linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [linux][PATCH] counter: microchip-tcb-capture: Fix the use of internal GCLK logic
@ 2023-09-05 10:08 Dharma Balasubiramani
  2023-09-05 16:32 ` William Breathitt Gray
  0 siblings, 1 reply; 2+ messages in thread
From: Dharma Balasubiramani @ 2023-09-05 10:08 UTC (permalink / raw)
  To: kamel.bouhara, william.gray, linux-arm-kernel, linux-iio,
	linux-kernel
  Cc: hari.prasathge, balamanikandan.gunasundar, Dharma Balasubiramani

As per the datasheet, the clock selection Bits 2:0 – TCCLKS[2:0] should
be set to 0 while using the internal GCLK (TIMER_CLOCK1).

Fixes: 106b104137fd ("counter: Add microchip TCB capture counter")
Signed-off-by: Dharma Balasubiramani <dharma.b@microchip.com>
---
 drivers/counter/microchip-tcb-capture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/counter/microchip-tcb-capture.c b/drivers/counter/microchip-tcb-capture.c
index e2d1dc6ca668..c7af13aca36c 100644
--- a/drivers/counter/microchip-tcb-capture.c
+++ b/drivers/counter/microchip-tcb-capture.c
@@ -98,7 +98,7 @@ static int mchp_tc_count_function_write(struct counter_device *counter,
 		priv->qdec_mode = 0;
 		/* Set highest rate based on whether soc has gclk or not */
 		bmr &= ~(ATMEL_TC_QDEN | ATMEL_TC_POSEN);
-		if (priv->tc_cfg->has_gclk)
+		if (!priv->tc_cfg->has_gclk)
 			cmr |= ATMEL_TC_TIMER_CLOCK2;
 		else
 			cmr |= ATMEL_TC_TIMER_CLOCK1;
-- 
2.25.1


_______________________________________________
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] 2+ messages in thread

* Re: [linux][PATCH] counter: microchip-tcb-capture: Fix the use of internal GCLK logic
  2023-09-05 10:08 [linux][PATCH] counter: microchip-tcb-capture: Fix the use of internal GCLK logic Dharma Balasubiramani
@ 2023-09-05 16:32 ` William Breathitt Gray
  0 siblings, 0 replies; 2+ messages in thread
From: William Breathitt Gray @ 2023-09-05 16:32 UTC (permalink / raw)
  To: Dharma Balasubiramani
  Cc: kamel.bouhara, linux-iio, balamanikandan.gunasundar, linux-kernel,
	hari.prasathge, linux-arm-kernel


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

On Tue, Sep 05, 2023 at 03:38:35PM +0530, Dharma Balasubiramani wrote:
> As per the datasheet, the clock selection Bits 2:0 – TCCLKS[2:0] should
> be set to 0 while using the internal GCLK (TIMER_CLOCK1).
> 
> Fixes: 106b104137fd ("counter: Add microchip TCB capture counter")
> Signed-off-by: Dharma Balasubiramani <dharma.b@microchip.com>
> ---
>  drivers/counter/microchip-tcb-capture.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/counter/microchip-tcb-capture.c b/drivers/counter/microchip-tcb-capture.c
> index e2d1dc6ca668..c7af13aca36c 100644
> --- a/drivers/counter/microchip-tcb-capture.c
> +++ b/drivers/counter/microchip-tcb-capture.c
> @@ -98,7 +98,7 @@ static int mchp_tc_count_function_write(struct counter_device *counter,
>  		priv->qdec_mode = 0;
>  		/* Set highest rate based on whether soc has gclk or not */
>  		bmr &= ~(ATMEL_TC_QDEN | ATMEL_TC_POSEN);
> -		if (priv->tc_cfg->has_gclk)
> +		if (!priv->tc_cfg->has_gclk)
>  			cmr |= ATMEL_TC_TIMER_CLOCK2;
>  		else
>  			cmr |= ATMEL_TC_TIMER_CLOCK1;
> -- 
> 2.25.1

Applied to counter-fixes as commit df8fdd01c98b.

Thanks,

William Breathitt Gray

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 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] 2+ messages in thread

end of thread, other threads:[~2023-09-05 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-05 10:08 [linux][PATCH] counter: microchip-tcb-capture: Fix the use of internal GCLK logic Dharma Balasubiramani
2023-09-05 16:32 ` William Breathitt Gray

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