mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] i2c: rtl9300: remove IO_MODE configuration
@ 2026-10-10  6:12 Michael Zavertkin
  2026-10-10  6:12 ` [PATCH v2 1/2] i2c: rtl9300: add realtek,rtl9607c-i2c compatible Michael Zavertkin
  2026-10-10  6:12 ` [PATCH v2 2/2] dt-bindings: i2c: rtl9300: add 'rtl9607c-i2c' Michael Zavertkin
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Zavertkin @ 2026-10-10  6:12 UTC (permalink / raw)
  To: linux-i2c
  Cc: Rustam Adilov, Chris Packham, Andi Shyti, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree, linux-kernel,
	Michael Zavertkin

i2c driver for RTL9607C used to configure IO_MODE register. The register
is global and responsible for configuring SoC pins, therefore it should
belong to pinctrl driver.

SoC-specific pinctrl driver is WIP (waiting for these patches in OpenWRT),
but pinctrl-single could be used instead.

While added compatible realtek,rtl9607c-i2c relies on pinctrl driver,
old realtek,rtl9607-i2c left for backward compatibility.

Signed-off-by: Michael Zavertkin <misha.zavertkin@mail.ru>
---
Changes in v2:
- Backward compatibility achieved by adding new compatible value. Old
  one is marked as deprecated
- Link to v1: https://patch.msgid.link/cover.1791127538.git.misha.zavertkin@mail.ru
---
Michael Zavertkin (2):
  i2c: rtl9300: add realtek,rtl9607c-i2c compatible
  dt-bindings: i2c: rtl9300: add 'rtl9607c-i2c'

 .../bindings/i2c/realtek,rtl9301-i2c.yaml     | 20 ++++++++++++++++++-
 drivers/i2c/busses/i2c-rtl9300.c              | 15 ++++++++++----
 2 files changed, 30 insertions(+), 5 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] i2c: rtl9300: add realtek,rtl9607c-i2c compatible
  2026-10-10  6:12 [PATCH v2 0/2] i2c: rtl9300: remove IO_MODE configuration Michael Zavertkin
@ 2026-10-10  6:12 ` Michael Zavertkin
  2026-10-10  6:12 ` [PATCH v2 2/2] dt-bindings: i2c: rtl9300: add 'rtl9607c-i2c' Michael Zavertkin
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Zavertkin @ 2026-10-10  6:12 UTC (permalink / raw)
  To: linux-i2c
  Cc: Rustam Adilov, Chris Packham, Andi Shyti, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree, linux-kernel,
	Michael Zavertkin

RTL9607C was already supported by realtek,rtl9607-i2c, which is
confusing, because there are another SoCs such as RTL9607F, RTL9607
(without letter) and a few more. So more correct compatible was added.

New compatible doesn't use IO_MODE_EN register, leaving it to pinctrl
driver. Old one left for backward compatibility.

Signed-off-by: Michael Zavertkin <misha.zavertkin@mail.ru>
---
 drivers/i2c/busses/i2c-rtl9300.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c
