Commit Graph

127 Commits (2d8946c59743bc635a5e5701e6ef8e71e0a16ab7)

Author SHA1 Message Date
Russell King 1c3be369c5 PM: add runtime PM support to MMCI
Add runtime PM support to the MMCI primecell driver, making use of
the core primecell bus runtime PM support.

Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-09-22 16:21:42 +01:00
Linus Torvalds b6844e8f64 Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (237 commits)
  ARM: 7004/1: fix traps.h compile warnings
  ARM: 6998/2: kernel: use proper memory barriers for bitops
  ARM: 6997/1: ep93xx: increase NR_BANKS to 16 for support of 128MB RAM
  ARM: Fix build errors caused by adding generic macros
  ARM: CPU hotplug: ensure we migrate all IRQs off a downed CPU
  ARM: CPU hotplug: pass in proper affinity mask on IRQ migration
  ARM: GIC: avoid routing interrupts to offline CPUs
  ARM: CPU hotplug: fix abuse of irqdesc->node
  ARM: 6981/2: mmci: adjust calculation of f_min
  ARM: 7000/1: LPAE: Use long long printk format for displaying the pud
  ARM: 6999/1: head, zImage: Always Enter the kernel in ARM state
  ARM: btc: avoid invalidating the branch target cache on kernel TLB maintanence
  ARM: ARM_DMA_ZONE_SIZE is no more
  ARM: mach-shark: move ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  ARM: mach-sa1100: move ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  ARM: mach-realview: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  ARM: mach-pxa: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  ARM: mach-ixp4xx: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  ARM: mach-h720x: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  ARM: mach-davinci: move from ARM_DMA_ZONE_SIZE to mdesc->dma_zone_size
  ...
2011-07-24 10:20:54 -07:00
Russell King 06f365acef Merge branches 'btc', 'dma', 'entry', 'fixes', 'linker-layout', 'misc', 'mmci', 'suspend' and 'vfp' into for-next 2011-07-22 23:08:48 +01:00
Per Forlin 58c7ccbf91 mmc: mmci: implement pre_req() and post_req()
pre_req() runs dma_map_sg() and prepares the dma descriptor for the next
mmc data transfer. post_req() runs dma_unmap_sg.  If not calling pre_req()
before mmci_request(), mmci_request() will prepare the cache and dma just
like it did it before.  It is optional to use pre_req() and post_req()
for mmci.

Signed-off-by: Per Forlin <per.forlin@linaro.org>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-07-20 17:21:11 -04:00
Linus Walleij 7f294e4983 ARM: 6981/2: mmci: adjust calculation of f_min
The ARM version maximum clock divider is 512 whereas for the ST
variants it's 257. Let's use DIV_ROUND_UP() for both cases so we
can see clearly what's going on here.

[Use DIV_ROUND_UP to clarify elder code]

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Reviewed-by: Sebastian Rasmussen <sebastian.rasmussen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-07-19 16:04:35 +01:00
Linus Walleij 757df746fc ARM: 6980/1: mmci: use StartBitErr to detect bad connections
Stresstesting insert/remove of SD-cards can trigger
a StartBitErr. This made the driver to hang in forever
waiting for a non ocurring data timeout.

This bit and interrupt is documented in the original
PL180 TRM, just never implemented until now.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Reviewed-by: Linus Walleij <linus.walleij@stericsson.com>
Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-07-06 20:46:04 +01:00
Linus Walleij 17ee083b78 ARM: 6894/1: mmci: trigger card detect IRQs on falling and rising edges
Right now the card detect IRQ for MMCI is requested without any
flags which will give some default machine-specified IRQ
behaviour. However on the U300 rising+falling edges (such as can
be expected from a simple GPIO to generate when inserting/removing
a card) need to be requested explicitly.

Cc: Rabin Vincent <rabin.vincent@stericsson.com>
Cc: Ulf Hansson <ulf.hansson@stericsson.com>
Cc: Sebastian Rasmussen <sebastian.rasmussen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-06-06 11:11:12 +01:00
Philippe Langlais 1784b157c8 ARM: 6832/1: mmci: support for ST-Ericsson db8500v2
ST-Ericsson modified ARM PrimeCell PL180 block has not got
an updated corresponding amba-id, althought the IP block has
changed in db8500v2. The change was done to the datactrl register.
Using the overrided subversion ID, account for this.

Signed-off-by: Philippe Langlais <philippe.langlais@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-05-26 10:33:35 +01:00
Linus Walleij 399bc4863e ARM: 6858/1: mmci: force negative edge on clock bypass for ux500
This fixes a regression on high clock speeds with the MMCI on
ux500. We need to make sure we derive the passthru clock on the
falling edge of the incoming clock if it shall work at high
frequencies, and on the ux500's there is a special bit for this.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-05-12 10:15:25 +01:00
Linus Walleij 49ac215e07 ARM: 6785/1: mmci: separate out ST Micro register defines
The mmci.h header contained a few registers not clearly marked
as ST Micro only, rectify this and remove the HWFC magic in the
process. The idea is to make the mmci.h header file more ordered
so other vendors with PL180 derivates can see where to put in
their custom register defines.

Includes portions of an earlier patch from Sebastian Rasmussen.

Acked-by: Sebastian Rasmussen <sebastian.rasmussen@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-05-11 12:56:49 +01:00
Pawel Moll 768fbc1876 mmc: mmci: Add ARM variant with extended FIFO
New IO FPGA implementation for Versatile Express boards contain
MMCI (PL180) cell with FIFO extended to 128 words (512 bytes).

Matt Waddel reports that this patch improves MMC performance on
his vexpress system, and also fixes "mmcblk0: error -5 transferring
data" errors.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Tested-by: Matt Waddel <matt.waddel@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-25 10:30:49 -04:00
Russell King 9c9585e0e9 Merge branches 'aaci', 'mmci-dma', 'pl' and 'pl011' into drivers 2011-03-17 11:04:51 +00:00
Russell King aa25afad2c ARM: amba: make probe() functions take const id tables
Make Primecell driver probe functions take a const pointer to their
ID tables.  Drivers should never modify their ID tables in their
probe handler.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-02-23 16:24:14 +00:00
Russell King c8ebae3703 ARM: mmci: add dmaengine-based DMA support
Based on a patch from Linus Walleij.

Add dmaengine based support for DMA to the MMCI driver, using the
Primecell DMA engine interface.  The changes over Linus' driver are:

- rename txsize_threshold to dmasize_threshold, as this reflects the
  purpose more.
- use 'mmci_dma_' as the function prefix rather than 'dma_mmci_'.
- clean up requesting of dma channels.
- don't release a single channel twice when it's shared between tx and rx.
- get rid of 'dma_enable' bool - instead check whether the channel is NULL.
- detect incomplete DMA at the end of a transfer.  Some DMA controllers
  (eg, PL08x) are unable to be configured for scatter DMA and also listen
  to all four DMA request signals [BREQ,SREQ,LBREQ,LSREQ] from the MMCI.
  They can do one or other but not both.  As MMCI uses LBREQ/LSREQ for the
  final burst/words, PL08x does not transfer the last few words.
- map and unmap DMA buffers using the DMA engine struct device, not the
  MMCI struct device - the DMA engine is doing the DMA transfer, not us.
- avoid double-unmapping of the DMA buffers on MMCI data errors.
- don't check for negative values from the dmaengine tx submission
  function - Dan says this must never fail.
- use new dmaengine helper functions rather than using the ugly function
  pointers directly.
- allow DMA code to be fully optimized away using dma_inprogress() which
  is defined to constant 0 if DMA engine support is disabled.
- request maximum segment size from the DMA engine struct device and
  set this appropriately.
