]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
9 years agommc: mediatek: Add PM support for MMC driver
Chaotian Jing [Mon, 15 Jun 2015 11:20:49 +0000 (19:20 +0800)]
mmc: mediatek: Add PM support for MMC driver

Add PM support for Mediatek MMC driver
Save/restore registers when PM

Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mediatek: Add Mediatek MMC driver
Chaotian Jing [Mon, 15 Jun 2015 11:20:48 +0000 (19:20 +0800)]
mmc: mediatek: Add Mediatek MMC driver

Add Mediatek MMC driver code
Support eMMC/SD/SDIO

Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dt-bindings: add Mediatek MMC bindings
Chaotian Jing [Mon, 15 Jun 2015 11:20:47 +0000 (19:20 +0800)]
mmc: dt-bindings: add Mediatek MMC bindings

Document the device-tree binding of Mediatek MMC host

Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: card: Fixup request missing in mmc_blk_issue_rw_rq
Ding Wang [Mon, 18 May 2015 12:14:15 +0000 (20:14 +0800)]
mmc: card: Fixup request missing in mmc_blk_issue_rw_rq

The current handler of MMC_BLK_CMD_ERR in mmc_blk_issue_rw_rq function
may cause new coming request permanent missing when the ongoing
request (previoulsy started) complete end.

The problem scenario is as follows:
(1) Request A is ongoing;
(2) Request B arrived, and finally mmc_blk_issue_rw_rq() is called;
(3) Request A encounters the MMC_BLK_CMD_ERR error;
(4) In the error handling of MMC_BLK_CMD_ERR, suppose mmc_blk_cmd_err()
    end request A completed and return zero. Continue the error handling,
    suppose mmc_blk_reset() reset device success;
(5) Continue the execution, while loop completed because variable ret
    is zero now;
(6) Finally, mmc_blk_issue_rw_rq() return without processing request B.

The process related to the missing request may wait that IO request
complete forever, possibly crashing the application or hanging the system.

Fix this issue by starting new request when reset success.

Signed-off-by: Ding Wang <justin.wang@spreadtrum.com>
Fixes: 67716327eec7 ("mmc: block: add eMMC hardware reset support")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: fix low memory corruption
Jiri Slaby [Fri, 12 Jun 2015 09:45:02 +0000 (11:45 +0200)]
mmc: sdhci: fix low memory corruption

When dma mapping (dma_map_sg) fails in sdhci_pre_dma_transfer, -EINVAL
is returned. There are 3 callers of sdhci_pre_dma_transfer:
* sdhci_pre_req and sdhci_adma_table_pre: handle negative return
* sdhci_prepare_data: handles 0 (error) and "else" (good) only

sdhci_prepare_data is therefore broken. When it receives -EINVAL from
sdhci_pre_dma_transfer, it assumes 1 sg mapping was mapped. Later,
this non-existent mapping with address 0 is kmap'ped and written to:
Corrupted low memory at ffff880000001000 (1000 phys) = 22b7d67df2f6d1cf
Corrupted low memory at ffff880000001008 (1008 phys) = 63848a5216b7dd95
Corrupted low memory at ffff880000001010 (1010 phys) = 330eb7ddef39e427
Corrupted low memory at ffff880000001018 (1018 phys) = 8017ac7295039bda
Corrupted low memory at ffff880000001020 (1020 phys) = 8ce039eac119074f
...

So teach sdhci_prepare_data to understand negative return values from
sdhci_pre_dma_transfer and disable DMA in that case, as well as for
zero.

It was introduced in 348487cb28e66b032bae1b38424d81bf5b444408 (mmc:
sdhci: use pipeline mmc requests to improve performance). The commit
seems to be suspicious also by assigning host->sg_count both in
sdhci_pre_dma_transfer and sdhci_adma_table_pre.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: stable@vger.kernel.org # 4.0+
Fixes: 348487cb28e6
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Haibo Chen <haibo.chen@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pci: Change AMD SDHCI quirk application scope
Vincent Wan [Thu, 11 Jun 2015 12:11:47 +0000 (20:11 +0800)]
mmc: sdhci-pci: Change AMD SDHCI quirk application scope

Change this quirk to apply to AMD Carrizo platform.

Signed-off-by: Wan ZongShun <Vincent.Wan@amd.com>
Tested-by: Nath, Arindam <Arindam.Nath@amd.com>
Tested-by: Ramesh, Ramya <Ramya.Ramesh@amd.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agoi2c-piix4: Use Macro for AMD CZ SMBus device ID
Vincent Wan [Thu, 11 Jun 2015 12:11:46 +0000 (20:11 +0800)]
i2c-piix4: Use Macro for AMD CZ SMBus device ID

Change AMD CZ SMBUS device ID from 0x790b to
use Macro definition

Signed-off-by: Wan ZongShun <Vincent.Wan@amd.com>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agopci_ids: Add AMD KERNCZ device ID support
Vincent Wan [Thu, 11 Jun 2015 12:11:45 +0000 (20:11 +0800)]
pci_ids: Add AMD KERNCZ device ID support

The KERNCZ is new AMD SB/FCH generation name, like HUDSON2.
0x790b is the device ID for this generation.

Signed-off-by: Wan ZongShun <Vincent.Wan@amd.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: queue: use swap() in mmc_queue_thread()
Fabian Frederick [Wed, 10 Jun 2015 16:30:53 +0000 (18:30 +0200)]
mmc: queue: use swap() in mmc_queue_thread()

Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: insmod followed by rmmod will hung for eMMC
Prabu Thangamuthu [Thu, 28 May 2015 12:21:06 +0000 (12:21 +0000)]
mmc: dw_mmc: insmod followed by rmmod will hung for eMMC

Remove module of dw_mmc driver will hung for eMMC devices if we follow the
steps which are listed below,
insmod dw_mmc.ko
insmod dw_mmc-pci.ko
rmmod dw_mmc-pci.ko

The root cause for this issue is, dw_mci_remove() will disable all the
interrupts by programming 0x0 to INTMASK register then it will call
dw_mci_cleanup_slot(). But dw_mci_cleanup_slot() is issuing CMD6 to
disable the eMMC boot partition and it is waiting for Command Complete
interrupt. Since INTMASK was already cleared by dw_mci_remove(), Command
Complete interrupt is not reaching the system. This leads to process hung.

Signed-off-by: Prabu Thangamuthu <prabu.t@synopsys.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Restore behavior while creating OCR mask
Ulf Hansson [Fri, 5 Jun 2015 09:40:08 +0000 (11:40 +0200)]
mmc: sdhci: Restore behavior while creating OCR mask

Commit 3a48edc4bd68 ("mmc: sdhci: Use mmc core regulator infrastucture")
changed the behavior for how to assign the ocr_avail mask for the mmc
host. More precisely it started to mask the bits instead of assigning
them.

Restore the behavior, but also make it clear that an OCR mask created
from an external regulator overrides the other ones. The OCR mask is
determined by one of the following with this priority:

1. Supported ranges of external regulator if one supplies VDD
2. Host OCR mask if set by the driver (based on DT properties)
3. The capabilities reported by the controller itself

Fixes: 3a48edc4bd68 ("mmc: sdhci: Use mmc core regulator infrastucture")
Cc: Tim Kryger <tim.kryger@gmail.com>
Reported-by: Yangbo Lu <yangbo.lu@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@gmail.com>
9 years agommc: sdhci-pxav3: fix device wakeup initialization
Jisheng Zhang [Tue, 2 Jun 2015 10:38:35 +0000 (18:38 +0800)]
mmc: sdhci-pxav3: fix device wakeup initialization

MMC_PM_KEEP_POWER doesn't imply MMC_PM_WAKE_SDIO_IRQ, we should only
enable device wake up when MMC_PM_WAKE_SDIO_IRQ is set. And "pm_flags"
is the requested pm features, we should not set it in the host driver.

At the same time, device wakeup is disabled by default, so there's no
need to disable device wakeup explicitly.

This patch fixes the warning as following:

[   64.616651] ------------[ cut here ]------------
[   64.616665] WARNING: CPU: 0 PID: 79 at linux/kernel/irq/manage.c:603 irq_set_irq_wake+0xf0/0x11c()
[   64.616667] Unbalanced IRQ 87 wake disable

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Attach PM domain prior probing of SDIO func driver
Ulf Hansson [Mon, 1 Jun 2015 10:18:25 +0000 (12:18 +0200)]
mmc: core: Attach PM domain prior probing of SDIO func driver

Other subsystem buses attach PM domains during probe, but prior calling
the driver's ->probe() method. During the removal phase, detaching the PM
domain will be done after invoking the driver's ->remove() callback.

Convert the SDIO bus to follow this behavior and add error handling.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove redundant ->power_restore() callback for SD
Ulf Hansson [Mon, 1 Jun 2015 09:14:58 +0000 (11:14 +0200)]
mmc: core: Remove redundant ->power_restore() callback for SD

Since the ->reset() callback is implemented for SD, the ->power_restore()
callback has become redundant, let's remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove redundant ->power_restore() callback for MMC
Ulf Hansson [Mon, 1 Jun 2015 09:14:57 +0000 (11:14 +0200)]
mmc: core: Remove redundant ->power_restore() callback for MMC

Since the ->reset() callback is implemented for MMC, the ->power_restore()
callback has become redundant, let's remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-bcm2835: Actually enable the clock
Eric Anholt [Fri, 29 May 2015 21:06:12 +0000 (14:06 -0700)]
mmc: sdhci-bcm2835: Actually enable the clock

We're currently using a fixed frequency clock specified in the DT, so
enabling is a no-op.  However, the RPi firmware-based clocks driver
can actually disable unused clocks, so when switching to use it we
ended up losing our MMC clock once all devices were probed.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails.
Eric Anholt [Fri, 29 May 2015 21:06:11 +0000 (14:06 -0700)]
mmc: sdhci-bcm2835: Clean up platform allocations if sdhci init fails.

Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-of-esdhc: enable interrupt mode to detect card
Yangbo Lu [Mon, 1 Jun 2015 05:47:12 +0000 (13:47 +0800)]
mmc: sdhci-of-esdhc: enable interrupt mode to detect card

Enable interrupt mode to detect card instead of polling mode
for P1020/P4080/P5020/P5040/T1040 by removing the quirk
SDHCI_QUIRK_BROKEN_CARD_DETECTION. This could improve data
transferring performance and avoid the call trace caused by
polling card status sometime.

Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl
Dong Aisheng [Wed, 27 May 2015 10:13:31 +0000 (18:13 +0800)]
mmc: sdhci-esdhc-imx: add quirk SDHCI_QUIRK2_BROKEN_HS200 for imx6qdl

The iMX6Q/DL can not support HS200 mode while iMX6SL and iMX6SX can,
so introduce a new flag to distinguish them.

Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: add imx6sx support
Dong Aisheng [Wed, 27 May 2015 10:13:30 +0000 (18:13 +0800)]
mmc: sdhci-esdhc-imx: add imx6sx support

