* [PATCH 1/2] sdhci/tegra: Add Device Tree probing support
@ 2011-08-23 18:15 Stephen Warren
2011-08-23 18:41 ` Chris Ball
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Stephen Warren @ 2011-08-23 18:15 UTC (permalink / raw)
To: Chris Ball
Cc: Olof Johansson, Shawn Guo, linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Grant Likely, Stephen Warren
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Add hooks to read gpio configuration out of the device tree node.
[grant.likely: Rewrite of original patch from John Bonesio]
Signed-off-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
[swarren: Fixed tegra_sdhci_get_ro() to retrieve pdata correctly]
[swarren: Reworked to avoid #ifdef CONFIG_OF]
[swarren: Reworked binding based on fsl-imx-esdhc.txt]
[swarren: Documented binding]
Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
Theoretically, these two patches should be merged in order in one place,
since the 2nd logically depends on the first. However, it's really just
a documentation dependency, so I think it's fine to merge them into the
MMC and DT trees separately and let them meet in linux-next.
.../devicetree/bindings/mmc/nvidia-sdhci.txt | 25 ++++++++++
drivers/mmc/host/sdhci-tegra.c | 51 +++++++++++++++----
2 files changed, 65 insertions(+), 11 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
diff --git a/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
new file mode 100644
index 0000000..c87f667
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
@@ -0,0 +1,25 @@
+* NVIDIA Tegra Secure Digital Host Controller
+
+This controller on Tegra family SoCs provides an interface for MMC, SD,
+and SDIO types of memory cards.
+
+Required properties:
+- compatible : Should be "nvidia,<chip>-sdhci"
+- reg : Should contain eSDHC registers location and length
+- interrupts : Should contain eSDHC interrupt
+
+Optional properties:
+- cd-gpios : Specify GPIOs for card detection
+- wp-gpios : Specify GPIOs for write protection
+- power-gpios : Specify GPIOs for power control
+
+Example:
+
+sdhci@c8000200 {
+ compatible = "nvidia,tegra20-sdhci";
+ reg = <0xc8000200 0x200>;
+ interrupts = <47>;
+ cd-gpios = <&gpio 69 0>; /* gpio PI5 */
+ wp-gpios = <&gpio 57 0>; /* gpio PH1 */
+ power-gpios = <&gpio 155 0>; /* gpio PT3 */
+};
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index a5a9a97..9ab18d6 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -17,6 +17,7 @@
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/io.h>
+#include <linux/of_gpio.h>
#include <linux/gpio.h>
#include <linux/mmc/card.h>
#include <linux/mmc/host.h>
@@ -74,10 +75,8 @@ static void tegra_sdhci_writel(struct sdhci_host *host, u32 val, int reg)
static unsigned int tegra_sdhci_get_ro(struct sdhci_host *sdhci)
{
- struct platform_device *pdev = to_platform_device(mmc_dev(sdhci->mmc));
- struct tegra_sdhci_platform_data *plat;
-
- plat = pdev->dev.platform_data;
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(sdhci);
+ struct tegra_sdhci_platform_data *plat = pltfm_host->priv;
if (!gpio_is_valid(plat->wp_gpio))
return -1;
@@ -95,12 +94,10 @@ static irqreturn_t carddetect_irq(int irq, void *data)
static int tegra_sdhci_8bit(struct sdhci_host *host, int bus_width)
{
- struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc));
- struct tegra_sdhci_platform_data *plat;
+ struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+ struct tegra_sdhci_platform_data *plat = pltfm_host->priv;
u32 ctrl;
- plat = pdev->dev.platform_data;
-
ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
if (plat->is_8bit && bus_width == MMC_BUS_WIDTH_8) {
ctrl &= ~SDHCI_CTRL_4BITBUS;
@@ -132,6 +129,34 @@ static struct sdhci_pltfm_data sdhci_tegra_pdata = {
.ops = &tegra_sdhci_ops,
};
+static const struct of_device_id sdhci_tegra_dt_match[] __devinitdata = {
+ { .compatible = "nvidia,tegra20-sdhci", },
+ {}
+};
+MODULE_DEVICE_TABLE(of, sdhci_dt_ids);
+
+static struct tegra_sdhci_platform_data * __devinit sdhci_tegra_dt_parse_pdata(
+ struct platform_device *pdev)
+{
+ struct tegra_sdhci_platform_data *plat;
+ struct device_node *np = pdev->dev.of_node;
+
+ if (!np)
+ return NULL;
+
+ plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
+ if (!plat) {
+ dev_err(&pdev->dev, "Can't allocate platform data\n");
+ return NULL;
+ }
+
+ plat->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
+ plat->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
+ plat->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
+
+ return plat;
+}
+
static int __devinit sdhci_tegra_probe(struct platform_device *pdev)
{
struct sdhci_pltfm_host *pltfm_host;
@@ -148,12 +173,17 @@ static int __devinit sdhci_tegra_probe(struct platform_device *pdev)
plat = pdev->dev.platform_data;
+ if (plat == NULL)
+ plat = sdhci_tegra_dt_parse_pdata(pdev);
+
if (plat == NULL) {
dev_err(mmc_dev(host->mmc), "missing platform data\n");
rc = -ENXIO;
goto err_no_plat;
}
+ pltfm_host->priv = plat;
+
if (gpio_is_valid(plat->power_gpio)) {
rc = gpio_request(plat->power_gpio, "sdhci_power");
if (rc) {
@@ -248,13 +278,11 @@ static int __devexit sdhci_tegra_remove(struct platform_device *pdev)
{
struct sdhci_host *host = platform_get_drvdata(pdev);
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- struct tegra_sdhci_platform_data *plat;
+ struct tegra_sdhci_platform_data *plat = pltfm_host->priv;
int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff);
sdhci_remove_host(host, dead);
- plat = pdev->dev.platform_data;
-
if (gpio_is_valid(plat->wp_gpio)) {
tegra_gpio_disable(plat->wp_gpio);
gpio_free(plat->wp_gpio);
@@ -283,6 +311,7 @@ static struct platform_driver sdhci_tegra_driver = {
.driver = {
.name = "sdhci-tegra",
.owner = THIS_MODULE,
+ .of_match_table = sdhci_tegra_dt_match,
},
.probe = sdhci_tegra_probe,
.remove = __devexit_p(sdhci_tegra_remove),
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] arm/dt: Tegra: Update SDHCI nodes to match bindings
[not found] ` <1314123334-23133-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2011-08-23 18:15 ` Stephen Warren
[not found] ` <1314123334-23133-2-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-08-26 5:19 ` [PATCH 1/2] sdhci/tegra: Add Device Tree probing support Olof Johansson
2011-08-30 7:52 ` Marc Dietich
2 siblings, 1 reply; 10+ messages in thread
From: Stephen Warren @ 2011-08-23 18:15 UTC (permalink / raw)
To: Grant Likely, Chris Ball
Cc: Olof Johansson, Shawn Guo, linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Stephen Warren
The bindings were recently updated to be more in-line with other SDHCI
bindings that are already merged.
Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
arch/arm/boot/dts/tegra-harmony.dts | 12 ++++++------
arch/arm/boot/dts/tegra-seaboard.dts | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts
index 4c05334..e581866 100644
--- a/arch/arm/boot/dts/tegra-harmony.dts
+++ b/arch/arm/boot/dts/tegra-harmony.dts
@@ -57,14 +57,14 @@
};
sdhci@c8000200 {
- gpios = <&gpio 69 0>, /* cd, gpio PI5 */
- <&gpio 57 0>, /* wp, gpio PH1 */
- <&gpio 155 0>; /* power, gpio PT3 */
+ cd-gpios = <&gpio 69 0>; /* gpio PI5 */
+ wp-gpios = <&gpio 57 0>; /* gpio PH1 */
+ power-gpios = <&gpio 155 0>; /* gpio PT3 */
};
sdhci@c8000600 {
- gpios = <&gpio 58 0>, /* cd, gpio PH2 */
- <&gpio 59 0>, /* wp, gpio PH3 */
- <&gpio 70 0>; /* power, gpio PI6 */
+ cd-gpios = <&gpio 58 0>; /* gpio PH2 */
+ wp-gpios = <&gpio 59 0>; /* gpio PH3 */
+ power-gpios = <&gpio 70 0>; /* gpio PI6 */
};
};
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts
index 1940cae..64cedca 100644
--- a/arch/arm/boot/dts/tegra-seaboard.dts
+++ b/arch/arm/boot/dts/tegra-seaboard.dts
@@ -21,8 +21,8 @@
};
sdhci@c8000400 {
- gpios = <&gpio 69 0>, /* cd, gpio PI5 */
- <&gpio 57 0>, /* wp, gpio PH1 */
- <&gpio 70 0>; /* power, gpio PI6 */
+ cd-gpios = <&gpio 69 0>; /* gpio PI5 */
+ wp-gpios = <&gpio 57 0>; /* gpio PH1 */
+ power-gpios = <&gpio 70 0>; /* gpio PI6 */
};
};
--
1.7.0.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] sdhci/tegra: Add Device Tree probing support
2011-08-23 18:15 [PATCH 1/2] sdhci/tegra: Add Device Tree probing support Stephen Warren
@ 2011-08-23 18:41 ` Chris Ball
[not found] ` <1314123334-23133-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-08-30 3:40 ` Shawn Guo
2 siblings, 0 replies; 10+ messages in thread
From: Chris Ball @ 2011-08-23 18:41 UTC (permalink / raw)
To: Stephen Warren
Cc: Grant Likely, Olof Johansson, Shawn Guo, linux-mmc, linux-tegra,
linux-arm-kernel, devicetree-discuss, linux-kernel
Hi Stephen,
On Tue, Aug 23 2011, Stephen Warren wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> Add hooks to read gpio configuration out of the device tree node.
>
> [grant.likely: Rewrite of original patch from John Bonesio]
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> [swarren: Fixed tegra_sdhci_get_ro() to retrieve pdata correctly]
> [swarren: Reworked to avoid #ifdef CONFIG_OF]
> [swarren: Reworked binding based on fsl-imx-esdhc.txt]
> [swarren: Documented binding]
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> Theoretically, these two patches should be merged in order in one place,
> since the 2nd logically depends on the first. However, it's really just
> a documentation dependency, so I think it's fine to merge them into the
> MMC and DT trees separately and let them meet in linux-next.
>
> .../devicetree/bindings/mmc/nvidia-sdhci.txt | 25 ++++++++++
> drivers/mmc/host/sdhci-tegra.c | 51 +++++++++++++++----
> 2 files changed, 65 insertions(+), 11 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
Okay, I've pushed this patch [1/2] to mmc-next for 3.2.
Thanks,
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/2] arm/dt: Tegra: Update SDHCI nodes to match bindings
[not found] ` <1314123334-23133-2-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2011-08-26 5:19 ` Olof Johansson
0 siblings, 0 replies; 10+ messages in thread
From: Olof Johansson @ 2011-08-26 5:19 UTC (permalink / raw)
To: Stephen Warren
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA, Chris Ball,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On Tue, Aug 23, 2011 at 11:15 AM, Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
> The bindings were recently updated to be more in-line with other SDHCI
> bindings that are already merged.
>
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] sdhci/tegra: Add Device Tree probing support
[not found] ` <1314123334-23133-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-08-23 18:15 ` [PATCH 2/2] arm/dt: Tegra: Update SDHCI nodes to match bindings Stephen Warren
@ 2011-08-26 5:19 ` Olof Johansson
2011-08-30 7:52 ` Marc Dietich
2 siblings, 0 replies; 10+ messages in thread
From: Olof Johansson @ 2011-08-26 5:19 UTC (permalink / raw)
To: Stephen Warren
Cc: Grant Likely, Chris Ball, Shawn Guo,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
On Tue, Aug 23, 2011 at 11:15 AM, Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> wrote:
> From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
>
> Add hooks to read gpio configuration out of the device tree node.
>
> [grant.likely: Rewrite of original patch from John Bonesio]
> Signed-off-by: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
> [swarren: Fixed tegra_sdhci_get_ro() to retrieve pdata correctly]
> [swarren: Reworked to avoid #ifdef CONFIG_OF]
> [swarren: Reworked binding based on fsl-imx-esdhc.txt]
> [swarren: Documented binding]
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>
-Olof
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] sdhci/tegra: Add Device Tree probing support
2011-08-23 18:15 [PATCH 1/2] sdhci/tegra: Add Device Tree probing support Stephen Warren
2011-08-23 18:41 ` Chris Ball
[not found] ` <1314123334-23133-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
@ 2011-08-30 3:40 ` Shawn Guo
2011-08-30 16:01 ` Stephen Warren
2 siblings, 1 reply; 10+ messages in thread
From: Shawn Guo @ 2011-08-30 3:40 UTC (permalink / raw)
To: Stephen Warren
Cc: devicetree-discuss, linux-mmc, linux-kernel, Grant Likely,
linux-tegra, Chris Ball, linux-arm-kernel
On Tue, Aug 23, 2011 at 12:15:33PM -0600, Stephen Warren wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> Add hooks to read gpio configuration out of the device tree node.
>
> [grant.likely: Rewrite of original patch from John Bonesio]
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> [swarren: Fixed tegra_sdhci_get_ro() to retrieve pdata correctly]
> [swarren: Reworked to avoid #ifdef CONFIG_OF]
> [swarren: Reworked binding based on fsl-imx-esdhc.txt]
> [swarren: Documented binding]
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> Theoretically, these two patches should be merged in order in one place,
> since the 2nd logically depends on the first. However, it's really just
> a documentation dependency, so I think it's fine to merge them into the
> MMC and DT trees separately and let them meet in linux-next.
>
> .../devicetree/bindings/mmc/nvidia-sdhci.txt | 25 ++++++++++
> drivers/mmc/host/sdhci-tegra.c | 51 +++++++++++++++----
> 2 files changed, 65 insertions(+), 11 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
>
> diff --git a/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
> new file mode 100644
> index 0000000..c87f667
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
> @@ -0,0 +1,25 @@
> +* NVIDIA Tegra Secure Digital Host Controller
> +
> +This controller on Tegra family SoCs provides an interface for MMC, SD,
> +and SDIO types of memory cards.
> +
> +Required properties:
> +- compatible : Should be "nvidia,<chip>-sdhci"
> +- reg : Should contain eSDHC registers location and length
> +- interrupts : Should contain eSDHC interrupt
You may want to replace eSDHC with something Tegra specific.
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] sdhci/tegra: Add Device Tree probing support
[not found] ` <1314123334-23133-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-08-23 18:15 ` [PATCH 2/2] arm/dt: Tegra: Update SDHCI nodes to match bindings Stephen Warren
2011-08-26 5:19 ` [PATCH 1/2] sdhci/tegra: Add Device Tree probing support Olof Johansson
@ 2011-08-30 7:52 ` Marc Dietich
[not found] ` <201108300952.02418.marvin24-Mmb7MZpHnFY@public.gmane.org>
2 siblings, 1 reply; 10+ messages in thread
From: Marc Dietich @ 2011-08-30 7:52 UTC (permalink / raw)
To: Stephen Warren
Cc: Grant Likely, Chris Ball, Olof Johansson, Shawn Guo,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-tegra-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi,
just a small question,
> From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
[...]
> diff --git a/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
> b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt new file mode
> 100644
> index 0000000..c87f667
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
> @@ -0,0 +1,25 @@
> +* NVIDIA Tegra Secure Digital Host Controller
> +
> +This controller on Tegra family SoCs provides an interface for MMC, SD,
> +and SDIO types of memory cards.
> +
> +Required properties:
> +- compatible : Should be "nvidia,<chip>-sdhci"
> +- reg : Should contain eSDHC registers location and length
> +- interrupts : Should contain eSDHC interrupt
> +
> +Optional properties:
> +- cd-gpios : Specify GPIOs for card detection
> +- wp-gpios : Specify GPIOs for write protection
> +- power-gpios : Specify GPIOs for power control
> +
> +Example:
> +
> +sdhci@c8000200 {
> + compatible = "nvidia,tegra20-sdhci";
> + reg = <0xc8000200 0x200>;
> + interrupts = <47>;
> + cd-gpios = <&gpio 69 0>; /* gpio PI5 */
> + wp-gpios = <&gpio 57 0>; /* gpio PH1 */
> + power-gpios = <&gpio 155 0>; /* gpio PT3 */
> +};
> diff --git a/drivers/mmc/host/sdhci-tegra.c
> b/drivers/mmc/host/sdhci-tegra.c index a5a9a97..9ab18d6 100644
> --- a/drivers/mmc/host/sdhci-tegra.c
> +++ b/drivers/mmc/host/sdhci-tegra.c
> @@ -17,6 +17,7 @@
> #include <linux/platform_device.h>
> #include <linux/clk.h>
> #include <linux/io.h>
> +#include <linux/of_gpio.h>
> #include <linux/gpio.h>
> #include <linux/mmc/card.h>
> #include <linux/mmc/host.h>
> @@ -74,10 +75,8 @@ static void tegra_sdhci_writel(struct sdhci_host *host,
> u32 val, int reg)
>
> static unsigned int tegra_sdhci_get_ro(struct sdhci_host *sdhci)
> {
> - struct platform_device *pdev = to_platform_device(mmc_dev(sdhci->mmc));
> - struct tegra_sdhci_platform_data *plat;
> -
> - plat = pdev->dev.platform_data;
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(sdhci);
> + struct tegra_sdhci_platform_data *plat = pltfm_host->priv;
>
> if (!gpio_is_valid(plat->wp_gpio))
> return -1;
> @@ -95,12 +94,10 @@ static irqreturn_t carddetect_irq(int irq, void *data)
>
> static int tegra_sdhci_8bit(struct sdhci_host *host, int bus_width)
> {
> - struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc));
> - struct tegra_sdhci_platform_data *plat;
> + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> + struct tegra_sdhci_platform_data *plat = pltfm_host->priv;
> u32 ctrl;
>
> - plat = pdev->dev.platform_data;
> -
> ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
> if (plat->is_8bit && bus_width == MMC_BUS_WIDTH_8) {
> ctrl &= ~SDHCI_CTRL_4BITBUS;
what about 8 bit support?
> @@ -132,6 +129,34 @@ static struct sdhci_pltfm_data sdhci_tegra_pdata = {
> .ops = &tegra_sdhci_ops,
> };
>
> +static const struct of_device_id sdhci_tegra_dt_match[] __devinitdata = {
> + { .compatible = "nvidia,tegra20-sdhci", },
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, sdhci_dt_ids);
> +
> +static struct tegra_sdhci_platform_data * __devinit
> sdhci_tegra_dt_parse_pdata( + struct platform_device *pdev)
> +{
> + struct tegra_sdhci_platform_data *plat;
> + struct device_node *np = pdev->dev.of_node;
> +
> + if (!np)
> + return NULL;
> +
> + plat = devm_kzalloc(&pdev->dev, sizeof(*plat), GFP_KERNEL);
> + if (!plat) {
> + dev_err(&pdev->dev, "Can't allocate platform data\n");
> + return NULL;
> + }
> +
> + plat->cd_gpio = of_get_named_gpio(np, "cd-gpios", 0);
> + plat->wp_gpio = of_get_named_gpio(np, "wp-gpios", 0);
> + plat->power_gpio = of_get_named_gpio(np, "power-gpios", 0);
> +
> + return plat;
> +}
[...]
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH 1/2] sdhci/tegra: Add Device Tree probing support
2011-08-30 3:40 ` Shawn Guo
@ 2011-08-30 16:01 ` Stephen Warren
2011-08-31 2:49 ` Shawn Guo
0 siblings, 1 reply; 10+ messages in thread
From: Stephen Warren @ 2011-08-30 16:01 UTC (permalink / raw)
To: Shawn Guo
Cc: Grant Likely, Chris Ball, devicetree-discuss@lists.ozlabs.org,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Shawn Guo wrote at Monday, August 29, 2011 9:41 PM:
> On Tue, Aug 23, 2011 at 12:15:33PM -0600, Stephen Warren wrote:
> > From: Grant Likely <grant.likely@secretlab.ca>
> >
> > Add hooks to read gpio configuration out of the device tree node.
...
> > diff --git a/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
...
> > +* NVIDIA Tegra Secure Digital Host Controller
> > +
> > +This controller on Tegra family SoCs provides an interface for MMC, SD,
> > +and SDIO types of memory cards.
> > +
> > +Required properties:
> > +- compatible : Should be "nvidia,<chip>-sdhci"
> > +- reg : Should contain eSDHC registers location and length
> > +- interrupts : Should contain eSDHC interrupt
>
> You may want to replace eSDHC with something Tegra specific.
True. The patch is already submitted. Do you think it's worth posting one
just to fix that; it still seems pretty clear what's required?
Thanks.
--
nvpublic
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH 1/2] sdhci/tegra: Add Device Tree probing support
[not found] ` <201108300952.02418.marvin24-Mmb7MZpHnFY@public.gmane.org>
@ 2011-08-30 16:17 ` Stephen Warren
0 siblings, 0 replies; 10+ messages in thread
From: Stephen Warren @ 2011-08-30 16:17 UTC (permalink / raw)
To: Marc Dietich
Cc: Grant Likely, Chris Ball, Olof Johansson, Shawn Guo,
linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Marc Dietich wrote at Tuesday, August 30, 2011 1:52 AM:
...
> > diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
...
> > @@ -95,12 +94,10 @@ static irqreturn_t carddetect_irq(int irq, void *data)
> >
> > static int tegra_sdhci_8bit(struct sdhci_host *host, int bus_width)
> > {
> > - struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc));
> > - struct tegra_sdhci_platform_data *plat;
> > + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> > + struct tegra_sdhci_platform_data *plat = pltfm_host->priv;
> > u32 ctrl;
> >
> > - plat = pdev->dev.platform_data;
> > -
> > ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
> > if (plat->is_8bit && bus_width == MMC_BUS_WIDTH_8) {
> > ctrl &= ~SDHCI_CTRL_4BITBUS;
>
> what about 8 bit support?
I didn't understand the question at first; I assume you're asking about
8-bit support in the device-tree binding/parsing.
Yes, that's a missing feature, and I should add it. Thanks for pointing
that out.
(I'll also fix the binding docs issue that Shawn pointed out while I'm
at it).
--
nvpublic
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] sdhci/tegra: Add Device Tree probing support
2011-08-30 16:01 ` Stephen Warren
@ 2011-08-31 2:49 ` Shawn Guo
0 siblings, 0 replies; 10+ messages in thread
From: Shawn Guo @ 2011-08-31 2:49 UTC (permalink / raw)
To: Stephen Warren
Cc: Grant Likely, Chris Ball, devicetree-discuss@lists.ozlabs.org,
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-arm-kernel@lists.infradead.org
On Tue, Aug 30, 2011 at 09:01:37AM -0700, Stephen Warren wrote:
> Shawn Guo wrote at Monday, August 29, 2011 9:41 PM:
> > On Tue, Aug 23, 2011 at 12:15:33PM -0600, Stephen Warren wrote:
> > > From: Grant Likely <grant.likely@secretlab.ca>
> > >
> > > Add hooks to read gpio configuration out of the device tree node.
> ...
> > > diff --git a/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt b/Documentation/devicetree/bindings/mmc/nvidia-sdhci.txt
> ...
> > > +* NVIDIA Tegra Secure Digital Host Controller
> > > +
> > > +This controller on Tegra family SoCs provides an interface for MMC, SD,
> > > +and SDIO types of memory cards.
> > > +
> > > +Required properties:
> > > +- compatible : Should be "nvidia,<chip>-sdhci"
> > > +- reg : Should contain eSDHC registers location and length
> > > +- interrupts : Should contain eSDHC interrupt
> >
> > You may want to replace eSDHC with something Tegra specific.
>
> True. The patch is already submitted. Do you think it's worth posting one
> just to fix that;
It's totally your call.
Regards,
Shawn
> it still seems pretty clear what's required?
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-08-31 2:49 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-23 18:15 [PATCH 1/2] sdhci/tegra: Add Device Tree probing support Stephen Warren
2011-08-23 18:41 ` Chris Ball
[not found] ` <1314123334-23133-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-08-23 18:15 ` [PATCH 2/2] arm/dt: Tegra: Update SDHCI nodes to match bindings Stephen Warren
[not found] ` <1314123334-23133-2-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-08-26 5:19 ` Olof Johansson
2011-08-26 5:19 ` [PATCH 1/2] sdhci/tegra: Add Device Tree probing support Olof Johansson
2011-08-30 7:52 ` Marc Dietich
[not found] ` <201108300952.02418.marvin24-Mmb7MZpHnFY@public.gmane.org>
2011-08-30 16:17 ` Stephen Warren
2011-08-30 3:40 ` Shawn Guo
2011-08-30 16:01 ` Stephen Warren
2011-08-31 2:49 ` Shawn Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).