- removed checking of buffer alignment - the DMA engine should deal with
  its own restrictions on buffer alignment, not the individual DMA engine
  users.
- removed setting DMAREQCTL - this confuses some DMA controllers as it
  causes LBREQ to be asserted for the last seven transfers, rather than
  six SREQ and one LSREQ.
- removed burst setting - the DMA controller should not burst past the
  transfer size required to complete the DMA operation.

Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-02-04 13:25:49 +00:00
Russell King 51d4375dd7 ARM: mmci: no need for separate host->data_xfered
We don't need to store the number of bytes transferred in our host
structure - we can store this directly in data->bytes_xfered.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-02-04 13:25:48 +00:00
Russell King c4d877c1b3 ARM: mmci: avoid unnecessary switch to data available PIO interrupts
We don't need to switch to data available interrupts if there's at
least half a FIFO depth worth of data remaining, as we'll still get
the FIFO half full interrupt.  Keep this interrupt masked off until
we have less than half the FIFO depth worth of data remaining.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-02-04 13:25:48 +00:00
Russell King 7d7aa23cf0 ARM: mmci: no need to call flush_dcache_page() with sg_miter API
The sg_miter API provides the required cache maintainence, so we don't
need to do that ourselves.  Remove the unnecessary additional cache
maintainence.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-02-04 13:25:47 +00:00
Russell King c8afc9d59c ARM: mmci: avoid reporting too many completed bytes on fifo overrun
The data counter counts the number of bytes transferred on the MMC bus.
When a FIFO overrun occurs, we will not have transferred a FIFOs-worth
of data to memory, and so the data counter will be a FIFOs-worth ahead.
If this occurs on a block boundary, we will report one too many sectors
as successful.  Fix this.

Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-02-04 13:25:41 +00:00
Russell King 613b152c63 ARM: mmci: round down the bytes transferred on error
We should not report incomplete blocks on error.  Return the number of
bytes successfully transferred, rounded down to the nearest block.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-01-31 10:53:37 +00:00
Russell King ccff9b5182 ARM: mmci: complete the transaction on error
When we encounter an error, make sure we complete the transaction
otherwise we'll leave the request dangling.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-01-31 10:53:23 +00:00
Linus Walleij f5a106d9e2 ARM: 6642/1: mmci: calculate remaining bytes at error correctly
The MMCIDATACNT register contain the number of byte left at error
not the number of words, so loose the << 2 thing. Further if CRC
fails on the first block, we may end up with a negative number
of transferred bytes which is not good, and the formula was in
wrong order.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-01-27 22:06:12 +00:00
Russell King - ARM Linux 9047b435a0 mmc: mmci: don't read command response when invalid
Don't read the command response from the registers when either the
command timed out (because there was no response from the card) or
the checksum on the response was invalid.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Chris Ball <cjb@laptop.org>
2011-01-25 21:53:46 -05:00
Linus Walleij 8cb2815574 ARM: 6632/3: mmci: stop using the blockend interrupts
Implement a suggestion from Russell to drop the use of blockend
interrupts altogether and instead rely on the data counter.

Tested with error-free cards on U300, U8500 and RealView PB1176.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2011-01-24 15:23:00 +00:00
Russell King 8c11a94d86 ARM: mmci: Clean up MMCI announcement printk
Make the MMCI announcement printk say which primecell part number
has been found.  Display the revision as an unsigned decimal, and
display only the first 8 hex digits of the base address unless it's
larger.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-12-30 14:07:10 +00:00
Linus Walleij 991a86e182 ARM: 6530/1: mmci: partially revert clock divisor code
I misread the datasheet as if bypass mode was not available at all
on the ux500's, I was wrong. It is there, the datasheet just
states that you should not have to use it.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-12-19 16:01:25 +00:00
Linus Walleij b70a67f938 ARM: 6526/1: mmci: corrected calculation of clock div for ux500
The Ux500 variant of this block has a different divider.
The value used right now is too big and which means a loss
in performance. This fix corrects it. Also expand the math
comments a bit so it's clear what's happening. Further
the Ux500 variant does not like if we use the BYPASS bit,
instead we are supposed to set the clock divider to zero.

Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-12-19 16:01:24 +00:00
Linus Walleij 3417780200 ARM: 6438/2: mmci: add SDIO support for ST Variants
This adds some minor variant data and trickery to enable SDIO
on the ST Micro variants of MMCI/PL180.

