diff options
| -rw-r--r-- | drivers/mmc/card/block.c | 122 | ||||
| -rw-r--r-- | drivers/mmc/core/core.c | 77 | ||||
| -rw-r--r-- | drivers/mmc/core/mmc.c | 18 | ||||
| -rw-r--r-- | drivers/mmc/host/Makefile | 3 | ||||
| -rw-r--r-- | drivers/mmc/host/at91_mci.c | 4 | ||||
| -rw-r--r-- | drivers/mmc/host/mmc_spi.c | 4 | ||||
| -rw-r--r-- | drivers/mmc/host/of_mmc_spi.c | 149 | ||||
| -rw-r--r-- | drivers/mmc/host/pxamci.c | 2 | ||||
| -rw-r--r-- | drivers/mmc/host/ricoh_mmc.c | 17 | ||||
| -rw-r--r-- | drivers/mmc/host/sdhci-pci.c | 2 | ||||
| -rw-r--r-- | drivers/mmc/host/sdhci.c | 17 | ||||
| -rw-r--r-- | drivers/mmc/host/sdhci.h | 2 | ||||
| -rw-r--r-- | drivers/mmc/host/sdricoh_cs.c | 4 | ||||
| -rw-r--r-- | drivers/mmc/host/tmio_mmc.c | 3 | ||||
| -rw-r--r-- | include/linux/mmc/core.h | 2 | ||||
| -rw-r--r-- | include/linux/mmc/host.h | 2 | ||||
| -rw-r--r-- | include/linux/spi/mmc_spi.h | 15 |
17 files changed, 392 insertions, 51 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 3d067c35185d..45b1f430685f 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
| @@ -145,7 +145,7 @@ struct mmc_blk_request { | |||
| 145 | static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | 145 | static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) |
| 146 | { | 146 | { |
| 147 | int err; | 147 | int err; |
| 148 | u32 blocks; | 148 | __be32 blocks; |
| 149 | 149 | ||
| 150 | struct mmc_request mrq; | 150 | struct mmc_request mrq; |
| 151 | struct mmc_command cmd; | 151 | struct mmc_command cmd; |
| @@ -204,9 +204,24 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) | |||
| 204 | if (cmd.error || data.error) | 204 | if (cmd.error || data.error) |
| 205 | return (u32)-1; | 205 | return (u32)-1; |
| 206 | 206 | ||
| 207 | blocks = ntohl(blocks); | 207 | return ntohl(blocks); |
| 208 | } | ||
| 209 | |||
| 210 | static u32 get_card_status(struct mmc_card *card, struct request *req) | ||
| 211 | { | ||
| 212 | struct mmc_command cmd; | ||
| 213 | int err; | ||
| 208 | 214 | ||
| 209 | return blocks; | 215 | memset(&cmd, 0, sizeof(struct mmc_command)); |
| 216 | cmd.opcode = MMC_SEND_STATUS; | ||
| 217 | if (!mmc_host_is_spi(card->host)) | ||
| 218 | cmd.arg = card->rca << 16; | ||
| 219 | cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; | ||
| 220 | err = mmc_wait_for_cmd(card->host, &cmd, 0); | ||
| 221 | if (err) | ||
| 222 | printk(KERN_ERR "%s: error %d sending status comand", | ||
| 223 | req->rq_disk->disk_name, err); | ||
| 224 | return cmd.resp[0]; | ||
| 210 | } | 225 | } |
| 211 | 226 | ||
| 212 | static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | 227 | static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) |
| @@ -214,13 +229,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
| 214 | struct mmc_blk_data *md = mq->data; | 229 | struct mmc_blk_data *md = mq->data; |
| 215 | struct mmc_card *card = md->queue.card; | 230 | struct mmc_card *card = md->queue.card; |
| 216 | struct mmc_blk_request brq; | 231 | struct mmc_blk_request brq; |
| 217 | int ret = 1; | 232 | int ret = 1, disable_multi = 0; |
| 218 | 233 | ||
| 219 | mmc_claim_host(card->host); | 234 | mmc_claim_host(card->host); |
| 220 | 235 | ||
| 221 | do { | 236 | do { |
| 222 | struct mmc_command cmd; | 237 | struct mmc_command cmd; |
| 223 | u32 readcmd, writecmd; | 238 | u32 readcmd, writecmd, status = 0; |
| 224 | 239 | ||
| 225 | memset(&brq, 0, sizeof(struct mmc_blk_request)); | 240 | memset(&brq, 0, sizeof(struct mmc_blk_request)); |
| 226 | brq.mrq.cmd = &brq.cmd; | 241 | brq.mrq.cmd = &brq.cmd; |
| @@ -236,6 +251,14 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
| 236 | brq.stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; | 251 | brq.stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; |
| 237 | brq.data.blocks = req->nr_sectors; | 252 | brq.data.blocks = req->nr_sectors; |
| 238 | 253 | ||
| 254 | /* | ||
| 255 | * After a read error, we redo the request one sector at a time | ||
| 256 | * in order to accurately determine which sectors can be read | ||
| 257 | * successfully. | ||
| 258 | */ | ||
| 259 | if (disable_multi && brq.data.blocks > 1) | ||
| 260 | brq.data.blocks = 1; | ||
| 261 | |||
| 239 | if (brq.data.blocks > 1) { | 262 | if (brq.data.blocks > 1) { |
| 240 | /* SPI multiblock writes terminate using a special | 263 | /* SPI multiblock writes terminate using a special |
| 241 | * token, not a STOP_TRANSMISSION request. | 264 | * token, not a STOP_TRANSMISSION request. |
| @@ -264,6 +287,25 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
| 264 | brq.data.sg = mq->sg; | 287 | brq.data.sg = mq->sg; |
| 265 | brq.data.sg_len = mmc_queue_map_sg(mq); | 288 | brq.data.sg_len = mmc_queue_map_sg(mq); |
| 266 | 289 | ||
| 290 | /* | ||
| 291 | * Adjust the sg list so it is the same size as the | ||
| 292 | * request. | ||
| 293 | */ | ||
| 294 | if (brq.data.blocks != req->nr_sectors) { | ||
| 295 | int i, data_size = brq.data.blocks << 9; | ||
| 296 | struct scatterlist *sg; | ||
| 297 | |||
| 298 | for_each_sg(brq.data.sg, sg, brq.data.sg_len, i) { | ||
| 299 | data_size -= sg->length; | ||
| 300 | if (data_size <= 0) { | ||
| 301 | sg->length += data_size; | ||
| 302 | i++; | ||
| 303 | break; | ||
| 304 | } | ||
| 305 | } | ||
| 306 | brq.data.sg_len = i; | ||
| 307 | } | ||
| 308 | |||
| 267 | mmc_queue_bounce_pre(mq); | 309 | mmc_queue_bounce_pre(mq); |
| 268 | 310 | ||
| 269 | mmc_wait_for_req(card->host, &brq.mrq); | 311 | mmc_wait_for_req(card->host, &brq.mrq); |
| @@ -275,19 +317,40 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
| 275 | * until later as we need to wait for the card to leave | 317 | * until later as we need to wait for the card to leave |
| 276 | * programming mode even when things go wrong. | 318 | * programming mode even when things go wrong. |
| 277 | */ | 319 | */ |
| 320 | if (brq.cmd.error || brq.data.error || brq.stop.error) { | ||
| 321 | if (brq.data.blocks > 1 && rq_data_dir(req) == READ) { | ||
| 322 | /* Redo read one sector at a time */ | ||
| 323 | printk(KERN_WARNING "%s: retrying using single " | ||
| 324 | "block read\n", req->rq_disk->disk_name); | ||
| 325 | disable_multi = 1; | ||
| 326 | continue; | ||
| 327 | } | ||
| 328 | status = get_card_status(card, req); | ||
| 329 | } | ||
| 330 | |||
| 278 | if (brq.cmd.error) { | 331 | if (brq.cmd.error) { |
| 279 | printk(KERN_ERR "%s: error %d sending read/write command\n", | 332 | printk(KERN_ERR "%s: error %d sending read/write " |
| 280 | req->rq_disk->disk_name, brq.cmd.error); | 333 | "command, response %#x, card status %#x\n", |
| 334 | req->rq_disk->disk_name, brq.cmd.error, | ||
| 335 | brq.cmd.resp[0], status); | ||
| 281 | } | 336 | } |
| 282 | 337 | ||
| 283 | if (brq.data.error) { | 338 | if (brq.data.error) { |
| 284 | printk(KERN_ERR "%s: error %d transferring data\n", | 339 | if (brq.data.error == -ETIMEDOUT && brq.mrq.stop) |
| 285 | req->rq_disk->disk_name, brq.data.error); | 340 | /* 'Stop' response contains card status */ |
| 341 | status = brq.mrq.stop->resp[0]; | ||
| 342 | printk(KERN_ERR "%s: error %d transferring data," | ||
| 343 | " sector %u, nr %u, card status %#x\n", | ||
| 344 | req->rq_disk->disk_name, brq.data.error, | ||
| 345 | (unsigned)req->sector, | ||
| 346 | (unsigned)req->nr_sectors, status); | ||
| 286 | } | 347 | } |
| 287 | 348 | ||
| 288 | if (brq.stop.error) { | 349 | if (brq.stop.error) { |
| 289 | printk(KERN_ERR "%s: error %d sending stop command\n", | 350 | printk(KERN_ERR "%s: error %d sending stop command, " |
| 290 | req->rq_disk->disk_name, brq.stop.error); | 351 | "response %#x, card status %#x\n", |
| 352 | req->rq_disk->disk_name, brq.stop.error, | ||
| 353 | brq.stop.resp[0], status); | ||
| 291 | } | 354 | } |
| 292 | 355 | ||
| 293 | if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) { | 356 | if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) { |
| @@ -320,8 +383,20 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
| 320 | #endif | 383 | #endif |
| 321 | } | 384 | } |
| 322 | 385 | ||
| 323 | if (brq.cmd.error || brq.data.error || brq.stop.error) | 386 | if (brq.cmd.error || brq.stop.error || brq.data.error) { |
| 387 | if (rq_data_dir(req) == READ) { | ||
| 388 | /* | ||
| 389 | * After an error, we redo I/O one sector at a | ||
| 390 | * time, so we only reach here after trying to | ||
| 391 | * read a single sector. | ||
| 392 | */ | ||
| 393 | spin_lock_irq(&md->lock); | ||
| 394 | ret = __blk_end_request(req, -EIO, brq.data.blksz); | ||
| 395 | spin_unlock_irq(&md->lock); | ||
| 396 | continue; | ||
| 397 | } | ||
| 324 | goto cmd_err; | 398 | goto cmd_err; |
| 399 | } | ||
| 325 | 400 | ||
| 326 | /* | 401 | /* |
| 327 | * A block was successfully transferred. | 402 | * A block was successfully transferred. |
| @@ -343,25 +418,20 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
| 343 | * If the card is not SD, we can still ok written sectors | 418 | * If the card is not SD, we can still ok written sectors |
| 344 | * as reported by the controller (which might be less than | 419 | * as reported by the controller (which might be less than |
| 345 | * the real number of written sectors, but never more). | 420 | * the real number of written sectors, but never more). |
| 346 | * | ||
| 347 | * For reads we just fail the entire chunk as that should | ||
| 348 | * be safe in all cases. | ||
| 349 | */ | 421 | */ |
| 350 | if (rq_data_dir(req) != READ) { | 422 | if (mmc_card_sd(card)) { |
| 351 | if (mmc_card_sd(card)) { | 423 | u32 blocks; |
| 352 | u32 blocks; | ||
| 353 | 424 | ||
| 354 | blocks = mmc_sd_num_wr_blocks(card); | 425 | blocks = mmc_sd_num_wr_blocks(card); |
| 355 | if (blocks != (u32)-1) { | 426 | if (blocks != (u32)-1) { |
| 356 | spin_lock_irq(&md->lock); | ||
| 357 | ret = __blk_end_request(req, 0, blocks << 9); | ||
| 358 | spin_unlock_irq(&md->lock); | ||
| 359 | } | ||
| 360 | } else { | ||
| 361 | spin_lock_irq(&md->lock); | 427 | spin_lock_irq(&md->lock); |
| 362 | ret = __blk_end_request(req, 0, brq.data.bytes_xfered); | 428 | ret = __blk_end_request(req, 0, blocks << 9); |
| 363 | spin_unlock_irq(&md->lock); | 429 | spin_unlock_irq(&md->lock); |
| 364 | } | 430 | } |
| 431 | } else { | ||
| 432 | spin_lock_irq(&md->lock); | ||
| 433 | ret = __blk_end_request(req, 0, brq.data.bytes_xfered); | ||
| 434 | spin_unlock_irq(&md->lock); | ||
| 365 | } | 435 | } |
| 366 | 436 | ||
| 367 | mmc_release_host(card->host); | 437 | mmc_release_host(card->host); |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index f7284b905eb3..df6ce4a06cf3 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
| 21 | #include <linux/leds.h> | 21 | #include <linux/leds.h> |
| 22 | #include <linux/scatterlist.h> | 22 | #include <linux/scatterlist.h> |
| 23 | #include <linux/log2.h> | ||
| 23 | 24 | ||
| 24 | #include <linux/mmc/card.h> | 25 | #include <linux/mmc/card.h> |
| 25 | #include <linux/mmc/host.h> | 26 | #include <linux/mmc/host.h> |
| @@ -448,6 +449,80 @@ void mmc_set_bus_width(struct mmc_host *host, unsigned int width) | |||
| 448 | mmc_set_ios(host); | 449 | mmc_set_ios(host); |
| 449 | } | 450 | } |
| 450 | 451 | ||
| 452 | /** | ||
| 453 | * mmc_vdd_to_ocrbitnum - Convert a voltage to the OCR bit number | ||
| 454 | * @vdd: voltage (mV) | ||
| 455 | * @low_bits: prefer low bits in boundary cases | ||
| 456 | * | ||
| 457 | * This function returns the OCR bit number according to the provided @vdd | ||
| 458 | * value. If conversion is not possible a negative errno value returned. | ||
| 459 | * | ||
| 460 | * Depending on the @low_bits flag the function prefers low or high OCR bits | ||
| 461 | * on boundary voltages. For example, | ||
| 462 | * with @low_bits = true, 3300 mV translates to ilog2(MMC_VDD_32_33); | ||
| 463 | * with @low_bits = false, 3300 mV translates to ilog2(MMC_VDD_33_34); | ||
| 464 | * | ||
| 465 | * Any value in the [1951:1999] range translates to the ilog2(MMC_VDD_20_21). | ||
| 466 | */ | ||
| 467 | static int mmc_vdd_to_ocrbitnum(int vdd, bool low_bits) | ||
| 468 | { | ||
| 469 | const int max_bit = ilog2(MMC_VDD_35_36); | ||
| 470 | int bit; | ||
| 471 | |||
| 472 | if (vdd < 1650 || vdd > 3600) | ||
| 473 | return -EINVAL; | ||
| 474 | |||
| 475 | if (vdd >= 1650 && vdd <= 1950) | ||
| 476 | return ilog2(MMC_VDD_165_195); | ||
| 477 | |||
| 478 | if (low_bits) | ||
| 479 | vdd -= 1; | ||
| 480 | |||
| 481 | /* Base 2000 mV, step 100 mV, bit's base 8. */ | ||
| 482 | bit = (vdd - 2000) / 100 + 8; | ||
| 483 | if (bit > max_bit) | ||
| 484 | return max_bit; | ||
| 485 | return bit; | ||
| 486 | } | ||
| 487 | |||
| 488 | /** | ||
| 489 | * mmc_vddrange_to_ocrmask - Convert a voltage range to the OCR mask | ||
| 490 | * @vdd_min: minimum voltage value (mV) | ||
| 491 | * @vdd_max: maximum voltage value (mV) | ||
| 492 | * | ||
| 493 | * This function returns the OCR mask bits according to the provided @vdd_min | ||
| 494 | * and @vdd_max values. If conversion is not possible the function returns 0. | ||
| 495 | * | ||
| 496 | * Notes wrt boundary cases: | ||
| 497 | * This function sets the OCR bits for all boundary voltages, for example | ||
| 498 | * [3300:3400] range is translated to MMC_VDD_32_33 | MMC_VDD_33_34 | | ||
| 499 | * MMC_VDD_34_35 mask. | ||
| 500 | */ | ||
| 501 | u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max) | ||
| 502 | { | ||
| 503 | u32 mask = 0; | ||
| 504 | |||
| 505 | if (vdd_max < vdd_min) | ||
| 506 | return 0; | ||
| 507 | |||
| 508 | /* Prefer high bits for the boundary vdd_max values. */ | ||
| 509 | vdd_max = mmc_vdd_to_ocrbitnum(vdd_max, false); | ||
| 510 | if (vdd_max < 0) | ||
| 511 | return 0; | ||
| 512 | |||
| 513 | /* Prefer low bits for the boundary vdd_min values. */ | ||
| 514 | vdd_min = mmc_vdd_to_ocrbitnum(vdd_min, true); | ||
| 515 | if (vdd_min < 0) | ||
| 516 | return 0; | ||
| 517 | |||
| 518 | /* Fill the mask, from max bit to min bit. */ | ||
| 519 | while (vdd_max >= vdd_min) | ||
| 520 | mask |= 1 << vdd_max--; | ||
| 521 | |||
| 522 | return mask; | ||
| 523 | } | ||
| 524 | EXPORT_SYMBOL(mmc_vddrange_to_ocrmask); | ||
| 525 | |||
| 451 | /* | 526 | /* |
| 452 | * Mask off any voltages we don't support and select | 527 | * Mask off any voltages we don't support and select |
| 453 | * the lowest voltage | 528 | * the lowest voltage |
| @@ -467,6 +542,8 @@ u32 mmc_select_voltage(struct mmc_host *host, u32 ocr) | |||
| 467 | host->ios.vdd = bit; | 542 | host->ios.vdd = bit; |
| 468 | mmc_set_ios(host); | 543 | mmc_set_ios(host); |
| 469 | } else { | 544 | } else { |
| 545 | pr_warning("%s: host doesn't support card's voltages\n", | ||
| 546 | mmc_hostname(host)); | ||
| 470 | ocr = 0; | 547 | ocr = 0; |
| 471 | } | 548 | } |
| 472 | 549 | ||
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index fdd7c760be8c..c232d11a7ed4 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
| @@ -434,13 +434,24 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
| 434 | * Activate wide bus (if supported). | 434 | * Activate wide bus (if supported). |
| 435 | */ | 435 | */ |
| 436 | if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) && | 436 | if ((card->csd.mmca_vsn >= CSD_SPEC_VER_4) && |
| 437 | (host->caps & MMC_CAP_4_BIT_DATA)) { | 437 | (host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) { |
| 438 | unsigned ext_csd_bit, bus_width; | ||
| 439 | |||
| 440 | if (host->caps & MMC_CAP_8_BIT_DATA) { | ||
| 441 | ext_csd_bit = EXT_CSD_BUS_WIDTH_8; | ||
| 442 | bus_width = MMC_BUS_WIDTH_8; | ||
| 443 | } else { | ||
| 444 | ext_csd_bit = EXT_CSD_BUS_WIDTH_4; | ||
| 445 | bus_width = MMC_BUS_WIDTH_4; | ||
| 446 | } | ||
| 447 | |||
| 438 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, | 448 | err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, |
| 439 | EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_4); | 449 | EXT_CSD_BUS_WIDTH, ext_csd_bit); |
| 450 | |||
| 440 | if (err) | 451 | if (err) |
| 441 | goto free_card; | 452 | goto free_card; |
| 442 | 453 | ||
| 443 | mmc_set_bus_width(card->host, MMC_BUS_WIDTH_4); | 454 | mmc_set_bus_width(card->host, bus_width); |
| 444 | } | 455 | } |
| 445 | 456 | ||
| 446 | if (!oldcard) | 457 | if (!oldcard) |
| @@ -624,4 +635,3 @@ err: | |||
| 624 | 635 | ||
| 625 | return err; | 636 | return err; |
| 626 | } | 637 | } |
| 627 | |||
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile index c794cc5ce442..f4853288bbb1 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile | |||
| @@ -19,6 +19,9 @@ obj-$(CONFIG_MMC_AT91) += at91_mci.o | |||
| 19 | obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o | 19 | obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o |
| 20 | obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o | 20 | obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o |
| 21 | obj-$(CONFIG_MMC_SPI) += mmc_spi.o | 21 | obj-$(CONFIG_MMC_SPI) += mmc_spi.o |
| 22 | ifeq ($(CONFIG_OF),y) | ||
| 23 | obj-$(CONFIG_MMC_SPI) += of_mmc_spi.o | ||
| 24 | endif | ||
| 22 | obj-$(CONFIG_MMC_S3C) += s3cmci.o | 25 | obj-$(CONFIG_MMC_S3C) += s3cmci.o |
| 23 | obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o | 26 | obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o |
| 24 | obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o | 27 | obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o |
diff --git a/drivers/mmc/host/at91_mci.c b/drivers/mmc/host/at91_mci.c index 1f8b5b36222c..e556d42cc45a 100644 --- a/drivers/mmc/host/at91_mci.c +++ b/drivers/mmc/host/at91_mci.c | |||
| @@ -1088,6 +1088,8 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
| 1088 | goto fail0; | 1088 | goto fail0; |
| 1089 | } | 1089 | } |
| 1090 | 1090 | ||
| 1091 | setup_timer(&host->timer, at91_timeout_timer, (unsigned long)host); | ||
| 1092 | |||
| 1091 | platform_set_drvdata(pdev, mmc); | 1093 | platform_set_drvdata(pdev, mmc); |
| 1092 | 1094 | ||
| 1093 | /* | 1095 | /* |
| @@ -1101,8 +1103,6 @@ static int __init at91_mci_probe(struct platform_device *pdev) | |||
| 1101 | 1103 | ||
| 1102 | mmc_add_host(mmc); | 1104 | mmc_add_host(mmc); |
| 1103 | 1105 | ||
| 1104 | setup_timer(&host->timer, at91_timeout_timer, (unsigned long)host); | ||
| 1105 | |||
| 1106 | /* | 1106 | /* |
| 1107 | * monitor card insertion/removal if we can | 1107 | * monitor card insertion/removal if we can |
| 1108 | */ | 1108 | */ |
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index ad00e1632317..87e211df68ac 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
| @@ -1285,7 +1285,7 @@ static int mmc_spi_probe(struct spi_device *spi) | |||
| 1285 | /* Platform data is used to hook up things like card sensing | 1285 | /* Platform data is used to hook up things like card sensing |
| 1286 | * and power switching gpios. | 1286 | * and power switching gpios. |
| 1287 | */ | 1287 | */ |
| 1288 | host->pdata = spi->dev.platform_data; | 1288 | host->pdata = mmc_spi_get_pdata(spi); |
| 1289 | if (host->pdata) | 1289 | if (host->pdata) |
| 1290 | mmc->ocr_avail = host->pdata->ocr_mask; | 1290 | mmc->ocr_avail = host->pdata->ocr_mask; |
| 1291 | if (!mmc->ocr_avail) { | 1291 | if (!mmc->ocr_avail) { |
| @@ -1368,6 +1368,7 @@ fail_glue_init: | |||
| 1368 | 1368 | ||
| 1369 | fail_nobuf1: | 1369 | fail_nobuf1: |
| 1370 | mmc_free_host(mmc); | 1370 | mmc_free_host(mmc); |
| 1371 | mmc_spi_put_pdata(spi); | ||
| 1371 | dev_set_drvdata(&spi->dev, NULL); | 1372 | dev_set_drvdata(&spi->dev, NULL); |
| 1372 | 1373 | ||
| 1373 | nomem: | 1374 | nomem: |
| @@ -1402,6 +1403,7 @@ static int __devexit mmc_spi_remove(struct spi_device *spi) | |||
| 1402 | 1403 | ||
| 1403 | spi->max_speed_hz = mmc->f_max; | 1404 | spi->max_speed_hz = mmc->f_max; |
| 1404 | mmc_free_host(mmc); | 1405 | mmc_free_host(mmc); |
| 1406 | mmc_spi_put_pdata(spi); | ||
| 1405 | dev_set_drvdata(&spi->dev, NULL); | 1407 | dev_set_drvdata(&spi->dev, NULL); |
| 1406 | } | 1408 | } |
| 1407 | return 0; | 1409 | return 0; |
diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c new file mode 100644 index 000000000000..fb2921f8099d --- /dev/null +++ b/drivers/mmc/host/of_mmc_spi.c | |||
| @@ -0,0 +1,149 @@ | |||
| 1 | /* | ||
| 2 | * OpenFirmware bindings for the MMC-over-SPI driver | ||
| 3 | * | ||
| 4 | * Copyright (c) MontaVista Software, Inc. 2008. | ||
| 5 | * | ||
| 6 | * Author: Anton Vorontsov <avorontsov@ru.mvista.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/module.h> | ||
| 16 | #include <linux/device.h> | ||
| 17 | #include <linux/gpio.h> | ||
| 18 | #include <linux/of.h> | ||
| 19 | #include <linux/of_gpio.h> | ||
| 20 | #include <linux/spi/spi.h> | ||
| 21 | #include <linux/spi/mmc_spi.h> | ||
| 22 | #include <linux/mmc/core.h> | ||
| 23 | #include <linux/mmc/host.h> | ||
| 24 | |||
| 25 | enum { | ||
| 26 | CD_GPIO = 0, | ||
| 27 | WP_GPIO, | ||
| 28 | NUM_GPIOS, | ||
| 29 | }; | ||
| 30 | |||
| 31 | struct of_mmc_spi { | ||
| 32 | int gpios[NUM_GPIOS]; | ||
| 33 | bool alow_gpios[NUM_GPIOS]; | ||
| 34 | struct mmc_spi_platform_data pdata; | ||
| 35 | }; | ||
| 36 | |||
| 37 | static struct of_mmc_spi *to_of_mmc_spi(struct device *dev) | ||
| 38 | { | ||
| 39 | return container_of(dev->platform_data, struct of_mmc_spi, pdata); | ||
| 40 | } | ||
| 41 | |||
| 42 | static int of_mmc_spi_read_gpio(struct device *dev, int gpio_num) | ||
| 43 | { | ||
| 44 | struct of_mmc_spi *oms = to_of_mmc_spi(dev); | ||
| 45 | bool active_low = oms->alow_gpios[gpio_num]; | ||
| 46 | bool value = gpio_get_value(oms->gpios[gpio_num]); | ||
| 47 | |||
| 48 | return active_low ^ value; | ||
| 49 | } | ||
| 50 | |||
| 51 | static int of_mmc_spi_get_cd(struct device *dev) | ||
| 52 | { | ||
| 53 | return of_mmc_spi_read_gpio(dev, CD_GPIO); | ||
| 54 | } | ||
| 55 | |||
| 56 | static int of_mmc_spi_get_ro(struct device *dev) | ||
| 57 | { | ||
| 58 | return of_mmc_spi_read_gpio(dev, WP_GPIO); | ||
| 59 | } | ||
| 60 | |||
| 61 | struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) | ||
| 62 | { | ||
| 63 | struct device *dev = &spi->dev; | ||
| 64 | struct device_node *np = dev_archdata_get_node(&dev->archdata); | ||
| 65 | struct of_mmc_spi *oms; | ||
| 66 | const u32 *voltage_ranges; | ||
| 67 | int num_ranges; | ||
| 68 | int i; | ||
| 69 | int ret = -EINVAL; | ||
| 70 | |||
| 71 | if (dev->platform_data || !np) | ||
| 72 | return dev->platform_data; | ||
| 73 | |||
| 74 | oms = kzalloc(sizeof(*oms), GFP_KERNEL); | ||
| 75 | if (!oms) | ||
| 76 | return NULL; | ||
| 77 | |||
| 78 | voltage_ranges = of_get_property(np, "voltage-ranges", &num_ranges); | ||
| 79 | num_ranges = num_ranges / sizeof(*voltage_ranges) / 2; | ||
| 80 | if (!voltage_ranges || !num_ranges) { | ||
| 81 | dev_err(dev, "OF: voltage-ranges unspecified\n"); | ||
| 82 | goto err_ocr; | ||
| 83 | } | ||
| 84 | |||
| 85 | for (i = 0; i < num_ranges; i++) { | ||
| 86 | const int j = i * 2; | ||
| 87 | u32 mask; | ||
| 88 | |||
| 89 | mask = mmc_vddrange_to_ocrmask(voltage_ranges[j], | ||
| 90 | voltage_ranges[j + 1]); | ||
| 91 | if (!mask) { | ||
| 92 | ret = -EINVAL; | ||
| 93 | dev_err(dev, "OF: voltage-range #%d is invalid\n", i); | ||
| 94 | goto err_ocr; | ||
| 95 | } | ||
| 96 | oms->pdata.ocr_mask |= mask; | ||
| 97 | } | ||
| 98 | |||
| 99 | for (i = 0; i < ARRAY_SIZE(oms->gpios); i++) { | ||
| 100 | enum of_gpio_flags gpio_flags; | ||
| 101 | |||
| 102 | oms->gpios[i] = of_get_gpio_flags(np, i, &gpio_flags); | ||
| 103 | if (!gpio_is_valid(oms->gpios[i])) | ||
| 104 | continue; | ||
| 105 | |||
| 106 | ret = gpio_request(oms->gpios[i], dev->bus_id); | ||
| 107 | if (ret < 0) { | ||
| 108 | oms->gpios[i] = -EINVAL; | ||
| 109 | continue; | ||
| 110 | } | ||
| 111 | |||
| 112 | if (gpio_flags & OF_GPIO_ACTIVE_LOW) | ||
| 113 | oms->alow_gpios[i] = true; | ||
| 114 | } | ||
| 115 | |||
| 116 | if (gpio_is_valid(oms->gpios[CD_GPIO])) | ||
| 117 | oms->pdata.get_cd = of_mmc_spi_get_cd; | ||
| 118 | if (gpio_is_valid(oms->gpios[WP_GPIO])) | ||
| 119 | oms->pdata.get_ro = of_mmc_spi_get_ro; | ||
| 120 | |||
| 121 | /* We don't support interrupts yet, let's poll. */ | ||
| 122 | oms->pdata.caps |= MMC_CAP_NEEDS_POLL; | ||
| 123 | |||
| 124 | dev->platform_data = &oms->pdata; | ||
| 125 | return dev->platform_data; | ||
| 126 | err_ocr: | ||
| 127 | kfree(oms); | ||
| 128 | return NULL; | ||
| 129 | } | ||
| 130 | EXPORT_SYMBOL(mmc_spi_get_pdata); | ||
| 131 | |||
| 132 | void mmc_spi_put_pdata(struct spi_device *spi) | ||
| 133 | { | ||
| 134 | struct device *dev = &spi->dev; | ||
| 135 | struct device_node *np = dev_archdata_get_node(&dev->archdata); | ||
| 136 | struct of_mmc_spi *oms = to_of_mmc_spi(dev); | ||
| 137 | int i; | ||
| 138 | |||
| 139 | if (!dev->platform_data || !np) | ||
| 140 | return; | ||
| 141 | |||
| 142 | for (i = 0; i < ARRAY_SIZE(oms->gpios); i++) { | ||
| 143 | if (gpio_is_valid(oms->gpios[i])) | ||
| 144 | gpio_free(oms->gpios[i]); | ||
| 145 | } | ||
| 146 | kfree(oms); | ||
| 147 | dev->platform_data = NULL; | ||
| 148 | } | ||
| 149 | EXPORT_SYMBOL(mmc_spi_put_pdata); | ||
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index f88cc7406354..3c5483b75da4 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
| @@ -283,7 +283,7 @@ static int pxamci_data_done(struct pxamci_host *host, unsigned int stat) | |||
| 283 | return 0; | 283 | return 0; |
| 284 | 284 | ||
| 285 | DCSR(host->dma) = 0; | 285 | DCSR(host->dma) = 0; |
| 286 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->dma_len, | 286 | dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, |
| 287 | host->dma_dir); | 287 | host->dma_dir); |
| 288 | 288 | ||
| 289 | if (stat & STAT_READ_TIME_OUT) | 289 | if (stat & STAT_READ_TIME_OUT) |
diff --git a/drivers/mmc/host/ricoh_mmc.c b/drivers/mmc/host/ricoh_mmc.c index a16d7609e4ee..be9e7b32b34e 100644 --- a/drivers/mmc/host/ricoh_mmc.c +++ b/drivers/mmc/host/ricoh_mmc.c | |||
| @@ -11,9 +11,10 @@ | |||
| 11 | 11 | ||
| 12 | /* | 12 | /* |
| 13 | * This is a conceptually ridiculous driver, but it is required by the way | 13 | * This is a conceptually ridiculous driver, but it is required by the way |
| 14 | * the Ricoh multi-function R5C832 works. This chip implements firewire | 14 | * the Ricoh multi-function chips (R5CXXX) work. These chips implement |
| 15 | * and four different memory card controllers. Two of those controllers are | 15 | * the four main memory card controllers (SD, MMC, MS, xD) and one or both |
| 16 | * an SDHCI controller and a proprietary MMC controller. The linux SDHCI | 16 | * of cardbus or firewire. It happens that they implement SD and MMC |
| 17 | * support as separate controllers (and PCI functions). The linux SDHCI | ||
| 17 | * driver supports MMC cards but the chip detects MMC cards in hardware | 18 | * driver supports MMC cards but the chip detects MMC cards in hardware |
| 18 | * and directs them to the MMC controller - so the SDHCI driver never sees | 19 | * and directs them to the MMC controller - so the SDHCI driver never sees |
| 19 | * them. To get around this, we must disable the useless MMC controller. | 20 | * them. To get around this, we must disable the useless MMC controller. |
| @@ -21,8 +22,10 @@ | |||
| 21 | * a detection event occurs immediately, even if the MMC card is already | 22 | * a detection event occurs immediately, even if the MMC card is already |
| 22 | * in the reader. | 23 | * in the reader. |
| 23 | * | 24 | * |
| 24 | * The relevant registers live on the firewire function, so this is unavoidably | 25 | * It seems to be the case that the relevant PCI registers to deactivate the |
| 25 | * ugly. Such is life. | 26 | * MMC controller live on PCI function 0, which might be the cardbus controller |
| 27 | * or the firewire controller, depending on the particular chip in question. As | ||
| 28 | * such, it makes what this driver has to do unavoidably ugly. Such is life. | ||
| 26 | */ | 29 | */ |
| 27 | 30 | ||
| 28 | #include <linux/pci.h> | 31 | #include <linux/pci.h> |
| @@ -143,6 +146,7 @@ static int __devinit ricoh_mmc_probe(struct pci_dev *pdev, | |||
| 143 | pci_get_device(PCI_VENDOR_ID_RICOH, | 146 | pci_get_device(PCI_VENDOR_ID_RICOH, |
| 144 | PCI_DEVICE_ID_RICOH_RL5C476, fw_dev))) { | 147 | PCI_DEVICE_ID_RICOH_RL5C476, fw_dev))) { |
| 145 | if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && | 148 | if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && |
| 149 | PCI_FUNC(fw_dev->devfn) == 0 && | ||
| 146 | pdev->bus == fw_dev->bus) { | 150 | pdev->bus == fw_dev->bus) { |
| 147 | if (ricoh_mmc_disable(fw_dev) != 0) | 151 | if (ricoh_mmc_disable(fw_dev) != 0) |
| 148 | return -ENODEV; | 152 | return -ENODEV; |
| @@ -160,6 +164,7 @@ static int __devinit ricoh_mmc_probe(struct pci_dev *pdev, | |||
| 160 | (fw_dev = pci_get_device(PCI_VENDOR_ID_RICOH, | 164 | (fw_dev = pci_get_device(PCI_VENDOR_ID_RICOH, |
| 161 | PCI_DEVICE_ID_RICOH_R5C832, fw_dev))) { | 165 | PCI_DEVICE_ID_RICOH_R5C832, fw_dev))) { |
| 162 | if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && | 166 | if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && |
| 167 | PCI_FUNC(fw_dev->devfn) == 0 && | ||
| 163 | pdev->bus == fw_dev->bus) { | 168 | pdev->bus == fw_dev->bus) { |
| 164 | if (ricoh_mmc_disable(fw_dev) != 0) | 169 | if (ricoh_mmc_disable(fw_dev) != 0) |
| 165 | return -ENODEV; | 170 | return -ENODEV; |
| @@ -172,7 +177,7 @@ static int __devinit ricoh_mmc_probe(struct pci_dev *pdev, | |||
| 172 | 177 | ||
| 173 | if (!ctrlfound) { | 178 | if (!ctrlfound) { |
| 174 | printk(KERN_WARNING DRIVER_NAME | 179 | printk(KERN_WARNING DRIVER_NAME |
| 175 | ": Main firewire function not found. Cannot disable controller.\n"); | 180 | ": Main Ricoh function not found. Cannot disable controller.\n"); |
| 176 | return -ENODEV; | 181 | return -ENODEV; |
| 177 | } | 182 | } |
| 178 | 183 | ||
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index 9bd7026b0021..f07255cb17ee 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
| @@ -545,7 +545,7 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot( | |||
| 545 | } | 545 | } |
| 546 | 546 | ||
| 547 | addr = pci_resource_start(pdev, bar); | 547 | addr = pci_resource_start(pdev, bar); |
| 548 | host->ioaddr = ioremap_nocache(addr, pci_resource_len(pdev, bar)); | 548 | host->ioaddr = pci_ioremap_bar(pdev, bar); |
| 549 | if (!host->ioaddr) { | 549 | if (!host->ioaddr) { |
| 550 | dev_err(&pdev->dev, "failed to remap registers\n"); | 550 | dev_err(&pdev->dev, "failed to remap registers\n"); |
| 551 | goto release; | 551 | goto release; |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 4d010a984bed..6b2d1f99af67 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
| @@ -30,6 +30,11 @@ | |||
| 30 | #define DBG(f, x...) \ | 30 | #define DBG(f, x...) \ |
| 31 | pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x) | 31 | pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x) |
| 32 | 32 | ||
| 33 | #if defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \ | ||
| 34 | defined(CONFIG_MMC_SDHCI_MODULE)) | ||
| 35 | #define SDHCI_USE_LEDS_CLASS | ||
| 36 | #endif | ||
| 37 | |||
| 33 | static unsigned int debug_quirks = 0; | 38 | static unsigned int debug_quirks = 0; |
| 34 | 39 | ||
| 35 | static void sdhci_prepare_data(struct sdhci_host *, struct mmc_data *); | 40 | static void sdhci_prepare_data(struct sdhci_host *, struct mmc_data *); |
| @@ -149,7 +154,7 @@ static void sdhci_deactivate_led(struct sdhci_host *host) | |||
| 149 | writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); | 154 | writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); |
| 150 | } | 155 | } |
| 151 | 156 | ||
| 152 | #ifdef CONFIG_LEDS_CLASS | 157 | #ifdef SDHCI_USE_LEDS_CLASS |
| 153 | static void sdhci_led_control(struct led_classdev *led, | 158 | static void sdhci_led_control(struct led_classdev *led, |
| 154 | enum led_brightness brightness) | 159 | enum led_brightness brightness) |
| 155 | { | 160 | { |
| @@ -994,7 +999,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
| 994 | 999 | ||
| 995 | WARN_ON(host->mrq != NULL); | 1000 | WARN_ON(host->mrq != NULL); |
| 996 | 1001 | ||
| 997 | #ifndef CONFIG_LEDS_CLASS | 1002 | #ifndef SDHCI_USE_LEDS_CLASS |
| 998 | sdhci_activate_led(host); | 1003 | sdhci_activate_led(host); |
| 999 | #endif | 1004 | #endif |
| 1000 | 1005 | ||
| @@ -1201,7 +1206,7 @@ static void sdhci_tasklet_finish(unsigned long param) | |||
| 1201 | host->cmd = NULL; | 1206 | host->cmd = NULL; |
| 1202 | host->data = NULL; | 1207 | host->data = NULL; |
| 1203 | 1208 | ||
| 1204 | #ifndef CONFIG_LEDS_CLASS | 1209 | #ifndef SDHCI_USE_LEDS_CLASS |
| 1205 | sdhci_deactivate_led(host); | 1210 | sdhci_deactivate_led(host); |
| 1206 | #endif | 1211 | #endif |
| 1207 | 1212 | ||
| @@ -1717,7 +1722,7 @@ int sdhci_add_host(struct sdhci_host *host) | |||
| 1717 | sdhci_dumpregs(host); | 1722 | sdhci_dumpregs(host); |
| 1718 | #endif | 1723 | #endif |
| 1719 | 1724 | ||
| 1720 | #ifdef CONFIG_LEDS_CLASS | 1725 | #ifdef SDHCI_USE_LEDS_CLASS |
| 1721 | host->led.name = mmc_hostname(mmc); | 1726 | host->led.name = mmc_hostname(mmc); |
| 1722 | host->led.brightness = LED_OFF; | 1727 | host->led.brightness = LED_OFF; |
| 1723 | host->led.default_trigger = mmc_hostname(mmc); | 1728 | host->led.default_trigger = mmc_hostname(mmc); |
| @@ -1739,7 +1744,7 @@ int sdhci_add_host(struct sdhci_host *host) | |||
| 1739 | 1744 | ||
| 1740 | return 0; | 1745 | return 0; |
| 1741 | 1746 | ||
| 1742 | #ifdef CONFIG_LEDS_CLASS | 1747 | #ifdef SDHCI_USE_LEDS_CLASS |
| 1743 | reset: | 1748 | reset: |
| 1744 | sdhci_reset(host, SDHCI_RESET_ALL); | 1749 | sdhci_reset(host, SDHCI_RESET_ALL); |
| 1745 | free_irq(host->irq, host); | 1750 | free_irq(host->irq, host); |
| @@ -1775,7 +1780,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead) | |||
| 1775 | 1780 | ||
| 1776 | mmc_remove_host(host->mmc); | 1781 | mmc_remove_host(host->mmc); |
| 1777 | 1782 | ||
| 1778 | #ifdef CONFIG_LEDS_CLASS | 1783 | #ifdef SDHCI_USE_LEDS_CLASS |
| 1779 | led_classdev_unregister(&host->led); | 1784 | led_classdev_unregister(&host->led); |
| 1780 | #endif | 1785 | #endif |
| 1781 | 1786 | ||
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 31f4b1528e76..3efba2363941 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h | |||
| @@ -220,7 +220,7 @@ struct sdhci_host { | |||
| 220 | struct mmc_host *mmc; /* MMC structure */ | 220 | struct mmc_host *mmc; /* MMC structure */ |
| 221 | u64 dma_mask; /* custom DMA mask */ | 221 | u64 dma_mask; /* custom DMA mask */ |
| 222 | 222 | ||
| 223 | #ifdef CONFIG_LEDS_CLASS | 223 | #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE) |
| 224 | struct led_classdev led; /* LED control */ | 224 | struct led_classdev led; /* LED control */ |
| 225 | #endif | 225 | #endif |
| 226 | 226 | ||
diff --git a/drivers/mmc/host/sdricoh_cs.c b/drivers/mmc/host/sdricoh_cs.c index 1df44d966bdb..cb41e9c3ac07 100644 --- a/drivers/mmc/host/sdricoh_cs.c +++ b/drivers/mmc/host/sdricoh_cs.c | |||
| @@ -82,6 +82,8 @@ static struct pcmcia_device_id pcmcia_ids[] = { | |||
| 82 | /* vendor and device strings followed by their crc32 hashes */ | 82 | /* vendor and device strings followed by their crc32 hashes */ |
| 83 | PCMCIA_DEVICE_PROD_ID12("RICOH", "Bay1Controller", 0xd9f522ed, | 83 | PCMCIA_DEVICE_PROD_ID12("RICOH", "Bay1Controller", 0xd9f522ed, |
| 84 | 0xc3901202), | 84 | 0xc3901202), |
| 85 | PCMCIA_DEVICE_PROD_ID12("RICOH", "Bay Controller", 0xd9f522ed, | ||
| 86 | 0xace80909), | ||
| 85 | PCMCIA_DEVICE_NULL, | 87 | PCMCIA_DEVICE_NULL, |
| 86 | }; | 88 | }; |
| 87 | 89 | ||
| @@ -463,7 +465,7 @@ static int sdricoh_init_mmc(struct pci_dev *pci_dev, | |||
| 463 | 465 | ||
| 464 | err: | 466 | err: |
| 465 | if (iobase) | 467 | if (iobase) |
| 466 | iounmap(iobase); | 468 | pci_iounmap(pci_dev, iobase); |
| 467 | if (mmc) | 469 | if (mmc) |
| 468 | mmc_free_host(mmc); | 470 | mmc_free_host(mmc); |
| 469 | 471 | ||
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index 95430b81ec11..6a7a61904833 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c | |||
| @@ -224,7 +224,7 @@ static inline void tmio_mmc_data_irq(struct tmio_mmc_host *host) | |||
| 224 | { | 224 | { |
| 225 | void __iomem *ctl = host->ctl; | 225 | void __iomem *ctl = host->ctl; |
| 226 | struct mmc_data *data = host->data; | 226 | struct mmc_data *data = host->data; |
| 227 | struct mmc_command *stop = data->stop; | 227 | struct mmc_command *stop; |
| 228 | 228 | ||
| 229 | host->data = NULL; | 229 | host->data = NULL; |
| 230 | 230 | ||
| @@ -232,6 +232,7 @@ static inline void tmio_mmc_data_irq(struct tmio_mmc_host *host) | |||
| 232 | pr_debug("Spurious data end IRQ\n"); | 232 | pr_debug("Spurious data end IRQ\n"); |
| 233 | return; | 233 | return; |
| 234 | } | 234 | } |
| 235 | stop = data->stop; | ||
| 235 | 236 | ||
| 236 | /* FIXME - return correct transfer count on errors */ | 237 | /* FIXME - return correct transfer count on errors */ |
| 237 | if (!data->error) | 238 | if (!data->error) |
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 143cebf0586f..7ac8b500d55c 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h | |||
| @@ -151,4 +151,6 @@ static inline void mmc_claim_host(struct mmc_host *host) | |||
| 151 | __mmc_claim_host(host, NULL); | 151 | __mmc_claim_host(host, NULL); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); | ||
| 155 | |||
| 154 | #endif | 156 | #endif |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index f842f234e44f..4e457256bd33 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
| @@ -41,6 +41,7 @@ struct mmc_ios { | |||
| 41 | 41 | ||
| 42 | #define MMC_BUS_WIDTH_1 0 | 42 | #define MMC_BUS_WIDTH_1 0 |
| 43 | #define MMC_BUS_WIDTH_4 2 | 43 | #define MMC_BUS_WIDTH_4 2 |
| 44 | #define MMC_BUS_WIDTH_8 3 | ||
| 44 | 45 | ||
| 45 | unsigned char timing; /* timing specification used */ | 46 | unsigned char timing; /* timing specification used */ |
| 46 | 47 | ||
| @@ -116,6 +117,7 @@ struct mmc_host { | |||
| 116 | #define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */ | 117 | #define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */ |
| 117 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ | 118 | #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ |
| 118 | #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ | 119 | #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ |
| 120 | #define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ | ||
| 119 | 121 | ||
| 120 | /* host specific block data */ | 122 | /* host specific block data */ |
| 121 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ | 123 | unsigned int max_seg_size; /* see blk_queue_max_segment_size */ |
diff --git a/include/linux/spi/mmc_spi.h b/include/linux/spi/mmc_spi.h index a3626aedaec9..0f4eb165f254 100644 --- a/include/linux/spi/mmc_spi.h +++ b/include/linux/spi/mmc_spi.h | |||
| @@ -1,9 +1,10 @@ | |||
| 1 | #ifndef __LINUX_SPI_MMC_SPI_H | 1 | #ifndef __LINUX_SPI_MMC_SPI_H |
| 2 | #define __LINUX_SPI_MMC_SPI_H | 2 | #define __LINUX_SPI_MMC_SPI_H |
| 3 | 3 | ||
| 4 | #include <linux/device.h> | ||
| 5 | #include <linux/spi/spi.h> | ||
| 4 | #include <linux/interrupt.h> | 6 | #include <linux/interrupt.h> |
| 5 | 7 | ||
| 6 | struct device; | ||
| 7 | struct mmc_host; | 8 | struct mmc_host; |
| 8 | 9 | ||
| 9 | /* Put this in platform_data of a device being used to manage an MMC/SD | 10 | /* Put this in platform_data of a device being used to manage an MMC/SD |
| @@ -41,4 +42,16 @@ struct mmc_spi_platform_data { | |||
| 41 | void (*setpower)(struct device *, unsigned int maskval); | 42 | void (*setpower)(struct device *, unsigned int maskval); |
| 42 | }; | 43 | }; |
| 43 | 44 | ||
| 45 | #ifdef CONFIG_OF | ||
| 46 | extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi); | ||
| 47 | extern void mmc_spi_put_pdata(struct spi_device *spi); | ||
| 48 | #else | ||
| 49 | static inline struct mmc_spi_platform_data * | ||
| 50 | mmc_spi_get_pdata(struct spi_device *spi) | ||
| 51 | { | ||
| 52 | return spi->dev.platform_data; | ||
| 53 | } | ||
| 54 | static inline void mmc_spi_put_pdata(struct spi_device *spi) {} | ||
| 55 | #endif /* CONFIG_OF */ | ||
| 56 | |||
| 44 | #endif /* __LINUX_SPI_MMC_SPI_H */ | 57 | #endif /* __LINUX_SPI_MMC_SPI_H */ |
