diff --git a/target/linux/ath79/dts/ar9344_meraki_z1.dts b/target/linux/ath79/dts/ar9344_meraki_z1.dts new file mode 100644 index 00000000000000..80a11fee83d16c --- /dev/null +++ b/target/linux/ath79/dts/ar9344_meraki_z1.dts @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include "ar9344.dtsi" + +#include +#include + +/ { + compatible = "meraki,z1", "qca,ar9344"; + model = "Cisco Meraki Z1"; + + aliases { + led-boot = &led_power_orange; + led-failsafe = &led_power_orange; + led-upgrade = &led_power_orange; + label-mac-device = ð0; + }; + + chosen { + bootargs = "console=ttyS0,115200n8"; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "Reset button"; + linux,code = ; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power_orange: power_orange { + label = "orange:power"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&ref { + clock-frequency = <40000000>; +}; + +&gpio { + pinctrl-names = "default"; + pinctrl-0 = <&jtag_disable_pins>; + + gpio_ext_lna0 { + gpio-hog; + gpios = <18 0>; + output-low; + line-name = "z1:ext:lna0"; + }; + + gpio_ext_lna1 { + gpio-hog; + gpios = <19 0>; + output-low; + line-name = "z1:ext:lna1"; + }; +}; + +&usb { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&pcie { + status = "okay"; + + ath9k: wifi@0,0 { + compatible = "pci168c,002a"; /* check the pciid - AR9283 */ + reg = <0x0000 0 0 0 0>; + qca,no-eeprom; + }; +}; + +&wmac { + status = "okay"; +}; + +&nand { + status = "okay"; + + nand-ecc-mode = "soft"; + nand-ecc-algo = "bch"; + nand-is-boot-medium; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "loader1"; + reg = <0x0 0x20000>; + read-only; + }; + + partition@20000 { + label = "kernel"; + reg = <0x20000 0x7e0000>; + }; + + partition@800000 { + label = "loader2"; + reg = <0x800000 0x20000>; + read-only; + }; + + partition@820000 { + label = "recovery"; + reg = <0x820000 0x7e0000>; + }; + + partition@1000000 { + label = "ubi"; + reg = <0x1000000 0x6fe0000>; + }; + + partition@7fe0000 { + label = "origcaldata"; + reg = <0x7fe0000 0x20000>; + read-only; + }; + }; +}; + +&mdio0 { + status = "okay"; + + phy0: ethernet-phy@0 { + reg = <0>; + phy-mode = "rgmii"; + + qca,ar8327-initvals = < + 0x04 0x07600000 /* PORT0 PAD MODE CTRL */ + 0x7c 0x0000007e /* PORT0_STATUS */ + >; + }; +}; + +ð0 { + status = "okay"; + + pll-data = <0x06000000 0x00000101 0x00001313>; + phy-mode = "rgmii-id"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + + gmac-config { + device = <&gmac>; + rgmii-gmac0 = <1>; + switch-only-mode = <1>; + }; +}; diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk index d3c1120aa23ca0..9bcc460e4cd92e 100644 --- a/target/linux/ath79/image/nand.mk +++ b/target/linux/ath79/image/nand.mk @@ -19,6 +19,14 @@ define Build/meraki-header @mv $@.new $@ endef +define Build/meraki-old-nand + -$(STAGING_DIR_HOST)/bin/mkmerakifw-old \ + -B $(1) -s \ + -i $@ \ + -o $@.new + @mv $@.new $@ +endef + # attention: only zlib compression is allowed for the boot fs define Build/zyxel-buildkerneljffs mkdir -p $@.tmp/boot @@ -322,6 +330,20 @@ define Device/meraki_mr18 endef TARGET_DEVICES += meraki_mr18 +define Device/meraki_z1 + SOC = ar9344 + DEVICE_VENDOR := Meraki + DEVICE_MODEL := Z1 + DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport kmod-owl-loader \ + kmod-leds-uleds kmod-spi-gpio nu801 + KERNEL_SIZE := 8064k + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL := kernel-bin | meraki-old-nand z1 + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += meraki_z1 + # fake rootfs is mandatory, pad-offset 129 equals (2 * uimage_header + '\0') define Device/netgear_ath79_nand DEVICE_VENDOR := NETGEAR diff --git a/target/linux/ath79/nand/base-files/etc/board.d/01_leds b/target/linux/ath79/nand/base-files/etc/board.d/01_leds index ce22d0e3ce2200..a7b1fc932da089 100644 --- a/target/linux/ath79/nand/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/nand/base-files/etc/board.d/01_leds @@ -30,6 +30,9 @@ netgear,pgzng1) netgear,r6100) ucidef_set_led_netdev "wan-green" "WAN (green)" "green:wan" "eth1" ;; +meraki,z1) + ucidef_set_led_default "diag" "DIAG" "green:tricolor" "1" + ;; netgear,wndr3700-v4|\ netgear,wndr4300|\ netgear,wndr4300sw|\ diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network index b60586a15effa2..0130a94d6e8190 100644 --- a/target/linux/ath79/nand/base-files/etc/board.d/02_network +++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network @@ -44,6 +44,10 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "6@eth1" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" "0@eth0" ;; + meraki,z1) + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan" + ;; netgear,pgzng1) ucidef_set_interfaces_lan_wan "eth1" "eth0" ;; @@ -106,6 +110,10 @@ ath79_setup_macs() meraki,mr18) lan_mac=$(mtd_get_mac_binary_ubi board-config 102) ;; + meraki,z1) + lan_mac=$(mtd_get_mac_binary_ubi board-config 102) + wan_mac=$(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 1) + ;; netgear,wndr3700-v4|\ netgear,wndr4300|\ netgear,wndr4300sw|\ diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index ca722040f6ec05..69c552ed32e4bf 100644 --- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -19,6 +19,16 @@ case "$FIRMWARE" in fi ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 1) ;; + meraki,z1) + . /lib/upgrade/nand.sh + + if [ -n "$(nand_find_volume ubi0 caldata)" ]; then + caldata_extract_ubi "caldata" 0x1000 0x800 + else + caldata_extract "origcaldata" 0x1000 0x800 + ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 2) + fi + ;; *) caldata_die "board $board is not supported yet" ;; @@ -36,6 +46,16 @@ case "$FIRMWARE" in fi ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 2) ;; + meraki,z1) + . /lib/upgrade/nand.sh + + if [ -n "$(nand_find_volume ubi0 caldata)" ]; then + caldata_extract_ubi "caldata" 0x15000 0x1000 + else + caldata_extract "origcaldata" 0x15000 01000 + ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi board-config 102) 3) + fi + ;; *) caldata_die "board $board is not supported yet" ;;