blob: 5aca7364634c10f35c6dcb88d2ff100f9f3c84be [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) || \
Kuninori Morimoto6c01ba42011-11-10 18:45:52 -080018 defined(CONFIG_ARCH_SH7372) || \
19 defined(CONFIG_ARCH_R8A7740)
20
Paul Mundtb12bb292012-03-30 19:50:15 +090021# define SCxSR_RDxF_CLEAR(port) (serial_port_in(port, SCxSR) & 0xfffc)
22# define SCxSR_ERROR_CLEAR(port) (serial_port_in(port, SCxSR) & 0xfd73)
23# define SCxSR_TDxE_CLEAR(port) (serial_port_in(port, SCxSR) & 0xffdf)
24# define SCxSR_BREAK_CLEAR(port) (serial_port_in(port, SCxSR) & 0xffe3)
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#else
Linus Torvalds1da177e2005-04-16 15:20:36 -070026# define SCxSR_RDxF_CLEAR(port) (((port)->type == PORT_SCI) ? 0xbc : 0x00fc)
27# define SCxSR_ERROR_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x0073)
28# define SCxSR_TDxE_CLEAR(port) (((port)->type == PORT_SCI) ? 0x78 : 0x00df)
29# define SCxSR_BREAK_CLEAR(port) (((port)->type == PORT_SCI) ? 0xc4 : 0x00e3)
30#endif
31
32/* SCFCR */
33#define SCFCR_RFRST 0x0002
34#define SCFCR_TFRST 0x0004
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#define SCFCR_MCE 0x0008
36
37#define SCI_MAJOR 204
38#define SCI_MINOR_START 8