3 uart declarations, Ktt20/pitx software guide – Kontron KTT20-pITX User Manual
Page 34
KTD-S0045-D
Page 30
U-Boot Compilation
KTT20/pITX Software Guide
// gpio_request is a function from older U-Boot versions - possibly not necessary
ret = gpio_request (GPIO_PD6, NULL);
// define GPIO30 as GPIO, also labeled D.06
if (ret) {
do something;
// Error
}
gpio_direction_output (GPIO_PD6, 0);
// Set GPIO as output with low level
udelay (1000);
// Wait 1 ms
gpio_set_value (GPIO_PD6, 1);
// Set high level
8.3
UART Declarations
For an extensive usage of UARTs the module 'board.c' in the directory 'board/nvidia/common' must be
changed. For example:
enum {
// UARTs which we can enable
UARTA = 1 << 0,
UARTB = 1 << 1,
UARTC = 1 << 2,
UARTD = 1 << 3,
};
static void clock_init_uart (int uart_ids)
{
if (uart_ids & UARTA)
enable_uart
(PERIPH_ID_UART1);
if (uart_ids & UARTB)
enable_uart
(PERIPH_ID_UART2);
if (uart_ids & UARTC)
enable_uart
(PERIPH_ID_UART3);
}
static void pin_mux_uart (int uart_ids)
{
if (uart_ids & UARTA) {
pinmux_set_func (PINGRP_UAA, PMUX_FUNC_UARTA);
pinmux_tristate_disable
(PINGRP_UAA);
}
if (uart_ids & UARTB) {
pinmux_set_func (PINGRP_UAD, PMUX_FUNC_IRDA);
pinmux_set_func (PINGRP_IRRX, PMUX_FUNC_UARTB);
pinmux_set_func (PINGRP_IRTX, PMUX_FUNC_UARTB);
pinmux_tristate_disable
(PINGRP_UAD);
pinmux_tristate_disable
(PINGRP_IRRX);
pinmux_tristate_disable
(PINGRP_IRTX);
}
if (uart_ids & UARTC) {
pinmux_set_func (PINGRP_UCA, PMUX_FUNC_UARTC);
pinmux_tristate_disable
(PINGRP_UCA);
pinmux_set_func (PINGRP_UCB, PMUX_FUNC_UARTC);
pinmux_tristate_disable
(PINGRP_UCB);
}