[U-Boot] [PATCHv2] MMC: disable multiblock rw on old rev OMAP3 silicon

Andy Fleming afleming at freescale.com
Thu Apr 14 20:32:44 CEST 2011


On Apr 14, 2011, at 10:46 AM, John Rigby wrote:

> Make existing field b_max field in struct mmc unconditional
> and use it instead of CONFIG_SYS_MMC_MAX_BLK_COUNT in mmc_bread
> and mmc_bwrite.
> 
> Initialize b_max to CONFIG_SYS_MMC_MAX_BLK_COUNT in mmc_register
> if it has not been initialized by the hw driver.
> 
> Initialize b_max to 1 in omap_hsmmc.c for old rev silicon OMAP3
> to disable multi block rw.
> 
> Signed-off-by: John Rigby <john.rigby at linaro.org>
> ---
> v2: Test cpu family and rev
> 
> drivers/mmc/mmc.c        |    8 ++++----
> drivers/mmc/omap_hsmmc.c |    8 ++++++++
> include/mmc.h            |    2 --


Please split apart the omap changes vs the generic changes.


> 3 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index d69eaa1..59ca4df 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -144,8 +144,7 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
> 		return 0;
> 
> 	do {
> -		cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ?
> -		       CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo;
> +		cur = (blocks_todo > mmc->b_max) ?  mmc->b_max : blocks_todo;
> 		if(mmc_write_blocks(mmc, start, cur, src) != cur)
> 			return 0;
> 		blocks_todo -= cur;
> @@ -217,8 +216,7 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
> 		return 0;
> 
> 	do {
> -		cur = (blocks_todo > CONFIG_SYS_MMC_MAX_BLK_COUNT) ?
> -		       CONFIG_SYS_MMC_MAX_BLK_COUNT : blocks_todo;
> +		cur = (blocks_todo > mmc->b_max) ?  mmc->b_max : blocks_todo;
> 		if(mmc_read_blocks(mmc, dst, start, cur) != cur)
> 			return 0;
> 		blocks_todo -= cur;
> @@ -852,6 +850,8 @@ int mmc_register(struct mmc *mmc)
> 	mmc->block_dev.removable = 1;
> 	mmc->block_dev.block_read = mmc_bread;
> 	mmc->block_dev.block_write = mmc_bwrite;
> +	if (!mmc->b_max)
> +		mmc->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
> 
> 	INIT_LIST_HEAD (&mmc->link);
> 
> diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
> index 6f2280a..685ff74 100644
> --- a/drivers/mmc/omap_hsmmc.c
> +++ b/drivers/mmc/omap_hsmmc.c
> @@ -465,6 +465,14 @@ int omap_mmc_init(int dev_index)
> 	mmc->f_min = 400000;
> 	mmc->f_max = 52000000;
> 
> +#if defined(CONFIG_OMAP34XX)
> +	/*
> +	 * 34XX silicon revs 2.1 and older do not support multiblock transfers.
> +	 */
> +	if ((get_cpu_family() == CPU_OMAP34XX) && (get_cpu_rev() <= CPU_3XX_ES21))
> +		mmc->b_max = 1;
> +#endif
> +


It would be better if we could avoid platform-specific code in the driver....but I see that there's already a lot of that, so I'll save that fight for another day.  :)


> 	mmc_register(mmc);
> 
> 	return 0;
> diff --git a/include/mmc.h b/include/mmc.h
> index fcd0fd1..91d0495 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -274,9 +274,7 @@ struct mmc {
> 			struct mmc_cmd *cmd, struct mmc_data *data);
> 	void (*set_ios)(struct mmc *mmc);
> 	int (*init)(struct mmc *mmc);
> -#ifdef CONFIG_MMC_MBLOCK
> 	uint b_max;
> -#endif


Can you go and remove CONFIG_MMC_MBLOCK from the 3 other places it appears? It seems to be unnecessary at the moment.

Andy


More information about the U-Boot mailing list