[BPI-R2 Pro] RTC driver/hw issue?

Hi,

I try to seen patch for rtc upstream and this way it is rejected because maintainers think there is an hardware-problem

https://marc.info/?l=linux-kernel&m=166143695822014&w=2

As far as i understand, they assume a race between pmic and rtc probe. So rtc is not completely up (due to pmic init) when probing.

Can you please verify this is maybe the case? Tests were done on r2pro rev 1.0. Maybe something was changed in 1.1?

Reagards Frank

Just wondering, is it a external RTC?

[ 2.781916] rtc-hym8563 3-0051: registered as rtc1

I have such message in all saved dmesgs AFAIK this means successful initialization.

What message or behavior indicates a problem?

===============================================

BTW, /dev/rtc1 solved my problem with hwclock reset after PSU disconnect.

Probably it’s a good idea to update/add to defconfig:

CONFIG_RTC_HCTOSYS_DEVICE="rtc1"
CONFIG_RTC_SYSTOHC_DEVICE="rtc1"

Again, i had no problems with rtc1 in 6.0-rc

===============================================

tested in 6.0-rc

before:

bpi-r2pro ~ # dmesg | grep rtc
[    1.889067] rk808-rtc rk808-rtc: registered as rtc0
[    1.892292] rk808-rtc rk808-rtc: setting system clock to 2017-08-05T09:02:34 UTC (1501923754)
[    1.908561] rtc-hym8563 3-0051: registered as rtc1

after:

bpi-r2pro ~ # dmesg | grep rtc
[    1.896735] rk808-rtc rk808-rtc: registered as rtc0
[    1.910031] rtc-hym8563 3-0051: registered as rtc1
[    1.911523] rtc-hym8563 3-0051: setting system clock to 2022-08-31T05:52:54 UTC (1661925174)

===============================================

Ok, i got it, your branch is already has this patch…

Right,but i do not get it mainline. They think about some kind of hardware issue or race condition between pmic and rtc.

RTC works for me without the patch

[email protected]:/#  dmesg | grep rtc
[    2.414983] rk808-rtc rk808-rtc: registered as rtc0
[    2.418179] rk808-rtc rk808-rtc: setting system clock to 2022-09-05T05:37:17 UTC (1662356237)
[    2.428647] rtc-hym8563 3-0051: registered as rtc1
[email protected]:/# cat /proc/driver/rtc
rtc_time        : 13:31:57
rtc_date        : 2022-09-05
alrm_time       : 21:37:05
alrm_date       : 2022-09-04
alarm_IRQ       : no
alrm_pending    : no
update IRQ enabled      : no
periodic IRQ enabled    : no
periodic IRQ frequency  : 1
max user IRQ frequency  : 64
24hr            : yes

Thx for test, which hw-rev do you have? Peter and mine was 1.0 where we needed this patch. Maybe v1.1 is fixed…then it will be interesting what was changed

I forgot to mention that, my board is v1.1

@sinovoip has anything changed for rtc between v1.0 and v1.1 ?

1 Like

got it , will check it soon

just change U22 HYM8563TS to AT8563S.because we found after poweron the frist time to read HYM8563TS(i2cget), oftenly won’t return anything,but the second time an after that, it work fine. AT8563S does not have this issue.

Mhm,that matches my experience and why i had sent the patch simply try to init 3 times. Wonder why new chip is recognize as hym too as it looks to be completely different vendor.

Do you find anything in research why this issue is happen (race condition?) And why other rk boards seem to not affected? Hym seems to be widely used.

Yes, RK’s reference design also uses HYM, but the actual test is not good. We have also measured the waveform and timing of I2C. At least we think there is no problem.Tried HYM’s agent for their help, but their support is not enough, so we replaced it