u-boot/drivers/mmc
Marek Vasut dbb9e136b8 mmc: Fix size calculation for sector addressed MMC version 4
For eMMC v4 and newer that is smaller than 2 GiB, the JEDEC JESD84-B51
section 6.2.4 Configure partitions indicates that EXT_CSD SEC_COUNT
should not be used to determine device size, and instead device size
should be calculated from C_SIZE and C_SIZE_MULT.

This is not exactly accurate, the 2 GiB limit is not a hard line,
there are eMMC devices which are smaller than 2 GiB and still
require device size to be determined from EXT_CSD SEC_COUNT. The
hard line is instead OCR HCS bit, which indicates whether the device
is byte or sector addressed, the former applies to most devices
below 2 GiB, and the later applies mostly to devices above 2 GiB.

However, there are a couple of devices which are smaller than 2 GiB
and still set the OCR HCS bit to indicate they are sector addressed,
and therefore the size calculation for those devices should also
use EXT_CSD SEC_COUNT . Use mmc->high_capacity flag to discern the
devices instead of arbitrary 2 GiB limit. The mmc->high_capacity flag
reflects the OCR HCS bit state.

Fixes: 639b7827d1 ("mmc: fix the condition for MMC version 4")
Signed-off-by: Marek Vasut <marex@denx.de>
2025-02-24 14:16:28 -06:00
..
am654_sdhci.c mmc: am654_sdhci: Add the quirk to set TESTCD bit 2024-07-11 13:15:37 -06:00
arm_pl180_mmci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
arm_pl180_mmci.h mmc: arm_pl180_mmci: Enable HWFC for specific versions of MCI 2021-10-29 18:22:32 +09:00
aspeed_sdhci.c drivers: mmc: Remove duplicate newlines 2024-07-22 10:53:05 -06:00
atmel_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
bcm2835_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
bcm2835_sdhost.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
bcmstb_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
ca_dw_mmc.c mmc: exynos_dw_mmc: Refactor fixed CIU clock divider 2024-08-19 16:09:06 +09:00
cv1800b_sdhci.c mmc: cv1800b: Add transmit tap delay config to fix write error 2024-05-01 22:40:08 +08:00
davinci_mmc.c drivers: mmc: Remove duplicate newlines 2024-07-22 10:53:05 -06:00
dw_mmc.c mmc: Allow controlling DM_MMC for VPL builds 2025-02-03 16:00:42 -06:00
exynos_dw_mmc.c mmc: exynos_dw_mmc: Improve coding style 2024-08-19 16:09:06 +09:00
f_sdh30.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
fsl_esdhc.c drivers: mmc: Remove duplicate newlines 2024-07-22 10:53:05 -06:00
fsl_esdhc_imx.c mmc: fsl_esdhc: Convert to use livetree API for fdt access 2024-10-25 09:07:43 -03:00
fsl_esdhc_spl.c drivers: mmc: Remove duplicate newlines 2024-07-22 10:53:05 -06:00
ftsdc010_mci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
ftsdc010_mci.h mmc: dw_mmc: Replace fifoth_val property with fifo-depth 2024-08-19 16:09:06 +09:00
gen_atmel_mci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
hi6220_dw_mmc.c mmc: dw_mmc: Replace fifoth_val property with fifo-depth 2024-08-19 16:09:06 +09:00
iproc_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
jz_mmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
Kconfig blk: Make block subsystems select BLK 2025-01-20 19:26:54 -06:00
kona_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
Makefile mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC 2024-12-18 13:19:16 +08:00
meson_gx_mmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
meson_gx_mmc.h dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
mmc-pwrseq.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
mmc-uclass.c drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILD 2024-10-11 11:44:48 -06:00
mmc.c mmc: Fix size calculation for sector addressed MMC version 4 2025-02-24 14:16:28 -06:00
mmc_boot.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
mmc_bootdev.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
mmc_legacy.c drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILD 2024-10-11 11:44:48 -06:00
mmc_private.h drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILD 2024-10-11 11:44:48 -06:00
mmc_spi.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
mmc_write.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
msm_sdhci.c mmc: msm_sdhci: enable vqmmc at probe if available 2024-11-20 17:57:57 +01:00
mtk-sd.c mmc: mediatek: add support for MediaTek MT7987 SoCs 2025-01-30 14:35:14 -06:00
mv_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
mvebu_mmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
mxcmmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
mxsmmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
nexell_dw_mmc.c mmc: dw_mmc: Replace fifoth_val property with fifo-depth 2024-08-19 16:09:06 +09:00
npcm_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
octeontx_hsmmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
octeontx_hsmmc.h treewide: use linux/time.h for time conversion defines 2023-11-16 18:59:58 -05:00
omap_hsmmc.c drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILD 2024-10-11 11:44:48 -06:00
owl_mmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
pci_mmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
pic32_sdhci.c treewide: Remove clk_free 2024-01-29 22:35:02 -05:00
piton_mmc.c drivers: mmc: Remove duplicate newlines 2024-07-22 10:53:05 -06:00
renesas-sdhi.c mmc: renesas: Fix R-Car spelling 2024-12-11 08:36:24 +01:00
rockchip_dw_mmc.c Merge patch series "Tidy up use of 'SPL' and CONFIG_SPL_BUILD" 2024-10-11 12:23:25 -06:00
rockchip_sdhci.c Merge patch series "Tidy up use of 'SPL' and CONFIG_SPL_BUILD" 2024-10-11 12:23:25 -06:00
rpmb.c drivers: mmc: Remove duplicate newlines 2024-07-22 10:53:05 -06:00
s5p_sdhci.c mmc: exynos_dw_mmc: Read common bus-width property 2024-08-19 16:09:06 +09:00
sandbox_mmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
sdhci-adma.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
sdhci-cadence.c mmc: sdhci-cadence: Add support for Cadence sdmmc v6 2024-09-05 16:18:38 -06:00
sdhci-cadence.h mmc: sdhci-cadence: Add support for Cadence sdmmc v6 2024-09-05 16:18:38 -06:00
sdhci-cadence6.c mmc: sdhci-cadence: Add support for Cadence sdmmc v6 2024-09-05 16:18:38 -06:00
sdhci.c mmc: Use logging instead of printf() 2024-08-23 15:58:41 -06:00
sh_mmcif.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
sh_mmcif.h ARM: renesas: Rename ARCH_RMOBILE to ARCH_RENESAS 2024-03-02 14:29:36 -05:00
snps_dw_mmc.c mmc: dw_mmc: Add "starfive, jh7110-mmc" compatible to match upstream DT 2024-12-18 13:19:15 +08:00
snps_sdhci.c mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC 2024-12-18 13:19:16 +08:00
socfpga_dw_mmc.c drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILD 2024-10-11 11:44:48 -06:00
sti_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
stm32_sdmmc2.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
sunxi_mmc.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
sunxi_mmc.h sunxi: mmc: Move header to the driver directory 2023-11-12 16:45:08 +00:00
tangier_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
tegra_mmc.c drivers: mmc: Remove duplicate newlines 2024-07-22 10:53:05 -06:00
tmio-common.c drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILD 2024-10-11 11:44:48 -06:00
tmio-common.h mmc: renesas: Fix R-Car spelling 2024-12-11 08:36:24 +01:00
uniphier-sd.c drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILD 2024-10-11 11:44:48 -06:00
xenon_sdhci.c Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet" 2024-05-20 13:35:03 -06:00
zynq_sdhci.c drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILD 2024-10-11 11:44:48 -06:00