Message ID | 20210527081646.4813-4-user@home.lan |
---|---|
State | Accepted |
Delegated to: | Koen Vandeputte |
Headers | show |
Series | ath79: add support for MikroTik RouterBOARD 912UAG-2HPnD | expand |
Hi, a few remaining comments below. > + gpio-export { > + compatible = "gpio-export"; > + > + usb_power { > + label = "power:usb"; gpio-export nodes normally don't have a label property. We have gpio-export,name instead. > + gpio-export,name = "power-usb"; > + gpio-export,output = <1>; > + gpios = <&ssr 6 GPIO_ACTIVE_HIGH>; > + }; > + > + pcie_power { > + label = "power:pcie"; > + gpio-export,name = "power-pcie"; > + gpio-export,output = <0>; > + gpios = <&ssr 7 GPIO_ACTIVE_HIGH>; > + }; > + }; > +}; > + > +&spi { > + status = "okay"; > + > + compatible = "qca,ar7100-spi"; > + > + cs-gpios = <0>, <&gpio_latch 0 GPIO_ACTIVE_LOW>; I still don't think this belongs here. Why would it be the only device requiring this, while we removed it everywhere else? > + > + flash@0 { > + compatible = "jedec,spi-nor"; > + reg = <0>; > + spi-max-frequency = <80000000>; Typically, speeds > 50 MHz require m25p,fast-read? Best Adrian
On Mon, Jun 14, 2021 at 9:02 PM Adrian Schmutzler <mail@adrianschmutzler.de> wrote: > > Hi, > > a few remaining comments below. > >> + gpio-export { >> + compatible = "gpio-export"; >> + >> + usb_power { >> + label = "power:usb"; > > gpio-export nodes normally don't have a label property. We have gpio-export,name instead. > >> + gpio-export,name = "power-usb"; >> + gpio-export,output = <1>; >> + gpios = <&ssr 6 GPIO_ACTIVE_HIGH>; >> + }; >> + >> + pcie_power { >> + label = "power:pcie"; >> + gpio-export,name = "power-pcie"; >> + gpio-export,output = <0>; >> + gpios = <&ssr 7 GPIO_ACTIVE_HIGH>; >> + }; >> + }; >> +}; >> + >> +&spi { >> + status = "okay"; >> + >> + compatible = "qca,ar7100-spi"; >> + >> + cs-gpios = <0>, <&gpio_latch 0 GPIO_ACTIVE_LOW>; > > I still don't think this belongs here. Why would it be the only device requiring this, while we removed it everywhere else? Every other board uses SPI controller CS lines, so they are not needed in this property. While the RB912 board uses the controller CS line only to control the first device on the bus, and the regular GPIO line to control the second device. So yes, this board requires the cs-gpios property. This board is overly special, the latch based GPIO controller will just suffice to mention. >> + >> + flash@0 { >> + compatible = "jedec,spi-nor"; >> + reg = <0>; >> + spi-max-frequency = <80000000>; > > Typically, speeds > 50 MHz require m25p,fast-read?
On Thu, May 27, 2021 at 11:18 AM Denis Kalashnikov <denis281089@gmail.com> wrote: > From: Denis Kalashnikov <denis281089@gmail.com> > > This board has been supported in the ar71xx. > > Links: > * https://mikrotik.com/product/RB912UAG-2HPnD > * https://openwrt.org/toh/hwdata/mikrotik/mikrotik_rb912uag-2hpnd > > Hardware: > * SoC: Atheros AR9342, > * RAM: DDR 64MB, > * SPI NOR: 64KB, > * NAND: 128MB, > * Ethernet: x1 10/100/1000 port with passive POE in, > * Wi-Fi: 802.11 b/g/n, > * PCIe, > * USB: 2.0 EHCI controller, connected to mPCIe slot and a Type-A > port -- both can be used for LTE modem. But only one can be used. > * LEDs: 5 general purpose LEDs (led1..led5), power LED, user LED, > Ethernet phy LED, > * Button, > * Beeper. > > Not working: > * Button: it shares gpio line 15 with NAND ALE and NAND IO7, > and current drivers doesn't easily support this configuration, > * Beeper: it is connected to bit 5 of a serial shift register > (tested with sysfs led trigger timer). But kmod-gpio-beeper > doesn't work -- we left this as is for now. > > Flashing: > * Use the RouterBOARD Reset button to enable TFTP netboot, > boot kernel and initramfs and then perform sysupgrade. > * From ar71xx OpenWrt firmware run: > $ sysupgrade -F /tmp/<sysupgrade.bin> > For more info see: https://openwrt.org/toh/mikrotik/common. > > Co-Developed-by: Koen Vandeputte <koen.vandeputte@citymesh.com> > Signed-off-by: Denis Kalashnikov <denis281089@gmail.com> Reviewed-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
On 14.06.21 20:02, Adrian Schmutzler wrote: > Hi, > > a few remaining comments below. > >> + gpio-export { >> + compatible = "gpio-export"; >> + >> + usb_power { >> + label = "power:usb"; > gpio-export nodes normally don't have a label property. We have gpio-export,name instead. OK. Thanks > >> + gpio-export,name = "power-usb"; >> + gpio-export,output = <1>; >> + gpios = <&ssr 6 GPIO_ACTIVE_HIGH>; >> + }; >> + >> + pcie_power { >> + label = "power:pcie"; >> + gpio-export,name = "power-pcie"; >> + gpio-export,output = <0>; >> + gpios = <&ssr 7 GPIO_ACTIVE_HIGH>; >> + }; >> + }; >> +}; >> + >> +&spi { >> + status = "okay"; >> + >> + compatible = "qca,ar7100-spi"; >> + >> + cs-gpios = <0>, <&gpio_latch 0 GPIO_ACTIVE_LOW>; > I still don't think this belongs here. Why would it be the only device requiring this, while we removed it everywhere else? > >> + >> + flash@0 { >> + compatible = "jedec,spi-nor"; >> + reg = <0>; >> + spi-max-frequency = <80000000>; > Typically, speeds > 50 MHz require m25p,fast-read? I checked datasheets for all revisions (carrying different NOR's) and 80MHz was the lowest common for all. This was also tested on all various boards. But I do agree to play safe here and reduce to 50. The performance impact is nearly 0 while avoiding issues on potential newer revisions later on. Thanks for the insights. > > Best > > Adrian @ Denis I can adapt this right away in my staging tree if that's ok with you.
diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts new file mode 100644 index 0000000000..ffca700e0a --- /dev/null +++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts @@ -0,0 +1,214 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "ar9344.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> + +/ { + compatible = "mikrotik,routerboard-912uag-2hpnd", "qca,ar9342"; + model = "MikroTik RouterBOARD 912UAG-2HPnD"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + }; + + gpio_latch: gpio_latch { + compatible = "gpio-latch"; + gpio-controller; + #gpio-cells = <2>; + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>, + <&gpio 1 GPIO_ACTIVE_HIGH>, + <&gpio 2 GPIO_ACTIVE_HIGH>, + <&gpio 3 GPIO_ACTIVE_HIGH>, + <0>, /* Not connected */ + <&gpio 13 GPIO_ACTIVE_HIGH>, + <&gpio 14 GPIO_ACTIVE_HIGH>, + <&gpio 15 GPIO_ACTIVE_HIGH>, + <&gpio 11 GPIO_ACTIVE_LOW>; /* Latch Enable */ + }; + + nand_gpio { + compatible = "mikrotik,rb91x-nand"; + + gpios = <&gpio_latch 3 GPIO_ACTIVE_HIGH>, /* Read */ + <&gpio 4 GPIO_ACTIVE_HIGH>, /* Ready (RDY) */ + <&gpio_latch 5 GPIO_ACTIVE_LOW>, /* Chip Enable (nCE) */ + <&gpio_latch 6 GPIO_ACTIVE_HIGH>, /* Command Latch Enable (CLE) */ + <&gpio_latch 7 GPIO_ACTIVE_HIGH>, /* Address Latch Enable (ALE) */ + <&gpio 12 GPIO_ACTIVE_LOW>, /* Read/Write Enable (nRW) */ + <&gpio_latch 8 GPIO_ACTIVE_LOW>; /* Latch Enable (nLE) */ + + partitions { + compatible = "fixed-partitions"; + #size-cells = <1>; + + partition@0 { + label = "booter"; + reg = <0x0 0x0040000>; + read-only; + }; + + partition@40000 { + label = "kernel"; + reg = <0x0040000 0x03c0000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x0400000 0x7c00000>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + gpios = <&gpio_latch 1 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + user { + label = "green:user"; + gpios = <&gpio_latch 2 GPIO_ACTIVE_HIGH>; + }; + + led1 { + label = "green:led1"; + gpios = <&ssr 0 GPIO_ACTIVE_HIGH>; + }; + + led2 { + label = "green:led2"; + gpios = <&ssr 1 GPIO_ACTIVE_HIGH>; + }; + + led3 { + label = "green:led3"; + gpios = <&ssr 2 GPIO_ACTIVE_HIGH>; + }; + + led4 { + label = "green:led4"; + gpios = <&ssr 3 GPIO_ACTIVE_HIGH>; + }; + + led5 { + label = "green:led5"; + gpios = <&ssr 4 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + usb_power { + label = "power:usb"; + gpio-export,name = "power-usb"; + gpio-export,output = <1>; + gpios = <&ssr 6 GPIO_ACTIVE_HIGH>; + }; + + pcie_power { + label = "power:pcie"; + gpio-export,name = "power-pcie"; + gpio-export,output = <0>; + gpios = <&ssr 7 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&spi { + status = "okay"; + + compatible = "qca,ar7100-spi"; + + cs-gpios = <0>, <&gpio_latch 0 GPIO_ACTIVE_LOW>; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <80000000>; + + partitions { + compatible = "mikrotik,routerboot-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "routerboot"; + reg = <0x0 0x0>; + read-only; + }; + + hard_config: hard_config { + read-only; + }; + + bios { + size = <0x1000>; + read-only; + }; + + soft_config { + }; + }; + }; + + ssr: ssr@1 { + compatible = "fairchild,74hc595"; + gpio-controller; + #gpio-cells = <2>; + registers-number = <1>; + reg = <1>; + spi-max-frequency = <50000000>; + }; +}; + +&mdio0 { + status = "okay"; + + phy-mask = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +ð0 { + status = "okay"; + + phy-mode = "rgmii-id"; + phy-handle = <&phy0>; + pll-data = <0x02000000 0x00000101 0x00001313>; + + gmac-config { + device = <&gmac>; + rgmii-gmac0 = <1>; + rgmii-enabled = <1>; + rxd-delay = <1>; + txd-delay = <1>; + }; +}; + +&wmac { + status = "okay"; + qca,no-eeprom; +}; + +&pcie { + status = "okay"; +}; + +&usb { + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk index 74f8603b5a..96a94793a9 100644 --- a/target/linux/ath79/image/mikrotik.mk +++ b/target/linux/ath79/image/mikrotik.mk @@ -9,6 +9,15 @@ define Device/mikrotik_routerboard-493g endef TARGET_DEVICES += mikrotik_routerboard-493g +define Device/mikrotik_routerboard-912uag-2hpnd + $(Device/mikrotik_nand) + SOC := ar9342 + DEVICE_MODEL := RouterBOARD 912UAG-2HPnD + DEVICE_PACKAGES += kmod-usb-ehci kmod-usb2 kmod-gpio-beeper + SUPPORTED_DEVICES += rb-912uag-2hpnd +endef +TARGET_DEVICES += mikrotik_routerboard-912uag-2hpnd + define Device/mikrotik_routerboard-921gs-5hpacd-15s $(Device/mikrotik_nand) SOC := qca9558 diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index 4ffe82588c..d4a32c1e1a 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -14,6 +14,7 @@ ath79_setup_interfaces() ucidef_add_switch "switch1" \ "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" ;; + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ @@ -36,6 +37,7 @@ ath79_setup_macs() local mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)" case "$board" in + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 7ef6fdbe0f..ae0c94d8ec 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -23,6 +23,7 @@ board=$(board_name) case "$FIRMWARE" in "ath9k-eeprom-ahb-18100000.wmac.bin") case $board in + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-lhg-2nd|\ mikrotik,routerboard-sxt-5nd-r2|\ mikrotik,routerboard-wapr-2nd) diff --git a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh index 97d388168f..6962c6fdcc 100644 --- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh @@ -32,6 +32,7 @@ platform_do_upgrade() { case "$board" in mikrotik,routerboard-493g|\ + mikrotik,routerboard-912uag-2hpnd|\ mikrotik,routerboard-921gs-5hpacd-15s|\ mikrotik,routerboard-922uags-5hpacd|\ mikrotik,routerboard-sxt-5nd-r2)