All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI
@ 2022-03-23 13:18 Pali Rohár
  2022-03-23 14:47 ` Stefan Roese
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Pali Rohár @ 2022-03-23 13:18 UTC (permalink / raw)
  To: Stefan Roese, Marek Behún; +Cc: u-boot

Commit 0934dddc6436 ("arm: a37xx: Update DTS files to version from
upstream Linux kernel") ported Linux's device-tree files for Armada 3720
SOCs. This broke SPI support on some Espressobin boards and results in
following U-Boot error:

  Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: f7, 30, 0b
  *** Warning - spi_flash_probe_bus_cs() failed, using default environment

Before that commit DT node for SPI was called 'spi-flash@0' and after
that commit it is called 'flash@0'. Before that commit 'spi-max-frequency'
was set to 50000000 and after it is 104000000.

Rename DT node 'spi-flash@0 in armada-3720-espressobin-u-boot.dtsi to
'flash@0' and set custom U-Boot 'spi-max-frequency' back to 50000000.

With this change SPI is working on Espressobin again and it is detected
with JEDEC ids ef, 60, 16 on our tested unit.

  Loading Environment from SPIFlash... SF: Detected w25q32dw with page size 256 Bytes, erase size 4 KiB, total 4 MiB
  OK

Note that it is unknown why spi-max-frequency with value 104000000 does not
work in U-Boot as it works fine with Linux kernel. Also note that in
defconfig file configs/mvebu_espressobin-88f3720_defconfig is set option
CONFIG_SF_DEFAULT_SPEED=40000000 which is different value than in DT.

Fixes: 0934dddc6436 ("arm: a37xx: Update DTS files to version from upstream Linux kernel")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
Hello Stefan, like with USB3.0 port on Turris MOX, this is SPI
regression on Espressobin in U-Boot 2022.04. Could you send this fix to
master to have SPI working in U-Boot 2022.04? I do not know what is wrong
with SPI frequency and we have different value in defconfig and
different value in DTS file and another value in kernel DTS file. So the
best for now is to stick with old value which was used in U-Boot.

I have tested also Turris MOX with current U-Boot from master branch and
it does not have any issue with SPI, like Espressobin.
---
 arch/arm/dts/armada-3720-espressobin-u-boot.dtsi | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
index 3e01c64a4bdb..2ffdc65e9f47 100644
--- a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
+++ b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
@@ -1,8 +1,15 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 
-#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
 &spi0 {
-	spi-flash@0 {
+	flash@0 {
+		/*
+		 * For some unknown reason U-Boot SPI driver cannot access
+		 * SPI-NOR with higher frequency. Linux kernel SPI driver
+		 * does not have this problem.
+		 */
+		spi-max-frequency = <50000000>;
+
+#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
 		partitions {
 			compatible = "fixed-partitions";
 			#address-cells = <1>;
@@ -19,8 +26,8 @@
 			};
 		};
 	};
-};
 #endif
+};
 
 /*
  * U-Boot requires to have this eMMC node by default in "okay" status. U-Boot
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI
  2022-03-23 13:18 [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI Pali Rohár
@ 2022-03-23 14:47 ` Stefan Roese
  2022-03-23 16:13 ` Stefan Roese
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2022-03-23 14:47 UTC (permalink / raw)
  To: Pali Rohár, Marek Behún; +Cc: u-boot

On 3/23/22 14:18, Pali Rohár wrote:
> Commit 0934dddc6436 ("arm: a37xx: Update DTS files to version from
> upstream Linux kernel") ported Linux's device-tree files for Armada 3720
> SOCs. This broke SPI support on some Espressobin boards and results in
> following U-Boot error:
> 
>    Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: f7, 30, 0b
>    *** Warning - spi_flash_probe_bus_cs() failed, using default environment
> 
> Before that commit DT node for SPI was called 'spi-flash@0' and after
> that commit it is called 'flash@0'. Before that commit 'spi-max-frequency'
> was set to 50000000 and after it is 104000000.
> 
> Rename DT node 'spi-flash@0 in armada-3720-espressobin-u-boot.dtsi to
> 'flash@0' and set custom U-Boot 'spi-max-frequency' back to 50000000.
> 
> With this change SPI is working on Espressobin again and it is detected
> with JEDEC ids ef, 60, 16 on our tested unit.
> 
>    Loading Environment from SPIFlash... SF: Detected w25q32dw with page size 256 Bytes, erase size 4 KiB, total 4 MiB
>    OK
> 
> Note that it is unknown why spi-max-frequency with value 104000000 does not
> work in U-Boot as it works fine with Linux kernel. Also note that in
> defconfig file configs/mvebu_espressobin-88f3720_defconfig is set option
> CONFIG_SF_DEFAULT_SPEED=40000000 which is different value than in DT.
> 
> Fixes: 0934dddc6436 ("arm: a37xx: Update DTS files to version from upstream Linux kernel")
> Signed-off-by: Pali Rohár <pali@kernel.org>

Reviewed-by: Stefan Roese <sr@denx.de>

> ---
> Hello Stefan, like with USB3.0 port on Turris MOX, this is SPI
> regression on Espressobin in U-Boot 2022.04. Could you send this fix to
> master to have SPI working in U-Boot 2022.04? I do not know what is wrong
> with SPI frequency and we have different value in defconfig and
> different value in DTS file and another value in kernel DTS file. So the
> best for now is to stick with old value which was used in U-Boot.
> 
> I have tested also Turris MOX with current U-Boot from master branch and
> it does not have any issue with SPI, like Espressobin.

Let me try. I've pushed it and CI building is running now. Let's keep
the fingers crossed. ;)

Thanks,
Stefan

> ---
>   arch/arm/dts/armada-3720-espressobin-u-boot.dtsi | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> index 3e01c64a4bdb..2ffdc65e9f47 100644
> --- a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> +++ b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> @@ -1,8 +1,15 @@
>   // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>   
> -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
>   &spi0 {
> -	spi-flash@0 {
> +	flash@0 {
> +		/*
> +		 * For some unknown reason U-Boot SPI driver cannot access
> +		 * SPI-NOR with higher frequency. Linux kernel SPI driver
> +		 * does not have this problem.
> +		 */
> +		spi-max-frequency = <50000000>;
> +
> +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
>   		partitions {
>   			compatible = "fixed-partitions";
>   			#address-cells = <1>;
> @@ -19,8 +26,8 @@
>   			};
>   		};
>   	};
> -};
>   #endif
> +};
>   
>   /*
>    * U-Boot requires to have this eMMC node by default in "okay" status. U-Boot

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI
  2022-03-23 13:18 [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI Pali Rohár
  2022-03-23 14:47 ` Stefan Roese
