diff options
author | Grazvydas Ignotas <notasas@gmail.com> | 2010-08-10 21:01:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-11 11:59:04 -0400 |
commit | 6f51be3d37dff73cf8db771df4169f4c2f1cbf66 (patch) | |
tree | 0d79099cab112a4bd694d2868fbd9c35fd3cdd3a /drivers | |
parent | 20b1597bcf4a76ccab232fa032f5f9ad30069167 (diff) |
sdio: allow non-standard SDIO cards
There are some chips (like TI WL12xx series) that can be interfaced over
SDIO but don't support the SDIO specification, meaning that they are
missing CIA (Common I/O Area) with all it's registers. Current Linux SDIO
implementation relies on those registers to identify and configure the
card, so non-standard cards can not function and cause lots of warnings
from the core when it reads invalid data from non-existent registers.
After this patch, init_card() host callback can now set new quirk
MMC_QUIRK_NONSTD_SDIO, which means that SDIO core should not try to access
any standard SDIO registers and rely on init_card() to fill all SDIO
structures instead. As those cards are usually embedded chips, all the
required information can be obtained from machine board files by the host
driver when it's called through init_card() callback.
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Cc: Adrian Hunter <adrian.hunter@nokia.com>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Bob Copeland <me@bobcopeland.com>
Cc: Kalle Valo <kvalo@adurom.com>
Cc: Madhusudhan Chikkature <madhu.cr@ti.com>
Cc: Kishore Kadiyala <kishore.kadiyala@ti.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/core/sdio.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index b0b6ce93e519..bd2755e8d9a3 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
@@ -63,13 +63,19 @@ static int sdio_init_func(struct mmc_card *card, unsigned int fn) | |||
63 | 63 | ||
64 | func->num = fn; | 64 | func->num = fn; |
65 | 65 | ||
66 | ret = sdio_read_fbr(func); | 66 | if (!(card->quirks & MMC_QUIRK_NONSTD_SDIO)) { |
67 | if (ret) | 67 | ret = sdio_read_fbr(func); |
68 | goto fail; | 68 | if (ret) |
69 | goto fail; | ||
69 | 70 | ||
70 | ret = sdio_read_func_cis(func); | 71 | ret = sdio_read_func_cis(func); |
71 | if (ret) | 72 | if (ret) |
72 | goto fail; | 73 | goto fail; |
74 | } else { | ||
75 | func->vendor = func->card->cis.vendor; | ||
76 | func->device = func->card->cis.device; | ||
77 | func->max_blksize = func->card->cis.blksize; | ||
78 | } | ||
73 | 79 | ||
74 | card->sdio_func[fn - 1] = func; | 80 | card->sdio_func[fn - 1] = func; |
75 | 81 | ||
@@ -412,6 +418,23 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, | |||
412 | goto remove; | 418 | goto remove; |
413 | } | 419 | } |
414 | 420 | ||
421 | if (card->quirks & MMC_QUIRK_NONSTD_SDIO) { | ||
422 | /* | ||
423 | * This is non-standard SDIO device, meaning it doesn't | ||
424 | * have any CIA (Common I/O area) registers present. | ||
425 | * It's host's responsibility to fill cccr and cis | ||
426 | * structures in init_card(). | ||
427 | */ | ||
428 | mmc_set_clock(host, card->cis.max_dtr); | ||
429 | |||
430 | if (card->cccr.high_speed) { | ||
431 | mmc_card_set_highspeed(card); | ||
432 | mmc_set_timing(card->host, MMC_TIMING_SD_HS); | ||
433 | } | ||
434 | |||
435 | goto finish; | ||
436 | } | ||
437 | |||
415 | /* | 438 | /* |
416 | * Read the common registers. | 439 | * Read the common registers. |
417 | */ | 440 | */ |
@@ -480,6 +503,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, | |||
480 | else if (err) | 503 | else if (err) |
481 | goto remove; | 504 | goto remove; |
482 | 505 | ||
506 | finish: | ||
483 | if (!oldcard) | 507 | if (!oldcard) |
484 | host->card = card; | 508 | host->card = card; |
485 | return 0; | 509 | return 0; |