The imx6sx usdhc is derived from imx6sl, the difference is minor.
imx6sx have the errata ESDHC_FLAG_ERR004536 fixed.
So introduce a new compatible string for imx6sx to distinguish them.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: using specific compatible string in binding doc
Dong Aisheng [Wed, 27 May 2015 10:13:29 +0000 (18:13 +0800)]
mmc: sdhci-esdhc-imx: using specific compatible string in binding doc

Using specific compatible string in binding doc to make the binding
more clear.
It's also used to avoid checkpatch warning in the future like follows:
WARNING: DT compatible string "fsl,imx6sx-usdhc" appears un-documented --
check ./Documentation/devicetree/bindings/
+       { .compatible = "fsl,imx6sx-usdhc", .data = &usdhc_imx6sx_data, },

total: 0 errors, 1 warnings, 18 lines checked

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix
Dong Aisheng [Wed, 27 May 2015 10:13:28 +0000 (18:13 +0800)]
mmc: sdhci-esdhc-imx: add ADMA Length Mismatch errata fix

The uSDHC has an ADMA Length Mismatch errata ERR004536 which may
cause ADMA work abnormally. The errata has already been fixed for
i.MX6Q TO1.2 and i.MX6DL TO1.1 by enable the bit 7 in 0x6c register.
Unfortunately this fix is not included in i.MX6SL.
So we disable ADMA for i.MX6SL and use SDMA instead.

Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue
Dong Aisheng [Wed, 27 May 2015 10:13:27 +0000 (18:13 +0800)]
mmc: sdhci-esdhc-imx: usdhc does not have missing card interrupt issue

The usdhc does not have missing card interrupt issue, so don't execute
workaround for usdhc.

Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: merge the same register check into one place
Dong Aisheng [Wed, 27 May 2015 10:13:26 +0000 (18:13 +0800)]
mmc: sdhci-esdhc-imx: merge the same register check into one place

In esdhc_writel_le() function, there's duplicated checking of the same
register as follows:
"if (unlikely(reg == SDHCI_INT_ENABLE || reg == SDHCI_SIGNAL_ENABLE))".
Merge them into one and remove the duplicated one.

Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pci: Enable HS400 for some Intel host controllers
Adrian Hunter [Fri, 6 Feb 2015 12:13:01 +0000 (14:13 +0200)]
mmc: sdhci-pci: Enable HS400 for some Intel host controllers

Enable detection of HS400 support via capability bit-63
for some Intel host controllers.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pci: Add support for drive strength selection for SPT
Adrian Hunter [Fri, 6 Feb 2015 12:13:00 +0000 (14:13 +0200)]
mmc: sdhci-pci: Add support for drive strength selection for SPT

Implement the select_drive_strength callback to provide
drive strength selection for Intel SPT.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Add a callback to select drive strength
Adrian Hunter [Fri, 6 Feb 2015 12:12:59 +0000 (14:12 +0200)]
mmc: sdhci: Add a callback to select drive strength

Add a callbak to let host drivers select drive
strength.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mmc: Add driver strength selection
Adrian Hunter [Fri, 6 Feb 2015 12:12:58 +0000 (14:12 +0200)]
mmc: mmc: Add driver strength selection

Add the ability to set eMMC driver strength
for HS200 and HS400.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mmc: Read card's valid driver strength mask
Adrian Hunter [Fri, 6 Feb 2015 12:12:57 +0000 (14:12 +0200)]
mmc: mmc: Read card's valid driver strength mask

In preparation for supporing drive strength selection
for eMMC, read the card's valid driver strengths.

Note that though the SD spec uses the term "drive strength",
the JEDEC eMMC spec uses the term "driver strength".

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Record card drive strength
Adrian Hunter [Fri, 6 Feb 2015 12:12:56 +0000 (14:12 +0200)]
mmc: core: Record card drive strength

In preparation for adding drive strength support
for eMMC, add drive_strength to struct mmc_card
to record the card drive strength for UHS-I modes
and HS200 / HS400. For eMMC this will be needed
when switching between HS200 and HS400.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Factor out common code in drive strength selection
Adrian Hunter [Fri, 6 Feb 2015 12:12:55 +0000 (14:12 +0200)]
mmc: core: Factor out common code in drive strength selection

Make a new function out of common code used for drive
strength selection.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Add 'card' to drive strength selection callback
Adrian Hunter [Fri, 6 Feb 2015 12:12:54 +0000 (14:12 +0200)]
mmc: core: Add 'card' to drive strength selection callback

In preparation for supporting also eMMC drive strength,
add the 'card' as a parameter so that the callback can
distinguish different types of cards if necessary.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Simplify card drive strength mask
Adrian Hunter [Fri, 6 Feb 2015 12:12:53 +0000 (14:12 +0200)]
mmc: core: Simplify card drive strength mask

Card drive strength selection uses a callback to
which a mask of supported drive strengths is passed.
Currently, the bits are checked against the values
in the SD specifications. That is not necessary
because the callback will anyway match the mask
against a valid value. Simplify by taking the mask
as is but still ensuring that the default mandatory
value (type B) is always supported.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Allow card drive strength to be different to host
Adrian Hunter [Fri, 6 Feb 2015 12:12:52 +0000 (14:12 +0200)]
mmc: core: Allow card drive strength to be different to host

Initialization of UHS-I modes for SD and SDIO cards
employs a callback to allow the host driver to
choose a drive strength value. Currently that
assumes the card drive strength and host driver
type must be the same value. Change to let the
callback make that decision and return both the
card drive strength and host driver type.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Reset driver type to default
Adrian Hunter [Fri, 6 Feb 2015 12:12:51 +0000 (14:12 +0200)]
mmc: core: Reset driver type to default

IO state variable drv_type could be set during card
initialization. Consequently, it must be reset to the
default value when setting the initial state.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mmcif: calculate best clock with parent clock
Kuninori Morimoto [Thu, 14 May 2015 07:22:46 +0000 (07:22 +0000)]
mmc: sh_mmcif: calculate best clock with parent clock

MMCIF IP on R-Car series has parent clock which can be set several rate,
and it was not implemented on old SH-Mobile series (= SH-Mobile series
parent clock was fixed rate) R-Car series MMCIF can use more high speed
access if it setups parent clock. This patch adds parent clock setup
method. It will be used if DT has "max-frequency", and then, this driver
assumes it is booted on R-Car Gen2 or later SoC. Because SH-Mobile series
(which doesn't boot from DT) and R-Car series (which boots from DT) have
different divider.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[Ulf: Silence compiler warning]

9 years agommc: sh_mmcif: use sh_mmcif_xxx prefix for all functions
Kuninori Morimoto [Thu, 14 May 2015 07:21:36 +0000 (07:21 +0000)]
mmc: sh_mmcif: use sh_mmcif_xxx prefix for all functions

Current sh_mmcif driver is using sh_mmcif_xxx and mmcif_xxx
for functions. This patch used sh_mmcif_xxx for all functions.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mmcif: add sh_mmcif_host_to_dev() macro and use it.
Kuninori Morimoto [Thu, 14 May 2015 07:21:18 +0000 (07:21 +0000)]
mmc: sh_mmcif: add sh_mmcif_host_to_dev() macro and use it.

Current sh_mmcif driver is directly using &host->pd->dev in all place.
It is not big problem, but it is unreadable, and it can be cause of
future bug. This patch adds new sh_mmcif_host_to_dev() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: fix driver type B and D handling in sdhci_do_set_ios()
Petri Gynther [Wed, 20 May 2015 21:35:00 +0000 (14:35 -0700)]
mmc: sdhci: fix driver type B and D handling in sdhci_do_set_ios()

sdhci_do_set_ios() doesn't currently program SDHCI_HOST_CONTROL2
register correctly when host->preset_enabled == false.

Add code to handle the missing cases MMC_SET_DRIVER_TYPE_B and
MMC_SET_DRIVER_TYPE_D.

Signed-off-by: Petri Gynther <pgynther@google.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agopowerpc/dts: add eSDHC compatible list
Yangbo Lu [Fri, 15 May 2015 02:46:02 +0000 (10:46 +0800)]
powerpc/dts: add eSDHC compatible list

Add eSDHC compatible list for P2041/P3041/P4080/P5020/P5040.

Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
Acked-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mmc-test: use swap() in mmc_test_nonblock_transfer()
Fabian Frederick [Mon, 18 May 2015 17:52:58 +0000 (19:52 +0200)]
mmc: mmc-test: use swap() in mmc_test_nonblock_transfer()

Use kernel.h macro definition.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Increase delay for voltage to stabilize from 3.3V to 1.8V
Doug Anderson [Tue, 12 May 2015 21:46:11 +0000 (14:46 -0700)]
mmc: core: Increase delay for voltage to stabilize from 3.3V to 1.8V

Since the regulator used for the SDMMC IO voltage is not expected to
draw a lot of current, most systems will probably use an inexpensive
LDO for it.  LDO regulators apparently have the feature that they
don't actively drive the voltage down--they wait for other components
in the system to drag the voltage down.  Thus they will transition
faster under heavy loads and slower under light loads.

During an SDMMC voltage change from 3.3V to 1.8V, we are almost
certainly under a light load.  To be specific:
* The regulator is hooked through pulls to CMD0-3 and DAT.  Probably
  the CMD pulls are something like 47K and the DAT is something like
  10K.
* The card is supposed to be driving DAT0-3 low during voltage change
  which will draw _some_ current, but not a lot.
* The regulator is also provided to the SDMMC host controller, but the
  SDMMC host controller is in open drain mode during the voltage
  change and so shouldn't be drawing much current.

In order to keep the SDMMC host working properly (or for noise
reasons), there might also be a capacitor attached to the SDMMC IO
regulator.  This also will have the effect of slowing down transitions
of the regulator, especially under light loads.

From experimental evidence, we've seen the voltage change fail if the
card doesn't detect that the voltage fell to less than about 2.3V when
we turn on the clock.  On one device (that admittedly had a 47K CMD
pullup instead of a 10K CMD pullup) we saw that the voltage was just
about 2.3V after 5ms and thus the voltage change would sometimes fail.
Doubling the delay gave margin and made the voltage change work 100%
of the time, despite the slightly weaker CMD pull.

At the moment submitting this as an RFC patch since my problem _could_
be fixed by increasing the pull strength (or using a smaller
capacitor).  However being a little bit more lenient to strange
hardware could also be a good thing.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-st: Fix modalias to make module auto-loading work
Zhangfei Gao [Thu, 14 May 2015 08:59:47 +0000 (16:59 +0800)]
mmc: sdhci-st: Fix modalias to make module auto-loading work

Make the modalias match driver name, this is required to make module
auto-loading work.

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
CC: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: rockchip: Fix modalias to make module auto-loading work
Zhangfei Gao [Thu, 14 May 2015 08:59:46 +0000 (16:59 +0800)]
mmc: dw_mmc: rockchip: Fix modalias to make module auto-loading work

Make the modalias match driver name, this is required to make module
auto-loading work.

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
CC: Doug Anderson <dianders@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: exynos: Fix modalias to make module auto-loading work
Zhangfei Gao [Thu, 14 May 2015 08:59:45 +0000 (16:59 +0800)]
mmc: dw_mmc: exynos: Fix modalias to make module auto-loading work

Make the modalias match driver name, this is required to make module
auto-loading work.

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: k3: Fix modalias to make module auto-loading work
Zhangfei Gao [Thu, 14 May 2015 08:59:44 +0000 (16:59 +0800)]
mmc: dw_mmc: k3: Fix modalias to make module auto-loading work

Make the modalias match driver name, this is required to make module
auto-loading work.

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: Use core to handle absent write protect line
Lars-Peter Clausen [Wed, 6 May 2015 18:31:22 +0000 (20:31 +0200)]
mmc: dw_mmc: Use core to handle absent write protect line

Use the new MMC_CAP2_NO_WRITE_PROTECT to let the core handle the case where
no write protect line is present instead of having custom driver code to
handle it.

dw_mci_of_get_slot_quirks() is slightly refactored to directly modify the
mmc_host capabilities instead of returning a quirk mask.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: k3: support hi6220
Zhangfei Gao [Thu, 14 May 2015 08:45:19 +0000 (16:45 +0800)]
mmc: dw_mmc: k3: support hi6220

Support hi6220, tested on hikey board
emmc: support hs
sd: support hs, sdr12, sdr25

Signed-off-by: Jorge A. Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Dan Yuan <yuandan@hisilicon.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: add switch_voltage
Zhangfei Gao [Thu, 14 May 2015 08:45:18 +0000 (16:45 +0800)]
mmc: dw_mmc: add switch_voltage

switch_voltage is required on some platform since special register accessing

Signed-off-by: Jorge A. Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Dan Yuan <yuandan@hisilicon.com>
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agoDocument: dw_mmc-k3: add document of hi6220 mmc
Zhangfei Gao [Thu, 14 May 2015 08:45:17 +0000 (16:45 +0800)]
Document: dw_mmc-k3: add document of hi6220 mmc

Add bindings for hi6220 mmc support

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: cast unsigned int to typeof(sector_t) to avoid unexpected error
Kuninori Morimoto [Mon, 11 May 2015 07:35:28 +0000 (07:35 +0000)]
mmc: cast unsigned int to typeof(sector_t) to avoid unexpected error

card->csd.capacity is defined as "unsigned int", and sector_t is defined as
"u64" or "unsigned long" (depends on CONFIG_LBDAF). Thus, sector_t data
might have strange data (see below). This patch cast it to typeof(sector_t)
Special thanks to coverity <http://www.coverity.com>

ex) if sector_t was u64

        unsigned int data;
        sector_t sector;

        data = 0x800000;
        sector = (data << 8); // 0xffffffff80000000
        sector = (((typeof(sector_t))data) << 8); // 0x80000000

or

        data = 0x80000000;
        sector = (data << 8); // 0x0
        sector = (((typeof(sector_t))data) << 8); // 0x8000000000

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: cast u8 to unsigned long long to avoid unexpected error
Kuninori Morimoto [Mon, 11 May 2015 07:34:53 +0000 (07:34 +0000)]
mmc: cast u8 to unsigned long long to avoid unexpected error

card->ext_csd.enhanced_area_offset is defined as "unsigned long long",
and, ext_csd[] is defined as u8.
unsigned long long data might have strange data if first bit of ext_csd[]
was 1. this patch cast it to (unsigned long long)
Special thanks to coverity <http://www.coverity.com>

ex)
        u8  data8;
        u64 data64;

        data8 = 0x80;
        data64 = (data8 << 24); // 0xffffffff80000000
        data64 = (((unsigned long long)data8) << 24); // 0x80000000;

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: host: sdhci: Use BUG_ON()
Fabio Estevam [Sat, 9 May 2015 21:44:51 +0000 (18:44 -0300)]
mmc: host: sdhci: Use BUG_ON()

Use BUG_ON() instead of an 'if' condition followed by BUG().

The semantic patch that makes this change is available
in scripts/coccinelle/misc/bugon.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: host: mxcmmc: Simplify a trivial if-return sequence
Fabio Estevam [Sat, 9 May 2015 21:44:50 +0000 (18:44 -0300)]
mmc: host: mxcmmc: Simplify a trivial if-return sequence

Simplify a trivial if-return sequence. Possibly combine with a
preceding function call.

The semantic patch that makes this change is available
in scripts/coccinelle/misc/simple_return.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: card: mmc_test: Simplify a trivial if-return sequence
Fabio Estevam [Sat, 9 May 2015 21:44:49 +0000 (18:44 -0300)]
mmc: card: mmc_test: Simplify a trivial if-return sequence

Simplify a trivial if-return sequence. Possibly combine with a
preceding function call.

The semantic patch that makes this change is available
in scripts/coccinelle/misc/simple_return.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: Do not break platform data boards
Fabio Estevam [Sat, 9 May 2015 12:57:09 +0000 (09:57 -0300)]
mmc: sdhci-esdhc-imx: Do not break platform data boards

The only user of this driver that has not been converted to fully
device tree is the i.MX35 SoC.

There is a i.MX35-based board (mach-pcm043.c) that uses platform data
to pass wp_gpio and cd_gpio information.

Commit 8d86e4fcccf61ba ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()")
broke the platform data case by removing mmc_gpio_request_ro() and
mmc_gpio_request_cd(), so restore the functionality for the non-dt
case.

Also, restore the check for ESDHC_CD_CONTROLLER so that we can still
support the "fsl,cd-controller" property.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: Move mmc_of_parse() to the dt probe
Fabio Estevam [Sat, 9 May 2015 12:57:08 +0000 (09:57 -0300)]
mmc: sdhci-esdhc-imx: Move mmc_of_parse() to the dt probe

