summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Chuang <ben.chuang@genesyslogic.com.tw>2019-08-26 20:32:55 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2019-09-11 09:58:39 -0400
commit1beabbdba708bc9b6d7fc04695cc98d1287d92f2 (patch)
treef309d239cbdbcd76d505ad5fdc812664cf3fbdd0
parent4a9e0d1a6256024582c225ce0d86b51e109062c4 (diff)
mmc: sdhci: Add PLL Enable support to internal clock setup
The GL9750 and GL9755 chipsets, and possibly others, require PLL Enable setup as part of the internal clock setup as described in 3.2.1 Internal Clock Setup Sequence of SD Host Controller Simplified Specification Version 4.20. Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw> Co-developed-by: Michael K Johnson <johnsonm@danlj.org> Signed-off-by: Michael K Johnson <johnsonm@danlj.org> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/sdhci.c23
-rw-r--r--drivers/mmc/host/sdhci.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 40de56d6da0b..de833b1eadb9 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1653,6 +1653,29 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk)
1653 udelay(10); 1653 udelay(10);
1654 } 1654 }
1655 1655
1656 if (host->version >= SDHCI_SPEC_410 && host->v4_mode) {
1657 clk |= SDHCI_CLOCK_PLL_EN;
1658 clk &= ~SDHCI_CLOCK_INT_STABLE;
1659 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
1660
1661 /* Wait max 150 ms */
1662 timeout = ktime_add_ms(ktime_get(), 150);
1663 while (1) {
1664 bool timedout = ktime_after(ktime_get(), timeout);
1665
1666 clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL);
1667 if (clk & SDHCI_CLOCK_INT_STABLE)
1668 break;
1669 if (timedout) {
1670 pr_err("%s: PLL clock never stabilised.\n",
1671 mmc_hostname(host->mmc));
1672 sdhci_dumpregs(host);
1673 return;
1674 }
1675 udelay(10);
1676 }
1677 }
1678
1656 clk |= SDHCI_CLOCK_CARD_EN; 1679 clk |= SDHCI_CLOCK_CARD_EN;
1657 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); 1680 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
1658} 1681}
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index 902f855efe8f..929310e869a3 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -114,6 +114,7 @@
114#define SDHCI_DIV_HI_MASK 0x300 114#define SDHCI_DIV_HI_MASK 0x300
115#define SDHCI_PROG_CLOCK_MODE 0x0020 115#define SDHCI_PROG_CLOCK_MODE 0x0020
116#define SDHCI_CLOCK_CARD_EN 0x0004 116#define SDHCI_CLOCK_CARD_EN 0x0004
117#define SDHCI_CLOCK_PLL_EN 0x0008
117#define SDHCI_CLOCK_INT_STABLE 0x0002 118#define SDHCI_CLOCK_INT_STABLE 0x0002
118#define SDHCI_CLOCK_INT_EN 0x0001 119#define SDHCI_CLOCK_INT_EN 0x0001
119 120