diff mbox

[v3,5/5] mmc: sdhci-of-arasan: implement enhanced strobe callback

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

Commit Message

Shawn Lin May 10, 2016, 9:10 a.m. UTC
Currently sdhci-arasan 5.1 can support enhanced strobe function,
and we now limit it just for "arasan,sdhci-5.1". Add
mmc-hs400-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>
---

Changes in v3: None
Changes in v2: None

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

Comments

Doug Anderson May 20, 2016, 12:11 a.m. UTC | #1
Hi,

On Tue, May 10, 2016 at 2:10 AM, Shawn Lin <shawn.lin@rock-chips.com> wrote:
> Currently sdhci-arasan 5.1 can support enhanced strobe function,
> and we now limit it just for "arasan,sdhci-5.1". Add
> mmc-hs400-enhanced-strobe in DT to enable the function if we'r sure

nit:s/we'r/we're/

[ ... ]
> @@ -79,6 +81,21 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)
>         }
>  }
>
> +static void sdhci_arasan_hs400_enhanced_strobe(struct mmc_host *mmc,
> +                                       struct mmc_ios *ios)
> +{
> +       u32 vendor;
> +       struct sdhci_host *host = mmc_priv(mmc);
> +
> +       vendor = readl(host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
> +       if (ios->enhanced_strobe)
> +               vendor |= VENDOR_ENHANCED_STROBE;
> +       else
> +               vendor &= (~VENDOR_ENHANCED_STROBE);

nit: no extra parentheses:

  vendor &= ~VENDOR_ENHANCED_STROBE;


Other than the nits this patch looks good to me.  Feel free to add my
Reviewed-by when nits fixed.

-Doug
--
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 May 20, 2016, 1:49 a.m. UTC | #2
Hi

在 2016-5-20 8:11, Doug Anderson 写道:
> Hi,
>
> On Tue, May 10, 2016 at 2:10 AM, Shawn Lin <shawn.lin@rock-chips.com> wrote:
>> Currently sdhci-arasan 5.1 can support enhanced strobe function,
>> and we now limit it just for "arasan,sdhci-5.1". Add
>> mmc-hs400-enhanced-strobe in DT to enable the function if we'r sure
>
> nit:s/we'r/we're/
>
> [ ... ]
>> @@ -79,6 +81,21 @@ static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)
>>          }
>>   }
>>
>> +static void sdhci_arasan_hs400_enhanced_strobe(struct mmc_host *mmc,
>> +                                       struct mmc_ios *ios)
>> +{
>> +       u32 vendor;
>> +       struct sdhci_host *host = mmc_priv(mmc);
>> +
>> +       vendor = readl(host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
>> +       if (ios->enhanced_strobe)
>> +               vendor |= VENDOR_ENHANCED_STROBE;
>> +       else
>> +               vendor &= (~VENDOR_ENHANCED_STROBE);
>
> nit: no extra parentheses:
>
>    vendor &= ~VENDOR_ENHANCED_STROBE;
>
>
> Other than the nits this patch looks good to me.  Feel free to add my
> Reviewed-by when nits fixed.

okay, will fix them.

Thanks for your review!

>
> -Doug
>
>
>

--
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
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index b6f4c1d..8e5cb06 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -25,7 +25,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
@@ -79,6 +81,21 @@  static void sdhci_arasan_set_clock(struct sdhci_host *host, unsigned int clock)
 	}
 }
 
+static void sdhci_arasan_hs400_enhanced_strobe(struct mmc_host *mmc,
+					struct mmc_ios *ios)
+{
+	u32 vendor;
+	struct sdhci_host *host = mmc_priv(mmc);
+
+	vendor = readl(host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
+	if (ios->enhanced_strobe)
+		vendor |= VENDOR_ENHANCED_STROBE;
+	else
+		vendor &= (~VENDOR_ENHANCED_STROBE);
+
+	writel(vendor, host->ioaddr + SDHCI_ARASAN_VENDOR_REGISTER);
+}
+
 static struct sdhci_ops sdhci_arasan_ops = {
 	.set_clock = sdhci_arasan_set_clock,
 	.get_max_clock = sdhci_pltfm_clk_get_max_clock,
@@ -245,6 +262,9 @@  static int sdhci_arasan_probe(struct platform_device *pdev)
 			dev_err(&pdev->dev, "phy_power_on err.\n");
 			goto err_phy_power;
 		}
+
+		host->mmc_host_ops.hs400_enhanced_strobe =
+					sdhci_arasan_hs400_enhanced_strobe;
 	}
 
 	ret = sdhci_add_host(host);