static void sh_mmcif_multi_read(struct sh_mmcif_host *host,
struct mmc_request *mrq)
{
+ struct sg_mapping_iter *sgm = &host->sg_miter;
struct mmc_data *data = mrq->data;
if (!data->sg_len || !data->sg->length)
host->blocksize = sh_mmcif_readl(host->addr, MMCIF_CE_BLOCK_SET) &
BLOCK_SIZE_MASK;
- sg_miter_start(&host->sg_miter, data->sg, data->sg_len,
+ sg_miter_start(sgm, data->sg, data->sg_len,
SG_MITER_TO_SG);
+ /* Advance to the first sglist entry */
+ if (!sg_miter_next(sgm)) {
+ sg_miter_stop(sgm);
+ return;
+ }
+
host->wait_for = MMCIF_WAIT_FOR_MREAD;
sh_mmcif_bitset(host, MMCIF_CE_INT_MASK, MASK_MBUFREN);
return false;
}
- if (!sg_miter_next(sgm)) {
- sg_miter_stop(sgm);
- return false;
- }
-
p = sgm->addr;
for (i = 0; i < host->blocksize / 4; i++)
sh_mmcif_bitset(host, MMCIF_CE_INT_MASK, MASK_MBUFREN);
+ if (!sg_miter_next(sgm)) {
+ sg_miter_stop(sgm);
+ return false;
+ }
+
return true;
}
static void sh_mmcif_multi_write(struct sh_mmcif_host *host,
struct mmc_request *mrq)
{
+ struct sg_mapping_iter *sgm = &host->sg_miter;
struct mmc_data *data = mrq->data;
if (!data->sg_len || !data->sg->length)
host->blocksize = sh_mmcif_readl(host->addr, MMCIF_CE_BLOCK_SET) &
BLOCK_SIZE_MASK;
- sg_miter_start(&host->sg_miter, data->sg, data->sg_len,
+ sg_miter_start(sgm, data->sg, data->sg_len,
SG_MITER_FROM_SG);
+ /* Advance to the first sglist entry */
+ if (!sg_miter_next(sgm)) {
+ sg_miter_stop(sgm);
+ return;
+ }
+
host->wait_for = MMCIF_WAIT_FOR_MWRITE;
sh_mmcif_bitset(host, MMCIF_CE_INT_MASK, MASK_MBUFWEN);
return false;
}
- if (!sg_miter_next(sgm)) {
- sg_miter_stop(sgm);
- return false;
- }
-
p = sgm->addr;
for (i = 0; i < host->blocksize / 4; i++)
sgm->consumed = host->blocksize;
+ if (!sg_miter_next(sgm)) {
+ sg_miter_stop(sgm);
+ return false;
+ }
+
sh_mmcif_bitset(host, MMCIF_CE_INT_MASK, MASK_MBUFWEN);
return true;