Signed-off-by: Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-11-10 13:15:19 +00:00
Linus Walleij f20f8f21e0 ARM: 6399/3: mmci: handle broken MCI_DATABLOCKEND hardware
On the U300 the MCI_DATAEND and MCI_DATABLOCKEND IRQs can arrive
out-of-order. Replace an ugly #ifdef hack with a proper runtime
solution which models what is really happening.

In the U300 DMA mode and on all Ux500 models, the MCI_DATABLOCKEND
flag isn't properly cleared in hardware following and ACK leading
to all kind of weird behaviour when the flag is still up in
subsequent interrupts, so we add two flags indicating the
error and handle this runtime.

Cc: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-11-10 13:12:59 +00:00
Linus Walleij 2686b4b408 ARM: 6311/2: mmci: work with only one irq
The DBx500 variants have only one IRQ line hooked up.  Allow these (and
any other implementations which choose to use only one irq) to work by
directing the PIO interrupts also to the first IRQ line.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-11-10 13:10:01 +00:00
Linus Walleij 99fc513101 mmc: Move regulator handling closer to core
After discovering a problem in regulator reference counting I took Mark
Brown's advice to move the reference count into the MMC core by making the
regulator status a member of struct mmc_host.

I took this opportunity to also implement NULL versions of
the regulator functions so as to rid the driver code from
some ugly #ifdef CONFIG_REGULATOR clauses.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Adrian Hunter <adrian.hunter@nokia.com>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Sundar Iyer <sundar.iyer@stericsson.com>
Cc: Daniel Mack <daniel@caiaq.de>
Cc: Pierre Ossman <pierre@ossman.eu>
Cc: Matt Fleming <matt@console-pimps.org>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Cliff Brake <cbrake@bec-systems.com>
Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:16 +08:00
Martin K. Petersen a36274e018 mmc: Remove distinction between hw and phys segments
We have deprecated the distinction between hardware and physical
segments in the block layer.  Consolidate the two limits into one in
drivers/mmc/.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2010-10-23 21:11:11 +08:00
Linus Walleij 18a0630115 ARM: 6370/1: mmci: use _cansleep GPIO functions
Currently the kernel is screaming about slowpath at me for the
wp/cd callbacks. Switch to the _cansleep variants so as to silence
this.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-09-23 15:02:28 +01:00
Rabin Vincent 4b8caec095 ARM: 6309/1: mmci: allow neither ->status nor gpio_cd to be specified
The card may be always present on the board, and for these cases neither
a status callback nor a card detect GPIO is required, and card detection
polling can be disabled.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-09-23 15:02:00 +01:00
Rabin Vincent 148b8b39c1 ARM: 6308/1: mmci: support card detection interrupts
If an IRQ can be requested on the card detected GPIO, use it instead of
polling.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-09-23 15:01:59 +01:00
Rabin Vincent 8301bb68c6 ARM: 6310/1: mmci: support different FIFO sizes
The Ux500 variant has a 32-word FIFO (TXFIFOEMPTY is asserted when it
has 2 left) and TXFIFOHALFEMPTY is repurposed as TXFIFOBURSTWRITEABLE,
with a burst being defined as 8-words.  Likewise for RX.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-08-26 19:54:29 +01:00
Rabin Vincent 2971944582 ARM: 6307/1: mmci: allow the card detect GPIO value not to be inverted
On some platforms, the GPIO value from the gpio_cd pin doesn't need to
be inverted to get it active high.  Add a cd_invert platform data
parameter and change existing platforms using GPIO for CD (only
Realview) to enable it.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-08-26 19:54:27 +01:00
Linus Torvalds be82ae0238 Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (291 commits)
  ARM: AMBA: Add pclk support to AMBA bus infrastructure
  ARM: 6278/2: fix regression in RealView after the introduction of pclk
  ARM: 6277/1: mach-shmobile: Allow users to select HZ, default to 128
  ARM: 6276/1: mach-shmobile: remove duplicate NR_IRQS_LEGACY
  ARM: 6246/1: mmci: support larger MMCIDATALENGTH register
  ARM: 6245/1: mmci: enable hardware flow control on Ux500 variants
  ARM: 6244/1: mmci: add variant data and default MCICLOCK support
  ARM: 6243/1: mmci: pass power_mode to the translate_vdd callback
  ARM: 6274/1: add global control registers definition header file for nuc900
  mx2_camera: fix type of dma buffer virtual address pointer
  mx2_camera: Add soc_camera support for i.MX25/i.MX27
  arm/imx/gpio: add spinlock protection
  ARM: Add support for the LPC32XX arch
  ARM: LPC32XX: Arch config menu supoport and makefiles
  ARM: LPC32XX: Phytec 3250 platform support
  ARM: LPC32XX: Misc support functions
  ARM: LPC32XX: Serial support code
  ARM: LPC32XX: System suspend support
  ARM: LPC32XX: GPIO, timer, and IRQ drivers
  ARM: LPC32XX: Clock driver
  ...
