Skip to contentSkip to conversation

mmc: USB SD Host Controller (USHC) driver

PATCH Superseded David Vrabel 2 participants 3 messages Aug 19, 2010 – Aug 20, 2010 MMC, SD and SDIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 mmc: USB SD Host Controller (USHC) driver

Add a driver for USB SD Host Controller devices. These devices are Cypress Astoria chips with firmware compliant with issue 2 of CSR's USHC specification.

---
 drivers/mmc/host/Kconfig  |   13 +
 drivers/mmc/host/Makefile |    1 +
 drivers/mmc/host/ushc.c   |  567 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 581 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mmc/host/ushc.c
drivers/mmc/host/Kconfig +13 -0
index 283190b..c394294 100644
@@ -451,3 +451,16 @@ config MMC_JZ4740
 	  SoCs.
 	  If you have a board based on such a SoC and with a SD/MMC slot,
 	  say Y or M here.
+
+config MMC_USHC
+	tristate "USB SD Host Controller (USHC) support"
+	depends on USB
+	help
+	  This selects support for USB SD Host Controllers based on
+	  the Cypress Astoria chip with firmware compliant with CSR's
+	  USB SD Host Controller specification (CS-118793-SP).
+
+	  CSR boards with this device include: USB<>SDIO (M1985v2),
+	  and Ultrasira.
+
+	  Note: Version 2 devices only support SDIO cards/devices.
drivers/mmc/host/Makefile +1 -0
index 840bcb5..f7fb7eb 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_MMC_VIA_SDMMC)	+= via-sdmmc.o
 obj-$(CONFIG_SDH_BFIN)		+= bfin_sdh.o
 obj-$(CONFIG_MMC_SH_MMCIF)	+= sh_mmcif.o
 obj-$(CONFIG_MMC_JZ4740)	+= jz4740_mmc.o
+obj-$(CONFIG_MMC_USHC)		+= ushc.o
 
 obj-$(CONFIG_MMC_SDHCI_PLTFM)			+= sdhci-platform.o
 sdhci-platform-y				:= sdhci-pltfm.o
drivers/mmc/host/ushc.c new file +567 -0

567 lines not on this page · raw message

Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 5 lines · David Vrabel

Add a driver for USB SD Host Controller devices. These devices are Cypress Astoria chips with firmware compliant with issue 2 of CSR's USHC specification.

Looks good from a quick glance. Some nits below.

drivers/mmc/host/Kconfig config MMC_JZ4740 · line 466

Quoted 12 lines
drivers/mmc/host/Kconfig +12 -0
+config MMC_USHC
+	tristate "USB SD Host Controller (USHC) support"
+	depends on USB
+	help
+	  This selects support for USB SD Host Controllers based on
+	  the Cypress Astoria chip with firmware compliant with CSR's
+	  USB SD Host Controller specification (CS-118793-SP).
+
+	  CSR boards with this device include: USB<>SDIO (M1985v2),
+	  and Ultrasira.
+
+	  Note: Version 2 devices only support SDIO cards/devices.

Do you mean that only the devices with version 2 do support SDIO, or that devices with version 2 support SDIO only?

Quoted 6 lines
drivers/mmc/host/ushc.c new file +6 -0
+	/* The Astoria's data FIFOs don't work with clock speeds < 5MHz so
+	   limit commands with data to 6MHz or more. */
+	if (req->data && ushc->clock_freq < 6000000) {
+		ret = -EINVAL;
+		goto out;
+	}

[...]

drivers/mmc/host/ushc.c line 453

Quoted 2 lines
drivers/mmc/host/ushc.c new file +2 -0
+	mmc->f_min = 0;
+	mmc->f_max = 50000000;

Why are you setting mmc->f_min to zero? I understand that the 6000000 limit is only for commands with data, but a limit of 0 is rather ... unusual.

Nicolas

#2 lore raw
Quoted 6 lines · Nicolas Pitre

drivers/mmc/host/Kconfig config MMC_JZ4740 · line 466

Quoted 1 line · David Vrabel
drivers/mmc/host/Kconfig +1 -0
+	  Note: Version 2 devices only support SDIO cards/devices.

Do you mean that only the devices with version 2 do support SDIO, or that devices with version 2 support SDIO only?

I've revised the wording to:

Note: These controllers only support SDIO cards and do not support MMC or SD memory cards.

This is because the protocol doesn't support the long R2 response format.

Quoted 6 lines

drivers/mmc/host/ushc.c line 453

Quoted 2 lines
drivers/mmc/host/ushc.c new file +2 -0
+	mmc->f_min = 0;
+	mmc->f_max = 50000000;

Why are you setting mmc->f_min to zero? I understand that the 6000000 limit is only for commands with data, but a limit of 0 is rather ... unusual.

f_min should be 400 kHz.

I'll wait and see if there are any other review comments before posted an updated patch.

David

Signature · 6 lines
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom