Commit Graph

255 Commits

Author SHA1 Message Date
Pavel Pisa 2cb3320b3f [ARM] 4256/1: i.MX/MX1 SDHC fix/workaround of SD card recognition problems
The SDHC controllers cannot process shorter transfers.
They has to be handled as longer ones, but it such case CRC
error is evaluated. There was a case in the code still,
where this error is not ignored as it should to be process
these transfers.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-03-12 16:49:37 +00:00
Pierre Ossman a715dfc7b9 sdhci: release irq during suspend
Release the device's irq during sleep, as all well-behaved drivers
should.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-03-06 13:38:49 +01:00
Mark Lord 62df67a523 sdhci: make isr tolerant of read errors
The interrupt is shared with another device, which resumes earlier than the
sdhci controller, and generates an interrupt.

The sdhci interrupt handler runs, sees 0xffffffff in its own device's
interrupt status, and tries to handle it..  The reason for the 0xffffffff
is that the device is still suspended, and *all* regs are reading back
0xffffffff.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-03-06 13:30:13 +01:00
Pierre Ossman cd9277c011 mmc: require explicit support for high-speed
The new high-speed timings are similar to each other and the old
system, but not identical. And although things "just work" most of
the time, sometimes it does not. So we need to start marking which
hosts are known to fully comply with the new timings.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-03-06 13:26:55 +01:00
Linus Torvalds 59b8175c77 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: (117 commits)
  [ARM] 4058/2: iop32x: set ->broken_parity_status on n2100 onboard r8169 ports
  [ARM] 4140/1: AACI stability add ac97 timeout and retries
  [ARM] 4139/1: AACI record support
  [ARM] 4138/1: AACI: multiple channel support for IRQ handling
  [ARM] 4211/1: Provide a defconfig for ns9xxx
  [ARM] 4210/1: base for new machine type "NetSilicon NS9360"
  [ARM] 4222/1: S3C2443: Remove reference to missing S3C2443_PM
  [ARM] 4221/1: S3C2443: DMA support
  [ARM] 4220/1: S3C24XX: DMA system initialised from sysdev
  [ARM] 4219/1: S3C2443: DMA source definitions
  [ARM] 4218/1: S3C2412: fix CONFIG_CPU_S3C2412_ONLY wrt to S3C2443
  [ARM] 4217/1: S3C24XX: remove the dma channel show at startup
  [ARM] 4090/2: avoid clash between PXA and SA1111 defines
  [ARM] 4216/1: add .gitignore entries for ARM specific files
  [ARM] 4214/2: S3C2410: Add Armzone QT2410
  [ARM] 4215/1: s3c2410 usb device:  per-platform vbus_draw
  [ARM] 4213/1: S3C2410 - Update definition of ADCTSC_XY_PST
  [ARM] 4098/1: ARM: rtc_lock only used with rtc_cmos
  [ARM] 4137/1: Add kexec support
  [ARM] 4201/1: SMP barriers pair needed for the secondary boot process
  ...

Fix up conflict due to typedef removal in sound/arm/aaci.h
2007-02-19 13:18:39 -08:00
Tim Schmielau cd354f1ae7 [PATCH] remove many unneeded #includes of sched.h
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-14 08:09:54 -08:00
Linus Torvalds a727fea99b Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
  tifm_sd: treat "status error" as normal command completion
  mmc: wbsd: Remove stray kunmap_atomic()
  mmc: sdhci: Stop asking for mail
  mmc: sdhci: Remove driver version
  mmc: wbsd: Remove driver version
