Bug 1707139

Summary: DS3231 RTC Module doesn't work properly
Product: [Fedora] Fedora Reporter: Mikhail <midnighterdev>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: airlied, ajax, bskeggs, hdegoede, ichavero, itamar, jarodwilson, jaromir.capik, jeremy, jglisse, john.j5live, jonathan, josef, kernel-maint, linville, masami256, mchehab, miminar, mjg59, pbrobinson, steved
Target Milestone: ---   
Target Release: ---   
Hardware: armhfp   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-06-12 15:24:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 245418    

Description Mikhail 2019-05-06 21:28:23 UTC
Description of problem:
I have DS3231 RTC Module that works fine under centos arm arch, but under Fedora arm arch I can't get current date and time from this hardware RTC clock

Version-Release number of selected component (if applicable):
last updates

Steps to Reproduce:
1. connect DS3231 RTC to Raspberry Pi 3 
2. add options to file /boot/efi/config.txt
dtparam=i2c_arm=on
dtoverlay=upstream,i2c-rtc,ds3231
3. create file
echo -e "i2c-dev" >> /etc/modules-load.d/i2c.conf
4. dnf -y install i2c-tools && reboot

Actual results:
dmesg shows
hctosys: unable to open rtc device (rtc0)

sudo hwclock -r
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --verbose option to see the details of our search for an access method.


Expected results:
hwclock have to get actual time from hardwate RTC


Additional info:

sudo hwclock -r --verbose
hwclock из util-linux 2.33.2
System Time: 1557177406.430509
Trying to open: /dev/rtc0
Trying to open: /dev/rtc
Trying to open: /dev/misc/rtc
hwclock: Cannot access the Hardware Clock via any known method.

Comment 1 Mikhail 2019-06-08 08:52:09 UTC
I've fixed my problem. I added new systemd unit

cat >> /lib/systemd/system/ebb_hwclock.service

[Unit]
Description=EBB RTC Service
Before=getty.target

[Service]
Type=oneshot
ExecStartPre=/bin/sh -c "/bin/echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device"
ExecStart=/sbin/hwclock -s -f /dev/rtc1
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target



Then enable new unit and reboot system

sudo systemctl enable ebb_hwclock
sudo reboot

Comment 2 Peter Robinson 2020-04-14 07:36:18 UTC
This is nothing to do with i2c-tools.

Comment 3 Peter Robinson 2021-06-12 15:24:11 UTC
There's documentation on how to use HATs with Fedora here: https://fedoraproject.org/w/index.php?title=Architectures/ARM/Raspberry_Pi/HATs

The hw clock support was improved in F-34.