summaryrefslogtreecommitdiffstats
path: root/include/mci.h
Commit message (Collapse)AuthorAgeFilesLines
* mci: Allow to partition eMMC boot partitionsSascha Hauer2017-01-191-0/+1
| | | | | | | | | So far the eMMC boot partitions cannot be partitioned from the device tree. Since they are often 4MiB in size they are big enough to hold a barebox image and the environment. Add partition parsing to the boot partitions to allow this usecase. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Fix version numbers againTrent Piepho2016-06-071-1/+6
| | | | | | | | | | | The SD and eMMC version numbers are a pain to print and sort, since they are inconsistent in if a two digit minor version shdoulde be treated as a single number or as minor and micro version numbers. This allows version 1.10 and 4.5 and 4.41, where 41 is less than 5. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: core: bus-width property should override driver defaultTrent Piepho2015-11-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The OF code for parsing bus-width would only add the specified width to those the driver might have already set capability flags for. Because of this, if the driver had set 8 or 4 bit width, it wasn't possible for the DT to specify that fewer pins were used on the board and a smaller width was necessary. Change this so the width in the DT overrides whatever widths the driver says it supports. There is no reason to have an incorrect device tree and it makes far more sense for the DT to override the driver default than for the driver default to override the DT. The widths the driver puts in host_caps before calling mci_of_parse() are considered the default if the DT doesn't specify bus-width. This should cause the least amount of change to existing boards, as despite a comment that no bus-width meant to use 1 bit, using the driver default is what was really happening. Unfortunately, half of existing drivers default to the largest width they support while the other half default to the smallest. Boards should just stick the width in the device tree. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: mci: Add mci_get_device_by_name functionDaniel Schultz2015-09-041-0/+4
| | | | | | | Get a 'struct mci' by search after the device name. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: mci: Add new ext. CSD field definesDaniel Schultz2015-09-041-0/+99
| | | | | | | Added missing defines for the extended CSD register until standard 5.1. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: mci: Make two functions publicDaniel Schultz2015-09-041-0/+3
| | | | | | | | | There is no possibility to read/write to the extended CSD register of MMC devices from a command. To avoid duplicated driver code, two driver functions have to be public. Signed-off-by: Daniel Schultz <d.schultz@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: implement non-removable propertyLucas Stach2014-06-041-0/+1
| | | | | | | | There is no need to check the card-detect status for non-removable devices. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Add regulator supportSascha Hauer2014-04-291-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Fix version handlingSascha Hauer2014-02-141-9/+9
| | | | | | | | | | | | Currently the version defines reflect the digits in the version number. MMC_VERSION_4_41 is defined as 0x441 and MMC_VERSION_4_5 is defined as 0x405. This results in MMC_VERSION_4_5 < MMC_VERSION_4_41 becoming true which was surely not intended. Fix this by redefining the versions as 0x<major><minor><micro>. This makes the string generation more complicated but makes versions comparable again. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: add DSR supportMarkus Niebel2014-01-151-0/+3
| | | | | | | | | | | | | | | | The eMMC and the SD-Card specifications describe the optional SET_DSR command. During measurements at our lab we found that some cards implementing this feature having really strong driver strengts per default. This can lead to voltage peaks above the specification of the host on signal edges for data sent from a card to the host. Since availability of a given card type may be shorter than the time a certain hardware will be produced it is useful to have support for this command (Alternative would be changing termination resistors and adapting the driver strength of the host to the used card.) Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Support the correct version for eMMCMarkus Niebel2014-01-101-8/+13
| | | | | | | | | | | | | | | | eMMC is available up to version 4.5 but the correct version is not decoded. Change version definitions to support more minor verions, add missing versions and parse the minor versions from ext_csd. After this, card detection code and devinfo reports correct versions. Handling is inspired by u-boot code. Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: mxs: support overwriting the device name via platform dataUwe Kleine-König2013-11-111-1/+1
| | | | | | | | | | | | | The current implementation of the bootloader specification depends on the hardware name and the name of the device in /dev to match. As the default hardware name is mciX and the device name is diskY the bootloader spec cannot be used as is. This patch implements a way to overwrite the device name similar to what is possible for the imx-esdhc driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: add max_req_size supportJean-Christophe PLAGNIOL-VILLARD2013-10-221-0/+1
| | | | | | | | Some controller such as the ARM AMBA pl181 can not handle more than 16bits data length request. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Use tran_speed field to fix highspeed MMC card clockSascha Hauer2013-06-201-1/+1
| | | | | | | | | | | | | | | 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>
* mci: provide static inline function for mmc_host_is_spiSascha Hauer2013-06-201-6/+8
| | | | | | | | | | To prevent compiler warnings like: warning: unused variable 'host' When CONFIG_MCI_SPI is disabled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: rename capabilities flagsSascha Hauer2013-06-031-5/+6
| | | | | | | | | | 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>
* mci: Add devicetree helper functionSascha Hauer2013-05-311-0/+1
| | | | | | | This adds helper code to parse the bus-width and max-frequency property from devicetree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: implement detect driver callbackSascha Hauer2013-05-311-2/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: embed mci device into struct mciSascha Hauer2013-05-301-1/+1
| | | | | | To safe a separate allocation and to make the code simpler. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Add support for MMC boot partitionsSascha Hauer2013-05-301-1/+30
| | | | | | | | | | | | | | | | | 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>
* mci: Use dev_add_param_int for probe parameterSascha Hauer2013-04-111-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: add card_write_protectedJean-Christophe PLAGNIOL-VILLARD2013-01-271-0/+2
| | | | | | | | | 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>
* mci: Add card_present callbackSascha Hauer2013-01-201-0/+2
| | | | | | | | 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>
* mci: Allow to specify device nameSascha Hauer2012-12-171-0/+1
| | | | | | | | 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>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Fix 8 bit mmc cardsSascha Hauer2012-02-091-0/+1
| | | | | | | | | | Currently we test the cards capabilities for being 8bit capable. This does not work since noone ever sets this bit. Unfortunately there is no bit to test 8bit capability, so we introduce a patch from the kernel which puts the mmc card into 8bit mode and tests whether it can succesfully read the ext_csd in this mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Add a complete list of EXT_CSD_* fields from the kernelSascha Hauer2012-02-091-5/+45
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Use struct mci for internal argument passingSascha Hauer2012-02-091-5/+2
| | | | | | | | | The mci layer currently passes around a struct device_d for its internal use. Apart from being confusing this drops typesafety for no good reason. Instead, pass around a struct mci. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: remove unused device argument from set_iosSascha Hauer2012-02-091-1/+1
| | | | | | This argmuent is unused in all drivers, so remove it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci core: replace discrete ios values with struct iosSascha Hauer2012-02-091-1/+31
| | | | | | | As we'll need more arguments to set_ios over time put them in a struct mci_ios like the kernel does. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: use card type definitionsSascha Hauer2012-02-091-1/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Add complete definitions for the card typeSascha Hauer2012-02-091-2/+10
| | | | | | | Add the different DDR types and also a definition for the card type mask. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Use generic block layer to access the drives and do partition parsingJuergen Beisert2011-11-281-1/+2
| | | | | | | 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>
* mci: Add MCI over SPI supportFranck Jullien2011-11-251-0/+18
| | | | | | | | | | | 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>
* mci: embed mci_dev into mci_host instead of allocating it seperatelySascha Hauer2011-08-151-0/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add MCI card support to bareboxJuergen Beisert2010-10-111-0/+239
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>