Commit graph android_kernel_sony_sdm845/drivers/mmc/core
Message SHA1
mmc: sdio_ops.c should #include "sdio_ops.h"
Every file should include the headers containing the externs for its
global functions.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Adrian Bunk   authored and   Pierre Ossman   commited 2008-04-18 20:05:33 +02:00
e70aa3fac1
mmc: proper prototypes for mmc_attach_*()
This patch adds proper prototypes for mmc_attach_*() in
drivers/mmc/core/core.h

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Adrian Bunk   authored and   Pierre Ossman   commited 2008-04-18 20:05:32 +02:00
98b843be56
mmc: make __mmc_release_bus() static
This patch makes the needlessly global __mmc_release_bus() static.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Adrian Bunk   authored and   Pierre Ossman   commited 2008-04-18 20:05:32 +02:00
261172fd1b
mmc: use shorter, equivalent set_current_state()
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Robert P. J. Day   authored and   Pierre Ossman   commited 2008-04-18 20:05:27 +02:00
6fee65cfde
mmc: set controller name early
Reorganise code so that mmc_hostname() works directly after allocation.
That way host drivers can use that name for resource allocations and
messages during probing.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2008-04-18 20:05:26 +02:00
ff3112f5ad
mmc: use sysfs groups to handle conditional attributes
Suppressing uevents turned out to be a bad idea as it screws up the
order of events, making user space very confused. Change the system to
use sysfs groups instead.

This is a regression that, for some odd reason, has gone unnoticed for
some time. It confuses hal so that the block devices (which have the
mmc device as a parent) are not registered. End result being that
desktop magic when cards are inserted won't work.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Pierre Ossman   authored and   Linus Torvalds   commited 2008-03-22 17:02:20 -07:00
51ec92e295
cleanup asm/scatterlist.h includes
Not architecture specific code should not #include <asm/scatterlist.h>.

This patch therefore either replaces them with
#include <linux/scatterlist.h> or simply removes them if they were
unused.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

Adrian Bunk   authored and   Jens Axboe   commited 2007-11-02 08:47:06 +01:00
87ae9afdca
mmc: use common byte swap macros
Use the more generic byte swapping macros instead of the socket variants.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-10-27 14:41:04 +02:00
1fa8dd146f
mmc: fix cid and csd byte order
MMC over SPI sends the CID and CSD registers as data, not responses,
which means that the host driver won't do the necessary byte flipping
for us.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-10-27 14:14:23 +02:00
78e480731a
mmc: possible leak in mmc_read_ext_csd
The exception path associated with an invalid ext_csd_struct returns
without freeing ext_csd.

Coverity CID 1909.

Signed-off-by: Florin Malita
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Florin Malita   authored and   Pierre Ossman   commited 2007-10-17 21:33:46 +02:00
00cedfa67b
uevent environment changes fallout
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Al Viro   authored and   Linus Torvalds   commited 2007-10-14 08:53:33 -07:00
7ac0326c3f
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (75 commits)
  PM: merge device power-management source files
  sysfs: add copyrights
  kobject: update the copyrights
  kset: add some kerneldoc to help describe what these strange things are
  Driver core: rename ktype_edd and ktype_efivar
  Driver core: rename ktype_driver
  Driver core: rename ktype_device
  Driver core: rename ktype_class
  driver core: remove subsystem_init()
  sysfs: move sysfs file poll implementation to sysfs_open_dirent
  sysfs: implement sysfs_open_dirent
  sysfs: move sysfs_dirent->s_children into sysfs_dirent->s_dir
  sysfs: make sysfs_root a regular directory dirent
  sysfs: open code sysfs_attach_dentry()
  sysfs: make s_elem an anonymous union
  sysfs: make bin attr open get active reference of parent too
  sysfs: kill unnecessary NULL pointer check in sysfs_release()
  sysfs: kill unnecessary sysfs_get() in open paths
  sysfs: reposition sysfs_dirent->s_mode.
  sysfs: kill sysfs_update_file()
  ...

Linus Torvalds   commited 2007-10-12 15:49:37 -07:00
efefc6eb38
Driver core: change add_uevent_var to use a struct
This changes the uevent buffer functions to use a struct instead of a
long list of parameters. It does no longer require the caller to do the
proper buffer termination and size accounting, which is currently wrong
in some places. It fixes a known bug where parts of the uevent
environment are overwritten because of wrong index calculations.

Many thanks to Mathieu Desnoyers for finding bugs and improving the
error handling.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Kay Sievers   authored and   Greg Kroah-Hartman   commited 2007-10-12 14:51:01 -07:00
7eff2e7a8b
mmc: use correct unregister function for led trigger
We register a simple trigger so make sure we use the corresponding
unregister function.

