Linux添加PCF8563 RTC支持

原文链接:https://blog.csdn.net/WXXGoodJob/article/details/88692949

SOC:RK3288

kernel:Linux4.1

1. 添加驱动支持

Device Drivers  --->

     [*] Real Time Clock  --->

           [*]   Set system time from RTC on startup and resume    (自动同步时间)

           <*>   Philips PCF8563/Epson RTC8564          (CONFIG_RTC_DRV_PCF8563)

2. 添加设备树

参考文档:Documentation/devicetree/bindings/rtc/pcf8563.txt

arch/arm/boot/dts/rk3288-firefly.dtsi:

......
        rtc_pcf8563: rtc-pcf8563 {
                clocks = <&pcf8563>;
 
        };
 
        sdio_pwrseq: sdio-pwrseq {
                compatible = "mmc-pwrseq-simple";
        //      clocks = <&hym8563>;
                clock-names = "ext_clock";
                pinctrl-names = "default";
                pinctrl-0 = <&wifi_enable_h>;
 
                /*
                 * On the module itself this is one of these (depending
                 * on the actual card populated):
                 * - SDIO_RESET_L_WL_REG_ON
                 * - PDN (power down when low)
                 */
                reset-gpios = <&gpio4 28 GPIO_ACTIVE_LOW>;
        };
......
 
&i2c0 {
            pcf8563: pcf8563@51 {
                compatible = "nxp,pcf8563";
                reg = <0x51>;
                #clock-cells = <0>;
        };
 
};
......

3. 测试

3.1 date 设置时间:date 月日时分年.秒

3.2 同步时间到RTC(把系统时间写到RTC芯片):hwclock -w (write)

3.3 同步时间到系统(把RTC芯片时间写到系统时间):hwclock -s (sync)
  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值