diff --git a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network index 147ae0b31f..5c176d4963 100644 --- a/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa9/base-files/etc/board.d/02_network @@ -30,6 +30,9 @@ mvebu_setup_interfaces() fortinet,fg-50e) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan5" "eth1 eth2" ;; + iij,sa-w2) + ucidef_set_interfaces_lan_wan "ge1_0 ge1_1 ge1_2 ge1_3" "ge0" + ;; iptime,nas1dual) ucidef_set_interface_lan "eth0 eth1" "dhcp" ;; diff --git a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh index 8432fdbfc8..7f45aa8a91 100755 --- a/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa9/base-files/lib/upgrade/platform.sh @@ -56,6 +56,20 @@ platform_do_upgrade() { fortinet,fg-50e) fortinet_do_upgrade "$1" ;; + iij,sa-w2) + local envmtd=$(find_mtd_part "bootloader-env") + local bootdev=$(grep "BOOTDEV=" "$envmtd") + case "${bootdev#*=}" in + flash) PART_NAME="firmware" ;; + rescue) PART_NAME="rescue" ;; + *) + echo "invalid BOOTDEV is set (\"${bootdev#*=}\")" + umount -a + reboot -f + ;; + esac + default_do_upgrade "$1" + ;; linksys,wrt1200ac|\ linksys,wrt1900ac-v1|\ linksys,wrt1900ac-v2|\ diff --git a/target/linux/mvebu/files/arch/arm/boot/dts/armada-380-iij-sa-w2.dts b/target/linux/mvebu/files/arch/arm/boot/dts/armada-380-iij-sa-w2.dts new file mode 100644 index 0000000000..d2483611ae --- /dev/null +++ b/target/linux/mvebu/files/arch/arm/boot/dts/armada-380-iij-sa-w2.dts @@ -0,0 +1,390 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +/dts-v1/; + +#include +#include +#include +#include "armada-380.dtsi" + +/ { + model = "IIJ SA-W2"; + compatible = "iij,sa-w2", "marvell,armada380"; + + aliases { + led-boot = &led_power_green; + led-failsafe = &led_power_red; + led-running = &led_power_green; + led-upgrade = &led_power_green; + label-mac-device = &ge0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@0 { + device_type = "memory"; + reg = <0x00000000 0x10000000>; /* 256MB */ + }; + + soc { + ranges = ; + + pcie { + status = "okay"; + + pcie@1,0 { + status = "okay"; + }; + + pcie@3,0 { + status = "okay"; + }; + }; + }; + + keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&pmx_keys_pins>; + + button-init { + label = "init"; + linux,code = ; + gpios = <&gpio0 18 GPIO_ACTIVE_LOW>; + }; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&pmx_leds_pins>; + + led-0 { + label = "green:wlan5g"; + gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>; + color = ; + linux,default-trigger = "phy0tpt"; + }; + + led-1 { + label = "red:wlan5g"; + gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-2 { + label = "green:status"; + gpios = <&gpio1 1 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led-3 { + label = "red:status"; + gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + }; + + led-4 { + label = "green:mobile"; + gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-5 { + label = "red:mobile"; + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-6 { + label = "green:wlan2g"; + gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>; + color = ; + linux,default-trigger = "phy1tpt"; + }; + + led-7 { + label = "red:wlan2g"; + gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led_power_green: led-8 { + label = "green:power"; + gpios = <&gpio1 14 GPIO_ACTIVE_LOW>; + color = ; + }; + + led_power_red: led-9 { + label = "red:power"; + gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; + color = ; + }; + + led-10 { + label = "green:usb1"; + gpios = <&gpio1 22 GPIO_ACTIVE_LOW>; + color = ; + linux,default-trigger = "usbport"; + trigger-sources = <&hub_port2>; + }; + + led-11 { + label = "green:usb0"; + gpios = <&gpio1 23 GPIO_ACTIVE_LOW>; + color = ; + linux,default-trigger = "usbport"; + trigger-sources = <&hub_port1>; + }; + }; + + regulator-vbus-usb0 { + compatible = "regulator-fixed"; + regulator-name = "vbus-usb0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio1 20 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; + + regulator-vbus-usb1 { + compatible = "regulator-fixed"; + regulator-name = "vbus-usb1"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio1 21 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-always-on; + }; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pins>; + status = "okay"; +}; + +&pinctrl { + pmx_usb_pins: usb-pins { + marvell,pins = "mpp2", /* smsc usb2514b reset */ + "mpp48", "mpp49", /* port over current */ + "mpp52", "mpp53"; /* port vbus */ + marvell,function = "gpio"; + }; + + pmx_keys_pins: keys-pins { + marvell,pins = "mpp18"; + marvell,function = "gpio"; + }; + + pmx_leds_pins: leds-pins { + marvell,pins = "mpp19", "mpp20", "mpp33", "mpp34", "mpp35", + "mpp36", "mpp44", "mpp45", "mpp46", "mpp47", + "mpp54", "mpp55"; + marvell,function = "gpio"; + }; +}; + +&gpio0 { + usb-hub-reset { + gpio-hog; + gpios = <2 GPIO_ACTIVE_HIGH>; + output-high; + }; +}; + +&usb0 { + pinctrl-names = "default"; + pinctrl-0 = <&pmx_usb_pins>; + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; + + /* SMSC USB2514B on PCB */ + hub@1 { + compatible = "usb424,2514"; + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + hub_port1: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; + + hub_port2: port@2 { + reg = <2>; + #trigger-source-cells = <0>; + }; + }; +}; + +&bm { + status = "okay"; +}; + +&bm_bppi { + status = "okay"; +}; + +ð1 { + pinctrl-names = "default"; + pinctrl-0 = <&ge1_rgmii_pins>; + status = "okay"; + + phy-connection-type = "rgmii-id"; + buffer-manager = <&bm>; + bm,pool-long = <2>; + bm,pool-short = <3>; + + nvmem-cells = <&macaddr_bdinfo_6 1>; + nvmem-cell-names = "mac-address"; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +&mdio { + pinctrl-names = "default"; + pinctrl-0 = <&mdio_pins>; + status = "okay"; + + /* Marvell 88E6172 */ + switch@0 { + compatible = "marvell,mv88e6085"; + reg = <0x0>; + interrupt-controller; + #interrupt-cells = <2>; + interrupt-parent = <&gpio1>; + interrupts = <10 IRQ_TYPE_LEVEL_LOW>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "ge1_0"; + }; + + port@1 { + reg = <1>; + label = "ge1_1"; + }; + + port@2 { + reg = <2>; + label = "ge1_2"; + }; + + port@3 { + reg = <3>; + label = "ge1_3"; + }; + + ge0: port@4 { + reg = <4>; + label = "ge0"; + nvmem-cells = <&macaddr_bdinfo_6 0>; + nvmem-cell-names = "mac-address"; + }; + + /* + * eth0 is connected to port5 for WAN connection + * on port4 ("GE0") + */ + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <ð1>; + phy-connection-type = "rgmii-id"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; + }; +}; + +&rtc { + status = "disabled"; +}; + +&spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&spi1_pins>; + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <40000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + reg = <0x0 0x100000>; + label = "bootloader"; + read-only; + }; + + partition@100000 { + reg = <0x100000 0x10000>; + label = "bootloader-env"; + read-only; + }; + + partition@110000 { + compatible = "nvmem-cells"; + reg = <0x110000 0xf0000>; + label = "board_info"; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_bdinfo_6: macaddr@6 { + compatible = "mac-base"; + reg = <0x6 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + partition@200000 { + compatible = "iij,seil-firmware"; + reg = <0x200000 0xf00000>; + label = "firmware"; + iij,bootdev-name = "flash"; + iij,seil-id = <0x5345494c 0x32303135>; + }; + + partition@1100000 { + compatible = "iij,seil-firmware"; + reg = <0x1100000 0xf00000>; + label = "rescue"; + iij,bootdev-name = "rescue"; + iij,seil-id = <0x5345494c 0x32303135>; + }; + }; + }; +}; diff --git a/target/linux/mvebu/image/cortexa9.mk b/target/linux/mvebu/image/cortexa9.mk index 27f41c58a8..3234d62cd9 100644 --- a/target/linux/mvebu/image/cortexa9.mk +++ b/target/linux/mvebu/image/cortexa9.mk @@ -16,6 +16,23 @@ define Build/fortigate-header mv $@.new $@ endef +define Build/seil-header + ( \ + data_size_crc="$$(gzip -c $@ | tail -c8 | \ + od -An -tx8 --endian little | tr -d ' \n')"; \ + printf "SEIL2015"; \ + printf "$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION)" | \ + dd bs=80 count=1 conv=sync 2>/dev/null; \ + printf "$$(echo $${data_size_crc:8:8} | sed 's/../\\x&/g')"; \ + printf "\x00\x00\x00\x01\x00\x00\x00\x09\x00\x00\x00\x63"; \ + printf "$(REVISION)" | dd bs=32 count=1 conv=sync 2>/dev/null; \ + printf "\x00\x00\x00\x00"; \ + printf "$$(echo $${data_size_crc:0:8} | sed 's/../\\x&/g')"; \ + cat $@; \ + ) > $@.new + mv $@.new $@ +endef + define Device/dsa-migration DEVICE_COMPAT_VERSION := 1.1 DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA @@ -134,6 +151,20 @@ define Device/globalscale_mirabox endef TARGET_DEVICES += globalscale_mirabox +define Device/iij_sa-w2 + DEVICE_VENDOR := IIJ + DEVICE_MODEL := SA-W2 + SOC := armada-380 + KERNEL := kernel-bin | append-dtb | seil-header + DEVICE_DTS := armada-380-iij-sa-w2 + IMAGE_SIZE := 15360k + IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | \ + append-rootfs | pad-rootfs | check-size | append-metadata + DEVICE_PACKAGES := kmod-ath9k kmod-ath10k-ct ath10k-firmware-qca988x-ct \ + wpad-basic-mbedtls +endef +TARGET_DEVICES += iij_sa-w2 + define Device/iptime_nas1dual DEVICE_VENDOR := ipTIME DEVICE_MODEL := NAS1dual