m68k: amiga - A4000T SCSI platform device conversion
[firefly-linux-kernel-4.4.55.git] / arch / m68k / amiga / platform.c
1 /*
2  *  Copyright (C) 2007-2009 Geert Uytterhoeven
3  *
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
6  * for more details.
7  */
8
9 #include <linux/init.h>
10 #include <linux/platform_device.h>
11 #include <linux/zorro.h>
12
13 #include <asm/amigahw.h>
14
15
16 #ifdef CONFIG_ZORRO
17
18 static const struct resource zorro_resources[] __initconst = {
19         /* Zorro II regions (on Zorro II/III) */
20         {
21                 .name   = "Zorro II exp",
22                 .start  = 0x00e80000,
23                 .end    = 0x00efffff,
24                 .flags  = IORESOURCE_MEM,
25         }, {
26                 .name   = "Zorro II mem",
27                 .start  = 0x00200000,
28                 .end    = 0x009fffff,
29                 .flags  = IORESOURCE_MEM,
30         },
31         /* Zorro III regions (on Zorro III only) */
32         {
33                 .name   = "Zorro III exp",
34                 .start  = 0xff000000,
35                 .end    = 0xffffffff,
36                 .flags  = IORESOURCE_MEM,
37         }, {
38                 .name   = "Zorro III cfg",
39                 .start  = 0x40000000,
40                 .end    = 0x7fffffff,
41                 .flags  = IORESOURCE_MEM,
42         }
43 };
44
45
46 static int __init amiga_init_bus(void)
47 {
48         if (!MACH_IS_AMIGA || !AMIGAHW_PRESENT(ZORRO))
49                 return -ENODEV;
50
51         platform_device_register_simple("amiga-zorro", -1, zorro_resources,
52                                         AMIGAHW_PRESENT(ZORRO3) ? 4 : 2);
53         return 0;
54 }
55
56 subsys_initcall(amiga_init_bus);
57
58 #endif /* CONFIG_ZORRO */
59
60
61 static const struct resource a3000_scsi_resource __initconst = {
62         .start  = 0xdd0000,
63         .end    = 0xdd00ff,
64         .flags  = IORESOURCE_MEM,
65 };
66
67
68 static const struct resource a4000t_scsi_resource __initconst = {
69         .start  = 0xdd0000,
70         .end    = 0xdd0fff,
71         .flags  = IORESOURCE_MEM,
72 };
73
74
75 static int __init amiga_init_devices(void)
76 {
77         if (!MACH_IS_AMIGA)
78                 return -ENODEV;
79
80         /* video hardware */
81         if (AMIGAHW_PRESENT(AMI_VIDEO))
82                 platform_device_register_simple("amiga-video", -1, NULL, 0);
83
84
85         /* sound hardware */
86         if (AMIGAHW_PRESENT(AMI_AUDIO))
87                 platform_device_register_simple("amiga-audio", -1, NULL, 0);
88
89
90         /* storage interfaces */
91         if (AMIGAHW_PRESENT(AMI_FLOPPY))
92                 platform_device_register_simple("amiga-floppy", -1, NULL, 0);
93
94         if (AMIGAHW_PRESENT(A3000_SCSI))
95                 platform_device_register_simple("amiga-a3000-scsi", -1,
96                                                 &a3000_scsi_resource, 1);
97
98         if (AMIGAHW_PRESENT(A4000_SCSI))
99                 platform_device_register_simple("amiga-a4000t-scsi", -1,
100                                                 &a4000t_scsi_resource, 1);
101
102         return 0;
103 }
104
105 device_initcall(amiga_init_devices);