2020-06-19 18:25:31

by Faiz Abbas

[permalink] [raw]
Subject: [PATCH 0/7] Add support for SD card in AM654x-evm

The following patches add driver support for SD card on the
am654x-evm. It only enables high speed mode with UHS mode
support coming in a future series.

DTS support will be added in another series as well.

Faiz Abbas (7):
dt-bindings: mmc: sdhci-am654: Add ti,clkbuf-sel binding
mmc: sdhci_am654: Add flag for PHY calibration
mmc: sdhci_am654: Add Support for SR2.0
mmc: sdhci_am654: Fix conditions for enabling dll
mmc: sdhci_am654: Update delay chain configuration
mmc: sdhci_am654: Add support for clkbuf_sel property
arm64: defconfig: Enable AM654x SDHCI controller

.../devicetree/bindings/mmc/sdhci-am654.txt | 1 +
arch/arm64/configs/defconfig | 1 +
drivers/mmc/host/sdhci_am654.c | 86 ++++++++++++++-----
3 files changed, 65 insertions(+), 23 deletions(-)

--
2.17.1


2020-06-19 18:25:34

by Faiz Abbas

[permalink] [raw]
Subject: [PATCH 4/7] mmc: sdhci_am654: Fix conditions for enabling dll

The clock > CLOCK_TOO_SLOW_HZ condition gating phy configuration
is only required because dll should not be enabled at too low a
clock frequency or too low timing. Make sure that this condition
only gates dll enablement.

Signed-off-by: Faiz Abbas <[email protected]>
---
drivers/mmc/host/sdhci_am654.c | 42 ++++++++++++++++------------------
1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index 365eb2819dd9..8b0f69012d09 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -204,34 +204,32 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)

sdhci_set_clock(host, clock);

- if (clock > CLOCK_TOO_SLOW_HZ) {
- /* Setup DLL Output TAP delay */
- if (sdhci_am654->legacy_otapdly)
- otap_del_sel = sdhci_am654->otap_del_sel[0];
- else
- otap_del_sel = sdhci_am654->otap_del_sel[timing];
+ /* Setup DLL Output TAP delay */
+ if (sdhci_am654->legacy_otapdly)
+ otap_del_sel = sdhci_am654->otap_del_sel[0];
+ else
+ otap_del_sel = sdhci_am654->otap_del_sel[timing];

- otap_del_ena = (timing > MMC_TIMING_UHS_SDR25) ? 1 : 0;
+ otap_del_ena = (timing > MMC_TIMING_UHS_SDR25) ? 1 : 0;

- mask = OTAPDLYENA_MASK | OTAPDLYSEL_MASK;
- val = (otap_del_ena << OTAPDLYENA_SHIFT) |
- (otap_del_sel << OTAPDLYSEL_SHIFT);
+ mask = OTAPDLYENA_MASK | OTAPDLYSEL_MASK;
+ val = (otap_del_ena << OTAPDLYENA_SHIFT) |
+ (otap_del_sel << OTAPDLYSEL_SHIFT);

- /* Write to STRBSEL for HS400 speed mode */
- if (timing == MMC_TIMING_MMC_HS400) {
- if (sdhci_am654->flags & STRBSEL_4_BIT)
- mask |= STRBSEL_4BIT_MASK;
- else
- mask |= STRBSEL_8BIT_MASK;
+ /* Write to STRBSEL for HS400 speed mode */
+ if (timing == MMC_TIMING_MMC_HS400) {
+ if (sdhci_am654->flags & STRBSEL_4_BIT)
+ mask |= STRBSEL_4BIT_MASK;
+ else
+ mask |= STRBSEL_8BIT_MASK;

- val |= sdhci_am654->strb_sel << STRBSEL_SHIFT;
- }
+ val |= sdhci_am654->strb_sel << STRBSEL_SHIFT;
+ }

- regmap_update_bits(sdhci_am654->base, PHY_CTRL4, mask, val);
+ regmap_update_bits(sdhci_am654->base, PHY_CTRL4, mask, val);

- if (timing > MMC_TIMING_UHS_SDR25)
- sdhci_am654_setup_dll(host, clock);
- }
+ if (timing > MMC_TIMING_UHS_SDR25 && clock > CLOCK_TOO_SLOW_HZ)
+ sdhci_am654_setup_dll(host, clock);
}

static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
--
2.17.1

2020-06-19 19:11:32

by Faiz Abbas

[permalink] [raw]
Subject: [PATCH 3/7] mmc: sdhci_am654: Add Support for SR2.0

Add Support for AM65x PG2.0. Use the SoC bus framework to fixup
the driver data and skip do DLL calibration if the revision is 1.0

Signed-off-by: Faiz Abbas <[email protected]>
---
drivers/mmc/host/sdhci_am654.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
index 85a05344f825..365eb2819dd9 100644
--- a/drivers/mmc/host/sdhci_am654.c
+++ b/drivers/mmc/host/sdhci_am654.c
@@ -11,6 +11,7 @@
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regmap.h>
+#include <linux/sys_soc.h>

