ath79: reduce spi-max-frequency to 50 MHz
authorAdrian Schmutzler <freifunk@adrianschmutzler.de>
Thu, 27 Feb 2020 10:55:36 +0000 (11:55 +0100)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Thu, 27 Feb 2020 11:14:09 +0000 (12:14 +0100)
The introduction of ebf0d8dadeca ("ath79: add new ar934x spi driver")
made the SPI memory unusable on devices with very high spi-max-frequency
(104 MHz).

Here's how the actual clock is calculated: (AHB_CLK/((CLOCK_DIVIDER+1)*2))
where AHB_CLK is a fixed clock (e.g. 200MHz on AR9331) and CLOCK_DIVIDER
is the parameter we can set. Highest clock according to this formula is
AHB_CLK/2 (100MHz, but that didn't work in device tests).
The next possible value is AHB_CLK/4 (50MHz). Speeds between 50 MHz and
100 MHz will be rounded down, so using values higher than 50 MHz does
not provide any benefit.

Consequently, this patch reduces spi-max-frequency for all devices with
values higher than 50 MHz to 50 MHz (effectively, this only affects
devices with 104 MHz before this patch).

Tested on GL.inet GL-AR150:
Boot fails with 104 MHz but is successful with both 50 MHz and 80 MHz
(fast-read), where the latter two yield identical read speeds.

Fixes: ebf0d8dadeca ("ath79: add new ar934x spi driver")
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
target/linux/ath79/dts/ar9330_glinet_gl-ar150.dts
target/linux/ath79/dts/ar9330_pqi_air-pen.dts
target/linux/ath79/dts/ar9331_8dev_carambola2.dts
target/linux/ath79/dts/ar9331_embeddedwireless_dorin.dts
target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts
target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts

index 70754c905edb5d4e9bfc5594e2f4177f34ba94c8..68e1995c76e37cb004dd9f968be30c8ceb14308e 100644 (file)
@@ -86,7 +86,7 @@
 
        flash@0 {
                compatible = "jedec,spi-nor";
-               spi-max-frequency = <104000000>;
+               spi-max-frequency = <50000000>;
                reg = <0>;
 
                partitions {
index 92484f9331d4504b2f4faa3eb1160893098326f8..8537faa0f936aa7154e946eda9ee7e3d9bbc3809 100644 (file)
@@ -75,7 +75,7 @@
 
        flash@0 {
                compatible = "jedec,spi-nor";
-               spi-max-frequency = <104000000>;
+               spi-max-frequency = <50000000>;
                reg = <0>;
 
                partitions {
index cc0320d65239c780b59e746716ea3735449b28c2..ef244f0b559bb1a38ec245a45c5e64cb334fd26f 100644 (file)
@@ -73,7 +73,7 @@
 
        flash@0 {
                compatible = "jedec,spi-nor";
-               spi-max-frequency = <104000000>;
+               spi-max-frequency = <50000000>;
                reg = <0>;
 
                partitions {
index 3489a972d4e74aedc75082a87889dc2b19eb50e8..4761b910937b8896e1e84448b6a2ad170f1bd49b 100644 (file)
@@ -68,7 +68,7 @@
 
        flash@0 {
                compatible = "jedec,spi-nor";
-               spi-max-frequency = <104000000>;
+               spi-max-frequency = <50000000>;
                reg = <0>;
 
                partitions {
index 3cd5c130c88f404c41dfdfb4e40d1d3dc1e8e5b2..97a058edf6718dbcb341b4084d869e1489e97d1d 100644 (file)
        /* Spansion S25FL032PIF SPI flash */
        flash@0 {
                compatible = "jedec,spi-nor";
-               spi-max-frequency = <104000000>;
+               spi-max-frequency = <50000000>;
                reg = <0>;
 
                partitions {
index e8a3dfbce798b6e13bf61443996fcd0cc28d2cf3..5918e611dd23b1ba757e328cb1bd1142e98770a3 100644 (file)
 
        flash@0 {
                compatible = "jedec,spi-nor";
-               spi-max-frequency = <104000000>;
+               spi-max-frequency = <50000000>;
                reg = <0>;
 
                partitions {