]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
9 years agommc: block: Increase max_devices
Ben Hutchings [Thu, 6 Nov 2014 03:35:09 +0000 (03:35 +0000)]
mmc: block: Increase max_devices

Currently the driver imposes a limit of 256 total minor numbers,
apparently based on the historic Unix/Linux limit.  This is quite
restrictive, particularly if we raise the maximum number of
partitions per card to 256 to match sd.

In order to make the full minor number space available we would
have to replace the static dev_use and name_use arrays with struct
ida.  But we can at least allow use of 256 cards rather than just
256 minors, with only a small change.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: add support for ARM64
Alim Akhtar [Fri, 29 Aug 2014 10:24:51 +0000 (15:54 +0530)]
mmc: dw_mmc: add support for ARM64

There are upcoming ARM64 SoCs with dw_mmc host controller.

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: reset sdio card properly on resume.
NeilBrown [Wed, 12 Nov 2014 03:55:19 +0000 (14:55 +1100)]
mmc: core: reset sdio card properly on resume.

mmc_sdio_power_restore() calls
mmc_send_if_cond(host, host->card->ocr);

ret = mmc_send_io_op_cond(host, 0, NULL);

between mmc_go_idle() and mmc_sdio_init_card().
mmc_sdio_resume() needs to as well, else my libertas sdio wifi
device doesn't resume properly from suspend.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: use card->ocr when negotiating voltage setting in mmc_sdio_power_restore
NeilBrown [Wed, 12 Nov 2014 03:55:19 +0000 (14:55 +1100)]
mmc: core: use card->ocr when negotiating voltage setting in mmc_sdio_power_restore

As we are restoring power to a known card, it makes sense to use
the 'ocr' value known for the card rather than the generic one
for the host interface.
This matches the use of card->ocr passed to mmc_power_up in
mmc_sdio_runtime_resume  (just before mmc_sdio_power_restore is
called), and the value passed to mmc_sdio_init_card() a little
later in mmc_sdio_power_restore().

Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: add Toshiba PCI SD controller driver
Ondrej Zary [Tue, 11 Nov 2014 16:54:55 +0000 (17:54 +0100)]
mmc: add Toshiba PCI SD controller driver

This patch resurrects an old never-finished driver for Toshiba PCI SD
controllers found in some older Toshiba laptops (such as Portege R100):

02:0d.0 System peripheral [0880]: Toshiba America Info Systems SD TypA Controller [1179:0805] (rev 05)

The code is fixed, cleaned up and successfully tested with SD, SDHC, SDXC and
MMC cards on Portege R100. (MMC cards don't even work in Windows!)
SDIO probably does not work (don't have any SDIO card).

The hardware is slow (around 2 MB/s - same in Windows) because it does not
support bus mastering (busmaster enable bit cannot be set in PCI control reg).
Also the card clock is limited to 16MHz (33MHz PCI clock divided by 2).

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: exynos: Add support for exynos7
Abhilash Kesavan [Thu, 28 Aug 2014 13:18:53 +0000 (18:48 +0530)]
mmc: dw_mmc: exynos: Add support for exynos7

The Exynos7 has a DWMMC controller (v2.70a) which is different from
prior versions. This patch adds new compatible strings for exynos7.
This patch also fixes the CLKSEL register offset on exynos7.

Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com>
Signed-off-by: Yuvaraj Kumar C D <yuvaraj.cd@samsung.com>
Tested-by: Vivek Gautam <gautam.vivek@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: consistent handling of initial values
Johan Rudholm [Thu, 6 Nov 2014 13:46:54 +0000 (14:46 +0100)]
mmc: core: consistent handling of initial values

mmc_do_hw_reset(), mmc_power_up() and mmc_power_off() all set similar
initial values for bus_mode, bus_width, chip_select and timing. Let's
make this handling simpler and more consistent by sticking them
together in a common function. This will introduce small changes in
behavior in the following places:

mmc_power_off():

  For SPI hosts, explicitly set bus_mode = MMC_BUSMODE_PUSHPULL and
  chip_select = MMC_CS_HIGH, before we left them as they were.

  For non-SPI hosts, set bus_mode = MMC_BUSMODE_PUSHPULL instead of
  MMC_BUSMODE_OPENDRAIN as before.

  These two changes should not be a problem since the device will be
  powered off anyway.

mmc_do_hw_reset():

  Always set bus_mode = MMC_BUSMODE_PUSHPULL, as required by SD/SDIO
  cards. MMC cards require MMC_BUSMODE_OPENDRAIN, but this is taken
  care of by mmc_init_card() and mmc_attach_mmc().

Signed-off-by: Johan Rudholm <johanru@axis.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: remove unused slot_id parameter
Andreas Fenkart [Sat, 8 Nov 2014 14:33:17 +0000 (15:33 +0100)]
mmc: omap_hsmmc: remove unused slot_id parameter

omap_hsmmc only supports one slot. So slot id is always zero, and
slot id was never used in the callbacks anyway

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: Remove unnecessary callbacks from platform data
Andreas Fenkart [Sat, 8 Nov 2014 14:33:16 +0000 (15:33 +0100)]
mmc: omap_hsmmc: Remove unnecessary callbacks from platform data

These callbacks are set during driver probe and not from the platform
init, -- evtl. they had been for oamp 1/2 -- for omap3 they are local
functions of the driver. These indirection could be dropped
altogether in favor of regular function calls TODO

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: pass mmc_priv struct to gpio init / free
Andreas Fenkart [Sat, 8 Nov 2014 14:33:15 +0000 (15:33 +0100)]
mmc: omap_hsmmc: pass mmc_priv struct to gpio init / free

this is needed when installing callbacks in the host struct and not
in the platform data, e.g. cover detect irq should be stored in
omap_hsmmc_host and not platform data

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: remove unnecessary omap_hsmmc_slot_data indirection
Andreas Fenkart [Sat, 8 Nov 2014 14:33:14 +0000 (15:33 +0100)]
mmc: omap_hsmmc: remove unnecessary omap_hsmmc_slot_data indirection

omap_hsmmc supports only one slot per controller, see OMAP_MMC_MAX_SLOTS.
This unnecessary indirection leads to confusion in the omap_hsmmc driver.
For example the card_detect callback is not installed by platform code
but from the driver probe function. So it should be a field of
omap_hsmmc_host. But since it is declared under the platform slot while
the drivers struct omap_hsmmc_host has no slot abstraction, this looks
like a bug, especially when not familiar that this driver only supports
1 slot anyway.
Either we should add a slot abstraction to omap_hsmmc_host or remove
it from the platform data struct. Removed since slot multiplexing is
an un-implemented feature

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: remove unused get_context_loss_count callback
Andreas Fenkart [Sat, 8 Nov 2014 14:33:13 +0000 (15:33 +0100)]
mmc: omap_hsmmc: remove unused get_context_loss_count callback

trigger of this callback has been removed in 0a82e06e6183

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: remove never read power_saving field in omap2_hsmmc_info
Andreas Fenkart [Sat, 8 Nov 2014 14:33:12 +0000 (15:33 +0100)]
mmc: omap_hsmmc: remove never read power_saving field in omap2_hsmmc_info

these fields are never read, probably an unimplemented feature
or superseded by pm_runtime

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: remove un-initialized callbacks from platform data
Andreas Fenkart [Sat, 8 Nov 2014 14:33:11 +0000 (15:33 +0100)]
mmc: omap_hsmmc: remove un-initialized callbacks from platform data

these callbacks are not set, probably legacy omap 1/2 features

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: omap_hsmmc: remove unused fields in platform_data
Andreas Fenkart [Sat, 8 Nov 2014 14:33:10 +0000 (15:33 +0100)]
mmc: omap_hsmmc: remove unused fields in platform_data

platform data is built from omap2_hsmmc_info, remove all fields that
are never set in omap_hsmmc_info, hence never copied to platform data.
Note that the omap_hsmmc driver is not affected by this patch those
fields were completely unused.

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agoARM: OMAP1/2+: MMC: separate platform data for mmc and mmc hs driver
Andreas Fenkart [Sat, 8 Nov 2014 14:33:09 +0000 (15:33 +0100)]
ARM: OMAP1/2+: MMC: separate platform data for mmc and mmc hs driver

- omap mmc driver supports multiplexing, omap_mmc_hs doesn't
this leads to one of the major confusions in the omap_hsmmc driver

- platform data should be read-only for the driver
most callbacks are not set by the omap3 platform init code while still
required. So they are set from the driver probe function, which is against
the paradigm that platform-data should not be modified by the driver
typical examples are card_detect, read_only callbacks

un-bundling by searching for driver name \"omap_hsmmc in the
arch/arm folder. omap_hsmmc_platform_data is not initialized directly,
but from omap2_hsmmc_info, which is defined in a separate header file
not touched by this patch

hwmod includes platform headers to declare features of the platform. All
the declared features are prefixed OMAP_HSMMC. There is no need to
include platform header from hwmod other except for feature defines

Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agoARM: OMAP2: MMC: include mmc-omap platform header directly
Andreas Fenkart [Sat, 8 Nov 2014 14:33:08 +0000 (15:33 +0100)]
ARM: OMAP2: MMC: include mmc-omap platform header directly

Only a few files really need that platform header. When later splitting
omap_mmc_platform_data into omap_mmc and omap_mmc_hs, those files
declaring an hs mmc platform data will have to change the platform
include, which is a good sanity check.
Also removing omap242x_init_mmc, which is not used anywhere, checked
with grep.

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: atmel-mci: adopt pinctrl support
Wenyou Yang [Fri, 7 Nov 2014 00:48:13 +0000 (08:48 +0800)]
mmc: atmel-mci: adopt pinctrl support

Amend the atmel mci pin controller to optionally take a pin control
handle and set the state of the pins to:
- "default" on boot, resume and before performing an transfer.
- "sleep" on suspend().

This should make it possible to optimize energy usage for the pins
both for the suspend/resume cycle.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Add HS400 support to SDHCI driver
Adrian Hunter [Thu, 6 Nov 2014 13:19:06 +0000 (15:19 +0200)]
mmc: sdhci: Add HS400 support to SDHCI driver

MMC core already has support for HS400.  Add HS400
support to SDHCI driver.  The SDHC Standard specification
does not define HS400 so consequently HS400 support is
non-standard.  However HS400 is not selected without
the host controller setting the corresponding capability
flags so host controllers not yet supporting HS400
will not be affected.  To support that, a quirk
SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400 is introduced to
enable the use of capabilities register reserved bit-63
to indicate HS400 support.

Because HS400 is non-standard for SDHCI, it is possible
that different vendors will do things in different ways.
However HS200 support faced the same issue but currently
there is only one solution.  As such, no attempt has
been made to provide for alternate HS400 solutions except
for SDHCI_QUIRK2_CAPS_BIT63_FOR_HS400.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Clear also HS400 1.2V capability if 1.2V is not supported
Adrian Hunter [Thu, 6 Nov 2014 13:19:05 +0000 (15:19 +0200)]
mmc: sdhci: Clear also HS400 1.2V capability if 1.2V is not supported

1.2V HS200 mode capability is cleared if there is not a voltage
regulator that supports 1.2V.  Do the same for 1.2V HS400 mode.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Fix vqmmc error setting
Adrian Hunter [Thu, 6 Nov 2014 13:19:04 +0000 (15:19 +0200)]
mmc: sdhci: Fix vqmmc error setting

supply.vqmmc is used with the IS_ERR macro which means
the value must be valid or an error code.  NULL is
neither, so replace with ERR_PTR(-EINVAL).

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Remove unused SDHCI_CTRL_HS_SDR200
Adrian Hunter [Thu, 6 Nov 2014 13:19:03 +0000 (15:19 +0200)]
mmc: sdhci: Remove unused SDHCI_CTRL_HS_SDR200

SDHCI_CTRL_HS_SDR200 is unused.  Remove it.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: Add IDMAC 64-bit address mode support
Prabu Thangamuthu [Mon, 20 Oct 2014 07:12:33 +0000 (07:12 +0000)]
mmc: dw_mmc: Add IDMAC 64-bit address mode support

Synopsys DW_MMC IP core supports Internal DMA Controller with 64-bit address mode from IP version 2.70a onwards.
Updated the driver to support IDMAC 64-bit addressing mode.

Signed-off-by: Prabu Thangamuthu <prabu.t@synopsys.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pci: enable sdhci doesn't support hs200 quirk for AMD sdhci
Vincent Wan [Wed, 5 Nov 2014 06:09:28 +0000 (14:09 +0800)]
mmc: sdhci-pci: enable sdhci doesn't support hs200 quirk for AMD sdhci

AMD SD controller supports the SDR104 mode, but caps2 can not
be promoted to support hs200 for eMMC.

Signed-off-by: Vincent Wan <vincent.wan@amd.com>
Signed-off-by: Wan Zongshun <mcuos.com@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pci: enable the clear transfer mode register quirk for AMD sdhci
Vincent Wan [Wed, 5 Nov 2014 06:09:14 +0000 (14:09 +0800)]
mmc: sdhci-pci: enable the clear transfer mode register quirk for AMD sdhci

This patch is to enable the quirk for AMD sdhci requiring transfer
mode register need to be cleared for commands without data

Signed-off-by: Vincent Wan <vincent.wan@amd.com>
Signed-off-by: Wan Zongshun <mcuos.com@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Add a quirk for AMD SDHC transfer mode register need to be cleared for...
Vincent Wan [Wed, 5 Nov 2014 06:09:00 +0000 (14:09 +0800)]
mmc: sdhci: Add a quirk for AMD SDHC transfer mode register need to be cleared for cmd without data

SDHC controller in AMD chipsets require SDHC transfer mode
register to be cleared for commands without data. The issue was
uncovered during testing eMMC cards on KB/ML based platforms

Signed-off-by: Vincent Wan <vincent.wan@amd.com>
Signed-off-by: Wan Zongshun <mcuos.com@gmail.com>
Signed-off-by: Arindam Nath <arindam.nath@amd.com>
Tested-by: Vikram B <vikram.b@amd.com>
Tested-by: Raghavendra Swamy <raghavendra.swamy@amd.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: use mmc_send_status to check hw_reset
Johan Rudholm [Tue, 4 Nov 2014 15:07:03 +0000 (16:07 +0100)]
mmc: core: use mmc_send_status to check hw_reset

Signed-off-by: Johan Rudholm <johanru@axis.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-s3c: Check if clk_set_rate() succeeds
Mark Brown [Tue, 4 Nov 2014 12:26:42 +0000 (12:26 +0000)]
mmc: sdhci-s3c: Check if clk_set_rate() succeeds

It is possible that we may fail to set the clock rate, if we do so then
log the failure and don't bother reprogramming the IP.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: atmel-mci: add runtime pm support
Wenyou Yang [Thu, 30 Oct 2014 04:00:41 +0000 (12:00 +0800)]
mmc: atmel-mci: add runtime pm support

Add runtime pm support to atmel mci controller.
Use runtime pm APIs to enable/disable atmel mci's clock.
Use runtime autosuspend APIs to enable auto suspend delay.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[Ulf: Fixed compile error]

9 years agommc: mmc_test: Extend "Badly aligned" tests for 8-byte alignment
Adrian Hunter [Tue, 4 Nov 2014 10:42:49 +0000 (12:42 +0200)]
mmc: mmc_test: Extend "Badly aligned" tests for 8-byte alignment

The "Badly aligned" tests, test reading/writing with alignments
of 1,2 and 3.  SDHCI now has 64-bit ADMA which has 8-byte
alignment, so extend the tests to test up to 7.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pci: Add 64-bit DMA support
Adrian Hunter [Tue, 4 Nov 2014 10:42:48 +0000 (12:42 +0200)]
mmc: sdhci-pci: Add 64-bit DMA support

Set a 64-bit DMA mask when using 64-bit DMA.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-acpi: Add 64-bit DMA support
Adrian Hunter [Tue, 4 Nov 2014 10:42:47 +0000 (12:42 +0200)]
mmc: sdhci-acpi: Add 64-bit DMA support

Set the DMA mask during the first call to ->enable_dma() to
make use of the SDHCI_USE_64_BIT_DMA flag.

This patch is dependent on
commit 8a2f38ddfeb526c30b3ec209468172a30a38d996 ("ACPI / platform: provide default DMA mask")
which provides the dev->dma_mask pointer without
which dma_set_mask_and_coherent() will always fail.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Add 64-bit ADMA support
Adrian Hunter [Tue, 4 Nov 2014 10:42:46 +0000 (12:42 +0200)]
mmc: sdhci: Add 64-bit ADMA support

Add 64-bit ADMA support including:
- add 64-bit ADMA descriptor
- add SDHCI_USE_64_BIT_DMA flag
- set upper 32-bits of DMA addresses
- ability to select 64-bit ADMA
- ability to use 64-bit ADMA sizes and alignment
- display "ADMA 64-bit" when host is added

It is assumed that a 64-bit capable device has set a 64-bit DMA mask
and *must* do 64-bit DMA.  A driver has the opportunity to change
that during the first call to ->enable_dma().  Similarly
SDHCI_QUIRK2_BROKEN_64_BIT_DMA must be left to the drivers to
implement.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Define ADMA descriptor structure
Adrian Hunter [Tue, 4 Nov 2014 10:42:45 +0000 (12:42 +0200)]
mmc: sdhci: Define ADMA descriptor structure

Define the ADMA descriptor structure instead of
using manual offsets and casts.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Define ADMA constants
Adrian Hunter [Tue, 4 Nov 2014 10:42:44 +0000 (12:42 +0200)]
mmc: sdhci: Define ADMA constants

Define all the ADMA constants instead of having numbers
scattered throughout the code.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Define maximum segments
Adrian Hunter [Tue, 4 Nov 2014 10:42:43 +0000 (12:42 +0200)]
mmc: sdhci: Define maximum segments

Define the maximum number of segments instead of
having the constant 128 appearing in the code in
various places.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Parameterize ADMA sizes and alignment
Adrian Hunter [Tue, 4 Nov 2014 10:42:42 +0000 (12:42 +0200)]
mmc: sdhci: Parameterize ADMA sizes and alignment

In preparation for 64-bit ADMA, parameterize ADMA sizes
and alignment.  64-bit ADMA has a larger descriptor
because it contains a 64-bit address instead of a 32-bit
address.  Also data must be 8-byte aligned instead
of 4-byte aligned.  Consequently, sdhci_host members
are added for descriptor, table, and buffer sizes
and alignment.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Use 'void *' for not 'u8 *' for ADMA data
Adrian Hunter [Tue, 4 Nov 2014 10:42:41 +0000 (12:42 +0200)]
mmc: sdhci: Use 'void *' for not 'u8 *' for ADMA data

It is kernel-style to use 'void *' for anonymous data.
This is being applied to the ADMA bounce buffer which
contains unaligned bytes, and to the ADMA descriptor
table which will contain 32-bit ADMA descriptors
or 64-bit ADMA descriptors when support is added.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Add sdhci_adma_mark_end()
Adrian Hunter [Tue, 4 Nov 2014 10:42:40 +0000 (12:42 +0200)]
mmc: sdhci: Add sdhci_adma_mark_end()

In preparation for 64-bit ADMA, separate out code
that touches the ADMA descriptor by adding
sdhci_adma_mark_end().

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Rename adma_desc to adma_table
Adrian Hunter [Tue, 4 Nov 2014 10:42:39 +0000 (12:42 +0200)]
mmc: sdhci: Rename adma_desc to adma_table

In preparation for 64-bit ADMA, rename adma_desc to
adma_table.  That is because members will be added
for descriptor size and table size, so using adma_desc
(which is the table) is confusing.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Rename two ADMA-related functions for consistency
Adrian Hunter [Tue, 4 Nov 2014 10:42:38 +0000 (12:42 +0200)]
mmc: sdhci: Rename two ADMA-related functions for consistency

Rename sdhci_set_adma_desc to sdhci_adma_write_desc and
sdhci_show_adma_error to sdhci_adma_show_error so that
all ADMA functions start with sdhci_adma_.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Fix ADMA table size warning
Adrian Hunter [Tue, 4 Nov 2014 10:42:37 +0000 (12:42 +0200)]
mmc: sdhci: Fix ADMA table size warning

The intent of the warning is to warn if the ADMA table
overflows.  However there can be one more 'end' entry
so the condition should be adjusted accordingly.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Fix ADMA page boundary warnings
Adrian Hunter [Tue, 4 Nov 2014 10:42:36 +0000 (12:42 +0200)]
mmc: sdhci: Fix ADMA page boundary warnings

Bytes are being copied from/to a single page.  The intent
of the warning is to warn if the page boundary is crossed.
There are two problems.  First, PAGE_MASK is mistaken for
(PAGE_SIZE - 1).  Secondly, instead of using the number
of bytes to copy, the warning is using the maximum that
that value could be.  Fix both.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Fix incorrect ADMA2 descriptor table size
Adrian Hunter [Tue, 4 Nov 2014 10:42:35 +0000 (12:42 +0200)]
mmc: sdhci: Fix incorrect ADMA2 descriptor table size

The ADMA2 descriptor table size was being calculated incorrectly
Fix it.

Note that it has been wrong for a long time and likely has not
caused any problems because of a combination of 1) not needing
alignment descriptors for block operations 2) more memory being
allocated than was requested 3) the use of
SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC which does not use an extra
descriptor for the end marker.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: host: atmel-mci: Add support for non-removable slots
Timo Kokkonen [Mon, 3 Nov 2014 11:12:59 +0000 (13:12 +0200)]
mmc: host: atmel-mci: Add support for non-removable slots

Add support for non-removable slots which have no card detection GPIO
and which should not be polled for a card change.

Signed-off-by: Timo Kokkonen <timo.kokkonen@offcode.fi>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: Document clocks and additional clock-names property
Sebastian Hesselbarth [Tue, 21 Oct 2014 09:22:41 +0000 (11:22 +0200)]
mmc: sdhci-pxav3: Document clocks and additional clock-names property

Now that sdhci-pxav3 driver allows to have more than one IP clock defined,
document both clocks and clock-names properties.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: Get optional core clock
Sebastian Hesselbarth [Tue, 21 Oct 2014 09:22:40 +0000 (11:22 +0200)]
mmc: sdhci-pxav3: Get optional core clock

Besides the I/O clock, some PXAv3 SDHCI IP also requires a core clock to
be enabled. Add an optional core clock to the corresponding driver.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: Try to get named I/O clock first
Sebastian Hesselbarth [Tue, 21 Oct 2014 09:22:39 +0000 (11:22 +0200)]
mmc: sdhci-pxav3: Try to get named I/O clock first

With support for more than one clock, we'll need to distinguish between
the clock by name. Change clock probing to first try to get "io" clock
before falling back to unnamed clock.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: Move I/O clock to private data
Sebastian Hesselbarth [Tue, 21 Oct 2014 09:22:38 +0000 (11:22 +0200)]
mmc: sdhci-pxav3: Move I/O clock to private data

