linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] atmel-mci device tree support
@ 2012-03-21 18:03 ludovic.desroches at atmel.com
  2012-03-21 18:03 ` [PATCH 1/4] mmc: atmel-mci: add " ludovic.desroches at atmel.com
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-03-21 18:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This patch-set adds device tree support for atmel-mci.

Regards

Ludovic

 .../devicetree/bindings/mmc/atmel-hsmci.txt        |   55 +++++++++++++++
 arch/arm/boot/dts/at91sam9g25ek.dts                |   16 ++++
 arch/arm/boot/dts/at91sam9x5.dtsi                  |   14 ++++
 arch/arm/mach-at91/at91sam9x5.c                    |    2 +
 drivers/mmc/host/atmel-mci.c                       |   74 +++++++++++++++++++-
 5 files changed, 158 insertions(+), 3 deletions(-)
 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/4] mmc: atmel-mci: add device tree support
  2012-03-21 18:03 [PATCH 0/4] atmel-mci device tree support ludovic.desroches at atmel.com
@ 2012-03-21 18:03 ` ludovic.desroches at atmel.com
  2012-03-22 14:50   ` Nicolas Ferre
  2012-03-21 18:03 ` [PATCH 2/4] arm: at91: at91sam9x5 add mci clk_lookup ludovic.desroches at atmel.com
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-03-21 18:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 .../devicetree/bindings/mmc/atmel-hsmci.txt        |   55 +++++++++++++++
 drivers/mmc/host/atmel-mci.c                       |   74 +++++++++++++++++++-
 2 files changed, 126 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/atmel-hsmci.txt

diff --git a/Documentation/devicetree/bindings/mmc/atmel-hsmci.txt b/Documentation/devicetree/bindings/mmc/atmel-hsmci.txt
new file mode 100644
index 0000000..657f9de
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/atmel-hsmci.txt
@@ -0,0 +1,55 @@
+* Atmel High Speed MultiMedia Card Interface
+
+This controller on atmel products provides an interface for MMC, SD and SDIO
+types of memory cards.
+
+1) MCI node
+
+Required properties:
+- compatible: no blank "atmel,hsmci"
+- reg: should contain HSMCI registers location and length
+- interrupts: should contain HSMCI interrupt number
+- at least one slot node
+
+The node contains child nodes for each slot that the platform uses
+
+Example MCI node:
+
+mmc0: mmc at f0008000 {
+	compatible = "atmel,hsmci";
+	reg = <0xf0008000 0x600>;
+	interrupts = <12 4>;
+
+	[ child node definitions...]
+};
+
+2) slot nodes
+
+Optional properties:
+- bus-width: number of data lines connected to the controller
+- cd-gpios: specify GPIOs for card detection
+- cd-invert: invert the value of external card detect gpio line
+- wp-gpios: specify GPIOs for write protection
+
+Example slot node:
+
+slot at 0 {
+	bus-width = <4>;
+	cd-gpios = <&pioD 15 0>
+	cd-invert;
+};
+
+Example full MCI node:
+mmc0: mmc at f0008000 {
+	compatible = "atmel,hsmci";
+	reg = <0xf0008000 0x600>;
+	interrupts = <12 4>;
+	slot at 0 {
+		bus-width = <4>;
+		cd-gpios = <&pioD 15 0>
+		cd-invert;
+	};
+	slot at 1 {
+		bus-width = <4>;
+	};
+};
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index b5693fd..2d6a04a 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -19,6 +19,9 @@
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
 #include <linux/platform_device.h>
 #include <linux/scatterlist.h>
 #include <linux/seq_file.h>
