ARM: DaVinci: usb setup
Declare the musb_hdrc platform device for DaVinci. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
This commit is contained in:
committed by
Kevin Hilman
parent
d395e6ad98
commit
cece6e5af2
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
# Common objects
|
# Common objects
|
||||||
obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \
|
obj-y := time.o irq.o clock.o serial.o io.o id.o psc.o \
|
||||||
gpio.o mux.o devices.o
|
gpio.o mux.o devices.o usb.o
|
||||||
|
|
||||||
# Board specific
|
# Board specific
|
||||||
obj-$(CONFIG_MACH_DAVINCI_EVM) += board-evm.o
|
obj-$(CONFIG_MACH_DAVINCI_EVM) += board-evm.o
|
||||||
|
@@ -16,4 +16,7 @@ struct sys_timer;
|
|||||||
|
|
||||||
extern struct sys_timer davinci_timer;
|
extern struct sys_timer davinci_timer;
|
||||||
|
|
||||||
|
/* parameters describe VBUS sourcing for host mode */
|
||||||
|
extern void setup_usb(unsigned mA, unsigned potpgt_msec);
|
||||||
|
|
||||||
#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
|
#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
|
||||||
|
116
arch/arm/mach-davinci/usb.c
Normal file
116
arch/arm/mach-davinci/usb.c
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
/*
|
||||||
|
* USB
|
||||||
|
*/
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <linux/init.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/dma-mapping.h>
|
||||||
|
|
||||||
|
#include <linux/usb/musb.h>
|
||||||
|
#include <linux/usb/otg.h>
|
||||||
|
|
||||||
|
#include <mach/common.h>
|
||||||
|
#include <mach/hardware.h>
|
||||||
|
|
||||||
|
#if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE)
|
||||||
|
static struct musb_hdrc_eps_bits musb_eps[] = {
|
||||||
|
{ "ep1_tx", 8, },
|
||||||
|
{ "ep1_rx", 8, },
|
||||||
|
{ "ep2_tx", 8, },
|
||||||
|
{ "ep2_rx", 8, },
|
||||||
|
{ "ep3_tx", 5, },
|
||||||
|
{ "ep3_rx", 5, },
|
||||||
|
{ "ep4_tx", 5, },
|
||||||
|
{ "ep4_rx", 5, },
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct musb_hdrc_config musb_config = {
|
||||||
|
.multipoint = true,
|
||||||
|
.dyn_fifo = true,
|
||||||
|
.soft_con = true,
|
||||||
|
.dma = true,
|
||||||
|
|
||||||
|
.num_eps = 5,
|
||||||
|
.dma_channels = 8,
|
||||||
|
.ram_bits = 10,
|
||||||
|
.eps_bits = musb_eps,
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct musb_hdrc_platform_data usb_data = {
|
||||||
|
#if defined(CONFIG_USB_MUSB_OTG)
|
||||||
|
/* OTG requires a Mini-AB connector */
|
||||||
|
.mode = MUSB_OTG,
|
||||||
|
#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
|
||||||
|
.mode = MUSB_PERIPHERAL,
|
||||||
|
#elif defined(CONFIG_USB_MUSB_HOST)
|
||||||
|
.mode = MUSB_HOST,
|
||||||
|
#endif
|
||||||
|
.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,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static u64 usb_dmamask = DMA_32BIT_MASK;
|
||||||
|
|
||||||
|
static struct platform_device usb_dev = {
|
||||||
|
.name = "musb_hdrc",
|
||||||
|
.id = -1,
|
||||||
|
.dev = {
|
||||||
|
.platform_data = &usb_data,
|
||||||
|
.dma_mask = &usb_dmamask,
|
||||||
|
.coherent_dma_mask = DMA_32BIT_MASK,
|
||||||
|
},
|
||||||
|
.resource = usb_resources,
|
||||||
|
.num_resources = ARRAY_SIZE(usb_resources),
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef CONFIG_USB_MUSB_OTG
|
||||||
|
|
||||||
|
static struct otg_transceiver *xceiv;
|
||||||
|
|
||||||
|
struct otg_transceiver *otg_get_transceiver(void)
|
||||||
|
{
|
||||||
|
if (xceiv)
|
||||||
|
get_device(xceiv->dev);
|
||||||
|
return xceiv;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(otg_get_transceiver);
|
||||||
|
|
||||||
|
int otg_set_transceiver(struct otg_transceiver *x)
|
||||||
|
{
|
||||||
|
if (xceiv && x)
|
||||||
|
return -EBUSY;
|
||||||
|
xceiv = x;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(otg_set_transceiver);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void __init setup_usb(unsigned mA, unsigned potpgt_msec)
|
||||||
|
{
|
||||||
|
usb_data.power = mA / 2;
|
||||||
|
usb_data.potpgt = potpgt_msec / 2;
|
||||||
|
platform_device_register(&usb_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
void __init setup_usb(unsigned mA, unsigned potpgt_msec)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* CONFIG_USB_MUSB_HDRC */
|
||||||
|
|
Reference in New Issue
Block a user