From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: "lianfeng.ouyang" <lianfeng.ouyang@starfivetech.com>
Cc: Andi Shyti <andi.shyti@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] i2c: designware: Export symbols and add __weak for Starfive I2C driver
Date: Wed, 3 Jun 2026 01:24:29 +0300 [thread overview]
Message-ID: <ah9YHcs8UyRhXZSx@ashevche-desk.local> (raw)
In-Reply-To: <20260527085039.44435-3-lianfeng.ouyang@starfivetech.com>
On Wed, May 27, 2026 at 04:50:38PM +0800, lianfeng.ouyang wrote:
> Export several key functions (i2c_dw_probe_master, i2c_dw_init,
> i2c_dw_xfer_init, i2c_dw_read_clear_intrbits, etc.) and mark them as
> __weak. This allows the i2c starfive driver to reuse the common
> infrastructure while overriding the implementations where needed.
>
> Additionally, extend the register map configuration and introduce the
> MODEL_STARFIVE flag to accommodate the starfive i2c IP's different
> register space.
...
> +#endif
My gosh, no.
> .val_bits = 32,
> .reg_stride = 4,
> .disable_locking = true,
> +#if IS_ENABLED(CONFIG_I2C_STARFIVE)
> + .reg_read = sf_reg_read,
> + .reg_write = sf_reg_write,
> + .max_register = SF_IC_SMBUS_INTR_CLR,
> +#else
No.
Just find a different way. See how Baikal T1 support was implemented
(in v6.18, for example).
> .reg_read = dw_reg_read,
> .reg_write = dw_reg_write,
> .max_register = DW_IC_COMP_TYPE,
> +#endif
...
> +#ifdef CONFIG_OF
Definitely no.
> + ret = of_property_read_u32(dev->dev->of_node, "starfive,i2c-tx-fifo-depth", &tx_fifo_cfg);
No. Why?!
Also do not use OF-centric APIs in the driver that uses fwnode.
> + if (!ret && (tx_fifo_cfg < 2 || tx_fifo_cfg > 256))
> + tx_fifo_cfg = 8;
> +
> + ret = of_property_read_u32(dev->dev->of_node, "starfive,i2c-rx-fifo-depth", &rx_fifo_cfg);
> + if (!ret && (rx_fifo_cfg < 2 || rx_fifo_cfg > 256))
> + rx_fifo_cfg = 8;
> +#endif
> + param = rx_fifo_cfg << 8 | tx_fifo_cfg << 16;
> +#else
> ret = regmap_read(dev->map, DW_IC_COMP_PARAM_1, ¶m);
> i2c_dw_release_lock(dev);
> if (ret)
> return ret;
> +#endif
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-06-02 22:24 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 8:50 [PATCH v2 0/3] i2c: Add Starfive JHB100 I2C master/slave support lianfeng.ouyang
2026-05-27 8:50 ` [PATCH v2 1/3] dt-bindings: i2c: Add StarFive JHB100 I2C lianfeng.ouyang
2026-05-27 13:04 ` Krzysztof Kozlowski
2026-05-28 6:57 ` 回复: " Lianfeng Ouyang
2026-05-28 7:47 ` Krzysztof Kozlowski
2026-05-28 8:30 ` 回复: " Lianfeng Ouyang
2026-05-27 8:50 ` [PATCH v2 2/3] i2c: designware: Export symbols and add __weak for Starfive I2C driver lianfeng.ouyang
2026-05-27 13:07 ` Krzysztof Kozlowski
2026-05-28 2:36 ` 回复: " Lianfeng Ouyang
2026-05-28 7:46 ` Krzysztof Kozlowski
2026-05-28 8:28 ` 回复: " Lianfeng Ouyang
2026-06-03 14:34 ` Krzysztof Kozlowski
2026-06-04 2:11 ` 回复: " Lianfeng Ouyang
2026-06-02 22:24 ` Andy Shevchenko [this message]
2026-05-27 8:50 ` [PATCH v2 3/3] i2c: starfive: Add StarFive JHB100 I2C master/slave support lianfeng.ouyang
2026-05-27 12:36 ` [PATCH v2 0/3] i2c: Add Starfive " Mika Westerberg
2026-05-28 2:41 ` 回复: " Lianfeng Ouyang
2026-06-02 22:26 ` Andy Shevchenko
2026-06-03 5:31 ` 回复: " Lianfeng Ouyang
2026-06-03 5:48 ` Andy Shevchenko
2026-06-03 6:09 ` 回复: " Lianfeng Ouyang
2026-06-03 6:39 ` Andy Shevchenko
2026-06-04 3:00 ` 回复: " Lianfeng Ouyang
2026-06-04 18:09 ` Andy Shevchenko
2026-06-08 9:48 ` 回复: " Lianfeng Ouyang
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=ah9YHcs8UyRhXZSx@ashevche-desk.local \
--to=andriy.shevchenko@linux.intel.com \
--cc=andi.shyti@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lianfeng.ouyang@starfivetech.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=robh@kernel.org \
/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