2005-04-16 22:20:36 +00:00
|
|
|
#include <linux/serial_core.h>
|
2009-11-25 07:23:35 +00:00
|
|
|
#include <linux/io.h>
|
2008-12-25 09:17:34 +00:00
|
|
|
#include <linux/gpio.h>
|
2007-08-19 23:59:33 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
|
|
|
|
#include <asm/regs306x.h>
|
|
|
|
#endif
|
|
|
|
#if defined(CONFIG_H8S2678)
|
|
|
|
#include <asm/regs267x.h>
|
|
|
|
#endif
|
|
|
|
|
2007-07-26 01:14:16 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7707) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7708) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7709)
|
2005-04-16 22:20:36 +00:00
|
|
|
# define SCPCR 0xA4000116 /* 16 bit SCI and SCIF */
|
|
|
|
# define SCPDR 0xA4000136 /* 8 bit SCI and SCIF */
|
|
|
|
# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
|
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
|
|
|
|
# define SCIF0 0xA4400000
|
|
|
|
# define SCIF2 0xA4410000
|
2006-02-01 11:06:06 +00:00
|
|
|
# define SCSMR_Ir 0xA44A0000
|
|
|
|
# define IRDA_SCIF SCIF0
|
2005-04-16 22:20:36 +00:00
|
|
|
# define SCPCR 0xA4000116
|
|
|
|
# define SCPDR 0xA4000136
|
|
|
|
|
|
|
|
/* Set the clock source,
|
|
|
|
* SCIF2 (0xA4410000) -> External clock, SCK pin used as clock input
|
|
|
|
* SCIF0 (0xA4400000) -> Internal clock, SCK pin as serial clock output
|
|
|
|
*/
|
|
|
|
# define SCSCR_INIT(port) (port->mapbase == SCIF2) ? 0xF3 : 0xF0
|
2007-12-26 02:45:06 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7721)
|
2007-08-19 23:59:33 +00:00
|
|
|
# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
|
2009-01-09 07:32:08 +00:00
|
|
|
# define PORT_PTCR 0xA405011EUL
|
|
|
|
# define PORT_PVCR 0xA4050122UL
|
|
|
|
# define SCIF_ORER 0x0200 /* overrun error bit */
|
2005-04-16 22:20:36 +00:00
|
|
|
#elif defined(CONFIG_SH_RTS7751R2D)
|
2008-10-29 07:16:02 +00:00
|
|
|
# define SCSPTR1 0xFFE0001C /* 8 bit SCIF */
|
2005-04-16 22:20:36 +00:00
|
|
|
# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
|
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2007-05-15 07:25:47 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7091) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7751) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7751R)
|
2005-04-16 22:20:36 +00:00
|
|
|
# define SCSPTR1 0xffe0001c /* 8 bit SCI */
|
|
|
|
# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
|
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) (((port)->type == PORT_SCI) ? \
|
|
|
|
0x30 /* TIE=0,RIE=0,TE=1,RE=1 */ : \
|
|
|
|
0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ )
|
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
|
2006-02-01 11:06:06 +00:00
|
|
|
# define SCSPTR0 0xfe600024 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR1 0xfe610024 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR2 0xfe620024 /* 16 bit SCIF */
|
2005-04-16 22:20:36 +00:00
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2007-06-20 09:27:10 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
|
2006-09-27 07:32:13 +00:00
|
|
|
# define SCSPTR0 0xA4400000 /* 16 bit SCIF */
|
2007-03-27 09:13:51 +00:00
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define PACR 0xa4050100
|
|
|
|
# define PBCR 0xa4050102
|
|
|
|
# define SCSCR_INIT(port) 0x3B
|
2006-09-27 07:32:13 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7343)
|
|
|
|
# define SCSPTR0 0xffe00010 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR1 0xffe10010 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR2 0xffe20010 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR3 0xffe30010 /* 16 bit SCIF */
|
|
|
|
# define SCSCR_INIT(port) 0x32 /* TIE=0,RIE=0,TE=1,RE=1,REIE=0,CKE=1 */
|
2006-12-11 11:28:03 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
|
2008-04-23 12:25:29 +00:00
|
|
|
# define PADR 0xA4050120
|
|
|
|
# define PSDR 0xA405013e
|
|
|
|
# define PWDR 0xA4050166
|
|
|
|
# define PSCR 0xA405011E
|
2006-12-11 11:28:03 +00:00
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2008-02-08 08:31:24 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7366)
|
|
|
|
# define SCPDR0 0xA405013E /* 16 bit SCIF0 PSDR */
|
|
|
|
# define SCSPTR0 SCPDR0
|
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2008-04-09 08:56:18 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7723)
|
|
|
|
# define SCSPTR0 0xa4050160
|
|
|
|
# define SCSPTR1 0xa405013e
|
|
|
|
# define SCSPTR2 0xa4050160
|
|
|
|
# define SCSPTR3 0xa405013e
|
|
|
|
# define SCSPTR4 0xa4050128
|
|
|
|
# define SCSPTR5 0xa4050128
|
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2009-04-15 02:42:47 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7724)
|
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x0038 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2005-04-16 22:20:36 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
|
|
|
|
# define SCSPTR2 0xffe80020 /* 16 bit SCIF */
|
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
|
|
|
|
# define SCIF_BASE_ADDR 0x01030000
|
|
|
|
# define SCIF_ADDR_SH5 PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR
|
|
|
|
# define SCIF_PTR2_OFFS 0x0000020
|
|
|
|
# define SCIF_LSR2_OFFS 0x0000024
|
|
|
|
# define SCSPTR2 ((port->mapbase)+SCIF_PTR2_OFFS) /* 16 bit SCIF */
|
|
|
|
# define SCLSR2 ((port->mapbase)+SCIF_LSR2_OFFS) /* 16 bit SCIF */
|
2007-11-07 02:05:32 +00:00
|
|
|
# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0, TE=1,RE=1,REIE=1 */
|
2005-04-16 22:20:36 +00:00
|
|
|
#elif defined(CONFIG_H83007) || defined(CONFIG_H83068)
|
|
|
|
# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
|
|
|
|
# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
|
|
|
|
#elif defined(CONFIG_H8S2678)
|
|
|
|
# define SCSCR_INIT(port) 0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
|
|
|
|
# define H8300_SCI_DR(ch) *(volatile char *)(P1DR + h8300_sci_pins[ch].port)
|
2009-08-21 07:30:28 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7757)
|
|
|
|
# define SCSPTR0 0xfe4b0020
|
|
|
|
# define SCSPTR1 0xfe4b0020
|
|
|
|
# define SCSPTR2 0xfe4b0020
|
|
|
|
# define SCIF_ORER 0x0001
|
|
|
|
# define SCSCR_INIT(port) 0x38
|
|
|
|
# define SCIF_ONLY
|
2008-01-07 05:40:07 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
|
|
|
|
# define SCSPTR0 0xffe00024 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR1 0xffe08024 /* 16 bit SCIF */
|
2008-06-06 08:04:08 +00:00
|
|
|
# define SCSPTR2 0xffe10020 /* 16 bit SCIF/IRDA */
|
2008-01-07 05:40:07 +00:00
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
2008-06-06 08:04:08 +00:00
|
|
|
# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2006-02-01 11:06:06 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
|
|
|
|
# define SCSPTR0 0xff923020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR1 0xff924020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR2 0xff925020 /* 16 bit SCIF */
|
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x3c /* TIE=0,RIE=0,TE=1,RE=1,REIE=1,cke=2 */
|
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
|
|
|
|
# define SCSPTR0 0xffe00024 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR1 0xffe10024 /* 16 bit SCIF */
|
2006-09-27 07:32:13 +00:00
|
|
|
# define SCIF_ORER 0x0001 /* Overrun error bit */
|
2006-02-01 11:06:06 +00:00
|
|
|
# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2009-03-03 06:40:25 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7786)
|
2007-03-12 05:38:59 +00:00
|
|
|
# define SCSPTR0 0xffea0024 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR1 0xffeb0024 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR2 0xffec0024 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR3 0xffed0024 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR4 0xffee0024 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR5 0xffef0024 /* 16 bit SCIF */
|
2009-02-10 09:04:00 +00:00
|
|
|
# define SCIF_ORER 0x0001 /* Overrun error bit */
|
2007-03-12 05:38:59 +00:00
|
|
|
# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2008-11-28 13:48:20 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7203) || \
|
2007-11-26 10:54:02 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7206) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7263)
|
2006-11-05 06:40:13 +00:00
|
|
|
# define SCSPTR0 0xfffe8020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR1 0xfffe8820 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR2 0xfffe9020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR3 0xfffe9820 /* 16 bit SCIF */
|
2008-11-28 13:48:20 +00:00
|
|
|
# if defined(CONFIG_CPU_SUBTYPE_SH7201)
|
|
|
|
# define SCSPTR4 0xfffeA020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR5 0xfffeA820 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR6 0xfffeB020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR7 0xfffeB820 /* 16 bit SCIF */
|
|
|
|
# endif
|
2006-11-05 06:40:13 +00:00
|
|
|
# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
|
|
|
|
# define SCSPTR0 0xf8400020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR1 0xf8410020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR2 0xf8420020 /* 16 bit SCIF */
|
|
|
|
# define SCIF_ORER 0x0001 /* overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2007-06-20 09:27:10 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
|
|
|
|
# define SCSPTR0 0xffc30020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR1 0xffc40020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR2 0xffc50020 /* 16 bit SCIF */
|
|
|
|
# define SCSPTR3 0xffc60020 /* 16 bit SCIF */
|
|
|
|
# define SCIF_ORER 0x0001 /* Overrun error bit */
|
|
|
|
# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
|
2005-04-16 22:20:36 +00:00
|
|
|
#else
|
|
|
|
# error CPU subtype not defined
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* SCSCR */
|
|
|
|
#define SCI_CTRL_FLAGS_TIE 0x80 /* all */
|
|
|
|
#define SCI_CTRL_FLAGS_RIE 0x40 /* all */
|
|
|
|
#define SCI_CTRL_FLAGS_TE 0x20 /* all */
|
|
|
|
#define SCI_CTRL_FLAGS_RE 0x10 /* all */
|
2007-05-15 07:25:47 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7750) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7091) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
|
2008-10-31 07:10:23 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7722) || \
|
2007-05-15 07:25:47 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7751) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
|
2008-06-06 08:04:08 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7763) || \
|
2007-05-15 07:25:47 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7780) || \
|
2007-06-20 09:27:10 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7785) || \
|
2009-03-03 06:40:25 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7786) || \
|
2007-06-20 09:27:10 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SHX3)
|
2005-04-16 22:20:36 +00:00
|
|
|
#define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */
|
|
|
|
#else
|
|
|
|
#define SCI_CTRL_FLAGS_REIE 0
|
|
|
|
#endif
|
|
|
|
/* SCI_CTRL_FLAGS_MPIE 0x08 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
/* SCI_CTRL_FLAGS_TEIE 0x04 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
/* SCI_CTRL_FLAGS_CKE1 0x02 * all */
|
|
|
|
/* SCI_CTRL_FLAGS_CKE0 0x01 * 7707 SCI/SCIF, 7708 SCI, 7709 SCI/SCIF, 7750 SCI */
|
|
|
|
|
|
|
|
/* SCxSR SCI */
|
|
|
|
#define SCI_TDRE 0x80 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
#define SCI_RDRF 0x40 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
#define SCI_ORER 0x20 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
#define SCI_FER 0x10 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
#define SCI_PER 0x08 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
#define SCI_TEND 0x04 /* 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
/* SCI_MPB 0x02 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
/* SCI_MPBT 0x01 * 7707 SCI, 7708 SCI, 7709 SCI, 7750 SCI */
|
|
|
|
|
|
|
|
#define SCI_ERRORS ( SCI_PER | SCI_FER | SCI_ORER)
|
|
|
|
|
|
|
|
/* SCxSR SCIF */
|
|
|
|
#define SCIF_ER 0x0080 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
|
|
|
|
#define SCIF_TEND 0x0040 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
|
|
|
|
#define SCIF_TDFE 0x0020 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
|
|
|
|
#define SCIF_BRK 0x0010 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
|
|
|
|
#define SCIF_FER 0x0008 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
|
|
|
|
#define SCIF_PER 0x0004 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
|
|
|
|
#define SCIF_RDF 0x0002 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
|
|
|
|
#define SCIF_DR 0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
|
|
|
|
|
2007-08-19 23:59:33 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
|
2007-12-26 02:45:06 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7720) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7721)
|
2008-06-06 08:04:08 +00:00
|
|
|
# define SCIF_ORER 0x0200
|
|
|
|
# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
|
|
|
|
# define SCIF_RFDC_MASK 0x007f
|
|
|
|
# define SCIF_TXROOM_MAX 64
|
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
|
|
|
|
# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK )
|
|
|
|
# define SCIF_RFDC_MASK 0x007f
|
|
|
|
# define SCIF_TXROOM_MAX 64
|
|
|
|
/* SH7763 SCIF2 support */
|
|
|
|
# define SCIF2_RFDC_MASK 0x001f
|
|
|
|
# define SCIF2_TXROOM_MAX 16
|
2005-04-16 22:20:36 +00:00
|
|
|
#else
|
2008-06-06 08:04:08 +00:00
|
|
|
# define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)
|
|
|
|
# define SCIF_RFDC_MASK 0x001f
|
|
|
|
# define SCIF_TXROOM_MAX 16
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
|
|
|
|
2008-12-16 10:29:38 +00:00
|
|
|
#ifndef SCIF_ORER
|
|
|
|
#define SCIF_ORER 0x0000
|
|
|
|
#endif
|
|
|
|
|
2008-10-02 10:47:12 +00:00
|
|
|
#define SCxSR_TEND(port) (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND)
|
|
|
|
#define SCxSR_ERRORS(port) (((port)->type == PORT_SCI) ? SCI_ERRORS : SCIF_ERRORS)
|
|
|
|
#define SCxSR_RDxF(port) (((port)->type == PORT_SCI) ? SCI_RDRF : SCIF_RDF)
|
|
|
|
#define SCxSR_TDxE(port) (((port)->type == PORT_SCI) ? SCI_TDRE : SCIF_TDFE)
|
|
|
|
#define SCxSR_FER(port) (((port)->type == PORT_SCI) ? SCI_FER : SCIF_FER)
|
|
|
|
#define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER)
|
|
|
|
#define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK)
|
2008-12-16 10:29:38 +00:00
|
|
|
#define SCxSR_ORER(port) (((port)->type == PORT_SCI) ? SCI_ORER : SCIF_ORER)
|
2008-10-02 10:47:12 +00:00
|
|
|
|
2007-08-19 23:59:33 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
|
2007-12-26 02:45:06 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7720) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7721)
|
2008-10-02 10:47:12 +00:00
|
|
|
# define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc)
|
|
|
|
# define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73)
|
|
|
|
# define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf)
|
|
|
|
# define SCxSR_BREAK_CLEAR(port) (sci_in(port, SCxSR) & 0xffe3)
|
2005-04-16 22:20:36 +00:00
|
|
|
#else
|
|
|
|
# define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc)
|
|
|
|
# define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073)
|
|
|
|
# define SCxSR_TDxE_CLEAR(port) (((port)->type == PORT_SCI) ? 0x78 : 0x00df)
|
|
|
|
# define SCxSR_BREAK_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x00e3)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* SCFCR */
|
|
|
|
#define SCFCR_RFRST 0x0002
|
|
|
|
#define SCFCR_TFRST 0x0004
|
|
|
|
#define SCFCR_TCRST 0x4000
|
|
|
|
#define SCFCR_MCE 0x0008
|
|
|
|
|
|
|
|
#define SCI_MAJOR 204
|
|
|
|
#define SCI_MINOR_START 8
|
|
|
|
|
|
|
|
/* Generic serial flags */
|
|
|
|
#define SCI_RX_THROTTLE 0x0000001
|
|
|
|
|
|
|
|
#define SCI_MAGIC 0xbabeface
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Events are used to schedule things to happen at timer-interrupt
|
|
|
|
* time, instead of at rs interrupt time.
|
|
|
|
*/
|
|
|
|
#define SCI_EVENT_WRITE_WAKEUP 0
|
|
|
|
|
|
|
|
#define SCI_IN(size, offset) \
|
2006-02-01 11:06:06 +00:00
|
|
|
if ((size) == 8) { \
|
2008-10-01 06:46:58 +00:00
|
|
|
return ioread8(port->membase + (offset)); \
|
2006-02-01 11:06:06 +00:00
|
|
|
} else { \
|
2008-10-01 06:46:58 +00:00
|
|
|
return ioread16(port->membase + (offset)); \
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
#define SCI_OUT(size, offset, value) \
|
2006-02-01 11:06:06 +00:00
|
|
|
if ((size) == 8) { \
|
2008-10-01 06:46:58 +00:00
|
|
|
iowrite8(value, port->membase + (offset)); \
|
2008-04-23 12:37:39 +00:00
|
|
|
} else if ((size) == 16) { \
|
2008-10-01 06:46:58 +00:00
|
|
|
iowrite16(value, port->membase + (offset)); \
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\
|
|
|
|
static inline unsigned int sci_##name##_in(struct uart_port *port) \
|
|
|
|
{ \
|
2008-11-11 03:19:05 +00:00
|
|
|
if (port->type == PORT_SCIF) { \
|
|
|
|
SCI_IN(scif_size, scif_offset) \
|
|
|
|
} else { /* PORT_SCI or PORT_SCIFA */ \
|
|
|
|
SCI_IN(sci_size, sci_offset); \
|
2005-04-16 22:20:36 +00:00
|
|
|
} \
|
|
|
|
} \
|
|
|
|
static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
|
|
|
|
{ \
|
2008-11-11 03:19:05 +00:00
|
|
|
if (port->type == PORT_SCIF) { \
|
|
|
|
SCI_OUT(scif_size, scif_offset, value) \
|
|
|
|
} else { /* PORT_SCI or PORT_SCIFA */ \
|
|
|
|
SCI_OUT(sci_size, sci_offset, value); \
|
2005-04-16 22:20:36 +00:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2009-04-28 04:40:15 +00:00
|
|
|
#ifdef CONFIG_H8300
|
|
|
|
/* h8300 don't have SCIF */
|
|
|
|
#define CPU_SCIF_FNS(name) \
|
|
|
|
static inline unsigned int sci_##name##_in(struct uart_port *port) \
|
|
|
|
{ \
|
|
|
|
return 0; \
|
|
|
|
} \
|
|
|
|
static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
|
|
|
|
{ \
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define CPU_SCIF_FNS(name, scif_offset, scif_size) \
|
2005-04-16 22:20:36 +00:00
|
|
|
static inline unsigned int sci_##name##_in(struct uart_port *port) \
|
|
|
|
{ \
|
2006-02-01 11:06:06 +00:00
|
|
|
SCI_IN(scif_size, scif_offset); \
|
2005-04-16 22:20:36 +00:00
|
|
|
} \
|
|
|
|
static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \
|
|
|
|
{ \
|
|
|
|
SCI_OUT(scif_size, scif_offset, value); \
|
|
|
|
}
|
2009-04-28 04:40:15 +00:00
|
|
|
#endif
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#define CPU_SCI_FNS(name, sci_offset, sci_size) \
|
|
|
|
static inline unsigned int sci_##name##_in(struct uart_port* port) \
|
|
|
|
{ \
|
2006-02-01 11:06:06 +00:00
|
|
|
SCI_IN(sci_size, sci_offset); \
|
2005-04-16 22:20:36 +00:00
|
|
|
} \
|
|
|
|
static inline void sci_##name##_out(struct uart_port* port, unsigned int value) \
|
|
|
|
{ \
|
|
|
|
SCI_OUT(sci_size, sci_offset, value); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_CPU_SH3
|
2007-03-27 09:13:51 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
|
|
|
|
#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
|
|
|
|
sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
|
|
|
|
h8_sci_offset, h8_sci_size) \
|
|
|
|
CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
|
|
|
|
#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
|
|
|
|
CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
|
2007-08-19 23:59:33 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
|
2007-12-26 02:45:06 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7720) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7721)
|
2005-04-16 22:20:36 +00:00
|
|
|
#define SCIF_FNS(name, scif_offset, scif_size) \
|
|
|
|
CPU_SCIF_FNS(name, scif_offset, scif_size)
|
|
|
|
#else
|
|
|
|
#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
|
|
|
|
sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
|
|
|
|
h8_sci_offset, h8_sci_size) \
|
|
|
|
CPU_SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh3_scif_offset, sh3_scif_size)
|
|
|
|
#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
|
|
|
|
CPU_SCIF_FNS(name, sh3_scif_offset, sh3_scif_size)
|
|
|
|
#endif
|
|
|
|
#elif defined(__H8300H__) || defined(__H8300S__)
|
|
|
|
#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
|
|
|
|
sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
|
|
|
|
h8_sci_offset, h8_sci_size) \
|
|
|
|
CPU_SCI_FNS(name, h8_sci_offset, h8_sci_size)
|
2009-04-28 04:40:15 +00:00
|
|
|
#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
|
|
|
|
CPU_SCIF_FNS(name)
|
2009-04-15 02:42:47 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7724)
|
2008-04-09 08:56:18 +00:00
|
|
|
#define SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scif_offset, sh4_scif_size) \
|
|
|
|
CPU_SCIx_FNS(name, sh4_scifa_offset, sh4_scifa_size, sh4_scif_offset, sh4_scif_size)
|
|
|
|
#define SCIF_FNS(name, sh4_scif_offset, sh4_scif_size) \
|
|
|
|
CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
|
2005-04-16 22:20:36 +00:00
|
|
|
#else
|
|
|
|
#define SCIx_FNS(name, sh3_sci_offset, sh3_sci_size, sh4_sci_offset, sh4_sci_size, \
|
|
|
|
sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size, \
|
|
|
|
h8_sci_offset, h8_sci_size) \
|
|
|
|
CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
|
|
|
|
#define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
|
|
|
|
CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
|
|
|
|
#endif
|
|
|
|
|
2007-08-19 23:59:33 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
|
2007-12-26 02:45:06 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7720) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7721)
|
2007-03-27 09:13:51 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
SCIF_FNS(SCSMR, 0x00, 16)
|
|
|
|
SCIF_FNS(SCBRR, 0x04, 8)
|
|
|
|
SCIF_FNS(SCSCR, 0x08, 16)
|
|
|
|
SCIF_FNS(SCTDSR, 0x0c, 8)
|
|
|
|
SCIF_FNS(SCFER, 0x10, 16)
|
|
|
|
SCIF_FNS(SCxSR, 0x14, 16)
|
|
|
|
SCIF_FNS(SCFCR, 0x18, 16)
|
|
|
|
SCIF_FNS(SCFDR, 0x1c, 16)
|
|
|
|
SCIF_FNS(SCxTDR, 0x20, 8)
|
|
|
|
SCIF_FNS(SCxRDR, 0x24, 8)
|
|
|
|
SCIF_FNS(SCLSR, 0x24, 16)
|
2009-04-15 02:42:47 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7724)
|
2008-04-09 08:56:18 +00:00
|
|
|
SCIx_FNS(SCSMR, 0x00, 16, 0x00, 16)
|
|
|
|
SCIx_FNS(SCBRR, 0x04, 8, 0x04, 8)
|
|
|
|
SCIx_FNS(SCSCR, 0x08, 16, 0x08, 16)
|
|
|
|
SCIx_FNS(SCxTDR, 0x20, 8, 0x0c, 8)
|
|
|
|
SCIx_FNS(SCxSR, 0x14, 16, 0x10, 16)
|
|
|
|
SCIx_FNS(SCxRDR, 0x24, 8, 0x14, 8)
|
2009-01-20 03:18:22 +00:00
|
|
|
SCIx_FNS(SCSPTR, 0, 0, 0, 0)
|
2008-04-09 08:56:18 +00:00
|
|
|
SCIF_FNS(SCTDSR, 0x0c, 8)
|
|
|
|
SCIF_FNS(SCFER, 0x10, 16)
|
|
|
|
SCIF_FNS(SCFCR, 0x18, 16)
|
|
|
|
SCIF_FNS(SCFDR, 0x1c, 16)
|
|
|
|
SCIF_FNS(SCLSR, 0x24, 16)
|
2005-04-16 22:20:36 +00:00
|
|
|
#else
|
|
|
|
/* reg SCI/SH3 SCI/SH4 SCIF/SH3 SCIF/SH4 SCI/H8*/
|
|
|
|
/* name off sz off sz off sz off sz off sz*/
|
|
|
|
SCIx_FNS(SCSMR, 0x00, 8, 0x00, 8, 0x00, 8, 0x00, 16, 0x00, 8)
|
|
|
|
SCIx_FNS(SCBRR, 0x02, 8, 0x04, 8, 0x02, 8, 0x04, 8, 0x01, 8)
|
|
|
|
SCIx_FNS(SCSCR, 0x04, 8, 0x08, 8, 0x04, 8, 0x08, 16, 0x02, 8)
|
|
|
|
SCIx_FNS(SCxTDR, 0x06, 8, 0x0c, 8, 0x06, 8, 0x0C, 8, 0x03, 8)
|
|
|
|
SCIx_FNS(SCxSR, 0x08, 8, 0x10, 8, 0x08, 16, 0x10, 16, 0x04, 8)
|
|
|
|
SCIx_FNS(SCxRDR, 0x0a, 8, 0x14, 8, 0x0A, 8, 0x14, 8, 0x05, 8)
|
|
|
|
SCIF_FNS(SCFCR, 0x0c, 8, 0x18, 16)
|
2007-03-12 05:38:59 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7760) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7780) || \
|
2009-03-03 06:40:25 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7785) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7786)
|
2008-07-29 15:56:39 +00:00
|
|
|
SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
|
2006-02-01 11:06:06 +00:00
|
|
|
SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
|
|
|
|
SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
|
|
|
|
SCIF_FNS(SCSPTR, 0, 0, 0x24, 16)
|
|
|
|
SCIF_FNS(SCLSR, 0, 0, 0x28, 16)
|
2008-07-29 15:56:39 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
|
2008-06-06 08:04:08 +00:00
|
|
|
SCIF_FNS(SCFDR, 0, 0, 0x1C, 16)
|
|
|
|
SCIF_FNS(SCSPTR2, 0, 0, 0x20, 16)
|
2008-07-29 15:56:39 +00:00
|
|
|
SCIF_FNS(SCLSR2, 0, 0, 0x24, 16)
|
|
|
|
SCIF_FNS(SCTFDR, 0x0e, 16, 0x1C, 16)
|
|
|
|
SCIF_FNS(SCRFDR, 0x0e, 16, 0x20, 16)
|
|
|
|
SCIF_FNS(SCSPTR, 0, 0, 0x24, 16)
|
|
|
|
SCIF_FNS(SCLSR, 0, 0, 0x28, 16)
|
2006-02-01 11:06:06 +00:00
|
|
|
#else
|
2005-04-16 22:20:36 +00:00
|
|
|
SCIF_FNS(SCFDR, 0x0e, 16, 0x1C, 16)
|
2008-04-23 12:31:14 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7722)
|
|
|
|
SCIF_FNS(SCSPTR, 0, 0, 0, 0)
|
|
|
|
#else
|
2005-04-16 22:20:36 +00:00
|
|
|
SCIF_FNS(SCSPTR, 0, 0, 0x20, 16)
|
2008-04-23 12:31:14 +00:00
|
|
|
#endif
|
2005-04-16 22:20:36 +00:00
|
|
|
SCIF_FNS(SCLSR, 0, 0, 0x24, 16)
|
|
|
|
#endif
|
2006-02-01 11:06:06 +00:00
|
|
|
#endif
|
2005-04-16 22:20:36 +00:00
|
|
|
#define sci_in(port, reg) sci_##reg##_in(port)
|
|
|
|
#define sci_out(port, reg, value) sci_##reg##_out(port, value)
|
|
|
|
|
|
|
|
/* H8/300 series SCI pins assignment */
|
|
|
|
#if defined(__H8300H__) || defined(__H8300S__)
|
|
|
|
static const struct __attribute__((packed)) {
|
|
|
|
int port; /* GPIO port no */
|
|
|
|
unsigned short rx,tx; /* GPIO bit no */
|
|
|
|
} h8300_sci_pins[] = {
|
|
|
|
#if defined(CONFIG_H83007) || defined(CONFIG_H83068)
|
|
|
|
{ /* SCI0 */
|
|
|
|
.port = H8300_GPIO_P9,
|
|
|
|
.rx = H8300_GPIO_B2,
|
|
|
|
.tx = H8300_GPIO_B0,
|
|
|
|
},
|
|
|
|
{ /* SCI1 */
|
|
|
|
.port = H8300_GPIO_P9,
|
|
|
|
.rx = H8300_GPIO_B3,
|
|
|
|
.tx = H8300_GPIO_B1,
|
|
|
|
},
|
|
|
|
{ /* SCI2 */
|
|
|
|
.port = H8300_GPIO_PB,
|
|
|
|
.rx = H8300_GPIO_B7,
|
|
|
|
.tx = H8300_GPIO_B6,
|
|
|
|
}
|
|
|
|
#elif defined(CONFIG_H8S2678)
|
|
|
|
{ /* SCI0 */
|
|
|
|
.port = H8300_GPIO_P3,
|
|
|
|
.rx = H8300_GPIO_B2,
|
|
|
|
.tx = H8300_GPIO_B0,
|
|
|
|
},
|
|
|
|
{ /* SCI1 */
|
|
|
|
.port = H8300_GPIO_P3,
|
|
|
|
.rx = H8300_GPIO_B3,
|
|
|
|
.tx = H8300_GPIO_B1,
|
|
|
|
},
|
|
|
|
{ /* SCI2 */
|
|
|
|
.port = H8300_GPIO_P5,
|
|
|
|
.rx = H8300_GPIO_B1,
|
|
|
|
.tx = H8300_GPIO_B0,
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2007-07-26 01:14:16 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7707) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7708) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7709)
|
2005-04-16 22:20:36 +00:00
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xfffffe80)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCPDR)&0x01 ? 1 : 0; /* SCI */
|
2005-04-16 22:20:36 +00:00
|
|
|
if (port->mapbase == 0xa4000150)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
|
2005-04-16 22:20:36 +00:00
|
|
|
if (port->mapbase == 0xa4000140)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCPDR)&0x04 ? 1 : 0; /* IRDA */
|
2005-04-16 22:20:36 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == SCIF0)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCPDR)&0x04 ? 1 : 0; /* IRDA */
|
2005-04-16 22:20:36 +00:00
|
|
|
if (port->mapbase == SCIF2)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCPDR)&0x10 ? 1 : 0; /* SCIF */
|
2005-04-16 22:20:36 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2007-03-27 09:13:51 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
|
2006-09-27 07:32:13 +00:00
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
2007-03-27 09:13:51 +00:00
|
|
|
return sci_in(port,SCxSR)&0x0010 ? 1 : 0;
|
|
|
|
}
|
2007-12-26 02:45:06 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7720) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7721)
|
2007-08-19 23:59:33 +00:00
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xa4430000)
|
|
|
|
return sci_in(port, SCxSR) & 0x0003 ? 1 : 0;
|
|
|
|
else if (port->mapbase == 0xa4438000)
|
|
|
|
return sci_in(port, SCxSR) & 0x0003 ? 1 : 0;
|
|
|
|
return 1;
|
|
|
|
}
|
2007-05-15 07:25:47 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7751) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
|
2008-10-29 04:33:45 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7091)
|
2005-04-16 22:20:36 +00:00
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffe00000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCSPTR1)&0x01 ? 1 : 0; /* SCI */
|
2005-04-16 22:20:36 +00:00
|
|
|
if (port->mapbase == 0xffe80000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
|
2005-04-16 22:20:36 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2008-10-29 04:33:45 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH4_202)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffe80000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2)&0x0001 ? 1 : 0; /* SCIF */
|
2008-10-29 04:33:45 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2009-08-21 07:30:28 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7757)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xfe4b0000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0;
|
2009-08-21 07:30:28 +00:00
|
|
|
if (port->mapbase == 0xfe4c0000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0;
|
2009-08-21 07:30:28 +00:00
|
|
|
if (port->mapbase == 0xfe4d0000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0;
|
2009-08-21 07:30:28 +00:00
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xfe600000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2005-04-16 22:20:36 +00:00
|
|
|
if (port->mapbase == 0xfe610000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2005-04-16 22:20:36 +00:00
|
|
|
if (port->mapbase == 0xfe620000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-12-08 05:26:19 +00:00
|
|
|
return 1;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2006-09-27 07:32:13 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7343)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffe00000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-09-27 07:32:13 +00:00
|
|
|
if (port->mapbase == 0xffe10000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-09-27 07:32:13 +00:00
|
|
|
if (port->mapbase == 0xffe20000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-09-27 07:32:13 +00:00
|
|
|
if (port->mapbase == 0xffe30000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-09-27 07:32:13 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2008-04-23 12:25:29 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7366)
|
2006-12-11 11:28:03 +00:00
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffe00000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCPDR0) & 0x0001 ? 1 : 0; /* SCIF0 */
|
2006-12-11 11:28:03 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2008-04-23 12:25:29 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7722)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffe00000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(PSDR) & 0x02 ? 1 : 0; /* SCIF0 */
|
2008-04-23 12:25:29 +00:00
|
|
|
if (port->mapbase == 0xffe10000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(PADR) & 0x40 ? 1 : 0; /* SCIF1 */
|
2008-04-23 12:25:29 +00:00
|
|
|
if (port->mapbase == 0xffe20000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(PWDR) & 0x04 ? 1 : 0; /* SCIF2 */
|
2008-04-23 12:25:29 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
2008-04-09 08:56:18 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7723)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffe00000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCSPTR0) & 0x0008 ? 1 : 0; /* SCIF0 */
|
2008-04-09 08:56:18 +00:00
|
|
|
if (port->mapbase == 0xffe10000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCSPTR1) & 0x0020 ? 1 : 0; /* SCIF1 */
|
2008-04-09 08:56:18 +00:00
|
|
|
if (port->mapbase == 0xffe20000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF2 */
|
2008-04-09 08:56:18 +00:00
|
|
|
if (port->mapbase == 0xa4e30000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF3 */
|
2008-04-09 08:56:18 +00:00
|
|
|
if (port->mapbase == 0xa4e40000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF4 */
|
2008-04-09 08:56:18 +00:00
|
|
|
if (port->mapbase == 0xa4e50000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readb(SCSPTR5) & 0x0008 ? 1 : 0; /* SCIF5 */
|
2008-04-09 08:56:18 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2009-04-15 02:42:47 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7724)
|
|
|
|
# define SCFSR 0x0010
|
|
|
|
# define SCASSR 0x0014
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->type == PORT_SCIF)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw((port->mapbase + SCFSR)) & SCIF_BRK ? 1 : 0;
|
2009-04-15 02:42:47 +00:00
|
|
|
if (port->type == PORT_SCIFA)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw((port->mapbase + SCASSR)) & SCIF_BRK ? 1 : 0;
|
2009-04-15 02:42:47 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH5_101) || defined(CONFIG_CPU_SUBTYPE_SH5_103)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
2009-05-09 05:31:37 +00:00
|
|
|
return sci_in(port, SCSPTR)&0x0001 ? 1 : 0; /* SCIF */
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
#elif defined(__H8300H__) || defined(__H8300S__)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
int ch = (port->mapbase - SMR0) >> 3;
|
|
|
|
return (H8300_SCI_DR(ch) & h8300_sci_pins[ch].rx) ? 1 : 0;
|
|
|
|
}
|
2008-01-07 05:40:07 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7763)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffe00000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2008-01-07 05:40:07 +00:00
|
|
|
if (port->mapbase == 0xffe08000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2008-06-06 08:04:08 +00:00
|
|
|
if (port->mapbase == 0xffe10000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF/IRDA */
|
2008-06-06 08:04:08 +00:00
|
|
|
|
2008-01-07 05:40:07 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2006-02-01 11:06:06 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7770)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xff923000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-02-01 11:06:06 +00:00
|
|
|
if (port->mapbase == 0xff924000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-02-01 11:06:06 +00:00
|
|
|
if (port->mapbase == 0xff925000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-12-08 05:26:19 +00:00
|
|
|
return 1;
|
2006-02-01 11:06:06 +00:00
|
|
|
}
|
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffe00000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-02-01 11:06:06 +00:00
|
|
|
if (port->mapbase == 0xffe10000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-12-08 05:26:19 +00:00
|
|
|
return 1;
|
2006-02-01 11:06:06 +00:00
|
|
|
}
|
2009-03-03 06:40:25 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7785) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7786)
|
2007-03-12 05:38:59 +00:00
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffea0000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-03-12 05:38:59 +00:00
|
|
|
if (port->mapbase == 0xffeb0000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-03-12 05:38:59 +00:00
|
|
|
if (port->mapbase == 0xffec0000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-03-12 05:38:59 +00:00
|
|
|
if (port->mapbase == 0xffed0000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-03-12 05:38:59 +00:00
|
|
|
if (port->mapbase == 0xffee0000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR4) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-03-12 05:38:59 +00:00
|
|
|
if (port->mapbase == 0xffef0000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR5) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-03-12 05:38:59 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2008-11-28 13:48:20 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7201) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7203) || \
|
2007-11-26 10:54:02 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7206) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7263)
|
2006-11-05 06:40:13 +00:00
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xfffe8000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-11-05 06:40:13 +00:00
|
|
|
if (port->mapbase == 0xfffe8800)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-11-05 06:40:13 +00:00
|
|
|
if (port->mapbase == 0xfffe9000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-11-05 06:40:13 +00:00
|
|
|
if (port->mapbase == 0xfffe9800)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
|
2008-11-28 13:48:20 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7201)
|
|
|
|
if (port->mapbase == 0xfffeA000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2008-11-28 13:48:20 +00:00
|
|
|
if (port->mapbase == 0xfffeA800)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2008-11-28 13:48:20 +00:00
|
|
|
if (port->mapbase == 0xfffeB000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
|
2008-11-28 13:48:20 +00:00
|
|
|
if (port->mapbase == 0xfffeB800)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
|
2008-11-28 13:48:20 +00:00
|
|
|
#endif
|
2006-12-08 05:26:19 +00:00
|
|
|
return 1;
|
2006-11-05 06:40:13 +00:00
|
|
|
}
|
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7619)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xf8400000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-11-05 06:40:13 +00:00
|
|
|
if (port->mapbase == 0xf8410000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-11-05 06:40:13 +00:00
|
|
|
if (port->mapbase == 0xf8420000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
|
2006-12-08 05:26:19 +00:00
|
|
|
return 1;
|
2006-11-05 06:40:13 +00:00
|
|
|
}
|
2007-06-20 09:27:10 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
|
|
|
|
static inline int sci_rxd_in(struct uart_port *port)
|
|
|
|
{
|
|
|
|
if (port->mapbase == 0xffc30000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-06-20 09:27:10 +00:00
|
|
|
if (port->mapbase == 0xffc40000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-06-20 09:27:10 +00:00
|
|
|
if (port->mapbase == 0xffc50000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-06-20 09:27:10 +00:00
|
|
|
if (port->mapbase == 0xffc60000)
|
2009-12-24 05:52:43 +00:00
|
|
|
return __raw_readw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
|
2007-08-08 07:57:05 +00:00
|
|
|
return 1;
|
2007-06-20 09:27:10 +00:00
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Values for the BitRate Register (SCBRR)
|
|
|
|
*
|
|
|
|
* The values are actually divisors for a frequency which can
|
|
|
|
* be internal to the SH3 (14.7456MHz) or derived from an external
|
|
|
|
* clock source. This driver assumes the internal clock is used;
|
|
|
|
* to support using an external clock source, config options or
|
|
|
|
* possibly command-line options would need to be added.
|
|
|
|
*
|
|
|
|
* Also, to support speeds below 2400 (why?) the lower 2 bits of
|
|
|
|
* the SCSMR register would also need to be set to non-zero values.
|
|
|
|
*
|
|
|
|
* -- Greg Banks 27Feb2000
|
|
|
|
*
|
|
|
|
* Answer: The SCBRR register is only eight bits, and the value in
|
|
|
|
* it gets larger with lower baud rates. At around 2400 (depending on
|
|
|
|
* the peripherial module clock) you run out of bits. However the
|
|
|
|
* lower two bits of SCSMR allow the module clock to be divided down,
|
|
|
|
* scaling the value which is needed in SCBRR.
|
|
|
|
*
|
|
|
|
* -- Stuart Menefy - 23 May 2000
|
|
|
|
*
|
|
|
|
* I meant, why would anyone bother with bitrates below 2400.
|
|
|
|
*
|
|
|
|
* -- Greg Banks - 7Jul2000
|
|
|
|
*
|
|
|
|
* You "speedist"! How will I use my 110bps ASR-33 teletype with paper
|
|
|
|
* tape reader as a console!
|
|
|
|
*
|
|
|
|
* -- Mitch Davis - 15 Jul 2000
|
|
|
|
*/
|
|
|
|
|
2008-06-06 08:04:08 +00:00
|
|
|
#if defined(CONFIG_CPU_SUBTYPE_SH7780) || \
|
2009-03-03 06:40:25 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7785) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7786)
|
2006-02-01 11:06:06 +00:00
|
|
|
#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
|
2007-08-19 23:59:33 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7705) || \
|
2007-12-26 02:45:06 +00:00
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7720) || \
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7721)
|
2006-02-01 11:06:06 +00:00
|
|
|
#define SCBRR_VALUE(bps, clk) (((clk*2)+16*bps)/(32*bps)-1)
|
2009-04-15 02:42:47 +00:00
|
|
|
#elif defined(CONFIG_CPU_SUBTYPE_SH7723) ||\
|
|
|
|
defined(CONFIG_CPU_SUBTYPE_SH7724)
|
2008-10-03 08:37:31 +00:00
|
|
|
static inline int scbrr_calc(struct uart_port *port, int bps, int clk)
|
|
|
|
{
|
|
|
|
if (port->type == PORT_SCIF)
|
|
|
|
return (clk+16*bps)/(32*bps)-1;
|
|
|
|
else
|
|
|
|
return ((clk*2)+16*bps)/(16*bps)-1;
|
|
|
|
}
|
|
|
|
#define SCBRR_VALUE(bps, clk) scbrr_calc(port, bps, clk)
|
2006-02-01 11:06:06 +00:00
|
|
|
#elif defined(__H8300H__) || defined(__H8300S__)
|
2008-10-02 10:09:13 +00:00
|
|
|
#define SCBRR_VALUE(bps, clk) (((clk*1000/32)/bps)-1)
|
2006-02-01 11:06:06 +00:00
|
|
|
#else /* Generic SH */
|
|
|
|
#define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(32*bps)-1)
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif
|