[U-Boot] [PATCH RFC]: mmc: Add multi-block support

Reinhard Meyer u-boot at emk-elektronik.de
Fri Oct 15 06:49:36 CEST 2010


Dear Steve Sakoman,
> From: Alagu Sankar<alagusankar at embwise.com>
>
> This patch adds multi-block read support for generic MMC. It also modifies
> existing multi-block write to limit the maximum number of blocks per transfer.
> A new member is added in the mmc structure for the host controller to specify
> the maximum number of blocks it supports.
>
> Signed-off-by: Alagu Sankar<alagusankar at embwise.com>
> Acked-by: Steve Sakoman<steve.sakoman at linaro.org>
> Tested-by: Steve Sakoman<steve.sakoman at linaro.org>

> +static ulong
> +mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void *src)
> +{
> +	int err;
> +	int i;
> +	struct mmc *mmc = find_mmc_device(dev_num);
> +	uint b_max = mmc->b_max;
> +
> +	if (!mmc)
> +		return 0;
> +
> +	for (i = blkcnt; i>  0; i -= b_max) {
> +		uint blocks = (i>  b_max) ? b_max : i;

I feel that all vars dealing with #blocks (b_max, i) should be lbaint_t too,
not a mixture of int, uint... (i -= b_max) would have to be rephrased, then.
That would apply to the parameters of the *_blocks functions as well...
Have a look at Lei Wen's patch of 2 days ago in this matter:
[PATCH V4] mmc: seperate block number into small parts for multi-write cmd

> +	if (mmc->b_max == 0)
> +		mmc->b_max = 1;

Currently some of the mmc low level drivers do not clear the structure,
so unfortunately this would fail. That should be corrected in the drivers,
of course.

> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -274,6 +274,7 @@ struct mmc {
>   			struct mmc_cmd *cmd, struct mmc_data *data);
>   	void (*set_ios)(struct mmc *mmc);
>   	int (*init)(struct mmc *mmc);
> +	uint b_max;

lbaint_t b_max ?

Best Regards,
Reinhard


More information about the U-Boot mailing list