[PATCH RFT] mmc: sdhci-spear: Convert to use sdhci_pltfm_* APIs

2013-08-30 Thread Axel Lin
This patch refactors the code to use sdhci_pltfm_* APIs instead of open-coded. Signed-off-by: Axel Lin --- Hi Viresh, Looks like this driver can be converted to use sdhci_pltfm_* APIs instead of open-coded. I don't have this hardware, any chance to test if this patch works? Thanks, Axel driver

[PATCH V2 0/7] Add password protected lock/unlock support for SD/MMC

2013-08-30 Thread Al Cooper
This set of patches adds support for password protected locking and unlocking of MMC and SD devices. It uses the LOCK/UNLOCK command (CMD42) available in both the MMC and SD command sets. Some of this code was based on a patch set submitted in 2006 by Anderson Briglia "Add MMC Password Protection

[PATCH V2 3/7] mmc: lock: Add function to unlock a password locked card

2013-08-30 Thread Al Cooper
This function will try to get a password for the card and use the password to unlock it. It will leave the card state flag set appropriately. Signed-off-by: Al Cooper --- drivers/mmc/core/core.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/drivers/mmc/core/core

[PATCH V2 5/7] mmc: lock: Change SD init functionality to handle locked SD cards

2013-08-30 Thread Al Cooper
- Change mmc_sd_init_card() to check for a locked card and, if found, try to get a password using the kernel KEYS subsystem, unlock the card and continue. The unlock can fail due to a bad password, no password or during boot when the rootfs that holds the password is not yet available. To handle th

[PATCH V2 7/7] mmc: lock: Change MMC init to handle locked cards.

2013-08-30 Thread Al Cooper
- Change mmc_init_card() to check for a locked card and, if found, try to get a password using the kernel KEYS subsystem, unlock the card and continue. Unlike SD cards, MMC cards support all initialization commands when locked so the init sequence can be completed on a locked card and the card can

[PATCH V2 6/7] mmc: lock: Prevent partition table read for locked cards.

2013-08-30 Thread Al Cooper
Change the MMC block layer to avoid reading the partition table when the card is locked because read commands will fail. Signed-off-by: Al Cooper --- drivers/mmc/card/block.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index cd0b

[PATCH V2 2/7] mmc: lock: Add low level LOCK_UNLOCK command

2013-08-30 Thread Al Cooper
Add support for the LOCK_UNLOCK command. This command can lock, unlock, set password, clear password and force erase SD and MMC cards. Signed-off-by: Al Cooper --- drivers/mmc/core/mmc_ops.c | 112 + drivers/mmc/core/mmc_ops.h | 13 ++ include/lin

[PATCH V2 1/7] mmc: lock: Use the kernel "KEYS" subsystem to get a card's password

2013-08-30 Thread Al Cooper
Use the kernel "KEYS" subsystem to get a password for a card based on the card's CID. This code was based on a patch set submitted by Anderson Briglia in 2006. Signed-off-by: Al Cooper --- drivers/mmc/core/Kconfig | 8 drivers/mmc/core/core.c | 105 +++

[PATCH V2 4/7] mmc: lock: Add card lock/unlock maintenance commands

2013-08-30 Thread Al Cooper
Create a sysfs interface that allows a user to manage an inserted cards lock state. The sysfs attribute "lock" will be added to the device's sysfs directory. The following commands are supported: "setpw" - Set the cards password "clearpw" - Clear the cards password "lock"- Lock the card "unlo

[PATCH 19/22] mmc: dw_mmc: rework the code related to cmd/data completion

2013-08-30 Thread Seungwon Jeon
Main change corresponds to dw_mci_command_complete(). And EBE is divided into read and write. Some minor changes make the code readability Signed-off-by: Seungwon Jeon Tested-by: Alim Akhtar --- drivers/mmc/host/dw_mmc.c | 147 ++--- 1 files changed, 84

[PATCH 14/22] mmc: dw_mmc: set the supported max/min frequency

2013-08-30 Thread Seungwon Jeon
Both f_max and f_min will be informed for core layer to request valid clock rate. But current setting from 'host->bus_hz' may not represent the max/min frequency properly. Even if host can actually support high speed than bus_hz, core layer will not request clock rate over bus_hz. Basically, f_max/

[PATCH 21/22] mmc: dw_mmc: amend use of idmac sw reset

