bcm53xx: add support for Cisco Meraki MX64/MX65

This commit adds support for the Cisco Meraki MX64 and MX65 devices which
use the Broadcom NSP SoC, which is compatible with the bcm53xx platform.

MX64 Hardware info:
  - CPU: Broadcom BCM58625 Cortex A9 @ 1200Mhz
  - RAM: 2 GB (4 x 4Gb SK Hynix H5TC4G83CFR)
  - Storage: 1 GB (Micron MT29F8G08ABACA)
  - Networking: BCM58625 internal switch (5x 1GbE ports)
  - USB: 1x USB2.0
  - Serial: Internal header

MX65 Hardware info:
  - CPU: Broadcom BCM58625 Cortex A9 @ 1200Mhz
  - RAM: 2 GB (4 x 4Gb SK Hynix H5TC4G83CFR)
  - Storage: 1 GB (Micron MT29F8G08ABACA)
  - Networking: BCM58625 switch (2x 1GbE ports, used for WAN ports 1 & 2)
    2x Qualcomm QCA8337 switches (10x 1GbE ports, used for LAN ports 3-12)
  - PSE: Broadcom BCM59111KMLG connected to LAN ports 11 & 12
  - USB: 1x USB2.0
  - Serial: Internal header

Notes:
  - The Meraki provided GPL source are available at [2].
  - Wireless capability on the MX64W and MX65W exists in the form of 2x
    Broadcom BCM43520KMLG, which is not supported. These devices will work
    otherwise as standard MX64 or MX65 devices.
  - Early MX64 units use an A0 variant of the BCM958625 SoC which lacks
    cache coherency and uses a different "secondary-boot-reg". As a
    consequence a different device tree is needed.
  - Installation of OpenWrt requires changing u-boot to a custom version.
    This is due to the stock u-boot "nand read" command being limited to
    load only 2MB, in spite of the bootkernel1 and bootkernel2 partitions
    both being 3MB in the stock layout. It is also required to allow
    booting via USB, enabling cache coherency and setting up the QCA
    switches and Serdes link on the MX65. The modified sources for U-boot
    are available for the MX64[3] and MX65[4].
  - Initial work on this device used a small bootloader within the OEM
    partition scheme. To allow booting of larger kernels, UBI and bootm
    support has been added, along with ability to store env variables to
    the NAND. The Shmoo and newly created env partitions have been moved
    to the extra space available after the nvram data.
  - Users who installed the previous non-UBI supporting bootloader will
    need to convert to the new one before flashing a compatible image.
    These steps are detailed below.

References:

[1] https://www.broadcom.com/products/embedded-and-networking-processors/c
ommunications/bcm5862x
[2] https://dl.meraki.net/wired-14-39-mx64-20190426.tar.bz2
[3] https://github.com/clayface/U-boot-MX64-20190430_MX64
[4] https://github.com/clayface/U-boot-MX64-20190430_MX65

Installation guide:

Initial installation steps:
  1. Compile or obtain OpenWrt files for the MX64 or MX65, including
     u-boot[3][4], initramfs and sysupgrade images.
  2. A USB disk with DOS partition scheme and primary FAT partition is
     required.
  3. If installing onto an MX64, set up a local web server.
  4. On the device, boot into diagnostic mode by holding reset when
     powering on the device. Continue to hold reset until the orange LED
     begins to flash white. On used units the white flash may be difficult
     to see.
  5. Plug an Ethernet cable into the first LAN port, set the host to
     192.168.1.2 and confirm telnet connectivity to 192.168.1.1.

