linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] thermal: armada-thermal: fix register offsets for AXP
       [not found] <1574721077-29892-1-git-send-email-zhays@lexmark.com>
@ 2019-11-26 14:53 ` Zak Hays
       [not found] ` <1574721077-29892-2-git-send-email-zhays@lexmark.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Zak Hays @ 2019-11-26 14:53 UTC (permalink / raw)
  To: Zak Hays
  Cc: Miquel Raynal, Zhang Rui, Eduardo Valentin, Daniel Lezcano,
	Amit Kucheria, linux-pm, linux-kernel

As shown in its device tree, Armada XP has the control1 register at

0x184d0, not 0x182d0.

---

 drivers/thermal/armada_thermal.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)



diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c

index 709a22f455e9..88363812033c 100644

--- a/drivers/thermal/armada_thermal.c

+++ b/drivers/thermal/armada_thermal.c

@@ -578,7 +578,7 @@ static const struct armada_thermal_data armadaxp_data = {

         .coef_m = 10000000ULL,

         .coef_div = 13825,

         .syscon_status_off = 0xb0,

-       .syscon_control1_off = 0xd0,

+       .syscon_control1_off = 0x2d0,

 };

 

 static const struct armada_thermal_data armada370_data = {

-- 

2.7.4




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

* [PATCH 2/2] thermal: armada-thermal: clear reset in armadaxp_init
       [not found] ` <1574721077-29892-2-git-send-email-zhays@lexmark.com>
@ 2019-11-26 14:54   ` Zak Hays
  2019-11-27 11:00     ` Miquel Raynal
  0 siblings, 1 reply; 4+ messages in thread
From: Zak Hays @ 2019-11-26 14:54 UTC (permalink / raw)
  To: Zak Hays
  Cc: Miquel Raynal, Zhang Rui, Eduardo Valentin, Daniel Lezcano,
	Amit Kucheria, linux-pm, linux-kernel

The reset bit needs to be cleared in the init sequence otherwise it

holds the block in reset.

---

 drivers/thermal/armada_thermal.c | 3 +++

 1 file changed, 3 insertions(+)



diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c

index 88363812033c..8c4d1244ee7a 100644

--- a/drivers/thermal/armada_thermal.c

+++ b/drivers/thermal/armada_thermal.c

@@ -155,6 +155,9 @@ static void armadaxp_init(struct platform_device *pdev,

 

         regmap_write(priv->syscon, data->syscon_control1_off, reg);

 

+       reg &= ~PMU_TDC0_SW_RST_MASK;

+       regmap_write(priv->syscon, data->syscon_control1_off, reg);

+

         /* Enable the sensor */

         regmap_read(priv->syscon, data->syscon_status_off, &reg);

         reg &= ~PMU_TM_DISABLE_MASK;

-- 

2.7.4




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

* Re: [PATCH 2/2] thermal: armada-thermal: clear reset in armadaxp_init
  2019-11-26 14:54   ` [PATCH 2/2] thermal: armada-thermal: clear reset in armadaxp_init Zak Hays
@ 2019-11-27 11:00     ` Miquel Raynal
  2019-12-03 16:36       ` Zak Hays
  0 siblings, 1 reply; 4+ messages in thread
From: Miquel Raynal @ 2019-11-27 11:00 UTC (permalink / raw)
  To: Zak Hays
  Cc: Zhang Rui, Eduardo Valentin, Daniel Lezcano, Amit Kucheria,
	linux-pm, linux-kernel

Hi Zak,

Zak Hays <zak.hays@lexmark.com> wrote on Tue, 26 Nov 2019 14:54:11
+0000:

> The reset bit needs to be cleared in the init sequence otherwise it
> 
> holds the block in reset.

"thermal: armada: " is the right prefix for your title

Your Signed-off-by should be here (git commit --amend -s)

The format of your patch is strange, there are additional empty lines
which are problematic.

> 
> ---
> 
>  drivers/thermal/armada_thermal.c | 3 +++
> 
>  1 file changed, 3 insertions(+)
> 
> 
> 
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> 
> index 88363812033c..8c4d1244ee7a 100644
> 
> --- a/drivers/thermal/armada_thermal.c
> 
> +++ b/drivers/thermal/armada_thermal.c
> 
> @@ -155,6 +155,9 @@ static void armadaxp_init(struct platform_device *pdev,
> 
>  
> 
>          regmap_write(priv->syscon, data->syscon_control1_off, reg);
> 
>  
> 
> +       reg &= ~PMU_TDC0_SW_RST_MASK;
> 
> +       regmap_write(priv->syscon, data->syscon_control1_off, reg);
> 
> +

Do you really want to write this register twice? Shouldn't you get rid
of the first regmap_write() above?

> 
>          /* Enable the sensor */
> 
>          regmap_read(priv->syscon, data->syscon_status_off, &reg);
> 
>          reg &= ~PMU_TM_DISABLE_MASK;
> 

In your next iteration, please use the '-v2' option with
git-format-patch to get titles starting with "[PATCH v2 x/2] ..."
automatically. Also write a changelog below the three dots '---'.

Thanks,
Miquèl

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

* Re: [PATCH 2/2] thermal: armada-thermal: clear reset in armadaxp_init
  2019-11-27 11:00     ` Miquel Raynal
@ 2019-12-03 16:36       ` Zak Hays
  0 siblings, 0 replies; 4+ messages in thread
From: Zak Hays @ 2019-12-03 16:36 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Zhang Rui, Daniel Lezcano, Amit Kucheria, linux-pm, linux-kernel

Hi Miquèl,

>The format of your patch is strange, there are additional empty lines
>which are problematic.

Apologies for the formatting. I'll try to fix that in that next patch set.

>Do you really want to write this register twice? Shouldn't you get rid
>of the first regmap_write() above?

I'm writing the register twice in order to pulse the reset line and ensure the block is reset at init. This is similar to what was done in the driver previously:

        /* Reset the sensor */
        reg = readl_relaxed(priv->control1);
        writel((reg | PMU_TDC0_SW_RST_MASK), priv->control1);      <= Set the reset bit

        writel(reg, priv->control1);                                                       <= Immediately clear the bit

I'm a little unsure that setting then immediately clearing reset is enough time for the block to do a full reset but I can't find anything in AXP's documentation to indicate a correct reset time. As such, I just emulated the original process from earlier kernel versions. If you believe that a udelay should be added, I can add one in the next patch set.

Thanks!
Zak


________________________________________
From: Miquel Raynal <miquel.raynal@bootlin.com>
Sent: Wednesday, November 27, 2019 6:00 AM
To: Zak Hays
Cc: Zhang Rui; Eduardo Valentin; Daniel Lezcano; Amit Kucheria; linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] thermal: armada-thermal: clear reset in armadaxp_init

Hi Zak,

Zak Hays <zak.hays@lexmark.com> wrote on Tue, 26 Nov 2019 14:54:11
+0000:

> The reset bit needs to be cleared in the init sequence otherwise it
>
> holds the block in reset.

"thermal: armada: " is the right prefix for your title

Your Signed-off-by should be here (git commit --amend -s)

The format of your patch is strange, there are additional empty lines
which are problematic.

>
> ---
>
>  drivers/thermal/armada_thermal.c | 3 +++
>
>  1 file changed, 3 insertions(+)
>
>
>
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
>
> index 88363812033c..8c4d1244ee7a 100644
>
> --- a/drivers/thermal/armada_thermal.c
>
> +++ b/drivers/thermal/armada_thermal.c
>
> @@ -155,6 +155,9 @@ static void armadaxp_init(struct platform_device *pdev,
>
>
>
>          regmap_write(priv->syscon, data->syscon_control1_off, reg);
>
>
>
> +       reg &= ~PMU_TDC0_SW_RST_MASK;
>
> +       regmap_write(priv->syscon, data->syscon_control1_off, reg);
>
> +

Do you really want to write this register twice? Shouldn't you get rid
of the first regmap_write() above?

>
>          /* Enable the sensor */
>
>          regmap_read(priv->syscon, data->syscon_status_off, &reg);
>
>          reg &= ~PMU_TM_DISABLE_MASK;
>

In your next iteration, please use the '-v2' option with
git-format-patch to get titles starting with "[PATCH v2 x/2] ..."
automatically. Also write a changelog below the three dots '---'.

Thanks,
Miquèl

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

end of thread, other threads:[~2019-12-03 16:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1574721077-29892-1-git-send-email-zhays@lexmark.com>
2019-11-26 14:53 ` [PATCH 1/2] thermal: armada-thermal: fix register offsets for AXP Zak Hays
     [not found] ` <1574721077-29892-2-git-send-email-zhays@lexmark.com>
2019-11-26 14:54   ` [PATCH 2/2] thermal: armada-thermal: clear reset in armadaxp_init Zak Hays
2019-11-27 11:00     ` Miquel Raynal
2019-12-03 16:36       ` Zak Hays

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