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
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>
27 #include <linux/usb/musb.h>
29 #include <mach/hardware.h>
30 #include <mach/irqs.h>
31 #include <mach/am35xx.h>
35 #if defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined (CONFIG_USB_MUSB_AM35X)
37 static struct resource musb_resources
[] = {
38 [0] = { /* start and end set dynamically */
39 .flags
= IORESOURCE_MEM
,
41 [1] = { /* general IRQ */
42 .start
= INT_243X_HS_USB_MC
,
43 .flags
= IORESOURCE_IRQ
,
47 .start
= INT_243X_HS_USB_DMA
,
48 .flags
= IORESOURCE_IRQ
,
53 static struct musb_hdrc_config musb_config
= {
60 static struct musb_hdrc_platform_data musb_plat
= {
61 #ifdef CONFIG_USB_MUSB_OTG
63 #elif defined(CONFIG_USB_MUSB_HDRC_HCD)
65 #elif defined(CONFIG_USB_GADGET_MUSB_HDRC)
66 .mode
= MUSB_PERIPHERAL
,
68 /* .clock is set dynamically */
69 .config
= &musb_config
,
71 /* REVISIT charge pump on TWL4030 can supply up to
72 * 100 mA ... but this value is board-specific, like
73 * "mode", and should be passed to usb_musb_init().
75 .power
= 50, /* up to 100 mA */
78 static u64 musb_dmamask
= DMA_BIT_MASK(32);
80 static struct platform_device musb_device
= {
81 .name
= "musb-omap2430",
84 .dma_mask
= &musb_dmamask
,
85 .coherent_dma_mask
= DMA_BIT_MASK(32),
86 .platform_data
= &musb_plat
,
88 .num_resources
= ARRAY_SIZE(musb_resources
),
89 .resource
= musb_resources
,
92 static void usb_musb_mux_init(struct omap_musb_board_data
*board_data
)
94 switch (board_data
->interface_type
) {
95 case MUSB_INTERFACE_UTMI
:
96 omap_mux_init_signal("usba0_otg_dp", OMAP_PIN_INPUT
);
97 omap_mux_init_signal("usba0_otg_dm", OMAP_PIN_INPUT
);
99 case MUSB_INTERFACE_ULPI
:
100 omap_mux_init_signal("usba0_ulpiphy_clk",
101 OMAP_PIN_INPUT_PULLDOWN
);
102 omap_mux_init_signal("usba0_ulpiphy_stp",
103 OMAP_PIN_INPUT_PULLDOWN
);
104 omap_mux_init_signal("usba0_ulpiphy_dir",
105 OMAP_PIN_INPUT_PULLDOWN
);
106 omap_mux_init_signal("usba0_ulpiphy_nxt",
107 OMAP_PIN_INPUT_PULLDOWN
);
108 omap_mux_init_signal("usba0_ulpiphy_dat0",
109 OMAP_PIN_INPUT_PULLDOWN
);
110 omap_mux_init_signal("usba0_ulpiphy_dat1",
111 OMAP_PIN_INPUT_PULLDOWN
);
112 omap_mux_init_signal("usba0_ulpiphy_dat2",
113 OMAP_PIN_INPUT_PULLDOWN
);
114 omap_mux_init_signal("usba0_ulpiphy_dat3",
115 OMAP_PIN_INPUT_PULLDOWN
);
116 omap_mux_init_signal("usba0_ulpiphy_dat4",
117 OMAP_PIN_INPUT_PULLDOWN
);
118 omap_mux_init_signal("usba0_ulpiphy_dat5",
119 OMAP_PIN_INPUT_PULLDOWN
);
120 omap_mux_init_signal("usba0_ulpiphy_dat6",
121 OMAP_PIN_INPUT_PULLDOWN
);
122 omap_mux_init_signal("usba0_ulpiphy_dat7",
123 OMAP_PIN_INPUT_PULLDOWN
);
129 void __init
usb_musb_init(struct omap_musb_board_data
*board_data
)
131 if (cpu_is_omap243x()) {
132 musb_resources
[0].start
= OMAP243X_HS_BASE
;
133 } else if (cpu_is_omap3517() || cpu_is_omap3505()) {
134 musb_device
.name
= "musb-am35x";
135 musb_resources
[0].start
= AM35XX_IPSS_USBOTGSS_BASE
;
136 musb_resources
[1].start
= INT_35XX_USBOTG_IRQ
;
137 } else if (cpu_is_omap34xx()) {
138 musb_resources
[0].start
= OMAP34XX_HSUSB_OTG_BASE
;
139 } else if (cpu_is_omap44xx()) {
140 musb_resources
[0].start
= OMAP44XX_HSUSB_OTG_BASE
;
141 musb_resources
[1].start
= OMAP44XX_IRQ_HS_USB_MC_N
;
142 musb_resources
[2].start
= OMAP44XX_IRQ_HS_USB_DMA_N
;
144 usb_musb_mux_init(board_data
);
146 musb_resources
[0].end
= musb_resources
[0].start
+ SZ_4K
- 1;
149 * REVISIT: This line can be removed once all the platforms using
150 * musb_core.c have been converted to use use clkdev.
152 musb_plat
.clock
= "ick";
153 musb_plat
.board_data
= board_data
;
154 musb_plat
.power
= board_data
->power
>> 1;
155 musb_plat
.mode
= board_data
->mode
;
156 musb_plat
.extvbus
= board_data
->extvbus
;
158 if (platform_device_register(&musb_device
) < 0)
159 printk(KERN_ERR
"Unable to register HS-USB (MUSB) device\n");
163 void __init
usb_musb_init(struct omap_musb_board_data
*board_data
)
166 #endif /* CONFIG_USB_MUSB_SOC */