summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/omap_hsmmc.c
Commit message (Collapse)AuthorAgeFilesLines
* common: Drop asm/global_data.h from common headerSimon Glass2021-02-021-0/+1
| | | | | | | | | | | | Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
* dm: treewide: Rename ofdata_to_platdata() to of_to_plat()Simon Glass2020-12-131-2/+2
| | | | | | | This name is far too long. Rename it to remove the 'data' bits. This makes it consistent with the platdata->plat rename. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename dev_get_platdata() to dev_get_plat()Simon Glass2020-12-131-4/+4
| | | | | | Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass2020-12-131-1/+1
| | | | | | | | | | We use 'priv' for private data but often use 'platdata' for platform data. We can't really use 'pdata' since that is ambiguous (it could mean private or platform data). Rename some of the latter variables to end with 'plat' for consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename auto_alloc_size members to be shorterSimon Glass2020-12-131-2/+2
| | | | | | | | | | | | This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <sjg@chromium.org>
* treewide: convert devfdt_get_addr() to dev_read_addr()Masahiro Yamada2020-07-251-2/+2
| | | | | | | | | | | | | | | | | | | | When you enable CONFIG_OF_LIVE, you will end up with a lot of conversions. To generate this commit, I used coccinelle excluding drivers/core/, include/dm/, and test/ The semantic patch that makes this change is as follows: <smpl> @@ expression dev; @@ -devfdt_get_addr(dev) +dev_read_addr(dev) </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
* Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"Tom Rini2020-07-241-2/+2
| | | | | | | | | | This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing changes made to 56d37f1c564107e27d873181d838571b7d7860e7. Unfortunately this is causing CI failures: https://travis-ci.org/github/trini/u-boot/jobs/711313649 Signed-off-by: Tom Rini <trini@konsulko.com>
* treewide: convert devfdt_get_addr() to dev_read_addr()Masahiro Yamada2020-07-201-2/+2
| | | | | | | | | | | | | | | | | | | | When you enable CONFIG_OF_LIVE, you will end up with a lot of conversions. To generate this commit, I used coccinelle excluding drivers/core/, include/dm/, and test/ The semantic patch that makes this change is as follows: <smpl> @@ expression dev; @@ -devfdt_get_addr(dev) +dev_read_addr(dev) </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
* mmc: omap_hsmmc: Set 3.3V for IO voltage on all placesPali Rohár2020-07-131-1/+1
| | | | | | | | | | | | | | In commit commit d2c05f50e12f ("mmc: omap_hsmmc: Set 3.3V for IO voltage") was changed 3.0V IO voltage to 3.3V but it was not done on all places in omap_hsmmc driver. That commit broke eMMC support on Nokia N900. This patch fixes that problematic commit and changes 3.0V to 3.3V on all remaining places in omap_hsmmc driver. Fixes: d2c05f50e12f ("mmc: omap_hsmmc: Set 3.3V for IO voltage") Signed-off-by: Pali Rohár <pali@kernel.org> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Faiz Abbas <faiz_abbas@ti.com>
* mmc: omap_hsmmc: Add guards around omap_hsmmc_get_cfg()Tom Rini2020-06-161-0/+3
| | | | | | | | | | | | We only call the function omap_hsmmc_get_cfg in the case of OMAP34XX or when we have to iodelay recalibration. Add guards for these checks as clang will otherwise warn. Cc: Peng Fan <peng.fan@nxp.com> Cc: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
* common: Drop linux/bitops.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop linux/delay.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop log.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: Drop net.h from common headerSimon Glass2020-05-181-0/+1
| | | | | | | | | | | Move this header out of the common header. Network support is used in quite a few places but it still does not warrant blanket inclusion. Note that this net.h header itself has quite a lot in it. It could be split into the driver-mode support, functions, structures, checksumming, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
* mmc: Merge SD_LEGACY and MMC_LEGACY bus modesFaiz Abbas2020-03-091-1/+0
| | | | | | | | | MMC_LEGACY & SD_LEGACY are not differentiated timings in the spec and don't have any meaningful differences. Therefore, get rid of all references to SD_LEGACY and use MMC_LEGACY to mean both of them. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
* dm: core: Require users of devres to include the headerSimon Glass2020-02-051-0/+2
| | | | | | | | | | At present devres.h is included in all files that include dm.h but few make use of it. Also this pulls in linux/compat which adds several more headers. Drop the automatic inclusion and require files to include devres themselves. This provides a good indication of which files use devres. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de>
* dm: gpio: Allow control of GPIO uclass in SPLSimon Glass2019-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | At present if CONFIG_SPL_GPIO_SUPPORT is enabled then the GPIO uclass is included in SPL/TPL without any control for boards. Some boards may want to disable this to reduce code size where GPIOs are not needed in SPL or TPL. Add a new Kconfig option to permit this. Default it to 'y' so that existing boards work correctly. Change existing uses of CONFIG_DM_GPIO to CONFIG_IS_ENABLED(DM_GPIO) to preserve the current behaviour. Also update the 74x164 GPIO driver since it cannot build with SPL. This allows us to remove the hacks in config_uncmd_spl.h and Makefile.uncmd_spl (eventually those files should be removed). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* common: Move ARM cache operations out of common.hSimon Glass2019-12-021-0/+1
| | | | | | | | | These functions are CPU-related and do not use driver model. Move them to cpu_func.h Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* mmc: Rename timeout parameters for clarificationSam Protsenko2019-09-051-3/+3
| | | | | | | | | | | | | | | | | It's quite hard to figure out time units for various function that have timeout parameters. This leads to possible errors when one forgets to convert ms to us, for example. Let's rename those parameters correspondingly to 'timeout_us' and 'timeout_ms' to prevent such issues further. While at it, add time units info as comments to struct mmc fields. This commit doesn't change the behavior, only renames parameters names. Buildman should report no changes at all. Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org> Reviewed-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com>
* mmc: omap_hsmmc: provide wait_dat0 even if UHS modes are not supportedJean-Jacques Hiblot2019-07-151-4/+0
| | | | | | This function can also be used for eMMC devices. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: don't fill the send_init_stream callbackJean-Jacques Hiblot2019-07-151-9/+0
| | | | | | | This is not required. The MMC core sends CMD0 right after the initialization and it serves the same purpose. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: reset FSM for DAT and CMD lines if needed before a new commandJean-Jacques Hiblot2019-07-151-7/+6
| | | | | | | | | | | It sometimes happen that the PSTATE register does not indicate that the bus is ready when it really is. This usually happens after a mode switch. In that case it makes sense to reset the FSM handling the CMD and DATA Also reset the FSMs if the STATE register cannot be cleared. This also sometimes happens after a mode switch. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: Set 3.3V for IO voltageFaiz Abbas2019-04-121-11/+10
| | | | | | | | Pbias voltage should match the IO voltage set for the SD card. With the latest pbias change to 3.3V, update the capabilities and IO voltages settings to 3.3V. Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
* Merge tag 'dm-pull-10feb19' of git://git.denx.de/u-boot-dmTom Rini2019-02-101-8/+8
|\ | | | | | | | | | | | | Samsung sound patches (applied for Samsung maintainer) Common sound support buildman environment support of-platdata documentation improvements
| * mmc: omap_hsmmc: Use regulator_set_enable_if_allowed for enabling regulatorLokesh Vutla2019-02-091-8/+8
| | | | | | | | | | | | | | | | | | Use regulator_set_enable_if_allowed() api instead of regulator_set_enable() while enabling io regulators. This way the driver doesn't see an error when disabling an always-on regulator and when enabling is not supported. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
* | mmc: omap_hsmmc: Workaround errata regarding SDR104/HS200 tuning failures (i929)Faiz Abbas2019-02-091-1/+91
|/ | | | | | | | | | | | | | | | | | | | | Errata i929 in certain OMAP5/DRA7XX/AM57XX silicon revisions (SPRZ426D - November 2014 - Revised February 2018 [1]) mentions unexpected tuning pattern errors. A small failure band may be present in the tuning range which may be missed by the current algorithm. Furthermore, the failure bands vary with temperature leading to different optimum tuning values for different temperatures. As suggested in the related Application Report (SPRACA9B - October 2017 - Revised July 2018 [2]), tuning should be done in two stages. In stage 1, assign the optimum ratio in the maximum pass window for the current temperature. In stage 2, if the chosen value is close to the small failure band, move away from it in the appropriate direction. References: [1] http://www.ti.com/lit/pdf/sprz426 [2] http://www.ti.com/lit/pdf/SPRACA9 Signed-off-by: Faiz Abbas <faiz_abbas@ti.com>
* mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL checkBin Meng2018-11-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage. To mitigate this potential impact, the following changes are implemented: - Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* mmc: omap_mmc: Remove invert referencesAdam Ford2018-09-291-11/+1
| | | | | | | | | | With DM_GPIO and DM_MMC translating GPIO_ACTIVE_LOW, any boards using the 'cd-invert' option will no longer need to do this. This patch removes the support for 'invert' from the MMC driver. Signed-off-by: Adam Ford <aford173@gmail.com> [trini: Fix warning over when !DM_GPIO] Signed-off-by: Tom Rini <trini@konsulko.com>
* mmc: omap_hsmmc: Fix pbias for omap3_logic to enable CD pinAdam Ford2018-09-251-0/+4
| | | | | | | | | The MMC card detect pin is connected to gpio127 on omap3_logic. When setting up the pbias register for MMC, let's also enable gpio_127 for the card detect. As part of the package deal, gpio_126 and gpio_129 are also enabled. Signed-off-by: Adam Ford <aford173@gmail.com>
* mmc: omap_hsmmc: Make DM_GPIO calls dependent on DM_GPIOAdam Ford2018-09-111-5/+9
| | | | | | | | The getcd and getwp functions when DM_MMC is enabled are assumming the DM_GPIO is enabled. In cases (like SPL) where DM_GPIO may not be enabled, wrap these calls in an #ifdef Signed-off-by: Adam Ford <aford173@gmail.com>
* mmc: omap_hsmmc: use a default 52MHz max clock rate if none is specifiedJean-Jacques Hiblot2018-02-261-0/+2
| | | | | | | | | | mmc_of_parse() doesn't set a default value if none is available in DT. In that case, use a default 52MHz clock rate. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Tested-by: Adam Ford <aford173@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* mmc: omap_hsmmc: make it possible to compile out ADMA supportJean-Jacques Hiblot2018-02-261-6/+6
| | | | | | | | | | | Some platforms don't have ADMA controllers. For those platforms, compiling it out reduces the size of the binary by about 600 bytes. Leaving the support in doesn't break things as the driver checks at runtime if the ADMA2 controller is present. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Tested-by: Adam Ford <aford173@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* mmc: omap_hsmmc: compile out write support if not neededJean-Jacques Hiblot2018-02-261-2/+9
| | | | | | | | This reduces the size of the binary by about 196 bytes. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Tested-by: Adam Ford <aford173@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* mmc: omap_hsmmc: do not embed struct mmc in struct omap_hsmmc_platJean-Jacques Hiblot2018-02-261-3/+3
| | | | | | | | | | | | | The area for struct mmc can be allocated dynamically. It greatly reduces the size of struct omap_hsmmc_plat. This is useful in cases where the board level code declares one or two struct omap_hsmmc_plat because it doesn't use the Driver Model. This saves around 740 bytes for the am335x_evm SPL. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Tested-by: Adam Ford <aford173@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* mmc: Fix uninitialised priv memberAlex Kiernan2018-02-191-1/+1
| | | | | | | | | When using omap_hsmmc without the device model then the allocation of mmc->priv ends up uninitialised. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com> Tested-by: Robert Nelson <robertcnelson@gmail.com> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>
* mmc: omap_hsmmc: add signal voltage selection supportJean-Jacques Hiblot2018-02-191-22/+154
| | | | | | | | | | I/O data lines of UHS SD card operates at 1.8V when in UHS speed mode (same is true for eMMC in DDR and HS200 modes). Add support to switch signal voltage to 1.8V in order to support UHS cards and eMMC HS200 and DDR modes. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: allow mmc clock to be gatedKishon Vijay Abraham I2018-02-191-0/+6
| | | | | | | | mmc core has defined a new parameter *clk_disable* to gate the clock. Disable the clock here if *clk_disable* is set. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: implement send_init_stream callbackJean-Jacques Hiblot2018-02-191-0/+13
| | | | | | This callback is used to send the 74 clock cycles after power up. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: update mmc->clock with the actual bus speedJean-Jacques Hiblot2018-02-191-1/+2
| | | | | | | When the clock is applied, compute the actual value of the clock. It may be slightly different from the requested value (max freq, divisor threshold) Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: allow the simple HS modes to use the default pinctrlJean-Jacques Hiblot2018-02-191-10/+13
| | | | | | | The default configuration is usually working fine for the the HS modes. Don't enforce the presence of a dedicated pinmux for the HS modes. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: Add support to get pinctrl values and max frequency for ↵Kishon Vijay Abraham I2018-02-191-14/+44
| | | | | | | | | | | | | | different hw revisions AM572x SR1.1 requires different IODelay values to be used than that used in AM572x SR2.0. These values are populated in device tree. Add capability in omap_hsmmc driver to extract IOdelay values for different silicon revision. The maximum frequency is also reduced when using a ES1.1. To keep the ability to boot both revsions with the same dtb, those values can be provided by the platform code. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: Add support to set IODELAY valuesKishon Vijay Abraham I2018-02-191-0/+372
| | | | | | | | | | | | The data manual of J6/J6 Eco recommends to set different IODELAY values depending on the mode in which the MMC/SD is enumerated in order to ensure IO timings are met. Add support to parse mux values and iodelay values from device tree and set these depending on the enumerated MMC mode. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: use mmc_of_parse to populate mmc_configKishon Vijay Abraham I2018-02-191-19/+5
| | | | | | | | Use the mmc_of_parse library function to populate mmc_config instead of repeating the same code in host controller driver. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: Reduce the max timeout for reset controller fsmJean-Jacques Hiblot2018-02-191-1/+2
| | | | | | | | | | | | | | >From OMAP3 SoCs (OMAP3, OMAP4, OMAP5, AM572x, AM571x), the DAT/CMD lines reset procedure section in TRM suggests to first poll the SRD/SRC bit until it is set to 0x1. But looks like that bit is never set to 1 and there is an observable delay of 1sec everytime the driver tries to reset DAT/CMD. (The same is observed in linux kernel). Reduce the time the driver waits for the controller to set the SRC/SRD bits to 1 so that there is no observable delay. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: Workaround for errata id i802Jean-Jacques Hiblot2018-02-191-6/+22
| | | | | | | | | | | | | | | | | | According to errata i802, DCRC error interrupts (MMCHS_STAT[21] DCRC=0x1) can occur during the tuning procedure. The DCRC interrupt, occurs when the last tuning block fails (the last ratio tested). The delay from CRC check until the interrupt is asserted is bigger than the delay until assertion of the tuning end flag. Assertion of tuning end flag is what masks the interrupts. Because of this race, an erroneous DCRC interrupt occurs. The suggested workaround is to disable DCRC interrupts during the tuning procedure which is implemented here. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: Add tuning supportJean-Jacques Hiblot2018-02-191-0/+122
| | | | | | | | | HS200/SDR104 requires tuning command to be sent to the card. Use the mmc_send_tuning library function to send the tuning command and configure the internal DLL. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: Enable DDR mode supportKishon Vijay Abraham I2018-02-191-0/+5
| | | | | | | | In order to enable DDR mode, Dual Data Rate mode bit has to be set in MMCHS_CON register. Set it here. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: set MMC mode in the UHSMS bit fieldJean-Jacques Hiblot2018-02-191-0/+47
| | | | | | | | | Use the timing parameter set in the MMC core to set the mode in UHSMS bit field. This is in preparation for adding HS200 support in omap hsmmc driver. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: add support to set default io voltageKishon Vijay Abraham I2018-02-191-0/+67
| | | | | | | | | | | "ti,dual-volt" is used in linux kernel to set the voltage capabilities. For host controller dt nodes that doesn't have "ti,dual-volt", it's assumed 1.8v is the io voltage. This is not always true (like in the case of beagle-x15 where the io lines are connected to 3.3v). Hence if "no-1-8-v" property is set, io voltage will be set to 3v. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* mmc: omap_hsmmc: cleanup omap_hsmmc_set_iosKishon Vijay Abraham I2018-02-191-9/+20
| | | | | | | | | No functional change. Move bus width configuration setting to a separate function and invoke it only if there is a change in the bus width. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>