* [PATCH v2 0/2] mmc: host: sdhci-s3c: Add support for pinctrl interface
@ 2012-11-16 14:28 Tomasz Figa
2012-11-16 14:28 ` [PATCH v2 1/2] mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs Tomasz Figa
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Tomasz Figa @ 2012-11-16 14:28 UTC (permalink / raw)
To: linux-mmc
Cc: linux-samsung-soc, kgene.kim, cjb, ben-linux, kyungmin.park,
m.szyprowski, t.figa, tomasz.figa
This series intends to add support for pin configuration using pin control
interface.
First patch cleans up GPIO requesting and freeing in the driver to simplify
adding pin control support.
Second patch adds pin control support to the driver.
Changes since v1:
- fixed build error because of incorrect merge
Tomasz Figa (2):
mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs
mmc: host: sdhci-s3c: Add support for pinctrl
.../devicetree/bindings/mmc/samsung-sdhci.txt | 20 ++++++---
drivers/mmc/host/sdhci-s3c.c | 52 ++++++++--------------
2 files changed, 32 insertions(+), 40 deletions(-)
--
1.8.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/2] mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs
2012-11-16 14:28 [PATCH v2 0/2] mmc: host: sdhci-s3c: Add support for pinctrl interface Tomasz Figa
@ 2012-11-16 14:28 ` Tomasz Figa
2012-11-21 10:52 ` Thomas Abraham
2012-11-16 14:28 ` [PATCH v2 2/2] mmc: host: sdhci-s3c: Add support for pinctrl Tomasz Figa
2012-11-21 10:40 ` [PATCH v2 0/2] mmc: host: sdhci-s3c: Add support for pinctrl interface Tomasz Figa
2 siblings, 1 reply; 9+ messages in thread
From: Tomasz Figa @ 2012-11-16 14:28 UTC (permalink / raw)
To: linux-mmc
Cc: linux-samsung-soc, kgene.kim, cjb, ben-linux, kyungmin.park,
m.szyprowski, t.figa, tomasz.figa
The set of GPIO pins used by sdhci-s3c driver varies between
configurations, such as card detect method, pinctrl availability, etc.
This overly complicates the code requesting and freeing GPIO pins, which
must check which pins are used, when freeing them.
This patch modifies the sdhci-s3c driver to use devm_gpio_request to
free requested pins automatically after unbinding the driver.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
---
drivers/mmc/host/sdhci-s3c.c | 40 +++++++++-------------------------------
1 file changed, 9 insertions(+), 31 deletions(-)
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 2903949..75f85fd 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -406,7 +406,7 @@ static void sdhci_s3c_setup_card_detect_gpio(struct sdhci_s3c *sc)
struct s3c_sdhci_platdata *pdata = sc->pdata;
struct device *dev = &sc->pdev->dev;
- if (gpio_request(pdata->ext_cd_gpio, "SDHCI EXT CD") == 0) {
+ if (devm_gpio_request(dev, pdata->ext_cd_gpio, "SDHCI EXT CD") == 0) {
sc->ext_cd_gpio = pdata->ext_cd_gpio;
sc->ext_cd_irq = gpio_to_irq(pdata->ext_cd_gpio);
if (sc->ext_cd_irq &&
@@ -487,7 +487,7 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
if (of_get_property(node, "cd-inverted", NULL))
pdata->ext_cd_gpio_invert = 1;
} else if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
- ret = gpio_request(gpio, "sdhci-cd");
+ ret = devm_gpio_request(dev, gpio, "sdhci-cd");
if (ret) {
dev_err(dev, "card detect gpio request failed\n");
return -EINVAL;
@@ -501,28 +501,20 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
gpio = of_get_gpio(node, cnt);
if (!gpio_is_valid(gpio)) {
dev_err(dev, "invalid gpio[%d]\n", cnt);
- goto err_free_dt_cd_gpio;
+ return -EINVAL;
}
ourhost->gpios[cnt] = gpio;
}
for (cnt = 0; cnt < NUM_GPIOS(pdata->max_width); cnt++) {
- ret = gpio_request(ourhost->gpios[cnt], "sdhci-gpio");
+ ret = devm_gpio_request(dev, ourhost->gpios[cnt], "sdhci-gpio");
if (ret) {
dev_err(dev, "gpio[%d] request failed\n", cnt);
- goto err_free_dt_gpios;
+ return -EINVAL;
}
}
return 0;
-
- err_free_dt_gpios:
- while (--cnt >= 0)
- gpio_free(ourhost->gpios[cnt]);
- err_free_dt_cd_gpio:
- if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL)
- gpio_free(ourhost->ext_cd_gpio);
- return -EINVAL;
}
#else
static int __devinit sdhci_s3c_parse_dt(struct device *dev,
@@ -579,13 +571,13 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) {
ret = -ENOMEM;
- goto err_pdata;
+ goto err_pdata_io_clk;
}
if (pdev->dev.of_node) {
ret = sdhci_s3c_parse_dt(&pdev->dev, host, pdata);
if (ret)
- goto err_pdata;
+ goto err_pdata_io_clk;
} else {
memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata));
sc->ext_cd_gpio = -1; /* invalid gpio number */
@@ -603,7 +595,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
if (IS_ERR(sc->clk_io)) {
dev_err(dev, "failed to get io clock\n");
ret = PTR_ERR(sc->clk_io);
- goto err_io_clk;
+ goto err_pdata_io_clk;
}
/* enable the local io clock and keep it running for the moment. */
@@ -765,13 +757,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
clk_disable(sc->clk_io);
clk_put(sc->clk_io);
- err_io_clk:
- for (ptr = 0; ptr < NUM_GPIOS(sc->pdata->max_width); ptr++)
- gpio_free(sc->gpios[ptr]);
- if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL)
- gpio_free(sc->ext_cd_gpio);
-
- err_pdata:
+ err_pdata_io_clk:
sdhci_free_host(host);
return ret;
@@ -790,9 +776,6 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
if (sc->ext_cd_irq)
free_irq(sc->ext_cd_irq, sc);
- if (gpio_is_valid(sc->ext_cd_gpio))
- gpio_free(sc->ext_cd_gpio);
-
#ifdef CONFIG_PM_RUNTIME
clk_enable(sc->clk_io);
#endif
@@ -812,11 +795,6 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
clk_disable(sc->clk_io);
clk_put(sc->clk_io);
- if (pdev->dev.of_node) {
- for (ptr = 0; ptr < NUM_GPIOS(sc->pdata->max_width); ptr++)
- gpio_free(sc->gpios[ptr]);
- }
-
sdhci_free_host(host);
platform_set_drvdata(pdev, NULL);
--
1.8.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/2] mmc: host: sdhci-s3c: Add support for pinctrl
2012-11-16 14:28 [PATCH v2 0/2] mmc: host: sdhci-s3c: Add support for pinctrl interface Tomasz Figa
2012-11-16 14:28 ` [PATCH v2 1/2] mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs Tomasz Figa
@ 2012-11-16 14:28 ` Tomasz Figa
2012-11-21 10:58 ` Thomas Abraham
2012-11-21 10:40 ` [PATCH v2 0/2] mmc: host: sdhci-s3c: Add support for pinctrl interface Tomasz Figa
2 siblings, 1 reply; 9+ messages in thread
From: Tomasz Figa @ 2012-11-16 14:28 UTC (permalink / raw)
To: linux-mmc
Cc: linux-samsung-soc, kgene.kim, cjb, ben-linux, kyungmin.park,
m.szyprowski, t.figa, tomasz.figa
This patch adds support for pin configuration using pinctrl subsystem
to the sdhci-s3c driver.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
---
.../devicetree/bindings/mmc/samsung-sdhci.txt | 20 +++++++++++++-------
drivers/mmc/host/sdhci-s3c.c | 12 ++++++++++--
2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
index 630a7d7..97e9e31 100644
--- a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
+++ b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
@@ -12,10 +12,6 @@ is used. The Samsung's SDHCI controller bindings extends this as listed below.
[A] The property "samsung,cd-pinmux-gpio" can be used as stated in the
"Optional Board Specific Properties" section below.
-[B] If core card-detect bindings and "samsung,cd-pinmux-gpio" property
- is not specified, it is assumed that there is no card detection
- mechanism used.
-
Required SoC Specific Properties:
- compatible: should be one of the following
- "samsung,s3c6410-sdhci": For controllers compatible with s3c6410 sdhci
@@ -24,14 +20,18 @@ Required SoC Specific Properties:
controller.
Required Board Specific Properties:
-- gpios: Should specify the gpios used for clock, command and data lines. The
- gpio specifier format depends on the gpio controller.
+- Samsung GPIO variant (will be completely replaced by pinctrl):
+ - gpios: Should specify the gpios used for clock, command and data lines. The
+ gpio specifier format depends on the gpio controller.
+- Pinctrl variant (preferred if available):
+ - pinctrl-0: Should specify pin control groups used for this controller.
+ - pinctrl-names: Should contain only one value - "default".
Optional Board Specific Properties:
- samsung,cd-pinmux-gpio: Specifies the card detect line that is routed
through a pinmux to the card-detect pin of the card slot. This property
should be used only if none of the mmc core card-detect properties are
- used.
+ used. Only for Samsung GPIO variant.
Example:
sdhci@12530000 {
@@ -40,12 +40,18 @@ Example:
interrupts = <0 75 0>;
bus-width = <4>;
cd-gpios = <&gpk2 2 2 3 3>;
+
+ /* Samsung GPIO variant */
gpios = <&gpk2 0 2 0 3>, /* clock line */
<&gpk2 1 2 0 3>, /* command line */
<&gpk2 3 2 3 3>, /* data line 0 */
<&gpk2 4 2 3 3>, /* data line 1 */
<&gpk2 5 2 3 3>, /* data line 2 */
<&gpk2 6 2 3 3>; /* data line 3 */
+
+ /* Pinctrl variant */
+ pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4>;
+ pinctrl-names = "default";
};
Note: This example shows both SoC specific and board specific properties
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 75f85fd..6161162 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -24,6 +24,7 @@
#include <linux/of_gpio.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
+#include <linux/pinctrl/consumer.h>
#include <linux/mmc/host.h>
@@ -57,6 +58,7 @@ struct sdhci_s3c {
int ext_cd_irq;
int ext_cd_gpio;
int *gpios;
+ struct pinctrl *pctrl;
struct clk *clk_io;
struct clk *clk_bus[MAX_BUS_CLK];
@@ -477,8 +479,9 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
return -EINVAL;
}
- dev_info(dev, "assuming no card detect line available\n");
- pdata->cd_type = S3C_SDHCI_CD_NONE;
+ /* 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) {
@@ -496,6 +499,9 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
}
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);
@@ -574,6 +580,8 @@ static int __devinit 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)
--
1.8.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 0/2] mmc: host: sdhci-s3c: Add support for pinctrl interface
2012-11-16 14:28 [PATCH v2 0/2] mmc: host: sdhci-s3c: Add support for pinctrl interface Tomasz Figa
2012-11-16 14:28 ` [PATCH v2 1/2] mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs Tomasz Figa
2012-11-16 14:28 ` [PATCH v2 2/2] mmc: host: sdhci-s3c: Add support for pinctrl Tomasz Figa
@ 2012-11-21 10:40 ` Tomasz Figa
2 siblings, 0 replies; 9+ messages in thread
From: Tomasz Figa @ 2012-11-21 10:40 UTC (permalink / raw)
To: linux-mmc
Cc: linux-samsung-soc, kgene.kim, cjb, ben-linux, kyungmin.park,
m.szyprowski, tomasz.figa
Hi,
On Friday 16 of November 2012 15:28:15 Tomasz Figa wrote:
> This series intends to add support for pin configuration using pin
> control interface.
>
> First patch cleans up GPIO requesting and freeing in the driver to
> simplify adding pin control support.
>
> Second patch adds pin control support to the driver.
>
> Changes since v1:
> - fixed build error because of incorrect merge
>
> Tomasz Figa (2):
> mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs
> mmc: host: sdhci-s3c: Add support for pinctrl
>
> .../devicetree/bindings/mmc/samsung-sdhci.txt | 20 ++++++---
> drivers/mmc/host/sdhci-s3c.c | 52
> ++++++++-------------- 2 files changed, 32 insertions(+), 40
> deletions(-)
I know it's less than a week since I posted this series, but time is
running out, while it would be nice to get this included in 3.8, because
it's required for all Exynos4 boards using MMC.
Best regards,
--
Tomasz Figa
Samsung Poland R&D Center
SW Solution Development, Linux Platform
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/2] mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs
2012-11-16 14:28 ` [PATCH v2 1/2] mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs Tomasz Figa
@ 2012-11-21 10:52 ` Thomas Abraham
0 siblings, 0 replies; 9+ messages in thread
From: Thomas Abraham @ 2012-11-21 10:52 UTC (permalink / raw)
To: Tomasz Figa
Cc: linux-mmc, linux-samsung-soc, kgene.kim, cjb, ben-linux,
kyungmin.park, m.szyprowski, tomasz.figa
On 16 November 2012 19:58, Tomasz Figa <t.figa@samsung.com> wrote:
> The set of GPIO pins used by sdhci-s3c driver varies between
> configurations, such as card detect method, pinctrl availability, etc.
> This overly complicates the code requesting and freeing GPIO pins, which
> must check which pins are used, when freeing them.
>
> This patch modifies the sdhci-s3c driver to use devm_gpio_request to
> free requested pins automatically after unbinding the driver.
>
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> ---
> drivers/mmc/host/sdhci-s3c.c | 40 +++++++++-------------------------------
> 1 file changed, 9 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 2903949..75f85fd 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -406,7 +406,7 @@ static void sdhci_s3c_setup_card_detect_gpio(struct sdhci_s3c *sc)
> struct s3c_sdhci_platdata *pdata = sc->pdata;
> struct device *dev = &sc->pdev->dev;
>
> - if (gpio_request(pdata->ext_cd_gpio, "SDHCI EXT CD") == 0) {
> + if (devm_gpio_request(dev, pdata->ext_cd_gpio, "SDHCI EXT CD") == 0) {
> sc->ext_cd_gpio = pdata->ext_cd_gpio;
> sc->ext_cd_irq = gpio_to_irq(pdata->ext_cd_gpio);
> if (sc->ext_cd_irq &&
> @@ -487,7 +487,7 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
> if (of_get_property(node, "cd-inverted", NULL))
> pdata->ext_cd_gpio_invert = 1;
> } else if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
> - ret = gpio_request(gpio, "sdhci-cd");
> + ret = devm_gpio_request(dev, gpio, "sdhci-cd");
> if (ret) {
> dev_err(dev, "card detect gpio request failed\n");
> return -EINVAL;
> @@ -501,28 +501,20 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
> gpio = of_get_gpio(node, cnt);
> if (!gpio_is_valid(gpio)) {
> dev_err(dev, "invalid gpio[%d]\n", cnt);
> - goto err_free_dt_cd_gpio;
> + return -EINVAL;
> }
> ourhost->gpios[cnt] = gpio;
> }
>
> for (cnt = 0; cnt < NUM_GPIOS(pdata->max_width); cnt++) {
> - ret = gpio_request(ourhost->gpios[cnt], "sdhci-gpio");
> + ret = devm_gpio_request(dev, ourhost->gpios[cnt], "sdhci-gpio");
> if (ret) {
> dev_err(dev, "gpio[%d] request failed\n", cnt);
> - goto err_free_dt_gpios;
> + return -EINVAL;
> }
> }
>
> return 0;
> -
> - err_free_dt_gpios:
> - while (--cnt >= 0)
> - gpio_free(ourhost->gpios[cnt]);
> - err_free_dt_cd_gpio:
> - if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL)
> - gpio_free(ourhost->ext_cd_gpio);
> - return -EINVAL;
> }
> #else
> static int __devinit sdhci_s3c_parse_dt(struct device *dev,
> @@ -579,13 +571,13 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
> pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> if (!pdata) {
> ret = -ENOMEM;
> - goto err_pdata;
> + goto err_pdata_io_clk;
> }
>
> if (pdev->dev.of_node) {
> ret = sdhci_s3c_parse_dt(&pdev->dev, host, pdata);
> if (ret)
> - goto err_pdata;
> + goto err_pdata_io_clk;
> } else {
> memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata));
> sc->ext_cd_gpio = -1; /* invalid gpio number */
> @@ -603,7 +595,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
> if (IS_ERR(sc->clk_io)) {
> dev_err(dev, "failed to get io clock\n");
> ret = PTR_ERR(sc->clk_io);
> - goto err_io_clk;
> + goto err_pdata_io_clk;
> }
>
> /* enable the local io clock and keep it running for the moment. */
> @@ -765,13 +757,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev)
> clk_disable(sc->clk_io);
> clk_put(sc->clk_io);
>
> - err_io_clk:
> - for (ptr = 0; ptr < NUM_GPIOS(sc->pdata->max_width); ptr++)
> - gpio_free(sc->gpios[ptr]);
> - if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL)
> - gpio_free(sc->ext_cd_gpio);
> -
> - err_pdata:
> + err_pdata_io_clk:
> sdhci_free_host(host);
>
> return ret;
> @@ -790,9 +776,6 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
> if (sc->ext_cd_irq)
> free_irq(sc->ext_cd_irq, sc);
>
> - if (gpio_is_valid(sc->ext_cd_gpio))
> - gpio_free(sc->ext_cd_gpio);
> -
> #ifdef CONFIG_PM_RUNTIME
> clk_enable(sc->clk_io);
> #endif
> @@ -812,11 +795,6 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev)
> clk_disable(sc->clk_io);
> clk_put(sc->clk_io);
>
> - if (pdev->dev.of_node) {
> - for (ptr = 0; ptr < NUM_GPIOS(sc->pdata->max_width); ptr++)
> - gpio_free(sc->gpios[ptr]);
> - }
> -
> sdhci_free_host(host);
> platform_set_drvdata(pdev, NULL);
>
> --
> 1.8.0
Acked-by: Thomas Abraham <thomas.abraham@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] mmc: host: sdhci-s3c: Add support for pinctrl
2012-11-16 14:28 ` [PATCH v2 2/2] mmc: host: sdhci-s3c: Add support for pinctrl Tomasz Figa
@ 2012-11-21 10:58 ` Thomas Abraham
2012-11-25 19:22 ` Chris Ball
0 siblings, 1 reply; 9+ messages in thread
From: Thomas Abraham @ 2012-11-21 10:58 UTC (permalink / raw)
To: Tomasz Figa
Cc: linux-mmc, linux-samsung-soc, kgene.kim, cjb, ben-linux,
kyungmin.park, m.szyprowski, tomasz.figa
On 16 November 2012 19:58, Tomasz Figa <t.figa@samsung.com> wrote:
> This patch adds support for pin configuration using pinctrl subsystem
> to the sdhci-s3c driver.
>
> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
> ---
> .../devicetree/bindings/mmc/samsung-sdhci.txt | 20 +++++++++++++-------
> drivers/mmc/host/sdhci-s3c.c | 12 ++++++++++--
> 2 files changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
> index 630a7d7..97e9e31 100644
> --- a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
> +++ b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
> @@ -12,10 +12,6 @@ is used. The Samsung's SDHCI controller bindings extends this as listed below.
> [A] The property "samsung,cd-pinmux-gpio" can be used as stated in the
> "Optional Board Specific Properties" section below.
>
> -[B] If core card-detect bindings and "samsung,cd-pinmux-gpio" property
> - is not specified, it is assumed that there is no card detection
> - mechanism used.
> -
> Required SoC Specific Properties:
> - compatible: should be one of the following
> - "samsung,s3c6410-sdhci": For controllers compatible with s3c6410 sdhci
> @@ -24,14 +20,18 @@ Required SoC Specific Properties:
> controller.
>
> Required Board Specific Properties:
> -- gpios: Should specify the gpios used for clock, command and data lines. The
> - gpio specifier format depends on the gpio controller.
> +- Samsung GPIO variant (will be completely replaced by pinctrl):
> + - gpios: Should specify the gpios used for clock, command and data lines. The
> + gpio specifier format depends on the gpio controller.
> +- Pinctrl variant (preferred if available):
> + - pinctrl-0: Should specify pin control groups used for this controller.
> + - pinctrl-names: Should contain only one value - "default".
>
> Optional Board Specific Properties:
> - samsung,cd-pinmux-gpio: Specifies the card detect line that is routed
> through a pinmux to the card-detect pin of the card slot. This property
> should be used only if none of the mmc core card-detect properties are
> - used.
> + used. Only for Samsung GPIO variant.
>
> Example:
> sdhci@12530000 {
> @@ -40,12 +40,18 @@ Example:
> interrupts = <0 75 0>;
> bus-width = <4>;
> cd-gpios = <&gpk2 2 2 3 3>;
> +
> + /* Samsung GPIO variant */
> gpios = <&gpk2 0 2 0 3>, /* clock line */
> <&gpk2 1 2 0 3>, /* command line */
> <&gpk2 3 2 3 3>, /* data line 0 */
> <&gpk2 4 2 3 3>, /* data line 1 */
> <&gpk2 5 2 3 3>, /* data line 2 */
> <&gpk2 6 2 3 3>; /* data line 3 */
> +
> + /* Pinctrl variant */
> + pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_bus4>;
> + pinctrl-names = "default";
> };
nit: there could have been one example each for gpio and pinctrl
variant instead of putting both into one example node.
>
> Note: This example shows both SoC specific and board specific properties
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 75f85fd..6161162 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -24,6 +24,7 @@
> #include <linux/of_gpio.h>
> #include <linux/pm.h>
> #include <linux/pm_runtime.h>
> +#include <linux/pinctrl/consumer.h>
>
> #include <linux/mmc/host.h>
>
> @@ -57,6 +58,7 @@ struct sdhci_s3c {
> int ext_cd_irq;
> int ext_cd_gpio;
> int *gpios;
> + struct pinctrl *pctrl;
>
> struct clk *clk_io;
> struct clk *clk_bus[MAX_BUS_CLK];
> @@ -477,8 +479,9 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
> return -EINVAL;
> }
>
> - dev_info(dev, "assuming no card detect line available\n");
> - pdata->cd_type = S3C_SDHCI_CD_NONE;
> + /* 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) {
> @@ -496,6 +499,9 @@ static int __devinit sdhci_s3c_parse_dt(struct device *dev,
> }
>
> 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);
> @@ -574,6 +580,8 @@ static int __devinit 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)
> --
> 1.8.0
Acked-by: Thomas Abraham <thomas.abraham@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] mmc: host: sdhci-s3c: Add support for pinctrl
2012-11-21 10:58 ` Thomas Abraham
@ 2012-11-25 19:22 ` Chris Ball
2012-11-25 19:37 ` Tomasz Figa
0 siblings, 1 reply; 9+ messages in thread
From: Chris Ball @ 2012-11-25 19:22 UTC (permalink / raw)
To: Thomas Abraham
Cc: Tomasz Figa, linux-mmc, linux-samsung-soc, kgene.kim, ben-linux,
kyungmin.park, m.szyprowski, tomasz.figa
Hi,
On Wed, Nov 21 2012, Thomas Abraham wrote:
> nit: there could have been one example each for gpio and pinctrl
> variant instead of putting both into one example node.
Tomasz, do you want to reply to this review comment?
Thanks,
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] mmc: host: sdhci-s3c: Add support for pinctrl
2012-11-25 19:22 ` Chris Ball
@ 2012-11-25 19:37 ` Tomasz Figa
2012-11-25 20:01 ` Chris Ball
0 siblings, 1 reply; 9+ messages in thread
From: Tomasz Figa @ 2012-11-25 19:37 UTC (permalink / raw)
To: Chris Ball
Cc: Thomas Abraham, Tomasz Figa, linux-mmc, linux-samsung-soc,
kgene.kim, ben-linux, kyungmin.park, m.szyprowski
Hi Chris,
On Sunday 25 of November 2012 14:22:44 Chris Ball wrote:
> Hi,
>
> On Wed, Nov 21 2012, Thomas Abraham wrote:
> > nit: there could have been one example each for gpio and pinctrl
> > variant instead of putting both into one example node.
>
> Tomasz, do you want to reply to this review comment?
Well, since Thomas already gave his Acked-by for this patch and the
comment was only about a minor thing in the documentation, I considered it
a thing that could be adjusted with further patch if needed.
If you will be still taking patches for 3.8 tomorrow, then I'm fine with
preparing new version with this comment addressed.
Best regards,
Tomasz Figa
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 2/2] mmc: host: sdhci-s3c: Add support for pinctrl
2012-11-25 19:37 ` Tomasz Figa
@ 2012-11-25 20:01 ` Chris Ball
0 siblings, 0 replies; 9+ messages in thread
From: Chris Ball @ 2012-11-25 20:01 UTC (permalink / raw)
To: Tomasz Figa
Cc: Thomas Abraham, Tomasz Figa, linux-mmc, linux-samsung-soc,
kgene.kim, ben-linux, kyungmin.park, m.szyprowski
Hi,
On Sun, Nov 25 2012, Tomasz Figa wrote:
> Hi Chris,
>
> On Sunday 25 of November 2012 14:22:44 Chris Ball wrote:
>> Hi,
>>
>> On Wed, Nov 21 2012, Thomas Abraham wrote:
>> > nit: there could have been one example each for gpio and pinctrl
>> > variant instead of putting both into one example node.
>>
>> Tomasz, do you want to reply to this review comment?
>
> Well, since Thomas already gave his Acked-by for this patch and the
> comment was only about a minor thing in the documentation, I considered it
> a thing that could be adjusted with further patch if needed.
Okay, that's reasonable -- I'll take it as-is for now. Thanks,
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-11-25 20:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-16 14:28 [PATCH v2 0/2] mmc: host: sdhci-s3c: Add support for pinctrl interface Tomasz Figa
2012-11-16 14:28 ` [PATCH v2 1/2] mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs Tomasz Figa
2012-11-21 10:52 ` Thomas Abraham
2012-11-16 14:28 ` [PATCH v2 2/2] mmc: host: sdhci-s3c: Add support for pinctrl Tomasz Figa
2012-11-21 10:58 ` Thomas Abraham
2012-11-25 19:22 ` Chris Ball
2012-11-25 19:37 ` Tomasz Figa
2012-11-25 20:01 ` Chris Ball
2012-11-21 10:40 ` [PATCH v2 0/2] mmc: host: sdhci-s3c: Add support for pinctrl interface Tomasz Figa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox