-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NXP LPSPI: Minor refactor and tweaks #82650
NXP LPSPI: Minor refactor and tweaks #82650
Conversation
decsny
commented
Dec 6, 2024
•
edited
Loading
edited
e161fdc
to
f868ca3
Compare
996c410
to
ed2dcc8
Compare
ed2dcc8
to
1f2c371
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good commit messages.
@@ -531,6 +525,22 @@ static int transceive_dma(const struct device *dev, const struct spi_config *spi | |||
#endif /* CONFIG_SPI_MCUX_LPSPI_DMA */ | |||
|
|||
#ifdef CONFIG_SPI_RTIO | |||
static void spi_mcux_iodev_complete(const struct device *dev, int status); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the prototype defined here? It does not seem necessary as there are no calls to this function until it's defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not seem necessary as there are no calls to this function until it's defined
this is not true, it's at the end of iodev_start
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yvanderv just do a search and you will see that it is called in multiple places before the definition.
@@ -226,7 +215,6 @@ static int spi_mcux_configure(const struct device *dev, const struct spi_config | |||
master_config.pinCfg = config->data_pin_config; | |||
|
|||
LPSPI_MasterInit(base, &master_config, clock_freq); | |||
LPSPI_MasterTransferCreateHandle(base, &data->handle, spi_mcux_master_callback, data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor nit on commit message:
"creation outide of the configure call" -- outside instead of outide
These changes: * Fix the check of the word size to be more useful - check min frame size instead of max - check for min word size requirement - add a clarifying comment about what the word size represents in hardware since the nomenclature from zephyr does not match the nxp references * Add a clarifying comment about half duplex being supported by hardware * Add LPSPI_ namespace to defines * Change chip select error message to be more clear about the problem * Move the check of the clock device being ready to the lpspi init, instead of checking it every time on configure. It probably also makes more sense to not ready the lpspi device if the clock is not ready. * Move the bare-metal configuration of bit fields AFTER the SDK Init call. * Return the proper error code if clock control call errors. Signed-off-by: Declan Snyder <[email protected]>
To facilitate changing this driver, decouple rtio from functions not specific to RTIO. This also requires moving the sdk driver handle creation outside of the configure call. An effect of this is we can stop initializing an unused sdk driver handle for the dma path. Signed-off-by: Declan Snyder <[email protected]>
1f2c371
to
e13cc8c
Compare
rebased and fixed commit message @mmahadevan108 @tbursztyka can one of the assignee help to review this |