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