linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] mmc: cqhci: Add pre_enable() and post_disable() hook function
@ 2020-08-27  9:33 Chun-Hung Wu
  2020-08-27  9:33 ` [PATCH v1 1/2] mmc: cqhci: add new cqhci_host_ops pre_enable() and post_disable() Chun-Hung Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Chun-Hung Wu @ 2020-08-27  9:33 UTC (permalink / raw)
  To: mirq-linux, Jonathan Hunter, Al Cooper, Adrian Hunter,
	Florian Fainelli, bcm-kernel-feedback-list, Andy Gross,
	Bjorn Andersson, Michal Simek, Thierry Reding, Chaotian Jing,
	Mao Yong, Ulf Hansson, Rob Herring, Mark Rutland,
	Matthias Brugger, Linus Walleij, Pavel Machek, Kate Stewart,
	Greg Kroah-Hartman, Martin Blumenstingl, Pan Bian,
	Thomas Gleixner, Allison Randal, Mathieu Malaterre, Asutosh Das,
	Ritesh Harjani, Stanley Chu, Kuohong Wang
  Cc: kernel-team, linux-kernel, linux-mmc, linux-mediatek, devicetree,
	wsd_upstream, linux-arm-kernel, linux-arm-msm, linux-tegra,
	Chun-Hung Wu

This series provides MediaTek cqhci implementations as below:
  - Add cqhci_host_ops->pre_enable() and cqhci_host_ops->post_disable()
  - Implement MediaTek's hook functions

Chun-Hung Wu (2):
  mmc: cqhci: add new cqhci_host_ops pre_enable() and post_disable()
  mmc: mediatek: add pre_enable() and post_disable() hook function

 drivers/mmc/host/cqhci.c  |    6 ++++++
 drivers/mmc/host/cqhci.h  |    2 ++
 drivers/mmc/host/mtk-sd.c |   22 ++++++++++++++++++++++
 3 files changed, 30 insertions(+)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v1 1/2] mmc: cqhci: add new cqhci_host_ops pre_enable() and post_disable()
  2020-08-27  9:33 [PATCH v1 0/2] mmc: cqhci: Add pre_enable() and post_disable() hook function Chun-Hung Wu
@ 2020-08-27  9:33 ` Chun-Hung Wu
  2020-08-31 13:07   ` Adrian Hunter
  2020-08-27  9:33 ` [PATCH v1 2/2] mmc: mediatek: add pre_enable() and post_disable() hook function Chun-Hung Wu
  2020-09-02  9:02 ` [PATCH v1 0/2] mmc: cqhci: Add " Ulf Hansson
  2 siblings, 1 reply; 6+ messages in thread
From: Chun-Hung Wu @ 2020-08-27  9:33 UTC (permalink / raw)
  To: mirq-linux, Jonathan Hunter, Al Cooper, Adrian Hunter,
	Florian Fainelli, bcm-kernel-feedback-list, Andy Gross,
	Bjorn Andersson, Michal Simek, Thierry Reding, Chaotian Jing,
	Mao Yong, Ulf Hansson, Rob Herring, Mark Rutland,
	Matthias Brugger, Linus Walleij, Pavel Machek, Kate Stewart,
	Greg Kroah-Hartman, Martin Blumenstingl, Pan Bian,
	Thomas Gleixner, Allison Randal, Mathieu Malaterre, Asutosh Das,
	Ritesh Harjani, Stanley Chu, Kuohong Wang
  Cc: kernel-team, linux-kernel, linux-mmc, linux-mediatek, devicetree,
	wsd_upstream, linux-arm-kernel, linux-arm-msm, linux-tegra,
	Chun-Hung Wu

Add pre_enable() and post_disable() for cqhci_host_ops.
Add hook functions before cqhci enable and
after cqhci disable for platforms need them.

Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
---
 drivers/mmc/host/cqhci.c |    6 ++++++
 drivers/mmc/host/cqhci.h |    2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c
index cfa87df..697fe40 100644
--- a/drivers/mmc/host/cqhci.c
+++ b/drivers/mmc/host/cqhci.c
@@ -376,6 +376,9 @@ static void cqhci_off(struct mmc_host *mmc)
 	else
 		pr_debug("%s: cqhci: CQE off\n", mmc_hostname(mmc));
 
+	if (cq_host->ops->post_disable)
+		cq_host->ops->post_disable(mmc);
+
 	mmc->cqe_on = false;
 }
 
@@ -580,6 +583,9 @@ static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 		__cqhci_enable(cq_host);
 
 	if (!mmc->cqe_on) {
+		if (cq_host->ops->pre_enable)
+			cq_host->ops->pre_enable(mmc);
+
 		cqhci_writel(cq_host, 0, CQHCI_CTL);
 		mmc->cqe_on = true;
 		pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc));
diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h
index 4377001..89bf6ad 100644
--- a/drivers/mmc/host/cqhci.h
+++ b/drivers/mmc/host/cqhci.h
@@ -206,6 +206,8 @@ struct cqhci_host_ops {
 	void (*disable)(struct mmc_host *mmc, bool recovery);
 	void (*update_dcmd_desc)(struct mmc_host *mmc, struct mmc_request *mrq,
 				 u64 *data);
+	void (*pre_enable)(struct mmc_host *mmc);
+	void (*post_disable)(struct mmc_host *mmc);
 };
 
 static inline void cqhci_writel(struct cqhci_host *host, u32 val, int reg)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH  v1 2/2] mmc: mediatek: add pre_enable() and post_disable() hook function
  2020-08-27  9:33 [PATCH v1 0/2] mmc: cqhci: Add pre_enable() and post_disable() hook function Chun-Hung Wu
  2020-08-27  9:33 ` [PATCH v1 1/2] mmc: cqhci: add new cqhci_host_ops pre_enable() and post_disable() Chun-Hung Wu
