From 8e7c9f5393e6c96a9c13da0f5b407a6912523e77 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 15 May 2021 23:40:50 +0200 Subject: [PATCH] octeon: create shared DTSI for Ubiquiti E300 platform EdgeRouter 4 and upcoming EdgeRouter 6P and 12 have similar setup, so create a shared DTSI to prevent duplicate code. Signed-off-by: Dan Brown [reorder/squash commits, add description, move ethernet@0 to DTS] Signed-off-by: Adrian Schmutzler --- .../cn7130_ubnt_edgerouter-4.dts | 195 +---------------- .../cn7130_ubnt_edgerouter-e300.dtsi | 205 ++++++++++++++++++ 2 files changed, 206 insertions(+), 194 deletions(-) create mode 100644 target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts index a89455c613..d8dabfc370 100644 --- a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-4.dts @@ -1,180 +1,14 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "cn71xx.dtsi" - -#include -#include +#include "cn7130_ubnt_edgerouter-e300.dtsi" / { compatible = "ubnt,edgerouter-4", "cavium,cn7130"; model = "Ubiquiti EdgeRouter 4"; - - aliases { - /* White + Blinking Blue */ - led-boot = &led_power_white; - /* Blue + Blinking White */ - led-failsafe = &led_power_blue; - /* Constant Blue */ - led-running = &led_power_blue; - /* Blue + Blinking White */ - led-upgrade = &led_power_blue; - }; - - memory@0 { - device_type = "memory"; - reg = <0x0 0x00000000>, - <0x0 0x10000000>, - <0x0 0x20000000>, - <0x0 0x30000000>; - }; - - leds { - compatible = "gpio-leds"; - - led_power_blue: power_blue { - label = "blue:power"; - gpios = <&gpio 15 GPIO_ACTIVE_LOW>; - }; - - led_power_white: power_white { - label = "white:power"; - gpios = <&gpio 17 GPIO_ACTIVE_LOW>; - }; - }; - - keys { - compatible = "gpio-keys-polled"; - poll-interval = <20>; - - reset { - label = "reset"; - linux,code = ; - gpios = <&gpio 11 GPIO_ACTIVE_LOW>; - debounce-interval = <60>; - }; - }; - - sfp: sfp { - compatible = "sff,sfp"; - i2c-bus = <&twsi0>; - /* Pins 12, 13 and 14 gets pulled low when SFP is plugged in */ - mod-def0-gpio = <&gpio 12 GPIO_ACTIVE_LOW>; - }; -}; - -&uart0 { - status = "okay"; -}; - -&usb0 { - status = "okay"; -}; - -&xhci0 { - status = "okay"; - dr_mode = "host"; -}; - -&twsi0 { - status = "okay"; - - sfp_eeprom@50 { - compatible = "at,24c04"; - reg = <0x50>; - }; - - sfp_eeprom@51 { - compatible = "at,24c04"; - reg = <0x51>; - }; -}; - -&spi { - status = "okay"; - - flash@0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "Macronix,mx25l6405d", "spi-flash"; - reg = <0>; - spi-max-frequency = <25000000>; - - partition@0 { - label = "boot0"; - read-only; - reg = <0x000000 0x300000>; - }; - - partition@300000 { - label = "dummy"; - read-only; - reg = <0x300000 0x100000>; - }; - - eeprom: partition@400000 { - label = "eeprom"; - read-only; - reg = <0x400000 0x10000>; - }; - }; -}; - -&mmc { - status = "okay"; - - mmc-slot@0 { - compatible = "mmc-slot"; - reg = <0>; - non-removable; - max-frequency = <26000000>; - voltage-ranges = <3300 3300>; - bus-width = <8>; - }; -}; - -&smi0 { - status = "okay"; - - phy4: ethernet-phy@4 { - device_type = "ethernet-phy"; - interrupts = <17 8>; - interrupt-parent = <&gpio>; - compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; - reg = <4>; - sfp = <&sfp>; - }; - - phy5: ethernet-phy@5 { - device_type = "ethernet-phy"; - interrupts = <17 8>; - interrupt-parent = <&gpio>; - compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; - reg = <5>; - }; - - phy6: ethernet-phy@6 { - device_type = "ethernet-phy"; - interrupts = <17 8>; - interrupt-parent = <&gpio>; - compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; - reg = <6>; - }; - - phy7: ethernet-phy@7 { - device_type = "ethernet-phy"; - interrupts = <17 8>; - interrupt-parent = <&gpio>; - compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; - reg = <7>; - }; }; &pip { - status = "okay"; - interface@0 { - status = "okay"; - ethernet@0 { label = "lan3"; status = "okay"; @@ -182,32 +16,5 @@ phy-handle = <&phy4>; mtd-mac-address = <&eeprom 0>; }; - - ethernet@1 { - label = "lan0"; - status = "okay"; - phy-mode = "sgmii"; - phy-handle = <&phy5>; - mtd-mac-address = <&eeprom 0>; - mtd-mac-address-increment = <(1)>; - }; - - ethernet@2 { - label = "lan1"; - status = "okay"; - phy-mode = "sgmii"; - phy-handle = <&phy6>; - mtd-mac-address = <&eeprom 0>; - mtd-mac-address-increment = <(2)>; - }; - - ethernet@3 { - label = "lan2"; - status = "okay"; - phy-mode = "sgmii"; - phy-handle = <&phy7>; - mtd-mac-address = <&eeprom 0>; - mtd-mac-address-increment = <(3)>; - }; }; }; diff --git a/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi new file mode 100644 index 0000000000..7d4c7f0de9 --- /dev/null +++ b/target/linux/octeon/files/arch/mips/boot/dts/cavium-octeon/cn7130_ubnt_edgerouter-e300.dtsi @@ -0,0 +1,205 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "cn71xx.dtsi" + +#include +#include + +/ { + compatible = "ubnt,edgerouter-e300", "cavium,cn7130"; + model = "Ubiquiti EdgeRouter E300 series"; + + aliases { + /* White + Blinking Blue */ + led-boot = &led_power_white; + /* Blue + Blinking White */ + led-failsafe = &led_power_blue; + /* Constant Blue */ + led-running = &led_power_blue; + /* Blue + Blinking White */ + led-upgrade = &led_power_blue; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x00000000>, + <0x0 0x10000000>, + <0x0 0x20000000>, + <0x0 0x30000000>; + }; + + leds { + compatible = "gpio-leds"; + + led_power_blue: power_blue { + label = "blue:power"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + }; + + led_power_white: power_white { + label = "white:power"; + gpios = <&gpio 17 GPIO_ACTIVE_LOW>; + }; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + sfp: sfp { + compatible = "sff,sfp"; + i2c-bus = <&twsi0>; + /* Pins 12, 13 and 14 gets pulled low when SFP is plugged in */ + mod-def0-gpio = <&gpio 12 GPIO_ACTIVE_LOW>; + }; +}; + +&uart0 { + status = "okay"; +}; + +&usb0 { + status = "okay"; +}; + +&xhci0 { + status = "okay"; + dr_mode = "host"; +}; + +&twsi0 { + status = "okay"; + + sfp_eeprom@50 { + compatible = "at,24c04"; + reg = <0x50>; + }; + + sfp_eeprom@51 { + compatible = "at,24c04"; + reg = <0x51>; + }; +}; + +&spi { + status = "okay"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "Macronix,mx25l6405d", "spi-flash"; + reg = <0>; + spi-max-frequency = <25000000>; + + partition@0 { + label = "boot0"; + read-only; + reg = <0x000000 0x300000>; + }; + + partition@300000 { + label = "dummy"; + read-only; + reg = <0x300000 0x100000>; + }; + + eeprom: partition@400000 { + label = "eeprom"; + read-only; + reg = <0x400000 0x10000>; + }; + }; +}; + +&mmc { + status = "okay"; + + mmc-slot@0 { + compatible = "mmc-slot"; + reg = <0>; + non-removable; + max-frequency = <26000000>; + voltage-ranges = <3300 3300>; + bus-width = <8>; + }; +}; + +&smi0 { + status = "okay"; + + phy4: ethernet-phy@4 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; + reg = <4>; + sfp = <&sfp>; + }; + + phy5: ethernet-phy@5 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; + reg = <5>; + }; + + phy6: ethernet-phy@6 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; + reg = <6>; + }; + + phy7: ethernet-phy@7 { + device_type = "ethernet-phy"; + interrupts = <17 8>; + interrupt-parent = <&gpio>; + compatible = "vitesse,vsc8504", "ethernet-phy-ieee802.3-c22"; + reg = <7>; + }; +}; + +&pip { + status = "okay"; + + interface@0 { + status = "okay"; + + ethernet@1 { + label = "lan0"; + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&phy5>; + mtd-mac-address = <&eeprom 0>; + mtd-mac-address-increment = <(1)>; + }; + + ethernet@2 { + label = "lan1"; + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&phy6>; + mtd-mac-address = <&eeprom 0>; + mtd-mac-address-increment = <(2)>; + }; + + ethernet@3 { + label = "lan2"; + status = "okay"; + phy-mode = "sgmii"; + phy-handle = <&phy7>; + mtd-mac-address = <&eeprom 0>; + mtd-mac-address-increment = <(3)>; + }; + }; +}; -- 2.30.2