summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/sdhci-s3c.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-05-04 13:45:17 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-05-04 13:45:17 -0700
commit173192958d06b8d1eb44f56d74373052ad6a9a60 (patch)
tree838a4f063c994d4d0a6259a85f21005c4098b752 /drivers/mmc/host/sdhci-s3c.c
parente72a5d1ceb1c5cbe39c35c1c7a7f5909cbe8451a (diff)
parente4404fab2e0b70287a471a1e760c9338ce683fde (diff)
Merge tag 'mmc-updates-for-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc
Pull MMC update from Chris Ball: "MMC highlights for 3.10: Core: - Introduce MMC_CAP2_NO_PRESCAN_POWERUP to allow skipping mmc_power_up() at boot/initialization time if it's already happened, for performance (faster boot time) reasons. - Fix a bit width test failure that resulted in old eMMC cards being put into 1-bit mode when 4-bit mode was available. - Expose fwrev/hwrev for MMCv4 parts. - Improve card removal logic in the case where the card's removed slowly; we were missing card removal events if the card retained contact with the slot pads for long enough to reply to a CMD13 while being removed. Drivers: - davinci_mmc: Support using PIO instead of DMA. - dw_mmc: Add support for Exynos4412. - mxcmmc: DT support, use slot-gpio API. - mxs-mmc: Add broken-cd/cd-inverted/non-removable DT property support. - sdhci-sirf: New sdhci-pltfm driver for CSR SiRF SoCs: SiRFprimaII: unicore ARM Cortex-A9 SiRFatlas6: unicore ARM Cortex-A9 SiRFmarco: dual core ARM Cortex-A9 SMP - sdhci-tegra: Add support for Tegra114 platforms, use mmc_of_parse()" * tag 'mmc-updates-for-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (66 commits) mmc: sdhci-tegra: fix MODULE_DEVICE_TABLE mmc: core: fix init controller performance regression, updated patch mmc: mxcmmc: enable DMA support on mpc512x mmc: mxcmmc: constify mxcmci_devtype mmc: mxcmmc: use slot-gpio API for write-protect detection mmc: mxcmmc: add mpc512x SDHC support mmc: mxcmmc: fix race conditions for host->req and host->data access mmc: mxcmmc: DT support mmc: dw_mmc: let device core setup the default pin configuration mmc: mxs-mmc: add broken-cd property mmc: mxs-mmc: add non-removable property mmc: mxs-mmc: add cd-inverted property mmc: core: call pm_runtime_put_noidle in pm_runtime_get_sync failed case mmc: mxcmmc: Fix bug when card is present during boot mmc: core: fix performance regression initializing MMC host controllers Revert "mmc: core: wait while adding MMC host to ensure root mounts successfully" mmc: atmel-mci: pio hang on block errors mmc: core: Fix bit width test failing on old eMMC cards mmc: dw_mmc: Use pr_info instead of printk mmc: dw_mmc: Check return value of regulator_enable ...
Diffstat (limited to 'drivers/mmc/host/sdhci-s3c.c')
-rw-r--r--drivers/mmc/host/sdhci-s3c.c88
1 files changed, 10 insertions, 78 deletions
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index e4f52b5c2592..c6f6246a4933 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -25,7 +25,6 @@
#include <linux/of_gpio.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
-#include <linux/pinctrl/consumer.h>
#include <linux/mmc/host.h>
@@ -44,7 +43,6 @@
* @ioarea: The resource created when we claimed the IO area.
* @pdata: The platform data for this controller.
* @cur_clk: The index of the current bus clock.
- * @gpios: List of gpio numbers parsed from device tree.
* @clk_io: The clock for the internal bus interface.
* @clk_bus: The clocks that are available for the SD/MMC bus clock.
*/
@@ -56,8 +54,6 @@ struct sdhci_s3c {
unsigned int cur_clk;
int ext_cd_irq;
int ext_cd_gpio;
- int *gpios;
- struct pinctrl *pctrl;
struct clk *clk_io;
struct clk *clk_bus[MAX_BUS_CLK];
@@ -446,88 +442,39 @@ static int sdhci_s3c_parse_dt(struct device *dev,
struct device_node *node = dev->of_node;
struct sdhci_s3c *ourhost = to_s3c(host);
u32 max_width;
- int gpio, cnt, ret;
+ int gpio;
/* if the bus-width property is not specified, assume width as 1 */
if (of_property_read_u32(node, "bus-width", &max_width))
max_width = 1;
pdata->max_width = max_width;
- ourhost->gpios = devm_kzalloc(dev, NUM_GPIOS(pdata->max_width) *
- sizeof(int), GFP_KERNEL);
- if (!ourhost->gpios)
- return -ENOMEM;
-
/* get the card detection method */
if (of_get_property(node, "broken-cd", NULL)) {
pdata->cd_type = S3C_SDHCI_CD_NONE;
- goto setup_bus;
+ return 0;
}
if (of_get_property(node, "non-removable", NULL)) {
pdata->cd_type = S3C_SDHCI_CD_PERMANENT;
- goto setup_bus;
+ return 0;
}
gpio = of_get_named_gpio(node, "cd-gpios", 0);
if (gpio_is_valid(gpio)) {
pdata->cd_type = S3C_SDHCI_CD_GPIO;
- goto found_cd;
- } else if (gpio != -ENOENT) {
- dev_err(dev, "invalid card detect gpio specified\n");
- return -EINVAL;
- }
-
- gpio = of_get_named_gpio(node, "samsung,cd-pinmux-gpio", 0);
- if (gpio_is_valid(gpio)) {
- pdata->cd_type = S3C_SDHCI_CD_INTERNAL;
- goto found_cd;
- } else if (gpio != -ENOENT) {
- dev_err(dev, "invalid card detect gpio specified\n");
- return -EINVAL;
- }
-
- /* assuming internal card detect that will be configured by pinctrl */
- pdata->cd_type = S3C_SDHCI_CD_INTERNAL;
- goto setup_bus;
-
- found_cd:
- if (pdata->cd_type == S3C_SDHCI_CD_GPIO) {
pdata->ext_cd_gpio = gpio;
ourhost->ext_cd_gpio = -1;
if (of_get_property(node, "cd-inverted", NULL))
pdata->ext_cd_gpio_invert = 1;
- } else if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
- ret = devm_gpio_request(dev, gpio, "sdhci-cd");
- if (ret) {
- dev_err(dev, "card detect gpio request failed\n");
- return -EINVAL;
- }
- ourhost->ext_cd_gpio = gpio;
- }
-
- setup_bus:
- if (!IS_ERR(ourhost->pctrl))
return 0;
-
- /* get the gpios for command, clock and data lines */
- for (cnt = 0; cnt < NUM_GPIOS(pdata->max_width); cnt++) {
- gpio = of_get_gpio(node, cnt);
- if (!gpio_is_valid(gpio)) {
- dev_err(dev, "invalid gpio[%d]\n", cnt);
- return -EINVAL;
- }
- ourhost->gpios[cnt] = gpio;
- }
-
- for (cnt = 0; cnt < NUM_GPIOS(pdata->max_width); cnt++) {
- ret = devm_gpio_request(dev, ourhost->gpios[cnt], "sdhci-gpio");
- if (ret) {
- dev_err(dev, "gpio[%d] request failed\n", cnt);
- return -EINVAL;
- }
+ } else if (gpio != -ENOENT) {
+ dev_err(dev, "invalid card detect gpio specified\n");
+ return -EINVAL;
}
+ /* assuming internal card detect that will be configured by pinctrl */
+ pdata->cd_type = S3C_SDHCI_CD_INTERNAL;
return 0;
}
#else
@@ -588,8 +535,6 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
goto err_pdata_io_clk;
}
- sc->pctrl = devm_pinctrl_get_select_default(&pdev->dev);
-
if (pdev->dev.of_node) {
ret = sdhci_s3c_parse_dt(&pdev->dev, host, pdata);
if (ret)
@@ -607,7 +552,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, host);
- sc->clk_io = clk_get(dev, "hsmmc");
+ sc->clk_io = devm_clk_get(dev, "hsmmc");
if (IS_ERR(sc->clk_io)) {
dev_err(dev, "failed to get io clock\n");
ret = PTR_ERR(sc->clk_io);
@@ -622,7 +567,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
char name[14];
snprintf(name, 14, "mmc_busclk.%d", ptr);
- clk = clk_get(dev, name);
+ clk = devm_clk_get(dev, name);
if (IS_ERR(clk))
continue;
@@ -763,15 +708,9 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
#ifndef CONFIG_PM_RUNTIME
clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);
#endif
- for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
- if (sc->clk_bus[ptr]) {
- clk_put(sc->clk_bus[ptr]);
- }
- }
err_no_busclks:
clk_disable_unprepare(sc->clk_io);
- clk_put(sc->clk_io);
err_pdata_io_clk:
sdhci_free_host(host);
@@ -784,7 +723,6 @@ static int sdhci_s3c_remove(struct platform_device *pdev)
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_s3c *sc = sdhci_priv(host);
struct s3c_sdhci_platdata *pdata = sc->pdata;
- int ptr;
if (pdata->cd_type == S3C_SDHCI_CD_EXTERNAL && pdata->ext_cd_cleanup)
pdata->ext_cd_cleanup(&sdhci_s3c_notify_change);
@@ -804,13 +742,7 @@ static int sdhci_s3c_remove(struct platform_device *pdev)
#ifndef CONFIG_PM_RUNTIME
clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);
#endif
- for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
- if (sc->clk_bus[ptr]) {
- clk_put(sc->clk_bus[ptr]);
- }
- }
clk_disable_unprepare(sc->clk_io);
- clk_put(sc->clk_io);
sdhci_free_host(host);
platform_set_drvdata(pdev, NULL);