[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251230150653.42097-2-jyc0019@gmail.com>
Date: Tue, 30 Dec 2025 23:06:52 +0800
From: Encrow Thorne <jyc0019@...il.com>
To: jyc0019@...il.com
Cc: alex@...ti.fr,
andi.shyti@...nel.org,
aou@...s.berkeley.edu,
conor+dt@...nel.org,
devicetree@...r.kernel.org,
dlan@...too.org,
guodong@...cstar.com,
krzk+dt@...nel.org,
linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org,
p.zabel@...gutronix.de,
palmer@...belt.com,
pjw@...nel.org,
robh@...nel.org,
spacemit@...ts.linux.dev,
troy.mitchell@...ux.spacemit.com,
troymitchell988@...il.com
Subject: [PATCH 2/3] i2c: k1: add reset support
The K1 I2C controller provides a reset line that needs to be deasserted
before the controller can be accessed.
Add reset support to the driver to ensure the controller starts in the
required state.
Reviewed-by: Troy Mitchell <troy.mitchell@...ux.spacemit.com>
Signed-off-by: Encrow Thorne <jyc0019@...il.com>
---
drivers/i2c/busses/i2c-k1.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/i2c/busses/i2c-k1.c b/drivers/i2c/busses/i2c-k1.c
index d42c03ef5db5..23661c7ddb67 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 */
@@ -534,6 +535,7 @@ static int spacemit_i2c_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct device_node *of_node = pdev->dev.of_node;
struct spacemit_i2c_dev *i2c;
+ struct reset_control *rst;
int ret;
i2c = devm_kzalloc(dev, sizeof(*i2c), GFP_KERNEL);
@@ -578,6 +580,11 @@ 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");
+ rst = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
+ if (IS_ERR(rst))
+ return dev_err_probe(dev, PTR_ERR(rst),
+ "failed to acquire deasserted reset\n");
+
spacemit_i2c_reset(i2c);
i2c_set_adapdata(&i2c->adapt, i2c);
--
2.25.1
Powered by blists - more mailing lists