@@ -458,31 +458,21 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd)
/* data? */
if (cmd->data) {
- desc->cmd_cfg |= CMD_CFG_DATA_IO;
- if (cmd->data->blocks > 1) {
- desc->cmd_cfg |= CMD_CFG_BLOCK_MODE;
- desc->cmd_cfg |=
- (cmd->data->blocks & CMD_CFG_LENGTH_MASK) <<
- CMD_CFG_LENGTH_SHIFT;
-
- /* check if block-size matches, if not update */
- cfg = readl(host->regs + SD_EMMC_CFG);
- blk_len = cfg & (CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT);
- blk_len >>= CFG_BLK_LEN_SHIFT;
- if (blk_len != ilog2(cmd->data->blksz)) {
- dev_dbg(host->dev, "%s: update blk_len %d -> %d\n",
- __func__, blk_len,
- ilog2(cmd->data->blksz));
- blk_len = ilog2(cmd->data->blksz);
- cfg &= ~(CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT);
- cfg |= blk_len << CFG_BLK_LEN_SHIFT;
- writel(cfg, host->regs + SD_EMMC_CFG);
- }
- } else {
- desc->cmd_cfg &= ~CMD_CFG_BLOCK_MODE;
- desc->cmd_cfg |=
- (cmd->data->blksz & CMD_CFG_LENGTH_MASK) <<
- CMD_CFG_LENGTH_SHIFT;
+ desc->cmd_cfg |= CMD_CFG_DATA_IO | CMD_CFG_BLOCK_MODE;
+ desc->cmd_cfg |= (cmd->data->blocks & CMD_CFG_LENGTH_MASK) <<
+ CMD_CFG_LENGTH_SHIFT;
+
+ /* check if block-size matches, if not update */
+ cfg = readl(host->regs + SD_EMMC_CFG);
+ blk_len = cfg & (CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT);
+ blk_len >>= CFG_BLK_LEN_SHIFT;
+ if (blk_len != ilog2(cmd->data->blksz)) {
+ dev_dbg(host->dev, "%s: update blk_len %d -> %d\n",
+ __func__, blk_len, ilog2(cmd->data->blksz));
+ blk_len = ilog2(cmd->data->blksz);
+ cfg &= ~(CFG_BLK_LEN_MASK << CFG_BLK_LEN_SHIFT);
+ cfg |= blk_len << CFG_BLK_LEN_SHIFT;
+ writel(cfg, host->regs + SD_EMMC_CFG);
}
cmd->data->bytes_xfered = 0;
Currently block mode isn't used if just one block has to be transferred. Change this to use block mode also in this case. This helps to simplify the code in function meson_mmc_start_cmd which is quite (too?) complex currently. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> --- drivers/mmc/host/meson-gx-mmc.c | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-)