diff options
Diffstat (limited to 'target/linux/ipq40xx')
9 files changed, 392 insertions, 5 deletions
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 b2545f41e1..8942ad2000 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds +++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds @@ -45,6 +45,14 @@ engenius,ens620ext) ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "eth0" ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth1" ;; +mikrotik,hap-ac3) + ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1" + ucidef_set_led_switch "lan1" "LAN1" "green:lan1" "switch0" "0x10" + ucidef_set_led_switch "lan2" "LAN2" "green:lan2" "switch0" "0x08" + ucidef_set_led_switch "lan3" "LAN3" "green:lan3" "switch0" "0x04" + ucidef_set_led_switch "lan4" "LAN4" "green:lan4" "switch0" "0x02" + ucidef_set_led_gpio "poe" "POE" "red:poe" "452" "0" + ;; mikrotik,sxtsq-5-ac) ucidef_set_rssimon "wlan0" "200000" "1" ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100" 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 5d123109a2..7ccdf97a60 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/02_network +++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network @@ -50,6 +50,7 @@ ipq40xx_setup_interfaces() ;; asus,rt-ac58u|\ mikrotik,hap-ac2|\ + mikrotik,hap-ac3|\ p2w,r619ac-64m|\ p2w,r619ac-128m|\ zyxel,nbg6617) @@ -182,7 +183,8 @@ ipq40xx_setup_macs() wan_mac=$(mtd_get_mac_ascii devinfo hw_mac_addr) lan_mac=$(macaddr_add "$wan_mac" 1) ;; - mikrotik,hap-ac2) + mikrotik,hap-ac2|\ + mikrotik,hap-ac3) wan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base) lan_mac=$(macaddr_add $wan_mac 1) label_mac="$wan_mac" diff --git a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches index 9029eb3a82..4036e5356f 100644 --- a/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/ipq40xx/base-files/etc/board.d/03_gpio_switches @@ -18,6 +18,9 @@ cilab,meshpoint-one) compex,wpj428) ucidef_add_gpio_switch "sim_card_select" "SIM card select" "3" "0" ;; +mikrotik,hap-ac3) + ucidef_add_gpio_switch "poe_passtrough" "PoE Passthrough" "452" "0" + ;; esac board_config_flush 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 f90c558015..1e1b445924 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 @@ -149,7 +149,8 @@ case "$FIRMWARE" in caldata_valid "202f" || caldata_extract "ART" 0x1000 0x2f20 ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) 2) ;; - mikrotik,hap-ac2) + mikrotik,hap-ac2 |\ + mikrotik,hap-ac3) wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data" ( [ -f "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data" 0x0 0x2f20 ) || \ ( [ -d "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data/data_0" 0x0 0x2f20 ) @@ -266,7 +267,8 @@ case "$FIRMWARE" in caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20 ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) 3) ;; - mikrotik,hap-ac2|\ + mikrotik,hap-ac2 |\ + mikrotik,hap-ac3 |\ mikrotik,sxtsq-5-ac) wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data" ( [ -f "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data" 0x8000 0x2f20 ) || \ diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh index 605b1e7881..02833ebc3d 100644 --- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh @@ -55,6 +55,24 @@ zyxel_do_upgrade() { fi } +platform_do_upgrade_mikrotik_nand() { + local fw_mtd=$(find_mtd_part kernel) + fw_mtd="${fw_mtd/block/}" + [ -n "$fw_mtd" ] || return + + local board_dir=$(tar tf "$1" | grep -m 1 '^sysupgrade-.*/$') + board_dir=${board_dir%/} + [ -n "$board_dir" ] || return + + local kernel_len=$(tar xf "$1" ${board_dir}/kernel -O | wc -c) + [ -n "$kernel_len" ] || return + + tar xf "$1" ${board_dir}/kernel -O | ubiformat "$fw_mtd" -y -S $kernel_len -f - + + CI_KERNPART="none" + nand_do_upgrade "$1" +} + platform_do_upgrade() { case "$(board_name)" in 8dev,jalapeno |\ @@ -119,6 +137,9 @@ platform_do_upgrade() { [ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware default_do_upgrade "$1" ;; + mikrotik,hap-ac3) + platform_do_upgrade_mikrotik_nand "$1" + ;; netgear,rbr50 |\ netgear,rbs50 |\ netgear,srr60 |\ diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hap-ac3.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hap-ac3.dts new file mode 100644 index 0000000000..9aa58ffcb4 --- /dev/null +++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4019-hap-ac3.dts @@ -0,0 +1,328 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* Copyright (c) 2021, Robert Marko <robimarko@gmail.com> */ + +#include "qcom-ipq4019.dtsi" +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/soc/qcom,tcsr.h> + +/ { + model = "MikroTik hAP ac3"; + compatible = "mikrotik,hap-ac3"; + + memory { + device_type = "memory"; + reg = <0x80000000 0x10000000>; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + aliases { + led-boot = &led_status_blue; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_red; + }; + + soc { + rng@22000 { + status = "okay"; + }; + + counter@4a1000 { + compatible = "qcom,qca-gcnt"; + reg = <0x4a1000 0x4>; + }; + + tcsr@1949000 { + compatible = "qcom,tcsr"; + reg = <0x1949000 0x100>; + qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>; + }; + + tcsr@194b000 { + /* select hostmode */ + compatible = "qcom,tcsr"; + reg = <0x194b000 0x100>; + qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>; + status = "okay"; + }; + + ess_tcsr@1953000 { + compatible = "qcom,tcsr"; + reg = <0x1953000 0x1000>; + qcom,ess-interface-select = <TCSR_ESS_PSGMII>; + }; + + tcsr@1957000 { + compatible = "qcom,tcsr"; + reg = <0x1957000 0x100>; + qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>; + }; + + usb2: usb2@60f8800 { + status = "okay"; + }; + + crypto@8e3a000 { + status = "okay"; + }; + + watchdog@b017000 { + status = "okay"; + }; + + ess-switch@c000000 { + status = "okay"; + }; + + edma@c080000 { + status = "okay"; + }; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&tlmm 5 GPIO_ACTIVE_LOW>; + linux,code = <KEY_RESTART>; + }; + + mode { + label = "mode"; + gpios = <&tlmm 4 GPIO_ACTIVE_LOW>; + linux,code = <KEY_RFKILL>; + }; + + led { + label = "led"; + gpios = <&tlmm 42 GPIO_ACTIVE_LOW>; + linux,code = <KEY_WPS_BUTTON>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status_blue: status-blue { + label = "blue:status"; + gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>; + }; + + led_status_red: status-red { + label = "red:status"; + gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + + led_status_green: status-green { + label = "green:status"; + gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>; + }; + + wlan { + label = "green:wlan"; + gpios = <&tlmm 23 GPIO_ACTIVE_HIGH>; + }; + + ethernet { + label = "green:ethernet"; + gpios = <&tlmm 22 GPIO_ACTIVE_HIGH>; + }; + + wan { + label = "green:wan"; + gpios = <&tlmm 28 GPIO_ACTIVE_HIGH>; + }; + + lan1 { + label = "green:lan1"; + gpios = <&tlmm 29 GPIO_ACTIVE_HIGH>; + }; + + lan2 { + label = "green:lan2"; + gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>; + }; + + lan3 { + label = "green:lan3"; + gpios = <&tlmm 31 GPIO_ACTIVE_HIGH>; + }; + + lan4 { + label = "green:lan4"; + gpios = <&tlmm 32 GPIO_ACTIVE_HIGH>; + }; + + poe { + label = "red:poe"; + gpios = <&tlmm 36 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&tlmm { + serial_pins: serial_pinmux { + mux { + pins = "gpio16", "gpio17"; + function = "blsp_uart0"; + bias-disable; + }; + }; + + spi_0_pins: spi_0_pinmux { + pin { + function = "blsp_spi0"; + pins = "gpio13", "gpio14", "gpio15"; + drive-strength = <12>; + bias-disable; + }; + + pin_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 = "gpio55", "gpio56", "gpio57", "gpio60", + "gpio62", "gpio63", "gpio64", "gpio65", + "gpio66", "gpio67", "gpio68", "gpio69"; + function = "qpic"; + bias-pull-down; + }; + }; + + enable-usb-power { + gpio-hog; + gpios = <44 GPIO_ACTIVE_HIGH>; + output-high; + line-name = "enable USB power"; + }; +}; + +&blsp_dma { + status = "okay"; +}; + +&blsp1_spi1 { + status = "okay"; + + pinctrl-0 = <&spi_0_pins>; + pinctrl-names = "default"; + cs-gpios = <&tlmm 12 GPIO_ACTIVE_HIGH>; + + flash@0 { + reg = <0>; + compatible = "jedec,spi-nor"; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "Qualcomm"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + label = "RouterBoot"; + reg = <0x80000 0x80000>; + read-only; + + hard_config { + read-only; + size = <0x2000>; + }; + + dtb_config { + read-only; + }; + + soft_config { + }; + }; + }; + }; +}; + +&qpic_bam { + status = "okay"; +}; + +&nand { + status = "okay"; + + pinctrl-0 = <&nand_pins>; + pinctrl-names = "default"; + + nand@0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0xa00000>; + }; + + partition@a00000 { + label = "ubi"; + reg = <0xa00000 0x7600000>; + }; + }; + }; +}; + +&blsp1_uart1 { + status = "okay"; + + pinctrl-0 = <&serial_pins>; + pinctrl-names = "default"; +}; + +&cryptobam { + status = "okay"; +}; + +&usb2_hs_phy { + status = "okay"; +}; + +&mdio { + status = "okay"; +}; + +&wifi0 { + status = "okay"; + + qcom,ath10k-calibration-variant = "MikroTik-hAP-ac3"; +}; + +&wifi1 { + status = "okay"; + + qcom,ath10k-calibration-variant = "MikroTik-hAP-ac3"; +}; diff --git a/target/linux/ipq40xx/image/mikrotik.mk b/target/linux/ipq40xx/image/mikrotik.mk index 31497608be..bfff58597f 100644 --- a/target/linux/ipq40xx/image/mikrotik.mk +++ b/target/linux/ipq40xx/image/mikrotik.mk @@ -10,6 +10,16 @@ define Device/mikrotik_nor check-size | append-metadata endef +define Device/mikrotik_nand + DEVICE_VENDOR := MikroTik + KERNEL_NAME := vmlinux + KERNEL_INITRAMFS := kernel-bin | append-dtb-elf + KERNEL := kernel-bin | append-dtb-elf | package-kernel-ubifs | \ + ubinize-kernel + IMAGES := nand-sysupgrade.bin + IMAGE/nand-sysupgrade.bin := sysupgrade-tar | append-metadata +endef + define Device/mikrotik_hap-ac2 $(call Device/mikrotik_nor) DEVICE_MODEL := hAP ac2 @@ -19,6 +29,17 @@ define Device/mikrotik_hap-ac2 endef TARGET_DEVICES += mikrotik_hap-ac2 +define Device/mikrotik_hap-ac3 + $(call Device/mikrotik_nand) + DEVICE_MODEL := hAP ac3 + SOC := qcom-ipq4019 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_UBIFS_OPTS = -m $$(PAGESIZE) -e 124KiB -c $$(PAGESIZE) -x none + DEVICE_PACKAGES := kmod-ledtrig-gpio ipq-wifi-mikrotik_hap-ac3 +endef +TARGET_DEVICES += mikrotik_hap-ac3 + define Device/mikrotik_sxtsq-5-ac $(call Device/mikrotik_nor) DEVICE_MODEL := SXTsq 5 ac (RBSXTsqG-5acD) diff --git a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch index 436f5a74f5..69ba9e4a43 100644 --- a/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-5.10/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org> --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -902,11 +902,67 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -902,11 +902,68 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -55,6 +55,7 @@ Signed-off-by: John Crispin <john@phrozen.org> + qcom-ipq4019-fritzrepeater-1200.dtb \ + qcom-ipq4019-fritzrepeater-3000.dtb \ + qcom-ipq4019-habanero-dvk.dtb \ ++ qcom-ipq4019-hap-ac3.dtb \ + qcom-ipq4019-map-ac2200.dtb \ + qcom-ipq4019-mr8300.dtb \ + qcom-ipq4019-pa2200.dtb \ diff --git a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch index bb63c1c4fb..0846c6668c 100644 --- a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch +++ b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch @@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@phrozen.org> --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -837,11 +837,65 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -837,11 +837,66 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8074-dragonboard.dtb \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ @@ -52,6 +52,7 @@ Signed-off-by: John Crispin <john@phrozen.org> + qcom-ipq4019-fritzbox-7530.dtb \ + qcom-ipq4019-fritzrepeater-1200.dtb \ + qcom-ipq4019-fritzrepeater-3000.dtb \ ++ qcom-ipq4019-hap-ac3.dtb \ + qcom-ipq4019-map-ac2200.dtb \ + qcom-ipq4019-mr8300.dtb \ + qcom-ipq4019-e2600ac-c1.dtb \ |