Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46DC2C433EF for ; Wed, 23 Mar 2022 16:13:35 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 23C3883BDB; Wed, 23 Mar 2022 17:13:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1648052012; bh=XOqzNgsYiV3qPAdOm4JosIqapl0FYsSsRw3mrZ35zJQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=O+ylLCeL7g5xs7eRReptsIFViCXjFD8MH/3ZEFVvAi2/z5QZ62T6cDf4PLWQPJqUu qpNeTT+A6Pgi39nsNzJDb4q7x9Gqxd5m+hWs6pdIVADAvnjTspu7oZUaJICI07dHh7 /cRHXcdAUj6sP7Pi5G5cihymx/AKsIYtonhGy2kwKni1h6akt5kJr3zPGHk7h4XUtn VAfEZaUw0j1ZLSfbdL9l3NP3D67iA+UOKOGP9TlulyWYsT3tAEahRP23bFTLYIGlc0 7r5TcbQbkSR7ukRF1tq2PBcIMJEGcbjE6KA+oKUQ8ix2hlhgaXaMYofYVLECLNoPKi 1s74YT3Kz3oQw== Received: by phobos.denx.de (Postfix, from userid 109) id 4C56383F6C; Wed, 23 Mar 2022 17:13:30 +0100 (CET) Received: from mout-u-204.mailbox.org (mout-u-204.mailbox.org [91.198.250.253]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFF1A83972 for ; Wed, 23 Mar 2022 17:13:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:105:465:1:3:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4KNtgp1ztRz9sV8; Wed, 23 Mar 2022 17:13:26 +0100 (CET) Message-ID: <359d64fe-138a-320e-156c-3b595ace7717@denx.de> Date: Wed, 23 Mar 2022 17:13:21 +0100 MIME-Version: 1.0 Subject: Re: [PATCH u-boot-marvell] arm: a37xx: espressobin: Fix non-working SPI Content-Language: en-US To: =?UTF-8?Q?Pali_Roh=c3=a1r?= , =?UTF-8?Q?Marek_Beh=c3=ban?= Cc: u-boot@lists.denx.de References: <20220323131857.29273-1-pali@kernel.org> From: Stefan Roese In-Reply-To: <20220323131857.29273-1-pali@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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 > --- > 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