Skip to content

Commit 1cfab89

Browse files
kywwilson11xiaoxiang781216
authored andcommitted
Added incomplete octospi hardware defintions.
Register addresses are defined. Bit defintions are still needed. Bitmaps for OCTOSPI peripheral register Incremental updates to qspi files Redefined QSPI/OCTOSPI registers for STM32H5 Fixed register definitions for the STM32H5. However, more work still needs to be done. Some bits that shared registers on the STM32H7 have different register locations on the H5. This still needs to be accounted for. Fixed more differences vs STM32H7 qspi Added ifdef for including stm32_dma.h in stm32_qspi.c. Added stm32_qspi.c to Make.defs. Register fixes. SPI activity but not able to format device yet. Fixed DCYC mask Set HCLK frequency to correct value. Undid ccrconfig debug. Tested Interrupt Mode (single SPI). Added alternate bytes to meminfo and cmdinfo structures. Updated Kconfig variables for STM32H5. Fixed base register in hardware/stm32_qspi.h. Updated qspi_dumpregs. The base register was previously set to STM32_QUADSPI_BASE, changed to the correctly named STM32_OCTOSPI1_BASE. However, these defines for the OCTOSPI registers are not even used. Instead qspi_putreg and qspi_getreg utilize the priv->base value to access OCTOSPI registers. Removed altbytes code, left as before. Moved QSPI clock selection to stm32h5xx_rcc.c Changed STM32H5_QUADSPI to STM32H5_QSPI1 Added hook to define QSPI_CLK_FREQUENCY as STM32_QSPI_FREQUENCY from board.h Removed changes to nuttx qspi.h style fixes
1 parent ca4fd09 commit 1cfab89

File tree

5 files changed

+3036
-0
lines changed

5 files changed

+3036
-0
lines changed

arch/arm/src/stm32h5/Kconfig

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ config STM32H5_ETHMAC
309309
select ARCH_HAVE_PHY
310310
select STM32H5_HAVE_PHY_POLLED
311311

312+
config STM32H5_QSPI1
313+
bool "QSPI1"
314+
default n
315+
312316
config STM32H5_USART2
313317
bool "USART2"
314318
default n
@@ -1570,4 +1574,138 @@ config STM32H5_I2CTIMEOTICKS
15701574

15711575
endmenu # "I2C Configuration"
15721576

