linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mmc: sdhci-of-esdhc: Don't walk device-tree on every interrupt
@ 2020-09-03  1:20 Chris Packham
  2020-09-03  8:10 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Packham @ 2020-09-03  1:20 UTC (permalink / raw)
  To: adrian.hunter, ulf.hansson, yinbo.zhu
  Cc: linux-mmc, linux-kernel, Chris Packham

Commit b214fe592ab7 ("mmc: sdhci-of-esdhc: add erratum eSDHC7 support")
added code to check for a specific compatible string in the device-tree
on every esdhc interrupat. Instead of doing this record the quirk in
struct sdhci_esdhc and lookup the struct in esdhc_irq.

Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
I found this in passing while trying to track down another issue using ftrace.
I found it odd that I was seeing a lot of calls to __of_device_is_compatible()
coming from esdhc_irq() (the fact that this interrupt is going off on my board
is also odd, but that's a different story).

Changes in v2:
- add quirk_trans_complete_erratum to struct sdhci_esdhc so all the dt handling
  is taken care of in esdhc_init.

 drivers/mmc/host/sdhci-of-esdhc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
index 7c73d243dc6c..45881b309956 100644
--- a/drivers/mmc/host/sdhci-of-esdhc.c
+++ b/drivers/mmc/host/sdhci-of-esdhc.c
@@ -81,6 +81,7 @@ struct sdhci_esdhc {
 	bool quirk_tuning_erratum_type2;
 	bool quirk_ignore_data_inhibit;
 	bool quirk_delay_before_data_reset;
+	bool quirk_trans_complete_erratum;
 	bool in_sw_tuning;
 	unsigned int peripheral_clock;
 	const struct esdhc_clk_fixup *clk_fixup;
@@ -1177,10 +1178,11 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host,
 
 static u32 esdhc_irq(struct sdhci_host *host, u32 intmask)
 {
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
 	u32 command;
 
-	if (of_find_compatible_node(NULL, NULL,
-				"fsl,p2020-esdhc")) {
+	if (esdhc->quirk_trans_complete_erratum) {
 		command = SDHCI_GET_CMD(sdhci_readw(host,
 					SDHCI_COMMAND));
 		if (command == MMC_WRITE_MULTIPLE_BLOCK &&
@@ -1334,8 +1336,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
 		esdhc->clk_fixup = match->data;
 	np = pdev->dev.of_node;
 
-	if (of_device_is_compatible(np, "fsl,p2020-esdhc"))
+	if (of_device_is_compatible(np, "fsl,p2020-esdhc")) {
 		esdhc->quirk_delay_before_data_reset = true;
+		esdhc->quirk_trans_complete_erratum = true;
+	}
 
 	clk = of_clk_get(np, 0);
 	if (!IS_ERR(clk)) {
-- 
2.28.0


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

* Re: [PATCH v2] mmc: sdhci-of-esdhc: Don't walk device-tree on every interrupt
  2020-09-03  1:20 [PATCH v2] mmc: sdhci-of-esdhc: Don't walk device-tree on every interrupt Chris Packham
@ 2020-09-03  8:10 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2020-09-03  8:10 UTC (permalink / raw)
  To: Chris Packham
  Cc: Adrian Hunter, yinbo.zhu, linux-mmc, Linux Kernel Mailing List

On Thu, 3 Sep 2020 at 03:20, Chris Packham
<chris.packham@alliedtelesis.co.nz> wrote:
>
> Commit b214fe592ab7 ("mmc: sdhci-of-esdhc: add erratum eSDHC7 support")
> added code to check for a specific compatible string in the device-tree
> on every esdhc interrupat. Instead of doing this record the quirk in
> struct sdhci_esdhc and lookup the struct in esdhc_irq.
>
> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>

Applied for fixes, and by adding a stable tag, thanks!

Kind regards
Uffe


> ---
> I found this in passing while trying to track down another issue using ftrace.
> I found it odd that I was seeing a lot of calls to __of_device_is_compatible()
> coming from esdhc_irq() (the fact that this interrupt is going off on my board
> is also odd, but that's a different story).
>
> Changes in v2:
> - add quirk_trans_complete_erratum to struct sdhci_esdhc so all the dt handling
>   is taken care of in esdhc_init.
>
>  drivers/mmc/host/sdhci-of-esdhc.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
> index 7c73d243dc6c..45881b309956 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -81,6 +81,7 @@ struct sdhci_esdhc {
>         bool quirk_tuning_erratum_type2;
>         bool quirk_ignore_data_inhibit;
>         bool quirk_delay_before_data_reset;
> +       bool quirk_trans_complete_erratum;
>         bool in_sw_tuning;
>         unsigned int peripheral_clock;
>         const struct esdhc_clk_fixup *clk_fixup;
> @@ -1177,10 +1178,11 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host,
>
>  static u32 esdhc_irq(struct sdhci_host *host, u32 intmask)
>  {
> +       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +       struct sdhci_esdhc *esdhc = sdhci_pltfm_priv(pltfm_host);
>         u32 command;
>
> -       if (of_find_compatible_node(NULL, NULL,
> -                               "fsl,p2020-esdhc")) {
> +       if (esdhc->quirk_trans_complete_erratum) {
>                 command = SDHCI_GET_CMD(sdhci_readw(host,
>                                         SDHCI_COMMAND));
>                 if (command == MMC_WRITE_MULTIPLE_BLOCK &&
> @@ -1334,8 +1336,10 @@ static void esdhc_init(struct platform_device *pdev, struct sdhci_host *host)
>                 esdhc->clk_fixup = match->data;
>         np = pdev->dev.of_node;
>
> -       if (of_device_is_compatible(np, "fsl,p2020-esdhc"))
> +       if (of_device_is_compatible(np, "fsl,p2020-esdhc")) {
>                 esdhc->quirk_delay_before_data_reset = true;
> +               esdhc->quirk_trans_complete_erratum = true;
> +       }
>
>         clk = of_clk_get(np, 0);
>         if (!IS_ERR(clk)) {
> --
> 2.28.0
>

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

end of thread, other threads:[~2020-09-03  8:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03  1:20 [PATCH v2] mmc: sdhci-of-esdhc: Don't walk device-tree on every interrupt Chris Packham
2020-09-03  8:10 ` 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).