| 1 | #ifndef __BDK_HAL_USB_H__ |
| 2 | #define __BDK_HAL_USB_H__ |
| 3 | /***********************license start*********************************** |
| 4 | * Copyright (c) 2003-2017 Cavium Inc. ([email protected]). All rights |
| 5 | * reserved. |
| 6 | * |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions are |
| 10 | * met: |
| 11 | * |
| 12 | * * Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * |
| 15 | * * Redistributions in binary form must reproduce the above |
| 16 | * copyright notice, this list of conditions and the following |
| 17 | * disclaimer in the documentation and/or other materials provided |
| 18 | * with the distribution. |
| 19 | * |
| 20 | * * Neither the name of Cavium Inc. nor the names of |
| 21 | * its contributors may be used to endorse or promote products |
| 22 | * derived from this software without specific prior written |
| 23 | * permission. |
| 24 | * |
| 25 | * This Software, including technical data, may be subject to U.S. export |
| 26 | * control laws, including the U.S. Export Administration Act and its |
| 27 | * associated regulations, and may be subject to export or import |
| 28 | * regulations in other countries. |
| 29 | * |
| 30 | * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
| 31 | * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR |
| 32 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT |
| 33 | * TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY |
| 34 | * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT |
| 35 | * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES |
| 36 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR |
| 37 | * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, |
| 38 | * QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK |
| 39 | * ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. |
| 40 | ***********************license end**************************************/ |
| 41 | |
| 42 | /** |
| 43 | * @file |
| 44 | * |
| 45 | * Interface to USB3 or USB2. |
| 46 | * |
| 47 | * <hr>$Revision: 49448 $<hr> |
| 48 | * |
| 49 | * @addtogroup hal |
| 50 | * @{ |
| 51 | */ |
| 52 | |
| 53 | typedef enum |
| 54 | { |
| 55 | BDK_USB_TEST_USB2_DISABLE, |
| 56 | BDK_USB_TEST_USB2_J_STATE, |
| 57 | BDK_USB_TEST_USB2_K_STATE, |
| 58 | BDK_USB_TEST_USB2_SE0_NAK, |
| 59 | BDK_USB_TEST_USB2_PACKET, |
| 60 | BDK_USB_TEST_USB2_FORCE_ENABLE, |
| 61 | BDK_USB_XHCI_INIT, |
| 62 | BDK_USB_XHCI_LIST_ADDRESSES, |
| 63 | BDK_USB_XHCI_POLL_STATUS, |
| 64 | BDK_USB_XHCI_TOGGLE_POLLING, |
| 65 | BDK_USB_TEST_USB2_LAST, |
| 66 | } bdk_usb_test_t; |
| 67 | |
| 68 | typedef enum |
| 69 | { |
| 70 | BDK_USB_CLOCK_SS_PAD_HS_PAD = 0x0, /* Superspeed and high speed use PAD clock */ |
| 71 | BDK_USB_CLOCK_SS_REF0_HS_REF0 = 0x1, /* Superspeed and high speed use DLM/QLM ref clock 0 */ |
| 72 | BDK_USB_CLOCK_SS_REF1_HS_REF1 = 0x2, /* Superspeed and high speed use DLM/QLM ref clock 1 */ |
| 73 | BDK_USB_CLOCK_SS_PAD_HS_PLL = 0x3, /* Superspeed uses PAD clock, high speed uses PLL ref clock */ |
| 74 | BDK_USB_CLOCK_SS_REF0_HS_PLL = 0x4, /* Superspeed uses DLM/QLM ref clock 0, high speed uses PLL ref clock */ |
| 75 | BDK_USB_CLOCK_SS_REF1_HS_PLL = 0x5, /* Superspeed uses DLM/QLM ref clock 1, high speed uses PLL ref clock */ |
| 76 | } bdk_usb_clock_t; |
| 77 | |
| 78 | /** |
| 79 | * Initialize the clocks for USB such that it is ready for a generic XHCI driver |
| 80 | * |
| 81 | * @param node Node to init |
| 82 | * @param usb_port Port to intialize |
| 83 | * @param clock_type Type of clock connected to the usb port |
| 84 | * |
| 85 | * @return Zero on success, negative on failure |
| 86 | */ |
| 87 | int bdk_usb_initialize(bdk_node_t node, int usb_port, bdk_usb_clock_t clock_type); |
| 88 | |
| 89 | /** |
| 90 | * Put the USB port into a specific testing mode |
| 91 | * |
| 92 | * @param node Node to use |
| 93 | * @param usb_port Port to use |
| 94 | * @param test_mode USB test mode |
| 95 | * |
| 96 | * @return Zero on success, negative on failure |
| 97 | */ |
| 98 | int bdk_usb_test_mode(bdk_node_t node, int usb_port, bdk_usb_test_t test_mode); |
| 99 | |
| 100 | /** |
| 101 | * Convert a USB test enumeration into a string for display to the user |
| 102 | * |
| 103 | * @param node Node to use |
| 104 | * @param usb_port Port to use |
| 105 | * @param test_mode Mode to convert |
| 106 | * |
| 107 | * @return String name of test |
| 108 | */ |
| 109 | const char *bdk_usb_get_test_mode_string(bdk_node_t node, int usb_port, bdk_usb_test_t test_mode); |
| 110 | |
| 111 | /** @} */ |
| 112 | #endif |