All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: sf: Set SF parameters as env variables
@ 2021-09-14  3:28 Marek Vasut
  2021-09-23 18:53 ` Pratyush Yadav
  2021-12-02  5:47 ` Jagan Teki
  0 siblings, 2 replies; 12+ messages in thread
From: Marek Vasut @ 2021-09-14  3:28 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Jagan Teki, Vignesh R

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 <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Vignesh R <vigneshr@ti.com>
---
 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 <dm.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <env.h>
 #include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/errno.h>
@@ -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");
 #endif
 
-- 
2.33.0


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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-09-14  3:28 [PATCH] mtd: sf: Set SF parameters as env variables Marek Vasut
@ 2021-09-23 18:53 ` Pratyush Yadav
  2021-09-23 20:00   ` Marek Vasut
  2021-12-02  5:47 ` Jagan Teki
  1 sibling, 1 reply; 12+ messages in thread
From: Pratyush Yadav @ 2021-09-23 18:53 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Jagan Teki, Vignesh R

On 14/09/21 05:28AM, 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.

I don't quite follow the rationale for making these environment 
variables. Wouldn't you be better off finding this info out via mtd or 
sf command?

> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Vignesh R <vigneshr@ti.com>
> ---
>  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 <dm.h>
>  #include <dm/device_compat.h>
>  #include <dm/devres.h>
> +#include <env.h>
>  #include <linux/bitops.h>
>  #include <linux/err.h>
>  #include <linux/errno.h>
> @@ -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");
>  #endif
>  
> -- 
> 2.33.0
> 

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-09-23 18:53 ` Pratyush Yadav
@ 2021-09-23 20:00   ` Marek Vasut
  2021-10-07 12:40     ` Pratyush Yadav
  0 siblings, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2021-09-23 20:00 UTC (permalink / raw)
  To: Pratyush Yadav; +Cc: u-boot, Jagan Teki, Vignesh R

On 9/23/21 8:53 PM, Pratyush Yadav wrote:
> On 14/09/21 05:28AM, 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.
> 
> I don't quite follow the rationale for making these environment
> variables. Wouldn't you be better off finding this info out via mtd or
> sf command?

I need to use that info in a script, that's why these env vars.

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-09-23 20:00   ` Marek Vasut
@ 2021-10-07 12:40     ` Pratyush Yadav
  2021-10-07 12:46       ` Marek Vasut
  2021-12-02 16:41       ` Sean Anderson
  0 siblings, 2 replies; 12+ messages in thread
From: Pratyush Yadav @ 2021-10-07 12:40 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Jagan Teki, Vignesh R

On 23/09/21 10:00PM, Marek Vasut wrote:
> On 9/23/21 8:53 PM, Pratyush Yadav wrote:
> > On 14/09/21 05:28AM, 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.
> > 
> > I don't quite follow the rationale for making these environment
> > variables. Wouldn't you be better off finding this info out via mtd or
> > sf command?
> 
> I need to use that info in a script, that's why these env vars.

Ok. Honestly, it doesn't feel quite right to me.

I haven't played with U-Boot's shell too much but is there no way to 
assign variables from command outputs? For example, can we do something 
like `foo=$(cat a.txt)`? If that is possible, maybe add some new 
subcommands to "sf" that return this information?

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-10-07 12:40     ` Pratyush Yadav
@ 2021-10-07 12:46       ` Marek Vasut
  2021-11-28 21:56         ` Marek Vasut
  2021-12-02 16:41       ` Sean Anderson
  1 sibling, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2021-10-07 12:46 UTC (permalink / raw)
  To: Pratyush Yadav; +Cc: u-boot, Jagan Teki, Vignesh R

On 10/7/21 2:40 PM, Pratyush Yadav wrote:
> On 23/09/21 10:00PM, Marek Vasut wrote:
>> On 9/23/21 8:53 PM, Pratyush Yadav wrote:
>>> On 14/09/21 05:28AM, 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.
>>>
>>> I don't quite follow the rationale for making these environment
>>> variables. Wouldn't you be better off finding this info out via mtd or
>>> sf command?
>>
>> I need to use that info in a script, that's why these env vars.
> 
> Ok. Honestly, it doesn't feel quite right to me.
> 
> I haven't played with U-Boot's shell too much but is there no way to
> assign variables from command outputs?

Not that I know of.

> For example, can we do something
> like `foo=$(cat a.txt)`? If that is possible, maybe add some new
> subcommands to "sf" that return this information?

