linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno  <angelogioacchino.delregno@collabora.com>
To: Daniel Golle <daniel@makrotopia.org>,
	linux-i2c@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Qii Wang <qii.wang@mediatek.com>,
	Sam Shih <sam.shih@mediatek.com>
Cc: 郭小桥 <joe@gainstrong.cn>
Subject: Re: [PATCH 2/2] i2c: mt65xx: add additional clocks
Date: Thu, 1 Jun 2023 11:18:25 +0200	[thread overview]
Message-ID: <053d4f6f-b43d-3a03-d193-437817321293@collabora.com> (raw)
In-Reply-To: <6632ce37e260f5f5cbdd0c6a5da8fe9679352aee.1685549360.git.daniel@makrotopia.org>

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@makrotopia.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)) {


  reply	other threads:[~2023-06-01  9:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31 16:10 [PATCH 1/2] dt-bindings: i2c: i2c-mt65xx: add additional clocks Daniel Golle
2023-05-31 16:11 ` [PATCH 2/2] i2c: mt65xx: " Daniel Golle
2023-06-01  9:18   ` AngeloGioacchino Del Regno [this message]
2023-06-01 16:54 ` [PATCH 1/2] dt-bindings: i2c: i2c-mt65xx: " Krzysztof Kozlowski
2023-06-01 19:10   ` Daniel Golle
2023-06-01 20:16     ` Conor Dooley
2023-06-02  7:12     ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=053d4f6f-b43d-3a03-d193-437817321293@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=daniel@makrotopia.org \
    --cc=joe@gainstrong.cn \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=qii.wang@mediatek.com \
    --cc=sam.shih@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).