-
Notifications
You must be signed in to change notification settings - Fork 0
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
arch/arm64/lspi: improve spi initialization #315
Conversation
The priv->refcount doesn't actually work as a reference counter, since the bus can't be uninitialized and refcount doesn't count downwards there. Maybe also add an "uninitialize" function to count down priv->refcount, and from there call the disable when the count goes to 0. Just to have the refcount fully implemented.... Then work this to upstream |
f7a50c9
to
953dee1
Compare
arch/arm64/src/imx9/imx9_lpspi.c
Outdated
{ | ||
struct imx9_lpspidev_s *priv = (struct imx9_lpspidev_s *)dev; | ||
|
||
if (priv->refcount == 1) |
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 not just first decrease refcount (if refcount > 0) and then disable if refcount == 0 ?
arch/arm64/src/imx9/imx9_lpspi.c
Outdated
|
||
if (priv->refcount == 1) | ||
{ | ||
imx9_lpspibus_disable(priv->bus_number); |
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.
I feel bus_number is unnecessary... why not just pass the "struct spi_dev_s *dev" to the "disable".
953dee1
to
97ed43e
Compare
97ed43e
to
660b6d8
Compare
arch/arm64/src/imx9/imx9_lpspi.c
Outdated
if (priv->refcount == 0) | ||
{ | ||
imx9_lpspi_modifyreg32(priv, | ||
IMX9_LPSPI_CR_OFFSET, LPSPI_CR_MEN, 0); |
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.
indent this line
Hardware initialization is based refcount, not spi enable bit and add interface to unitialize bus Signed-off-by: Jouni Ukkonen <[email protected]>
660b6d8
to
fa638ed
Compare
Hardware initialization is based refcount, not
spi enable bit. Interface to disable selected bus
added
Summary
Impact
Testing