aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc/core
AgeCommit message (Collapse)AuthorFilesLines
2013-11-20Merge tag 'pm+acpi-2-3.13-rc1' of ↵Linus Torvalds1-2/+1
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull more ACPI and power management updates from Rafael Wysocki: - ACPI-based device hotplug fixes for issues introduced recently and a fix for an older error code path bug in the ACPI PCI host bridge driver - Fix for recently broken OMAP cpufreq build from Viresh Kumar - Fix for a recent hibernation regression related to s2disk - Fix for a locking-related regression in the ACPI EC driver from Puneet Kumar - System suspend error code path fix related to runtime PM and runtime PM documentation update from Ulf Hansson - cpufreq's conservative governor fix from Xiaoguang Chen - New processor IDs for intel_idle and turbostat and removal of an obsolete Kconfig option from Len Brown - New device IDs for the ACPI LPSS (Low-Power Subsystem) driver and ACPI-based PCI hotplug (ACPIPHP) cleanup from Mika Westerberg - Removal of several ACPI video DMI blacklist entries that are not necessary any more from Aaron Lu - Rework of the ACPI companion representation in struct device and code cleanup related to that change from Rafael J Wysocki, Lan Tianyu and Jarkko Nikula - Fixes for assigning names to ACPI-enumerated I2C and SPI devices from Jarkko Nikula * tag 'pm+acpi-2-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (24 commits) PCI / hotplug / ACPI: Drop unused acpiphp_debug declaration ACPI / scan: Set flags.match_driver in acpi_bus_scan_fixed() ACPI / PCI root: Clear driver_data before failing enumeration ACPI / hotplug: Fix PCI host bridge hot removal ACPI / hotplug: Fix acpi_bus_get_device() return value check cpufreq: governor: Remove fossil comment in the cpufreq_governor_dbs() ACPI / video: clean up DMI table for initial black screen problem ACPI / EC: Ensure lock is acquired before accessing ec struct members PM / Hibernate: Do not crash kernel in free_basic_memory_bitmaps() ACPI / AC: Remove struct acpi_device pointer from struct acpi_ac spi: Use stable dev_name for ACPI enumerated SPI slaves i2c: Use stable dev_name for ACPI enumerated I2C slaves ACPI: Provide acpi_dev_name accessor for struct acpi_device device name ACPI / bind: Use (put|get)_device() on ACPI device objects too ACPI: Eliminate the DEVICE_ACPI_HANDLE() macro ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node cpufreq: OMAP: Fix compilation error 'r & ret undeclared' PM / Runtime: Fix error path for prepare PM / Runtime: Update documentation around probe|remove|suspend cpufreq: conservative: set requested_freq to policy max when it is over policy max ...
2013-11-18Merge tag 'mmc-updates-for-3.13-rc1' of ↵Linus Torvalds7-294/+291
git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc Pull MMC updates from Chris Ball: "MMC highlights for 3.13: Core: - Improve runtime PM support, remove mmc_{suspend,resume}_host(). - Add MMC_CAP_RUNTIME_RESUME, for delaying MMC resume until we're outside of the resume sequence (in runtime_resume) to decrease system resume time. Drivers: - dw_mmc: Support HS200 mode. - sdhci-eshdc-imx: Support SD3.0 SDR clock tuning, DDR on IMX6. - sdhci-pci: Add support for Intel Clovertrail and Merrifield" * tag 'mmc-updates-for-3.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (108 commits) mmc: wbsd: Silence compiler warning mmc: core: Silence compiler warning in __mmc_switch mmc: sh_mmcif: Convert to clk_prepare|unprepare mmc: sh_mmcif: Convert to PM macros when defining dev_pm_ops mmc: dw_mmc: exynos: Revert the sdr_timing assignment mmc: sdhci: Avoid needless loop while handling SDIO interrupts in sdhci_irq mmc: core: Add MMC_CAP_RUNTIME_RESUME to resume at runtime_resume mmc: core: Improve runtime PM support during suspend/resume for sd/mmc mmc: core: Remove redundant mmc_power_up|off at runtime callbacks mmc: Don't force card to active state when entering suspend/shutdown MIPS: db1235: Don't use MMC_CLKGATE mmc: core: Remove deprecated mmc_suspend|resume_host APIs mmc: mmci: Move away from using deprecated APIs mmc: via-sdmmc: Move away from using deprecated APIs mmc: tmio: Move away from using deprecated APIs mmc: sh_mmcif: Move away from using deprecated APIs mmc: sdricoh_cs: Move away from using deprecated APIs mmc: rtsx: Remove redundant suspend and resume callbacks mmc: wbsd: Move away from using deprecated APIs mmc: pxamci: Remove redundant suspend and resume callbacks ...
2013-11-14ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_nodeRafael J. Wysocki1-2/+1
Modify struct acpi_dev_node to contain a pointer to struct acpi_device associated with the given device object (that is, its ACPI companion device) instead of an ACPI handle corresponding to it. Introduce two new macros for manipulating that pointer in a CONFIG_ACPI-safe way, ACPI_COMPANION() and ACPI_COMPANION_SET(), and rework the ACPI_HANDLE() macro to take the above changes into account. Drop the ACPI_HANDLE_SET() macro entirely and rework its users to use ACPI_COMPANION_SET() instead. For some of them who used to pass the result of acpi_get_child() directly to ACPI_HANDLE_SET() introduce a helper routine acpi_preset_companion() doing an equivalent thing. The main motivation for doing this is that there are things represented by struct acpi_device objects that don't have valid ACPI handles (so called fixed ACPI hardware features, such as power and sleep buttons) and we would like to create platform device objects for them and "glue" them to their ACPI companions in the usual way (which currently is impossible due to the lack of valid ACPI handles). However, there are more reasons why it may be useful. First, struct acpi_device pointers allow of much better type checking than void pointers which are ACPI handles, so it should be more difficult to write buggy code using modified struct acpi_dev_node and the new macros. Second, the change should help to reduce (over time) the number of places in which the result of ACPI_HANDLE() is passed to acpi_bus_get_device() in order to obtain a pointer to the struct acpi_device associated with the given "physical" device, because now that pointer is returned by ACPI_COMPANION() directly. Finally, the change should make it easier to write generic code that will build both for CONFIG_ACPI set and unset without adding explicit compiler directives to it. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Tested-by: Mika Westerberg <[email protected]> # on Haswell Reviewed-by: Mika Westerberg <[email protected]> Reviewed-by: Aaron Lu <[email protected]> # for ATA and SDIO part
2013-11-08mmc: core: Silence compiler warning in __mmc_switchUlf Hansson1-1/+1
Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Add MMC_CAP_RUNTIME_RESUME to resume at runtime_resumeUlf Hansson2-10/+14
In some environments it is to prefer to postpone the resume of the card device until runtime_resume is being carried out, since it will mean a signficant decrease of the total system resume time. The reason of the decreased resume time is simply because of the actual re-initalization of the card, which typically takes hundreds of milliseconds, is performed outside the resume sequence and wont thus affect it. For removable card, the detect work tries to re-detect the card to make sure it is still present, as a part of that sequence the card will also be runtime_resumed and thus also fully resumed. For a non-removable card, typically a mmc blk request will trigger a runtime_resume and thus fully resume the card. This also means the first request will likely suffer from an inital latency since the re-initialization of the card needs to be performed. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Improve runtime PM support during suspend/resume for sd/mmcUlf Hansson2-17/+66
The card device is considered as in-active after it has been suspended. To prevent any further runtime PM requests in suspend state, we then disable runtime PM. After the card device has been resumed, we shall consider it as active, like we also do after a probe sequence. When resumed, we can safely enable runtime PM again. This will make sure the PM core can request the card device to go to in-active state after a resume has been completed. Previously we had to wait for new pm_runtime_get->pm_runtime_put cycle to be executed. Additionally, once a resume has been carried out, update the last busy mark. At the moment this will have no effect but if the PM core will respect autosuspend enabled devices, when it directly triggers a runtime_suspend from a runtime_idle, it will mean the card device will be scheduled for a delayed runtime_suspend instead of done immediately. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Remove redundant mmc_power_up|off at runtime callbacksUlf Hansson2-24/+2
Commit "mmc: core: Push common suspend|resume code into each bus_ops" moved the responsibility for doing mmc_power_up|off into each suspend/resume bus_ops. When using MMC_CAP_AGGRESSIVE_PM, through the runtime callbacks, calls to mmc_power_up|off became redundant. When removing them, we are also able to remove the calls to mmc_claim|release_host, thus simplifing code a bit more. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: Don't force card to active state when entering suspend/shutdownUlf Hansson2-15/+51
By adding a card state that records if it is suspended or resumed, we can accept asyncronus suspend/resume requests for the mmc and sd bus_ops. MMC_CAP_AGGRESSIVE_PM, will at request inactivity through the runtime bus_ops callbacks, execute a suspend of the the card. In the state were this has been done, we can receive a suspend request for the mmc bus, which for sd and mmc forced the card to active state by a pm_runtime_get_sync. In other words, the card was resumed and then immediately suspended again, completely unnecessary. Since the suspend/resume bus_ops callbacks for sd and mmc are now capable of handling asynchronous requests, we no longer need to force the card to active state before executing suspend. Evidently preventing the above sequence for MMC_CAP_AGGRESSIVE_PM. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Remove deprecated mmc_suspend|resume_host APIsUlf Hansson1-22/+0
The are no more users of the deprecated mmc_suspend|resume_host API, so let's remove it. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Signal wakeup event at card insert/removalUlf Hansson1-12/+27
We want to give user space provision to fully consume a card insert/remove event, when the event was caused by a wakeup irq. By signaling the wakeup event for a time of 5 s for devices configured as wakeup capable, we likely will be prevent a sleep long enough to let user space consume the event. To enable this feature, host drivers must thus configure their devices as wakeup capable. This is a reworked implementation of the old wakelocks for the mmc subsystem, originally authored by Colin Cross and San Mehat for the Android kernel. Zoran Markovic shall also be given cred for recently re-trying to upstream this feature. Cc: San Mehat <[email protected]> Cc: Colin Cross <[email protected]> Cc: John Stultz <[email protected]> Cc: Zoran Markovic <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Reviewed-by: Zoran Markovic <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Collect common code for card ocr validationUlf Hansson4-40/+10
Since mmc_select_voltage now only gets called from the attach sequence, it makes sense to move the out of spec validations of the card ocr into this function. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Prevent violation of specs while initializing cardsUlf Hansson4-37/+13
According to eMMC/SD/SDIO specs, the VDD (VCC) voltage level must be maintained during the initialization sequence. If we want/need to tune the voltage level, a complete power cycle of the card must be executed. Most host drivers conforms to the specifications by only allowing to change VDD voltage level at the MMC_POWER_UP state, but some also cares about MMC_POWER_ON state, which they should'nt. This patch will not break those drivers, but they could clean up code to better reflect what is expected from the protocol layer. A big re-work of the mmc_select_voltage function is done to only change VDD voltage level if the host supports MMC_CAP2_FULL_PWR_CYCLE. Otherwise only validation of the host and card ocr mask will be done. A very nice side-effect of this patch is that we now don't need to reset the negotiated ocr mask at the mmc_power_off function, since now it will actually reflect the present voltage level, which safely can be used at the next power up and re-initialization. Moreover, we then only need to execute mmc_select_voltage from the attach sequence. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Move cached value of the negotiated ocr mask to card structUlf Hansson4-34/+40
The negotiated ocr mask is directly related to the card. Once a card gets removed, the mask shall be dropped. By moving the cache of the ocr mask from the host struct to the card struct we have accomplished this. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Cleanup code for setting ocr mask for SDIOUlf Hansson1-16/+10
At several places in mmc_sdio_init_card function the cached mask in host->ocr were being updated. To simplify code, we make use of an local ocr parameter instead. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Remove unnecessary retry mechanism at SDIO attachUlf Hansson1-11/+3
The retry and fallback mechanism when failing to switch to 1.8V signaling voltage is handled by the SDIO card init function. Thus we can remove the duplicated old code from the attach function. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Let mmc_set_signal_voltage take ocr as parameterUlf Hansson4-5/+7
This is yet another step of restructure code to be able to fixup the setup of the negotiated ocr mask. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Let mmc_power_up|cycle take ocr as parameterUlf Hansson5-24/+16
As a step to fixup the setup of the negotiated ocr mask, we need the mmc_power_up|cycle functions to take the ocr as a parameter. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-30mmc: core: Do not poll for busy with status cmd for all switch cmdsUlf Hansson3-9/+22
Some switch operations like poweroff notify, shall according to the spec not be followed by any other new commands. For these cases and when the host does'nt support MMC_CAP_WAIT_WHILE_BUSY, we must not send status commands to poll for busy detection. Instead wait for the stated timeout from the EXT_CSD before completing the request. Signed-off-by: Ulf Hansson <[email protected]> Cc: Jaehoon Chung <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-10-16MMC: convert bus code to use dev_groupsGreg Kroah-Hartman2-14/+19
The dev_attrs field of struct bus_type is going away soon, dev_groups should be used instead. This converts the MMC bus code to use the correct field. Cc: Chris Ball <[email protected]> Cc: Ulf Hansson <[email protected]> Cc: Konstantin Dorfman <[email protected]> Cc: Seungwon Jeon <[email protected]> Cc: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-09-25mmc: core: clean up duplicate macrosJackey Shen1-1/+1
Clean up the duplicate macros: mmc_sd_card_uhs -> mmc_card_uhs mmc_sd_card_set_uhs -> mmc_card_set_uhs Signed-off-by: Jackey Shen <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-09-25mmc: add ignorance case for CMD13 CRC errorSeungwon Jeon1-28/+45
While speed mode is changed, CMD13 cannot be guaranteed. According to the spec., it is not recommended to use CMD13 to check the busy completion of the timing change. If CMD13 is used in this case, CRC error must be ignored. Signed-off-by: Seungwon Jeon <[email protected]> Acked-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-09-25mmc: core: remove dead function mmc_try_claim_hostGrant Grundler1-25/+0
cscope says there are no callers for mmc_try_claim_host in the kernel. No reason to keep it. Signed-off-by: Grant Grundler <[email protected]> Acked-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-09-10Merge tag 'mmc-updates-for-3.12-rc1' of ↵Linus Torvalds5-7/+67
git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc Pull MMC updates from Chris Ball: "MMC highlights for 3.12: Core: - Support Allocation Units 8MB-64MB in SD3.0, previous max was 4MB. - The slot-gpio helper can now handle GPIO debouncing card-detect. - Read supported voltages from DT "voltage-ranges" property. Drivers: - dw_mmc: Add support for ARC architecture, and support exynos5420. - mmc_spi: Support CD/RO GPIOs. - sh_mobile_sdhi: Add compatibility for more Renesas SoCs. - sh_mmcif: Add DT support for DMA channels" * tag 'mmc-updates-for-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (50 commits) Revert "mmc: tmio-mmc: Remove .set_pwr() callback from platform data" mmc: dw_mmc: Add support for ARC mmc: sdhci-s3c: initialize host->quirks2 for using quirks2 mmc: sdhci-s3c: fix the wrong register value, when clock is disabled mmc: esdhc: add support to get voltage from device-tree mmc: sdhci: get voltage from sdhc host mmc: core: parse voltage from device-tree mmc: omap_hsmmc: use the generic config for omap2plus devices mmc: omap_hsmmc: clear status flags before starting a new command mmc: dw_mmc: exynos: Add a new compatible string for exynos5420 mmc: sh_mmcif: revision-specific CLK_CTRL2 handling mmc: sh_mmcif: revision-specific Command Completion Signal handling mmc: sh_mmcif: add support for Device Tree DMA bindings mmc: sh_mmcif: move header include from header into .c mmc: SDHI: add DT compatibility strings for further SoCs mmc: dw_mmc-pci: enable bus-mastering mode mmc: dw_mmc-pci: get resources from a proper BAR mmc: tmio-mmc: Remove .set_pwr() callback from platform data mmc: tmio-mmc: Remove .get_cd() callback from platform data mmc: sh_mobile_sdhi: Remove .set_pwr() callback from platform data ...
2013-08-26mmc: core: parse voltage from device-treeHaijun Zhang1-0/+44
Add function to support getting voltage from device-tree. If voltage-range is specified in device-tree node, this function will parse it and return the available voltage mask. Signed-off-by: Haijun Zhang <[email protected]> Acked-by: Anton Vorontsov <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-08-24mmc: slot-gpio: Add debouncing capability to mmc_gpio_request_cd()Laurent Pinchart2-2/+14
Add a debounce parameter to the mmc_gpio_request_cd() function that enables GPIO debouncing when set to a non-zero value. This can be used by MMC host drivers to enable debouncing on the card detect signal. Signed-off-by: Laurent Pinchart <[email protected]> Reviewed-by: H Hartley Sweeten <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-08-24mmc: core: Set data timeout for mmc bus test commands (CMD14 and CMD19).Minjian Wu1-0/+1
Signed-off-by: Minjian Wu <[email protected]> Acked-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-08-24mmc: sd: fix the maximum au_size for SD3.0Jaehoon Chung1-2/+5
Since SD Physical Layer specification V3.0, AU_SIZE is supported up to 0xf. So If SD-card is supported v3.0, then max_au should be 0xf. Signed-off-by: Jaehoon Chung <[email protected]> Signed-off-by: Kyungmin Park <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-08-24mmc: core: free mmc_card if cmd 3,9,7 fails in mmc_sd_init_cardWei WANG1-3/+3
In function mmc_sd_init_card, if command 3/9/7 got failed, mmc_card allocated just before won't be freed. This would cause memory leak. Signed-off-by: Wei WANG <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-07-31mmc: core: Indicate that vmmcq may be absentMark Brown1-1/+1
Use regulator_get_optional() to tell the core that requests for the vmmcq regulator can fail in a real system. Signed-off-by: Mark Brown <[email protected]> Acked-by: Chris Ball <[email protected]>
2013-07-10Merge tag 'mmc-updates-for-3.11-rc1' of ↵Linus Torvalds10-272/+457
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 ...
2013-07-05mmc: core: Fixup Oops for SDIO shutdownUlf Hansson1-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 <[email protected]> Reported-by: Stephen Warren <[email protected]> Reported-by: Tuomas Tynkkynen <[email protected]> Tested-by: Tuomas Tynkkynen <[email protected]> Acked-by: Jaehoon Chung <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-07-05mmc: core: production year for eMMC 4.41 and laterRomain Izard1-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 <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Add DT-bindings for MMC_CAP2_FULL_PWR_CYCLEUlf Hansson1-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 <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Invent MMC_CAP2_FULL_PWR_CYCLEUlf Hansson1-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 <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Enable power_off_notify for eMMC shutdown sequenceUlf Hansson1-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 <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Add shutdown callback for (e)MMC bus_opsUlf Hansson1-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 <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Handle both poweroff notification types for eMMCUlf Hansson1-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 <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Add shutdown callback for SD bus_opsUlf Hansson1-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 <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Extend shutdown sequence to handle bus operationsUlf Hansson2-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 <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Handle card shutdown from mmc_busUlf Hansson1-0/+9
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 <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Initiate suspend|resume from mmc bus instead of mmc hostUlf Hansson2-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 <[email protected]> Tested-by: Jaehoon Chung <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Push common suspend|resume code into each bus_opsUlf Hansson4-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 <[email protected]> Tested-by: Jaehoon Chung <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Validate suspend prerequisites for SDIO at SUSPEND_PREPAREUlf Hansson3-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 <[email protected]> Tested-by: Jaehoon Chung <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Remove unnecessary check for the remove callbackUlf Hansson1-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 <[email protected]> Tested-by: Jaehoon Chung <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: core: Update the ext-csd.rev check for eMMC5.1Yuvaraj Kumar C D1-1/+1
With the new eMMC5.1 spec, there is a new EXT_CSD register with the revision number(EXT_CSD_REV) 7. This patch updates the check for ext-csd.rev number as 7. Signed-off-by: Alim Akhtar <[email protected]> Signed-off-by: Yuvaraj Kumar C D <[email protected]> Reviewed-by: Doug Anderson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-27mmc: return mmc_of_parse() errors to callerSimon Baatz1-5/+25
In addition to just logging errors encountered during DT parsing or allocating GPIO slots for CD/WP, mmc_of_parse() now returns with an error. In particular, this is needed if the GPIO allocation may return EPROBE_DEFER. Signed-off-by: Simon Baatz <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-06-03PM / Runtime: Rework the "runtime idle" helper routineRafael J. Wysocki2-2/+2
The "runtime idle" helper routine, rpm_idle(), currently ignores return values from .runtime_idle() callbacks executed by it. However, it turns out that many subsystems use pm_generic_runtime_idle() which checks the return value of the driver's callback and executes pm_runtime_suspend() for the device unless that value is not 0. If that logic is moved to rpm_idle() instead, pm_generic_runtime_idle() can be dropped and its users will not need any .runtime_idle() callbacks any more. Moreover, the PCI, SCSI, and SATA subsystems' .runtime_idle() routines, pci_pm_runtime_idle(), scsi_runtime_idle(), and ata_port_runtime_idle(), respectively, as well as a few drivers' ones may be simplified if rpm_idle() calls rpm_suspend() after 0 has been returned by the .runtime_idle() callback executed by it. To reduce overall code bloat, make the changes described above. Tested-by: Mika Westerberg <[email protected]> Tested-by: Kevin Hilman <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Kevin Hilman <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Acked-by: Alan Stern <[email protected]>
2013-05-26mmc: core: Fix select power class after resumeFredrik Soderstedt1-24/+50
Use the saved values in card->ext_csd when selecting power class. By doing this the power class will be selected even if mmc_init_card is called with oldcard != NULL, which is the case after a suspend/resume. Today ext_csd is NULL if mmc_init_card is called with oldcard != NULL and power class will not be selected. According to the eMMC specification the POWER_CLASS value is reset after power failure, H/W reset assertion and any CMD0 reset. Signed-off-by: Fredrik Soderstedt <[email protected]> Reviewed-by: Johan Rudholm <[email protected]> Acked By: Girish K S <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-05-26mmc: core: Restructure and simplify code for mmc sleep|awakeUlf Hansson5-119/+41
The mmc_card_sleep|awake APIs are not being used since the support is already properly encapsulated within the suspend sequence. Sleep|awake command is also specific for eMMC. We remove the sleep|awake bus_ops, the mmc_card_sleep|awake APIs and move the code into the mmc specific core instead. This also includes the mmc ops function, mmc_sleepawake. All releated functions have then become static and we have got far less code to maintain. Additionally this patch also simplifies the code from mmc_sleepawake, since it is only used to put the card to sleep and not awake. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>
2013-05-26mmc: core: Support aggressive power management for (e)MMC/SDUlf Hansson2-0/+99
Aggressive power management is suitable when saving power is essential. At request inactivity timeout, aka pm runtime autosuspend timeout, the card will be suspended. Once a new request arrives, the card will be re-initalized and thus the first request will suffer from a latency. This latency is card-specific, experiments has shown in general that SD-cards has quite poor initialization time, around 300ms-1100ms. eMMC is not surprisingly far better but still a couple of hundreds of ms has been observed. Except for the request latency, it is important to know that suspending the card will also prevent the card from executing internal house-keeping operations in idle mode. This could mean degradation in performance. To use this feature make sure the request inactivity timeout is chosen carefully. This has not been done as a part of this patch. Enable this feature by using host cap MMC_CAP_AGGRESSIVE_PM and by setting CONFIG_MMC_UNSAFE_RESUME. Signed-off-by: Ulf Hansson <[email protected]> Signed-off-by: Chris Ball <[email protected]>