drivers: pwm: pwm_mcux: Convert driver to new DT_INST macros

Convert driver to use DT_INST macros and remove related board per
instance Kconfig symbol usage.  We also remove dts_fixup.h defines that
are no longer needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-04-15 11:56:52 -05:00 committed by Maureen Helm
parent 87186e5039
commit 476e90a6a5
4 changed files with 7 additions and 267 deletions

View file

@ -79,8 +79,4 @@ endchoice
endif # LVGL
config FLEXPWM2_PWM3
default y
depends on PWM_MCUX
endif # BOARD_MIMXRT1064_EVK

View file

@ -3,108 +3,8 @@
# Copyright (c) 2019 Linaro Limited.
# SPDX-License-Identifier: Apache-2.0
menuconfig PWM_MCUX
config PWM_MCUX
bool "MCUX PWM driver"
depends on HAS_MCUX_PWM
help
Enable mcux pwm driver.
if PWM_MCUX
config FLEXPWM1_PWM0
bool "NXP MCUX FLEXPWM1_PWM0 Output"
help
Enable output for FLEXPWM1_PWM0 in the driver. Say y here
if you want to use FLEXPWM1_PWM0 output.
config FLEXPWM1_PWM1
bool "NXP MCUX FLEXPWM1_PWM1 Output"
help
Enable output for FLEXPWM1_PWM1 in the driver. Say y here
if you want to use FLEXPWM1_PWM1 output.
config FLEXPWM1_PWM2
bool "NXP MCUX FLEXPWM1_PWM2 Output"
help
Enable output for FLEXPWM1_PWM2 in the driver. Say y here
if you want to use FLEXPWM1_PWM2 output.
config FLEXPWM1_PWM3
bool "NXP MCUX FLEXPWM1_PWM3 Output"
help
Enable output for FLEXPWM1_PWM3 in the driver. Say y here
if you want to use FLEXPWM1_PWM3 output.
config FLEXPWM2_PWM0
bool "NXP MCUX FLEXPWM2_PWM0 Output"
help
Enable output for FLEXPWM2_PWM0 in the driver. Say y here
if you want to use FLEXPWM2_PWM0 output.
config FLEXPWM2_PWM1
bool "NXP MCUX FLEXPWM2_PWM1 Output"
help
Enable output for FLEXPWM2_PWM1 in the driver. Say y here
if you want to use FLEXPWM2_PWM1 output.
config FLEXPWM2_PWM2
bool "NXP MCUX FLEXPWM2_PWM2 Output"
help
Enable output for FLEXPWM2_PWM2 in the driver. Say y here
if you want to use FLEXPWM2_PWM2 output.
config FLEXPWM2_PWM3
bool "NXP MCUX FLEXPWM2_PWM3 Output"
help
Enable output for FLEXPWM2_PWM3 in the driver. Say y here
if you want to use FLEXPWM2_PWM3 output.
config FLEXPWM3_PWM0
bool "NXP MCUX FLEXPWM3_PWM0 Output"
help
Enable output for FLEXPWM3_PWM0 in the driver. Say y here
if you want to use FLEXPWM3_PWM0 output.
config FLEXPWM3_PWM1
bool "NXP MCUX FLEXPWM3_PWM1 Output"
help
Enable output for FLEXPWM3_PWM1 in the driver. Say y here
if you want to use FLEXPWM3_PWM1 output.
config FLEXPWM3_PWM2
bool "NXP MCUX FLEXPWM3_PWM2 Output"
help
Enable output for FLEXPWM3_PWM2 in the driver. Say y here
if you want to use FLEXPWM3_PWM2 output.
config FLEXPWM3_PWM3
bool "NXP MCUX FLEXPWM3_PWM3 Output"
help
Enable output for FLEXPWM3_PWM3 in the driver. Say y here
if you want to use FLEXPWM3_PWM3 output.
config FLEXPWM4_PWM0
bool "NXP MCUX FLEXPWM4_PWM0 Output"
help
Enable output for FLEXPWM4_PWM0 in the driver. Say y here
if you want to use FLEXPWM4_PWM0 output.
config FLEXPWM4_PWM1
bool "NXP MCUX FLEXPWM4_PWM1 Output"
help
Enable output for FLEXPWM4_PWM1 in the driver. Say y here
if you want to use FLEXPWM4_PWM1 output.
config FLEXPWM4_PWM2
bool "NXP MCUX FLEXPWM4_PWM2 Output"
help
Enable output for FLEXPWM4_PWM2 in the driver. Say y here
if you want to use FLEXPWM4_PWM2 output.
config FLEXPWM4_PWM3
bool "NXP MCUX FLEXPWM4_PWM3 Output"
help
Enable output for FLEXPWM4_PWM3 in the driver. Say y here
if you want to use FLEXPWM4_PWM3 output.
endif # PWM_MCUX

