2017-04-06 12:39:17 -05:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017, NXP
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <init.h>
|
2019-06-25 15:53:57 -04:00
|
|
|
#include <drivers/pinmux.h>
|
2017-04-06 12:39:17 -05:00
|
|
|
#include <fsl_port.h>
|
|
|
|
|
2020-04-30 20:33:38 +02:00
|
|
|
static int hexiwear_kw40z_pinmux_init(const struct device *dev)
|
2017-04-06 12:39:17 -05:00
|
|
|
{
|
|
|
|
ARG_UNUSED(dev);
|
|
|
|
|
2017-06-07 07:33:08 -05:00
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTB
|
2020-04-30 20:33:38 +02:00
|
|
|
const struct device *portb =
|
2017-06-07 07:33:08 -05:00
|
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTB_NAME);
|
|
|
|
#endif
|
|
|
|
|
2017-04-06 12:39:17 -05:00
|
|
|
#ifdef CONFIG_PINMUX_MCUX_PORTC
|
2020-04-30 20:33:38 +02:00
|
|
|
const struct device *portc =
|
2017-04-06 12:39:17 -05:00
|
|
|
device_get_binding(CONFIG_PINMUX_MCUX_PORTC_NAME);
|
|
|
|
#endif
|
|
|
|
|
2020-05-21 08:32:04 -05:00
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(lpuart0), okay) && CONFIG_SERIAL
|
2017-04-06 12:39:17 -05:00
|
|
|
/* UART0 RX, TX */
|
|
|
|
pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAlt4));
|
|
|
|
pinmux_pin_set(portc, 7, PORT_PCR_MUX(kPORT_MuxAlt4));
|
|
|
|
#endif
|
|
|
|
|
2020-05-21 08:52:08 -05:00
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) && CONFIG_I2C
|
2017-04-06 12:39:17 -05:00
|
|
|
/* I2C1 SCL, SDA */
|
|
|
|
pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAlt3)
|
|
|
|
| PORT_PCR_PS_MASK);
|
|
|
|
pinmux_pin_set(portc, 6, PORT_PCR_MUX(kPORT_MuxAlt3)
|
|
|
|
| PORT_PCR_PS_MASK);
|
|
|
|
#endif
|
|
|
|
|
2020-05-21 09:02:02 -05:00
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc0), okay) && CONFIG_ADC
|
2017-06-07 07:33:08 -05:00
|
|
|
/* ADC0_SE1 */
|
|
|
|
pinmux_pin_set(portb, 1, PORT_PCR_MUX(kPORT_PinDisabledOrAnalog));
|
|
|
|
#endif
|
|
|
|
|
2017-04-06 12:39:17 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
SYS_INIT(hexiwear_kw40z_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);
|