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