spi: spi-fsl-dspi: restrict register range for regmap access
authorLarisa Grigore <larisa.grigore@nxp.com>
Thu, 22 May 2025 14:51:30 +0000 (15:51 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 22 May 2025 15:05:24 +0000 (16:05 +0100)
commit283ae0c65e9c592f4a1ba4f31917f5e766da7f31
treeaed7a033e86b049f0cb75efee2c51f9149a436a0
parent1007ae0d464ceb55a3740634790521d3543aaab9
spi: spi-fsl-dspi: restrict register range for regmap access

DSPI registers are NOT continuous, some registers are reserved and
accessing them from userspace will trigger external abort, add regmap
register access table to avoid below abort.

  For example on S32G:

  # cat /sys/kernel/debug/regmap/401d8000.spi/registers

  Internal error: synchronous external abort: 96000210 1 PREEMPT SMP
  ...
  Call trace:
  regmap_mmio_read32le+0x24/0x48
  regmap_mmio_read+0x48/0x70
  _regmap_bus_reg_read+0x38/0x48
  _regmap_read+0x68/0x1b0
  regmap_read+0x50/0x78
  regmap_read_debugfs+0x120/0x338

Fixes: 1acbdeb92c87 ("spi/fsl-dspi: Convert to use regmap and add big-endian support")
Co-developed-by: Xulin Sun <xulin.sun@windriver.com>
Signed-off-by: Xulin Sun <xulin.sun@windriver.com>
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Link: https://patch.msgid.link/20250522-james-nxp-spi-v2-1-bea884630cfb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-dspi.c