File: /usr/src/linux/arch/sparc64/kernel/auxio.c
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/config.h>
7 #include <linux/stddef.h>
8 #include <linux/kernel.h>
9 #include <linux/sched.h>
10 #include <linux/smp.h>
11 #include <linux/init.h>
12 #include <linux/delay.h>
13 #include <linux/ioport.h>
14
15 #include <asm/oplib.h>
16 #include <asm/io.h>
17 #include <asm/auxio.h>
18 #include <asm/sbus.h>
19 #include <asm/ebus.h>
20 #include <asm/fhc.h>
21 #include <asm/spitfire.h>
22 #include <asm/starfire.h>
23
24 /* Probe and map in the Auxiliary I/O register */
25 unsigned long auxio_register = 0;
26
27 void __init auxio_probe(void)
28 {
29 struct sbus_bus *sbus;
30 struct sbus_dev *sdev = 0;
31
32 for_each_sbus(sbus) {
33 for_each_sbusdev(sdev, sbus) {
34 if(!strcmp(sdev->prom_name, "auxio"))
35 goto found_sdev;
36 }
37 }
38
39 found_sdev:
40 if (!sdev) {
41 #ifdef CONFIG_PCI
42 struct linux_ebus *ebus;
43 struct linux_ebus_device *edev = 0;
44 unsigned long led_auxio;
45
46 for_each_ebus(ebus) {
47 for_each_ebusdev(edev, ebus) {
48 if (!strcmp(edev->prom_name, "auxio"))
49 goto ebus_done;
50 }
51 }
52 ebus_done:
53
54 if (edev) {
55 led_auxio = edev->resource[0].start;
56 outl(0x01, led_auxio);
57 return;
58 }
59 #endif
60 auxio_register = 0UL;
61 return;
62 }
63
64 /* Map the register both read and write */
65 auxio_register = sbus_ioremap(&sdev->resource[0], 0,
66 sdev->reg_addrs[0].reg_size, "auxiliaryIO");
67 TURN_ON_LED;
68 }
69