drivers: gpio: mcux_lpc: Convert driver to use devicetree port prop

Move to using port property for a few cases in which we need to know
which specific hardware port a device is for.  This allows us to
remove the PORT0/1 Kconfig options.  This also fixes the issue that
assumed pio0 would map to DT_INST(0) and pio1 would map to DT_INST(1)

Fixes #35693

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2021-05-28 10:37:05 -05:00 committed by Carles Cufí
parent 5fcbe5e099
commit 7f77240126
7 changed files with 9 additions and 78 deletions

View file

@ -9,14 +9,4 @@ config BOARD
default "lpcxpresso54114_m4" if BOARD_LPCXPRESSO54114_M4
default "lpcxpresso54114_m0" if BOARD_LPCXPRESSO54114_M0
if GPIO_MCUX_LPC
config GPIO_MCUX_LPC_PORT0
default y
config GPIO_MCUX_LPC_PORT1
default y
endif # GPIO_MCUX_LPC
endif # BOARD_LPCXPRESSO54114_M4 || BOARD_LPCXPRESSO54114_M0

View file

@ -8,16 +8,6 @@ if BOARD_LPCXPRESSO55S16
config BOARD
default "lpcxpresso55S16"
if GPIO_MCUX_LPC
config GPIO_MCUX_LPC_PORT0
default y
config GPIO_MCUX_LPC_PORT1
default y
endif # GPIO_MCUX_LPC
config FXOS8700_DRDY_INT1
default y
depends on FXOS8700_TRIGGER

View file

@ -8,16 +8,6 @@ if BOARD_LPCXPRESSO55S28
config BOARD
default "lpcxpresso55S28"
if GPIO_MCUX_LPC
config GPIO_MCUX_LPC_PORT0
default y
config GPIO_MCUX_LPC_PORT1
default y
endif # GPIO_MCUX_LPC
config FXOS8700_DRDY_INT1
default y
depends on FXOS8700_TRIGGER

View file

@ -9,16 +9,6 @@ config BOARD
default "lpcxpresso55S69_cpu0" if BOARD_LPCXPRESSO55S69_CPU0
default "lpcxpresso55S69_cpu1" if BOARD_LPCXPRESSO55S69_CPU1
if GPIO_MCUX_LPC
config GPIO_MCUX_LPC_PORT0
default y
config GPIO_MCUX_LPC_PORT1
default y
endif # GPIO_MCUX_LPC
config FXOS8700_DRDY_INT1
default y
depends on FXOS8700_TRIGGER

View file

@ -24,16 +24,6 @@ choice FLASH_MCUX_FLEXSPI_XIP_MEM_TARGET
default FLASH_MCUX_FLEXSPI_XIP_MEM_SRAM
endchoice
if GPIO_MCUX_LPC
config GPIO_MCUX_LPC_PORT0
default y
config GPIO_MCUX_LPC_PORT1
default y
endif # GPIO_MCUX_LPC
config FXOS8700_DRDY_INT1
default y
depends on FXOS8700_TRIGGER

View file

@ -3,24 +3,8 @@
# Copyright (c) 2017, NXP
# SPDX-License-Identifier: Apache-2.0
menuconfig GPIO_MCUX_LPC
config GPIO_MCUX_LPC
bool "MCUX LPC GPIO driver"
depends on HAS_MCUX
help
Enable the MCUX LPC pinmux driver.
if GPIO_MCUX_LPC
config GPIO_MCUX_LPC_PORT0
bool "Port 0"
depends on $(dt_nodelabel_enabled,pio0)
help
Enable Port 0.
config GPIO_MCUX_LPC_PORT1
bool "Port 1"
depends on $(dt_nodelabel_enabled,pio1)
help
Enable Port 1.
endif # GPIO_MCUX_LPC

View file

@ -25,9 +25,6 @@
#include <fsl_inputmux.h>
#include <fsl_device_registers.h>
#define PORT0_IDX 0u
#define PORT1_IDX 1u
#define PIN_TO_INPUT_MUX_CONNECTION(port, pin) \
((PINTSEL_PMUX_ID << PMUX_SHIFT) + (32 * port) + (pin))
@ -359,7 +356,7 @@ static const struct gpio_driver_api gpio_mcux_lpc_driver_api = {
static const clock_ip_name_t gpio_clock_names[] = GPIO_CLOCKS;
#ifdef CONFIG_GPIO_MCUX_LPC_PORT0
#if DT_NODE_HAS_STATUS(DT_DRV_INST(0), okay)
static int lpc_gpio_0_init(const struct device *dev);
static const struct gpio_mcux_lpc_config gpio_mcux_lpc_port0_config = {
@ -373,8 +370,8 @@ static const struct gpio_mcux_lpc_config gpio_mcux_lpc_port0_config = {
#else
.pinmux_base = IOCON,
#endif
.port_no = PORT0_IDX,
.clock_ip_name = gpio_clock_names[0],
.port_no = DT_INST_PROP(0, port),
.clock_ip_name = gpio_clock_names[DT_INST_PROP(0, port)],
};
static struct gpio_mcux_lpc_data gpio_mcux_lpc_port0_data;
@ -431,9 +428,9 @@ static int lpc_gpio_0_init(const struct device *dev)
return 0;
}
#endif /* CONFIG_GPIO_MCUX_LPC_PORT0 */
#endif
#ifdef CONFIG_GPIO_MCUX_LPC_PORT1
#if DT_NODE_HAS_STATUS(DT_DRV_INST(1), okay)
static int lpc_gpio_1_init(const struct device *dev);
static const struct gpio_mcux_lpc_config gpio_mcux_lpc_port1_config = {
@ -447,8 +444,8 @@ static const struct gpio_mcux_lpc_config gpio_mcux_lpc_port1_config = {
#else
.pinmux_base = IOCON,
#endif
.port_no = PORT1_IDX,
.clock_ip_name = gpio_clock_names[1],
.port_no = DT_INST_PROP(1, port),
.clock_ip_name = gpio_clock_names[DT_INST_PROP(1, port)],
};
static struct gpio_mcux_lpc_data gpio_mcux_lpc_port1_data;
@ -505,4 +502,4 @@ static int lpc_gpio_1_init(const struct device *dev)
return 0;
}
#endif /* CONFIG_GPIO_MCUX_LPC_PORT1 */
#endif