aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/auxio.c
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-12-03 06:08:37 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-04 12:17:20 -0500
commitd670bd4f803c8b646acd20f3ba21e65458293faf (patch)
treeeabc30aadce1556023c4aa445c649ba9e1d3f352 /arch/sparc/kernel/auxio.c
parent478b8fecda511942404ac232897a718cecd13e48 (diff)
sparc: prepare kernel/ for unification
o sparc32 files with identical names to sparc64 renamed to <name>_32.S o introduced a few Kconfig helpers to simplify Makefile logic o refactored Makefile to prepare for unification - use obj-$(CONFIG_SPARC32) for sparc32 specific files - use <name>_$(BITS) for files where sparc64 has a _64 variant - sparc64 directly include a few files where sparc32 builds them, refer to these files directly (no BITS) - sneaked in -Werror as used by sparc64 o modified sparc/Makefile to use the new names for head/init_task Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/auxio.c')
-rw-r--r--arch/sparc/kernel/auxio.c139
1 files changed, 0 insertions, 139 deletions
diff --git a/arch/sparc/kernel/auxio.c b/arch/sparc/kernel/auxio.c
deleted file mode 100644
index 09c857215a52..000000000000
--- a/arch/sparc/kernel/auxio.c
+++ /dev/null
@@ -1,139 +0,0 @@
1/* auxio.c: Probing for the Sparc AUXIO register at boot time.
2 *
3 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
4 */
5
6#include <linux/stddef.h>
7#include <linux/init.h>
8#include <linux/spinlock.h>
9#include <linux/of.h>
10#include <linux/of_device.h>
11#include <asm/oplib.h>
12#include <asm/io.h>
13#include <asm/auxio.h>
14#include <asm/string.h> /* memset(), Linux has no bzero() */
15
16/* Probe and map in the Auxiliary I/O register */
17
18/* auxio_register is not static because it is referenced
19 * in entry.S::floppy_tdone
20 */
21void __iomem *auxio_register = NULL;
22static DEFINE_SPINLOCK(auxio_lock);
23
24void __init auxio_probe(void)
25{
26 int node, auxio_nd;
27 struct linux_prom_registers auxregs[1];
28 struct resource r;
29
30 switch (sparc_cpu_model) {
31 case sun4d:
32 case sun4:
33 return;
34 default:
35 break;
36 }
37 node = prom_getchild(prom_root_node);
38 auxio_nd = prom_searchsiblings(node, "auxiliary-io");
39 if(!auxio_nd) {
40 node = prom_searchsiblings(node, "obio");
41 node = prom_getchild(node);
42 auxio_nd = prom_searchsiblings(node, "auxio");
43 if(!auxio_nd) {
44#ifdef CONFIG_PCI
45 /* There may be auxio on Ebus */
46 return;
47#else
48 if(prom_searchsiblings(node, "leds")) {
49 /* VME chassis sun4m machine, no auxio exists. */
50 return;
51 }
52 prom_printf("Cannot find auxio node, cannot continue...\n");
53 prom_halt();
54#endif
55 }
56 }
57 if(prom_getproperty(auxio_nd, "reg", (char *) auxregs, sizeof(auxregs)) <= 0)
58 return;
59 prom_apply_obio_ranges(auxregs, 0x1);
60 /* Map the register both read and write */
61 r.flags = auxregs[0].which_io & 0xF;
62 r.start = auxregs[0].phys_addr;
63 r.end = auxregs[0].phys_addr + auxregs[0].reg_size - 1;
64 auxio_register = of_ioremap(&r, 0, auxregs[0].reg_size, "auxio");
65 /* Fix the address on sun4m and sun4c. */
66 if((((unsigned long) auxregs[0].phys_addr) & 3) == 3 ||
67 sparc_cpu_model == sun4c)
68 auxio_register += (3 - ((unsigned long)auxio_register & 3));
69
70 set_auxio(AUXIO_LED, 0);
71}
72
73unsigned char get_auxio(void)
74{
75 if(auxio_register)
76 return sbus_readb(auxio_register);
77 return 0;
78}
79
80void set_auxio(unsigned char bits_on, unsigned char bits_off)
81{
82 unsigned char regval;
83 unsigned long flags;
84 spin_lock_irqsave(&auxio_lock, flags);
85 switch(sparc_cpu_model) {
86 case sun4c:
87 regval = sbus_readb(auxio_register);
88 sbus_writeb(((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN,
89 auxio_register);
90 break;
91 case sun4m:
92 if(!auxio_register)
93 break; /* VME chassis sun4m, no auxio. */
94 regval = sbus_readb(auxio_register);
95 sbus_writeb(((regval | bits_on) & ~bits_off) | AUXIO_ORMEIN4M,
96 auxio_register);
97 break;
98 case sun4d:
99 break;
100 default:
101 panic("Can't set AUXIO register on this machine.");
102 };
103 spin_unlock_irqrestore(&auxio_lock, flags);
104}
105
106
107/* sun4m power control register (AUXIO2) */
108
109volatile unsigned char * auxio_power_register = NULL;
110
111void __init auxio_power_probe(void)
112{
113 struct linux_prom_registers regs;
114 int node;
115 struct resource r;
116
117 /* Attempt to find the sun4m power control node. */
118 node = prom_getchild(prom_root_node);
119 node = prom_searchsiblings(node, "obio");
120 node = prom_getchild(node);
121 node = prom_searchsiblings(node, "power");
122 if (node == 0 || node == -1)
123 return;
124
125 /* Map the power control register. */
126 if (prom_getproperty(node, "reg", (char *)&regs, sizeof(regs)) <= 0)
127 return;
128 prom_apply_obio_ranges(&regs, 1);
129 memset(&r, 0, sizeof(r));
130 r.flags = regs.which_io & 0xF;
131 r.start = regs.phys_addr;
132 r.end = regs.phys_addr + regs.reg_size - 1;
133 auxio_power_register = (unsigned char *) of_ioremap(&r, 0,
134 regs.reg_size, "auxpower");
135
136 /* Display a quick message on the console. */
137 if (auxio_power_register)
138 printk(KERN_INFO "Power off control detected.\n");
139}