mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan-gabriel Mirea <stefan-gabriel.mirea@nxp.com>
To: Joakim Zhang <qiangqing.zhang@nxp.com>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 2/5] can: flexcan: add CAN FD mode support
Date: Mon, 8 Apr 2019 17:46:02 +0000	[thread overview]
Message-ID: <385f7948-d12b-1fc2-2ed2-23d1e76034a0@nxp.com> (raw)
In-Reply-To: <20190319051512.14950-3-qiangqing.zhang@nxp.com>

Hello Joakim,

I successfully validated your CAN FD support on an S32V234 based board.
Here are some points which are not very clear to me:

Joakim Zhang <qiangqing.zhang@nxp.com> writes:
> +		priv->write(reg_mcr | FLEXCAN_MCR_FDEN, &regs->mcr);

According to the S32V234 reference manual (not sure if this applies to
i.MX8QM as well), CAN_CTRL1[SMP] cannot be asserted when CAN FD is
enabled. Is it safe to configure the interface with both "fd on" and
"triple-sampling on"? If not, flexcan_open should return an error when
both CAN_CTRLMODE_FD and CAN_CTRLMODE_3_SAMPLES are set in ctrlmode.

Joakim Zhang <qiangqing.zhang@nxp.com> writes:
> +		priv->offload.is_canfd = true;

Shouldn't is_canfd be assigned false in the "else" branch? Otherwise,
is_canfd will stay true after the following sequence:

root@s32v234evb:~# ip link set can0 type can bitrate 500000 dbitrate
2000000 fd on
root@s32v234evb:~# ip link set can0 up
root@s32v234evb:~# ip link set can0 down
root@s32v234evb:~# ip link set can0 type can bitrate 500000 fd off
root@s32v234evb:~# ip link set can0 up

Moreover, I wonder if we even need is_canfd, because frames should be
fed to the kernel as classic or FD based only on the EDL bit in the C/S
word of the Rx MB, to keep their original format. That is, you may
either read EDL from within a new callback (but I think that
mailbox_read should remain the only one which both locks and unlocks the
mailboxes) or let mailbox_read call alloc_can(fd)_skb itself.

Regards,
Stefan

  reply	other threads:[~2019-04-08 17:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19  5:17 [PATCH V2 0/5] can: flexcan: add CAN FD support on i.MX8QM Joakim Zhang
2019-03-19  5:17 ` [PATCH V2 1/5] can: rx-offload: add CANFD support based on offload Joakim Zhang
2019-03-19  5:17 ` [PATCH V2 2/5] can: flexcan: add CAN FD mode support Joakim Zhang
2019-04-08 17:46   ` Stefan-gabriel Mirea [this message]
2019-04-09  2:07     ` Joakim Zhang
2019-04-09  7:04       ` Stefan-gabriel Mirea
2019-04-09  7:36         ` Joakim Zhang
2019-03-19  5:17 ` [PATCH V2 3/5] can: flexcan: add CANFD BRS support and improve bittiming setting Joakim Zhang
2019-03-19  5:17 ` [PATCH V2 4/5] can: flexcan: add ISO CAN FD feature support Joakim Zhang
2019-03-19  5:17 ` [PATCH V2 5/5] can: flexcan: add imx8qm support Joakim Zhang
2019-04-04  2:11 ` [PATCH V2 0/5] can: flexcan: add CAN FD support on i.MX8QM Joakim Zhang

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=385f7948-d12b-1fc2-2ed2-23d1e76034a0@nxp.com \
    --to=stefan-gabriel.mirea@nxp.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®