From patchwork Wed May 31 16:11:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 101538 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3008418vqr; Wed, 31 May 2023 09:32:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6PSW32B7cHheXktL9hbI451b2YF8mtXwDPlgsCggX0OObcIPEF08iuyRotJr42+Gdm3ghK X-Received: by 2002:a05:6a00:b42:b0:63b:62d1:d868 with SMTP id p2-20020a056a000b4200b0063b62d1d868mr6391920pfo.8.1685550757749; Wed, 31 May 2023 09:32:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685550757; cv=none; d=google.com; s=arc-20160816; b=Wf4rVJm5JS7H3CD6+AcU4juOu2k+4To41dpXaqTSHkFV8XgbuPgYEReTMFzeDQt2xF wLogeCYSs7T94ATs/iZN5IjzxO8VWUX3BvHt1xXd019dddxFj8P97B7dKG4EUjJa+OOD k08AElWUD/NxznQOtGiJRWDNrgWu/i401PZa/ei3zmxcgyFa2YTiIUPJcEkEGVK9Pirk hYjWyje/er+g7kl8KLh3/Y8iifJktJh1aWq+L9YOFkcn4L7r64LwE+dTMS0DW+nhqkfH u6bEaNj5j8yLuL395P/L6ZaHMtEpIlkG2NOUeTrRSB+Mrhe9sHb1wTbRtbkxeFRzK8ji veQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=zBq3QXD/QVD7c5dWiiPwMUvtu1mioKJKBaDEMsW/U/I=; b=E++LuiYxUhGPDgYf5RQDrnn51Ic0hQC7MYlqMCiYxA0aBDtds6Zlw2Y67DKY4GPM0T renqUIh480y3o2ISU1uIQrbrMNc4N8KIJnVuHyVyYz1KXT3UXnDGKgkHoSsuQ+goa/yy Paigl0ufvEzqDM7h3Zg4BrwS6c8LCnjB9UfDMiP6wf5JLHPBjPt0o/z4ldge3usY443P wekqAp7g6ZisyKAVEGHOcY6kBMqa0FH2q7hE1cV8bivC3sLptWpW+qvOr39rc392XGpT t5rgfAxcQShhALE5Gw2AzGKmvDD0wEu1B2Gpl1QR83C3Bu0W3kLZcGjUCOPfNlfZ7Lfa cTgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a623805000000b0064d62222c46si3742910pfa.121.2023.05.31.09.32.24; Wed, 31 May 2023 09:32:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229520AbjEaQLh (ORCPT + 99 others); Wed, 31 May 2023 12:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjEaQLf (ORCPT ); Wed, 31 May 2023 12:11:35 -0400 X-Greylist: delayed 60 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 31 May 2023 09:11:33 PDT Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF41811F; Wed, 31 May 2023 09:11:33 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1q4OQ8-0001Nc-0H; Wed, 31 May 2023 16:11:32 +0000 Date: Wed, 31 May 2023 17:11:17 +0100 From: Daniel Golle To: linux-i2c@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, AngeloGioacchino Del Regno , Matthias Brugger , Qii Wang , Sam Shih Cc: =?utf-8?b?6YOt5bCP5qGl?= Subject: [PATCH 2/2] i2c: mt65xx: add additional clocks Message-ID: <6632ce37e260f5f5cbdd0c6a5da8fe9679352aee.1685549360.git.daniel@makrotopia.org> References: <5f15212060f82fb94239174c4e4b46c151645fe8.1685549360.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5f15212060f82fb94239174c4e4b46c151645fe8.1685549360.git.daniel@makrotopia.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767428070969310090?= X-GMAIL-MSGID: =?utf-8?q?1767428070969310090?= On MT7981 additional clocks are required when accessing I2C registers. Add MCK and PCK optional clocks to i2c-mt65xx driver so we don't have to always have them enabled, but really only if I2C is used. Fixes: f82fd1845d309 ("i2c: mediatek: add support for MT7981 SoC") Signed-off-by: Daniel Golle --- drivers/i2c/busses/i2c-mt65xx.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c index a43c4d77739ab..cd28cbec2b96d 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -93,6 +93,8 @@ * @I2C_MT65XX_CLK_DMA: DMA clock for i2c via DMA * @I2C_MT65XX_CLK_PMIC: PMIC clock for i2c from PMIC * @I2C_MT65XX_CLK_ARB: Arbitrator clock for i2c + * @I2C_MT65XX_CLK_MCK: MCK clock for i2c + * @I2C_MT65XX_CLK_PCK: PCK clock for i2c * @I2C_MT65XX_CLK_MAX: Number of supported clocks */ enum i2c_mt65xx_clks { @@ -100,11 +102,13 @@ enum i2c_mt65xx_clks { I2C_MT65XX_CLK_DMA, I2C_MT65XX_CLK_PMIC, I2C_MT65XX_CLK_ARB, + I2C_MT65XX_CLK_MCK, + I2C_MT65XX_CLK_PCK, I2C_MT65XX_CLK_MAX }; static const char * const i2c_mt65xx_clk_ids[I2C_MT65XX_CLK_MAX] = { - "main", "dma", "pmic", "arb" + "main", "dma", "pmic", "arb", "mck", "pck" }; enum DMA_REGS_OFFSET { @@ -1444,6 +1448,14 @@ static int mtk_i2c_probe(struct platform_device *pdev) if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk)) return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_ARB].clk); + i2c->clocks[I2C_MT65XX_CLK_MCK].clk = devm_clk_get_optional(&pdev->dev, "mck"); + if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_MCK].clk)) + return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_MCK].clk); + + i2c->clocks[I2C_MT65XX_CLK_PCK].clk = devm_clk_get_optional(&pdev->dev, "pck"); + if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PCK].clk)) + return PTR_ERR(i2c->clocks[I2C_MT65XX_CLK_PCK].clk); + if (i2c->have_pmic) { i2c->clocks[I2C_MT65XX_CLK_PMIC].clk = devm_clk_get(&pdev->dev, "pmic"); if (IS_ERR(i2c->clocks[I2C_MT65XX_CLK_PMIC].clk)) {