aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
AgeCommit message (Collapse)Author
2008-10-28[ARM] 5322/1: Fix fastpath issue in mmci.cLinus Walleij
Fix fastpath issues Since mmci_request() can be called from a non-interrupt context, and does, during kernel init, causing a host of debug messages during boot if you enable spinlock debugging, we need to use the spinlock calls that save IRQ flags and restore them. Signed-off-by: Linus Walleij <triad@df.lth.se> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-10-21[PATCH] switch mmcAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-10-21[PATCH] beginning of methods conversionAl Viro
To keep the size of changesets sane we split the switch by drivers; to keep the damn thing bisectable we do the following: 1) rename the affected methods, add ones with correct prototypes, make (few) callers handle both. That's this changeset. 2) for each driver convert to new methods. *ALL* drivers are converted in this series. 3) kill the old (renamed) methods. Note that it _is_ a flagday; all in-tree drivers are converted and by the end of this series no trace of old methods remain. The only reason why we do that this way is to keep the damn thing bisectable and allow per-driver debugging if anything goes wrong. New methods: open(bdev, mode) release(disk, mode) ioctl(bdev, mode, cmd, arg) /* Called without BKL */ compat_ioctl(bdev, mode, cmd, arg) locked_ioctl(bdev, mode, cmd, arg) /* Called with BKL, legacy */ Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-10-20Merge branch 'for-linus' of ↵Linus Torvalds
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: s3cmci: Add Ben Dooks/Simtec Electronics to header & copyright s3cmci: fix continual accesses to host->pio_ptr s3cmci: Support transfers which are not multiple of 32 bits. s3cmci: cpufreq support s3cmci: Make general protocol errors less noisy mmc_block: tell block layer there is no seek penalty
2008-10-15Merge branch 'fixes' into for-linusRussell King
Conflicts: arch/arm/mach-versatile/core.c
2008-10-15s3cmci: Add Ben Dooks/Simtec Electronics to header & copyrightben@fluff.org.uk
Since the original authour (Thomas Kleffel) has been too busy to merge the s3cmci driver and keep it up to date, I (mostly as part of my role with Simtec Electronics) got the driver to a mergable state and have been maintaining it since I think that I should be added to the header. Also add a copyright statement for the new work. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-15s3cmci: fix continual accesses to host->pio_ptrben@fluff.org.uk
The s3cmci driver uses the host->pio_ptr field to point to the current position into the buffer for data transfer. During the transfers it does the following: while (fifo_words--) *(host->pio_ptr++) = readl(from_ptr); This is inefficent, as host->pio_ptr is not used in any other part of the transfer but the compiler emits code which does the following: while (fifo_words--) { u32 *ptr = host->pio_ptr; *ptr = readl(from_ptr); ptr++; host->pio_ptr = ptr; } This is obviously a waste of a load and store each time around the loop, which could be up to 16 times depending on how much needs to be transfered. Move the ptr accesses to outside the while loop so that we do not end up reloading/re-writing the pointer. Note, this seems to make the code 16 bytes larger. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-15s3cmci: Support transfers which are not multiple of 32 bits.Christer Weinigel
To be able to do SDIO the s3cmci driver has to support non-word-sized transfers. Change pio_words into pio_bytes and fix up all the places where it is used. This variant of the patch will not overrun the buffer when reading an odd number of bytes. When writing, this variant will still read past the end of the buffer, but since the driver can't support non-word- aligned transfers anyway, this should not be a problem, since a word-aligned transfer will never cross a page boundary. This has been tested with a CSR SDIO Bluetooth Type A device on a Samsung S3C24A0 processor. Signed-off-by: Christer Weinigel <christer@weinigel.se> Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-15s3cmci: cpufreq supportben@fluff.org.uk
Support for cpu frequency changing. Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-15s3cmci: Make general protocol errors less noisyben@fluff.org.uk
General errors, such as timeouts during probe do not need to be sent to the console, so move them down to be included if the debug is enabled. Such errors include: s3c2440-sdi s3c2440-sdi: s3cmci_request: no medium present Signed-off-by: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-14Merge branch 's3c-move' into develRussell King
Conflicts: arch/arm/mach-versatile/core.c
2008-10-14Merge branch 'omap-all' into develRussell King
Conflicts: arch/arm/mach-omap2/gpmc.c arch/arm/mach-omap2/irq.c
2008-10-14mmc_block: tell block layer there is no seek penaltyPierre Ossman
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-13Merge branch 'master' of ↵David Woodhouse
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 Conflicts: include/asm-x86/statfs.h
2008-10-12Merge branch 'for-linus' of ↵Linus Torvalds
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: (24 commits) MMC: Use timeout values from CSR MMC: CSD and CID timeout values sdhci: 'scratch' may be used uninitialized mmc: explicitly mention SDIO support in Kconfig mmc: remove redundant "depends on" Fix comment in include/linux/mmc/host.h sdio: high-speed support mmc_block: hard code 512 byte block size sdhci: force high speed capability on some controllers mmc_block: filter out PC requests mmc_block: indicate strict ordering mmc_block: inform block layer about sector count restriction sdio: give sdio irq thread a host specific name sdio: make sleep on error interruptable sdhci: reduce card detection delay sdhci: let the controller wait for busy state to end atmel-mci: Add missing flush_dcache_page() in PIO transfer code atmel-mci: Don't overwrite error bits when NOTBUSY is set atmel-mci: Add experimental DMA support atmel-mci: support multiple mmc slots ...
2008-10-12Merge branch 'master' of ↵Pierre Ossman
git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/atmel-mci-2.6.28 Conflicts: drivers/mmc/host/atmel-mci.c
2008-10-12MMC: Use timeout values from CSRMatthew Fleming
Hard-coded timeout values of 250ms for writes and 100ms for reads are currently used for MMC transactions over SPI. The spec states that the timeout values from the card should be used. Signed-off-by: Matthew Fleming <matthew.fleming@imgtec.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12MMC: CSD and CID timeout valuesMatthew Fleming
The MMC spec states that the timeout for accessing the CSD and CID registers is 64 clock cycles. Signed-off-by: Matthew Fleming <matthew.fleming@imgtec.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12sdhci: 'scratch' may be used uninitializedSteven Noonan
The variable 'scratch' is always initialized before it's used. The conditional which is responsible for initialization of 'scratch' will always evaluate 'true' when the first loop iteration occurs, and thus, it's properly initialized. GCC doesn't see this, of course, so using the uninitialized_var() macro seems to work for silencing this case. Signed-off-by: Steven Noonan <steven@uplinklabs.net> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12mmc: explicitly mention SDIO support in KconfigPierre Ossman
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12mmc: remove redundant "depends on"Pierre Ossman
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12sdio: high-speed supportPierre Ossman
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12mmc_block: hard code 512 byte block sizePierre Ossman
We use 512 byte blocks on all cards, and newer cards support nothing else, so hard code it and make the code less complex. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12sdhci: force high speed capability on some controllersPierre Ossman
Some high speed capable controllers forget to set the high speed capability bit. Make sure we enable the functionality anyway. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12mmc_block: filter out PC requestsPierre Ossman
We do not support PC (SCSI) commands, so don't pretend we do by letting them through. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12mmc_block: indicate strict orderingPierre Ossman
The MMC block driver services requests one at a time and in strict order. Indicate this to the block layer so that it can handle barriers in an efficient manner. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12mmc_block: inform block layer about sector count restrictionPierre Ossman
Make sure we consider the maximum block count when we tell the block layer about the maximum sector count. That way we don't have to chop up the request ourselves. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12sdio: give sdio irq thread a host specific namePierre Ossman
There is one thread per host controller so make sure they all get unique names. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12sdio: make sleep on error interruptablePierre Ossman
Make sure we can be woken from the forced sleep that is done on errors. Removing a card often results in -ENOMEDIUM or -EILSEQ so we previously locked up the removal process for a second. We could completely exit on -ENOMEDIUM, but it might be a transient glitch so treat it like any other error. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12sdhci: reduce card detection delayPierre Ossman
The card detection delay was added early when the behaviour of the card interrupt was still very much unknown (i.e. before there was a public specification). As it is now known that it is a debounced signal, reduce the delay to something more sensible. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-12sdhci: let the controller wait for busy state to endPierre Ossman
The sdhci controllers can interrupt us when the busy state from the card has ended, saving CPU cycles and power. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-10-11Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-armLinus Torvalds
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (236 commits) [ARM] 5300/1: fixup spitz reset during boot [ARM] 5295/1: make ZONE_DMA optional [ARM] 5239/1: Palm Zire 72 power management support [ARM] 5298/1: Drop desc_handle_irq() [ARM] 5297/1: [KS8695] Fix two compile-time warnings [ARM] 5296/1: [KS8695] Replace macro's with trailing underscores. [ARM] pxa: allow multi-machine PCMCIA builds [ARM] pxa: add preliminary CPUFREQ support for PXA3xx [ARM] pxa: add missing ACCR bit definitions to pxa3xx-regs.h [ARM] pxa: rename cpu-pxa.c to cpufreq-pxa2xx.c [ARM] pxa/zylonite: add support for USB OHCI [ARM] ohci-pxa27x: use ioremap() and offset for register access [ARM] ohci-pxa27x: introduce pxa27x_clear_otgph() [ARM] ohci-pxa27x: use platform_get_{irq,resource} for the resource [ARM] ohci-pxa27x: move OHCI controller specific registers into the driver [ARM] ohci-pxa27x: introduce flags to avoid direct access to OHCI registers [ARM] pxa: move I2S register and bit definitions into pxa2xx-i2s.c [ARM] pxa: simplify DMA register definitions [ARM] pxa: make additional DCSR bits valid for PXA3xx [ARM] pxa: move i2c register and bit definitions into i2c-pxa.c ... Fixed up conflicts in arch/arm/mach-versatile/core.c sound/soc/pxa/pxa2xx-ac97.c sound/soc/pxa/pxa2xx-i2s.c manually.
2008-10-10Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6Linus Torvalds
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (37 commits) [SCSI] zfcp: fix double dbf id usage [SCSI] zfcp: wait on SCSI work to be finished before proceeding with init dev [SCSI] zfcp: fix erp list usage without using locks [SCSI] zfcp: prevent fc_remote_port_delete calls for unregistered rport [SCSI] zfcp: fix deadlock caused by shared work queue tasks [SCSI] zfcp: put threshold data in hba trace [SCSI] zfcp: Simplify zfcp data structures [SCSI] zfcp: Simplify get_adapter_by_busid [SCSI] zfcp: remove all typedefs and replace them with standards [SCSI] zfcp: attach and release SAN nameserver port on demand [SCSI] zfcp: remove unused references, declarations and flags [SCSI] zfcp: Update message with input from review [SCSI] zfcp: add queue_full sysfs attribute [SCSI] scsi_dh: suppress comparison warning [SCSI] scsi_dh: add Dell product information into rdac device handler [SCSI] qla2xxx: remove the unused SCSI_QLOGIC_FC_FIRMWARE option [SCSI] qla2xxx: fix printk format warnings [SCSI] qla2xxx: Update version number to 8.02.01-k8. [SCSI] qla2xxx: Ignore payload reserved-bits during RSCN processing. [SCSI] qla2xxx: Additional residual-count corrections during UNDERRUN handling. ...
2008-10-09block: don't depend on consecutive minor spaceTejun Heo
* Implement disk_devt() and part_devt() and use them to directly access devt instead of computing it from ->major and ->first_minor. Note that all references to ->major and ->first_minor outside of block layer is used to determine devt of the disk (the part0) and as ->major and ->first_minor will continue to represent devt for the disk, converting these users aren't strictly necessary. However, convert them for consistency. * Implement disk_max_parts() to avoid directly deferencing genhd->minors. * Update bdget_disk() such that it doesn't assume consecutive minor space. * Move devt computation from register_disk() to add_disk() and make it the only one (all other usages use the initially determined value). These changes clean up the code and will help disk->part dereference fix and extended block device numbers. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2008-10-07Merge branches 'pxa-core' and 'pxa-machines' into pxa-allRussell King
Conflicts: arch/arm/mach-pxa/Kconfig arch/arm/mach-pxa/pxa25x.c arch/arm/mach-pxa/pxa27x.c
2008-10-06atmel-mci: Initialize BLKR before sending data transfer commandHaavard Skinnemoen
The atmel-mci driver sometimes fails data transfers like this: mmcblk0: error -5 transferring data end_request: I/O error, dev mmcblk0, sector 2749769 end_request: I/O error, dev mmcblk0, sector 2749777 It turns out that this might be caused by the BLKR register (which contains the block size and the number of blocks being transfered) being initialized too late. This patch moves the initialization of BLKR so that it contains the correct value before the block transfer command is sent. This error is difficult to reproduce, but if you insert a long delay (mdelay(10) or thereabouts) between the calls to atmci_start_command() and atmci_submit_data(), all transfers seem to fail without this patch, while I haven't seen any failures with this patch. Reported-by: Hein_Tibosch <hein_tibosch@yahoo.es> Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-05atmel-mci: Add missing flush_dcache_page() in PIO transfer codeHaavard Skinnemoen
Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2008-10-05atmel-mci: Don't overwrite error bits when NOTBUSY is setHaavard Skinnemoen
After a data error, we wait for the NOTBUSY bit to be set so that we can be sure the data transfer is completely finished. However, when NOTBUSY is set, the interrupt handler copies the contents of SR into data_status, overwriting any error bits we may have detected earlier. To avoid this, initialize data_status to 0 before starting a request, and don't overwrite it unless it still contains 0. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2008-10-05atmel-mci: Add experimental DMA supportHaavard Skinnemoen
This adds support for DMA transfers through the generic DMA engine framework with the DMA slave extensions. The driver has been tested using mmc-block and ext3fs on several SD, SDHC and MMC+ cards. Reads and writes work fine, with read transfer rates up to 7.5 MiB/s on fast cards with debugging disabled. Unfortunately, the driver has been known to lock up from time to time with DMA enabled, so DMA support is currently optional and marked EXPERIMENTAL. However, I didn't see any problems while testing 13 different cards (MMC, SD and SDHC of different brands and sizes), so I suspect the "Initialize BLKR before sending data transfer command" fix that was posted earlier fixed this as well. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2008-10-05atmel-mci: support multiple mmc slotsHaavard Skinnemoen
The Atmel MCI controller can drive multiple cards through separate sets of pins, but only one at a time. This patch adds support for multiplexing access to the controller so that multiple card slots can be used as if they were hooked up to separate mmc controllers. The atmel-mci driver registers each slot as a separate mmc_host. Both access the same common controller state, but they also have some state on their own for card detection/write protect handling, and separate shadows of the MR and SDCR registers. When one of the slots receives a request from the mmc core, the common controller state is checked. If it's idle, the request is submitted immediately. If not, the request is added to a queue. When a request is done, the queue is checked and if there is a queued request, it is submitted before the completion callback is called. This patch also includes a few cleanups and fixes, including a locking overhaul. I had to change the locking extensively in any case, so I might as well try to get it right. The driver no longer takes any irq-safe locks, which may or may not improve the overall system performance. This patch also adds a bit of documentation of the internal data structures. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2008-10-05atmel-mci: Platform code for supporting multiple mmc slotsHaavard Skinnemoen
Add the necessary platform infrastructure to support multiple mmc/sdcard slots all at once through a single controller. Currently, the driver will use the first valid slot it finds and stick with that, but later patches will add support for switching between several slots on the fly. Extend the platform data structure with per-slot information: MMC/SDcard bus width and card detect/write protect pins. This will affect the pin muxing as well as the capabilities announced to the mmc core. Note that board code is now required to supply a mci_platform_data struct to at32_add_device_mci(). Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2008-10-05atmel-mci: Don't stop the clock between transfersHaavard Skinnemoen
Some cards might get upset if we turn off the clock for extended periods of time. So keep the clock running until the mmc core tells us to turn it off. Also, don't reset the controller between each transfer. That was an attempt to work around earlier bugs, and it never really worked very well. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2008-10-05atmel-mci: Implement tasklet as a state machineHaavard Skinnemoen
With the current system of completed/pending events, things may get handled in different order depending on which event triggers first. For example, if the data transfer is complete before the command, the stop command must be sent after the command is complete, not the data. This creates a bit of complexity around the stop command. By having the tasklet go through a sequence of clearly defined states, things always happen in a certain order even if the events come at different times, so the stop command can simply be sent when we exit the "sending data" state because we will never enter that state before the command has been sent successfully. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2008-10-05atmel-mci: Initialize BLKR before sending data transfer commandHaavard Skinnemoen
The atmel-mci driver sometimes fails data transfers like this: mmcblk0: error -5 transferring data end_request: I/O error, dev mmcblk0, sector 2749769 end_request: I/O error, dev mmcblk0, sector 2749777 It turns out that this might be caused by the BLKR register (which contains the block size and the number of blocks being transfered) being initialized too late. This patch moves the initialization of BLKR so that it contains the correct value before the block transfer command is sent. This error is difficult to reproduce, but if you insert a long delay (mdelay(10) or thereabouts) between the calls to atmci_start_command() and atmci_submit_data(), all transfers seem to fail without this patch, while I haven't seen any failures with this patch. Reported-by: Hein_Tibosch <hein_tibosch@yahoo.es> Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
2008-10-03[SCSI] mmc_block: use generic helper to print capacitiesPierre Ossman
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-09-25[ARM] pxa: make cpu_is_pxa2* macros more consistentEric Miao
1. add a CPUID table in the comment 2. make cpu_is_pxa25x() true for PXA210/250/255/26x 3. PXA210 is treated as PXA25x, all related code modified to reflect this Signed-off-by: Eric Miao <eric.miao@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-09-21Merge branch 'for-linus' of ↵Linus Torvalds
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_test: initialize mmc_test_lock statically mmc_block: handle error from mmc_register_driver() atmel-mci: Set MMC_CAP_NEEDS_POLL if no detect_pin atmel-mci: Fix bogus debugfs file size atmel-mci: Fix memory leak in atmci_regs_show atmel-mci: debugfs: enable clock before dumping regs tmio_mmc: fix compilation with debug enabled
2008-09-20mmc_test: initialize mmc_test_lock staticallyAkinobu Mita
The mutex mmc_test_lock is initialized at every time mmc_test device is probed. Probing another mmc_test device may break the mutex, if the probe function is called while the mutex is locked. This patch fixes it by statically initializing mmc_test_lock. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-09-20mmc_block: handle error from mmc_register_driver()Akinobu Mita
Check error from mmc_register_driver() and properly unwind block device registration. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-09-20atmel-mci: Set MMC_CAP_NEEDS_POLL if no detect_pinHaavard Skinnemoen
This allows the mmc core to detect card insertion/removal for slots that don't have any CD pin wired up. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>