@@ -477,6 +480,54 @@ err:
 	dev_err(&mmc->class_dev, "failed to initialize debugfs for slot\n");
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id atmci_dt_ids[] = {
+	{ .compatible = "atmel,hsmci" },
+	{ /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmci_dt_ids);
+
+static void __init
+atmci_get_of_slots(struct device *dev, struct mci_platform_data *pdata)
+{
+	struct device_node *np = dev->of_node;
+	struct device_node *cnp;
+	unsigned int slot_nb = 0;
+
+	if (!np)
+		return;
+
+	for_each_child_of_node(np, cnp) {
+		if (slot_nb > (ATMCI_MAX_NR_SLOTS-1)) {
+			dev_warn(dev, "can't have more than %d slots\n",
+			         ATMCI_MAX_NR_SLOTS);
+			break;
+		}
+		if (of_property_read_u32(cnp, "bus-width",
+		                         &pdata->slot[slot_nb].bus_width))
+			pdata->slot[slot_nb].bus_width = 1;
+
+		pdata->slot[slot_nb].detect_pin =
+			of_get_named_gpio(cnp, "cd-gpios", 0);
+
+		if (of_find_property(cnp, "cd-invert", NULL))
+			pdata->slot[slot_nb].detect_is_active_high = true;
+
+		pdata->slot[slot_nb].wp_pin =
+			of_get_named_gpio(cnp, "wp-gpios", 0);
+
+		slot_nb++;
+	}
+}
+#else /* CONFIG_OF */
+static inline void
+atmci_get_of_slots(struct device *dev, struct mci_platform_data *pdata)
+{
+	return;
+}
+#endif
+
 static inline unsigned int atmci_ns_to_clocks(struct atmel_mci *host,
 					unsigned int ns)
 {
@@ -1847,6 +1898,13 @@ static int __init atmci_init_slot(struct atmel_mci *host,
 	slot->sdc_reg = sdc_reg;
 	slot->sdio_irq = sdio_irq;
 
+	dev_dbg(&mmc->class_dev,
+	        "slot[%u]: bus_width=%u, detect_pin=%d, "
+		"detect_is_active_high=%s, wp_pin=%d\n",
+		id, slot_data->bus_width, slot_data->detect_pin,
+		slot_data->detect_is_active_high ? "true" : "false",
+		slot_data->wp_pin);
+
 	mmc->ops = &atmci_ops;
 	mmc->f_min = DIV_ROUND_UP(host->bus_hz, 512);
 	mmc->f_max = host->bus_hz / 2;
@@ -2047,9 +2105,17 @@ static int __init atmci_probe(struct platform_device *pdev)
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!regs)
 		return -ENXIO;
-	pdata = pdev->dev.platform_data;
-	if (!pdata)
-		return -ENXIO;
+
+	if (pdev->dev.of_node) {
+		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+		if (!pdata)
+			return -ENOMEM;
+	} else {
+		pdata = pdev->dev.platform_data;
+		if (!pdata)
+			return -ENXIO;
+	}
+
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
 		return irq;
@@ -2109,6 +2175,7 @@ static int __init atmci_probe(struct platform_device *pdev)
 	/* We need@least one slot to succeed */
 	nr_slots = 0;
 	ret = -ENODEV;
+	atmci_get_of_slots(&pdev->dev, pdata);
 	if (pdata->slot[0].bus_width) {
 		ret = atmci_init_slot(host, &pdata->slot[0],
 				0, ATMCI_SDCSEL_SLOT_A, ATMCI_SDIOIRQA);
@@ -2242,6 +2309,7 @@ static struct platform_driver atmci_driver = {
 	.driver		= {
 		.name		= "atmel_mci",
 		.pm		= ATMCI_PM_OPS,
+		.of_match_table	= of_match_ptr(atmci_dt_ids),
 	},
 };
 
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/4] arm: at91: at91sam9x5 add mci clk_lookup
  2012-03-21 18:03 [PATCH 0/4] atmel-mci device tree support ludovic.desroches at atmel.com
  2012-03-21 18:03 ` [PATCH 1/4] mmc: atmel-mci: add " ludovic.desroches at atmel.com
@ 2012-03-21 18:03 ` ludovic.desroches at atmel.com
  2012-03-22 14:51   ` Nicolas Ferre
  2012-03-21 18:03 ` [PATCH 3/4] arm: at91: dt: sam9x5 add mci support ludovic.desroches at atmel.com
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-03-21 18:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/mach-at91/at91sam9x5.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
index 13c8cae..39cbef3 100644
--- a/arch/arm/mach-at91/at91sam9x5.c
+++ b/arch/arm/mach-at91/at91sam9x5.c
@@ -225,6 +225,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
 	CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
+	CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc0_clk),
+	CLKDEV_CON_DEV_ID("mci_clk", "f000c000.mmc", &mmc1_clk),
 	CLKDEV_CON_ID("pioA", &pioAB_clk),
 	CLKDEV_CON_ID("pioB", &pioAB_clk),
 	CLKDEV_CON_ID("pioC", &pioCD_clk),
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/4] arm: at91: dt: sam9x5 add mci support
  2012-03-21 18:03 [PATCH 0/4] atmel-mci device tree support ludovic.desroches at atmel.com
  2012-03-21 18:03 ` [PATCH 1/4] mmc: atmel-mci: add " ludovic.desroches at atmel.com
  2012-03-21 18:03 ` [PATCH 2/4] arm: at91: at91sam9x5 add mci clk_lookup ludovic.desroches at atmel.com
