linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hkallweit1@gmail.com (Heiner Kallweit)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH 1/4] mmc: pwrseq: add op reset to struct mmc_pwrseq_ops
Date: Wed, 8 Feb 2017 22:48:56 +0100	[thread overview]
Message-ID: <c75c3e5c-c4e1-3f2f-267b-1c781052c55e@gmail.com> (raw)
In-Reply-To: <75ad5eac-412b-fe73-ff53-3d8b975937e4@gmail.com>

Add an operation reset to struct mmc_pwrseq_ops and related wrappers.

Don't expose the pwrseq-internal reset function directly to kernel
users but just to the mmc core.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/mmc/core/core.c   | 6 ++++++
 drivers/mmc/core/pwrseq.c | 8 ++++++++
 drivers/mmc/core/pwrseq.h | 3 +++
 include/linux/mmc/core.h  | 1 +
 4 files changed, 18 insertions(+)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 926e0fde..5d5fe591 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1869,6 +1869,12 @@ void mmc_power_cycle(struct mmc_host *host, u32 ocr)
 	mmc_power_up(host, ocr);
 }
 
+void mmc_hw_reset_pwrseq(struct mmc_host *host)
+{
+	mmc_pwrseq_reset(host);
+}
+EXPORT_SYMBOL(mmc_hw_reset_pwrseq);
+
 /*
  * Cleanup when the last reference to the bus operator is dropped.
  */
diff --git a/drivers/mmc/core/pwrseq.c b/drivers/mmc/core/pwrseq.c
index 9386c477..e3ad30fa 100644
--- a/drivers/mmc/core/pwrseq.c
+++ b/drivers/mmc/core/pwrseq.c
@@ -76,6 +76,14 @@ void mmc_pwrseq_power_off(struct mmc_host *host)
 		pwrseq->ops->power_off(host);
 }
 
+void mmc_pwrseq_reset(struct mmc_host *host)
+{
+	struct mmc_pwrseq *pwrseq = host->pwrseq;
+
+	if (pwrseq && pwrseq->ops->reset)
+		pwrseq->ops->reset(host);
+}
+
 void mmc_pwrseq_free(struct mmc_host *host)
 {
 	struct mmc_pwrseq *pwrseq = host->pwrseq;
diff --git a/drivers/mmc/core/pwrseq.h b/drivers/mmc/core/pwrseq.h
index 39c911aa..819386f4 100644
--- a/drivers/mmc/core/pwrseq.h
+++ b/drivers/mmc/core/pwrseq.h
@@ -18,6 +18,7 @@ struct mmc_pwrseq_ops {
 	void (*pre_power_on)(struct mmc_host *host);
 	void (*post_power_on)(struct mmc_host *host);
 	void (*power_off)(struct mmc_host *host);
+	void (*reset)(struct mmc_host *host);
 };
 
 struct mmc_pwrseq {
@@ -36,6 +37,7 @@ int mmc_pwrseq_alloc(struct mmc_host *host);
 void mmc_pwrseq_pre_power_on(struct mmc_host *host);
 void mmc_pwrseq_post_power_on(struct mmc_host *host);
 void mmc_pwrseq_power_off(struct mmc_host *host);
+void mmc_pwrseq_reset(struct mmc_host *host);
 void mmc_pwrseq_free(struct mmc_host *host);
 
 #else
@@ -49,6 +51,7 @@ static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; }
 static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}
 static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {}
 static inline void mmc_pwrseq_power_off(struct mmc_host *host) {}
+static inline void mmc_pwrseq_reset(struct mmc_host *host) {}
 static inline void mmc_pwrseq_free(struct mmc_host *host) {}
 
 #endif
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index a0c63ea2..8dbbd7a1 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -166,6 +166,7 @@ int mmc_wait_for_cmd(struct mmc_host *host, struct mmc_command *cmd,
 		int retries);
 
 int mmc_hw_reset(struct mmc_host *host);
+void mmc_hw_reset_pwrseq(struct mmc_host *host);
 void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card);
 
 #endif /* LINUX_MMC_CORE_H */
-- 
2.11.0

       reply	other threads:[~2017-02-08 21:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <75ad5eac-412b-fe73-ff53-3d8b975937e4@gmail.com>
2017-02-08 21:48 ` Heiner Kallweit [this message]
2017-03-15 10:50   ` [PATCH 1/4] mmc: pwrseq: add op reset to struct mmc_pwrseq_ops Ulf Hansson
2017-03-15 21:42     ` Heiner Kallweit
2017-03-16  6:49       ` Heiner Kallweit
2017-03-20 18:02         ` Ulf Hansson
2017-03-20 17:56       ` Ulf Hansson
2017-02-08 21:49 ` [PATCH 2/4] mmc: pwrseq: implement reset operation in pwrseq_emmc Heiner Kallweit
2017-02-08 21:49 ` [PATCH 3/4] mmc: meson-gx: add pwrseq-based hw_reset Heiner Kallweit
2017-02-08 21:49 ` [PATCH 4/4] ARM64: dts: meson-gxbb-odroidc2: add hw-reset capability flag for emmc port Heiner Kallweit

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=c75c3e5c-c4e1-3f2f-267b-1c781052c55e@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=linus-amlogic@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).