aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc/host/sdhci.c
AgeCommit message (Collapse)Author
2008-08-01sdhci: check correct return valuePierre Ossman
Fix a copy-and-paste error. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-08-01sdhci: disable DMA for req, not completelyPierre Ossman
The wrong flag was manipulated when an invalid sg list was given, turning off DMA on the next (and all subsequent) request instead of the current one. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-08-01sdhci: handle bug in JMB38x for sizes < 4 bytesPierre Ossman
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-26dma-mapping: add the device argument to dma_mapping_error()FUJITA Tomonori
Add per-device dma_mapping_ops support for CONFIG_X86_64 as POWER architecture does: This enables us to cleanly fix the Calgary IOMMU issue that some devices are not behind the IOMMU (http://lkml.org/lkml/2008/5/8/423). I think that per-device dma_mapping_ops support would be also helpful for KVM people to support PCI passthrough but Andi thinks that this makes it difficult to support the PCI passthrough (see the above thread). So I CC'ed this to KVM camp. Comments are appreciated. A pointer to dma_mapping_ops to struct dev_archdata is added. If the pointer is non NULL, DMA operations in asm/dma-mapping.h use it. If it's NULL, the system-wide dma_ops pointer is used as before. If it's useful for KVM people, I plan to implement a mechanism to register a hook called when a new pci (or dma capable) device is created (it works with hot plugging). It enables IOMMUs to set up an appropriate dma_mapping_ops per device. The major obstacle is that dma_mapping_error doesn't take a pointer to the device unlike other DMA operations. So x86 can't have dma_mapping_ops per device. Note all the POWER IOMMUs use the same dma_mapping_error function so this is not a problem for POWER but x86 IOMMUs use different dma_mapping_error functions. The first patch adds the device argument to dma_mapping_error. The patch is trivial but large since it touches lots of drivers and dma-mapping.h in all the architecture. This patch: dma_mapping_error() doesn't take a pointer to the device unlike other DMA operations. So we can't have dma_mapping_ops per device. Note that POWER already has dma_mapping_ops per device but all the POWER IOMMUs use the same dma_mapping_error function. x86 IOMMUs use device argument. [akpm@linux-foundation.org: fix sge] [akpm@linux-foundation.org: fix svc_rdma] [akpm@linux-foundation.org: build fix] [akpm@linux-foundation.org: fix bnx2x] [akpm@linux-foundation.org: fix s2io] [akpm@linux-foundation.org: fix pasemi_mac] [akpm@linux-foundation.org: fix sdhci] [akpm@linux-foundation.org: build fix] [akpm@linux-foundation.org: fix sparc] [akpm@linux-foundation.org: fix ibmvscsi] Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Cc: Muli Ben-Yehuda <muli@il.ibm.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: Avi Kivity <avi@qumranet.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-23sdhci: highmem capable PIO routinesPierre Ossman
Improve the PIO handling so that it can service highmem pages. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-23sdhci: fix bad warning from commit c8b3e02Pierre Ossman
Commit c8b3e02 renamed a variable, but missed one reference to it inside a WARN_ON, causing it to incorrectly trigger. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-23sdhci: add warnings for bad buffers in ADMA pathPierre Ossman
The ADMA code path assumes that the 3 byte alignment fix doesn't cross a page boundary. I'm not convinced this is worth supporting, but at least print a warning in the off chance we'll actually see such a request. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: OLPC: update vdd/powerup quirk commentAndres Salomon
This comment update got lost in the great floo^Wmerge. As Pierre pointed out, no one knows what 'CaFe' is. Signed-off-by: Andres Salomon <dilinger@debian.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15mmc: fix spares errors of sdhci.cTomas Winkler
1. sdhci_prepare_data: fix shadowing of count variable u8 count int count -> sg_cnt; 2. sdhci_add_host: assignment of integer to pointer dma_mask = 0 -> dma_mask = NULL; Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15sdhci: graceful handling of bad addressesPierre Ossman
Be a bit more robust and fall back to PIO if someone is feeding us bogus addresses. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15sdhci: scatter-gather (ADMA) supportPierre Ossman
Add support for the scatter-gather DMA mode present on newer controllers. As the mode requires 32-bit alignment, non-aligned chunks are handled by using a bounce buffer. Also add some new quirks to handle controllers that have bugs in the ADMA engine. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15sdhci: handle hot-removePierre Ossman
Gracefully handle when the device is suddenly removed. Do a test read and avoid any further access if that read returns -1. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15sdhci: make workaround for timeout bug more generalPierre Ossman
Give the quirk for broken timeout handling a better chance of handling more controllers by simply classifying the system as broken and setting a fixed value. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15sdhci: move pci stuff to separate modulePierre Ossman
The SDHCI interface is not PCI specific, yet the Linux driver was intimitely connected to the PCI bus. This patch properly separates the PCI specific portion from the bus independent code. This patch is based on work by Ben Dooks but he did not have time to complete it. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15sdhci: don't check block count for progressPierre Ossman
The specification is insufficiently strict when it comes to how the hardware should update the block count register, making it useless for checking transfer progress. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-04mmc: don't use DMA on newer ENE controllersPierre Ossman
Even the newer ENE controllers have bugs in their DMA engine that make it too dangerous to use. Disable it until someone has figured out under which conditions it corrupts data. This has caused problems at least once, and can be found as bug report 10925 in the kernel bugzilla. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-04olpc: sdhci: add quirk for the Marvell CaFe's interrupt timeoutAndres Salomon
The CaFe chip has a hardware bug that ends up with us getting a timeout value that's too small, causing the following sorts of problems: [ 60.525138] mmcblk0: error -110 transferring data [ 60.531477] end_request: I/O error, dev mmcblk0, sector 1484353 [ 60.533371] Buffer I/O error on device mmcblk0p2, logical block 181632 [ 60.533371] lost page write due to I/O error on mmcblk0p2 Presumably this is an off-by-one error in the hardware. Incrementing the timeout count value that we stuff into the TIMEOUT_CONTROL register gets us a value that works. This bug was originally discovered by Pierre Ossman, I believe. [thanks to Robert Millan for proving that this was still a problem] Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: Pierre Ossman <drzeus-list@drzeus.cx> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-04olpc: sdhci: add quirk for the Marvell CaFe's vdd/powerup issueAndres Salomon
This has been sitting around unloved for way too long.. The Marvell CaFe chip's SD implementation chokes during card insertion if one attempts to set the voltage and power up in the same SDHCI_POWER_CONTROL register write. This adds a quirk that does that particular dance in two steps. It also adds an entry to pci_ids.h for the CaFe chip's SD device. Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: Pierre Ossman <drzeus-list@drzeus.cx> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-18sdhci: improve no card, no reset quirkPierre Ossman
The quirk was meant to just inhibit some resets, but ended up blocking all of them. Fortunately, this was just what was needed. Change the comment to reflect reality. Also, this issue has just been observed on Samsung laptops, so reduce the number of chips the quirk affects. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-04-18sdhci: allow led to be controlled freelyPierre Ossman
Hook up the controller LED to the LED subsystem, allowing more flexible control than simply indicating an ongoing request. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-04-18sdhci: remove custom controller namePierre Ossman
Remove the use of the sdhci specific device name and use the mmc controller name instead. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-02-08sdhci: add num index for multi controllers caseFeng Tang
Some devices have several controllers; need add the index info to device slot name host->slot_desc[] Signed-off-by: Feng Tang <feng.tang@intel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-12-12sdhci: support JMicron JMB38x chipsPierre Ossman
The JMicron JMB38x chip doesn't support transfers that aren't 32-bit aligned (both size and start address). It also doesn't like switching between PIO and DMA mode, so it needs to be reset after each request. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-12-12sdhci: use PIO when DMA can't satisfy the requestPierre Ossman
Some controllers have been designed on the assumption that all transfers will be 32-bit aligned, both in start address and in size. This is not a guarantee the SDHCI specification provides and not one we can provide. Revert back to PIO for individual requests in order to work around the hardware bug. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-12-12sdhci: don't warn about sdhci 2.0 controllersPierre Ossman
We support 2.0 controllers, even though we don't use anything in the new feature set. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-12-12sdhci: describe quirksPierre Ossman
Add a comment for each quirk to describe what it does and why. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-11-10Add missing "\n" to log messageRolf Eike Beer
Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-10-24mmc: sg falloutJens Axboe
Do a full scan of the directory to try and be a bit more proactive, instead of waiting for things to break. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-23[PATCH] Fix breakage after SG cleanupsRalf Baechle
Commits 58b053e4ce9d2fc3023645c1b96e537c72aa8d9a ("Update arch/ to use sg helpers") 45711f1af6eff1a6d010703b4862e0d2b9afd056 ("[SG] Update drivers to use sg helpers") fa05f1286be25a8ce915c5dd492aea61126b3f33 ("Update net/ to use sg helpers") converted many files to use the scatter gather helpers without ensuring that the necessary headerfile <linux/scatterlist> is included. This happened to work for ia64, powerpc, sparc64 and x86 because they happened to drag in that file via their <asm/dma-mapping.h>. On most of the others this probably broke. Instead of increasing the header file spider web I choose to include <linux/scatterlist.h> directly into the affectes files. Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-22[SG] Update drivers to use sg helpersJens Axboe
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-10-03sdhci: remove old dma module paramsPierre Ossman
The forcedma and nodma module parameters can be replaced with the quirks parameter, so remove the redundancy. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-10-03sdhci: add SDHCI_QUIRK_BROKEN_DMA quirkFeng Tang
Some controllers like ENE712 can't work properly with DMA mode, add this quirk to force these kinds of HW work with PIO mode Signed-off-by: Feng Tang <feng.tang@intel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-10-03sdhci: remove DMA capability check from controller's PCI Class regFeng Tang
Many host controllers don't fully follow the PCI spec to claim whether they support DMA in PCI class register. Leave the driver to judge it from the Capability register, quirks and module parameter Signed-off-by: Feng Tang <feng.tang@intel.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-10-03sdhci: fix a typoNicolas Pitre
Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23sdhci: sdio interrupt supportPierre Ossman
Add support for relaying the sdio interrupt signal from the card. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23mmc: remove BYTEBLOCK capabilityPierre Ossman
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 Ossman
Convert the MMC layer to use standard error codes and not its own, incompatible values. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23sdhci: tell which spurious interrupt we gotPierre Ossman
When we get unexpected interrupts, also print which interrupt it was. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23sdhci: handle data interrupts during commandPierre Ossman
It is fully legal for a controller to start issuing data related interrupts before it has signalled that the command has completed. Make sure the driver actually can handle this. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23mmc: ignore bad max block size in sdhciDavid Vrabel
Some SDHC cards report an invalid maximum block size, in these cases assume they support block sizes up to 512 bytes instead of returning an error. Signed-off-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23sdhci: be more cautious about block count registerPierre Ossman
The block count register shouldn't be trusted for single block transfers, so avoid using it completely when calculating transferred bytes. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26mmc: remove redundant debug information from sdhci and wbsdPierre Ossman
Remove the extra debugging output that now is properly printed by the core. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26mmc: update header file pathsPierre Ossman
Make sure all headers in the files reflect their true position in the tree. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26sdhci: add support to ENE-CB714Leandro Dorileo
Added its pci_id and implemented a quirk for it because this controller needs to reset cmd and data when setting ios. Signed-off-by: Leandro Dorileo <dorileo@ossystems.com.br> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26mmc: check error bits before command completionPierre Ossman
Some controllers signal "command complete" even on failures (which they are allowed to do according to the spec). Make sure we check the error bits first so we don't get any false positives. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-20sdhci: make sure to clear the error interruptPierre Ossman
The controller has a bit indicating that one of the higher bits (the error bits) are set. A previous bug caused this bit to be masked, but since that bug has been fixed we have to clear it explicictly. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09sdhci: Fix "Unexpected interrupt" handlingRolf Eike Beer
Whenever a power interrupt is signaled it is also reported as an unexpected one. All other unexpected interrupts get lost. Cause is a not inversed bitmask to remove power interrupts from the status. Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-09sdhci: add ene controller idMilko Krachounov
ENE has a very weird design where an SDHCI device (0805) is presented on the PCI bus, but that device is non-functional, and the real device is hidden as a more generic device. Signed-off-by: Milko Krachounov <milko@3mhz.net> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-14sdhci: handle dma boundary interruptsPierre Ossman
When the device hits certain memory boundaries, it signals an interrupt and expects to be serviced. We don't need the feature but we need to make sure the device doesn't stall. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01MMC: Fix handling of low-voltage cardsPhilip Langdale
Fix handling of low voltage MMC cards. The latest MMC and SD specs both agree that support for low-voltage operations is indicated by bit 7 in the OCR. The MMC spec states that the low voltage range is 1.65-1.95V while the SD spec leaves the actual voltage range undefined - meaning that there is still no such thing as a low voltage SD card. However, an old Sandisk spec implied that bits 7.0 represented voltages below 2.0V in 1V or 0.5V increments, and the code was accordingly written with that expectation. This confusion meant that host drivers attempting to support the typical low voltage (1.8V) would set the wrong bits in the host OCR mask (usually bits 5 and/or 6) resulting in the the low voltage mode never being used. This change corrects the low voltage range and adds sanity checks on the reserved bits (0-6) and for SD cards that claim to support low-voltage operations. Signed-off-by: Philip Langdale <philipl@overt.org> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>