ath79: reduce spi-max-frequency to 50 MHz

The introduction of ebf0d8dade ("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: ebf0d8dade ("ath79: add new ar934x spi driver")

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
This commit is contained in:
Adrian Schmutzler 2020-02-27 11:55:36 +01:00
parent 9de6bc872a
commit ebc090e420
6 changed files with 6 additions and 6 deletions

View File

@ -86,7 +86,7 @@
flash@0 { flash@0 {
compatible = "jedec,spi-nor"; compatible = "jedec,spi-nor";
spi-max-frequency = <104000000>; spi-max-frequency = <50000000>;
reg = <0>; reg = <0>;
partitions { partitions {

View File

@ -75,7 +75,7 @@
flash@0 { flash@0 {
compatible = "jedec,spi-nor"; compatible = "jedec,spi-nor";
spi-max-frequency = <104000000>; spi-max-frequency = <50000000>;
reg = <0>; reg = <0>;
partitions { partitions {

View File

@ -73,7 +73,7 @@
flash@0 { flash@0 {
compatible = "jedec,spi-nor"; compatible = "jedec,spi-nor";
spi-max-frequency = <104000000>; spi-max-frequency = <50000000>;
reg = <0>; reg = <0>;
partitions { partitions {

View File

@ -68,7 +68,7 @@
flash@0 { flash@0 {
compatible = "jedec,spi-nor"; compatible = "jedec,spi-nor";
spi-max-frequency = <104000000>; spi-max-frequency = <50000000>;
reg = <0>; reg = <0>;
partitions { partitions {

View File

@ -120,7 +120,7 @@
/* Spansion S25FL032PIF SPI flash */ /* Spansion S25FL032PIF SPI flash */
flash@0 { flash@0 {
compatible = "jedec,spi-nor"; compatible = "jedec,spi-nor";
spi-max-frequency = <104000000>; spi-max-frequency = <50000000>;
reg = <0>; reg = <0>;
partitions { partitions {

View File

@ -114,7 +114,7 @@
flash@0 { flash@0 {
compatible = "jedec,spi-nor"; compatible = "jedec,spi-nor";
spi-max-frequency = <104000000>; spi-max-frequency = <50000000>;
reg = <0>; reg = <0>;
partitions { partitions {