drivers: clock_control: mcux_sim: convert to DT_INST defines
Convert driver to use DT_INST_ defines. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
a32eed06f7
commit
a9e68d61df
8 changed files with 27 additions and 41 deletions
|
@ -43,15 +43,37 @@ static int mcux_sim_get_subsys_rate(struct device *dev,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DT_INST_0_NXP_KINETIS_KE1XF_SIM
|
||||||
|
#define NXP_KINETIS_SIM_LABEL DT_INST_0_NXP_KINETIS_KE1XF_SIM_LABEL
|
||||||
|
#ifdef DT_INST_0_NXP_KINETIS_KE1XF_SIM_CLKOUT_SOURCE
|
||||||
|
#define NXP_KINETIS_SIM_CLKOUT_SOURCE \
|
||||||
|
DT_INST_0_NXP_KINETIS_KE1XF_SIM_CLKOUT_SOURCE
|
||||||
|
#endif
|
||||||
|
#ifdef DT_INST_0_NXP_KINETIS_KE1XF_SIM_CLKOUT_DIVIDER
|
||||||
|
#define NXP_KINETIS_SIM_CLKOUT_DIVIDER \
|
||||||
|
DT_INST_0_NXP_KINETIS_KE1XF_SIM_CLKOUT_DIVIDER
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define NXP_KINETIS_SIM_LABEL DT_INST_0_NXP_KINETIS_SIM_LABEL
|
||||||
|
#ifdef DT_INST_0_NXP_KINETIS_SIM_CLKOUT_SOURCE
|
||||||
|
#define NXP_KINETIS_SIM_CLKOUT_SOURCE \
|
||||||
|
DT_INST_0_NXP_KINETIS_SIM_CLKOUT_SOURCE
|
||||||
|
#endif
|
||||||
|
#ifdef DT_INST_0_NXP_KINETIS_SIM_CLKOUT_DIVIDER
|
||||||
|
#define NXP_KINETIS_SIM_CLKOUT_DIVIDER \
|
||||||
|
DT_INST_0_NXP_KINETIS_SIM_CLKOUT_DIVIDER
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
static int mcux_sim_init(struct device *dev)
|
static int mcux_sim_init(struct device *dev)
|
||||||
{
|
{
|
||||||
#ifdef DT_SIM_CLKOUT_DIVIDER
|
#ifdef NXP_KINETIS_SIM_CLKOUT_DIVIDER
|
||||||
SIM->CHIPCTL = (SIM->CHIPCTL & ~SIM_CHIPCTL_CLKOUTDIV_MASK)
|
SIM->CHIPCTL = (SIM->CHIPCTL & ~SIM_CHIPCTL_CLKOUTDIV_MASK)
|
||||||
| SIM_CHIPCTL_CLKOUTDIV(DT_SIM_CLKOUT_DIVIDER);
|
| SIM_CHIPCTL_CLKOUTDIV(NXP_KINETIS_SIM_CLKOUT_DIVIDER);
|
||||||
#endif
|
#endif
|
||||||
#ifdef DT_SIM_CLKOUT_SOURCE
|
#ifdef NXP_KINETIS_SIM_CLKOUT_SOURCE
|
||||||
SIM->CHIPCTL = (SIM->CHIPCTL & ~SIM_CHIPCTL_CLKOUTSEL_MASK)
|
SIM->CHIPCTL = (SIM->CHIPCTL & ~SIM_CHIPCTL_CLKOUTSEL_MASK)
|
||||||
| SIM_CHIPCTL_CLKOUTSEL(DT_SIM_CLKOUT_SOURCE);
|
| SIM_CHIPCTL_CLKOUTSEL(NXP_KINETIS_SIM_CLKOUT_SOURCE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -63,7 +85,7 @@ static const struct clock_control_driver_api mcux_sim_driver_api = {
|
||||||
.get_rate = mcux_sim_get_subsys_rate,
|
.get_rate = mcux_sim_get_subsys_rate,
|
||||||
};
|
};
|
||||||
|
|
||||||
DEVICE_AND_API_INIT(mcux_sim, DT_SIM_NAME,
|
DEVICE_AND_API_INIT(mcux_sim, NXP_KINETIS_SIM_LABEL,
|
||||||
&mcux_sim_init,
|
&mcux_sim_init,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
#define DT_ADC_0_IRQ_PRI DT_NXP_KINETIS_ADC16_4003B000_IRQ_0_PRIORITY
|
#define DT_ADC_0_IRQ_PRI DT_NXP_KINETIS_ADC16_4003B000_IRQ_0_PRIORITY
|
||||||
#define DT_ADC_0_NAME DT_NXP_KINETIS_ADC16_4003B000_LABEL
|
#define DT_ADC_0_NAME DT_NXP_KINETIS_ADC16_4003B000_LABEL
|
||||||
|
|
||||||
#define DT_SIM_BASE_ADDRESS DT_NXP_KINETIS_SIM_40047000_BASE_ADDRESS
|
|
||||||
#define DT_SIM_NAME DT_NXP_KINETIS_SIM_40047000_LABEL
|
|
||||||
|
|
||||||
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFE_40020000_BASE_ADDRESS
|
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFE_40020000_BASE_ADDRESS
|
||||||
#define DT_FLASH_DEV_NAME DT_NXP_KINETIS_FTFE_40020000_LABEL
|
#define DT_FLASH_DEV_NAME DT_NXP_KINETIS_FTFE_40020000_LABEL
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,6 @@
|
||||||
#define DT_ADC_1_IRQ_PRI DT_NXP_KINETIS_ADC16_400BB000_IRQ_0_PRIORITY
|
#define DT_ADC_1_IRQ_PRI DT_NXP_KINETIS_ADC16_400BB000_IRQ_0_PRIORITY
|
||||||
#define DT_ADC_1_NAME DT_NXP_KINETIS_ADC16_400BB000_LABEL
|
#define DT_ADC_1_NAME DT_NXP_KINETIS_ADC16_400BB000_LABEL
|
||||||
|
|
||||||
#define DT_SIM_BASE_ADDRESS DT_NXP_KINETIS_SIM_40047000_BASE_ADDRESS
|
|
||||||
#define DT_SIM_NAME DT_NXP_KINETIS_SIM_40047000_LABEL
|
|
||||||
|
|
||||||
#define DT_RTC_0_NAME DT_NXP_KINETIS_RTC_4003D000_LABEL
|
#define DT_RTC_0_NAME DT_NXP_KINETIS_RTC_4003D000_LABEL
|
||||||
|
|
||||||
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFE_40020000_BASE_ADDRESS
|
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFE_40020000_BASE_ADDRESS
|
||||||
|
|
|
@ -7,14 +7,6 @@
|
||||||
/* SoC level DTS fixup file */
|
/* SoC level DTS fixup file */
|
||||||
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
|
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
|
||||||
|
|
||||||
#define DT_SIM_NAME DT_NXP_KINETIS_SIM_40047000_LABEL
|
|
||||||
#ifdef DT_NXP_KINETIS_SIM_40047000_CLKOUT_DIVIDER
|
|
||||||
#define DT_SIM_CLKOUT_DIVIDER DT_NXP_KINETIS_SIM_40047000_CLKOUT_DIVIDER
|
|
||||||
#endif
|
|
||||||
#ifdef DT_NXP_KINETIS_SIM_40047000_CLKOUT_SOURCE
|
|
||||||
#define DT_SIM_CLKOUT_SOURCE DT_NXP_KINETIS_SIM_40047000_CLKOUT_SOURCE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFA_40020000_BASE_ADDRESS
|
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFA_40020000_BASE_ADDRESS
|
||||||
#define DT_FLASH_DEV_NAME DT_NXP_KINETIS_FTFA_40020000_LABEL
|
#define DT_FLASH_DEV_NAME DT_NXP_KINETIS_FTFA_40020000_LABEL
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,6 @@
|
||||||
/* SoC level DTS fixup file */
|
/* SoC level DTS fixup file */
|
||||||
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
|
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
|
||||||
|
|
||||||
#define DT_SIM_NAME DT_NXP_KINETIS_KE1XF_SIM_40048000_LABEL
|
|
||||||
#ifdef DT_NXP_KINETIS_KE1XF_SIM_40048000_CLKOUT_DIVIDER
|
|
||||||
#define DT_SIM_CLKOUT_DIVIDER DT_NXP_KINETIS_KE1XF_SIM_40048000_CLKOUT_DIVIDER
|
|
||||||
#endif /* DT_NXP_KINETIS_KE1XF_SIM_40048000_CLKOUT_DIVIDER */
|
|
||||||
#ifdef DT_NXP_KINETIS_KE1XF_SIM_40048000_CLKOUT_SOURCE
|
|
||||||
#define DT_SIM_CLKOUT_SOURCE DT_NXP_KINETIS_KE1XF_SIM_40048000_CLKOUT_SOURCE
|
|
||||||
#endif /* DT_NXP_KINETIS_KE1XF_SIM_40048000_CLKOUT_SOURCE */
|
|
||||||
|
|
||||||
#define DT_RTC_0_NAME DT_NXP_KINETIS_RTC_4003D000_LABEL
|
#define DT_RTC_0_NAME DT_NXP_KINETIS_RTC_4003D000_LABEL
|
||||||
|
|
||||||
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFE_40020000_BASE_ADDRESS
|
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFE_40020000_BASE_ADDRESS
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
#define DT_ADC_0_IRQ_PRI DT_NXP_KINETIS_ADC16_4003B000_IRQ_0_PRIORITY
|
#define DT_ADC_0_IRQ_PRI DT_NXP_KINETIS_ADC16_4003B000_IRQ_0_PRIORITY
|
||||||
#define DT_ADC_0_NAME DT_NXP_KINETIS_ADC16_4003B000_LABEL
|
#define DT_ADC_0_NAME DT_NXP_KINETIS_ADC16_4003B000_LABEL
|
||||||
|
|
||||||
#define DT_SIM_BASE_ADDRESS DT_NXP_KINETIS_SIM_40047000_BASE_ADDRESS
|
|
||||||
#define DT_SIM_NAME DT_NXP_KINETIS_SIM_40047000_LABEL
|
|
||||||
|
|
||||||
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFA_40020000_BASE_ADDRESS
|
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFA_40020000_BASE_ADDRESS
|
||||||
#define DT_FLASH_DEV_NAME DT_NXP_KINETIS_FTFA_40020000_LABEL
|
#define DT_FLASH_DEV_NAME DT_NXP_KINETIS_FTFA_40020000_LABEL
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,6 @@
|
||||||
/* SoC level DTS fixup file */
|
/* SoC level DTS fixup file */
|
||||||
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
|
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
|
||||||
|
|
||||||
#define DT_SIM_NAME DT_NXP_KINETIS_SIM_40047000_LABEL
|
|
||||||
#ifdef DT_NXP_KINETIS_SIM_40047000_CLKOUT_DIVIDER
|
|
||||||
#define DT_SIM_CLKOUT_DIVIDER DT_NXP_KINETIS_SIM_40047000_CLKOUT_DIVIDER
|
|
||||||
#endif /* DT_NXP_KINETIS_SIM_40047000_CLKOUT_DIVIDER */
|
|
||||||
#ifdef DT_NXP_KINETIS_SIM_40047000_CLKOUT_SOURCE
|
|
||||||
#define DT_SIM_CLKOUT_SOURCE DT_NXP_KINETIS_SIM_40047000_CLKOUT_SOURCE
|
|
||||||
#endif /* DT_NXP_KINETIS_SIM_40047000_CLKOUT_SOURCE */
|
|
||||||
|
|
||||||
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFE_40020000_BASE_ADDRESS
|
#define DT_FLASH_DEV_BASE_ADDRESS DT_NXP_KINETIS_FTFE_40020000_BASE_ADDRESS
|
||||||
#define DT_FLASH_DEV_NAME DT_NXP_KINETIS_FTFE_40020000_LABEL
|
#define DT_FLASH_DEV_NAME DT_NXP_KINETIS_FTFE_40020000_LABEL
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,6 @@
|
||||||
#define DT_ADC_0_IRQ_PRI DT_NXP_KINETIS_ADC16_4003B000_IRQ_0_PRIORITY
|
#define DT_ADC_0_IRQ_PRI DT_NXP_KINETIS_ADC16_4003B000_IRQ_0_PRIORITY
|
||||||
#define DT_ADC_0_NAME DT_NXP_KINETIS_ADC16_4003B000_LABEL
|
#define DT_ADC_0_NAME DT_NXP_KINETIS_ADC16_4003B000_LABEL
|
||||||
|
|
||||||
#define DT_SIM_BASE_ADDRESS DT_NXP_KINETIS_SIM_40047000_BASE_ADDRESS
|
|
||||||
#define DT_SIM_NAME DT_NXP_KINETIS_SIM_40047000_LABEL
|
|
||||||
|
|
||||||
#define DT_RTC_0_NAME DT_NXP_KINETIS_RTC_4003D000_LABEL
|
#define DT_RTC_0_NAME DT_NXP_KINETIS_RTC_4003D000_LABEL
|
||||||
|
|
||||||
#if defined(CONFIG_SOC_MKW22D5) || defined(CONFIG_SOC_MKW24D5)
|
#if defined(CONFIG_SOC_MKW22D5) || defined(CONFIG_SOC_MKW24D5)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue