diff options
| author | Boon Khai Ng <[email protected]> | 2026-03-12 12:46:33 +0800 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-07-20 13:16:10 -0600 |
| commit | 5a83cae32d9a1f29209d4f171a8de18bf82fd630 (patch) | |
| tree | e75334f69681a203f722531c789922c5e5069548 /tests/data_files/parse_input | |
| parent | 042e45e026c77227319a426940577856ffe62e7b (diff) | |
spi: dw: Allow bits_per_word to be configured by device drivers
The DesignWare SPI controller supports configurable bits_per_word
(typically 4-32 bits), but this was previously hardcoded to 8 bits
in the driver initialization.
This patch enables bits_per_word to be set dynamically by upper-level
device drivers, matching the approach used in Linux. The controller
reads the bits_per_word value from the spi_slave structure during
each transfer, allowing different SPI devices on the same bus to use
different word sizes.
Implementation details:
- Read slave->bits_per_word in dw_spi_xfer() before each transfer
- Validate requested value against controller capabilities (4 to max_xfer)
- Default to 8 bits if not set (maintains backward compatibility)
This follows the Linux model where spi_device drivers set bits_per_word,
and the controller driver reads it in the transfer function. Device
drivers can now set slave->bits_per_word before calling spi_xfer().
Example usage in device driver:
slave->bits_per_word = 16;
spi_xfer(slave, ...);
Backward compatible: Existing drivers that don't set bits_per_word
will continue to work with the default 8-bit transfers.
Signed-off-by: Boon Khai Ng <[email protected]>
Diffstat (limited to 'tests/data_files/parse_input')
0 files changed, 0 insertions, 0 deletions
