188 lines
6.1 KiB
C
188 lines
6.1 KiB
C
/*
|
|
* Copyright (c) 2019, Joris Offouga
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
|
|
#include <init.h>
|
|
#include "device_imx.h"
|
|
|
|
static int pico_pi_m4_pinmux_init(const struct device *dev)
|
|
{
|
|
ARG_UNUSED(dev);
|
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart2), okay) && CONFIG_SERIAL
|
|
IOMUXC_SW_MUX_CTL_PAD_UART2_RX_DATA =
|
|
IOMUXC_SW_MUX_CTL_PAD_UART2_RX_DATA_MUX_MODE(0);
|
|
IOMUXC_SW_MUX_CTL_PAD_UART2_TX_DATA =
|
|
IOMUXC_SW_MUX_CTL_PAD_UART2_TX_DATA_MUX_MODE(0);
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_RX_DATA =
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_RX_DATA_PE_MASK |
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_RX_DATA_PS(3) |
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_RX_DATA_HYS_MASK |
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_RX_DATA_DSE(0);
|
|
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_TX_DATA =
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_TX_DATA_PE_MASK |
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_TX_DATA_PS(3) |
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_TX_DATA_HYS_MASK |
|
|
IOMUXC_SW_PAD_CTL_PAD_UART2_TX_DATA_DSE(0);
|
|
|
|
IOMUXC_UART2_RX_DATA_SELECT_INPUT =
|
|
IOMUXC_UART2_RX_DATA_SELECT_INPUT_DAISY(2);
|
|
#endif
|
|
|
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(uart5), okay) && CONFIG_SERIAL
|
|
IOMUXC_SW_MUX_CTL_PA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PAD_CTL_PAD_EPDC_DATA08_HYS_MASK |
|
|
IOMUXC_SW_PAD_CTL_PAD_EPDC_DATA08_DSE(1);
|
|
|
|
IOMUXC_SW_PAD_CTL_PAD_EPDC_DATA09 =
|
|
IOMUXC_SW_PAD_CTL_PAD_EPDC_DATA09_PE_MASK |
|
|
IOMUXC_SW_PAD_CTL_PAD_EPDC_DATA09_PS(3) |
|
|
IOMUXC_SW_PAD_CTL_PAD_EPDC_DATA09_HYS_MASK |
|
|
IOMUXC_SW_PAD_CTL_PAD_EPDC_DATA09_DSE(1);
|
|
|
|
IOMUXC_UART6_RX_DATA_SELECT_INPUT =
|
|
IOMUXC_UART6_RX_DATA_SELECT_INPUT_DAISY(0);
|
|
#endif
|
|
|
|
|
|
#if DT_NODE_HAS_STATUS(DT_NODELABEL(i2c1), okay) && CONFIG_I2C
|
|
IOMUXC_SW_MUX_CTL_PAD_UART1_RX_DATA =
|
|
IOMUXC_SW_MUX_CTL_PAD_UART1_RX_DATA_MUX_MODE(1) |
|
|
IOMUXC_SW_MUX_CTL_PAD_UART1_RX_DATA_SION_MASK;
|
|
IOMUXC_SW_MUX_CTL_PAD_UART1_TX_DATA =
|
|
IOMUXC_SW_MUX_CTL_PAD_UART1_TX_DATA_MUX_MODE(1) |
|
|
IOMUXC_SW_MUX_CTL_PAD_UART1_TX_DATA_SION_MASK;
|
|
|
|
IOMUXC_I2C1_SCL_SELECT_INPUT = IOMUXC_I2C1_SCL_SELECT_INPUT_DAISY(0);
|
|
IOMUXC_I2C1_SDA_SELECT_INPUT = IOMUXC_I2C1_SDA_SELECT_INPUT_DAISY(0);
|
|
|
|
IOMUXC_SW_PAD_CTL_PAD_UART1_RX_DATA =
|
|
IOMUXC_SW_PAD_CTL_PAD_UART1_RX_DATA_PE_MASK |
|
|
IOMUXC_SW_PAD_CTL_PAD_UART1_RX_DATA_PS(3) |
|
|
IOMUXC_SW_PAD_CTL_PAD_UART1_RX_DATA_DSE(0) |
|
|
IOMUXC_SW_PAD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