blob: 71859c4fee84779848dd4032ddf0c8500faeabeb [file] [log] [blame]
Ralf Baechle23fbee92005-07-25 22:45:45 +00001/*
2 * linux/arch/mips/tx4938/common/setup.c
3 *
4 * common tx4938 setup routines
5 *
6 * 2003-2005 (c) MontaVista Software, Inc. This file is licensed under the
7 * terms of the GNU General Public License version 2. This program is
8 * licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 *
11 * Support for TX4938 in 2.6 - Manish Lachwani (mlachwani@mvista.com)
12 */
13
14#include <linux/errno.h>
15#include <linux/init.h>
16#include <linux/kernel_stat.h>
17#include <linux/module.h>
18#include <linux/signal.h>
19#include <linux/sched.h>
20#include <linux/types.h>
21#include <linux/interrupt.h>
22#include <linux/ioport.h>
23#include <linux/timex.h>
24#include <linux/slab.h>
25#include <linux/random.h>
26#include <linux/irq.h>
27#include <asm/bitops.h>
28#include <asm/bootinfo.h>
29#include <asm/io.h>
30#include <asm/irq.h>
31#include <asm/mipsregs.h>
32#include <asm/system.h>
33#include <asm/time.h>
34#include <asm/time.h>
35#include <asm/tx4938/rbtx4938.h>
36
37extern void toshiba_rbtx4938_setup(void);
38extern void rbtx4938_time_init(void);
39
40void __init tx4938_setup(void);
41void __init tx4938_time_init(void);
Ralf Baechle23fbee92005-07-25 22:45:45 +000042void dump_cp0(char *key);
43
44void (*__wbflush) (void);
45
46static void
47tx4938_write_buffer_flush(void)
48{
49 mmiowb();
50
51 __asm__ __volatile__(
52 ".set push\n\t"
53 ".set noreorder\n\t"
54 "lw $0,%0\n\t"
55 "nop\n\t"
56 ".set pop"
57 : /* no output */
58 : "m" (*(int *)KSEG1)
59 : "memory");
60}
61
62void __init
Ralf Baechle2925aba2006-06-18 01:32:22 +010063plat_mem_setup(void)
Ralf Baechle23fbee92005-07-25 22:45:45 +000064{
65 board_time_init = tx4938_time_init;
Ralf Baechle23fbee92005-07-25 22:45:45 +000066 __wbflush = tx4938_write_buffer_flush;
67 toshiba_rbtx4938_setup();
68}
69
70void __init
71tx4938_time_init(void)
72{
73 rbtx4938_time_init();
74}
75
Ralf Baechle54d0a212006-07-09 21:38:56 +010076void __init plat_timer_setup(struct irqaction *irq)
Ralf Baechle23fbee92005-07-25 22:45:45 +000077{
78 u32 count;
79 u32 c1;
80 u32 c2;
81
82 setup_irq(TX4938_IRQ_CPU_TIMER, irq);
83
84 c1 = read_c0_count();
85 count = c1 + (mips_hpt_frequency / HZ);
86 write_c0_compare(count);
87 c2 = read_c0_count();
88}