blob: d3d3d50c2c6f7a8e207182e155c9879da989f1b7 [file] [log] [blame]
Stefan Roeseb02f76a2018-08-16 15:27:30 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2018 Stefan Roese <sr@denx.de>
4 */
5
6#include <common.h>
7#include <asm/io.h>
8
Stefan Roese8bd19772018-10-09 08:59:15 +02009#define MT76XX_GPIO1_MODE 0x10000060
Stefan Roeseb02f76a2018-08-16 15:27:30 +020010
11void board_debug_uart_init(void)
12{
Stefan Roese8bd19772018-10-09 08:59:15 +020013 void __iomem *gpio_mode;
14
Stefan Roeseb02f76a2018-08-16 15:27:30 +020015 /* Select UART2 mode instead of GPIO mode (default) */
Stefan Roese8bd19772018-10-09 08:59:15 +020016 gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100);
17 clrbits_le32(gpio_mode, GENMASK(27, 26));
Stefan Roeseb02f76a2018-08-16 15:27:30 +020018}
19
20int board_early_init_f(void)
21{
22 /*
23 * The pin muxing of UART2 also needs to be done, if debug uart
24 * is not enabled. So we need to call this function here as well.
25 */
26 board_debug_uart_init();
27
28 return 0;
29}