netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
	Wenyou Yang <wenyou.yang@atmel.com>,
	Wolfgang Grandegger <wg@grandegger.com>
Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Quentin Schulz <quentin.schulz@free-electrons.com>,
	Wenyou Yang <wenyou.yang@microchip.com>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] can: m_can: enable transmission of FD frame on latest version
Date: Mon, 6 Mar 2017 20:33:15 +0100	[thread overview]
Message-ID: <b24f3252-6bd9-db48-b224-5bf3683cb75d@hartkopp.net> (raw)
In-Reply-To: <e4360c52-d62d-6c35-f691-7fcd0f74f954@pengutronix.de>

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 <socketcan@hartkopp.net>

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&m=148716783119090&w=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

  reply	other threads:[~2017-03-06 19:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-06  2:21 [PATCH v2] can: m_can: enable transmission of FD frame on latest version Wenyou Yang
2017-03-06 10:53 ` Marc Kleine-Budde
2017-03-06 19:33   ` Oliver Hartkopp [this message]
2017-03-06 21:26     ` Oliver Hartkopp
2017-03-07  1:03       ` Wenyou.Yang
2017-04-07 11:41         ` Quentin Schulz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b24f3252-6bd9-db48-b224-5bf3683cb75d@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    --cc=quentin.schulz@free-electrons.com \
    --cc=wenyou.yang@atmel.com \
    --cc=wenyou.yang@microchip.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).