aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/saturn
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sh/boards/saturn
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/sh/boards/saturn')
-rw-r--r--arch/sh/boards/saturn/Makefile8
-rw-r--r--arch/sh/boards/saturn/io.c26
-rw-r--r--arch/sh/boards/saturn/irq.c118
-rw-r--r--arch/sh/boards/saturn/setup.c43
-rw-r--r--arch/sh/boards/saturn/smp.c68
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
5obj-y := setup.o io.o irq.o
6
7obj-$(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
13unsigned long saturn_isa_port2addr(unsigned long offset)
14{
15 return offset;
16}
17
18void *saturn_ioremap(unsigned long offset, unsigned long size)
19{
20 return (void *)offset;
21}
22
23void 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
41static 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
52static 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
61static 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
70static void disable_saturn_irq(unsigned int irq_nr)
71{
72 mask_saturn_irq(irq_nr);
73}
74
75static void enable_saturn_irq(unsigned int irq_nr)
76{
77 unmask_saturn_irq(irq_nr);
78}
79
80static void mask_and_ack_saturn_irq(unsigned int irq_nr)
81{
82 mask_saturn_irq(irq_nr);
83}
84
85static 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
91static unsigned int startup_saturn_irq(unsigned int irq_nr)
92{
93 unmask_saturn_irq(irq_nr);
94
95 return 0;
96}
97
98static void shutdown_saturn_irq(unsigned int irq_nr)
99{
100 mask_saturn_irq(irq_nr);
101}
102
103static 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
113int 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
17extern int saturn_irq_demux(int irq_nr);
18
19const char *get_system_type(void)
20{
21 return "Sega Saturn";
22}
23
24/*
25 * The Machine Vector
26 */
27struct 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
37ALIAS_MV(saturn)
38
39int __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
16extern void start_secondary(void);
17
18void __smp_send_ipi(unsigned int cpu, unsigned int action)
19{
20 /* Nothing here yet .. */
21}
22
23unsigned 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 */
37static 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
46static 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
54void __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