I'm expecting this to need to be tidied up based upon feedback, but here's the first try of support for the two mt7621 atel platforms I've been working on.
I have a number of smaller changes to go with this, but these are the top level pieces to get started that I want to get right first. Signed-off-by: Peter Naulls <pe...@chocky.org>
diff --git a/target/linux/ramips/dts/mt7621_atel-ei.dts b/target/linux/ramips/dts/mt7621_atel-ei.dts new file mode 100755 index 0000000000..2dcbd7b932 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_atel-ei.dts @@ -0,0 +1,177 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/mtd/partitions/uimage.h> + + +/ { + compatible = "atel,ei", "atel,aw12", "mediatek,mt7621-soc"; + model = "ATEL-EI"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + linux,code = <KEY_RESTART>; + }; + }; + + leds { + compatible = "gpio-leds"; + led_status: green { + label = "green"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + blue { + label = "blue"; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + red { + label = "red"; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + mcu-reset { + gpio-export,name = "mcu-reset"; + gpio-export,output = <0>; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + }; + + aw12-power { + gpio-export,name = "aw12-power"; + gpio-export,output = <1>; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + }; + + mcu-download { + gpio-export,name = "mcu-download"; + gpio-export,output = <0>; + gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; + }; + + mcu-watchdog { + gpio-export,name = "mcu-watchdog"; + gpio-export,output = <0>; + gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&i2c { + status = "okay"; +}; + +&sdhci { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + firmware: partition@50000 { + compatible = "openwrt,uimage", "denx,uimage"; + reg = <0x50000 0x1fa0000>; + label = "firmware"; + }; + + manufacture: partition@0x1ff0000 { + reg = <0x1ff0000 0x10000>; + label = "manufacture"; + read-only; + }; + }; + }; +}; + + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_0028>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_0028: macaddr@0028 { + reg = <0x0028 0x6>; + }; +}; + +&state_default { + gpio { + groups = "wdt", "jtag", "rgmii2"; + function = "gpio"; + }; +}; + + + + diff --git a/target/linux/ramips/dts/mt7621_atel-fi.dts b/target/linux/ramips/dts/mt7621_atel-fi.dts new file mode 100755 index 0000000000..b49cb727ed --- /dev/null +++ b/target/linux/ramips/dts/mt7621_atel-fi.dts @@ -0,0 +1,423 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> +#include <dt-bindings/mtd/partitions/uimage.h> + + +/ { + compatible = "atel,fi", "mediatek,mt7621-soc"; + model = "ATEL-FI"; + + aliases { + led-boot = &led_status; + led-failsafe = &led_status; + led-running = &led_status; + led-upgrade = &led_status; + label-mac-device = &gmac0; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + keys { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + linux,code = <KEY_RESTART>; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_status: green { + label = "green"; + gpios = <&gpio 24 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + blue { + label = "blue"; + gpios = <&gpio 23 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + signal1_red { + label = "signal1_red"; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal1_green { + label = "signal1_green"; + gpios = <&gpio 14 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal1_blue { + label = "signal1_blue"; + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal2_red { + label = "signal2_red"; + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal2_green { + label = "signal2_green"; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal2_blue { + label = "signal2_blue"; + gpios = <&gpio 12 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal3_red { + label = "signal3_red"; + gpios = <&gpio 10 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal3_green { + label = "signal3_green"; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal3_blue { + label = "signal3_blue"; + gpios = <&gpio 7 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal4_red { + label = "signal4_red"; + gpios = <&gpio 8 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal4_green { + label = "signal4_green"; + gpios = <&gpio 6 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + signal4_blue { + label = "signal4_blue"; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + wifi_green { + label = "wifi_green"; + gpios = <&gpio 26 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + wlan_green { + label = "wlan_green"; + gpios = <&gpio 22 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + lan0_yellow { + label = "lan0_yellow"; + gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + lan1_yellow { + label = "lan1_yellow"; + gpios = <&gpio 27 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + lan2_yellow { + label = "lan2_yellow"; + gpios = <&gpio 31 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + + lan3_yellow { + label = "lan3_yellow"; + gpios = <&gpio 30 GPIO_ACTIVE_HIGH>; + default-state = "off"; + }; + }; + + gsw: gsw@1e110000 { + compatible = "mediatek,mt7621-gsw"; + reg = <0x1e110000 0x8000>; + interrupt-parent = <&gic>; + interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>; + }; + + gpio-export { + compatible = "gpio-export"; + #size-cells = <0>; + + mcu-reset { + gpio-export,name = "mcu-reset"; + gpio-export,output = <0>; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + }; + + aw12-power { + gpio-export,name = "aw12-power"; + gpio-export,output = <1>; + gpios = <&gpio 25 GPIO_ACTIVE_HIGH>; + }; + + mcu-download { + gpio-export,name = "mcu-download"; + gpio-export,output = <0>; + gpios = <&gpio 28 GPIO_ACTIVE_HIGH>; + }; + + mcu-watchdog { + gpio-export,name = "mcu-watchdog"; + gpio-export,output = <0>; + gpios = <&gpio 32 GPIO_ACTIVE_HIGH>; + }; + }; + +}; + +&i2c { + status = "okay"; +}; + +&sdhci { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + // Comments are from the factory Atel image layout + + // 0x000000000000-0x000000030000 : "u-boot" + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + // 0x000000030000-0x000000040000 : "Config" + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + }; + + // 0x000000040000-0x000000050000 : "factory" + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + // 0x000000050000-0x000000f50000 : "firmware" + + firmware: partition@50000 { + compatible = "openwrt,uimage", "denx,uimage"; + //reg = <0x50000 0x1fa0000>; + reg = <0x50000 0xf00000>; + label = "firmware"; + }; + + // 0x000000f50000-0x000000f60000 : "Backup_factory" + // 0x000000f60000-0x000000f70000 : "Backup_config" + // 0x000000f70000-0x000000f80000 : "Backup_config2" + // 0x000000f80000-0x000000fa0000 : "Syslog" + // 0x000000fa0000-0x000000fc0000 : "SMS" + // 0x000000fc0000-0x000000fd0000 : "Reserve0" + // 0x000000fd0000-0x000000fe0000 : "CA_WEB" + + reserved0: partition@f50000 { + label = "reserved0"; + reg = <0xf50000 0x90000>; + read-only; + }; + + // 0x000000fe0000-0x000000ff0000 : "Manufacture_bak" + + manufacture_backup: partition@0xfe0000 { + reg = <0xfe0000 0x10000>; + label = "manufacture_backup"; + read-only; + }; + + // 0x000000ff0000-0x000001000000 : "CA_VPN" + + reserved1: partition@ff0000 { + label = "reserved1"; + reg = <0xff0000 0x10000>; + read-only; + }; + + // 0x000001000000-0x000001f00000 : "Backup_firmware" + + firmware_backup: partition@1000000 { + compatible = "openwrt,uimage", "denx,uimage"; + reg = <0x1000000 0xf00000>; + label = "firmware_backup"; + }; + + // 0x000001f00000-0x000001f10000 : "CA_uboot" + // 0x000001f10000-0x000001f60000 : "Tr069" + // 0x000001f60000-0x000001f70000 : "Reserve2" + // 0x000001f70000-0x000001ff0000 : "Reserve3" + + reserved2: partition@1f00000 { + label = "reserved2"; + reg = <0x1f00000 0xf0000>; + read-only; + }; + + // 0x000001ff0000-0x000002000000 : "Manufacture" + + manufacture: partition@0x1ff0000 { + reg = <0x1ff0000 0x10000>; + label = "manufacture"; + read-only; + }; + }; + }; +}; + + +ðernet { + pinctrl-0 = <&mdio_pins>, <&rgmii1_pins>; +}; + + +&gmac0 { + #nvmem-cells = <&macaddr_manu_007e>; + nvmem-cells = <&macaddr_factory_0028>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + + port@3 { + status = "okay"; + label = "lan4"; + }; + + port@4 { + status = "okay"; + label = "wan"; + nvmem-cells = <&macaddr_factory_002d>; + nvmem-cell-names = "mac-address"; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + nvmem-cells = <&macaddr_factory_0004>; + nvmem-cell-names = "mac-address"; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + nvmem-cells = <&macaddr_factory_8004>; + nvmem-cell-names = "mac-address"; + }; +}; + +&pcie2 { + status = "disabled"; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_0004: macaddr@0004 { // WLAN0 + reg = <0x0004 0x6>; + }; + + macaddr_factory_0028: macaddr@0028 { // LAN + reg = <0x0028 0x6>; + }; + + macaddr_factory_002d: macaddr@002d { // WAN + reg = <0x002d 0x6>; + }; + + macaddr_factory_8004: macaddr@8004 { // WLAN1 + reg = <0x8004 0x6>; + }; +}; + +&manufacture { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_manu_007e: macaddr@007e { + reg = <0x007e 0x11>; + }; +}; + +&state_default { + gpio { + groups = "wdt", "jtag", "rgmii2"; + function = "gpio"; + }; +}; + diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 9d01399c5c..fa68036532 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -338,6 +338,34 @@ define Device/asus_rt-ax53u endef TARGET_DEVICES += asus_rt-ax53u +define Device/atel-ei + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + DTS := mt7621_atel-ei + IMAGE_SIZE := 28000k + DEVICE_VENDOR := ATEL + DEVICE_MODEL := EI + SUPPORTED_DEVICES += ei atel,ei atel,aw12 + DEVICE_PACKAGES := \ + kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620 \ + kmod-usb3 +endef +TARGET_DEVICES += atel-ei + +define Device/atel-fi + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + DTS := mt7621_atel-fi + IMAGE_SIZE := 16064k + DEVICE_VENDOR := ATEL + DEVICE_MODEL := FI + SUPPORTED_DEVICES += fi atel,fi + DEVICE_PACKAGES := \ + kmod-ata-core kmod-ata-ahci kmod-sdhci-mt7620 \ + kmod-usb3 kmod-mt7603 +endef +TARGET_DEVICES += atel-fi + define Device/beeline_smartbox-flash $(Device/dsa-migration) $(Device/uimage-lzma-loader)
_______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel