u-boot-brain/drivers/mmc
Andy Fleming 7798f6dbd5 mmc: Properly determine maximum supported bus width
At some point, a confusion arose about the use of the bit
definitions in host_caps for bus widths, and the value
in ext_csd. By coincidence, a simple shift could convert
between one and the other:

MMC_MODE_1BIT = 0, EXT_CSD_BUS_WIDTH_1 = 0
MMC_MODE_4BIT = 0x100, EXT_CSD_BUS_WIDTH_4 = 1
MMC_MODE_8BIT = 0x200, EXT_CSD_BUS_WIDTH_8 = 2

However, as host_caps is a bitmask of supported things,
there is not, in fact, a one-to-one correspondence. host_caps
is capable of containing MODE_4BIT | MODE_8BIT, so nonsensical
things were happening where we would try to set the bus width
to 12.

The new code clarifies the very different namespaces:

host_caps/card_caps = bitmask (MMC_MODE_*)
ext CSD fields are just an index (EXT_CSD_BUS_WIDTH_*)
mmc->bus_width integer number of bits (1, 4, 8)

We create arrays to map between the namespaces, like in Linux.

Signed-off-by: Andy Fleming <afleming@freescale.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Stephen Warren <swarren@nvidia.com>
2012-11-27 17:48:46 -06:00
..
arm_pl180_mmci.c mmc: Remove incorrect cmd->flags usage 2012-09-06 15:23:13 -05:00
arm_pl180_mmci.h u8500: Separating mmc config parameters from driver 2012-09-01 14:58:20 +02:00
bfin_sdh.c Blackfin: bfin_sdh: drop dos part hardcode 2012-04-22 13:00:19 -04:00
davinci_mmc.c mmc: Implement card detection. 2012-01-08 21:28:27 -06:00
dw_mmc.c mmc: dw-mmc: support DesignWare MMC Controller 2012-10-22 02:56:25 -05:00
exynos_dw_mmc.c EXYNOS: mmc: support DesignWare Controller for Samsung-SoC 2012-11-27 17:26:47 -06:00
fsl_esdhc.c Merge branch 'master' of git://git.denx.de/u-boot-arm 2012-11-05 07:42:00 -07:00
ftsdc010_esdhc.c mmc: Implement card detection. 2012-01-08 21:28:27 -06:00
gen_atmel_mci.c mmc: at91: use max timeout value. It will avoid some situation that timeout happened. 2012-10-17 11:29:52 +02:00
Makefile EXYNOS: mmc: support DesignWare Controller for Samsung-SoC 2012-11-27 17:26:47 -06:00
mmc_spi.c mmc: Fix mmc_spi error on cmd->flags field 2012-10-22 02:53:35 -05:00
mmc.c mmc: Properly determine maximum supported bus width 2012-11-27 17:48:46 -06:00
mv_sdhci.c drivers/mmc/mv_sdhci.c: Fix build warning 2012-01-08 21:28:16 -06:00
mxcmmc.c mmc: access mxcmmc from mx31 boards 2012-02-12 10:11:26 +01:00
mxsmmc.c common: rework bouncebuf implementation 2012-11-27 17:26:48 -06:00
omap_hsmmc.c Merge branch 'master' of git://git.denx.de/u-boot-arm 2012-05-20 21:31:26 +02:00
pxa_mmc_gen.c mmc: Remove incorrect cmd->flags usage 2012-09-06 15:23:13 -05:00
pxa_mmc.h pxa: move mmc drivers to drivers/mmc 2009-02-20 03:47:50 +01:00
s5p_sdhci.c mmc: sdhci: Add a quirk to add delay during completion of sdhci_send_cmd 2012-10-22 02:53:36 -05:00
sdhci.c mmc: add no simultaenous power and vdd 2012-11-27 17:26:48 -06:00
sh_mmcif.c mmc: sh_mmcif: enable MMC_MODE_HC 2012-09-05 17:32:41 -05:00
sh_mmcif.h mmc: sh_mmcif: add support for Renesas MMCIF 2011-07-15 20:29:21 -05:00
spl_mmc.c SPL: Move the omap SPL framework to common/spl 2012-09-27 09:49:59 -07:00
tegra_mmc.c mmc: tegra: use bounce buffer APIs 2012-11-27 17:26:49 -06:00