From: Baolin Wang <baolin.wang@linaro.org> To: adrian.hunter@intel.com, ulf.hansson@linaro.org, zhang.lyra@gmail.com, orsonzhai@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, arnd@arndb.de, olof@lixom.net Cc: baolin.wang@linaro.org, vincent.guittot@linaro.org, arm@kernel.org, linux-arm-kernel@lists.infradead.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 5/9] mmc: sdhci-sprd: Add HS400 enhanced strobe mode Date: Mon, 20 May 2019 18:11:58 +0800 [thread overview] Message-ID: <20349e8ebd4c1ec64fb5f8cdd9e094d0c1732855.1558346019.git.baolin.wang@linaro.org> (raw) In-Reply-To: <cover.1558346019.git.baolin.wang@linaro.org> In-Reply-To: <cover.1558346019.git.baolin.wang@linaro.org> Add HS400 enhanced strobe mode support for Spreadtrum SD host controller. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> --- drivers/mmc/host/sdhci-sprd.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index d91281d..edec197 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -41,6 +41,7 @@ /* SDHCI_HOST_CONTROL2 */ #define SDHCI_SPRD_CTRL_HS200 0x0005 #define SDHCI_SPRD_CTRL_HS400 0x0006 +#define SDHCI_SPRD_CTRL_HS400ES 0x0007 /* * According to the standard specification, BIT(3) of SDHCI_SOFTWARE_RESET is @@ -132,6 +133,15 @@ static inline void sdhci_sprd_sd_clk_off(struct sdhci_host *host) sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); } +static inline void sdhci_sprd_sd_clk_on(struct sdhci_host *host) +{ + u16 ctrl; + + ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL); + ctrl |= SDHCI_CLOCK_CARD_EN; + sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); +} + static inline void sdhci_sprd_set_dll_invert(struct sdhci_host *host, u32 mask, bool en) { @@ -325,6 +335,26 @@ static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) sdhci_request(mmc, mrq); } +static void sdhci_sprd_hs400_enhanced_strobe(struct mmc_host *mmc, + struct mmc_ios *ios) +{ + struct sdhci_host *host = mmc_priv(mmc); + u16 ctrl_2; + + if (!ios->enhanced_strobe) + return; + + sdhci_sprd_sd_clk_off(host); + + /* Set HS400 enhanced strobe mode */ + ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + ctrl_2 &= ~SDHCI_CTRL_UHS_MASK; + ctrl_2 |= SDHCI_SPRD_CTRL_HS400ES; + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); + + sdhci_sprd_sd_clk_on(host); +} + static const struct sdhci_pltfm_data sdhci_sprd_pdata = { .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK, .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 | @@ -346,6 +376,8 @@ static int sdhci_sprd_probe(struct platform_device *pdev) host->dma_mask = DMA_BIT_MASK(64); pdev->dev.dma_mask = &host->dma_mask; host->mmc_host_ops.request = sdhci_sprd_request; + host->mmc_host_ops.hs400_enhanced_strobe = + sdhci_sprd_hs400_enhanced_strobe; host->mmc->caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_ERASE | MMC_CAP_CMD23; -- 1.7.9.5
WARNING: multiple messages have this Message-ID (diff)
From: Baolin Wang <baolin.wang@linaro.org> To: adrian.hunter@intel.com, ulf.hansson@linaro.org, zhang.lyra@gmail.com, orsonzhai@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com, arnd@arndb.de, olof@lixom.net Cc: devicetree@vger.kernel.org, vincent.guittot@linaro.org, baolin.wang@linaro.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, arm@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 5/9] mmc: sdhci-sprd: Add HS400 enhanced strobe mode Date: Mon, 20 May 2019 18:11:58 +0800 [thread overview] Message-ID: <20349e8ebd4c1ec64fb5f8cdd9e094d0c1732855.1558346019.git.baolin.wang@linaro.org> (raw) In-Reply-To: <cover.1558346019.git.baolin.wang@linaro.org> In-Reply-To: <cover.1558346019.git.baolin.wang@linaro.org> Add HS400 enhanced strobe mode support for Spreadtrum SD host controller. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> --- drivers/mmc/host/sdhci-sprd.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c index d91281d..edec197 100644 --- a/drivers/mmc/host/sdhci-sprd.c +++ b/drivers/mmc/host/sdhci-sprd.c @@ -41,6 +41,7 @@ /* SDHCI_HOST_CONTROL2 */ #define SDHCI_SPRD_CTRL_HS200 0x0005 #define SDHCI_SPRD_CTRL_HS400 0x0006 +#define SDHCI_SPRD_CTRL_HS400ES 0x0007 /* * According to the standard specification, BIT(3) of SDHCI_SOFTWARE_RESET is @@ -132,6 +133,15 @@ static inline void sdhci_sprd_sd_clk_off(struct sdhci_host *host) sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); } +static inline void sdhci_sprd_sd_clk_on(struct sdhci_host *host) +{ + u16 ctrl; + + ctrl = sdhci_readw(host, SDHCI_CLOCK_CONTROL); + ctrl |= SDHCI_CLOCK_CARD_EN; + sdhci_writew(host, ctrl, SDHCI_CLOCK_CONTROL); +} + static inline void sdhci_sprd_set_dll_invert(struct sdhci_host *host, u32 mask, bool en) { @@ -325,6 +335,26 @@ static void sdhci_sprd_request(struct mmc_host *mmc, struct mmc_request *mrq) sdhci_request(mmc, mrq); } +static void sdhci_sprd_hs400_enhanced_strobe(struct mmc_host *mmc, + struct mmc_ios *ios) +{ + struct sdhci_host *host = mmc_priv(mmc); + u16 ctrl_2; + + if (!ios->enhanced_strobe) + return; + + sdhci_sprd_sd_clk_off(host); + + /* Set HS400 enhanced strobe mode */ + ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2); + ctrl_2 &= ~SDHCI_CTRL_UHS_MASK; + ctrl_2 |= SDHCI_SPRD_CTRL_HS400ES; + sdhci_writew(host, ctrl_2, SDHCI_HOST_CONTROL2); + + sdhci_sprd_sd_clk_on(host); +} + static const struct sdhci_pltfm_data sdhci_sprd_pdata = { .quirks = SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK, .quirks2 = SDHCI_QUIRK2_BROKEN_HS200 | @@ -346,6 +376,8 @@ static int sdhci_sprd_probe(struct platform_device *pdev) host->dma_mask = DMA_BIT_MASK(64); pdev->dev.dma_mask = &host->dma_mask; host->mmc_host_ops.request = sdhci_sprd_request; + host->mmc_host_ops.hs400_enhanced_strobe = + sdhci_sprd_hs400_enhanced_strobe; host->mmc->caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_ERASE | MMC_CAP_CMD23; -- 1.7.9.5 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-05-20 10:12 UTC|newest] Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-20 10:11 [PATCH 0/9] Add SD host controller support for SC9860 platform Baolin Wang 2019-05-20 10:11 ` Baolin Wang 2019-05-20 10:11 ` [PATCH 1/9] mmc: sdhci-sprd: Check the enable clock's return value correctly Baolin Wang 2019-05-20 10:11 ` Baolin Wang 2019-06-03 12:09 ` Adrian Hunter 2019-06-03 12:09 ` Adrian Hunter 2019-05-20 10:11 ` [PATCH 2/9] dt-bindings: mmc: sprd: Add another optional clock documentation Baolin Wang 2019-05-20 10:11 ` Baolin Wang 2019-06-03 13:34 ` Ulf Hansson 2019-06-03 13:34 ` Ulf Hansson 2019-06-04 2:33 ` Baolin Wang 2019-06-04 2:33 ` Baolin Wang 2019-06-04 6:52 ` Ulf Hansson 2019-06-04 6:52 ` Ulf Hansson 2019-05-20 10:11 ` [PATCH 3/9] mmc: sdhci-sprd: Add optional gate clock support Baolin Wang 2019-05-20 10:11 ` Baolin Wang 2019-06-03 12:20 ` Adrian Hunter 2019-06-03 12:20 ` Adrian Hunter 2019-05-20 10:11 ` [PATCH 4/9] mmc: sdhci-sprd: Implement the get_max_timeout_count() interface Baolin Wang 2019-05-20 10:11 ` Baolin Wang 2019-06-03 12:34 ` Adrian Hunter 2019-06-03 12:34 ` Adrian Hunter 2019-06-04 8:03 ` Baolin Wang 2019-06-04 8:03 ` Baolin Wang 2019-05-20 10:11 ` Baolin Wang [this message] 2019-05-20 10:11 ` [PATCH 5/9] mmc: sdhci-sprd: Add HS400 enhanced strobe mode Baolin Wang 2019-06-03 12:39 ` Adrian Hunter 2019-06-03 12:39 ` Adrian Hunter 2019-05-20 10:11 ` [PATCH 6/9] mmc: sdhci-sprd: Enable PHY DLL to make clock stable Baolin Wang 2019-05-20 10:11 ` Baolin Wang 2019-06-03 12:40 ` Adrian Hunter 2019-06-03 12:40 ` Adrian Hunter 2019-05-20 10:12 ` [PATCH 7/9] dt-bindings: mmc: sprd: Add PHY DLL delay documentation Baolin Wang 2019-05-20 10:12 ` Baolin Wang 2019-05-20 10:12 ` [PATCH 8/9] mmc: sdhci-sprd: Add PHY DLL delay configuration Baolin Wang 2019-05-20 10:12 ` Baolin Wang 2019-06-03 13:01 ` Adrian Hunter 2019-06-03 13:01 ` Adrian Hunter 2019-06-04 2:18 ` Baolin Wang 2019-06-04 2:18 ` Baolin Wang 2019-05-20 10:12 ` [PATCH 9/9] arm64: dts: sprd: Add Spreadtrum SD host controller support Baolin Wang 2019-05-20 10:12 ` Baolin Wang 2019-06-03 8:41 ` [PATCH 0/9] Add SD host controller support for SC9860 platform Baolin Wang 2019-06-03 8:41 ` Baolin Wang 2019-06-04 7:13 ` Ulf Hansson 2019-06-04 7:13 ` Ulf Hansson 2019-06-04 7:21 ` Baolin Wang 2019-06-04 7:21 ` Baolin Wang
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20349e8ebd4c1ec64fb5f8cdd9e094d0c1732855.1558346019.git.baolin.wang@linaro.org \ --to=baolin.wang@linaro.org \ --cc=adrian.hunter@intel.com \ --cc=arm@kernel.org \ --cc=arnd@arndb.de \ --cc=devicetree@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mmc@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=olof@lixom.net \ --cc=orsonzhai@gmail.com \ --cc=robh+dt@kernel.org \ --cc=ulf.hansson@linaro.org \ --cc=vincent.guittot@linaro.org \ --cc=zhang.lyra@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.