RTEMS | spec/bsps: Rename xqspi files to xqspipsu (!804)
Ranulfo Raphael (@ranulfo)
gitlab at rtems.org
Thu Oct 16 15:38:38 UTC 2025
Ranulfo Raphael created a merge request: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/804
Project:Branches: ranulfo/rtems:xqspips-driver to rtems/rtos/rtems:main
Author: Ranulfo Raphael
## Summary
This MR adds the Xilinx `XQspiPs` driver for the `arm/xilinx-zynq` BSPs.
- The driver follows the same structure as existing `XQspiPsu`.
- The imported files are mostly unchanged, some conditional directive was added for `__rtems__`.
- The `xqspips-flash-helper` was based on the Xilinx's example for flash devices greater than 128Mb and interrupts.
- Some files related to the `XQspiPsu` driver were renamed from `xqspi` to `xqspipsu` for this MR.
The driver was tested on:
- Zedboard: S25FL256S_64K. JEDEC ID: 0x010219. Single mode.
- Custom board: N25Q1024A. JEDEC ID: 0x20bb21. Stacked mode.
### Example usage
The following code snippet mounts a JFFS2 filesystem on the Zedboard QSPI Flash.
```c
#include <dev/spi/xqspips_flash.h>
#include <dev/spi/xqspips-flash-helper.h>
#include <dev/flash/jffs2_flashdev.h>
#define ZQSPI_QSPI_BASE 0xE000D000
#define QSPI_FLASH_DEV "/dev/flash"
#define QSPI_FLASH_DISK "/flashdisk"
#define QSPI_FLASH_JFFS2_READWRITE 0
XQspiPs QspiInstance = {
.Config = {
.BaseAddress = ZQSPI_QSPI_BASE,
.ConnectionMode = XQSPIPS_CONNECTION_MODE_SINGLE,
},
};
rtems_flashdev *Flash = NULL;
rtems_flashdev_region Regions[] = {
{
.offset = 0x00000000,
.size = 0x02000000 /* 32 MB */
}
};
static rtems_jffs2_compressor_control CompressorControl = {
.compress = rtems_jffs2_compressor_rtime_compress,
.decompress = rtems_jffs2_compressor_rtime_decompress
};
rtems_task Init(rtems_task_argument ignored);
rtems_task Init(rtems_task_argument ignored __attribute__((unused))) {
int Status;
Status = QspiPs_NOR_Initialize(&QspiInstance, ZYNQ_IRQ_QUAD_SPI);
assert(Status == XST_SUCCESS);
Flash = xqspi_flashdev_init(&QspiInstance);
assert(Flash != NULL);
Status = rtems_flashdev_register(Flash, QSPI_FLASH_DEV);
assert(Status == 0);
Status = rtems_mkdir(QSPI_FLASH_DISK, S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO);
assert(Status == 0);
Flash->erase(Flash, Regions[0].offset, Regions[0].size);
Status = jffs2_flashdev_mount(QSPI_FLASH_DEV,
QSPI_FLASH_DISK,
&Regions[0],
&CompressorControl,
QSPI_FLASH_JFFS2_READWRITE);
assert(Status == RTEMS_SUCCESSFUL);
shell();
(void) rtems_task_delete(RTEMS_SELF);
return;
}
```
Zedboard output:
```
SHLL [/] # ls /dev
console flash rda ttyS0 ttyS1
SHLL [/] # flashdev /dev/flash -d
JEDEC Id: 0x10219
SHLL [/] # ls
dev etc flashdisk
SHLL [/] # df
Filesystem 1K-blocks Used Available Use% Mounted on
none 4194304 3677538 516767 87% /
none 32768 904 31864 2% /flashdisk
SHLL [/] # cpuuse
-------------------------------------------------------------------------------
CPU USAGE BY THREAD
------------+----------------------------------------+---------------+---------
ID | NAME | SECONDS | PERCENT
------------+----------------------------------------+---------------+---------
0x09010001 | IDLE | 135.983057 | 59.827
0x0a010001 | JFFS | 25.760130 | 11.333
0x0a010003 | BSWP | 0.000657 | 0.000
0x0a010004 | SHLL | 0.003777 | 0.001
------------+----------------------------------------+---------------+---------
TIME SINCE LAST CPU USAGE RESET IN SECONDS: 227.308503
-------------------------------------------------------------------------------
SHLL [/] # rtems all
RTEMS: 7.0.0 (62e0865bcc66ff5bde8fcec915abb836442c8187-modified)
CPU: ARM (ARMv4)
BSP: xilinx_zynq_zedboard
Tools: 13.4.0 20250605 (RTEMS 7, RSB 005bc7ee591d12ee2de19f8c930ee8d359e7c052, Newlib 038afec1)
Options: POSIX
```
<!-- Default settings, if it is a dropdown it will set after submission -->
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/804
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20251016/c6a0d51e/attachment-0001.htm>
More information about the bugs
mailing list