mmc: use new hwpart API when CONFIG_BLK enabled
PATCH 1/2 mmc: use new hwpart API when CONFIG_BLK enabled
When CONFIG_BLK is enabled, the hwpart id is different with legacy interface, update it to kame driver work with CONFIG_BLK.
---
cmd/mmc.c | 4 ++++ 1 file changed, 4 insertions(+)
cmd/mmc.c +4 -0
@@ -258,7 +258,11 @@ static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,return CMD_RET_FAILURE ; }/* Switch to the RPMB partition */ +#ifndef CONFIG_BLK original_part = mmc->block_dev.hwpart; +#else + original_part =mmc_get_blk_desc (mmc)->hwpart; +#endif if (blk_select_hwpart_devnum (IF_TYPE_MMC , curr_device,MMC_PART_RPMB ) !=0 )return CMD_RET_FAILURE ;
Signature · 1 line
1.9.1
PATCH 2/2 mmc: rpmb: update size format for write_counter
According to MMC spec, the write_counter is 4-byte length, use 'int' instead of 'long' type for the 'long' is not 4-byte in 64 bit CPU.
---
drivers/mmc/rpmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/rpmb.c +1 -1
@@ -67,7 +67,7 @@ struct s_rpmb {unsigned char mac[RPMB_SZ_MAC ];unsigned char data[RPMB_SZ_DATA ];unsigned char nonce[RPMB_SZ_NONCE ]; -unsigned long write_counter; +unsigned int write_counter;unsigned short address;unsigned short block_count;unsigned short result;
Signature · 1 line
1.9.1
PATCH 2/2 mmc: rpmb: update size format for write_counter
Quoted 10 lines · Kever Yang
According to MMC spec, the
write_counteris 4-byte length, use 'int' instead of 'long' type for the 'long' is not 4-byte in 64 bit CPU.Signed-off-by Jason Zhu <[email protected]>Signed-off-by Kever Yang <[email protected]>---
drivers/mmc/rpmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
So should we use uint32_t?
Quoted 17 lines
drivers/mmc/rpmb.c +1
-2@@ -67,7 +67,7 @@ struct s_rpmb {unsigned char mac[RPMB_SZ_MAC ];unsigned char data[RPMB_SZ_DATA ];unsigned char nonce[RPMB_SZ_NONCE ]; -unsigned long write_counter; +unsigned int write_counter;unsigned short address;unsigned short block_count;unsigned short result; --1.9.1
PATCH 2/2 mmc: rpmb: update size format for write_counter
Hi Simon,
Quoted 5 lines · Simon Glass
Quoted 4 lines · Kever Yang
According to MMC spec, the
write_counteris 4-byte length, use 'int' instead of 'long' type for the 'long' is not 4-byte in 64 bit CPU.
Quoted 7 lines
Quoted 6 lines
Signed-off-by Jason Zhu <[email protected]>Signed-off-by Kever Yang <[email protected]>---
drivers/mmc/rpmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)So should we use
uint32_t?
Yes, we can use uint32_t, I use 'unsigned int' just for the same format with other
members in the structure which using unsigned char/short.
Is there a doc for which kind of data format prefer to use first in U-Boot? unsigned int, uint32_t, u32;
Thanks,
- Kever
Quoted 16 lines
Quoted 16 lines
drivers/mmc/rpmb.c +1
-2@@ -67,7 +67,7 @@ struct s_rpmb {unsigned char mac[RPMB_SZ_MAC ];unsigned char data[RPMB_SZ_DATA ];unsigned char nonce[RPMB_SZ_NONCE ]; -unsigned long write_counter; +unsigned int write_counter;unsigned short address;unsigned short block_count;unsigned short result; --1.9.1
PATCH 2/2 mmc: rpmb: update size format for write_counter
Quoted 21 lines · Kever Yang
Hi Simon,
Quoted 7 lines · Simon Glass
Quoted 5 lines · Kever Yang
According to MMC spec, the
write_counteris 4-byte length, use 'int' instead of 'long' type for the 'long' is not 4-byte in 64 bit CPU.Quoted 8 lines
Quoted 6 lines
Signed-off-by Jason Zhu <[email protected]>Signed-off-by Kever Yang <[email protected]>---
drivers/mmc/rpmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)So should we use
uint32_t?
Quoted 6 lines
Yes, we can use
uint32_t, I use 'unsigned int' just for the same format with other
members in the structure which using unsigned char/short.Is there a doc for which kind of data format prefer to use first in U-Boot? unsigned int,
uint32_t, u32;
Well I am mostly wondering about what happens on a 64-bit machine where this would be 64-bits long. There is also u32 which is shorter.
Quoted 22 lines
Thanks,
- KeverQuoted 16 lines
Quoted 16 lines
drivers/mmc/rpmb.c +1
-2@@ -67,7 +67,7 @@ struct s_rpmb {unsigned char mac[RPMB_SZ_MAC ];unsigned char data[RPMB_SZ_DATA ];unsigned char nonce[RPMB_SZ_NONCE ]; -unsigned long write_counter; +unsigned int write_counter;unsigned short address;unsigned short block_count;unsigned short result; --1.9.1
PATCH 2/2 mmc: rpmb: update size format for write_counter
In reply to Kever YangHi,
Quoted 15 lines · On Tue, 13 Jun 2017 10:11:17 +0800 Kever Yang wrote:
Hi Simon,
Quoted 11 lines · Simon Glass
Quoted 10 lines · Kever Yang
According to MMC spec, the
write_counteris 4-byte length, use 'int' instead of 'long' type for the 'long' is not 4-byte in 64 bit CPU.Signed-off-by Jason Zhu <[email protected]>Signed-off-by Kever Yang <[email protected]>---
drivers/mmc/rpmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 9 lines
Quoted 1 line
So should we use
uint32_t?Yes, we can use
uint32_t, I use 'unsigned int' just for the same format with other
members in the structure which using unsigned char/short.Is there a doc for which kind of data format prefer to use first in U-Boot? unsigned int,
uint32_t, u32;
uint32_t is guaranteed to be of size 32bit according to the C spec. '[unsigned] int' is only guaranteed to be at least 32bit but can be larger on some machine.
A good overview of the C data types and their properties can be found
at: https://en.wikipedia.org/wiki/C_data_types
Lothar Waßmann
PATCH 2/2 mmc: rpmb: update size format for write_counter
In reply to Kever YangQuoted 6 lines · Kever Yang
According to MMC spec, the
write_counteris 4-byte length, use 'int' instead of 'long' type for the 'long' is not 4-byte in 64 bit CPU.Signed-off-by Jason Zhu <[email protected]>Signed-off-by Kever Yang <[email protected]>
Applied to u-boot-mmc. Thanks!
Best Regards,
Jaehoon Chung
Quoted 19 lines
---
drivers/mmc/rpmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mmc/rpmb.c +1
-1@@ -67,7 +67,7 @@ struct s_rpmb {unsigned char mac[RPMB_SZ_MAC ];unsigned char data[RPMB_SZ_DATA ];unsigned char nonce[RPMB_SZ_NONCE ]; -unsigned long write_counter; +unsigned int write_counter;unsigned short address;unsigned short block_count;unsigned short result;
PATCH 1/2 mmc: use new hwpart API when CONFIG_BLK enabled
In reply to Kever YangQuoted 9 lines · Kever Yang
When
CONFIG_BLKis enabled, the hwpart id is different with legacy interface, update it to kame driver work withCONFIG_BLK.Signed-off-by Kever Yang <[email protected]>---
cmd/mmc.c | 4 ++++ 1 file changed, 4 insertions(+)
nit (for future) I think it is best to put the driver-model code first, so change #iifndef to #ifdef.
Quoted 19 lines
cmd/mmc.c +4
-1@@ -258,7 +258,11 @@ static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,return CMD_RET_FAILURE ; }/* Switch to the RPMB partition */ +#ifndef CONFIG_BLK original_part = mmc->block_dev.hwpart; +#else + original_part =mmc_get_blk_desc (mmc)->hwpart; +#endif if (blk_select_hwpart_devnum (IF_TYPE_MMC , curr_device,MMC_PART_RPMB ) !=0 )return CMD_RET_FAILURE ; --1.9.1
PATCH 1/2 mmc: use new hwpart API when CONFIG_BLK enabled
In reply to Kever YangQuoted 4 lines · Kever Yang
When
CONFIG_BLKis enabled, the hwpart id is different with legacy interface, update it to kame driver work withCONFIG_BLK.Signed-off-by Kever Yang <[email protected]>
Applied to u-boot-mmc. Thanks!
Best Regards,
Jaehoon Chung
Quoted 22 lines
---
cmd/mmc.c | 4 ++++ 1 file changed, 4 insertions(+)cmd/mmc.c +4
-0@@ -258,7 +258,11 @@ static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,return CMD_RET_FAILURE ; }/* Switch to the RPMB partition */ +#ifndef CONFIG_BLK original_part = mmc->block_dev.hwpart; +#else + original_part =mmc_get_blk_desc (mmc)->hwpart; +#endif if (blk_select_hwpart_devnum (IF_TYPE_MMC , curr_device,MMC_PART_RPMB ) !=0 )return CMD_RET_FAILURE ;