summaryrefslogtreecommitdiffstats
path: root/drivers/mci
Commit message (Collapse)AuthorAgeFilesLines
* mci: stm32_sdmmc2: parse generic MCI oftree propertiesAhmad Fatoum2019-11-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | mci_of_parse takes care of the generic oftree bits, like removable flag, aliases and max-frequency. Insert it, so we can start to refer to the controller's block devices by a fixed name. Sticking in the mci_of_parse shows that the SD/MMC2 driver in barebox doesn't play nicely with the device tree specification of the SD/MMC2 for the dk2 board, however: Specifying the bus-width = <4> property in the device tree now made mmc usage fail when reading the environment: ERROR: error SDMMC_STA_DCRCFAIL (0x81042) for cmd 18 ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12 WARNING: stm32_sdmmc2_send_cmd: cmd 12 failed, retrying ... ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12 WARNING: stm32_sdmmc2_send_cmd: cmd 12 failed, retrying ... ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12 WARNING: stm32_sdmmc2_send_cmd: cmd 12 failed, retrying ... ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12 We'll want to fix this eventually, but for now force the bus width to 1. So we don't forget about this, print a notice to the console that we've done so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: add support for stm32mp sd/mmc controllerOleksij Rempel2019-11-063-0/+675
| | | | | | | | | | This driver was ported from u-boot v2019.10. Instead of devicetree compatible it is using ARM AMBA id. So, there is no need to patch devicetree with different compatible as it was implemented in u-boot. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mmc'Sascha Hauer2019-10-172-6/+28
|\
| * mci: imx-esdhc: fix error handling during probeMarco Felsch2019-09-121-6/+24
| | | | | | | | | | | | | | | | Currently the the driver don't handle any error and return immediately. Handling the errors correctly is a must to support defered probing. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: core: make mci_register -EPROBE_DEFER sensitiveMarco Felsch2019-09-121-0/+4
| | | | | | | | | | | | | | | | If the current regulator can't be requested because of -EPROBE_DEFER we shouldn't print a error and ignore it. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc-pbl: Fix watermark level value for i.MXAndrey Smirnov2019-10-022-3/+23
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Layerscape and i.MX have different semantics of Watermark Level Register. Whereas the former uses "0" to signify maximum allowed value, the latter does not. According to the RM (i.MX8MQ, i.MX6): "...The read burst length must be less than or equal to the read watermark level.." Setting Watermark Level Register to zero violates that limitation. It appears that, on i.MX8MQ, not following that rule causes certain configs + toolchains to result in non-bootable image. Specifically, polling for CICHB, CIDHB and DLA to clear in esdhc_send_cmd() times out. There doesn't appear to be any clear relationship as to what kind of image will have the problem, but the following combinations failed to boot on ZII i.MX8MQ Zest board: - gcc version 9.2.1 20190827 (Red Hat Cross 9.2.1-1) (GCC) + imx_v8_defconfig + CONFIG_DEBUG_LL and CONFIG_PBL_CONSOLE - gcc version 5.5.0 (Timesys 20190405) (custom toolchain) + imx_v8_defconfig Setting WML's *_BRST_LE to 16 and *_WML to 128 on i.MX resolves the issue (same setting that's selected by writing 0 on Layerscape). Fixes: 48562aeaa8 ("esdhc-xload: check for PRSSTAT_BREN only after each block") Cc: Chris Healy <cphealy@gmail.com> Cc: Ruslan Sushko <ruslan.sushko@zii.aero> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX8: Fix piggydata loadingSascha Hauer2019-08-231-8/+13
| | | | | | | | | | We are running at MX8MQ_ATF_BL33_BASE_ADDR now, so we can't use this as a temporary buffer. Add 32MiB to that address and use this instead. Also copy the piggydata to the place where we expect it later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
* esdhc-pbl: add piggy load functionRouven Czerwinski2019-08-071-0/+46
| | | | | | | | | Add a function to load and copy the piggy data to the correct offset expected by barebox in the RAM. This way the PBL can later verify the piggydata before uncompressing and loading the main barebox. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* esdhc-pbl: extract header parsing from image startRouven Czerwinski2019-08-071-14/+30
| | | | | | | | | Extract the header parsing code from esdc_start_image. The header parsing function will be used by the piggy loading code added in the next commit. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/at91'Sascha Hauer2019-06-111-2/+2
|\
| * ARM: at91: replace __raw_{readl, writel} of peripherals with readl, writelAhmad Fatoum2019-05-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the potentially endianness-changing readl, writel and siblings directly. They looks prettier and are the correct thing to do, as even if the CPU is in big-endian mode, the peripherals are little-endian. Unlike Linux, barebox readl,writel are the same Linux' {readl,writel}_relaxed (they don't imply memory barriers) and thus there shouldn't be any functional change. Patch was generated by a mass search and replace. I looked it over, adjust some whitespace and further verified by reviewing the output of git diff HEAD~1 --word-diff | \ perl -pe 's/\[-(.*?)__raw_/{+$1/; s/-\]\{\+/+}{+/;' \ -e 's/(\{\+.*?\+\})\1/__ALL_IS_WELL__/' | grep '+}{+' which filters out the common case of lines where a single __raw_{readT,writeT} had its __raw_ prefix stripped without any further changes. Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Tested-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: introduce sync_caches_for_executionSascha Hauer2019-05-131-1/+3
|/ | | | | | | | | | | | | | | | | | | We have several places in the code which which prepares just modified code for execution. This is done differently in all the places, so add a common function to be used by all. Most places called arm_early_mmu_cache_flush(). This function includes invalidating the instruction cache, so doing it again is unnecessary. Sometimes we had arm_early_mmu_cache_flush() inside #ifdef CONFIG_MMU. The ifdef seems unnecessary since we do not have it consistently, so remove the ifdef. Some early i.MX xload code had icache_invalidate() but forgot to flush the caches. Replace the instruction cache invalidation with sync_caches_for_execution(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mmc'Sascha Hauer2019-05-103-0/+643
|\
| * mci: add driver for BCM283x sdhost coreLucas Stach2019-05-063-0/+643
| | | | | | | | | | | | | | | | | | | | The sdhost is a simple MMC controller found on the Broadcom BCM283x line of SoCs. The driver code was ported from U-Boot and then simplified a bit, by dropping a lot of the state tracking. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | esdhc-xload: invalidate icache before jumping to imageSascha Hauer2019-05-101-0/+3
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc-pbl: ls1046a: Set better divider valuesSascha Hauer2019-05-081-1/+1
|/ | | | | | | MMC Frequency was set to something like 55MHz. This doesn't work for all SD cards. Set to 25MHz which is supported by all SD cards. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/layerscape'Sascha Hauer2019-04-082-2/+61
|\
| * esdhc-xload: Add support for LayerscapeSascha Hauer2019-03-131-1/+59
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc: Actually enable cache snoopingSascha Hauer2019-03-131-1/+2
| | | | | | | | | | | | | | | | | | | | 15b64fd520 introduced the ESDHC_FLAG_CACHE_SNOOPING for layerscape support, but didn't actually set it for layerscape. Add the new flag to the layerscape SoC data. Fixes: 15b64fd520 ("mci: imx-esdhc: Add layerscape support") Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc: resolve conflicting flagsAlexander Kurz2019-03-181-4/+5
| | | | | | | | | | | | | | | | | | | | | | With commit 3354adee3920 ("mci: imx-esdhc: Add bigendian register access support") and commit 15b64fd520c2 ("mci: imx-esdhc: Add layerscape support") two ESDHC_FLAGs got assigned to already existing values. This conflict made the imx6sl usdhc appear to be big endian. Resolve this conflict by assign the new flags to the next vacant values. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc-pbl: initialize is_beChristian Hemp2019-03-181-0/+2
|/ | | | | | | | | Initialize is_be, otherwise the value of is_be is undefined. So it is possible that the i.MX8 will not boot because the bigendian functions are used. Signed-off-by: Christian Hemp <c.hemp@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spd'Sascha Hauer2019-03-072-3/+3
|\
| * crc: import crc_itu_t() from kernelSascha Hauer2019-03-042-3/+3
| | | | | | | | | | | | | | | | Our cyc_crc16() function is the same function as crc_itu_t() in the Linux kernel. Import and use crc_itu_t() from the Kernel for consistency. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/rpi'Sascha Hauer2019-03-071-1/+4
|\ \
| * | mci: bcm2835: parse other device tree properties.Tomaz Solc2019-02-191-0/+3
| | | | | | | | | | | | | | | | | | | | | The driver was missing a call to mci_of_parse() which fills in properties such as "bus-width", "no-sd" into the mci_host struct. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: bcm2835: use device_initcall(), not coredev.Tomaz Solc2019-02-191-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | pinctrl driver needs to be initialized before mci driver on Raspberry Pi. Otherwise the pinctrl device tree properties in the mci node are ignored. pinctrl is initialized by coredevice_initcall(), so moving mci-bcm2835 to device_initcall() ensures that it is initialized later. There is no reason for mci-bcm2835 to use coredevice_initcall(). Other mci drivers already use device_initcall(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | esdhc-xload: check for PRSSTAT_BREN only after each blockSascha Hauer2019-03-051-9/+16
| | | | | | | | | | | | | | | | | | The BREN bit tells us a watermark level sized buffer is ready for read. Instead of testing it before each FIFO read we must only check it once and then read a watermark level sized buffer. This is at least necessary on Layerscape, otherwise timeouts occur while reading the buffer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | esdhc-xload: Add bigendian supportSascha Hauer2019-03-051-3/+10
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | esdhc-xload: Use static inline io wrappersSascha Hauer2019-03-051-27/+33
| | | | | | | | | | | | | | We'll need big endian support for Layerscape, so put the io accessors into static inline wrappers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | esdhc-xload: move some register defines to header fileSascha Hauer2019-03-053-10/+8
| | | | | | | | | | | | To make them usable for the PBL driver aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | esdhc-xload: Move to drivers/mciSascha Hauer2019-03-053-0/+391
|/ | | | | | | The esdhc-xload code will be used by upcoming Layerscape support aswell, so move it from architecture code to drivers/mci/. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rpi'Sascha Hauer2019-02-131-5/+5
|\
| * mci: bcm2835: make locally used functions staticRoland Hieber2019-02-051-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mci-bcm2835 driver registers itself as an MCI driver on probing, and is thereby used through the MCI interface, so these functions are not meant to act as a public interface and only used internally in this compilation unit. This fixes the following build warnings: .../drivers/mci/mci-bcm2835.c:56:6: warning: no previous prototype for 'bcm2835_mci_write' [-Wmissing-prototypes] void bcm2835_mci_write(struct bcm2835_mci_host *host, u32 reg, u32 val) ^~~~~~~~~~~~~~~~~ .../drivers/mci/mci-bcm2835.c:74:5: warning: no previous prototype for 'bcm2835_mci_read' [-Wmissing-prototypes] u32 bcm2835_mci_read(struct bcm2835_mci_host *host, u32 reg) ^~~~~~~~~~~~~~~~ .../drivers/mci/mci-bcm2835.c:83:6: warning: no previous prototype for 'bcm2835_mci_write_data' [-Wmissing-prototypes] void bcm2835_mci_write_data(struct bcm2835_mci_host *host, u32 *p) ^~~~~~~~~~~~~~~~~~~~~~ .../drivers/mci/mci-bcm2835.c:89:6: warning: no previous prototype for 'bcm2835_mci_read_data' [-Wmissing-prototypes] void bcm2835_mci_read_data(struct bcm2835_mci_host *host, u32 *p) ^~~~~~~~~~~~~~~~~~~~~ CC common/date.o .../drivers/mci/mci-bcm2835.c:419:5: warning: no previous prototype for 'bcm2835_mci_reset' [-Wmissing-prototypes] int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev) Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc: Add layerscape supportSascha Hauer2019-02-122-1/+15
| | | | | | | | | | | | | | | | This adds support for the esdhc controller found on Layerscape SoCs. This means adding the compatible and a driver data to access the controller in bigendian mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc: Add bigendian register access supportSascha Hauer2019-02-071-6/+15
| | | | | | | | | | | | Layerscape will need bigendian io accessors. Add support for them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc: implement static inline io wrappersSascha Hauer2019-02-072-64/+83
| | | | | | | | | | | | | | Layerscape will need accesses in big endian mode. To make this possible create static inline wrappers for the io accessors. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc: remove unnecessary includeSascha Hauer2019-02-061-1/+0
| | | | | | | | | | | | Drop inclusion of unnecessary include from mach-imx/include/mach. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc: make clkidx configurableSascha Hauer2019-02-061-1/+7
| | | | | | | | | | | | | | | | Other architectures using this driver may need a different clk_id to find its clock. Make this configurable as a preparation for layerscape support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc: move platform_dataSascha Hauer2019-02-061-1/+1
| | | | | | | | | | | | | | move platform_data from mach-imx/include/mach/ to include/platform_data where it's available for other architectures aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc: use dev_idSascha Hauer2019-02-061-14/+19
| | | | | | | | | | | | | | Avoid using cpu_is_* macros and use a dev_id instead. This will make it easier to integrate the driver into another architecture. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: imx-esdhc: Do not reset twiceSascha Hauer2019-02-061-47/+34
|/ | | | | | | | | | The esdhc controller is resetted once during probe by calling esdhc_reset() and once open coded in esdhc_init(). Resetting it once is enough, so drop the open coded reset from esdhc_init() and call esdhc_reset() there. With this we can remove the call to esdhc_reset() during probe. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mmc'Sascha Hauer2019-01-156-22/+5
|\
| * mci: mxs: Drop explicit devname setup codeAndrey Smirnov2018-12-101-6/+0
| | | | | | | | | | | | | | | | Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: imx-esdhc: Drop explicit devname setup codeAndrey Smirnov2018-12-101-4/+0
| | | | | | | | | | | | | | | | Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: omap_hsmmc: Drop explicit devname setup codeAndrey Smirnov2018-12-101-6/+0
| | | | | | | | | | | | | | | | Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: dw_mmc: Drop explicit devname setup codeAndrey Smirnov2018-12-101-3/+0
| | | | | | | | | | | | | | | | Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: tegra-sdmmc: Drop explicit devname setup codeAndrey Smirnov2018-12-101-3/+0
| | | | | | | | | | | | | | | | Drop explicit devname setup code. Same setup will be done by mci_of_parse(). Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mci: core: Use alias as a devname by defaultAndrey Smirnov2018-12-101-0/+5
| | | | | | | | | | | | | | | | This idiom is repeatead by almost every mci driver, so move it to mci_of_parse() in order to reduce amount of duplicated code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2019-01-151-11/+15
|\ \
| * | mci: skip of_partitions_register_fixup for boot partitionsAhmad Fatoum2019-01-031-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | The bootN-partitions binding is barebox-specific, so it shouldn't be fixed up into the kernel device tree. Suggested-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>