Commit Graph

375 Commits (2342f3323c9a76367a1d7f9a35525ee3cb3911df)

Author SHA1 Message Date
Nicolas Pitre 2342f3323c sdio: allow for mmc_claim_host to be aborted
It is sometimes necessary to give up on trying to claim the host lock,
especially if that happens in a thread that has to be stopped.

While at it, fix the description for mmc_claim_host() which was wrong.

Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:55:13 +02:00
Pierre Ossman bcfe66e21e sdio: add basic sysfs attributes
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:54:15 +02:00
Pierre Ossman d59b66c7a5 sdio: add modalias support
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:53:33 +02:00
Pierre Ossman 9eb3a94d02 mmc: whip bus uevent handler into shape
Make the mmc bus uevent callback look like all other subsystems.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:52:20 +02:00
Pierre Ossman 3b38bea0d9 sdio: add device id table and matching
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:51:27 +02:00
Nicolas Pitre 26074962e8 mmc: initialize mmc subsystem with subsys_initcall()
The problem is that the sdio_bus must be registered before any SDIO
drivers are registered against it otherwise the kernel sulks.  Because
the sdio_bus registration happens through module_init (equivalent to
device_initcall), then any SDIO
drivers linked before the SDIO core code in the kernel will be initialized
first.

Upcoming SDIO function drivers are likely to be located outside the
drivers/mmc directory as it is common practice to group drivers according
to their function rather than the bus they use.  SDIO drivers are therefore
likely to appear at random location in the kernel link.

To make sure the sdio_bus is always initialized before any SDIO drivers,
let's move the MMC init to the subsys_initcall level.

Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:45:39 +02:00
Pierre Ossman 1a632f8cdc sdio: split up common and function CIS parsing
Add a more clean separation between global, common CIS information
and the function specific one as we need the common information in
places where no specific function is specified.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:44:22 +02:00
Nicolas Pitre b1538bcf75 sdio: link unknown CIS tuples to the sdio_func structure
This way those tuples that the core cares about are consumed by the core
code, and tuples that only function drivers might make sense of are
available to drivers.

Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:31:43 +02:00
Nicolas Pitre b726126196 sdio: initial CIS parsing code
Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:26:42 +02:00
Pierre Ossman 0597007f1b sdio: basic parsing of FBR
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:13:52 +02:00
Pierre Ossman 35c66c1908 sdio: read and decode interesting parts of the CCCR
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:12:18 +02:00
Pierre Ossman fa64efa1f2 mmc: enable/disable functions for SDIO
Like many other buses, the devices (functions) on the SDIO bus
must be enabled before they can be used. Add functions that allow
drivers to do so.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 20:10:56 +02:00
Pierre Ossman 46f555f273 mmc: add basic SDIO I/O operations
Add command wrappers that simplify register access from SDIO
function drivers.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 19:57:03 +02:00
Pierre Ossman f76c85154d mmc: add SDIO driver handling
Add basic driver handling to the SDIO device model.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 19:55:26 +02:00
Pierre Ossman e29a7d73f4 mmc: basic SDIO device model
Add the sdio bus type and basic device handling.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 19:45:31 +02:00
Pierre Ossman b2bcc798bb mmc: implement SDIO IO_RW_DIRECT operation
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 19:42:37 +02:00
Pierre Ossman 5c4e6f1301 mmc: detect SDIO cards
Really basic init sequence for SDIO cards.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 19:40:07 +02:00
Marc Pignat 1d4de9edd6 mmc: at91_mci: disable handling of blocks with size not multiple of 4 bytes
This kind of transfer is not supported, so don't advertise it and make it
fail early.

Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 19:29:34 +02:00
Pierre Ossman 8fdd8521dc mmc: add missing printk levels
Some printk:s were missing an explicit level.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 09:15:22 +02:00
Pierre Ossman be0192aae1 mmc: remove confusing flag
The MMC_DATA_MULTI flag never had a proper definition of what it
means, so remove it and let the drivers check the block count in
the request.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 09:15:12 +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 b146d26a61 mmc: mmc_set_data_timeout() parameter write is redundant
The write parameter in mmc_set_data_timeout() is redundant as the
data structure contains information about the direction of the
transfer.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 09:15:00 +02:00
Pierre Ossman d7604d7635 mmc: read ext_csd version number
Make sure we do not try to parse a structure we do not
understand.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 09:14:53 +02:00
Pierre Ossman adf66a0dc5 mmc: improve error code feedback
Now that we use "normal" error codes, improve the reporting and response
to error codes in the core.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-23 09:14:43 +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
Anti Sullin e0cda54e44 bug in AT91 MCI suspend routines
This patch fixes a bug in AT91 mmc host driver, that enables the wakeup
from suspend on card detection pin even if the card detect pin is not
available (==0). If not card detection pin is defined, IRQ0 == FIQ gets
enabled and if some activity is present on that pin, the system gets a
FIQ request, that causes a crash.