@ 2012-03-21 18:03 ` ludovic.desroches at atmel.com
  2012-03-22 14:52   ` Nicolas Ferre
  2012-03-21 18:03 ` [PATCH 4/4] arm: at91: dt: sam9g25ek " ludovic.desroches at atmel.com
  2012-04-01  3:49 ` [PATCH 0/4] atmel-mci device tree support Chris Ball
  4 siblings, 1 reply; 13+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-03-21 18:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/boot/dts/at91sam9x5.dtsi |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
index c111001..5846f99 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -191,6 +191,20 @@
 				interrupts = <27 4>;
 				status = "disabled";
 			};
+
+			mmc0: mmc at f0008000 {
+				compatible = "atmel,hsmci";
+				reg = <0xf0008000 0x600>;
+				interrupts = <12 4>;
+				status = "disabled";
+			};
+
+			mmc1: mmc at f000c000 {
+				compatible = "atmel,hsmci";
+				reg = <0xf000c000 0x600>;
+				interrupts = <26 4>;
+				status = "disabled";
+			};
 		};
 
 		nand0: nand at 40000000 {
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/4] arm: at91: dt: sam9g25ek add mci support
  2012-03-21 18:03 [PATCH 0/4] atmel-mci device tree support ludovic.desroches at atmel.com
                   ` (2 preceding siblings ...)
  2012-03-21 18:03 ` [PATCH 3/4] arm: at91: dt: sam9x5 add mci support ludovic.desroches at atmel.com
@ 2012-03-21 18:03 ` ludovic.desroches at atmel.com
  2012-03-22 14:53   ` Nicolas Ferre
  2012-04-01  3:49 ` [PATCH 0/4] atmel-mci device tree support Chris Ball
  4 siblings, 1 reply; 13+ messages in thread
From: ludovic.desroches at atmel.com @ 2012-03-21 18:03 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
---
 arch/arm/boot/dts/at91sam9g25ek.dts |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
index 7a13d09..960de2b 100644
--- a/arch/arm/boot/dts/at91sam9g25ek.dts
+++ b/arch/arm/boot/dts/at91sam9g25ek.dts
@@ -32,6 +32,22 @@
 				phy-mode = "rmii";
 				status = "okay";
 			};
+
+			mmc0: mmc at f0008000 {
+				status = "okay";
+				slot at 0 {
+					bus-width = <4>;
+					cd-gpios = <&pioD 15 0>;
+				};
+			};
+
+			mmc1: mmc at f000c000 {
+				status = "okay";
+				slot at 0 {
+					bus-width = <4>;
+					cd-gpios = <&pioD 14 0>;
+				};
+			};
 		};
 
 		usb0: ohci at 00600000 {
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 1/4] mmc: atmel-mci: add device tree support
  2012-03-21 18:03 ` [PATCH 1/4] mmc: atmel-mci: add " ludovic.desroches at atmel.com
