udbg_16550.c (75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37) udbg_16550.c (48b545b8018db61ab4978d29c73c16b9fbfad12c)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * udbg for NS16550 compatible serial ports
4 *
5 * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp
6 */
7#include <linux/types.h>
8#include <asm/udbg.h>

--- 282 unchanged lines hidden (view full) ---

291void __init udbg_init_40x_realmode(void)
292{
293 udbg_uart_in = udbg_uart_in_40x;
294 udbg_uart_out = udbg_uart_out_40x;
295 udbg_use_uart();
296}
297
298#endif /* CONFIG_PPC_EARLY_DEBUG_40x */
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * udbg for NS16550 compatible serial ports
4 *
5 * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp
6 */
7#include <linux/types.h>
8#include <asm/udbg.h>

--- 282 unchanged lines hidden (view full) ---

291void __init udbg_init_40x_realmode(void)
292{
293 udbg_uart_in = udbg_uart_in_40x;
294 udbg_uart_out = udbg_uart_out_40x;
295 udbg_use_uart();
296}
297
298#endif /* CONFIG_PPC_EARLY_DEBUG_40x */
299
300#ifdef CONFIG_PPC_EARLY_DEBUG_MICROWATT
301
302#define UDBG_UART_MW_ADDR ((void __iomem *)0xc0002000)
303
304static u8 udbg_uart_in_isa300_rm(unsigned int reg)
305{
306 uint64_t msr = mfmsr();
307 uint8_t c;
308
309 mtmsr(msr & ~(MSR_EE|MSR_DR));
310 isync();
311 eieio();
312 c = __raw_rm_readb(UDBG_UART_MW_ADDR + (reg << 2));
313 mtmsr(msr);
314 isync();
315 return c;
316}
317
318static void udbg_uart_out_isa300_rm(unsigned int reg, u8 val)
319{
320 uint64_t msr = mfmsr();
321
322 mtmsr(msr & ~(MSR_EE|MSR_DR));
323 isync();
324 eieio();
325 __raw_rm_writeb(val, UDBG_UART_MW_ADDR + (reg << 2));
326 mtmsr(msr);
327 isync();
328}
329
330void __init udbg_init_debug_microwatt(void)
331{
332 udbg_uart_in = udbg_uart_in_isa300_rm;
333 udbg_uart_out = udbg_uart_out_isa300_rm;
334 udbg_use_uart();
335}
336
337#endif /* CONFIG_PPC_EARLY_DEBUG_MICROWATT */