Hi All,
I am working on AM437x SOC and I am trying to change UART debug console from default port UART0 to UART5 in out custom board.
I would like to confirm my changes in the u-boot source for my custom board to make use of UART5 as debug console. The below are the changes I have done in my u-boot source to use UART5 as debug console.
Kindly please have a look and let me know is these changes are fine, or need to do any extra changes in the u-boot source for UART5 port.
1. Pin MUX configuration for UART5.
Added the below changes in the following file "board/ti/am43xx/mux.c" to support UART5 Pinx MUX configuration.
static struct module_pin_mux uart5_pin_mux[] = {
{OFFSET(mii1_col), (MODE(3) | PULLUP_EN | RXACTIVE | SLEWCTRL)},
{OFFSET(rmii1_refclk), (MODE(3) | PULLUDDIS | PULLUP_EN | SLEWCTRL)},
{-1},
};
Added function call to configure pin mux for UART5.
void enable_uart5_pin_mux(void)
{
configure_module_pin_mux(uart5_pin_mux);
}
2. Edited the file "board/ti/am43xx/board.c" to add required changes for UART5 pin mux.
void set_uart_mux_conf(void)
{
//enable_uart0_pin_mux();
enable_uart5_pin_mux(); /*added for UART5 */
}
3. Changes in file "board/ti/am43xx/board.h"
Added prototype declaration for function "enable_uart5_pin_mux()"
void enable_uart5_pin_mux(void);
4. Added uart clock for UART5 in the file "arch/arm/cpu/armv7/am33xx/clock_am43xx.c"
in the function: "setup_clocks_for_console(void), edited the below lines to add support for UART5.
/* Enable UART5 */
clrsetbits_le32(&cmper->uart5clkctrl,
MODULE_CLKCTRL_MODULEMODE_MASK,
MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN <<
MODULE_CLKCTRL_MODULEMODE_SHIFT);
while ((idlest == MODULE_CLKCTRL_IDLEST_DISABLED) ||
(idlest == MODULE_CLKCTRL_IDLEST_TRANSITIONING)) {
clkctrl = readl(&cmper->uart5clkctrl);
idlest = (clkctrl & MODULE_CLKCTRL_IDLEST_MASK) >>
MODULE_CLKCTRL_IDLEST_SHIFT;
}
5. Added uart clock reset support for UART5 in the file "arch/arm/cpu/armv7/am33xx/board.c"
/*Added UART base address macro in the same file*/
#define UART5_BASE_ADD 0x481AA000
static void uart_soft_reset(void)
{
struct uart_sys *uart_base = (struct uart_sys *)UART5_BASE_ADD;
u32 regval;
regval = readl(&uart_base->uartsyscfg);
regval |= UART_RESET;
writel(regval, &uart_base->uartsyscfg);
while ((readl(&uart_base->uartsyssts) &
UART_CLK_RUNNING_MASK) != UART_CLK_RUNNING_MASK)
;
/* Disable smart idle */
regval = readl(&uart_base->uartsyscfg);
regval |= UART_SMART_IDLE_EN;
writel(regval, &uart_base->uartsyscfg);
}
6. Edited make file of the following path "board/ti/am43xx/Makefile" to generate mux obj file to link.
ifeq ($(CONFIG_SKIP_LOWLEVEL_INIT),)
obj-y := mux.o
endif
obj-y := mux.o
obj-y += board.o
7. Added UART5 base address and port configuration in the "include/configs/am43xx_evm.h" file as shown below.
#define CONFIG_SYS_NS16550_COM6 0x481aa000 /* Base custom board has UART5 */
Replaced the boot-args parameter ""console=ttyO0,115200n8\0" \" to ""console=ttyO5,115200n8\0" \ " to support UART5 console.
I appreciate your support on this.
Thanks & Regards
Ch. Siva