From: Arnd Bergmann <arnd@arndb.de>
To: linux-arm-msm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
David Brown <davidb@codeaurora.org>,
Daniel Walker <dwalker@fifo99.com>,
Bryan Huntsman <bryanh@codeaurora.org>,
Stephen Boyd <sboyd@codeaurora.org>,
Tim Bird <tim.bird@sonymobile.com>,
Bjorn Andersson <bjorn.andersson@sonymobile.com>,
Linus Walleij <linus.walleij@linaro.org>,
linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
Arnd Bergmann <arnd@arndb.de>
Subject: [RFC PATCH 04/18] mmc: msm: move clk-reset logic to platform
Date: Wed, 4 Mar 2015 20:32:58 +0100 [thread overview]
Message-ID: <1425497592-1831064-5-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1425497592-1831064-1-git-send-email-arnd@arndb.de>
There is no generic interface for resetting a clock, and
creating a reset driver for msm seems overkill, so this
moves the reset logic from the msm_sdcc driver into
a platform_data callback that calls into the clock driver.
This follows the model that is used for all other devices
on the msm platform that require a clk reset.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/mach-msm/board-qsd8x50.c | 18 +++++++++++++++++-
arch/arm/mach-msm/board-trout-mmc.c | 18 ++++++++++++++++++
arch/arm/mach-msm/clock.c | 2 +-
drivers/mmc/host/msm_sdcc.c | 12 ++----------
include/linux/platform_data/mmc-msm_sdcc.h | 3 +++
5 files changed, 41 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 4c748616ef47..9676a73683d2 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -180,6 +180,21 @@ static uint32_t msm_sdcc_setup_power(struct device *dv, unsigned int vdd)
return 0;
}
+static void msm_sdcc_clk_reset(struct clk *clk)
+{
+ int ret;
+
+ ret = clk_reset(clk, CLK_RESET_ASSERT);
+ if (ret)
+ pr_err("sdcc clock assert failed at %lu Hz with err %d\n",
+ clk_get_rate(clk), ret);
+
+ ret = clk_reset(clk, CLK_RESET_DEASSERT);
+ if (ret)
+ pr_err("sdcc clock deassert failed at %lu Hz with err %d\n",
+ clk_get_rate(clk), ret);
+}
+
static struct msm_mmc_gpio_data sdc1_gpio = {
.gpio = sdc1_gpio_cfg,
.size = ARRAY_SIZE(sdc1_gpio_cfg),
@@ -188,7 +203,8 @@ static struct msm_mmc_gpio_data sdc1_gpio = {
static struct msm_mmc_platform_data qsd8x50_sdc1_data = {
.ocr_mask = MMC_VDD_27_28 | MMC_VDD_28_29,
.translate_vdd = msm_sdcc_setup_power,
- .gpio_data = &sdc1_gpio,
+ .gpio_data = &sdc1_gpio,
+ .clk_reset = msm_sdcc_clk_reset,
};
static void __init qsd8x50_init_mmc(void)
diff --git a/arch/arm/mach-msm/board-trout-mmc.c b/arch/arm/mach-msm/board-trout-mmc.c
index 3723e55819d6..2474bba71c8b 100644
--- a/arch/arm/mach-msm/board-trout-mmc.c
+++ b/arch/arm/mach-msm/board-trout-mmc.c
@@ -2,6 +2,7 @@
** Author: Brian Swetland <swetland@google.com>
*/
#include <linux/gpio.h>
+#include <linux/clk.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
@@ -14,6 +15,7 @@
#include <asm/io.h>
#include <mach/vreg.h>
+#include <mach/clk.h>
#include <linux/platform_data/mmc-msm_sdcc.h>
@@ -154,6 +156,21 @@ static unsigned int trout_sdslot_status(struct device *dev)
return (!status);
}
+static void trout_sdcc_clk_reset(struct clk *clk)
+{
+ int ret;
+
+ ret = clk_reset(clk, CLK_RESET_ASSERT);
+ if (ret)
+ pr_err("sdcc clock assert failed at %lu Hz with err %d\n",
+ clk_get_rate(clk), ret);
+
+ ret = clk_reset(clk, CLK_RESET_DEASSERT);
+ if (ret)
+ pr_err("sdcc clock deassert failed at %lu Hz with err %d\n",
+ clk_get_rate(clk), ret);
+}
+
#define TROUT_MMC_VDD MMC_VDD_165_195 | MMC_VDD_20_21 | MMC_VDD_21_22 \
| MMC_VDD_22_23 | MMC_VDD_23_24 | MMC_VDD_24_25 \
| MMC_VDD_25_26 | MMC_VDD_26_27 | MMC_VDD_27_28 \
@@ -163,6 +180,7 @@ static struct msm_mmc_platform_data trout_sdslot_data = {
.ocr_mask = TROUT_MMC_VDD,
.status = trout_sdslot_status,
.translate_vdd = trout_sdslot_switchvdd,
+ .clk_reset = trout_sdcc_clk_reset,
};
int __init trout_init_mmc(unsigned int sys_rev)
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index 35ea02b52483..0b59ad5eb557 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -23,6 +23,6 @@ int clk_reset(struct clk *clk, enum clk_reset_action action)
{
struct clk_hw *hw = __clk_get_hw(clk);
struct msm_clk *m = to_msm_clk(hw);
+
return m->reset(hw, action);
}
-EXPORT_SYMBOL(clk_reset);
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 3002e377e9f7..be5b9b3b3843 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -45,7 +45,6 @@
#include <asm/sizes.h>
#include <linux/platform_data/mmc-msm_sdcc.h>
-#include <mach/clk.h>
/* data mover definitions */
@@ -493,15 +492,8 @@ static void msmsdcc_reset_and_restore(struct msmsdcc_host *host)
mci_mask0 = readl(host->base + MMCIMASK0);
/* Reset the controller */
- ret = clk_reset(host->clk, CLK_RESET_ASSERT);
- if (ret)
- pr_err("%s: Clock assert failed at %u Hz with err %d\n",
- mmc_hostname(host->mmc), host->clk_rate, ret);
-
- ret = clk_reset(host->clk, CLK_RESET_DEASSERT);
- if (ret)
- pr_err("%s: Clock deassert failed at %u Hz with err %d\n",
- mmc_hostname(host->mmc), host->clk_rate, ret);
+ if (host->plat->clk_reset)
+ host->plat->clk_reset(host->clk);
pr_info("%s: Controller has been re-initialiazed\n",
mmc_hostname(host->mmc));
diff --git a/include/linux/platform_data/mmc-msm_sdcc.h b/include/linux/platform_data/mmc-msm_sdcc.h
index 55aa873c9396..6f1821a4bf93 100644
--- a/include/linux/platform_data/mmc-msm_sdcc.h
+++ b/include/linux/platform_data/mmc-msm_sdcc.h
@@ -15,6 +15,8 @@ struct msm_mmc_gpio_data {
u8 size;
};
+struct clk;
+
struct msm_mmc_platform_data {
unsigned int ocr_mask; /* available voltages */
u32 (*translate_vdd)(struct device *, unsigned int);
@@ -22,6 +24,7 @@ struct msm_mmc_platform_data {
int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
struct msm_mmc_gpio_data *gpio_data;
void (*init_card)(struct mmc_card *card);
+ void (*clk_reset)(struct clk *clk);
};
#endif
--
2.1.0.rc2
next prev parent reply other threads:[~2015-03-04 19:34 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-04 19:32 [RFC PATCH 00/18] ARM: msm multiplatform support Arnd Bergmann
2015-03-04 19:32 ` [RFC PATCH 01/18] serial: remove obsolete msm_serial_hs driver Arnd Bergmann
2015-03-04 20:03 ` Paul Bolle
2015-03-04 20:07 ` Paul Bolle
2015-03-04 20:38 ` Arnd Bergmann
2015-03-04 19:32 ` [RFC PATCH 02/18] mmc: msm: move data mover into mmc driver Arnd Bergmann
2015-03-13 13:14 ` Ulf Hansson
2015-03-04 19:32 ` [RFC PATCH 03/18] mmc: msm: pass dmov resources via device Arnd Bergmann
2015-03-13 13:15 ` Ulf Hansson
2015-03-04 19:32 ` Arnd Bergmann [this message]
2015-03-13 13:15 ` [RFC PATCH 04/18] mmc: msm: move clk-reset logic to platform Ulf Hansson
2015-03-04 19:32 ` [RFC PATCH 05/18] ARM: msm: fix qsd8x50 rev.a support Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 06/18] ARM: msm: fix mach/msm_iomap.h inclusions Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 07/18] ARM: msm: fix sirc code for multiplatform Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 08/18] ARM: msm: fix gpiomux config " Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 09/18] ARM: msm: fix vic irqchip " Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 10/18] gpio: move msm-v1 driver to mach-msm Arnd Bergmann
2015-03-09 16:10 ` Linus Walleij
2015-03-04 19:33 ` [RFC PATCH 11/18] clocksource: qcom: make mach-msm and mach-qcom coexist Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 12/18] ARM: msm: make smd behave like a normal driver Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 13/18] ARM: msm: rename conflicting symbols Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 14/18] ARM: msm: pass gpio irq range as resource Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 15/18] ARM: msm: clean up irq handling Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 16/18] ARM: msm: make msm_smd.h global Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 17/18] ARM: msm: make all header files local Arnd Bergmann
2015-03-04 19:33 ` [RFC PATCH 18/18] ARM: msm: enable multiplatform support Arnd Bergmann
2015-03-04 20:31 ` [RFC PATCH 00/18] ARM: msm " Paul Bolle
2015-03-04 20:35 ` Arnd Bergmann
2015-03-04 21:09 ` Paul Bolle
2015-03-04 21:14 ` Paul Bolle
2015-03-04 22:11 ` dwalker
2015-03-04 22:30 ` Arnd Bergmann
2015-03-05 16:40 ` Ulf Hansson
2015-03-08 22:52 ` Arnd Bergmann
2015-03-07 3:12 ` dwalker
2015-03-12 16:27 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425497592-1831064-5-git-send-email-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=bjorn.andersson@sonymobile.com \
--cc=bryanh@codeaurora.org \
--cc=davidb@codeaurora.org \
--cc=dwalker@fifo99.com \
--cc=gregkh@linuxfoundation.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sboyd@codeaurora.org \
--cc=tim.bird@sonymobile.com \
--cc=ulf.hansson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®