2013-08-30 Thread Seungwon Jeon
First, compiling warning along with previous change is removed. [drivers/mmc/host/dw_mmc.c:1890:7: warning: unused variable 'ctrl'] And with the recommendation in manual, IDMAC software reset is followed by dma-reset of the CTRL register in order to terminate the transfer. Signed-off-by: Seungwon

[PATCH 16/22] mmc: dw_mmc: control card read threshold

2013-08-30 Thread Seungwon Jeon
Card Read Threshold should be ensured that the card clock does not stop in the middle of a block of data being transferred from the card to the Host. Specially, clock stop is allowed in fast transfer such as HS200 or SDR104 mode. And so, it should be enabled. Signed-off-by: Seungwon Jeon Tested-b

[PATCH 18/22] mmc: dw_mmc: guarantee stop-abort cmd in data errors

2013-08-30 Thread Seungwon Jeon
In error cases, DTO interrupt may or may not be generated depending on remained data. Stop/Abort command ensures DTO generation for that situation. Currently if 'stop' field of data is empty, there is no stop/abort command. So, it could hang waiting DTO. This change rein- forces these cases. Signe

[PATCH 13/22] mmc: dw_mmc: move supports-highspeed of quirks to caps

2013-08-30 Thread Seungwon Jeon
'supports-highspeed' is not one of the quirks but is a capability. So, it's removed from quirks. Signed-off-by: Seungwon Jeon Tested-by: Alim Akhtar --- drivers/mmc/host/dw_mmc.c |9 +++-- 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/dw_mmc.c b/drivers

[PATCH 20/22] mmc: dw_mmc: gather each reset code into functions

2013-08-30 Thread Seungwon Jeon
There are three resets in CTRL register. FIFO reset is especially used in several points with the same routine. It could be replaced with one function and the others may be applied similarly if needed. So, mci_wait_reset() is modified to allow various bit field of reset Signed-off-by: Seungwon Jeo

[PATCH 12/22] mmc: dw_mmc: add the capability to support hs200 mode

2013-08-30 Thread Seungwon Jeon
As host controller can support eMMC's HS200 mode at 1.8V or 1.2V, these capability will be added. Signed-off-by: Seungwon Jeon Tested-by: Alim Akhtar --- .../devicetree/bindings/mmc/synopsis-dw-mshc.txt |5 + drivers/mmc/host/dw_mmc.c |6 ++ 2 files ch

[PATCH 17/22] mmc: dw_mmc: fix error handling on response error

2013-08-30 Thread Seungwon Jeon
Even if response error is detected in case data command, data transfer is continued. It means that data can live in FIFO. Current handling just breaks out the request when seeing the command error. This causes kernel panic in dw_mci_read_data_pio() [host->data = NULL]. And also, FIFO should be guar

[PATCH 15/22] mmc: dw_mmc: adjust the fifoth with block size

2013-08-30 Thread Seungwon Jeon
This change helps to choose msize, rx_watermark and tx_watermak depending on block size for IDMAC mode. For SDIO block size can be variable, so if these values are set incorrectly, card clock may stop. Signed-off-by: Seungwon Jeon Tested-by: Alim Akhtar --- drivers/mmc/host/dw_mmc.c | 74 +++

[PATCH 22/22] mmc: dw_mmc: fix the transfer termination in IDMAC mode

2013-08-30 Thread Seungwon Jeon
In IDMAC mode EVENT_XFER_COMPLETE is set when RI/TI of last descriptor is done. So if errors are happened in the middle of data transfers, 'dw_mci_stop_dma' during error handing can be called and eventually prevents this flag to be set. This results in permanent wait for EVENT_XFER_COMPLETE in 'dw_

[PATCH 11/22] mmc: dw_mmc: exynos: adjust the clock rate with speed mode

2013-08-30 Thread Seungwon Jeon
Exynos's host has divider logic before 'cclk_in' to controller core. It means that actual clock rate of ciu clock comes from this divider value. So, source clock should be adjusted along with 'ciu_div' which indicates the host's divider ratio. Setting clock rate basically fits the required speed. S

[PATCH 10/22] mmc: dw_mmc: exynos: add variable delay tuning sequence

2013-08-30 Thread Seungwon Jeon
Implements variable delay tuning. In this change, exynos host can determine the correct sampling point for the HS200 and SDR104 speed mode. Signed-off-by: Seungwon Jeon Tested-by: Alim Akhtar --- drivers/mmc/host/dw_mmc-exynos.c | 124 ++ 1 files changed, 12