U-boot installation - MX64 Only:
  1. Newer fw versions require extra steps to support OpenWrt. To check,
     please connect via telnet and run:
        `cat /sys/block/mtdblock0/ro`
     If the result is 1, your mtd0 is locked will need to perform extra
     steps 4 and 5 in this section. If the result is 0 then skip these.

  2. Check which SoC is in use by running the following command:
        `devmem 0x18000000`
     If devmem is not found then try:
        `devmem2 0x18000000`
     If the output begins with anything between "0x3F00-0x3F03" you will
     need to use the A0 release. For any other output, eg "0x3F04" or
     higher, use the regular MX64 image.

  3  Confirm the size of the device's boot(mtd0) partition. In most
     cases it should be 0x100000 or larger. If this is the case, please
     proceed to use the uboot_mx64 image. If the reported size is
     0x80000, please use the uboot_mx64_small image, then follow the
     later guide to change to the larger image.
        `cat /proc/mtd`
     Example output:
        `# cat /proc/mtd
        cat /proc/mtd
        dev:    size   erasesize  name
        mtd0: 00100000 00040000 "boot"
        mtd1: 00080000 00040000 "shmoo"
        mtd2: 00300000 00040000 "bootkernel1"
        mtd3: 00100000 00040000 "nvram"
        mtd4: 00300000 00040000 "bootkernel2"
        mtd5: 3f700000 00040000 "ubi"
        mtd6: 40000000 00040000 "all"`

  4. Set up a webserver to serve the appropriate uboot_mx64 from the
     following location and verify the SHA512:
     https://github.com/clayface/U-boot-MX64-20190430_MX64

  5. (Only if mtd0 is locked) You will also need the mtd-rw.ko kernel
     module to unlock the partition from the same repo. An mtd executable
     is also needed to write the mtd block. Place these on the web server
     as well.

  6. (Only if mtd0 is locked) Use wget to retrieve the files on the MX64:
        `wget http://192.168.1.2/mtd-rw.ko`
        `insmod mtd-rw.ko i_want_a_brick=1`
     and confirm the unlock is set with dmesg
        `mtd-rw: mtd0: setting writeable flag`

  7. Download the appropriate u-boot image according to step 3. If you
     did not need to unlock the mtd0 partition then use dd to write the
     file, with caution:
        `wget http://192.168.1.2/uboot_mx64`
        `dd if=uboot_mx64 of=/dev/mtdblock0`
     If you needed to unlock the mtd0 partition using the mtd-rw module,
     run these commands instead to install u-boot instead:
        `wget http://192.168.1.2/mtd`
        `chmod +x mtd`
        `wget http://192.168.1.2/uboot_mx64`
        `./mtd write uboot_mx64 /dev/mtd0`

  8. Once this has successfully completed, power off the device. If you
     did not need to install the small u-boot image, proceed to
     "OpenWrt Installation". Otherwise proceed to "UBI supporting
     bootloader installation".

U-boot installation - MX65 Only:
  1. Obtain telnet access to the MX65.

  2. Confirm the size of the device's boot(mtd0) partition. In most
     cases it should be 0x100000 or larger. If this is the case, please
     proceed to use the uboot_mx65 image. If the reported size is
     0x80000, please use the uboot_mx65_small image, then follow the
     later guide to change to the larger image.
	`cat /proc/mtd`

  3. Prepare a USB drive formatted to FAT. Download the appropriate
     uboot_mx65 to the USB drive from the following location and verify
     the SHA512:
        https://github.com/clayface/U-boot-MX64-20190430_MX65

  3. Once you have telnet access to the MX65, plug in the USB disk and
     run the following commands, with caution. The USB disk should
     automount but if it does not, you will need to power off and on
     again with reset held. Depending on step 2, use the uboot_mx65 or
     uboot_mx65_small image accordingly:
        `cd /tmp/media/sda1`
        `dd if=uboot_mx65 of=/dev/mtdblock0`

  4. Once this has successfully completed, power off the device. If you
     did not need to install the small u-boot image, proceed to
     "OpenWrt Installation". Otherwise proceed to "UBI supporting
     bootloader installation".

UBI supporting bootloader installation:
  These steps need to be followed if the older u-boot image was
  installed, either because the Meraki diagnostic partition scheme used
  0x80000 as the mtd0 size, or because you installed the u-boot provided
  while OpenWrt support was still under development. If using OpenWrt,
  please make a backup before proceeding.

  1. Obtain the relevant image from the MX64(A0) or MX65 u-boot repo:
        `openwrt-bcm5862x-generic-meraki_XXXX-initramfs-kernel.bin`

  2. With the USB drive already inserted, power on the device while
     holding the reset button. A white/orange flashing pattern will
     occur shortly after power on. Let go of the reset button. The
     device is now booting into OpenWrt initramfs stored on the USB
     disk.

  3. Connect by SSH to 192.168.1.1 and flash the embedded u-boot image,
     changing X as appropriate:
        `mtd write /root/uboot_mx6X /dev/mtd0`
     You do not need to reboot as this image can handle "Kernel-in-UBI"
     OpenWrt installation.

  4. You can proceed to obtain and flash the appropriate OpenWrt image
     at "OpenWrt Installation" Step 3.

  5. Reboot will take significantly longer due to Shmoo calibration. In
     case the device does not come online after several minute, power-
     cycle the device and see if it boots. If you see an orange/white
     flashing pattern, this indicates UBI booting was not successful and
     you will need to copy a new bcm53xx image to a USB disk before
     booting it and attempting to install OpenWrt again - refer to
     "OpenWrt Installation" step 1. Do not attempt to reflash u-boot in
     this scenario.

