mmc_spi host driver

This is the latest version of the MMC-over-SPI support.  It works
on 2.6.23-rc2 plus git-mmc (from rc1-mm2), along with the preceding
patches which teach the rest of the MMC stack about SPI.

The main issue of note is that sometimes cards need to be power cycled
to recover after certain faults.  Also, it may sometimes be necessary
to disable CRCs.  ("modprobe mmc_core use_spi_crc=n")

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: mikael.starvik@axis.com,
Cc: Hans-Peter Nilsson <hp@axis.com>
Cc: Jan Nikitenko <jan.nikitenko@gmail.com>
Cc: Mike Lavender <mike@steroidmicros.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
This commit is contained in:
David Brownell 2007-08-08 09:12:54 -07:00 committed by Pierre Ossman
parent af51715079
commit 15a0580ced
5 changed files with 1461 additions and 0 deletions

View file

@ -2567,6 +2567,12 @@ M: drzeus-mmc@drzeus.cx
L: linux-kernel@vger.kernel.org
S: Maintained
MULTIMEDIA CARD (MMC) ETC. OVER SPI
P: David Brownell
M: dbrownell@users.sourceforge.net
L: linux-kernel@vger.kernel.org
S: Odd fixes
MULTISOUND SOUND DRIVER
P: Andrew Veliath
M: andrewtv@usa.net

View file

@ -100,3 +100,16 @@ config MMC_TIFM_SD
To compile this driver as a module, choose M here: the
module will be called tifm_sd.
config MMC_SPI
tristate "MMC/SD over SPI (EXPERIMENTAL)"
depends on MMC && SPI_MASTER && !HIGHMEM && EXPERIMENTAL
select CRC7
select CRC_ITU_T
help
Some systems accss MMC/SD cards using a SPI controller instead of
using a "native" MMC/SD controller. This has a disadvantage of
being relatively high overhead, but a compensating advantage of
working on many systems without dedicated MMC/SD controllers.
If unsure, or if your system has no SPI master driver, say N.

View file

@ -15,4 +15,5 @@ obj-$(CONFIG_MMC_AU1X) += au1xmmc.o
obj-$(CONFIG_MMC_OMAP) += omap.o
obj-$(CONFIG_MMC_AT91) += at91_mci.o
obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o
obj-$(CONFIG_MMC_SPI) += mmc_spi.o

1408
drivers/mmc/host/mmc_spi.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,33 @@
#ifndef __LINUX_SPI_MMC_SPI_H
#define __LINUX_SPI_MMC_SPI_H
struct device;
struct mmc_host;
/* Put this in platform_data of a device being used to manage an MMC/SD
* card slot. (Modeled after PXA mmc glue; see that for usage examples.)
*
* REVISIT This is not a spi-specific notion. Any card slot should be
* able to handle it. If the MMC core doesn't adopt this kind of notion,
* switch the "struct device *" parameters over to "struct spi_device *".
*/
struct mmc_spi_platform_data {
/* driver activation and (optional) card detect irq hookup */
int (*init)(struct device *,
irqreturn_t (*)(int, void *),
void *);
void (*exit)(struct device *, void *);
/* sense switch on sd cards */
int (*get_ro)(struct device *);
/* how long to debounce card detect, in msecs */
u16 detect_delay;
/* power management */
u16 powerup_msecs; /* delay of up to 250 msec */
u32 ocr_mask; /* available voltages */
void (*setpower)(struct device *, unsigned int maskval);
};
#endif /* __LINUX_SPI_MMC_SPI_H */