9
0
Fork 0
Commit Graph

291 Commits

Author SHA1 Message Date
Sascha Hauer b2968cc8af mci: set partnames of eMMC boot partitions
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-07-15 11:16:19 +02:00
Sascha Hauer b83536bdb9 Merge branch 'for-next/mxs' 2013-07-01 10:14:40 +02:00
Sascha Hauer dee6282fbf mci: Use tran_speed field to fix highspeed MMC card clock
The tran_speed field as decoded from csd is valid in most cases,
so use it to determine the maximum clock we can support. It is
not valid though for MMC highspeed cards, in this case the
csd contains invalid values and we have to set tran_speed explicitly
to the maximum speed. As the values passed into mci_set_clock are
now based on tran_speed we no longer have to limit the rate to
tran_speed in mci_set_clock.

The (intended) effect of this patch is that highspeed MMC cards are
no longer limited to non highspeed rates.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 16:18:16 +02:00
Sascha Hauer 9590d6f9f1 mci: add mci_caps function
To let the card caps be card caps and not the intersection between
card caps and host caps.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 16:18:16 +02:00
Sascha Hauer 2ab4c0869e mci: provide static inline function for mmc_host_is_spi
To prevent compiler warnings like:

warning: unused variable 'host'

When CONFIG_MCI_SPI is disabled.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 16:18:16 +02:00
Sascha Hauer 1d0e15f098 mci: mxs: use common clk API
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 08:49:56 +02:00
Sascha Hauer 97f88df3fd mci: mxs: Use dev_*
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-20 08:49:56 +02:00
Sascha Hauer af4e312929 mci: Print more info
In devinfo for the card also print:

- capabilities for host and card
- current bus width
- current clock

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-03 11:17:04 +02:00
Sascha Hauer 2302fc6076 mci: rename capabilities flags
Use MMC_CAP_ names instead of MMC_MODE_. This makes it more
clear that these are capabilities of host/card and do not refer
to the current mode. These are in line with the Linux Kernel
except for MMC_CAP_MMC_HIGHSPEED_52MHZ which could be fixed
later.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-06-03 10:59:53 +02:00
Sascha Hauer 8f9044927d Merge branch 'for-next/mci'
Conflicts:
	include/driver.h
2013-06-02 16:28:21 +02:00
Sascha Hauer 9aad0fb2d6 mci: i.MX esdhc: get additional parameters from devicetree
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 18:19:16 +02:00
Sascha Hauer ea9c911b8f mci: Add devicetree helper function
This adds helper code to parse the bus-width and max-frequency
property from devicetree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 18:19:11 +02:00
Sascha Hauer 0ea008e15b mci fsl-esdhc: implement detect driver callback
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 12:32:16 +02:00
Sascha Hauer dffbe91e8b mci: implement detect driver callback
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-31 12:32:10 +02:00
Sascha Hauer 86974b5d99 mci: imx-esdhc: allow to specify devicename via OF alias
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:28 +02:00
Sascha Hauer abee214ba5 mci: set name of mci device to same name as the filename
We already have the possibility to register a mci with a certain
filename to get persistent names. However, the device needed to
find the probe parameter still has the name 'mcix'. This patch
changes this by registering the mci device with the same name
as the filename.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:28 +02:00
Sascha Hauer 895c0bee6e mci: embed mci device into struct mci
To safe a separate allocation and to make the code simpler.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:28 +02:00
Sascha Hauer c68feb4b4e mci: make mci device a pure device
No need to match and probe the device if all that we want is a logical
deivice for the mci.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Sascha Hauer 73b0d228e5 driver: Attach info callback to device, not to driver
Since the info is device specific and not driver specific, attach
the callback to the device. This makes it possible to have a info
callback for a device which does not have a driver attached.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Sascha Hauer 4a4f2f20b8 mci: Add support for MMC boot partitions
Some MMC cards support boot partitions. These are special regions
on the MMC card intended to put a bootloader on.

This patch adds support for these partitions, they are accessible
as /dev/diskx.boot[0|1].

Additionally the partitions can be configured bootable using a
device parameter. This can be used to mark the user area or one
of the boot partitions as bootable.

Since this feature is mostly seen on eMMC cards it is made optional
to lower the size impact for boards which do not have eMMC.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Sascha Hauer 93b1578323 mci i.MX esdhc: Fix clock divider calculation
This updates the i.MX esdhc divider settings to FSLs U-Boot.
Current timings work fine for SD cards, but not for eMMC.
Although the calculation is fine according to the datasheet and reading from
eMMC works, writing is broken. Atleast on i.MX53/tqma53.
With this patch the result is the same, but uses different divider values to
achieve it.

While at it, replace the udelay with a busy-loop.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Alexander Shiyan 2f2329ff22 MCI: Sort Makefile entries
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Alexander Shiyan 425bf8b5c9 ARM: OMAP MCI: Move TWL6030 power initialization into OMAP directory
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
wilhelm 2821446cbe Added sd driver for bcm2835 (Raspberry PI)
Replaced defines according to sdhci.h

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Sascha Hauer bd1bf53b34 mci: imx-esdhc: factor out common sdhci registers
This gives the SDHCI specific registers a common name and moves
them to a separate file for use by other SDHCI like drivers.

The SDHCI spec has some 16bit and 8bit registers. The i.MX accesses
these as 32bit registers. These register defines now are named after
the SDHCI registers they combine into one, for example:

SDHCI_HOST_CONTROL__POWER_CONTROL__BLOCK_GAP_CONTROL

is the 32bit version of the SDHCI registers HOST_CONTROL, POWER_CONTROL
and BLOCK_GAP_CONTROL.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-30 12:18:27 +02:00
Sascha Hauer fe85ff4761 treewide: Fix typo seperate -> separate
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-21 21:38:21 +02:00
Juergen Beisert 6a5e4f0c89 MCI/MXS: fix signed/unsigned mismatch
Using the MXS MCI driver with an eight bit capable eMMC results into the
'devinfo' message the interface uses '0' bits for data transfer:

 barebox:/ devinfo mxs_mci0
 resources:
 num   : 0
 start : 0x80034000
 size  : 0x00002000
 driver: mxs_mci
 bus: platform

  Interface
   Min. bus clock: 1476 Hz
   Max. bus clock: 48000000 Hz
   Current bus clock: 24000000 Hz
   Bus width: 0 bit

The eight bit interface width is stored internally as value '2'. And a two bit
'2' ends up into 0xfffffffe when used as an array index. Using an unsigned
field instead fixes this issue:

 barebox:/ devinfo mxs_mci0
 resources:
 num   : 0
 start : 0x80034000
 size  : 0x00002000
 driver: mxs_mci
 bus: platform

  Interface
   Min. bus clock: 1476 Hz
   Max. bus clock: 48000000 Hz
   Current bus clock: 24000000 Hz
   Bus width: 8 bit

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-05-08 23:24:50 +02:00
Sascha Hauer c19efab886 Merge branch 'for-next/param'
Conflicts:
	drivers/mci/mci-core.c