As we are using references to the I/O clock throughout the driver,
move it to the private data. Also, in preparation for core clock,
rename it to clk_io.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-of-arasan: Omit superfluous error messages
Mike Looijmans [Tue, 28 Oct 2014 07:53:21 +0000 (08:53 +0100)]
mmc: sdhci-of-arasan: Omit superfluous error messages

sdhci_add_host and sdhci_platfm_init already report failure,
so don't emit error messages when a failure occurs. This prevents
occurences of "deferred" messages when required power supplies
are not ready for operation yet.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Convert to use kzalloc() for CXD register buffers
Ulf Hansson [Fri, 17 Oct 2014 10:00:56 +0000 (12:00 +0200)]
mmc: core: Convert to use kzalloc() for CXD register buffers

While allocating buffers for CXD data, let's use kzalloc() to make sure
those are zeroed.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Don't handle buffers on stack while fetching CXD registers
Ulf Hansson [Fri, 17 Oct 2014 09:58:24 +0000 (11:58 +0200)]
mmc: core: Don't handle buffers on stack while fetching CXD registers

Due to previous patches, all callers of mmc_send_cxd_data() now
allocates their buffers from the heap. This enables us to simplify
mmc_send_cxd_data() by removing the support of handling buffers, which
are allocated from the stack.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove the redundant mmc_send_ext_csd() API
Ulf Hansson [Fri, 17 Oct 2014 09:54:22 +0000 (11:54 +0200)]
mmc: core: Remove the redundant mmc_send_ext_csd() API

Previous patches has replaced the calls to mmc_send_ext_csd() into
mmc_get_ext_csd(), thus mmc_send_ext_csd() has become redundant. Let's
remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Use mmc_get_ext_csd() instead of mmc_send_ext_csd()
Ulf Hansson [Fri, 17 Oct 2014 09:48:23 +0000 (11:48 +0200)]
mmc: core: Use mmc_get_ext_csd() instead of mmc_send_ext_csd()

By using mmc_get_ext_csd() in favor of mmc_send_ext_csd, we decrease
code duplication.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: block: Use mmc_get_ext_csd() instead of mmc_send_ext_csd()
Ulf Hansson [Fri, 17 Oct 2014 09:39:05 +0000 (11:39 +0200)]
mmc: block: Use mmc_get_ext_csd() instead of mmc_send_ext_csd()

By using mmc_get_ext_csd() in favor of mmc_send_ext_csd, we decrease
code duplication.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Export mmc_get_ext_csd()
Ulf Hansson [Fri, 17 Oct 2014 09:32:32 +0000 (11:32 +0200)]
mmc: core: Export mmc_get_ext_csd()

Callers of mmc_send_ext_csd() will be able to decrease code duplication
by using mmc_get_ext_csd() instead. Let's make it available.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Don't panic when fetching EXT_CSD
Ulf Hansson [Thu, 16 Oct 2014 15:00:39 +0000 (17:00 +0200)]
mmc: core: Don't panic when fetching EXT_CSD

Instead of doing BUG_ON(), return an error code.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Let's callers of from mmc_get_ext_csd() do error handling
Ulf Hansson [Mon, 20 Oct 2014 12:08:16 +0000 (14:08 +0200)]
mmc: core: Let's callers of from mmc_get_ext_csd() do error handling

The callers of mmc_get_ext_csd() need the flexibility to handle errors
themselves, because they behave differently.

Let's clean up mmc_get_ext_csd() with its friends and adopt the error
handling as stated above.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Fetch and decode EXT_CSD from mmc_read_ext_csd()
Ulf Hansson [Mon, 20 Oct 2014 11:37:24 +0000 (13:37 +0200)]
mmc: core: Fetch and decode EXT_CSD from mmc_read_ext_csd()

As a step in cleaning up code around reading/decoding EXT_CSD, convert
the current mmc_read_ext_csd(), to handle both fetching the EXT_CSD
and decoding its data.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Add helper function for EXT_CSD support
Ulf Hansson [Mon, 20 Oct 2014 09:33:53 +0000 (11:33 +0200)]
mmc: core: Add helper function for EXT_CSD support

The helper function mmc_can_ext_csd() will return a positive value if
the card supports the EXT_CSD register. Start using it at relavant
places in the mmc core.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove unnecessary 'out of memory' message
Ulf Hansson [Tue, 21 Oct 2014 15:16:14 +0000 (17:16 +0200)]
mmc: core: Remove unnecessary 'out of memory' message

Rely on the prints handled internally by kmalloc().

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove redundant check of max_dtr while selecting timings
Ulf Hansson [Mon, 20 Oct 2014 09:49:21 +0000 (11:49 +0200)]
mmc: core: Remove redundant check of max_dtr while selecting timings

If the MMC spec version is < CSD_SPEC_VER_4, there aren't support for
the EXT_CSD register. Since max_dtr is fetched from there, it will
default to zero, which thus isn't needed to verify.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove redundant check while selecting powerclass
Ulf Hansson [Mon, 20 Oct 2014 09:18:41 +0000 (11:18 +0200)]
mmc: core: Remove redundant check while selecting powerclass

The validation of the buswidth and the MMC spec version in
__mmc_select_powerclass() is redundant, let's remove it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove duplicated definition of mmc_send_ext_csd()
Ulf Hansson [Fri, 17 Oct 2014 09:16:57 +0000 (11:16 +0200)]
mmc: core: Remove duplicated definition of mmc_send_ext_csd()

mmc_send_ext_csd() is an exported function used by both the mmc core
and the mmc block layer. Let's remove the local duplicated definition
in the mmc core.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove mmc_free_ext_csd()
Ulf Hansson [Thu, 16 Oct 2014 14:18:51 +0000 (16:18 +0200)]
mmc: core: Remove mmc_free_ext_csd()

Let callers of mmc_free_ext_csd() do kfree() directly instead.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: Remove old card detect infrastructure
Doug Anderson [Tue, 14 Oct 2014 16:33:09 +0000 (09:33 -0700)]
mmc: dw_mmc: Remove old card detect infrastructure

The dw_mmc driver had a bunch of code that ran whenever a card was
ejected and inserted.  However, this code was old and crufty and
should be removed.  Some evidence that it's really not needed:

1. Is is supposed to be legal to use 'cd-gpio' on dw_mmc instead of
   using the built-in card detect mechanism.  The 'cd-gpio' code
   doesn't run any of the crufty old code but yet still works.

