2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* 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>
|
2005-10-30 01:07:23 +07:00
|
|
|
#include <linux/platform_device.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2005-09-01 21:56:26 +07:00
|
|
|
/*
|
|
|
|
* This is the platform device platform_data structure
|
|
|
|
*/
|
2005-04-17 05:20:36 +07:00
|
|
|
struct plat_serial8250_port {
|
|
|
|
unsigned long iobase; /* io base address */
|
|
|
|
void __iomem *membase; /* ioremap cookie or NULL */
|
2007-07-24 08:43:44 +07:00
|
|
|
resource_size_t mapbase; /* resource base */
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int irq; /* interrupt number */
|
2009-09-20 03:13:19 +07:00
|
|
|
unsigned long irqflags; /* request_irq flags */
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned int uartclk; /* UART clock rate */
|
2008-02-05 13:27:50 +07:00
|
|
|
void *private_data;
|
2005-04-17 05:20:36 +07:00
|
|
|
unsigned char regshift; /* register shift */
|
|
|
|
unsigned char iotype; /* UPIO_* */
|
2005-06-27 17:12:54 +07:00
|
|
|
unsigned char hub6;
|
2006-01-22 06:03:28 +07:00
|
|
|
upf_t flags; /* UPF_* flags */
|
2009-01-02 20:49:54 +07:00
|
|
|
unsigned int type; /* If UPF_FIXED_TYPE */
|
2009-01-02 20:49:47 +07:00
|
|
|
unsigned int (*serial_in)(struct uart_port *, int);
|
|
|
|
void (*serial_out)(struct uart_port *, int, int);
|
U6715 16550A serial driver support
UART Features extract from STEricsson U6715 data-sheet (arm926 SoC for mobile phone):
* Fully compatible with industry standard 16C550 and 16C450 from various
manufacturers
* RX and TX 64 byte FIFO reduces CPU interrupts
* Full double buffering
* Modem control signals include CTS, RTS, (and DSR, DTR on UART1 only)
* Automatic baud rate selection
* Manual or automatic RTS/CTS smart hardware flow control
* Programmable serial characteristics:
– Baud rate generation (50 to 3.25M baud)
– 5, 6, 7 or 8-bit characters
– Even, odd or no-parity bit generation and detection
– 1, 1.5 or 2 stop bit generation
* Independent control of transmit, receive, line status, data set interrupts and FIFOs
* Full status-reporting capabilities
* Separate DMA signaling for RX and TX
* Timed interrupt to spread receive interrupt on known duration
* DMA time-out interrupt to allow detection of end of reception
* Carkit pulse coding and decoding compliant with USB carkit control interface [40]
In 16550A auto-configuration, if the fifo size is 64 then it's an U6 16550A port
Add set_termios hook & export serial8250_do_set_termios to change uart
clock following baudrate
Signed-off-by: Philippe Langlais <philippe.langlais@stericsson.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-07-29 22:13:57 +07:00
|
|
|
void (*set_termios)(struct uart_port *,
|
|
|
|
struct ktermios *new,
|
|
|
|
struct ktermios *old);
|
2011-08-15 16:17:52 +07:00
|
|
|
int (*handle_irq)(struct uart_port *);
|
2010-09-25 20:13:45 +07:00
|
|
|
void (*pm)(struct uart_port *, unsigned int state,
|
|
|
|
unsigned old);
|
2012-04-11 04:10:53 +07:00
|
|
|
void (*handle_break)(struct uart_port *);
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2005-09-08 22:04:41 +07:00
|
|
|
/*
|
|
|
|
* 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,
|
2006-03-26 06:03:13 +07:00
|
|
|
PLAT8250_DEV_PLATFORM2,
|
2005-09-08 22:04:41 +07:00
|
|
|
PLAT8250_DEV_FOURPORT,
|
|
|
|
PLAT8250_DEV_ACCENT,
|
|
|
|
PLAT8250_DEV_BOCA,
|
2006-12-07 11:37:03 +07:00
|
|
|
PLAT8250_DEV_EXAR_ST16C554,
|
2005-09-08 22:04:41 +07:00
|
|
|
PLAT8250_DEV_HUB6,
|
2005-11-06 16:07:03 +07:00
|
|
|
PLAT8250_DEV_AU1X00,
|
2008-04-28 16:14:22 +07:00
|
|
|
PLAT8250_DEV_SM501,
|
2005-09-08 22:04:41 +07:00
|
|
|
};
|
|
|
|
|
2013-01-10 16:25:11 +07:00
|
|
|
struct uart_8250_dma;
|
|
|
|
|
2005-09-01 21:56:26 +07:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2012-07-17 23:06:20 +07:00
|
|
|
|
|
|
|
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 */
|
|
|
|
unsigned int tx_loadsz; /* transmit fifo load size */
|
|
|
|
unsigned char acr;
|
|
|
|
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 */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
2013-01-10 16:25:11 +07:00
|
|
|
struct uart_8250_dma *dma;
|
|
|
|
|
2012-07-17 23:06:20 +07:00
|
|
|
/* 8250 specific callbacks */
|
|
|
|
int (*dl_read)(struct uart_8250_port *);
|
|
|
|
void (*dl_write)(struct uart_8250_port *, int);
|
|
|
|
};
|
2005-09-01 21:56:26 +07:00
|
|
|
|
2012-05-02 19:47:27 +07:00
|
|
|
int serial8250_register_8250_port(struct uart_8250_port *);
|
2005-09-01 21:56:26 +07:00
|
|
|
void serial8250_unregister_port(int line);
|
|
|
|
void serial8250_suspend_port(int line);
|
|
|
|
void serial8250_resume_port(int line);
|
|
|
|
|
2007-07-18 14:49:10 +07:00
|
|
|
extern int early_serial_setup(struct uart_port *port);
|
|
|
|
|
serial: convert early_uart to earlycon for 8250
Beacuse SERIAL_PORT_DFNS is removed from include/asm-i386/serial.h and
include/asm-x86_64/serial.h. the serial8250_ports need to be probed late in
serial initializing stage. the console_init=>serial8250_console_init=>
register_console=>serial8250_console_setup will return -ENDEV, and console
ttyS0 can not be enabled at that time. need to wait till uart_add_one_port in
drivers/serial/serial_core.c to call register_console to get console ttyS0.
that is too late.
Make early_uart to use early_param, so uart console can be used earlier. Make
it to be bootconsole with CON_BOOT flag, so can use console handover feature.
and it will switch to corresponding normal serial console automatically.
new command line will be:
console=uart8250,io,0x3f8,9600n8
console=uart8250,mmio,0xff5e0000,115200n8
or
earlycon=uart8250,io,0x3f8,9600n8
earlycon=uart8250,mmio,0xff5e0000,115200n8
it will print in very early stage:
Early serial console at I/O port 0x3f8 (options '9600n8')
console [uart0] enabled
later for console it will print:
console handover: boot [uart0] -> real [ttyS0]
Signed-off-by: <yinghai.lu@sun.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Gerd Hoffmann <kraxel@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-16 13:37:59 +07:00
|
|
|
extern int serial8250_find_port(struct uart_port *p);
|
|
|
|
extern int serial8250_find_port_for_earlycon(void);
|
2012-11-16 12:03:05 +07:00
|
|
|
extern unsigned int serial8250_early_in(struct uart_port *port, int offset);
|
|
|
|
extern void serial8250_early_out(struct uart_port *port, int offset, int value);
|
serial: convert early_uart to earlycon for 8250
Beacuse SERIAL_PORT_DFNS is removed from include/asm-i386/serial.h and
include/asm-x86_64/serial.h. the serial8250_ports need to be probed late in
serial initializing stage. the console_init=>serial8250_console_init=>
register_console=>serial8250_console_setup will return -ENDEV, and console
ttyS0 can not be enabled at that time. need to wait till uart_add_one_port in
drivers/serial/serial_core.c to call register_console to get console ttyS0.
that is too late.
Make early_uart to use early_param, so uart console can be used earlier. Make
it to be bootconsole with CON_BOOT flag, so can use console handover feature.
and it will switch to corresponding normal serial console automatically.
new command line will be:
console=uart8250,io,0x3f8,9600n8
console=uart8250,mmio,0xff5e0000,115200n8
or
earlycon=uart8250,io,0x3f8,9600n8
earlycon=uart8250,mmio,0xff5e0000,115200n8
it will print in very early stage:
Early serial console at I/O port 0x3f8 (options '9600n8')
console [uart0] enabled
later for console it will print:
console handover: boot [uart0] -> real [ttyS0]
Signed-off-by: <yinghai.lu@sun.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Gerd Hoffmann <kraxel@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-16 13:37:59 +07:00
|
|
|
extern int setup_early_serial8250_console(char *cmdline);
|
U6715 16550A serial driver support
UART Features extract from STEricsson U6715 data-sheet (arm926 SoC for mobile phone):
* Fully compatible with industry standard 16C550 and 16C450 from various
manufacturers
* RX and TX 64 byte FIFO reduces CPU interrupts
* Full double buffering
* Modem control signals include CTS, RTS, (and DSR, DTR on UART1 only)
* Automatic baud rate selection
* Manual or automatic RTS/CTS smart hardware flow control
* Programmable serial characteristics:
– Baud rate generation (50 to 3.25M baud)
– 5, 6, 7 or 8-bit characters
– Even, odd or no-parity bit generation and detection
– 1, 1.5 or 2 stop bit generation
* Independent control of transmit, receive, line status, data set interrupts and FIFOs
* Full status-reporting capabilities
* Separate DMA signaling for RX and TX
* Timed interrupt to spread receive interrupt on known duration
* DMA time-out interrupt to allow detection of end of reception
* Carkit pulse coding and decoding compliant with USB carkit control interface [40]
In 16550A auto-configuration, if the fifo size is 64 then it's an U6 16550A port
Add set_termios hook & export serial8250_do_set_termios to change uart
clock following baudrate
Signed-off-by: Philippe Langlais <philippe.langlais@stericsson.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-07-29 22:13:57 +07:00
|
|
|
extern void serial8250_do_set_termios(struct uart_port *port,
|
|
|
|
struct ktermios *termios, struct ktermios *old);
|
2010-09-25 20:13:45 +07:00
|
|
|
extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
|
|
|
|
unsigned int oldstate);
|
2011-12-05 06:42:23 +07:00
|
|
|
extern int fsl8250_handle_irq(struct uart_port *port);
|
2011-08-15 16:17:52 +07:00
|
|
|
int serial8250_handle_irq(struct uart_port *port, unsigned int iir);
|
2011-12-05 06:42:20 +07:00
|
|
|
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);
|
serial: convert early_uart to earlycon for 8250
Beacuse SERIAL_PORT_DFNS is removed from include/asm-i386/serial.h and
include/asm-x86_64/serial.h. the serial8250_ports need to be probed late in
serial initializing stage. the console_init=>serial8250_console_init=>
register_console=>serial8250_console_setup will return -ENDEV, and console
ttyS0 can not be enabled at that time. need to wait till uart_add_one_port in
drivers/serial/serial_core.c to call register_console to get console ttyS0.
that is too late.
Make early_uart to use early_param, so uart console can be used earlier. Make
it to be bootconsole with CON_BOOT flag, so can use console handover feature.
and it will switch to corresponding normal serial console automatically.
new command line will be:
console=uart8250,io,0x3f8,9600n8
console=uart8250,mmio,0xff5e0000,115200n8
or
earlycon=uart8250,io,0x3f8,9600n8
earlycon=uart8250,mmio,0xff5e0000,115200n8
it will print in very early stage:
Early serial console at I/O port 0x3f8 (options '9600n8')
console [uart0] enabled
later for console it will print:
console handover: boot [uart0] -> real [ttyS0]
Signed-off-by: <yinghai.lu@sun.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Gerd Hoffmann <kraxel@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-16 13:37:59 +07:00
|
|
|
|
2010-10-19 01:38:02 +07:00
|
|
|
extern void serial8250_set_isa_configurator(void (*v)
|
|
|
|
(int port, struct uart_port *up,
|
|
|
|
unsigned short *capabilities));
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|