diff mbox

[RFC,4/4] mmc: sdhci-of-arasan: overwrite enhanced strobe callback

Message ID 1456972613-8159-1-git-send-email-shawn.lin@rock-chips.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shawn Lin March 3, 2016, 2:36 a.m. UTC
Currently sdhci-arasan 5.1 can support enhanced strobe function,
but considering the potential requirement in the future for other
version IP, we don't limit it just for "arasan,sdhci-5.1". Add
cap-enhanced-strobe in DT to enable the function if we'r sure our
controller can support it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/mmc/host/sdhci-of-arasan.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Michal Simek March 3, 2016, 11:02 a.m. UTC | #1
On 3.3.2016 03:36, Shawn Lin wrote:
> Currently sdhci-arasan 5.1 can support enhanced strobe function,
> but considering the potential requirement in the future for other
> version IP, we don't limit it just for "arasan,sdhci-5.1". Add
> cap-enhanced-strobe in DT to enable the function if we'r sure our
> controller can support it.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> ---
> 
>  drivers/mmc/host/sdhci-of-arasan.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 1e4b5e0..31f3494 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -24,7 +24,9 @@
>  #include "sdhci-pltfm.h"
>  
>  #define SDHCI_ARASAN_CLK_CTRL_OFFSET	0x2c
> +#define SDHCI_ARASAN_VENDOR_REGISTER	0x78

I was checking our register map and we even don't have this register
listed as reserved.
It looks like that this will be related to certain SoC and different SoC
can use it different location.
That's why I think this feature and setup should be related to certain
SoC specific compatible string.

Thanks,
Michal

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Lin March 3, 2016, 11:37 a.m. UTC | #2
On 2016/3/3 19:02, Michal Simek wrote:
> On 3.3.2016 03:36, Shawn Lin wrote:
>> Currently sdhci-arasan 5.1 can support enhanced strobe function,
>> but considering the potential requirement in the future for other
>> version IP, we don't limit it just for "arasan,sdhci-5.1". Add
>> cap-enhanced-strobe in DT to enable the function if we'r sure our
>> controller can support it.
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>> ---
>>
>>   drivers/mmc/host/sdhci-of-arasan.c | 20 ++++++++++++++++++++
>>   1 file changed, 20 insertions(+)
>>
>> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
>> index 1e4b5e0..31f3494 100644
>> --- a/drivers/mmc/host/sdhci-of-arasan.c
>> +++ b/drivers/mmc/host/sdhci-of-arasan.c
>> @@ -24,7 +24,9 @@
>>   #include "sdhci-pltfm.h"
>>
>>   #define SDHCI_ARASAN_CLK_CTRL_OFFSET	0x2c
>> +#define SDHCI_ARASAN_VENDOR_REGISTER	0x78
>
> I was checking our register map and we even don't have this register
> listed as reserved.
> It looks like that this will be related to certain SoC and different SoC
> can use it different location.
> That's why I think this feature and setup should be related to certain
> SoC specific compatible string.

Hi Michal,

I think that is IP version specific because it's inside controller's
databook. But I only have a datasheet released by arasan for 5.1 
controller, so I didn't know if your databook has this register. And
I can't find sdhci spec has a reg to enable this feature either. Looks
strange, but maybe you are right: it also related to certain Soc for
other sdhci variant drivers. But for sdhci-of-arsan, it more likes to
use this register from now on for the future IP version to enable this
feature inside the controller register-range.

Thanks for checking that. Now, I'm more sure about that we should limit
it for 5.1 currently by checking the compatible string.

I expect more comments from ulf and adrian about the other part of code
until I respin the next version.

>
> Thanks,
> Michal
>
>
>
>
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 1e4b5e0..31f3494 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -24,7 +24,9 @@ 
 #include "sdhci-pltfm.h"
 
 #define SDHCI_ARASAN_CLK_CTRL_OFFSET	0x2c
+#define SDHCI_ARASAN_VENDOR_REGISTER	0x78
 
+#define VENDOR_ENHANCED_STROBE		BIT(0)
 #define CLK_CTRL_TIMEOUT_SHIFT		16
 #define CLK_CTRL_TIMEOUT_MASK		(0xf << CLK_CTRL_TIMEOUT_SHIFT)
 #define CLK_CTRL_TIMEOUT_MIN_EXP	13
@@ -52,6 +54,21 @@  static unsigned int sdhci_arasan_get_timeout_clock(struct sdhci_host *host)
 	return freq;
 }
 
+static int sdhci_arasan_enhanced_strobe(struct sdhci_host *host, bool enable)
+{
+	u32 vendor;
+
+	vendor = readl(host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
+	if (enable)
+		vendor |= VENDOR_ENHANCED_STROBE;
+	else
+		vendor &= (~VENDOR_ENHANCED_STROBE);
+
+	writel(vendor, host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
+
+	return 0;
+}
+
 static struct sdhci_ops sdhci_arasan_ops = {
 	.set_clock = sdhci_set_clock,
 	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
@@ -172,6 +189,9 @@  static int sdhci_arasan_probe(struct platform_device *pdev)
 	sdhci_get_of_property(pdev);
 	pltfm_host->clk = clk_xin;
 
+	host->mmc_host_ops.prepare_enhanced_strobe =
+					sdhci_arasan_enhanced_strobe;
+
 	ret = mmc_of_parse(host->mmc);
 	if (ret) {
 		dev_err(&pdev->dev, "parsing dt failed (%u)\n", ret);