* [PATCH v3 0/3] Add DT support for davinci_mmc driver
@ 2013-02-12 6:37 Manjunathappa, Prakash
2013-02-12 6:37 ` [PATCH v3 1/3] mmc: davinci_mmc: add DT support Manjunathappa, Prakash
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-12 6:37 UTC (permalink / raw)
To: linux-mmc
Cc: grant.likely, rob.herring, rob, linux, nsekhar, hs,
devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
davinci-linux-open-source, Manjunathappa, Prakash
Patch set adds DT support for davinci_mmc driver and is
verified on da850-evm without card_detect/write_protect and
EDMA support.
This patch depends on below patches under review:
1) Patch "drivers/pinctrl: grab default handles from device core"
http://www.gossamer-threads.com/lists/linux/kernel/1664015?page=last
2) Patch "mmc: davinci: allow driver to work without DMA resource"
http://www.mail-archive.com/linux-mmc@vger.kernel.org/msg18771.html
Applies on top of v3.9/dt-2 branch of linux_davinci tree:
git://gitorious.org/linux-davinci/linux-davinci.git
Since v2:
Modified the default value for bus-width and skipping the property specifications
for highspeed card capabilties for now. Re-ordered patch 2 and 3.
Since v1:
Modified the DT parse function to take default values, updated DT binding
documentation accordingly.
Manjunathappa, Prakash (3):
mmc: davinci_mmc: add DT support
ARM: davinci: da850: add mmc DT entries
ARM: davinci: da850: override mmc DT node device name
.../devicetree/bindings/mmc/davinci_mmc.txt | 25 ++++++++
arch/arm/boot/dts/da850-evm.dts | 7 ++
arch/arm/boot/dts/da850.dtsi | 14 ++++
arch/arm/mach-davinci/da8xx-dt.c | 2 +
drivers/mmc/host/davinci_mmc.c | 65 +++++++++++++++++++-
5 files changed, 111 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mmc/davinci_mmc.txt
--
1.7.4.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/3] mmc: davinci_mmc: add DT support
2013-02-12 6:37 [PATCH v3 0/3] Add DT support for davinci_mmc driver Manjunathappa, Prakash
@ 2013-02-12 6:37 ` Manjunathappa, Prakash
2013-02-12 11:00 ` Mark Rutland
2013-02-12 6:37 ` [PATCH v3 2/3] ARM: davinci: da850: add mmc DT entries Manjunathappa, Prakash
2013-02-12 6:37 ` [PATCH v3 3/3] ARM: davinci: da850: override mmc DT node device name Manjunathappa, Prakash
2 siblings, 1 reply; 6+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-12 6:37 UTC (permalink / raw)
To: linux-mmc
Cc: grant.likely, rob.herring, rob, linux, nsekhar, hs,
devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
davinci-linux-open-source, Manjunathappa, Prakash, mporter
Adds device tree support for davinci_mmc. Also add binding documentation.
As of now in non-dma PIO mode and without GPIO card_detect/write_protect
option because of dependencies on EDMA and GPIO module DT support.
Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
Cc: linux-mmc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: davinci-linux-open-source@linux.davincidsp.com
Cc: devicetree-discuss@lists.ozlabs.org
Cc: cjb@laptop.org
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: mporter@ti.com
---
Since v2:
Modified the default value for bus-width and removed the support for
highspeed card capabilties for now.
Since v1:
Modified DT parse function to take default values and accomodate controller
version in compatible field.
.../devicetree/bindings/mmc/davinci_mmc.txt | 25 ++++++++
drivers/mmc/host/davinci_mmc.c | 65 +++++++++++++++++++-
2 files changed, 88 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mmc/davinci_mmc.txt
diff --git a/Documentation/devicetree/bindings/mmc/davinci_mmc.txt b/Documentation/devicetree/bindings/mmc/davinci_mmc.txt
new file mode 100644
index 0000000..247be0f
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/davinci_mmc.txt
@@ -0,0 +1,25 @@
+* TI Highspeed MMC host controller for DaVinci
+
+The Highspeed MMC Host Controller on TI DaVinci family
+provides an interface for MMC, SD and SDIO types of memory cards.
+
+This file documents the properties used by the davinci_mmc driver.
+
+Required properties:
+- compatible:
+ Should be "ti,davinci-mmc-da830": for da830, da850, dm365
+ Should be "ti,davinci-mmc-dm355": for dm355, dm644x
+
+Optional properties:
+- bus-width: Number of data lines, can be <1>, <4>, or <8>, default <1>
+- max-frequency: Maximum operating clock frequency, default 25MHz.
+
+Example:
+ mmc0: mmc@1c40000 {
+ compatible = "ti,davinci-mmc-da830",
+ reg = <0x40000 0x1000>;
+ interrupts = <16>;
+ status = "okay";
+ bus-width = <4>;
+ max-frequency = <50000000>;
+ };
diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 27123f8..66ca6bf 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -34,6 +34,8 @@
#include <linux/dma-mapping.h>
#include <linux/edma.h>
#include <linux/mmc/mmc.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/platform_data/mmc-davinci.h>
@@ -1157,16 +1159,74 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
mmc_davinci_reset_ctrl(host, 0);
}
-static int __init davinci_mmcsd_probe(struct platform_device *pdev)
+static const struct of_device_id davinci_mmc_dt_ids[] = {
+ {
+ .compatible = "ti,davinci-mmc-dm355",
+ .data = (void *)MMC_CTLR_VERSION_1,
+ },
+ {
+ .compatible = "ti,davinci-mmc-da830",
+ .data = (void *)MMC_CTLR_VERSION_2,
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, davinci_mmc_dt_ids);
+
+static struct davinci_mmc_config
+ *mmc_parse_pdata(struct platform_device *pdev)
{
+ struct device_node *np;
struct davinci_mmc_config *pdata = pdev->dev.platform_data;
+ const struct of_device_id *match =
+ of_match_device(of_match_ptr(davinci_mmc_dt_ids), &pdev->dev);
+ u32 data;
+
+ np = pdev->dev.of_node;
+ if (!np)
+ return pdata;
+
+ pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata) {
+ dev_err(&pdev->dev, "Failed to allocate memory for struct davinci_mmc_config\n");
+ goto nodata;
+ }
+
+ if (match->data)
+ pdata->version = (u8)((int)match->data);
+
+ of_property_read_u32(np, "max-frequency", &pdata->max_freq);
+ if (!pdata->max_freq)
+ dev_info(&pdev->dev, "'max-frequency' property not specified, defaulting to 25MHz\n");
+
+ of_property_read_u32(np, "bus-width", &data);
+ switch (data) {
+ case 1:
+ case 4:
+ case 8:
+ pdata->wires = data;
+ break;
+ default:
+ pdata->wires = 1;
+ dev_info(&pdev->dev, "Unsupported buswidth, defaulting to 1 bit\n");
+ }
+nodata:
+ return pdata;
+}
+
+static int __init davinci_mmcsd_probe(struct platform_device *pdev)
+{
+ struct davinci_mmc_config *pdata = NULL;
struct mmc_davinci_host *host = NULL;
struct mmc_host *mmc = NULL;
struct resource *r, *mem = NULL;
int ret = 0, irq = 0;
size_t mem_size;
- /* REVISIT: when we're fully converted, fail if pdata is NULL */
+ pdata = mmc_parse_pdata(pdev);
+ if (pdata == NULL) {
+ dev_err(&pdev->dev, "Can not get platform data\n");
+ return -ENOENT;
+ }
ret = -ENODEV;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1408,6 +1468,7 @@ static struct platform_driver davinci_mmcsd_driver = {
.name = "davinci_mmc",
.owner = THIS_MODULE,
.pm = davinci_mmcsd_pm_ops,
+ .of_match_table = of_match_ptr(davinci_mmc_dt_ids),
},
.remove = __exit_p(davinci_mmcsd_remove),
};
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/3] ARM: davinci: da850: add mmc DT entries
2013-02-12 6:37 [PATCH v3 0/3] Add DT support for davinci_mmc driver Manjunathappa, Prakash
2013-02-12 6:37 ` [PATCH v3 1/3] mmc: davinci_mmc: add DT support Manjunathappa, Prakash
@ 2013-02-12 6:37 ` Manjunathappa, Prakash
2013-02-12 6:37 ` [PATCH v3 3/3] ARM: davinci: da850: override mmc DT node device name Manjunathappa, Prakash
2 siblings, 0 replies; 6+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-12 6:37 UTC (permalink / raw)
To: linux-mmc
Cc: grant.likely, rob.herring, rob, linux, nsekhar, hs,
devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
davinci-linux-open-source, Manjunathappa, Prakash
Add DT entry for MMC. Also add entry for pinmux information.
Tested:
1) Without GPIO card detection and EDMA support as DT support for
GPIO and EDMA are yet come.
2) By creating/deleting files and mounting/unmounting the partition.
Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
Cc: linux-mmc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: davinci-linux-open-source@linux.davincidsp.com
Cc: devicetree-discuss@lists.ozlabs.org
Cc: cjb@laptop.org
Cc: Sekhar Nori <nsekhar@ti.com>
---
Since v2:
Remove properties specifying for highspeed card capability.
Since v1:
Removed bitfields for specifying the device capabilty and accomodate
controller revision in compatible field.
arch/arm/boot/dts/da850-evm.dts | 7 +++++++
arch/arm/boot/dts/da850.dtsi | 14 ++++++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts
index f712fb6..78c8e54 100644
--- a/arch/arm/boot/dts/da850-evm.dts
+++ b/arch/arm/boot/dts/da850-evm.dts
@@ -39,6 +39,13 @@
wdt: wdt@1c21000 {
status = "okay";
};
+ mmc0: mmc@1c40000 {
+ max-frequency = <50000000>;
+ bus-width = <4>;
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc0_pins>;
+ };
};
nand_cs3@62000000 {
status = "okay";
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi
index 4b2262a..ebe7386 100644
--- a/arch/arm/boot/dts/da850.dtsi
+++ b/arch/arm/boot/dts/da850.dtsi
@@ -67,6 +67,15 @@
0x10 0x00002200 0x0000ff00
>;
};
+ mmc0_pins: pinmux_mmc_pins {
+ pinctrl-single,bits = <
+ /* MMCSD0_DAT[3] MMCSD0_DAT[2]
+ * MMCSD0_DAT[1] MMCSD0_DAT[0]
+ * MMCSD0_CMD MMCSD0_CLK
+ */
+ 0x28 0x00222222 0x00ffffff
+ >;
+ };
};
serial0: serial@1c42000 {
compatible = "ns16550a";
@@ -110,6 +119,11 @@
wdt: wdt@1c21000 {
compatible = "ti,davinci-wdt";
reg = <0x21000 0x1000>;
+ };
+ mmc0: mmc@1c40000 {
+ compatible = "ti,davinci-mmc-da830";
+ reg = <0x40000 0x1000>;
+ interrupts = <16>;
status = "disabled";
};
};
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 3/3] ARM: davinci: da850: override mmc DT node device name
2013-02-12 6:37 [PATCH v3 0/3] Add DT support for davinci_mmc driver Manjunathappa, Prakash
2013-02-12 6:37 ` [PATCH v3 1/3] mmc: davinci_mmc: add DT support Manjunathappa, Prakash
2013-02-12 6:37 ` [PATCH v3 2/3] ARM: davinci: da850: add mmc DT entries Manjunathappa, Prakash
@ 2013-02-12 6:37 ` Manjunathappa, Prakash
2 siblings, 0 replies; 6+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-12 6:37 UTC (permalink / raw)
To: linux-mmc
Cc: grant.likely, rob.herring, rob, linux, nsekhar, hs,
devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
davinci-linux-open-source, Manjunathappa, Prakash, linux-kernel
Populate OF_DEV_AUXDATA with desired device name expected by
davinci_mmc driver. Without this clk_get of davinci_mmc DT driver
fails.
Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
Cc: linux-mmc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: davinci-linux-open-source@linux.davincidsp.com
Cc: devicetree-discuss@lists.ozlabs.org
Cc: cjb@laptop.org
Cc: Sekhar Nori <nsekhar@ti.com>
---
Since v2:
Rebased on top of v3.9/dt-2 branch of linux_davinci and reordered this patch.
Since v1:
No Change.
arch/arm/mach-davinci/da8xx-dt.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-davinci/da8xx-dt.c b/arch/arm/mach-davinci/da8xx-dt.c
index 5404e92..fc62240 100644
--- a/arch/arm/mach-davinci/da8xx-dt.c
+++ b/arch/arm/mach-davinci/da8xx-dt.c
@@ -40,6 +40,8 @@ static void __init da8xx_init_irq(void)
struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL),
OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "watchdog", NULL),
+ OF_DEV_AUXDATA("ti,davinci-mmc-da830", 0x01c40000, "davinci_mmc.0",
+ NULL),
{}
};
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/3] mmc: davinci_mmc: add DT support
2013-02-12 6:37 ` [PATCH v3 1/3] mmc: davinci_mmc: add DT support Manjunathappa, Prakash
@ 2013-02-12 11:00 ` Mark Rutland
2013-02-14 6:22 ` Manjunathappa, Prakash
0 siblings, 1 reply; 6+ messages in thread
From: Mark Rutland @ 2013-02-12 11:00 UTC (permalink / raw)
To: Manjunathappa, Prakash
Cc: linux-mmc@vger.kernel.org, mporter@ti.com,
davinci-linux-open-source@linux.davincidsp.com, cjb@laptop.org,
linux@arm.linux.org.uk, linux-doc@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org, nsekhar@ti.com,
rob.herring@calxeda.com, hs@denx.de,
linux-arm-kernel@lists.infradead.org
Hi Prakash,
I think this looks pretty good now :)
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Thanks,
Mark.
On Tue, Feb 12, 2013 at 06:37:36AM +0000, Manjunathappa, Prakash wrote:
> Adds device tree support for davinci_mmc. Also add binding documentation.
> As of now in non-dma PIO mode and without GPIO card_detect/write_protect
> option because of dependencies on EDMA and GPIO module DT support.
>
> Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
> Cc: linux-mmc@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: davinci-linux-open-source@linux.davincidsp.com
> Cc: devicetree-discuss@lists.ozlabs.org
> Cc: cjb@laptop.org
> Cc: Sekhar Nori <nsekhar@ti.com>
> Cc: mporter@ti.com
> ---
> Since v2:
> Modified the default value for bus-width and removed the support for
> highspeed card capabilties for now.
> Since v1:
> Modified DT parse function to take default values and accomodate controller
> version in compatible field.
>
> .../devicetree/bindings/mmc/davinci_mmc.txt | 25 ++++++++
> drivers/mmc/host/davinci_mmc.c | 65 +++++++++++++++++++-
> 2 files changed, 88 insertions(+), 2 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/mmc/davinci_mmc.txt
>
> diff --git a/Documentation/devicetree/bindings/mmc/davinci_mmc.txt b/Documentation/devicetree/bindings/mmc/davinci_mmc.txt
> new file mode 100644
> index 0000000..247be0f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/davinci_mmc.txt
> @@ -0,0 +1,25 @@
> +* TI Highspeed MMC host controller for DaVinci
> +
> +The Highspeed MMC Host Controller on TI DaVinci family
> +provides an interface for MMC, SD and SDIO types of memory cards.
> +
> +This file documents the properties used by the davinci_mmc driver.
> +
> +Required properties:
> +- compatible:
> + Should be "ti,davinci-mmc-da830": for da830, da850, dm365
> + Should be "ti,davinci-mmc-dm355": for dm355, dm644x
> +
> +Optional properties:
> +- bus-width: Number of data lines, can be <1>, <4>, or <8>, default <1>
> +- max-frequency: Maximum operating clock frequency, default 25MHz.
> +
> +Example:
> + mmc0: mmc@1c40000 {
> + compatible = "ti,davinci-mmc-da830",
> + reg = <0x40000 0x1000>;
> + interrupts = <16>;
> + status = "okay";
> + bus-width = <4>;
> + max-frequency = <50000000>;
> + };
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 27123f8..66ca6bf 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -34,6 +34,8 @@
> #include <linux/dma-mapping.h>
> #include <linux/edma.h>
> #include <linux/mmc/mmc.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>
> #include <linux/platform_data/mmc-davinci.h>
>
> @@ -1157,16 +1159,74 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
> mmc_davinci_reset_ctrl(host, 0);
> }
>
> -static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> +static const struct of_device_id davinci_mmc_dt_ids[] = {
> + {
> + .compatible = "ti,davinci-mmc-dm355",
> + .data = (void *)MMC_CTLR_VERSION_1,
> + },
> + {
> + .compatible = "ti,davinci-mmc-da830",
> + .data = (void *)MMC_CTLR_VERSION_2,
> + },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, davinci_mmc_dt_ids);
> +
> +static struct davinci_mmc_config
> + *mmc_parse_pdata(struct platform_device *pdev)
> {
> + struct device_node *np;
> struct davinci_mmc_config *pdata = pdev->dev.platform_data;
> + const struct of_device_id *match =
> + of_match_device(of_match_ptr(davinci_mmc_dt_ids), &pdev->dev);
> + u32 data;
> +
> + np = pdev->dev.of_node;
> + if (!np)
> + return pdata;
> +
> + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata) {
> + dev_err(&pdev->dev, "Failed to allocate memory for struct davinci_mmc_config\n");
> + goto nodata;
> + }
> +
> + if (match->data)
> + pdata->version = (u8)((int)match->data);
> +
> + of_property_read_u32(np, "max-frequency", &pdata->max_freq);
> + if (!pdata->max_freq)
> + dev_info(&pdev->dev, "'max-frequency' property not specified, defaulting to 25MHz\n");
> +
> + of_property_read_u32(np, "bus-width", &data);
> + switch (data) {
> + case 1:
> + case 4:
> + case 8:
> + pdata->wires = data;
> + break;
> + default:
> + pdata->wires = 1;
> + dev_info(&pdev->dev, "Unsupported buswidth, defaulting to 1 bit\n");
> + }
> +nodata:
> + return pdata;
> +}
> +
> +static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> +{
> + struct davinci_mmc_config *pdata = NULL;
> struct mmc_davinci_host *host = NULL;
> struct mmc_host *mmc = NULL;
> struct resource *r, *mem = NULL;
> int ret = 0, irq = 0;
> size_t mem_size;
>
> - /* REVISIT: when we're fully converted, fail if pdata is NULL */
> + pdata = mmc_parse_pdata(pdev);
> + if (pdata == NULL) {
> + dev_err(&pdev->dev, "Can not get platform data\n");
> + return -ENOENT;
> + }
>
> ret = -ENODEV;
> r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1408,6 +1468,7 @@ static struct platform_driver davinci_mmcsd_driver = {
> .name = "davinci_mmc",
> .owner = THIS_MODULE,
> .pm = davinci_mmcsd_pm_ops,
> + .of_match_table = of_match_ptr(davinci_mmc_dt_ids),
> },
> .remove = __exit_p(davinci_mmcsd_remove),
> };
> --
> 1.7.4.1
>
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH v3 1/3] mmc: davinci_mmc: add DT support
2013-02-12 11:00 ` Mark Rutland
@ 2013-02-14 6:22 ` Manjunathappa, Prakash
0 siblings, 0 replies; 6+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-14 6:22 UTC (permalink / raw)
To: Mark Rutland
Cc: linux-mmc@vger.kernel.org, Porter, Matt,
davinci-linux-open-source@linux.davincidsp.com, cjb@laptop.org,
linux@arm.linux.org.uk, linux-doc@vger.kernel.org,
devicetree-discuss@lists.ozlabs.org, Nori, Sekhar,
rob.herring@calxeda.com, hs@denx.de,
linux-arm-kernel@lists.infradead.org
Hi Mark,
On Tue, Feb 12, 2013 at 16:30:48, Mark Rutland wrote:
> Hi Prakash,
>
> I think this looks pretty good now :)
>
> Reviewed-by: Mark Rutland <mark.rutland@arm.com>
>
Thanks for inputs, I will add your Reviewed-by for future versions of this patch.
Regards,
Prakash
> Thanks,
> Mark.
>
> On Tue, Feb 12, 2013 at 06:37:36AM +0000, Manjunathappa, Prakash wrote:
> > Adds device tree support for davinci_mmc. Also add binding documentation.
> > As of now in non-dma PIO mode and without GPIO card_detect/write_protect
> > option because of dependencies on EDMA and GPIO module DT support.
> >
> > Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
> > Cc: linux-mmc@vger.kernel.org
> > Cc: linux-arm-kernel@lists.infradead.org
> > Cc: davinci-linux-open-source@linux.davincidsp.com
> > Cc: devicetree-discuss@lists.ozlabs.org
> > Cc: cjb@laptop.org
> > Cc: Sekhar Nori <nsekhar@ti.com>
> > Cc: mporter@ti.com
> > ---
> > Since v2:
> > Modified the default value for bus-width and removed the support for
> > highspeed card capabilties for now.
> > Since v1:
> > Modified DT parse function to take default values and accomodate controller
> > version in compatible field.
> >
> > .../devicetree/bindings/mmc/davinci_mmc.txt | 25 ++++++++
> > drivers/mmc/host/davinci_mmc.c | 65 +++++++++++++++++++-
> > 2 files changed, 88 insertions(+), 2 deletions(-)
> > create mode 100644 Documentation/devicetree/bindings/mmc/davinci_mmc.txt
> >
> > diff --git a/Documentation/devicetree/bindings/mmc/davinci_mmc.txt b/Documentation/devicetree/bindings/mmc/davinci_mmc.txt
> > new file mode 100644
> > index 0000000..247be0f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mmc/davinci_mmc.txt
> > @@ -0,0 +1,25 @@
> > +* TI Highspeed MMC host controller for DaVinci
> > +
> > +The Highspeed MMC Host Controller on TI DaVinci family
> > +provides an interface for MMC, SD and SDIO types of memory cards.
> > +
> > +This file documents the properties used by the davinci_mmc driver.
> > +
> > +Required properties:
> > +- compatible:
> > + Should be "ti,davinci-mmc-da830": for da830, da850, dm365
> > + Should be "ti,davinci-mmc-dm355": for dm355, dm644x
> > +
> > +Optional properties:
> > +- bus-width: Number of data lines, can be <1>, <4>, or <8>, default <1>
> > +- max-frequency: Maximum operating clock frequency, default 25MHz.
> > +
> > +Example:
> > + mmc0: mmc@1c40000 {
> > + compatible = "ti,davinci-mmc-da830",
> > + reg = <0x40000 0x1000>;
> > + interrupts = <16>;
> > + status = "okay";
> > + bus-width = <4>;
> > + max-frequency = <50000000>;
> > + };
> > diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> > index 27123f8..66ca6bf 100644
> > --- a/drivers/mmc/host/davinci_mmc.c
> > +++ b/drivers/mmc/host/davinci_mmc.c
> > @@ -34,6 +34,8 @@
> > #include <linux/dma-mapping.h>
> > #include <linux/edma.h>
> > #include <linux/mmc/mmc.h>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
> >
> > #include <linux/platform_data/mmc-davinci.h>
> >
> > @@ -1157,16 +1159,74 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
> > mmc_davinci_reset_ctrl(host, 0);
> > }
> >
> > -static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> > +static const struct of_device_id davinci_mmc_dt_ids[] = {
> > + {
> > + .compatible = "ti,davinci-mmc-dm355",
> > + .data = (void *)MMC_CTLR_VERSION_1,
> > + },
> > + {
> > + .compatible = "ti,davinci-mmc-da830",
> > + .data = (void *)MMC_CTLR_VERSION_2,
> > + },
> > + {},
> > +};
> > +MODULE_DEVICE_TABLE(of, davinci_mmc_dt_ids);
> > +
> > +static struct davinci_mmc_config
> > + *mmc_parse_pdata(struct platform_device *pdev)
> > {
> > + struct device_node *np;
> > struct davinci_mmc_config *pdata = pdev->dev.platform_data;
> > + const struct of_device_id *match =
> > + of_match_device(of_match_ptr(davinci_mmc_dt_ids), &pdev->dev);
> > + u32 data;
> > +
> > + np = pdev->dev.of_node;
> > + if (!np)
> > + return pdata;
> > +
> > + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> > + if (!pdata) {
> > + dev_err(&pdev->dev, "Failed to allocate memory for struct davinci_mmc_config\n");
> > + goto nodata;
> > + }
> > +
> > + if (match->data)
> > + pdata->version = (u8)((int)match->data);
> > +
> > + of_property_read_u32(np, "max-frequency", &pdata->max_freq);
> > + if (!pdata->max_freq)
> > + dev_info(&pdev->dev, "'max-frequency' property not specified, defaulting to 25MHz\n");
> > +
> > + of_property_read_u32(np, "bus-width", &data);
> > + switch (data) {
> > + case 1:
> > + case 4:
> > + case 8:
> > + pdata->wires = data;
> > + break;
> > + default:
> > + pdata->wires = 1;
> > + dev_info(&pdev->dev, "Unsupported buswidth, defaulting to 1 bit\n");
> > + }
> > +nodata:
> > + return pdata;
> > +}
> > +
> > +static int __init davinci_mmcsd_probe(struct platform_device *pdev)
> > +{
> > + struct davinci_mmc_config *pdata = NULL;
> > struct mmc_davinci_host *host = NULL;
> > struct mmc_host *mmc = NULL;
> > struct resource *r, *mem = NULL;
> > int ret = 0, irq = 0;
> > size_t mem_size;
> >
> > - /* REVISIT: when we're fully converted, fail if pdata is NULL */
> > + pdata = mmc_parse_pdata(pdev);
> > + if (pdata == NULL) {
> > + dev_err(&pdev->dev, "Can not get platform data\n");
> > + return -ENOENT;
> > + }
> >
> > ret = -ENODEV;
> > r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > @@ -1408,6 +1468,7 @@ static struct platform_driver davinci_mmcsd_driver = {
> > .name = "davinci_mmc",
> > .owner = THIS_MODULE,
> > .pm = davinci_mmcsd_pm_ops,
> > + .of_match_table = of_match_ptr(davinci_mmc_dt_ids),
> > },
> > .remove = __exit_p(davinci_mmcsd_remove),
> > };
> > --
> > 1.7.4.1
> >
> > _______________________________________________
> > devicetree-discuss mailing list
> > devicetree-discuss@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/devicetree-discuss
> >
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-02-14 6:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-12 6:37 [PATCH v3 0/3] Add DT support for davinci_mmc driver Manjunathappa, Prakash
2013-02-12 6:37 ` [PATCH v3 1/3] mmc: davinci_mmc: add DT support Manjunathappa, Prakash
2013-02-12 11:00 ` Mark Rutland
2013-02-14 6:22 ` Manjunathappa, Prakash
2013-02-12 6:37 ` [PATCH v3 2/3] ARM: davinci: da850: add mmc DT entries Manjunathappa, Prakash
2013-02-12 6:37 ` [PATCH v3 3/3] ARM: davinci: da850: override mmc DT node device name Manjunathappa, Prakash
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).