patch-2.4.21 linux-2.4.21/arch/m68k/q40/config.c
Next file: linux-2.4.21/arch/m68k/q40/q40ints.c
Previous file: linux-2.4.21/arch/m68k/mvme16x/rtc.c
Back to the patch index
Back to the overall index
- Lines: 67
- Date:
2003-06-13 07:51:31.000000000 -0700
- Orig file:
linux-2.4.20/arch/m68k/q40/config.c
- Orig date:
2002-11-28 15:53:09.000000000 -0800
diff -urN linux-2.4.20/arch/m68k/q40/config.c linux-2.4.21/arch/m68k/q40/config.c
@@ -58,7 +58,10 @@
extern void q40_gettod (int *year, int *mon, int *day, int *hour,
int *min, int *sec);
extern int q40_hwclk (int, struct rtc_time *);
+extern unsigned int q40_get_ss (void);
extern int q40_set_clock_mmss (unsigned long);
+static int q40_get_rtc_pll(struct rtc_pll_info *pll);
+static int q40_set_rtc_pll(struct rtc_pll_info *pll);
extern void q40_reset (void);
void q40_halt(void);
extern void q40_waitbut(void);
@@ -196,6 +199,9 @@
mach_gettimeoffset = q40_gettimeoffset;
mach_gettod = q40_gettod;
mach_hwclk = q40_hwclk;
+ mach_get_ss = q40_get_ss;
+ mach_get_rtc_pll = q40_get_rtc_pll;
+ mach_set_rtc_pll = q40_set_rtc_pll;
mach_set_clock_mmss = q40_set_clock_mmss;
mach_reset = q40_reset;
@@ -331,6 +337,11 @@
return 0;
}
+unsigned int q40_get_ss()
+{
+ return bcd2bin(Q40_RTC_SECS);
+}
+
/*
* Set the minutes and seconds from seconds value 'nowtime'. Fail if
* clock is out by > 30 minutes. Logic lifted from atari code.
@@ -362,3 +373,33 @@
return retval;
}
+
+/* get and set PLL calibration of RTC clock */
+#define Q40_RTC_PLL_MASK ((1<<5)-1)
+#define Q40_RTC_PLL_SIGN (1<<5)
+
+static int q40_get_rtc_pll(struct rtc_pll_info *pll)
+{
+ int tmp=Q40_RTC_CTRL;
+ pll->pll_value = tmp & Q40_RTC_PLL_MASK;
+ if (tmp & Q40_RTC_PLL_SIGN)
+ pll->pll_value = -pll->pll_value;
+ pll->pll_max=31;
+ pll->pll_min=-31;
+ pll->pll_posmult=512;
+ pll->pll_negmult=256;
+ pll->pll_clock=125829120;
+ return 0;
+ }
+
+static int q40_set_rtc_pll(struct rtc_pll_info *pll)
+{
+ if (!pll->pll_ctrl){
+ /* the docs are a bit unclear so I am doublesetting RTC_WRITE here ... */
+ int tmp=(pll->pll_value & 31) | (pll->pll_value<0 ? 32 : 0) | Q40_RTC_WRITE;
+ Q40_RTC_CTRL |= Q40_RTC_WRITE;
+ Q40_RTC_CTRL = tmp;
+ Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
+ return 0;
+ } else return -EINVAL;
+}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)