diff options
author | Greg Ungerer <gerg@uclinux.org> | 2012-01-22 22:25:56 -0500 |
---|---|---|
committer | Greg Ungerer <gerg@uclinux.org> | 2012-03-04 18:43:03 -0500 |
commit | 9517746131f62294ddd922bcd288415be5104c23 (patch) | |
tree | 1ca5433e9d25c1c2f34197a52bfa15fdec163fac | |
parent | d3f033f894c433d3c9bf347a0a84f45dac0b14ac (diff) |
m68knommu: make persistent clock code consistent with m68k
The read_persistent_clock() code is different on m68knommu, for really no
reason. With a few changes to support function names and some code
re-organization the code can be made the same.
This will make it easier to merge the arch/m68k/kernel/time.c for m68k and
m68knommu in a future patch.
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
-rw-r--r-- | arch/m68k/include/asm/machdep.h | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/setup_no.c | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/time_no.c | 36 | ||||
-rw-r--r-- | arch/m68k/platform/68328/config.c | 5 | ||||
-rw-r--r-- | arch/m68k/platform/68328/timers.c | 18 | ||||
-rw-r--r-- | arch/m68k/platform/68360/config.c | 8 | ||||
-rw-r--r-- | arch/m68k/platform/68EZ328/config.c | 5 | ||||
-rw-r--r-- | arch/m68k/platform/68VZ328/config.c | 5 |
8 files changed, 35 insertions, 46 deletions
diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h index 789f3b2de0e9..3bfa7df35729 100644 --- a/arch/m68k/include/asm/machdep.h +++ b/arch/m68k/include/asm/machdep.h | |||
@@ -22,8 +22,6 @@ extern unsigned int (*mach_get_ss)(void); | |||
22 | extern int (*mach_get_rtc_pll)(struct rtc_pll_info *); | 22 | extern int (*mach_get_rtc_pll)(struct rtc_pll_info *); |
23 | extern int (*mach_set_rtc_pll)(struct rtc_pll_info *); | 23 | extern int (*mach_set_rtc_pll)(struct rtc_pll_info *); |
24 | extern int (*mach_set_clock_mmss)(unsigned long); | 24 | extern int (*mach_set_clock_mmss)(unsigned long); |
25 | extern void (*mach_gettod)(int *year, int *mon, int *day, int *hour, | ||
26 | int *min, int *sec); | ||
27 | extern void (*mach_reset)( void ); | 25 | extern void (*mach_reset)( void ); |
28 | extern void (*mach_halt)( void ); | 26 | extern void (*mach_halt)( void ); |
29 | extern void (*mach_power_off)( void ); | 27 | extern void (*mach_power_off)( void ); |
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c index ca3df0dc7e88..8394b56b2c72 100644 --- a/arch/m68k/kernel/setup_no.c +++ b/arch/m68k/kernel/setup_no.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/initrd.h> | 32 | #include <linux/initrd.h> |
33 | #include <linux/root_dev.h> | 33 | #include <linux/root_dev.h> |
34 | #include <linux/rtc.h> | ||
34 | 35 | ||
35 | #include <asm/setup.h> | 36 | #include <asm/setup.h> |
36 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
@@ -48,6 +49,7 @@ char __initdata command_line[COMMAND_LINE_SIZE]; | |||
48 | 49 | ||
49 | /* machine dependent timer functions */ | 50 | /* machine dependent timer functions */ |
50 | int (*mach_set_clock_mmss)(unsigned long); | 51 | int (*mach_set_clock_mmss)(unsigned long); |
52 | int (*mach_hwclk) (int, struct rtc_time*); | ||
51 | 53 | ||
52 | /* machine dependent reboot functions */ | 54 | /* machine dependent reboot functions */ |
53 | void (*mach_reset)(void); | 55 | void (*mach_reset)(void); |
diff --git a/arch/m68k/kernel/time_no.c b/arch/m68k/kernel/time_no.c index 3ef0f7768dcd..ca3b3b4d4630 100644 --- a/arch/m68k/kernel/time_no.c +++ b/arch/m68k/kernel/time_no.c | |||
@@ -20,15 +20,11 @@ | |||
20 | #include <linux/profile.h> | 20 | #include <linux/profile.h> |
21 | #include <linux/time.h> | 21 | #include <linux/time.h> |
22 | #include <linux/timex.h> | 22 | #include <linux/timex.h> |
23 | #include <linux/rtc.h> | ||
23 | 24 | ||
24 | #include <asm/machdep.h> | 25 | #include <asm/machdep.h> |
25 | #include <asm/irq_regs.h> | 26 | #include <asm/irq_regs.h> |
26 | 27 | ||
27 | #define TICK_SIZE (tick_nsec / 1000) | ||
28 | |||
29 | /* machine dependent timer functions */ | ||
30 | void (*mach_gettod)(int*, int*, int*, int*, int*, int*); | ||
31 | |||
32 | static inline int set_rtc_mmss(unsigned long nowtime) | 28 | static inline int set_rtc_mmss(unsigned long nowtime) |
33 | { | 29 | { |
34 | if (mach_set_clock_mmss) | 30 | if (mach_set_clock_mmss) |
@@ -55,28 +51,20 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) | |||
55 | } | 51 | } |
56 | #endif | 52 | #endif |
57 | 53 | ||
58 | static unsigned long read_rtc_mmss(void) | ||
59 | { | ||
60 | unsigned int year, mon, day, hour, min, sec; | ||
61 | |||
62 | if (mach_gettod) { | ||
63 | mach_gettod(&year, &mon, &day, &hour, &min, &sec); | ||
64 | if ((year += 1900) < 1970) | ||
65 | year += 100; | ||
66 | } else { | ||
67 | year = 1970; | ||
68 | mon = day = 1; | ||
69 | hour = min = sec = 0; | ||
70 | } | ||
71 | |||
72 | |||
73 | return mktime(year, mon, day, hour, min, sec); | ||
74 | } | ||
75 | |||
76 | void read_persistent_clock(struct timespec *ts) | 54 | void read_persistent_clock(struct timespec *ts) |
77 | { | 55 | { |
78 | ts->tv_sec = read_rtc_mmss(); | 56 | struct rtc_time time; |
57 | ts->tv_sec = 0; | ||
79 | ts->tv_nsec = 0; | 58 | ts->tv_nsec = 0; |
59 | |||
60 | if (mach_hwclk) { | ||
61 | mach_hwclk(0, &time); | ||
62 | |||
63 | if ((time.tm_year += 1900) < 1970) | ||
64 | time.tm_year += 100; | ||
65 | ts->tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday, | ||
66 | time.tm_hour, time.tm_min, time.tm_sec); | ||
67 | } | ||
80 | } | 68 | } |
81 | 69 | ||
82 | int update_persistent_clock(struct timespec now) | 70 | int update_persistent_clock(struct timespec now) |
diff --git a/arch/m68k/platform/68328/config.c b/arch/m68k/platform/68328/config.c index d70bf2623db1..44b866544314 100644 --- a/arch/m68k/platform/68328/config.c +++ b/arch/m68k/platform/68328/config.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/types.h> | 18 | #include <linux/types.h> |
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/rtc.h> | ||
20 | #include <asm/system.h> | 21 | #include <asm/system.h> |
21 | #include <asm/machdep.h> | 22 | #include <asm/machdep.h> |
22 | #include <asm/MC68328.h> | 23 | #include <asm/MC68328.h> |
@@ -26,7 +27,7 @@ | |||
26 | 27 | ||
27 | /***************************************************************************/ | 28 | /***************************************************************************/ |
28 | 29 | ||
29 | void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); | 30 | int m68328_hwclk(int set, struct rtc_time *t); |
30 | 31 | ||
31 | /***************************************************************************/ | 32 | /***************************************************************************/ |
32 | 33 | ||
@@ -48,7 +49,7 @@ void config_BSP(char *command, int len) | |||
48 | printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n"); | 49 | printk(KERN_INFO "68328 support Kenneth Albanowski <kjahds@kjshds.com>\n"); |
49 | printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n"); | 50 | printk(KERN_INFO "68328/Pilot support Bernhard Kuhn <kuhn@lpr.e-technik.tu-muenchen.de>\n"); |
50 | 51 | ||
51 | mach_gettod = m68328_timer_gettod; | 52 | mach_hwclk = m68328_hwclk; |
52 | mach_reset = m68328_reset; | 53 | mach_reset = m68328_reset; |
53 | } | 54 | } |
54 | 55 | ||
diff --git a/arch/m68k/platform/68328/timers.c b/arch/m68k/platform/68328/timers.c index f2678866067b..b15ddef1ec76 100644 --- a/arch/m68k/platform/68328/timers.c +++ b/arch/m68k/platform/68328/timers.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/irq.h> | 21 | #include <linux/irq.h> |
22 | #include <linux/clocksource.h> | 22 | #include <linux/clocksource.h> |
23 | #include <linux/rtc.h> | ||
23 | #include <asm/setup.h> | 24 | #include <asm/setup.h> |
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
25 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
@@ -119,14 +120,17 @@ void hw_timer_init(void) | |||
119 | 120 | ||
120 | /***************************************************************************/ | 121 | /***************************************************************************/ |
121 | 122 | ||
122 | void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec) | 123 | int m68328_hwclk(int set, struct rtc_time *t) |
123 | { | 124 | { |
124 | long now = RTCTIME; | 125 | if (!set) { |
125 | 126 | long now = RTCTIME; | |
126 | *year = *mon = *day = 1; | 127 | t->tm_year = t->tm_mon = t->tm_mday = 1; |
127 | *hour = (now >> 24) % 24; | 128 | t->tm_hour = (now >> 24) % 24; |
128 | *min = (now >> 16) % 60; | 129 | t->tm_min = (now >> 16) % 60; |
129 | *sec = now % 60; | 130 | t->tm_sec = now % 60; |
131 | } | ||
132 | |||
133 | return 0; | ||
130 | } | 134 | } |
131 | 135 | ||
132 | /***************************************************************************/ | 136 | /***************************************************************************/ |
diff --git a/arch/m68k/platform/68360/config.c b/arch/m68k/platform/68360/config.c index 9dd5bca38749..599a5949f320 100644 --- a/arch/m68k/platform/68360/config.c +++ b/arch/m68k/platform/68360/config.c | |||
@@ -103,11 +103,6 @@ void hw_timer_init(void) | |||
103 | pquicc->timer_tgcr = tgcr_save; | 103 | pquicc->timer_tgcr = tgcr_save; |
104 | } | 104 | } |
105 | 105 | ||
106 | void BSP_gettod (int *yearp, int *monp, int *dayp, | ||
107 | int *hourp, int *minp, int *secp) | ||
108 | { | ||
109 | } | ||
110 | |||
111 | int BSP_set_clock_mmss(unsigned long nowtime) | 106 | int BSP_set_clock_mmss(unsigned long nowtime) |
112 | { | 107 | { |
113 | #if 0 | 108 | #if 0 |
@@ -181,6 +176,5 @@ void config_BSP(char *command, int len) | |||
181 | scc1_hwaddr = "\00\01\02\03\04\05"; | 176 | scc1_hwaddr = "\00\01\02\03\04\05"; |
182 | #endif | 177 | #endif |
183 | 178 | ||
184 | mach_gettod = BSP_gettod; | 179 | mach_reset = BSP_reset; |
185 | mach_reset = BSP_reset; | ||
186 | } | 180 | } |
diff --git a/arch/m68k/platform/68EZ328/config.c b/arch/m68k/platform/68EZ328/config.c index 1be1a16f6896..dd2c53554341 100644 --- a/arch/m68k/platform/68EZ328/config.c +++ b/arch/m68k/platform/68EZ328/config.c | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
18 | #include <linux/rtc.h> | ||
18 | #include <asm/system.h> | 19 | #include <asm/system.h> |
19 | #include <asm/pgtable.h> | 20 | #include <asm/pgtable.h> |
20 | #include <asm/machdep.h> | 21 | #include <asm/machdep.h> |
@@ -25,7 +26,7 @@ | |||
25 | 26 | ||
26 | /***************************************************************************/ | 27 | /***************************************************************************/ |
27 | 28 | ||
28 | void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); | 29 | int m68328_hwclk(int set, struct rtc_time *t); |
29 | 30 | ||
30 | /***************************************************************************/ | 31 | /***************************************************************************/ |
31 | 32 | ||
@@ -69,7 +70,7 @@ void config_BSP(char *command, int len) | |||
69 | else command[0] = 0; | 70 | else command[0] = 0; |
70 | #endif | 71 | #endif |
71 | 72 | ||
72 | mach_gettod = m68328_timer_gettod; | 73 | mach_hwclk = m68328_hwclk; |
73 | mach_reset = m68ez328_reset; | 74 | mach_reset = m68ez328_reset; |
74 | } | 75 | } |
75 | 76 | ||
diff --git a/arch/m68k/platform/68VZ328/config.c b/arch/m68k/platform/68VZ328/config.c index eabaabe8af36..25ec673edc25 100644 --- a/arch/m68k/platform/68VZ328/config.c +++ b/arch/m68k/platform/68VZ328/config.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/irq.h> | 22 | #include <linux/irq.h> |
23 | #include <linux/rtc.h> | ||
23 | 24 | ||
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
25 | #include <asm/pgtable.h> | 26 | #include <asm/pgtable.h> |
@@ -33,7 +34,7 @@ | |||
33 | 34 | ||
34 | /***************************************************************************/ | 35 | /***************************************************************************/ |
35 | 36 | ||
36 | void m68328_timer_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); | 37 | int m68328_hwclk(int set, struct rtc_time *t); |
37 | 38 | ||
38 | /***************************************************************************/ | 39 | /***************************************************************************/ |
39 | /* Init Drangon Engine hardware */ | 40 | /* Init Drangon Engine hardware */ |
@@ -181,7 +182,7 @@ void config_BSP(char *command, int size) | |||
181 | 182 | ||
182 | init_hardware(command, size); | 183 | init_hardware(command, size); |
183 | 184 | ||
184 | mach_gettod = m68328_timer_gettod; | 185 | mach_hwclk = m68328_hwclk; |
185 | mach_reset = m68vz328_reset; | 186 | mach_reset = m68vz328_reset; |
186 | } | 187 | } |
187 | 188 | ||