From mboxrd@z Thu Jan 1 00:00:00 1970 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 F2D4CC433EF for ; Thu, 2 Dec 2021 06:04:06 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 88805830F5; Thu, 2 Dec 2021 07:04:04 +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=1638425045; bh=rRs9ASJsNVvs2Kvk8bUbtzJXaYeOSj3FGAfKMnXo5nc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=WqEWGnhSo3kkLX3lFOUK8N09qNBAnY/1nRNxp19RpczUexyp1jHfrLxt//apz1+Mm hrslmUcDPWcboDAT7kQaDTHAaevv7gAo1el5zqW8J5KwYHbo/5lu+4V0Z4uF2DrhNp 3Pcr4VIPkXx3AZUvSYd8hD8tGUTv/zcv9zkS9AxX4v7B15puI/3hVliQ60zEHBtIzr ReA4WdaW+QFgOZgue7CnOfRc2vdrEBCxR22JEI7cQ3mCjKlbMX09TVgb6kDpV6JHHq KcUOp7/ZijTqLCHKW7UsO9KJswsWawBmGPqIJ8ra5tKPIAvpseT+eDUqT4dNyPVgT/ cTKq67AZ5NoOQ== Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id B4E79830EC; Thu, 2 Dec 2021 07:03:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1638425040; bh=rRs9ASJsNVvs2Kvk8bUbtzJXaYeOSj3FGAfKMnXo5nc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Np1ODK60Aqe/uikrcUAabdVt2jnPTS+TD03s08hX7b3kWzHvDFIYI4/2JB/etgo8Y 8LmC+VUSlPu1nbdxmtMTx0nJ5qtfG8jk6GJ6RgLBdFKZu9MExFw5IO8MmgjFlfda7C W3PqUKAAZySD/0BxEtuZDkNYnwJGnxD/p1zTZGPKeuVRkHJv+dsUq9nSemEhR6CKnU 0ppoXK/5SNZ6a0DmdVqhDAwSR/CwxewLMpUSxTHvRsqH40/DbLb3/uNjgG5jO4tdPj gbyMwbRjpwvgsthFIe36DkkXHWhk7nhlfdURsAcPDdSHpjGaAa4dn6q0OslTWdyUQ8 QtrNnRBwO9zVg== Message-ID: Date: Thu, 2 Dec 2021 07:03:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH] mtd: sf: Set SF parameters as env variables Content-Language: en-US To: Jagan Teki Cc: Tom Rini , u-boot@lists.denx.de, Vignesh R References: <20210914032849.273625-1-marex@denx.de> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.37 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.2 at phobos.denx.de X-Virus-Status: Clean On 12/2/21 06:57, Jagan Teki wrote: > On Thu, Dec 2, 2021 at 11:19 AM Marek Vasut wrote: >> >> On 12/2/21 06:47, Jagan Teki wrote: >>> On Tue, Sep 14, 2021 at 8:59 AM Marek Vasut wrote: >>>> >>>> Set the SF page size, erase block size and total size as an environment >>>> variable after "sf probe". This lets us discern boards with multiple >>>> distinct SPI flash options and also e.g. set mtdparts accordingly. >>>> >>>> Signed-off-by: Marek Vasut >>>> Cc: Jagan Teki >>>> Cc: Vignesh R >>>> --- >>>> drivers/mtd/spi/spi-nor-core.c | 4 ++++ >>>> 1 file changed, 4 insertions(+) >>>> >>>> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c >>>> index d5d905fa5a1..448653b9931 100644 >>>> --- a/drivers/mtd/spi/spi-nor-core.c >>>> +++ b/drivers/mtd/spi/spi-nor-core.c >>>> @@ -15,6 +15,7 @@ >>>> #include >>>> #include >>>> #include >>>> +#include >>>> #include >>>> #include >>>> #include >>>> @@ -3829,8 +3830,11 @@ int spi_nor_scan(struct spi_nor *nor) >>>> #ifndef CONFIG_SPL_BUILD >>>> printf("SF: Detected %s with page size ", nor->name); >>>> print_size(nor->page_size, ", erase size "); >>>> + env_set_hex("sf_pagesize", nor->page_size); >>>> print_size(nor->erase_size, ", total "); >>>> + env_set_hex("sf_erasesize", nor->erase_size); >>>> print_size(nor->size, ""); >>>> + env_set_hex("sf_size", nor->size); >>>> puts("\n"); >>> >>> I feel this unnecessarily add env variables which are not needed for >>> those SF enabled boards, isn't it? >> >> So, how do you determine current SPI NOR size from U-Boot shell ? > > I think we need to know the size for those who enabled mtd command (or > mtdparts), any way to preserve it via mtd command or set the env via > mtd command side. I need to know the size of SPI NOR flash to use it in an U-Boot script which handle different board population options. This has nothing to do with mtd command.