summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/at91_mci.c
AgeCommit message (Collapse)AuthorFilesLines
2008-12-01mmc: at91_mci: reorder timer setup and mmc_add_host() callNicolas Ferre1-2/+2
As said in function comment mmc_add_host() requires that: "The host must be prepared to start servicing requests before this function completes." During this function, at91_mci_request() can be invoqued without timer beeing setup leading to a kernel Oops. This has been reported inserting this driver as a module. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Reported-by: Wu Xuan <wux@landicorp.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-09-03mmc: at91_mci: don't use coherent dma buffersDavid Brownell1-4/+16
At91_mci is abusing dma_free_coherent(), which may not be called with IRQs disabled. I saw "mkfs.ext3" on an MMC card objecting voluminously as each write completed: WARNING: at arch/arm/mm/consistent.c:368 dma_free_coherent+0x2c/0x224() [<c002726c>] (dump_stack+0x0/0x14) from [<c00387d4>] (warn_on_slowpath+0x4c/0x68) [<c0038788>] (warn_on_slowpath+0x0/0x68) from [<c0028768>] (dma_free_coherent+0x2c/0x224) r6:00008008 r5:ffc06000 r4:00000000 [<c002873c>] (dma_free_coherent+0x0/0x224) from [<c01918ac>] (at91_mci_irq+0x374/0x420) [<c0191538>] (at91_mci_irq+0x0/0x420) from [<c0065d9c>] (handle_IRQ_event+0x2c/0x6c) ... This bug has been around for a LONG time. The MM warning is from late 2005, but the driver merged a year later ... so I'm puzzled why nobody noticed this before now. The fix involves noting that this buffer shouldn't be DMA-coherent; it's just used for normal DMA writes. So replace it with standard kmalloc() buffering and DMA mapping calls. This is the quickie fix. A better one would not rely on allocating large bounce buffers. (Note that dma_alloc_coherent could have failed too, but that case was ignored... kmalloc is a bit more likely to fail though.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Pierre Ossman <drzeus-mmc@drzeus.cx> Cc: Andrew Victor <linux@maxim.org.za> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-08-07[ARM] Move include/asm-arm/arch-* to arch/arm/*/include/machRussell King1-3/+3
This just leaves include/asm-arm/plat-* to deal with. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-07-15mmc: remove multiwrite capabilityPierre Ossman1-1/+1
Relax requirements on host controllers and only require that they do not report a transfer count than is larger than the actual one (i.e. a lower value is okay). This is how many other parts of the kernel behaves so upper layers should already be prepared to handle that scenario. This gives us a performance boost on MMC cards. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15at91_mci: Fix byte mode transitions.Ville Syrjala1-1/+1
The byte mode support fails to clear the byte mode bit in the command register, possibly leaving byte mode enabled with the counters programmed in non-byte mode. Signed-off-by: Ville Syrjala <syrjala@sci.fi> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15at91_mci: Cover more AT91RM9200 and AT91SAM9261 errata.Ville Syrjala1-6/+14
According to the documentation the AT91SAM9261 MCI shares the block size limitations of the AT91RM9200 MCI. Also the errata documentation for AT91RM9200 and AT91SAM9261 state that stream commands are not supported. This has not been tested on actual hardware. Signed-off-by: Ville Syrjala <syrjala@sci.fi> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15at91_mci: AT91SAM9260/9263 12 byte write erratum (v2)Ville Syrjala1-4/+17
AT91SAM926[0/3] PDC must write at least 12 bytes. The code compiles and runs but the actual condition for this erratum did not trigger in my tests so it's unclear if it actually works as intended. Signed-off-by: Ville Syrjala <syrjala@sci.fi> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15at91_mci: manage cmd error and data error independentlyNicolas Ferre1-8/+19
In at91_mci_completed_command() function, this patch distinguishes command error and data error. It reports it in the corresponding error field. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: at91_mci: do not read irq status twice as it will forget some errorsNicolas Ferre1-7/+5
Reading AT91_MCI_SR again at the end of transfer can corrupt the error reporting. Some fields in the SR register are read-and-clear. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: at91_mci: add sdio irq managementEric Benard1-4/+22
Enable SDIO interrupt handling. Signed-off-by: Eric Benard <ebenard@free.fr> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: at91_mci: add multiwrite switchNicolas Ferre1-0/+1
at91_mci is capable of multiwrite. Enable it before it disappears. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: at91_mci: update bytes_xfered value once xfer doneNicolas Ferre1-6/+34
Modify bytes_xfered value after a write. That will report, as accurately as possible, the amount of sectors that are effectively written. This update introduces the check of the busy signal given by the card. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: at91_mci: avoid timeoutsMarc Pignat1-0/+48
The at91 mci controller internal state machine seems to often crash. This can be fixed by resetting the controller after each command for at91rm9200 and by setting the MCI_BLKR register on at91sam926*. Signed-off-by: Marc Pignat <marc.pignat@hevs.ch> Signed-off-by: Hans J Koch <hjk@linutronix.de> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: at91_mci: show timeoutsMarc Pignat1-2/+33
Detect command timeout (or mci controller hangs). Signed-off-by: Marc Pignat <marc.pignat@hevs.ch> Signed-off-by: Hans J Koch <hjk@linutronix.de> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: at91_mci: support for block size not modulo 4Marc Pignat1-5/+10
Implement transfer with size not modulo 4 for at91sam9*. Please note that the at91rm9200 simply can't handle this. Signed-off-by: Marc Pignat <marc.pignat@hevs.ch> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: change .get_ro() callback semanticsAnton Vorontsov1-11/+7
Now get_ro() callback must return 0/1 values for its logical states, and negative errno values in case of error. If particular host instance doesn't support RO/WP switch, it should return -ENOSYS. This patch changes some hosts in two ways: 1. Now functions should be smart to not return negative values in "RO asserted" case (particularly gpio_ calls could return negative values for the outermost GPIOs). Also, board code usually passes get_ro() callbacks that directly return gpioreg & bit result, so at91_mci, imxmmc, pxamci and mmc_spi's get_ro() handlers need take special care when returning platform's values to the mmc core. 2. In case of host instance didn't implement get_ro() callback, it should really return -ENOSYS and let the mmc core decide what to do about it (mmc core thinks the same way as the hosts, so it isn't functional change). Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-05-17at91_mci: minor cleanupMarc Pignat1-1/+4
MMC_POWER_ON is a noop, no need to set the power pin again. Signed-off-by: Marc Pignat <marc.pignat@hevs.ch> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-04-16mmc: fix platform driver hotplug/coldplugKay Sievers1-0/+1
Since 43cc71eed1250755986da4c0f9898f9a635cb3bf, the platform modalias is prefixed with "platform:". Add MODULE_ALIAS() to the hotpluggable MMC host platform drivers, to re-enable auto loading. Also, add missing owner declarations in driver init. [dbrownell@users.sourceforge.net: registration fixes] Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08at91_mci: use generic GPIO callsDavid Brownell1-34/+80
Update the AT91 MMC driver to use the generic GPIO calls instead of the AT91-specific calls; and to request (and release) those GPIO signals. That required updating the probe() fault cleanup codepaths. Now there is a single sequence for freeing resources, in reverse order of their allocation. Also that code uses use dev_*() for messaging, and has less abuse of KERN_ERR. Likewise with updating remove() cleanup. This had to free the GPIOs, and while adding that code I noticed and fixed two other problems: it was poking at a workqueue owned by the mmc core; and in one (rare) case would try freeing an IRQ that it didn't allocate. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-10-22[SG] Update drivers to use sg helpersJens Axboe1-4/+4
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-17mmc: at91_mci: cleanup: use MCI_ERRORSAndrew Victor1-3/+1
A small MMC driver cleanup. Use the defined AT91_MCI_ERRORS in at91_mci_completed_command() instead of specifying all the error bits individually. Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23mmc: at91_mci: disable handling of blocks with size not multiple of 4 bytesMarc Pignat1-0/+8
This kind of transfer is not supported, so don't advertise it and make it fail early. Signed-off-by: Marc Pignat <marc.pignat@hevs.ch> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23mmc: remove confusing flagPierre Ossman1-2/+2
The MMC_DATA_MULTI flag never had a proper definition of what it means, so remove it and let the drivers check the block count in the request. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23mmc: remove BYTEBLOCK capabilityPierre Ossman1-1/+0
Remove the BYTEBLOCK capability and let the broken hosts fail the requests with -EINVAL instead. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23mmc: remove custom error codesPierre Ossman1-7/+5
Convert the MMC layer to use standard error codes and not its own, incompatible values. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-11bug in AT91 MCI suspend routinesAnti Sullin1-3/+3
This patch fixes a bug in AT91 mmc host driver, that enables the wakeup from suspend on card detection pin even if the card detect pin is not available (==0). If not card detection pin is defined, IRQ0 == FIQ gets enabled and if some activity is present on that pin, the system gets a FIQ request, that causes a crash. Signed-off-by: Anti Sullin <anti.sullin@artecdesign.ee> Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-09mmc: at91_mci: remove whitespace at the end of linesNicolas Ferre1-4/+4
Some cleanup with whitespace/tab at the end of lines. Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26mmc: update header file pathsPierre Ossman1-1/+1
Make sure all headers in the files reflect their true position in the tree. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-20mmc: at91_mci: wakeup on card insertion (or removal)Marc Pignat1-1/+12
This piece of code enable the system to be wake-up by a card insertion or removal. Signed-off-by: Marc Pignat <marc.pignat@hevs.ch> Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09mmc: at91_mci: fix hanging and rework to match flowchartsNicolas Ferre1-91/+108
Fixes hanging using multi block operations (seen during CMD25). Follows closely the datasheet flowcharts. This piece of code handles better big file writing. I had to take care of the notbusy signal during write (at91_mci_handle_cmdrdy function) and to rearrange the AT91_MCI_ENDRX and AT91_MCI_RXBUFF flag usage. Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09mmc: at91_mci typoNicolas Ferre1-15/+15
Typo fix in at91_mci driver : standardized the typo (at91_mci everywhere) Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-06-07mmc-atmel: remove linux/mmc/protocol.h dependenciesMarc Pignat1-3/+2
Fix compilation error by removing command decoding from at91_mci.c driver. Decoding commands in the host driver is the wrong way. Signed-off-by: Marc Pignat <marc.pignat@hevs.ch> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01mmc: Move host and card drivers to subdirsPierre Ossman1-0/+1001
Clean up the drivers/mmc directory by moving card and host drivers into subdirectories. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>