Discussion:
[PATCH 0/3] mmc: sdhci-acpi: Fix Braswell eMMC timeout clock frequency
Adrian Hunter
2014-10-06 12:23:04 UTC
Permalink
Hi

Here are 3 patches that fix Fix Braswell eMMC timeout clock
frequency. A fix has already been done for sdhci-pci, so
please consider these for 3.18 also.


Adrian Hunter (3):
mmc: sdhci-acpi: Get UID directly from acpi_device
mmc: sdhci-acpi: Pass HID and UID to probe_slot
mmc: sdhci-acpi: Fix Braswell eMMC timeout clock frequency

drivers/mmc/host/sdhci-acpi.c | 44 ++++++++++++++++++-------------------------
1 file changed, 18 insertions(+), 26 deletions(-)


Regards
Adrian
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Adrian Hunter
2014-10-06 12:23:06 UTC
Permalink
Pass HID and UID to probe_slot so extra setup
can be done for specific ids.

Signed-off-by: Adrian Hunter <***@intel.com>
---
drivers/mmc/host/sdhci-acpi.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 839f26c..7548261 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -67,7 +67,7 @@ struct sdhci_acpi_slot {
unsigned int caps2;
mmc_pm_flag_t pm_caps;
unsigned int flags;
- int (*probe_slot)(struct platform_device *);
+ int (*probe_slot)(struct platform_device *, const char *, const char *);
int (*remove_slot)(struct platform_device *);
};

@@ -124,7 +124,8 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = {
.ops = &sdhci_acpi_ops_int,
};

-static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev)
+static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev,
+ const char *hid, const char *uid)
{
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
struct sdhci_host *host;
@@ -139,7 +140,8 @@ static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev)
return 0;
}

-static int sdhci_acpi_sdio_probe_slot(struct platform_device *pdev)
+static int sdhci_acpi_sdio_probe_slot(struct platform_device *pdev,
+ const char *hid, const char *uid)
{
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
struct sdhci_host *host;
@@ -154,7 +156,8 @@ static int sdhci_acpi_sdio_probe_slot(struct platform_device *pdev)
return 0;
}

-static int sdhci_acpi_sd_probe_slot(struct platform_device *pdev)
+static int sdhci_acpi_sd_probe_slot(struct platform_device *pdev,
+ const char *hid, const char *uid)
{
struct sdhci_acpi_host *c = platform_get_drvdata(pdev);
struct sdhci_host *host;
@@ -314,7 +317,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)

if (c->slot) {
if (c->slot->probe_slot) {
- err = c->slot->probe_slot(pdev);
+ err = c->slot->probe_slot(pdev, hid, uid);
if (err)
goto err_free;
}
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Adrian Hunter
2014-10-06 12:23:07 UTC
Permalink
Braswell eMMC host controller specifies an incorrect
timeout clock frequncy in the capabilities registers.
The correct value is 1 MHz. A similar fix was done
for sdhci-pci, however in the sdhci-acpi case the
HID/UID is not unique so the capabilities register
values are matched also.

Signed-off-by: Adrian Hunter <***@intel.com>
---
drivers/mmc/host/sdhci-acpi.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 7548261..9cccc0e 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -137,6 +137,11 @@ static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev,

/* Platform specific code during emmc proble slot goes here */

+ if (hid && uid && !strcmp(hid, "80860F14") && !strcmp(uid, "1") &&
+ sdhci_readl(host, SDHCI_CAPABILITIES) == 0x446cc8b2 &&
+ sdhci_readl(host, SDHCI_CAPABILITIES_1) == 0x00000807)
+ host->timeout_clk = 1000; /* 1000 kHz i.e. 1 MHz */
+
return 0;
}
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Adrian Hunter
2014-10-06 12:23:05 UTC
Permalink
UID was made available on acpi_device since
commit ccf78040265b ("ACPI: Add _UID support for ACPI devices.")
Use it from there instead of reprocessing the
ACPI object info.

Signed-off-by: Adrian Hunter <***@intel.com>
---
drivers/mmc/host/sdhci-acpi.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index e9a2c6f..839f26c 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -225,8 +225,8 @@ static const struct acpi_device_id sdhci_acpi_ids[] = {
};
MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids);

-static const struct sdhci_acpi_slot *sdhci_acpi_get_slot_by_ids(const char *hid,
- const char *uid)
+static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(const char *hid,
+ const char *uid)
{
const struct sdhci_acpi_uid_slot *u;

@@ -241,24 +241,6 @@ static const struct sdhci_acpi_slot *sdhci_acpi_get_slot_by_ids(const char *hid,
return NULL;
}

-static const struct sdhci_acpi_slot *sdhci_acpi_get_slot(acpi_handle handle,
- const char *hid)
-{
- const struct sdhci_acpi_slot *slot;
- struct acpi_device_info *info;
- const char *uid = NULL;
- acpi_status status;
-
- status = acpi_get_object_info(handle, &info);
- if (!ACPI_FAILURE(status) && (info->valid & ACPI_VALID_UID))
- uid = info->unique_id.string;
-
- slot = sdhci_acpi_get_slot_by_ids(hid, uid);
-
- kfree(info);
- return slot;
-}
-
static int sdhci_acpi_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -269,6 +251,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
struct resource *iomem;
resource_size_t len;
const char *hid;
+ const char *uid;
int err;

if (acpi_bus_get_device(handle, &device))
@@ -278,6 +261,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
return -ENODEV;

hid = acpi_device_hid(device);
+ uid = device->pnp.unique_id;

iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!iomem)
@@ -296,7 +280,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)

c = sdhci_priv(host);
c->host = host;
- c->slot = sdhci_acpi_get_slot(handle, hid);
+ c->slot = sdhci_acpi_get_slot(hid, uid);
c->pdev = pdev;
c->use_runtime_pm = sdhci_acpi_flag(c, SDHCI_ACPI_RUNTIME_PM);
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ulf Hansson
2014-10-06 13:14:16 UTC
Permalink
Post by Adrian Hunter
Hi
Here are 3 patches that fix Fix Braswell eMMC timeout clock
frequency. A fix has already been done for sdhci-pci, so
please consider these for 3.18 also.
Thanks! Applied for next.

Kind regards
Uffe
Post by Adrian Hunter
mmc: sdhci-acpi: Get UID directly from acpi_device
mmc: sdhci-acpi: Pass HID and UID to probe_slot
mmc: sdhci-acpi: Fix Braswell eMMC timeout clock frequency
drivers/mmc/host/sdhci-acpi.c | 44 ++++++++++++++++++-------------------------
1 file changed, 18 insertions(+), 26 deletions(-)
Regards
Adrian
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...