Blame view

include/linux/serial_8250.h 5.71 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);
144ef5c2d   Wan Ahmad Zainie   serial: 8250: exp...
39
  	unsigned int	(*get_mctrl)(struct uart_port *);
583d28e92   Jamie Iles   tty: serial8250: ...
40
  	int		(*handle_irq)(struct uart_port *);
c161afe97   Manuel Lauss   8250: allow platf...
41
42
  	void		(*pm)(struct uart_port *, unsigned int state,
  			      unsigned old);
bf03f65b7   Dan Williams   tegra, serial8250...
43
  	void		(*handle_break)(struct uart_port *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
44
  };
bc49a661e   Russell King   [SERIAL] Move ser...
45
  /*
6df29debb   Russell King   [SERIAL] Use an e...
46
47
48
49
50
51
52
   * 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...
53
  	PLAT8250_DEV_PLATFORM2,
6df29debb   Russell King   [SERIAL] Use an e...
54
55
56
  	PLAT8250_DEV_FOURPORT,
  	PLAT8250_DEV_ACCENT,
  	PLAT8250_DEV_BOCA,
e0980dafa   Paul B Schroeder   [PATCH] Exar quad...
57
  	PLAT8250_DEV_EXAR_ST16C554,
6df29debb   Russell King   [SERIAL] Use an e...
58
  	PLAT8250_DEV_HUB6,
21c614a78   Pantelis Antoniou   [SERIAL] Support ...
59
  	PLAT8250_DEV_AU1X00,
61711f8fd   Magnus Damm   sm501: add uart s...
60
  	PLAT8250_DEV_SM501,
6df29debb   Russell King   [SERIAL] Use an e...
61
  };
9ee4b83e5   Heikki Krogerus   serial: 8250: Add...
62
  struct uart_8250_dma;
a4416cd1a   Peter Hurley   serial: 8250: Sep...
63
64
65
66
67
68
69
70
71
72
73
74
75
76
  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...
77

e490c9144   Matwey V. Kornilov   tty: Add software...
78
79
80
81
82
  struct uart_8250_em485 {
  	struct timer_list	start_tx_timer; /* "rs485 start tx" timer */
  	struct timer_list	stop_tx_timer;  /* "rs485 stop tx" timer */
  	struct timer_list	*active_timer;  /* pointer to active timer */
  };
6df29debb   Russell King   [SERIAL] Use an e...
83
  /*
bc49a661e   Russell King   [SERIAL] Move ser...
84
85
86
87
88
   * 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...
89
90
91
92
93
94
95
  
  struct uart_8250_port {
  	struct uart_port	port;
  	struct timer_list	timer;		/* "no irq" timer */
  	struct list_head	list;		/* ports on this IRQ */
  	unsigned short		capabilities;	/* port capabilities */
  	unsigned short		bugs;		/* port bugs */
aef9a7bd9   Yoshihiro YUNOMAE   serial/uart/8250:...
96
  	bool			fifo_bug;	/* min RX trigger if enabled */
ce7240e44   Alan Cox   8250: three way r...
97
98
  	unsigned int		tx_loadsz;	/* transmit fifo load size */
  	unsigned char		acr;
aef9a7bd9   Yoshihiro YUNOMAE   serial/uart/8250:...
99
  	unsigned char		fcr;
ce7240e44   Alan Cox   8250: three way r...
100
101
102
103
104
105
  	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...
106
  	unsigned int		rpm_tx_active;
4516d50aa   Peter Hurley   serial: 8250: Use...
107
108
109
  	unsigned char		canary;		/* non-zero during system sleep
  						 *   if no_console_suspend
  						 */
403753937   Peter Hurley   serial: 8250: Dec...
110
111
  	unsigned char		probe;
  #define UART_PROBE_RSA	(1 << 0)
ce7240e44   Alan Cox   8250: three way r...
112
113
114
115
116
117
118
119
120
121
  
  	/*
  	 * 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...
122
  	struct uart_8250_dma	*dma;
a4416cd1a   Peter Hurley   serial: 8250: Sep...
123
  	const struct uart_8250_ops *ops;
9ee4b83e5   Heikki Krogerus   serial: 8250: Add...
124

ce7240e44   Alan Cox   8250: three way r...
125
126
127
  	/* 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...
128
129
  
  	struct uart_8250_em485 *em485;
ce7240e44   Alan Cox   8250: three way r...
130
  };
bc49a661e   Russell King   [SERIAL] Move ser...
131

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

af7f37435   Alan Cox   serial: abstracti...
162
163
164
  extern void serial8250_set_isa_configurator(void (*v)
  					(int port, struct uart_port *up,
  						unsigned short *capabilities));
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
165
  #endif