mmc_of_parse() should be placed inside sdhci_esdhc_imx_probe_dt() as it
suits only for the dt case.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dt: Allow to specify that no write protect signal is present
Lars-Peter Clausen [Wed, 6 May 2015 18:31:20 +0000 (20:31 +0200)]
mmc: dt: Allow to specify that no write protect signal is present

Allow to specify in the device-tree that no physical write-protect signal
is connected to a particular instance of a MMC controller. Setting the
property will cause the core will assume that the SD card is always
read-write.

The name for the new property is 'disable-wp' and was chosen based on the
property with the same function from the Synopsys designware mobile storage
host controller DT bindings specification.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: Add support for disabling write-protect detection
Lars-Peter Clausen [Wed, 6 May 2015 18:31:19 +0000 (20:31 +0200)]
mmc: Add support for disabling write-protect detection

It is not uncommon to see systems where there is no physical write-protect
signal (e.g. when using eMMC or microSD card slots). For some controllers,
which have a dedicated write-protection detection logic (like SDHCI
controllers), the get_ro() callback can return bogus data in such a case.

Instead of handling this on a per controller basis this patch adds a new
capability flag to the MMC core that can be set to specify that the result
of get_ro() is invalid. When the flag is set the core will not call
get_ro() and assume that the card is always read-write.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Don't print reset warning if reset is not supported
Adrian Hunter [Thu, 7 May 2015 10:10:25 +0000 (13:10 +0300)]
mmc: core: Don't print reset warning if reset is not supported

Check the error code for EOPNOTSUPP and do not print
reset warning in that case.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: block: Retry errored data requests when re-tuning is needed
Adrian Hunter [Thu, 7 May 2015 10:10:24 +0000 (13:10 +0300)]
mmc: block: Retry errored data requests when re-tuning is needed

Retry errored data requests when re-tuning is needed and
add a flag to struct mmc_blk_request so that the retry
is only done once.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: block: Check re-tuning in the recovery path
Adrian Hunter [Thu, 7 May 2015 10:10:23 +0000 (13:10 +0300)]
mmc: block: Check re-tuning in the recovery path

If re-tuning is needed, do it in the recovery path to
give recovery commands a better chance of success.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Flag re-tuning is needed on CRC errors
Adrian Hunter [Thu, 7 May 2015 10:10:22 +0000 (13:10 +0300)]
mmc: core: Flag re-tuning is needed on CRC errors

CRC errors could possibly be alleviated by
re-tuning so flag re-tuning needed in those cases.
Note this has no effect if re-tuning has not been
enabled.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Change to new way of doing re-tuning
Adrian Hunter [Thu, 7 May 2015 10:10:21 +0000 (13:10 +0300)]
mmc: sdhci: Change to new way of doing re-tuning

Make use of mmc core support for re-tuning instead
of doing it all in the sdhci driver.

This patch also changes to flag the need for re-tuning
always after runtime suspend when tuning has been used
at initialization. Previously it was only done if
the re-tuning timer was in use.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Add support for HS400 re-tuning
Adrian Hunter [Thu, 7 May 2015 10:10:20 +0000 (13:10 +0300)]
mmc: core: Add support for HS400 re-tuning

HS400 re-tuning must be done in HS200 mode. Add
the ability to switch from HS400 mode to HS200
mode before re-tuning and switch back to HS400
after re-tuning.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Separate out the mmc_switch status check so it can be re-used
Adrian Hunter [Thu, 7 May 2015 10:10:19 +0000 (13:10 +0300)]
mmc: core: Separate out the mmc_switch status check so it can be re-used

Make a separate function to do the mmc_switch status check
so it can be re-used. This is preparation for adding support
for HS400 re-tuning.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mmc: Hold re-tuning in mmc_sleep()
Adrian Hunter [Thu, 7 May 2015 10:10:18 +0000 (13:10 +0300)]
mmc: mmc: Hold re-tuning in mmc_sleep()

The sleep command is issued after deselecting the
card, but re-tuning won't work on a deselected card
so re-tuning must be held.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Hold re-tuning while bkops ongoing
Adrian Hunter [Thu, 7 May 2015 10:10:17 +0000 (13:10 +0300)]
mmc: core: Hold re-tuning while bkops ongoing

Hold re-tuning during bkops to prevent
it from conflicting with the busy state.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Hold re-tuning during erase commands
Adrian Hunter [Thu, 7 May 2015 10:10:16 +0000 (13:10 +0300)]
mmc: core: Hold re-tuning during erase commands

Hold re-tuning during erase commands to prevent
it from conflicting with the sequence of commands.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Hold re-tuning during switch commands
Adrian Hunter [Thu, 7 May 2015 10:10:15 +0000 (13:10 +0300)]
mmc: core: Hold re-tuning during switch commands

Hold re-tuning during switch commands to prevent
it from conflicting with the busy state or the CMD13
verification.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Add support for re-tuning before each request
Adrian Hunter [Thu, 7 May 2015 10:10:14 +0000 (13:10 +0300)]
mmc: core: Add support for re-tuning before each request

At the start of each request, re-tune if needed and
then hold off re-tuning again until the request is done.

Note that though there is one function that starts
requests (mmc_start_request) there are two that wait for
the request to be done (mmc_wait_for_req_done and
mmc_wait_for_data_req_done).  Also note that
mmc_wait_for_data_req_done can return even when the
request is not done (which allows the block driver
to prepare a newly arrived request while still
waiting for the previous request).

