1 /* auxio.c: Probing for the Sparc AUXIO register at boot time.
3 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
6 #include <linux/stddef.h>
7 #include <linux/init.h>
8 #include <linux/config.h>
11 #include <asm/auxio.h>
12 #include <asm/string.h> /* memset(), Linux has no bzero() */
14 /* Probe and map in the Auxiliary I/O register */
15 unsigned char *auxio_register
;
17 void __init
auxio_probe(void)
20 struct linux_prom_registers auxregs
[1];
23 switch (sparc_cpu_model
) {
31 node
= prom_getchild(prom_root_node
);
32 auxio_nd
= prom_searchsiblings(node
, "auxiliary-io");
34 node
= prom_searchsiblings(node
, "obio");
35 node
= prom_getchild(node
);
36 auxio_nd
= prom_searchsiblings(node
, "auxio");
39 /* There may be auxio on Ebus */
43 if(prom_searchsiblings(node
, "leds")) {
44 /* VME chassis sun4m machine, no auxio exists. */
48 prom_printf("Cannot find auxio node, cannot continue...\n");
53 prom_getproperty(auxio_nd
, "reg", (char *) auxregs
, sizeof(auxregs
));
54 prom_apply_obio_ranges(auxregs
, 0x1);
55 /* Map the register both read and write */
56 r
.flags
= auxregs
[0].which_io
& 0xF;
57 r
.start
= auxregs
[0].phys_addr
;
58 r
.end
= auxregs
[0].phys_addr
+ auxregs
[0].reg_size
- 1;
59 auxio_register
= (unsigned char *) sbus_ioremap(&r
, 0,
60 auxregs
[0].reg_size
, "auxio");
61 /* Fix the address on sun4m and sun4c. */
62 if((((unsigned long) auxregs
[0].phys_addr
) & 3) == 3 ||
63 sparc_cpu_model
== sun4c
)
64 auxio_register
= (unsigned char *) ((int)auxio_register
| 3);
70 /* sun4m power control register (AUXIO2) */
72 volatile unsigned char * auxio_power_register
= NULL
;
74 void __init
auxio_power_probe(void)
76 struct linux_prom_registers regs
;
80 /* Attempt to find the sun4m power control node. */
81 node
= prom_getchild(prom_root_node
);
82 node
= prom_searchsiblings(node
, "obio");
83 node
= prom_getchild(node
);
84 node
= prom_searchsiblings(node
, "power");
85 if (node
== 0 || node
== -1)
88 /* Map the power control register. */
89 prom_getproperty(node
, "reg", (char *)®s
, sizeof(regs
));
90 prom_apply_obio_ranges(®s
, 1);
91 memset(&r
, 0, sizeof(r
));
92 r
.flags
= regs
.which_io
& 0xF;
93 r
.start
= regs
.phys_addr
;
94 r
.end
= regs
.phys_addr
+ regs
.reg_size
- 1;
95 auxio_power_register
= (unsigned char *) sbus_ioremap(&r
, 0,
96 regs
.reg_size
, "auxpower");
98 /* Display a quick message on the console. */
99 if (auxio_power_register
)
100 printk(KERN_INFO
"Power off control detected.\n");