(Also means we get a dummy function when triggers aren't compiled in)

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-10-12 22:48:46 +02:00
77f1fd6ecd
sdio: make the IRQ thread more resilient in the presence of bad states
Currently we print a message about some bad states wrt function IRQ
handlers but return 0 from process_sdio_pending_irqs() nevertheless.
This can lead to an infinite loop as nothing might have cleared the
condition for the pending card interrupt from the host controller by
the time host->ops->enable_sdio_irq(host, 1) is called.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Nicolas Pitre   authored and   Pierre Ossman   commited 2007-10-06 17:51:45 +02:00
599473cf15
sdio: fix IRQ diagnostic message
If func is actually null we won't get much from sdio_func_id(func).

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Nicolas Pitre   authored and   Pierre Ossman   commited 2007-10-06 17:48:57 +02:00
3e01e4bcdd
sdio: adaptive interrupt polling
The interrupt polling frequency is a compromise between power usage and
interrupt latency. Unfortunately, it affects throughput rather severely
for devices which require an interrupt for every chunk of data.

By making the polling frequency adaptive, we get better throughput with
those devices without sacficing too much power. Polling will quickly
increase when there is an actual interrupt, and slowly fall back to the
idle frequency when the interrupts stop coming.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-27 10:48:29 +02:00
6f4285d133
mmc: add led trigger
Add a led trigger for each host controller that indicates if there
is a request active on the controller.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-24 07:15:48 +02:00
af8350c756
MMC core learns about SPI
Teach the MMC/SD/SDIO core about using SPI mode.

 - Use mmc_host_is_spi() so enumeration works through SPI signaling
   and protocols, not just the native versions.

 - Provide the SPI response type flags with each request issued,
   including requests from the new lock/unlock code.

 - Understand that cmd->resp[0] and mmc_get_status() results for SPI
   return different values than for "native" MMC/SD protocol; this
   affects resetting, checking card lock status, and some others.

 - Understand that some commands act a bit differently ... notably:
     * OP_COND command doesn't return the OCR
     * APP_CMD status doesn't have an R1_APP_CMD analogue

Those changes required some new and updated primitives:

 - Provide utilities to access two SPI-only requests, and one
   request that wasn't previously needed:
     * mmc_spi_read_ocr() ... SPI only
     * mmc_spi_set_crc() ... SPI only (override by module parm)
     * mmc_send_cid() ... for use without broadcast mode

 - Updated internal routines:
     * Previous mmc_send_csd() modified into mmc_send_cxd_native();
       it uses native "R2" responses, which include 16 bytes of data.
     * Previous mmc_send_ext_csd() becomes new mmc_send_cxd_data()
       helper for command-and-data access
     * Bugfix to that mmc_send_cxd_data() code:  dma-to-stack is
       unsafe/nonportable, so kmalloc a bounce buffer instead.

 - Modified mmc_send_ext_csd() now uses mmc_send_cxd_data() helper

 - Modified mmc_send_csd(), and new mmc_spi_send_cid(), routines use
   those helper routines based on whether they're native or SPI

The newest categories of cards supported by the MMC stack aren't expected
to work yet with SPI:  MMC or SD cards with over 4GB data, and SDIO.
All those cards support SPI mode, so eventually they should work too.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

David Brownell   authored and   Pierre Ossman   commited 2007-09-23 21:51:30 +02:00
af51715079
sdio: store vendor strings
Store vendor strings found in CISTPL_VERS_1 so that function drivers
can access them.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 21:28:01 +02:00
759bdc7af4
mmc: increase power up delay
Increase delay for power up in order to support some slower boards.

Also add some comments about why the delays are there.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 21:26:06 +02:00
f9996aee36
sdio: add sdio_f0_readb() and sdio_f0_writeb()
Add sdio_f0_readb() and sdio_f0_writeb() functions to reading and
writing function 0 registers.  Writes outside the vendor specific CCCR
registers (0xF0 - 0xFF) are not permitted.

Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

David Vrabel   authored and   Pierre Ossman   commited 2007-09-23 21:24:27 +02:00
7806cdb40f
mmc: replace BUG_ON with WARN_ON
Replace all cases of BUG_ON with WARN_ON where there is a chance
(with varying degrees of slim) that the kernel can continue without
incidence.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 21:23:07 +02:00
d84075c8ae
sdio: kmalloc + memset conversion to kzalloc
Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Mariusz Kozlowski   authored and   Pierre Ossman   commited 2007-09-23 21:22:45 +02:00
9f2fcf9939
sdio: extend sdio_readsb() and friends to handle any length of buffer
Extend sdio_readsb(), sdio_writesb(), sdio_memcpy_fromio(), and
sdio_memcpy_toio() to handle any length of buffer by splitting the transfer
into several IO_RW_EXTENDED commands. Typically, a transfer would be split
into a single block mode transfer followed by a byte mode transfer for the
remainder but we also handle lack of block mode support and the block size
being greater than 512 (the maximum byte mode transfer size).

host->max_seg_size <= host->max_req_size so there's no need to check both
when determining the maximum data size for a single command.

Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

David Vrabel   authored and   Pierre Ossman   commited 2007-09-23 21:21:32 +02:00
eb65946892
sdio: set the functions' block size
Before a driver is probed, set the function's block size to the default so the
driver is sure the block size is something sensible and it needn't explicitly
set it.

The default block size is the largest that's supported by both the card and
the host, with a maximum of 512 to ensure aribitrarily sized transfer use the
optimal (least) number of commands.

See http://lkml.org/lkml/2007/8/7/150 for reasons for the block size choice.

Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

David Vrabel   authored and   Pierre Ossman   commited 2007-09-23 21:19:26 +02:00
9a08f82b3c
sdio: add SDIO_FBR_BASE(f) macro
Signed-off-by: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

David Vrabel   authored and   Pierre Ossman   commited 2007-09-23 21:16:27 +02:00
7616ee95f2
mmc: fix sdio timeout calculation
SDIO doesn't have a CSD so it uses different timeout values than
SD memory.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 21:16:01 +02:00
e6f918bf39
mmc: fix incorrect divisor in debug output
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 21:15:45 +02:00
ce252edd86
sdio: enable wide bus mode
Enable 4-bit data bus mode, according to host and card
capabilities.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 21:15:16 +02:00
4ff6471c02
sdio: change clock speed
Change clock speed to the highest supported by the card.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 21:14:09 +02:00
6db5020e73
make struct sdio_dev_attrs[] static
On Wed, Jul 25, 2007 at 04:03:04AM -0700, Andrew Morton wrote:
>...
> Changes since 2.6.22-rc6-mm1:
>...
>  git-mmc.patch
>...
>  git trees
>...

sdio_dev_attrs[] can become static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Adrian Bunk   authored and   Pierre Ossman   commited 2007-09-23 21:13:32 +02:00
22bfc979d3
sdio: add interface for host side SDIO interrupt reporting
Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Nicolas Pitre   authored and   Pierre Ossman   commited 2007-09-23 21:13:08 +02:00
17b759aff9
sdio: support IO_RW_EXTENDED
Support the multi-byte transfer operation, including handlers for
common operations like writel()/readl().

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 21:09:34 +02:00
112c9db91e
sdio: core support for SDIO function interrupt
Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Nicolas Pitre   authored and   Pierre Ossman   commited 2007-09-23 21:01:33 +02:00
d1496c39e5
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>

Nicolas Pitre   authored and   Pierre Ossman   commited 2007-09-23 20:55:13 +02:00
2342f3323c
sdio: add basic sysfs attributes
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 20:54:15 +02:00
bcfe66e21e
sdio: add modalias support
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 20:53:33 +02:00
d59b66c7a5
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>

Pierre Ossman   commited 2007-09-23 20:52:20 +02:00
9eb3a94d02
sdio: add device id table and matching
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 20:51:27 +02:00
3b38bea0d9
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>

Nicolas Pitre   authored and   Pierre Ossman   commited 2007-09-23 20:45:39 +02:00
26074962e8
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>

Pierre Ossman   commited 2007-09-23 20:44:22 +02:00
1a632f8cdc
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>

Nicolas Pitre   authored and   Pierre Ossman   commited 2007-09-23 20:31:43 +02:00
b1538bcf75
sdio: initial CIS parsing code
Signed-off-by: Nicolas Pitre <npitre@mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Nicolas Pitre   authored and   Pierre Ossman   commited 2007-09-23 20:26:42 +02:00
b726126196
sdio: basic parsing of FBR
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 20:13:52 +02:00
0597007f1b
sdio: read and decode interesting parts of the CCCR
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 20:12:18 +02:00
35c66c1908
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>

Pierre Ossman   commited 2007-09-23 20:10:56 +02:00
fa64efa1f2
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>

Pierre Ossman   commited 2007-09-23 19:57:03 +02:00
46f555f273
mmc: add SDIO driver handling
Add basic driver handling to the SDIO device model.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 19:55:26 +02:00
f76c85154d
mmc: basic SDIO device model
Add the sdio bus type and basic device handling.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>

Pierre Ossman   commited 2007-09-23 19:45:31 +02:00
e29a7d73f4