@ 2022-03-23 16:13 ` Stefan Roese
  2022-03-23 16:16   ` Pali Rohár
  2022-03-23 16:19 ` [PATCH u-boot-marvell v2] " Pali Rohár
  2022-03-24 16:41 ` [PATCH u-boot-marvell] " Stefan Roese
  3 siblings, 1 reply; 7+ messages in thread
From: Stefan Roese @ 2022-03-23 16:13 UTC (permalink / raw)
  To: Pali Rohár, Marek Behún; +Cc: u-boot

Hi Pali,

On 3/23/22 14:18, Pali Rohár wrote:
> Commit 0934dddc6436 ("arm: a37xx: Update DTS files to version from
> upstream Linux kernel") ported Linux's device-tree files for Armada 3720
> SOCs. This broke SPI support on some Espressobin boards and results in
> following U-Boot error:
> 
>    Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: f7, 30, 0b
>    *** Warning - spi_flash_probe_bus_cs() failed, using default environment
> 
> Before that commit DT node for SPI was called 'spi-flash@0' and after
> that commit it is called 'flash@0'. Before that commit 'spi-max-frequency'
> was set to 50000000 and after it is 104000000.
> 
> Rename DT node 'spi-flash@0 in armada-3720-espressobin-u-boot.dtsi to
> 'flash@0' and set custom U-Boot 'spi-max-frequency' back to 50000000.
> 
> With this change SPI is working on Espressobin again and it is detected
> with JEDEC ids ef, 60, 16 on our tested unit.
> 
>    Loading Environment from SPIFlash... SF: Detected w25q32dw with page size 256 Bytes, erase size 4 KiB, total 4 MiB
>    OK
> 
> Note that it is unknown why spi-max-frequency with value 104000000 does not
> work in U-Boot as it works fine with Linux kernel. Also note that in
> defconfig file configs/mvebu_espressobin-88f3720_defconfig is set option
> CONFIG_SF_DEFAULT_SPEED=40000000 which is different value than in DT.
> 
> Fixes: 0934dddc6436 ("arm: a37xx: Update DTS files to version from upstream Linux kernel")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> Hello Stefan, like with USB3.0 port on Turris MOX, this is SPI
> regression on Espressobin in U-Boot 2022.04. Could you send this fix to
> master to have SPI working in U-Boot 2022.04? I do not know what is wrong
> with SPI frequency and we have different value in defconfig and
> different value in DTS file and another value in kernel DTS file. So the
> best for now is to stick with old value which was used in U-Boot.
> 
> I have tested also Turris MOX with current U-Boot from master branch and
> it does not have any issue with SPI, like Espressobin.
> ---
>   arch/arm/dts/armada-3720-espressobin-u-boot.dtsi | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)

