From patchwork Wed Dec 4 07:49:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ciprian Costea X-Patchwork-Id: 13893362 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2067.outbound.protection.outlook.com [40.107.105.67]) (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 4E1631F6680 for ; Wed, 4 Dec 2024 07:49:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.105.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298575; cv=fail; b=rWuO7hdFqkBV1dPAXON7d0RLw+JAVCiecGN+JcJaI1CqfxcQQyo8RfUuSuO7ZIkplI2PtniBAGivLiwJ4TDPMpOTC83Qs1pQ1LROcLDxcPPEU9UhHXQxQBpNKCPXOjG4+zazLM+L5Cv+bhtZqvdmVxIxeQZ+7VQ/nNhfrr5PSSI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733298575; c=relaxed/simple; bh=z7sgzUHJzovVRjZcaYrA+17RJo1kqu7VsOOZWWx1Ykc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=eQdmt9QIq/2pe/8V7XB0pfgnWEHvdmlQ5e8NdPAs1ZUSyfpx8Vnt1SH6RIU9A+tzxhhEDxIz4xYT1IziHWQuprIVpkhWanpxrZxUcuIjHE+Y4n39YGCK/GtxoGET0685dy7OLnJK8HP5MgYHcuyZMdwUsDZEo3h+MdkP6qLLFWA= 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=W1y3dDai; arc=fail smtp.client-ip=40.107.105.67 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="W1y3dDai" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Jox82fmJI7F03/3mMk5Io75FUPGweCBUU0xct2fNOMQyduRjQD5djsFI/Q6vLQSO9pbAkYGd+HeCJ8jr3v8WHYEUP7h0rI9CLRJac5BhyH+D5l2H2XFa6YF/oMsQrbGvhvCw1MbQc4NM5CBkbWfXot0kSq8wET3jf8hUu2H/fNs8dkcnnn0xqGygfgpl63oDZOhdp9viprVTMKsSnkX6r9J9gs0/fsnMdozQoHFTW40q93jK3D11Da8Mw3MywN9RpyVqtb2OPO6yn0pZHMajtv4ZkzWSnpKhpMURUZSq20tea1o8AVsb99iPx+ZqaIIkD/Ttkdd8nEN+AP8KzubHwA== 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=ZkN/xoxSTUbB0hxYm7negwS6wSMQdj4t9GLlTpKMWEUQxLvrhn3tvpDlo/sAHPFORhcjH060TX06hpG5QUInXygTh6/NKmVSxsossl6LRc8XrjHhg3PMNxmB3Qcsb1wwcHfxuiX1+IieX3aHuPKF38FRjlakSpH7QYVUBoMR6dUne368BwkqEBQhnxNYWH6zAkAZhq08aBofYaDcUSczfXzvNOjocHOD51XmXQxgMq/7pZvZSMhULLBJ2j7wMwEZGRSX2FDdL5IE19klPaO6ttHX02gk0GNnm+jXJGf+Ak2OI8Emq1VkSVXncQNBDRTX338Nx6tO0ziGULhdtBLmqQ== 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=W1y3dDaiLl7OdsqVmGDtYTTtbGq/1PoMyYcivY/vurQ5jZUbK03Bspsia0dWE+TRehLIhToG0QFFI3+47C+jA5aOsTCdjrZQ+40cNnTYD+/R96iWHezcjDPgABy1lBQitRooMaqburPBMtUM/txJaaX4D9zC7x0uGIP6Yvz9Ym3elauMGwRQaI/2Vutd/LsrtMTK8QU2Gsqf5iEnxlS3GYKQNoVChsH1O+QayvqC3XQmQnXM/W+pQmrY4PE+8NT9moDM2WzC0cTj4byGyFyRp7wDVv609+5odM/yT6HhxMZb5vqZTckIqifNAoBhoVPASYPu+jy6RNef1XgiewwmMw== 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 PA1PR04MB10769.eurprd04.prod.outlook.com (2603:10a6:102:488::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.19; Wed, 4 Dec 2024 07:49:25 +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.017; Wed, 4 Dec 2024 07:49:25 +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 v4 3/3] can: flexcan: add NXP S32G2/S32G3 SoC support Date: Wed, 4 Dec 2024 09:49:15 +0200 Message-ID: <20241204074916.880466-4-ciprianmarian.costea@oss.nxp.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241204074916.880466-1-ciprianmarian.costea@oss.nxp.com> References: <20241204074916.880466-1-ciprianmarian.costea@oss.nxp.com> X-ClientProxiedBy: AS4P191CA0005.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:5d5::15) 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_|PA1PR04MB10769:EE_ X-MS-Office365-Filtering-Correlation-Id: 71b6ed5c-30d9-4e60-1b70-08dd14382c79 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|366016|376014|7416014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?q?OarLXlq20s3ceyYD2Wv0BH1WtbfXctD?= =?utf-8?q?GGY2vlkWi07AY/c7HYWR64ZaGWfk8fBR87XYnLKwMzxBqz9N0PH+unEhts6Yd5gFO?= =?utf-8?q?1JYTh4d6ASHZT9H/P/hvAEPSBGkaGrccChh53789IRtFvB7sPQU+UGstoqQujRNo4?= =?utf-8?q?Vezj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uir87IWzzEgp5HHp2Jf+xpxLIjl26Eo7GXNIvNlS0K91rQgjke4TTiKdkE8q3z?= =?utf-8?q?jC5c+H9/5BDzkou70x8G8Lw8YXHbSKNFppB48KUwHTwQ025KA+W4VV/iXgExC4g07?= =?utf-8?q?TtIu6YpNIC0Hptez/65A79eN2+6ocTKyUj08rJbIVz1DXi2w7HH3SZ8UyUdzCb67g?= =?utf-8?q?2V2zhUwx0HZXDXTmGGKgPFOgFIzbtk7Ym6cmu0b6xyKKx+i+epyT27xhl93Xs+QbE?= =?utf-8?q?KO4HFPVKW+Hn1Xlv42N9ctsjqZM32wljAAQ=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)(366016)(376014)(7416014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?nRt+qflfedjV9MlMjcyukFmN6zAh?= =?utf-8?q?vJg+8L6CpJ2VzyTnvJ4E+9BUN76XGy+ssYSE4Q+FQ5bjOqmVOleR1WMG+ScN946YH?= =?utf-8?q?lew0fcEUwsnuR0w8Ds44kNtwcBYK7IyBmAPzJpDlFkBOq8p7NtDp6uVV3+KqJK10I?= =?utf-8?q?0OUXc++kSVs7ANsMJaz4opatQBn1T/1YKpnCVFx4yirKhfLR7tubnz80dgJm3w6Ik?= =?utf-8?q?wZIqiTPXD5D4ScvbbVzR7+f3nCnLwUatJZcgPwiMKUp9imN6if3fH57q5I7uYR7qi?= =?utf-8?q?crP2+uQbxnGbz8jUyEIfxypu6KiB9tQhXTlv5xW1BMZ1bl6lyNiazsIw4s9jx0gjZ?= =?utf-8?q?IBz++RX36Wos78Q9fm01vRH6MhYj1Xn/FkSFVnO1fCfZ8mZIhaXazxJ/J9rRoEbmz?= =?utf-8?q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Ixh6XvR4Az2xop9PoQUzijQhNFzSR4d7S9sMCW/MHhs/DoQm9vjeiTLp0y?= =?utf-8?q?yCZX0NjJEHE/grFNZYfMegwk34yHd80q6z332wYOa93IW+B0pmKmv3+TJc1PsSiII?= =?utf-8?q?KunTwCp0+WgylITegwbs9tmOX2nL02Xy5fM8+5xcjrCtU9zmVOmxzmOvrQ6fGX3oG?= =?utf-8?q?TfC5MomLvhq1s07gDOk6XyskY654zeZV4LgBPS2TCARdmYKjeo+ZZE4OjDzB2Nk8P?= =?utf-8?q?HPzJ7ZSJioy5uWB333tjkK47q9W84EHiaQ=3D=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71b6ed5c-30d9-4e60-1b70-08dd14382c79 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9251.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2024 07:49:25.4905 (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: AKS6x5FgqJy1+YNMf08NF51oqBJhCybBoWtudXYZUhZc+jy/rM18LgWuldh2qvdoJcd96e2Mair9KShlqd/qum/NQzlYSnjmOmeyHTwpnWg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA1PR04MB10769 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);