Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3202690yba; Mon, 8 Apr 2019 13:24:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNnFqYkWSY8F+fetnf4rOeCLgs1tZVml42prWnUxYyCtApvUFyoVIFy50rfudnLaxGBfN/ X-Received: by 2002:a17:902:768c:: with SMTP id m12mr32082715pll.160.1554755045113; Mon, 08 Apr 2019 13:24:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554755045; cv=none; d=google.com; s=arc-20160816; b=W37PdlgR3cwAi0Obonp94DF1QdDay8dFJIFGsOJ/MvIqCyStIlLbf8hFPdybEqXwCR YzXC0HNvhWjRbtNWqd4G6luT5gz67gyH+cJS8GjXADlIpP0KIDkPsjFrEgi7tnWz6/fi ZwopSCf9ucTyinbkLe7zfEYPsooyWEmlfjprk2SBHdP26dT2cZoWy9o5FA32KqgiR/+Y EpY71L5xqG+ukkxMTdKKKBuJPeD25FzdKsfLBwPBgYsmpcqf41F1ASIk1iHThitKEeQo 4eSS+jCQHlusyg8rpRR+q5SxWYSaGiWp6QCv34BMIKH0sDY8zmLbdr9DAoLmwJR/KB0l Watg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:message-id :date:thread-index:thread-topic:subject:to:from:dkim-signature; bh=sbh/zzKlzWnsJKjm7NnORGJ6/vlYsNtf4rWcjHAkNd8=; b=k2IymOG4DlvIVYzcGwMIJuHKj1WhbfdO/Aal4Vbacm9dwC9kfvBR/zJJo60wGpRet0 gqiYd0DhH06EKu0qIJXdEDuOybP0jB607QiYp1PO/W64Ef2mL6oX+fphFrUoIvUMTWmf B+Hwx5s3q9JP/vceA9H6UMgbB+xYZno9x2YR5OIjhmH9oJtSSIHMZgRV8obgWY421DvD y/ic/JJP3JeLoRM4EN9/cffYJl7Fd44RDYlJ57JzGuO45F/pq+Jq2Yxj9cyhXAo/2mgu zrTMkenEuEtRHQSL6lZ9cuX8KDNGV/11zGmsq4HZiJcP3cTMI0LW856nU78qKu0Q0ehv DG2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=LZQe1ebN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si11289475plo.212.2019.04.08.13.23.50; Mon, 08 Apr 2019 13:24:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=LZQe1ebN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728546AbfDHRqH (ORCPT + 99 others); Mon, 8 Apr 2019 13:46:07 -0400 Received: from mail-eopbgr140088.outbound.protection.outlook.com ([40.107.14.88]:55876 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726373AbfDHRqG (ORCPT ); Mon, 8 Apr 2019 13:46:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sbh/zzKlzWnsJKjm7NnORGJ6/vlYsNtf4rWcjHAkNd8=; b=LZQe1ebNqU7dQfkY51HAiQgzT10AtjwYg4mCtLdlChicX7J4He5Z+anVtXACEus4hQwIWp6H+v1fX/Ms6wQ9t8dcm09tZn5admIctjikJRixKO+zF5wTWJew1omgC0iPyI1yy3RDMs5P88mV1SCWVCTlIjNGJEveEQmKqamDitY= Received: from VI1PR0402MB2863.eurprd04.prod.outlook.com (10.175.23.144) by VI1PR0402MB3901.eurprd04.prod.outlook.com (52.134.17.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1771.21; Mon, 8 Apr 2019 17:46:02 +0000 Received: from VI1PR0402MB2863.eurprd04.prod.outlook.com ([fe80::b8b3:8509:a056:360e]) by VI1PR0402MB2863.eurprd04.prod.outlook.com ([fe80::b8b3:8509:a056:360e%2]) with mapi id 15.20.1771.011; Mon, 8 Apr 2019 17:46:02 +0000 From: Stefan-gabriel Mirea To: Joakim Zhang , "linux-can@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V2 2/5] can: flexcan: add CAN FD mode support Thread-Topic: [PATCH V2 2/5] can: flexcan: add CAN FD mode support Thread-Index: AQHU7jLtjTghFqR720GjUH/3qPjtqQ== Date: Mon, 8 Apr 2019 17:46:02 +0000 Message-ID: <385f7948-d12b-1fc2-2ed2-23d1e76034a0@nxp.com> In-Reply-To: <20190319051512.14950-3-qiangqing.zhang@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VE1PR08CA0017.eurprd08.prod.outlook.com (2603:10a6:803:104::30) To VI1PR0402MB2863.eurprd04.prod.outlook.com (2603:10a6:800:b6::16) authentication-results: spf=none (sender IP is ) smtp.mailfrom=stefan-gabriel.mirea@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [212.146.100.6] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1c4a69f2-f921-4334-880b-08d6bc4a115d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600139)(711020)(4605104)(4618075)(2017052603328)(7193020);SRVR:VI1PR0402MB3901; x-ms-traffictypediagnostic: VI1PR0402MB3901: x-microsoft-antispam-prvs: x-forefront-prvs: 0001227049 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(136003)(346002)(366004)(376002)(39860400002)(54094003)(51444003)(189003)(199004)(14454004)(6436002)(97736004)(2616005)(476003)(11346002)(8676002)(6246003)(478600001)(8936002)(14444005)(26005)(102836004)(256004)(99286004)(186003)(66066001)(31686004)(7736002)(2501003)(68736007)(81156014)(81166006)(5660300002)(6512007)(6506007)(53936002)(386003)(36756003)(25786009)(305945005)(486006)(6116002)(52116002)(229853002)(2201001)(3846002)(2906002)(110136005)(106356001)(71190400001)(86362001)(31696002)(105586002)(316002)(71200400001)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB3901;H:VI1PR0402MB2863.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: ieNaCaDstvWpft2ymsMCQYuJn5Mm1IV/M2S5Io/FxeQaNh8F+VX0DRX+9zlJW8PwgOAhX8W6S/C9fmyM/7Nz5PClJtKJlLYkzuH2AGyJApT3Pb3Tkcp1oyktRY7n//hOBLNfzg9/dA8WRcymQ8ug3HQbjcSEQU6r4WhZTNiNC/ROonqCCi6TpIjM5EkaTX5c2D0G1F/VNmNQ/1QM/EvGZA7LFytfYfKzHrEt5AVj1xO0eRfcqEbqKfkqfN6o5InGE3f7beDuR+yN716iCAiuBtZNqQN/5CPqjosrPH+itgZ4Ew7H0TvfeacAH1xnjCOiQtc6P0v1f2NHb01hUdofnvesIT1d5Jfzox1y8QDIzsUsz2tZVJk+QZE8yHj39BIoYUkIiStlIACCBQjhcxl9PKEnjVRv2JT/Eax29Qp10Ns= Content-Type: text/plain; charset="Windows-1252" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c4a69f2-f921-4334-880b-08d6bc4a115d X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Apr 2019 17:46:02.7420 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3901 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 writes: > + priv->write(reg_mcr | FLEXCAN_MCR_FDEN, ®s->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 writes: > + priv->offload.is_canfd =3D 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