1 /* ASB2305-specific 8250 serial ports
3 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public Licence
8 * as published by the Free Software Foundation; either version
9 * 2 of the Licence, or (at your option) any later version.
11 #ifndef _ASM_UNIT_SERIAL_H
12 #define _ASM_UNIT_SERIAL_H
14 #include <asm/cpu/cpu-regs.h>
16 #include <linux/serial_reg.h>
18 #define SERIAL_PORT0_BASE_ADDRESS 0xA6FB0000
19 #define ASB2305_DEBUG_MCR __SYSREG(0xA6FB0000 + UART_MCR * 2, u8)
21 #define SERIAL_IRQ XIRQ0 /* Dual serial (PC16552) (Hi) */
24 * dispose of the /dev/ttyS0 serial port
26 #ifndef CONFIG_GDBSTUB_ON_TTYSx
28 #define SERIAL_PORT_DFNS \
30 .baud_base = BASE_BAUD, \
32 .flags = STD_COM_FLAGS, \
33 .iomem_base = (u8 *) SERIAL_PORT0_BASE_ADDRESS, \
34 .iomem_reg_shift = 2, \
35 .io_type = SERIAL_IO_MEM, \
40 static inline void __debug_to_serial(const char *p, int n)
44 #endif /* !__ASSEMBLY__ */
46 #else /* CONFIG_GDBSTUB_ON_TTYSx */
48 #define SERIAL_PORT_DFNS /* stolen by gdb-stub */
50 #if defined(CONFIG_GDBSTUB_ON_TTYS0)
51 #define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_RX * 4, u8)
52 #define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8)
53 #define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLL * 4, u8)
54 #define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLM * 4, u8)
55 #define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 4, u8)
56 #define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IIR * 4, u8)
57 #define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_FCR * 4, u8)
58 #define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LCR * 4, u8)
59 #define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8)
60 #define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8)
61 #define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8)
62 #define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_SCR * 4, u8)
63 #define GDBPORT_SERIAL_IRQ SERIAL_IRQ
65 #elif defined(CONFIG_GDBSTUB_ON_TTYS1)
66 #error The ASB2305 doesnt have a /dev/ttyS1
71 #define TTYS0_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8)
72 #define TTYS0_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8)
73 #define TTYS0_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8)
74 #define TTYS0_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8)
76 #define LSR_WAIT_FOR(STATE) \
78 while (!(TTYS0_LSR & UART_LSR_##STATE)) {} \
80 #define FLOWCTL_WAIT_FOR(LINE) \
82 while (!(TTYS0_MSR & UART_MSR_##LINE)) {} \
84 #define FLOWCTL_CLEAR(LINE) \
86 TTYS0_MCR &= ~UART_MCR_##LINE; \
88 #define FLOWCTL_SET(LINE) \
90 TTYS0_MCR |= UART_MCR_##LINE; \
92 #define FLOWCTL_QUERY(LINE) ({ TTYS0_MSR & UART_MSR_##LINE; })
94 static inline void __debug_to_serial(const char *p, int n)
102 FLOWCTL_WAIT_FOR(CTS);
108 FLOWCTL_WAIT_FOR(CTS);
116 #endif /* !__ASSEMBLY__ */
118 #endif /* CONFIG_GDBSTUB_ON_TTYSx */
120 #endif /* _ASM_UNIT_SERIAL_H */