Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-04-07 Thread Quentin Schulz
Hi Oliver and Marc,

On 07/03/2017 02:03, wenyou.y...@microchip.com wrote:
> HI Oliver, 
> 
>> -Original Message-
>> From: Oliver Hartkopp [mailto:socket...@hartkopp.net]
>> Sent: 2017年3月7日 5:26
>> To: Marc Kleine-Budde <m...@pengutronix.de>; Wenyou Yang - A41535
>> <wenyou.y...@microchip.com>; Wolfgang Grandegger <w...@grandegger.com>
>> Cc: Alexandre Belloni <alexandre.bell...@free-electrons.com>; Florian 
>> Fainelli
>> <f.faine...@gmail.com>; Quentin Schulz <quentin.sch...@free-electrons.com>;
>> Wenyou Yang - A41535 <wenyou.y...@microchip.com>; Nicolas Ferre
>> <nicolas.fe...@atmel.com>; linux-...@vger.kernel.org; net...@vger.kernel.org;
>> linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest
>> version
>>
>> @Wenyou Yang: Can you please test the two patches posted here:
> 
> Tested on SAMA5D2 SoC, It works.
> 
>>
>> [PATCH 1/2] can: m_can: handle bitrate setup on IP core >= 3.1.x
>> http://marc.info/?l=linux-can=148883529927720=2
>>
>> [PATCH 2/2] can: m_can: handle frame transmission on IP core >= 3.1.x
>> http://marc.info/?l=linux-can=148883529927718=2
>>

Sorry, never received those mails so didn't know I had to do something.
I forgot to add my Signed-off-by when resending it so of course you can
add it to your next version:

Signed-off-by: Quentin Schulz <quentin.sch...@free-electrons.com>

That gives me the opportunity to relaunch the discussion on it. What's
the status?

Quentin

>> Tnx & regards,
>> Oliver
> 
> Thank you.
> 
> Best Regards,
> Wenyou Yang
> 

-- 
Quentin Schulz, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-04-07 Thread Quentin Schulz
Hi Oliver and Marc,

On 07/03/2017 02:03, wenyou.y...@microchip.com wrote:
> HI Oliver, 
> 
>> -Original Message-
>> From: Oliver Hartkopp [mailto:socket...@hartkopp.net]
>> Sent: 2017年3月7日 5:26
>> To: Marc Kleine-Budde ; Wenyou Yang - A41535
>> ; Wolfgang Grandegger 
>> Cc: Alexandre Belloni ; Florian 
>> Fainelli
>> ; Quentin Schulz ;
>> Wenyou Yang - A41535 ; Nicolas Ferre
>> ; linux-...@vger.kernel.org; net...@vger.kernel.org;
>> linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest
>> version
>>
>> @Wenyou Yang: Can you please test the two patches posted here:
> 
> Tested on SAMA5D2 SoC, It works.
> 
>>
>> [PATCH 1/2] can: m_can: handle bitrate setup on IP core >= 3.1.x
>> http://marc.info/?l=linux-can=148883529927720=2
>>
>> [PATCH 2/2] can: m_can: handle frame transmission on IP core >= 3.1.x
>> http://marc.info/?l=linux-can=148883529927718=2
>>

Sorry, never received those mails so didn't know I had to do something.
I forgot to add my Signed-off-by when resending it so of course you can
add it to your next version:

Signed-off-by: Quentin Schulz 

That gives me the opportunity to relaunch the discussion on it. What's
the status?

Quentin

>> Tnx & regards,
>> Oliver
> 
> Thank you.
> 
> Best Regards,
> Wenyou Yang
> 

-- 
Quentin Schulz, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


RE: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-03-06 Thread Wenyou.Yang
HI Oliver, 

> -Original Message-
> From: Oliver Hartkopp [mailto:socket...@hartkopp.net]
> Sent: 2017年3月7日 5:26
> To: Marc Kleine-Budde <m...@pengutronix.de>; Wenyou Yang - A41535
> <wenyou.y...@microchip.com>; Wolfgang Grandegger <w...@grandegger.com>
> Cc: Alexandre Belloni <alexandre.bell...@free-electrons.com>; Florian Fainelli
> <f.faine...@gmail.com>; Quentin Schulz <quentin.sch...@free-electrons.com>;
> Wenyou Yang - A41535 <wenyou.y...@microchip.com>; Nicolas Ferre
> <nicolas.fe...@atmel.com>; linux-...@vger.kernel.org; net...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest
> version
> 
> @Wenyou Yang: Can you please test the two patches posted here:

Tested on SAMA5D2 SoC, It works.

> 
> [PATCH 1/2] can: m_can: handle bitrate setup on IP core >= 3.1.x
> http://marc.info/?l=linux-can=148883529927720=2
> 
> [PATCH 2/2] can: m_can: handle frame transmission on IP core >= 3.1.x
> http://marc.info/?l=linux-can=148883529927718=2
> 
> Tnx & regards,
> Oliver

Thank you.

Best Regards,
Wenyou Yang


RE: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-03-06 Thread Wenyou.Yang
HI Oliver, 

> -Original Message-
> From: Oliver Hartkopp [mailto:socket...@hartkopp.net]
> Sent: 2017年3月7日 5:26
> To: Marc Kleine-Budde ; Wenyou Yang - A41535
> ; Wolfgang Grandegger 
> Cc: Alexandre Belloni ; Florian Fainelli
> ; Quentin Schulz ;
> Wenyou Yang - A41535 ; Nicolas Ferre
> ; linux-...@vger.kernel.org; net...@vger.kernel.org;
> linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest
> version
> 
> @Wenyou Yang: Can you please test the two patches posted here:

