From patchwork Wed May 31 16:10:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 13262519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BA1BC77B7A for ; Wed, 31 May 2023 16:11:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=p53zdOYNuZaSGngimpTnuG8ImkhFTSfIkC/eli1SYuo=; b=WXYwZWLOxZjoOB RgX0pnxUFuCEbYtWsJd8s8wyiIC0hyOqFD7gfkV4UzCekyX2HhXckLBm514kbqxI6t0k0OQbyZk3f wfOIouZVY+DSDQ7yc/f/JVAqZ2SgkgAGMP5mzONOzgLpj54dMas54CWYpjr1+l1SQef87P9N7O4hf TWI1pOVgo3J4Yuu07aUCcdhnJdmknQKKjYUrvOTdjv9sGPu44njsXvLqvKPyTZN4/VYUtDz9/dBvS yEBXx13XVcdHiHzxzgKVUfmQHUaEcB3qyVgJ41donDZ923jTkDftIIZ+7HfRNiHgiKp0cwweyX28z VpRlQTleacrvtf1Vn7FA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q4OPJ-000Q6X-16; Wed, 31 May 2023 16:10:41 +0000 Received: from pidgin.makrotopia.org ([185.142.180.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q4OPG-000Q4H-1a; Wed, 31 May 2023 16:10:39 +0000 Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1q4OP4-0001N8-0V; Wed, 31 May 2023 16:10:26 +0000 Date: Wed, 31 May 2023 17:10:14 +0100 From: Daniel Golle To: devicetree@vger.kernel.org, linux-i2c@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Conor Dooley , Krzysztof Kozlowski , Rob Herring , AngeloGioacchino Del Regno , Matthias Brugger , Qii Wang , Sam Shih Cc: =?utf-8?b?6YOt5bCP5qGl?= Subject: [PATCH 1/2] dt-bindings: i2c: i2c-mt65xx: add additional clocks Message-ID: <5f15212060f82fb94239174c4e4b46c151645fe8.1685549360.git.daniel@makrotopia.org> MIME-Version: 1.0 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230531_091038_528891_76914439 X-CRM114-Status: UNSURE ( 8.87 ) X-CRM114-Notice: Please train this message. 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 Add pck and mck clocks which are needed to access I2C registers on MT7981. Signed-off-by: Daniel Golle --- Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml index fda0467cdd954..550795f6573c5 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml @@ -78,6 +78,8 @@ properties: - const: dma - const: arb - const: pmic + - const: mck + - const: pck clock-div: $ref: /schemas/types.yaml#/definitions/uint32 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: 13262520 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A1BAC77B7A for ; Wed, 31 May 2023 16:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Y7xKgzheXWdryayhF/FoF7iezHEBmbBxwtpHWqmFKIo=; b=T0pIBQe10Y58Gw gh9JdX5PiwE/WXfNp7be+xQ5DuKfmUtvLYYd2b7DnAPEb5l/spPNhb11KuHRGI+fuzbsfLM/Ig1zI 7AWlPJHEUZ81rGIZ2R+U75sFj07MDqDjnZ8VuU/ZQy3Y1uaGq1BDM5LJEYOdu5BByt4L4mD32xue/ BPMLXLXWG6y90AwsJXORtvc6JL89i0eiuTqo85KKtXSp/YPTqLRuOJRwQkqHzlDQ5z4x+qNBCV/9E YiFfuYDrvVHxQHWTMiMiTcqOH2D1HpDmKvo4KxO/oZ+c4jwDEon+ZRL6E4gbWIozZk8E2FX6LRlIT Rjro+7YDKqDO68pmsSJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q4OQB-000QHo-2o; Wed, 31 May 2023 16:11:35 +0000 Received: from pidgin.makrotopia.org ([185.142.180.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q4OQ9-000QGt-0k; Wed, 31 May 2023 16:11:34 +0000 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230531_091133_270103_367BF2F3 X-CRM114-Status: GOOD ( 14.28 ) 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 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)) {