drivers: lpadc: Move SOC code out of driver
To be consistent with the current NXP clocking scheme, move the LPADC clocking code to the SOC files where all of the other peripheral clocking is done. Also remove any other SOC-specific code to the respective SOC file and out of this driver. Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
This commit is contained in:
parent
af6b9d857f
commit
4b45928e86
4 changed files with 50 additions and 77 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017, NXP
|
||||
* Copyright 2017, 2019-2023 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
@ -31,6 +31,9 @@
|
|||
#include "usb_phy.h"
|
||||
#include "usb.h"
|
||||
#endif
|
||||
#if defined(CONFIG_SOC_LPC55S36) && defined(CONFIG_ADC_MCUX_LPADC)
|
||||
#include <fsl_vref.h>
|
||||
#endif
|
||||
|
||||
#define CTIMER_CLOCK_SOURCE(node_id) \
|
||||
TO_CTIMER_CLOCK_SOURCE(DT_CLOCKS_CELL(node_id, name), DT_PROP(node_id, clk_source))
|
||||
|
@ -220,6 +223,33 @@ DT_FOREACH_STATUS_OKAY(nxp_lpc_ctimer, CTIMER_CLOCK_SETUP)
|
|||
(SYSCON_PWM1SUBCTL_CLK0_EN_MASK | SYSCON_PWM1SUBCTL_CLK1_EN_MASK |
|
||||
SYSCON_PWM1SUBCTL_CLK2_EN_MASK);
|
||||
#endif
|
||||
|
||||
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(adc0), nxp_lpc_lpadc, okay)
|
||||
#if defined(CONFIG_SOC_LPC55S36)
|
||||
CLOCK_SetClkDiv(kCLOCK_DivAdc0Clk, 2U, true);
|
||||
CLOCK_AttachClk(kFRO_HF_to_ADC0);
|
||||
|
||||
#if defined(CONFIG_ADC_MCUX_LPADC)
|
||||
/* Vref is required for LPADC reference */
|
||||
POWER_DisablePD(kPDRUNCFG_PD_VREF);
|
||||
|
||||
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
|
||||
#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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue