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
10 #include <linux/init.h>
11 #include <linux/platform_device.h>
12 #include <linux/zorro.h>
14 #include <asm/amigahw.h>
15 #include <asm/amigayle.h>
20 static const struct resource zorro_resources[] __initconst = {
21 /* Zorro II regions (on Zorro II/III) */
23 .name = "Zorro II exp",
26 .flags = IORESOURCE_MEM,
28 .name = "Zorro II mem",
31 .flags = IORESOURCE_MEM,
33 /* Zorro III regions (on Zorro III only) */
35 .name = "Zorro III exp",
38 .flags = IORESOURCE_MEM,
40 .name = "Zorro III cfg",
43 .flags = IORESOURCE_MEM,
48 static int __init amiga_init_bus(void)
50 struct platform_device *pdev;
53 if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
56 n = AMIGAHW_PRESENT(ZORRO3) ? 4 : 2;
57 pdev = platform_device_register_simple("amiga-zorro", -1,
62 subsys_initcall(amiga_init_bus);
65 static int __init z_dev_present(zorro_id id)
69 for (i = 0; i < zorro_num_autocon; i++)
70 if (zorro_autocon[i].rom.er_Manufacturer == ZORRO_MANUF(id) &&
71 zorro_autocon[i].rom.er_Product == ZORRO_PROD(id))
77 #else /* !CONFIG_ZORRO */
79 static inline int z_dev_present(zorro_id id) { return 0; }
81 #endif /* !CONFIG_ZORRO */
84 static const struct resource a3000_scsi_resource __initconst = {
87 .flags = IORESOURCE_MEM,
91 static const struct resource a4000t_scsi_resource __initconst = {
94 .flags = IORESOURCE_MEM,
98 static const struct resource a1200_ide_resource __initconst = {
101 .flags = IORESOURCE_MEM,
104 static const struct gayle_ide_platform_data a1200_ide_pdata __initconst = {
111 static const struct resource a4000_ide_resource __initconst = {
114 .flags = IORESOURCE_MEM,
117 static const struct gayle_ide_platform_data a4000_ide_pdata __initconst = {
124 static const struct resource amiga_rtc_resource __initconst = {
127 .flags = IORESOURCE_MEM,
131 static int __init amiga_init_devices(void)
133 struct platform_device *pdev;
140 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
141 pdev = platform_device_register_simple("amiga-video", -1, NULL,
144 return PTR_ERR(pdev);
149 if (AMIGAHW_PRESENT(AMI_AUDIO)) {
150 pdev = platform_device_register_simple("amiga-audio", -1, NULL,
153 return PTR_ERR(pdev);
157 /* storage interfaces */
158 if (AMIGAHW_PRESENT(AMI_FLOPPY)) {
159 pdev = platform_device_register_simple("amiga-floppy", -1,
162 return PTR_ERR(pdev);
165 if (AMIGAHW_PRESENT(A3000_SCSI)) {
166 pdev = platform_device_register_simple("amiga-a3000-scsi", -1,
167 &a3000_scsi_resource, 1);
169 return PTR_ERR(pdev);
172 if (AMIGAHW_PRESENT(A4000_SCSI)) {
173 pdev = platform_device_register_simple("amiga-a4000t-scsi", -1,
174 &a4000t_scsi_resource,
177 return PTR_ERR(pdev);
180 if (AMIGAHW_PRESENT(A1200_IDE) ||
181 z_dev_present(ZORRO_PROD_MTEC_VIPER_MK_V_E_MATRIX_530_SCSI_IDE)) {
182 pdev = platform_device_register_simple("amiga-gayle-ide", -1,
183 &a1200_ide_resource, 1);
185 return PTR_ERR(pdev);
186 error = platform_device_add_data(pdev, &a1200_ide_pdata,
187 sizeof(a1200_ide_pdata));
192 if (AMIGAHW_PRESENT(A4000_IDE)) {
193 pdev = platform_device_register_simple("amiga-gayle-ide", -1,
194 &a4000_ide_resource, 1);
196 return PTR_ERR(pdev);
197 error = platform_device_add_data(pdev, &a4000_ide_pdata,
198 sizeof(a4000_ide_pdata));
204 /* other I/O hardware */
205 if (AMIGAHW_PRESENT(AMI_KEYBOARD)) {
206 pdev = platform_device_register_simple("amiga-keyboard", -1,
209 return PTR_ERR(pdev);
212 if (AMIGAHW_PRESENT(AMI_MOUSE)) {
213 pdev = platform_device_register_simple("amiga-mouse", -1, NULL,
216 return PTR_ERR(pdev);
219 if (AMIGAHW_PRESENT(AMI_SERIAL)) {
220 pdev = platform_device_register_simple("amiga-serial", -1,
223 return PTR_ERR(pdev);
226 if (AMIGAHW_PRESENT(AMI_PARALLEL)) {
227 pdev = platform_device_register_simple("amiga-parallel", -1,
230 return PTR_ERR(pdev);
234 /* real time clocks */
235 if (AMIGAHW_PRESENT(A2000_CLK)) {
236 pdev = platform_device_register_simple("rtc-msm6242", -1,
237 &amiga_rtc_resource, 1);
239 return PTR_ERR(pdev);
242 if (AMIGAHW_PRESENT(A3000_CLK)) {
243 pdev = platform_device_register_simple("rtc-rp5c01", -1,
244 &amiga_rtc_resource, 1);
246 return PTR_ERR(pdev);
252 arch_initcall(amiga_init_devices);