mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 05:56:56 +07:00
ba9e72c229
Ingenic SoC declares ZBOOT support, but debug definitions are missing for MACH_JZ4780 resulting in a build failure when DEBUG_ZBOOT is set. The UART addresses are same as with JZ4740, so fix by covering JZ4780 with those as well. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/12830/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
64 lines
1.4 KiB
C
64 lines
1.4 KiB
C
/*
|
|
* 16550 compatible uart based serial debug support for zboot
|
|
*/
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/serial_reg.h>
|
|
|
|
#include <asm/addrspace.h>
|
|
|
|
#if defined(CONFIG_MACH_LOONGSON64) || defined(CONFIG_MIPS_MALTA)
|
|
#define UART_BASE 0x1fd003f8
|
|
#define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset))
|
|
#endif
|
|
|
|
#ifdef CONFIG_AR7
|
|
#include <ar7.h>
|
|
#define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset))
|
|
#endif
|
|
|
|
#if defined(CONFIG_MACH_JZ4740) || defined(CONFIG_MACH_JZ4780)
|
|
#include <asm/mach-jz4740/base.h>
|
|
#define PORT(offset) (CKSEG1ADDR(JZ4740_UART0_BASE_ADDR) + (4 * offset))
|
|
#endif
|
|
|
|
#ifdef CONFIG_CPU_XLR
|
|
#define UART0_BASE 0x1EF14000
|
|
#define PORT(offset) (CKSEG1ADDR(UART0_BASE) + (4 * offset))
|
|
#define IOTYPE unsigned int
|
|
#endif
|
|
|
|
#ifdef CONFIG_CPU_XLP
|
|
#define UART0_BASE 0x18030100
|
|
#define PORT(offset) (CKSEG1ADDR(UART0_BASE) + (4 * offset))
|
|
#define IOTYPE unsigned int
|
|
#endif
|
|
|
|
#ifndef IOTYPE
|
|
#define IOTYPE char
|
|
#endif
|
|
|
|
#ifndef PORT
|
|
#error please define the serial port address for your own machine
|
|
#endif
|
|
|
|
static inline unsigned int serial_in(int offset)
|
|
{
|
|
return *((volatile IOTYPE *)PORT(offset)) & 0xFF;
|
|
}
|
|
|
|
static inline void serial_out(int offset, int value)
|
|
{
|
|
*((volatile IOTYPE *)PORT(offset)) = value & 0xFF;
|
|
}
|
|
|
|
void putc(char c)
|
|
{
|
|
int timeout = 1000000;
|
|
|
|
while (((serial_in(UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0))
|
|
;
|
|
|
|
serial_out(UART_TX, c);
|
|
}
|