All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Angelo Dureghello <angelo@kernel-space.org>
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: Wed, 19 Jan 2022 07:38:37 +0100	[thread overview]
Message-ID: <20220119063837.idsiq72xrv4fvtih@pengutronix.de> (raw)
In-Reply-To: <1cf937d1-1e26-e611-c85f-f9e2128c225@kernel-space.org>

[-- Attachment #1: Type: text/plain, Size: 2910 bytes --]

On 19.01.2022 07:25:21, Angelo Dureghello wrote:
> > we're currently discussing the option that the user of a flexcan can
> > switch between RX-FIFO and RX via mailboxes.
> > 
> > I noticed that the mcf5441x currently is configured for FIFO mode. Have
> > you tested the driver in mailbox mode?
> > 
> > The reason that some cores use the FIFO mode is, that they cannot
> > receive RTR CAN frames in mailbox mode. According to the IP core
> > overview table, the mcf5441x can receive RTR frames.
> > 
> > If the IP core supports reception of RTR frames, mailbox mode should be
> > used, as it makes use of more buffers (16-2) instead of 6 in FIFO mode.
> > Should we activate mailbox mode for the mcf5441x?
> 
> Ok, not sure why i selected FIFO mode initially, my application
> actually is quite simple. Will try the switch to mailbox, sure,
> looking into this.

Thanks for coming back to me. The mailbox mode performs better under
heavy load, as you have more buffers available. 

If you're using a recent kernel, the flexcan driver has been moved to:
| drivers/net/can/flexcan/flexcan-core.c

diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c
index 0bff1884d5cc..aa0b7efb5ca6 100644
--- a/drivers/net/can/flexcan/flexcan-core.c
+++ b/drivers/net/can/flexcan/flexcan-core.c
@@ -296,7 +296,8 @@ 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_SUPPPORT_RX_MAILBOX |
+               FLEXCAN_QUIRK_SUPPPORT_RX_MAILBOX_RTR,
 };

On older kernel with drivers/net/can/flexcan.c you need:

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 7734229aa078..538b26619460 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -382,7 +382,8 @@ struct flexcan_priv {
 
 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_NR_IRQ_3 | FLEXCAN_QUIRK_NR_MB_16 |
+               FLEXCAN_QUIRK_USE_OFF_TIMESTAMP,
 };
 
 static const struct flexcan_devtype_data fsl_p1010_devtype_data = {

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.

regards,
Marc

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

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

  reply	other threads:[~2022-01-19  6:38 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 [this message]
2022-01-20 23:35     ` Angelo Dureghello
2022-01-21  8:49       ` Marc Kleine-Budde
2022-01-21 10:16         ` Angelo Dureghello

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=20220119063837.idsiq72xrv4fvtih@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.