2013-05-06 09:30:50 +02:00
Sascha Hauer 646a0d058d Merge branch 'for-next/mxs' 2013-05-06 09:30:28 +02:00
Sascha Hauer c8af035b41 Merge branch 'for-next/misc' 2013-05-06 09:30:28 +02:00
Sascha Hauer a20caf6c57 Merge branch 'for-next/mci' 2013-05-06 09:30:27 +02:00
Alexander Shiyan 32d531574f MCI: imx: Fix possible null pointer dereference
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-30 09:35:55 +02:00
Alexander Shiyan ef3e752fa1 MCI: atmel: Fix possible null pointer dereference
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-30 09:35:55 +02:00
Juergen Beisert 47e2d9f6e5 MCI/MXS: report a better matching error code when the transfer fails
EIO is a better error message to describe the data transfer to or from the SD cards has failed.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-27 00:06:24 +02:00
Juergen Beisert 869dc35888 MCI/Core: honor transmission limits at the card's side
The host limits are only one limit we must honor when changing the transmission frequency.
The SD cards have their own limits, so take them also into account.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-27 00:06:24 +02:00
Juergen Beisert bd041b2ced MCI/Core: increase the transmission frequency while card detection
According to the SD card spec the detection can happen at 400 kHz

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-27 00:06:24 +02:00
Juergen Beisert 93c90a9636 MXS/MCI: simplify reset of the MCI device block
Since a generic block reset function is a available, also the MCI driver
should make use of it.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-27 00:05:27 +02:00
Juergen Beisert 57c64582a0 MXS/MCI: don't touch variables in the host structure
MMC_BUS_WIDTH_* macros do not correspond with the real bus width.
After setting a bus width larger than 1 bit the next call to change the
frequency ends in the default handler and the host interface stays silently
at the previous frequency.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-26 23:59:34 +02:00
Sascha Hauer aec4ccd96b mci: imx-esdhc: remove cache snoop register access
Remove some leftover from former powerpc support which has no
relevance for i.MX based esdhc controllers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-26 23:20:24 +02:00
Sascha Hauer ab855df99f console: Use dev_add_param_int for baudrate parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Sascha Hauer fff0e0f741 mci: Use dev_add_param_int for probe parameter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-11 11:48:35 +02:00
Alexander Shiyan be78f86efc mci: Fix bug if probe parameter is omitted
barebox@Phytec phyCORE-i.MX27:/ mci0.probe=
unable to handle NULL pointer dereference at address 0x00000000
pc : [<a7f24700>]    lr : [<a7f193f4>]
sp : a7fff8e0  ip : 00000000  fp : 00000001
r10: 00000000  r9 : a6ffba8c  r8 : 00000000
r7 : a7fffad0  r6 : a6ffbb04  r5 : a6fdd5cc  r4 : a6fdd658
r3 : a7f18760  r2 : 00000000  r1 : 00000000  r0 : 00000000
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
[<a7f24700>] (simple_strtoul+0xc/0xc0) from [<a7f193f4>] (mci_set_probe+0xc94/0xd64)
[<a7f193f4>] (mci_set_probe+0xc94/0xd64) from [<a7f252cc>] (dev_set_param+0x74/0x8c)
[<a7f252cc>] (dev_set_param+0x74/0x8c) from [<a7f0606c>] (setenv+0x60/0xd8)
[<a7f0606c>] (setenv+0x60/0xd8) from [<a7f00820>] (set_local_var.isra.3+0x5c/0x7c)
[<a7f00820>] (set_local_var.isra.3+0x5c/0x7c) from [<a7f01a6c>] (run_list_real+0x494/0x934)
[<a7f01a6c>] (run_list_real+0x494/0x934) from [<a7f01400>] (parse_stream_outer+0x198/0x270)
[<a7f01400>] (parse_stream_outer+0x198/0x270) from [<a7f0209c>] (run_shell+0x3c/0x7c)
[<a7f0209c>] (run_shell+0x3c/0x7c) from [<a7f05494>] (execute_command+0x38/0x78)
[<a7f05494>] (execute_command+0x38/0x78) from [<a7f01db8>] (run_list_real+0x7e0/0x934)
[<a7f01db8>] (run_list_real+0x7e0/0x934) from [<a7f019ec>] (run_list_real+0x414/0x934)
[<a7f39578>] (unwind_backtrace+0x0/0xa8) from [<a7f24ed4>] (panic+0x28/0x3c)
[<a7f24ed4>] (panic+0x28/0x3c) from [<a7f39a3c>] (do_exception+0x10/0x14)
[<a7f39a3c>] (do_exception+0x10/0x14) from [<a7f39ac8>] (do_data_abort+0x2c/0x38)
[<a7f39ac8>] (do_data_abort+0x2c/0x38) from [<a7f39788>] (data_abort+0x48/0x60)

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-09 09:07:17 +02:00
Sascha Hauer 45b87922a6 Merge branch 'for-next/misc-arm' 2013-04-04 14:20:32 +02:00
Sascha Hauer 8f2c6a3d2b Merge branch 'for-next/misc' 2013-04-04 14:20:32 +02:00
Hubert Feurstein a17aee8d86 mci-core: fix coding style
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-03 17:22:11 +02:00
Hubert Feurstein c833347874 mci-core: use dev_* for messages
Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-04-03 17:22:11 +02:00
Alexander Shiyan e4588cf311 Introduce device_spi_driver() macro and use it for SPI drivers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 07:15:45 +01:00
Alexander Shiyan 2f65379c98 SPI: Rename spi_register_driver() for using with register_driver_macro()
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-14 07:15:44 +01:00
Sascha Hauer e42522f5bf MMC i.MX: remove unnecessary mach include
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-03-10 11:09:03 +01:00
Sascha Hauer ea0f831cd0 Merge branch 'for-next/mxs' 2013-03-04 09:21:54 +01:00
Alexander Shiyan bbc0b6bc15 mfd: Using MFD_xx prefix for symbols
This patch provides rename MFD-related symbols for using MFD-prefix.
Additionally, sorting mfd/Kconfig and mfd/Makefile records.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-18 09:21:08 +01:00
Alexander Shiyan 6a256321b8 Use new device_platform_driver() macro for drivers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-13 09:23:28 +01:00
Michael Grzeschik a90c32c861 ARM mxs: ssp move to common register layout
This patch moves the register defines and bit definitions
into one include file. As the defines are common for ssp
and mci devices they can be shared.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-02-11 20:58:34 +01:00
Sascha Hauer 6eb49a5b1f Merge branch 'for-next/mci'
Conflicts:
	drivers/mci/atmel_mci.c