#include "cqhci.h"
#include "sdhci-pltfm.h"
@@ -324,12 +325,17 @@ static const struct sdhci_pltfm_data sdhci_am654_pdata = {
.quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN,
};

-static const struct sdhci_am654_driver_data sdhci_am654_drvdata = {
+static const struct sdhci_am654_driver_data sdhci_am654_sr1_drvdata = {
.pdata = &sdhci_am654_pdata,
.flags = IOMUX_PRESENT | FREQSEL_2_BIT | STRBSEL_4_BIT | DLL_PRESENT |
DLL_CALIB,
};

+static const struct sdhci_am654_driver_data sdhci_am654_drvdata = {
+ .pdata = &sdhci_am654_pdata,
+ .flags = IOMUX_PRESENT | FREQSEL_2_BIT | STRBSEL_4_BIT | DLL_PRESENT,
+};
+
static struct sdhci_ops sdhci_j721e_8bit_ops = {
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
@@ -376,6 +382,14 @@ static const struct sdhci_am654_driver_data sdhci_j721e_4bit_drvdata = {
.flags = IOMUX_PRESENT,
};

+static const struct soc_device_attribute sdhci_am654_devices[] = {
+ { .family = "AM65X",
+ .revision = "SR1.0",
+ .data = &sdhci_am654_sr1_drvdata
+ },
+ {/* sentinel */}
+};
+
static void sdhci_am654_dumpregs(struct mmc_host *mmc)
{
sdhci_dumpregs(mmc_priv(mmc));
@@ -587,6 +601,7 @@ static const struct of_device_id sdhci_am654_of_match[] = {
static int sdhci_am654_probe(struct platform_device *pdev)
{
const struct sdhci_am654_driver_data *drvdata;
+ const struct soc_device_attribute *soc;
struct sdhci_pltfm_host *pltfm_host;
struct sdhci_am654_data *sdhci_am654;
const struct of_device_id *match;
@@ -598,6 +613,12 @@ static int sdhci_am654_probe(struct platform_device *pdev)

match = of_match_node(sdhci_am654_of_match, pdev->dev.of_node);
drvdata = match->data;
+
+ /* Update drvdata based on SoC revision */
+ soc = soc_device_match(sdhci_am654_devices);
+ if (soc && soc->data)
+ drvdata = soc->data;
+
host = sdhci_pltfm_init(pdev, drvdata->pdata, sizeof(*sdhci_am654));
if (IS_ERR(host))
return PTR_ERR(host);
--
2.17.1

2020-07-03 07:28:33

by Faiz Abbas

[permalink] [raw]
Subject: Re: [PATCH 0/7] Add support for SD card in AM654x-evm

Hi,

On 19/06/20 6:27 pm, Faiz Abbas wrote:
> The following patches add driver support for SD card on the
> am654x-evm. It only enables high speed mode with UHS mode
> support coming in a future series.
>
> DTS support will be added in another series as well.
>
> Faiz Abbas (7):
> dt-bindings: mmc: sdhci-am654: Add ti,clkbuf-sel binding
> mmc: sdhci_am654: Add flag for PHY calibration
> mmc: sdhci_am654: Add Support for SR2.0
> mmc: sdhci_am654: Fix conditions for enabling dll
> mmc: sdhci_am654: Update delay chain configuration
> mmc: sdhci_am654: Add support for clkbuf_sel property
> arm64: defconfig: Enable AM654x SDHCI controller
>
> .../devicetree/bindings/mmc/sdhci-am654.txt | 1 +
> arch/arm64/configs/defconfig | 1 +
> drivers/mmc/host/sdhci_am654.c | 86 ++++++++++++++-----
> 3 files changed, 65 insertions(+), 23 deletions(-)
>

Gentle ping.

Thanks,
Faiz

2020-07-06 14:51:28

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH 0/7] Add support for SD card in AM654x-evm

On Fri, 19 Jun 2020 at 14:58, Faiz Abbas <[email protected]> wrote:
>
> The following patches add driver support for SD card on the
> am654x-evm. It only enables high speed mode with UHS mode
> support coming in a future series.
>
> DTS support will be added in another series as well.
>
> Faiz Abbas (7):
> dt-bindings: mmc: sdhci-am654: Add ti,clkbuf-sel binding
> mmc: sdhci_am654: Add flag for PHY calibration
> mmc: sdhci_am654: Add Support for SR2.0
> mmc: sdhci_am654: Fix conditions for enabling dll
> mmc: sdhci_am654: Update delay chain configuration
> mmc: sdhci_am654: Add support for clkbuf_sel property
> arm64: defconfig: Enable AM654x SDHCI controller
>
> .../devicetree/bindings/mmc/sdhci-am654.txt | 1 +
> arch/arm64/configs/defconfig | 1 +
> drivers/mmc/host/sdhci_am654.c | 86 ++++++++++++++-----
> 3 files changed, 65 insertions(+), 23 deletions(-)
>
> --
> 2.17.1
>

Patch 1 to 6, applied for next, thanks!

Kind regards
Uffe