Unfortunately this generates problem with other MVEBU targets:

$ make mvebu_crb_cn9130_defconfig
#
# configuration written to .config
#
$ make -s -j20
Error: arch/arm/dts/armada-3720-espressobin-u-boot.dtsi:36.1-8 syntax error
FATAL ERROR: Unable to parse input tree
Check 
/home/stefan/git/u-boot/u-boot-marvell/arch/arm/dts/.armada-3720-espressobin.dtb.pre.tmp 
for errors
make[2]: *** [scripts/Makefile.lib:337: 
arch/arm/dts/armada-3720-espressobin.dtb] Error 1
make[1]: *** [dts/Makefile:44: arch-dtbs] Error 2
make: *** [Makefile:1150: dts/dt.dtb] Error 2
make: *** Waiting for unfinished jobs....

Could you please take a look?

Thanks,
Stefan

> diff --git a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> index 3e01c64a4bdb..2ffdc65e9f47 100644
> --- a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> +++ b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> @@ -1,8 +1,15 @@
>   // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>   
> -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
>   &spi0 {
> -	spi-flash@0 {
> +	flash@0 {
> +		/*
> +		 * For some unknown reason U-Boot SPI driver cannot access
> +		 * SPI-NOR with higher frequency. Linux kernel SPI driver
> +		 * does not have this problem.
> +		 */
> +		spi-max-frequency = <50000000>;
> +
> +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
>   		partitions {
>   			compatible = "fixed-partitions";
>   			#address-cells = <1>;
> @@ -19,8 +26,8 @@
>   			};
>   		};
>   	};
> -};
>   #endif
> +};
>   
>   /*
>    * U-Boot requires to have this eMMC node by default in "okay" status. U-Boot

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI
  2022-03-23 16:13 ` Stefan Roese
@ 2022-03-23 16:16   ` Pali Rohár
  0 siblings, 0 replies; 7+ messages in thread
From: Pali Rohár @ 2022-03-23 16:16 UTC (permalink / raw)
  To: Stefan Roese; +Cc: Marek Behún, u-boot

On Wednesday 23 March 2022 17:13:21 Stefan Roese wrote:
> Hi Pali,
> 
> On 3/23/22 14:18, Pali Rohár wrote:
> > Commit 0934dddc6436 ("arm: a37xx: Update DTS files to version from
> > upstream Linux kernel") ported Linux's device-tree files for Armada 3720
> > SOCs. This broke SPI support on some Espressobin boards and results in
> > following U-Boot error:
> > 
> >    Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: f7, 30, 0b
> >    *** Warning - spi_flash_probe_bus_cs() failed, using default environment
> > 
> > Before that commit DT node for SPI was called 'spi-flash@0' and after
> > that commit it is called 'flash@0'. Before that commit 'spi-max-frequency'
> > was set to 50000000 and after it is 104000000.
> > 
> > Rename DT node 'spi-flash@0 in armada-3720-espressobin-u-boot.dtsi to
> > 'flash@0' and set custom U-Boot 'spi-max-frequency' back to 50000000.
> > 
> > With this change SPI is working on Espressobin again and it is detected
> > with JEDEC ids ef, 60, 16 on our tested unit.
> > 
> >    Loading Environment from SPIFlash... SF: Detected w25q32dw with page size 256 Bytes, erase size 4 KiB, total 4 MiB
> >    OK
> > 
> > Note that it is unknown why spi-max-frequency with value 104000000 does not
> > work in U-Boot as it works fine with Linux kernel. Also note that in
> > defconfig file configs/mvebu_espressobin-88f3720_defconfig is set option
> > CONFIG_SF_DEFAULT_SPEED=40000000 which is different value than in DT.
> > 
> > Fixes: 0934dddc6436 ("arm: a37xx: Update DTS files to version from upstream Linux kernel")
> > Signed-off-by: Pali Rohár <pali@kernel.org>
> > ---
> > Hello Stefan, like with USB3.0 port on Turris MOX, this is SPI
> > regression on Espressobin in U-Boot 2022.04. Could you send this fix to
> > master to have SPI working in U-Boot 2022.04? I do not know what is wrong
> > with SPI frequency and we have different value in defconfig and
> > different value in DTS file and another value in kernel DTS file. So the
> > best for now is to stick with old value which was used in U-Boot.
> > 
> > I have tested also Turris MOX with current U-Boot from master branch and
> > it does not have any issue with SPI, like Espressobin.
> > ---
> >   arch/arm/dts/armada-3720-espressobin-u-boot.dtsi | 13 ++++++++++---
> >   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> Unfortunately this generates problem with other MVEBU targets:
> 
> $ make mvebu_crb_cn9130_defconfig
> #
> # configuration written to .config
> #
> $ make -s -j20
> Error: arch/arm/dts/armada-3720-espressobin-u-boot.dtsi:36.1-8 syntax error
> FATAL ERROR: Unable to parse input tree
> Check /home/stefan/git/u-boot/u-boot-marvell/arch/arm/dts/.armada-3720-espressobin.dtb.pre.tmp
> for errors
> make[2]: *** [scripts/Makefile.lib:337:
> arch/arm/dts/armada-3720-espressobin.dtb] Error 1
> make[1]: *** [dts/Makefile:44: arch-dtbs] Error 2
> make: *** [Makefile:1150: dts/dt.dtb] Error 2
> make: *** Waiting for unfinished jobs....
> 
> Could you please take a look?

I see...

> Thanks,
> Stefan
> 
> > diff --git a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> > index 3e01c64a4bdb..2ffdc65e9f47 100644
> > --- a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> > +++ b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> > @@ -1,8 +1,15 @@
> >   // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
> > -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
> >   &spi0 {
> > -	spi-flash@0 {
> > +	flash@0 {
> > +		/*
> > +		 * For some unknown reason U-Boot SPI driver cannot access
> > +		 * SPI-NOR with higher frequency. Linux kernel SPI driver
> > +		 * does not have this problem.
> > +		 */
> > +		spi-max-frequency = <50000000>;
> > +
> > +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
> >   		partitions {
> >   			compatible = "fixed-partitions";
> >   			#address-cells = <1>;
> > @@ -19,8 +26,8 @@
> >   			};
> >   		};
> >   	};
> > -};
> >   #endif
> > +};

