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