summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/meson-gx-mmc.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2017-03-04 13:37:46 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2017-04-24 21:41:12 +0200
commitbb11eff1f1820b9f3bf6578af18b3d18094e7f54 (patch)
treecc987f2efe3a206e2e653a94ed8d40f2efd5a320 /drivers/mmc/host/meson-gx-mmc.c
parent7cdcc480e4c32b0480233adb196a573ef538a6b6 (diff)
mmc: meson-gx: replace magic timeout numbers with constants
Replace timeout magic numbers with proper constants. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Acked-by: Kevin Hilman <khilman@baylibre.com> Tested-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/meson-gx-mmc.c')
-rw-r--r--drivers/mmc/host/meson-gx-mmc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index d1826cf87a76..62597638ccaf 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -116,6 +116,8 @@
#define SD_EMMC_CFG_BLK_SIZE 512 /* internal buffer max: 512 bytes */
#define SD_EMMC_CFG_RESP_TIMEOUT 256 /* in clock cycles */
+#define SD_EMMC_CMD_TIMEOUT 1024 /* in ms */
+#define SD_EMMC_CMD_TIMEOUT_DATA 4096 /* in ms */
#define SD_EMMC_CFG_CMD_GAP 16 /* in clock cycles */
#define MUX_CLK_NUM_PARENTS 2
@@ -498,10 +500,10 @@ static void meson_mmc_start_cmd(struct mmc_host *mmc, struct mmc_command *cmd)
desc->cmd_data = host->bounce_dma_addr & CMD_DATA_MASK;
- cmd_cfg_timeout = 12;
+ cmd_cfg_timeout = ilog2(SD_EMMC_CMD_TIMEOUT_DATA);
} else {
desc->cmd_cfg &= ~CMD_CFG_DATA_IO;
- cmd_cfg_timeout = 10;
+ cmd_cfg_timeout = ilog2(SD_EMMC_CMD_TIMEOUT);
}
desc->cmd_cfg |= (cmd_cfg_timeout & CMD_CFG_TIMEOUT_MASK) <<
CMD_CFG_TIMEOUT_SHIFT;