]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/log
mirror_ubuntu-focal-kernel.git
8 years agommc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3
Wolfram Sang [Mon, 9 May 2016 15:01:07 +0000 (17:01 +0200)]
mmc: sh_mobile_sdhi: enable SDIO IRQs for RCar Gen3

Tested on a Salvator-X board with a Spectec SDW-823 WLAN card.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdio: fall back to SDIO 1.0 for broken 1.1 cards
Wolfram Sang [Mon, 9 May 2016 07:59:59 +0000 (09:59 +0200)]
mmc: sdio: fall back to SDIO 1.0 for broken 1.1 cards

I have two SDIO WLAN cards which specify being SDIO Rev. 1.1 cards but
their FUNCE tuple reports the smaller size of a Rev 1.0 card. So,
enforce 1.0 on these cards to avoid reading the not present registers.
They are not really used anyhow. My cards initialize properly after this
patch.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-st: correct name of sd-uhs-sdr50 property
Simon Horman [Tue, 10 May 2016 00:14:24 +0000 (09:14 +0900)]
mmc: sdhci-st: correct name of sd-uhs-sdr50 property

Correct what appears to be a typo in the name of the sd-uhs-sdr50.

Also fix mixed tab/space indentation.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agoMAINTAINERS: update entry for TMIO MMC driver
Wolfram Sang [Mon, 9 May 2016 08:26:58 +0000 (10:26 +0200)]
MAINTAINERS: update entry for TMIO MMC driver

I have some more additions planned for this driver, so I'd like to get
notified of other changes and coordinate them. Drop Ian as maintainer
because he hasn't been involved in development for a while. Thanks for
all the initial work, of course! Also, reflect the recent changes to
the include file layout.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Ian Molton <ian@mnementh.co.uk>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: block: improve logging of handling emmc timeouts
Ken Sumrall [Tue, 10 May 2016 09:23:13 +0000 (14:53 +0530)]
mmc: block: improve logging of handling emmc timeouts

Add some logging to make it clear just how the emmc timeout
was handled.

Signed-off-by: Ken Sumrall <ksumrall@android.com>
[AmitP: cherry-picked this Android patch from aosp
        common kernel android-4.4]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: removed unneeded function wrappers
Dong Aisheng [Fri, 15 Apr 2016 17:29:25 +0000 (01:29 +0800)]
mmc: sdhci: removed unneeded function wrappers

After commit d6463f170cf0 ("mmc: sdhci: Remove redundant runtime PM calls"),
some of original sdhci_do_xx() function wrappers becomes meaningless,
so remove them.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: core: remove the invalid message in mmc_select_timing
Dong Aisheng [Wed, 20 Apr 2016 16:51:31 +0000 (00:51 +0800)]
mmc: core: remove the invalid message in mmc_select_timing

mmc_select_hs200() and mmc_select_hs() will keep the timing
as before if switch fails. So it's meaningless to print the
failed switched mode outside based on the current host timing.

Furthermore, the original print is wrong, it should be:
pr_warn("%s: switch to %s failed\n",
mmc_hostname(card->host),
mmc_card_hs(card) ? "high-speed" :
(mmc_card_hs200(card) ? "hs200" : ""));

Since we already have error message in mmc_select_hs200(),
simply remove it outside.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: core: fix using wrong io voltage if mmc_select_hs200 fails
Dong Aisheng [Wed, 20 Apr 2016 16:51:30 +0000 (00:51 +0800)]
mmc: core: fix using wrong io voltage if mmc_select_hs200 fails

Currently MMC core will keep going if HS200/HS timing switch failed
with -EBADMSG error by the assumption that the old timing is still valid.

However, for mmc_select_hs200 case, the signal voltage may have already
been switched. If the timing switch failed, we should fall back to
the old voltage in case the card is continue run with legacy timing.

If fall back signal voltage failed, we explicitly report an EIO error
to force retry during the next power cycle.

Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-of-arasan: fix set_clock when a phy is supported
Shawn Lin [Wed, 4 May 2016 01:43:24 +0000 (09:43 +0800)]
mmc: sdhci-of-arasan: fix set_clock when a phy is supported

