OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2007-2009 NVIDIA Corporation. |
| 3 * All rights reserved. |
| 4 * |
| 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: |
| 7 * |
| 8 * Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. |
| 10 * |
| 11 * Redistributions in binary form must reproduce the above copyright notice, |
| 12 * this list of conditions and the following disclaimer in the documentation |
| 13 * and/or other materials provided with the distribution. |
| 14 * |
| 15 * Neither the name of the NVIDIA Corporation nor the names of its contributors |
| 16 * may be used to endorse or promote products derived from this software |
| 17 * without specific prior written permission. |
| 18 * |
| 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 * POSSIBILITY OF SUCH DAMAGE. |
| 30 * |
| 31 */ |
| 32 |
| 33 /** |
| 34 * @file |
| 35 * <b>NVIDIA Tegra ODM Kit: |
| 36 * ODM Peripheral Discovery API</b> |
| 37 * |
| 38 * @b Description: Defines a query interface for enumerating peripherals |
| 39 * and the board-specific topology that may be called during |
| 40 * boot and at run-time. |
| 41 */ |
| 42 |
| 43 #ifndef INCLUDED_NVODM_QUERY_DISCOVERY_H |
| 44 #define INCLUDED_NVODM_QUERY_DISCOVERY_H |
| 45 |
| 46 /** |
| 47 * @defgroup nvodm_discovery ODM Peripheral Discovery Interface |
| 48 * |
| 49 * This is the ODM query interface allowing ODMs to specify the connectivity |
| 50 * of peripherals on their boards to I/Os on an NVIDIA® Application Processo
r |
| 51 * without modifying the driver libraries. |
| 52 * |
| 53 * All peripherals connected to the application processor are referenced by |
| 54 * their Global Unique Identifier code, or GUID. The GUID is an ODM-defined |
| 55 * 64-bit value (8-character code) that uniquely identifies each peripheral, |
| 56 * i.e., each peripheral will have exactly one GUID, and each GUID will refer |
| 57 * to exactly one peripheral. |
| 58 * |
| 59 * The implementation of this API is similar to a simple database: tables are |
| 60 * provided by the ODMs that, for every peripheral, define the peripheral's |
| 61 * GUID, and specify the bus, or set of buses, to which the peripheral is |
| 62 * connected. As an example, an audio codec peripheral with GUID 0 could be |
| 63 * connected to the application processor by DAP instance 0, I2C instance 1 |
| 64 * (address 0x80), and voltage rail 3. The functions provided by this API |
| 65 * provide facilities enabling the boot process and driver libraries to |
| 66 * enumerate the set of peripherals attached to a specific bus, the set of |
| 67 * peripherals with specific functionality (such as display outputs), and the |
| 68 * set of buses connected to a specific peripheral. |
| 69 * @ingroup nvodm_query |
| 70 * @{ |
| 71 */ |
| 72 |
| 73 #include "nvodm_modules.h" |
| 74 #include "nvodm_services.h" |
| 75 |
| 76 #if defined(__cplusplus) |
| 77 extern "C" |
| 78 { |
| 79 #endif |
| 80 |
| 81 /** |
| 82 * The NV_ODM_GUID macro is used to convert ASCII 8-character codes into the |
| 83 * 64-bit globally-unique identifiers that identify each peripheral. |
| 84 * |
| 85 * @note GUIDs beginning with the characters <b>nv</b>, <b>Nv</b>, <b>nV</b>, |
| 86 * and <b>NV</b> are reserved for use by NVIDIA; all other values may be |
| 87 * assigned by the ODM as desired. |
| 88 */ |
| 89 #define NV_ODM_GUID(a,b,c,d,e,f,g,h) \ |
| 90 ((NvU64) ((((a)&0xffULL)<<56ULL) | (((b)&0xffULL)<<48ULL) | \ |
| 91 (((c)&0xffULL)<<40ULL) | (((d)&0xffULL)<<32ULL) | \ |
| 92 (((e)&0xffULL)<<24ULL) | (((f)&0xffULL)<<16ULL) | \ |
| 93 (((g)&0xffULL)<< 8ULL) | (((h)&0xffULL)))) |
| 94 |
| 95 /** |
| 96 * Reserved GUIDs. |
| 97 */ |
| 98 #define NV_VDD_RTC_ODM_ID (NV_ODM_GUID('N','V','D','D','_','R','T','C')) |
| 99 #define NV_VDD_CORE_ODM_ID (NV_ODM_GUID('N','V','D','D','C','O','R','E')) |
| 100 #define NV_VDD_CPU_ODM_ID (NV_ODM_GUID('N','V','D','D','_','C','P','U')) |
| 101 |
| 102 #define NV_VDD_PLLA_ODM_ID (NV_ODM_GUID('N','V','D','D','P','L','L','A')) |
| 103 #define NV_VDD_PLLM_ODM_ID (NV_ODM_GUID('N','V','D','D','P','L','L','M')) |
| 104 #define NV_VDD_PLLP_ODM_ID (NV_ODM_GUID('N','V','D','D','P','L','L','P')) |
| 105 #define NV_VDD_PLLC_ODM_ID (NV_ODM_GUID('N','V','D','D','P','L','L','C')) |
| 106 #define NV_VDD_PLLD_ODM_ID (NV_ODM_GUID('N','V','D','D','P','L','L','D')) |
| 107 #define NV_VDD_PLLE_ODM_ID (NV_ODM_GUID('N','V','D','D','P','L','L','E')) |
| 108 #define NV_VDD_PLLU_ODM_ID (NV_ODM_GUID('N','V','D','D','P','L','L','U')) |
| 109 #define NV_VDD_PLLU1_ODM_ID (NV_ODM_GUID('N','V','D','P','L','L','U','1')) |
| 110 #define NV_VDD_PLLHDMI_ODM_ID (NV_ODM_GUID('N','V','D','P','L','L','H','D')) |
| 111 #define NV_VDD_OSC_ODM_ID (NV_ODM_GUID('N','V','D','D','_','O','S','C')) |
| 112 #define NV_VDD_PLLS_ODM_ID (NV_ODM_GUID('N','V','D','D','P','L','L','S')) |
| 113 #define NV_VDD_PLLX_ODM_ID (NV_ODM_GUID('N','V','D','D','P','L','L','X')) |
| 114 #define NV_VDD_PLL_USB_ODM_ID (NV_ODM_GUID('N','V','D','P','L','L','U','S')) |
| 115 #define NV_VDD_PLL_PEX_ODM_ID (NV_ODM_GUID('N','V','D','P','L','L','P','X')) |
| 116 |
| 117 #define NV_VDD_SYS_ODM_ID (NV_ODM_GUID('N','V','D','D','_','S','Y','S')) |
| 118 #define NV_VDD_USB_ODM_ID (NV_ODM_GUID('N','V','D','D','_','U','S','B')) |
| 119 #define NV_VDD_HDMI_ODM_ID (NV_ODM_GUID('N','V','D','D','H','D','M','I')) |
| 120 #define NV_VDD_MIPI_ODM_ID (NV_ODM_GUID('N','V','D','D','M','I','P','I')) |
| 121 #define NV_VDD_LCD_ODM_ID (NV_ODM_GUID('N','V','D','D','_','L','C','D')) |
| 122 #define NV_VDD_AUD_ODM_ID (NV_ODM_GUID('N','V','D','D','_','A','U','D')) |
| 123 #define NV_VDD_DDR_ODM_ID (NV_ODM_GUID('N','V','D','D','_','D','D','R')) |
| 124 #define NV_VDD_DDR_RX_ODM_ID (NV_ODM_GUID('N','V','D','D','D','R','R','X')) |
| 125 #define NV_VDD_NAND_ODM_ID (NV_ODM_GUID('N','V','D','D','N','A','N','D')) |
| 126 #define NV_VDD_UART_ODM_ID (NV_ODM_GUID('N','V','D','D','U','A','R','T')) |
| 127 #define NV_VDD_SDIO_ODM_ID (NV_ODM_GUID('N','V','D','D','S','D','I','O')) |
| 128 #define NV_VDD_VDAC_ODM_ID (NV_ODM_GUID('N','V','D','D','V','D','A','C')) |
| 129 #define NV_VDD_VI_ODM_ID (NV_ODM_GUID('N','V','D','D','_','_','V','I')) |
| 130 #define NV_VDD_BB_ODM_ID (NV_ODM_GUID('N','V','D','D','_','_','B','B')) |
| 131 #define NV_VDD_VBUS_ODM_ID (NV_ODM_GUID('N','V','D','D','V','B','U','S')) |
| 132 #define NV_VDD_USB2_VBUS_ODM_ID (NV_ODM_GUID('N','V','D','V','B','U','S','2')) |
| 133 #define NV_VDD_USB3_VBUS_ODM_ID (NV_ODM_GUID('N','V','D','V','B','U','S','3')) |
| 134 |
| 135 #define NV_VDD_HSIC_ODM_ID (NV_ODM_GUID('N','V','D','D','H','S','I','C')) |
| 136 #define NV_VDD_USB_IC_ODM_ID (NV_ODM_GUID('N','V','D','D','U','S','B','I')) |
| 137 #define NV_VDD_PEX_ODM_ID (NV_ODM_GUID('N','V','D','D','_','P','E','X')) |
| 138 #define NV_VDD_PEX_CLK_ODM_ID (NV_ODM_GUID('N','V','D','D','P','E','X','C')) |
| 139 #define NV_VDD_SoC_ODM_ID (NV_ODM_GUID('N','V','D','D','_','S','O','C')) |
| 140 |
| 141 #define NV_PMU_TRANSPORT_ODM_ID (NV_ODM_GUID('N','V','P','M','U','T','R','N')) |
| 142 |
| 143 /** |
| 144 * Some of the NVIDIA driver libraries enumerate peripherals based on the |
| 145 * logical functionality that the peripheral performs, rather than by the |
| 146 * bus that connects it. An example of this is the camera driver, which |
| 147 * enumerates all peripherals supporting camera functionality on an ODM's |
| 148 * system (depending on the target market, 0, 1, or multiple cameras may |
| 149 * be present). To support this abstract functionality-based query, each |
| 150 * peripheral is assigned a class based on the user-level functionality it |
| 151 * provides. |
| 152 */ |
| 153 typedef enum |
| 154 { |
| 155 /// Specifies a display output peripheral, such as an LCD or attached TV. |
| 156 NvOdmPeripheralClass_Display = 1, |
| 157 |
| 158 /// Specifies a camera (imager) input peripheral. |
| 159 NvOdmPeripheralClass_Imager, |
| 160 |
| 161 /// Specifies a mass-storage device, such as a NAND flash controller. |
| 162 NvOdmPeripheralClass_Storage, |
| 163 |
| 164 /// Specifies a human-computer input, such as a keypad or touch panel. |
| 165 NvOdmPeripheralClass_HCI, |
| 166 |
| 167 /// Specifies a peripheral that does not fall into the other classes. |
| 168 NvOdmPeripheralClass_Other, |
| 169 |
| 170 NvOdmPeripheralClass_Num, |
| 171 /// Ignore -- Forces compilers to make 32-bit enums. |
| 172 NvOdmPeripheralClass_Force32 = 0x7fffffffUL |
| 173 } NvOdmPeripheralClass; |
| 174 |
| 175 /** |
| 176 * Defines the unique address on a bus where a peripheral is connected. |
| 177 */ |
| 178 typedef struct |
| 179 { |
| 180 /// Specifies the type of bus or I/O (I2C, DAP, GPIO) for this connection. |
| 181 NvOdmIoModule Interface; |
| 182 |
| 183 /** |
| 184 * Some buses or I/Os on an application processor have multiple instances, |
| 185 * such as the 3 SPI controllers on AP15, or multiple GPIO ports. This |
| 186 * value specifies to which instance of a multi-instance bus is the |
| 187 * peripheral connected. The instance value should be the same value |
| 188 * passed to the instance parameter in the ODM service APIs (e.g., |
| 189 * NvOdmI2cOpen()). |
| 190 * |
| 191 * @note For GPIOs, this value refers to the GPIO port. |
| 192 */ |
| 193 NvU32 Instance; |
| 194 |
| 195 /** |
| 196 * Some buses, such as I2C and SPI, support multiple slave devices on |
| 197 * a single bus, through the use of peripheral addresses and/or chip |
| 198 * select signals. This value specifies the appropriate address or chip |
| 199 * select required to communicate with the peripheral. |
| 200 * |
| 201 * @note This value differs depending on usage: |
| 202 * - For GPIOs, this value specifies the GPIO pin. |
| 203 * - For VDDs, this value is ODM-defined PMU rail ID. |
| 204 * - For board designs where the LCD bus is connected to a main |
| 205 * display and sub-display (e.g., a clam-shell cellular phone), |
| 206 * address 0 should refer to the main panel, and 1 to the sub-panel. |
| 207 */ |
| 208 NvU32 Address; |
| 209 } NvOdmIoAddress; |
| 210 |
| 211 /** |
| 212 * Defines the full bus connectivity for peripherals connected to the |
| 213 * application processor. |
| 214 */ |
| 215 typedef struct |
| 216 { |
| 217 /// The ODM-defined 64-bit GUID that identifies this peripheral. |
| 218 NvU64 Guid; |
| 219 |
| 220 /** |
| 221 * The list of all I/Os and buses connecting this peripheral to the AP. |
| 222 * @see NvOdmIoAddress |
| 223 */ |
| 224 const NvOdmIoAddress *AddressList; |
| 225 |
| 226 /// The number of entries in the \a addressList array. |
| 227 NvU32 NumAddress; |
| 228 |
| 229 /// The functionality class of this peripheral. |
| 230 NvOdmPeripheralClass Class; |
| 231 } NvOdmPeripheralConnectivity; |
| 232 |
| 233 |
| 234 /// Defines different criteria for searching through the peripheral database. |
| 235 typedef enum |
| 236 { |
| 237 /// Searches for peripherals that are members of the specified class. |
| 238 NvOdmPeripheralSearch_PeripheralClass, |
| 239 |
| 240 /// Searches for peripherals connected to the specified I/O module. |
| 241 NvOdmPeripheralSearch_IoModule, |
| 242 |
| 243 /** |
| 244 * Searches for peripherals connected to the specified bus instance. |
| 245 * |
| 246 * @note This value will be compared against all entries in \a addressList. |
| 247 */ |
| 248 NvOdmPeripheralSearch_Instance, |
| 249 |
| 250 /** |
| 251 * Searches for peripherals matching the specified address or chip select. |
| 252 * |
| 253 * @note This value will be compared against all entries in \a addressList. |
| 254 */ |
| 255 NvOdmPeripheralSearch_Address, |
| 256 |
| 257 NvOdmPeripheralSearch_Num, |
| 258 /** Ignore -- Forces compilers to make 32-bit enums. */ |
| 259 NvOdmPeripheralSearch_Force32 = 0x7fffffffUL |
| 260 } NvOdmPeripheralSearch; |
| 261 |
| 262 /** |
| 263 * Defines the data structure that describes each sub-assembly of the |
| 264 * development platform. This data is read from EEPROMs on each of the sub- |
| 265 * assemblies, which is saved with the following format: |
| 266 * <pre> |
| 267 * E-xxxx-yyyy-0zz XN |
| 268 * </pre> |
| 269 * |
| 270 * Where: |
| 271 * |
| 272 * - xxxx is the board ID number 0-9999 (2 byte number) |
| 273 * - yyyy is the SKU number 0-9999 (2 byte number) |
| 274 * - zz is the FAB number 0-99 (1 byte number) |
| 275 * - X is the major revision, (1 byte ASCII character), e.g., 'A', 'B', etc. |
| 276 * - N is the minor revision, (1 byte number, 0 - 9) |
| 277 */ |
| 278 typedef struct |
| 279 { |
| 280 /// Specifies the board number. |
| 281 NvU16 BoardID; |
| 282 |
| 283 /// Specifies the SKU number. |
| 284 NvU16 SKU; |
| 285 |
| 286 /// Specifies the FAB number. |
| 287 NvU8 Fab; |
| 288 |
| 289 /// Specifies the part revision. |
| 290 NvU8 Revision; |
| 291 |
| 292 /// Specifies the minor revision level |
| 293 NvU8 MinorRevision; |
| 294 } NvOdmBoardInfo; |
| 295 |
| 296 /** |
| 297 * Searches through the database of connected peripherals for peripherals |
| 298 * matching the specified search criteria. |
| 299 * |
| 300 * Search criteria are supplied by paired attribute-value lists; if multiple |
| 301 * criteria are specified, the returned peripherals represent the intersection |
| 302 * (boolean AND) of the supplied search criteria. |
| 303 * |
| 304 * This function is expected to be called twice with the same search criteria. |
| 305 * In the first call, \a guidList should be NULL. The number of peripherals |
| 306 * matching the search criteria will be returned. |
| 307 * |
| 308 * In the second call, \a guidList should point to an array of NvU64s; the GUIDs |
| 309 * of up to \a numGuids peripherals matching the search critiera will be written |
| 310 * to \a guidList. The number of stored GUIDs will be returned. |
| 311 * |
| 312 * @param searchAttrs The array of search attributes (::NvOdmPeripheralSearch). |
| 313 * @param searchVals The array of values for each search attribute. |
| 314 * @param numCriteria The number of entries in the attribute-value lists. |
| 315 * @param guidList The array of output GUIDs. If NULL, no GUIDs are returned. |
| 316 * @param numGuids The number of entries in \a guidList. |
| 317 * @return The number of GUIDs written to \a guidList, or the total number of |
| 318 * peripherals matching the search criteria if \a guidList is NULL. |
| 319 */ |
| 320 NvU32 |
| 321 NvOdmPeripheralEnumerate( |
| 322 const NvOdmPeripheralSearch *searchAttrs, |
| 323 const NvU32 *searchVals, |
| 324 NvU32 numCriteria, |
| 325 NvU64 *guidList, |
| 326 NvU32 numGuids); |
| 327 |
| 328 /** |
| 329 * Searches through the database of connected peripherals for the peripheral |
| 330 * matching the specified GUID and returns that peripheral's connectivity |
| 331 * structure. |
| 332 * |
| 333 * @note If the ODM system supports hot-pluggable peripherals (e.g., an |
| 334 * external TV-out display), the connectivity structure should only be returned |
| 335 * when the peripheral is useable by the NVIDIA driver libraries. If hot-plug |
| 336 * detection is not supported, the peripheral's connectivity structure may |
| 337 * always be returned. |
| 338 * |
| 339 * @see NvOdmPeripheralConnectivity |
| 340 * |
| 341 * @param searchGuid The GUID value of the queried peripheral. |
| 342 * |
| 343 * @return A pointer to the peripheral's bus connectivity structure if a |
| 344 * peripheral matching \a searchGuid is found, or NULL if no peripheral is found
. |
| 345 */ |
| 346 const NvOdmPeripheralConnectivity * |
| 347 NvOdmPeripheralGetGuid(NvU64 searchGuid); |
| 348 |
| 349 /** |
| 350 * Gets the ::NvOdmBoardInfo data structure values for the given board ID. |
| 351 * |
| 352 * @param BoardId Identifies the board for which the BoardInfo data is to be ret
rieved. |
| 353 * @note The \a BoardId is in Binary Encoded Decimal (BCD) format. For example, |
| 354 * E920 is identified by a \a BoardId of 0x0920 and E9820 would be 0x9820. |
| 355 * @param pBoardInfo A pointer to the location where the requested \a BoardInfo
data |
| 356 * shall be saved. |
| 357 * |
| 358 * @return NV_TRUE if successful, or NV_FALSE otherwise. |
| 359 */ |
| 360 NvBool |
| 361 NvOdmPeripheralGetBoardInfo( |
| 362 NvU16 BoardId, |
| 363 NvOdmBoardInfo* pBoardInfo); |
| 364 |
| 365 #if defined(__cplusplus) |
| 366 } |
| 367 #endif |
| 368 |
| 369 /** @} */ |
| 370 |
| 371 #endif // INCLUDED_NVODM_QUERY_DISCOVERY_H |
OLD | NEW |