aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2017-04-04 15:03:22 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2017-04-24 15:42:20 -0400
commitc08bcb6c90068d8eacffdb8b5f77916de5481a72 (patch)
tree2016023e1b0d3edfe545172f327683675deb48c6
parent06c9ccb78e68e2e9b69e736fc0a39fb13be49b74 (diff)
mmc: meson-gx: introduce struct meson_tuning_params
Introduce struct meson_tuning_params for storing the clock phase configurations. There's no functional change because tx and rx clock phase were implicitely set to CLK_PHASE_0 before. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/meson-gx-mmc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 0036680bad9e..3a6e51c8c5d2 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -49,6 +49,8 @@
49#define CLK_SRC_PLL 1 /* FCLK_DIV2 */ 49#define CLK_SRC_PLL 1 /* FCLK_DIV2 */
50#define CLK_SRC_PLL_RATE 1000000000 50#define CLK_SRC_PLL_RATE 1000000000
51#define CLK_CORE_PHASE_MASK GENMASK(9, 8) 51#define CLK_CORE_PHASE_MASK GENMASK(9, 8)
52#define CLK_TX_PHASE_MASK GENMASK(11, 10)
53#define CLK_RX_PHASE_MASK GENMASK(13, 12)
52#define CLK_PHASE_0 0 54#define CLK_PHASE_0 0
53#define CLK_PHASE_90 1 55#define CLK_PHASE_90 1
54#define CLK_PHASE_180 2 56#define CLK_PHASE_180 2
@@ -111,6 +113,12 @@
111#define SD_EMMC_CFG_CMD_GAP 16 /* in clock cycles */ 113#define SD_EMMC_CFG_CMD_GAP 16 /* in clock cycles */
112#define MUX_CLK_NUM_PARENTS 2 114#define MUX_CLK_NUM_PARENTS 2
113 115
116struct meson_tuning_params {
117 u8 core_phase;
118 u8 tx_phase;
119 u8 rx_phase;
120};
121
114struct meson_host { 122struct meson_host {
115 struct device *dev; 123 struct device *dev;
116 struct mmc_host *mmc; 124 struct mmc_host *mmc;
@@ -130,6 +138,7 @@ struct meson_host {
130 void *bounce_buf; 138 void *bounce_buf;
131 dma_addr_t bounce_dma_addr; 139 dma_addr_t bounce_dma_addr;
132 140
141 struct meson_tuning_params tp;
133 bool vqmmc_enabled; 142 bool vqmmc_enabled;
134}; 143};
135 144
@@ -312,7 +321,9 @@ static int meson_mmc_clk_init(struct meson_host *host)
312 321
313 /* init SD_EMMC_CLOCK to sane defaults w/min clock rate */ 322 /* init SD_EMMC_CLOCK to sane defaults w/min clock rate */
314 clk_reg = 0; 323 clk_reg = 0;
315 clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, CLK_PHASE_180); 324 clk_reg |= FIELD_PREP(CLK_CORE_PHASE_MASK, host->tp.core_phase);
325 clk_reg |= FIELD_PREP(CLK_TX_PHASE_MASK, host->tp.tx_phase);
326 clk_reg |= FIELD_PREP(CLK_RX_PHASE_MASK, host->tp.rx_phase);
316 clk_reg |= FIELD_PREP(CLK_SRC_MASK, CLK_SRC_XTAL); 327 clk_reg |= FIELD_PREP(CLK_SRC_MASK, CLK_SRC_XTAL);
317 clk_reg |= FIELD_PREP(CLK_DIV_MASK, CLK_DIV_MAX); 328 clk_reg |= FIELD_PREP(CLK_DIV_MASK, CLK_DIV_MAX);
318 clk_reg &= ~CLK_ALWAYS_ON; 329 clk_reg &= ~CLK_ALWAYS_ON;
@@ -757,6 +768,10 @@ static int meson_mmc_probe(struct platform_device *pdev)
757 if (ret) 768 if (ret)
758 goto free_host; 769 goto free_host;
759 770
771 host->tp.core_phase = CLK_PHASE_180;
772 host->tp.tx_phase = CLK_PHASE_0;
773 host->tp.rx_phase = CLK_PHASE_0;
774
760 ret = meson_mmc_clk_init(host); 775 ret = meson_mmc_clk_init(host);
761 if (ret) 776 if (ret)
762 goto err_core_clk; 777 goto err_core_clk;