[PATCH 2/3] i3c: renesas: Add support for the analog noise filter

Diogo Ivo diogo.ivo.sx at renesas.com
Tue Oct 20 02:36:27 PDT 2026


The input terminals (I3C_SDA, I3C_SCL) of the Renesas I3C controller
have an analog filter for noise removal, controlled through a bypass
bit on the SYS_I3C_CFG register of the system controller (SYSC).

Add support for configuring the filter through the
renesas,analog-noise-filter Device Tree property, which references
the system controller together with the offset of the SYS_I3C_CFG
register and the state of the filter. Boards not providing the
property keep the reset value of the filter.

Signed-off-by: Diogo Ivo <diogo.ivo.sx at renesas.com>
---
 drivers/i3c/master/renesas-i3c.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/i3c/master/renesas-i3c.c b/drivers/i3c/master/renesas-i3c.c
index 80a6df1151bf..80d360aa87ba 100644
--- a/drivers/i3c/master/renesas-i3c.c
+++ b/drivers/i3c/master/renesas-i3c.c
@@ -19,10 +19,12 @@
 #include <linux/ioport.h>
 #include <linux/iopoll.h>
 #include <linux/list.h>
+#include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/regmap.h>
 #include <linux/reset.h>
 #include <linux/slab.h>
 #include "../internals.h"
@@ -200,6 +202,9 @@
 #define RENESAS_I3C_MAX_DEVS	8
 #define I2C_INIT_MSG		-1
 
+/* System controller registers */
+#define SYSC_SYS_I3C_CFG_AF_BYPASS	BIT(0)
+
 enum i3c_internal_state {
 	I3C_INTERNAL_STATE_DISABLED,
 	I3C_INTERNAL_STATE_CONTROLLER_IDLE,
@@ -1466,6 +1471,8 @@ static const struct renesas_i3c_irq_desc renesas_i3c_irqs[] = {
 static int renesas_i3c_probe(struct platform_device *pdev)
 {
 	struct renesas_i3c *i3c;
+	struct regmap *sysc;
+	unsigned int anf[2];
 	int ret, i;
 
 	i3c = devm_kzalloc(&pdev->dev, sizeof(*i3c), GFP_KERNEL);
@@ -1497,6 +1504,27 @@ static int renesas_i3c_probe(struct platform_device *pdev)
 		return dev_err_probe(&pdev->dev, PTR_ERR(i3c->presetn),
 				     "Error: missing presetn ctrl\n");
 
+	sysc = syscon_regmap_lookup_by_phandle_args(pdev->dev.of_node,
+						    "renesas,analog-noise-filter",
+						    ARRAY_SIZE(anf), anf);
+	if (IS_ERR(sysc) && PTR_ERR(sysc) != -ENOENT)
+		return dev_err_probe(&pdev->dev, PTR_ERR(sysc),
+				     "Failed to lookup analog noise filter\n");
+
+	if (!IS_ERR(sysc)) {
+		/*
+		 * The analog noise filter of the input terminals is bypassed
+		 * when SYSC_SYS_I3C_CFG_AF_BYPASS is set and used when the
+		 * bit is clear.
+		 */
+		u32 bypass = anf[1] ? 0 : SYSC_SYS_I3C_CFG_AF_BYPASS;
+
+		ret = regmap_update_bits(sysc, anf[0],
+					 SYSC_SYS_I3C_CFG_AF_BYPASS, bypass);
+		if (ret)
+			return ret;
+	}
+
 	spin_lock_init(&i3c->xferqueue.lock);
 	INIT_LIST_HEAD(&i3c->xferqueue.list);
 

-- 
2.56.0




More information about the linux-i3c mailing list