summaryrefslogtreecommitdiffstats
path: root/drivers/mci
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/parameter'Sascha Hauer2020-02-181-3/+4
|\
| * mci: remove param_probe member from struct mciChristian Eggers2020-01-271-3/+4
| | | | | | | | | | | | | | After adding the parameter, the pointer isn't required anymore. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mmc'Sascha Hauer2020-02-182-4/+30
|\ \
| * | mci: core: populate mci_ios.timing memberAhmad Fatoum2020-02-141-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far we passed an uninitialized timing member in the ios to the ->set_ios of the host controller drivers. To allow extension for new modes that need MCI host support beyond the usual clock rate change, make the member useful: - populate is with the correct value - add some type safety by using an enum - print it in the devinfo output Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: stm32_sdmmc2: add High-Speed (26 & 52 MHz) supportAhmad Fatoum2020-02-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | The SDMMC2 doesn't need any special setup for High-Speed modes, except for the clock changes. Thus set the cap flags if the max clock would allow for the higher speed mode. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2020-02-181-1/+1
|\ \ \
| * | | mci: stm32_sdmmc2: don't ignore reset_control_get errorsAhmad Fatoum2020-02-121-1/+1
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | reset_control_get returns a NULL pointer when no resets were specified via device tree properties. If there's a malformed "resets"-property, we get an error pointer. This error should be propagated, only the NULL returns are the ones we can safely ignore. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/imx'Sascha Hauer2020-02-181-1/+1
|\ \ \ | |_|/ |/| |
| * | mci: imx-esdhc: lower timeout message priority to dev_dbgSascha Hauer2020-02-131-1/+1
| |/ | | | | | | | | | | | | | | | | The timeout when waiting for a command to complete is expected in some cases, so do not bark loudly. This used to be dev_dbg() earlier already. Fixes: 4a7d7b16e2 ("mci: imx-esdhc: Share code for esdhc_send_cmd()") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: stm32_sdmmc2: fix typo in debug stringAhmad Fatoum2020-02-031-1/+1
| | | | | | | | | | | | | | s/bus_with/bus_width/ Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: stm32_sdmmc2: compare ios ->bus_width with correct constantsAhmad Fatoum2020-02-031-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MMC_BUS_WIDTH_4 != 4 && MMC_BUS_WIDTH_8 != 8. This enables driver support for 4-bit SD-Cards and 8-bit MMCs, which before was disabled because of CRC errors: ERROR: error SDMMC_STA_DCRCFAIL (0x81042) for cmd 18 ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12 These happened because the card was correctly instructed to use the new bus width, but the controller wasn't. Cc: Oleksij Rempel <o.rempel@pengutronix.de> Fixes: ce99d0c86b32ec ("mci: add support for stm32mp sd/mmc controller") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: core: don't test 4-bit-buswidth support if MMC host lacks capabilityAhmad Fatoum2020-02-031-0/+3
| | | | | | | | | | | | | | | | | | | | We already check for MMC_CAP_8_BIT_DATA before trying if buswidth=8 yields legible data. For consistency, don't test whether buswidth=4 works if the MMC host doesn't indicated MMC_CAP_4_BIT_DATA. Fixes: 68db956d ("mci: Fix 8 bit mmc cards") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: stm32_sdmmc2: don't reset before retrying failed operationsAhmad Fatoum2020-02-031-2/+0
| | | | | | | | | | | | | | | | | | | | The original U-Boot code doesn't do this and it wipes the configured settings like clock rate, ensuring that we won't ever recover from the error. Drop it. Fixes: ce99d0c86b32ec ("mci: add support for stm32mp sd/mmc controller") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: stm32_sdmmc2: use correct card power cycle sequenceAhmad Fatoum2020-02-031-15/+14
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The stm32mp157c RM0436 reference manual lists following sequence for resetting the SDMMC: 1. Reset using the RCC.SDMMCxRST register bit -> We do this via reset_control_assert 2. Disable Vcc power to the card -> We don't do this, because the rail often has other 3v3 peripherals hanging off it 3. Set the SDMMC to power-cycle state -> We do this only when the MCI core sets the frequency to zero, not on init! 4. reenable Vcc power to the card after a >1ms -> We don't do this, because we don't disable Vcc 5. Wait >1ms for the power ramp period, then put card into power-off -> We do this in stm32_sdmmc2_pwron 6. Wait >1ms, then put card into power-on state -> We do this in stm32_sdmmc2_pwron 7. Wait 74 SDMMC_CK cycles before sending the first command to the card -> We don't have an explicit delay between mci_startup_{sd,mmc} and mci_set_blocklen, so a low max-speed may run afoul of the timing constraint Fix 3 & 7. 3 is the main one and doing it fixes an issue of timeouts occurring, when having barebox in a reboot loop or the SD-Card inside a USB-SD-Mux. Fixes: ce99d0c86b32ec ("mci: add support for stm32mp sd/mmc controller") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2020-01-151-1/+1
|\
| * mci: imx-esdhc: fix termination of statementHubert Feurstein2019-12-111-1/+1
| | | | | | | | | | | | | | Use semicolon instead of comma to terminate statement. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | esdhc-pbl: remove now unused imx8_esdhc_load_piggyLucas Stach2020-01-091-42/+0
| | | | | | | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | esdhc-pbl: allow to skip starting i.MX8 imageLucas Stach2020-01-091-9/+13
|/ | | | | | | | | Add an option that allows to just load the image into memory, but return to the calling function instead of directly jumping to the loaded image. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/sdhci'Sascha Hauer2019-12-1012-1074/+1338
|\
| * mci: imx-esdhc: Share code for esdhc_send_cmd()Andrey Smirnov2019-12-044-202/+131
| | | | | | | | | | | | | | | | | | | | Versions of esdhc_send_cmd() in imx-esdhc.c and imx-esdhc-pbl.c implement almost the same algorithm. To avoid code repetition, move that code to imx-esdhc-common.c and adjust all of the users accordingly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc: Introduce esdhc_poll()Andrey Smirnov2019-12-044-39/+66
| | | | | | | | | | | | | | | | Replace all of the explcitly coded timeout loops with a shared subroutine that is used by both regular driver and PBL code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc: Share code for esdhc_(setup|do)_data operationsAndrey Smirnov2019-12-044-81/+95
| | | | | | | | | | | | | | | | | | PBL and PIO case of the regular driver do exaclty the same thing during esdhc_(setup|do)_data stages of esdhc_send_cmd(). Move the code to a common file and adjust all of the users accordingly. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc-pbl: Use sdhci_set_cmd_xfer_mode()Andrey Smirnov2019-12-041-31/+10
| | | | | | | | | | | | | | | | Drop extra code by converting imx-esdhc-pbl.c to use sdhci_set_cmd_xfer_mode(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc-pbl: Use sdhci_transfer_data()Andrey Smirnov2019-12-044-35/+16
| | | | | | | | | | | | | | | | Drop some extra code by converting esdhc_do_data() to use sdhci_transfer_data(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc-pbl: Share IO accessors with regular driverAndrey Smirnov2019-12-045-208/+218
| | | | | | | | | | | | | | | | | | With a bit of a change to PBL ESDHC initialization code it is possible to share all of the low-level I/O accessor code with the regular driver, including sharing definitions of flags describing HW's quirks. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc-pbl: Drop 'wrap_wml' flagAndrey Smirnov2019-12-041-17/+9
| | | | | | | | | | | | | | | | | | | | IMX_SDHCI_WML doesn't change its value during PBL opearation, so it should be possible to configure it once. Doing it once also allows us to move the call into SoC specific code making 'wrap_wml' flag unnecessary. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc-pbl: Share initialization codeAndrey Smirnov2019-12-041-31/+33
| | | | | | | | | | | | | | | | Move common ESDHC initialization code into subroutines and convert the rest of the code to use it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc-pbl: Don't setup DMA registersAndrey Smirnov2019-12-041-6/+0
| | | | | | | | | | | | | | | | PBL code is PIO only, so setting up DMA related registers shouldn't be necessary. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc: Drop extra helper varaibleAndrey Smirnov2019-12-041-5/+3
| | | | | | | | | | | | | | | | There's already 'ret' availible, no need to declare another return value variable. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc: Drop unused type definitionAndrey Smirnov2019-12-041-5/+0
| | | | | | | | | | | | | | | | There doesn't seem to be any users of struct fsl_esdhc_cfg in the tree. Drop it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc: Drop unnecessary type conversionAndrey Smirnov2019-12-041-6/+4
| | | | | | | | | | | | | | | | | | Nether esdhc_setup_data() nor esdhc_do_data() really need struct mci_host, so we can drop a bit of extra type conversion code by changing their signature to accept struct fsl_esdhc_host instead Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: dove: fix dereference of nullable pointerAhmad Fatoum2019-11-251-7/+8
| | | | | | | | | | | | | | | | | | | | | | data->{blocks, blocksize, flags} are all used outside of the if clause checking whether data is not NULL. Fix this to avoid dereferencing null pointers. Fixes: bdcf89d274 ("mci: add Marvell Dove SDHCI driver") Cc: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: add Arasan SDHCI controller driverThomas Haemmerle2019-11-214-0/+433
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds support for the Arasan SDHCI controller, which is found on the Xilinx Zynq 7000 and ZynqMP SoCs. This just adds very basic PIO read/write support. This submission is also missing the tap delay configuration, which is required for the high speed modes on the ZynqMP, but this can be added in a separate patch once it is clear how the interface for this feature should look like. The driver skeleton was provided by Michael, most of the actual driver porting work was done by Thomas and some coding style fixes and write support bug fixes added by Lucas. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net> Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: mci-bcm2835: Use generic PIO transfer functionSascha Hauer2019-11-211-84/+8
| | | | | | | | | | | | Use sdhci_transfer_data() to share more code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhci: Use generic PIO transfer functionSascha Hauer2019-11-211-68/+1
| | | | | | | | | | | | Use sdhci_transfer_data() in PIO mode to share mode code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: tegra: Use sdhci_set_cmd_xfer_mode()Sascha Hauer2019-11-211-30/+3
| | | | | | | | | | | | Use sdhci_set_cmd_xfer_mode() to share more code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: bcm2835: Use sdhci_set_cmd_xfer_mode()Sascha Hauer2019-11-211-20/+2
| | | | | | | | | | | | Use sdhci_set_cmd_xfer_mode() to share more code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc: Use sdhci_set_cmd_xfer_mode()Sascha Hauer2019-11-211-46/+11
| | | | | | | | | | | | Use sdhci_set_cmd_xfer_mode() to share more code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: dove: Use sdhci_set_cmd_xfer_mode()Sascha Hauer2019-11-211-28/+4
| | | | | | | | | | | | Use sdhci_set_cmd_xfer_mode() to share more code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: sdhci: remove duplicate register defines for prsstat bitsSascha Hauer2019-11-215-26/+19
| | | | | | | | | | | | | | We have duplicate register bit defines for the prsstat register. Remove the duplicates. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: sdhci: remove duplicate register defines for interrupt bitsSascha Hauer2019-11-216-70/+41
| | | | | | | | | | | | We have duplicate bit defines for the interrupt bits. Remove the duplicates. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: sdhci: remove duplicate transfer mode register definesSascha Hauer2019-11-215-18/+12
| | | | | | | | | | | | | | We have duplicate register bit defines for the transfer mode register. Remove the duplicates. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: sdhci: remove 32bit register definesSascha Hauer2019-11-211-12/+0
| | | | | | | | | | | | The 32bit register defines are no longer used. Remove them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc-pbl: Use 16bit register definitionsSascha Hauer2019-11-211-9/+14
| | | | | | | | | | | | | | We have some register defines in a 16bit access version and a 32bit access version. Use the former to get rid of the latter later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: tegra: Use 16bit register definitionsSascha Hauer2019-11-211-9/+11
| | | | | | | | | | | | | | We have some register defines in a 16bit access version and a 32bit access version. Use the former to get rid of the latter later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: mci-bcm2835: Use 16bit register definitionsSascha Hauer2019-11-211-10/+12
| | | | | | | | | | | | | | We have some register defines in a 16bit access version and a 32bit access version. Use the former to get rid of the latter later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc: Use 16bit register definitionsSascha Hauer2019-11-211-10/+11
| | | | | | | | | | | | | | We have some register defines in a 16bit access version and a 32bit access version. Use the former to get rid of the latter later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: dove: use sdhci helpersSascha Hauer2019-11-212-54/+63
| | | | | | | | | | | | | | To use the sdhci helpers we have to switch to the sdhci accessors. Also use sdhci_read_response(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: tegra: use sdhci helpersSascha Hauer2019-11-212-58/+65
| | | | | | | | | | | | | | To use the sdhci helpers we have to switch to the sdhci accessors. Also use sdhci_read_response(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: bcm2835: use sdhci helpersSascha Hauer2019-11-212-65/+55
| | | | | | | | | | | | | | To use the sdhci helpers we have to switch to the sdhci accessors. Also use sdhci_read_response(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>