aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2017-12-19mmc: sdhci-xenon: wait 5ms after set 1.8V signal enableZhoujie Wu1-0/+7
According to SD spec 3.00 3.6.1 signal voltage switch procedure step 6~8, (6) Set 1.8V Signal Enable in the Host Control 2 register. (7) Wait 5ms. 1.8V voltage regulator shall be stable within this period. (8) If 1.8V Signal Enable is cleared by Host Controller, go to step (12). Host should wait 5ms after set 1.8V signal enable bit in Host Control 2 register and check if 1.8V is stable or not. But current code checks this bit right after set it. On some platforms with xenon controller found the bit is cleared right away and host reports "1.8V regulator output did not became stable" and 5ms delay can help. Implement voltage_switch callback for xenon controller to add 5ms delay to make sure the 1.8V signal enable bit is set by controller. Signed-off-by: Zhoujie Wu <[email protected]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-19mmc: tmio: change bus_shift to unsigned intMasahiro Yamada1-1/+1
Sane values for bus_shift are: 0 - for 16 bit bus 1 - for 32 bit bus 2 - for 64 bit bus "unsigned long" is too much. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-19mmc: tmio,renesas_sdhi: move ssc_tappos to renesas_sdhi.hMasahiro Yamada3-3/+3
struct tmio_mmc_host has "scc_tappos", but in fact, it is Renesas private data. Move it to renesas_sdhi.h Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-19mmc: tmio, renesas_sdhi: move Renesas-specific DMA data to renesas_sdhi.hMasahiro Yamada4-9/+18
struct tmio_mmc_host has "dma_dataend" and "dma_complete", but in fact, they are Renesas private data. Move them to renesas_sdhi.h Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-19mmc: tmio, renesas_sdhi: move struct tmio_mmc_dma to renesas_sdhi.hMasahiro Yamada5-29/+33
struct tmio_mmc_dma looks like TMIO core data, but in fact, Renesas private data. Move it to renesas_sdhi.h (probably, it is better to rename it to renesas_sdhi_dma, or squash it into struct renesas_sdhi). I also moved struct renesas_sdhi and host_to_priv() to that header because they are necessary to convert the tmio_mmc_host pointer into the renesas_sdhi pointer. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-19mmc: renesas_sdhi: remove always false conditionMasahiro Yamada1-2/+2
renesas_sdhi_probe() always sets host->dma as follows: host->dma = dma_priv; !host->dma is always false. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: block: fix logical error to avoid memory leakLiu, Changcheng1-0/+1
If the MMC_DRV_OP_GET_EXT_CSD request completes successfully, then ext_csd must be freed, but in one case it was not. Fix that. Signed-off-by: Liu Changcheng <[email protected]> Acked-by: Adrian Hunter <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18Merge branch 'fixes' into nextUlf Hansson1-0/+3
2017-12-18mmc: avoid removing non-removable hosts during suspendDaniel Drake1-0/+8
The Weibu F3C MiniPC has an onboard AP6255 module, presenting two SDIO functions on a single MMC host (Bluetooth/btsdio and WiFi/brcmfmac), and the mmc layer correctly detects this as non-removable. After suspend/resume, the wifi and bluetooth interfaces disappear and do not get probed again. The conditions here are: 1. During suspend, we reach mmc_pm_notify() 2. mmc_pm_notify() calls mmc_sdio_pre_suspend() to see if we can suspend the SDIO host. However, mmc_sdio_pre_suspend() returns -ENOSYS because btsdio_driver does not have a suspend method. 3. mmc_pm_notify() proceeds to remove the card 4. Upon resume, mmc_rescan() does nothing with this host, because of the rescan_entered check which aims to only scan a non-removable device a single time (i.e. during boot). Fix the loss of functionality by detecting that we are unable to suspend a non-removable host, so avoid the forced removal in that case. The comment above this function already indicates that this code was only intended for removable devices. Signed-off-by: Daniel Drake <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: android-goldfish: remove duplicate includesPravin Shedge1-2/+0
These duplicate includes have been found with scripts/checkincludes.pl but they have been removed manually to avoid removing false positives. Signed-off-by: Pravin Shedge <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: tmio: move mmc_gpio_request_cd() before mmc_add_host()Masahiro Yamada1-8/+6
Drivers do not need to call mmc_gpiod_request_cd_irq() explicitly because mmc_start_host() calls it. To make it work, cd_gpio must be set before mmc_add_host(). Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: tmio, renesas_sdhi: set mmc_host_ops hooks directlyMasahiro Yamada3-9/+2
Drivers can set any mmc_host_ops hooks between tmio_mmc_host_alloc() and tmio_mmc_host_probe(). Remove duplicated hooks in tmio_mmc_host. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Tested-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: tmio: move mmc_host_ops to struct tmio_mmc_host from static dataMasahiro Yamada2-4/+6
Currently, tmio_mmc_ops is static data and tmio_mmc_host_probe() updates some hooks in the static data. This is a problem when two or more instances call tmio_mmc_host_probe() and each of them requests to use its own card_busy/start_signal_voltage_switch. We can borrow a solution from sdhci_alloc_host(). Copy the whole ops structure to host->mmc_host_ops, then override the hooks in malloc'ed data. Constify tmio_mmc_ops since it is now a template ops used by default. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Tested-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: tmio: use devm_ioremap_resource() instead of devm_ioremap()Masahiro Yamada1-7/+3
The TMIO core misses to call request_mem_region(). devm_ioremap_resource() takes care of it and makes the code cleaner. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Tested-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: tmio: set tmio_mmc_host to driver dataMasahiro Yamada3-15/+8
The remove, suspend, resume hooks need to get tmio_mmc_host. It is tedious to call mmc_priv() to convert mmc_host to tmio_mmc_host. We can directly set tmio_mmc_host to driver data. Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: renesas_sdhi: remove eprobe jump labelMasahiro Yamada1-6/+4
"goto eprobe" does nothing. Return directly. Signed-off-by: Masahiro Yamada <[email protected]> Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: renesas_sdhi: remove wrong depends on to enable compile testMasahiro Yamada1-1/+0
ARCH_RENESAS is a stronger condition than (ARM || ARM64). If ARCH_RENESAS is enabled, (ARM || ARM64) is met as well. What is worse, the first depends on line prevents COMPILE_TEST from enabling this driver. It should be removed. Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Wolfram Sang <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-18mmc: tmio: use ioread* for repeated access to a registerWolfram Sang1-4/+4
Not all archs define reads* and writes*. Switch to ioread*_rep and friends which is defined everywhere, so we can enable COMPILE_TEST after that. Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-15mmc: renesas_sdhi: Add MODULE_LICENSEMasaharu Hayakawa1-0/+3
The following error occurs when loading renesas_sdhi_core.c module, so add MODULE_LICENSE("GPL v2"). renesas_sdhi_core: module license 'unspecified' taints kernel. Signed-off-by: Masaharu Hayakawa <[email protected]> Fixes: 9d08428afb72 ("mmc: renesas-sdhi: make renesas_sdhi_sys_dmac main module file") Cc: <[email protected]> # v4.13+ [Shimoda: Added Fixes tag and Cc to the stable ML] Signed-off-by: Yoshihiro Shimoda <[email protected]> Reviewed-by: Simon Horman <[email protected]> Acked-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-15mmc: renesas_sdhi: consolidate DMAC CONFIG optionsMasahiro Yamada2-8/+4
The description in the Makefile is odd. Fix the CONFIG selection in a cleaner way. Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-15mmc: sunxi-mmc: Handle return value of platform_get_irqArvind Yadav1-0/+5
platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-15mmc: sdhci-spear: Handle return value of platform_get_irqArvind Yadav1-0/+4
platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-15mmc: sdhci-acpi: Handle return value of platform_get_irqArvind Yadav1-0/+4
platform_get_irq() can fail here and we must check its return value. Signed-off-by: Arvind Yadav <[email protected]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-15mmc: s3cmci: Fix platform_get_irq's error checkingArvind Yadav1-1/+1
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct. Signed-off-by: Arvind Yadav <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-15mmc: meson-gx-mmc: Fix platform_get_irq's error checkingArvind Yadav1-1/+1
The platform_get_irq() function returns negative if an error occurs. zero or positive number on success. platform_get_irq() error checking for zero is not correct. Signed-off-by: Arvind Yadav <[email protected]> Acked-by: Kevin Hilman <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-15mmc: dt-bindings: add mmc support to MT7623 SoCSean Wang1-0/+2
Add the devicetree binding for MT7623 SoC using MT2701 as the fallback. Cc: [email protected] Signed-off-by: Sean Wang <[email protected]> Acked-by: Rob Herring <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11Merge branch 'fixes' into nextUlf Hansson2-0/+10
2017-12-11mmc: core: apply NO_CMD23 quirk to some specific cardsChristoph Fritz2-0/+10
To get an usdhc Apacer and some ATP SD cards work reliable, CMD23 needs to be disabled. This has been tested on i.MX6 (sdhci-esdhc) and rk3288 (dw_mmc-rockchip). Without this patch on i.MX6 (sdhci-esdhc): $ dd if=/dev/urandom of=/mnt/test bs=1M count=10 conv=fsync | <mmc0: starting CMD23 arg 00000400 flags 00000015> | mmc0: starting CMD25 arg 00a71f00 flags 000000b5 | mmc0: blksz 512 blocks 1024 flags 00000100 tsac 3000 ms nsac 0 | mmc0: CMD12 arg 00000000 flags 0000049d | sdhci [sdhci_irq()]: *** mmc0 got interrupt: 0x00000001 | mmc0: Timeout waiting for hardware interrupt. Without this patch on rk3288 (dw_mmc-rockchip): | mmc1: Card stuck in programming state! mmcblk1 card_busy_detect | dwmmc_rockchip ff0c0000.dwmmc: Busy; trying anyway | mmc_host mmc1: Bus speed (slot 0) = 400000Hz (slot req 400000Hz, | actual 400000HZ div = 0) | mmc1: card never left busy state | mmc1: tried to reset card, got error -110 | blk_update_request: I/O error, dev mmcblk1, sector 139778 | Buffer I/O error on dev mmcblk1p1, logical block 131586, lost async | page write Signed-off-by: Christoph Fritz <[email protected]> Cc: <[email protected]> # v4.14+ Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11Merge branch 'fixes' into nextUlf Hansson1-1/+1
2017-12-11mmc: sdhci-acpi: Avoid broken UHS transfer modes on Intel CHTAdrian Hunter1-0/+34
Intel DSM function 8 has been used to identify transfer modes that are not working on some CHT boards. Add support for that. Signed-off-by: Adrian Hunter <[email protected]> Tested-by: Carlo Caione <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: sdhci-acpi: Add setup_host() callbackAdrian Hunter1-1/+14
Add a ->setup_host() callback so that device-specific changes can be made to the mmc host controller before it is added. Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: block: blk-mq: Potential NULL deref on mmc_blk_alloc_req() failureDan Carpenter1-0/+1
mmc_blk_alloc_req() is supposed to return error pointers but there is one path where we forget to set the error code and accidentally return NULL. The callers are not expecting that and will have a NULL pointer dereference. Fixes: 41e3efd07d5a ("mmc: block: Simplify cleaning up the queue") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: cqhci: Ensure macro parameters are wrapped in parenthesesAdrian Hunter1-21/+21
Absence of parentheses is not affecting current code, but ensure macro parameters are wrapped in parentheses. Reported-by: Dan Carpenter <[email protected]> Fixes: a4080225f51d ("mmc: cqhci: support for command queue enabled host") Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: core: Remove code no longer needed after the switch to blk-mqAdrian Hunter5-200/+1
Remove code no longer needed after the switch to blk-mq. Signed-off-by: Adrian Hunter <[email protected]> Acked-by: Linus Walleij <[email protected]> Tested-by: Linus Walleij <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: block: Remove code no longer needed after the switch to blk-mqAdrian Hunter4-964/+16
Remove code no longer needed after the switch to blk-mq. Signed-off-by: Adrian Hunter <[email protected]> Acked-by: Linus Walleij <[email protected]> Tested-by: Linus Walleij <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: core: Remove option not to use blk-mqAdrian Hunter5-22/+1
Remove config option MMC_MQ_DEFAULT and parameter mmc_use_blk_mq, so that blk-mq must be used always. Signed-off-by: Adrian Hunter <[email protected]> Acked-by: Linus Walleij <[email protected]> Tested-by: Linus Walleij <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: sdhci-of-esdhc: fix the mmc error after sleep on ls1046ardbyinbo.zhu1-4/+8
When system wakes up from sleep on ls1046ardb, the SD operation fails with mmc error messages since ESDHC_TB_EN bit couldn't be cleaned by eSDHC_SYSCTL[RSTA]. It's proper to clean this bit in esdhc_reset() rather than in probe. Signed-off-by: yinbo.zhu <[email protected]> Acked-by: Yangbo Lu <[email protected]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: mmc_test: Ensure command queue is disabled for testingAdrian Hunter1-2/+9
mmc_test disables the command queue because none of the tests use the command queue. However the Reset Test will re-enable it, so disable it in that case too. Fixes: 9d4579a85c84 ("mmc: mmc_test: Disable Command Queue while mmc_test is used") Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: core: Ensure cmd_completion is initializedAdrian Hunter1-4/+2
mmc_test now uses mmc_start_request() to test sending commands during "ongoing" asynchronous transfers, i.e. tests: Commands during non-blocking read - use Set Block Count (CMD23) Commands during non-blocking write - use Set Block Count (CMD23) mmc_start_request() was not initializing cmd_completion, but cmd_completion is used by "ongoing" transfers, so move initialization of cmd_completion into making mmc_start_request(). Fixes: cb39f61e9b1e ("mmc: core: Export a few functions needed for blkmq support") Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: sdhci-acpi: Add support for ACPI HID of AMD Controller with HS400Shah Nehal-Bakulchandra1-0/+79
This patch supports HS400 for AMD upcoming emmc 5.0 controller.The HS400 and HS200 mode requires hardware work around also. This patch adds the quirks for the same. Signed-off-by: Nehal-bakulchandra Shah <[email protected]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc_test: use ktime_get_ts64 for timestampsArnd Bergmann1-46/+42
Calling getnstimeofday() can suffer from time jumps and from the y2038 overflow, so it is not appropriate here. Using ktime_get_ts64() solves both problems. Using ktime_get() with ktime_t timestamps would also work, but it seems that we mainly want to print the times as seconds+nanoseconds, so it would require an extra division in the output. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: sdhci-of-arasan: Add sdhci_arasan_set_powerMilan Stevanovic1-0/+12
The power register needs to have a valid voltage set even when the power supply is managed by an external regulator. Signed-off-by: Milan Stevanovic <[email protected]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: renesas_sdhi: enable R-Car D3 (r8a77995) supportUlrich Hecht1-0/+1
Whitelists for internal DMAC implementation. Signed-off-by: Ulrich Hecht <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Acked-by: Wolfram Sang <[email protected]>
2017-12-11mmc: block: make function mmc_cqe_issue_type staticColin Ian King1-2/+2
The function mmc_cqe_issue_type is local to the source and does not need to be in global scope, so make it static. Cleans up sparse warning: drivers/mmc/core/queue.c:62:21: warning: symbol 'mmc_cqe_issue_type' was not declared. Should it be static? Signed-off-by: Colin Ian King <[email protected]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: block: blk-mq: fix boolreturn.cocci warningsWu Fengguang1-1/+1
drivers/mmc/core/block.c:2106:9-10: WARNING: return of 0/1 in function 'mmc_blk_status_error' with return type bool Return statements in functions returning bool should use true/false instead of 1/0. Generated by: scripts/coccinelle/misc/boolreturn.cocci Fixes:7eb43d537166 ("mmc: block: blk-mq: Stop using legacy recovery") CC: Adrian Hunter <[email protected]> Signed-off-by: Fengguang Wu <[email protected]> Acked-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
2017-12-11mmc: mmc_test: Do not use mmc_start_areq() anymoreAdrian Hunter1-68/+54
The block driver's blk-mq paths do not use mmc_start_areq(). In order to remove mmc_start_areq() entirely, start by removing it from mmc_test. Signed-off-by: Adrian Hunter <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Tested-by: Linus Walleij <[email protected]>
2017-12-11mmc: block: blk-mq: Stop using legacy recoveryAdrian Hunter1-143/+161
There are only a few things the recovery needs to do. Primarily, it just needs to: Determine the number of bytes transferred Get the card back to transfer state Determine whether to retry There are also a couple of additional features: Reset the card before the last retry Read one sector at a time The legacy code spent much effort analyzing command errors, but commands fail fast, so it is simpler just to give all command errors the same number of retries. Signed-off-by: Adrian Hunter <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Tested-by: Linus Walleij <[email protected]>
2017-12-11mmc: block: Reduce polling timeout from 10 minutes to 10 secondsAdrian Hunter1-1/+7
Set a 10 second timeout for polling write request busy state. Note, mmc core is setting a 3 second timeout for SD cards, and SDHCI has long had a 10 second software timer to timeout the whole request, so 10 seconds should be ample. Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Acked-by: Linus Walleij <[email protected]> Tested-by: Linus Walleij <[email protected]>
2017-12-11mmc: block: Add timeout_clks when calculating timeoutAdrian Hunter1-7/+35
According to the specification, total access time is derived from both TAAC and NSAC, which means the timeout should add both timeout_ns and timeout_clks. Host drivers do that, so make the block driver do that too. Signed-off-by: Adrian Hunter <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Acked-by: Linus Walleij <[email protected]> Tested-by: Linus Walleij <[email protected]>
2017-12-11mmc: block: Check for transfer state in card_busy_detect()Adrian Hunter1-4/+13
The card is required to return to transfer state. Since that is the state required to start another transfer, check for that state instead of programming state. Signed-off-by: Adrian Hunter <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Ulf Hansson <[email protected]> Tested-by: Linus Walleij <[email protected]>