[PATCH 08/22] mmc: dw_mmc: exynos: configure SMU in exynos5420

2013-08-30 Thread Seungwon Jeon
From: Yuvaraj Kumar C D Exynos5420 Mobile Storage Host controller has Security Management Unit (SMU) for channel 0 and channel 1 (mainly for eMMC). This time, SMU configuration is set for non-encryption mode. Signed-off-by: Yuvaraj Kumar C D Signed-off-by: Alim Akhtar Tested-by: Jaehoon Chung

[PATCH 07/22] mmc: dw_mmc: move the platform specific init call

2013-08-30 Thread Seungwon Jeon
From: Yuvaraj Kumar C D Current platform specific private data initialization call dw_mci_exynos_priv_init() can be used to do platform specific initialization of SMU and others in future. So the drv_data->init call has moved to dw_mci_probe(). Signed-off-by: Yuvaraj Kumar C D Tested-by: Alim A

[PATCH 09/22] mmc: dw_mmc: add support tuning scheme

2013-08-30 Thread Seungwon Jeon
For the speed modes HS200 and SDR104, tuning is needed to determine the correct sampling point. Actual tuning procedure is provided by specific host controller driver. This patch defines the tuning command and tuning data. Additionally, 'struct dw_mci_slot' is moved to header file to consider the e

[PATCH 06/22] mmc: dw_mmc: socfpga: move socfpga private init

2013-08-30 Thread Seungwon Jeon
From: Yuvaraj Kumar C D Currently platform specific private data initialization is done by dw_mci_socfpga_priv_init and dw_mci_socfpga_parse_dt. As we already have separate platform specific device tree parser dw_mci_socfpga_parse_dt, move the dw_mci_socfpga_priv_init code to dw_mci_socfpga_parse

[PATCH 02/22] mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT

2013-08-30 Thread Seungwon Jeon
From: Doug Anderson If the WAKEUP_INT is asserted at wakeup and not cleared, we'll end up looping around forever. This has been seen to happen on exynos5420 silicon despite the fact that we haven't enabled any wakeup events due to a silicon errata. It is safe to do on all exynos variants. Sign

[PATCH 03/22] mmc: dw_mmc: Honor requests to set the clock to 0

2013-08-30 Thread Seungwon Jeon
From: Doug Anderson Previously the dw_mmc driver would ignore any requests to disable the card's clock. This doesn't seem like a good thing in general, but had one extra bad side effect in the following situation: * mmc core would set clk to 400kHz at boot time while scanning * mmc core would se

[PATCH 01/22] mmc: dw_mmc: don't queue up a card detect at slot startup

2013-08-30 Thread Seungwon Jeon
From: Doug Anderson The MMC subsystem handles looking for a card at probe time. Queuing up our own can race with the rest of the MMC subsystem and cause problems if we get unlucky with timing. Just remove driver own detection triggering. While progressing the request from 'mmc_rescan', if 'dw_mci

[PATCH 00/22] mmc: dw_mmc: add driver's updates

2013-08-30 Thread Seungwon Jeon
This patch set includes updates of dw_mmc driver. - Tuning scheme for high speed mode such as HS200. - Support of HS200 mode in exynos host - Involved some fixes and code clean-up Doug Anderson (4): mmc: dw_mmc: don't queue up a card detect at slot startup mmc: dw_mmc: Add exynos res

[PATCH 04/22] mmc: dw_mmc: Set timeout to max upon resume

2013-08-30 Thread Seungwon Jeon
From: Doug Anderson The TMOUT register is set to 0x at probe time but isn't set after suspend/resume. Add an init of this value. No problems were observed without this (it will also be set in __dw_mci_start_request if there is data to send), but it makes the register dump before and aft

[PATCH 05/22] mmc: dw_mmc: exynos: move the exynos private init

2013-08-30 Thread Seungwon Jeon
From: Yuvaraj Kumar C D Currently platform specific private data initialization is done by dw_mci_exynos_priv_init and dw_mci_exynos_parse_dt. As we already have separate platform specific device tree parser dw_mci_exynos_parse_dt, move the dw_mci_exynos_priv_init code to dw_mci_exynos_parse_dt.

Re: mmc0: Timeout waiting for hardware interrupt.

