public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Angelo Dureghello <angelo@kernel-space.org>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: gerg@linux-m68k.org, geert@linux-m68k.org,
	linux-m68k@vger.kernel.org, linux-can@vger.kernel.org,
	qiangqing.zhang@nxp.com,
	Dario Binacchi <dario.binacchi@amarulasolutions.com>
Subject: Re: mcf5441x: flexcan FIFO and mailbox mode (was: Re: [PATCH v5 5/5] can: flexcan: add mcf5441x support)
Date: Fri, 21 Jan 2022 11:16:16 +0100 (CET)	[thread overview]
Message-ID: <d67c4bbf-1c39-323-2a4-3167d6febe64@kernel-space.org> (raw)
In-Reply-To: <20220121084931.llxryhizdaeb4ph4@pengutronix.de>

Hi Marc,

On Fri, 21 Jan 2022, Marc Kleine-Budde wrote:

> On 21.01.2022 00:35:43, Angelo Dureghello wrote:
>>> Please apply appropriate change and check if the driver still works if
>>> you RX with full CAN bus load. Please also test if you can still receive
>>> RTR frames.
>>>
>>
>> I tested this patch:
>>
>> -------------------- drivers/net/can/flexcan/flexcan-core.c index
>> 0bff1884d5cc..daeeb6250347 100644
>> @@ -296,7 +296,10 @@ static_assert(sizeof(struct flexcan_regs) ==  0x4 * 18
>> + 0xfb8);
>>  static const struct flexcan_devtype_data fsl_mcf5441x_devtype_data = {
>>  	.quirks = FLEXCAN_QUIRK_BROKEN_PERR_STATE |
>>  		FLEXCAN_QUIRK_NR_IRQ_3 | FLEXCAN_QUIRK_NR_MB_16 |
>> -		FLEXCAN_QUIRK_SUPPPORT_RX_FIFO,
>> +		FLEXCAN_QUIRK_USE_RX_MAILBOX |
>> +		FLEXCAN_QUIRK_SUPPPORT_RX_FIFO |
>> +		FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX |
>> +		FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR,
>>  };
>>
>>  static const struct flexcan_devtype_data fsl_p1010_devtype_data = {
>>
>> Bus load PC -> mcf5441x tested by
>>
>> ip link set can0 type can bitrate 1000000
>> ip link set can0 up
>> cangen can0 -g 0
>>
>> On target (mcf54415)
>> candump can0
>>
>> It works, even better then FIFO mode.
>
> What's the difference, does it produce less overruns?
>

In FIFO mode, i had a conditions where the mcf system
was stuck. Had to reboot. Not clear what's happen btw, should try to 
reproduce this.

>> While unfortunately, RTR rx does not work. Tested it by putting
>> a trace in flexcan_mailbox_read()
>>
>> 	if (reg_ctrl & FLEXCAN_MB_CNT_RTR) {
>> 		printk("%s() RX RTR frame\n", __func__);
>> 		cfd->can_id |= CAN_RTR_FLAG;
>> 	}
>>
>> on host pc i used:
>>
>> cangen can0 -R
>>
>> No sign of RTR in rx. While in FIFO mode i can see it.
>
> Ok, then I enable the mailbox support for the mcf5441x and fix the note
> that the IP core doesn't support RTR reception via mailboxes. See the
> following patch:
>
> | https://lore.kernel.org/all/20220121084425.3141218-1-mkl@pengutronix.de
>
> If you have time, please test and add your Tested-by.
>
> You can switch to mailbox mode during runtime, if the interface is down:
>
> | ethtool --set-priv-flags can0 rx-rtr off
>
> With ethtool you can query the number of used RX and TX buffers:
>
> | ethtool --show-ring can0
>
> The FIFO mode uses 6 RX buffers, while mailbox mode will probably use
> 14.
>

My mcf5441x small system does not have ethtool available
right now. Will test this as soon as i can.

> regards,
> Marc

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

      reply	other threads:[~2022-01-21 10:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06 11:18 mcf5441x: flexcan FIFO and mailbox mode (was: Re: [PATCH v5 5/5] can: flexcan: add mcf5441x support) Marc Kleine-Budde
2022-01-19  6:25 ` Angelo Dureghello
2022-01-19  6:38   ` Marc Kleine-Budde
2022-01-20 23:35     ` Angelo Dureghello
2022-01-21  8:49       ` Marc Kleine-Budde
2022-01-21 10:16         ` Angelo Dureghello [this message]

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=d67c4bbf-1c39-323-2a4-3167d6febe64@kernel-space.org \
    --to=angelo@kernel-space.org \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=qiangqing.zhang@nxp.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