* [PATCH 0/3] i2c: spacemit: add reset support
@ 2025-11-19 11:46 Encrow Thorne
2025-11-19 11:46 ` [PATCH 1/3] dt-bindings: i2c: spacemit: add optional resets Encrow Thorne
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Encrow Thorne @ 2025-11-19 11:46 UTC (permalink / raw)
To: Troy Mitchell, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Philipp Zabel, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: Troy Mitchell, linux-i2c, devicetree, linux-riscv, spacemit,
linux-kernel, Encrow Thorne
Add reset control to SpacemiT K1 I2C.
Signed-off-by: Encrow Thorne <jyc0019@gmail.com>
---
Encrow Thorne (3):
dt-bindings: i2c: spacemit: add optional resets
i2c: k1: add reset support
riscv: dts: spacemit: add reset property
Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml | 3 +++
arch/riscv/boot/dts/spacemit/k1.dtsi | 2 ++
drivers/i2c/busses/i2c-k1.c | 11 +++++++++++
3 files changed, 16 insertions(+)
---
base-commit: 8fec172c82c2b5f6f8e47ab837c1dc91ee3d1b87
change-id: 20251104-i2c-k1_reset-support-12784e17bf83
Best regards,
--
Encrow Thorne <jyc0019@gmail.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] dt-bindings: i2c: spacemit: add optional resets
2025-11-19 11:46 [PATCH 0/3] i2c: spacemit: add reset support Encrow Thorne
@ 2025-11-19 11:46 ` 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 11:46 ` [PATCH 3/3] riscv: dts: spacemit: add reset property Encrow Thorne
2 siblings, 2 replies; 8+ messages in thread
From: Encrow Thorne @ 2025-11-19 11:46 UTC (permalink / raw)
To: Troy Mitchell, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Philipp Zabel, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: Troy Mitchell, linux-i2c, devicetree, linux-riscv, spacemit,
linux-kernel, Encrow Thorne
Add optional reset property for the SpacemiT K1 I2C.
Signed-off-by: Encrow Thorne <jyc0019@gmail.com>
---
Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml b/Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml
index b7220fff2235..3d4faec41abe 100644
--- a/Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml
@@ -27,6 +27,9 @@ properties:
- description: I2C Functional Clock
- description: APB Bus Clock
+ resets:
+ maxItems: 1
+
clock-names:
items:
- const: func
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] i2c: k1: add reset support
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 11:46 ` Encrow Thorne
2025-11-19 12:08 ` Troy Mitchell
2025-11-19 11:46 ` [PATCH 3/3] riscv: dts: spacemit: add reset property Encrow Thorne
2 siblings, 1 reply; 8+ messages in thread
From: Encrow Thorne @ 2025-11-19 11:46 UTC (permalink / raw)
To: Troy Mitchell, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Philipp Zabel, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: Troy Mitchell, linux-i2c, devicetree, linux-riscv, spacemit,
linux-kernel, Encrow Thorne
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;
struct i2c_msg *msgs;
u32 msg_num;
@@ -571,6 +573,15 @@ static int spacemit_i2c_probe(struct platform_device *pdev)
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);
+ 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);
+
spacemit_i2c_reset(i2c);
i2c_set_adapdata(&i2c->adapt, i2c);
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] riscv: dts: spacemit: add reset property
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 11:46 ` [PATCH 2/3] i2c: k1: add reset support Encrow Thorne
@ 2025-11-19 11:46 ` Encrow Thorne
2025-11-19 12:10 ` Troy Mitchell
2 siblings, 1 reply; 8+ messages in thread
From: Encrow Thorne @ 2025-11-19 11:46 UTC (permalink / raw)
To: Troy Mitchell, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Philipp Zabel, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: Troy Mitchell, linux-i2c, devicetree, linux-riscv, spacemit,
linux-kernel, Encrow Thorne
Add resets property to K1 I2C node.
Signed-off-by: Encrow Thorne <jyc0019@gmail.com>
---
arch/riscv/boot/dts/spacemit/k1.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index af35f9cd6435..2b84dc276ace 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -468,6 +468,7 @@ i2c2: i2c@d4012000 {
<&syscon_apbc CLK_TWSI2_BUS>;
clock-names = "func", "bus";
clock-frequency = <400000>;
+ resets = <&syscon_apbc RESET_TWSI2>;
interrupts = <38>;
status = "disabled";
};
@@ -481,6 +482,7 @@ i2c8: i2c@d401d800 {
<&syscon_apbc CLK_TWSI8_BUS>;
clock-names = "func", "bus";
clock-frequency = <400000>;
+ resets = <&syscon_apbc RESET_TWSI8>;
interrupts = <19>;
status = "disabled";
};
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] i2c: k1: add reset support
2025-11-19 11:46 ` [PATCH 2/3] i2c: k1: add reset support Encrow Thorne
@ 2025-11-19 12:08 ` Troy Mitchell
0 siblings, 0 replies; 8+ messages in thread
From: Troy Mitchell @ 2025-11-19 12:08 UTC (permalink / raw)
To: Encrow Thorne, Troy Mitchell, Andi Shyti, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Yixun Lan, Philipp Zabel,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: Troy Mitchell, linux-i2c, devicetree, linux-riscv, spacemit,
linux-kernel
Hi Encrow,
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;
>
> struct i2c_msg *msgs;
> u32 msg_num;
> @@ -571,6 +573,15 @@ static int spacemit_i2c_probe(struct platform_device *pdev)
> 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);
> + if (IS_ERR(i2c->resets))
> + return dev_err_probe(dev, PTR_ERR(i2c->resets),
> + "failed to get reset\n");
Please align.
> +
> + reset_control_assert(i2c->resets);
> + udelay(2);
This seems to be a very small value. If this
has been verified multiple times?
- Troy
> + reset_control_deassert(i2c->resets);
> +
> spacemit_i2c_reset(i2c);
>
> i2c_set_adapdata(&i2c->adapt, i2c);
>
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] riscv: dts: spacemit: add reset property
2025-11-19 11:46 ` [PATCH 3/3] riscv: dts: spacemit: add reset property Encrow Thorne
@ 2025-11-19 12:10 ` Troy Mitchell
0 siblings, 0 replies; 8+ messages in thread
From: Troy Mitchell @ 2025-11-19 12:10 UTC (permalink / raw)
To: Encrow Thorne, Troy Mitchell, Andi Shyti, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Yixun Lan, Philipp Zabel,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: Troy Mitchell, linux-i2c, devicetree, linux-riscv, spacemit,
linux-kernel
On Wed, Nov 19, 2025 at 07:46:45PM +0800, Encrow Thorne wrote:
> Add resets property to K1 I2C node.
>
> Signed-off-by: Encrow Thorne <jyc0019@gmail.com>
> ---
> arch/riscv/boot/dts/spacemit/k1.dtsi | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
> index af35f9cd6435..2b84dc276ace 100644
> --- a/arch/riscv/boot/dts/spacemit/k1.dtsi
> +++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
> @@ -468,6 +468,7 @@ i2c2: i2c@d4012000 {
> <&syscon_apbc CLK_TWSI2_BUS>;
> clock-names = "func", "bus";
> clock-frequency = <400000>;
> + resets = <&syscon_apbc RESET_TWSI2>;
> interrupts = <38>;
> status = "disabled";
> };
> @@ -481,6 +482,7 @@ i2c8: i2c@d401d800 {
> <&syscon_apbc CLK_TWSI8_BUS>;
> clock-names = "func", "bus";
> clock-frequency = <400000>;
> + resets = <&syscon_apbc RESET_TWSI8>;
> interrupts = <19>;
> status = "disabled";
> };
Since this patch has been merged [1], you can add resets property in all
i2c node.
- Troy
Link: https://lore.kernel.org/all/176294559674.467363.5417599191009488468.b4-ty@gentoo.org/ [1]
>
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] dt-bindings: i2c: spacemit: add optional resets
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
1 sibling, 0 replies; 8+ messages in thread
From: Troy Mitchell @ 2025-11-19 12:11 UTC (permalink / raw)
To: Encrow Thorne, Troy Mitchell, Andi Shyti, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Yixun Lan, Philipp Zabel,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Alexandre Ghiti
Cc: Troy Mitchell, linux-i2c, devicetree, linux-riscv, spacemit,
linux-kernel
On Wed, Nov 19, 2025 at 07:46:43PM +0800, Encrow Thorne wrote:
> Add optional reset property for the SpacemiT K1 I2C.
>
> Signed-off-by: Encrow Thorne <jyc0019@gmail.com>
>
Thanks.
Acked-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] dt-bindings: i2c: spacemit: add optional resets
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
1 sibling, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-11-20 8:13 UTC (permalink / raw)
To: Encrow Thorne
Cc: Troy Mitchell, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Yixun Lan, Philipp Zabel, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Troy Mitchell,
linux-i2c, devicetree, linux-riscv, spacemit, linux-kernel
On Wed, Nov 19, 2025 at 07:46:43PM +0800, Encrow Thorne wrote:
> Add optional reset property for the SpacemiT K1 I2C.
Why? You just repeated diff and we can read the diff. Please explain WHY
you are doing things in terms of hardware.
>
> Signed-off-by: Encrow Thorne <jyc0019@gmail.com>
> ---
> Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml b/Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml
> index b7220fff2235..3d4faec41abe 100644
> --- a/Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml
> +++ b/Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml
> @@ -27,6 +27,9 @@ properties:
> - description: I2C Functional Clock
> - description: APB Bus Clock
>
> + resets:
> + maxItems: 1
> +
Completely misplaced. There are never random properties between xxx and
xxx-names.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-11-20 8:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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-11-19 11:46 ` [PATCH 3/3] riscv: dts: spacemit: add reset property Encrow Thorne
2025-11-19 12:10 ` Troy Mitchell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).