GitHub/moto-9609/android_kernel_motorola_exynos9610.git
9 years agommc: sdhci: switch voltage before sdhci_set_ios in runtime resume
Jisheng Zhang [Thu, 29 Jan 2015 09:42:12 +0000 (17:42 +0800)]
mmc: sdhci: switch voltage before sdhci_set_ios in runtime resume

I observed the Host Control2 register isn't correctly restored
after runtime resuming on BG2Q. For example, the register reads
as 0x800c before runtime suspend, but it's set as 0x8004 after runtime
resuming. This could results in a non working host.

The reason is the Host Control2 is incorrectly reset when switching
voltage. We fix this by following the same sequence during initialization.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tegra: Write xfer_mode, CMD regs in together
Pavan Kunapuli [Wed, 28 Jan 2015 16:45:16 +0000 (11:45 -0500)]
mmc: tegra: Write xfer_mode, CMD regs in together

If there is a gap between xfer mode and command register writes,
tegra SDMMC controller can sometimes issue a spurious command before
the CMD register is written. To avoid this, these two registers need
to be written together in a single write operation.

This is implemented as an NVQUIRK as it applies to T114, T124 and
T132.

Signed-off-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: Resolve BKOPS compatability issue
Alexey Skidanov [Thu, 29 Jan 2015 08:49:43 +0000 (10:49 +0200)]
mmc: Resolve BKOPS compatability issue

This patch is coming to fix compatibility issue of BKOPS_EN  field of EXT_CSD.
In eMMC-5.1, BKOPS_EN was changed, and now it has two operational bits:
Bit 0 - MANUAL_EN
Bit 1 - AUTO_EN
In previous eMMC revisions, only Bit 0 was supported.

Signed-off-by: Alexey Skidanov <alexey.skidanov@sandisk.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles
Jisheng Zhang [Wed, 28 Jan 2015 11:54:12 +0000 (19:54 +0800)]
mmc: sdhci-pxav3: fix setting of pdata->clk_delay_cycles

Current code checks "clk_delay_cycles > 0" to know whether the optional
"mrvl,clk_delay_cycles" is set or not. But of_property_read_u32() doesn't
touch clk_delay_cycles if the property is not set. And type of
clk_delay_cycles is u32, so we may always set pdata->clk_delay_cycles as a
random value.

This patch fix this problem by check the return value of of_property_read_u32()
to know whether the optional clk-delay-cycles is set or not.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Cc: <stable@vger.kernel.org> # v3.6+
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: rockchip: remove incorrect __exit_p()
Dmitry Torokhov [Sat, 24 Jan 2015 00:30:09 +0000 (16:30 -0800)]
mmc: dw_mmc: rockchip: remove incorrect __exit_p()

dw_mci_pltfm_remove() is not (nor should it be) marked as __exit,
so we should not be using __exit_p() wrapper with it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: exynos: remove incorrect __exit_p()
Dmitry Torokhov [Sat, 24 Jan 2015 00:33:40 +0000 (16:33 -0800)]
mmc: dw_mmc: exynos: remove incorrect __exit_p()

dw_mci_pltfm_remove() is not (nor should it be) marked as __exit,
so we should not be using __exit_p() wrapper with it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: Fix menuconfig alignment of MMC_SDHCI_* options
Jean Delvare [Mon, 26 Jan 2015 10:35:44 +0000 (11:35 +0100)]
mmc: Fix menuconfig alignment of MMC_SDHCI_* options

Let MMC_SDHCI_BIG_ENDIAN_32BIT_BYTE_SWAPPER depend on MMC_SDHCI. Not
only this is more correct, but this also avoids breaking the alignment
of all other MMC_SDHCI_* options in menuconfig.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Chris Ball <chris@printf.net>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Albert Herranz <albert_herranz@yahoo.es>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: Enable Ricoh MMC quirk by default
Jean Delvare [Mon, 26 Jan 2015 10:44:15 +0000 (11:44 +0100)]
mmc: Enable Ricoh MMC quirk by default

Config option MMC_RICOH_MMC's help text reads:

  If unsure, say Y.

However the option defaults to N. Set the default to Y to match the
recommendation in the help text.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Chris Ball <chris@printf.net>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Philipl Langdale <philipl@overt.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mmci: Get rid of dead code in mmci_dma_setup
Pramod Gurav [Wed, 21 Jan 2015 10:17:17 +0000 (15:47 +0530)]
mmc: mmci: Get rid of dead code in mmci_dma_setup

DMA configuration has been removed from function mmci_dma_setup but the
local mask variable was not removed. This remains unused hence remove
it from the function and operations on it

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: fix race between runtime pm and irq
Jisheng Zhang [Fri, 23 Jan 2015 10:08:21 +0000 (18:08 +0800)]
mmc: sdhci-pxav3: fix race between runtime pm and irq

This patch is to fix a race condition that may cause an unhandled irq,
which results in big sdhci interrupt numbers and endless "mmc1: got irq
while runtime suspended" msgs before v3.15.

Consider following scenario:

      CPU0                            CPU1
                              sdhci_pxav3_runtime_suspend()
                               spin_lock_irqsave(&host->lock, flags);
 sdhci_irq()
  spining on the &host->lock
                               host->runtime_suspended = true;
                               spin_unlock_irqrestore(&host->lock, flags);
  get the &host->lock
  runtime_suspended is true now
  return IRQ_NONE;

Fix this race by using the core sdhci.c supplied sdhci_runtime_suspend_host()
in runtime suspend hook which will disable card interrupts. We also use the
sdhci_runtime_resume_host() in the runtime resume hook accordingly.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Cc: <stable@vger.kernel.org> # v3.9+
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: block: Remove unnecessary temporary variable
Tobias Klauser [Wed, 21 Jan 2015 14:56:44 +0000 (15:56 +0100)]
mmc: block: Remove unnecessary temporary variable