This patch ensures re-tuning is held for the duration
of a request.  Subsequent patches will also hold
re-tuning at other times when it might cause a
conflict.

In addition, possibly a command is failing because
re-tuning is needed. Use mmc_retune_recheck() to check
re-tuning. At that point re-tuning is held, at least by
the request, so mmc_retune_recheck() flags host->retune_now
if the hold count is 1.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Enable / disable re-tuning
Adrian Hunter [Thu, 7 May 2015 10:10:13 +0000 (13:10 +0300)]
mmc: core: Enable / disable re-tuning

Enable re-tuning when tuning is executed and
disable re-tuning when card is no longer initialized.

In the case of SDIO suspend, the card can keep power.
In that case, re-tuning need not be disabled, but, if
a re-tuning timer is being used, ensure it is disabled
and assume that re-tuning will be needed upon resume
since it is not known how long the suspend will last.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: host: Add facility to support re-tuning
Adrian Hunter [Thu, 7 May 2015 10:10:12 +0000 (13:10 +0300)]
mmc: host: Add facility to support re-tuning

Currently, there is core support for tuning during
initialization. There can also be a need to re-tune
periodically (e.g. sdhci) or to re-tune after the
host controller is powered off (e.g. after PM
runtime suspend / resume) or to re-tune in response
to CRC errors.

The main requirements for re-tuning are:
  - ability to enable / disable re-tuning
  - ability to flag that re-tuning is needed
  - ability to re-tune before any request
  - ability to hold off re-tuning if the card is busy
  - ability to hold off re-tuning if re-tuning is in
  progress
  - ability to run a re-tuning timer

To support those requirements 7 members are added to struct
mmc_host:

  unsigned int can_retune:1; /* re-tuning can be used */
  unsigned int doing_retune:1; /* re-tuning in progress */
  unsigned int retune_now:1;   /* do re-tuning at next req */
  int need_retune; /* re-tuning is needed */
  int hold_retune; /* hold off re-tuning */
  unsigned int retune_period;  /* re-tuning period in secs */
  struct timer_list retune_timer; /* for periodic re-tuning */

need_retune is an integer so it can be set without needing
synchronization. hold_retune is a integer to allow nesting.

Various simple functions are provided to set / clear those
variables.

Subsequent patches take those functions into use.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-{pxav2,pxav3}: Use of_match_ptr() macro
Axel Lin [Tue, 5 May 2015 09:11:54 +0000 (17:11 +0800)]
mmc: sdhci-{pxav2,pxav3}: Use of_match_ptr() macro

This eliminates having an #ifdef returning NULL for the case
when OF is disabled.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Jisheng Zhang <jszhang@marvell.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-of-arasan: Add the support for sdhci-arasan4.9a
Suman Tripathi [Mon, 4 May 2015 13:39:51 +0000 (19:09 +0530)]
mmc: sdhci-of-arasan: Add the support for sdhci-arasan4.9a

This patch adds the quirks and compatible string in sdhci-of-arasan.c
to support sdhci-arasan4.9a version of controller.

Signed-off-by: Suman Tripathi <stripathi@apm.com>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-s3c: Constify platform_device_id
Krzysztof Kozlowski [Fri, 1 May 2015 15:49:22 +0000 (00:49 +0900)]
mmc: sdhci-s3c: Constify platform_device_id

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>
9 years agommc: sdhci-imx: Constify platform_device_id
Krzysztof Kozlowski [Fri, 1 May 2015 15:49:21 +0000 (00:49 +0900)]
mmc: sdhci-imx: Constify platform_device_id

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>
9 years agommc: s3cmci: Constify platform_device_id
Krzysztof Kozlowski [Fri, 1 May 2015 15:49:20 +0000 (00:49 +0900)]
mmc: s3cmci: Constify platform_device_id

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>
9 years agommc: rtsx: Constify platform_device_id
Krzysztof Kozlowski [Fri, 1 May 2015 15:49:19 +0000 (00:49 +0900)]
mmc: rtsx: Constify platform_device_id

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>
9 years agommc: mxs: Constify platform_device_id
Krzysztof Kozlowski [Fri, 1 May 2015 15:49:18 +0000 (00:49 +0900)]
mmc: mxs: Constify platform_device_id

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>
9 years agommc: davinci: Constify platform_device_id
Krzysztof Kozlowski [Fri, 1 May 2015 15:49:17 +0000 (00:49 +0900)]
mmc: davinci: Constify platform_device_id

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>
9 years agommc: sdhci-sirf: fake version and capbility registers
Weijun Yang [Mon, 27 Apr 2015 08:15:14 +0000 (08:15 +0000)]
mmc: sdhci-sirf: fake version and capbility registers

chips have some issues for version and capbility registers, here we fake
them.

Signed-off-by: Weijun Yang <Weijun.Yang@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-sirf: fix the tuning count in platform_execute_tuning
Weijun Yang [Mon, 27 Apr 2015 08:15:13 +0000 (08:15 +0000)]
mmc: sdhci-sirf: fix the tuning count in platform_execute_tuning

hardware has 16bit to record the tuning count, so fix it to 16384.
at the same time, tuned_phases[SIRF_TUNING_COUNT] is useless as the
array is never used, so move it to a variant.

Signed-off-by: Weijun Yang <Weijun.Yang@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agoMAINTAINERS: mmc: Update Ian Molton's address for tmio_mmc driver
Ben Hutchings [Sun, 26 Apr 2015 23:01:53 +0000 (00:01 +0100)]
MAINTAINERS: mmc: Update Ian Molton's address for tmio_mmc driver

