aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core (follow)
AgeCommit message (Collapse)AuthorFilesLines
2011-05-25mmc: core: Block CMD23 support for UHS104/SDXC cards.Andrei Warkentin1-0/+2
SD cards operating at UHS104 or better support SET_BLOCK_COUNT. Signed-off-by: Andrei Warkentin <andreiw@motorola.com> Reviewed-by: Arindam Nath <arindam.nath@amd.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: core: duplicated trial with same freq in mmc_rescan_try_freq()Jaehoon Chung1-1/+1
mmc_rescan_try_freq() tries to init two times with the last frequency. For example, if host->f_min is 400KHz, we see the message below: mmc1: mmc_rescan_try_freq: trying to init card at 400000 Hz mmc1: mmc_rescan_try_freq: trying to init card at 400000 Hz Andy Ross says that he didn't try this code on a board with an f_min that exactly matches one of the table entries, which explains why the bug wasn't detected. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: Andy Ross <andy.ross@windriver.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: core: add support for eMMC Dual Data RatePhilip Rakity3-19/+32
eMMC voltage change not required for 1.8V. 3.3V and 1.8V vcc are capable of doing DDR. vccq of 1.8v is not required. 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-05-24mmc: core: eMMC signal voltage does not use CMD11Philip Rakity3-5/+6
eMMC chips do not use CMD11 when changing voltage. Add extra argument to call to indicate if CMD11 needs to be sent. 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-05-24mmc: core: clear MMC_PM_KEEP_POWER flag on resumeEliad Peller1-0/+1
Since the MMC_PM_KEEP_POWER flag should be set on each suspend, it should also cleared on each resume. Upon resuming, we have to know if power was kept (for re-initialization, etc.), so clear it just after resuming. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: sdio: optimized SDIO IRQ handling for single irqStefan Nilsson XK1-1/+32
If there is only 1 function interrupt registered it is possible to improve performance by directly calling the irq handler and avoiding the overhead of reading the CCCR registers. Signed-off-by: Per Forlin <per.forlin@linaro.org> Acked-by: Ulf Hansson <ulf.hansson@stericsson.com> Reviewed-by: Nicolas Pitre <nicolas.pitre@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: sdhci: enable preset value after uhs initializationArindam Nath1-0/+11
According to the Host Controller spec v3.00, setting Preset Value Enable in the Host Control2 register lets SDCLK Frequency Select, Clock Generator Select and Driver Strength Select to be set automatically by the Host Controller based on the UHS-I mode set. This patch enables this feature. Since Preset Value Enable makes sense only for UHS-I cards, we enable this feature after successfull UHS-I initialization. We also reset Preset Value Enable next time before initialization. Tested by Zhangfei Gao with a Toshiba uhs card and general hs card, on mmp2 in SDMA mode. Signed-off-by: Arindam Nath <arindam.nath@amd.com> Reviewed-by: Philip Rakity <prakity@marvell.com> Tested-by: Philip Rakity <prakity@marvell.com> Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: sd: add support for tuning during uhs initializationArindam Nath1-0/+6
Host Controller needs tuning during initialization to operate SDR50 and SDR104 UHS-I cards. Whether SDR50 mode actually needs tuning is indicated by bit 45 of the Host Controller Capabilities register. A new command CMD19 has been defined in the Physical Layer spec v3.01 to request the card to send tuning pattern. We enable Buffer Read Ready interrupt at the very begining of tuning procedure, because that is the only interrupt generated by the Host Controller during tuning. We program the block size to 64 in the Block Size register. We make sure that DMA Enable and Multi Block Select in the Transfer Mode register are set to 0 before actually sending CMD19. The tuning block is sent by the card to the Host Controller using DAT lines, so we set Data Present Select (bit 5) in the Command register. The Host Controller is responsible for doing the verfication of tuning block sent by the card at the hardware level. After sending CMD19, we wait for Buffer Read Ready interrupt. In case we don't receive an interrupt after the specified timeout value, we fall back on fixed sampling clock by setting Execute Tuning (bit 6) and Sampling Clock Select (bit 7) of Host Control2 register to 0. Before exiting the tuning procedure, we disable Buffer Read Ready interrupt and re-enable other interrupts. Tested by Zhangfei Gao with a Toshiba uhs card and general hs card, on mmp2 in SDMA mode. Signed-off-by: Arindam Nath <arindam.nath@amd.com> Reviewed-by: Philip Rakity <prakity@marvell.com> Tested-by: Philip Rakity <prakity@marvell.com> Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: sd: report correct speed and capacity of uhs cardsArindam Nath2-4/+17
Since only UHS-I cards respond with S18A set in response to ACMD41, we set the card as ultra-high-speed after successfull initialization. We need to decide whether a card is SDXC based on the C_SIZE field of CSDv2.0 register. According to Physical Layer spec v3.01, the minimum value of C_SIZE for SDXC card is 00FFFFh. Tested by Zhangfei Gao with a Toshiba uhs card and general hs card, on mmp2 in SDMA mode. Signed-off-by: Arindam Nath <arindam.nath@amd.com> Reviewed-by: Philip Rakity <prakity@marvell.com> Tested-by: Philip Rakity <prakity@marvell.com> Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: sd: set current limit for uhs cardsArindam Nath1-0/+63
We decide on the current limit to be set for the card based on the Capability of Host Controller to provide current at 1.8V signalling, and the maximum current limit of the card as indicated by CMD6 mode 0. We then set the current limit for the card using CMD6 mode 1. As per the Physical Layer Spec v3.01, the current limit switch is only applicable for SDR50, SDR104, and DDR50 bus speed modes. For other UHS-I modes, we set the default current limit of 200mA. Tested by Zhangfei Gao with a Toshiba uhs card and general hs card, on mmp2 in SDMA mode. Signed-off-by: Arindam Nath <arindam.nath@amd.com> Reviewed-by: Philip Rakity <prakity@marvell.com> Tested-by: Philip Rakity <prakity@marvell.com> Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: sd: add support for uhs bus speed mode selectionArindam Nath1-0/+65
This patch adds support for setting UHS-I bus speed mode during UHS-I initialization procedure. Since both the host and card can support more than one bus speed, we select the highest speed based on both of their capabilities. First we set the bus speed mode for the card using CMD6 mode 1, and then we program the host controller to support the required speed mode. We also set High Speed Enable in case one of the UHS-I modes is selected. We take care to reset SD clock before setting UHS mode in the Host Control2 register, and then re-enable it as per the Host Controller spec v3.00. We then set the clock frequency for the UHS-I mode selected. Tested by Zhangfei Gao with a Toshiba uhs card and general hs card, on mmp2 in SDMA mode. Signed-off-by: Arindam Nath <arindam.nath@amd.com> Reviewed-by: Philip Rakity <prakity@marvell.com> Tested-by: Philip Rakity <prakity@marvell.com> Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: sd: add support for driver type selectionArindam Nath5-29/+139
This patch adds support for setting driver strength during UHS-I initialization procedure. Since UHS-I cards set S18A (bit 24) in response to ACMD41, we use this as a base for UHS-I initialization. We modify the parameter list of mmc_sd_get_cid() so that we can save the ROCR from ACMD41 to check whether bit 24 is set. We decide whether the Host Controller supports A, C, or D driver type depending on the Capabilities register. Driver type B is suported by default. We then set the appropriate driver type for the card using CMD6 mode 1. As per Host Controller spec v3.00, we set driver type for the host only if Preset Value Enable in the Host Control2 register is not set. SDHCI_HOST_CONTROL has been renamed to SDHCI_HOST_CONTROL1 to conform to the spec. Tested by Zhangfei Gao with a Toshiba uhs card and general hs card, on mmp2 in SDMA mode. Signed-off-by: Arindam Nath <arindam.nath@amd.com> Reviewed-by: Philip Rakity <prakity@marvell.com> Tested-by: Philip Rakity <prakity@marvell.com> Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: sd: query function modes for uhs cardsArindam Nath1-10/+58
SD cards which conform to Physical Layer Spec v3.01 can support additional Bus Speed Modes, Driver Strength, and Current Limit other than the default values. We use CMD6 mode 0 to read these additional card functions. The values read here will be used during UHS-I initialization steps. Tested by Zhangfei Gao with a Toshiba uhs card and general hs card, on mmp2 in SDMA mode. Signed-off-by: Arindam Nath <arindam.nath@amd.com> Reviewed-by: Philip Rakity <prakity@marvell.com> Tested-by: Philip Rakity <prakity@marvell.com> Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: sd: add support for signal voltage switch procedureArindam Nath3-2/+67
Host Controller v3.00 adds another Capabilities register. Apart from other things, this new register indicates whether the Host Controller supports SDR50, SDR104, and DDR50 UHS-I modes. The spec doesn't mention about explicit support for SDR12 and SDR25 UHS-I modes, so the Host Controller v3.00 should support them by default. Also if the controller supports SDR104 mode, it will also support SDR50 mode as well. So depending on the host support, we set the corresponding MMC_CAP_* flags. One more new register. Host Control2 is added in v3.00, which is used during Signal Voltage Switch procedure described below. Since as per v3.00 spec, UHS-I supported hosts should set S18R to 1, we set S18R (bit 24) of OCR before sending ACMD41. We also need to set XPC (bit 28) of OCR in case the host can supply >150mA. This support is indicated by the Maximum Current Capabilities register of the Host Controller. If the response of ACMD41 has both CCS and S18A set, we start the signal voltage switch procedure, which if successfull, will switch the card from 3.3V signalling to 1.8V signalling. Signal voltage switch procedure adds support for a new command CMD11 in the Physical Layer Spec v3.01. As part of this procedure, we need to set 1.8V Signalling Enable (bit 3) of Host Control2 register, which if remains set after 5ms, means the switch to 1.8V signalling is successfull. Otherwise, we clear bit 24 of OCR and retry the initialization sequence. When we remove the card, and insert the same or another card, we need to make sure that we start with 3.3V signalling voltage. So we call mmc_set_signal_voltage() with MMC_SIGNAL_VOLTAGE_330 set so that we are back to 3.3V signalling voltage before we actually start initializing the card. Tested by Zhangfei Gao with a Toshiba uhs card and general hs card, on mmp2 in SDMA mode. Signed-off-by: Arindam Nath <arindam.nath@amd.com> Reviewed-by: Philip Rakity <prakity@marvell.com> Tested-by: Philip Rakity <prakity@marvell.com> Acked-by: Zhangfei Gao <zhangfei.gao@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: core: Add mmc CMD+ACMD passthrough ioctlJohn Calixto1-1/+2
Allows appropriately-privileged applications to send CMD (normal) and ACMD (application-specific; preceded with CMD55) commands to cards/devices on the mmc bus. This is primarily useful for enabling the security functionality built in to every SD card. It can also be used as a generic passthrough (e.g. to enable virtual machines to control mmc bus devices directly). However, this use case has not been tested rigorously. Generic passthrough testing was only conducted for a few non-security opcodes to prove the feasibility of the passthrough. Since any opcode can be sent using this passthrough, it is very possible to render the card/device unusable. Applications that use this ioctl must have CAP_SYS_RAWIO. Security commands tested on TI PCIxx12 (SDHCI), Sigma Designs SMP8652 SoC, TI OMAP3621/OMAP3630 SoC, Samsung S5PC110 SoC, Qualcomm MSM7200A SoC. Signed-off-by: John Calixto <john.calixto@modsystems.com> Reviewed-by: Andrei Warkentin <andreiw@motorola.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: initialize struct mmc_request at declaration timeChris Ball4-22/+8
Converts from: struct mmc_request mrq; memset(&mrq, 0, sizeof(struct mmc_request)); to: struct mmc_request mrq = {0}; because it's shorter, as performant, and easier to work out whether initialization has happened. Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: initialize struct mmc_data at declaration timeChris Ball3-12/+6
Converts from: struct mmc_data data; memset(&data, 0, sizeof(struct mmc_data)); to: struct mmc_data data = {0}; because it's shorter, as performant, and easier to work out whether initialization has happened. Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: initialize struct mmc_command at declaration timeChris Ball4-70/+26
Converts from: struct mmc_command cmd; memset(&cmd, 0, sizeof(struct mmc_command)); to: struct mmc_command cmd = {0}; because it's shorter, as performant, and easier to work out whether initialization has happened. Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: core: Fix use of uninitialized data in mmc_send_if_cond.Chris Ball1-0/+2
mmc_send_if_cond did not zero out mmc_command on stack. Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: core: Fix use of uninitialized data in mmc_cmd_app.Andrei Warkentin1-0/+2
mmc_cmd_app did not zero out mmc_command on stack. Reported-by: Chuanxiao Dong <chuanxiao.dong@intel.com> Signed-off-by: Andrei Warkentin <andreiw@motorola.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: MMC boot partitions support.Andrei Warkentin1-5/+17
Allows device MMC boot partitions to be accessed. MMC partitions are treated effectively as separate block devices on the same MMC card. Signed-off-by: Andrei Warkentin <andreiw@motorola.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: core: Allow setting CMD timeout for CMD6 (SWITCH).Andrei Warkentin3-8/+23
CMD6 is an R1B-type command, where DAT is used as busy. Depending on register written using CMD6, timeout value can be different as per spec. Signed-off-by: Andrei Warkentin <andreiw@motorola.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: core: Rename erase_timeout to cmd_timeout_ms.Andrei Warkentin1-18/+21
Renames erase_timeout to cmd_timeout_ms inside struct mmc_command. First step to making host honor timeouts for non-data-transfer commands. Cleans up erase timeout code. Signed-off-by: Andrei Warkentin <andreiw@motorola.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: quirks: Extends card quirks with MMC/SD quirks matching the CID.Andrei Warkentin3-54/+43
The current mechanism is SDIO-only. This allows us to create function-specific quirks, without creating messy Kconfig dependencies, or polluting core/ with function-specific code. Signed-off-by: Andrei Warkentin <andreiw@motorola.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: core: fix memory leak in mmc_add_hostWolfram Sang1-2/+2
led_trigger_register_simple() allocates memory which must not be leaked in the error-path of mmc_add_host. Move it past the only error-check in the function. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: quirks: wl1271 is MMC_QUIRK_DISABLE_CDOhad Ben-Cohen1-0/+2
The wl12xx device supports disconnecting the pull-up resistor on CD/DAT[3] (pin 1) of the card. Tell SDIO core to disconnect that resistor during card init, since we don't need it at that point (and anyway all hosts shall provide pull-up resistors on all data lines DAT[3:0] as described in section 6 of the SD physical specification). As a result, this may save some power, but it's also generally healthy since it prevents both ends from pulling up that pin, which results in undesirable asymmetric physical bus. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: add MMC_QUIRK_DISABLE_CDOhad Ben-Cohen1-1/+1
006ebd5d introduced sdio_disable_cd(), which disconnects the pull-up resistor on CD/DAT[3] (pin 1) of the card. Make it possible to start using sdio_disable_cd() by introducing MMC_QUIRK_DISABLE_CD. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: quirks: wl1271 is MMC_QUIRK_NONSTD_FUNC_IFOhad Ben-Cohen1-0/+2
Tell SDIO core to ignore the standard SDIO function interface codes indicated by the wl1271. This is required because the wl1271 erroneously indicates its first function as a standard Bluetooth SDIO interface, and that drives btsdio mad. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: add MMC_QUIRK_NONSTD_FUNC_IFOhad Ben-Cohen1-0/+6
Introduce MMC_QUIRK_NONSTD_FUNC_IF to ignore the "SDIO Standard Function interface code" as indicated by the card's FBR, and instead treat all functions as non-standard interfaces. This is required to prevent standard drivers from facing errors when trying to communicate with SDIO cards that erroneously indicate standard function interface codes. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: do not switch to 1-bit mode if not requiredOhad Ben-Cohen1-2/+2
6b5eda36 followed SDIO spec part E1 section 8, which states that in case SDIO interrupts are being used to wake up a suspended host, then it is required to switch to 1-bit mode before stopping the clock. Before switching to 1-bit mode (or back to 4-bit mode on resume), make sure that SDIO interrupts are really being used to wake the host. This is helpful for devices which have an external irq line (e.g. wl1271), and do not use SDIO interrupts to wake up the host. In this case, switching to 1-bit mode (and back to 4-bit mode on resume) is not necessary. Reported-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: mmc_card_keep_power cleanupsOhad Ben-Cohen2-7/+7
mmc_card_is_powered_resumed is a mouthful; instead, simply use mmc_card_keep_power, which also better explains the purpose of the macro. Employ mmc_card_keep_power() where possible. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: Reliable write support.Andrei Warkentin1-0/+5
Allows reliable writes to be used for MMC writes. Reliable writes are used to service write REQ_FUA/REQ_META requests. Handles both the legacy and the enhanced reliable write support in MMC cards. Signed-off-by: Andrei Warkentin <andreiw@motorola.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-24mmc: Ensure linux starts in eMMC user partitionPhilip Rakity1-0/+10
uBoot sometimes leaves eMMC pointing to the private boot partition. Ensure we always start looking at the user partition. Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Bruce Clemens <bpclemens@marvell.com> Signed-off-by: Mark F. Brown <markb@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-05-16Revert "mmc: fix a race between card-detect rescan and clock-gate work instances"Chris Ball1-4/+5
This reverts commit 26fc8775b51484d8c0a671198639c6d5ae60533e, which has been reported to cause boot/resume-time crashes for some users: https://bbs.archlinux.org/viewtopic.php?id=118751. Signed-off-by: Chris Ball <cjb@laptop.org> Cc: <stable@kernel.org>
2011-04-27mmc: fix a race between card-detect rescan and clock-gate work instancesGuennadi Liakhovetski1-5/+4
Currently there is a race in the MMC core between a card-detect rescan work and the clock-gating work, scheduled from a command completion. Fix it by removing the dedicated clock-gating mutex and using the MMC standard locking mechanism instead. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Cc: Simon Horman <horms@verge.net.au> Cc: Magnus Damm <damm@opensource.se> Acked-by: Linus Walleij <linus.walleij@linaro.org> Cc: <stable@kernel.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-04-27mmc: core: mmc_add_card(): fix missing break in switch statementMichał Mirosław1-0/+1
Fixes a cosmetic bug that affects printk() for SD-combo cards. Reported-by: Prashanth Bhat <prashanth.bhat@manipal.net> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-31Fix common misspellingsLucas De Marchi3-3/+3
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-03-25mmc: fix mmc_app_send_scr() for dma transferYoshihiro Shimoda1-1/+13
This patch is based on the commit "af51715079e7fb6b290e1881d63d815dc4de5011": * Bugfix to that mmc_send_cxd_data() code: dma-to-stack is unsafe/nonportable, so kmalloc a bounce buffer instead. The driver may invalidate the mmc_card->csd when host driver uses dma. So this subroutine also needs a kmalloc buffer. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-17mmc: core: reset card voltage after power offUlf Hansson1-0/+7
At power off, reset OCR mask to be the highest possible voltage supported for the current mmc host. This solves the re-initialization during the power up sequence. The voltage may have been decreased due to the card accepts a lower voltage than the voltage used during the initialization sequence. We need to reset the voltage to by the host highest possible value since according to specification the initialization must always be done at high voltage. Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-17mmc: core: export function mmc_do_release_host()Ulf Hansson1-1/+9
When using mmc_try_claim_host the corresponding release function is mmc_do_release_host, which then also must be exported. Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com> Reviewed-by: Sebastian Rasmussen <sebastian.rasmussen@stericsson.com> Signed-off-by: Ulf Hansson <ulf.hansson@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-17mmc: sdio: remember new card RCA when redetecting cardStefan Nilsson XK1-0/+8
During redetection of a SDIO card, a request for a new card RCA was submitted to the card, but was then overwritten by the old RCA. This caused the card to be deselected instead of selected when using the incorrect RCA. This bug's been present since the "oldcard" handling was introduced in 2.6.32. Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com> Reviewed-by: Ulf Hansson <ulf.hansson@stericsson.com> Reviewed-by: Pawel Wieczorkiewicz <pawel.wieczorkiewicz@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: <stable@kernel.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-16mmc: check if mmc cards < 2GB do sector addressingPhilip Rakity1-1/+11
Some TOSHIBA MMC cards only support sector addressing even though the size is < 2GB. According to JEDEC Spec JESD84-A441-1 the ocr register (bits 30, 29) determine byte/sector mode. Use them. Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-16mmc: core: comment on why sdio_reset is done at init timePhilip Rakity1-0/+6
sdio_reset sends a CMD52 to reset the sdio card. This is highly recommended for sdio cards being reinitialized. Since we do not know if the card is being reinitialized we just send the command. SD/eMMC cards are supposed to ignore the CMD before the CMD0. Document why we are doing this. Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-15mmc: Ensure prototypes for SD API are visible in sd.cMark Brown1-0/+1
So we know the implementation and prototypes agree with each other. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Chris Ball <cjb@laptop.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-15mmc: remove BROKEN_CLK_GATING quirk for wl1271Pierre Tardy1-1/+11
This sdio card supports having its sdio clock shutdown. It is also not using the SDIO IRQ, but rather uses a side gpio irq. Signed-off-by: Pierre Tardy <tardyp@gmail.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-15mmc: add MMC_QUIRK_BROKEN_CLK_GATINGPierre Tardy2-4/+14
Some sdio card are not following sdio standard, and do not work when the sdio bus's clock is gated. To keep functionnality for all legacy driver, we turn this quirk on for every sdio card. Drivers needs to disable the quirk manually when someone verifies that their supported card works with clock gating. Signed-off-by: Pierre Tardy <tardyp@gmail.com> Acked-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-15mmc: add per device quirk placeholderPierre Tardy4-1/+66
Some cards have quirks valid for every platforms using current platform quirk hooks leads to a lot of code and debug duplication. So we inspire a bit from what exists in PCI subsystem and do our own per vendorid/deviceid quirk. We still drop the complexity of the pci quirk system (with special section tables, and so on). That can be added later if needed. Signed-off-by: Pierre Tardy <pierre.tardy@intel.com> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Acked-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-15mmc: put the led blinking code after clock ungatingPierre Tardy1-2/+1
Since mmc clock gating can also be used as a power gating tip, it's better to put the led blinking after having ungated the clock. Signed-off-by: Pierre Tardy <pierre.tardy@intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-15mmc: export eMMC4.4 enhanced area details to sysfsChuanxiao Dong1-0/+74
Enhanced area feature is a new feature defined in eMMC4.4 standard. This user data area provides higher performance/reliability, at the expense of using twice the effective media space due to the area using SLC. The MMC driver now reads out the enhanced area offset and size and adds them to the device attributes in sysfs. Enabling the enhanced area can only be done once, and should be done in manufacturing. To use this feature, bit ERASE_GRP_DEF should also be set. Documentation/ABI/testing/sysfs-devices-mmc describes the two new attributes. Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com> Reviewed-by: Chris Ball <cjb@laptop.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2011-03-09Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmcLinus Torvalds1-1/+1
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: mmc: fix CONFIG_MMC_UNSAFE_RESUME regression