OpenWrt Installation:
  1. Having obtained an OpenWrt image, please copy the file
        `openwrt-bcm53xx-generic-meraki_XXXX-initramfs.bin`
     to the base directory of a FAT formatted USB drive using DOS
     partition scheme ,where XXXX is mx64, mx64_a0 or mx65 depending on
     which device you have.

  2. With the USB drive already inserted, power on the device. Boot time
     will be longer than usual while Shmoo calibration takes place. A
     different white/orange flashing pattern will eventually occur to
     indicate device is now booting into OpenWrt initramfs stored on the
     USB disk.

  3. Ensuring Ethernet is plugged into a LAN port with IP set in the
     192.168.1.0/24 subnet excluding 192.168.1.1, use SCP to copy the
     sysupgrade file to 192.168.1.1:/tmp, eg:
        `scp openwrt-bcm53xx-generic-meraki_XXXX-squashfs.sysupgrade.bin\
        192.168.1.1:/tmp`

  4. Connect by SSH to 192.168.1.1 and run sysupgrade:
        `sysupgrade \
        /tmp/openwrt-bcm53xx-generic-meraki_XXXX-squashfs.sysupgrade.bin`

  5. OpenWrt should now be installed on the device.

Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>

[ Rebase kernel configuration for 6.6,
  fix failsafe by making kmod-eeprom-at24 and kmod-dsa-qca8k built-in,
  resolve conflicts,
  add LED aliases,
  fix eth0 MAC address at probe ]

TODO:
- fix multiple LED colors not applied despite aliases - due to custom
  /etc/diag.sh
- fix race condition between preinit and probing of the DSA tree,
  causing no network interface available in failsafe mode (in general
  case - to allow moving drivers back to modules)

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16634
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Matthew Hagan 2021-09-06 22:42:35 +00:00 committed by Hauke Mehrtens
parent d2ffd43171
commit 7ad9988287
7 changed files with 217 additions and 3 deletions

View File

@ -4,6 +4,18 @@
board_config_update
case "$(board_name)" in
meraki,mx64|\
meraki,mx64-a0)
ucidef_set_led_netdev "wan" "WAN Port" "green:activity-9" "wan"
ucidef_set_led_netdev "lan1" "LAN Port 1" "green:activity-1" "lan1"
ucidef_set_led_netdev "lan2" "LAN Port 2" "green:activity-3" "lan2"
ucidef_set_led_netdev "lan3" "LAN Port 3" "green:activity-5" "lan3"
ucidef_set_led_netdev "lan4" "LAN Port 4" "green:activity-7" "lan4"
;;
meraki,mx65)
ucidef_set_led_netdev "wan1" "WAN Port 1" "green:activity-1" "wan1"
ucidef_set_led_netdev "wan2" "WAN Port 2" "green:activity-3" "wan2"
;;
netgear,r8000)
ucidef_set_led_usbport "usb2" "USB 2.0" "bcm53xx:white:usb2" "usb1-port2" "usb2-port2"
ucidef_set_led_usbport "usb3" "USB 3.0" "bcm53xx:white:usb3" "usb1-port1" "usb2-port1" "usb4-port1"

View File

@ -29,6 +29,14 @@ bcm53xx_setup_interfaces()
meraki,mr32)
ucidef_set_interface_lan "poe" "dhcp"
;;
meraki,mx64 | \
meraki,mx64-a0)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
;;
meraki,mx65)
ucidef_set_interfaces_lan_wan \
"lan3 lan4 lan5 lan6 lan7 lan8 lan9 lan10 lan11 lan12" "wan1 wan2"
;;
phicomm,k3)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
;;
@ -68,6 +76,12 @@ bcm53xx_setup_macs()
ucidef_set_interface_macaddr "lan" "$label_mac"
ucidef_set_label_macaddr "$label_mac"
;;
meraki,mx64 | \
meraki,mx64-a0 | \
meraki,mx65)
etXmacaddr=$(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66)
offset=1
;;
*)
etXmacaddr=$(nvram get et0macaddr)
offset=1

View File

@ -200,7 +200,10 @@ platform_check_image() {
board="$(board_name)"
case "$board" in
meraki,mr26 | \
meraki,mr32)
meraki,mr32 | \
meraki,mx64 | \
meraki,mx64-a0 | \
meraki,mx65)
# NAND sysupgrade
return 0
;;
@ -403,6 +406,12 @@ platform_do_upgrade() {
CI_KERNPART="part.safe"
nand_do_upgrade "$1"
;;
meraki,mx64 | \
meraki,mx64-a0 | \
meraki,mx65)
REQUIRE_IMAGE_METADATA=1
nand_do_upgrade "$1"
;;
*)
platform_other_do_upgrade "$1"
;;

