soc: lpc55s3x: Enable VREF

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>
This commit is contained in:
Declan Snyder 2023-04-12 15:19:44 +00:00 committed by Carles Cufí
commit 15bc6a2389
3 changed files with 25 additions and 20 deletions

View file

@ -176,6 +176,10 @@ zephyr_udc0: &usbfs {
status = "okay";
};
&vref0 {
status = "okay";
};
&dac0 {
status = "okay";
pinctrl-0 = <&pinmux_dac0>;

View file

@ -462,6 +462,15 @@
prescaler = <2>;
#pwm-cells = <3>;
};
vref0: vref@b5000 {
compatible = "nxp,vref";
regulator-name = "lpc55s36-vref";
reg = <0xb5000 0x30>;
status = "disabled";
nxp,buffer-startup-delay-us = <400>;
nxp,bandgap-startup-time-us = <20>;
};
};
&nvic {

View file

@ -1,5 +1,4 @@
/*
* Copyright 2017, 2019-2023 NXP
/* Copyright 2017, 2019-2023 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -323,15 +322,21 @@ DT_FOREACH_STATUS_OKAY(nxp_lpc_ctimer, CTIMER_CLOCK_SETUP)
#if defined(CONFIG_SOC_LPC55S36)
CLOCK_SetClkDiv(kCLOCK_DivAdc0Clk, 2U, true);
CLOCK_AttachClk(kFRO_HF_to_ADC0);
#else
#else /* not LPC55s36 */
CLOCK_SetClkDiv(kCLOCK_DivAdcAsyncClk,
DT_PROP(DT_NODELABEL(adc0), clk_divider), true);
CLOCK_AttachClk(MUX_A(CM_ADCASYNCCLKSEL, DT_PROP(DT_NODELABEL(adc0), clk_source)));
/* Power up the ADC */
POWER_DisablePD(kPDRUNCFG_PD_LDOGPADC);
#endif
#endif
#endif /* SOC platform */
#endif /* ADC */
#if (DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(vref0), nxp_vref, okay))
CLOCK_EnableClock(kCLOCK_Vref);
POWER_DisablePD(kPDRUNCFG_PD_VREF);
#endif /* vref0 */
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(dac0), nxp_lpdac, okay)
#if defined(CONFIG_SOC_LPC55S36)
CLOCK_SetClkDiv(kCLOCK_DivDac0Clk, 1U, true);
@ -339,22 +344,9 @@ DT_FOREACH_STATUS_OKAY(nxp_lpc_ctimer, CTIMER_CLOCK_SETUP)
/* Disable DAC0 power down */
POWER_DisablePD(kPDRUNCFG_PD_DAC0);
#endif
#endif
#if defined(CONFIG_SOC_LPC55S36)
#if (defined(CONFIG_ADC_MCUX_LPADC) || defined(CONFIG_DAC_MCUX_LPDAC))
/* Vref is required for LPADC reference */
POWER_DisablePD(kPDRUNCFG_PD_VREF);
#endif /* SOC platform */
#endif /* DAC */
vref_config_t vrefConfig;
VREF_GetDefaultConfig(&vrefConfig);
vrefConfig.bufferMode = kVREF_ModeHighPowerBuffer;
vrefConfig.enableInternalVoltageRegulator = true;
vrefConfig.enableVrefOut = true;
VREF_Init((VREF_Type *)VREF_BASE, &vrefConfig);
#endif
#endif
}
/**