-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Description
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).
- SSI_COMP_VERSION register definition: https://github.com/zephyrproject-rtos/zephyr/tree/4867d4564714e42c08b4769f579dc927b8f82270/drivers/spi/spi_dw_regs.h#L40
- Auxiliary register access functions: https://github.com/zephyrproject-rtos/zephyr/tree/4867d4564714e42c08b4769f579dc927b8f82270/drivers/spi/spi_dw.h#L67-L94
- Board device tree configuration:https://github.com/zephyrproject-rtos/zephyr/tree/4867d4564714e42c08b4769f579dc927b8f82270/dts/arc/synopsys/emsdp.dtsi#L131-L158
- Register read helper macro:https://github.com/zephyrproject-rtos/zephyr/tree/4867d4564714e42c08b4769f579dc927b8f82270/drivers/spi/spi_dw_regs.h#L53
Regression
- This is a regression.
Steps to reproduce
Use the Zephyr SDK
west twister -p emsdp/emsdp_em11d -W --scenario sample.basic.helloworldRelevant 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: 0x0Impact
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:
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.