Skip to contentSkip to conversation

Add DT support for davinci_mmc driver

PATCH Superseded Manjunathappa, Prakash 2 participants 10 messages Mar 20, 2013 – Mar 27, 2013

Subsystems (5)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add DT support for davinci_mmc driver

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.

Applies on top of below patch series under community review:
"Enable SPI flash support on da850-evm DT kernel"
http://www.spinics.net/lists/arm-kernel/msg231546.html

This series is reviewed and tested by Sekhar Nori, with and without DT on da850 EVM.

Since v5:
Add below patch to this series.
"mmc: davinci: allow driver to work without DMA resource" Choose smaller device name, da830-mmc instead of davinci-mmc-da830 and dm6441-mmc instead of davinci-mmc-dm355.

Since v4:
Minor nit, check on return value for failure of max-frequency property parsing.
Merged patch "ARM: davinci: mmc: derive version information from device name" with patch 1/4.

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):
mmc: davinci: allow driver to work without DMA resource
ARM: davinci: mmc: derive version information from device name
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                       |   15 +++
 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                   |    1 +
 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                     |   92 ++++++++++++++++++--
 include/linux/platform_data/mmc-davinci.h          |    3 -
 23 files changed, 151 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/davinci_mmc.txt
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH v6 1/5 mmc: davinci: allow driver to work without DMA resource

Do not return probe failure with missing DMA resources, allow driver to work in PIO mode.
Tested on da850-evm by mounting partition followed by file creation and deletion.

---
 drivers/mmc/host/davinci_mmc.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
drivers/mmc/host/davinci_mmc.c +6 -4
index f5d46ea..bd848d3 100644
@@ -1191,13 +1191,15 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 
 	r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
 	if (!r)
-		goto out;
-	host->rxdma = r->start;
+		dev_warn(&pdev->dev, "RX DMA resource not specified\n");
+	else
+		host->rxdma = r->start;
 
 	r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
 	if (!r)
-		goto out;
-	host->txdma = r->start;
+		dev_warn(&pdev->dev, "TX DMA resource not specified\n");
+	else
+		host->txdma = r->start;
 
 	host->mem_res = mem;
 	host->base = ioremap(mem->start, mem_size);
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH v6 2/5 ARM: davinci: mmc: derive version information from device name

In reply to 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.

---
Since v5:
Choose smaller device name, da830-mmc instead of davinci-mmc-da830 and dm6441-mmc instead of davinci-mmc-dm355.

Since v4:
Merged patch "ARM: davinci: mmc: derive version information from device name" with this patch

 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 ++--
 drivers/mmc/host/davinci_mmc.c              |   18 +++++++++++++++++-
 include/linux/platform_data/mmc-davinci.h   |    3 ---
 19 files changed, 35 insertions(+), 29 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +0 -1
