Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 1 | /* |
Felipe Balbi | a8480ea | 2011-03-01 20:08:15 +0530 | [diff] [blame] | 2 | * usb-host.c - OMAP USB Host |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 3 | * |
| 4 | * This file will contain the board specific details for the |
Felipe Balbi | a8480ea | 2011-03-01 20:08:15 +0530 | [diff] [blame] | 5 | * Synopsys EHCI/OHCI host controller on OMAP3430 and onwards |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 6 | * |
Felipe Balbi | a8480ea | 2011-03-01 20:08:15 +0530 | [diff] [blame] | 7 | * Copyright (C) 2007-2011 Texas Instruments |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 8 | * Author: Vikram Pandita <vikram.pandita@ti.com> |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 9 | * Author: Keshava Munegowda <keshava_mgowda@ti.com> |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 10 | * |
| 11 | * Generalization by: |
Felipe Balbi | a8480ea | 2011-03-01 20:08:15 +0530 | [diff] [blame] | 12 | * Felipe Balbi <balbi@ti.com> |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 13 | * |
| 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. |
| 17 | */ |
| 18 | |
| 19 | #include <linux/types.h> |
| 20 | #include <linux/errno.h> |
| 21 | #include <linux/delay.h> |
| 22 | #include <linux/platform_device.h> |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 23 | #include <linux/slab.h> |
Amit Kucheria | bfb0119 | 2010-06-09 13:53:05 +0300 | [diff] [blame] | 24 | #include <linux/dma-mapping.h> |
| 25 | |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 26 | #include <asm/io.h> |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 27 | |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 28 | #include <plat/usb.h> |
Tony Lindgren | e4c060d | 2012-10-05 13:25:59 -0700 | [diff] [blame] | 29 | #include "soc.h" |
Tony Lindgren | 25c7d49 | 2012-10-02 17:25:48 -0700 | [diff] [blame] | 30 | #include "omap_device.h" |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 31 | |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 32 | #include "mux.h" |
| 33 | |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 34 | #ifdef CONFIG_MFD_OMAP_USB_HOST |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 35 | |
Keshava Munegowda | 50b2a9b | 2011-10-11 13:21:37 +0530 | [diff] [blame] | 36 | #define OMAP_USBHS_DEVICE "usbhs_omap" |
Keshava Munegowda | 760189b | 2012-07-16 19:01:10 +0530 | [diff] [blame] | 37 | #define OMAP_USBTLL_DEVICE "usbhs_tll" |
Keshava Munegowda | 50b2a9b | 2011-10-11 13:21:37 +0530 | [diff] [blame] | 38 | #define USBHS_UHH_HWMODNAME "usb_host_hs" |
| 39 | #define USBHS_TLL_HWMODNAME "usb_tll_hs" |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 40 | |
Keshava Munegowda | 3b68ae7 | 2011-03-01 20:08:20 +0530 | [diff] [blame] | 41 | static struct usbhs_omap_platform_data usbhs_data; |
Keshava Munegowda | 760189b | 2012-07-16 19:01:10 +0530 | [diff] [blame] | 42 | static struct usbtll_omap_platform_data usbtll_data; |
Keshava Munegowda | 3b68ae7 | 2011-03-01 20:08:20 +0530 | [diff] [blame] | 43 | static struct ehci_hcd_omap_platform_data ehci_data; |
| 44 | static struct ohci_hcd_omap_platform_data ohci_data; |
| 45 | |
Keshava Munegowda | 50b2a9b | 2011-10-11 13:21:37 +0530 | [diff] [blame] | 46 | static struct omap_device_pm_latency omap_uhhtll_latency[] = { |
| 47 | { |
| 48 | .deactivate_func = omap_device_idle_hwmods, |
| 49 | .activate_func = omap_device_enable_hwmods, |
| 50 | .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, |
| 51 | }, |
| 52 | }; |
| 53 | |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 54 | /* MUX settings for EHCI pins */ |
| 55 | /* |
| 56 | * setup_ehci_io_mux - initialize IO pad mux for USBHOST |
| 57 | */ |
Igor Grinberg | 1512f0d | 2012-03-26 16:51:10 +0200 | [diff] [blame] | 58 | static void __init setup_ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 59 | { |
| 60 | switch (port_mode[0]) { |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 61 | case OMAP_EHCI_PORT_MODE_PHY: |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 62 | omap_mux_init_signal("hsusb1_stp", OMAP_PIN_OUTPUT); |
| 63 | omap_mux_init_signal("hsusb1_clk", OMAP_PIN_OUTPUT); |
| 64 | omap_mux_init_signal("hsusb1_dir", OMAP_PIN_INPUT_PULLDOWN); |
| 65 | omap_mux_init_signal("hsusb1_nxt", OMAP_PIN_INPUT_PULLDOWN); |
| 66 | omap_mux_init_signal("hsusb1_data0", OMAP_PIN_INPUT_PULLDOWN); |
| 67 | omap_mux_init_signal("hsusb1_data1", OMAP_PIN_INPUT_PULLDOWN); |
| 68 | omap_mux_init_signal("hsusb1_data2", OMAP_PIN_INPUT_PULLDOWN); |
| 69 | omap_mux_init_signal("hsusb1_data3", OMAP_PIN_INPUT_PULLDOWN); |
| 70 | omap_mux_init_signal("hsusb1_data4", OMAP_PIN_INPUT_PULLDOWN); |
| 71 | omap_mux_init_signal("hsusb1_data5", OMAP_PIN_INPUT_PULLDOWN); |
| 72 | omap_mux_init_signal("hsusb1_data6", OMAP_PIN_INPUT_PULLDOWN); |
| 73 | omap_mux_init_signal("hsusb1_data7", OMAP_PIN_INPUT_PULLDOWN); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 74 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 75 | case OMAP_EHCI_PORT_MODE_TLL: |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 76 | omap_mux_init_signal("hsusb1_tll_stp", |
| 77 | OMAP_PIN_INPUT_PULLUP); |
| 78 | omap_mux_init_signal("hsusb1_tll_clk", |
| 79 | OMAP_PIN_INPUT_PULLDOWN); |
| 80 | omap_mux_init_signal("hsusb1_tll_dir", |
| 81 | OMAP_PIN_INPUT_PULLDOWN); |
| 82 | omap_mux_init_signal("hsusb1_tll_nxt", |
| 83 | OMAP_PIN_INPUT_PULLDOWN); |
| 84 | omap_mux_init_signal("hsusb1_tll_data0", |
| 85 | OMAP_PIN_INPUT_PULLDOWN); |
| 86 | omap_mux_init_signal("hsusb1_tll_data1", |
| 87 | OMAP_PIN_INPUT_PULLDOWN); |
| 88 | omap_mux_init_signal("hsusb1_tll_data2", |
| 89 | OMAP_PIN_INPUT_PULLDOWN); |
| 90 | omap_mux_init_signal("hsusb1_tll_data3", |
| 91 | OMAP_PIN_INPUT_PULLDOWN); |
| 92 | omap_mux_init_signal("hsusb1_tll_data4", |
| 93 | OMAP_PIN_INPUT_PULLDOWN); |
| 94 | omap_mux_init_signal("hsusb1_tll_data5", |
| 95 | OMAP_PIN_INPUT_PULLDOWN); |
| 96 | omap_mux_init_signal("hsusb1_tll_data6", |
| 97 | OMAP_PIN_INPUT_PULLDOWN); |
| 98 | omap_mux_init_signal("hsusb1_tll_data7", |
| 99 | OMAP_PIN_INPUT_PULLDOWN); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 100 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 101 | case OMAP_USBHS_PORT_MODE_UNUSED: |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 102 | /* FALLTHROUGH */ |
| 103 | default: |
| 104 | break; |
| 105 | } |
| 106 | |
| 107 | switch (port_mode[1]) { |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 108 | case OMAP_EHCI_PORT_MODE_PHY: |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 109 | omap_mux_init_signal("hsusb2_stp", OMAP_PIN_OUTPUT); |
| 110 | omap_mux_init_signal("hsusb2_clk", OMAP_PIN_OUTPUT); |
| 111 | omap_mux_init_signal("hsusb2_dir", OMAP_PIN_INPUT_PULLDOWN); |
| 112 | omap_mux_init_signal("hsusb2_nxt", OMAP_PIN_INPUT_PULLDOWN); |
| 113 | omap_mux_init_signal("hsusb2_data0", |
| 114 | OMAP_PIN_INPUT_PULLDOWN); |
| 115 | omap_mux_init_signal("hsusb2_data1", |
| 116 | OMAP_PIN_INPUT_PULLDOWN); |
| 117 | omap_mux_init_signal("hsusb2_data2", |
| 118 | OMAP_PIN_INPUT_PULLDOWN); |
| 119 | omap_mux_init_signal("hsusb2_data3", |
| 120 | OMAP_PIN_INPUT_PULLDOWN); |
| 121 | omap_mux_init_signal("hsusb2_data4", |
| 122 | OMAP_PIN_INPUT_PULLDOWN); |
| 123 | omap_mux_init_signal("hsusb2_data5", |
| 124 | OMAP_PIN_INPUT_PULLDOWN); |
| 125 | omap_mux_init_signal("hsusb2_data6", |
| 126 | OMAP_PIN_INPUT_PULLDOWN); |
| 127 | omap_mux_init_signal("hsusb2_data7", |
| 128 | OMAP_PIN_INPUT_PULLDOWN); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 129 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 130 | case OMAP_EHCI_PORT_MODE_TLL: |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 131 | omap_mux_init_signal("hsusb2_tll_stp", |
| 132 | OMAP_PIN_INPUT_PULLUP); |
| 133 | omap_mux_init_signal("hsusb2_tll_clk", |
| 134 | OMAP_PIN_INPUT_PULLDOWN); |
| 135 | omap_mux_init_signal("hsusb2_tll_dir", |
| 136 | OMAP_PIN_INPUT_PULLDOWN); |
| 137 | omap_mux_init_signal("hsusb2_tll_nxt", |
| 138 | OMAP_PIN_INPUT_PULLDOWN); |
| 139 | omap_mux_init_signal("hsusb2_tll_data0", |
| 140 | OMAP_PIN_INPUT_PULLDOWN); |
| 141 | omap_mux_init_signal("hsusb2_tll_data1", |
| 142 | OMAP_PIN_INPUT_PULLDOWN); |
| 143 | omap_mux_init_signal("hsusb2_tll_data2", |
| 144 | OMAP_PIN_INPUT_PULLDOWN); |
| 145 | omap_mux_init_signal("hsusb2_tll_data3", |
| 146 | OMAP_PIN_INPUT_PULLDOWN); |
| 147 | omap_mux_init_signal("hsusb2_tll_data4", |
| 148 | OMAP_PIN_INPUT_PULLDOWN); |
| 149 | omap_mux_init_signal("hsusb2_tll_data5", |
| 150 | OMAP_PIN_INPUT_PULLDOWN); |
| 151 | omap_mux_init_signal("hsusb2_tll_data6", |
| 152 | OMAP_PIN_INPUT_PULLDOWN); |
| 153 | omap_mux_init_signal("hsusb2_tll_data7", |
| 154 | OMAP_PIN_INPUT_PULLDOWN); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 155 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 156 | case OMAP_USBHS_PORT_MODE_UNUSED: |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 157 | /* FALLTHROUGH */ |
| 158 | default: |
| 159 | break; |
| 160 | } |
| 161 | |
| 162 | switch (port_mode[2]) { |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 163 | case OMAP_EHCI_PORT_MODE_PHY: |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 164 | printk(KERN_WARNING "Port3 can't be used in PHY mode\n"); |
| 165 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 166 | case OMAP_EHCI_PORT_MODE_TLL: |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 167 | omap_mux_init_signal("hsusb3_tll_stp", |
| 168 | OMAP_PIN_INPUT_PULLUP); |
| 169 | omap_mux_init_signal("hsusb3_tll_clk", |
| 170 | OMAP_PIN_INPUT_PULLDOWN); |
| 171 | omap_mux_init_signal("hsusb3_tll_dir", |
| 172 | OMAP_PIN_INPUT_PULLDOWN); |
| 173 | omap_mux_init_signal("hsusb3_tll_nxt", |
| 174 | OMAP_PIN_INPUT_PULLDOWN); |
| 175 | omap_mux_init_signal("hsusb3_tll_data0", |
| 176 | OMAP_PIN_INPUT_PULLDOWN); |
| 177 | omap_mux_init_signal("hsusb3_tll_data1", |
| 178 | OMAP_PIN_INPUT_PULLDOWN); |
| 179 | omap_mux_init_signal("hsusb3_tll_data2", |
| 180 | OMAP_PIN_INPUT_PULLDOWN); |
| 181 | omap_mux_init_signal("hsusb3_tll_data3", |
| 182 | OMAP_PIN_INPUT_PULLDOWN); |
| 183 | omap_mux_init_signal("hsusb3_tll_data4", |
| 184 | OMAP_PIN_INPUT_PULLDOWN); |
| 185 | omap_mux_init_signal("hsusb3_tll_data5", |
| 186 | OMAP_PIN_INPUT_PULLDOWN); |
| 187 | omap_mux_init_signal("hsusb3_tll_data6", |
| 188 | OMAP_PIN_INPUT_PULLDOWN); |
| 189 | omap_mux_init_signal("hsusb3_tll_data7", |
| 190 | OMAP_PIN_INPUT_PULLDOWN); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 191 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 192 | case OMAP_USBHS_PORT_MODE_UNUSED: |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 193 | /* FALLTHROUGH */ |
| 194 | default: |
| 195 | break; |
| 196 | } |
| 197 | |
| 198 | return; |
| 199 | } |
| 200 | |
Igor Grinberg | 1512f0d | 2012-03-26 16:51:10 +0200 | [diff] [blame] | 201 | static |
| 202 | void __init setup_4430ehci_io_mux(const enum usbhs_omap_port_mode *port_mode) |
Anand Gadiyar | becf073 | 2010-11-21 23:23:41 +0530 | [diff] [blame] | 203 | { |
| 204 | switch (port_mode[0]) { |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 205 | case OMAP_EHCI_PORT_MODE_PHY: |
Anand Gadiyar | becf073 | 2010-11-21 23:23:41 +0530 | [diff] [blame] | 206 | omap_mux_init_signal("usbb1_ulpiphy_stp", |
| 207 | OMAP_PIN_OUTPUT); |
| 208 | omap_mux_init_signal("usbb1_ulpiphy_clk", |
| 209 | OMAP_PIN_INPUT_PULLDOWN); |
| 210 | omap_mux_init_signal("usbb1_ulpiphy_dir", |
| 211 | OMAP_PIN_INPUT_PULLDOWN); |
| 212 | omap_mux_init_signal("usbb1_ulpiphy_nxt", |
| 213 | OMAP_PIN_INPUT_PULLDOWN); |
| 214 | omap_mux_init_signal("usbb1_ulpiphy_dat0", |
| 215 | OMAP_PIN_INPUT_PULLDOWN); |
| 216 | omap_mux_init_signal("usbb1_ulpiphy_dat1", |
| 217 | OMAP_PIN_INPUT_PULLDOWN); |
| 218 | omap_mux_init_signal("usbb1_ulpiphy_dat2", |
| 219 | OMAP_PIN_INPUT_PULLDOWN); |
| 220 | omap_mux_init_signal("usbb1_ulpiphy_dat3", |
| 221 | OMAP_PIN_INPUT_PULLDOWN); |
| 222 | omap_mux_init_signal("usbb1_ulpiphy_dat4", |
| 223 | OMAP_PIN_INPUT_PULLDOWN); |
| 224 | omap_mux_init_signal("usbb1_ulpiphy_dat5", |
| 225 | OMAP_PIN_INPUT_PULLDOWN); |
| 226 | omap_mux_init_signal("usbb1_ulpiphy_dat6", |
| 227 | OMAP_PIN_INPUT_PULLDOWN); |
| 228 | omap_mux_init_signal("usbb1_ulpiphy_dat7", |
| 229 | OMAP_PIN_INPUT_PULLDOWN); |
| 230 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 231 | case OMAP_EHCI_PORT_MODE_TLL: |
Anand Gadiyar | becf073 | 2010-11-21 23:23:41 +0530 | [diff] [blame] | 232 | omap_mux_init_signal("usbb1_ulpitll_stp", |
| 233 | OMAP_PIN_INPUT_PULLUP); |
| 234 | omap_mux_init_signal("usbb1_ulpitll_clk", |
| 235 | OMAP_PIN_INPUT_PULLDOWN); |
| 236 | omap_mux_init_signal("usbb1_ulpitll_dir", |
| 237 | OMAP_PIN_INPUT_PULLDOWN); |
| 238 | omap_mux_init_signal("usbb1_ulpitll_nxt", |
| 239 | OMAP_PIN_INPUT_PULLDOWN); |
| 240 | omap_mux_init_signal("usbb1_ulpitll_dat0", |
| 241 | OMAP_PIN_INPUT_PULLDOWN); |
| 242 | omap_mux_init_signal("usbb1_ulpitll_dat1", |
| 243 | OMAP_PIN_INPUT_PULLDOWN); |
| 244 | omap_mux_init_signal("usbb1_ulpitll_dat2", |
| 245 | OMAP_PIN_INPUT_PULLDOWN); |
| 246 | omap_mux_init_signal("usbb1_ulpitll_dat3", |
| 247 | OMAP_PIN_INPUT_PULLDOWN); |
| 248 | omap_mux_init_signal("usbb1_ulpitll_dat4", |
| 249 | OMAP_PIN_INPUT_PULLDOWN); |
| 250 | omap_mux_init_signal("usbb1_ulpitll_dat5", |
| 251 | OMAP_PIN_INPUT_PULLDOWN); |
| 252 | omap_mux_init_signal("usbb1_ulpitll_dat6", |
| 253 | OMAP_PIN_INPUT_PULLDOWN); |
| 254 | omap_mux_init_signal("usbb1_ulpitll_dat7", |
| 255 | OMAP_PIN_INPUT_PULLDOWN); |
| 256 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 257 | case OMAP_USBHS_PORT_MODE_UNUSED: |
Anand Gadiyar | becf073 | 2010-11-21 23:23:41 +0530 | [diff] [blame] | 258 | default: |
| 259 | break; |
| 260 | } |
| 261 | switch (port_mode[1]) { |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 262 | case OMAP_EHCI_PORT_MODE_PHY: |
Anand Gadiyar | becf073 | 2010-11-21 23:23:41 +0530 | [diff] [blame] | 263 | omap_mux_init_signal("usbb2_ulpiphy_stp", |
| 264 | OMAP_PIN_OUTPUT); |
| 265 | omap_mux_init_signal("usbb2_ulpiphy_clk", |
| 266 | OMAP_PIN_INPUT_PULLDOWN); |
| 267 | omap_mux_init_signal("usbb2_ulpiphy_dir", |
| 268 | OMAP_PIN_INPUT_PULLDOWN); |
| 269 | omap_mux_init_signal("usbb2_ulpiphy_nxt", |
| 270 | OMAP_PIN_INPUT_PULLDOWN); |
| 271 | omap_mux_init_signal("usbb2_ulpiphy_dat0", |
| 272 | OMAP_PIN_INPUT_PULLDOWN); |
| 273 | omap_mux_init_signal("usbb2_ulpiphy_dat1", |
| 274 | OMAP_PIN_INPUT_PULLDOWN); |
| 275 | omap_mux_init_signal("usbb2_ulpiphy_dat2", |
| 276 | OMAP_PIN_INPUT_PULLDOWN); |
| 277 | omap_mux_init_signal("usbb2_ulpiphy_dat3", |
| 278 | OMAP_PIN_INPUT_PULLDOWN); |
| 279 | omap_mux_init_signal("usbb2_ulpiphy_dat4", |
| 280 | OMAP_PIN_INPUT_PULLDOWN); |
| 281 | omap_mux_init_signal("usbb2_ulpiphy_dat5", |
| 282 | OMAP_PIN_INPUT_PULLDOWN); |
| 283 | omap_mux_init_signal("usbb2_ulpiphy_dat6", |
| 284 | OMAP_PIN_INPUT_PULLDOWN); |
| 285 | omap_mux_init_signal("usbb2_ulpiphy_dat7", |
| 286 | OMAP_PIN_INPUT_PULLDOWN); |
| 287 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 288 | case OMAP_EHCI_PORT_MODE_TLL: |
Anand Gadiyar | becf073 | 2010-11-21 23:23:41 +0530 | [diff] [blame] | 289 | omap_mux_init_signal("usbb2_ulpitll_stp", |
| 290 | OMAP_PIN_INPUT_PULLUP); |
| 291 | omap_mux_init_signal("usbb2_ulpitll_clk", |
| 292 | OMAP_PIN_INPUT_PULLDOWN); |
| 293 | omap_mux_init_signal("usbb2_ulpitll_dir", |
| 294 | OMAP_PIN_INPUT_PULLDOWN); |
| 295 | omap_mux_init_signal("usbb2_ulpitll_nxt", |
| 296 | OMAP_PIN_INPUT_PULLDOWN); |
| 297 | omap_mux_init_signal("usbb2_ulpitll_dat0", |
| 298 | OMAP_PIN_INPUT_PULLDOWN); |
| 299 | omap_mux_init_signal("usbb2_ulpitll_dat1", |
| 300 | OMAP_PIN_INPUT_PULLDOWN); |
| 301 | omap_mux_init_signal("usbb2_ulpitll_dat2", |
| 302 | OMAP_PIN_INPUT_PULLDOWN); |
| 303 | omap_mux_init_signal("usbb2_ulpitll_dat3", |
| 304 | OMAP_PIN_INPUT_PULLDOWN); |
| 305 | omap_mux_init_signal("usbb2_ulpitll_dat4", |
| 306 | OMAP_PIN_INPUT_PULLDOWN); |
| 307 | omap_mux_init_signal("usbb2_ulpitll_dat5", |
| 308 | OMAP_PIN_INPUT_PULLDOWN); |
| 309 | omap_mux_init_signal("usbb2_ulpitll_dat6", |
| 310 | OMAP_PIN_INPUT_PULLDOWN); |
| 311 | omap_mux_init_signal("usbb2_ulpitll_dat7", |
| 312 | OMAP_PIN_INPUT_PULLDOWN); |
| 313 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 314 | case OMAP_USBHS_PORT_MODE_UNUSED: |
Anand Gadiyar | becf073 | 2010-11-21 23:23:41 +0530 | [diff] [blame] | 315 | default: |
| 316 | break; |
| 317 | } |
| 318 | } |
| 319 | |
Igor Grinberg | 1512f0d | 2012-03-26 16:51:10 +0200 | [diff] [blame] | 320 | static void __init setup_ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) |
Anand Gadiyar | 95344fc | 2010-05-10 21:56:10 +0530 | [diff] [blame] | 321 | { |
| 322 | switch (port_mode[0]) { |
| 323 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: |
| 324 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM: |
| 325 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0: |
| 326 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM: |
| 327 | omap_mux_init_signal("mm1_rxdp", |
| 328 | OMAP_PIN_INPUT_PULLDOWN); |
| 329 | omap_mux_init_signal("mm1_rxdm", |
| 330 | OMAP_PIN_INPUT_PULLDOWN); |
| 331 | /* FALLTHROUGH */ |
| 332 | case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM: |
| 333 | case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM: |
| 334 | omap_mux_init_signal("mm1_rxrcv", |
| 335 | OMAP_PIN_INPUT_PULLDOWN); |
| 336 | /* FALLTHROUGH */ |
| 337 | case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0: |
| 338 | case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0: |
| 339 | omap_mux_init_signal("mm1_txen_n", OMAP_PIN_OUTPUT); |
| 340 | /* FALLTHROUGH */ |
| 341 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0: |
| 342 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM: |
| 343 | omap_mux_init_signal("mm1_txse0", |
| 344 | OMAP_PIN_INPUT_PULLDOWN); |
| 345 | omap_mux_init_signal("mm1_txdat", |
| 346 | OMAP_PIN_INPUT_PULLDOWN); |
| 347 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 348 | case OMAP_USBHS_PORT_MODE_UNUSED: |
Anand Gadiyar | 95344fc | 2010-05-10 21:56:10 +0530 | [diff] [blame] | 349 | /* FALLTHROUGH */ |
| 350 | default: |
| 351 | break; |
| 352 | } |
| 353 | switch (port_mode[1]) { |
| 354 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: |
| 355 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM: |
| 356 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0: |
| 357 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM: |
| 358 | omap_mux_init_signal("mm2_rxdp", |
| 359 | OMAP_PIN_INPUT_PULLDOWN); |
| 360 | omap_mux_init_signal("mm2_rxdm", |
| 361 | OMAP_PIN_INPUT_PULLDOWN); |
| 362 | /* FALLTHROUGH */ |
| 363 | case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM: |
| 364 | case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM: |
| 365 | omap_mux_init_signal("mm2_rxrcv", |
| 366 | OMAP_PIN_INPUT_PULLDOWN); |
| 367 | /* FALLTHROUGH */ |
| 368 | case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0: |
| 369 | case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0: |
| 370 | omap_mux_init_signal("mm2_txen_n", OMAP_PIN_OUTPUT); |
| 371 | /* FALLTHROUGH */ |
| 372 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0: |
| 373 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM: |
| 374 | omap_mux_init_signal("mm2_txse0", |
| 375 | OMAP_PIN_INPUT_PULLDOWN); |
| 376 | omap_mux_init_signal("mm2_txdat", |
| 377 | OMAP_PIN_INPUT_PULLDOWN); |
| 378 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 379 | case OMAP_USBHS_PORT_MODE_UNUSED: |
Anand Gadiyar | 95344fc | 2010-05-10 21:56:10 +0530 | [diff] [blame] | 380 | /* FALLTHROUGH */ |
| 381 | default: |
| 382 | break; |
| 383 | } |
| 384 | switch (port_mode[2]) { |
| 385 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: |
| 386 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM: |
| 387 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0: |
| 388 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM: |
| 389 | omap_mux_init_signal("mm3_rxdp", |
| 390 | OMAP_PIN_INPUT_PULLDOWN); |
| 391 | omap_mux_init_signal("mm3_rxdm", |
| 392 | OMAP_PIN_INPUT_PULLDOWN); |
| 393 | /* FALLTHROUGH */ |
| 394 | case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM: |
| 395 | case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM: |
| 396 | omap_mux_init_signal("mm3_rxrcv", |
| 397 | OMAP_PIN_INPUT_PULLDOWN); |
| 398 | /* FALLTHROUGH */ |
| 399 | case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0: |
| 400 | case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0: |
| 401 | omap_mux_init_signal("mm3_txen_n", OMAP_PIN_OUTPUT); |
| 402 | /* FALLTHROUGH */ |
| 403 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0: |
| 404 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM: |
| 405 | omap_mux_init_signal("mm3_txse0", |
| 406 | OMAP_PIN_INPUT_PULLDOWN); |
| 407 | omap_mux_init_signal("mm3_txdat", |
| 408 | OMAP_PIN_INPUT_PULLDOWN); |
| 409 | break; |
Keshava Munegowda | 181b250 | 2011-03-01 20:08:16 +0530 | [diff] [blame] | 410 | case OMAP_USBHS_PORT_MODE_UNUSED: |
Anand Gadiyar | 95344fc | 2010-05-10 21:56:10 +0530 | [diff] [blame] | 411 | /* FALLTHROUGH */ |
| 412 | default: |
| 413 | break; |
| 414 | } |
| 415 | } |
| 416 | |
Igor Grinberg | 1512f0d | 2012-03-26 16:51:10 +0200 | [diff] [blame] | 417 | static |
| 418 | void __init setup_4430ohci_io_mux(const enum usbhs_omap_port_mode *port_mode) |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 419 | { |
| 420 | switch (port_mode[0]) { |
| 421 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: |
| 422 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM: |
| 423 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0: |
| 424 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM: |
| 425 | omap_mux_init_signal("usbb1_mm_rxdp", |
| 426 | OMAP_PIN_INPUT_PULLDOWN); |
| 427 | omap_mux_init_signal("usbb1_mm_rxdm", |
| 428 | OMAP_PIN_INPUT_PULLDOWN); |
| 429 | |
| 430 | case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM: |
| 431 | case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM: |
| 432 | omap_mux_init_signal("usbb1_mm_rxrcv", |
| 433 | OMAP_PIN_INPUT_PULLDOWN); |
| 434 | |
| 435 | case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0: |
| 436 | case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0: |
| 437 | omap_mux_init_signal("usbb1_mm_txen", |
| 438 | OMAP_PIN_INPUT_PULLDOWN); |
| 439 | |
| 440 | |
| 441 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0: |
| 442 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM: |
| 443 | omap_mux_init_signal("usbb1_mm_txdat", |
| 444 | OMAP_PIN_INPUT_PULLDOWN); |
| 445 | omap_mux_init_signal("usbb1_mm_txse0", |
| 446 | OMAP_PIN_INPUT_PULLDOWN); |
| 447 | break; |
| 448 | |
| 449 | case OMAP_USBHS_PORT_MODE_UNUSED: |
| 450 | default: |
| 451 | break; |
| 452 | } |
| 453 | |
| 454 | switch (port_mode[1]) { |
| 455 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DATSE0: |
| 456 | case OMAP_OHCI_PORT_MODE_PHY_6PIN_DPDM: |
| 457 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DATSE0: |
| 458 | case OMAP_OHCI_PORT_MODE_TLL_6PIN_DPDM: |
| 459 | omap_mux_init_signal("usbb2_mm_rxdp", |
| 460 | OMAP_PIN_INPUT_PULLDOWN); |
| 461 | omap_mux_init_signal("usbb2_mm_rxdm", |
| 462 | OMAP_PIN_INPUT_PULLDOWN); |
| 463 | |
| 464 | case OMAP_OHCI_PORT_MODE_PHY_4PIN_DPDM: |
| 465 | case OMAP_OHCI_PORT_MODE_TLL_4PIN_DPDM: |
| 466 | omap_mux_init_signal("usbb2_mm_rxrcv", |
| 467 | OMAP_PIN_INPUT_PULLDOWN); |
| 468 | |
| 469 | case OMAP_OHCI_PORT_MODE_PHY_3PIN_DATSE0: |
| 470 | case OMAP_OHCI_PORT_MODE_TLL_3PIN_DATSE0: |
| 471 | omap_mux_init_signal("usbb2_mm_txen", |
| 472 | OMAP_PIN_INPUT_PULLDOWN); |
| 473 | |
| 474 | |
| 475 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DATSE0: |
| 476 | case OMAP_OHCI_PORT_MODE_TLL_2PIN_DPDM: |
| 477 | omap_mux_init_signal("usbb2_mm_txdat", |
| 478 | OMAP_PIN_INPUT_PULLDOWN); |
| 479 | omap_mux_init_signal("usbb2_mm_txse0", |
| 480 | OMAP_PIN_INPUT_PULLDOWN); |
| 481 | break; |
| 482 | |
| 483 | case OMAP_USBHS_PORT_MODE_UNUSED: |
| 484 | default: |
| 485 | break; |
| 486 | } |
| 487 | } |
| 488 | |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 489 | void __init usbhs_init(const struct usbhs_omap_board_data *pdata) |
| 490 | { |
Keshava Munegowda | 760189b | 2012-07-16 19:01:10 +0530 | [diff] [blame] | 491 | struct omap_hwmod *uhh_hwm, *tll_hwm; |
Felipe Balbi | abe763f | 2012-02-14 10:54:46 +0200 | [diff] [blame] | 492 | struct platform_device *pdev; |
Keshava Munegowda | 50b2a9b | 2011-10-11 13:21:37 +0530 | [diff] [blame] | 493 | int bus_id = -1; |
| 494 | int i; |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 495 | |
| 496 | for (i = 0; i < OMAP3_HS_USB_PORTS; i++) { |
| 497 | usbhs_data.port_mode[i] = pdata->port_mode[i]; |
Keshava Munegowda | 760189b | 2012-07-16 19:01:10 +0530 | [diff] [blame] | 498 | usbtll_data.port_mode[i] = pdata->port_mode[i]; |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 499 | ohci_data.port_mode[i] = pdata->port_mode[i]; |
| 500 | ehci_data.port_mode[i] = pdata->port_mode[i]; |
| 501 | ehci_data.reset_gpio_port[i] = pdata->reset_gpio_port[i]; |
| 502 | ehci_data.regulator[i] = pdata->regulator[i]; |
| 503 | } |
| 504 | ehci_data.phy_reset = pdata->phy_reset; |
| 505 | ohci_data.es2_compatibility = pdata->es2_compatibility; |
| 506 | usbhs_data.ehci_data = &ehci_data; |
| 507 | usbhs_data.ohci_data = &ohci_data; |
| 508 | |
| 509 | if (cpu_is_omap34xx()) { |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 510 | setup_ehci_io_mux(pdata->port_mode); |
| 511 | setup_ohci_io_mux(pdata->port_mode); |
| 512 | } else if (cpu_is_omap44xx()) { |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 513 | setup_4430ehci_io_mux(pdata->port_mode); |
| 514 | setup_4430ohci_io_mux(pdata->port_mode); |
| 515 | } |
| 516 | |
Keshava Munegowda | 760189b | 2012-07-16 19:01:10 +0530 | [diff] [blame] | 517 | uhh_hwm = omap_hwmod_lookup(USBHS_UHH_HWMODNAME); |
| 518 | if (!uhh_hwm) { |
Keshava Munegowda | 50b2a9b | 2011-10-11 13:21:37 +0530 | [diff] [blame] | 519 | pr_err("Could not look up %s\n", USBHS_UHH_HWMODNAME); |
| 520 | return; |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 521 | } |
| 522 | |
Keshava Munegowda | 760189b | 2012-07-16 19:01:10 +0530 | [diff] [blame] | 523 | tll_hwm = omap_hwmod_lookup(USBHS_TLL_HWMODNAME); |
| 524 | if (!tll_hwm) { |
Keshava Munegowda | 50b2a9b | 2011-10-11 13:21:37 +0530 | [diff] [blame] | 525 | pr_err("Could not look up %s\n", USBHS_TLL_HWMODNAME); |
| 526 | return; |
| 527 | } |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 528 | |
Keshava Munegowda | 760189b | 2012-07-16 19:01:10 +0530 | [diff] [blame] | 529 | pdev = omap_device_build(OMAP_USBTLL_DEVICE, bus_id, tll_hwm, |
| 530 | &usbtll_data, sizeof(usbtll_data), |
Keshava Munegowda | 50b2a9b | 2011-10-11 13:21:37 +0530 | [diff] [blame] | 531 | omap_uhhtll_latency, |
| 532 | ARRAY_SIZE(omap_uhhtll_latency), false); |
Felipe Balbi | abe763f | 2012-02-14 10:54:46 +0200 | [diff] [blame] | 533 | if (IS_ERR(pdev)) { |
Keshava Munegowda | 760189b | 2012-07-16 19:01:10 +0530 | [diff] [blame] | 534 | pr_err("Could not build hwmod device %s\n", |
| 535 | USBHS_TLL_HWMODNAME); |
| 536 | return; |
| 537 | } |
| 538 | |
| 539 | pdev = omap_device_build(OMAP_USBHS_DEVICE, bus_id, uhh_hwm, |
| 540 | &usbhs_data, sizeof(usbhs_data), |
| 541 | omap_uhhtll_latency, |
| 542 | ARRAY_SIZE(omap_uhhtll_latency), false); |
| 543 | if (IS_ERR(pdev)) { |
| 544 | pr_err("Could not build hwmod devices %s\n", |
| 545 | USBHS_UHH_HWMODNAME); |
Keshava Munegowda | 50b2a9b | 2011-10-11 13:21:37 +0530 | [diff] [blame] | 546 | return; |
| 547 | } |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 548 | } |
| 549 | |
Anand Gadiyar | 95344fc | 2010-05-10 21:56:10 +0530 | [diff] [blame] | 550 | #else |
| 551 | |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 552 | void __init usbhs_init(const struct usbhs_omap_board_data *pdata) |
| 553 | { |
| 554 | } |
| 555 | |
Keshava Munegowda | 2236396 | 2011-03-01 20:08:18 +0530 | [diff] [blame] | 556 | #endif |