What you would want to have is per-device runtime properties, kind-of 
like reduced sysfs, which would need VFS in U-Boot, and we do not have 
that yet.

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-10-07 12:46       ` Marek Vasut
@ 2021-11-28 21:56         ` Marek Vasut
  2021-12-02  9:14           ` Pratyush Yadav
  0 siblings, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2021-11-28 21:56 UTC (permalink / raw)
  To: Pratyush Yadav; +Cc: u-boot, Jagan Teki, Vignesh R

On 10/7/21 2:46 PM, Marek Vasut wrote:
> On 10/7/21 2:40 PM, Pratyush Yadav wrote:
>> On 23/09/21 10:00PM, Marek Vasut wrote:
>>> On 9/23/21 8:53 PM, Pratyush Yadav wrote:
>>>> On 14/09/21 05:28AM, 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.
>>>>
>>>> I don't quite follow the rationale for making these environment
>>>> variables. Wouldn't you be better off finding this info out via mtd or
>>>> sf command?
>>>
>>> I need to use that info in a script, that's why these env vars.
>>
>> Ok. Honestly, it doesn't feel quite right to me.
>>
>> I haven't played with U-Boot's shell too much but is there no way to
>> assign variables from command outputs?
> 
> Not that I know of.
> 
>> For example, can we do something
>> like `foo=$(cat a.txt)`? If that is possible, maybe add some new
>> subcommands to "sf" that return this information?
> 
> What you would want to have is per-device runtime properties, kind-of 
> like reduced sysfs, which would need VFS in U-Boot, and we do not have 
> that yet.

Are there any news on this patch ?

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-09-14  3:28 [PATCH] mtd: sf: Set SF parameters as env variables Marek Vasut
  2021-09-23 18:53 ` Pratyush Yadav
@ 2021-12-02  5:47 ` Jagan Teki
  2021-12-02  5:49   ` Marek Vasut
  1 sibling, 1 reply; 12+ messages in thread
From: Jagan Teki @ 2021-12-02  5:47 UTC (permalink / raw)
  To: Marek Vasut, Tom Rini; +Cc: u-boot, Vignesh R

On Tue, Sep 14, 2021 at 8:59 AM Marek Vasut <marex@denx.de> 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 <marex@denx.de>
> Cc: Jagan Teki <jagan@amarulasolutions.com>
> Cc: Vignesh R <vigneshr@ti.com>
> ---
>  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 <dm.h>
>  #include <dm/device_compat.h>
>  #include <dm/devres.h>
> +#include <env.h>
>  #include <linux/bitops.h>
>  #include <linux/err.h>
>  #include <linux/errno.h>
> @@ -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?

Jagan.

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-12-02  5:47 ` Jagan Teki
@ 2021-12-02  5:49   ` Marek Vasut
  2021-12-02  5:57     ` Jagan Teki
  0 siblings, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2021-12-02  5:49 UTC (permalink / raw)
  To: Jagan Teki, Tom Rini; +Cc: u-boot, Vignesh R

On 12/2/21 06:47, Jagan Teki wrote:
> On Tue, Sep 14, 2021 at 8:59 AM Marek Vasut <marex@denx.de> 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 <marex@denx.de>
>> Cc: Jagan Teki <jagan@amarulasolutions.com>
>> Cc: Vignesh R <vigneshr@ti.com>
>> ---
>>   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 <dm.h>
>>   #include <dm/device_compat.h>
>>   #include <dm/devres.h>
>> +#include <env.h>
>>   #include <linux/bitops.h>
>>   #include <linux/err.h>
>>   #include <linux/errno.h>
>> @@ -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 ?

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-12-02  5:49   ` Marek Vasut
@ 2021-12-02  5:57     ` Jagan Teki
  2021-12-02  6:03       ` Marek Vasut
  0 siblings, 1 reply; 12+ messages in thread
From: Jagan Teki @ 2021-12-02  5:57 UTC (permalink / raw)
  To: Marek Vasut; +Cc: Tom Rini, u-boot, Vignesh R

On Thu, Dec 2, 2021 at 11:19 AM Marek Vasut <marex@denx.de> wrote:
>
> On 12/2/21 06:47, Jagan Teki wrote:
> > On Tue, Sep 14, 2021 at 8:59 AM Marek Vasut <marex@denx.de> 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 <marex@denx.de>
> >> Cc: Jagan Teki <jagan@amarulasolutions.com>
> >> Cc: Vignesh R <vigneshr@ti.com>
> >> ---
> >>   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 <dm.h>
> >>   #include <dm/device_compat.h>
> >>   #include <dm/devres.h>
> >> +#include <env.h>
> >>   #include <linux/bitops.h>
> >>   #include <linux/err.h>
> >>   #include <linux/errno.h>
> >> @@ -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.

Jagan.

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-12-02  5:57     ` Jagan Teki
@ 2021-12-02  6:03       ` Marek Vasut
  0 siblings, 0 replies; 12+ messages in thread
From: Marek Vasut @ 2021-12-02  6:03 UTC (permalink / raw)
  To: Jagan Teki; +Cc: Tom Rini, u-boot, Vignesh R

