diff options
Diffstat (limited to 'arch/sh/boards/se')
25 files changed, 764 insertions, 515 deletions
diff --git a/arch/sh/boards/se/7300/io.c b/arch/sh/boards/se/7300/io.c index f449a94ddffd..8a03d7a52a7c 100644 --- a/arch/sh/boards/se/7300/io.c +++ b/arch/sh/boards/se/7300/io.c | |||
@@ -9,8 +9,8 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <asm/mach/se7300.h> | ||
13 | #include <asm/io.h> | 12 | #include <asm/io.h> |
13 | #include <asm/se7300.h> | ||
14 | 14 | ||
15 | #define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a) | 15 | #define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a) |
16 | 16 | ||
@@ -99,6 +99,7 @@ bad_outb(struct iop *p, unsigned char value, unsigned long port) | |||
99 | badio(inw, port); | 99 | badio(inw, port); |
100 | } | 100 | } |
101 | 101 | ||
102 | #ifdef CONFIG_SMC91X | ||
102 | /* MSTLANEX01 LAN at 0xb400:0000 */ | 103 | /* MSTLANEX01 LAN at 0xb400:0000 */ |
103 | static struct iop laniop = { | 104 | static struct iop laniop = { |
104 | .start = 0x300, | 105 | .start = 0x300, |
@@ -110,6 +111,7 @@ static struct iop laniop = { | |||
110 | .outb = simple_outb, | 111 | .outb = simple_outb, |
111 | .outw = simple_outw, | 112 | .outw = simple_outw, |
112 | }; | 113 | }; |
114 | #endif | ||
113 | 115 | ||
114 | /* NE2000 pc card NIC */ | 116 | /* NE2000 pc card NIC */ |
115 | static struct iop neiop = { | 117 | static struct iop neiop = { |
@@ -123,6 +125,7 @@ static struct iop neiop = { | |||
123 | .outw = simple_outw, | 125 | .outw = simple_outw, |
124 | }; | 126 | }; |
125 | 127 | ||
128 | #ifdef CONFIG_IDE | ||
126 | /* CF in CF slot */ | 129 | /* CF in CF slot */ |
127 | static struct iop cfiop = { | 130 | static struct iop cfiop = { |
128 | .base = 0xb0600000, | 131 | .base = 0xb0600000, |
@@ -132,12 +135,13 @@ static struct iop cfiop = { | |||
132 | .outb = pcc_outb, | 135 | .outb = pcc_outb, |
133 | .outw = simple_outw, | 136 | .outw = simple_outw, |
134 | }; | 137 | }; |
138 | #endif | ||
135 | 139 | ||
136 | static __inline__ struct iop * | 140 | static __inline__ struct iop * |
137 | port2iop(unsigned long port) | 141 | port2iop(unsigned long port) |
138 | { | 142 | { |
139 | if (0) ; | 143 | if (0) ; |
140 | #if defined(CONFIG_SMC91111) | 144 | #if defined(CONFIG_SMC91X) |
141 | else if (laniop.check(&laniop, port)) | 145 | else if (laniop.check(&laniop, port)) |
142 | return &laniop; | 146 | return &laniop; |
143 | #endif | 147 | #endif |
diff --git a/arch/sh/boards/se/7300/irq.c b/arch/sh/boards/se/7300/irq.c index 216a78d1a108..ad1034f98a29 100644 --- a/arch/sh/boards/se/7300/irq.c +++ b/arch/sh/boards/se/7300/irq.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
12 | #include <asm/irq.h> | 12 | #include <asm/irq.h> |
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/mach/se7300.h> | 14 | #include <asm/se7300.h> |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * Initialize IRQ setting | 17 | * Initialize IRQ setting |
diff --git a/arch/sh/boards/se/7300/led.c b/arch/sh/boards/se/7300/led.c index ad51f0a9c1e3..4d03bb7774be 100644 --- a/arch/sh/boards/se/7300/led.c +++ b/arch/sh/boards/se/7300/led.c | |||
@@ -12,24 +12,10 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <asm/mach/se7300.h> | 15 | #include <asm/se7300.h> |
16 | |||
17 | static void | ||
18 | mach_led(int position, int value) | ||
19 | { | ||
20 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; | ||
21 | |||
22 | if (value) { | ||
23 | *p |= (1 << 8); | ||
24 | } else { | ||
25 | *p &= ~(1 << 8); | ||
26 | } | ||
27 | } | ||
28 | |||
29 | 16 | ||
30 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | 17 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ |
31 | void | 18 | void heartbeat_7300se(void) |
32 | heartbeat_7300se(void) | ||
33 | { | 19 | { |
34 | static unsigned int cnt = 0, period = 0; | 20 | static unsigned int cnt = 0, period = 0; |
35 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; | 21 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; |
diff --git a/arch/sh/boards/se/7300/setup.c b/arch/sh/boards/se/7300/setup.c index ebcd98d4c081..6f082a722d42 100644 --- a/arch/sh/boards/se/7300/setup.c +++ b/arch/sh/boards/se/7300/setup.c | |||
@@ -9,23 +9,16 @@ | |||
9 | 9 | ||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <asm/machvec.h> | 11 | #include <asm/machvec.h> |
12 | #include <asm/machvec_init.h> | 12 | #include <asm/se7300.h> |
13 | #include <asm/mach/io.h> | ||
14 | 13 | ||
15 | void heartbeat_7300se(void); | 14 | void heartbeat_7300se(void); |
16 | void init_7300se_IRQ(void); | 15 | void init_7300se_IRQ(void); |
17 | 16 | ||
18 | const char * | ||
19 | get_system_type(void) | ||
20 | { | ||
21 | return "SolutionEngine 7300"; | ||
22 | } | ||
23 | |||
24 | /* | 17 | /* |
25 | * The Machine Vector | 18 | * The Machine Vector |
26 | */ | 19 | */ |
27 | |||
28 | struct sh_machine_vector mv_7300se __initmv = { | 20 | struct sh_machine_vector mv_7300se __initmv = { |
21 | .mv_name = "SolutionEngine 7300", | ||
29 | .mv_nr_irqs = 109, | 22 | .mv_nr_irqs = 109, |
30 | .mv_inb = sh7300se_inb, | 23 | .mv_inb = sh7300se_inb, |
31 | .mv_inw = sh7300se_inw, | 24 | .mv_inw = sh7300se_inw, |
@@ -53,13 +46,4 @@ struct sh_machine_vector mv_7300se __initmv = { | |||
53 | .mv_heartbeat = heartbeat_7300se, | 46 | .mv_heartbeat = heartbeat_7300se, |
54 | #endif | 47 | #endif |
55 | }; | 48 | }; |
56 | |||
57 | ALIAS_MV(7300se) | 49 | ALIAS_MV(7300se) |
58 | /* | ||
59 | * Initialize the board | ||
60 | */ | ||
61 | void __init | ||
62 | platform_setup(void) | ||
63 | { | ||
64 | |||
65 | } | ||
diff --git a/arch/sh/boards/se/73180/io.c b/arch/sh/boards/se/73180/io.c index 755df5ac4a4e..72715575458b 100644 --- a/arch/sh/boards/se/73180/io.c +++ b/arch/sh/boards/se/73180/io.c | |||
@@ -99,6 +99,7 @@ bad_outb(struct iop *p, unsigned char value, unsigned long port) | |||
99 | badio(inw, port); | 99 | badio(inw, port); |
100 | } | 100 | } |
101 | 101 | ||
102 | #ifdef CONFIG_SMC91X | ||
102 | /* MSTLANEX01 LAN at 0xb400:0000 */ | 103 | /* MSTLANEX01 LAN at 0xb400:0000 */ |
103 | static struct iop laniop = { | 104 | static struct iop laniop = { |
104 | .start = 0x300, | 105 | .start = 0x300, |
@@ -110,6 +111,7 @@ static struct iop laniop = { | |||
110 | .outb = simple_outb, | 111 | .outb = simple_outb, |
111 | .outw = simple_outw, | 112 | .outw = simple_outw, |
112 | }; | 113 | }; |
114 | #endif | ||
113 | 115 | ||
114 | /* NE2000 pc card NIC */ | 116 | /* NE2000 pc card NIC */ |
115 | static struct iop neiop = { | 117 | static struct iop neiop = { |
@@ -123,6 +125,7 @@ static struct iop neiop = { | |||
123 | .outw = simple_outw, | 125 | .outw = simple_outw, |
124 | }; | 126 | }; |
125 | 127 | ||
128 | #ifdef CONFIG_IDE | ||
126 | /* CF in CF slot */ | 129 | /* CF in CF slot */ |
127 | static struct iop cfiop = { | 130 | static struct iop cfiop = { |
128 | .base = 0xb0600000, | 131 | .base = 0xb0600000, |
@@ -132,12 +135,13 @@ static struct iop cfiop = { | |||
132 | .outb = pcc_outb, | 135 | .outb = pcc_outb, |
133 | .outw = simple_outw, | 136 | .outw = simple_outw, |
134 | }; | 137 | }; |
138 | #endif | ||
135 | 139 | ||
136 | static __inline__ struct iop * | 140 | static __inline__ struct iop * |
137 | port2iop(unsigned long port) | 141 | port2iop(unsigned long port) |
138 | { | 142 | { |
139 | if (0) ; | 143 | if (0) ; |
140 | #if defined(CONFIG_SMC91111) | 144 | #if defined(CONFIG_SMC91X) |
141 | else if (laniop.check(&laniop, port)) | 145 | else if (laniop.check(&laniop, port)) |
142 | return &laniop; | 146 | return &laniop; |
143 | #endif | 147 | #endif |
diff --git a/arch/sh/boards/se/73180/irq.c b/arch/sh/boards/se/73180/irq.c index 4344d0ef24aa..2c62b8ea350e 100644 --- a/arch/sh/boards/se/73180/irq.c +++ b/arch/sh/boards/se/73180/irq.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * Modified for SH-Mobile SolutionEngine 73180 Support | 7 | * Modified for SH-Mobile SolutionEngine 73180 Support |
8 | * by YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp> | 8 | * by YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp> |
9 | * | 9 | * |
10 | * | ||
11 | */ | 10 | */ |
12 | 11 | ||
13 | #include <linux/init.h> | 12 | #include <linux/init.h> |
@@ -17,14 +16,6 @@ | |||
17 | #include <asm/mach/se73180.h> | 16 | #include <asm/mach/se73180.h> |
18 | 17 | ||
19 | static int | 18 | static int |
20 | intreq2irq(int i) | ||
21 | { | ||
22 | if (i == 5) | ||
23 | return 10; | ||
24 | return 32 + 7 - i; | ||
25 | } | ||
26 | |||
27 | static int | ||
28 | irq2intreq(int irq) | 19 | irq2intreq(int irq) |
29 | { | 20 | { |
30 | if (irq == 10) | 21 | if (irq == 10) |
diff --git a/arch/sh/boards/se/73180/led.c b/arch/sh/boards/se/73180/led.c index 610439fde6ee..4b72e9a3ead9 100644 --- a/arch/sh/boards/se/73180/led.c +++ b/arch/sh/boards/se/73180/led.c | |||
@@ -14,21 +14,8 @@ | |||
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <asm/mach/se73180.h> | 15 | #include <asm/mach/se73180.h> |
16 | 16 | ||
17 | static void | ||
18 | mach_led(int position, int value) | ||
19 | { | ||
20 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; | ||
21 | |||
22 | if (value) { | ||
23 | *p |= (1 << LED_SHIFT); | ||
24 | } else { | ||
25 | *p &= ~(1 << LED_SHIFT); | ||
26 | } | ||
27 | } | ||
28 | |||
29 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | 17 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ |
30 | void | 18 | void heartbeat_73180se(void) |
31 | heartbeat_73180se(void) | ||
32 | { | 19 | { |
33 | static unsigned int cnt = 0, period = 0; | 20 | static unsigned int cnt = 0, period = 0; |
34 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; | 21 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; |
diff --git a/arch/sh/boards/se/73180/setup.c b/arch/sh/boards/se/73180/setup.c index cdb7b5f8d942..b38ef50a160a 100644 --- a/arch/sh/boards/se/73180/setup.c +++ b/arch/sh/boards/se/73180/setup.c | |||
@@ -11,23 +11,17 @@ | |||
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <asm/machvec.h> | 13 | #include <asm/machvec.h> |
14 | #include <asm/machvec_init.h> | 14 | #include <asm/se73180.h> |
15 | #include <asm/mach/io.h> | 15 | #include <asm/irq.h> |
16 | 16 | ||
17 | void heartbeat_73180se(void); | 17 | void heartbeat_73180se(void); |
18 | void init_73180se_IRQ(void); | 18 | void init_73180se_IRQ(void); |
19 | 19 | ||
20 | const char * | ||
21 | get_system_type(void) | ||
22 | { | ||
23 | return "SolutionEngine 73180"; | ||
24 | } | ||
25 | |||
26 | /* | 20 | /* |
27 | * The Machine Vector | 21 | * The Machine Vector |
28 | */ | 22 | */ |
29 | |||
30 | struct sh_machine_vector mv_73180se __initmv = { | 23 | struct sh_machine_vector mv_73180se __initmv = { |
24 | .mv_name = "SolutionEngine 73180", | ||
31 | .mv_nr_irqs = 108, | 25 | .mv_nr_irqs = 108, |
32 | .mv_inb = sh73180se_inb, | 26 | .mv_inb = sh73180se_inb, |
33 | .mv_inw = sh73180se_inw, | 27 | .mv_inw = sh73180se_inw, |
@@ -51,17 +45,9 @@ struct sh_machine_vector mv_73180se __initmv = { | |||
51 | .mv_outsl = sh73180se_outsl, | 45 | .mv_outsl = sh73180se_outsl, |
52 | 46 | ||
53 | .mv_init_irq = init_73180se_IRQ, | 47 | .mv_init_irq = init_73180se_IRQ, |
48 | .mv_irq_demux = shmse_irq_demux, | ||
54 | #ifdef CONFIG_HEARTBEAT | 49 | #ifdef CONFIG_HEARTBEAT |
55 | .mv_heartbeat = heartbeat_73180se, | 50 | .mv_heartbeat = heartbeat_73180se, |
56 | #endif | 51 | #endif |
57 | }; | 52 | }; |
58 | |||
59 | ALIAS_MV(73180se) | 53 | ALIAS_MV(73180se) |
60 | /* | ||
61 | * Initialize the board | ||
62 | */ | ||
63 | void __init | ||
64 | platform_setup(void) | ||
65 | { | ||
66 | |||
67 | } | ||
diff --git a/arch/sh/boards/se/7343/Makefile b/arch/sh/boards/se/7343/Makefile new file mode 100644 index 000000000000..4291069c0b4f --- /dev/null +++ b/arch/sh/boards/se/7343/Makefile | |||
@@ -0,0 +1,7 @@ | |||
1 | # | ||
2 | # Makefile for the 7343 SolutionEngine specific parts of the kernel | ||
3 | # | ||
4 | |||
5 | obj-y := setup.o io.o irq.o | ||
6 | |||
7 | obj-$(CONFIG_HEARTBEAT) += led.o | ||
diff --git a/arch/sh/boards/se/7343/io.c b/arch/sh/boards/se/7343/io.c new file mode 100644 index 000000000000..646661a146ad --- /dev/null +++ b/arch/sh/boards/se/7343/io.c | |||
@@ -0,0 +1,275 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/se/7343/io.c | ||
3 | * | ||
4 | * I/O routine for SH-Mobile3AS 7343 SolutionEngine. | ||
5 | * | ||
6 | */ | ||
7 | |||
8 | #include <linux/config.h> | ||
9 | #include <linux/kernel.h> | ||
10 | #include <asm/io.h> | ||
11 | #include <asm/mach/se7343.h> | ||
12 | |||
13 | #define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a) | ||
14 | |||
15 | struct iop { | ||
16 | unsigned long start, end; | ||
17 | unsigned long base; | ||
18 | struct iop *(*check) (struct iop * p, unsigned long port); | ||
19 | unsigned char (*inb) (struct iop * p, unsigned long port); | ||
20 | unsigned short (*inw) (struct iop * p, unsigned long port); | ||
21 | void (*outb) (struct iop * p, unsigned char value, unsigned long port); | ||
22 | void (*outw) (struct iop * p, unsigned short value, unsigned long port); | ||
23 | }; | ||
24 | |||
25 | struct iop * | ||
26 | simple_check(struct iop *p, unsigned long port) | ||
27 | { | ||
28 | static int count; | ||
29 | |||
30 | if (count < 100) | ||
31 | count++; | ||
32 | |||
33 | port &= 0xFFFF; | ||
34 | |||
35 | if ((p->start <= port) && (port <= p->end)) | ||
36 | return p; | ||
37 | else | ||
38 | badio(check, port); | ||
39 | } | ||
40 | |||
41 | struct iop * | ||
42 | ide_check(struct iop *p, unsigned long port) | ||
43 | { | ||
44 | if (((0x1f0 <= port) && (port <= 0x1f7)) || (port == 0x3f7)) | ||
45 | return p; | ||
46 | return NULL; | ||
47 | } | ||
48 | |||
49 | unsigned char | ||
50 | simple_inb(struct iop *p, unsigned long port) | ||
51 | { | ||
52 | return *(unsigned char *) (p->base + port); | ||
53 | } | ||
54 | |||
55 | unsigned short | ||
56 | simple_inw(struct iop *p, unsigned long port) | ||
57 | { | ||
58 | return *(unsigned short *) (p->base + port); | ||
59 | } | ||
60 | |||
61 | void | ||
62 | simple_outb(struct iop *p, unsigned char value, unsigned long port) | ||
63 | { | ||
64 | *(unsigned char *) (p->base + port) = value; | ||
65 | } | ||
66 | |||
67 | void | ||
68 | simple_outw(struct iop *p, unsigned short value, unsigned long port) | ||
69 | { | ||
70 | *(unsigned short *) (p->base + port) = value; | ||
71 | } | ||
72 | |||
73 | unsigned char | ||
74 | pcc_inb(struct iop *p, unsigned long port) | ||
75 | { | ||
76 | unsigned long addr = p->base + port + 0x40000; | ||
77 | unsigned long v; | ||
78 | |||
79 | if (port & 1) | ||
80 | addr += 0x00400000; | ||
81 | v = *(volatile unsigned char *) addr; | ||
82 | return v; | ||
83 | } | ||
84 | |||
85 | void | ||
86 | pcc_outb(struct iop *p, unsigned char value, unsigned long port) | ||
87 | { | ||
88 | unsigned long addr = p->base + port + 0x40000; | ||
89 | |||
90 | if (port & 1) | ||
91 | addr += 0x00400000; | ||
92 | *(volatile unsigned char *) addr = value; | ||
93 | } | ||
94 | |||
95 | unsigned char | ||
96 | bad_inb(struct iop *p, unsigned long port) | ||
97 | { | ||
98 | badio(inb, port); | ||
99 | } | ||
100 | |||
101 | void | ||
102 | bad_outb(struct iop *p, unsigned char value, unsigned long port) | ||
103 | { | ||
104 | badio(inw, port); | ||
105 | } | ||
106 | |||
107 | #ifdef CONFIG_SMC91X | ||
108 | /* MSTLANEX01 LAN at 0xb400:0000 */ | ||
109 | static struct iop laniop = { | ||
110 | .start = 0x00, | ||
111 | .end = 0x0F, | ||
112 | .base = 0x04000000, | ||
113 | .check = simple_check, | ||
114 | .inb = simple_inb, | ||
115 | .inw = simple_inw, | ||
116 | .outb = simple_outb, | ||
117 | .outw = simple_outw, | ||
118 | }; | ||
119 | #endif | ||
120 | |||
121 | #ifdef CONFIG_NE2000 | ||
122 | /* NE2000 pc card NIC */ | ||
123 | static struct iop neiop = { | ||
124 | .start = 0x280, | ||
125 | .end = 0x29f, | ||
126 | .base = 0xb0600000 + 0x80, /* soft 0x280 -> hard 0x300 */ | ||
127 | .check = simple_check, | ||
128 | .inb = pcc_inb, | ||
129 | .inw = simple_inw, | ||
130 | .outb = pcc_outb, | ||
131 | .outw = simple_outw, | ||
132 | }; | ||
133 | #endif | ||
134 | |||
135 | #ifdef CONFIG_IDE | ||
136 | /* CF in CF slot */ | ||
137 | static struct iop cfiop = { | ||
138 | .base = 0xb0600000, | ||
139 | .check = ide_check, | ||
140 | .inb = pcc_inb, | ||
141 | .inw = simple_inw, | ||
142 | .outb = pcc_outb, | ||
143 | .outw = simple_outw, | ||
144 | }; | ||
145 | #endif | ||
146 | |||
147 | static __inline__ struct iop * | ||
148 | port2iop(unsigned long port) | ||
149 | { | ||
150 | if (0) ; | ||
151 | #if defined(CONFIG_SMC91X) | ||
152 | else if (laniop.check(&laniop, port)) | ||
153 | return &laniop; | ||
154 | #endif | ||
155 | #if defined(CONFIG_NE2000) | ||
156 | else if (neiop.check(&neiop, port)) | ||
157 | return &neiop; | ||
158 | #endif | ||
159 | #if defined(CONFIG_IDE) | ||
160 | else if (cfiop.check(&cfiop, port)) | ||
161 | return &cfiop; | ||
162 | #endif | ||
163 | else | ||
164 | return NULL; | ||
165 | } | ||
166 | |||
167 | static inline void | ||
168 | delay(void) | ||
169 | { | ||
170 | ctrl_inw(0xac000000); | ||
171 | ctrl_inw(0xac000000); | ||
172 | } | ||
173 | |||
174 | unsigned char | ||
175 | sh7343se_inb(unsigned long port) | ||
176 | { | ||
177 | struct iop *p = port2iop(port); | ||
178 | return (p->inb) (p, port); | ||
179 | } | ||
180 | |||
181 | unsigned char | ||
182 | sh7343se_inb_p(unsigned long port) | ||
183 | { | ||
184 | unsigned char v = sh7343se_inb(port); | ||
185 | delay(); | ||
186 | return v; | ||
187 | } | ||
188 | |||
189 | unsigned short | ||
190 | sh7343se_inw(unsigned long port) | ||
191 | { | ||
192 | struct iop *p = port2iop(port); | ||
193 | return (p->inw) (p, port); | ||
194 | } | ||
195 | |||
196 | unsigned int | ||
197 | sh7343se_inl(unsigned long port) | ||
198 | { | ||
199 | badio(inl, port); | ||
200 | } | ||
201 | |||
202 | void | ||
203 | sh7343se_outb(unsigned char value, unsigned long port) | ||
204 | { | ||
205 | struct iop *p = port2iop(port); | ||
206 | (p->outb) (p, value, port); | ||
207 | } | ||
208 | |||
209 | void | ||
210 | sh7343se_outb_p(unsigned char value, unsigned long port) | ||
211 | { | ||
212 | sh7343se_outb(value, port); | ||
213 | delay(); | ||
214 | } | ||
215 | |||
216 | void | ||
217 | sh7343se_outw(unsigned short value, unsigned long port) | ||
218 | { | ||
219 | struct iop *p = port2iop(port); | ||
220 | (p->outw) (p, value, port); | ||
221 | } | ||
222 | |||
223 | void | ||
224 | sh7343se_outl(unsigned int value, unsigned long port) | ||
225 | { | ||
226 | badio(outl, port); | ||
227 | } | ||
228 | |||
229 | void | ||
230 | sh7343se_insb(unsigned long port, void *addr, unsigned long count) | ||
231 | { | ||
232 | unsigned char *a = addr; | ||
233 | struct iop *p = port2iop(port); | ||
234 | while (count--) | ||
235 | *a++ = (p->inb) (p, port); | ||
236 | } | ||
237 | |||
238 | void | ||
239 | sh7343se_insw(unsigned long port, void *addr, unsigned long count) | ||
240 | { | ||
241 | unsigned short *a = addr; | ||
242 | struct iop *p = port2iop(port); | ||
243 | while (count--) | ||
244 | *a++ = (p->inw) (p, port); | ||
245 | } | ||
246 | |||
247 | void | ||
248 | sh7343se_insl(unsigned long port, void *addr, unsigned long count) | ||
249 | { | ||
250 | badio(insl, port); | ||
251 | } | ||
252 | |||
253 | void | ||
254 | sh7343se_outsb(unsigned long port, const void *addr, unsigned long count) | ||
255 | { | ||
256 | unsigned char *a = (unsigned char *) addr; | ||
257 | struct iop *p = port2iop(port); | ||
258 | while (count--) | ||
259 | (p->outb) (p, *a++, port); | ||
260 | } | ||
261 | |||
262 | void | ||
263 | sh7343se_outsw(unsigned long port, const void *addr, unsigned long count) | ||
264 | { | ||
265 | unsigned short *a = (unsigned short *) addr; | ||
266 | struct iop *p = port2iop(port); | ||
267 | while (count--) | ||
268 | (p->outw) (p, *a++, port); | ||
269 | } | ||
270 | |||
271 | void | ||
272 | sh7343se_outsl(unsigned long port, const void *addr, unsigned long count) | ||
273 | { | ||
274 | badio(outsw, port); | ||
275 | } | ||
diff --git a/arch/sh/boards/se/7343/irq.c b/arch/sh/boards/se/7343/irq.c new file mode 100644 index 000000000000..b41e3d4ea37c --- /dev/null +++ b/arch/sh/boards/se/7343/irq.c | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/se/7343/irq.c | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #include <linux/config.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/interrupt.h> | ||
9 | #include <linux/irq.h> | ||
10 | #include <asm/irq.h> | ||
11 | #include <asm/io.h> | ||
12 | #include <asm/mach/se7343.h> | ||
13 | |||
14 | static void | ||
15 | disable_intreq_irq(unsigned int irq) | ||
16 | { | ||
17 | int bit = irq - OFFCHIP_IRQ_BASE; | ||
18 | u16 val; | ||
19 | |||
20 | val = ctrl_inw(PA_CPLD_IMSK); | ||
21 | val |= 1 << bit; | ||
22 | ctrl_outw(val, PA_CPLD_IMSK); | ||
23 | } | ||
24 | |||
25 | static void | ||
26 | enable_intreq_irq(unsigned int irq) | ||
27 | { | ||
28 | int bit = irq - OFFCHIP_IRQ_BASE; | ||
29 | u16 val; | ||
30 | |||
31 | val = ctrl_inw(PA_CPLD_IMSK); | ||
32 | val &= ~(1 << bit); | ||
33 | ctrl_outw(val, PA_CPLD_IMSK); | ||
34 | } | ||
35 | |||
36 | static void | ||
37 | mask_and_ack_intreq_irq(unsigned int irq) | ||
38 | { | ||
39 | disable_intreq_irq(irq); | ||
40 | } | ||
41 | |||
42 | static unsigned int | ||
43 | startup_intreq_irq(unsigned int irq) | ||
44 | { | ||
45 | enable_intreq_irq(irq); | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | static void | ||
50 | shutdown_intreq_irq(unsigned int irq) | ||
51 | { | ||
52 | disable_intreq_irq(irq); | ||
53 | } | ||
54 | |||
55 | static void | ||
56 | end_intreq_irq(unsigned int irq) | ||
57 | { | ||
58 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
59 | enable_intreq_irq(irq); | ||
60 | } | ||
61 | |||
62 | static struct hw_interrupt_type intreq_irq_type = { | ||
63 | .typename = "FPGA-IRQ", | ||
64 | .startup = startup_intreq_irq, | ||
65 | .shutdown = shutdown_intreq_irq, | ||
66 | .enable = enable_intreq_irq, | ||
67 | .disable = disable_intreq_irq, | ||
68 | .ack = mask_and_ack_intreq_irq, | ||
69 | .end = end_intreq_irq | ||
70 | }; | ||
71 | |||
72 | static void | ||
73 | make_intreq_irq(unsigned int irq) | ||
74 | { | ||
75 | disable_irq_nosync(irq); | ||
76 | irq_desc[irq].handler = &intreq_irq_type; | ||
77 | disable_intreq_irq(irq); | ||
78 | } | ||
79 | |||
80 | int | ||
81 | shmse_irq_demux(int irq) | ||
82 | { | ||
83 | int bit; | ||
84 | volatile u16 val; | ||
85 | |||
86 | if (irq == IRQ5_IRQ) { | ||
87 | /* Read status Register */ | ||
88 | val = ctrl_inw(PA_CPLD_ST); | ||
89 | bit = ffs(val); | ||
90 | if (bit != 0) | ||
91 | return OFFCHIP_IRQ_BASE + bit - 1; | ||
92 | } | ||
93 | return irq; | ||
94 | } | ||
95 | |||
96 | /* IRQ5 is multiplexed between the following sources: | ||
97 | * 1. PC Card socket | ||
98 | * 2. Extension slot | ||
99 | * 3. USB Controller | ||
100 | * 4. Serial Controller | ||
101 | * | ||
102 | * We configure IRQ5 as a cascade IRQ. | ||
103 | */ | ||
104 | static struct irqaction irq5 = { no_action, 0, CPU_MASK_NONE, "IRQ5-cascade", | ||
105 | NULL, NULL}; | ||
106 | |||
107 | /* | ||
108 | * Initialize IRQ setting | ||
109 | */ | ||
110 | void __init | ||
111 | init_7343se_IRQ(void) | ||
112 | { | ||
113 | /* Setup Multiplexed interrupts */ | ||
114 | ctrl_outw(8, PA_CPLD_MODESET); /* Set all CPLD interrupts to active | ||
115 | * low. | ||
116 | */ | ||
117 | /* Mask all CPLD controller interrupts */ | ||
118 | ctrl_outw(0x0fff, PA_CPLD_IMSK); | ||
119 | |||
120 | /* PC Card interrupts */ | ||
121 | make_intreq_irq(PC_IRQ0); | ||
122 | make_intreq_irq(PC_IRQ1); | ||
123 | make_intreq_irq(PC_IRQ2); | ||
124 | make_intreq_irq(PC_IRQ3); | ||
125 | |||
126 | /* Extension Slot Interrupts */ | ||
127 | make_intreq_irq(EXT_IRQ0); | ||
128 | make_intreq_irq(EXT_IRQ1); | ||
129 | make_intreq_irq(EXT_IRQ2); | ||
130 | make_intreq_irq(EXT_IRQ3); | ||
131 | |||
132 | /* USB Controller interrupts */ | ||
133 | make_intreq_irq(USB_IRQ0); | ||
134 | make_intreq_irq(USB_IRQ1); | ||
135 | |||
136 | /* Serial Controller interrupts */ | ||
137 | make_intreq_irq(UART_IRQ0); | ||
138 | make_intreq_irq(UART_IRQ1); | ||
139 | |||
140 | /* Setup all external interrupts to be active low */ | ||
141 | ctrl_outw(0xaaaa, INTC_ICR1); | ||
142 | |||
143 | make_ipr_irq(IRQ5_IRQ, IRQ5_IPR_ADDR+2, IRQ5_IPR_POS, IRQ5_PRIORITY); | ||
144 | setup_irq(IRQ5_IRQ, &irq5); | ||
145 | /* Set port control to use IRQ5 */ | ||
146 | *(u16 *)0xA4050108 &= ~0xc; | ||
147 | |||
148 | make_ipr_irq(SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY); | ||
149 | make_ipr_irq(VPU_IRQ, VPU_IPR_ADDR, VPU_IPR_POS, 8); | ||
150 | |||
151 | ctrl_outb(0x0f, INTC_IMCR5); /* enable SCIF IRQ */ | ||
152 | |||
153 | make_ipr_irq(DMTE0_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); | ||
154 | make_ipr_irq(DMTE1_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); | ||
155 | make_ipr_irq(DMTE2_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); | ||
156 | make_ipr_irq(DMTE3_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); | ||
157 | make_ipr_irq(DMTE4_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY); | ||
158 | make_ipr_irq(DMTE5_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY); | ||
159 | |||
160 | /* I2C block */ | ||
161 | make_ipr_irq(IIC0_ALI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY); | ||
162 | make_ipr_irq(IIC0_TACKI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, | ||
163 | IIC0_PRIORITY); | ||
164 | make_ipr_irq(IIC0_WAITI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, | ||
165 | IIC0_PRIORITY); | ||
166 | make_ipr_irq(IIC0_DTEI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY); | ||
167 | |||
168 | make_ipr_irq(IIC1_ALI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, IIC1_PRIORITY); | ||
169 | make_ipr_irq(IIC1_TACKI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, | ||
170 | IIC1_PRIORITY); | ||
171 | make_ipr_irq(IIC1_WAITI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, | ||
172 | IIC1_PRIORITY); | ||
173 | make_ipr_irq(IIC1_DTEI_IRQ, IIC1_IPR_ADDR, IIC1_IPR_POS, IIC1_PRIORITY); | ||
174 | |||
175 | /* SIOF */ | ||
176 | make_ipr_irq(SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY); | ||
177 | |||
178 | /* SIU */ | ||
179 | make_ipr_irq(SIU_IRQ, SIU_IPR_ADDR, SIU_IPR_POS, SIU_PRIORITY); | ||
180 | |||
181 | /* VIO interrupt */ | ||
182 | make_ipr_irq(CEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY); | ||
183 | make_ipr_irq(BEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY); | ||
184 | make_ipr_irq(VEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY); | ||
185 | |||
186 | /*MFI interrupt*/ | ||
187 | |||
188 | make_ipr_irq(MFI_IRQ, MFI_IPR_ADDR, MFI_IPR_POS, MFI_PRIORITY); | ||
189 | |||
190 | /* LCD controller */ | ||
191 | make_ipr_irq(LCDC_IRQ, LCDC_IPR_ADDR, LCDC_IPR_POS, LCDC_PRIORITY); | ||
192 | ctrl_outw(0x2000, PA_MRSHPC + 0x0c); /* mrshpc irq enable */ | ||
193 | } | ||
diff --git a/arch/sh/boards/se/7343/led.c b/arch/sh/boards/se/7343/led.c new file mode 100644 index 000000000000..6a439cf83e46 --- /dev/null +++ b/arch/sh/boards/se/7343/led.c | |||
@@ -0,0 +1,46 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/se/7343/led.c | ||
3 | * | ||
4 | */ | ||
5 | |||
6 | #include <linux/config.h> | ||
7 | #include <linux/sched.h> | ||
8 | #include <asm/mach/se7343.h> | ||
9 | |||
10 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | ||
11 | void heartbeat_7343se(void) | ||
12 | { | ||
13 | static unsigned int cnt = 0, period = 0; | ||
14 | volatile unsigned short *p = (volatile unsigned short *) PA_LED; | ||
15 | static unsigned bit = 0, up = 1; | ||
16 | |||
17 | cnt += 1; | ||
18 | if (cnt < period) { | ||
19 | return; | ||
20 | } | ||
21 | |||
22 | cnt = 0; | ||
23 | |||
24 | /* Go through the points (roughly!): | ||
25 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35,f(inf)->110 | ||
26 | */ | ||
27 | period = 110 - ((300 << FSHIFT) / ((avenrun[0] / 5) + (3 << FSHIFT))); | ||
28 | |||
29 | if (up) { | ||
30 | if (bit == 7) { | ||
31 | bit--; | ||
32 | up = 0; | ||
33 | } else { | ||
34 | bit++; | ||
35 | } | ||
36 | } else { | ||
37 | if (bit == 0) { | ||
38 | bit++; | ||
39 | up = 1; | ||
40 | } else { | ||
41 | bit--; | ||
42 | } | ||
43 | } | ||
44 | *p = 1 << (bit + LED_SHIFT); | ||
45 | |||
46 | } | ||
diff --git a/arch/sh/boards/se/7343/setup.c b/arch/sh/boards/se/7343/setup.c new file mode 100644 index 000000000000..787322291fb3 --- /dev/null +++ b/arch/sh/boards/se/7343/setup.c | |||
@@ -0,0 +1,84 @@ | |||
1 | #include <linux/config.h> | ||
2 | #include <linux/init.h> | ||
3 | #include <linux/platform_device.h> | ||
4 | #include <asm/machvec.h> | ||
5 | #include <asm/mach/se7343.h> | ||
6 | #include <asm/irq.h> | ||
7 | |||
8 | void heartbeat_7343se(void); | ||
9 | void init_7343se_IRQ(void); | ||
10 | |||
11 | static struct resource smc91x_resources[] = { | ||
12 | [0] = { | ||
13 | .start = 0x10000000, | ||
14 | .end = 0x1000000F, | ||
15 | .flags = IORESOURCE_MEM, | ||
16 | }, | ||
17 | [1] = { | ||
18 | /* | ||
19 | * shared with other devices via externel | ||
20 | * interrupt controller in FPGA... | ||
21 | */ | ||
22 | .start = EXT_IRQ2, | ||
23 | .end = EXT_IRQ2, | ||
24 | .flags = IORESOURCE_IRQ, | ||
25 | }, | ||
26 | }; | ||
27 | |||
28 | static struct platform_device smc91x_device = { | ||
29 | .name = "smc91x", | ||
30 | .id = 0, | ||
31 | .num_resources = ARRAY_SIZE(smc91x_resources), | ||
32 | .resource = smc91x_resources, | ||
33 | }; | ||
34 | |||
35 | static struct platform_device *smc91x_platform_devices[] __initdata = { | ||
36 | &smc91x_device, | ||
37 | }; | ||
38 | |||
39 | static int __init sh7343se_devices_setup(void) | ||
40 | { | ||
41 | return platform_add_devices(smc91x_platform_devices, | ||
42 | ARRAY_SIZE(smc91x_platform_devices)); | ||
43 | } | ||
44 | |||
45 | static void __init sh7343se_setup(char **cmdline_p) | ||
46 | { | ||
47 | device_initcall(sh7343se_devices_setup); | ||
48 | } | ||
49 | |||
50 | /* | ||
51 | * The Machine Vector | ||
52 | */ | ||
53 | struct sh_machine_vector mv_7343se __initmv = { | ||
54 | .mv_name = "SolutionEngine 7343", | ||
55 | .mv_setup = sh7343se_setup, | ||
56 | .mv_nr_irqs = 108, | ||
57 | .mv_inb = sh7343se_inb, | ||
58 | .mv_inw = sh7343se_inw, | ||
59 | .mv_inl = sh7343se_inl, | ||
60 | .mv_outb = sh7343se_outb, | ||
61 | .mv_outw = sh7343se_outw, | ||
62 | .mv_outl = sh7343se_outl, | ||
63 | |||
64 | .mv_inb_p = sh7343se_inb_p, | ||
65 | .mv_inw_p = sh7343se_inw, | ||
66 | .mv_inl_p = sh7343se_inl, | ||
67 | .mv_outb_p = sh7343se_outb_p, | ||
68 | .mv_outw_p = sh7343se_outw, | ||
69 | .mv_outl_p = sh7343se_outl, | ||
70 | |||
71 | .mv_insb = sh7343se_insb, | ||
72 | .mv_insw = sh7343se_insw, | ||
73 | .mv_insl = sh7343se_insl, | ||
74 | .mv_outsb = sh7343se_outsb, | ||
75 | .mv_outsw = sh7343se_outsw, | ||
76 | .mv_outsl = sh7343se_outsl, | ||
77 | |||
78 | .mv_init_irq = init_7343se_IRQ, | ||
79 | .mv_irq_demux = shmse_irq_demux, | ||
80 | #ifdef CONFIG_HEARTBEAT | ||
81 | .mv_heartbeat = heartbeat_7343se, | ||
82 | #endif | ||
83 | }; | ||
84 | ALIAS_MV(7343se) | ||
diff --git a/arch/sh/boards/se/770x/Makefile b/arch/sh/boards/se/770x/Makefile index be89a73cc418..9a5035f80ec0 100644 --- a/arch/sh/boards/se/770x/Makefile +++ b/arch/sh/boards/se/770x/Makefile | |||
@@ -2,5 +2,5 @@ | |||
2 | # Makefile for the 770x SolutionEngine specific parts of the kernel | 2 | # Makefile for the 770x SolutionEngine specific parts of the kernel |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := mach.o setup.o io.o irq.o led.o | 5 | obj-y := setup.o io.o irq.o |
6 | 6 | obj-$(CONFIG_HEARTBEAT) += led.o | |
diff --git a/arch/sh/boards/se/770x/io.c b/arch/sh/boards/se/770x/io.c index 9a39ee963143..9941949331ab 100644 --- a/arch/sh/boards/se/770x/io.c +++ b/arch/sh/boards/se/770x/io.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $ | 1 | /* $Id: io.c,v 1.7 2006/02/05 21:55:29 lethal Exp $ |
2 | * | 2 | * |
3 | * linux/arch/sh/kernel/io_se.c | 3 | * linux/arch/sh/kernel/io_se.c |
4 | * | 4 | * |
@@ -11,7 +11,7 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/se/se.h> | 14 | #include <asm/se.h> |
15 | 15 | ||
16 | /* SH pcmcia io window base, start and end. */ | 16 | /* SH pcmcia io window base, start and end. */ |
17 | int sh_pcic_io_wbase = 0xb8400000; | 17 | int sh_pcic_io_wbase = 0xb8400000; |
@@ -20,11 +20,6 @@ int sh_pcic_io_stop; | |||
20 | int sh_pcic_io_type; | 20 | int sh_pcic_io_type; |
21 | int sh_pcic_io_dummy; | 21 | int sh_pcic_io_dummy; |
22 | 22 | ||
23 | static inline void delay(void) | ||
24 | { | ||
25 | ctrl_inw(0xa0000000); | ||
26 | } | ||
27 | |||
28 | /* MS7750 requires special versions of in*, out* routines, since | 23 | /* MS7750 requires special versions of in*, out* routines, since |
29 | PC-like io ports are located at upper half byte of 16-bit word which | 24 | PC-like io ports are located at upper half byte of 16-bit word which |
30 | can be accessed only with 16-bit wide. */ | 25 | can be accessed only with 16-bit wide. */ |
@@ -52,10 +47,6 @@ shifted_port(unsigned long port) | |||
52 | return 1; | 47 | return 1; |
53 | } | 48 | } |
54 | 49 | ||
55 | #define maybebadio(name,port) \ | ||
56 | printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \ | ||
57 | #name, (port), (__u32) __builtin_return_address(0)) | ||
58 | |||
59 | unsigned char se_inb(unsigned long port) | 50 | unsigned char se_inb(unsigned long port) |
60 | { | 51 | { |
61 | if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop) | 52 | if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop) |
@@ -76,7 +67,7 @@ unsigned char se_inb_p(unsigned long port) | |||
76 | v = (*port2adr(port) >> 8); | 67 | v = (*port2adr(port) >> 8); |
77 | else | 68 | else |
78 | v = (*port2adr(port))&0xff; | 69 | v = (*port2adr(port))&0xff; |
79 | delay(); | 70 | ctrl_delay(); |
80 | return v; | 71 | return v; |
81 | } | 72 | } |
82 | 73 | ||
@@ -86,13 +77,13 @@ unsigned short se_inw(unsigned long port) | |||
86 | (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)) | 77 | (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)) |
87 | return *port2adr(port); | 78 | return *port2adr(port); |
88 | else | 79 | else |
89 | maybebadio(inw, port); | 80 | maybebadio(port); |
90 | return 0; | 81 | return 0; |
91 | } | 82 | } |
92 | 83 | ||
93 | unsigned int se_inl(unsigned long port) | 84 | unsigned int se_inl(unsigned long port) |
94 | { | 85 | { |
95 | maybebadio(inl, port); | 86 | maybebadio(port); |
96 | return 0; | 87 | return 0; |
97 | } | 88 | } |
98 | 89 | ||
@@ -114,7 +105,7 @@ void se_outb_p(unsigned char value, unsigned long port) | |||
114 | *(port2adr(port)) = value << 8; | 105 | *(port2adr(port)) = value << 8; |
115 | else | 106 | else |
116 | *(port2adr(port)) = value; | 107 | *(port2adr(port)) = value; |
117 | delay(); | 108 | ctrl_delay(); |
118 | } | 109 | } |
119 | 110 | ||
120 | void se_outw(unsigned short value, unsigned long port) | 111 | void se_outw(unsigned short value, unsigned long port) |
@@ -123,12 +114,12 @@ void se_outw(unsigned short value, unsigned long port) | |||
123 | (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)) | 114 | (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)) |
124 | *port2adr(port) = value; | 115 | *port2adr(port) = value; |
125 | else | 116 | else |
126 | maybebadio(outw, port); | 117 | maybebadio(port); |
127 | } | 118 | } |
128 | 119 | ||
129 | void se_outl(unsigned int value, unsigned long port) | 120 | void se_outl(unsigned int value, unsigned long port) |
130 | { | 121 | { |
131 | maybebadio(outl, port); | 122 | maybebadio(port); |
132 | } | 123 | } |
133 | 124 | ||
134 | void se_insb(unsigned long port, void *addr, unsigned long count) | 125 | void se_insb(unsigned long port, void *addr, unsigned long count) |
@@ -159,7 +150,7 @@ void se_insw(unsigned long port, void *addr, unsigned long count) | |||
159 | 150 | ||
160 | void se_insl(unsigned long port, void *addr, unsigned long count) | 151 | void se_insl(unsigned long port, void *addr, unsigned long count) |
161 | { | 152 | { |
162 | maybebadio(insl, port); | 153 | maybebadio(port); |
163 | } | 154 | } |
164 | 155 | ||
165 | void se_outsb(unsigned long port, const void *addr, unsigned long count) | 156 | void se_outsb(unsigned long port, const void *addr, unsigned long count) |
@@ -190,37 +181,5 @@ void se_outsw(unsigned long port, const void *addr, unsigned long count) | |||
190 | 181 | ||
191 | void se_outsl(unsigned long port, const void *addr, unsigned long count) | 182 | void se_outsl(unsigned long port, const void *addr, unsigned long count) |
192 | { | 183 | { |
193 | maybebadio(outsw, port); | 184 | maybebadio(port); |
194 | } | ||
195 | |||
196 | /* Map ISA bus address to the real address. Only for PCMCIA. */ | ||
197 | |||
198 | /* ISA page descriptor. */ | ||
199 | static __u32 sh_isa_memmap[256]; | ||
200 | |||
201 | static int | ||
202 | sh_isa_mmap(__u32 start, __u32 length, __u32 offset) | ||
203 | { | ||
204 | int idx; | ||
205 | |||
206 | if (start >= 0x100000 || (start & 0xfff) || (length != 0x1000)) | ||
207 | return -1; | ||
208 | |||
209 | idx = start >> 12; | ||
210 | sh_isa_memmap[idx] = 0xb8000000 + (offset &~ 0xfff); | ||
211 | #if 0 | ||
212 | printk("sh_isa_mmap: start %x len %x offset %x (idx %x paddr %x)\n", | ||
213 | start, length, offset, idx, sh_isa_memmap[idx]); | ||
214 | #endif | ||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | unsigned long | ||
219 | se_isa_port2addr(unsigned long offset) | ||
220 | { | ||
221 | int idx; | ||
222 | |||
223 | idx = (offset >> 12) & 0xff; | ||
224 | offset &= 0xfff; | ||
225 | return sh_isa_memmap[idx] + offset; | ||
226 | } | 185 | } |
diff --git a/arch/sh/boards/se/770x/irq.c b/arch/sh/boards/se/770x/irq.c index 3e558716ce10..cff6700bbafd 100644 --- a/arch/sh/boards/se/770x/irq.c +++ b/arch/sh/boards/se/770x/irq.c | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
12 | #include <asm/irq.h> | 12 | #include <asm/irq.h> |
13 | #include <asm/io.h> | 13 | #include <asm/io.h> |
14 | #include <asm/se/se.h> | 14 | #include <asm/se.h> |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * Initialize IRQ setting | 17 | * Initialize IRQ setting |
diff --git a/arch/sh/boards/se/770x/led.c b/arch/sh/boards/se/770x/led.c index 3cddbda025fc..daf7b1ee786a 100644 --- a/arch/sh/boards/se/770x/led.c +++ b/arch/sh/boards/se/770x/led.c | |||
@@ -9,22 +9,8 @@ | |||
9 | * This file contains Solution Engine specific LED code. | 9 | * This file contains Solution Engine specific LED code. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <asm/se/se.h> | ||
13 | |||
14 | static void mach_led(int position, int value) | ||
15 | { | ||
16 | volatile unsigned short* p = (volatile unsigned short*)PA_LED; | ||
17 | |||
18 | if (value) { | ||
19 | *p |= (1<<8); | ||
20 | } else { | ||
21 | *p &= ~(1<<8); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | #ifdef CONFIG_HEARTBEAT | ||
26 | |||
27 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <asm/se.h> | ||
28 | 14 | ||
29 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | 15 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ |
30 | void heartbeat_se(void) | 16 | void heartbeat_se(void) |
@@ -64,4 +50,3 @@ void heartbeat_se(void) | |||
64 | *p = 1<<(bit+8); | 50 | *p = 1<<(bit+8); |
65 | 51 | ||
66 | } | 52 | } |
67 | #endif /* CONFIG_HEARTBEAT */ | ||
diff --git a/arch/sh/boards/se/770x/mach.c b/arch/sh/boards/se/770x/mach.c deleted file mode 100644 index 6ec07bd3dcf1..000000000000 --- a/arch/sh/boards/se/770x/mach.c +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/kernel/mach_se.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Stuart Menefy (stuart.menefy@st.com) | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * Machine vector for the Hitachi SolutionEngine | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | |||
14 | #include <asm/machvec.h> | ||
15 | #include <asm/rtc.h> | ||
16 | #include <asm/machvec_init.h> | ||
17 | |||
18 | #include <asm/se/io.h> | ||
19 | |||
20 | void heartbeat_se(void); | ||
21 | void setup_se(void); | ||
22 | void init_se_IRQ(void); | ||
23 | |||
24 | /* | ||
25 | * The Machine Vector | ||
26 | */ | ||
27 | |||
28 | struct sh_machine_vector mv_se __initmv = { | ||
29 | #if defined(CONFIG_CPU_SH4) | ||
30 | .mv_nr_irqs = 48, | ||
31 | #elif defined(CONFIG_CPU_SUBTYPE_SH7708) | ||
32 | .mv_nr_irqs = 32, | ||
33 | #elif defined(CONFIG_CPU_SUBTYPE_SH7709) | ||
34 | .mv_nr_irqs = 61, | ||
35 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) | ||
36 | .mv_nr_irqs = 86, | ||
37 | #endif | ||
38 | |||
39 | .mv_inb = se_inb, | ||
40 | .mv_inw = se_inw, | ||
41 | .mv_inl = se_inl, | ||
42 | .mv_outb = se_outb, | ||
43 | .mv_outw = se_outw, | ||
44 | .mv_outl = se_outl, | ||
45 | |||
46 | .mv_inb_p = se_inb_p, | ||
47 | .mv_inw_p = se_inw, | ||
48 | .mv_inl_p = se_inl, | ||
49 | .mv_outb_p = se_outb_p, | ||
50 | .mv_outw_p = se_outw, | ||
51 | .mv_outl_p = se_outl, | ||
52 | |||
53 | .mv_insb = se_insb, | ||
54 | .mv_insw = se_insw, | ||
55 | .mv_insl = se_insl, | ||
56 | .mv_outsb = se_outsb, | ||
57 | .mv_outsw = se_outsw, | ||
58 | .mv_outsl = se_outsl, | ||
59 | |||
60 | .mv_isa_port2addr = se_isa_port2addr, | ||
61 | |||
62 | .mv_init_irq = init_se_IRQ, | ||
63 | #ifdef CONFIG_HEARTBEAT | ||
64 | .mv_heartbeat = heartbeat_se, | ||
65 | #endif | ||
66 | }; | ||
67 | ALIAS_MV(se) | ||
diff --git a/arch/sh/boards/se/770x/setup.c b/arch/sh/boards/se/770x/setup.c index 7d1a071727cc..f3f82b7c8217 100644 --- a/arch/sh/boards/se/770x/setup.c +++ b/arch/sh/boards/se/770x/setup.c | |||
@@ -7,15 +7,17 @@ | |||
7 | * Hitachi SolutionEngine Support. | 7 | * Hitachi SolutionEngine Support. |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | |||
11 | #include <linux/init.h> | 10 | #include <linux/init.h> |
12 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
13 | |||
14 | #include <linux/hdreg.h> | 12 | #include <linux/hdreg.h> |
15 | #include <linux/ide.h> | 13 | #include <linux/ide.h> |
16 | #include <asm/io.h> | 14 | #include <asm/io.h> |
17 | #include <asm/se/se.h> | 15 | #include <asm/se.h> |
18 | #include <asm/se/smc37c93x.h> | 16 | #include <asm/smc37c93x.h> |
17 | #include <asm/machvec.h> | ||
18 | |||
19 | void heartbeat_se(void); | ||
20 | void init_se_IRQ(void); | ||
19 | 21 | ||
20 | /* | 22 | /* |
21 | * Configure the Super I/O chip | 23 | * Configure the Super I/O chip |
@@ -26,7 +28,8 @@ static void __init smsc_config(int index, int data) | |||
26 | outb_p(data, DATA_PORT); | 28 | outb_p(data, DATA_PORT); |
27 | } | 29 | } |
28 | 30 | ||
29 | static void __init init_smsc(void) | 31 | /* XXX: Another candidate for a more generic cchip machine vector */ |
32 | static void __init smsc_setup(char **cmdline_p) | ||
30 | { | 33 | { |
31 | outb_p(CONFIG_ENTER, CONFIG_PORT); | 34 | outb_p(CONFIG_ENTER, CONFIG_PORT); |
32 | outb_p(CONFIG_ENTER, CONFIG_PORT); | 35 | outb_p(CONFIG_ENTER, CONFIG_PORT); |
@@ -69,16 +72,46 @@ static void __init init_smsc(void) | |||
69 | outb_p(CONFIG_EXIT, CONFIG_PORT); | 72 | outb_p(CONFIG_EXIT, CONFIG_PORT); |
70 | } | 73 | } |
71 | 74 | ||
72 | const char *get_system_type(void) | ||
73 | { | ||
74 | return "SolutionEngine"; | ||
75 | } | ||
76 | |||
77 | /* | 75 | /* |
78 | * Initialize the board | 76 | * The Machine Vector |
79 | */ | 77 | */ |
80 | void __init platform_setup(void) | 78 | struct sh_machine_vector mv_se __initmv = { |
81 | { | 79 | .mv_name = "SolutionEngine", |
82 | init_smsc(); | 80 | .mv_setup = smsc_setup, |
83 | /* XXX: RTC setting comes here */ | 81 | #if defined(CONFIG_CPU_SH4) |
84 | } | 82 | .mv_nr_irqs = 48, |
83 | #elif defined(CONFIG_CPU_SUBTYPE_SH7708) | ||
84 | .mv_nr_irqs = 32, | ||
85 | #elif defined(CONFIG_CPU_SUBTYPE_SH7709) | ||
86 | .mv_nr_irqs = 61, | ||
87 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) | ||
88 | .mv_nr_irqs = 86, | ||
89 | #endif | ||
90 | |||
91 | .mv_inb = se_inb, | ||
92 | .mv_inw = se_inw, | ||
93 | .mv_inl = se_inl, | ||
94 | .mv_outb = se_outb, | ||
95 | .mv_outw = se_outw, | ||
96 | .mv_outl = se_outl, | ||
97 | |||
98 | .mv_inb_p = se_inb_p, | ||
99 | .mv_inw_p = se_inw, | ||
100 | .mv_inl_p = se_inl, | ||
101 | .mv_outb_p = se_outb_p, | ||
102 | .mv_outw_p = se_outw, | ||
103 | .mv_outl_p = se_outl, | ||
104 | |||
105 | .mv_insb = se_insb, | ||
106 | .mv_insw = se_insw, | ||
107 | .mv_insl = se_insl, | ||
108 | .mv_outsb = se_outsb, | ||
109 | .mv_outsw = se_outsw, | ||
110 | .mv_outsl = se_outsl, | ||
111 | |||
112 | .mv_init_irq = init_se_IRQ, | ||
113 | #ifdef CONFIG_HEARTBEAT | ||
114 | .mv_heartbeat = heartbeat_se, | ||
115 | #endif | ||
116 | }; | ||
117 | ALIAS_MV(se) | ||
diff --git a/arch/sh/boards/se/7751/Makefile b/arch/sh/boards/se/7751/Makefile index ce7ca247f84d..188900c48321 100644 --- a/arch/sh/boards/se/7751/Makefile +++ b/arch/sh/boards/se/7751/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile for the 7751 SolutionEngine specific parts of the kernel | 2 | # Makefile for the 7751 SolutionEngine specific parts of the kernel |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := mach.o setup.o io.o irq.o led.o | 5 | obj-y := setup.o io.o irq.o |
6 | 6 | ||
7 | obj-$(CONFIG_PCI) += pci.o | 7 | obj-$(CONFIG_PCI) += pci.o |
8 | 8 | obj-$(CONFIG_HEARTBEAT) += led.o | |
diff --git a/arch/sh/boards/se/7751/io.c b/arch/sh/boards/se/7751/io.c index 99041b269261..e8d846cec89d 100644 --- a/arch/sh/boards/se/7751/io.c +++ b/arch/sh/boards/se/7751/io.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/sh/kernel/io_7751se.c | ||
3 | * | ||
4 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel | 2 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel |
5 | * Based largely on io_se.c. | 3 | * Based largely on io_se.c. |
6 | * | 4 | * |
@@ -10,96 +8,21 @@ | |||
10 | * placeholder code from io_se.c left in with the | 8 | * placeholder code from io_se.c left in with the |
11 | * expectation of later SuperIO and PCMCIA access. | 9 | * expectation of later SuperIO and PCMCIA access. |
12 | */ | 10 | */ |
13 | |||
14 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
15 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/pci.h> | ||
16 | #include <asm/io.h> | 14 | #include <asm/io.h> |
17 | #include <asm/se7751/se7751.h> | 15 | #include <asm/se7751.h> |
18 | #include <asm/addrspace.h> | 16 | #include <asm/addrspace.h> |
19 | 17 | ||
20 | #include <linux/pci.h> | 18 | static inline volatile u16 *port2adr(unsigned int port) |
21 | #include "../../../drivers/pci/pci-sh7751.h" | ||
22 | |||
23 | #if 0 | ||
24 | /****************************************************************** | ||
25 | * Variables from io_se.c, related to PCMCIA (not PCI); we're not | ||
26 | * compiling them in, and have removed references from functions | ||
27 | * which follow. [Many checked for IO ports in the range bounded | ||
28 | * by sh_pcic_io_start/stop, and used sh_pcic_io_wbase as offset. | ||
29 | * As start/stop are uninitialized, only port 0x0 would match?] | ||
30 | * When used, remember to adjust names to avoid clash with io_se? | ||
31 | *****************************************************************/ | ||
32 | /* SH pcmcia io window base, start and end. */ | ||
33 | int sh_pcic_io_wbase = 0xb8400000; | ||
34 | int sh_pcic_io_start; | ||
35 | int sh_pcic_io_stop; | ||
36 | int sh_pcic_io_type; | ||
37 | int sh_pcic_io_dummy; | ||
38 | /*************************************************************/ | ||
39 | #endif | ||
40 | |||
41 | /* | ||
42 | * The 7751 Solution Engine uses the built-in PCI controller (PCIC) | ||
43 | * of the 7751 processor, and has a SuperIO accessible via the PCI. | ||
44 | * The board also includes a PCMCIA controller on its memory bus, | ||
45 | * like the other Solution Engine boards. | ||
46 | */ | ||
47 | |||
48 | #define PCIIOBR (volatile long *)PCI_REG(SH7751_PCIIOBR) | ||
49 | #define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR) | ||
50 | #define PCI_IO_AREA SH7751_PCI_IO_BASE | ||
51 | #define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE | ||
52 | |||
53 | #define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) | ||
54 | |||
55 | #define maybebadio(name,port) \ | ||
56 | printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \ | ||
57 | #name, (port), (__u32) __builtin_return_address(0)) | ||
58 | |||
59 | static inline void delay(void) | ||
60 | { | ||
61 | ctrl_inw(0xa0000000); | ||
62 | } | ||
63 | |||
64 | static inline volatile __u16 * | ||
65 | port2adr(unsigned int port) | ||
66 | { | 19 | { |
67 | if (port >= 0x2000) | 20 | if (port >= 0x2000) |
68 | return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); | 21 | return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); |
69 | #if 0 | 22 | maybebadio((unsigned long)port); |
70 | else | ||
71 | return (volatile __u16 *) (PA_SUPERIO + (port << 1)); | ||
72 | #endif | ||
73 | maybebadio(name,(unsigned long)port); | ||
74 | return (volatile __u16*)port; | 23 | return (volatile __u16*)port; |
75 | } | 24 | } |
76 | 25 | ||
77 | #if 0 | ||
78 | /* The 7751 Solution Engine seems to have everything hooked */ | ||
79 | /* up pretty normally (nothing on high-bytes only...) so this */ | ||
80 | /* shouldn't be needed */ | ||
81 | static inline int | ||
82 | shifted_port(unsigned long port) | ||
83 | { | ||
84 | /* For IDE registers, value is not shifted */ | ||
85 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) | ||
86 | return 0; | ||
87 | else | ||
88 | return 1; | ||
89 | } | ||
90 | #endif | ||
91 | |||
92 | /* In case someone configures the kernel w/o PCI support: in that */ | ||
93 | /* scenario, don't ever bother to check for PCI-window addresses */ | ||
94 | |||
95 | /* NOTE: WINDOW CHECK MAY BE A BIT OFF, HIGH PCIBIOS_MIN_IO WRAPS? */ | ||
96 | #if defined(CONFIG_PCI) | ||
97 | #define CHECK_SH7751_PCIIO(port) \ | ||
98 | ((port >= PCIBIOS_MIN_IO) && (port < (PCIBIOS_MIN_IO + SH7751_PCI_IO_SIZE))) | ||
99 | #else | ||
100 | #define CHECK_SH7751_PCIIO(port) (0) | ||
101 | #endif | ||
102 | |||
103 | /* | 26 | /* |
104 | * General outline: remap really low stuff [eventually] to SuperIO, | 27 | * General outline: remap really low stuff [eventually] to SuperIO, |
105 | * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) | 28 | * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) |
@@ -111,10 +34,10 @@ unsigned char sh7751se_inb(unsigned long port) | |||
111 | { | 34 | { |
112 | if (PXSEG(port)) | 35 | if (PXSEG(port)) |
113 | return *(volatile unsigned char *)port; | 36 | return *(volatile unsigned char *)port; |
114 | else if (CHECK_SH7751_PCIIO(port)) | 37 | else if (is_pci_ioaddr(port)) |
115 | return *(volatile unsigned char *)PCI_IOMAP(port); | 38 | return *(volatile unsigned char *)pci_ioaddr(port); |
116 | else | 39 | else |
117 | return (*port2adr(port))&0xff; | 40 | return (*port2adr(port)) & 0xff; |
118 | } | 41 | } |
119 | 42 | ||
120 | unsigned char sh7751se_inb_p(unsigned long port) | 43 | unsigned char sh7751se_inb_p(unsigned long port) |
@@ -123,11 +46,11 @@ unsigned char sh7751se_inb_p(unsigned long port) | |||
123 | 46 | ||
124 | if (PXSEG(port)) | 47 | if (PXSEG(port)) |
125 | v = *(volatile unsigned char *)port; | 48 | v = *(volatile unsigned char *)port; |
126 | else if (CHECK_SH7751_PCIIO(port)) | 49 | else if (is_pci_ioaddr(port)) |
127 | v = *(volatile unsigned char *)PCI_IOMAP(port); | 50 | v = *(volatile unsigned char *)pci_ioaddr(port); |
128 | else | 51 | else |
129 | v = (*port2adr(port))&0xff; | 52 | v = (*port2adr(port)) & 0xff; |
130 | delay(); | 53 | ctrl_delay(); |
131 | return v; | 54 | return v; |
132 | } | 55 | } |
133 | 56 | ||
@@ -135,12 +58,12 @@ unsigned short sh7751se_inw(unsigned long port) | |||
135 | { | 58 | { |
136 | if (PXSEG(port)) | 59 | if (PXSEG(port)) |
137 | return *(volatile unsigned short *)port; | 60 | return *(volatile unsigned short *)port; |
138 | else if (CHECK_SH7751_PCIIO(port)) | 61 | else if (is_pci_ioaddr(port)) |
139 | return *(volatile unsigned short *)PCI_IOMAP(port); | 62 | return *(volatile unsigned short *)pci_ioaddr(port); |
140 | else if (port >= 0x2000) | 63 | else if (port >= 0x2000) |
141 | return *port2adr(port); | 64 | return *port2adr(port); |
142 | else | 65 | else |
143 | maybebadio(inw, port); | 66 | maybebadio(port); |
144 | return 0; | 67 | return 0; |
145 | } | 68 | } |
146 | 69 | ||
@@ -148,12 +71,12 @@ unsigned int sh7751se_inl(unsigned long port) | |||
148 | { | 71 | { |
149 | if (PXSEG(port)) | 72 | if (PXSEG(port)) |
150 | return *(volatile unsigned long *)port; | 73 | return *(volatile unsigned long *)port; |
151 | else if (CHECK_SH7751_PCIIO(port)) | 74 | else if (is_pci_ioaddr(port)) |
152 | return *(volatile unsigned int *)PCI_IOMAP(port); | 75 | return *(volatile unsigned int *)pci_ioaddr(port); |
153 | else if (port >= 0x2000) | 76 | else if (port >= 0x2000) |
154 | return *port2adr(port); | 77 | return *port2adr(port); |
155 | else | 78 | else |
156 | maybebadio(inl, port); | 79 | maybebadio(port); |
157 | return 0; | 80 | return 0; |
158 | } | 81 | } |
159 | 82 | ||
@@ -162,8 +85,8 @@ void sh7751se_outb(unsigned char value, unsigned long port) | |||
162 | 85 | ||
163 | if (PXSEG(port)) | 86 | if (PXSEG(port)) |
164 | *(volatile unsigned char *)port = value; | 87 | *(volatile unsigned char *)port = value; |
165 | else if (CHECK_SH7751_PCIIO(port)) | 88 | else if (is_pci_ioaddr(port)) |
166 | *((unsigned char*)PCI_IOMAP(port)) = value; | 89 | *((unsigned char*)pci_ioaddr(port)) = value; |
167 | else | 90 | else |
168 | *(port2adr(port)) = value; | 91 | *(port2adr(port)) = value; |
169 | } | 92 | } |
@@ -172,73 +95,41 @@ void sh7751se_outb_p(unsigned char value, unsigned long port) | |||
172 | { | 95 | { |
173 | if (PXSEG(port)) | 96 | if (PXSEG(port)) |
174 | *(volatile unsigned char *)port = value; | 97 | *(volatile unsigned char *)port = value; |
175 | else if (CHECK_SH7751_PCIIO(port)) | 98 | else if (is_pci_ioaddr(port)) |
176 | *((unsigned char*)PCI_IOMAP(port)) = value; | 99 | *((unsigned char*)pci_ioaddr(port)) = value; |
177 | else | 100 | else |
178 | *(port2adr(port)) = value; | 101 | *(port2adr(port)) = value; |
179 | delay(); | 102 | ctrl_delay(); |
180 | } | 103 | } |
181 | 104 | ||
182 | void sh7751se_outw(unsigned short value, unsigned long port) | 105 | void sh7751se_outw(unsigned short value, unsigned long port) |
183 | { | 106 | { |
184 | if (PXSEG(port)) | 107 | if (PXSEG(port)) |
185 | *(volatile unsigned short *)port = value; | 108 | *(volatile unsigned short *)port = value; |
186 | else if (CHECK_SH7751_PCIIO(port)) | 109 | else if (is_pci_ioaddr(port)) |
187 | *((unsigned short *)PCI_IOMAP(port)) = value; | 110 | *((unsigned short *)pci_ioaddr(port)) = value; |
188 | else if (port >= 0x2000) | 111 | else if (port >= 0x2000) |
189 | *port2adr(port) = value; | 112 | *port2adr(port) = value; |
190 | else | 113 | else |
191 | maybebadio(outw, port); | 114 | maybebadio(port); |
192 | } | 115 | } |
193 | 116 | ||
194 | void sh7751se_outl(unsigned int value, unsigned long port) | 117 | void sh7751se_outl(unsigned int value, unsigned long port) |
195 | { | 118 | { |
196 | if (PXSEG(port)) | 119 | if (PXSEG(port)) |
197 | *(volatile unsigned long *)port = value; | 120 | *(volatile unsigned long *)port = value; |
198 | else if (CHECK_SH7751_PCIIO(port)) | 121 | else if (is_pci_ioaddr(port)) |
199 | *((unsigned long*)PCI_IOMAP(port)) = value; | 122 | *((unsigned long*)pci_ioaddr(port)) = value; |
200 | else | 123 | else |
201 | maybebadio(outl, port); | 124 | maybebadio(port); |
202 | } | 125 | } |
203 | 126 | ||
204 | void sh7751se_insl(unsigned long port, void *addr, unsigned long count) | 127 | void sh7751se_insl(unsigned long port, void *addr, unsigned long count) |
205 | { | 128 | { |
206 | maybebadio(insl, port); | 129 | maybebadio(port); |
207 | } | 130 | } |
208 | 131 | ||
209 | void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count) | 132 | void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count) |
210 | { | 133 | { |
211 | maybebadio(outsw, port); | 134 | maybebadio(port); |
212 | } | ||
213 | |||
214 | /* Map ISA bus address to the real address. Only for PCMCIA. */ | ||
215 | |||
216 | /* ISA page descriptor. */ | ||
217 | static __u32 sh_isa_memmap[256]; | ||
218 | |||
219 | #if 0 | ||
220 | static int | ||
221 | sh_isa_mmap(__u32 start, __u32 length, __u32 offset) | ||
222 | { | ||
223 | int idx; | ||
224 | |||
225 | if (start >= 0x100000 || (start & 0xfff) || (length != 0x1000)) | ||
226 | return -1; | ||
227 | |||
228 | idx = start >> 12; | ||
229 | sh_isa_memmap[idx] = 0xb8000000 + (offset &~ 0xfff); | ||
230 | printk("sh_isa_mmap: start %x len %x offset %x (idx %x paddr %x)\n", | ||
231 | start, length, offset, idx, sh_isa_memmap[idx]); | ||
232 | return 0; | ||
233 | } | ||
234 | #endif | ||
235 | |||
236 | unsigned long | ||
237 | sh7751se_isa_port2addr(unsigned long offset) | ||
238 | { | ||
239 | int idx; | ||
240 | |||
241 | idx = (offset >> 12) & 0xff; | ||
242 | offset &= 0xfff; | ||
243 | return sh_isa_memmap[idx] + offset; | ||
244 | } | 135 | } |
diff --git a/arch/sh/boards/se/7751/irq.c b/arch/sh/boards/se/7751/irq.c index bf6c023615df..c607b0a48479 100644 --- a/arch/sh/boards/se/7751/irq.c +++ b/arch/sh/boards/se/7751/irq.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
14 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
15 | #include <asm/se7751/se7751.h> | 15 | #include <asm/se7751.h> |
16 | 16 | ||
17 | /* | 17 | /* |
18 | * Initialize IRQ setting | 18 | * Initialize IRQ setting |
diff --git a/arch/sh/boards/se/7751/led.c b/arch/sh/boards/se/7751/led.c index a878726d3c7c..ff0355dea81b 100644 --- a/arch/sh/boards/se/7751/led.c +++ b/arch/sh/boards/se/7751/led.c | |||
@@ -8,23 +8,8 @@ | |||
8 | * | 8 | * |
9 | * This file contains Solution Engine specific LED code. | 9 | * This file contains Solution Engine specific LED code. |
10 | */ | 10 | */ |
11 | |||
12 | #include <asm/se7751/se7751.h> | ||
13 | |||
14 | static void mach_led(int position, int value) | ||
15 | { | ||
16 | volatile unsigned short* p = (volatile unsigned short*)PA_LED; | ||
17 | |||
18 | if (value) { | ||
19 | *p |= (1<<8); | ||
20 | } else { | ||
21 | *p &= ~(1<<8); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | #ifdef CONFIG_HEARTBEAT | ||
26 | |||
27 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
12 | #include <asm/se7751.h> | ||
28 | 13 | ||
29 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ | 14 | /* Cycle the LED's in the clasic Knightrider/Sun pattern */ |
30 | void heartbeat_7751se(void) | 15 | void heartbeat_7751se(void) |
@@ -64,4 +49,3 @@ void heartbeat_7751se(void) | |||
64 | *p = 1<<(bit+8); | 49 | *p = 1<<(bit+8); |
65 | 50 | ||
66 | } | 51 | } |
67 | #endif /* CONFIG_HEARTBEAT */ | ||
diff --git a/arch/sh/boards/se/7751/mach.c b/arch/sh/boards/se/7751/mach.c deleted file mode 100644 index 62d8d3e62590..000000000000 --- a/arch/sh/boards/se/7751/mach.c +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/kernel/mach_7751se.c | ||
3 | * | ||
4 | * Minor tweak of mach_se.c file to reference 7751se-specific items. | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * Machine vector for the Hitachi 7751 SolutionEngine | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | |||
14 | #include <asm/machvec.h> | ||
15 | #include <asm/rtc.h> | ||
16 | #include <asm/machvec_init.h> | ||
17 | |||
18 | #include <asm/se7751/io.h> | ||
19 | |||
20 | void heartbeat_7751se(void); | ||
21 | void init_7751se_IRQ(void); | ||
22 | |||
23 | /* | ||
24 | * The Machine Vector | ||
25 | */ | ||
26 | |||
27 | struct sh_machine_vector mv_7751se __initmv = { | ||
28 | .mv_nr_irqs = 72, | ||
29 | |||
30 | .mv_inb = sh7751se_inb, | ||
31 | .mv_inw = sh7751se_inw, | ||
32 | .mv_inl = sh7751se_inl, | ||
33 | .mv_outb = sh7751se_outb, | ||
34 | .mv_outw = sh7751se_outw, | ||
35 | .mv_outl = sh7751se_outl, | ||
36 | |||
37 | .mv_inb_p = sh7751se_inb_p, | ||
38 | .mv_inw_p = sh7751se_inw, | ||
39 | .mv_inl_p = sh7751se_inl, | ||
40 | .mv_outb_p = sh7751se_outb_p, | ||
41 | .mv_outw_p = sh7751se_outw, | ||
42 | .mv_outl_p = sh7751se_outl, | ||
43 | |||
44 | .mv_insl = sh7751se_insl, | ||
45 | .mv_outsl = sh7751se_outsl, | ||
46 | |||
47 | .mv_isa_port2addr = sh7751se_isa_port2addr, | ||
48 | |||
49 | .mv_init_irq = init_7751se_IRQ, | ||
50 | #ifdef CONFIG_HEARTBEAT | ||
51 | .mv_heartbeat = heartbeat_7751se, | ||
52 | #endif | ||
53 | }; | ||
54 | ALIAS_MV(7751se) | ||
diff --git a/arch/sh/boards/se/7751/setup.c b/arch/sh/boards/se/7751/setup.c index 48dc5aee67d4..73e826310ba8 100644 --- a/arch/sh/boards/se/7751/setup.c +++ b/arch/sh/boards/se/7751/setup.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/sh/kernel/setup_7751se.c | 2 | * linux/arch/sh/kernel/setup_7751se.c |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Kazumoto Kojima | 4 | * Copyright (C) 2000 Kazumoto Kojima |
@@ -11,78 +11,15 @@ | |||
11 | 11 | ||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
14 | |||
15 | #include <linux/hdreg.h> | ||
16 | #include <linux/ide.h> | 14 | #include <linux/ide.h> |
17 | #include <asm/io.h> | 15 | #include <asm/io.h> |
18 | #include <asm/se7751/se7751.h> | 16 | #include <asm/se7751.h> |
19 | 17 | ||
20 | #ifdef CONFIG_SH_KGDB | 18 | void heartbeat_7751se(void); |
21 | #include <asm/kgdb.h> | 19 | void init_7751se_IRQ(void); |
22 | #endif | ||
23 | |||
24 | /* | ||
25 | * Configure the Super I/O chip | ||
26 | */ | ||
27 | #if 0 | ||
28 | /* Leftover code from regular Solution Engine, for reference. */ | ||
29 | /* The SH7751 Solution Engine has a different SuperIO. */ | ||
30 | static void __init smsc_config(int index, int data) | ||
31 | { | ||
32 | outb_p(index, INDEX_PORT); | ||
33 | outb_p(data, DATA_PORT); | ||
34 | } | ||
35 | |||
36 | static void __init init_smsc(void) | ||
37 | { | ||
38 | outb_p(CONFIG_ENTER, CONFIG_PORT); | ||
39 | outb_p(CONFIG_ENTER, CONFIG_PORT); | ||
40 | |||
41 | /* FDC */ | ||
42 | smsc_config(CURRENT_LDN_INDEX, LDN_FDC); | ||
43 | smsc_config(ACTIVATE_INDEX, 0x01); | ||
44 | smsc_config(IRQ_SELECT_INDEX, 6); /* IRQ6 */ | ||
45 | |||
46 | /* IDE1 */ | ||
47 | smsc_config(CURRENT_LDN_INDEX, LDN_IDE1); | ||
48 | smsc_config(ACTIVATE_INDEX, 0x01); | ||
49 | smsc_config(IRQ_SELECT_INDEX, 14); /* IRQ14 */ | ||
50 | |||
51 | /* AUXIO (GPIO): to use IDE1 */ | ||
52 | smsc_config(CURRENT_LDN_INDEX, LDN_AUXIO); | ||
53 | smsc_config(GPIO46_INDEX, 0x00); /* nIOROP */ | ||
54 | smsc_config(GPIO47_INDEX, 0x00); /* nIOWOP */ | ||
55 | |||
56 | /* COM1 */ | ||
57 | smsc_config(CURRENT_LDN_INDEX, LDN_COM1); | ||
58 | smsc_config(ACTIVATE_INDEX, 0x01); | ||
59 | smsc_config(IO_BASE_HI_INDEX, 0x03); | ||
60 | smsc_config(IO_BASE_LO_INDEX, 0xf8); | ||
61 | smsc_config(IRQ_SELECT_INDEX, 4); /* IRQ4 */ | ||
62 | |||
63 | /* COM2 */ | ||
64 | smsc_config(CURRENT_LDN_INDEX, LDN_COM2); | ||
65 | smsc_config(ACTIVATE_INDEX, 0x01); | ||
66 | smsc_config(IO_BASE_HI_INDEX, 0x02); | ||
67 | smsc_config(IO_BASE_LO_INDEX, 0xf8); | ||
68 | smsc_config(IRQ_SELECT_INDEX, 3); /* IRQ3 */ | ||
69 | |||
70 | /* RTC */ | ||
71 | smsc_config(CURRENT_LDN_INDEX, LDN_RTC); | ||
72 | smsc_config(ACTIVATE_INDEX, 0x01); | ||
73 | smsc_config(IRQ_SELECT_INDEX, 8); /* IRQ8 */ | ||
74 | |||
75 | /* XXX: PARPORT, KBD, and MOUSE will come here... */ | ||
76 | outb_p(CONFIG_EXIT, CONFIG_PORT); | ||
77 | } | ||
78 | #endif | ||
79 | |||
80 | const char *get_system_type(void) | ||
81 | { | ||
82 | return "7751 SolutionEngine"; | ||
83 | } | ||
84 | 20 | ||
85 | #ifdef CONFIG_SH_KGDB | 21 | #ifdef CONFIG_SH_KGDB |
22 | #include <asm/kgdb.h> | ||
86 | static int kgdb_uart_setup(void); | 23 | static int kgdb_uart_setup(void); |
87 | static struct kgdb_sermap kgdb_uart_sermap = | 24 | static struct kgdb_sermap kgdb_uart_sermap = |
88 | { "ttyS", 0, kgdb_uart_setup, NULL }; | 25 | { "ttyS", 0, kgdb_uart_setup, NULL }; |
@@ -91,7 +28,7 @@ static struct kgdb_sermap kgdb_uart_sermap = | |||
91 | /* | 28 | /* |
92 | * Initialize the board | 29 | * Initialize the board |
93 | */ | 30 | */ |
94 | void __init platform_setup(void) | 31 | static void __init sh7751se_setup(char **cmdline_p) |
95 | { | 32 | { |
96 | /* Call init_smsc() replacement to set up SuperIO. */ | 33 | /* Call init_smsc() replacement to set up SuperIO. */ |
97 | /* XXX: RTC setting comes here */ | 34 | /* XXX: RTC setting comes here */ |
@@ -225,3 +162,37 @@ static int kgdb_uart_setup(void) | |||
225 | return 0; | 162 | return 0; |
226 | } | 163 | } |
227 | #endif /* CONFIG_SH_KGDB */ | 164 | #endif /* CONFIG_SH_KGDB */ |
165 | |||
166 | |||
167 | /* | ||
168 | * The Machine Vector | ||
169 | */ | ||
170 | |||
171 | struct sh_machine_vector mv_7751se __initmv = { | ||
172 | .mv_name = "7751 SolutionEngine", | ||
173 | .mv_setup = sh7751se_setup, | ||
174 | .mv_nr_irqs = 72, | ||
175 | |||
176 | .mv_inb = sh7751se_inb, | ||
177 | .mv_inw = sh7751se_inw, | ||
178 | .mv_inl = sh7751se_inl, | ||
179 | .mv_outb = sh7751se_outb, | ||
180 | .mv_outw = sh7751se_outw, | ||
181 | .mv_outl = sh7751se_outl, | ||
182 | |||
183 | .mv_inb_p = sh7751se_inb_p, | ||
184 | .mv_inw_p = sh7751se_inw, | ||
185 | .mv_inl_p = sh7751se_inl, | ||
186 | .mv_outb_p = sh7751se_outb_p, | ||
187 | .mv_outw_p = sh7751se_outw, | ||
188 | .mv_outl_p = sh7751se_outl, | ||
189 | |||
190 | .mv_insl = sh7751se_insl, | ||
191 | .mv_outsl = sh7751se_outsl, | ||
192 | |||
193 | .mv_init_irq = init_7751se_IRQ, | ||
194 | #ifdef CONFIG_HEARTBEAT | ||
195 | .mv_heartbeat = heartbeat_7751se, | ||
196 | #endif | ||
197 | }; | ||
198 | ALIAS_MV(7751se) | ||