From patchwork Tue Apr 6 11:32:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 417024 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 C87E0C433B4 for ; Tue, 6 Apr 2021 11:33:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 914E661396 for ; Tue, 6 Apr 2021 11:33:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241800AbhDFLdN (ORCPT ); Tue, 6 Apr 2021 07:33:13 -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 S241735AbhDFLdL (ORCPT ); Tue, 6 Apr 2021 07:33:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GIK4ke1+BSCJ/h9HRn7shqN+sK8Aq4bbbsPmtRSEKIYzKDDWR1IQPRJxRN3jBsXabt27DhZIOuqUIC2JFuXxLAiQyWb+Qln5wi/tL5pbk/k/ch9easPLlgUGP4ZoI+d3NXbms2T3BRuF5vw08+Q45nZk44Gvei0jL+WDzgcZVDcyarOC3pI/5CoZN2sIVjVJ1kY+PFtgqyjDM9s7OgiYq+rXkxwhbl3+EtxOVupdprb5FRafmkmKoNTAf+CmZWHK5pPyhcXjvIFl1KWfeUYrH/R4eCG0s/0++dlDDee6lUhx8ZJgI96MIwBdgcf/VJM13juhJV4//Ze3eL+77Osy4g== 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=I+VY+rsjT/BGHI5/+IiuUFsFO9vzTd2P9vRixHslR28=; b=bXrL2TN7VbG7s/vb+tgAhNbwWopWJgexDMVIMr1Asnlk+T7BcRZC7uMJLGJEP8Y2LEAu8CnLQqfjlWxKQ8FxXBtfBRzWZrNHcps+GPyTlf98elqygo5FlRpYDrx9s6AEdsxPhWLkA6u+c9vwijhO7q0sV1/9Nf4P/RgCL07Z5+LkyOMPrDM91RDY0bkJU4Eup5LiYP+9CYJZ7fDCmtey2P9HcQ6MYlJ281FnkrDxMlnwRHeT8t3pMeHfta7N4q5G8VOad8ovDRPfvAtfjl3KNmzbKF6lWBJz0me37k3X7i+NYrO9vJ74hki4zP8o65AWnCUBZWe/0TM1FT5kyQc6Xg== 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=I+VY+rsjT/BGHI5/+IiuUFsFO9vzTd2P9vRixHslR28=; b=OWWW0DZE6cSJROai3Ud1kLghFM10v5Gst/GCXoOebpR8mvdMnu+7ka5ua+AWIdvrLWK4w8cCC7MwDxKAoLuaq5a79MdacPRFwY6bnDA3gpbU5chBUEEkOX561h5ZC3HDh1US74oYAeX5AqBp+UwwZjEYXzcxVVzduXTSUAtktNQ= 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:00 +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:00 +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 01/18] i2c: imx-lpi2c: directly retrun ISR when detect a NACK Date: Tue, 6 Apr 2021 19:32:49 +0800 Message-Id: <20210406113306.2633595-2-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:32:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 63945085-8857-455c-8ab5-08d8f8efbb76 X-MS-TrafficTypeDiagnostic: AM6PR0402MB3765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1148; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xgB/DcsxSMNLnjn302r4GgAn6vYoFtr0qGu2mJmGZo6KvrjniMZd28IMoc3PLu8cAJWvb9igHrdDwdXzXKIMWaFpv9OXrYYHVTQJEVznJ28sM5upsbjMHBYpNXsmmfdS8tU+cERoQLo1yJ5N9wEs2pikYMLl25256iG2KEhNyt/DN+QanU4p5nL2CYeQhe30ocPRhZaGPEi6lcR9B9e/NmlV4wHruK/11VNtRx0NyGdpNGrvzVcwVQ0t4IM729uhQdczure+uk21IeyiRV4JHvOE2yxk0Sm8Nu0VTUxhp3YUwIaJg9KPViWZpWTWMfcom1MZZWLGSspwaA3VjgHIcmpYNN2/US45upfSNbjulaiiK0KknjCaNltWhy3IJ1jU2r4wt4O7CMgsFKhjGp/3HWQjOnloO7c9/u961cSxwCJFllqsiBi/UVI6iKAtT75xPOwXEXZwO7w9t+SspD8Tsjj7DIUGKr6+5Ttecyo0wuL2UutwCMkfcDAsDi0SZq4vbm8vAFDajwkl3UDy0ItnDo7PLMN3PU59e5P/UU9VQ7AOOeRxE9ZBSCHmXnas0TuUeJbjjt12JL0t7/pVKYNJCD0Bu9w5WqV/pH6/0nwNQb2nS8/f51zfzgNVeh21k2/hscxlBgYX/cwzcx+u0FXE4bPFAo8f3sEKKKkEzaSr9TgDvpvupjIXO61jQipIjvHCBr56ZAy/dPOpB3nrKwO+sAXXoR70zqCTBhy9DanwCZ4= 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: rDZwYgFijkR8Jh/MYbMQOmOEi84NzvVBp+o+Z5fs3UaGYypsj/ZQupVukUSBtwGZ+nv/gN8hMZ4zCLkHBgAT5nfA53bNNXKjniIvyqTKpXYjibronyNzQ68926iLZ0BZ1zeIZhYxKvKlrYiEPwoGuxuLEyDgtjpSCO07lXa2h5r69OxmjUm/diwEMhl1e9QXtsQDM7liFqVx4Jwotuq7yKvpOhNniHeH1cGsrFtSbneg9ODV5T3NtrWsHEfC+mA2Xvy/nxPgGaF5gjv6o+ZCnYhiANAAw4x8PBo4Z5DiNp/7ADwhxpqe0bUghK5ogenDPVr7fUrT5/eCThD8f+XUg4MLmaLHlZT9/ljCVWujws3TxoYTE2Nq5fFvcBWG1co0lNBr+PYazZMXqcEpI4wbYGImYbw1RQK8ZL0ovhnbW8Pgi00tgVAUR+BoKywOSpExa3l4Y2vAAVN0Th2PZo6H0xMUgd73qMuBdSqdg9ITRS026yHsARru8cGRUAsQK/A6Wpq2wmrxiLrnwDe1JvKMNt1vSKn28BZvvBmjp55jMucjRJswS7TamQjE2b54j/wDMeEVr+nnE90VPMmmOCmHq6qf4EzcU+5Pl3oXjBsVIA49IhyRofJtaPcvICEeR0ov9RhPRAYFof6URuW2Ct3D1k/ygIzP8Q58P1GzWzly3dqfgHWUYmovc661GZmZ8kdxTBs+zX2wzNKP0WPIh9xKgVE/AGYFqc4nBO+rQyWxeaOIzCo0RqhfM9z4vkzjqOeVusKBkmnIYwSp3O385zA0prr3pX2HWvfj93iXpL04O8xVnX2BdupIhnhb/hRpT8Wv8pNd2qWP4QeKzIO6Q1WwY2Asx53AoMD3YqmFW9W0ojIEPvcGIna6f2kLOsTxMTgMiEp7iaC+Igs1loTU65Mc+GxtVN4O8f6IK9BLt+1Zaalo9FK0k0IUKj5O+5s3j/SM9/Js0FsZ27l10+1mq6oifGP1F4zBaG9GvLl51pYSOegtzGKBtqzhXztsU5bxBKiGtnUSlfYcpgtITj/yQEWoHVWKsrcMhFaHRXOwnaXe1uh2pIHD6S0wbzYxp/7PfgNs9TOgLaSZYySaxIZ/ZskWsiEs0EoHkW39yomwc6r9M6AI04wzcJ5EdRErBoWfYdfNADErcu4UXGYkqaK+F6nCODw3K/Q46rYDBjEA/w3SErlavxFmcqX3iGI/u/RmXUJf4/zOqK3zzh6Kk3WzifDsyqiYWYW34j4hLNm+T9krCnXjG16lZ5pnjiBHQdw+4BJwy2X2Hfck7zksoAfEtoQ63+iUkWEJO8EWl7kbm1Qi73oFhXNkTf+rrVKG6OA9oeb4 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 63945085-8857-455c-8ab5-08d8f8efbb76 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:00.2583 (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: a9lbOy0uRy16SAi25Z8wXHCOSZjCy8x+CAe2VdUVpXbMTwnAO5aeeKIiVNeOcGTFs6b4RwO0Bx/qtlEuMbha6Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3765 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Gao Pan A NACK flag in ISR means i2c bus error. In such codition, there is no need to do read/write operation. It's better to return ISR directly and then stop i2c transfer. Signed-off-by: Gao Pan Signed-off-by: Clark Wang Reviewed-by: Dong Aisheng --- V2 changes: - No change. Has been reviewed by Dong Aisheng in V1. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 9db6ccded5e9..bbf44ac95021 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -507,15 +507,17 @@ static irqreturn_t lpi2c_imx_isr(int irq, void *dev_id) lpi2c_imx_intctrl(lpi2c_imx, 0); temp = readl(lpi2c_imx->base + LPI2C_MSR); + if (temp & MSR_NDF) { + complete(&lpi2c_imx->complete); + goto ret; + } + if (temp & MSR_RDF) lpi2c_imx_read_rxfifo(lpi2c_imx); - - if (temp & MSR_TDF) + else if (temp & MSR_TDF) lpi2c_imx_write_txfifo(lpi2c_imx); - if (temp & MSR_NDF) - complete(&lpi2c_imx->complete); - +ret: return IRQ_HANDLED; } 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: 416187 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 0FFC1C43462 for ; Tue, 6 Apr 2021 11:33:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DADB86128B for ; Tue, 6 Apr 2021 11:33:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241875AbhDFLdP (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: linux-i2c@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:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 417023 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 3D885C43461 for ; Tue, 6 Apr 2021 11:33:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E77961396 for ; Tue, 6 Apr 2021 11:33:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241948AbhDFLdT (ORCPT ); Tue, 6 Apr 2021 07:33:19 -0400 Received: from mail-db8eur05on2046.outbound.protection.outlook.com ([40.107.20.46]:41728 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241914AbhDFLdS (ORCPT ); Tue, 6 Apr 2021 07:33:18 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XmSeEbfNtrG+sIUy+khXO3HkfRZOAysmi7ITZm9Ie/PNZr+RUjpVJrw/l09EpfCoLKyjibOSDluHAqB53meFn83bdP2tSZzN6CD3rQQQ/N1ra19Qa/CTqq0Qr8MitfVbi4EJgCG7t6DNDZvBrDs4tdn9TkTuEAUMJ4FTeees/6Zbqqx1ZkOFD4XRhzbx5BItIUpldhwoVwbNic8Uf7zVbAK0/sbQ7jK7xQafLSJbL2gnwKg+Nrg1Bxgy6ropj3fTgjotM69lUe0LYXcWSRNVP7DG/AKyOIulvu59QQFkxVldb5wZ0X3t36oZPIkG/QAZa+W7gScNgVU/+rJo8KU9sA== 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=pDmJd3VC7BBxTZE9F6tMXQfsFUUGe3M4vt/lcXUnHPQ=; b=MpmIFKEiQ7HcRYZsNasO1bHs4Bmg10cfDyRY8b64j7K44GzUw9uXni9L/UnbLhXIaYoL7Gzba003S3a6uLc+vS5LIUo/ye+gyEq7UGUKQnoLkm3//CU3QNoaDMpQb0MO7DYS1qqWFkJ1zXqWr25zAXadWj996KDmZEqNZvvSar2AtQIPYELXJtDaJ8lkyxF7JNmBaQ3def114EtA9H7gzzpdnWxkMfQwmN7ld5Ykjhc1ljjcuubIBpazcu+AnTCis5vanUme/jyRpVXGOhRrW2f1pA371fyP5GX/y2RMkVAVA2AiRnNprLdA0boyWm51668n7iLBP2VBmWB2oZeAfw== 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=pDmJd3VC7BBxTZE9F6tMXQfsFUUGe3M4vt/lcXUnHPQ=; b=O4Wu23s+bkBnF+EfyWV+GvY820QYswYcb0C3BFjYvyzdTsRo1y3Ro/lLPf1JCCLmOnrx7cehD/amccDOXA8BQ7dk84uNXOLuQBXBDsCMuygAmfHAgUJxc4svOocDLJ8yEgpRgk+pAzSW7LRCRtwA2t70LVxxbDOztFI/Gc0VmUw= 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:07 +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:07 +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 03/18] ARM: dts: imx7ulp: add the missing lpi2c ipg clock Date: Tue, 6 Apr 2021 19:32:51 +0800 Message-Id: <20210406113306.2633595-4-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:04 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c40b359-7833-4682-f9af-08d8f8efbfe6 X-MS-TrafficTypeDiagnostic: AM6PR0402MB3765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F0oOfq7WxujtCwDAZZmU1zV4HGlYL7udb7IwouRKY0B08l1llwHyYKz3lb63v0AxX1LeEGh7i0Lbd5J+tkPn1J4LZevQH/lonqQiJmB8Pj8k99BKlzucBEcWWnFWjAhHaOGXR3ooUfF2MQHycQvdMZYaasZZYCum72J+O0Oz0OcnAEShYeXBne//cPLTxdFcY4mLw616FzLeSXYu1pWfIEYdPj6EScQOOud179tMWomV0q6BD0waKqWNjLc7kT8lZ2x0jElEqVXzLYkZTObbTDhTxAqpL5JqN94uYJnl7XALpykqY9sBcAmOh9DsTlz5gDxWcTTqaH5fa9sA8KLPkJYFZ/Z4FMeJcy1HDI3WBv8527ehzDL6ADCm+OH7hRMxncjTP1dXHZJia/SdL5RJ/zdWPj4xKbYswHpJMgksQViowvvBHgI69LI8C00N6RoQdh5U2lE7u6mqL4YjkWD79E4Ost+X1sgFQCMWnj7hfJLDss6FVCIYMqIdCdcfcV/yH+oMsOmD3Fg0uUKFJy/QefJJQSfC/+qqzaiy+YcHQeAclBJmsqPpdRkpf/gfVAzoiM4mfxPmILMc98sm1hqOS+S/ipX3tNcL3grwY6P6JGxmJzh87uGkAPs5dlgVzZB9m8x0rzA4wUzjic9UltskQ+FXmn12itGM7M2vgkpkt3QB0Ejfi+dGxDr/GGtRPVJjTjENrjUvs4YxslorG6Qw495YeFXmjZyYEspcmlCmIso= 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: QKPlONszad3xmkr4zr3AzUrKCqJwcnCqp9Q1qZms0SSsF4tpwTRR8zrdd6WhaX5zaH4e11ldOjc9p6b72Dc+IzilBRjI5Thbuidrbfj+15EsIFmnZbrriDnU2VQHlt9XfyptVfgLjvDC2Hxmxj4c9AxbDQxebipmUjGOl4VtpKCO2u1onJRN8PxASjbW98MzaiswHGPaSfTH+3faxnLd/yS8OO05C9xXP1/rHcxmHMxpIJaPC98AVq1Uk6g8qTlShMJYlE19tqZIstHFefNI5VKYbSlkfllYiWRNkweqWz07qMDR6vnUtnTZyzALHPKcZtC17BwfHURFE1mVhOjMxWEz6nJ6E9MrnOKoccoxrfB+kqGui/0InwbHb7RTaeg+LDcEybLsXfW11/3YXwrKoNowl1XIezQecCHXWfASTK7DTZro0scABCl4F9uFr6WkUkYUKoc6Bgz+SLqZms7Mfl1dZy8j0vHJ23kskkrxl1aDBg4eLeD+ScPithyTQpeNnTK5yfwzZ17+W2bsh+AgTAdwnAv1f1dJoPjhjqQ0CmG/C0aqV1r0Rc6yM5is7AEC2k+tmpeHB4HDffzdm+AsaqInqSBEqEq/GQ7tKgs7hIyQHp6DWUFkzPvozOoAC7ftF2nTzP2EAYUliqgD3Vz8CW6PPtHWT9byVlf2l1F5aqTLdWaHXNWhcpNwC/bP61s2CuonBZZISiHFj6uSYFGYT8irljrorVHCbSuEz8NKVJY7W2+vsoRr9lvXb4wiInd0EkCnMT4GO17xa0EW7v/Gpj7fm1CqJ4WFTMD5eFHmaCmu7Oh/Gnl7/qAQjjqw95I7/REfnqEOPK92aObxLzXDfDygHA7BDRjGAiu1YOMmQAHP8wVYAbQdpfhWUBY2p+VvNAOkWbfAB4NsbJO0WR+OXZdB9io8/Y5iSA/yIg64zC7Dpav7xIzItNljCI6/R3NMOPHSw2pZah/aJ4uQPB1gnnC+XYoQZZogKRV9x9FKVFnAScG4ll/+xRXVofCNfPIqxiKJne9WsEvpycWf1OQrk5QM2Alsj7BzGHT/cDYsuBj90KwBa3Mn0ewWS+TwXvxbVzj+suWKY2XvZtPau36scUtsAyGW2nT+BMzfwoLPwa6rRrFs2pYra2D4WxO/3Xvgwyzeo2fsEShETHeuPlF3ZX638Jq9Inm47WL3m6tcPehg80btQJB20MfwC3Z3j78NhXeBNj1nQnJE6xflVUw1ZcRpSOTrO/3myNHFVwJMNJcXOZ56fvLMXRTan6aRDit0ArWplPMauqHUty6YSqFyA+7IeKb54SnndiDr45NSGmH9HBVw+JjW23OWJKdOh8jP X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c40b359-7833-4682-f9af-08d8f8efbfe6 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:07.6281 (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: fv/T1t/p9zYA4IRjxfe5f8Rgsy/TrYHNwZyy8XhuNWq/6MZG1H99xFbddvnQp/wy0OtHfq4V8iyVtSoFninWGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3765 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The lpi2c driver has add the missing ipg clock. So add the ipg clock here for all lpi2c nodes. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- arch/arm/boot/dts/imx7ulp.dtsi | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi index b7ea37ad4e55..eb0d4b8f624d 100644 --- a/arch/arm/boot/dts/imx7ulp.dtsi +++ b/arch/arm/boot/dts/imx7ulp.dtsi @@ -328,8 +328,9 @@ lpi2c6: i2c@40a40000 { compatible = "fsl,imx7ulp-lpi2c"; reg = <0x40a40000 0x10000>; interrupts = ; - clocks = <&pcc3 IMX7ULP_CLK_LPI2C6>; - clock-names = "ipg"; + clocks = <&pcc3 IMX7ULP_CLK_LPI2C6>, + <&scg1 IMX7ULP_CLK_NIC1_BUS_DIV>; + clock-names = "per", "ipg"; assigned-clocks = <&pcc3 IMX7ULP_CLK_LPI2C6>; assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>; assigned-clock-rates = <48000000>; @@ -340,8 +341,9 @@ lpi2c7: i2c@40a50000 { compatible = "fsl,imx7ulp-lpi2c"; reg = <0x40a50000 0x10000>; interrupts = ; - clocks = <&pcc3 IMX7ULP_CLK_LPI2C7>; - clock-names = "ipg"; + clocks = <&pcc3 IMX7ULP_CLK_LPI2C7>, + <&scg1 IMX7ULP_CLK_NIC1_BUS_DIV>; + clock-names = "per", "ipg"; assigned-clocks = <&pcc3 IMX7ULP_CLK_LPI2C7>; assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>; assigned-clock-rates = <48000000>; 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: 416186 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 33CF6C43460 for ; Tue, 6 Apr 2021 11:33:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DF65613CA for ; Tue, 6 Apr 2021 11:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241603AbhDFLdX (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: linux-i2c@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:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 417022 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 BEABCC433ED for ; Tue, 6 Apr 2021 11:33:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9B68361396 for ; Tue, 6 Apr 2021 11:33:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242251AbhDFLd3 (ORCPT ); Tue, 6 Apr 2021 07:33:29 -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 S242124AbhDFLdZ (ORCPT ); Tue, 6 Apr 2021 07:33:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hQO151/Strx4/a+48DrbJdmsp7wrdnOCBt47NBRRk0A+NwRd91gHnV81pZO9p3BfnxdTP81XgzKEKr+tLatxrRPvUOjtl+4bG3oTA23Kkqv7RZbHnSG1t7LVmc3gdlXrx+rhR/638zQNdwyMq4XIiSyx0lzthjmheZ9YeUZ50l4LvkyWpXZE4PGWrUahGwZ5nvWV9bWotjLyYINMr4nUqYcPZwkyNNt92pvt7b9THpxQcL4L9PnQbLFqXsFP+TDmtOeLwm19xpjlagawqc1H3m3QpK43EAvCVHQx4iNZDnSKHUdaVLk5K6pUNDT1fyWTfwtOYz8KcJLOz8KNNrbaXQ== 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=CILmh6SUfQdYNkpp3k7X05hN6ybufc/pGlh6OBBbDY0=; b=MgqJK7YJ5aZHF0z1uKbWgtkJ35Ev7JcL2kF9bFWRt727y3AnikN9MmxuBEJe1Et22jwyr8iZtCgnUrUY4Y8Tfr57vbnuUgCQm3UjUIPBO6bOCd5bk5xtSqByOw5x9HqJADRviFa8UFoOiLc+QUOX+1m9MQ6mcreVt2Vfn7gVscZGYjMJob940ktPxbq2/IdgiZagTdXtMcP1P+yC2leXOArkCHePDuENDQCppHpRT1VYohELYTVr7zZacIuJNT1eBa/3l8bPowk1QWIuQweX+FxhrQ7lPErstnGF8uD3aOk5/BECMrs1/tYfc7feFboggZ5MQOR0GO1RvAx3cwRhrw== 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=CILmh6SUfQdYNkpp3k7X05hN6ybufc/pGlh6OBBbDY0=; b=rqsRHhr1ygghZMxmBDDZzYyT6yS4LvzuEHvQW5xNOgyP2DuBJEPRkPk8cfPnbbpRu9oME8W+PEAAXnEjFAwpKBaOK1a8CZnDtIkY7MJdfnWt1ZvNZUEsZjhzYCMI4pPNXfqqn2U54dtm3hDIX+yaSqlieua8jxU2ipOZsuaU2iU= 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:14 +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:14 +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 05/18] ARM64: dts: imx8: add the missing lpi2c ipg clock Date: Tue, 6 Apr 2021 19:32:53 +0800 Message-Id: <20210406113306.2633595-6-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:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7dae9f5c-f9e4-4f75-c586-08d8f8efc43f X-MS-TrafficTypeDiagnostic: AM6PR0402MB3765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t0jyRl75Vk1pXLOchmQMLRZEGN1VrMMlwykwHzeBbrtRN8ILrTrr7de5JMu8M+KMohYEikBN9HgbRG0aVbWGC+VvjMO8DT1HN+XgE1PUSbY1DyIsZtmYNMUl76dr2q2U5oPpcUbN9+2b6W4Ey1QrmRsIQY8g+F1dmKBq2lxDU9qVT47y388osyEDurRcaf/dr90XvLr1fA4lp5emIeuYqPO47m41+nlcZPaQb3nG2uHXLi9/1L0N8vhvZTwdeRX0OAZhTE44B4b6uK3I9bLIHXnJhi6VEx5T3lFLgy8wTtZrseJapox8Sui4/ma+CcYSxb6fG1pg/gaSPoypIXSQZnLlmi8n5kpT5h4GOfuzBxzRab3mp0ZSIJJvJ3MmYAJv1RbyB1GwNx/Sqpa0aPTvoLQVY+yWn27c3qpZWQPRlGht4L5cIi3NuEvlCPnwdzbfH/8iWIWvElVRuCtcEMsEGXhrn2fR7J9IV9QJHkT9Sag7lSaZ5gxMf9DVK7vYDWXipXCyMmcecBzRdAQ/NTH2vWSEsZ7ZcW+ipuheemplAN9EwXFshMYjGbJfDZWvFypzQZ+DDvMvVBWUMcyeVsXorVoplaY+vt3l/kAxBBFFb1zmP6mFT4eLlCGxh7VZTvcHIYXhgRuOgn8XqTUgCRd+kLBYoRvA4ohWtx/E3E7K8czN8rb3NDM7qmQxWpChkhoFF3TKQrp66W3bURNd3b4SKA== 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: qnNf65EApqc3tqwXOLZhK6yX9zRsPQr/7JfmU9NseMIQbaDN1qQrIIqrGwGZlfTBc+VUZXyHdY6qWS9OphIz9fiIKYnnNbLnzGSAAgR5L7abyB3081HxVsjKswSyDlmWNPB2MYCzjK9lii+0suYGPsSmVgaP5FtRGkUjGZf9B9/P+FousJJsGCidVytMGQdqE0gG6W+aDLgHcthn2aYHAs7WRXgx4KEv2mNSqyv2uMs4yO0kj1OuSRhsMxk0JjoF79SUOoGGG4tPTtPqVq8mIcDtGOmNzlHK94fqT4O0mVHIjpPRvykC4Bh3ChDjD6l3ZRq4ymyQ5mjzyTR6Sr5MCMHxYAG7WjvMbuoxMPa9o+uNem2xcNT48YgsFp3JDLupaThVnCPd8St0JnFhnjFcw3hpcPpqPz8Lm/eTWxza6ifoxxTFeAdtggtDdjCBbiWU3MxB2loKOF7h5FRriyFkZF9dYAio1up/zBGOyz46l/UppfsMzucbbgv9Ggt/H818cv9ptU2ZgdAgoKJNNGICQTZZeA0OuDjHAqlqr115Y3SS4R2QX6MLhSdwMLf8WMsTFZbDrJ2Xd2BYF4pBb3isZkApX2EmVTBtowDsyVIN+PKnVQF7ZEPMqGQTOlJXevyxp8PnjuGOCaKV1bNrXXNX1y1xS/dzRkqnDKRo8OGr++ouZu620EtFLTCrZGrDdNsNTFEH5kyu9h991uP347ueppnzPUtq7+FjJVluOJTYQ7PruoUU10CSgf0W1X9eIRCgmp3gQD43VfxqCPypeUeMTlEGtmO4jRhQUvDyDs6lch0ceHQrGk28EmykPHO7VgeZGeMbYtIyJLoW3IPmXiRbHLLdQ4nhzLMTUdp4WRshwA5iSmXMobfucNF+l1a+D5IAMRQk8sz4cRsnKKEXX97eo1GrhC/NC5x2pYdRWK19w/nWlj0m5eF3peWc1nckV8/SlyZfbVDvxfGKpBQTHjmJANSqwXuso1O1qhCqlnOnQ0wUuuX3lzQuuUvCEuzomkhoqp6tHoLucG46+pdyHkaHYHCXGtuntviVOqCXOs8wkMm8EAW8QU2tysYjcIFPe/C617c5TQUwj2PJmKra5HGkynUOkUNMg86q+CkRXOlc3brCS43kTAHQIFgNz4sN8agLUeWq91a5vU2HwM7H51tl5I0GJk4q52xDNxmFAceDt9nfMeufV/N3X+aE0VXqfjVWIYgPQ6YmlvHoIyXvyBZblX2yiKmL3iHi3NUPxq4sdqPeHIkze1AA6dwfVajl9+HDZgBHDZDlGTxEplXW2KAg5gz/pqdzQ2lbHKhGL6Jazv8ZsmcnjHus/CRVdC+tjcAt X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7dae9f5c-f9e4-4f75-c586-08d8f8efc43f 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:14.8319 (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: KIFRwyyNUXQxnwb0Eimi7VnvtixohctDi2CyRX1+aBp3UuO1E4EhIJEC21sKvY5X1dc5qgaSb73mdfZHD01gvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3765 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The lpi2c driver has add the missing ipg clock. So add the ipg clock here for all lpi2c nodes. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- .../arm64/boot/dts/freescale/imx8-ss-dma.dtsi | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi b/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi index 960a802b8b6e..b5ed12a06538 100644 --- a/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8-ss-dma.dtsi @@ -111,8 +111,10 @@ uart3_lpcg: clock-controller@5a490000 { i2c0: i2c@5a800000 { reg = <0x5a800000 0x4000>; interrupts = ; - clocks = <&i2c0_lpcg IMX_LPCG_CLK_0>; - clock-names = "per"; + interrupt-parent = <&gic>; + clocks = <&i2c0_lpcg IMX_LPCG_CLK_0>, + <&i2c0_lpcg IMX_LPCG_CLK_4>; + clock-names = "per", "ipg"; assigned-clocks = <&clk IMX_SC_R_I2C_0 IMX_SC_PM_CLK_PER>; assigned-clock-rates = <24000000>; power-domains = <&pd IMX_SC_R_I2C_0>; @@ -122,8 +124,10 @@ i2c0: i2c@5a800000 { i2c1: i2c@5a810000 { reg = <0x5a810000 0x4000>; interrupts = ; - clocks = <&i2c1_lpcg IMX_LPCG_CLK_0>; - clock-names = "per"; + interrupt-parent = <&gic>; + clocks = <&i2c1_lpcg IMX_LPCG_CLK_0>, + <&i2c1_lpcg IMX_LPCG_CLK_4>; + clock-names = "per", "ipg"; assigned-clocks = <&clk IMX_SC_R_I2C_1 IMX_SC_PM_CLK_PER>; assigned-clock-rates = <24000000>; power-domains = <&pd IMX_SC_R_I2C_1>; @@ -133,8 +137,10 @@ i2c1: i2c@5a810000 { i2c2: i2c@5a820000 { reg = <0x5a820000 0x4000>; interrupts = ; - clocks = <&i2c2_lpcg IMX_LPCG_CLK_0>; - clock-names = "per"; + interrupt-parent = <&gic>; + clocks = <&i2c2_lpcg IMX_LPCG_CLK_0>, + <&i2c2_lpcg IMX_LPCG_CLK_4>; + clock-names = "per", "ipg"; assigned-clocks = <&clk IMX_SC_R_I2C_2 IMX_SC_PM_CLK_PER>; assigned-clock-rates = <24000000>; power-domains = <&pd IMX_SC_R_I2C_2>; @@ -144,8 +150,10 @@ i2c2: i2c@5a820000 { i2c3: i2c@5a830000 { reg = <0x5a830000 0x4000>; interrupts = ; - clocks = <&i2c3_lpcg IMX_LPCG_CLK_0>; - clock-names = "per"; + interrupt-parent = <&gic>; + clocks = <&i2c3_lpcg IMX_LPCG_CLK_0>, + <&i2c3_lpcg IMX_LPCG_CLK_4>; + clock-names = "per", "ipg"; assigned-clocks = <&clk IMX_SC_R_I2C_3 IMX_SC_PM_CLK_PER>; assigned-clock-rates = <24000000>; power-domains = <&pd IMX_SC_R_I2C_3>; 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: 416185 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 4C2D3C433B4 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 2049261399 for ; Tue, 6 Apr 2021 11:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242196AbhDFLdc (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: linux-i2c@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:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 417021 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 6586BC433ED for ; Tue, 6 Apr 2021 11:33:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40459613B8 for ; Tue, 6 Apr 2021 11:33:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242999AbhDFLdi (ORCPT ); Tue, 6 Apr 2021 07:33:38 -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 S242086AbhDFLdd (ORCPT ); Tue, 6 Apr 2021 07:33:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MC+zUzr/Mka7cBptgl7w+v3bnGXeX3h0Bkc5IZQ05oQbYgzcL4eicgBXTo/jxnEigQM3Zx3XA6vtaaumYEZMlz14K3YmGIgl0Den+jVKyb7K7JY1P96LI4wlod2UFklW0rPnX0nTENs/HY4HNle0HV6mfWhJcAXADvdPFg1iXvuVUnITHaaWvYcQNFYU7Vvq1t6WuCtueUnevXwqlfKTXzJlh3q1IVsbTM3TM88I3mctfsGsDyFFzw/wtiR+tVXiUyJbCtjhbPrMRQqcDDihv6r+GDxt80fIjx8D7Oa5n6iwQuCS358GQ85+xAaiHWKO8h7WvzLB23i+HNS+/I6nwQ== 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=YHBT619cLbGp748Vs3R6uZFcp3NsEE5WPSp4A6KS/3M=; b=JLlj0RmuKIqhprydSmIcxfJC9rHZymAIJnvknIVn8LXuZ6/NI2rUMIE9xJG3nThy+9k9QG2qewlM5PaTwGKN2KD8wTvvO16LnO3zuNXzWiJO5FAeieXZEKmU+6ueCLyFfQm3eZQr6Iz0jtUc2y5S9KRx26EtkKumrUvbuKluY3yFGzmommiJzJkeDtSdH+IGL3qIrq2tRHVWXWsnDaY8NA1FFxvAw5CaY3YzvZ8IRiBGRm4glcEcYyOX+OoiX949h1WJpKhGD7yHpQskRVU2FhOdu7QQl6bn1q/LTe6XX7omIT0Uh1xrYckSU1VfdqmJUp3pD6dEu2bnerReFCY/2w== 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=YHBT619cLbGp748Vs3R6uZFcp3NsEE5WPSp4A6KS/3M=; b=OoyKCB47ILuO8sbpnAJoaNPdywsI5CBcbxJ5YwQpQvSj3QQDhnVbES7Ab8qb4F7dnVxKp7ytH9uvNU555jlcA2QrAwBg6V1WcMprQu4lu/V3Bzm7J4UNtLhH92tS2DfPGpMyU108Sc0eBFtw+J4Ub5ekuraIWvQiVbuI/rUjiw0= 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:22 +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:22 +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 07/18] i2c: imx-lpi2c: manage irq resource request/release in runtime pm Date: Tue, 6 Apr 2021 19:32:55 +0800 Message-Id: <20210406113306.2633595-8-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:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2cdaa416-ab63-4c66-f5bb-08d8f8efc88e X-MS-TrafficTypeDiagnostic: AM6PR0402MB3765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:935; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PThFXg1mr/PR4O9L8Q8O4VuM3/MMezZwBlwZAPyqusqb91wwbe5GX658B5LILWb+Cn223tgk7Q4GjWxgj8D9zck9WsD1YqXXSeuUN9BnoK0ZU3tdVTViorigC1SrLR1ztLO2uYEHs/+83ttXRDbHbdaBJvJv9JLN5KU44/OXkOfVvr4Myglc9KQgcLGeEql8GQJQL8UIxYvyOwNceEIfSlMTvRNJ0UMMb/h6stjmTBiMyIe8KMtotWwnn6P/klMzSMw00e7F6H4VBS4O91p69GePvF1iBiGv/OFjkO+ctXgICrEvZHtSa0smLgr14vxCzGNvO3wZ/4FNHcUe9PcpRoX/81vZmb5e2oJN/TIPYKJRBu3JIyuI3kulo2jBTJTXGMAZcNSEnS1mPYZCq9fCpw9q1BDvriWXAcoe6Gb/El3Uq7rB31Z1Iq2k/3OJCSrZRRoEQ/AOnSanCFDcThJm6BWUU8NdfnMODy4xzXOMqWM467w0sL0fwcx71wt2jZmMIN/PHTVl/vaBa8zxwTD7BzADaMzpv8WGS/zFvLNBqVqO6HweGIvLwJuxBIs6WI8Ui/aWu4e46LjWtHtd6AUFWApOlaI7Ht+WJSRpjDs7x3dRy8EO1emXorbm/agBMlFzzuFGcEYaP6RelnOzsBRhWeM7ysTzVS5GZwFi6TrvszOkX4NnlMODucKW+Kaw68Y/MhMvK6ShsEWq4ZRFP+F8RA== 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: NOpwklhSef2UK+HhJBDQY506v66cCV12O3OB02/Fk5pTz1P6Lenv67Tn2knYyIUh5ViyQzfIRmCBPaq/GUS4y70VlEtOzyqzkdwocdvQD6KChqaBHIRonNYTiQe6sr9ufSIjAe4yXiSm6nrI7sg+T/PLKbKO6RpXcx9HHAX68koHhycVfoykkWwuxcdF+PO7/EpEb4jTpOqT35lhHG/802yUcs8TDpjRBmivvP5S44C/yKrmIYrCMWs4Y72eEDomrtAAZ0cW7mk3suLr2MavS6pHN1Rz7oPJj/4d+Ev+f8Jfss7zf9xTKEw0p14w8Hc6nHtG3Jr1YjSH2gj1Y0f3MHQDAj21N3wPKCiWqJOFVLdCCw1stOuK6v2v2SghmSLJSuMIdIsSYn1YpAfbkYmWyFlvt0aaVppViFWBYRfvWqsK4JlVa0VumYHHevCBfn+5rC7FpkEwQbeAZ4IFcZRRSda3YmmDVf/t/RbBDViNTl4UB4kzPDvKmWRIutuj8mNu71NjVBLIhhX4/IX0GfZfFmlL4ZMdXrwRprhIJa+t+husv+Qv7fnGVsWs+F5/LqHsd3uJoe4ze7c25pibvn1HIimV6tNhvB8JR5QWifjUU52KlvhLwndE9uH3BgMIq9kcfXT12p0BQu6rRTIJGfK+cGzdfbFFCU2PnmoAd24mT574U1i9euGkqHP+y29+UH0iqHqCjz2pl6kHxnXW7K8uLqESl4ppoBK6gkZPyw2034SFavX+KfPqEBedtvqEJv7xt3Dg0WwFdD50mCcSwK+RMU2C8C3WrtXJRghpVOI7zMcTvJ5W2chZNB1+HzI/cWVPpuCSCaTxRmDDmkBkCbNWUdPSL4AtpcLfI41A/nAaw0xYFa8fuIB7K8jEo9neBj1uT4AE8dp8iHu4f/Ip0O5slaQTJbTiRxZJgDBopAdfaYPsHtEqtQTMFkOShtGyE8vsVNtUxzdFYHPxh+xZEDynYss0qCd6NLq6TcqSHqd1TP6APp+nVBYwA0Bs5DsgrGYknYfrRFrZBB02yEcsNJojpSqw0KSHJmcjP2OSpXFGgtvNQSRXziX85NXKb7EZGN4mLC7NxOzpsfm+r4pk3Fautdl8fCDxYFXzeV+sSANpg4so8bAOK8en/aPr/IfESliktYRVnXDudSAzMWdWjGUoY3YljlDxyxnVOQvRRuyikewsyf3w/cIxCqrvgdGl1KHGkNrAzzEPMRXPBUdPdNhOcLxIXZV0LvO7mNhOUPbOLl1Ll6fz5ijwa5ooV7HW0xLhSTiMJzFF4OU8Luuco7skYkeHXVBNBe8A4Cpsn7ltHA0h4ACsd7rFXfBlOR6P6F29 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cdaa416-ab63-4c66-f5bb-08d8f8efc88e 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:22.0068 (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: gte1W12atBrLjXf7bDXJLV0B2Tv698YivWKh0qiplrPvtjjc6P+QsUQ/M/yHyaGIAqzLOyWonwzPwfQ82wKCDQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3765 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Fugang Duan Manage irq resource request/release in runtime pm to save irq domain's power. Signed-off-by: Frank Li Signed-off-by: Fugang Duan Signed-off-by: Clark Wang Reviewed-by: Frank Li Reviewed-by: Dong Aisheng --- V2 changes: - Change to use request_irq/free_irq. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 89b7b0795f51..333209ba81c1 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -94,6 +94,7 @@ enum lpi2c_imx_pincfg { struct lpi2c_imx_struct { struct i2c_adapter adapter; + int irq; struct clk *clk_per; struct clk *clk_ipg; void __iomem *base; @@ -571,7 +572,7 @@ static int lpi2c_imx_probe(struct platform_device *pdev) { struct lpi2c_imx_struct *lpi2c_imx; unsigned int temp; - int irq, ret; + int ret; lpi2c_imx = devm_kzalloc(&pdev->dev, sizeof(*lpi2c_imx), GFP_KERNEL); if (!lpi2c_imx) @@ -581,9 +582,9 @@ static int lpi2c_imx_probe(struct platform_device *pdev) if (IS_ERR(lpi2c_imx->base)) return PTR_ERR(lpi2c_imx->base); - irq = platform_get_irq(pdev, 0); - if (irq < 0) - return irq; + lpi2c_imx->irq = platform_get_irq(pdev, 0); + if (lpi2c_imx->irq < 0) + return lpi2c_imx->irq; lpi2c_imx->adapter.owner = THIS_MODULE; lpi2c_imx->adapter.algo = &lpi2c_imx_algo; @@ -609,13 +610,6 @@ static int lpi2c_imx_probe(struct platform_device *pdev) if (ret) lpi2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ; - ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr, 0, - pdev->name, lpi2c_imx); - if (ret) { - dev_err(&pdev->dev, "can't claim irq %d\n", irq); - return ret; - } - i2c_set_adapdata(&lpi2c_imx->adapter, lpi2c_imx); platform_set_drvdata(pdev, lpi2c_imx); @@ -668,6 +662,7 @@ static int __maybe_unused lpi2c_runtime_suspend(struct device *dev) { struct lpi2c_imx_struct *lpi2c_imx = dev_get_drvdata(dev); + free_irq(lpi2c_imx->irq, lpi2c_imx); lpi2c_imx_clocks_unprepare(lpi2c_imx); pinctrl_pm_select_sleep_state(dev); @@ -677,10 +672,21 @@ 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 = 0; pinctrl_pm_select_default_state(dev); + ret = lpi2c_imx_clocks_prepare(lpi2c_imx); + if (ret) + return ret; - return lpi2c_imx_clocks_prepare(lpi2c_imx); + ret = request_irq(lpi2c_imx->irq, lpi2c_imx_isr, 0, + dev_name(dev), lpi2c_imx); + if (ret) { + dev_err(dev, "can't claim irq %d\n", lpi2c_imx->irq); + return ret; + } + + return ret; } static const struct dev_pm_ops lpi2c_pm_ops = { 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: 416184 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 33E11C433ED 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 11B2661399 for ; Tue, 6 Apr 2021 11:33:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242932AbhDFLdo (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: linux-i2c@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: 417020 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 4A656C433B4 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 29FB4613CB for ; Tue, 6 Apr 2021 11:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241614AbhDFLds (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: linux-i2c@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:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416183 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 5A335C43462 for ; Tue, 6 Apr 2021 11:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BD4A61396 for ; Tue, 6 Apr 2021 11:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245603AbhDFLdu (ORCPT ); Tue, 6 Apr 2021 07:33:50 -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 S242950AbhDFLds (ORCPT ); Tue, 6 Apr 2021 07:33:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=crdwivKDBjAa3HpXm+4UEUVRJLB4F4OpcOv6+LXVqPLbui6XKuHJ3bn+wyzrK7EWHZq2cT7GLWvGa5YZT8IqOxdu9ISdXT2NQ4wZH5HMGfRF4yR1TiCuBgrBHot6TwrskYPqEQ1FcvkhdIwFKGCtf7qop5iGrvR2ZyBNR/vRvziwc5p48WBiYBUmgspSn+vFK1h/rNLZwMNXb2C7exW37ENAs9wYwt475ReiZ4Znkta7Vh/EvCn/R4m3DRzttzGS145SZk/ua1VKGhB2/mv7Pge6/DhIan6KPgSHjUDcI0roncx8orTqWwimifcfk8V20lx19M4oR2O2hdFzRYbCzg== 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=1ItK860xtb6WtGa2MT62um1Y1RoXjtqAHsk19jyRhWI=; b=Z9McqcO0ldoqog3JtUTXVV+vEkkp7mH3U/CJmyTLGtykhAwZM0RVEMjEjuG2YySKedejUO1GvQDQfDLtFdM48uMGzdYyjlIU/bSOm/wl/dUQAt+P49psdfY+yRNGgCwbkMQiBTOgQLVosHIbWd3mgHHchQv+2BKUh31Uld1egi29PXHu+eiaxEDCSUEz+ipbAE+mnhBqJpE3oVgxgOc4vIlKKS/b8KxGtv0gZhhTWMOKEzRHOX+9Ef5ERR+cvP2prRmfTzcVxy3+EzJnLfUL40us7l7R/do/6p6iWvBtg5w2brNOBT6PZ2LKSFhICVdMKyrgJ9m7sR9qnvnjKWRszQ== 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=1ItK860xtb6WtGa2MT62um1Y1RoXjtqAHsk19jyRhWI=; b=m4/T+dri4oXliMtdjTgad8CSa54Jfb6xbwLhWmIE+ETZcjoaqO/O8ZFS27THEnnQWVRzLWOCzOcYWU0pjxa27/5HNLJLuCn9XFtECROR1vI527p2JOlNXNEcxwPWkxJv7pvzurLVOtr77R4cJA0c+Lba/0HC6Yg0n3JhQdEj2WI= 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:33 +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:33 +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 10/18] i2c: imx-lpi2c: add bus recovery feature Date: Tue, 6 Apr 2021 19:32:58 +0800 Message-Id: <20210406113306.2633595-11-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:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 980d1739-2dfc-4deb-f904-08d8f8efcf1f X-MS-TrafficTypeDiagnostic: AM7PR04MB7142: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kXyWfQpGTValco6Y2Wm7n547wewAceIbnkeVxKPhvSTCU5xgXb0WoSo3PGqK49ErFHvzKvV6pnkOYzoJQewRk+gypMZEm+Pgi3v0BkeiMelFNYcRAPdZf9BfhiwmhKDSk0uhWcAd4rB79lPT29fzQidXjib4kF+nkUpWsZ+Ldmm/JYf8LbW2zuwYDe5R5AY7MHrUj8IhNgTnGiNMZJhJzuD4XQ+WCsZP/RL85jytuNj7F4ixOEmWkpa6VMMEXismWACsvgd4oijjn4vp7FEXn2vD4QNfkygbLh39Bnf0snxDvSFd4T62Xfk1x+bej2SFU2LxHgENMHSRhyeJcxUoxzEvQnTSX4HytP/Ew7c8RaE3OGPl6tlJAltm9pVWm9dAIpUcdwXMmUXbqtdnBSA162/FEi6CwNfgxBLt1UEDoZT/i+55cUfTmT5a39LS+Z7ANeIIXzkqavbjhgUBCYBOdxJyU870/rB+PmsEzfZaHREpY39WgforI8ma0DOu75GHYu+D3s3sm5FX1CFDzhnslVXHWenZh4lTmxP/jRmHJxmICU80DjLAPZQTBmu9QpyPhekwIh6VKIOAODKFg+g9R4ghY9SH4VQ1BBsa4ixXnfGMSV5zoCgPn8Na0f0pE0wVnsPXJ4mgMEFu2mxl7qYNhielYaZI2B66ms8Y6Ab8kKI8bzev7iBJZB1vrrgj3J034gR7glJjPQDkmmZqVG01XQ== 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)(956004)(6666004)(5660300002)(1076003)(4326008)(6512007)(66476007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Gcs+n5YPz6ncZvqyWKKApCeuZY9AnolRLT0WhAa+TkeO6YmEOJP0bKPv3P7yunX8EUicr2VlIaywLgjqToO3/zTIxb8upkf9YaclDoZpnIb8/VXChlcmXwxzKG6iU+SVy6wNZReyW99EI+WszV9GfIyCd/n3TGHjzygt+eEoKaeKjmwLF/UgPfMVh3ntZBiUWnm3YzNoqY8mh1gBbIb36/X9NeUGwL17so5LNVeVUgsJBA0Z2eAqxJ8x3VgXXqDHl/VKh2704v6sHXtuN+pHX7JKbPGzUdFyrj4JePz5mT9LIzF7ScV8Pfb+d4cAwXFmG6tyQrSEw5DKDA3q13cFORGFQ097e4/mDaMCQIPs72OlVypbTkO3O5w153LdYZgu19O/B/ICSgGlMP13GnhgxurwEA44j7oWIExRfoAiQRE+Wf2avqTIK3/2EjiwKO/lUzArIz2XDOxOc+RR/JiXoBtUhl/ZnBG+A35VwybQbqGN28Ksqz/T4Uxmf3ukfoAX7gioUB5qcCP0NPJKuHpqw0Oz7/oODPGvDKsKbIB+uCB5Aw3DnD+VRp/s/VNqlf49xVfxkAysgHYGeBZXxzIdc64Vx6wbWEBvaYXfl7dpXd+zKj6TeKyrEBTspuJ3IO/4zAB+UaD5ZsXMVUsFdXR92gu4V0O09Yn4GIwgnt04mHwGZpdIk5gf3v3L7cewVtPvjwJR3cDxcS7hDnTBIMK8IgaagtY4/YnBCh/T+12KkIygI7jBluuvy6vG7+ZXxL+167w7fCaWOOr/Sjj3yKgCHD2cujmQWq0cBmWUqBOL33PWr4Ll8e7NMMLznLl3QSS92G8vta4HcCajmimJyzqN6eJ6MiAICZXimIhf8wekwUmR3u5SikGqY5C48EYeCrF17pxwfAEscyFnzkpFCuYvZtEBKiF3bLrIbhofqGmGQISuHoXs5CPrHOqLH0dhgsFOgNx7G3NsT33DGKld4hrhPgKa3sVIAOdhF0/+U3m0vB684niFxdLTLDMzXgbWs09XFFIZ54FboLnVCVcuPUytEh6VJl+CDaVYskH5d19qc0dKep0mRLiaA+4UhC2bdk3hEimgkT+RpnO0E6/d7e2sQ0SnmTnPws5yjJ8yJhzxhTXrnEi71V8ZLvCOqfT4h6/lPXqBfDcj7CILkNUtIAIBOyfY6lIHr7KZhUB+JbvJasY7Tzovyu3Tf2qfYynJDjVUOQ6fs8BBBTTP69L6d5o0FHBijh8JfCuxkxy7gKxJBAETZzEegZf4vX//+jZ2nI+AxhO0uq35R3g41wcfaAtcMvKPnykXa4K3LOUAqxVtqjxoLGcji3FKTTSdpM06nQKO X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 980d1739-2dfc-4deb-f904-08d8f8efcf1f 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:33.0105 (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: Cf7VQH3frCHQeW99z4I3uYlBJoGh5Jy8/QUlrRfLb5wgrL6RPxYjZrYfoXTmWh79IQAx8jlBu3OL7+LjuWc8xA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR04MB7142 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Add bus recovery feature for LPI2C. Need add gpio pinctrl, scl-gpios and sda-gpios configuration in dts. Signed-off-by: Clark Wang Reported-by: kernel test robot --- V2 changes: - No change. Add dt-bindings in the next patch. --- drivers/i2c/busses/i2c-imx-lpi2c.c | 83 ++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 77ceb743b282..77dd6ee5a4a8 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -108,6 +109,11 @@ struct lpi2c_imx_struct { unsigned int txfifosize; unsigned int rxfifosize; enum lpi2c_imx_mode mode; + + struct i2c_bus_recovery_info rinfo; + struct pinctrl *pinctrl; + struct pinctrl_state *pinctrl_pins_default; + struct pinctrl_state *pinctrl_pins_gpio; }; static void lpi2c_imx_intctrl(struct lpi2c_imx_struct *lpi2c_imx, @@ -135,6 +141,8 @@ static int lpi2c_imx_bus_busy(struct lpi2c_imx_struct *lpi2c_imx) if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) { dev_dbg(&lpi2c_imx->adapter.dev, "bus not work\n"); + if (lpi2c_imx->adapter.bus_recovery_info) + i2c_recover_bus(&lpi2c_imx->adapter); return -ETIMEDOUT; } schedule(); @@ -192,6 +200,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx) if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) { dev_dbg(&lpi2c_imx->adapter.dev, "stop timeout\n"); + if (lpi2c_imx->adapter.bus_recovery_info) + i2c_recover_bus(&lpi2c_imx->adapter); break; } schedule(); @@ -329,6 +339,8 @@ static int lpi2c_imx_txfifo_empty(struct lpi2c_imx_struct *lpi2c_imx) if (time_after(jiffies, orig_jiffies + msecs_to_jiffies(500))) { 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(); @@ -528,6 +540,71 @@ static irqreturn_t lpi2c_imx_isr(int irq, void *dev_id) return IRQ_HANDLED; } +static void lpi2c_imx_prepare_recovery(struct i2c_adapter *adap) +{ + struct lpi2c_imx_struct *lpi2c_imx; + + lpi2c_imx = container_of(adap, struct lpi2c_imx_struct, adapter); + + pinctrl_select_state(lpi2c_imx->pinctrl, lpi2c_imx->pinctrl_pins_gpio); +} + +static void lpi2c_imx_unprepare_recovery(struct i2c_adapter *adap) +{ + struct lpi2c_imx_struct *lpi2c_imx; + + lpi2c_imx = container_of(adap, struct lpi2c_imx_struct, adapter); + + pinctrl_select_state(lpi2c_imx->pinctrl, lpi2c_imx->pinctrl_pins_default); +} + +/* + * We switch SCL and SDA to their GPIO function and do some bitbanging + * for bus recovery. These alternative pinmux settings can be + * described in the device tree by a separate pinctrl state "gpio". If + * this is missing this is not a big problem, the only implication is + * that we can't do bus recovery. + */ +static int lpi2c_imx_init_recovery_info(struct lpi2c_imx_struct *lpi2c_imx, + struct platform_device *pdev) +{ + struct i2c_bus_recovery_info *rinfo = &lpi2c_imx->rinfo; + + lpi2c_imx->pinctrl = devm_pinctrl_get(&pdev->dev); + if (!lpi2c_imx->pinctrl || IS_ERR(lpi2c_imx->pinctrl)) { + dev_info(&pdev->dev, "can't get pinctrl, bus recovery not supported\n"); + return PTR_ERR(lpi2c_imx->pinctrl); + } + + lpi2c_imx->pinctrl_pins_default = pinctrl_lookup_state(lpi2c_imx->pinctrl, + PINCTRL_STATE_DEFAULT); + lpi2c_imx->pinctrl_pins_gpio = pinctrl_lookup_state(lpi2c_imx->pinctrl, + "gpio"); + rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN); + rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN); + + if (PTR_ERR(rinfo->sda_gpiod) == -EPROBE_DEFER || + PTR_ERR(rinfo->scl_gpiod) == -EPROBE_DEFER) { + return -EPROBE_DEFER; + } else if (IS_ERR(rinfo->sda_gpiod) || + IS_ERR(rinfo->scl_gpiod) || + IS_ERR(lpi2c_imx->pinctrl_pins_default) || + IS_ERR(lpi2c_imx->pinctrl_pins_gpio)) { + dev_dbg(&pdev->dev, "recovery information incomplete\n"); + return 0; + } + + dev_info(&pdev->dev, "using scl%s for recovery\n", + rinfo->sda_gpiod ? ",sda" : ""); + + rinfo->prepare_recovery = lpi2c_imx_prepare_recovery; + rinfo->unprepare_recovery = lpi2c_imx_unprepare_recovery; + rinfo->recover_bus = i2c_generic_scl_recovery; + lpi2c_imx->adapter.bus_recovery_info = rinfo; + + return 0; +} + static u32 lpi2c_imx_func(struct i2c_adapter *adapter) { return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | @@ -632,6 +709,12 @@ static int lpi2c_imx_probe(struct platform_device *pdev) lpi2c_imx->txfifosize = 1 << (temp & 0x0f); lpi2c_imx->rxfifosize = 1 << ((temp >> 8) & 0x0f); + /* Init optional bus recovery function */ + ret = lpi2c_imx_init_recovery_info(lpi2c_imx, pdev); + /* Give it another chance if pinctrl used is not ready yet */ + if (ret == -EPROBE_DEFER) + goto rpm_disable; + ret = i2c_add_adapter(&lpi2c_imx->adapter); if (ret) goto rpm_disable; 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: 417019 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 9F1A4C433ED 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 70344613CA for ; Tue, 6 Apr 2021 11:33:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245635AbhDFLdy (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: linux-i2c@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: 417018 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=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 1A060C433ED for ; Tue, 6 Apr 2021 11:34:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DC90E613D3 for ; Tue, 6 Apr 2021 11:34:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236753AbhDFLeD (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: linux-i2c@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:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416182 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 07D82C433ED for ; Tue, 6 Apr 2021 11:33:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BA2A8613A3 for ; Tue, 6 Apr 2021 11:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbhDFLeC (ORCPT ); Tue, 6 Apr 2021 07:34:02 -0400 Received: from mail-db8eur05on2042.outbound.protection.outlook.com ([40.107.20.42]:42593 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S245630AbhDFLdy (ORCPT ); Tue, 6 Apr 2021 07:33:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gS3K5hu2xX5QDAS+8KSUY87mAf9eTrjiexwdCqVFhiBE5XvmCwMc73CxavNQbwr/dbpdDFiAgQzp5m179JgioyBbJsIHTNhAc5NfC9OcSW24WtXcOWHhHp04N35fHhSQEhonb1XCFwEn2cFc3GaEGEU1n2w2zTGIRPbFugi+ay+/4c5yNtJTnNBthd+x668l0Qyhwx05bdeQwLYRUvX2F+7I1latqjhYMf+4HwVztZ0hDUvovtqKXyWbLXLsAgpw9NDD7FVdhK8nq5C4rP+1WRQ17TMqg6Uf0/a7Tmu8I2YyBG71YGoX1rEtM2jrz4rmgo91BYuWjPk+FbU3Nyl/fw== 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=z0DJbMGP5jtQt8jmC7BVVzD6nrFLd/WlXnJLdGk67fA=; b=oOFxnOdN7I4vcpvnXKgKzqiOPGsfVJuH8Xqmr0sEi0EFZGKmVw+YbxAyz+LXsVmOoXEGqMY0nT4frHqbRachrDmKOTqJ193yA511UB7fx9XoIMqlzG3u2jTqPEzat3v+afG67Z9x5Mkq+XskVncV4G3DUDFw14WZTLrY58oVJ4ChpT+el+g5G1DNIvdti+J7kRrjXpVlHcl9Td5uMRSmrfDRt/oqD/Akx+VavNgYqOb7JgLttb9z8s4xDi8iSXtR/M7E2UKbiqEGyaN8/ZdMOSxp83LESuf0m7AGXU75tprpev9Ph51PAcFqgtl1ueekS1JpiWJzoY7PGGXFujJx+w== 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=z0DJbMGP5jtQt8jmC7BVVzD6nrFLd/WlXnJLdGk67fA=; b=gO8zaECKHbutYwUyWMODF6CMgagPGCYPAI10LWSUNarNocqqCAA/BXFm9zckiA0igRJfiyRNpkVUOeX8kBsEnJVCUP3x6S2zui1lQy7rOhbw7mmpfc/m6K+ptlmw24x+RawwyBDMeCH+7Kv9Q57qaIpQZOIFwhmQ6q8hEu5SpSM= 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:44 +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:44 +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 13/18] i2c: imx-lpi2c: fix type char overflow issue when calculating the clock cycle Date: Tue, 6 Apr 2021 19:33:01 +0800 Message-Id: <20210406113306.2633595-14-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:40 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b24d3e50-0d76-4d8a-f0b5-08d8f8efd59b X-MS-TrafficTypeDiagnostic: AM6PR0402MB3765: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /PDyrBOmssV35Kqpvb+4J75Y7uTev3Uat5aJd3uyKtJa/QKGn8lOdnnOKHn/hOE+77xek1szeUlI2mum6iM5EKpGML8PzIyw3bGEPHX5rJdxwKBPa5hsoLn3LanjO17vqtfc6cxgHpEhlbjQ2IVmHn6EPoQ0gd2EmIdexA4h4wpvCAfx7N8ZN7Ygb9GU5ANVuQ06jMGh3vvhThzy/S2+BXAuP3Ot+zSjQgmm9/3eIJramRu752mTjN0wW+WA+H4I+R8cqFMC1NKim5JTBP1aR5h3S/GkIhS6+XtIznwUSEkxribkkjbUKSY5a0EG2xbvfdaVtccPq09Dm20HmilAQwyLPs17+zxo03K0iTaGjrSgyt0JiUn/tTDSU3yypJaH8LyisKGupIM7y02daAtpRmZFpZFuumfUXGawNhfHsqozE9ARy86PqtMxMUXwLhkJjQ4Yu43LGllkXWuXSLuT4+c2RgTy6IyLhwlMuZxvULIMUpkhBKDDzShuEjUQlYPXFA3QwsXn26chPtEAK21uI+zTp10630mXsfPn8rMDBva6Mx7CTj4lB823cKNkZTEbx3Lld1lukUnSPOajtaS0E8+2QFIw9fRv3j8zEwTDAHcen1WPi0x5ZL+FAeiuElHFqSlGDnmOqEqmDuxufuYo7Bb6FZDKd9saV/kHtz2xgCQB+o4m+Isl7VMP5chn5KHkDK1V4C9E3Av/xXI5MY1VBw== 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: 6umrCu5npt5Meqb9QbGL/5VagcqBgQznm4R2WPWMJQIccIwQoHnp24e2u2k7r+7dHZeGhQ4FSsHOcUjzppubxfnj/EB9FqRIE/Lh232XwYBv1MLqIvCU/dAns8UePqFxfaBcN4whPzeIr6SYBhWL+h6O7xRMjANjV535OjvOHUGylPaEW77dl5PnPMDM6DDnN21vxBmSvcZnoxmwFEx7Eev7M7cqU4+rd8ersUpgF+/xmUqc1uWyHBPA6+o8Vo8+Cur0dQtiRT1ovYo46vzpGwOC+Y96eWOQvs9zc9kOY1uJHiUwCc4cQlzr0K3OUI78qgp6kMLjRamDAJFL31nqXZPdU8KfFBMA1n6byBTHLhlUSZ72CdjVEIeOTozCmrkwAUHSaWoWPqaTta+DKB4deRg2z8UWD4iCv8MO07Ra6c8vXIbhBOOAC+26q+jUyCJ1Kjoj2rIZNGoyJf2Cb8fBWwAsaLjBaZiD2QfWQzfYukgMwYtgD7L5iX0milQrxLPNqP8sjZ051o9X9wq3RPLXJ46LO1QQp0B39tdeWwjjCGBW/+lRU3Hcszz6FHRObuNAtA0mPOwY3ZTbyn0EOdsDDTcEBELLtPNkF87xyXNwblXfEUsHO5rTPjSH7EX5ftpiOTwE6p8dI80uuud2dNTwxXcDvSfIrMvZA4NfMyTl0Opk4yXI2LgK+0mctg8/Hqk4Y4dxZKAhLqGIEt+uusuIfdCiNmsIZKBwKU2FQqu00AHelpRbvSMQZDblYBJKaSNWlcQ/9f+elNwQaGkJpVFMwkA4h55yW5BnRwNsna9SztKSJdqMtUxxNlPukjtYQxhbgBEuxP4TxmNtOv+bzspGUC7NMvVYy2Uj/b4MFwK3um5uLd4Sd9TcB9ylodtCKmxhON84DmgT1MXDuG89ivwEkC8cC4owSvKDYTx2ZZ+N290ATjXyuhB85koSC+nrTx53JPaIQ2w3jZ7TT9p5I4dfgr9OAZjrmcc2C0XOvaNloIZmZY6dUS4n3d1/bHBd7fmxumyZwrFhw/pi4JVtb9FdU1NspOM/fuy2DWb0ad3915g9IU9jWxABVxSwEYwy/d9fPzSxnRl8ATP6ueuPqsN8FSrS9vL1cr/BQGUMMrxd4//GTLDUT+dHpPfNgKvyRi/ViTYcP778SWH+NdaTQCsZ8X5+4DPKT8l0gxR+WjB7aGa+WMXErHBYqRt2hzdPA2etBL4rTW8gGlPydiYQWnhWOCNhBSUtDp4fYZ7phmsKI/u1U3vMmZ+uFRPhoV+hS3rGgWzUz1Wk4Z83JUny5PxozhR0UIgKtCP0tFGiLhMWlTTtsFQGmIM7fiv06lt+w7zn X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b24d3e50-0d76-4d8a-f0b5-08d8f8efd59b 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:44.1132 (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: BFo7ad7xsZCViapz7oVu3AVRJlljmTC0yC7L1u9BWWEipzrg2ylXcZc5I2A4gFiNN2eKYfxR9CW4z2Iiz4AIhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3765 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Claim clkhi and clklo as integer type to avoid possible calculation errors caused by data overflow. Signed-off-by: Clark Wang Reviewed-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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index d124c4000823..c2f8e49660ea 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -213,8 +213,8 @@ static void lpi2c_imx_stop(struct lpi2c_imx_struct *lpi2c_imx) CLKHI = I2C_CLK_RATIO * clk_cycle */ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) { - u8 prescale, filt, sethold, clkhi, clklo, datavd; - unsigned int clk_rate, clk_cycle; + u8 prescale, filt, sethold, datavd; + unsigned int clk_rate, clk_cycle, clkhi, clklo; enum lpi2c_imx_pincfg pincfg; unsigned int temp; 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: 417017 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=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 0B048C43460 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 D60B7613D0 for ; Tue, 6 Apr 2021 11:34:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242952AbhDFLet (ORCPT ); Tue, 6 Apr 2021 07:34:49 -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: linux-i2c@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:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416181 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 40730C43460 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 1ECAF6128B for ; Tue, 6 Apr 2021 11:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238284AbhDFLes (ORCPT ); Tue, 6 Apr 2021 07:34:48 -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 S238346AbhDFLeC (ORCPT ); Tue, 6 Apr 2021 07:34:02 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n0KPj+GgJ+iPjdccgZ9h1WV8oMXpcY5gyNd8HE2m1+5YlghFDK8uBK0n/+zmhertv8hm5GnCWXxgl4eq31CBkOUGgMOCT3JuE+7biUAs+csycaF/zRlfq79KFKLWGRGLcSq1TgiskQerjSr40znGsk4GrSLgZRx1cayNS6/wAnTNqJZxihxfwS5it8oqUXcWR/ZuXCAjlex7OWOm+ON0JPWWikq1Woi8rf0EnyxDUt17jjBxRr1i1mvHfsJwrF5K9neLC1uR8USQ7wJ3Kr9QfmbZlc9N4mKaAj9LPfHgXttNmLk+c++XZB4pfd1srVSwRepLF3zWEs1Iu0d37WCl+A== 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=RlsQNheMsLfUzZMBi494k56EUF3qzqHcstMOTN168/M=; b=DRherDCN6uiIec7+8jI7vD50CLkwx0OK7F2JQah/7DLTHTVjaV+HmmzD8QXJE4ByQgtIrOrcyWn9jJO6EfiY+v+0YbU4+o0j2/s3Gtelv/6UUanBbKea2ryGBQCAVfqTGsqVS9SEQsOygavvIFGnalFbpuzRLZ603LzFHv/rFF2EzbePW8SNeULQ0QsCG+0j73agKLR6GN30UCIXNA4C2ZjIYT53T/pXuYlvex79STNZ/RYMocMJe2RMv3x+ImJZecU9Ab9+7qR6VvIjhEfXVWFjC+1atMzRefdvE9OBF361eonBNGQKNxmHZoqj8P391/jj5GeXHXOVc4B/+jNjZQ== 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=RlsQNheMsLfUzZMBi494k56EUF3qzqHcstMOTN168/M=; b=BCQf44g7KmEYNq1SnPIKls2AT/gCkg8MjLsm5W2MQs/HYfTUhwRXepX2IaIb2Hw3qcxe2fF2mv+NVTZs0VyObMW1uuqcHFj4J9hQDilEdVR5SlzYKy6SOI/xlwO6ndaxsgXxsGa3VxwtciMAhewLPmXnJ7o4cMGfUN36lf0hRZs= 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:51 +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:51 +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 15/18] dt-bindings: i2c: imx-lpi2c: Add dma configuration example Date: Tue, 6 Apr 2021 19:33:03 +0800 Message-Id: <20210406113306.2633595-16-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:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc5cca9f-2bb0-4535-8bd0-08d8f8efda01 X-MS-TrafficTypeDiagnostic: AS8PR04MB8359: 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: jbEUiQJ9Lk3eMw9IyVLpn/Kco4Q0Xi8VHGs+9MlXt+5DroQDQ/2kcQbxOrhP8FBih3OgK6nhf56WSaXJTb8HHblcvPUjZEjv/A8jwZTwq+iCTofZr70ijYnQ3bkBkqDxE7XTFJgRHUtWjrPlc6F0/9NneCAM/hAJqZ/ZQ2q6B8rn8UFWvkbSEZaDZ1UY+6Dc2NTH70XPkeXsX/FXlVb1UGTAMAcOdPWkbufoqN88Sm1wbV8I/MXzuSb2ezAlgtanqMMd4RNfvNUvvOLZNY0YtbCCP2IOvY3MrjOIE4IDMYfSb9BbH97kYlTS+sJPpxjIqZK/tKGMTX0mHqMEN0nCFszOV5uOU2400VDap8cGako1dNtskk0McCTC+OQPokVWIs5FTC69gpKUf30uh/4dFZKBLfsARwYEFx8Hj6LXeUf976PY9GUrV4pklJF6uB/oMIf9R5MHOzJPAanUOhkwOnL1q3XZFIWR4OelSI9OLgU973ft9Dv29SgN6a9zFlihxptny4uRPlLmp8F2SnOdyLoV4Pt+l6KLS+XIEO4Um4hxB9rgs6/uoeab+hXIFmLZLhizV99dTMLxxjU6ypcQXHxSXPtXSoQw1JjE32ysqeVk1ng1bnthzL/3T7RFHoEXYEIqafUpvD8PDrPRKcMaQfzGs43FN1Fbf3yMde6bqleJJEOlv9JJDgkjrWLSZD8gR+nLRJEp0lxUylJhziLtQA== 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)(2906002)(38100700001)(956004)(2616005)(36756003)(66476007)(6512007)(66946007)(66556008)(1076003)(498600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: UQle0m/q1ZHUaFKhmUtXeYgse6KCPFEOjpsZ8KkFGuYUhLKbvdbwA/jBt9Rmy0neQ+udJ4nkynNBmpIjqe6SWFe4oYC1L+fzFDNhP1cRUiTJTyWi798uSCU183zAyt7/2vJf7RM6+dK5HyxFyVOfv9FI4eUgxT/IoYBCYDfQEiFovfO9JmGdOLP5XSCfRgcUuVl/2Cn1ebuaUFi2g52U4kRpMEHl9nxsopnbvgX6f8wAvF3sWmHy11Z8lolvtnMjkSKDEvD28fQ6FCsFnVtcPZHOJ8Cls/O1ECreVQmkw289x0HiPag34TYpHX0MY7eGf5av/z6Xew3z50Lgsa6KV0E3Ujyte2yg1zxG5Z24Te8K5PGrKDpGISJF3rQrLFBQUCzjpLQ4obSPtLYvNH/hIJtZuHPBDD+/tNrDNwluX1xVVKIKxpdUlvMPlSU7c0JIFugHqKekqC+ODVjU1QjdfA2BsR/9qNApE6mOdqGkI8E8TJYNOyNX9a1Zx1jBoruP4DPQyKpPp5Yq+ATyRtLn2WRdh25N3OSj3sNdMa2K097NmV+l0aS0h6j3Cb9MZtvuZ9JX7S84czIMIc4eGOJvAdHO+dVHIrB9/nLDp4GytmyOpYzIWt/1KGYqTzjP/F5BeEtrMe9HuQdDJpMAB1RMISeJPLPxmm/KvX5og49juovEyLB/elXdfxE5Uj/poIeEO6e23GR4D/70qJgu3Vl7OXTZYdkboodpZJZMp1+cv3fQaXMUWewcl2oAC+8b+EpMz0n4Puhrmvj7oEeYEn8l70SC7FAxQ25o/Tt5J8kHe45dj21qJbrCash5PTe0Fg1xLXjgxXf4Ps6NcIh2xcVVEkN8hj0OA1Iv4fsrvX8flp1He+doTlYl7EqFT2wlMFO7aKqOQ15Bx4LkY/QNgrPYZRPac7s6bgcXccbUsrYoYblyCMxuUEHCcPUDIm3scX6uMukNfXPgntrTIjAR+vqbL8A8dnPW1lTleF9tNW+b194Bj8x8HLjoXO4FU8QfKDP4D6BS7DbluZY/tFPWB+0HElXxv/azTkz2vcnCJT6ef8+9IHs/FzVP7beDwEdQDTALzH2gRTZ/CvMTs/0HbUl2jqKCXMACCrJCrfcE2oTLy4XD5SauD0nSA2GQj9GYRafDKnFzxo0hbNs0TnMHSo7Gu/CxI5CiWewQvwunWMi3rTkGrsFaTvWP61hJP0CfluVOrNdCdGE98Yfni3hZVNRqE6GQMjQN1liB5bGOXhgU6U6YOhqlKjYuqDtcS2INIP1FYx73WTwsxnepWVwMbnsOktDixWYdSivEGv0/OGAoJSX1gSc8Ve+eSbtkTH5VIj3m X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc5cca9f-2bb0-4535-8bd0-08d8f8efda01 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:51.4749 (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: KeKiLDBxMVQxMaHqGAy0MXxhQsBTORL44HYUxIUGT7SODPzul144n++3ox+es1gAJqcTwB1mh0uzpju3eEiCog== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8359 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Add i2c bus dma mode configuration example. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- .../devicetree/bindings/i2c/i2c-imx-lpi2c.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml index 0a4b28827dcc..3868fec0cf27 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml @@ -51,6 +51,16 @@ properties: sda-gpios: maxItems: 1 + dmas: + minItems: 2 + maxItems: 2 + + dma-names: + minItems: 2 + maxItems: 2 + items: + enum: [ "tx", "rx" ] + required: - compatible - reg @@ -75,4 +85,6 @@ examples: 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)>; + dmas = <&edma1 0 16>, <&edma1 0 15>; + dma-names = "tx","rx"; }; From patchwork Tue Apr 6 11:33:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416180 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 0E9DDC433ED for ; Tue, 6 Apr 2021 11:34:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D558A613D3 for ; Tue, 6 Apr 2021 11:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245664AbhDFLeu (ORCPT ); Tue, 6 Apr 2021 07:34:50 -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 S245678AbhDFLeM (ORCPT ); Tue, 6 Apr 2021 07:34:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=baJT+MsGQd+eHq6VPgh8qXM/krMS6LlntswvlDDLjaCwzDKi9jW9HydH+vHmGHXDWmnuvtnQCdmEkrwHpnlsY2xprBsaxV5nJDXCq0tuNKwCJVYrNjuVb3iHH36b0VkYqCc2gDLwZ3/JMs9phhECRyqzQxzma/fRgff+KnEMtU65DMmF5tJi6ZiaY5iLkCbMIwZt/x0WD/pA1C6CHmqxmCFOHeHdv/3w6y7O83kx431epr4nw1Y/qZvb5E4NZG/rfqEI19kuEh8Pldj8iUf3Sw7cjFlunzRHGAbVTrW4OgNwCYGuh+DbVXiYKFqFZcQK8tCFR1VoKjjBFjLwdQNzoQ== 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=0IhdC5K9KRswvsw0bEREtNYb2zNFz2R22TVQ/JhFVvQ=; b=LMhfZrHU2iLH6kEcYOtoaKgdsZed9lgNPFZaOdB85irxy/z2gb5y1kDzcjPj5rk2LwG0EbyJtucDWBZ84ZWhGBJ9oCg0eEB3j7nnGM488hPj/pX6B7KdWFYKN6gHSzT7I15H2PO2GeXDW9Bp4BIg0FdQ41fvzbDXSxei+FykhRo/vgLtj99djN3xBABIC6hEr/PmJnLzro3YT0juhibBRhsI8iQb/RUcx3f1nKlAFGuzEsgD6V7oKrQe5vpiXH2T+m6i9UvJKIFo5WqzoKaz7NXsyXYE5/rsl+gU67mGYrX7boQ/1K5q8jZ3ntVGDvAUy+0EfTqc/4jGgPeFJR+kEA== 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=0IhdC5K9KRswvsw0bEREtNYb2zNFz2R22TVQ/JhFVvQ=; b=Qt70oEpvC8VWjY5CT3dHEu/0Agk5fqzypKVO3voyL3tI0cNxZugiXg9qnTE54s7tNvaDLrpVa1x2TulDl6KZaWNIApVp85iZ/d5WQeBOIm5xHgIVGj2luN0SR4ggWw9/OoTCu6Xu3kYORb/+29B7Y9U7rzuc0fIh1TVuNHH60ik= 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:55 +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:55 +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 16/18] ARM: dts: imx7ulp: add dma configurations for lpi2c Date: Tue, 6 Apr 2021 19:33:04 +0800 Message-Id: <20210406113306.2633595-17-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:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3f2eaab2-a24e-4ec9-67c9-08d8f8efdc3f X-MS-TrafficTypeDiagnostic: AS8PR04MB8359: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1079; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 54jdds3LhWW7caCOoJrQCtWDxC6JzoCGQKIYsVLtwOWCGd0RKZztOvSvjqJALKiHWA4C1vYSxyQwPHr5Th++ZMa7tQspemfjcynhtnle3raoI9oIxzJDK0Qer3CKotHI3BfghdGMvPT02Osh19yCMda5OiPt1p2RydDrcbSQSlQUdCLq3WuYfPRAMfuvvWoWF74K/2PZlTfMN9W6u3PM/VbbutmY9nUZxfVufkNDnRb5LvIKWgrN63x2Ui63k5kf1Gu/0/LdKTBcZML5zD1PFnr4Kh6b0lYBBP5kVh5/1JZZ9YnDKCJo6NaVI3wqEA2JYenQReny6dI9ggiwDNpnVVyivv/qV4U+LFMHyEsb/eynur5Lckqz17CaSo1nB1YVB1/SXolkxF97LNIi8v49ARFasGYFS6CTEPxX/3vkEwZrPTVNfXM8hv7XIIChUvIqCO3MqlTy2OCp6L7p71DO5aDJEQvLVRNICvXavcE1SA3aGenU7ES4cMkH22TgkdNzb2KawFKxqnxJ0lt/q0sTaFi9VbbeoYE3Ebqz2jjhWkzcozjedmC/j+tPig/5A0A5ek7IUkvC0iLe8tvY+p77W7vpPXOFAmnaY3Rdwd2j3aQAHAXKgXYXVaSD+jHnU5PSrvFr/WjoCBOB6x+9ZH9K8brq8Gywb9zWtZuSWgbc19YVvO032KkVwzCnNbWBS4Eytwth+SEOVnyWxSXha3BdNw== 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)(83380400001)(2906002)(38100700001)(956004)(2616005)(36756003)(66476007)(6512007)(66946007)(66556008)(1076003)(498600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: hEvTdSNWDuceGA7B5hK0CHpr11eiVBSwJ+v7ZmZP9rW0xACMrZszEI11H8VT12bCKOvyBByc4g0YV0+uRB4xeI+eP+QgFmukS4UAnbUu96mG4MXA037xoLUpwUKCiZcZghBrfXGgkADwRQbK0kDdzr7s7KtQcXEzzfatWOFTWXk0A5z/c6Ef+dQdJocMBzZ7Vfq4jNFORX+eMYkF0bBG8g5ZMvoqXYhivld1TN8dIwQcZUG1o3gemtlSGGFNXGab0gSD00iogLc8GsSu7qPF0lfqeq9Q7ueg3sAokzWKTWJgBfPWa+b4wCjCnwElUQznSuFF03GPEQ65qPMRzZBwtuJ+pnTrkiXdxoMFc9+aIwZdLp8NXlqYCarw2RUCbkVj2SFXHDbBXA8nJAXNE8cDzGcb90gep111ct3dx3E8fXpPFNYpg3a34gNUubUm9DBn87qIVQEta6hp0BylbNj35voBkYcD2l7P7KSxmeB7H4AjcGizdfcnMTTqJ/jPEqej+Ye+4G5fCWLdCGXJMNG6AWF1nHbiyWJCbX29ZnR+aocvDbor0N218fy1ahV7yaa06Aiuubi3uxzflMxvhj7ue6qopfMVHUID/+1BgSbPQ9goWNI5QbrWlburZdccGdR0J9n5gpXUx/qOROUGm4hXNJoi0G/qEheXUF3KPM63Zqr631UXFEb934USNiyEMaPj1N8fKaR0nqchrg6sr+lxUmcBBViPinhgGrax0AZAHAZSp5T0uRyVLTJMCUCjnj1+FW6RjAOf05JCYybnlx6vZ2HvuQhkQWSO4csGJw5TtoW+NgIuC6MbyOH+U/UrAZf/8zAXn2Wxx1DbV6iSgGphghuvxdkI/dhrIsVZiC6xiNE0XYGLBl7DxeL/NWubZHYa+lJZOUwt1dWAij15+eV/SCTzYHB+FBadUI0Mh0JoYm+3vXknNdLYlOZGvQsh8t44vAtC8+PXFXqnzNd8UKrzqle8HCpSSkvVpXHO5joYTLT3NhHRLIZpuLEUgdEEug9RgLYXXzfF0EsVxpkGI+vjdDcFLJp0tX2UA4bKU7wNImqqaPaM+eXGaBRHx1Ik08UOqG5C+rIe5eJ5LX2GTZF6/aukJRxcz675x3w8dcwWmLJu4bKE3Q/sJtYYbFM/wyjbFRFd3t4AYNS70UmsPrUNf3kR76F2/Xpr0aJ5d77Io+zMwIJsAlXhWKlDXcs/PpBCG4jChcfwaKBlzuvRYw3bTLVwV+El9tpa2PLzITFNx8LVBCAveFs2YSFOrGpgWXXnmsfd//QVQtJKWqmrQlU33Pc3ZkVrY2+BdvNY/Mc2LTYmFn2y7e8SeChNisD2ruGh X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3f2eaab2-a24e-4ec9-67c9-08d8f8efdc3f 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:55.0799 (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: g+K3AUYmFYjAFRsDhrXwnxWhPJwDjPXEEScaF9tLoszufxJY8RUpqJ6StwBksvQHm5R72qmRcXmReQ80qUmNSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8359 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Enable dma support for all lpi2c nodes. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- arch/arm/boot/dts/imx7ulp.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi index 0c51fa79c0bc..a6681836ca05 100644 --- a/arch/arm/boot/dts/imx7ulp.dtsi +++ b/arch/arm/boot/dts/imx7ulp.dtsi @@ -157,6 +157,8 @@ lpi2c4: lpi2c4@402b0000 { assigned-clocks = <&pcc2 IMX7ULP_CLK_LPI2C4>; assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>; assigned-clock-rates = <48000000>; + dmas = <&edma1 0 10>, <&edma1 0 9>; + dma-names = "tx","rx"; status = "disabled"; }; @@ -170,6 +172,8 @@ lpi2c5: lpi2c5@402c0000 { assigned-clocks = <&pcc2 IMX7ULP_CLK_LPI2C5>; assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>; assigned-clock-rates = <48000000>; + dmas = <&edma1 0 12>, <&edma1 0 11>; + dma-names = "tx","rx"; }; lpuart4: serial@402d0000 { @@ -361,6 +365,8 @@ lpi2c6: i2c@40a40000 { assigned-clocks = <&pcc3 IMX7ULP_CLK_LPI2C6>; assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>; assigned-clock-rates = <48000000>; + dmas = <&edma1 0 14>, <&edma1 0 13>; + dma-names = "tx","rx"; status = "disabled"; }; @@ -374,6 +380,8 @@ lpi2c7: i2c@40a50000 { assigned-clocks = <&pcc3 IMX7ULP_CLK_LPI2C7>; assigned-clock-parents = <&scg1 IMX7ULP_CLK_FIRC>; assigned-clock-rates = <48000000>; + dmas = <&edma1 0 16>, <&edma1 0 15>; + dma-names = "tx","rx"; status = "disabled"; }; 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: 417016 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 07674C433B4 for ; Tue, 6 Apr 2021 11:34:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF3CD61399 for ; Tue, 6 Apr 2021 11:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343568AbhDFLex (ORCPT ); Tue, 6 Apr 2021 07:34:53 -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: linux-i2c@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 { From patchwork Tue Apr 6 11:33:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Clark Wang X-Patchwork-Id: 416179 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 B319CC43460 for ; Tue, 6 Apr 2021 11:34:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 94FEE613D0 for ; Tue, 6 Apr 2021 11:34:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343572AbhDFLey (ORCPT ); Tue, 6 Apr 2021 07:34:54 -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 S245723AbhDFLeZ (ORCPT ); Tue, 6 Apr 2021 07:34:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Sar13/hU5sKw0l8QL9VDopbDo2wBqyfbR0Y1WhhxcnUIRbdoUTtjAg+YwNCuNPJwGsoPjOSpMPejeGRbzMgxvVCW8xiMtjHPvJUvqePQkCC7PTtbq+mgrVosBRR8iBuuYr7wGBDB5FdFob2H3d7o5c6NW19Qx//ri5GcBmAlwo9PTbNuAOJP70rs+xnyyWT5nh8cLR2YcMc2n5H+syyVX28f0qKYiXhlIAcdEYh21wdM0+u1sx3f4IbWn1Uskwf6gJcC5KZ6EAjWuNrv7NMJqzHVh7mzgrUqzvAkPfYmuZgM6GsHwMKkCdX8vd8ICQ+lgONizBvzThhrHlitFoVe/g== 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=JsMqRJ7b1swq7PgJZIFM+TvT0ckkLDGK5zgIUET/sWc=; b=LIVmunN25nqtQRHwdq72IjL5YfV8vDc1xtci73VggZtl/tyBbhp3xX5aIK635MHj519s6UrmfuQJ1wSVfBmfpI8BKL8PjYAt4OnAMwknCU1OeRIAyTZrKTnsHtZhbBjXhXQMcbRoKOZV94aNvkSKL339Q1EA10skV8maKT2Nt1Z1AAkW1XYWHoE4CWeUZEhsilsqqNFA8dF+fmU4GcLQ3BtmQZ4+X+ylKNXodq+XhqN8TrsVZeT+V3W8DX2kJHxMRgv8gOk1cTMsqzTmZqtF9FCIZRRYyE2dR13yYSeYqHQQRz0TyMQQS7HjJfjh3Kau3aLkJo0sMDR8eO8sTbppJw== 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=JsMqRJ7b1swq7PgJZIFM+TvT0ckkLDGK5zgIUET/sWc=; b=HqoG7Ws0FBgg9VD/O1VLu2+msTBIHPotFihHjGQne+KeNA50GE2C8pDWX9UtMI1UkAsQ27RMdPy02cl018QZEIX2Pbej5wPepyGiwY+xog2LRuDT1uSslJyUVXQy2JYKyomzR40GxJMIL4bclxdxddhjafBZ5y9595xSuUQiV6A= 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:34:02 +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:34:02 +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 18/18] i2c: imx-lpi2c: fix pio mode cannot send 256+ bytes in one frame Date: Tue, 6 Apr 2021 19:33:06 +0800 Message-Id: <20210406113306.2633595-19-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:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3bfca646-9492-46dd-4c84-08d8f8efe0a7 X-MS-TrafficTypeDiagnostic: AS8PR04MB8359: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sqHaODDYzH52VY4z0kM0UeHWi3st90xv5lgC7kk5jMEVJBe42a6RyQydc6lhQpjA3ZnACVMs6jB7QPMOvU+7qx4pXlTjA65TUfqQlo7avfQIRBXBSPIFUmVop3I33R/lMbMMSuOH/8t5nQpg66khYCs/fIOmKYX/OrLd+ivpVbj6OsTdRA8NMkFZHF5rE0a1BkLRwliQI10x8T/tvHPkaXFRhVR6/qpIpAnQ3hbWBGARI2aSjv5CGlmctMd9W+sRdCZzg11I22NvC/SYleEUCrersHxrlH79fnsQg3L6gAtbH/Zu/+wGa9XO8SyMo2W1Mm0SYKIhXpYakXwZ4C6nB+eVtJhLGC+830cB8v5wCItf8tutSh6kW5rqco8GOycrZbyV9rXAFtZKzx5nwOoGoG++wrTu6bkHV+0MFlNEch3nua9bbpVrrleOW6Bz2d8VGX/Ny6EGv2FqQ8GWfbJaTngyRFBBbTBEyzId76aNIpIuzzqBDit7J9d+8MSsO8N7KSVLfIJvy36rZ44d8Vvp/tnB5PIE7NhaQW4WROINR7MPmv5CXHZ+vo4TyrMI93RUTRh5cHdnr8MnBsN5zOLB+D+HziciyT6VhC1a8msNVHJ/6yDsHs8fV85UFyIBnq/LkGgp9UDMCUP7k/Bi0xjNCjlxBxb54AmUbVrwjbd1ghG++vxnjoAsDNT74Ala1hCeRVIt1idCUT4+feL/u9gGGw== 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)(83380400001)(2906002)(38100700001)(956004)(2616005)(36756003)(66476007)(6512007)(66946007)(66556008)(1076003)(498600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 1Vre4mo1yj7hEDJN6f4qPmTRYQUSngsYJpyTbC16Jq5G6rf56ED9onxzwIQ5p7Tqs5d9QdQayt1qSSJVUWwiISibDOGi8LxTSm1oeWeCJtjqxR7qIMCeDi3iR2M6lVw+j+NYT7P52KjBUu41irvTp6iQOEIXPCWXnpfwEdwY1V4LkqmE/1bhkUQgBTHlV0xQkYSZQXGF3ysdrj8SlctWFJFgkqx5sfZbea94nsWuQHF42CjQROlT6K+X6rLqJaBszxVcgI2mOJRfQ4fLp7Ggi/O9kX08/vIPcbidawXJECcaJhnXGQIb7bhGlOTBKQxXU4Lnqhnv7CbxzVM+MK89Dx8QrW6NMa4KdUZOsZtaoeH+ahd9A4VcHTZxnkZuddnq1CDdJ0cOz/1kd6PtWDYP7Trz+Lws/5KxX4Xweok9l+w5uGNZSgppnn0fykU3sWeKqKoSWyPNiE4zqVJC9SwVDvvt826l0mv3J12sQFnXS1ldVIiFnCohZFcG1hpt/aHlgrKiy+M9oN2OPmzYIeeMp4cPTeccR7ULR1/hydELJmEN4zRudYGkEvIpnvnmfQFztNmxjkWEyUnwEmqR+KpCIzaaIsK3mmuT8XU6ddoRgv41DW4E4qQZb8wv8kzBvPPuQPRzkQOt0sogdiWYChXMfM3iH8VvXkWGPYdAwagqY5HxwQG2+CuZNgAd3tpZgsejSRa3AiEqaWuX4wgbz2GOXTh59FnwrcWrRwU77qRgXYT32xcFsaF2aHN0e4MdpUNtnTh20oJph+KRB9bh1pRvshlRhj4AGF5hLdLnDQWi0FoEkht493vJKugcIvRLdhF1zeWdBx99uMnL6ad/AsllqssX2lZ29/Js4nB4KMskask4I2k4xA/+vn2y+mkGm3VdUVyDQNL02wMe9vIpDxf6nV0BzLOUb25zNpi947e3JO6JcKjJMMV+EJ8/PjJ4ywtaev3C3IRmnJ0ULmD0fD3Ly/GriYCXsNj9zAoxxDNeogyW4H6ECwceTTvDpaNXwpKLg1xn5IVAm00yOxXb4UC/2bqhM75+BA/D/aYDFJ/sQ1ITiJcvSohI5aaHkkUgT29BVGgxiOCSF3OxjY/PbDIOnPwfTG+CFI5aZFM3cvsM6ki9PFwcquzDMMIuhNHR+/omrvrd5vmlAiMEceNam3dB8cp8Fb7y2nfvdZGCUmgFjBjBeTVO9d/q4S82jIxuRVC0QZs6UVt6ntzMs63KOg6riNr5oCbPMgoGA9s7/v4oS4Y7FSystxwPL53EI5S8iKYsNYHDpdROnQ5bMuqB22lu+SpaBg81RFEKvVYN5d8TZ/c2xdk2xJ7ksO0Wm6Po+jK1 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3bfca646-9492-46dd-4c84-08d8f8efe0a7 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:34:02.4856 (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: N43EXGbYLaRMzDKhPwfIQ5ZHnou9jBGh6E99IeFW1hKuKsOdJCtxiiVKHQ7tlnjnn7/2HTnmxNXwV5trR7bZiQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8359 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The next MTDR command should be filled before the last receive command is fininshed. Otherwise, a NACK will be sent when the current MTDR command is finished. It causes lpi2c cannot send the next chunk data successfully. Signed-off-by: Clark Wang --- V2 changes: - New patch added in V2 --- drivers/i2c/busses/i2c-imx-lpi2c.c | 43 +++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 3c0f16a79185..8d908b9b5112 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -112,6 +112,7 @@ struct lpi2c_imx_struct { struct completion complete; unsigned int msglen; unsigned int delivered; + unsigned int remain_chunk_num; unsigned int block_data; unsigned int bitrate; unsigned int txfifosize; @@ -413,6 +414,28 @@ static void lpi2c_imx_write_txfifo(struct lpi2c_imx_struct *lpi2c_imx) complete(&lpi2c_imx->complete); } +static void lpi2c_imx_pio_push_rx_cmd(struct lpi2c_imx_struct *lpi2c_imx) +{ + unsigned int remaining, temp; + u8 last_chunk_num = lpi2c_imx->msglen % CHUNK_DATA; + + if (lpi2c_imx->remain_chunk_num > 0 && + (lpi2c_imx->delivered % CHUNK_DATA) > (CHUNK_DATA >> 1)) { + if ((readl(lpi2c_imx->base + LPI2C_MFSR) & 0xff) <= + (lpi2c_imx->rxfifosize >> 1)) { + if (last_chunk_num) + remaining = (lpi2c_imx->remain_chunk_num - 1) * + CHUNK_DATA + last_chunk_num; + else + remaining = lpi2c_imx->remain_chunk_num * CHUNK_DATA; + temp = (remaining > CHUNK_DATA ? CHUNK_DATA : remaining) - 1; + temp |= (RECV_DATA << 8); + writel(temp, lpi2c_imx->base + LPI2C_MTDR); + lpi2c_imx->remain_chunk_num--; + } + } +} + static void lpi2c_imx_read_rxfifo(struct lpi2c_imx_struct *lpi2c_imx) { unsigned int blocklen, remaining; @@ -420,10 +443,16 @@ static void lpi2c_imx_read_rxfifo(struct lpi2c_imx_struct *lpi2c_imx) do { data = readl(lpi2c_imx->base + LPI2C_MRDR); - if (data & MRDR_RXEMPTY) - break; + if (data & MRDR_RXEMPTY) { + if (lpi2c_imx->delivered == lpi2c_imx->msglen || + lpi2c_imx->block_data) + break; + else + continue; + } lpi2c_imx->rx_buf[lpi2c_imx->delivered++] = data & 0xff; + lpi2c_imx_pio_push_rx_cmd(lpi2c_imx); } while (1); /* @@ -451,13 +480,9 @@ static void lpi2c_imx_read_rxfifo(struct lpi2c_imx_struct *lpi2c_imx) temp = remaining; temp |= (RECV_DATA << 8); writel(temp, lpi2c_imx->base + LPI2C_MTDR); - } else if (!(lpi2c_imx->delivered & 0xff)) { - temp = (remaining > CHUNK_DATA ? CHUNK_DATA : remaining) - 1; - temp |= (RECV_DATA << 8); - writel(temp, lpi2c_imx->base + LPI2C_MTDR); } - lpi2c_imx_intctrl(lpi2c_imx, MIER_RDIE); + lpi2c_imx_intctrl(lpi2c_imx, MIER_RDIE | MIER_NDIE); } static void lpi2c_imx_write(struct lpi2c_imx_struct *lpi2c_imx, @@ -477,6 +502,10 @@ static void lpi2c_imx_read(struct lpi2c_imx_struct *lpi2c_imx, lpi2c_imx->block_data = msgs->flags & I2C_M_RECV_LEN; lpi2c_imx_set_rx_watermark(lpi2c_imx); + if (msgs->len > CHUNK_DATA) { + temp = CHUNK_DATA - 1; + lpi2c_imx->remain_chunk_num = DIV_ROUND_UP(msgs->len, CHUNK_DATA) - 1; + } temp = msgs->len > CHUNK_DATA ? CHUNK_DATA - 1 : msgs->len - 1; temp |= (RECV_DATA << 8); writel(temp, lpi2c_imx->base + LPI2C_MTDR);