Re: [PATCH v5] mmc: sdhci-s3c: Add device tree support

2012-09-17 Thread Thomas Abraham
On 23 August 2012 22:40, Thomas Abraham thomas.abra...@linaro.org wrote:
 Add device tree based discovery support for Samsung's sdhci controller

 Cc: Ben Dooks ben-li...@fluff.org
 Cc: Kukjin Kim kgene@samsung.com
 Cc: Chris Ball c...@laptop.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 Changes since v4:
 Adapted to new mmc core card detection bindings as specfied in the patch:
 [PATCH] mmc: dt: Add card-detection properties to core binding
 and extends it samsung,cd-pinmux-gpio property as suggested by
 Mitch Bradley w...@firmworks.com

 Changes since v3:

 The patch series that adds device tree support for Samsung sdhci controller
 had six patches in total, of which, the first five patches have been accepted.
 The sixth patch in the series was dropped since it was using custom Samsung
 properties for descrbing the bus-width and card-detect gpio, but had otherwise
 addressed all the comments.

 This patch reworks the sixth patch in v3 of the sdhci device tree support
 patch series. The only change in this patch from the v3 version is the use of
 generic mmc bindings for descrbing the bus-width and card-detect gpio.

  .../devicetree/bindings/mmc/samsung-sdhci.txt  |   53 +++
  drivers/mmc/host/sdhci-s3c.c   |  162 
 +++-
  2 files changed, 209 insertions(+), 6 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/samsung-sdhci.txt

Hi Chris,

This patch adds device tree support for sdhci-s3c driver. All the
comments for this patch has been addressed. Can this be queued for
v3.7?

