[U-Boot] [U-BOOT][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 donari75@gmail.com --- doc/README.mflash | 10 +++++----- drivers/block/mg_disk.c | 10 +++------- 2 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/doc/README.mflash b/doc/README.mflash index fb74b90..d0d0f7b 100644 --- a/doc/README.mflash +++ b/doc/README.mflash @@ -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. diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c index 4454fca..e1b1a68 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c @@ -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

On 20:06 Fri 13 Feb , unsik Kim wrote:
Byte is too small unit for CONFIG_MG_DISK_RES and also needs sector size alignment.
Signed-off-by: unsik Kim donari75@gmail.com
why do you do this in an other patch?
Best Regards, J.

This series of patches are logically same as my previous mails. Wolfgang Denx requested splitting. Please refer, 20090211213208.C53BE832E893@gemini.denx.de
Regards, unsik Kim
Jean-Christophe PLAGNIOL-VILLARD wrote:
On 20:06 Fri 13 Feb , unsik Kim wrote:
Byte is too small unit for CONFIG_MG_DISK_RES and also needs sector size alignment.
Signed-off-by: unsik Kim donari75@gmail.com
why do you do this in an other patch?
Best Regards, J.
participants (2)
-
Jean-Christophe PLAGNIOL-VILLARD
-
unsik Kim