2 * linux/arch/sh/kernel/setup_7751se.c
4 * Copyright (C) 2000 Kazumoto Kojima
6 * Hitachi SolutionEngine Support.
8 * Modified for 7751 Solution Engine by
9 * Ian da Silva and Jeremy Siegel, 2001.
11 #include <linux/init.h>
12 #include <asm/machvec.h>
13 #include <asm/se7751.h>
16 void heartbeat_7751se(void);
17 void init_7751se_IRQ(void);
21 static int kgdb_uart_setup(void);
22 static struct kgdb_sermap kgdb_uart_sermap
=
23 { "ttyS", 0, kgdb_uart_setup
, NULL
};
27 * Initialize the board
29 static void __init
sh7751se_setup(char **cmdline_p
)
31 /* Call init_smsc() replacement to set up SuperIO. */
32 /* XXX: RTC setting comes here */
34 kgdb_register_sermap(&kgdb_uart_sermap
);
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 *********************************************************************/
46 #include <linux/types.h>
47 #include <linux/serial.h>
48 #include <linux/serialP.h>
49 #include <linux/serial_reg.h>
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 */
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
64 struct uart_port uart_ports
[] = {
68 struct uart_port
*kgdb_uart_port
;
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)
73 /* Basic read/write functions for the UART */
74 #define UART_LSR_RXCERR (UART_LSR_BI | UART_LSR_FE | UART_LSR_PE)
75 static int kgdb_uart_getchar(void)
81 lsr
= UART_IN(UART_LSR
);
82 if (lsr
& UART_LSR_DR
)
84 if ((lsr
& UART_LSR_RXCERR
))
90 static void kgdb_uart_putchar(int c
)
92 while ((UART_IN(UART_LSR
) & UART_LSR_THRE
) == 0)
98 * Initialize UART to configured/requested values.
99 * (But we don't interrupts yet, or interact w/serial.c)
101 static int kgdb_uart_setup(void)
107 if (kgdb_portnum
>= UART_NPORTS
) {
108 KGDB_PRINTK("uart port %d invalid.\n", kgdb_portnum
);
112 kgdb_uart_port
= &uart_ports
[kgdb_portnum
];
114 /* Init sequence from gdb_hook_interrupt */
116 UART_OUT(UART_IER
, 0);
118 UART_IN(UART_RX
); /* Serial driver comments say */
119 UART_IN(UART_IIR
); /* this clears interrupt regs */
122 /* Figure basic LCR values */
125 lcr
|= UART_LCR_WLEN7
;
128 lcr
|= UART_LCR_WLEN8
;
131 switch (kgdb_parity
) {
133 lcr
|= UART_LCR_PARITY
;
136 lcr
|= (UART_LCR_PARITY
| UART_LCR_EPAR
);
141 /* Figure the baud rate divisor */
142 bdiv
= (SB_BASE
/kgdb_baud
);
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
);
151 UART_OUT(UART_MCR
, SB_MCR
);
153 /* Turn off FIFOs for now */
154 UART_OUT(UART_FCR
, 0);
156 /* Setup complete: initialize function pointers */
157 kgdb_getchar
= kgdb_uart_getchar
;
158 kgdb_putchar
= kgdb_uart_putchar
;
162 #endif /* CONFIG_SH_KGDB */
169 struct sh_machine_vector mv_7751se __initmv
= {
170 .mv_name
= "7751 SolutionEngine",
171 .mv_setup
= sh7751se_setup
,
174 .mv_inb
= sh7751se_inb
,
175 .mv_inw
= sh7751se_inw
,
176 .mv_inl
= sh7751se_inl
,
177 .mv_outb
= sh7751se_outb
,
178 .mv_outw
= sh7751se_outw
,
179 .mv_outl
= sh7751se_outl
,
181 .mv_inb_p
= sh7751se_inb_p
,
182 .mv_inw_p
= sh7751se_inw
,
183 .mv_inl_p
= sh7751se_inl
,
184 .mv_outb_p
= sh7751se_outb_p
,
185 .mv_outw_p
= sh7751se_outw
,
186 .mv_outl_p
= sh7751se_outl
,
188 .mv_insl
= sh7751se_insl
,
189 .mv_outsl
= sh7751se_outsl
,
191 .mv_init_irq
= init_7751se_IRQ
,
192 #ifdef CONFIG_HEARTBEAT
193 .mv_heartbeat
= heartbeat_7751se
,