summaryrefslogtreecommitdiffstats
path: root/drivers/mci
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/misc'Sascha Hauer2018-01-221-10/+6
|\
| * mci: drop unused parameter from mci_switch()Uwe Kleine-König2018-01-221-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SWITCH command has two purposes: a) switch the command set b) Write to the EXT_CSD register If the access field (bits [25:24]) in the argument are b00, we're in case a), otherwise in b). As mci_switch() always passes MMC_SWITCH_MODE_WRITE_BYTE (0b3) in the access field, only case b) is relevant here. According to the eMMC specification[1] the command set field is ignored in case b) and so the respective parameter (that is unused already now) can be dropped. [1] Embedded Multi-Media Card (e•MMC) Electrical Standard (5.1), February 2015; paragraph 6.6.1 Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Revert "mci: imx-esdhc: Enable clock"Andrey Smirnov2018-01-111-1/+0
|/ | | | | | | | | | | | This reverts commit 61c6c24958934b6b226aa37b3b3a2c089189f52b which is pretty much a duplicate of: a97345102 "i.MX: esdhc: Enable host->clk during initialization" Since we don't need to enable that clock twice reverse the former and keep the latter. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX: esdhc: wait until SDSTB is asserted, not other way arroundOleksij Rempel2017-11-171-1/+1
| | | | | | | this added 10msec on each sd/mmc clock switch request. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-10-191-4/+8
|\
| * mmc: allow skipping SD card initializationPhilipp Zabel2017-09-261-4/+8
| | | | | | | | | | | | | | | | | | This patch allows to skip SD card initialization for eMMCs by setting the "no-sd" property in the host controller device tree node. Avoiding two SD command timeouts speeds up detection time by well over 200 ms. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: mmci: add DT supportLucas Stach2017-10-171-3/+36
|/ | | | | | | | | | | Just adds the minimal implementation to fill platform_data from the DT properties with Linux binding. As all MMC controllers are supposed to support at least the 3.3V signalling level, this gets exposed regardless of the platform data, just as other controller drivers in Barebox handle this. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/mmc'Lucas Stach2017-07-311-24/+30
|\
| * mmc: add eMMC v5 and V5.1 detection supportPeter Seiderer2017-07-061-0/+6
| | | | | | | | | | | | | | Just add the defines. Signed-off-by: Peter Seiderer <ps.report@gmx.net> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
| * mmc: Consistently use EXT_CSD_* names from eMMC 5.1 specSascha Hauer2017-07-061-24/+24
| | | | | | | | | | | | | | | | | | | | We have kept the EXT_CSD registers which were added in the 5.1 spec separately for no good reason. Order the EXT_CSD defines by register number instead. Also we had some duplicates, for these consistently use the names from the 5.1 spec. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* | mci: atmel_mci: fix devinfo DEV with OF enabledSam Ravnborg2017-07-201-2/+1
|/ | | | | | | | | | devinfo DEV resulted in a NULL pointer expection. As platform_data is only valid in non-DT setup, fix this so we no longer reference platform_data outside the probe function Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* Merge branch 'for-next/mvebu'Sascha Hauer2017-05-054-0/+459
|\
| * mci: add Marvell Dove SDHCI driverMichael Grzeschik2017-04-194-0/+459
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds a driver for the SDHCI controller found on Marvell Dove SoCs. Despite a missing pinctrl driver, corresponding MPP config has to be set on a per board basis. This driver was succesfully tested with Solidrun Dove Cubox. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: be more verbose about wrong bus-widthChristoph Fritz2017-05-031-4/+7
|/ | | | | | | | | | | | | | If configured or default bus-width is wrong for the current hardware, registration of card/emmc is likely to fail. This patch adds more verbosity in the case of a failed detection: | omap-hsmmc 48060000.mmc: registered as 48060000.mmc | mmc0: detected MMC card version 4.41 | mmc0: Changing MMC bus width failed: -110 | mmc0: Card's startup fails with -110 Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ofpart'Sascha Hauer2017-04-071-1/+3
|\
| * of: partition: Register the of partition fixup for of partition usersSascha Hauer2017-03-311-1/+3
| | | | | | | | | | | | | | at24, at25 and mci core are using of_parse_partitions(). Register the fixup for them aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: atmel_mci: Add DT supportAndrey Smirnov2017-03-301-31/+70
| | | | | | | | | | | | Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mci: Allow parsing for explicit DT nodeAndrey Smirnov2017-03-301-5/+8
|/ | | | | | | | | | | | | | Convert mci_of_parse into mci_of_parse_node, a function that takes explicit deivce tree node pointer to be used for SD/MMC related properties extraction. Implement original mci_of_parse as a wrapper around the call to new function. This is useful for controllers who specify parameter like bus witdth and GPIOs as a part of main controller's child nodes (e.g. AT91 SoCs). Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci-bcm2835: enable devicetree probingEnrico Joerns2017-03-021-0/+9
| | | | | Signed-off-by: Enrico Joerns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX: esdhc: fix imx-esdhc driver for non-OF boardsAlexander Kurz2017-02-141-15/+15
| | | | | | | | | | Commit 39f7a7ee8b68 ("i.MX: esdhc: Do not rely on CPU type for quirks") made imx-esdhc dependent on OF and broke probing for all non-OF boards. Since newer platforms like mx6 and vf610 are restricted to OF, the non-OF probing only needs to distinguish mx5 vs earlier SoC. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: imx-esdhci: remove wrong write protection testSascha Hauer2017-01-191-12/+2
| | | | | | | | | | | Testing for the write protection bit to determine if a card is write protected or not is wrong. The bit may have the wrong value for permanently plugged cards (eMMC) or for boards using a GPIO for write protection detection. Since the core will test for write protection before actually calling into the driver this test can just be removed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: Allow to partition eMMC boot partitionsSascha Hauer2017-01-191-23/+55
| | | | | | | | | So far the eMMC boot partitions cannot be partitioned from the device tree. Since they are often 4MiB in size they are big enough to hold a barebox image and the environment. Add partition parsing to the boot partitions to allow this usecase. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: imx-esdhc: Enable clockSascha Hauer2017-01-191-0/+1
| | | | | | For architectures which do not enable all clocks during initialization. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX: esdhc: Enable host->clk during initializationAndrey Smirnov2017-01-121-0/+7
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/vybrid'Sascha Hauer2017-01-121-24/+105
|\
| * i.MX: esdhc: Request "per" clock explicitlyAndrey Smirnov2017-01-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling clk_get() with NULL as the second argument will give us "ipg" clock as a result. The actual clock feeding into the peripheral is "per" and, depending on the SoC, "ipg" and "per" may be separated by a clock divider, so querying "ipg"'s rate may not result in rate that does not represent the actual peripheral clock rate. Change the code to request "per" as our peripheral clock to avoid aforementioned problem. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * i.MX: esdhc: Do not rely on CPU type for quirksAndrey Smirnov2017-01-111-21/+100
| | | | | | | | | | | | | | | | | | | | | | | | CPU type is not a reliable indicator of the underlying type of IP core used, since there's no 1:1 mapping between the two. As example of one such violation consider Vybrid SoC which contains IP block from i.MX53. Instead port feature flags from corresponding Linux kernel driver and use the ones that are relevant. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2017-01-111-0/+2
|\ \
| * | mci: omap: Add devicetree options parsing by MCI core.Alexander Shiyan2017-01-101-0/+2
| |/ | | | | | | | | | | | | | | This patch adds a callback to parsing devicetree options for MMC: bus-width, etc.. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mci: imx: Add imx6sx compatibleChristian Hemp2017-01-101-0/+2
|/ | | | | | | To let the driver probe on i.MX6SX and i.MX6UL. Signed-off-by: Christian Hemp <c.hemp@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/rockchip'Sascha Hauer2016-09-131-0/+2
|\
| * mci: dw_mmc: Add RK3288 compatible stringWadim Egorov2016-08-261-0/+2
| | | | | | | | | | | | | | | | The SDHC used in the RK2928 and RK3288 are compatible with each other. Add a compatible string for RK3288's SDHC. Signed-off-by: Wadim Egorov <w.egorov@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2016-09-131-2/+1
|\ \
| * | mci: mmci: Fix read FIFO handlingMichael Olbrich2016-09-051-2/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to the Linux kernel and the qemu code, the MMCIFIFOCNT contains the remaining number of words to read, excluding those that are already in the FIFO. So the current number of bytes in the FIFO is host_remain - (readl(base + MMCIFIFOCNT) << 2). Also writing to MMCIDATACTRL will reset the read counter. As a result, MCI_DATABLOCKEND is never set and read_bytes() waits forever. With this change, SD-Card support on qemu vexpress works correctly. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / ARM: i.MX drivers: enable i.MX50 where already supportedAlexander Kurz2016-09-121-1/+3
|/ | | | | | | | The i.MX50 SOC includes one ESDHCv3, three ESDHCv2, one cspi and two ecspi instances which are supported by existing drivers. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "mci: imx-esdhc: Remove excess function"Sascha Hauer2016-07-141-0/+9
| | | | | | | | | | | This reverts commit 8a6896971d093b9d8d1c36eb0d7af891b6ca5369. With this patch it's no longer possible to call detect on the physical device which is necessary for example to make environment on MMC work. Unlike the commit message for 8a6896971d claims mci_detect_card() is not called from mci_register(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: imx-esdhc: Remove excess functionAlexander Shiyan2016-06-201-9/+0
| | | | | | | | Function detect() is defined in the MCI core and mci_detect_card() is already called form mci_register(). Remove excess fuction. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: core: Do not fail if vmmc regulator failAlexander Shiyan2016-06-201-9/+10
| | | | | | | | The vmmc regulator can be an usupported device for barebox, the specific MFD regulator type, for example. Just lets think is all ok. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: imx: Add devicetree options parsing by MCI core.Alexander Shiyan2016-06-201-0/+2
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mci: imx: Use mci_register() return value for driver probe.Alexander Shiyan2016-06-201-3/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-06-141-5/+9
|\
| * mci: Fix version numbers againTrent Piepho2016-06-071-5/+9
| | | | | | | | | | | | | | | | | | | | | | The SD and eMMC version numbers are a pain to print and sort, since they are inconsistent in if a two digit minor version shdoulde be treated as a single number or as minor and micro version numbers. This allows version 1.10 and 4.5 and 4.41, where 41 is less than 5. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | MCI: imx-esdhc: Allow to use 1-bit bus width in board filesAlexander Shiyan2016-05-311-6/+3
|/ | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-05-091-1/+9
|\
| * mci: mxs: add support for dt aliases to name devicesUwe Kleine-König2016-04-121-1/+9
| | | | | | | | | | | | | | | | While changing there, reformat the comment and use ; instead of , after the previous call. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/include-cleanup'Sascha Hauer2016-05-091-3/+3
|\ \
| * | string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-3/+3
| |/ | | | | | | | | | | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mci: imx-esdhc: implement reset quirks for i.MX6 DualLite/SoloStefan Christ2016-05-091-0/+14
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all the reset values of MMC interfaces are differently between Quad and DualLite/Solo SoM. Register VEND_SPEC2(0xC8) Quad: 0x0 DualLite: 0x00000006 default: 0x00000006 (from i.MX6 Reference Manual) Furthermore the ROM Code of Quad and DualLite uses the MMC interfaces differently when it loads the bootloader from that device: Register DLL_CTRL(0x60) Bit 25 FBCLK_SEL (0x48) Quad: 0x0 0 DualLite: 0x01000021 1 Since the linux kernel and barebox driver doesn't reset all registers, the MMC interface is in an inconsistent state, which leads to boot failures for some eMMC devices on the i.MX6 DualLite SoM. The errors look like: mmcblk3: error -110 sending stop command, original cmd response 0x900, card status 0x400900 mmcblk3: error -84 transferring data, sector 24578, nr 2, cmd response 0x900, card status 0x0 mmcblk3: retrying using single block read mmcblk3: error -84 transferring data, sector 24578, nr 2, cmd response 0x900, card status 0x0 blk_update_request: I/O error, dev mmcblk3, sector 24578 It's sufficient to reset register DLL_CTRL and bit FBCLK_SEL. Register VEND_SPEC2 has no effect. Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-0710-30/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bcm2835: introduce mach-bcm283xAlexander Aring2016-01-042-4/+4
| | | | | | | | | | | | This patch changes the most part of mach-bcm2835 to mach-bcm283x. This prepares to add RPi2 support which is a bcm2836. This patch changes the Kconfig entry namens to BCM283X for drivers only. These drivers should working the same in bcm2836. While updating defconfig I added LED support/trigger option. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>