index 3a8225b0666c..22aa3b38458c 100644
--- a/drivers/i2c/busses/i2c-rtl9300.c
+++ b/drivers/i2c/busses/i2c-rtl9300.c
@@ -200,10 +200,12 @@ static int rtl9607_i2c_config_chan(struct rtl9300_i2c *i2c, struct rtl9300_i2c_c
 	if (ret)
 		return ret;
 
-	drv_data = device_get_match_data(i2c->dev);
-	ret = drv_data->select_scl(i2c, i2c->scl_num);
-	if (ret)
-		return ret;
+	if (device_is_compatible(i2c->dev, "realtek,rtl9607-i2c")) {
+		drv_data = device_get_match_data(i2c->dev);
+		ret = drv_data->select_scl(i2c, i2c->scl_num);
+		if (ret)
+			return ret;
+	}
 
 	i2c->sda_num = chan->sda_num;
 	return 0;
@@ -494,6 +496,10 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
 		scl_num = 0;
 	i2c->scl_num = (u8)scl_num;
 
+	if (device_is_compatible(i2c->dev, "realtek,rtl9607-i2c"))
+		dev_warn(dev, "Compatible 'realtek,rtl9607-i2c' is deprecated. "
+			      "Use 'realtek,rtl9607c-i2c' instead\n");
+
 	platform_set_drvdata(pdev, i2c);
 
 	drv_data = device_get_match_data(i2c->dev);
@@ -652,6 +658,7 @@ static const struct of_device_id i2c_rtl9300_dt_ids[] = {
 	{ .compatible = "realtek,rtl9312-i2c", .data = (void *) &rtl9310_i2c_drv_data },
 	{ .compatible = "realtek,rtl9313-i2c", .data = (void *) &rtl9310_i2c_drv_data },
 	{ .compatible = "realtek,rtl9607-i2c", .data = (void *) &rtl9607_i2c_drv_data },
+	{ .compatible = "realtek,rtl9607c-i2c", .data = (void *) &rtl9607_i2c_drv_data },
 	{}
 };
 MODULE_DEVICE_TABLE(of, i2c_rtl9300_dt_ids);
-- 
2.54.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] dt-bindings: i2c: rtl9300: add 'rtl9607c-i2c'
  2026-10-10  6:12 [PATCH v2 0/2] i2c: rtl9300: remove IO_MODE configuration Michael Zavertkin
  2026-10-10  6:12 ` [PATCH v2 1/2] i2c: rtl9300: add realtek,rtl9607c-i2c compatible Michael Zavertkin
@ 2026-10-10  6:12 ` Michael Zavertkin
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Zavertkin @ 2026-10-10  6:12 UTC (permalink / raw)
  To: linux-i2c
  Cc: Rustam Adilov, Chris Packham, Andi Shyti, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree, linux-kernel,
	Michael Zavertkin

Add realtek,rtl9607c-i2c compatible for RTL9607C SoC and mark
realtek,rtl9607-i2c as deprecated.

New compatible relies on pinctrl driver for correct pin assignment
instead of directly modifying IO_MODE register.

Signed-off-by: Michael Zavertkin <misha.zavertkin@mail.ru>
---
 .../bindings/i2c/realtek,rtl9301-i2c.yaml     | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml b/Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml
index 5873cfdc5b3e..7c00918f33c8 100644
--- a/Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml
@@ -36,7 +36,11 @@ properties:
       - enum:
           - realtek,rtl9301-i2c
           - realtek,rtl9310-i2c
-          - realtek,rtl9607-i2c
+          - realtek,rtl9607c-i2c
+      - const: realtek,rtl9607-i2c
+        deprecated: true
+        description: >
+          Use 'realtek,rtl9607c-i2c' instead
 
   reg:
     items:
@@ -57,6 +61,10 @@ properties:
   clocks:
     maxItems: 1
 
+  pinctrl-0: true
+
+  pinctrl-names: true
+
 patternProperties:
   '^i2c@[0-9ab]$':
     $ref: /schemas/i2c/i2c-controller.yaml
@@ -96,6 +104,16 @@ allOf:
       required:
         - realtek,scl
         - clocks
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: realtek,rtl9607c-i2c
+    then:
+      required:
+        - clocks
+        - pinctrl-0
+        - pinctrl-names
 
 required:
   - compatible
-- 
2.54.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-10  6:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-10  6:12 [PATCH v2 0/2] i2c: rtl9300: remove IO_MODE configuration Michael Zavertkin
2026-10-10  6:12 ` [PATCH v2 1/2] i2c: rtl9300: add realtek,rtl9607c-i2c compatible Michael Zavertkin
2026-10-10  6:12 ` [PATCH v2 2/2] dt-bindings: i2c: rtl9300: add 'rtl9607c-i2c' Michael Zavertkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®