Skip to content

Commit 263ac3e

Browse files
committed
drivers: pinmux: mcux_lpc: Convert to using devicetree
Convert driver and users of pinmux on mcux lpc platforms to getting basic port info from devicetree (register address, label) Signed-off-by: Kumar Gala <[email protected]>
1 parent 686968b commit 263ac3e

File tree

15 files changed

+63
-159
lines changed

15 files changed

+63
-159
lines changed

boards/arm/lpcxpresso54114/Kconfig.defconfig

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ config BOARD
99
default "lpcxpresso54114_m4" if BOARD_LPCXPRESSO54114_M4
1010
default "lpcxpresso54114_m0" if BOARD_LPCXPRESSO54114_M0
1111

12-
if PINMUX_MCUX_LPC
13-
14-
config PINMUX_MCUX_LPC_PORT0
15-
default y
16-
17-
config PINMUX_MCUX_LPC_PORT1
18-
default y
19-
20-
endif # PINMUX_MCUX_LPC
21-
2212
if GPIO_MCUX_LPC
2313

2414
config GPIO_MCUX_LPC_PORT0

boards/arm/lpcxpresso54114/pinmux.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ static int lpcxpresso_54114_pinmux_init(const struct device *dev)
1313
{
1414
ARG_UNUSED(dev);
1515

16-
#ifdef CONFIG_PINMUX_MCUX_LPC_PORT0
17-
const struct device *port0 =
18-
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT0_NAME);
16+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pio0), okay)
17+
const struct device *port0 = DEVICE_DT_GET(DT_NODELABEL(pio0));
18+
19+
__ASSERT_NO_MSG(device_is_ready(port0));
1920
#endif
2021

21-
#ifdef CONFIG_PINMUX_MCUX_LPC_PORT1
22-
const struct device *port1 =
23-
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
22+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pio1), okay)
23+
const struct device *port1 = DEVICE_DT_GET(DT_NODELABEL(pio1));
24+
25+
__ASSERT_NO_MSG(device_is_ready(port1));
2426
#endif
2527

2628
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm0), nxp_lpc_usart, okay) && CONFIG_SERIAL

boards/arm/lpcxpresso55s16/Kconfig.defconfig

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ if BOARD_LPCXPRESSO55S16
88
config BOARD
99
default "lpcxpresso55S16"
1010

11-
if PINMUX_MCUX_LPC
12-
13-
config PINMUX_MCUX_LPC_PORT0
14-
default y
15-
16-
config PINMUX_MCUX_LPC_PORT1
17-
default y
18-
19-
endif # PINMUX_MCUX_LPC
20-
2111
if GPIO_MCUX_LPC
2212

2313
config GPIO_MCUX_LPC_PORT0

boards/arm/lpcxpresso55s16/pinmux.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ static int lpcxpresso_55s16_pinmux_init(const struct device *dev)
1313
{
1414
ARG_UNUSED(dev);
1515

16-
#ifdef CONFIG_PINMUX_MCUX_LPC_PORT0
17-
__unused const struct device *port0 =
18-
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT0_NAME);
16+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pio0), okay)
17+
const struct device *port0 = DEVICE_DT_GET(DT_NODELABEL(pio0));
18+
19+
__ASSERT_NO_MSG(device_is_ready(port0));
1920
#endif
2021

21-
#ifdef CONFIG_PINMUX_MCUX_LPC_PORT1
22-
__unused const struct device *port1 =
23-
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
22+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pio1), okay)
23+
const struct device *port1 = DEVICE_DT_GET(DT_NODELABEL(pio1));
24+
25+
__ASSERT_NO_MSG(device_is_ready(port1));
2426
#endif
2527

2628
#if DT_PHA_HAS_CELL(DT_ALIAS(sw0), gpios, pin)

boards/arm/lpcxpresso55s28/Kconfig.defconfig

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ if BOARD_LPCXPRESSO55S28
88
config BOARD
99
default "lpcxpresso55S28"
1010

11-
if PINMUX_MCUX_LPC
12-
13-
config PINMUX_MCUX_LPC_PORT0
14-
default y
15-
16-
config PINMUX_MCUX_LPC_PORT1
17-
default y
18-
19-
endif # PINMUX_MCUX_LPC
20-
2111
if GPIO_MCUX_LPC
2212

