diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2007-02-28 10:40:21 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-03-04 14:02:34 -0500 |
commit | a0574e04807608998d4d115c07b7bc12bb499a44 (patch) | |
tree | 41995893f58885097144c6d6908efa3bd4f7f735 /arch/mips/tx4927/toshiba_rbtx4927 | |
parent | 148171b2ac1fb6a1a9f987f8daedc146c810a8ae (diff) |
[MIPS] Convert to RTC-class ds1742 driver
The generic rtc-ds1742 driver can be used for RBTX4927 and JMR3927
(with __swizzle_addr trick). This patch also removes MIPS local
DS1742 stuff.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/tx4927/toshiba_rbtx4927')
-rw-r--r-- | arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c | 3 | ||||
-rw-r--r-- | arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | 76 |
2 files changed, 15 insertions, 64 deletions
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c index dcce88f403c9..5cc30c10e746 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c | |||
@@ -132,9 +132,6 @@ JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthB | |||
132 | #include <asm/wbflush.h> | 132 | #include <asm/wbflush.h> |
133 | #include <linux/bootmem.h> | 133 | #include <linux/bootmem.h> |
134 | #include <linux/blkdev.h> | 134 | #include <linux/blkdev.h> |
135 | #ifdef CONFIG_RTC_DS1742 | ||
136 | #include <linux/ds1742rtc.h> | ||
137 | #endif | ||
138 | #ifdef CONFIG_TOSHIBA_FPCIB0 | 135 | #ifdef CONFIG_TOSHIBA_FPCIB0 |
139 | #include <asm/tx4927/smsc_fdc37m81x.h> | 136 | #include <asm/tx4927/smsc_fdc37m81x.h> |
140 | #endif | 137 | #endif |
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c index 7316a78fdd68..0f7576dfd141 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/pci.h> | 53 | #include <linux/pci.h> |
54 | #include <linux/timex.h> | 54 | #include <linux/timex.h> |
55 | #include <linux/pm.h> | 55 | #include <linux/pm.h> |
56 | #include <linux/platform_device.h> | ||
56 | 57 | ||
57 | #include <asm/bootinfo.h> | 58 | #include <asm/bootinfo.h> |
58 | #include <asm/page.h> | 59 | #include <asm/page.h> |
@@ -64,9 +65,6 @@ | |||
64 | #include <asm/time.h> | 65 | #include <asm/time.h> |
65 | #include <linux/bootmem.h> | 66 | #include <linux/bootmem.h> |
66 | #include <linux/blkdev.h> | 67 | #include <linux/blkdev.h> |
67 | #ifdef CONFIG_RTC_DS1742 | ||
68 | #include <linux/ds1742rtc.h> | ||
69 | #endif | ||
70 | #ifdef CONFIG_TOSHIBA_FPCIB0 | 68 | #ifdef CONFIG_TOSHIBA_FPCIB0 |
71 | #include <asm/tx4927/smsc_fdc37m81x.h> | 69 | #include <asm/tx4927/smsc_fdc37m81x.h> |
72 | #endif | 70 | #endif |
@@ -1020,69 +1018,12 @@ void __init toshiba_rbtx4927_setup(void) | |||
1020 | "+\n"); | 1018 | "+\n"); |
1021 | } | 1019 | } |
1022 | 1020 | ||
1023 | #ifdef CONFIG_RTC_DS1742 | ||
1024 | extern unsigned long rtc_ds1742_get_time(void); | ||
1025 | extern int rtc_ds1742_set_time(unsigned long); | ||
1026 | extern void rtc_ds1742_wait(void); | ||
1027 | #endif | ||
1028 | |||
1029 | void __init | 1021 | void __init |
1030 | toshiba_rbtx4927_time_init(void) | 1022 | toshiba_rbtx4927_time_init(void) |
1031 | { | 1023 | { |
1032 | u32 c1; | ||
1033 | u32 c2; | ||
1034 | |||
1035 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n"); | 1024 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n"); |
1036 | 1025 | ||
1037 | #ifdef CONFIG_RTC_DS1742 | 1026 | mips_hpt_frequency = tx4927_cpu_clock / 2; |
1038 | |||
1039 | rtc_mips_get_time = rtc_ds1742_get_time; | ||
1040 | rtc_mips_set_time = rtc_ds1742_set_time; | ||
1041 | |||
1042 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1043 | ":rtc_ds1742_init()-\n"); | ||
1044 | rtc_ds1742_init(0xbc010000); | ||
1045 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1046 | ":rtc_ds1742_init()+\n"); | ||
1047 | |||
1048 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1049 | ":Calibrate mips_hpt_frequency-\n"); | ||
1050 | rtc_ds1742_wait(); | ||
1051 | |||
1052 | /* get the count */ | ||
1053 | c1 = read_c0_count(); | ||
1054 | |||
1055 | /* wait for the seconds to change again */ | ||
1056 | rtc_ds1742_wait(); | ||
1057 | |||
1058 | /* get the count again */ | ||
1059 | c2 = read_c0_count(); | ||
1060 | |||
1061 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1062 | ":Calibrate mips_hpt_frequency+\n"); | ||
1063 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1064 | ":c1=%12u\n", c1); | ||
1065 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1066 | ":c2=%12u\n", c2); | ||
1067 | |||
1068 | /* this diff is as close as we are going to get to counter ticks per sec */ | ||
1069 | mips_hpt_frequency = abs(c2 - c1); | ||
1070 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1071 | ":f1=%12u\n", mips_hpt_frequency); | ||
1072 | |||
1073 | /* round to 1/10th of a MHz */ | ||
1074 | mips_hpt_frequency /= (100 * 1000); | ||
1075 | mips_hpt_frequency *= (100 * 1000); | ||
1076 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, | ||
1077 | ":f2=%12u\n", mips_hpt_frequency); | ||
1078 | |||
1079 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_INFO, | ||
1080 | ":mips_hpt_frequency=%uHz (%uMHz)\n", | ||
1081 | mips_hpt_frequency, | ||
1082 | mips_hpt_frequency / 1000000); | ||
1083 | #else | ||
1084 | mips_hpt_frequency = 100000000; | ||
1085 | #endif | ||
1086 | 1027 | ||
1087 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n"); | 1028 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n"); |
1088 | 1029 | ||
@@ -1095,3 +1036,16 @@ void __init toshiba_rbtx4927_timer_setup(struct irqaction *irq) | |||
1095 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP, | 1036 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIMER_SETUP, |
1096 | "+\n"); | 1037 | "+\n"); |
1097 | } | 1038 | } |
1039 | |||
1040 | static int __init toshiba_rbtx4927_rtc_init(void) | ||
1041 | { | ||
1042 | struct resource res = { | ||
1043 | .start = 0x1c010000, | ||
1044 | .end = 0x1c010000 + 0x800 - 1, | ||
1045 | .flags = IORESOURCE_MEM, | ||
1046 | }; | ||
1047 | struct platform_device *dev = | ||
1048 | platform_device_register_simple("ds1742", -1, &res, 1); | ||
1049 | return IS_ERR(dev) ? PTR_ERR(dev) : 0; | ||
1050 | } | ||
1051 | device_initcall(toshiba_rbtx4927_rtc_init); | ||