From patchwork Fri Nov 29 14:25:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Costea X-Patchwork-Id: 13888730 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2079.outbound.protection.outlook.com [40.107.103.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81F6B7C6E6 for ; Fri, 29 Nov 2024 14:25:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.79 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732890360; cv=fail; b=T1e21SgJD7mQ5Enei7xsFmKthLSUsG8g5SlBzFqnGUw5sCvPwJKpsziDQ4RwgQUDOfPluvanL+EzZW28EW9XVjD1qv/so/UdXpt8WKeD6w6IF6JcuNrMGf27AZW2BfyK4rRv/6c4H1LYtGJzdHx8hWAWSTynkuFI69c/zBH+cFM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732890360; c=relaxed/simple; bh=z7sgzUHJzovVRjZcaYrA+17RJo1kqu7VsOOZWWx1Ykc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=mjN9US5JxTKJzv67zjJSXfLxKTjl2Xl4Ry4tRF3BS4ALXIW0k3eB162hSeNDwg7DqRByuyOl/B8dGMtIS+UJHIWr/bM7aUnP9BTVMJc2zC6Vwkb58VG5IqxnIT/2UA92UFCnome/3A6l33mtPkUUjIqqZWNuUCU/4yMrGbdMVyU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com; spf=pass smtp.mailfrom=oss.nxp.com; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b=VamjHE9R; arc=fail smtp.client-ip=40.107.103.79 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="VamjHE9R" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hnuE0LtkWgB6udSqm8BtLTEo7KBxoc4i/eoftL2kNMdvrYB7l9yKSG8FMv8H/pgbRiDoHRiMEyJtsJ14ETZpw6PuLLgF3PokZx62aL+jRU7h9iDxXv3PyCNs65oE0A/kl34m8hPDqhT0mhQ5YD7Njuuo2EFVwGGiBvz19HW0piTazHDvkKP4s4A8DzUch9HTsSLWN5ZDmekooetkvCJzjNIFmtWXLgfFs6Kb3nI8LPjc27lnPyANd3034zIznaOgv+sRQ3XKEYGLxupmXt+Gq9Qvt/cq/07JyZ/LYl295sx9+DE+Mc3t8u4i6JRAzaBa1LDOhjzBixUvLiB5rQ/XFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ifRbbYsxVD/S/XeUi1nthARbnHnUTln9zsV7Ng5LIrM=; b=dMuPKxFkY0VUHU8LRzXAvTdhMG5F2ROAMQQJGIcQlMIYf8EzJxJeS9iaoe62QOGJZ/CUMYUoKTMsz++CC3mkgyNfKnRN5wkcY8dNw1efUCnl7sxx8ZsPGQtfiaDV9krYklKPJcnAGpye6aDSbwtzCeeo3FxPAwuB0//oXs2T/1Ugn9/yVQ22onBIq7EuY3aXXcX6ym/gJnoXD2jdHAyRMNPh5EAxiWlscFBQeHiQcwhQa9Uy3bOK7OTYDZXMxaBfnosXypSnOwONqoeNpT/fBampgN067gEA5otdsoMhkaX9CciKskDsacjCqARtahVqNm07xRv80+0ECoilnEb1/A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ifRbbYsxVD/S/XeUi1nthARbnHnUTln9zsV7Ng5LIrM=; b=VamjHE9RWZT7H+nRAyOv5iJ8JiCnXTlhI92vipoENJGUaqQgonBT/rF7SXbttNZvnMkvHZCw9NyeeBn6uNjI3i2I+68oPeLs7nDf8nrmd5zwAvOpCsMRlRWkVNhvP+kx4YV3OHS2xHx253ol59zEjCqDnIKNhOW4ixM4+gaWeS1+jGe5rcutaQj4SFQz6XoYQQ5oaDBeze+qtrOSuKSnD7T05d5HGQ+X8LOFGG4VzqN743by3OWsuHDsfieRD5S+z7Ao9tlMLMcam3YGRwRdDkiRAnOLozTLK+aoOkzAcpG2f9ePsIfAudCCZxpKKVT3Q6XNTp2sZoyJy5Xt8aunEw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9251.eurprd04.prod.outlook.com (2603:10a6:10:352::15) by AM7PR04MB6869.eurprd04.prod.outlook.com (2603:10a6:20b:dc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.14; Fri, 29 Nov 2024 14:25:53 +0000 Received: from DU0PR04MB9251.eurprd04.prod.outlook.com ([fe80::708f:69ee:15df:6ebd]) by DU0PR04MB9251.eurprd04.prod.outlook.com ([fe80::708f:69ee:15df:6ebd%6]) with mapi id 15.20.8207.010; Fri, 29 Nov 2024 14:25:53 +0000 From: Ciprian Costea To: Marc Kleine-Budde , Vincent Mailhol , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-can@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, NXP S32 Linux , imx@lists.linux.dev, Christophe Lizzi , Alberto Ruiz , Enric Balletbo , Ciprian Marian Costea Subject: [PATCH v3 3/3] can: flexcan: add NXP S32G2/S32G3 SoC support Date: Fri, 29 Nov 2024 16:25:35 +0200 Message-ID: <20241129142535.1171249-4-ciprianmarian.costea@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241129142535.1171249-1-ciprianmarian.costea@oss.nxp.com> References: <20241129142535.1171249-1-ciprianmarian.costea@oss.nxp.com> X-ClientProxiedBy: AS4P189CA0023.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5db::11) To DU0PR04MB9251.eurprd04.prod.outlook.com (2603:10a6:10:352::15) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9251:EE_|AM7PR04MB6869:EE_ X-MS-Office365-Filtering-Correlation-Id: ff70218e-b6d8-4c2b-0a4b-08dd1081bb4a X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|366016; X-Microsoft-Antispam-Message-Info: =?utf-8?q?NiBvL6dtJc4jh8INZYNOonasheRE0mM?= =?utf-8?q?Y3oAj0SZdFt0bIrvogKkfhB6PK1pkjh8Oka0LjWydXNucDJOMaHt63c9uDCV2wyVm?= =?utf-8?q?CrmgjHRnZbcvQEc4Lmc4U3QMhBOGQIPKvR6+8taI7d0Pf8wHsvkzA0uY7U+53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?utf-8?q?WpkNAxzL1P5clQYqik5kcHGwkuwq2Uy4mQ/TEc/xKNKP6U3M3Jqt7Ka+GL+w70V23?= =?utf-8?q?v+y40HjGWIPuONGgnMClCko50xHZQPe2FOrWex6+RL0/G99nQot4EZBnsSScEu240?= =?utf-8?q?AZW8ue2M0/5L7IuQrAKSlywCw/6ySLbuhrsJAxXDPKWfgk3M+pJX9WHMCBQlQw7u5?= =?utf-8?q?jWYciEf/DH05bcfA8ndxYgG6iGI+fbXIcgPsohYcwpUtZ2Iz3/92GVOZDPgUeNBvi?= =?utf-8?q?xG75KHgMzrEfs+I+qCft2NHq1WB/YoEkJsQ=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9251.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ZDW8goUyDyeDbjgo/cKQAyj3cq32?= =?utf-8?q?BT/slb0k+FqHtqZepnjQg5BVOm4PIDti+KU+INfuS6w9U2fHpjaOOatA+UelTEeBG?= =?utf-8?q?jdeicB9Z/swjTBNObSix7YuHAuIaF8rdscDqVfZiQK/J64Y54BYA/NzXfhyipr9mc?= =?utf-8?q?htkndx7ZjRyzEeexjDM3Px95CLElWG77SYoxu5V/kYaXkf4hTfimVBXZOiJzs2tVr?= =?utf-8?q?a4ECsqlDryl2BKy5Y3y+rWmpPsxszhLtnYGvht/QVk5WsWet+XLNuqW7iqm/pDDPr?= =?utf-8?q?PNztczXg3AU/ZM1sC+1cfa5MmcTEglMJ8ehLOhZIsmt/ls97bscrz/cbT7PyvDLwB?= =?utf-8?q?LOO5IuMxI+WsLOOGS9lzh33+XHHDnJrPV+8pSRCmIroJ8vnqZM4Op1XPthWx2neVf?= =?utf-8?q?a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SeP8slYeJjHLohAJy49Cu3ioLmLkNf0QbyOwaeA3GF183N3s?= =?utf-8?q?6kPDU0dzJ8fEnJU3+aMN44mSEW4KwMo11zg6W9r1VJhxLTp1y3Zco4TnL4IaDC/u0?= =?utf-8?q?hjPxfJx79fcL/HmKAUI0uV6KprGz8BE4kDaq3rhEEV/hb8wx2aze37sBEyej73jD8?= =?utf-8?q?uu+21c8Oj0Vp2VCQ7qoWK3/knurGJXdoip/WBqwP6DmzFn2cnyN0uSMRn+b35Z/FJ?= =?utf-8?q?TNJU4cZK8s+Trfv3CXM9d9dtDhcXgyeR/Q=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ff70218e-b6d8-4c2b-0a4b-08dd1081bb4a X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9251.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2024 14:25:53.7495 (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-CrossTenant-UserPrincipalName: P0oKiq7f0JW7ON1yEKqGexpCZv1XZ3o26iI5DWTEtblZvtIq9UjiYX28hiONWCT4+IpkkxBRakbHFVTjOi6b0jO9YeqPGTY7HG36W2yWqmY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB6869 From: Ciprian Marian Costea Add device type data for S32G2/S32G3 SoC. FlexCAN module from S32G2/S32G3 is similar with i.MX SoCs, but interrupt management is different. On S32G2/S32G3 SoC, there are separate interrupts for state change, bus errors, Mailboxes 0-7 and Mailboxes 8-127 respectively. In order to handle this FlexCAN hardware particularity, first reuse the 'FLEXCAN_QUIRK_NR_IRQ_3' quirk provided by mcf5441x's irq handling support. Secondly, use the newly introduced 'FLEXCAN_QUIRK_SECONDARY_MB_IRQ' quirk which handles the case where two separate mailbox ranges are controlled by independent hardware interrupt lines. Signed-off-by: Ciprian Marian Costea --- drivers/net/can/flexcan/flexcan-core.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/net/can/flexcan/flexcan-core.c b/drivers/net/can/flexcan/flexcan-core.c index 3ae54305bf33..282297c55502 100644 --- a/drivers/net/can/flexcan/flexcan-core.c +++ b/drivers/net/can/flexcan/flexcan-core.c @@ -386,6 +386,16 @@ static const struct flexcan_devtype_data fsl_lx2160a_r1_devtype_data = { FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR, }; +static const struct flexcan_devtype_data nxp_s32g2_devtype_data = { + .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_BROKEN_PERR_STATE | + FLEXCAN_QUIRK_USE_RX_MAILBOX | FLEXCAN_QUIRK_SUPPORT_FD | + FLEXCAN_QUIRK_SUPPORT_ECC | FLEXCAN_QUIRK_NR_IRQ_3 | + FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX | + FLEXCAN_QUIRK_SUPPORT_RX_MAILBOX_RTR | + FLEXCAN_QUIRK_SECONDARY_MB_IRQ, +}; + static const struct can_bittiming_const flexcan_bittiming_const = { .name = DRV_NAME, .tseg1_min = 4, @@ -2055,6 +2065,7 @@ static const struct of_device_id flexcan_of_match[] = { { .compatible = "fsl,vf610-flexcan", .data = &fsl_vf610_devtype_data, }, { .compatible = "fsl,ls1021ar2-flexcan", .data = &fsl_ls1021a_r2_devtype_data, }, { .compatible = "fsl,lx2160ar1-flexcan", .data = &fsl_lx2160a_r1_devtype_data, }, + { .compatible = "nxp,s32g2-flexcan", .data = &nxp_s32g2_devtype_data, }, { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, flexcan_of_match);