Skip to contentSkip to conversation

DaVinci: MMC: Updated MMC/SD controller driver for DaVinci family.

PATCH In review Purushotam Kumar 3 participants 4 messages Mar 18, 2009 – Mar 30, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 DaVinci: MMC: Updated MMC/SD controller driver for DaVinci family.

From: Purshotam Kumar <[email protected]>

This patch adds support for MMC/SD controller driver for DaVinci family SoC. This patch will work for SoC like DM6446 and DM355. SoC like DM365 and DA830 also has same controller with small variations and could supported/added easily by using this version of patch. It means that this version of patch could be used for all SoC which has been derived from DaVinci family.

This patch has been generated against latest 2.6.29 mainline kernel. This patch will not compile currently because it depends notably on the EDMA utilities and chip/board setup, that will come at some point through the ARM tree. Please use currently DaVinci GIT tree for EDMA utilities and chip/board setup etc.

Many thanks to David Brownell ([email protected]) for his all support.

---
 arch/arm/mach-davinci/include/mach/mmc.h |   25 +
 drivers/mmc/host/Kconfig                 |    8 +
 drivers/mmc/host/Makefile                |    1 +
 drivers/mmc/host/davinci_mmc.c           | 1257 ++++++++++++++++++++++++++++++
 4 files changed, 1291 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-davinci/include/mach/mmc.h
 create mode 100644 drivers/mmc/host/davinci_mmc.c
arch/arm/mach-davinci/include/mach/mmc.h new file +25 -0
new file mode 100644
index 0000000..8fee158
@@ -0,0 +1,25 @@
+/*
+ *  Board-specific MMC configuration
+ */
+
+#ifndef _DAVINCI_MMC_H
+#define _DAVINCI_MMC_H
+
+#include <linux/types.h>
+#include <linux/mmc/host.h>
+
+struct davinci_mmc_config {
+	/* get_cd()/get_wp() may sleep */
+	int (*get_cd)(int module);
+	int (*get_ro)(int module);
+	/* wires == 0 is equivalent to wires == 4 (4-bit parallel) */
+	u8 wires;
+
+	u32 max_freq;
+
+	/* any additional host capabilities: OR'd in to mmc->f_caps */
+	u32 caps;
+};
+void davinci_setup_mmc(int module, struct davinci_mmc_config *config);
+
+#endif
drivers/mmc/host/Kconfig +8 -0
index 99d4b28..311d00f 100644
@@ -171,6 +171,14 @@ config MMC_TIFM_SD
           To compile this driver as a module, choose M here: the
 	  module will be called tifm_sd.
 
+config MMC_DAVINCI
+        tristate "TI DAVINCI Multimedia Card Interface support"
+        depends on ARCH_DAVINCI
+        help
+          This selects the TI DAVINCI Multimedia card Interface.
+          If you have an DAVINCI board with a Multimedia Card slot,
+          say Y or M here.  If unsure, say N.
+
 config MMC_SPI
 	tristate "MMC/SD/SDIO over SPI"
 	depends on SPI_MASTER && !HIGHMEM && HAS_DMA
drivers/mmc/host/Makefile +1 -0
index dedec55..6bc91b1 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_MMC_OMAP_HS)	+= omap_hsmmc.o
 obj-$(CONFIG_MMC_AT91)		+= at91_mci.o
 obj-$(CONFIG_MMC_ATMELMCI)	+= atmel-mci.o
 obj-$(CONFIG_MMC_TIFM_SD)	+= tifm_sd.o
+obj-$(CONFIG_MMC_DAVINCI)       += davinci_mmc.o
 obj-$(CONFIG_MMC_SPI)		+= mmc_spi.o
 ifeq ($(CONFIG_OF),y)
 obj-$(CONFIG_MMC_SPI)		+= of_mmc_spi.o
drivers/mmc/host/davinci_mmc.c new file +1257 -0

1,257 lines not on this page · raw message

Signature · 1 line
1.5.4.1
Acked-by on v1 1/1
#1 lore raw
Quoted 13 lines · Purushotam Kumar

From: Purshotam Kumar <[email protected]>

This patch adds support for MMC/SD controller driver for DaVinci family SoC. This patch will work for SoC like DM6446 and DM355. SoC like DM365 and DA830 also has same controller with small variations and could supported/added easily by using this version of patch. It means that this version of patch could be used for all SoC which has been derived from DaVinci family.