@ 2012-03-22 14:50   ` Nicolas Ferre
  2012-03-23 10:38     ` Ludovic Desroches
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Ferre @ 2012-03-22 14:50 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/21/2012 07:03 PM, ludovic.desroches at atmel.com :
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  .../devicetree/bindings/mmc/atmel-hsmci.txt        |   55 +++++++++++++++
>  drivers/mmc/host/atmel-mci.c                       |   74 +++++++++++++++++++-
>  2 files changed, 126 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/mmc/atmel-hsmci.txt
> 
> diff --git a/Documentation/devicetree/bindings/mmc/atmel-hsmci.txt b/Documentation/devicetree/bindings/mmc/atmel-hsmci.txt
> new file mode 100644
> index 0000000..657f9de
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mmc/atmel-hsmci.txt
> @@ -0,0 +1,55 @@
> +* Atmel High Speed MultiMedia Card Interface
> +
> +This controller on atmel products provides an interface for MMC, SD and SDIO
> +types of memory cards.
> +
> +1) MCI node
> +
> +Required properties:
> +- compatible: no blank "atmel,hsmci"
> +- reg: should contain HSMCI registers location and length
> +- interrupts: should contain HSMCI interrupt number
> +- at least one slot node
> +
> +The node contains child nodes for each slot that the platform uses
> +
> +Example MCI node:
> +
> +mmc0: mmc at f0008000 {
> +	compatible = "atmel,hsmci";
> +	reg = <0xf0008000 0x600>;
> +	interrupts = <12 4>;
> +
> +	[ child node definitions...]
> +};
> +
> +2) slot nodes
> +
> +Optional properties:
> +- bus-width: number of data lines connected to the controller
> +- cd-gpios: specify GPIOs for card detection
> +- cd-invert: invert the value of external card detect gpio line
> +- wp-gpios: specify GPIOs for write protection
> +
> +Example slot node:
> +
> +slot at 0 {
> +	bus-width = <4>;
> +	cd-gpios = <&pioD 15 0>
> +	cd-invert;
> +};
> +
> +Example full MCI node:
> +mmc0: mmc at f0008000 {
> +	compatible = "atmel,hsmci";
> +	reg = <0xf0008000 0x600>;
> +	interrupts = <12 4>;
> +	slot at 0 {
> +		bus-width = <4>;
> +		cd-gpios = <&pioD 15 0>
> +		cd-invert;
> +	};
> +	slot at 1 {
> +		bus-width = <4>;
> +	};
> +};
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index b5693fd..2d6a04a 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -19,6 +19,9 @@
>  #include <linux/interrupt.h>
>  #include <linux/ioport.h>
>  #include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/of_gpio.h>
>  #include <linux/platform_device.h>
>  #include <linux/scatterlist.h>
>  #include <linux/seq_file.h>
> @@ -477,6 +480,54 @@ err:
>  	dev_err(&mmc->class_dev, "failed to initialize debugfs for slot\n");
>  }
>  
> +#if defined(CONFIG_OF)
> +static const struct of_device_id atmci_dt_ids[] = {
> +	{ .compatible = "atmel,hsmci" },
> +	{ /* sentinel */ }
> +};
> +
> +MODULE_DEVICE_TABLE(of, atmci_dt_ids);
> +
> +static void __init
> +atmci_get_of_slots(struct device *dev, struct mci_platform_data *pdata)
> +{
> +	struct device_node *np = dev->of_node;
> +	struct device_node *cnp;
> +	unsigned int slot_nb = 0;
> +
> +	if (!np)
> +		return;
> +
> +	for_each_child_of_node(np, cnp) {
> +		if (slot_nb > (ATMCI_MAX_NR_SLOTS-1)) {
> +			dev_warn(dev, "can't have more than %d slots\n",
> +			         ATMCI_MAX_NR_SLOTS);
> +			break;
> +		}
> +		if (of_property_read_u32(cnp, "bus-width",
> +		                         &pdata->slot[slot_nb].bus_width))
> +			pdata->slot[slot_nb].bus_width = 1;
> +
> +		pdata->slot[slot_nb].detect_pin =
> +			of_get_named_gpio(cnp, "cd-gpios", 0);
> +
> +		if (of_find_property(cnp, "cd-invert", NULL))
> +			pdata->slot[slot_nb].detect_is_active_high = true;
> +
> +		pdata->slot[slot_nb].wp_pin =
> +			of_get_named_gpio(cnp, "wp-gpios", 0);
> +
> +		slot_nb++;
> +	}
> +}
> +#else /* CONFIG_OF */
> +static inline void
> +atmci_get_of_slots(struct device *dev, struct mci_platform_data *pdata)
> +{
> +	return;
> +}
> +#endif
> +
>  static inline unsigned int atmci_ns_to_clocks(struct atmel_mci *host,
>  					unsigned int ns)
>  {
> @@ -1847,6 +1898,13 @@ static int __init atmci_init_slot(struct atmel_mci *host,
>  	slot->sdc_reg = sdc_reg;
>  	slot->sdio_irq = sdio_irq;
>  
> +	dev_dbg(&mmc->class_dev,
> +	        "slot[%u]: bus_width=%u, detect_pin=%d, "
> +		"detect_is_active_high=%s, wp_pin=%d\n",
> +		id, slot_data->bus_width, slot_data->detect_pin,
> +		slot_data->detect_is_active_high ? "true" : "false",
> +		slot_data->wp_pin);
> +
>  	mmc->ops = &atmci_ops;
>  	mmc->f_min = DIV_ROUND_UP(host->bus_hz, 512);
>  	mmc->f_max = host->bus_hz / 2;
> @@ -2047,9 +2105,17 @@ static int __init atmci_probe(struct platform_device *pdev)
>  	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	if (!regs)
>  		return -ENXIO;
> -	pdata = pdev->dev.platform_data;
> -	if (!pdata)
> -		return -ENXIO;
> +
> +	if (pdev->dev.of_node) {
> +		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> +		if (!pdata)
> +			return -ENOMEM;
> +	} else {
> +		pdata = pdev->dev.platform_data;
> +		if (!pdata)
> +			return -ENXIO;
> +	}
> +
>  	irq = platform_get_irq(pdev, 0);
>  	if (irq < 0)
>  		return irq;
> @@ -2109,6 +2175,7 @@ static int __init atmci_probe(struct platform_device *pdev)
>  	/* We need at least one slot to succeed */
>  	nr_slots = 0;
>  	ret = -ENODEV;
> +	atmci_get_of_slots(&pdev->dev, pdata);
>  	if (pdata->slot[0].bus_width) {
>  		ret = atmci_init_slot(host, &pdata->slot[0],
>  				0, ATMCI_SDCSEL_SLOT_A, ATMCI_SDIOIRQA);
> @@ -2242,6 +2309,7 @@ static struct platform_driver atmci_driver = {
>  	.driver		= {
>  		.name		= "atmel_mci",
>  		.pm		= ATMCI_PM_OPS,
> +		.of_match_table	= of_match_ptr(atmci_dt_ids),
>  	},
>  };
>  


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 2/4] arm: at91: at91sam9x5 add mci clk_lookup
  2012-03-21 18:03 ` [PATCH 2/4] arm: at91: at91sam9x5 add mci clk_lookup ludovic.desroches at atmel.com
@ 2012-03-22 14:51   ` Nicolas Ferre
  0 siblings, 0 replies; 13+ messages in thread
From: Nicolas Ferre @ 2012-03-22 14:51 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/21/2012 07:03 PM, ludovic.desroches at atmel.com :
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  arch/arm/mach-at91/at91sam9x5.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/at91sam9x5.c b/arch/arm/mach-at91/at91sam9x5.c
> index 13c8cae..39cbef3 100644
> --- a/arch/arm/mach-at91/at91sam9x5.c
> +++ b/arch/arm/mach-at91/at91sam9x5.c
> @@ -225,6 +225,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
>  	CLKDEV_CON_DEV_ID("t0_clk", "f800c000.timer", &tcb0_clk),
>  	CLKDEV_CON_DEV_ID("dma_clk", "ffffec00.dma-controller", &dma0_clk),
>  	CLKDEV_CON_DEV_ID("dma_clk", "ffffee00.dma-controller", &dma1_clk),
> +	CLKDEV_CON_DEV_ID("mci_clk", "f0008000.mmc", &mmc0_clk),
> +	CLKDEV_CON_DEV_ID("mci_clk", "f000c000.mmc", &mmc1_clk),
>  	CLKDEV_CON_ID("pioA", &pioAB_clk),
>  	CLKDEV_CON_ID("pioB", &pioAB_clk),
>  	CLKDEV_CON_ID("pioC", &pioCD_clk),


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 3/4] arm: at91: dt: sam9x5 add mci support
  2012-03-21 18:03 ` [PATCH 3/4] arm: at91: dt: sam9x5 add mci support ludovic.desroches at atmel.com
@ 2012-03-22 14:52   ` Nicolas Ferre
  0 siblings, 0 replies; 13+ messages in thread
From: Nicolas Ferre @ 2012-03-22 14:52 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/21/2012 07:03 PM, ludovic.desroches at atmel.com :
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  arch/arm/boot/dts/at91sam9x5.dtsi |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi b/arch/arm/boot/dts/at91sam9x5.dtsi
> index c111001..5846f99 100644
> --- a/arch/arm/boot/dts/at91sam9x5.dtsi
> +++ b/arch/arm/boot/dts/at91sam9x5.dtsi
> @@ -191,6 +191,20 @@
>  				interrupts = <27 4>;
>  				status = "disabled";
>  			};
> +
> +			mmc0: mmc at f0008000 {
> +				compatible = "atmel,hsmci";
> +				reg = <0xf0008000 0x600>;
> +				interrupts = <12 4>;
> +				status = "disabled";
> +			};
> +
> +			mmc1: mmc at f000c000 {
> +				compatible = "atmel,hsmci";
> +				reg = <0xf000c000 0x600>;
> +				interrupts = <26 4>;
> +				status = "disabled";
> +			};
>  		};
>  
>  		nand0: nand at 40000000 {


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 4/4] arm: at91: dt: sam9g25ek add mci support
  2012-03-21 18:03 ` [PATCH 4/4] arm: at91: dt: sam9g25ek " ludovic.desroches at atmel.com
@ 2012-03-22 14:53   ` Nicolas Ferre
  2012-03-24 19:10     ` Grant Likely
  0 siblings, 1 reply; 13+ messages in thread
From: Nicolas Ferre @ 2012-03-22 14:53 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/21/2012 07:03 PM, ludovic.desroches at atmel.com :
> From: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  arch/arm/boot/dts/at91sam9g25ek.dts |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
> index 7a13d09..960de2b 100644
> --- a/arch/arm/boot/dts/at91sam9g25ek.dts
> +++ b/arch/arm/boot/dts/at91sam9g25ek.dts
> @@ -32,6 +32,22 @@
>  				phy-mode = "rmii";
>  				status = "okay";
>  			};
> +
> +			mmc0: mmc at f0008000 {
> +				status = "okay";
> +				slot at 0 {
> +					bus-width = <4>;
> +					cd-gpios = <&pioD 15 0>;
> +				};
> +			};
> +
> +			mmc1: mmc at f000c000 {
> +				status = "okay";
> +				slot at 0 {
> +					bus-width = <4>;
> +					cd-gpios = <&pioD 14 0>;
> +				};
> +			};
>  		};
>  
>  		usb0: ohci at 00600000 {


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/4] mmc: atmel-mci: add device tree support
  2012-03-22 14:50   ` Nicolas Ferre
