} else { en为1是执行。表示开启RTC,就不具体讲了主要是先读出寄存器值进行判断,然后如果有需要在从读并回写。对这芯片手册,很简单。
/* re-enable the device, and check it is ok */
if ((readw(base+S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){
dev_info(&pdev->dev, "rtc disabled, re-enabling\n");
tmp = readw(base + S3C2410_RTCCON);
writew(tmp|S3C2410_RTCCON_RTCEN, base+S3C2410_RTCCON);
}
if ((readw(base + S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){
dev_info(&pdev->dev, "removing RTCCON_CNTSEL\n");
tmp = readw(base + S3C2410_RTCCON);
writew(tmp& ~S3C2410_RTCCON_CNTSEL, base+S3C2410_RTCCON);
}
if ((readw(base + S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){
dev_info(&pdev->dev, "removing RTCCON_CLKRST\n");
tmp = readw(base + S3C2410_RTCCON);
writew(tmp & ~S3C2410_RTCCON_CLKRST, base+S3C2410_RTCCON);
}
}
}
S3C6410的RTC在Linux中的驱动(2)
内容版权声明:除非注明,否则皆为本站原创文章。