2313
config GPIO_MCUX_LPC_PORT0

boards/arm/lpcxpresso55s28/pinmux.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ static int lpcxpresso_55s28_pinmux_init(const struct device *dev)
1313
{
1414
ARG_UNUSED(dev);
1515

16-
#ifdef CONFIG_PINMUX_MCUX_LPC_PORT0
17-
__unused const struct device *port0 =
18-
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT0_NAME);
16+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pio0), okay)
17+
const struct device *port0 = DEVICE_DT_GET(DT_NODELABEL(pio0));
18+
19+
__ASSERT_NO_MSG(device_is_ready(port0));
1920
#endif
2021

21-
#ifdef CONFIG_PINMUX_MCUX_LPC_PORT1
22-
__unused const struct device *port1 =
23-
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
22+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pio1), okay)
23+
const struct device *port1 = DEVICE_DT_GET(DT_NODELABEL(pio1));
24+
25+
__ASSERT_NO_MSG(device_is_ready(port1));
2426
#endif
2527

2628
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(flexcomm0), nxp_lpc_usart, okay) && CONFIG_SERIAL

boards/arm/lpcxpresso55s69/Kconfig.defconfig

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,6 @@ config BOARD
99
default "lpcxpresso55S69_cpu0" if BOARD_LPCXPRESSO55S69_CPU0
1010
default "lpcxpresso55S69_cpu1" if BOARD_LPCXPRESSO55S69_CPU1
1111

12-
if PINMUX_MCUX_LPC
13-
14-
config PINMUX_MCUX_LPC_PORT0
15-
default y
16-
17-
config PINMUX_MCUX_LPC_PORT1
18-
default y
19-
20-
endif # PINMUX_MCUX_LPC
21-
2212
if GPIO_MCUX_LPC
2313

2414
config GPIO_MCUX_LPC_PORT0

boards/arm/lpcxpresso55s69/pinmux.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ static int lpcxpresso_55s69_pinmux_init(const struct device *dev)
1515

1616
#ifdef CONFIG_BOARD_LPCXPRESSO55S69_CPU0
1717
/* Only CPU0 configures GPIO port inputs. */
18-
#ifdef CONFIG_PINMUX_MCUX_LPC_PORT0
19-
const struct device *port0 =
20-
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT0_NAME);
18+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pio0), okay)
19+
const struct device *port0 = DEVICE_DT_GET(DT_NODELABEL(pio0));
20+
21+
__ASSERT_NO_MSG(device_is_ready(port0));
2122
#endif
2223

23-
#ifdef CONFIG_PINMUX_MCUX_LPC_PORT1
24-
const struct device *port1 =
25-
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
24+
#if DT_NODE_HAS_STATUS(DT_NODELABEL(pio1), okay)
25+
const struct device *port1 = DEVICE_DT_GET(DT_NODELABEL(pio1));
26+
27+
__ASSERT_NO_MSG(device_is_ready(port1));
2628
#endif
2729
#endif
2830

boards/arm/mimxrt685_evk/Kconfig.defconfig

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,6 @@ config XTAL_SYS_CLK_HZ
1414
config SYSOSC_SETTLING_US
1515
default 260
1616

17-
if PINMUX_MCUX_LPC
18-
19-
config PINMUX_MCUX_LPC_PORT0
20-
default y
21-
22-
config PINMUX_MCUX_LPC_PORT1
23-
default y
24-
25-
endif # PINMUX_MCUX_LPC
26-
2717
if GPIO_MCUX_LPC
2818

2919
config GPIO_MCUX_LPC_PORT0

boards/arm/mimxrt685_evk/mimxrt685_evk_cm33_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ CONFIG_SERIAL=y
1313
CONFIG_UART_INTERRUPT_DRIVEN=y
1414
CONFIG_CORTEX_M_SYSTICK=y
1515
CONFIG_GPIO=y
16-
CONFIG_PINMUX=y
1716
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=250105263
1817
# Enable TrustZone-M
1918
CONFIG_TRUSTED_EXECUTION_SECURE=y

0 commit comments

Comments
 (0)