Blame view

include/linux/serial_8250.h 5.91 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
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   Masahiro Yamada   serial: 8250: inc...
15
  #include <linux/serial_reg.h>
d052d1bef   Russell King   Create platform_d...
16
  #include <linux/platform_device.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17

bc49a661e   Russell King   [SERIAL] Move ser...
18
19
20
  /*
   * This is the platform device platform_data structure
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
23
  struct plat_serial8250_port {
  	unsigned long	iobase;		/* io base address */
  	void __iomem	*membase;	/* ioremap cookie or NULL */
4f640efb3   Josh Boyer   Use resource_size...
24
  	resource_size_t	mapbase;	/* resource base */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25
  	unsigned int	irq;		/* interrupt number */
1c2f04937   Vikram Pandita   serial: 8250: add...
26
  	unsigned long	irqflags;	/* request_irq flags */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
27
  	unsigned int	uartclk;	/* UART clock rate */
74a197417   Will Newton   8250.c: support s...
28
  	void            *private_data;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29
30
  	unsigned char	regshift;	/* register shift */
  	unsigned char	iotype;		/* UPIO_* */
ec9f47cd6   Russell King   [PATCH] Serial: S...
31
  	unsigned char	hub6;
0077d45e4   Russell King   [SERIAL] Make uar...
32
  	upf_t		flags;		/* UPF_* flags */
8e23fcc89   David Daney   Serial: Allow por...
33
  	unsigned int	type;		/* If UPF_FIXED_TYPE */
7d6a07d12   David Daney   8250: Serial driv...
34
35
  	unsigned int	(*serial_in)(struct uart_port *, int);
  	void		(*serial_out)(struct uart_port *, int, int);
235dae5d0   Philippe Langlais   U6715 16550A seri...
36
37
38
  	void		(*set_termios)(struct uart_port *,
  			               struct ktermios *new,
  			               struct ktermios *old);
db405a8f8   Ed Blake   serial: 8250: Exp...
39
40
  	void		(*set_ldisc)(struct uart_port *,
  				     struct ktermios *);
144ef5c2d   Wan Ahmad Zainie   serial: 8250: exp...
41
  	unsigned int	(*get_mctrl)(struct uart_port *);
583d28e92   Jamie Iles   tty: serial8250: ...
42
  	int		(*handle_irq)(struct uart_port *);
c161afe97   Manuel Lauss   8250: allow platf...
43
44
  	void		(*pm)(struct uart_port *, unsigned int state,
  			      unsigned old);
bf03f65b7   Dan Williams   tegra, serial8250...
45
  	void		(*handle_break)(struct uart_port *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
46
  };
bc49a661e   Russell King   [SERIAL] Move ser...
47
  /*
6df29debb   Russell King   [SERIAL] Use an e...
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   Lennert Buytenhek   [ARM] 3383/3: ixp...
55
  	PLAT8250_DEV_PLATFORM2,
6df29debb   Russell King   [SERIAL] Use an e...
56
57
58
  	PLAT8250_DEV_FOURPORT,
  	PLAT8250_DEV_ACCENT,
  	PLAT8250_DEV_BOCA,
e0980dafa   Paul B Schroeder   [PATCH] Exar quad...
59
  	PLAT8250_DEV_EXAR_ST16C554,
6df29debb   Russell King   [SERIAL] Use an e...
60
  	PLAT8250_DEV_HUB6,
21c614a78   Pantelis Antoniou   [SERIAL] Support ...
61
  	PLAT8250_DEV_AU1X00,
61711f8fd   Magnus Damm   sm501: add uart s...
62
  	PLAT8250_DEV_SM501,
6df29debb   Russell King   [SERIAL] Use an e...
63
  };
9ee4b83e5   Heikki Krogerus   serial: 8250: Add...
64
  struct uart_8250_dma;
a4416cd1a   Peter Hurley   serial: 8250: Sep...
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   Heikki Krogerus   serial: 8250: Add...
79

e490c9144   Matwey V. Kornilov   tty: Add software...
80
  struct uart_8250_em485 {
6e0a5de21   Rafael Gago   serial: 8250: Use...
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   Matwey V. Kornilov   tty: Add software...
85
  };
6df29debb   Russell King   [SERIAL] Use an e...
86
  /*
bc49a661e   Russell King   [SERIAL] Move ser...
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   Alan Cox   8250: three way r...
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   Ed Blake   serial: 8250: Add...
97
  	u32			capabilities;	/* port capabilities */