commit 61b914eb81f8 ("mmc: sdhci-of-arasan: add phy support for
sdhci-of-arasan") introduce phy support for arasan. According to
the vendor's databook, we should make sure the phy is in poweroff
status before we configure the clk stuff. Otherwise it may cause
some IO sample timing issues from the test. And we don't need this
extra operation while running in low performance mode since phy
doesn't trigger sampling block.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: omap: Use dma_request_chan() for requesting DMA channel
Peter Ujfalusi [Wed, 4 May 2016 08:23:08 +0000 (11:23 +0300)]
mmc: omap: Use dma_request_chan() for requesting DMA channel

With the new dma_request_chan() the client driver does not need to look for
the DMA resource and it does not need to pass filter_fn anymore.
By switching to the new API the driver can now support deferred probing
against DMA.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: Jarkko Nikula <jarkko.nikula@bitmer.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: mmc: Attempt to flush cache before reset
Adrian Hunter [Wed, 4 May 2016 07:38:21 +0000 (10:38 +0300)]
mmc: mmc: Attempt to flush cache before reset

CMD0 or hardware reset may invalidate the cache, so it needs to be
flushed before reset.

In the case of recovery, we can't expect flushing the cache to work
always, but have a go and ignore errors.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mobile_sdhi: check return value when changing clk
Wolfram Sang [Mon, 2 May 2016 20:25:42 +0000 (22:25 +0200)]
mmc: sh_mobile_sdhi: check return value when changing clk

And return the old clock rate if something went wrong.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mobile_sdhi: only change the clock on RCar Gen2+
Wolfram Sang [Mon, 2 May 2016 20:25:41 +0000 (22:25 +0200)]
mmc: sh_mobile_sdhi: only change the clock on RCar Gen2+

We had a regression on r8a7740 where the SDHI clock was a generic
peripheral clock, so changing its rate was not desired. This should be
fixed in the clock driver. However, it also shows that the new clock
calculation should only be used on tested systems. Add a check for that.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio/sdhi: introduce flag for RCar 2+ specific features
Wolfram Sang [Mon, 2 May 2016 20:25:40 +0000 (22:25 +0200)]
mmc: tmio/sdhi: introduce flag for RCar 2+ specific features

RCar Gen2 and later implementations of TMIO/SDHI have their own set of
features and additions. FAST_CLK_CHG is just one of them and I see a few
others being added soon. Some may work on older chipsets but this needs
to be tested case by case. Instead of adding a bunch of flags for each
feature, add a global RCar2+ one for now. We can still break out
features if the need arises.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mobile_sdhi: make clk_update function more compact
Wolfram Sang [Mon, 2 May 2016 20:25:39 +0000 (22:25 +0200)]
mmc: sh_mobile_sdhi: make clk_update function more compact

Save a few lines, the codebase is large enough.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: omap_hsmmc: Use dma_request_chan() for requesting DMA channel
Peter Ujfalusi [Fri, 29 Apr 2016 13:06:18 +0000 (16:06 +0300)]
mmc: omap_hsmmc: Use dma_request_chan() for requesting DMA channel

With the new dma_request_chan() the client driver does not need to look for
the DMA resource and it does not need to pass filter_fn anymore.
By switching to the new API the driver can now support deferred probing
against DMA.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-of-at91: add presets setup
Ludovic Desroches [Thu, 28 Apr 2016 12:59:26 +0000 (14:59 +0200)]
mmc: sdhci-of-at91: add presets setup

The controller claims to support SDR104. In fact, it only supports a
degraded SDR104 since the maximum frequency of the SD clock is 120 MHz
instead of 208 MHz.
The sdhci core is unaware of it and will compute a wrong clock divider.
We can deal with this specific case by using presets.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: usdhi6rol0: add pinctrl to set pin drive strength
Lars Persson [Wed, 27 Apr 2016 15:21:29 +0000 (17:21 +0200)]
mmc: usdhi6rol0: add pinctrl to set pin drive strength

Some boards need different pin drive strength for the UHS mode. Add an
optional pinctrl setting with two pin states covering UHS speeds and
other speeds.

Signed-off-by: Lars Persson <larper@axis.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: usdhi6rol0: add support for UHS modes
Lars Persson [Wed, 27 Apr 2016 15:21:28 +0000 (17:21 +0200)]
mmc: usdhi6rol0: add support for UHS modes

Add a start_signal_voltage_switch() operation to support enabling of
UHS modes.

Signed-off-by: Lars Persson <larper@axis.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: usdhi6rol0: do not announce UHS capabilities
Lars Persson [Wed, 27 Apr 2016 15:21:27 +0000 (17:21 +0200)]
mmc: usdhi6rol0: do not announce UHS capabilities

The driver in its current form does not support UHS at all due to
a missing start_signal_voltage_switch callback.

Also when this callback is added we should let the device tree control
UHS capabilities using the standard mmc bindings.

Signed-off-by: Lars Persson <larper@axis.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dt: usdhi6rol0: add optional pinctrl binding
Lars Persson [Wed, 27 Apr 2016 15:21:26 +0000 (17:21 +0200)]
mmc: dt: usdhi6rol0: add optional pinctrl binding

Add a pinctrl binding to specify different pin settings for high speed
modes and UHS modes.

Signed-off-by: Lars Persson <larper@axis.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mobile_sdhi: remove obsolete include file
Wolfram Sang [Thu, 28 Apr 2016 06:18:11 +0000 (08:18 +0200)]
mmc: sh_mobile_sdhi: remove obsolete include file

A few SH boards include the file but don't make use of it (no named
interrupts). The SDHI code removed support for this feature as well.
So, drop the references and ultimately remove the unneeded file.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Rich Felker <dalias@libc.org>
Acked-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: document CTL_STATUS handling
Wolfram Sang [Wed, 27 Apr 2016 16:51:27 +0000 (18:51 +0200)]
mmc: tmio: document CTL_STATUS handling

Now that reading CTL_STATUS is consistent, we can remove CTL_STATUS2 and
document how this is handled internally.

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio/sdhi: distinguish between SCLKDIVEN and ILL_FUNC
Wolfram Sang [Wed, 27 Apr 2016 16:51:26 +0000 (18:51 +0200)]
mmc: tmio/sdhi: distinguish between SCLKDIVEN and ILL_FUNC

This bit has a different meaning in SDHI and original TMIO. Document
that and use the proper naming.

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: use CTL_STATUS consistently
Wolfram Sang [Wed, 27 Apr 2016 16:51:25 +0000 (18:51 +0200)]
mmc: tmio: use CTL_STATUS consistently

