Page MenuHomeFreeBSD

ds1307: add support for the EPSON RX-8035SA I2C RTC
ClosedPublic

Authored by matt_traverse.com.au on Jul 17 2022, 11:08 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 26, 12:40 AM
Unknown Object (File)
Thu, Apr 25, 11:27 PM
Unknown Object (File)
Thu, Apr 25, 5:59 PM
Unknown Object (File)
Thu, Apr 25, 2:45 PM
Unknown Object (File)
Thu, Apr 25, 2:44 PM
Unknown Object (File)
Thu, Apr 25, 2:42 PM
Unknown Object (File)
Mon, Apr 22, 8:05 AM
Unknown Object (File)
Sun, Apr 21, 11:49 PM
Subscribers

Details

Summary

This I2C RTC has a similar time register layout to the ds1307 family, but with some minor differences in bit positions, polarity and control registers.

There are also other features in this RTC like event (GPIO) detection, alarm, timestamp and scratch/RAM register which are not implemented at this time.

There is also a predecessor device, the RX-8025 which could be implemented with a few minor changes, but this has been left out for simplicity.

I started with the ds1307(4) driver for simplicity (and to ease the learning curve as I'm new to FreeBSD), but an entirely separate driver for the Epson RX-8025/35 could be justified given the divergence between them and other ds1307-look-a-likes.

Test Plan

I have tested this driver to be "interoperable" with the Linux rtc-rx8025 driver, in other words, the time set in one system should be readable by the other on reboot.

I also tested that FreeBSD will correctly reset the validity status bits for a board where the RTC was not keeping time, for example on the Ten64, we use a supercap instead of a battery so there is only a few days at most of 'offline' time keeping.

Unfortunately I don't have a device with a ds1307 so can't regression test.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz removed subscribers: bz, loos.
manu added inline comments.
sys/dev/iicbus/ds1307.c
59

That doesn't seems to be needed.

109

We usually don't use func for non-debug printf.

142

Shouldn't that be TYPE_MICROCHIP_MCP74 ?

376

return (...)

sys/dev/iicbus/ds1307.c
109

That's my fault. I think the same message was in multiple functions so I wanted to be able to figure out where it is from. func is good for that.

Addresse @manu 's comments (but the func).

@manu, what's you suggestion on how to better distinguish the various
identical device_printf error messages in multiple functions w/o hardcoding
the function name?

Anyone else anything on this?

If no one has any further comments I'll commit it the next days...

sys/dev/iicbus/ds1307.c
384

This is a bug. For DS1307 we'd clear the AMPM bit again when PM making it HS20 in 24-hour mode. Not what we want.

Update return () and comments.
Reduce some whitespace to main.

Fix a bug in ds1307_settime() where we'd lose DS1307_HOUR_USE_AMPM in
case of PM.

Unless I'll hear anything this will go in before the end of this month.

This revision was not accepted when it landed; it landed in state Needs Review.Sep 2 2022, 1:44 AM
This revision was automatically updated to reflect the committed changes.