View File

@ -4,6 +4,7 @@ CONFIG_ARCH_BCM=y
CONFIG_ARCH_BCM_5301X=y
CONFIG_ARCH_BCM_53573=y
CONFIG_ARCH_BCM_IPROC=y
CONFIG_ARCH_BCM_NSP=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_KEEP_MEMBLOCK=y
CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
@ -34,13 +35,16 @@ CONFIG_ARM_L1_CACHE_SHIFT=6
CONFIG_ARM_L1_CACHE_SHIFT_6=y
CONFIG_ARM_PATCH_IDIV=y
CONFIG_ARM_PATCH_PHYS_VIRT=y
CONFIG_ARM_SP805_WATCHDOG=y
CONFIG_ARM_THUMB=y
CONFIG_ARM_TIMER_SP804=y
CONFIG_ARM_UNWIND=y
CONFIG_ARM_VIRT_EXT=y
CONFIG_ATAGS=y
CONFIG_AUTO_ZRELADDR=y
CONFIG_B53=y
CONFIG_B53_MDIO_DRIVER=y
CONFIG_B53_SERDES=y
CONFIG_B53_SRAB_DRIVER=y
CONFIG_BCM47XX_NVRAM=y
CONFIG_BCM47XX_SPROM=y
@ -62,7 +66,7 @@ CONFIG_BCM_NS_THERMAL=y
CONFIG_BCM_SR_THERMAL=y
CONFIG_BGMAC=y
CONFIG_BGMAC_BCMA=y
# CONFIG_BGMAC_PLATFORM is not set
CONFIG_BGMAC_PLATFORM=y
CONFIG_BINFMT_FLAT_ARGVP_ENVP_ON_STACK=y
CONFIG_BLK_MQ_PCI=y
CONFIG_BOUNCE=y
@ -289,9 +293,11 @@ CONFIG_PHY_BCM_SR_USB=y
# CONFIG_PHY_BRCM_SATA is not set
# CONFIG_PHY_NS2_USB_DRD is not set
CONFIG_PINCTRL=y
# CONFIG_PINCTRL_IPROC_GPIO is not set
CONFIG_PINCTRL_IPROC_GPIO=y
CONFIG_PINCTRL_NS=y
# CONFIG_PINCTRL_NS2_MUX is not set
CONFIG_PINCTRL_NSP_GPIO=y
CONFIG_PINCTRL_NSP_MUX=y
CONFIG_PREEMPT_NONE_BUILD=y
CONFIG_PTP_1588_CLOCK_OPTIONAL=y
CONFIG_PWM=y

View File

@ -420,6 +420,44 @@ define Device/meraki_mr32
endef
TARGET_DEVICES += meraki_mr32
define Device/meraki_mx6x
KERNEL_IN_UBI := 1
KERNEL_LOADADDR := 0x60008000
DEVICE_PACKAGES := -oseama kmod-leds-pwm kmod-usb-ehci \
kmod-usb-ohci kmod-usb2 \
kmod-ledtrig-default-on kmod-ledtrig-netdev
DEVICE_VENDOR := Cisco Meraki
KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
KERNEL_INITRAMFS := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
KERNEL_INITRAMFS_SUFFIX := .bin
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
endef
define Device/meraki_mx64
$(call Device/meraki_mx6x)
DEVICE_MODEL := MX64
DEVICE_DTS_CONFIG := config@4
DEVICE_DTS := bcm958625-meraki-mx64
endef
TARGET_DEVICES += meraki_mx64
define Device/meraki_mx64_a0
$(call Device/meraki_mx64)
DEVICE_VARIANT := A0
DEVICE_DTS_CONFIG := config@2
DEVICE_DTS := bcm958625-meraki-mx64-a0
endef
TARGET_DEVICES += meraki_mx64_a0
define Device/meraki_mx65
$(call Device/meraki_mx6x)
DEVICE_MODEL := MX65
DEVICE_DTS_CONFIG := config@3
DEVICE_DTS := bcm958625-meraki-mx65
endef
TARGET_DEVICES += meraki_mx65
define Device/netgear
DEVICE_VENDOR := NETGEAR
IMAGES := chk

View File

