Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
mmc: warn about voltage mismatches
mmc_spi: Add support for OpenFirmware bindings
pxamci: fix dma_unmap_sg length
mmc_block: ensure all sectors that do not have errors are read
drivers/mmc: Move a dereference below a NULL test
sdhci: handle built-in sdhci with modular leds class
mmc: balanc pci_iomap with pci_iounmap
mmc_block: print better error messages
mmc: Add mmc_vddrange_to_ocrmask() helper function
ricoh_mmc: Handle newer models of Ricoh controllers
mmc: Add 8-bit bus width support
sdhci: activate led support also when module
mmc: trivial annotation of 'blocks'
pci: use pci_ioremap_bar() in drivers/mmc
sdricoh_cs: Add support for Bay Controller devices
mmc: at91_mci: reorder timer setup and mmc_add_host() call

+392 -51
+96 -26
drivers/mmc/card/block.c
··· 145 145 static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) 146 146 { 147 147 int err; 148 - u32 blocks; 148 + __be32 blocks; 149 149 150 150 struct mmc_request mrq; 151 151 struct mmc_command cmd; ··· 204 204 if (cmd.error || data.error) 205 205 return (u32)-1; 206 206 207 - blocks = ntohl(blocks); 207 + return ntohl(blocks); 208 + } 208 209 209 - return blocks; 210 + static u32 get_card_status(struct mmc_card *card, struct request *req) 211 + { 212 + struct mmc_command cmd; 213 + int err; 214 + 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 227 static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) ··· 229 214 struct mmc_blk_data *md = mq->data; 230 215 struct mmc_card *card = md->queue.card; 231 216 struct mmc_blk_request brq; 232 - int ret = 1; 217 + int ret = 1, disable_multi = 0; 233 218 234 219 mmc_claim_host(card->host); 235 220 236 221 do { 237 222 struct mmc_command cmd; 238 - u32 readcmd, writecmd; 223 + u32 readcmd, writecmd, status = 0; 239 224 240 225 memset(&brq, 0, sizeof(struct mmc_blk_request)); 241 226 brq.mrq.cmd = &brq.cmd; ··· 250 235 brq.stop.arg = 0; 251 236 brq.stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; 252 237 brq.data.blocks = req->nr_sectors; 238 + 239 + /* 240 + * After a read error, we redo the request one sector at a time 241 + * in order to accurately determine which sectors can be read 242 + * successfully. 243 + */ 244 + if (disable_multi && brq.data.blocks > 1) 245 + brq.data.blocks = 1; 253 246 254 247 if (brq.data.blocks > 1) { 255 248 /* SPI multiblock writes terminate using a special ··· 287 264 brq.data.sg = mq->sg; 288 265 brq.data.sg_len = mmc_queue_map_sg(mq); 289 266 267 + /* 268 + * Adjust the sg list so it is the same size as the 269 + * request. 270 + */ 271 + if (brq.data.blocks != req->nr_sectors) { 272 + int i, data_size = brq.data.blocks << 9; 273 + struct scatterlist *sg; 274 + 275 + for_each_sg(brq.data.sg, sg, brq.data.sg_len, i) { 276 + data_size -= sg->length; 277 + if (data_size <= 0) { 278 + sg->length += data_size; 279 + i++; 280 + break; 281 + } 282 + } 283 + brq.data.sg_len = i; 284 + } 285 + 290 286 mmc_queue_bounce_pre(mq); 291 287 292 288 mmc_wait_for_req(card->host, &brq.mrq); ··· 317 275 * until later as we need to wait for the card to leave 318 276 * programming mode even when things go wrong. 319 277 */ 278 + if (brq.cmd.error || brq.data.error || brq.stop.error) { 279 + if (brq.data.blocks > 1 && rq_data_dir(req) == READ) { 280 + /* Redo read one sector at a time */ 281 + printk(KERN_WARNING "%s: retrying using single " 282 + "block read\n", req->rq_disk->disk_name); 283 + disable_multi = 1; 284 + continue; 285 + } 286 + status = get_card_status(card, req); 287 + } 288 + 320 289 if (brq.cmd.error) { 321 - printk(KERN_ERR "%s: error %d sending read/write command\n", 322 - req->rq_disk->disk_name, brq.cmd.error); 290 + printk(KERN_ERR "%s: error %d sending read/write " 291 + "command, response %#x, card status %#x\n", 292 + req->rq_disk->disk_name, brq.cmd.error, 293 + brq.cmd.resp[0], status); 323 294 } 324 295 325 296 if (brq.data.error) { 326 - printk(KERN_ERR "%s: error %d transferring data\n", 327 - req->rq_disk->disk_name, brq.data.error); 297 + if (brq.data.error == -ETIMEDOUT && brq.mrq.stop) 298 + /* 'Stop' response contains card status */ 299 + status = brq.mrq.stop->resp[0]; 300 + printk(KERN_ERR "%s: error %d transferring data," 301 + " sector %u, nr %u, card status %#x\n", 302 + req->rq_disk->disk_name, brq.data.error, 303 + (unsigned)req->sector, 304 + (unsigned)req->nr_sectors, status); 328 305 } 329 306 330 307 if (brq.stop.error) { 331 - printk(KERN_ERR "%s: error %d sending stop command\n", 332 - req->rq_disk->disk_name, brq.stop.error); 308 + printk(KERN_ERR "%s: error %d sending stop command, " 309 + "response %#x, card status %#x\n", 310 + req->rq_disk->disk_name, brq.stop.error, 311 + brq.stop.resp[0], status); 333 312 } 334 313 335 314 if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) { ··· 383 320 #endif 384 321 } 385 322 386 - if (brq.cmd.error || brq.data.error || brq.stop.error) 323 + if (brq.cmd.error || brq.stop.error || brq.data.error) { 324 + if (rq_data_dir(req) == READ) { 325 + /* 326 + * After an error, we redo I/O one sector at a 327 + * time, so we only reach here after trying to 328 + * read a single sector. 329 + */ 330 + spin_lock_irq(&md->lock); 331 + ret = __blk_end_request(req, -EIO, brq.data.blksz); 332 + spin_unlock_irq(&md->lock); 333 + continue; 334 + } 387 335 goto cmd_err; 336 + } 388 337 389 338 /* 390 339 * A block was successfully transferred. ··· 418 343 * If the card is not SD, we can still ok written sectors 419 344 * as reported by the controller (which might be less than 420 345 * the real number of written sectors, but never more). 421 - * 422 - * For reads we just fail the entire chunk as that should 423 - * be safe in all cases. 424 346 */ 425 - if (rq_data_dir(req) != READ) { 426 - if (mmc_card_sd(card)) { 427 - u32 blocks; 347 + if (mmc_card_sd(card)) { 348 + u32 blocks; 428 349 429 - blocks = mmc_sd_num_wr_blocks(card); 430 - if (blocks != (u32)-1) { 431 - spin_lock_irq(&md->lock); 432 - ret = __blk_end_request(req, 0, blocks << 9); 433 - spin_unlock_irq(&md->lock); 434 - } 435 - } else { 350 + blocks = mmc_sd_num_wr_blocks(card); 351 + if (blocks != (u32)-1) { 436 352 spin_lock_irq(&md->lock); 437 - ret = __blk_end_request(req, 0, brq.data.bytes_xfered); 353 + ret = __blk_end_request(req, 0, blocks << 9); 438 354 spin_unlock_irq(&md->lock); 439 355 } 356 + } else { 357 + spin_lock_irq(&md->lock); 358 + ret = __blk_end_request(req, 0, brq.data.bytes_xfered); 359 + spin_unlock_irq(&md->lock); 440 360 } 441 361 442 362 mmc_release_host(card->host);
+77
drivers/mmc/core/core.c
··· 20 20 #include <linux/err.h> 21 21 #include <linux/leds.h> 22 22 #include <linux/scatterlist.h> 23 + #include <linux/log2.h> 23 24 24 25 #include <linux/mmc/card.h> 25 26 #include <linux/mmc/host.h> ··· 449 448 mmc_set_ios(host); 450 449 } 451 450 451 + /** 452 + * mmc_vdd_to_ocrbitnum - Convert a voltage to the OCR bit number 453 + * @vdd: voltage (mV) 454 + * @low_bits: prefer low bits in boundary cases 455 + * 456 + * This function returns the OCR bit number according to the provided @vdd 457 + * value. If conversion is not possible a negative errno value returned. 458 + * 459 + * Depending on the @low_bits flag the function prefers low or high OCR bits 460 + * on boundary voltages. For example, 461 + * with @low_bits = true, 3300 mV translates to ilog2(MMC_VDD_32_33); 462 + * with @low_bits = false, 3300 mV translates to ilog2(MMC_VDD_33_34); 463 + * 464 + * Any value in the [1951:1999] range translates to the ilog2(MMC_VDD_20_21). 465 + */ 466 + static int mmc_vdd_to_ocrbitnum(int vdd, bool low_bits) 467 + { 468 + const int max_bit = ilog2(MMC_VDD_35_36); 469 + int bit; 470 + 471 + if (vdd < 1650 || vdd > 3600) 472 + return -EINVAL; 473 + 474 + if (vdd >= 1650 && vdd <= 1950) 475 + return ilog2(MMC_VDD_165_195); 476 + 477 + if (low_bits) 478 + vdd -= 1; 479 + 480 + /* Base 2000 mV, step 100 mV, bit's base 8. */ 481 + bit = (vdd - 2000) / 100 + 8; 482 + if (bit > max_bit) 483 + return max_bit; 484 + return bit; 485 + } 486 + 487 + /** 488 + * mmc_vddrange_to_ocrmask - Convert a voltage range to the OCR mask 489 + * @vdd_min: minimum voltage value (mV) 490 + * @vdd_max: maximum voltage value (mV) 491 + * 492 + * This function returns the OCR mask bits according to the provided @vdd_min 493 + * and @vdd_max values. If conversion is not possible the function returns 0. 494 + * 495 + * Notes wrt boundary cases: 496 + * This function sets the OCR bits for all boundary voltages, for example 497 + * [3300:3400] range is translated to MMC_VDD_32_33 | MMC_VDD_33_34 | 498 + * MMC_VDD_34_35 mask. 499 + */ 500 + u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max) 501 + { 502 + u32 mask = 0; 503 + 504 + if (vdd_max < vdd_min) 505 + return 0; 506 + 507 + /* Prefer high bits for the boundary vdd_max values. */ 508 + vdd_max = mmc_vdd_to_ocrbitnum(vdd_max, false); 509 + if (vdd_max < 0) 510 + return 0; 511 + 512 + /* Prefer low bits for the boundary vdd_min values. */ 513 + vdd_min = mmc_vdd_to_ocrbitnum(vdd_min, true); 514 + if (vdd_min < 0) 515 + return 0; 516 + 517 + /* Fill the mask, from max bit to min bit. */ 518 + while (vdd_max >= vdd_min) 519 + mask |= 1 << vdd_max--; 520 + 521 + return mask; 522 + } 523 + EXPORT_SYMBOL(mmc_vddrange_to_ocrmask); 524 + 452 525 /* 453 526 * Mask off any voltages we don't support and select 454 527 * the lowest voltage ··· 542 467 host->ios.vdd = bit; 543 468 mmc_set_ios(host); 544 469 } else { 470 + pr_warning("%s: host doesn't support card's voltages\n", 471 + mmc_hostname(host)); 545 472 ocr = 0; 546 473 } 547 474
+14 -4
drivers/mmc/core/mmc.c
··· 434 434 * Activate wide bus (if supported). 435 435 */ 436 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 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 451 if (err) 441 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 457 if (!oldcard) ··· 635 624 636 625 return err; 637 626 } 638 -
+3
drivers/mmc/host/Makefile
··· 19 19 obj-$(CONFIG_MMC_ATMELMCI) += atmel-mci.o 20 20 obj-$(CONFIG_MMC_TIFM_SD) += tifm_sd.o 21 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 25 obj-$(CONFIG_MMC_S3C) += s3cmci.o 23 26 obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o 24 27 obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o
+2 -2
drivers/mmc/host/at91_mci.c
··· 1088 1088 goto fail0; 1089 1089 } 1090 1090 1091 + setup_timer(&host->timer, at91_timeout_timer, (unsigned long)host); 1092 + 1091 1093 platform_set_drvdata(pdev, mmc); 1092 1094 1093 1095 /* ··· 1102 1100 host->present = -1; 1103 1101 1104 1102 mmc_add_host(mmc); 1105 - 1106 - setup_timer(&host->timer, at91_timeout_timer, (unsigned long)host); 1107 1103 1108 1104 /* 1109 1105 * monitor card insertion/removal if we can
+3 -1
drivers/mmc/host/mmc_spi.c
··· 1285 1285 /* Platform data is used to hook up things like card sensing 1286 1286 * and power switching gpios. 1287 1287 */ 1288 - host->pdata = spi->dev.platform_data; 1288 + host->pdata = mmc_spi_get_pdata(spi); 1289 1289 if (host->pdata) 1290 1290 mmc->ocr_avail = host->pdata->ocr_mask; 1291 1291 if (!mmc->ocr_avail) { ··· 1368 1368 1369 1369 fail_nobuf1: 1370 1370 mmc_free_host(mmc); 1371 + mmc_spi_put_pdata(spi); 1371 1372 dev_set_drvdata(&spi->dev, NULL); 1372 1373 1373 1374 nomem: ··· 1403 1402 1404 1403 spi->max_speed_hz = mmc->f_max; 1405 1404 mmc_free_host(mmc); 1405 + mmc_spi_put_pdata(spi); 1406 1406 dev_set_drvdata(&spi->dev, NULL); 1407 1407 } 1408 1408 return 0;
+149
drivers/mmc/host/of_mmc_spi.c
··· 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);
+1 -1
drivers/mmc/host/pxamci.c
··· 283 283 return 0; 284 284 285 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 287 host->dma_dir); 288 288 289 289 if (stat & STAT_READ_TIME_OUT)
+11 -6
drivers/mmc/host/ricoh_mmc.c
··· 11 11 12 12 /* 13 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 15 - * and four different memory card controllers. Two of those controllers are 16 - * an SDHCI controller and a proprietary MMC controller. The linux SDHCI 14 + * the Ricoh multi-function chips (R5CXXX) work. These chips implement 15 + * the four main memory card controllers (SD, MMC, MS, xD) and one or both 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 18 * driver supports MMC cards but the chip detects MMC cards in hardware 18 19 * and directs them to the MMC controller - so the SDHCI driver never sees 19 20 * them. To get around this, we must disable the useless MMC controller. ··· 22 21 * a detection event occurs immediately, even if the MMC card is already 23 22 * in the reader. 24 23 * 25 - * The relevant registers live on the firewire function, so this is unavoidably 26 - * ugly. Such is life. 24 + * It seems to be the case that the relevant PCI registers to deactivate the 25 + * MMC controller live on PCI function 0, which might be the cardbus controller 26 + * or the firewire controller, depending on the particular chip in question. As 27 + * such, it makes what this driver has to do unavoidably ugly. Such is life. 27 28 */ 28 29 29 30 #include <linux/pci.h> ··· 146 143 pci_get_device(PCI_VENDOR_ID_RICOH, 147 144 PCI_DEVICE_ID_RICOH_RL5C476, fw_dev))) { 148 145 if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && 146 + PCI_FUNC(fw_dev->devfn) == 0 && 149 147 pdev->bus == fw_dev->bus) { 150 148 if (ricoh_mmc_disable(fw_dev) != 0) 151 149 return -ENODEV; ··· 164 160 (fw_dev = pci_get_device(PCI_VENDOR_ID_RICOH, 165 161 PCI_DEVICE_ID_RICOH_R5C832, fw_dev))) { 166 162 if (PCI_SLOT(pdev->devfn) == PCI_SLOT(fw_dev->devfn) && 163 + PCI_FUNC(fw_dev->devfn) == 0 && 167 164 pdev->bus == fw_dev->bus) { 168 165 if (ricoh_mmc_disable(fw_dev) != 0) 169 166 return -ENODEV; ··· 177 172 178 173 if (!ctrlfound) { 179 174 printk(KERN_WARNING DRIVER_NAME 180 - ": Main firewire function not found. Cannot disable controller.\n"); 175 + ": Main Ricoh function not found. Cannot disable controller.\n"); 181 176 return -ENODEV; 182 177 } 183 178
+1 -1
drivers/mmc/host/sdhci-pci.c
··· 545 545 } 546 546 547 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 549 if (!host->ioaddr) { 550 550 dev_err(&pdev->dev, "failed to remap registers\n"); 551 551 goto release;
+11 -6
drivers/mmc/host/sdhci.c
··· 30 30 #define DBG(f, x...) \ 31 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 38 static unsigned int debug_quirks = 0; 34 39 35 40 static void sdhci_prepare_data(struct sdhci_host *, struct mmc_data *); ··· 154 149 writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL); 155 150 } 156 151 157 - #ifdef CONFIG_LEDS_CLASS 152 + #ifdef SDHCI_USE_LEDS_CLASS 158 153 static void sdhci_led_control(struct led_classdev *led, 159 154 enum led_brightness brightness) 160 155 { ··· 999 994 1000 995 WARN_ON(host->mrq != NULL); 1001 996 1002 - #ifndef CONFIG_LEDS_CLASS 997 + #ifndef SDHCI_USE_LEDS_CLASS 1003 998 sdhci_activate_led(host); 1004 999 #endif 1005 1000 ··· 1206 1201 host->cmd = NULL; 1207 1202 host->data = NULL; 1208 1203 1209 - #ifndef CONFIG_LEDS_CLASS 1204 + #ifndef SDHCI_USE_LEDS_CLASS 1210 1205 sdhci_deactivate_led(host); 1211 1206 #endif 1212 1207 ··· 1722 1717 sdhci_dumpregs(host); 1723 1718 #endif 1724 1719 1725 - #ifdef CONFIG_LEDS_CLASS 1720 + #ifdef SDHCI_USE_LEDS_CLASS 1726 1721 host->led.name = mmc_hostname(mmc); 1727 1722 host->led.brightness = LED_OFF; 1728 1723 host->led.default_trigger = mmc_hostname(mmc); ··· 1744 1739 1745 1740 return 0; 1746 1741 1747 - #ifdef CONFIG_LEDS_CLASS 1742 + #ifdef SDHCI_USE_LEDS_CLASS 1748 1743 reset: 1749 1744 sdhci_reset(host, SDHCI_RESET_ALL); 1750 1745 free_irq(host->irq, host); ··· 1780 1775 1781 1776 mmc_remove_host(host->mmc); 1782 1777 1783 - #ifdef CONFIG_LEDS_CLASS 1778 + #ifdef SDHCI_USE_LEDS_CLASS 1784 1779 led_classdev_unregister(&host->led); 1785 1780 #endif 1786 1781
+1 -1
drivers/mmc/host/sdhci.h
··· 220 220 struct mmc_host *mmc; /* MMC structure */ 221 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 224 struct led_classdev led; /* LED control */ 225 225 #endif 226 226
+3 -1
drivers/mmc/host/sdricoh_cs.c
··· 82 82 /* vendor and device strings followed by their crc32 hashes */ 83 83 PCMCIA_DEVICE_PROD_ID12("RICOH", "Bay1Controller", 0xd9f522ed, 84 84 0xc3901202), 85 + PCMCIA_DEVICE_PROD_ID12("RICOH", "Bay Controller", 0xd9f522ed, 86 + 0xace80909), 85 87 PCMCIA_DEVICE_NULL, 86 88 }; 87 89 ··· 465 463 466 464 err: 467 465 if (iobase) 468 - iounmap(iobase); 466 + pci_iounmap(pci_dev, iobase); 469 467 if (mmc) 470 468 mmc_free_host(mmc); 471 469
+2 -1
drivers/mmc/host/tmio_mmc.c
··· 224 224 { 225 225 void __iomem *ctl = host->ctl; 226 226 struct mmc_data *data = host->data; 227 - struct mmc_command *stop = data->stop; 227 + struct mmc_command *stop; 228 228 229 229 host->data = NULL; 230 230 ··· 232 232 pr_debug("Spurious data end IRQ\n"); 233 233 return; 234 234 } 235 + stop = data->stop; 235 236 236 237 /* FIXME - return correct transfer count on errors */ 237 238 if (!data->error)
+2
include/linux/mmc/core.h
··· 151 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 156 #endif
+2
include/linux/mmc/host.h
··· 41 41 42 42 #define MMC_BUS_WIDTH_1 0 43 43 #define MMC_BUS_WIDTH_4 2 44 + #define MMC_BUS_WIDTH_8 3 44 45 45 46 unsigned char timing; /* timing specification used */ 46 47 ··· 117 116 #define MMC_CAP_SDIO_IRQ (1 << 3) /* Can signal pending SDIO IRQs */ 118 117 #define MMC_CAP_SPI (1 << 4) /* Talks only SPI protocols */ 119 118 #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */ 119 + #define MMC_CAP_8_BIT_DATA (1 << 6) /* Can the host do 8 bit transfers */ 120 120 121 121 /* host specific block data */ 122 122 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
+14 -1
include/linux/spi/mmc_spi.h
··· 1 1 #ifndef __LINUX_SPI_MMC_SPI_H 2 2 #define __LINUX_SPI_MMC_SPI_H 3 3 4 + #include <linux/device.h> 5 + #include <linux/spi/spi.h> 4 6 #include <linux/interrupt.h> 5 7 6 - struct device; 7 8 struct mmc_host; 8 9 9 10 /* Put this in platform_data of a device being used to manage an MMC/SD ··· 41 40 u32 ocr_mask; /* available voltages */ 42 41 void (*setpower)(struct device *, unsigned int maskval); 43 42 }; 43 + 44 + #ifdef CONFIG_OF 45 + extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi); 46 + extern void mmc_spi_put_pdata(struct spi_device *spi); 47 + #else 48 + static inline struct mmc_spi_platform_data * 49 + mmc_spi_get_pdata(struct spi_device *spi) 50 + { 51 + return spi->dev.platform_data; 52 + } 53 + static inline void mmc_spi_put_pdata(struct spi_device *spi) {} 54 + #endif /* CONFIG_OF */ 44 55 45 56 #endif /* __LINUX_SPI_MMC_SPI_H */