0c6a3e004dfea799e757a83e095cbd118cf13f2c
[openwrt/openwrt.git] / target / linux / ifxmips / files-2.6.33 / arch / mips / ifxmips / danube / devices.c
1 #include <linux/init.h>
2 #include <linux/module.h>
3 #include <linux/types.h>
4 #include <linux/string.h>
5 #include <linux/mtd/physmap.h>
6 #include <linux/kernel.h>
7 #include <linux/reboot.h>
8 #include <linux/platform_device.h>
9 #include <linux/leds.h>
10 #include <linux/etherdevice.h>
11 #include <linux/reboot.h>
12 #include <linux/time.h>
13 #include <linux/io.h>
14 #include <linux/gpio.h>
15 #include <linux/leds.h>
16
17 #include <asm/bootinfo.h>
18 #include <asm/irq.h>
19
20 #include <ifxmips.h>
21 #include <ifxmips_irq.h>
22
23 /* usb */
24 static struct resource dwc_usb_res[] =
25 {
26 {
27 .name = "dwc3884_membase",
28 .flags = IORESOURCE_MEM,
29 .start = 0x1E101000,
30 .end = 0x1E101FFF
31 },
32 {
33 .name = "dwc3884_irq",
34 .flags = IORESOURCE_IRQ,
35 .start = IFXMIPS_USB_INT,
36 }
37 };
38
39 static struct platform_device dwc_usb =
40 {
41 .name = "dwc3884-hcd",
42 .resource = dwc_usb_res,
43 .num_resources = ARRAY_SIZE(dwc_usb_res),
44 };
45
46 void __init
47 danube_register_usb(void)
48 {
49 platform_device_register(&dwc_usb);
50 }
51
52 /* ebu gpio */
53 static struct platform_device ifxmips_ebu_gpio =
54 {
55 .name = "ifxmips_ebu",
56 .num_resources = 1,
57 };
58
59 void __init
60 danube_register_ebu_gpio(struct resource *resource, u32 value)
61 {
62 ifxmips_ebu_gpio.resource = resource;
63 ifxmips_ebu_gpio.dev.platform_data = (void*)value;
64 platform_device_register(&ifxmips_ebu_gpio);
65 }
66
67 /* ethernet */
68 unsigned char ifxmips_ethaddr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
69 static struct resource danube_ethernet_resources =
70 {
71 .start = IFXMIPS_PPE32_BASE_ADDR,
72 .end = IFXMIPS_PPE32_BASE_ADDR + IFXMIPS_PPE32_SIZE - 1,
73 .flags = IORESOURCE_MEM,
74 };
75
76 static struct platform_device danube_ethernet =
77 {
78 .name = "danube_ethernet",
79 .resource = &danube_ethernet_resources,
80 .num_resources = 1,
81 .dev = {
82 .platform_data = ifxmips_ethaddr,
83 }
84 };
85
86 void __init
87 danube_register_ethernet(unsigned char *mac)
88 {
89 if(mac)
90 danube_ethernet.dev.platform_data = mac;
91 platform_device_register(&danube_ethernet);
92 }
93
94 /* pci */
95 extern int ifxmips_pci_external_clock;
96 extern int ifxmips_pci_req_mask;
97
98 void __init
99 danube_register_pci(int clock, int irq_mask)
100 {
101 ifxmips_pci_external_clock = clock;
102 if(irq_mask)
103 ifxmips_pci_req_mask = irq_mask;
104 }