Atlas 200外设驱动开发和调试指南_ RTC
调试基于Atlas 200 参考板驱动包进行重构调试,调试方法请参考https://support.huawei.com/enterprise/zh/doc/EDOC1100193743/3db58fa7
1 芯片型号
RTC芯片使用RX8900芯片。
2 固件烧录
是否需要固件烧录:否
3 内核配置
RTC芯片下挂在i2c总线上,通过查询RTC芯片手册,RX8900的i2c地址为0x32。
DTS配置,在源码包中的hi1910-fpga-i2c.dtsi的i2c0下增加如下配置:
rx8900: rx8900@32{
compatible = "epson,rx8900";
reg = <0x32>;
epson,vdet-disable;
trickle-diode-disable;
};
4 驱动调试
驱动获取地址:https://www5.epsondevice.com/cn/information/support/soft/rx8900_k3.8-v1.0.zip
● 驱动安装
将驱动包中的源码文件rtc-rx8900.c拷贝到内核rtc驱动源码目录下
cp -f rtc-rx8900.c source/kernel/linux-4.19/drivers/rtc/rtc-rx8900.c
修改à²vàäȍàìcȍ<cÑnfigȀ增加如下内容
cÑnfig RTC_DRV_RX8900
tristate "Epson RX8900SA/LC"
help
If you say yes here you get support for the Epson
RX8900SA/LC RTC chips.
修改à²vàäȍàìcȍMÀfiÃ
obj-$(CONFIG_RTC_DRV_RX8900) += rtc-rx8900.o
选择内核配置
Device Drivers ->
[*]Real Time Clock ->
[M]Epson RX8900SA/LC
编译内核模块后,得到驱动文件rtc-rx8900.ko
insmod rtc-rx8900.ko
驱动加载后,查看驱动加载信息
dmesg | grep rtc
root@davinci-mini:/usr/local/bluez_tools/bin# dmesg | grep rtc
[ 2.810377] hctosys: unable to open rtc device (rtc0)
[ 12.117552] rtc-rx8900 0-0032: Temperature compensation is stop detected.
[ 12.117560] rtc-rx8900 0-0032: Data loss is detected. All registers must beinitialized.
[ 12.117562] rtc-rx8900 0-0032: Update was detected
[ 12.120346] rtc-rx8900 0-0032: - time set to 1970/1/1
[ 12.122022] rtc-rx8900 0-0032: rtc core: registered rx8900 as rtc0
注意:调试过程中内核自带的rtc开源驱动不能工作。
5 测试工具
测试RX8900的读写能力,使用hwclock命令
● 获取当前时间
hwclock -r -f /dev/rtc0
如果当前时间没有设置,rtc会初始设置Jan 1, 1970.
● 设置系统时间
date -s "Thurs Nov 07 11:33:00 PDT 2013"
● 将最新时间写入时钟
hwclock -w -f /dev/rtc0
● 读时间
hwclock -w -f /dev/rtc0
Atlas 200外设驱动开发和调试指南_ RTC
调试基于Atlas 200 参考板驱动包进行重构调试,调试方法请参考https://support.huawei.com/enterprise/zh/doc/EDOC1100193743/3db58fa7
1 芯片型号
RTC芯片使用RX8900芯片。
2 固件烧录
是否需要固件烧录:否
3 内核配置
RTC芯片下挂在i2c总线上,通过查询RTC芯片手册,RX8900的i2c地址为0x32。
DTS配置,在源码包中的hi1910-fpga-i2c.dtsi的i2c0下增加如下配置:
rx8900: rx8900@32{
compatible = "epson,rx8900";
reg = <0x32>;
epson,vdet-disable;
trickle-diode-disable;
};
4 驱动调试
驱动获取地址:https://www5.epsondevice.com/cn/information/support/soft/rx8900_k3.8-v1.0.zip
● 驱动安装
将驱动包中的源码文件rtc-rx8900.c拷贝到内核rtc驱动源码目录下
cp -f rtc-rx8900.c source/kernel/linux-4.19/drivers/rtc/rtc-rx8900.c
修改à²vàäȍàìcȍ<cÑnfigȀ增加如下内容
cÑnfig RTC_DRV_RX8900
tristate "Epson RX8900SA/LC"
help
If you say yes here you get support for the Epson
RX8900SA/LC RTC chips.
修改à²vàäȍàìcȍMÀfiÃ
obj-$(CONFIG_RTC_DRV_RX8900) += rtc-rx8900.o
选择内核配置
Device Drivers ->
[*]Real Time Clock ->
[M]Epson RX8900SA/LC
编译内核模块后,得到驱动文件rtc-rx8900.ko
insmod rtc-rx8900.ko
驱动加载后,查看驱动加载信息
dmesg | grep rtc
root@davinci-mini:/usr/local/bluez_tools/bin# dmesg | grep rtc
[ 2.810377] hctosys: unable to open rtc device (rtc0)
[ 12.117552] rtc-rx8900 0-0032: Temperature compensation is stop detected.
[ 12.117560] rtc-rx8900 0-0032: Data loss is detected. All registers must beinitialized.
[ 12.117562] rtc-rx8900 0-0032: Update was detected
[ 12.120346] rtc-rx8900 0-0032: - time set to 1970/1/1
[ 12.122022] rtc-rx8900 0-0032: rtc core: registered rx8900 as rtc0
注意:调试过程中内核自带的rtc开源驱动不能工作。
5 测试工具
测试RX8900的读写能力,使用hwclock命令
● 获取当前时间
hwclock -r -f /dev/rtc0
如果当前时间没有设置,rtc会初始设置Jan 1, 1970.
● 设置系统时间
date -s "Thurs Nov 07 11:33:00 PDT 2013"
● 将最新时间写入时钟
hwclock -w -f /dev/rtc0
● 读时间
hwclock -w -f /dev/rtc0