diff options
author | David Brownell <david-b@pacbell.net> | 2007-08-08 12:11:32 -0400 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-09-23 15:51:30 -0400 |
commit | af51715079e7fb6b290e1881d63d815dc4de5011 (patch) | |
tree | 324e81b2346955f130dda8515f2ad4f4ce97c864 /drivers/mmc/core/bus.c | |
parent | 7213d175e3b6f6db60f843b72e88857a350e146a (diff) |
MMC core learns about SPI
Teach the MMC/SD/SDIO core about using SPI mode.
- Use mmc_host_is_spi() so enumeration works through SPI signaling
and protocols, not just the native versions.
- Provide the SPI response type flags with each request issued,
including requests from the new lock/unlock code.
- Understand that cmd->resp[0] and mmc_get_status() results for SPI
return different values than for "native" MMC/SD protocol; this
affects resetting, checking card lock status, and some others.
- Understand that some commands act a bit differently ... notably:
* OP_COND command doesn't return the OCR
* APP_CMD status doesn't have an R1_APP_CMD analogue
Those changes required some new and updated primitives:
- Provide utilities to access two SPI-only requests, and one
request that wasn't previously needed:
* mmc_spi_read_ocr() ... SPI only
* mmc_spi_set_crc() ... SPI only (override by module parm)
* mmc_send_cid() ... for use without broadcast mode
- Updated internal routines:
* Previous mmc_send_csd() modified into mmc_send_cxd_native();
it uses native "R2" responses, which include 16 bytes of data.
* Previous mmc_send_ext_csd() becomes new mmc_send_cxd_data()
helper for command-and-data access
* Bugfix to that mmc_send_cxd_data() code: dma-to-stack is
unsafe/nonportable, so kmalloc a bounce buffer instead.
- Modified mmc_send_ext_csd() now uses mmc_send_cxd_data() helper
- Modified mmc_send_csd(), and new mmc_spi_send_cid(), routines use
those helper routines based on whether they're native or SPI
The newest categories of cards supported by the MMC stack aren't expected
to work yet with SPI: MMC or SD cards with over 4GB data, and SDIO.
All those cards support SPI mode, so eventually they should work too.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/core/bus.c')
-rw-r--r-- | drivers/mmc/core/bus.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 733ac95331c..8d6f6014870 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c | |||
@@ -243,10 +243,17 @@ int mmc_add_card(struct mmc_card *card) | |||
243 | break; | 243 | break; |
244 | } | 244 | } |
245 | 245 | ||
246 | printk(KERN_INFO "%s: new %s%s card at address %04x\n", | 246 | if (mmc_host_is_spi(card->host)) { |
247 | mmc_hostname(card->host), | 247 | printk(KERN_INFO "%s: new %s%s card on SPI\n", |
248 | mmc_card_highspeed(card) ? "high speed " : "", | 248 | mmc_hostname(card->host), |
249 | type, card->rca); | 249 | mmc_card_highspeed(card) ? "high speed " : "", |
250 | type); | ||
251 | } else { | ||
252 | printk(KERN_INFO "%s: new %s%s card at address %04x\n", | ||
253 | mmc_hostname(card->host), | ||
254 | mmc_card_highspeed(card) ? "high speed " : "", | ||
255 | type, card->rca); | ||
256 | } | ||
250 | 257 | ||
251 | card->dev.uevent_suppress = 1; | 258 | card->dev.uevent_suppress = 1; |
252 | 259 | ||
@@ -278,8 +285,13 @@ int mmc_add_card(struct mmc_card *card) | |||
278 | void mmc_remove_card(struct mmc_card *card) | 285 | void mmc_remove_card(struct mmc_card *card) |
279 | { | 286 | { |
280 | if (mmc_card_present(card)) { | 287 | if (mmc_card_present(card)) { |
281 | printk(KERN_INFO "%s: card %04x removed\n", | 288 | if (mmc_host_is_spi(card->host)) { |
282 | mmc_hostname(card->host), card->rca); | 289 | printk(KERN_INFO "%s: SPI card removed\n", |
290 | mmc_hostname(card->host)); | ||
291 | } else { | ||
292 | printk(KERN_INFO "%s: card %04x removed\n", | ||
293 | mmc_hostname(card->host), card->rca); | ||
294 | } | ||
283 | 295 | ||
284 | if (card->host->bus_ops->sysfs_remove) | 296 | if (card->host->bus_ops->sysfs_remove) |
285 | card->host->bus_ops->sysfs_remove(card->host, card); | 297 | card->host->bus_ops->sysfs_remove(card->host, card); |