Skip to content

Commit e7cf484

Browse files
committed
Versal QSPI differences
1 parent fb3da15 commit e7cf484

2 files changed

Lines changed: 72 additions & 7 deletions

File tree

hal/versal.c

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,23 @@
2222
* Target: VMK180 Evaluation Board (VM1802 Versal Prime)
2323
*
2424
* Features:
25-
* - UART driver (Cadence UART)
25+
* - UART driver (Cadence UART / ARM PL011)
2626
* - ARM Generic Timer
27-
* - Flash stubs (OSPI/SD to be implemented)
27+
* - QSPI flash driver (GQSPI - dual parallel MT25QU01GBBB)
28+
*
29+
* QSPI Driver Notes:
30+
* This driver is a port of the ZynqMP GQSPI driver (hal/zynq.c) with the
31+
* following Versal-specific adaptations:
32+
*
33+
* 1. Different base address (0xF1030000 vs 0xFF0F0000)
34+
* 2. Tap delay bypass register is in QSPI block (not IOU_SLCR)
35+
* 3. Preserves PLM's QSPI configuration instead of full reset
36+
* 4. UART init skips MIO/clock setup when EL2 (PLM already did it)
37+
*
38+
* The register layout, GenFIFO format, and DMA interface are identical
39+
* to ZynqMP since both use the same Xilinx GQSPI IP block.
40+
*
41+
* See hal/versal.h for detailed comparison with ZynqMP.
2842
*/
2943

3044
#ifdef TARGET_versal
@@ -260,10 +274,31 @@ void hal_delay_us(uint32_t us)
260274

261275

262276
/* ============================================================================
263-
* QSPI Flash Driver
277+
* QSPI Flash Driver (GQSPI)
264278
* ============================================================================
265-
* Bare-metal QSPI driver for Versal VMK180
266-
* Dual parallel MT25QU01GBBB (128MB each, 256MB total)
279+
* Bare-metal QSPI driver for Versal VMK180.
280+
* Hardware: Dual parallel MT25QU01GBBB (128MB each, 256MB total).
281+
*
282+
* This driver is adapted from the ZynqMP GQSPI driver (hal/zynq.c).
283+
* Both platforms use the same Xilinx GQSPI IP block with identical:
284+
* - Register offsets (GQSPI at +0x100, DMA at +0x800 from base)
285+
* - GenFIFO entry format (command, address, data, stripe bits)
286+
* - Interrupt status bits and DMA interface
287+
*
288+
* Versal-specific differences from ZynqMP:
289+
* - Base address: 0xF1030000 (vs 0xFF0F0000 on ZynqMP)
290+
* - Tap delay register: In QSPI block (vs IOU_SLCR on ZynqMP)
291+
* - Initialization: Preserves PLM config (vs full reset on ZynqMP)
292+
*
293+
* Supported modes (same as ZynqMP):
294+
* - DMA mode (default) or IO polling mode (GQSPI_MODE_IO)
295+
* - Quad SPI (4-bit), Dual SPI (2-bit), or Standard SPI (1-bit)
296+
* - 4-byte addressing for flash >16MB (GQPI_USE_4BYTE_ADDR)
297+
* - Dual parallel with hardware striping (GQPI_USE_DUAL_PARALLEL)
298+
* - EXP (exponent) length mode for large transfers
299+
*
300+
* Clock: 300MHz ref / (2 << DIV) = 75MHz default (DIV=1)
301+
* MT25QU01GBBB supports up to 133MHz for Quad Output Read.
267302
*/
268303

269304
#ifdef EXT_FLASH

hal/versal.h

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,38 @@
293293
/* ============================================================================
294294
* QSPI (Quad SPI) Flash Controller - GQSPI
295295
* ============================================================================
296-
* Versal QSPI is similar to ZynqMP but at different base address.
297-
* VMK180 uses dual parallel MT25QU01GBBB (128MB each, 256MB total)
296+
* The Versal GQSPI controller is derived from the ZynqMP GQSPI IP block.
297+
* VMK180 uses dual parallel MT25QU01GBBB (128MB each, 256MB total).
298+
*
299+
* Key differences from ZynqMP (see hal/zynq.c for comparison):
300+
*
301+
* 1. BASE ADDRESS:
302+
* - ZynqMP: 0xFF0F0000
303+
* - Versal: 0xF1030000
304+
*
305+
* 2. TAP DELAY BYPASS REGISTER:
306+
* - ZynqMP: Located in IOU_SLCR block at 0xFF180390
307+
* - Versal: Integrated in QSPI block at BASE + 0x03C
308+
*
309+
* 3. INITIALIZATION:
310+
* - ZynqMP: Full init including FIFO reset and loopback delay tuning
311+
* - Versal: Preserves PLM configuration, only drains RX FIFO
312+
* (PLM already configured clocks, MIO, and controller)
313+
*
314+
* 4. CLOCK CONFIGURATION:
315+
* - Both use same divisor formula: QSPI_CLK = REF_CLK / (2 << DIV)
316+
* - Default: 300MHz ref, DIV=1 -> 75MHz (within MT25QU01G 133MHz spec)
317+
*
318+
* 5. REGISTER LAYOUT:
319+
* - Identical offsets from base (+0x100 for GQSPI, +0x800 for DMA)
320+
* - Same GenFIFO format, interrupt bits, and DMA interface
321+
*
322+
* 6. BUILD OPTIONS (same as ZynqMP):
323+
* - GQSPI_MODE_IO: Use polling instead of DMA (DMA is default)
324+
* - GQPI_USE_DUAL_PARALLEL: Enable dual parallel flash striping
325+
* - GQPI_USE_4BYTE_ADDR: Enable 4-byte addressing for >16MB flash
326+
* - GQSPI_CLK_DIV: Clock divider (0-7)
327+
* - DEBUG_QSPI: Enable verbose debug logging
298328
*/
299329
#define VERSAL_QSPI_BASE 0xF1030000UL
300330

0 commit comments

Comments
 (0)