[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <053d4f6f-b43d-3a03-d193-437817321293@collabora.com>
Date: Thu, 1 Jun 2023 11:18:25 +0200
From: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
To: Daniel Golle <daniel@...rotopia.org>, linux-i2c@...r.kernel.org,
linux-mediatek@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Matthias Brugger <matthias.bgg@...il.com>,
Qii Wang <qii.wang@...iatek.com>,
Sam Shih <sam.shih@...iatek.com>
Cc: 郭小桥 <joe@...nstrong.cn>
Subject: Re: [PATCH 2/2] i2c: mt65xx: add additional clocks
Il 31/05/23 18:11, Daniel Golle ha scritto:
> 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 <daniel@...rotopia.org>
PCK and MCK should really be P=PMIC and M=MEM as far as I understand, which
means that they should effectively be CLK_PMIC and CLK_ARB.
In that case, you don't need to add new clocks to the driver, as you're using
the very same ones that the driver supports.
Cheers,
Angelo
> ---
> 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)) {
Powered by blists - more mailing lists