aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sh-sci.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/sh-sci.h')
-rw-r--r--drivers/serial/sh-sci.h48
1 files changed, 38 insertions, 10 deletions
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index d24621ce799a..f5764ebcfe07 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -46,7 +46,8 @@
46 */ 46 */
47# define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0 47# define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0
48# define SCIF_ONLY 48# define SCIF_ONLY
49#elif defined(CONFIG_CPU_SUBTYPE_SH7720) 49#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
50 defined(CONFIG_CPU_SUBTYPE_SH7721)
50# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ 51# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
51# define SCIF_ONLY 52# define SCIF_ONLY
52#define SCIF_ORER 0x0200 /* overrun error bit */ 53#define SCIF_ORER 0x0200 /* overrun error bit */
@@ -119,6 +120,12 @@
119# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ 120# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
120# define SCI_ONLY 121# define SCI_ONLY
121# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port) 122# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
123#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
124# define SCSPTR0 0xffe00024 /* 16 bit SCIF */
125# define SCSPTR1 0xffe08024 /* 16 bit SCIF */
126# define SCIF_ORER 0x0001 /* overrun error bit */
127# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
128# define SCIF_ONLY
122#elif defined(CONFIG_CPU_SUBTYPE_SH7770) 129#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
123# define SCSPTR0 0xff923020 /* 16 bit SCIF */ 130# define SCSPTR0 0xff923020 /* 16 bit SCIF */
124# define SCSPTR1 0xff924020 /* 16 bit SCIF */ 131# define SCSPTR1 0xff924020 /* 16 bit SCIF */
@@ -142,7 +149,9 @@
142# define SCIF_OPER 0x0001 /* Overrun error bit */ 149# define SCIF_OPER 0x0001 /* Overrun error bit */
143# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 150# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
144# define SCIF_ONLY 151# define SCIF_ONLY
145#elif defined(CONFIG_CPU_SUBTYPE_SH7206) 152#elif defined(CONFIG_CPU_SUBTYPE_SH7203) || \
153 defined(CONFIG_CPU_SUBTYPE_SH7206) || \
154 defined(CONFIG_CPU_SUBTYPE_SH7263)
146# define SCSPTR0 0xfffe8020 /* 16 bit SCIF */ 155# define SCSPTR0 0xfffe8020 /* 16 bit SCIF */
147# define SCSPTR1 0xfffe8820 /* 16 bit SCIF */ 156# define SCSPTR1 0xfffe8820 /* 16 bit SCIF */
148# define SCSPTR2 0xfffe9020 /* 16 bit SCIF */ 157# define SCSPTR2 0xfffe9020 /* 16 bit SCIF */
@@ -214,7 +223,8 @@
214#define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */ 223#define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
215 224
216#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 225#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
217 defined(CONFIG_CPU_SUBTYPE_SH7720) 226 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
227 defined(CONFIG_CPU_SUBTYPE_SH7721)
218#define SCIF_ORER 0x0200 228#define SCIF_ORER 0x0200
219#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER) 229#define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
220#define SCIF_RFDC_MASK 0x007f 230#define SCIF_RFDC_MASK 0x007f
@@ -252,7 +262,8 @@
252# define SCxSR_PER(port) SCIF_PER 262# define SCxSR_PER(port) SCIF_PER
253# define SCxSR_BRK(port) SCIF_BRK 263# define SCxSR_BRK(port) SCIF_BRK
254#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 264#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
255 defined(CONFIG_CPU_SUBTYPE_SH7720) 265 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
266 defined(CONFIG_CPU_SUBTYPE_SH7721)
256# define SCxSR_RDxF_CLEAR(port) (sci_in(port,SCxSR)&0xfffc) 267# define SCxSR_RDxF_CLEAR(port) (sci_in(port,SCxSR)&0xfffc)
257# define SCxSR_ERROR_CLEAR(port) (sci_in(port,SCxSR)&0xfd73) 268# define SCxSR_ERROR_CLEAR(port) (sci_in(port,SCxSR)&0xfd73)
258# define SCxSR_TDxE_CLEAR(port) (sci_in(port,SCxSR)&0xffdf) 269# define SCxSR_TDxE_CLEAR(port) (sci_in(port,SCxSR)&0xffdf)
@@ -361,7 +372,8 @@
361#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \ 372#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
362 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) 373 CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
363#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 374#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
364 defined(CONFIG_CPU_SUBTYPE_SH7720) 375 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
376 defined(CONFIG_CPU_SUBTYPE_SH7721)
365#define SCIF_FNS(name, scif_offset, scif_size) \ 377#define SCIF_FNS(name, scif_offset, scif_size) \
366 CPU_SCIF_FNS(name, scif_offset, scif_size) 378 CPU_SCIF_FNS(name, scif_offset, scif_size)
367#else 379#else
@@ -388,7 +400,8 @@
388#endif 400#endif
389 401
390#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 402#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
391 defined(CONFIG_CPU_SUBTYPE_SH7720) 403 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
404 defined(CONFIG_CPU_SUBTYPE_SH7721)
392 405
393SCIF_FNS(SCSMR, 0x00, 16) 406SCIF_FNS(SCSMR, 0x00, 16)
394SCIF_FNS(SCBRR, 0x04, 8) 407SCIF_FNS(SCBRR, 0x04, 8)
@@ -412,6 +425,7 @@ SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8)
412SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8) 425SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8)
413SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16) 426SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16)
414#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \ 427#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
428 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
415 defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 429 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
416 defined(CONFIG_CPU_SUBTYPE_SH7785) 430 defined(CONFIG_CPU_SUBTYPE_SH7785)
417SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16) 431SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
@@ -510,7 +524,8 @@ static inline void set_sh771x_scif_pfc(struct uart_port *port)
510 return; 524 return;
511 } 525 }
512} 526}
513#elif defined(CONFIG_CPU_SUBTYPE_SH7720) 527#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
528 defined(CONFIG_CPU_SUBTYPE_SH7721)
514static inline int sci_rxd_in(struct uart_port *port) 529static inline int sci_rxd_in(struct uart_port *port)
515{ 530{
516 if (port->mapbase == 0xa4430000) 531 if (port->mapbase == 0xa4430000)
@@ -580,6 +595,15 @@ static inline int sci_rxd_in(struct uart_port *port)
580 int ch = (port->mapbase - SMR0) >> 3; 595 int ch = (port->mapbase - SMR0) >> 3;
581 return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0; 596 return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0;
582} 597}
598#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
599static inline int sci_rxd_in(struct uart_port *port)
600{
601 if (port->mapbase == 0xffe00000)
602 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
603 if (port->mapbase == 0xffe08000)
604 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
605 return 1;
606}
583#elif defined(CONFIG_CPU_SUBTYPE_SH7770) 607#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
584static inline int sci_rxd_in(struct uart_port *port) 608static inline int sci_rxd_in(struct uart_port *port)
585{ 609{
@@ -617,7 +641,9 @@ static inline int sci_rxd_in(struct uart_port *port)
617 return ctrl_inw(SCSPTR5) & 0x0001 ? 1 : 0; /* SCIF */ 641 return ctrl_inw(SCSPTR5) & 0x0001 ? 1 : 0; /* SCIF */
618 return 1; 642 return 1;
619} 643}
620#elif defined(CONFIG_CPU_SUBTYPE_SH7206) 644#elif defined(CONFIG_CPU_SUBTYPE_SH7203) || \
645 defined(CONFIG_CPU_SUBTYPE_SH7206) || \
646 defined(CONFIG_CPU_SUBTYPE_SH7263)
621static inline int sci_rxd_in(struct uart_port *port) 647static inline int sci_rxd_in(struct uart_port *port)
622{ 648{
623 if (port->mapbase == 0xfffe8000) 649 if (port->mapbase == 0xfffe8000)
@@ -688,11 +714,13 @@ static inline int sci_rxd_in(struct uart_port *port)
688 * -- Mitch Davis - 15 Jul 2000 714 * -- Mitch Davis - 15 Jul 2000
689 */ 715 */
690 716
691#if defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 717#if defined(CONFIG_CPU_SUBTYPE_SH7763) || \
718 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
692 defined(CONFIG_CPU_SUBTYPE_SH7785) 719 defined(CONFIG_CPU_SUBTYPE_SH7785)
693#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1) 720#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
694#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 721#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
695 defined(CONFIG_CPU_SUBTYPE_SH7720) 722 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
723 defined(CONFIG_CPU_SUBTYPE_SH7721)
696#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1) 724#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
697#elif defined(__H8300H__) || defined(__H8300S__) 725#elif defined(__H8300H__) || defined(__H8300S__)
698#define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1) 726#define SCBRR_VALUE(bps) (((CONFIG_CPU_CLOCK*1000/32)/bps)-1)