[openwrt/openwrt] ath79: support Ruckus ZoneFlex 7372

LEDE Commits lede-commits at lists.infradead.org
Sat Sep 10 16:53:48 PDT 2022


hauke pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/59cb4dc91d500edc2e6b462e223e367806557cc5

commit 59cb4dc91d500edc2e6b462e223e367806557cc5
Author: Lech Perczak <lech.perczak at gmail.com>
AuthorDate: Sun May 22 17:46:28 2022 +0200

    ath79: support Ruckus ZoneFlex 7372
    
    Ruckus ZoneFlex 7372 is a dual-band, dual-radio 802.11n 2x2 MIMO enterprise
    access point.
    
    Ruckus ZoneFlex 7352 is also supported, lacking the 5GHz radio part.
    
    Hardware highligts:
    - CPU: Atheros AR9344 SoC at 560 MHz
    - RAM: 128MB DDR2
    - Flash: 32MB SPI-NOR
    - Wi-Fi 2.4GHz: AR9344 built-in 2x2 MIMO radio
    - Wi-Fi 5Ghz: AR9582 2x2 MIMO radio (Only in ZF7372)
    - Antennas:
      - Separate internal active antennas with beamforming support on both
        bands with 7 elements per band, each controlled by 74LV164 GPIO
        expanders, attached to GPIOs of each radio.
      - Two dual-band external RP-SMA antenna connections on "7372-E"
        variant.
    - Ethernet 1: single Gigabit Ethernet port through AR8035 gigabit PHY
    - Ethernet 2: single Fast Ethernet port through AR9344 built-in switch
    - PoE: input through Gigabit port
    - Standalone 12V/1A power input
    - USB: optional single USB 2.0 host port on "-U" variants.
    
    The same image should support:
    - ZoneFlex 7372E (variant with external antennas, without beamforming
      capability)
    - ZoneFlex 7352 (single-band, 2.4GHz-only variant).
    
    which are based on same baseboard (codename St. Bernard),
    with different populated components.
    
    Serial console: 115200-8-N-1 on internal H1 header.
    Pinout:
    
    H1
    ---
    |5|
    ---
    |4|
    ---
    |3|
    ---
    |x|
    ---
    |1|
    ---
    
    Pin 5 is near the "H1" marking.
    1 - RX
    x - no pin
    3 - VCC (3.3V)
    4 - GND
    5 - TX
    
    JTAG: Connector H2, similar to MIPS eJTAG, standard,
    but without the key in pin 12 and not every pin routed:
    
    ------- H2
    |1 |2 |
    -------
    |3 |4 |
    -------
    |5 |6 |
    -------
    |7 |8 |
    -------
    |9 |10|
    -------
    |11|12|
    -------
    |13|14|
    -------
    
    3 - TDI
    5 - TDO
    7 - TMS
    9 - TCK
    2,4,6,8,10 - GND
    14 - Vref
    1,11,12,13 - Not connected
    
    Installation:
    There are two methods of installation:
    - Using serial console [1] - requires some disassembly, 3.3V USB-Serial
      adapter, TFTP server,  and removing a single T10 screw,
      but with much less manual steps, and is generally recommended, being
      safer.
    - Using stock firmware root shell exploit, SSH and TFTP [2]. Does not
      work on some rare versions of stock firmware. A more involved, and
      requires installing `mkenvimage` from u-boot-tools package if you
      choose to rebuild your own environment, but can be used without
      disassembly or removal from installation point, if you have the
      credentials.
      If for some reason, size of your sysupgrade image exceeds 13312kB,
      proceed with method [1]. For official images this is not likely to
      happen ever.
    
    [1] Using serial console:
    0. Connect serial console to H1 header. Ensure the serial converter
       does not back-power the board, otherwise it will fail to boot.
    
    1. Power-on the board. Then quickly connect serial converter to PC and
       hit Ctrl+C in the terminal to break boot sequence. If you're lucky,
       you'll enter U-boot shell. Then skip to point 3.
       Connection parameters are 115200-8-N-1.
    
    2. Allow the board to boot.  Press the reset button, so the board
       reboots into U-boot again and go back to point 1.
    
    3. Set the "bootcmd" variable to disable the dual-boot feature of the
       system and ensure that uImage is loaded. This is critical step, and
       needs to be done only on initial installation.
    
       > setenv bootcmd "bootm 0x9f040000"
       > saveenv
    
    4. Boot the OpenWrt initramfs using TFTP. Replace IP addresses as needed:
    
       > setenv serverip 192.168.1.2
       > setenv ipaddr 192.168.1.1
       > tftpboot 0x81000000 openwrt-ath79-generic-ruckus_zf7372-initramfs-kernel.bin
       > bootm 0x81000000
    
    5. Optional, but highly recommended: back up contents of "firmware" partition:
    
       $ ssh root at 192.168.1.1 cat /dev/mtd1 > ruckus_zf7372_fw1_backup.bin
       $ ssh root at 192.168.1.1 cat /dev/mtd5 > ruckus_zf7372_fw2_backup.bin
    
    6. Copy over sysupgrade image, and perform actual installation. OpenWrt
       shall boot from flash afterwards:
    
       $ ssh root at 192.168.1.1
       # sysupgrade -n openwrt-ath79-generic-ruckus_zf7372-squashfs-sysupgrade.bin
    
    [2] Using stock root shell:
    0. Reset the device to factory defaullts. Power-on the device and after
       it boots, hold the reset button near Ethernet connectors for 5
       seconds.
    
    1. Connect the device to the network. It will acquire address over DHCP,
       so either find its address using list of DHCP leases by looking for
       label MAC address, or try finding it by scanning for SSH port:
    
       $ nmap 10.42.0.0/24 -p22
    
       From now on, we assume your computer has address 10.42.0.1 and the device
       has address 10.42.0.254.
    
    2. Set up a TFTP server on your computer. We assume that TFTP server
       root is at /srv/tftp.
    
    3. Obtain root shell. Connect to the device over SSH. The SSHD ond the
       frmware is pretty ancient and requires enabling HMAC-MD5.
    
       $ ssh 10.42.0.254 \
       -o UserKnownHostsFile=/dev/null \
       -o StrictHostKeyCheking=no \
       -o MACs=hmac-md5
    
       Login. User is "super", password is "sp-admin".
       Now execute a hidden command:
    
       Ruckus
    
       It is case-sensitive. Copy and paste the following string,
       including quotes. There will be no output on the console for that.
    
       ";/bin/sh;"
    
       Hit "enter". The AP will respond with:
    
       grrrr
       OK
    
       Now execute another hidden command:
    
       !v54!
    
       At "What's your chow?" prompt just hit "enter".
       Congratulations, you should now be dropped to Busybox shell with root
       permissions.
    
    4. Optional, but highly recommended: backup the flash contents before
       installation. At your PC ensure the device can write the firmware
       over TFTP:
    
       $ sudo touch /srv/tftp/ruckus_zf7372_firmware{1,2}.bin
       $ sudo chmod 666 /srv/tftp/ruckus_zf7372_firmware{1,2}.bin
    
       Locate partitions for primary and secondary firmware image.
       NEVER blindly copy over MTD nodes, because MTD indices change
       depending on the currently active firmware, and all partitions are
       writable!
    
       # grep rcks_wlan /proc/mtd
    
       Copy over both images using TFTP, this will be useful in case you'd
       like to return to stock FW in future. Make sure to backup both, as
       OpenWrt uses bot firmwre partitions for storage!
    
       # tftp -l /dev/<rcks_wlan.main_mtd> -r ruckus_zf7372_firmware1.bin -p 10.42.0.1
       # tftp -l /dev/<rcks_wlan.bkup_mtd> -r ruckus_zf7372_firmware2.bin -p 10.42.0.1
    
       When the command finishes, copy over the dump to a safe place for
       storage.
    
       $ cp /srv/tftp/ruckus_zf7372_firmware{1,2}.bin ~/
    
    5. Ensure the system is running from the BACKUP image, i.e. from
       rcks_wlan.bkup partition or "image 2". Otherwise the installation
       WILL fail, and you will need to access mtd0 device to write image
       which risks overwriting the bootloader, and so is not covered here
       and not supported.
    
       Switching to backup firmware can be achieved by executing a few
       consecutive reboots of the device, or by updating the stock firmware. The
       system will boot from the image it was not running from previously.
       Stock firmware available to update was conveniently dumped in point 4 :-)
    
    6. Prepare U-boot environment image.
       Install u-boot-tools package. Alternatively, if you build your own
       images, OpenWrt provides mkenvimage in host staging directory as well.
       It is recommended to extract environment from the device, and modify
       it, rather then relying on defaults:
    
       $ sudo touch /srv/tftp/u-boot-env.bin
       $ sudo chmod 666 /srv/tftp/u-boot-env.bin
    
       On the device, find the MTD partition on which environment resides.
       Beware, it may change depending on currently active firmware image!
    
       # grep u-boot-env /proc/mtd
    
       Now, copy over the partition
    
       # tftp -l /dev/mtd<N> -r u-boot-env.bin -p 10.42.0.1
    
       Store the stock environment in a safe place:
    
       $ cp /srv/tftp/u-boot-env.bin ~/
    
       Extract the values from the dump:
    
       $ strings u-boot-env.bin | tee u-boot-env.txt
    
       Now clean up the debris at the end of output, you should end up with
       each variable defined once. After that, set the bootcmd variable like
       this:
    
       bootcmd=bootm 0x9f040000
    
       You should end up with something like this:
    
    bootcmd=bootm 0x9f040000
    bootargs=console=ttyS0,115200 rootfstype=squashfs init=/sbin/init
    baudrate=115200
    ethaddr=0x00:0xaa:0xbb:0xcc:0xdd:0xee
    bootdelay=2
    mtdids=nor0=ar7100-nor0
    mtdparts=mtdparts=ar7100-nor0:256k(u-boot),13312k(rcks_wlan.main),2048k(datafs),256k(u-boot-env),512k(Board Data),13312k(rcks_wlan.bkup)
    ethact=eth0
    filesize=1000000
    fileaddr=81000000
    ipaddr=192.168.0.7
    serverip=192.168.0.51
    partition=nor0,0
    mtddevnum=0
    mtddevname=u-boot
    stdin=serial
    stdout=serial
    stderr=serial
    
       These are the defaults, you can use most likely just this as input to
       mkenvimage.
    
       Now, create environment image and copy it over to TFTP root:
    
       $ mkenvimage -s 0x40000 -b -o u-boot-env.bin u-boot-env.txt
       $ sudo cp u-boot-env.bin /srv/tftp
    
       This is the same image, gzipped and base64-encoded:
    
    H4sIAAAAAAAAA+3QTW7TQBQAYB+AQ2TZSGk6Tpv+SbNBrNhyADSJHWolsYPtlJaDcAWOCXaqQhdIXOD7
    Fm/ee+MZ+/nHu58fV03Tr/dFHNf9JDzdbcJVGGRjI7Vfurhu6q7ZlbHvnz+FWZ4vFyFM2mF30/XPhzJ2
    X4+pe9h0k6qu+njRrar6YkyzVToWberL+HImK/uHVBRtDE8h3IenlIawWg1hvR5CUQyhLE/vLcpdeo6L
    bN8XVdHFumlDTO1NHsL5mI/9Q2r7Lv5J3uzeL5bX27Pj+XjRdJZfXuaL7Vm73nafv+1SPd+nqp7OFuHq
    dntWpD5tuqH6e+K8rB+ns+V45n2T2mLyYXjmH9estsfD9DTSuo/DErJNtSu76vswbjg5NU4D3752qsOp
    zu8W8/z6dh7mN1lXto9lWx3eNJd5Ng5V9VVTn2afnSYuysf6uI9/8rQv48s3Z93wn+o4XFWl3Vg0x/5N
    Vbbta5X9AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAID/+Q2Z/B7cAAAEAA==
    
    7. Perform actual installation. Copy over OpenWrt sysupgrade image to
       TFTP root:
    
       $ sudo cp openwrt-ath79-generic-ruckus_zf7372-squashfs-sysupgrade.bin /srv/tftp
    
       Now load both to the device over TFTP:
    
       # tftp -l /tmp/u-boot-env.bin -r u-boot-env.bin -g 10.42.0.1
       # tftp -l /tmp/openwrt.bin -r openwrt-ath79-generic-ruckus_zf7372-squashfs-sysupgrade.bin -g 10.42.0.1
    
       Verify checksums of both images to ensure the transfer over TFTP
       was completed:
    
       # sha256sum /tmp/u-boot-env.bin /tmp/openwrt.bin
    
       And compare it against source images:
    
       $ sha256sum /srv/tftp/u-boot-env.bin /srv/tftp/openwrt-ath79-generic-ruckus_zf7372-squashfs-sysupgrade.bin
    
       Locate MTD partition of the primary image:
    
       # grep rcks_wlan.main /proc/mtd
    
       Now, write the images in place. Write U-boot environment last, so
       unit still can boot from backup image, should power failure occur during
       this. Replace MTD placeholders with real MTD nodes:
    
       # flashcp /tmp/openwrt.bin /dev/<rcks_wlan.main_mtd>
       # flashcp /tmp/u-boot-env.bin /dev/<u-boot-env_mtd>
    
       Finally, reboot the device. The device should directly boot into
       OpenWrt. Look for the characteristic power LED blinking pattern.
    
       # reboot -f
    
       After unit boots, it should be available at the usual 192.168.1.1/24.
    
    Return to factory firmware:
    
    1. Boot into OpenWrt initramfs as for initial installation. To do that
       without disassembly, you can write an initramfs image to the device
       using 'sysupgrade -F' first.
    2. Unset the "bootcmd" variable:
       fw_setenv bootcmd ""
    3. Write factory images downloaded from manufacturer website into
       fwconcat0 and fwconcat1 MTD partitions, or restore backup you took
       before installation:
       mtd write ruckus_zf7372_fw1_backup.bin /dev/mtd1
       mtd write ruckus_zf7372_fw2_backup.bin /dev/mtd5
    4. Reboot the system, it should load into factory firmware again.
    
    Quirks and known issues:
    - This is first device in ath79 target to support link state reporting
      on FE port attached trough the built-in switch.
    - Flash layout is changed from the factory, to use both firmware image
      partitions for storage using mtd-concat, and uImage format is used to
      actually boot the system, which rules out the dual-boot capability.
      The 5GHz radio has its own EEPROM on board, not connected to CPU.
    - The stock firmware has dual-boot capability, which is not supported in
      OpenWrt by choice.
      It is controlled by data in the top 64kB of RAM which is unmapped,
      to avoid   the interference in the boot process and accidental
      switch to the inactive image, although boot script presence in
      form of "bootcmd" variable should prevent this entirely.
    - U-boot disables JTAG when starting. To re-enable it, you need to
      execute the following command before booting:
      mw.l 1804006c 40
      And also you need to disable the reset button in device tree if you
      intend to debug Linux, because reset button on GPIO0 shares the TCK
      pin.
    - On some versions of stock firmware, it is possible to obtain root shell,
      however not much is available in terms of debugging facitilies.
      1. Login to the rkscli
      2. Execute hidden command "Ruckus"
      3. Copy and paste ";/bin/sh;" including quotes. This is required only
         once, the payload will be stored in writable filesystem.
      4. Execute hidden command "!v54!". Press Enter leaving empty reply for
         "What's your chow?" prompt.
      5. Busybox shell shall open.
      Source: https://alephsecurity.com/vulns/aleph-2019014
    - Stock firmware has beamforming functionality, known as BeamFlex,
      using active multi-segment antennas on both bands - controlled by
      RF analog switches, driven by a pair of 74LV164 shift registers.
      Shift registers used for each radio are connected to GPIO14 (clock)
      and GPIO15 of the respective chip.
      They are mapped as generic GPIOs in OpenWrt - in stock firmware,
      they were most likely handled directly by radio firmware,
      given the real-time nature of their control.
      Lack of this support in OpenWrt causes the antennas to behave as
      ordinary omnidirectional antennas, and does not affect throughput in
      normal conditions, but GPIOs are available to tinker with nonetheless.
    
    Signed-off-by: Lech Perczak <lech.perczak at gmail.com>
