9
0
Fork 0
Commit Graph

30 Commits

Author SHA1 Message Date
Juergen Beisert 82db23d3f4 Use generic block layer to access the drives and do partition parsing
Change all relevant blockdevice users to the simplified interface.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-28 09:23:24 +01:00
Franck Jullien 2aad209b78 mci: Add MCI over SPI support
This patch adds MMC over SPI support to mci-core.c and
mci_spi.c driver.

This driver is useful when SOC doesn't have built-in MCI
component. Tested with nios, 2Go SD-CARD and FAT file system.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-25 12:38:29 +01:00
Sascha Hauer 50a62491c5 mci: remove unnecessary loops
We used to loop around the sectors in mci_sd_write/mci_sd_read.
Now that we have multi block read and write this is not necessary
anymore.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-11 12:58:24 +01:00
Sascha Hauer a2ca100344 mci: implement multi block write
This speeds up writes to MMC/SD cards significantly.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-11-11 12:58:18 +01:00
Robert Schwebel c3d7a97726 mci-core: fix typo for pr_warn
It is pr_warning(), not pr_warn().

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-10-12 08:50:28 +02:00
Sascha Hauer c41360cd20 mci: parent fixups
Make the mci host a child of the hardware device and the disk
a child of the mci host.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-17 09:36:30 +02:00
Sascha Hauer 31c88a6929 mci: embed mci_dev into mci_host instead of allocating it seperately
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-08-15 09:48:03 +02:00
Jean-Christophe PLAGNIOL-VILLARD 6e2e7a67f2 mci-core: switch to resource
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2011-07-30 02:05:27 +08:00
Sascha Hauer 8f24f965e1 mci: do not use unitialized resource
disk_dev->resource is unitialized. Do not use it. This
got broken in:

commit 4c542622cb
Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Date:   Mon Jul 18 20:17:04 2011 +0800

    mci: switch to "struct resource"

    Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-07-29 12:03:38 +02:00
Jean-Christophe PLAGNIOL-VILLARD 4c542622cb mci: switch to "struct resource"
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2011-07-23 13:52:17 +08:00
Hubert Feurstein d1c02cfcec mci-core: add missing newline in debug message
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-06-01 14:52:31 +02:00
Sascha Hauer 0f16a03b00 mci: turn several pr_* statements into debug
These are mostly useful for developers, so turn them off by default.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-05-06 08:35:59 +02:00
Sascha Hauer 3af51e9edd mci: shrink string footprint
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-05-06 08:34:15 +02:00
Sascha Hauer 342c8de8f5 mci-core: fix debug statements
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-12 10:39:20 +02:00
Sascha Hauer 64cc568eda mci: make write support optional
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 15:57:51 +02:00
Sascha Hauer 1ac850c488 mci: make it compile without info support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-11 12:36:07 +02:00
Sascha Hauer c8df17c05f mmc: check correctness of the voltage mask in ocr
Most cards do not answer if some reserved bits
in the ocr are set. However, some controllers
can set bit 7 (reserved for low voltages), but
how to manage low voltages SD card is not yet
specified.

based on the original U-Boot patch from
Stefano Babic <sbabic@denx.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-04-04 15:02:35 +02:00
Sascha Hauer 2f0109b1bb Merge branch 'master' into next 2011-01-17 09:43:40 +01:00
Sascha Hauer 7c1e5d6dd7 mci-core: fix printf compiler warnings
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-07 11:38:11 +01:00
Krzysztof Halasa c5baa0edc4 Fix error handling with malloc, memalign etc. Introduce xmemalign().
The idea is to panic() when there is no memory available for normal
operation. Exception: code which can consume arbitrary amount of RAM
(example: files allocated in ramfs) must report error instead of panic().

This patch also fixes code which didn't check for NULL from malloc() etc.

Usage: malloc(), memalign() return NULL when out of RAM.
xmalloc(), xmemalign() always return non-NULL or panic().

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2011-01-07 10:21:22 +01:00
Marek Belisko 804e0b0084 drivers: mci: Fix compilation warning.
Fix compilation warning:
drivers/mci/mci-core.c:1002:
warning: comparison of distinct pointer types lacks a cast

Signed-off-by: Marek Belisko <marek.belisko@open-nandra.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-11-26 08:24:35 +01:00
Robert Schwebel d65ee96da2 doc: fix parameter name in mci-core
Silence this warning:

drivers/mci/mci-core.c:1324: Warning: argument `pdata' of command @param is not found in the argument list of mci_register(struct mci_host *host)
drivers/mci/mci-core.c:1324: Warning: The following parameters of mci_register(struct mci_host *host) are not documented:
  parameter host

Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-22 20:47:03 +02:00
Sascha Hauer 13c09da676 mci: align data for commands
Some mci controllers cannot transfer data with their DMA engines
if the data is not sufficiently aligned. Normally this is a driver
problem, but hey, we have no problem aligning the data and keep
the burden from the drivers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Juergen Beisert <jbe@pengutronix.de>
Acked-by: Juergen Beisert <jbe@pengurtronix.de>
2010-10-22 19:32:01 +02:00
Sascha Hauer d339b76797 mci-core: add multiple block support
So far only for reading blocks. This is based on the corresponding
U-Boot code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Juergen Beisert <jbe@pengutronix.de>
Acked-by: Juergen Beisert <jbe@pengurtronix.de>
2010-10-22 19:31:35 +02:00
Eric Bénard 7c9016431b mci-core: add more tested SD Cards
note :
- Transcend 16GiB fails (no log)
- Micron 8GiB eMMC fails (hangs after : Detecting a 4.0 revision card)

Signed-off-by: Eric Bénard <eric@eukrea.com>
2010-10-14 13:07:14 +02:00
Juergen Beisert 869baba658 mci: mark 'old Canon SD 16 MiB' as working
This card is working since 'mci: handle SD cards < 2.0 correctly'

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Jürgen Beisert <jbe@pengutronix.de>
2010-10-11 15:17:43 +02:00
Sascha Hauer be2be409c0 mci: align write buffer if necessary
Most SD controllers need some kind of alignment for writing
blocks. Instead of coding this in every driver, align write
blocks to a 4 byte alignment in the mci layer. For DMA
accesses we may need bigger alignment, but let's solve this
problem when we have it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-11 13:22:13 +02:00
Sascha Hauer f78e8f84fe mci: handle SD cards < 2.0 correctly
With SD cards older than 2.0 the sd_send_if_cond() fails. Do
not assume it's an MMC card in this case. Instead, assume
it's a MMC card if sd_send_op_cond() fails.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-11 13:22:13 +02:00
Sascha Hauer b98c977cf0 mci: print error code on failure
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-11 13:22:09 +02:00
Juergen Beisert 7051227d2e Add MCI card support to barebox
This adds the basic framework to handle MCI cards in barebox.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2010-10-11 13:08:27 +02:00