All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: bcm2711-rpi-cm4-io: Add rtc on i2c0
@ 2021-11-22 15:26 Uwe Kleine-König
  2021-11-22 16:08 ` Cyril Brulebois
  2021-11-22 16:33 ` Dave Stevenson
  0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2021-11-22 15:26 UTC (permalink / raw)
  To: Nicolas Saenz Julienne
  Cc: bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel,
	Stefan Wahren, Cyril Brulebois

The cm4-io board comes with an PCF85063. Add it to the device tree to make
it usable.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
 arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
index 19600b629be5..1b67ad65e228 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
@@ -20,6 +20,17 @@ led-pwr {
 	};
 };
 
+&i2c0 {
+	pinctrl-0 = <&i2c0_gpio44>;
+	status = "okay";
+
+	rtc@51 {
+		/* Attention: An alarm resets the machine */
+		compatible = "nxp,pcf85063";
+		reg = <0x51>;
+	};
+};
+
 &ddc0 {
 	status = "okay";
 };

base-commit: 8ab774587903771821b59471cc723bba6d893942
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: dts: bcm2711-rpi-cm4-io: Add rtc on i2c0
  2021-11-22 15:26 [PATCH] ARM: dts: bcm2711-rpi-cm4-io: Add rtc on i2c0 Uwe Kleine-König
@ 2021-11-22 16:08 ` Cyril Brulebois
  2021-11-22 16:33 ` Dave Stevenson
  1 sibling, 0 replies; 5+ messages in thread
From: Cyril Brulebois @ 2021-11-22 16:08 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Nicolas Saenz Julienne, bcm-kernel-feedback-list,
	linux-rpi-kernel, linux-arm-kernel, Stefan Wahren


[-- Attachment #1.1: Type: text/plain, Size: 1879 bytes --]

Uwe Kleine-König <uwe@kleine-koenig.org> (2021-11-22):
> The cm4-io board comes with an PCF85063. Add it to the device tree to make
> it usable.
> 
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
>  arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
> index 19600b629be5..1b67ad65e228 100644
> --- a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
> +++ b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
> @@ -20,6 +20,17 @@ led-pwr {
>  	};
>  };
>  
> +&i2c0 {
> +	pinctrl-0 = <&i2c0_gpio44>;
> +	status = "okay";
> +
> +	rtc@51 {
> +		/* Attention: An alarm resets the machine */
> +		compatible = "nxp,pcf85063";
> +		reg = <0x51>;
> +	};
> +};
> +
>  &ddc0 {
>  	status = "okay";
>  };
> 
> base-commit: 8ab774587903771821b59471cc723bba6d893942

I had come up with the pinctrl-0 setting on my own, making sure i2c0 was
visible in userland (via i2c-2; i2c-0 and i2c-1 being the internal ones,
for HDMI outputs), and I toyed with rtc@51 via an overlay to enable the
RTC automatically (instead of toying with new_device under /sys/class).
My next step was checking whether having both i2c0 wired properly and
the RTC enabled made sense for mainline, and apparently Uwe agrees. :)

This patch looks good to me, and seems to work fine:

Tested-by: Cyril Brulebois <cyril@debamax.com>


Checking arch/arm64/boot/dts/broadcom/.bcm2711-rpi-cm4-io.dtb.dts.tmp,
it looks like i2c0 was already getting enabled anyway, but wired to
i2c0_gpio0 instead:

    &i2c0 {
     pinctrl-names = "default";
     pinctrl-0 = <&i2c0_gpio0>;
     status = "okay";
     clock-frequency = <100000>;
    };


Cheers,
-- 
Cyril Brulebois -- Debian Consultant @ DEBAMAX -- https://debamax.com/

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: dts: bcm2711-rpi-cm4-io: Add rtc on i2c0
  2021-11-22 15:26 [PATCH] ARM: dts: bcm2711-rpi-cm4-io: Add rtc on i2c0 Uwe Kleine-König
  2021-11-22 16:08 ` Cyril Brulebois
@ 2021-11-22 16:33 ` Dave Stevenson
  2021-11-30 12:02   ` nicolas saenz julienne
  1 sibling, 1 reply; 5+ messages in thread
From: Dave Stevenson @ 2021-11-22 16:33 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Nicolas Saenz Julienne, Cyril Brulebois,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel

Hi

On Mon, 22 Nov 2021 at 15:27, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
>
> The cm4-io board comes with an PCF85063. Add it to the device tree to make
> it usable.
>
> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> ---
>  arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
> index 19600b629be5..1b67ad65e228 100644
> --- a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
> +++ b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
> @@ -20,6 +20,17 @@ led-pwr {
>         };
>  };
>
> +&i2c0 {
> +       pinctrl-0 = <&i2c0_gpio44>;

This will break the assumption that most users will make that i2c0 is
on GPIOs 0&1 (pins 27&28 on the 40 pin header). This is the case on
all other Pi variants, so having it different on the CM4IO is going to
catch some out.

You can use the i2c-mux-pinctrl module to expose both pin mappings of
the BSC0 peripheral as separate I2C buses, which is what the
downstream device tree does.

  Dave

> +       status = "okay";
> +
> +       rtc@51 {
> +               /* Attention: An alarm resets the machine */
> +               compatible = "nxp,pcf85063";
> +               reg = <0x51>;
> +       };
> +};
> +
>  &ddc0 {
>         status = "okay";
>  };
>
> base-commit: 8ab774587903771821b59471cc723bba6d893942
> --
> 2.30.2
>
>
> _______________________________________________
> linux-rpi-kernel mailing list
> linux-rpi-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: dts: bcm2711-rpi-cm4-io: Add rtc on i2c0
  2021-11-22 16:33 ` Dave Stevenson
