From: Michal Simek <michal.simek@amd.com>
To: Swark Yang <syang@axiado.com>, Andi Shyti <andi.shyti@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
openbmc@lists.ozlabs.org
Subject: Re: [PATCH v3 2/2] i2c: cadence: Add support for Axiado AX3000
Date: Thu, 2 Jul 2026 08:35:16 +0200 [thread overview]
Message-ID: <5a1ef110-dbf9-4537-a542-9739a6ab0733@amd.com> (raw)
In-Reply-To: <20260630-axiado-ax3000-cadence-i2c-support-v3-2-4e217cfe5904@axiado.com>
On 7/1/26 06:48, Swark Yang wrote:
> The Axiado AX3000 SoC integrates a Cadence I2C controller
> that supports SMBus Quick commands.
>
> Introduce the "axiado,ax3000-i2c" compatible string and
> add a new quirk CDNS_I2C_ENABLE_SMBUS_QUICK to enable
> this functionality. This allows the controller to support
> I2C_FUNC_SMBUS_QUICK, enabling features such as bus scanning
> via quick write commands.
>
> Additionally, enabling SMBus Quick emulation in the I2C core exposes
> the controller to potential 0-length reads. Because the Cadence IP
> does not natively support 0-length reads (writing 0 to the transfer
> size register leaves the hardware in an unsupported state), this patch
> also populates the adapter quirks with I2C_AQ_NO_ZERO_LEN_READ.
nit: Avoid "this patch". Just use ", populate ..."
> This ensures 0-length reads are safely rejected by the core, preventing
> potential bus hangs.
>
> Signed-off-by: Swark Yang <syang@axiado.com>
> ---
> drivers/i2c/busses/i2c-cadence.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
> index 0fb728ade92e..1964ea1650c5 100644
> --- a/drivers/i2c/busses/i2c-cadence.c
> +++ b/drivers/i2c/busses/i2c-cadence.c
> @@ -128,6 +128,7 @@
> #define CDNS_I2C_TIMEOUT_MAX 0xFF
>
> #define CDNS_I2C_BROKEN_HOLD_BIT BIT(0)
> +#define CDNS_I2C_ENABLE_SMBUS_QUICK BIT(1)
> #define CDNS_I2C_POLL_US 100000
> #define CDNS_I2C_POLL_US_ATOMIC 10
> #define CDNS_I2C_TIMEOUT_US 500000
> @@ -1175,10 +1176,14 @@ static int cdns_i2c_master_xfer_atomic(struct i2c_adapter *adap, struct i2c_msg
> */
> static u32 cdns_i2c_func(struct i2c_adapter *adap)
> {
> + struct cdns_i2c *id = adap->algo_data;
> u32 func = I2C_FUNC_I2C | I2C_FUNC_10BIT_ADDR |
> (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK) |
> I2C_FUNC_SMBUS_BLOCK_DATA;
>
> + if (id->quirks & CDNS_I2C_ENABLE_SMBUS_QUICK)
> + func |= I2C_FUNC_SMBUS_QUICK;
> +
> #if IS_ENABLED(CONFIG_I2C_SLAVE)
> func |= I2C_FUNC_SLAVE;
> #endif
> @@ -1442,9 +1447,24 @@ static const struct cdns_platform_data r1p10_i2c_def = {
> .quirks = CDNS_I2C_BROKEN_HOLD_BIT,
> };
>
> +static const struct cdns_platform_data ax3000_i2c_def = {
> + .quirks = CDNS_I2C_ENABLE_SMBUS_QUICK,
> +};
> +
> +/*
> + * The controller does not support zero-length reads. Enabling SMBus Quick
> + * commands would otherwise let the core emulate a Quick read as a zero-length
> + * read message, which writes 0 to the transfer size register and leaves the
> + * hardware in an unsupported state. Reject such transfers in the core.
> + */
> +static const struct i2c_adapter_quirks cdns_i2c_quirks = {
> + .flags = I2C_AQ_NO_ZERO_LEN_READ,
> +};
> +
> static const struct of_device_id cdns_i2c_of_match[] = {
> { .compatible = "cdns,i2c-r1p10", .data = &r1p10_i2c_def },
> { .compatible = "cdns,i2c-r1p14",},
> + { .compatible = "axiado,ax3000-i2c", .data = &ax3000_i2c_def },
> { /* end of table */ }
> };
> MODULE_DEVICE_TABLE(of, cdns_i2c_of_match);
> @@ -1510,6 +1530,9 @@ static int cdns_i2c_probe(struct platform_device *pdev)
> id->quirks = data->quirks;
> }
>
> + if (id->quirks & CDNS_I2C_ENABLE_SMBUS_QUICK)
> + id->adap.quirks = &cdns_i2c_quirks;
> +
> id->rinfo.pinctrl = devm_pinctrl_get(&pdev->dev);
> if (IS_ERR(id->rinfo.pinctrl)) {
> int err = PTR_ERR(id->rinfo.pinctrl);
>
Wiring looks good to me.
Acked-by: Michal Simek <michal.simek@amd.com>
Thanks,
Michal
prev parent reply other threads:[~2026-07-02 6:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 4:48 [PATCH v3 0/2] i2c: cadence: Add support for Axiado AX3000 Swark Yang
2026-07-01 4:48 ` [PATCH v3 1/2] dt-bindings: i2c: cadence: Add " Swark Yang
2026-07-01 4:48 ` [PATCH v3 2/2] i2c: cadence: Add support for " Swark Yang
2026-07-01 4:58 ` sashiko-bot
2026-07-02 6:35 ` Michal Simek [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=5a1ef110-dbf9-4537-a542-9739a6ab0733@amd.com \
--to=michal.simek@amd.com \
--cc=andi.shyti@kernel.org \
--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=openbmc@lists.ozlabs.org \
--cc=robh@kernel.org \
--cc=syang@axiado.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