All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/5] Add DT support for davinci_mmc driver
@ 2013-02-15  6:21 ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:21 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. Also takecare to derive controller IP version from
platform_device_id table, remove version specification in pdata.

DT patches 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 v3:
Added support to derive IP version information from platform_device_id table.

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 (5):
  ARM: davinci: mmc: derive version information from device name
  mmc: davinci_mmc: derive controller IP version from
    platform_device_id
  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/board-da830-evm.c            |    1 -
 arch/arm/mach-davinci/board-da850-evm.c            |    2 -
 arch/arm/mach-davinci/board-dm355-evm.c            |    1 -
 arch/arm/mach-davinci/board-dm365-evm.c            |    1 -
 arch/arm/mach-davinci/board-dm644x-evm.c           |    1 -
 arch/arm/mach-davinci/board-neuros-osd2.c          |    1 -
 arch/arm/mach-davinci/board-omapl138-hawk.c        |    1 -
 arch/arm/mach-davinci/board-tnetv107x-evm.c        |    1 -
 arch/arm/mach-davinci/da830.c                      |    2 +-
 arch/arm/mach-davinci/da850.c                      |    4 +-
 arch/arm/mach-davinci/da8xx-dt.c                   |    2 +
 arch/arm/mach-davinci/devices-da8xx.c              |    4 +-
 arch/arm/mach-davinci/devices-tnetv107x.c          |    4 +-
 arch/arm/mach-davinci/devices.c                    |    6 +-
 arch/arm/mach-davinci/dm355.c                      |    4 +-
 arch/arm/mach-davinci/dm365.c                      |    4 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/tnetv107x.c                  |    4 +-
 drivers/mmc/host/davinci_mmc.c                     |   83 +++++++++++++++++++-
 include/linux/platform_data/mmc-davinci.h          |    3 -
 23 files changed, 146 insertions(+), 31 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/davinci_mmc.txt

-- 
1.7.4.1


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

* [PATCH v4 0/5] Add DT support for davinci_mmc driver
@ 2013-02-15  6:21 ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:21 UTC (permalink / raw)
  To: linux-arm-kernel

Patch set adds DT support for davinci_mmc driver and is
verified on da850-evm without card_detect/write_protect and
EDMA support. Also takecare to derive controller IP version from
platform_device_id table, remove version specification in pdata.

DT patches 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 at 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 v3:
Added support to derive IP version information from platform_device_id table.

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 (5):
  ARM: davinci: mmc: derive version information from device name
  mmc: davinci_mmc: derive controller IP version from
    platform_device_id
  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/board-da830-evm.c            |    1 -
 arch/arm/mach-davinci/board-da850-evm.c            |    2 -
 arch/arm/mach-davinci/board-dm355-evm.c            |    1 -
 arch/arm/mach-davinci/board-dm365-evm.c            |    1 -
 arch/arm/mach-davinci/board-dm644x-evm.c           |    1 -
 arch/arm/mach-davinci/board-neuros-osd2.c          |    1 -
 arch/arm/mach-davinci/board-omapl138-hawk.c        |    1 -
 arch/arm/mach-davinci/board-tnetv107x-evm.c        |    1 -
 arch/arm/mach-davinci/da830.c                      |    2 +-
 arch/arm/mach-davinci/da850.c                      |    4 +-
 arch/arm/mach-davinci/da8xx-dt.c                   |    2 +
 arch/arm/mach-davinci/devices-da8xx.c              |    4 +-
 arch/arm/mach-davinci/devices-tnetv107x.c          |    4 +-
 arch/arm/mach-davinci/devices.c                    |    6 +-
 arch/arm/mach-davinci/dm355.c                      |    4 +-
 arch/arm/mach-davinci/dm365.c                      |    4 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/tnetv107x.c                  |    4 +-
 drivers/mmc/host/davinci_mmc.c                     |   83 +++++++++++++++++++-
 include/linux/platform_data/mmc-davinci.h          |    3 -
 23 files changed, 146 insertions(+), 31 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/davinci_mmc.txt

-- 
1.7.4.1

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

* [PATCH v4 1/5] ARM: davinci: mmc: derive version information from device name
  2013-02-15  6:21 ` Manjunathappa, Prakash
@ 2013-02-15  6:21   ` Manjunathappa, Prakash
  -1 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:21 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

Remove specifying mmc controller IP version information via platform
data, instead specify device name so that driver derives it from
platform_device_id table. Also change the clock node name to match
the changed dev_id.
Tested on da850-evm to make sure driver loads without clk_get failures.

Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
---
Suppose to be v1 but got added later to this series.

 arch/arm/mach-davinci/board-da830-evm.c     |    1 -
 arch/arm/mach-davinci/board-da850-evm.c     |    2 --
 arch/arm/mach-davinci/board-dm355-evm.c     |    1 -
 arch/arm/mach-davinci/board-dm365-evm.c     |    1 -
 arch/arm/mach-davinci/board-dm644x-evm.c    |    1 -
 arch/arm/mach-davinci/board-neuros-osd2.c   |    1 -
 arch/arm/mach-davinci/board-omapl138-hawk.c |    1 -
 arch/arm/mach-davinci/board-tnetv107x-evm.c |    1 -
 arch/arm/mach-davinci/da830.c               |    2 +-
 arch/arm/mach-davinci/da850.c               |    4 ++--
 arch/arm/mach-davinci/devices-da8xx.c       |    4 ++--
 arch/arm/mach-davinci/devices-tnetv107x.c   |    4 ++--
 arch/arm/mach-davinci/devices.c             |    6 ++++--
 arch/arm/mach-davinci/dm355.c               |    4 ++--
 arch/arm/mach-davinci/dm365.c               |    4 ++--
 arch/arm/mach-davinci/dm644x.c              |    2 +-
 arch/arm/mach-davinci/tnetv107x.c           |    4 ++--
 17 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 95b5e10..d6a41f0 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -246,7 +246,6 @@ static struct davinci_mmc_config da830_evm_mmc_config = {
 	.wires			= 8,
 	.max_freq		= 50000000,
 	.caps			= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version		= MMC_CTLR_VERSION_2,
 };
 
 static inline void da830_evm_init_mmc(void)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index b030794..ba85660 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -802,7 +802,6 @@ static struct davinci_mmc_config da850_mmc_config = {
 	.wires		= 4,
 	.max_freq	= 50000000,
 	.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_2,
 };
 
 static const short da850_evm_mmcsd0_pins[] __initconst = {
@@ -1362,7 +1361,6 @@ static struct davinci_mmc_config da850_wl12xx_mmc_config = {
 	.max_freq	= 25000000,
 	.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
 			  MMC_CAP_POWER_OFF_CARD,
-	.version	= MMC_CTLR_VERSION_2,
 };
 
 static const short da850_wl12xx_pins[] __initconst = {
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index cdf8d07..2caa5e9 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -280,7 +280,6 @@ static struct davinci_mmc_config dm355evm_mmc_config = {
 	.wires		= 4,
 	.max_freq       = 50000000,
 	.caps           = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_1,
 };
 
 /* Don't connect anything to J10 unless you're only using USB host
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 5d49c75..ba06295 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -253,7 +253,6 @@ static struct davinci_mmc_config dm365evm_mmc_config = {
 	.wires		= 4,
 	.max_freq	= 50000000,
 	.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_2,
 };
 
 static void dm365evm_emac_configure(void)
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index f5e018d..4a57280 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -570,7 +570,6 @@ static struct davinci_mmc_config dm6446evm_mmc_config = {
 	.get_cd		= dm6444evm_mmc_get_cd,
 	.get_ro		= dm6444evm_mmc_get_ro,
 	.wires		= 4,
-	.version	= MMC_CTLR_VERSION_1
 };
 
 static struct i2c_board_info __initdata i2c_info[] =  {
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 3e3e3af..bad8192 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -164,7 +164,6 @@ static void __init davinci_ntosd2_map_io(void)
 
 static struct davinci_mmc_config davinci_ntosd2_mmc_config = {
 	.wires		= 4,
-	.version	= MMC_CTLR_VERSION_1
 };
 
 
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index dc1208e..4331ff3 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -138,7 +138,6 @@ static struct davinci_mmc_config da850_mmc_config = {
 	.wires		= 4,
 	.max_freq	= 50000000,
 	.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_2,
 };
 
 static __init void omapl138_hawk_mmc_init(void)
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
index be30997..42066ed 100644
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
@@ -85,7 +85,6 @@ static struct davinci_mmc_config mmc_config = {
 	.wires		= 4,
 	.max_freq	= 50000000,
 	.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_1,
 };
 
 static const short sdio1_pins[] __initconst = {
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 678a54a..42ad1ab 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -394,7 +394,7 @@ static struct clk_lookup da830_clks[] = {
 	CLK(NULL,		"tpcc",		&tpcc_clk),
 	CLK(NULL,		"tptc0",	&tptc0_clk),
 	CLK(NULL,		"tptc1",	&tptc1_clk),
-	CLK("davinci_mmc.0",	NULL,		&mmcsd_clk),
+	CLK("davinci-mmc-da830.0", NULL,	&mmcsd_clk),
 	CLK(NULL,		"uart0",	&uart0_clk),
 	CLK(NULL,		"uart1",	&uart1_clk),
 	CLK(NULL,		"uart2",	&uart2_clk),
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 6b9154e..364f61d 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -404,8 +404,8 @@ static struct clk_lookup da850_clks[] = {
 	CLK("davinci_emac.1",	NULL,		&emac_clk),
 	CLK("davinci-mcasp.0",	NULL,		&mcasp_clk),
 	CLK("da8xx_lcdc.0",	"fck",		&lcdc_clk),
-	CLK("davinci_mmc.0",	NULL,		&mmcsd0_clk),
-	CLK("davinci_mmc.1",	NULL,		&mmcsd1_clk),
+	CLK("davinci-mmc-da830.0", NULL,	&mmcsd0_clk),
+	CLK("davinci-mmc-da830.1", NULL,	&mmcsd1_clk),
 	CLK(NULL,		"aemif",	&aemif_clk),
 	CLK(NULL,		"usb11",	&usb11_clk),
 	CLK(NULL,		"usb20",	&usb20_clk),
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index cc6916d..3f27600 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -664,7 +664,7 @@ static struct resource da8xx_mmcsd0_resources[] = {
 };
 
 static struct platform_device da8xx_mmcsd0_device = {
-	.name		= "davinci_mmc",
+	.name		= "davinci-mmc-da830",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(da8xx_mmcsd0_resources),
 	.resource	= da8xx_mmcsd0_resources,
@@ -701,7 +701,7 @@ static struct resource da850_mmcsd1_resources[] = {
 };
 
 static struct platform_device da850_mmcsd1_device = {
-	.name		= "davinci_mmc",
+	.name		= "davinci-mmc-da830",
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(da850_mmcsd1_resources),
 	.resource	= da850_mmcsd1_resources,
diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c
index 773ab07..0eda4d1 100644
--- a/arch/arm/mach-davinci/devices-tnetv107x.c
+++ b/arch/arm/mach-davinci/devices-tnetv107x.c
@@ -218,7 +218,7 @@ static u64 mmc1_dma_mask = DMA_BIT_MASK(32);
 
 static struct platform_device mmc_devices[2] = {
 	{
-		.name		= "davinci_mmc",
+		.name		= "davinci-mmc-dm355",
 		.id		= 0,
 		.dev		= {
 			.dma_mask		= &mmc0_dma_mask,
@@ -228,7 +228,7 @@ static struct platform_device mmc_devices[2] = {
 		.resource	= mmc0_resources
 	},
 	{
-		.name		= "davinci_mmc",
+		.name		= "davinci-mmc-dm355",
 		.id		= 1,
 		.dev		= {
 			.dma_mask		= &mmc1_dma_mask,
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 4c48a36..92411b2 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -150,7 +150,7 @@ static struct resource mmcsd0_resources[] = {
 };
 
 static struct platform_device davinci_mmcsd0_device = {
-	.name = "davinci_mmc",
+	.name = "davinci-mmc-dm355",
 	.id = 0,
 	.dev = {
 		.dma_mask = &mmcsd0_dma_mask,
@@ -187,7 +187,7 @@ static struct resource mmcsd1_resources[] = {
 };
 
 static struct platform_device davinci_mmcsd1_device = {
-	.name = "davinci_mmc",
+	.name = "davinci-mmc-dm355",
 	.id = 1,
 	.dev = {
 		.dma_mask = &mmcsd1_dma_mask,
@@ -235,6 +235,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
 			mmcsd1_resources[0].end = DM365_MMCSD1_BASE +
 							SZ_4K - 1;
 			mmcsd1_resources[2].start = IRQ_DM365_SDIOINT1;
+			davinci_mmcsd1_device.name = "davinci-mmc-da830";
 		} else
 			break;
 
@@ -256,6 +257,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
 			mmcsd0_resources[0].end = DM365_MMCSD0_BASE +
 							SZ_4K - 1;
 			mmcsd0_resources[2].start = IRQ_DM365_SDIOINT0;
+			davinci_mmcsd0_device.name = "davinci-mmc-da830";
 		} else if (cpu_is_davinci_dm644x()) {
 			/* REVISIT: should this be in board-init code? */
 			/* Power-on 3.3V IO cells */
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index b49c3b7..ed3e79a 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -361,8 +361,8 @@ static struct clk_lookup dm355_clks[] = {
 	CLK("i2c_davinci.1", NULL, &i2c_clk),
 	CLK("davinci-mcbsp.0", NULL, &asp0_clk),
 	CLK("davinci-mcbsp.1", NULL, &asp1_clk),
-	CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
-	CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
+	CLK("davinci-mmc-dm355.0", NULL, &mmcsd0_clk),
+	CLK("davinci-mmc-dm355.1", NULL, &mmcsd1_clk),
 	CLK("spi_davinci.0", NULL, &spi0_clk),
 	CLK("spi_davinci.1", NULL, &spi1_clk),
 	CLK("spi_davinci.2", NULL, &spi2_clk),
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 6c39805..3f46b24 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -454,8 +454,8 @@ static struct clk_lookup dm365_clks[] = {
 	CLK(NULL, "uart0", &uart0_clk),
 	CLK(NULL, "uart1", &uart1_clk),
 	CLK("i2c_davinci.1", NULL, &i2c_clk),
-	CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
-	CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
+	CLK("davinci-mmc-da830.0", NULL, &mmcsd0_clk),
+	CLK("davinci-mmc-da830.1", NULL, &mmcsd1_clk),
 	CLK("spi_davinci.0", NULL, &spi0_clk),
 	CLK("spi_davinci.1", NULL, &spi1_clk),
 	CLK("spi_davinci.2", NULL, &spi2_clk),
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 11c79a3..5e1e502 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -310,7 +310,7 @@ static struct clk_lookup dm644x_clks[] = {
 	CLK("i2c_davinci.1", NULL, &i2c_clk),
 	CLK("palm_bk3710", NULL, &ide_clk),
 	CLK("davinci-mcbsp", NULL, &asp_clk),
-	CLK("davinci_mmc.0", NULL, &mmcsd_clk),
+	CLK("davinci-mmc-dm355.0", NULL, &mmcsd_clk),
 	CLK(NULL, "spi", &spi_clk),
 	CLK(NULL, "gpio", &gpio_clk),
 	CLK(NULL, "usb", &usb_clk),
diff --git a/arch/arm/mach-davinci/tnetv107x.c b/arch/arm/mach-davinci/tnetv107x.c
index dc1a209..f9b9399 100644
--- a/arch/arm/mach-davinci/tnetv107x.c
+++ b/arch/arm/mach-davinci/tnetv107x.c
@@ -272,7 +272,7 @@ static struct clk_lookup clks[] = {
 	CLK("tnetv107x-keypad.0", NULL,			&clk_keypad),
 	CLK(NULL,		"clk_gpio",		&clk_gpio),
 	CLK(NULL,		"clk_mdio",		&clk_mdio),
-	CLK("davinci_mmc.0",	NULL,			&clk_sdio0),
+	CLK("davinci-mmc-dm355.0",	NULL,			&clk_sdio0),
 	CLK(NULL,		"uart0",		&clk_uart0),
 	CLK(NULL,		"uart1",		&clk_uart1),
 	CLK(NULL,		"timer0",		&clk_timer0),
@@ -292,7 +292,7 @@ static struct clk_lookup clks[] = {
 	CLK(NULL,		"clk_system",		&clk_system),
 	CLK(NULL,		"clk_imcop",		&clk_imcop),
 	CLK(NULL,		"clk_spare",		&clk_spare),
-	CLK("davinci_mmc.1",	NULL,			&clk_sdio1),
+	CLK("davinci-mmc-dm355.1",	NULL,			&clk_sdio1),
 	CLK(NULL,		"clk_ddr2_vrst",	&clk_ddr2_vrst),
 	CLK(NULL,		"clk_ddr2_vctl_rst",	&clk_ddr2_vctl_rst),
 	CLK(NULL,		NULL,			NULL),
-- 
1.7.4.1


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

* [PATCH v4 1/5] ARM: davinci: mmc: derive version information from device name
@ 2013-02-15  6:21   ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:21 UTC (permalink / raw)
  To: linux-arm-kernel

Remove specifying mmc controller IP version information via platform
data, instead specify device name so that driver derives it from
platform_device_id table. Also change the clock node name to match
the changed dev_id.
Tested on da850-evm to make sure driver loads without clk_get failures.

Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
---
Suppose to be v1 but got added later to this series.

 arch/arm/mach-davinci/board-da830-evm.c     |    1 -
 arch/arm/mach-davinci/board-da850-evm.c     |    2 --
 arch/arm/mach-davinci/board-dm355-evm.c     |    1 -
 arch/arm/mach-davinci/board-dm365-evm.c     |    1 -
 arch/arm/mach-davinci/board-dm644x-evm.c    |    1 -
 arch/arm/mach-davinci/board-neuros-osd2.c   |    1 -
 arch/arm/mach-davinci/board-omapl138-hawk.c |    1 -
 arch/arm/mach-davinci/board-tnetv107x-evm.c |    1 -
 arch/arm/mach-davinci/da830.c               |    2 +-
 arch/arm/mach-davinci/da850.c               |    4 ++--
 arch/arm/mach-davinci/devices-da8xx.c       |    4 ++--
 arch/arm/mach-davinci/devices-tnetv107x.c   |    4 ++--
 arch/arm/mach-davinci/devices.c             |    6 ++++--
 arch/arm/mach-davinci/dm355.c               |    4 ++--
 arch/arm/mach-davinci/dm365.c               |    4 ++--
 arch/arm/mach-davinci/dm644x.c              |    2 +-
 arch/arm/mach-davinci/tnetv107x.c           |    4 ++--
 17 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 95b5e10..d6a41f0 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -246,7 +246,6 @@ static struct davinci_mmc_config da830_evm_mmc_config = {
 	.wires			= 8,
 	.max_freq		= 50000000,
 	.caps			= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version		= MMC_CTLR_VERSION_2,
 };
 
 static inline void da830_evm_init_mmc(void)
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index b030794..ba85660 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -802,7 +802,6 @@ static struct davinci_mmc_config da850_mmc_config = {
 	.wires		= 4,
 	.max_freq	= 50000000,
 	.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_2,
 };
 
 static const short da850_evm_mmcsd0_pins[] __initconst = {
@@ -1362,7 +1361,6 @@ static struct davinci_mmc_config da850_wl12xx_mmc_config = {
 	.max_freq	= 25000000,
 	.caps		= MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
 			  MMC_CAP_POWER_OFF_CARD,
-	.version	= MMC_CTLR_VERSION_2,
 };
 
 static const short da850_wl12xx_pins[] __initconst = {
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index cdf8d07..2caa5e9 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -280,7 +280,6 @@ static struct davinci_mmc_config dm355evm_mmc_config = {
 	.wires		= 4,
 	.max_freq       = 50000000,
 	.caps           = MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_1,
 };
 
 /* Don't connect anything to J10 unless you're only using USB host
diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c
index 5d49c75..ba06295 100644
--- a/arch/arm/mach-davinci/board-dm365-evm.c
+++ b/arch/arm/mach-davinci/board-dm365-evm.c
@@ -253,7 +253,6 @@ static struct davinci_mmc_config dm365evm_mmc_config = {
 	.wires		= 4,
 	.max_freq	= 50000000,
 	.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_2,
 };
 
 static void dm365evm_emac_configure(void)
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index f5e018d..4a57280 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -570,7 +570,6 @@ static struct davinci_mmc_config dm6446evm_mmc_config = {
 	.get_cd		= dm6444evm_mmc_get_cd,
 	.get_ro		= dm6444evm_mmc_get_ro,
 	.wires		= 4,
-	.version	= MMC_CTLR_VERSION_1
 };
 
 static struct i2c_board_info __initdata i2c_info[] =  {
diff --git a/arch/arm/mach-davinci/board-neuros-osd2.c b/arch/arm/mach-davinci/board-neuros-osd2.c
index 3e3e3af..bad8192 100644
--- a/arch/arm/mach-davinci/board-neuros-osd2.c
+++ b/arch/arm/mach-davinci/board-neuros-osd2.c
@@ -164,7 +164,6 @@ static void __init davinci_ntosd2_map_io(void)
 
 static struct davinci_mmc_config davinci_ntosd2_mmc_config = {
 	.wires		= 4,
-	.version	= MMC_CTLR_VERSION_1
 };
 
 
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index dc1208e..4331ff3 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -138,7 +138,6 @@ static struct davinci_mmc_config da850_mmc_config = {
 	.wires		= 4,
 	.max_freq	= 50000000,
 	.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_2,
 };
 
 static __init void omapl138_hawk_mmc_init(void)
diff --git a/arch/arm/mach-davinci/board-tnetv107x-evm.c b/arch/arm/mach-davinci/board-tnetv107x-evm.c
index be30997..42066ed 100644
--- a/arch/arm/mach-davinci/board-tnetv107x-evm.c
+++ b/arch/arm/mach-davinci/board-tnetv107x-evm.c
@@ -85,7 +85,6 @@ static struct davinci_mmc_config mmc_config = {
 	.wires		= 4,
 	.max_freq	= 50000000,
 	.caps		= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
-	.version	= MMC_CTLR_VERSION_1,
 };
 
 static const short sdio1_pins[] __initconst = {
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 678a54a..42ad1ab 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -394,7 +394,7 @@ static struct clk_lookup da830_clks[] = {
 	CLK(NULL,		"tpcc",		&tpcc_clk),
 	CLK(NULL,		"tptc0",	&tptc0_clk),
 	CLK(NULL,		"tptc1",	&tptc1_clk),
-	CLK("davinci_mmc.0",	NULL,		&mmcsd_clk),
+	CLK("davinci-mmc-da830.0", NULL,	&mmcsd_clk),
 	CLK(NULL,		"uart0",	&uart0_clk),
 	CLK(NULL,		"uart1",	&uart1_clk),
 	CLK(NULL,		"uart2",	&uart2_clk),
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 6b9154e..364f61d 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -404,8 +404,8 @@ static struct clk_lookup da850_clks[] = {
 	CLK("davinci_emac.1",	NULL,		&emac_clk),
 	CLK("davinci-mcasp.0",	NULL,		&mcasp_clk),
 	CLK("da8xx_lcdc.0",	"fck",		&lcdc_clk),
-	CLK("davinci_mmc.0",	NULL,		&mmcsd0_clk),
-	CLK("davinci_mmc.1",	NULL,		&mmcsd1_clk),
+	CLK("davinci-mmc-da830.0", NULL,	&mmcsd0_clk),
+	CLK("davinci-mmc-da830.1", NULL,	&mmcsd1_clk),
 	CLK(NULL,		"aemif",	&aemif_clk),
 	CLK(NULL,		"usb11",	&usb11_clk),
 	CLK(NULL,		"usb20",	&usb20_clk),
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index cc6916d..3f27600 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -664,7 +664,7 @@ static struct resource da8xx_mmcsd0_resources[] = {
 };
 
 static struct platform_device da8xx_mmcsd0_device = {
-	.name		= "davinci_mmc",
+	.name		= "davinci-mmc-da830",
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(da8xx_mmcsd0_resources),
 	.resource	= da8xx_mmcsd0_resources,
@@ -701,7 +701,7 @@ static struct resource da850_mmcsd1_resources[] = {
 };
 
 static struct platform_device da850_mmcsd1_device = {
-	.name		= "davinci_mmc",
+	.name		= "davinci-mmc-da830",
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(da850_mmcsd1_resources),
 	.resource	= da850_mmcsd1_resources,
diff --git a/arch/arm/mach-davinci/devices-tnetv107x.c b/arch/arm/mach-davinci/devices-tnetv107x.c
index 773ab07..0eda4d1 100644
--- a/arch/arm/mach-davinci/devices-tnetv107x.c
+++ b/arch/arm/mach-davinci/devices-tnetv107x.c
@@ -218,7 +218,7 @@ static u64 mmc1_dma_mask = DMA_BIT_MASK(32);
 
 static struct platform_device mmc_devices[2] = {
 	{
-		.name		= "davinci_mmc",
+		.name		= "davinci-mmc-dm355",
 		.id		= 0,
 		.dev		= {
 			.dma_mask		= &mmc0_dma_mask,
@@ -228,7 +228,7 @@ static struct platform_device mmc_devices[2] = {
 		.resource	= mmc0_resources
 	},
 	{
-		.name		= "davinci_mmc",
+		.name		= "davinci-mmc-dm355",
 		.id		= 1,
 		.dev		= {
 			.dma_mask		= &mmc1_dma_mask,
diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c
index 4c48a36..92411b2 100644
--- a/arch/arm/mach-davinci/devices.c
+++ b/arch/arm/mach-davinci/devices.c
@@ -150,7 +150,7 @@ static struct resource mmcsd0_resources[] = {
 };
 
 static struct platform_device davinci_mmcsd0_device = {
-	.name = "davinci_mmc",
+	.name = "davinci-mmc-dm355",
 	.id = 0,
 	.dev = {
 		.dma_mask = &mmcsd0_dma_mask,
@@ -187,7 +187,7 @@ static struct resource mmcsd1_resources[] = {
 };
 
 static struct platform_device davinci_mmcsd1_device = {
-	.name = "davinci_mmc",
+	.name = "davinci-mmc-dm355",
 	.id = 1,
 	.dev = {
 		.dma_mask = &mmcsd1_dma_mask,
@@ -235,6 +235,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
 			mmcsd1_resources[0].end = DM365_MMCSD1_BASE +
 							SZ_4K - 1;
 			mmcsd1_resources[2].start = IRQ_DM365_SDIOINT1;
+			davinci_mmcsd1_device.name = "davinci-mmc-da830";
 		} else
 			break;
 
@@ -256,6 +257,7 @@ void __init davinci_setup_mmc(int module, struct davinci_mmc_config *config)
 			mmcsd0_resources[0].end = DM365_MMCSD0_BASE +
 							SZ_4K - 1;
 			mmcsd0_resources[2].start = IRQ_DM365_SDIOINT0;
+			davinci_mmcsd0_device.name = "davinci-mmc-da830";
 		} else if (cpu_is_davinci_dm644x()) {
 			/* REVISIT: should this be in board-init code? */
 			/* Power-on 3.3V IO cells */
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index b49c3b7..ed3e79a 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -361,8 +361,8 @@ static struct clk_lookup dm355_clks[] = {
 	CLK("i2c_davinci.1", NULL, &i2c_clk),
 	CLK("davinci-mcbsp.0", NULL, &asp0_clk),
 	CLK("davinci-mcbsp.1", NULL, &asp1_clk),
-	CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
-	CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
+	CLK("davinci-mmc-dm355.0", NULL, &mmcsd0_clk),
+	CLK("davinci-mmc-dm355.1", NULL, &mmcsd1_clk),
 	CLK("spi_davinci.0", NULL, &spi0_clk),
 	CLK("spi_davinci.1", NULL, &spi1_clk),
 	CLK("spi_davinci.2", NULL, &spi2_clk),
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 6c39805..3f46b24 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -454,8 +454,8 @@ static struct clk_lookup dm365_clks[] = {
 	CLK(NULL, "uart0", &uart0_clk),
 	CLK(NULL, "uart1", &uart1_clk),
 	CLK("i2c_davinci.1", NULL, &i2c_clk),
-	CLK("davinci_mmc.0", NULL, &mmcsd0_clk),
-	CLK("davinci_mmc.1", NULL, &mmcsd1_clk),
+	CLK("davinci-mmc-da830.0", NULL, &mmcsd0_clk),
+	CLK("davinci-mmc-da830.1", NULL, &mmcsd1_clk),
 	CLK("spi_davinci.0", NULL, &spi0_clk),
 	CLK("spi_davinci.1", NULL, &spi1_clk),
 	CLK("spi_davinci.2", NULL, &spi2_clk),
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 11c79a3..5e1e502 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -310,7 +310,7 @@ static struct clk_lookup dm644x_clks[] = {
 	CLK("i2c_davinci.1", NULL, &i2c_clk),
 	CLK("palm_bk3710", NULL, &ide_clk),
 	CLK("davinci-mcbsp", NULL, &asp_clk),
-	CLK("davinci_mmc.0", NULL, &mmcsd_clk),
+	CLK("davinci-mmc-dm355.0", NULL, &mmcsd_clk),
 	CLK(NULL, "spi", &spi_clk),
 	CLK(NULL, "gpio", &gpio_clk),
 	CLK(NULL, "usb", &usb_clk),
diff --git a/arch/arm/mach-davinci/tnetv107x.c b/arch/arm/mach-davinci/tnetv107x.c
index dc1a209..f9b9399 100644
--- a/arch/arm/mach-davinci/tnetv107x.c
+++ b/arch/arm/mach-davinci/tnetv107x.c
@@ -272,7 +272,7 @@ static struct clk_lookup clks[] = {
 	CLK("tnetv107x-keypad.0", NULL,			&clk_keypad),
 	CLK(NULL,		"clk_gpio",		&clk_gpio),
 	CLK(NULL,		"clk_mdio",		&clk_mdio),
-	CLK("davinci_mmc.0",	NULL,			&clk_sdio0),
+	CLK("davinci-mmc-dm355.0",	NULL,			&clk_sdio0),
 	CLK(NULL,		"uart0",		&clk_uart0),
 	CLK(NULL,		"uart1",		&clk_uart1),
 	CLK(NULL,		"timer0",		&clk_timer0),
@@ -292,7 +292,7 @@ static struct clk_lookup clks[] = {
 	CLK(NULL,		"clk_system",		&clk_system),
 	CLK(NULL,		"clk_imcop",		&clk_imcop),
 	CLK(NULL,		"clk_spare",		&clk_spare),
-	CLK("davinci_mmc.1",	NULL,			&clk_sdio1),
+	CLK("davinci-mmc-dm355.1",	NULL,			&clk_sdio1),
 	CLK(NULL,		"clk_ddr2_vrst",	&clk_ddr2_vrst),
 	CLK(NULL,		"clk_ddr2_vctl_rst",	&clk_ddr2_vctl_rst),
 	CLK(NULL,		NULL,			NULL),
-- 
1.7.4.1

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

* [PATCH v4 2/5] mmc: davinci_mmc: derive controller IP version from platform_device_id
  2013-02-15  6:21 ` Manjunathappa, Prakash
@ 2013-02-15  6:21   ` Manjunathappa, Prakash
  -1 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:21 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

Stop getting controller IP version via platform data, instead derive it
from platform_device_id table.

Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
---
Suppose to be v1 but got added later to this series.

 drivers/mmc/host/davinci_mmc.c            |   17 ++++++++++++++++-
 include/linux/platform_data/mmc-davinci.h |    3 ---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 27123f8..874dc60 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1156,6 +1156,17 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
 
 	mmc_davinci_reset_ctrl(host, 0);
 }
+static struct platform_device_id davinci_mmc_devtype[] = {
+	{
+		.name	= "davinci-mmc-dm355",
+		.driver_data = MMC_CTLR_VERSION_1,
+	}, {
+		.name	= "davinci-mmc-da830",
+		.driver_data = MMC_CTLR_VERSION_2,
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
 
 static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 {
@@ -1165,6 +1176,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 	struct resource *r, *mem = NULL;
 	int ret = 0, irq = 0;
 	size_t mem_size;
+	const struct platform_device_id *id_entry;
 
 	/* REVISIT:  when we're fully converted, fail if pdata is NULL */
 
@@ -1239,7 +1251,9 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 	if (pdata && (pdata->wires == 8))
 		mmc->caps |= (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA);
 
-	host->version = pdata->version;
+	id_entry = platform_get_device_id(pdev);
+	if (id_entry)
+		host->version = id_entry->driver_data;
 
 	mmc->ops = &mmc_davinci_ops;
 	mmc->f_min = 312500;
@@ -1410,6 +1424,7 @@ static struct platform_driver davinci_mmcsd_driver = {
 		.pm	= davinci_mmcsd_pm_ops,
 	},
 	.remove		= __exit_p(davinci_mmcsd_remove),
+	.id_table	= davinci_mmc_devtype,
 };
 
 static int __init davinci_mmcsd_init(void)
diff --git a/include/linux/platform_data/mmc-davinci.h b/include/linux/platform_data/mmc-davinci.h
index 5ba6b22..9cea4ee 100644
--- a/include/linux/platform_data/mmc-davinci.h
+++ b/include/linux/platform_data/mmc-davinci.h
@@ -23,9 +23,6 @@ struct davinci_mmc_config {
 	/* any additional host capabilities: OR'd in to mmc->f_caps */
 	u32     caps;
 
-	/* Version of the MMC/SD controller */
-	u8	version;
-
 	/* Number of sg segments */
 	u8	nr_sg;
 };
-- 
1.7.4.1


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

* [PATCH v4 2/5] mmc: davinci_mmc: derive controller IP version from platform_device_id
@ 2013-02-15  6:21   ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:21 UTC (permalink / raw)
  To: linux-arm-kernel

Stop getting controller IP version via platform data, instead derive it
from platform_device_id table.

Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
---
Suppose to be v1 but got added later to this series.

 drivers/mmc/host/davinci_mmc.c            |   17 ++++++++++++++++-
 include/linux/platform_data/mmc-davinci.h |    3 ---
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
index 27123f8..874dc60 100644
--- a/drivers/mmc/host/davinci_mmc.c
+++ b/drivers/mmc/host/davinci_mmc.c
@@ -1156,6 +1156,17 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
 
 	mmc_davinci_reset_ctrl(host, 0);
 }
+static struct platform_device_id davinci_mmc_devtype[] = {
+	{
+		.name	= "davinci-mmc-dm355",
+		.driver_data = MMC_CTLR_VERSION_1,
+	}, {
+		.name	= "davinci-mmc-da830",
+		.driver_data = MMC_CTLR_VERSION_2,
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
 
 static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 {
@@ -1165,6 +1176,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 	struct resource *r, *mem = NULL;
 	int ret = 0, irq = 0;
 	size_t mem_size;
+	const struct platform_device_id *id_entry;
 
 	/* REVISIT:  when we're fully converted, fail if pdata is NULL */
 
@@ -1239,7 +1251,9 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 	if (pdata && (pdata->wires == 8))
 		mmc->caps |= (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA);
 
-	host->version = pdata->version;
+	id_entry = platform_get_device_id(pdev);
+	if (id_entry)
+		host->version = id_entry->driver_data;
 
 	mmc->ops = &mmc_davinci_ops;
 	mmc->f_min = 312500;
@@ -1410,6 +1424,7 @@ static struct platform_driver davinci_mmcsd_driver = {
 		.pm	= davinci_mmcsd_pm_ops,
 	},
 	.remove		= __exit_p(davinci_mmcsd_remove),
+	.id_table	= davinci_mmc_devtype,
 };
 
 static int __init davinci_mmcsd_init(void)
diff --git a/include/linux/platform_data/mmc-davinci.h b/include/linux/platform_data/mmc-davinci.h
index 5ba6b22..9cea4ee 100644
--- a/include/linux/platform_data/mmc-davinci.h
+++ b/include/linux/platform_data/mmc-davinci.h
@@ -23,9 +23,6 @@ struct davinci_mmc_config {
 	/* any additional host capabilities: OR'd in to mmc->f_caps */
 	u32     caps;
 
-	/* Version of the MMC/SD controller */
-	u8	version;
-
 	/* Number of sg segments */
 	u8	nr_sg;
 };
-- 
1.7.4.1

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

* [PATCH v4 3/5] mmc: davinci_mmc: add DT support
  2013-02-15  6:21 ` Manjunathappa, Prakash
@ 2013-02-15  6:22   ` Manjunathappa, Prakash
  -1 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:22 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>
Reviewed-by: Mark Rutland <mark.rutland@arm.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                     |   66 +++++++++++++++++++-
 2 files changed, 89 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 874dc60..6b08b9a 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>
 
@@ -1156,6 +1158,7 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
 
 	mmc_davinci_reset_ctrl(host, 0);
 }
+
 static struct platform_device_id davinci_mmc_devtype[] = {
 	{
 		.name	= "davinci-mmc-dm355",
@@ -1168,9 +1171,63 @@ static struct platform_device_id davinci_mmc_devtype[] = {
 };
 MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
 
-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 = &davinci_mmc_devtype[MMC_CTLR_VERSION_1],
+	},
+	{
+		.compatible = "ti,davinci-mmc-da830",
+		.data = &davinci_mmc_devtype[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)
+		pdev->id_entry = 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;
@@ -1178,7 +1235,11 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 	size_t mem_size;
 	const struct platform_device_id *id_entry;
 
-	/* 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);
@@ -1422,6 +1483,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),
 	.id_table	= davinci_mmc_devtype,
-- 
1.7.4.1


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

* [PATCH v4 3/5] mmc: davinci_mmc: add DT support
@ 2013-02-15  6:22   ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:22 UTC (permalink / raw)
  To: linux-arm-kernel

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>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Cc: linux-mmc at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: davinci-linux-open-source at linux.davincidsp.com
Cc: devicetree-discuss at lists.ozlabs.org
Cc: cjb at laptop.org
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: mporter at 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                     |   66 +++++++++++++++++++-
 2 files changed, 89 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 at 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 874dc60..6b08b9a 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>
 
@@ -1156,6 +1158,7 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
 
 	mmc_davinci_reset_ctrl(host, 0);
 }
+
 static struct platform_device_id davinci_mmc_devtype[] = {
 	{
 		.name	= "davinci-mmc-dm355",
@@ -1168,9 +1171,63 @@ static struct platform_device_id davinci_mmc_devtype[] = {
 };
 MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
 
-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 = &davinci_mmc_devtype[MMC_CTLR_VERSION_1],
+	},
+	{
+		.compatible = "ti,davinci-mmc-da830",
+		.data = &davinci_mmc_devtype[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)
+		pdev->id_entry = 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;
@@ -1178,7 +1235,11 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 	size_t mem_size;
 	const struct platform_device_id *id_entry;
 
-	/* 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);
@@ -1422,6 +1483,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),
 	.id_table	= davinci_mmc_devtype,
-- 
1.7.4.1

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

* [PATCH v4 4/5] ARM: davinci: da850: add mmc DT entries
  2013-02-15  6:21 ` Manjunathappa, Prakash
  (?)
@ 2013-02-15  6:22   ` Manjunathappa, Prakash
  -1 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:22 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

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: 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:
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] 29+ messages in thread

* [PATCH v4 4/5] ARM: davinci: da850: add mmc DT entries
@ 2013-02-15  6:22   ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:22 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

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: 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:
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] 29+ messages in thread

* [PATCH v4 4/5] ARM: davinci: da850: add mmc DT entries
@ 2013-02-15  6:22   ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:22 UTC (permalink / raw)
  To: linux-arm-kernel

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 at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Cc: davinci-linux-open-source at linux.davincidsp.com
Cc: devicetree-discuss at lists.ozlabs.org
Cc: cjb at 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 at 1c21000 {
 			status = "okay";
 		};
+		mmc0: mmc at 1c40000 {
+			max-frequency = <50000000>;
+			bus-width = <4>;
+			status = "okay";
+			pinctrl-names = "default";
+			pinctrl-0 = <&mmc0_pins>;
+		};
 	};
 	nand_cs3 at 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 at 1c42000 {
 			compatible = "ns16550a";
@@ -110,6 +119,11 @@
 		wdt: wdt at 1c21000 {
 			compatible = "ti,davinci-wdt";
 			reg = <0x21000 0x1000>;
+		};
+		mmc0: mmc at 1c40000 {
+			compatible = "ti,davinci-mmc-da830";
+			reg = <0x40000 0x1000>;
+			interrupts = <16>;
 			status = "disabled";
 		};
 	};
-- 
1.7.4.1

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

* [PATCH v4 5/5] ARM: davinci: da850: override mmc DT node device name
@ 2013-02-15  6:22   ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:22 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.

 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..2b740a9 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-da830.0",
+			NULL),
 	{}
 };
 
-- 
1.7.4.1


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

* [PATCH v4 5/5] ARM: davinci: da850: override mmc DT node device name
@ 2013-02-15  6:22   ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:22 UTC (permalink / raw)
  To: linux-mmc-u79uwXL29TY76Z2rM5mHXA
  Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	cjb-2X9k7bc8m7Mdnm+yROfE0A, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	linux-doc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, nsekhar-l0cyMroinI0,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Manjunathappa, Prakash,
	hs-ynQEQJNshbs,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

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-l0cyMroinI0@public.gmane.org>
Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Cc: cjb-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org
Cc: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>
---
Since v2:
Rebased on top of v3.9/dt-2 branch of linux_davinci and reordered this patch.

 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..2b740a9 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-da830.0",
+			NULL),
 	{}
 };
 
-- 
1.7.4.1

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

* [PATCH v4 5/5] ARM: davinci: da850: override mmc DT node device name
@ 2013-02-15  6:22   ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-02-15  6:22 UTC (permalink / raw)
  To: linux-arm-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 at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Cc: davinci-linux-open-source at linux.davincidsp.com
Cc: devicetree-discuss at lists.ozlabs.org
Cc: cjb at 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.

 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..2b740a9 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-da830.0",
+			NULL),
 	{}
 };
 
-- 
1.7.4.1

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

* Re: [PATCH v4 3/5] mmc: davinci_mmc: add DT support
  2013-02-15  6:22   ` Manjunathappa, Prakash
@ 2013-02-27 11:43     ` Sekhar Nori
  -1 siblings, 0 replies; 29+ messages in thread
From: Sekhar Nori @ 2013-02-27 11:43 UTC (permalink / raw)
  To: Manjunathappa, Prakash
  Cc: linux-mmc, grant.likely, rob.herring, rob, linux, hs,
	devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
	davinci-linux-open-source, mporter

On 2/15/2013 11:52 AM, 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>
> Reviewed-by: Mark Rutland <mark.rutland@arm.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

> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 874dc60..6b08b9a 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>
>  
> @@ -1156,6 +1158,7 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
>  
>  	mmc_davinci_reset_ctrl(host, 0);
>  }
> +

Stray line addition.

>  static struct platform_device_id davinci_mmc_devtype[] = {
>  	{
>  		.name	= "davinci-mmc-dm355",
> @@ -1168,9 +1171,63 @@ static struct platform_device_id davinci_mmc_devtype[] = {
>  };
>  MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
>  
> -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 = &davinci_mmc_devtype[MMC_CTLR_VERSION_1],
> +	},
> +	{
> +		.compatible = "ti,davinci-mmc-da830",
> +		.data = &davinci_mmc_devtype[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;

devm_kzalloc() returns NULL on error so you will end up returning
success in this case.

> +	}
> +
> +	if (match)
> +		pdev->id_entry = 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() returns error on failure. pdata->max_freq is not
guaranteed to be zero in case of error. See comments atop
of_property_read_u32_array().

> +
> +	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;
> +}
> +

Thanks,
Sekhar

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

* [PATCH v4 3/5] mmc: davinci_mmc: add DT support
@ 2013-02-27 11:43     ` Sekhar Nori
  0 siblings, 0 replies; 29+ messages in thread
From: Sekhar Nori @ 2013-02-27 11:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 2/15/2013 11:52 AM, 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>
> Reviewed-by: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-mmc at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: davinci-linux-open-source at linux.davincidsp.com
> Cc: devicetree-discuss at lists.ozlabs.org
> Cc: cjb at laptop.org
> Cc: Sekhar Nori <nsekhar@ti.com>
> Cc: mporter at ti.com

> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index 874dc60..6b08b9a 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>
>  
> @@ -1156,6 +1158,7 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
>  
>  	mmc_davinci_reset_ctrl(host, 0);
>  }
> +

Stray line addition.

>  static struct platform_device_id davinci_mmc_devtype[] = {
>  	{
>  		.name	= "davinci-mmc-dm355",
> @@ -1168,9 +1171,63 @@ static struct platform_device_id davinci_mmc_devtype[] = {
>  };
>  MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
>  
> -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 = &davinci_mmc_devtype[MMC_CTLR_VERSION_1],
> +	},
> +	{
> +		.compatible = "ti,davinci-mmc-da830",
> +		.data = &davinci_mmc_devtype[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;

devm_kzalloc() returns NULL on error so you will end up returning
success in this case.

> +	}
> +
> +	if (match)
> +		pdev->id_entry = 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() returns error on failure. pdata->max_freq is not
guaranteed to be zero in case of error. See comments atop
of_property_read_u32_array().

> +
> +	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;
> +}
> +

Thanks,
Sekhar

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

* Re: [PATCH v4 1/5] ARM: davinci: mmc: derive version information from device name
  2013-02-15  6:21   ` Manjunathappa, Prakash
@ 2013-02-27 11:45     ` Sekhar Nori
  -1 siblings, 0 replies; 29+ messages in thread
From: Sekhar Nori @ 2013-02-27 11:45 UTC (permalink / raw)
  To: Manjunathappa, Prakash
  Cc: linux-mmc, grant.likely, rob.herring, rob, linux, hs,
	devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
	davinci-linux-open-source

On 2/15/2013 11:51 AM, Manjunathappa, Prakash wrote:
> Remove specifying mmc controller IP version information via platform
> data, instead specify device name so that driver derives it from
> platform_device_id table. Also change the clock node name to match
> the changed dev_id.
> Tested on da850-evm to make sure driver loads without clk_get failures.
> 
> Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>

The patch looks good to me, but after this patch MMC/SD will be broken.
I suggest merging this into 2/5. It makes little sense without those
changes anyway.

Thanks,
Sekhar

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

* [PATCH v4 1/5] ARM: davinci: mmc: derive version information from device name
@ 2013-02-27 11:45     ` Sekhar Nori
  0 siblings, 0 replies; 29+ messages in thread
From: Sekhar Nori @ 2013-02-27 11:45 UTC (permalink / raw)
  To: linux-arm-kernel

On 2/15/2013 11:51 AM, Manjunathappa, Prakash wrote:
> Remove specifying mmc controller IP version information via platform
> data, instead specify device name so that driver derives it from
> platform_device_id table. Also change the clock node name to match
> the changed dev_id.
> Tested on da850-evm to make sure driver loads without clk_get failures.
> 
> Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>

The patch looks good to me, but after this patch MMC/SD will be broken.
I suggest merging this into 2/5. It makes little sense without those
changes anyway.

Thanks,
Sekhar

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

* Re: [PATCH v4 5/5] ARM: davinci: da850: override mmc DT node device name
  2013-02-15  6:22   ` Manjunathappa, Prakash
@ 2013-02-27 14:04     ` Rob Herring
  -1 siblings, 0 replies; 29+ messages in thread
From: Rob Herring @ 2013-02-27 14:04 UTC (permalink / raw)
  To: Manjunathappa, Prakash
  Cc: linux-mmc, grant.likely, rob, linux, nsekhar, hs,
	devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
	davinci-linux-open-source, linux-kernel

On 02/15/2013 12:22 AM, Manjunathappa, Prakash wrote:
> 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.
> 
>  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..2b740a9 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-da830.0",
> +			NULL),

If you only need clock lookup, just add a clkdev entry with the new name.

Rob

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

* [PATCH v4 5/5] ARM: davinci: da850: override mmc DT node device name
@ 2013-02-27 14:04     ` Rob Herring
  0 siblings, 0 replies; 29+ messages in thread
From: Rob Herring @ 2013-02-27 14:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/15/2013 12:22 AM, Manjunathappa, Prakash wrote:
> 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 at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> Cc: linux-kernel at vger.kernel.org
> Cc: davinci-linux-open-source at linux.davincidsp.com
> Cc: devicetree-discuss at lists.ozlabs.org
> Cc: cjb at 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.
> 
>  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..2b740a9 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-da830.0",
> +			NULL),

If you only need clock lookup, just add a clkdev entry with the new name.

Rob

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

* Re: [PATCH v4 5/5] ARM: davinci: da850: override mmc DT node device name
  2013-02-27 14:04     ` Rob Herring
  (?)
@ 2013-02-28 10:51       ` Sekhar Nori
  -1 siblings, 0 replies; 29+ messages in thread
From: Sekhar Nori @ 2013-02-28 10:51 UTC (permalink / raw)
  To: Rob Herring
  Cc: Manjunathappa, Prakash, linux-mmc, grant.likely, rob, linux, hs,
	devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
	davinci-linux-open-source, linux-kernel

Hi Rob,

On 2/27/2013 7:34 PM, Rob Herring wrote:
> On 02/15/2013 12:22 AM, Manjunathappa, Prakash wrote:
>> 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.
>>
>>  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..2b740a9 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-da830.0",
>> +			NULL),
> 
> If you only need clock lookup, just add a clkdev entry with the new name.

That would work, but wouldn't it be better to keep this here so it can
all be dropped once clocks are converted to DT?

Thanks,
Sekhar

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

* Re: [PATCH v4 5/5] ARM: davinci: da850: override mmc DT node device name
@ 2013-02-28 10:51       ` Sekhar Nori
  0 siblings, 0 replies; 29+ messages in thread
From: Sekhar Nori @ 2013-02-28 10:51 UTC (permalink / raw)
  To: Rob Herring
  Cc: Manjunathappa, Prakash, linux-mmc, grant.likely, rob, linux, hs,
	devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
	davinci-linux-open-source, linux-kernel

Hi Rob,

On 2/27/2013 7:34 PM, Rob Herring wrote:
> On 02/15/2013 12:22 AM, Manjunathappa, Prakash wrote:
>> 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.
>>
>>  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..2b740a9 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-da830.0",
>> +			NULL),
> 
> If you only need clock lookup, just add a clkdev entry with the new name.

That would work, but wouldn't it be better to keep this here so it can
all be dropped once clocks are converted to DT?

Thanks,
Sekhar

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

* [PATCH v4 5/5] ARM: davinci: da850: override mmc DT node device name
@ 2013-02-28 10:51       ` Sekhar Nori
  0 siblings, 0 replies; 29+ messages in thread
From: Sekhar Nori @ 2013-02-28 10:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Rob,

On 2/27/2013 7:34 PM, Rob Herring wrote:
> On 02/15/2013 12:22 AM, Manjunathappa, Prakash wrote:
>> 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 at vger.kernel.org
>> Cc: linux-arm-kernel at lists.infradead.org
>> Cc: linux-kernel at vger.kernel.org
>> Cc: davinci-linux-open-source at linux.davincidsp.com
>> Cc: devicetree-discuss at lists.ozlabs.org
>> Cc: cjb at 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.
>>
>>  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..2b740a9 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-da830.0",
>> +			NULL),
> 
> If you only need clock lookup, just add a clkdev entry with the new name.

That would work, but wouldn't it be better to keep this here so it can
all be dropped once clocks are converted to DT?

Thanks,
Sekhar

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

* RE: [PATCH v4 3/5] mmc: davinci_mmc: add DT support
  2013-02-27 11:43     ` Sekhar Nori
@ 2013-03-05 11:24       ` Manjunathappa, Prakash
  -1 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-03-05 11:24 UTC (permalink / raw)
  To: Nori, Sekhar
  Cc: linux-mmc, grant.likely, rob.herring, rob, linux, hs,
	devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
	davinci-linux-open-source, Porter, Matt

Hi Sekhar,

On Wed, Feb 27, 2013 at 17:13:43, Nori, Sekhar wrote:
> On 2/15/2013 11:52 AM, 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>
> > Reviewed-by: Mark Rutland <mark.rutland@arm.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
> 
> > diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> > index 874dc60..6b08b9a 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>
> >  
> > @@ -1156,6 +1158,7 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
> >  
> >  	mmc_davinci_reset_ctrl(host, 0);
> >  }
> > +
> 
> Stray line addition.
> 

I will fix this.

> >  static struct platform_device_id davinci_mmc_devtype[] = {
> >  	{
> >  		.name	= "davinci-mmc-dm355",
> > @@ -1168,9 +1171,63 @@ static struct platform_device_id davinci_mmc_devtype[] = {
> >  };
> >  MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
> >  
> > -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 = &davinci_mmc_devtype[MMC_CTLR_VERSION_1],
> > +	},
> > +	{
> > +		.compatible = "ti,davinci-mmc-da830",
> > +		.data = &davinci_mmc_devtype[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;
> 
> devm_kzalloc() returns NULL on error so you will end up returning
> success in this case.
> 

Returns NULL on failure, caller is checking on NULL for failures.

        pdata = mmc_parse_pdata(pdev);
        if (pdata == NULL) {
                dev_err(&pdev->dev, "Can not get platform data\n");
                return -ENOENT;
        }

> > +	}
> > +
> > +	if (match)
> > +		pdev->id_entry = 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() returns error on failure. pdata->max_freq is not
> guaranteed to be zero in case of error. See comments atop
> of_property_read_u32_array().
> 

As pdata is from kzalloc, max_freq will remain NULL in case of_property_read_u32_array fails.
It makes sense to check for return value, I agree to change this.

Thanks,
Prakash

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

* [PATCH v4 3/5] mmc: davinci_mmc: add DT support
@ 2013-03-05 11:24       ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-03-05 11:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sekhar,

On Wed, Feb 27, 2013 at 17:13:43, Nori, Sekhar wrote:
> On 2/15/2013 11:52 AM, 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>
> > Reviewed-by: Mark Rutland <mark.rutland@arm.com>
> > Cc: linux-mmc at vger.kernel.org
> > Cc: linux-arm-kernel at lists.infradead.org
> > Cc: davinci-linux-open-source at linux.davincidsp.com
> > Cc: devicetree-discuss at lists.ozlabs.org
> > Cc: cjb at laptop.org
> > Cc: Sekhar Nori <nsekhar@ti.com>
> > Cc: mporter at ti.com
> 
> > diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> > index 874dc60..6b08b9a 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>
> >  
> > @@ -1156,6 +1158,7 @@ static void __init init_mmcsd_host(struct mmc_davinci_host *host)
> >  
> >  	mmc_davinci_reset_ctrl(host, 0);
> >  }
> > +
> 
> Stray line addition.
> 

I will fix this.

> >  static struct platform_device_id davinci_mmc_devtype[] = {
> >  	{
> >  		.name	= "davinci-mmc-dm355",
> > @@ -1168,9 +1171,63 @@ static struct platform_device_id davinci_mmc_devtype[] = {
> >  };
> >  MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
> >  
> > -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 = &davinci_mmc_devtype[MMC_CTLR_VERSION_1],
> > +	},
> > +	{
> > +		.compatible = "ti,davinci-mmc-da830",
> > +		.data = &davinci_mmc_devtype[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;
> 
> devm_kzalloc() returns NULL on error so you will end up returning
> success in this case.
> 

Returns NULL on failure, caller is checking on NULL for failures.

        pdata = mmc_parse_pdata(pdev);
        if (pdata == NULL) {
                dev_err(&pdev->dev, "Can not get platform data\n");
                return -ENOENT;
        }

> > +	}
> > +
> > +	if (match)
> > +		pdev->id_entry = 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() returns error on failure. pdata->max_freq is not
> guaranteed to be zero in case of error. See comments atop
> of_property_read_u32_array().
> 

As pdata is from kzalloc, max_freq will remain NULL in case of_property_read_u32_array fails.
It makes sense to check for return value, I agree to change this.

Thanks,
Prakash

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

* RE: [PATCH v4 1/5] ARM: davinci: mmc: derive version information from device name
  2013-02-27 11:45     ` Sekhar Nori
@ 2013-03-05 11:24       ` Manjunathappa, Prakash
  -1 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-03-05 11:24 UTC (permalink / raw)
  To: Nori, Sekhar
  Cc: linux-mmc, grant.likely, rob.herring, rob, linux, hs,
	devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
	davinci-linux-open-source

On Wed, Feb 27, 2013 at 17:15:59, Nori, Sekhar wrote:
> On 2/15/2013 11:51 AM, Manjunathappa, Prakash wrote:
> > Remove specifying mmc controller IP version information via platform
> > data, instead specify device name so that driver derives it from
> > platform_device_id table. Also change the clock node name to match
> > the changed dev_id.
> > Tested on da850-evm to make sure driver loads without clk_get failures.
> > 
> > Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
> 
> The patch looks good to me, but after this patch MMC/SD will be broken.
> I suggest merging this into 2/5. It makes little sense without those
> changes anyway.
> 

Ok I will merge this with 2/5.

Thanks,
Prakash 


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

* [PATCH v4 1/5] ARM: davinci: mmc: derive version information from device name
@ 2013-03-05 11:24       ` Manjunathappa, Prakash
  0 siblings, 0 replies; 29+ messages in thread
From: Manjunathappa, Prakash @ 2013-03-05 11:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Feb 27, 2013 at 17:15:59, Nori, Sekhar wrote:
> On 2/15/2013 11:51 AM, Manjunathappa, Prakash wrote:
> > Remove specifying mmc controller IP version information via platform
> > data, instead specify device name so that driver derives it from
> > platform_device_id table. Also change the clock node name to match
> > the changed dev_id.
> > Tested on da850-evm to make sure driver loads without clk_get failures.
> > 
> > Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
> 
> The patch looks good to me, but after this patch MMC/SD will be broken.
> I suggest merging this into 2/5. It makes little sense without those
> changes anyway.
> 

Ok I will merge this with 2/5.

Thanks,
Prakash 

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

* Re: [PATCH v4 3/5] mmc: davinci_mmc: add DT support
  2013-03-05 11:24       ` Manjunathappa, Prakash
@ 2013-03-05 11:46         ` Sekhar Nori
  -1 siblings, 0 replies; 29+ messages in thread
From: Sekhar Nori @ 2013-03-05 11:46 UTC (permalink / raw)
  To: Manjunathappa, Prakash
  Cc: linux-mmc, grant.likely, rob.herring, rob, linux, hs,
	devicetree-discuss, linux-doc, linux-arm-kernel, cjb,
	davinci-linux-open-source, Porter, Matt

On 3/5/2013 4:54 PM, Manjunathappa, Prakash wrote:

>>> +	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;
>>
>> devm_kzalloc() returns NULL on error so you will end up returning
>> success in this case.
>>
> 
> Returns NULL on failure, caller is checking on NULL for failures.
> 
>         pdata = mmc_parse_pdata(pdev);
>         if (pdata == NULL) {
>                 dev_err(&pdev->dev, "Can not get platform data\n");
>                 return -ENOENT;
>         }

Ha, okay. I was somehow confused into thinking this is part of probe
routine.

Thanks,
Sekhar

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

* [PATCH v4 3/5] mmc: davinci_mmc: add DT support
@ 2013-03-05 11:46         ` Sekhar Nori
  0 siblings, 0 replies; 29+ messages in thread
From: Sekhar Nori @ 2013-03-05 11:46 UTC (permalink / raw)
  To: linux-arm-kernel

On 3/5/2013 4:54 PM, Manjunathappa, Prakash wrote:

>>> +	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;
>>
>> devm_kzalloc() returns NULL on error so you will end up returning
>> success in this case.
>>
> 
> Returns NULL on failure, caller is checking on NULL for failures.
> 
>         pdata = mmc_parse_pdata(pdev);
>         if (pdata == NULL) {
>                 dev_err(&pdev->dev, "Can not get platform data\n");
>                 return -ENOENT;
>         }

Ha, okay. I was somehow confused into thinking this is part of probe
routine.

Thanks,
Sekhar

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

end of thread, other threads:[~2013-03-05 11:46 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15  6:21 [PATCH v4 0/5] Add DT support for davinci_mmc driver Manjunathappa, Prakash
2013-02-15  6:21 ` Manjunathappa, Prakash
2013-02-15  6:21 ` [PATCH v4 1/5] ARM: davinci: mmc: derive version information from device name Manjunathappa, Prakash
2013-02-15  6:21   ` Manjunathappa, Prakash
2013-02-27 11:45   ` Sekhar Nori
2013-02-27 11:45     ` Sekhar Nori
2013-03-05 11:24     ` Manjunathappa, Prakash
2013-03-05 11:24       ` Manjunathappa, Prakash
2013-02-15  6:21 ` [PATCH v4 2/5] mmc: davinci_mmc: derive controller IP version from platform_device_id Manjunathappa, Prakash
2013-02-15  6:21   ` Manjunathappa, Prakash
2013-02-15  6:22 ` [PATCH v4 3/5] mmc: davinci_mmc: add DT support Manjunathappa, Prakash
2013-02-15  6:22   ` Manjunathappa, Prakash
2013-02-27 11:43   ` Sekhar Nori
2013-02-27 11:43     ` Sekhar Nori
2013-03-05 11:24     ` Manjunathappa, Prakash
2013-03-05 11:24       ` Manjunathappa, Prakash
2013-03-05 11:46       ` Sekhar Nori
2013-03-05 11:46         ` Sekhar Nori
2013-02-15  6:22 ` [PATCH v4 4/5] ARM: davinci: da850: add mmc DT entries Manjunathappa, Prakash
2013-02-15  6:22   ` Manjunathappa, Prakash
2013-02-15  6:22   ` Manjunathappa, Prakash
2013-02-15  6:22 ` [PATCH v4 5/5] ARM: davinci: da850: override mmc DT node device name Manjunathappa, Prakash
2013-02-15  6:22   ` Manjunathappa, Prakash
2013-02-15  6:22   ` Manjunathappa, Prakash
2013-02-27 14:04   ` Rob Herring
2013-02-27 14:04     ` Rob Herring
2013-02-28 10:51     ` Sekhar Nori
2013-02-28 10:51       ` Sekhar Nori
2013-02-28 10:51       ` Sekhar Nori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.