2007-02-11 11:39:00 -08:00
Alex Dubov 12c834527b tifm_sd: treat "status error" as normal command completion
TI FlasMedia controller attempts to validate command responses and
issues a "status error" if response does not matches its perceived
(by controller) value. As mmc layer does its own validation we can
safely ignore the controller's opinion.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-11 16:28:22 +01:00
Pierre Ossman abc71668b5 mmc: wbsd: Remove stray kunmap_atomic()
There was one kunmap_atomic() left over from
4a0ddbd25a that was causing
crashes.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-11 16:27:13 +01:00
Al Viro 9f3bed5fdb [PATCH] TIFM should depend on PCI - TIFM_CORE leads to use of pci primitives
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-09 08:28:48 -08:00
Pierre Ossman acf1da4522 mmc: sdhci: Stop asking for mail
We get enough error reports without having to ask for it.
Remove notices about mailing the development list.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-09 08:29:19 +01:00
Pierre Ossman 52fbf9c976 mmc: sdhci: Remove driver version
The driver version was only really meaningful when it was an
out-of-tree driver. Now we can use the version of the kernel.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-09 08:23:41 +01:00
Pierre Ossman 1615cc224e mmc: wbsd: Remove driver version
The driver version was only really meaningful when it was an
out-of-tree driver. Now we can use the version of the kernel.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-09 08:19:07 +01:00
Andrew Victor 93a3ddc201 [ARM] 4151/1: AT91 / AVR32: Move at91_pdc.h to linux/atmel_pdc.h
The Atmel AT91 and AVR32 processor architectures share many of the same
peripherals.  The PDC (Peripheral Data Controller) registers are also
implemented within in a number of the on-chip peripherals (eg, USART,
MMC, SPI, SSC, etc).

In a attempt not to duplicate the register definitions in each
peripheral, or in each architecture, the at91_pdc.h header in
asm-arm/arch-at91 and asm-avr32/arch-at32ap has been replaced with
linux/atmel_pdc.h.

The definitions have also been renamed from AT91_PDC_* to ATMEL_PDC_*,
and the drivers updated accordingly.

Original patch from Nicolas Ferre.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Acked-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-02-08 15:13:47 +00:00
Pierre Ossman f9d429a2e5 mmc: tifm: replace kmap with page_address
Since we actively avoid highmem, calling kmap_atomic() instead
of page_address() is effectively only obfuscation.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:12 +01:00
Pierre Ossman c70840e819 mmc: sdhci: fix voltage ocr
Some bad if-clauses caused the driver to just report the highest
supported voltage, not all.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:12 +01:00
Pierre Ossman 2a22b14edf mmc: sdhci: replace kmap with page_address
Since we actively avoid highmem, calling kmap_atomic() instead
of page_address() is effectively only obfuscation.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:12 +01:00
Pierre Ossman 4a0ddbd25a mmc: wbsd: replace kmap with page_address
Since we actively avoid highmem, calling kmap_atomic() instead
of page_address() is effectively only obfuscation.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:11 +01:00
Pierre Ossman df1c4b7bf7 mmc: handle pci_enable_device() return value in sdhci
Make sure we report back any errors from pci_enable_device().

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:11 +01:00
Pierre Ossman 397411e67f mmc: Proper unclaim in mmc_block
Make sure we release the claim on the host even on failure.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:11 +01:00
Pierre Ossman ae06eaf9ab mmc: Graceful fallback for fancy features
MMC high-speed, wide bus support and SD high-speed
are functions that aren't critical for correct
operation of the card. As such, they shouldn't mark
the card as bad or dead when there is a failure
activating these features.