2010-08-03 14:31:24 -07:00
Russell King 74bc80931c ARM: Fix Versatile/Realview/VExpress MMC card detection sense
The MMC card detection sense has become really confused with negations
at various levels, leading to some platforms not detecting inserted
cards.  Fix this by converting everything to positive logic throughout,
thereby getting rid of these negations.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-07-30 23:16:32 +01:00
Rabin Vincent 08458ef6ee ARM: 6246/1: mmci: support larger MMCIDATALENGTH register
The Ux500 variant has a 24-bit MMCIDATALENGTH register, as opposed to
the 16-bit one on the ARM version.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-07-29 15:40:56 +01:00
Rabin Vincent 4380c14fd7 ARM: 6245/1: mmci: enable hardware flow control on Ux500 variants
Although both the U300 and Ux500 use ST variants, the HWFCEN bits are at
different positions, so use the variant_data to store the information.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-07-29 15:40:32 +01:00
Rabin Vincent 4956e10903 ARM: 6244/1: mmci: add variant data and default MCICLOCK support
Add a variant_data structure to handle the differences between the
various variants of this peripheral.  Add a first quirk for a default
MCICLOCK value, required on the Ux500 variant where the enable bit needs
to be always set, since it controls access to some registers.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-07-29 15:39:56 +01:00
Rabin Vincent bb8f563c84 ARM: 6243/1: mmci: pass power_mode to the translate_vdd callback
Platforms may have some external power control which need to be
controlled from board specific code.  Rename the translate_vdd()
callback to vdd_handler() and pass it the power mode.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-07-29 15:39:05 +01:00
Rabin Vincent f5e2574e73 ARM: 6239/1: mmci: let core poll for card detection
Use the MMC core's ability to poll for card detection.  This also has
the advantage of doing the gpio_get_value from a workqueue instead of
timer, allowing the gpio to be on a sleeping gpiochip.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-07-27 10:48:44 +01:00
Rabin Vincent 528320db01 ARM: 6238/1: mmci: fix multi block transfers
Fix the data transfer size to allow multi block transfers to work.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-07-27 10:48:44 +01:00
Rabin Vincent 4ce1d6cbf0 ARM: 6237/1: mmci: use sg_miter API to fix multi-page sg handling
The mmci driver's SG list iteration logic assumes that each SG entry
spans only one page, and only maps and flushes one page of the sg.  This
is not a valid assumption.  Fix it by converting the driver to the
sg_miter API, which correctly handles sgs which span multiple pages.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-07-27 10:48:44 +01:00
Matt Fleming 1a13f8fa76 mmc: remove the "state" argument to mmc_suspend_host()
Even though many mmc host drivers pass a pm_message_t argument to
mmc_suspend_host() that argument isn't used the by MMC core.  As host
drivers are converted to dev_pm_ops they'll have to construct
pm_message_t's (as they won't be passed by the PM subsystem any more) just
to appease the mmc suspend interface.