@ 2021-11-30 12:02   ` nicolas saenz julienne
  2021-11-30 17:18     ` Stefan Wahren
  0 siblings, 1 reply; 5+ messages in thread
From: nicolas saenz julienne @ 2021-11-30 12:02 UTC (permalink / raw)
  To: Dave Stevenson, Uwe Kleine-König, Stefan Wahren
  Cc: Cyril Brulebois, bcm-kernel-feedback-list, linux-rpi-kernel,
	linux-arm-kernel

+ Stephan, feel free to chime in.

On Mon, 2021-11-22 at 16:33 +0000, Dave Stevenson wrote:
> Hi
> 
> On Mon, 22 Nov 2021 at 15:27, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
> > 
> > The cm4-io board comes with an PCF85063. Add it to the device tree to make
> > it usable.
> > 
> > Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
> > ---
> >  arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
> > index 19600b629be5..1b67ad65e228 100644
> > --- a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
> > +++ b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
> > @@ -20,6 +20,17 @@ led-pwr {
> >         };
> >  };
> > 
> > +&i2c0 {
> > +       pinctrl-0 = <&i2c0_gpio44>;
> 
> This will break the assumption that most users will make that i2c0 is
> on GPIOs 0&1 (pins 27&28 on the 40 pin header). This is the case on
> all other Pi variants, so having it different on the CM4IO is going to
> catch some out.
> 
> You can use the i2c-mux-pinctrl module to expose both pin mappings of
> the BSC0 peripheral as separate I2C buses, which is what the
> downstream device tree does.

+1

I think it can be done without breaking anything as long as we enable
CONFIG_I2C_MUX_PINCTRL in arm64's defconfig.

Regards,
Nicolas

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: dts: bcm2711-rpi-cm4-io: Add rtc on i2c0
  2021-11-30 12:02   ` nicolas saenz julienne
@ 2021-11-30 17:18     ` Stefan Wahren
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Wahren @ 2021-11-30 17:18 UTC (permalink / raw)
  To: nicolas saenz julienne, Dave Stevenson, Uwe Kleine-König
  Cc: Cyril Brulebois, bcm-kernel-feedback-list, linux-rpi-kernel,
	linux-arm-kernel

Hi,

Am 30.11.21 um 13:02 schrieb nicolas saenz julienne:
> + Stephan, feel free to chime in.
>
> On Mon, 2021-11-22 at 16:33 +0000, Dave Stevenson wrote:
>> Hi
>>
>> On Mon, 22 Nov 2021 at 15:27, Uwe Kleine-König <uwe@kleine-koenig.org> wrote:
>>> The cm4-io board comes with an PCF85063. Add it to the device tree to make
>>> it usable.
>>>
>>> Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
>>> ---
>>>  arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts | 11 +++++++++++
>>>  1 file changed, 11 insertions(+)
>>>
>>> diff --git a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
>>> index 19600b629be5..1b67ad65e228 100644
>>> --- a/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
>>> +++ b/arch/arm/boot/dts/bcm2711-rpi-cm4-io.dts
>>> @@ -20,6 +20,17 @@ led-pwr {
>>>         };
>>>  };
>>>
>>> +&i2c0 {
>>> +       pinctrl-0 = <&i2c0_gpio44>;
>> This will break the assumption that most users will make that i2c0 is
>> on GPIOs 0&1 (pins 27&28 on the 40 pin header). This is the case on
>> all other Pi variants, so having it different on the CM4IO is going to
>> catch some out.
>>
>> You can use the i2c-mux-pinctrl module to expose both pin mappings of
>> the BSC0 peripheral as separate I2C buses, which is what the
>> downstream device tree does.
> +1
>
> I think it can be done without breaking anything as long as we enable
> CONFIG_I2C_MUX_PINCTRL in arm64's defconfig.

i didn't test Dave's suggestion, but it sounds like the better approach
to me. Even this results in more changes ...

Thanks

>
> Regards,
> Nicolas


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-11-30 17:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-22 15:26 [PATCH] ARM: dts: bcm2711-rpi-cm4-io: Add rtc on i2c0 Uwe Kleine-König
2021-11-22 16:08 ` Cyril Brulebois
2021-11-22 16:33 ` Dave Stevenson
2021-11-30 12:02   ` nicolas saenz julienne
2021-11-30 17:18     ` Stefan Wahren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.