Archived
14
0
Fork 0
Commit graph

51 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Pierre Ossman
077df88483 mmc: sdhci high speed support
The SDHCI spec implies that is is incorrect to set a clock
frequency above 25 MHz without setting the high speed bit.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-01 18:54:10 +01:00
David Brownell
ab7aefd0b3 mmc: constify mmc_host_ops vectors
Now that mmc_host_ops can be constified, update the various drivers
to constify those method tables and shrink the writable data segment.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-12-01 17:58:53 +01:00
Al Viro
e4cad1b5a4 [PATCH] passing pointer to setup_timer() should be via unsigned long
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-10 15:37:22 -07:00
David Howells
7d12e780e0 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

	struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

	set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.

 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.

 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:10:12 +01:00
Pierre Ossman
8a4da1430f [PATCH] mmc: avoid some resets without card
Some Ricoh controllers only respect a full reset when there is no card in the
slot.  As we wait for the reset to complete, we must avoid even requesting
those resets on the buggy controllers.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-04 07:55:14 -07:00
Pierre Ossman
5f25a66f6b [PATCH] mmc: fix MMIO vs memory races in sdhci
Sprinkle some mmiowb() where needed (writeX() before unlock()).

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-04 07:55:14 -07:00
Pierre Ossman
643f720cea [PATCH] mmc (mainly): add "or later" clause to licence statement.
Clarify my (Pierre's) position on which GPL versions apply.  The patch only
touches the source files where I am the only major author.  The people who
have made the minor commits to the files have been contacted and have no
issues with this change.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-01 00:39:23 -07:00
Russell King
42431acbac [MMC] MMC_CAP_BYTEBLOCK flag for non-log2 block sizes capable hosts
Some MMC hosts can only handle log2 block sizes.  Unfortunately,
the MMC password support needs to be able to send non-log2 block
sizes.  Provide a capability so that the MMC password support can
decide whether it should use this support or not.

The unfortunate side effect of this host limitation is that any
MMC card protected by a password which is not a log2 block size
can not be accessed on a host which only allows a log2 block size.

This change just adds the flag.  The MMC password support code
needs updating to use it (if and when it is finally submitted.)

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-09-24 10:44:09 +01:00
Russell King
db53f28b3a [MMC] Add multi block-write capability
Add a capability flag for drivers to set when they can perform multi-
block transfers to cards _and_ correctly report the number of bytes
transferred should an error occur.

The last point is very important - if a driver reports more bytes than
were actually accepted by the card and an error occurs, there is the
possibility for data loss.

Pierre Ossman provided the patch for wbsd and sdhci.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-09-16 11:57:49 +01:00
Pierre Ossman
8b1b21853b [MMC] Change SDHCI version error to a warning
O2 Micro's controllers have a larger specification version value and are
therefore denied by the driver. When bypassing this check they seem to work
fine. This patch makes the code a bit more forgiving by changing the error
to a warning.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-13 16:17:46 +01:00
Pierre Ossman
fb61e28951 [MMC] Fix incorrect register access
There was a writel() being used on a 16-bit register.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-13 16:17:45 +01:00
Linus Torvalds
f82bc1762e Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-mmc
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-mmc:
  [MMC] sdhci: remove duplicate error message
  [MMC] sdhci: force DMA on some controllers
  [MMC] sdhci: quirk for broken reset
  [MMC] sdhci: Add SDHCI controller ids
2006-07-02 16:35:07 -07:00
Linus Torvalds
168d04b3b4 Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-mmc
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-mmc:
  [MMC] sdhci: version bump sdhci
  [MMC] sdhci: support controller specific quirks
  [MMC] sdhci: more DMA capabilities tests
  [MMC] sdhci: reset sdhci controller early
  [MMC] sdhci: check controller version
  [MMC] sdhci: check only relevant inhibit bits
  [MMC] sdhci: Test for invalid block size
  [MMC] sdhci: Avoid sdhci DMA boundaries
  [MMC] Fix sdhci PIO routines
  [MMC] sdhci: fix interrupt handling
  [MMC] sdhci: correct register order
  [MMC] sdhci: proper timeout handling
  [MMC] sdhci: fix sdhci reset timeout
  [MMC] sdhci: fix timeout loops in sdhci
  [MMC] sdhci: support for multiple voltages
  [MMC] sdhci: print device id
  [MMC] sdhci: check SDHCI base clock
2006-07-02 14:58:03 -07:00
Thomas Gleixner
dace145374 [PATCH] irq-flags: misc drivers: Use the new IRQF_ constants
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-02 13:58:50 -07:00
Pierre Ossman
4cca56c504 [MMC] sdhci: remove duplicate error message
When there is remaining blocks untransferred, we get two error messages saying
almost the same thing.  Make sure at most one is shown.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 18:02:02 +01:00
Pierre Ossman
98608076a2 [MMC] sdhci: force DMA on some controllers
Some controllers incorrectly report that the cannot do DMA.  Forcefully enable
it for those that we know it works fine on.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 18:02:01 +01:00
Pierre Ossman
645289dca5 [MMC] sdhci: quirk for broken reset
Some controllers fail to complete a reset unless you touch the clock register
first.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 18:02:00 +01:00
Pierre Ossman
2c5f394025 [MMC] sdhci: version bump sdhci
New version number for sdhci driver.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:55:00 +01:00
Pierre Ossman
df673b227c [MMC] sdhci: support controller specific quirks
As some specific controllers will have bugs, we need a way to map special
behaviour to certain hardware.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:54:59 +01:00
Pierre Ossman
6743527441 [MMC] sdhci: more DMA capabilities tests
Properly test for controller interface to see if it's DMA capable.  As many
controllers are misconfigured in this regard, also add debug parameters to
force DMA support either way.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:54:56 +01:00
Pierre Ossman
d96649ed5a [MMC] sdhci: reset sdhci controller early
The specification states that the capabilities register might need a reset to
get correct values after boot up.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:54:54 +01:00
Pierre Ossman
4a9655051f [MMC] sdhci: check controller version
Check the interface version of the controller and bail out if it's an unknown
version.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:54:53 +01:00
Pierre Ossman
fd2208d7c7 [MMC] sdhci: check only relevant inhibit bits
Conform to the sdhci specification as to which inhibit bits should be checked
at different times.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:54:50 +01:00
Pierre Ossman
1d676e0297 [MMC] sdhci: Test for invalid block size
The controller has an upper limit on the block size. Make sure we do not
cross it.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:52:10 +01:00
Pierre Ossman
bab7696184 [MMC] sdhci: Avoid sdhci DMA boundaries
The sdhci controllers will issue an interrupt when a configurable number of
bytes have been transfered using DMA. The purpose is to handle multiple,
scattered memory pages.

Unfortunately, it requires that all transfers are completely aligned to
memory pages, which we cannot guarantee. So we just disable the function.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:51:35 +01:00
Pierre Ossman
a406f5a3b6 [MMC] Fix sdhci PIO routines
The sdhci controllers operate with blocks, not bytes. The PIO routines must
therefore make sure that the minimum unit transfered is a complete block.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:50:59 +01:00
Pierre Ossman
3192a28f7d [MMC] sdhci: fix interrupt handling
The specification says that interrupts should be cleared before the source is
removed.  We should also not set unknown bits.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:02:05 +01:00
Pierre Ossman
c7fa9963ee [MMC] sdhci: correct register order
The sdhci specification states that some registers must be written to in a
specific order.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:02:04 +01:00
Pierre Ossman
1c8cde92fa [MMC] sdhci: proper timeout handling
Use the give timeout clock and calculate a proper timeout instead of using the
maximum at all times.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:02:04 +01:00
Pierre Ossman
e16514d8d8 [MMC] sdhci: fix sdhci reset timeout
The reset register is automatically cleared when the reset has completed.
Hence, we should busy wait and not have a fixed delay.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:02:03 +01:00
Pierre Ossman
7cb2c76fa2 [MMC] sdhci: fix timeout loops in sdhci
The current timeout loop assume that jiffies are updated.  This might not be
the case depending on locks and if the kernel is compiled without preemption.
Change the system to use a counter and fixed delays.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:02:02 +01:00
Pierre Ossman
146ad66eac [MMC] sdhci: support for multiple voltages
The sdhci controllers can support up to three voltage levels.  Detect which
and report back to the MMC layer.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:02:01 +01:00
Pierre Ossman
51f82bc07a [MMC] sdhci: print device id
As sdhci is a generic driver, it is helpful to see some more specific
identification of the actual hardware in dmesg.  PCI vendor, device and
revision is sufficient in most cases.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:02:01 +01:00
Pierre Ossman
8ef1a14379 [MMC] sdhci: check SDHCI base clock
A base clock value of 0 means that the driver must get the base clock through
some other means.  As we have no other way of getting it, we must abort.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-07-02 16:01:59 +01:00
Russell King
a3fd4a1b9c [MMC] Convert all hosts except mmci to use data->blksz
The MMC specification allows non-power of two block sizes.  As such,
we should not pass the log2 block size to host drivers, but instead
pass the byte size.

However, ARM MMCI can only work with log2 block size, so continue to
pass both the log2 block size and byte block size.  This means that
for the moment, the byte block size must remain a power of two, but
this is the first stage of removing this restriction for other hosts.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-06-19 13:05:08 +01:00
Andrew Morton
e474c66b1c [MMC] sdhci truncated pointer fix
On 64-bit machines, we just lost the uppermost 32 bits.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-06-12 22:10:22 +01:00
Russell King
920e70c5c6 [MMC] Move set_ios debugging into mmc.c
Rather than having every driver duplicate the set_ios debugging,
provide a single version in mmc.c which can be expanded as we
add additional functionality.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-05-04 18:22:51 +01:00
Russell King
c65631781e [MMC] Pass -DDEBUG on compiler command line if MMC_DEBUG selected
Rather than each driver test MMC_DEBUG itself, and define DEBUG,
pass it in via the makefile instead.

Fix drivers to use pr_debug() where appropriate, and avoid defining
a DEBUG() macro.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-03-29 09:30:20 +01:00