History log of /drivers/mmc/host/sdhci-s3c.c
Revision Date Author Comments
2137f5d3b8e8e04cff06194cacd0f6357495ac94 12-Aug-2014 Peter Griffin <peter.griffin@linaro.org> mmc: remove .owner field for drivers using module_platform_driver

This patch removes the superflous .owner field for drivers which
use the module_platform_driver API, as this is overriden in
platform_driver_register anyway.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
221414db1934c1c883501998f510bb75acfbaa51 07-Aug-2014 Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> mmc: sdhci-s3c: fix runtime PM handling on sdhci_add_host() failure

Runtime Power Management handling for the sdhci_add_host() failure
case in sdhci_s3c_probe() should match the code in sdhci_s3c_remove()
(which uses pm_runtime_disable() call which matches the earlier
pm_runtime_enable() one). Fix it.

This patch fixes "BUG: spinlock bad magic on CPU#0, swapper/0/1" and
"Unbalanced pm_runtime_enable!" warnings.

>From the kernel log:
...
[ 1.659631] s3c-sdhci 12530000.sdhci: sdhci_add_host() failed
[ 1.665096] BUG: spinlock bad magic on CPU#0, swapper/0/1
[ 1.670433] lock: 0xea01e484, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[ 1.677895] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.16.0-next-20140804-00008-ga59480f-dirty #707
[ 1.687037] [<c0013ae4>] (unwind_backtrace) from [<c0010d70>] (show_stack+0x10/0x14)
[ 1.694740] [<c0010d70>] (show_stack) from [<c04050c8>] (dump_stack+0x68/0xb8)
[ 1.701948] [<c04050c8>] (dump_stack) from [<c0052558>] (do_raw_spin_lock+0x15c/0x1a4)
[ 1.709848] [<c0052558>] (do_raw_spin_lock) from [<c040a630>] (_raw_spin_lock_irqsave+0x20/0x28)
[ 1.718619] [<c040a630>] (_raw_spin_lock_irqsave) from [<c030d7d0>] (sdhci_do_set_ios+0x1c/0x5cc)
[ 1.727464] [<c030d7d0>] (sdhci_do_set_ios) from [<c030ddfc>] (sdhci_runtime_resume_host+0x50/0x104)
[ 1.736574] [<c030ddfc>] (sdhci_runtime_resume_host) from [<c02462dc>] (pm_generic_runtime_resume+0x2c/0x40)
[ 1.746383] [<c02462dc>] (pm_generic_runtime_resume) from [<c0247898>] (__rpm_callback+0x34/0x70)
[ 1.755233] [<c0247898>] (__rpm_callback) from [<c02478fc>] (rpm_callback+0x28/0x88)
[ 1.762958] [<c02478fc>] (rpm_callback) from [<c02486f0>] (rpm_resume+0x384/0x4ec)
[ 1.770511] [<c02486f0>] (rpm_resume) from [<c02488b0>] (pm_runtime_forbid+0x58/0x64)
[ 1.778325] [<c02488b0>] (pm_runtime_forbid) from [<c030ea70>] (sdhci_s3c_probe+0x4a4/0x540)
[ 1.786749] [<c030ea70>] (sdhci_s3c_probe) from [<c02429cc>] (platform_drv_probe+0x2c/0x5c)
[ 1.795076] [<c02429cc>] (platform_drv_probe) from [<c02415f0>] (driver_probe_device+0x114/0x234)
[ 1.803929] [<c02415f0>] (driver_probe_device) from [<c024179c>] (__driver_attach+0x8c/0x90)
[ 1.812347] [<c024179c>] (__driver_attach) from [<c023ffb4>] (bus_for_each_dev+0x54/0x88)
[ 1.820506] [<c023ffb4>] (bus_for_each_dev) from [<c0240df8>] (bus_add_driver+0xd8/0x1cc)
[ 1.828665] [<c0240df8>] (bus_add_driver) from [<c0241db8>] (driver_register+0x78/0xf4)
[ 1.836652] [<c0241db8>] (driver_register) from [<c00088a4>] (do_one_initcall+0x80/0x1d0)
[ 1.844816] [<c00088a4>] (do_one_initcall) from [<c059ac94>] (kernel_init_freeable+0x108/0x1d4)
[ 1.853503] [<c059ac94>] (kernel_init_freeable) from [<c0401300>] (kernel_init+0x8/0xe4)
[ 1.861568] [<c0401300>] (kernel_init) from [<c000e538>] (ret_from_fork+0x14/0x3c)
[ 1.869582] platform 12530000.sdhci: Driver s3c-sdhci requests probe deferral
...
[ 1.997047] s3c-sdhci 12530000.sdhci: Unbalanced pm_runtime_enable!
...
[ 2.027235] s3c-sdhci 12530000.sdhci: sdhci_add_host() failed
[ 2.032884] platform 12530000.sdhci: Driver s3c-sdhci requests probe deferral
...

Tested on Hardkernel's Exynos4412 based ODROID-U3 board.

Fixes: 9f4e8151dbbc ("mmc: sdhci-s3c: Enable runtime power management")
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
11bc9381b277a65ea4b3fe994e658f4a78512139 26-May-2014 Jaehoon Chung <jh80.chung@samsung.com> mmc: sdhci-s3c: use mmc_of_parse and remove the card_tasklet

Fix the compile error.
(Removed the card_tasklet at "mmc: sdhci: push card_tasklet into treaded irq handler")

drivers/mmc/host/sdhci-s3c.c: In function ‘sdhci_s3c_notify_change’:
drivers/mmc/host/sdhci-s3c.c:402:25: error: ‘struct sdhci_host’ has no member named ‘card_tasklet’

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
96d7b78cfc2fd6b1539704e2d33239dbaa097cc4 25-Apr-2014 Russell King <rmk+kernel@arm.linux.org.uk> mmc: sdhci: convert sdhci_set_uhs_signaling() into a library function

Add sdhci_set_uhs_signaling() and always call the set_uhs_signaling
method. This avoids quirks being added into sdhci_set_uhs_signaling().

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Markus Pargmann <mpa@pengutronix.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
[Ulf Hansson] Resolved conflict
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
1771059cf5f9c09e37ef6315df8acf120f2642fc 25-Apr-2014 Russell King <rmk+kernel@arm.linux.org.uk> mmc: sdhci: convert sdhci_set_clock() into a library function

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Markus Pargmann <mpa@pengutronix.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
1650d0c71a209c7d6bdddda8a7e187c537ceb71a 25-Apr-2014 Russell King <rmk+kernel@arm.linux.org.uk> mmc: sdhci: move setting mmc->actual_clock into set_clock handlers

Move the setting of mmc->actual_clock to zero into the set_clock
handlers themselves. This will allow us to clean up the calling
logic for the set_clock() method, and turn sdhci_set_clock() into
a library function.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Markus Pargmann <mpa@pengutronix.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
373073efd06528867df963724a93f29c7d5534d0 25-Apr-2014 Russell King <rmk+kernel@arm.linux.org.uk> mmc: sdhci: move setting host->clock into sdhci_do_set_ios()

We don't need implementations to do this, since the only time it's
necessary is when we change the clock, and the only place that happens
is in sdhci_do_set_ios(). So, move it there, and remove it from the
iMX platform backend.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Markus Pargmann <mpa@pengutronix.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
03231f9b781f24205c0af0398ce3cbef70090939 25-Apr-2014 Russell King <rmk+kernel@arm.linux.org.uk> mmc: sdhci: convert reset into a library function

Rather than having platform_reset_enter/platform_reset_exit methods,
turn the core of the reset handling into a library function which
platforms can call at the appropriate moment in their (new) reset
method.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Markus Pargmann <mpa@pengutronix.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
2317f56c055fcad524bf6a873df48a754e7ebc4d 25-Apr-2014 Russell King <rmk+kernel@arm.linux.org.uk> mmc: sdhci: convert generic bus width setup to library function

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Markus Pargmann <mpa@pengutronix.de>
Tested-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
3beef62479bef4309a220f7ca5415d9a66c0b0cb 08-Mar-2014 Axel Lin <axel.lin@ingics.com> mmc: sdhci-s3c: Remove unused define for NUM_GPIOS

