Skip to contentSkip to conversation

i2c: i2c-mt65xx: add support for MT7981

PATCH In review Daniel Golle 2 participants 6 messages Mar 14, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover i2c: i2c-mt65xx: add support for MT7981

Add support for the I2C units found in the MT7981 SoC.

Daniel Golle (2):
i2c: mediatek: add support for MT7981 SoC
dt-bindings: i2c: i2c-mt65xx: add binding for MT7981 SoC

 .../devicetree/bindings/i2c/i2c-mt65xx.yaml         |  1 +
 drivers/i2c/busses/i2c-mt65xx.c                     | 13 +++++++++++++
 2 files changed, 14 insertions(+)

base-commit: 24469a0e5052ba01a35a15f104717a82b7a4798b

Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/2 i2c: mediatek: add support for MT7981 SoC

---
 drivers/i2c/busses/i2c-mt65xx.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/i2c/busses/i2c-mt65xx.c +13 -0
index 43dd966d5ef5..54cabd366403 100644
@@ -431,6 +431,18 @@ static const struct mtk_i2c_compatible mt8168_compat = {
 	.max_dma_support = 33,
 };
 
+static const struct mtk_i2c_compatible mt7981_compat = {
+	.regs = mt_i2c_regs_v3,
+	.pmic_i2c = 0,
+	.dcm = 0,
+	.auto_restart = 1,
+	.aux_len_reg = 1,
+	.timing_adjust = 1,
+	.dma_sync = 1,
+	.ltiming_adjust = 1,
+	.max_dma_support = 33
+};
+
 static const struct mtk_i2c_compatible mt7986_compat = {
 	.quirks = &mt7622_i2c_quirks,
 	.regs = mt_i2c_regs_v1,
@@ -516,6 +528,7 @@ static const struct of_device_id mtk_i2c_of_match[] = {
 	{ .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat },
 	{ .compatible = "mediatek,mt6589-i2c", .data = &mt6589_compat },
 	{ .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat },
+	{ .compatible = "mediatek,mt7981-i2c", .data = &mt7981_compat },
 	{ .compatible = "mediatek,mt7986-i2c", .data = &mt7986_compat },
 	{ .compatible = "mediatek,mt8168-i2c", .data = &mt8168_compat },
 	{ .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat },
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH 1/2] i2c: mediatek: add support for MT7981 SoC

Il 14/03/23 02:18, Daniel Golle ha scritto:

Quoted 10 lines
---
  drivers/i2c/busses/i2c-mt65xx.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)
drivers/i2c/busses/i2c-mt65xx.c +0 -0
index 43dd966d5ef5..54cabd366403 100644