Issue is with this #endif, it should be at the one line above as it
guard partitions { ... }; node.

I will send v2.

> >   /*
> >    * U-Boot requires to have this eMMC node by default in "okay" status. U-Boot
> 
> Viele Grüße,
> Stefan Roese
> 
> -- 
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH u-boot-marvell v2] arm: a37xx: espressobin: Fix non-working SPI
  2022-03-23 13:18 [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI Pali Rohár
  2022-03-23 14:47 ` Stefan Roese
  2022-03-23 16:13 ` Stefan Roese
@ 2022-03-23 16:19 ` Pali Rohár
  2022-03-24  7:08   ` Stefan Roese
  2022-03-24 16:41 ` [PATCH u-boot-marvell] " Stefan Roese
  3 siblings, 1 reply; 7+ messages in thread
From: Pali Rohár @ 2022-03-23 16:19 UTC (permalink / raw)
  To: Stefan Roese, Marek Behún; +Cc: u-boot

Commit 0934dddc6436 ("arm: a37xx: Update DTS files to version from
upstream Linux kernel") ported Linux's device-tree files for Armada 3720
SOCs. This broke SPI support on some Espressobin boards and results in
following U-Boot error:

  Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: f7, 30, 0b
  *** Warning - spi_flash_probe_bus_cs() failed, using default environment

Before that commit DT node for SPI was called 'spi-flash@0' and after
that commit it is called 'flash@0'. Before that commit 'spi-max-frequency'
was set to 50000000 and after it is 104000000.

Rename DT node 'spi-flash@0 in armada-3720-espressobin-u-boot.dtsi to
'flash@0' and set custom U-Boot 'spi-max-frequency' back to 50000000.

With this change SPI is working on Espressobin again and it is detected
with JEDEC ids ef, 60, 16 on our tested unit.

  Loading Environment from SPIFlash... SF: Detected w25q32dw with page size 256 Bytes, erase size 4 KiB, total 4 MiB
  OK

Note that it is unknown why spi-max-frequency with value 104000000 does not
work in U-Boot as it works fine with Linux kernel. Also note that in
defconfig file configs/mvebu_espressobin-88f3720_defconfig is set option
CONFIG_SF_DEFAULT_SPEED=40000000 which is different value than in DT.

Fixes: 0934dddc6436 ("arm: a37xx: Update DTS files to version from upstream Linux kernel")
Signed-off-by: Pali Rohár <pali@kernel.org>

---
Changes in v2:
* Fix #endif for partitions { } node
---
 arch/arm/dts/armada-3720-espressobin-u-boot.dtsi | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
index 3e01c64a4bdb..07293ab72d1f 100644
--- a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
+++ b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
@@ -1,8 +1,15 @@
 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
 
-#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
 &spi0 {
-	spi-flash@0 {
+	flash@0 {
+		/*
+		 * For some unknown reason U-Boot SPI driver cannot access
+		 * SPI-NOR with higher frequency. Linux kernel SPI driver
+		 * does not have this problem.
+		 */
+		spi-max-frequency = <50000000>;
+
+#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
 		partitions {
 			compatible = "fixed-partitions";
 			#address-cells = <1>;
@@ -18,9 +25,9 @@
 				label = "u-boot-env";
 			};
 		};
+#endif
 	};
 };
-#endif
 
 /*
  * U-Boot requires to have this eMMC node by default in "okay" status. U-Boot
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH u-boot-marvell v2] arm: a37xx: espressobin: Fix non-working SPI
  2022-03-23 16:19 ` [PATCH u-boot-marvell v2] " Pali Rohár
@ 2022-03-24  7:08   ` Stefan Roese
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2022-03-24  7:08 UTC (permalink / raw)
  To: Pali Rohár, Marek Behún; +Cc: u-boot

On 3/23/22 17:19, Pali Rohár wrote:
> Commit 0934dddc6436 ("arm: a37xx: Update DTS files to version from
> upstream Linux kernel") ported Linux's device-tree files for Armada 3720
> SOCs. This broke SPI support on some Espressobin boards and results in
> following U-Boot error:
> 
>    Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: f7, 30, 0b
>    *** Warning - spi_flash_probe_bus_cs() failed, using default environment
> 
> Before that commit DT node for SPI was called 'spi-flash@0' and after
> that commit it is called 'flash@0'. Before that commit 'spi-max-frequency'
> was set to 50000000 and after it is 104000000.
> 
> Rename DT node 'spi-flash@0 in armada-3720-espressobin-u-boot.dtsi to
> 'flash@0' and set custom U-Boot 'spi-max-frequency' back to 50000000.
> 
> With this change SPI is working on Espressobin again and it is detected
> with JEDEC ids ef, 60, 16 on our tested unit.
> 
>    Loading Environment from SPIFlash... SF: Detected w25q32dw with page size 256 Bytes, erase size 4 KiB, total 4 MiB
>    OK
> 
> Note that it is unknown why spi-max-frequency with value 104000000 does not
> work in U-Boot as it works fine with Linux kernel. Also note that in
> defconfig file configs/mvebu_espressobin-88f3720_defconfig is set option
> CONFIG_SF_DEFAULT_SPEED=40000000 which is different value than in DT.
> 
> Fixes: 0934dddc6436 ("arm: a37xx: Update DTS files to version from upstream Linux kernel")
> Signed-off-by: Pali Rohár <pali@kernel.org>
> 
> ---
> Changes in v2:
> * Fix #endif for partitions { } node

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   arch/arm/dts/armada-3720-espressobin-u-boot.dtsi | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> index 3e01c64a4bdb..07293ab72d1f 100644
> --- a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> +++ b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> @@ -1,8 +1,15 @@
>   // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>   
> -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
>   &spi0 {
> -	spi-flash@0 {
> +	flash@0 {
> +		/*
> +		 * For some unknown reason U-Boot SPI driver cannot access
> +		 * SPI-NOR with higher frequency. Linux kernel SPI driver
> +		 * does not have this problem.
> +		 */
> +		spi-max-frequency = <50000000>;
> +
> +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
>   		partitions {
>   			compatible = "fixed-partitions";
>   			#address-cells = <1>;
> @@ -18,9 +25,9 @@
>   				label = "u-boot-env";
>   			};
>   		};
> +#endif
>   	};
>   };
> -#endif
>   
>   /*
>    * U-Boot requires to have this eMMC node by default in "okay" status. U-Boot

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI
  2022-03-23 13:18 [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI Pali Rohár
                   ` (2 preceding siblings ...)
  2022-03-23 16:19 ` [PATCH u-boot-marvell v2] " Pali Rohár
@ 2022-03-24 16:41 ` Stefan Roese
  3 siblings, 0 replies; 7+ messages in thread
From: Stefan Roese @ 2022-03-24 16:41 UTC (permalink / raw)
  To: Pali Rohár, Marek Behún; +Cc: u-boot

On 3/23/22 14:18, Pali Rohár wrote:
> Commit 0934dddc6436 ("arm: a37xx: Update DTS files to version from
> upstream Linux kernel") ported Linux's device-tree files for Armada 3720
> SOCs. This broke SPI support on some Espressobin boards and results in
> following U-Boot error:
> 
>    Loading Environment from SPIFlash... jedec_spi_nor flash@0: unrecognized JEDEC id bytes: f7, 30, 0b
>    *** Warning - spi_flash_probe_bus_cs() failed, using default environment
> 
> Before that commit DT node for SPI was called 'spi-flash@0' and after
> that commit it is called 'flash@0'. Before that commit 'spi-max-frequency'
> was set to 50000000 and after it is 104000000.
> 
> Rename DT node 'spi-flash@0 in armada-3720-espressobin-u-boot.dtsi to
> 'flash@0' and set custom U-Boot 'spi-max-frequency' back to 50000000.
> 
> With this change SPI is working on Espressobin again and it is detected
> with JEDEC ids ef, 60, 16 on our tested unit.
> 
>    Loading Environment from SPIFlash... SF: Detected w25q32dw with page size 256 Bytes, erase size 4 KiB, total 4 MiB
>    OK
> 
> Note that it is unknown why spi-max-frequency with value 104000000 does not
> work in U-Boot as it works fine with Linux kernel. Also note that in
> defconfig file configs/mvebu_espressobin-88f3720_defconfig is set option
> CONFIG_SF_DEFAULT_SPEED=40000000 which is different value than in DT.
> 
> Fixes: 0934dddc6436 ("arm: a37xx: Update DTS files to version from upstream Linux kernel")
> Signed-off-by: Pali Rohár <pali@kernel.org>

Applied to u-boot-marvell/master

Thanks,
Stefan

> ---
> Hello Stefan, like with USB3.0 port on Turris MOX, this is SPI
> regression on Espressobin in U-Boot 2022.04. Could you send this fix to
> master to have SPI working in U-Boot 2022.04? I do not know what is wrong
> with SPI frequency and we have different value in defconfig and
> different value in DTS file and another value in kernel DTS file. So the
> best for now is to stick with old value which was used in U-Boot.
> 
> I have tested also Turris MOX with current U-Boot from master branch and
> it does not have any issue with SPI, like Espressobin.
> ---
>   arch/arm/dts/armada-3720-espressobin-u-boot.dtsi | 13 ++++++++++---
>   1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> index 3e01c64a4bdb..2ffdc65e9f47 100644
> --- a/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> +++ b/arch/arm/dts/armada-3720-espressobin-u-boot.dtsi
> @@ -1,8 +1,15 @@
>   // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>   
> -#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
>   &spi0 {
> -	spi-flash@0 {
> +	flash@0 {
> +		/*
> +		 * For some unknown reason U-Boot SPI driver cannot access
> +		 * SPI-NOR with higher frequency. Linux kernel SPI driver
> +		 * does not have this problem.
> +		 */
> +		spi-max-frequency = <50000000>;
> +
> +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH
>   		partitions {
>   			compatible = "fixed-partitions";
>   			#address-cells = <1>;
> @@ -19,8 +26,8 @@
>   			};
>   		};
>   	};
> -};
>   #endif
> +};
>   
>   /*
>    * U-Boot requires to have this eMMC node by default in "okay" status. U-Boot

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-24 16:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23 13:18 [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI Pali Rohár
2022-03-23 14:47 ` Stefan Roese
2022-03-23 16:13 ` Stefan Roese
2022-03-23 16:16   ` Pali Rohár
2022-03-23 16:19 ` [PATCH u-boot-marvell v2] " Pali Rohár
2022-03-24  7:08   ` Stefan Roese
2022-03-24 16:41 ` [PATCH u-boot-marvell] " Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.