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 | * |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 6 | * (C) Copyright Embedded Alley Solutions, Inc 2005 |
| 7 | * Author: Pantelis Antoniou <pantelis@embeddedalley.com> |
| 8 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * This file is licensed under the terms of the GNU General Public |
| 10 | * License version 2. This program is licensed "as is" without any |
| 11 | * warranty of any kind, whether express or implied. |
| 12 | */ |
Sergei Shtylyov | ce28f94 | 2008-04-23 22:43:55 +0400 | [diff] [blame] | 13 | |
Ralf Baechle | 4b62220 | 2008-07-15 18:44:29 +0100 | [diff] [blame] | 14 | #include <linux/dma-mapping.h> |
Russell King | d052d1b | 2005-10-29 19:07:23 +0100 | [diff] [blame] | 15 | #include <linux/platform_device.h> |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 16 | #include <linux/serial_8250.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | |
Pete Popov | 26a940e | 2005-09-15 08:03:12 +0000 | [diff] [blame] | 19 | #include <asm/mach-au1x00/au1xxx.h> |
Manuel Lauss | f591eb1 | 2008-10-21 08:59:14 +0200 | [diff] [blame] | 20 | #include <asm/mach-au1x00/au1xxx_dbdma.h> |
| 21 | #include <asm/mach-au1x00/au1100_mmc.h> |
Florian Fainelli | 66f75cc | 2009-11-10 01:13:30 +0100 | [diff] [blame] | 22 | #include <asm/mach-au1x00/au1xxx_eth.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
Manuel Lauss | b6e6d12 | 2009-10-15 19:07:34 +0200 | [diff] [blame] | 24 | #define PORT(_base, _irq) \ |
| 25 | { \ |
| 26 | .mapbase = _base, \ |
| 27 | .irq = _irq, \ |
| 28 | .regshift = 2, \ |
| 29 | .iotype = UPIO_AU, \ |
Manuel Lauss | 63ea336 | 2009-10-28 21:49:46 +0100 | [diff] [blame] | 30 | .flags = UPF_SKIP_TEST | UPF_IOREMAP | \ |
| 31 | UPF_FIXED_TYPE, \ |
| 32 | .type = PORT_16550A, \ |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | static struct plat_serial8250_port au1x00_uart_data[] = { |
| 36 | #if defined(CONFIG_SERIAL_8250_AU1X00) |
| 37 | #if defined(CONFIG_SOC_AU1000) |
Manuel Lauss | b6e6d12 | 2009-10-15 19:07:34 +0200 | [diff] [blame] | 38 | PORT(UART0_PHYS_ADDR, AU1000_UART0_INT), |
| 39 | PORT(UART1_PHYS_ADDR, AU1000_UART1_INT), |
| 40 | PORT(UART2_PHYS_ADDR, AU1000_UART2_INT), |
| 41 | PORT(UART3_PHYS_ADDR, AU1000_UART3_INT), |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 42 | #elif defined(CONFIG_SOC_AU1500) |
Manuel Lauss | b6e6d12 | 2009-10-15 19:07:34 +0200 | [diff] [blame] | 43 | PORT(UART0_PHYS_ADDR, AU1500_UART0_INT), |
| 44 | PORT(UART3_PHYS_ADDR, AU1500_UART3_INT), |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 45 | #elif defined(CONFIG_SOC_AU1100) |
Manuel Lauss | b6e6d12 | 2009-10-15 19:07:34 +0200 | [diff] [blame] | 46 | PORT(UART0_PHYS_ADDR, AU1100_UART0_INT), |
| 47 | PORT(UART1_PHYS_ADDR, AU1100_UART1_INT), |
| 48 | PORT(UART3_PHYS_ADDR, AU1100_UART3_INT), |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 49 | #elif defined(CONFIG_SOC_AU1550) |
Manuel Lauss | b6e6d12 | 2009-10-15 19:07:34 +0200 | [diff] [blame] | 50 | PORT(UART0_PHYS_ADDR, AU1550_UART0_INT), |
| 51 | PORT(UART1_PHYS_ADDR, AU1550_UART1_INT), |
| 52 | PORT(UART3_PHYS_ADDR, AU1550_UART3_INT), |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 53 | #elif defined(CONFIG_SOC_AU1200) |
Manuel Lauss | b6e6d12 | 2009-10-15 19:07:34 +0200 | [diff] [blame] | 54 | PORT(UART0_PHYS_ADDR, AU1200_UART0_INT), |
| 55 | PORT(UART1_PHYS_ADDR, AU1200_UART1_INT), |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 56 | #endif |
| 57 | #endif /* CONFIG_SERIAL_8250_AU1X00 */ |
| 58 | { }, |
| 59 | }; |
| 60 | |
| 61 | static struct platform_device au1xx0_uart_device = { |
| 62 | .name = "serial8250", |
| 63 | .id = PLAT8250_DEV_AU1X00, |
| 64 | .dev = { |
| 65 | .platform_data = au1x00_uart_data, |
| 66 | }, |
| 67 | }; |
| 68 | |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 69 | /* OHCI (USB full speed host controller) */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | static struct resource au1xxx_usb_ohci_resources[] = { |
| 71 | [0] = { |
| 72 | .start = USB_OHCI_BASE, |
Jordan Crouse | d5fb7f1 | 2006-01-20 14:09:54 -0800 | [diff] [blame] | 73 | .end = USB_OHCI_BASE + USB_OHCI_LEN - 1, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 74 | .flags = IORESOURCE_MEM, |
| 75 | }, |
| 76 | [1] = { |
Manuel Lauss | 7881446 | 2009-10-07 20:15:15 +0200 | [diff] [blame] | 77 | .start = FOR_PLATFORM_C_USB_HOST_INT, |
| 78 | .end = FOR_PLATFORM_C_USB_HOST_INT, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | .flags = IORESOURCE_IRQ, |
| 80 | }, |
| 81 | }; |
| 82 | |
| 83 | /* The dmamask must be set for OHCI to work */ |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 84 | static u64 ohci_dmamask = DMA_BIT_MASK(32); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | |
| 86 | static struct platform_device au1xxx_usb_ohci_device = { |
| 87 | .name = "au1xxx-ohci", |
| 88 | .id = 0, |
| 89 | .dev = { |
| 90 | .dma_mask = &ohci_dmamask, |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 91 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | }, |
| 93 | .num_resources = ARRAY_SIZE(au1xxx_usb_ohci_resources), |
| 94 | .resource = au1xxx_usb_ohci_resources, |
| 95 | }; |
| 96 | |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 97 | /*** AU1100 LCD controller ***/ |
| 98 | |
| 99 | #ifdef CONFIG_FB_AU1100 |
| 100 | static struct resource au1100_lcd_resources[] = { |
| 101 | [0] = { |
| 102 | .start = LCD_PHYS_ADDR, |
| 103 | .end = LCD_PHYS_ADDR + 0x800 - 1, |
| 104 | .flags = IORESOURCE_MEM, |
| 105 | }, |
| 106 | [1] = { |
| 107 | .start = AU1100_LCD_INT, |
| 108 | .end = AU1100_LCD_INT, |
| 109 | .flags = IORESOURCE_IRQ, |
| 110 | } |
| 111 | }; |
| 112 | |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 113 | static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32); |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 114 | |
| 115 | static struct platform_device au1100_lcd_device = { |
| 116 | .name = "au1100-lcd", |
| 117 | .id = 0, |
| 118 | .dev = { |
| 119 | .dma_mask = &au1100_lcd_dmamask, |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 120 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 121 | }, |
| 122 | .num_resources = ARRAY_SIZE(au1100_lcd_resources), |
| 123 | .resource = au1100_lcd_resources, |
| 124 | }; |
| 125 | #endif |
| 126 | |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 127 | #ifdef CONFIG_SOC_AU1200 |
| 128 | /* EHCI (USB high speed host controller) */ |
| 129 | static struct resource au1xxx_usb_ehci_resources[] = { |
| 130 | [0] = { |
| 131 | .start = USB_EHCI_BASE, |
| 132 | .end = USB_EHCI_BASE + USB_EHCI_LEN - 1, |
| 133 | .flags = IORESOURCE_MEM, |
| 134 | }, |
| 135 | [1] = { |
Manuel Lauss | 7881446 | 2009-10-07 20:15:15 +0200 | [diff] [blame] | 136 | .start = AU1200_USB_INT, |
| 137 | .end = AU1200_USB_INT, |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 138 | .flags = IORESOURCE_IRQ, |
| 139 | }, |
| 140 | }; |
| 141 | |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 142 | static u64 ehci_dmamask = DMA_BIT_MASK(32); |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 143 | |
| 144 | static struct platform_device au1xxx_usb_ehci_device = { |
| 145 | .name = "au1xxx-ehci", |
| 146 | .id = 0, |
| 147 | .dev = { |
| 148 | .dma_mask = &ehci_dmamask, |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 149 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 150 | }, |
| 151 | .num_resources = ARRAY_SIZE(au1xxx_usb_ehci_resources), |
| 152 | .resource = au1xxx_usb_ehci_resources, |
| 153 | }; |
| 154 | |
| 155 | /* Au1200 UDC (USB gadget controller) */ |
| 156 | static struct resource au1xxx_usb_gdt_resources[] = { |
| 157 | [0] = { |
| 158 | .start = USB_UDC_BASE, |
| 159 | .end = USB_UDC_BASE + USB_UDC_LEN - 1, |
| 160 | .flags = IORESOURCE_MEM, |
| 161 | }, |
| 162 | [1] = { |
| 163 | .start = AU1200_USB_INT, |
| 164 | .end = AU1200_USB_INT, |
| 165 | .flags = IORESOURCE_IRQ, |
| 166 | }, |
| 167 | }; |
| 168 | |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 169 | static u64 udc_dmamask = DMA_BIT_MASK(32); |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 170 | |
| 171 | static struct platform_device au1xxx_usb_gdt_device = { |
| 172 | .name = "au1xxx-udc", |
| 173 | .id = 0, |
| 174 | .dev = { |
| 175 | .dma_mask = &udc_dmamask, |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 176 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 177 | }, |
| 178 | .num_resources = ARRAY_SIZE(au1xxx_usb_gdt_resources), |
| 179 | .resource = au1xxx_usb_gdt_resources, |
| 180 | }; |
| 181 | |
| 182 | /* Au1200 UOC (USB OTG controller) */ |
| 183 | static struct resource au1xxx_usb_otg_resources[] = { |
| 184 | [0] = { |
| 185 | .start = USB_UOC_BASE, |
| 186 | .end = USB_UOC_BASE + USB_UOC_LEN - 1, |
| 187 | .flags = IORESOURCE_MEM, |
| 188 | }, |
| 189 | [1] = { |
| 190 | .start = AU1200_USB_INT, |
| 191 | .end = AU1200_USB_INT, |
| 192 | .flags = IORESOURCE_IRQ, |
| 193 | }, |
| 194 | }; |
| 195 | |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 196 | static u64 uoc_dmamask = DMA_BIT_MASK(32); |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 197 | |
| 198 | static struct platform_device au1xxx_usb_otg_device = { |
| 199 | .name = "au1xxx-uoc", |
| 200 | .id = 0, |
| 201 | .dev = { |
| 202 | .dma_mask = &uoc_dmamask, |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 203 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 204 | }, |
| 205 | .num_resources = ARRAY_SIZE(au1xxx_usb_otg_resources), |
| 206 | .resource = au1xxx_usb_otg_resources, |
| 207 | }; |
| 208 | |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 209 | static struct resource au1200_lcd_resources[] = { |
| 210 | [0] = { |
| 211 | .start = LCD_PHYS_ADDR, |
| 212 | .end = LCD_PHYS_ADDR + 0x800 - 1, |
| 213 | .flags = IORESOURCE_MEM, |
| 214 | }, |
| 215 | [1] = { |
| 216 | .start = AU1200_LCD_INT, |
| 217 | .end = AU1200_LCD_INT, |
| 218 | .flags = IORESOURCE_IRQ, |
| 219 | } |
| 220 | }; |
| 221 | |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 222 | static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32); |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 223 | |
| 224 | static struct platform_device au1200_lcd_device = { |
| 225 | .name = "au1200-lcd", |
| 226 | .id = 0, |
| 227 | .dev = { |
| 228 | .dma_mask = &au1200_lcd_dmamask, |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 229 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 230 | }, |
| 231 | .num_resources = ARRAY_SIZE(au1200_lcd_resources), |
| 232 | .resource = au1200_lcd_resources, |
| 233 | }; |
Pete Popov | 26a940e | 2005-09-15 08:03:12 +0000 | [diff] [blame] | 234 | |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 235 | static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32); |
Pete Popov | ba264b3 | 2005-09-21 06:18:27 +0000 | [diff] [blame] | 236 | |
Manuel Lauss | f591eb1 | 2008-10-21 08:59:14 +0200 | [diff] [blame] | 237 | extern struct au1xmmc_platform_data au1xmmc_platdata[2]; |
| 238 | |
| 239 | static struct resource au1200_mmc0_resources[] = { |
| 240 | [0] = { |
| 241 | .start = SD0_PHYS_ADDR, |
| 242 | .end = SD0_PHYS_ADDR + 0x7ffff, |
| 243 | .flags = IORESOURCE_MEM, |
| 244 | }, |
| 245 | [1] = { |
| 246 | .start = AU1200_SD_INT, |
| 247 | .end = AU1200_SD_INT, |
| 248 | .flags = IORESOURCE_IRQ, |
| 249 | }, |
| 250 | [2] = { |
| 251 | .start = DSCR_CMD0_SDMS_TX0, |
| 252 | .end = DSCR_CMD0_SDMS_TX0, |
| 253 | .flags = IORESOURCE_DMA, |
| 254 | }, |
| 255 | [3] = { |
| 256 | .start = DSCR_CMD0_SDMS_RX0, |
| 257 | .end = DSCR_CMD0_SDMS_RX0, |
| 258 | .flags = IORESOURCE_DMA, |
| 259 | } |
| 260 | }; |
| 261 | |
| 262 | static struct platform_device au1200_mmc0_device = { |
Pete Popov | ba264b3 | 2005-09-21 06:18:27 +0000 | [diff] [blame] | 263 | .name = "au1xxx-mmc", |
| 264 | .id = 0, |
| 265 | .dev = { |
Manuel Lauss | f591eb1 | 2008-10-21 08:59:14 +0200 | [diff] [blame] | 266 | .dma_mask = &au1xxx_mmc_dmamask, |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 267 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Manuel Lauss | f591eb1 | 2008-10-21 08:59:14 +0200 | [diff] [blame] | 268 | .platform_data = &au1xmmc_platdata[0], |
Pete Popov | ba264b3 | 2005-09-21 06:18:27 +0000 | [diff] [blame] | 269 | }, |
Manuel Lauss | f591eb1 | 2008-10-21 08:59:14 +0200 | [diff] [blame] | 270 | .num_resources = ARRAY_SIZE(au1200_mmc0_resources), |
| 271 | .resource = au1200_mmc0_resources, |
Pete Popov | ba264b3 | 2005-09-21 06:18:27 +0000 | [diff] [blame] | 272 | }; |
Manuel Lauss | f591eb1 | 2008-10-21 08:59:14 +0200 | [diff] [blame] | 273 | |
| 274 | #ifndef CONFIG_MIPS_DB1200 |
| 275 | static struct resource au1200_mmc1_resources[] = { |
| 276 | [0] = { |
| 277 | .start = SD1_PHYS_ADDR, |
| 278 | .end = SD1_PHYS_ADDR + 0x7ffff, |
| 279 | .flags = IORESOURCE_MEM, |
| 280 | }, |
| 281 | [1] = { |
| 282 | .start = AU1200_SD_INT, |
| 283 | .end = AU1200_SD_INT, |
| 284 | .flags = IORESOURCE_IRQ, |
| 285 | }, |
| 286 | [2] = { |
| 287 | .start = DSCR_CMD0_SDMS_TX1, |
| 288 | .end = DSCR_CMD0_SDMS_TX1, |
| 289 | .flags = IORESOURCE_DMA, |
| 290 | }, |
| 291 | [3] = { |
| 292 | .start = DSCR_CMD0_SDMS_RX1, |
| 293 | .end = DSCR_CMD0_SDMS_RX1, |
| 294 | .flags = IORESOURCE_DMA, |
| 295 | } |
| 296 | }; |
| 297 | |
| 298 | static struct platform_device au1200_mmc1_device = { |
| 299 | .name = "au1xxx-mmc", |
| 300 | .id = 1, |
| 301 | .dev = { |
| 302 | .dma_mask = &au1xxx_mmc_dmamask, |
Yang Hongyang | 284901a | 2009-04-06 19:01:15 -0700 | [diff] [blame] | 303 | .coherent_dma_mask = DMA_BIT_MASK(32), |
Manuel Lauss | f591eb1 | 2008-10-21 08:59:14 +0200 | [diff] [blame] | 304 | .platform_data = &au1xmmc_platdata[1], |
| 305 | }, |
| 306 | .num_resources = ARRAY_SIZE(au1200_mmc1_resources), |
| 307 | .resource = au1200_mmc1_resources, |
| 308 | }; |
| 309 | #endif /* #ifndef CONFIG_MIPS_DB1200 */ |
Pete Popov | ba264b3 | 2005-09-21 06:18:27 +0000 | [diff] [blame] | 310 | #endif /* #ifdef CONFIG_SOC_AU1200 */ |
| 311 | |
Manuel Lauss | 8b798c4 | 2008-01-27 18:14:52 +0100 | [diff] [blame] | 312 | /* All Alchemy demoboards with I2C have this #define in their headers */ |
| 313 | #ifdef SMBUS_PSC_BASE |
| 314 | static struct resource pbdb_smbus_resources[] = { |
| 315 | { |
Sergei Shtylyov | 8e07c2c | 2008-04-05 22:16:21 +0400 | [diff] [blame] | 316 | .start = CPHYSADDR(SMBUS_PSC_BASE), |
| 317 | .end = CPHYSADDR(SMBUS_PSC_BASE + 0xfffff), |
Manuel Lauss | 8b798c4 | 2008-01-27 18:14:52 +0100 | [diff] [blame] | 318 | .flags = IORESOURCE_MEM, |
| 319 | }, |
| 320 | }; |
| 321 | |
| 322 | static struct platform_device pbdb_smbus_device = { |
| 323 | .name = "au1xpsc_smbus", |
| 324 | .id = 0, /* bus number */ |
| 325 | .num_resources = ARRAY_SIZE(pbdb_smbus_resources), |
| 326 | .resource = pbdb_smbus_resources, |
| 327 | }; |
| 328 | #endif |
| 329 | |
Florian Fainelli | 66f75cc | 2009-11-10 01:13:30 +0100 | [diff] [blame] | 330 | /* Macro to help defining the Ethernet MAC resources */ |
| 331 | #define MAC_RES(_base, _enable, _irq) \ |
| 332 | { \ |
| 333 | .start = CPHYSADDR(_base), \ |
| 334 | .end = CPHYSADDR(_base + 0xffff), \ |
| 335 | .flags = IORESOURCE_MEM, \ |
| 336 | }, \ |
| 337 | { \ |
| 338 | .start = CPHYSADDR(_enable), \ |
| 339 | .end = CPHYSADDR(_enable + 0x3), \ |
| 340 | .flags = IORESOURCE_MEM, \ |
| 341 | }, \ |
| 342 | { \ |
| 343 | .start = _irq, \ |
| 344 | .end = _irq, \ |
| 345 | .flags = IORESOURCE_IRQ \ |
| 346 | } |
| 347 | |
| 348 | static struct resource au1xxx_eth0_resources[] = { |
| 349 | #if defined(CONFIG_SOC_AU1000) |
| 350 | MAC_RES(AU1000_ETH0_BASE, AU1000_MAC0_ENABLE, AU1000_MAC0_DMA_INT), |
| 351 | #elif defined(CONFIG_SOC_AU1100) |
| 352 | MAC_RES(AU1100_ETH0_BASE, AU1100_MAC0_ENABLE, AU1100_MAC0_DMA_INT), |
| 353 | #elif defined(CONFIG_SOC_AU1550) |
| 354 | MAC_RES(AU1550_ETH0_BASE, AU1550_MAC0_ENABLE, AU1550_MAC0_DMA_INT), |
| 355 | #elif defined(CONFIG_SOC_AU1500) |
| 356 | MAC_RES(AU1500_ETH0_BASE, AU1500_MAC0_ENABLE, AU1500_MAC0_DMA_INT), |
| 357 | #endif |
| 358 | }; |
| 359 | |
Florian Fainelli | 66f75cc | 2009-11-10 01:13:30 +0100 | [diff] [blame] | 360 | |
| 361 | static struct au1000_eth_platform_data au1xxx_eth0_platform_data = { |
| 362 | .phy1_search_mac0 = 1, |
| 363 | }; |
| 364 | |
| 365 | static struct platform_device au1xxx_eth0_device = { |
| 366 | .name = "au1000-eth", |
| 367 | .id = 0, |
| 368 | .num_resources = ARRAY_SIZE(au1xxx_eth0_resources), |
| 369 | .resource = au1xxx_eth0_resources, |
| 370 | .dev.platform_data = &au1xxx_eth0_platform_data, |
| 371 | }; |
| 372 | |
| 373 | #ifndef CONFIG_SOC_AU1100 |
Manuel Lauss | acc4d24 | 2010-02-26 17:22:02 +0100 | [diff] [blame] | 374 | static struct resource au1xxx_eth1_resources[] = { |
| 375 | #if defined(CONFIG_SOC_AU1000) |
| 376 | MAC_RES(AU1000_ETH1_BASE, AU1000_MAC1_ENABLE, AU1000_MAC1_DMA_INT), |
| 377 | #elif defined(CONFIG_SOC_AU1550) |
| 378 | MAC_RES(AU1550_ETH1_BASE, AU1550_MAC1_ENABLE, AU1550_MAC1_DMA_INT), |
| 379 | #elif defined(CONFIG_SOC_AU1500) |
| 380 | MAC_RES(AU1500_ETH1_BASE, AU1500_MAC1_ENABLE, AU1500_MAC1_DMA_INT), |
| 381 | #endif |
| 382 | }; |
| 383 | |
Florian Fainelli | 66f75cc | 2009-11-10 01:13:30 +0100 | [diff] [blame] | 384 | static struct au1000_eth_platform_data au1xxx_eth1_platform_data = { |
| 385 | .phy1_search_mac0 = 1, |
| 386 | }; |
| 387 | |
| 388 | static struct platform_device au1xxx_eth1_device = { |
| 389 | .name = "au1000-eth", |
| 390 | .id = 1, |
| 391 | .num_resources = ARRAY_SIZE(au1xxx_eth1_resources), |
| 392 | .resource = au1xxx_eth1_resources, |
| 393 | .dev.platform_data = &au1xxx_eth1_platform_data, |
| 394 | }; |
| 395 | #endif |
| 396 | |
| 397 | void __init au1xxx_override_eth_cfg(unsigned int port, |
| 398 | struct au1000_eth_platform_data *eth_data) |
| 399 | { |
| 400 | if (!eth_data || port > 1) |
| 401 | return; |
| 402 | |
| 403 | if (port == 0) |
| 404 | memcpy(&au1xxx_eth0_platform_data, eth_data, |
| 405 | sizeof(struct au1000_eth_platform_data)); |
| 406 | #ifndef CONFIG_SOC_AU1100 |
| 407 | else |
| 408 | memcpy(&au1xxx_eth1_platform_data, eth_data, |
| 409 | sizeof(struct au1000_eth_platform_data)); |
| 410 | #endif |
| 411 | } |
| 412 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | static struct platform_device *au1xxx_platform_devices[] __initdata = { |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 414 | &au1xx0_uart_device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 415 | &au1xxx_usb_ohci_device, |
Pete Popov | 3b495f2 | 2005-04-04 01:06:19 +0000 | [diff] [blame] | 416 | #ifdef CONFIG_FB_AU1100 |
| 417 | &au1100_lcd_device, |
| 418 | #endif |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 419 | #ifdef CONFIG_SOC_AU1200 |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 420 | &au1xxx_usb_ehci_device, |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 421 | &au1xxx_usb_gdt_device, |
| 422 | &au1xxx_usb_otg_device, |
| 423 | &au1200_lcd_device, |
Manuel Lauss | f591eb1 | 2008-10-21 08:59:14 +0200 | [diff] [blame] | 424 | &au1200_mmc0_device, |
| 425 | #ifndef CONFIG_MIPS_DB1200 |
| 426 | &au1200_mmc1_device, |
| 427 | #endif |
Pete Popov | 64abf64 | 2005-09-14 16:17:59 +0000 | [diff] [blame] | 428 | #endif |
Manuel Lauss | 8b798c4 | 2008-01-27 18:14:52 +0100 | [diff] [blame] | 429 | #ifdef SMBUS_PSC_BASE |
| 430 | &pbdb_smbus_device, |
| 431 | #endif |
Florian Fainelli | 66f75cc | 2009-11-10 01:13:30 +0100 | [diff] [blame] | 432 | &au1xxx_eth0_device, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | }; |
| 434 | |
Sergei Shtylyov | c1dcb14 | 2008-04-30 23:18:41 +0400 | [diff] [blame] | 435 | static int __init au1xxx_platform_init(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | { |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 437 | unsigned int uartclk = get_au1x00_uart_baud_base() * 16; |
Wolfgang Grandegger | 0d5977d | 2010-07-17 16:38:48 +0200 | [diff] [blame^] | 438 | int err, i; |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 439 | |
| 440 | /* Fill up uartclk. */ |
Sergei Shtylyov | c1dcb14 | 2008-04-30 23:18:41 +0400 | [diff] [blame] | 441 | for (i = 0; au1x00_uart_data[i].flags; i++) |
Sergei Shtylyov | 6e76645 | 2008-04-04 00:02:53 +0400 | [diff] [blame] | 442 | au1x00_uart_data[i].uartclk = uartclk; |
| 443 | |
Wolfgang Grandegger | 0d5977d | 2010-07-17 16:38:48 +0200 | [diff] [blame^] | 444 | err = platform_add_devices(au1xxx_platform_devices, |
| 445 | ARRAY_SIZE(au1xxx_platform_devices)); |
Florian Fainelli | 66f75cc | 2009-11-10 01:13:30 +0100 | [diff] [blame] | 446 | #ifndef CONFIG_SOC_AU1100 |
| 447 | /* Register second MAC if enabled in pinfunc */ |
Wolfgang Grandegger | 0d5977d | 2010-07-17 16:38:48 +0200 | [diff] [blame^] | 448 | if (!err && !(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2)) |
Florian Fainelli | 66f75cc | 2009-11-10 01:13:30 +0100 | [diff] [blame] | 449 | platform_device_register(&au1xxx_eth1_device); |
| 450 | #endif |
| 451 | |
Wolfgang Grandegger | 0d5977d | 2010-07-17 16:38:48 +0200 | [diff] [blame^] | 452 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 453 | } |
| 454 | |
| 455 | arch_initcall(au1xxx_platform_init); |