All of lore.kernel.org
 help / color / mirror / Atom feed
* rtc_rv8803.ko does not create a /dev/rtc?
@ 2021-07-01 12:50  
  2021-07-02 13:08 ` Nobuhiro Iwamatsu
  0 siblings, 1 reply; 3+ messages in thread
From:   @ 2021-07-01 12:50 UTC (permalink / raw)
  To: linux-rtc

­Hi all,

I have a raspberry pi 3B, running kernel 5.10.17. On the i2c bus, I've added a rx8900 rtc chip. I would like to use this chip, but I fail to create a /dev/rtc for it.

I have checked the kernel version:
# uname -a
Linux raspberrypi 5.10.17-v7+ #1421 SMP Thu May 27 13:59:01 BST 2021 armv7l GNU/Linux

I've downloaded the rtc driver for this version of the kernel from here:
https://github.com/raspberrypi/linux/blob/rpi-5.10.y/drivers/rtc/rtc-rv8803.c

And compiled the driver with this makefile [1, see below] and installed the resulting rtc-rv8803.ko here:

$ modinfo /usr/lib/modules/5.10.17-v7+/kernel/drivers/rtc/rtc-rv8803.ko 
filename:       /usr/lib/modules/5.10.17-v7+/kernel/drivers/rtc/rtc-rv8803.ko
license:        GPL v2
description:    Micro Crystal RV8803 RTC driver
author:         Alexandre Belloni <alexandre.belloni@bootlin.com>
srcversion:     0067552CB786360DEA9CADB
alias:          i2c:rx8900
alias:          i2c:rx8803
alias:          i2c:rv8803
alias:          of:N*T*Cepson,rx8900C*
alias:          of:N*T*Cepson,rx8900
alias:          of:N*T*Cepson,rx8803C*
alias:          of:N*T*Cepson,rx8803
alias:          of:N*T*Cmicrocrystal,rv8803C*
alias:          of:N*T*Cmicrocrystal,rv8803
depends:        
name:           rtc_rv8803
vermagic:       5.10.17-v7+ SMP mod_unload modversions ARMv7 p2v8 

Next I do the following steps to load the module:
# modprobe i2c:rx8900
[  130.591843] rtc_rv8803: loading out-of-tree module taints kernel.

The module is loaded:
# lsmod
Module                  Size  Used by
rtc_rv8803             16384  0

Next I bind the driver to the i2c address 0x32:
# echo i2c:rx8900 0x32 > /sys/class/i2c-adapter/i2c-1/new_device
[  176.871589] i2c i2c-1: new_device: Instantiated device i2c:rx8900 at 0x32

This does not give me a /dev/rtc device:
# ls /dev/rtc*
ls: cannot access '/dev/rtc*': No such file or directory

The rtc is detected at address 0x32, but it's not claimed by any driver (that would have been indicated by UU instead of 32).
# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 
30: -- -- 32 -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- 49 4a -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

What did I miss?

Kind regards,
Cedric

[1] 
$ cat Makefile
RV8803_DIR = $(shell pwd)
KSRC = /lib/modules/$(KVER)/build
KVER = $(shell uname -r)
MODDESTDIR = /lib/modules/$(KVER)/kernel/drivers/rtc

CROSS_COMPILE    =

AS              = $(CROSS_COMPILE)as
LD              = $(CROSS_COMPILE)ld
CC              = $(CROSS_COMPILE)gcc
CPP             = $(CC) -E
AR              = $(CROSS_COMPILE)ar
NM              = $(CROSS_COMPILE)nm
STRIP           = $(CROSS_COMPILE)strip
OBJCOPY         = $(CROSS_COMPILE)objcopy
OBJDUMP         = $(CROSS_COMPILE)objdump
DEPMOD          = /sbin/depmod
INSTALL            = /usr/bin/install
GREP            = /bin/grep

obj-m += rtc-rv8803.o

all:
    modules

modules:
    $(MAKE) -C $(KSRC) M=$(RV8803_DIR) CC=$(CC) modules

install: modules
    @$(GREP) rtc-rv8803.ko /lib/modules/$(shell uname -r)/modules.dep && rm -fr $(MODDESTDIR)/rtc-rv8803.ko || echo "No system rtc-rv8803.ko file found. Install the new rtc-rv8803.ko driver into the system"
    $(INSTALL) -p -m 644 rtc-rv8803.ko $(MODDESTDIR)
    @$(DEPMOD) -a
    
uninstall:
    @$(GREP) rtc-rv8803.ko /lib/modules/$(shell uname -r)/modules.dep && rm -fr $(MODDESTDIR)/rtc-rv8803.ko || echo "Remove the rtc-rv8803.ko driver from the system"
    @$(DEPMOD) -a
    
clean:
________________________________________________________
Ihr Recht auf Privatsphäre. Schützen Sie Ihre Daten und wechseln jetzt zu eclipso Mail & Cloud - https://www.eclipso.de



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: rtc_rv8803.ko does not create a /dev/rtc?
  2021-07-01 12:50 rtc_rv8803.ko does not create a /dev/rtc?  
@ 2021-07-02 13:08 ` Nobuhiro Iwamatsu
       [not found]   ` <e565b6503bfcf0dcd704e2959640aee5@mail.eclipso.de>
  0 siblings, 1 reply; 3+ messages in thread
From: Nobuhiro Iwamatsu @ 2021-07-02 13:08 UTC (permalink / raw)
  To: Cedric.dewijs; +Cc: linux-rtc

Hi,

2021年7月1日(木) 21:50 <Cedric.dewijs@eclipso.eu>:
>
> ­Hi all,
>
> I have a raspberry pi 3B, running kernel 5.10.17. On the i2c bus, I've added a rx8900 rtc chip. I would like to use this chip, but I fail to create a /dev/rtc for it.
>
> I have checked the kernel version:
> # uname -a
> Linux raspberrypi 5.10.17-v7+ #1421 SMP Thu May 27 13:59:01 BST 2021 armv7l GNU/Linux
>
> I've downloaded the rtc driver for this version of the kernel from here:
> https://github.com/raspberrypi/linux/blob/rpi-5.10.y/drivers/rtc/rtc-rv8803.c
>
> And compiled the driver with this makefile [1, see below] and installed the resulting rtc-rv8803.ko here:
>
> $ modinfo /usr/lib/modules/5.10.17-v7+/kernel/drivers/rtc/rtc-rv8803.ko
> filename:       /usr/lib/modules/5.10.17-v7+/kernel/drivers/rtc/rtc-rv8803.ko
> license:        GPL v2
> description:    Micro Crystal RV8803 RTC driver
> author:         Alexandre Belloni <alexandre.belloni@bootlin.com>
> srcversion:     0067552CB786360DEA9CADB
> alias:          i2c:rx8900
> alias:          i2c:rx8803
> alias:          i2c:rv8803
> alias:          of:N*T*Cepson,rx8900C*
> alias:          of:N*T*Cepson,rx8900
> alias:          of:N*T*Cepson,rx8803C*
> alias:          of:N*T*Cepson,rx8803
> alias:          of:N*T*Cmicrocrystal,rv8803C*
> alias:          of:N*T*Cmicrocrystal,rv8803
> depends:
> name:           rtc_rv8803
> vermagic:       5.10.17-v7+ SMP mod_unload modversions ARMv7 p2v8
>
> Next I do the following steps to load the module:
> # modprobe i2c:rx8900
> [  130.591843] rtc_rv8803: loading out-of-tree module taints kernel.

This is not necessary if the module is installed correctly.
The module will be loaded when you write to '/sys/class/
i2c-adapter/i2c-1/new_device' below.

>
> The module is loaded:
> # lsmod
> Module                  Size  Used by
> rtc_rv8803             16384  0
>
> Next I bind the driver to the i2c address 0x32:
> # echo i2c:rx8900 0x32 > /sys/class/i2c-adapter/i2c-1/new_device

I think ' i2c' is unnecessary.
Please check with following:
  echo rx8900 0x32 > /sys/class/i2c-adapter/i2c-1/new_device

> [  176.871589] i2c i2c-1: new_device: Instantiated device i2c:rx8900 at 0x32
>
> This does not give me a /dev/rtc device:
> # ls /dev/rtc*
> ls: cannot access '/dev/rtc*': No such file or directory
>
> The rtc is detected at address 0x32, but it's not claimed by any driver (that would have been indicated by UU instead of 32).
> # i2cdetect -y 1
>      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> 00:          -- -- -- -- -- -- -- -- -- -- -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- --
> 30: -- -- 32 -- -- -- -- -- -- -- -- -- -- -- -- --
> 40: -- -- -- -- -- -- -- -- -- 49 4a -- -- -- -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
> 70: -- -- -- -- -- -- -- --
>
> What did I miss?
>
> Kind regards,
> Cedric

Best regards,
  Nobuhiro

-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org / kernel.org}
   GPG ID: 40AD1FA6

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fwd: Re: rtc_rv8803.ko does not create a /dev/rtc?
       [not found]   ` <e565b6503bfcf0dcd704e2959640aee5@mail.eclipso.de>
