aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
AgeCommit message (Collapse)Author
2022-12-05global: Move remaining CONFIG_SYS_* to CFG_SYS_*Tom Rini
The rest of the unmigrated CONFIG symbols in the CONFIG_SYS namespace do not easily transition to Kconfig. In many cases they likely should come from the device tree instead. Move these out of CONFIG namespace and in to CFG namespace. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-10global: Migrate CONFIG_SYS_FSL* symbols to the CFG_SYS namespaceTom Rini
Migrate all of COFIG_SYS_FSL* to the CFG_SYS namespace. Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-11-10Convert CONFIG_SYS_MMC_MAX_BLK_COUNT to KconfigTom Rini
This converts the following to Kconfig: CONFIG_SYS_MMC_MAX_BLK_COUNT Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-31dm: mmc: Allow sandbox emulator to build without writesSimon Glass
When MMC_WRITE is disabled this driver produced a build error. Fix this. Also update a comment while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-31dm: blk: mmc: Tidy up some Makefile rules for SPLSimon Glass
Use the correct SPL_TPL_ variable so that these features can be enabled in TPL and VPL as needed. Disable it by default in TPL to avoid any code-size increase. No boards are actually using it since the Makefile rules don't allow including drivers/block/ with TPL_DM enabled. It can be manually enabled as needed. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-24Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmcTom Rini
2022-10-24mmc: Fix static checker warningsVenkatesh Yadav Abbarapu
Correct pointer dereferencing check to be more consistent. Eliminate the below smatch warning: drivers/mmc/mmc.c:3118 mmc_init_device() warn: variable dereferenced before check 'm' (see line 3116) Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Reviewed-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-24mmc: dwmmc: only clear handled interruptsJohn Keeping
Unconditionally clearing DTO when RXDR is set leads to spurious timeouts in FIFO mode transfers if events occur in the following order: mask = dwmci_readl(host, DWMCI_RINTSTS); // Hardware asserts DWMCI_INTMSK_DTO here dwmci_writel(host, DWMCI_RINTSTS, DWMCI_INTMSK_DTO); if (mask & DWMCI_INTMSK_DTO) { // Unreachable as DTO is cleared without being handled! return 0; } Only clear interrupts that we have seen and are handling so that DTO is not missed. Signed-off-by: John Keeping <john@metanate.com> Tested-by: Jerome Forissier <jerome.forissier@linaro.org> (Rock PI 4B) Tested-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-24mmc: stm32_sdmmc2: manage vqmmcYann Gautier
The SDMMC IOs can be in an IO domain, that has to be enabled. This is done by enabling vqmmc in the driver. This has no impact on configurations not using an IO domain, the check can then be executed on all platforms managing regulator, and the vqmmc regulator enabled on all platforms having it in their DT. Signed-off-by: Yann Gautier <yann.gautier@foss.st.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-24mmc: stm32_sdmmc2: protect against unsupported modesYann Gautier
The UHS modes for SD, HS200 and HS400 modes for eMMC are not supported by the stm32_sdmmc2 driver. Make it clear by removing the corresponding caps after parsing the DT. Signed-off-by: Yann Gautier <yann.gautier@foss.st.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-24mmc: stm32_sdmmc2: add dual data rate supportYann Gautier
To support dual data rate with STM32 sdmmc2 driver, the dedicated bit (DDR - BIT(18)) needs to be set in the CLKRC register. Clock bypass (no divider) is not allowed in this case. This is required for the eMMC DDR modes. Signed-off-by: Yann Gautier <yann.gautier@foss.st.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-24mmc: f_sdh30: Add support for F_SDH30_E51Kunihiko Hayashi
Add Socionext F_SDH30_E51 IP support. The features of this IP includes CMD/DAT line delay and force card insertion mode for non-removable cards. And the IP needs to add some quirks. Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
2022-10-24mmc: sdhci: Add new quirks for SUPPORT_SINGLEKunihiko Hayashi
This patch defines a quirk to disable the block count for single block transactions. This is similar to Linux kernel commit d3fc5d71ac4d ("mmc: sdhci: add a quirk for single block transactions"). Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-24mmc: ftsdc010: make command timeout 250 ms as in the commentSergei Antonov
Get rid of discrepancy beween comment /* 250 ms */ and code which shifts by 4 thus dividing by 16. So change code to shift by 2 and make the timeout value 250 ms. Signed-off-by: Sergei Antonov <saproj@gmail.com> Reviewed-by: Rick Chen <rick@andestech.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-21mmc: fsl_esdhc: fix problem when using clk driverYe Li
Move init_clk_usdhc to non-clk driver case, since assigned-clocks properties will initialize the clocks by clk driver. Signed-off-by: Ye Li <ye.li@nxp.com> Signed-off-by: Marek Vasut <marex@denx.de> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-10-17dm: treewide: Use uclass_first_device_err when accessing one deviceMichal Suchanek
There is a number of users that use uclass_first_device to access the first and (assumed) only device in uclass. Some check the return value of uclass_first_device and also that a device was returned which is exactly what uclass_first_device_err does. Some are not checking that a device was returned and can potentially crash if no device exists in the uclass. Finally there is one that returns NULL on error either way. Convert all of these to use uclass_first_device_err instead, the return value will be removed from uclass_first_device in a later patch. Signed-off-by: Michal Suchanek <msuchanek@suse.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-10-05mmc: zynq_sdhci: Read power-domains id from DT and useAshok Reddy Soma
Firmware calls need node_id which is basically "power-domains" id. At present static values are used based on the "device_id" property of dt. Instead of this, read "power-domains" id from dt and use it. Add a element called node_id in priv structure and read it from dt. Replace static node_id with this priv->node_id across the driver. Since "device_id" is not used anywhere else simply remove it. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Link: https://lore.kernel.org/r/20220930092548.18453-3-ashok.reddy.soma@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-10-05mmc: zynq_sdhci: Change node_id prototype to u32Ashok Reddy Soma
In Versal platform power domain node_id is bigger than u8, hence change prototype to u32 to accommodate. Change u8 to u32 in the function prototypes that use node_id and remove casting to u32 from xilinx_pm_request() call parameters. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@amd.com> Link: https://lore.kernel.org/r/20220930092548.18453-2-ashok.reddy.soma@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-09-25blk: Rename if_type to uclass_idSimon Glass
Use the word 'uclass' instead of 'if_type' to complete the conversion. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-23mmc: mediatek: add support for MediaTek MT7891/MT7986 SoCsWeijie Gao
Add eMMC and SDXC support for MediaTek MT7981/MT7986 SoCs Both chips support SDXC and eMMC 4.5. MT7986A supports eMMC 5.1. Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-09-20Merge tag 'u-boot-at91-2023.01-a' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-at91 into next First set of u-boot-at91 features for the 2023.01 cycle: This feature set includes the important update on PIO4 pinctrl driver that solves a long time mismatch between Linux and U-boot, related on the unification of pinctrl and gpio driver support, now respecting the pinctrl bindings ABI; and also support for pinctrl subnodes. The feature set also adds support for PDA screen detection for sam9x60_curiosity board , one fix for SD-Card reinsertion and one fix for sam9x60 clocks.
2022-09-19Merge branch 'master' into nextTom Rini
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-09-19mmc: atmel_sdhci: re-enable sdhci after SD Card re-insertionSergiu Moga
Whenever the SD Card would be removed and then re-inserted while in the U-Boot command line, the `SDBPWR` bit of the `SDMMC_PCR` register would remain unset afterwards. In order for the bit to be set again after re-insertion, register an additional `deferred_probe` method that the DM would then transparently call. This method will call the generic `sdhci_probe` which will, during its execution flow, set this bit to 1. Signed-off-by: Sergiu Moga <sergiu.moga@microchip.com> Reported-by: Mihai Sain <mihai.sain@microchip.com> Reviewed-by: Eugen Hristev <eugen.hristev@microchip.com>
2022-09-18cyclic: Use schedule() instead of WATCHDOG_RESET()Stefan Roese
Globally replace all occurances of WATCHDOG_RESET() with schedule(), which handles the HW_WATCHDOG functionality and the cyclic infrastructure. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2022-09-16mmc: fsl_esdhc_spl: Add support for builds without CONFIG_SYS_MMC_U_BOOT_OFFSPali Rohár
When fixed offset via CONFIG_SYS_MMC_U_BOOT_OFFS is not specified then expects that U-Boot proper is placed immediately after SPL without any additional padding. This allows to generate smaller SPL+U-Boot final binary as it is not required to specify fixed offset to U-Boot proper at SPL compile time. In this case offset to U-Boot proper is calculated at SPL compile time in linker script. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Marek Behún <kabel@kernel.org>
2022-09-16mmc: fsl_esdhc_spl: Add support for loading proper U-Boot from unaligned ↵Pali Rohár
location This allows to concatenate SPL and proper U-Boot without extra alignment. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Marek Behún <kabel@kernel.org>
2022-09-16blk: Switch over to using uclass IDsSimon Glass
We currently have an if_type (interface type) and a uclass id. These are closely related and we don't need to have both. Drop the if_type values and use the uclass ones instead. Maintain the existing, subtle, one-way conversion between UCLASS_USB and UCLASS_MASS_STORAGE for now, and add a comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-16blk: Select SPL_LEGACY_BLOCK automaticallySimon Glass
Selecting this option can be handled in the Kconfig option itself, as it is with BLK. Update this an drop the various 'select' clauses. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-16blk: Rename HAVE_BLOCK_DEVICESimon Glass
This option is fact really related to SPL. For U-Boot proper we always use driver model for block devices, so CONFIG_BLK is enabled if block devices are in use. It is only for SPL that we have two cases: - SPL_BLK is enabled, in which case we use driver model and blk-uclass.c - SPL_BLK is not enabled, in which case (if we need block devices) we must use blk_legacy.c Rename the symbol to SPL_LEGACY_BLOCK to make this clear. This is different enough from BLK and SPL_BLK that there should be no confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12Convert CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE to KconfigTom Rini
This converts the following to Kconfig: CONFIG_SYS_FSL_ESDHC_HAS_DDR_MODE Signed-off-by: Tom Rini <trini@konsulko.com>
2022-08-10common: Drop display_options.h from common headerSimon Glass
Move this out of the common header and include it only where needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-10mmc: Do not send status of send_status is falseMarek Vasut
Commit 44645f87de5 ("mmc: Fix mmc_switch excessive timeout") introduced a side effect where CMD13 SEND_STATUS is issued in case mmc_wait_dat0() does not return -ENOSYS and $send_status is not set. This happens on all hardware which does implement .mmc_wait_dat0 callback, e.g. i.MX8M . This leads to lengthy timeout before booting OS in case of eMMC in one of the HS200/HS400 modes, since the card cannot respond to CMD13 while downgrading from HS200/HS400 to regular HS mode. Fix this by adding the missing conditional. Fixes: 44645f87de5 ("mmc: Fix mmc_switch excessive timeout") Signed-off-by: Marek Vasut <marex@denx.de> Cc: Jaehoon Chung <jh80.chung@samsung.com> Cc: Kirill Kapranov <kirill.kapranov@compulab.co.il> Cc: Marek Behún <marek.behun@nic.cz> Cc: Pantelis Antoniou <panto@antoniou-consulting.com> Cc: Ye Li <ye.li@nxp.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-07-27mmc: pci_mmc.c should build with ACPIGEN=nHeinrich Schuchardt
sandbox_defconfig builds the PCI MMC driver. It should be possible to build the sandbox without ACPI support. ACPI support in the PCI MMC driver is only needed when creating an ACPI table. Fix building with ACPIGEN=n. Fixes: dba7ee419d9d ("acpi: mmc: Generate ACPI info for the PCI SD Card") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2022-07-27drivers: mmc: write protect single boot areaYing-Chun Liu (PaulLiu)
Add features to write protect single boot area rather than all boot areas. Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> Cc: Peng Fan <peng.fan@nxp.com> Cc: Jaehoon Chung <jh80.chung@samsung.com>
2022-07-27mmc: nuvoton: Add NPCM7xx mmc driverJim Liu
Add Nuvoton BMC NPCM750 mmc control driver. Signed-off-by: Jim Liu <JJLIU0@nuvoton.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-07-27mmc: fsl_esdhc: Fix 'Internal clock never stabilised.' errorPali Rohár
Only newer eSDHC controllers set PRSSTAT_SDSTB flag. So do not wait until flag PRSSTAT_SDSTB is set on old pre-2.2 controllers. Instead sleep for fixed amount of time like it was before commit 6f883e501b65 ("mmc: fsl_esdhc: Add emmc hs200 support"). This change fixes error 'Internal clock never stabilised.' which is printed on P2020 board at every access to SD card. Fixes: 6f883e501b65 ("mmc: fsl_esdhc: Add emmc hs200 support") Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2022-07-26Merge tag 'u-boot-imx-20220726' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-imx u-boot-imx-20220726 ------------------- i.MX for 2022.10 - Added i.MX93 architecture CI: https://source.denx.de/u-boot/custodians/u-boot-imx/-/pipelines/12891
2022-07-26mmc: fsl_esdhc_imx: Support i.MX9Peng Fan
Support i.MX9 for fsl_esdhc_imx driver Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-07-26mmc: zynq_sdhci: Fix timing macros for MMC High speedAshok Reddy Soma
Timing macro's are wrong for MMC_HS_52 and MMC_DDR_52. Fix it with correct values of MMC_TIMING_MMC_HS and MMC_TIMING_MMC_DDR52 respectively. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Link: https://lore.kernel.org/r/1656319965-12124-1-git-send-email-ashok.reddy.soma@xilinx.com Signed-off-by: Michal Simek <michal.simek@amd.com>
2022-07-25mmc: msm_sdhci: Add SDCC version 5.0.0 supportSumit Garg
For SDCC version 5.0.0, MCI registers are removed from SDCC interface and some registers are moved to HC. So add support to use the new compatible string "qcom,sdhci-msm-v5". Based on this new msm variant, pick the relevant variant data and use it to detect MCI presence thereby configuring register read/write to msm specific registers. Signed-off-by: Sumit Garg <sumit.garg@linaro.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2022-07-21arch: mvebu: Disable by default unused peripherals in SPLPali Rohár
SPL on mvebu loads proper U-Boot from custom Marvell kwbimage format and therefore support for other binary formats is not required to be present in SPL. Boot source of proper U-Boot is defined by compile time options and therefore it is not required to enable all possible and unused peripherals in SPL by default. This change decrease size of SPL binaries. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-07-13mmc: mediatek: add support for MediaTek MT7621 SoCWeijie Gao
This patch adds SDXC support for MediaTek MT7621 SoC Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
2022-07-12mmc: stm32_sdmmc2: introduce of_to_plat opsPatrick Delaunay
Add the uclass ops of_to_plat to parse the device tree properties to respect the expected sequence by the driver model. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-07-12mmc: stm32_sdmmc2: remove privdataPatrick Delaunay
All the elements of privdata are static and build from device tree, they are moved in platdata to prepare the support of ops of_to_plat. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-07-12mmc: stm32_sdmmc2: cosmetic: rename stm32_sdmmc_bindPatrick Delaunay
Rename stm32_sdmmc_bind to stm32_sdmmc2_bind as all other functions in SDMMCv2 driver Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Change-Id: Ic51acdfbbba6e971809c1029dd2227038bfe879d
2022-07-07arm: Remove PXA architecture supportTom Rini
With the last platform for this architecture removed, remove the rest of the architecture support as well. Cc: Marek Vasut <marex@denx.de> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-07-07spl: Ensure all SPL symbols in Kconfig have some SPL dependencyTom Rini
Tighten up symbol dependencies in a number of places. Ensure that a SPL specific option has at least a direct dependency on SPL. In places where it's clear that we depend on something more specific, use that dependency instead. This means in a very small number of places we can drop redundant dependencies. Reported-by: Pali Rohár <pali@kernel.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2022-07-06mmc/aspeed: Enable controller clocksJoel Stanley
Request and enable the controller level clocks. Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-07-06mmc/aspeed: Probe from controllerJoel Stanley
The Aspeed SDHCI controller is arranged with some shared control registers, followed by one or two sets of actual SDHCI registers. Adjust the driver to probe this controller device first. The driver then wants to iterate over the child nodes to probe the SDHCI proper: ofnode node; dev_for_each_subnode(node, parent) { struct udevice *dev; int ret; ret = device_bind_driver_to_node(parent, "aspeed_sdhci", ofnode_get_name(node), node, &dev); if (ret) return ret; } However if we did this the sdhci driver would probe twice; once "naturally" from the device tree and a second time due to this code. Instead of doing this we can rely on the probe order, where the controller will be set up before the sdhci devices. A better solution is preferred. Select MISC as the controller driver is implemented as a misc device. Signed-off-by: Joel Stanley <joel@jms.id.au>
2022-07-06mmc/aspeed: Add debuging for clock probe failuresJoel Stanley
Signed-off-by: Joel Stanley <joel@jms.id.au>