To prevent confusion, use the virtual u32 CTL_STATUS in card_busy() the
same way as in other parts of this driver.

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: use BIT() within defines
Wolfram Sang [Wed, 27 Apr 2016 16:51:24 +0000 (18:51 +0200)]
mmc: tmio: use BIT() within defines

BIT() makes it easier to match the bits to the datasheet. This is
especially important here, since some variants have different names in
their datasheets (like with Renesas R-Car).

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: give read32/write32 functions more descriptive names
Wolfram Sang [Wed, 27 Apr 2016 16:51:23 +0000 (18:51 +0200)]
mmc: tmio: give read32/write32 functions more descriptive names

Looking at the backlogs, I am not the only one who missed that the above
functions do not read u32 from one register, but create a virtual u32
from reading to adjacent u16 registers (which depending on 'bus_shift'
can be up to 8 byte apart). Because this driver supports old hardware
for which we don't have documentation, I first wrongly assumed there was
a variant which had a few u32 registers. Let's give the functions more
descriptive names to make it more obvious what is happening.

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: omap_hsmmc: Check if MMC slot name is passed in pdata
Tony Lindgren [Tue, 26 Apr 2016 23:46:23 +0000 (16:46 -0700)]
mmc: omap_hsmmc: Check if MMC slot name is passed in pdata

The legacy user space for n900 relies on the MMC slot names.
Let's check if those are passed in pdata and use them.

As this makes the DT booting compatible with legacy booting,
we should be able to start dropping omap3 legacy booting
support in v4.8.

Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Tony Lindgren <tony@atomide.com>
Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mobile_sdhi: remove obsolete support for sh7372
Wolfram Sang [Tue, 26 Apr 2016 20:29:10 +0000 (22:29 +0200)]
mmc: sh_mobile_sdhi: remove obsolete support for sh7372

There is no support for this platform in the kernel anymore.

Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mmcif: remove obsolete support for sh7372
Wolfram Sang [Tue, 26 Apr 2016 20:34:46 +0000 (22:34 +0200)]
mmc: sh_mmcif: remove obsolete support for sh7372

There is no support for this platform in the kernel anymore. Make the
Kconfig text more generic, so it won't get stale anymore.

Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mobile_sdhi: simplify code for voltage switching
Wolfram Sang [Tue, 26 Apr 2016 15:55:27 +0000 (17:55 +0200)]
mmc: sh_mobile_sdhi: simplify code for voltage switching

A last minute fix applied by Ulf made room for some simplification.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: merge distributed include files
Wolfram Sang [Tue, 26 Apr 2016 15:55:26 +0000 (17:55 +0200)]
mmc: tmio: merge distributed include files

There is no reason to have a public and private header file. Merge them
into a private one, so looking up symbols is less confusing.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: simplify irq handler
Wolfram Sang [Tue, 26 Apr 2016 15:55:25 +0000 (17:55 +0200)]
mmc: tmio: simplify irq handler

Having just one irq handler again, let's include the 'card_status'
function in the main handler which is way more readable. Drop a useless
debug output while here. It should be a dev_dbg in case we ever need it
again.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: remove now unneeded seperate irq handlers
Wolfram Sang [Tue, 26 Apr 2016 15:55:24 +0000 (17:55 +0200)]
mmc: tmio: remove now unneeded seperate irq handlers

We removed installation of separate handlers previously, so we can also
remove the separate handlers.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mobile_sdhi: remove obsolete irq_by_name registration
Wolfram Sang [Tue, 26 Apr 2016 15:55:23 +0000 (17:55 +0200)]
mmc: sh_mobile_sdhi: remove obsolete irq_by_name registration

There is no user left in the kernel, so this code can be removed.
(Legacy, non-DT sh_mobile boards have been removed a while ago.) The

diff looks more complicated than it is: The if-block for multiplexed isr
is now the main code path, the rest is removed.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mobile_sdhi: don't use array for DT configs
Wolfram Sang [Tue, 26 Apr 2016 15:55:22 +0000 (17:55 +0200)]
mmc: sh_mobile_sdhi: don't use array for DT configs

We won't access an index based array to get our DT config, but create
separate structs instead. So, remove the array which only wastes memory.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: block: Convert to IDA for partition device indexes
Ulf Hansson [Thu, 7 Apr 2016 12:36:46 +0000 (14:36 +0200)]
mmc: block: Convert to IDA for partition device indexes

Instead of using an mmc specific implementation to deal with indexes
through a BITMAP, let's convert to use the IDA library.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: block: Release index in partition allocation error path
Ulf Hansson [Thu, 7 Apr 2016 12:23:23 +0000 (14:23 +0200)]
mmc: block: Release index in partition allocation error path

If the allocation of a new partition fails, let's make sure to also
release the previously picked device index.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: core: Convert from IDR to IDA for host indexes
Ulf Hansson [Thu, 7 Apr 2016 09:40:59 +0000 (11:40 +0200)]
mmc: core: Convert from IDR to IDA for host indexes

As IDA is more lightweight than IDR, let's convert to use that instead.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: use IS_ENABLE(CONFIG_LEDS_CLASS) to enable LED struct members
Masahiro Yamada [Thu, 14 Apr 2016 04:19:40 +0000 (13:19 +0900)]
mmc: sdhci: use IS_ENABLE(CONFIG_LEDS_CLASS) to enable LED struct members

defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)

is equivalent to:

IS_ENABLED(CONFIG_LEDS_CLASS)

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: use IS_REACHABLE(CONFIG_LEDS_CLASS) to enable LED code
Masahiro Yamada [Thu, 14 Apr 2016 04:19:39 +0000 (13:19 +0900)]
mmc: sdhci: use IS_REACHABLE(CONFIG_LEDS_CLASS) to enable LED code

defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
    defined(CONFIG_MMC_SDHCI_MODULE))

is equivalent to:

defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
    defined(MODULE))

and it can also be written shortly as:

IS_REACHABLE(CONFIG_LEDS_CLASS)

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: Remove SDHCI_SDR104_NEEDS_TUNING
Adrian Hunter [Wed, 20 Apr 2016 06:24:03 +0000 (09:24 +0300)]
mmc: sdhci: Remove SDHCI_SDR104_NEEDS_TUNING

SDHCI_SDR104_NEEDS_TUNING was originally named SDHCI_HS200_NEEDS_TUNING
and was added in commit 069c9f142822 ("mmc: host: Adds support for eMMC
4.5 HS200 mode").

That commit conflated SDHCI_SDR50_NEEDS_TUNING and SDHCI_HS200_NEEDS_TUNING
due to what appears to be misplaced parentheses.

Commit 156e14b126ff ("mmc: sdhci: fix caps2 for HS200") made HS200
configuration equivalent to SDR104 configuration, renaming
SDHCI_HS200_NEEDS_TUNING to SDHCI_SDR104_NEEDS_TUNING despite tuning for
HS200 now being non-optional.

The mix-up with SDHCI_SDR50_NEEDS_TUNING remained and became more obvious
after commit 4b6f37d3a379 ("mmc: sdhci: clean up sdhci_execute_tuning()
decision") where the author noted the patch was "reflecting what the
original code was doing, it shows that it may not be what the author
actually intended."

The way the code is currently written, SDHCI_SDR104_NEEDS_TUNING
causes tuning to be done always for SDR50 mode if SDR104 mode is
also supported by the host controller.  That makes no sense because
we already have capabilities bit SDHCI_USE_SDR50_TUNING and
corresponding flag SDHCI_SDR50_NEEDS_TUNING for that purpose.

Given the dubious origins of SDHCI_SDR104_NEEDS_TUNING, it seems
reasonable to remove it.  The benefit being SDR50 mode will now not
un-nessessarily do tuning.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-pltfm: call platform_get_irq() before sdhci_alloc_host()
Masahiro Yamada [Wed, 20 Apr 2016 02:16:31 +0000 (11:16 +0900)]
mmc: sdhci-pltfm: call platform_get_irq() before sdhci_alloc_host()

Swap the call order of sdhci_alloc_host() and platform_get_irq().
It makes sdhci_alloc_host() the last function that can fail in the
sdhci_pltfm_init().  So, we can drop the sdhci_free_host() call from
the failure path.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-pltfm: move devm_ioremap_resource() up
Masahiro Yamada [Wed, 20 Apr 2016 02:16:30 +0000 (11:16 +0900)]
mmc: sdhci-pltfm: move devm_ioremap_resource() up

Call devm_ioremap_resource() right after platform_get_resource().
This saves the error check of platform_get_resource() because
devm_ioremap_resource() checks if the given resource is NULL.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-pltfm: use devm_ioremap_resource()
Masahiro Yamada [Wed, 20 Apr 2016 02:16:29 +0000 (11:16 +0900)]
mmc: sdhci-pltfm: use devm_ioremap_resource()

The chain of devm_request_mem_region() and devm_ioremap() can be
replaced with devm_ioremap_resource().  Also, we can drop the error
messages because devm_ioremap_resource() displays similar messages
on error.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-pltfm: use devm_ioremap()
Masahiro Yamada [Wed, 20 Apr 2016 02:16:28 +0000 (11:16 +0900)]
mmc: sdhci-pltfm: use devm_ioremap()

Use the managed variant of ioremap().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-pltfm: use devm_request_mem_region()
Masahiro Yamada [Wed, 20 Apr 2016 02:16:27 +0000 (11:16 +0900)]
mmc: sdhci-pltfm: use devm_request_mem_region()

Use the managed variant of request_mem_region().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-pltfm: check return value of platform_get_irq()
Masahiro Yamada [Wed, 20 Apr 2016 02:16:26 +0000 (11:16 +0900)]
mmc: sdhci-pltfm: check return value of platform_get_irq()

The function platform_get_irq() can fail; it returns a negative error
code on failure.  A negative IRQ number will make sdhci_add_host() fail
to request IRQ anyway, but it makes sense to let it fail earlier here.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-pltfm: drop error message for too small MMIO resource size
Masahiro Yamada [Wed, 20 Apr 2016 02:16:25 +0000 (11:16 +0900)]
mmc: sdhci-pltfm: drop error message for too small MMIO resource size

The requirement resource_size >= 0x100 may not necessarily be
reasonable; for example, sdhci-dove appears to sidestep some
registers in sdhci_dove_readw().

Moreover, current code displays an error message for too small
resource size, but still moves forward.

Every DT should be responsible for describing its properties
correctly, so lets's remove this error message from the common
framework.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: core: drop unnecessary bit checking
Masahiro Yamada [Fri, 15 Apr 2016 11:16:12 +0000 (20:16 +0900)]
mmc: core: drop unnecessary bit checking

This if-block is going to call mmc_card_set_blockaddr(), so
mmc_card_blockaddr() right before it is redundant.

I am fixing the block comment style while I am here.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: pwrseq: convert to proper platform device
Srinivas Kandagatla [Thu, 14 Apr 2016 13:02:16 +0000 (14:02 +0100)]
mmc: pwrseq: convert to proper platform device

simple-pwrseq and emmc-pwrseq drivers rely on platform_device
structure from of_find_device_by_node(), this works mostly. But, as there
is no driver associated with this devices, cases like default/init pinctrl
setup would never be performed by pwrseq. This becomes problem when the
gpios used in pwrseq require pinctrl setup.

Currently most of the common pinctrl setup is done in
drivers/base/pinctrl.c by pinctrl_bind_pins().

There are two ways to solve this issue on either convert pwrseq drivers
to a proper platform drivers or copy the exact code from
pcintrl_bind_pins(). I prefer converting pwrseq to proper drivers so that
other cases like setting up clks/parents from dt would also be possible.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: pwrseq_emmc: add to_pwrseq_emmc() macro
Srinivas Kandagatla [Thu, 14 Apr 2016 13:02:15 +0000 (14:02 +0100)]
mmc: pwrseq_emmc: add to_pwrseq_emmc() macro

This patch adds to_pwrseq_emmc() macro to make the code more readable.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: pwrseq_simple: add to_pwrseq_simple() macro
Srinivas Kandagatla [Thu, 14 Apr 2016 13:02:14 +0000 (14:02 +0100)]
mmc: pwrseq_simple: add to_pwrseq_simple() macro

This patch adds to_pwrseq_simple() macro to make the code more readable.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: Tidy together LED code
Adrian Hunter [Tue, 12 Apr 2016 11:25:09 +0000 (14:25 +0300)]
mmc: sdhci: Tidy together LED code

ifdef's make the code more complicated and harder to read.
Move all the LED code together to reduce the ifdef's to
one place.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: Fix error paths in sdhci_add_host()
Adrian Hunter [Tue, 12 Apr 2016 11:25:08 +0000 (14:25 +0300)]
mmc: sdhci: Fix error paths in sdhci_add_host()

Some error paths in sdhci_add_host() simply returned without
cleaning up.  Also the return value from mmc_add_host()
was not being checked.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: Remove redundant condition
Adrian Hunter [Tue, 12 Apr 2016 11:25:07 +0000 (14:25 +0300)]
mmc: sdhci: Remove redundant condition

The logic '!mmc.f_max || (mmc.f_max && mmc.f_max > max_clk)'
is equivalent to '!mmc.f_max || mmc.f_max > max_clk'.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-acpi: Set MMC_CAP_AGGRESSIVE_PM for Broxton controllers
Adrian Hunter [Tue, 12 Apr 2016 11:25:06 +0000 (14:25 +0300)]
mmc: sdhci-acpi: Set MMC_CAP_AGGRESSIVE_PM for Broxton controllers

Set MMC_CAP_AGGRESSIVE_PM for Broxton host controllers.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-pci: Set MMC_CAP_AGGRESSIVE_PM for Broxton controllers
Adrian Hunter [Tue, 12 Apr 2016 11:25:05 +0000 (14:25 +0300)]
mmc: sdhci-pci: Set MMC_CAP_AGGRESSIVE_PM for Broxton controllers

Set MMC_CAP_AGGRESSIVE_PM for Broxton host controllers.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: Remove SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST
Ludovic Desroches [Thu, 7 Apr 2016 09:13:10 +0000 (11:13 +0200)]
mmc: sdhci: Remove SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST

SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST quirk is not used anymore so
remove it.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-of-at91: Implement specific ->set_clock() function
Ludovic Desroches [Thu, 7 Apr 2016 09:13:09 +0000 (11:13 +0200)]
mmc: sdhci-of-at91: Implement specific ->set_clock() function

Disabling the internal clock while configuring the SD card clock can
lead to internal clock stabilization issue and/or unexpected switch to
the base clock when using presets.
A quirk SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST was introduced to fix
these bugs. The cause was assumed to be a too long internal
re-synchronisation but it seems in some cases the delay (even if longer)
doesn't fix this bug. The safest workaround is to not disable/enable the
internal clock during the SD card clock configuration.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: Introduce sdhci_calc_clk()
Ludovic Desroches [Thu, 7 Apr 2016 09:13:08 +0000 (11:13 +0200)]
mmc: sdhci: Introduce sdhci_calc_clk()

In order to remove the SDHCI_QUIRK2_NEED_DELAY_AFTER_INT_CLK_RST and to
reduce code duplication, put the code relative to the SD clock
configuration in a function which can be used by hosts for the
implementation of the ->set_clock() callback.

Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: Move sdhci_runtime_pm_bus_off|on() to avoid pre-definition
Ulf Hansson [Mon, 11 Apr 2016 13:32:41 +0000 (15:32 +0200)]
mmc: sdhci: Move sdhci_runtime_pm_bus_off|on() to avoid pre-definition

There are no need to have two versions of sdhci_runtime_pm_bus_off|on(),
depending on whether CONFIG_PM is set or unset. Thus it's easy to move the
implementation of these functions a bit earlier to avoid the unnecessary
pre-definition of them, so let's do that.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
8 years agommc: sdhci-pic32: remove owner assignment
Masahiro Yamada [Fri, 8 Apr 2016 05:22:37 +0000 (14:22 +0900)]
mmc: sdhci-pic32: remove owner assignment

A platform_driver does not need to set an owner, it will be populated
by the driver core.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci: Remove redundant runtime PM calls
Ulf Hansson [Thu, 7 Apr 2016 08:56:39 +0000 (10:56 +0200)]
mmc: sdhci: Remove redundant runtime PM calls

Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.

Moreover as SDHCI have its own wrapper functions for runtime PM these
becomes superfluous, so let's remove them as well.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
8 years agommc: core: Do regular power cycle when lacking eMMC HW reset support
Gwendal Grignou [Fri, 1 Apr 2016 23:04:22 +0000 (16:04 -0700)]
mmc: core: Do regular power cycle when lacking eMMC HW reset support

The eMMC HW reset may be implemented either via the host ops ->hw_reset()
callback or through DT and the eMMC pwrseq. Additionally some eMMC cards
don't support HW reset.

To allow a reset to be done for the different combinations of mmc hosts
and eMMC/MMC cards, let's implement a fallback via trying a regular power
cycle. This improves the mmc block layer retry mechanism of failing I/O
requests.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
[Ulf: Rewrote changelog]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: Remove redundant runtime PM calls
Ulf Hansson [Mon, 21 Mar 2016 14:43:41 +0000 (15:43 +0100)]
mmc: tmio: Remove redundant runtime PM calls

Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.

Cc: Ian Molton <ian@mnementh.co.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-pci: Remove redundant runtime PM calls
Ulf Hansson [Mon, 21 Mar 2016 13:40:07 +0000 (14:40 +0100)]
mmc: sdhci-pci: Remove redundant runtime PM calls

Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sdhci-acpi: Remove redundant runtime PM calls
Ulf Hansson [Mon, 21 Mar 2016 13:33:35 +0000 (14:33 +0100)]
mmc: sdhci-acpi: Remove redundant runtime PM calls

Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: omap_hsmmc: Remove redundant runtime PM calls
Ulf Hansson [Mon, 21 Mar 2016 13:28:36 +0000 (14:28 +0100)]
mmc: omap_hsmmc: Remove redundant runtime PM calls

Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: mediatek: Remove redundant runtime PM calls
Ulf Hansson [Mon, 21 Mar 2016 13:21:25 +0000 (14:21 +0100)]
mmc: mediatek: Remove redundant runtime PM calls

Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.

Cc: Chaotian Jing <chaotian.jing@mediatek.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: mmci: Remove redundant runtime PM calls
Ulf Hansson [Mon, 21 Mar 2016 13:17:00 +0000 (14:17 +0100)]
mmc: mmci: Remove redundant runtime PM calls

Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.

Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: atmel-mci: Remove redundant runtime PM calls
Ulf Hansson [Mon, 21 Mar 2016 13:09:07 +0000 (14:09 +0100)]
mmc: atmel-mci: Remove redundant runtime PM calls

Commit 9250aea76bfc ("mmc: core: Enable runtime PM management of host
devices"), made some calls to the runtime PM API from the driver
redundant. Especially those which deals with runtime PM reference
counting, so let's remove them.

Cc: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Tested-by: Ludovic Desroches <ludovic.desroches@atmel.com>
8 years agoARM: davinci: remove mmc dma resources
David Lechner [Tue, 5 Apr 2016 17:31:51 +0000 (12:31 -0500)]
ARM: davinci: remove mmc dma resources

The davinci_mmc driver no longer uses platform resources for getting dma
channels. Instead lookup is now done using dma_slave_map.

Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: davinci: prepare clock
David Lechner [Tue, 5 Apr 2016 17:31:50 +0000 (12:31 -0500)]
mmc: davinci: prepare clock

When trying to use this driver with the common clock framework, enabling
the clock fails because it was not prepared. This fixes the problem by
calling clk_prepare and clk_enable in a single function. Ditto for
clk_disable_unprepare.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: davinci: fix unwinding in probe
David Lechner [Tue, 5 Apr 2016 17:31:49 +0000 (12:31 -0500)]
mmc: davinci: fix unwinding in probe

Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
not handled and not all paths unwound correctly. Also using devm_ where
possible to simplify things.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dw_mmc: remove setup_clock callback
Shawn Lin [Thu, 31 Mar 2016 07:34:10 +0000 (15:34 +0800)]
mmc: dw_mmc: remove setup_clock callback

Now, no dw_mmc variant drivers use this callback, let's
remove it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dw_mmc-exynos: remove dw_mci_exynos_setup_clock
Shawn Lin [Thu, 31 Mar 2016 07:34:02 +0000 (15:34 +0800)]
mmc: dw_mmc-exynos: remove dw_mci_exynos_setup_clock

We combine what dw_mci_exynos_setup_clock does with init
hook to simplify the code

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dw_mmc-rockchip: remove setup_clock for rockchip
Shawn Lin [Thu, 31 Mar 2016 07:33:53 +0000 (15:33 +0800)]
mmc: dw_mmc-rockchip: remove setup_clock for rockchip

We remove setup_clock hook and combine it into
init hook to simplify the code

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dw_mmc: exynos: add the function for controlling SMU
Jaehoon Chung [Thu, 31 Mar 2016 05:53:18 +0000 (14:53 +0900)]
mmc: dw_mmc: exynos: add the function for controlling SMU

Some of Exynos has the Security management Unit(SMU).
This patch adds the function for controlling SMU.

In future, if exynos needs to control SMU, it can be implemented
in "config_smu" function, not "init" function.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dw_mmc: remove unused EVENT_XFER_ERROR
Shawn Lin [Wed, 3 Feb 2016 03:26:04 +0000 (11:26 +0800)]
mmc: dw_mmc: remove unused EVENT_XFER_ERROR

EVENT_XFER_ERROR isn't been used now, so it can be removed.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dw_mmc: avoid using dmaengine_terminate_all
Shawn Lin [Wed, 9 Mar 2016 02:34:46 +0000 (10:34 +0800)]
mmc: dw_mmc: avoid using dmaengine_terminate_all

dmaengine_terminate_all is deprecated and should be
replaced by more explicit synchronous and asynchronous
terminate functions. This change is based on the
commit b36f09c3c441 ("dmaengine: Add transfer termination
synchronization support"). Currently dw_mci_stop_dma
may be called under the spinlock, let's migrate
dmaengine_terminate_all to async terminate. This could
avoid the race condition of use-after-free resouce of
dmaengine once slave-dma driver implement the synchronize
method.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dw_mmc: fix warning reported by kernel-doc
Shawn Lin [Wed, 9 Mar 2016 02:33:55 +0000 (10:33 +0800)]
mmc: dw_mmc: fix warning reported by kernel-doc

Try to fix the warning reported by:
scripts/kernel-doc -man -v include/linux/mmc/dw_mmc.h > /dev/null

warning: No description found for parameter 'irq_lock'
warning: No description found for parameter 'stop_abort'
warning: No description found for parameter 'prev_blksz'
warning: No description found for parameter 'timing'
warning: No description found for parameter 'ring_size'
warning: No description found for parameter 'dms'
warning: No description found for parameter 'phy_regs'
warning: No description found for parameter 'fifoth_val'
warning: No description found for parameter 'vqmmc_enabled'
warning: No description found for parameter 'cmd11_timer'
warning: Excess struct/union/enum/typedef member 'card_tasklet'
description in 'dw_mci'

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dw_mmc-rockchip: fix failing to mount partition with "discard"
Shawn Lin [Tue, 1 Mar 2016 07:12:53 +0000 (15:12 +0800)]
mmc: dw_mmc-rockchip: fix failing to mount partition with "discard"

Without MMC_CAP_ERASE support, we fail to mount partition
with "discard" option since mmc_queue_setup_discard is limited
for checking mmc_can_erase. Without doing mmc_queue_setup_discard,
blk_queue_discard fails to test QUEUE_FLAG_DISCARD flag, so we get
the following log from f2fs(actually similar to other file system):

mounting with "discard" option, but the device does not support discard

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: dw_mmc-rockchip: remove dw_mci_rockchip_pmops
Shawn Lin [Wed, 3 Feb 2016 03:26:44 +0000 (11:26 +0800)]
mmc: dw_mmc-rockchip: remove dw_mci_rockchip_pmops

dw_mci_rockchip_pmops just copy-paste what dw_mci_pltfm_pmops
have done. Let's remove it.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mobile_sdhi: Add UHS-I mode support
Wolfram Sang [Fri, 1 Apr 2016 15:44:37 +0000 (17:44 +0200)]
mmc: sh_mobile_sdhi: Add UHS-I mode support

Implement voltage switch, supporting modes up to SDR-50.

Based on work by Shinobu Uehara, Rob Taylor, William Towle and Ian Molton.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: host: add note that set_ios needs to handle 0Hz properly
Wolfram Sang [Fri, 1 Apr 2016 15:44:36 +0000 (17:44 +0200)]
mmc: host: add note that set_ios needs to handle 0Hz properly

While here, refactor the comments so that they are before the
declaration they are referring to.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: stop clock when 0Hz is requested
Wolfram Sang [Fri, 1 Apr 2016 15:44:35 +0000 (17:44 +0200)]
mmc: tmio: stop clock when 0Hz is requested

Setting frequency to 0 is not enough, the clock explicitly has to be
disabled. Otherwise voltage switching (which needs SDCLK to be quiet)
fails for various cards.

Because we now do the 'new_clock == 0' check right at the beginning,
the indentation level of the rest of the code can be decreased a little.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: always start clock after frequency calculation
Wolfram Sang [Fri, 1 Apr 2016 15:44:34 +0000 (17:44 +0200)]
mmc: tmio: always start clock after frequency calculation

Starting the clock is always done after frequency change anyhow, so we can
do it directly after the clock calculation and remove the specific calls.
This is the first part of doing proper clock de-/activation at calculation
time.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio: Add UHS-I mode support
Wolfram Sang [Fri, 1 Apr 2016 15:44:33 +0000 (17:44 +0200)]
mmc: tmio: Add UHS-I mode support

Based on work by Shinobu Uehara and Ben Dooks. This adds the voltage
switch operation needed for all UHS-I modes, but not the tuning needed
for SDR-104 which will come later.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio, sh_mobile_sdhi: Add support for variable input clock frequency
Ben Hutchings [Fri, 1 Apr 2016 15:44:32 +0000 (17:44 +0200)]
mmc: tmio, sh_mobile_sdhi: Add support for variable input clock frequency

Currently tmio_mmc assumes that the input clock frequency is fixed and
only its own clock divider can be changed.  This is not true in the
case of sh_mobile_sdhi; we can use the clock API to change it.

In tmio_mmc:
- Delegate setting of f_min from tmio to the clk_enable operation (if
  implemented), as it can be smaller than f_max / 512
- Add an optional clk_update operation called from tmio_mmc_set_clock()
  that updates the input clock frequency
- Rename tmio_mmc_clk_update() to tmio_mmc_clk_enable(), to avoid
  confusion with the clk_update operation

In sh_mobile_sdhi:
- Make the setting of f_max conditional; it should be set through the
  max-frequency property in the device tree in future
- Set f_min based on the input clock's minimum frequency
- Implement the clk_update operation, selecting the best input clock
  frequency for the bus frequency that's wanted

sh_mobile_sdhi_clk_update() is loosely based on Kuninori Morimoto's work
in sh_mmcif.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: tmio, sh_mobile_sdhi: Pass tmio_mmc_host ptr to clk_{enable, disable} ops
Ben Hutchings [Fri, 1 Apr 2016 15:44:31 +0000 (17:44 +0200)]
mmc: tmio, sh_mobile_sdhi: Pass tmio_mmc_host ptr to clk_{enable, disable} ops

Change the clk_enable operation to take a pointer to the struct
tmio_mmc_host and have it set f_max.  For consistency, also change the
clk_disable operation to take a pointer to struct tmio_mmc_host.

Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: core: Provide tracepoints for request processing
Baolin Wang [Thu, 31 Mar 2016 03:16:27 +0000 (11:16 +0800)]
mmc: core: Provide tracepoints for request processing

This patch provides some tracepoints for the lifecycle of a mmc request
from starting to completion to help with performance analysis of MMC
subsystem.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: omap_hsmmc: pass omap_hsmmc_host pointer directly
Andreas Fenkart [Sun, 20 Mar 2016 23:58:08 +0000 (00:58 +0100)]
mmc: omap_hsmmc: pass omap_hsmmc_host pointer directly

unnecessary indirection via 'struct device' back to omap_hsmmc_host

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: davinci: remove matching string
David Lechner [Thu, 17 Mar 2016 03:45:32 +0000 (22:45 -0500)]
mmc: davinci: remove matching string

The string "MMCSDCLK" is not actually used for clock lookup, so can be
removed.

Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: davinci_mmc: Use dma_request_chan() to requesting DMA channel
Peter Ujfalusi [Thu, 17 Mar 2016 03:45:31 +0000 (22:45 -0500)]
mmc: davinci_mmc: Use dma_request_chan() to requesting DMA channel

With the new dma_request_chan() the client driver does not need to look for
the DMA resource and it does not need to pass filter_fn anymore.
By switching to the new API the driver can now support deferred probing
against DMA.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mmci: Get rid of wrapper function for regulators
Ulf Hansson [Thu, 11 Feb 2016 12:59:55 +0000 (13:59 +0100)]
mmc: sh_mmci: Get rid of wrapper function for regulators

As there are two callers of sh_mmcif_set_power() and because its only
additional action is to check for a valid regulator, let's just remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mmcif: Restructure ->set_ios()
Ulf Hansson [Thu, 11 Feb 2016 12:59:54 +0000 (13:59 +0100)]
mmc: sh_mmcif: Restructure ->set_ios()

Both from a runtime PM and clock management point of view, the ->set_ios()
code is unnecessary complex.

A suboptimal path is also executed when the mmc core requests a clock rate
of zero. As that happens during the card initialization phase, trying to
save power by decreasing the runtime PM usage count and gating the clock
via clk_disable_unprepare() is just superfluous.

Moreover, from a runtime PM point of view the core will anyway keep the
device active during the entire card initialization phase.

Restructure the code to rely on the ios->power_mode to understand when the
runtime PM usage count needs to be increased. Let's also deal with clock
rate changes by simply applying the rate.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agommc: sh_mmcif: Make sure the device stays active when needed in ->probe()
Ulf Hansson [Thu, 11 Feb 2016 12:59:53 +0000 (13:59 +0100)]
mmc: sh_mmcif: Make sure the device stays active when needed in ->probe()

While accessing the device, make sure it stays active by increasing the
runtime PM usage count for it.

Let's also defer to enable runtime PM until we really need access to the
device. This also enables the error path in ->probe() to become simpler.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
8 years agoLinux 4.6-rc6
Linus Torvalds [Sun, 1 May 2016 22:52:31 +0000 (15:52 -0700)]
Linux 4.6-rc6

8 years agoMerge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
Linus Torvalds [Sun, 1 May 2016 01:57:42 +0000 (18:57 -0700)]
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal

Pull thermal fixes from Eduardo Valentin:
 "A couple of minor fixes for the thermal subsystem.

  Specifics in this pull request:

   - Fixes in hisilicon thermal driver
   - More fixes of unsigned to int type change in thermal_core.c"

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal:
  thermal: use %d to print S32 parameters
  thermal: hisilicon: increase temperature resolution