2013-08-30 Thread Christian Gmeiner
Hi Prasanna. > Sorry for the late reply. I had faced the similar problem in the past. > No problem... > There are certain 4.5 features like BKOPS, Sanitize, cache control operations > which uses CMD6 to trigger the operation and use DAT0 line for busy signalling > which was not monitored for pro

[PATCH] mmc: enable BKOPS for supported eMMC(4.41)

2013-08-30 Thread Prasanna NAVARATNA
>From d596be94f87b86ccb372a4ae55ee478951524895 Mon Sep 17 00:00:00 2001 From: Prasanna NAVARATNA Date: Fri, 30 Aug 2013 17:18:32 +0530 Subject: [PATCH] mmc: enable BKOPS for supported eMMC(4.41) BKOPS feature is optional for eMMC 4.41. If an eMMC supports BKOPS and is of version 4.41 then BKOPS f

RE: [PATCH v7 2/3] mmc: dw_mmc: Honor requests to set the clock to 0 (turn off clock)

2013-08-30 Thread Seungwon Jeon
Hi Doug, On Friday, August 30, 2013, Doug Anderson wrote: > Previously the dw_mmc driver would ignore any requests to disable the > card's clock. This doesn't seem like a good thing in general, but had > one extra bad side effect in the following situtation: > * mmc core would set clk to 400kHz a

[PATCH] mmc: dw_mmc: update binding document exynos-dw-mshc.txt

2013-08-30 Thread Yuvaraj Kumar C D
This patch updates the exynos-dw-mshc.txt.Currently we are using "pinctrl" binding property to describe the CMD and DATA line's of Mobile Storage Host Controller(mshc) node. Compatibility string is added in the driver with the patch. [1] mmc: dw_mmc: exynos: configure SMU in exynos5420. DT nodes

[RFC V4 4/4] mmc: dw_mmc: exynos: configure SMU in exynos5420.

2013-08-30 Thread Yuvaraj Kumar C D
Exynos5420 Mobile Storage Host controller has Security Management Unit (SMU) for channel 0 and channel 1 (mainly for eMMC).This patch configures SMU for exynos5420. This patch is on top of the below patches [1]mmc: dw_mmc: Add exynos resume_noirq callback to clear WAKEUP_INT. [2]ARM: dts: Add dwm

[RFC V4 2/4] mmc: dw_mmc: socfpga: move socfpga private init

2013-08-30 Thread Yuvaraj Kumar C D
Currently platform specific private data initialisation is done by dw_mci_socfpga_priv_init and dw_mci_socfpga_parse_dt.As we already have separate platform specific device tree parser dw_mci_socfpga_parse_dt, move the dw_mci_socfpga_priv_init code to dw_mci_socfpga_parse_dt. We can use the dw_mci_

[RFC V4 1/4] mmc: dw_mmc: exynos: move the exynos private init

2013-08-30 Thread Yuvaraj Kumar C D
Currently platform specific private data initialisation is done by dw_mci_exynos_priv_init and dw_mci_exynos_parse_dt.As we already have separate platform specific device tree parser dw_mci_exynos_parse_dt, move the dw_mci_exynos_priv_init code to dw_mci_exynos_parse_dt. We can use the dw_mci_exyno

[RFC V4 3/4] mmc: dw_mmc: move the platform specific init call

2013-08-30 Thread Yuvaraj Kumar C D
Current platform specific private data initialisation call dw_mci_exynos_priv_init can be used to do platform specific initialisation of SMU and others in future.So the drv_data->init call has moved to dw_mci_probe. changes since V3: none changes since V2: none changes since V1: none Signed-off-b

[RFC V4 0/4] dw_mmc platform specific private data and SMU init

2013-08-30 Thread Yuvaraj Kumar C D
changes from V3: changes only in the patch mmc: dw_mmc: exynos: configure SMU in exynos5420. 1.Added new compatible string "samsung,exynos5420-dw-mshc-smu" for the host with SMU. 2.Used compatible string "samsung,exynos5420-dw-mshc-smu" for controller in

Re: [PATCH] mmc: sdhci-s3c: Check if clk_set_rate() succeeds

2013-08-30 Thread Jaehoon Chung
Looks good to me. Acked-by: Jaehoon Chung On 08/30/2013 01:15 AM, Mark Brown wrote: > From: Mark Brown > > 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 > --- > drivers/mmc/host/