diff options
Diffstat (limited to 'arch/sh/boards/ec3104')
-rw-r--r-- | arch/sh/boards/ec3104/Makefile | 6 | ||||
-rw-r--r-- | arch/sh/boards/ec3104/io.c | 81 | ||||
-rw-r--r-- | arch/sh/boards/ec3104/irq.c | 196 | ||||
-rw-r--r-- | arch/sh/boards/ec3104/setup.c | 65 |
4 files changed, 0 insertions, 348 deletions
diff --git a/arch/sh/boards/ec3104/Makefile b/arch/sh/boards/ec3104/Makefile deleted file mode 100644 index 178891534b67..000000000000 --- a/arch/sh/boards/ec3104/Makefile +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for the EC3104 specific parts of the kernel | ||
3 | # | ||
4 | |||
5 | obj-y := setup.o io.o irq.o | ||
6 | |||
diff --git a/arch/sh/boards/ec3104/io.c b/arch/sh/boards/ec3104/io.c deleted file mode 100644 index 2f86394b280b..000000000000 --- a/arch/sh/boards/ec3104/io.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/ec3104/io.c | ||
3 | * EC3104 companion chip support | ||
4 | * | ||
5 | * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> | ||
6 | * | ||
7 | */ | ||
8 | /* EC3104 note: | ||
9 | * This code was written without any documentation about the EC3104 chip. While | ||
10 | * I hope I got most of the basic functionality right, the register names I use | ||
11 | * are most likely completely different from those in the chip documentation. | ||
12 | * | ||
13 | * If you have any further information about the EC3104, please tell me | ||
14 | * (prumpf@tux.org). | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/types.h> | ||
19 | #include <asm/io.h> | ||
20 | #include <asm/page.h> | ||
21 | #include <asm/ec3104/ec3104.h> | ||
22 | |||
23 | /* | ||
24 | * EC3104 has a real ISA bus which we redirect low port accesses to (the | ||
25 | * actual device on mine is a ESS 1868, and I don't want to hack the driver | ||
26 | * more than strictly necessary). I am not going to duplicate the | ||
27 | * hard coding of PC addresses (for the 16550s aso) here though; it's just | ||
28 | * too ugly. | ||
29 | */ | ||
30 | |||
31 | #define low_port(port) ((port) < 0x10000) | ||
32 | |||
33 | static inline unsigned long port2addr(unsigned long port) | ||
34 | { | ||
35 | switch(port >> 16) { | ||
36 | case 0: | ||
37 | return EC3104_ISA_BASE + port * 2; | ||
38 | |||
39 | /* XXX hack. it's unclear what to do about the serial ports */ | ||
40 | case 1: | ||
41 | return EC3104_BASE + (port&0xffff) * 4; | ||
42 | |||
43 | default: | ||
44 | /* XXX PCMCIA */ | ||
45 | return 0; | ||
46 | } | ||
47 | } | ||
48 | |||
49 | unsigned char ec3104_inb(unsigned long port) | ||
50 | { | ||
51 | u8 ret; | ||
52 | |||
53 | ret = *(volatile u8 *)port2addr(port); | ||
54 | |||
55 | return ret; | ||
56 | } | ||
57 | |||
58 | unsigned short ec3104_inw(unsigned long port) | ||
59 | { | ||
60 | BUG(); | ||
61 | } | ||
62 | |||
63 | unsigned long ec3104_inl(unsigned long port) | ||
64 | { | ||
65 | BUG(); | ||
66 | } | ||
67 | |||
68 | void ec3104_outb(unsigned char data, unsigned long port) | ||
69 | { | ||
70 | *(volatile u8 *)port2addr(port) = data; | ||
71 | } | ||
72 | |||
73 | void ec3104_outw(unsigned short data, unsigned long port) | ||
74 | { | ||
75 | BUG(); | ||
76 | } | ||
77 | |||
78 | void ec3104_outl(unsigned long data, unsigned long port) | ||
79 | { | ||
80 | BUG(); | ||
81 | } | ||
diff --git a/arch/sh/boards/ec3104/irq.c b/arch/sh/boards/ec3104/irq.c deleted file mode 100644 index ffa4ff1f090f..000000000000 --- a/arch/sh/boards/ec3104/irq.c +++ /dev/null | |||
@@ -1,196 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/ec3104/irq.c | ||
3 | * EC3104 companion chip support | ||
4 | * | ||
5 | * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #include <asm/io.h> | ||
10 | #include <asm/irq.h> | ||
11 | #include <asm/ec3104/ec3104.h> | ||
12 | |||
13 | /* This is for debugging mostly; here's the table that I intend to keep | ||
14 | * in here: | ||
15 | * | ||
16 | * index function base addr power interrupt bit | ||
17 | * 0 power b0ec0000 --- 00000001 (unused) | ||
18 | * 1 irqs b0ec1000 --- 00000002 (unused) | ||
19 | * 2 ?? b0ec2000 b0ec0008 00000004 | ||
20 | * 3 PS2 (1) b0ec3000 b0ec000c 00000008 | ||
21 | * 4 PS2 (2) b0ec4000 b0ec0010 00000010 | ||
22 | * 5 ?? b0ec5000 b0ec0014 00000020 | ||
23 | * 6 I2C b0ec6000 b0ec0018 00000040 | ||
24 | * 7 serial (1) b0ec7000 b0ec001c 00000080 | ||
25 | * 8 serial (2) b0ec8000 b0ec0020 00000100 | ||
26 | * 9 serial (3) b0ec9000 b0ec0024 00000200 | ||
27 | * 10 serial (4) b0eca000 b0ec0028 00000400 | ||
28 | * 12 GPIO (1) b0ecc000 b0ec0030 | ||
29 | * 13 GPIO (2) b0ecc000 b0ec0030 | ||
30 | * 16 pcmcia (1) b0ed0000 b0ec0040 00010000 | ||
31 | * 17 pcmcia (2) b0ed1000 b0ec0044 00020000 | ||
32 | */ | ||
33 | |||
34 | /* I used the register names from another interrupt controller I worked with, | ||
35 | * since it seems to be identical to the ec3104 except that all bits are | ||
36 | * inverted: | ||
37 | * | ||
38 | * IRR: Interrupt Request Register (pending and enabled interrupts) | ||
39 | * IMR: Interrupt Mask Register (which interrupts are enabled) | ||
40 | * IPR: Interrupt Pending Register (pending interrupts, even disabled ones) | ||
41 | * | ||
42 | * 0 bits mean pending or enabled, 1 bits mean not pending or disabled. all | ||
43 | * IRQs seem to be level-triggered. | ||
44 | */ | ||
45 | |||
46 | #define EC3104_IRR (EC3104_BASE + 0x1000) | ||
47 | #define EC3104_IMR (EC3104_BASE + 0x1004) | ||
48 | #define EC3104_IPR (EC3104_BASE + 0x1008) | ||
49 | |||
50 | #define ctrl_readl(addr) (*(volatile u32 *)(addr)) | ||
51 | #define ctrl_writel(data,addr) (*(volatile u32 *)(addr) = (data)) | ||
52 | #define ctrl_readb(addr) (*(volatile u8 *)(addr)) | ||
53 | |||
54 | static char *ec3104_name(unsigned index) | ||
55 | { | ||
56 | switch(index) { | ||
57 | case 0: | ||
58 | return "power management"; | ||
59 | case 1: | ||
60 | return "interrupts"; | ||
61 | case 3: | ||
62 | return "PS2 (1)"; | ||
63 | case 4: | ||
64 | return "PS2 (2)"; | ||
65 | case 5: | ||
66 | return "I2C (1)"; | ||
67 | case 6: | ||
68 | return "I2C (2)"; | ||
69 | case 7: | ||
70 | return "serial (1)"; | ||
71 | case 8: | ||
72 | return "serial (2)"; | ||
73 | case 9: | ||
74 | return "serial (3)"; | ||
75 | case 10: | ||
76 | return "serial (4)"; | ||
77 | case 16: | ||
78 | return "pcmcia (1)"; | ||
79 | case 17: | ||
80 | return "pcmcia (2)"; | ||
81 | default: { | ||
82 | static char buf[32]; | ||
83 | |||
84 | sprintf(buf, "unknown (%d)", index); | ||
85 | |||
86 | return buf; | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | int get_pending_interrupts(char *buf) | ||
92 | { | ||
93 | u32 ipr; | ||
94 | u32 bit; | ||
95 | char *p = buf; | ||
96 | |||
97 | p += sprintf(p, "pending: ("); | ||
98 | |||
99 | ipr = ctrl_inl(EC3104_IPR); | ||
100 | |||
101 | for (bit = 1; bit < 32; bit++) | ||
102 | if (!(ipr & (1<<bit))) | ||
103 | p += sprintf(p, "%s ", ec3104_name(bit)); | ||
104 | |||
105 | p += sprintf(p, ")\n"); | ||
106 | |||
107 | return p - buf; | ||
108 | } | ||
109 | |||
110 | static inline u32 ec3104_irq2mask(unsigned int irq) | ||
111 | { | ||
112 | return (1 << (irq - EC3104_IRQBASE)); | ||
113 | } | ||
114 | |||
115 | static inline void mask_ec3104_irq(unsigned int irq) | ||
116 | { | ||
117 | u32 mask; | ||
118 | |||
119 | mask = ctrl_readl(EC3104_IMR); | ||
120 | |||
121 | mask |= ec3104_irq2mask(irq); | ||
122 | |||
123 | ctrl_writel(mask, EC3104_IMR); | ||
124 | } | ||
125 | |||
126 | static inline void unmask_ec3104_irq(unsigned int irq) | ||
127 | { | ||
128 | u32 mask; | ||
129 | |||
130 | mask = ctrl_readl(EC3104_IMR); | ||
131 | |||
132 | mask &= ~ec3104_irq2mask(irq); | ||
133 | |||
134 | ctrl_writel(mask, EC3104_IMR); | ||
135 | } | ||
136 | |||
137 | static void disable_ec3104_irq(unsigned int irq) | ||
138 | { | ||
139 | mask_ec3104_irq(irq); | ||
140 | } | ||
141 | |||
142 | static void enable_ec3104_irq(unsigned int irq) | ||
143 | { | ||
144 | unmask_ec3104_irq(irq); | ||
145 | } | ||
146 | |||
147 | static void mask_and_ack_ec3104_irq(unsigned int irq) | ||
148 | { | ||
149 | mask_ec3104_irq(irq); | ||
150 | } | ||
151 | |||
152 | static void end_ec3104_irq(unsigned int irq) | ||
153 | { | ||
154 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | ||
155 | unmask_ec3104_irq(irq); | ||
156 | } | ||
157 | |||
158 | static unsigned int startup_ec3104_irq(unsigned int irq) | ||
159 | { | ||
160 | unmask_ec3104_irq(irq); | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
165 | static void shutdown_ec3104_irq(unsigned int irq) | ||
166 | { | ||
167 | mask_ec3104_irq(irq); | ||
168 | |||
169 | } | ||
170 | |||
171 | static struct hw_interrupt_type ec3104_int = { | ||
172 | .typename = "EC3104", | ||
173 | .enable = enable_ec3104_irq, | ||
174 | .disable = disable_ec3104_irq, | ||
175 | .ack = mask_and_ack_ec3104_irq, | ||
176 | .end = end_ec3104_irq, | ||
177 | .startup = startup_ec3104_irq, | ||
178 | .shutdown = shutdown_ec3104_irq, | ||
179 | }; | ||
180 | |||
181 | /* Yuck. the _demux API is ugly */ | ||
182 | int ec3104_irq_demux(int irq) | ||
183 | { | ||
184 | if (irq == EC3104_IRQ) { | ||
185 | unsigned int mask; | ||
186 | |||
187 | mask = ctrl_readl(EC3104_IRR); | ||
188 | |||
189 | if (mask == 0xffffffff) | ||
190 | return EC3104_IRQ; | ||
191 | else | ||
192 | return EC3104_IRQBASE + ffz(mask); | ||
193 | } | ||
194 | |||
195 | return irq; | ||
196 | } | ||
diff --git a/arch/sh/boards/ec3104/setup.c b/arch/sh/boards/ec3104/setup.c deleted file mode 100644 index 902bc975a13e..000000000000 --- a/arch/sh/boards/ec3104/setup.c +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/ec3104/setup.c | ||
3 | * EC3104 companion chip support | ||
4 | * | ||
5 | * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> | ||
6 | * | ||
7 | */ | ||
8 | /* EC3104 note: | ||
9 | * This code was written without any documentation about the EC3104 chip. While | ||
10 | * I hope I got most of the basic functionality right, the register names I use | ||
11 | * are most likely completely different from those in the chip documentation. | ||
12 | * | ||
13 | * If you have any further information about the EC3104, please tell me | ||
14 | * (prumpf@tux.org). | ||
15 | */ | ||
16 | |||
17 | #include <linux/sched.h> | ||
18 | #include <linux/kernel.h> | ||
19 | #include <linux/param.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/irq.h> | ||
23 | #include <linux/types.h> | ||
24 | #include <asm/io.h> | ||
25 | #include <asm/irq.h> | ||
26 | #include <asm/machvec.h> | ||
27 | #include <asm/mach/ec3104.h> | ||
28 | |||
29 | static void __init ec3104_setup(char **cmdline_p) | ||
30 | { | ||
31 | char str[8]; | ||
32 | int i; | ||
33 | |||
34 | for (i=0; i<8; i++) | ||
35 | str[i] = ctrl_readb(EC3104_BASE + i); | ||
36 | |||
37 | for (i = EC3104_IRQBASE; i < EC3104_IRQBASE + 32; i++) | ||
38 | irq_desc[i].handler = &ec3104_int; | ||
39 | |||
40 | printk("initializing EC3104 \"%.8s\" at %08x, IRQ %d, IRQ base %d\n", | ||
41 | str, EC3104_BASE, EC3104_IRQ, EC3104_IRQBASE); | ||
42 | |||
43 | /* mask all interrupts. this should have been done by the boot | ||
44 | * loader for us but we want to be sure ... */ | ||
45 | ctrl_writel(0xffffffff, EC3104_IMR); | ||
46 | } | ||
47 | |||
48 | /* | ||
49 | * The Machine Vector | ||
50 | */ | ||
51 | struct sh_machine_vector mv_ec3104 __initmv = { | ||
52 | .mv_name = "EC3104", | ||
53 | .mv_setup = ec3104_setup, | ||
54 | .mv_nr_irqs = 96, | ||
55 | |||
56 | .mv_inb = ec3104_inb, | ||
57 | .mv_inw = ec3104_inw, | ||
58 | .mv_inl = ec3104_inl, | ||
59 | .mv_outb = ec3104_outb, | ||
60 | .mv_outw = ec3104_outw, | ||
61 | .mv_outl = ec3104_outl, | ||
62 | |||
63 | .mv_irq_demux = ec3104_irq_demux, | ||
64 | }; | ||
65 | ALIAS_MV(ec3104) | ||