RK3568系列7——HYM8563时钟芯片配置

  HYM8563是一个高精度低功耗的实时时钟芯片,其本身基于一个32.768kHZ的晶震,因此可以为蓝牙芯片提供一个时钟信号。由于本项目没有为RK809配备电池,而是采用一颗CR2032纽扣电池保存时钟信息,因此采用了RK推荐的HYM8563作为时钟芯片。

配置要点

  • I2C总线地址:0x51
  • 中断脚(芯片第3脚):低电平有效,默认拉高

DTS配置

  • clock-output-names:/sys/kernel/debug/clk中显示的时钟名称
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
&pinctrl {
rtc {
rtc_int: rtc-int {
rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>;
};
};
};

&i2c0 {
status = "okay";

/* Clock */
hym8563: hym8563@51 {
compatible = "haoyu,hym8563";
reg = <0x51>;

pinctrl-names = "default";
pinctrl-0 = <&rtc_int>;

interrupt-parent = <&gpio0>;
interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>;

clock-frequency = <32768>;
clock-output-names = "hym8563";
#clock-cells = <0>;
};
};

内核配置

  关闭没有用到的RK809的时钟驱动,打开HYM8563的时钟驱动。

1
2
3
4
vim kernel/kernel/configs/alpha.config

# CONFIG_RTC_DRV_RK808 is not set
CONFIG_RTC_DRV_HYM8563=y