---
 package/boot/uboot-envtools/files/ath79            |   3 +
 target/linux/ath79/dts/ar9344_ruckus_zf7372.dts    | 133 ++++++++++++++
 target/linux/ath79/dts/ar934x_ruckus_zf73xx.dtsi   | 198 +++++++++++++++++++++
 .../ath79/generic/base-files/etc/board.d/01_leds   |   3 +
 .../generic/base-files/etc/board.d/02_network      |   5 +
 target/linux/ath79/image/generic.mk                |  16 ++
 6 files changed, 358 insertions(+)

diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79
index a435e06a0d..9e4d0ff96d 100644
--- a/package/boot/uboot-envtools/files/ath79
+++ b/package/boot/uboot-envtools/files/ath79
@@ -126,6 +126,9 @@ plasmacloud,pa300e)
 qihoo,c301)
 	ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000"
 	;;
+ruckus,zf7372)
+	ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x40000" "0x10000"
+	;;
 sophos,ap15|\
 sophos,ap55|\
 sophos,ap55c|\
diff --git a/target/linux/ath79/dts/ar9344_ruckus_zf7372.dts b/target/linux/ath79/dts/ar9344_ruckus_zf7372.dts
new file mode 100644
index 0000000000..4bf7276db5
--- /dev/null
+++ b/target/linux/ath79/dts/ar9344_ruckus_zf7372.dts
@@ -0,0 +1,133 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar934x_ruckus_zf73xx.dtsi"
+
+/ {
+	model = "Ruckus ZoneFlex 7352/7372[-E/-U]";
+	compatible = "ruckus,zf7372", "qca,ar9344";
+
+	leds {
+		air-green {
+			label = "green:air";
+			gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+		};
+
+		air-yellow {
+			label = "yellow:air";
+			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+		};
+
+		dir-green {
+			label = "green:dir";
+			gpios = <&gpio 17 GPIO_ACTIVE_LOW>;
+		};
+
+		eth1-green {
+			label = "green:eth1";
+			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+		};
+
+		power_red: power-red {
+			label = "red:power";
+			gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+			panic-indicator;
+		};
+
+		wlan2g-green {
+			label = "green:wlan2g";
+			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy0assoc";
+		};
+
+		wlan2g-yellow {
+			label = "yellow:wlan2g";
+			gpios = <&gpio 20 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy0tpt";
+		};
+
+		wlan5g-green {
+			label = "green:wlan5g";
+			gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy1assoc";
+		};
+
+		wlan5g-yellow {
+			label = "yellow:wlan5g";
+			gpios = <&gpio 22 GPIO_ACTIVE_LOW>;
+			linux,default-trigger = "phy1tpt";
+		};
+	};
+
+	beamforming-2g-spi {
+		compatible = "spi-gpio";
+		mosi-gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
+		sck-gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
+		num-chipselects = <0>;
+
+		beamforming-2g-gpio at 0 {
+			compatible = "fairchild,74hc595";
+			reg = <0>;
+			registers-number = <1>;
+			spi-max-frequency = <24000000>;
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+	};
+
+	beamforming-5g-spi {
+		compatible = "spi-gpio";
+		mosi-gpios = <&ath9k 15 GPIO_ACTIVE_HIGH>;
+		sck-gpios = <&ath9k 14 GPIO_ACTIVE_HIGH>;
+		num-chipselects = <0>;
+
+		beamforming-5g-gpio at 0 {
+			compatible = "fairchild,74hc595";
+			reg = <0>;
+			registers-number = <1>;
+			spi-max-frequency = <24000000>;
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+	};
+};
+
+&eth0 {
+	nvmem-cells = <&macaddr_board_data_6c>;
+};
+
+&eth1 {
+	status = "okay";
+
+	nvmem-cells = <&macaddr_board_data_66>;
+	nvmem-cell-names = "mac-address";
+
+	gmac-config {
+		device = <&gmac>;
+		switch-phy-swap = <0>;
+		switch-only-mode = <1>;
+	};
+};
+
+&pcie {
+	status = "okay";
+
+	ath9k: wifi at 0,0 {
+		compatible = "pci168c,0033";
+		reg = <0x0000 0 0 0 0>;
+		gpio-controller;
+		#gpio-cells = <2>;
+
+		nvmem-cells = <&macaddr_board_data_76>;
+		nvmem-cell-names = "mac-address";
+	};
+};
+
+&board_data {
+	macaddr_board_data_6c: macaddr at 6c {
+		reg = <0x6c 0x6>;
+	};
+
+	macaddr_board_data_76: macaddr at 76 {
+		reg = <0x76 0x6>;
+	};
+};
diff --git a/target/linux/ath79/dts/ar934x_ruckus_zf73xx.dtsi b/target/linux/ath79/dts/ar934x_ruckus_zf73xx.dtsi
new file mode 100644
index 0000000000..a0348e7213
--- /dev/null
+++ b/target/linux/ath79/dts/ar934x_ruckus_zf73xx.dtsi
@@ -0,0 +1,198 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar9344.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/mtd/partitions/uimage.h>
+
+/ {
+	aliases {
+		led-boot = &power_green;
+		led-failsafe = &power_red;
+		led-running = &power_green;
+		led-upgrade = &power_red;
+	};
+
+	firmware-concat {
+		compatible = "mtd-concat";
+		devices = <&fwconcat0 &fwconcat1>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				reg = <0x0 0x1f00000>;
+				label = "firmware";
+				compatible = "openwrt,uimage", "denx,uimage";
+			};
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			linux,code = <KEY_RESTART>;
+			label = "Reset button";
+			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+			debounce-interval = <50>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		pinctrl-names = "default";
+		pinctrl-0 = <&enable_gpio_11>,
+			    <&enable_gpio_16>,
+			    <&enable_gpio_4>,
+			    <&clks_disable_pins>;
+
+		power_green: power-green {
+			label = "green:power";
+			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+			default-state = "on";
+		};
+	};
+
+	reserved-memory {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		ruckus-himem at 7ff0000 {
+			/* Ruckus Himem area used to control
+			 * redundant boot image selection
+			 */
+			compatible = "nvmem-rmem";
+			reg = <0x7ff0000 0x10000>;
+			no-map;
+		};
+	};
+};
+
+&ref {
+	clock-frequency = <40000000>;
+};
+
+&spi {
+	status = "okay";
+
+	flash at 0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <25000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "u-boot";
+				reg = <0x000000 0x040000>;
+				read-only;
+			};
+
+			fwconcat0: partition at 40000 {
+				label = "fwconcat0";
+				reg = <0x040000 0xf00000>;
+			};
+
+			partition at f40000 {
+				compatible = "u-boot,env";
+				label = "u-boot-env";
+				reg = <0xf40000 0x040000>;
+			};
+
+			board_data: partition at f80000 {
+				label = "board-data";
+				reg = <0xf80000 0x080000>;
+				read-only;
+			};
+
+			fwconcat1: partition at 1000000 {
+				label = "fwconcat1";
+				reg = <0x1000000 0x1000000>;
+			};
+		};
+	};
+};
+
+&mdio0 {
+	status = "okay";
+
+	phy: ethernet-phy at 6 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <6>;
+	};
+};
+
+&eth0 {
+	status = "okay";
+	pll-data = <0x02000000 0x00000101 0x00001313>;
+	phy-mode = "rgmii-id";
+	phy-handle = <&phy>;
+
+	nvmem-cell-names = "mac-address";
+
+	gmac-config {
+		device = <&gmac>;
+		rgmii-gmac0 = <1>;
+		rxdv-delay = <3>;
+		rxd-delay = <3>;
+	};
+};
+
+&pinmux {
+	clks_disable_pins: pinmux_clks_disable_pins {
+		pinctrl-single,bits = <0x40 0x0 0x20>;
+	};
+
+	enable_gpio_4: pinctrl_enable_gpio_4 {
+		pinctrl-single,bits = <0x4 0x0 0xff>;
+	};
+
+	enable_gpio_11: pinctrl_enable_gpio_11 {
+		pinctrl-single,bits = <0x8 0x0 0xff000000>;
+	};
+
+	enable_gpio_16: pinctrl_enable_gpio_16 {
+		pinctrl-single,bits = <0x10 0x0 0xff>;
+	};
+};
+
+&wmac {
+	status = "okay";
+
+	nvmem-cells = <&macaddr_board_data_60>, <&cal_board_data_41000>;
+	nvmem-cell-names = "mac-address", "calibration";
+};
+
+&usb {
+	status = "okay";
+};
+
+&usb_phy {
+	status = "okay";
+};
+
+&board_data {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_board_data_60: macaddr at 60 {
+		reg = <0x60 0x6>;
+	};
+
+	macaddr_board_data_66: macaddr at 66 {
+		reg = <0x66 0x6>;
+	};
+
+	cal_board_data_41000: cal at 41000 {
+		reg = <0x41000 0x440>;
+	};
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index 188262018c..4773826520 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -324,6 +324,9 @@ qca,ap143-16m)
 qihoo,c301)
 	ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt"
 	;;
