netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] can: m_can: add support for one shot mode
       [not found] <CGME20190925114609epcas5p305e259619c7fe8cdc75d9fd27f34e758@epcas5p3.samsung.com>
@ 2019-09-25 11:45 ` Pankaj Sharma
  2019-10-03  3:47   ` pankj.sharma
  2019-10-04 20:41   ` Marc Kleine-Budde
  0 siblings, 2 replies; 4+ messages in thread
From: Pankaj Sharma @ 2019-09-25 11:45 UTC (permalink / raw)
  To: linux-can, netdev, linux-kernel
  Cc: wg, mkl, davem, eugen.hristev, ludovic.desroches, pankaj.dubey,
	rcsekar, Pankaj Sharma, Sriram Dash

According to the CAN Specification (see ISO 11898-1:2015, 8.3.4
Recovery Management), the M_CAN provides means for automatic
retransmission of frames that have lost arbitration or that
have been disturbed by errors during transmission. By default
automatic retransmission is enabled.

The Bosch MCAN controller has support for disabling automatic
retransmission.

To support time-triggered communication as described in ISO
11898-1:2015, chapter 9.2, the automatic retransmission may be
disabled via CCCR.DAR.

CAN_CTRLMODE_ONE_SHOT is used for disabling automatic retransmission.

Signed-off-by: Pankaj Sharma <pankj.sharma@samsung.com>
Signed-off-by: Sriram Dash <sriram.dash@samsung.com>
---
 drivers/net/can/m_can/m_can.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index deb274a19ba0..e7165404ba8a 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -150,6 +150,7 @@ enum m_can_mram_cfg {
 #define CCCR_CME_CANFD_BRS	0x2
 #define CCCR_TXP		BIT(14)
 #define CCCR_TEST		BIT(7)
+#define CCCR_DAR		BIT(6)
 #define CCCR_MON		BIT(5)
 #define CCCR_CSR		BIT(4)
 #define CCCR_CSA		BIT(3)
@@ -1123,7 +1124,7 @@ static void m_can_chip_config(struct net_device *dev)
 	if (priv->version == 30) {
 	/* Version 3.0.x */
 
-		cccr &= ~(CCCR_TEST | CCCR_MON |
+		cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_DAR |
 			(CCCR_CMR_MASK << CCCR_CMR_SHIFT) |
 			(CCCR_CME_MASK << CCCR_CME_SHIFT));
 
@@ -1133,7 +1134,7 @@ static void m_can_chip_config(struct net_device *dev)
 	} else {
 	/* Version 3.1.x or 3.2.x */
 		cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE |
-			  CCCR_NISO);
+			  CCCR_NISO | CCCR_DAR);
 
 		/* Only 3.2.x has NISO Bit implemented */
 		if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO)
@@ -1153,6 +1154,10 @@ static void m_can_chip_config(struct net_device *dev)
 	if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
 		cccr |= CCCR_MON;
 
+	/* Disable Auto Retransmission (all versions) */
+	if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT)
+		cccr |= CCCR_DAR;
+
 	/* Write config */
 	m_can_write(priv, M_CAN_CCCR, cccr);
 	m_can_write(priv, M_CAN_TEST, test);
@@ -1291,7 +1296,8 @@ static int m_can_dev_setup(struct platform_device *pdev, struct net_device *dev,
 	priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
 					CAN_CTRLMODE_LISTENONLY |
 					CAN_CTRLMODE_BERR_REPORTING |
-					CAN_CTRLMODE_FD;
+					CAN_CTRLMODE_FD |
+					CAN_CTRLMODE_ONE_SHOT;
 
 	/* Set properties depending on M_CAN version */
 	switch (priv->version) {
-- 
2.17.1


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

* RE: [PATCH] can: m_can: add support for one shot mode
  2019-09-25 11:45 ` [PATCH] can: m_can: add support for one shot mode Pankaj Sharma
@ 2019-10-03  3:47   ` pankj.sharma
  2019-10-04 20:41   ` Marc Kleine-Budde
  1 sibling, 0 replies; 4+ messages in thread
From: pankj.sharma @ 2019-10-03  3:47 UTC (permalink / raw)
  To: linux-can, netdev, linux-kernel
  Cc: wg, mkl, davem, eugen.hristev, ludovic.desroches, pankaj.dubey,
	rcsekar, 'Sriram Dash'

Gentle Ping

> -----Original Message-----
> From: Pankaj Sharma <pankj.sharma@samsung.com>
> Subject: [PATCH] can: m_can: add support for one shot mode
> 
> According to the CAN Specification (see ISO 11898-1:2015, 8.3.4 Recovery
> Management), the M_CAN provides means for automatic retransmission of
> frames that have lost arbitration or that have been disturbed by errors during
> transmission. By default automatic retransmission is enabled.
> 
> The Bosch MCAN controller has support for disabling automatic retransmission.
> 
> To support time-triggered communication as described in ISO 11898-1:2015,
> chapter 9.2, the automatic retransmission may be disabled via CCCR.DAR.
> 
> CAN_CTRLMODE_ONE_SHOT is used for disabling automatic retransmission.
> 
> Signed-off-by: Pankaj Sharma <pankj.sharma@samsung.com>
> Signed-off-by: Sriram Dash <sriram.dash@samsung.com>
> ---
>  drivers/net/can/m_can/m_can.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
> index deb274a19ba0..e7165404ba8a 100644
> --- a/drivers/net/can/m_can/m_can.c
> +++ b/drivers/net/can/m_can/m_can.c
> @@ -150,6 +150,7 @@ enum m_can_mram_cfg {
>  #define CCCR_CME_CANFD_BRS	0x2
>  #define CCCR_TXP		BIT(14)
>  #define CCCR_TEST		BIT(7)
> +#define CCCR_DAR		BIT(6)
>  #define CCCR_MON		BIT(5)
>  #define CCCR_CSR		BIT(4)
>  #define CCCR_CSA		BIT(3)
> @@ -1123,7 +1124,7 @@ static void m_can_chip_config(struct net_device
> *dev)
>  	if (priv->version == 30) {
>  	/* Version 3.0.x */
> 
> -		cccr &= ~(CCCR_TEST | CCCR_MON |
> +		cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_DAR |
>  			(CCCR_CMR_MASK << CCCR_CMR_SHIFT) |
>  			(CCCR_CME_MASK << CCCR_CME_SHIFT));
> 
> @@ -1133,7 +1134,7 @@ static void m_can_chip_config(struct net_device
> *dev)
>  	} else {
>  	/* Version 3.1.x or 3.2.x */
>  		cccr &= ~(CCCR_TEST | CCCR_MON | CCCR_BRSE | CCCR_FDOE
> |
> -			  CCCR_NISO);
> +			  CCCR_NISO | CCCR_DAR);
> 
>  		/* Only 3.2.x has NISO Bit implemented */
>  		if (priv->can.ctrlmode & CAN_CTRLMODE_FD_NON_ISO) @@ -
> 1153,6 +1154,10 @@ static void m_can_chip_config(struct net_device *dev)
>  	if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
>  		cccr |= CCCR_MON;
> 
> +	/* Disable Auto Retransmission (all versions) */
> +	if (priv->can.ctrlmode & CAN_CTRLMODE_ONE_SHOT)
> +		cccr |= CCCR_DAR;
> +
>  	/* Write config */
>  	m_can_write(priv, M_CAN_CCCR, cccr);
>  	m_can_write(priv, M_CAN_TEST, test);
> @@ -1291,7 +1296,8 @@ static int m_can_dev_setup(struct platform_device
> *pdev, struct net_device *dev,
>  	priv->can.ctrlmode_supported = CAN_CTRLMODE_LOOPBACK |
>  					CAN_CTRLMODE_LISTENONLY |
>  					CAN_CTRLMODE_BERR_REPORTING |
> -					CAN_CTRLMODE_FD;
> +					CAN_CTRLMODE_FD |
> +					CAN_CTRLMODE_ONE_SHOT;
> 
>  	/* Set properties depending on M_CAN version */
>  	switch (priv->version) {
> --
> 2.17.1



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

* Re: [PATCH] can: m_can: add support for one shot mode
  2019-09-25 11:45 ` [PATCH] can: m_can: add support for one shot mode Pankaj Sharma
  2019-10-03  3:47   ` pankj.sharma
@ 2019-10-04 20:41   ` Marc Kleine-Budde
  2019-10-14 11:30     ` pankj.sharma
  1 sibling, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2019-10-04 20:41 UTC (permalink / raw)
  To: Pankaj Sharma, linux-can, netdev, linux-kernel
  Cc: wg, davem, eugen.hristev, ludovic.desroches, pankaj.dubey,
	rcsekar, Sriram Dash


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

On 9/25/19 1:45 PM, Pankaj Sharma wrote:
> According to the CAN Specification (see ISO 11898-1:2015, 8.3.4
> Recovery Management), the M_CAN provides means for automatic
> retransmission of frames that have lost arbitration or that
> have been disturbed by errors during transmission. By default
> automatic retransmission is enabled.
> 
> The Bosch MCAN controller has support for disabling automatic
> retransmission.
> 
> To support time-triggered communication as described in ISO
> 11898-1:2015, chapter 9.2, the automatic retransmission may be
> disabled via CCCR.DAR.
> 
> CAN_CTRLMODE_ONE_SHOT is used for disabling automatic retransmission.
> 
> Signed-off-by: Pankaj Sharma <pankj.sharma@samsung.com>
> Signed-off-by: Sriram Dash <sriram.dash@samsung.com>

The patch does not apply to net-next/master. Please use net-next/master
as a base for patches introducing new features.

I've ported the patch and applied it.

tnx,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* RE: [PATCH] can: m_can: add support for one shot mode
  2019-10-04 20:41   ` Marc Kleine-Budde
@ 2019-10-14 11:30     ` pankj.sharma
  0 siblings, 0 replies; 4+ messages in thread
From: pankj.sharma @ 2019-10-14 11:30 UTC (permalink / raw)
  To: 'Marc Kleine-Budde'
  Cc: wg, davem, eugen.hristev, ludovic.desroches, pankaj.dubey,
	rcsekar, 'Sriram Dash',
	linux-can, netdev, linux-kernel

> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Subject: Re: [PATCH] can: m_can: add support for one shot mode
> 
> On 9/25/19 1:45 PM, Pankaj Sharma wrote:
> > According to the CAN Specification (see ISO 11898-1:2015, 8.3.4
> > Recovery Management), the M_CAN provides means for automatic
> > retransmission of frames that have lost arbitration or that have been
> > disturbed by errors during transmission. By default automatic
> > retransmission is enabled.
> >
> > The Bosch MCAN controller has support for disabling automatic
> > retransmission.
> >
> > To support time-triggered communication as described in ISO
> > 11898-1:2015, chapter 9.2, the automatic retransmission may be
> > disabled via CCCR.DAR.
> >
> > CAN_CTRLMODE_ONE_SHOT is used for disabling automatic retransmission.
> >
> > Signed-off-by: Pankaj Sharma <pankj.sharma@samsung.com>
> > Signed-off-by: Sriram Dash <sriram.dash@samsung.com>
> 
> The patch does not apply to net-next/master. Please use net-next/master as a
> base for patches introducing new features.
> 

Thank you for the information.

> I've ported the patch and applied it.
> 

We are not able to get the patch in the net-next/master branch.
Sent patch v2 after rebasing to net-next/master
https://lore.kernel.org/patchwork/patch/1139214/

> tnx,
> Marc
> 
> --
> Pengutronix e.K.                  | Marc Kleine-Budde           |
> Industrial Linux Solutions        | Phone: +49-231-2826-924     |
> Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



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

end of thread, other threads:[~2019-10-14 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190925114609epcas5p305e259619c7fe8cdc75d9fd27f34e758@epcas5p3.samsung.com>
2019-09-25 11:45 ` [PATCH] can: m_can: add support for one shot mode Pankaj Sharma
2019-10-03  3:47   ` pankj.sharma
2019-10-04 20:41   ` Marc Kleine-Budde
2019-10-14 11:30     ` pankj.sharma

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