lantiq: bump to 3.1
[openwrt.git] / target / linux / lantiq / files-3.1 / arch / mips / lantiq / xway / dev-dwc_otg.c
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
8  */
9
10 #include <linux/init.h>
11 #include <linux/module.h>
12 #include <linux/types.h>
13 #include <linux/string.h>
14 #include <linux/mtd/physmap.h>
15 #include <linux/kernel.h>
16 #include <linux/reboot.h>
17 #include <linux/platform_device.h>
18 #include <linux/leds.h>
19 #include <linux/etherdevice.h>
20 #include <linux/reboot.h>
21 #include <linux/time.h>
22 #include <linux/io.h>
23 #include <linux/gpio.h>
24 #include <linux/leds.h>
25
26 #include <asm/bootinfo.h>
27 #include <asm/irq.h>
28
29 #include <lantiq_soc.h>
30 #include <lantiq_irq.h>
31 #include <lantiq_platform.h>
32
33 #define LTQ_USB_IOMEM_BASE 0x1e101000
34 #define LTQ_USB_IOMEM_SIZE 0x00001000
35
36 static struct resource resources[] =
37 {
38         [0] = {
39                 .name    = "dwc_otg_membase",
40                 .start   = LTQ_USB_IOMEM_BASE,
41                 .end     = LTQ_USB_IOMEM_BASE + LTQ_USB_IOMEM_SIZE - 1,
42                 .flags   = IORESOURCE_MEM,
43         },
44         [1] = {
45                 .name    = "dwc_otg_irq",
46                 .start   = LTQ_USB_INT,
47                 .flags   = IORESOURCE_IRQ,
48         },
49 };
50
51 static u64 dwc_dmamask = (u32)0x1fffffff;
52
53 static struct platform_device platform_dev = {
54         .name = "dwc_otg",
55         .dev = {
56                 .dma_mask      = &dwc_dmamask,
57         },
58         .resource               = resources,
59         .num_resources          = ARRAY_SIZE(resources),
60 };
61
62 int __init
63 xway_register_dwc(int pin)
64 {
65         struct irq_data d;
66         d.irq = resources[1].start;
67         ltq_enable_irq(&d);
68         platform_dev.dev.platform_data = (void*) pin;
69         return platform_device_register(&platform_dev);
70 }