linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: m_can: m_can_chip_config(): actually enable internal timestamping
@ 2022-06-12 21:27 ` Marc Kleine-Budde
  2022-06-13  6:30   ` Chandrasekar R
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Kleine-Budde @ 2022-06-12 21:27 UTC (permalink / raw)
  To: linux-can
  Cc: kernel, Marc Kleine-Budde, Torin Cooper-Bennun,
	Chandrasekar Ramakrishnan

In commit df06fd678260 ("can: m_can: m_can_chip_config(): enable and
configure internal timestamps") the timestamping in the m_can core
should be enabled. In peripheral mode, the RX'ed CAN frames, TX
compete frames and error events are sorted by the timestamp.

The above mentioned commit however forgot to enable the timestamping.
This patch adds the missing bits to the write of the Timestamp Counter
Configuration register.

Fixes: df06fd678260 ("can: m_can: m_can_chip_config(): enable and configure internal timestamps")
Cc: Torin Cooper-Bennun <torin@maxiluxsystems.com>
Cc: Chandrasekar Ramakrishnan <rcsekar@samsung.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/m_can/m_can.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 5d0c82d8b9a9..03a22d493cf6 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1351,7 +1351,9 @@ static void m_can_chip_config(struct net_device *dev)
 	/* enable internal timestamp generation, with a prescalar of 16. The
 	 * prescalar is applied to the nominal bit timing
 	 */
-	m_can_write(cdev, M_CAN_TSCC, FIELD_PREP(TSCC_TCP_MASK, 0xf));
+	m_can_write(cdev, M_CAN_TSCC,
+		    FIELD_PREP(TSCC_TCP_MASK, 0xf) |
+		    FIELD_PREP(TSCC_TSS_MASK, TSCC_TSS_INTERNAL));
 
 	m_can_config_endisable(cdev, false);
 
-- 
2.35.1



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

* RE: [PATCH] can: m_can: m_can_chip_config(): actually enable internal timestamping
  2022-06-12 21:27 ` [PATCH] can: m_can: m_can_chip_config(): actually enable internal timestamping Marc Kleine-Budde
@ 2022-06-13  6:30   ` Chandrasekar R
  0 siblings, 0 replies; 2+ messages in thread
From: Chandrasekar R @ 2022-06-13  6:30 UTC (permalink / raw)
  To: 'Marc Kleine-Budde', linux-can
  Cc: kernel, 'Torin Cooper-Bennun'



> -----Original Message-----
> From: Marc Kleine-Budde [mailto:mkl@pengutronix.de]
> Sent: Monday, June 13, 2022 2:57 AM
> To: linux-can@vger.kernel.org
> Cc: kernel@pengutronix.de; Marc Kleine-Budde <mkl@pengutronix.de>;
> Torin Cooper-Bennun <torin@maxiluxsystems.com>; Chandrasekar
> Ramakrishnan <rcsekar@samsung.com>
> Subject: [PATCH] can: m_can: m_can_chip_config(): actually enable internal
> timestamping
> 
> In commit df06fd678260 ("can: m_can: m_can_chip_config(): enable and
> configure internal timestamps") the timestamping in the m_can core should
> be enabled. In peripheral mode, the RX'ed CAN frames, TX compete frames
> and error events are sorted by the timestamp.
> 
> The above mentioned commit however forgot to enable the timestamping.
> This patch adds the missing bits to the write of the Timestamp Counter
> Configuration register.
> 
> Fixes: df06fd678260 ("can: m_can: m_can_chip_config(): enable and
> configure internal timestamps")
> Cc: Torin Cooper-Bennun <torin@maxiluxsystems.com>
> Cc: Chandrasekar Ramakrishnan <rcsekar@samsung.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Changes looks fine, 
Reviewed-by: Chandrasekar Ramakrishnan <rcsekar@samsung.com>
> ---
>  drivers/net/can/m_can/m_can.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/m_can/m_can.c
> b/drivers/net/can/m_can/m_can.c index 5d0c82d8b9a9..03a22d493cf6
> 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -1351,7 +1351,9 @@ static void m_can_chip_config(struct net_device
> *dev)
>  	/* enable internal timestamp generation, with a prescalar of 16. The
>  	 * prescalar is applied to the nominal bit timing
>  	 */
> -	m_can_write(cdev, M_CAN_TSCC, FIELD_PREP(TSCC_TCP_MASK,
> 0xf));
> +	m_can_write(cdev, M_CAN_TSCC,
> +		    FIELD_PREP(TSCC_TCP_MASK, 0xf) |
> +		    FIELD_PREP(TSCC_TSS_MASK, TSCC_TSS_INTERNAL));
> 
>  	m_can_config_endisable(cdev, false);
> 
> --
> 2.35.1
> 



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

end of thread, other threads:[~2022-06-13  6:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20220612212736epcas5p4bf1d5ea94666f176dd1ec3b0e61f37bf@epcas5p4.samsung.com>
2022-06-12 21:27 ` [PATCH] can: m_can: m_can_chip_config(): actually enable internal timestamping Marc Kleine-Budde
2022-06-13  6:30   ` Chandrasekar R

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