blob: 91fa08fd9ec2d75247eb22ed9db85511b8a432b5 [file] [log] [blame]
Stefan Roese2052a932018-08-16 15:27:30 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2018 Stefan Roese <sr@denx.de>
4 */
5
Simon Glass97589732020-05-10 11:40:02 -06006#include <init.h>
Stefan Roese2052a932018-08-16 15:27:30 +02007#include <asm/io.h>
Simon Glass4dcacfc2020-05-10 11:40:13 -06008#include <linux/bitops.h>
Stefan Roese2052a932018-08-16 15:27:30 +02009
Stefan Roesebfb27b12018-10-09 08:59:15 +020010#define MT76XX_GPIO1_MODE 0x10000060
Stefan Roese2052a932018-08-16 15:27:30 +020011
12void board_debug_uart_init(void)
13{
Stefan Roesebfb27b12018-10-09 08:59:15 +020014 void __iomem *gpio_mode;
15
Stefan Roese2052a932018-08-16 15:27:30 +020016 /* Select UART2 mode instead of GPIO mode (default) */
Stefan Roesebfb27b12018-10-09 08:59:15 +020017 gpio_mode = ioremap_nocache(MT76XX_GPIO1_MODE, 0x100);
18 clrbits_le32(gpio_mode, GENMASK(27, 26));
Stefan Roese2052a932018-08-16 15:27:30 +020019}
20
21int board_early_init_f(void)
22{
23 /*
24 * The pin muxing of UART2 also needs to be done, if debug uart
25 * is not enabled. So we need to call this function here as well.
26 */
27 board_debug_uart_init();
28
29 return 0;
30}