diff options
author | Atsushi Nemoto <anemo@mba.ocn.ne.jp> | 2007-10-24 12:34:09 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-10-29 15:35:35 -0400 |
commit | 229f773ef4ee852ad7bfbe8e1238a2c35b2baa6f (patch) | |
tree | 44d9dd3f2be845140024883db13ab879b4ce1f2e /arch | |
parent | 22df3f53e33d55335e1ef43d4e6ead54b379b3a2 (diff) |
[MIPS] txx9tmr clockevent/clocksource driver
Convert jmr3927_clock_event_device to more generic
txx9tmr_clock_event_device which supports one-shot mode. The
txx9tmr_clock_event_device can be used for TX49 too if the cp0 timer
interrupt was not available.
Convert jmr3927_hpt_read to txx9_clocksource driver which does not
depends jiffies anymore. The txx9_clocksource itself can be used for
TX49, but normally TX49 uses higher precision clocksource_mips.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/Kconfig | 6 | ||||
-rw-r--r-- | arch/mips/jmr3927/rbhma3100/setup.c | 83 | ||||
-rw-r--r-- | arch/mips/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/mips/kernel/cevt-txx9.c | 171 | ||||
-rw-r--r-- | arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | 17 | ||||
-rw-r--r-- | arch/mips/tx4938/toshiba_rbtx4938/setup.c | 19 |
6 files changed, 201 insertions, 96 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 61262c5f9c62..97da953eb5d0 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -583,6 +583,7 @@ config SNI_RM | |||
583 | 583 | ||
584 | config TOSHIBA_JMR3927 | 584 | config TOSHIBA_JMR3927 |
585 | bool "Toshiba JMR-TX3927 board" | 585 | bool "Toshiba JMR-TX3927 board" |
586 | select CEVT_TXX9 | ||
586 | select DMA_NONCOHERENT | 587 | select DMA_NONCOHERENT |
587 | select HW_HAS_PCI | 588 | select HW_HAS_PCI |
588 | select MIPS_TX3927 | 589 | select MIPS_TX3927 |
@@ -597,6 +598,7 @@ config TOSHIBA_JMR3927 | |||
597 | config TOSHIBA_RBTX4927 | 598 | config TOSHIBA_RBTX4927 |
598 | bool "Toshiba RBTX49[23]7 board" | 599 | bool "Toshiba RBTX49[23]7 board" |
599 | select CEVT_R4K | 600 | select CEVT_R4K |
601 | select CEVT_TXX9 | ||
600 | select DMA_NONCOHERENT | 602 | select DMA_NONCOHERENT |
601 | select HAS_TXX9_SERIAL | 603 | select HAS_TXX9_SERIAL |
602 | select HW_HAS_PCI | 604 | select HW_HAS_PCI |
@@ -618,6 +620,7 @@ config TOSHIBA_RBTX4927 | |||
618 | config TOSHIBA_RBTX4938 | 620 | config TOSHIBA_RBTX4938 |
619 | bool "Toshiba RBTX4938 board" | 621 | bool "Toshiba RBTX4938 board" |
620 | select CEVT_R4K | 622 | select CEVT_R4K |
623 | select CEVT_TXX9 | ||
621 | select DMA_NONCOHERENT | 624 | select DMA_NONCOHERENT |
622 | select HAS_TXX9_SERIAL | 625 | select HAS_TXX9_SERIAL |
623 | select HW_HAS_PCI | 626 | select HW_HAS_PCI |
@@ -736,6 +739,9 @@ config CEVT_GT641XX | |||
736 | config CEVT_R4K | 739 | config CEVT_R4K |
737 | bool | 740 | bool |
738 | 741 | ||
742 | config CEVT_TXX9 | ||
743 | bool | ||
744 | |||
739 | config CFE | 745 | config CFE |
740 | bool | 746 | bool |
741 | 747 | ||
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c index edb9e59248ec..06e01c8f4e3a 100644 --- a/arch/mips/jmr3927/rbhma3100/setup.c +++ b/arch/mips/jmr3927/rbhma3100/setup.c | |||
@@ -27,17 +27,13 @@ | |||
27 | * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org) | 27 | * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org) |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <linux/clockchips.h> | ||
31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
32 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
33 | #include <linux/kdev_t.h> | 32 | #include <linux/kdev_t.h> |
34 | #include <linux/types.h> | 33 | #include <linux/types.h> |
35 | #include <linux/sched.h> | ||
36 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
37 | #include <linux/ide.h> | 35 | #include <linux/ide.h> |
38 | #include <linux/irq.h> | ||
39 | #include <linux/ioport.h> | 36 | #include <linux/ioport.h> |
40 | #include <linux/param.h> /* for HZ */ | ||
41 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
42 | #include <linux/pm.h> | 38 | #include <linux/pm.h> |
43 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
@@ -48,17 +44,13 @@ | |||
48 | #endif | 44 | #endif |
49 | 45 | ||
50 | #include <asm/addrspace.h> | 46 | #include <asm/addrspace.h> |
51 | #include <asm/time.h> | 47 | #include <asm/txx9tmr.h> |
52 | #include <asm/reboot.h> | 48 | #include <asm/reboot.h> |
53 | #include <asm/jmr3927/jmr3927.h> | 49 | #include <asm/jmr3927/jmr3927.h> |
54 | #include <asm/mipsregs.h> | 50 | #include <asm/mipsregs.h> |
55 | 51 | ||
56 | extern void puts(const char *cp); | 52 | extern void puts(const char *cp); |
57 | 53 | ||
58 | /* Tick Timer divider */ | ||
59 | #define JMR3927_TIMER_CCD 0 /* 1/2 */ | ||
60 | #define JMR3927_TIMER_CLK (JMR3927_IMCLK / (2 << JMR3927_TIMER_CCD)) | ||
61 | |||
62 | /* don't enable - see errata */ | 54 | /* don't enable - see errata */ |
63 | static int jmr3927_ccfg_toeon; | 55 | static int jmr3927_ccfg_toeon; |
64 | 56 | ||
@@ -93,66 +85,12 @@ static void jmr3927_machine_power_off(void) | |||
93 | while (1); | 85 | while (1); |
94 | } | 86 | } |
95 | 87 | ||
96 | static cycle_t jmr3927_hpt_read(void) | ||
97 | { | ||
98 | /* We assume this function is called xtime_lock held. */ | ||
99 | return jiffies * (JMR3927_TIMER_CLK / HZ) + jmr3927_tmrptr->trr; | ||
100 | } | ||
101 | |||
102 | static void jmr3927_set_mode(enum clock_event_mode mode, | ||
103 | struct clock_event_device *evt) | ||
104 | { | ||
105 | /* Nothing to do here */ | ||
106 | } | ||
107 | |||
108 | struct clock_event_device jmr3927_clock_event_device = { | ||
109 | .name = "MIPS", | ||
110 | .features = CLOCK_EVT_FEAT_PERIODIC, | ||
111 | .shift = 32, | ||
112 | .rating = 300, | ||
113 | .cpumask = CPU_MASK_CPU0, | ||
114 | .irq = JMR3927_IRQ_TICK, | ||
115 | .set_mode = jmr3927_set_mode, | ||
116 | }; | ||
117 | |||
118 | static irqreturn_t jmr3927_timer_interrupt(int irq, void *dev_id) | ||
119 | { | ||
120 | struct clock_event_device *cd = &jmr3927_clock_event_device; | ||
121 | |||
122 | jmr3927_tmrptr->tisr = 0; /* ack interrupt */ | ||
123 | |||
124 | cd->event_handler(cd); | ||
125 | |||
126 | return IRQ_HANDLED; | ||
127 | } | ||
128 | |||
129 | static struct irqaction jmr3927_timer_irqaction = { | ||
130 | .handler = jmr3927_timer_interrupt, | ||
131 | .flags = IRQF_DISABLED | IRQF_PERCPU, | ||
132 | .name = "jmr3927-timer", | ||
133 | }; | ||
134 | |||
135 | void __init plat_time_init(void) | 88 | void __init plat_time_init(void) |
136 | { | 89 | { |
137 | struct clock_event_device *cd; | 90 | txx9_clockevent_init(TX3927_TMR_REG(0), |
138 | 91 | TXX9_IRQ_BASE + JMR3927_IRQ_IRC_TMR(0), | |
139 | clocksource_mips.read = jmr3927_hpt_read; | 92 | JMR3927_IMCLK); |
140 | mips_hpt_frequency = JMR3927_TIMER_CLK; | 93 | txx9_clocksource_init(TX3927_TMR_REG(1), JMR3927_IMCLK); |
141 | |||
142 | jmr3927_tmrptr->cpra = JMR3927_TIMER_CLK / HZ; | ||
143 | jmr3927_tmrptr->itmr = TXx927_TMTITMR_TIIE | TXx927_TMTITMR_TZCE; | ||
144 | jmr3927_tmrptr->ccdr = JMR3927_TIMER_CCD; | ||
145 | jmr3927_tmrptr->tcr = | ||
146 | TXx927_TMTCR_TCE | TXx927_TMTCR_CCDE | TXx927_TMTCR_TMODE_ITVL; | ||
147 | |||
148 | cd = &jmr3927_clock_event_device; | ||
149 | /* Calculate the min / max delta */ | ||
150 | cd->mult = div_sc((unsigned long) JMR3927_IMCLK, NSEC_PER_SEC, 32); | ||
151 | cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); | ||
152 | cd->min_delta_ns = clockevent_delta2ns(0x300, cd); | ||
153 | clockevents_register_device(cd); | ||
154 | |||
155 | setup_irq(JMR3927_IRQ_TICK, &jmr3927_timer_irqaction); | ||
156 | } | 94 | } |
157 | 95 | ||
158 | #define DO_WRITE_THROUGH | 96 | #define DO_WRITE_THROUGH |
@@ -317,15 +255,8 @@ static void __init tx3927_setup(void) | |||
317 | tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg); | 255 | tx3927_ccfgptr->ccfg, tx3927_ccfgptr->pcfg); |
318 | 256 | ||
319 | /* TMR */ | 257 | /* TMR */ |
320 | /* disable all timers */ | 258 | for (i = 0; i < TX3927_NR_TMR; i++) |
321 | for (i = 0; i < TX3927_NR_TMR; i++) { | 259 | txx9_tmr_init(TX3927_TMR_REG(i)); |
322 | tx3927_tmrptr(i)->tcr = TXx927_TMTCR_CRE; | ||
323 | tx3927_tmrptr(i)->tisr = 0; | ||
324 | tx3927_tmrptr(i)->cpra = 0xffffffff; | ||
325 | tx3927_tmrptr(i)->itmr = 0; | ||
326 | tx3927_tmrptr(i)->ccdr = 0; | ||
327 | tx3927_tmrptr(i)->pgmr = 0; | ||
328 | } | ||
329 | 260 | ||
330 | /* DMA */ | 261 | /* DMA */ |
331 | tx3927_dmaptr->mcr = 0; | 262 | tx3927_dmaptr->mcr = 0; |
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index d7745c8976f6..3196509a28d5 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -10,6 +10,7 @@ obj-y += cpu-probe.o branch.o entry.o genex.o irq.o process.o \ | |||
10 | 10 | ||
11 | obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o | 11 | obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o |
12 | obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o | 12 | obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o |
13 | obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o | ||
13 | 14 | ||
14 | binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ | 15 | binfmt_irix-objs := irixelf.o irixinv.o irixioctl.o irixsig.o \ |
15 | irix5sys.o sysirix.o | 16 | irix5sys.o sysirix.o |
diff --git a/arch/mips/kernel/cevt-txx9.c b/arch/mips/kernel/cevt-txx9.c new file mode 100644 index 000000000000..795cb8fb0d74 --- /dev/null +++ b/arch/mips/kernel/cevt-txx9.c | |||
@@ -0,0 +1,171 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Based on linux/arch/mips/kernel/cevt-r4k.c, | ||
7 | * linux/arch/mips/jmr3927/rbhma3100/setup.c | ||
8 | * | ||
9 | * Copyright 2001 MontaVista Software Inc. | ||
10 | * Copyright (C) 2000-2001 Toshiba Corporation | ||
11 | * Copyright (C) 2007 MIPS Technologies, Inc. | ||
12 | * Copyright (C) 2007 Ralf Baechle <ralf@linux-mips.org> | ||
13 | */ | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <asm/time.h> | ||
17 | #include <asm/txx9tmr.h> | ||
18 | |||
19 | #define TCR_BASE (TXx9_TMTCR_CCDE | TXx9_TMTCR_CRE | TXx9_TMTCR_TMODE_ITVL) | ||
20 | #define TIMER_CCD 0 /* 1/2 */ | ||
21 | #define TIMER_CLK(imclk) ((imclk) / (2 << TIMER_CCD)) | ||
22 | |||
23 | static struct txx9_tmr_reg __iomem *txx9_cs_tmrptr; | ||
24 | |||
25 | static cycle_t txx9_cs_read(void) | ||
26 | { | ||
27 | return __raw_readl(&txx9_cs_tmrptr->trr); | ||
28 | } | ||
29 | |||
30 | /* Use 1 bit smaller width to use full bits in that width */ | ||
31 | #define TXX9_CLOCKSOURCE_BITS (TXX9_TIMER_BITS - 1) | ||
32 | |||
33 | static struct clocksource txx9_clocksource = { | ||
34 | .name = "TXx9", | ||
35 | .rating = 200, | ||
36 | .read = txx9_cs_read, | ||
37 | .mask = CLOCKSOURCE_MASK(TXX9_CLOCKSOURCE_BITS), | ||
38 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | ||
39 | }; | ||
40 | |||
41 | void __init txx9_clocksource_init(unsigned long baseaddr, | ||
42 | unsigned int imbusclk) | ||
43 | { | ||
44 | struct txx9_tmr_reg __iomem *tmrptr; | ||
45 | |||
46 | clocksource_set_clock(&txx9_clocksource, TIMER_CLK(imbusclk)); | ||
47 | clocksource_register(&txx9_clocksource); | ||
48 | |||
49 | tmrptr = ioremap(baseaddr, sizeof(struct txx9_tmr_reg)); | ||
50 | __raw_writel(TCR_BASE, &tmrptr->tcr); | ||
51 | __raw_writel(0, &tmrptr->tisr); | ||
52 | __raw_writel(TIMER_CCD, &tmrptr->ccdr); | ||
53 | __raw_writel(TXx9_TMITMR_TZCE, &tmrptr->itmr); | ||
54 | __raw_writel(1 << TXX9_CLOCKSOURCE_BITS, &tmrptr->cpra); | ||
55 | __raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr); | ||
56 | txx9_cs_tmrptr = tmrptr; | ||
57 | } | ||
58 | |||
59 | static struct txx9_tmr_reg __iomem *txx9_tmrptr; | ||
60 | |||
61 | static void txx9tmr_stop_and_clear(struct txx9_tmr_reg __iomem *tmrptr) | ||
62 | { | ||
63 | /* stop and reset counter */ | ||
64 | __raw_writel(TCR_BASE, &tmrptr->tcr); | ||
65 | /* clear pending interrupt */ | ||
66 | __raw_writel(0, &tmrptr->tisr); | ||
67 | } | ||
68 | |||
69 | static void txx9tmr_set_mode(enum clock_event_mode mode, | ||
70 | struct clock_event_device *evt) | ||
71 | { | ||
72 | struct txx9_tmr_reg __iomem *tmrptr = txx9_tmrptr; | ||
73 | |||
74 | txx9tmr_stop_and_clear(tmrptr); | ||
75 | switch (mode) { | ||
76 | case CLOCK_EVT_MODE_PERIODIC: | ||
77 | __raw_writel(TXx9_TMITMR_TIIE | TXx9_TMITMR_TZCE, | ||
78 | &tmrptr->itmr); | ||
79 | /* start timer */ | ||
80 | __raw_writel(((u64)(NSEC_PER_SEC / HZ) * evt->mult) >> | ||
81 | evt->shift, | ||
82 | &tmrptr->cpra); | ||
83 | __raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr); | ||
84 | break; | ||
85 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
86 | case CLOCK_EVT_MODE_UNUSED: | ||
87 | __raw_writel(0, &tmrptr->itmr); | ||
88 | break; | ||
89 | case CLOCK_EVT_MODE_ONESHOT: | ||
90 | __raw_writel(TXx9_TMITMR_TIIE, &tmrptr->itmr); | ||
91 | break; | ||
92 | case CLOCK_EVT_MODE_RESUME: | ||
93 | __raw_writel(TIMER_CCD, &tmrptr->ccdr); | ||
94 | __raw_writel(0, &tmrptr->itmr); | ||
95 | break; | ||
96 | } | ||
97 | } | ||
98 | |||
99 | static int txx9tmr_set_next_event(unsigned long delta, | ||
100 | struct clock_event_device *evt) | ||
101 | { | ||
102 | struct txx9_tmr_reg __iomem *tmrptr = txx9_tmrptr; | ||
103 | |||
104 | txx9tmr_stop_and_clear(tmrptr); | ||
105 | /* start timer */ | ||
106 | __raw_writel(delta, &tmrptr->cpra); | ||
107 | __raw_writel(TCR_BASE | TXx9_TMTCR_TCE, &tmrptr->tcr); | ||
108 | return 0; | ||
109 | } | ||
110 | |||
111 | static struct clock_event_device txx9tmr_clock_event_device = { | ||
112 | .name = "TXx9", | ||
113 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | ||
114 | .rating = 200, | ||
115 | .cpumask = CPU_MASK_CPU0, | ||
116 | .set_mode = txx9tmr_set_mode, | ||
117 | .set_next_event = txx9tmr_set_next_event, | ||
118 | }; | ||
119 | |||
120 | static irqreturn_t txx9tmr_interrupt(int irq, void *dev_id) | ||
121 | { | ||
122 | struct clock_event_device *cd = &txx9tmr_clock_event_device; | ||
123 | struct txx9_tmr_reg __iomem *tmrptr = txx9_tmrptr; | ||
124 | |||
125 | __raw_writel(0, &tmrptr->tisr); /* ack interrupt */ | ||
126 | cd->event_handler(cd); | ||
127 | return IRQ_HANDLED; | ||
128 | } | ||
129 | |||
130 | static struct irqaction txx9tmr_irq = { | ||
131 | .handler = txx9tmr_interrupt, | ||
132 | .flags = IRQF_DISABLED | IRQF_PERCPU, | ||
133 | .name = "txx9tmr", | ||
134 | }; | ||
135 | |||
136 | void __init txx9_clockevent_init(unsigned long baseaddr, int irq, | ||
137 | unsigned int imbusclk) | ||
138 | { | ||
139 | struct clock_event_device *cd = &txx9tmr_clock_event_device; | ||
140 | struct txx9_tmr_reg __iomem *tmrptr; | ||
141 | |||
142 | tmrptr = ioremap(baseaddr, sizeof(struct txx9_tmr_reg)); | ||
143 | txx9tmr_stop_and_clear(tmrptr); | ||
144 | __raw_writel(TIMER_CCD, &tmrptr->ccdr); | ||
145 | __raw_writel(0, &tmrptr->itmr); | ||
146 | txx9_tmrptr = tmrptr; | ||
147 | |||
148 | clockevent_set_clock(cd, TIMER_CLK(imbusclk)); | ||
149 | cd->max_delta_ns = | ||
150 | clockevent_delta2ns(0xffffffff >> (32 - TXX9_TIMER_BITS), cd); | ||
151 | cd->min_delta_ns = clockevent_delta2ns(0xf, cd); | ||
152 | cd->irq = irq; | ||
153 | clockevents_register_device(cd); | ||
154 | setup_irq(irq, &txx9tmr_irq); | ||
155 | printk(KERN_INFO "TXx9: clockevent device at 0x%lx, irq %d\n", | ||
156 | baseaddr, irq); | ||
157 | } | ||
158 | |||
159 | void __init txx9_tmr_init(unsigned long baseaddr) | ||
160 | { | ||
161 | struct txx9_tmr_reg __iomem *tmrptr; | ||
162 | |||
163 | tmrptr = ioremap(baseaddr, sizeof(struct txx9_tmr_reg)); | ||
164 | __raw_writel(TXx9_TMTCR_CRE, &tmrptr->tcr); | ||
165 | __raw_writel(0, &tmrptr->tisr); | ||
166 | __raw_writel(0xffffffff, &tmrptr->cpra); | ||
167 | __raw_writel(0, &tmrptr->itmr); | ||
168 | __raw_writel(0, &tmrptr->ccdr); | ||
169 | __raw_writel(0, &tmrptr->pgmr); | ||
170 | iounmap(tmrptr); | ||
171 | } | ||
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c index c7470fba6180..0299595ce1c4 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include <asm/processor.h> | 63 | #include <asm/processor.h> |
64 | #include <asm/reboot.h> | 64 | #include <asm/reboot.h> |
65 | #include <asm/time.h> | 65 | #include <asm/time.h> |
66 | #include <asm/txx9tmr.h> | ||
66 | #include <linux/bootmem.h> | 67 | #include <linux/bootmem.h> |
67 | #include <linux/blkdev.h> | 68 | #include <linux/blkdev.h> |
68 | #ifdef CONFIG_TOSHIBA_FPCIB0 | 69 | #ifdef CONFIG_TOSHIBA_FPCIB0 |
@@ -93,7 +94,6 @@ | |||
93 | 94 | ||
94 | #define TOSHIBA_RBTX4927_SETUP_EFWFU ( 1 << 3 ) | 95 | #define TOSHIBA_RBTX4927_SETUP_EFWFU ( 1 << 3 ) |
95 | #define TOSHIBA_RBTX4927_SETUP_SETUP ( 1 << 4 ) | 96 | #define TOSHIBA_RBTX4927_SETUP_SETUP ( 1 << 4 ) |
96 | #define TOSHIBA_RBTX4927_SETUP_TIME_INIT ( 1 << 5 ) | ||
97 | #define TOSHIBA_RBTX4927_SETUP_PCIBIOS ( 1 << 7 ) | 97 | #define TOSHIBA_RBTX4927_SETUP_PCIBIOS ( 1 << 7 ) |
98 | #define TOSHIBA_RBTX4927_SETUP_PCI1 ( 1 << 8 ) | 98 | #define TOSHIBA_RBTX4927_SETUP_PCI1 ( 1 << 8 ) |
99 | #define TOSHIBA_RBTX4927_SETUP_PCI2 ( 1 << 9 ) | 99 | #define TOSHIBA_RBTX4927_SETUP_PCI2 ( 1 << 9 ) |
@@ -130,7 +130,6 @@ extern void toshiba_rbtx4927_power_off(void); | |||
130 | 130 | ||
131 | int tx4927_using_backplane = 0; | 131 | int tx4927_using_backplane = 0; |
132 | 132 | ||
133 | extern void gt64120_time_init(void); | ||
134 | extern void toshiba_rbtx4927_irq_setup(void); | 133 | extern void toshiba_rbtx4927_irq_setup(void); |
135 | 134 | ||
136 | char *prom_getcmdline(void); | 135 | char *prom_getcmdline(void); |
@@ -721,6 +720,7 @@ void toshiba_rbtx4927_power_off(void) | |||
721 | 720 | ||
722 | void __init toshiba_rbtx4927_setup(void) | 721 | void __init toshiba_rbtx4927_setup(void) |
723 | { | 722 | { |
723 | int i; | ||
724 | u32 cp0_config; | 724 | u32 cp0_config; |
725 | char *argptr; | 725 | char *argptr; |
726 | 726 | ||
@@ -764,6 +764,9 @@ void __init toshiba_rbtx4927_setup(void) | |||
764 | _machine_halt = toshiba_rbtx4927_halt; | 764 | _machine_halt = toshiba_rbtx4927_halt; |
765 | pm_power_off = toshiba_rbtx4927_power_off; | 765 | pm_power_off = toshiba_rbtx4927_power_off; |
766 | 766 | ||
767 | for (i = 0; i < TX4927_NR_TMR; i++) | ||
768 | txx9_tmr_init(TX4927_TMR_REG(0) & 0xfffffffffULL); | ||
769 | |||
767 | #ifdef CONFIG_PCI | 770 | #ifdef CONFIG_PCI |
768 | 771 | ||
769 | /* PCIC */ | 772 | /* PCIC */ |
@@ -892,7 +895,6 @@ void __init toshiba_rbtx4927_setup(void) | |||
892 | #ifdef CONFIG_SERIAL_TXX9 | 895 | #ifdef CONFIG_SERIAL_TXX9 |
893 | { | 896 | { |
894 | extern int early_serial_txx9_setup(struct uart_port *port); | 897 | extern int early_serial_txx9_setup(struct uart_port *port); |
895 | int i; | ||
896 | struct uart_port req; | 898 | struct uart_port req; |
897 | for(i = 0; i < 2; i++) { | 899 | for(i = 0; i < 2; i++) { |
898 | memset(&req, 0, sizeof(req)); | 900 | memset(&req, 0, sizeof(req)); |
@@ -937,12 +939,11 @@ void __init toshiba_rbtx4927_setup(void) | |||
937 | void __init | 939 | void __init |
938 | toshiba_rbtx4927_time_init(void) | 940 | toshiba_rbtx4927_time_init(void) |
939 | { | 941 | { |
940 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "-\n"); | ||
941 | |||
942 | mips_hpt_frequency = tx4927_cpu_clock / 2; | 942 | mips_hpt_frequency = tx4927_cpu_clock / 2; |
943 | 943 | if (tx4927_ccfgptr->ccfg & TX4927_CCFG_TINTDIS) | |
944 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, "+\n"); | 944 | txx9_clockevent_init(TX4927_TMR_REG(0) & 0xfffffffffULL, |
945 | 945 | TXX9_IRQ_BASE + 17, | |
946 | 50000000); | ||
946 | } | 947 | } |
947 | 948 | ||
948 | static int __init toshiba_rbtx4927_rtc_init(void) | 949 | static int __init toshiba_rbtx4927_rtc_init(void) |
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c index ceecaf498957..4a8152375efe 100644 --- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c +++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <asm/reboot.h> | 26 | #include <asm/reboot.h> |
27 | #include <asm/irq.h> | 27 | #include <asm/irq.h> |
28 | #include <asm/time.h> | 28 | #include <asm/time.h> |
29 | #include <asm/txx9tmr.h> | ||
29 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
30 | #include <asm/io.h> | 31 | #include <asm/io.h> |
31 | #include <asm/bootinfo.h> | 32 | #include <asm/bootinfo.h> |
@@ -773,15 +774,8 @@ void __init tx4938_board_setup(void) | |||
773 | } | 774 | } |
774 | 775 | ||
775 | /* TMR */ | 776 | /* TMR */ |
776 | /* disable all timers */ | 777 | for (i = 0; i < TX4938_NR_TMR; i++) |
777 | for (i = 0; i < TX4938_NR_TMR; i++) { | 778 | txx9_tmr_init(TX4938_TMR_REG(i) & 0xfffffffffULL); |
778 | tx4938_tmrptr(i)->tcr = 0x00000020; | ||
779 | tx4938_tmrptr(i)->tisr = 0; | ||
780 | tx4938_tmrptr(i)->cpra = 0xffffffff; | ||
781 | tx4938_tmrptr(i)->itmr = 0; | ||
782 | tx4938_tmrptr(i)->ccdr = 0; | ||
783 | tx4938_tmrptr(i)->pgmr = 0; | ||
784 | } | ||
785 | 779 | ||
786 | /* enable DMA */ | 780 | /* enable DMA */ |
787 | TX4938_WR64(0xff1fb150, TX4938_DMA_MCR_MSTEN); | 781 | TX4938_WR64(0xff1fb150, TX4938_DMA_MCR_MSTEN); |
@@ -852,12 +846,13 @@ void tx4938_report_pcic_status(void) | |||
852 | 846 | ||
853 | #endif /* CONFIG_PCI */ | 847 | #endif /* CONFIG_PCI */ |
854 | 848 | ||
855 | /* We use onchip r4k counter or TMR timer as our system wide timer | ||
856 | * interrupt running at 100HZ. */ | ||
857 | |||
858 | void __init plat_time_init(void) | 849 | void __init plat_time_init(void) |
859 | { | 850 | { |
860 | mips_hpt_frequency = txx9_cpu_clock / 2; | 851 | mips_hpt_frequency = txx9_cpu_clock / 2; |
852 | if (tx4938_ccfgptr->ccfg & TX4938_CCFG_TINTDIS) | ||
853 | txx9_clockevent_init(TX4938_TMR_REG(0) & 0xfffffffffULL, | ||
854 | TXX9_IRQ_BASE + TX4938_IR_TMR(0), | ||
855 | txx9_gbus_clock / 2); | ||
861 | } | 856 | } |
862 | 857 | ||
863 | void __init toshiba_rbtx4938_setup(void) | 858 | void __init toshiba_rbtx4938_setup(void) |