Commit Graph

31 Commits

Author SHA1 Message Date
Timo Teras 63ef731aa6 MMC: Do not set unsupported bits in OCR response
The card might go to inactive state (according to specification), if
there are unsupported bits set in the OCR.

Signed-off-by: Timo Teras <timo.teras@solidboot.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-11-09 07:23:54 +01:00
Timo Teras 25a122fd0d MMC: Poll card status after rescanning cards
Some broken cards seem to process CMD1 even in stand-by state. The result is
that the card replies with ILLEGAL_COMMAND error for the next command sent
after rescanning. Currently the next command is select card, which would
return the error. But CMD7 does actually succeed and retries of the command
will timeout. The workaround is to poll card status after CMD1 to clear the
pending error.

Signed-off-by: Timo Teras <timo.teras@solidboot.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2006-11-09 07:23:37 +01:00
Pierre Ossman 7104e2d5a8 [PATCH] mmc: use own work queue
The MMC layer uses the standard work queue for doing card detection.  As this
queue is shared with other crucial subsystems, the effects of a long (and
perhaps buggy) detection can cause the system to be unusable.  E.g.  the
keyboard stops working while the detection routine is running.

The solution is to add a specific mmc work queue to run the detection code in.
This is similar to how other subsystems handle detection (a full kernel
thread is the most common theme).

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:15 -07:00
Russell King 132919ba80 [MMC] Remove data->blksz_bits member
data->blksz_bits is unused now - remove it.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-09-16 11:54:04 +01:00
Russell King d773d72551 [MMC] Cleanup 385e3227d4
Rather than having two places which independently calculate the
timeout for data transfers, make it a library function instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Pierre Ossman <drzeus@drzeus.cx>
2006-09-07 15:57:12 +01:00
Pierre Ossman 385e3227d4 [MMC] Fix SD timeout calculation
Secure Digital cards use a different algorithm to calculate the timeout
for data transfers. Using the MMC one works often, but not always.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-09-07 13:18:40 +01:00
Ingo Molnar 0afffc723c [PATCH] lockdep: annotate on-stack completions, mmc
lockdep needs to have the waitqueue lock initialized for on-stack
waitqueues implicitly initialized by DECLARE_COMPLETION().

Annotate mmc_wait_for_req()'s on-stack completion accordingly.

Has no effect on non-lockdep kernels.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Arjan van de Ven <arjan@linux.intel.com>
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-07-03 15:27:10 -07:00
Jörn Engel 6ab3d5624e Remove obsolete #include <linux/config.h>
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-30 19:25:36 +02:00
Pavel Pisa 2c171bf134 [ARM] 3531/1: i.MX/MX1 SD/MMC ensure, that clock are stopped before new command and cleanups
Patch from Pavel Pisa

There has been problems that for some paths that clock are not stopped
during new command programming and initiation. Result is issuing
of incorrect command to the card. Some other problems are cleaned too.
Noisy report of known ERRATUM #4 has been suppressed.

Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-05-19 21:48:03 +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 fe10c6abea [MMC] Correct mmc_request_done comments
mmc_request_done should be called at the end of handling a request, not
between the data and initial command parts of the request.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-05-04 13:51:45 +01:00
Russell King 37be4e7809 [MMC] extend data timeout for writes
The CSD contains a "read2write factor" which determines the multiplier to
be applied to the read timeout to obtain the write timeout.  We were
ignoring this parameter, resulting in the possibility for writes being
timed out too early.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-05-02 17:24:59 +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
Russell King e92251762d [MMC] Add MMC command type flags
Some hosts need to know the command type, so pass it via a set of
flags in cmd->flags.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-02-02 12:23:12 +00:00
Pierre Ossman cb757b4eef [MMC] Support MMC version 4 cards
Version 4 of the MMC specification increased the version number of the
CID structure. None of the fields changed though so the only required
change is adding '4' to the approved list.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-01-08 14:23:02 +00:00
Russell King a6f6c96b65 [MMC] Improve MMC card block size selection
Select a block size for IO based on the read and write block size
combinations, and whether the card supports partial block reads
and/or partial block writes.