@ 2012-03-23 10:38     ` Ludovic Desroches
  0 siblings, 0 replies; 13+ messages in thread
From: Ludovic Desroches @ 2012-03-23 10:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Mar 22, 2012 at 03:50:48PM +0100, Nicolas Ferre wrote:
> On 03/21/2012 07:03 PM, ludovic.desroches at atmel.com :

[...]

> > diff --git a/Documentation/devicetree/bindings/mmc/atmel-hsmci.txt b/Documentation/devicetree/bindings/mmc/atmel-hsmci.txt
> > new file mode 100644
> > index 0000000..657f9de
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mmc/atmel-hsmci.txt
> > @@ -0,0 +1,55 @@
> > +* Atmel High Speed MultiMedia Card Interface
> > +
> > +This controller on atmel products provides an interface for MMC, SD and SDIO
> > +types of memory cards.
> > +
> > +1) MCI node
> > +
> > +Required properties:
> > +- compatible: no blank "atmel,hsmci"
> > +- reg: should contain HSMCI registers location and length
> > +- interrupts: should contain HSMCI interrupt number
> > +- at least one slot node
> > +
> > +The node contains child nodes for each slot that the platform uses
> > +
> > +Example MCI node:
> > +
> > +mmc0: mmc at f0008000 {
> > +	compatible = "atmel,hsmci";
> > +	reg = <0xf0008000 0x600>;
> > +	interrupts = <12 4>;
> > +
> > +	[ child node definitions...]
> > +};
> > +
> > +2) slot nodes
> > +
> > +Optional properties:
> > +- bus-width: number of data lines connected to the controller
> > +- cd-gpios: specify GPIOs for card detection
> > +- cd-invert: invert the value of external card detect gpio line
> > +- wp-gpios: specify GPIOs for write protection
> > +
> > +Example slot node:
> > +
> > +slot at 0 {
> > +	bus-width = <4>;
> > +	cd-gpios = <&pioD 15 0>
> > +	cd-invert;
> > +};
> > +
> > +Example full MCI node:
> > +mmc0: mmc at f0008000 {
> > +	compatible = "atmel,hsmci";
> > +	reg = <0xf0008000 0x600>;
> > +	interrupts = <12 4>;
> > +	slot at 0 {
> > +		bus-width = <4>;
> > +		cd-gpios = <&pioD 15 0>
> > +		cd-invert;
> > +	};
> > +	slot at 1 {
> > +		bus-width = <4>;
> > +	};
> > +};

[...]

> > +static void __init
> > +atmci_get_of_slots(struct device *dev, struct mci_platform_data *pdata)
> > +{
> > +	struct device_node *np = dev->of_node;
> > +	struct device_node *cnp;
> > +	unsigned int slot_nb = 0;
> > +
> > +	if (!np)
> > +		return;
> > +
> > +	for_each_child_of_node(np, cnp) {
> > +		if (slot_nb > (ATMCI_MAX_NR_SLOTS-1)) {
> > +			dev_warn(dev, "can't have more than %d slots\n",
> > +			         ATMCI_MAX_NR_SLOTS);
> > +			break;
> > +		}
> > +		if (of_property_read_u32(cnp, "bus-width",
> > +		                         &pdata->slot[slot_nb].bus_width))
> > +			pdata->slot[slot_nb].bus_width = 1;
> > +
> > +		pdata->slot[slot_nb].detect_pin =
> > +			of_get_named_gpio(cnp, "cd-gpios", 0);
> > +
> > +		if (of_find_property(cnp, "cd-invert", NULL))
> > +			pdata->slot[slot_nb].detect_is_active_high = true;
> > +
> > +		pdata->slot[slot_nb].wp_pin =
> > +			of_get_named_gpio(cnp, "wp-gpios", 0);
> > +
> > +		slot_nb++;
> > +	}
> > +}

In fact this part of code is not correct. Each mci can have two slots: slot0
and slot1. If someone wants to use only slot1, I will fill only pdata->slot[0]
that is incorrect because later in the driver there is:

if (pdata->slot[0].bus_width) {
	ret = atmci_init_slot(host, &pdata->slot[0], 
			0, ATMCI_SDCSEL_SLOT_A, ATMCI_SDIOIRQA);
	if (!ret)
		nr_slots++;
}
if (pdata->slot[1].bus_width) {
	ret = atmci_init_slot(host, &pdata->slot[1],
			1, ATMCI_SDCSEL_SLOT_B, ATMCI_SDIOIRQB);
	if (!ret)
		nr_slots++;
}

So what is the best solution to solve this issue?

- Adding a property slot id? I would like to use only existing bindings hoping 
we can have a generic binding for mmc.

- Using aliases?
aliases {
	slot0 = &mmc-slot0;
}

mmc0: mmc at f0008000 {
	compatible = "atmel,hsmci";
	reg = <0xf0008000 0x600>;
	interrupts = <12 4>;              
	mmc-slot0: slot at 0 {
	};                                                                
	status = "disabled";
};

- Using reg property as an index?


Thanks for your help.

Regards

Ludovic

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 4/4] arm: at91: dt: sam9g25ek add mci support
  2012-03-22 14:53   ` Nicolas Ferre