1577+
menu "QuadSPI Configuration"
1578+
depends on STM32H5_QSPI1
1579+
1580+
config STM32H5_QSPI_FLASH_SIZE
1581+
int "Size of attached serial flash, bytes"
1582+
default 16777216
1583+
range 1 2147483648
1584+
---help---
1585+
The STM32H5 QSPI peripheral requires the size of the Flash be specified
1586+
1587+
config STM32H5_QSPI_FIFO_THESHOLD
1588+
int "Number of bytes before asserting FIFO threshold flag"
1589+
default 4
1590+
range 1 32
1591+
---help---
1592+
The STM32H5 QSPI peripheral requires that the FIFO threshold be specified
1593+
I would leave it at the default value of 4 unless you know what you are doing.
1594+
1595+
config STM32H5_QSPI_CSHT
1596+
int "Number of cycles Chip Select must be inactive between transactions"
1597+
default 5
1598+
range 1 64
1599+
---help---
1600+
The STM32H5 QSPI peripheral requires that it be specified the minimum number
1601+
of AHB cycles that Chip Select be held inactive between transactions.
1602+
1603+
choice
1604+
prompt "Transfer technique"
1605+
default STM32H5_QSPI_DMA
1606+
---help---
1607+
You can choose between using polling, interrupts, or DMA to transfer data
1608+
over the QSPI interface.
1609+
1610+
config STM32H5_QSPI_POLLING
1611+
bool "Polling"
1612+
---help---
1613+
Use conventional register I/O with status polling to transfer data.
1614+
1615+
config STM32H5_QSPI_INTERRUPTS
1616+
bool "Interrupts"
1617+
---help---
1618+
User interrupt driven I/O transfers.
1619+
1620+
config STM32H5_QSPI_DMA
1621+
bool "DMA"
1622+
depends on STM32H5_DMA
1623+
---help---
1624+
Use DMA to improve QSPI transfer performance.
1625+
1626+
endchoice
1627+
1628+
choice
1629+
prompt "Bank selection"
1630+
default STM32H5_QSPI_MODE_BANK1
1631+
---help---
1632+
You can choose between using polling, interrupts, or DMA to transfer data
1633+
over the QSPI interface.
1634+
1635+
config STM32H5_QSPI_MODE_BANK1
1636+
bool "Bank 1"
1637+
1638+
config STM32H5_QSPI_MODE_BANK2
1639+
bool "Bank 2"
1640+
1641+
config STM32H5_QSPI_MODE_DUAL
1642+
bool "Dual Bank"
1643+
1644+
endchoice
1645+
1646+
choice
1647+
prompt "DMA Priority"
1648+
default STM32H5_QSPI_DMAPRIORITY_MEDIUM
1649+
depends on STM32H5_DMA
1650+
---help---
1651+
The DMA controller supports priority levels. You are probably fine
1652+
with the default of 'medium' except for special cases. In the event
1653+
of contention between to channels at the same priority, the lower
1654+
numbered channel has hardware priority over the higher numbered one.
1655+
1656+
config STM32H5_QSPI_DMAPRIORITY_VERYHIGH
1657+
bool "Very High priority"
1658+
depends on STM32H5_DMA
1659+
---help---
1660+
'Highest' priority.
1661+
1662+
config STM32H5_QSPI_DMAPRIORITY_HIGH
1663+
bool "High priority"
1664+
depends on STM32H5_DMA
1665+
---help---
1666+
'High' priority.
1667+
1668+
config STM32H5_QSPI_DMAPRIORITY_MEDIUM
1669+
bool "Medium priority"
1670+
depends on STM32H5_DMA
1671+
---help---
1672+
'Medium' priority.
1673+
1674+
config STM32H5_QSPI_DMAPRIORITY_LOW
1675+
bool "Low priority"
1676+
depends on STM32H5_DMA
1677+
---help---
1678+
'Low' priority.
1679+
1680+
endchoice
1681+
1682+
config STM32H5_QSPI_DMATHRESHOLD
1683+
int "QSPI DMA threshold"
1684+
default 4
1685+
depends on STM32H5_QSPI_DMA
1686+
---help---
1687+
When QSPI DMA is enabled, small DMA transfers will still be performed
1688+
by polling logic. This value is the threshold below which transfers
1689+
will still be performed by conventional register status polling.
1690+
1691+
config STM32H5_QSPI_DMADEBUG
1692+
bool "QSPI DMA transfer debug"
1693+
depends on STM32H5_QSPI_DMA && DEBUG_SPI && DEBUG_DMA
1694+
default n
1695+
---help---
1696+
Enable special debug instrumentation to analyze QSPI DMA data transfers.
1697+
This logic is as non-invasive as possible: It samples DMA
1698+
registers at key points in the data transfer and then dumps all of
1699+
the registers at the end of the transfer.
1700+
1701+
config STM32H5_QSPI_REGDEBUG
1702+
bool "QSPI Register level debug"
1703+
depends on DEBUG_SPI_INFO
1704+
default n
1705+
---help---
1706+
Output detailed register-level QSPI device debug information.
1707+
Requires also CONFIG_DEBUG_SPI_INFO.
1708+
1709+
endmenu
1710+
15731711
endif # ARCH_CHIP_STM32H5

arch/arm/src/stm32h5/Make.defs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ ifeq ($(CONFIG_STM32H5_SPI),y)
5858
CHIP_CSRCS += stm32_spi.c
5959
endif
6060

61+
ifeq ($(CONFIG_STM32H5_QSPI1),y)
62+
CHIP_CSRCS += stm32_qspi.c
63+
endif
64+
6165
# Required chip type specific files
6266

6367
ifeq ($(CONFIG_STM32H5_STM32H5XXXX),y)

0 commit comments

Comments
 (0)