Merge tag 'sound-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[deliverable/linux.git] / arch / arm / mach-davinci / usb.c
CommitLineData
cece6e5a
DB
1/*
2 * USB
3 */
cece6e5a
DB
4#include <linux/init.h>
5#include <linux/platform_device.h>
6#include <linux/dma-mapping.h>
7
8#include <linux/usb/musb.h>
cece6e5a
DB
9
10#include <mach/common.h>
d0e58ae7 11#include <mach/irqs.h>
efd91181 12#include <mach/cputype.h>
ec2a0833 13#include <linux/platform_data/usb-davinci.h>
cece6e5a 14
e5d3d252 15#define DAVINCI_USB_OTG_BASE 0x01c64000
b0ea26e1 16
a0a56db9 17#if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
cece6e5a
DB
18static struct musb_hdrc_config musb_config = {
19 .multipoint = true,
cece6e5a
DB
20
21 .num_eps = 5,
cece6e5a 22 .ram_bits = 10,
cece6e5a
DB
23};
24
25static struct musb_hdrc_platform_data usb_data = {
cece6e5a
DB
26 /* OTG requires a Mini-AB connector */
27 .mode = MUSB_OTG,
34f32c97 28 .clock = "usb",
cece6e5a
DB
29 .config = &musb_config,
30};
31
32static struct resource usb_resources[] = {
33 {
34 /* physical address */
35 .start = DAVINCI_USB_OTG_BASE,
36 .end = DAVINCI_USB_OTG_BASE + 0x5ff,
37 .flags = IORESOURCE_MEM,
38 },
39 {
40 .start = IRQ_USBINT,
41 .flags = IORESOURCE_IRQ,
fcf173e4 42 .name = "mc"
cece6e5a 43 },
efd91181
SS
44 {
45 /* placeholder for the dedicated CPPI IRQ */
46 .flags = IORESOURCE_IRQ,
fcf173e4 47 .name = "dma"
efd91181 48 },
cece6e5a
DB
49};
50
284901a9 51static u64 usb_dmamask = DMA_BIT_MASK(32);
cece6e5a
DB
52
53static struct platform_device usb_dev = {
73b089b0 54 .name = "musb-davinci",
cece6e5a
DB
55 .id = -1,
56 .dev = {
57 .platform_data = &usb_data,
58 .dma_mask = &usb_dmamask,
284901a9 59 .coherent_dma_mask = DMA_BIT_MASK(32),
cece6e5a
DB
60 },
61 .resource = usb_resources,
62 .num_resources = ARRAY_SIZE(usb_resources),
63};
64
355fb4e3 65void __init davinci_setup_usb(unsigned mA, unsigned potpgt_ms)
cece6e5a 66{
355fb4e3
SS
67 usb_data.power = mA > 510 ? 255 : mA / 2;
68 usb_data.potpgt = (potpgt_ms + 1) / 2;
efd91181
SS
69
70 if (cpu_is_davinci_dm646x()) {
71 /* Override the defaults as DM6467 uses different IRQs. */
72 usb_dev.resource[1].start = IRQ_DM646X_USBINT;
73 usb_dev.resource[2].start = IRQ_DM646X_USBDMAINT;
74 } else /* other devices don't have dedicated CPPI IRQ */
75 usb_dev.num_resources = 2;
76
cece6e5a
DB
77 platform_device_register(&usb_dev);
78}
79
80#else
81
355fb4e3 82void __init davinci_setup_usb(unsigned mA, unsigned potpgt_ms)
cece6e5a
DB
83{
84}
85
86#endif /* CONFIG_USB_MUSB_HDRC */
This page took 0.411851 seconds and 5 git commands to generate.