If we are able to satisfy block reads but not block writes, mark
the device read only.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2006-01-03 22:38:44 +00:00
Russell King 45f8245b97 [MMC] Explain the internals of mmc_power_up()
It seems that people get confused about what is happening in
mmc_power_up().  Add a comment to make it clear why we have
a two stage process.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-12-14 14:57:35 +00:00
Pierre Ossman e781de4415 [MMC] Proper check of SCR error code
The routine reading the SCR wasn't paying proper attention to the
error codes returned from the driver.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-12-05 10:00:50 +00:00
Pierre Ossman 24117defab [MMC] Fix protocol errors
A review against MMC/SD specifications found some errors in the current
implementation.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-11-28 21:00:29 +00:00
Uli Luckas 896937ad5c [ARM] 3120/1: Fix MMC/SD card driver resume deadlock
Patch from Uli Luckas

This is a simplification of patch 3116/1 as sugested by Russell King.

Signed-off-by: Uli Luckas <u.luckas@road-gmbh.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-11-07 21:22:07 +00:00
Richard Purdie 8dc003359c [MMC] Allow detection/removal to be delayed
Change mmc_detect_change() to take a delay argument such that
the detection of card insertions and removals can be delayed
according to the requirements of the host driver or platform.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-09-08 17:53:01 +01:00
Pierre Ossman 5b4fd9aef7 [PATCH] sd: SD copyright notice
Credit where credit is due.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 16:57:51 -07:00
Pierre Ossman f218278a45 [PATCH] sd: SD 4-bit bus
Infrastructure for 4-bit bus transfers with SD cards.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 16:57:51 -07:00
Pierre Ossman b57c43ad81 [PATCH] sd: SCR register
Read the SD specific SCR register from the card.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 16:57:50 -07:00
Pierre Ossman a00fc09029 [PATCH] sd: read-only switch
Support for the read-only switch on SD cards which must be enforced by the
host.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 16:57:50 -07:00
Pierre Ossman 335eadf2ef [PATCH] sd: initialize SD cards
Support for the Secure Digital protocol in the MMC layer.

A summary of the legal issues surrounding SD cards, as understood by yours
truly:

Members of the Secure Digital Association, hereafter SDA, are required to sign
a NDA[1] before given access to any specifications.  It has been speculated
that including an SD implementation would forbid these members to redistribute
Linux.  This is the basic problem with SD support so it is unclear if it even
is a problem since it has no effect on those of us that aren't members.

The SDA doesn't seem to enforce these rules though since the patches included
here are based on documentation made public by some of the members.  The most
complete specs[2] are actually released by Sandisk, one of the founding
companies of the SDA.

Because of this the NDA is considered a non-issue by most involved in the
discussions concerning these patches.  It might be that the SDA is only
interested in protecting the so called "secure" bits of SD, which so far
hasn't been found in any public spec.  (The card is split into two sections,
one "normal" and one "secure" which has an access scheme similar to TPM:s).

(As a side note, Microsoft is working to make things easier for us since they
want to be able to include the source code for a SD driver in one of their
development kits.  HP is making sure that the new NDA will allow a Linux
implementation.  So far only the SDIO specs have been opened up[3].  More will
hopefully follow.)

 [1] http://www.sdcard.org/membership/images/ippolicy.pdf
 [2] http://www.sandisk.com/pdf/oem/ProdManualSDCardv1.9.pdf
 [3] http://www.sdcard.org/sdio/Simplified%20SDIO%20Card%20Specification.pdf

This patch contains the central parts of the SD support.  If no MMC cards are
found on a bus then the MMC layer proceeds looking for SD cards.  Helper
functions are extended to handle the special needs of SD cards.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 16:57:50 -07:00
Pierre Ossman 865e9f13c9 [MMC] ios for mmc chip select
Adds a new ios for setting the chip select pin on MMC cards. Needed on
SD controllers which use this pin for other things and therefore cannot
have it pulled high at all times.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-09-03 16:45:02 +01:00
Russell King 00b137cfda [MMC] Add MMC class devices
Create a mmc_host class to allow enumeration of MMC host controllers
even though they have no card(s) inserted.

Patch based on work by Pierre Ossman.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-08-19 09:41:24 +01:00
Russell King d366b64363 [MMC] Add mmc_hostname() macro
mmc_hostname() returns a pointer to the hostname for the mmc_host.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2005-08-19 09:40:08 +01:00
Pavel Machek e5378ca8c0 [PATCH] fix u32 vs. pm_message_t in drivers/mmc,mtd,scsi
This fixes u32 vs.  pm_message_t in drivers/mmc, drivers/mtd and
drivers/scsi.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-04-16 15:25:29 -07:00
Linus Torvalds 1da177e4c3 Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
2005-04-16 15:20:36 -07:00