This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

rtc-ds1307 with i2c

hi all

my rtc hw is ds1307z, my kernel is Linux-2.6.18_pro500, i make menuconfig ,and configruing ds1307. then ,how can i read/wirte ds1307 with i2c?

my test:

# hwclock -r
hwclock: Could not access RTC: No such file or directory

# cat /proc/devices |grep rtc
254 rtc

#mknod /dev/rtc0 c 254 0

# ls /dev/rtc* -lh
lrwxrwxrwx    1 root     root            9 Jan  1 00:00 /dev/rtc -> /dev/rtc0
crw-r--r--    1 root     root     254,   0 Jan  1 00:00 /dev/rtc0

# hwclock -r
hwclock: Could not access RTC: No such file or directory

how can i working ds1307 normal with i2c?

  • You probably have to add an I2C platform device. Hopefully your board init file has the i2c driver configured and all you have to do is add your RTC device to the list. It is unlikely that someone is using your exact version of Linux and exact platform. So you will probably have to dig around the code yourself.