Skip to content

Comments

EMB-237: build M41T80 RTC driver into kernel#219

Open
bajosoto wants to merge 1 commit intomaster/imx8from
EMB-237-fix-chronological-discrepancy-in-logs
Open

EMB-237: build M41T80 RTC driver into kernel#219
bajosoto wants to merge 1 commit intomaster/imx8from
EMB-237-fix-chronological-discrepancy-in-logs

Conversation

@bajosoto
Copy link
Contributor

@bajosoto bajosoto commented Feb 17, 2026

Description

This PR fixes a bug where initially during boot, the timestamps in the log are incorrect and eventually change to the correct date, creating a chronological discrepancy and making Ruben and everyone else's life difficult when trying to read logs, especially via Grafana et.al.

The problem was that the external RTC (real time clock) M41T80 was being loaded as a module (rtc1), meaning that while booting, the RTC embedded on the SoC (rtc0) was being used until rtc1 was loaded. Since we don't have a proper shutdown routine where rtc0 is written or anything, that one always contains garbage dates.

When this driver is built as a module, rtc1 is registered later and the system clock is corrected mid-boot, causing a visible time jump. Building it in allows hctosys to use rtc1 earlier and avoids that jump.

The fix: Set CONFIG_RTC_DRV_M41T80=y so the external RTC (rtc1) is available during early boot.

How has this been tested

@bajosoto : On an S8, I first booted the printer with 11.2.0 and confirmed the time jump in the logs:

Mar 06 14:56:18 kernel: rtc-m41t80 3-0068: registered as rtc1
Mar 06 14:56:18 kernel: at24 1-0057: 4096 byte 24c32 EEPROM, writable, 32 bytes/write
Mar 06 14:56:18 systemd[1]: Mounting var-spool.mount - /var/spool...
Mar 06 14:56:18 systemd[1]: Starting connman.service - Connection service...
Feb 17 08:36:50 kernel: at24 1-0050: supply vcc not found, using dummy regulator
Feb 17 08:36:50 kernel: EXT4-fs (mmcblk2p3): mounted filesystem 4de4086f-b8f8-4444-98da-b2d066cf678e r/w with ordered data mode. Quota mode: none.
Feb 17 08:36:50 kernel: rtc-m41t80 3-0068: setting system clock to 2026-02-17T08:36:50 UTC (1771317410)

Note: It's easy to find the jump if you search for "registered as rtc1"

After installing the QA build, I verified that the time jump is gone and the correct time is displayed before rtc1 is registered:

Feb 17 14:02:13 kernel: i2c i2c-2: IMX I2C adapter registered
Feb 17 14:02:13 kernel: i2c 3-002c: Fixed dependency cycle(s) with /panel-lvds
Feb 17 14:02:13 kernel: rtc-m41t80 3-0068: registered as rtc1
Feb 17 14:02:13 kernel: rtc-m41t80 3-0068: setting system clock to 2026-02-17T14:02:07 UTC (1771336927)
Feb 17 14:02:13 kernel: i2c i2c-3: IMX I2C adapter registered
Feb 17 14:02:13 kernel: imx6q-pcie 33800000.pcie: host bridge /soc@0/pcie@33800000 ranges:
Feb 17 14:02:13 kernel: imx6q-pcie 33800000.pcie:       IO 0x001ff80000..0x001ff8ffff -> 0x0000000000
Feb 17 14:02:13 kernel: imx6q-pcie 33800000.pcie:      MEM 0x0018000000..0x001fefffff -> 0x0018000000
Feb 17 14:02:13 kernel: etnaviv etnaviv: bound 38000000.gpu (ops gpu_ops)

QA build: update-firmware 237.0.5-dev

Ready for Review Checklist

To help with deciding if this PR is RFR, use this checklist.

The author confirms that:

  • the author has self-reviewed this work and is highly confident about the quality
  • this work satisfies all acceptance criteria that are stated in the linked ticket
  • this work has been tested on all product families and the process and results are documented in the above section
  • The description above is concise yet complete
  • the reviewer has been offered a walkthrough (if needed)
  • the code is cleaned from any rubbish (e.g. meaningless comments, log-spamming, etc...)
  • remaining #TODO comments mention a Jira ticket number
  • all CI checks are passing
  • all commits are (re)structured to be meaningful and clearly arranged, and all are prepended with the ticket number for traceability

Set CONFIG_RTC_DRV_M41T80=y so the external RTC (rtc1) is available
during early boot.

When this driver is built as a module, rtc1 is registered later and the
system clock is corrected mid-boot, causing a visible time jump.
Building it in allows hctosys to use rtc1 earlier and avoids that jump.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants