diff --git a/boards/arm/lpcxpresso55s36/lpcxpresso55s36.dts b/boards/arm/lpcxpresso55s36/lpcxpresso55s36.dts index df4fbbdc99b..3b51a1602f2 100644 --- a/boards/arm/lpcxpresso55s36/lpcxpresso55s36.dts +++ b/boards/arm/lpcxpresso55s36/lpcxpresso55s36.dts @@ -176,6 +176,10 @@ zephyr_udc0: &usbfs { status = "okay"; }; +&vref0 { + status = "okay"; +}; + &dac0 { status = "okay"; pinctrl-0 = <&pinmux_dac0>; diff --git a/dts/arm/nxp/nxp_lpc55S3x_common.dtsi b/dts/arm/nxp/nxp_lpc55S3x_common.dtsi index 77e1ed26b0e..99b105fbf81 100644 --- a/dts/arm/nxp/nxp_lpc55S3x_common.dtsi +++ b/dts/arm/nxp/nxp_lpc55S3x_common.dtsi @@ -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 { diff --git a/soc/arm/nxp_lpc/lpc55xxx/soc.c b/soc/arm/nxp_lpc/lpc55xxx/soc.c index a16b5c959f0..8084be53384 100644 --- a/soc/arm/nxp_lpc/lpc55xxx/soc.c +++ b/soc/arm/nxp_lpc/lpc55xxx/soc.c @@ -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 } /**