From patchwork Mon Sep 28 18:02:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 260037 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9AE8C2D0A8 for ; Mon, 28 Sep 2020 10:03:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B1D120773 for ; Mon, 28 Sep 2020 10:03:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="bIQs019o" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726621AbgI1KDD (ORCPT ); Mon, 28 Sep 2020 06:03:03 -0400 Received: from mail-eopbgr50054.outbound.protection.outlook.com ([40.107.5.54]:20046 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726566AbgI1KDC (ORCPT ); Mon, 28 Sep 2020 06:03:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fDes9E0UgKtk8kYANW4dFpsf255L6nFQNW/699FoDlHoB+guD/ZUlHNpIkRT/i6guZFF6VBtUuUKmpn2RtNvrAZerU9yvr0HgqX9G+mBsew5ZRHBbUWKW0u++Mrs8Ts6/DGCjQdVSWK182f0dq5qLTyCSyRR2LFDaPgATeRlr39OfGiMElpesrSgI2z5YSPc2xTyJFCj/8AtWhKwtwBMIE/2VCCjnlu2arDrehbSibEzlhSmqC2F7cZ9/MNwopDmurwbWL92gjo+v6ROZOPrZST2e0XMGyxoMdboWsrwhxFBT0f1460Gn/L4N4IPKSj5k5rnRnREmnM744pMbWm0ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2dCP3tAifiRxz3f8ii2379t+5xtF/4K+kZmSGk8TtS8=; b=iDzozL9nXkcRDMgUPDK0jXI48FRI3h1rpOJvVcgvkqZAn0j0eNeAoegq3un6DeqvlsBGQjpkaXiy5RihvAZh4Ev/jmStzw6mCzcFPJQZ3Dn7eaw/t3tI6KjNucVEjNdq/50K6Mk7cu6c9jrwAYSEDsFFWtGLbpteDgoQSL5/6QJQBlTp43g2SOz34O3Kh9Sk8yDzB+AuvKpRt3EfdfvWbuopycpJhYsYZYHX0pyehFxTCnaCmAk/WX8r4Lu0wWRMB8Pgxs1DoU6wzftyeQf9vSBmdx4vdoMWk6eVyw5zqzSK7x73IsoUUot+8op2AHvqheyxquB/IQixWuOY28pQcA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2dCP3tAifiRxz3f8ii2379t+5xtF/4K+kZmSGk8TtS8=; b=bIQs019owDO6ndJxSG/v/wrvQ3PLRNZie5tsPOQVKxz4Dj+Wg33JiEug/4aFCBS+M+9FQ+sOuGlfdvenSJNRW1csy7p8dMlSL3hfePrhWnpIXum9DI/LEPYyCflzP4S+4UeB+czsncx+Gp+k5wcZj2dhbU5viry5eU9th9FdaTQ= Authentication-Results: pengutronix.de; dkim=none (message not signed) header.d=none; pengutronix.de; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB3PR0402MB3769.eurprd04.prod.outlook.com (2603:10a6:8:f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Mon, 28 Sep 2020 10:02:58 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::d12e:689a:169:fd68]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::d12e:689a:169:fd68%8]) with mapi id 15.20.3412.029; Mon, 28 Sep 2020 10:02:58 +0000 From: Joakim Zhang To: mkl@pengutronix.de, linux-can@vger.kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V3 1/3] can: flexcan: initialize all flexcan memory for ECC function Date: Tue, 29 Sep 2020 02:02:51 +0800 Message-Id: <20200928180253.1454-2-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200928180253.1454-1-qiangqing.zhang@nxp.com> References: <20200928180253.1454-1-qiangqing.zhang@nxp.com> X-ClientProxiedBy: SGAP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::29) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SGAP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Mon, 28 Sep 2020 10:02:57 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1ec75227-4ca2-41cc-6d94-08d86395ad7b X-MS-TrafficTypeDiagnostic: DB3PR0402MB3769: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OtkZpe8so6HlzuLugsvBEFRIuXX0h3nDkcIc9sd6d6CcLYNsw9lEwRUDpWP8mF8aovdBqSM3+DB4S/8+eCXgASeo4FjJEXIOuUOUQ+kzGpXlWAPwCiYsLl3PBFnyu7FyLPF2bES6ee+fi99/m+I1rkXHEfvwM3ssb9u9kAfqejgXat04mxhwLPh0ANknhCH37UU2mRlVNYehrRovathqzF3CC7rg1Mf4Jdo9GLDekoWM9KOEA7rZgWYLlr1UlvkYAj4z5w8XwAL2QgnYPeBRYREJj7W04HSP9M+uJl45WoXXtyFOodkawncRaMh2HSOOwyqALEilpz//ch37C7TZG5vqb9qyic8sPMOs+euej8SrlgF4/xzTCkornWQQMF5jO8rBR8i87bdNsA21dxn5zOUetwxBX7esY48GoqPZ9c2RQc3UR5ouzfj4YnLrJquW X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(346002)(376002)(39860400002)(396003)(6506007)(52116002)(2906002)(478600001)(956004)(2616005)(186003)(16526019)(5660300002)(66556008)(6512007)(66476007)(4326008)(316002)(8676002)(83380400001)(8936002)(66946007)(86362001)(36756003)(26005)(69590400008)(6666004)(6486002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: e6RMz5HDon+HIxYrYh8BZhDRmh1krxUzEQ4k/xM2NYEw72Dga4eMSqtzgkNju2nAQ6CGU/88z3yOajAybMCeqBHufByQBfRt6i9ZX9bBiHa8bu717eAtXVdC0qwk8wiysWHAbj5cfj6gyWjCnq3izxTokg9rCJUEDxgG/5MyPkClju4DB+dHHXag684Cx+Jv/ls/QZOLn0GoX8/5GKAHWODJaEjOUVO0VZDembebfGpAs0RpgxCTyvTuzS6lP+b9BoWYzJ882UFZgmM8Sr/krMa9rR57TrnTPLLR4c4pmzF9FQjkX9VAo9f/IKoXGgq4SA8kkuh47sBEpDJRlo/bwaY9bVx6oZ+AFAkr0YRgwQVoDzNfdIBM/9lk2KATfNN7Ef5IGW4W5FmsoMVI33Tka3Po8Poj7EYa5VvBhwI3wWMYRbc56Udhd0O4N5MPspZGkUUUskKQxJ60Cdixhsc889THSMf8dowXjV649+aaEyUzt4vkkLymEdsphaO7Jm34xe74nbZ1Yr+JU9nChbmG0E9a5oCYT61Hmre4id32cA20qI7FaQ+K5Ose4JFCIPKkDvm+bwSG+XKw034J6ZcCPm816PgmngnPncG6JT8uMJdd1KdprYInQhYl+Hkf9AdFDRa9Q0mC25chHHo8M/LyIA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ec75227-4ca2-41cc-6d94-08d86395ad7b X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2020 10:02:58.6939 (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: KjooA7ErDGi6zXMXXfgWaMtinffo+nTfCEDwaZeXZ2h6NCzbIaYcfKjHSMQJauiQU0stCyXYqXlpnaCo+ivjGw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3769 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org One issue was reported at a baremetal environment, which is used for FPGA verification. "The first transfer will fail for extended ID format(for both 2.0B and FD format), following frames can be transmitted and received successfully for extended format, and standard format don't have this issue. This issue occurred randomly with high possiblity, when it occurs, the transmitter will detect a BIT1 error, the receiver a CRC error. According to the spec, a non-correctable error may cause this transfer failure." With FLEXCAN_QUIRK_DISABLE_MECR quirk, it supports correctable errors, disable non-correctable errors interrupt and freeze mode. Platform has ECC hardware support, but select this quirk, this issue may not come to light. Initialize all FlexCAN memory before accessing them, at least it can avoid non-correctable errors detected due to memory uninitialized. The internal region can't be initialized when the hardware doesn't support ECC. According to IMX8MPRM, Rev.C, 04/2020. There is a NOTE at the section 11.8.3.13 Detection and correction of memory errors: "All FlexCAN memory must be initialized before starting its operation in order to have the parity bits in memory properly updated. CTRL2[WRMFRZ] grants write access to all memory positions that require initialization, ranging from 0x080 to 0xADF and from 0xF28 to 0xFFF when the CAN FD feature is enabled. The RXMGMASK, RX14MASK, RX15MASK, and RXFGMASK registers need to be initialized as well. MCR[RFEN] must not be set during memory initialization." Memory range from 0x080 to 0xADF, there are reserved memory (unimplemented by hardware, e.g. only configure 64 MBs), these memory can be initialized or not. In this patch, initialize all flexcan memory which includes reserved memory. In this patch, create FLEXCAN_QUIRK_SUPPORT_ECC for platforms which has ECC feature. If you have a ECC platform in your hand, please select this qurik to initialize all flexcan memory firstly, then you can select FLEXCAN_QUIRK_DISABLE_MECR to only enable correctable errors. Signed-off-by: Joakim Zhang --- ChangeLogs: V1->V2: * update commit messages, add a datasheet reference. * initialize block memory instead of trivial memory. * inilialize reserved memory. V2->V3: * add FLEXCAN_QUIRK_SUPPORT_ECC quirk. * remove init_ram struct. --- drivers/net/can/flexcan.c | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index e86925134009..0ae7436ee6ef 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -239,6 +239,8 @@ #define FLEXCAN_QUIRK_SETUP_STOP_MODE BIT(8) /* Support CAN-FD mode */ #define FLEXCAN_QUIRK_SUPPORT_FD BIT(9) +/* support memory detection and correction */ +#define FLEXCAN_QUIRK_SUPPORT_ECC BIT(10) /* Structure of the message buffer */ struct flexcan_mb { @@ -1292,6 +1294,51 @@ static void flexcan_set_bittiming(struct net_device *dev) return flexcan_set_bittiming_ctrl(dev); } +static void flexcan_init_ram(struct net_device *dev) +{ + struct flexcan_priv *priv = netdev_priv(dev); + struct flexcan_regs __iomem *regs = priv->regs; + u32 reg_ctrl2; + + /* 11.8.3.13 Detection and correction of memory errors: + * CTRL2[WRMFRZ] grants write access to all memory positions that + * require initialization, ranging from 0x080 to 0xADF and + * from 0xF28 to 0xFFF when the CAN FD feature is enabled. + * The RXMGMASK, RX14MASK, RX15MASK, and RXFGMASK registers need to + * be initialized as well. MCR[RFEN] must not be set during memory + * initialization. + */ + reg_ctrl2 = priv->read(®s->ctrl2); + reg_ctrl2 |= FLEXCAN_CTRL2_WRMFRZ; + priv->write(reg_ctrl2, ®s->ctrl2); + + /* ranging from 0x0080 to 0x0ADF, ram details as below list: + * 0x0080--0x087F: 128 MBs + * 0x0880--0x0A7F: 128 RXIMRs + * 0x0A80--0x0A97: 6 RXFIRs + * 0x0A98--0x0A9F: Reserved + * 0x0AA0--0x0AA3: RXMGMASK + * 0x0AA4--0x0AA7: RXFGMASK + * 0x0AA8--0x0AAB: RX14MASK + * 0x0AAC--0x0AAF: RX15MASK + * 0x0AB0--0x0ABF: TX_SMB + * 0x0AC0--0x0ACF: RX_SMB0 + * 0x0AD0--0x0ADF: RX_SMB1 + */ + memset_io((void __iomem *)regs + 0x80, 0, 0xadf - 0x80 + 1); + + /* ranging from 0x0F28 to 0x0FFF when CAN FD feature is enabled, + * ram details as below list: + * 0x0F28--0x0F6F: TX_SMB_FD + * 0x0F70--0x0FB7: RX_SMB0_FD + * 0x0FB8--0x0FFF: RX_SMB0_FD + */ + memset_io((void __iomem *)regs + 0xf28, 0, 0xfff - 0xf28 + 1); + + reg_ctrl2 &= ~FLEXCAN_CTRL2_WRMFRZ; + priv->write(reg_ctrl2, ®s->ctrl2); +} + /* flexcan_chip_start * * this functions is entered with clocks enabled @@ -1316,6 +1363,9 @@ static int flexcan_chip_start(struct net_device *dev) if (err) goto out_chip_disable; + if (priv->devtype_data->quirks & FLEXCAN_QUIRK_SUPPORT_ECC) + flexcan_init_ram(dev); + flexcan_set_bittiming(dev); /* MCR From patchwork Mon Sep 28 18:02:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 289495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DD51C4727F for ; Mon, 28 Sep 2020 10:03:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 037AB20BED for ; Mon, 28 Sep 2020 10:03:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cEIP7YyN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726638AbgI1KDI (ORCPT ); Mon, 28 Sep 2020 06:03:08 -0400 Received: from mail-eopbgr50054.outbound.protection.outlook.com ([40.107.5.54]:20046 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726328AbgI1KDF (ORCPT ); Mon, 28 Sep 2020 06:03:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZOCtY45FCDEGfBLb52jdhH5x9UmRD1lVNOccPImAoS0g58lIGkssKeNbFkFrBJW5raCTwMWXMcjGG5nEDn62J9Sv7sFdGgx+kyD2Z1YLJnUTFTbyioW7+Zs9mMXy8u8uVN3hcx0tvK9oQ/guoUo/EPEEUhygTe2yjUBwrRUQE7/66BdrzC8cd2P6j9t2RaG2vS1lH9NkRW3DUcYKJP2/sVQJ/RGOlC3VrPBnrVTM5O6ZwDsBjELx+GLvU0OYj5QzKuX3oDs5vPlR+kjDSbfccpMqS9C3+VkT3lKNsTk+yuodaMO/ubcLn+GfxMrcbSeir57VLgu5qG5de0dhS5VZIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RPF2fiNntz7y4HFb68prKvpXcho+Ba/VjqcokuOBnbQ=; b=fJydyLhgl33MLAlMXW7TWxA2cmg+eGvSjUOAECv8zIAUY7bRyGC2HaVK0GlVp6Kk43EGS9APRweFNnoWjqHzEW3UtyCuNQQ+kKlwXpMrioYp5lOqKfZLDx6Dg8J0s2xYi7gMxzqewUl9JGVWUe7vVZNsFYH5/T/Qmbf4AE32LF5FzGv/IUP+voYDLzSS1u22bxe7vgWPMtj9OYC2ToBgOtiZzXrjn45x+pLisTCLszE6MB8oc1B/uvCivv9Qrh30DetK9rnqx8bL9rIRFSi2jCuJBUA+T3hesUrEpD1SJC9XdO4jeha73pWXzUvAAFWa8u1lb71VPRVQpppf8SW7jQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RPF2fiNntz7y4HFb68prKvpXcho+Ba/VjqcokuOBnbQ=; b=cEIP7YyNh57y23bOOqdUsDr75hVJYjSIgRbSxbVxgMZCA4HuCavrpSFH76Vi+g+4pHMe/j9rwYsNZ1l0dcNNbcbL/DGv4Y0vEXgocoEI+4nxB2H7Din7j3tMV+qdlzcqz8SQJjzjfrK07y8kYIehs3TZU99MpoPkD+gEDmcTuvg= Authentication-Results: pengutronix.de; dkim=none (message not signed) header.d=none; pengutronix.de; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB3PR0402MB3769.eurprd04.prod.outlook.com (2603:10a6:8:f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Mon, 28 Sep 2020 10:03:00 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::d12e:689a:169:fd68]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::d12e:689a:169:fd68%8]) with mapi id 15.20.3412.029; Mon, 28 Sep 2020 10:03:00 +0000 From: Joakim Zhang To: mkl@pengutronix.de, linux-can@vger.kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V3 2/3] can: flexcan: add flexcan driver for i.MX8MP Date: Tue, 29 Sep 2020 02:02:52 +0800 Message-Id: <20200928180253.1454-3-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200928180253.1454-1-qiangqing.zhang@nxp.com> References: <20200928180253.1454-1-qiangqing.zhang@nxp.com> X-ClientProxiedBy: SGAP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::29) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SGAP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Mon, 28 Sep 2020 10:02:59 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0da83f4a-4fd4-4387-4ead-08d86395aeae X-MS-TrafficTypeDiagnostic: DB3PR0402MB3769: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1122; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Ymxef283Gg/XgWkaCInUMWGIS+V5dXITRsgyNuaFPC4bGSr3Tz4SZ4Gw56qVdMLM2fAG1L4gBEGpLBoh6uUUaoaPgcBaMY6iB22gPlJ0vfBmmZWm/zl7LcFrmaBHIX023ZVEgQamZmT8XfmAhH18ysfWYt11SKkWdjT4ijyWcM0MH8JCqRdjNOtnpiC145fsT6G2KXS0QJkbAh0VAYgvbShXx84A8r8P55MOk+i18zLI+4MV5iyhpaLslplnPu4wgPwfi7uNrbOq/SxQr98l+U2D2C+71CwU3qTN2D4ShjrgBMlFwTeaCD3G/xFLl47oFQGGo+nhAcmgR5nwBNrO6D6FwVh62CbCFqjOLJZI1AS3DXsaOtxNwDrsngj94kzUGN8/k2LrjMtDvIA01aiHuRCEoasxxE3qzhoJcys7Om5BpFy59fCL9WguXCAE/pF X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(346002)(376002)(39860400002)(396003)(6506007)(52116002)(2906002)(478600001)(956004)(2616005)(186003)(16526019)(5660300002)(66556008)(6512007)(66476007)(4326008)(316002)(8676002)(83380400001)(8936002)(66946007)(86362001)(36756003)(26005)(69590400008)(6666004)(6486002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: +VBSfrewP6WrxJZDFKcfZ/IkfL1xBs8ERWmWi9Xj3Xo+BorFGynk6FVZnSQZhkUT66SeaHoZa8JIRE5pC2uONGnQesKxgb0D3FS84qvOWW8FaP7tIiQObP9KhISiV3RSifgnbNVOhvbJp9boBDkGH0HRziYaFCWinYX5uH8mLkRSIm9kbIhmy8JWx2HUw81ommAgpRJOl9JTP46mD5hDAcHIEibwySjpaaZ2yBcXJ9qGCy7VuQ+d8hUiKton5x1AoByEnXMKF8ajY0xKKTAFhkwTMzKwa6bwCCNInaRoGcwfupSIAqWAHeaL1IkJHnjWDoHcRZOIW6qidBML6TNAPa8qvvZNmCytzWUNUeHzjRTtQhj0kimPOYptH7mtU3pTEurVOVDZ8WuLdhAVTaubrO5jrB4XaS3GOQsCcgltRaaOrStDZ8Wnv4y4aL4iZVX+PC/piB3GajMrkmGVfHCv+iAcSHjRQXBqhIfm8ecxRVePbs7g/8R46o+/bW9kPeBlwRoAHz6pVZkHgQe/uflem8wR+eCJvcrl1/Ae6X31VxEWi4TowPZy4UEs7um1pRWl2FxejgJI24mdGc7V6tNmtIDu39XBEUtb0M2sUIzq4FYgQV/uM6oRqtYUdcwPWsnDQfzvQ7ISL+ie3M72n5R0Ug== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0da83f4a-4fd4-4387-4ead-08d86395aeae X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2020 10:03:00.7170 (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: Maa6TkF+vZPM+IquXNpjtGaYHj0VBxNYEsey5KNenmxH7UrhwzSUVFo/r5rBt6KbBqqUWLrX7+fSITS+5CX1KA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3769 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add flexcan driver for i.MX8MP, which supports CAN FD and ECC. Signed-off-by: Joakim Zhang --- ChangeLogs: V1->V2: * sort the order of the quirks by their value. V2->V3: * add FLEXCAN_QUIRK_SUPPORT_ECC for i.MX8MP. --- drivers/net/can/flexcan.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 0ae7436ee6ef..925efc986b6b 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -214,6 +214,7 @@ * MX53 FlexCAN2 03.00.00.00 yes no no no no no * MX6s FlexCAN3 10.00.12.00 yes yes no no yes no * MX8QM FlexCAN3 03.00.23.00 yes yes no no yes yes + * MX8MP FlexCAN3 03.00.17.01 yes yes no yes yes yes * VF610 FlexCAN3 ? no yes no yes yes? no * LS1021A FlexCAN2 03.00.04.00 no yes no no yes no * LX2160A FlexCAN3 03.00.23.00 no yes no no yes yes @@ -378,6 +379,13 @@ static const struct flexcan_devtype_data fsl_imx8qm_devtype_data = { FLEXCAN_QUIRK_SUPPORT_FD, }; +static struct flexcan_devtype_data fsl_imx8mp_devtype_data = { + .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | + FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | + FLEXCAN_QUIRK_BROKEN_PERR_STATE | FLEXCAN_QUIRK_SETUP_STOP_MODE | + FLEXCAN_QUIRK_SUPPORT_FD | FLEXCAN_QUIRK_SUPPORT_ECC, +}; + static const struct flexcan_devtype_data fsl_vf610_devtype_data = { .quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS | FLEXCAN_QUIRK_DISABLE_MECR | FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | @@ -1895,6 +1903,7 @@ static int flexcan_setup_stop_mode(struct platform_device *pdev) static const struct of_device_id flexcan_of_match[] = { { .compatible = "fsl,imx8qm-flexcan", .data = &fsl_imx8qm_devtype_data, }, + { .compatible = "fsl,imx8mp-flexcan", .data = &fsl_imx8mp_devtype_data, }, { .compatible = "fsl,imx6q-flexcan", .data = &fsl_imx6q_devtype_data, }, { .compatible = "fsl,imx28-flexcan", .data = &fsl_imx28_devtype_data, }, { .compatible = "fsl,imx53-flexcan", .data = &fsl_imx25_devtype_data, }, From patchwork Mon Sep 28 18:02:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Zhang X-Patchwork-Id: 260036 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.0 required=3.0 tests=BAYES_00, DATE_IN_FUTURE_06_12,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CF05C4741F for ; Mon, 28 Sep 2020 10:03:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BD3B20773 for ; Mon, 28 Sep 2020 10:03:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="XbcyGoVb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726656AbgI1KDL (ORCPT ); Mon, 28 Sep 2020 06:03:11 -0400 Received: from mail-eopbgr50054.outbound.protection.outlook.com ([40.107.5.54]:20046 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726566AbgI1KDK (ORCPT ); Mon, 28 Sep 2020 06:03:10 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZCmHXGQTRRrsmISzZtAwrlsyWpdAc0w2INcr3+kosZyg4s8n0FqhSXjp5yX63ROypy0hNYuEeQlh+uToEk8QoyEzSWBQa5iAR/S7Z2hv0k1ql1XXvmIP8k28p5p+WGEjXkBrh3CtzvHizkEhJIBxobJbgVYbkp9G1kHBoL+1rzavb8s1VmscdAsKLqdIrSVrZNlKJOCFTHprMa2Kj9ydIs0nsFek2W1AY3VnKA6NW1KuARG71+mpZl7OpVxJpUVA+iP0zErGDGKJWPosq6LAwRO67yxx/WgiKKO+wKj4ur9dxq6ScMMqjutOddCMMtQRvJcW+9meadlYM20hsd/Emw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=voz73Kao5sfdCWENEH/Zme/ZX//wNmXgmMelYmmqA50=; b=CCYPk1S4HaspX2attr1yGXPhqQ4OHzeA1V4z9Kfw7xCsoUmXdEvuUdBSK5o3b4rgxQXwLTpg9dF9IOnCOBdEAf6orWRi0Zyt+eo9Z8Lzmfh7/lSVBH8kh8iP1cMtt81ajBjVT8o62wXOcDVEyF2+AXMKZmat2rYhyRBz+T0d30fmcsqyVm9aSlFlKPWfGCbzLV6Yk+uwUIpMjAf27jKhoqXnGqib+r8YlqEMcFVuLi+nPKg1ifh2GhYAPPJqgjfUjsHd/0WnGwZuzKjf0UxVRHbCFsCvAfqomZhgCp6Z8adfTKJGDyvHVlcge6tt2LJh/JLt1s+qNkn1OkLES5XSVw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=voz73Kao5sfdCWENEH/Zme/ZX//wNmXgmMelYmmqA50=; b=XbcyGoVbnx4/+z28MPmFPoG3mWzaKit8cepbml5ohgnwh+MY1g7qH4Fu6deuyh7S4d4vA7aAFq2D7hydrVerc+unDdeLib7lumwF7RvdoduPBYb89FZ9JBrsFtuMOQNmEjHdzmkaGEtoWVyT0n9a242jnPUl6mMQWQmI8fmsYWk= Authentication-Results: pengutronix.de; dkim=none (message not signed) header.d=none; pengutronix.de; dmarc=none action=none header.from=nxp.com; Received: from DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) by DB3PR0402MB3769.eurprd04.prod.outlook.com (2603:10a6:8:f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.22; Mon, 28 Sep 2020 10:03:03 +0000 Received: from DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::d12e:689a:169:fd68]) by DB8PR04MB6795.eurprd04.prod.outlook.com ([fe80::d12e:689a:169:fd68%8]) with mapi id 15.20.3412.029; Mon, 28 Sep 2020 10:03:03 +0000 From: Joakim Zhang To: mkl@pengutronix.de, linux-can@vger.kernel.org Cc: netdev@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH V3 3/3] can: flexcan: disable runtime PM if register flexcandev failed Date: Tue, 29 Sep 2020 02:02:53 +0800 Message-Id: <20200928180253.1454-4-qiangqing.zhang@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200928180253.1454-1-qiangqing.zhang@nxp.com> References: <20200928180253.1454-1-qiangqing.zhang@nxp.com> X-ClientProxiedBy: SGAP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::29) To DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by SGAP274CA0017.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.20 via Frontend Transport; Mon, 28 Sep 2020 10:03:01 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [119.31.174.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: d5a3f4a8-a252-4f99-a463-08d86395afe1 X-MS-TrafficTypeDiagnostic: DB3PR0402MB3769: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:421; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FwLIupxNn9JaOrznTqMt7hCRM91RA8mhrjGUqHtvE5EmxSNt/o1rk5/CRY7RlmXGMTNbiBpVLXOFT0rzlUbtb0Urg5xJVO4ew8yI29HcbDaD6+y0lpulVScTTCCVNzgHd6le4HXrKUE5C+b+GaqEHRqtKprrTZFExx99Ph//3ejwuybo4PWVYyJEb4zrmbmM64vkK5GC5ijvUnc620UeJGIxyiyV6y2AusxxsYyKSnHXtmdt6GoXbeXG7eP3J+VzHKsIC5ERlDy2SyXgVNiJfyOLJFtwkfybMUoOqwKr1vDZDKRX12TD8aFnPp8xJExZtEYa6qNldeFC8x6cRvBmf8ZINQg8ETLybOcY3eNowUN06A7RYq+ONd9CJo7hQYGY/apLdAK0EYTcahdy7F3/lMsVFFN1Vfgl3N4h+l+dd0zltRBU1dGo3x4MaJSGICen X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB8PR04MB6795.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(366004)(346002)(376002)(39860400002)(396003)(6506007)(52116002)(2906002)(478600001)(4744005)(956004)(2616005)(186003)(16526019)(5660300002)(66556008)(6512007)(66476007)(4326008)(316002)(8676002)(8936002)(66946007)(86362001)(36756003)(26005)(69590400008)(6666004)(6486002)(1076003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: E0xsNGAn/xRTK4EAvMjMD0G3UqBBl2ZjhQk4tiEjt4y2HZXpEl7irExEUVVdfg30oftPfyDR/VWSagEj8INerX22l4ND0GKt7V4XWsZSkvBiB+8BP24CcbK+1FFzc24lanOUNqKQGZurbjurt/N3nB+LedxVP0OmG1CdLbnwUt5G4q5LjA1q0kXssTZ4FXbemSS6XccMQgUqaRl4jZWbK4mdHtZ+j2H2kEeqzAbghQx2l80HD/C0FpOOIojJEFAWsq4ML61EEiFpnx6qy2yjKyL4S4ES0LVC10PX2w1PCRaGotVb/zg5iqeWuqwhH9a6xs4Rs/FPIf8ZmDLKObmXgVmAwwK/okuCsXnb5WiFDqBpeoGBkxNKlI0x1YDhYzBmOwG7eAsbmENdp/EmpxP5Kj0z+0uHDA3mxpMTPvYmEnHCKBJ3idKCcIdy8AExRWzCV/t3A8MNLWSbXK22XgPPFmSlygA3Ud3CnLZdFu1xey5LkxcwZG9Y/MPdiABaNoOtYBIxz94ZberD3Nd5rVpoMBlCPhRhOO00whEjXQnFXwWCh2wEQq60SCNAEXEX3EF6GunKPlF4tcQKzN1z1lcSZIInO9x6NHfVCBSlCB00HOVqPx+W4FCqoPwya9xwpMtf8++t5jtEqeYsw6xak7/7xQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d5a3f4a8-a252-4f99-a463-08d86395afe1 X-MS-Exchange-CrossTenant-AuthSource: DB8PR04MB6795.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Sep 2020 10:03:02.8457 (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: vhAwByDyHTZLeLZYdzQINah5W1Ain8yepCB97yzLSEXRfLHsm3phbUMUD4zEjehEtxDsDycfr2ZIcLQuK/L4TA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3769 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Disable runtime PM if register flexcandev failed, and balance reference of usage_count. Signed-off-by: Joakim Zhang --- ChangeLogs: V1->V3: * no changes. --- drivers/net/can/flexcan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 925efc986b6b..fbbc90454df1 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -2058,6 +2058,8 @@ static int flexcan_probe(struct platform_device *pdev) return 0; failed_register: + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_disable(&pdev->dev); free_candev(dev); return err; }