ce7240e44   Alan Cox   8250: three way r...
98
  	unsigned short		bugs;		/* port bugs */
aef9a7bd9   Yoshihiro YUNOMAE   serial/uart/8250:...
99
  	bool			fifo_bug;	/* min RX trigger if enabled */
ce7240e44   Alan Cox   8250: three way r...
100
101
  	unsigned int		tx_loadsz;	/* transmit fifo load size */
  	unsigned char		acr;
aef9a7bd9   Yoshihiro YUNOMAE   serial/uart/8250:...
102
  	unsigned char		fcr;
ce7240e44   Alan Cox   8250: three way r...
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   Sebastian Andrzej Siewior   tty: serial: 8250...
109
  	unsigned int		rpm_tx_active;
4516d50aa   Peter Hurley   serial: 8250: Use...
110
111
112
  	unsigned char		canary;		/* non-zero during system sleep
  						 *   if no_console_suspend
  						 */
403753937   Peter Hurley   serial: 8250: Dec...
113
114
  	unsigned char		probe;
  #define UART_PROBE_RSA	(1 << 0)
ce7240e44   Alan Cox   8250: three way r...
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   Heikki Krogerus   serial: 8250: Add...
125
  	struct uart_8250_dma	*dma;
a4416cd1a   Peter Hurley   serial: 8250: Sep...
126
  	const struct uart_8250_ops *ops;
9ee4b83e5   Heikki Krogerus   serial: 8250: Add...
127

ce7240e44   Alan Cox   8250: three way r...
128
129
130
  	/* 8250 specific callbacks */
  	int			(*dl_read)(struct uart_8250_port *);
  	void			(*dl_write)(struct uart_8250_port *, int);
e490c9144   Matwey V. Kornilov   tty: Add software...
131
132
  
  	struct uart_8250_em485 *em485;
ce7240e44   Alan Cox   8250: three way r...
133
  };
bc49a661e   Russell King   [SERIAL] Move ser...
134

b1261c86f   Andy Shevchenko   serial: 8250: int...
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   Magnus Damm   serial8250: Intro...
139
  int serial8250_register_8250_port(struct uart_8250_port *);
bc49a661e   Russell King   [SERIAL] Move ser...
140
141
142
  void serial8250_unregister_port(int line);
  void serial8250_suspend_port(int line);
  void serial8250_resume_port(int line);
b187f180c   Yinghai Lu   serial: add early...
143
  extern int early_serial_setup(struct uart_port *port);
1c5841e83   Eddie Huang   tty: serial: 8250...
144
145
  extern int early_serial8250_setup(struct earlycon_device *device,
  					 const char *options);
235dae5d0   Philippe Langlais   U6715 16550A seri...
146
147
  extern void serial8250_do_set_termios(struct uart_port *port,
  		struct ktermios *termios, struct ktermios *old);
db405a8f8   Ed Blake   serial: 8250: Exp...
148
149
  extern void serial8250_do_set_ldisc(struct uart_port *port,
  				    struct ktermios *termios);
144ef5c2d   Wan Ahmad Zainie   serial: 8250: exp...
150
  extern unsigned int serial8250_do_get_mctrl(struct uart_port *port);
b99b121b2   Sebastian Andrzej Siewior   tty: serial: 8250...
151
152
  extern int serial8250_do_startup(struct uart_port *port);
  extern void serial8250_do_shutdown(struct uart_port *port);
c161afe97   Manuel Lauss   8250: allow platf...
153
154
  extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
  			     unsigned int oldstate);
4bf4ea9dc   Peter Hurley   serial: omap_8250...
155
  extern void serial8250_do_set_mctrl(struct uart_port *port, unsigned int mctrl);
9deaa53ac   Paul Gortmaker   serial: add irq h...
156
  extern int fsl8250_handle_irq(struct uart_port *port);
583d28e92   Jamie Iles   tty: serial8250: ...
157
  int serial8250_handle_irq(struct uart_port *port, unsigned int iir);
3986fb2ba   Paul Gortmaker   serial: export th...
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   Peter Hurley   serial: 8250: Spl...
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   Yinghai Lu   serial: convert e...
166

af7f37435   Alan Cox   serial: abstracti...
167
168
  extern void serial8250_set_isa_configurator(void (*v)
  					(int port, struct uart_port *up,
98838d950   Ed Blake   serial: 8250: Add...
169
  						u32 *capabilities));
af7f37435   Alan Cox   serial: abstracti...
170

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
171
  #endif