drivers: counter: imx_epit: Convert driver to new DT_INST macros
Convert driver to use DT_INST macros and remove related board per instance Kconfig symbol usage. Also update counter_basic_api test to use DT_INST and remove the udoo_neo_full_m4.conf as its not longer needed since the per instance Kconfig sybmols don't exist anymore. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
7064bab954
commit
6c6c1010bb
6 changed files with 14 additions and 51 deletions
|
@ -8,8 +8,4 @@ if BOARD_UDOO_NEO_FULL_M4
|
|||
config BOARD
|
||||
default "udoo_neo_full_m4"
|
||||
|
||||
config COUNTER_IMX_EPIT_1
|
||||
default y
|
||||
depends on COUNTER_IMX_EPIT
|
||||
|
||||
endif # BOARD_UDOO_NEO_FULL_M4
|
||||
|
|
|
@ -8,17 +8,3 @@ config COUNTER_IMX_EPIT
|
|||
depends on HAS_IMX_EPIT
|
||||
help
|
||||
Enable the IMX EPIT driver.
|
||||
|
||||
if COUNTER_IMX_EPIT
|
||||
|
||||
config COUNTER_IMX_EPIT_1
|
||||
bool "Counter 1"
|
||||
help
|
||||
Enable Counter 1.
|
||||
|
||||
config COUNTER_IMX_EPIT_2
|
||||
bool "Counter 2"
|
||||
help
|
||||
Enable Counter 2.
|
||||
|
||||
endif # COUNTER_IMX_EPIT
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
#define DT_DRV_COMPAT nxp_imx_epit
|
||||
|
||||
#include <drivers/counter.h>
|
||||
#include <device.h>
|
||||
|
@ -151,36 +152,30 @@ static const struct counter_driver_api imx_epit_driver_api = {
|
|||
|
||||
#define COUNTER_IMX_EPIT_DEVICE(idx) \
|
||||
static int imx_epit_config_func_##idx(struct device *dev); \
|
||||
static const struct imx_epit_config imx_epit_##idx##z_config = { \
|
||||
static const struct imx_epit_config imx_epit_##idx##z_config = { \
|
||||
.info = { \
|
||||
.max_top_value = COUNTER_MAX_RELOAD, \
|
||||
.freq = 1U, \
|
||||
.flags = 0, \
|
||||
.channels = 0U, \
|
||||
}, \
|
||||
.base = (EPIT_Type *)DT_COUNTER_IMX_EPIT_##idx##_BASE_ADDRESS, \
|
||||
.prescaler = DT_COUNTER_IMX_EPIT_##idx##_PRESCALER, \
|
||||
.base = (EPIT_Type *)DT_INST_REG_ADDR(idx), \
|
||||
.prescaler = DT_INST_PROP(idx, prescaler), \
|
||||
}; \
|
||||
static struct imx_epit_data imx_epit_##idx##_data; \
|
||||
DEVICE_AND_API_INIT(epit_##idx, DT_COUNTER_IMX_EPIT_##idx##_LABEL, \
|
||||
DEVICE_AND_API_INIT(epit_##idx, DT_INST_LABEL(idx), \
|
||||
&imx_epit_config_func_##idx, \
|
||||
&imx_epit_##idx##_data, &imx_epit_##idx##z_config.info, \
|
||||
&imx_epit_##idx##_data, &imx_epit_##idx##z_config.info, \
|
||||
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \
|
||||
&imx_epit_driver_api); \
|
||||
static int imx_epit_config_func_##idx(struct device *dev) \
|
||||
{ \
|
||||
imx_epit_init(dev); \
|
||||
IRQ_CONNECT(DT_COUNTER_IMX_EPIT_##idx##_IRQ, \
|
||||
DT_COUNTER_IMX_EPIT_##idx##_IRQ_PRI, \
|
||||
IRQ_CONNECT(DT_INST_IRQN(idx), \
|
||||
DT_INST_IRQ(idx, priority), \
|
||||
imx_epit_isr, DEVICE_GET(epit_##idx), 0); \
|
||||
irq_enable(DT_COUNTER_IMX_EPIT_##idx##_IRQ); \
|
||||
irq_enable(DT_INST_IRQN(idx)); \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
#ifdef CONFIG_COUNTER_IMX_EPIT_1
|
||||
COUNTER_IMX_EPIT_DEVICE(1);
|
||||
#endif /* CONFIG_COUNTER_IMX_EPIT_1 */
|
||||
|
||||
#ifdef CONFIG_COUNTER_IMX_EPIT_2
|
||||
COUNTER_IMX_EPIT_DEVICE(2);
|
||||
#endif /* CONFIG_COUNTER_IMX_EPIT_2 */
|
||||
DT_INST_FOREACH(COUNTER_IMX_EPIT_DEVICE)
|
||||
|
|
|
@ -5,15 +5,3 @@
|
|||
*/
|
||||
|
||||
#define DT_NUM_IRQ_PRIO_BITS DT_ARM_V7M_NVIC_E000E100_ARM_NUM_IRQ_PRIORITY_BITS
|
||||
|
||||
#define DT_COUNTER_IMX_EPIT_1_BASE_ADDRESS DT_NXP_IMX_EPIT_420D0000_BASE_ADDRESS
|
||||
#define DT_COUNTER_IMX_EPIT_1_IRQ DT_NXP_IMX_EPIT_420D0000_IRQ_0
|
||||
#define DT_COUNTER_IMX_EPIT_1_IRQ_PRI DT_NXP_IMX_EPIT_420D0000_IRQ_0_PRIORITY
|
||||
#define DT_COUNTER_IMX_EPIT_1_LABEL DT_NXP_IMX_EPIT_420D0000_LABEL
|
||||
#define DT_COUNTER_IMX_EPIT_1_PRESCALER DT_NXP_IMX_EPIT_420D0000_PRESCALER
|
||||
|
||||
#define DT_COUNTER_IMX_EPIT_2_BASE_ADDRESS DT_NXP_IMX_EPIT_420D4000_BASE_ADDRESS
|
||||
#define DT_COUNTER_IMX_EPIT_2_IRQ DT_NXP_IMX_EPIT_420D4000_IRQ_0
|
||||
#define DT_COUNTER_IMX_EPIT_2_IRQ_PRI DT_NXP_IMX_EPIT_420D4000_IRQ_0_PRIORITY
|
||||
#define DT_COUNTER_IMX_EPIT_2_LABEL DT_NXP_IMX_EPIT_420D4000_LABEL
|
||||
#define DT_COUNTER_IMX_EPIT_2_PRESCALER DT_NXP_IMX_EPIT_420D4000_PRESCALER
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
CONFIG_COUNTER_IMX_EPIT_1=y
|
||||
CONFIG_COUNTER_IMX_EPIT_2=y
|
|
@ -51,11 +51,11 @@ static const char * const devices[] = {
|
|||
#ifdef CONFIG_COUNTER_RTC2
|
||||
DT_NORDIC_NRF_RTC_RTC_2_LABEL,
|
||||
#endif
|
||||
#ifdef CONFIG_COUNTER_IMX_EPIT_1
|
||||
DT_COUNTER_IMX_EPIT_1_LABEL,
|
||||
#if DT_HAS_NODE(DT_INST(0, nxp_imx_epit))
|
||||
DT_LABEL(DT_INST(0, nxp_imx_epit)),
|
||||
#endif
|
||||
#ifdef CONFIG_COUNTER_IMX_EPIT_2
|
||||
DT_COUNTER_IMX_EPIT_2_LABEL,
|
||||
#if DT_HAS_NODE(DT_INST(1, nxp_imx_epit))
|
||||
DT_LABEL(DT_INST(1, nxp_imx_epit)),
|
||||
#endif
|
||||
#if DT_HAS_NODE(DT_INST(0, arm_cmsdk_timer))
|
||||
DT_LABEL(DT_INST(0, arm_cmsdk_timer)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue