|
@@ -382,25 +382,25 @@ static const struct rtc_class_ops s3c_rtcops = {
|
|
|
|
|
|
static void s3c_rtc_enable(struct s3c_rtc *info, int en)
|
|
|
{
|
|
|
- unsigned int tmp;
|
|
|
+ unsigned int con, tmp;
|
|
|
|
|
|
clk_enable(info->rtc_clk);
|
|
|
+
|
|
|
+ con = readw(info->base + S3C2410_RTCCON);
|
|
|
if (!en) {
|
|
|
- tmp = readw(info->base + S3C2410_RTCCON);
|
|
|
if (info->cpu_type == TYPE_S3C64XX)
|
|
|
- tmp &= ~S3C64XX_RTCCON_TICEN;
|
|
|
- tmp &= ~S3C2410_RTCCON_RTCEN;
|
|
|
- writew(tmp, info->base + S3C2410_RTCCON);
|
|
|
+ con &= ~S3C64XX_RTCCON_TICEN;
|
|
|
+ con &= ~S3C2410_RTCCON_RTCEN;
|
|
|
+ writew(con, info->base + S3C2410_RTCCON);
|
|
|
|
|
|
if (info->cpu_type != TYPE_S3C64XX) {
|
|
|
- tmp = readb(info->base + S3C2410_TICNT);
|
|
|
- tmp &= ~S3C2410_TICNT_ENABLE;
|
|
|
- writeb(tmp, info->base + S3C2410_TICNT);
|
|
|
+ con = readb(info->base + S3C2410_TICNT);
|
|
|
+ con &= ~S3C2410_TICNT_ENABLE;
|
|
|
+ writeb(con, info->base + S3C2410_TICNT);
|
|
|
}
|
|
|
} else {
|
|
|
/* re-enable the device, and check it is ok */
|
|
|
-
|
|
|
- if ((readw(info->base + S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0) {
|
|
|
+ if ((con & S3C2410_RTCCON_RTCEN) == 0) {
|
|
|
dev_info(info->dev, "rtc disabled, re-enabling\n");
|
|
|
|
|
|
tmp = readw(info->base + S3C2410_RTCCON);
|
|
@@ -408,7 +408,7 @@ static void s3c_rtc_enable(struct s3c_rtc *info, int en)
|
|
|
info->base + S3C2410_RTCCON);
|
|
|
}
|
|
|
|
|
|
- if ((readw(info->base + S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)) {
|
|
|
+ if (con & S3C2410_RTCCON_CNTSEL) {
|
|
|
dev_info(info->dev, "removing RTCCON_CNTSEL\n");
|
|
|
|
|
|
tmp = readw(info->base + S3C2410_RTCCON);
|
|
@@ -416,7 +416,7 @@ static void s3c_rtc_enable(struct s3c_rtc *info, int en)
|
|
|
info->base + S3C2410_RTCCON);
|
|
|
}
|
|
|
|
|
|
- if ((readw(info->base + S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)) {
|
|
|
+ if (con & S3C2410_RTCCON_CLKRST) {
|
|
|
dev_info(info->dev, "removing RTCCON_CLKRST\n");
|
|
|
|
|
|
tmp = readw(info->base + S3C2410_RTCCON);
|
|
@@ -445,8 +445,10 @@ static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
|
|
|
{
|
|
|
#ifdef CONFIG_OF
|
|
|
struct s3c_rtc_drv_data *data;
|
|
|
+
|
|
|
if (pdev->dev.of_node) {
|
|
|
const struct of_device_id *match;
|
|
|
+
|
|
|
match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
|
|
|
data = (struct s3c_rtc_drv_data *) match->data;
|
|
|
return data->cpu_type;
|