@ 2020-08-27  9:33 ` Chun-Hung Wu
  2020-08-31 13:09   ` Adrian Hunter
  2020-09-02  9:02 ` [PATCH v1 0/2] mmc: cqhci: Add " Ulf Hansson
  2 siblings, 1 reply; 6+ messages in thread
From: Chun-Hung Wu @ 2020-08-27  9:33 UTC (permalink / raw)
  To: mirq-linux, Jonathan Hunter, Al Cooper, Adrian Hunter,
	Florian Fainelli, bcm-kernel-feedback-list, Andy Gross,
	Bjorn Andersson, Michal Simek, Thierry Reding, Chaotian Jing,
	Mao Yong, Ulf Hansson, Rob Herring, Mark Rutland,
	Matthias Brugger, Linus Walleij, Pavel Machek, Kate Stewart,
	Greg Kroah-Hartman, Martin Blumenstingl, Pan Bian,
	Thomas Gleixner, Allison Randal, Mathieu Malaterre, Asutosh Das,
	Ritesh Harjani, Stanley Chu, Kuohong Wang
  Cc: kernel-team, linux-kernel, linux-mmc, linux-mediatek, devicetree,
	wsd_upstream, linux-arm-kernel, linux-arm-msm, linux-tegra,
	Chun-Hung Wu

CQHCI_ENABLE bit in CQHCI_CFG should be disabled
after msdc_cqe_disable(), and should be enabled before
msdc_ceq_enable() for MTK platform.
Add hook functions for cqhci_host_ops->pre_enable() and
cqhci_host_ops->post_disable().

Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
---
 drivers/mmc/host/mtk-sd.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 4e2583f..f53e11b 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -2282,6 +2282,26 @@ static void msdc_cqe_disable(struct mmc_host *mmc, bool recovery)
 	}
 }
 
+static void msdc_cqe_pre_enable(struct mmc_host *mmc)
+{
+	struct cqhci_host *cq_host = mmc->cqe_private;
+	u32 reg;
+
+	reg = cqhci_readl(cq_host, CQHCI_CFG);
+	reg |= CQHCI_ENABLE;
+	cqhci_writel(cq_host, reg, CQHCI_CFG);
+}
+
+static void msdc_cqe_post_disable(struct mmc_host *mmc)
+{
+	struct cqhci_host *cq_host = mmc->cqe_private;
+	u32 reg;
+
+	reg = cqhci_readl(cq_host, CQHCI_CFG);
+	reg &= ~CQHCI_ENABLE;
+	cqhci_writel(cq_host, reg, CQHCI_CFG);
+}
+
 static const struct mmc_host_ops mt_msdc_ops = {
 	.post_req = msdc_post_req,
 	.pre_req = msdc_pre_req,
@@ -2301,6 +2321,8 @@ static void msdc_cqe_disable(struct mmc_host *mmc, bool recovery)
 static const struct cqhci_host_ops msdc_cmdq_ops = {
 	.enable         = msdc_cqe_enable,
 	.disable        = msdc_cqe_disable,
+	.pre_enable = msdc_cqe_pre_enable,
+	.post_disable = msdc_cqe_post_disable,
 };
 
 static void msdc_of_property_parse(struct platform_device *pdev,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 1/2] mmc: cqhci: add new cqhci_host_ops pre_enable() and post_disable()
  2020-08-27  9:33 ` [PATCH v1 1/2] mmc: cqhci: add new cqhci_host_ops pre_enable() and post_disable() Chun-Hung Wu
