diff options
Diffstat (limited to 'drivers/serial/sh-sci.h')
-rw-r--r-- | drivers/serial/sh-sci.h | 60 |
1 files changed, 45 insertions, 15 deletions
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index 01a9dd715f5d..fa8700a968fc 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -1,20 +1,5 @@ | |||
1 | /* $Id: sh-sci.h,v 1.4 2004/02/19 16:43:56 lethal Exp $ | ||
2 | * | ||
3 | * linux/drivers/serial/sh-sci.h | ||
4 | * | ||
5 | * SuperH on-chip serial module support. (SCI with no FIFO / with FIFO) | ||
6 | * Copyright (C) 1999, 2000 Niibe Yutaka | ||
7 | * Copyright (C) 2000 Greg Banks | ||
8 | * Copyright (C) 2002, 2003 Paul Mundt | ||
9 | * Modified to support multiple serial ports. Stuart Menefy (May 2000). | ||
10 | * Modified to support SH7300(SH-Mobile) SCIF. Takashi Kusuda (Jun 2003). | ||
11 | * Modified to support H8/300 Series Yoshinori Sato (Feb 2004). | ||
12 | * Removed SH7300 support (Jul 2007). | ||
13 | * Modified to support SH7720 SCIF. Markus Brunner, Mark Jonas (Aug 2007). | ||
14 | */ | ||
15 | #include <linux/serial_core.h> | 1 | #include <linux/serial_core.h> |
16 | #include <asm/io.h> | 2 | #include <asm/io.h> |
17 | |||
18 | #include <asm/gpio.h> | 3 | #include <asm/gpio.h> |
19 | 4 | ||
20 | #if defined(CONFIG_H83007) || defined(CONFIG_H83068) | 5 | #if defined(CONFIG_H83007) || defined(CONFIG_H83068) |
@@ -102,6 +87,15 @@ | |||
102 | # define SCSPTR0 SCPDR0 | 87 | # define SCSPTR0 SCPDR0 |
103 | # define SCIF_ORER 0x0001 /* overrun error bit */ | 88 | # define SCIF_ORER 0x0001 /* overrun error bit */ |
104 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | 89 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ |
90 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) | ||
91 | # define SCSPTR0 0xa4050160 | ||
92 | # define SCSPTR1 0xa405013e | ||
93 | # define SCSPTR2 0xa4050160 | ||
94 | # define SCSPTR3 0xa405013e | ||
95 | # define SCSPTR4 0xa4050128 | ||
96 | # define SCSPTR5 0xa4050128 | ||
97 | # define SCIF_ORER 0x0001 /* overrun error bit */ | ||
98 | # define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ | ||
105 | # define SCIF_ONLY | 99 | # define SCIF_ONLY |
106 | #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) | 100 | #elif defined(CONFIG_CPU_SUBTYPE_SH4_202) |
107 | # define SCSPTR2 0xffe80020 /* 16 bit SCIF */ | 101 | # define SCSPTR2 0xffe80020 /* 16 bit SCIF */ |
@@ -395,6 +389,11 @@ | |||
395 | h8_sci_offset, h8_sci_size) \ | 389 | h8_sci_offset, h8_sci_size) \ |
396 | CPU_SCI_FNS(name, h8_sci_offset, h8_sci_size) | 390 | CPU_SCI_FNS(name, h8_sci_offset, h8_sci_size) |
397 | #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) | 391 | #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) |
392 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) | ||
393 | #define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scif_offset, sh4_scif_size) \ | ||
394 | CPU_SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scif_offset, sh4_scif_size) | ||
395 | #define SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) \ | ||
396 | CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) | ||
398 | #else | 397 | #else |
399 | #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \ | 398 | #define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \ |
400 | sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \ | 399 | sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \ |
@@ -419,6 +418,18 @@ SCIF_FNS(SCFDR, 0x1c, 16) | |||
419 | SCIF_FNS(SCxTDR, 0x20, 8) | 418 | SCIF_FNS(SCxTDR, 0x20, 8) |
420 | SCIF_FNS(SCxRDR, 0x24, 8) | 419 | SCIF_FNS(SCxRDR, 0x24, 8) |
421 | SCIF_FNS(SCLSR, 0x24, 16) | 420 | SCIF_FNS(SCLSR, 0x24, 16) |
421 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) | ||
422 | SCIx_FNS(SCSMR, 0x00, 16, 0x00, 16) | ||
423 | SCIx_FNS(SCBRR, 0x04, 8, 0x04, 8) | ||
424 | SCIx_FNS(SCSCR, 0x08, 16, 0x08, 16) | ||
425 | SCIx_FNS(SCxTDR, 0x20, 8, 0x0c, 8) | ||
426 | SCIx_FNS(SCxSR, 0x14, 16, 0x10, 16) | ||
427 | SCIx_FNS(SCxRDR, 0x24, 8, 0x14, 8) | ||
428 | SCIF_FNS(SCTDSR, 0x0c, 8) | ||
429 | SCIF_FNS(SCFER, 0x10, 16) | ||
430 | SCIF_FNS(SCFCR, 0x18, 16) | ||
431 | SCIF_FNS(SCFDR, 0x1c, 16) | ||
432 | SCIF_FNS(SCLSR, 0x24, 16) | ||
422 | #else | 433 | #else |
423 | /* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 SCI/H8*/ | 434 | /* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 SCI/H8*/ |
424 | /* name off sz off sz off sz off sz off sz*/ | 435 | /* name off sz off sz off sz off sz off sz*/ |
@@ -589,6 +600,23 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
589 | return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ | 600 | return ctrl_inb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */ |
590 | return 1; | 601 | return 1; |
591 | } | 602 | } |
603 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) | ||
604 | static inline int sci_rxd_in(struct uart_port *port) | ||
605 | { | ||
606 | if (port->mapbase == 0xffe00000) | ||
607 | return ctrl_inb(SCSPTR0) & 0x0008 ? 1 : 0; /* SCIF0 */ | ||
608 | if (port->mapbase == 0xffe10000) | ||
609 | return ctrl_inb(SCSPTR1) & 0x0020 ? 1 : 0; /* SCIF1 */ | ||
610 | if (port->mapbase == 0xffe20000) | ||
611 | return ctrl_inb(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF2 */ | ||
612 | if (port->mapbase == 0xa4e30000) | ||
613 | return ctrl_inb(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF3 */ | ||
614 | if (port->mapbase == 0xa4e40000) | ||
615 | return ctrl_inb(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF4 */ | ||
616 | if (port->mapbase == 0xa4e50000) | ||
617 | return ctrl_inb(SCSPTR5) & 0x0008 ? 1 : 0; /* SCIF5 */ | ||
618 | return 1; | ||
619 | } | ||
592 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) | 620 | #elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103) |
593 | static inline int sci_rxd_in(struct uart_port *port) | 621 | static inline int sci_rxd_in(struct uart_port *port) |
594 | { | 622 | { |
@@ -727,6 +755,8 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
727 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ | 755 | defined(CONFIG_CPU_SUBTYPE_SH7720) || \ |
728 | defined(CONFIG_CPU_SUBTYPE_SH7721) | 756 | defined(CONFIG_CPU_SUBTYPE_SH7721) |
729 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) | 757 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) |
758 | #elif defined(CONFIG_CPU_SUBTYPE_SH7723) | ||
759 | #define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(16*bps)-1) | ||
730 | #elif defined(__H8300H__) || defined(__H8300S__) | 760 | #elif defined(__H8300H__) || defined(__H8300S__) |
731 | #define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1) | 761 | #define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1) |
732 | #elif defined(CONFIG_SUPERH64) | 762 | #elif defined(CONFIG_SUPERH64) |