Skip to contentSkip to conversation

Add MediaTek MT8365 I2C support

PATCH Applied Alexandre Mergnat 3 participants 6 messages Jan 19, 2023 – Jan 20, 2023

Subsystems (4)

v2 of 6 Applied Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add MediaTek MT8365 I2C support

Hi,
This patch series adds I2C support for MT8365-EVK board. The I2C-0 is enabled, it can be used through the board pin header, as described directly on the PCB.

This series depends to another one which add support for MT8365 SoC and EVK board. Link [1]

One patch has been cherry-picked from [2], so I've addressed the comment and kept the trailer.

Regards,
Alex

[1]: https://lore.kernel.org/linux-mediatek/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/

To: Qii Wang <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Matthias Brugger <[email protected]>

---
Changes in v2:
- Drop the patch which do useless change in i2c-mt65xx.c driver.
- Change 2 lines compatible/reg in oneline.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Alexandre Mergnat (2):
arm64: dts: mediatek: add i2c support for mt8365 SoC
arm64: dts: mediatek: enable i2c0 for mt8365-evk board

Fabien Parent (1):
dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC

 .../devicetree/bindings/i2c/i2c-mt65xx.yaml        |  4 ++
 arch/arm64/boot/dts/mediatek/mt8365-evk.dts        | 19 ++++++++
 arch/arm64/boot/dts/mediatek/mt8365.dtsi           | 52 ++++++++++++++++++++++
 3 files changed, 75 insertions(+)

---
base-commit: 8b6cfcce3ce939db11166680a57253c39110f07e
change-id: 20221122-mt8365-i2c-support-fc048da261ea

Best regards,

Signature · 1 line
Alexandre Mergnat <[email protected]>
#1 lore raw

PATCH v2 1/3 dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC

From: Fabien Parent <[email protected]>

Add binding documentation for the MT8365 I2C controllers.

---
 Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml +4 -0
index 421563bf576c..72ae2e01cf22 100644
@@ -41,6 +41,10 @@ properties:
               - mediatek,mt6797-i2c
               - mediatek,mt7623-i2c
           - const: mediatek,mt6577-i2c
+      - items:
+          - enum:
+              - mediatek,mt8365-i2c
+          - const: mediatek,mt8168-i2c
       - items:
           - enum:
               - mediatek,mt8195-i2c
Signature · 1 line
b4 0.10.1
maintainer Reviewed-by on v2 1/3
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC

Quoted 8 lines · Alexandre Mergnat

From: Fabien Parent <[email protected]>

Add binding documentation for the MT8365 I2C controllers.

Quoted 20 lines
---
  Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml | 4 ++++
  1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/i2c/i2c-mt65xx.yaml +4 -0
index 421563bf576c..72ae2e01cf22 100644
@@ -41,6 +41,10 @@ properties:
                - mediatek,mt6797-i2c
                - mediatek,mt7623-i2c
            - const: mediatek,mt6577-i2c
+      - items:
+          - enum:
+              - mediatek,mt8365-i2c
+          - const: mediatek,mt8168-i2c
        - items:
            - enum:
                - mediatek,mt8195-i2c
Applied
#3 lore raw

Re: [PATCH v2 1/3] dt-bindings: i2c: i2c-mt65xx: add binding for MT8365 SoC

In reply to Alexandre Mergnat
Quoted 8 lines · Alexandre Mergnat

From: Fabien Parent <[email protected]>

Add binding documentation for the MT8365 I2C controllers.

Applied to for-next, thanks!

#4 lore raw

PATCH v2 2/3 arm64: dts: mediatek: add i2c support for mt8365 SoC

In reply to Alexandre Mergnat

There are four I2C master channels in MT8365 with a same HW architecture.

---
 arch/arm64/boot/dts/mediatek/mt8365.dtsi | 52 ++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
arch/arm64/boot/dts/mediatek/mt8365.dtsi +52 -0
index a32f2b7507be..013beb50b4aa 100644
@@ -282,6 +282,58 @@ pwm: pwm@11006000 {
 			clock-names = "top", "main", "pwm1", "pwm2", "pwm3";
 		};
 
+		i2c0: i2c@11007000 {
+			compatible = "mediatek,mt8365-i2c", "mediatek,mt8168-i2c";
+			reg = <0 0x11007000 0 0xa0>, <0 0x11000080 0 0x80>;
+			interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_LOW>;
+			clock-div = <1>;
+			clocks = <&infracfg CLK_IFR_I2C0_AXI>,
+				 <&infracfg CLK_IFR_AP_DMA>;
+			clock-names = "main", "dma";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
+		i2c1: i2c@11008000 {
+			compatible = "mediatek,mt8365-i2c", "mediatek,mt8168-i2c";
+			reg = <0 0x11008000 0 0xa0>, <0 0x11000100 0 0x80>;
+			interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_LOW>;
+			clock-div = <1>;
+			clocks = <&infracfg CLK_IFR_I2C1_AXI>,
+				 <&infracfg CLK_IFR_AP_DMA>;
+			clock-names = "main", "dma";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
+		i2c2: i2c@11009000 {
+			compatible = "mediatek,mt8365-i2c", "mediatek,mt8168-i2c";
+			reg = <0 0x11009000 0 0xa0>, <0 0x11000180 0 0x80>;
+			interrupts = <GIC_SPI 30 IRQ_TYPE_LEVEL_LOW>;
+			clock-div = <1>;
+			clocks = <&infracfg CLK_IFR_I2C2_AXI>,
+				 <&infracfg CLK_IFR_AP_DMA>;
+			clock-names = "main", "dma";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
+		i2c3: i2c@1100f000 {
+			compatible = "mediatek,mt8365-i2c", "mediatek,mt8168-i2c";
+			reg = <0 0x1100f000 0 0xa0>, <0 0x11000200 0 0x80>;
+			interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_LOW>;
+			clock-div = <1>;
+			clocks = <&infracfg CLK_IFR_I2C3_AXI>,
+				 <&infracfg CLK_IFR_AP_DMA>;
+			clock-names = "main", "dma";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+
 		spi: spi@1100a000 {
 			compatible = "mediatek,mt8365-spi", "mediatek,mt7622-spi";
 			reg = <0 0x1100a000 0 0x100>;
Signature · 1 line
b4 0.10.1
#5 lore raw

PATCH v2 3/3 arm64: dts: mediatek: enable i2c0 for mt8365-evk board

In reply to Alexandre Mergnat

Enable the I2C0 bus provides communication with:
- The integrated RT9466 Switching Battery Charger.
- The integrated MT6691 LP4X buck for VDDQ.
- The integrated MT6691 LP4X buck for VDD2.
- The pin header, to plug external I2C devices.

---
 arch/arm64/boot/dts/mediatek/mt8365-evk.dts | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/arm64/boot/dts/mediatek/mt8365-evk.dts +19 -0
index 275ea3a0e708..d5d76a7dbd82 100644
@@ -88,6 +88,15 @@ optee_reserved: optee@43200000 {
 	};
 };
 
+&i2c0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&i2c0_pins>;
+	clock-frequency = <100000>;
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+};
+
 &pio {
 	gpio_keys: gpio-keys-pins {
 		pins {
@@ -97,6 +106,16 @@ pins {
 		};
 	};
 
+	i2c0_pins: i2c0 {
+		pins_i2c {
+			pinmux = <MT8365_PIN_57_SDA0__FUNC_SDA0_0>,
+				 <MT8365_PIN_58_SCL0__FUNC_SCL0_0>;
+			mediatek,pull-up-adv = <3>;
+			mediatek,drive-strength-adv = <00>;
+			bias-pull-up;
+		};
+	};
+
 	uart0_pins: uart0-pins {
 		pins {
 			pinmux = <MT8365_PIN_35_URXD0__FUNC_URXD0>,
Signature · 1 line
b4 0.10.1