@ 2020-08-31 13:07   ` Adrian Hunter
  0 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2020-08-31 13:07 UTC (permalink / raw)
  To: Chun-Hung Wu, mirq-linux, Jonathan Hunter, Al Cooper,
	Florian Fainelli, bcm-kernel-feedback-list, Andy Gross,
	Bjorn Andersson, Michal Simek, Thierry Reding, Chaotian Jing,
	Mao Yong, Ulf Hansson, Rob Herring, Mark Rutland,
	Matthias Brugger, Linus Walleij, Pavel Machek, Kate Stewart,
	Greg Kroah-Hartman, Martin Blumenstingl, Pan Bian,
	Thomas Gleixner, Allison Randal, Mathieu Malaterre, Asutosh Das,
	Ritesh Harjani, Stanley Chu, Kuohong Wang
  Cc: kernel-team, linux-kernel, linux-mmc, linux-mediatek, devicetree,
	wsd_upstream, linux-arm-kernel, linux-arm-msm, linux-tegra

On 27/08/20 12:33 pm, Chun-Hung Wu wrote:
> Add pre_enable() and post_disable() for cqhci_host_ops.
> Add hook functions before cqhci enable and
> after cqhci disable for platforms need them.
> 
> Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/cqhci.c |    6 ++++++
>  drivers/mmc/host/cqhci.h |    2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/mmc/host/cqhci.c b/drivers/mmc/host/cqhci.c
> index cfa87df..697fe40 100644
> --- a/drivers/mmc/host/cqhci.c
> +++ b/drivers/mmc/host/cqhci.c
> @@ -376,6 +376,9 @@ static void cqhci_off(struct mmc_host *mmc)
>  	else
>  		pr_debug("%s: cqhci: CQE off\n", mmc_hostname(mmc));
>  
> +	if (cq_host->ops->post_disable)
> +		cq_host->ops->post_disable(mmc);
> +
>  	mmc->cqe_on = false;
>  }
>  
> @@ -580,6 +583,9 @@ static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
>  		__cqhci_enable(cq_host);
>  
>  	if (!mmc->cqe_on) {
> +		if (cq_host->ops->pre_enable)
> +			cq_host->ops->pre_enable(mmc);
> +
>  		cqhci_writel(cq_host, 0, CQHCI_CTL);
>  		mmc->cqe_on = true;
>  		pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc));
> diff --git a/drivers/mmc/host/cqhci.h b/drivers/mmc/host/cqhci.h
> index 4377001..89bf6ad 100644
> --- a/drivers/mmc/host/cqhci.h
> +++ b/drivers/mmc/host/cqhci.h
> @@ -206,6 +206,8 @@ struct cqhci_host_ops {
>  	void (*disable)(struct mmc_host *mmc, bool recovery);
>  	void (*update_dcmd_desc)(struct mmc_host *mmc, struct mmc_request *mrq,
>  				 u64 *data);
> +	void (*pre_enable)(struct mmc_host *mmc);
> +	void (*post_disable)(struct mmc_host *mmc);
>  };
>  
>  static inline void cqhci_writel(struct cqhci_host *host, u32 val, int reg)
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 2/2] mmc: mediatek: add pre_enable() and post_disable() hook function
  2020-08-27  9:33 ` [PATCH v1 2/2] mmc: mediatek: add pre_enable() and post_disable() hook function Chun-Hung Wu
@ 2020-08-31 13:09   ` Adrian Hunter
  0 siblings, 0 replies; 6+ messages in thread
From: Adrian Hunter @ 2020-08-31 13:09 UTC (permalink / raw)
  To: Chun-Hung Wu, mirq-linux, Jonathan Hunter, Al Cooper,
	Florian Fainelli, bcm-kernel-feedback-list, Andy Gross,
	Bjorn Andersson, Michal Simek, Thierry Reding, Chaotian Jing,
	Mao Yong, Ulf Hansson, Rob Herring, Mark Rutland,
	Matthias Brugger, Linus Walleij, Pavel Machek, Kate Stewart,
	Greg Kroah-Hartman, Martin Blumenstingl, Pan Bian,
	Thomas Gleixner, Allison Randal, Mathieu Malaterre, Asutosh Das,
	Ritesh Harjani, Stanley Chu, Kuohong Wang
  Cc: kernel-team, linux-kernel, linux-mmc, linux-mediatek, devicetree,
	wsd_upstream, linux-arm-kernel, linux-arm-msm, linux-tegra

On 27/08/20 12:33 pm, Chun-Hung Wu wrote:
> CQHCI_ENABLE bit in CQHCI_CFG should be disabled
> after msdc_cqe_disable(), and should be enabled before
> msdc_ceq_enable() for MTK platform.
> Add hook functions for cqhci_host_ops->pre_enable() and
> cqhci_host_ops->post_disable().
> 
> Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/host/mtk-sd.c |   22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
> index 4e2583f..f53e11b 100644
> --- a/drivers/mmc/host/mtk-sd.c
> +++ b/drivers/mmc/host/mtk-sd.c
> @@ -2282,6 +2282,26 @@ static void msdc_cqe_disable(struct mmc_host *mmc, bool recovery)
>  	}
>  }
>  
> +static void msdc_cqe_pre_enable(struct mmc_host *mmc)
> +{
> +	struct cqhci_host *cq_host = mmc->cqe_private;
> +	u32 reg;
> +
> +	reg = cqhci_readl(cq_host, CQHCI_CFG);
> +	reg |= CQHCI_ENABLE;
> +	cqhci_writel(cq_host, reg, CQHCI_CFG);
> +}
> +
> +static void msdc_cqe_post_disable(struct mmc_host *mmc)
> +{
> +	struct cqhci_host *cq_host = mmc->cqe_private;
> +	u32 reg;
> +
> +	reg = cqhci_readl(cq_host, CQHCI_CFG);
> +	reg &= ~CQHCI_ENABLE;
> +	cqhci_writel(cq_host, reg, CQHCI_CFG);
> +}
> +
>  static const struct mmc_host_ops mt_msdc_ops = {
>  	.post_req = msdc_post_req,
>  	.pre_req = msdc_pre_req,
> @@ -2301,6 +2321,8 @@ static void msdc_cqe_disable(struct mmc_host *mmc, bool recovery)
>  static const struct cqhci_host_ops msdc_cmdq_ops = {
>  	.enable         = msdc_cqe_enable,
>  	.disable        = msdc_cqe_disable,
> +	.pre_enable = msdc_cqe_pre_enable,
> +	.post_disable = msdc_cqe_post_disable,
>  };
>  
>  static void msdc_of_property_parse(struct platform_device *pdev,
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1 0/2] mmc: cqhci: Add pre_enable() and post_disable() hook function
  2020-08-27  9:33 [PATCH v1 0/2] mmc: cqhci: Add pre_enable() and post_disable() hook function Chun-Hung Wu
  2020-08-27  9:33 ` [PATCH v1 1/2] mmc: cqhci: add new cqhci_host_ops pre_enable() and post_disable() Chun-Hung Wu
  2020-08-27  9:33 ` [PATCH v1 2/2] mmc: mediatek: add pre_enable() and post_disable() hook function Chun-Hung Wu
@ 2020-09-02  9:02 ` Ulf Hansson
  2 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2020-09-02  9:02 UTC (permalink / raw)
  To: Chun-Hung Wu
  Cc: Michał Mirosław, Jonathan Hunter, Al Cooper,
	Adrian Hunter, Florian Fainelli, BCM Kernel Feedback, Andy Gross,
	Bjorn Andersson, Michal Simek, Thierry Reding, Chaotian Jing,
	Mao Yong, Rob Herring, Mark Rutland, Matthias Brugger,
	Linus Walleij, Pavel Machek, Kate Stewart, Greg Kroah-Hartman,
	Martin Blumenstingl, Pan Bian, Thomas Gleixner, Allison Randal,
	Mathieu Malaterre, Asutosh Das, Ritesh Harjani, Stanley Chu,
	Kuohong Wang, Android Kernel Team, Linux Kernel Mailing List,
	linux-mmc, moderated list:ARM/Mediatek SoC support, DTML,
	wsd_upstream, Linux ARM, linux-arm-msm, linux-tegra

On Thu, 27 Aug 2020 at 11:33, Chun-Hung Wu <chun-hung.wu@mediatek.com> wrote:
>
> This series provides MediaTek cqhci implementations as below:
>   - Add cqhci_host_ops->pre_enable() and cqhci_host_ops->post_disable()
>   - Implement MediaTek's hook functions
>
> Chun-Hung Wu (2):
>   mmc: cqhci: add new cqhci_host_ops pre_enable() and post_disable()
>   mmc: mediatek: add pre_enable() and post_disable() hook function
>
>  drivers/mmc/host/cqhci.c  |    6 ++++++
>  drivers/mmc/host/cqhci.h  |    2 ++
>  drivers/mmc/host/mtk-sd.c |   22 ++++++++++++++++++++++
>  3 files changed, 30 insertions(+)
>
> --
> 1.7.9.5

Applied for next, thanks!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-02  9:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27  9:33 [PATCH v1 0/2] mmc: cqhci: Add pre_enable() and post_disable() hook function Chun-Hung Wu
2020-08-27  9:33 ` [PATCH v1 1/2] mmc: cqhci: add new cqhci_host_ops pre_enable() and post_disable() Chun-Hung Wu
2020-08-31 13:07   ` Adrian Hunter
2020-08-27  9:33 ` [PATCH v1 2/2] mmc: mediatek: add pre_enable() and post_disable() hook function Chun-Hung Wu
2020-08-31 13:09   ` Adrian Hunter
2020-09-02  9:02 ` [PATCH v1 0/2] mmc: cqhci: Add " Ulf Hansson

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).