1 #include <linux/init.h>
2 #include <linux/if_ether.h>
3 #include <linux/kernel.h>
4 #include <linux/platform_device.h>
6 #include <asm/paccess.h>
7 #include <asm/sgi/ip22.h>
8 #include <asm/sgi/hpc3.h>
9 #include <asm/sgi/mc.h>
10 #include <asm/sgi/seeq.h>
11 #include <asm/sgi/wd.h>
13 static struct resource sgiwd93_0_resources
[] = {
16 .start
= SGI_WD93_0_IRQ
,
17 .end
= SGI_WD93_0_IRQ
,
18 .flags
= IORESOURCE_IRQ
22 static struct sgiwd93_platform_data sgiwd93_0_pd
= {
24 .irq
= SGI_WD93_0_IRQ
,
27 static struct platform_device sgiwd93_0_device
= {
30 .num_resources
= ARRAY_SIZE(sgiwd93_0_resources
),
31 .resource
= sgiwd93_0_resources
,
33 .platform_data
= &sgiwd93_0_pd
,
37 static struct resource sgiwd93_1_resources
[] = {
40 .start
= SGI_WD93_1_IRQ
,
41 .end
= SGI_WD93_1_IRQ
,
42 .flags
= IORESOURCE_IRQ
46 static struct sgiwd93_platform_data sgiwd93_1_pd
= {
48 .irq
= SGI_WD93_1_IRQ
,
51 static struct platform_device sgiwd93_1_device
= {
54 .num_resources
= ARRAY_SIZE(sgiwd93_1_resources
),
55 .resource
= sgiwd93_1_resources
,
57 .platform_data
= &sgiwd93_1_pd
,
62 * Create a platform device for the GPI port that receives the
63 * image data from the embedded camera.
65 static int __init
sgiwd93_devinit(void)
69 sgiwd93_0_pd
.hregs
= &hpc3c0
->scsi_chan0
;
70 sgiwd93_0_pd
.wdregs
= (unsigned char *) hpc3c0
->scsi0_ext
;
72 res
= platform_device_register(&sgiwd93_0_device
);
76 if (!ip22_is_fullhouse())
79 sgiwd93_1_pd
.hregs
= &hpc3c0
->scsi_chan1
;
80 sgiwd93_1_pd
.wdregs
= (unsigned char *) hpc3c0
->scsi1_ext
;
82 return platform_device_register(&sgiwd93_1_device
);
85 device_initcall(sgiwd93_devinit
);
87 static struct resource sgiseeq_0_resources
[] = {
90 .start
= SGI_ENET_IRQ
,
92 .flags
= IORESOURCE_IRQ
96 static struct sgiseeq_platform_data eth0_pd
;
98 static struct platform_device eth0_device
= {
101 .num_resources
= ARRAY_SIZE(sgiseeq_0_resources
),
102 .resource
= sgiseeq_0_resources
,
104 .platform_data
= ð0_pd
,
108 static struct resource sgiseeq_1_resources
[] = {
111 .start
= SGI_GIO_0_IRQ
,
112 .end
= SGI_GIO_0_IRQ
,
113 .flags
= IORESOURCE_IRQ
117 static struct sgiseeq_platform_data eth1_pd
;
119 static struct platform_device eth1_device
= {
122 .num_resources
= ARRAY_SIZE(sgiseeq_1_resources
),
123 .resource
= sgiseeq_1_resources
,
125 .platform_data
= ð1_pd
,
130 * Create a platform device for the GPI port that receives the
131 * image data from the embedded camera.
133 static int __init
sgiseeq_devinit(void)
138 eth0_pd
.hpc
= hpc3c0
;
139 eth0_pd
.irq
= SGI_ENET_IRQ
;
140 #define EADDR_NVOFS 250
141 for (i
= 0; i
< 3; i
++) {
142 unsigned short tmp
= ip22_nvram_read(EADDR_NVOFS
/ 2 + i
);
144 eth0_pd
.mac
[2 * i
] = tmp
>> 8;
145 eth0_pd
.mac
[2 * i
+ 1] = tmp
& 0xff;
148 res
= platform_device_register(ð0_device
);
152 /* Second HPC is missing? */
153 if (ip22_is_fullhouse() ||
154 get_dbe(tmp
, (unsigned int *)&hpc3c1
->pbdma
[1]))
157 sgimc
->giopar
|= SGIMC_GIOPAR_MASTEREXP1
| SGIMC_GIOPAR_EXP164
|
159 hpc3c1
->pbus_piocfg
[0][0] = 0x3ffff;
160 /* interrupt/config register on Challenge S Mezz board */
161 hpc3c1
->pbus_extregs
[0][0] = 0x30;
163 eth1_pd
.hpc
= hpc3c1
;
164 eth1_pd
.irq
= SGI_GIO_0_IRQ
;
165 #define EADDR_NVOFS 250
166 for (i
= 0; i
< 3; i
++) {
167 unsigned short tmp
= ip22_eeprom_read(&hpc3c1
->eeprom
,
168 EADDR_NVOFS
/ 2 + i
);
170 eth1_pd
.mac
[2 * i
] = tmp
>> 8;
171 eth1_pd
.mac
[2 * i
+ 1] = tmp
& 0xff;
174 return platform_device_register(ð1_device
);
177 device_initcall(sgiseeq_devinit
);
179 static int __init
sgi_hal2_devinit(void)
181 return IS_ERR(platform_device_register_simple("sgihal2", 0, NULL
, 0));
184 device_initcall(sgi_hal2_devinit
);
186 static int __init
sgi_button_devinit(void)
188 if (ip22_is_fullhouse())
189 return 0; /* full house has no volume buttons */
191 return IS_ERR(platform_device_register_simple("sgibtns", -1, NULL
, 0));
194 device_initcall(sgi_button_devinit
);
196 static int __init
sgi_ds1286_devinit(void)
200 memset(&res
, 0, sizeof(res
));
201 res
.start
= HPC3_CHIP0_BASE
+ offsetof(struct hpc3_regs
, rtcregs
);
202 res
.end
= res
.start
+ sizeof(hpc3c0
->rtcregs
) - 1;
203 res
.flags
= IORESOURCE_MEM
;
205 return IS_ERR(platform_device_register_simple("rtc-ds1286", -1,
209 device_initcall(sgi_ds1286_devinit
);