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

2012-01-30 Thread Heiko Stübner
Am Mittwoch, 2. November 2011, 21:36:03 schrieb Thomas Abraham:

Hi Thomas,

in patch 1/6:
 +static struct platform_device_id sdhci_s3c_driver_ids[] = {
 +   {
 +   .name   = s3c-sdhci,
 +   .driver_data= (kernel_ulong_t)NULL,
 +   },
 +   {
 +   .name   = exynos4-sdhci,
 +   .driver_data= EXYNOS4_SDHCI_DRV_DATA,
 +   },
 +};
 +MODULE_DEVICE_TABLE(platform, sdhci_s3c_driver_ids);


and in patch 6/6:
 +#ifdef CONFIG_OF
 +static const struct of_device_id sdhci_s3c_dt_match[] = {
 + { .compatible = samsung,s3c6410-sdhci, },
 + { .compatible = samsung,exynos4210-sdhci,
 + .data = exynos4_sdhci_drv_data },
 + {},
 +};
 +MODULE_DEVICE_TABLE(of, sdhci_s3c_dt_match);

wouldn't it be better to keep the naming consistent between of and non-of?
I.e. s3c-sdhci vs. s3c6410-sdhci. Since the driver is used for all S3C SoCs 
containing hsmmc controllers I think s3c-sdhci would be preferable here.

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


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

2012-01-30 Thread Grant Likely
On Mon, Jan 30, 2012 at 10:51:11AM +0100, Heiko Stübner wrote:
 Am Mittwoch, 2. November 2011, 21:36:03 schrieb Thomas Abraham:
 
 Hi Thomas,
 
 in patch 1/6:
  +static struct platform_device_id sdhci_s3c_driver_ids[] = {
  +   {
  +   .name   = s3c-sdhci,
  +   .driver_data= (kernel_ulong_t)NULL,
  +   },
  +   {
  +   .name   = exynos4-sdhci,
  +   .driver_data= EXYNOS4_SDHCI_DRV_DATA,
  +   },
  +};
  +MODULE_DEVICE_TABLE(platform, sdhci_s3c_driver_ids);
 
 
 and in patch 6/6:
  +#ifdef CONFIG_OF
  +static const struct of_device_id sdhci_s3c_dt_match[] = {
  +   { .compatible = samsung,s3c6410-sdhci, },
  +   { .compatible = samsung,exynos4210-sdhci,
  +   .data = exynos4_sdhci_drv_data },
  +   {},
  +};
  +MODULE_DEVICE_TABLE(of, sdhci_s3c_dt_match);
 
 wouldn't it be better to keep the naming consistent between of and non-of?
 I.e. s3c-sdhci vs. s3c6410-sdhci. Since the driver is used for all S3C SoCs 
 containing hsmmc controllers I think s3c-sdhci would be preferable here.

History has shown that future devices aren't always compatible with earlier
ones.  Compatible strings are expected to be specific to an exact device to
reduce the possibility of new hardware breaking assumptions.

Instead, new hardware can either claim compatibility with older
compatible strings (the compatible property in the DT is a list), or
can have the new string added to the match table in the driver;
whichever option makes the most sense.

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


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

2012-01-30 Thread Heiko Stübner
Am Montag 30 Januar 2012, 20:01:14 schrieb Grant Likely:
 On Mon, Jan 30, 2012 at 10:51:11AM +0100, Heiko Stübner wrote:
  Am Mittwoch, 2. November 2011, 21:36:03 schrieb Thomas Abraham:
  
  Hi Thomas,
  
  in patch 1/6:
   +static struct platform_device_id sdhci_s3c_driver_ids[] = {
   +   {
   +   .name   = s3c-sdhci,
   +   .driver_data= (kernel_ulong_t)NULL,
   +   },
   +   {
   +   .name   = exynos4-sdhci,
   +   .driver_data= EXYNOS4_SDHCI_DRV_DATA,
   +   },
   +};
   +MODULE_DEVICE_TABLE(platform, sdhci_s3c_driver_ids);
  
  and in patch 6/6:
   +#ifdef CONFIG_OF
   +static const struct of_device_id sdhci_s3c_dt_match[] = {
   + { .compatible = samsung,s3c6410-sdhci, },
   + { .compatible = samsung,exynos4210-sdhci,
   + .data = exynos4_sdhci_drv_data },
   + {},
   +};
   +MODULE_DEVICE_TABLE(of, sdhci_s3c_dt_match);
  
  wouldn't it be better to keep the naming consistent between of and
  non-of? I.e. s3c-sdhci vs. s3c6410-sdhci. Since the driver is used for
  all S3C SoCs containing hsmmc controllers I think s3c-sdhci would be
  preferable here.
 
 History has shown that future devices aren't always compatible with earlier
 ones.  Compatible strings are expected to be specific to an exact device to
 reduce the possibility of new hardware breaking assumptions.
 
 Instead, new hardware can either claim compatibility with older
 compatible strings (the compatible property in the DT is a list), or
 can have the new string added to the match table in the driver;
 whichever option makes the most sense.
ah, ok. Thanks for the explanation and I will keep that in mind.

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


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

2012-01-05 Thread Thomas Abraham
Hi Sylwester,

On 4 January 2012 21:07, Sylwester Nawrocki s.nawro...@samsung.com wrote:
 Hi Kgene, Thomas

 On 11/08/2011 04:23 PM, Thomas Abraham wrote:
 Hi Grant,

 On 8 November 2011 02:47, Grant Likely grant.lik...@secretlab.ca wrote:
 On Thu, Nov 03, 2011 at 02:06:03AM +0530, Thomas Abraham wrote:
 Add device tree based discovery support for Samsung's sdhci controller

 Cc: Ben Dooks ben-li...@fluff.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 +Example:
 +     sdhci@1253 {
 +             compatible = samsung,exynos4210-sdhci;
 +             reg = 0x1253 0x100;
 +             interrupts = 139;
 +             samsung,sdhci-bus-width = 4;
 +             linux,mmc_cap_4_bit_data;

 Following on from my reply on patch 5, this is an example of exactly
 what I'm talking about.  This node both sets bus-width to '4', and
 sets the 4_bit_data flag.  Don't you think that the driver would be
 smart enough to set the 4_bit_data flag when the bus width was set to
 4?

 Yes, that is true. I will modify the driver based on your comments and
 resubmit this patch.

 Are we going to have those patches in 3.3-rc1 or only in 3.4 ?

Sorry for the delaying in completing this patchset. I will redo this
patchset and submit it soon. But 3.3-rc1 looks unlikely.

Thanks,
Thomas.


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


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

2012-01-05 Thread Sylwester Nawrocki
Hi Thomas,

On 01/05/2012 04:45 PM, Thomas Abraham wrote:
 On Thu, Nov 03, 2011 at 02:06:03AM +0530, Thomas Abraham wrote:
 Add device tree based discovery support for Samsung's sdhci controller

 Cc: Ben Dooks ben-li...@fluff.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 +Example:
 + sdhci@1253 {
 + compatible = samsung,exynos4210-sdhci;
 + reg = 0x1253 0x100;
 + interrupts = 139;
 + samsung,sdhci-bus-width = 4;
 + linux,mmc_cap_4_bit_data;

 Following on from my reply on patch 5, this is an example of exactly
 what I'm talking about.  This node both sets bus-width to '4', and
 sets the 4_bit_data flag.  Don't you think that the driver would be
 smart enough to set the 4_bit_data flag when the bus width was set to
 4?

 Yes, that is true. I will modify the driver based on your comments and
 resubmit this patch.

 Are we going to have those patches in 3.3-rc1 or only in 3.4 ?
 
 Sorry for the delaying in completing this patchset. I will redo this
 patchset and submit it soon. But 3.3-rc1 looks unlikely.

Ok, thanks. It's fine, there is no rush. I was just curious because we have
reused this sdhci driver update series and it seemed essential for initial
DT support on Exynos4 machines. Just FYI I have prepared initial DT support
patches for the S5P MIPI-CSI2 (s5p-mipi-csis) receiver driver.
But the whole camera subsystem needs more work, i.e. resource dependencies
(clock) between all involved devices (like image sensors and video capture
platform devices) need to be resolved and method of registering sub-devices
in the V4L2 core will likely need to be changed.


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


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

2012-01-05 Thread Thomas Abraham
Hi Sylwester,

On 5 January 2012 21:52, Sylwester Nawrocki s.nawro...@samsung.com wrote:
[...]

 Sorry for the delaying in completing this patchset. I will redo this
 patchset and submit it soon. But 3.3-rc1 looks unlikely.

 Ok, thanks. It's fine, there is no rush. I was just curious because we have
 reused this sdhci driver update series and it seemed essential for initial
 DT support on Exynos4 machines. Just FYI I have prepared initial DT support
 patches for the S5P MIPI-CSI2 (s5p-mipi-csis) receiver driver.
 But the whole camera subsystem needs more work, i.e. resource dependencies
 (clock) between all involved devices (like image sensors and video capture
 platform devices) need to be resolved and method of registering sub-devices
 in the V4L2 core will likely need to be changed.

Thanks for the information. It was helpful to know that you are working on this.

Regards,
Thomas.



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


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

2011-11-07 Thread Grant Likely
On Thu, Nov 03, 2011 at 02:06:03AM +0530, Thomas Abraham wrote:
 Add device tree based discovery support for Samsung's sdhci controller
 
 Cc: Ben Dooks ben-li...@fluff.org
 Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
 ---
 +Example:
 + sdhci@1253 {
 + compatible = samsung,exynos4210-sdhci;
 + reg = 0x1253 0x100;
 + interrupts = 139;
 + samsung,sdhci-bus-width = 4;
 + linux,mmc_cap_4_bit_data;

Following on from my reply on patch 5, this is an example of exactly
what I'm talking about.  This node both sets bus-width to '4', and
sets the 4_bit_data flag.  Don't you think that the driver would be
smart enough to set the 4_bit_data flag when the bus width was set to
4?

g.

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


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

2011-11-02 Thread Thomas Abraham
Add device tree based discovery support for Samsung's sdhci controller

Cc: Ben Dooks ben-li...@fluff.org
Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
---
 .../devicetree/bindings/mmc/samsung-sdhci.txt  |   75 ++
 drivers/mmc/host/sdhci-s3c.c   |  152 +++-
 2 files changed, 221 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..a6dd6bb
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/samsung-sdhci.txt
@@ -0,0 +1,75 @@
+* 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.
+
+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 controller compatible with Exynos4 sdhci
+controller.
+
+- reg: physical base address of the controller and length of memory mapped
+  region.
+
+- interrupts: The interrupt number to the cpu. The interrupt specifier format
+  depends on the interrupt 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. Note: There is no
+  particular order in which the gpio's have to be listed.
+
+
+Optional Board Specific Properties:
+- samsung,sdhci-bus-width: Number of data lines connected to the controller.
+  Note: This excludes the clock,command and card detect lines. If this property
+  is not specified, default value is 1.
+
+- samsung,cd-gpio-invert: If 'samsung,sdhci-cd-gpio' card detect method is
+  selected, this property can be optionally specified to invert the value of
+  external card detect gpio line.
+
+- One of the following properties for card detect type.
+  - samsung,sdhci-cd-internal: Card detect line from the card slot  is
+connected to the card detect pad of the sdhci controller. A gpio is
+used for this connection (with possible pin function settings).
+  - samsung,sdhci-cd-gpio: A gpio line (with possible pin function settings)
+is used a card detect line. This gpio line is not connected to card detect
+pad of the sdhci controller.
+  - samsung,sdhci-cd-none: There is no card detect line. Polling is used to
+detect the presence of the card. (DEFAULT, if no card detect property
+is specified).
+  - samsung,sdhci-cd-permanent: There is no card detect line. The card is
+permanently connected to the sdhci controller.
+
+- gpio-cd: The gpio to be used as card detect line for
+  'samsung,sdhci-cd-internal' or 'samsung,sdhci-cd-gpio' card detection method.
+  The gpio specifier format depends on the gpio controller.
+
+- One or more of the linux specific mmc host bindings.
+  See Documentation/devicetree/bindings/mmc/linux-mmc-host.txt for all the
+  linux mmc host controller specific bindings.
+
+Example:
+   sdhci@1253 {
+   compatible = samsung,exynos4210-sdhci;
+   reg = 0x1253 0x100;
+   interrupts = 139;
+   samsung,sdhci-bus-width = 4;
+   linux,mmc_cap_4_bit_data;
+   samsung,sdhci-cd-internal;
+   gpio-cd = 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 c77ec42..e77e301 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -20,6 +20,8 @@
 #include linux/io.h
 #include linux/gpio.h
 #include linux/module.h
+#include linux/of.h
+#include linux/of_gpio.h
 
 #include linux/mmc/host.h
 
@@ -29,6 +31,8 @@
 #include sdhci.h
 
 #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
@@ -48,6 +52,7 @@ struct sdhci_s3c {
unsigned intcur_clk;
int ext_cd_irq;
int ext_cd_gpio;
+   int *gpios;
 
struct clk  *clk_io;
struct clk  *clk_bus[MAX_BUS_CLK];
@@ -415,9 +420,112 @@ static void