Blame view
include/linux/serial_8250.h
5.91 KB
1da177e4c
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/* * linux/include/linux/serial_8250.h * * Copyright (C) 2004 Russell King * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef _LINUX_SERIAL_8250_H #define _LINUX_SERIAL_8250_H #include <linux/serial_core.h> |
34d2e4584
|
15 |
#include <linux/serial_reg.h> |
d052d1bef
|
16 |
#include <linux/platform_device.h> |
1da177e4c
|
17 |
|
bc49a661e
|
18 19 20 |
/* * This is the platform device platform_data structure */ |
1da177e4c
|
21 22 23 |
struct plat_serial8250_port { unsigned long iobase; /* io base address */ void __iomem *membase; /* ioremap cookie or NULL */ |
4f640efb3
|
24 |
resource_size_t mapbase; /* resource base */ |
1da177e4c
|
25 |
unsigned int irq; /* interrupt number */ |
1c2f04937
|
26 |
unsigned long irqflags; /* request_irq flags */ |
1da177e4c
|
27 |
unsigned int uartclk; /* UART clock rate */ |
74a197417
|
28 |
void *private_data; |
1da177e4c
|
29 30 |
unsigned char regshift; /* register shift */ unsigned char iotype; /* UPIO_* */ |
ec9f47cd6
|
31 |
unsigned char hub6; |
0077d45e4
|
32 |
upf_t flags; /* UPF_* flags */ |
8e23fcc89
|
33 |
unsigned int type; /* If UPF_FIXED_TYPE */ |
7d6a07d12
|
34 35 |
unsigned int (*serial_in)(struct uart_port *, int); void (*serial_out)(struct uart_port *, int, int); |
235dae5d0
|
36 37 38 |
void (*set_termios)(struct uart_port *, struct ktermios *new, struct ktermios *old); |
db405a8f8
|
39 40 |
void (*set_ldisc)(struct uart_port *, struct ktermios *); |
144ef5c2d
|
41 |
unsigned int (*get_mctrl)(struct uart_port *); |
583d28e92
|
42 |
int (*handle_irq)(struct uart_port *); |
c161afe97
|
43 44 |
void (*pm)(struct uart_port *, unsigned int state, unsigned old); |
bf03f65b7
|
45 |
void (*handle_break)(struct uart_port *); |
1da177e4c
|
46 |
}; |
bc49a661e
|
47 |
/* |
6df29debb
|
48 49 50 51 52 53 54 |
* Allocate 8250 platform device IDs. Nothing is implied by * the numbering here, except for the legacy entry being -1. */ enum { PLAT8250_DEV_LEGACY = -1, PLAT8250_DEV_PLATFORM, PLAT8250_DEV_PLATFORM1, |
104c7b03e
|
55 |
PLAT8250_DEV_PLATFORM2, |
6df29debb
|
56 57 58 |
PLAT8250_DEV_FOURPORT, PLAT8250_DEV_ACCENT, PLAT8250_DEV_BOCA, |
e0980dafa
|
59 |
PLAT8250_DEV_EXAR_ST16C554, |
6df29debb
|
60 |
PLAT8250_DEV_HUB6, |
21c614a78
|
61 |
PLAT8250_DEV_AU1X00, |
61711f8fd
|
62 |
PLAT8250_DEV_SM501, |
6df29debb
|
63 |
}; |
9ee4b83e5
|
64 |
struct uart_8250_dma; |
a4416cd1a
|
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
struct uart_8250_port; /** * 8250 core driver operations * * @setup_irq() Setup irq handling. The universal 8250 driver links this * port to the irq chain. Other drivers may @request_irq(). * @release_irq() Undo irq handling. The universal 8250 driver unlinks * the port from the irq chain. */ struct uart_8250_ops { int (*setup_irq)(struct uart_8250_port *); void (*release_irq)(struct uart_8250_port *); }; |
9ee4b83e5
|
79 |
|
e490c9144
|
80 |
struct uart_8250_em485 { |
6e0a5de21
|
81 82 83 84 |
struct hrtimer start_tx_timer; /* "rs485 start tx" timer */ struct hrtimer stop_tx_timer; /* "rs485 stop tx" timer */ struct hrtimer *active_timer; /* pointer to active timer */ struct uart_8250_port *port; /* for hrtimer callbacks */ |
e490c9144
|
85 |
}; |
6df29debb
|
86 |
/* |
bc49a661e
|
87 88 89 90 91 |
* This should be used by drivers which want to register * their own 8250 ports without registering their own * platform device. Using these will make your driver * dependent on the 8250 driver. */ |
ce7240e44
|
92 93 94 95 96 |
struct uart_8250_port { struct uart_port port; struct timer_list timer; /* "no irq" timer */ struct list_head list; /* ports on this IRQ */ |
98838d950
|
97 |
u32 capabilities; /* port capabilities */ |
ce7240e44
|
98 |
unsigned short bugs; /* port bugs */ |
aef9a7bd9
|
99 |
bool fifo_bug; /* min RX trigger if enabled */ |
ce7240e44
|
100 101 |
unsigned int tx_loadsz; /* transmit fifo load size */ unsigned char acr; |
aef9a7bd9
|
102 |
unsigned char fcr; |
ce7240e44
|
103 104 105 106 107 108 |
unsigned char ier; unsigned char lcr; unsigned char mcr; unsigned char mcr_mask; /* mask of user bits */ unsigned char mcr_force; /* mask of forced bits */ unsigned char cur_iotype; /* Running I/O type */ |
baeb7ef34
|
109 |
unsigned int rpm_tx_active; |
4516d50aa
|
110 111 112 |
unsigned char canary; /* non-zero during system sleep * if no_console_suspend */ |
403753937
|
113 114 |
unsigned char probe; #define UART_PROBE_RSA (1 << 0) |
ce7240e44
|
115 116 117 118 119 120 121 122 123 124 |
/* * Some bits in registers are cleared on a read, so they must * be saved whenever the register is read but the bits will not * be immediately processed. */ #define LSR_SAVE_FLAGS UART_LSR_BRK_ERROR_BITS unsigned char lsr_saved_flags; #define MSR_SAVE_FLAGS UART_MSR_ANY_DELTA unsigned char msr_saved_flags; |
9ee4b83e5
|
125 |
struct uart_8250_dma *dma; |
a4416cd1a
|
126 |
const struct uart_8250_ops *ops; |
9ee4b83e5
|
127 |
|
ce7240e44
|
128 129 130 |
/* 8250 specific callbacks */ int (*dl_read)(struct uart_8250_port *); void (*dl_write)(struct uart_8250_port *, int); |
e490c9144
|
131 132 |
struct uart_8250_em485 *em485; |
ce7240e44
|
133 |
}; |
bc49a661e
|
134 |
|
b1261c86f
|
135 136 137 138 |
static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up) { return container_of(up, struct uart_8250_port, port); } |
f73fa05b9
|
139 |
int serial8250_register_8250_port(struct uart_8250_port *); |
bc49a661e
|
140 141 142 |
void serial8250_unregister_port(int line); void serial8250_suspend_port(int line); void serial8250_resume_port(int line); |
b187f180c
|
143 |
extern int early_serial_setup(struct uart_port *port); |
1c5841e83
|
144 145 |
extern int early_serial8250_setup(struct earlycon_device *device, const char *options); |
235dae5d0
|
146 147 |
extern void serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old); |
db405a8f8
|
148 149 |
extern void serial8250_do_set_ldisc(struct uart_port *port, struct ktermios *termios); |
144ef5c2d
|
150 |
extern unsigned int serial8250_do_get_mctrl(struct uart_port *port); |
b99b121b2
|
151 152 |
extern int serial8250_do_startup(struct uart_port *port); extern void serial8250_do_shutdown(struct uart_port *port); |
c161afe97
|
153 154 |
extern void serial8250_do_pm(struct uart_port *port, unsigned int state, unsigned int oldstate); |
4bf4ea9dc
|
155 |
extern void serial8250_do_set_mctrl(struct uart_port *port, unsigned int mctrl); |
9deaa53ac
|
156 |
extern int fsl8250_handle_irq(struct uart_port *port); |
583d28e92
|
157 |
int serial8250_handle_irq(struct uart_port *port, unsigned int iir); |
3986fb2ba
|
158 159 160 |
unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr); void serial8250_tx_chars(struct uart_8250_port *up); unsigned int serial8250_modem_status(struct uart_8250_port *up); |
b6830f6df
|
161 162 163 164 165 |
void serial8250_init_port(struct uart_8250_port *up); void serial8250_set_defaults(struct uart_8250_port *up); void serial8250_console_write(struct uart_8250_port *up, const char *s, unsigned int count); int serial8250_console_setup(struct uart_port *port, char *options, bool probe); |
18a8bd949
|
166 |
|
af7f37435
|
167 168 |
extern void serial8250_set_isa_configurator(void (*v) (int port, struct uart_port *up, |
98838d950
|
169 |
u32 *capabilities)); |
af7f37435
|
170 |
|
1da177e4c
|
171 |
#endif |