From: Guodong Xu <guodong@riscstar.com>
To: jyc0019@gmail.com
Cc: alex@ghiti.fr, andi.shyti@kernel.org, aou@eecs.berkeley.edu,
conor+dt@kernel.org, devicetree@vger.kernel.org, dlan@gentoo.org,
krzk+dt@kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
p.zabel@pengutronix.de, palmer@dabbelt.com, pjw@kernel.org,
robh@kernel.org, spacemit@lists.linux.dev,
troy.mitchell@linux.spacemit.com, troymitchell988@gmail.com
Subject: Re: [PATCH 2/3] i2c: k1: add reset support
Date: Thu, 11 Dec 2025 15:35:26 +0800 [thread overview]
Message-ID: <20251211073526.3164875-1-guodong@riscstar.com> (raw)
In-Reply-To: <20251119-i2c-k1_reset-support-v1-2-0e9e82bf9b65@gmail.com>
On Wed, Nov 19, 2025 at 07:46:44PM +0800, Encrow Thorne wrote:
> Add reset control handling to the K1 I2C driver.
>
> Signed-off-by: Encrow Thorne <jyc0019@gmail.com>
> ---
> drivers/i2c/busses/i2c-k1.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-k1.c b/drivers/i2c/busses/i2c-k1.c
> index 6b918770e612..64d817d8315d 100644
> --- a/drivers/i2c/busses/i2c-k1.c
> +++ b/drivers/i2c/busses/i2c-k1.c
> @@ -10,6 +10,7 @@
> #include <linux/module.h>
> #include <linux/of_address.h>
> #include <linux/platform_device.h>
> + #include <linux/reset.h>
>
> /* spacemit i2c registers */
> #define SPACEMIT_ICR 0x0 /* Control register */
> @@ -113,6 +114,7 @@ struct spacemit_i2c_dev {
> void __iomem *base;
> int irq;
> u32 clock_freq;
> + struct reset_control *resets;
Thanks for the patch! A few suggestions to simplify this:
The reset_control structure doesn't need to be stored in the device
struct since the devm API automatically manages the resource lifecycle.
>
> struct i2c_msg *msgs;
> u32 msg_num;
> @@ -571,6 +573,15 @@ static int spacemit_i2c_probe(struct platform_device *pdev)
Please use a local variable in the probe function instead:
struct reset_control *rst;
> if (IS_ERR(clk))
> return dev_err_probe(dev, PTR_ERR(clk), "failed to enable bus clock");
>
> + i2c->resets = devm_reset_control_get_optional(dev, NULL);
There is a new API, I would suggest this:
rst = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
> + if (IS_ERR(i2c->resets))
> + return dev_err_probe(dev, PTR_ERR(i2c->resets),
> + "failed to get reset\n");
> +
> + reset_control_assert(i2c->resets);
> + udelay(2);
> + reset_control_deassert(i2c->resets);
> +
Why you need to call assert() then deassert()?
Wouldn't the single API fit?
Best regards,
Guodong
> spacemit_i2c_reset(i2c);
>
> i2c_set_adapdata(&i2c->adapt, i2c);
>
next prev parent reply other threads:[~2025-12-11 7:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 11:46 [PATCH 0/3] i2c: spacemit: add reset support Encrow Thorne
2025-11-19 11:46 ` [PATCH 1/3] dt-bindings: i2c: spacemit: add optional resets Encrow Thorne
2025-11-19 12:11 ` Troy Mitchell
2025-11-20 8:13 ` Krzysztof Kozlowski
2025-11-19 11:46 ` [PATCH 2/3] i2c: k1: add reset support Encrow Thorne
2025-11-19 12:08 ` Troy Mitchell
2025-12-11 7:35 ` Guodong Xu [this message]
2025-12-16 5:21 ` Encrow Thorne
2025-11-19 11:46 ` [PATCH 3/3] riscv: dts: spacemit: add reset property Encrow Thorne
2025-11-19 12:10 ` Troy Mitchell
-- strict thread matches above, loose matches on Subject: below --
2025-12-30 14:29 [PATCH v3 0/3] i2c: spacemit: add reset support Encrow Thorne
2025-12-30 15:06 ` [PATCH 1/3] dt-bindings: i2c: spacemit: add optional resets Encrow Thorne
2025-12-30 15:06 ` [PATCH 2/3] i2c: k1: add reset support Encrow Thorne
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=20251211073526.3164875-1-guodong@riscstar.com \
--to=guodong@riscstar.com \
--cc=alex@ghiti.fr \
--cc=andi.shyti@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlan@gentoo.org \
--cc=jyc0019@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=spacemit@lists.linux.dev \
--cc=troy.mitchell@linux.spacemit.com \
--cc=troymitchell988@gmail.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