diff mbox series

[v5,2/2] arm64: dts: mediatek: enable i2c0 for mt8365-evk board

Message ID 20221122-mt8365-i2c-support-v5-2-6e4f3b54937f@baylibre.com (mailing list archive)
State New, archived
Headers show
Series Add MediaTek MT8365 I2C support | expand

Commit Message

Alexandre Mergnat March 27, 2023, 8:27 a.m. UTC
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.

Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
---
 arch/arm64/boot/dts/mediatek/mt8365-evk.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

AngeloGioacchino Del Regno March 27, 2023, 8:45 a.m. UTC | #1
Il 27/03/23 10:27, Alexandre Mergnat ha scritto:
> 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.
> 
> Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
> ---
>   arch/arm64/boot/dts/mediatek/mt8365-evk.dts | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
> index 4683704ea235..35cb142004a4 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
> +++ b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
> @@ -87,6 +87,13 @@ optee_reserved: optee@43200000 {
>   	};
>   };
>   
> +&i2c0 {
> +	clock-frequency = <100000>;
> +	pinctrl-0 = <&i2c0_pins>;
> +	pinctrl-names = "default";
> +	status = "okay";
> +};
> +
>   &pio {
>   	gpio_keys: gpio-keys-pins {
>   		pins {
> @@ -96,6 +103,15 @@ pins {
>   		};
>   	};
>   
> +	i2c0_pins: i2c0-pins {
> +		pins {
			pinmux = ...pins...
			bias-pull-up = <your-pull-up-adv-value>;
		};

...and please do *not* use the mediatek,pull-up-adv property: this is
supposed to be there only for older devicetrees and there's a replacement
for it.... unless you have any specific reason to do so (and if you do,
you should well explain that).

Besides, if you introduce the usage of that property in any 8365 devicetree,
the previously proposed 8365 pinctrl cleanup will become a bit harder to do.

Cheers,
Angelo
Alexandre Mergnat March 27, 2023, 10:56 a.m. UTC | #2
Hi Angelo,

Le lun. 27 mars 2023 à 10:45, AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com> a écrit :
>
> Il 27/03/23 10:27, Alexandre Mergnat ha scritto:
> > 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.
> >
> > Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
> > ---
> >   arch/arm64/boot/dts/mediatek/mt8365-evk.dts | 16 ++++++++++++++++
> >   1 file changed, 16 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
> > index 4683704ea235..35cb142004a4 100644
> > --- a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
> > +++ b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
> > @@ -87,6 +87,13 @@ optee_reserved: optee@43200000 {
> >       };
> >   };
> >
> > +&i2c0 {
> > +     clock-frequency = <100000>;
> > +     pinctrl-0 = <&i2c0_pins>;
> > +     pinctrl-names = "default";
> > +     status = "okay";
> > +};
> > +
> >   &pio {
> >       gpio_keys: gpio-keys-pins {
> >               pins {
> > @@ -96,6 +103,15 @@ pins {
> >               };
> >       };
> >
> > +     i2c0_pins: i2c0-pins {
> > +             pins {
>                         pinmux = ...pins...
>                         bias-pull-up = <your-pull-up-adv-value>;
>                 };
>
> ...and please do *not* use the mediatek,pull-up-adv property: this is
> supposed to be there only for older devicetrees and there's a replacement
> for it.... unless you have any specific reason to do so (and if you do,
> you should well explain that).

bias-pull-up isn't necessary currently because MT8365 doesn't use MTK
paris/moore drivers.

> Besides, if you introduce the usage of that property in any 8365 devicetree,
> the previously proposed 8365 pinctrl cleanup will become a bit harder to do.

I'm thinking of deprecating the "mediatek,pull-up-adv",
"mediatek,pull-down-adv" properties from mt8365 pinctrl binding too.

Regards,
Alex
Alexandre Mergnat March 27, 2023, 10:59 a.m. UTC | #3
> > ...and please do *not* use the mediatek,pull-up-adv property: this is
> > supposed to be there only for older devicetrees and there's a replacement
> > for it.... unless you have any specific reason to do so (and if you do,
> > you should well explain that).
>
> bias-pull-up isn't necessary currently because MT8365 doesn't use MTK

I mean mediatek,pull-up-adv. bias-pull-up can be kept.
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
index 4683704ea235..35cb142004a4 100644
--- a/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8365-evk.dts
@@ -87,6 +87,13 @@  optee_reserved: optee@43200000 {
 	};
 };
 
+&i2c0 {
+	clock-frequency = <100000>;
+	pinctrl-0 = <&i2c0_pins>;
+	pinctrl-names = "default";
+	status = "okay";
+};
+
 &pio {
 	gpio_keys: gpio-keys-pins {
 		pins {
@@ -96,6 +103,15 @@  pins {
 		};
 	};
 
+	i2c0_pins: i2c0-pins {
+		pins {
+			bias-pull-up;
+			mediatek,pull-up-adv = <3>;
+			pinmux = <MT8365_PIN_57_SDA0__FUNC_SDA0_0>,
+				 <MT8365_PIN_58_SCL0__FUNC_SCL0_0>;
+		};
+	};
+
 	uart0_pins: uart0-pins {
 		pins {
 			pinmux = <MT8365_PIN_35_URXD0__FUNC_URXD0>,