drivers: mcux_gpt: convert to DT_INST defines

Convert driver to use DT_INST_ defines and remove Kconfig per instance
enablement in favor of DT_INST_ define existing.  Also, remove the
aliases that had been used for this driver in nxp_rt.dtsi.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2020-02-13 12:12:00 -06:00 committed by Kumar Gala
commit 41fcf784e9
5 changed files with 12 additions and 28 deletions

View file

@ -3,16 +3,8 @@
# Copyright (c) 2019 Linaro Limited
# SPDX-License-Identifier: Apache-2.0
menuconfig COUNTER_MCUX_GPT
config COUNTER_MCUX_GPT
bool "MCUX GPT driver"
depends on HAS_MCUX_GPT
help
Enable support for mcux General Purpose Timer (GPT) driver.
config COUNTER_MCUX_GPT1
bool "Enable Counter on GPT1"
depends on COUNTER_MCUX_GPT
config COUNTER_MCUX_GPT2
bool "Enable Counter on GPT2"
depends on COUNTER_MCUX_GPT

View file

@ -203,7 +203,7 @@ static const struct counter_driver_api mcux_gpt_driver_api = {
static struct mcux_gpt_data mcux_gpt_data_ ## n; \
\
static const struct mcux_gpt_config mcux_gpt_config_ ## n = { \
.base = (void *)DT_NXP_IMX_GPT_COUNTER_ ## n ## _BASE_ADDRESS, \
.base = (void *)DT_INST_## n ##_NXP_IMX_GPT_BASE_ADDRESS, \
.clock_source = kCLOCK_PerClk, \
.info = { \
.max_top_value = UINT32_MAX, \
@ -215,7 +215,7 @@ static const struct counter_driver_api mcux_gpt_driver_api = {
\
static int mcux_gpt_## n ##_init(struct device *dev); \
DEVICE_AND_API_INIT(mcux_gpt ## n, \
DT_NXP_IMX_GPT_COUNTER_ ## n ## _LABEL, \
DT_INST_## n ##_NXP_IMX_GPT_LABEL, \
mcux_gpt_## n ##_init, \
&mcux_gpt_data_ ## n, \
&mcux_gpt_config_ ## n, \
@ -224,17 +224,17 @@ static const struct counter_driver_api mcux_gpt_driver_api = {
\
static int mcux_gpt_## n ##_init(struct device *dev) \
{ \
IRQ_CONNECT(DT_NXP_IMX_GPT_COUNTER_## n ##_IRQ_0, \
DT_NXP_IMX_GPT_COUNTER_## n ##_IRQ_0_PRIORITY, \
IRQ_CONNECT(DT_INST_## n ##_NXP_IMX_GPT_IRQ_0, \
DT_INST_## n ##_NXP_IMX_GPT_IRQ_0_PRIORITY, \
mcux_gpt_isr, DEVICE_GET(mcux_gpt ## n), 0); \
irq_enable(DT_NXP_IMX_GPT_COUNTER_## n ##_IRQ_0); \
irq_enable(DT_INST_## n ##_NXP_IMX_GPT_IRQ_0); \
return mcux_gpt_init(dev); \
} \
#ifdef CONFIG_COUNTER_MCUX_GPT1
GPT_DEVICE_INIT_MCUX(1)
#ifdef DT_INST_0_NXP_IMX_GPT
GPT_DEVICE_INIT_MCUX(0)
#endif
#ifdef CONFIG_COUNTER_MCUX_GPT2
GPT_DEVICE_INIT_MCUX(2)
#ifdef DT_INST_1_NXP_IMX_GPT
GPT_DEVICE_INIT_MCUX(1)
#endif

View file

@ -11,8 +11,6 @@
/ {
aliases {
counter-1 = &gpt1;
counter-2 = &gpt2;
eth = &eth;
gpio-1 = &gpio1;
gpio-2 = &gpio2;

View file

@ -52,12 +52,6 @@ if COUNTER
config COUNTER_MCUX_GPT
default y if HAS_MCUX_GPT
config COUNTER_MCUX_GPT1
default y if HAS_MCUX_GPT
config COUNTER_MCUX_GPT2
default y if HAS_MCUX_GPT
endif # COUNTER
config SPI_MCUX_LPSPI

View file

@ -13,8 +13,8 @@
#define DT_MCUX_CCM_BASE_ADDRESS DT_NXP_IMX_CCM_400FC000_BASE_ADDRESS
#define DT_MCUX_CCM_NAME DT_NXP_IMX_CCM_400FC000_LABEL
#define DT_RTC_0_NAME DT_NXP_IMX_GPT_COUNTER_1_LABEL
#define DT_RTC_1_NAME DT_NXP_IMX_GPT_COUNTER_2_LABEL
#define DT_RTC_0_NAME DT_INST_0_NXP_IMX_GPT_LABEL
#define DT_RTC_1_NAME DT_INST_1_NXP_IMX_GPT_LABEL
#define DT_ETH_MCUX_0_NAME DT_NXP_KINETIS_ETHERNET_402D8000_LABEL