summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2017-03-27 22:02:32 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2017-04-24 21:41:57 +0200
commit75c7fd96d0e51e8d652767e910a79aad67fe9826 (patch)
tree25b1f36f8cf291e5ced8f15b2b7ffae0e03ca5a2 /drivers/mmc
parent3d03f6a99a8de552e094445dde341ca4b4d4326a (diff)
mmc: meson-gx: factor out setting response configuration bits
Factor out setting the response configuration bits thus further reducing complexity of function meson_mmc_start_cmd. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/meson-gx-mmc.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 0de320084c45..0036680bad9e 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -456,6 +456,23 @@ static void meson_mmc_set_blksz(struct mmc_host *mmc, unsigned int blksz)
writel(cfg, host->regs + SD_EMMC_CFG);
}
+static void meson_mmc_set_response_bits(struct mmc_command *cmd, u32 *cmd_cfg)
+{
+ if (cmd->flags & MMC_RSP_PRESENT) {
+ if (cmd->flags & MMC_RSP_136)
+ *cmd_cfg |= CMD_CFG_RESP_128;
+ *cmd_cfg |= CMD_CFG_RESP_NUM;
+
+ if (!(cmd->flags & MMC_RSP_CRC))
+ *cmd_cfg |= CMD_CFG_RESP_NOCRC;
+
+ if (cmd->flags & MMC_RSP_BUSY)
+ *cmd_cfg |= CMD_CFG_R1B;
+ } else {
+ *cmd_cfg |= CMD_CFG_NO_RESP;
+ }
+}
+
static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd)
{
struct meson_host *host = mmc_priv(mmc);
@@ -469,20 +486,7 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd)
cmd_cfg |= FIELD_PREP(CMD_CFG_CMD_INDEX_MASK, cmd->opcode);
cmd_cfg |= CMD_CFG_OWNER; /* owned by CPU */
- /* Response */
- if (cmd->flags & MMC_RSP_PRESENT) {
- if (cmd->flags & MMC_RSP_136)
- cmd_cfg |= CMD_CFG_RESP_128;
- cmd_cfg |= CMD_CFG_RESP_NUM;
-
- if (!(cmd->flags & MMC_RSP_CRC))
- cmd_cfg |= CMD_CFG_RESP_NOCRC;
-
- if (cmd->flags & MMC_RSP_BUSY)
- cmd_cfg |= CMD_CFG_R1B;
- } else {
- cmd_cfg |= CMD_CFG_NO_RESP;
- }
+ meson_mmc_set_response_bits(cmd, &cmd_cfg);
/* data? */
if (data) {