-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
drivers: regulator: Add NXP VREF driver #56822
drivers: regulator: Add NXP VREF driver #56822
Conversation
const struct regulator_nxp_vref_config *config = dev->config; | ||
const VREF_Type *base = (VREF_Type *) config->base; | ||
|
||
volatile uint32_t *const csr = (volatile uint32_t *const) &base->CSR; |
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 declare this? You can just reference base->CSR
in the function. I guess compiler should optimize this anyways, just not sure why we add it.
* Disable HC Bandgap, LP Bandgap, and Buf21 | ||
* to achieve "Off" mode of VREF | ||
*/ | ||
*csr &= ~VREF_CSR_HCBGEN_MASK; |
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 doesn't seen like the VREF_CSR_BUF21EN_MASK
is being cleared here, contrary to what comment suggests.
4d1f4a7
to
658e052
Compare
0659acb
to
a5759a6
Compare
@gmarull can you revisit this PR? I marked your comments as resolved if I thought I addressed them just to navigate the thread easier, but feel free to unresolve if needed. I would like to make progress on this because there are multiple platforms and multiple other IP blocks that depend on this one. |
a5759a6
to
41c6971
Compare
@gmarull I think I addressed your comments, can you check? |
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.
lgtm, a few nitpicks
Add binding, include header, and driver for NXP VREF IP block. NXP VREF is an internal voltage reference generator on some SOCs that fits well with the regulator API in zephyr. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add node for VREF0 peripheral to LPC55S3X SOC DT Clock VREF peripheral if status = okay in DT Enable VREF on lpcxpresso55s36 Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Add phandle prop to reference any regulator that must be enabled in order for the LPADC to function as intended. Change LPADC driver to use this property if present. LPADC on LPC55S36 depends on VREF peripheral, enable for this platform. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
Support lpcxpresso55s36 on regulator voltage test using VREF Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
41c6971
to
0b98a62
Compare
@danieldegrasse @aasinclair review ping |
VREF is a peripheral on NXP's LPC55S36 which generates a reference voltage and can take advantage of an internal regulator to keep the signal stable. This SOC peripheral fits nicely into the Zephyr regulator API, so in this PR I am adding a Zephyr native driver for this peripheral. To show that it is somewhat functional, I replaced the VREF SDK code in init for LPC55S36, which is needed to use LPADC, with a call to enable the regulator(s) in the LPADC driver that it needs to function.