public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: "Stefan Roese" <sr@denx.de>, "Marek Behún" <marek.behun@nic.cz>
Cc: u-boot@lists.denx.de
Subject: [PATCH u-boot-marvell v2] arm: a37xx: espressobin: Fix non-working SPI
Date: Wed, 23 Mar 2022 17:19:42 +0100	[thread overview]
Message-ID: <20220323161942.7308-1-pali@kernel.org> (raw)
In-Reply-To: <20220323131857.29273-1-pali@kernel.org>

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


  parent reply	other threads:[~2022-03-23 16:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Pali Rohár [this message]
2022-03-24  7:08   ` [PATCH u-boot-marvell v2] " Stefan Roese
2022-03-24 16:41 ` [PATCH u-boot-marvell] " Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220323161942.7308-1-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox