u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add more support for NXP's mfgtool
@ 2021-12-17 15:41 Angus Ainslie
  2021-12-17 15:41 ` [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool Angus Ainslie
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Angus Ainslie @ 2021-12-17 15:41 UTC (permalink / raw)
  To: u-boot
  Cc: Sean Anderson, Simon Glass, Oleh Kravchenko, Patrick Delaunay,
	Roman Stratiienko, Marek Szyprowski, Angus Ainslie

NXP's mfgtool needs some additional switches to deal with the whole
mmc device.

Angus Ainslie (2):
  fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool
  fastboot: fb_mmc: Add mfgtool all partition size

 drivers/fastboot/fb_getvar.c | 27 +++++++++++++++++++++++++++
 drivers/fastboot/fb_mmc.c    |  7 +++++++
 2 files changed, 34 insertions(+)

-- 
2.25.1


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

* [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool
  2021-12-17 15:41 [PATCH 0/2] Add more support for NXP's mfgtool Angus Ainslie
@ 2021-12-17 15:41 ` Angus Ainslie
  2021-12-17 23:10   ` Sean Anderson
  2021-12-17 15:42 ` [PATCH 2/2] fastboot: fb_mmc: Add mfgtool all partition size Angus Ainslie
  2021-12-18  8:44 ` [PATCH 0/2] Add more support for NXP's mfgtool Oleh Kravchenko
  2 siblings, 1 reply; 9+ messages in thread
From: Angus Ainslie @ 2021-12-17 15:41 UTC (permalink / raw)
  To: u-boot
  Cc: Sean Anderson, Simon Glass, Oleh Kravchenko, Patrick Delaunay,
	Roman Stratiienko, Marek Szyprowski, Angus Ainslie

uuu uses the blocksize to determine the upload size

Signed-off-by: Angus Ainslie <angus@akkea.ca>
---
 drivers/fastboot/fb_getvar.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index d43f2cfee6..ff5f0d3d40 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -31,6 +31,7 @@ static void getvar_partition_type(char *part_name, char *response);
 static void getvar_partition_size(char *part_name, char *response);
 #endif
 static void getvar_is_userspace(char *var_parameter, char *response);
+static void getvar_logical_blocksize(char *var_parameter, char *response);
 
 static const struct {
 	const char *variable;
@@ -81,6 +82,9 @@ static const struct {
 	}, {
 		.variable = "is-userspace",
 		.dispatch = getvar_is_userspace
+	}, {
+		.variable = "logical-block-size",
+		.dispatch = getvar_logical_blocksize
 	}
 };
 
@@ -140,6 +144,29 @@ static void getvar_downloadsize(char *var_parameter, char *response)
 	fastboot_response("OKAY", response, "0x%08x", fastboot_buf_size);
 }
 
+static int fb_get_block_size(void)
+{
+	int dev_no = 0;
+	struct blk_desc *dev_desc;
+
+	dev_desc = blk_get_dev("mmc", 0);
+
+	if (!dev_desc) {
+		printf("** Block device %s %d not supported\n",
+		       "mmc", 0);
+		return 0;
+	}
+	return dev_desc->blksz;
+}
+
+static void getvar_logical_blocksize(char *var_parameter, char *response)
+{
+	u32 blksz;
+
+	blksz = fb_get_block_size();
+	fastboot_response("OKAY", response, "0x%08x", blksz);
+}
+
 static void getvar_serialno(char *var_parameter, char *response)
 {
 	const char *tmp = env_get("serial#");
-- 
2.25.1


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

* [PATCH 2/2] fastboot: fb_mmc: Add mfgtool all partition size
  2021-12-17 15:41 [PATCH 0/2] Add more support for NXP's mfgtool Angus Ainslie
  2021-12-17 15:41 ` [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool Angus Ainslie
@ 2021-12-17 15:42 ` Angus Ainslie
  2021-12-17 23:02   ` Sean Anderson
  2021-12-18  8:44 ` [PATCH 0/2] Add more support for NXP's mfgtool Oleh Kravchenko
  2 siblings, 1 reply; 9+ messages in thread
From: Angus Ainslie @ 2021-12-17 15:42 UTC (permalink / raw)
  To: u-boot
  Cc: Sean Anderson, Simon Glass, Oleh Kravchenko, Patrick Delaunay,
	Roman Stratiienko, Marek Szyprowski, Angus Ainslie

NXP mfgtool uses all to specify the entire partition

Signed-off-by: Angus Ainslie <angus@akkea.ca>
---
 drivers/fastboot/fb_mmc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 2738dc836e..9ebf392252 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -84,6 +84,13 @@ static int do_get_part_info(struct blk_desc **dev_desc, const char *name,
 	/* First try partition names on the default device */
 	*dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
 	if (*dev_desc) {
+		if (!strncmp(name, "all", strlen("all"))) {
+			info->blksz = (*dev_desc)->blksz;
+			info->size = (*dev_desc)->lba;
+			info->start = 0;
+			return 0;
+		}
+
 		ret = part_get_info_by_name(*dev_desc, name, info);
 		if (ret >= 0)
 			return ret;
-- 
2.25.1


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

* Re: [PATCH 2/2] fastboot: fb_mmc: Add mfgtool all partition size
  2021-12-17 15:42 ` [PATCH 2/2] fastboot: fb_mmc: Add mfgtool all partition size Angus Ainslie
@ 2021-12-17 23:02   ` Sean Anderson
  0 siblings, 0 replies; 9+ messages in thread
From: Sean Anderson @ 2021-12-17 23:02 UTC (permalink / raw)
  To: Angus Ainslie, u-boot
  Cc: Sean Anderson, Simon Glass, Oleh Kravchenko, Patrick Delaunay,
	Roman Stratiienko, Marek Szyprowski



On 12/17/21 10:42 AM, Angus Ainslie wrote:
> NXP mfgtool uses all to specify the entire partition
> 
> Signed-off-by: Angus Ainslie <angus@akkea.ca>
> ---
>   drivers/fastboot/fb_mmc.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
> index 2738dc836e..9ebf392252 100644
> --- a/drivers/fastboot/fb_mmc.c
> +++ b/drivers/fastboot/fb_mmc.c
> @@ -84,6 +84,13 @@ static int do_get_part_info(struct blk_desc **dev_desc, const char *name,
>   	/* First try partition names on the default device */
>   	*dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
>   	if (*dev_desc) {
> +		if (!strncmp(name, "all", strlen("all"))) {
> +			info->blksz = (*dev_desc)->blksz;
> +			info->size = (*dev_desc)->lba;
> +			info->start = 0;
> +			return 0;
> +		}
> +
>   		ret = part_get_info_by_name(*dev_desc, name, info);
>   		if (ret >= 0)
>   			return ret;
> 

This can be done with "partition" 0. If you need compatibility, use an alias.

--Sean

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

* Re: [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool
  2021-12-17 15:41 ` [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool Angus Ainslie
@ 2021-12-17 23:10   ` Sean Anderson
  2021-12-19 15:25     ` Angus Ainslie
  0 siblings, 1 reply; 9+ messages in thread
From: Sean Anderson @ 2021-12-17 23:10 UTC (permalink / raw)
  To: Angus Ainslie, u-boot
  Cc: Sean Anderson, Simon Glass, Oleh Kravchenko, Patrick Delaunay,
	Roman Stratiienko, Marek Szyprowski

Hi Angus,

On 12/17/21 10:41 AM, Angus Ainslie wrote:
> uuu uses the blocksize to determine the upload size

Can you please elaborate on this more?

> 
> Signed-off-by: Angus Ainslie <angus@akkea.ca>
> ---
>   drivers/fastboot/fb_getvar.c | 27 +++++++++++++++++++++++++++
>   1 file changed, 27 insertions(+)
> 
> diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
> index d43f2cfee6..ff5f0d3d40 100644
> --- a/drivers/fastboot/fb_getvar.c
> +++ b/drivers/fastboot/fb_getvar.c
> @@ -31,6 +31,7 @@ static void getvar_partition_type(char *part_name, char *response);
>   static void getvar_partition_size(char *part_name, char *response);
>   #endif
>   static void getvar_is_userspace(char *var_parameter, char *response);
> +static void getvar_logical_blocksize(char *var_parameter, char *response);
>   
>   static const struct {
>   	const char *variable;
> @@ -81,6 +82,9 @@ static const struct {
>   	}, {
>   		.variable = "is-userspace",
>   		.dispatch = getvar_is_userspace
> +	}, {
> +		.variable = "logical-block-size",
> +		.dispatch = getvar_logical_blocksize
>   	}
>   };
>   
> @@ -140,6 +144,29 @@ static void getvar_downloadsize(char *var_parameter, char *response)
>   	fastboot_response("OKAY", response, "0x%08x", fastboot_buf_size);
>   }
>   
> +static int fb_get_block_size(void)
> +{
> +	int dev_no = 0;
> +	struct blk_desc *dev_desc;
> +
> +	dev_desc = blk_get_dev("mmc", 0);

And what if your block device is not mmc 0? This code is not specific to fastboot mmc. What about nand?

> +
> +	if (!dev_desc) {
> +		printf("** Block device %s %d not supported\n",
> +		       "mmc", 0);
> +		return 0;

Why return 0? This should result in an error fastboot_response.

> +	}
> +	return dev_desc->blksz;
> +}
> +
> +static void getvar_logical_blocksize(char *var_parameter, char *response)
> +{
> +	u32 blksz;
> +
> +	blksz = fb_get_block_size();
> +	fastboot_response("OKAY", response, "0x%08x", blksz);

Can we combine these functions?

--Sean

> +}
> +
>   static void getvar_serialno(char *var_parameter, char *response)
>   {
>   	const char *tmp = env_get("serial#");
> 

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

* Re: [PATCH 0/2] Add more support for NXP's mfgtool
  2021-12-17 15:41 [PATCH 0/2] Add more support for NXP's mfgtool Angus Ainslie
  2021-12-17 15:41 ` [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool Angus Ainslie
  2021-12-17 15:42 ` [PATCH 2/2] fastboot: fb_mmc: Add mfgtool all partition size Angus Ainslie
@ 2021-12-18  8:44 ` Oleh Kravchenko
  2021-12-18 14:34   ` Angus Ainslie
  2 siblings, 1 reply; 9+ messages in thread
From: Oleh Kravchenko @ 2021-12-18  8:44 UTC (permalink / raw)
  To: Angus Ainslie
  Cc: u-boot, Sean Anderson, Simon Glass, Patrick Delaunay,
	Roman Stratiienko, Marek Szyprowski

Hello Angus!
What is the use-case for these patches?

Would you mind defining why the current implementation is not enough?
Used like that:
> FB: flash -raw2sparse mmc0 emmc.wic


> 17 груд. 2021 р. о 17:41 Angus Ainslie <angus@akkea.ca> написав(ла):
> 
> NXP's mfgtool needs some additional switches to deal with the whole
> mmc device.
> 
> Angus Ainslie (2):
>  fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool
>  fastboot: fb_mmc: Add mfgtool all partition size
> 
> drivers/fastboot/fb_getvar.c | 27 +++++++++++++++++++++++++++
> drivers/fastboot/fb_mmc.c    |  7 +++++++
> 2 files changed, 34 insertions(+)
> 
> -- 
> 2.25.1
> 


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

* Re: [PATCH 0/2] Add more support for NXP's mfgtool
  2021-12-18  8:44 ` [PATCH 0/2] Add more support for NXP's mfgtool Oleh Kravchenko
@ 2021-12-18 14:34   ` Angus Ainslie
  2021-12-18 21:52     ` Oleh Kravchenko
  0 siblings, 1 reply; 9+ messages in thread
From: Angus Ainslie @ 2021-12-18 14:34 UTC (permalink / raw)
  To: Oleh Kravchenko
  Cc: u-boot, Sean Anderson, Simon Glass, Patrick Delaunay,
	Roman Stratiienko, Marek Szyprowski

Hi Oleh

On 2021-12-18 00:44, Oleh Kravchenko wrote:
> Hello Angus!
> What is the use-case for these patches?
> 
> Would you mind defining why the current implementation is not enough?
> Used like that:
>> FB: flash -raw2sparse mmc0 emmc.wic
> 
> 

Thanks, it looks like the way I'm using fastboot is causing the issue.

FB: ucmd setenv fastboot_dev mmc
FB: ucmd setenv mmcdev 0
FB: flash -raw2sparse all <image>

using your syntax I likely won't need these patches.

FB: flash -raw2sparse mmc0 <image>

Cheers
Angus

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

* Re: [PATCH 0/2] Add more support for NXP's mfgtool
  2021-12-18 14:34   ` Angus Ainslie
@ 2021-12-18 21:52     ` Oleh Kravchenko
  0 siblings, 0 replies; 9+ messages in thread
From: Oleh Kravchenko @ 2021-12-18 21:52 UTC (permalink / raw)
  To: Angus Ainslie
  Cc: u-boot, Sean Anderson, Simon Glass, Patrick Delaunay,
	Roman Stratiienko, Marek Szyprowski




18.12.21 16:34, Angus Ainslie пише:
> Hi Oleh
> 
> On 2021-12-18 00:44, Oleh Kravchenko wrote:
>> Hello Angus!
>> What is the use-case for these patches?
>>
>> Would you mind defining why the current implementation is not enough?
>> Used like that:
>>> FB: flash -raw2sparse mmc0 emmc.wic
>>
>>
> 
> Thanks, it looks like the way I'm using fastboot is causing the issue.
> 
> FB: ucmd setenv fastboot_dev mmc
> FB: ucmd setenv mmcdev 0
> FB: flash -raw2sparse all <image>
> 
> using your syntax I likely won't need these patches.

Just make sure you have these configs enabled:

> CONFIG_FASTBOOT_MMC_USER_SUPPORT=y
> CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y # enable this if you planning flash boot area too

  
> FB: flash -raw2sparse mmc0 <image>
> 
> Cheers
> Angus

-- 
Best regards,
Oleh Kravchenko

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

* Re: [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool
  2021-12-17 23:10   ` Sean Anderson
@ 2021-12-19 15:25     ` Angus Ainslie
  0 siblings, 0 replies; 9+ messages in thread
From: Angus Ainslie @ 2021-12-19 15:25 UTC (permalink / raw)
  To: Sean Anderson
  Cc: u-boot, Sean Anderson, Simon Glass, Oleh Kravchenko,
	Patrick Delaunay, Roman Stratiienko, Marek Szyprowski

Hi Sean,

On 2021-12-17 15:10, Sean Anderson wrote:
> Hi Angus,
> 
> On 12/17/21 10:41 AM, Angus Ainslie wrote:
>> uuu uses the blocksize to determine the upload size
> 
> Can you please elaborate on this more?
> 
>> 
>> Signed-off-by: Angus Ainslie <angus@akkea.ca>
>> ---
>>   drivers/fastboot/fb_getvar.c | 27 +++++++++++++++++++++++++++
>>   1 file changed, 27 insertions(+)
>> 
>> diff --git a/drivers/fastboot/fb_getvar.c 
>> b/drivers/fastboot/fb_getvar.c
>> index d43f2cfee6..ff5f0d3d40 100644
>> --- a/drivers/fastboot/fb_getvar.c
>> +++ b/drivers/fastboot/fb_getvar.c
>> @@ -31,6 +31,7 @@ static void getvar_partition_type(char *part_name, 
>> char *response);
>>   static void getvar_partition_size(char *part_name, char *response);
>>   #endif
>>   static void getvar_is_userspace(char *var_parameter, char 
>> *response);
>> +static void getvar_logical_blocksize(char *var_parameter, char 
>> *response);
>>     static const struct {
>>   	const char *variable;
>> @@ -81,6 +82,9 @@ static const struct {
>>   	}, {
>>   		.variable = "is-userspace",
>>   		.dispatch = getvar_is_userspace
>> +	}, {
>> +		.variable = "logical-block-size",
>> +		.dispatch = getvar_logical_blocksize
>>   	}
>>   };
>>   @@ -140,6 +144,29 @@ static void getvar_downloadsize(char 
>> *var_parameter, char *response)
>>   	fastboot_response("OKAY", response, "0x%08x", fastboot_buf_size);
>>   }
>>   +static int fb_get_block_size(void)
>> +{
>> +	int dev_no = 0;
>> +	struct blk_desc *dev_desc;
>> +
>> +	dev_desc = blk_get_dev("mmc", 0);
> 
> And what if your block device is not mmc 0? This code is not specific
> to fastboot mmc. What about nand?
> 
>> +
>> +	if (!dev_desc) {
>> +		printf("** Block device %s %d not supported\n",
>> +		       "mmc", 0);
>> +		return 0;
> 
> Why return 0? This should result in an error fastboot_response.
> 
>> +	}
>> +	return dev_desc->blksz;
>> +}
>> +
>> +static void getvar_logical_blocksize(char *var_parameter, char 
>> *response)
>> +{
>> +	u32 blksz;
>> +
>> +	blksz = fb_get_block_size();
>> +	fastboot_response("OKAY", response, "0x%08x", blksz);
> 
> Can we combine these functions?
> 
> --Sean

Thanks for the comments. I'll fix them up for v2.

Angus


> 
>> +}
>> +
>>   static void getvar_serialno(char *var_parameter, char *response)
>>   {
>>   	const char *tmp = env_get("serial#");
>> 

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

end of thread, other threads:[~2021-12-19 15:26 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 15:41 [PATCH 0/2] Add more support for NXP's mfgtool Angus Ainslie
2021-12-17 15:41 ` [PATCH 1/2] fastboot: fb_getvar: Add getvar_logical_blocksize for MXP mfgtool Angus Ainslie
2021-12-17 23:10   ` Sean Anderson
2021-12-19 15:25     ` Angus Ainslie
2021-12-17 15:42 ` [PATCH 2/2] fastboot: fb_mmc: Add mfgtool all partition size Angus Ainslie
2021-12-17 23:02   ` Sean Anderson
2021-12-18  8:44 ` [PATCH 0/2] Add more support for NXP's mfgtool Oleh Kravchenko
2021-12-18 14:34   ` Angus Ainslie
2021-12-18 21:52     ` Oleh Kravchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).