1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2022 MediaTek Inc. All rights reserved.
4 *
5 * Author: Weijie Gao <weijie.gao@mediatek.com>
6 */
7
8#include <asm/io.h>
9#include <asm/addrspace.h>
10#include "mt7621.h"
11
12void board_debug_uart_init(void)
13{
14	void __iomem *base = ioremap_nocache(SYSCTL_BASE, SYSCTL_SIZE);
15
16#if CONFIG_DEBUG_UART_BASE == 0xbe000c00 /* KSEG1ADDR(UART1_BASE) */
17	clrbits_32(base + SYSCTL_GPIOMODE_REG, UART1_MODE);
18#elif CONFIG_DEBUG_UART_BASE == 0xbe000d00 /* KSEG1ADDR(UART2_BASE) */
19	clrbits_32(base + SYSCTL_GPIOMODE_REG, UART2_MODE_M);
20#elif CONFIG_DEBUG_UART_BASE == 0xbe000e00 /* KSEG1ADDR(UART3_BASE) */
21	clrbits_32(base + SYSCTL_GPIOMODE_REG, UART3_MODE_M);
22#endif
23}
24