Angel Pons | 8a3453f | 2020-04-02 23:48:19 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 2 | |
Elyes HAOUAS | d970e39 | 2020-07-10 10:58:10 +0200 | [diff] [blame] | 3 | #include <stdint.h> |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 4 | #include <console/console.h> |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 5 | #include <string.h> |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 6 | |
| 7 | #include "ehci_debug.h" |
| 8 | #include "usb_ch9.h" |
| 9 | #include "ehci.h" |
| 10 | |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 11 | #define USB_HUB_PORT_CONNECTION 0 |
| 12 | #define USB_HUB_PORT_ENABLED 1 |
| 13 | #define USB_HUB_PORT_RESET 4 |
| 14 | #define USB_HUB_PORT_POWER 8 |
| 15 | #define USB_HUB_C_PORT_CONNECTION 16 |
| 16 | #define USB_HUB_C_PORT_RESET 20 |
| 17 | |
Elyes HAOUAS | b0b0c8c | 2018-07-08 12:33:47 +0200 | [diff] [blame] | 18 | static int hub_port_status(const char *buf, int feature) |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 19 | { |
| 20 | return !!(buf[feature>>3] & (1<<(feature&0x7))); |
| 21 | } |
| 22 | |
| 23 | /* After USB port reset, treat device number 0 as an USB hub. Assign it with |
| 24 | * a device number hub_addr. Then apply enable and reset on downstream port. |
| 25 | */ |
Martin Roth | b9810a4 | 2017-07-23 20:00:04 -0600 | [diff] [blame] | 26 | static int dbgp_hub_enable(struct ehci_dbg_port *ehci_debug, unsigned char hub_addr, |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 27 | unsigned char port) |
| 28 | { |
| 29 | char status[8]; |
| 30 | int ret, loop; |
| 31 | |
| 32 | /* Assign a devicenumber for the hub. */ |
| 33 | ret = dbgp_control_msg(ehci_debug, 0, |
| 34 | USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
| 35 | USB_REQ_SET_ADDRESS, hub_addr, 0, NULL, 0); |
| 36 | if (ret < 0) |
| 37 | goto err; |
| 38 | |
| 39 | /* Enter configured state on hub. */ |
| 40 | ret = dbgp_control_msg(ehci_debug, hub_addr, |
| 41 | USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
| 42 | USB_REQ_SET_CONFIGURATION, 1, 0, NULL, 0); |
| 43 | if (ret < 0) |
| 44 | goto err; |
| 45 | |
| 46 | /* Set PORT_POWER, poll for PORT_CONNECTION. */ |
| 47 | ret = dbgp_control_msg(ehci_debug, hub_addr, |
| 48 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_OTHER, |
| 49 | USB_REQ_SET_FEATURE, USB_HUB_PORT_POWER, port, NULL, 0); |
| 50 | if (ret < 0) |
| 51 | goto err; |
| 52 | |
| 53 | loop = 100; |
| 54 | do { |
| 55 | dbgp_mdelay(10); |
| 56 | ret = dbgp_control_msg(ehci_debug, hub_addr, |
| 57 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_OTHER, |
| 58 | USB_REQ_GET_STATUS, 0, port, status, 4); |
| 59 | if (ret < 0) |
| 60 | goto err; |
| 61 | if (hub_port_status(status, USB_HUB_PORT_CONNECTION)) |
| 62 | break; |
| 63 | } while (--loop); |
| 64 | if (! loop) |
| 65 | goto err; |
| 66 | |
| 67 | ret = dbgp_control_msg(ehci_debug, hub_addr, |
| 68 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_OTHER, |
| 69 | USB_REQ_CLEAR_FEATURE, USB_HUB_C_PORT_CONNECTION, port, NULL, 0); |
| 70 | if (ret < 0) |
| 71 | goto err; |
| 72 | |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 73 | /* Set PORT_RESET, poll for C_PORT_RESET. */ |
| 74 | ret = dbgp_control_msg(ehci_debug, hub_addr, |
| 75 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_OTHER, |
| 76 | USB_REQ_SET_FEATURE, USB_HUB_PORT_RESET, port, NULL, 0); |
| 77 | if (ret < 0) |
| 78 | goto err; |
| 79 | |
| 80 | loop = 100; |
| 81 | do { |
| 82 | dbgp_mdelay(10); |
| 83 | ret = dbgp_control_msg(ehci_debug, hub_addr, |
| 84 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_OTHER, |
| 85 | USB_REQ_GET_STATUS, 0, port, status, 4); |
| 86 | if (ret < 0) |
| 87 | goto err; |
| 88 | if (hub_port_status(status, USB_HUB_C_PORT_RESET)) |
| 89 | break; |
| 90 | } while (--loop); |
| 91 | if (! loop) |
| 92 | goto err; |
| 93 | |
| 94 | ret = dbgp_control_msg(ehci_debug, hub_addr, |
| 95 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_OTHER, |
| 96 | USB_REQ_CLEAR_FEATURE, USB_HUB_C_PORT_RESET, port, NULL, 0); |
| 97 | if (ret < 0) |
| 98 | goto err; |
| 99 | |
| 100 | if (hub_port_status(status, USB_HUB_PORT_ENABLED)) |
| 101 | return 0; |
| 102 | err: |
| 103 | return -1; |
| 104 | } |
| 105 | |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 106 | static void ack_set_configuration(struct dbgp_pipe *pipe, u8 devnum, int timeout) |
| 107 | { |
| 108 | int i = DBGP_SETUP_EP0; |
| 109 | while (++i < DBGP_MAX_ENDPOINTS) { |
| 110 | if (pipe[i].endpoint != 0) { |
| 111 | pipe[i].devnum = devnum; |
| 112 | pipe[i].pid = USB_PID_DATA0; |
| 113 | pipe[i].timeout = timeout; |
| 114 | } |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | static void activate_endpoints(struct dbgp_pipe *pipe) |
| 119 | { |
| 120 | int i = DBGP_SETUP_EP0; |
| 121 | pipe[i].status |= DBGP_EP_ENABLED | DBGP_EP_VALID; |
| 122 | while (++i < DBGP_MAX_ENDPOINTS) { |
| 123 | if (pipe[i].endpoint != 0) |
| 124 | pipe[i].status |= DBGP_EP_ENABLED | DBGP_EP_VALID; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | static int probe_for_debug_descriptor(struct ehci_dbg_port *ehci_debug, struct dbgp_pipe *pipe) |
| 129 | { |
| 130 | struct usb_debug_descriptor dbgp_desc; |
| 131 | int configured = 0, ret; |
| 132 | u8 devnum = 0; |
| 133 | |
| 134 | /* Find the debug device and make it device number 127 */ |
| 135 | debug_dev_retry: |
| 136 | memset(&dbgp_desc, 0, sizeof(dbgp_desc)); |
| 137 | ret = dbgp_control_msg(ehci_debug, devnum, |
| 138 | USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
| 139 | USB_REQ_GET_DESCRIPTOR, (USB_DT_DEBUG << 8), 0, |
| 140 | &dbgp_desc, sizeof(dbgp_desc)); |
| 141 | if (ret == sizeof(dbgp_desc)) { |
Elyes HAOUAS | 9b41bae | 2018-04-26 10:29:10 +0200 | [diff] [blame] | 142 | if (dbgp_desc.bLength == sizeof(dbgp_desc) && dbgp_desc.bDescriptorType == USB_DT_DEBUG) |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 143 | goto debug_dev_found; |
| 144 | else |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 145 | printk(BIOS_INFO, "Invalid debug device descriptor.\n"); |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 146 | } |
| 147 | if (devnum == 0) { |
| 148 | devnum = USB_DEBUG_DEVNUM; |
| 149 | goto debug_dev_retry; |
| 150 | } else { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 151 | printk(BIOS_INFO, "Could not find attached debug device.\n"); |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 152 | return -1; |
| 153 | } |
| 154 | debug_dev_found: |
| 155 | |
| 156 | /* Move the device to 127 if it isn't already there */ |
| 157 | if (devnum != USB_DEBUG_DEVNUM) { |
| 158 | ret = dbgp_control_msg(ehci_debug, devnum, |
| 159 | USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
| 160 | USB_REQ_SET_ADDRESS, USB_DEBUG_DEVNUM, 0, NULL, 0); |
| 161 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 162 | printk(BIOS_INFO, "Could not move attached device to %d.\n", |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 163 | USB_DEBUG_DEVNUM); |
| 164 | return -2; |
| 165 | } |
| 166 | devnum = USB_DEBUG_DEVNUM; |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 167 | printk(BIOS_INFO, "EHCI debug device renamed to 127.\n"); |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | /* Enable the debug interface */ |
| 171 | ret = dbgp_control_msg(ehci_debug, USB_DEBUG_DEVNUM, |
| 172 | USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
| 173 | USB_REQ_SET_FEATURE, USB_DEVICE_DEBUG_MODE, 0, NULL, 0); |
| 174 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 175 | printk(BIOS_INFO, "Could not enable EHCI debug device.\n"); |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 176 | return -3; |
| 177 | } |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 178 | printk(BIOS_INFO, "EHCI debug interface enabled.\n"); |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 179 | |
| 180 | pipe[DBGP_CONSOLE_EPOUT].endpoint = dbgp_desc.bDebugOutEndpoint; |
| 181 | pipe[DBGP_CONSOLE_EPIN].endpoint = dbgp_desc.bDebugInEndpoint; |
| 182 | |
| 183 | ack_set_configuration(pipe, devnum, 1000); |
| 184 | |
| 185 | /* Perform a small write. */ |
| 186 | configured = 0; |
| 187 | small_write: |
| 188 | ret = dbgp_bulk_write_x(&pipe[DBGP_CONSOLE_EPOUT], "USB\r\n",5); |
| 189 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 190 | printk(BIOS_INFO, "dbgp_bulk_write failed: %d\n", ret); |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 191 | if (!configured) { |
| 192 | /* Send Set Configure request to device. This is required for FX2 |
| 193 | (CY7C68013) to transfer from USB state Addressed to Configured, |
| 194 | only then endpoints other than 0 are enabled. */ |
| 195 | if (dbgp_control_msg(ehci_debug, USB_DEBUG_DEVNUM, |
| 196 | USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
| 197 | USB_REQ_SET_CONFIGURATION, 1, 0, NULL, 0) >= 0) { |
| 198 | configured = 1; |
| 199 | goto small_write; |
| 200 | } |
| 201 | } |
| 202 | return -4; |
| 203 | } |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 204 | printk(BIOS_INFO, "Test write done\n"); |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 205 | return 0; |
| 206 | } |
| 207 | |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 208 | /* FTDI FT232H UART programming. */ |
| 209 | #define FTDI_SIO_SET_FLOW_CTRL_REQUEST 0x02 |
| 210 | #define FTDI_SIO_SET_BAUDRATE_REQUEST 0x03 |
| 211 | #define FTDI_SIO_SET_DATA_REQUEST 0x04 |
| 212 | #define FTDI_SIO_SET_BITMODE_REQUEST 0x0b |
| 213 | |
Nico Huber | c868fd1 | 2016-11-18 20:11:43 +0100 | [diff] [blame] | 214 | /* Simplified divisor selection for 12MHz base clock only */ |
| 215 | static void ft232h_baud(u16 *const value, u16 *const index, u32 baud) |
| 216 | { |
| 217 | static const u32 fraction_map[8] = { 0, 3, 2, 4, 1, 5, 6, 7 }; |
| 218 | |
| 219 | /* divisor must fit into 14 bits */ |
| 220 | if (baud < 733) |
| 221 | baud = 733; |
| 222 | |
| 223 | /* divisor is given as a fraction of 8 */ |
| 224 | const u32 div8 = ((12 * 1000 * 1000) * 8) / baud; |
| 225 | /* upper 3 bits fractional part, lower 14 bits integer */ |
| 226 | u32 div = fraction_map[div8 & 7] << 14 | div8 / 8; |
| 227 | |
| 228 | /* special case for 12MHz */ |
| 229 | if (div == 1) |
| 230 | div = 0; |
| 231 | /* special case for 8MHz */ |
| 232 | else if (div == (fraction_map[4] << 14 | 1)) |
| 233 | div = 1; |
| 234 | |
| 235 | *value = div; /* divisor lower 16 bits */ |
| 236 | *index = (div >> 8) & 0x0100; /* divisor bit 16 */ |
| 237 | *index |= 0x0200; /* select 120MHz / 10 */ |
| 238 | } |
| 239 | |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 240 | static int probe_for_ftdi(struct ehci_dbg_port *ehci_debug, struct dbgp_pipe *pipe) |
| 241 | { |
| 242 | int ret; |
| 243 | u8 devnum = 0; |
| 244 | u8 uart_if = 1; /* FTDI_INTERFACE_A 1 */ |
Nico Huber | c868fd1 | 2016-11-18 20:11:43 +0100 | [diff] [blame] | 245 | u16 baud_value, baud_index; |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 246 | |
| 247 | /* Move the device to 127 if it isn't already there */ |
| 248 | ret = dbgp_control_msg(ehci_debug, devnum, |
| 249 | USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
| 250 | USB_REQ_SET_ADDRESS, USB_DEBUG_DEVNUM, 0, NULL, 0); |
| 251 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 252 | printk(BIOS_INFO, "Could not move attached device to %d.\n", |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 253 | USB_DEBUG_DEVNUM); |
| 254 | return -2; |
| 255 | } |
| 256 | devnum = USB_DEBUG_DEVNUM; |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 257 | printk(BIOS_INFO, "EHCI debug device renamed to %d.\n", devnum); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 258 | |
| 259 | /* Send Set Configure request to device. */ |
| 260 | ret = dbgp_control_msg(ehci_debug, devnum, |
| 261 | USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
| 262 | USB_REQ_SET_CONFIGURATION, 1, 0, NULL, 0); |
| 263 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 264 | printk(BIOS_INFO, "FTDI set configuration failed.\n"); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 265 | return -2; |
| 266 | } |
| 267 | |
| 268 | ret = dbgp_control_msg(ehci_debug, devnum, |
| 269 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
| 270 | FTDI_SIO_SET_BITMODE_REQUEST, 0, uart_if, NULL, 0); |
| 271 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 272 | printk(BIOS_INFO, "FTDI SET_BITMODE failed.\n"); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 273 | return -3; |
| 274 | } |
Nico Huber | c868fd1 | 2016-11-18 20:11:43 +0100 | [diff] [blame] | 275 | ft232h_baud(&baud_value, &baud_index, |
| 276 | CONFIG_USBDEBUG_DONGLE_FTDI_FT232H_BAUD); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 277 | ret = dbgp_control_msg(ehci_debug, devnum, |
| 278 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
| 279 | FTDI_SIO_SET_BAUDRATE_REQUEST, |
Nico Huber | c868fd1 | 2016-11-18 20:11:43 +0100 | [diff] [blame] | 280 | baud_value, baud_index | uart_if, NULL, 0); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 281 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 282 | printk(BIOS_INFO, "FTDI SET_BAUDRATE failed.\n"); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 283 | return -3; |
| 284 | } |
| 285 | ret = dbgp_control_msg(ehci_debug, devnum, |
| 286 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
| 287 | FTDI_SIO_SET_DATA_REQUEST, |
| 288 | 0x0008, uart_if, NULL, 0); |
| 289 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 290 | printk(BIOS_INFO, "FTDI SET_DATA failed.\n"); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 291 | return -3; |
| 292 | } |
| 293 | ret = dbgp_control_msg(ehci_debug, devnum, |
| 294 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
| 295 | FTDI_SIO_SET_FLOW_CTRL_REQUEST, |
| 296 | 0x0000, uart_if, NULL, 0); |
| 297 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 298 | printk(BIOS_INFO, "FTDI SET_FLOW_CTRL failed.\n"); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 299 | return -3; |
| 300 | } |
| 301 | |
| 302 | pipe[DBGP_CONSOLE_EPOUT].endpoint = 0x02; |
| 303 | pipe[DBGP_CONSOLE_EPIN].endpoint = 0x81; |
| 304 | |
| 305 | ack_set_configuration(pipe, devnum, 1000); |
| 306 | |
| 307 | /* Perform a small write. */ |
| 308 | ret = dbgp_bulk_write_x(&pipe[DBGP_CONSOLE_EPOUT], "USB\r\n", 5); |
| 309 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 310 | printk(BIOS_INFO, "dbgp_bulk_write failed: %d\n", ret); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 311 | return -4; |
| 312 | } |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 313 | printk(BIOS_INFO, "Test write done\n"); |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 314 | return 0; |
| 315 | } |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 316 | |
| 317 | int dbgp_probe_gadget(struct ehci_dbg_port *ehci_debug, struct dbgp_pipe *pipe) |
| 318 | { |
| 319 | int ret; |
| 320 | |
| 321 | if (CONFIG_USBDEBUG_OPTIONAL_HUB_PORT != 0) { |
| 322 | ret = dbgp_hub_enable(ehci_debug, USB_DEBUG_DEVNUM-1, |
| 323 | CONFIG_USBDEBUG_OPTIONAL_HUB_PORT); |
| 324 | if (ret < 0) { |
| 325 | printk(BIOS_INFO, "Could not enable USB hub on debug port.\n"); |
| 326 | return ret; |
| 327 | } |
| 328 | } |
| 329 | |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 330 | if (CONFIG(USBDEBUG_DONGLE_FTDI_FT232H)) { |
Kyösti Mälkki | cc4d309 | 2015-05-03 06:27:11 +0300 | [diff] [blame] | 331 | ret = probe_for_ftdi(ehci_debug, pipe); |
| 332 | } else { |
| 333 | ret = probe_for_debug_descriptor(ehci_debug, pipe); |
| 334 | } |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 335 | if (ret < 0) { |
Elyes HAOUAS | e7b96c3 | 2022-01-26 14:33:47 +0100 | [diff] [blame^] | 336 | printk(BIOS_INFO, "Could not enable debug dongle.\n"); |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 337 | return ret; |
| 338 | } |
| 339 | |
| 340 | activate_endpoints(pipe); |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 341 | return 0; |
| 342 | } |