Directly return the result of mmc_blk_alloc_req() instead of assigning
and returning the variable md.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: pwrseq_simple: Add support for a reset GPIO pin
Ulf Hansson [Mon, 15 Dec 2014 15:07:11 +0000 (16:07 +0100)]
mmc: pwrseq_simple: Add support for a reset GPIO pin

The need for reset GPIOs has several times been pointed out from
erlier posted patchsets. Especially some WLAN chips which are
attached to an SDIO interface may use a GPIO reset.

The reset GPIO is asserted at initialization and prior we start the
power up procedure. The GPIO will be de-asserted right after the power
has been provided to the card, from the ->post_power_on() callback.

Note, the reset GPIO is optional. Thus we don't return an error even if
we can't find a GPIO for the consumer.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
9 years agommc: pwrseq: Initial support for the simple MMC power sequence provider
Ulf Hansson [Fri, 5 Dec 2014 13:36:58 +0000 (14:36 +0100)]
mmc: pwrseq: Initial support for the simple MMC power sequence provider

To add the core part for the MMC power sequence, let's start by adding
initial support for the simple MMC power sequence provider.

In this initial step, the MMC power sequence node are fetched and the
compatible string for the simple MMC power sequence provider are
verified.

At this point we don't parse the node for any properties, but instead
that will be handled from following patches. Since there are no
properties supported yet, let's just implement the ->alloc() and the
->free() callbacks.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
9 years agommc: pwrseq: Document DT bindings for the simple MMC power sequence
Ulf Hansson [Mon, 8 Dec 2014 14:26:13 +0000 (15:26 +0100)]
mmc: pwrseq: Document DT bindings for the simple MMC power sequence

To support SOCs which specifies specific MMC power sequences, document
some MMC DT bindings to be able to describe these hardwares.

Let's also document bindings for a simple MMC power sequence provider,
which purpose is to support a set of common properties between various
SOCs.

In this initial step, let's also document a top level description of
the MMC power sequence and describe the compatible string used for the
simple MMC power sequence provider.

The simple MMC power sequence provider will initially support a reset
GPIO. From several earlier posted patches, it's clear that such
hardware exists. Especially some WLAN chips which are attached to an
SDIO interface may use a GPIO reset.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
9 years agommc: core: Initial support for MMC power sequences
Ulf Hansson [Fri, 28 Nov 2014 13:38:36 +0000 (14:38 +0100)]
mmc: core: Initial support for MMC power sequences

System on chip designs may specify a specific MMC power sequence. To
successfully detect an (e)MMC/SD/SDIO card, that power sequence must
be followed while initializing the card.

To be able to handle these SOC specific power sequences, let's add a
MMC power sequence interface. It provides the following functions to
help the mmc core to deal with these power sequences.

mmc_pwrseq_alloc() - Invoked from mmc_of_parse(), to initialize data.
mmc_pwrseq_pre_power_on()- Invoked in the beginning of mmc_power_up().
mmc_pwrseq_post_power_on()- Invoked at the end in mmc_power_up().
mmc_pwrseq_power_off()- Invoked from mmc_power_off().
mmc_pwrseq_free() - Invoked from mmc_free_host(), to free data.

Each MMC power sequence provider will be responsible to implement a set
of callbacks. These callbacks mirrors the functions above.

This patch adds the skeleton, following patches will extend the core of
the MMC power sequence and add support for a specific simple MMC power
sequence.

Do note, since the mmc_pwrseq_alloc() is invoked from mmc_of_parse(),
host drivers needs to make use of this API to enable the support for
MMC power sequences. Moreover the MMC power sequence support depends on
CONFIG_OF.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
9 years agommc: sdhci-pxav3: Remove checks for optional core clock in error/remove path
Jisheng Zhang [Mon, 5 Jan 2015 07:59:19 +0000 (15:59 +0800)]
mmc: sdhci-pxav3: Remove checks for optional core clock in error/remove path

