Skip to content

Conversation

@tbursztyka
Copy link
Contributor

@tbursztyka tbursztyka commented Nov 2, 2021

Adding a configuration bit to switch between TI and Motorola frame formats.

@tbursztyka tbursztyka added the area: API Changes to public APIs label Nov 2, 2021
@tbursztyka tbursztyka added DNM This PR should not be merged (Do Not Merge) and removed platform: STM32 ST Micro STM32 platform: NXP NXP platform: Silabs Silicon Labs labels Nov 2, 2021
@tbursztyka tbursztyka changed the title SPI API: frame format configuration option (TI vs Motorola) [RFC] SPI API: frame format configuration option (TI vs Motorola) Nov 2, 2021
@tbursztyka tbursztyka added the RFC Request For Comments: want input from the community label Nov 2, 2021
@tbursztyka tbursztyka force-pushed the spi_motorola_ti branch 2 times, most recently from a61e54a to 0985d86 Compare November 11, 2021 07:11
@tbursztyka tbursztyka force-pushed the spi_motorola_ti branch 5 times, most recently from e78aca2 to 4c1291f Compare November 15, 2021 09:13
@github-actions github-actions bot added the area: Devicetree Binding PR modifies or adds a Device Tree binding label Nov 22, 2021
@tbursztyka tbursztyka changed the title [RFC] SPI API: frame format configuration option (TI vs Motorola) SPI API: frame format configuration option (TI vs Motorola) Nov 22, 2021
@tbursztyka tbursztyka force-pushed the spi_motorola_ti branch 2 times, most recently from baf8a70 to e87d945 Compare November 23, 2021 08:03
Tomasz Bursztyka added 2 commits November 24, 2021 08:21
So TI will no longer be the only frame format available, though it will
still be the default one. It will be possible to select the Motorola
frame format when relevant.

Signed-off-by: Tomasz Bursztyka <[email protected]>
Most of the time SPI devices use TI's frame format. But some may use
Motorola's. This is already taken care of in the SPI API and now it will
be possible to select the right format from DTS. Like:

    ...
    frame-format = <SPI_FRAME_FORMAT_MOTOROLA>;
    ...

This is only meant to be used for devices supporting both formats (so
the format is not hard-coded in the driver) and selected by hardware
configuration or else.  Which, in such case, it will need to use
DT_INST_PROP(<instance number>, frame-format) macro call to retrieve
the property value. Others can fully ignore it.

Signed-off-by: Tomasz Bursztyka <[email protected]>
@carlescufi carlescufi merged commit 1c1a2cc into zephyrproject-rtos:main Nov 29, 2021
@tbursztyka tbursztyka deleted the spi_motorola_ti branch November 30, 2021 10:09
@FRASTM
Copy link
Contributor

FRASTM commented Dec 15, 2021

@tbursztyka, could you please have a look at my PR #40860
I wonder if the structure spi_config is getting the frame-format correctly. I add a commit 538b0992d02b2b41ceca2c065b741e64a9594289 but It think the bit[15] of the operation is well placed for this:

/**
 * @name SPI frame format
 * @{
 */
#define SPI_FRAME_FORMAT_SHIFT	(15U)
#define SPI_FRAME_FORMAT_MASK	(0x1U << SPI_FRAME_FORMAT_SHIFT)
#define SPI_FRAME_FORMAT_GET(_operation_)					\
	(((_operation_) & SPI_FRAME_FORMAT_MASK) >> SPI_FRAME_FORMAT_SHIFT)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: API Changes to public APIs area: Bluetooth area: Build System area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree area: Display area: eSPI eSPI area: Flash area: GPIO area: Kscan area: LED Label to identify LED subsystem area: Sensors Sensors area: SPI SPI bus area: Wi-Fi Wi-Fi DNM This PR should not be merged (Do Not Merge) platform: ESP32 Espressif ESP32 platform: nRF Nordic nRFx platform: NXP NXP platform: Silabs Silicon Labs platform: STM32 ST Micro STM32 RFC Request For Comments: want input from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants