All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mfd: stm32-timers: avoid clearing auto reload register
@ 2021-03-03 17:51 ` Fabrice Gasnier
  0 siblings, 0 replies; 10+ messages in thread
From: Fabrice Gasnier @ 2021-03-03 17:51 UTC (permalink / raw)
  To: lee.jones
  Cc: vilhelm.gray, alexandre.torgue, mcoquelin.stm32, fabrice.gasnier,
	olivier.moysan, linux-arm-kernel, linux-kernel, linux-stm32

The ARR register is cleared unconditionally upon probing, after the maximum
value has been read. This initial condition is rather not intuitive, when
considering the counter child driver. It rather expects the maximum value
by default:
- The counter interface shows a zero value by default for 'ceiling'
  attribute.
- Enabling the counter without any prior configuration makes it doesn't
  count.

The reset value of ARR register is the maximum. So Choice here
is to backup it, and restore it then, instead of clearing its value.
It also fixes the initial condition seen by the counter driver.

Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
---
 drivers/mfd/stm32-timers.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
index add6033..44ed2fc 100644
--- a/drivers/mfd/stm32-timers.c
+++ b/drivers/mfd/stm32-timers.c
@@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
 
 static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
 {
+	u32 arr;
+
+	/* Backup ARR to restore it after getting the maximum value */
+	regmap_read(ddata->regmap, TIM_ARR, &arr);
+
 	/*
 	 * Only the available bits will be written so when readback
 	 * we get the maximum value of auto reload register
 	 */
 	regmap_write(ddata->regmap, TIM_ARR, ~0L);
 	regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
-	regmap_write(ddata->regmap, TIM_ARR, 0x0);
+	regmap_write(ddata->regmap, TIM_ARR, arr);
 }
 
 static int stm32_timers_dma_probe(struct device *dev,
-- 
2.7.4


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

* [PATCH] mfd: stm32-timers: avoid clearing auto reload register
@ 2021-03-03 17:51 ` Fabrice Gasnier
  0 siblings, 0 replies; 10+ messages in thread
From: Fabrice Gasnier @ 2021-03-03 17:51 UTC (permalink / raw)
  To: lee.jones
  Cc: vilhelm.gray, alexandre.torgue, mcoquelin.stm32, fabrice.gasnier,
	olivier.moysan, linux-arm-kernel, linux-kernel, linux-stm32

The ARR register is cleared unconditionally upon probing, after the maximum
value has been read. This initial condition is rather not intuitive, when
considering the counter child driver. It rather expects the maximum value
by default:
- The counter interface shows a zero value by default for 'ceiling'
  attribute.
- Enabling the counter without any prior configuration makes it doesn't
  count.

The reset value of ARR register is the maximum. So Choice here
is to backup it, and restore it then, instead of clearing its value.
It also fixes the initial condition seen by the counter driver.

Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
---
 drivers/mfd/stm32-timers.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
index add6033..44ed2fc 100644
--- a/drivers/mfd/stm32-timers.c
+++ b/drivers/mfd/stm32-timers.c
@@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
 
 static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
 {
+	u32 arr;
+
+	/* Backup ARR to restore it after getting the maximum value */
+	regmap_read(ddata->regmap, TIM_ARR, &arr);
+
 	/*
 	 * Only the available bits will be written so when readback
 	 * we get the maximum value of auto reload register
 	 */
 	regmap_write(ddata->regmap, TIM_ARR, ~0L);
 	regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
-	regmap_write(ddata->regmap, TIM_ARR, 0x0);
+	regmap_write(ddata->regmap, TIM_ARR, arr);
 }
 
 static int stm32_timers_dma_probe(struct device *dev,
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register
  2021-03-03 17:51 ` Fabrice Gasnier
@ 2021-03-03 23:45   ` William Breathitt Gray
  -1 siblings, 0 replies; 10+ messages in thread
From: William Breathitt Gray @ 2021-03-03 23:45 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: lee.jones, alexandre.torgue, mcoquelin.stm32, olivier.moysan,
	linux-arm-kernel, linux-kernel, linux-stm32

[-- Attachment #1: Type: text/plain, Size: 1909 bytes --]

On Wed, Mar 03, 2021 at 06:51:35PM +0100, Fabrice Gasnier wrote:
> The ARR register is cleared unconditionally upon probing, after the maximum
> value has been read. This initial condition is rather not intuitive, when
> considering the counter child driver. It rather expects the maximum value
> by default:
> - The counter interface shows a zero value by default for 'ceiling'
>   attribute.
> - Enabling the counter without any prior configuration makes it doesn't
>   count.
> 
> The reset value of ARR register is the maximum. So Choice here
> is to backup it, and restore it then, instead of clearing its value.
> It also fixes the initial condition seen by the counter driver.
> 
> Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>

> ---
>  drivers/mfd/stm32-timers.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
> index add6033..44ed2fc 100644
> --- a/drivers/mfd/stm32-timers.c
> +++ b/drivers/mfd/stm32-timers.c
> @@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
>  
>  static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
>  {
> +	u32 arr;
> +
> +	/* Backup ARR to restore it after getting the maximum value */
> +	regmap_read(ddata->regmap, TIM_ARR, &arr);
> +
>  	/*
>  	 * Only the available bits will be written so when readback
>  	 * we get the maximum value of auto reload register
>  	 */
>  	regmap_write(ddata->regmap, TIM_ARR, ~0L);
>  	regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
> -	regmap_write(ddata->regmap, TIM_ARR, 0x0);
> +	regmap_write(ddata->regmap, TIM_ARR, arr);
>  }
>  
>  static int stm32_timers_dma_probe(struct device *dev,
> -- 
> 2.7.4
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register
@ 2021-03-03 23:45   ` William Breathitt Gray
  0 siblings, 0 replies; 10+ messages in thread
From: William Breathitt Gray @ 2021-03-03 23:45 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: lee.jones, alexandre.torgue, mcoquelin.stm32, olivier.moysan,
	linux-arm-kernel, linux-kernel, linux-stm32


[-- Attachment #1.1: Type: text/plain, Size: 1909 bytes --]

On Wed, Mar 03, 2021 at 06:51:35PM +0100, Fabrice Gasnier wrote:
> The ARR register is cleared unconditionally upon probing, after the maximum
> value has been read. This initial condition is rather not intuitive, when
> considering the counter child driver. It rather expects the maximum value
> by default:
> - The counter interface shows a zero value by default for 'ceiling'
>   attribute.
> - Enabling the counter without any prior configuration makes it doesn't
>   count.
> 
> The reset value of ARR register is the maximum. So Choice here
> is to backup it, and restore it then, instead of clearing its value.
> It also fixes the initial condition seen by the counter driver.
> 
> Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>

Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>

> ---
>  drivers/mfd/stm32-timers.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
> index add6033..44ed2fc 100644
> --- a/drivers/mfd/stm32-timers.c
> +++ b/drivers/mfd/stm32-timers.c
> @@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
>  
>  static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
>  {
> +	u32 arr;
> +
> +	/* Backup ARR to restore it after getting the maximum value */
> +	regmap_read(ddata->regmap, TIM_ARR, &arr);
> +
>  	/*
>  	 * Only the available bits will be written so when readback
>  	 * we get the maximum value of auto reload register
>  	 */
>  	regmap_write(ddata->regmap, TIM_ARR, ~0L);
>  	regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
> -	regmap_write(ddata->regmap, TIM_ARR, 0x0);
> +	regmap_write(ddata->regmap, TIM_ARR, arr);
>  }
>  
>  static int stm32_timers_dma_probe(struct device *dev,
> -- 
> 2.7.4
> 

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register
  2021-03-03 17:51 ` Fabrice Gasnier
@ 2021-03-22 10:59   ` Fabrice Gasnier
  -1 siblings, 0 replies; 10+ messages in thread
From: Fabrice Gasnier @ 2021-03-22 10:59 UTC (permalink / raw)
  To: lee.jones
  Cc: vilhelm.gray, alexandre.torgue, mcoquelin.stm32, olivier.moysan,
	linux-arm-kernel, linux-kernel, linux-stm32

On 3/3/21 6:51 PM, Fabrice Gasnier wrote:
> The ARR register is cleared unconditionally upon probing, after the maximum
> value has been read. This initial condition is rather not intuitive, when
> considering the counter child driver. It rather expects the maximum value
> by default:
> - The counter interface shows a zero value by default for 'ceiling'
>   attribute.
> - Enabling the counter without any prior configuration makes it doesn't
>   count.
> 
> The reset value of ARR register is the maximum. So Choice here
> is to backup it, and restore it then, instead of clearing its value.
> It also fixes the initial condition seen by the counter driver.
> 
> Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> ---
>  drivers/mfd/stm32-timers.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Hi,

It's just a gentle reminder to review this patch.

Best Regards,
Fabrice

> 
> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
> index add6033..44ed2fc 100644
> --- a/drivers/mfd/stm32-timers.c
> +++ b/drivers/mfd/stm32-timers.c
> @@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
>  
>  static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
>  {
> +	u32 arr;
> +
> +	/* Backup ARR to restore it after getting the maximum value */
> +	regmap_read(ddata->regmap, TIM_ARR, &arr);
> +
>  	/*
>  	 * Only the available bits will be written so when readback
>  	 * we get the maximum value of auto reload register
>  	 */
>  	regmap_write(ddata->regmap, TIM_ARR, ~0L);
>  	regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
> -	regmap_write(ddata->regmap, TIM_ARR, 0x0);
> +	regmap_write(ddata->regmap, TIM_ARR, arr);
>  }
>  
>  static int stm32_timers_dma_probe(struct device *dev,
> 

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

* Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register
@ 2021-03-22 10:59   ` Fabrice Gasnier
  0 siblings, 0 replies; 10+ messages in thread
From: Fabrice Gasnier @ 2021-03-22 10:59 UTC (permalink / raw)
  To: lee.jones
  Cc: vilhelm.gray, alexandre.torgue, mcoquelin.stm32, olivier.moysan,
	linux-arm-kernel, linux-kernel, linux-stm32

On 3/3/21 6:51 PM, Fabrice Gasnier wrote:
> The ARR register is cleared unconditionally upon probing, after the maximum
> value has been read. This initial condition is rather not intuitive, when
> considering the counter child driver. It rather expects the maximum value
> by default:
> - The counter interface shows a zero value by default for 'ceiling'
>   attribute.
> - Enabling the counter without any prior configuration makes it doesn't
>   count.
> 
> The reset value of ARR register is the maximum. So Choice here
> is to backup it, and restore it then, instead of clearing its value.
> It also fixes the initial condition seen by the counter driver.
> 
> Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> ---
>  drivers/mfd/stm32-timers.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Hi,

It's just a gentle reminder to review this patch.

Best Regards,
Fabrice

> 
> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
> index add6033..44ed2fc 100644
> --- a/drivers/mfd/stm32-timers.c
> +++ b/drivers/mfd/stm32-timers.c
> @@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
>  
>  static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
>  {
> +	u32 arr;
> +
> +	/* Backup ARR to restore it after getting the maximum value */
> +	regmap_read(ddata->regmap, TIM_ARR, &arr);
> +
>  	/*
>  	 * Only the available bits will be written so when readback
>  	 * we get the maximum value of auto reload register
>  	 */
>  	regmap_write(ddata->regmap, TIM_ARR, ~0L);
>  	regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
> -	regmap_write(ddata->regmap, TIM_ARR, 0x0);
> +	regmap_write(ddata->regmap, TIM_ARR, arr);
>  }
>  
>  static int stm32_timers_dma_probe(struct device *dev,
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register
  2021-03-22 10:59   ` Fabrice Gasnier
@ 2021-03-22 12:56     ` Lee Jones
  -1 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2021-03-22 12:56 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: vilhelm.gray, alexandre.torgue, mcoquelin.stm32, olivier.moysan,
	linux-arm-kernel, linux-kernel, linux-stm32

On Mon, 22 Mar 2021, Fabrice Gasnier wrote:

> On 3/3/21 6:51 PM, Fabrice Gasnier wrote:
> > The ARR register is cleared unconditionally upon probing, after the maximum
> > value has been read. This initial condition is rather not intuitive, when
> > considering the counter child driver. It rather expects the maximum value
> > by default:
> > - The counter interface shows a zero value by default for 'ceiling'
> >   attribute.
> > - Enabling the counter without any prior configuration makes it doesn't
> >   count.
> > 
> > The reset value of ARR register is the maximum. So Choice here
> > is to backup it, and restore it then, instead of clearing its value.
> > It also fixes the initial condition seen by the counter driver.
> > 
> > Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")
> > 
> > Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> > ---
> >  drivers/mfd/stm32-timers.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> Hi,
> 
> It's just a gentle reminder to review this patch.

Looks like this was either dropped, or didn't make it into my queue.

It's on the list now, I will deal with it soon.

> > diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
> > index add6033..44ed2fc 100644
> > --- a/drivers/mfd/stm32-timers.c
> > +++ b/drivers/mfd/stm32-timers.c
> > @@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
> >  
> >  static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
> >  {
> > +	u32 arr;
> > +
> > +	/* Backup ARR to restore it after getting the maximum value */
> > +	regmap_read(ddata->regmap, TIM_ARR, &arr);
> > +
> >  	/*
> >  	 * Only the available bits will be written so when readback
> >  	 * we get the maximum value of auto reload register
> >  	 */
> >  	regmap_write(ddata->regmap, TIM_ARR, ~0L);
> >  	regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
> > -	regmap_write(ddata->regmap, TIM_ARR, 0x0);
> > +	regmap_write(ddata->regmap, TIM_ARR, arr);
> >  }
> >  
> >  static int stm32_timers_dma_probe(struct device *dev,
> > 

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register
@ 2021-03-22 12:56     ` Lee Jones
  0 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2021-03-22 12:56 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: vilhelm.gray, alexandre.torgue, mcoquelin.stm32, olivier.moysan,
	linux-arm-kernel, linux-kernel, linux-stm32

On Mon, 22 Mar 2021, Fabrice Gasnier wrote:

> On 3/3/21 6:51 PM, Fabrice Gasnier wrote:
> > The ARR register is cleared unconditionally upon probing, after the maximum
> > value has been read. This initial condition is rather not intuitive, when
> > considering the counter child driver. It rather expects the maximum value
> > by default:
> > - The counter interface shows a zero value by default for 'ceiling'
> >   attribute.
> > - Enabling the counter without any prior configuration makes it doesn't
> >   count.
> > 
> > The reset value of ARR register is the maximum. So Choice here
> > is to backup it, and restore it then, instead of clearing its value.
> > It also fixes the initial condition seen by the counter driver.
> > 
> > Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")
> > 
> > Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> > ---
> >  drivers/mfd/stm32-timers.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> Hi,
> 
> It's just a gentle reminder to review this patch.

Looks like this was either dropped, or didn't make it into my queue.

It's on the list now, I will deal with it soon.

> > diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
> > index add6033..44ed2fc 100644
> > --- a/drivers/mfd/stm32-timers.c
> > +++ b/drivers/mfd/stm32-timers.c
> > @@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
> >  
> >  static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
> >  {
> > +	u32 arr;
> > +
> > +	/* Backup ARR to restore it after getting the maximum value */
> > +	regmap_read(ddata->regmap, TIM_ARR, &arr);
> > +
> >  	/*
> >  	 * Only the available bits will be written so when readback
> >  	 * we get the maximum value of auto reload register
> >  	 */
> >  	regmap_write(ddata->regmap, TIM_ARR, ~0L);
> >  	regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
> > -	regmap_write(ddata->regmap, TIM_ARR, 0x0);
> > +	regmap_write(ddata->regmap, TIM_ARR, arr);
> >  }
> >  
> >  static int stm32_timers_dma_probe(struct device *dev,
> > 

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register
  2021-03-03 17:51 ` Fabrice Gasnier
@ 2021-03-23  9:39   ` Lee Jones
  -1 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2021-03-23  9:39 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: vilhelm.gray, alexandre.torgue, mcoquelin.stm32, olivier.moysan,
	linux-arm-kernel, linux-kernel, linux-stm32

On Wed, 03 Mar 2021, Fabrice Gasnier wrote:

> The ARR register is cleared unconditionally upon probing, after the maximum
> value has been read. This initial condition is rather not intuitive, when
> considering the counter child driver. It rather expects the maximum value
> by default:
> - The counter interface shows a zero value by default for 'ceiling'
>   attribute.
> - Enabling the counter without any prior configuration makes it doesn't
>   count.
> 
> The reset value of ARR register is the maximum. So Choice here
> is to backup it, and restore it then, instead of clearing its value.
> It also fixes the initial condition seen by the counter driver.
> 
> Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> ---
>  drivers/mfd/stm32-timers.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH] mfd: stm32-timers: avoid clearing auto reload register
@ 2021-03-23  9:39   ` Lee Jones
  0 siblings, 0 replies; 10+ messages in thread
From: Lee Jones @ 2021-03-23  9:39 UTC (permalink / raw)
  To: Fabrice Gasnier
  Cc: vilhelm.gray, alexandre.torgue, mcoquelin.stm32, olivier.moysan,
	linux-arm-kernel, linux-kernel, linux-stm32

On Wed, 03 Mar 2021, Fabrice Gasnier wrote:

> The ARR register is cleared unconditionally upon probing, after the maximum
> value has been read. This initial condition is rather not intuitive, when
> considering the counter child driver. It rather expects the maximum value
> by default:
> - The counter interface shows a zero value by default for 'ceiling'
>   attribute.
> - Enabling the counter without any prior configuration makes it doesn't
>   count.
> 
> The reset value of ARR register is the maximum. So Choice here
> is to backup it, and restore it then, instead of clearing its value.
> It also fixes the initial condition seen by the counter driver.
> 
> Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")
> 
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
> ---
>  drivers/mfd/stm32-timers.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Applied, thanks.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-03-23  9:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 17:51 [PATCH] mfd: stm32-timers: avoid clearing auto reload register Fabrice Gasnier
2021-03-03 17:51 ` Fabrice Gasnier
2021-03-03 23:45 ` William Breathitt Gray
2021-03-03 23:45   ` William Breathitt Gray
2021-03-22 10:59 ` Fabrice Gasnier
2021-03-22 10:59   ` Fabrice Gasnier
2021-03-22 12:56   ` Lee Jones
2021-03-22 12:56     ` Lee Jones
2021-03-23  9:39 ` Lee Jones
2021-03-23  9:39   ` Lee Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.