2013-02-04 15:48:58 +01:00
Sascha Hauer a01e54d201 treewide: fix format specifiers
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-27 14:24:10 +01:00
Jean-Christophe PLAGNIOL-VILLARD 20615ac8c9 mci: add card_write_protected
Currently there is no common way for the mci host driver to tell
that thee car is write protected. This adds a card_write_protected callback
which is used by the framework to tell whether it's protected or not.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-27 12:17:28 +01:00
Jean-Christophe PLAGNIOL-VILLARD 2c93912f34 atmel_mci: gpio: request and configure card detect
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:44 +01:00
Jean-Christophe PLAGNIOL-VILLARD 50559d2c4c atmel_mci: drop board host caps
as it's handle by detecting the IP version and bus with

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:43 +01:00
Jean-Christophe PLAGNIOL-VILLARD be42bafdd0 atmel_mci: update the SD/SDIO Card Register at request time
as we need to reset the IP

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:43 +01:00
Jean-Christophe PLAGNIOL-VILLARD c934d62029 atmel_mci: support the SD highspeed since IP version 0x300
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:43 +01:00
Jean-Christophe PLAGNIOL-VILLARD bc33582a8a atmel_mci: after a software timeout the IP need to be reset
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:43 +01:00
Jean-Christophe PLAGNIOL-VILLARD 14b2c8f15b atmel_mci: on version 0x0 we need to reset the IP at each request
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:43 +01:00
Jean-Christophe PLAGNIOL-VILLARD 40a333b062 atmel_mci: rwproof is only needed up to IP version 0x200
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:18 +01:00
Jean-Christophe PLAGNIOL-VILLARD 7bd476801a atmel_mci: fix host init
disable interrupt and reset the IP at the probe
set timout at the host init

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:14 +01:00
Jean-Christophe PLAGNIOL-VILLARD 0a98283554 atmel_mci: version 0x5xx of the IP have a different clk div
so detect and support it

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:14 +01:00
Jean-Christophe PLAGNIOL-VILLARD b9696a0b3f atmel_mci: detect IP version
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:14 +01:00
Jean-Christophe PLAGNIOL-VILLARD f674fb3125 atmel_mci: use linux regs define
to simplify sync and share code

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:14 +01:00
Jean-Christophe PLAGNIOL-VILLARD aaa55b560e atmel_mci: rename all function to start with atmci
to be consistent and have a unique naming convention
be in sync with the kernel too

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:14 +01:00
Jean-Christophe PLAGNIOL-VILLARD 1f99b4ca84 atmel_mci: rename atmel_mci_readl/writel to atmci_readl/writel
to be consistent with the kernel
This also reduce the ligne length

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:14 +01:00
Jean-Christophe PLAGNIOL-VILLARD cb9d84a0e1 atmel_mci: rename atmel_mci_host tp atmel_mci
to be consistent with the kernel

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-25 19:52:14 +01:00
Sascha Hauer 456fae0227 mci atmel: implement card_present callback
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 10:53:30 +01:00
Sascha Hauer d21575ddea mci i.MX esdhc: implement card_present callback
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 10:53:30 +01:00
Sascha Hauer 096789bc2a mci: Add card_present callback
Currently there is no common way for the mci host driver to tell
that there is no card present. This adds a card_present callback
which is used by the framework to tell whether it's present or not.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 10:53:30 +01:00
Sascha Hauer c94cd71bb4 mci: Always add probe parameter for cards
Always add the 'probe' parameter to cards so that scripts can
rely on the parameter to be present.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 10:53:30 +01:00
Sascha Hauer 1fcdbe3337 mci: return 0 for probe parameter even when already initialized
This makes the behaviour more friendly to scripts which can now
set the probe parameter without checking if it has been done before.
Having a succesful result now means that there is a card.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-20 10:52:04 +01:00
Sascha Hauer db31ccf293 Merge branch 'for-next/omap' 2013-01-09 10:29:08 +01:00
Sascha Hauer 04cb446c9a ARM omap / mci: Fix register offsets
Only the OMAP4 has a register offset of 0x100 in the register space. Fix
this by using the device id mechanism. This became broken when the device
register convenience functions were introduced.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-08 10:02:13 +01:00
Sascha Hauer d43bcb9987 mci omap_hsmmc: Fix whitespaces
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2013-01-07 10:07:52 +01:00
Teresa Gámez 4746717a5d ARM OMAP AM33XX: create new ARCH for AM33xx
Created ARCH for AM33xx boards as second stage bootloader.
This includes:
- Added dmtimer0
- Created basic header files
- Added MMC support for ARCH_AM33XX
- Added reset function

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>

