diff options
Diffstat (limited to 'arch/sh/boards/saturn')
-rw-r--r-- | arch/sh/boards/saturn/Makefile | 8 | ||||
-rw-r--r-- | arch/sh/boards/saturn/io.c | 26 | ||||
-rw-r--r-- | arch/sh/boards/saturn/irq.c | 118 | ||||
-rw-r--r-- | arch/sh/boards/saturn/setup.c | 43 | ||||
-rw-r--r-- | arch/sh/boards/saturn/smp.c | 68 |
5 files changed, 263 insertions, 0 deletions
diff --git a/arch/sh/boards/saturn/Makefile b/arch/sh/boards/saturn/Makefile new file mode 100644 index 000000000000..75a3042e252e --- /dev/null +++ b/arch/sh/boards/saturn/Makefile | |||
@@ -0,0 +1,8 @@ | |||
1 | # | ||
2 | # Makefile for the Sega Saturn specific parts of the kernel | ||
3 | # | ||
4 | |||
5 | obj-y := setup.o io.o irq.o | ||
6 | |||
7 | obj-$(CONFIG_SMP) += smp.o | ||
8 | |||
diff --git a/arch/sh/boards/saturn/io.c b/arch/sh/boards/saturn/io.c new file mode 100644 index 000000000000..c6e4f7f2e686 --- /dev/null +++ b/arch/sh/boards/saturn/io.c | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/saturn/io.c | ||
3 | * | ||
4 | * I/O routines for the Sega Saturn. | ||
5 | * | ||
6 | * Copyright (C) 2002 Paul Mundt | ||
7 | * | ||
8 | * Released under the terms of the GNU GPL v2.0. | ||
9 | */ | ||
10 | #include <asm/saturn/io.h> | ||
11 | #include <asm/machvec.h> | ||
12 | |||
13 | unsigned long saturn_isa_port2addr(unsigned long offset) | ||
14 | { | ||
15 | return offset; | ||
16 | } | ||
17 | |||
18 | void *saturn_ioremap(unsigned long offset, unsigned long size) | ||
19 | { | ||
20 | return (void *)offset; | ||
21 | } | ||
22 | |||
23 | void saturn_iounmap(void *addr) | ||
24 | { | ||
25 | } | ||
26 | |||
diff --git a/arch/sh/boards/saturn/irq.c b/arch/sh/boards/saturn/irq.c new file mode 100644 index 000000000000..15d1d3f0f787 --- /dev/null +++ b/arch/sh/boards/saturn/irq.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/saturn/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2002 Paul Mundt | ||
5 | * | ||
6 | * Released under the terms of the GNU GPL v2.0. | ||
7 | */ | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/init.h> | ||
10 | #include <linux/interrupt.h> | ||
11 | #include <asm/irq.h> | ||
12 | #include <asm/io.h> | ||
13 | |||
14 | /* | ||
15 | * Interrupts map out as follows: | ||
16 | * | ||
17 | * Vector Name Mask | ||
18 | * | ||
19 | * 64 VBLANKIN 0x0001 | ||
20 | * 65 VBLANKOUT 0x0002 | ||
21 | * 66 HBLANKIN 0x0004 | ||
22 | * 67 TIMER0 0x0008 | ||
23 | * 68 TIMER1 0x0010 | ||
24 | * 69 DSPEND 0x0020 | ||
25 | * 70 SOUNDREQUEST 0x0040 | ||
26 | * 71 SYSTEMMANAGER 0x0080 | ||
27 | * 72 PAD 0x0100 | ||
28 | * 73 LEVEL2DMAEND 0x0200 | ||
29 | * 74 LEVEL1DMAEND 0x0400 | ||
30 | * 75 LEVEL0DMAEND 0x0800 | ||
31 | * 76 DMAILLEGAL 0x1000 | ||
32 | * 77 SRITEDRAWEND 0x2000 | ||
33 | * 78 ABUS 0x8000 | ||
34 | * | ||
35 | */ | ||
36 | #define SATURN_IRQ_MIN 64 /* VBLANKIN */ | ||
37 | #define SATURN_IRQ_MAX 78 /* ABUS */ | ||
38 | |||
39 | #define SATURN_IRQ_MASK 0xbfff | ||
40 | |||
41 | static inline u32 saturn_irq_mask(unsigned int irq_nr) | ||
42 | { | ||
43 | u32 mask; | ||
44 | |||
45 | mask = (1 << (irq_nr - SATURN_IRQ_MIN)); | ||
46 | mask <<= (irq_nr == SATURN_IRQ_MAX); | ||
47 | mask &= SATURN_IRQ_MASK; | ||
48 | |||
49 | return mask; | ||
50 | } | ||
51 | |||
52 | static inline void mask_saturn_irq(unsigned int irq_nr) | ||
53 | { | ||
54 | u32 mask; | ||
55 | |||
56 | mask = ctrl_inl(SATURN_IMR); | ||
57 | mask |= saturn_irq_mask(irq_nr); | ||
58 | ctrl_outl(mask, SATURN_IMR); | ||
59 | } | ||
60 | |||
61 | static inline void unmask_saturn_irq(unsigned int irq_nr) | ||
62 | { | ||
63 | u32 mask; | ||
64 | |||
65 | mask = ctrl_inl(SATURN_IMR); | ||
66 | mask &= ~saturn_irq_mask(irq_nr); | ||
67 | ctrl_outl(mask, SATURN_IMR); | ||
68 | } | ||
69 | |||
70 | static void disable_saturn_irq(unsigned int irq_nr) | ||
71 | { | ||
72 | mask_saturn_irq(irq_nr); | ||
73 | } | ||
74 | |||
75 | static void enable_saturn_irq(unsigned int irq_nr) | ||
76 | { | ||
77 | unmask_saturn_irq(irq_nr); | ||
78 | } | ||
79 | |||
80 | static void mask_and_ack_saturn_irq(unsigned int irq_nr) | ||
81 | { | ||
82 | mask_saturn_irq(irq_nr); | ||
83 | } | ||
84 | |||
85 | static void end_saturn_irq(unsigned int irq_nr) | ||
86 | { | ||
87 | if (!(irq_desc[irq_nr].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
88 | unmask_saturn_irq(irq_nr); | ||
89 | } | ||
90 | |||
91 | static unsigned int startup_saturn_irq(unsigned int irq_nr) | ||
92 | { | ||
93 | unmask_saturn_irq(irq_nr); | ||
94 | |||
95 | return 0; | ||
96 | } | ||
97 | |||
98 | static void shutdown_saturn_irq(unsigned int irq_nr) | ||
99 | { | ||
100 | mask_saturn_irq(irq_nr); | ||
101 | } | ||
102 | |||
103 | static struct hw_interrupt_type saturn_int = { | ||
104 | .typename = "Saturn", | ||
105 | .enable = enable_saturn_irq, | ||
106 | .disable = disable_saturn_irq, | ||
107 | .ack = mask_and_ack_saturn_irq, | ||
108 | .end = end_saturn_irq, | ||
109 | .startup = startup_saturn_irq, | ||
110 | .shutdown = shutdown_saturn_irq, | ||
111 | }; | ||
112 | |||
113 | int saturn_irq_demux(int irq_nr) | ||
114 | { | ||
115 | /* FIXME */ | ||
116 | return irq_nr; | ||
117 | } | ||
118 | |||
diff --git a/arch/sh/boards/saturn/setup.c b/arch/sh/boards/saturn/setup.c new file mode 100644 index 000000000000..bea6c572ad82 --- /dev/null +++ b/arch/sh/boards/saturn/setup.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/saturn/setup.c | ||
3 | * | ||
4 | * Hardware support for the Sega Saturn. | ||
5 | * | ||
6 | * Copyright (c) 2002 Paul Mundt | ||
7 | * | ||
8 | * Released under the terms of the GNU GPL v2.0. | ||
9 | */ | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/init.h> | ||
12 | |||
13 | #include <asm/io.h> | ||
14 | #include <asm/machvec.h> | ||
15 | #include <asm/mach/io.h> | ||
16 | |||
17 | extern int saturn_irq_demux(int irq_nr); | ||
18 | |||
19 | const char *get_system_type(void) | ||
20 | { | ||
21 | return "Sega Saturn"; | ||
22 | } | ||
23 | |||
24 | /* | ||
25 | * The Machine Vector | ||
26 | */ | ||
27 | struct sh_machine_vector mv_saturn __initmv = { | ||
28 | .mv_nr_irqs = 80, /* Fix this later */ | ||
29 | |||
30 | .mv_isa_port2addr = saturn_isa_port2addr, | ||
31 | .mv_irq_demux = saturn_irq_demux, | ||
32 | |||
33 | .mv_ioremap = saturn_ioremap, | ||
34 | .mv_iounmap = saturn_iounmap, | ||
35 | }; | ||
36 | |||
37 | ALIAS_MV(saturn) | ||
38 | |||
39 | int __init platform_setup(void) | ||
40 | { | ||
41 | return 0; | ||
42 | } | ||
43 | |||
diff --git a/arch/sh/boards/saturn/smp.c b/arch/sh/boards/saturn/smp.c new file mode 100644 index 000000000000..76460918c9cd --- /dev/null +++ b/arch/sh/boards/saturn/smp.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/saturn/smp.c | ||
3 | * | ||
4 | * SMP support for the Sega Saturn. | ||
5 | * | ||
6 | * Copyright (c) 2002 Paul Mundt | ||
7 | * | ||
8 | * Released under the terms of the GNU GPL v2.0. | ||
9 | */ | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/smp.h> | ||
13 | |||
14 | #include <asm/saturn/smpc.h> | ||
15 | |||
16 | extern void start_secondary(void); | ||
17 | |||
18 | void __smp_send_ipi(unsigned int cpu, unsigned int action) | ||
19 | { | ||
20 | /* Nothing here yet .. */ | ||
21 | } | ||
22 | |||
23 | unsigned int __smp_probe_cpus(void) | ||
24 | { | ||
25 | /* | ||
26 | * This is just a straightforward master/slave configuration, | ||
27 | * and probing isn't really supported.. | ||
28 | */ | ||
29 | return 2; | ||
30 | } | ||
31 | |||
32 | /* | ||
33 | * We're only allowed to do byte-access to SMPC registers. In | ||
34 | * addition to which, we treat them as write-only, since | ||
35 | * reading from them will return undefined data. | ||
36 | */ | ||
37 | static inline void smpc_slave_stop(unsigned int cpu) | ||
38 | { | ||
39 | smpc_barrier(); | ||
40 | ctrl_outb(1, SMPC_STATUS); | ||
41 | |||
42 | ctrl_outb(SMPC_CMD_SSHOFF, SMPC_COMMAND); | ||
43 | smpc_barrier(); | ||
44 | } | ||
45 | |||
46 | static inline void smpc_slave_start(unsigned int cpu) | ||
47 | { | ||
48 | ctrl_outb(1, SMPC_STATUS); | ||
49 | ctrl_outb(SMPC_CMD_SSHON, SMPC_COMMAND); | ||
50 | |||
51 | smpc_barrier(); | ||
52 | } | ||
53 | |||
54 | void __smp_slave_init(unsigned int cpu) | ||
55 | { | ||
56 | register unsigned long vbr; | ||
57 | void **entry; | ||
58 | |||
59 | __asm__ __volatile__ ("stc vbr, %0\n\t" : "=r" (vbr)); | ||
60 | entry = (void **)(vbr + 0x310 + 0x94); | ||
61 | |||
62 | smpc_slave_stop(cpu); | ||
63 | |||
64 | *(void **)entry = (void *)start_secondary; | ||
65 | |||
66 | smpc_slave_start(cpu); | ||
67 | } | ||
68 | |||