aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/se
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2007-03-08 03:27:37 -0500
committerPaul Mundt <lethal@hera.kernel.org>2007-05-06 22:10:51 -0400
commitfa5da2f7bdcf885efe65a37df13907c7d72296f6 (patch)
tree54104d5f660a1ec824505b28540eb2c5e4be390a /arch/sh/boards/se
parent15700770ef7c5d12e2f1659d2ddbeb3f658d9f37 (diff)
sh: Bring kgdb back from the dead.
This code has suffered quite a bit of bitrot, do some basic tidying to get it to a reasonably functional state again. This gets the basic support and the console working again. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/se')
-rw-r--r--arch/sh/boards/se/7751/setup.c148
1 files changed, 0 insertions, 148 deletions
diff --git a/arch/sh/boards/se/7751/setup.c b/arch/sh/boards/se/7751/setup.c
index e3feae6ec0bf..770defed9c4a 100644
--- a/arch/sh/boards/se/7751/setup.c
+++ b/arch/sh/boards/se/7751/setup.c
@@ -14,153 +14,6 @@
14#include <asm/se7751.h> 14#include <asm/se7751.h>
15#include <asm/io.h> 15#include <asm/io.h>
16 16
17void init_7751se_IRQ(void);
18
19#ifdef CONFIG_SH_KGDB
20#include <asm/kgdb.h>
21static int kgdb_uart_setup(void);
22static struct kgdb_sermap kgdb_uart_sermap =
23{ "ttyS", 0, kgdb_uart_setup, NULL };
24#endif
25
26/*
27 * Initialize the board
28 */
29static void __init sh7751se_setup(char **cmdline_p)
30{
31 /* Call init_smsc() replacement to set up SuperIO. */
32 /* XXX: RTC setting comes here */
33#ifdef CONFIG_SH_KGDB
34 kgdb_register_sermap(&kgdb_uart_sermap);
35#endif
36}
37
38/*********************************************************************
39 * Currently a hack (e.g. does not interact well w/serial.c, lots of *
40 * hardcoded stuff) but may be useful if SCI/F needs debugging. *
41 * Mostly copied from x86 code (see files asm-i386/kgdb_local.h and *
42 * arch/i386/lib/kgdb_serial.c). *
43 *********************************************************************/
44
45#ifdef CONFIG_SH_KGDB
46#include <linux/types.h>
47#include <linux/serial.h>
48#include <linux/serialP.h>
49#include <linux/serial_reg.h>
50
51#define COM1_PORT 0x3f8 /* Base I/O address */
52#define COM1_IRQ 4 /* IRQ not used yet */
53#define COM2_PORT 0x2f8 /* Base I/O address */
54#define COM2_IRQ 3 /* IRQ not used yet */
55
56#define SB_CLOCK 1843200 /* Serial baud clock */
57#define SB_BASE (SB_CLOCK/16)
58#define SB_MCR UART_MCR_OUT2 | UART_MCR_DTR | UART_MCR_RTS
59
60struct uart_port {
61 int base;
62};
63#define UART_NPORTS 2
64struct uart_port uart_ports[] = {
65 { COM1_PORT },
66 { COM2_PORT },
67};
68struct uart_port *kgdb_uart_port;
69
70#define UART_IN(reg) inb_p(kgdb_uart_port->base + reg)
71#define UART_OUT(reg,v) outb_p((v), kgdb_uart_port->base + reg)
72
73/* Basic read/write functions for the UART */
74#define UART_LSR_RXCERR (UART_LSR_BI | UART_LSR_FE | UART_LSR_PE)
75static int kgdb_uart_getchar(void)
76{
77 int lsr;
78 int c = -1;
79
80 while (c == -1) {
81 lsr = UART_IN(UART_LSR);
82 if (lsr & UART_LSR_DR)
83 c = UART_IN(UART_RX);
84 if ((lsr & UART_LSR_RXCERR))
85 c = -1;
86 }
87 return c;
88}
89
90static void kgdb_uart_putchar(int c)
91{
92 while ((UART_IN(UART_LSR) & UART_LSR_THRE) == 0)
93 ;
94 UART_OUT(UART_TX, c);
95}
96
97/*
98 * Initialize UART to configured/requested values.
99 * (But we don't interrupts yet, or interact w/serial.c)
100 */
101static int kgdb_uart_setup(void)
102{
103 int port;
104 int lcr = 0;
105 int bdiv = 0;
106
107 if (kgdb_portnum >= UART_NPORTS) {
108 KGDB_PRINTK("uart port %d invalid.\n", kgdb_portnum);
109 return -1;
110 }
111
112 kgdb_uart_port = &uart_ports[kgdb_portnum];
113
114 /* Init sequence from gdb_hook_interrupt */
115 UART_IN(UART_RX);
116 UART_OUT(UART_IER, 0);
117
118 UART_IN(UART_RX); /* Serial driver comments say */
119 UART_IN(UART_IIR); /* this clears interrupt regs */
120 UART_IN(UART_MSR);
121
122 /* Figure basic LCR values */
123 switch (kgdb_bits) {
124 case '7':
125 lcr |= UART_LCR_WLEN7;
126 break;
127 default: case '8':
128 lcr |= UART_LCR_WLEN8;
129 break;
130 }
131 switch (kgdb_parity) {
132 case 'O':
133 lcr |= UART_LCR_PARITY;
134 break;
135 case 'E':
136 lcr |= (UART_LCR_PARITY | UART_LCR_EPAR);
137 break;
138 default: break;
139 }
140
141 /* Figure the baud rate divisor */
142 bdiv = (SB_BASE/kgdb_baud);
143
144 /* Set the baud rate and LCR values */
145 UART_OUT(UART_LCR, (lcr | UART_LCR_DLAB));
146 UART_OUT(UART_DLL, (bdiv & 0xff));
147 UART_OUT(UART_DLM, ((bdiv >> 8) & 0xff));
148 UART_OUT(UART_LCR, lcr);
149
150 /* Set the MCR */
151 UART_OUT(UART_MCR, SB_MCR);
152
153 /* Turn off FIFOs for now */
154 UART_OUT(UART_FCR, 0);
155
156 /* Setup complete: initialize function pointers */
157 kgdb_getchar = kgdb_uart_getchar;
158 kgdb_putchar = kgdb_uart_putchar;
159
160 return 0;
161}
162#endif /* CONFIG_SH_KGDB */
163
164static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 }; 17static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
165 18
166static struct resource heartbeat_resources[] = { 19static struct resource heartbeat_resources[] = {
@@ -197,7 +50,6 @@ __initcall(se7751_devices_setup);
197 */ 50 */
198struct sh_machine_vector mv_7751se __initmv = { 51struct sh_machine_vector mv_7751se __initmv = {
199 .mv_name = "7751 SolutionEngine", 52 .mv_name = "7751 SolutionEngine",
200 .mv_setup = sh7751se_setup,
201 .mv_nr_irqs = 72, 53 .mv_nr_irqs = 72,
202 54
203 .mv_inb = sh7751se_inb, 55 .mv_inb = sh7751se_inb,