Tested on SAMA5D2 SoC, It works.

> 
> [PATCH 1/2] can: m_can: handle bitrate setup on IP core >= 3.1.x
> http://marc.info/?l=linux-can=148883529927720=2
> 
> [PATCH 2/2] can: m_can: handle frame transmission on IP core >= 3.1.x
> http://marc.info/?l=linux-can=148883529927718=2
> 
> Tnx & regards,
> Oliver

Thank you.

Best Regards,
Wenyou Yang


Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-03-06 Thread Oliver Hartkopp

@Wenyou Yang: Can you please test the two patches posted here:

[PATCH 1/2] can: m_can: handle bitrate setup on IP core >= 3.1.x
http://marc.info/?l=linux-can=148883529927720=2

[PATCH 2/2] can: m_can: handle frame transmission on IP core >= 3.1.x
http://marc.info/?l=linux-can=148883529927718=2

Tnx & regards,
Oliver



Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-03-06 Thread Oliver Hartkopp

@Wenyou Yang: Can you please test the two patches posted here:

[PATCH 1/2] can: m_can: handle bitrate setup on IP core >= 3.1.x
http://marc.info/?l=linux-can=148883529927720=2

[PATCH 2/2] can: m_can: handle frame transmission on IP core >= 3.1.x
http://marc.info/?l=linux-can=148883529927718=2

Tnx & regards,
Oliver



Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-03-06 Thread Oliver Hartkopp

Hi Marc,

On 03/06/2017 11:53 AM, Marc Kleine-Budde wrote:

On 03/06/2017 03:21 AM, Wenyou Yang wrote:

Enables the transmission of CAN FD frames on M_CAN IP core >= v3.1.x
and with the bit rate switching.

Tested on M_CAN IP 3.1.0 (CREL = 0x31040730) of SAMA5D2 SoC.


Does this patch work still with the old version of the silicon?


The bits that were added in the TX FIFO element are 'reserved' in the 
old silicon - so it should not harm.


This code enables

 if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
-   cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT;
+   cccr |= (CCCR_CME_CANFD_BRS | CCCR_CME_CANFD) << CCCR_CME_SHIFT;

the CAN FD support in the new silicon.

This register is set for the old silicon EVERY time a CAN frame is sent.
So this change should not harm the old silicon either.

In fact I was told that the v3.0.x IP core is rather seldom in the wild.
Although I don't have a v3.0.x to test it should work from the 
documentation side of view.


Reviewed-by: Oliver Hartkopp 

If we would like to make it really better, the code in 
m_can_start_xmit() should only fiddle with the M_CAN_CCCR register when 
working with the v3.0.x silicon.


In fact I would suggest to use the

if (m_can_read_core_rev(priv) < M_CAN_COREREL_3_1_0)

method from

http://marc.info/?l=linux-can=148716783119090=2

to split the code in m_can_start_xmit() accordingly.

@Wenyou Yang: Can you please send a v3 which splits the tx function?

Regards,
Oliver


Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-03-06 Thread Oliver Hartkopp

Hi Marc,

On 03/06/2017 11:53 AM, Marc Kleine-Budde wrote:

On 03/06/2017 03:21 AM, Wenyou Yang wrote:

Enables the transmission of CAN FD frames on M_CAN IP core >= v3.1.x
and with the bit rate switching.

Tested on M_CAN IP 3.1.0 (CREL = 0x31040730) of SAMA5D2 SoC.


Does this patch work still with the old version of the silicon?


The bits that were added in the TX FIFO element are 'reserved' in the 
old silicon - so it should not harm.


This code enables

 if (priv->can.ctrlmode & CAN_CTRLMODE_FD)
-   cccr |= CCCR_CME_CANFD_BRS << CCCR_CME_SHIFT;
+   cccr |= (CCCR_CME_CANFD_BRS | CCCR_CME_CANFD) << CCCR_CME_SHIFT;

the CAN FD support in the new silicon.

This register is set for the old silicon EVERY time a CAN frame is sent.
So this change should not harm the old silicon either.

In fact I was told that the v3.0.x IP core is rather seldom in the wild.
Although I don't have a v3.0.x to test it should work from the 
documentation side of view.


Reviewed-by: Oliver Hartkopp 

If we would like to make it really better, the code in 
m_can_start_xmit() should only fiddle with the M_CAN_CCCR register when 
working with the v3.0.x silicon.


In fact I would suggest to use the

if (m_can_read_core_rev(priv) < M_CAN_COREREL_3_1_0)

method from

http://marc.info/?l=linux-can=148716783119090=2

to split the code in m_can_start_xmit() accordingly.

@Wenyou Yang: Can you please send a v3 which splits the tx function?

Regards,
Oliver


Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-03-06 Thread Marc Kleine-Budde
On 03/06/2017 03:21 AM, Wenyou Yang wrote:
> Enables the transmission of CAN FD frames on M_CAN IP core >= v3.1.x
> and with the bit rate switching.
> 
> Tested on M_CAN IP 3.1.0 (CREL = 0x31040730) of SAMA5D2 SoC.

Does this patch work still with the old version of the silicon?

Marc

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



signature.asc
Description: OpenPGP digital signature


Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest version

2017-03-06 Thread Marc Kleine-Budde
On 03/06/2017 03:21 AM, Wenyou Yang wrote:
> Enables the transmission of CAN FD frames on M_CAN IP core >= v3.1.x
> and with the bit rate switching.
> 
> Tested on M_CAN IP 3.1.0 (CREL = 0x31040730) of SAMA5D2 SoC.

Does this patch work still with the old version of the silicon?

Marc

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



signature.asc
Description: OpenPGP digital signature