diff options
author | Fred Fan <r01011@freescale.com> | 2009-11-19 16:43:08 +0800 |
---|---|---|
committer | Terry Lv <r65388@freescale.com> | 2009-12-04 17:14:08 +0800 |
commit | d8667412a8b7e1ad96979bc2191b4e3fa90c8254 (patch) | |
tree | 52f9a08604fdbb9a3dfee9e77473f7a0127126ca /common/env_mmc.c | |
parent | 3f86cf9693f8b98c44999e81d4067943c634b421 (diff) | |
download | u-boot-imx-d8667412a8b7e1ad96979bc2191b4e3fa90c8254.zip u-boot-imx-d8667412a8b7e1ad96979bc2191b4e3fa90c8254.tar.gz u-boot-imx-d8667412a8b7e1ad96979bc2191b4e3fa90c8254.tar.bz2 |
ENGR00118978: Timer adjustment for all platforms
In current u-boot design,
get_timer_masked is not correct and udelay is not accurate
when the time is less than 1000us.
Thus we need to use ipg clock source for accurate timer.
Signed-off-by: Terry Lv <r65388@freescale.com>
Diffstat (limited to 'common/env_mmc.c')
-rw-r--r-- | common/env_mmc.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common/env_mmc.c b/common/env_mmc.c index 5742db0..8c98ad2 100644 --- a/common/env_mmc.c +++ b/common/env_mmc.c @@ -101,8 +101,10 @@ inline int write_env(struct mmc *mmc, unsigned long size, { uint blk_start = 0, blk_cnt = 0, n = 0; - blk_start = (offset % 512) ? ((offset / 512) + 1) : (offset / 512); - blk_cnt = (size % 512) ? ((size / 512) + 1) : (size / 512); + blk_start = (offset & (0x200 - 1)) \ + ? ((offset >> 9) + 1) : (offset >> 9); + blk_cnt = (size & (0x200 - 1)) \ + ? ((size >> 9) + 1) : (size >> 9); n = mmc->block_dev.block_write(0, blk_start , blk_cnt, (u_char *)buffer); return (n == blk_cnt) ? 0 : -1; @@ -132,8 +134,10 @@ inline int read_env(struct mmc *mmc, unsigned long size, { uint blk_start = 0, blk_cnt = 0, n = 0; - blk_start = (offset % 512) ? ((offset / 512) + 1) : (offset / 512); - blk_cnt = (size % 512) ? ((size / 512) + 1) : (size / 512); + blk_start = (offset & (0x200 - 1)) ? \ + ((offset >> 9) + 1) : (offset >> 9); + blk_cnt = (size & (0x200 - 1)) ? \ + ((size >> 9) + 1) : (size >> 9); n = mmc->block_dev.block_read(0, blk_start, blk_cnt, (uchar *)buffer); |