Source: linux
Version: 4.19.146-1
Severity: normal
Tags: patch

Hi,

While preparing a product based on a Raspberry Pi Compute Module 3+
embedded on a carrier board, I've stumbled upon an RTC module that's not
enabled in the current arm64 kernel on buster, that's required for the
PCF85063* family:
  https://www.nxp.com/search?keyword=PCF85063&start=0

I've tested two approaches:
 - Hackingly building it as a module (rebuilding only the drivers/rtc
   directory, shipping the resulting .ko and calling depmod myself);
 - and having it built-in instead, this time going for a full build of
   the linux source package, cross-building it for arm64 on amd64.

In both cases, some actions are required to activate the RTC:

    modprobe i2c-dev
    modprobe rtc-pcf85063
    echo pcf85063 0x51 > /sys/class/i2c-adapter/i2c-1/new_device

This means that the kernel initialization happens too early for the
kernel itself reading the RTC time and using it to define system time:

    [    3.889684] hctosys: unable to open rtc device (rtc0)
    [   10.577352] rtc-pcf85063 1-0051: rtc core: registered rtc-pcf85063 as 
rtc0

But after the write to “…/new_device”, one can set system time from the
RTC manually with:

    hwclock -s     # aka. --hctosys

I've also verified that systemd-timesyncd manages to update the RTC
upon successful NTP synchronization.


For now, I've only tested this with a buster userspace, on top of the
buster branch of linux.git; please let me know if you require applying
it on top of unstable and testing the resulting linux-image package
before considering applying this patch to buster (I would understand,
but I'd be rather happy to skip an extra build).

Because of the required I²C dance, I don't think it makes much of a
difference to enable it with =y or =m (I've learned about some
interesting facts in #855203); my most recent attempt was a full
(cross-)build with =y, hence the proposed patch.


Thanks for considering,
Cyril.
-- 
Cyril Brulebois -- Debian Consultant @ DEBAMAX -- https://debamax.com/
From b187f0b521c18f65e077c99dd464290b125b47e5 Mon Sep 17 00:00:00 2001
From: Cyril Brulebois <cy...@debamax.com>
Date: Fri, 16 Oct 2020 13:22:39 +0200
Subject: [PATCH] Set CONFIG_RTC_DRV_PCF85063=y on arm64.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Tested successfully with PCF85063TP/PCF85063A on a carrier board with
Raspberry Pi Compute Module 3+, via I²C, on top of Linux 4.19.146, with
a buster userspace:

    modprobe i2c-dev
    modprobe rtc-pcf85063
    echo pcf85063 0x51 > /sys/class/i2c-adapter/i2c-1/new_device

which results in:

    [   10.577352] rtc-pcf85063 1-0051: rtc core: registered rtc-pcf85063 as 
rtc0

Tested-by: Cyril Brulebois <cy...@debamax.com>
Signed-off-by: Cyril Brulebois <cy...@debamax.com>
---
 debian/changelog           | 6 ++++++
 debian/config/arm64/config | 1 +
 2 files changed, 7 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 9de6cef68fb2..087e48b0843f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+linux (4.19.146-2) UNRELEASED; urgency=medium
+
+  * Set CONFIG_RTC_DRV_PCF85063=y on arm64.
+
+ -- Cyril Brulebois <cy...@debamax.com>  Fri, 16 Oct 2020 12:42:59 +0200
+
 linux (4.19.146-1) buster; urgency=medium
 
   * New upstream stable update:
diff --git a/debian/config/arm64/config b/debian/config/arm64/config
index b9d806a3cbbf..dd9002e40de7 100644
--- a/debian/config/arm64/config
+++ b/debian/config/arm64/config
@@ -994,6 +994,7 @@ CONFIG_RTC_DRV_DS1307=y
 CONFIG_RTC_DRV_MAX77686=y
 CONFIG_RTC_DRV_RK808=y
 CONFIG_RTC_DRV_PCF8563=y
+CONFIG_RTC_DRV_PCF85063=y
 CONFIG_RTC_DRV_EFI=y
 CONFIG_RTC_DRV_CROS_EC=m
 CONFIG_RTC_DRV_PL031=y
-- 
2.20.1

Reply via email to