Thanks,
Thomas.



 diff --git a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt 
 b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
 new file mode 100644
 index 000..361c2ee
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
 @@ -0,0 +1,53 @@
 +* Samsung's SDHCI Controller device tree bindings
 +
 +Samsung's SDHCI controller is used as a connectivity interface with external
 +MMC, SD and eMMC storage mediums. This file documents differences between the
 +core mmc properties described by mmc.txt and the properties used by the
 +Samsung implmentation of the SDHCI controller.
 +
 +Note: The mmc core bindings documentation states that if none of the core
 +card-detect bindings are used, then the standard sdhci card detect mechanism
 +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
 +controller.
 +  - samsung,exynos4210-sdhci: For controllers compatible with Exynos4 sdhci
 +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.
 +
 +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.
 +
 +Example:
 +   sdhci@1253 {
 +   compatible = samsung,exynos4210-sdhci;
 +   reg = 0x1253 0x100;
 +   interrupts = 0 75 0;
 +   bus-width = 4;
 +   cd-gpios = gpk2 2 2 3 3;
 +   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 */
 +   };
 +
 +   Note: This example shows both SoC specific and board specific 
 properties
 +   in a single device node. The properties can be actually be seperated
 +   into SoC specific node and board specific node.
 diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
 index a50c205..445910e 100644
 --- a/drivers/mmc/host/sdhci-s3c.c
 +++ b/drivers/mmc/host/sdhci-s3c.c
 @@ -34,6 +34,9 @@

  #define MAX_BUS_CLK(4)

 +/* Number of gpio's used is max data bus width + command and clock lines */
 +#define NUM_GPIOS(x)   (x + 2)
 +
  /**
   * struct sdhci_s3c - S3C SDHCI instance
   * @host: The SDHCI host created
 @@ -41,6 +44,7 @@
   * @ioarea: The resource created when we claimed the IO area.
   * @pdata: The platform data for this controller.
   * @cur_clk: The index of the current bus clock.
 + * @gpios: List of gpio numbers parsed from device tree.
   * 

Re: [PATCH v5] mmc: sdhci-s3c: Add device tree support

2012-09-17 Thread Chris Ball
Hi,

On Mon, Sep 17 2012, Thomas Abraham wrote:
 On 23 August 2012 22:40, Thomas Abraham thomas.abra...@linaro.org wrote:
 Add device tree based discovery support for Samsung's sdhci controller

 Cc: Ben Dooks ben-li...@fluff.org
 Cc: Kukjin Kim kgene@samsung.com
 Cc: Chris Ball c...@laptop.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 Changes since v4:
 Adapted to new mmc core card detection bindings as specfied in the patch:
 [PATCH] mmc: dt: Add card-detection properties to core binding
 and extends it samsung,cd-pinmux-gpio property as suggested by
 Mitch Bradley w...@firmworks.com

 Changes since v3:

 The patch series that adds device tree support for Samsung sdhci controller
 had six patches in total, of which, the first five patches have been 
 accepted.
 The sixth patch in the series was dropped since it was using custom Samsung
 properties for descrbing the bus-width and card-detect gpio, but had 
 otherwise
 addressed all the comments.

 This patch reworks the sixth patch in v3 of the sdhci device tree support
 patch series. The only change in this patch from the v3 version is the use of
 generic mmc bindings for descrbing the bus-width and card-detect gpio.

  .../devicetree/bindings/mmc/samsung-sdhci.txt  |   53 +++
  drivers/mmc/host/sdhci-s3c.c   |  162 
 +++-
  2 files changed, 209 insertions(+), 6 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/samsung-sdhci.txt

 Hi Chris,

 This patch adds device tree support for sdhci-s3c driver. All the
 comments for this patch has been addressed. Can this be queued for
 v3.7?

Yes, sounds good.  Jaehoon, perhaps you could give your Reviewed-by
for me to add to the patch?  I've pushed this to mmc-next for 3.7
now, after adding Jaehoon's else-if suggestion that wasn't acted on:

diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index 3d91c7a..0c77b10 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -461,22 +461,18 @@ static int __devinit sdhci_s3c_parse_dt(struct device 
*dev,
if (gpio_is_valid(gpio)) {
pdata-cd_type = S3C_SDHCI_CD_GPIO;
goto found_cd;
-   } else {
-   if (gpio != -ENOENT) {
-   dev_err(dev, invalid card detect gpio specified\n);
-   return -EINVAL;
-   }
+   } else if (gpio != -ENOENT) {
+   dev_err(dev, invalid card detect gpio specified\n);
+   return -EINVAL;
}
 
gpio = of_get_named_gpio(node, samsung,cd-pinmux-gpio, 0);
if (gpio_is_valid(gpio)) {
pdata-cd_type = S3C_SDHCI_CD_INTERNAL;
goto found_cd;
-   } else {
-   if (gpio != -ENOENT) {
-   dev_err(dev, invalid card detect gpio specified\n);
-   return -EINVAL;
-   }
+   } else if (gpio != -ENOENT) {
+   dev_err(dev, invalid card detect gpio specified\n);
+   return -EINVAL;
}
 
dev_info(dev, assuming no card detect line available\n);

Thanks,

- Chris.
-- 
Chris Ball   c...@laptop.org   http://printf.net/
One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5] mmc: sdhci-s3c: Add device tree support

2012-09-17 Thread Thomas Abraham
On 18 September 2012 09:20, Chris Ball c...@laptop.org wrote:
 Hi,

 On Mon, Sep 17 2012, Thomas Abraham wrote:
 On 23 August 2012 22:40, Thomas Abraham thomas.abra...@linaro.org wrote:
 Add device tree based discovery support for Samsung's sdhci controller

 Cc: Ben Dooks ben-li...@fluff.org
 Cc: Kukjin Kim kgene@samsung.com
 Cc: Chris Ball c...@laptop.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 Changes since v4:
 Adapted to new mmc core card detection bindings as specfied in the patch:
 [PATCH] mmc: dt: Add card-detection properties to core binding
 and extends it samsung,cd-pinmux-gpio property as suggested by
 Mitch Bradley w...@firmworks.com

 Changes since v3:

 The patch series that adds device tree support for Samsung sdhci controller
 had six patches in total, of which, the first five patches have been 
 accepted.
 The sixth patch in the series was dropped since it was using custom Samsung
 properties for descrbing the bus-width and card-detect gpio, but had 
 otherwise
 addressed all the comments.

 This patch reworks the sixth patch in v3 of the sdhci device tree support
 patch series. The only change in this patch from the v3 version is the use 
 of
 generic mmc bindings for descrbing the bus-width and card-detect gpio.

  .../devicetree/bindings/mmc/samsung-sdhci.txt  |   53 +++
  drivers/mmc/host/sdhci-s3c.c   |  162 
 +++-
  2 files changed, 209 insertions(+), 6 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/samsung-sdhci.txt

 Hi Chris,

 This patch adds device tree support for sdhci-s3c driver. All the
 comments for this patch has been addressed. Can this be queued for
 v3.7?

 Yes, sounds good.  Jaehoon, perhaps you could give your Reviewed-by
 for me to add to the patch?  I've pushed this to mmc-next for 3.7
 now, after adding Jaehoon's else-if suggestion that wasn't acted on:

 diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
 index 3d91c7a..0c77b10 100644
 --- a/drivers/mmc/host/sdhci-s3c.c
 +++ b/drivers/mmc/host/sdhci-s3c.c
 @@ -461,22 +461,18 @@ static int __devinit sdhci_s3c_parse_dt(struct device 
 *dev,
 if (gpio_is_valid(gpio)) {
 pdata-cd_type = S3C_SDHCI_CD_GPIO;
 goto found_cd;
 -   } else {
 -   if (gpio != -ENOENT) {
 -   dev_err(dev, invalid card detect gpio specified\n);
 -   return -EINVAL;
 -   }
 +   } else if (gpio != -ENOENT) {
 +   dev_err(dev, invalid card detect gpio specified\n);
 +   return -EINVAL;
 }

 gpio = of_get_named_gpio(node, samsung,cd-pinmux-gpio, 0);
 if (gpio_is_valid(gpio)) {
 pdata-cd_type = S3C_SDHCI_CD_INTERNAL;
 goto found_cd;
 -   } else {
 -   if (gpio != -ENOENT) {
 -   dev_err(dev, invalid card detect gpio specified\n);
 -   return -EINVAL;
 -   }
 +   } else if (gpio != -ENOENT) {
 +   dev_err(dev, invalid card detect gpio specified\n);
 +   return -EINVAL;
 }

Thank you Chris for your modification.

Regards,
Thomas.


 dev_info(dev, assuming no card detect line available\n);

 Thanks,

 - Chris.
 --
 Chris Ball   c...@laptop.org   http://printf.net/
 One Laptop Per Child
--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5] mmc: sdhci-s3c: Add device tree support

2012-09-17 Thread Jaehoon Chung
On 09/18/2012 12:50 PM, Chris Ball wrote:
 Hi,
 
 On Mon, Sep 17 2012, Thomas Abraham wrote:
 On 23 August 2012 22:40, Thomas Abraham thomas.abra...@linaro.org wrote:
 Add device tree based discovery support for Samsung's sdhci controller

 Cc: Ben Dooks ben-li...@fluff.org
 Cc: Kukjin Kim kgene@samsung.com
 Cc: Chris Ball c...@laptop.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 Changes since v4:
 Adapted to new mmc core card detection bindings as specfied in the patch:
 [PATCH] mmc: dt: Add card-detection properties to core binding
 and extends it samsung,cd-pinmux-gpio property as suggested by
 Mitch Bradley w...@firmworks.com

 Changes since v3:

 The patch series that adds device tree support for Samsung sdhci controller
 had six patches in total, of which, the first five patches have been 
 accepted.
 The sixth patch in the series was dropped since it was using custom Samsung
 properties for descrbing the bus-width and card-detect gpio, but had 
 otherwise
 addressed all the comments.

 This patch reworks the sixth patch in v3 of the sdhci device tree support
 patch series. The only change in this patch from the v3 version is the use 
 of
 generic mmc bindings for descrbing the bus-width and card-detect gpio.

  .../devicetree/bindings/mmc/samsung-sdhci.txt  |   53 +++
  drivers/mmc/host/sdhci-s3c.c   |  162 
 +++-
  2 files changed, 209 insertions(+), 6 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/samsung-sdhci.txt

 Hi Chris,

 This patch adds device tree support for sdhci-s3c driver. All the
 comments for this patch has been addressed. Can this be queued for
 v3.7?
 
 Yes, sounds good.  Jaehoon, perhaps you could give your Reviewed-by
 for me to add to the patch?  I've pushed this to mmc-next for 3.7
 now, after adding Jaehoon's else-if suggestion that wasn't acted on:
Right, I suggested them. thanks Chris. Looks good to me this patch except for 
them.

Reviewed-by: Jaehoon Chung jh80.ch...@samsung.com
 
 diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
 index 3d91c7a..0c77b10 100644
 --- a/drivers/mmc/host/sdhci-s3c.c
 +++ b/drivers/mmc/host/sdhci-s3c.c
 @@ -461,22 +461,18 @@ static int __devinit sdhci_s3c_parse_dt(struct device 
 *dev,
   if (gpio_is_valid(gpio)) {
   pdata-cd_type = S3C_SDHCI_CD_GPIO;
   goto found_cd;
 - } else {
 - if (gpio != -ENOENT) {
 - dev_err(dev, invalid card detect gpio specified\n);
 - return -EINVAL;
 - }
 + } else if (gpio != -ENOENT) {
 + dev_err(dev, invalid card detect gpio specified\n);
 + return -EINVAL;
   }
  
   gpio = of_get_named_gpio(node, samsung,cd-pinmux-gpio, 0);
   if (gpio_is_valid(gpio)) {
   pdata-cd_type = S3C_SDHCI_CD_INTERNAL;
   goto found_cd;
 - } else {
 - if (gpio != -ENOENT) {
 - dev_err(dev, invalid card detect gpio specified\n);
 - return -EINVAL;
 - }
 + } else if (gpio != -ENOENT) {
 + dev_err(dev, invalid card detect gpio specified\n);
 + return -EINVAL;
   }
  
   dev_info(dev, assuming no card detect line available\n);
 
 Thanks,
 
 - Chris.
 

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5] mmc: sdhci-s3c: Add device tree support

2012-08-23 Thread Thomas Abraham
Add device tree based discovery support for Samsung's sdhci controller

Cc: Ben Dooks ben-li...@fluff.org
Cc: Kukjin Kim kgene@samsung.com
Cc: Chris Ball c...@laptop.org
Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
---
Changes since v4:
Adapted to new mmc core card detection bindings as specfied in the patch:
[PATCH] mmc: dt: Add card-detection properties to core binding
and extends it samsung,cd-pinmux-gpio property as suggested by
Mitch Bradley w...@firmworks.com

Changes since v3:

The patch series that adds device tree support for Samsung sdhci controller
had six patches in total, of which, the first five patches have been accepted.
The sixth patch in the series was dropped since it was using custom Samsung
properties for descrbing the bus-width and card-detect gpio, but had otherwise
addressed all the comments.

This patch reworks the sixth patch in v3 of the sdhci device tree support
patch series. The only change in this patch from the v3 version is the use of
generic mmc bindings for descrbing the bus-width and card-detect gpio.

 .../devicetree/bindings/mmc/samsung-sdhci.txt  |   53 +++
 drivers/mmc/host/sdhci-s3c.c   |  162 +++-
 2 files changed, 209 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/samsung-sdhci.txt

diff --git a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt 
b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
new file mode 100644
index 000..361c2ee
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
@@ -0,0 +1,53 @@
+* Samsung's SDHCI Controller device tree bindings
+
+Samsung's SDHCI controller is used as a connectivity interface with external
+MMC, SD and eMMC storage mediums. This file documents differences between the
+core mmc properties described by mmc.txt and the properties used by the
+Samsung implmentation of the SDHCI controller.
+
+Note: The mmc core bindings documentation states that if none of the core
+card-detect bindings are used, then the standard sdhci card detect mechanism
+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
+controller.
+  - samsung,exynos4210-sdhci: For controllers compatible with Exynos4 sdhci
+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.
+
+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.
+
+Example:
+   sdhci@1253 {
+   compatible = samsung,exynos4210-sdhci;
+   reg = 0x1253 0x100;
+   interrupts = 0 75 0;
+   bus-width = 4;
+   cd-gpios = gpk2 2 2 3 3;
+   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 */
+   };
+
+   Note: This example shows both SoC specific and board specific properties
+   in a single device node. The properties can be actually be seperated
+   into SoC specific node and board specific node.
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index a50c205..445910e 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -34,6 +34,9 @@
 
 #define MAX_BUS_CLK(4)
 
+/* Number of gpio's used is max data bus width + command and clock lines */
+#define NUM_GPIOS(x)   (x + 2)
+
 /**
  * struct sdhci_s3c - S3C SDHCI instance
  * @host: The SDHCI host created
@@ -41,6 +44,7 @@
  * @ioarea: The resource created when we claimed the IO area.
  * @pdata: The platform data for this controller.
  * @cur_clk: The index of the current bus clock.
+ * @gpios: List of gpio numbers parsed from device tree.
  * @clk_io: The clock for the internal bus interface.
  * @clk_bus: The clocks that are available for the SD/MMC bus clock.
  */
@@ -52,6 +56,7 @@ struct sdhci_s3c {
unsigned intcur_clk;
int ext_cd_irq;
int ext_cd_gpio;
+   int *gpios;
 
struct 

Re: [PATCH v5] mmc: sdhci-s3c: Add device tree support

2012-08-23 Thread Jaehoon Chung
On 08/24/2012 02:10 AM, Thomas Abraham wrote:
 Add device tree based discovery support for Samsung's sdhci controller
 
 Cc: Ben Dooks ben-li...@fluff.org
 Cc: Kukjin Kim kgene@samsung.com
 Cc: Chris Ball c...@laptop.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 Changes since v4:
 Adapted to new mmc core card detection bindings as specfied in the patch:
 [PATCH] mmc: dt: Add card-detection properties to core binding
 and extends it samsung,cd-pinmux-gpio property as suggested by
 Mitch Bradley w...@firmworks.com
 
 Changes since v3:
 
 The patch series that adds device tree support for Samsung sdhci controller
 had six patches in total, of which, the first five patches have been accepted.
 The sixth patch in the series was dropped since it was using custom Samsung
 properties for descrbing the bus-width and card-detect gpio, but had otherwise
 addressed all the comments.
 
 This patch reworks the sixth patch in v3 of the sdhci device tree support
 patch series. The only change in this patch from the v3 version is the use of
 generic mmc bindings for descrbing the bus-width and card-detect gpio.
 
  .../devicetree/bindings/mmc/samsung-sdhci.txt  |   53 +++
  drivers/mmc/host/sdhci-s3c.c   |  162 
 +++-
  2 files changed, 209 insertions(+), 6 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
 
 diff --git a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt 
 b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
 new file mode 100644
 index 000..361c2ee
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
 @@ -0,0 +1,53 @@
 +* Samsung's SDHCI Controller device tree bindings
 +
 +Samsung's SDHCI controller is used as a connectivity interface with external
 +MMC, SD and eMMC storage mediums. This file documents differences between the
 +core mmc properties described by mmc.txt and the properties used by the
 +Samsung implmentation of the SDHCI controller.
 +
 +Note: The mmc core bindings documentation states that if none of the core
 +card-detect bindings are used, then the standard sdhci card detect mechanism
 +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
 +controller.
 +  - samsung,exynos4210-sdhci: For controllers compatible with Exynos4 sdhci
 +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.
 +
 +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.
 +
 +Example:
 + sdhci@1253 {
 + compatible = samsung,exynos4210-sdhci;
 + reg = 0x1253 0x100;
 + interrupts = 0 75 0;
 + bus-width = 4;
 + cd-gpios = gpk2 2 2 3 3;
 + 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 */
 + };
 +
 + Note: This example shows both SoC specific and board specific properties
 + in a single device node. The properties can be actually be seperated
 + into SoC specific node and board specific node.
 diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
 index a50c205..445910e 100644
 --- a/drivers/mmc/host/sdhci-s3c.c
 +++ b/drivers/mmc/host/sdhci-s3c.c
 @@ -34,6 +34,9 @@
  
  #define MAX_BUS_CLK  (4)
  
 +/* Number of gpio's used is max data bus width + command and clock lines */
 +#define NUM_GPIOS(x) (x + 2)
 +
  /**
   * struct sdhci_s3c - S3C SDHCI instance
   * @host: The SDHCI host created
 @@ -41,6 +44,7 @@
   * @ioarea: The resource created when we claimed the IO area.
   * @pdata: The platform data for this controller.
   * @cur_clk: The index of the current bus clock.
 + * @gpios: List of gpio numbers parsed from device tree.
   * @clk_io: The clock for the internal bus interface.
   * @clk_bus: The clocks that are available for the SD/MMC bus clock.
   */
 @@ -52,6 +56,7 @@ struct sdhci_s3c {
   unsigned intcur_clk;
   int 

Re: [PATCH v5] mmc: sdhci-s3c: Add device tree support

2012-08-23 Thread Thomas Abraham
On 24 August 2012 05:28, Jaehoon Chung jh80.ch...@samsung.com wrote:
 On 08/24/2012 02:10 AM, Thomas Abraham wrote:
 Add device tree based discovery support for Samsung's sdhci controller

 Cc: Ben Dooks ben-li...@fluff.org
 Cc: Kukjin Kim kgene@samsung.com
 Cc: Chris Ball c...@laptop.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 Changes since v4:
 Adapted to new mmc core card detection bindings as specfied in the patch:
 [PATCH] mmc: dt: Add card-detection properties to core binding
 and extends it samsung,cd-pinmux-gpio property as suggested by
 Mitch Bradley w...@firmworks.com

 Changes since v3:

 The patch series that adds device tree support for Samsung sdhci controller
 had six patches in total, of which, the first five patches have been 
 accepted.
 The sixth patch in the series was dropped since it was using custom Samsung
 properties for descrbing the bus-width and card-detect gpio, but had 
 otherwise
 addressed all the comments.

 This patch reworks the sixth patch in v3 of the sdhci device tree support
 patch series. The only change in this patch from the v3 version is the use of
 generic mmc bindings for descrbing the bus-width and card-detect gpio.

  .../devicetree/bindings/mmc/samsung-sdhci.txt  |   53 +++
  drivers/mmc/host/sdhci-s3c.c   |  162 
 +++-
  2 files changed, 209 insertions(+), 6 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/samsung-sdhci.txt

 diff --git a/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt 
 b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
 new file mode 100644
 index 000..361c2ee
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
 @@ -0,0 +1,53 @@
 +* Samsung's SDHCI Controller device tree bindings
 +
 +Samsung's SDHCI controller is used as a connectivity interface with external
 +MMC, SD and eMMC storage mediums. This file documents differences between 
 the
 +core mmc properties described by mmc.txt and the properties used by the
 +Samsung implmentation of the SDHCI controller.
 +
 +Note: The mmc core bindings documentation states that if none of the core
 +card-detect bindings are used, then the standard sdhci card detect mechanism
 +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
 +controller.
 +  - samsung,exynos4210-sdhci: For controllers compatible with Exynos4 
 sdhci
 +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.
 +
 +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.
 +
 +Example:
 + sdhci@1253 {
 + compatible = samsung,exynos4210-sdhci;
 + reg = 0x1253 0x100;
 + interrupts = 0 75 0;
 + bus-width = 4;
 + cd-gpios = gpk2 2 2 3 3;
 + 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 */
 + };
 +
 + Note: This example shows both SoC specific and board specific 
 properties
 + in a single device node. The properties can be actually be seperated
 + into SoC specific node and board specific node.
 diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
 index a50c205..445910e 100644
 --- a/drivers/mmc/host/sdhci-s3c.c
 +++ b/drivers/mmc/host/sdhci-s3c.c
 @@ -34,6 +34,9 @@

  #define MAX_BUS_CLK  (4)

 +/* Number of gpio's used is max data bus width + command and clock lines */
 +#define NUM_GPIOS(x) (x + 2)
 +
  /**
   * struct sdhci_s3c - S3C SDHCI instance
   * @host: The SDHCI host created
 @@ -41,6 +44,7 @@
   * @ioarea: The resource created when we claimed the IO area.
   * @pdata: The platform data for this controller.
   * @cur_clk: The index of the current bus clock.
 + * @gpios: List of gpio numbers parsed from device tree.
   * @clk_io: The clock for the internal bus interface.
   * @clk_bus: The clocks that are available for the SD/MMC bus clock.
   */
 @@ -52,6 +56,7 @@ struct