Signed-off-by: Anti Sullin <anti.sullin@artecdesign.ee>
Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-09-11 17:21:51 +02:00
Pierre Ossman b67ac3f339 sdhci: tell which spurious interrupt we got
When we get unexpected interrupts, also print which interrupt it was.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23 06:31:07 +02:00
Pierre Ossman e538fbe83e sdhci: handle data interrupts during command
It is fully legal for a controller to start issuing data related
interrupts before it has signalled that the command has completed.
Make sure the driver actually can handle this.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23 06:30:53 +02:00
David Vrabel 03f8590d90 mmc: ignore bad max block size in sdhci
Some SDHC cards report an invalid maximum block size, in these cases
assume they support block sizes up to 512 bytes instead of returning
an error.

Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23 06:27:50 +02:00
Pierre Ossman 2b06197340 sdhci: be more cautious about block count register
The block count register shouldn't be trusted for single block transfers,
so avoid using it completely when calculating transferred bytes.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23 06:27:44 +02:00
Mariusz Kozlowski be760a9de8 drivers/mmc/core/host.c: kmalloc + memset conversion to kzalloc
drivers/mmc/core/host.c | 3509 -> 3457 (-52 bytes)
 drivers/mmc/core/host.o | 92400 -> 92136 (-264 bytes)

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23 06:26:31 +02:00
Mariusz Kozlowski 733cb1e440 drivers/mmc/core/bus.c: kmalloc + memset conversion to kzalloc
drivers/mmc/core/bus.c | 5663 -> 5619 (-44 bytes)
 drivers/mmc/core/bus.o | 70899 -> 70731 (-168 bytes)

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-23 06:26:26 +02:00
Nicolas Ferre 37b758e8bc mmc: at91_mci: remove whitespace at the end of lines
Some cleanup with whitespace/tab at the end of lines.

Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-09 16:13:44 +02:00
Pierre Ossman aafabfab26 mmc: reorganize bounce buffer init
Reorganize the code that initializes mmc_block's bounce buffer in
order to avoid warnings when MMC_BLOCK_BOUNCE isn't used.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-09 14:37:17 +02:00
Gabriel C b3627bb19f wbsd: fix section mismatch warnings
This patch fixes the following section mismatch warnings

...

WARNING: vmlinux.o(.init.text+0x29d40): Section mismatch: reference to .exit.text:wbsd_release_resources (between 'wbsd_init' and 'wbsd_probe')
WARNING: vmlinux.o(.init.text+0x29d49): Section mismatch: reference to .exit.text:wbsd_free_mmc (between 'wbsd_init' and 'wbsd_probe')
WARNING: vmlinux.o(.init.text+0x29f28): Section mismatch: reference to .exit.text:wbsd_free_mmc (between 'wbsd_init' and 'wbsd_probe')

...

