Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an undesirable API for the following reasons: - it's inconsistent with the rest of the DT_NODE_HAS_FOO names - DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand for macros which are equivalent to DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) && - DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck - DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway - it is seen as a somewhat aesthetically challenged name Replace all users with DT_NODE_HAS_STATUS(..., okay), which is semantically equivalent. This is mostly done with sed, but a few remaining cases were done by hand, along with whitespace, docs, and comment changes. These special cases include the Nordic SOC static assert files. Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
83 lines
2.5 KiB
C
83 lines
2.5 KiB
C
/*
|
|
* Copyright (c) 2019 SEAL AG
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <init.h>
|
|
#include <drivers/pinmux.h>
|
|
#include <fsl_port.h>
|
|
|
|
static int frdm_k82f_pinmux_init(struct device *dev)
|
|
{
|
|
ARG_UNUSED(dev);
|
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTA
|
|
__unused struct device *porta =
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTA_NAME);
|
|
#endif
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTB
|
|
__unused struct device *portb =
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTB_NAME);
|
|
#endif
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTC
|
|
__unused struct device *portc =
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTC_NAME);
|
|
#endif
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTD
|
|
__unused struct device *portd =
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTD_NAME);
|
|
#endif
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTE
|
|
__unused struct device *porte =
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTE_NAME);
|
|
#endif
|
|
|
|
#if DT_NODE_HAS_COMPAT_STATUS(DT_NODELABEL(ftm3), nxp_kinetis_ftm_pwm, okay)
|
|
/* Red, green, blue LEDs as PWM channels */
|
|
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAlt3));
|
|
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAlt3));
|
|
pinmux_pin_set(portc, 10, PORT_PCR_MUX(kPORT_MuxAlt4));
|
|
#else
|
|
/* Red, green, blue LEDs as GPIOs */
|
|
pinmux_pin_set(portc, 8, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
|
pinmux_pin_set(portc, 9, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
|
pinmux_pin_set(portc, 10, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
|
#endif
|
|
|
|
/* Buttons */
|
|
pinmux_pin_set(porta, 4, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
|
pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
|
|
|
/* FXOS8700 INT1 */
|
|
pinmux_pin_set(portc, 13, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c3), okay)
|
|
/* I2C3 SDA, SCL */
|
|
pinmux_pin_set(porta, 1, PORT_PCR_MUX(kPORT_MuxAlt4)
|
|
| PORT_PCR_ODE_MASK);
|
|
pinmux_pin_set(porta, 2, PORT_PCR_MUX(kPORT_MuxAlt4)
|
|
| PORT_PCR_ODE_MASK);
|
|
#endif
|
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi1), okay)
|
|
/* SPI1 SCK, SOUT, SIN, PCS0 */
|
|
pinmux_pin_set(porte, 1, PORT_PCR_MUX(kPORT_MuxAlt2));
|
|
pinmux_pin_set(porte, 2, PORT_PCR_MUX(kPORT_MuxAlt2));
|
|
pinmux_pin_set(porte, 4, PORT_PCR_MUX(kPORT_MuxAlt2));
|
|
pinmux_pin_set(porte, 5, PORT_PCR_MUX(kPORT_MuxAlt2));
|
|
/* SPI1 NOR RESET, WP */
|
|
pinmux_pin_set(porte, 0, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
|
pinmux_pin_set(porte, 3, PORT_PCR_MUX(kPORT_MuxAsGpio));
|
|
#endif
|
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart4), okay)
|
|
/* LPUART4 RX, TX */
|
|
pinmux_pin_set(portc, 14, PORT_PCR_MUX(kPORT_MuxAlt3));
|
|
pinmux_pin_set(portc, 15, PORT_PCR_MUX(kPORT_MuxAlt3));
|
|
#endif
|
|
|
|
return 0;
|
|
}
|
|
|
|
SYS_INIT(frdm_k82f_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);
|