Skip to content

DesignWare SPI driver crashes on emsdp_em11d when reading SSI_COMP_VERSION register with aux-reg enabled #93620

@M-Moawad

Description

@M-Moawad

Describe the bug

The DesignWare SPI driver causes instruction errors on the emsdp_em11d board when attempting to read the SSI_COMP_VERSION register during initialization. This occurs specifically for SPI controllers configured with auxiliary register access (aux-reg property).

Regression

  • This is a regression.

Steps to reproduce

Use the Zephyr SDK

west twister -p emsdp/emsdp_em11d -W --scenario sample.basic.helloworld

Relevant log output

.../twister-out/emsdp_emsdp_em11d/zephyr/samples/hello_world/sample.basic.helloworld/device.log
--------------------
Open On-Chip Debugger 0.12.0-01018-gb89d626c6 (2025-05-21-22:01)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
25163300316B
DEPRECATED! use 'adapter serial' not 'ftdi_serial'
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi tdo_sample_edge falling"
Info : clock speed 10000 kHz
Info : JTAG tap: arc-em.cpu tap/device found: 0x200044b1 (mfg: 0x258 (ARC International), part: 0x0004, ver: 0x2)
Info : starting gdb server for arc-em.cpu on 3333
Error: couldn't bind gdb to socket on port 3333: Address already in use
    TargetName         Type       Endian TapName            State       
--  ------------------ ---------- ------ ------------------ ------------
 0* arc-em.cpu         arcv2      little arc-em.cpu         running

Info : JTAG tap: arc-em.cpu tap/device found: 0x200044b1 (mfg: 0x258 (ARC International), part: 0x0004, ver: 0x2)
18706 bytes written at address 0x60000000
416 bytes written at address 0x80000000
downloaded 19122 bytes in 0.022556s (827.887 KiB/s)

shutdown command invoked

==== Another type of errors ======

.../twister-out/emsdp_emsdp_em11d/zephyr/samples/userspace/hello_world_user/sample.helloworld/handler.log
--------------------
***** Exception vector: 0x2, cause code: 0x0, parameter 0x0
Address 0x600046e4
Instruction Error
 r0: 0x20  r1: 0x80010000  r2: 0x80010017  r3: 0x600046e0
 r4: 0x8000117c  r5: 0x8000117c  r6: 0x0  r7: 0xf
 r8: 0x1  r9: 0x0 r10: 0x10 r11: 0x80808080
r12: 0x600046d4 r13: 0x6000b4a8  pc: 0x600046e4
 blink: 0x60004d36 status32: 0x80102806
lp_end: 0x0 lp_start: 0x0 lp_count: 0x0

Impact

Annoyance – Minor irritation; no significant impact on usability or functionality.

Environment

OS: Linux
Toolchain (e.g Zephyr SDK, ...): Zephyr SDK
Commit SHA or Version used: Main 4867d45

Additional Context

The issue was introduced in commit db168539 from PR #87716, which added SSI component version reading functionality.

The issue is in the code that reads the SSI component version register during SPI initialization:

zephyr/drivers/spi/spi_dw.c

Lines 569 to 573 in 4867d45

/* SSI component version */
spi->version = read_ssi_comp_version(dev);
LOG_DBG("Version: %c.%c%c%c", (spi->version >> 24) & 0xff,
(spi->version >> 16) & 0xff, (spi->version >> 8) & 0xff,
spi->version & 0xff);

The emsdp_em11d board has SPI controllers configured with aux-reg property , which uses different register access functions .

For auxiliary register access, the addressing calculation uses addr + off/4 where the SSI_COMP_VERSION register offset is 0x5c . This results in accessing an invalid memory location on certain DesignWare SPI controller variants that don't implement this register through the auxiliary register interface.
The aux-reg property was initially implemented in commit cbdd2f38 from PR #56925.

Metadata

Metadata

Labels

area: SPISPI busbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions