NVIDIA DRIVE OS Linux API Reference

5.1.0.2 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
qspi.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 
18 #ifndef _QB_QSPI_H_
19 #define _QB_QSPI_H_
20 
29 #include <device.h>
30 #include <nvcommon.h>
31 #include <nverror.h>
32 
33 // Enable this to print debug messages.
34 // #define DEBUG_QSPI 1
35 
36 #define DEBUG_QSPI 0
37 #if DEBUG_QSPI
38 #define PRINT_QSPI_DBG_MESSAGES(...) pr_info(__VA_ARGS__)
39 #define PRINT_QSPI_REG_ACCESS(...) pr_info(__VA_ARGS__)
40 #else
41 #define PRINT_QSPI_DBG_MESSAGES(...)
42 #define PRINT_QSPI_REG_ACCESS(...)
43 #endif
44 
45 #ifdef CONFIG_T19x
46 #define QSPI_CONTROLLERS_MAX 2
47 #else
48 #define QSPI_CONTROLLERS_MAX 1
49 #endif
50 
56 };
57 
58 #define QSPI_MAX_BIT_LENGTH 31
59 #define QSPI_8Bit_BIT_LENGTH 7
60 #define QSPI_FIFO_DEPTH 64
61 #define BYTES_PER_WORD 4
62 
64 #define QSPI_HW_TIMEOUT 100000
65 
67 typedef enum
68 {
72 
74 typedef enum
75 {
76  SYNC,
79 
80 
82 typedef enum {
83  SDR_MODE = 0,
85 } QspiOpMode_t;
86 
90 typedef struct QspiTransfer
91 {
92  NvU8 *Txbuf;
93  NvU8 *Rxbuf;
94  NvU32 Mode;
95  NvU32 Writelen;
96  NvU32 Readlen;
97  NvU32 Speed_hz;
98  NvU32 BusWidth;
99  NvU32 DummyCycles;
102 } QspiTransfer;
103 
105 typedef struct
106 {
107  NvU32 Instance;
108  NvU32 BaseAddr;
109 
114  NvU32 DmaChannel;
115  NvU32 DmaClient;
118 
122 
125  NvU32 CyclesBwPkts;
128  NvU32 QuadState;
129 
131  QspiTransfer Transfers[3];
133 
141 NvError NvQspiInit(void *pdata);
142 
151 NvError
152 QspiHwProcReadAsyncWaitDMAComplete(NvU32 Instance);
153 
165 NvError
167  QspiTransfer *Transfers,
168  NvU8 Numoftransfers,
169  NvU32 Instance);
170 
178 void NvQspiShutdown(NvU32 Instance);
179 
187 void QspiDumpRegisters(NvU32 Instance);
188 
189 #endif /* _QB_QSPI_H_ */
190 
NvU32 QuadState
Quad state.
Definition: qspi.h:128
QspiOpMode_t OpMode
DDR or SDR mode taken from the DT/ board file.
Definition: qspi.h:113
NvU32 Mode
QSPI X1 or X2 or X4 xfer mode.
Definition: qspi.h:94
=0
Definition: qspi.h:76
=1
Definition: qspi.h:77
NvU32 ChipSelectLevel
CS assert level, Active Low or Active High.
Definition: qspi.h:121
Holds QSPI Transfer data.
Definition: qspi.h:90
NvError NvQspiTransaction(QspiTransfer *Transfers, NvU8 Numoftransfers, NvU32 Instance)
Performs QSPI transactions for write and read.
struct QspiTransfer QspiTransfer
Holds QSPI Transfer data.
NvU32 Instance
QSPI hardware controller instance.
Definition: qspi.h:107
NvU8 * Txbuf
TX buffer address.
Definition: qspi.h:92
Holds QSPI hardware controller context data.
Definition: qspi.h:105
NvU8 * Rxbuf
RX buffer address.
Definition: qspi.h:93
NvU32 CyclesBwPkts
Idle clock cycles between two packets.
Definition: qspi.h:125
QspiOpMode_t OpMode
DDR or SDR mode of xfer.
Definition: qspi.h:101
NvU32 ReadStartTimeinUs
Time at which the read xfer is started.
Definition: qspi.h:116
1 [IO on rising and falling edge of clock]
Definition: qspi.h:84
QspiXferType_t
Defines the transfer types.
Definition: qspi.h:74
QspiBusWidth
Defines the QSPI bus widths.
Definition: qspi.h:52
QspiOpMode_t
Defines the QSPI controller and Flash chip operating mode.
Definition: qspi.h:82
void NvQspiShutdown(NvU32 Instance)
Shuts down the QSPI controller.
NvU32 CSActiveBwPkts
For software type CS, 1 enables the CS.
Definition: qspi.h:124
NvU32 BaseAddr
QSPI hardware register base address.
Definition: qspi.h:108
NvU32 BusWidth
QSPI controller FIFO width.
Definition: qspi.h:98
NVIDIA Quickboot Interface: Error Handling (Parker)
NvU32 RxClkTapDelay
Rx TAP delay for sampling data.
Definition: qspi.h:127
NvU32 Writelen
TX length.
Definition: qspi.h:95
NvU32 DummyCycles
Clock cycles between two transaction.
Definition: qspi.h:99
NvU32 DmaClient
Time at which the read xfer is started.
Definition: qspi.h:115
NvU32 WriteStartTimeinUs
Time at which the write xfer is started.
Definition: qspi.h:117
0 [IO on single edge of clock]
Definition: qspi.h:83
NvU32 Speed_hz
QSPI clock frequency.
Definition: qspi.h:97
NVIDIA Quickboot Interface: Device Drivers
NvU32 DmaChannel
GPCDMA channel number if DMA is enabled for QSPI IO.
Definition: qspi.h:114
QspiXferType_t type
ASYNC or SYNC xfer.
Definition: qspi.h:100
NvQspiChipSelect
Defines the QSPI chip selection.
Definition: qspi.h:67
NvU32 TxClkTapDelay
Tx TAP delay for sampling data.
Definition: qspi.h:126
NvError NvQspiInit(void *pdata)
Initializes the specified QSPI controller.
void QspiDumpRegisters(NvU32 Instance)
Dumps the registers of the QSPI controller.
NvU32 Readlen
RX length.
Definition: qspi.h:96
NvError QspiHwProcReadAsyncWaitDMAComplete(NvU32 Instance)
Waits until the IO from the DMA is complete.