From patchwork Wed Mar 17 06:53: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: 12144961 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=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 C8877C433DB for ; Wed, 17 Mar 2021 06:56:24 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 463D564F80 for ; Wed, 17 Mar 2021 06:56:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 463D564F80 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IYBBusJreyq9vdn7LppbQWOI4+o79+xir45+sSsY1Qg=; b=cgP3pQh8T7P22qXJTs9+AVe3X HFmSE/w7CgDBnkPpF0THjqWMyyuI2vh65wbeGTPtQUbmgKqrDjB0G8KQwRHyqLT3T78q/A4zBxq2G zTC0VDJwdRqlDqE6K3Jb4YBsh9DXdAno5slDnUYkAhDa76Y5RF5ln8TluQgU/8HSTsgoXG9YPDMaz 0AxsyqsqcECWNjn21Mwy/DGnvEsYI4uTIWi8RaxhHTQ2XXoEK2cJ05fZ8I5XwR9Dc5Py4vpcZOQTS Ual3JYbvCMrd4WmTGcmH1UIdJTkDOMhh4m/gxnKTYcdhnjrV/qx7E8aolS2QU1Vlv57kejEV8+eyr 7My4/S/pA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lMQ4l-002bLd-Rx; Wed, 17 Mar 2021 06:54:40 +0000 Received: from mail-eopbgr80048.outbound.protection.outlook.com ([40.107.8.48] helo=EUR04-VI1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lMQ4A-002b6E-Hj for linux-arm-kernel@lists.infradead.org; Wed, 17 Mar 2021 06:54:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gISrt13dCZUFZO4eVbO9ctQn22ruluP0hWiuAaLNRU1943kvzTWYIKlqzGg07jtPFkEz2dCTShqD4g8wgbdAWV7i44nWEDTHGoRTOooV2GOOwIViayaD2JLnT1uHyFRavAyhOJZzmAQO/zGPdOWbtpL2gmY+7RYu+PlvOykjj8gR6ufCYTOKOfCVlRjc8lbzeAyPfksi94g+rDnJYTZnsEhLVBnpAE8MfQj4u1hTHDs7Y0M1IjBM8ZKUxdnGdS3YXkFUnAb/zSyZt6Yr5J32QsGToUpOM57NrpVdJjklSVqLlYG49MAv3iW3lgzHdfX9TyUG7NMyWRPVMaCirZyBVw== 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=hJZXvAPB4JFtFYVB8ctM2LZCEtm9/HphDpEZmAwLhbg=; b=ndG+HLvcaDFkv+HJ+2dCJjz0y7Fy63No3zhaO2W0NQ4lIgAW/Phw1AtV6oKdxLB/7aOcF2nRtSFfPY0FYoJK6yhzIVjWDGbH3HMfXxYYnG34U4+hjEwHRgpzcORGBati/gyVCKo58DtcSVi66ApMe7vfnwFhuCedYiOsJSKRT4OthRmuJzHiG0ublAqyEg54xVgM0+o9s+91/BqrthdNd1A0bEr3Z8oK4ak2Grf3x/Riv5WPpFY6YdIG1HTORIadYHWuwM13DHnpLt9wLOARBwXPhGQ7ML9IHbbDKlEpp075VedL7CcdqtbAwhNbu4FLu0DRq+N7k1JKzv9AvZmIQg== 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=hJZXvAPB4JFtFYVB8ctM2LZCEtm9/HphDpEZmAwLhbg=; b=sJJuwST/cIPFabTT8V3aQzMTP5+zSwxS67X1sP1SAVgtLroRPBVIG6gt+f3kJVf0JCc2gmmxN5cUe72UZ7igqJQ79LKNVrrxvab+2ybDijvEDlBa1lXCSCdvhrVqxSUirYJrhOPK5QK8u8wRQz9hmjwCgPKlDHNdV4E7uiKtq5s= Authentication-Results: nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB5618.eurprd04.prod.outlook.com (2603:10a6:208:123::11) by AM0PR04MB7091.eurprd04.prod.outlook.com (2603:10a6:208:197::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31; Wed, 17 Mar 2021 06:53:59 +0000 Received: from AM0PR04MB5618.eurprd04.prod.outlook.com ([fe80::69a8:a768:8fa1:7236]) by AM0PR04MB5618.eurprd04.prod.outlook.com ([fe80::69a8:a768:8fa1:7236%7]) with mapi id 15.20.3933.032; Wed, 17 Mar 2021 06:53:59 +0000 From: Clark Wang To: aisheng.dong@nxp.com, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, sumit.semwal@linaro.org, christian.koenig@amd.com, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/11] i2c: imx-lpi2c: add ipg clk for lpi2c driver Date: Wed, 17 Mar 2021 14:53:51 +0800 Message-Id: <20210317065359.3109394-4-xiaoning.wang@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317065359.3109394-1-xiaoning.wang@nxp.com> References: <20210317065359.3109394-1-xiaoning.wang@nxp.com> X-Originating-IP: [119.31.174.71] X-ClientProxiedBy: HK2PR02CA0215.apcprd02.prod.outlook.com (2603:1096:201:20::27) To AM0PR04MB5618.eurprd04.prod.outlook.com (2603:10a6:208:123::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (119.31.174.71) by HK2PR02CA0215.apcprd02.prod.outlook.com (2603:1096:201:20::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.18 via Frontend Transport; Wed, 17 Mar 2021 06:53:56 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c28b101a-82bf-42e2-315e-08d8e91170fa X-MS-TrafficTypeDiagnostic: AM0PR04MB7091: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:454; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 50+K/JUGsVvZjg7Zw4nTBTiDxkhjOV1Rba0NcB6uXAAeFw0T0VH4ySOKEyNfo1MT3wQZgX5Yz6EYpJZKUkteVnNZi0OgvroHU7Dg0T59uwuHkFs6ooQqrYbFqsk9Bonrukb2ILCQLOvwZLgxpK8ALr3n8sDJt9TDpRyTud4DugpDrPdAVwXCM9hnDwdWouz/ThhovZvZBTF444D3EDPvdmdUj9L9ENkSaLUkKsD2G7TE1OEourYWXoZ39JTrq2C5Tc5I+YkQqrXPWVV68YatiLU8afpGgptgWbBVIq5gTYmMbiZ7lEQw8FbN0uj3pexdLRZ7ax1dK+usj2etc3WzqnbttDauSw4MfuKvvVRrr3b0KThrkwW3nsYczHBfBPiYEp36x4vCjKPU3pwpxVkynfN/qiqZ3zp7ujgTOMyMbqYImRZ+bur5RddkRTRuWskk42xJUyVXdc7RQGh7Il0BC2skhgZp4/a5Q+f10CwuxhKz2rd1XnCAemlv8tzUhpOzfHgBPGkpqGtfwzMUB28V7AzHRBLujSBn0Q5o5ofKv5oCyN8iCG8ZP2RBULWn5DYC/H/l04u2nHrqXbLH2C/J9hU/P+yQB0nzwvpLOTi+UDlu+Kq45AS0ZMkXHp0DhkdR X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5618.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(376002)(396003)(346002)(39860400002)(136003)(478600001)(66556008)(66476007)(69590400012)(6506007)(66946007)(83380400001)(36756003)(16526019)(5660300002)(2616005)(316002)(2906002)(1076003)(8936002)(26005)(52116002)(186003)(956004)(4326008)(6512007)(6486002)(8676002)(6666004)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: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AEpwrISpwiR2TryeS053vtYczuJytsnDixM9HYjSJeKFS7piy0EJAFU+CpCdslkpRz3/+q/wjiV/LQ+F6L0tPEXcIVTtDFFwnRve7A3VIMZ7BfDpTEg1XOYICqaUFi/KLR1Jb7MuExJAJqfFReQSaS6mLuPVyeLw1XY0AHqZKjew8MhFOPjnzdj7zMXC6BMDppszDrW0xVMRd4l0Rqfyfqtv69hO7d+GHeZnqE1Z8mr68CSH5rFU5RTWCyv+66CwxgEWSxswgCttfp+QvnJakEpW+/emXH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c28b101a-82bf-42e2-315e-08d8e91170fa X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5618.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Mar 2021 06:53:59.3425 (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: Hrn4Un24S9o/5ZdNMuzBryaRoiZbQQ8Yi7Qpq1wWinJPNJ768q8r9oPTsSNYJ3io1z7nZ5ozYpCGH9m4cDRAKg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB7091 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210317_065402_882983_984B7394 X-CRM114-Status: GOOD ( 15.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 --- drivers/i2c/busses/i2c-imx-lpi2c.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 1e920e7ac7c1..664fcc0dba51 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; @@ -563,10 +564,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, @@ -633,7 +640,8 @@ 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); + clk_disable_unprepare(lpi2c_imx->clk_ipg); + clk_disable_unprepare(lpi2c_imx->clk_per); pinctrl_pm_select_idle_state(dev); return 0; @@ -645,12 +653,18 @@ static int __maybe_unused lpi2c_runtime_resume(struct device *dev) int ret; pinctrl_pm_select_default_state(dev); - ret = clk_prepare_enable(lpi2c_imx->clk); + ret = clk_prepare_enable(lpi2c_imx->clk_per); if (ret) { - dev_err(dev, "can't enable I2C clock, ret=%d\n", ret); + dev_err(dev, "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(dev, "can't enable I2C ipg clock, ret=%d\n", ret); + } + return ret; }