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 D87A8C64ED6 for ; Mon, 27 Feb 2023 07:40:25 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A5D6785A33; Mon, 27 Feb 2023 08:40:23 +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=1677483623; bh=ODA3ov7K6Mg6puA94DRIYq2Oa+R+QWiulGBH4xnJ8n8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rqnWPxupuOYdQ2UP42tMa7fTcpBlmyJW9MpQsAAOVBEpyzzbkJC9+qfwsV/wLMSaY 5yXrd81mOcoCH/x55RpaJK2XvrH/riRJtwjpprFDfW3KtenJ4HnlQWyBC6BKrT3yhW W5u1YURg2uJeU9Hr+6uaKr53O0oFM1L7U/bHWQ8DQ4znkreFEyZNrO02L476NA5Qjd cb/ZxihFkzzLbTEEUFzyw4CR+MpBh6NBYm2GMweJCUhMhQLSjJU6WN/7h6CP9/V8gm qYGk7jnAgx0uYbn767uLSFjlGswJxPglTsRH80RqrWLLE/t/ZiyeHy4vBX5ow79ear p1LWF+dgpEZYA== Received: by phobos.denx.de (Postfix, from userid 109) id 136CD85A36; Mon, 27 Feb 2023 08:40:22 +0100 (CET) Received: from mout-u-107.mailbox.org (mout-u-107.mailbox.org [80.241.59.207]) (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 C19DE85A26 for ; Mon, 27 Feb 2023 08:40:19 +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 smtp202.mailbox.org (smtp202.mailbox.org [IPv6:2001:67c:2050:b231:465::202]) (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-107.mailbox.org (Postfix) with ESMTPS id 4PQC8K3DyHz9sQ8; Mon, 27 Feb 2023 08:40:17 +0100 (CET) Message-ID: <13bee2e3-cff2-0385-393d-c3e3b0d79771@denx.de> Date: Mon, 27 Feb 2023 08:40:16 +0100 MIME-Version: 1.0 Subject: Re: [PATCH 2/2] arm: mvebu: clearfog: Add defconfig for SPI booting Content-Language: en-US To: Tony Dinh , =?UTF-8?Q?Pali_Roh=c3=a1r?= Cc: Martin Rowe , Josua Mayer , u-boot@lists.denx.de References: <20230225014220.13166-1-martin.p.rowe@gmail.com> <20230225014220.13166-3-martin.p.rowe@gmail.com> <20230225074134.c33li7ys5cktcah2@pali> <1ca418af-fa98-a982-3ac3-a94bdf894588@solid-run.com> <20230225134109.hfmpkp36cacuj5x2@pali> <20230226105229.cmoclw3sj5ckfy7a@pali> From: Stefan Roese In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4PQC8K3DyHz9sQ8 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.6 at phobos.denx.de X-Virus-Status: Clean Hi Tony, On 2/27/23 01:11, Tony Dinh wrote: > Hi Pali, > > On Sun, Feb 26, 2023 at 2:52 AM Pali Rohár wrote: >> >> On Saturday 25 February 2023 20:56:10 Tony Dinh wrote: >>> Hi Martin, >>> >>> On Sat, Feb 25, 2023 at 6:17 PM Martin Rowe wrote: >>>> >>>>>>> I'm not sure how to run proper timing tests on the process, but >>>>>>> stopwatch timing just between seeing "Trying to boot" and "U-Boot >>>>>>> 2023.04-rc2" showed the return to BootROM under 1 second, and the >>>>>>> direct from SPI around 4 seconds. I thought the goal of loading from >>>>>>> SPI directly was speed, but returning to BootROM is significantly >>>>>>> faster on this board. >>>>>> >>>>>> You should check SPI speed in DTS file and also in the defconfig. >>>>> >>>>> I think we have probably seen this slowdown before. There is a TODO in >>>>> the way the DTS nodes are parsed by DM uclass. So this config must be >>>>> set in defconfig to get around that bug: >>>>> CONFIG_SF_DEFAULT_SPEED=50000000 >>>> >>>> That works and is much faster now. I'll submit it in a V2 for these >>>> two patches once Pali's mvebu changes are accepted. Only question I >>>> have is: should the faster speed be applied to all three defconfigs? >>>> CONFIG_SF_DEFAULT_SPEED=1000000 (50x less) is implicitly added to the >>>> MMC and SATA configs at the moment. >>> >>> This is only a workaround to get the SPI probe to work correctly. The >>> real fix should be in spi_flash_probe() >>> ./common/spl/spl_spi.c >>> flash = spi_flash_probe(sf_bus, sf_cs, >>> CONFIG_SF_DEFAULT_SPEED, >>> CONFIG_SF_DEFAULT_MODE); >>> If spi_flash_probe() failed to get SPI max_hz from the DTS, the >>> fallback is CONFIG_SF_DEFAULT_SPEED. >>> >>> IMO, perhaps we could add CONFIG_SF_DEFAULT_SPEED and >>> CONFIG_SF_DEFAULT_MODE selection to arch/arm/mach-mvebu/Kconfig or >>> some other common place. And when we will have fixed the DTS parsing >>> problem, they can be removed. >>> >>> I'd like to hear from Stefan and Pali if this approach sounds good. >>> >>> All the best, >>> Tony >> >> Well, the maximal SPI speed depends on the wiring. You can have on the >> board some SPI device which does not support high frequency. >> >> But having some sane defaults in Kconfig for mvebu makes sense. Agreed. > The CONFIG_SF_DEFAULT_SPEED is set to 1_000_000 if the board defconfig > does not specify it. I think the sane default value is 10_000_000 > (grepping the Armada* DTS files showing the slowest spi-max-frequency > is 10_000_000). While a big improvement, it is not fast enough for > many other boards. So we still need to define it in those board > defconfigs (before fixing that bug), or use return to BootROM. I'm fine with setting CONFIG_SF_DEFAULT_SPEED to 10.000.000 for MVEBU. Not sure if this should be done in drivers/mtd/spi/Kconfig, as this currently has no platform- / board- specific configurations. Perhaps it can be done in a mach-mvebu Kconfig file instead? Thanks, Stefan