From e519bee7c82124e38452bcd2e458d4b999425467 Mon Sep 17 00:00:00 2001 From: Arif Alam Date: Fri, 19 Jun 2020 14:02:32 +0200 Subject: [PATCH 15/40] ipq40xx: TP-Link AP2220 support Signed-off-by: Arif Alam --- package/firmware/ipq-wifi/Makefile | 4 +- .../ipq-wifi/board-tp-link_ap2220.bin | Bin 0 -> 65536 bytes .../ipq40xx/base-files/etc/board.d/02_network | 1 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 6 +- .../boot/dts/qcom-ipq4019-tp-link-ap2220.dts | 277 ++++++++++++++++++ target/linux/ipq40xx/image/Makefile | 13 + .../patches-4.14/998-tp-link-ap2220.patch | 12 + .../patches-4.14/999-mtd-gd25q256.patch | 28 ++ 8 files changed, 338 insertions(+), 3 deletions(-) create mode 100755 package/firmware/ipq-wifi/board-tp-link_ap2220.bin create mode 100755 target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-tp-link-ap2220.dts create mode 100755 target/linux/ipq40xx/patches-4.14/998-tp-link-ap2220.patch create mode 100755 target/linux/ipq40xx/patches-4.14/999-mtd-gd25q256.patch diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile index 1609d7a42d..4ca6adf324 100644 --- a/package/firmware/ipq-wifi/Makefile +++ b/package/firmware/ipq-wifi/Makefile @@ -35,7 +35,8 @@ ALLWIFIBOARDS:= \ engenius_ens620ext \ linksys_ea6350v3 \ linksys_ea8300 \ - qxwlan_e2600ac + qxwlan_e2600ac \ + tp-link_ap2220 ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ipq-wifi-$(BOARD)) @@ -110,5 +111,6 @@ $(eval $(call generate-ipq-wifi-package,engenius_ens620ext,EnGenius ENS620EXT)) $(eval $(call generate-ipq-wifi-package,linksys_ea6350v3,Linksys EA6350v3)) $(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300)) $(eval $(call generate-ipq-wifi-package,qxwlan_e2600ac,Qxwlan E2600AC)) +$(eval $(call generate-ipq-wifi-package,tp-link_ap2220,tp-link AP2220)) $(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE)))) diff --git a/package/firmware/ipq-wifi/board-tp-link_ap2220.bin b/package/firmware/ipq-wifi/board-tp-link_ap2220.bin new file mode 100755 index 0000000000000000000000000000000000000000..cfe31877d8c96f07faeb7fc80454017ca693b5c2 GIT binary patch literal 65536 zcmeI5dr(tJzQ;Quh$0Ro1O&lD2;n6dG@wR}10rI87#LJEfCxTNq96}JF}R>8AVzQy zln|nTpn^`8VYuUCR9wf|yIVC<`^VO;t-H1E+`4!7k2|;A9ml$B)t!~wC&?ipBp3v0 zc>Fq?)4%?m?$h0$bCR5#KHp|&2m%lQ0zd!=00AHX1b_e#00KY&2mk>fFxv@m!o0I+ zG-OxKibz3-gO;@+8p=e-(ZL0gfsK$$xXxmrt(&BKq>0=2#3t^L#^`(q1qX9!Ix{>x z{LSmvG!c6qdi$UCk3e`kD}VOz<{CN*~cW&2v*}XLOpg5p9fNAQ!`n z+CsLGvW;=%hqu_c6Kpx^QeS_|KpevhJ2*P0VZ~;drXtx64i5JA_I4%#p~qxTZ47QW zpXuU`)254!yBW^rjKgqZh8y{HcTL{PBRliz*7GX$?$TAMOJ9C=x3YG3>dH8uCq3%w z+QOVq;#NPogRP>Rchj)&v zwq96%+&lYzd0GCJ^dRx#h_C9Td7)`uV%EA_H*=cBwIRp74n6p+$Y$%U*hz%=;t zaL_p>%i?mmhW$;@vc!f-Fqs>Pjm(wAN@jlX$?~)3>n=BsHV{{&4;{mX!6AAyhQT6O zeAc%t<`QBFe~H9}aAA57(L^*q`rBw`JQ2^2mqZa!OfexK1bo4_0_Hkm9e9A}f9#ylbbK)k|FOg`tizCh9%8Wf0%@)&@aDC;<^dh|YUXo43rdOMo2}A-v zK@v`czY1rrC)V@VOY{f9bnQ(dX&-w{W-(BDG!dITck|C{?wT(C6AaY%inZ9%`{hG@ zv*DT)`e4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jTG;GkdIGsr2~-=Al+HXro=77iu2W)XomZ{Ci?S>8yj!j=*e1J~7UqZP|2bsa zxnr*7tkr_m%#T^AE#zzT{$C?M^aEOoUL#-h7RPq@YcTQfJlci} z#yJ3ZJU{&B&-L}iGbwU?&5~wwESe?FGMgpMGMgo>eIr}AWdtrD00e*l5C8%|00;m9 zAOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=00AHX1b_e#00KY&2mk>f00e*l5C8%|00;m9 tAOHk_01yBIKmZ5;0U!VbfB+Bx0zd!=00AHX1b_e#00KY&2uv!0{|8`OD9``^ literal 0 HcmV?d00001 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 6e0fb52ab4..c191812191 100755 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -45,6 +45,7 @@ ipq40xx_setup_interfaces() meraki,mr33|\ netgear,ex6100v2|\ netgear,ex6150v2|\ + tp-link,ap2220|\ zyxel,wre6606) ucidef_set_interface_lan "eth0" ;; 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 7d2e173e1a..9b11674b02 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 @@ -123,7 +123,8 @@ case "$FIRMWARE" in # OEM assigns 4 sequential MACs ath10kcal_patch_mac_crc $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4)) ;; - openmesh,a62) + openmesh,a62 |\ + tp-link,ap2220) ath10kcal_extract "0:ART" 36864 12064 ;; esac @@ -163,7 +164,8 @@ case "$FIRMWARE" in openmesh,a42 |\ openmesh,a62 |\ qxwlan,e2600ac-c1 |\ - qxwlan,e2600ac-c2) + qxwlan,e2600ac-c2 |\ + tp-link,ap2220) ath10kcal_extract "0:ART" 4096 12064 ;; engenius,ens620ext) diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-tp-link-ap2220.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-tp-link-ap2220.dts new file mode 100755 index 0000000000..fc35bcacbd --- /dev/null +++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-tp-link-ap2220.dts @@ -0,0 +1,277 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qcom-ipq4019.dtsi" +#include +#include +#include + +/ { + model = "tp-link AP2220"; + compatible = "tp-link,ap2220"; + + aliases { + led-boot = &led_green; + led-failsafe = &led_green; + led-running = &led_green; + led-upgrade = &led_green; + }; + + 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 = ; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + switch_mac_mode = <0x0>; /* mac mode for RGMII RMII */ + switch_initvlas = <0x0007c 0x54>; /* port0 status */ + switch_lan_bmp = <0x10>; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + key { + compatible = "gpio-keys"; + + button@1 { + label = "reset"; + linux,code = ; + gpios = <&tlmm 10 GPIO_ACTIVE_LOW>; + linux,input-type = <1>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_red { + label = "red"; + gpios = <&tlmm 20 GPIO_ACTIVE_LOW>; + }; + + led_green: power { + label = "green"; + gpios = <&tlmm 21 GPIO_ACTIVE_LOW>; + }; + + led_blue { + label = "blue"; + gpios = <&tlmm 24 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&tlmm { + serial_0_pins: serial_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pinmux { + function = "blsp_spi0"; + pins = "gpio13", "gpio14", "gpio15"; + drive-strength = <12>; + bias-disable; + }; + + pinmux_cs { + function = "gpio"; + pins = "gpio12"; + drive-strength = <2>; + bias-disable; + output-high; + }; + }; + + nand_pins: nand_pins { + pullups { + pins = "gpio53", "gpio58", "gpio59"; + function = "qpic"; + bias-pull-up; + }; + + pulldowns { + pins = "gpio54", "gpio55", "gpio56", + "gpio57", "gpio60", "gpio61", + "gpio62", "gpio63", "gpio64", + "gpio65", "gpio66", "gpio67", + "gpio68", "gpio69"; + function = "qpic"; + bias-pull-down; + }; + }; +}; + +&cryptobam { + status = "okay"; +}; + +&blsp1_spi1 { + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + status = "okay"; + cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + linux,modalias = "m25p80", "gd25q256"; + spi-max-frequency = <24000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition0@0 { + label = "0:SBL1"; + reg = <0x00000000 0x00040000>; + read-only; + }; + partition1@40000 { + label = "0:MIBIB"; + reg = <0x00040000 0x00020000>; + read-only; + }; + partition2@60000 { + label = "0:QSEE"; + reg = <0x00060000 0x00060000>; + read-only; + }; + partition3@c0000 { + label = "0:CDT"; + reg = <0x000c0000 0x00010000>; + read-only; + }; + partition4@d0000 { + label = "0:DDRPARAMS"; + reg = <0x000d0000 0x00010000>; + read-only; + }; + partition5@e0000 { + label = "0:APPSBLENV"; + reg = <0x000e0000 0x00010000>; + read-only; + }; + partition6@f0000 { + label = "0:APPSBL"; + reg = <0x000f0000 0x00080000>; + read-only; + }; + partition7@170000 { + label = "0:ART"; + reg = <0x00170000 0x00010000>; + read-only; + }; + partition8@180000 { + compatible = "denx,fit"; + label = "firmware"; + //32M + reg = <0x00180000 0x01e80000>; + }; + }; + }; +}; + +&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 = "rootfs1"; + reg = <0x00000000 0x10000000>; + }; + }; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_uart1 { + pinctrl-0 = <&serial_0_pins>; + pinctrl-names = "default"; + status = "okay"; +}; + +&qpic_bam { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + qcom,ath10k-calibration-variant = "tp-link AP2220"; +}; + +&wifi1 { + status = "disabled"; + qcom,ath10k-calibration-variant = "tp-link AP2220"; +}; + +&pcie0 { + status = "okay"; + perst-gpio = <&tlmm 38 GPIO_ACTIVE_LOW>; + wake-gpio = <&tlmm 40 GPIO_ACTIVE_LOW>; + + bridge@0,0 { + reg = <0x00000000 0 0 0 0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + wifi2: wifi@1,0 { + compatible = "qcom,ath10k"; + status = "okay"; + reg = <0x00010000 0 0 0 0>; + qcom,ath10k-calibration-variant = "tp-link AP2220"; + }; + }; +}; + diff --git a/target/linux/ipq40xx/image/Makefile b/target/linux/ipq40xx/image/Makefile index 553ac66fa3..10ba4dcbab 100644 --- a/target/linux/ipq40xx/image/Makefile +++ b/target/linux/ipq40xx/image/Makefile @@ -399,6 +399,19 @@ define Device/qxwlan_e2600ac-c2 endef TARGET_DEVICES += qxwlan_e2600ac-c2 +define Device/tp-link_ap2220 + $(call Device/FitImage) + DEVICE_TITLE := tp-link AP2220 + BOARD_NAME := ap2220 + DEVICE_DTS := qcom-ipq4019-tp-link-ap2220 + KERNEL_SIZE := 4096k + IMAGE_SIZE := 26624k + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := append-kernel |append-rootfs | pad-rootfs | append-metadata + DEVICE_PACKAGES := ath10k-firmware-qca9984-ct ipq-wifi-tp-link_ap2220 +endef +TARGET_DEVICES += tp-link_ap2220 + define Device/zyxel_nbg6617 $(call Device/FitImageLzma) DEVICE_DTS := qcom-ipq4018-nbg6617 diff --git a/target/linux/ipq40xx/patches-4.14/998-tp-link-ap2220.patch b/target/linux/ipq40xx/patches-4.14/998-tp-link-ap2220.patch new file mode 100755 index 0000000000..4bb0566493 --- /dev/null +++ b/target/linux/ipq40xx/patches-4.14/998-tp-link-ap2220.patch @@ -0,0 +1,12 @@ +Index: linux-4.14.171/arch/arm/boot/dts/Makefile +=================================================================== +--- linux-4.14.171.orig/arch/arm/boot/dts/Makefile ++++ linux-4.14.171/arch/arm/boot/dts/Makefile +@@ -715,6 +715,7 @@ dtb-$(CONFIG_ARCH_QCOM) += \ + qcom-ipq4019-fritzbox-7530.dtb \ + qcom-ipq4019-fritzrepeater-1200.dtb \ + qcom-ipq4019-fritzrepeater-3000.dtb \ ++ qcom-ipq4019-tp-link-ap2220.dtb \ + qcom-ipq4019-linksys_ea8300.dtb \ + qcom-ipq4019-map-ac2200.dtb \ + qcom-ipq4019-qxwlan-e2600ac-c1.dtb \ diff --git a/target/linux/ipq40xx/patches-4.14/999-mtd-gd25q256.patch b/target/linux/ipq40xx/patches-4.14/999-mtd-gd25q256.patch new file mode 100755 index 0000000000..0baa38ad29 --- /dev/null +++ b/target/linux/ipq40xx/patches-4.14/999-mtd-gd25q256.patch @@ -0,0 +1,28 @@ +Index: linux-4.14.171/drivers/mtd/devices/m25p80.c +=================================================================== +--- linux-4.14.171.orig/drivers/mtd/devices/m25p80.c ++++ linux-4.14.171/drivers/mtd/devices/m25p80.c +@@ -354,6 +354,7 @@ static const struct spi_device_id m25p_i + {"m25p64"}, {"m25p128"}, + {"w25x80"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, + {"w25q80bl"}, {"w25q128"}, {"w25q256"}, ++ {"gd25q256"}, + + /* Flashes that can't be detected using JEDEC */ + {"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"}, +Index: linux-4.14.171/drivers/mtd/spi-nor/spi-nor.c +=================================================================== +--- linux-4.14.171.orig/drivers/mtd/spi-nor/spi-nor.c ++++ linux-4.14.171/drivers/mtd/spi-nor/spi-nor.c +@@ -1005,6 +1005,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) + }, ++ { ++ "gd25q256", INFO(0xc84019, 0, 64 * 1024, 512, ++ SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | ++ SPI_NOR_4B_OPCODES | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) ++ }, + + /* Intel/Numonyx -- xxxs33b */ + { "160s33b", INFO(0x898911, 0, 64 * 1024, 32, 0) }, -- 2.25.1