We might as well just delete the unused paramter.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Acked-by: Michal Miroslaw <mirq-linux@rere.qmqm.pl>ZZ
Acked-by: Sascha Sommer <saschasommer@freenet.de>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-05-27 09:12:40 -07:00
Linus Walleij 808d97ccbe ARM: 6033/1: ARM: MMCI: pass max frequency from platform
This introduce the field f_max into the mmci_platform_data,
making it possible to pass in a desired block clocking frequency
from a board configuration. This is often more desirable than
using a module parameter. We keep the module parameter as a
fallback as well as the default frequency specified for this
parameter if a parameter is not provided.

This also adds some kerneldoc style documentation to the
platform data struct in mmci.h.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-04-14 16:08:18 +01:00
Linus Walleij 771dc157e0 ARM: 6032/1: ARM: MMCI: support 8bit mode on the ST Micro version
This adds support for an 8bit wide bus to the card (data lines
MCIDAT0 through 7 exist) on the ST Micro version and alters the
U300 platform to support this. Also add some ST_ prefix to the
ST-specific registers.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-04-14 16:08:17 +01:00
Linus Walleij 64de028948 ARM: 5940/2: ARM: MMCI: remove custom DBG macro and printk
This removes the custom DBG macro in favor of the in-kernel
dev_dbg() macro. Probably a leftover from a time when dev_dbg()
didn't yet exist. Also remove a printk() in favor of dev_err().

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-02-21 22:21:17 +00:00
Linus Walleij f28e8a4d02 ARM: 5896/1: MMCI: work around a hardware bug in U300
In the U300 some hardware bug makes the status flag not come up
signalling a successful write (or anything else, like an error, for
that matter) on write requests. This little quirk makes the writes
work on U300.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2010-01-27 22:00:47 +00:00
Linus Walleij b43149c168 ARM: 5785/1: Use ST vendor enum instead of numeral
This fixes a leftover instance of using the 0x80 numeral instead
of the new AMBA_VENDOR_ST enum in the MMCI/PL180 driver.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-11-24 10:06:26 +00:00
Linus Walleij ee17962e24 ARM: 5731/2: Fix U300 generic GPIO, remove ifdefs from MMCI v3
The #ifdefs in the MMCI driver were erroneous and just masking
a bug in the U300 generic GPIO implementation. This removes the
ifdefs and fixes the U300 generic GPIO instead.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-10-01 16:26:15 +01:00
Linus Walleij 34e84f39a2 ARM: 5721/1: MMCI enable the use of a regulator
This enables the use of a regulator to power the MMCI/PL180
PrimeCell. The OCR mask is calculated and voltage is set using
the new MMC core functions for discovering voltage ranges
in regulators. The platform translate_vdd function which basically
controls the 4 lines out of the PL180 is disabled if you use a
regulator instead.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-09-22 20:49:05 +01:00
Linus Walleij 6ef297f86b ARM: 5720/1: Move MMCI header to amba include dir
This moves the mmci platform data definition struct away from
arch/arm/include/asm/mach/mmc.h into the more proper place among
the other primecells in include/linux/amba/mmci.h and at the same
time renames it to "mmci.h", and also the struct in this file
confusingly named mmc_platform_data has been renamed
mmci_platform_data for clarity.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-09-22 20:49:04 +01:00
Linus Walleij 9e6c82cd3e ARM: 5698/1: MMCI pass capabilities in platform data
This makes it possible to pass down the host controller
capabilities for the MMCI driver using the platform data. It
also provides the capabilties for the U300 implementation as an
example, and makes sure the 4bit wide mode is set if this is
requested by the ios() now that we can actually set that
capability for a platform.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-09-15 22:11:06 +01:00
Linus Walleij a6a6464a0e ARM: 5697/1: MMCI Break out clock divider setup
This breaks out the clock divider set-up code from the
mmci_set_ios() code and surrounds the two register
writes with a host lock so we don't get collisions if
(in future code) two code paths want to change the
clock divider at the same time as can be the case if
we get something like pre/post- clock frequency change
notifications soonish.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-09-15 22:11:05 +01:00
Russell King ddd559b13f Merge branch 'devel-stable' into devel
Conflicts:
	MAINTAINERS
	arch/arm/mm/fault.c
