1 /* 2 * Copyright (c) 2015 - 2016, Freescale Semiconductor, Inc. 3 * Copyright 2016 - 2019 NXP 4 * All rights reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef _USB_HOST_CONFIG_H_ 10 #define _USB_HOST_CONFIG_H_ 11 12 /* Host Controller Enable */ 13 /*! 14 * @brief host khci instance count, meantime it indicates khci enable or disable. 15 * - if 0, host khci driver is disable. 16 * - if greater than 0, host khci driver is enable. 17 */ 18 #define USB_HOST_CONFIG_KHCI (0U) 19 20 /*! 21 * @brief host ehci instance count, meantime it indicates ehci enable or disable. 22 * - if 0, host ehci driver is disable. 23 * - if greater than 0, host ehci driver is enable. 24 */ 25 #define USB_HOST_CONFIG_EHCI (1U) 26 27 /*! 28 * @brief host ohci instance count, meantime it indicates ohci enable or disable. 29 * - if 0, host ohci driver is disable. 30 * - if greater than 0, host ohci driver is enable. 31 */ 32 #define USB_HOST_CONFIG_OHCI (0U) 33 34 /*! 35 * @brief host ip3516hs instance count, meantime it indicates ohci enable or disable. 36 * - if 0, host ip3516hs driver is disable. 37 * - if greater than 0, host ip3516hs driver is enable. 38 */ 39 #define USB_HOST_CONFIG_IP3516HS (0U) 40 41 /* Common configuration macros for all controllers */ 42 43 /*! 44 * @brief host driver instance max count. 45 * for example: 2 - one for khci, one for ehci. 46 */ 47 #define USB_HOST_CONFIG_MAX_HOST \ 48 (USB_HOST_CONFIG_KHCI + USB_HOST_CONFIG_EHCI + USB_HOST_CONFIG_OHCI + USB_HOST_CONFIG_IP3516HS) 49 50 /*! 51 * @brief host pipe max count. 52 * pipe is the host driver resource for device endpoint, one endpoint need one pipe. 53 */ 54 #define USB_HOST_CONFIG_MAX_PIPES (16U) 55 56 /*! 57 * @brief host transfer max count. 58 * transfer is the host driver resource for data transmission mission, one transmission mission need one transfer. 59 */ 60 #define USB_HOST_CONFIG_MAX_TRANSFERS (16U) 61 62 /*! 63 * @brief the max endpoint for one interface. 64 * the max endpoint descriptor number that one interface descriptor contain. 65 */ 66 #define USB_HOST_CONFIG_INTERFACE_MAX_EP (4U) 67 68 /*! 69 * @brief the max interface for one configuration. 70 * the max interface descriptor number that one configuration descriptor can contain. 71 */ 72 #define USB_HOST_CONFIG_CONFIGURATION_MAX_INTERFACE (5U) 73 74 /*! 75 * @brief the max power for one device. 76 * the max power the host can provide for one device. 77 */ 78 #define USB_HOST_CONFIG_MAX_POWER (250U) 79 80 /*! 81 * @brief the max retries for enumeration. 82 * retry time when enumeration fail. 83 */ 84 #define USB_HOST_CONFIG_ENUMERATION_MAX_RETRIES (3U) 85 86 /*! 87 * @brief the max retries for enumeration setup stall. 88 * the max times for one transfer can stall. 89 */ 90 #define USB_HOST_CONFIG_ENUMERATION_MAX_STALL_RETRIES (1U) 91 92 /*! 93 * @brief the max NAK count for one transaction. 94 * when nak count reach to the value, the transaction fail. 95 */ 96 #define USB_HOST_CONFIG_MAX_NAK (3000U) 97 98 /*! @brief Whether the transfer buffer is cache-enabled or not. */ 99 #ifndef USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE 100 #define USB_HOST_CONFIG_BUFFER_PROPERTY_CACHEABLE (0U) 101 #endif 102 /*! @brief if 1, enable usb compliance test codes; if 0, disable usb compliance test codes. */ 103 #ifndef USB_HOST_CONFIG_COMPLIANCE_TEST 104 #define USB_HOST_CONFIG_COMPLIANCE_TEST (0U) 105 #endif 106 107 /*! @brief if 1, class driver clear stall automatically; if 0, class driver don't clear stall. */ 108 #define USB_HOST_CONFIG_CLASS_AUTO_CLEAR_STALL (0U) 109 110 /* KHCI configuration */ 111 #if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI)) 112 113 /*! 114 * @brief khci dma align fix buffer size. 115 */ 116 #define USB_HOST_CONFIG_KHCI_DMA_ALIGN_BUFFER (64U) 117 118 #endif 119 120 /* EHCI configuration */ 121 #if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI)) 122 123 /*! 124 * @brief ehci periodic frame list size. 125 * the value can be 1024, 512, 256, 128, 64, 32, 16 or 8. 126 */ 127 #define USB_HOST_CONFIG_EHCI_FRAME_LIST_SIZE (1024U) 128 129 /*! 130 * @brief ehci QH max count. 131 */ 132 #define USB_HOST_CONFIG_EHCI_MAX_QH (8U) 133 134 /*! 135 * @brief ehci QTD max count. 136 */ 137 #define USB_HOST_CONFIG_EHCI_MAX_QTD (8U) 138 139 /*! 140 * @brief ehci ITD max count. 141 */ 142 #define USB_HOST_CONFIG_EHCI_MAX_ITD (0U) 143 144 /*! 145 * @brief ehci SITD max count. 146 */ 147 #define USB_HOST_CONFIG_EHCI_MAX_SITD (0U) 148 149 #endif 150 151 /* OHCI configuration */ 152 #if ((defined USB_HOST_CONFIG_OHCI) && (USB_HOST_CONFIG_OHCI)) 153 154 /*! 155 * @brief ohci ED max count. 156 */ 157 #define USB_HOST_CONFIG_OHCI_MAX_ED (16U) 158 159 /*! 160 * @brief ohci GTD max count. 161 */ 162 #define USB_HOST_CONFIG_OHCI_MAX_GTD (16U) 163 164 /*! 165 * @brief ohci ITD max count. 166 */ 167 #define USB_HOST_CONFIG_OHCI_MAX_ITD (8U) 168 169 #endif 170 171 /* OHCI configuration */ 172 #if ((defined USB_HOST_CONFIG_IP3516HS) && (USB_HOST_CONFIG_IP3516HS)) 173 174 #define USB_HOST_CONFIG_IP3516HS_MAX_PIPE (32U) 175 176 /*! 177 * @brief ohci ED max count. 178 */ 179 #define USB_HOST_CONFIG_IP3516HS_MAX_ATL (32U) 180 181 /*! 182 * @brief ohci GTD max count. 183 */ 184 #define USB_HOST_CONFIG_IP3516HS_MAX_INT (32U) 185 186 /*! 187 * @brief ohci ITD max count. 188 */ 189 #define USB_HOST_CONFIG_IP3516HS_MAX_ISO (0U) 190 191 #endif 192 193 /*! 194 * @brief host HUB class instance count, meantime it indicates HUB class enable or disable. 195 * - if 0, host HUB class driver is disable. 196 * - if greater than 0, host HUB class driver is enable. 197 */ 198 #define USB_HOST_CONFIG_HUB (0U) 199 200 /*! 201 * @brief host HID class instance count, meantime it indicates HID class enable or disable. 202 * - if 0, host HID class driver is disable. 203 * - if greater than 0, host HID class driver is enable. 204 */ 205 #define USB_HOST_CONFIG_HID (0U) 206 207 /*! 208 * @brief host MSD class instance count, meantime it indicates MSD class enable or disable. 209 * - if 0, host MSD class driver is disable. 210 * - if greater than 0, host MSD class driver is enable. 211 */ 212 #define USB_HOST_CONFIG_MSD (0U) 213 214 /*! 215 * @brief host CDC class instance count, meantime it indicates CDC class enable or disable. 216 * - if 0, host CDC class driver is disable. 217 * - if greater than 0, host CDC class driver is enable. 218 */ 219 #define USB_HOST_CONFIG_CDC (0U) 220 221 /*! 222 * @brief host AUDIO class instance count, meantime it indicates AUDIO class enable or disable. 223 * - if 0, host AUDIO class driver is disable. 224 * - if greater than 0, host AUDIO class driver is enable. 225 */ 226 #define USB_HOST_CONFIG_AUDIO (0U) 227 228 /*! 229 * @brief host PHDC class instance count, meantime it indicates PHDC class enable or disable. 230 * - if 0, host PHDC class driver is disable. 231 * - if greater than 0, host PHDC class driver is enable. 232 */ 233 #define USB_HOST_CONFIG_PHDC (0U) 234 235 /*! 236 * @brief host printer class instance count, meantime it indicates printer class enable or disable. 237 * - if 0, host printer class driver is disable. 238 * - if greater than 0, host printer class driver is enable. 239 */ 240 #define USB_HOST_CONFIG_PRINTER (0U) 241 242 /*! 243 * @brief host charger detect enable or disable. It is only supported on RT600 currently. 244 * - if 0, host charger detect is disable. 245 * - if greater than 0, host charger detect is enable. 246 */ 247 #define USB_HOST_CONFIG_BATTERY_CHARGER (0U) 248 #endif /* _USB_HOST_CONFIG_H_ */ 249