2008-09-08 14:41:57 +08:00
|
|
|
/*
|
|
|
|
* USB
|
|
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/dma-mapping.h>
|
|
|
|
|
|
|
|
#include <linux/usb/musb.h>
|
|
|
|
|
|
|
|
#include <mach/common.h>
|
2009-01-19 00:29:10 +08:00
|
|
|
#include <mach/irqs.h>
|
2009-07-16 23:58:53 +08:00
|
|
|
#include <mach/cputype.h>
|
2012-08-24 21:11:34 +08:00
|
|
|
#include <linux/platform_data/usb-davinci.h>
|
2008-09-08 14:41:57 +08:00
|
|
|
|
2009-09-26 03:14:02 +08:00
|
|
|
#define DAVINCI_USB_OTG_BASE 0x01c64000
|
2009-10-31 03:49:44 +08:00
|
|
|
|
2013-04-01 15:13:44 +08:00
|
|
|
#if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
|
2008-09-08 14:41:57 +08:00
|
|
|
static struct musb_hdrc_config musb_config = {
|
|
|
|
.multipoint = true,
|
|
|
|
|
|
|
|
.num_eps = 5,
|
|
|
|
.ram_bits = 10,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct musb_hdrc_platform_data usb_data = {
|
|
|
|
/* OTG requires a Mini-AB connector */
|
|
|
|
.mode = MUSB_OTG,
|
2009-02-21 05:45:17 +08:00
|
|
|
.clock = "usb",
|
2008-09-08 14:41:57 +08:00
|
|
|
.config = &musb_config,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource usb_resources[] = {
|
|
|
|
{
|
|
|
|
/* physical address */
|
|
|
|
.start = DAVINCI_USB_OTG_BASE,
|
|
|
|
.end = DAVINCI_USB_OTG_BASE + 0x5ff,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.start = IRQ_USBINT,
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2010-09-30 00:26:39 +08:00
|
|
|
.name = "mc"
|
2008-09-08 14:41:57 +08:00
|
|
|
},
|
2009-07-16 23:58:53 +08:00
|
|
|
{
|
|
|
|
/* placeholder for the dedicated CPPI IRQ */
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2010-09-30 00:26:39 +08:00
|
|
|
.name = "dma"
|
2009-07-16 23:58:53 +08:00
|
|
|
},
|
2008-09-08 14:41:57 +08:00
|
|
|
};
|
|
|
|
|
2009-04-07 10:01:15 +08:00
|
|
|
static u64 usb_dmamask = DMA_BIT_MASK(32);
|
2008-09-08 14:41:57 +08:00
|
|
|
|
|
|
|
static struct platform_device usb_dev = {
|
2010-12-02 15:16:55 +08:00
|
|
|
.name = "musb-davinci",
|
2008-09-08 14:41:57 +08:00
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &usb_data,
|
|
|
|
.dma_mask = &usb_dmamask,
|
2009-04-07 10:01:15 +08:00
|
|
|
.coherent_dma_mask = DMA_BIT_MASK(32),
|
2008-09-08 14:41:57 +08:00
|
|
|
},
|
|
|
|
.resource = usb_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(usb_resources),
|
|
|
|
};
|
|
|
|
|
2009-10-31 03:46:14 +08:00
|
|
|
void __init davinci_setup_usb(unsigned mA, unsigned potpgt_ms)
|
2008-09-08 14:41:57 +08:00
|
|
|
{
|
2009-10-31 03:46:14 +08:00
|
|
|
usb_data.power = mA > 510 ? 255 : mA / 2;
|
|
|
|
usb_data.potpgt = (potpgt_ms + 1) / 2;
|
2009-07-16 23:58:53 +08:00
|
|
|
|
|
|
|
if (cpu_is_davinci_dm646x()) {
|
|
|
|
/* Override the defaults as DM6467 uses different IRQs. */
|
|
|
|
usb_dev.resource[1].start = IRQ_DM646X_USBINT;
|
|
|
|
usb_dev.resource[2].start = IRQ_DM646X_USBDMAINT;
|
|
|
|
} else /* other devices don't have dedicated CPPI IRQ */
|
|
|
|
usb_dev.num_resources = 2;
|
|
|
|
|
2008-09-08 14:41:57 +08:00
|
|
|
platform_device_register(&usb_dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
2009-10-31 03:46:14 +08:00
|
|
|
void __init davinci_setup_usb(unsigned mA, unsigned potpgt_ms)
|
2008-09-08 14:41:57 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CONFIG_USB_MUSB_HDRC */
|