index 6da25ee..12e6f75 100644
@@ -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)
arch/arm/mach-davinci/board-da850-evm.c +0 -2
index c2dfe06..dcc8710 100644
@@ -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 = {
@@ -1372,7 +1371,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 = {
arch/arm/mach-davinci/board-dm355-evm.c +0 -1
index 147b8e1..bfdf8b9 100644
@@ -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
arch/arm/mach-davinci/board-dm365-evm.c +0 -1
index 1c9440b..312cc72 100644
@@ -256,7 +256,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)
arch/arm/mach-davinci/board-dm644x-evm.c +0 -1
index 71735e7..c0206d5 100644
@@ -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[] =  {
arch/arm/mach-davinci/board-neuros-osd2.c +0 -1
index 1c98107..b70e83c 100644
@@ -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
 };
 
 
arch/arm/mach-davinci/board-omapl138-hawk.c +0 -1
index 5a2bd44..328dbd8 100644
@@ -136,7 +136,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)
arch/arm/mach-davinci/board-tnetv107x-evm.c +0 -1
index 10c9efd..78ea395 100644
@@ -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 = {
arch/arm/mach-davinci/da830.c +1 -1
index 678a54a..abbaf02 100644
@@ -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("da830-mmc.0",	NULL,		&mmcsd_clk),
 	CLK(NULL,		"uart0",	&uart0_clk),
 	CLK(NULL,		"uart1",	&uart1_clk),
 	CLK(NULL,		"uart2",	&uart2_clk),
arch/arm/mach-davinci/da850.c +2 -2
index 0c4a26d..98642bd 100644
@@ -420,8 +420,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("da830-mmc.0",	NULL,		&mmcsd0_clk),
+	CLK("da830-mmc.1",	NULL,		&mmcsd1_clk),
 	CLK(NULL,		"aemif",	&aemif_clk),
 	CLK(NULL,		"usb11",	&usb11_clk),
 	CLK(NULL,		"usb20",	&usb20_clk),
arch/arm/mach-davinci/devices-da8xx.c +2 -2
index fc50243..cb97e07 100644
@@ -664,7 +664,7 @@ static struct resource da8xx_mmcsd0_resources[] = {
 };
 
 static struct platform_device da8xx_mmcsd0_device = {
-	.name		= "davinci_mmc",
+	.name		= "da830-mmc",
 	.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		= "da830-mmc",
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(da850_mmcsd1_resources),
 	.resource	= da850_mmcsd1_resources,
arch/arm/mach-davinci/devices-tnetv107x.c +2 -2
index ba37760..612a085 100644
@@ -218,7 +218,7 @@ static u64 mmc1_dma_mask = DMA_BIT_MASK(32);
 
 static struct platform_device mmc_devices[2] = {
 	{
-		.name		= "davinci_mmc",
+		.name		= "dm6441-mmc",
 		.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		= "dm6441-mmc",
 		.id		= 1,
 		.dev		= {
 			.dma_mask		= &mmc1_dma_mask,
arch/arm/mach-davinci/devices.c +4 -2
index ca0c7b3..69320eb 100644
@@ -154,7 +154,7 @@ static struct resource mmcsd0_resources[] = {
 };
 
 static struct platform_device davinci_mmcsd0_device = {
-	.name = "davinci_mmc",
+	.name = "dm6441-mmc",
 	.id = 0,
 	.dev = {
 		.dma_mask = &mmcsd0_dma_mask,
@@ -191,7 +191,7 @@ static struct resource mmcsd1_resources[] = {
 };
 
 static struct platform_device davinci_mmcsd1_device = {
-	.name = "davinci_mmc",
+	.name = "dm6441-mmc",
 	.id = 1,
 	.dev = {
 		.dma_mask = &mmcsd1_dma_mask,
@@ -239,6 +239,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 = "da830-mmc";
 		} else
 			break;
 
@@ -260,6 +261,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 = "da830-mmc";
 		} else if (cpu_is_davinci_dm644x()) {
 			/* REVISIT: should this be in board-init code? */
 			/* Power-on 3.3V IO cells */
arch/arm/mach-davinci/dm355.c +2 -2
index 53998d8..771f4bd 100644
@@ -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("dm6441-mmc.0", NULL, &mmcsd0_clk),
+	CLK("dm6441-mmc.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),
arch/arm/mach-davinci/dm365.c +2 -2
index 9b41d33..ba41435 100644
@@ -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("da830-mmc.0", NULL, &mmcsd0_clk),
+	CLK("da830-mmc.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),
arch/arm/mach-davinci/dm644x.c +1 -1
index e8bf21f..8854caa 100644
@@ -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("dm6441-mmc.0", NULL, &mmcsd_clk),
 	CLK(NULL, "spi", &spi_clk),
 	CLK(NULL, "gpio", &gpio_clk),
 	CLK(NULL, "usb", &usb_clk),
arch/arm/mach-davinci/tnetv107x.c +2 -2
index dc1a209..3b2a70d 100644
@@ -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("dm6441-mmc.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("dm6441-mmc.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),
drivers/mmc/host/davinci_mmc.c +17 -1
index bd848d3..7d0e684 100644
@@ -1158,6 +1158,18 @@ 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	= "dm6441-mmc",
+		.driver_data = MMC_CTLR_VERSION_1,
+	}, {
+		.name	= "da830-mmc",
+		.driver_data = MMC_CTLR_VERSION_2,
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(platform, davinci_mmc_devtype);
+
 static int __init davinci_mmcsd_probe(struct platform_device *pdev)
 {
 	struct davinci_mmc_config *pdata = pdev->dev.platform_data;
@@ -1166,6 +1178,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 */
 
@@ -1240,7 +1253,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;
@@ -1411,6 +1426,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)
include/linux/platform_data/mmc-davinci.h +0 -3
index 5ba6b22..9cea4ee 100644
@@ -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;
 };
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH v6 3/5 mmc: davinci_mmc: add DT support

In reply to Manjunathappa, Prakash

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.

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 <[email protected]>
Cc mporter at ti.com

---
Since v4:
Minor nit, check on return value for failure of max-frequency property parsing.

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.

 .../devicetree/bindings/mmc/davinci_mmc.txt        |   25 ++++++++
 drivers/mmc/host/davinci_mmc.c                     |   64 +++++++++++++++++++-
 2 files changed, 87 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/davinci_mmc.txt
Documentation/devicetree/bindings/mmc/davinci_mmc.txt new file +25 -0
new file mode 100644
index 0000000..c4413f7
@@ -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,da830-mmc": for da830, da850, dm365
+ Should be "ti,dm355-mmc": 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,da830-mmc",
+		reg = <0x40000 0x1000>;
+		interrupts = <16>;
+		status = "okay";
+		bus-width = <4>;
+		max-frequency = <50000000>;
+	};
drivers/mmc/host/davinci_mmc.c +62 -2

90 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#4 lore raw

PATCH v6 3/5 mmc: davinci_mmc: add DT support

Quoted 3 lines · Prakash

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.

Shouldn't the binding at least specify the names for the DMA channels? It's fine if the driver works without those, but I think there is no strict dependency here: If dma_request_slave_channel does not find a channel, the driver can just continue in PIO mode, and as soon as the EDMA driver is merged, it will work with DMA.

Arnd

#5 lore raw

PATCH v6 3/5 mmc: davinci_mmc: add DT support

Hi Arnd,

Quoted 11 lines · Arnd Bergmann
Quoted 3 lines · Prakash

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.

Shouldn't the binding at least specify the names for the DMA channels? It's fine if the driver works without those, but I think there is no strict dependency here: If dma_request_slave_channel does not find a channel, the driver can just continue in PIO mode, and as soon as the EDMA driver is merged, it will work with DMA.

In that case, don't I have to add support for it in driver also using dma_request_slave_channel_compat? As we do not have edma support yet on da850, I will not be able to test it.

Thanks,
Prakash

#6 lore raw

PATCH v6 3/5 mmc: davinci_mmc: add DT support

Quoted 12 lines · Prakash
Quoted 10 lines · Arnd Bergmann
Quoted 3 lines · Prakash

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.

Shouldn't the binding at least specify the names for the DMA channels? It's fine if the driver works without those, but I think there is no strict dependency here: If dma_request_slave_channel does not find a channel, the driver can just continue in PIO mode, and as soon as the EDMA driver is merged, it will work with DMA.

Quoted 3 lines

In that case, don't I have to add support for it in driver also using dma_request_slave_channel_compat? As we do not have edma support yet on da850, I will not be able to test it.

The code is independent of the binding in this case. If you already know that the hardware supports DMA channels and you will add support in the code later, I would recommend writing up the binding the way it should be used.

Arnd

#7 lore raw

PATCH v6 3/5 mmc: davinci_mmc: add DT support

Quoted 13 lines · Arnd Bergmann
Quoted 12 lines · Prakash
Quoted 10 lines · Arnd Bergmann
Quoted 3 lines · Prakash

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.

Shouldn't the binding at least specify the names for the DMA channels? It's fine if the driver works without those, but I think there is no strict dependency here: If dma_request_slave_channel does not find a channel, the driver can just continue in PIO mode, and as soon as the EDMA driver is merged, it will work with DMA.

Quoted 9 lines
Quoted 3 lines

In that case, don't I have to add support for it in driver also using dma_request_slave_channel_compat? As we do not have edma support yet on da850, I will not be able to test it.

The code is independent of the binding in this case. If you already know that the hardware supports DMA channels and you will add support in the code later, I would recommend writing up the binding the way it should be used.

Ok I will add support for DMA bindings with a note saying "not tested dma capability via DT".

Thanks,
Prakash

#8 lore raw

PATCH v6 4/5 ARM: davinci: da850: add mmc DT entries

In reply to Manjunathappa, Prakash

Add DT entry for MMC. Also add entry for pinmux information. Tested:
1) Without GPIO card detection and EDMA support as DT support for GPIO and EDMA are yet come.
2) By creating/deleting files and mounting/unmounting the partition.

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 <[email protected]>
---
 arch/arm/boot/dts/da850-evm.dts |    7 +++++++
 arch/arm/boot/dts/da850.dtsi    |   15 +++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
arch/arm/boot/dts/da850-evm.dts +7 -0
index fe2bbe7..bc1f951 100644
@@ -81,6 +81,13 @@
 				};
 			};
 		};
+		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";
arch/arm/boot/dts/da850.dtsi +15 -0
index 327fb06..ef22fa2 100644
@@ -70,6 +70,15 @@
 					0x14 0x00111111 0x00ffffff
 				>;
 			};
+			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";
@@ -115,6 +124,12 @@
 			reg = <0x21000 0x1000>;
 			status = "disabled";
 		};
+		mmc0: mmc at 1c40000 {
+			compatible = "ti,da830-mmc";
+			reg = <0x40000 0x1000>;
+			interrupts = <16>;
+			status = "disabled";
+		};
 		spi1: spi at 1f0e000 {
 			#address-cells = <1>;
 			#size-cells = <0>;
Signature · 1 line
1.7.4.1
#9 lore raw

PATCH v6 5/5 ARM: davinci: da850: override mmc DT node device name

In reply to Manjunathappa, Prakash

Populate OF_DEV_AUXDATA with desired device name expected by davinci_mmc driver. Without this clk_get of davinci_mmc DT driver fails.

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 <[email protected]>
---
 arch/arm/mach-davinci/da8xx-dt.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-davinci/da8xx-dt.c +1 -0
index 24146de..f581068 100644
@@ -41,6 +41,7 @@ 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,da830-spi", 0x01f0e000, "spi_davinci.1", NULL),
+	OF_DEV_AUXDATA("ti,da830-mmc", 0x01c40000, "da830-mmc.0", NULL),
 	{}
 };
 
Signature · 1 line
1.7.4.1