raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
Other
11.02k stars 4.95k forks source link

CM3 and RTC PCF85063 #4934

Open shanemurphyconex opened 2 years ago

shanemurphyconex commented 2 years ago

Describe the bug

I am trying to use a PCF85063 RTC with a CM3. Currently using version 4.19.66-v7+.

I do not see any kernel module for the PCF85063, only for the PCF8563, which has slightly different registers. It does not seem like it should be THAT difficult to get the PCF85063 working with the RPI CM3.

I currently have the PCF85063 on 44/45 and am able to detect it with "i2cdetect -y 1".

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

In /boot/config.txt, I added these two lines:

dtoverlay=i2c-rtc,i2c1,pcf85063
dtoverlay=i2c1-bcm2708,sda1_pin=44,scl1_pin=45,pin_func=6

Additionally, I have tried: dtoverlay=i2c-rtc,i2c1,pcf8563 Which changes the address in i2cdetect to UU, but the registers are slightly different and therefore did not work with "sudo hwclock".

And in "i2c-rtc-overlay.dts" I have added a fragment for this RTC:

fragment@10 {
                target = <&i2c_arm>;
                __dormant__ {
                        #address-cells = <1>;
                        #size-cells = <0>;
                        status = "okay";

                        pcf85063: pcf85063@51 {
                                compatible = "nxp,pcf85063";
                                reg = <0x51>;
                                status = "okay";
                        };
                };
        };

I believe my next step is to add a kernel module (.ko) with support for the PCF85063 but that is where I am stuck.

Reason for wanting to use the PCF85063 on the CM3: Inexpensive compared to other RTC, available, supposedly supported on CM4 which I will be working with shortly, small footprint.

Any advice at this point would be great, or if there is anything I am doing incorrectly please let me know. If any files are needed I can upload them.

Steps to reproduce the behaviour

"i2cdetect -y -1" does not show "UU", only address "51".

Device (s)

Raspberry Pi CM3

System

Raspberry Pi reference 2019-04-08 Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, e910bf55ac92e27c6e77043e8995bcb5e0a2d742, stage2

Aug 15 2019 12:06:42 Copyright (c) 2012 Broadcom version 0e6daa5106dd4164474616408e0dc24f997ffcf3 (clean) (release) (start)

Linux raspberrypi 4.19.66-v7+ #1253 SMP Thu Aug 15 11:49:46 BST 2019 armv7l GNU/Linux

Logs

No response

Additional context

No response

pelwell commented 2 years ago

An updated driver and overlay is waiting for you in our 5.10 kernel, but we are soon to switch to 5.15 as our main kernel version. We can't offer support for 4.19.