Signed-off-by: Gabriel Craciunescu <nix.or.die@googlemail.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-08-09 14:37:10 +02:00
Linus Torvalds d941cf5e37 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:
  drivers/mmc/core/: make 3 functions static
  mmc: add missing printk levels
  mmc: remove redundant debug information from sdhci and wbsd
  mmc: proper debugging output in core
  mmc: be more verbose about card insertions/removal
  mmc: Don't hold lock when releasing an added card
  mmc: add a might_sleep() to mmc_claim_host()
  mmc: update kerneldoc
  mmc: update header file paths
  sdhci: add support to ENE-CB714
  mmc: check error bits before command completion
2007-07-26 14:00:56 -07:00
Adrian Bunk 393618510d drivers/mmc/core/: make 3 functions static
This patch makes the following needlessly global functions static:
- sd_ops.c: mmc_app_cmd()
- core.c: __mmc_release_bus()
- core.c: mmc_start_request()

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 02:05:57 +02:00
Pierre Ossman facba9179e mmc: add missing printk levels
Some printk:s were missing an explicit level.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 02:05:49 +02:00
Pierre Ossman 462f104ba6 mmc: remove redundant debug information from sdhci and wbsd
Remove the extra debugging output that now is properly printed
by the core.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 02:05:39 +02:00
Pierre Ossman e4d2170874 mmc: proper debugging output in core
Make sure that the debugging output in the core is complete.
This should allow us to clean up all the extra debug output
that each and every other host driver seems to contain.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 02:05:30 +02:00
Pierre Ossman 109b5bed18 mmc: be more verbose about card insertions/removal
Let the user know that the kernel actually detected the card
by printing some basic information in dmesg.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 02:05:04 +02:00
Pierre Ossman 2986d0bf23 mmc: Don't hold lock when releasing an added card
When the card has been added to the device model, it might be bound
to a card driver. Therefore, we have to release the host lock when
trying to remove it as we otherwise might deadlock with the driver.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 01:54:06 +02:00
Pierre Ossman cf795bfb3a mmc: add a might_sleep() to mmc_claim_host()
In the normal case, the host lock can be claimed directly.
When it cannot, the caller will sleep. Make sure we don't
have any latent bugs by always calling might_sleep().

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 01:53:48 +02:00
Pierre Ossman 67a61c4847 mmc: update kerneldoc
Make sure the kerneldoc comments are up to date and relevant.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 01:53:39 +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
Leandro Dorileo b8352260d2 sdhci: add support to ENE-CB714
Added its pci_id and implemented a quirk for it because this
controller needs to reset cmd and data when setting ios.

Signed-off-by: Leandro Dorileo <dorileo@ossystems.com.br>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 01:53:09 +02:00
Pierre Ossman 43b58b36b7 mmc: check error bits before command completion
Some controllers signal "command complete" even on failures (which
they are allowed to do according to the spec). Make sure we check
the error bits first so we don't get any false positives.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-26 01:53:01 +02:00
Jens Axboe 165125e1e4 [BLOCK] Get rid of request_queue_t typedef
Some of the code has been gradually transitioned to using the proper
struct request_queue, but there's lots left. So do a full sweet of
the kernel and get rid of this typedef and replace its uses with
the proper type.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2007-07-24 09:28:11 +02:00
Pierre Ossman 964f9ce2ff sdhci: make sure to clear the error interrupt
The controller has a bit indicating that one of the higher bits (the
error bits) are set. A previous bug caused this bit to be masked, but
since that bug has been fixed we have to clear it explicictly.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-20 18:51:44 +02:00
Marc Pignat 63b6643886 mmc: at91_mci: wakeup on card insertion (or removal)
This piece of code enable the system to be wake-up by a card insertion or removal.

Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
Signed-off-by: Nicolas Ferre <nicolas.ferre@rfo.atmel.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2007-07-20 18:51:30 +02:00