Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Platform device support for Au1x00 SoCs. |
| 3 | * |
| 4 | * Copyright 2004, Matt Porter <mporter@kernel.crashing.org> |
| 5 | * |
| 6 | * This file is licensed under the terms of the GNU General Public |
| 7 | * License version 2. This program is licensed "as is" without any |
| 8 | * warranty of any kind, whether express or implied. |
| 9 | */ |
| 10 | #include <linux/device.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 11 | #include <linux/platform_device.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <linux/kernel.h> |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/resource.h> |
| 15 | |
Pete Popov | 26a940e | 2005-09-15 08:03:12 +0000 | [diff] [blame] | 16 | #include <asm/mach-au1x00/au1xxx.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 18 | /* OHCI (USB full speed host controller) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 | static struct resource au1xxx_usb_ohci_resources[] = { |
| 20 | [0] = { |
| 21 | .start = USB_OHCI_BASE, |
Jordan Crouse | d5fb7f1 | 2006-01-20 14:09:54 -0800 | [diff] [blame] | 22 | .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | .flags = IORESOURCE_MEM, |
| 24 | }, |
| 25 | [1] = { |
| 26 | .start = AU1000_USB_HOST_INT, |
| 27 | .end = AU1000_USB_HOST_INT, |
| 28 | .flags = IORESOURCE_IRQ, |
| 29 | }, |
| 30 | }; |
| 31 | |
| 32 | /* The dmamask must be set for OHCI to work */ |
| 33 | static u64 ohci_dmamask = ~(u32)0; |
| 34 | |
| 35 | static struct platform_device au1xxx_usb_ohci_device = { |
| 36 | .name = "au1xxx-ohci", |
| 37 | .id = 0, |
| 38 | .dev = { |
| 39 | .dma_mask = &ohci_dmamask, |
| 40 | .coherent_dma_mask = 0xffffffff, |
| 41 | }, |
| 42 | .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), |
| 43 | .resource = au1xxx_usb_ohci_resources, |
| 44 | }; |
| 45 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 46 | /*** AU1100 LCD controller ***/ |
| 47 | |
| 48 | #ifdef CONFIG_FB_AU1100 |
| 49 | static struct resource au1100_lcd_resources[] = { |
| 50 | [0] = { |
| 51 | .start = LCD_PHYS_ADDR, |
| 52 | .end = LCD_PHYS_ADDR + 0x800 - 1, |
| 53 | .flags = IORESOURCE_MEM, |
| 54 | }, |
| 55 | [1] = { |
| 56 | .start = AU1100_LCD_INT, |
| 57 | .end = AU1100_LCD_INT, |
| 58 | .flags = IORESOURCE_IRQ, |
| 59 | } |
| 60 | }; |
| 61 | |
| 62 | static u64 au1100_lcd_dmamask = ~(u32)0; |
| 63 | |
| 64 | static struct platform_device au1100_lcd_device = { |
| 65 | .name = "au1100-lcd", |
| 66 | .id = 0, |
| 67 | .dev = { |
| 68 | .dma_mask = &au1100_lcd_dmamask, |
| 69 | .coherent_dma_mask = 0xffffffff, |
| 70 | }, |
| 71 | .num_resources = ARRAY_SIZE(au1100_lcd_resources), |
| 72 | .resource = au1100_lcd_resources, |
| 73 | }; |
| 74 | #endif |
| 75 | |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 76 | #ifdef CONFIG_SOC_AU1200 |
| 77 | /* EHCI (USB high speed host controller) */ |
| 78 | static struct resource au1xxx_usb_ehci_resources[] = { |
| 79 | [0] = { |
| 80 | .start = USB_EHCI_BASE, |
| 81 | .end = USB_EHCI_BASE + USB_EHCI_LEN - 1, |
| 82 | .flags = IORESOURCE_MEM, |
| 83 | }, |
| 84 | [1] = { |
| 85 | .start = AU1000_USB_HOST_INT, |
| 86 | .end = AU1000_USB_HOST_INT, |
| 87 | .flags = IORESOURCE_IRQ, |
| 88 | }, |
| 89 | }; |
| 90 | |
| 91 | static u64 ehci_dmamask = ~(u32)0; |
| 92 | |
| 93 | static struct platform_device au1xxx_usb_ehci_device = { |
| 94 | .name = "au1xxx-ehci", |
| 95 | .id = 0, |
| 96 | .dev = { |
| 97 | .dma_mask = &ehci_dmamask, |
| 98 | .coherent_dma_mask = 0xffffffff, |
| 99 | }, |
| 100 | .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources), |
| 101 | .resource = au1xxx_usb_ehci_resources, |
| 102 | }; |
| 103 | |
| 104 | /* Au1200 UDC (USB gadget controller) */ |
| 105 | static struct resource au1xxx_usb_gdt_resources[] = { |
| 106 | [0] = { |
| 107 | .start = USB_UDC_BASE, |
| 108 | .end = USB_UDC_BASE + USB_UDC_LEN - 1, |
| 109 | .flags = IORESOURCE_MEM, |
| 110 | }, |
| 111 | [1] = { |
| 112 | .start = AU1200_USB_INT, |
| 113 | .end = AU1200_USB_INT, |
| 114 | .flags = IORESOURCE_IRQ, |
| 115 | }, |
| 116 | }; |
| 117 | |
Pete Popov | ba264b3 | 2005-09-21 06:18:27 +0000 | [diff] [blame] | 118 | static struct resource au1xxx_mmc_resources[] = { |
| 119 | [0] = { |
| 120 | .start = SD0_PHYS_ADDR, |
| 121 | .end = SD0_PHYS_ADDR + 0x40, |
| 122 | .flags = IORESOURCE_MEM, |
| 123 | }, |
| 124 | [1] = { |
| 125 | .start = SD1_PHYS_ADDR, |
| 126 | .end = SD1_PHYS_ADDR + 0x40, |
| 127 | .flags = IORESOURCE_MEM, |
| 128 | }, |
| 129 | [2] = { |
| 130 | .start = AU1200_SD_INT, |
| 131 | .end = AU1200_SD_INT, |
| 132 | .flags = IORESOURCE_IRQ, |
| 133 | } |
| 134 | }; |
| 135 | |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 136 | static u64 udc_dmamask = ~(u32)0; |
| 137 | |
| 138 | static struct platform_device au1xxx_usb_gdt_device = { |
| 139 | .name = "au1xxx-udc", |
| 140 | .id = 0, |
| 141 | .dev = { |
| 142 | .dma_mask = &udc_dmamask, |
| 143 | .coherent_dma_mask = 0xffffffff, |
| 144 | }, |
| 145 | .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources), |
| 146 | .resource = au1xxx_usb_gdt_resources, |
| 147 | }; |
| 148 | |
| 149 | /* Au1200 UOC (USB OTG controller) */ |
| 150 | static struct resource au1xxx_usb_otg_resources[] = { |
| 151 | [0] = { |
| 152 | .start = USB_UOC_BASE, |
| 153 | .end = USB_UOC_BASE + USB_UOC_LEN - 1, |
| 154 | .flags = IORESOURCE_MEM, |
| 155 | }, |
| 156 | [1] = { |
| 157 | .start = AU1200_USB_INT, |
| 158 | .end = AU1200_USB_INT, |
| 159 | .flags = IORESOURCE_IRQ, |
| 160 | }, |
| 161 | }; |
| 162 | |
| 163 | static u64 uoc_dmamask = ~(u32)0; |
| 164 | |
| 165 | static struct platform_device au1xxx_usb_otg_device = { |
| 166 | .name = "au1xxx-uoc", |
| 167 | .id = 0, |
| 168 | .dev = { |
| 169 | .dma_mask = &uoc_dmamask, |
| 170 | .coherent_dma_mask = 0xffffffff, |
| 171 | }, |
| 172 | .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources), |
| 173 | .resource = au1xxx_usb_otg_resources, |
| 174 | }; |
| 175 | |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 176 | static struct resource au1200_lcd_resources[] = { |
| 177 | [0] = { |
| 178 | .start = LCD_PHYS_ADDR, |
| 179 | .end = LCD_PHYS_ADDR + 0x800 - 1, |
| 180 | .flags = IORESOURCE_MEM, |
| 181 | }, |
| 182 | [1] = { |
| 183 | .start = AU1200_LCD_INT, |
| 184 | .end = AU1200_LCD_INT, |
| 185 | .flags = IORESOURCE_IRQ, |
| 186 | } |
| 187 | }; |
| 188 | |
Pete Popov | 26a940e | 2005-09-15 08:03:12 +0000 | [diff] [blame] | 189 | static struct resource au1200_ide0_resources[] = { |
| 190 | [0] = { |
| 191 | .start = AU1XXX_ATA_PHYS_ADDR, |
| 192 | .end = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN, |
| 193 | .flags = IORESOURCE_MEM, |
| 194 | }, |
| 195 | [1] = { |
| 196 | .start = AU1XXX_ATA_INT, |
| 197 | .end = AU1XXX_ATA_INT, |
| 198 | .flags = IORESOURCE_IRQ, |
| 199 | } |
| 200 | }; |
| 201 | |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 202 | static u64 au1200_lcd_dmamask = ~(u32)0; |
| 203 | |
| 204 | static struct platform_device au1200_lcd_device = { |
| 205 | .name = "au1200-lcd", |
| 206 | .id = 0, |
| 207 | .dev = { |
| 208 | .dma_mask = &au1200_lcd_dmamask, |
| 209 | .coherent_dma_mask = 0xffffffff, |
| 210 | }, |
| 211 | .num_resources = ARRAY_SIZE(au1200_lcd_resources), |
| 212 | .resource = au1200_lcd_resources, |
| 213 | }; |
Pete Popov | 26a940e | 2005-09-15 08:03:12 +0000 | [diff] [blame] | 214 | |
| 215 | |
| 216 | static u64 ide0_dmamask = ~(u32)0; |
| 217 | |
| 218 | static struct platform_device au1200_ide0_device = { |
| 219 | .name = "au1200-ide", |
| 220 | .id = 0, |
| 221 | .dev = { |
| 222 | .dma_mask = &ide0_dmamask, |
| 223 | .coherent_dma_mask = 0xffffffff, |
| 224 | }, |
| 225 | .num_resources = ARRAY_SIZE(au1200_ide0_resources), |
| 226 | .resource = au1200_ide0_resources, |
| 227 | }; |
| 228 | |
Pete Popov | ba264b3 | 2005-09-21 06:18:27 +0000 | [diff] [blame] | 229 | static u64 au1xxx_mmc_dmamask = ~(u32)0; |
| 230 | |
| 231 | static struct platform_device au1xxx_mmc_device = { |
| 232 | .name = "au1xxx-mmc", |
| 233 | .id = 0, |
| 234 | .dev = { |
| 235 | .dma_mask = &au1xxx_mmc_dmamask, |
| 236 | .coherent_dma_mask = 0xffffffff, |
| 237 | }, |
| 238 | .num_resources = ARRAY_SIZE(au1xxx_mmc_resources), |
| 239 | .resource = au1xxx_mmc_resources, |
| 240 | }; |
| 241 | #endif /* #ifdef CONFIG_SOC_AU1200 */ |
| 242 | |
Pete Popov | efe29c0 | 2005-09-15 23:42:27 +0000 | [diff] [blame] | 243 | static struct platform_device au1x00_pcmcia_device = { |
| 244 | .name = "au1x00-pcmcia", |
| 245 | .id = 0, |
| 246 | }; |
| 247 | |
Pete Popov | 0c9ec46 | 2005-09-21 21:39:44 +0000 | [diff] [blame] | 248 | #ifdef CONFIG_MIPS_DB1200 |
| 249 | |
| 250 | static struct resource smc91x_resources[] = { |
| 251 | [0] = { |
| 252 | .name = "smc91x-regs", |
| 253 | .start = AU1XXX_SMC91111_PHYS_ADDR, |
| 254 | .end = AU1XXX_SMC91111_PHYS_ADDR + 0xfffff, |
| 255 | .flags = IORESOURCE_MEM, |
| 256 | }, |
| 257 | [1] = { |
| 258 | .start = AU1XXX_SMC91111_IRQ, |
| 259 | .end = AU1XXX_SMC91111_IRQ, |
| 260 | .flags = IORESOURCE_IRQ, |
| 261 | }, |
| 262 | }; |
| 263 | |
| 264 | static struct platform_device smc91x_device = { |
| 265 | .name = "smc91x", |
Ralf Baechle | a3dddd5 | 2006-03-11 08:18:41 +0000 | [diff] [blame] | 266 | .id = -1, |
Pete Popov | 0c9ec46 | 2005-09-21 21:39:44 +0000 | [diff] [blame] | 267 | .num_resources = ARRAY_SIZE(smc91x_resources), |
| 268 | .resource = smc91x_resources, |
| 269 | }; |
| 270 | |
| 271 | #endif |
| 272 | |
Manuel Lauss | 8b798c4 | 2008-01-27 18:14:52 +0100 | [diff] [blame^] | 273 | /* All Alchemy demoboards with I2C have this #define in their headers */ |
| 274 | #ifdef SMBUS_PSC_BASE |
| 275 | static struct resource pbdb_smbus_resources[] = { |
| 276 | { |
| 277 | .start = SMBUS_PSC_BASE, |
| 278 | .end = SMBUS_PSC_BASE + 0x24 - 1, |
| 279 | .flags = IORESOURCE_MEM, |
| 280 | }, |
| 281 | }; |
| 282 | |
| 283 | static struct platform_device pbdb_smbus_device = { |
| 284 | .name = "au1xpsc_smbus", |
| 285 | .id = 0, /* bus number */ |
| 286 | .num_resources = ARRAY_SIZE(pbdb_smbus_resources), |
| 287 | .resource = pbdb_smbus_resources, |
| 288 | }; |
| 289 | #endif |
| 290 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 291 | static struct platform_device *au1xxx_platform_devices[] __initdata = { |
| 292 | &au1xxx_usb_ohci_device, |
Pete Popov | efe29c0 | 2005-09-15 23:42:27 +0000 | [diff] [blame] | 293 | &au1x00_pcmcia_device, |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 294 | #ifdef CONFIG_FB_AU1100 |
| 295 | &au1100_lcd_device, |
| 296 | #endif |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 297 | #ifdef CONFIG_SOC_AU1200 |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 298 | &au1xxx_usb_ehci_device, |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 299 | &au1xxx_usb_gdt_device, |
| 300 | &au1xxx_usb_otg_device, |
| 301 | &au1200_lcd_device, |
Pete Popov | 26a940e | 2005-09-15 08:03:12 +0000 | [diff] [blame] | 302 | &au1200_ide0_device, |
Pete Popov | ba264b3 | 2005-09-21 06:18:27 +0000 | [diff] [blame] | 303 | &au1xxx_mmc_device, |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 304 | #endif |
Pete Popov | 0c9ec46 | 2005-09-21 21:39:44 +0000 | [diff] [blame] | 305 | #ifdef CONFIG_MIPS_DB1200 |
Ralf Baechle | a3dddd5 | 2006-03-11 08:18:41 +0000 | [diff] [blame] | 306 | &smc91x_device, |
Pete Popov | 0c9ec46 | 2005-09-21 21:39:44 +0000 | [diff] [blame] | 307 | #endif |
Manuel Lauss | 8b798c4 | 2008-01-27 18:14:52 +0100 | [diff] [blame^] | 308 | #ifdef SMBUS_PSC_BASE |
| 309 | &pbdb_smbus_device, |
| 310 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | }; |
| 312 | |
Ralf Baechle | 070c7b8 | 2007-07-10 09:35:12 +0100 | [diff] [blame] | 313 | int __init au1xxx_platform_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | { |
| 315 | return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices)); |
| 316 | } |
| 317 | |
| 318 | arch_initcall(au1xxx_platform_init); |