View file

@ -4,6 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_imx_pwm
#include <errno.h>
#include <drivers/pwm.h>
#include <soc.h>
@ -154,81 +156,19 @@ static const struct pwm_driver_api pwm_mcux_driver_api = {
static struct pwm_mcux_data pwm_mcux_data_ ## n; \
\
static const struct pwm_mcux_config pwm_mcux_config_ ## n = { \
.base = (void *)DT_PWM_MCUX_ ## n ## _BASE_ADDRESS, \
.index = DT_PWM_MCUX_ ## n ## _INDEX, \
.base = (void *)DT_REG_ADDR(DT_PARENT(DT_DRV_INST(n))), \
.index = DT_INST_PROP(n, index), \
.mode = kPWM_EdgeAligned, \
.prescale = kPWM_Prescale_Divide_128, \
.clock_source = kCLOCK_IpgClk, \
}; \
\
DEVICE_AND_API_INIT(pwm_mcux_ ## n, \
DT_PWM_MCUX_ ## n ## _NAME, \
DT_INST_LABEL(n), \
pwm_mcux_init, \
&pwm_mcux_data_ ## n, \
&pwm_mcux_config_ ## n, \
POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,\
&pwm_mcux_driver_api);
#ifdef CONFIG_FLEXPWM1_PWM0
PWM_DEVICE_INIT_MCUX(0)
#endif
#ifdef CONFIG_FLEXPWM1_PWM1
PWM_DEVICE_INIT_MCUX(1)
#endif
#ifdef CONFIG_FLEXPWM1_PWM2
PWM_DEVICE_INIT_MCUX(2)
#endif
#ifdef CONFIG_FLEXPWM1_PWM3
PWM_DEVICE_INIT_MCUX(3)
#endif
#ifdef CONFIG_FLEXPWM2_PWM0
PWM_DEVICE_INIT_MCUX(4)
#endif
#ifdef CONFIG_FLEXPWM2_PWM1
PWM_DEVICE_INIT_MCUX(5)
#endif
#ifdef CONFIG_FLEXPWM2_PWM2
PWM_DEVICE_INIT_MCUX(6)
#endif
#ifdef CONFIG_FLEXPWM2_PWM3
PWM_DEVICE_INIT_MCUX(7)
#endif
#ifdef CONFIG_FLEXPWM3_PWM0
PWM_DEVICE_INIT_MCUX(8)
#endif
#ifdef CONFIG_FLEXPWM3_PWM1
PWM_DEVICE_INIT_MCUX(9)
#endif
#ifdef CONFIG_FLEXPWM3_PWM2
PWM_DEVICE_INIT_MCUX(10)
#endif
#ifdef CONFIG_FLEXPWM3_PWM3
PWM_DEVICE_INIT_MCUX(11)
#endif
#ifdef CONFIG_FLEXPWM4_PWM0
PWM_DEVICE_INIT_MCUX(12)
#endif
#ifdef CONFIG_FLEXPWM4_PWM1
PWM_DEVICE_INIT_MCUX(13)
#endif
#ifdef CONFIG_FLEXPWM4_PWM2
PWM_DEVICE_INIT_MCUX(14)
#endif
#ifdef CONFIG_FLEXPWM4_PWM3
PWM_DEVICE_INIT_MCUX(15)
#endif
DT_INST_FOREACH(PWM_DEVICE_INIT_MCUX)