Some header file cleanup by:
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-20 11:43:10 +01:00
Sascha Hauer 416a99135a ARM omap hsmmc: Fix register offset
The hsmmc module has a 0x100 offset in its register space. The real
register space size for the module is 4K, so when we register the
device with the size 4k, we have to account for the offset in the
driver, not in the resource allocation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-19 21:52:36 +01:00
Sascha Hauer de3c258d41 mci i.MX esdhc: Allow to specify devicename from platformdata
For boards which need to have persistent names for the device file.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-17 08:42:32 +01:00
Sascha Hauer 30eb680378 mci: Allow to specify device name
When multiple MMC/SD cards are present in the system we often
have to have persistent names to identify them during runtime.
This patch allows to overwrite the devicename which is used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-17 08:42:32 +01:00
Sascha Hauer 1a9e93cc81 drivers/base: fix corrupt device tree
dev_add_child is a very unsafe function. If called multiple times
it allows setting the same device to different parents thus corrupting
the siblings list. This happens regularly since:

| commit c2e568d19c
| Author: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
| Date:   Sat Nov 3 16:11:05 2012 +0100
|
|    bus: add bus device
|
|    automatically add it as parent of any bus device if none already specified
|
|    we have now a nice output per bus

If for example a FATfs is mounted this nice output per bus often ends with:

>     `---- fat0
>     `---- 0
>          `---- 0x86f0000087020031-0x86f000410df27124: /dev/<NULL>
>          `---- sram00
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               `---- 0x00000000-0xffffffffffffffff: /dev/<NULL>
>               unable to handle NULL pointer dereference at address 0x0000000c
> pc : [<87f08a20>]    lr : [<87f08a04>]
> sp : 86eff8c0  ip : 87f3fbde  fp : ffffffff
> r10: ffffffff  r9 : 00000000  r8 : 00000003
> r7 : 86f075b8  r6 : 00000002  r5 : ffffffec  r4 : 86f07544
> r3 : 00000000  r2 : 43f900b4  r1 : 00000020  r0 : 00000005
> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
> [<87f08a20>] (do_devinfo_subtree+0x90/0x130) from [<87f08a90>] (do_devinfo_subtree+0x100/0x130)
>
> [<87f3e070>] (unwind_backtrace+0x0/0x90) from [<87f28514>] (panic+0x28/0x3c)
> [<87f28514>] (panic+0x28/0x3c) from [<87f3e4b8>] (do_exception+0x10/0x14)
> [<87f3e4b8>] (do_exception+0x10/0x14) from [<87f3e544>] (do_data_abort+0x2c/0x38)
> [<87f3e544>] (do_data_abort+0x2c/0x38) from [<87f3e268>] (data_abort+0x48/0x60)

This patch fixes this by adding a device to its parents children list in
register_device so that dev_add_child is no longer needed. This function
is removed from the tree. Now callers of register_device have to clearly
set the parent *before* registering a device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Jan Lübbe <jlu@pengutronix.de>
2012-12-12 15:04:27 +01:00
Sascha Hauer 8030ab24fa Merge branch 'kconfig' 2012-12-08 12:22:21 +01:00
Alexander Shiyan 4c20f9af97 Cleanup Kconfig files
This patch provides a global cleanup barebox Kconfig files. This includes
replacing spaces to tabs, formatting in accordance format, removing
extraneous lines and spaces. No functional changes.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-08 12:22:12 +01:00
Sascha Hauer 63cfa83739 mci i.MX esdhc: turn error message into debug message
During card probe the mci core may send commands to the card
which the card doesn't understand. This is intended, so do not
print an error message here.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-05 19:57:47 +01:00
Sascha Hauer fa5b8a2a32 mci: Fix capacity calculation for high capacity MMC cards
For these cards we have to calculate the size using the ext csd
sector count fields.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-12-03 19:48:25 +01:00
Sascha Hauer ae01f384f2 mci: Add STUFF_BITS and use it
This adds the STUFF_BITS macro from the kernel to extract numbers
from the csd. This also fixes several places where the csd fields
in SD cards differ from MMC cards.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-29 19:52:41 +01:00
Sascha Hauer 813c3bd3a2 Merge branch 'for-next/mci' 2012-11-16 14:01:11 +01:00
Jean-Christophe PLAGNIOL-VILLARD c06fca0f84 mci-core: fix debug Capacity cast
so we print the correct size

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-15 14:40:50 +01:00
Jean-Christophe PLAGNIOL-VILLARD 6d0d1392f4 mci_spi: add clock frequency change support
setup the spi master correctly

provide f_min and f_max

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-14 21:09:41 +01:00
Jean-Christophe PLAGNIOL-VILLARD 0738b3c6fe mci_spi: add sanity check
as in linux

SD/MMC support only mode 0 or 3 (if 0 not supported by the spi master)
so if the mode is not 3 force 0

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-14 21:09:41 +01:00
Jean-Christophe PLAGNIOL-VILLARD bcdafc8f3c mci-core: spi fix op cond support
so we can detect sd card version 2.0 on spi

as we need to the OCR_HCS on version 2.0 regardless if it's a SPI or not

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-14 21:09:41 +01:00
Franck Jullien d4695def29 mci_spi: always compute command crc byte
The spec says: "the CMD8 CRC verification is always enabled.
The Host shall set correct CRC in the argument ofCMD8. If
CRC error is detected, card returns CRC error in R1 response
regardless of command index."

Make it simple, and compute crc on every commands.

Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-11-14 21:08:55 +01:00
Sascha Hauer 94de405d8f Merge branch 'for-next/imx-clk' 2012-10-04 15:24:57 +02:00
Sascha Hauer d4edd480b2 ARM i.MX: Remove old clock support
The old clock support is now unused. Remove it. The former i.MX clko
command is superseeded by generic clock manipulation commands.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-04 15:19:57 +02:00
Sascha Hauer 3591842f8a mci i.MX: Switch to clock support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-04 15:19:56 +02:00
Sascha Hauer c7cea55e0a mci i.MX ESDHC: Switch to clock support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-10-04 15:19:56 +02:00
Jean-Christophe PLAGNIOL-VILLARD 3c5327e660 switch all platform_bus device/driver registering to platform_driver/device_register
now register_driver and register_device are for bus only usage.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2012-10-04 15:19:12 +02:00
Sascha Hauer d1e65d2a7b Merge branch 'for-next/remove-fsf-address'
Conflicts:
	drivers/net/miidev.c
	include/miidev.h
2012-10-03 21:12:48 +02:00