Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aniket Limaye" <a-limaye@ti.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 3/3] i2c: designware: Add snps,dwc-i2c support and new compatible
Date: Sat, 19 Sep 2026 09:15:08 +0000	[thread overview]
Message-ID: <20260919091508.E52A91F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260919-tda54-upstream-i2c-v1-3-b0b9f77be18b@ti.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] i2c: designware: unintended register write to offset 0x00 for SMBus
--

commit 756dafe564a9964f945795b25e2b59168e6adcc6
Author: Aniket Limaye <a-limaye@ti.com>

i2c: designware: Add snps,dwc-i2c support and new compatible

This patch adds register offset tables and bit layouts for the DWC_i2c IP
and registers it with a new MODEL_DWC_I2C flag. It handles variations in
interrupt acknowledgments, timing parameters, and capabilities checking.

> diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
> index a21aeb7f415af..cc05c822aa56d 100644
> --- a/drivers/i2c/busses/i2c-designware-common.c
> +++ b/drivers/i2c/busses/i2c-designware-common.c
> @@ -113,6 +113,41 @@ static const u32 dw_i2c_reg_offsets[DW_REG_IDX_MAX] = {
[ ... ]
> +static const u32 dwc_i2c_reg_offsets[DW_REG_IDX_MAX] = {
> +	[DW_REG_IDX_ENABLE]			= DWC_OPERATION_BLK_OFFSET + 0x04,
> +	[DW_REG_IDX_CAPABILITIES]		= DWC_OPERATION_BLK_OFFSET + 0x0c,
> +	[DW_REG_IDX_CON]			= DWC_I2C_BLK_OFFSET + 0x04,
[ ... ]
> +	[DW_REG_IDX_COMP_VERSION]		= DWC_DEBUG_BLK_OFFSET + 0x08,
> +	[DW_REG_IDX_COMP_TYPE]		= DWC_DEBUG_BLK_OFFSET + 0x0c,
> +};

[Severity: High]
Does this array lack an initialization for DW_REG_IDX_SMBUS_INTR_MASK?

Since this is designated to have the size DW_REG_IDX_MAX, any omitted
indices will default to 0x00.

[ ... ]
> @@ -536,8 +636,10 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
>  	 * Mask SMBus interrupts to block storms from broken
>  	 * firmware that leaves IC_SMBUS=1; the handler never
>  	 * services them.
> +	 * For DWC-i2c, need to first check if SMBus is supported
>  	 */
> -	regmap_write(dev->map, dev->regs[DW_REG_IDX_SMBUS_INTR_MASK], 0);
> +	if (!(dev->flags & MODEL_DWC_I2C) || i2c_dwc_has_smbus(dev))
> +		regmap_write(dev->map, dev->regs[DW_REG_IDX_SMBUS_INTR_MASK], 0);

[Severity: High]
If a DWC_I2C hardware instance actually reports SMBus support via the
capabilities register, i2c_dwc_has_smbus() will return true and this will
attempt to mask the SMBus interrupts.

Because DW_REG_IDX_SMBUS_INTR_MASK is missing from dwc_i2c_reg_offsets,
could this unintendedly write the value 0 to the DWC_I2C block at register
offset 0x00?

Even if the TI TDA54 SoC doesn't support SMBus, this code is reachable for
other SoCs or configurations that might report the capability, which could
lead to unintended configuration changes or bus errors.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260919-tda54-upstream-i2c-v1-0-b0b9f77be18b@ti.com?part=3

      reply	other threads:[~2026-09-19  9:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19  9:06 [PATCH 0/3] i2c: designware: Add DWC_i2c support Aniket Limaye
2026-09-19  9:06 ` [PATCH 1/3] dt-bindings: i2c: dw: Add DWC_i2c compatible Aniket Limaye
2026-09-20 18:24   ` Krzysztof Kozlowski
2026-09-21  8:25     ` Aniket Limaye
2026-09-21 11:14       ` Mika Westerberg
2026-09-21 14:00         ` Krzysztof Kozlowski
2026-09-21 14:10           ` Mika Westerberg
2026-09-21 17:25             ` Aniket Limaye
2026-09-22  8:50               ` Krzysztof Kozlowski
2026-09-19  9:06 ` [PATCH 2/3] i2c: designware: Introduce per-variant register offset and bit-layout tables Aniket Limaye
2026-09-21 11:11   ` Mika Westerberg
2026-09-21 17:10     ` Aniket Limaye
2026-09-25  8:11     ` Andy Shevchenko
2026-09-25  9:26       ` Aniket Limaye
2026-09-19  9:06 ` [PATCH 3/3] i2c: designware: Add snps,dwc-i2c support and new compatible Aniket Limaye
2026-09-19  9:15   ` sashiko-bot [this message]

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=20260919091508.E52A91F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=a-limaye@ti.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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