usb: musb: Add extvbus in musb_board_data
[linux-2.6.git] / arch / arm / mach-omap2 / usb-musb.c
blob96f6787e00b25071294d26f8659cc5afded6d6db
1 /*
2 * linux/arch/arm/mach-omap2/usb-musb.c
4 * This file will contain the board specific details for the
5 * MENTOR USB OTG controller on OMAP3430
7 * Copyright (C) 2007-2008 Texas Instruments
8 * Copyright (C) 2008 Nokia Corporation
9 * Author: Vikram Pandita
11 * Generalization by:
12 * Felipe Balbi <felipe.balbi@nokia.com>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
19 #include <linux/types.h>
20 #include <linux/errno.h>
21 #include <linux/delay.h>
22 #include <linux/platform_device.h>
23 #include <linux/clk.h>
24 #include <linux/dma-mapping.h>
25 #include <linux/io.h>
27 #include <linux/usb/musb.h>
29 #include <mach/hardware.h>
30 #include <mach/irqs.h>
31 #include <plat/mux.h>
32 #include <plat/usb.h>
34 #ifdef CONFIG_USB_MUSB_SOC
36 static struct resource musb_resources[] = {
37 [0] = { /* start and end set dynamically */
38 .flags = IORESOURCE_MEM,
40 [1] = { /* general IRQ */
41 .start = INT_243X_HS_USB_MC,
42 .flags = IORESOURCE_IRQ,
44 [2] = { /* DMA IRQ */
45 .start = INT_243X_HS_USB_DMA,
46 .flags = IORESOURCE_IRQ,
50 static struct musb_hdrc_config musb_config = {
51 .multipoint = 1,
52 .dyn_fifo = 1,
53 .num_eps = 16,
54 .ram_bits = 12,
57 static struct musb_hdrc_platform_data musb_plat = {
58 #ifdef CONFIG_USB_MUSB_OTG
59 .mode = MUSB_OTG,
60 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
61 .mode = MUSB_HOST,
62 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
63 .mode = MUSB_PERIPHERAL,
64 #endif
65 /* .clock is set dynamically */
66 .config = &musb_config,
68 /* REVISIT charge pump on TWL4030 can supply up to
69 * 100 mA ... but this value is board-specific, like
70 * "mode", and should be passed to usb_musb_init().
72 .power = 50, /* up to 100 mA */
75 static u64 musb_dmamask = DMA_BIT_MASK(32);
77 static struct platform_device musb_device = {
78 .name = "musb_hdrc",
79 .id = -1,
80 .dev = {
81 .dma_mask = &musb_dmamask,
82 .coherent_dma_mask = DMA_BIT_MASK(32),
83 .platform_data = &musb_plat,
85 .num_resources = ARRAY_SIZE(musb_resources),
86 .resource = musb_resources,
89 void __init usb_musb_init(struct omap_musb_board_data *board_data)
91 if (cpu_is_omap243x()) {
92 musb_resources[0].start = OMAP243X_HS_BASE;
93 } else if (cpu_is_omap34xx()) {
94 musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE;
95 } else if (cpu_is_omap44xx()) {
96 musb_resources[0].start = OMAP44XX_HSUSB_OTG_BASE;
97 musb_resources[1].start = OMAP44XX_IRQ_HS_USB_MC_N;
98 musb_resources[2].start = OMAP44XX_IRQ_HS_USB_DMA_N;
100 musb_resources[0].end = musb_resources[0].start + SZ_4K - 1;
103 * REVISIT: This line can be removed once all the platforms using
104 * musb_core.c have been converted to use use clkdev.
106 musb_plat.clock = "ick";
107 musb_plat.board_data = board_data;
108 musb_plat.power = board_data->power >> 1;
109 musb_plat.mode = board_data->mode;
110 musb_plat.extvbus = board_data->extvbus;
112 if (platform_device_register(&musb_device) < 0)
113 printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n");
116 #else
117 void __init usb_musb_init(struct omap_musb_board_data *board_data)
120 #endif /* CONFIG_USB_MUSB_SOC */