Skip to content

Commit

Permalink
boards: arm: nxp: lpc: Convert from Kconfig to DT_NODELABEL
Browse files Browse the repository at this point in the history
As prep for drivers being converted to utilize DT_INST and removal of
per instance Kconfig symbols, move board pinmux.c code to utilize
DT_NODELABEL instead.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
  • Loading branch information
galak authored and MaureenHelm committed Apr 17, 2020
1 parent 0b58ae6 commit 5e73787
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
17 changes: 10 additions & 7 deletions boards/arm/lpcxpresso54114/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
#endif

#ifdef CONFIG_UART_MCUX_FLEXCOMM_0
#if DT_HAS_NODE(DT_NODELABEL(flexcomm0)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
/* USART0 RX, TX */
const u32_t port0_pin0_config = (
IOCON_PIO_FUNC1 |
Expand All @@ -50,7 +51,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)

#endif

#ifdef CONFIG_GPIO_MCUX_LPC_PORT0
#if DT_HAS_NODE(DT_NODELABEL(gpio0))
const u32_t port0_pin29_config = (
IOCON_PIO_FUNC0 |
IOCON_PIO_MODE_PULLUP |
Expand Down Expand Up @@ -93,7 +94,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)

#endif

#ifdef CONFIG_GPIO_MCUX_LPC_PORT1
#if DT_HAS_NODE(DT_NODELABEL(gpio1))
const u32_t port1_pin10_config = (
IOCON_PIO_FUNC0 |
IOCON_PIO_MODE_PULLUP |
Expand All @@ -107,7 +108,8 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
pinmux_pin_set(port1, 10, port1_pin10_config);
#endif

#ifdef CONFIG_I2C_4
#if DT_HAS_NODE(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
/* PORT0 PIN25 is configured as FC4_RTS_SCL_SSEL1 */
pinmux_pin_set(port0, 25, IOCON_PIO_FUNC1 |
IOCON_PIO_I2CSLEW_I2C |
Expand All @@ -125,9 +127,10 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
IOCON_PIO_INPFILT_OFF |
IOCON_PIO_I2CDRIVE_LOW |
IOCON_PIO_I2CFILTER_EN);
#endif /* CONFIG_I2C_4 */
#endif

#ifdef CONFIG_SPI_5
#if DT_HAS_NODE(DT_NODELABEL(flexcomm5)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm5), nxp_lpc_spi)
/* PORT0 PIN18 is configured as FC5_TXD_SCL_MISO */
pinmux_pin_set(port0, 18, IOCON_PIO_FUNC1 |
IOCON_PIO_MODE_PULLUP |
Expand Down Expand Up @@ -159,7 +162,7 @@ static int lpcxpresso_54114_pinmux_init(struct device *dev)
IOCON_PIO_DIGITAL_EN |
IOCON_PIO_SLEW_STANDARD |
IOCON_PIO_OPENDRAIN_DI);
#endif /* CONFIG_SPI_5 */
#endif

return 0;
}
Expand Down
12 changes: 7 additions & 5 deletions boards/arm/lpcxpresso55s69/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
device_get_binding(CONFIG_PINMUX_MCUX_LPC_PORT1_NAME);
#endif

#ifdef CONFIG_UART_MCUX_FLEXCOMM_0
#if DT_HAS_NODE(DT_NODELABEL(flexcomm0)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm0), nxp_lpc_usart)
/* USART0 RX, TX */
const u32_t port0_pin29_config = (
IOCON_PIO_FUNC1 |
Expand Down Expand Up @@ -87,7 +88,8 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
pinmux_pin_set(port1, DT_ALIAS_SW2_GPIOS_PIN, sw2_config);
#endif

#ifdef CONFIG_I2C_4
#if DT_HAS_NODE(DT_NODELABEL(flexcomm4)) && \
DT_NODE_HAS_COMPAT(DT_NODELABEL(flexcomm4), nxp_lpc_i2c)
/* PORT1 PIN20 is configured as FC4_TXD_SCL_MISO_WS */
pinmux_pin_set(port1, 20, IOCON_PIO_FUNC5 |
IOCON_PIO_MODE_INACT |
Expand All @@ -103,7 +105,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
IOCON_PIO_INV_DI |
IOCON_PIO_DIGITAL_EN |
IOCON_PIO_OPENDRAIN_DI);
#endif /* CONFIG_I2C_4 */
#endif

#ifdef CONFIG_FXOS8700_TRIGGER
pinmux_pin_set(port1, 19, IOCON_PIO_FUNC0 |
Expand All @@ -115,7 +117,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
IOCON_PIO_OPENDRAIN_DI);
#endif

#ifdef CONFIG_SPI_8
#if DT_HAS_NODE(DT_NODELABEL(hs_lspi))
/* PORT0 PIN26 is configured as HS_SPI_MOSI */
pinmux_pin_set(port0, 26, IOCON_PIO_FUNC9 |
IOCON_PIO_MODE_PULLUP |
Expand Down Expand Up @@ -147,7 +149,7 @@ static int lpcxpresso_55s69_pinmux_init(struct device *dev)
IOCON_PIO_DIGITAL_EN |
IOCON_PIO_SLEW_STANDARD |
IOCON_PIO_OPENDRAIN_DI);
#endif /* CONFIG_SPI_8 */
#endif

return 0;
}
Expand Down

0 comments on commit 5e73787

Please sign in to comment.