summaryrefslogtreecommitdiff
path: root/drivers/mmc
Commit message (Collapse)AuthorAgeFilesLines
* ARM: pxa: propagate errors from regulator_enable() to pxamciArnd Bergmann2013-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | The em_x270_mci_setpower() and em_x270_usb_hub_init() functions call regulator_enable(), which may return an error that must be checked. This changes the em_x270_usb_hub_init() function to bail out if it fails, and changes the pxamci_platform_data->setpower callback so that the a failed em_x270_mci_setpower call can be propagated by the pxamci driver into the mmc core. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Mike Rapoport <mike@compulab.co.il> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Haojian Zhuang <haojian.zhuang@gmail.com> Acked-by: Chris Ball <cjb@laptop.org> [olof: fixed order of regulator_enable() and test in em_x270_usb_hub_init] Signed-off-by: Olof Johansson <olof@lixom.net>
* Merge tag 'mmc-updates-for-3.11-rc1' of ↵Linus Torvalds2013-07-1063-780/+1726
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc Pull MMC updates from Chris Ball: "MMC highlights for 3.11: Core: - Add support for eMMC 5.1 devices - Add MMC_CAP_AGGRESSIVE_PM capability for aggressive power management of eMMC/SD between requests, using runtime PM - Add an ioctl to perform the eMMC 4.5 Sanitize command. Sample code at: git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git Drivers: - dw_mmc: Add support for Rockchip's Cortex-A9 SoCs - dw_mmc: Add support for Altera SoCFPGAs - sdhci-esdhc-imx: Add support for 8-bit bus width, non-removable cards - sdhci-bcm-kona: New driver for Broadcom Kona (281xx) SoCs - sdhi/tmio: Add DT DMA support" * tag 'mmc-updates-for-3.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (87 commits) mmc: bcm281xx SDHCI driver mmc: sdhci: add card_event callback to sdhci mmc: core: Fixup Oops for SDIO shutdown mmc: sdhci-pci: add another device id mmc: esdhc: Fix bug when writing to SDHCI_HOST_CONTROL register mmc: esdhc: Add support for 8-bit bus width and non-removable card mmc: core: production year for eMMC 4.41 and later mmc: omap: remove unnecessary #if 0's mmc: sdhci: fix ctrl_2 on super-speed selection mmc: dw_mmc-pltfm: add Rockchip variant mmc: dw_mmc-pltfm: move probe and remove below dt match table mmc: dw_mmc-pltfm: remove static from dw_mci_pltfm_remove mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14 mmc: sdhci-pci: add support for eMMC hardware reset for BYT eMMC. mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGA mmc: sdhci: fix caps2 for HS200 sdhci-pxav3: Fix runtime PM initialization mmc: core: Add DT-bindings for MMC_CAP2_FULL_PWR_CYCLE mmc: core: Invent MMC_CAP2_FULL_PWR_CYCLE mmc: core: Enable power_off_notify for eMMC shutdown sequence ...
| * mmc: bcm281xx SDHCI driverChristian Daudt2013-07-053-0/+360
| | | | | | | | | | | | | | | | | | | | | | Add SDHCI driver for the Broadcom 281xx SoCs. Still missing: - power managemement Signed-off-by: Christian Daudt <csd@broadcom.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sdhci: add card_event callback to sdhciChristian Daudt2013-07-052-0/+5
| | | | | | | | | | | | | | | | Add a card_event callback to sdhci so that clients can provide their own card_event to be called when card_detect is triggered. Signed-off-by: Christian Daudt <csd@broadcom.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Fixup Oops for SDIO shutdownUlf Hansson2013-07-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit "mmc: core: Handle card shutdown from mmc_bus" introduced an Oops in the shutdown sequence for SDIO. The drv pointer, does not exist for SDIO since the probing of the SDIO card from the mmc_bus perspective is expected to fail by returning -ENODEV. This patch adds the proper check for the pointer before calling it. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Reported-by: Stephen Warren <swarren@wwwdotorg.org> Reported-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Tested-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sdhci-pci: add another device idAdrian Hunter2013-07-051-0/+9
| | | | | | | | | | | | | | Add another PCI device id for an eMMC host controller. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: esdhc: Fix bug when writing to SDHCI_HOST_CONTROL registerOded Gabbay2013-07-051-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The P2020 has a non-standard implementation of the SDHCI_HOST_CONTROL register. This patch adds a QUIRK in the SDHCI header to signal that a host controller has a non-standard SDHCI_HOST_CONTROL register. The patch adds a check to the function esdhc_writeb in file sdhci-of-esdhc.c, where it checks if the write is done to the SDHCI_HOST_CONTROL register and th host has the above mentioned QUIRK, then the function simply returns instead of writing to the register. The patch also detects if the processor is P2020 (by looking in dev tree) and if so, adds the QUIRK to the host->quirk2 Signed-off-by: Oded Gabbay <ogabbay@advaoptical.com> Reviewed-by: Anton Vorontsov <anton@enomsg.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: esdhc: Add support for 8-bit bus width and non-removable cardOded Gabbay2013-07-052-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support of connecting an MMC media using an 8-bit bus width connection to Freescale's P2020 H/W SDHC controller. During the probe function, the generic function mmc_of_parse is called to detect whether the controller is configured with 8-bit bus width. Also, the generic function detects if the non-removable property is set in the device tree. The function esdhc_pltfm_bus_width was added because the bus width configuration is platform specific. Signed-off-by: Oded Gabbay <ogabbay@advaoptical.com> Reviewed-by: Anton Vorontsov <anton@enomsg.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: production year for eMMC 4.41 and laterRomain Izard2013-07-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The field containing the production date in the CID register only uses 4 bits to encode the year, starting from 1997 in the original standard. In 2013, the production year field contains 0, and the kernel reports a 1997 production date. The eMMC 4.51 specification adds a new interpretation rule. For all devices implementing the 4.41 specification or later, the production year field will be interpreted as a value between 2010 and 2025, with 0 corresponding to 2013. Signed-off-by: Romain Izard <romain.izard.pro@gmail.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: omap: remove unnecessary #if 0'sLuciano Coelho2013-07-051-16/+0
| | | | | | | | | | | | | | | | | | | | In commit 3451c067 (mmc: omap: add DMA engine support), some #if 0's were used to comment out parts of the code. This has been in the code for over a year and are not needed anymore (and the commented-out code doesn't even compile). Remove them. Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sdhci: fix ctrl_2 on super-speed selectionGiuseppe CAVALLARO2013-07-051-4/+3
| | | | | | | | | | | | | | | | | | | | This patch fixes the HC ctrl_2 programming where, in case of SDR104 and HS200, we have to write 100b in the the UHS Mode bits. We wrote 101b that is reserved from Arasan Specs. Reported-by: Youssef Triki <youssef.triki@st.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: dw_mmc-pltfm: add Rockchip variantHeiko Stübner2013-07-051-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Cortex-A9 SoCs from Rockchip use a slightly modified variant of dw_mmc controllers that seems to require the SDMMC_CMD_USE_HOLD_REG bit to always be set. There also seem to be no other modifications (additional register etc) present, so to keep the footprint low, add this small variant to the pltfm driver. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: dw_mmc-pltfm: move probe and remove below dt match tableHeiko Stübner2013-07-051-14/+14
| | | | | | | | | | | | | | | | | | | | In a subsquent patch probe will need to do some handling of data from the dt match table. So to prevent the need for forward declarations, move probe and remove below the match table. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: dw_mmc-pltfm: remove static from dw_mci_pltfm_removeHeiko Stübner2013-07-051-1/+1
| | | | | | | | | | | | | | | | | | | | dw_mci_pltfm_remove gets exported and used by dw_mmc-exynos, so should not be static. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sdhci-acpi: add support for eMMC hardware reset for HID 80860F14Adrian Hunter2013-07-051-1/+27
| | | | | | | | | | | | | | Add support for eMMC hardware reset for HID 80860F14. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sdhci-pci: add support for eMMC hardware reset for BYT eMMC.Adrian Hunter2013-07-051-2/+30
| | | | | | | | | | | | | | Add support for eMMC hardware reset for BYT eMMC. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGADinh Nguyen2013-06-275-2/+150
| | | | | | | | | | | | | | | | | | | | | | | | | | Add platform specific functionality for the DW SD/MMC driver for SoCFPGA. Move SDMMC_CMD_USE_HOLD_REG to dw_mmc.h so other platforms can use this define. Signed-off-by: Dinh Nguyen <dinguyen@altera.com> Reviewed-by: Pavel Machek <pavel@denx.de> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Olof Johansson <olof@lixom.net> Acked-by: Seungwon Jeon <tgih.jun@samsung.com Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sdhci: fix caps2 for HS200Giuseppe CAVALLARO2013-06-271-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Although the HC supports HS200 (eMMC) the caps2 are always zero; this means there's no way to use the super speed mode (when init the card). If the HC support SDR104, for SD3.0, so it also supports HS200 for eMMC and this patch just sets the MMC_CAP2_HS200 in the host caps2 field. Reported-by: Youssef Triki <youssef.triki@st.com> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com> Reviewed-by: Philip Rakity <prakity@nvidia.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * sdhci-pxav3: Fix runtime PM initializationDaniel Drake2013-06-271-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit bb691ae464b77d30e74c66480e98d74e88d6b194 breaks boot on OLPC XO-4, it hangs somewhere inside sdhci_add_host. When pm_runtime_set_autosuspend_delay() was being called, the device's usage counter was 0, causing the PM layer to runtime-suspend the device. We then went on to call sdhci_add_host() on a suspended device, which hung. Fix this by making the driver consistent with the omap_hsmmc driver, both in terms of runtime PM initialization and error handling. Now the device is not runtime-suspended until we exit the probe routine. Signed-off-by: Daniel Drake <dsd@laptop.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Add DT-bindings for MMC_CAP2_FULL_PWR_CYCLEUlf Hansson2013-06-271-0/+2
| | | | | | | | | | | | | | | | The DT-binding for MMC_CAP2_FULL_PWR_CYCLE, is used to indicate whether it is possible to perform a full power cycle of the card. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Invent MMC_CAP2_FULL_PWR_CYCLEUlf Hansson2013-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MMC_CAP2_FULL_PWR_CYCLE shall be set by host drivers which are able to do a complete power cycle of the card. In the eMMC case that includes both vcc and vccq. This CAP is providing the protocol layer with important information, needed to take optimized decisions during card initialization and in the suspend/resume sequence. MMC_CAP2_POWEROFF_NOTIFY is replaced by MMC_CAP2_FULL_PWR_CYCLE, since it makes sense to use a wider scope for it. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Enable power_off_notify for eMMC shutdown sequenceUlf Hansson2013-06-271-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In suspend mode it is important to save power. If the host is able to cut buth vcc and vccq, the MMC_CAP2_POWEROFF_NOTIFY shall be set. It will mean the card will be completely powered down at suspend and the power off notification cmd will be sent prior power down. It seems common not being able to cut both vcc and vccq for a host. In this situation we issue the sleep cmd in favor of the power off notification cmd, to save more power. While maintainng the above policy, we also want to make use of the power off notification in the shutdown sequence, even in the case were the host has not set MMC_CAP2_POWEROFF_NOTIFY, since we know vcc and vccq will regardless be cut. We accomplish this by always enabling the power off notification byte in the EXT_CSD and issue the power off notification when either MMC_CAP2_POWEROFF_NOTIFY is set or we are executing a shutdown. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Add shutdown callback for (e)MMC bus_opsUlf Hansson2013-06-271-0/+10
| | | | | | | | | | | | | | | | The shutdown sequence of an (e)MMC is very similar to a suspend. We re-use the suspend function and tell it we are not in suspend context. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Handle both poweroff notification types for eMMCUlf Hansson2013-06-271-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | Depending on the context of the operation while powering down the card, either POWER_OFF_NOTIFY_SHORT or POWER_OFF_NOTIFY_LONG will be used. In suspend context a short timeout is preferred while a long timeout would be acceptable in a shutdown/hibernation context. We add a new parameter to the mmc_suspend function so we can provide an indication of what notification type to use. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Add shutdown callback for SD bus_opsUlf Hansson2013-06-271-0/+2
| | | | | | | | | | | | | | | | For the SD .shutdown callback we re-use the SD suspend function since it performs the relevant actions. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Extend shutdown sequence to handle bus operationsUlf Hansson2013-06-272-0/+10
| | | | | | | | | | | | | | | | | | By adding an optional .shutdown callback to the bus_ops struct we provide the possibility to let each bus type handle it's shutdown requirements. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Handle card shutdown from mmc_busUlf Hansson2013-06-273-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | Considering shutdown of the card, the responsibility to initate this sequence shall be driven from the mmc_bus. This patch enables the mmc_bus to handle this sequence properly. A new .shutdown callback is added in the mmc_driver struct which is used to shutdown the blk device. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Initiate suspend|resume from mmc bus instead of mmc hostUlf Hansson2013-06-272-26/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The host should be responsible to suspend|resume the host and not the card. This patch changes this behaviour, by moving the responsiblity to the mmc bus instead which already holds the card device. The exported functions mmc_suspend|resume_host are now to be considered as depcrecated. Once all host drivers moves away from using them, we can remove them. As of now, a successful error code is always returned. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Push common suspend|resume code into each bus_opsUlf Hansson2013-06-274-28/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | By moving code from the mmc_suspend|resume_host down into each .suspend|resume bus_ops callback, we get a more flexible solution. Some nice side effects are that we get a better understanding of each bus_ops suspend|resume sequence and the common code don't have to take care of specific corner cases, especially for the SDIO case. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Validate suspend prerequisites for SDIO at SUSPEND_PREPAREUlf Hansson2013-06-273-21/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves the validation for all the suspend prerequisites to be done at SUSPEND_PREPARE notification. Previously in the SDIO case parts of the validation was done from mmc_suspend_host. This patch invents a new pre_suspend bus_ops callback and implements it for SDIO. Returning an error code from it, will mean at SUSPEND_PREPARE notification, the card will be removed before proceeding with the suspend sequence. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: core: Remove unnecessary check for the remove callbackUlf Hansson2013-06-271-8/+3
| | | | | | | | | | | | | | | | | | For every bus_ops type the .remove callback always exist, thus there are no need to check the existence of it, before we decide to call it. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: jz4740: Use managed resourcesLars-Peter Clausen2013-06-271-31/+6
| | | | | | | | | | | | | | | | Use managed resources for the mmio memory region and the clock. Makes the code a bit shorter. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: jz4740: Use slot-gpio helpersLars-Peter Clausen2013-06-271-90/+23
| | | | | | | | | | | | | | | | Use the slot-gpio helpers to handle the write protect and card detect GPIO pins instead of re-implementing the same functionality in the driver. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: jz4740: Use SIMPLE_DEV_PM_OPSLars-Peter Clausen2013-06-271-8/+3
| | | | | | | | | | | | | | | | It's a bit shorter than open-conding it. While we are at it also make jz4740_mmc_pm_ops static. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: jz4740: Fix handling of read errors.Paul Cercueil2013-06-271-0/+8
| | | | | | | | | | | | | | | | | | For no reason, the code handling write errors was implemented while the code handling read errors was missing. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: jz4740: Remove duplicated code.Paul Cercueil2013-06-271-5/+0
| | | | | | | | | | | | Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sdhci: improve card removal check in sdhci_card_event()Shawn Guo2013-06-271-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following error randomly appears on an imx6q board where gpio is used to implement card-detection when mounting EXT4 rootfs during boot. mmc1: Card removed during transfer! mmc1: Resetting controller. mmcblk0: unknown error -123 sending read/write command, card status 0x900 end_request: I/O error, dev mmcblk0, sector 106744 EXT4-fs error (device mmcblk0p2): ext4_find_entry:1312: inode #5011: comm swapper/0: reading directory lblock 0 It turns out that the error message comes from the card removal check in function sdhci_card_event(). While we have a well implemented function sdhci_do_get_cd() handling all the possible cases of CD, the current code only checks controller internal CD case. That causes problem for other CD cases like gpio on above imx6q board. Improve the check by using sdhci_do_get_cd() to cover all possible CD cases, so that above error on the imx6q board gets fixed. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: dw_mmc: Add the ability to set the ciu clock frequencyDoug Anderson2013-06-271-4/+13
| | | | | | | | | | | | | | | | | | | | As of now we rely on code outside of the driver to set the ciu clock frequency. There's no reason to do that. Add support for setting up the clock in the driver during probe. Signed-off-by: Doug Anderson <dianders@chromium.org> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: dw_mmc: Handle late vmmc regulators with EPROBE_DEFERDoug Anderson2013-06-271-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is possible to specify a regulator that should be turned on when dw_mmc is probed. At the moment dw_mmc will fail to use the regulator properly if the regulator probes after dw_mmc. Fix this problem by honoring EPROBE_DEFER. At the same time move the regulator code out of the slot init code. We only specify one regulator for the whole device and other parts of the code (like suspend/resume) assume that the regulator has only been enabled once. Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: esdhc-imx: parse max-frequency from devicetreeLucas Stach2013-06-271-1/+17
| | | | | | | | | | | | | | | | | | | | In order to make it possible to reduce the SD bus frequency, parse the optional "max-frequency" attribute as documented in devicetree/bindings/mmc/mmc.txt Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sdhci-esdhc: calculate sdclk divider from controller clockLucas Stach2013-06-273-6/+15
| | | | | | | | | | | | | | | | | | | | The SDCLK is divided down from the host controller clock. Host controller clock may be different from the maximum SDCLK, so get it from the platform, instead of just using the max SDCLK. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: card: fixing an false identification of SANITIZE commandYaniv Gardi2013-06-271-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inside the routine mmc_blk_ioctl_cmd() the sanitize command is identified according to the value of bits 16-23 of the argument. but what happens if a different command is sent, and only by chance, bits 16-23 contain the value of SANITIZE command ? In that case a SANITIZE command will be falsely identified. In order to prevent such a case, the condition is expanded and now it also checks the opcode itself, and verifies that it is an MMC_SWITCH opcode. Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: atmel-mci: remove include <mach/cpu.h>Nicolas Ferre2013-06-271-2/+0
| | | | | | | | | | | | | | | | | | | | Header file not needed anymore as we have removed the calls to cpu_is_xxx() macro. Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: dw_mmc-pci: convert to use pcim_* and devm_*Andy Shevchenko2013-06-271-35/+15
| | | | | | | | | | | | | | | | | | The PCI driver is getting simplier and tidier with pcim_* and devm_* functions in use. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: dw_mmc: eliminate useless usage of retAndy Shevchenko2013-06-272-20/+5
| | | | | | | | | | | | | | | | | | In few places usage of ret variable is not needed. This patch simplifies those pieces of code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: dw_mmc-pltfm: don't check resource with devm_ioremap_resourceAndy Shevchenko2013-06-271-5/+3
| | | | | | | | | | | | | | | | | | devm_ioremap_resource does sanity checks on the given resource. No need to duplicate this in the driver. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Seungwon Jeon <tgih.jun@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: reordered shutdown sequence in mmc_bld_remove_reqPaul Taysom2013-06-271-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had a multi-partition SD-Card with two ext2 file systems. The partition table was getting overwritten by a race between the card removal and the unmount of the 2nd ext2 partition. What was observed: 1. Suspend/resume would call to remove the device. The clearing of the device information is done asynchronously. 2. A request is made to unmount the file system (this is called after the removal has started). 3. The remapping table was cleared by the asynchronous part of the device removal. 4. A write request to the super block (block 0 of the partition) was sent down and instead of being remapped to the partition offset, it was remapped to block 0 of the device which is where the partition table is located. 5. Write was queued and written resulting in the overwriting of the partition table with the ext2 super block. 6. The mmc_queue is cleaned up. The mmc card device driver used to access SD cards, was calling del_gendisk before calling mmc_cleanup-queue. The comment in the mmc_blk_remove_req code indicated that it expected del_gendisk to block all further requests from being queued but it doesn't. The mmc driver uses the presences of the mmc_queue to determine if the request should be queued. The fix was to clean up the mmc_queue before the rest of the the delete partition code is called. This prevents the overwriting of the partition table. However, the umount gets an error trying to write the super block. The umount should be issued before the device is removed but that is not always possible. The umount is still needed to cleanup other data structures. Addresses the problem described in http://crbug.com/240815 Signed-off-by: Paul Taysom <taysom@chromium.org> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sirf: fix sdhci_pltfm_init sequenceArnd Bergmann2013-06-271-28/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch "mmc: sdhci: Add size for caller in init+register" changed the interface for sdhci_pltfm_init, while patch "mmc: sdhci-sirf: add mmc host sdhci-pltfm based driver for SiRF SoCs" added a new driver with the old interface. This changes the sirf driver to use the new interface, avoiding one warning, and simplifying the init sequence. Since we're here already, this also adds an error path for failed clk_prepare_enable. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Christian Daudt <csd@broadcom.com> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: host: use platform_{get,set}_drvdata()Jingoo Han2013-06-273-5/+5
| | | | | | | | | | | | | | | | | | | | Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Chris Ball <cjb@laptop.org>
| * mmc: sh_mobile_sdhi: fix error return code in sh_mobile_sdhi_probe()Wei Yongjun2013-06-271-1/+3
| | | | | | | | | | | | | | | | | | Fix to return a negative error code instead of 0 when we cannot get IRQ source by platform_get_irq(), as done elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Chris Ball <cjb@laptop.org>