Kyösti Mälkki | cb141bc | 2014-02-07 19:24:23 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007 AMD |
| 5 | * Written by Yinghai Lu <yinghai.lu@amd.com> for AMD. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Kyösti Mälkki | cb141bc | 2014-02-07 19:24:23 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef _EHCI_DEBUG_H_ |
| 18 | #define _EHCI_DEBUG_H_ |
| 19 | |
Kyösti Mälkki | ea6736a | 2014-02-10 00:00:44 +0200 | [diff] [blame] | 20 | #include <types.h> |
| 21 | |
Kyösti Mälkki | cb141bc | 2014-02-07 19:24:23 +0200 | [diff] [blame] | 22 | void usbdebug_re_enable(unsigned ehci_base); |
| 23 | void usbdebug_disable(void); |
| 24 | |
Kyösti Mälkki | 6f6a249 | 2014-02-09 19:21:30 +0200 | [diff] [blame] | 25 | /* Returns 0 on success and sets MMIO base and dbg_offset if EHCI debug |
| 26 | * capability was found and enabled. Returns non-zero on error. |
| 27 | */ |
| 28 | int ehci_debug_hw_enable(unsigned *base, unsigned *dbg_offset); |
Kyösti Mälkki | cb141bc | 2014-02-07 19:24:23 +0200 | [diff] [blame] | 29 | void ehci_debug_select_port(unsigned int port); |
| 30 | |
Kyösti Mälkki | 8cde852 | 2014-02-09 23:35:39 +0200 | [diff] [blame] | 31 | #define DBGP_EP_VALID (1<<0) |
| 32 | #define DBGP_EP_ENABLED (1<<1) |
| 33 | #define DBGP_EP_BUSY (1<<2) |
| 34 | #define DBGP_EP_STATMASK (DBGP_EP_VALID | DBGP_EP_ENABLED) |
| 35 | |
Kyösti Mälkki | 46249be2 | 2014-10-27 14:07:28 +0200 | [diff] [blame] | 36 | #define DBGP_MAX_ENDPOINTS 4 |
| 37 | #define DBGP_SETUP_EP0 0 /* Compulsory endpoint 0. */ |
| 38 | #define DBGP_CONSOLE_EPOUT 1 |
| 39 | #define DBGP_CONSOLE_EPIN 2 |
| 40 | |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 41 | struct ehci_dbg_port; |
| 42 | |
Kyösti Mälkki | 8cde852 | 2014-02-09 23:35:39 +0200 | [diff] [blame] | 43 | struct dbgp_pipe |
| 44 | { |
| 45 | u8 devnum; |
| 46 | u8 endpoint; |
| 47 | u8 pid; |
| 48 | u8 status; |
| 49 | int timeout; |
| 50 | |
| 51 | u8 bufidx; |
| 52 | u8 buflen; |
| 53 | char buf[8]; |
| 54 | }; |
| 55 | |
| 56 | void dbgp_put(struct dbgp_pipe *pipe); |
| 57 | int dbgp_try_get(struct dbgp_pipe *pipe); |
| 58 | |
Kyösti Mälkki | ea6736a | 2014-02-10 00:00:44 +0200 | [diff] [blame] | 59 | struct dbgp_pipe *dbgp_console_output(void); |
| 60 | struct dbgp_pipe *dbgp_console_input(void); |
| 61 | int dbgp_ep_is_active(struct dbgp_pipe *pipe); |
| 62 | int dbgp_bulk_write_x(struct dbgp_pipe *pipe, const char *bytes, int size); |
| 63 | int dbgp_bulk_read_x(struct dbgp_pipe *pipe, void *data, int size); |
| 64 | |
Kyösti Mälkki | 83fe6d7 | 2014-02-25 20:11:52 +0200 | [diff] [blame] | 65 | int dbgp_control_msg(struct ehci_dbg_port *ehci_debug, unsigned devnum, |
| 66 | int requesttype, int request, int value, int index, void *data, int size); |
| 67 | void dbgp_mdelay(int ms); |
| 68 | |
| 69 | int dbgp_probe_gadget(struct ehci_dbg_port *ehci_debug, struct dbgp_pipe *pipe); |
| 70 | |
Kyösti Mälkki | cb141bc | 2014-02-07 19:24:23 +0200 | [diff] [blame] | 71 | #endif /* _EHCI_DEBUG_H_ */ |