View file

@ -21,102 +21,6 @@
#define DT_IRQ_ETH1_COMMON DT_NXP_KINETIS_ETHERNET_402D4000_IRQ_0
#define DT_IRQ_ETH1_IEEE1588_TMR DT_NXP_KINETIS_PTP_402D4000_PTP_IRQ_0
#define DT_PWM_MCUX_0_BASE_ADDRESS DT_NXP_FLEXPWM_403DC000_BASE_ADDRESS
#define DT_PWM_MCUX_0_IRQ DT_NXP_IMX_PWM_403DC000_PWM0_IRQ_0
#define DT_PWM_MCUX_0_IRQ_PRI DT_NXP_IMX_PWM_403DC000_PWM0_IRQ_0_PRIORITY
#define DT_PWM_MCUX_0_NAME DT_NXP_IMX_PWM_403DC000_PWM0_LABEL
#define DT_PWM_MCUX_0_INDEX DT_NXP_IMX_PWM_403DC000_PWM0_INDEX
#define DT_PWM_MCUX_1_BASE_ADDRESS DT_NXP_FLEXPWM_403DC000_BASE_ADDRESS
#define DT_PWM_MCUX_1_IRQ DT_NXP_IMX_PWM_403DC000_PWM1_IRQ_0
#define DT_PWM_MCUX_1_IRQ_PRI DT_NXP_IMX_PWM_403DC000_PWM1_IRQ_0_PRIORITY
#define DT_PWM_MCUX_1_NAME DT_NXP_IMX_PWM_403DC000_PWM1_LABEL
#define DT_PWM_MCUX_1_INDEX DT_NXP_IMX_PWM_403DC000_PWM1_INDEX
#define DT_PWM_MCUX_2_BASE_ADDRESS DT_NXP_FLEXPWM_403DC000_BASE_ADDRESS
#define DT_PWM_MCUX_2_IRQ DT_NXP_IMX_PWM_403DC000_PWM2_IRQ_0
#define DT_PWM_MCUX_2_IRQ_PRI DT_NXP_IMX_PWM_403DC000_PWM2_IRQ_0_PRIORITY
#define DT_PWM_MCUX_2_NAME DT_NXP_IMX_PWM_403DC000_PWM2_LABEL
#define DT_PWM_MCUX_2_INDEX DT_NXP_IMX_PWM_403DC000_PWM2_INDEX
#define DT_PWM_MCUX_3_BASE_ADDRESS DT_NXP_FLEXPWM_403DC000_BASE_ADDRESS
#define DT_PWM_MCUX_3_IRQ DT_NXP_IMX_PWM_403DC000_PWM3_IRQ_0
#define DT_PWM_MCUX_3_IRQ_PRI DT_NXP_IMX_PWM_403DC000_PWM3_IRQ_0_PRIORITY
#define DT_PWM_MCUX_3_NAME DT_NXP_IMX_PWM_403DC000_PWM3_LABEL
#define DT_PWM_MCUX_3_INDEX DT_NXP_IMX_PWM_403DC000_PWM3_INDEX
#define DT_PWM_MCUX_4_BASE_ADDRESS DT_NXP_FLEXPWM_403E0000_BASE_ADDRESS
#define DT_PWM_MCUX_4_IRQ DT_NXP_IMX_PWM_403E0000_PWM0_IRQ_0
#define DT_PWM_MCUX_4_IRQ_PRI DT_NXP_IMX_PWM_403E0000_PWM0_IRQ_0_PRIORITY
#define DT_PWM_MCUX_4_NAME DT_NXP_IMX_PWM_403E0000_PWM0_LABEL
#define DT_PWM_MCUX_4_INDEX DT_NXP_IMX_PWM_403E0000_PWM0_INDEX
#define DT_PWM_MCUX_5_BASE_ADDRESS DT_NXP_FLEXPWM_403E0000_BASE_ADDRESS
#define DT_PWM_MCUX_5_IRQ DT_NXP_IMX_PWM_403E0000_PWM1_IRQ_0
#define DT_PWM_MCUX_5_IRQ_PRI DT_NXP_IMX_PWM_403E0000_PWM1_IRQ_0_PRIORITY
#define DT_PWM_MCUX_5_NAME DT_NXP_IMX_PWM_403E0000_PWM1_LABEL
#define DT_PWM_MCUX_5_INDEX DT_NXP_IMX_PWM_403E0000_PWM1_INDEX
#define DT_PWM_MCUX_6_BASE_ADDRESS DT_NXP_FLEXPWM_403E0000_BASE_ADDRESS
#define DT_PWM_MCUX_6_IRQ DT_NXP_IMX_PWM_403E0000_PWM2_IRQ_0
#define DT_PWM_MCUX_6_IRQ_PRI DT_NXP_IMX_PWM_403E0000_PWM2_IRQ_0_PRIORITY
#define DT_PWM_MCUX_6_NAME DT_NXP_IMX_PWM_403E0000_PWM2_LABEL
#define DT_PWM_MCUX_6_INDEX DT_NXP_IMX_PWM_403E0000_PWM2_INDEX
#define DT_PWM_MCUX_7_BASE_ADDRESS DT_NXP_FLEXPWM_403E0000_BASE_ADDRESS
#define DT_PWM_MCUX_7_IRQ DT_NXP_IMX_PWM_403E0000_PWM3_IRQ_0
#define DT_PWM_MCUX_7_IRQ_PRI DT_NXP_IMX_PWM_403E0000_PWM3_IRQ_0_PRIORITY
#define DT_PWM_MCUX_7_NAME DT_NXP_IMX_PWM_403E0000_PWM3_LABEL
#define DT_PWM_MCUX_7_INDEX DT_NXP_IMX_PWM_403E0000_PWM3_INDEX
#define DT_PWM_MCUX_8_BASE_ADDRESS DT_NXP_FLEXPWM_403E4000_BASE_ADDRESS
#define DT_PWM_MCUX_8_IRQ DT_NXP_IMX_PWM_403E4000_PWM0_IRQ_0
#define DT_PWM_MCUX_8_IRQ_PRI DT_NXP_IMX_PWM_403E4000_PWM0_IRQ_0_PRIORITY
#define DT_PWM_MCUX_8_NAME DT_NXP_IMX_PWM_403E4000_PWM0_LABEL
#define DT_PWM_MCUX_8_INDEX DT_NXP_IMX_PWM_403E4000_PWM0_INDEX
#define DT_PWM_MCUX_9_BASE_ADDRESS DT_NXP_FLEXPWM_403E4000_BASE_ADDRESS
#define DT_PWM_MCUX_9_IRQ DT_NXP_IMX_PWM_403E4000_PWM1_IRQ_0
#define DT_PWM_MCUX_9_IRQ_PRI DT_NXP_IMX_PWM_403E4000_PWM1_IRQ_0_PRIORITY
#define DT_PWM_MCUX_9_NAME DT_NXP_IMX_PWM_403E4000_PWM1_LABEL
#define DT_PWM_MCUX_9_INDEX DT_NXP_IMX_PWM_403E4000_PWM1_INDEX
#define DT_PWM_MCUX_10_BASE_ADDRESS DT_NXP_FLEXPWM_403E4000_BASE_ADDRESS
#define DT_PWM_MCUX_10_IRQ DT_NXP_IMX_PWM_403E4000_PWM2_IRQ_0
#define DT_PWM_MCUX_10_IRQ_PRI DT_NXP_IMX_PWM_403E4000_PWM2_IRQ_0_PRIORITY
#define DT_PWM_MCUX_10_NAME DT_NXP_IMX_PWM_403E4000_PWM2_LABEL
#define DT_PWM_MCUX_10_INDEX DT_NXP_IMX_PWM_403E4000_PWM2_INDEX
#define DT_PWM_MCUX_11_BASE_ADDRESS DT_NXP_FLEXPWM_403E4000_BASE_ADDRESS
#define DT_PWM_MCUX_11_IRQ DT_NXP_IMX_PWM_403E4000_PWM3_IRQ_0
#define DT_PWM_MCUX_11_IRQ_PRI DT_NXP_IMX_PWM_403E4000_PWM3_IRQ_0_PRIORITY
#define DT_PWM_MCUX_11_NAME DT_NXP_IMX_PWM_403E4000_PWM3_LABEL
#define DT_PWM_MCUX_11_INDEX DT_NXP_IMX_PWM_403E4000_PWM3_INDEX
#define DT_PWM_MCUX_12_BASE_ADDRESS DT_NXP_FLEXPWM_403E8000_BASE_ADDRESS
#define DT_PWM_MCUX_12_IRQ DT_NXP_IMX_PWM_403E8000_PWM0_IRQ_0
#define DT_PWM_MCUX_12_IRQ_PRI DT_NXP_IMX_PWM_403E8000_PWM0_IRQ_0_PRIORITY
#define DT_PWM_MCUX_12_NAME DT_NXP_IMX_PWM_403E8000_PWM0_LABEL
#define DT_PWM_MCUX_12_INDEX DT_NXP_IMX_PWM_403E8000_PWM0_INDEX
#define DT_PWM_MCUX_13_BASE_ADDRESS DT_NXP_FLEXPWM_403E8000_BASE_ADDRESS
#define DT_PWM_MCUX_13_IRQ DT_NXP_IMX_PWM_403E8000_PWM1_IRQ_0
#define DT_PWM_MCUX_13_IRQ_PRI DT_NXP_IMX_PWM_403E8000_PWM1_IRQ_0_PRIORITY
#define DT_PWM_MCUX_13_NAME DT_NXP_IMX_PWM_403E8000_PWM1_LABEL
#define DT_PWM_MCUX_13_INDEX DT_NXP_IMX_PWM_403E8000_PWM1_INDEX
#define DT_PWM_MCUX_14_BASE_ADDRESS DT_NXP_FLEXPWM_403E8000_BASE_ADDRESS
#define DT_PWM_MCUX_14_IRQ DT_NXP_IMX_PWM_403E8000_PWM2_IRQ_0
#define DT_PWM_MCUX_14_IRQ_PRI DT_NXP_IMX_PWM_403E8000_PWM2_IRQ_0_PRIORITY
#define DT_PWM_MCUX_14_NAME DT_NXP_IMX_PWM_403E8000_PWM2_LABEL
#define DT_PWM_MCUX_14_INDEX DT_NXP_IMX_PWM_403E8000_PWM2_INDEX
#define DT_PWM_MCUX_15_BASE_ADDRESS DT_NXP_FLEXPWM_403E8000_BASE_ADDRESS
#define DT_PWM_MCUX_15_IRQ DT_NXP_IMX_PWM_403E8000_PWM3_IRQ_0
#define DT_PWM_MCUX_15_IRQ_PRI DT_NXP_IMX_PWM_403E8000_PWM3_IRQ_0_PRIORITY
#define DT_PWM_MCUX_15_NAME DT_NXP_IMX_PWM_403E8000_PWM3_LABEL
#define DT_PWM_MCUX_15_INDEX DT_NXP_IMX_PWM_403E8000_PWM3_INDEX
#define DT_VIDEO_MCUX_CSI_BASE_ADDRESS DT_NXP_IMX_CSI_402BC000_BASE_ADDRESS
#define DT_VIDEO_MCUX_CSI_IRQ DT_NXP_IMX_CSI_402BC000_IRQ_0
#define DT_VIDEO_MCUX_CSI_IRQ_PRI DT_NXP_IMX_CSI_402BC000_IRQ_0_PRIORITY