From patchwork Tue Apr 6 11:32:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416098 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, 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 E1C91C43461 for ; Tue, 6 Apr 2021 11:33:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A0F1B61396 for ; Tue, 6 Apr 2021 11:33:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241785AbhDFLdP (ORCPT ); Tue, 6 Apr 2021 07:33:15 -0400 Received: from mail-db8eur05on2048.outbound.protection.outlook.com ([40.107.20.48]:33152 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241603AbhDFLdO (ORCPT ); Tue, 6 Apr 2021 07:33:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MJABIOAvBFq+ns8K5X7TtuZ+gtiO87+NHrVHwFeLFRxfh4vwbWtAitZcAu272FK7erZOyRbPkNaZ5tGB7lHxEGki3TyHtv09DgxqS97v4lqWDySAhBL/Tl0QSMWURsQM+Re3SVxFDALTAMkk5QTwHsliFeo99/evWy67/kuRC+Ss/p1esOObK2fUNtyDglaB7cqT0DWWSTIUz/OV3VpO/eVaS3qz7ytgPFxNaS2qlvN9yyW9zeEUzgyEMVo2OxAF6U+jncm1hDgqfUBIwxLZ0wAIq+2yrQVWHk43OdrRTwnsDMcp768gmjTjpi9KBrQaHP7VXw1N0Q65QOLUXunt6g== 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=34WXF855dTFrymUPQKjP/yMf8DblmnD46nRKBTpqtlY=; b=oVcNWs/cUHNszFnYVRAsUfKXCS2GkOm/czyaSbFd5L04zWvpJroMqOup8sNSObtEODrnPleI0YogttAR76yBZvlk+q8rRTdl2dXRBHRlr3GInQpT5SASn1aoUjs1jpUTLfQHNI6Ri7ySlsyfa8HVJeI1WuZ3zARdimYuKtlZ5jIQ1+mFZk0M787X94auuRM4OIvOj556DAfNaHftc1BHwnFOn27cXqONFYg2Q2chNTpiRnUzD2XF+g2mILw4MRuIAbL7VJuSkX82IizxrH1WSyVxAzOIDDub+ETRxwlOydbTbZoMHZT1PHjD4pg3QtL6VRM/0/sVFPRI128gwjl0eg== 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=34WXF855dTFrymUPQKjP/yMf8DblmnD46nRKBTpqtlY=; b=EqOuVp/1Q96aFvdNx3+g/CNH7d6v/A6545AQpVnJi0tN+H/rl2O8IOOIyJL+sbIa1HFNFQDmMuf0Pmi9jSLlZYsdF5Tj1Y9iK19Hvscf54jgLcFfU1S0yW3+eOE3qZlP3iNqPp5AoLyufLuPF2UBujCpoqPsaZ1/vnBwUKuPRrY= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AM6PR0402MB3765.eurprd04.prod.outlook.com (2603:10a6:209:19::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.32; Tue, 6 Apr 2021 11:33:03 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9%3]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 11:33:03 +0000 From: Clark Wang To: aisheng.dong@nxp.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 02/18] i2c: imx-lpi2c: add ipg clk for lpi2c driver Date: Tue, 6 Apr 2021 19:32:50 +0800 Message-Id: <20210406113306.2633595-3-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210406113306.2633595-1-xiaoning.wang@nxp.com> References: <20210406113306.2633595-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 11:33:00 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6443bbe-48c0-4800-66a8-08d8f8efbdb4 X-MS-TrafficTypeDiagnostic: AM6PR0402MB3765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: D/kINHKZ9TJ9eyc44l9TQ3H+5KQ6Y1HP3QhDqG+FBgGsC97jQcJaJPvYFpMvZoMo179a6qJaJvWqcyyDpOhbTHI+7wEbvmQqrWyYMCoGvbpgGzr5n3LqFBwqZEiV8NnSJHkJw1SGMLNKEy9KwLDDGfm2DRgzVrgGWKZJU+KxP/PrM5s3too2YJ/n6uFSypZWQ/YgYGn4kqNDRNDOLsSBhB5No4QXZ2Llnbq0u70bdYkSGFyVsn40TKwzQengcyaSXXE4D/rYpB9rY+yzU6dTrRc7O3nmn171l2dG9iBHidnXdjcIOY2of6y99BbvIrBQ+WBXFC1qiV0AMoekRfa/yBltyBz+KFv7zD69Iw32HXbDVGgNXZZwG4sG+dMUKODf1L+l6X21cgoFu4wT0ieya5My8b3HSvmeP+XToqgNg+8oS6kxwaZXNTrVITmAfI0VgMpCBRzpp1+f+4V4GhzA0Ml5A9z/fDcu+7zsR3LT5ukkUMv0amkRoXRBgqezwAHRKcZn7HIBjt6g9ubL/mCDHxIkWWbTBS63hKgpmW+t0udHSi8oJpXr2ljx9A2N3LpjJ4JzQQ0DHzFJKwUKo3w9I4rjaWsxODqXff1wubAGXNY3NZygki1wQfDc0OCJfeuGh4o0OciRS3u46UwhWEMnHGv2qr9SeLJUrTs9eTRVxF6el/PDh0QGhvikncIxRnpcJ7ZEmIJZDPOaDR42a5YlMi18SdtS9Nauv9689cTVQ4Q= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(69590400012)(66946007)(36756003)(6666004)(38350700001)(66476007)(66556008)(498600001)(83380400001)(52116002)(1076003)(26005)(38100700001)(4326008)(956004)(16526019)(2616005)(186003)(86362001)(6506007)(6512007)(2906002)(6486002)(8936002)(5660300002)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: XRmco9Tt6vSQ23hDeZBveT09XkWhOGVpUN+A7Fw0KdjQsqqoqpMFlBt4fJ4ov/PZhBPxXadim6wXMVzccxprt1MdmWzuT/ePutsM7Ehq8wIRUbsjIMNUMS0pJJcD7xhIOwRKobphVCLArl5D5dPnuClcKJ4zcsHsNz4SSueHIFwPJC6l0X9mzOcajneG5sSh3vVRpo9K8VYREwyTS2goGcltiIGWbQ+yoiltfWE1KxO+TdeLr20aCD1lxxmjtvqwLZbYeXvZwj6E7CtVKOxXZ7xuqnLQ9RW8yVJVFKN7R+m2KyMwGLEK3m5JhmaRPglIdOHSMzFJjVDbFE06lKYvkJpGHxHm9MC0IrTEBRBbVrNLGBbnIjtsuVMeRXeU/XbUwPWzzCwicWq5x3tpfEN6xcz9EtNQRzKW7lezqrlCiD9mYk0RCSdVaVa9QQBWUF4476um+TJfDnb1tJy+IVJ00ds9Bc62+6sSaXOHHSLjf/wVz4Rt+Yak0rVyw7VCKFpxsE5ZZmsbVrfInmULhlxMhR9MnqsPijBq0POKXMuh7Nd6IYmeqwYhhDp+/4tQbfK1oqXgppkqAwfwsBX8UUuMrZ2kUKqFAAI2TdCIOZe6sGBURWhMN4OQd6rd8bHazqFls8Cz61Q7y6fYZlOPqo5y+rvLg84+WLRRR3gCtXbl1u5nA6c17OVQRhQFzF6DCRuQo7l5bng2dgD/ytNtEeS8Ud81QfDzuT1zNLMFzdbSnIlV7ADXy6lJ2fNyHcreMqfR8ieHqieWKRLMdDKu2aYMOdcWas1EU7nNmZt1saiFxYP20a0enMz8cp306m+b5AUslSMtSOhvilrQZrV/6egPzNKYdTO9bu39eQ8JDgqEUjBatrv2X6GFoEUgK+dUdkiLGsVBzEl9Muk3hGc4H5pp7D34MXlCSqjxaCgPjAZV6xuLo5TA4TK6NY/U6jX0Ww0i0lwkFw6s6dw39Mv/EWC+lPE7uIZNPmf9ZZQIcZk/tfB+pP6CJNTVlBB4xdwQ/GTGPd5BbF+ehTYlThBq5FDXVPvnko2vsqwnHrEr+NNd97gpZd4/pa97nraqWg2WNgIiDYaHqJvkEz+4mYA1UK1dTqvogKI1boykhPXPLe8kpdW+7ZzAe5WhqMibDFEYqsm5brPnG3E/yErW8VWVpU5yWHA2U75oeomC875QDM3y7gVZOmxSNYkfIy10OfDBnLcWFQ7LH2ncg/vyQBFhZgaBqAfdEwqSW5s9D5TUAQkFtYHwkMFgF51DUSRQXr7lqE1czxU9I3fNAlNolp7HC1/Sam0Xg0JhzWeDXipUxSZ/4Y7QAPmEgORGKkCBmFaggkER X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6443bbe-48c0-4800-66a8-08d8f8efbdb4 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 11:33:03.7933 (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: ZqBypiL+r5IWKzyKfyegXLQ3SB1N43ncTOW35taSy/4HUnCtpmCAGct+j1vpQI6p15wd930eQdBPfLf3XIcR2A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3765 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The lpi2c IP needs two clks: ipg clk and per clk. The old lpi2c driver missed ipg clk. This patch adds ipg clk for lpi2c driver. Signed-off-by: Gao Pan Signed-off-by: Clark Wang Acked-by: Fugang Duan --- V2 changes: - Merge two clocks' prepare funtions to lpi2c_imx_clocks_prepare(). --- drivers/i2c/busses/i2c-imx-lpi2c.c | 61 +++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index bbf44ac95021..89b7b0795f51 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -94,7 +94,8 @@ enum lpi2c_imx_pincfg { struct lpi2c_imx_struct { struct i2c_adapter adapter; - struct clk *clk; + struct clk *clk_per; + struct clk *clk_ipg; void __iomem *base; __u8 *rx_buf; __u8 *tx_buf; @@ -207,7 +208,7 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) lpi2c_imx_set_mode(lpi2c_imx); - clk_rate = clk_get_rate(lpi2c_imx->clk); + clk_rate = clk_get_rate(lpi2c_imx->clk_per); if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST) filt = 0; else @@ -538,6 +539,34 @@ static const struct of_device_id lpi2c_imx_of_match[] = { }; MODULE_DEVICE_TABLE(of, lpi2c_imx_of_match); +static int lpi2c_imx_clocks_prepare(struct lpi2c_imx_struct *lpi2c_imx) +{ + int ret = 0; + + ret = clk_prepare_enable(lpi2c_imx->clk_per); + if (ret) { + dev_err(lpi2c_imx->adapter.dev.parent, + "can't enable I2C per clock, ret=%d\n", ret); + return ret; + } + + ret = clk_prepare_enable(lpi2c_imx->clk_ipg); + if (ret) { + clk_disable_unprepare(lpi2c_imx->clk_per); + dev_err(lpi2c_imx->adapter.dev.parent, + "can't enable I2C ipg clock, ret=%d\n", ret); + return ret; + } + + return ret; +} + +static void lpi2c_imx_clocks_unprepare(struct lpi2c_imx_struct *lpi2c_imx) +{ + clk_disable_unprepare(lpi2c_imx->clk_ipg); + clk_disable_unprepare(lpi2c_imx->clk_per); +} + static int lpi2c_imx_probe(struct platform_device *pdev) { struct lpi2c_imx_struct *lpi2c_imx; @@ -563,10 +592,16 @@ static int lpi2c_imx_probe(struct platform_device *pdev) strlcpy(lpi2c_imx->adapter.name, pdev->name, sizeof(lpi2c_imx->adapter.name)); - lpi2c_imx->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(lpi2c_imx->clk)) { + lpi2c_imx->clk_per = devm_clk_get(&pdev->dev, "per"); + if (IS_ERR(lpi2c_imx->clk_per)) { dev_err(&pdev->dev, "can't get I2C peripheral clock\n"); - return PTR_ERR(lpi2c_imx->clk); + return PTR_ERR(lpi2c_imx->clk_per); + } + + lpi2c_imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); + if (IS_ERR(lpi2c_imx->clk_ipg)) { + dev_err(&pdev->dev, "can't get I2C ipg clock\n"); + return PTR_ERR(lpi2c_imx->clk_ipg); } ret = of_property_read_u32(pdev->dev.of_node, @@ -584,11 +619,9 @@ static int lpi2c_imx_probe(struct platform_device *pdev) i2c_set_adapdata(&lpi2c_imx->adapter, lpi2c_imx); platform_set_drvdata(pdev, lpi2c_imx); - ret = clk_prepare_enable(lpi2c_imx->clk); - if (ret) { - dev_err(&pdev->dev, "clk enable failed %d\n", ret); + ret = lpi2c_imx_clocks_prepare(lpi2c_imx); + if (ret) return ret; - } pm_runtime_set_autosuspend_delay(&pdev->dev, I2C_PM_TIMEOUT); pm_runtime_use_autosuspend(&pdev->dev); @@ -635,7 +668,7 @@ static int __maybe_unused lpi2c_runtime_suspend(struct device *dev) { struct lpi2c_imx_struct *lpi2c_imx = dev_get_drvdata(dev); - clk_disable_unprepare(lpi2c_imx->clk); + lpi2c_imx_clocks_unprepare(lpi2c_imx); pinctrl_pm_select_sleep_state(dev); return 0; @@ -644,16 +677,10 @@ static int __maybe_unused lpi2c_runtime_suspend(struct device *dev) static int __maybe_unused lpi2c_runtime_resume(struct device *dev) { struct lpi2c_imx_struct *lpi2c_imx = dev_get_drvdata(dev); - int ret; pinctrl_pm_select_default_state(dev); - ret = clk_prepare_enable(lpi2c_imx->clk); - if (ret) { - dev_err(dev, "failed to enable I2C clock, ret=%d\n", ret); - return ret; - } - return 0; + return lpi2c_imx_clocks_prepare(lpi2c_imx); } static const struct dev_pm_ops lpi2c_pm_ops = { From patchwork Tue Apr 6 11:32:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416097 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, 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 E7D9BC433B4 for ; Tue, 6 Apr 2021 11:33:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CC4076128B for ; Tue, 6 Apr 2021 11:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241914AbhDFLdX (ORCPT ); Tue, 6 Apr 2021 07:33:23 -0400 Received: from mail-db8eur05on2059.outbound.protection.outlook.com ([40.107.20.59]:54880 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S242022AbhDFLdV (ORCPT ); Tue, 6 Apr 2021 07:33:21 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QmSyR5R6ZmeBl12J4utglvag9vdJmz+sN78D8XCmi8FbvShRWWPCZB76zoh39yrTJ2arsldQCQdjZdq+Mo68npn9xvD0XdeDPmrMM55Nf5+yq5wKEej3mGUNqvcKf3UB7KQoRa9Noa714/pMVidQCeHbPcF5qHHVTSSjf2isgEf7XNOX5v1EVLLM0QHEWwGwAZol/DBuqJrCZ3e1SIieIVsu5xcOsg5HjVFy73832BiKWtJEcbnQWe0rEoXi87o0QzFdh9Y0tJFWEZHQEvfOgtq1CZy38F7JPr70pdtI1YWWAZIxqhf4D65fdWuihBYB4PgHqqu4RPI/dV8RphrGHw== 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=uUxP6kXUybJmmHVqI4y3x/kNT5LVKhcxABhspnWD7xQ=; b=OistX+QG/sH5vIZEqDJO1CHhYceslunh4uU+xo9SSeYDW2fvQOhhLiQJXzECTwK1tgIa+Ns0xlGOMqDYP1JuQm5dX1uq4T5y1KLG+uSctzNFJu5j6PHKVWb0wNrW3uWpYZFtmDywNokwWRpAR1F6aCauddXYHrsqZMTlv4lW/JGiYAht1/EZhJqvt9wv4CesTiV0mtlVHuXAr9oWyuRyNgrrPkzLl3UIZVW5/7J/3Zn+a8Dd9LmPTWW9rUFcTwD9b7e9TbitgXX9zl7Rja6Yxicc5t2mJn97uniEmVRUy2lR9kdOS6+bgRxftMMxc4B1Cy2yaqR9UcUunRc9JyqArw== 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=uUxP6kXUybJmmHVqI4y3x/kNT5LVKhcxABhspnWD7xQ=; b=FG/sRmux5Ip5y3Li4KVGJVyBaNLzP6DRUAF9SBkVbFPx6aqGjSidtQbPNjQk0tohlRKlt7/nNixUugYgFLNCj2W8qaH2Ade07pXje3SuzHCH/bZi68cbawS3oMntCTpczuEWajg7192zrx0S9SoP0uH5+OVOdkPZ1NHnaWm1rMw= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AM6PR0402MB3765.eurprd04.prod.outlook.com (2603:10a6:209:19::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.32; Tue, 6 Apr 2021 11:33:11 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9%3]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 11:33:11 +0000 From: Clark Wang To: aisheng.dong@nxp.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 04/18] ARM: dts: imx7ulp: add the missing lpi2c nodes Date: Tue, 6 Apr 2021 19:32:52 +0800 Message-Id: <20210406113306.2633595-5-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210406113306.2633595-1-xiaoning.wang@nxp.com> References: <20210406113306.2633595-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 11:33:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ba46151-0668-4b57-0ea0-08d8f8efc21d X-MS-TrafficTypeDiagnostic: AM6PR0402MB3765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7yiUvG+HLAua1XYeBvR38W0dy16cgzIxljci7GxjVL+45urGy2vp7DgsGJ2JypkRv4Nxk7ud1kkn4Y0BTcPCCO7cg4e/fI/5URakTXoICe7M8CFdnJKCY3PQg69UOzA0AjPc7l4QtHH1odqtZGWUyV0qJ6OJv/Y6B1YIDNbT3/e4Y6LWWLm4xHR9nXQm2yyfInvj1PSyn4zc5ejwLydlh+cMTMjWADVK+a2CECUHJNwlUjPWo8Z64c5pLy/591yZpdrsLsfzAT704bM/P/skcUDcY2Utdy8BIDtYlzRbqRGe8JDzDU9XSJVDxc0BIEDL50/en3HlrtA9AdW0er2mrlDVYc/oCE72EnH44jReLSLKhPpp0otaMddDJX6MKmLsK8+NQu9QA2WbobZvYHsc7BoTQz0nx3skZ8ge+Q0YUyaqRpt16D2hwBd+htIz5Ti0FUVQ50PyIO+9MADacOom2qJLv8iCngYvYTqOa6s5Gc2IBEEIMcIpNI9NJSAz2ISDEu13XkN1Lu8y9IvyNDTma848LhGEy4z4KJohnl7Eew7rgNg3P3Yfy10iyTIraPloR1UU4HiRIIMICCSVf3m79r7AqZ8C3Mo7fLY4wKXbe0m9zmzMYAG+Ef4k1dSfEjN4R/5dnSCFkPmCqKal+rhbAeyvT5C5YBW1CfR0w/wpLSztBd45hqQ1pNz6svJqwOHyJ7LcFC+ds1xCUWgpxuUBD0sUKfNn2gAvJ83hAGBWlas= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(69590400012)(66946007)(36756003)(6666004)(38350700001)(66476007)(66556008)(498600001)(83380400001)(52116002)(1076003)(26005)(38100700001)(4326008)(956004)(16526019)(2616005)(186003)(86362001)(6506007)(6512007)(2906002)(6486002)(8936002)(5660300002)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: VkYw1i6ACN+tqoW0y42k/8s2jC5gkwN5Lbq/rKlBHVHvk0B3WCMfB6RuDWoqPBQ8NXsaeknarhbveNyVrlB/TsKeLUZnavfi+bueBzTZ+SrTvChUK+NWYlvU1KK7XPxb7liozL0sXlsqOS5rh/hqGj9Vf+JH0d4xCVtIWW6cAQRs2cqIJj1MqBcR1xyxVwlUBxKNN/bEtxxkq3japRZkY8/JTsO5fKVJtUKbPUDasFbu4pzRZ362uE7UF+9ksI7z0X9W/UrIJCQocgXOcqQX4OhU35EvcvoCHL/0uRboZM2QbvB7x5QigBOigiZkJXSiJgudJKRKkTbBYoQgn6d6KpzpMizo3jvwNbTA4rfPy7rIgq9bId8QGXRSwO7cCEKzdKKtIiLTLpfiPxKGNL5fEx/diypIjHQnmo06n0YM/VeRAIx8l+XrtYpeNp68q4CtKeF2TVl2+fchbq4ddvGhJJMWD/zRURPDn+98eaUWxWfUo7zkUJ+gzGdLoVfcygNJn1N24xknDV2IeUSvU34+yzVT1OY0Ao01CzbDzKRY47etW52zh2+mXhOOuC4jwKAwl0YKajy0wDy3B3AOoZsT6tltL7Mjxv3K28OxA7yivrPehgzCAnSUO6ugynRK83W3J+4oLgF+UapzsQAASA1jbhMggkE+ooFViq/vE6ADn/HcA6Z6jf/zZYFmYnRpCgnlkQEA1YG1x5y7BoysKH92HUJmTLBt6xb1GX8D6e6qyLmHUlcczslFwXOnQURshDEJ2FGhHtvTYMJvldQdqqUJF13iCROODxfoNjoMdTmnhzuC5QyrJQ1B5ct0devUDlZDPa0iFr5TEf+cSmuT5lhClHhyUPXD0qnYSBymFGDLjIjMeUtZs1ExgknWDwLTOGNTVIfOXbGMKiTZiMujcBTIbuAr2cz0FdJ0YNFb+Dl9YM41AjjPZZJEZKjeuy0hHoGA8B9GzzZcBCRMvoAL88bnEDRbFKZpwQqjGyq2HbJJ4LTrv1KgN2O4pDPUC+lYVA1IzusrgH2vAOAdwVmvYO9bvtcijQLqQpRb1hBdRH+rTSedPNJ+0R3pLWLdfF3wDEdFLnz2bWZEAljgIeJMNkoGkVQt94coZNsh3djc3UXIGOfo2/ENPONGbB8Jw3xats8fUqmVQ+tHlvm6qxrZE2sXgWjVh0RH/Auu+Blc4HZXx2jj5DI4W2OXazwT46trgsiVAzkGU+W7ejXgQESHLP7ajh2u0YdZN1rRPRLZbFJSIB4REm6rKy+lJZHduwyXPBek1bN2xCnY5RoZRFF18O3b/hh8Fsbu0tXgOAjP9xJafeZJzaF790w9IwOmOW5kb6EB X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ba46151-0668-4b57-0ea0-08d8f8efc21d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 11:33:11.1820 (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: gUCjWjeKcLFcRmsYCpIgDwO/VFF7+lFtGsSpINuDgBt06ccIWhKXvbmbgqQWBSlFDnQWZCTAXrEOa/aHIgppjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3765 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add the missing lpi2c4/5 nodes for imx7ulp. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- arch/arm/boot/dts/imx7ulp.dtsi | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi index eb0d4b8f624d..0c51fa79c0bc 100644 --- a/arch/arm/boot/dts/imx7ulp.dtsi +++ b/arch/arm/boot/dts/imx7ulp.dtsi @@ -22,8 +22,10 @@ aliases { gpio1 = &gpio_ptd; gpio2 = &gpio_pte; gpio3 = &gpio_ptf; - i2c0 = &lpi2c6; - i2c1 = &lpi2c7; + i2c0 = &lpi2c4; + i2c1 = &lpi2c5; + i2c2 = &lpi2c6; + i2c3 = &lpi2c7; mmc0 = &usdhc0; mmc1 = &usdhc1; serial0 = &lpuart4; @@ -145,6 +147,31 @@ sec_jr1: jr@2000 { }; }; + lpi2c4: lpi2c4@402b0000 { + compatible = "fsl,imx7ulp-lpi2c"; + reg = <0x402b0000 0x10000>; + interrupts = ; + clocks = <&pcc2 IMX7ULP_CLK_LPI2C4>, + <&scg1 IMX7ULP_CLK_NIC1_BUS_DIV>; + clock-names = "per", "ipg"; + assigned-clocks = <&pcc2 IMX7ULP_CLK_LPI2C4>; + assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>; + assigned-clock-rates = <48000000>; + status = "disabled"; + }; + + lpi2c5: lpi2c5@402c0000 { + compatible = "fsl,imx7ulp-lpi2c"; + reg = <0x402c0000 0x10000>; + interrupts = ; + clocks = <&pcc2 IMX7ULP_CLK_LPI2C5>, + <&scg1 IMX7ULP_CLK_NIC1_BUS_DIV>; + clock-names = "per", "ipg"; + assigned-clocks = <&pcc2 IMX7ULP_CLK_LPI2C5>; + assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>; + assigned-clock-rates = <48000000>; + }; + lpuart4: serial@402d0000 { compatible = "fsl,imx7ulp-lpuart"; reg = <0x402d0000 0x1000>; From patchwork Tue Apr 6 11:32:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416096 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, 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 5A617C43462 for ; Tue, 6 Apr 2021 11:33:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3412C61396 for ; Tue, 6 Apr 2021 11:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242179AbhDFLdc (ORCPT ); Tue, 6 Apr 2021 07:33:32 -0400 Received: from mail-db8eur05on2047.outbound.protection.outlook.com ([40.107.20.47]:31407 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S242215AbhDFLd3 (ORCPT ); Tue, 6 Apr 2021 07:33:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZGK6roFztnWpp3SP83e4ibnhSatJAFJxlD5aiULYRqA7rRWlzwc+koY98r6snZsWkNjRb/qihXMdxEszlr0NDjDexTie4y6kkhfo2X09QqCiSatrAQqiCGDPT+DhnrC3RrVMjm6zu+uzut8trvZeLoaNr27Ak1Qwn0Hrq9bxpOQvwP6UhEbHUFhosdjDrKm409zD05SLQPk+x1ptMNt9SlK8rGz/tZe3Dg32aXPuIL4aqj+kDTY00f67yg0GK4TjIuojIFndbspJAjROm6WVPfP3BcAXkXC7w3ywM2Gnh1V9JIMsFEeoGWiNZV9Zt89CIQ2fJellXIo/wNK2XiFoIA== 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=xSxOxmAX84FNDqMKmQa5ef21e3n7IdvoKnytZEo80co=; b=KMPREUUZ/Gqjw/6d6SD9W2pJrf0Qv2M8IULG0qmlUhjkVz+wxBXwZrnxZ43UPKmweiDWT526SE8PslXzC4CTN+qIpopX4ynTrKcWwyW/p6MJAU8pUnGSVVoHP/LlQC8lxFjFjU60jR+FXQ/lW20ceQ/8XLzblyoGyR+o4yL0H/FuPd3jtWbP6r2b7rST4rm/PWgFIiIykGF4ERW1um494Vo5o0j8s7jpPzLv/Wy68wIXQsSeED8+DKtmH4D29GQd/q57ro6ytoXeyA0Gh4LxOvIV6ey7iEnRmjuVtGYlaBFebmy+g8z42GgqP4Z4J6z2cE2xexjQ1M46Ng+w0O07IA== 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=xSxOxmAX84FNDqMKmQa5ef21e3n7IdvoKnytZEo80co=; b=N9QhJvLUj2phxBXEB5yMnfJ5vf7v1uYyUKMo0X9OV7CnjIm4dZ/4uYVS8x9OnmZtyLSTPfeMxI6zWnHWkNFThkqaH+VgbqDCfoRmMJshb7F/DdOLOoowzlsqIMpymqyOsBFMkz4Bmg4Qu83YjiiEstv3UkzskWgEfXDl0VmdjB4= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AM6PR0402MB3765.eurprd04.prod.outlook.com (2603:10a6:209:19::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.32; Tue, 6 Apr 2021 11:33:18 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9%3]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 11:33:18 +0000 From: Clark Wang To: aisheng.dong@nxp.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 06/18] ARM64: dts: imx8: change i2c irq number to non-combined Date: Tue, 6 Apr 2021 19:32:54 +0800 Message-Id: <20210406113306.2633595-7-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210406113306.2633595-1-xiaoning.wang@nxp.com> References: <20210406113306.2633595-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 11:33:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b2e3d9a-0d92-4ee2-83fc-08d8f8efc670 X-MS-TrafficTypeDiagnostic: AM6PR0402MB3765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R2tffQ2gYiquciHYk3fQVkgu9ezHrAVxZ413nif40mByqzHsJyCuv3vzStwDst2gDjAFmLkMAltlKQoyLJUooalpPe9kiqlMPJsFrx9+nAKc6YcGOSTO8o7hHf/hxtyfju1CxXkCBl2DOgkYW5CftWdOeiSfaT/PkwI7uRD0zO7QrYbcSwrvlX9qXNY3i9HgEWDz6rMkm1MeJNftX+FmyxlbcY9+cgt1yTqBXQUDVMIPV5+tpPqqisNr3AQ9a+KY8nUfwYNmzD3I90om5nYaZPgNIwrc+sJIDn0ODVP7NGO4u4rkVw01CSRUEk7sVxBi5/zjFWyIlT9qko7MZcr2myzDlC7MYX99mvHmtnEiKine9fCNJOXkzWFlryEbd4PNklr93pD2mBZ9KgLMN3zriprwgdTfOXSsBTTDAknQ1Bk5NT8I18TczAlUhGKNxpz3ANCYlRNlisCHp5JZKhk2Z5+gTgs8VKNmvfJ2wzUZE0u5WlrOGi0gi/IQEMxg0XNpjzEAQkZz1RucofkA9XBt9W3EDe4mm0SckPQ+4RxAnbAMeljhu6faDufB+fhx5+/dF+6SUORYI7ouG+8A6mcY6cz2Bm/pV2nUN4tiTNwkn43zcop45E26Z4N+ZKKUsUn7EPqsnDVBk/1M42t6YDuaTZGLahfiYDgE8WZ6zTdG/TpbLudaIVeexqDHeqB41D+J3Jbytzn5TcksycQnkmnMPTGBHxUSAdkJoEE/yyIGNgY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(69590400012)(66946007)(36756003)(6666004)(38350700001)(66476007)(66556008)(498600001)(83380400001)(52116002)(1076003)(26005)(38100700001)(4326008)(956004)(16526019)(2616005)(186003)(86362001)(6506007)(6512007)(2906002)(6486002)(8936002)(5660300002)(8676002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: X7m9M7769DKY9xYtquzEEqlR0WIcCRYq9ER8c+sE73ZZuKZX98Icz+5Wyn/GHvcPBFLkQm08DXdCNRR8+oT6De1JxfszX4s/s/CKzqz4QGxE1VRggj0C4sMPyAX35A5EX9jVMsfBhQjWJVXVMt0Q7auSr8OWpAlFwxWZi2uzcSsbBXGqMxh6pOpU3dbnnuL2hz95FednLQLbRTaxkPFoLv8iJ9oOLLJ9pUM8O/rOdkmQnRoYQm2AtRwaGPfSb8cGTFAvtMfNRnVT6H5Ja6ufiNLf+Vkd4z+JHHm2M3j2KmJol60R45tds2YrN293/d+gwlFm3Sluuz9phcWWdAx6UpkPKyUAB2COw3+EJj3+7Z/m7YKQPHqvmzrjOaxPNm71rCKxcuUq+Q8CmM/MxjWv36fDXl+i3xO3f4f8By2XvjGnE3FAN0IqhMpCyaG1B/oWTVzGRlpnquMPxtSSZsq6bXcf4P/ITNuVtmvYd8eClCiseaYRngBFkJxxG5T+NUPiGvBQGTdrCCLzH+5ia3E3cR0gJFf/uy/sSKs8RzE0RZeumiDq1+RUNu6aeOVkIxiqlTXsBQWkX1fJRdN0GDWqVZJkdIQub6N2hx+iE8yc33m3GsdeFvWxv9GZkZNwWyTcyV+AHsQcJmkUiU8+2IuRLc4Vt6vBSPPJJRpM1+PORBryS05t9tbYulgCP6y/DwtxaKhw0yIXKI3ty2dIbkSPcQISmSc46x9ZguQn+9lwGZuiE09OChpNM5V2y9f+A/cNfEgBFjB5YSLFZux77PnNY6BJqscnxadNaxUtOPbQvWS2sGWLd920Ylt7mQNGpMY6ILaGi5r2RxKVo/5jnYXkPKCY3rmhDmjYK7pr3uJUSBlhN0r2pUcOPD4iAgNJh4Lr2+cGo3313B3BYHToxlP5fxy+gR7KTGvIUSVCF7+AuG93K2tmCHAsn64w5bngoTG0cD3UMCLRNzDfQYZhYiTzdC9XWrP0dkM+FH+QLhIysofBt2zN4Z/rjSuANSy2zz22tsboNq2YEW0C9e4rAN+EjZfsXnk/P93unthVHi95x2E3fhiJWir34saN4+XHxrjmByHOPFTPdP7Q3N4aI6iZLCLjaBPuZJJ45MCWsGYiBTQ77BTpYqsMfRcuTToAtgiXia8IQITI8yha5bXoydJ2H39cguTFtIg4lo6++AdmMrgwMbXFCdJsM12lw3PTZ3qNyPEDAz0uvHrM/nizII02KPhpX5TnlYtg2Wrhy+yLmqQ590hGE7YWFAvmxvUUrZOxrJ+5+YgEIRELtAlX/SONQecI1tb3vbBftoPElAORghS7KoRc8jb3jQGde5Xps/+W X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b2e3d9a-0d92-4ee2-83fc-08d8f8efc670 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 11:33:18.4649 (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: Yc7NzKBFGi4kWC/uhEz6J3KtNx87Oj/eZQwckWB4XCHCXdpYwWupN6jwxJs+D4Xnz1tB6v8swOT0GgBdrPD1gg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3765 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Combined interrupt number may cause unexcepted irq event when using DMA and too many interrupts will be generated. So change all i2c interrupts number to non-combined for imx8qxp/8qm/8dxl. Signed-off-by: Clark Wang Reviewed-by: Dong Aisheng --- V2 changes: - New patch added in V2 --- arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi b/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi index b5ed12a06538..9ba57f04859b 100644 --- a/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi @@ -110,7 +110,7 @@ uart3_lpcg: clock-controller@5a490000 { i2c0: i2c@5a800000 { reg = <0x5a800000 0x4000>; - interrupts = ; + interrupts = ; interrupt-parent = <&gic>; clocks = <&i2c0_lpcg IMX_LPCG_CLK_0>, <&i2c0_lpcg IMX_LPCG_CLK_4>; @@ -123,7 +123,7 @@ i2c0: i2c@5a800000 { i2c1: i2c@5a810000 { reg = <0x5a810000 0x4000>; - interrupts = ; + interrupts = ; interrupt-parent = <&gic>; clocks = <&i2c1_lpcg IMX_LPCG_CLK_0>, <&i2c1_lpcg IMX_LPCG_CLK_4>; @@ -136,7 +136,7 @@ i2c1: i2c@5a810000 { i2c2: i2c@5a820000 { reg = <0x5a820000 0x4000>; - interrupts = ; + interrupts = ; interrupt-parent = <&gic>; clocks = <&i2c2_lpcg IMX_LPCG_CLK_0>, <&i2c2_lpcg IMX_LPCG_CLK_4>; @@ -149,7 +149,7 @@ i2c2: i2c@5a820000 { i2c3: i2c@5a830000 { reg = <0x5a830000 0x4000>; - interrupts = ; + interrupts = ; interrupt-parent = <&gic>; clocks = <&i2c3_lpcg IMX_LPCG_CLK_0>, <&i2c3_lpcg IMX_LPCG_CLK_4>; From patchwork Tue Apr 6 11:32:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416095 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, 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 4F8C0C433B4 for ; Tue, 6 Apr 2021 11:33:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 258B8613CF for ; Tue, 6 Apr 2021 11:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232624AbhDFLdo (ORCPT ); Tue, 6 Apr 2021 07:33:44 -0400 Received: from mail-db8eur05on2077.outbound.protection.outlook.com ([40.107.20.77]:22144 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S242942AbhDFLdf (ORCPT ); Tue, 6 Apr 2021 07:33:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AACCwR4BQSBkkz8Ou8NdxKNupOeixilEOc43jHh3g6P702TLw9vDt866dYZZaImHrvTRUMjdXBaaQEEDruYPx75FYXfcuy5r9d5MMJ5NSGJmZXsDIItI0q6tDrK0TqCsDM09k/3hp+dfhuB8Eu7+YVG6DpvH59QVf3wPVR4RM6ELhv8wBByl/4AatK2cqimOaf5+HbtgVXJ2Wb/q5cXwzMCkba4gHPY9yU7fkji4P0XWrMdtmjySIUPTPlzqaCX2axdYjo0ON+ozuXeYlRaEwA8lRHDDTM94EMeoxoEmaAI+ytfJuJUG+yq1Fd7KqFDxEsnk+h6OYuJXi1uKgjw2Ng== 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=0tJozU71mETkSwiNm9/aEAti6psIvOH41i55UiDVmrg=; b=cQXZMuv4tdyZK+xOrdthkW0mByR+cX8vEYatSSG0vKsAdIGK6mx5aimGX40Zllc6pZZf9pZ1YV3tBq9mdJWqu9DKOuWdLVmDuDMfE89yY0R2kaAxFplg71qwaSEGqa90liJI9oB8vulsg2cAl6eR1eXTRechDVmsMTyH51lyFJaQROWQxCM+gZa2Pyel9/Q+6Ig5LniISR/lctxRKUkJ5THHfF+9HN8lZIB8Tijh2CoHyGKYPtI8tf5dscAfeNyuEmgt+QJD8BCqSK3dk9mjJHw34XQGqTxVCpjc4t2TSIBIyJpQCsd0gEowDH5jCK3VwJg6glDSxwSYYhqur0jP7g== 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=0tJozU71mETkSwiNm9/aEAti6psIvOH41i55UiDVmrg=; b=gG4bHa6vYw7xHqVkx+z7QOWboYJ4YMXeP1KTEwuiFCpUotfLZ7Ij+DXX64yFeb0wKRcG3hv7Rh3YJWAdS+UtRWA2mNUYseBzJhgXffRd/d19e14tGm8Z8M+jHfbR08hdHljKzPoPaDzYbNI1K4nhHVkDH9jX/gtJ/tWqqMEukHg= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 11:33:25 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9%3]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 11:33:25 +0000 From: Clark Wang To: aisheng.dong@nxp.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 08/18] i2c: imx-lpi2c: add debug message when i2c peripheral clk doesn't work Date: Tue, 6 Apr 2021 19:32:56 +0800 Message-Id: <20210406113306.2633595-9-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210406113306.2633595-1-xiaoning.wang@nxp.com> References: <20210406113306.2633595-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 11:33:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7816586e-58ad-47a8-9fc0-08d8f8efcaae X-MS-TrafficTypeDiagnostic: AM7PR04MB7142: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R9dHxunvLRyWd/93xpp7+eSWvhHpxiTxmKhAE+mtHoj3MIm0vvgr8mtpq1dKSjlIh1gVMayVdtTSEbEq8PUTIGAzIcmc/Z2fFavcsl1XdK2/vporSUE7IvcmH0FuMrLgtN7LK7f1kXmUTCyVBX7RtZlfvvgHwSWKoOCvPFUzRWnWLgUssbVdQZ9/26gi/qM6uUaJX/pvF3oC05JIX8QQTs1EdT/nD0Csba3JZBnGsO9GCdRq2XWVL1msukk6YiXRcDSmbUhp7jQ+DI6Y+v/5yjn6dXZR1Z0N4bFgAtuBK32hIgWuEwjysg2P+03rOMGT+zTjPetpRS/pqjL/vSlfH1qfuPChkXQO4hpaxHXQ1QX2egwop7z/3Pa+XqwVRG5ukP6Cf3VqSJGY6JGSzdIeeoxG0mLZxGpy6zh7g1fC6x3V5GGuIU/brGAajpeh64/qgyL3lzJIFMChTwZhnNYaDHXtktYAQoZfCp1YdORMscC5JLtMhSRtfEXtnIY+GEPh/XRRSzcIxRJxILhy++KyHMBj+aakmNpAroMv3kO9y1zlNeM3El5F5XlmTBwg69hpvuh/w/NFp3mBYC1/ijHsBDg2HXO3C39iLV20jeRiFb0YT48loAEpyUmhYC9OxcUrNshCraJBpDHhxu0vQ5DHo2Gn+ONJh91nV2HUqYJ7ckFLddJu3uwlxhfefYbxTAkUG89mshw6jYsnIMdfNDZseg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(52116002)(186003)(16526019)(86362001)(36756003)(26005)(66946007)(6486002)(6506007)(2906002)(66556008)(38100700001)(38350700001)(498600001)(69590400012)(8676002)(8936002)(2616005)(83380400001)(956004)(6666004)(4744005)(5660300002)(1076003)(4326008)(6512007)(66476007)(15650500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Ua1fpgwJSlJK+gr7v7d9jevX/LK4hnDzp60HOFXbG52vVarxbCsBzo/2ne2pJlXfZppqlscXrwzxxMrVtKTMp/hSlICYmmXy0vZWBCYanH3+bdUvrwvZLdiYTLKssUiBXRG9vxix0fwjlrcw7NLkQtFkBYy9Xy9h4LDZjYU7WoPr3HMuhHIqR9l3Zv70knlU+Hau/DxcdXHDLa0rvKXO4aJiQ5H7fi+phsNbIrulcfGXFfmyNkiiElUbmPZMptJrAqMYSXwbfDNeicr3tSOxegJFa7z2/iWPgu3qtFNfXiY11GGlU/tUgvbwdhyeOdOS7TxFteWs3sNYoVhyi4bZeue2R5n8GPNYWwpKD9VKdd7I7Y3yuctoyv4XE8c3eaen6nCopJeSGllWamMbVodoyb3o/D7P1EsYMqlvfN7YkgqyB7UynHX3f9nn6YNfGzyjrl/U9WXGnJZULtKzC77f8GlvNeYp6HDJPhM/FZiWLwXyLlVufceSoclmU88K5a2mMv0dp8GIzVFW6wLx5bW5T3tN0ZAA00hlP5B/T2OkC1jNh9Ya27rG6f5sl5rBX8CCgmBLO+L9WSlCz391EQCb6s+E6QSvgTar2KHztlOoZeZHMdQDuOZfc0OKKt1FeTlhf5x/vafZnTNpwDxB4xMLm0Kns7bXRrH3v7Gn52uMfFHkQXr1oF9o8WUrJtQ7oZsjbcWTB23pwM54ZOijxSx8oTPU0EmgObfpLgtTynoG4mKUm2UTLHprIxMEfWR5Bo+/HogL2kDEVIRbo2etfAWRqvF5JtD6T03ONJkMx5KA9Gmbr7OXPhIKBAWBkQOUcYnRzCi0mHpgAzT6eDh6XK80nB8X+pJB7mvBvO/dr1jsQaeNTX9UU5aXhCs5UGQUo3mPVLEuRcO7cBpWqWPrc64ds4oXPYjj5TdkzFm33/Bmpne7lkJXeEMv1Kh49VdWHcc3fUPXNnlwe/pmkv28guEFEjJ1jh7fGWPz0gkH/g4Zs43w2p5zXYIod+OHodE5NONfWQBv9RQz4kU2/l22bFrZYkOWp+c7U0GYWhCJz08fcVCrpcpUYY685K9VltN53CLbBenXCHGcugC+FeQ3txg99vgihshOhJHmn5QzH7oToaI08XnSf8sMm3JZG1kLVFB+H+4IEyzsuwiVMaupXFjTefNL+Et6gpnExFBeSdvKM500L/Ho2aXin2NW3rBcQk9GjyvakvN0kio0pGjok4XJ61591OK04trv5XZ5i9PNx0sqw2mgZiie4awMuu93TJcZbMCapQRlJ1KwEvq+htNZH6f4LlH8pWOr9Q80Imjb5nLpF2i+BuXGZqzl/54m2lXT X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7816586e-58ad-47a8-9fc0-08d8f8efcaae X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 11:33:25.7497 (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: bCLvT1KLUin1jR/aGuq+AP3jyFXj4x7GjLPNAzczdo+0pJtg/meaBbZG8mpVvpY0hSKdU0h6CBtNGq20bh7HEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Gao Pan add debug message when i2c peripheral clk rate is 0, then directly return -EINVAL. Signed-off-by: Clark Wang Signed-off-by: Gao Pan Reviewed-by: Andy Duan --- V2 changes: - Add my signed-off. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 333209ba81c1..dfec334712c2 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -210,6 +210,11 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) lpi2c_imx_set_mode(lpi2c_imx); clk_rate = clk_get_rate(lpi2c_imx->clk_per); + if (!clk_rate) { + dev_dbg(&lpi2c_imx->adapter.dev, "clk_per rate is 0\n"); + return -EINVAL; + } + if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST) filt = 0; else From patchwork Tue Apr 6 11:32:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416094 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, 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 34386C433ED for ; Tue, 6 Apr 2021 11:33:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 04D55613CA for ; Tue, 6 Apr 2021 11:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245593AbhDFLds (ORCPT ); Tue, 6 Apr 2021 07:33:48 -0400 Received: from mail-db8eur05on2077.outbound.protection.outlook.com ([40.107.20.77]:22144 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233103AbhDFLdo (ORCPT ); Tue, 6 Apr 2021 07:33:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nuIZ/ClPR/1qTwy0RRgOVOK/lJrTPAxTZxHLDEl0WRvdkOGYls2GxYodM5Vw/PQBKU9soAhYkcALsO6Ap5xV0YsKp865fWsocaFLtooGEkb5jrXCgrSIlgV9CFc5zEc+q3IEq7BbsnboTEhALhoNxXqzo+XLzvIZn468CQ0BMWTVDKRhzGgfjfokcig6pP73KudsqAxZPMgWXErNorMOXEA16BZcIwwYDL0ahBZGFwra0dly8i6Zz08/q7O36Q9AfeSywD15nMZykSFFG88uDzr7OYbTcN99AcW0KgvOhM+v2aMTcRV/f2Xq7WgHpFAoAtGeVQped7xqtWiNmwkhbg== 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=4JSppjieFHxMsU8F7jhZqMFlfT3NPEnAN6j+6fUDx6A=; b=R5z4PdSU7U3Pm8q/anILa9kynE5WirC7HiIMLQ+9NlsDI/4vlXXymVoWThQCC0VxIyJC6piDkOQIBjIteoO42xw2KL+5dtBSkylRzDZj/Q3NqOBLGdGh3uu838L12iqxYFme8JCFuSkavdb5OgXjbWiV24eKkTxJn2IVktSkTCrBTCoe8oqR3yViphKZ8kjCclDuhkHd4jIz1e/rAOuCugdIs/ALzU0yWCcAEdzrIentf1r6vuHvMXVD8C3w2vbe6GfnnPmLtgExJ+nr9MFnXvPkprP0dAiSy7op+TguK6WRTqP6Ay1VK9s/hiQtAqLmNUWcjWMt8RUIMd0isRd2IA== 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=4JSppjieFHxMsU8F7jhZqMFlfT3NPEnAN6j+6fUDx6A=; b=qPHPJKMec3AuHHulHpMFMv8LeC4D8dcMC7ebwPCKOkNpBIwsQCQy9pngELgcJwblFtMXx+KIUgAGSkot6DhCyvgWtXuQ2bswaf+9yfjqjpAUUn8/JaW5/C3PQQt+LMhhwNJFjKg7y6YcVbJB81xgbHiBa57n4dYOgnF9+h9j6AI= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 11:33:29 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9%3]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 11:33:29 +0000 From: Clark Wang To: aisheng.dong@nxp.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 09/18] i2c: imx-lpi2c: increase PM timeout to avoid operate clk frequently Date: Tue, 6 Apr 2021 19:32:57 +0800 Message-Id: <20210406113306.2633595-10-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210406113306.2633595-1-xiaoning.wang@nxp.com> References: <20210406113306.2633595-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 11:33:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 10be54ff-f995-4eb3-d2c7-08d8f8efcce8 X-MS-TrafficTypeDiagnostic: AM7PR04MB7142: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kgMD5QwbHV7ddR66OIyzhEmPMbj124tE9iQxrKmyWEEsfy5rA/6d5h/5BCGtCZsLZP4lDZFUXcPVSVb7b0pFA5MWRy+oY8mEhJ9FmW/AWlB89cK85RWrzR8GrFh199/91jN/WA16tmn6STycK0JR6SpeFO03AcjD2Xi/95QrEwo+tPrz4HkCokm8LlrAVp96kOWIc63eNAHxbC7lS9XbhqtRBzCYL4FudgZS9Xxvai2OrgLFU7Pdt50tAR4oWZQ7Ka44qhl7epjFG3tclwBR2PpW1XQ9UHrLpXXzqO7lDujoxEpSBcju8Zb/ahhgYPOhmeahALwLt99ZFG4Isq5emGkkxR4pCVZr+UHJL3Mf3wGRAAf+16G3fthUjlW2ml7cKkmxCJYcNNXlNUeio03bRLgEihc61hUqqLYZyLkgfLmXbK8T0nKy+HF+2Q7Jm2v0ZNWMlvZgUrgHigs1YDcGko7iw+ZHTEWEX84ZPf9CHxzVuktFnziqVs2BoSN3WAUwBEc9ZlTrPNhCoDRfxN7yGFdDgWA+lP02rttTcz+YQPQm7FuWt5rkaaS6X8l4pnR383uy20zgSmsl0BrfD7i8priQDIjnjYyl9VsXcVen3E5AAGI9bhyhchOo16ExN0YvJjyP4Co7N14NoRmoL+9Wa01fbmr88u7zt/KaT8rv3qZ3P3/K6B2Gp/VLH0ktLxIUmCNEzOjxZM3blUz6cwVJ6Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(52116002)(186003)(16526019)(86362001)(36756003)(26005)(66946007)(6486002)(6506007)(2906002)(66556008)(38100700001)(38350700001)(498600001)(69590400012)(8676002)(8936002)(2616005)(83380400001)(956004)(6666004)(4744005)(5660300002)(1076003)(4326008)(6512007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UMov8cucExiWdelhcgHBKeV0iOhp2lNO0xm/f8D0UGRc2iHVf6MahAXf1ziPTqrTpHWtJm4W9TfJAbm2zb6F/gZSG66ysRRQmciGGoGEiOkz0KHCzza5dmR/iFcSiCw10JASiAcIqBaqiU7cdywGgXzBSmLtu7qz12f7sPjFtHmhVUqrLE0dEDpUQzi2LxIVu0fwFVZJ+xV7I2eCIk64xQ7Z4Fu07RHn5PSAgj8kUoQbvAtET+zeqhQtNnPxIvpyvfVvkFcA/RJ4GkJCmB7WZi3Wk40pr0jYnzJMSaDUjZL+3RlDQJWWeq5E4WpC9wF/Td1ZbZDs0nVijDKTSgagydN17J0ZllT1+FuLzkuiYcZrUiE9W694AfhI56p80uLNGlARHyanv4if3nqzbp/d2GtPeKF9ajvYqB4FtAdEkAhcVV94NS7K0Om/n1Sqb/S61kPCr/zIQhNnYJGFyyfEa3I9y/hJR2YikVobzTJtNnX/fB66J553OwSNnZEtaKrcQ8waIAAr9USUc8camWFMXpN2qzPDlRR3vikci96FD5vbcnLH6/PgFC0JuEtiIDsKzUbPumKB9qvAFYO10bLYcR89MHOe7O8bmpoTAw1MtssiyZk2HJQLTYMe3oQjUIXjICwq7tYRlaI7Gg98hJhNMIUe4l1FQzD/F6/Jw4wo5pocazN2YJhSeIdEPinsPMi2gSpZmdTWXd8LYwEtw5tXyZLrUyO32zSeGdvHcJM+QpKOLT8YG4lbJXzqU6HdVMfmUtHKwaJYWuqJwPEC63pA9oimBcS1Ti63TJ0d0xpWyVqVsHeybfUkn+d+FxdWniZhv+d2pOCtF9LLNJbUEofxRGKGjNzYwy2KlfO9ze9llB+nZWyCPwllIbWmB84SFxXO+aI5WdYwY4n8S+qaX+ZHnB0kycQX46qXOANplsr18sHfOHXIg6pLWb2NV4KuX7/GDRn8eBMKpF6oXGiINhkPK0vSQVVCbDyv9THhsOa+QWduvrWy5TvjM7tJx+KrMg0olPX8EoVwOa3MuAKBIeBBSdWAYXZJ3Wjwc3/kcz9xauRTqS6JketGljJPNc5PnlU5wTMj75qrlDRpwkvf/bYkTrNBBxGLBmwfgjgxvM9bHPRlUlwRWKLWAGPvAmIdvMe+ek+vqmLL5tC+NevPeG/TQfVkuCum8gxInKxYbuJ/e6cpN44xNGmvzPc53LRFjs0pFfca8rvpVv4Qz7BolLzE8ahiIv6BYjVQQmwI+e2DjRudofAaeteDU5hdWM3sZu0pvKlwUzxPYNWrA+CuhP7EGujNeWILgq4huMTxCTj8DRwDWfrWfZ4v4lLjGJz8iWye X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 10be54ff-f995-4eb3-d2c7-08d8f8efcce8 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 11:33:29.4885 (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: 9buxdUVzh7C1JeE2LTzquWKGQSOEmhUAC1CNrp3JlzwzZDQqFE8bMl/kfhQ657pyrzpsxr4ePlX67YPeXDrKVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Switching the clock frequently will affect the data transmission efficiency, and prolong the timeout to reduce autosuspend times for lpi2c. Signed-off-by: Clark Wang Acked-by: Fugang Duan Reviewed-by: Dong Aisheng --- V2 changes: - No change. Has been reviewed by Dong Aisheng in V1. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index dfec334712c2..77ceb743b282 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -75,7 +75,7 @@ #define I2C_CLK_RATIO 2 #define CHUNK_DATA 256 -#define I2C_PM_TIMEOUT 10 /* ms */ +#define I2C_PM_TIMEOUT 1000 /* ms */ enum lpi2c_imx_mode { STANDARD, /* 100+Kbps */ From patchwork Tue Apr 6 11:32:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416093 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, 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 404FDC43460 for ; Tue, 6 Apr 2021 11:33:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 174DC6128B for ; Tue, 6 Apr 2021 11:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245633AbhDFLdy (ORCPT ); Tue, 6 Apr 2021 07:33:54 -0400 Received: from mail-db8eur05on2077.outbound.protection.outlook.com ([40.107.20.77]:22144 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238346AbhDFLdv (ORCPT ); Tue, 6 Apr 2021 07:33:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AHudd42oyUk2lNTxl4MN5Gj/Jw+evsNiGU35uLJrj2d78Plp92ysl+yQ+2hUTJHGYelONilaTzqQ1QdvRAG/JMVVXcPz71g3AeBt4EI4yGbPAmQws4VU4kcuuV4lgioE6i0JlTIGIAHzWRJ7hlj1i62zwEms2+10w8G0MHki4CLeqd9JySRgav5FSh5G0hVgV5fhKXjfRLbdYI5SXw9FJaqHujU6yR5enbWq02LKxwZJ0jdK0Va4raLpNyHGipmc96Y+MMTW0eXiWn84P/CxSnIXY8XO6u5JDbZF6I7G0SgnDvulx25suvyqYVhhnxNCc9x7/vti2zE4fFwjm7AN4w== 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=d2MIbZ3YEqRcZ667TK06dNgpm8V1WHPf/1/2Y4RLyNQ=; b=OChVg7Nq/5I3P9AP7X2H8gqXteknN0C1wHuwX9xy2qDbKcsER6sG/vu7zn2SCbIHBHuOYaWOiRDCrRS5xkseyyHk5TqvqbIV01FElw8Byne7tECf6DFRKhLiWoJZYRkDHaqWr5FJqugQMEjZEvVQucBPRG11EJQwTOypc+V5DYBUuKWJ4qSeokgMo5WWyrQ7SBJccs3CAg+UGFLW/RfXInfdFYGyiVUmSK2rGE5QK1LWfz/U3rfJUdAk5LPscflOBKN6MgJ3qOD/vPhs4z8vRIxWbQBNw7jrluBf+pW7fQWKeskyXTvtCosBfT2Fo103piNLTyHeQwSAFCi1K0LEdQ== 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=d2MIbZ3YEqRcZ667TK06dNgpm8V1WHPf/1/2Y4RLyNQ=; b=UrDKVgo7tUq1nfuryzblmkWCypVNWZ7+F5z+6B4vP2E8/nWg/fLU/oxkVPLwVE4HQ0/4bIBDYOwsk1POeRocaE9HpcxRO+TQ/Y7LCAOqbDChw+g31DDCblFTcs+054Y6AwNkzUyfFO5lK1ajdJ8ja+LWqcXpyc3rp2r3YSoIcNk= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 11:33:36 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9%3]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 11:33:36 +0000 From: Clark Wang To: aisheng.dong@nxp.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 11/18] dt-bindings: i2c: imx-lpi2c: Add bus recovery example Date: Tue, 6 Apr 2021 19:32:59 +0800 Message-Id: <20210406113306.2633595-12-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210406113306.2633595-1-xiaoning.wang@nxp.com> References: <20210406113306.2633595-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 11:33:33 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cb674880-827f-4227-5de5-08d8f8efd13b X-MS-TrafficTypeDiagnostic: AM7PR04MB7142: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:854; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SwQ9h6pd7ZOFCubcekgCnyVV+aTwUT8i8ZaMJdTeVzab6R1Ko0FdeYN/8KUjdn7ECsvR6Cr7yEfnTJBPaWjZ8vqxR4xB/kWXFfORXT5zee8bMeeCwo2BrlW6gN7jrXBSTyIAV439vCX4esyp4pTGKix0mP+0FjZpulu2eZYr2h560JNvwY2Z7IAjgddsGWJXfXI0ojKLg9HJzd+YzGtWhLdJhRc0XyFLtAQbf2VIk39Cy7hsaQTzyx5LenK6NCD3Saj8KgRzZ6fICSXSfcfjw7CZjNgHoPJtjbiXlzpT5S5jd+ecA9FzGgscEQqOyarxDqD4AqYaEZetRxCJsukBdX6RhlRM4OzWdGRVzDExI3Glajgsg289wJRQM5OOOYL/jpvNeA0bQNJtto13CmSaDTOum2Ieu0PbJiHC8E4kqNCdqBjHn9VeuTIZzm9FgpIGVjM47Yj01VNSVCaRuCDTmfKqMCzlreyA9m7x93ZhwUrWNRkDdVrQGC4cmdJnFxBz1MORqf66SYvOofoOMY/07AE6mrBiEuarJ+wlzvl9SUm+RohYHbWjlWODUWvXbX1bqsQEK38zrxZQFP1LD9SfRXCAOd3Tu4d4THOrRcUS4pGk9E2x1KvQz7rT1T06fFdWEempuhz0o4c1WDsC2j+MP1MWxZatdbAK++lPdq5gDi04GRzKDSTCxlzI8lQo5bt5rKg3D+eSyNhMCCqhKn3nSA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(52116002)(186003)(16526019)(86362001)(36756003)(26005)(66946007)(6486002)(6506007)(2906002)(66556008)(38100700001)(38350700001)(498600001)(69590400012)(8676002)(8936002)(2616005)(83380400001)(956004)(6666004)(5660300002)(1076003)(4326008)(6512007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: vQlPcnZ8+LKQBR2Vj7ft7bCkD2HM35xATyuREqn17Glca5Bg3bJLwd6mHNuPYVRdXz1ttLk5xjZWPHmZJt1V8uo8kqinkBtt4VKmInXNJExrVgZIKIKSJTU/EB86l/a2mg1KT7tm8UDOjKE/JbKuuE+tfH4aKYqYZB57cpj2TpwtEBqDB2Fx5xHVMSo80xPrhwBPGxjjo33BYgzUCuaOb3Oijzur+rEZE6RjUSGV1SAXKtwq/mjeXEl8o4g7yZoV9/oZpP6koiDuoCnN27RNmJGzvDtm9qvsr+ryMwt4FF4+jffX231czq3ifbuobasMorqnce437GXqXaFsKZEVqfVRwlyrGbHTzVs6zSUBUbOD9NZmJp/U523M8SCf7H/LkYpTc/wTSELDagoFLTVi0BSqYMd+KdLAK2xsAjoighD5+b5GBAQkr4w65xab6Mi1OIfHii8mPMCtR7dbV08KtckXgdr6n4MWuEZdg3YRcEruV98IrbV/6rgBiXCO6ziam8UG7cayU1EGAQ0Av0OK7mJ0spy4l58fZJo6kRNcO+vl3T3UXIKam8hhdcgDgBsD3rzYENJKGqdtJA1zd0mbVjy3MWTcCs9IY4cxjlW10EIt4InGLg2NxhtKFjwdLiNyr7pVdtGafw3Vy+tfYP4Tf2vJTsia3oUbBOeNhh4vfjWqIhQlmA11vXU5ZOMBcqdQgM80rVxoguuTtth0JoszfGX5t0gwaeiPjghYY0CXSv6cMgCZSmFgpmzFZMz7+9NGuKoCkNypKx3VccOC4rryG+o6N2G4+iSBYBx624+FfygQczmgAoUq59z5V+jHw96+rY/2RG6StfKiCjDaXoJJN5/esteLk+rt82L5IQRZzJqIJA3isSqu5GYKBVHyQJTYdESJJHCp6D4rAGZS9GsAcdXN1JIt9oqdSslSVI6QZgGkjVSFaMpeqwCljVZIAmvlSe+HUPrb6xhLbVHmHpdITJHdpwG6ltQlHYKZMXK71Sk/lMHE0ecryO813myf9KqWhpMzqm78QJGn2fPTheih5KT+MQZuRgW549U37aq2IQmvyGJ49o4m5TF22uShaYzp8Wh0rvxY7OKQKDJgJwdqhYQTAfg+ZxsWBhUbmpRQ3cnvt7q/R+ioIBpqAVEB9i227LblziQlTHx8nKq214W/5xwyumpZZyhGngay/BIgLFu9IyVkk8vE+lWzG72xGhcBIuxNFCpewPsXsGw5dTy/Sru4moPc8ICNUjppDnYC+R/W+ttl1yKQu/Yy/IfpG8L1PuGRVCnwdc/xIHmLWkTS2+hK+Xc9RDO2EncD8/OJlRsKNAZoF0lphuU4GC1sGIqb X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cb674880-827f-4227-5de5-08d8f8efd13b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 11:33:36.8233 (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: TkRXL86STo/RQ8jsJMpI5FPw0AcypmBmQtmsqABqyVfBgPnxZI/bNeJZe85o6oE01I9iP5EuqvIYbx/Pcevpbw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add i2c bus recovery configuration example. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- .../devicetree/bindings/i2c/i2c-imx-lpi2c.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml index 29b9447f3b84..0a4b28827dcc 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml @@ -42,6 +42,15 @@ properties: power-domains: maxItems: 1 + pinctrl-names: + minItems: 1 + + scl-gpios: + maxItems: 1 + + sda-gpios: + maxItems: 1 + required: - compatible - reg @@ -61,4 +70,9 @@ examples: interrupt-parent = <&intc>; interrupts = ; clocks = <&clks IMX7ULP_CLK_LPI2C7>; + pinctrl-names = "default","gpio"; + pinctrl-0 = <&pinctrl_i2c>; + pinctrl-1 = <&pinctrl_i2c_recovery>; + scl-gpios = <&gpio5 14 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + sda-gpios = <&gpio5 15 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; }; From patchwork Tue Apr 6 11:33:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416092 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=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,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 B0626C433B4 for ; Tue, 6 Apr 2021 11:34:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8839C61396 for ; Tue, 6 Apr 2021 11:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245666AbhDFLeD (ORCPT ); Tue, 6 Apr 2021 07:34:03 -0400 Received: from mail-db8eur05on2077.outbound.protection.outlook.com ([40.107.20.77]:22144 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S242991AbhDFLdz (ORCPT ); Tue, 6 Apr 2021 07:33:55 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NMskF6Q1QCqJfPdTiys4+IcAocHfjHF7LATrIz164AzliptF2iWEskop67zf1kDvqEUDQe+rL8b0DBiVXyYGNwFiiU3YB/rGa+xCrWejcyx440TTfOO7z3FRUI712dLQcjnbKQlGDVozJGgTLIrRWNwrjGD8C6XE8LdwfSOHhL348XV+6z7MMMRBnmH5OmtgxIqR53qBe/Z3PsXya+SPrX871FZUfwCxs1GMHddRayXct60dvXDs640elJ9a9A/O1O2qWnNh7O5KgDO2D24chLorno01lFR8/4/ZjPh4ITfxU8IIK9M0/5dMn2R1vzZWmmt39l/Wgv/Qcjk1BwJwQw== 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=/raBy2/SYN4Ubz6Mq9D1SysCyJwQrph9ttm4A2kPYDg=; b=fh6Wt8E90q2RTRWW1DLfyWrK+/6UHjJK1Dil1Etotb60sf9mS1ybTVLs8XnFmugl0Y/iL3XlWXUSVxTc7hoeNc16qsQWdWktgovnmrrnxxicQRXq+eYBpusB2BaMf1/RSmeSbwijPGpsBnloMw1c+SiTZdleVo3b4IdspN6xqwout+Y0SR3M8zpD98aDgEU7Mw+Y2QhSIgkdo/OTUN1mO6WHjTb1ik11oKiit6UQzXiVCV/eZsadU3XTYvjCVqGSiKKxnN68Z6d5fVC3l1DtEbCnAVlib/MsZwQUAmLz6p7n57gNDDhdePcWcyzEFy7M3duaROvyXIRiN0mGtEJbOg== 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=/raBy2/SYN4Ubz6Mq9D1SysCyJwQrph9ttm4A2kPYDg=; b=T3sEqU5FvApgmeUG8OEeevjYter9dFNcpOcvjsHo0JLBVthKHXDDC5YlHyiLlqTag8PDqqhOFsPTDYuDj50JK2ZspusL9QwY/LSQXK8/vNh7WT+dZrnL0m4N318dC6hZPUadGlRl5qbRl3tRv6HFL1j/LrJfXVA9HdYNCmMv1jA= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 11:33:40 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9%3]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 11:33:40 +0000 From: Clark Wang To: aisheng.dong@nxp.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 12/18] i2c: imx-lpi2c: fix i2c timing issue Date: Tue, 6 Apr 2021 19:33:00 +0800 Message-Id: <20210406113306.2633595-13-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210406113306.2633595-1-xiaoning.wang@nxp.com> References: <20210406113306.2633595-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 11:33:37 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b3a34441-06ce-4a19-64c3-08d8f8efd380 X-MS-TrafficTypeDiagnostic: AM7PR04MB7142: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3968; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T1co7XJYGL+cFZ68VLBtgTlegdnd8KZtZYBIzAGd6CQT9X5cHRhAziWTqm0/ygUHpXgzwxmfMfIpvow5K64OoTbEbteOv3AR90R+aWLRHei0kZogdE4sAkTS+tI9yioIwUmr8jTIuWN5QKppWzO/Z6VBA9vsm/A6LcI/tyLw1D42mx4c0zaMApaFFsAkCBOOV3lcpwauHsesu4Qo1Z74b+OOQdyVnSQwtgG1aOH5hv333v3Y7v4AZkk66r4yxdtFiRmDgFKG5u+9IvMpKjRW0BMTVFmOix0sp4HyYJtbICrzC35wjWKQNOLNGIf6tjQW0YSHrN5yYwW3C7QkYbEY+Fjkjpc0LTQX8G1o45FsI/pcHRXlwhAgLCQmPfgxc1OdjGN8HoTjqa3UrrVc7dm8zKuc6w1kHMCYbJYLDKlT0o2kjkxPs/jYToJPMjtniYzaVF6FmGe2qz9ibbtpDIF7FXPj7rYUQZY3f4n5N5Alw2+iQRA9Wuat63dFfGaMDGbIHSwriusSxaGLQjuq5mo0Tp8Mpl8rGO9bkkmv9EEG5Kmny+ng0Lb0Ub0DPs8fcQg2sMPKL4nbGJkuPVPCvF0HE0b03C510zYv8TjocGwqebp2wMdqKqbogm+P5fRkSKtFJKM1aeRUV3TNmMzukC66b0fY9G27l+tsDmTJPtHrjPyA1OM7ptLMqDOlcySDwTo5GTgsgUsJn5jwl1DrIbaxZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(52116002)(186003)(16526019)(86362001)(36756003)(26005)(66946007)(6486002)(6506007)(2906002)(66556008)(38100700001)(38350700001)(498600001)(69590400012)(8676002)(8936002)(2616005)(83380400001)(956004)(6666004)(5660300002)(1076003)(4326008)(6512007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: OekcA8b8x9wiuLfoQUlNb8EfqKKF0vrqv6wx0V4QDDB4wwtRCOs1xm3vxM86WUMMpwvYqM361nOQuw3W4q+zn4A/0rFL2MRxXnNApjWK0s9MAU5CrlfVatYnOHJisGI/Yfzic3rzKWALoywFob8y7HBxiul/75t0bKQ3N7YmUm3+LPrncbqwUusEiSl06dE8LqNfc9SWNBC8SiAkDBveTfaY39vvanak328CwWGJdpth0893jzDrEv19hgbQd/5R0vyjIQ6hJVK6li1OaRbTmC6SoN698Ms1VH8cMB2ugm2AaZMXIFZIoZvR4rhzAl3/u2YjDV49ZsApaDU2I1YNxMx5c3LBy3QjS+k2H3NNTXiAxr7tgFhU5H1e000ZSakY5AcPcW9/VQ5/uCaVodxL/cPx8pfTZ5B1+Es/iU2p5jXjGxErhEK8cKBHie3CtoSG16GRIdbBAJIIYf2+XHEINYo2JdY0R099IRmwCS9rQFHvpcsZv75hCzj1MrUJ9Ns4vFN5VF45wKsbgaOvggDWCaQNVfSTunMGA6L5TLYzsdAFk2tw+7tmbI5o70IDIQ9aTQcciPykvgJAch1RdZIQFXsUPoywaXAl97rddxDn+Z06fYIlDRo1uX8aMgUohIw0wuTa/yXH+ypGr8jiatK8OiS0N1bSWLqsVDq7ucp2ApbiIMzr6w/j1CwIWQqRXt+bCP4Eq3Kl+GVBk3Z2ioEh7iPLvYMWtsT6jaeLKi3l0LG1loC8v03WI0CS9DY0WpkagFt15o+GcrVQV+hGLebwWiYtF+maKYp8w5nsQ+KmWvo23b6kq6njF6B9XZ8iVHrvT33R/5eMUQfB9ZkjuqaNaio47DLwP+PriwlTD7sULVC/GsA0aW57piSbcEpS/EvGKCmGSqv7+kIJqH0AVRqQtikWtGe2UvQytqwUPwW9/p8E9FWJHMQct3YfJv0qKaMIIz+QT/MkmFzrSQq5sQv2y7fXdIGDzUQbSfMorGlAM8U3RSCPCdZOkCp1R8VZ3YSmp09/hslBvOTZcAE7/H3HAL95saiAtEv/XDNzY5NhMmBElVMbrTapcceoO1xFtHk1vnIz9Oky+VObXuOS267cfJEysoJ5r7kAfHDz7KqB83PB2MdALa/ym7vdVYezTyR5JVJNFV8Gm5kI/ZZzDxAUmrg+NPi8T+HhxR6ntl3bYxcRdLOWwYKf2QTjiYlzMneM1Hxs22XclDKw8mAOUQSMKiY5PLXxbJTnHdpFoJIPMM6tNQInLrVJVAkDAjs4QwheY86PCAmDzVSE6BvNeHlv1zLhI7BLs4SRQKQ5JnjB6rjQpZPFWHY+5X0Peijvi14f X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3a34441-06ce-4a19-64c3-08d8f8efd380 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 11:33:40.3723 (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: l/1Ne6+0yVpUpUPxQtlotePDo7bCzfRPdwyzS6HWJBEDfb7KmNjrqBds/E8eQ5NutlATNS+vRQ6DZCaFM2F2Fg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The clkhi and clklo ratio was not very precise before that can make the time of START/STOP/HIGH LEVEL out of specification. Therefore, the calculation of these times has been modified in this patch. At the same time, the mode rate definition of i2c is corrected. Signed-off-by: Clark Wang Reviewed-by: Fugang Duan --- V2 changes: - No change. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 77dd6ee5a4a8..d124c4000823 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -73,17 +73,17 @@ #define MCFGR1_IGNACK BIT(9) #define MRDR_RXEMPTY BIT(14) -#define I2C_CLK_RATIO 2 +#define I2C_CLK_RATIO 24 / 59 #define CHUNK_DATA 256 #define I2C_PM_TIMEOUT 1000 /* ms */ enum lpi2c_imx_mode { - STANDARD, /* 100+Kbps */ - FAST, /* 400+Kbps */ - FAST_PLUS, /* 1.0+Mbps */ - HS, /* 3.4+Mbps */ - ULTRA_FAST, /* 5.0+Mbps */ + STANDARD, /* <=100Kbps */ + FAST, /* <=400Kbps */ + FAST_PLUS, /* <=1.0Mbps */ + HS, /* <=3.4Mbps */ + ULTRA_FAST, /* <=5.0Mbps */ }; enum lpi2c_imx_pincfg { @@ -156,13 +156,13 @@ static void lpi2c_imx_set_mode(struct lpi2c_imx_struct *lpi2c_imx) unsigned int bitrate = lpi2c_imx->bitrate; enum lpi2c_imx_mode mode; - if (bitrate < I2C_MAX_FAST_MODE_FREQ) + if (bitrate <= I2C_MAX_STANDARD_MODE_FREQ) mode = STANDARD; - else if (bitrate < I2C_MAX_FAST_MODE_PLUS_FREQ) + else if (bitrate <= I2C_MAX_FAST_MODE_FREQ) mode = FAST; - else if (bitrate < I2C_MAX_HIGH_SPEED_MODE_FREQ) + else if (bitrate <= I2C_MAX_FAST_MODE_PLUS_FREQ) mode = FAST_PLUS; - else if (bitrate < I2C_MAX_ULTRA_FAST_MODE_FREQ) + else if (bitrate <= I2C_MAX_HIGH_SPEED_MODE_FREQ) mode = HS; else mode = ULTRA_FAST; @@ -209,7 +209,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx) } while (1); } -/* CLKLO = I2C_CLK_RATIO * CLKHI, SETHOLD = CLKHI, DATAVD = CLKHI/2 */ +/* CLKLO = (1 - I2C_CLK_RATIO) * clk_cycle, SETHOLD = CLKHI, DATAVD = CLKHI/2 + CLKHI = I2C_CLK_RATIO * clk_cycle */ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) { u8 prescale, filt, sethold, clkhi, clklo, datavd; @@ -232,8 +233,8 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) for (prescale = 0; prescale <= 7; prescale++) { clk_cycle = clk_rate / ((1 << prescale) * lpi2c_imx->bitrate) - - 3 - (filt >> 1); - clkhi = (clk_cycle + I2C_CLK_RATIO) / (I2C_CLK_RATIO + 1); + - (2 + filt) / (1 << prescale); + clkhi = clk_cycle * I2C_CLK_RATIO; clklo = clk_cycle - clkhi; if (clklo < 64) break; From patchwork Tue Apr 6 11:33:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416091 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=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS,UNWANTED_LANGUAGE_BODY,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 5F68AC433ED for ; Tue, 6 Apr 2021 11:34:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 36DE261399 for ; Tue, 6 Apr 2021 11:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242921AbhDFLes (ORCPT ); Tue, 6 Apr 2021 07:34:48 -0400 Received: from mail-db8eur05on2077.outbound.protection.outlook.com ([40.107.20.77]:22144 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S245662AbhDFLeD (ORCPT ); Tue, 6 Apr 2021 07:34:03 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fHowY4JUGwXBwNRIIGQgn20y/cIoJdKqxfSNzrgwRTETaSYJMyyhOB6CVmWDyZVMm0vtmlxRxc3IjYbUYTh6MkPjF2gFCx2hnn194tq53t7aEVtxs0ENFpGzG7FSbjYszr0TewLhdK9uXML7WB/zbg6xL4lisqeNYiM/0fL4I6+z4+alUKe6x7TS/F/nEFrns8gEbiB0YYrytMM7Ga9acl/Dk/2TZ/abcfYqRWMcLnS1+N/4bOKNyObT2cFaGRDqmV3Qb13Yklkne9xM76MD81rTcUsfK/sijO2eoIa3HAOaGO54K6nKusNuZZ/cyHAt4+gU6cp83wkByXqZYo6S8A== 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=PJgHL/hV5EBgRKFYGPVT5eQ7si2/5oigY9LOwihNR5k=; b=GO2SrtcLFJSFsalczUEr2IcWynyvPrah7lSpM38yWVZUvmtEywgDY9+R47+cBos1NK+GE3VEr8U2oWFSjLRPcXU9KCPoCRsdzZd4YR+QXbtVxR8nRrpWsnwCbhPNMMJoS6y0evQ49ML1dzS6VYcbpoYc1GpUmmWRmqLhdHPcbqGF4fv/y+JSU0O4u2FPL7IY/lVMRJwADw2MYbh/E+3DGcfGXyiylw4WBkL5o0PllGZpaRNwquARg2Z0DWx/9upBVcCKjVhALGABWvJX6/ej4GDgtSydrpzESHzZ/0x2YAVyU/4NEwA9QfOt+uL90LLKy8dVvU2NtEr9NfbRA4/KbA== 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=PJgHL/hV5EBgRKFYGPVT5eQ7si2/5oigY9LOwihNR5k=; b=c52atin0T/1un6uBNVop5yIux7ZkUfGVyahHIAUcaxdcjF7eSafJajuaw8o1cZ8cWQmvd9rRuXhfU8TDahjC2mC/IPAGRISo98gHC9MkLhQecI7gAUm8xAeUnLFPdKtxmCDzVlummklguZugWLAUK8C7NpHc2Pc+WK+7GLnj/NM= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AM7PR04MB7142.eurprd04.prod.outlook.com (2603:10a6:20b:113::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 11:33:47 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9%3]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 11:33:47 +0000 From: Clark Wang To: aisheng.dong@nxp.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 14/18] i2c: imx-lpi2c: add edma mode support Date: Tue, 6 Apr 2021 19:33:02 +0800 Message-Id: <20210406113306.2633595-15-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210406113306.2633595-1-xiaoning.wang@nxp.com> References: <20210406113306.2633595-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 11:33:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 74bb926b-e9fa-4596-d122-08d8f8efd7d7 X-MS-TrafficTypeDiagnostic: AM7PR04MB7142: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tbfF/JqIFSDcg4zunf9GT8i9kTgN7iMnRrMVo4mMifDIcWiyMi6QbrUBdHe4BnjZfXtJUjSnnkaAqdc985U+p7thNURoGhOmXsH851Yb1hMhi8MVob/REV85BIgMY3hvCSa7F/KLkHhsvPfOESa+N2kLO+gB/W9p3eG41JcoIsihCDsTE2d5Aez8BioL0V89gdIrriWdD22M/rjUsa11C73zCdRuLXsgjTpLkvGIMT3p7odRs4+VYrkL2C+ci+26wqjIwgjOGQBw5dpd9GUCc1ULosWep83X6AR6+gJWxVGz77B5CMP8boDxL4udGNXGWKxhWcPb7cKm8qtujABD3L7ucAYJDGFnwgj3EXlkGyLmdBa5i0aNV30OXTTVY/k/vyU1Glguwe0EBmxImsRZBO7jC9oVf7xWOdvWdvxh0mPqKxbwyMY3fqcsg5UkoYwqr81b4g7Zs5qC+UUrzlfxSNFlHf/8YPpTBGkmXdbswYhmMjv7Gqiz5SjF/32XWvu+FYSBuDjteUojN/sqkT4rx5Exg7C3O6iupgz3TylpNr62LI3mElLCoPIwb5S5u8o5ljVQAJKU8jmz3oC9pjSOtRbCnD5hqpaMsqCqWCmjZXiKHMN8v6p2Yd1kdrh0DmfkwqxVG18vP+28O55WHYK3kH0A8G2BhQpqyFYXEJPcjLIZPIaFJM6/xqG5N/BYFuASRU5MYJ7sBktxo/Zr/GxtZg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(52116002)(186003)(16526019)(86362001)(36756003)(26005)(66946007)(6486002)(6506007)(2906002)(66556008)(38100700001)(38350700001)(498600001)(69590400012)(8676002)(8936002)(2616005)(83380400001)(956004)(6666004)(30864003)(5660300002)(1076003)(4326008)(6512007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: fPf2lUS+vkfdV/mF3URnlIvv5PX6aCBvt+0FYb+XAaO3Jerxz/9bHzVP93MkI0WKLVTC8XLGR2j/RROIovcbHpYeOL4kbTqifRv/hYIh+k67uEbTAN8oS65khBgMg1JCzsnAhB5lkPGL8p3Ib6q263o7vfBgD4Xo6KFxvOrgjmn/3tC6mMGnoMlN+6ufgnxLAlJuELbj/IQgIhgC5r+TSfXO9RylGjyXssCwNokyvBsoHsKnvYd/AffdPv2e1D/9ntOmvRMyolu3qODqieejwq8WoP3W/IKVaDKt6TKG4660xt0uE/16CDw5UNYDJrR3lF2X/sJL+/F9yU0TXveKYoJEUvna4qlbB1XrkNUE8o4oe9gV0yhP1+DghsrTiia4ciMyLCQdgsam64WBSSfrDl0dPpbxmGgr+XYN9L47jbN739q3QQOsDHjStVsaw3U7tZ1lv9uKCDOnBVYt+du5rY8VSqTHr9wPLU4i+UDNGLqOWnVf2p2E85yUAoPOWqhE3Yy7/JD/t6m7jkgCT0dYDb0qkbZ4QaqueVmDhcg2c7z0UZvDYZkr5/9z2lmIAR8LacRRArLan+YOdiAFUiHCBvKyww5rA6L3aQdP90LxMWNSPeFqD86ZSeE9SeOt0yfRNdQQVA1+NkhUPHcvnBlcL2PqMoJ/PSB6ZWVlaM7IhCRom8u72pLP1SV8/pguTQRiy8ipOVU4pXJHOS64/bV12aCjVMSydNwyRPlPru0g0y/ddcHww+ghQM0bK1FV68FkJNL5UUgE/uQZ/ZuwrY3otN3kKYAt8/4TDTlWbqKo8g1rS4Pxc33L7nj6YN84x4Q/lnradky3Z4Adf+WSUT+TQw7TbJfcnvvpHu6ST2VhldXoFNnLMo+zh4zL67zuYfywJK+LpetslkrcAsLfj/aMR4Ok5qamYN4loAwKmuwYIDCoU1axqlV1MrPjGDtQLSwCNGA8HetOHcupjS7cWInsABiJwDl5V6QKUXM8uJmr1OjWGue+EXiOPRP97voqfuy9jTZEYuauyFpwzyPBoJOuuwm315ycJxmd86xS3OaMw3pbKwvjIolO/KFEl1mccgBsMh/qfvc+TSx5ZFe9U/wyz4ajY7X+deCMAJtutXP9Aje4FnpMXEQnr0nheOBN9owWpEuiLFNtQaPvqT+WV+JHm3EZlbE/Dl9bckLrHQZIKjJzEHbLhRtf9/aVkzyJRWrW9Zszye9vmqQU+BBpRPcuGFpXv0kWfhHNM56Z8vdD/iLIC8HVKDUVASUZ7faQwNjrt5Rclr4Fad8IlQ4sN/4IhQPrIWlgUMCAX+Uoxm9MgkBa74awUB/ZxZB/cJUT/GpF X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74bb926b-e9fa-4596-d122-08d8f8efd7d7 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 11:33:47.7011 (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: 5jkGFQg6Pw66ryMthRdQZWlSHFCiumJstNZ0BKJmWIPpvC6kHdoY7SkIwaljFs+LhPRa0MPLnWxVWtRu8zMDxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add eDMA receive and send mode support. Support to read and write data larger than 256 bytes in one frame. Signed-off-by: Clark Wang Reviewed-by: Li Jun --- V2 changes: - change marco I2C_USE_PIO to DMA_ERR_I2C_USE_PIO. It is a error code defined in this driver to --- drivers/i2c/busses/i2c-imx-lpi2c.c | 290 ++++++++++++++++++++++++++++- 1 file changed, 288 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index c2f8e49660ea..d1a56d52f19f 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -8,6 +8,8 @@ #include #include #include +#include +#include #include #include #include @@ -31,6 +33,7 @@ #define LPI2C_MCR 0x10 /* i2c contrl register */ #define LPI2C_MSR 0x14 /* i2c status register */ #define LPI2C_MIER 0x18 /* i2c interrupt enable */ +#define LPI2C_MDER 0x1C /* i2c DMA enable */ #define LPI2C_MCFGR0 0x20 /* i2c master configuration */ #define LPI2C_MCFGR1 0x24 /* i2c master configuration */ #define LPI2C_MCFGR2 0x28 /* i2c master configuration */ @@ -72,11 +75,15 @@ #define MCFGR1_AUTOSTOP BIT(8) #define MCFGR1_IGNACK BIT(9) #define MRDR_RXEMPTY BIT(14) +#define MDER_TDDE BIT(0) +#define MDER_RDDE BIT(1) #define I2C_CLK_RATIO 24 / 59 #define CHUNK_DATA 256 #define I2C_PM_TIMEOUT 1000 /* ms */ +#define I2C_DMA_THRESHOLD 16 /* bytes */ +#define DMA_ERR_I2C_USE_PIO (-150) enum lpi2c_imx_mode { STANDARD, /* <=100Kbps */ @@ -95,6 +102,7 @@ enum lpi2c_imx_pincfg { struct lpi2c_imx_struct { struct i2c_adapter adapter; + resource_size_t phy_addr; int irq; struct clk *clk_per; struct clk *clk_ipg; @@ -114,6 +122,17 @@ struct lpi2c_imx_struct { struct pinctrl *pinctrl; struct pinctrl_state *pinctrl_pins_default; struct pinctrl_state *pinctrl_pins_gpio; + + bool can_use_dma; + bool using_dma; + bool xferred; + struct i2c_msg *msg; + dma_addr_t dma_addr; + struct dma_chan *dma_tx; + struct dma_chan *dma_rx; + enum dma_data_direction dma_direction; + u8 *dma_buf; + unsigned int dma_len; }; static void lpi2c_imx_intctrl(struct lpi2c_imx_struct *lpi2c_imx, @@ -289,6 +308,9 @@ static int lpi2c_imx_master_enable(struct lpi2c_imx_struct *lpi2c_imx) if (ret) goto rpm_put; + if (lpi2c_imx->can_use_dma) + writel(MDER_TDDE | MDER_RDDE, lpi2c_imx->base + LPI2C_MDER); + temp = readl(lpi2c_imx->base + LPI2C_MCR); temp |= MCR_MEN; writel(temp, lpi2c_imx->base + LPI2C_MCR); @@ -462,6 +484,154 @@ static void lpi2c_imx_read(struct lpi2c_imx_struct *lpi2c_imx, lpi2c_imx_intctrl(lpi2c_imx, MIER_RDIE | MIER_NDIE); } +static void lpi2c_dma_unmap(struct lpi2c_imx_struct *lpi2c_imx) +{ + struct dma_chan *chan = lpi2c_imx->dma_direction == DMA_FROM_DEVICE + ? lpi2c_imx->dma_rx : lpi2c_imx->dma_tx; + + dma_unmap_single(chan->device->dev, lpi2c_imx->dma_addr, + lpi2c_imx->dma_len, lpi2c_imx->dma_direction); + + lpi2c_imx->dma_direction = DMA_NONE; +} + +static void lpi2c_cleanup_dma(struct lpi2c_imx_struct *lpi2c_imx) +{ + if (lpi2c_imx->dma_direction == DMA_NONE) + return; + else if (lpi2c_imx->dma_direction == DMA_FROM_DEVICE) + dmaengine_terminate_all(lpi2c_imx->dma_rx); + else if (lpi2c_imx->dma_direction == DMA_TO_DEVICE) + dmaengine_terminate_all(lpi2c_imx->dma_tx); + + lpi2c_dma_unmap(lpi2c_imx); +} + +static void lpi2c_dma_callback(void *data) +{ + struct lpi2c_imx_struct *lpi2c_imx = (struct lpi2c_imx_struct *)data; + + lpi2c_dma_unmap(lpi2c_imx); + writel(GEN_STOP << 8, lpi2c_imx->base + LPI2C_MTDR); + lpi2c_imx->xferred = true; + + complete(&lpi2c_imx->complete); +} + +static int lpi2c_dma_submit(struct lpi2c_imx_struct *lpi2c_imx, + struct i2c_msg *msg) +{ + bool read = msg->flags & I2C_M_RD; + enum dma_data_direction dir = read ? DMA_FROM_DEVICE : DMA_TO_DEVICE; + struct dma_chan *chan = read ? lpi2c_imx->dma_rx : lpi2c_imx->dma_tx; + struct dma_async_tx_descriptor *txdesc; + dma_cookie_t cookie; + + lpi2c_imx->dma_len = read ? msg->len - 1 : msg->len; + lpi2c_imx->msg = msg; + lpi2c_imx->dma_direction = dir; + + if (IS_ERR(chan)) + return PTR_ERR(chan); + + lpi2c_imx->dma_addr = dma_map_single(chan->device->dev, + lpi2c_imx->dma_buf, + lpi2c_imx->dma_len, dir); + if (dma_mapping_error(chan->device->dev, lpi2c_imx->dma_addr)) { + dev_err(&lpi2c_imx->adapter.dev, "dma map failed, use pio\n"); + return -EINVAL; + } + + txdesc = dmaengine_prep_slave_single(chan, lpi2c_imx->dma_addr, + lpi2c_imx->dma_len, read ? + DMA_DEV_TO_MEM : DMA_MEM_TO_DEV, + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + if (!txdesc) { + dev_err(&lpi2c_imx->adapter.dev, "dma prep slave sg failed, use pio\n"); + lpi2c_cleanup_dma(lpi2c_imx); + return -EINVAL; + } + + reinit_completion(&lpi2c_imx->complete); + txdesc->callback = lpi2c_dma_callback; + txdesc->callback_param = (void *)lpi2c_imx; + + cookie = dmaengine_submit(txdesc); + if (dma_submit_error(cookie)) { + dev_err(&lpi2c_imx->adapter.dev, "submitting dma failed, use pio\n"); + lpi2c_cleanup_dma(lpi2c_imx); + return -EINVAL; + } + + lpi2c_imx_intctrl(lpi2c_imx, MIER_NDIE); + + dma_async_issue_pending(chan); + + return 0; +} + +static bool is_use_dma(struct lpi2c_imx_struct *lpi2c_imx, struct i2c_msg *msg) +{ + if (!lpi2c_imx->can_use_dma) + return false; + + if (msg->len < I2C_DMA_THRESHOLD) + return false; + + return true; +} + +static int lpi2c_imx_dma_push_rx_cmd(struct lpi2c_imx_struct *lpi2c_imx, + struct i2c_msg *msg) +{ + unsigned int temp, rx_remain; + unsigned long orig_jiffies = jiffies; + + if ((msg->flags & I2C_M_RD)) { + rx_remain = msg->len; + do { + temp = rx_remain > CHUNK_DATA ? + CHUNK_DATA - 1 : rx_remain - 1; + temp |= (RECV_DATA << 8); + while ((readl(lpi2c_imx->base + LPI2C_MFSR) & 0xff) > (lpi2c_imx->rxfifosize >> 1)) { + if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(1000))) { + dev_dbg(&lpi2c_imx->adapter.dev, "txfifo empty timeout\n"); + if (lpi2c_imx->adapter.bus_recovery_info) + i2c_recover_bus(&lpi2c_imx->adapter); + return -ETIMEDOUT; + } + schedule(); + } + writel(temp, lpi2c_imx->base + LPI2C_MTDR); + rx_remain = rx_remain - (temp & 0xff) - 1; + } while (rx_remain > 0); + } + + return 0; +} + +static int lpi2c_dma_xfer(struct lpi2c_imx_struct *lpi2c_imx, + struct i2c_msg *msg) +{ + int result; + + result = lpi2c_dma_submit(lpi2c_imx, msg); + if (!result) { + result = lpi2c_imx_dma_push_rx_cmd(lpi2c_imx, msg); + if (result) + return result; + result = lpi2c_imx_msg_complete(lpi2c_imx); + return result; + } + + /* DMA xfer failed, try to use PIO, clean up dma things */ + i2c_put_dma_safe_msg_buf(lpi2c_imx->dma_buf, lpi2c_imx->msg, + lpi2c_imx->xferred); + lpi2c_cleanup_dma(lpi2c_imx); + + return DMA_ERR_I2C_USE_PIO; +} + static int lpi2c_imx_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num) { @@ -474,6 +644,9 @@ static int lpi2c_imx_xfer(struct i2c_adapter *adapter, return result; for (i = 0; i < num; i++) { + lpi2c_imx->xferred = false; + lpi2c_imx->using_dma = false; + result = lpi2c_imx_start(lpi2c_imx, &msgs[i]); if (result) goto disable; @@ -482,9 +655,24 @@ static int lpi2c_imx_xfer(struct i2c_adapter *adapter, if (num == 1 && msgs[0].len == 0) goto stop; + if (is_use_dma(lpi2c_imx, &msgs[i])) { + lpi2c_imx->using_dma = true; + + writel(0x1, lpi2c_imx->base + LPI2C_MFCR); + + lpi2c_imx->dma_buf = i2c_get_dma_safe_msg_buf(&msgs[i], + I2C_DMA_THRESHOLD); + if (lpi2c_imx->dma_buf) { + result = lpi2c_dma_xfer(lpi2c_imx, &msgs[i]); + if (result != DMA_ERR_I2C_USE_PIO) + goto stop; + } + } + + lpi2c_imx->using_dma = false; lpi2c_imx->delivered = 0; lpi2c_imx->msglen = msgs[i].len; - init_completion(&lpi2c_imx->complete); + reinit_completion(&lpi2c_imx->complete); if (msgs[i].flags & I2C_M_RD) lpi2c_imx_read(lpi2c_imx, &msgs[i]); @@ -503,7 +691,16 @@ static int lpi2c_imx_xfer(struct i2c_adapter *adapter, } stop: - lpi2c_imx_stop(lpi2c_imx); + if (!lpi2c_imx->using_dma) + lpi2c_imx_stop(lpi2c_imx); + else { + i2c_put_dma_safe_msg_buf(lpi2c_imx->dma_buf, lpi2c_imx->msg, + lpi2c_imx->xferred); + if (result) { + lpi2c_cleanup_dma(lpi2c_imx); + writel(GEN_STOP << 8, lpi2c_imx->base + LPI2C_MTDR); + } + } temp = readl(lpi2c_imx->base + LPI2C_MSR); if ((temp & MSR_NDF) && !result) @@ -528,6 +725,10 @@ static irqreturn_t lpi2c_imx_isr(int irq, void *dev_id) temp = readl(lpi2c_imx->base + LPI2C_MSR); if (temp & MSR_NDF) { + if (lpi2c_imx->using_dma) { + lpi2c_cleanup_dma(lpi2c_imx); + writel(GEN_STOP << 8, lpi2c_imx->base + LPI2C_MTDR); + } complete(&lpi2c_imx->complete); goto ret; } @@ -623,6 +824,77 @@ static const struct of_device_id lpi2c_imx_of_match[] = { }; MODULE_DEVICE_TABLE(of, lpi2c_imx_of_match); +static void lpi2c_dma_exit(struct lpi2c_imx_struct *lpi2c_imx) +{ + if (lpi2c_imx->dma_rx) { + dma_release_channel(lpi2c_imx->dma_rx); + lpi2c_imx->dma_rx = NULL; + } + + if (lpi2c_imx->dma_tx) { + dma_release_channel(lpi2c_imx->dma_tx); + lpi2c_imx->dma_tx = NULL; + } +} + +static int lpi2c_dma_init(struct device *dev, + struct lpi2c_imx_struct *lpi2c_imx) +{ + int ret; + struct dma_slave_config dma_sconfig; + + /* Prepare for TX DMA: */ + lpi2c_imx->dma_tx = dma_request_chan(dev, "tx"); + if (IS_ERR(lpi2c_imx->dma_tx)) { + ret = PTR_ERR(lpi2c_imx->dma_tx); + dev_err(dev, "can't get the TX DMA channel, error %d!\n", ret); + lpi2c_imx->dma_tx = NULL; + goto err; + } + + dma_sconfig.dst_addr = lpi2c_imx->phy_addr + LPI2C_MTDR; + dma_sconfig.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; + dma_sconfig.dst_maxburst = 1; + dma_sconfig.direction = DMA_MEM_TO_DEV; + ret = dmaengine_slave_config(lpi2c_imx->dma_tx, &dma_sconfig); + if (ret < 0) { + dev_err(dev, "can't configure tx channel (%d)\n", ret); + goto fail_tx; + } + + /* Prepare for RX DMA: */ + lpi2c_imx->dma_rx = dma_request_chan(dev, "rx"); + if (IS_ERR(lpi2c_imx->dma_rx)) { + ret = PTR_ERR(lpi2c_imx->dma_rx); + dev_err(dev, "can't get the RX DMA channel, error %d\n", ret); + lpi2c_imx->dma_rx = NULL; + goto fail_tx; + } + + dma_sconfig.src_addr = lpi2c_imx->phy_addr + LPI2C_MRDR; + dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; + dma_sconfig.src_maxburst = 1; + dma_sconfig.direction = DMA_DEV_TO_MEM; + ret = dmaengine_slave_config(lpi2c_imx->dma_rx, &dma_sconfig); + if (ret < 0) { + dev_err(dev, "can't configure rx channel (%d)\n", ret); + goto fail_rx; + } + + lpi2c_imx->can_use_dma = true; + lpi2c_imx->using_dma = false; + + return 0; +fail_rx: + dma_release_channel(lpi2c_imx->dma_rx); +fail_tx: + dma_release_channel(lpi2c_imx->dma_tx); +err: + lpi2c_dma_exit(lpi2c_imx); + lpi2c_imx->can_use_dma = false; + return ret; +} + static int lpi2c_imx_clocks_prepare(struct lpi2c_imx_struct *lpi2c_imx) { int ret = 0; @@ -656,15 +928,18 @@ static int lpi2c_imx_probe(struct platform_device *pdev) struct lpi2c_imx_struct *lpi2c_imx; unsigned int temp; int ret; + struct resource *res; lpi2c_imx = devm_kzalloc(&pdev->dev, sizeof(*lpi2c_imx), GFP_KERNEL); if (!lpi2c_imx) return -ENOMEM; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); lpi2c_imx->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(lpi2c_imx->base)) return PTR_ERR(lpi2c_imx->base); + lpi2c_imx->phy_addr = (dma_addr_t)res->start; lpi2c_imx->irq = platform_get_irq(pdev, 0); if (lpi2c_imx->irq < 0) return lpi2c_imx->irq; @@ -716,6 +991,17 @@ static int lpi2c_imx_probe(struct platform_device *pdev) if (ret == -EPROBE_DEFER) goto rpm_disable; + /* Init DMA */ + lpi2c_imx->dma_direction = DMA_NONE; + ret = lpi2c_dma_init(&pdev->dev, lpi2c_imx); + if (ret) { + dev_err_probe(&pdev->dev, ret, "dma setup error %d, use pio\n", ret); + if (ret == -EPROBE_DEFER) + goto rpm_disable; + } + + init_completion(&lpi2c_imx->complete); + ret = i2c_add_adapter(&lpi2c_imx->adapter); if (ret) goto rpm_disable; From patchwork Tue Apr 6 11:33:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416090 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=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, 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 D5ADFC43461 for ; Tue, 6 Apr 2021 11:34:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AC6ED613A3 for ; Tue, 6 Apr 2021 11:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245667AbhDFLev (ORCPT ); Tue, 6 Apr 2021 07:34:51 -0400 Received: from mail-vi1eur05on2043.outbound.protection.outlook.com ([40.107.21.43]:5955 "EHLO EUR05-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S245711AbhDFLeW (ORCPT ); Tue, 6 Apr 2021 07:34:22 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IKTzt8Hc0RKPEw5N1wc1PAvvhudcqyMVOYU4Pz4BJNmPPM+/UXhWb56Gx6hLnCeHoH3dPzYHcyBDYsHSa0Y4XZYhAWqjj4Igt8RzeKyONImpULxqeQyG0wZfMqWtxZ2O/ZgK0zpB8txzlW+P4dcIwjTZ4FuacsOFXCyzm3pQLlcLg7TOORjOBrsiNtrp8nUWI0m2cgeRhTORLR1xsAjpeF51kcaLsQ1Onn2k+PYqwdKL1dt+1HvAX+pfB4MwR/WeE7ierBScbhXt41+oLIH+bQzmJ5NgyqaWRyrQJtvCzvFkt9+E7hz+OvYN4JKxfpqN1yN1KMfyDh5KD50L9d+PEA== 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=YlJK7DMoI7Eg1jvOSgnomr6baokKxTNwS46RML/ZnV4=; b=Uj7KdrmWUECasRN5CzK75t4lcIpHpkIQM/oRhYn9IJxBw3IL5ktLLi8Hs9p4d1LdWdzq+CivsHp4v/GJf68qhoC418ZdsmPNW93jho/bG9dICKHbSO/3HUoN26ld3lE6EaTfpjTh4XB0c3mX/ihnfv6hZKoab9Bv5eFqcCk4igSR+micuhdt426IDlHO3cy9ycfPsezgauXblSDDM6Ssr5hNAKgoMUUGk3yKjmDspP7jUYaT4fQhQQmbv0QWA+18k8ybuR5d+RLTZz/AGuS6dqeiQMc5/lcgYuR18HOShWBdP7kfYSV5jgJbKtzQzONm0lPoOcBpmaYUmowpT/QWZA== 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=YlJK7DMoI7Eg1jvOSgnomr6baokKxTNwS46RML/ZnV4=; b=FYUOQciPfZ39LFlnxJ2nku9LvWBmbaEXudnAfGDclFEHecAXs7rvJJnBn/wqWIfQMKE066o4fNB+yu/DnR+7PSWcWu3+P5M2Q4o7q3FVkhl1LMK2OIb6srVSh9Lv40jOtoPn+acIIyuIG15X2Alt6OqUkJx1E2Az8M+PSe9MMIk= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) by AS8PR04MB8359.eurprd04.prod.outlook.com (2603:10a6:20b:3b3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27; Tue, 6 Apr 2021 11:33:59 +0000 Received: from AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9]) by AM6PR04MB5623.eurprd04.prod.outlook.com ([fe80::5cd9:3da7:144f:36f9%3]) with mapi id 15.20.3999.032; Tue, 6 Apr 2021 11:33:58 +0000 From: Clark Wang To: aisheng.dong@nxp.com, robh+dt@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com Cc: kernel@pengutronix.de, linux-imx@nxp.com, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 17/18] ARM: dts: imx7ulp: add the missing status property of lpi2c5 Date: Tue, 6 Apr 2021 19:33:05 +0800 Message-Id: <20210406113306.2633595-18-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210406113306.2633595-1-xiaoning.wang@nxp.com> References: <20210406113306.2633595-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) To AM6PR04MB5623.eurprd04.prod.outlook.com (2603:10a6:20b:a9::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR0401CA0010.apcprd04.prod.outlook.com (2603:1096:202:2::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.27 via Frontend Transport; Tue, 6 Apr 2021 11:33:55 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e5631e6-544b-4cce-5274-08d8f8efde65 X-MS-TrafficTypeDiagnostic: AS8PR04MB8359: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2399; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CL1XgymghztlwpbkI1QDbjBa3kepNcRt7tBeDOC6mm+TTJeVAF4bEGcc2a2K88AUYMAmL5nDm/crGV4kVaxb4RahtqLSmZXdPO2bWpKwuAK/CgK9rivM+oC4wLUHaNNbaAYmqiIdWn4RIXJxryJc8zGbQ50nb9jH/j+ov4LKqgHbNpBzCYEoMS2xNxGMBjWqRSzP2GScCO+IeHk7Yc56oJcwfOtFNDErJrkH2+Okxptq2MQDP/lB4pxDiCOLUmNNA0sVLWQK2usEGW2y5sDTDbkBsjHVsz9RcY0+9rSOQ+QEZPZjozCcifSry3qlyVdC3BiR+lY6l7Qy8F8Usr4VLmVFIMGdxqLXssjo0FUSQP0w5Uz4ablVQORi80rUvY2NR++ka2QdrT7ttHMeUX9CeL0ARcFbIbD+CDan7LAlvvTWYQV51ySwqlAN6ndANZ+LxZ4kd+AU5g+v517uc6J87yCHA+kQ/QMuIX6s9E59ICQ6BnK9fl37FBovh9yQDTKmV8v3ZVVGxLTxrj3bmFL/Ag9dJ4f+HPgO8VfpY83XN/ayP13Bjjnd+JZ6Wu/uyOIxbiY42VM4NrpXH74bea2ozWRjMXb2TRa1/d2lbt+K6/ZwZ6ctRuOdNzfx3fv1yazoDkewMe4W6EGgfyncOkCHJkUyLGDfaGa321q1KxhHvL2xkFArh0vq5wAep85Jo00b8XX/1Ae6fJYplpUXbTvauw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB5623.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(6486002)(5660300002)(8676002)(16526019)(86362001)(4326008)(8936002)(6506007)(52116002)(26005)(38350700001)(69590400012)(6666004)(186003)(4744005)(83380400001)(2906002)(38100700001)(956004)(2616005)(36756003)(66476007)(6512007)(66946007)(66556008)(1076003)(498600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hca+kLa+vXnsPyEerfE4bkdFYKYN3bwCJpMiok7/PhlRQmlB7pSo5Knh/doU2fM4ZUt4iJeXN9kulxR4tyBbA6s0YCXN3G9S8Q4zzoJGzQmUCv++WqzkbXEV4FjEstYH2sMvEpSvvYhTZBISQB1lVCCzAoXQsBeOjL6XsnlBYircs5WlXnfjYDAHVP2JlPtmoFL1kplLOSOekDQ8ZXTajDjHpeIyUVNhWtxrZyLDoiej4X/CfVWY/R6aMyV8zt+kcFTPbJgZFqvJrgCXgxzqlE2kFFbNqG/51ssB3IGfc8W1r3cdZzJVs3r7uCtGkjQxGLRPbVao8wssojj00MzDKlTxUlVT2LZ4H83hEylCEya7E2mQce7aS6t8ZUvz9BYnfZyk3/ipz+b7e34OQHM8iBY9SrPvLu0LWEA+Vt/XX/uFf7DZyasESRwcpgFwN+c7sT8GcwmdSc+hIvkFP7mWSWA8sQ9zseA1VBTW8fcQZA2qH59mX0NQOdJK/udkzl8TbgXb8I6RCkj1EYQ78oftLtm1Ap0sEhipODcU3Vx6gcC5AR+4qeZLC/VgtT0VMaGVAHCX794xutyaDbpjXZtFVZZ3iwov9mjVX0w40JQgYaacYtQBdEWhzGBuGOHL1Dq745lGrN4MWJVks4DAE5QEbhhsJ7yia3QzibikKlqBunV5CzhHwNU//dySgK0d3wX4ErmrhsuH6TSIM4DFsus6llWFytwAyDdgoWst+X/L+zGBVyIZ4T7s3xDXhW3LUG3CM2bXNYS458UvSATP9QRwUQrY1WKdF1zGiOfovNx978PBnLq1aZxi7FCmI/y6zmDtnO2cR3u4xu4HKJgdPGs6tnUDtaz1Us+BwFX4z5NxXmkRXNcYAr7MO3M8GbJFuYUDnnRIxp7z9eBL0vIawlhanqqnaJeHoVugiZ0D9ChcOv8O1PXVhTYgeknxBbw/CpxkYeuRVw5OgB1VpppxMrUsU79eremPgD3a8iIqT0HuNEzZPevQf667fjk4RycEVJF8q4Y1ITZbmHGsVwmFT/3J/0s+w93QuN9HtYZchBAZbEryLZR5metCUi+MxokrJ3nzieoXKuoBAIfDAS5/2aAWaoAWWj3XVRkw5sa60BgJHS3KbErjW53wQyAXmPvO4D3Hot+uHdcN2ixe2zorE8x2fgYFr1LXjbXC/vyFnvO/NqA4RRYITDdEseTU4yeFGbtPtLXvvbu1fE7xgyAASKLqmtC8ae644bfaT/Pwcs7VWO07CwrbGCoF1gX1ZJl0GWT4GAzkEuMs0TGslMEE9Fgo1QCwcfQS0pF5CRdvtyeRU+4J0LXMhytDxOW+SB3x9r+6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e5631e6-544b-4cce-5274-08d8f8efde65 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5623.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Apr 2021 11:33:58.8307 (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: wrBL/8F2RR03BL1i+P+PlbpQ9KXGwBpOKvwAfZRm82rfug5aF2SzYeKFDbMIej41gENkzyWMsyzHPKJft/R7GA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8359 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add the missing lpi2c5 status property. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- arch/arm/boot/dts/imx7ulp.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi index a6681836ca05..b16441e18231 100644 --- a/arch/arm/boot/dts/imx7ulp.dtsi +++ b/arch/arm/boot/dts/imx7ulp.dtsi @@ -174,6 +174,7 @@ lpi2c5: lpi2c5@402c0000 { assigned-clock-rates = <48000000>; dmas = <&edma1 0 12>, <&edma1 0 11>; dma-names = "tx","rx"; + status = "disabled"; }; lpuart4: serial@402d0000 {