This patch has been generated against latest 2.6.29 mainline kernel. This patch will not compile currently because it depends notably on the EDMA utilities and chip/board setup, that will come at some point through the ARM tree. Please use currently DaVinci GIT tree for EDMA utilities and chip/board setup etc.

Quoted 4 lines

Many thanks to David Brownell ([email protected]) for his all support.

Sanity-tested against mainline with simple patches to add EDMA and chip/board setup ... root-on-MMC works, just like root-on-IDE.

Once you fix the build bug noted below:

Though the PIO bits still bother me ... I'd use *only* the io{read,write}8_rep() calls to load/unload the FIFO. While those calls haven't broken yet, it's rude to (a) open-code io{read,write}32_rep() like that, and (b) assume all buffers coming in to that function are 32-bit aligned. PIO is hardly ever used, given EDMA. Maybe just one or two calls when enumerating. (SDIO might use it more often.) That can be fixed a bit later.

Also, it'd be good to submit a patch to the DaVinci tree to make it match whatever Pierre eventually merges. (Less the clock name change, of course, which is only needed to cope with the elderly clock logic now in mainline.)

Quoted 6 lines
---
 arch/arm/mach-davinci/include/mach/mmc.h |   25 +
 drivers/mmc/host/Kconfig                 |    8 +
 drivers/mmc/host/Makefile                |    1 +
 drivers/mmc/host/davinci_mmc.c           | 1257 ++++++++++++++++++++++++++++++
 4 files changed, 1291 insertions(+), 0 deletions(-)

Build bug in probe():

drivers/mmc/host/davinci_mmc.c line 1094

Quoted 1 line
drivers/mmc/host/davinci_mmc.c new file +1 -0
+	host->clk = clk_get(&pdev->dev, MMCSDCLK);

Put quotes around "MMCSDCLK".

#2 lore raw
Quoted 13 lines

Though the PIO bits still bother me ... I'd use *only* the io{read,write}8_rep() calls to load/unload the FIFO. While those calls haven't broken yet, it's rude to (a) open-code io{read,write}32_rep() like that, and (b) assume all buffers coming in to that function are 32-bit aligned. PIO is hardly ever used, given EDMA. Maybe just one or two calls when enumerating. (SDIO might use it more often.) That can be fixed a bit later.

Quoted 4 lines

Also, it'd be good to submit a patch to the DaVinci tree to make it match whatever Pierre eventually merges. (Less the clock name change, of course, which is only needed to cope with the elderly clock logic now in mainline.)

In my testing, I have observed that io{read,write}8_rep() does not work properly in pure PIO mode i.e. when use_dma is set 0. So, I have introduced both io{read,write}8_rep() and io{read,write}32_rep() and we could handle different size of buffers irrespective of whether it is multiple of 4 bytes or not.

Quoted 6 lines

Build bug in probe():

drivers/mmc/host/davinci_mmc.c line 1094

Quoted 1 line
drivers/mmc/host/davinci_mmc.c new file +1 -0
+	host->clk = clk_get(&pdev->dev, MMCSDCLK);

Put quotes around "MMCSDCLK".

I will add quotes and re-submit patch today or tomorrow. -Purushotam

#3 lore raw
In reply to Purushotam Kumar
Quoted 10 lines · On Wed, 18 Mar 2009 17:51:25 +0530 Purushotam Kumar <[email protected]> wrote:

This patch adds support for MMC/SD controller driver for DaVinci family SoC. This patch will work for SoC like DM6446 and DM355. SoC like DM365 and DA830 also has same controller with small variations and could supported/added easily by using this version of patch. It means that this version of patch could be used for all SoC which has been derived from DaVinci family.

This patch has been generated against latest 2.6.29 mainline kernel. This patch will not compile currently because it depends notably on the EDMA utilities and chip/board setup, that will come at some point through the ARM tree. Please use currently DaVinci GIT tree for EDMA utilities and chip/board setup etc.

The wont-compile thing makes it a bit hard for me to merge.

Specifically where are these prerequisite patches and how will I know when they are available and in what tree?

Perhaps the simplest approach would be for you to wait until the code _will_ compile?