Au1100 FB driver uplift for 2.6.
[linux-2.6.git] / arch / mips / au1000 / common / platform.c
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>
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/resource.h>
14
15 #include <asm/mach-au1x00/au1000.h>
16
17 static struct resource au1xxx_usb_ohci_resources[] = {
18         [0] = {
19                 .start          = USB_OHCI_BASE,
20                 .end            = USB_OHCI_BASE + USB_OHCI_LEN,
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
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
74
75 static struct platform_device *au1xxx_platform_devices[] __initdata = {
76         &au1xxx_usb_ohci_device,
77 #ifdef CONFIG_FB_AU1100
78         &au1100_lcd_device,
79 #endif
80 };
81
82 int au1xxx_platform_init(void)
83 {
84         return platform_add_devices(au1xxx_platform_devices, ARRAY_SIZE(au1xxx_platform_devices));
85 }
86
87 arch_initcall(au1xxx_platform_init);