diff options
Diffstat (limited to 'arch/sh/boards')
29 files changed, 1182 insertions, 1149 deletions
diff --git a/arch/sh/boards/hp6xx/Makefile b/arch/sh/boards/hp6xx/Makefile index ff1b7f5b4e91..b3124278247c 100644 --- a/arch/sh/boards/hp6xx/Makefile +++ b/arch/sh/boards/hp6xx/Makefile | |||
@@ -2,6 +2,6 @@ | |||
2 | # Makefile for the HP6xx specific parts of the kernel | 2 | # Makefile for the HP6xx specific parts of the kernel |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o | 5 | obj-y := setup.o |
6 | obj-$(CONFIG_PM) += pm.o pm_wakeup.o | 6 | obj-$(CONFIG_PM) += pm.o pm_wakeup.o |
7 | obj-$(CONFIG_APM) += hp6xx_apm.o | 7 | obj-$(CONFIG_APM_EMULATION) += hp6xx_apm.o |
diff --git a/arch/sh/boards/hp6xx/setup.c b/arch/sh/boards/hp6xx/setup.c index b5a96649ed26..6aeee85c9785 100644 --- a/arch/sh/boards/hp6xx/setup.c +++ b/arch/sh/boards/hp6xx/setup.c | |||
@@ -2,6 +2,7 @@ | |||
2 | * linux/arch/sh/boards/hp6xx/setup.c | 2 | * linux/arch/sh/boards/hp6xx/setup.c |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Andriy Skulysh | 4 | * Copyright (C) 2002 Andriy Skulysh |
5 | * Copyright (C) 2007 Kristoffer Ericson <Kristoffer_e1@hotmail.com> | ||
5 | * | 6 | * |
6 | * May be copied or modified under the terms of the GNU General Public | 7 | * May be copied or modified under the terms of the GNU General Public |
7 | * License. See linux/COPYING for more information. | 8 | * License. See linux/COPYING for more information. |
@@ -10,6 +11,7 @@ | |||
10 | */ | 11 | */ |
11 | #include <linux/types.h> | 12 | #include <linux/types.h> |
12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/platform_device.h> | ||
13 | #include <asm/hd64461.h> | 15 | #include <asm/hd64461.h> |
14 | #include <asm/io.h> | 16 | #include <asm/io.h> |
15 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
@@ -19,6 +21,40 @@ | |||
19 | #define SCPCR 0xa4000116 | 21 | #define SCPCR 0xa4000116 |
20 | #define SCPDR 0xa4000136 | 22 | #define SCPDR 0xa4000136 |
21 | 23 | ||
24 | /* CF Slot */ | ||
25 | static struct resource cf_ide_resources[] = { | ||
26 | [0] = { | ||
27 | .start = 0x15000000 + 0x1f0, | ||
28 | .end = 0x15000000 + 0x1f0 + 0x08 - 0x01, | ||
29 | .flags = IORESOURCE_MEM, | ||
30 | }, | ||
31 | [1] = { | ||
32 | .start = 0x15000000 + 0x1fe, | ||
33 | .end = 0x15000000 + 0x1fe + 0x01, | ||
34 | .flags = IORESOURCE_MEM, | ||
35 | }, | ||
36 | [2] = { | ||
37 | .start = 93, | ||
38 | .flags = IORESOURCE_IRQ, | ||
39 | }, | ||
40 | }; | ||
41 | |||
42 | static struct platform_device cf_ide_device = { | ||
43 | .name = "pata_platform", | ||
44 | .id = -1, | ||
45 | .num_resources = ARRAY_SIZE(cf_ide_resources), | ||
46 | .resource = cf_ide_resources, | ||
47 | }; | ||
48 | |||
49 | static struct platform_device *hp6xx_devices[] __initdata = { | ||
50 | &cf_ide_device, | ||
51 | }; | ||
52 | |||
53 | static int __init hp6xx_devices_setup(void) | ||
54 | { | ||
55 | return platform_add_devices(hp6xx_devices, ARRAY_SIZE(hp6xx_devices)); | ||
56 | } | ||
57 | |||
22 | static void __init hp6xx_setup(char **cmdline_p) | 58 | static void __init hp6xx_setup(char **cmdline_p) |
23 | { | 59 | { |
24 | u8 v8; | 60 | u8 v8; |
@@ -60,41 +96,12 @@ static void __init hp6xx_setup(char **cmdline_p) | |||
60 | v |= SCPCR_TS_ENABLE; | 96 | v |= SCPCR_TS_ENABLE; |
61 | ctrl_outw(v, SCPCR); | 97 | ctrl_outw(v, SCPCR); |
62 | } | 98 | } |
99 | device_initcall(hp6xx_devices_setup); | ||
63 | 100 | ||
64 | /* | ||
65 | * XXX: This is stupid, we should have a generic machine vector for the cchips | ||
66 | * and just wrap the platform setup code in to this, as it's the only thing | ||
67 | * that ends up being different. | ||
68 | */ | ||
69 | struct sh_machine_vector mv_hp6xx __initmv = { | 101 | struct sh_machine_vector mv_hp6xx __initmv = { |
70 | .mv_name = "hp6xx", | 102 | .mv_name = "hp6xx", |
71 | .mv_setup = hp6xx_setup, | 103 | .mv_setup = hp6xx_setup, |
72 | .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM, | 104 | .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM, |
73 | |||
74 | .mv_inb = hd64461_inb, | ||
75 | .mv_inw = hd64461_inw, | ||
76 | .mv_inl = hd64461_inl, | ||
77 | .mv_outb = hd64461_outb, | ||
78 | .mv_outw = hd64461_outw, | ||
79 | .mv_outl = hd64461_outl, | ||
80 | |||
81 | .mv_inb_p = hd64461_inb_p, | ||
82 | .mv_inw_p = hd64461_inw, | ||
83 | .mv_inl_p = hd64461_inl, | ||
84 | .mv_outb_p = hd64461_outb_p, | ||
85 | .mv_outw_p = hd64461_outw, | ||
86 | .mv_outl_p = hd64461_outl, | ||
87 | |||
88 | .mv_insb = hd64461_insb, | ||
89 | .mv_insw = hd64461_insw, | ||
90 | .mv_insl = hd64461_insl, | ||
91 | .mv_outsb = hd64461_outsb, | ||
92 | .mv_outsw = hd64461_outsw, | ||
93 | .mv_outsl = hd64461_outsl, | ||
94 | |||
95 | .mv_readw = hd64461_readw, | ||
96 | .mv_writew = hd64461_writew, | ||
97 | |||
98 | .mv_irq_demux = hd64461_irq_demux, | 105 | .mv_irq_demux = hd64461_irq_demux, |
99 | }; | 106 | }; |
100 | ALIAS_MV(hp6xx) | 107 | ALIAS_MV(hp6xx) |
diff --git a/arch/sh/boards/landisk/Makefile b/arch/sh/boards/landisk/Makefile index 89e4beb2ad47..a696b4277fa9 100644 --- a/arch/sh/boards/landisk/Makefile +++ b/arch/sh/boards/landisk/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for I-O DATA DEVICE, INC. "LANDISK Series" | 2 | # Makefile for I-O DATA DEVICE, INC. "LANDISK Series" |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o io.o irq.o rtc.o landisk_pwb.o | 5 | obj-y := setup.o irq.o psw.o gio.o |
diff --git a/arch/sh/boards/landisk/gio.c b/arch/sh/boards/landisk/gio.c new file mode 100644 index 000000000000..50d38be62f01 --- /dev/null +++ b/arch/sh/boards/landisk/gio.c | |||
@@ -0,0 +1,167 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/landisk/gio.c - driver for landisk | ||
3 | * | ||
4 | * This driver will also support the I-O DATA Device, Inc. LANDISK Board. | ||
5 | * LANDISK and USL-5P Button, LED and GIO driver drive function. | ||
6 | * | ||
7 | * Copylight (C) 2006 kogiidena | ||
8 | * Copylight (C) 2002 Atom Create Engineering Co., Ltd. * | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | * | ||
14 | */ | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/kdev_t.h> | ||
18 | #include <linux/cdev.h> | ||
19 | #include <linux/fs.h> | ||
20 | #include <asm/io.h> | ||
21 | #include <asm/uaccess.h> | ||
22 | #include <asm/landisk/gio.h> | ||
23 | #include <asm/landisk/iodata_landisk.h> | ||
24 | |||
25 | #define DEVCOUNT 4 | ||
26 | #define GIO_MINOR 2 /* GIO minor no. */ | ||
27 | |||
28 | static dev_t dev; | ||
29 | static struct cdev *cdev_p; | ||
30 | static int openCnt; | ||
31 | |||
32 | static int gio_open(struct inode *inode, struct file *filp) | ||
33 | { | ||
34 | int minor; | ||
35 | |||
36 | minor = MINOR(inode->i_rdev); | ||
37 | if (minor < DEVCOUNT) { | ||
38 | if (openCnt > 0) { | ||
39 | return -EALREADY; | ||
40 | } else { | ||
41 | openCnt++; | ||
42 | return 0; | ||
43 | } | ||
44 | } | ||
45 | return -ENOENT; | ||
46 | } | ||
47 | |||
48 | static int gio_close(struct inode *inode, struct file *filp) | ||
49 | { | ||
50 | int minor; | ||
51 | |||
52 | minor = MINOR(inode->i_rdev); | ||
53 | if (minor < DEVCOUNT) { | ||
54 | openCnt--; | ||
55 | } | ||
56 | return 0; | ||
57 | } | ||
58 | |||
59 | static int gio_ioctl(struct inode *inode, struct file *filp, | ||
60 | unsigned int cmd, unsigned long arg) | ||
61 | { | ||
62 | unsigned int data; | ||
63 | static unsigned int addr = 0; | ||
64 | |||
65 | if (cmd & 0x01) { /* write */ | ||
66 | if (copy_from_user(&data, (int *)arg, sizeof(int))) { | ||
67 | return -EFAULT; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | switch (cmd) { | ||
72 | case GIODRV_IOCSGIOSETADDR: /* addres set */ | ||
73 | addr = data; | ||
74 | break; | ||
75 | |||
76 | case GIODRV_IOCSGIODATA1: /* write byte */ | ||
77 | ctrl_outb((unsigned char)(0x0ff & data), addr); | ||
78 | break; | ||
79 | |||
80 | case GIODRV_IOCSGIODATA2: /* write word */ | ||
81 | if (addr & 0x01) { | ||
82 | return -EFAULT; | ||
83 | } | ||
84 | ctrl_outw((unsigned short int)(0x0ffff & data), addr); | ||
85 | break; | ||
86 | |||
87 | case GIODRV_IOCSGIODATA4: /* write long */ | ||
88 | if (addr & 0x03) { | ||
89 | return -EFAULT; | ||
90 | } | ||
91 | ctrl_outl(data, addr); | ||
92 | break; | ||
93 | |||
94 | case GIODRV_IOCGGIODATA1: /* read byte */ | ||
95 | data = ctrl_inb(addr); | ||
96 | break; | ||
97 | |||
98 | case GIODRV_IOCGGIODATA2: /* read word */ | ||
99 | if (addr & 0x01) { | ||
100 | return -EFAULT; | ||
101 | } | ||
102 | data = ctrl_inw(addr); | ||
103 | break; | ||
104 | |||
105 | case GIODRV_IOCGGIODATA4: /* read long */ | ||
106 | if (addr & 0x03) { | ||
107 | return -EFAULT; | ||
108 | } | ||
109 | data = ctrl_inl(addr); | ||
110 | break; | ||
111 | default: | ||
112 | return -EFAULT; | ||
113 | break; | ||
114 | } | ||
115 | |||
116 | if ((cmd & 0x01) == 0) { /* read */ | ||
117 | if (copy_to_user((int *)arg, &data, sizeof(int))) { | ||
118 | return -EFAULT; | ||
119 | } | ||
120 | } | ||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | static struct file_operations gio_fops = { | ||
125 | .owner = THIS_MODULE, | ||
126 | .open = gio_open, /* open */ | ||
127 | .release = gio_close, /* release */ | ||
128 | .ioctl = gio_ioctl, /* ioctl */ | ||
129 | }; | ||
130 | |||
131 | static int __init gio_init(void) | ||
132 | { | ||
133 | int error; | ||
134 | |||
135 | printk(KERN_INFO "gio: driver initialized\n"); | ||
136 | |||
137 | openCnt = 0; | ||
138 | |||
139 | if ((error = alloc_chrdev_region(&dev, 0, DEVCOUNT, "gio")) < 0) { | ||
140 | printk(KERN_ERR | ||
141 | "gio: Couldn't alloc_chrdev_region, error=%d\n", | ||
142 | error); | ||
143 | return 1; | ||
144 | } | ||
145 | |||
146 | cdev_p = cdev_alloc(); | ||
147 | cdev_p->ops = &gio_fops; | ||
148 | error = cdev_add(cdev_p, dev, DEVCOUNT); | ||
149 | if (error) { | ||
150 | printk(KERN_ERR | ||
151 | "gio: Couldn't cdev_add, error=%d\n", error); | ||
152 | return 1; | ||
153 | } | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | static void __exit gio_exit(void) | ||
159 | { | ||
160 | cdev_del(cdev_p); | ||
161 | unregister_chrdev_region(dev, DEVCOUNT); | ||
162 | } | ||
163 | |||
164 | module_init(gio_init); | ||
165 | module_exit(gio_exit); | ||
166 | |||
167 | MODULE_LICENSE("GPL"); | ||
diff --git a/arch/sh/boards/landisk/io.c b/arch/sh/boards/landisk/io.c deleted file mode 100644 index 92498b4947d5..000000000000 --- a/arch/sh/boards/landisk/io.c +++ /dev/null | |||
@@ -1,250 +0,0 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/landisk/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 I-O Data Device, Inc. LANDISK. | ||
8 | * | ||
9 | * Initial version only to support LAN access; some | ||
10 | * placeholder code from io_landisk.c left in with the | ||
11 | * expectation of later SuperIO and PCMCIA access. | ||
12 | */ | ||
13 | /* | ||
14 | * modifed by kogiidena | ||
15 | * 2005.03.03 | ||
16 | */ | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/types.h> | ||
19 | #include <linux/pci.h> | ||
20 | #include <asm/landisk/iodata_landisk.h> | ||
21 | #include <asm/addrspace.h> | ||
22 | #include <asm/io.h> | ||
23 | |||
24 | extern void *area5_io_base; /* Area 5 I/O Base address */ | ||
25 | extern void *area6_io_base; /* Area 6 I/O Base address */ | ||
26 | |||
27 | static inline unsigned long port2adr(unsigned int port) | ||
28 | { | ||
29 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) | ||
30 | if (port == 0x3f6) | ||
31 | return ((unsigned long)area5_io_base + 0x2c); | ||
32 | else | ||
33 | return ((unsigned long)area5_io_base + PA_PIDE_OFFSET + | ||
34 | ((port - 0x1f0) << 1)); | ||
35 | else if ((0x170 <= port && port < 0x178) || port == 0x376) | ||
36 | if (port == 0x376) | ||
37 | return ((unsigned long)area6_io_base + 0x2c); | ||
38 | else | ||
39 | return ((unsigned long)area6_io_base + PA_SIDE_OFFSET + | ||
40 | ((port - 0x170) << 1)); | ||
41 | else | ||
42 | maybebadio((unsigned long)port); | ||
43 | |||
44 | return port; | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * General outline: remap really low stuff [eventually] to SuperIO, | ||
49 | * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) | ||
50 | * is mapped through the PCI IO window. Stuff with high bits (PXSEG) | ||
51 | * should be way beyond the window, and is used w/o translation for | ||
52 | * compatibility. | ||
53 | */ | ||
54 | u8 landisk_inb(unsigned long port) | ||
55 | { | ||
56 | if (PXSEG(port)) | ||
57 | return ctrl_inb(port); | ||
58 | else if (is_pci_ioaddr(port)) | ||
59 | return ctrl_inb(pci_ioaddr(port)); | ||
60 | |||
61 | return ctrl_inw(port2adr(port)) & 0xff; | ||
62 | } | ||
63 | |||
64 | u8 landisk_inb_p(unsigned long port) | ||
65 | { | ||
66 | u8 v; | ||
67 | |||
68 | if (PXSEG(port)) | ||
69 | v = ctrl_inb(port); | ||
70 | else if (is_pci_ioaddr(port)) | ||
71 | v = ctrl_inb(pci_ioaddr(port)); | ||
72 | else | ||
73 | v = ctrl_inw(port2adr(port)) & 0xff; | ||
74 | |||
75 | ctrl_delay(); | ||
76 | |||
77 | return v; | ||
78 | } | ||
79 | |||
80 | u16 landisk_inw(unsigned long port) | ||
81 | { | ||
82 | if (PXSEG(port)) | ||
83 | return ctrl_inw(port); | ||
84 | else if (is_pci_ioaddr(port)) | ||
85 | return ctrl_inw(pci_ioaddr(port)); | ||
86 | else | ||
87 | maybebadio(port); | ||
88 | |||
89 | return 0; | ||
90 | } | ||
91 | |||
92 | u32 landisk_inl(unsigned long port) | ||
93 | { | ||
94 | if (PXSEG(port)) | ||
95 | return ctrl_inl(port); | ||
96 | else if (is_pci_ioaddr(port)) | ||
97 | return ctrl_inl(pci_ioaddr(port)); | ||
98 | else | ||
99 | maybebadio(port); | ||
100 | |||
101 | return 0; | ||
102 | } | ||
103 | |||
104 | void landisk_outb(u8 value, unsigned long port) | ||
105 | { | ||
106 | if (PXSEG(port)) | ||
107 | ctrl_outb(value, port); | ||
108 | else if (is_pci_ioaddr(port)) | ||
109 | ctrl_outb(value, pci_ioaddr(port)); | ||
110 | else | ||
111 | ctrl_outw(value, port2adr(port)); | ||
112 | } | ||
113 | |||
114 | void landisk_outb_p(u8 value, unsigned long port) | ||
115 | { | ||
116 | if (PXSEG(port)) | ||
117 | ctrl_outb(value, port); | ||
118 | else if (is_pci_ioaddr(port)) | ||
119 | ctrl_outb(value, pci_ioaddr(port)); | ||
120 | else | ||
121 | ctrl_outw(value, port2adr(port)); | ||
122 | ctrl_delay(); | ||
123 | } | ||
124 | |||
125 | void landisk_outw(u16 value, unsigned long port) | ||
126 | { | ||
127 | if (PXSEG(port)) | ||
128 | ctrl_outw(value, port); | ||
129 | else if (is_pci_ioaddr(port)) | ||
130 | ctrl_outw(value, pci_ioaddr(port)); | ||
131 | else | ||
132 | maybebadio(port); | ||
133 | } | ||
134 | |||
135 | void landisk_outl(u32 value, unsigned long port) | ||
136 | { | ||
137 | if (PXSEG(port)) | ||
138 | ctrl_outl(value, port); | ||
139 | else if (is_pci_ioaddr(port)) | ||
140 | ctrl_outl(value, pci_ioaddr(port)); | ||
141 | else | ||
142 | maybebadio(port); | ||
143 | } | ||
144 | |||
145 | void landisk_insb(unsigned long port, void *dst, unsigned long count) | ||
146 | { | ||
147 | volatile u16 *p; | ||
148 | u8 *buf = dst; | ||
149 | |||
150 | if (PXSEG(port)) { | ||
151 | while (count--) | ||
152 | *buf++ = *(volatile u8 *)port; | ||
153 | } else if (is_pci_ioaddr(port)) { | ||
154 | volatile u8 *bp = (volatile u8 *)pci_ioaddr(port); | ||
155 | |||
156 | while (count--) | ||
157 | *buf++ = *bp; | ||
158 | } else { | ||
159 | p = (volatile u16 *)port2adr(port); | ||
160 | while (count--) | ||
161 | *buf++ = *p & 0xff; | ||
162 | } | ||
163 | } | ||
164 | |||
165 | void landisk_insw(unsigned long port, void *dst, unsigned long count) | ||
166 | { | ||
167 | volatile u16 *p; | ||
168 | u16 *buf = dst; | ||
169 | |||
170 | if (PXSEG(port)) | ||
171 | p = (volatile u16 *)port; | ||
172 | else if (is_pci_ioaddr(port)) | ||
173 | p = (volatile u16 *)pci_ioaddr(port); | ||
174 | else | ||
175 | p = (volatile u16 *)port2adr(port); | ||
176 | while (count--) | ||
177 | *buf++ = *p; | ||
178 | } | ||
179 | |||
180 | void landisk_insl(unsigned long port, void *dst, unsigned long count) | ||
181 | { | ||
182 | u32 *buf = dst; | ||
183 | |||
184 | if (is_pci_ioaddr(port)) { | ||
185 | volatile u32 *p = (volatile u32 *)pci_ioaddr(port); | ||
186 | |||
187 | while (count--) | ||
188 | *buf++ = *p; | ||
189 | } else | ||
190 | maybebadio(port); | ||
191 | } | ||
192 | |||
193 | void landisk_outsb(unsigned long port, const void *src, unsigned long count) | ||
194 | { | ||
195 | volatile u16 *p; | ||
196 | const u8 *buf = src; | ||
197 | |||
198 | if (PXSEG(port)) | ||
199 | while (count--) | ||
200 | ctrl_outb(*buf++, port); | ||
201 | else if (is_pci_ioaddr(port)) { | ||
202 | volatile u8 *bp = (volatile u8 *)pci_ioaddr(port); | ||
203 | |||
204 | while (count--) | ||
205 | *bp = *buf++; | ||
206 | } else { | ||
207 | p = (volatile u16 *)port2adr(port); | ||
208 | while (count--) | ||
209 | *p = *buf++; | ||
210 | } | ||
211 | } | ||
212 | |||
213 | void landisk_outsw(unsigned long port, const void *src, unsigned long count) | ||
214 | { | ||
215 | volatile u16 *p; | ||
216 | const u16 *buf = src; | ||
217 | |||
218 | if (PXSEG(port)) | ||
219 | p = (volatile u16 *)port; | ||
220 | else if (is_pci_ioaddr(port)) | ||
221 | p = (volatile u16 *)pci_ioaddr(port); | ||
222 | else | ||
223 | p = (volatile u16 *)port2adr(port); | ||
224 | |||
225 | while (count--) | ||
226 | *p = *buf++; | ||
227 | } | ||
228 | |||
229 | void landisk_outsl(unsigned long port, const void *src, unsigned long count) | ||
230 | { | ||
231 | const u32 *buf = src; | ||
232 | |||
233 | if (is_pci_ioaddr(port)) { | ||
234 | volatile u32 *p = (volatile u32 *)pci_ioaddr(port); | ||
235 | |||
236 | while (count--) | ||
237 | *p = *buf++; | ||
238 | } else | ||
239 | maybebadio(port); | ||
240 | } | ||
241 | |||
242 | void __iomem *landisk_ioport_map(unsigned long port, unsigned int size) | ||
243 | { | ||
244 | if (PXSEG(port)) | ||
245 | return (void __iomem *)port; | ||
246 | else if (is_pci_ioaddr(port)) | ||
247 | return (void __iomem *)pci_ioaddr(port); | ||
248 | |||
249 | return (void __iomem *)port2adr(port); | ||
250 | } | ||
diff --git a/arch/sh/boards/landisk/irq.c b/arch/sh/boards/landisk/irq.c index 3eba6d086d7f..258649491d44 100644 --- a/arch/sh/boards/landisk/irq.c +++ b/arch/sh/boards/landisk/irq.c | |||
@@ -1,18 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * arch/sh/boards/landisk/irq.c | 2 | * arch/sh/boards/landisk/irq.c |
3 | * | 3 | * |
4 | * I-O DATA Device, Inc. LANDISK Support | ||
5 | * | ||
6 | * Copyright (C) 2005-2007 kogiidena | ||
7 | * | ||
4 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel | 8 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel |
5 | * Based largely on io_se.c. | 9 | * Based largely on io_se.c. |
6 | * | 10 | * |
7 | * I/O routine for I-O Data Device, Inc. LANDISK. | 11 | * This file is subject to the terms and conditions of the GNU General Public |
8 | * | 12 | * License. See the file "COPYING" in the main directory of this archive |
9 | * Initial version only to support LAN access; some | 13 | * for more details. |
10 | * placeholder code from io_landisk.c left in with the | ||
11 | * expectation of later SuperIO and PCMCIA access. | ||
12 | */ | ||
13 | /* | ||
14 | * modified by kogiidena | ||
15 | * 2005.03.03 | ||
16 | */ | 14 | */ |
17 | #include <linux/init.h> | 15 | #include <linux/init.h> |
18 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
@@ -20,71 +18,27 @@ | |||
20 | #include <linux/io.h> | 18 | #include <linux/io.h> |
21 | #include <asm/landisk/iodata_landisk.h> | 19 | #include <asm/landisk/iodata_landisk.h> |
22 | 20 | ||
23 | static void enable_landisk_irq(unsigned int irq); | ||
24 | static void disable_landisk_irq(unsigned int irq); | ||
25 | |||
26 | /* shutdown is same as "disable" */ | ||
27 | #define shutdown_landisk_irq disable_landisk_irq | ||
28 | |||
29 | static void ack_landisk_irq(unsigned int irq); | ||
30 | static void end_landisk_irq(unsigned int irq); | ||
31 | |||
32 | static unsigned int startup_landisk_irq(unsigned int irq) | ||
33 | { | ||
34 | enable_landisk_irq(irq); | ||
35 | return 0; /* never anything pending */ | ||
36 | } | ||
37 | |||
38 | static void disable_landisk_irq(unsigned int irq) | 21 | static void disable_landisk_irq(unsigned int irq) |
39 | { | 22 | { |
40 | unsigned char val; | ||
41 | unsigned char mask = 0xff ^ (0x01 << (irq - 5)); | 23 | unsigned char mask = 0xff ^ (0x01 << (irq - 5)); |
42 | 24 | ||
43 | /* Set the priority in IPR to 0 */ | 25 | ctrl_outb(ctrl_inb(PA_IMASK) & mask, PA_IMASK); |
44 | val = ctrl_inb(PA_IMASK); | ||
45 | val &= mask; | ||
46 | ctrl_outb(val, PA_IMASK); | ||
47 | } | 26 | } |
48 | 27 | ||
49 | static void enable_landisk_irq(unsigned int irq) | 28 | static void enable_landisk_irq(unsigned int irq) |
50 | { | 29 | { |
51 | unsigned char val; | ||
52 | unsigned char value = (0x01 << (irq - 5)); | 30 | unsigned char value = (0x01 << (irq - 5)); |
53 | 31 | ||
54 | /* Set priority in IPR back to original value */ | 32 | ctrl_outb(ctrl_inb(PA_IMASK) | value, PA_IMASK); |
55 | val = ctrl_inb(PA_IMASK); | ||
56 | val |= value; | ||
57 | ctrl_outb(val, PA_IMASK); | ||
58 | } | ||
59 | |||
60 | static void ack_landisk_irq(unsigned int irq) | ||
61 | { | ||
62 | disable_landisk_irq(irq); | ||
63 | } | ||
64 | |||
65 | static void end_landisk_irq(unsigned int irq) | ||
66 | { | ||
67 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
68 | enable_landisk_irq(irq); | ||
69 | } | 33 | } |
70 | 34 | ||
71 | static struct hw_interrupt_type landisk_irq_type = { | 35 | static struct irq_chip landisk_irq_chip __read_mostly = { |
72 | .typename = "LANDISK IRQ", | 36 | .name = "LANDISK", |
73 | .startup = startup_landisk_irq, | 37 | .mask = disable_landisk_irq, |
74 | .shutdown = shutdown_landisk_irq, | 38 | .unmask = enable_landisk_irq, |
75 | .enable = enable_landisk_irq, | 39 | .mask_ack = disable_landisk_irq, |
76 | .disable = disable_landisk_irq, | ||
77 | .ack = ack_landisk_irq, | ||
78 | .end = end_landisk_irq | ||
79 | }; | 40 | }; |
80 | 41 | ||
81 | static void make_landisk_irq(unsigned int irq) | ||
82 | { | ||
83 | disable_irq_nosync(irq); | ||
84 | irq_desc[irq].chip = &landisk_irq_type; | ||
85 | disable_landisk_irq(irq); | ||
86 | } | ||
87 | |||
88 | /* | 42 | /* |
89 | * Initialize IRQ setting | 43 | * Initialize IRQ setting |
90 | */ | 44 | */ |
@@ -92,6 +46,11 @@ void __init init_landisk_IRQ(void) | |||
92 | { | 46 | { |
93 | int i; | 47 | int i; |
94 | 48 | ||
95 | for (i = 5; i < 14; i++) | 49 | for (i = 5; i < 14; i++) { |
96 | make_landisk_irq(i); | 50 | disable_irq_nosync(i); |
51 | set_irq_chip_and_handler_name(i, &landisk_irq_chip, | ||
52 | handle_level_irq, "level"); | ||
53 | enable_landisk_irq(i); | ||
54 | } | ||
55 | ctrl_outb(0x00, PA_PWRINT_CLR); | ||
97 | } | 56 | } |
diff --git a/arch/sh/boards/landisk/landisk_pwb.c b/arch/sh/boards/landisk/landisk_pwb.c deleted file mode 100644 index 47a63c6617ed..000000000000 --- a/arch/sh/boards/landisk/landisk_pwb.c +++ /dev/null | |||
@@ -1,346 +0,0 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/landisk/landisk_pwb.c -- driver for the Power control switch. | ||
3 | * | ||
4 | * This driver will also support the I-O DATA Device, Inc. LANDISK Board. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | * | ||
10 | * Copylight (C) 2002 Atom Create Engineering Co., Ltd. | ||
11 | * | ||
12 | * LED control drive function added by kogiidena | ||
13 | */ | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/signal.h> | ||
17 | #include <linux/major.h> | ||
18 | #include <linux/poll.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/sched.h> | ||
22 | #include <linux/timer.h> | ||
23 | #include <linux/interrupt.h> | ||
24 | |||
25 | #include <asm/system.h> | ||
26 | #include <asm/io.h> | ||
27 | #include <asm/irq.h> | ||
28 | #include <asm/uaccess.h> | ||
29 | #include <asm/landisk/iodata_landisk.h> | ||
30 | |||
31 | #define SHUTDOWN_BTN_MINOR 1 /* Shutdown button device minor no. */ | ||
32 | #define LED_MINOR 21 /* LED minor no. */ | ||
33 | #define BTN_MINOR 22 /* BUTTON minor no. */ | ||
34 | #define GIO_MINOR 40 /* GIO minor no. */ | ||
35 | |||
36 | static int openCnt; | ||
37 | static int openCntLED; | ||
38 | static int openCntGio; | ||
39 | static int openCntBtn; | ||
40 | static int landisk_btn; | ||
41 | static int landisk_btnctrlpid; | ||
42 | /* | ||
43 | * Functions prototypes | ||
44 | */ | ||
45 | |||
46 | static int gio_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | ||
47 | unsigned long arg); | ||
48 | |||
49 | static int swdrv_open(struct inode *inode, struct file *filp) | ||
50 | { | ||
51 | int minor; | ||
52 | |||
53 | minor = MINOR(inode->i_rdev); | ||
54 | filp->private_data = (void *)minor; | ||
55 | |||
56 | if (minor == SHUTDOWN_BTN_MINOR) { | ||
57 | if (openCnt > 0) { | ||
58 | return -EALREADY; | ||
59 | } else { | ||
60 | openCnt++; | ||
61 | return 0; | ||
62 | } | ||
63 | } else if (minor == LED_MINOR) { | ||
64 | if (openCntLED > 0) { | ||
65 | return -EALREADY; | ||
66 | } else { | ||
67 | openCntLED++; | ||
68 | return 0; | ||
69 | } | ||
70 | } else if (minor == BTN_MINOR) { | ||
71 | if (openCntBtn > 0) { | ||
72 | return -EALREADY; | ||
73 | } else { | ||
74 | openCntBtn++; | ||
75 | return 0; | ||
76 | } | ||
77 | } else if (minor == GIO_MINOR) { | ||
78 | if (openCntGio > 0) { | ||
79 | return -EALREADY; | ||
80 | } else { | ||
81 | openCntGio++; | ||
82 | return 0; | ||
83 | } | ||
84 | } | ||
85 | return -ENOENT; | ||
86 | |||
87 | } | ||
88 | |||
89 | static int swdrv_close(struct inode *inode, struct file *filp) | ||
90 | { | ||
91 | int minor; | ||
92 | |||
93 | minor = MINOR(inode->i_rdev); | ||
94 | if (minor == SHUTDOWN_BTN_MINOR) { | ||
95 | openCnt--; | ||
96 | } else if (minor == LED_MINOR) { | ||
97 | openCntLED--; | ||
98 | } else if (minor == BTN_MINOR) { | ||
99 | openCntBtn--; | ||
100 | } else if (minor == GIO_MINOR) { | ||
101 | openCntGio--; | ||
102 | } | ||
103 | return 0; | ||
104 | } | ||
105 | |||
106 | static int swdrv_read(struct file *filp, char *buff, size_t count, | ||
107 | loff_t * ppos) | ||
108 | { | ||
109 | int minor; | ||
110 | minor = (int)(filp->private_data); | ||
111 | |||
112 | if (!access_ok(VERIFY_WRITE, (void *)buff, count)) | ||
113 | return -EFAULT; | ||
114 | |||
115 | if (minor == SHUTDOWN_BTN_MINOR) { | ||
116 | if (landisk_btn & 0x10) { | ||
117 | put_user(1, buff); | ||
118 | return 1; | ||
119 | } else { | ||
120 | return 0; | ||
121 | } | ||
122 | } | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static int swdrv_write(struct file *filp, const char *buff, size_t count, | ||
127 | loff_t * ppos) | ||
128 | { | ||
129 | int minor; | ||
130 | minor = (int)(filp->private_data); | ||
131 | |||
132 | if (minor == SHUTDOWN_BTN_MINOR) { | ||
133 | return count; | ||
134 | } | ||
135 | return count; | ||
136 | } | ||
137 | |||
138 | static irqreturn_t sw_interrupt(int irq, void *dev_id) | ||
139 | { | ||
140 | landisk_btn = (0x0ff & (~ctrl_inb(PA_STATUS))); | ||
141 | disable_irq(IRQ_BUTTON); | ||
142 | disable_irq(IRQ_POWER); | ||
143 | ctrl_outb(0x00, PA_PWRINT_CLR); | ||
144 | |||
145 | if (landisk_btnctrlpid != 0) { | ||
146 | kill_proc(landisk_btnctrlpid, SIGUSR1, 1); | ||
147 | landisk_btnctrlpid = 0; | ||
148 | } | ||
149 | |||
150 | return IRQ_HANDLED; | ||
151 | } | ||
152 | |||
153 | static const struct file_operations swdrv_fops = { | ||
154 | .read = swdrv_read, /* read */ | ||
155 | .write = swdrv_write, /* write */ | ||
156 | .open = swdrv_open, /* open */ | ||
157 | .release = swdrv_close, /* release */ | ||
158 | .ioctl = gio_ioctl, /* ioctl */ | ||
159 | |||
160 | }; | ||
161 | |||
162 | static char banner[] __initdata = | ||
163 | KERN_INFO "LANDISK and USL-5P Button, LED and GIO driver initialized\n"; | ||
164 | |||
165 | int __init swdrv_init(void) | ||
166 | { | ||
167 | int error; | ||
168 | |||
169 | printk("%s", banner); | ||
170 | |||
171 | openCnt = 0; | ||
172 | openCntLED = 0; | ||
173 | openCntBtn = 0; | ||
174 | openCntGio = 0; | ||
175 | landisk_btn = 0; | ||
176 | landisk_btnctrlpid = 0; | ||
177 | |||
178 | if ((error = register_chrdev(SHUTDOWN_BTN_MAJOR, "swdrv", &swdrv_fops))) { | ||
179 | printk(KERN_ERR | ||
180 | "Button, LED and GIO driver:Couldn't register driver, error=%d\n", | ||
181 | error); | ||
182 | return 1; | ||
183 | } | ||
184 | |||
185 | if (request_irq(IRQ_POWER, sw_interrupt, 0, "SHUTDOWNSWITCH", NULL)) { | ||
186 | printk(KERN_ERR "Unable to get IRQ 11.\n"); | ||
187 | return 1; | ||
188 | } | ||
189 | if (request_irq(IRQ_BUTTON, sw_interrupt, 0, "USL-5P BUTTON", NULL)) { | ||
190 | printk(KERN_ERR "Unable to get IRQ 12.\n"); | ||
191 | return 1; | ||
192 | } | ||
193 | ctrl_outb(0x00, PA_PWRINT_CLR); | ||
194 | |||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | module_init(swdrv_init); | ||
199 | |||
200 | /* | ||
201 | * gio driver | ||
202 | * | ||
203 | */ | ||
204 | |||
205 | #include <asm/landisk/gio.h> | ||
206 | |||
207 | static int gio_ioctl(struct inode *inode, struct file *filp, | ||
208 | unsigned int cmd, unsigned long arg) | ||
209 | { | ||
210 | int minor; | ||
211 | unsigned int data, mask; | ||
212 | static unsigned int addr = 0; | ||
213 | |||
214 | minor = (int)(filp->private_data); | ||
215 | |||
216 | /* access control */ | ||
217 | if (minor == GIO_MINOR) { | ||
218 | ; | ||
219 | } else if (minor == LED_MINOR) { | ||
220 | if (((cmd & 0x0ff) >= 9) && ((cmd & 0x0ff) < 20)) { | ||
221 | ; | ||
222 | } else { | ||
223 | return -EINVAL; | ||
224 | } | ||
225 | } else if (minor == BTN_MINOR) { | ||
226 | if (((cmd & 0x0ff) >= 20) && ((cmd & 0x0ff) < 30)) { | ||
227 | ; | ||
228 | } else { | ||
229 | return -EINVAL; | ||
230 | } | ||
231 | } else { | ||
232 | return -EINVAL; | ||
233 | } | ||
234 | |||
235 | if (cmd & 0x01) { /* write */ | ||
236 | if (copy_from_user(&data, (int *)arg, sizeof(int))) { | ||
237 | return -EFAULT; | ||
238 | } | ||
239 | } | ||
240 | |||
241 | switch (cmd) { | ||
242 | case GIODRV_IOCSGIOSETADDR: /* addres set */ | ||
243 | addr = data; | ||
244 | break; | ||
245 | |||
246 | case GIODRV_IOCSGIODATA1: /* write byte */ | ||
247 | ctrl_outb((unsigned char)(0x0ff & data), addr); | ||
248 | break; | ||
249 | |||
250 | case GIODRV_IOCSGIODATA2: /* write word */ | ||
251 | if (addr & 0x01) { | ||
252 | return -EFAULT; | ||
253 | } | ||
254 | ctrl_outw((unsigned short int)(0x0ffff & data), addr); | ||
255 | break; | ||
256 | |||
257 | case GIODRV_IOCSGIODATA4: /* write long */ | ||
258 | if (addr & 0x03) { | ||
259 | return -EFAULT; | ||
260 | } | ||
261 | ctrl_outl(data, addr); | ||
262 | break; | ||
263 | |||
264 | case GIODRV_IOCGGIODATA1: /* read byte */ | ||
265 | data = ctrl_inb(addr); | ||
266 | break; | ||
267 | |||
268 | case GIODRV_IOCGGIODATA2: /* read word */ | ||
269 | if (addr & 0x01) { | ||
270 | return -EFAULT; | ||
271 | } | ||
272 | data = ctrl_inw(addr); | ||
273 | break; | ||
274 | |||
275 | case GIODRV_IOCGGIODATA4: /* read long */ | ||
276 | if (addr & 0x03) { | ||
277 | return -EFAULT; | ||
278 | } | ||
279 | data = ctrl_inl(addr); | ||
280 | break; | ||
281 | case GIODRV_IOCSGIO_LED: /* write */ | ||
282 | mask = ((data & 0x00ffffff) << 8) | ||
283 | | ((data & 0x0000ffff) << 16) | ||
284 | | ((data & 0x000000ff) << 24); | ||
285 | landisk_ledparam = data & (~mask); | ||
286 | if (landisk_arch == 0) { /* arch == landisk */ | ||
287 | landisk_ledparam &= 0x03030303; | ||
288 | mask = (~(landisk_ledparam >> 22)) & 0x000c; | ||
289 | landisk_ledparam |= mask; | ||
290 | } else { /* arch == usl-5p */ | ||
291 | mask = (landisk_ledparam >> 24) & 0x0001; | ||
292 | landisk_ledparam |= mask; | ||
293 | landisk_ledparam &= 0x007f7f7f; | ||
294 | } | ||
295 | landisk_ledparam |= 0x80; | ||
296 | break; | ||
297 | case GIODRV_IOCGGIO_LED: /* read */ | ||
298 | data = landisk_ledparam; | ||
299 | if (landisk_arch == 0) { /* arch == landisk */ | ||
300 | data &= 0x03030303; | ||
301 | } else { /* arch == usl-5p */ | ||
302 | ; | ||
303 | } | ||
304 | data &= (~0x080); | ||
305 | break; | ||
306 | case GIODRV_IOCSGIO_BUZZER: /* write */ | ||
307 | landisk_buzzerparam = data; | ||
308 | landisk_ledparam |= 0x80; | ||
309 | break; | ||
310 | case GIODRV_IOCGGIO_LANDISK: /* read */ | ||
311 | data = landisk_arch & 0x01; | ||
312 | break; | ||
313 | case GIODRV_IOCGGIO_BTN: /* read */ | ||
314 | data = (0x0ff & ctrl_inb(PA_PWRINT_CLR)); | ||
315 | data <<= 8; | ||
316 | data |= (0x0ff & ctrl_inb(PA_IMASK)); | ||
317 | data <<= 8; | ||
318 | data |= (0x0ff & landisk_btn); | ||
319 | data <<= 8; | ||
320 | data |= (0x0ff & (~ctrl_inb(PA_STATUS))); | ||
321 | break; | ||
322 | case GIODRV_IOCSGIO_BTNPID: /* write */ | ||
323 | landisk_btnctrlpid = data; | ||
324 | landisk_btn = 0; | ||
325 | if (irq_desc[IRQ_BUTTON].depth) { | ||
326 | enable_irq(IRQ_BUTTON); | ||
327 | } | ||
328 | if (irq_desc[IRQ_POWER].depth) { | ||
329 | enable_irq(IRQ_POWER); | ||
330 | } | ||
331 | break; | ||
332 | case GIODRV_IOCGGIO_BTNPID: /* read */ | ||
333 | data = landisk_btnctrlpid; | ||
334 | break; | ||
335 | default: | ||
336 | return -EFAULT; | ||
337 | break; | ||
338 | } | ||
339 | |||
340 | if ((cmd & 0x01) == 0) { /* read */ | ||
341 | if (copy_to_user((int *)arg, &data, sizeof(int))) { | ||
342 | return -EFAULT; | ||
343 | } | ||
344 | } | ||
345 | return 0; | ||
346 | } | ||
diff --git a/arch/sh/boards/landisk/psw.c b/arch/sh/boards/landisk/psw.c new file mode 100644 index 000000000000..5a9b70b5decb --- /dev/null +++ b/arch/sh/boards/landisk/psw.c | |||
@@ -0,0 +1,143 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/landisk/psw.c | ||
3 | * | ||
4 | * push switch support for LANDISK and USL-5P | ||
5 | * | ||
6 | * Copyright (C) 2006-2007 Paul Mundt | ||
7 | * Copyright (C) 2007 kogiidena | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General Public | ||
10 | * License. See the file "COPYING" in the main directory of this archive | ||
11 | * for more details. | ||
12 | */ | ||
13 | #include <linux/io.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <asm/landisk/iodata_landisk.h> | ||
18 | #include <asm/push-switch.h> | ||
19 | |||
20 | static irqreturn_t psw_irq_handler(int irq, void *arg) | ||
21 | { | ||
22 | struct platform_device *pdev = arg; | ||
23 | struct push_switch *psw = platform_get_drvdata(pdev); | ||
24 | struct push_switch_platform_info *psw_info = pdev->dev.platform_data; | ||
25 | unsigned int sw_value; | ||
26 | int ret = 0; | ||
27 | |||
28 | sw_value = (0x0ff & (~ctrl_inb(PA_STATUS))); | ||
29 | |||
30 | /* Nothing to do if there's no state change */ | ||
31 | if (psw->state) { | ||
32 | ret = 1; | ||
33 | goto out; | ||
34 | } | ||
35 | |||
36 | /* Figure out who raised it */ | ||
37 | if (sw_value & (1 << psw_info->bit)) { | ||
38 | psw->state = 1; | ||
39 | mod_timer(&psw->debounce, jiffies + 50); | ||
40 | ret = 1; | ||
41 | } | ||
42 | |||
43 | out: | ||
44 | /* Clear the switch IRQs */ | ||
45 | ctrl_outb(0x00, PA_PWRINT_CLR); | ||
46 | |||
47 | return IRQ_RETVAL(ret); | ||
48 | } | ||
49 | |||
50 | static struct resource psw_power_resources[] = { | ||
51 | [0] = { | ||
52 | .start = IRQ_POWER, | ||
53 | .flags = IORESOURCE_IRQ, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | static struct resource psw_usl5p_resources[] = { | ||
58 | [0] = { | ||
59 | .start = IRQ_BUTTON, | ||
60 | .flags = IORESOURCE_IRQ, | ||
61 | }, | ||
62 | }; | ||
63 | |||
64 | static struct push_switch_platform_info psw_power_platform_data = { | ||
65 | .name = "psw_power", | ||
66 | .bit = 4, | ||
67 | .irq_flags = IRQF_SHARED, | ||
68 | .irq_handler = psw_irq_handler, | ||
69 | }; | ||
70 | |||
71 | static struct push_switch_platform_info psw1_platform_data = { | ||
72 | .name = "psw1", | ||
73 | .bit = 0, | ||
74 | .irq_flags = IRQF_SHARED, | ||
75 | .irq_handler = psw_irq_handler, | ||
76 | }; | ||
77 | |||
78 | static struct push_switch_platform_info psw2_platform_data = { | ||
79 | .name = "psw2", | ||
80 | .bit = 2, | ||
81 | .irq_flags = IRQF_SHARED, | ||
82 | .irq_handler = psw_irq_handler, | ||
83 | }; | ||
84 | |||
85 | static struct push_switch_platform_info psw3_platform_data = { | ||
86 | .name = "psw3", | ||
87 | .bit = 1, | ||
88 | .irq_flags = IRQF_SHARED, | ||
89 | .irq_handler = psw_irq_handler, | ||
90 | }; | ||
91 | |||
92 | static struct platform_device psw_power_switch_device = { | ||
93 | .name = "push-switch", | ||
94 | .id = 0, | ||
95 | .num_resources = ARRAY_SIZE(psw_power_resources), | ||
96 | .resource = psw_power_resources, | ||
97 | .dev = { | ||
98 | .platform_data = &psw_power_platform_data, | ||
99 | }, | ||
100 | }; | ||
101 | |||
102 | static struct platform_device psw1_switch_device = { | ||
103 | .name = "push-switch", | ||
104 | .id = 1, | ||
105 | .num_resources = ARRAY_SIZE(psw_usl5p_resources), | ||
106 | .resource = psw_usl5p_resources, | ||
107 | .dev = { | ||
108 | .platform_data = &psw1_platform_data, | ||
109 | }, | ||
110 | }; | ||
111 | |||
112 | static struct platform_device psw2_switch_device = { | ||
113 | .name = "push-switch", | ||
114 | .id = 2, | ||
115 | .num_resources = ARRAY_SIZE(psw_usl5p_resources), | ||
116 | .resource = psw_usl5p_resources, | ||
117 | .dev = { | ||
118 | .platform_data = &psw2_platform_data, | ||
119 | }, | ||
120 | }; | ||
121 | |||
122 | static struct platform_device psw3_switch_device = { | ||
123 | .name = "push-switch", | ||
124 | .id = 3, | ||
125 | .num_resources = ARRAY_SIZE(psw_usl5p_resources), | ||
126 | .resource = psw_usl5p_resources, | ||
127 | .dev = { | ||
128 | .platform_data = &psw3_platform_data, | ||
129 | }, | ||
130 | }; | ||
131 | |||
132 | static struct platform_device *psw_devices[] = { | ||
133 | &psw_power_switch_device, | ||
134 | &psw1_switch_device, | ||
135 | &psw2_switch_device, | ||
136 | &psw3_switch_device, | ||
137 | }; | ||
138 | |||
139 | static int __init psw_init(void) | ||
140 | { | ||
141 | return platform_add_devices(psw_devices, ARRAY_SIZE(psw_devices)); | ||
142 | } | ||
143 | module_init(psw_init); | ||
diff --git a/arch/sh/boards/landisk/rtc.c b/arch/sh/boards/landisk/rtc.c deleted file mode 100644 index 0a9a2a2ad05b..000000000000 --- a/arch/sh/boards/landisk/rtc.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* | ||
2 | * arch/sh/boards/landisk/rtc.c -- RTC support | ||
3 | * | ||
4 | * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> | ||
5 | * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka | ||
6 | */ | ||
7 | /* | ||
8 | * modifed by kogiidena | ||
9 | * 2005.09.16 | ||
10 | */ | ||
11 | #include <linux/init.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/time.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/spinlock.h> | ||
17 | #include <linux/bcd.h> | ||
18 | #include <asm/rtc.h> | ||
19 | |||
20 | extern spinlock_t rtc_lock; | ||
21 | |||
22 | extern void | ||
23 | rs5c313_set_cmos_time(unsigned int BCD_yr, unsigned int BCD_mon, | ||
24 | unsigned int BCD_day, unsigned int BCD_hr, | ||
25 | unsigned int BCD_min, unsigned int BCD_sec); | ||
26 | |||
27 | extern unsigned long | ||
28 | rs5c313_get_cmos_time(unsigned int *BCD_yr, unsigned int *BCD_mon, | ||
29 | unsigned int *BCD_day, unsigned int *BCD_hr, | ||
30 | unsigned int *BCD_min, unsigned int *BCD_sec); | ||
31 | |||
32 | void landisk_rtc_gettimeofday(struct timespec *tv) | ||
33 | { | ||
34 | unsigned int BCD_yr, BCD_mon, BCD_day, BCD_hr, BCD_min, BCD_sec; | ||
35 | unsigned long flags; | ||
36 | |||
37 | spin_lock_irqsave(&rtc_lock, flags); | ||
38 | tv->tv_sec = rs5c313_get_cmos_time | ||
39 | (&BCD_yr, &BCD_mon, &BCD_day, &BCD_hr, &BCD_min, &BCD_sec); | ||
40 | tv->tv_nsec = 0; | ||
41 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
42 | } | ||
43 | |||
44 | int landisk_rtc_settimeofday(const time_t secs) | ||
45 | { | ||
46 | int retval = 0; | ||
47 | int real_seconds, real_minutes, cmos_minutes; | ||
48 | unsigned long flags; | ||
49 | unsigned long nowtime = secs; | ||
50 | unsigned int BCD_yr, BCD_mon, BCD_day, BCD_hr, BCD_min, BCD_sec; | ||
51 | |||
52 | spin_lock_irqsave(&rtc_lock, flags); | ||
53 | |||
54 | rs5c313_get_cmos_time | ||
55 | (&BCD_yr, &BCD_mon, &BCD_day, &BCD_hr, &BCD_min, &BCD_sec); | ||
56 | cmos_minutes = BCD_min; | ||
57 | BCD_TO_BIN(cmos_minutes); | ||
58 | |||
59 | /* | ||
60 | * since we're only adjusting minutes and seconds, | ||
61 | * don't interfere with hour overflow. This avoids | ||
62 | * messing with unknown time zones but requires your | ||
63 | * RTC not to be off by more than 15 minutes | ||
64 | */ | ||
65 | real_seconds = nowtime % 60; | ||
66 | real_minutes = nowtime / 60; | ||
67 | if (((abs(real_minutes - cmos_minutes) + 15) / 30) & 1) | ||
68 | real_minutes += 30; /* correct for half hour time zone */ | ||
69 | real_minutes %= 60; | ||
70 | |||
71 | if (abs(real_minutes - cmos_minutes) < 30) { | ||
72 | BIN_TO_BCD(real_seconds); | ||
73 | BIN_TO_BCD(real_minutes); | ||
74 | rs5c313_set_cmos_time(BCD_yr, BCD_mon, BCD_day, BCD_hr, | ||
75 | real_minutes, real_seconds); | ||
76 | } else { | ||
77 | printk(KERN_WARNING | ||
78 | "set_rtc_time: can't update from %d to %d\n", | ||
79 | cmos_minutes, real_minutes); | ||
80 | retval = -1; | ||
81 | } | ||
82 | |||
83 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
84 | return retval; | ||
85 | } | ||
86 | |||
87 | void landisk_time_init(void) | ||
88 | { | ||
89 | rtc_sh_get_time = landisk_rtc_gettimeofday; | ||
90 | rtc_sh_set_time = landisk_rtc_settimeofday; | ||
91 | } | ||
diff --git a/arch/sh/boards/landisk/setup.c b/arch/sh/boards/landisk/setup.c index 122d69962637..a83a5d9587bb 100644 --- a/arch/sh/boards/landisk/setup.c +++ b/arch/sh/boards/landisk/setup.c | |||
@@ -1,144 +1,90 @@ | |||
1 | /* | 1 | /* |
2 | * arch/sh/boards/landisk/setup.c | 2 | * arch/sh/boards/landisk/setup.c |
3 | * | 3 | * |
4 | * Copyright (C) 2000 Kazumoto Kojima | ||
5 | * Copyright (C) 2002 Paul Mundt | ||
6 | * | ||
7 | * I-O DATA Device, Inc. LANDISK Support. | 4 | * I-O DATA Device, Inc. LANDISK Support. |
8 | * | 5 | * |
9 | * Modified for LANDISK by | 6 | * Copyright (C) 2000 Kazumoto Kojima |
10 | * Atom Create Engineering Co., Ltd. 2002. | 7 | * Copyright (C) 2002 Paul Mundt |
11 | * | 8 | * Copylight (C) 2002 Atom Create Engineering Co., Ltd. |
12 | * modifed by kogiidena | 9 | * Copyright (C) 2005-2007 kogiidena |
13 | * 2005.09.16 | ||
14 | * | 10 | * |
15 | * This file is subject to the terms and conditions of the GNU General Public | 11 | * This file is subject to the terms and conditions of the GNU General Public |
16 | * License. See the file "COPYING" in the main directory of this archive | 12 | * License. See the file "COPYING" in the main directory of this archive |
17 | * for more details. | 13 | * for more details. |
18 | */ | 14 | */ |
19 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/pata_platform.h> | ||
20 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
21 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
22 | #include <asm/machvec.h> | 20 | #include <asm/machvec.h> |
23 | #include <asm/rtc.h> | ||
24 | #include <asm/landisk/iodata_landisk.h> | 21 | #include <asm/landisk/iodata_landisk.h> |
25 | #include <asm/io.h> | 22 | #include <asm/io.h> |
26 | 23 | ||
27 | void landisk_time_init(void); | ||
28 | void init_landisk_IRQ(void); | 24 | void init_landisk_IRQ(void); |
29 | 25 | ||
30 | int landisk_ledparam; | ||
31 | int landisk_buzzerparam; | ||
32 | int landisk_arch; | ||
33 | |||
34 | /* cycle the led's in the clasic knightrider/sun pattern */ | ||
35 | static void heartbeat_landisk(void) | ||
36 | { | ||
37 | static unsigned int cnt = 0, blink = 0x00, period = 25; | ||
38 | volatile u8 *p = (volatile u8 *)PA_LED; | ||
39 | char data; | ||
40 | |||
41 | if ((landisk_ledparam & 0x080) == 0) | ||
42 | return; | ||
43 | |||
44 | cnt += 1; | ||
45 | |||
46 | if (cnt < period) | ||
47 | return; | ||
48 | |||
49 | cnt = 0; | ||
50 | blink++; | ||
51 | |||
52 | data = (blink & 0x01) ? (landisk_ledparam >> 16) : 0; | ||
53 | data |= (blink & 0x02) ? (landisk_ledparam >> 8) : 0; | ||
54 | data |= landisk_ledparam; | ||
55 | |||
56 | /* buzzer */ | ||
57 | if (landisk_buzzerparam & 0x1) { | ||
58 | data |= 0x80; | ||
59 | } else { | ||
60 | data &= 0x7f; | ||
61 | } | ||
62 | *p = data; | ||
63 | |||
64 | if (((landisk_ledparam & 0x007f7f00) == 0) && | ||
65 | (landisk_buzzerparam == 0)) | ||
66 | landisk_ledparam &= (~0x0080); | ||
67 | |||
68 | landisk_buzzerparam >>= 1; | ||
69 | } | ||
70 | |||
71 | static void landisk_power_off(void) | 26 | static void landisk_power_off(void) |
72 | { | 27 | { |
73 | ctrl_outb(0x01, PA_SHUTDOWN); | 28 | ctrl_outb(0x01, PA_SHUTDOWN); |
74 | } | 29 | } |
75 | 30 | ||
76 | static void check_usl5p(void) | 31 | static struct resource cf_ide_resources[3]; |
77 | { | ||
78 | volatile u8 *p = (volatile u8 *)PA_LED; | ||
79 | u8 tmp1, tmp2; | ||
80 | 32 | ||
81 | tmp1 = *p; | 33 | static struct pata_platform_info pata_info = { |
82 | *p = 0x40; | 34 | .ioport_shift = 1, |
83 | tmp2 = *p; | 35 | }; |
84 | *p = tmp1; | ||
85 | 36 | ||
86 | landisk_arch = (tmp2 == 0x40); | 37 | static struct platform_device cf_ide_device = { |
87 | if (landisk_arch == 1) { | 38 | .name = "pata_platform", |
88 | /* arch == usl-5p */ | 39 | .id = -1, |
89 | landisk_ledparam = 0x00000380; | 40 | .num_resources = ARRAY_SIZE(cf_ide_resources), |
90 | landisk_ledparam |= (tmp1 & 0x07c); | 41 | .resource = cf_ide_resources, |
91 | } else { | 42 | .dev = { |
92 | /* arch == landisk */ | 43 | .platform_data = &pata_info, |
93 | landisk_ledparam = 0x02000180; | 44 | }, |
94 | landisk_ledparam |= 0x04; | 45 | }; |
95 | } | ||
96 | } | ||
97 | 46 | ||
98 | void *area5_io_base; | 47 | static struct platform_device *landisk_devices[] __initdata = { |
99 | void *area6_io_base; | 48 | &cf_ide_device, |
49 | }; | ||
100 | 50 | ||
101 | static int __init landisk_cf_init(void) | 51 | static int __init landisk_devices_setup(void) |
102 | { | 52 | { |
103 | pgprot_t prot; | 53 | pgprot_t prot; |
104 | unsigned long paddrbase, psize; | 54 | unsigned long paddrbase; |
55 | void *cf_ide_base; | ||
105 | 56 | ||
106 | /* open I/O area window */ | 57 | /* open I/O area window */ |
107 | paddrbase = virt_to_phys((void *)PA_AREA5_IO); | 58 | paddrbase = virt_to_phys((void *)PA_AREA5_IO); |
108 | psize = PAGE_SIZE; | ||
109 | prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16); | 59 | prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16); |
110 | area5_io_base = p3_ioremap(paddrbase, psize, prot.pgprot); | 60 | cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot); |
111 | if (!area5_io_base) { | 61 | if (!cf_ide_base) { |
112 | printk("allocate_cf_area : can't open CF I/O window!\n"); | 62 | printk("allocate_cf_area : can't open CF I/O window!\n"); |
113 | return -ENOMEM; | 63 | return -ENOMEM; |
114 | } | 64 | } |
115 | 65 | ||
116 | paddrbase = virt_to_phys((void *)PA_AREA6_IO); | 66 | /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */ |
117 | psize = PAGE_SIZE; | 67 | cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40; |
118 | prot = PAGE_KERNEL_PCC(0, _PAGE_PCC_IO16); | 68 | cf_ide_resources[0].end = (unsigned long)cf_ide_base + 0x40 + 0x0f; |
119 | area6_io_base = p3_ioremap(paddrbase, psize, prot.pgprot); | 69 | cf_ide_resources[0].flags = IORESOURCE_IO; |
120 | if (!area6_io_base) { | 70 | cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c; |
121 | printk("allocate_cf_area : can't open HDD I/O window!\n"); | 71 | cf_ide_resources[1].end = (unsigned long)cf_ide_base + 0x2c + 0x03; |
122 | return -ENOMEM; | 72 | cf_ide_resources[1].flags = IORESOURCE_IO; |
123 | } | 73 | cf_ide_resources[2].start = IRQ_FATA; |
124 | 74 | cf_ide_resources[2].flags = IORESOURCE_IRQ; | |
125 | printk(KERN_INFO "Allocate Area5/6 success.\n"); | 75 | |
126 | 76 | return platform_add_devices(landisk_devices, | |
127 | /* XXX : do we need attribute and common-memory area also? */ | 77 | ARRAY_SIZE(landisk_devices)); |
128 | |||
129 | return 0; | ||
130 | } | 78 | } |
131 | 79 | ||
80 | __initcall(landisk_devices_setup); | ||
81 | |||
132 | static void __init landisk_setup(char **cmdline_p) | 82 | static void __init landisk_setup(char **cmdline_p) |
133 | { | 83 | { |
134 | device_initcall(landisk_cf_init); | 84 | /* LED ON */ |
135 | 85 | ctrl_outb(ctrl_inb(PA_LED) | 0x03, PA_LED); | |
136 | landisk_buzzerparam = 0; | ||
137 | check_usl5p(); | ||
138 | 86 | ||
139 | printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n"); | 87 | printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n"); |
140 | |||
141 | board_time_init = landisk_time_init; | ||
142 | pm_power_off = landisk_power_off; | 88 | pm_power_off = landisk_power_off; |
143 | } | 89 | } |
144 | 90 | ||
@@ -148,29 +94,6 @@ static void __init landisk_setup(char **cmdline_p) | |||
148 | struct sh_machine_vector mv_landisk __initmv = { | 94 | struct sh_machine_vector mv_landisk __initmv = { |
149 | .mv_name = "LANDISK", | 95 | .mv_name = "LANDISK", |
150 | .mv_setup = landisk_setup, | 96 | .mv_setup = landisk_setup, |
151 | .mv_nr_irqs = 72, | ||
152 | .mv_inb = landisk_inb, | ||
153 | .mv_inw = landisk_inw, | ||
154 | .mv_inl = landisk_inl, | ||
155 | .mv_outb = landisk_outb, | ||
156 | .mv_outw = landisk_outw, | ||
157 | .mv_outl = landisk_outl, | ||
158 | .mv_inb_p = landisk_inb_p, | ||
159 | .mv_inw_p = landisk_inw, | ||
160 | .mv_inl_p = landisk_inl, | ||
161 | .mv_outb_p = landisk_outb_p, | ||
162 | .mv_outw_p = landisk_outw, | ||
163 | .mv_outl_p = landisk_outl, | ||
164 | .mv_insb = landisk_insb, | ||
165 | .mv_insw = landisk_insw, | ||
166 | .mv_insl = landisk_insl, | ||
167 | .mv_outsb = landisk_outsb, | ||
168 | .mv_outsw = landisk_outsw, | ||
169 | .mv_outsl = landisk_outsl, | ||
170 | .mv_ioport_map = landisk_ioport_map, | ||
171 | .mv_init_irq = init_landisk_IRQ, | 97 | .mv_init_irq = init_landisk_IRQ, |
172 | #ifdef CONFIG_HEARTBEAT | ||
173 | .mv_heartbeat = heartbeat_landisk, | ||
174 | #endif | ||
175 | }; | 98 | }; |
176 | ALIAS_MV(landisk) | 99 | ALIAS_MV(landisk) |
diff --git a/arch/sh/boards/lboxre2/Makefile b/arch/sh/boards/lboxre2/Makefile new file mode 100644 index 000000000000..e9ed140c06f6 --- /dev/null +++ b/arch/sh/boards/lboxre2/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for the L-BOX RE2 specific parts of the kernel | ||
3 | # Copyright (c) 2007 Nobuhiro Iwamatsu | ||
4 | |||
5 | obj-y := setup.o irq.o | ||
diff --git a/arch/sh/boards/lboxre2/irq.c b/arch/sh/boards/lboxre2/irq.c new file mode 100644 index 000000000000..5a1c3bbe7b50 --- /dev/null +++ b/arch/sh/boards/lboxre2/irq.c | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/lboxre2/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Nobuhiro Iwamatsu | ||
5 | * | ||
6 | * NTT COMWARE L-BOX RE2 Support. | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | * | ||
12 | */ | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <linux/irq.h> | ||
16 | #include <asm/irq.h> | ||
17 | #include <asm/io.h> | ||
18 | #include <asm/lboxre2.h> | ||
19 | |||
20 | /* | ||
21 | * Initialize IRQ setting | ||
22 | */ | ||
23 | void __init init_lboxre2_IRQ(void) | ||
24 | { | ||
25 | make_imask_irq(IRQ_CF1); | ||
26 | make_imask_irq(IRQ_CF0); | ||
27 | make_imask_irq(IRQ_INTD); | ||
28 | make_imask_irq(IRQ_ETH1); | ||
29 | make_imask_irq(IRQ_ETH0); | ||
30 | make_imask_irq(IRQ_INTA); | ||
31 | } | ||
diff --git a/arch/sh/boards/lboxre2/setup.c b/arch/sh/boards/lboxre2/setup.c new file mode 100644 index 000000000000..4e20f7c63bf3 --- /dev/null +++ b/arch/sh/boards/lboxre2/setup.c | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/lbox/setup.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Nobuhiro Iwamatsu | ||
5 | * | ||
6 | * NTT COMWARE L-BOX RE2 Support | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/pata_platform.h> | ||
17 | #include <asm/machvec.h> | ||
18 | #include <asm/addrspace.h> | ||
19 | #include <asm/lboxre2.h> | ||
20 | #include <asm/io.h> | ||
21 | |||
22 | static struct resource cf_ide_resources[] = { | ||
23 | [0] = { | ||
24 | .start = 0x1f0, | ||
25 | .end = 0x1f0 + 8 , | ||
26 | .flags = IORESOURCE_IO, | ||
27 | }, | ||
28 | [1] = { | ||
29 | .start = 0x1f0 + 0x206, | ||
30 | .end = 0x1f0 +8 + 0x206 + 8, | ||
31 | .flags = IORESOURCE_IO, | ||
32 | }, | ||
33 | [2] = { | ||
34 | .start = IRQ_CF0, | ||
35 | .flags = IORESOURCE_IRQ, | ||
36 | }, | ||
37 | }; | ||
38 | |||
39 | static struct platform_device cf_ide_device = { | ||
40 | .name = "pata_platform", | ||
41 | .id = -1, | ||
42 | .num_resources = ARRAY_SIZE(cf_ide_resources), | ||
43 | .resource = cf_ide_resources, | ||
44 | }; | ||
45 | |||
46 | static struct platform_device *lboxre2_devices[] __initdata = { | ||
47 | &cf_ide_device, | ||
48 | }; | ||
49 | |||
50 | static int __init lboxre2_devices_setup(void) | ||
51 | { | ||
52 | u32 cf0_io_base; /* Boot CF base address */ | ||
53 | pgprot_t prot; | ||
54 | unsigned long paddrbase, psize; | ||
55 | |||
56 | /* open I/O area window */ | ||
57 | paddrbase = virt_to_phys((void*)PA_AREA5_IO); | ||
58 | psize = PAGE_SIZE; | ||
59 | prot = PAGE_KERNEL_PCC( 1 , _PAGE_PCC_IO16); | ||
60 | cf0_io_base = (u32)p3_ioremap(paddrbase, psize, prot.pgprot); | ||
61 | if (!cf0_io_base) { | ||
62 | printk(KERN_ERR "%s : can't open CF I/O window!\n" , __func__ ); | ||
63 | return -ENOMEM; | ||
64 | } | ||
65 | |||
66 | cf_ide_resources[0].start += cf0_io_base ; | ||
67 | cf_ide_resources[0].end += cf0_io_base ; | ||
68 | cf_ide_resources[1].start += cf0_io_base ; | ||
69 | cf_ide_resources[1].end += cf0_io_base ; | ||
70 | |||
71 | return platform_add_devices(lboxre2_devices, | ||
72 | ARRAY_SIZE(lboxre2_devices)); | ||
73 | |||
74 | } | ||
75 | device_initcall(lboxre2_devices_setup); | ||
76 | |||
77 | /* | ||
78 | * The Machine Vector | ||
79 | */ | ||
80 | struct sh_machine_vector mv_lboxre2 __initmv = { | ||
81 | .mv_name = "L-BOX RE2", | ||
82 | .mv_nr_irqs = 72, | ||
83 | .mv_init_irq = init_lboxre2_IRQ, | ||
84 | }; | ||
85 | ALIAS_MV(lboxre2) | ||
diff --git a/arch/sh/boards/renesas/r7780rp/Kconfig b/arch/sh/boards/renesas/r7780rp/Kconfig index c26d9813d239..9fb11641fe13 100644 --- a/arch/sh/boards/renesas/r7780rp/Kconfig +++ b/arch/sh/boards/renesas/r7780rp/Kconfig | |||
@@ -1,14 +1,24 @@ | |||
1 | if SH_R7780RP | 1 | if SH_HIGHLANDER |
2 | 2 | ||
3 | menu "R7780RP options" | 3 | choice |
4 | prompt "Highlander options" | ||
5 | default SH_R7780MP | ||
6 | |||
7 | config SH_R7780RP | ||
8 | bool "R7780RP-1 board support" | ||
9 | select CPU_SUBTYPE_SH7780 | ||
4 | 10 | ||
5 | config SH_R7780MP | 11 | config SH_R7780MP |
6 | bool "R7780MP board support" | 12 | bool "R7780MP board support" |
7 | default y | 13 | select CPU_SUBTYPE_SH7780 |
8 | help | 14 | help |
9 | Selecting this option will enable support for the mass-production | 15 | Selecting this option will enable support for the mass-production |
10 | version of the R7780RP. If in doubt, say Y. | 16 | version of the R7780RP. If in doubt, say Y. |
11 | 17 | ||
12 | endmenu | 18 | config SH_R7785RP |
19 | bool "R7785RP board support" | ||
20 | select CPU_SUBTYPE_SH7785 | ||
21 | |||
22 | endchoice | ||
13 | 23 | ||
14 | endif | 24 | endif |
diff --git a/arch/sh/boards/renesas/r7780rp/Makefile b/arch/sh/boards/renesas/r7780rp/Makefile index ed5f5a9a3b3e..609e5d50dde8 100644 --- a/arch/sh/boards/renesas/r7780rp/Makefile +++ b/arch/sh/boards/renesas/r7780rp/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Makefile for the R7780RP-1 specific parts of the kernel | 2 | # Makefile for the R7780RP-1 specific parts of the kernel |
3 | # | 3 | # |
4 | 4 | irqinit-y := irq-r7780rp.o | |
5 | obj-y := setup.o irq.o | 5 | irqinit-$(CONFIG_SH_R7785RP) := irq-r7785rp.o |
6 | |||
7 | obj-$(CONFIG_PUSH_SWITCH) += psw.o | 6 | obj-$(CONFIG_PUSH_SWITCH) += psw.o |
7 | obj-y := setup.o irq.o $(irqinit-y) | ||
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c b/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c new file mode 100644 index 000000000000..f5f358746c9e --- /dev/null +++ b/arch/sh/boards/renesas/r7780rp/irq-r7780rp.c | |||
@@ -0,0 +1,21 @@ | |||
1 | /* | ||
2 | * Renesas Solutions Highlander R7780RP-1 Support. | ||
3 | * | ||
4 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. | ||
5 | * Copyright (C) 2006 Paul Mundt | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | #include <linux/init.h> | ||
12 | #include <asm/io.h> | ||
13 | #include <asm/r7780rp.h> | ||
14 | |||
15 | void __init highlander_init_irq(void) | ||
16 | { | ||
17 | int i; | ||
18 | |||
19 | for (i = 0; i < 15; i++) | ||
20 | make_r7780rp_irq(i); | ||
21 | } | ||
diff --git a/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c b/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c new file mode 100644 index 000000000000..dd6ec4ce44dc --- /dev/null +++ b/arch/sh/boards/renesas/r7780rp/irq-r7785rp.c | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | * Renesas Solutions Highlander R7780RP-1 Support. | ||
3 | * | ||
4 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. | ||
5 | * Copyright (C) 2006 Paul Mundt | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | #include <linux/init.h> | ||
12 | #include <asm/io.h> | ||
13 | #include <asm/r7780rp.h> | ||
14 | |||
15 | void __init highlander_init_irq(void) | ||
16 | { | ||
17 | ctrl_outw(0x0000, PA_IRLSSR1); /* FPGA IRLSSR1(CF_CD clear) */ | ||
18 | |||
19 | /* Setup the FPGA IRL */ | ||
20 | ctrl_outw(0x0000, PA_IRLPRA); /* FPGA IRLA */ | ||
21 | ctrl_outw(0xe598, PA_IRLPRB); /* FPGA IRLB */ | ||
22 | ctrl_outw(0x7060, PA_IRLPRC); /* FPGA IRLC */ | ||
23 | ctrl_outw(0x0000, PA_IRLPRD); /* FPGA IRLD */ | ||
24 | ctrl_outw(0x4321, PA_IRLPRE); /* FPGA IRLE */ | ||
25 | ctrl_outw(0x0000, PA_IRLPRF); /* FPGA IRLF */ | ||
26 | |||
27 | make_r7780rp_irq(1); /* CF card */ | ||
28 | make_r7780rp_irq(10); /* On-board ethernet */ | ||
29 | } | ||
diff --git a/arch/sh/boards/renesas/r7780rp/irq.c b/arch/sh/boards/renesas/r7780rp/irq.c index cc381e197783..e0b8eb52f376 100644 --- a/arch/sh/boards/renesas/r7780rp/irq.c +++ b/arch/sh/boards/renesas/r7780rp/irq.c | |||
@@ -14,10 +14,12 @@ | |||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <asm/r7780rp.h> | 15 | #include <asm/r7780rp.h> |
16 | 16 | ||
17 | #ifdef CONFIG_SH_R7780MP | 17 | #ifdef CONFIG_SH_R7780RP |
18 | static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0}; | ||
19 | #else | ||
20 | static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0}; | 18 | static int mask_pos[] = {15, 14, 13, 12, 11, 10, 9, 8, 7, 5, 6, 4, 0, 1, 2, 0}; |
19 | #elif defined(CONFIG_SH_R7780MP) | ||
20 | static int mask_pos[] = {12, 11, 9, 14, 15, 8, 13, 6, 5, 4, 3, 2, 0, 0, 1, 0}; | ||
21 | #elif defined(CONFIG_SH_R7785RP) | ||
22 | static int mask_pos[] = {2, 11, 2, 2, 2, 2, 9, 8, 7, 5, 10, 2, 2, 2, 2, 2}; | ||
21 | #endif | 23 | #endif |
22 | 24 | ||
23 | static void enable_r7780rp_irq(unsigned int irq) | 25 | static void enable_r7780rp_irq(unsigned int irq) |
@@ -40,17 +42,10 @@ static struct irq_chip r7780rp_irq_chip __read_mostly = { | |||
40 | .mask_ack = disable_r7780rp_irq, | 42 | .mask_ack = disable_r7780rp_irq, |
41 | }; | 43 | }; |
42 | 44 | ||
43 | /* | 45 | void make_r7780rp_irq(unsigned int irq) |
44 | * Initialize IRQ setting | ||
45 | */ | ||
46 | void __init init_r7780rp_IRQ(void) | ||
47 | { | 46 | { |
48 | int i; | 47 | disable_irq_nosync(irq); |
49 | 48 | set_irq_chip_and_handler_name(irq, &r7780rp_irq_chip, | |
50 | for (i = 0; i < 15; i++) { | 49 | handle_level_irq, "level"); |
51 | disable_irq_nosync(i); | 50 | enable_r7780rp_irq(irq); |
52 | set_irq_chip_and_handler_name(i, &r7780rp_irq_chip, | ||
53 | handle_level_irq, "level"); | ||
54 | enable_r7780rp_irq(i); | ||
55 | } | ||
56 | } | 51 | } |
diff --git a/arch/sh/boards/renesas/r7780rp/setup.c b/arch/sh/boards/renesas/r7780rp/setup.c index 2faba6679e64..0727ef92f2b3 100644 --- a/arch/sh/boards/renesas/r7780rp/setup.c +++ b/arch/sh/boards/renesas/r7780rp/setup.c | |||
@@ -1,10 +1,13 @@ | |||
1 | /* | 1 | /* |
2 | * arch/sh/boards/renesas/r7780rp/setup.c | 2 | * arch/sh/boards/renesas/r7780rp/setup.c |
3 | * | 3 | * |
4 | * Renesas Solutions Highlander Support. | ||
5 | * | ||
4 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. | 6 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. |
5 | * Copyright (C) 2005 - 2007 Paul Mundt | 7 | * Copyright (C) 2005 - 2007 Paul Mundt |
6 | * | 8 | * |
7 | * Renesas Solutions Highlander R7780RP-1 Support. | 9 | * This contains support for the R7780RP-1, R7780MP, and R7785RP |
10 | * Highlander modules. | ||
8 | * | 11 | * |
9 | * This file is subject to the terms and conditions of the GNU General Public | 12 | * This file is subject to the terms and conditions of the GNU General Public |
10 | * License. See the file "COPYING" in the main directory of this archive | 13 | * License. See the file "COPYING" in the main directory of this archive |
@@ -18,32 +21,6 @@ | |||
18 | #include <asm/clock.h> | 21 | #include <asm/clock.h> |
19 | #include <asm/io.h> | 22 | #include <asm/io.h> |
20 | 23 | ||
21 | extern void init_r7780rp_IRQ(void); | ||
22 | |||
23 | static struct resource m66596_usb_host_resources[] = { | ||
24 | [0] = { | ||
25 | .start = 0xa4800000, | ||
26 | .end = 0xa4ffffff, | ||
27 | .flags = IORESOURCE_MEM, | ||
28 | }, | ||
29 | [1] = { | ||
30 | .start = 6, /* irq number */ | ||
31 | .end = 6, | ||
32 | .flags = IORESOURCE_IRQ, | ||
33 | }, | ||
34 | }; | ||
35 | |||
36 | static struct platform_device m66596_usb_host_device = { | ||
37 | .name = "m66596-hcd", | ||
38 | .id = 0, | ||
39 | .dev = { | ||
40 | .dma_mask = NULL, /* don't use dma */ | ||
41 | .coherent_dma_mask = 0xffffffff, | ||
42 | }, | ||
43 | .num_resources = ARRAY_SIZE(m66596_usb_host_resources), | ||
44 | .resource = m66596_usb_host_resources, | ||
45 | }; | ||
46 | |||
47 | static struct resource cf_ide_resources[] = { | 24 | static struct resource cf_ide_resources[] = { |
48 | [0] = { | 25 | [0] = { |
49 | .start = PA_AREA5_IO + 0x1000, | 26 | .start = PA_AREA5_IO + 0x1000, |
@@ -56,10 +33,10 @@ static struct resource cf_ide_resources[] = { | |||
56 | .flags = IORESOURCE_MEM, | 33 | .flags = IORESOURCE_MEM, |
57 | }, | 34 | }, |
58 | [2] = { | 35 | [2] = { |
59 | #ifdef CONFIG_SH_R7780MP | 36 | #ifdef CONFIG_SH_R7780RP |
60 | .start = 1, | ||
61 | #else | ||
62 | .start = 4, | 37 | .start = 4, |
38 | #else | ||
39 | .start = 1, | ||
63 | #endif | 40 | #endif |
64 | .flags = IORESOURCE_IRQ, | 41 | .flags = IORESOURCE_IRQ, |
65 | }, | 42 | }, |
@@ -92,15 +69,18 @@ static struct resource heartbeat_resources[] = { | |||
92 | static struct platform_device heartbeat_device = { | 69 | static struct platform_device heartbeat_device = { |
93 | .name = "heartbeat", | 70 | .name = "heartbeat", |
94 | .id = -1, | 71 | .id = -1, |
72 | |||
73 | /* R7785RP has a slightly more sensible FPGA.. */ | ||
74 | #ifndef CONFIG_SH_R7785RP | ||
95 | .dev = { | 75 | .dev = { |
96 | .platform_data = heartbeat_bit_pos, | 76 | .platform_data = heartbeat_bit_pos, |
97 | }, | 77 | }, |
78 | #endif | ||
98 | .num_resources = ARRAY_SIZE(heartbeat_resources), | 79 | .num_resources = ARRAY_SIZE(heartbeat_resources), |
99 | .resource = heartbeat_resources, | 80 | .resource = heartbeat_resources, |
100 | }; | 81 | }; |
101 | 82 | ||
102 | static struct platform_device *r7780rp_devices[] __initdata = { | 83 | static struct platform_device *r7780rp_devices[] __initdata = { |
103 | &m66596_usb_host_device, | ||
104 | &cf_ide_device, | 84 | &cf_ide_device, |
105 | &heartbeat_device, | 85 | &heartbeat_device, |
106 | }; | 86 | }; |
@@ -110,18 +90,19 @@ static int __init r7780rp_devices_setup(void) | |||
110 | return platform_add_devices(r7780rp_devices, | 90 | return platform_add_devices(r7780rp_devices, |
111 | ARRAY_SIZE(r7780rp_devices)); | 91 | ARRAY_SIZE(r7780rp_devices)); |
112 | } | 92 | } |
93 | device_initcall(r7780rp_devices_setup); | ||
113 | 94 | ||
114 | /* | 95 | /* |
115 | * Platform specific clocks | 96 | * Platform specific clocks |
116 | */ | 97 | */ |
117 | static void ivdr_clk_enable(struct clk *clk) | 98 | static void ivdr_clk_enable(struct clk *clk) |
118 | { | 99 | { |
119 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << 8), PA_IVDRCTL); | 100 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL); |
120 | } | 101 | } |
121 | 102 | ||
122 | static void ivdr_clk_disable(struct clk *clk) | 103 | static void ivdr_clk_disable(struct clk *clk) |
123 | { | 104 | { |
124 | ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << 8), PA_IVDRCTL); | 105 | ctrl_outw(ctrl_inw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL); |
125 | } | 106 | } |
126 | 107 | ||
127 | static struct clk_ops ivdr_clk_ops = { | 108 | static struct clk_ops ivdr_clk_ops = { |
@@ -140,22 +121,22 @@ static struct clk *r7780rp_clocks[] = { | |||
140 | 121 | ||
141 | static void r7780rp_power_off(void) | 122 | static void r7780rp_power_off(void) |
142 | { | 123 | { |
143 | #ifdef CONFIG_SH_R7780MP | 124 | if (mach_is_r7780mp() || mach_is_r7785rp()) |
144 | ctrl_outw(0x0001, PA_POFF); | 125 | ctrl_outw(0x0001, PA_POFF); |
145 | #endif | ||
146 | } | 126 | } |
147 | 127 | ||
148 | /* | 128 | /* |
149 | * Initialize the board | 129 | * Initialize the board |
150 | */ | 130 | */ |
151 | static void __init r7780rp_setup(char **cmdline_p) | 131 | static void __init highlander_setup(char **cmdline_p) |
152 | { | 132 | { |
153 | u16 ver = ctrl_inw(PA_VERREG); | 133 | u16 ver = ctrl_inw(PA_VERREG); |
154 | int i; | 134 | int i; |
155 | 135 | ||
156 | device_initcall(r7780rp_devices_setup); | 136 | printk(KERN_INFO "Renesas Solutions Highlander %s support.\n", |
157 | 137 | mach_is_r7780rp() ? "R7780RP-1" : | |
158 | printk(KERN_INFO "Renesas Solutions Highlander R7780RP-1 support.\n"); | 138 | mach_is_r7780mp() ? "R7780MP" : |
139 | "R7785RP"); | ||
159 | 140 | ||
160 | printk(KERN_INFO "Board version: %d (revision %d), " | 141 | printk(KERN_INFO "Board version: %d (revision %d), " |
161 | "FPGA version: %d (revision %d)\n", | 142 | "FPGA version: %d (revision %d)\n", |
@@ -173,9 +154,10 @@ static void __init r7780rp_setup(char **cmdline_p) | |||
173 | } | 154 | } |
174 | 155 | ||
175 | ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */ | 156 | ctrl_outw(0x0000, PA_OBLED); /* Clear LED. */ |
176 | #ifndef CONFIG_SH_R7780MP | 157 | |
177 | ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */ | 158 | if (mach_is_r7780rp()) |
178 | #endif | 159 | ctrl_outw(0x0001, PA_SDPOW); /* SD Power ON */ |
160 | |||
179 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */ | 161 | ctrl_outw(ctrl_inw(PA_IVDRCTL) | 0x01, PA_IVDRCTL); /* Si13112 */ |
180 | 162 | ||
181 | pm_power_off = r7780rp_power_off; | 163 | pm_power_off = r7780rp_power_off; |
@@ -184,10 +166,10 @@ static void __init r7780rp_setup(char **cmdline_p) | |||
184 | /* | 166 | /* |
185 | * The Machine Vector | 167 | * The Machine Vector |
186 | */ | 168 | */ |
187 | struct sh_machine_vector mv_r7780rp __initmv = { | 169 | struct sh_machine_vector mv_highlander __initmv = { |
188 | .mv_name = "Highlander R7780RP-1", | 170 | .mv_name = "Highlander", |
189 | .mv_setup = r7780rp_setup, | ||
190 | .mv_nr_irqs = 109, | 171 | .mv_nr_irqs = 109, |
191 | .mv_init_irq = init_r7780rp_IRQ, | 172 | .mv_setup = highlander_setup, |
173 | .mv_init_irq = highlander_init_irq, | ||
192 | }; | 174 | }; |
193 | ALIAS_MV(r7780rp) | 175 | ALIAS_MV(highlander) |
diff --git a/arch/sh/boards/se/770x/io.c b/arch/sh/boards/se/770x/io.c index 9941949331ab..c4550473d4c3 100644 --- a/arch/sh/boards/se/770x/io.c +++ b/arch/sh/boards/se/770x/io.c | |||
@@ -27,6 +27,8 @@ int sh_pcic_io_dummy; | |||
27 | static inline volatile __u16 * | 27 | static inline volatile __u16 * |
28 | port2adr(unsigned int port) | 28 | port2adr(unsigned int port) |
29 | { | 29 | { |
30 | if (port & 0xff000000) | ||
31 | return ( volatile __u16 *) port; | ||
30 | if (port >= 0x2000) | 32 | if (port >= 0x2000) |
31 | return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); | 33 | return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); |
32 | else if (port >= 0x1000) | 34 | else if (port >= 0x1000) |
diff --git a/arch/sh/boards/se/770x/irq.c b/arch/sh/boards/se/770x/irq.c index 307ca5da6232..c8eccff77a04 100644 --- a/arch/sh/boards/se/770x/irq.c +++ b/arch/sh/boards/se/770x/irq.c | |||
@@ -55,23 +55,34 @@ void make_se770x_irq(struct ipr_data *table, unsigned int nr_irqs) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | static struct ipr_data se770x_ipr_map[] = { | 57 | static struct ipr_data se770x_ipr_map[] = { |
58 | /* | ||
59 | * Super I/O (Just mimic PC): | ||
60 | * 1: keyboard | ||
61 | * 3: serial 0 | ||
62 | * 4: serial 1 | ||
63 | * 5: printer | ||
64 | * 6: floppy | ||
65 | * 8: rtc | ||
66 | * 12: mouse | ||
67 | * 14: ide0 | ||
68 | */ | ||
58 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) | 69 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) |
59 | /* This is default value */ | 70 | /* This is default value */ |
60 | { 0xf-0x2, 0, 8, 0x2 , BCR_ILCRA}, | 71 | { 13, 0, 8, 0x0f-13 ,BCR_ILCRA}, |
61 | { 0xf-0xa, 0, 4, 0xa , BCR_ILCRA}, | 72 | { 5 , 0, 4, 0x0f- 5 ,BCR_ILCRA}, |
62 | { 0xf-0x5, 0, 0, 0x5 , BCR_ILCRB}, | 73 | { 10, 0, 0, 0x0f-10, BCR_ILCRB}, |
63 | { 0xf-0x8, 0, 4, 0x8 , BCR_ILCRC}, | 74 | { 7 , 0, 4, 0x0f- 7, BCR_ILCRC}, |
64 | { 0xf-0xc, 0, 0, 0xc , BCR_ILCRC}, | 75 | { 3 , 0, 0, 0x0f- 3, BCR_ILCRC}, |
65 | { 0xf-0xe, 0, 12, 0xe , BCR_ILCRD}, | 76 | { 1 , 0, 12, 0x0f- 1, BCR_ILCRD}, |
66 | { 0xf-0x3, 0, 4, 0x3 , BCR_ILCRD}, /* LAN */ | 77 | { 12, 0, 4, 0x0f-12, BCR_ILCRD}, /* LAN */ |
67 | { 0xf-0xd, 0, 8, 0xd , BCR_ILCRE}, | 78 | { 2 , 0, 8, 0x0f- 2, BCR_ILCRE}, /* PCIRQ2 */ |
68 | { 0xf-0x9, 0, 4, 0x9 , BCR_ILCRE}, | 79 | { 6 , 0, 4, 0x0f- 6, BCR_ILCRE}, /* PCIRQ1 */ |
69 | { 0xf-0x1, 0, 0, 0x1 , BCR_ILCRE}, | 80 | { 14, 0, 0, 0x0f-14, BCR_ILCRE}, /* PCIRQ0 */ |
70 | { 0xf-0xf, 0, 12, 0xf , BCR_ILCRF}, | 81 | { 0 , 0, 12, 0x0f , BCR_ILCRF}, |
71 | { 0xf-0xb, 0, 4, 0xb , BCR_ILCRF}, | 82 | { 4 , 0, 4, 0x0f- 4, BCR_ILCRF}, |
72 | { 0xf-0x7, 0, 12, 0x7 , BCR_ILCRG}, | 83 | { 8 , 0, 12, 0x0f- 8, BCR_ILCRG}, |
73 | { 0xf-0x6, 0, 8, 0x6 , BCR_ILCRG}, | 84 | { 9 , 0, 8, 0x0f- 9, BCR_ILCRG}, |
74 | { 0xf-0x4, 0, 4, 0x4 , BCR_ILCRG}, | 85 | { 11, 0, 4, 0x0f-11, BCR_ILCRG}, |
75 | #else | 86 | #else |
76 | { 14, 0, 8, 0x0f-14 ,BCR_ILCRA}, | 87 | { 14, 0, 8, 0x0f-14 ,BCR_ILCRA}, |
77 | { 12, 0, 4, 0x0f-12 ,BCR_ILCRA}, | 88 | { 12, 0, 4, 0x0f-12 ,BCR_ILCRA}, |
@@ -81,8 +92,10 @@ static struct ipr_data se770x_ipr_map[] = { | |||
81 | { 4, 0, 4, 0x0f- 4 ,BCR_ILCRC}, | 92 | { 4, 0, 4, 0x0f- 4 ,BCR_ILCRC}, |
82 | { 3, 0, 0, 0x0f- 3 ,BCR_ILCRC}, | 93 | { 3, 0, 0, 0x0f- 3 ,BCR_ILCRC}, |
83 | { 1, 0, 12, 0x0f- 1 ,BCR_ILCRD}, | 94 | { 1, 0, 12, 0x0f- 1 ,BCR_ILCRD}, |
95 | #if defined(CONFIG_STNIC) | ||
84 | /* ST NIC */ | 96 | /* ST NIC */ |
85 | { 10, 0, 4, 0x0f-10 ,BCR_ILCRD}, /* LAN */ | 97 | { 10, 0, 4, 0x0f-10 ,BCR_ILCRD}, /* LAN */ |
98 | #endif | ||
86 | /* MRSHPC IRQs setting */ | 99 | /* MRSHPC IRQs setting */ |
87 | { 0, 0, 12, 0x0f- 0 ,BCR_ILCRE}, /* PCIRQ3 */ | 100 | { 0, 0, 12, 0x0f- 0 ,BCR_ILCRE}, /* PCIRQ3 */ |
88 | { 11, 0, 8, 0x0f-11 ,BCR_ILCRE}, /* PCIRQ2 */ | 101 | { 11, 0, 8, 0x0f-11 ,BCR_ILCRE}, /* PCIRQ2 */ |
@@ -100,18 +113,6 @@ static struct ipr_data se770x_ipr_map[] = { | |||
100 | */ | 113 | */ |
101 | void __init init_se_IRQ(void) | 114 | void __init init_se_IRQ(void) |
102 | { | 115 | { |
103 | /* | ||
104 | * Super I/O (Just mimic PC): | ||
105 | * 1: keyboard | ||
106 | * 3: serial 0 | ||
107 | * 4: serial 1 | ||
108 | * 5: printer | ||
109 | * 6: floppy | ||
110 | * 8: rtc | ||
111 | * 12: mouse | ||
112 | * 14: ide0 | ||
113 | */ | ||
114 | #if defined(CONFIG_CPU_SUBTYPE_SH7705) | ||
115 | /* Disable all interrupts */ | 116 | /* Disable all interrupts */ |
116 | ctrl_outw(0, BCR_ILCRA); | 117 | ctrl_outw(0, BCR_ILCRA); |
117 | ctrl_outw(0, BCR_ILCRB); | 118 | ctrl_outw(0, BCR_ILCRB); |
@@ -120,6 +121,6 @@ void __init init_se_IRQ(void) | |||
120 | ctrl_outw(0, BCR_ILCRE); | 121 | ctrl_outw(0, BCR_ILCRE); |
121 | ctrl_outw(0, BCR_ILCRF); | 122 | ctrl_outw(0, BCR_ILCRF); |
122 | ctrl_outw(0, BCR_ILCRG); | 123 | ctrl_outw(0, BCR_ILCRG); |
123 | #endif | 124 | |
124 | make_se770x_irq(se770x_ipr_map, ARRAY_SIZE(se770x_ipr_map)); | 125 | make_se770x_irq(se770x_ipr_map, ARRAY_SIZE(se770x_ipr_map)); |
125 | } | 126 | } |
diff --git a/arch/sh/boards/se/770x/setup.c b/arch/sh/boards/se/770x/setup.c index 45cbc36b9fb7..17a2631de3ba 100644 --- a/arch/sh/boards/se/770x/setup.c +++ b/arch/sh/boards/se/770x/setup.c | |||
@@ -63,6 +63,31 @@ static void __init smsc_setup(char **cmdline_p) | |||
63 | outb_p(CONFIG_EXIT, CONFIG_PORT); | 63 | outb_p(CONFIG_EXIT, CONFIG_PORT); |
64 | } | 64 | } |
65 | 65 | ||
66 | |||
67 | static struct resource cf_ide_resources[] = { | ||
68 | [0] = { | ||
69 | .start = PA_MRSHPC_IO + 0x1f0, | ||
70 | .end = PA_MRSHPC_IO + 0x1f0 + 8, | ||
71 | .flags = IORESOURCE_MEM, | ||
72 | }, | ||
73 | [1] = { | ||
74 | .start = PA_MRSHPC_IO + 0x1f0 + 0x206, | ||
75 | .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8, | ||
76 | .flags = IORESOURCE_MEM, | ||
77 | }, | ||
78 | [2] = { | ||
79 | .start = IRQ_CFCARD, | ||
80 | .flags = IORESOURCE_IRQ, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static struct platform_device cf_ide_device = { | ||
85 | .name = "pata_platform", | ||
86 | .id = -1, | ||
87 | .num_resources = ARRAY_SIZE(cf_ide_resources), | ||
88 | .resource = cf_ide_resources, | ||
89 | }; | ||
90 | |||
66 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; | 91 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; |
67 | 92 | ||
68 | static struct resource heartbeat_resources[] = { | 93 | static struct resource heartbeat_resources[] = { |
@@ -85,13 +110,14 @@ static struct platform_device heartbeat_device = { | |||
85 | 110 | ||
86 | static struct platform_device *se_devices[] __initdata = { | 111 | static struct platform_device *se_devices[] __initdata = { |
87 | &heartbeat_device, | 112 | &heartbeat_device, |
113 | &cf_ide_device, | ||
88 | }; | 114 | }; |
89 | 115 | ||
90 | static int __init se_devices_setup(void) | 116 | static int __init se_devices_setup(void) |
91 | { | 117 | { |
92 | return platform_add_devices(se_devices, ARRAY_SIZE(se_devices)); | 118 | return platform_add_devices(se_devices, ARRAY_SIZE(se_devices)); |
93 | } | 119 | } |
94 | __initcall(se_devices_setup); | 120 | device_initcall(se_devices_setup); |
95 | 121 | ||
96 | /* | 122 | /* |
97 | * The Machine Vector | 123 | * The Machine Vector |
@@ -107,6 +133,8 @@ struct sh_machine_vector mv_se __initmv = { | |||
107 | .mv_nr_irqs = 61, | 133 | .mv_nr_irqs = 61, |
108 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) | 134 | #elif defined(CONFIG_CPU_SUBTYPE_SH7705) |
109 | .mv_nr_irqs = 86, | 135 | .mv_nr_irqs = 86, |
136 | #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) | ||
137 | .mv_nr_irqs = 104, | ||
110 | #endif | 138 | #endif |
111 | 139 | ||
112 | .mv_inb = se_inb, | 140 | .mv_inb = se_inb, |
diff --git a/arch/sh/boards/se/7722/Makefile b/arch/sh/boards/se/7722/Makefile new file mode 100644 index 000000000000..8694373389e5 --- /dev/null +++ b/arch/sh/boards/se/7722/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # | ||
2 | # Makefile for the HITACHI UL SolutionEngine 7722 specific parts of the kernel | ||
3 | # | ||
4 | # This file is subject to the terms and conditions of the GNU General Public | ||
5 | # License. See the file "COPYING" in the main directory of this archive | ||
6 | # for more details. | ||
7 | # | ||
8 | # | ||
9 | |||
10 | obj-y := setup.o irq.o | ||
diff --git a/arch/sh/boards/se/7722/irq.c b/arch/sh/boards/se/7722/irq.c new file mode 100644 index 000000000000..099e5deb77f8 --- /dev/null +++ b/arch/sh/boards/se/7722/irq.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/se/7722/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Nobuhiro Iwamatsu | ||
5 | * | ||
6 | * Hitachi UL SolutionEngine 7722 Support. | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/irq.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <asm/irq.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <asm/se7722.h> | ||
18 | |||
19 | #define INTC_INTMSK0 0xFFD00044 | ||
20 | #define INTC_INTMSKCLR0 0xFFD00064 | ||
21 | |||
22 | static void disable_se7722_irq(unsigned int irq) | ||
23 | { | ||
24 | struct ipr_data *p = get_irq_chip_data(irq); | ||
25 | ctrl_outw( ctrl_inw( p->addr ) | p->priority , p->addr ); | ||
26 | } | ||
27 | |||
28 | static void enable_se7722_irq(unsigned int irq) | ||
29 | { | ||
30 | struct ipr_data *p = get_irq_chip_data(irq); | ||
31 | ctrl_outw( ctrl_inw( p->addr ) & ~p->priority , p->addr ); | ||
32 | } | ||
33 | |||
34 | static struct irq_chip se7722_irq_chip __read_mostly = { | ||
35 | .name = "SE7722", | ||
36 | .mask = disable_se7722_irq, | ||
37 | .unmask = enable_se7722_irq, | ||
38 | .mask_ack = disable_se7722_irq, | ||
39 | }; | ||
40 | |||
41 | static struct ipr_data ipr_irq_table[] = { | ||
42 | /* irq ,idx,sft, priority , addr */ | ||
43 | { MRSHPC_IRQ0 , 0 , 0 , MRSHPC_BIT0 , IRQ01_MASK } , | ||
44 | { MRSHPC_IRQ1 , 0 , 0 , MRSHPC_BIT1 , IRQ01_MASK } , | ||
45 | { MRSHPC_IRQ2 , 0 , 0 , MRSHPC_BIT2 , IRQ01_MASK } , | ||
46 | { MRSHPC_IRQ3 , 0 , 0 , MRSHPC_BIT3 , IRQ01_MASK } , | ||
47 | { SMC_IRQ , 0 , 0 , SMC_BIT , IRQ01_MASK } , | ||
48 | { EXT_IRQ , 0 , 0 , EXT_BIT , IRQ01_MASK } , | ||
49 | }; | ||
50 | |||
51 | int se7722_irq_demux(int irq) | ||
52 | { | ||
53 | |||
54 | if ((irq == IRQ0_IRQ)||(irq == IRQ1_IRQ)) { | ||
55 | volatile unsigned short intv = | ||
56 | *(volatile unsigned short *)IRQ01_STS; | ||
57 | if (irq == IRQ0_IRQ){ | ||
58 | if(intv & SMC_BIT ) { | ||
59 | return SMC_IRQ; | ||
60 | } else if(intv & USB_BIT) { | ||
61 | return USB_IRQ; | ||
62 | } else { | ||
63 | printk("intv =%04x\n", intv); | ||
64 | return SMC_IRQ; | ||
65 | } | ||
66 | } else if(irq == IRQ1_IRQ){ | ||
67 | if(intv & MRSHPC_BIT0) { | ||
68 | return MRSHPC_IRQ0; | ||
69 | } else if(intv & MRSHPC_BIT1) { | ||
70 | return MRSHPC_IRQ1; | ||
71 | } else if(intv & MRSHPC_BIT2) { | ||
72 | return MRSHPC_IRQ2; | ||
73 | } else if(intv & MRSHPC_BIT3) { | ||
74 | return MRSHPC_IRQ3; | ||
75 | } else { | ||
76 | printk("BIT_EXTENTION =%04x\n", intv); | ||
77 | return EXT_IRQ; | ||
78 | } | ||
79 | } | ||
80 | } | ||
81 | return irq; | ||
82 | |||
83 | } | ||
84 | /* | ||
85 | * Initialize IRQ setting | ||
86 | */ | ||
87 | void __init init_se7722_IRQ(void) | ||
88 | { | ||
89 | int i = 0; | ||
90 | ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */ | ||
91 | ctrl_outl((3 << ((7 - 0) * 4))|(3 << ((7 - 1) * 4)), INTC_INTPRI0); /* irq0 pri=3,irq1,pri=3 */ | ||
92 | ctrl_outw((2 << ((7 - 0) * 2))|(2 << ((7 - 1) * 2)), INTC_ICR1); /* irq0,1 low-level irq */ | ||
93 | |||
94 | for (i = 0; i < ARRAY_SIZE(ipr_irq_table); i++) { | ||
95 | disable_irq_nosync(ipr_irq_table[i].irq); | ||
96 | set_irq_chip_and_handler_name( ipr_irq_table[i].irq, &se7722_irq_chip, | ||
97 | handle_level_irq, "level"); | ||
98 | set_irq_chip_data( ipr_irq_table[i].irq, &ipr_irq_table[i] ); | ||
99 | disable_se7722_irq(ipr_irq_table[i].irq); | ||
100 | } | ||
101 | } | ||
diff --git a/arch/sh/boards/se/7722/setup.c b/arch/sh/boards/se/7722/setup.c new file mode 100644 index 000000000000..636ca6c987e0 --- /dev/null +++ b/arch/sh/boards/se/7722/setup.c | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/se/7722/setup.c | ||
3 | * | ||
4 | * Copyright (C) 2007 Nobuhiro Iwamatsu | ||
5 | * | ||
6 | * Hitachi UL SolutionEngine 7722 Support. | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | * | ||
12 | */ | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/pata_platform.h> | ||
16 | #include <asm/machvec.h> | ||
17 | #include <asm/se7722.h> | ||
18 | #include <asm/io.h> | ||
19 | |||
20 | /* Heartbeat */ | ||
21 | static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; | ||
22 | |||
23 | static struct resource heartbeat_resources[] = { | ||
24 | [0] = { | ||
25 | .start = PA_LED, | ||
26 | .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, | ||
27 | .flags = IORESOURCE_MEM, | ||
28 | }, | ||
29 | }; | ||
30 | |||
31 | static struct platform_device heartbeat_device = { | ||
32 | .name = "heartbeat", | ||
33 | .id = -1, | ||
34 | .dev = { | ||
35 | .platform_data = heartbeat_bit_pos, | ||
36 | }, | ||
37 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
38 | .resource = heartbeat_resources, | ||
39 | }; | ||
40 | |||
41 | /* SMC91x */ | ||
42 | static struct resource smc91x_eth_resources[] = { | ||
43 | [0] = { | ||
44 | .name = "smc91x-regs" , | ||
45 | .start = PA_LAN + 0x300, | ||
46 | .end = PA_LAN + 0x300 + 0x10 , | ||
47 | .flags = IORESOURCE_MEM, | ||
48 | }, | ||
49 | [1] = { | ||
50 | .start = SMC_IRQ, | ||
51 | .end = SMC_IRQ, | ||
52 | .flags = IORESOURCE_IRQ, | ||
53 | }, | ||
54 | }; | ||
55 | |||
56 | static struct platform_device smc91x_eth_device = { | ||
57 | .name = "smc91x", | ||
58 | .id = 0, | ||
59 | .dev = { | ||
60 | .dma_mask = NULL, /* don't use dma */ | ||
61 | .coherent_dma_mask = 0xffffffff, | ||
62 | }, | ||
63 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), | ||
64 | .resource = smc91x_eth_resources, | ||
65 | }; | ||
66 | |||
67 | static struct resource cf_ide_resources[] = { | ||
68 | [0] = { | ||
69 | .start = PA_MRSHPC_IO + 0x1f0, | ||
70 | .end = PA_MRSHPC_IO + 0x1f0 + 8 , | ||
71 | .flags = IORESOURCE_IO, | ||
72 | }, | ||
73 | [1] = { | ||
74 | .start = PA_MRSHPC_IO + 0x1f0 + 0x206, | ||
75 | .end = PA_MRSHPC_IO + 0x1f0 +8 + 0x206 + 8, | ||
76 | .flags = IORESOURCE_IO, | ||
77 | }, | ||
78 | [2] = { | ||
79 | .start = MRSHPC_IRQ0, | ||
80 | .flags = IORESOURCE_IRQ, | ||
81 | }, | ||
82 | }; | ||
83 | |||
84 | static struct platform_device cf_ide_device = { | ||
85 | .name = "pata_platform", | ||
86 | .id = -1, | ||
87 | .num_resources = ARRAY_SIZE(cf_ide_resources), | ||
88 | .resource = cf_ide_resources, | ||
89 | }; | ||
90 | |||
91 | static struct platform_device *se7722_devices[] __initdata = { | ||
92 | &heartbeat_device, | ||
93 | &smc91x_eth_device, | ||
94 | &cf_ide_device, | ||
95 | }; | ||
96 | |||
97 | static int __init se7722_devices_setup(void) | ||
98 | { | ||
99 | return platform_add_devices(se7722_devices, | ||
100 | ARRAY_SIZE(se7722_devices)); | ||
101 | } | ||
102 | device_initcall(se7722_devices_setup); | ||
103 | |||
104 | static void __init se7722_setup(char **cmdline_p) | ||
105 | { | ||
106 | ctrl_outw(0x010D, FPGA_OUT); /* FPGA */ | ||
107 | |||
108 | ctrl_outl(0x00051001, MSTPCR0); | ||
109 | ctrl_outl(0x00000000, MSTPCR1); | ||
110 | /* KEYSC, VOU, BEU, CEU, VEU, VPU, LCDC */ | ||
111 | ctrl_outl(0xffffbfC0, MSTPCR2); | ||
112 | |||
113 | ctrl_outw(0x0000, PORT_PECR); /* PORT E 1 = IRQ5 ,E 0 = BS */ | ||
114 | ctrl_outw(0x1000, PORT_PJCR); /* PORT J 1 = IRQ1,J 0 =IRQ0 */ | ||
115 | |||
116 | /* LCDC I/O */ | ||
117 | ctrl_outw(0x0020, PORT_PSELD); | ||
118 | |||
119 | /* SIOF1*/ | ||
120 | ctrl_outw(0x0003, PORT_PSELB); | ||
121 | ctrl_outw(0xe000, PORT_PSELC); | ||
122 | ctrl_outw(0x0000, PORT_PKCR); | ||
123 | |||
124 | /* LCDC */ | ||
125 | ctrl_outw(0x4020, PORT_PHCR); | ||
126 | ctrl_outw(0x0000, PORT_PLCR); | ||
127 | ctrl_outw(0x0000, PORT_PMCR); | ||
128 | ctrl_outw(0x0002, PORT_PRCR); | ||
129 | ctrl_outw(0x0000, PORT_PXCR); /* LCDC,CS6A */ | ||
130 | |||
131 | /* KEYSC */ | ||
132 | ctrl_outw(0x0A10, PORT_PSELA); /* BS,SHHID2 */ | ||
133 | ctrl_outw(0x0000, PORT_PYCR); | ||
134 | ctrl_outw(0x0000, PORT_PZCR); | ||
135 | } | ||
136 | |||
137 | /* | ||
138 | * The Machine Vector | ||
139 | */ | ||
140 | struct sh_machine_vector mv_se7722 __initmv = { | ||
141 | .mv_name = "Solution Engine 7722" , | ||
142 | .mv_setup = se7722_setup , | ||
143 | .mv_nr_irqs = 109 , | ||
144 | .mv_init_irq = init_se7722_IRQ, | ||
145 | .mv_irq_demux = se7722_irq_demux, | ||
146 | |||
147 | }; | ||
148 | ALIAS_MV(se7722) | ||
diff --git a/arch/sh/boards/se/7751/setup.c b/arch/sh/boards/se/7751/setup.c index e3feae6ec0bf..770defed9c4a 100644 --- a/arch/sh/boards/se/7751/setup.c +++ b/arch/sh/boards/se/7751/setup.c | |||
@@ -14,153 +14,6 @@ | |||
14 | #include <asm/se7751.h> | 14 | #include <asm/se7751.h> |
15 | #include <asm/io.h> | 15 | #include <asm/io.h> |
16 | 16 | ||
17 | void init_7751se_IRQ(void); | ||
18 | |||
19 | #ifdef CONFIG_SH_KGDB | ||
20 | #include <asm/kgdb.h> | ||
21 | static int kgdb_uart_setup(void); | ||
22 | static struct kgdb_sermap kgdb_uart_sermap = | ||
23 | { "ttyS", 0, kgdb_uart_setup, NULL }; | ||
24 | #endif | ||
25 | |||
26 | /* | ||
27 | * Initialize the board | ||
28 | */ | ||
29 | static void __init sh7751se_setup(char **cmdline_p) | ||
30 | { | ||
31 | /* Call init_smsc() replacement to set up SuperIO. */ | ||
32 | /* XXX: RTC setting comes here */ | ||
33 | #ifdef CONFIG_SH_KGDB | ||
34 | kgdb_register_sermap(&kgdb_uart_sermap); | ||
35 | #endif | ||
36 | } | ||
37 | |||
38 | /********************************************************************* | ||
39 | * Currently a hack (e.g. does not interact well w/serial.c, lots of * | ||
40 | * hardcoded stuff) but may be useful if SCI/F needs debugging. * | ||
41 | * Mostly copied from x86 code (see files asm-i386/kgdb_local.h and * | ||
42 | * arch/i386/lib/kgdb_serial.c). * | ||
43 | *********************************************************************/ | ||
44 | |||
45 | #ifdef CONFIG_SH_KGDB | ||
46 | #include <linux/types.h> | ||
47 | #include <linux/serial.h> | ||
48 | #include <linux/serialP.h> | ||
49 | #include <linux/serial_reg.h> | ||
50 | |||
51 | #define COM1_PORT 0x3f8 /* Base I/O address */ | ||
52 | #define COM1_IRQ 4 /* IRQ not used yet */ | ||
53 | #define COM2_PORT 0x2f8 /* Base I/O address */ | ||
54 | #define COM2_IRQ 3 /* IRQ not used yet */ | ||
55 | |||
56 | #define SB_CLOCK 1843200 /* Serial baud clock */ | ||
57 | #define SB_BASE (SB_CLOCK/16) | ||
58 | #define SB_MCR UART_MCR_OUT2 | UART_MCR_DTR | UART_MCR_RTS | ||
59 | |||
60 | struct uart_port { | ||
61 | int base; | ||
62 | }; | ||
63 | #define UART_NPORTS 2 | ||
64 | struct uart_port uart_ports[] = { | ||
65 | { COM1_PORT }, | ||
66 | { COM2_PORT }, | ||
67 | }; | ||
68 | struct uart_port *kgdb_uart_port; | ||
69 | |||
70 | #define UART_IN(reg) inb_p(kgdb_uart_port->base + reg) | ||
71 | #define UART_OUT(reg,v) outb_p((v), kgdb_uart_port->base + reg) | ||
72 | |||
73 | /* Basic read/write functions for the UART */ | ||
74 | #define UART_LSR_RXCERR (UART_LSR_BI | UART_LSR_FE | UART_LSR_PE) | ||
75 | static int kgdb_uart_getchar(void) | ||
76 | { | ||
77 | int lsr; | ||
78 | int c = -1; | ||
79 | |||
80 | while (c == -1) { | ||
81 | lsr = UART_IN(UART_LSR); | ||
82 | if (lsr & UART_LSR_DR) | ||
83 | c = UART_IN(UART_RX); | ||
84 | if ((lsr & UART_LSR_RXCERR)) | ||
85 | c = -1; | ||
86 | } | ||
87 | return c; | ||
88 | } | ||
89 | |||
90 | static void kgdb_uart_putchar(int c) | ||
91 | { | ||
92 | while ((UART_IN(UART_LSR) & UART_LSR_THRE) == 0) | ||
93 | ; | ||
94 | UART_OUT(UART_TX, c); | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Initialize UART to configured/requested values. | ||
99 | * (But we don't interrupts yet, or interact w/serial.c) | ||
100 | */ | ||
101 | static int kgdb_uart_setup(void) | ||
102 | { | ||
103 | int port; | ||
104 | int lcr = 0; | ||
105 | int bdiv = 0; | ||
106 | |||
107 | if (kgdb_portnum >= UART_NPORTS) { | ||
108 | KGDB_PRINTK("uart port %d invalid.\n", kgdb_portnum); | ||
109 | return -1; | ||
110 | } | ||
111 | |||
112 | kgdb_uart_port = &uart_ports[kgdb_portnum]; | ||
113 | |||
114 | /* Init sequence from gdb_hook_interrupt */ | ||
115 | UART_IN(UART_RX); | ||
116 | UART_OUT(UART_IER, 0); | ||
117 | |||
118 | UART_IN(UART_RX); /* Serial driver comments say */ | ||
119 | UART_IN(UART_IIR); /* this clears interrupt regs */ | ||
120 | UART_IN(UART_MSR); | ||
121 | |||
122 | /* Figure basic LCR values */ | ||
123 | switch (kgdb_bits) { | ||
124 | case '7': | ||
125 | lcr |= UART_LCR_WLEN7; | ||
126 | break; | ||
127 | default: case '8': | ||
128 | lcr |= UART_LCR_WLEN8; | ||
129 | break; | ||
130 | } | ||
131 | switch (kgdb_parity) { | ||
132 | case 'O': | ||
133 | lcr |= UART_LCR_PARITY; | ||
134 | break; | ||
135 | case 'E': | ||
136 | lcr |= (UART_LCR_PARITY | UART_LCR_EPAR); | ||
137 | break; | ||
138 | default: break; | ||
139 | } | ||
140 | |||
141 | /* Figure the baud rate divisor */ | ||
142 | bdiv = (SB_BASE/kgdb_baud); | ||
143 | |||
144 | /* Set the baud rate and LCR values */ | ||
145 | UART_OUT(UART_LCR, (lcr | UART_LCR_DLAB)); | ||
146 | UART_OUT(UART_DLL, (bdiv & 0xff)); | ||
147 | UART_OUT(UART_DLM, ((bdiv >> 8) & 0xff)); | ||
148 | UART_OUT(UART_LCR, lcr); | ||
149 | |||
150 | /* Set the MCR */ | ||
151 | UART_OUT(UART_MCR, SB_MCR); | ||
152 | |||
153 | /* Turn off FIFOs for now */ | ||
154 | UART_OUT(UART_FCR, 0); | ||
155 | |||
156 | /* Setup complete: initialize function pointers */ | ||
157 | kgdb_getchar = kgdb_uart_getchar; | ||
158 | kgdb_putchar = kgdb_uart_putchar; | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | #endif /* CONFIG_SH_KGDB */ | ||
163 | |||
164 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; | 17 | static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; |
165 | 18 | ||
166 | static struct resource heartbeat_resources[] = { | 19 | static struct resource heartbeat_resources[] = { |
@@ -197,7 +50,6 @@ __initcall(se7751_devices_setup); | |||
197 | */ | 50 | */ |
198 | struct sh_machine_vector mv_7751se __initmv = { | 51 | struct sh_machine_vector mv_7751se __initmv = { |
199 | .mv_name = "7751 SolutionEngine", | 52 | .mv_name = "7751 SolutionEngine", |
200 | .mv_setup = sh7751se_setup, | ||
201 | .mv_nr_irqs = 72, | 53 | .mv_nr_irqs = 72, |
202 | 54 | ||
203 | .mv_inb = sh7751se_inb, | 55 | .mv_inb = sh7751se_inb, |
diff --git a/arch/sh/boards/se/7780/Makefile b/arch/sh/boards/se/7780/Makefile new file mode 100644 index 000000000000..6b88adae3ecc --- /dev/null +++ b/arch/sh/boards/se/7780/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # | ||
2 | # Makefile for the HITACHI UL SolutionEngine 7780 specific parts of the kernel | ||
3 | # | ||
4 | # This file is subject to the terms and conditions of the GNU General Public | ||
5 | # License. See the file "COPYING" in the main directory of this archive | ||
6 | # for more details. | ||
7 | # | ||
8 | # | ||
9 | |||
10 | obj-y := setup.o irq.o | ||
diff --git a/arch/sh/boards/se/7780/irq.c b/arch/sh/boards/se/7780/irq.c new file mode 100644 index 000000000000..3d0625c2d07b --- /dev/null +++ b/arch/sh/boards/se/7780/irq.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/se/7780/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2006,2007 Nobuhiro Iwamatsu | ||
5 | * | ||
6 | * Hitachi UL SolutionEngine 7780 Support. | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/irq.h> | ||
14 | #include <linux/interrupt.h> | ||
15 | #include <asm/irq.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <asm/se7780.h> | ||
18 | |||
19 | #define INTC_INTMSK0 0xFFD00044 | ||
20 | #define INTC_INTMSKCLR0 0xFFD00064 | ||
21 | |||
22 | static void disable_se7780_irq(unsigned int irq) | ||
23 | { | ||
24 | struct intc2_data *p = get_irq_chip_data(irq); | ||
25 | ctrl_outl(1 << p->msk_shift, INTC_INTMSK0 + p->msk_offset); | ||
26 | } | ||
27 | |||
28 | static void enable_se7780_irq(unsigned int irq) | ||
29 | { | ||
30 | struct intc2_data *p = get_irq_chip_data(irq); | ||
31 | ctrl_outl(1 << p->msk_shift, INTC_INTMSKCLR0 + p->msk_offset); | ||
32 | } | ||
33 | |||
34 | static struct irq_chip se7780_irq_chip __read_mostly = { | ||
35 | .name = "SE7780", | ||
36 | .mask = disable_se7780_irq, | ||
37 | .unmask = enable_se7780_irq, | ||
38 | .mask_ack = disable_se7780_irq, | ||
39 | }; | ||
40 | |||
41 | static struct intc2_data intc2_irq_table[] = { | ||
42 | { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT1 */ | ||
43 | { 4, 0, 30, 0, 30, 3 }, /* daughter board EXTINT2 */ | ||
44 | { 6, 0, 29, 0, 29, 3 }, /* daughter board EXTINT3 */ | ||
45 | { 8, 0, 28, 0, 28, 3 }, /* SMC 91C111 (LAN) */ | ||
46 | { 10, 0, 27, 0, 27, 3 }, /* daughter board EXTINT4 */ | ||
47 | { 4, 0, 30, 0, 30, 3 }, /* daughter board EXTINT5 */ | ||
48 | { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT6 */ | ||
49 | { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT7 */ | ||
50 | { 2, 0, 31, 0, 31, 3 }, /* daughter board EXTINT8 */ | ||
51 | { 0 , 0, 24, 0, 24, 3 }, /* SM501 */ | ||
52 | }; | ||
53 | |||
54 | /* | ||
55 | * Initialize IRQ setting | ||
56 | */ | ||
57 | void __init init_se7780_IRQ(void) | ||
58 | { | ||
59 | int i ; | ||
60 | |||
61 | /* enable all interrupt at FPGA */ | ||
62 | ctrl_outw(0, FPGA_INTMSK1); | ||
63 | /* mask SM501 interrupt */ | ||
64 | ctrl_outw((ctrl_inw(FPGA_INTMSK1) | 0x0002), FPGA_INTMSK1); | ||
65 | /* enable all interrupt at FPGA */ | ||
66 | ctrl_outw(0, FPGA_INTMSK2); | ||
67 | |||
68 | /* set FPGA INTSEL register */ | ||
69 | /* FPGA + 0x06 */ | ||
70 | ctrl_outw( ((IRQPIN_SM501 << IRQPOS_SM501) | | ||
71 | (IRQPIN_SMC91CX << IRQPOS_SMC91CX)), FPGA_INTSEL1); | ||
72 | |||
73 | /* FPGA + 0x08 */ | ||
74 | ctrl_outw(((IRQPIN_EXTINT4 << IRQPOS_EXTINT4) | | ||
75 | (IRQPIN_EXTINT3 << IRQPOS_EXTINT3) | | ||
76 | (IRQPIN_EXTINT2 << IRQPOS_EXTINT2) | | ||
77 | (IRQPIN_EXTINT1 << IRQPOS_EXTINT1)), FPGA_INTSEL2); | ||
78 | |||
79 | /* FPGA + 0x0A */ | ||
80 | ctrl_outw((IRQPIN_PCCPW << IRQPOS_PCCPW), FPGA_INTSEL3); | ||
81 | |||
82 | for (i = 0; i < ARRAY_SIZE(intc2_irq_table); i++) { | ||
83 | disable_irq_nosync(intc2_irq_table[i].irq); | ||
84 | set_irq_chip_and_handler_name( intc2_irq_table[i].irq, &se7780_irq_chip, | ||
85 | handle_level_irq, "level"); | ||
86 | set_irq_chip_data( intc2_irq_table[i].irq, &intc2_irq_table[i] ); | ||
87 | disable_se7780_irq(intc2_irq_table[i].irq); | ||
88 | } | ||
89 | } | ||
diff --git a/arch/sh/boards/se/7780/setup.c b/arch/sh/boards/se/7780/setup.c new file mode 100644 index 000000000000..df7d08a24c9f --- /dev/null +++ b/arch/sh/boards/se/7780/setup.c | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/se/7780/setup.c | ||
3 | * | ||
4 | * Copyright (C) 2006,2007 Nobuhiro Iwamatsu | ||
5 | * | ||
6 | * Hitachi UL SolutionEngine 7780 Support. | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file "COPYING" in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <asm/machvec.h> | ||
15 | #include <asm/se7780.h> | ||
16 | #include <asm/io.h> | ||
17 | |||
18 | /* Heartbeat */ | ||
19 | static unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 }; | ||
20 | |||
21 | static struct resource heartbeat_resources[] = { | ||
22 | [0] = { | ||
23 | .start = PA_LED, | ||
24 | .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1, | ||
25 | .flags = IORESOURCE_MEM, | ||
26 | }, | ||
27 | }; | ||
28 | |||
29 | static struct platform_device heartbeat_device = { | ||
30 | .name = "heartbeat", | ||
31 | .id = -1, | ||
32 | .dev = { | ||
33 | .platform_data = heartbeat_bit_pos, | ||
34 | }, | ||
35 | .num_resources = ARRAY_SIZE(heartbeat_resources), | ||
36 | .resource = heartbeat_resources, | ||
37 | }; | ||
38 | |||
39 | /* SMC91x */ | ||
40 | static struct resource smc91x_eth_resources[] = { | ||
41 | [0] = { | ||
42 | .name = "smc91x-regs" , | ||
43 | .start = PA_LAN + 0x300, | ||
44 | .end = PA_LAN + 0x300 + 0x10 , | ||
45 | .flags = IORESOURCE_MEM, | ||
46 | }, | ||
47 | [1] = { | ||
48 | .start = SMC_IRQ, | ||
49 | .end = SMC_IRQ, | ||
50 | .flags = IORESOURCE_IRQ, | ||
51 | }, | ||
52 | }; | ||
53 | |||
54 | static struct platform_device smc91x_eth_device = { | ||
55 | .name = "smc91x", | ||
56 | .id = 0, | ||
57 | .dev = { | ||
58 | .dma_mask = NULL, /* don't use dma */ | ||
59 | .coherent_dma_mask = 0xffffffff, | ||
60 | }, | ||
61 | .num_resources = ARRAY_SIZE(smc91x_eth_resources), | ||
62 | .resource = smc91x_eth_resources, | ||
63 | }; | ||
64 | |||
65 | static struct platform_device *se7780_devices[] __initdata = { | ||
66 | &heartbeat_device, | ||
67 | &smc91x_eth_device, | ||
68 | }; | ||
69 | |||
70 | static int __init se7780_devices_setup(void) | ||
71 | { | ||
72 | return platform_add_devices(se7780_devices, | ||
73 | ARRAY_SIZE(se7780_devices)); | ||
74 | } | ||
75 | device_initcall(se7780_devices_setup); | ||
76 | |||
77 | #define GPIO_PHCR 0xFFEA000E | ||
78 | #define GPIO_PMSELR 0xFFEA0080 | ||
79 | #define GPIO_PECR 0xFFEA0008 | ||
80 | |||
81 | static void __init se7780_setup(char **cmdline_p) | ||
82 | { | ||
83 | /* "SH-Linux" on LED Display */ | ||
84 | ctrl_outw( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) ); | ||
85 | ctrl_outw( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) ); | ||
86 | ctrl_outw( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) ); | ||
87 | ctrl_outw( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) ); | ||
88 | ctrl_outw( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) ); | ||
89 | ctrl_outw( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) ); | ||
90 | ctrl_outw( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) ); | ||
91 | ctrl_outw( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) ); | ||
92 | |||
93 | printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n"); | ||
94 | |||
95 | /* | ||
96 | * PCI REQ/GNT setting | ||
97 | * REQ0/GNT0 -> USB | ||
98 | * REQ1/GNT1 -> PC Card | ||
99 | * REQ2/GNT2 -> Serial ATA | ||
100 | * REQ3/GNT3 -> PCI slot | ||
101 | */ | ||
102 | ctrl_outw(0x0213, FPGA_REQSEL); | ||
103 | |||
104 | /* GPIO setting */ | ||
105 | ctrl_outw(0x0000, GPIO_PECR); | ||
106 | ctrl_outw(ctrl_inw(GPIO_PHCR)&0xfff3, GPIO_PHCR); | ||
107 | ctrl_outw(0x0c00, GPIO_PMSELR); | ||
108 | |||
109 | /* iVDR Power ON */ | ||
110 | ctrl_outw(0x0001, FPGA_IVDRPW); | ||
111 | } | ||
112 | |||
113 | /* | ||
114 | * The Machine Vector | ||
115 | */ | ||
116 | struct sh_machine_vector mv_se7780 __initmv = { | ||
117 | .mv_name = "Solution Engine 7780" , | ||
118 | .mv_setup = se7780_setup , | ||
119 | .mv_nr_irqs = 111 , | ||
120 | .mv_init_irq = init_se7780_IRQ, | ||
121 | }; | ||
122 | ALIAS_MV(se7780) | ||