Skip to content

Conversation

@dgarske
Copy link
Contributor

@dgarske dgarske commented Jan 29, 2026

Summary

  • Add MPFS250 QSPI support with two access paths: direct MSS QSPI controller and System Controller SPI services.
  • Introduce a QSPI-focused PolarFire config and extend the HAL/external-flash APIs for QSPI read/write/erase and SCB mailbox reads.
  • Tweak RISC-V build flow to select update loader based on disk usage and sign ELF outputs when ELF mode is enabled.
  • Add a PolarFire programming helper script and document QSPI usage under PolarFire targets.

Key Changes

  • New example config: config/examples/polarfire_mpfs250_qspi.config
  • QSPI init + drivers in hal/mpfs250.c (MSS QSPI + SC SPI paths)
  • Build logic updates in arch.mk for update loader selection + ELF signing
  • PolarFire QSPI documentation in docs/Targets.md
  • New tooling script: tools/scripts/mpfs_program.sh

Testing

  • Example output (with DEBUG_QSPI set):
wolfBoot Version: 2.7.0 (Jan 29 2026 13:03:10)
QSPI: Using System Controller SPI services
SC SPI: Read 0x20000 -> 0x80013680, len 512
SC SPI: Read 0x2000000 -> 0x80013680, len 512
Versions: Boot 1, Update 0
Trying Boot partition at 0x20000
Loading header 512 bytes from 0x20000 to 0x8DFFFE00
SC SPI: Read 0x20000 -> 0x8DFFFE00, len 512
Loading image 128664 bytes from 0x20200 to 0x8E000000...
SC SPI: Read 0x20200 -> 0x8E000000, len 128664
done
Boot partition: 0x8DFFFE00 (sz 128664, ver 0x1, type 0x601)
Checking integrity...done
Verifying signature...done
Successfully selected image in part: 0
Firmware Valid
SC SPI: Read 0x1FFFFFC -> 0x80013880, len 4
Loading elf at 0x8E000000
Found valid elf64 (little endian)
Program Headers 1 (size 56)
Load 21304 bytes (offset 0x1000) to 0x8E000000 (p 0x8E000000)
Clear 16392 bytes at 0x8E000000 (p 0x8E000000)
Entry point 0x8E0012B8
Booting at 0x8E0012B8
FDT: Invalid header! -1
QSPI: Using System Controller SPI services
========================
PolarFire SoC MPFS250 wolfBoot demo Application
Copyright 2025 wolfSSL Inc
GPL v3
========================

@dgarske dgarske self-assigned this Jan 29, 2026
@dgarske dgarske force-pushed the polarfire_soc_qspi branch 2 times, most recently from 633e7f8 to 5e963dc Compare January 30, 2026 22:19
@dgarske dgarske assigned danielinux and wolfSSL-Bot and unassigned dgarske Jan 30, 2026
@dgarske dgarske requested a review from danielinux January 30, 2026 22:19
Copy link
Member

@danielinux danielinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, some minor visibility issues

hal/mpfs250.h Outdated
* System Controller Mailbox API (public)
* ============================================================================ */
#ifndef __ASSEMBLER__
/* Returns non-zero if mailbox is busy */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why this API is public? Will these functions be used by other modules outside mpfs250.c ?

hal/mpfs250.c Outdated
}

/* Wait for flash to be ready (poll status register) */
int qspi_wait_ready(uint32_t timeout_ms)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static

hal/mpfs250.c Outdated
}

/* Send Write Enable command */
int qspi_write_enable(void)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static

hal/mpfs250.c Outdated
}

/* Read JEDEC ID from flash */
int qspi_read_id(uint8_t *id_buf)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static ?

hal/mpfs250.c Outdated
* data_len: Length of data phase
* dummy_cycles: Number of idle cycles between command and data phase
*/
int qspi_transfer_block(uint8_t read_mode, const uint8_t *cmd, uint32_t cmd_len,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static

hal/mpfs250.c Outdated
* Returns: non-zero if busy, 0 if ready
*/
static int mpfs_scb_mailbox_busy(void)
int mpfs_scb_is_busy(void)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment in .h -- if those become internal to the mpf250.c module, these functions starting with mpfs_ should become static.

@dgarske dgarske force-pushed the polarfire_soc_qspi branch from 5e963dc to 2f8ce14 Compare February 4, 2026 00:20
@dgarske dgarske requested a review from danielinux February 4, 2026 00:22
@dgarske dgarske assigned danielinux and unassigned danielinux Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants