blob: a2afc9fbe1869369d3d8c3165091ab3e9f73c46f [file] [log] [blame]
Paul Mundt96de1a82008-02-26 14:52:45 +09001#ifndef __LINUX_SERIAL_SCI_H
2#define __LINUX_SERIAL_SCI_H
Paul Mundtecd95612006-09-27 17:32:30 +09003
4#include <linux/serial_core.h>
Paul Mundt14baf9d2010-05-24 16:31:08 +09005#include <linux/sh_dma.h>
Paul Mundtecd95612006-09-27 17:32:30 +09006
7/*
Paul Mundt96de1a82008-02-26 14:52:45 +09008 * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts)
Paul Mundtecd95612006-09-27 17:32:30 +09009 */
10
Paul Mundt26c92f32009-06-24 18:23:52 +090011enum {
12 SCBRR_ALGO_1, /* ((clk + 16 * bps) / (16 * bps) - 1) */
13 SCBRR_ALGO_2, /* ((clk + 16 * bps) / (32 * bps) - 1) */
14 SCBRR_ALGO_3, /* (((clk * 2) + 16 * bps) / (16 * bps) - 1) */
15 SCBRR_ALGO_4, /* (((clk * 2) + 16 * bps) / (32 * bps) - 1) */
16 SCBRR_ALGO_5, /* (((clk * 1000 / 32) / bps) - 1) */
17};
18
Paul Mundt00b9de92009-06-24 17:53:33 +090019#define SCSCR_TIE (1 << 7)
20#define SCSCR_RIE (1 << 6)
21#define SCSCR_TE (1 << 5)
22#define SCSCR_RE (1 << 4)
Paul Mundtf43dc232011-01-13 15:06:28 +090023#define SCSCR_REIE (1 << 3) /* not supported by all parts */
Paul Mundt00b9de92009-06-24 17:53:33 +090024#define SCSCR_TOIE (1 << 2) /* not supported by all parts */
25#define SCSCR_CKE1 (1 << 1)
26#define SCSCR_CKE0 (1 << 0)
27
Paul Mundtecd95612006-09-27 17:32:30 +090028/* Offsets into the sci_port->irqs array */
29enum {
30 SCIx_ERI_IRQ,
31 SCIx_RXI_IRQ,
32 SCIx_TXI_IRQ,
33 SCIx_BRI_IRQ,
34 SCIx_NR_IRQS,
35};
36
Paul Mundt22cc8372011-01-19 14:37:14 +090037#define SCIx_IRQ_MUXED(irq) \
38{ \
39 [SCIx_ERI_IRQ] = (irq), \
40 [SCIx_RXI_IRQ] = (irq), \
41 [SCIx_TXI_IRQ] = (irq), \
42 [SCIx_BRI_IRQ] = (irq), \
43}
44
Guennadi Liakhovetski73a19e42010-03-02 11:39:15 +090045struct device;
46
Paul Mundtecd95612006-09-27 17:32:30 +090047/*
48 * Platform device specific platform_data struct
49 */
50struct plat_sci_port {
Paul Mundtecd95612006-09-27 17:32:30 +090051 unsigned long mapbase; /* resource base */
52 unsigned int irqs[SCIx_NR_IRQS]; /* ERI, RXI, TXI, BRI */
53 unsigned int type; /* SCI / SCIF / IRDA */
54 upf_t flags; /* UPF_* flags */
Paul Mundt00b9de92009-06-24 17:53:33 +090055
Paul Mundt26c92f32009-06-24 18:23:52 +090056 unsigned int scbrr_algo_id; /* SCBRR calculation algo */
Paul Mundt00b9de92009-06-24 17:53:33 +090057 unsigned int scscr; /* SCSCR initialization */
Paul Mundtf43dc232011-01-13 15:06:28 +090058
Guennadi Liakhovetski73a19e42010-03-02 11:39:15 +090059 struct device *dma_dev;
Paul Mundtf43dc232011-01-13 15:06:28 +090060
Paul Mundt27bd1072011-01-19 15:37:31 +090061 unsigned int dma_slave_tx;
62 unsigned int dma_slave_rx;
Paul Mundtecd95612006-09-27 17:32:30 +090063};
64
Paul Mundt96de1a82008-02-26 14:52:45 +090065#endif /* __LINUX_SERIAL_SCI_H */