boards: arm: lpcxpresso55s36: Added dac support for LPC55S36

Added dac support for the LPC55S36 board, updated lpc55xxx/soc.c to
enable clock and power for dac0.

Signed-off-by: Albort Xue <yao.xue@nxp.com>
This commit is contained in:
Albort Xue 2023-09-07 16:38:44 +08:00 committed by Carles Cufí
commit 2073dc9cdd
6 changed files with 66 additions and 11 deletions

View file

@ -81,6 +81,8 @@ already supported, which can also be re-used on this lpcxpresso55s36 board:
+-----------+------------+-------------------------------------+
| USB FS | on-chip | USB Full Speed device |
+-----------+------------+-------------------------------------+
| DAC | on-chip | dac |
+-----------+------------+-------------------------------------+
Other hardware features are not currently enabled.

View file

@ -2,7 +2,7 @@
* NOTE: File generated by lpc_cfg_utils.py
* from LPC55S36.mex
*
* Copyright 2022 NXP
* Copyright 2022-2023 NXP
* SPDX-License-Identifier: Apache-2.0
*/
@ -119,4 +119,12 @@
slew-rate = "standard";
};
};
pinmux_dac0: pinmux_dac0 {
group0 {
pinmux = <DAC0_OUT_PIO1_22>;
slew-rate = "standard";
nxp,analog-mode;
};
};
};

View file

@ -175,3 +175,9 @@ zephyr_udc0: &usbfs {
&dma0 {
status = "okay";
};
&dac0 {
status = "okay";
pinctrl-0 = <&pinmux_dac0>;
pinctrl-names = "default";
};

View file

@ -18,3 +18,4 @@ supported:
- can
- gpio
- pwm
- dac

View file

@ -294,6 +294,33 @@
dma-names = "adc0-dma0", "adc0-dma1";
};
dac0: dac@b2000 {
compatible = "nxp,lpdac";
reg = < 0xb2000 0x1000>;
interrupts = <74 0>;
status = "disabled";
voltage-reference = <0>;
#io-channel-cells = <1>;
};
dac1: dac@b6000 {
compatible = "nxp,lpdac";
reg = < 0xb6000 0x1000>;
interrupts = <75 0>;
status = "disabled";
voltage-reference = <0>;
#io-channel-cells = <1>;
};
dac2: dac@b9000 {
compatible = "nxp,lpdac";
reg = < 0xb9000 0x1000>;
interrupts = <76 0>;
status = "disabled";
voltage-reference = <0>;
#io-channel-cells = <1>;
};
can0: can@4009d000 {
compatible = "nxp,lpc-mcan";
reg = <0x4009d000 0x1000>;

View file

@ -31,7 +31,8 @@
#include "usb_phy.h"
#include "usb.h"
#endif
#if defined(CONFIG_SOC_LPC55S36) && defined(CONFIG_ADC_MCUX_LPADC)
#if defined(CONFIG_SOC_LPC55S36) && (defined(CONFIG_ADC_MCUX_LPADC) \
|| defined(CONFIG_DAC_MCUX_LPDAC))
#include <fsl_vref.h>
#endif
@ -322,8 +323,26 @@ 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
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)));
#if defined(CONFIG_ADC_MCUX_LPADC)
/* Power up the ADC */
POWER_DisablePD(kPDRUNCFG_PD_LDOGPADC);
#endif
#endif
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(dac0), nxp_lpdac, okay)
#if defined(CONFIG_SOC_LPC55S36)
CLOCK_SetClkDiv(kCLOCK_DivDac0Clk, 1U, true);
CLOCK_AttachClk(kMAIN_CLK_to_DAC0);
/* 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);
@ -335,14 +354,6 @@ DT_FOREACH_STATUS_OKAY(nxp_lpc_ctimer, CTIMER_CLOCK_SETUP)
vrefConfig.enableVrefOut = true;
VREF_Init((VREF_Type *)VREF_BASE, &vrefConfig);
#endif
#else
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
}