drivers/i2c/busses/i2c-mt65xx.c static const struct mtk_i2c_compatible mt8168_compat = { · line 435

Quoted 5 lines
drivers/i2c/busses/i2c-mt65xx.c +2 -0
@@ -431,6 +431,18 @@ static const struct mtk_i2c_compatible mt8168_compat = {
  	.max_dma_support = 33,
  };
 
+static const struct mtk_i2c_compatible mt7981_compat = {
+	.regs = mt_i2c_regs_v3,

I've found a downstream kernel saying that MT7981 uses mt_i2c_regs_v2, hence the question:

Are you sure that this is supposed to be v3?

Regards,
Angelo

Quoted 21 lines
drivers/i2c/busses/i2c-mt65xx.c +11 -0
+	.pmic_i2c = 0,
+	.dcm = 0,
+	.auto_restart = 1,
+	.aux_len_reg = 1,
+	.timing_adjust = 1,
+	.dma_sync = 1,
+	.ltiming_adjust = 1,
+	.max_dma_support = 33
+};
+
  static const struct mtk_i2c_compatible mt7986_compat = {
  	.quirks = &mt7622_i2c_quirks,
  	.regs = mt_i2c_regs_v1,
@@ -516,6 +528,7 @@ static const struct of_device_id mtk_i2c_of_match[] = {
  	{ .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat },
  	{ .compatible = "mediatek,mt6589-i2c", .data = &mt6589_compat },
  	{ .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat },
+	{ .compatible = "mediatek,mt7981-i2c", .data = &mt7981_compat },
  	{ .compatible = "mediatek,mt7986-i2c", .data = &mt7986_compat },
  	{ .compatible = "mediatek,mt8168-i2c", .data = &mt8168_compat },
  	{ .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat },
#3 lore raw

Re: [PATCH 1/2] i2c: mediatek: add support for MT7981 SoC

Quoted 19 lines · AngeloGioacchino Del Regno

Il 14/03/23 02:18, Daniel Golle ha scritto:

Quoted 10 lines
---
  drivers/i2c/busses/i2c-mt65xx.c | 13 +++++++++++++
  1 file changed, 13 insertions(+)
drivers/i2c/busses/i2c-mt65xx.c +0 -0
index 43dd966d5ef5..54cabd366403 100644

drivers/i2c/busses/i2c-mt65xx.c static const struct mtk_i2c_compatible mt8168_compat = { · line 434

Quoted 4 lines
drivers/i2c/busses/i2c-mt65xx.c +2 -0
@@ -431,6 +431,18 @@ static const struct mtk_i2c_compatible mt8168_compat = {
  	.max_dma_support = 33,
  };
+static const struct mtk_i2c_compatible mt7981_compat = {
+	.regs = mt_i2c_regs_v3,

I've found a downstream kernel saying that MT7981 uses mt_i2c_regs_v2, hence the question:

Quoted 1 line

Are you sure that this is supposed to be v3?

Yes, I've seen that downstream kernel and it also patches OFFSET_SLAVE_ADDR to be 0x94 instead of 0x4 (which is the only difference between v2 and v3 regs).

So yes, I'm sure MT7981 and MT7988 use v3 register layout.

Quoted 27 lines

Regards,
Angelo

Quoted 21 lines
drivers/i2c/busses/i2c-mt65xx.c +11 -0
+	.pmic_i2c = 0,
+	.dcm = 0,
+	.auto_restart = 1,
+	.aux_len_reg = 1,
+	.timing_adjust = 1,
+	.dma_sync = 1,
+	.ltiming_adjust = 1,
+	.max_dma_support = 33
+};
+
  static const struct mtk_i2c_compatible mt7986_compat = {
  	.quirks = &mt7622_i2c_quirks,
  	.regs = mt_i2c_regs_v1,
@@ -516,6 +528,7 @@ static const struct of_device_id mtk_i2c_of_match[] = {
  	{ .compatible = "mediatek,mt6577-i2c", .data = &mt6577_compat },
  	{ .compatible = "mediatek,mt6589-i2c", .data = &mt6589_compat },
  	{ .compatible = "mediatek,mt7622-i2c", .data = &mt7622_compat },
+	{ .compatible = "mediatek,mt7981-i2c", .data = &mt7981_compat },
  	{ .compatible = "mediatek,mt7986-i2c", .data = &mt7986_compat },
  	{ .compatible = "mediatek,mt8168-i2c", .data = &mt8168_compat },
  	{ .compatible = "mediatek,mt8173-i2c", .data = &mt8173_compat },
#4 lore raw

PATCH 2/2 dt-bindings: i2c: i2c-mt65xx: add binding for MT7981 SoC

In reply to Daniel Golle

Add binding documentation for the I2C controllers found in the MediaTek MT7981 SoC.

---
 Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml +1 -0
index 72ae2e01cf22..5ae6769483d7 100644
@@ -23,6 +23,7 @@ properties:
       - const: mediatek,mt6577-i2c
       - const: mediatek,mt6589-i2c
       - const: mediatek,mt7622-i2c
+      - const: mediatek,mt7981-i2c
       - const: mediatek,mt7986-i2c
       - const: mediatek,mt8168-i2c
       - const: mediatek,mt8173-i2c
Signature · 1 line
2.39.2
#5 lore raw

Re: [PATCH 2/2] dt-bindings: i2c: i2c-mt65xx: add binding for MT7981 SoC

Il 14/03/23 02:18, Daniel Golle ha scritto:

Quoted 13 lines

Add binding documentation for the I2C controllers found in the MediaTek MT7981 SoC.

---
  Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml | 1 +
  1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml +0 -0
index 72ae2e01cf22..5ae6769483d7 100644

Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml properties: · line 26

Quoted 4 lines
Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml +1 -0
@@ -23,6 +23,7 @@ properties:
        - const: mediatek,mt6577-i2c
        - const: mediatek,mt6589-i2c
        - const: mediatek,mt7622-i2c
+      - const: mediatek,mt7981-i2c

If MT7981 uses mt_i2c_regs_v2, the i2c compatible would be

compatible = "mediatek,mt7981-i2c", "mediatek,mt8183-i2c";

Regards,
Angelo

Quoted 3 lines
Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml +0 -0
        - const: mediatek,mt7986-i2c
        - const: mediatek,mt8168-i2c
        - const: mediatek,mt8173-i2c