Commit 2aa53d18 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] sh-sci compile error fix patch

From: Yoshinori Sato <ysato@users.sourceforge.jp>

- add Kconfig depends H8300
- H8/300 support compile error fixed.
parent 8d94c528
...@@ -479,7 +479,7 @@ config SERIAL98_CONSOLE ...@@ -479,7 +479,7 @@ config SERIAL98_CONSOLE
config SERIAL_SH_SCI config SERIAL_SH_SCI
tristate "SH SCI(F) serial port support" tristate "SH SCI(F) serial port support"
depends on SUPERH depends on SUPERH || H8300
select SERIAL_CORE select SERIAL_CORE
config SERIAL_SH_SCI_CONSOLE config SERIAL_SH_SCI_CONSOLE
......
...@@ -313,9 +313,9 @@ static void h8300_sci_enable(struct uart_port* port, unsigned int ctrl) ...@@ -313,9 +313,9 @@ static void h8300_sci_enable(struct uart_port* port, unsigned int ctrl)
#if defined(SCI_ONLY) || defined(SCI_AND_SCIF) #if defined(SCI_ONLY) || defined(SCI_AND_SCIF)
#if defined(__H8300H__) || defined(__H8300S__) #if defined(__H8300H__) || defined(__H8300S__)
static void sci_init_pins_sci(struct sci_port* port, unsigned int cflag) static void sci_init_pins_sci(struct uart_port* port, unsigned int cflag)
{ {
int ch = (port->base - SMR0) >> 3; int ch = (port->mapbase - SMR0) >> 3;
/* set DDR regs */ /* set DDR regs */
H8300_GPIO_DDR(h8300_sci_pins[ch].port,h8300_sci_pins[ch].rx,H8300_GPIO_INPUT); H8300_GPIO_DDR(h8300_sci_pins[ch].port,h8300_sci_pins[ch].rx,H8300_GPIO_INPUT);
...@@ -418,11 +418,15 @@ static void sci_transmit_chars(struct uart_port *port) ...@@ -418,11 +418,15 @@ static void sci_transmit_chars(struct uart_port *port)
return; return;
} }
#if !defined(SCI_ONLY)
if (port->type == PORT_SCIF) { if (port->type == PORT_SCIF) {
txroom = 16 - (sci_in(port, SCFDR)>>8); txroom = 16 - (sci_in(port, SCFDR)>>8);
} else { } else {
txroom = (sci_in(port, SCxSR) & SCI_TDRE)?1:0; txroom = (sci_in(port, SCxSR) & SCI_TDRE)?1:0;
} }
#else
txroom = (sci_in(port, SCxSR) & SCI_TDRE)?1:0;
#endif
count = txroom; count = txroom;
...@@ -454,10 +458,12 @@ static void sci_transmit_chars(struct uart_port *port) ...@@ -454,10 +458,12 @@ static void sci_transmit_chars(struct uart_port *port)
local_irq_save(flags); local_irq_save(flags);
ctrl = sci_in(port, SCSCR); ctrl = sci_in(port, SCSCR);
#if !defined(SCI_ONLY)
if (port->type == PORT_SCIF) { if (port->type == PORT_SCIF) {
sci_in(port, SCxSR); /* Dummy read */ sci_in(port, SCxSR); /* Dummy read */
sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
} }
#endif
ctrl |= SCI_CTRL_FLAGS_TIE; ctrl |= SCI_CTRL_FLAGS_TIE;
sci_out(port, SCSCR, ctrl); sci_out(port, SCSCR, ctrl);
...@@ -480,11 +486,15 @@ static inline void sci_receive_chars(struct uart_port *port, ...@@ -480,11 +486,15 @@ static inline void sci_receive_chars(struct uart_port *port,
return; return;
while (1) { while (1) {
#if !defined(SCI_ONLY)
if (port->type == PORT_SCIF) { if (port->type == PORT_SCIF) {
count = sci_in(port, SCFDR)&0x001f; count = sci_in(port, SCFDR)&0x001f;
} else { } else {
count = (sci_in(port, SCxSR)&SCxSR_RDxF(port))?1:0; count = (sci_in(port, SCxSR)&SCxSR_RDxF(port))?1:0;
} }
#else
count = (sci_in(port, SCxSR)&SCxSR_RDxF(port))?1:0;
#endif
/* Don't copy more bytes than there is room for in the buffer */ /* Don't copy more bytes than there is room for in the buffer */
if (tty->flip.count + count > TTY_FLIPBUF_SIZE) if (tty->flip.count + count > TTY_FLIPBUF_SIZE)
...@@ -936,9 +946,11 @@ static void sci_set_termios(struct uart_port *port, struct termios *termios, ...@@ -936,9 +946,11 @@ static void sci_set_termios(struct uart_port *port, struct termios *termios,
sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */
#if !defined(SCI_ONLY)
if (port->type == PORT_SCIF) { if (port->type == PORT_SCIF) {
sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST);
} }
#endif
smr_val = sci_in(port, SCSMR) & 3; smr_val = sci_in(port, SCSMR) & 3;
if ((termios->c_cflag & CSIZE) == CS7) if ((termios->c_cflag & CSIZE) == CS7)
...@@ -1328,8 +1340,11 @@ static int __init serial_console_setup(struct console *co, char *options) ...@@ -1328,8 +1340,11 @@ static int __init serial_console_setup(struct console *co, char *options)
* We need to set the initial uartclk here, since otherwise it will * We need to set the initial uartclk here, since otherwise it will
* only ever be setup at sci_init() time. * only ever be setup at sci_init() time.
*/ */
#if !defined(__H8300H__) && !defined(__H8300S__)
port->uartclk = current_cpu_data.module_clock * 16; port->uartclk = current_cpu_data.module_clock * 16;
#else
port->uartclk = CONFIG_CPU_CLOCK;
#endif
if (options) if (options)
uart_parse_options(options, &baud, &parity, &bits, &flow); uart_parse_options(options, &baud, &parity, &bits, &flow);
...@@ -1468,7 +1483,11 @@ static int __init sci_init(void) ...@@ -1468,7 +1483,11 @@ static int __init sci_init(void)
for (chan = 0; chan < SCI_NPORTS; chan++) { for (chan = 0; chan < SCI_NPORTS; chan++) {
struct sci_port *sciport = &sci_ports[chan]; struct sci_port *sciport = &sci_ports[chan];
#if !defined(__H8300H__) && !defined(__H8300S__)
sciport->port.uartclk = (current_cpu_data.module_clock * 16); sciport->port.uartclk = (current_cpu_data.module_clock * 16);
#else
sciport->port.uartclk = CONFIG_CPU_CLOCK;
#endif
uart_add_one_port(&sci_uart_driver, &sciport->port); uart_add_one_port(&sci_uart_driver, &sciport->port);
sciport->break_timer.data = (unsigned long)sciport; sciport->break_timer.data = (unsigned long)sciport;
sciport->break_timer.function = sci_break_timer; sciport->break_timer.function = sci_break_timer;
......
...@@ -240,11 +240,11 @@ struct sci_port { ...@@ -240,11 +240,11 @@ struct sci_port {
} }
#define CPU_SCI_FNS(name, sci_offset, sci_size) \ #define CPU_SCI_FNS(name, sci_offset, sci_size) \
static inline unsigned int sci_##name##_in(struct sci_port* port) \ static inline unsigned int sci_##name##_in(struct uart_port* port) \
{ \ { \
SCI_IN(sci_size, sci_offset); \ SCI_IN(sci_size, sci_offset); \
} \ } \
static inline void sci_##name##_out(struct sci_port* port, unsigned int value) \ static inline void sci_##name##_out(struct uart_port* port, unsigned int value) \
{ \ { \
SCI_OUT(sci_size, sci_offset, value); \ SCI_OUT(sci_size, sci_offset, value); \
} }
...@@ -379,9 +379,9 @@ static inline int sci_rxd_in(struct uart_port *port) ...@@ -379,9 +379,9 @@ static inline int sci_rxd_in(struct uart_port *port)
} }
#elif defined(__H8300H__) || defined(__H8300S__) #elif defined(__H8300H__) || defined(__H8300S__)
static inline int sci_rxd_in(struct sci_port *port) static inline int sci_rxd_in(struct uart_port *port)
{ {
int ch = (port->base - SMR0) >> 3; int ch = (port->mapbase - SMR0) >> 3;
return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0; return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment