2018-08-16 13:27:30 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Stefan Roese <sr@denx.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-10 17:40:02 +00:00
|
|
|
#include <init.h>
|
2018-08-16 13:27:30 +00:00
|
|
|
#include <asm/io.h>
|
2020-05-10 17:40:13 +00:00
|
|
|
#include <linux/bitops.h>
|
2018-08-16 13:27:30 +00:00
|
|
|
|
2018-10-09 06:59:15 +00:00
|
|
|
#define MT76XX_GPIO1_MODE 0x10000060
|
2018-08-16 13:27:30 +00:00
|
|
|
|
|
|
|
void board_debug_uart_init(void)
|
|
|
|
{
|
2018-10-09 06:59:15 +00:00
|
|
|
void __iomem *gpio_mode;
|
|
|
|
|
2018-08-16 13:27:30 +00:00
|
|
|
/* Select UART2 mode instead of GPIO mode (default) */
|
2018-10-09 06:59:15 +00:00
|
|
|
gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100);
|
|
|
|
clrbits_le32(gpio_mode, GENMASK(27, 26));
|
2018-08-16 13:27:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int board_early_init_f(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* The pin muxing of UART2 also needs to be done, if debug uart
|
|
|
|
* is not enabled. So we need to call this function here as well.
|
|
|
|
*/
|
|
|
|
board_debug_uart_init();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|