zephyr/boards/arm/mec2016evb_assy6797/pinmux.c
Francisco Munoz 11e5f7db6c boards : Add supoport for Microchip MEC2016 EVB ASSY 6797
This was tested with a the hello world application. UART 0 was used
as console for displaying "Hello World! mec2016evb_assy6797" to the
a serial terminal.

Signed-off-by: Francisco Munoz <francisco.munoz.ruiz@intel.com>
2019-02-08 21:38:54 -05:00

40 lines
1.0 KiB
C

/*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <device.h>
#include <init.h>
#include <kernel.h>
#include "soc.h"
static int board_pinmux_init(struct device *dev)
{
ARG_UNUSED(dev);
/* See table 2-4 from the Data sheet*/
#ifdef CONFIG_UART_NS16550_PORT_0
/* Set muxing, for UART 0 and power up */
PCR_INST->CLK_REQ_2_b.UART_0_CLK_REQ = 1;
UART0_INST->CONFIG = 0;
UART0_INST->ACTIVATE = 1;
GPIO_100_137_INST->GPIO_104_PIN_CONTROL_b.MUX_CONTROL = 1;
GPIO_100_137_INST->GPIO_105_PIN_CONTROL_b.MUX_CONTROL = 1;
#endif
#ifdef CONFIG_UART_NS16550_PORT_1
/* Set muxing, for UART 1 and power up */
PCR_INST->CLK_REQ_2_b.UART_1_CLK_REQ = 1;
UART1_INST->CONFIG = 0;
UART1_INST->ACTIVATE = 1;
GPIO_140_176_INST->GPIO_170_PIN_CONTROL_b.MUX_CONTROL = 2;
GPIO_140_176_INST->GPIO_171_PIN_CONTROL_b.MUX_CONTROL = 2;
GPIO_100_137_INST->GPIO_113_PIN_CONTROL_b.GPIO_DIRECTION = 1;
#endif
return 0;
}
SYS_INIT(board_pinmux_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);