2004-04-06 11:12:09

by Yoshinori Sato

[permalink] [raw]
Subject: sh-sci compile error fix patch

- add Kconfig depends H8300
- H8/300 support compile error fixed.

--
Yoshinori Sato
<[email protected]>

diff -Nru -X .exclude-diff linux-2.6.5/drivers/serial/Kconfig linux-2.6.5-h8300/drivers/serial/Kconfig
--- linux-2.6.5/drivers/serial/Kconfig 2004-04-06 17:11:11.000000000 +0900
+++ linux-2.6.5-h8300/drivers/serial/Kconfig 2004-04-06 01:52:16.000000000 +0900
@@ -479,7 +479,7 @@

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 -Nru -X .exclude-diff linux-2.6.5/drivers/serial/sh-sci.c linux-2.6.5-h8300/drivers/serial/sh-sci.c
--- linux-2.6.5/drivers/serial/sh-sci.c 2004-04-06 17:11:11.000000000 +0900
+++ linux-2.6.5-h8300/drivers/serial/sh-sci.c 2004-04-06 01:52:16.000000000 +0900
@@ -313,9 +313,9 @@

#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 @@
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 @@
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 @@
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 @@

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 @@
* 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 @@
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 -Nru -X .exclude-diff linux-2.6.5/drivers/serial/sh-sci.h linux-2.6.5-h8300/drivers/serial/sh-sci.h
--- linux-2.6.5/drivers/serial/sh-sci.h 2004-04-06 17:11:11.000000000 +0900
+++ linux-2.6.5-h8300/drivers/serial/sh-sci.h 2004-04-06 01:52:16.000000000 +0900
@@ -240,11 +240,11 @@
}

#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 @@

}
#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