aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-20 20:35:25 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-20 20:35:25 -0400
commitc2e68052429fdf87702fccd272951282bef1c60a (patch)
treeb9f3bf3918526af068ed264190a85fb18dd3d8b0 /include
parentd6f410bdbcb435c744c4f8259d6659ae2c6e447a (diff)
parent1256efd5519a8eca2dfa6039ce5cf58f44d1626d (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6: [SPARC64]: fix section mismatch warning in mdesc.c [SPARC64]: fix section mismatch warning in pci_sunv4 [SPARC64]: Stop using drivers/char/rtc.c [SPARC64]: Convert parport to of_platform_driver. [SPARC]: Implement fb_is_primary_device(). [SPARC64]: Fix virq decomposition. [SPARC64]: Use KERN_ERR in IRQ manipulation error printks. [SPARC64]: Do not flood log with failed DS messages. [SPARC64]: Add proper multicast support to VNET driver. [SPARC64]: Handle multiple domain-services-port nodes properly. [SPARC64]: Improve VIO device naming further. [SPARC]: Make sure dev_archdata is filled in for all devices. [SPARC]: Define minimal struct dev_archdata, similarly to sparc64. [SPARC]: Fix serial console device detection.
Diffstat (limited to 'include')
-rw-r--r--include/asm-sparc/device.h14
-rw-r--r--include/asm-sparc/fb.h9
-rw-r--r--include/asm-sparc/oplib.h26
-rw-r--r--include/asm-sparc/prom.h4
-rw-r--r--include/asm-sparc64/fb.h9
-rw-r--r--include/asm-sparc64/oplib.h28
-rw-r--r--include/asm-sparc64/parport.h233
-rw-r--r--include/asm-sparc64/prom.h4
-rw-r--r--include/asm-sparc64/system.h6
9 files changed, 174 insertions, 159 deletions
diff --git a/include/asm-sparc/device.h b/include/asm-sparc/device.h
index d8f9872b0e2d..4a56d84d69c4 100644
--- a/include/asm-sparc/device.h
+++ b/include/asm-sparc/device.h
@@ -3,5 +3,17 @@
3 * 3 *
4 * This file is released under the GPLv2 4 * This file is released under the GPLv2
5 */ 5 */
6#include <asm-generic/device.h> 6#ifndef _ASM_SPARC_DEVICE_H
7#define _ASM_SPARC_DEVICE_H
8
9struct device_node;
10struct of_device;
11
12struct dev_archdata {
13 struct device_node *prom_node;
14 struct of_device *op;
15};
16
17#endif /* _ASM_SPARC_DEVICE_H */
18
7 19
diff --git a/include/asm-sparc/fb.h b/include/asm-sparc/fb.h
index c7df38030992..c73ca081e1f5 100644
--- a/include/asm-sparc/fb.h
+++ b/include/asm-sparc/fb.h
@@ -1,11 +1,20 @@
1#ifndef _ASM_FB_H_ 1#ifndef _ASM_FB_H_
2#define _ASM_FB_H_ 2#define _ASM_FB_H_
3#include <linux/fb.h> 3#include <linux/fb.h>
4#include <asm/prom.h>
4 5
5#define fb_pgprotect(...) do {} while (0) 6#define fb_pgprotect(...) do {} while (0)
6 7
7static inline int fb_is_primary_device(struct fb_info *info) 8static inline int fb_is_primary_device(struct fb_info *info)
8{ 9{
10 struct device *dev = info->device;
11 struct device_node *node;
12
13 node = dev->archdata.prom_node;
14 if (node &&
15 node == of_console_device)
16 return 1;
17
9 return 0; 18 return 0;
10} 19}
11 20
diff --git a/include/asm-sparc/oplib.h b/include/asm-sparc/oplib.h
index 91691e52c058..17ba82ee220a 100644
--- a/include/asm-sparc/oplib.h
+++ b/include/asm-sparc/oplib.h
@@ -158,32 +158,6 @@ extern void prom_putchar(char character);
158extern void prom_printf(char *fmt, ...); 158extern void prom_printf(char *fmt, ...);
159extern void prom_write(const char *buf, unsigned int len); 159extern void prom_write(const char *buf, unsigned int len);
160 160
161/* Query for input device type */
162
163enum prom_input_device {
164 PROMDEV_IKBD, /* input from keyboard */
165 PROMDEV_ITTYA, /* input from ttya */
166 PROMDEV_ITTYB, /* input from ttyb */
167 PROMDEV_IRSC, /* input from rsc */
168 PROMDEV_IVCONS, /* input from virtual-console */
169 PROMDEV_I_UNK,
170};
171
172extern enum prom_input_device prom_query_input_device(void);
173
174/* Query for output device type */
175
176enum prom_output_device {
177 PROMDEV_OSCREEN, /* to screen */
178 PROMDEV_OTTYA, /* to ttya */
179 PROMDEV_OTTYB, /* to ttyb */
180 PROMDEV_ORSC, /* to rsc */
181 PROMDEV_OVCONS, /* to virtual-console */
182 PROMDEV_O_UNK,
183};
184
185extern enum prom_output_device prom_query_output_device(void);
186
187/* Multiprocessor operations... */ 161/* Multiprocessor operations... */
188 162
189/* Start the CPU with the given device tree node, context table, and context 163/* Start the CPU with the given device tree node, context table, and context
diff --git a/include/asm-sparc/prom.h b/include/asm-sparc/prom.h
index db9feb75bd86..350676c589f9 100644
--- a/include/asm-sparc/prom.h
+++ b/include/asm-sparc/prom.h
@@ -85,5 +85,9 @@ static inline void of_node_put(struct device_node *node)
85 */ 85 */
86#include <linux/of.h> 86#include <linux/of.h>
87 87
88extern struct device_node *of_console_device;
89extern char *of_console_path;
90extern char *of_console_options;
91
88#endif /* __KERNEL__ */ 92#endif /* __KERNEL__ */
89#endif /* _SPARC_PROM_H */ 93#endif /* _SPARC_PROM_H */
diff --git a/include/asm-sparc64/fb.h b/include/asm-sparc64/fb.h
index d6cd3a175fc3..389012e5fbad 100644
--- a/include/asm-sparc64/fb.h
+++ b/include/asm-sparc64/fb.h
@@ -3,6 +3,7 @@
3#include <linux/fb.h> 3#include <linux/fb.h>
4#include <linux/fs.h> 4#include <linux/fs.h>
5#include <asm/page.h> 5#include <asm/page.h>
6#include <asm/prom.h>
6 7
7static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, 8static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
8 unsigned long off) 9 unsigned long off)
@@ -12,6 +13,14 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
12 13
13static inline int fb_is_primary_device(struct fb_info *info) 14static inline int fb_is_primary_device(struct fb_info *info)
14{ 15{
16 struct device *dev = info->device;
17 struct device_node *node;
18
19 node = dev->archdata.prom_node;
20 if (node &&
21 node == of_console_device)
22 return 1;
23
15 return 0; 24 return 0;
16} 25}
17 26
diff --git a/include/asm-sparc64/oplib.h b/include/asm-sparc64/oplib.h
index 992f9f7a476c..3f23c5dc5f21 100644
--- a/include/asm-sparc64/oplib.h
+++ b/include/asm-sparc64/oplib.h
@@ -140,32 +140,6 @@ extern void prom_putchar(char character);
140extern void prom_printf(const char *fmt, ...); 140extern void prom_printf(const char *fmt, ...);
141extern void prom_write(const char *buf, unsigned int len); 141extern void prom_write(const char *buf, unsigned int len);
142 142
143/* Query for input device type */
144
145enum prom_input_device {
146 PROMDEV_IKBD, /* input from keyboard */
147 PROMDEV_ITTYA, /* input from ttya */
148 PROMDEV_ITTYB, /* input from ttyb */
149 PROMDEV_IRSC, /* input from rsc */
150 PROMDEV_IVCONS, /* input from virtual-console */
151 PROMDEV_I_UNK,
152};
153
154extern enum prom_input_device prom_query_input_device(void);
155
156/* Query for output device type */
157
158enum prom_output_device {
159 PROMDEV_OSCREEN, /* to screen */
160 PROMDEV_OTTYA, /* to ttya */
161 PROMDEV_OTTYB, /* to ttyb */
162 PROMDEV_ORSC, /* to rsc */
163 PROMDEV_OVCONS, /* to virtual-console */
164 PROMDEV_O_UNK,
165};
166
167extern enum prom_output_device prom_query_output_device(void);
168
169/* Multiprocessor operations... */ 143/* Multiprocessor operations... */
170#ifdef CONFIG_SMP 144#ifdef CONFIG_SMP
171/* Start the CPU with the given device tree node at the passed program 145/* Start the CPU with the given device tree node at the passed program
@@ -319,6 +293,8 @@ extern int prom_inst2pkg(int);
319extern int prom_service_exists(const char *service_name); 293extern int prom_service_exists(const char *service_name);
320extern void prom_sun4v_guest_soft_state(void); 294extern void prom_sun4v_guest_soft_state(void);
321 295
296extern int prom_ihandle2path(int handle, char *buffer, int bufsize);
297
322/* Client interface level routines. */ 298/* Client interface level routines. */
323extern void prom_set_trap_table(unsigned long tba); 299extern void prom_set_trap_table(unsigned long tba);
324extern void prom_set_trap_table_sun4v(unsigned long tba, unsigned long mmfsa); 300extern void prom_set_trap_table_sun4v(unsigned long tba, unsigned long mmfsa);
diff --git a/include/asm-sparc64/parport.h b/include/asm-sparc64/parport.h
index 23cc63f049a8..600afe5ae2e3 100644
--- a/include/asm-sparc64/parport.h
+++ b/include/asm-sparc64/parport.h
@@ -8,8 +8,9 @@
8#define _ASM_SPARC64_PARPORT_H 1 8#define _ASM_SPARC64_PARPORT_H 1
9 9
10#include <asm/ebus.h> 10#include <asm/ebus.h>
11#include <asm/isa.h>
12#include <asm/ns87303.h> 11#include <asm/ns87303.h>
12#include <asm/of_device.h>
13#include <asm/prom.h>
13 14
14#define PARPORT_PC_MAX_PORTS PARPORT_MAX 15#define PARPORT_PC_MAX_PORTS PARPORT_MAX
15 16
@@ -35,8 +36,12 @@ static struct sparc_ebus_info {
35 unsigned int addr; 36 unsigned int addr;
36 unsigned int count; 37 unsigned int count;
37 int lock; 38 int lock;
39
40 struct parport *port;
38} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS]; 41} sparc_ebus_dmas[PARPORT_PC_MAX_PORTS];
39 42
43static DECLARE_BITMAP(dma_slot_map, PARPORT_PC_MAX_PORTS);
44
40static __inline__ int request_dma(unsigned int dmanr, const char *device_id) 45static __inline__ int request_dma(unsigned int dmanr, const char *device_id)
41{ 46{
42 if (dmanr >= PARPORT_PC_MAX_PORTS) 47 if (dmanr >= PARPORT_PC_MAX_PORTS)
@@ -98,117 +103,145 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr)
98 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
99} 104}
100 105
101static int ebus_ecpp_p(struct linux_ebus_device *edev) 106static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match)
102{ 107{
103 if (!strcmp(edev->prom_node->name, "ecpp")) 108 unsigned long base = op->resource[0].start;
104 return 1; 109 unsigned long config = op->resource[1].start;
105 if (!strcmp(edev->prom_node->name, "parallel")) { 110 unsigned long d_base = op->resource[2].start;
106 const char *compat; 111 unsigned long d_len;
107 112 struct device_node *parent;
108 compat = of_get_property(edev->prom_node, 113 struct parport *p;
109 "compatible", NULL); 114 int slot, err;
110 if (compat && 115
111 (!strcmp(compat, "ecpp") || 116 parent = op->node->parent;
112 !strcmp(compat, "ns87317-ecpp") || 117 if (!strcmp(parent->name, "dma")) {
113 !strcmp(compat + 13, "ecpp"))) 118 p = parport_pc_probe_port(base, base + 0x400,
114 return 1; 119 op->irqs[0], PARPORT_DMA_NOFIFO,
120 op->dev.parent);
121 if (!p)
122 return -ENOMEM;
123 dev_set_drvdata(&op->dev, p);
124 return 0;
115 } 125 }
126
127 for (slot = 0; slot < PARPORT_PC_MAX_PORTS; slot++) {
128 if (!test_and_set_bit(slot, dma_slot_map))
129 break;
130 }
131 err = -ENODEV;
132 if (slot >= PARPORT_PC_MAX_PORTS)
133 goto out_err;
134
135 spin_lock_init(&sparc_ebus_dmas[slot].info.lock);
136
137 d_len = (op->resource[2].end - d_base) + 1UL;
138 sparc_ebus_dmas[slot].info.regs =
139 of_ioremap(&op->resource[2], 0, d_len, "ECPP DMA");
140
141 if (!sparc_ebus_dmas[slot].info.regs)
142 goto out_clear_map;
143
144 sparc_ebus_dmas[slot].info.flags = 0;
145 sparc_ebus_dmas[slot].info.callback = NULL;
146 sparc_ebus_dmas[slot].info.client_cookie = NULL;
147 sparc_ebus_dmas[slot].info.irq = 0xdeadbeef;
148 strcpy(sparc_ebus_dmas[slot].info.name, "parport");
149 if (ebus_dma_register(&sparc_ebus_dmas[slot].info))
150 goto out_unmap_regs;
151
152 ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 1);
153
154 /* Configure IRQ to Push Pull, Level Low */
155 /* Enable ECP, set bit 2 of the CTR first */
156 outb(0x04, base + 0x02);
157 ns87303_modify(config, PCR,
158 PCR_EPP_ENABLE |
159 PCR_IRQ_ODRAIN,
160 PCR_ECP_ENABLE |
161 PCR_ECP_CLK_ENA |
162 PCR_IRQ_POLAR);
163
164 /* CTR bit 5 controls direction of port */
165 ns87303_modify(config, PTR,
166 0, PTR_LPT_REG_DIR);
167
168 p = parport_pc_probe_port(base, base + 0x400,
169 op->irqs[0],
170 slot,
171 op->dev.parent);
172 err = -ENOMEM;
173 if (!p)
174 goto out_disable_irq;
175
176 dev_set_drvdata(&op->dev, p);
177
116 return 0; 178 return 0;
179
180out_disable_irq:
181 ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
182 ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
183
184out_unmap_regs:
185 of_iounmap(&op->resource[2], sparc_ebus_dmas[slot].info.regs, d_len);
186
187out_clear_map:
188 clear_bit(slot, dma_slot_map);
189
190out_err:
191 return err;
117} 192}
118 193
119static int parport_isa_probe(int count) 194static int __devexit ecpp_remove(struct of_device *op)
120{ 195{
121 struct sparc_isa_bridge *isa_br; 196 struct parport *p = dev_get_drvdata(&op->dev);
122 struct sparc_isa_device *isa_dev; 197 int slot = p->dma;
123 198
124 for_each_isa(isa_br) { 199 parport_pc_unregister_port(p);
125 for_each_isadev(isa_dev, isa_br) { 200
126 struct sparc_isa_device *child; 201 if (slot != PARPORT_DMA_NOFIFO) {
127 unsigned long base; 202 unsigned long d_base = op->resource[2].start;
128 203 unsigned long d_len;
129 if (strcmp(isa_dev->prom_node->name, "dma")) 204
130 continue; 205 d_len = (op->resource[2].end - d_base) + 1UL;
131 206
132 child = isa_dev->child; 207 ebus_dma_irq_enable(&sparc_ebus_dmas[slot].info, 0);
133 while (child) { 208 ebus_dma_unregister(&sparc_ebus_dmas[slot].info);
134 if (!strcmp(child->prom_node->name, "parallel")) 209 of_iounmap(&op->resource[2],
135 break; 210 sparc_ebus_dmas[slot].info.regs,
136 child = child->next; 211 d_len);
137 } 212 clear_bit(slot, dma_slot_map);
138 if (!child)
139 continue;
140
141 base = child->resource.start;
142
143 /* No DMA, see commentary in
144 * asm-sparc64/floppy.h:isa_floppy_init()
145 */
146 if (parport_pc_probe_port(base, base + 0x400,
147 child->irq, PARPORT_DMA_NOFIFO,
148 &child->bus->self->dev))
149 count++;
150 }
151 } 213 }
152 214
153 return count; 215 return 0;
154} 216}
155 217
156static int parport_pc_find_nonpci_ports (int autoirq, int autodma) 218static struct of_device_id ecpp_match[] = {
219 {
220 .name = "ecpp",
221 },
222 {
223 .name = "parallel",
224 .compatible = "ecpp",
225 },
226 {
227 .name = "parallel",
228 .compatible = "ns87317-ecpp",
229 },
230 {},
231};
232
233static struct of_platform_driver ecpp_driver = {
234 .name = "ecpp",
235 .match_table = ecpp_match,
236 .probe = ecpp_probe,
237 .remove = __devexit_p(ecpp_remove),
238};
239
240static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
157{ 241{
158 struct linux_ebus *ebus; 242 of_register_driver(&ecpp_driver, &of_bus_type);
159 struct linux_ebus_device *edev;
160 int count = 0;
161
162 for_each_ebus(ebus) {
163 for_each_ebusdev(edev, ebus) {
164 if (ebus_ecpp_p(edev)) {
165 unsigned long base = edev->resource[0].start;
166 unsigned long config = edev->resource[1].start;
167 unsigned long d_base = edev->resource[2].start;
168 unsigned long d_len;
169
170 spin_lock_init(&sparc_ebus_dmas[count].info.lock);
171 d_len = (edev->resource[2].end -
172 d_base) + 1;
173 sparc_ebus_dmas[count].info.regs =
174 ioremap(d_base, d_len);
175 if (!sparc_ebus_dmas[count].info.regs)
176 continue;
177 sparc_ebus_dmas[count].info.flags = 0;
178 sparc_ebus_dmas[count].info.callback = NULL;
179 sparc_ebus_dmas[count].info.client_cookie = NULL;
180 sparc_ebus_dmas[count].info.irq = 0xdeadbeef;
181 strcpy(sparc_ebus_dmas[count].info.name, "parport");
182 if (ebus_dma_register(&sparc_ebus_dmas[count].info))
183 continue;
184 ebus_dma_irq_enable(&sparc_ebus_dmas[count].info, 1);
185
186 /* Configure IRQ to Push Pull, Level Low */
187 /* Enable ECP, set bit 2 of the CTR first */
188 outb(0x04, base + 0x02);
189 ns87303_modify(config, PCR,
190 PCR_EPP_ENABLE |
191 PCR_IRQ_ODRAIN,
192 PCR_ECP_ENABLE |
193 PCR_ECP_CLK_ENA |
194 PCR_IRQ_POLAR);
195
196 /* CTR bit 5 controls direction of port */
197 ns87303_modify(config, PTR,
198 0, PTR_LPT_REG_DIR);
199
200 if (parport_pc_probe_port(base, base + 0x400,
201 edev->irqs[0],
202 count,
203 &ebus->self->dev))
204 count++;
205 }
206 }
207 }
208 243
209 count = parport_isa_probe(count); 244 return 0;
210
211 return count;
212} 245}
213 246
214#endif /* !(_ASM_SPARC64_PARPORT_H */ 247#endif /* !(_ASM_SPARC64_PARPORT_H */
diff --git a/include/asm-sparc64/prom.h b/include/asm-sparc64/prom.h
index 2b9e0d795faf..31dcb92fbae0 100644
--- a/include/asm-sparc64/prom.h
+++ b/include/asm-sparc64/prom.h
@@ -94,5 +94,9 @@ static inline void of_node_put(struct device_node *node)
94 */ 94 */
95#include <linux/of.h> 95#include <linux/of.h>
96 96
97extern struct device_node *of_console_device;
98extern char *of_console_path;
99extern char *of_console_options;
100
97#endif /* __KERNEL__ */ 101#endif /* __KERNEL__ */
98#endif /* _SPARC64_PROM_H */ 102#endif /* _SPARC64_PROM_H */
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 409067408eec..64891cb10f05 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -115,14 +115,8 @@ do { __asm__ __volatile__("ba,pt %%xcc, 1f\n\t" \
115#ifndef __ASSEMBLY__ 115#ifndef __ASSEMBLY__
116 116
117extern void sun_do_break(void); 117extern void sun_do_break(void);
118extern int serial_console;
119extern int stop_a_enabled; 118extern int stop_a_enabled;
120 119
121static __inline__ int con_is_present(void)
122{
123 return serial_console ? 0 : 1;
124}
125
126extern void synchronize_user_stack(void); 120extern void synchronize_user_stack(void);
127 121
128extern void __flushw_user(void); 122extern void __flushw_user(void);