1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright (C) 2018 Stefan Roese <sr@denx.de> 4 */ 5 6#include <common.h> 7#include <init.h> 8#include <asm/io.h> 9#include <linux/bitops.h> 10 11#define MT76XX_GPIO1_MODE 0x10000060 12 13void board_debug_uart_init(void) 14{ 15 void __iomem *gpio_mode; 16 17 /* Select UART2 mode instead of GPIO mode (default) */ 18 gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100); 19 clrbits_le32(gpio_mode, GENMASK(27, 26)); 20} 21 22int board_early_init_f(void) 23{ 24 /* 25 * The pin muxing of UART2 also needs to be done, if debug uart 26 * is not enabled. So we need to call this function here as well. 27 */ 28 board_debug_uart_init(); 29 30 return 0; 31} 32