blob: fd23091163f9a8c79664f633b24948781843cb21 [file] [log] [blame]
/*
* Copyright (c) 2017 Phytec Messtechnik GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <init.h>
#include <drivers/pinmux.h>
#include <fsl_port.h>
static int usb_kw24d512_pinmux_init(const struct device *dev)
{
ARG_UNUSED(dev);
#if DT_NODE_HAS_STATUS(DT_NODELABEL(porta), okay)
__unused const struct device *porta =
DEVICE_DT_GET(DT_NODELABEL(porta));
__ASSERT_NO_MSG(device_is_ready(porta));
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(portb), okay)
__unused const struct device *portb =
DEVICE_DT_GET(DT_NODELABEL(portb));
__ASSERT_NO_MSG(device_is_ready(portb));
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(portc), okay)
__unused const struct device *portc =
DEVICE_DT_GET(DT_NODELABEL(portc));
__ASSERT_NO_MSG(device_is_ready(portc));
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(portd), okay)
__unused const struct device *portd =
DEVICE_DT_GET(DT_NODELABEL(portd));
__ASSERT_NO_MSG(device_is_ready(portd));
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(porte), okay)
__unused const struct device *porte =
DEVICE_DT_GET(DT_NODELABEL(porte));
__ASSERT_NO_MSG(device_is_ready(porte));
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart0), okay) && CONFIG_SERIAL
/* UART0 RX, TX */
pinmux_pin_set(porta, 1, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(porta, 2, PORT_PCR_MUX(kPORT_MuxAlt2));
#endif
#if DT_NODE_HAS_STATUS(DT_NODELABEL(spi1), okay) && CONFIG_SPI
/* SPI1 CS0, SCK, SOUT, SIN */
pinmux_pin_set(portb, 10, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portb, 11, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portb, 16, PORT_PCR_MUX(kPORT_MuxAlt2));
pinmux_pin_set(portb, 17, PORT_PCR_MUX(kPORT_MuxAlt2));
#endif
return 0;
}
SYS_INIT(usb_kw24d512_pinmux_init, PRE_KERNEL_1, CONFIG_PINMUX_INIT_PRIORITY);