cmd: mmc: allow use of hardware parittion names for mmc partconf
PATCH 1/1 cmd: mmc: allow use of hardware parittion names for mmc partconf
eMMC devices have hardware partitions such as user, boot0, and boot1. Allow these names to be displayed when reading the mmc PARTITION_CONFIG field via 'mmc partconf'. Additionally allow a name to be specified when setting the PARTITION_CONFIG.
Before:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2
EXT_CSD[179], PARTITION_CONFIG:BOOT_ACK: 0x1BOOT_PARTITION_ENABLE: 0x2PARTITION_ACCESS: 0x0
After:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2 EXT_CSD[179], PARTITION_CONFIG:BOOT_ACK: 0x1BOOT_PARTITION_ENABLE: 0x1 (boot0)PARTITION_ACCESS: 0x0
u-boot=> mmc partconf 2 1 boot1 0 && mmc partconf 2 EXT_CSD[179], PARTITION_CONFIG:BOOT_ACK: 0x1BOOT_PARTITION_ENABLE: 0x2 (boot1)PARTITION_ACCESS: 0x0
--- cmd/mmc.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
cmd/mmc.c +22 -3
@@ -14,6 +14,18 @@#include <part.h> #include <sparse_format.h> #include <image-sparse.h> +#include <linux/ctype.h> + +static const char *mmc_partnames[] = { +"user" , +"boot0" , +"boot1" , +"" , +"" , +"" , +"" , +"user" , +};static int curr_device =-1 ;
@@ -918,8 +930,8 @@ static int mmc_partconf_print(struct mmc *mmc, const char *varname)printf ("EXT_CSD[179], PARTITION_CONFIG:\n" "BOOT_ACK: 0x%x\n" -"BOOT_PARTITION_ENABLE: 0x%x\n" -"PARTITION_ACCESS: 0x%x\n" , ack, part, access); +"BOOT_PARTITION_ENABLE: 0x%x (%s)\n" +"PARTITION_ACCESS: 0x%x\n" , ack, part, mmc_partnames[part], access);return CMD_RET_SUCCESS ; }
@@ -949,7 +961,14 @@ static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,return mmc_partconf_print (mmc,cmd_arg2 (argc, argv)); ack =dectoul (argv[2 ],NULL ); - part_num =dectoul (argv[3 ],NULL ); +if (!isdigit (*argv[3 ])) { +for (part_num =0 ; part_num <ARRAY_SIZE (mmc_partnames); part_num++) { +if (!strcmp (argv[3 ], mmc_partnames[part_num])) +break ; + } + }else { + part_num =dectoul (argv[3 ],NULL ); + } access =dectoul (argv[4 ],NULL );/* acknowledge to be sent during boot operation */
Signature · 1 line
2.25.1
Hi Tim,
Quoted 13 lines · Tim Harvey
eMMC devices have hardware partitions such as user, boot0, and boot1. Allow these names to be displayed when reading the mmc
PARTITION_CONFIGfield via 'mmc partconf'. Additionally allow a name to be specified when setting thePARTITION_CONFIG.Before:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2
EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x2PARTITION_ACCESS:0x0
Quoted 11 lines
After:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2 EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x1(boot0)PARTITION_ACCESS:0x0
u-boot=> mmc partconf 2 1 boot1 0 && mmc partconf 2 EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x2(boot1)PARTITION_ACCESS:0x0
This is a nice improvement:
Quoted 3 lines · Fabio Estevam
This is a nice improvement:
Reviewed-by Fabio Estevam <[email protected]>
There is a typo in the Subject: "partition"
Quoted 8 lines · Fabio Estevam
Quoted 3 lines · Fabio Estevam
This is a nice improvement:
Reviewed-by Fabio Estevam <[email protected]>There is a typo in the Subject: "partition"
Hi Fabio,
Thanks - I will fix this in v2.
Best Regards,
Tim
Quoted 34 lines · Tim Harvey
eMMC devices have hardware partitions such as user, boot0, and boot1. Allow these names to be displayed when reading the mmc
PARTITION_CONFIGfield via 'mmc partconf'. Additionally allow a name to be specified when setting thePARTITION_CONFIG.Before:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2
EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x2PARTITION_ACCESS:0x0After:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2 EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x1(boot0)PARTITION_ACCESS:0x0
u-boot=> mmc partconf 2 1 boot1 0 && mmc partconf 2 EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x2(boot1)PARTITION_ACCESS:0x0Signed-off-by Tim Harvey <[email protected]>--- cmd/mmc.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)cmd/mmc.c +0
-0
cmd/mmc.c line 23
Quoted 10 lines
cmd/mmc.c +7
-0@@ -14,6 +14,18 @@#include <part.h> #include <sparse_format.h> #include <image-sparse.h> +#include <linux/ctype.h> + +static const char *mmc_partnames[] = { +"user" , +"boot0" , +"boot1" , +"" ,
Shouldn't these be 'gp' partitions here ?
[...]
Quoted 40 lines · Marek Vasut
Quoted 38 lines · Tim Harvey
eMMC devices have hardware partitions such as user, boot0, and boot1. Allow these names to be displayed when reading the mmc
PARTITION_CONFIGfield via 'mmc partconf'. Additionally allow a name to be specified when setting thePARTITION_CONFIG.Before:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2
EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x2PARTITION_ACCESS:0x0After:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2 EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x1(boot0)PARTITION_ACCESS:0x0
u-boot=> mmc partconf 2 1 boot1 0 && mmc partconf 2 EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x2(boot1)PARTITION_ACCESS:0x0Signed-off-by Tim Harvey <[email protected]>--- cmd/mmc.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)cmd/mmc.c +1
-0@@ -14,6 +14,18 @@#include <part.h> #include <sparse_format.h> #include <image-sparse.h> +#include <linux/ctype.h>
Quoted 9 lines
cmd/mmc.c line 23
Quoted 6 lines
cmd/mmc.c +6
-0+ +static const char *mmc_partnames[] = { +"user" , +"boot0" , +"boot1" , +"" ,Shouldn't these be 'gp' partitions here ?
He Marek,
Do you mean that 3-6 should be named 'gp1', 'gp2' etc? I couldn't find if those values were possible or have meaning.
Best Regards,
Tim
Quoted 51 lines · Tim Harvey
Quoted 40 lines · Marek Vasut
Quoted 38 lines · Tim Harvey
eMMC devices have hardware partitions such as user, boot0, and boot1. Allow these names to be displayed when reading the mmc
PARTITION_CONFIGfield via 'mmc partconf'. Additionally allow a name to be specified when setting thePARTITION_CONFIG.Before:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2
EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x2PARTITION_ACCESS:0x0After:
u-boot=> mmc partconf 2 1 1 0 && mmc partconf 2 EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x1(boot0)PARTITION_ACCESS:0x0
u-boot=> mmc partconf 2 1 boot1 0 && mmc partconf 2 EXT_CSD[179],PARTITION_CONFIG:BOOT_ACK:0x1BOOT_PARTITION_ENABLE:0x2(boot1)PARTITION_ACCESS:0x0Signed-off-by Tim Harvey <[email protected]>--- cmd/mmc.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)cmd/mmc.c +1
-0@@ -14,6 +14,18 @@#include <part.h> #include <sparse_format.h> #include <image-sparse.h> +#include <linux/ctype.h> Quoted 9 lines
cmd/mmc.c line 23
Quoted 6 lines
cmd/mmc.c +6
-0+ +static const char *mmc_partnames[] = { +"user" , +"boot0" , +"boot1" , +"" ,Shouldn't these be 'gp' partitions here ?
Quoted 4 lines
He Marek,
Do you mean that 3-6 should be named 'gp1', 'gp2' etc? I couldn't find if those values were possible or have meaning.
Yes, General Purpose eMMC hardware partitions.