summaryrefslogtreecommitdiff
path: root/drivers/mmc/core
AgeCommit message (Collapse)Author
2012-07-31mmc: core: Fix PowerOff Notify suspend/resumePavan Kunapuli
Modified the mmc_poweroff to resume before sending the poweroff notification command. In sleep mode only AWAKE and RESET commands are allowed, so before sending the poweroff notification command resume from sleep mode and then send the notification command. PowerOff Notify is tested on a Synopsis Designware Host Controller (eMMC 4.5). The suspend to RAM and resume works fine. Change-Id: Ib4642a29e423aee6041a92cc72a388d677674ae3 Signed-off-by: Girish K S <girish.shivananjappa@linaro.org> Tested-by: Girish K S <girish.shivananjappa@linaro.org> Reviewed-by: Saugata Das <saugata.das@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org> Bug 1007644 Bug 936069 Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Change-Id: I2e3d421c82eb765cb640876691ffe4818d7e146b Reviewed-on: http://git-master/r/118918 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Min-wuk Lee <mlee@nvidia.com> Reviewed-by: Naveen Kumar Arepalli <naveenk@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
2012-07-31mmc: core: Add option to prevent eMMC sleep commandUlf Hansson
Host may now use MMC_CAP2_NO_SLEEP_CMD to disable the use of eMMC sleep/awake command. This option can be used when your platform has a buggy kernel crash dump software, which is supposed to store the dump on the eMMC, but is not able to wake up the eMMC from sleep state. In particular, failures have been seen with u-boot; even if it is fixed there, platforms will be slow to update their bootloader binaries. Change-Id: I403f4b2a231dde087095a660189dc2f4e79edfd5 Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> Reviewed-by: Hanumath Prasad <hanumath.prasad@stericsson.com> Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Acked-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Chris Ball <cjb@laptop.org> Bug 1007644 Bug 936069 Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Change-Id: I8b2834e154e338a97bd6d82f177809d47d318ff0 Reviewed-on: http://git-master/r/118914 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
2012-07-25mmc: core: SDXC speed class supportPavan Kunapuli
Unlike SDSC and SDHC, for SDXC cards CMD20 needs to be issued to meet the class performance for speed class recording. Adding mmc_speed_class_control() which should be used by an AV recording app/utility before starting recording on an SDXC card. Bug 969360 Reviewed-on: http://git-master/r/39394 Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Reviewed-on: http://git-master/r/115685 (cherry picked from commit 04b8d1287a95e1882d956cdf7997015350408a3c) Change-Id: Id567effb476ee580de3d49b70201ebae5a13360a Reviewed-on: http://git-master/r/118038 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Naveen Kumar Arepalli <naveenk@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2012-06-19mmc: core: adding new sysfs entry for prod_revVishal Singh
Adding new sysfs entry for product revision which is needed by mNAND health and status user space tool. Bug 974823. Change-Id: I4a07a5e6c1c81e2b7a4c1ed024e987e06f9f87c8 Signed-off-by: Vishal Singh <vissingh@nvidia.com> Reviewed-on: http://git-master/r/103366 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sandeep Trasi <strasi@nvidia.com> Reviewed-by: Luis Dib <ldib@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Pavan Kunapuli <pkunapuli@nvidia.com>
2012-06-11mmc: proactively issue bkops_start and refreshMohit Kataria
Adding CMD56 implementation. Doing the following for manfid 0x90 and FW revisions 0x73 and 0x7b (both are non-standard custom FW): 1. Adding change to issue BKOPS_START whenever 20 seconds have gone by without any slow write operations. 2. Adding change to issue CMD56 to refresh (custom feature) 1 block whenever 60 seconds have gone by without any slow write operations. Corresponding changes are already there in embedded branches: http://git-master/r/#change,93247 http://git-master/r/#change,97555 Bug 847037. Bug 874256. Bug 963737. Change-Id: Ie36b52620a75320abfedc36d1408647b36eddb46 Signed-off-by: Vishal Singh <vissingh@nvidia.com> Reviewed-on: http://git-master/r/102259 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Luis Dib <ldib@nvidia.com> Reviewed-by: Varun Wadekar <vwadekar@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2012-05-15mmc: enable background ops in driverVishal Singh
Adding a new config option and enabling background ops in driver. Correcting the EXT_CSD byte that needs to be written in order to trigger background ops in the MMC firmware. Bug 847037. Change-Id: Ibc517540cab43fa5070b142a416f6b67f2f7e7be Signed-off-by: Vishal Singh <vissingh@nvidia.com> Reviewed-on: http://git-master/r/99117 Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com>
2012-05-11mmc: core: Abort failed transfer before retriesPavan Kunapuli
Retries should be done only after abort command is issued for the current failed transfer. The block layer already has an implementation for retrying. No need for the extra retries. Bug 961761 Bug 922239 Change-Id: I07f60e85e093b725007727833739013f8fd66d43 Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Reviewed-on: http://git-master/r/100563 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
2012-03-06Hack: mmc: explicitly invoking mmc_test probe from bus drvSachin Nikam
Bug 930113 Change-Id: I15fede503217152263905d8f7f56d3392e460e8a Signed-off-by: Sachin Nikam <snikam@nvidia.com> Reviewed-on: http://git-master/r/87241 Reviewed-by: Shridhar Rasal <srasal@nvidia.com> Tested-by: Shridhar Rasal <srasal@nvidia.com> Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
2012-02-10mmc: core: Add support for BKOPS and HPI interruptShridhar Rasal
Added support for starting BKOPS and issuing HPI commands which are supported by eMMC v4.41 and eMMC v4.5 cards. Enable BKOPS and HPI interrupt if the host and card support it. Originally reviewed on: http://git-master/r/69778 Bug 919232 Change-Id: I09b33ddc18013e2eeb505fdb28dd8357fa75b569 Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Signed-off-by: Shridhar Rasal <srasal@nvidia.com> Reviewed-on: http://git-master/r/77319 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
2012-01-31mmc: core: Set card state to ddr in UHS DDR50 modePavan Kunapuli
When SD 3.0 cards operate in UHS DDR50 mode, set the card state to ddr mode to select the proper frequency. Bug 925326 Reviewed-on: http://git-master/r/72628 Change-Id: I9370ab402eb0c39f603555eccdcb49723ac4910f Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/78021 Reviewed-by: Automatic_Commit_Validation_User
2012-01-19mmc: Set suspend/resume bus operations if CONFIG_PM_RUNTIME is usedDmitry Shmidt
cherry-pick ea693bf7f87603b072f4ceea6684221fa0b8e863 from https://android.googlesource.com/kernel/common.git Change-Id: I9575b542af664973a03ad35d7bc48da130ce5a89 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/75463 Reviewed-by: Automatic_Commit_Validation_User
2012-01-13mmc: recognise SDIO cards with SDIO_CCCR_REV 3.00Bing Zhao
Table 6-2: CCCR bit Definitions, address 00h. Part E1 SDIO Simplified Specification Version 3.00, Feb. 25, 2011. This patch has been tested with Marvell WLAN device SD8797. Reviewed-on: http://git-master/r/72877 Change-Id: I1ea3b63bde2bbe8532459205f61feffae3e30f0a Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/74581 Reviewed-by: Automatic_Commit_Validation_User
2012-01-13mmc: sdio: support SDIO UHS cardsPavan Kunapuli
This patch adds support for sdio UHS cards per the version 3.0 spec. UHS mode is only enabled for version 3.0 cards when both the host and the controller support UHS modes. 1.8v signaling support is removed if both the card and the host do not support UHS. This is done to maintain compatibility and some system/card combinations break when 1.8v signaling is enabled when the host does not support UHS. Reviewed-on: http://git-master/r/72876 Change-Id: I8d7dbaf1d1cbff8e9f13526d39e69b2a00eca2fa Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Aaron Lu <Aaron.lu@amd.com> Reviewed-by: Arindam Nath <arindam.nath@amd.com> Tested-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Reviewed-by: Simone Willett <swillett@nvidia.com> Tested-by: Simone Willett <swillett@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/74580 Reviewed-by: Automatic_Commit_Validation_User
2011-12-21mmc: core: Retry if data commands fail with errorMayuresh Kulkarni
If the data commands fail due to some error, retry the transfer. Add 3 retries for data commands. for bug 914934 Change-Id: I53245ddd159abdbade09f841d9490d2f106e7c88 Signed-off-by: Mayuresh Kulkarni <mkulkarni@nvidia.com> Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com> Reviewed-on: http://git-master/r/71181 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Varun Wadekar <vwadekar@nvidia.com>
2011-12-21mmc: sd: set hs_max_dtr without sda_spec3 dependencynaveenk
some sd 2.0 cards have sda_spec3 bit set due to which hs_max_dtr is not set and the card operates at lower frequency. fixed this by setting hs_max_dtr without sda_spec3 dependency. Bug 914869 Signed-off-by: naveenk <naveenk@nvidia.com> Change-Id: I1624c0864f4f07cee5ea044f43e39c4336723e83 Reviewed-on: http://git-master/r/70009 Reviewed-by: Automatic_Commit_Validation_User Tested-by: Naveen Kumar Arepalli <naveenk@nvidia.com> Reviewed-by: Pavan Kunapuli <pkunapuli@nvidia.com> Reviewed-by: Bitan Biswas <bbiswas@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com>
2011-11-30[misc] cancel executable permission on source filesChao Jiang
Source files should not be with executable permission. Original-Change-Id: I70b6be4cf88fea4be9b092ca2f5dd08e40ee7cbd Reviewed-on: http://git-master/r/12081 Reviewed-by: Chao Jiang <chaoj@nvidia.com> Tested-by: Chao Jiang <chaoj@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Rebase-Id: R735406da6ad586ca43d65d1c1abc3844761f0378
2011-11-30mmc: core: host: only use wakelock for detect workColin Cross
There is no need to take a wakelock for delayed lazy disable work, it will be cancelled in the suspend handler and force disabled. Only take the wakelock when the detect work is queued, and make sure to drop the wakelock if the work is cancelled. Change-Id: I1e507a5f98848954ea21d45e23b6192c3132a349 Signed-off-by: Colin Cross <ccross@android.com>
2011-11-30Revert "mmc: subtract boot sectors from disk size for eMMC 4.3+ devices"Colin Cross
This reverts commit f0b0e4bec1e89014f3dcef4da8bcf95428cc771c. The reverted commit incorrectly calculates the size of eMMC devices in some (all?) cases. This revert may cause problems in cases where the bootloader was bug-compatible and puts a GPT partition at the incorrect end of the eMMC device. Signed-off-by: Colin Cross <ccross@android.com>
2011-11-30mmc: Fix pm_notifier obeying deferred resumeDmitry Shmidt
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-11-30mmc: Add "ignore mmc pm notify" functionalityDmitry Shmidt
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-11-30mmc: sdio: Fix enable_hs and enable_wide in sdio_reset_comm()Dmitry Shmidt
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-11-30mmc: subtract boot sectors from disk size for eMMC 4.3+ devicesGary King
the csd sector count reported by eMMC 4.3+ cards includes the boot partition size; subtract this from the size reported to the disk since the boot partition is inaccessible Change-Id: I601b83aa0159b7aa446409ea8c945b256dd0b5b1 Signed-off-by: Gary King <gking@nvidia.com>
2011-11-30mmc: core: Release delayed mmc work wakelock after deep disableSan Mehat
Signed-off-by: San Mehat <san@google.com>
2011-11-30mmc: sdio: Add high speed support to sdio_reset_comm()Daniel Chen
Signed-off-by: San Mehat <san@google.com>
2011-11-30mmc: sdio: Claim host in sdio_reset_comm()Dmitry Shmidt
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2011-11-30mmc: mmcblk: Add support for deferred SD bus resumeSan Mehat
Signed-off-by: San Mehat <san@google.com> mmc: card: Add MMC_BLOCK_DEFERRED_RESUME option to Kconfig Signed-off-by: San Mehat <san@google.com>
2011-11-30mmc: core: Add deferred bus resume policy.San Mehat
A card driver can now specify that the underlying bus should *not* auto-resume with the rest of the system. This is useful for reducing resume latency as well as saving power when the card driver is not using the bus. In the future, we'll add support for manual suspend Signed-off-by: San Mehat <san@google.com>
2011-11-30mmc: core: Hold a wake lock accross delayed work + mmc rescanSan Mehat
Signed-off-by: San Mehat <san@android.com> mmc: core: Rework mmc_delayed_work wakelock so that the wakelock is only extended if a card is added or removed. Signed-off-by: San Mehat <san@google.com>
2011-11-30mmc: sd: Add retries in re-detectionSan Mehat
Signed-off-by: San Mehat <san@android.com> mmc: sd: Remove debugging printk Signed-off-by: Dima Zavin <dima@android.com>
2011-11-30mmc: sd: When resuming, try a little harder to init the cardSan Mehat
Signed-off-by: San Mehat <san@android.com>
2011-11-30mmc: Add new API call 'sdio_reset_comm' for resetting communication with an ↵San Mehat
SDIO device Signed-off-by: San Mehat <san@android.com>
2011-11-30trout: Add functions for WiFiDmitry Shmidt
2011-11-30mmc: Add concept of an 'embedded' SDIO device.San Mehat
This is required to support chips which use SDIO for signaling/ communication but do not implement the various card enumeration registers as required for full SD / SDIO cards. mmc: sdio: Fix bug where we're freeing the CIS tables we never allocated when using EMBEDDED_SDIO mmc: Add max_blksize to embedded SDIO data Signed-off-by: San Mehat <san@google.com>
2011-11-30mmc: sd: Add new CONFIG_MMC_PARANOID_SD_INIT for enabling retries during SD ↵San Mehat
detection Signed-off-by: San Mehat <san@google.com>
2011-11-11mmc: core: ext_csd.raw_* used in comparison but never setAndrei Warkentin
commit 5238acbe36dd5100fb6b035a995ae5fc89dd0708 upstream. f39b2dd9d ("mmc: core: Bus width testing needs to handle suspend/resume") added code to only compare read-only ext_csd fields in bus width testing code, yet it's comparing some fields that are never set. The affected fields are ext_csd.raw_erased_mem_count and ext_csd.raw_partition_support. Signed-off-by: Andrei Warkentin <andrey.warkentin@gmail.com> Acked-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-11mmc: core: Fix hangs related to insert/remove of cardsUlf Hansson
commit 7f7e4129c23f0419257184dff6fec89d2d5a8964 upstream. During a rescan operation mmc_attach(sd|mmc|sdio) functions are called. The error handling in these function can trigger a detach of the bus, which also meant a power off. This is not notified by the rescan operation which then continues to the next attach function. If a power off has been done, the framework must never send any new commands to the host driver, without first doing a new power up. This will most likely trigger any host driver to hang. Moving power off out of detach and instead handle power off separately when it is actually needed, solves the issue. Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-31mmc: sd: UHS-I bus speed should be set last in UHS initializationSubhash Jadavani
mmc_sd_init_uhs_card function sets the driver type, current limit and bus speed mode on card as well as on host controller side. Currently bus speed mode is set by sending CMD6 to card and immediately setting the timing mode in host controller. But then before initiating tuning sequence, it also tries to set current limit by sending CMD6 to card which results in data timeout errors in controller if bus speed mode is SDR50/SDR104 mode. So basically bus speed mode should be set only after current limit is set in the card and immediately after setting the bus speed mode, tuning sequence should be initiated. Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org> Reviewed-by: Arindam Nath <arindam.nath@amd.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-08-31mmc: core: use non-reentrant workqueue for clock gatingMika Westerberg
The default multithread workqueue can cause the same work to be executed concurrently on a different CPUs. This isn't really suitable for clock gating as it might already gated the clock and gating it twice results both host->clk_old and host->ios.clock to be set to 0. To prevent this from happening we use system_nrt_wq instead. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Chris Ball <cjb@laptop.org> Cc: <stable@kernel.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-08-31mmc: core: prevent aggressive clock gating racing with ios updatesMika Westerberg
We have seen at least two different races when clock gating kicks in in a middle of ios structure update. First one happens when ios->clock is changed outside of aggressive clock gating framework, for example via mmc_set_clock(). The race might happen when we run following code: mmc_set_ios(): ... if (ios->clock > 0) mmc_set_ungated(host); Now if gating kicks in right after the condition check we end up setting host->clk_gated to false even though we have just gated the clock. Next time a request is started we try to ungate and restore the clock in mmc_host_clk_hold(). However since we have host->clk_gated set to false the original clock is not restored. This eventually will cause the host controller to hang since its clock is disabled while we are trying to issue a request. For example on Intel Medfield platform we see: [ 13.818610] mmc2: Timeout waiting for hardware interrupt. [ 13.818698] sdhci: =========== REGISTER DUMP (mmc2)=========== [ 13.818753] sdhci: Sys addr: 0x00000000 | Version: 0x00008901 [ 13.818804] sdhci: Blk size: 0x00000000 | Blk cnt: 0x00000000 [ 13.818853] sdhci: Argument: 0x00000000 | Trn mode: 0x00000000 [ 13.818903] sdhci: Present: 0x1fff0000 | Host ctl: 0x00000001 [ 13.818951] sdhci: Power: 0x0000000d | Blk gap: 0x00000000 [ 13.819000] sdhci: Wake-up: 0x00000000 | Clock: 0x00000000 [ 13.819049] sdhci: Timeout: 0x00000000 | Int stat: 0x00000000 [ 13.819098] sdhci: Int enab: 0x00ff00c3 | Sig enab: 0x00ff00c3 [ 13.819147] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000 [ 13.819196] sdhci: Caps: 0x6bee32b2 | Caps_1: 0x00000000 [ 13.819245] sdhci: Cmd: 0x00000000 | Max curr: 0x00000000 [ 13.819292] sdhci: Host ctl2: 0x00000000 [ 13.819331] sdhci: ADMA Err: 0x00000000 | ADMA Ptr: 0x00000000 [ 13.819377] sdhci: =========================================== [ 13.919605] mmc2: Reset 0x2 never completed. and it never recovers. Second race might happen while running mmc_power_off(): static void mmc_power_off(struct mmc_host *host) { host->ios.clock = 0; host->ios.vdd = 0; [ clock gating kicks in here ] /* * Reset ocr mask to be the highest possible voltage supported for * this mmc host. This value will be used at next power up. */ host->ocr = 1 << (fls(host->ocr_avail) - 1); if (!mmc_host_is_spi(host)) { host->ios.bus_mode = MMC_BUSMODE_OPENDRAIN; host->ios.chip_select = MMC_CS_DONTCARE; } host->ios.power_mode = MMC_POWER_OFF; host->ios.bus_width = MMC_BUS_WIDTH_1; host->ios.timing = MMC_TIMING_LEGACY; mmc_set_ios(host); } If the clock gating worker kicks in while we are only partially updated the ios structure the host controller gets incomplete ios and might not work as supposed. Again on Intel Medfield platform we get: [ 4.185349] kernel BUG at drivers/mmc/host/sdhci.c:1155! [ 4.185422] invalid opcode: 0000 [#1] PREEMPT SMP [ 4.185509] Modules linked in: [ 4.185565] [ 4.185608] Pid: 4, comm: kworker/0:0 Not tainted 3.0.0+ #240 Intel Corporation Medfield/iCDKA [ 4.185742] EIP: 0060:[<c136364e>] EFLAGS: 00010083 CPU: 0 [ 4.185827] EIP is at sdhci_set_power+0x3e/0xd0 [ 4.185891] EAX: f5ff98e0 EBX: f5ff98e0 ECX: 00000000 EDX: 00000001 [ 4.185970] ESI: f5ff977c EDI: f5ff9904 EBP: f644fe98 ESP: f644fe94 [ 4.186049] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068 [ 4.186125] Process kworker/0:0 (pid: 4, ti=f644e000 task=f644c0e0 task.ti=f644e000) [ 4.186219] Stack: [ 4.186257] f5ff98e0 f644feb0 c1365173 00000282 f5ff9460 f5ff96e0 f5ff96e0 f644feec [ 4.186418] c1355bd8 f644c0e0 c1499c3d f5ff96e0 f644fed4 00000006 f5ff96e0 00000286 [ 4.186579] f644fedc c107922b f644feec 00000286 f5ff9460 f5ff9700 f644ff10 c135839e [ 4.186739] Call Trace: [ 4.186802] [<c1365173>] sdhci_set_ios+0x1c3/0x340 [ 4.186883] [<c1355bd8>] mmc_gate_clock+0x68/0x120 [ 4.186963] [<c1499c3d>] ? _raw_spin_unlock_irqrestore+0x4d/0x60 [ 4.187052] [<c107922b>] ? trace_hardirqs_on+0xb/0x10 [ 4.187134] [<c135839e>] mmc_host_clk_gate_delayed+0xbe/0x130 [ 4.187219] [<c105ec09>] ? process_one_work+0xf9/0x5b0 [ 4.187300] [<c135841d>] mmc_host_clk_gate_work+0xd/0x10 [ 4.187379] [<c105ec82>] process_one_work+0x172/0x5b0 [ 4.187457] [<c105ec09>] ? process_one_work+0xf9/0x5b0 [ 4.187538] [<c1358410>] ? mmc_host_clk_gate_delayed+0x130/0x130 [ 4.187625] [<c105f3c8>] worker_thread+0x118/0x330 [ 4.187700] [<c1496cee>] ? preempt_schedule+0x2e/0x50 [ 4.187779] [<c105f2b0>] ? rescuer_thread+0x1f0/0x1f0 [ 4.187857] [<c1062cf4>] kthread+0x74/0x80 [ 4.187931] [<c1062c80>] ? __init_kthread_worker+0x60/0x60 [ 4.188015] [<c149acfa>] kernel_thread_helper+0x6/0xd [ 4.188079] Code: 81 fa 00 00 04 00 0f 84 a7 00 00 00 7f 21 81 fa 80 00 00 00 0f 84 92 00 00 00 81 fa 00 00 0 [ 4.188780] EIP: [<c136364e>] sdhci_set_power+0x3e/0xd0 SS:ESP 0068:f644fe94 [ 4.188898] ---[ end trace a7b23eecc71777e4 ]--- This BUG() comes from the fact that ios.power_mode was still in previous value (MMC_POWER_ON) and ios.vdd was set to zero. We prevent these by inhibiting the clock gating while we update the ios structure. Both problems can be reproduced by simply running the device in a reboot loop. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Chris Ball <cjb@laptop.org> Cc: <stable@kernel.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-08-31mmc: rename mmc_host_clk_{ungate|gate} to mmc_host_clk_{hold|release}Mika Westerberg
As per suggestion by Linus Walleij: > If you think the names of the functions are confusing then > you may rename them, say like this: > > mmc_host_clk_ungate() -> mmc_host_clk_hold() > mmc_host_clk_gate() -> mmc_host_clk_release() > > Which would make the usecases more clear (This is CC'd to stable@ because the next two patches, which fix observable races, depend on it.) Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Cc: <stable@kernel.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-08-13mmc: core: use defined R1_STATE_PRG macro for card statusJaehoon Chung
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-08-13mmc: core: Detect eMMC v4.5 ext_csd entriesKyungmin Park
The eMMC v4.5 Spec is released now: EXT_CSD_REV Extended CSD Revision 255-7 Reserved 6 Revision 1.6 (for MMC v4.5) 5 Revision 1.5 (for MMV v4.41) ... Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-07-25notifiers: pm: move pm notifiers into suspend.hAmerigo Wang
It is not necessary to share the same notifier.h. Signed-off-by: WANG Cong <amwang@redhat.com> Cc: David Miller <davem@davemloft.net> Acked-by: "Rafael J. Wysocki" <rjw@sisk.pl> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-07-21mmc: print debug messages for runtime PM actionsDaniel Drake
At http://www.mail-archive.com/linux-mmc@vger.kernel.org/msg08371.html (thread: "mmc: sdio: reset card during power_restore") we found and fixed a bug where mmc's runtime power management functions were not being called. We have now also made improvements to the SDIO powerup routine which could possibly mask this kind of issue in future. Add debug messages to the runtime PM hooks so that it is easy to verify if and when runtime PM is happening. Signed-off-by: Daniel Drake <dsd@laptop.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-07-21mmc: fix runtime PM with -ENOSYS suspend caseOhad Ben-Cohen
In the case where a driver returns -ENOSYS from its suspend handler to indicate that the device should be powered down over suspend, the remove routine of the driver was not being called, leading to lots of confusion during resume. The problem is that runtime PM is disabled during this process, and when we reach mmc_sdio_remove, calling the runtime PM functions here (validly) return errors, and this was causing us to skip the remove function. Fix this by ignoring the error value of pm_runtime_get_sync(), which can return valid errors. This also matches the behaviour of pci_device_remove(). Signed-off-by: Daniel Drake <dsd@laptop.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-07-20mmc: core: Set non-default Drive Strength via platform hookPhilip Rakity
Non default Drive Strength cannot be set automatically. It is a function of the board design and only if there is a specific platform handler can it be set. The platform handler needs to take into account the board design. Pass to the platform code the necessary information. For example: The card and host controller may indicate they support HIGH and LOW drive strength. There is no way to know what should be chosen without specific board knowledge. Setting HIGH may lead to reflections and setting LOW may not suffice. There is no mechanism (like ethernet duplex or speed pulses) to determine what should be done automatically. If no platform handler is defined -- use the default value. Signed-off-by: Philip Rakity <prakity@marvell.com> Reviewed-by: Arindam Nath <arindam.nath@amd.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-07-20mmc: core: add non-blocking mmc request functionPer Forlin
Previously there has only been one function mmc_wait_for_req() to start and wait for a request. This patch adds: * mmc_start_req() - starts a request wihtout waiting If there is on ongoing request wait for completion of that request and start the new one and return. Does not wait for the new command to complete. This patch also adds new function members in struct mmc_host_ops only called from core.c: * pre_req - asks the host driver to prepare for the next job * post_req - asks the host driver to clean up after a completed job The intention is to use pre_req() and post_req() to do cache maintenance while a request is active. pre_req() can be called while a request is active to minimize latency to start next job. post_req() can be used after the next job is started to clean up the request. This will minimize the host driver request end latency. post_req() is typically used before ending the block request and handing over the buffer to the block layer. Add a host-private member in mmc_data to be used by pre_req to mark the data. The host driver will then check this mark to see if the data is prepared or not. Signed-off-by: Per Forlin <per.forlin@linaro.org> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Venkatraman S <svenkatr@ti.com> Tested-by: Sourav Poddar <sourav.poddar@ti.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-07-20mmc: queue: let host controllers specify maximum discard timeoutAdrian Hunter
Some host controllers will not operate without a hardware timeout that is limited in value. However large discards require large timeouts, so there needs to be a way to specify the maximum discard size. A host controller driver may now specify the maximum discard timeout possible so that max_discard_sectors can be calculated. However, for eMMC when the High Capacity Erase Group Size is not in use, the timeout calculation depends on clock rate which may change. For that case Preferred Erase Size is used instead. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-07-13mmc: core: Bus width testing needs to handle suspend/resumePhilip Rakity
On reading the ext_csd for the first time (in 1 bit mode), save the ext_csd information needed for bus width compare. On every pass we make re-reading the ext_csd, compare the data against the saved ext_csd data. This fixes a regression introduced in 3.0-rc1 by 08ee80cc397ac1a3 ("mmc: core: eMMC bus width may not work on all platforms"), which incorrectly assumed we would be re-reading the ext_csd at resume- time. Signed-off-by: Philip Rakity <prakity@marvell.com> Tested-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-06-25mmc: core: make erase timeout calculation allow for gated clockAdrian Hunter
The erase timeout calculation may depend on clock rate which is zero if the clock is gated, so use mmc_host_clk_rate() which allows for that case. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Chris Ball <cjb@laptop.org>