[PATCH] ramips: increase SPI frequency for MT7620 Archer

David Bauer mail at david-bauer.net
Wed Jul 22 08:21:13 EDT 2020


Hello Adrian,

On 7/22/20 11:29 AM, mail at adrianschmutzler.de wrote:
>> -----Original Message-----
>> From: openwrt-devel [mailto:openwrt-devel-bounces at lists.openwrt.org]
>> On Behalf Of David Bauer
>> Sent: Dienstag, 21. Juli 2020 23:40
>> To: openwrt-devel at lists.openwrt.org
>> Subject: [PATCH] ramips: increase SPI frequency for MT7620 Archer
>>
>> Increase the SPI frequency for the MT7620 based TP-Link Archer series to
>> 30MHz.
> 
> Acked-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> 
> I'm not sure which are the frequency steps actually observed on that target, but raising it above the abundant copy/pasted 10 MHz seems a good idea in any case.

The SPI master can be operated in a range of {2..128}/SYS_CLK. (2..128 
has to be power of two). So in the end it will transfer at around 18 MHz.

I don't want to crank this up further, as TP-Link uses a broad selection 
of SPI chips on a single hardware revision on many of their devices. 
Increasing performance might come at the cost of compatibility here.

Best wishes
David

> 
> Best
> 
> Adrian
> 
>>
>> TP-Link uses different SPI flash chips for the same board revision, so be
>> conservative to not break boards with a different chip. 30MHz should be well
>> supported by all chips.
>>
>> Tested on Archer C2 v1 (GD25Q64B) and Archer C20i (W25Q64FV).
>>
>> Archer C20i (before)
>> ====================
>> root at OpenWrt:~# time dd if=/dev/mtd1 of=/tmp/test.bin bs=64k
>> 122+0 records in
>> 122+0 records out
>> real	0m 15.30s
>> user	0m 0.00s
>> sys	0m 15.29s
>>
>> Archer C20i (after)
>> ===================
>> root at OpenWrt:~# time dd if=/dev/mtd1 of=/tmp/test.bin bs=64k
>> 122+0 records in
>> 122+0 records out
>> real	0m 5.99s
>> user	0m 0.00s
>> sys	0m 5.98s
>>
>> Signed-off-by: David Bauer <mail at david-bauer.net>
>> ---
>>   target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts | 2 +-
>> target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts | 2 +-
>>   target/linux/ramips/dts/mt7620a_tplink_archer.dtsi      | 2 +-
>>   3 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts
>> b/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts
>> index c0b2c1ae92..75ddc5fb5d 100644
>> --- a/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts
>> +++ b/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts
>> @@ -82,7 +82,7 @@
>>   	flash at 0 {
>>   		compatible = "jedec,spi-nor";
>>   		reg = <0>;
>> -		spi-max-frequency = <10000000>;
>> +		spi-max-frequency = <30000000>;
>>
>>   		partitions {
>>   			compatible = "fixed-partitions";
>> diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts
>> b/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts
>> index c3c0efdfe6..0c0f4bb8e9 100644
>> --- a/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts
>> +++ b/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts
>> @@ -121,7 +121,7 @@
>>   	flash at 0 {
>>   		compatible = "jedec,spi-nor";
>>   		reg = <0>;
>> -		spi-max-frequency = <10000000>;
>> +		spi-max-frequency = <30000000>;
>>
>>   		partitions {
>>   			compatible = "fixed-partitions";
>> diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi
>> b/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi
>> index 184627b9f4..670bad615d 100644
>> --- a/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi
>> +++ b/target/linux/ramips/dts/mt7620a_tplink_archer.dtsi
>> @@ -43,7 +43,7 @@
>>   	flash at 0 {
>>   		compatible = "jedec,spi-nor";
>>   		reg = <0>;
>> -		spi-max-frequency = <10000000>;
>> +		spi-max-frequency = <30000000>;
>>
>>   		partitions {
>>   			compatible = "fixed-partitions";
>> --
>> 2.27.0
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel at lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>
>> _______________________________________________
>> 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