3 Tercel is a Wishbone-compatible, 32-bit, single+quad SPI Flash controller with XIP support. Both 3BA and 4BA devices are supported.
5 Tercel provides two interfaces to the host CPU:
6 1. A direct MMIO read/write region for the flash device
7 2. A configuration space where the core can be reconfigured on-line for operation beyond single SPI 3BA mode with fallback clocks (default)
13 On reset, the Tercel core provides basic read/write access in single SPI, 3BA mode to any attached Flash device. It uses the generic well-known single byte access instructions to provide full XIP support. Host software is responsible for reading the Flash ID of the attached Flash device and reconfiguring the Tercel core for faster and more advanced operating modes. This reconfiguration can take place online, with no interruption to the concurrent read operations in progress on the main MMIO Flash window.
15 By default, with Microwatt, the two bus regions are available at:
16 Flash MMIO (XIP base): 0xf0000000
17 Core configuration: 0xc8050000
22 Set bit 0 of "Core control register 1"
24 - Send Flash ID command
25 Write 0x9e to SPI MMIO base address (offset 0x0)
28 Read four bytes from SPI MMIO base address (offset 0x0) and assemble into 32-bit device ID
29 Read sequence is big endian per Flash device convention
32 Clear bit 0 of "Core control register 1"
36 ## [0x00 - 0x07] Device ID
38 Device make/model unique identifier for PnP functionality
39 Fixed value: 0x7c5250545350494d
41 ## [0x08 - 0x0b] Device version
43 Device revision (stepping)
45 | Bits | Description |
46 |-------|---------------|
47 | 31:16 | Major version |
48 | 15:8 | Minor version |
51 ## [0x0c - 0x0f] System clock frequency
53 Can be used to set divisor to meet specific SPI Flash clock frequency requirements
55 ## [0x10 - 0x13] PHY configuration register 1
59 | Bits | Description |
60 |-------|--------------------------------------------------------------------------------------------------------|
61 | 31:24 | Insert idle cycles with CS deasserted between SPI operations (cycle count to insert, 0 for none) |
63 | 21 | Enable quad I/O data write in QSPI mode |
64 | 20 | Enable quad I/O data read in QSPI mode |
65 | 19 | Enable fast reads (1 == use fast read commands and cycles, 0 == use standard read commands and cycles) |
66 | 18 | Enable 4BA addressing mode (1 == 4BA, 0 == 3BA) |
67 | 17:16 | PHY I/O type (0 == single, 2 == quad, others invalid) |
68 | 15:8 | Dummy cycle count |
69 | 7:0 | SPI clock divisor |
71 Clock divisor works as follows:
72 Clock frequency calculation:
73 spi_clock_frequency = peripheral_bus_clock_frequency / ((spi_clock_divisor - 1) * 2)
75 | Clock divisor value | Actual division |
76 |---------------------|------------------------------------|
77 | 0 | override to standard divide by two |
87 ## [0x14 - 0x17] Flash configuration register 1
91 | Bits | Description |
92 |-------|-----------------------|
94 | 23:16 | QSPI 3BA read command |
95 | 15:8 | SPI 4BA read command |
96 | 7:0 | SPI 3BA read command |
98 ## [0x18 - 0x1b] Flash configuration register 2
102 | Bits | Description |
103 |-------|----------------------------|
104 | 31:24 | QSPI 4BA fast read command |
105 | 23:16 | QSPI 3BA fast read command |
106 | 15:8 | SPI 4BA fast read command |
107 | 7:0 | SPI 3BA fast read command |
109 ## [0x1c - 0x1f] Flash configuration register 3
113 | Bits | Description |
114 |-------|--------------------------|
115 | 31:24 | QSPI 4BA program command |
116 | 23:16 | QSPI 3BA program command |
117 | 15:8 | SPI 4BA program command |
118 | 7:0 | SPI 3BA program command |
120 ## [0x20 - 0x23] Flash configuration register 4
124 Cycles to keep CS asserted after operation completion. Used to support high-throughput multi-cycle transfers with specific Flash devices.
126 See also "Flash configuration register 5"
128 ## [0x24 - 0x27] Flash configuration register 5
132 | Bits | Description |
133 |------|-------------------------|
135 | 1 | Allow multicycle writes |
136 | 0 | Allow multicycle reads |
138 ## [0x28 - 0x2b] Core control register 1
142 | Bits | Description | |
143 |------|-------------|--------------------------|
144 | | 31:1 | Reserved |
145 | | 0 | User command mode enable |
147 User command mode operates in conjunction with "Core data register 1" to support custom (non-data-I/O) SPI commands.
149 ## [0x2c - 0x2f] Core data register 1
151 Data transfer to/from SPI device in user command mode
153 See also "Core control register 1"
157 Tercel is licensed under the terms of the GNU LGPLv3+. See LICENSE.tercel for details.
159 # DOCUMENTATION CREDITS
161 (c) 2022 Raptor Engineering, LLC