@ -0,0 +1,52 @@
From 35bba88e75311242841dde83073c211310ec0259 Mon Sep 17 00:00:00 2001
From: Matthew Hagan <mnhagan88@gmail.com>
Date: Wed, 4 May 2022 08:07:06 +0100
Subject: [PATCH] bcm53xx: partition fixups for Meraki MX64/MX65
We need to enlarge the u-boot partition to add extra features like UBI
booting. The shmoo and newly created env partitions can easily be moved
to the nvram partition. This fixup allows u-boot to be enlarged to up to
1MiB.
Signed-off-by: Matthew Hagan <mnhagan88@gmail.com>
---
arch/arm/boot/dts/broadcom/bcm958625-meraki-mx6x-common.dtsi | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
--- a/arch/arm/boot/dts/broadcom/bcm958625-meraki-mx6x-common.dtsi
+++ b/arch/arm/boot/dts/broadcom/bcm958625-meraki-mx6x-common.dtsi
@@ -84,13 +84,7 @@
partition@0 {
label = "u-boot";
- reg = <0x0 0x80000>;
- read-only;
- };
-
- partition@80000 {
- label = "shmoo";
- reg = <0x80000 0x80000>;
+ reg = <0x0 0x100000>;
read-only;
};
@@ -101,7 +95,18 @@
partition@400000 {
label = "nvram";
- reg = <0x400000 0x100000>;
+ reg = <0x400000 0x40000>;
+ };
+
+ partition@440000 {
+ label = "u-boot-env";
+ reg = <0x440000 0x40000>;
+ };
+
+ partition@480000 {
+ label = "shmoo";
+ reg = <0x480000 0x80000>;
+ read-only;
};
partition@500000 {

View File

@ -0,0 +1,83 @@
From 9f4e68261b89df87457f46999c471d11754b5de2 Mon Sep 17 00:00:00 2001
From: Lech Perczak <lech.perczak@gmail.com>
Date: Sun, 6 Oct 2024 15:57:44 +0200
Subject: [PATCH] bcm53xx: dts: meraki-mx6x: add OpenWrt-specific LED aliases
Assign green power LED for "boot", "running", orange for "upgrade" and
red for "failsafe" functions - the same as done for MR33 and MR74.
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
---
arch/arm/boot/dts/broadcom/bcm958625-meraki-alamo.dtsi | 9 ++++++++-
arch/arm/boot/dts/broadcom/bcm958625-meraki-kingpin.dtsi | 8 +++++++-
.../boot/dts/broadcom/bcm958625-meraki-mx6x-common.dtsi | 4 ++--
3 files changed, 17 insertions(+), 4 deletions(-)
--- a/arch/arm/boot/dts/broadcom/bcm958625-meraki-alamo.dtsi
+++ b/arch/arm/boot/dts/broadcom/bcm958625-meraki-alamo.dtsi
@@ -8,6 +8,13 @@
#include "bcm958625-meraki-mx6x-common.dtsi"
/ {
+ aliases {
+ led-boot = &led_power;
+ led-running = &led_power;
+ led-upgrade = &led_fault;
+ led-failsafe = &led_failsafe;
+ };
+
keys {
compatible = "gpio-keys-polled";
autorepeat;
@@ -55,7 +62,7 @@
gpios = <&gpioa 26 GPIO_ACTIVE_LOW>;
};
- led-4 {
+ led_fault: led-4 {
/* amber:power */
function = LED_FUNCTION_FAULT;
color = <LED_COLOR_ID_AMBER>;
--- a/arch/arm/boot/dts/broadcom/bcm958625-meraki-kingpin.dtsi
+++ b/arch/arm/boot/dts/broadcom/bcm958625-meraki-kingpin.dtsi
@@ -8,6 +8,12 @@
#include "bcm958625-meraki-mx6x-common.dtsi"
/ {
+ aliases {
+ led-boot = &led_power;
+ led-running = &led_power;
+ led-upgrade = &led_fault;
+ led-failsafe = &led_failsafe;
+ };
keys {
compatible = "gpio-keys-polled";
@@ -104,7 +110,7 @@
gpios = <&gpioa 29 GPIO_ACTIVE_LOW>;
};
- led-a {
+ led_fault: led-a {
/* amber:power */
function = LED_FUNCTION_FAULT;
color = <LED_COLOR_ID_AMBER>;
--- a/arch/arm/boot/dts/broadcom/bcm958625-meraki-mx6x-common.dtsi
+++ b/arch/arm/boot/dts/broadcom/bcm958625-meraki-mx6x-common.dtsi
@@ -14,14 +14,14 @@
pwm-leds {
compatible = "pwm-leds";
- led-1 {
+ led_failsafe: led-1 {
function = LED_FUNCTION_INDICATOR;
color = <LED_COLOR_ID_RED>;
pwms = <&pwm 1 50000>;
max-brightness = <255>;
};
- led-2 {
+ led_power: led-2 {
function = LED_FUNCTION_POWER;
color = <LED_COLOR_ID_GREEN>;
pwms = <&pwm 2 50000>;