2. While looking at this, I realized that my old change (369ac86 mmc:
   dw_mmc: don't queue up a card detect at slot startup) actually
   castrated the old code a little bit already and nobody noticed.
   Specifically "last_detect_state" was left as 0 at bootup.  That
   means that on the first card removal none of the crufty code ran.

3. I can run "while true; do dd if=/dev/mmcblk1 of=/dev/null; done"
   while ejecting and inserting an SD Card and the world doesn't
   explode.

If some of the crufty old code is actually needed, we should justify
it and also put it in some place where it will be run even with
"cd-gpio".

Note that in my case I'm using the "cd-gpio" mechanism but for various
reasons the hardware triggers a dw_mmc "card detect" at bootup.  That
was actually causing a real bug.  The card detect workqueue was
running while the system was trying to enumerate the card.  The
"present != slot->last_detect_state" triggered and we were doing all
kinds of crazy stuff and messing up enumeration.  The new mechanism of
just asking the core to check the card is much safer and then the
bogus interrupt doesn't hurt.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: alim.akhtar <alim.akhtar@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: silence a shift wrapping warning
Dan Carpenter [Thu, 23 Oct 2014 11:37:00 +0000 (14:37 +0300)]
mmc: core: silence a shift wrapping warning

Presumably ->slotno is normally fairly small and the shift doesn't wrap
but static checkers will complain about it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-of-arasan: Use signed formatting in error messages
Mike Looijmans [Thu, 23 Oct 2014 11:31:00 +0000 (13:31 +0200)]
mmc: sdhci-of-arasan: Use signed formatting in error messages

"ret" is a signed int, so use "%d" in format strings instead of "%u".
This prevents cryptic codes in error messages like this:
sdhci-arasan e0101000.sdhci: platform register failed (4294966779)

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Reviewed-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agoavr32: remove mach/atmel-mci.h
Alexandre Belloni [Fri, 17 Oct 2014 08:26:38 +0000 (10:26 +0200)]
avr32: remove mach/atmel-mci.h

Use the generic platform_data header file instead of mach/atmel-mci.h

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agoARM: at91: remove mach/atmel-mci.h
Alexandre Belloni [Fri, 17 Oct 2014 08:26:37 +0000 (10:26 +0200)]
ARM: at91: remove mach/atmel-mci.h

Use the generic platform_data header file instead of mach/atmel-mci.h

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: atmel-mci: move mach header to platform_data
Alexandre Belloni [Fri, 17 Oct 2014 08:26:36 +0000 (10:26 +0200)]
mmc: atmel-mci: move mach header to platform_data

Move the mach header that can come either from arm/mach-at91 or avr32 to
platform_data to be able to switch the AT91 platforms to multiplatform.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[Ulf: Fixed compile error]

9 years agommc: core: Report firmware version for eMMC 5.0 devices.
Gwendal Grignou [Thu, 16 Oct 2014 18:27:16 +0000 (11:27 -0700)]
mmc: core: Report firmware version for eMMC 5.0 devices.

For eMMC 5.0 compliant device, firmware version is stored in ext_csd.
Report firmware as a 64bit hexa decimal. Vendor can use hexa or ascii
string to report firmware version.
Also add FFU related EXT_CSD register and note if the device is FFU capable.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: rockchip: Don't recalc the clock when it goes off
Doug Anderson [Tue, 14 Oct 2014 16:39:12 +0000 (09:39 -0700)]
mmc: dw_mmc: rockchip: Don't recalc the clock when it goes off

The "set_ios" function is called with a clock of 0 when the clock is
turning off.  There's no reason to go through all the extra Rockchip
logic (whose goal is to make sure DIV is 0 or 1) in that case.  The
Rockchip logic happened to work because the CCF will pick the lowest
possible rate when you ask it for a clock of 0, but it's silly to go
through all the remuxing and adjusting for no reason.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: Change signal voltage error to dev_dbg()
Doug Anderson [Sat, 11 Oct 2014 04:16:16 +0000 (21:16 -0700)]
mmc: dw_mmc: Change signal voltage error to dev_dbg()

In (28f92b5 mmc: core: Try other signal levels during power up) we can
see that there are times when it's valid to try several signal
voltages.  Don't print an ugly error in the logs when that happens.

Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: dw_mmc: Reset DMA before enabling IDMAC
Sonny Rao [Thu, 16 Oct 2014 16:58:05 +0000 (09:58 -0700)]
mmc: dw_mmc: Reset DMA before enabling IDMAC

We've already got a reset of DMA after it's done.  Add one before we
start DMA too.  This fixes a data corruption on Rockchip SoCs which
will get bad data when doing a DMA transfer after doing a PIO transfer.

We tested this on an Exynos 5800 with HS200 and didn't notice any
difference in sequential read throughput.

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Tested-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove unused mmc_list_to_card() macro
Ulf Hansson [Mon, 6 Oct 2014 12:39:03 +0000 (14:39 +0200)]
mmc: core: Remove unused mmc_list_to_card() macro

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: block: Use dev_set|get_drvdata()
Ulf Hansson [Mon, 6 Oct 2014 12:34:09 +0000 (14:34 +0200)]
mmc: block: Use dev_set|get_drvdata()

In most of the cases mmc_get|set_drvdata() didn't simplify code, which
should be the primary reason for such macros.

Let's remove them and convert to the common device_driver macros,
dev_set|get_drvdata() instead.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: msm_sdcc: Use platform_set|get_drvdata
Ulf Hansson [Mon, 6 Oct 2014 12:08:09 +0000 (14:08 +0200)]
mmc: msm_sdcc: Use platform_set|get_drvdata

The msm_sdcc host shall not use mmc core specific macros to handle its
driver data. Instead, convert to use the platform device driver macros.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Convert mmc_driver to device_driver
Ulf Hansson [Mon, 6 Oct 2014 11:51:40 +0000 (13:51 +0200)]
mmc: core: Convert mmc_driver to device_driver

The struct mmc_driver adds an extra layer on top of the struct
device_driver. That would be fine, if there were a good reason, but
that's not the case.

Let's simplify code by converting to the common struct device_driver
instead and thus also removing superfluous overhead.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Convert the mmc_driver to use the modern PM ops
Ulf Hansson [Mon, 6 Oct 2014 09:29:42 +0000 (11:29 +0200)]
mmc: core: Convert the mmc_driver to use the modern PM ops

Instead of having specific mmc system PM callbacks for the mmc driver,
let's convert to use the common ones.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Don't export the to_sdio_driver macro
Ulf Hansson [Mon, 6 Oct 2014 09:00:15 +0000 (11:00 +0200)]
mmc: core: Don't export the to_sdio_driver macro

The macro is only used by the mmc core, so let's move it in there.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Remove superfluous ifdefs for SDIO bus' PM callbacks
Ulf Hansson [Mon, 6 Oct 2014 08:28:35 +0000 (10:28 +0200)]
mmc: core: Remove superfluous ifdefs for SDIO bus' PM callbacks

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: Remove checks for mandatory host clock
Sebastian Hesselbarth [Tue, 21 Oct 2014 09:22:37 +0000 (11:22 +0200)]
mmc: sdhci-pxav3: Remove checks for mandatory host clock

NULL-checking a struct clk it not only wrong but also not required as
for PXAv3 driver the corresponding clock is mandatory. Remove the
checks from sdhci_pxav3_runtime_{suspend,resume}.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: Remove unused clk_enable from sdhci_pxa
Sebastian Hesselbarth [Tue, 21 Oct 2014 09:22:36 +0000 (11:22 +0200)]
mmc: sdhci-pxav3: Remove unused clk_enable from sdhci_pxa

clk_enable from struct sdhci_pxa is unused, remove it from the private
driver data.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: Move private driver data to driver source
Sebastian Hesselbarth [Tue, 21 Oct 2014 09:22:35 +0000 (11:22 +0200)]
mmc: sdhci-pxav3: Move private driver data to driver source

struct sdhci_pxa is only used in sdhci_pxa driver itself, so move it
there.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav3: Respect MMC_DDR52 timing on uhs signaling
Sebastian Hesselbarth [Tue, 21 Oct 2014 09:22:34 +0000 (11:22 +0200)]
mmc: sdhci-pxav3: Respect MMC_DDR52 timing on uhs signaling

commit bb8175a8aa42d731a840cd474e348ac3367eb5a0
  ("mmc: sdhci: clarify DDR timing mode between SD-UHS and eMMC")
added MMC_DDR52 as eMMC's DDR mode to be distinguished from SD-UHS.

While the differentation may be useful, pxav3 SDHCI controller lacks
a corresponding check in its custom .set_uhs_signaling callback for
MMC_DDR52. This patch adds a new switch case for MMC_TIMING_MMC_DDR52
to MMC_TIMING_UHS_DDR50 case.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pxav2: Drop unused struct sdhci_pxa
Sebastian Hesselbarth [Tue, 21 Oct 2014 09:22:33 +0000 (11:22 +0200)]
mmc: sdhci-pxav2: Drop unused struct sdhci_pxa

struct sdhci_pxa is private data of PXA SDHCI driver, but not used in
sdhci-pxav2 at all. Drop unused references to struct sdhci_pxa.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sunxi: Remove unused includes of linux/clk-private.h
Tomeu Vizoso [Fri, 3 Oct 2014 15:53:18 +0000 (17:53 +0200)]
mmc: sunxi: Remove unused includes of linux/clk-private.h

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mmci: fix mmci_post_request
Srinivas Kandagatla [Wed, 8 Oct 2014 11:25:17 +0000 (12:25 +0100)]
mmc: mmci: fix mmci_post_request

If the post request is cancelling the channel and descriptor and which are
equal to host->dma_current and host->dma_desc_current respectively, then it
makes sense to reset these pointers to NULL, so that the driver does not
reference it.

Also the host_cookie can be reset to 0 in cases of error, so that the
core could reissue the same mmc_request.

This patch was tested with 'mmc: core: fix prepared requests while doing
bkops' to fix the below issue.

mmci-pl18x 12400000.sdcc: error during DMA transfer!
Unable to handle kernel paging request at virtual address 40000000
pgd = c0204000
[40000000] *pgd=00000000
Internal error: Oops: 805 [#1] SMP ARM
Modules linked in: ipv6 ath6kl_sdio ath6kl_core
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W      3.17.0-rc7-linaro-multi-v7 #1
task: c0c9d7e0 ti: c0c92000 task.ti: c0c92000
PC is at v7_dma_inv_range+0x34/0x4c
LR is at __dma_page_dev_to_cpu+0x80/0x100
pc : [<c021efc0>]    lr : [<c021af18>]    psr: 400f0193
sp : c0c93e20  ip : c0c9a478  fp : c08ea538
r10: c0c9f548  r9 : 00000002  r8 : e97d9000
r7 : 00000200  r6 : c0c9d504  r5 : c0db0880  r4 : 00000000
r3 : 0000003f  r2 : 00000040  r1 : 40000200  r0 : 40000000
Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5787d  Table: a9ef406a  DAC: 00000015
Process swapper/0 (pid: 0, stack limit = 0xc0c92250)
Stack: (0xc0c93e20 to 0xc0c94000)
3e20: c021f058 e9a17178 e9a171bc e99dfd6c 00000001 00000001 e995de10 00000002
3e40: 00000000 c021b574 00000000 c04bc4a4 00000000 e9b49ac0 c0ce6e6c e99dfda4
3e60: 00000088 e9810780 c0d8291c c072ea58 00000000 c072d3fc 00000000 c072f534
3e80: 00000000 e9b49ac0 00000100 c0c9a444 00000088 c072f6b4 c072f5d4 e9d40080
3ea0: e98107dc 00000000 00000000 c0280a60 00000000 7d55bf61 e9810780 e98107dc
3ec0: 00000000 f0002000 c0d460e8 c0d460e8 c0c92000 c0280b60 e9810780 c0ce7190
3ee0: 00000000 c028369c c02835f4 00000088 00000088 c0280278 c0c8ec70 c020f080
3f00: f000200c c0c9a958 c0c93f28 c02088e4 c04bd630 c04bd5bc 200f0013 ffffffff
3f20: c0c93f5c c0212800 00000001 a987c000 c0c93f3c c04bd574 00000000 0000015b
3f40: ea7a0e40 00000000 c0d460e8 c0d460e8 c0c92000 c08ea538 29b12000 c0c93f70
3f60: c04bd630 c04bd5bc 200f0013 ffffffff c04bd574 c071bd24 7d50c9b4 c0719a44
3f80: 7d50c9b4 0000015b c0c9a498 c0c92028 c0c9a498 c0c9a4fc ea7a0e40 c0c8ee38
3fa0: c0d460e8 c0276198 00000000 c0d8291a 00000000 c0c9a400 00000000 c0be0bc4
3fc0: ffffffff ffffffff c0be05f8 00000000 00000000 c0c533d8 c0d82ed4 c0c9a47c
3fe0: c0c533d4 c0c9e870 8020406a 511f06f0 00000000 80208074 00000000 00000000
[<c021efc0>] (v7_dma_inv_range) from [<c021af18>] (__dma_page_dev_to_cpu+0x80/0x100)
[<c021af18>] (__dma_page_dev_to_cpu) from [<c021b574>] (arm_dma_unmap_sg+0x5c/0x84)
[<c021b574>] (arm_dma_unmap_sg) from [<c072ea58>] (mmci_dma_unmap.isra.16+0x60/0x74)
[<c072ea58>] (mmci_dma_unmap.isra.16) from [<c072f534>] (mmci_data_irq+0x1fc/0x29c)
[<c072f534>] (mmci_data_irq) from [<c072f6b4>] (mmci_irq+0xe0/0x114)
[<c072f6b4>] (mmci_irq) from [<c0280a60>] (handle_irq_event_percpu+0x78/0x134)
[<c0280a60>] (handle_irq_event_percpu) from [<c0280b60>] (handle_irq_event+0x44/0x64)
[<c0280b60>] (handle_irq_event) from [<c028369c>] (handle_fasteoi_irq+0xa8/0x1a8)
[<c028369c>] (handle_fasteoi_irq) from [<c0280278>] (generic_handle_irq+0x2c/0x3c)
[<c0280278>] (generic_handle_irq) from [<c020f080>] (handle_IRQ+0x40/0x90)
[<c020f080>] (handle_IRQ) from [<c02088e4>] (gic_handle_irq+0x38/0x68)
[<c02088e4>] (gic_handle_irq) from [<c0212800>] (__irq_svc+0x40/0x54)
Exception stack(0xc0c93f28 to 0xc0c93f70)
3f20:                   00000001 a987c000 c0c93f3c c04bd574 00000000 0000015b
3f40: ea7a0e40 00000000 c0d460e8 c0d460e8 c0c92000 c08ea538 29b12000 c0c93f70
3f60: c04bd630 c04bd5bc 200f0013 ffffffff
[<c0212800>] (__irq_svc) from [<c04bd5bc>] (msm_cpu_pm_enter_sleep+0x48/0x4c)
[<c04bd5bc>] (msm_cpu_pm_enter_sleep) from [<c071bd24>] (qcom_lpm_enter_spc+0x20/0x2c)
[<c071bd24>] (qcom_lpm_enter_spc) from [<c0719a44>] (cpuidle_enter_state+0x44/0xf0)
[<c0719a44>] (cpuidle_enter_state) from [<c0276198>] (cpu_startup_entry+0x1f4/0x238)
[<c0276198>] (cpu_startup_entry) from [<c0be0bc4>] (start_kernel+0x384/0x390)
Code: 1e070f3e e1110003 e1c11003 1e071f3e (ee070f36)
---[ end trace cf6cb3f6432c9834 ]---
Kernel panic - not syncing: Fatal exception in interrupt

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: fix prepared requests while doing bkops
Srinivas Kandagatla [Wed, 8 Oct 2014 11:24:24 +0000 (12:24 +0100)]
mmc: core: fix prepared requests while doing bkops

While starting the bkops the previously prepared request should be canceled
and restarted after the bkops. As the prepared resource might already
setup the dma channels and ready to be started. Now with the arrival of bkops
request this prepared request can be serviced ONLY after the bkops. So
holding on to the prepared request in the host driver is confusing at
this point in time, so it makes sense to cleanup such dangling requests and
reissue this request once bkops is done.
Canceling the prepared request would give opportunity to the host drivers
to perform cleanup on the prepared request.

Without this patch host drivers like mmci gets confused when a blocking
request like send_ext_csd(CMD8) is issued while there is already a prepared
request. With the help of this patch, the driver can better manage such
blocking requests and cleanup the prepared requests which are not started yet.

Without this patch I hit below crash on Qualcomm APQ8064 based IFC6410 board
with mmci host driver.

mmci-pl18x 12400000.sdcc: error during DMA transfer!
Unable to handle kernel paging request at virtual address 40000000
pgd = c0204000
[40000000] *pgd=00000000
Internal error: Oops: 805 [#1] SMP ARM
Modules linked in: ipv6 ath6kl_sdio ath6kl_core
CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W      3.17.0-rc7-linaro-multi-v7 #1
task: c0c9d7e0 ti: c0c92000 task.ti: c0c92000
PC is at v7_dma_inv_range+0x34/0x4c
LR is at __dma_page_dev_to_cpu+0x80/0x100
pc : [<c021efc0>]    lr : [<c021af18>]    psr: 400f0193
sp : c0c93e20  ip : c0c9a478  fp : c08ea538
r10: c0c9f548  r9 : 00000002  r8 : e97d9000
r7 : 00000200  r6 : c0c9d504  r5 : c0db0880  r4 : 00000000
r3 : 0000003f  r2 : 00000040  r1 : 40000200  r0 : 40000000
Flags: nZcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5787d  Table: a9ef406a  DAC: 00000015
Process swapper/0 (pid: 0, stack limit = 0xc0c92250)
Stack: (0xc0c93e20 to 0xc0c94000)
3e20: c021f058 e9a17178 e9a171bc e99dfd6c 00000001 00000001 e995de10 00000002
3e40: 00000000 c021b574 00000000 c04bc4a4 00000000 e9b49ac0 c0ce6e6c e99dfda4
3e60: 00000088 e9810780 c0d8291c c072ea58 00000000 c072d3fc 00000000 c072f534
3e80: 00000000 e9b49ac0 00000100 c0c9a444 00000088 c072f6b4 c072f5d4 e9d40080
3ea0: e98107dc 00000000 00000000 c0280a60 00000000 7d55bf61 e9810780 e98107dc
3ec0: 00000000 f0002000 c0d460e8 c0d460e8 c0c92000 c0280b60 e9810780 c0ce7190
3ee0: 00000000 c028369c c02835f4 00000088 00000088 c0280278 c0c8ec70 c020f080
3f00: f000200c c0c9a958 c0c93f28 c02088e4 c04bd630 c04bd5bc 200f0013 ffffffff
3f20: c0c93f5c c0212800 00000001 a987c000 c0c93f3c c04bd574 00000000 0000015b
3f40: ea7a0e40 00000000 c0d460e8 c0d460e8 c0c92000 c08ea538 29b12000 c0c93f70
3f60: c04bd630 c04bd5bc 200f0013 ffffffff c04bd574 c071bd24 7d50c9b4 c0719a44
3f80: 7d50c9b4 0000015b c0c9a498 c0c92028 c0c9a498 c0c9a4fc ea7a0e40 c0c8ee38
3fa0: c0d460e8 c0276198 00000000 c0d8291a 00000000 c0c9a400 00000000 c0be0bc4
3fc0: ffffffff ffffffff c0be05f8 00000000 00000000 c0c533d8 c0d82ed4 c0c9a47c
3fe0: c0c533d4 c0c9e870 8020406a 511f06f0 00000000 80208074 00000000 00000000
[<c021efc0>] (v7_dma_inv_range) from [<c021af18>] (__dma_page_dev_to_cpu+0x80/0x100)
[<c021af18>] (__dma_page_dev_to_cpu) from [<c021b574>] (arm_dma_unmap_sg+0x5c/0x84)
[<c021b574>] (arm_dma_unmap_sg) from [<c072ea58>] (mmci_dma_unmap.isra.16+0x60/0x74)
[<c072ea58>] (mmci_dma_unmap.isra.16) from [<c072f534>] (mmci_data_irq+0x1fc/0x29c)
[<c072f534>] (mmci_data_irq) from [<c072f6b4>] (mmci_irq+0xe0/0x114)
[<c072f6b4>] (mmci_irq) from [<c0280a60>] (handle_irq_event_percpu+0x78/0x134)
[<c0280a60>] (handle_irq_event_percpu) from [<c0280b60>] (handle_irq_event+0x44/0x64)
[<c0280b60>] (handle_irq_event) from [<c028369c>] (handle_fasteoi_irq+0xa8/0x1a8)
[<c028369c>] (handle_fasteoi_irq) from [<c0280278>] (generic_handle_irq+0x2c/0x3c)
[<c0280278>] (generic_handle_irq) from [<c020f080>] (handle_IRQ+0x40/0x90)
[<c020f080>] (handle_IRQ) from [<c02088e4>] (gic_handle_irq+0x38/0x68)
[<c02088e4>] (gic_handle_irq) from [<c0212800>] (__irq_svc+0x40/0x54)
Exception stack(0xc0c93f28 to 0xc0c93f70)
3f20:                   00000001 a987c000 c0c93f3c c04bd574 00000000 0000015b
3f40: ea7a0e40 00000000 c0d460e8 c0d460e8 c0c92000 c08ea538 29b12000 c0c93f70
3f60: c04bd630 c04bd5bc 200f0013 ffffffff
[<c0212800>] (__irq_svc) from [<c04bd5bc>] (msm_cpu_pm_enter_sleep+0x48/0x4c)
[<c04bd5bc>] (msm_cpu_pm_enter_sleep) from [<c071bd24>] (qcom_lpm_enter_spc+0x20/0x2c)
[<c071bd24>] (qcom_lpm_enter_spc) from [<c0719a44>] (cpuidle_enter_state+0x44/0xf0)
[<c0719a44>] (cpuidle_enter_state) from [<c0276198>] (cpu_startup_entry+0x1f4/0x238)
[<c0276198>] (cpu_startup_entry) from [<c0be0bc4>] (start_kernel+0x384/0x390)
Code: 1e070f3e e1110003 e1c11003 1e071f3e (ee070f36)
---[ end trace cf6cb3f6432c9834 ]---
Kernel panic - not syncing: Fatal exception in interrupt

Reported-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Fix error paths and messages in mmc_init_card
Andrew Gabbasov [Wed, 1 Oct 2014 12:14:11 +0000 (07:14 -0500)]
mmc: core: Fix error paths and messages in mmc_init_card

In mmc_init_card function some of the branches in error handling paths
go to "err" label, which skips removing of newly allocated card structure,
that will actually not be used. Fix that by using proper "free_card" label.

Also, some messages in these branches are reported as warnings,
although the operation processing is not continued. Change these
messages to error level.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Add debug message for SET_BLOCK_COUNT result
Andrew Gabbasov [Wed, 1 Oct 2014 12:14:10 +0000 (07:14 -0500)]
mmc: core: Add debug message for SET_BLOCK_COUNT result

The debug messages with commands execution results, that are printed
after processing the request, do not include results of sbc (set block count)
part of request. Add the debug message for that part too.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: core: Initialize SET_BLOCK_COUNT request fields
Andrew Gabbasov [Wed, 1 Oct 2014 12:14:09 +0000 (07:14 -0500)]
mmc: core: Initialize SET_BLOCK_COUNT request fields

Some request fields are initialized just before request processing
for sanity purposes. This is done for command, data, and stop parts
of the request, but not for sbc (set block count) part. Add such
initialization for that part too.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: fix error conditions for controller reset
Andrew Gabbasov [Wed, 1 Oct 2014 12:14:08 +0000 (07:14 -0500)]
mmc: sdhci: fix error conditions for controller reset

Add the case of SET_BLOCK_COUNT command error to the error conditions
check for making a controller reset at request handling finish.
Otherwise, if the SET_BLOCK_COUNT command failed, e.g. with a timeout,
the controller state was not reset, and the next command failed too.

In the case of data error the controller reset is already done in
finish_data() function before sending stop command (if present),
so the finish tasklet should make a reset after data error only
if no stop command existed in the request.

Also, fix the indentation of this condition check to make it more logical.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci: Balance vmmc regulator_disable()
Andrew Gabbasov [Wed, 1 Oct 2014 12:14:07 +0000 (07:14 -0500)]
mmc: sdhci: Balance vmmc regulator_disable()

As a follow-up of commit
"mmc: sdhci: Balance vmmc regulator_enable(), and always enable vqmmc"
vmmc regulator disable is also not needed in sdhci_remove_host.
The regulator is completely controlled by mmc_power_up and mmc_power_off
functions and is already disabled by the time of removing the host.
Extra regulator_disable call in sdhci_remove_host is unbalanced and
causes a warning reported by regulator core, so should be removed.

Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-esdhc-imx: don't exit in case of no pinctrl states
Dirk Behme [Wed, 1 Oct 2014 09:25:32 +0000 (04:25 -0500)]
mmc: sdhci-esdhc-imx: don't exit in case of no pinctrl states

The commit ad93220de7da ("mmc: sdhci-esdhc-imx: change pinctrl state
according to uhs mode") exits the probe in case there are no valid
pinctrl states found.

As there are configurations doing the pin mux properly in the boot
loader, don't exit. Just warn, but go on in case if there are no
pinctrl states in the device tree.

Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mxcmmc: fix the default value for available voltages into mxcmci_probe
Matteo Facchinetti [Wed, 8 Oct 2014 14:24:33 +0000 (16:24 +0200)]
mmc: mxcmmc: fix the default value for available voltages into mxcmci_probe

If available voltages are not given, mmc_regulator_get_supply() function
returns 0 and mxcmmc driver doesn't set a value for ocr_avail mask.

In accordance with the comment in platform_data/mmc-mxcmmc.h,
fix it, assuming MMC_VDD_32_33 | MMC_VDD_33_34 as default value.

Signed-off-by: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: mxcmmc: fix race condition when dma finish a data transfer
Matteo Facchinetti [Tue, 30 Sep 2014 14:59:37 +0000 (16:59 +0200)]
mmc: mxcmmc: fix race condition when dma finish a data transfer

During a read of data block using dma, driver might have two ways to finish to read
and free the resources:
1) checking STATUS_DATA_TRANS_DONE mask, in the mxcmci_irq() routine
   (pending to mmc irq)
2) mxmmc driver, registers also a mxcmci_dma_callback() and when transfer is finished,
   dma driver calls this callback. (pending to dma irq)
Both ways are concurrent with each other.

Race condition happens when following events occur:
/* (1) mxcmci driver start data transfer */
         158.418970: mpc_dma_execute: mpc_dma_execute(): will_access_peripheral start cid=31
         158.418976: mpc_dma_issue_pending <-mxcmci_request
         158.418983: mxcmci_start_cmd <-mxcmci_request
/* (2) mxcmci driver receive mmc irq */
         158.419656: mxcmci_irq <-handle_irq_event_percpu
         158.419692: mxcmci_read_response <-mxcmci_irq
/* (3) mxcmci driver checks that transfer is complete and call mxcmci_finish_data() */
         158.419726: mxcmci_data_done <-mxcmci_irq
         158.419729: mxcmci_finish_data <-mxcmci_data_done
         158.419733: dma_direct_unmap_sg <-mxcmci_finish_data
         158.419736: mxcmci_swap_buffers.isra.24 <-mxcmci_finish_data
         158.419762: mxcmci_read_response <-mxcmci_data_done
/* (4) mxcmci driver (no dma): send stop command */
         158.419765: mxcmci_start_cmd <-mxcmci_data_done
/* (5) mxcmci driver (no dma): receive the stop command irq response */
         158.419782: mxcmci_irq <-handle_irq_event_percpu
         158.419812: mxcmci_read_response <-mxcmci_irq
         158.419843: mxcmci_finish_request <-mxcmci_irq
/* (6) dma driver: receive dma irq (finish data transfer) related by request on step 1 */
         158.419853: mpc_dma_irq <-handle_irq_event_percpu
         158.420001: mpc_dma_irq_process <-mpc_dma_irq
         158.420004: mpc_dma_irq_process <-mpc_dma_irq
/* (7) dma driver: start dma tasklet to finish the dma irq handling */
         158.420008: mpc_dma_irq_process: mpc_dma_irq_process(): completed ch:31
/* (8) mxcmci driver: start next data transfer using dma */
         158.420174: mxcmci_request <-mmc_start_req
         158.420182: dma_direct_map_sg <-mxcmci_request
         158.420192: mpc_dma_prep_slave_sg <-mxcmci_request
/* (9) dma driver: schedule irq tasklet and execute mxcmci dma driver callback */
         158.420250: mpc_dma_tasklet <-tasklet_action
         158.420254: mpc_dma_process_completed <-tasklet_action
         158.420267: mxcmci_dma_callback <-mpc_dma_process_completed
/* ERROR!!! (10) mxcmci driver callback works on dma data related to the step 1
                 that is already finished */
         158.420271: mxcmci_data_done <-mpc_dma_process_completed
         158.420273: mxcmci_finish_data <-mxcmci_data_done
/* ERROR!!! (11) mxcmci driver: clear data that should be used by step 8 and
                 send an other mmc stop command (already sended on step 4) */
         158.420276: dma_direct_unmap_sg <-mxcmci_finish_data
         158.420279: mxcmci_swap_buffers.isra.24 <-mxcmci_finish_data
         158.420330: mxcmci_read_response <-mxcmci_data_done
         158.420333: mxcmci_start_cmd <-mxcmci_data_done
         158.420338: dma_run_dependencies <-mpc_dma_process_completed
...
...
...
         168.474223: mxcmci_watchdog <-call_timer_fn
         168.474236: mxcmci_watchdog: mxcmci_watchdog
         168.474397: mpc_dma_device_control <-mxcmci_watchdog

In accordance with the other drivers that using the dma engine,
fix it, leaving *only* to dma driver the complete control to
ending the read operation.

Removing STATUS_READ_OP_DONE event activation, has as effect
to force mxcmci driver to handle the finish data transfer only
by mxcmci dma callback.

Signed-off-by: Matteo Facchinetti <matteo.facchinetti@sirius-es.it>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: sdhci-pci-o2micro: Fix Dell E5440 issue
Peter Guo [Wed, 24 Sep 2014 02:29:04 +0000 (04:29 +0200)]
mmc: sdhci-pci-o2micro: Fix Dell E5440 issue

Fix Dell E5440 when reboot Linux, can't find o2micro sd host chip issue.

Fixes: 01acf6917aed (mmc: sdhci-pci: add support of O2Micro/BayHubTech SD hosts)
Signed-off-by: Peter Guo <peter.guo@bayhubtech.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
9 years agommc: block: add newline to sysfs display of force_ro
Baruch Siach [Mon, 22 Sep 2014 07:12:51 +0000 (10:12 +0300)]
mmc: block: add newline to sysfs display of force_ro

Make force_ro consistent with other sysfs entries.

Fixes: 371a689f64b0d ('mmc: MMC boot partitions support')
Cc: Andrei Warkentin <andrey.warkentin@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>