+ruckus,zf7372)
+	ucidef_set_led_switch "lan" "LAN" "green:eth1" "switch0" "0x02"
+	;;
 samsung,wam250)
 	ucidef_set_led_netdev "lan" "LAN" "white:lan" "eth0"
 	;;
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index 20dc564117..27482129ce 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -131,6 +131,7 @@ ath79_setup_interfaces()
 	engenius,enstationac-v1|\
 	engenius,ews511ap|\
 	ocedo,ursus|\
+	ruckus,zf7372|\
 	ubnt,unifi-ap-outdoor-plus)
 		ucidef_set_interface_lan "eth0 eth1"
 		;;
@@ -698,6 +699,10 @@ ath79_setup_macs()
 		wan_mac=$(mtd_get_mac_binary factory 0x0)
 		lan_mac=$(macaddr_setbit_la "$wan_mac")
 		;;
+	ruckus,zf7372)
+		lan_mac=$(mtd_get_mac_binary board-data 0x807E)
+		label_mac=$lan_mac
+		;;
 	sitecom,wlr-7100|\
 	sitecom,wlr-8100)
 		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index d205fd8d9e..2439429c60 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -2380,6 +2380,22 @@ define Device/rosinson_wr818
 endef
 TARGET_DEVICES += rosinson_wr818
 
+define Device/ruckus_zf73xx_common
+  DEVICE_VENDOR := Ruckus
+  DEVICE_PACKAGES := -swconfig kmod-usb2 kmod-usb-chipidea2
+  IMAGE_SIZE := 31744k
+  LOADER_TYPE := bin
+  KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel | uImage none
+endef
+
+define Device/ruckus_zf7372
+  $(Device/ruckus_zf73xx_common)
+  SOC := ar9344
+  DEVICE_MODEL := ZoneFlex 7352/7372[-E/-U]
+endef
+TARGET_DEVICES += ruckus_zf7372
+
 define Device/samsung_wam250
   SOC := ar9344
   DEVICE_VENDOR := Samsung




More information about the lede-commits mailing list