From: Yoshinori Sato - add Kconfig depends H8300 - H8/300 support compile error fixed. --- 25-akpm/drivers/serial/Kconfig | 2 +- 25-akpm/drivers/serial/sh-sci.c | 25 ++++++++++++++++++++++--- 25-akpm/drivers/serial/sh-sci.h | 8 ++++---- 3 files changed, 27 insertions(+), 8 deletions(-) diff -puN drivers/serial/Kconfig~sh-sci-build-fix drivers/serial/Kconfig --- 25/drivers/serial/Kconfig~sh-sci-build-fix 2004-04-06 19:05:45.447078344 -0700 +++ 25-akpm/drivers/serial/Kconfig 2004-04-06 19:05:45.454077280 -0700 @@ -479,7 +479,7 @@ config SERIAL98_CONSOLE config SERIAL_SH_SCI tristate "SH SCI(F) serial port support" - depends on SUPERH + depends on SUPERH || H8300 select SERIAL_CORE config SERIAL_SH_SCI_CONSOLE diff -puN drivers/serial/sh-sci.c~sh-sci-build-fix drivers/serial/sh-sci.c --- 25/drivers/serial/sh-sci.c~sh-sci-build-fix 2004-04-06 19:05:45.448078192 -0700 +++ 25-akpm/drivers/serial/sh-sci.c 2004-04-06 19:05:45.455077128 -0700 @@ -313,9 +313,9 @@ static void h8300_sci_enable(struct sci_ #if defined(SCI_ONLY) || defined(SCI_AND_SCIF) #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 */ 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 ua return; } +#if !defined(SCI_ONLY) if (port->type == PORT_SCIF) { txroom = 16 - (sci_in(port, SCFDR)>>8); } else { txroom = (sci_in(port, SCxSR) & SCI_TDRE)?1:0; } +#else + txroom = (sci_in(port, SCxSR) & SCI_TDRE)?1:0; +#endif count = txroom; @@ -454,10 +458,12 @@ static void sci_transmit_chars(struct ua local_irq_save(flags); ctrl = sci_in(port, SCSCR); +#if !defined(SCI_ONLY) if (port->type == PORT_SCIF) { sci_in(port, SCxSR); /* Dummy read */ sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); } +#endif ctrl |= SCI_CTRL_FLAGS_TIE; sci_out(port, SCSCR, ctrl); @@ -480,11 +486,15 @@ static inline void sci_receive_chars(str return; while (1) { +#if !defined(SCI_ONLY) if (port->type == PORT_SCIF) { count = sci_in(port, SCFDR)&0x001f; } else { 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 */ if (tty->flip.count + count > TTY_FLIPBUF_SIZE) @@ -936,9 +946,11 @@ static void sci_set_termios(struct uart_ sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ +#if !defined(SCI_ONLY) if (port->type == PORT_SCIF) { sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); } +#endif smr_val = sci_in(port, SCSMR) & 3; if ((termios->c_cflag & CSIZE) == CS7) @@ -1328,8 +1340,11 @@ static int __init serial_console_setup(s * We need to set the initial uartclk here, since otherwise it will * only ever be setup at sci_init() time. */ +#if !defined(__H8300H__) && !defined(__H8300S__) port->uartclk = current_cpu_data.module_clock * 16; - +#else + port->uartclk = CONFIG_CPU_CLOCK; +#endif if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); @@ -1468,7 +1483,11 @@ static int __init sci_init(void) for (chan = 0; chan < SCI_NPORTS; chan++) { struct sci_port *sciport = &sci_ports[chan]; +#if !defined(__H8300H__) && !defined(__H8300S__) 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); sciport->break_timer.data = (unsigned long)sciport; sciport->break_timer.function = sci_break_timer; diff -puN drivers/serial/sh-sci.h~sh-sci-build-fix drivers/serial/sh-sci.h --- 25/drivers/serial/sh-sci.h~sh-sci-build-fix 2004-04-06 19:05:45.450077888 -0700 +++ 25-akpm/drivers/serial/sh-sci.h 2004-04-06 19:05:45.456076976 -0700 @@ -240,11 +240,11 @@ struct sci_port { } #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); \ } \ - 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); \ } @@ -379,9 +379,9 @@ static inline int sci_rxd_in(struct uart } #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; } #endif _