@ 2021-07-05  6:56     `  
  0 siblings, 0 replies; 3+ messages in thread
From:   @ 2021-07-05  6:56 UTC (permalink / raw)
  To: Cedric.dewijs, iwamatsu, linux-rtc@vger.kernel.org>


--- Ursprüngliche Nachricht ---
Von: " " <Cedric.dewijs@eclipso.eu>
Datum: 05.07.2021 06:32:30
An: <cedric.dewijs@eclipso.eu>
Betreff: Fwd: Re: rtc_rv8803.ko does not create a /dev/rtc?

--- Ursprüngliche Nachricht ---
Von: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Datum: 02.07.2021 15:08:38
An: Cedric.dewijs@eclipso.eu
Betreff: Re: rtc_rv8803.ko does not create a /dev/rtc?

Hi,

2021年7月1日(木) 21:50 <Cedric.dewijs@eclipso.eu>:
>
> ­Hi all,
>
> I have a raspberry pi 3B, running kernel 5.10.17. On the i2c bus, I've

added a rx8900 rtc chip. I would like to use this chip, but I fail to create

a /dev/rtc for it.
>
> I have checked the kernel version:
> # uname -a
> Linux raspberrypi 5.10.17-v7+ #1421 SMP Thu May 27 13:59:01 BST 2021

armv7l GNU/Linux
>
> I've downloaded the rtc driver for this version of the kernel from here:


> https://github.com/raspberrypi/linux/blob/rpi-5.10.y/drivers/rtc/rtc-rv8803.c


>
> And compiled the driver with this makefile [1, see below] and installed

the resulting rtc-rv8803.ko here:
>
> $ modinfo /usr/lib/modules/5.10.17-v7+/kernel/drivers/rtc/rtc-rv8803.ko


> filename:       /usr/lib/modules/5.10.17-v7+/kernel/drivers/rtc/rtc-rv8803.ko


> license:        GPL v2
> description:    Micro Crystal RV8803 RTC driver
> author:         Alexandre Belloni <alexandre.belloni@bootlin.com>


> srcversion:     0067552CB786360DEA9CADB
> alias:          i2c:rx8900
> alias:          i2c:rx8803
> alias:          i2c:rv8803
> alias:          of:N*T*Cepson,rx8900C*
> alias:          of:N*T*Cepson,rx8900
> alias:          of:N*T*Cepson,rx8803C*
> alias:          of:N*T*Cepson,rx8803
> alias:          of:N*T*Cmicrocrystal,rv8803C*
> alias:          of:N*T*Cmicrocrystal,rv8803
> depends:
> name:           rtc_rv8803
> vermagic:       5.10.17-v7+ SMP mod_unload modversions ARMv7 p2v8
>
> Next I do the following steps to load the module:
> # modprobe i2c:rx8900
> [  130.591843] rtc_rv8803: loading out-of-tree module taints kernel.



This is not necessary if the module is installed correctly.
The module will be loaded when you write to '/sys/class/
i2c-adapter/i2c-1/new_device' below.

>
> The module is loaded:
> # lsmod
> Module                  Size  Used by
> rtc_rv8803             16384  0
>
> Next I bind the driver to the i2c address 0x32:
> # echo i2c:rx8900 0x32 > /sys/class/i2c-adapter/i2c-1/new_device



I think ' i2c' is unnecessary.
Please check with following:
  echo rx8900 0x32 > /sys/class/i2c-adapter/i2c-1/new_device

> [  176.871589] i2c i2c-1: new_device: Instantiated device i2c:rx8900

at 0x32
>
> This does not give me a /dev/rtc device:
> # ls /dev/rtc*
> ls: cannot access '/dev/rtc*': No such file or directory
>
> The rtc is detected at address 0x32, but it's not claimed by any driver

(that would have been indicated by UU instead of 32).
> # i2cdetect -y 1
>      0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
> 00:          -- -- -- -- -- -- -- -- -- -- -- -- --
> 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- --
> 30: -- -- 32 -- -- -- -- -- -- -- -- -- -- -- -- --
> 40: -- -- -- -- -- -- -- -- -- 49 4a -- -- -- -- --
> 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
> 70: -- -- -- -- -- -- -- --
>
> What did I miss?
>
> Kind regards,
> Cedric

Best regards,
  Nobuhiro


Hi, it worked:
pi@raspberrypi:~ $ sudo -i
root@raspberrypi:~# echo rx8900 0x32 > /sys/class/i2c-adapter/i2c-1/new_device

Jul  1 17:17:32 raspberrypi kernel: i2c i2c-1: new_device: Instantiated device rx8900 at 0x32
Jul  1 17:17:32 raspberrypi kernel: rtc_rv8803: loading out-of-tree module taints kernel.
Jul  1 17:17:32 raspberrypi kernel: rtc-rv8803 1-0032: Voltage low, temperature compensation stopped.
Jul  1 17:17:32 raspberrypi kernel: rtc-rv8803 1-0032: Voltage low, data loss detected.
Jul  1 17:17:32 raspberrypi kernel: rtc-rv8803 1-0032: An alarm maybe have been missed.
Jul  1 17:17:32 raspberrypi kernel: rtc-rv8803 1-0032: Voltage low, data is invalid.
Jul  1 17:17:32 raspberrypi kernel: rtc-rv8803 1-0032: registered as rtc0
Jul  1 17:21:02 raspberrypi dhcpcd[430]: wlan0: hardware address 00:00:00:00:00:00 claims 10.93.128.58
root@raspberrypi:~# ls -l /dev/rtc0 
crw------- 1 root root 252, 0 Jul  1 17:17 /dev/rtc0


root@raspberrypi:~# i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- -- 
30: -- -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- 49 4a -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

root@raspberrypi:~# hwclock -w
root@raspberrypi:~# hwclock -r
2021-07-01 17:29:37.223549+02:00
root@raspberrypi:~# hwclock -r
2021-07-01 17:29:49.788067+02:00

Thank you,
Cedric



________________________________________________________
Ihr Recht auf Privatsphäre. Schützen Sie Ihre Daten und wechseln jetzt zu eclipso Mail & Cloud - https://www.eclipso.de



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-05  6:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-01 12:50 rtc_rv8803.ko does not create a /dev/rtc?  
2021-07-02 13:08 ` Nobuhiro Iwamatsu
     [not found]   ` <e565b6503bfcf0dcd704e2959640aee5@mail.eclipso.de>
2021-07-05  6:56     ` Fwd: "  

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.