[PATCH v3] ARM: dts: bcm2711-rpi-cm4-io: Add rtc on a pinctrl-muxed i2c bus

Cyril Brulebois cyril at debamax.com
Sat Jan 1 20:33:22 PST 2022


Uwe Kleine-König <uwe at kleine-koenig.org> (2021-12-31):
> The cm4-io board comes with an PCF85063. Add it to the device tree to make
> it usable. The i2c0 bus can use two different pinmux settings to use
> different pins. To keep the bus appearing on the usual pin pair (gpio0 +
> gpio1) use a pinctrl-muxed setting as the vendor dts does.
> 
> Note that if you modified the dts before to add devices to the i2c bus
> appearing on pins gpio0 + gpio1 (either directly in the dts or using an
> overlay), you have to put these into the i2c at 0 node introduced here now.
> 
> Reviewed-by: Maxime Ripard <maxime at cerno.tech>
> Signed-off-by: Uwe Kleine-König <uwe at kleine-koenig.org>

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


Test hardware:
 - 1 Compute Module 4 IO Board;
 - 1 GPIO Extension Board, plugged onto the 40-pin header (mainly used
   for its labels, to ensure I'm using the correct pins);
 - 1 Pimoroni 5x5 RGB LED matrix, plugged onto SDA0/SCL0 as exposed by
   the GPIO Extension Board (plus 3.3V/GND of course);
 - Debian 11 userspace.

With the updated DTB, and provided the right kernel modules have been
enabled (CONFIG_RTC_DRV_PCF85063, CONFIG_I2C_MUX_PINCTRL), the RTC comes
up automatically; I'm also able to use the relevant library to display a
rotating rainbow on the LED matrix while being able to read from / write
to the RTC:
  https://github.com/pimoroni/rgbmatrix5x5-python

In passing, I'm seeing the RTC exclusively on (userspace) i2c-2 while
I'm seeing the LED matrix on both (userspace) i2c-2 and i2c-3:

    # i2cdetect -y 2
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:                         -- -- -- -- 0c -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 2f 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- -- -- -- --                         
    
    # i2cdetect -y 3
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:                         -- -- -- -- -- -- -- -- 
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
    70: -- -- -- -- 74 -- -- --                         

Tweaking the library to use either of those makes the rotation rainbow
display successfully (via python3-smbus):

    self.i2c = smbus.SMBus(2)
    self.i2c = smbus.SMBus(3)


Cheers,
-- 
Cyril Brulebois -- Debian Consultant @ DEBAMAX -- https://debamax.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20220102/0ebb5d44/attachment.sig>


More information about the linux-arm-kernel mailing list