From: Rob Herring <robh@kernel.org>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Stefan Roese <sr@denx.de>, Andi Shyti <andi.shyti@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 2/2] i2c: mt7621: limit SCL_STRETCH only to Mediatek SoC
Date: Fri, 30 Oct 2026 12:48:12 -0500 [thread overview]
Message-ID: <20261030174812.GA985982-robh@kernel.org> (raw)
In-Reply-To: <20261021153953.285222-2-ansuelsmth@gmail.com>
On Wed, Oct 21, 2026 at 05:39:52PM +0200, Christian Marangi wrote:
> The same I2C driver is also used for Airoha SoC with the only difference
> that the i2c_reset should not enable SCL_STRETCH for Airoha SoC.
>
> Introduce a new compatible for Airoha and limit the SCL_STRETCH only to
> Mediatek SoC.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> drivers/i2c/busses/i2c-mt7621.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-mt7621.c b/drivers/i2c/busses/i2c-mt7621.c
> index 0a288c998419..19dde7c4069e 100644
> --- a/drivers/i2c/busses/i2c-mt7621.c
> +++ b/drivers/i2c/busses/i2c-mt7621.c
> @@ -65,6 +65,7 @@ struct mtk_i2c {
> u32 clk_div;
> u32 flags;
> struct clk *clk;
> + bool have_scl_stretch;
> };
>
> static int mtk_i2c_wait_idle(struct mtk_i2c *i2c)
> @@ -83,6 +84,7 @@ static int mtk_i2c_wait_idle(struct mtk_i2c *i2c)
>
> static void mtk_i2c_reset(struct mtk_i2c *i2c)
> {
> + u32 reg;
> int ret;
>
> ret = device_reset(i2c->adap.dev.parent);
> @@ -93,8 +95,11 @@ static void mtk_i2c_reset(struct mtk_i2c *i2c)
> * Don't set SM0CTL0_ODRAIN as its bit meaning is inverted. To
> * configure open-drain mode, this bit needs to be cleared.
> */
> - iowrite32(((i2c->clk_div << 16) & SM0CTL0_CLK_DIV_MASK) | SM0CTL0_EN |
> - SM0CTL0_SCL_STRETCH, i2c->base + REG_SM0CTL0_REG);
> + reg = ((i2c->clk_div << 16) & SM0CTL0_CLK_DIV_MASK) | SM0CTL0_EN;
> + if (i2c->have_scl_stretch)
> + reg |= SM0CTL0_SCL_STRETCH;
> +
> + iowrite32(reg, i2c->base + REG_SM0CTL0_REG);
> iowrite32(0, i2c->base + REG_SM0CFG2_REG);
> }
>
> @@ -249,6 +254,7 @@ static const struct i2c_algorithm mtk_i2c_algo = {
>
> static const struct of_device_id i2c_mtk_dt_ids[] = {
> { .compatible = "mediatek,mt7621-i2c" },
> + { .compatible = "airoha,an7581-i2c" },
> { /* sentinel */ }
> };
>
> @@ -296,6 +302,10 @@ static int mtk_i2c_probe(struct platform_device *pdev)
> return -EINVAL;
> }
>
> + /* Set SCL_STRETCH only for Mediatek SoC */
> + if (device_is_compatible(i2c->dev, "mediatek,mt7621-i2c"))
> + i2c->have_scl_stretch = true;
Add match data for this. Calling device_is_compatible() doesn't scale.
Rob
next prev parent reply other threads:[~2026-10-30 17:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 15:39 [PATCH 1/2] dt-bindings: i2c: mt7621: Document an7581 compatible Christian Marangi
2026-10-21 15:39 ` [PATCH 2/2] i2c: mt7621: limit SCL_STRETCH only to Mediatek SoC Christian Marangi
2026-10-30 17:48 ` Rob Herring [this message]
2026-10-30 17:48 ` [PATCH 1/2] dt-bindings: i2c: mt7621: Document an7581 compatible Rob Herring (Arm)
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=20261030174812.GA985982-robh@kernel.org \
--to=robh@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=ansuelsmth@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--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=sr@denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.