[OpenWrt-Devel] [PATCH] ramips: add support for ASUS RT-AC57U

David Bauer mail at david-bauer.net
Mon Jun 24 16:00:06 EDT 2019


Hello Christian,

On 24.06.19 21:19, Christian Lamparter wrote:
> On Monday, June 24, 2019 2:31:57 PM CEST David Bauer wrote:
> 
> Some comments below.
> 
>> diff --git a/target/linux/ramips/dts/RT-AC57U.dts b/target/linux/ramips/dts/RT-AC57U.dts
>> --- /dev/null
>> +++ b/target/linux/ramips/dts/RT-AC57U.dts
>> @@ -0,0 +1,150 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>> +/dts-v1/;
>> +
>> +#include "mt7621.dtsi"
>> +
>> +#include <dt-bindings/gpio/gpio.h>
>> +#include <dt-bindings/input/input.h>
>> +
>> +/ {
>> +	compatible = "asus,rt-ac57u", "ralink,mt7620a-soc";
> "mediatek,mt7621-soc" ?

Whoops, you are right.  I will change this to

"mediatek,mt7621-soc"

> (From what I know, the machine compatible isn't important
> but the ralink,mt7620a-soc looks odd)
> 
>> +	model = "ASUS RT-AC57U";
>> +
>> +	aliases {
>> +		led-boot = &led_power;
>> +		led-failsafe = &led_power;
>> +		led-running = &led_power;
>> +		led-upgrade = &led_power;
>> +	};
>> +
>> +	memory at 0 {
>> +		device_type = "memory";
>> +		reg = <0x0 0x8000000>;
>> +	};
>> +
>> +	chosen {
>> +		bootargs = "console=ttyS0,57600";
>> +	};
>> +
>> +	leds {
>> +		compatible = "gpio-leds";
>> +
>> +		led_power: power {
>> +			label = "rt-ac57u:blue:power";
>> +			gpios = <&gpio1 16 GPIO_ACTIVE_LOW>;
>> +		};
>> +
>> +		usb {
>> +			label = "rt-ac57u:blue:usb";
>> +			gpios = <&gpio1 15 GPIO_ACTIVE_LOW>;
>> +			trigger-sources = <&ehci_port2>;
>> +			linux,default-trigger = "usbport";
>> +		};
>> +	};
>> +
>> +	keys {
>> +		compatible = "gpio-keys-polled";
> The MT7261 should support interrupt-supported gpio-keys.

I will try your suggestion, however i suspect we will face the same 
issues we have on the ath79 platform currently.

While we are at it - i haven't forgotten about this one but due to 
hardware issues, testing is currently a bit cumbersome.

> 
>> +		poll-interval = <20>;
>> +
>> +		wps {
>> +			label = "wps";
>> +			gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
>> +			linux,code = <KEY_WPS_BUTTON>;
>> +		};
>> +
>> +		reset {
>> +			label = "reset";
>> +			gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
>> +			linux,code = <KEY_RESTART>;
>> +		};
>> +	};
>> +
>> +	led-regulator {
>> +		compatible = "regulator-fixed";
>> +		regulator-name = "LED-Power";
>> +		gpio = <&gpio1 14 GPIO_ACTIVE_LOW>;
>> +		regulator-min-microvolt = <3300000>;
>> +		regulator-max-microvolt = <3300000>;
>> +		regulator-always-on;
> Just curious, is this regulator related to ASUS "Night mode"
> feature? Also did you measure the voltages or is there a
> 3v3 LED driver on the board?

I suppose it is as the PHY LEDs seem to be controlled in hardware and so 
can't be toggled from software. The voltage is the one that goes to the 
LEDs.

Thinking about this, do you think we are better off using a "fake" LED 
for this that we set default on? A user is then able to turn off even 
the LEDs we can't control in software. We could name it something like 
"rt-ac57u:power:led". However, this would violate the naming scheme.

What do you think?

> 
>> +	};
>> +};
>> +
>> +&spi0 {
>> +	status = "okay";
>> +
>> +	flash at 0 {
>> +		compatible = "jedec,spi-nor";
>> +		reg = <0>;
>> +		spi-max-frequency = <10000000>;
> I haven't said much about the spi-max-frequencies before
> but from what I know thanks to the threads like
> "ramips: Increase GB-PC1 SPI frequency to 80MHz" the original
> these values are off. And once the target switches to 4.19 (and
> uses the upstream mt7621a.dtsi + spi-driver) this needs to be
> reworked on all devices I think

I just head a quick look over this thread and the driver. I might be 
missing something, but shouldn't the spi bus run with 10 MHz in this case?

I don't doubt that we might be able to run higher frequencies, but the 
issue you pointed out in the thread seems to only apply to frequencies > 
25MHz.

Shall i test if the device runs with the current max of 25MHz and change 
the frequency accordingly?

> 
>> +
>> +		partitions {
>> +			compatible = "fixed-partitions";
>> +			#address-cells = <1>;
>> +			#size-cells = <1>;
>> +
>> +			partition at 0 {
>> +				label = "u-boot";
>> +				reg = <0x0 0x30000>;
>> +				read-only;
>> +			};
>> +
>> +			partition at 30000 {
>> +				label = "config";
>> +				reg = <0x30000 0x10000>;
>> +				read-only;
>> +			};
>> +
>> +			factory: partition at 40000 {
>> +				label = "factory";
>> +				reg = <0x40000 0x10000>;
>> +				read-only;
>> +			};
>> +
>> +			partition at 50000 {
>> +				compatible = "denx,uimage";
>> +				label = "firmware";
>> +				reg = <0x50000 0xfb0000>;
>> +			};
>> +		};
>> +	};
>> +};
>> +
>> +&pcie {
>> +	status = "okay";
>> +};
>> +
>> +&pcie0 {
>> +	wifi at 0,0 {
>> +		reg = <0x0000 0 0 0 0>;
> Please add a compatible. (Binding text lists the right one).

Thanks, will do.

> 
>> +		mediatek,mtd-eeprom = <&factory 0x8000>;
>> +
>> +		led {
>> +			led-sources = <2>;
>> +			led-active-low;
>> +		};
>> +	};
>> +};
>> +
>> +&pcie1 {
>> +	wifi at 0,0 {
>> +		reg = <0x0000 0 0 0 0>;
> Please add a compatible. (Binding text lists the right one).

Thanks, will do.

Best wishes
David

>> +		mediatek,mtd-eeprom = <&factory 0x0000>;
>> +
>> +		led {
>> +			led-active-low;
>> +		};
>> +	};
>> +};
>> +
>> +&ethernet {
>> +	mtd-mac-address = <&factory 0x4e000>;
>> +};
>> +
>> +&pinctrl {
>> +	state_default: pinctrl0 {
>> +		gpio {
>> +			ralink,group = "sdhci";
>> +			ralink,function = "gpio";
>> +		};
>> +	};
>> +};
> 
> Cheers,
> Christian
> 
> 
> 
> 

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list