This is needed in particular on some really stupid
hardware (e.g. Winbond's) where not all data transfer
commands are supported.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:11 +01:00
Pierre Ossman 5ba593a972 mmc: Handle wbsd's stupid command list
The wbsd hardware is so incredibly brain damaged that it has an internal
list of commands that result in data transfers. The result being that
commands that aren't on this list aren't supported.

Instead of locking up, waiting for a data interrupt that will never come,
we try to fail a bit more gracefully.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:11 +01:00
Pierre Ossman 55db890a83 mmc: Allow host drivers to specify max block count
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-04 20:54:10 +01:00
Pierre Ossman fe4a3c7a20 mmc: Allow host drivers to specify a max block size
Most controllers have an upper limit on the block size. Allow the host
drivers to specify this and make sure we avoid hitting this limit.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:10 +01:00
Alex Dubov dba4accab1 tifm_sd: add suspend and resume functionality
Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:10 +01:00
Alex Dubov 50743f4cb1 Remove unused return value from signal_irq callback
Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:08 +01:00
Alex Dubov 2e8ce5e741 tifm_sd: prettify
This patch introduces no semantic changes - it is here for estetic purposes.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:08 +01:00
Alex Dubov 8e02f8581c tifm_sd: restructure initialization, removal and command handling
In order to support correct suspend and resume several changes were needed:
1. Switch from work_struct to tasklet for command handling. When device
suspend is called workqueues are already frozen and can not be used.
2. Separate host initialization code from driver's probe and don't rely
on interrupts for host initialization. This, in turn, addresses two
problems:
 a) Resume needs to re-initialize the host, but can not assume that
    device interrupts were already re-armed.
 b) Previously, probe will return successfully before really knowing
    the state of the host, as host interrupts were not armed in time.
    Now it uses polling to determine the real host state before returning.
3. Separate termination code from driver's remove. Termination may be caused
by resume, if media changed type or became unavailable during suspend.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:07 +01:00
Alex Dubov 83d420ba92 tifm_sd: fix hardware timeout setup
The register access order when setting hardware timeout was incorrect and
causing problems (wrong timeout intervals). This is now fixed.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:07 +01:00
Alex Dubov 0803dd0c25 tifm_sd: Switch software timeout handler from work_struct to timer
Two changes are introduced to software timeout handler in order to simplify
its management:
1. The implementation is switched from work_struct to timer
2. Previously, software timeout was rearmed with each interrupt. Now,
current request must complete entirely within timeout interval.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:07 +01:00
Alex Dubov 255ef22e89 tifm_sd: use kmap_atomic instead of kmap for PIO data buffer
Data buffer for PIO transfer used to be mapped in advance with kmap.
Abolish it in favor of on-demand kmap_atomic.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:07 +01:00
Alex Dubov 1289335a2a tifm_sd: alter order of the states in the command handler
Previously, stop command was issued right after BRS (block received/sent)
event. Stop command completion event could interfere with the card busy
event, causing miscount of the written blocks.
This patch ensures that stop command issued as last action for a
particular command, after DMA sompletion event and written block
count verification.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:07 +01:00
Philip Langdale fba68bd2da mmc: Add support for SDHC cards
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>
2007-02-04 20:54:07 +01:00
Darren Salt 9e9dc5f29f mmc: Power quirk for ENE controllers
Support for these devices was broken for 2.6.18-rc1 and later by commit
146ad66eac, which added voltage level support.

This restores the previous behaviour for these devices by ensuring that when
the voltage is changed, only one write to set the voltage is performed.

It may be that both writes are needed if the voltage is being changed between
two non-zero values or that it's safe to ensure that only one write is done
if the hardware only supports one voltage; I don't know whether either is the
case nor can I test since I have only the one SD reader (1524:0550), and it
supports just the one voltage.

Signed-off-by: Darren Salt <linux@youmustbejoking.demon.co.uk>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:06 +01:00
Pierre Ossman 11354d03af mmc: let host be parent of cards
Change the parent of cards to be a specific host (a class
device), not the physical controller. This is particularly
useful when the hardware has multiple slots, meaning
multiple hosts.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:06 +01:00
Pierre Ossman f22ee4edf6 mmc: replace host->card_busy
As card_busy was only used to indicate if the host was exclusively
claimed and not really used to identify a particular card, replacing
it with just a boolean makes things a lot more easily understandable.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:06 +01:00
Manuel Lauss 279bc44509 mmc: au1xmmc: return errors for unknown response types
au1xmmc: return error when encountering unhandled/unknown response type.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:06 +01:00
Manuel Lauss 82999770d6 mmc: au1xmmc: implement proper ro switch detection
au1xmmc: implement proper R/O switch detection.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-02-04 20:54:05 +01:00
Philip Langdale 6f949909e8 mmc: Correct definition of R6
During development of SDHC support, it was discovered that the definition
for R6 was incorrect. This patch fixes that and patches the drivers that
do switch on the response type.

Signed-off-by: Philip Langdale <philipl@overt.org>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: Pavel Pisa <ppisa@pikron.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-01-15 06:44:03 +01:00
Carlos Eduardo Aguiar 1b3b263184 omap: Update MMC response types
This patch is a fix in order to update MMC response types. This modification is
needed to allow SD card support on OMAP platforms.

Signed-off-by: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
Signed-off-by: Yuha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-01-15 06:39:00 +01:00
Linus Torvalds c70a1ce873 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
  MMC: at91 mmc linkage updates
  ARM: OMAP: fix MMC workqueue changes
2007-01-10 15:55:10 -08:00
Russell King e47c222b22 [ARM] Fix potential MMCI bug
The MMCI driver might end up aborting the initial command and leaving
the data part of the command sequence still in place.  Avoid this
problem by ensuring that any data sequence is properly cleared out
when a command completes.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-01-08 19:49:51 +00:00
David Brownell a26b498c96 MMC: at91 mmc linkage updates
Linker level tweaks for the AT91 MMC driver:

  - fix a wrongly-exported symbol
  - move probe() to init section
  - move remove() to exit section

When this driver is statically linked, this patch shrinks the driver's
runtime I-space footprint by over 20% (950 bytes).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-01-04 07:03:57 +01:00
Kyungmin Park 3947a3907f ARM: OMAP: fix MMC workqueue changes
fix OMAP MMC workqueue in recent workqueue change

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-01-04 07:03:38 +01:00
Andrew Victor 99eeb8dfb1 AT91 MMC update for 2.6.19
The driver is usable on the newer SAM9 processors so replace all text
references to AT91RM9200 with just AT91.

The controller bug where all the words are byte-swapped is fixed on the
AT91SAM9 processors.  The byte-swapping work-around therefore only needs
to be done if cpu_is_at91rm9200().
[Original patch from Wojtek Kaniewski]

The AT91RM9200 and AT91SAM9260 processors support two MMC/SD slots - the
slot which is connected is now passed via the platform_data and the
correct slot selected in the AT91_MCI_SDCR register.

The driver should not be calling at91_set_gpio_output() since the VCC
pin should have already been configured as an output in the
processor/board setup code.  The driver should call
at91_set_gpio_value().

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-11 12:43:35 +01:00
Pierre Ossman a98087cf81 mmc: Change SDHCI iomem error to a warning
Some controllers report an invalid iomem size, but seem to work
correctly anyway. Change our current error to just a warning and
hope it doesn't cause too much problems.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-11 09:48:42 +01:00
Vitaly Wool 7b30d281b9 mmc: fix "prev->state: 2 != TASK_RUNNING??" problem on SD/MMC card removal
Currently on SD/MMC card removal the system exhibits the following message (the platform is ARM Versatile):

    prev->state: 2 != TASK_RUNNING??
    mmcqd/762[CPU#0]: BUG in __schedule at linux-2.6/kernel/sched.c:3826

(akpm: someone tried to fix this, but it's still wrong)

Signed-off-by: Vitaly Wool <vitalywool@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-11 09:48:16 +01:00
Andrew Victor f3a8efa90b AT91 MMC 5 : Minor cleanups
A number of small cleanups to the AT91RM9200 MMC driver:
 - fix warnings generated by pr_debug().
 - prepend "AT91 MMC:" to printk() messages.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-11 09:47:21 +01:00
Andrew Victor df05a303e3 AT91 MMC 4 : Interrupt handler cleanup
This patch simplifies the AT91RM9200 MMC interrupt handler code so that
it doesn't re-read the Interrupt Status and Interrupt Mask registers
multiple times.

Also defined AT91_MCI_ERRORS instead of using the hard-coded 0xffff0000.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-11 09:47:12 +01:00
Andrew Victor 3dd3b039d4 AT91 MMC 3 : Move global mci_clk variable
Move the global 'mci_clk' variable into the local 'at91mci_host'
structure.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-11 09:47:02 +01:00