History log of /drivers/mmc/host/mmc_spi.c
Revision Date Author Comments
6601056a96034fa08120b10b8dc728f213f91ec4 24-Nov-2011 Lars-Peter Clausen <lars@metafoo.de> mmc: Remove redundant spi driver bus initialization

In ancient times it was necessary to manually initialize the bus field of an
spi_driver to spi_bus_type. These days this is done in spi_driver_register(),
so we can drop the manual assignment.

The patch was generated using the following coccinelle semantic patch:
// <smpl>
@@
identifier _driver;
@@
struct spi_driver _driver = {
.driver = {
- .bus = &spi_bus_type,
},
};
// </smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
88b47679746b81534002bcba42da97ab82b5d12a 03-Jul-2011 Paul Gortmaker <paul.gortmaker@windriver.com> mmc: Add module.h to drivers/mmc users assuming implicit presence.

We are cleaning up the implicit presence of module.h; these guys are
some of the people who just assume it will be there. Call it out
explitly for those that really need it.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
25985edcedea6396277003854657b5f3cb31a628 31-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi> Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
c9e358dfc4a8cb2227172ef77908c2e0ee17bcb9 21-Jan-2011 Grant Likely <grant.likely@secretlab.ca> driver-core: remove conditionals around devicetree pointers

Having conditional around the of_match_table and the of_node pointers
turns out to make driver code use ugly #ifdef blocks. Drop the
conditionals and remove the #ifdef blocks from the affected drivers.

Also tidy up minor whitespace issues within the same hunks.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
061c6c847eeb11743e489a16e907b41c6f9042b6 12-Jul-2010 Sonic Zhang <sonic.zhang@analog.com> mmc_spi: Recover from CRC errors for r/w operation over SPI.

The SPI bus is not reliable for large data transfers on all platforms.
The current mmc_spi driver fails SD read/write commands immediately if
occasional CRC errors are reported by the SD device. This patch makes
the operation recover from CRC errors by repeating the last SD command.
The retry count is set to 5 to ensure the driver passes stress tests.

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
a36274e0184193e393fb82957925c3981a6b0477 10-Sep-2010 Martin K. Petersen <martin.petersen@oracle.com> mmc: Remove distinction between hw and phys segments

We have deprecated the distinction between hardware and physical
segments in the block layer. Consolidate the two limits into one in
drivers/mmc/.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
fbe0f8348fd6c3d016a3f48756eb729b41a67c22 08-Aug-2010 Anton Vorontsov <avorontsov@mvista.com> mmc_spi: Fix unterminated of_match_table

