aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc/mmc_block.c
AgeCommit message (Collapse)Author
2007-05-01mmc: Move queue functions to mmc_blockPierre Ossman
The mmc block queue functions are tailored for the mmc_block driver, so move those functions into that module. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01mmc: MMC sector based cardsPierre Ossman
Support for MMC 4.2 sector based cards. This tweaks the init a bit and reads a new field out of the EXT_CSD. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01mmc: cull sg list to match mmc request sizeAlex Dubov
mmc layer may introduce additional (compared to block layer) limits on request size. Culling of the sg list to match adjusted request size simplifies the handling of such cases in the low level driver, allowing it to skip block count checks while processing sg entries. (fixes for wbsd and sdhci by Pierre Ossman) Signed-off-by: Alex Dubov <oakad@yahoo.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-14[PATCH] remove many unneeded #includes of sched.hTim Schmielau
After Al Viro (finally) succeeded in removing the sched.h #include in module.h recently, it makes sense again to remove other superfluous sched.h includes. There are quite a lot of files which include it but don't actually need anything defined in there. Presumably these includes were once needed for macros that used to live in sched.h, but moved to other header files in the course of cleaning it up. To ease the pain, this time I did not fiddle with any header files and only removed #includes from .c-files, which tend to cause less trouble. Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha, arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig, allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all configs in arch/arm/configs on arm. I also checked that no new warnings were introduced by the patch (actually, some warnings are removed that were emitted by unnecessarily included header files). Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-04mmc: Proper unclaim in mmc_blockPierre Ossman
Make sure we release the claim on the host even on failure. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04mmc: Allow host drivers to specify max block countPierre Ossman
Many controllers have an upper limit on the number of blocks that can be transferred in one request. Allow the host drivers to specify this and make sure we avoid hitting this limit. Also change the max_sectors field to avoid confusion. This makes it map less directly to the block layer limits, but as they didn't apply directly on MMC cards anyway, this isn't a great loss. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04mmc: Add support for SDHC cardsPhilip Langdale
Thanks to the generous donation of an SDHC card by John Gilmore, and the surprisingly enlightened decision by the SD Card Association to publish useful specs, I've been able to bash out support for SDHC. The changes are not too profound: i) Add a card flag indicating the card uses block level addressing and check it in the block driver. As we never took advantage of byte-level addressing, this simply involves skipping the block -> byte translation when sending commands. ii) The layout of the CSD is changed - a set of fields are discarded to make space for a larger C_SIZE. We did not reference any of the discarded fields except those related to the C_SIZE. iii) Read and write timeouts are fixed values and not calculated from CSD values. iv) Before invoking SEND_APP_OP_COND, we must invoke the new SEND_IF_COND to inform the card we support SDHC. Signed-off-by: Philipl Langdale <philipl@overt.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-01mmc: correct request error handlingPierre Ossman
We need to jump to the part of just flushing the request when we cannot claim the bus. Sending commands to a bus we do not own will give unpredictable results. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-01mmc: Flush block queue when removing cardPierre Ossman
After mmc_block's remove function has exited, we must not touch the card structure in any way. This means we not only must remove the gendisk, we must also flush out any remaning requests already queued up. We previously removed the disk, but didn't flush it, causing oops:es when removing a card in the middle of a transfer. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-10-06[PATCH] mmc: multi sector write transfersPierre Ossman
SD cards extend the protocol by allowing the host to query a card how many blocks were successfully stored on the medium. This allows us to safely write chunks of blocks at once. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-04[PATCH] mmc: properly use the new multi block-write error handlingPierre Ossman
Use the new multi block-write error reporting flag and properly tell the block layer how much data was transferred before the error. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-24[MMC] Don't check READY_FOR_DATA when readingRussell King
There's no point checking to see if the card is ready to accept data when we're reading from it - sending the command only wastes precious bus bandwidth. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-09-16[MMC] Add multi block-write capabilityRussell King
Add a capability flag for drivers to set when they can perform multi- block transfers to cards _and_ correctly report the number of bytes transferred should an error occur. The last point is very important - if a driver reports more bytes than were actually accepted by the card and an error occurs, there is the possibility for data loss. Pierre Ossman provided the patch for wbsd and sdhci. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-09-16[MMC] Remove data->blksz_bits memberRussell King
data->blksz_bits is unused now - remove it. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-09-07[MMC] Always use a sector size of 512 bytesPierre Ossman
Both MMC and SD specifications specify (although a bit unclearly in the MMC case) that a sector size of 512 bytes must always be supported by the card. Cards can report larger "native" size than this, and cards >= 2 GB even must do so. Most other readers use 512 bytes even for these cards. We should do the same to be compatible. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-09-07[MMC] Cleanup 385e3227d4d83ab13d7767c4bb3593b0256bf246Russell King
Rather than having two places which independently calculate the timeout for data transfers, make it a library function instead. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Pierre Ossman <drzeus@drzeus.cx>
2006-09-07[MMC] Fix SD timeout calculationPierre Ossman
Secure Digital cards use a different algorithm to calculate the timeout for data transfers. Using the MMC one works often, but not always. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-06-26[PATCH] devfs: Remove the gendisk devfs_name field as it's no longer neededGreg Kroah-Hartman
And remove the now unneeded number field. Also fixes all drivers that set these fields. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26[PATCH] devfs: Remove the devfs_fs_kernel.h file from the treeGreg Kroah-Hartman
Also fixes up all files that #include it. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26[PATCH] devfs: Remove devfs_remove() function from the kernel treeGreg Kroah-Hartman
Removes the devfs_remove() function and all callers of it. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-26[PATCH] devfs: Remove devfs_mk_dir() function from the kernel treeGreg Kroah-Hartman
Removes the devfs_mk_dir() function and all callers of it. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-05-24[MMC] Fix premature use of md->diskPierre Ossman
md->disk was being used in a debug message before it was allocated. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-05-19[ARM] 3531/1: i.MX/MX1 SD/MMC ensure, that clock are stopped before new ↵Pavel Pisa
command and cleanups Patch from Pavel Pisa There has been problems that for some paths that clock are not stopped during new command programming and initiation. Result is issuing of incorrect command to the card. Some other problems are cleaned too. Noisy report of known ERRATUM #4 has been suppressed. Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-05-02[MMC] extend data timeout for writesRussell King
The CSD contains a "read2write factor" which determines the multiplier to be applied to the read timeout to obtain the write timeout. We were ignoring this parameter, resulting in the possibility for writes being timed out too early. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-02-02[MMC] Add MMC command type flagsRussell King
Some hosts need to know the command type, so pass it via a set of flags in cmd->flags. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-01-13[MMC] mmc_blk_probe() warning fixAndrew Morton
drivers/mmc/mmc_block.c: In function `mmc_blk_probe': drivers/mmc/mmc_block.c:467: warning: long unsigned int format, different type arg (arg 5) We don't know what size sector_t is - cast it. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-01-12[MMC+MFD] Convert mmc to mutexesArjan van de Ven
convert mfd and mmc to mutexes Signed-off-by: Arjan van de Ven <arjan@infradead.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-01-09Merge master.kernel.org:/home/rmk/linux-2.6-mmcLinus Torvalds
2006-01-09[MMC] Add DATA_MULTI flagRussell King
Some hosts need to know that a transfer will be multi-block. Add a data flag to indicate multiple data block transfers. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-01-08[PATCH] Add block_device_operations.getgeo block device methodChristoph Hellwig
HDIO_GETGEO is implemented in most block drivers, and all of them have to duplicate the code to copy the structure to userspace, as well as getting the start sector. This patch moves that to common code [1] and adds a ->getgeo method to fill out the raw kernel hd_geometry structure. For many drivers this means ->ioctl can go away now. [1] the s390 block drivers are odd in this respect. xpram sets ->start to 4 always which seems more than odd, and the dasd driver shifts the start offset around, probably because of it's non-standard sector size. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Jens Axboe <axboe@suse.de> Cc: <mike.miller@hp.com> Cc: Jeff Dike <jdike@addtoit.com> Cc: Paolo Giarrusso <blaisorblade@yahoo.it> Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl> Cc: Neil Brown <neilb@cse.unsw.edu.au> Cc: Markus Lidel <Markus.Lidel@shadowconnect.com> Cc: Russell King <rmk@arm.linux.org.uk> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: James Bottomley <James.Bottomley@steeleye.com> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-07Merge master.kernel.org:/home/rmk/linux-2.6-mmcLinus Torvalds
2006-01-06[BLOCK] add @uptodate to end_that_request_last() and @error to rq_end_io_fn()Tejun Heo
add @uptodate argument to end_that_request_last() and @error to rq_end_io_fn(). there's no generic way to pass error code to request completion function, making generic error handling of non-fs request difficult (rq->errors is driver-specific and each driver uses it differently). this patch adds @uptodate to end_that_request_last() and @error to rq_end_io_fn(). for fs requests, this doesn't really matter, so just using the same uptodate argument used in the last call to end_that_request_first() should suffice. imho, this can also help the generic command-carrying request jens is working on. Signed-off-by: tejun heo <htejun@gmail.com> Signed-Off-By: Jens Axboe <axboe@suse.de>
2006-01-03[MMC] Improve MMC card block size selectionRussell King
Select a block size for IO based on the read and write block size combinations, and whether the card supports partial block reads and/or partial block writes. If we are able to satisfy block reads but not block writes, mark the device read only. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-12-22[MMC] Set correct capacity for 1024-byte block cardsRussell King
We were passing set_capacity() the capacity we calculated in terms of the number of blocks on the card, which happened to be the right units for 512-byte block cards. However, with 1024-byte block cards, we end up setting the capacity to half the number of blocks. Fix this by shifting by the appropriate amount. Thanks to Todd Blumer for pointing this out. Use get_capacity() to report the card capacity, rather than recalculating it from the CSD information. Finally, use our chosen IO block size for the SET_BLOCKLEN command rather than the CSD read block size. Currently these are equivalent, but will not be in the future. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-11-04[MMC] Response to write commands is R1 nor R1bRussell King
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-10-30[MMC] Use command class to determine read-only statusPierre Ossman
If a card doesn't support the "write block" command class then any attempts to open the device should reflect this by denying write access. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-09-07[PATCH] sd: read-only switchPierre Ossman
Support for the read-only switch on SD cards which must be enforced by the host. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Cc: Russell King <rmk@arm.linux.org.uk> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-21[PATCH] MMC: Proper MMC command classes supportPierre Ossman
Defines for the different command classes as defined in the MMC and SD specifications. Removes the check for high command classes and instead checks that the command classes needed are present. Previous solution killed forward compatibility at no apparent gain. Signed-of-by: Pierre Ossman
2005-04-16Linux-2.6.12-rc2Linus Torvalds
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!