NUM_GPIOS is not used after e19499ae10903 ("mmc: sdhci-s3c: let device
core setup the default pin configuration"). Thus remove it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Chris Ball <chris@printf.net>
2200300060ada5e32136d597502e446ac2ef2a27 11-Jan-2014 Tomasz Figa <tomasz.figa@gmail.com> 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>
3ac147facfbd234acf3a990968de9746a399f133 11-Jan-2014 Tomasz Figa <tomasz.figa@gmail.com> 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>
222a13c5d0c67333e443a1ea2fcc746ad61f8d68 11-Jan-2014 Tomasz Figa <tomasz.figa@gmail.com> 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>
8f4b78d9bb042aacce43e0213c727da861a128f6 11-Jan-2014 Tomasz Figa <tomasz.figa@gmail.com> 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>
6eb28bdcb27249ca9981fb063d3f2485fd344500 11-Jan-2014 Tomasz Figa <tomasz.figa@gmail.com> 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>
8880a4a526340335403696f30daf4e05a413f3bd 11-Jan-2014 Tomasz Figa <tomasz.figa@gmail.com> 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>
285e244fef2463d2f6ec07488a0c86e709f6eb22 02-Aug-2013 Jaehoon Chung <jh80.chung@samsung.com> mmc: sdhci-s3c: initialize host->quirks2 for using quirks2

In order to use the quirks2, initialized the host->quirks2.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <Kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
7ef2a5e2f72325fd83c6e1ab76b139ca31c7f8ed 02-Aug-2013 Jaehoon Chung <jh80.chung@samsung.com> mmc: sdhci-s3c: fix the wrong register value, when clock is disabled

When use the QUIRK_NONSTANDARD_CLOCK, then never set to 0 at clock control
register. This patch fixes this problem.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
113a87f868b2f2e086790a68e8b9e41d8f0c3295 06-May-2013 Jingoo Han <jg1.han@samsung.com> mmc: remove unnecessary platform_set_drvdata()

The driver core clears the driver data to NULL after device_release
or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d
(device-core: Ensure drvdata = NULL when no driver is bound).
Thus, it is not needed to manually clear the device driver data to NULL.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Sonic Zhang <sonic.zhang@analog.com>
Acked-by: Seungwon Jeon <tgih.jun@samsung.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Chris Ball <cjb@laptop.org>
cc014f3e29e15140e35e14fa194034baee92df2a 04-Mar-2013 Arnd Bergmann <arnd@arndb.de> mmc: sdhci-s3c: remove platform dependencies

plat/regs-sdhci.h is not used anywhere but in the sdhci-s3c
driver, so it can become a local file there and all other
inclusions removed.

plat/sdhci.h is used only to define the platform devices,
and with the exception of the platform_data structure not
needed by the driver, so we can split out the platform_data
definition instead and leave the rest to platform code.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Chris Ball <cjb@laptop.org>
e19499ae10903807acbaa07a28d4b56d508ac339 06-Mar-2013 Thomas Abraham <thomas.abraham@linaro.org> mmc: sdhci-s3c: let device core setup the default pin configuration

With device core now able to setup the default pin configuration,
the call to devm_pinctrl_get_select_default can be removed. And
the pin configuration code based on the deprecated Samsung specific
gpio bindings is also removed.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
3aaf7ba7fda3cda285a407ad0a2acf1b183342fa 11-Feb-2013 Jingoo Han <jg1.han@samsung.com> mmc: sdhci-s3c: Use devm_clk_get()

Use devm_clk_get() rather than clk_get() to make cleanup paths
more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
7bc088d38f92f58df97e1cd9a8430331ee5491bb 21-Jan-2013 Sascha Hauer <s.hauer@pengutronix.de> mmc: sdhci: rename platform_8bit_width to platform_bus_width

The 8bit in the function name is misleading. When set, it will be
used to set the bus width, regardless of whether 8bit or another
bus width is requested, so change the function name to
platform_bus_width.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Dirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
a3e2cd7f24ba7521169943ace3d14b567487ea29 21-Jan-2013 Thierry Reding <thierry.reding@avionic-design.de> mmc: Convert to devm_ioremap_resource()

Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.

Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Chris Ball <cjb@laptop.org>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4577f77ba76127cd9e72e06f44d743894d34ac8b 04-Dec-2012 Sachin Kamat <sachin.kamat@linaro.org> mmc: sdhci-s3c: Fix compilation warning

'sc' is used only when CONFIG_PM_RUNTIME is defined. Hence define it
conditionally.

Silences the following warning:
drivers/mmc/host/sdhci-s3c.c: In function ‘sdhci_s3c_notify_change’:
drivers/mmc/host/sdhci-s3c.c:378:20: warning: unused variable ‘sc’ [-Wunused-variable]

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
b96efccb8fc9939605599e5b2c026644973cc92d 16-Nov-2012 Tomasz Figa <t.figa@samsung.com> mmc: host: sdhci-s3c: Add support for pinctrl

This patch adds support for pin configuration using pinctrl subsystem
to the sdhci-s3c driver.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
b1b8fea94f4c71b5503b7e29974635121f44b302 25-Nov-2012 Tomasz Figa <t.figa@samsung.com> mmc: host: sdhci-s3c: Use devm_gpio_request to request GPIOs

The set of GPIO pins used by sdhci-s3c driver varies between
configurations, such as card detect method, pinctrl availability, etc.
This overly complicates the code requesting and freeing GPIO pins, which
must check which pins are used, when freeing them.

This patch modifies the sdhci-s3c driver to use devm_gpio_request to
free requested pins automatically after unbinding the driver.

Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Acked-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
ab5023efdcfa87512663aca120245b0fec8511eb 20-Nov-2012 Tushar Behera <tushar.behera@linaro.org> mmc: sdhci-s3c: Use NULL instead of 0 for pointers

The third argument for of_get_property() is a pointer, hence pass
NULL instead of 0.

Fixes the following sparse warning:
sdhci-s3c.c:452:48: warning: Using plain integer as NULL pointer
sdhci-s3c.c:457:52: warning: Using plain integer as NULL pointer

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
fe007c02f9659f5c0ae6f3ceaf45076df92cc88e 18-Nov-2012 Heiko Stübner <heiko@sntech.de> mmc: sdhci-s3c: fix missing clock for gpio card-detect

2abeb5c5ded2 ("Add clk_(enable/disable) in runtime suspend/resume")
added the capability to stop the clocks when the device is runtime
suspended, but forgot to handle the case of the card-detect using
an external gpio.

Therefore in the case that runtime-pm is enabled, start the io-clock
when a card is inserted and stop it again once it is removed.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
6e0ee714fdab0568c3487455951dea2673e9557f 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> mmc: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Chris Ball <cjb@laptop.org>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Cc: Venkatraman S <svenkatr@ti.com>
Cc: Viresh Kumar <viresh.linux@gmail.com>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: Bruce Chang <brucechang@via.com.tw>
Cc: Harald Welte <HaraldWelte@viatech.com>
Cc: Pierre Ossman <pierre@ossman.eu>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
c3be1efd41a97f93be390240387d356a07b664c7 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> mmc: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Chris Ball <cjb@laptop.org>
Cc: Manuel Lauss <manuel.lauss@gmail.com>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Cc: Venkatraman S <svenkatr@ti.com>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: Bruce Chang <brucechang@via.com.tw>
Cc: Harald Welte <HaraldWelte@viatech.com>
Cc: Pierre Ossman <pierre@ossman.eu>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0433c14356702e296f474f77ebd42f0a9d9a5487 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> mmc: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Chris Ball <cjb@laptop.org>
Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Cc: Jarkko Lavinen <jarkko.lavinen@nokia.com>
Cc: Venkatraman S <svenkatr@ti.com>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: Bruce Chang <brucechang@via.com.tw>
Cc: Harald Welte <HaraldWelte@viatech.com>
Cc: Pierre Ossman <pierre@ossman.eu>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0aa55c2367f082876f92660312214cd20c6a024b 30-Oct-2012 Seungwon Jeon <tgih.jun@samsung.com> mmc: sdhci-s3c: fix the card detection in runtime-pm

If host clock is disabled, host cannot detect a card in case of using
CD internal for detection.

Signed-off-by: Seungwon Jeon <tgih.jun@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
0f310a057feb91ff17a7f4d5f8405e73035084e2 03-Oct-2012 Thomas Abraham <thomas.abraham@linaro.org> mmc: sdhci-s3c: use clk_prepare_enable and clk_disable_unprepare

Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
calls as required by common clock framework.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
2abeb5c5ded2e7f7d288058426fb0ae852adc77f 21-Sep-2012 Chander Kashyap <chander.kashyap@gmail.com> mmc: sdhci-s3c: Add clk_(enable/disable) in runtime suspend/resume

Perform clock disable/enable in runtime suspend/resume.

Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
5feb54a1ab91a237e247c013b8c4fb100ea347b1 19-Sep-2012 Jaehoon Chung <jh80.chung@samsung.com> mmc: sdhci-s3c: fix the wrong number of max bus clocks

We can use up to four bus-clocks; but on module remove, we didn't
disable the fourth bus clock.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
387a8cbdf84d5c417d24eabfdf9fe4e0b94458da 14-Sep-2012 Chander Kashyap <chander.kashyap@linaro.org> mmc: sdhci-s3c: Fix crash on module insertion for second time

If sdhci-s3c driver is built as module, it gives following error if inserted
again after removing. This was happening as pm_runtime_use_autosuspend() is
called in sdhci_s3c_probe() function but in sdhci_s3c_remove() its
complementary pm_runtime_dont_use_autosuspend() is not called.

BUG: spinlock bad magic on CPU#1, insmod/955
lock: 0xee771368, .magic: 00000000, .owner: insmod/955, .owner_cpu: 1
[<c00147e0>] (unwind_backtrace+0x0/0xf8) from [<c0136b40>] (do_raw_spin_unlock+0xa4/0xe4)
[<c0136b40>] (do_raw_spin_unlock+0xa4/0xe4) from [<c01be508>] (_raw_spin_unlock_irqrestore+0xc/0x38)
[<c01be508>] (_raw_spin_unlock_irqrestore+0xc/0x38) from [<c01a9334>] (sdhci_runtime_suspend_host+0x54/0x80)
[<c01a9334>] (sdhci_runtime_suspend_host+0x54/0x80) from [<bf0060a8>] (sdhci_s3c_runtime_suspend+0x14/0x38 [sdhci_s3c])
[<bf0060a8>] (sdhci_s3c_runtime_suspend+0x14/0x38 [sdhci_s3c]) from [<c016cb00>] (pm_generic_runtime_suspend+0x2c/0x40)
[<c016cb00>] (pm_generic_runtime_suspend+0x2c/0x40) from [<c0170090>] (__rpm_callback+0x70/0x98)
[<c0170090>] (__rpm_callback+0x70/0x98) from [<c01703f0>] (rpm_suspend+0xf0/0x534)
[<c01703f0>] (rpm_suspend+0xf0/0x534) from [<c0171670>] (__pm_runtime_suspend+0x5c/0x74)
[<c0171670>] (__pm_runtime_suspend+0x5c/0x74) from [<c016d018>] (pm_generic_runtime_idle+0x44/0x4c)
[<c016d018>] (pm_generic_runtime_idle+0x44/0x4c) from [<c0170090>] (__rpm_callback+0x70/0x98)
[<c0170090>] (__rpm_callback+0x70/0x98) from [<c0170984>] (rpm_idle+0xdc/0x18c)
[<c0170984>] (rpm_idle+0xdc/0x18c) from [<c0171608>] (pm_runtime_set_autosuspend_delay+0x30/0x3c)
[<c0171608>] (pm_runtime_set_autosuspend_delay+0x30/0x3c) from [<bf0069c4>] (sdhci_s3c_probe+0x35c/0x52c [sdhci_s3c])
[<bf0069c4>] (sdhci_s3c_probe+0x35c/0x52c [sdhci_s3c]) from [<c016a014>] (platform_drv_probe+0x18/0x1c)

Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
e684c46876f1d0c1c4964741244a34b6be837b5f 14-Sep-2012 Chander Kashyap <chander.kashyap@linaro.org> mmc: sdhci-s3c: Enable only required bus clock

In case of multiple bus clock sources, all the clock sources were
getting enabled. As only one clock source is needed at the time hence
enable only the required bus clock.

This patch does as follows:
1. In sdhci_s3c_probe enable only required bus clock source.

2. Handle the disabling of old bus clock and enables the
best clock selected in sdhci_s3c_set_clock().

Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
cd1b00eb24b0b204303211df7ffd1a77a1005824 23-Aug-2012 Thomas Abraham <thomas.abraham@linaro.org> mmc: sdhci-s3c: Add device tree support

Add device tree based discovery support for Samsung's sdhci controller.

Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
2ad0b2494f83d87046db2c4fe6256546d44b3160 29-Aug-2012 Jingoo Han <jg1.han@samsung.com> mmc: sdhci-s3c: fix checkpatch error and warnings

This patch fixes the checkpatch error and warnings listed below:

ERROR: return is not a function, parentheses are not required
WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
WARNING: quoted string split across lines
WARNING: line over 80 characters
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
81ec1daa118ec9a04c0a907883872ae2996372bd 03-Jun-2012 Heiko Stübner <heiko@sntech.de> mmc: sdhci-s3c: pass IRQF ONESHOT to request threaded irq

Fix a boot regression in existing kernels causing:

genirq: Threaded irq requested with handler=NULL and !ONESHOT for irq XXX

caused by 1c6c6952 (genirq: Reject bogus threaded irq requests).

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Chris Ball <cjb@laptop.org>
9f4e8151dbbc4ca4d5dd7792666a50c137102204 01-Apr-2012 Mark Brown <broonie@opensource.wolfsonmicro.com> mmc: sdhci-s3c: Enable runtime power management

Since most of the work is already done by the core we just need to add
runtime suspend methods and tell the PM core that runtime PM is enabled
for this device.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
d5e9c02cab60920d5ac16a8244bb6085dc27564f 03-Mar-2012 Mark Brown <broonie@opensource.wolfsonmicro.com> mmc: sdhci-s3c: Use CONFIG_PM_SLEEP to ifdef system suspend

This matches current best practice as one can have runtime PM enabled
without system sleep and CONFIG_PM is defined for both.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
9bda6da7ff7d35ef757e235aae559e679d3a9493 09-Mar-2012 Julia Lawall <Julia.Lawall@lip6.fr> mmc: sdhci-s3c: use devm_ functions

The various devm_ functions allocate memory that is released when a driver
detaches. This patch uses these functions for data that is allocated in
the probe function of a platform device and is only freed in the remove
function.

By using devm_ioremap, it also removes a potential memory leak, because
there was no call to iounmap in the probe function.

The call to platform_get_resource was moved just to make it closer to the
place where its result it used.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Chris Ball <cjb@laptop.org>
1d4dc338bb7cbbadcb5a527b1b0e897b5cde1701 16-Feb-2012 Thomas Abraham <thomas.abraham@linaro.org> mmc: sdhci-s3c: Keep a copy of platform data and use it

The platform data is copied into driver's private data and the copy is
used for all access to the platform data. This simpifies the addition
of device tree support for the sdhci-s3c driver.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
0d22c77089c86416324d0d87e7ef8cfa931e53cd 01-Apr-2012 Thomas Abraham <thomas.abraham@linaro.org> mmc: sdhci-s3c: derive transfer width host cap from max_width in platdata

max_width member in platform data can be used to derive the mmc bus transfer
width that can be supported by the controller.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
3119936a289db88cf749143fa5ef6b4a4712e3c0 16-Feb-2012 Thomas Abraham <thomas.abraham@linaro.org> mmc: sdhci-s3c: Remove usage of clk_type member in platform data

SDHCI controllers on Exynos4 do not include the sdclk divider as per the
sdhci controller specification. This case can be represented using the
sdhci quirk SDHCI_QUIRK_NONSTANDARD_CLOCK instead of using an additional
enum type definition 'clk_types'.

Hence, usage of clk_type member in platform data is removed and the sdhci
quirk is used. In addition to that, since this qurik is SoC specific,
driver data is introduced to represent controllers on SoC's that require
this quirk.

Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Jeongbae Seo <jeongbae.seo@samsung.com>
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
c1c4b66dc010bb69456f7f7c25442772bbe54dbd 07-Feb-2012 Jaehoon Chung <jh80.chung@samsung.com> mmc: sdhci-s3c: add platform data for the second capability

This patch is added host_caps2 in sdhci-s3c.c
It's necessary that use the second capabilities.
And removed the duplicated host_caps.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
7003fecbf0c9f7dde75d93ba75e0cb7ddb662749 14-Dec-2011 Jingoo Han <jg1.han@samsung.com> mmc: sdhci-s3c: use S3C_SDHCI_CONTROL2 instead of hardcoded offset value

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
fa1773cc5b78faa1ef0ab1ab0f48bce7bc72cec5 07-Nov-2011 Sangwook Lee <sangwook.lee@linaro.org> mmc: sdhci-s3c: Add pm_caps into SD/MMC host

sdhci-s3c updates pm_caps from platform data for SDIO PM.

Signed-off-by: Sangwook Lee <sangwook.lee@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
d1f81a64a4250bdd776978be06ae2b8e13ec7471 25-Nov-2011 Axel Lin <axel.lin@gmail.com> mmc: convert drivers/mmc/host/* to use module_platform_driver()

This patch converts the drivers in drivers/mmc/host/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
Acked-by: David Brown <davidb@codeaurora.org>
Acked-by: Viresh Kumar <viresh.kumar@st.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
4346b6d9c6651121f35ae9e42f240f36a8e56ce6 03-Nov-2011 Rajeshwari Shinde <rajeshwari.s@samsung.com> mmc: sdhci-s3c: Use generic clock names for sdhci bus clock options

This patch modifies the driver to stop depending on the clock names
being passed from the platform and switch over to bus clock lookup
using generic clock names.

Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
29495aa04a30c21565243c5b9c028510446d242c 03-Nov-2011 Manuel Lauss <manuel.lauss@googlemail.com> mmc: sdhci: remove "state" argument from sdhci_suspend_host

Drop the "state" argument from sdhci_suspend_host. Its only user is the
PCI glue; this allows to move all SDHCI glues to use dev_pm_ops instead.

Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
524bfca2b42a7c9dc43af13e1592b21dd1ce3fcc 21-Nov-2011 Mark Brown <broonie@opensource.wolfsonmicro.com> mmc: sdhci-s3c: Remove old and misprototyped suspend operations

Now that the driver is using dev_pm_ops the suspend operations in the
platform_driver structure won't get called so don't need to be there,
and certainly shouldn't be the same function as dev_pm_ops since the
signatures are different.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
326adda53a50ece492c3edaa60afc26fba5e3232 12-Oct-2011 Jaehoon Chung <jh80.chung@samsung.com> mmc: sdhci-s3c: fix potential NULL dereference

sc->clk_bus[ptr] could be NULL.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
6fe47179a07009ee3ee7c8b962966fee420becc8 13-Sep-2011 Thomas Abraham <thomas.abraham@linaro.org> mmc: sdhci-s3c: add default controller configuration

The default controller configuration which was previously setup by
platform helper functions is moved into the driver.

Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
49bb1e619568ec84785ceb366f07db2a6f0b64cc 26-Aug-2011 Girish K S <girish.shivananjappa@linaro.org> mmc: sdhci-s3c: Fix mmc card I/O problem

This patch fixes the problem in sdhci-s3c host driver for Samsung Soc's.
During the card identification stage the mmc core driver enumerates for
the best bus width in combination with the highest available data rate.
It starts enumerating from the highest bus width (8) to lowest width (1).

In case of few MMC cards the 4-bit bus enumeration fails and tries
the 1-bit bus enumeration. When switched to 1-bit bus mode the host driver
has to clear the previous bus width setting and apply the new setting.

The current patch will clear the previous bus mode and apply the new
mode setting.

Signed-off-by: Girish K S <girish.shivananjappa@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Cc: <stable@kernel.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
55156d240a4d41d47310278c5139e24517f1c65b 29-Jul-2011 Mark Brown <broonie@opensource.wolfsonmicro.com> mmc: sdhci-s3c: Fix build for header change

A header change has removed an implicit inclusion of module.h, breaking
the build due to the use of THIS_MODULE. Fix that.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
7199e2b61d715c5e8901ff32513d2b80db8d3737 12-Jul-2011 Jaehoon Chung <jh80.chung@samsung.com> mmc: sdhci-s3c: add BROKEN_ADMA_ZEROLEN_DESC quirk

Samsung SoCs need to set BROKEN_ADMA_ZEROLEN_DESC.
(If ADMA operation is more than 65535, maybe set by zero.)

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
65d13516b2358c38ac56a5f83e989a6837dcf825 29-Jun-2011 Wonil Choi <wonil22.choi@samsung.com> mmc: sdhci-s3c: Fix return value in sdhci_s3c_suspend/resume()

Signed-off-by: Wonil Choi <wonil22.choi@samsung.com>
Signed-off-by: Minho Ban <mhban@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
732f0e31db03c84005578927ed9d4e996c3c0020 29-Oct-2010 Kyungmin Park <kyungmin.park@samsung.com> mmc: sdhci-s3c: Auto CMD12 support

Samsung SDHCI host controller supports the Auto CMD12.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
548f07d2a36a4b085c059edb25edb3cd8d71fe3e 12-Jan-2011 Jaehoon Chung <jh80.chung@samsung.com> mmc: sdhci-s3c: add platform_8bit_width() hook

We have 8-bit width support but is not a v3 controller.
So we need platform_8bit_width() to support 8-bit buswidth.
Also we need MMC_CAP_8_BIT_DATA, so we add it in platdata.

This gets 8-bit support working again on s3c, after we previously
disabled 8-bit by default on non-v3 controllers.

Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
253e0a7c3dc4bbbc69fc6bfd7c01bc4c9397a5e5 08-Oct-2010 Jeongbae Seo <jeongbae.seo@samsung.com> mmc: sdhci-s3c: Support controllers with no internal clock divider

This patch supports controllers with no internal clock divider in SDHCI,
such as the s5pc210 board. The external clock divider can be used to
make a proper clock because SDHCI doesn't support internal clock divider
by itself.

If external clock divider type is selected, some functions related
to clock control will be overrided by other functions.

The current clock control index is added to let you know which
clock bus is used for SDHCI when overriding functions.

Checking functions are added into sdhci_s3c_consider_clock, because
the clock divider step is different from that of host controller.

Signed-off-by: Jeongbae Seo <jeongbae.seo@samsung.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
b3824f2c6f16ef19060a53ef9345a124de175098 08-Oct-2010 Jeongbae Seo <jeongbae.seo@samsung.com> mmc: sdhci-s3c: Support additional host capabilities

This patch adds support for additional host capabilities like SD/MMC
high speed, SDHCI bus width, etc.

Signed-off-by: Jeongbae Seo <jeongbae.seo@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
9320f7cbbdd5febf013b0e91db29189724057738 23-Sep-2010 Marek Szyprowski <m.szyprowski@samsung.com> mmc: sdhci-s3c: fix NULL ptr access in sdhci_s3c_remove

If not all clocks have been defined in platform data, the driver will
cause a null pointer dereference when it is removed. This patch fixes
this issue.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
06fe577f841f383b2d4f743cfb74fac7f6468353 20-Sep-2010 Marek Szyprowski <m.szyprowski@samsung.com> mmc: sdhci-s3c: fix incorrect spinlock usage after merge

In the commit f522886e202a34a2191dd5d471b3c4d46410a9a0 a merge conflict
in the sdhci-s3c driver been fixed. However the fix used incorrect
spinlock operation - it caused a race with sdhci interrupt service. The
correct way to solve it is to use spin_lock_irqsave/irqrestore() calls.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
f522886e202a34a2191dd5d471b3c4d46410a9a0 19-Aug-2010 Kyungmin Park <kyungmin.park@samsung.com> drivers/mmc/host/sdhci-s3c.c: use the correct mutex and card detect function

There's some merge problem between sdhic core and sdhci-s3c host. After
mutex is changed to spinlock. It needs to use use spin lock functions and
use the correct card detection function.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
17866e14f3a4f219e94f1374ece7226479418ff8 11-Aug-2010 Marek Szyprowski <m.szyprowski@samsung.com> sdhci-s3c: add support for new card detection methods

On some Samsung SoCs not all SDHCI controllers have card detect (CD) line.
For some embedded designs it is not even needed, because ususally the
device (like SDIO flash memory or wifi controller) is permanently wired to
the controller. There are also systems which have a card detect line
connected to some of the external interrupt lines or the presence of the
card depends on some other actions (like enabling a power regulator).

This patch adds support for all these cases. The following card detection
methods are possible:

1. internal sdhci host card detect line
2. external event
3. external gpio interrupt
4. no card detect line, controller will poll for the card
5. no card detect line, card is permanently wired to the controller
(once detected host won't poll it any more)

By default, all existing code would use method #1, what is compatible with
the previous version of the driver.

In case of external event, two callbacks must be provided in platdata:
ext_cd_init and ext_cd_cleanup. Both of them get a callback to a function
that notifies the s3c-sdhci host contoller as their argument. That
callback function should be called from the even dispatcher to let host
notice the card insertion/removal.

In case of external gpio interrupt, a gpio pin number must be provided in
platdata (ext_cd_gpio parameter), as well as the information about the
polarity of that gpio pin (ext_cd_gpio_invert). By default
(ext_cd_gpio_invert == 0) gpio value 0 means 'card has been removed', but
this can be changed to 'card has been removed' when ext_cd_gpio_invert ==
1.

This patch adds all required changes to sdhci-s3c driver.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a1d5646005af1247d6ae78434bb4db15b07a07b2 11-Aug-2010 Marek Szyprowski <m.szyprowski@samsung.com> sdhci-s3c: enable SDHCI_QUIRK_NO_HISPD_BIT quirk

This patch enables SDHCI_QUIRK_NO_HISPD_BIT on Samsung SDHCI driver. This
solves detection problems with some external SD cards. This change has
been tested on S5PC100 and S5PC110. It has no inpact on driver speed.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ce5f036bbbfc6c21d7b55b8fdaa2e2bd56392d94 11-Aug-2010 Marek Szyprowski <m.szyprowski@samsung.com> sdhci-s3c: add support for the non standard minimal clock value

S3C SDHCI host controller can change the source for generating mmc clock.
By default host bus clock is used, what causes some problems on machines
with 133MHz bus, because the SDHCI divider cannot be as high get proper
clock value for identification mode. This is not a problem for the
controller, because it can generate lower frequencies from other clock
sources. This patch changes sdhci driver to use get_min_clock() call if
it has been provided.

This fixes the flood of the following warnings on Samsung S5PV210 SoCs:
mmc0: Minimum clock frequency too high for identification mode

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3fe42e077f65351503f5004031549db330bb105e 11-Aug-2010 Hyuk Lee <hyuk1.lee@samsung.com> sdhci-s3c: add SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK quirk

On Samsung's SDMMC hosts the timeout clock is derivied from the SD Clock
which is set dynamically. So checked SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK
quirk and removed 'sdhci_s3c_get_timeout_clk' callback which doesn't need
any more.

Signed-off-by: Hyuk Lee <hyuk1.lee@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9d51a6b2487724e8713cd2794cf09ffeee5f6932 20-Jul-2010 Marek Szyprowski <m.szyprowski@samsung.com> sdhci-s3c: add missing remove function

System will crash sooner or later once the memory with the code of the
s3c-sdhci.ko module is reused for something else. I really have no idea
how the lack of remove function went unnoticed into the mainline code.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14c5aa6d3797c6b3d09193a8423472847f738526 26-May-2010 Maurus Cuelenaere <mcuelenaere@gmail.com> sdhci: enable multiblock transfers in sdhci-s3c

Wifi over SDIO doesn't work correctly without multiblock, so enable this.
This patch depends on the following patches:

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
Cc: Thomas Abraham <thomas.ab@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b2e75eff5e859d0c294e7405958362b26a423c6e 26-May-2010 Thomas Abraham <thomas.ab@samsung.com> mmc: s3c6410: enable ADMA feature in 6410 sdhci controller

Enable the ADMA feature in the 6410 SDHCI controller driver.

Signed-off-by: Maurus Cuelenaere <mcuelenaere@gmail.com>
Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
Acked-by: Ben Dooks <ben-linux@fluff.org>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
1388eefd5a5e6aaa3cb04070bfc2b944c1d24b82 14-Jun-2009 Ben Dooks <ben@simtec.co.uk> sdhci: Add SDHCI_QUIRK_NO_MULTIBLOCK quirk

Add quirk to show the controller cannot do multi-block IO.

This is mainly for the Samsung SDHCI controller that currently
cannot manage to do multi-block PIO without timing out.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>
0d1bb41ad4ebca92fafbab6d6c60438d7efef386 14-Jun-2009 Ben Dooks <ben@simtec.co.uk> sdhci-s3c: Samsung S3C based SDHCI controller glue

Add support for the 'HSMMC' block(s) in the Samsung SoC
line. These are compatible with the SDHCI driver so add
the necessary setup and driver binding for the platform
devices.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Pierre Ossman <pierre@ossman.eu>