diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-01 13:53:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-01 13:53:43 -0400 |
commit | 00e9028a95fb8a4d79f2fb695a853f33ea7d3b57 (patch) | |
tree | 2dea2ae498a6ce57de8890e87185aca5e9f3ad2d /arch/sh/boards/mach-systemh | |
parent | 57b1494d2ba544c62673234da6115c21fac27ffc (diff) | |
parent | 7cb93181629c613ee2b8f4ffe3446f8003074842 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (28 commits)
mm/hugetlb.c must #include <asm/io.h>
video: Fix up hp6xx driver build regressions.
sh: defconfig updates.
sh: Kill off stray mach-rsk7203 reference.
serial: sh-sci: Fix up SH7760/SH7780/SH7785 early printk regression.
sh: Move out individual boards without mach groups.
sh: Make sure AT_SYSINFO_EHDR is exposed to userspace in asm/auxvec.h.
sh: Allow SH-3 and SH-5 to use common headers.
sh: Provide common CPU headers, prune the SH-2 and SH-2A directories.
sh/maple: clean maple bus code
sh: More header path fixups for mach dir refactoring.
sh: Move out the solution engine headers to arch/sh/include/mach-se/
sh: I2C fix for AP325RXA and Migo-R
sh: Shuffle the board directories in to mach groups.
sh: dma-sh: Fix up dreamcast dma.h mach path.
sh: Switch KBUILD_DEFCONFIG to shx3_defconfig.
sh: Add ARCH_DEFCONFIG entries for sh and sh64.
sh: Fix compile error of Solution Engine
sh: Proper __put_user_asm() size mismatch fix.
sh: Stub in a dummy ENTRY_OFFSET for uImage offset calculation.
...
Diffstat (limited to 'arch/sh/boards/mach-systemh')
-rw-r--r-- | arch/sh/boards/mach-systemh/Makefile | 13 | ||||
-rw-r--r-- | arch/sh/boards/mach-systemh/io.c | 174 | ||||
-rw-r--r-- | arch/sh/boards/mach-systemh/irq.c | 102 | ||||
-rw-r--r-- | arch/sh/boards/mach-systemh/setup.c | 57 |
4 files changed, 346 insertions, 0 deletions
diff --git a/arch/sh/boards/mach-systemh/Makefile b/arch/sh/boards/mach-systemh/Makefile new file mode 100644 index 000000000000..2cc6a23d9d39 --- /dev/null +++ b/arch/sh/boards/mach-systemh/Makefile | |||
@@ -0,0 +1,13 @@ | |||
1 | # | ||
2 | # Makefile for the SystemH specific parts of the kernel | ||
3 | # | ||
4 | |||
5 | obj-y := setup.o irq.o io.o | ||
6 | |||
7 | # XXX: This wants to be consolidated in arch/sh/drivers/pci, and more | ||
8 | # importantly, with the generic sh7751_pcic_init() code. For now, we'll | ||
9 | # just abuse the hell out of kbuild, because we can.. | ||
10 | |||
11 | obj-$(CONFIG_PCI) += pci.o | ||
12 | pci-y := ../../se/7751/pci.o | ||
13 | |||
diff --git a/arch/sh/boards/mach-systemh/io.c b/arch/sh/boards/mach-systemh/io.c new file mode 100644 index 000000000000..1b767e1a1428 --- /dev/null +++ b/arch/sh/boards/mach-systemh/io.c | |||
@@ -0,0 +1,174 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/renesas/systemh/io.c | ||
3 | * | ||
4 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel | ||
5 | * Based largely on io_se.c. | ||
6 | * | ||
7 | * I/O routine for Hitachi 7751 Systemh. | ||
8 | */ | ||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/pci.h> | ||
12 | #include <asm/systemh7751.h> | ||
13 | #include <asm/addrspace.h> | ||
14 | #include <asm/io.h> | ||
15 | |||
16 | #define ETHER_IOMAP(adr) (0xB3000000 + (adr)) /*map to 16bits access area | ||
17 | of smc lan chip*/ | ||
18 | static inline volatile __u16 * | ||
19 | port2adr(unsigned int port) | ||
20 | { | ||
21 | if (port >= 0x2000) | ||
22 | return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); | ||
23 | maybebadio((unsigned long)port); | ||
24 | return (volatile __u16*)port; | ||
25 | } | ||
26 | |||
27 | /* | ||
28 | * General outline: remap really low stuff [eventually] to SuperIO, | ||
29 | * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) | ||
30 | * is mapped through the PCI IO window. Stuff with high bits (PXSEG) | ||
31 | * should be way beyond the window, and is used w/o translation for | ||
32 | * compatibility. | ||
33 | */ | ||
34 | unsigned char sh7751systemh_inb(unsigned long port) | ||
35 | { | ||
36 | if (PXSEG(port)) | ||
37 | return *(volatile unsigned char *)port; | ||
38 | else if (is_pci_ioaddr(port)) | ||
39 | return *(volatile unsigned char *)pci_ioaddr(port); | ||
40 | else if (port <= 0x3F1) | ||
41 | return *(volatile unsigned char *)ETHER_IOMAP(port); | ||
42 | else | ||
43 | return (*port2adr(port))&0xff; | ||
44 | } | ||
45 | |||
46 | unsigned char sh7751systemh_inb_p(unsigned long port) | ||
47 | { | ||
48 | unsigned char v; | ||
49 | |||
50 | if (PXSEG(port)) | ||
51 | v = *(volatile unsigned char *)port; | ||
52 | else if (is_pci_ioaddr(port)) | ||
53 | v = *(volatile unsigned char *)pci_ioaddr(port); | ||
54 | else if (port <= 0x3F1) | ||
55 | v = *(volatile unsigned char *)ETHER_IOMAP(port); | ||
56 | else | ||
57 | v = (*port2adr(port))&0xff; | ||
58 | ctrl_delay(); | ||
59 | return v; | ||
60 | } | ||
61 | |||
62 | unsigned short sh7751systemh_inw(unsigned long port) | ||
63 | { | ||
64 | if (PXSEG(port)) | ||
65 | return *(volatile unsigned short *)port; | ||
66 | else if (is_pci_ioaddr(port)) | ||
67 | return *(volatile unsigned short *)pci_ioaddr(port); | ||
68 | else if (port >= 0x2000) | ||
69 | return *port2adr(port); | ||
70 | else if (port <= 0x3F1) | ||
71 | return *(volatile unsigned int *)ETHER_IOMAP(port); | ||
72 | else | ||
73 | maybebadio(port); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | unsigned int sh7751systemh_inl(unsigned long port) | ||
78 | { | ||
79 | if (PXSEG(port)) | ||
80 | return *(volatile unsigned long *)port; | ||
81 | else if (is_pci_ioaddr(port)) | ||
82 | return *(volatile unsigned int *)pci_ioaddr(port); | ||
83 | else if (port >= 0x2000) | ||
84 | return *port2adr(port); | ||
85 | else if (port <= 0x3F1) | ||
86 | return *(volatile unsigned int *)ETHER_IOMAP(port); | ||
87 | else | ||
88 | maybebadio(port); | ||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | void sh7751systemh_outb(unsigned char value, unsigned long port) | ||
93 | { | ||
94 | |||
95 | if (PXSEG(port)) | ||
96 | *(volatile unsigned char *)port = value; | ||
97 | else if (is_pci_ioaddr(port)) | ||
98 | *((unsigned char*)pci_ioaddr(port)) = value; | ||
99 | else if (port <= 0x3F1) | ||
100 | *(volatile unsigned char *)ETHER_IOMAP(port) = value; | ||
101 | else | ||
102 | *(port2adr(port)) = value; | ||
103 | } | ||
104 | |||
105 | void sh7751systemh_outb_p(unsigned char value, unsigned long port) | ||
106 | { | ||
107 | if (PXSEG(port)) | ||
108 | *(volatile unsigned char *)port = value; | ||
109 | else if (is_pci_ioaddr(port)) | ||
110 | *((unsigned char*)pci_ioaddr(port)) = value; | ||
111 | else if (port <= 0x3F1) | ||
112 | *(volatile unsigned char *)ETHER_IOMAP(port) = value; | ||
113 | else | ||
114 | *(port2adr(port)) = value; | ||
115 | ctrl_delay(); | ||
116 | } | ||
117 | |||
118 | void sh7751systemh_outw(unsigned short value, unsigned long port) | ||
119 | { | ||
120 | if (PXSEG(port)) | ||
121 | *(volatile unsigned short *)port = value; | ||
122 | else if (is_pci_ioaddr(port)) | ||
123 | *((unsigned short *)pci_ioaddr(port)) = value; | ||
124 | else if (port >= 0x2000) | ||
125 | *port2adr(port) = value; | ||
126 | else if (port <= 0x3F1) | ||
127 | *(volatile unsigned short *)ETHER_IOMAP(port) = value; | ||
128 | else | ||
129 | maybebadio(port); | ||
130 | } | ||
131 | |||
132 | void sh7751systemh_outl(unsigned int value, unsigned long port) | ||
133 | { | ||
134 | if (PXSEG(port)) | ||
135 | *(volatile unsigned long *)port = value; | ||
136 | else if (is_pci_ioaddr(port)) | ||
137 | *((unsigned long*)pci_ioaddr(port)) = value; | ||
138 | else | ||
139 | maybebadio(port); | ||
140 | } | ||
141 | |||
142 | void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count) | ||
143 | { | ||
144 | unsigned char *p = addr; | ||
145 | while (count--) *p++ = sh7751systemh_inb(port); | ||
146 | } | ||
147 | |||
148 | void sh7751systemh_insw(unsigned long port, void *addr, unsigned long count) | ||
149 | { | ||
150 | unsigned short *p = addr; | ||
151 | while (count--) *p++ = sh7751systemh_inw(port); | ||
152 | } | ||
153 | |||
154 | void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count) | ||
155 | { | ||
156 | maybebadio(port); | ||
157 | } | ||
158 | |||
159 | void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count) | ||
160 | { | ||
161 | unsigned char *p = (unsigned char*)addr; | ||
162 | while (count--) sh7751systemh_outb(*p++, port); | ||
163 | } | ||
164 | |||
165 | void sh7751systemh_outsw(unsigned long port, const void *addr, unsigned long count) | ||
166 | { | ||
167 | unsigned short *p = (unsigned short*)addr; | ||
168 | while (count--) sh7751systemh_outw(*p++, port); | ||
169 | } | ||
170 | |||
171 | void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count) | ||
172 | { | ||
173 | maybebadio(port); | ||
174 | } | ||
diff --git a/arch/sh/boards/mach-systemh/irq.c b/arch/sh/boards/mach-systemh/irq.c new file mode 100644 index 000000000000..0ba2fe674c47 --- /dev/null +++ b/arch/sh/boards/mach-systemh/irq.c | |||
@@ -0,0 +1,102 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/renesas/systemh/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Kazumoto Kojima | ||
5 | * | ||
6 | * Hitachi SystemH Support. | ||
7 | * | ||
8 | * Modified for 7751 SystemH by | ||
9 | * Jonathan Short. | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | #include <linux/irq.h> | ||
14 | |||
15 | #include <linux/hdreg.h> | ||
16 | #include <linux/ide.h> | ||
17 | #include <asm/io.h> | ||
18 | #include <asm/systemh7751.h> | ||
19 | #include <asm/smc37c93x.h> | ||
20 | |||
21 | /* address of external interrupt mask register | ||
22 | * address must be set prior to use these (maybe in init_XXX_irq()) | ||
23 | * XXX : is it better to use .config than specifying it in code? */ | ||
24 | static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004; | ||
25 | static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000; | ||
26 | |||
27 | /* forward declaration */ | ||
28 | static unsigned int startup_systemh_irq(unsigned int irq); | ||
29 | static void shutdown_systemh_irq(unsigned int irq); | ||
30 | static void enable_systemh_irq(unsigned int irq); | ||
31 | static void disable_systemh_irq(unsigned int irq); | ||
32 | static void mask_and_ack_systemh(unsigned int); | ||
33 | static void end_systemh_irq(unsigned int irq); | ||
34 | |||
35 | /* hw_interrupt_type */ | ||
36 | static struct hw_interrupt_type systemh_irq_type = { | ||
37 | .typename = " SystemH Register", | ||
38 | .startup = startup_systemh_irq, | ||
39 | .shutdown = shutdown_systemh_irq, | ||
40 | .enable = enable_systemh_irq, | ||
41 | .disable = disable_systemh_irq, | ||
42 | .ack = mask_and_ack_systemh, | ||
43 | .end = end_systemh_irq | ||
44 | }; | ||
45 | |||
46 | static unsigned int startup_systemh_irq(unsigned int irq) | ||
47 | { | ||
48 | enable_systemh_irq(irq); | ||
49 | return 0; /* never anything pending */ | ||
50 | } | ||
51 | |||
52 | static void shutdown_systemh_irq(unsigned int irq) | ||
53 | { | ||
54 | disable_systemh_irq(irq); | ||
55 | } | ||
56 | |||
57 | static void disable_systemh_irq(unsigned int irq) | ||
58 | { | ||
59 | if (systemh_irq_mask_register) { | ||
60 | unsigned long val, mask = 0x01 << 1; | ||
61 | |||
62 | /* Clear the "irq"th bit in the mask and set it in the request */ | ||
63 | val = ctrl_inl((unsigned long)systemh_irq_mask_register); | ||
64 | val &= ~mask; | ||
65 | ctrl_outl(val, (unsigned long)systemh_irq_mask_register); | ||
66 | |||
67 | val = ctrl_inl((unsigned long)systemh_irq_request_register); | ||
68 | val |= mask; | ||
69 | ctrl_outl(val, (unsigned long)systemh_irq_request_register); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | static void enable_systemh_irq(unsigned int irq) | ||
74 | { | ||
75 | if (systemh_irq_mask_register) { | ||
76 | unsigned long val, mask = 0x01 << 1; | ||
77 | |||
78 | /* Set "irq"th bit in the mask register */ | ||
79 | val = ctrl_inl((unsigned long)systemh_irq_mask_register); | ||
80 | val |= mask; | ||
81 | ctrl_outl(val, (unsigned long)systemh_irq_mask_register); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | static void mask_and_ack_systemh(unsigned int irq) | ||
86 | { | ||
87 | disable_systemh_irq(irq); | ||
88 | } | ||
89 | |||
90 | static void end_systemh_irq(unsigned int irq) | ||
91 | { | ||
92 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | ||
93 | enable_systemh_irq(irq); | ||
94 | } | ||
95 | |||
96 | void make_systemh_irq(unsigned int irq) | ||
97 | { | ||
98 | disable_irq_nosync(irq); | ||
99 | irq_desc[irq].chip = &systemh_irq_type; | ||
100 | disable_systemh_irq(irq); | ||
101 | } | ||
102 | |||
diff --git a/arch/sh/boards/mach-systemh/setup.c b/arch/sh/boards/mach-systemh/setup.c new file mode 100644 index 000000000000..ee78af842778 --- /dev/null +++ b/arch/sh/boards/mach-systemh/setup.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/renesas/systemh/setup.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Kazumoto Kojima | ||
5 | * Copyright (C) 2003 Paul Mundt | ||
6 | * | ||
7 | * Hitachi SystemH Support. | ||
8 | * | ||
9 | * Modified for 7751 SystemH by Jonathan Short. | ||
10 | * | ||
11 | * Rewritten for 2.6 by Paul Mundt. | ||
12 | * | ||
13 | * This file is subject to the terms and conditions of the GNU General Public | ||
14 | * License. See the file "COPYING" in the main directory of this archive | ||
15 | * for more details. | ||
16 | */ | ||
17 | #include <linux/init.h> | ||
18 | #include <asm/machvec.h> | ||
19 | #include <asm/systemh7751.h> | ||
20 | |||
21 | extern void make_systemh_irq(unsigned int irq); | ||
22 | |||
23 | /* | ||
24 | * Initialize IRQ setting | ||
25 | */ | ||
26 | static void __init sh7751systemh_init_irq(void) | ||
27 | { | ||
28 | make_systemh_irq(0xb); /* Ethernet interrupt */ | ||
29 | } | ||
30 | |||
31 | static struct sh_machine_vector mv_7751systemh __initmv = { | ||
32 | .mv_name = "7751 SystemH", | ||
33 | .mv_nr_irqs = 72, | ||
34 | |||
35 | .mv_inb = sh7751systemh_inb, | ||
36 | .mv_inw = sh7751systemh_inw, | ||
37 | .mv_inl = sh7751systemh_inl, | ||
38 | .mv_outb = sh7751systemh_outb, | ||
39 | .mv_outw = sh7751systemh_outw, | ||
40 | .mv_outl = sh7751systemh_outl, | ||
41 | |||
42 | .mv_inb_p = sh7751systemh_inb_p, | ||
43 | .mv_inw_p = sh7751systemh_inw, | ||
44 | .mv_inl_p = sh7751systemh_inl, | ||
45 | .mv_outb_p = sh7751systemh_outb_p, | ||
46 | .mv_outw_p = sh7751systemh_outw, | ||
47 | .mv_outl_p = sh7751systemh_outl, | ||
48 | |||
49 | .mv_insb = sh7751systemh_insb, | ||
50 | .mv_insw = sh7751systemh_insw, | ||
51 | .mv_insl = sh7751systemh_insl, | ||
52 | .mv_outsb = sh7751systemh_outsb, | ||
53 | .mv_outsw = sh7751systemh_outsw, | ||
54 | .mv_outsl = sh7751systemh_outsl, | ||
55 | |||
56 | .mv_init_irq = sh7751systemh_init_irq, | ||
57 | }; | ||