public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [U-BOOT][PATCH 2/3] Change CONFIG_MG_DISK_RES unit to KB
@ 2009-02-13 11:06 unsik Kim
  2009-02-14 11:52 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 3+ messages in thread
From: unsik Kim @ 2009-02-13 11:06 UTC (permalink / raw)
  To: u-boot

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
-- 
1.5.6.6

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

* [U-Boot] [U-BOOT][PATCH 2/3] Change CONFIG_MG_DISK_RES unit to KB
  2009-02-13 11:06 [U-Boot] [U-BOOT][PATCH 2/3] Change CONFIG_MG_DISK_RES unit to KB unsik Kim
@ 2009-02-14 11:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-02-17  7:10   ` [U-Boot] [PATCH " unsik Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-02-14 11:52 UTC (permalink / raw)
  To: u-boot

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.

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

* [U-Boot] [PATCH 2/3] Change CONFIG_MG_DISK_RES unit to KB
  2009-02-14 11:52 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-02-17  7:10   ` unsik Kim
  0 siblings, 0 replies; 3+ messages in thread
From: unsik Kim @ 2009-02-17  7:10 UTC (permalink / raw)
  To: u-boot

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.
> 

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

end of thread, other threads:[~2009-02-17  7:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-13 11:06 [U-Boot] [U-BOOT][PATCH 2/3] Change CONFIG_MG_DISK_RES unit to KB unsik Kim
2009-02-14 11:52 ` Jean-Christophe PLAGNIOL-VILLARD
2009-02-17  7:10   ` [U-Boot] [PATCH " unsik Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox