mmc: sdhci-iproc: Add ACPI support
Add ACPI support to all IPROC SDHCI variants. Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Reviewed-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
8199d312da
commit
7c7ba4334e
|
@ -345,6 +345,7 @@ config MMC_SDHCI_IPROC
|
||||||
tristate "SDHCI support for the BCM2835 & iProc SD/MMC Controller"
|
tristate "SDHCI support for the BCM2835 & iProc SD/MMC Controller"
|
||||||
depends on ARCH_BCM2835 || ARCH_BCM_IPROC || COMPILE_TEST
|
depends on ARCH_BCM2835 || ARCH_BCM_IPROC || COMPILE_TEST
|
||||||
depends on MMC_SDHCI_PLTFM
|
depends on MMC_SDHCI_PLTFM
|
||||||
|
depends on OF || ACPI
|
||||||
default ARCH_BCM_IPROC
|
default ARCH_BCM_IPROC
|
||||||
select MMC_SDHCI_IO_ACCESSORS
|
select MMC_SDHCI_IO_ACCESSORS
|
||||||
help
|
help
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
* iProc SDHCI platform driver
|
* iProc SDHCI platform driver
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/acpi.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/mmc/host.h>
|
#include <linux/mmc/host.h>
|
||||||
|
@ -162,9 +163,19 @@ static void sdhci_iproc_writeb(struct sdhci_host *host, u8 val, int reg)
|
||||||
sdhci_iproc_writel(host, newval, reg & ~3);
|
sdhci_iproc_writel(host, newval, reg & ~3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static unsigned int sdhci_iproc_get_max_clock(struct sdhci_host *host)
|
||||||
|
{
|
||||||
|
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
|
||||||
|
|
||||||
|
if (pltfm_host->clk)
|
||||||
|
return sdhci_pltfm_clk_get_max_clock(host);
|
||||||
|
else
|
||||||
|
return pltfm_host->clock;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct sdhci_ops sdhci_iproc_ops = {
|
static const struct sdhci_ops sdhci_iproc_ops = {
|
||||||
.set_clock = sdhci_set_clock,
|
.set_clock = sdhci_set_clock,
|
||||||
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
|
.get_max_clock = sdhci_iproc_get_max_clock,
|
||||||
.set_bus_width = sdhci_set_bus_width,
|
.set_bus_width = sdhci_set_bus_width,
|
||||||
.reset = sdhci_reset,
|
.reset = sdhci_reset,
|
||||||
.set_uhs_signaling = sdhci_set_uhs_signaling,
|
.set_uhs_signaling = sdhci_set_uhs_signaling,
|
||||||
|
@ -178,7 +189,7 @@ static const struct sdhci_ops sdhci_iproc_32only_ops = {
|
||||||
.write_w = sdhci_iproc_writew,
|
.write_w = sdhci_iproc_writew,
|
||||||
.write_b = sdhci_iproc_writeb,
|
.write_b = sdhci_iproc_writeb,
|
||||||
.set_clock = sdhci_set_clock,
|
.set_clock = sdhci_set_clock,
|
||||||
.get_max_clock = sdhci_pltfm_clk_get_max_clock,
|
.get_max_clock = sdhci_iproc_get_max_clock,
|
||||||
.set_bus_width = sdhci_set_bus_width,
|
.set_bus_width = sdhci_set_bus_width,
|
||||||
.reset = sdhci_reset,
|
.reset = sdhci_reset,
|
||||||
.set_uhs_signaling = sdhci_set_uhs_signaling,
|
.set_uhs_signaling = sdhci_set_uhs_signaling,
|
||||||
|
@ -256,19 +267,25 @@ static const struct of_device_id sdhci_iproc_of_match[] = {
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
|
MODULE_DEVICE_TABLE(of, sdhci_iproc_of_match);
|
||||||
|
|
||||||
|
static const struct acpi_device_id sdhci_iproc_acpi_ids[] = {
|
||||||
|
{ .id = "BRCM5871", .driver_data = (kernel_ulong_t)&iproc_cygnus_data },
|
||||||
|
{ .id = "BRCM5872", .driver_data = (kernel_ulong_t)&iproc_data },
|
||||||
|
{ /* sentinel */ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(acpi, sdhci_iproc_acpi_ids);
|
||||||
|
|
||||||
static int sdhci_iproc_probe(struct platform_device *pdev)
|
static int sdhci_iproc_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct of_device_id *match;
|
struct device *dev = &pdev->dev;
|
||||||
const struct sdhci_iproc_data *iproc_data;
|
const struct sdhci_iproc_data *iproc_data = NULL;
|
||||||
struct sdhci_host *host;
|
struct sdhci_host *host;
|
||||||
struct sdhci_iproc_host *iproc_host;
|
struct sdhci_iproc_host *iproc_host;
|
||||||
struct sdhci_pltfm_host *pltfm_host;
|
struct sdhci_pltfm_host *pltfm_host;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
match = of_match_device(sdhci_iproc_of_match, &pdev->dev);
|
iproc_data = device_get_match_data(dev);
|
||||||
if (!match)
|
if (!iproc_data)
|
||||||
return -EINVAL;
|
return -ENODEV;
|
||||||
iproc_data = match->data;
|
|
||||||
|
|
||||||
host = sdhci_pltfm_init(pdev, iproc_data->pdata, sizeof(*iproc_host));
|
host = sdhci_pltfm_init(pdev, iproc_data->pdata, sizeof(*iproc_host));
|
||||||
if (IS_ERR(host))
|
if (IS_ERR(host))
|
||||||
|
@ -280,19 +297,21 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
|
||||||
iproc_host->data = iproc_data;
|
iproc_host->data = iproc_data;
|
||||||
|
|
||||||
mmc_of_parse(host->mmc);
|
mmc_of_parse(host->mmc);
|
||||||
sdhci_get_of_property(pdev);
|
sdhci_get_property(pdev);
|
||||||
|
|
||||||
host->mmc->caps |= iproc_host->data->mmc_caps;
|
host->mmc->caps |= iproc_host->data->mmc_caps;
|
||||||
|
|
||||||
pltfm_host->clk = devm_clk_get(&pdev->dev, NULL);
|
if (dev->of_node) {
|
||||||
if (IS_ERR(pltfm_host->clk)) {
|
pltfm_host->clk = devm_clk_get(dev, NULL);
|
||||||
ret = PTR_ERR(pltfm_host->clk);
|
if (IS_ERR(pltfm_host->clk)) {
|
||||||
goto err;
|
ret = PTR_ERR(pltfm_host->clk);
|
||||||
}
|
goto err;
|
||||||
ret = clk_prepare_enable(pltfm_host->clk);
|
}
|
||||||
if (ret) {
|
ret = clk_prepare_enable(pltfm_host->clk);
|
||||||
dev_err(&pdev->dev, "failed to enable host clk\n");
|
if (ret) {
|
||||||
goto err;
|
dev_err(dev, "failed to enable host clk\n");
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iproc_host->data->pdata->quirks & SDHCI_QUIRK_MISSING_CAPS) {
|
if (iproc_host->data->pdata->quirks & SDHCI_QUIRK_MISSING_CAPS) {
|
||||||
|
@ -307,7 +326,8 @@ static int sdhci_iproc_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_clk:
|
err_clk:
|
||||||
clk_disable_unprepare(pltfm_host->clk);
|
if (dev->of_node)
|
||||||
|
clk_disable_unprepare(pltfm_host->clk);
|
||||||
err:
|
err:
|
||||||
sdhci_pltfm_free(pdev);
|
sdhci_pltfm_free(pdev);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -317,6 +337,7 @@ static struct platform_driver sdhci_iproc_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "sdhci-iproc",
|
.name = "sdhci-iproc",
|
||||||
.of_match_table = sdhci_iproc_of_match,
|
.of_match_table = sdhci_iproc_of_match,
|
||||||
|
.acpi_match_table = ACPI_PTR(sdhci_iproc_acpi_ids),
|
||||||
.pm = &sdhci_pltfm_pmops,
|
.pm = &sdhci_pltfm_pmops,
|
||||||
},
|
},
|
||||||
.probe = sdhci_iproc_probe,
|
.probe = sdhci_iproc_probe,
|
||||||
|
|
Loading…
Reference in a new issue