summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/tmio_mmc.h
Commit message (Collapse)AuthorAgeFilesLines
* mmc: tmio: fix unbalanced power-on calls with clock-gating enabledGuennadi Liakhovetski2013-06-061-2/+18
| | | | | | | | | | | | | With MMC clock gating enabled the MMC core currently calls MMC host driver's .set_ios() method with .power_mode == MMC_POWER_ON and the clock value set either to 0 or to the target rate. The tmio MMC driver then wrongly translates the latter calls to card slot power-on requests, even when the slot already was on. This patch fixes the driver to avoid needlessly incrementing power-supplying regulator's use count. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: postpone controller reset during resumeGuennadi Liakhovetski2013-06-061-0/+1
| | | | | | | | | | | When resuming, the tmio_mmc_host_resume() function is run when the controller might still be powered down. Issuing a reset command to it at that time has no effect. This patch postpones resetting the controller until the first powering-up .set_ios() call. Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio_mmc: remove unused sdio_irq_enabled flagGuennadi Liakhovetski2012-03-271-1/+0Star
| | | | | | | | | The sdio_irq_enabled member of struct tmio_mmc_host is a left-over from the previously removed SDIO IRQ workaround. It is no longer needed and can now be removed too. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio_mmc: power status flag doesn't have to be exposed in platform dataGuennadi Liakhovetski2012-03-271-0/+3
| | | | | | | | | The controller power status flag does not have to be accessed from the hot-plug detection code any more, it can now be removed from the platform data and put in the controller private struct. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio_mmc: support the generic MMC GPIO card hotplug helperGuennadi Liakhovetski2012-03-271-4/+0Star
| | | | | | | | If the platform specifies the TMIO_MMC_HAS_COLD_CD flag, use the generic MMC GPIO card hotplug helper. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: calculate the native hotplug condition only onceGuennadi Liakhovetski2012-03-271-0/+1
| | | | | | | | | The condition, whether we have to use the native TMIO card hotplug detection interrupt, is rather complex, it is better to only calculate it once and store in the private data. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio_mmc: fix card eject during IO with DMAGuennadi Liakhovetski2012-02-141-1/+6
| | | | | | | | | When DMA is in use and the card is ejected during IO, DMA transfers have to be terminated, otherwise the dmaengine driver fails to operate properly, when the card is re-inserted. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: remove the second argument of k[un]map_atomic()Cong Wang2012-01-121-2/+2
| | | | | | Signed-off-by: Cong Wang <amwang@redhat.com> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: Provide separate interrupt handlersSimon Horman2011-10-261-0/+3
| | | | | | | | | | | | Provide separate interrupt handlers which may be used by platforms where SDHI has three interrupt sources. This patch also removes the commented-out handling of CRC and other errors. Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: Cache interrupt masksSimon Horman2011-10-261-0/+4
| | | | | | | | | | This avoids the need to look up the masks each time an interrupt is handled. As suggested by Guennadi. Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Chris Ball <cjb@laptop.org>
* MMC / TMIO: Fix build issue related to struct scatterlistRafael J. Wysocki2011-07-261-0/+1
| | | | | | | | Fix build issue caused by undefined struct scatterlist in drivers/mmc/host/tmio_mmc.c. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* mmc: tmio: fix a deadlockGuennadi Liakhovetski2011-07-211-0/+5
| | | | | | | | | Currently the tmio-mmc driver contains a recursive runtime PM method invocation, which leads to a deadlock on a mutex. Avoid it by taking care not to request DMA too early. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: maximize power savingGuennadi Liakhovetski2011-07-211-0/+2
| | | | | | | | This patch uses runtime PM to allow the system to power down the MMC controller, when the MMC closk is switched off. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: fix recursive spinlock, don't schedule with interrupts disabledGuennadi Liakhovetski2011-07-211-1/+5
| | | | | | | | | | Calling mmc_request_done() under a spinlock with interrupts disabled leads to a recursive spin-lock on request retry path and to scheduling in atomic context. This patch fixes both these problems by moving mmc_request_done() to the scheduler workqueue. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: sdhi: Add write16_hookSimon Horman2011-07-201-0/+5
| | | | | | | | | | | | Some controllers require waiting for the bus to become idle before writing to some registers. I have implemented this by adding a hook to sd_ctrl_write16() and implementing a hook for SDHI which waits for the bus to become idle. Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: Share register access functionsSimon Horman2011-07-201-0/+35
| | | | | | | | | | | | | | Move register access functions into a shared header. Use sd_ctrl_write16 in tmio_mmc_dma.c:tmio_mmc_enable_dma(). Other than avoiding (trivial) open-coding, the motivation for this is to allow platform-hooks in access functions to be applied across all applicable accesses. Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: runtime suspend the controller, where possibleGuennadi Liakhovetski2011-05-251-0/+3
| | | | | | | | | | | The TMIO MMC controller cannot be powered off to save power, when no card is plugged in, because then it will not be able to detect a new card-insertion event. On some implementations, however, it is possible to switch to using another source to detect card insertion. This patch adds support for such implementations. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio/sdhi: break out interrupt request/freeMagnus Damm2011-05-251-1/+1
| | | | | | | | | | | | | Move request_irq()/free_irq() from the shared code in tmio_mmc.c into the SDHI/tmio specific portion in sh_mobile_sdhi.c and tmio_mmc_pio.c. This is ground work to allow us to adjust the SDHI code with IRQ flags and number of interupt sources. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: protect the tmio_mmc driver against a theoretical raceGuennadi Liakhovetski2011-05-251-0/+1
| | | | | | | | | | The MMC subsystem does not guarantee, that host driver .request() and .set_ios() callbacks are serialised. Such concurrent calls, however, do not have to be meaningfully supported, drivers just have to make sure to avoid any severe problems. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: Add runtime and system-wide PM to the TMIO MMC driverGuennadi Liakhovetski2011-05-251-0/+10
| | | | | | | | | | | Add runtime and system-wide power management to the TMIO MMC driver in PIO and DMA modes, allowing it to properly save and restore its state during system suspend. Runtime PM is very crude ATM, because the controller has to be powered on all the time to detect card hotplug events. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio_mmc: Move some defines into a shared headerSimon Horman2011-03-261-26/+4Star
| | | | | | | | | | | | Also add TMIO_BBS. This allows these defines to also be used by zboot. Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: convert the SDHI MMC driver from MFD to a platform driverGuennadi Liakhovetski2011-03-251-1/+1
| | | | | | | | | | | | On sh-mobile platforms the SDHI driver was using the tmio_mmc SD/SDIO MFD cell driver. Now that the tmio_mmc driver has been split into a core and a separate MFD glue, we can support SDHI natively without the need to emulate an MFD controller. This also allows to support systems with an on-SoC SDHI controller and a separate MFD with a TMIO core. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio: split core functionality, DMA and MFD glueGuennadi Liakhovetski2011-03-251-0/+145
| | | | | | | | | | | | | | | | TMIO MMC chips contain an SD / SDIO IP core from Panasonic, similar to the one, used in MN5774 and other MN57xx controllers. These IP cores are included in many multifunction devices, in sh-mobile chips from Renesas, in the latter case they can also use DMA. Some sh-mobile implementations also have some other specialities, that MFD-based solutions don't have. This makes supporting all these features in a monolithic driver inconveniet and error-prone. This patch splits the driver into 3 parts: the core, the MFD glue and the DMA support. In case of a modular build, two modules will be built: mmc_tmio_core and mmc_tmio. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio_mmc: merge the private header into the driverGuennadi Liakhovetski2011-01-091-226/+0Star
| | | | | | | | drivers/mmc/host/tmio_mmc.h is only used by drivers/mmc/host/tmio_mmc.c, this needlessly complicates source-code handling. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: tmio_mmc: fix PIO fallback on DMA descriptor allocation failureGuennadi Liakhovetski2011-01-091-2/+0Star
| | | | | | | | | | | | The easiest way to fall back to PIO, when a DMA descriptor allocation fails is to disable DMA on the controller but continue with the current request in PIO mode. This way tmio_mmc_start_dma() can become void, since it cannot be failing any more. The current version is also broken: it is testing a wrong pointer and thus failing to recognise, that a descriptor allocation wasn't successful. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
* mmc: fix the use of kunmap_atomic() in tmio_mmc.hGuennadi Liakhovetski2010-09-101-5/+3Star
| | | | | | | | | | | | | | | | | kunmap_atomic() takes the cookie, returned by the kmap_atomic() as its argument and not the page address, used as an argument to kmap_atomic(). This patch fixes the compile error: In file included from drivers/mmc/host/tmio_mmc.c:37: drivers/mmc/host/tmio_mmc.h: In function 'tmio_mmc_kunmap_atomic': drivers/mmc/host/tmio_mmc.h:192: error: negative width in bit-field '<anonymous>' Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Eric Miao <eric.y.miao@gmail.com> Tested-by: Magnus Damm <damm@opensource.se> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* tmio_mmc: don't clear unhandled pending interruptsYusuke Goda2010-09-101-4/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, it was possible for ack_mmc_irqs() to clear pending interrupt bits in the CTL_STATUS register, even though the interrupt handler had not been called. This was because of a race that existed when doing a read-modify-write sequence on CTL_STATUS. After the read step in this sequence, if an interrupt occurred (causing one of the bits in CTL_STATUS to be set) the write step would inadvertently clear it. Observed with the TMIO_STAT_RXRDY bit together with CMD53 on AR6002 and BCM4318 SDIO cards in polled mode. This patch eliminates this race by only writing to CTL_STATUS and clearing the interrupts that were passed as an argument to ack_mmc_irqs()." [matt@console-pimps.org: rewrote changelog] Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com> Acked-by: Magnus Damm <damm@opensource.se>" Tested-by: Arnd Hannemann <arnd@arndnet.de>" Acked-by: Ian Molton <ian@mnementh.co.uk> Cc: Matt Fleming <matt@console-pimps.org> Cc: Samuel Ortiz <sameo@linux.intel.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: <linux-mmc@vger.kernel.org> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* mmc: add DMA support to tmio_mmc driver, when used on SuperHGuennadi Liakhovetski2010-05-221-0/+13
| | | | | | | | | | SDHI controllers on SuperH, served by the tmio_mmc driver, can use slave DMA for data transfer. This patch adds support for the dmaengine API to the tmio_mmc driver. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Ian Molton <ian@mnementh.co.uk> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
* tmio_mmc: Keep card-detect interrupts enabledGuennadi Liakhovetski2010-03-071-4/+2Star
| | | | | | | | | | On SuperH platforms the SDHI controller does not produce any command IRQs after a completed IO. This leads to card-detect interrupts staying disabled. Do not disable card-detect interrupts on DATA IRQs. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* mfd: tmio_mmc hardware abstraction for CNF areaIan Molton2010-01-181-40/+6Star
| | | | | | | | | | | | This patch abstracts out the CNF area code from tmio_mmc which is not present in all hardware that can use this driver. This is required so that we can support non-toshiba based hardware. ASIC3 support by Philipp Zabel Signed-off-by: Ian Molton <ian@mnementh.co.uk> Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* tmio_mmc: add bus_shift supportPhilipp Zabel2009-06-131-9/+68
| | | | | | | | | | Some ASIC3 devices in the wild are connected with the address bus shifted by one line, so that its 16-bit registers appear 32-bit aligned in host memory space. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Acked-by: Ian Molton <ian@mnementh.co.uk> Signed-off-by: Pierre Ossman <pierre@ossman.eu>
* MMC: tmio_mmc.h: fix build problemAlexander Beregalov2009-03-241-0/+3
| | | | | | | | | | | | drivers/mmc/host/tmio_mmc.h: In function 'tmio_mmc_kmap_atomic': drivers/mmc/host/tmio_mmc.h:147: error: implicit declaration of function 'kmap_atomic' drivers/mmc/host/tmio_mmc.h:147: error: 'KM_BIO_SRC_IRQ' undeclared (first use in this function) drivers/mmc/host/tmio_mmc.h: In function 'tmio_mmc_kunmap_atomic': drivers/mmc/host/tmio_mmc.h:153: error: implicit declaration of function 'kunmap_atomic' drivers/mmc/host/tmio_mmc.h:153: error: 'KM_BIO_SRC_IRQ' undeclared (first use in this function) Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
* tmio_mmc: fix compilation with debug enabledDmitry Baryshkov2008-09-201-2/+2
| | | | | | Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Acked-by: Ian Molton <spyro@f2s.com> Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
* mfd: TMIO MMC driverIan Molton2008-08-101-0/+194
This patch adds support for the MMC subdevice 'cell' commonly found in TMIO based MFDs. Signed-off-by: Ian Molton <spyro@f2s.com> Acked-by: Pierre Ossman <drzeus@drzeus.cx> Signed-off-by: Samuel Ortiz <sameo@openedhand.com>