Paul Mundt | 96de1a8 | 2008-02-26 14:52:45 +0900 | [diff] [blame] | 1 | #ifndef __LINUX_SERIAL_SCI_H |
| 2 | #define __LINUX_SERIAL_SCI_H |
Paul Mundt | ecd9561 | 2006-09-27 17:32:30 +0900 | [diff] [blame] | 3 | |
| 4 | #include <linux/serial_core.h> |
Paul Mundt | 14baf9d | 2010-05-24 16:31:08 +0900 | [diff] [blame] | 5 | #include <linux/sh_dma.h> |
Paul Mundt | ecd9561 | 2006-09-27 17:32:30 +0900 | [diff] [blame] | 6 | |
| 7 | /* |
Paul Mundt | 96de1a8 | 2008-02-26 14:52:45 +0900 | [diff] [blame] | 8 | * Generic header for SuperH SCI(F) (used by sh/sh64/h8300 and related parts) |
Paul Mundt | ecd9561 | 2006-09-27 17:32:30 +0900 | [diff] [blame] | 9 | */ |
| 10 | |
Paul Mundt | 26c92f3 | 2009-06-24 18:23:52 +0900 | [diff] [blame] | 11 | enum { |
| 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 Mundt | 00b9de9 | 2009-06-24 17:53:33 +0900 | [diff] [blame] | 19 | #define SCSCR_TIE (1 << 7) |
| 20 | #define SCSCR_RIE (1 << 6) |
| 21 | #define SCSCR_TE (1 << 5) |
| 22 | #define SCSCR_RE (1 << 4) |
Paul Mundt | f43dc23 | 2011-01-13 15:06:28 +0900 | [diff] [blame] | 23 | #define SCSCR_REIE (1 << 3) /* not supported by all parts */ |
Paul Mundt | 00b9de9 | 2009-06-24 17:53:33 +0900 | [diff] [blame] | 24 | #define SCSCR_TOIE (1 << 2) /* not supported by all parts */ |
| 25 | #define SCSCR_CKE1 (1 << 1) |
| 26 | #define SCSCR_CKE0 (1 << 0) |
| 27 | |
Paul Mundt | ecd9561 | 2006-09-27 17:32:30 +0900 | [diff] [blame] | 28 | /* Offsets into the sci_port->irqs array */ |
| 29 | enum { |
| 30 | SCIx_ERI_IRQ, |
| 31 | SCIx_RXI_IRQ, |
| 32 | SCIx_TXI_IRQ, |
| 33 | SCIx_BRI_IRQ, |
| 34 | SCIx_NR_IRQS, |
| 35 | }; |
| 36 | |
Paul Mundt | 22cc837 | 2011-01-19 14:37:14 +0900 | [diff] [blame] | 37 | #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 Liakhovetski | 73a19e4 | 2010-03-02 11:39:15 +0900 | [diff] [blame] | 45 | struct device; |
| 46 | |
Paul Mundt | ecd9561 | 2006-09-27 17:32:30 +0900 | [diff] [blame] | 47 | /* |
| 48 | * Platform device specific platform_data struct |
| 49 | */ |
| 50 | struct plat_sci_port { |
Paul Mundt | ecd9561 | 2006-09-27 17:32:30 +0900 | [diff] [blame] | 51 | 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 Mundt | 00b9de9 | 2009-06-24 17:53:33 +0900 | [diff] [blame] | 55 | |
Paul Mundt | 26c92f3 | 2009-06-24 18:23:52 +0900 | [diff] [blame] | 56 | unsigned int scbrr_algo_id; /* SCBRR calculation algo */ |
Paul Mundt | 00b9de9 | 2009-06-24 17:53:33 +0900 | [diff] [blame] | 57 | unsigned int scscr; /* SCSCR initialization */ |
Paul Mundt | f43dc23 | 2011-01-13 15:06:28 +0900 | [diff] [blame] | 58 | |
Guennadi Liakhovetski | 73a19e4 | 2010-03-02 11:39:15 +0900 | [diff] [blame] | 59 | struct device *dma_dev; |
Paul Mundt | f43dc23 | 2011-01-13 15:06:28 +0900 | [diff] [blame] | 60 | |
Peter Huewe | 04e82ff | 2010-03-10 11:55:05 +0900 | [diff] [blame] | 61 | #ifdef CONFIG_SERIAL_SH_SCI_DMA |
Magnus Damm | 4bab9d4 | 2010-03-19 04:46:38 +0000 | [diff] [blame] | 62 | unsigned int dma_slave_tx; |
| 63 | unsigned int dma_slave_rx; |
Peter Huewe | 04e82ff | 2010-03-10 11:55:05 +0900 | [diff] [blame] | 64 | #endif |
Paul Mundt | ecd9561 | 2006-09-27 17:32:30 +0900 | [diff] [blame] | 65 | }; |
| 66 | |
Paul Mundt | 96de1a8 | 2008-02-26 14:52:45 +0900 | [diff] [blame] | 67 | #endif /* __LINUX_SERIAL_SCI_H */ |