diff options
author | Stephen Warren <swarren@nvidia.com> | 2015-12-07 11:38:48 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-01-13 21:05:18 -0500 |
commit | 7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86 (patch) | |
tree | 8dfb6b9f5721891de191bad798b0533e3a0bf69a /drivers/mmc | |
parent | adc421e4cee8275cd99367b3b455ffbb5ead3990 (diff) | |
download | u-boot-imx-7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86.zip u-boot-imx-7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86.tar.gz u-boot-imx-7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86.tar.bz2 |
block: pass block dev not num to read/write/erase()
This will allow the implementation to make use of data in the block_dev
structure beyond the base device number. This will be useful so that eMMC
block devices can encompass the HW partition ID rather than treating this
out-of-band. Equally, the existence of the priv field is crying out for
this patch to exist.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/fsl_esdhc_spl.c | 8 | ||||
-rw-r--r-- | drivers/mmc/mmc.c | 4 | ||||
-rw-r--r-- | drivers/mmc/mmc_private.h | 15 | ||||
-rw-r--r-- | drivers/mmc/mmc_write.c | 8 | ||||
-rw-r--r-- | drivers/mmc/sunxi_mmc.c | 2 |
5 files changed, 23 insertions, 14 deletions
diff --git a/drivers/mmc/fsl_esdhc_spl.c b/drivers/mmc/fsl_esdhc_spl.c index b1cb4b3..301d9b3 100644 --- a/drivers/mmc/fsl_esdhc_spl.c +++ b/drivers/mmc/fsl_esdhc_spl.c @@ -38,7 +38,8 @@ void mmc_spl_load_image(uint32_t offs, unsigned int size, void *vdst) blk_start = ALIGN(offs, mmc->read_bl_len) / mmc->read_bl_len; blk_cnt = ALIGN(size, mmc->read_bl_len) / mmc->read_bl_len; - err = mmc->block_dev.block_read(0, blk_start, blk_cnt, vdst); + err = mmc->block_dev.block_read(&mmc->block_dev, blk_start, blk_cnt, + vdst); if (err != blk_cnt) { puts("spl: mmc read failed!!\n"); hang(); @@ -85,7 +86,8 @@ void __noreturn mmc_boot(void) /* * Read source addr from sd card */ - err = mmc->block_dev.block_read(0, CONFIG_CFG_DATA_SECTOR, 1, tmp_buf); + err = mmc->block_dev.block_read(&mmc->block_dev, + CONFIG_CFG_DATA_SECTOR, 1, tmp_buf); if (err != 1) { puts("spl: mmc read failed!!\n"); free(tmp_buf); @@ -126,7 +128,7 @@ void __noreturn mmc_boot(void) #endif blk_start = ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len; blk_cnt = ALIGN(code_len, mmc->read_bl_len) / mmc->read_bl_len; - err = mmc->block_dev.block_read(0, blk_start, blk_cnt, + err = mmc->block_dev.block_read(&mmc->block_dev, blk_start, blk_cnt, (uchar *)CONFIG_SYS_MMC_U_BOOT_DST); if (err != blk_cnt) { puts("spl: mmc read failed!!\n"); diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index 3a34028..6d88db4 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -234,8 +234,10 @@ static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start, return blkcnt; } -static ulong mmc_bread(int dev_num, lbaint_t start, lbaint_t blkcnt, void *dst) +static ulong mmc_bread(block_dev_desc_t *block_dev, lbaint_t start, + lbaint_t blkcnt, void *dst) { + int dev_num = block_dev->dev; lbaint_t cur, blocks_todo = blkcnt; if (blkcnt == 0) diff --git a/drivers/mmc/mmc_private.h b/drivers/mmc/mmc_private.h index 447a700..6a70639 100644 --- a/drivers/mmc/mmc_private.h +++ b/drivers/mmc/mmc_private.h @@ -22,23 +22,24 @@ void mmc_adapter_card_type_ident(void); #ifndef CONFIG_SPL_BUILD -extern unsigned long mmc_berase(int dev_num, lbaint_t start, lbaint_t blkcnt); +unsigned long mmc_berase(block_dev_desc_t *block_dev, lbaint_t start, + lbaint_t blkcnt); -extern ulong mmc_bwrite(int dev_num, lbaint_t start, lbaint_t blkcnt, - const void *src); +unsigned long mmc_bwrite(block_dev_desc_t *block_dev, lbaint_t start, + lbaint_t blkcnt, const void *src); #else /* CONFIG_SPL_BUILD */ /* SPL will never write or erase, declare dummies to reduce code size. */ -static inline unsigned long mmc_berase(int dev_num, lbaint_t start, - lbaint_t blkcnt) +static inline unsigned long mmc_berase(block_dev_desc_t *block_dev, + lbaint_t start, lbaint_t blkcnt) { return 0; } -static inline ulong mmc_bwrite(int dev_num, lbaint_t start, lbaint_t blkcnt, - const void *src) +static inline ulong mmc_bwrite(block_dev_desc_t *block_dev, lbaint_t start, + lbaint_t blkcnt, const void *src) { return 0; } diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c index 221bf30..6733314 100644 --- a/drivers/mmc/mmc_write.c +++ b/drivers/mmc/mmc_write.c @@ -65,8 +65,10 @@ err_out: return err; } -unsigned long mmc_berase(int dev_num, lbaint_t start, lbaint_t blkcnt) +unsigned long mmc_berase(block_dev_desc_t *block_dev, lbaint_t start, + lbaint_t blkcnt) { + int dev_num = block_dev->dev; int err = 0; u32 start_rem, blkcnt_rem; struct mmc *mmc = find_mmc_device(dev_num); @@ -165,8 +167,10 @@ static ulong mmc_write_blocks(struct mmc *mmc, lbaint_t start, return blkcnt; } -ulong mmc_bwrite(int dev_num, lbaint_t start, lbaint_t blkcnt, const void *src) +ulong mmc_bwrite(block_dev_desc_t *block_dev, lbaint_t start, lbaint_t blkcnt, + const void *src) { + int dev_num = block_dev->dev; lbaint_t cur, blocks_todo = blkcnt; struct mmc *mmc = find_mmc_device(dev_num); diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c index e717c44..7b33094 100644 --- a/drivers/mmc/sunxi_mmc.c +++ b/drivers/mmc/sunxi_mmc.c @@ -454,7 +454,7 @@ int sunxi_mmc_has_egon_boot_signature(struct mmc *mmc) panic("Failed to allocate memory\n"); if (mmc_getcd(mmc) && mmc_init(mmc) == 0 && - mmc->block_dev.block_read(mmc->block_dev.dev, 16, 1, buf) == 1 && + mmc->block_dev.block_read(&mmc->block_dev, 16, 1, buf) == 1 && strncmp(&buf[4], "eGON.BT0", 8) == 0) valid_signature = 1; |