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