@ 2012-03-24 19:10     ` Grant Likely
  0 siblings, 0 replies; 13+ messages in thread
From: Grant Likely @ 2012-03-24 19:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 22 Mar 2012 15:53:01 +0100, Nicolas Ferre <nicolas.ferre@atmel.com> wrote:
> On 03/21/2012 07:03 PM, ludovic.desroches at atmel.com :
> > From: Ludovic Desroches <ludovic.desroches@atmel.com>
> > 
> > Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
> 
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

I think you really mean "Acked-by".  It is only appropriate to add a
"Signed-off-by" tag when you have actually picked up and either
committed or reposted a patch.  When replying to a patch on the
mailing list and giving your okay, the correct tag is either
"Acked-by" or "Reviewed-by"  (The difference being that "Acked-by"
infers that you have some authority over the areas touched by the
patch).

See Documentation/SubmittingPatches

g.

> 
> > ---
> >  arch/arm/boot/dts/at91sam9g25ek.dts |   16 ++++++++++++++++
> >  1 files changed, 16 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/at91sam9g25ek.dts b/arch/arm/boot/dts/at91sam9g25ek.dts
> > index 7a13d09..960de2b 100644
> > --- a/arch/arm/boot/dts/at91sam9g25ek.dts
> > +++ b/arch/arm/boot/dts/at91sam9g25ek.dts
> > @@ -32,6 +32,22 @@
> >  				phy-mode = "rmii";
> >  				status = "okay";
> >  			};
> > +
> > +			mmc0: mmc at f0008000 {
> > +				status = "okay";
> > +				slot at 0 {
> > +					bus-width = <4>;
> > +					cd-gpios = <&pioD 15 0>;
> > +				};
> > +			};
> > +
> > +			mmc1: mmc at f000c000 {
> > +				status = "okay";
> > +				slot at 0 {
> > +					bus-width = <4>;
> > +					cd-gpios = <&pioD 14 0>;
> > +				};
> > +			};
> >  		};
> >  
> >  		usb0: ohci at 00600000 {
> 
> 
> -- 
> Nicolas Ferre
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 0/4] atmel-mci device tree support
  2012-03-21 18:03 [PATCH 0/4] atmel-mci device tree support ludovic.desroches at atmel.com
                   ` (3 preceding siblings ...)
  2012-03-21 18:03 ` [PATCH 4/4] arm: at91: dt: sam9g25ek " ludovic.desroches at atmel.com
@ 2012-04-01  3:49 ` Chris Ball
  2012-04-02  6:51   ` Ludovic Desroches
  4 siblings, 1 reply; 13+ messages in thread
From: Chris Ball @ 2012-04-01  3:49 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Wed, Mar 21 2012, ludovic.desroches at atmel.com wrote:
> Hi,
>
> This patch-set adds device tree support for atmel-mci.

Please can you resend after syncing up with Arnd's suggestions in:
   http://thread.gmane.org/gmane.linux.kernel.samsung-soc/9216/focus=13659

(It looks like the main difference is just s/cd-invert;/cd-inverted;/.)

Thanks,

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 0/4] atmel-mci device tree support
  2012-04-01  3:49 ` [PATCH 0/4] atmel-mci device tree support Chris Ball
