2 * Copyright (C) 2007-2009 Geert Uytterhoeven
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file COPYING in the main directory of this archive
9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/zorro.h>
13 #include <asm/amigahw.h>
14 #include <asm/amigayle.h>
19 static const struct resource zorro_resources[] __initconst = {
20 /* Zorro II regions (on Zorro II/III) */
22 .name = "Zorro II exp",
25 .flags = IORESOURCE_MEM,
27 .name = "Zorro II mem",
30 .flags = IORESOURCE_MEM,
32 /* Zorro III regions (on Zorro III only) */
34 .name = "Zorro III exp",
37 .flags = IORESOURCE_MEM,
39 .name = "Zorro III cfg",
42 .flags = IORESOURCE_MEM,
47 static int __init amiga_init_bus(void)
49 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
52 platform_device_register_simple("amiga-zorro", -1, zorro_resources,
53 AMIGAHW_PRESENT(ZORRO3) ? 4 : 2);
57 subsys_initcall(amiga_init_bus);
60 static int z_dev_present(zorro_id id)
64 for (i = 0; i < zorro_num_autocon; i++)
65 if (zorro_autocon[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
66 zorro_autocon[i].rom.er_Product == ZORRO_PROD(id))
72 #else /* !CONFIG_ZORRO */
74 static inline int z_dev_present(zorro_id id) { return 0; }
76 #endif /* !CONFIG_ZORRO */
79 static const struct resource a3000_scsi_resource __initconst = {
82 .flags = IORESOURCE_MEM,
86 static const struct resource a4000t_scsi_resource __initconst = {
89 .flags = IORESOURCE_MEM,
93 static const struct resource a1200_ide_resource __initconst = {
96 .flags = IORESOURCE_MEM,
99 static const struct gayle_ide_platform_data a1200_ide_pdata __initconst = {
106 static const struct resource a4000_ide_resource __initconst = {
109 .flags = IORESOURCE_MEM,
112 static const struct gayle_ide_platform_data a4000_ide_pdata __initconst = {
119 static const struct resource amiga_rtc_resource __initconst = {
122 .flags = IORESOURCE_MEM,
126 static int __init amiga_init_devices(void)
128 struct platform_device *pdev;
134 if (AMIGAHW_PRESENT(AMI_VIDEO))
135 platform_device_register_simple("amiga-video", -1, NULL, 0);
139 if (AMIGAHW_PRESENT(AMI_AUDIO))
140 platform_device_register_simple("amiga-audio", -1, NULL, 0);
143 /* storage interfaces */
144 if (AMIGAHW_PRESENT(AMI_FLOPPY))
145 platform_device_register_simple("amiga-floppy", -1, NULL, 0);
147 if (AMIGAHW_PRESENT(A3000_SCSI))
148 platform_device_register_simple("amiga-a3000-scsi", -1,
149 &a3000_scsi_resource, 1);
151 if (AMIGAHW_PRESENT(A4000_SCSI))
152 platform_device_register_simple("amiga-a4000t-scsi", -1,
153 &a4000t_scsi_resource, 1);
155 if (AMIGAHW_PRESENT(A1200_IDE) ||
156 z_dev_present(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE)) {
157 pdev = platform_device_register_simple("amiga-gayle-ide", -1,
158 &a1200_ide_resource, 1);
159 platform_device_add_data(pdev, &a1200_ide_pdata,
160 sizeof(a1200_ide_pdata));
163 if (AMIGAHW_PRESENT(A4000_IDE)) {
164 pdev = platform_device_register_simple("amiga-gayle-ide", -1,
165 &a4000_ide_resource, 1);
166 platform_device_add_data(pdev, &a4000_ide_pdata,
167 sizeof(a4000_ide_pdata));
171 /* other I/O hardware */
172 if (AMIGAHW_PRESENT(AMI_KEYBOARD))
173 platform_device_register_simple("amiga-keyboard", -1, NULL, 0);
175 if (AMIGAHW_PRESENT(AMI_MOUSE))
176 platform_device_register_simple("amiga-mouse", -1, NULL, 0);
178 if (AMIGAHW_PRESENT(AMI_SERIAL))
179 platform_device_register_simple("amiga-serial", -1, NULL, 0);
181 if (AMIGAHW_PRESENT(AMI_PARALLEL))
182 platform_device_register_simple("amiga-parallel", -1, NULL, 0);
185 /* real time clocks */
186 if (AMIGAHW_PRESENT(A2000_CLK))
187 platform_device_register_simple("rtc-msm6242", -1,
188 &amiga_rtc_resource, 1);
190 if (AMIGAHW_PRESENT(A3000_CLK))
191 platform_device_register_simple("rtc-rp5c01", -1,
192 &amiga_rtc_resource, 1);
197 device_initcall(amiga_init_devices);