serial_sci.h 2.5 KB
Newer Older
1 2
#ifndef __LINUX_SERIAL_SCI_H
#define __LINUX_SERIAL_SCI_H
3 4

#include <linux/serial_core.h>
5
#include <linux/sh_dma.h>
6 7

/*
8
 * Generic header for SuperH (H)SCI(F) (used by sh/sh64 and related parts)
9 10
 */

11 12
#define SCIx_NOT_SUPPORTED	(-1)

13 14 15 16
#define SCSCR_TIE	(1 << 7)
#define SCSCR_RIE	(1 << 6)
#define SCSCR_TE	(1 << 5)
#define SCSCR_RE	(1 << 4)
P
Paul Mundt 已提交
17
#define SCSCR_REIE	(1 << 3)	/* not supported by all parts */
18 19 20 21
#define SCSCR_TOIE	(1 << 2)	/* not supported by all parts */
#define SCSCR_CKE1	(1 << 1)
#define SCSCR_CKE0	(1 << 0)

22 23 24 25 26 27 28 29 30 31
/* SCxSR SCI */
#define SCI_TDRE  0x80
#define SCI_RDRF  0x40
#define SCI_ORER  0x20
#define SCI_FER   0x10
#define SCI_PER   0x08
#define SCI_TEND  0x04

#define SCI_DEFAULT_ERROR_MASK (SCI_PER | SCI_FER)

U
Ulrich Hecht 已提交
32
/* SCxSR SCIF, HSCIF */
33 34 35 36 37 38 39 40 41 42 43
#define SCIF_ER    0x0080
#define SCIF_TEND  0x0040
#define SCIF_TDFE  0x0020
#define SCIF_BRK   0x0010
#define SCIF_FER   0x0008
#define SCIF_PER   0x0004
#define SCIF_RDF   0x0002
#define SCIF_DR    0x0001

#define SCIF_DEFAULT_ERROR_MASK (SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK)

44 45 46
/* SCSPTR, optional */
#define SCSPTR_RTSIO	(1 << 7)
#define SCSPTR_CTSIO	(1 << 5)
47 48
#define SCSPTR_SPB2IO	(1 << 1)
#define SCSPTR_SPB2DT	(1 << 0)
49

U
Ulrich Hecht 已提交
50 51 52
/* HSSRR HSCIF */
#define HSCIF_SRE	0x8000

53 54 55 56 57 58 59
enum {
	SCIx_PROBE_REGTYPE,

	SCIx_SCI_REGTYPE,
	SCIx_IRDA_REGTYPE,
	SCIx_SCIFA_REGTYPE,
	SCIx_SCIFB_REGTYPE,
60
	SCIx_SH2_SCIF_FIFODATA_REGTYPE,
61 62 63 64 65
	SCIx_SH3_SCIF_REGTYPE,
	SCIx_SH4_SCIF_REGTYPE,
	SCIx_SH4_SCIF_NO_SCSPTR_REGTYPE,
	SCIx_SH4_SCIF_FIFODATA_REGTYPE,
	SCIx_SH7705_SCIF_REGTYPE,
U
Ulrich Hecht 已提交
66
	SCIx_HSCIF_REGTYPE,
67 68 69 70 71 72 73 74 75 76 77 78

	SCIx_NR_REGTYPES,
};

/*
 * SCI register subset common for all port types.
 * Not all registers will exist on all parts.
 */
enum {
	SCSMR, SCBRR, SCSCR, SCxSR,
	SCFCR, SCFDR, SCxTDR, SCxRDR,
	SCLSR, SCTFDR, SCRFDR, SCSPTR,
U
Ulrich Hecht 已提交
79
	HSSRR,
80 81 82 83

	SCIx_NR_REGS,
};

84 85
struct device;

86 87 88 89
struct plat_sci_port_ops {
	void (*init_pins)(struct uart_port *, unsigned int cflag);
};

90 91 92 93 94
/*
 * Port-specific capabilities
 */
#define SCIx_HAVE_RTSCTS	(1 << 0)

95 96 97 98
/*
 * Platform device specific platform_data struct
 */
struct plat_sci_port {
U
Ulrich Hecht 已提交
99
	unsigned int	type;			/* SCI / SCIF / IRDA / HSCIF */
100
	upf_t		flags;			/* UPF_* flags */
101
	unsigned long	capabilities;		/* Port features/capabilities */
102

103
	unsigned int	sampling_rate;
104
	unsigned int	scscr;			/* SCSCR initialization */
P
Paul Mundt 已提交
105

106 107 108
	/*
	 * Platform overrides if necessary, defaults otherwise.
	 */
109
	int		port_reg;
110 111 112 113
	unsigned char	regshift;
	unsigned char	regtype;

	struct plat_sci_port_ops	*ops;
114

115 116
	unsigned int	dma_slave_tx;
	unsigned int	dma_slave_rx;
117 118
};

119
#endif /* __LINUX_SERIAL_SCI_H */