Skip to content

hal: microchip: sam: add the three SPI aliases the D5x/E5x pack lacks - #75

Open
TheArkadiuszGrzelka wants to merge 1 commit into
zephyrproject-rtos:masterfrom
ArivEmb:sercom-d5x-e5x-spi-aliases
Open

hal: microchip: sam: add the three SPI aliases the D5x/E5x pack lacks#75
TheArkadiuszGrzelka wants to merge 1 commit into
zephyrproject-rtos:masterfrom
ArivEmb:sercom-d5x-e5x-spi-aliases

Conversation

@TheArkadiuszGrzelka

Copy link
Copy Markdown

Moving the SPI driver onto the generic SERCOM_SPI_ names needs three aliases the D5x/E5x pack never defined, and this is the one family whose Kconfig compiles the CTRLC line at all.

Three names missing from forty

sercom_samd5xe5x.h maps the generic SERCOM_SPI_ names onto this pack's
SERCOM_SPIM_ ones, some forty of them, and three are absent:
CTRLA_SWRST, SYNCBUSY_SWRST and CTRLC_ICSPACE.

Nothing noticed, because spi_mchp_sercom_g1.c reached past the mapping and
used the SPIM spelling directly in exactly those four places. That direct
use is what stops the driver building on PIC32CM SG/GC, which has one SPI
block and no SPIM prefix at all.

The family where the third name matters

SPI_MCHP_INTER_CHARACTER_SPACE is depends on SOC_FAMILY_MICROCHIP_SAM_D5X_E5X, so the CTRLC write is compiled here and
nowhere else. On PIC32CM JH the same three-name gap exists for the two
SWRST names only: that pack has no SPIM CTRLC register at all, and the
Kconfig can never select it, so aliasing CTRLC_ICSPACE there would be a
definition pointing at a name that does not exist.

sam_e54_xpro is the in-tree board that carries this pack and a
microchip,sercom-g1-spi node.

Scope

Six lines in one header, all of the same one-line form as the forty already
in it. Nothing that compiles today changes meaning: on this pack each new
generic name resolves to the SPIM definition the driver used before.

Testing

samples/hello_world on sam_e54_xpro with CONFIG_SPI=y and
CONFIG_SPI_MCHP_INTER_CHARACTER_SPACE=1, with the Zephyr generic-names
change in the tree. spi_mchp_sercom_g1.c.obj is built, and the generated
autoconf.h carries CONFIG_SPI_MCHP_INTER_CHARACTER_SPACE 1, so the
CTRLC line inside the #ifdef is compiled rather than skipped - which is
the only way this pack's third alias gets exercised at all.

No D5x/E5x board is on this bench, so L3 is UNVERIFIED.

Verification

Built in the project's dev container, whose west workspace applies this
change as a module patch. This is one of the consumer-side pairs of
zephyrproject-rtos/zephyr's spi-mchp-sercom-g1-generic-names; the other
is sercom-jh-spi-aliases, and all three have to land in the same window.

sercom_samd5xe5x.h maps the generic SERCOM_SPI_ names onto this pack's
SERCOM_SPIM_ ones, some forty of them, and three are missing:
CTRLA_SWRST, SYNCBUSY_SWRST and CTRLC_ICSPACE. Nothing noticed, because
the SPI driver reached past the mapping and used the SPIM spelling
directly in exactly those four places.

That direct use is what keeps the driver from building on PIC32CM SG/GC,
whose pack has one SPI register block and no SPIM prefix at all. The
driver is being moved onto the generic names, and this pack is the one
family where the CTRLC line is compiled at all:
SPI_MCHP_INTER_CHARACTER_SPACE depends on
SOC_FAMILY_MICROCHIP_SAM_D5X_E5X.

The three definitions are the same one-line form as the forty already in
the file, and sam_e54_xpro is the in-tree board that needs them.

Signed-off-by: Arkadiusz Grzelka <devitwise@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant