From: Reinhard Meyer Date: Fri, 15 Oct 2010 06:49:36 +0200 Subject: [U-Boot] [PATCH RFC]: mmc: Add multi-block support In-Reply-To: <1287094363.7756.50.camel@quadra> References: <1287094363.7756.50.camel@quadra> Message-ID: <4CB7DD60.4010007@emk-elektronik.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Steve Sakoman, > From: Alagu Sankar > > 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 > Acked-by: Steve Sakoman > Tested-by: Steve Sakoman > +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