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