2009-09-12 12:02:26 +01:00
Linus Walleij f17a1f06d2 ARM: 5636/1: Move vendor enum to AMBA include
This moves the primecell vendor enum definition inside vic.c
out to linux/amba/bus.h where it belongs and replace any
occurances of specific vendor ID:s with the respective enums
instead.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-09-12 11:51:14 +01:00
Linus Walleij 7064d2092d ARM: 5685/1: Make MMCI driver compile without gpiolib
The recent addition of optional gpiolib support to check if a
card was inserted or write protected was really not optional.
It needs this ifdef to become optional so that U300 compiles,
for example.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-09-02 11:21:14 +01:00
Russell King 8900144692 MMC: MMCI: use gpiolib for card detect/write protect
Use gpiolib where available (and when valid GPIOs are provided) for
write protect/card detect status reporting.  We fall back to the old
'status' method where gpiolib support is not available.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-07-09 15:16:07 +01:00
Russell King 012b7d339c MMC: MMCI: use AMBA bus accessors
Rather than open coding the accessors for decoding peripheral IDs,
use the macros already provided.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
2009-07-09 15:13:56 +01:00
Linus Walleij dc890c2dcd [ARM] 5544/1: Trust PrimeCell resource sizes
I found the PrimeCell/AMBA Bus drivers distrusting the resource
passed in as part of the struct amba_device abstraction. This
patch removes all hard coded resource sizes found in the PrimeCell
drivers and move the responsibility of this definition back to
the platform/board device definition, which already exist and
appear to be correct for all in-tree users of these drivers.
We do this using the resource_size() inline function which was
also replicated in the only driver using the resource size, so
that has been changed too. The KMI_SIZE was left in kmi.h in case
someone likes it. Test-compiled against Versatile and Integrator
defconfigs, seems to work but I don't posess these boards and
cannot test them.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-06-11 15:36:56 +01:00
Alessandro Rubini 03fbdb15c1 [ARM] 5519/1: amba probe: pass "struct amba_id *" instead of void *
The second argument of the probe method points to the amba_id
structure, so it's better passed with the correct type. None of the
current in-tree drivers uses the pointer, so they have only been
checked for a clean compile.

Change suggested by Russell King.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-05-20 23:26:51 +01:00
Rabin Vincent 4ea580f1db mmci: fix crash with debug enabled
If MMC debugging is enabled, the mmci driver oopses because the DBG
macro uses host->mmc before it is set.  Set it earlier.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
2009-05-03 22:12:27 +02:00
Linus Walleij 6dc4a47a0c [ARM] 5420/1: MMCI devinit and devexit macros
This adds __devinit and __devexit macros to the module probe and
remove functions in MMCI. Now includes the __devexit_p() thing too.

Signed-off-by: Linus Walleij <linus.walleij@ericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2009-03-12 16:50:10 +00:00
Linus Walleij cc30d60e4c mmci: Add support for ST Micro derivate
This patch adds support for the ST Microelectronics version of
the PL180 PrimeCell. They use designer ID 0x80 and have a few
alterations/bugfixes related to open drain and HW flow control.
They also add some SDIO registers, I am unsure if these are
in ST HW only or if this is things also added in later ARM
revisions, but they are included in the mmci.h file for
completeness.

Signed-off-by: Linus Walleij <linus.walleij@ericsson.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2009-02-02 20:57:06 +01:00
Russell King ee569c43e3 [ARM] amba drivers: don't pass a consumer clock name for devices with unique clocks
Where devices only have one consumer, passing a consumer clock ID
has no real benefit, and it only encourages wrong implementations of
the clk API.  Remove it.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-11-30 17:38:14 +00:00
Linus Walleij 9e9430213f [ARM] 5322/1: Fix fastpath issue in mmci.c
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-28 00:00:42 +00:00
Pierre Ossman 23af60398a mmc: remove multiwrite capability
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-15 14:14:49 +02:00
Linus Walleij c8df9a53e8 [ARM] 5024/1: Fix some minor clk issues in the MMCI PL18x driver
This fixes some two minor clk issues.

The first is a comparison where a byte will probably wrap around to 0 instead of being saturated to 255, shouldn't be triggered very often but need fixing.

The second is an attempt by the driver to adjust MCLK down to the maximum frequency according to the spec, so we don't accidentally overclock the PL18x block. None of the mach-{versatile|integrator|lh7a40x} that use it in-tree seem to have a problem with this (all are well below 100MHz, typically 33MHz), but some day there will be a problem.

This is not applied on top of the earlier mmci patch for race condition but rather a clean 2.6.25, but I guess it applies without major protests anyway.

Signed-off-by: Linus Walleij <triad@df.lth.se>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-05-04 11:06:05 +01:00
Linus Walleij 26eed9a5c6 [ARM] 5022/1: Race in ARM MMCI PL18x driver, V2
Updated version of 4446/1. This also drops the suggested comparison
of host_remain for == 0, since that doesn't make sense (still works
for us, too). We have verified that this patch solve race problems
on atleast 2 archs at high frequencies.

(Verbatim copy of old patch text below.)

The patch below fixes a race condition in the ARM MMCI PL18x driver.

If new data arrives in the FIFO while existing data is being read then
we get a second iteration of the loop in mmci_pio_read.

However host->size is not updated until after mmci_pio_read returns,
so we get count = number of new bytes PLUS number of bytes already
copied in the first iteration. This results in a FIFO underrun as
we try and read mode data than is available.

The fix is to compensating for data read on previous iterations
when calculating the amount of data in the FIFO.

Signed-off-by: Linus Walleij <triad@df.lth.se>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2008-04-28 17:03:34 +01:00
Jens Axboe bd6dee6f30 mmc: sg fallout
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-24 09:01:09 +02:00
Nicolas Pitre 019a5f56ec mmc: don't use weight32()
Using weight32() to determine if a value is a power of 2 is a rather
heavi weight solution.  The classic idiom is (x & (x - 1)) == 0, but
the kernel already provide a is_power_of_2 function for it.

Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-10-11 19:09:08 +02:00
Pierre Ossman 255d01af9a mmc: remove BYTEBLOCK capability
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-23 09:15:05 +02:00
Pierre Ossman 17b0429dde mmc: remove custom error codes
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-23 08:46:48 +02:00
Pierre Ossman 70f10482c6 mmc: update header file paths
Make sure all headers in the files reflect their true position
in the tree.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 01:53:31 +02:00
Pierre Ossman 1c6a0718f0 mmc: Move host and card drivers to subdirs
Clean up the drivers/mmc directory by moving card and host drivers
into subdirectories.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-05-01 13:04:17 +02:00