commit 2ffe8c5f323c3b9749bf7bc2375d909d20bdbb15 ("of: refactor
of_modalias_node() and remove explicit match table"), introduced
an unterminated of_match_table, which may cause kernel to oops.

This patch fixes the issue by adding an empty device ID.

Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2ffe8c5f323c3b9749bf7bc2375d909d20bdbb15 08-Jun-2010 Grant Likely <grant.likely@secretlab.ca> of: refactor of_modalias_node() and remove explicit match table.

This patch tightens up the behaviour of of_modalias_node() to be more
predicatable and to eliminate the explicit of_modalias_tablep[] that
is currently used to override the first entry in the compatible list
of a device. The override table was needed originally because spi
and i2c drivers had no way to do of-style matching. Now that all
devices can have an of_node pointer, and all drivers can have an
of_match_table, the explicit override table is no longer needed
because each driver can specify its own OF-style match data.

The mpc8349emitx-mcu driver is modified to explicitly specify the
correct device to bind against.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
4751c1c74bc7b596db5de0c93be1a22a570145c0 18-Feb-2010 Ernst Schwab <eschwab@online.de> spi/mmc_spi: mmc_spi adaptations for SPI bus locking API

Modification of the mmc_spi driver to use the SPI bus locking API.
With this, the mmc_spi driver can be used together with other SPI
devices on the same SPI bus. The exclusive access to the SPI bus is
now managed in the SPI layer. The counting of chip selects in the probe
function is no longer needed.

Signed-off-by: Ernst Schwab <eschwab@online.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Matt Fleming <matt@console-pimps.org>
Tested-by: Antonio Ospite <ospite@studenti.unina.it>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
e0626e3844e8f430fc1a4417f523a00797df7ca6 23-Sep-2009 Anton Vorontsov <avorontsov@ru.mvista.com> spi: prefix modalias with "spi:"

This makes it consistent with other buses (platform, i2c, vio, ...). I'm
not sure why we use the prefixes, but there must be a reason.

This was easy enough to do it, and I did it.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Dmitry Torokhov <dtor@mail.ru>
Cc: Samuel Ortiz <sameo@openedhand.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Acked-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
70d6027ff2bc8bab180273b77e7ab3e8a62cca51 30-Jun-2009 David Brownell <dbrownell@users.sourceforge.net> spi: add spi_master flag word

Add a new spi_master.flags word listing constraints relevant to that
controller. Define the first constraint bit: a half duplex restriction.
Include that constraint in the OMAP1 MicroWire controller driver.

Have the mmc_spi host be the first customer of this flag. Its coding
relies heavily on full duplex transfers, so it must fail when the
underlying controller driver won't perform them.

(The spi_write_then_read routine could use it too: use the
temporarily-withdrawn full-duplex speedup unless this flag is set, in
which case the existing code applies. Similarly, any spi_master
implementing only SPI_3WIRE should set the flag.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fdd858db7113ca64132de390188d7ca00701013d 26-May-2009 Wolfgang Muees <wolfgang.mues@auerswald.de> mmc_spi: don't use EINVAL for possible transmission errors

This patch changes the reported error code for the responses
to a command from EINVAL to EFAULT/ENOSYS, as EINVAL is reserved
for non-recoverable host errors, and the responses from
the SD/MMC card may be because of recoverable transmission
errors in the command or in the response. Response codes
in SPI mode are NOT protected by a checksum, so don't trust them.

Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de>
Acked-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
5cf20aa557e8f9dd5af302b8f33972082479753a 08-Apr-2009 Wolfgang Muees <wolfgang.mues@auerswald.de> mmc_spi: speedup for slow cards, less wear-out

Speedup for slow cards by transfering more data at once.
This patch also reduces the amount of wear-out of the flash
blocks because fewer partial blocks are written.

Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
ab5a643cf597f2214feb6ff7288c72589661bde1 08-Apr-2009 Wolfgang Muees <wolfgang.mues@auerswald.de> mmc_spi: support for non-byte-aligned cards

A very large subset of SD cards in the market send their
responses and data non-byte-aligned. So add logic to the
mmc spi driver to handle this mess.

Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
56e303ebeec7ef43dbd9d7998f8ad1a9f75d59bc 07-Apr-2009 Wolfgang Muees <wolfgang.mues@auerswald.de> mmc_spi: convert timeout handling to jiffies and avoid busy waiting

SD/MMC card timeouts can be very high. So avoid busy-waiting,
using the scheduler. Calculate all timeouts in jiffies units,
because this will give us the correct sign when to involve
the scheduler.

Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
f079a8fc61e3dc35830f6abc58c21ae815ab4297 16-Mar-2009 Wolfgang Muees <wolfgang.mues@auerswald.de> mmc_spi: adjust for delayed data token response

Some cards are not able to send the data token in time, but
miss the time frame for some bits(!). So synchronize to the
start of the token.

Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
ea15ba5cd7bb370902cd9f6a73c2d288bfba6b2c 11-Mar-2009 Wolfgang Muees <wolfgang.mues@auerswald.de> mmc_spi: wait more bytes for card response

Some cards are slower than the standard allows and need more
time to respond to a command. Max. observed number of bytes
was 12.

Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
48881caec426786cd451383ee53943cc5d3bfdeb 11-Mar-2009 Wolfgang Muees <wolfgang.mues@auerswald.de> mmc_spi: allow setting of spi mode 3

Allow the platform data structures to specify spi mode 3
(if there is a pullup on the clock line or the spi hardware
is not able to serve spi mode 0).

Signed-off-by: Wolfgang Muees <wolfgang.mues@auerswald.de>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
9c43df57910bbba540a6cb5c9132302a9ea5f41a 30-Dec-2008 Anton Vorontsov <avorontsov@ru.mvista.com> mmc_spi: Add support for OpenFirmware bindings

The support is implemented via platform data accessors, new module
(of_mmc_spi) will be created automatically when the driver compiles
on OpenFirmware platforms. Link-time dependency will load the module
automatically.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
d1b268630875a7713b5d468a0c03403c5b721c8e 08-Nov-2008 Kay Sievers <kay.sievers@vrfy.org> mmc: struct device - replace bus_id with dev_name(), dev_set_name()

Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-Off-By: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
162350eb75fcb81ec0ea34f042f1deddb759aea8 02-Oct-2008 Matthew Fleming <matthew.fleming@imgtec.com> MMC: Use timeout values from CSR

Hard-coded timeout values of 250ms for writes and 100ms for reads are
currently used for MMC transactions over SPI. The spec states that the
timeout values from the card should be used.

Signed-off-by: Matthew Fleming <matthew.fleming@imgtec.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
1685a03e98b7e9b83e0aa692c1cc470b3aa37597 24-Jul-2008 Jan Nikitenko <jan.nikitenko@gmail.com> mmc_spi: put signals to low power off fix

The original intention was to write a zero byte to mmc to force spi
signals to low when doing power off. Somehow the spi_w8r8 call got there
so a read followed the write of single zero byte. This patch changes
that to simple write of zero byte without the following read.
This way the power off is more reliable and completely sufficient.

Signed-off-by: Jan Nikitenko <jan.nikitenko@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
23af60398af2f5033e2f53665538a09f498dbc03 06-Jul-2008 Pierre Ossman <drzeus@drzeus.cx> mmc: remove multiwrite capability

Relax requirements on host controllers and only require that they do not
report a transfer count than is larger than the actual one (i.e. a lower
value is okay). This is how many other parts of the kernel behaves so
upper layers should already be prepared to handle that scenario. This
gives us a performance boost on MMC cards.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
08f80bb5196517a0dfe50dc7c10f234c0ff2f0e8 17-Jun-2008 Anton Vorontsov <avorontsov@ru.mvista.com> mmc: change .get_ro() callback semantics

Now get_ro() callback must return 0/1 values for its logical states, and
negative errno values in case of error. If particular host instance doesn't
support RO/WP switch, it should return -ENOSYS.

This patch changes some hosts in two ways:

1. Now functions should be smart to not return negative values in
"RO asserted" case (particularly gpio_ calls could return negative
values for the outermost GPIOs).

Also, board code usually passes get_ro() callbacks that directly return
gpioreg & bit result, so at91_mci, imxmmc, pxamci and mmc_spi's get_ro()
handlers need take special care when returning platform's values to the
mmc core.

2. In case of host instance didn't implement get_ro() callback, it should
really return -ENOSYS and let the mmc core decide what to do about it
(mmc core thinks the same way as the hosts, so it isn't functional
change).

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
619ef4b42128709de4d89d209b2c874f560deecd 17-Jun-2008 Anton Vorontsov <avorontsov@ru.mvista.com> mmc_spi: add support for card-detection polling

This patch adds new platform data variable "caps", so platforms
could pass theirs capabilities into MMC core (for example, platforms
without interrupt on the CD line will most probably want to pass
MMC_CAP_NEEDS_POLL).

New platform get_cd() callback provided to optimize polling.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
48b2cf9e2921581c3f72295397da07673cdde072 29-Apr-2008 Harvey Harrison <harvey.harrison@gmail.com> mmc: use get/put_unaligned_* helpers

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Tony Jones <tonyj@suse.de>
Cc: Pierre Ossman <drzeus@drzeus.cx>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
c24b2602af88db4489c6c3fb4b2a8e47fb15769b 05-Dec-2007 Marc Pignat <marc.pignat@hevs.ch> spi: use simplified spi_sync() calling convention

Given the patch which simplifies the spi_sync calling convention, this one
updates the callers of that routine which tried using it according to the
previous specification. (Most didn't.)

Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
460cd0589df8aa9b89599905b13c2010db627012 27-Oct-2007 David Brownell <david-b@pacbell.net> mmc_spi: Fix mmc-over-spi regression

Patch 49dce689ad4ef0fd1f970ef762168e4bd46f69a3 changed the sysfs data
structures for SPI in a way which broke the MMC-over-SPI host driver.

This patch fixes that regression by changing the scheme used to keep
from knowingly trying to use a shared bus segment, and updates the
adjacent comments slightly to better explain the issue.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
45711f1af6eff1a6d010703b4862e0d2b9afd056 22-Oct-2007 Jens Axboe <jens.axboe@oracle.com> [SG] Update drivers to use sg helpers

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
e5712a6a98862c2bd58a3c1ffc88062da9e2f02c 17-Oct-2007 Al Viro <viro@ftp.linux.org.uk> missing include in mmc

AFAICS, fallout from repacing include of blkdev.h with include of bio.h.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
49dce689ad4ef0fd1f970ef762168e4bd46f69a3 16-Oct-2007 Tony Jones <tonyj@suse.de> spi doesn't need class_device

Make the SPI framework and drivers stop using class_device. Update docs
accordingly ... highlighting just which sysfs paths should be
"safe"/stable.

Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
23fd50450a34f2558070ceabb0bfebc1c9604af5 14-Oct-2007 David Brownell <david-b@pacbell.net> Fix compile while compiling drivers/mmc/host/mmc_spi.o with !BLOCK

Make sure the mmc_spi driver can build without CONFIG_BLOCK.
Issue noted by "Avuton Olrich" <avuton@gmail.com> and randconfig.

While that won't be a common configuration, sometimes embedded
boards use SDIO to interface WLAN or Bluetooth chips (vs some
parallel interface), and don't provide an MMC/SD socket for use
with flash memory cards.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15a0580ced081a0f7dc2deea8a4812bdc5e9a109 08-Aug-2007 David Brownell <david-b@pacbell.net> mmc_spi host driver

This is the latest version of the MMC-over-SPI support. It works
on 2.6.23-rc2 plus git-mmc (from rc1-mm2), along with the preceding
patches which teach the rest of the MMC stack about SPI.

The main issue of note is that sometimes cards need to be power cycled
to recover after certain faults. Also, it may sometimes be necessary
to disable CRCs. ("modprobe mmc_core use_spi_crc=n")

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: mikael.starvik@axis.com,
Cc: Hans-Peter Nilsson <hp@axis.com>
Cc: Jan Nikitenko <jan.nikitenko@gmail.com>
Cc: Mike Lavender <mike@steroidmicros.com>
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>