davinci: DA8xx: CFGCHIP2 register definitions
[deliverable/linux.git] / arch / arm / mach-davinci / usb.c
CommitLineData
cece6e5a
DB
1/*
2 * USB
3 */
4#include <linux/kernel.h>
5#include <linux/module.h>
6#include <linux/init.h>
7#include <linux/platform_device.h>
8#include <linux/dma-mapping.h>
9
10#include <linux/usb/musb.h>
11#include <linux/usb/otg.h>
12
13#include <mach/common.h>
14#include <mach/hardware.h>
d0e58ae7 15#include <mach/irqs.h>
efd91181 16#include <mach/cputype.h>
cece6e5a 17
f5c122da
KH
18#define DAVINCI_USB_OTG_BASE 0x01C64000
19
cece6e5a
DB
20#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
21static struct musb_hdrc_eps_bits musb_eps[] = {
22 { "ep1_tx", 8, },
23 { "ep1_rx", 8, },
24 { "ep2_tx", 8, },
25 { "ep2_rx", 8, },
26 { "ep3_tx", 5, },
27 { "ep3_rx", 5, },
28 { "ep4_tx", 5, },
29 { "ep4_rx", 5, },
30};
31
32static struct musb_hdrc_config musb_config = {
33 .multipoint = true,
34 .dyn_fifo = true,
35 .soft_con = true,
36 .dma = true,
37
38 .num_eps = 5,
39 .dma_channels = 8,
40 .ram_bits = 10,
41 .eps_bits = musb_eps,
42};
43
44static struct musb_hdrc_platform_data usb_data = {
45#if defined(CONFIG_USB_MUSB_OTG)
46 /* OTG requires a Mini-AB connector */
47 .mode = MUSB_OTG,
48#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
49 .mode = MUSB_PERIPHERAL,
50#elif defined(CONFIG_USB_MUSB_HOST)
51 .mode = MUSB_HOST,
52#endif
34f32c97 53 .clock = "usb",
cece6e5a
DB
54 .config = &musb_config,
55};
56
57static struct resource usb_resources[] = {
58 {
59 /* physical address */
60 .start = DAVINCI_USB_OTG_BASE,
61 .end = DAVINCI_USB_OTG_BASE + 0x5ff,
62 .flags = IORESOURCE_MEM,
63 },
64 {
65 .start = IRQ_USBINT,
66 .flags = IORESOURCE_IRQ,
67 },
efd91181
SS
68 {
69 /* placeholder for the dedicated CPPI IRQ */
70 .flags = IORESOURCE_IRQ,
71 },
cece6e5a
DB
72};
73
284901a9 74static u64 usb_dmamask = DMA_BIT_MASK(32);
cece6e5a
DB
75
76static struct platform_device usb_dev = {
77 .name = "musb_hdrc",
78 .id = -1,
79 .dev = {
80 .platform_data = &usb_data,
81 .dma_mask = &usb_dmamask,
284901a9 82 .coherent_dma_mask = DMA_BIT_MASK(32),
cece6e5a
DB
83 },
84 .resource = usb_resources,
85 .num_resources = ARRAY_SIZE(usb_resources),
86};
87
cece6e5a
DB
88void __init setup_usb(unsigned mA, unsigned potpgt_msec)
89{
90 usb_data.power = mA / 2;
91 usb_data.potpgt = potpgt_msec / 2;
efd91181
SS
92
93 if (cpu_is_davinci_dm646x()) {
94 /* Override the defaults as DM6467 uses different IRQs. */
95 usb_dev.resource[1].start = IRQ_DM646X_USBINT;
96 usb_dev.resource[2].start = IRQ_DM646X_USBDMAINT;
97 } else /* other devices don't have dedicated CPPI IRQ */
98 usb_dev.num_resources = 2;
99
cece6e5a
DB
100 platform_device_register(&usb_dev);
101}
102
103#else
104
105void __init setup_usb(unsigned mA, unsigned potpgt_msec)
106{
107}
108
109#endif /* CONFIG_USB_MUSB_HDRC */
110
This page took 0.101996 seconds and 5 git commands to generate.