]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: pcf85063: add support for fixed clock
authorAlexander Stein <alexander.stein@ew.tq-group.com>
Wed, 13 Oct 2021 07:49:54 +0000 (09:49 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 15 Oct 2021 19:08:45 +0000 (21:08 +0200)
commit7fd805f25d5831de9c8d6a3c00b269b8f944d441
tree30e83c9004be8fa99eacc791c2252958ac8e9c7b
parent30ec54522ab79957652b93112cab52ea270a6354
rtc: pcf85063: add support for fixed clock

TQ-Systems' TQMa8Mx module (SoM) uses a pcf85063 as RTC. The default output
is 32768Hz. This is to provide the i.MX8M CKIL clock. Once the RTC driver
is probed, the clock is disabled and all i.MX8M functionality depending on
the 32 KHz clock will halt. In our case the whole system halts and a power
cycle is required.

Referencing the pcf85063 directly results in a deadlock. The kernel
will see, that i.MX8M system clock needs the RTC clock and do probe
deferral. But the i.MX8M I2C module never becomes usable without the
i.MX8M CKIL clock and thus the RTC's clock will not be probed. So
from the kernel's perspective this is a chicken-and-egg problem.

Technically everything is fine by not touching anything, since
the RTC clock correctly enables the clock on reset (i.e. on
battery backup power loss).

A workaround for this issue is describing the square wave pin
as fixed-clock, which is registered early and basically how
this pin is used on the i.MX8M.

This addresses the exact same issue as in commit b3fec7fdd934 ("rtc:
m41t80: add support for fixed clock").

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
[Fixed return value 0 -> NULL]
Link: https://lore.kernel.org/r/20211013074954.997445-1-alexander.stein@ew.tq-group.com
Documentation/devicetree/bindings/rtc/nxp,pcf85063.txt
drivers/rtc/rtc-pcf85063.c