Commit 63589e92c2d9 ("clk: Ignore error and NULL pointers passed to
clk_{unprepare, disable}()") allows NULL or error pointer to be passed
unconditionally.

This patch is to simplify probe error and remove code paths.

However, we reserve the core clock checks in runtime suspend/resume code
because we want a little smaller latency.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: rtsx: check sg_count before long data xfer
Micky Ching [Wed, 14 Jan 2015 03:09:12 +0000 (11:09 +0800)]
mmc: rtsx: check sg_count before long data xfer

Check sg_count before sending long data xfer.
Because dma_map_sg() return int, and sg_count may be negative,
so using int instead of unsigned.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: rtsx: finish request if no card exist
Micky Ching [Wed, 14 Jan 2015 03:09:11 +0000 (11:09 +0800)]
mmc: rtsx: finish request if no card exist

Return error-code directly if no card exist, this can
make card remove faster.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: host: fix odd_ptr_err.cocci warnings
Wu Fengguang [Wed, 21 Jan 2015 11:19:45 +0000 (19:19 +0800)]
mmc: sdhci: host: fix odd_ptr_err.cocci warnings

drivers/mmc/host/sdhci_f_sdh30.c:143:5-11: inconsistent IS_ERR and PTR_ERR, PTR_ERR on line 144

 PTR_ERR should access the value just tested by IS_ERR

Semantic patch information:
 There can be false positives in the patch case, where it is the call
 IS_ERR that is wrong.

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

CC: Vincent Yang <vincent.yang.fujitsu@gmail.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: vub300: remove unreachable return value handling
Nicholas Mc Guire [Sun, 18 Jan 2015 01:51:02 +0000 (02:51 +0100)]
mmc: vub300: remove unreachable return value handling

Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: block: fix format string warning
Asaf Vertz [Tue, 20 Jan 2015 16:33:35 +0000 (18:33 +0200)]
mmc: block: fix format string warning

Fixed the following warning (reported by cppcheck):
[drivers/mmc/card/block.c:2149]: (warning) %d in format string (no. 1)
requires 'int' but the argument type is 'unsigned int'.

Signed-off-by: Asaf Vertz <asaf.vertz@tandemg.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agoMerge branch 'tmio' into next
Ulf Hansson [Tue, 20 Jan 2015 09:44:08 +0000 (10:44 +0100)]
Merge branch 'tmio' into next

9 years agommc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag
Kuninori Morimoto [Tue, 13 Jan 2015 05:00:39 +0000 (05:00 +0000)]
mmc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag

tmio_mmc_host has .enable_dma callback now.
We don't need TMIO_MMC_HAVE_CTL_DMA_REG anymore.
Let's remove it

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mobile_sdhi: enable 32bit DMA access
Kuninori Morimoto [Tue, 13 Jan 2015 05:00:07 +0000 (05:00 +0000)]
mmc: sh_mobile_sdhi: enable 32bit DMA access

Now, sh_mobile_sdhi can use 32bit DMA access in R-Cer Gen2.
Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mobile_sdhi: use .enable_dma
Kuninori Morimoto [Tue, 13 Jan 2015 04:59:56 +0000 (04:59 +0000)]
mmc: sh_mobile_sdhi: use .enable_dma

tmio_mmc_dma has .enable_dma callback now.
let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi
Kuninori Morimoto [Tue, 13 Jan 2015 04:59:43 +0000 (04:59 +0000)]
mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi

getting struct sh_mobile_sdhi from struct mmc_host needs to use
complex container_of(). This patch adds new host_to_priv macro to
get it easily.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC
Kuninori Morimoto [Tue, 13 Jan 2015 04:59:33 +0000 (04:59 +0000)]
mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC

Latest SDHI on Renesas has expand register mapping.
update mmc_data->bus_shift for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mobile_sdhi: remove .init/.cleanup
Kuninori Morimoto [Tue, 13 Jan 2015 04:59:24 +0000 (04:59 +0000)]
mmc: sh_mobile_sdhi: remove .init/.cleanup

No one is using .init/.cleanup callback function.
Let's remove these.
sdhi_ops and .cd_wakeup are also removed

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: enable SoC specific DMA buswidth settings
Kuninori Morimoto [Tue, 13 Jan 2015 04:59:14 +0000 (04:59 +0000)]
mmc: tmio: enable SoC specific DMA buswidth settings

Renesas SDHI which is based on TMIO driver has 2 type SoC. 1st one is
used as SH-Mobile series, and 2nd is R-Car series. R-Car series SoC has
DMA buswidth setting register which enables 32bit access.
This patch adds .dma_buswidth and enables it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: add .enable_dma on tmio_mmc_dma
Kuninori Morimoto [Tue, 13 Jan 2015 04:59:05 +0000 (04:59 +0000)]
mmc: tmio: add .enable_dma on tmio_mmc_dma

Some controllers need DMA special register/setting.
This patch adds new .enable_dma callback for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: tmio_mmc_data has .dma_rx_offset
Kuninori Morimoto [Tue, 13 Jan 2015 04:58:56 +0000 (04:58 +0000)]
mmc: tmio: tmio_mmc_data has .dma_rx_offset

Current .dma_rx_offset is implemented under tmio_mmc_dma.
It goes to tmio_mmc_data by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: tmio_mmc_data has .alignment_shift
Kuninori Morimoto [Tue, 13 Jan 2015 04:58:46 +0000 (04:58 +0000)]
mmc: tmio: tmio_mmc_data has .alignment_shift

Current .alignment_shift is implemented under tmio_mmc_dma.
It goes to tmio_mmc_data by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: tmio_mmc_host has .bus_shift
Kuninori Morimoto [Tue, 13 Jan 2015 04:58:20 +0000 (04:58 +0000)]
mmc: tmio: tmio_mmc_host has .bus_shift

Current .bus_shift is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: tmio_mmc_host has .multi_io_quirk
Kuninori Morimoto [Tue, 13 Jan 2015 04:58:10 +0000 (04:58 +0000)]
mmc: tmio: tmio_mmc_host has .multi_io_quirk

Current .multi_io_quirk is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: tmio_mmc_host has .clk_disable
Kuninori Morimoto [Tue, 13 Jan 2015 04:58:01 +0000 (04:58 +0000)]
mmc: tmio: tmio_mmc_host has .clk_disable

Current .clk_disable is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: tmio_mmc_host has .clk_enable
Kuninori Morimoto [Tue, 13 Jan 2015 04:57:52 +0000 (04:57 +0000)]
mmc: tmio: tmio_mmc_host has .clk_enable

Current .clk_enable is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: tmio_mmc_host has .write16_hook
Kuninori Morimoto [Tue, 13 Jan 2015 04:57:42 +0000 (04:57 +0000)]
mmc: tmio: tmio_mmc_host has .write16_hook

Current .write16_hook is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: tmio_mmc_host has .dma
Kuninori Morimoto [Tue, 13 Jan 2015 04:57:33 +0000 (04:57 +0000)]
mmc: tmio: tmio_mmc_host has .dma

Current .dma is implemented under tmio_mmc_data.
It goes to tmio_mmc_host by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: tmio: add tmio_mmc_host_alloc/free()
Kuninori Morimoto [Tue, 13 Jan 2015 04:57:22 +0000 (04:57 +0000)]
mmc: tmio: add tmio_mmc_host_alloc/free()

Current tmio_mmc driver is using tmio_mmc_data for driver/platform
specific data/callback, and it is needed for tmio_mmc_host_probe()
function. Because of this style, include/linux/mfd/tmio.h header has
tmio driver/framework specific data which is not needed from platform.

This patch adds new tmio_mmc_host_alloc/free() as cleanup preparation.
tmio driver specific data/callback will be implemented in tmio_mmc_host,
and platform specific data/callback will be implemented in tmio_mmc_data
in this cleanup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: host: add new f_sdh30
Vincent Yang [Tue, 20 Jan 2015 08:05:18 +0000 (16:05 +0800)]
mmc: sdhci: host: add new f_sdh30

This patch adds new host controller driver for
Fujitsu SDHCI controller f_sdh30.

Signed-off-by: Vincent Yang <Vincent.Yang@tw.fujitsu.com>
Signed-off-by: Andy Green <andy.green@linaro.org>
Signed-off-by: Tetsuya Takinishi <t.takinishi@jp.fujitsu.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: add a quirk for single block transactions
Vincent Yang [Tue, 20 Jan 2015 08:05:17 +0000 (16:05 +0800)]
mmc: sdhci: add a quirk for single block transactions

This patch defines a quirk to disable the block count
for single block transactions.
It is a preparation and will be used by Fujitsu
SDHCI controller f_sdh30 driver.

Signed-off-by: Vincent Yang <Vincent.Yang@tw.fujitsu.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: add a quirk for tuning work around
Vincent Yang [Tue, 20 Jan 2015 08:05:16 +0000 (16:05 +0800)]
mmc: sdhci: add a quirk for tuning work around

This patch defines a quirk for tuning work
around for some sdhci host controller. It sets
both SDHCI_CTRL_EXEC_TUNING and SDHCI_CTRL_TUNED_CLK
for tuning.
It is a preparation and will be used by Fujitsu
SDHCI controller f_sdh30 driver.

Signed-off-by: Vincent Yang <Vincent.Yang@tw.fujitsu.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: add a voltage switch callback function
Vincent Yang [Tue, 20 Jan 2015 08:05:15 +0000 (16:05 +0800)]
mmc: sdhci: add a voltage switch callback function

This patch adds a callback function to do
controller-specific actions when switching voltages.
It is a preparation and will be used by Fujitsu
SDHCI controller f_sdh30 driver.

Signed-off-by: Vincent Yang <Vincent.Yang@tw.fujitsu.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: Power on vqmmc in MMC_POWER_ON, not MMC_POWER_UP
Doug Anderson [Tue, 13 Jan 2015 23:58:44 +0000 (15:58 -0800)]
mmc: dw_mmc: Power on vqmmc in MMC_POWER_ON, not MMC_POWER_UP

If we power up vqmmc in MMC_POWER_ON then we end up turning it on
before mmc_power_up() sets the signal voltage.  That's not so great
since we might be powering it up at the wrong voltage.

Note that this is how Yuvaraj originally coded things up in
<https://patchwork.kernel.org/patch/4401231/> but he changed it on my
suggestion.  Apparently I was wrong.

Reported-by: Alexandru M Stan <amstan@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: host: sdhci: Added a space before (
Mohammad Jamal [Tue, 13 Jan 2015 15:17:24 +0000 (20:47 +0530)]
mmc: host: sdhci: Added a space before (

This patch solves the coding style issue by adding a space
before (

Signed-off-by: Mohammad Jamal <md.jamalmohiuddin@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: fix pm unbalanced issue in -> remove()
Jisheng Zhang [Sun, 4 Jan 2015 15:15:48 +0000 (23:15 +0800)]
mmc: sdhci-pxav3: fix pm unbalanced issue in -> remove()

This patch calls pm_runtime_put_noidle() to restore the device's usage
counter in the ->remove() implementation.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: fix unbalanced clock issues during probe
Jisheng Zhang [Sun, 4 Jan 2015 15:15:47 +0000 (23:15 +0800)]
mmc: sdhci-pxav3: fix unbalanced clock issues during probe

Commit 0dcaa2499b7d ("sdhci-pxav3: Fix runtime PM initialization") tries
to fix one hang issue caused by calling sdhci_add_host() on a suspended
device. The fix enables the clock twice, once by clk_prepare_enable() and
another by pm_runtime_get_sync(), meaning that the clock will never be
gated at runtime PM suspend. I observed the power consumption regression on
Marvell BG2Q SoCs.

In fact, the fix is not correct. There still be a very small window
during which a runtime suspend might somehow occur after pm_runtime_enable()
but before pm_runtime_get_sync().

This patch fixes all of the two problems by just incrementing the usage
counter before pm_runtime_enable(). It also adjust the order of disabling
runtime pm and storing the usage count in the error path to handle clock
gating properly.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Cc: <stable@vger.kernel.org> # v3.11+
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Always init buf_ready_int
Adrian Hunter [Fri, 5 Dec 2014 17:41:10 +0000 (19:41 +0200)]
mmc: sdhci: Always init buf_ready_int

There is no point making the initialization
of buf_ready_int conditional on host version.
Simplify by just doing it always. Note that
the other conditional initializations will be
removed when the new way of doing re-tuning
is taken into use.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Move mmc_card_removed() into mmc_start_request()
Adrian Hunter [Fri, 5 Dec 2014 17:41:02 +0000 (19:41 +0200)]
mmc: core: Move mmc_card_removed() into mmc_start_request()

Both callers of mmc_start_request() call mmc_card_removed()
so move that call into mmc_start_request().

This patch is preparation for adding re-tuning support.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Simplify by adding mmc_execute_tuning()
Adrian Hunter [Fri, 5 Dec 2014 17:40:59 +0000 (19:40 +0200)]
mmc: core: Simplify by adding mmc_execute_tuning()

For each MMC, SD and SDIO there is code that
holds the clock, calls ops->execute_tuning, and
releases the clock. Simplify the code a bit by
providing a separate function to do that.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: use mmc_of_parse to parse common mmc configuration.
NeilBrown [Mon, 12 Jan 2015 19:23:18 +0000 (08:23 +1300)]
mmc: omap_hsmmc: use mmc_of_parse to parse common mmc configuration.

This ensures that all standard options are available to hsmmc,
In particular, I need cap-power-off-card.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: use slot-gpio library for gpio support.
NeilBrown [Mon, 12 Jan 2015 19:23:18 +0000 (08:23 +1300)]
mmc: omap_hsmmc: use slot-gpio library for gpio support.

Using the common code removes some code duplication, and
makes it easier to switch to using mmc_of_parse() which
will remove more duplication.

This uses the new mmc_gpio_request_cd_isr to provide a non-standard
interrupt service routine for card-detect interrupts.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: slot-gpio: Allow host driver to provide isr for card-detect interrupts
NeilBrown [Mon, 12 Jan 2015 19:23:18 +0000 (08:23 +1300)]
mmc: slot-gpio: Allow host driver to provide isr for card-detect interrupts

One of the reasons omap_hsmmc doesn't use the slot-gpio library
is that it has some non-standard functionality in the card-detect
interrupt service routine.

To make it possible for omap_hsmmc (and maybe others) to be converted
to use slot-gpio, add 'mmc_gpio_request_cd_isr' which provide an
alternate isr to be register by the slot-gpio code.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-acpi: fix copy'n'paste typos in the comments
Andy Shevchenko [Mon, 12 Jan 2015 17:37:25 +0000 (19:37 +0200)]
mmc: sdhci-acpi: fix copy'n'paste typos in the comments

Just fix the comments, no functional changes.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sd: add reset bus_ops callback
Johan Rudholm [Mon, 12 Jan 2015 14:38:06 +0000 (15:38 +0100)]
mmc: sd: add reset bus_ops callback

Enable power cycle and re-initialization of SD cards via the reset
bus_ops. Power cycling a buggy SD card sometimes helps it get back on
track.

Signed-off-by: Johan Rudholm <johanru@axis.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: refactor the hw_reset routines
Johan Rudholm [Mon, 12 Jan 2015 14:38:05 +0000 (15:38 +0100)]
mmc: core: refactor the hw_reset routines

Move the (e)MMC specific hw_reset code from core.c into mmc.c. Call the
code from the new bus_ops member "reset". This also allows for adding
a SD card specific reset procedure.

Signed-off-by: Johan Rudholm <johanru@axis.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: always check status after reset
Johan Rudholm [Mon, 12 Jan 2015 14:38:04 +0000 (15:38 +0100)]
mmc: core: always check status after reset

Always check if the card is alive after a successful reset. This allows
us to remove mmc_hw_reset_check(), leaving mmc_hw_reset() as the only
card reset interface.

Signed-off-by: Johan Rudholm <johanru@axis.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: Add SDIO function devicetree subnode parsing
Sascha Hauer [Mon, 30 Jun 2014 09:07:25 +0000 (11:07 +0200)]
mmc: Add SDIO function devicetree subnode parsing

This adds SDIO devicetree subnode parsing to the mmc core. While
SDIO devices are runtime probable they sometimes need nonprobable
additional information on embedded systems, like an additional gpio
interrupt or a clock. This patch makes it possible to supply this
information from the devicetree. SDIO drivers will find a pointer
to the devicenode in their devices of_node pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
[hdegoede@redhat.com: Misc. cleanups]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: Add SDIO function subnode DT documentation
Sascha Hauer [Mon, 30 Jun 2014 09:07:24 +0000 (11:07 +0200)]
mmc: Add SDIO function subnode DT documentation

While SDIO devices are runtime probable they sometimes need nonprobable
additional information on embedded systems, like an additional gpio
interrupt or a clock. This binding describes how to add child nodes to the
devicetree to supply this information.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
[hdegoede@redhat.com: Documented the need for #address- and #size-cells]
[hdegoede@redhat.com: Added a real world example]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-acpi: Remove redundant runtime PM idle callback
Ulf Hansson [Fri, 2 Jan 2015 13:47:00 +0000 (14:47 +0100)]
mmc: sdhci-acpi: Remove redundant runtime PM idle callback

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: use pipeline mmc requests to improve performance
Haibo Chen [Tue, 9 Dec 2014 09:04:05 +0000 (17:04 +0800)]
mmc: sdhci: use pipeline mmc requests to improve performance

This patch is based on the patches by Per Forlin, Tony Lin and Ryan QIAN.

This patch complete the API 'post_req' and 'pre_req' in sdhci host side,

Test Env:
1. i.MX6Q-SABREAUTO board, CPU @ 996MHz, use ADMA in uSDHC controller.
2. Test command:
$ echo 1 > /proc/sys/vm/drop_caches
write to sd card:
$ dd if=/dev/zero of=/dev/mmcblk0 bs=1M count=2000 conv=fsync
read the sd card:
$ dd if=/dev/mmcblk0 of=/dev/null bs=1M count=2000

3. TOSHIBA 16GB SD3.0 card, running at 4 bit, SDR104 @ 198MHZ
Performance with and without this patch:
      -------------------------------------------------
  |                    | read speed | write speed |
  |------------------------------------------------
  | with this patch    | ~76.7 MB/s |  ~23.3 MB/s |
  |------------------------------------------------
  |without this patch  | ~60.5 MB/s |  ~22.5 MB/s |
  -------------------------------------------------

4. SanDisk 8GB SD3.0 card, running at 4 bit, DDR50 @ 50MHZ
Performance with and without this patch:
      -------------------------------------------------
  |                    | read speed | write speed |
  |------------------------------------------------
  | with this patch    | ~40.5 MB/s |  ~15.6 MB/s |
  |------------------------------------------------
  |without this patch  | ~36.1 MB/s |  ~14.1 MB/s |
  -------------------------------------------------

5. Kingston 8GB SD2.0 card, running at 4 bit, High-speed @ 50MHZ
Performance with and without this patch:
      -------------------------------------------------
  |                    | read speed | write speed |
  |------------------------------------------------
  | with this patch    | ~22.7 MB/s |  ~8.2 MB/s  |
  |------------------------------------------------
  |without this patch  | ~21.3 MB/s |  ~8.0 MB/s  |
  -------------------------------------------------

6. About eMMC, Sandisk 8GB eMMC on i.MX6DL-sabresd board, CPU @ 792MHZ,
   eMMC running at 8 bit, DDR52 @ 52MHZ.
Performance with and without this patch:
      -------------------------------------------------
  |                    | read speed | write speed |
  |------------------------------------------------
  | with this patch    | ~37.3 MB/s |  ~10.5 MB/s |
  |------------------------------------------------
  |without this patch  | ~33.4 MB/s |  ~10.5 MB/s |
  -------------------------------------------------

Signed-off-by: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Remove redundant ADMA page boundary warnings
Andrew Gabbasov [Mon, 22 Dec 2014 12:23:21 +0000 (06:23 -0600)]
mmc: sdhci: Remove redundant ADMA page boundary warnings

The bounce buffer, used for misaligned bytes for ADMA access,
resides wholly within the (align_sz)-aligned word, just by construction.
The page addresses are aligned to (align_sz), either for 4 or 8 bytes
alignment, so that the aligned word resides wholly within a single page
and can't cross the page boundary. So, the bounce buffer can't cross
the page boundary too. That's why the warnings are never hit, and can
be safely removed.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Make tuning block patterns static
Ulf Hansson [Mon, 1 Dec 2014 15:53:34 +0000 (16:53 +0100)]
mmc: core: Make tuning block patterns static

Since previous patches removed the need for the tuning block patterns
to be exported, let's move them close to the mmc_send_tuning() API.

Those are now intended to be used only by the mmc core.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
9 years agommc: dw_mmc: Convert to mmc_send_tuning()
Ulf Hansson [Mon, 1 Dec 2014 15:13:39 +0000 (16:13 +0100)]
mmc: dw_mmc: Convert to mmc_send_tuning()

Instead of having a local hack taking care of sending the tuning
command and as well to verify the response pattern, let's convert to
the common mmc_send_tuning() API.

This change affects the Exynos variant, since it's the only one which
support the dw_mmc's ->execute_tuning() callback.

It's seems like dw_mmc internal logic expects failed data transfers to
be ended using a stop command. Let the tuning requests also fall into
this category, since there are data transfer involved.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Tested-by: Alim Akhtar <alim.akhtar@samsung.com>
9 years agommc: mmci: Do pm_runtime_put() after the host has been added
Ulf Hansson [Thu, 11 Dec 2014 13:35:55 +0000 (14:35 +0100)]
mmc: mmci: Do pm_runtime_put() after the host has been added

Previously the pm_runtime_put() caused the device to be runtime PM
suspended, but then immediately being resumed when we add the host.

Prevent this unnecessary runtime PM suspend/resume cycle during
->probe() by moving the call to pm_runtime_put() after mmc_add_host().

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pci: Remove redundant runtime PM idle callback
Ulf Hansson [Wed, 10 Dec 2014 15:49:23 +0000 (16:49 +0100)]
mmc: sdhci-pci: Remove redundant runtime PM idle callback

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: Fixup runtime PM conditions during ->probe()
Ulf Hansson [Thu, 11 Dec 2014 14:12:25 +0000 (15:12 +0100)]
mmc: sdhci-esdhc-imx: Fixup runtime PM conditions during ->probe()

By configure runtime PM prior we enable the use of it, we close the gap
for strange and unhandled conditions. Moreover it makes us rely on the
driver core, after finalized ->probe(), to request an inactive device
to become runtime PM idle/suspended, which earlier potentially could
happen already at pm_runtime_set_autosuspend_delay().

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: Fixup ->remove()
Ulf Hansson [Thu, 11 Dec 2014 13:56:15 +0000 (14:56 +0100)]
mmc: sdhci-esdhc-imx: Fixup ->remove()

Since sdhci_remove_host() access the device, we need to make sure it's
runtime PM resumed.

To handle clock gating properly in remove, we first have to make sure
the clocks are ungated.

To fix both these issues, by invoking pm_runtime_get_sync() early in
->remove() callback. Later once we disabled runtime PM, we can restore
the usage count.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mvsdio: don't use devm_pinctrl_get_select_default() in probe
Wolfram Sang [Mon, 22 Dec 2014 22:16:54 +0000 (23:16 +0100)]
mmc: mvsdio: don't use devm_pinctrl_get_select_default() in probe

Since commit ab78029ecc34 (drivers/pinctrl: grab default handles from device
core), we can rely on device core for setting the default pins.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: remove unnecessary debug message
Beomho Seo [Tue, 23 Dec 2014 12:07:33 +0000 (21:07 +0900)]
mmc: dw_mmc: remove unnecessary debug message

This patch remove unnecessary 'out of memory' message on dw mmc driver.

Signed-off-by: Beomho Seo <beomho.seo@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: rtsx: swap function position to avoid pre declaration
Micky Ching [Tue, 23 Dec 2014 01:19:46 +0000 (09:19 +0800)]
mmc: rtsx: swap function position to avoid pre declaration

move function sd_read_data()/sd_write_data() behind
sd_send_cmd_get_rsp() to avoid pre-declaration.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: rtsx: add support for sdio card
Micky Ching [Tue, 23 Dec 2014 01:19:45 +0000 (09:19 +0800)]
mmc: rtsx: add support for sdio card

Modify transfer mode for support sdio card,
send cmd and data at the same time for read data transfer,
but send data after cmd for write data transfer.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: rtsx: add helper function to simplify code
Micky Ching [Tue, 23 Dec 2014 01:19:44 +0000 (09:19 +0800)]
mmc: rtsx: add helper function to simplify code

To support sdio card, transfer mode need make a change,
this need to split code and use it in different place,
Add new function to simplify repeat operation.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: rtsx: init cookie at probe/card_event
Micky Ching [Tue, 23 Dec 2014 01:19:43 +0000 (09:19 +0800)]
mmc: rtsx: init cookie at probe/card_event

host->cookie is used for handle async request,
we should init it to negative value when new card inserted,
make cookie value invalid.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: rtsx: add dump_reg_range to simplify dump register
Micky Ching [Tue, 23 Dec 2014 01:19:42 +0000 (09:19 +0800)]
mmc: rtsx: add dump_reg_range to simplify dump register

Add a new function to dump register within a range.
We print 1 register a line before this patch,
this may make debug info too long when we add more register to dump.

The new dump_reg_range() dump to 8 register a line,
and it is easy to use.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: slot-gpio: Rework how to handle allocation of slot-gpio data
Ulf Hansson [Thu, 18 Dec 2014 14:44:36 +0000 (15:44 +0100)]
mmc: slot-gpio: Rework how to handle allocation of slot-gpio data

By moving the allocation of the slot-gpio data into mmc_alloc_host(),
we can remove the slot-gpio internal calls to mmc_gpio_alloc().

This means mmc_gpio_alloc() has now only one caller left, which
consequence allow us to simplify and remove some of the slot-gpio code.

Additionally, this makes the slot-gpio mutex redundant, so let's remove
it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Free all resources for the class device at ->dev_release()
Ulf Hansson [Thu, 18 Dec 2014 14:44:35 +0000 (15:44 +0100)]
mmc: core: Free all resources for the class device at ->dev_release()

To be consistent when freeing data, let's move the idr_remove() call
from mmc_free_host() into the ->dev_release() callback for the class
device.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: slot-gpio: Make mmc_gpio_alloc() available for MMC core
Ulf Hansson [Thu, 18 Dec 2014 14:44:34 +0000 (15:44 +0100)]
mmc: slot-gpio: Make mmc_gpio_alloc() available for MMC core

As a step in moving slot-gpio functions/structs closer to the MMC core,
let's add a local header file for slot-gpio.

In this initial step we move mmc_gpio_alloc() into the header file,
to make it available for the MMC core. Following patches will show the
utilization of it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: slot-gpio: Use the parent device while allocating data
Ulf Hansson [Thu, 18 Dec 2014 14:44:33 +0000 (15:44 +0100)]
mmc: slot-gpio: Use the parent device while allocating data

We had a mix of using the class device and the parent device while
allocating data through the devm_* managed functions.

Let's be more consistent and always use the parent device.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: slot-gpio: Remove option to explicitly free requested CD/WP GPIOs
Ulf Hansson [Thu, 18 Dec 2014 14:44:32 +0000 (15:44 +0100)]
mmc: slot-gpio: Remove option to explicitly free requested CD/WP GPIOs

The slot-gpio uses the devm*_ managed functions. Still it provide APIs
to explicitly free requested CD/WP GPIOs, but these API isn't being
used.

Therefore let's simplify slot-gpio by removing these unused APIs. If it
later turns out we need some of them, we can always consider to restore
the code.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-sirf: Remove redundant use of mmc_gpio_free_cd()
Ulf Hansson [Thu, 18 Dec 2014 14:44:31 +0000 (15:44 +0100)]
mmc: sdhci-sirf: Remove redundant use of mmc_gpio_free_cd()

The MMC core makes use of the devm_* functions while requesting the
CD/WP GPIOs, let's rely on that.

Cc: Barry Song <baohua@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mvsdio: Remove redundant use of mmc_gpio_free_cd|ro()
Ulf Hansson [Thu, 18 Dec 2014 14:44:30 +0000 (15:44 +0100)]
mmc: mvsdio: Remove redundant use of mmc_gpio_free_cd|ro()

The MMC core makes use of the devm_* functions while requesting the
CD/WP GPIOs, let's rely on that.

Cc: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Return error at failure of request CD/WP in mmc_of_parse()
Ulf Hansson [Thu, 18 Dec 2014 09:41:44 +0000 (10:41 +0100)]
mmc: core: Return error at failure of request CD/WP in mmc_of_parse()

Instead of just printing an error when mmc_of_parse() fails to request
CD/WP GPIO pins, let's propagate all errors, except for -ENOENT.
Earlier only -EPROBE_DEFER was handled correctly.

As a side effect of this change and by relying on host drivers to
handle the errors during ->probe(), we don't need to free any data in
the error path.

This also means we are actually fixing a bug, since we remove the call
to mmc_gpio_free_cd() which wasn't the correct function to invoke to
handle cleanup. Instead that should have been mmc_gpiod_free_cd().

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-st: Do cleanup while mmc_of_parse() return an error
Ulf Hansson [Thu, 18 Dec 2014 09:41:43 +0000 (10:41 +0100)]
mmc: sdhci-st: Do cleanup while mmc_of_parse() return an error

At errors, balance sdhci_pltfm_init() with sdhci_pltfm_free(), to make
sure all data is freed properly.

Cc: Srinivas Kandagatla <srinivas.kandagatla@gmail.com>
Cc: Maxime Coquelin <maxime.coquelin@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Maxime Coquelin <maxime.coquelin@st.com>
9 years agommc: sdhci-s3c: Handle error from mmc_of_parse()
Ulf Hansson [Thu, 18 Dec 2014 09:41:42 +0000 (10:41 +0100)]
mmc: sdhci-s3c: Handle error from mmc_of_parse()

Since mmc_of_parse() may fail, let's deal with it and thus do proper
error handling.

Cc: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
9 years agommc: sdhci-of-esdhc: Handle error from mmc_of_parse()
Ulf Hansson [Thu, 18 Dec 2014 09:41:41 +0000 (10:41 +0100)]
mmc: sdhci-of-esdhc: Handle error from mmc_of_parse()

Since mmc_of_parse() may fail, let's deal with it and thus do proper
error handling.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-bcm-kona: Handle error from mmc_of_parse()
Ulf Hansson [Thu, 18 Dec 2014 09:41:40 +0000 (10:41 +0100)]
mmc: sdhci-bcm-kona: Handle error from mmc_of_parse()

Since mmc_of_parse() may fail, let's deal with it and thus do proper
error handling.

Cc: Christian Daudt <bcm@fixthebug.org>
Cc: Matt Porter <mporter@linaro.org>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
9 years agommc: moxart: Handle error from mmc_of_parse()
Ulf Hansson [Thu, 18 Dec 2014 09:41:39 +0000 (10:41 +0100)]
mmc: moxart: Handle error from mmc_of_parse()

Since mmc_of_parse() may fail, let's deal with it and thus do proper
error handling.

Cc: Jonas Jensen <jonas.jensen@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: exynos: move definitions to header file
Seungwon Jeon [Mon, 22 Dec 2014 12:12:04 +0000 (17:42 +0530)]
mmc: dw_mmc: exynos: move definitions to header file

Move exynos related definition to header file. And this
also changes some of the registers name to match the standard
naming convention.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
[Alim: updated the commit message]
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: exynos: don't use if clock isn't available
Seungwon Jeon [Mon, 22 Dec 2014 12:12:03 +0000 (17:42 +0530)]
mmc: dw_mmc: exynos: don't use if clock isn't available

Add checking whether the clock is valid.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: fix the max_blk_count in IDMAC
Seungwon Jeon [Mon, 22 Dec 2014 12:12:02 +0000 (17:42 +0530)]
mmc: dw_mmc: fix the max_blk_count in IDMAC

Even though 1MB is reserved for descriptor table in IDMAC,
the dw_mmc host driver is allowed to receive only maximum
128KB block length in one request. This is caused by setting
improper max_blk_count. It needs to be e adjusted so that
descriptor table is used fully. It is found that the performance
is improved with the increased the max_blk_count.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mxs-mmc: remove unneeded NULL check
Dan Carpenter [Tue, 16 Dec 2014 23:57:50 +0000 (02:57 +0300)]
mmc: mxs-mmc: remove unneeded NULL check

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>
9 years agommc: sunxi: Removing unused code
David Lanzendörfer [Tue, 16 Dec 2014 14:11:15 +0000 (15:11 +0100)]
mmc: sunxi: Removing unused code

Removing a relict from reverse engineering of the Android driver code
in sunxi_mmc_clk_set_rate.

Signed-off-by: David Lanzendörfer <david.lanzendoerfer@o2s.ch>
Reported-by: <lixiang@allwinnertech.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sunxi: Correcting SDXC_HARDWARE_RESET bit
David Lanzendörfer [Tue, 16 Dec 2014 14:11:10 +0000 (15:11 +0100)]
mmc: sunxi: Correcting SDXC_HARDWARE_RESET bit

Fixing the register name in sunxi_mmc_reset_host since the
SDXC_HARDWARE_RESET bit is actually located within REG_GCTRL and not
REG_CMDR as it was pointed out by Allwinner.

Signed-off-by: David Lanzendörfer <david.lanzendoerfer@o2s.ch>
Reported-by: <lixiang@allwinnertech.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sunxi: Lock fix
David Lanzendörfer [Tue, 16 Dec 2014 14:11:04 +0000 (15:11 +0100)]
mmc: sunxi: Lock fix

1) Adding a comment in order to clarify the choice of the locks within
sunxi_mmc_handle_manual_stop

2) As <lixiang@allwinnertech.com> has pointed out the wait_dma variable
was not accessed within the spin lock block in sunxi_mmc_request and so
(even if it should never happend) it would have theoretically been
possible that some other function would access the variable at the same
time as the function. This has been changed now and the function is
using local variables outside the lock and copys the value over during
the lock phase.

Signed-off-by: David Lanzendörfer <david.lanzendoerfer@o2s.ch>
Reported-by: <lixiang@allwinnertech.com>
Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sunxi: Fix setup of last descriptor of dma transfer
Hans de Goede [Tue, 16 Dec 2014 14:10:59 +0000 (15:10 +0100)]
mmc: sunxi: Fix setup of last descriptor of dma transfer

The last descriptor might be the first descriptor as well, so use masking to
add the LD (last descriptor) bit and drop the DIC (disable interrupt on
completion) bit rather then hard assignment as hard assignment will override
the FD (first descriptor) bit if there is only 1 descriptor.

Also set the ER (end of ring) bit and clear buf_addr_ptr2 on the last
descriptor, like the android kernel code does.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: David Lanzendörfer <david.lanzendoerfer@o2s.ch>
Reported-by: <lixiang@allwinnertech.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: remove prepare/complete system suspend support.
NeilBrown [Thu, 11 Dec 2014 21:43:08 +0000 (08:43 +1100)]
mmc: omap_hsmmc: remove prepare/complete system suspend support.

The only function of these 'prepare' and 'complete' is to
disable the 'card detect' irq during suspend.

The commit which added this,
commit a48ce884d5819d5df2cf1139ab3c43f8e9e419b3
    mmc: omap_hsmmc: Introduce omap_hsmmc_prepare/complete

justified it by the need to avoid the registration of new devices
during suspend.
However mmc_pm_notify will set ->rescan_disable in the 'prepare'
stage and clear it in the 'complete' stage, so no card detection
will actually happen.
Also the interrupt will be disabled before final suspend as part
of common suspend processing.

So this disabling of the interrupt is unnecessary, and interferes
with a transition to using common code for card-detect management.

Cc: Felipe Balbi <balbi@ti.com>
Cc: Venkatraman S <svenkatr@ti.com>
Cc: Chris Ball <cjb@laptop.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: toshsd: Fix unbalanced locking
Axel Lin [Thu, 11 Dec 2014 03:10:44 +0000 (11:10 +0800)]
mmc: toshsd: Fix unbalanced locking

Fix returning IRQ_HANDLED with spin_lock held.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: toshsd: use module_pci_driver to simplify the code
Wei Yongjun [Tue, 9 Dec 2014 01:08:05 +0000 (09:08 +0800)]
mmc: toshsd: use module_pci_driver to simplify the code

Use the module_pci_driver() macro to make the code simpler
by eliminating module_init and module_exit calls.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Fix FSL ESDHC reset handling quirk
Alessio Igor Bogani [Tue, 9 Dec 2014 08:40:38 +0000 (09:40 +0100)]
mmc: sdhci: Fix FSL ESDHC reset handling quirk

The commit 0718e59ae259 ("mmc: sdhci: move FSL ESDHC reset handling quirk into
esdhc code") states that Freescale esdhc is the only controller which needs
the interrupt registers restored after a reset. So it moves
SDHCI_QUIRK_RESTORE_IRQS_AFTER_RESET quirk handling code into the
esdhc-imx driver only. Unfortunately the same controller is used in
other boards which use the of-esdhc driver instead (like powerpc P2020).

Restore interrupts after reset in the sdhci-of-esdhc driver also.

Signed-off-by: Alessio Igor Bogani <alessio.bogani@elettra.eu>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>