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-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 * The ASB2305 has an 18.432 MHz clock the UART
26 #define BASE_BAUD (18432000 / 16)
29 * dispose of the /dev/ttyS0 serial port
31 #ifndef CONFIG_GDBSTUB_ON_TTYSx
33 #define SERIAL_PORT_DFNS \
35 .baud_base = BASE_BAUD, \
37 .flags = STD_COM_FLAGS, \
38 .iomem_base = (u8 *) SERIAL_PORT0_BASE_ADDRESS, \
39 .iomem_reg_shift = 2, \
40 .io_type = SERIAL_IO_MEM, \
45 static inline void __debug_to_serial(const char *p
, int n
)
49 #endif /* !__ASSEMBLY__ */
51 #else /* CONFIG_GDBSTUB_ON_TTYSx */
53 #define SERIAL_PORT_DFNS /* stolen by gdb-stub */
55 #if defined(CONFIG_GDBSTUB_ON_TTYS0)
56 #define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_RX * 4, u8)
57 #define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8)
58 #define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLL * 4, u8)
59 #define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLM * 4, u8)
60 #define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 4, u8)
61 #define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IIR * 4, u8)
62 #define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_FCR * 4, u8)
63 #define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LCR * 4, u8)
64 #define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8)
65 #define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8)
66 #define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8)
67 #define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_SCR * 4, u8)
68 #define GDBPORT_SERIAL_IRQ SERIAL_IRQ
70 #elif defined(CONFIG_GDBSTUB_ON_TTYS1)
71 #error The ASB2305 doesnt have a /dev/ttyS1
76 #define TTYS0_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8)
77 #define TTYS0_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8)
78 #define TTYS0_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8)
79 #define TTYS0_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8)
81 #define LSR_WAIT_FOR(STATE) \
83 while (!(TTYS0_LSR & UART_LSR_##STATE)) {} \
85 #define FLOWCTL_WAIT_FOR(LINE) \
87 while (!(TTYS0_MSR & UART_MSR_##LINE)) {} \
89 #define FLOWCTL_CLEAR(LINE) \
91 TTYS0_MCR &= ~UART_MCR_##LINE; \
93 #define FLOWCTL_SET(LINE) \
95 TTYS0_MCR |= UART_MCR_##LINE; \
97 #define FLOWCTL_QUERY(LINE) ({ TTYS0_MSR & UART_MSR_##LINE; })
99 static inline void __debug_to_serial(const char *p
, int n
)
107 FLOWCTL_WAIT_FOR(CTS
);
113 FLOWCTL_WAIT_FOR(CTS
);
121 #endif /* !__ASSEMBLY__ */
123 #endif /* CONFIG_GDBSTUB_ON_TTYSx */
125 #endif /* _ASM_UNIT_SERIAL_H */