summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/atmel-mci.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-16mmc: atmel-mci: Convert to pinctrl_select_default_state()Ulf Hansson1-1/+1
Let's move away from using pinctrl_pm_select_default_state() as it's scheduled for removal and use pinctrl_select_default_state() instead. Cc: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20191206170821.29711-8-ulf.hansson@linaro.org
2019-11-27Merge tag 'driver-core-5.5-rc1' of ↵Linus Torvalds1-5/+5
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg KH: "Here is the "big" set of driver core patches for 5.5-rc1 There's a few minor cleanups and fixes in here, but the majority of the patches in here fall into two buckets: - debugfs api cleanups and fixes - driver core device link support for boot dependancy issues The debugfs api cleanups are working to slowly refactor the debugfs apis so that it is even harder to use incorrectly. That work has been happening for the past few kernel releases and will continue over time, it's a long-term project/goal The driver core device link support missed 5.4 by just a bit, so it's been sitting and baking for many months now. It's from Saravana Kannan to help resolve the problems that DT-based systems have at boot time with dependancy graphs and kernel modules. Turns out that no one has actually tried to build a generic arm64 kernel with loads of modules and have it "just work" for a variety of platforms (like a distro kernel). The big problem turned out to be a lack of dependency information between different areas of DT entries, and the work here resolves that problem and now allows devices to boot properly, and quicker than a monolith kernel. All of these patches have been in linux-next for a long time with no reported issues" * tag 'driver-core-5.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (68 commits) tracing: Remove unnecessary DEBUG_FS dependency of: property: Add device link support for interrupt-parent, dmas and -gpio(s) debugfs: Fix !DEBUG_FS debugfs_create_automount of: property: Add device link support for "iommu-map" of: property: Fix the semantics of of_is_ancestor_of() i2c: of: Populate fwnode in of_i2c_get_board_info() drivers: base: Fix Kconfig indentation firmware_loader: Fix labels with comma for builtin firmware driver core: Allow device link operations inside sync_state() driver core: platform: Declare ret variable only once cpu-topology: declare parse_acpi_topology in <linux/arch_topology.h> crypto: hisilicon: no need to check return value of debugfs_create functions driver core: platform: use the correct callback type for bus_find_device firmware_class: make firmware caching configurable driver core: Clarify documentation for fwnode_operations.add_links() mailbox: tegra: Fix superfluous IRQ error message net: caif: Fix debugfs on 64-bit platforms mac80211: Use debugfs_create_xul() helper media: c8sectpfe: no need to check return value of debugfs_create functions of: property: Add device link support for iommus, mboxes and io-channels ...
2019-11-14mmc: atmel-mci: Use dma_request_chan() directly for channel requestPeter Ujfalusi1-2/+1
dma_request_slave_channel_reason() is: dma_request_chan(dev, name) Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Reviewed-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2019-11-03mmc: atmel-mci: Remove superfluous cast in debugfs_create_u32() callGeert Uytterhoeven1-1/+1
"atmel_mci.state" is an enum, which is compatible with u32, so there is no need to cast its address, preventing further compiler checks. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20191025094130.26033-6-geert+renesas@glider.be Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-03mmc: atmel-mci: Fix debugfs on 64-bit platformsGeert Uytterhoeven1-4/+4
"atmel_mci.pending_events" and "atmel_mci.completed_events" are "unsigned long", i.e. 32-bit or 64-bit, depending on the platform. Hence casting their addresses to "u32 *", and calling debugfs_create_x32() breaks operation on 64-bit platforms. Fix this by using the new debugfs_create_xul() helper instead. Fixes: deec9ae31e607955 ("atmel-mci: debugfs support") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20191025094130.26033-5-geert+renesas@glider.be Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-11mmc: atmel-mci: Mark expected switch fall-throughsGustavo A. R. Silva1-0/+4
Mark switch cases where we are expecting to fall through. This patch fixes the following warnings: drivers/mmc/host/atmel-mci.c: In function 'atmci_get_cap': drivers/mmc/host/atmel-mci.c:2415:30: warning: this statement may fall through [-Wimplicit-fallthrough=] host->caps.has_odd_clk_div = 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/mmc/host/atmel-mci.c:2416:2: note: here case 0x400: ^~~~ drivers/mmc/host/atmel-mci.c:2422:28: warning: this statement may fall through [-Wimplicit-fallthrough=] host->caps.has_highspeed = 1; ~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/mmc/host/atmel-mci.c:2423:2: note: here case 0x200: ^~~~ drivers/mmc/host/atmel-mci.c:2426:40: warning: this statement may fall through [-Wimplicit-fallthrough=] host->caps.need_notbusy_for_read_ops = 1; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ drivers/mmc/host/atmel-mci.c:2427:2: note: here case 0x100: ^~~~ Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2019-07-11Merge tag 'mmc-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmcLinus Torvalds1-31/+7
Pull MMC updates from Ulf Hansson: "MMC core: - Let the dma map ops deal with bouncing and drop dma_max_pfn() from the dma-mapping interface for ARM - Convert the generic MMC DT doc to YAML schemas - Drop questionable support for powered-on re-init of SDIO cards at runtime resume and for SDIO HW reset - Prevent questionable re-init of powered-on removable SDIO cards at system resume - Cleanup and clarify some SDIO core code MMC host: - tmio: Make runtime PM enablement more flexible for variants - tmio/renesas_sdhi: Rename DT doc tmio_mmc.txt to renesas,sdhi.txt to clarify - sdhci-pci: Add support for Intel EHL - sdhci-pci-o2micro: Enable support for 8-bit bus - sdhci-msm: Prevent acquiring a mutex while holding a spin_lock - sdhci-of-esdhc: Improve clock management and tuning - sdhci_am654: Enable support for 4 and 8-bit bus on J721E - sdhci-sprd: Use pinctrl for a proper signal voltage switch - sdhci-sprd: Add support for HS400 enhanced strobe mode - sdhci-sprd: Enable PHY DLL and allow delay config to stabilize the clock - sdhci-sprd: Add support for optional gate clock - sunxi-mmc: Convert DT doc to YAML schemas - meson-gx: Add support for broken DRAM access for DMA MEMSTICK core: - Fixup error path of memstick_init()" * tag 'mmc-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (52 commits) mmc: sdhci_am654: Add dependency on MMC_SDHCI_AM654 mmc: alcor: remove a redundant greater or equal to zero comparison mmc: sdhci-msm: fix mutex while in spinlock mmc: sdhci_am654: Make some symbols static dma-mapping: remove dma_max_pfn mmc: core: let the dma map ops handle bouncing dt-binding: mmc: rename tmio_mmc.txt to renesas,sdhi.txt mmc: sdhci-sprd: Add pin control support for voltage switch dt-bindings: mmc: sprd: Add pinctrl support mmc: sdhci-sprd: Add start_signal_voltage_switch ops mmc: sdhci-pci: Add support for Intel EHL mmc: tmio: Use dma_max_mapping_size() instead of a workaround mmc: sdio: Drop unused in-parameter from mmc_sdio_init_card() mmc: sdio: Drop unused in-parameter to mmc_sdio_reinit_card() mmc: sdio: Don't re-initialize powered-on removable SDIO cards at resume mmc: sdio: Drop powered-on re-init at runtime resume and HW reset mmc: sdio: Move comment about re-initialization to mmc_sdio_reinit_card() mmc: sdio: Drop mmc_claim|release_host() in mmc_sdio_power_restore() mmc: sdio: Turn sdio_run_irqs() into static mmc: sdhci: Fix indenting on SDHCI_CTRL_8BITBUS ...
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner1-4/+1
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-17mmc: host: atmel-mci: no need to check return value of debugfs_create functionsGreg Kroah-Hartman1-31/+7
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2019-02-25mmc: atmel-mci: enable 8 bits buswidth supportNicolas Ferre1-1/+7
This patch adds support for 8-bit buswidth. Relevant SDCR value modified. Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com> Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2018-12-17mmc: convert to DEFINE_SHOW_ATTRIBUTEYangtao Li1-26/+5
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. Signed-off-by: Yangtao Li <tiny.windzz@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2018-12-17mmc: atmel-mci: do not assume idle after atmci_request_endJonas Danielsson1-1/+2
On our AT91SAM9260 board we use the same sdio bus for wifi and for the sd card slot. This caused the atmel-mci to give the following splat on the serial console: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 538 at drivers/mmc/host/atmel-mci.c:859 atmci_send_command+0x24/0x44 Modules linked in: CPU: 0 PID: 538 Comm: mmcqd/0 Not tainted 4.14.76 #14 Hardware name: Atmel AT91SAM9 [<c000fccc>] (unwind_backtrace) from [<c000d3dc>] (show_stack+0x10/0x14) [<c000d3dc>] (show_stack) from [<c0017644>] (__warn+0xd8/0xf4) [<c0017644>] (__warn) from [<c0017704>] (warn_slowpath_null+0x1c/0x24) [<c0017704>] (warn_slowpath_null) from [<c033bb9c>] (atmci_send_command+0x24/0x44) [<c033bb9c>] (atmci_send_command) from [<c033e984>] (atmci_start_request+0x1f4/0x2dc) [<c033e984>] (atmci_start_request) from [<c033f3b4>] (atmci_request+0xf0/0x164) [<c033f3b4>] (atmci_request) from [<c0327108>] (mmc_start_request+0x280/0x2d0) [<c0327108>] (mmc_start_request) from [<c032800c>] (mmc_start_areq+0x230/0x330) [<c032800c>] (mmc_start_areq) from [<c03366f8>] (mmc_blk_issue_rw_rq+0xc4/0x310) [<c03366f8>] (mmc_blk_issue_rw_rq) from [<c03372c4>] (mmc_blk_issue_rq+0x118/0x5ac) [<c03372c4>] (mmc_blk_issue_rq) from [<c033781c>] (mmc_queue_thread+0xc4/0x118) [<c033781c>] (mmc_queue_thread) from [<c002daf8>] (kthread+0x100/0x118) [<c002daf8>] (kthread) from [<c000a580>] (ret_from_fork+0x14/0x34) ---[ end trace 594371ddfa284bd6 ]--- This is: WARN_ON(host->cmd); This was fixed on our board by letting atmci_request_end determine what state we are in. Instead of unconditionally setting it to STATE_IDLE on STATE_END_REQUEST. Signed-off-by: Jonas Danielsson <jonas@orbital-systems.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2018-08-21mmc: atmel-mci: fix bad logic of sg_copy_{from,to}_buffer conversionLudovic Desroches1-6/+6
The conversion to sg_copy_{from,to}_buffer has been done in the wrong way. sg_copy_to_buffer is a copy from an SG list to a linear buffer so it can't replace memcpy(buf + offset, &value, remaining) where buf is the virtual address of the SG. Same for sg_copy_to_buffer but in the opposite way. Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com> Suggested-by: Douglas Gilbert <dgilbert@interlog.com> Fixes: 5b4277814e3f ("mmc: atmel-mci: use sg_copy_{from,to}_buffer") Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2018-05-21mmc: atmel-mci: use sg_copy_{from,to}_bufferChristoph Hellwig1-12/+9
This handles highmem pages, and also cleans up the code. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-11-02mmc: Convert timers to use timer_setup()Kees Cook1-7/+6
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Ludovic Desroches <ludovic.desroches@microchip.com> Cc: Ulf Hansson <ulf.hansson@linaro.org> Cc: Jaehoon Chung <jh80.chung@samsung.com> Cc: Carlo Caione <carlo@caione.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Nicolas Pitre <nico@fluxnic.net> Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alex Dubov <oakad@yahoo.com> Cc: Bruce Chang <brucechang@via.com.tw> Cc: Harald Welte <HaraldWelte@viatech.com> Cc: Tony Olech <tony.olech@elandigitalsystems.com> Cc: Pierre Ossman <pierre@ossman.eu> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Paul Cercueil <paul@crapouillou.net> Cc: Heiner Kallweit <hkallweit1@gmail.com> Cc: Shawn Lin <shawn.lin@rock-chips.com> Cc: Arvind Yadav <arvind.yadav.cs@gmail.com> Cc: Allen <allen.lkml@gmail.com> Cc: linux-mmc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-amlogic@lists.infradead.org Cc: linux-omap@vger.kernel.org Cc: linux-usb@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-08-30mmc: Convert to using %pOF instead of full_nameRob Herring1-2/+2
Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Ulf Hansson <ulf.hansson@linaro.org> Cc: Ludovic Desroches <ludovic.desroches@microchip.com> Cc: Jan Glauber <jglauber@cavium.com> Cc: David Daney <david.daney@cavium.com> Cc: "Steven J. Hill" <Steven.Hill@cavium.com> Cc: linux-mmc@vger.kernel.org Acked-by: David Daney <david.daney@cavium.com> Tested-by: Steven J. Hill <Steven.Hill@cavium.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-08-30mmc: atmel-mci: add missing of_node_putJulia Lawall1-0/+1
for_each_child_of_node performs an of_node_get on each iteration, so a break out the loop requires an of_node_put. The semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ local idexpression n; expression e,e1; iterator name for_each_child_of_node; @@ for_each_child_of_node(e1,n) { ... ( of_node_put(n); | e = n | + of_node_put(n); ? break; ) ... } ... when != n // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-08-30mmc: atmel-mci: remove unused sg_len variableShawn Lin1-3/+2
We got a warning: drivers/mmc/host/atmel-mci.c:1086:15: warning: variable 'sg_len' set but not used [-Wunused-but-set-variable] Ideally we should check to see if sg_len is zero but looking into the code closely, I didn't find any possible to do that as atmci_start_request didn't even deploy any error handling for its host->prepare_data hook. So even we return error value for iflags like what other host drivers did, for instance, sdhci and dwmmc, it still need some extra work to improve the code. Just remove it to silent the warning, although it isn't perfect. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-06-20mmc: atmel-mci: Delete an error message for a failed memory allocationMarkus Elfring1-3/+1
Omit an extra message for a memory allocation failure. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-06-20mmc: atmel-mci: Remove AVR32 bits from the driverAndy Shevchenko1-22/+2
AVR32 is gone. Now it's time to clean up the driver by removing leftovers that was used by AVR32 related code. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2017-04-24mmc: use new core function mmc_get_dma_dirHeiner Kallweit1-19/+11
Use new core function mmc_get_dma_dir(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2016-05-02mmc: atmel-mci: Remove redundant runtime PM callsUlf Hansson1-9/+0
Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host devices"), made some calls to the runtime PM API from the driver redundant. Especially those which deals with runtime PM reference counting, so let's remove them. Cc: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com>
2016-03-17mmc: atmel-mci: Check pdata for NULL before dereferencing it at DMA configBrent Taylor1-1/+1
Using an at91sam9g20ek development board with DTS configuration may trigger a kernel panic because of a NULL pointer dereference exception, while configuring DMA. Let's fix this by adding a check for pdata before dereferencing it. Signed-off-by: Brent Taylor <motobud@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2016-02-29mmc: atmel-mci: remove the MMC_DATA_STREAM flagJaehoon Chung1-7/+2
Remove the MMC_DATA_STREAM flag because it isn't used anymore. Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2016-01-18Merge branch 'for-linus' of ↵Linus Torvalds1-1/+17
git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32 Pull AVR32 updates from Hans-Christian Noren Egtvedt. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt/linux-avr32: mmc: atmel: get rid of struct mci_dma_data mmc: atmel-mci: restore dma on AVR32 avr32: wire up missing syscalls avr32: wire up accept4 syscall
2016-01-14mmc: atmel: get rid of struct mci_dma_dataMans Rullgard1-1/+0
As struct mci_dma_data is now only used by AVR32, it is nothing but pointless indirection. Replace it with struct dw_dma_slave in the AVR32 platform code and with a void pointer elsewhere. Signed-off-by: Mans Rullgard <mans@mansr.com> Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
2016-01-14mmc: atmel-mci: restore dma on AVR32Mans Rullgard1-0/+17
Commit ecb89f2f5f3e7 ("mmc: atmel-mci: remove compat for non DT board when requesting dma chan") broke dma on AVR32 and any other boards not using DT. This restores a fallback mechanism for such cases. Signed-off-by: Mans Rullgard <mans@mansr.com> Acked-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
2015-12-22mmc: atmel-mci: atmci_convert_chksize depends on controller versionludovic.desroches@atmel.com1-16/+27
The atmci_convert_chksize() function is no more valid for controller version 0x600 due to the introduction of '2 data' chunk size. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2015-12-22mmc: atmel-mci: move atmel-mci-regs.h content in atmel-mci.cludovic.desroches@atmel.com1-1/+149
atmel-mci-regs.h is only included in atmel-mci.c so move its content in the driver and do some cleanup in these definitions to remove checkpatch errors. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2015-08-27mmc: atmel-mci: remove useless includeAlexandre Belloni1-1/+0
Definitions from linux/platform_data/atmel.h are not used, remove the include. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2015-05-18mmc: atmel-mci: fix bad variable type for clkdivLudovic Desroches1-2/+7
clkdiv is declared as an u32 but it can be set to a negative value causing a huge divisor value. Change its type to int to avoid this case. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Cc: <stable@vger.kernel.org> # 3.4 and later Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-12-13mmc: atmel-mci: use SET_RUNTIME_PM_OPS() macroLudovic Desroches1-1/+1
The currently used SET_PM_RUNTIME_PM_OPS() macro is defined to the SET_RUNTIME_PM_OPS() macro. Convert to the later, since that's the proper one to use. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-12-02mmc: atmel-mci: use probe deferring if dma controller is not ready yetludovic.desroches@atmel.com1-24/+24
Return probe defer if requesting a dma channel without a dma controller probed. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-12-02mmc: atmel-mci: stop using specific initcallludovic.desroches@atmel.com1-13/+2
No more use late initcall to manage probing order. Use probe deferring if needed. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-12-02mmc: atmel-mci: remove __init/__exit attributesludovic.desroches@atmel.com1-5/+5
Using __init/__exit attributes can cause several breakages so remove them. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-12-02mmc: atmel-mci: remove useless DMA stuff for non-dt devicesludovic.desroches@atmel.com1-8/+0
All devices with a DMA controller are DT compliant and legacy support has been removed. For those reasons, some DMA stuff is useless. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-11-26mmc: atmel-mci: remove compat for non DT board when requesting dma chanludovic.desroches@atmel.com1-19/+1
All boards with a dma controller have DT support so using dma_request_slave_channel_compat is no more needed. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-11-26mmc: atmel-mci: adopt pinctrl supportWenyou Yang1-0/+5
Amend the atmel mci pin controller to optionally take a pin control handle and set the state of the pins to: - "default" on boot, resume and before performing an transfer. - "sleep" on suspend(). This should make it possible to optimize energy usage for the pins both for the suspend/resume cycle. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-11-10mmc: atmel-mci: add runtime pm supportWenyou Yang1-23/+67
Add runtime pm support to atmel mci controller. Use runtime pm APIs to enable/disable atmel mci's clock. Use runtime autosuspend APIs to enable auto suspend delay. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> [Ulf: Fixed compile error]
2014-11-10mmc: host: atmel-mci: Add support for non-removable slotsTimo Kokkonen1-2/+9
Add support for non-removable slots which have no card detection GPIO and which should not be polled for a card change. Signed-off-by: Timo Kokkonen <timo.kokkonen@offcode.fi> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-11-10mmc: atmel-mci: move mach header to platform_dataAlexandre Belloni1-1/+1
Move the mach header that can come either from arm/mach-at91 or avr32 to platform_data to be able to switch the AT91 platforms to multiplatform. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> [Ulf: Fixed compile error]
2014-09-29mmc: atmel-mci: fix mismatched section on atmci_cleanup_slotArnd Bergmann1-1/+1
As of 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe"), the atmci_probe() function calls atmci_cleanup_slot in the failure path. This causes a new warning whenever the driver is built: WARNING: drivers/mmc/host/built-in.o(.init.text+0xa04): Section mismatch in reference from the function atmci_probe() to the function .exit.text:atmci_cleanup_slot() The function __init atmci_probe() references a function __exit atmci_cleanup_slot(). Gcc correctly warns about this function getting dropped in the link stage for the built-in case, which would cause undefined behavior when this error path is hit. The solution is to simply drop the __exit annotation. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 528bc7808f4e ("mmc: atmel-mci: Release mmc resources on failure in probe") Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-09-24mmc: atmel-mci: Release mmc resources on failure in probePramod Gurav1-2/+9
This change takes care of releasing mmc resources on error cases in probe function which was missing. Also release timer in remove function. Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-09-24mmc: atmel-mci: Switch to using managed resource in probePramod Gurav1-27/+14
This change uses managed resource APIs to allocate resources such as, clk, gpio, io in order to simplify the driver unload or failure cases. Hence does away with release statements of the same resources in error labels and remove function. Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-09-09mmc: atmel-mci: add 0x600 IP versionNicolas Ferre1-0/+1
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-06-12mmc: atmel-mci: incude asm/cacheclush.hArnd Bergmann1-0/+1
This avoids a build error due to the use of flush_dcache_page. drivers/mmc/host/atmel-mci.c: In function 'atmci_read_data_pio': drivers/mmc/host/atmel-mci.c:1870:5: error: implicit declaration of function 'flush_dcache_page' [-Werror=implicit-function-declaration] flush_dcache_page(sg_page(sg)); ^ Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-05-12mmc: atmel: don't test host->dataAlexandre Belloni1-10/+3
Found using smatch: drivers/mmc/host/atmel-mci.c:827 atmci_pdc_complete() warn: variable dereferenced before check 'host->data' (see line 807) Stop testing host->data as it is not NULL at that point. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
2014-01-13mmc: atmel-mci: add vmmc-supply supportAlexandre Belloni1-0/+7
Other MMC hosts handle a regulator named vmmc-supply that allows to power the MMC card or SDIO device before communicating on the bus. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Chris Ball <chris@printf.net>
2014-01-13mmc: atmel-mci: fix timeout errors in SDIO mode when using DMALudovic Desroches1-1/+12
With some SDIO devices, timeout errors can happen when reading data. To solve this issue, the DMA transfer has to be activated before sending the command to the device. This order is incorrect in PDC mode. So we have to take care if we are using DMA or PDC to know when to send the MMC command. Cc: stable <stable@vger.kernel.org> # 3.2+ Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-10-30mmc: atmel-mci: Remove redundant suspend and resume callbacksUlf Hansson1-61/+0
Suspend and resume of cards are handled by the protocol layer and consequently the mmc_suspend|resume_host APIs are marked as deprecated. While moving away from using the deprecated APIs, there are nothing left to be done for the suspend and resume callbacks, so remove them. Cc: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Chris Ball <cjb@laptop.org>