@ 2012-04-02  6:51   ` Ludovic Desroches
  0 siblings, 0 replies; 13+ messages in thread
From: Ludovic Desroches @ 2012-04-02  6:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Chris,

On Sat, Mar 31, 2012 at 11:49:19PM -0400, Chris Ball wrote:
> Hi,
> 
> On Wed, Mar 21 2012, ludovic.desroches at atmel.com wrote:
> > Hi,
> >
> > This patch-set adds device tree support for atmel-mci.
> 
> Please can you resend after syncing up with Arnd's suggestions in:
>    http://thread.gmane.org/gmane.linux.kernel.samsung-soc/9216/focus=13659
> 
> (It looks like the main difference is just s/cd-invert;/cd-inverted;/.)

I have already sent a v2 version. I will send the v3 version once a decision
about bindings would be taken.

I think the cd-invert (or cd-inverted) property will be removed since we can
get the information with gpio flags.

> 
> Thanks,
> 
> - Chris.
> -- 
> Chris Ball   <cjb@laptop.org>   <http://printf.net/>
> One Laptop Per Child
> 

Regards

Ludovic

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-04-02  6:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-21 18:03 [PATCH 0/4] atmel-mci device tree support ludovic.desroches at atmel.com
2012-03-21 18:03 ` [PATCH 1/4] mmc: atmel-mci: add " ludovic.desroches at atmel.com
2012-03-22 14:50   ` Nicolas Ferre
2012-03-23 10:38     ` Ludovic Desroches
2012-03-21 18:03 ` [PATCH 2/4] arm: at91: at91sam9x5 add mci clk_lookup ludovic.desroches at atmel.com
2012-03-22 14:51   ` Nicolas Ferre
2012-03-21 18:03 ` [PATCH 3/4] arm: at91: dt: sam9x5 add mci support ludovic.desroches at atmel.com
2012-03-22 14:52   ` Nicolas Ferre
2012-03-21 18:03 ` [PATCH 4/4] arm: at91: dt: sam9g25ek " ludovic.desroches at atmel.com
2012-03-22 14:53   ` Nicolas Ferre
2012-03-24 19:10     ` Grant Likely
2012-04-01  3:49 ` [PATCH 0/4] atmel-mci device tree support Chris Ball
2012-04-02  6:51   ` Ludovic Desroches

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).