• Alexander Stein's avatar
    rtc: pcf85063: add support for fixed clock · 4c8a7b80
    Alexander Stein authored
    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 f765e349 ("rtc:
    m41t80: add support for fixed clock").
    Signed-off-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
    Reported-by: default avatarkernel test robot <lkp@intel.com>
    Signed-off-by: default avatarAlexandre 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
    4c8a7b80
rtc-pcf85063.c 16.1 KB