summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/mxs-mmc.c
AgeCommit message (Collapse)Author
2017-01-26mmc: mxs-mmc: Fix additional cycles after transmission stopStefan Wahren
commit 01167c7b9cbf099c69fe411a228e4e9c7104e123 upstream. According to the code the intention is to append 8 SCK cycles instead of 4 at end of a MMC_STOP_TRANSMISSION command. But this will never happened because it's an AC command not an ADTC command. So fix this by moving the statement into the right function. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Fixes: e4243f13d10e (mmc: mxs-mmc: add mmc host driver for i.MX23/28) Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-07mmc: mxs: Initialize the spinlock prior to using itFabio Estevam
An interrupt may occur right after devm_request_irq() is called and prior to the spinlock initialization, leading to a kernel oops, as the interrupt handler uses the spinlock. In order to prevent this problem, move the spinlock initialization prior to requesting the interrupts. Fixes: e4243f13d10e (mmc: mxs-mmc: add mmc host driver for i.MX23/28) Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2015-06-01mmc: mxs: Constify platform_device_idKrzysztof Kozlowski
The platform_device_id is not modified by the driver and core uses it as const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2015-01-19mmc: mxs-mmc: remove unneeded NULL checkDan Carpenter
Static checkers complain about the inconsistent NULL checking here: drivers/mmc/host/mxs-mmc.c:680 mxs_mmc_probe() warn: variable dereferenced before check 'ssp->dmach' (see line 660) The variable can't actually be NULL so we can remove the check. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-11-26mmc: mxs-mmc: Check for clk_prepare_enable() errorFabio Estevam
clk_prepare_enable() may fail and in this case we should propagate the error. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-11-26mmc: mxs-mmc: Propagate the real errorFabio Estevam
If platform_get_irq() fails, it is better to propagate the real error value instead of a 'fake' one. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-11-26mmc: mxs-mmc: No need to do NULL check on 'iores'Fabio Estevam
devm_ioremap_resource() already checks if 'iores' is NULL or not, so we can skip this manual check. While at it, move platform_get_resource() closer to devm_ioremap_resource() for better readability. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-11-26mmc: mxs-mmc: Simplify PM hooksFabio Estevam
By using SIMPLE_DEV_PM_OPS we can make the code smaller and cleaner. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-11-26mmc: mxs-mmc: Register the irq with the device nameFabio Estevam
Instead of registering the irq name with the driver's name, it's better to pass the device name so that we have a more explicit indication as to what mmc instance the irq is related: $ cat /proc/interrupts CPU0 ... 26: 6 - 96 80010000.ssp Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-09-09mmc: remove .owner field for drivers using module_platform_driverPeter Griffin
This patch removes the superflous .owner field for drivers which use the module_platform_driver API, as this is overriden in platform_driver_register anyway. Signed-off-by: Peter Griffin <peter.griffin@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-07-09mmc: mxs: fix card detection in case of 'broken-cd' flag setRoman Peniaev
In case of reboot my olinuxino imx23 board does not see mmc card any more. mmc_rescan is being called by delayed work in loop, but mxs_mmc_get_cd always returns 0, so we will never pass the card detection check and will not do further card inition. This patch is just an attempt to partially revert the patch a91fe279ae of Sascha Hauer, where it is claimed that upper layer will handle broken card detection using the polling logic and MMC_CAP_NEEDS_POLL capability, but seems it is not true, because upper logic still expects 1 from 'get_cd'. So, here we always return 1 (card present) in case of MMC_CAP_NEEDS_POLL capability set. Signed-off-by: Roman Pen <r.peniaev@gmail.com> CC: Chris Ball <chris@printf.net> CC: Sascha Hauer <s.hauer@pengutronix.de> CC: Fabio Estevam <fabio.estevam@freescale.com> CC: Shawn Guo <shawn.guo@linaro.org> CC: Ulf Hansson <ulf.hansson@linaro.org> CC: linux-mmc@vger.kernel.org CC: linux-kernel@vger.kernel.org Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
2014-05-12mmc: mxs: fix card detection function for broken card detectDaniel Willmann
Return -ENOSYS in get_cd if broken-cd is specified in the device tree. Commit a91fe279ae75 (mmc: mxs: use standard flag for broken card detection) sets MMC_CAP_NEEDS_POLL when broken-cd is specified. This driver sets this flag unconditionally as it does not support a card detect interrupt. Instead, broken-cd means that there is no card detect signal connected. The mmc core checks the get_cd function return value to determine if a card is present. Only for a non-zero return value it will attempt to initialize the card. So retuning -ENOSYS will allow the card to be initialized. For comparison, mmc_gpio_get_cd in slot-gpio.c also returns -ENOSYS if the card detect GPIO is not valid. Signed-off-by: Daniel Willmann <daniel@totalueberwachung.de> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Chris Ball <chris@printf.net>
2014-01-13mmc: mxs: use mmc_of_parse to parse devicetree propertiesSascha Hauer
Use generic helper function. This also adds support for the cd-gpios and max-frequency devicetree properties. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2014-01-13mmc: mxs: use mmc_gpio_get_ro for detecting read-only statusSascha Hauer
This also fixes that the read-only gpio was used without being requested. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2014-01-13mmc: mxs: use standard flag for cd invertedSascha Hauer
We have a MMC_CAP2_CD_ACTIVE_HIGH flag, so use it rather than a custom driver specific flag. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2014-01-13mmc: mxs: use standard flag for broken card detectionSascha Hauer
Use the standard MMC_CAP_NEEDS_POLL flag rather than a custom broken_cd flag. The original code used to just return true in the card detection function for broken card detection. The MMC_CAP_NEEDS_POLL works different, but was introduced for the same purpose, so assume the code works correct now. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2014-01-13mmc: mxs: use standard flag for non-removable statusSascha Hauer
The standard caps already have a MMC_CAP_NONREMOVABLE flag. Use it rather than a custom non_removable flag. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-10-30mmc: mxs-mmc: Move away from using deprecated APIsUlf Hansson
Suspend and resume of cards are being handled from the protocol layer and consequently the mmc_suspend|resume_host APIs are deprecated. This means we can simplify the suspend|resume callbacks by removing the use of the deprecated APIs. Cc: Shawn Guo <shawn.guo@linaro.org> Cc: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-08-24mmc: mxs-mmc: Check the return value from stmp_reset_block()Fabio Estevam
stmp_reset_block() may fail, so let's check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-08-24mmc: mxs-mmc: Use devm_clk_get()Fabio Estevam
Using devm_clk_get() allows us to remove the clk_put() calls, so let's use it to simplify the code. Rename the 'out_clk_put' label to 'out_clk_disable' now that clk_put is removed. Signed-off-by: Fabio Estevam <festevam@gmail.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-06-27mmc: mxs-mmc: Let device core handle pinctrlFabio Estevam
Since commit ab78029 (drivers/pinctrl: grab default handles from device core), we can rely on device core for handling pinctrl. So remove devm_pinctrl_get_select_default() from the driver. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-05-26mmc: remove unnecessary platform_set_drvdata()Jingoo Han
The driver core clears the driver data to NULL after device_release or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound). Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Sonic Zhang <sonic.zhang@analog.com> Acked-by: Seungwon Jeon <tgih.jun@samsung.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> Acked-by: Jaehoon Chung <jh80.chung@samsung.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Tony Prisk <linux@prisktech.co.nz> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-05-26mmc: mxs-mmc: fix error return code in mxs_mmc_probe()Wei Yongjun
Fix to return -ENODEV in the request dma error case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Reviewed-by: Marek Vasut <marex@denx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-05-07Merge tag 'dt-for-linus-2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC device tree updates (part 2) from Arnd Bergmann: "These are mostly new device tree bindings for existing drivers, as well as changes to the device tree source files to add support for those devices, and a couple of new boards, most notably Samsung's Exynos5 based Chromebook. The changes depend on earlier platform specific updates and touch the usual platforms: omap, exynos, tegra, mxs, mvebu and davinci." * tag 'dt-for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (169 commits) ARM: exynos: dts: cros5250: add EC device ARM: dts: Add sbs-battery for exynos5250-snow ARM: dts: Add i2c-arbitrator bus for exynos5250-snow ARM: dts: add mshc controller node for Exynos4x12 SoCs ARM: dts: Add chip-id controller node on Exynos4/5 SoC ARM: EXYNOS: Create virtual I/O mapping for Chip-ID controller using device tree ARM: davinci: da850-evm: add SPI flash support ARM: davinci: da850: override SPI DT node device name ARM: davinci: da850: add SPI1 DT node spi/davinci: add DT binding documentation spi/davinci: no wildcards in DT compatible property ARM: dts: mvebu: Convert mvebu device tree files to 64 bits ARM: dts: mvebu: introduce internal-regs node ARM: dts: mvebu: Convert all the mvebu files to use the range property ARM: dts: mvebu: move all peripherals inside soc ARM: dts: mvebu: fix cpus section indentation ARM: davinci: da850: add EHRPWM & ECAP DT node ARM/dts: OMAP3: fix pinctrl-single configuration ARM: dts: Add OMAP3430 SDP NOR flash memory binding ARM: dts: Add NOR flash bindings for OMAP2420 H4 ...
2013-04-12mmc: mxs-mmc: add broken-cd propertyHector Palacios
According to bindings documentation for mmc, the property 'broken-cd' can be used to indicate card-detection is not available and polling must be used instead. This patch retrieves this property and sets a custom flag. On the get_cd() hook, it returns 1 if the flag is set, to always assume the card is present. Signed-off-by: Hector Palacios <hector.palacios@digi.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-04-12mmc: mxs-mmc: add non-removable propertyMarc Kleine-Budde
Some boards have non removable cards like eMMC. Handle such case. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-04-12mmc: mxs-mmc: add cd-inverted propertyMarc Kleine-Budde
The card-detect GPIO is inverted on some boards. Handle such case. Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-04-04mmc: mxs-mmc: move to use generic DMA helperShawn Guo
With the generic DMA device tree helper supported by mxs-dma driver, client devices only need to call dma_request_slave_channel() for requesting a DMA channel from dmaengine. Since mxs is a DT only platform now, along with the changes, the non-DT case checking in probe function also gets cleaned up. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: Chris Ball <cjb@laptop.org> Cc: linux-mmc@vger.kernel.org Reviewed-by: Arnd Bergmann <arnd@arndb.de>
2013-02-26Merge tag 'mmc-updates-for-3.9-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc Pull MMC update from Chris Ball: "MMC highlights for 3.9: Core: - Support for packed commands in eMMC 4.5. (This requires a host capability to be turned on. It increases write throughput by 20%+, but may also increase average write latency; more testing needed.) - Add DT bindings for capability flags. - Add mmc_of_parse() for shared DT parsing between drivers. Drivers: - android-goldfish: New MMC driver for the Android Goldfish emulator. - mvsdio: Add DT bindings, pinctrl, use slot-gpio for card detection. - omap_hsmmc: Fix boot hangs with RPMB partitions. - sdhci-bcm2835: New driver for controller used by Raspberry Pi. - sdhci-esdhc-imx: Add 8-bit data, auto CMD23 support, use slot-gpio. - sh_mmcif: Add support for eMMC DDR, bundled MMCIF IRQs. - tmio_mmc: Add DT bindings, support for vccq regulator" * tag 'mmc-updates-for-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc: (92 commits) mmc: tegra: assume CONFIG_OF, remove platform data mmc: add DT bindings for more MMC capability flags mmc: tmio: add support for the VccQ regulator mmc: tmio: remove unused and deprecated symbols mmc: sh_mobile_sdhi: use managed resource allocations mmc: sh_mobile_sdhi: remove unused .pdata field mmc: tmio-mmc: parse device-tree bindings mmc: tmio-mmc: define device-tree bindings mmc: sh_mmcif: use mmc_of_parse() to parse standard MMC DT bindings mmc: (cosmetic) remove "extern" from function declarations mmc: provide a standard MMC device-tree binding parser centrally mmc: detailed definition of CD and WP MMC line polarities in DT mmc: sdhi, tmio: only check flags in tmio-mmc driver proper mmc: sdhci: Fix parameter of sdhci_do_start_signal_voltage_switch() mmc: sdhci: check voltage range only on regulators aware of voltage value mmc: bcm2835: set SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK mmc: support packed write command for eMMC4.5 devices mmc: add packed command feature of eMMC4.5 mmc: rtsx: remove driving adjustment mmc: use regulator_can_change_voltage() instead of regulator_count_voltages ...
2013-02-24mmc: mxs-mmc: Fix warning due to incorrect typeFabio Estevam
Fixes the following warning when building with W=1 option: drivers/mmc/host/mxs-mmc.c: In function 'mxs_mmc_adtc': drivers/mmc/host/mxs-mmc.c:401:2: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] The warning happens because 'i' is used in 'for_each_sg(sgl, sg, sg_len, i)' and should be made unsigned. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-02-24mmc: mxs-mmc: Add MODULE_ALIAS()Fabio Estevam
Add an entry for MODULE_ALIAS(). Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2013-01-25mmc: Convert to devm_ioremap_resource()Thierry Reding
Convert all uses of devm_request_and_ioremap() to the newly introduced devm_ioremap_resource() which provides more consistent error handling. devm_ioremap_resource() provides its own error messages so all explicit error messages can be removed from the failure code paths. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Cc: Chris Ball <cjb@laptop.org> Cc: Ben Dooks <ben-linux@fluff.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-12-06mmc: mxs-mmc: Remove platform dataFabio Estevam
All MXS users have been converted to device tree and the board files have been removed. No need to keep platform data in the driver. Also move bus_width declaration in the beggining of mxs_mmc_probe() to avoid: 'warning: ISO C90 forbids mixed declarations and code'. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Marek Vasut <marex@denx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-10-11mmc: mxs-mmc: Fix merge issue causing build errorMarek Vasut
The following error appeared due to a merge problem; the patches: fc108d24 "mmc: mxs-mmc: fix deadlock caused by recursion loop" 829c1bf4 "mmc: spi: Pull out parts shared between MMC and SPI" came in through separate branches and cause this build error when combined. drivers/mmc/host/mxs-mmc.c: In function 'mxs_mmc_enable_sdio_irq': drivers/mmc/host/mxs-mmc.c:527:3: error: 'struct mxs_mmc_host' has no member named 'base' drivers/mmc/host/mxs-mmc.c:527:3: error: 'struct mxs_mmc_host' has no member named 'devid' make[3]: *** [drivers/mmc/host/mxs-mmc.o] Error 1 This patch corrects the issue. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-09-25Merge tag 'v3.6-rc6' into spi-mxsMark Brown
Linux 3.6-rc6 Conflicts (overlap between moving code that accesses registers around and factoring the register access out into a SSP layer): drivers/mmc/host/mxs-mmc.c
2012-09-04mmc: mxs-mmc: fix deadlock caused by recursion loopLauri Hintsala
Release the lock before mmc_signal_sdio_irq is called by mxs_mmc_enable_sdio_irq. Backtrace: [ 65.470000] ============================================= [ 65.470000] [ INFO: possible recursive locking detected ] [ 65.470000] 3.5.0-rc5 #2 Not tainted [ 65.470000] --------------------------------------------- [ 65.470000] ksdioirqd/mmc0/73 is trying to acquire lock: [ 65.470000] (&(&host->lock)->rlock#2){-.-...}, at: [<bf054120>] mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc] [ 65.470000] [ 65.470000] but task is already holding lock: [ 65.470000] (&(&host->lock)->rlock#2){-.-...}, at: [<bf054120>] mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc] [ 65.470000] [ 65.470000] other info that might help us debug this: [ 65.470000] Possible unsafe locking scenario: [ 65.470000] [ 65.470000] CPU0 [ 65.470000] ---- [ 65.470000] lock(&(&host->lock)->rlock#2); [ 65.470000] lock(&(&host->lock)->rlock#2); [ 65.470000] [ 65.470000] *** DEADLOCK *** [ 65.470000] [ 65.470000] May be due to missing lock nesting notation [ 65.470000] [ 65.470000] 1 lock held by ksdioirqd/mmc0/73: [ 65.470000] #0: (&(&host->lock)->rlock#2){-.-...}, at: [<bf054120>] mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc] [ 65.470000] [ 65.470000] stack backtrace: [ 65.470000] [<c0014990>] (unwind_backtrace+0x0/0xf4) from [<c005ccb8>] (__lock_acquire+0x14f8/0x1b98) [ 65.470000] [<c005ccb8>] (__lock_acquire+0x14f8/0x1b98) from [<c005d3f8>] (lock_acquire+0xa0/0x108) [ 65.470000] [<c005d3f8>] (lock_acquire+0xa0/0x108) from [<c02f671c>] (_raw_spin_lock_irqsave+0x48/0x5c) [ 65.470000] [<c02f671c>] (_raw_spin_lock_irqsave+0x48/0x5c) from [<bf054120>] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) [ 65.470000] [<bf054120>] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) from [<bf0541d0>] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) [ 65.470000] [<bf0541d0>] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) from [<c0219b38>] (sdio_irq_thread+0x1bc/0x274) [ 65.470000] [<c0219b38>] (sdio_irq_thread+0x1bc/0x274) from [<c003c324>] (kthread+0x8c/0x98) [ 65.470000] [<c003c324>] (kthread+0x8c/0x98) from [<c00101ac>] (kernel_thread_exit+0x0/0x8) [ 65.470000] BUG: spinlock lockup suspected on CPU#0, ksdioirqd/mmc0/73 [ 65.470000] lock: 0xc3358724, .magic: dead4ead, .owner: ksdioirqd/mmc0/73, .owner_cpu: 0 [ 65.470000] [<c0014990>] (unwind_backtrace+0x0/0xf4) from [<c01b46b0>] (do_raw_spin_lock+0x100/0x144) [ 65.470000] [<c01b46b0>] (do_raw_spin_lock+0x100/0x144) from [<c02f6724>] (_raw_spin_lock_irqsave+0x50/0x5c) [ 65.470000] [<c02f6724>] (_raw_spin_lock_irqsave+0x50/0x5c) from [<bf054120>] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) [ 65.470000] [<bf054120>] (mxs_mmc_enable_sdio_irq+0x18/0xdc [mxs_mmc]) from [<bf0541d0>] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) [ 65.470000] [<bf0541d0>] (mxs_mmc_enable_sdio_irq+0xc8/0xdc [mxs_mmc]) from [<c0219b38>] (sdio_irq_thread+0x1bc/0x274) [ 65.470000] [<c0219b38>] (sdio_irq_thread+0x1bc/0x274) from [<c003c324>] (kthread+0x8c/0x98) [ 65.470000] [<c003c324>] (kthread+0x8c/0x98) from [<c00101ac>] (kernel_thread_exit+0x0/0x8) Reported-by: Attila Kinali <attila@kinali.ch> Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-09-04mmc: mxs-mmc: fix deadlock in SDIO IRQ caseLauri Hintsala
Release the lock before mmc_signal_sdio_irq is called by mxs_mmc_irq_handler. Backtrace: [ 79.660000] ============================================= [ 79.660000] [ INFO: possible recursive locking detected ] [ 79.660000] 3.4.0-00009-g3e96082-dirty #11 Not tainted [ 79.660000] --------------------------------------------- [ 79.660000] swapper/0 is trying to acquire lock: [ 79.660000] (&(&host->lock)->rlock#2){-.....}, at: [<c026ea3c>] mxs_mmc_enable_sdio_irq+0x18/0xd4 [ 79.660000] [ 79.660000] but task is already holding lock: [ 79.660000] (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8 [ 79.660000] [ 79.660000] other info that might help us debug this: [ 79.660000] Possible unsafe locking scenario: [ 79.660000] [ 79.660000] CPU0 [ 79.660000] ---- [ 79.660000] lock(&(&host->lock)->rlock#2); [ 79.660000] lock(&(&host->lock)->rlock#2); [ 79.660000] [ 79.660000] *** DEADLOCK *** [ 79.660000] [ 79.660000] May be due to missing lock nesting notation [ 79.660000] [ 79.660000] 1 lock held by swapper/0: [ 79.660000] #0: (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8 [ 79.660000] [ 79.660000] stack backtrace: [ 79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c005f9c0>] (__lock_acquire+0x1948/0x1d48) [ 79.660000] [<c005f9c0>] (__lock_acquire+0x1948/0x1d48) from [<c005fea0>] (lock_acquire+0xe0/0xf8) [ 79.660000] [<c005fea0>] (lock_acquire+0xe0/0xf8) from [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58) [ 79.660000] [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) [ 79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) [ 79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) [ 79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c) [ 79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110) [ 79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50) [ 79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84) [ 79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60) [ 79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40) [ 79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc) [ 79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8) [ 79.660000] BUG: spinlock lockup on CPU#0, swapper/0 [ 79.660000] lock: c398cb2c, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0 [ 79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144) [ 79.660000] [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144) from [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58) [ 79.660000] [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) [ 79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) [ 79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) [ 79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c) [ 79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110) [ 79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50) [ 79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84) [ 79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60) [ 79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40) [ 79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc) [ 79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8) Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-08-17mmc: spi: Pull out common DMA parts from MXS MMCMarek Vasut
These parts will be used by the MXS SPI driver too. Signed-off-by: Marek Vasut <marex@denx.de> Acked-by: Chris Ball <cjb@laptop.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-17mmc: spi: Pull out the SSP clock configuration functionMarek Vasut
Pull out the MMC clock configuration function and make it into SSP clock configuration function, so it can be used by the SPI driver too. Signed-off-by: Marek Vasut <marex@denx.de> Acked-by: Chris Ball <cjb@laptop.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-17mmc: spi: Pull out parts shared between MMC and SPIMarek Vasut
Abstract out the common part of private data shared between MMC and SPI. These shall later allow to use common clock configuration function. Signed-off-by: Marek Vasut <marex@denx.de> Acked-by: Chris Ball <cjb@laptop.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-17mmc: spi: Rename IMX2[38]_MMC to IMX2[38]_SSPMarek Vasut
Since the SSP controller can act as both SPI and MMC host, renaming the enum to properly reflect the naming seems appropriate. Based on previous attempt by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Marek Vasut <marex@denx.de> Acked-by: Chris Ball <cjb@laptop.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-17mmc: spi: Move SSP register definitions into separate fileMarek Vasut
Move the definitions into separate file so separate SPI driver can be implemented. The SSP controller in MXS can act both as a MMC host and as a SPI host. Based on previous attempt by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Marek Vasut <marex@denx.de> Acked-by: Chris Ball <cjb@laptop.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-22mmc: mxs-mmc: Add wp-inverted propertyMarek Vasut
The write-protect GPIO is inverted on some boards. Handle such case. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-07-22mmc: mxs-mmc: enable regulator for mmc slotShawn Guo
If bootloader or platform initialization code does not enable the power supply to mmc slot, we need to do it in mmc driver. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-06-06mmc: mxs-mmc: Move of_match_table out of CONFIG_PMMarek Vasut
Signed-off-by: Marek Vasut <marex@denx.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Chris Ball <cjb@laptop.org>
2012-05-13mmc: mxs-mmc: add device tree supportShawn Guo
It adds device tree probe support for mxs-mmc driver. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Chris Ball <cjb@laptop.org>
2012-05-13mmc: mxs-mmc: copy wp_gpio in struct mxs_mmc_hostShawn Guo
Copy wp_gpio from platform_data into struct mxs_mmc_host, so that the use of platform_data can be limited in probe function, which will ease the device tree probe. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Chris Ball <cjb@laptop.org>
2012-05-13mmc: mxs-mmc: have dma_channel than dma_res in mxs_mmc_hostShawn Guo
It replaces dma_res with dma_channel in struct mxs_mmc_host, so that the device tree support will be a little easier, since dma channel can not be retrieved from "struct resource *dma_res". Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Chris Ball <cjb@laptop.org>
2012-05-13mmc: mxs-mmc: use devm_* helper to make cleanup simplerShawn Guo
Use devm_request_and_ioremap and devm_request_irq helpers to clean up the code a little bit. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Chris Ball <cjb@laptop.org>
2012-05-13mmc: mxs-mmc: move header from mach into linux folderShawn Guo
Rename arch/arm/mach-mxs/include/mach/mmc.h to include/linux/mmc/mxs-mmc.h, so that mxs-mmc driver becomes <mach/*> inclusion free. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Chris Ball <cjb@laptop.org>