Change CONFIG_MG_DISK_RES unit to KB
PATCH 2/3 Change CONFIG_MG_DISK_RES unit to KB
Byte is too small unit for CONFIG_MG_DISK_RES and also needs sector size alignment.
Signed-off-by unsik Kim <[email protected]>
--- doc/README.mflash | 10 +++++----- drivers/block/mg_disk.c | 10 +++------- 2 files changed, 8 insertions(+), 12 deletions(-)
doc/README.mflash +5 -5
@@ -30,13 +30,13 @@ sector) and size of 0x400 (1024 byte) * Reserved size config (optional) If you want to use some reserved area for bootloader, environment variable or -whatever, use CONFIG_MG_DISK_RES. The value should be multiple of -MG_SECTOR_SIZE (512Byte). Mflash's block operation method use this value as -start offset. So any u-boot's partition table parser and file system command -work consistently. You can access this area by using mflash command. +whatever, use CONFIG_MG_DISK_RES. The unit is KB. Mflash's block operation +method use this value as start offset. So any u-boot's partition table parser +and file system command work consistently. You can access this area by using +mflash command. Following example sets 10MB of reserved area. -#define CONFIG_MG_DISK_RES 10485760 +#define CONFIG_MG_DISK_RES 10240 2-2. Porting mg_get_drv_data function Mflash is active device and need some gpio control for proper operation.
drivers/block/mg_disk.c +3 -7
@@ -34,11 +34,7 @@#define CONFIG_MG_DISK_RES 0#endif -#if (CONFIG_MG_DISK_RES %MG_SECTOR_SIZE !=0 ) -#error "CONFIG_MG_DISK_RES should be MG_SECTOR_SIZE algined" -#endif - -#define MG_DISK_RES ((CONFIG_MG_DISK_RES) / MG_SECTOR_SIZE) +#define MG_RES_SEC ((CONFIG_MG_DISK_RES) << 1)#define MG_BASE (host.drv_data->base)
@@ -344,7 +340,7 @@ unsigned int mg_disk_read_sects(void *buff, u32 sect_num, u32 sect_cnt)unsigned long mg_block_read (int dev,unsigned long start,lbaint_t blkcnt,void *buffer) { - start +=MG_DISK_RES ; + start +=MG_RES_SEC ;if (!mg_disk_read_sects (buffer, start, blkcnt))return blkcnt;else
@@ -482,7 +478,7 @@ unsigned int mg_disk_write_sects(void *buff, u32 sect_num, u32 sect_cnt)unsigned long mg_block_write (int dev,unsigned long start,lbaint_t blkcnt,const void *buffer) { - start +=MG_DISK_RES ; + start +=MG_RES_SEC ;if (!mg_disk_write_sects ((void *)buffer, start, blkcnt))return blkcnt;else
Signature · 1 line
1.5.6.6
PATCH 2/3 Change CONFIG_MG_DISK_RES unit to KB
Quoted 4 lines · unsik Kim
Byte is too small unit for
CONFIG_MG_DISK_RESand also needs sector size alignment.Signed-off-by unsik Kim <[email protected]>
why do you do this in an other patch?
Best Regards,
J.
PATCH 2/3 Change CONFIG_MG_DISK_RES unit to KB
This series of patches are logically same as my previous mails. Wolfgang Denx requested splitting.
Please refer, <[email protected]>
Regards,
unsik Kim
Quoted 10 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 4 lines · unsik Kim
Byte is too small unit for
CONFIG_MG_DISK_RESand also needs sector size alignment.Signed-off-by unsik Kim <[email protected]>why do you do this in an other patch?
Best Regards,
J.