]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
10 years agommc: sdhci-msm: Add platform_execute_tuning implementation
Georgi Djakov [Mon, 10 Mar 2014 15:37:13 +0000 (17:37 +0200)]
mmc: sdhci-msm: Add platform_execute_tuning implementation

This patch adds implementation for platform specific tuning in order
to support HS200 bus speed mode on Qualcomm SDHCI controller.

Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Georgi Djakov <gdjakov@mm-sol.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-msm: Initial support for Qualcomm chipsets
Georgi Djakov [Mon, 10 Mar 2014 15:37:12 +0000 (17:37 +0200)]
mmc: sdhci-msm: Initial support for Qualcomm chipsets

This platform driver adds the initial support of Secure Digital Host
Controller Interface compliant controller found in Qualcomm chipsets.

Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Tested-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Georgi Djakov <gdjakov@mm-sol.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-msm: Qualcomm SDHCI binding documentation
Georgi Djakov [Mon, 10 Mar 2014 15:37:11 +0000 (17:37 +0200)]
mmc: sdhci-msm: Qualcomm SDHCI binding documentation

This patch adds the device-tree binding documentation for Qualcomm
SDHCI driver. It contains the differences between the core properties
in mmc.txt and the properties used by the sdhci-msm driver.

Signed-off-by: Georgi Djakov <gdjakov@mm-sol.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agosdhci: only reprogram retuning timer when flag is set
Arend van Spriel [Sat, 4 Jan 2014 12:51:26 +0000 (13:51 +0100)]
sdhci: only reprogram retuning timer when flag is set

When the host->tuning_count is zero it means that the retuning is
disabled. This is checked on the first run of sdhci_execute_tuning()
by the if statement below:

if (!(host->flags & SDHCI_NEEDS_RETUNING) && host->tuning_count &&
    (host->tuning_mode == SDHCI_TUNING_MODE_1)) {

So only when tuning_count is non-zero it will set the host flag
SDHCI_USING_RETUNING_TIMER. The else statement is only for re-programming
the timer, which means that flag must be set. Because that is not checked
the else statement is executed in the first run when tuning_count is zero.

This was seen on a host controller which indicated SDHCI_TUNING_MODE_1 (0)
and tuning_count being zero. Suspect that (one of) these registers is not
properly set.

Signed-off-by: Arend van Spriel <arend@broadcom.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: rename ARCH_BCM to ARCH_BCM_MOBILE
Christian Daudt [Mon, 23 Sep 2013 17:20:35 +0000 (10:20 -0700)]
mmc: rename ARCH_BCM to ARCH_BCM_MOBILE

Currently ARCH_BCM has been used for Broadcom Mobile V7 based SoCs.
In order to allow other Broadcom SoCs to also use mach-bcm directory and
files, this patch renames the original ARCH_BCM to ARCH_BCM_MOBILE, and
uses ARCH_BCM to define any Broadcom chip residing in mach-bcm directory.

Signed-off-by: Christian Daudt <bcm@fixthebug.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci: Allow for irq being shared
Adrian Hunter [Tue, 11 Mar 2014 08:09:36 +0000 (10:09 +0200)]
mmc: sdhci: Allow for irq being shared

If the SDHCI irq is shared with another device then the interrupt
handler can get called while SDHCI is runtime suspended.  That is
harmless but the warning message is not useful so remove it.  Also
returning IRQ_NONE is more appropriate.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-acpi: Add device id 80860F16
Adrian Hunter [Mon, 10 Mar 2014 13:02:43 +0000 (15:02 +0200)]
mmc: sdhci-acpi: Add device id 80860F16

Add ACPI HID 80860F16 as a host controller for a SD card.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-acpi: Fix broken card detect for ACPI HID 80860F14
Adrian Hunter [Mon, 10 Mar 2014 13:02:42 +0000 (15:02 +0200)]
mmc: sdhci-acpi: Fix broken card detect for ACPI HID 80860F14

Some 80860F14 devices do not support card detect and must rely
completely on GPIO.  Presently the card detect GPIO is used
only to wake-up from runtime suspend.  Change to using
mmc_gpioid_request_cd() which will cause the SDHCI driver to
prefer the GPIO to the host controller's native card detect.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: slot-gpio: Add GPIO descriptor based CD GPIO API
Adrian Hunter [Mon, 10 Mar 2014 13:02:41 +0000 (15:02 +0200)]
mmc: slot-gpio: Add GPIO descriptor based CD GPIO API

Add functions to request a CD GPIO using the GPIO descriptor API.
Note that the new request function is paired with mmc_gpiod_free_cd()
not mmc_gpio_free_cd().  Note also that it must be called prior to
mmc_add_host() otherwise the caller must also call
mmc_gpiod_request_cd_irq().

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: slot-gpio: Split out CD IRQ request into a separate function
Adrian Hunter [Mon, 10 Mar 2014 13:02:40 +0000 (15:02 +0200)]
mmc: slot-gpio: Split out CD IRQ request into a separate function

In preparation for adding a descriptor-based CD GPIO API, split out
CD IRQ request into a separate function.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: slot-gpio: Record GPIO descriptors instead of GPIO numbers
Adrian Hunter [Mon, 10 Mar 2014 13:02:39 +0000 (15:02 +0200)]
mmc: slot-gpio: Record GPIO descriptors instead of GPIO numbers

In preparation for adding a descriptor-based CD GPIO API, switch from
recording GPIO numbers to recording GPIO descriptors.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agoRevert "dts: socfpga: Add support for SD/MMC on the SOCFPGA platform"
Chris Ball [Mon, 17 Mar 2014 13:04:57 +0000 (09:04 -0400)]
Revert "dts: socfpga: Add support for SD/MMC on the SOCFPGA platform"

This reverts commit d9c3f5df539a8a74cc830b35838670fe0541fed1, which
should not have been merged via mmc-next.  It's in arm-soc instead now.

10 years agommc: sdhci-spear: use generic card detection gpio support
Russell King [Fri, 28 Feb 2014 21:32:49 +0000 (21:32 +0000)]
mmc: sdhci-spear: use generic card detection gpio support

sdhci has support for using GPIOs for card detection.  If we have a
GPIO specified, we can use that directly, without needing our own
interrupt handler.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-spear: remove support for power gpio
Russell King [Fri, 28 Feb 2014 21:32:44 +0000 (21:32 +0000)]
mmc: sdhci-spear: remove support for power gpio

None of this code is currently used: there are no definitions of
struct sdhci_plat_data in arch/arm, neither are there any DT properties
which use card_power_gpio/power_active_high/power_always_enb.  In any
case, slot power control should be rigged up via vmmc and the regulator
subsystem in the DT case.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-spear: simplify resource handling
Russell King [Fri, 28 Feb 2014 21:32:39 +0000 (21:32 +0000)]
mmc: sdhci-spear: simplify resource handling

Use devm_ioremap_resource() to simplify iomem resource handling in the
probe path.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-spear: fix platform_data usage
Russell King [Fri, 28 Feb 2014 21:32:34 +0000 (21:32 +0000)]
mmc: sdhci-spear: fix platform_data usage

sdhci-spear is unsafe should a probe fail or defer, since it overwrites
the platform_data with its own driver-private data.  It's trivial to
fix as SDHCI allows for driver-private data to be appended to its own
structure - we just need to arrange the code to allow this.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-spear: fix error handling paths for DT
Russell King [Fri, 28 Feb 2014 21:32:29 +0000 (21:32 +0000)]
mmc: sdhci-spear: fix error handling paths for DT

Fix the error handling paths for DT and simplify using the devm_* API
for clk_get().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-bcm-kona: fix build errors when built-in
Russell King [Tue, 4 Mar 2014 21:25:51 +0000 (16:25 -0500)]
mmc: sdhci-bcm-kona: fix build errors when built-in

`sdhci_bcm_kona_remove' referenced in section `.data' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o

Fixes: 058feb53666f ("mmc: sdhci-bcm-kona: make linker-section warning go away")
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Markus Mayer <markus.mayer@linaro.org>
Acked-by: Matt Porter <mporter@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: add autocmd23 support
Balaji T K [Tue, 21 Jan 2014 14:24:42 +0000 (19:54 +0530)]
mmc: omap_hsmmc: add autocmd23 support

Add support for autocmd23 support

Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: add cmd23 support
Balaji T K [Tue, 21 Jan 2014 14:24:42 +0000 (19:54 +0530)]
mmc: omap_hsmmc: add cmd23 support

Add set block count command support for close ended multiblock read/write.

Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: split dma setup
Balaji T K [Tue, 21 Jan 2014 14:24:42 +0000 (19:54 +0530)]
mmc: omap_hsmmc: split dma setup

split start dma function into setup and start dma to keep track of
host_cookie when cmd23 support is enabled along with async request.

Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: fix request done for sbc error case
Balaji T K [Tue, 21 Jan 2014 14:24:42 +0000 (19:54 +0530)]
mmc: omap_hsmmc: fix request done for sbc error case

mrq is not populated for set block count(cmd23) command.
Use block read/write mmc_commond pointer for request done and
avoid NULL pointer access in error case for sbc (cmd23).

Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: save clock rate to use in interrupt context
Balaji T K [Tue, 21 Jan 2014 14:24:42 +0000 (19:54 +0530)]
mmc: omap_hsmmc: save clock rate to use in interrupt context

clk_get_rate throws DEBUG_LOCKS_WARN_ON(in_interrupt()) warning
if called from interrupt context.
use cached clock rate in set_data_timeout, so that
set_data_timeout can be called from interrupt context.

Signed-off-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: remove redundant reset done
Balaji T K [Fri, 28 Feb 2014 13:38:24 +0000 (19:08 +0530)]
mmc: omap_hsmmc: remove redundant reset done

Remove redundant reset done check since omap hwmod layer ensures IP reset.

Signed-off-by: Balaji T K <balajitk@ti.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: fix return error code for of_get_hsmmc_pdata
Balaji T K [Fri, 28 Feb 2014 13:38:18 +0000 (19:08 +0530)]
mmc: omap_hsmmc: fix return error code for of_get_hsmmc_pdata

of_get_hsmmc_pdata returns a pointer, returning NULL is invalid,
return ERR_PTR for error case.

Signed-off-by: Balaji T K <balajitk@ti.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: remove pbias workaround
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
mmc: omap_hsmmc: remove pbias workaround

remove pbias workaround

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
Tested-by: Stefan Roese <sr@denx.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agoARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
ARM: OMAP: enable SYSCON and REGULATOR_PBIAS in omap2plus_defconfig

Enable REGULATOR_PBIAS needed for SD card on most OMAPs.

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
Tested-by: Stefan Roese <sr@denx.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agoARM: dts: add pbias dt node
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
ARM: dts: add pbias dt node

Add pbias regulator node as a child of system control
module - syscon.

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
Tested-by: Stefan Roese <sr@denx.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: adapt hsmmc to use pbias regulator
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
mmc: omap_hsmmc: adapt hsmmc to use pbias regulator

In DT case, PBAIS registers are programmed via regulator,
use regulator APIs to control PBIAS.

Signed-off-by: Balaji T K <balajitk@ti.com>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
Tested-by: Stefan Roese <sr@denx.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agoregulator: add pbias regulator support
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
regulator: add pbias regulator support

pbias register controls internal power supply to sd card i/o pads
in most OMAPs (OMAP2-5, DRA7).
Control bits for selecting voltage level and
enabling/disabling are in the same PBIAS register.

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Mark Brown <broonie@linaro.org>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
Tested-by: Stefan Roese <sr@denx.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: handle vcc and vcc_aux independently
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
mmc: omap_hsmmc: handle vcc and vcc_aux independently

handle vcc and vcc_aux independently to reduce indent.

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
Tested-by: Stefan Roese <sr@denx.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: use devm_regulator API
Balaji T K [Wed, 19 Feb 2014 14:56:40 +0000 (20:26 +0530)]
mmc: omap_hsmmc: use devm_regulator API

Use devm_regulator API, while at it use
devm_regulator_get_optional for optional vmmc_aux supply

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Florian Vaussard <florian.vaussard@epfl.ch>
Tested-by: Stefan Roese <sr@denx.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: support more DT properties
Daniel Mack [Mon, 17 Feb 2014 11:36:33 +0000 (12:36 +0100)]
mmc: omap_hsmmc: support more DT properties

This should probably be done implicitly through mmc_of_parse(), but that
doesn't play well along with the multi-slot model the hsmmc driver
features. Hence, for now, do it manually. The properties are already
documented in Documentation/devicetree/bindings/mmc/mmc.txt.

Signed-off-by: Daniel Mack <zonque@gmail.com>
Acked-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agoARM: dts: omap3-ldp: fix mmc configuration
Nishanth Menon [Fri, 14 Feb 2014 05:45:49 +0000 (23:45 -0600)]
ARM: dts: omap3-ldp: fix mmc configuration

MMC1 is the only MMC interface available on the platform. Further,
since the platform is based on older revision of SoC which is not
capable of doing multi-block reads, mark it with compatibility for the
same and add pinmux to ensure that all relevant pins are configured
for non-MMC boot mode.

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: Add support for quirky omap3 hsmmc controller
Nishanth Menon [Fri, 14 Feb 2014 05:45:48 +0000 (23:45 -0600)]
mmc: omap_hsmmc: Add support for quirky omap3 hsmmc controller

When device is booted using devicetree, platforms impacted by Erratum
2.1.1.128 is not detected easily in the mmc driver. This erratum
indicates that the module cannot do multi-block transfers. Platforms
such as LDP which use OMAP3 ES revision prior to ES3.0 are impacted by
this.

Provide a new compatible property "ti,omap3-pre-es3-hsmmc" to allow
driver to determine if driver needs to implement quirks associated
with the specific module version (primarily because the IP revision
information is not sufficient for the same).

Signed-off-by: Nishanth Menon <nm@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap_hsmmc: remove a duplicative test
Dan Carpenter [Thu, 30 Jan 2014 12:15:18 +0000 (15:15 +0300)]
mmc: omap_hsmmc: remove a duplicative test

Static checkers complain that testing for both "next" and "!next" is
duplicative.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Balaji T K <balajitk@ti.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: dw_mmc: fix possible build error
Felipe Balbi [Tue, 25 Feb 2014 14:57:44 +0000 (08:57 -0600)]
mmc: dw_mmc: fix possible build error

Fix the following build errors:

drivers/mmc/host/dw_mmc-k3.c: In function ‘dw_mci_k3_suspend’:
drivers/mmc/host/dw_mmc-k3.c:58:2: error: implicit declaration of
function ‘dw_mci_suspend’ [-Werror=implicit-function-declaration]
  ret = dw_mci_suspend(host);
  ^
drivers/mmc/host/dw_mmc-k3.c: In function ‘dw_mci_k3_resume’:
drivers/mmc/host/dw_mmc-k3.c:76:2: error: implicit declaration of
function ‘dw_mci_resume’ [-Werror=implicit-function-declaration]
  return dw_mci_resume(host);
  ^
drivers/mmc/host/dw_mmc-k3.c: At top level:
drivers/mmc/host/dw_mmc-k3.c:53:12: warning: ‘dw_mci_k3_suspend’ defined
but not used [-Wunused-function]
 static int dw_mci_k3_suspend(struct device *dev)
            ^
drivers/mmc/host/dw_mmc-k3.c:65:12: warning: ‘dw_mci_k3_resume’ defined
but not used [-Wunused-function]
 static int dw_mci_k3_resume(struct device *dev)
            ^

Signed-off-by: Felipe Balbi <balbi@ti.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-s3c: Do not allow frequencies higher than requested
Tomasz Figa [Sat, 11 Jan 2014 21:39:06 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Do not allow frequencies higher than requested

This patch modifies sdhci_s3c_consider_clock() to fail if bus clock
being considered can not provide frequency lower or equal requested,
instead of returning the lowest supported.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by; Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-s3c: Fix handling of bus clock switching
Tomasz Figa [Sat, 11 Jan 2014 21:39:05 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Fix handling of bus clock switching

Currently the driver assumes at probe that controller is configured for
last valid enumerated bus clock. This assumption is completely wrong, as
there is no way to ensure such configuration until the hardware gets
first configured (by calling sdhci_s3c_set_clock()).

This patch modifies the driver to set current clock at probe to unknown
state (represented by negative value) and make sure that the hardware
gets actually configured to selected clock in sdhci_s3c_set_clock().

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by; Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-s3c: Simplify min/max clock calculation
Tomasz Figa [Sat, 11 Jan 2014 21:39:04 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Simplify min/max clock calculation

This patch reimplements functions calculating minimum and maximum clock
rates to leverage clock rate cache introduced by previous patches.

In addition, the calculation is simplified to just comparing input
clock rates (max case) or input clock rates divided by maximum divisor
(min case), which is basically what the original code did, but with much
more unnecessary work.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by; Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-s3c: Use correct condition to check for clock presence
Tomasz Figa [Sat, 11 Jan 2014 21:39:03 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Use correct condition to check for clock presence

IS_ERR() must be used to make sure that not a valid clock was returned
by clk_get() and company.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by; Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-s3c: Cache bus clock rates
Tomasz Figa [Sat, 11 Jan 2014 21:39:02 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Cache bus clock rates

To fix scheduling while atomic happening in sdhci_s3c_set_clock() caused
by calling clk_get_rate() that might sleep, this patch modifies the
driver to cache rates of all bus clocks at probe time and then only use
those cache values.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by; Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-s3c: Use shifts to divide by powers of two
Tomasz Figa [Sat, 11 Jan 2014 21:39:01 +0000 (22:39 +0100)]
mmc: sdhci-s3c: Use shifts to divide by powers of two

Current implementation of sdhci_s3c_consider_clock() is highly
inefficient due to multiple integer divisions by variable performed in a
loop. Since only divisors that are powers of two are considered, this
patch replaces them with respective shifts, removing all the integer
divisions.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by; Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agodts: socfpga: Add support for SD/MMC on the SOCFPGA platform
Dinh Nguyen [Tue, 18 Feb 2014 02:31:02 +0000 (20:31 -0600)]
dts: socfpga: Add support for SD/MMC on the SOCFPGA platform

Introduce "altr,socfpga-dw-mshc" to enable Altera's SOCFPGA platform
specific implementation of the dw_mmc driver.

Also add the "syscon" binding to the "altr,sys-mgr" node. The clock
driver can use the syscon driver to toggle the register for the SD/MMC
clock phase shift settings.

Finally, fix an indentation error for the sysmgr node.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Acked-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Tested-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: dw_mmc: Add support for SOCFPGA's platform specific implementation
Dinh Nguyen [Tue, 18 Feb 2014 02:31:01 +0000 (20:31 -0600)]
mmc: dw_mmc: Add support for SOCFPGA's platform specific implementation

Like the rockchip, Altera's SOCFPGA platform specific implementation of the
dw_mmc driver requires using the HOLD register for SD commands. This patch
renames dw_mci_rockchip_prepare_command to dw_mci_pltfm_prepare_command so
that SOCFPGA and Rockchip can use it.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Acked-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Tested-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: dw_mmc-socfpga: Remove the SOCFPGA specific platform for dw_mmc
Dinh Nguyen [Tue, 18 Feb 2014 02:31:00 +0000 (20:31 -0600)]
mmc: dw_mmc-socfpga: Remove the SOCFPGA specific platform for dw_mmc

It turns now that the only really platform specific code that is needed for
SOCFPGA is using the SDMMC_CMD_USE_HOLD_REG in the prepare_command function.
Since the Rockchip already has this functionality, re-use the code that is
already in dw_mmc-pltfm.c.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Tested-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: dw_mmc: Fix NULL pointer dereference
Sachin Kamat [Tue, 25 Feb 2014 09:48:28 +0000 (15:18 +0530)]
mmc: dw_mmc: Fix NULL pointer dereference

If mrq->sbc is not NULL but data->stop happens to be NULL,
it will lead to NULL pointer dereferencing. Avoid this by
having a NULL check for data->stop.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: mvsdio: Cleanup mmc-mvsdio.h header
Sachin Kamat [Tue, 25 Feb 2014 09:48:27 +0000 (15:18 +0530)]
mmc: mvsdio: Cleanup mmc-mvsdio.h header

Commit c02cecb92ed4 ("ARM: orion: move platform_data definitions")
moved the file to the current location but forgot to remove the pointer
to its previous location. Clean it up. While at it also change the header
file protection macros appropriately.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: msm: Cleanup mmc-msm_sdcc.h header
Sachin Kamat [Tue, 25 Feb 2014 09:48:26 +0000 (15:18 +0530)]
mmc: msm: Cleanup mmc-msm_sdcc.h header

Commit 1ef21f6343ff ("ARM: msm: move platform_data definitions")
moved the file to the current location but forgot to remove the pointer
to its previous location. Clean it up. While at it also change the header
file protection macros appropriately.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: dw_mmc: Add missing description
Sachin Kamat [Tue, 25 Feb 2014 09:48:25 +0000 (15:18 +0530)]
mmc: dw_mmc: Add missing description

Commit 0976f16d ("mmc: dw_mmc: add support tuning scheme") introduced
the execute_tuning hook but did not add its description for kernel docs.
Update the same.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-dove: Remove redundant of_match_ptr
Sachin Kamat [Tue, 25 Feb 2014 09:48:24 +0000 (15:18 +0530)]
mmc: sdhci-dove: Remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: dw_mmc: Remove redundant of_match_ptr
Sachin Kamat [Tue, 25 Feb 2014 09:48:23 +0000 (15:18 +0530)]
mmc: dw_mmc: Remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: davinci: Remove redundant of_match_ptr
Sachin Kamat [Tue, 25 Feb 2014 09:48:22 +0000 (15:18 +0530)]
mmc: davinci: Remove redundant of_match_ptr

The data structure of_match_ptr() protects is always compiled in.
Hence of_match_ptr() is not needed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-spear: Fix NULL pointer dereference
Sachin Kamat [Tue, 25 Feb 2014 09:48:21 +0000 (15:18 +0530)]
mmc: sdhci-spear: Fix NULL pointer dereference

pdata could be NULL if cd_gpio = -1. Dereference pdata only
if it is not NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: wmt-sdmmc: Fix NULL pointer dereference
Sachin Kamat [Tue, 25 Feb 2014 09:48:20 +0000 (15:18 +0530)]
mmc: wmt-sdmmc: Fix NULL pointer dereference

'of_id' is dereferenced before NULL pointer check. Move it to
after the check.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: ushc: Fix incorrect parameter in sizeof
Sachin Kamat [Tue, 25 Feb 2014 09:48:19 +0000 (15:18 +0530)]
mmc: ushc: Fix incorrect parameter in sizeof

sizeof should be of the parent structure type.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci-bcm-kona: Add basic use of clocks
Tim Kryger [Thu, 5 Dec 2013 19:20:41 +0000 (11:20 -0800)]
mmc: sdhci-bcm-kona: Add basic use of clocks

Enable the external clock needed by the host controller during the
probe and disable it during the remove.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: mmci: Enable support for busy detection for ux500 variant
Ulf Hansson [Mon, 13 Jan 2014 15:49:31 +0000 (16:49 +0100)]
mmc: mmci: Enable support for busy detection for ux500 variant

The ux500 variants have HW busy detection support, which is indicated
by the busy_detect flag. For these variants let's enable the
MMC_CAP_WAIT_WHILE_BUSY flag and add the support for it.

The mmc core will provide the RSP_BUSY command flag for those requests
we should care about busy detection. Regarding the max_busy_timeout,
the HW don't support busy detection timeouts so at this initial step
let's make it simple and set it to zero to indicate we are able to
support any timeout.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: Johan Rudholm <jrudholm@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: mmci: Handle CMD irq before DATA irq
Ulf Hansson [Fri, 10 Jan 2014 13:51:42 +0000 (14:51 +0100)]
mmc: mmci: Handle CMD irq before DATA irq

In case of a read operation both MCI_CMDRESPEND and MCI_DATAEND can be
set in the status register when entering the interrupt handler. This is
due to that the card start sending data before the host has
acknowledged the command response.

To resolve the issue for this scenario, we must start by handling the
CMD irq instead of the DATA irq. The reason is beacuse the completion
of the DATA irq will not respect the current command and then causing
it to be garbled.

Cc: Russell King <linux@arm.linux.org.uk>
Cc: Johan Rudholm <jrudholm@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: block: Fixup busy detection while invoking stop cmd at recovery
Ulf Hansson [Tue, 14 Jan 2014 20:31:35 +0000 (21:31 +0100)]
mmc: block: Fixup busy detection while invoking stop cmd at recovery

When sending a stop command at the recovery path, use a R1B response
when the failing data request are a WRITE. Thus we also care about the
busy detection completion in this case.

For a failing READ request, we use a R1 response for the stop command,
since we don't need to care about busy detection in this case.

To align behavior between hosts supporting MMC_CAP_WAIT_WHILE_BUSY and
those who are not, we add a CMD13 polling method for the card's status.

We also respect whether the host has specified the max_busy_timeout,
which means we may fallback to CMD13 polling if the timeout is greater
than what the host are able to support.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: block: Respect hw busy detection in card_busy_detect()
Ulf Hansson [Wed, 29 Jan 2014 12:11:27 +0000 (13:11 +0100)]
mmc: block: Respect hw busy detection in card_busy_detect()

Currently for write request we don't trust the hw busy detection to be
fully handled by host, thus we also poll the card's status until we see
it's gets out of the busy state.

Still there are scenarios where it will a benefit to trust the hw busy
detection done by the host, since no additional polling is needed.
Let's prepare card_busy_detect() to be able to handle this.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: block: Implement card_busy_detect() for busy detection
Ulf Hansson [Wed, 29 Jan 2014 10:01:55 +0000 (11:01 +0100)]
mmc: block: Implement card_busy_detect() for busy detection

To complete a data write request we poll for the card's status register
by sending CMD13. The are other scenarios when this polling method are
needed, which is why we here moves this code to it's own function. No
functional change.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: block: Use R1 responses for stop cmds for read requests
Ulf Hansson [Tue, 14 Jan 2014 20:24:21 +0000 (21:24 +0100)]
mmc: block: Use R1 responses for stop cmds for read requests

While using open ended transmission and thus ending the transfer by
sending a stop command, we shall use R1B only for writes and R1 shall
be used for reads. Previously R1B were used in both cases.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Respect host's max_busy_timeout when sending sleep cmd
Ulf Hansson [Tue, 14 Jan 2014 22:17:36 +0000 (23:17 +0100)]
mmc: core: Respect host's max_busy_timeout when sending sleep cmd

When sending the sleep command for host drivers supporting
MMC_CAP_WAIT_WHILE_BUSY, we need to confirm that max_busy_timeout is
big enough comparing to the sleep timeout specified from card's
EXT_CSD. If this isn't case, we use a R1 response instead of R1B and
fallback to use a delay instead.

Do note that a max_busy_timeout set to zero by the host, is interpreted
as it can cope with whatever timeout the mmc core provides it with.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Use generic CMD6 time while switching to eMMC HS200 mode
Ulf Hansson [Tue, 14 Jan 2014 16:36:21 +0000 (17:36 +0100)]
mmc: core: Use generic CMD6 time while switching to eMMC HS200 mode

Conform to the eMMC spec and use the CMD6 generic timeout from the
EXT_CSD register, when switching to HS200 mode.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Fixup busy detection for mmc switch operations
Ulf Hansson [Tue, 28 Jan 2014 13:15:34 +0000 (14:15 +0100)]
mmc: core: Fixup busy detection for mmc switch operations

If the host controller supports busy detection in HW, we expect the
MMC_CAP_WAIT_WHILE_BUSY to be set. Likewise the corresponding
host->max_busy_timeout should reflect the maximum busy detection
timeout supported by the host.

Previously we expected a host that supported MMC_CAP_WAIT_WHILE_BUSY to
cope with any timeout, which just isn't feasible due to HW limitations.

For most switch operations, R1B responses are expected and thus we need
to check for busy detection completion. To cope with cases where the
requested busy detection timeout is greater than what the host are able
to support, we fallback to use a R1 response instead. This will prevent
the host from doing HW busy detection.

In those cases, busy detection completion is handled by polling the for
the card's status using CMD13. This is the same mechanism used when the
host doesn't support MMC_CAP_WAIT_WHILE_BUSY.

Do note, a host->max_busy_timeout set to zero, is interpreted by the
mmc core as it don't know what the host supports. It will then provide
the host with whatever timeout the mmc core finds suitable.

For some cases the mmc core has unfurtunate no clue of what timeout to
use. In these cases we provide the host with a timeout value of zero,
which the host may interpret as use whatever timeout it finds suitable.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Minor simplifications to __mmc_switch
Ulf Hansson [Tue, 28 Jan 2014 13:05:39 +0000 (14:05 +0100)]
mmc: core: Minor simplifications to __mmc_switch

Instead of using several references to card->host, let's use a local
variable. That means we can remove the BUG_ON verifications for the
same pointers.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Add ignore_crc flag to __mmc_switch
Ulf Hansson [Wed, 8 Jan 2014 15:09:33 +0000 (16:09 +0100)]
mmc: core: Add ignore_crc flag to __mmc_switch

Instead of handle specific adaptations, releated to certain switch
operations, inside __mmc_switch, push this to be handled by the caller
instead.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Rename cmd_timeout_ms to busy_timeout
Ulf Hansson [Wed, 8 Jan 2014 14:06:08 +0000 (15:06 +0100)]
mmc: core: Rename cmd_timeout_ms to busy_timeout

To better reflect that the cmd_timeout_ms is directly related to the
busy detection timeout, let's rename it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Rename max_discard_to to max_busy_timeout
Ulf Hansson [Wed, 18 Dec 2013 08:57:38 +0000 (09:57 +0100)]
mmc: core: Rename max_discard_to to max_busy_timeout

Rename host->max_discard_to to host->max_busy_timeout, to reflect that
it tells the mmc core layer about the maximum supported busy detection
timeout by the host.

This timeout is at the moment only applicable to erase/trim/discard
commands. By the renaming we provide the option of make use of it for
other commands that cares about busy detection. In other words, those
commands that wants an R1B response, like for example the mmc switch
command.

Do note that the max_busy_timeout is supposed to be specified only by
hosts supporting MMC_CAP_WAIT_WHILE_BUSY.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agoMAINTAINERS: Add maintainer for the mmc subsystem
Ulf Hansson [Tue, 18 Feb 2014 23:01:05 +0000 (00:01 +0100)]
MAINTAINERS: Add maintainer for the mmc subsystem

Put myself as a (co)maintainer of the mmc subsystem to help out Chris
Ball in a more official role.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Add DT bindings for eMMC HS200 1.8/1.2V
Jaehoon Chung [Fri, 14 Feb 2014 12:27:09 +0000 (13:27 +0100)]
mmc: core: Add DT bindings for eMMC HS200 1.8/1.2V

Provide the option to configure these speed modes per host, for those
host driver's that can't distinguish this in runtime.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Add DT bindings for eMMC high-speed DDR 1.8/1.2V
Ulf Hansson [Fri, 14 Feb 2014 12:27:08 +0000 (13:27 +0100)]
mmc: core: Add DT bindings for eMMC high-speed DDR 1.8/1.2V

Provide the option to configure these speed modes per host, for those
host driver's that can't distinguish this in runtime.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Add DT bindings for SD card's UHS bus speed modes
Ulf Hansson [Fri, 14 Feb 2014 12:27:07 +0000 (13:27 +0100)]
mmc: core: Add DT bindings for SD card's UHS bus speed modes

Provide the option to configure these speed modes per host, for those
host driver's that can't distinguish this in runtime.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: rtsx: add support for pre_req and post_req
Micky Ching [Mon, 17 Feb 2014 08:45:48 +0000 (16:45 +0800)]
mmc: rtsx: add support for pre_req and post_req

Add support for non-blocking request, pre_req() runs dma_map_sg() and
post_req() runs dma_unmap_sg(). This patch can increase card read/write
speed, especially for high speed card and slow CPU(for some embedded
platform).

Users can get a great benefit from this patch. if CPU frequency is 800MHz,
SDR104 or DDR50 card read/write speed may increase more than 15%.

test results:
intel i3(800MHz - 2.3GHz), SD card clock 208MHz

performance mode(2.3GHz):
Before:
dd if=/dev/mmcblk0p1 of=/dev/null bs=64k count=1024
67108864 bytes (67 MB) copied, 1.18191 s, 56.8 MB/s
After:
 dd if=/dev/mmcblk0p1 of=/dev/null bs=64k count=1024
67108864 bytes (67 MB) copied, 1.09276 s, 61.4 MB/s

powersave mode(800MHz):
Before:
dd if=/dev/mmcblk0p1 of=/dev/null bs=64k count=1024
67108864 bytes (67 MB) copied, 1.29569 s, 51.8 MB/s
After:
dd if=/dev/mmcblk0p1 of=/dev/null bs=64k count=1024
67108864 bytes (67 MB) copied, 1.11218 s, 60.3 MB/s

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: rtsx: modify phase searching method for tuning
Micky Ching [Mon, 17 Feb 2014 08:45:47 +0000 (16:45 +0800)]
mmc: rtsx: modify phase searching method for tuning

The new phase searching method is more concise and easier to
understand.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: rtsx: fix card poweroff bug
Micky Ching [Mon, 17 Feb 2014 08:45:46 +0000 (16:45 +0800)]
mmc: rtsx: fix card poweroff bug

If the host driver removed while card in the slot, the host will not
power off card power correctly. This bug is produced because host
eject flag set before the last mmc_set_ios callback, we should set the
eject flag after power off.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhci: add support for realtek rts5250
Micky Ching [Fri, 21 Feb 2014 10:40:35 +0000 (18:40 +0800)]
mmc: sdhci: add support for realtek rts5250

Add support for realtek rts5250 pci card reader. The card reader has
some problems with DDR50 mode, so add a new quirks2 for broken ddr50.

Signed-off-by: Micky Ching <micky_ching@realsil.com.cn>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap: Add erase capability
Jarkko Nikula [Sat, 22 Feb 2014 16:01:43 +0000 (18:01 +0200)]
mmc: omap: Add erase capability

This patch adds the erase capability to OMAP1/OMAP2420 MMC driver. Idea is
the same than in commit 93caf8e ("omap_hsmmc: add erase capability") that we
disable the data timeout interrupt for erases.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap: Remove always set use_dma flag from struct mmc_omap_host
Jarkko Nikula [Sat, 22 Feb 2014 16:01:42 +0000 (18:01 +0200)]
mmc: omap: Remove always set use_dma flag from struct mmc_omap_host

Because use_dma is set only in mmc_omap_probe and unset nowhere there is no
need to carry that flag in struct mmc_omap_host for mmc_omap_prepare_data
function.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap: Convert to devm_ioremap_resource
Jarkko Nikula [Sat, 22 Feb 2014 16:01:41 +0000 (18:01 +0200)]
mmc: omap: Convert to devm_ioremap_resource

Simplify probe and cleanup code by using devm_ioremap_resource. This also
makes probe code to follow more common allocate private struct followed by
other initialization style.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap: Remove mem_res field from struct mmc_omap_host
Jarkko Nikula [Sat, 22 Feb 2014 16:01:40 +0000 (18:01 +0200)]
mmc: omap: Remove mem_res field from struct mmc_omap_host

Field mem_res in struct mmc_omap_host is used only once in mmc_omap_probe
when setting the phys_base field so we may just se the phys_base straight
and remove needless mem_res.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap: Remove duplicate host->irq assignment
Jarkko Nikula [Sat, 22 Feb 2014 16:01:39 +0000 (18:01 +0200)]
mmc: omap: Remove duplicate host->irq assignment

host-irq is set twice so remove needless one.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap: Convert to devm_kzalloc
Jarkko Nikula [Sat, 22 Feb 2014 16:01:38 +0000 (18:01 +0200)]
mmc: omap: Convert to devm_kzalloc

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet
Jarkko Nikula [Sat, 22 Feb 2014 16:01:37 +0000 (18:01 +0200)]
mmc: omap: Fix NULL pointer dereference due uninitialized cover_tasklet

Omap MMC driver initialization can cause a NULL pointer dereference in
tasklet_hi_action on Nokia N810 if its miniSD cover is open during driver
initialization.

[    1.070000] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[    1.080000] pgd = c0004000
[    1.080000] [00000000] *pgd=00000000
[    1.080000] Internal error: Oops: 80000005 [#1] PREEMPT ARM
[    1.080000] Modules linked in:
[    1.080000] CPU: 0 PID: 24 Comm: kworker/0:1 Not tainted 3.13.0-rc2+ #95
[    1.080000] Workqueue: events menelaus_work
[    1.080000] task: c7863340 ti: c7878000 task.ti: c7878000
[    1.080000] PC is at 0x0
[    1.080000] LR is at tasklet_hi_action+0x68/0xa4
...
[    1.080000] [<c003543c>] (tasklet_hi_action+0x68/0xa4) from [<c0034dd0>] (__do_softirq+0xbc/0x208)
[    1.080000] [<c0034dd0>] (__do_softirq+0xbc/0x208) from [<c003521c>] (irq_exit+0x84/0xac)
[    1.080000] [<c003521c>] (irq_exit+0x84/0xac) from [<c00135cc>] (handle_IRQ+0x64/0x84)
[    1.080000] [<c00135cc>] (handle_IRQ+0x64/0x84) from [<c000859c>] (omap2_intc_handle_irq+0x54/0x68)
[    1.080000] [<c000859c>] (omap2_intc_handle_irq+0x54/0x68) from [<c0015be0>] (__irq_svc+0x40/0x74)
[    1.080000] Exception stack(0xc7879d70 to 0xc7879db8)
[    1.080000] 9d60:                                     000003f1 0000000a 00000009 0000001c
[    1.080000] 9d80: c7879e70 c780bc10 c780bc10 00000000 00000001 00008603 c780bc78 c7879e4e
[    1.080000] 9da0: 00000002 c7879db8 c00343b0 c0160c9c 20000113 ffffffff
[    1.080000] [<c0015be0>] (__irq_svc+0x40/0x74) from [<c0160c9c>] (__aeabi_uidiv+0x20/0x9c)
[    1.080000] [<c0160c9c>] (__aeabi_uidiv+0x20/0x9c) from [<c00343b0>] (msecs_to_jiffies+0x18/0x24)
[    1.080000] [<c00343b0>] (msecs_to_jiffies+0x18/0x24) from [<c01ec3ec>] (omap_i2c_xfer+0x30c/0x458)
[    1.080000] [<c01ec3ec>] (omap_i2c_xfer+0x30c/0x458) from [<c01e9724>] (__i2c_transfer+0x3c/0x74)
[    1.080000] [<c01e9724>] (__i2c_transfer+0x3c/0x74) from [<c01eac4c>] (i2c_transfer+0x78/0x94)
[    1.080000] [<c01eac4c>] (i2c_transfer+0x78/0x94) from [<c01eb0bc>] (i2c_smbus_xfer+0x3c0/0x4f8)
[    1.080000] [<c01eb0bc>] (i2c_smbus_xfer+0x3c0/0x4f8) from [<c01eb414>] (i2c_smbus_write_byte_data+0x34/0x3c)
[    1.080000] [<c01eb414>] (i2c_smbus_write_byte_data+0x34/0x3c) from [<c01bb308>] (menelaus_write_reg+0x1c/0x40)
[    1.080000] [<c01bb308>] (menelaus_write_reg+0x1c/0x40) from [<c01bb904>] (menelaus_work+0xa0/0xc4)
[    1.080000] [<c01bb904>] (menelaus_work+0xa0/0xc4) from [<c00439c4>] (process_one_work+0x1fc/0x334)
[    1.080000] [<c00439c4>] (process_one_work+0x1fc/0x334) from [<c0043d6c>] (worker_thread+0x244/0x380)
[    1.080000] [<c0043d6c>] (worker_thread+0x244/0x380) from [<c0049d04>] (kthread+0xc0/0xd4)
[    1.080000] [<c0049d04>] (kthread+0xc0/0xd4) from [<c0012758>] (ret_from_fork+0x14/0x3c)
[    1.080000] Code: bad PC value
[    1.090000] ---[ end trace 7bc2fc7cd14f1d95 ]---
[    1.100000] Kernel panic - not syncing: Fatal exception in interrupt

Reason for this is that omap_notify_cover_event which calls
tasklet_hi_schedule gets called before struct cover_tasklet is initialized.

Call to omap_notify_cover_event on Nokia N810 happens from menelaus.c PMIC
driver via board-n8x0.c during execution of mmc_add_host in case of open
miniSD cover.

Fix this by moving cover_timer and cover_tasklet initialization before
mmc_add_host call in mmc_omap_new_slot.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhi: update sh_mobile_sdhi_of_data for r8a7791
Kuninori Morimoto [Fri, 21 Feb 2014 00:55:40 +0000 (16:55 -0800)]
mmc: sdhi: update sh_mobile_sdhi_of_data for r8a7791

This patch adds DT support for r8a7791.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhi: update sh_mobile_sdhi_of_data for r8a7790
Kuninori Morimoto [Fri, 21 Feb 2014 00:55:27 +0000 (16:55 -0800)]
mmc: sdhi: update sh_mobile_sdhi_of_data for r8a7790

This patch updates r8a7790 DT data to have SoC specific settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhi: update sh_mobile_sdhi_of_data for r8a7779
Kuninori Morimoto [Fri, 21 Feb 2014 00:55:12 +0000 (16:55 -0800)]
mmc: sdhi: update sh_mobile_sdhi_of_data for r8a7779

This patch updates r8a7779 DT data to have SoC specific settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhi: update sh_mobile_sdhi_of_data for r8a7778
Kuninori Morimoto [Fri, 21 Feb 2014 00:54:58 +0000 (16:54 -0800)]
mmc: sdhi: update sh_mobile_sdhi_of_data for r8a7778

This patch updates r8a7778 DT data to have SoC specific settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sdhi: tidyup sh_mobile_sdhi_of_match position
Kuninori Morimoto [Fri, 21 Feb 2014 00:54:44 +0000 (16:54 -0800)]
mmc: sdhi: tidyup sh_mobile_sdhi_of_match position

It is easier to read if sh_mobile_sdhi_of_cfg and
sh_mobile_sdhi_of_match are closer.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Enable MMC_CAP2_CACHE_CTRL as default
Ulf Hansson [Wed, 18 Dec 2013 10:59:17 +0000 (11:59 +0100)]
mmc: core: Enable MMC_CAP2_CACHE_CTRL as default

There are no reason to why the use of a non-volatile internal eMMC
cache should be controlled by a host cap. Instead let's just enable it
if the eMMC card supports it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Use mmc_flush_cache() during mmc suspend
Ulf Hansson [Mon, 16 Dec 2013 15:23:22 +0000 (16:23 +0100)]
mmc: core: Use mmc_flush_cache() during mmc suspend

Earlier we disabled the cache during suspend, which meant a flush was
internally at the eMMC performed as well.

To simplify code we can make use of the mmc_flush_cache(), during mmc
suspend, which makes the mmc_cache_ctrl() redundant so then we can
remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Remove support for MMC_CAP2_NO_SLEEP_CMD
Ulf Hansson [Mon, 16 Dec 2013 13:46:00 +0000 (14:46 +0100)]
mmc: core: Remove support for MMC_CAP2_NO_SLEEP_CMD

There are no active users of this host capability. The primary reason
for adding this cap was due to a bug in ux500 boot loader code, which
is not a relevant issue any more. So, let's remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Remove unused host cap MMC_CAP2_BROKEN_VOLTAGE
Ulf Hansson [Mon, 16 Dec 2013 13:43:51 +0000 (14:43 +0100)]
mmc: core: Remove unused host cap MMC_CAP2_BROKEN_VOLTAGE

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: card: Remove host cap MMC_CAP2_SANITIZE
Ulf Hansson [Mon, 16 Dec 2013 13:37:26 +0000 (14:37 +0100)]
mmc: card: Remove host cap MMC_CAP2_SANITIZE

There is no need for keeping a host cap for MMC_CAP2_SANITIZE, instead
we just make the feature default available.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Remove unnecessary validations for bus_ops callbacks
Ulf Hansson [Wed, 30 Oct 2013 22:15:30 +0000 (23:15 +0100)]
mmc: core: Remove unnecessary validations for bus_ops callbacks

Due to the removal of the Kconfig option MMC_UNSAFE_RESUME, several
validations of a present bus_ops callback became redundant. Let's
remove these.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: core: Use MMC_UNSAFE_RESUME as default behavior
Ulf Hansson [Wed, 30 Oct 2013 00:00:18 +0000 (01:00 +0100)]
mmc: core: Use MMC_UNSAFE_RESUME as default behavior

Invoking system suspend or shutdown without using the Kconfig option
MMC_UNSAFE_RESUME, did trigger an ungraceful power cut of the card.

To improve the situation, change the behavior to always make use of the
available bus_ops callbacks that handles system suspend and shutdown
properly.

By changing the behavior MMC_UNSAFE_RESUME becomes redundant, so lets's
remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: tmio: Adapt to proper PM configs for exported functions
Ulf Hansson [Wed, 23 Oct 2013 12:55:07 +0000 (14:55 +0200)]
mmc: tmio: Adapt to proper PM configs for exported functions

Since the users of the exported PM functions are now using the modern
PM ops macros, we can convert to the proper corresponding PM configs.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: tmio_mmc: Convert from legacy to modern PM ops
Ulf Hansson [Wed, 23 Oct 2013 12:57:50 +0000 (14:57 +0200)]
mmc: tmio_mmc: Convert from legacy to modern PM ops

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <chris@printf.net>
10 years agommc: sh_mobile_sdhi: Use modern PM macros to define pm callbacks
Ulf Hansson [Wed, 23 Oct 2013 12:51:31 +0000 (14:51 +0200)]
mmc: sh_mobile_sdhi: Use modern PM macros to define pm callbacks

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Chris Ball <chris@printf.net>