On 12/2/21 06:57, Jagan Teki wrote:
> On Thu, Dec 2, 2021 at 11:19 AM Marek Vasut <marex@denx.de> wrote:
>>
>> On 12/2/21 06:47, Jagan Teki wrote:
>>> On Tue, Sep 14, 2021 at 8:59 AM Marek Vasut <marex@denx.de> 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 <marex@denx.de>
>>>> Cc: Jagan Teki <jagan@amarulasolutions.com>
>>>> Cc: Vignesh R <vigneshr@ti.com>
>>>> ---
>>>>    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 <dm.h>
>>>>    #include <dm/device_compat.h>
>>>>    #include <dm/devres.h>
>>>> +#include <env.h>
>>>>    #include <linux/bitops.h>
>>>>    #include <linux/err.h>
>>>>    #include <linux/errno.h>
>>>> @@ -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.

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-11-28 21:56         ` Marek Vasut
@ 2021-12-02  9:14           ` Pratyush Yadav
  0 siblings, 0 replies; 12+ messages in thread
From: Pratyush Yadav @ 2021-12-02  9:14 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Jagan Teki, Vignesh R

Hi Marek,

On 28/11/21 10:56PM, Marek Vasut wrote:
> On 10/7/21 2:46 PM, Marek Vasut wrote:
> > On 10/7/21 2:40 PM, Pratyush Yadav wrote:
> > > On 23/09/21 10:00PM, Marek Vasut wrote:
> > > > On 9/23/21 8:53 PM, Pratyush Yadav wrote:
> > > > > On 14/09/21 05:28AM, 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.
> > > > > 
> > > > > I don't quite follow the rationale for making these environment
> > > > > variables. Wouldn't you be better off finding this info out via mtd or
> > > > > sf command?
> > > > 
> > > > I need to use that info in a script, that's why these env vars.
> > > 
> > > Ok. Honestly, it doesn't feel quite right to me.
> > > 
> > > I haven't played with U-Boot's shell too much but is there no way to
> > > assign variables from command outputs?
> > 
> > Not that I know of.
> > 
> > > For example, can we do something
> > > like `foo=$(cat a.txt)`? If that is possible, maybe add some new
> > > subcommands to "sf" that return this information?
> > 
> > What you would want to have is per-device runtime properties, kind-of
> > like reduced sysfs, which would need VFS in U-Boot, and we do not have
> > that yet.
> 
> Are there any news on this patch ?

All I would say is that I do not particularly like what this patch is 
doing, but I also can't give you an alternative solution to the problem 
unfortunately. So I drop my $0.02 here and leave it up to you and Jagan 
to figure it out.

-- 
Regards,
Pratyush Yadav
Texas Instruments Inc.

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

* Re: [PATCH] mtd: sf: Set SF parameters as env variables
  2021-10-07 12:40     ` Pratyush Yadav
  2021-10-07 12:46       ` Marek Vasut
@ 2021-12-02 16:41       ` Sean Anderson
  1 sibling, 0 replies; 12+ messages in thread
From: Sean Anderson @ 2021-12-02 16:41 UTC (permalink / raw)
  To: Pratyush Yadav, Marek Vasut; +Cc: u-boot, Jagan Teki, Vignesh R




On 10/7/21 8:40 AM, Pratyush Yadav wrote:
> On 23/09/21 10:00PM, Marek Vasut wrote:
>> On 9/23/21 8:53 PM, Pratyush Yadav wrote:
>> > On 14/09/21 05:28AM, 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.
>> >
>> > I don't quite follow the rationale for making these environment
>> > variables. Wouldn't you be better off finding this info out via mtd or
>> > sf command?
>>
>> I need to use that info in a script, that's why these env vars.
>
> Ok. Honestly, it doesn't feel quite right to me.
>
> I haven't played with U-Boot's shell too much but is there no way to
> assign variables from command outputs? For example, can we do something
> like `foo=$(cat a.txt)`? If that is possible, maybe add some new
> subcommands to "sf" that return this information?
>

There is not.

IMO the current solution (exporting to environment variables in an ad-hoc
manner) is rather ugly, but fixing it is difficult :)

--Sean

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

end of thread, other threads:[~2021-12-02 16:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  3:28 [PATCH] mtd: sf: Set SF parameters as env variables Marek Vasut
2021-09-23 18:53 ` Pratyush Yadav
2021-09-23 20:00   ` Marek Vasut
2021-10-07 12:40     ` Pratyush Yadav
2021-10-07 12:46       ` Marek Vasut
2021-11-28 21:56         ` Marek Vasut
2021-12-02  9:14           ` Pratyush Yadav
2021-12-02 16:41       ` Sean Anderson
2021-12-02  5:47 ` Jagan Teki
2021-12-02  5:49   ` Marek Vasut
2021-12-02  5:57     ` Jagan Teki
2021-12-02  6:03       ` Marek Vasut

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.