blob: a1a2d364f92b6a5fa92e865e4fd91954ce6119dc [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#include <linux/serial_core.h>
Paul Mundtedad1f22009-11-25 16:23:35 +09002#include <linux/io.h>
Magnus Damm69edbba2008-12-25 18:17:34 +09003#include <linux/gpio.h>
Markus Brunner3ea6bc32007-08-20 08:59:33 +09004
Paul Mundt15c73aa2008-10-02 19:47:12 +09005#define SCxSR_TEND(port) (((port)->type == PORT_SCI) ? SCI_TEND : SCIF_TEND)
Paul Mundt15c73aa2008-10-02 19:47:12 +09006#define SCxSR_RDxF(port) (((port)->type == PORT_SCI) ? SCI_RDRF : SCIF_RDF)
7#define SCxSR_TDxE(port) (((port)->type == PORT_SCI) ? SCI_TDRE : SCIF_TDFE)
8#define SCxSR_FER(port) (((port)->type == PORT_SCI) ? SCI_FER : SCIF_FER)
9#define SCxSR_PER(port) (((port)->type == PORT_SCI) ? SCI_PER : SCIF_PER)
10#define SCxSR_BRK(port) (((port)->type == PORT_SCI) ? 0x00 : SCIF_BRK)
Paul Mundtdebf9502011-06-08 18:19:37 +090011
12#define SCxSR_ERRORS(port) (to_sci_port(port)->cfg->error_mask)
Paul Mundt15c73aa2008-10-02 19:47:12 +090013
Markus Brunner3ea6bc32007-08-20 08:59:33 +090014#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
Yoshihiro Shimoda31a49c42007-12-26 11:45:06 +090015 defined(CONFIG_CPU_SUBTYPE_SH7720) || \
Magnus Damm8a77b8d2010-02-05 11:15:33 +000016 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
Magnus Damm6d9598e2010-11-17 10:59:31 +000017 defined(CONFIG_ARCH_SH73A0) || \
Magnus Damm8d099d42010-03-16 11:21:07 +000018 defined(CONFIG_ARCH_SH7367) || \
19 defined(CONFIG_ARCH_SH7377) || \
Kuninori Morimoto6c01ba42011-11-10 18:45:52 -080020 defined(CONFIG_ARCH_SH7372) || \
21 defined(CONFIG_ARCH_R8A7740)
22
Paul Mundt15c73aa2008-10-02 19:47:12 +090023# define SCxSR_RDxF_CLEAR(port) (sci_in(port, SCxSR) & 0xfffc)
24# define SCxSR_ERROR_CLEAR(port) (sci_in(port, SCxSR) & 0xfd73)
25# define SCxSR_TDxE_CLEAR(port) (sci_in(port, SCxSR) & 0xffdf)
26# define SCxSR_BREAK_CLEAR(port) (sci_in(port, SCxSR) & 0xffe3)
Linus Torvalds1da177e2005-04-16 15:20:36 -070027#else
Linus Torvalds1da177e2005-04-16 15:20:36 -070028# define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc)
29# define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073)
30# define SCxSR_TDxE_CLEAR(port) (((port)->type == PORT_SCI) ? 0x78 : 0x00df)
31# define SCxSR_BREAK_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x00e3)
32#endif
33
34/* SCFCR */
35#define SCFCR_RFRST 0x0002
36#define SCFCR_TFRST 0x0004
Linus Torvalds1da177e2005-04-16 15:20:36 -070037#define SCFCR_MCE 0x0008
38
39#define SCI_MAJOR 204
40#define SCI_MINOR_START 8