Ian no longer works for Codethink so the current address doesn't work.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: TMIO: Use devm_request_irq()
Ian Molton [Sun, 26 Apr 2015 23:01:36 +0000 (00:01 +0100)]
mmc: TMIO: Use devm_request_irq()

Clean up resource allocation and freeing.

Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: TMIO: Fix I/O mapping leak on error using devm_ioremap()
Ian Molton [Sun, 26 Apr 2015 23:01:17 +0000 (00:01 +0100)]
mmc: TMIO: Fix I/O mapping leak on error using devm_ioremap()

Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
[bwh: Forward-ported to 4.0]
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: TMIO: Ensure MFD cell is disabled on probe error path
Ian Molton [Sun, 26 Apr 2015 23:01:06 +0000 (00:01 +0100)]
mmc: TMIO: Ensure MFD cell is disabled on probe error path

Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci_f_sdh30: Fix the size passed to sdhci_alloc_host
Axel Lin [Fri, 24 Apr 2015 07:02:00 +0000 (15:02 +0800)]
mmc: sdhci_f_sdh30: Fix the size passed to sdhci_alloc_host

sdhci_alloc_host() takes priv_size rather than
sizeof(struct sdhci_host) + priv_size.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci_f_sdh30: Staticize local functions
Axel Lin [Fri, 24 Apr 2015 07:00:29 +0000 (15:00 +0800)]
mmc: sdhci_f_sdh30: Staticize local functions

Make local functions static.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-of-esdhc: Pre divider starts at 1
Joakim Tjernlund [Mon, 20 Apr 2015 21:12:13 +0000 (23:12 +0200)]
mmc: sdhci-of-esdhc: Pre divider starts at 1

For PowerPC esdhc pre divider starts at 1, fixing the increases
the actual clock from 40KHz to 50 KHz.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: host: sdhci-esdhc-imx: fix broken email address
Wolfram Sang [Mon, 20 Apr 2015 13:51:42 +0000 (15:51 +0200)]
mmc: host: sdhci-esdhc-imx: fix broken email address

My Pengutronix address is not valid anymore, redirect people to the Pengutronix
kernel team.

Reported-by: Harald Geyer <harald@ccbib.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Robert Schwebel <r.schwebel@pengutronix.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: pwrseq: dt: example with reset clock and active low pin
Andreas Fenkart [Thu, 16 Apr 2015 08:03:14 +0000 (10:03 +0200)]
mmc: pwrseq: dt: example with reset clock and active low pin

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mmcif: separate sh_mmcif_clk_update() into setup and prepare
Kuninori Morimoto [Thu, 23 Apr 2015 08:16:04 +0000 (08:16 +0000)]
mmc: sh_mmcif: separate sh_mmcif_clk_update() into setup and prepare

Current sh_mmcif_clk_update() is called from probe() and set_ios(),
but, the purpose of later one is just clk_prepare_enable().
No need to setup mmc->f_max/f_min in many times.
This patch separe sh_mmcif_clk_update() into clk_prepare_enable()
and mmc->f_max/f_min setup.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mmcif: remove unnecessary int clk from struct sh_mmcif_host
Kuninori Morimoto [Thu, 23 Apr 2015 08:15:08 +0000 (08:15 +0000)]
mmc: sh_mmcif: remove unnecessary int clk from struct sh_mmcif_host

struct sh_mmcif_host has 1) int clk, 2) struct clock *hclk,
and host->clk = clk_get_rate(host->hclk).
This int clk is not necessary. Let's remove it.
And, current hclk is confusable naming. Let's rename it to clk.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mmcif: cleanup to use dev instead of &pdev->dev
Kuninori Morimoto [Thu, 23 Apr 2015 08:14:12 +0000 (08:14 +0000)]
mmc: sh_mmcif: cleanup to use dev instead of &pdev->dev

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sh_mmcif: move mmcif_of_match to upside
Kuninori Morimoto [Thu, 23 Apr 2015 08:13:25 +0000 (08:13 +0000)]
mmc: sh_mmcif: move mmcif_of_match to upside

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Keita Kobayashi <keita.kobayashi.ym@renesas.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdio: add reset callback to bus operations
Andreas Fenkart [Thu, 23 Apr 2015 11:15:42 +0000 (13:15 +0200)]
mmc: sdio: add reset callback to bus operations

Some drivers schedule automatic hw resets. An example is mwifiex,
which schedules a card reset if the command handler between driver
and card firmware becomes out of sync

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agoLinux 4.1-rc5
Linus Torvalds [Mon, 25 May 2015 01:22:35 +0000 (18:22 -0700)]
Linux 4.1-rc5

9 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sun, 24 May 2015 18:15:28 +0000 (11:15 -0700)]
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "This is a set of five fixes: Two MAINTAINER email updates (urgent
  because the non-avagotech emails will start bouncing) an lpfc big
  endian oops fix, a 256 byte sector hang fix (to eliminate 256 byte
  sectors) and a storvsc fix which could cause test unit ready failures
  on bringup"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  MAINTAINERS: Revise lpfc maintainers for Avago Technologies ownership of Emulex
  MAINTAINERS, be2iscsi: change email domain
  sd: Disable support for 256 byte/sector disks
  lpfc: Fix breakage on big endian kernels
  storvsc: Set the SRB flags correctly when no data transfer is needed

9 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 24 May 2015 00:57:40 +0000 (17:57 -0700)]
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Thomas Gleixner:
 "One more fix from the timer departement:

    - Handle division of negative nanosecond values proper on 32bit.

      A recent cleanup wrecked the sign handling of the dividend and
      dropped the check for negative divisors"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  ktime: Fix ktime_divns to do signed division