2019-05-27 14:55:01 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-04-17 06:20:36 +08:00
|
|
|
/*
|
|
|
|
* linux/include/linux/serial_8250.h
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004 Russell King
|
|
|
|
*/
|
|
|
|
#ifndef _LINUX_SERIAL_8250_H
|
|
|
|
#define _LINUX_SERIAL_8250_H
|
|
|
|
|
|
|
|
#include <linux/serial_core.h>
|
2015-05-26 12:28:48 +08:00
|
|
|
#include <linux/serial_reg.h>
|
2005-10-30 02:07:23 +08:00
|
|
|
#include <linux/platform_device.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-09-01 22:56:26 +08:00
|
|
|
/*
|
|
|
|
* This is the platform device platform_data structure
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
struct plat_serial8250_port {
|
|
|
|
unsigned long iobase; /* io base address */
|
|
|
|
void __iomem *membase; /* ioremap cookie or NULL */
|
2007-07-24 09:43:44 +08:00
|
|
|
resource_size_t mapbase; /* resource base */
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned int irq; /* interrupt number */
|
2009-09-20 04:13:19 +08:00
|
|
|
unsigned long irqflags; /* request_irq flags */
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned int uartclk; /* UART clock rate */
|
2008-02-05 14:27:50 +08:00
|
|
|
void *private_data;
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned char regshift; /* register shift */
|
|
|
|
unsigned char iotype; /* UPIO_* */
|
2005-06-27 18:12:54 +08:00
|
|
|
unsigned char hub6;
|
2019-12-13 08:06:04 +08:00
|
|
|
unsigned char has_sysrq; /* supports magic SysRq */
|
2006-01-22 07:03:28 +08:00
|
|
|
upf_t flags; /* UPF_* flags */
|
2009-01-02 21:49:54 +08:00
|
|
|
unsigned int type; /* If UPF_FIXED_TYPE */
|
2009-01-02 21:49:47 +08: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 23:13:57 +08:00
|
|
|
void (*set_termios)(struct uart_port *,
|
|
|
|
struct ktermios *new,
|
|
|
|
struct ktermios *old);
|
2016-11-11 02:07:55 +08:00
|
|
|
void (*set_ldisc)(struct uart_port *,
|
|
|
|
struct ktermios *);
|
2016-04-06 12:06:51 +08:00
|
|
|
unsigned int (*get_mctrl)(struct uart_port *);
|
2011-08-15 17:17:52 +08:00
|
|
|
int (*handle_irq)(struct uart_port *);
|
2010-09-25 21:13:45 +08:00
|
|
|
void (*pm)(struct uart_port *, unsigned int state,
|
|
|
|
unsigned old);
|
2012-04-11 05:10:53 +08:00
|
|
|
void (*handle_break)(struct uart_port *);
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2005-09-08 23:04:41 +08: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 07:03:13 +08:00
|
|
|
PLAT8250_DEV_PLATFORM2,
|
2005-09-08 23:04:41 +08:00
|
|
|
PLAT8250_DEV_FOURPORT,
|
|
|
|
PLAT8250_DEV_ACCENT,
|
|
|
|
PLAT8250_DEV_BOCA,
|
2006-12-07 12:37:03 +08:00
|
|
|
PLAT8250_DEV_EXAR_ST16C554,
|
2005-09-08 23:04:41 +08:00
|
|
|
PLAT8250_DEV_HUB6,
|
2005-11-06 17:07:03 +08:00
|
|
|
PLAT8250_DEV_AU1X00,
|
2008-04-28 17:14:22 +08:00
|
|
|
PLAT8250_DEV_SM501,
|
2005-09-08 23:04:41 +08:00
|
|
|
};
|
|
|
|
|
2013-01-10 17:25:11 +08:00
|
|
|
struct uart_8250_dma;
|
2015-02-25 03:25:07 +08:00
|
|
|
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 *);
|
|
|
|
};
|
2013-01-10 17:25:11 +08:00
|
|
|
|
2016-02-02 02:09:21 +08:00
|
|
|
struct uart_8250_em485 {
|
2017-07-31 16:46:43 +08:00
|
|
|
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 */
|
2020-02-28 21:31:06 +08:00
|
|
|
unsigned int tx_stopped:1; /* tx is currently stopped */
|
2016-02-02 02:09:21 +08:00
|
|
|
};
|
|
|
|
|
2005-09-01 22:56:26 +08: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-18 00:06:20 +08:00
|
|
|
|
|
|
|
struct uart_8250_port {
|
|
|
|
struct uart_port port;
|
|
|
|
struct timer_list timer; /* "no irq" timer */
|
|
|
|
struct list_head list; /* ports on this IRQ */
|
2016-11-11 02:07:54 +08:00
|
|
|
u32 capabilities; /* port capabilities */
|
2012-07-18 00:06:20 +08:00
|
|
|
unsigned short bugs; /* port bugs */
|
serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers
Add tunable RX interrupt trigger I/F of FIFO buffers.
Serial devices are used as not only message communication devices but control
or sending communication devices. For the latter uses, normally small data
will be exchanged, so user applications want to receive data unit as soon as
possible for real-time tendency. If we have a sensor which sends a 1 byte data
each time and must control a device based on the sensor feedback, the RX
interrupt should be triggered for each data.
According to HW specification of serial UART devices, RX interrupt trigger
can be changed, but the trigger is hard-coded. For example, RX interrupt trigger
in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets
the trigger to only 8bytes.
This patch makes some devices change RX interrupt trigger from userland.
<How to use>
- Read current setting
# cat /sys/class/tty/ttyS0/rx_trig_bytes
8
- Write user setting
# echo 1 > /sys/class/tty/ttyS0/rx_trig_bytes
# cat /sys/class/tty/ttyS0/rx_trig_bytes
1
<Support uart devices>
- 16550A and Tegra (1, 4, 8, or 14 bytes)
- 16650V2 (8, 16, 24, or 28 bytes)
- 16654 (8, 16, 56, or 60 bytes)
- 16750 (1, 16, 32, or 56 bytes)
<Change log>
Changes in V9:
- Use attr_group instead of dev_spec_attr_group of uart_port structure
Changes in V8:
- Divide this patch from V7's patch based on Greg's comment
Changes in V7:
- Add Documentation
- Change I/F name from rx_int_trig to rx_trig_bytes because the name
rx_int_trig is hard to understand how users specify the value
Changes in V6:
- Move FCR_RX_TRIG_* definition in 8250.h to include/uapi/linux/serial_reg.h,
rename those to UART_FCR_R_TRIG_*, and use UART_FCR_TRIGGER_MASK to
UART_FCR_R_TRIG_BITS()
- Change following function names:
convert_fcr2val() => fcr_get_rxtrig_bytes()
convert_val2rxtrig() => bytes_to_fcr_rxtrig()
- Fix typo in serial8250_do_set_termios()
- Delete the verbose error message pr_info() in bytes_to_fcr_rxtrig()
- Rename *rx_int_trig/rx_trig* to *rxtrig* for several functions or variables
(but UI remains rx_int_trig)
- Change the meaningless variable name 'val' to 'bytes' following functions:
fcr_get_rxtrig_bytes(), bytes_to_fcr_rxtrig(), do_set_rxtrig(),
do_serial8250_set_rxtrig(), and serial8250_set_attr_rxtrig()
- Use up->fcr in order to get rxtrig_bytes instead of rx_trig_raw in
fcr_get_rxtrig_bytes()
- Use conf_type->rxtrig_bytes[0] instead of switch statement for support check
in register_dev_spec_attr_grp()
- Delete the checking whether a user changed FCR or not when minimum buffer
is needed in serial8250_do_set_termios()
Changes in V5.1:
- Fix FCR_RX_TRIG_MAX_STATE definition
Changes in V5:
- Support Tegra, 16650V2, 16654, and 16750
- Store default FCR value to up->fcr when the port is first created
- Add rx_trig_byte[] in uart_config[] for each device and use rx_trig_byte[]
in convert_fcr2val() and convert_val2rxtrig()
Changes in V4:
- Introduce fifo_bug flag in uart_8250_port structure
This is enabled only when parity is enabled and UART_BUG_PARITY is enabled
for up->bugs. If this flag is enabled, user cannot set RX trigger.
- Return -EOPNOTSUPP when it does not support device at convert_fcr2val() and
at convert_val2rxtrig()
- Set the nearest lower RX trigger when users input a meaningless value at
convert_val2rxtrig()
- Check whether p->fcr is existing at serial8250_clear_and_reinit_fifos()
- Set fcr = up->fcr in the begging of serial8250_do_set_termios()
Changes in V3:
- Change I/F from ioctl(2) to sysfs(rx_int_trig)
Changed in V2:
- Use _IOW for TIOCSFIFORTRIG definition
- Pass the interrupt trigger value itself
Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-16 09:19:36 +08:00
|
|
|
bool fifo_bug; /* min RX trigger if enabled */
|
2012-07-18 00:06:20 +08:00
|
|
|
unsigned int tx_loadsz; /* transmit fifo load size */
|
|
|
|
unsigned char acr;
|
serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers
Add tunable RX interrupt trigger I/F of FIFO buffers.
Serial devices are used as not only message communication devices but control
or sending communication devices. For the latter uses, normally small data
will be exchanged, so user applications want to receive data unit as soon as
possible for real-time tendency. If we have a sensor which sends a 1 byte data
each time and must control a device based on the sensor feedback, the RX
interrupt should be triggered for each data.
According to HW specification of serial UART devices, RX interrupt trigger
can be changed, but the trigger is hard-coded. For example, RX interrupt trigger
in 16550A can be set to 1, 4, 8, or 14 bytes for HW, but current driver sets
the trigger to only 8bytes.
This patch makes some devices change RX interrupt trigger from userland.
<How to use>
- Read current setting
# cat /sys/class/tty/ttyS0/rx_trig_bytes
8
- Write user setting
# echo 1 > /sys/class/tty/ttyS0/rx_trig_bytes
# cat /sys/class/tty/ttyS0/rx_trig_bytes
1
<Support uart devices>
- 16550A and Tegra (1, 4, 8, or 14 bytes)
- 16650V2 (8, 16, 24, or 28 bytes)
- 16654 (8, 16, 56, or 60 bytes)
- 16750 (1, 16, 32, or 56 bytes)
<Change log>
Changes in V9:
- Use attr_group instead of dev_spec_attr_group of uart_port structure
Changes in V8:
- Divide this patch from V7's patch based on Greg's comment
Changes in V7:
- Add Documentation
- Change I/F name from rx_int_trig to rx_trig_bytes because the name
rx_int_trig is hard to understand how users specify the value
Changes in V6:
- Move FCR_RX_TRIG_* definition in 8250.h to include/uapi/linux/serial_reg.h,
rename those to UART_FCR_R_TRIG_*, and use UART_FCR_TRIGGER_MASK to
UART_FCR_R_TRIG_BITS()
- Change following function names:
convert_fcr2val() => fcr_get_rxtrig_bytes()
convert_val2rxtrig() => bytes_to_fcr_rxtrig()
- Fix typo in serial8250_do_set_termios()
- Delete the verbose error message pr_info() in bytes_to_fcr_rxtrig()
- Rename *rx_int_trig/rx_trig* to *rxtrig* for several functions or variables
(but UI remains rx_int_trig)
- Change the meaningless variable name 'val' to 'bytes' following functions:
fcr_get_rxtrig_bytes(), bytes_to_fcr_rxtrig(), do_set_rxtrig(),
do_serial8250_set_rxtrig(), and serial8250_set_attr_rxtrig()
- Use up->fcr in order to get rxtrig_bytes instead of rx_trig_raw in
fcr_get_rxtrig_bytes()
- Use conf_type->rxtrig_bytes[0] instead of switch statement for support check
in register_dev_spec_attr_grp()
- Delete the checking whether a user changed FCR or not when minimum buffer
is needed in serial8250_do_set_termios()
Changes in V5.1:
- Fix FCR_RX_TRIG_MAX_STATE definition
Changes in V5:
- Support Tegra, 16650V2, 16654, and 16750
- Store default FCR value to up->fcr when the port is first created
- Add rx_trig_byte[] in uart_config[] for each device and use rx_trig_byte[]
in convert_fcr2val() and convert_val2rxtrig()
Changes in V4:
- Introduce fifo_bug flag in uart_8250_port structure
This is enabled only when parity is enabled and UART_BUG_PARITY is enabled
for up->bugs. If this flag is enabled, user cannot set RX trigger.
- Return -EOPNOTSUPP when it does not support device at convert_fcr2val() and
at convert_val2rxtrig()
- Set the nearest lower RX trigger when users input a meaningless value at
convert_val2rxtrig()
- Check whether p->fcr is existing at serial8250_clear_and_reinit_fifos()
- Set fcr = up->fcr in the begging of serial8250_do_set_termios()
Changes in V3:
- Change I/F from ioctl(2) to sysfs(rx_int_trig)
Changed in V2:
- Use _IOW for TIOCSFIFORTRIG definition
- Pass the interrupt trigger value itself
Signed-off-by: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-07-16 09:19:36 +08:00
|
|
|
unsigned char fcr;
|
2012-07-18 00:06:20 +08:00
|
|
|
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 */
|
2014-09-29 16:21:03 +08:00
|
|
|
unsigned int rpm_tx_active;
|
2015-01-23 01:24:30 +08:00
|
|
|
unsigned char canary; /* non-zero during system sleep
|
|
|
|
* if no_console_suspend
|
|
|
|
*/
|
2015-02-25 03:25:14 +08:00
|
|
|
unsigned char probe;
|
2019-06-20 14:24:20 +08:00
|
|
|
struct mctrl_gpios *gpios;
|
2015-02-25 03:25:14 +08:00
|
|
|
#define UART_PROBE_RSA (1 << 0)
|
2012-07-18 00:06:20 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 17:25:11 +08:00
|
|
|
struct uart_8250_dma *dma;
|
2015-02-25 03:25:07 +08:00
|
|
|
const struct uart_8250_ops *ops;
|
2013-01-10 17:25:11 +08:00
|
|
|
|
2012-07-18 00:06:20 +08:00
|
|
|
/* 8250 specific callbacks */
|
|
|
|
int (*dl_read)(struct uart_8250_port *);
|
|
|
|
void (*dl_write)(struct uart_8250_port *, int);
|
2016-02-02 02:09:21 +08:00
|
|
|
|
|
|
|
struct uart_8250_em485 *em485;
|
2020-02-28 21:31:06 +08:00
|
|
|
void (*rs485_start_tx)(struct uart_8250_port *);
|
|
|
|
void (*rs485_stop_tx)(struct uart_8250_port *);
|
2018-12-10 06:29:09 +08:00
|
|
|
|
|
|
|
/* Serial port overrun backoff */
|
|
|
|
struct delayed_work overrun_backoff;
|
|
|
|
u32 overrun_backoff_time_ms;
|
2012-07-18 00:06:20 +08:00
|
|
|
};
|
2005-09-01 22:56:26 +08:00
|
|
|
|
2014-07-14 19:26:14 +08:00
|
|
|
static inline struct uart_8250_port *up_to_u8250p(struct uart_port *up)
|
|
|
|
{
|
|
|
|
return container_of(up, struct uart_8250_port, port);
|
|
|
|
}
|
|
|
|
|
2012-05-02 20:47:27 +08:00
|
|
|
int serial8250_register_8250_port(struct uart_8250_port *);
|
2005-09-01 22:56:26 +08:00
|
|
|
void serial8250_unregister_port(int line);
|
|
|
|
void serial8250_suspend_port(int line);
|
|
|
|
void serial8250_resume_port(int line);
|
|
|
|
|
2007-07-18 15:49:10 +08:00
|
|
|
extern int early_serial_setup(struct uart_port *port);
|
|
|
|
|
2015-04-28 21:40:32 +08:00
|
|
|
extern int early_serial8250_setup(struct earlycon_device *device,
|
|
|
|
const char *options);
|
2020-07-23 08:33:54 +08:00
|
|
|
extern void serial8250_update_uartclk(struct uart_port *port,
|
|
|
|
unsigned int uartclk);
|
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 23:13:57 +08:00
|
|
|
extern void serial8250_do_set_termios(struct uart_port *port,
|
|
|
|
struct ktermios *termios, struct ktermios *old);
|
2016-11-11 02:07:55 +08:00
|
|
|
extern void serial8250_do_set_ldisc(struct uart_port *port,
|
|
|
|
struct ktermios *termios);
|
2016-04-06 12:06:51 +08:00
|
|
|
extern unsigned int serial8250_do_get_mctrl(struct uart_port *port);
|
2014-09-06 03:02:37 +08:00
|
|
|
extern int serial8250_do_startup(struct uart_port *port);
|
|
|
|
extern void serial8250_do_shutdown(struct uart_port *port);
|
2010-09-25 21:13:45 +08:00
|
|
|
extern void serial8250_do_pm(struct uart_port *port, unsigned int state,
|
|
|
|
unsigned int oldstate);
|
2014-12-31 09:28:15 +08:00
|
|
|
extern void serial8250_do_set_mctrl(struct uart_port *port, unsigned int mctrl);
|
2018-07-12 09:58:14 +08:00
|
|
|
extern void serial8250_do_set_divisor(struct uart_port *port, unsigned int baud,
|
|
|
|
unsigned int quot,
|
|
|
|
unsigned int quot_frac);
|
2011-12-05 07:42:23 +08:00
|
|
|
extern int fsl8250_handle_irq(struct uart_port *port);
|
2011-08-15 17:17:52 +08:00
|
|
|
int serial8250_handle_irq(struct uart_port *port, unsigned int iir);
|
2011-12-05 07:42:20 +08:00
|
|
|
unsigned char serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr);
|
2018-03-27 11:48:25 +08:00
|
|
|
void serial8250_read_char(struct uart_8250_port *up, unsigned char lsr);
|
2011-12-05 07:42:20 +08:00
|
|
|
void serial8250_tx_chars(struct uart_8250_port *up);
|
|
|
|
unsigned int serial8250_modem_status(struct uart_8250_port *up);
|
2015-06-27 21:19:00 +08:00
|
|
|
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);
|
serial: 8250_port: Don't use power management for kernel console
Doing any kind of power management for kernel console is really bad idea.
First of all, it runs in poll and atomic mode. This fact attaches a limitation
on the functions that might be called. For example, pm_runtime_get_sync() might
sleep and thus can't be used. This call needs, for example, to bring the device
to powered on state on the system, where the power on sequence may require
on-atomic operations, such as Intel Cherrytrail with ACPI enumerated UARTs.
That said, on ACPI enabled platforms it might even call firmware for a job.
On the other hand pm_runtime_get() doesn't guarantee that device will become
powered on fast enough.
Besides that, imagine the case when console is about to print a kernel Oops and
it's powered off. In such an emergency case calling the complex functions is
not the best what we can do, taking into consideration that user wants to see
at least something of the last kernel word before it passes away.
Here we modify the 8250 console code to prevent runtime power management.
Note, there is a behaviour change for OMAP boards. It will require to detach
kernel console to become idle.
Link: https://lists.openwall.net/linux-kernel/2018/09/29/65
Suggested-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200217114016.49856-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-17 19:40:15 +08:00
|
|
|
int serial8250_console_exit(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 14:37:59 +08:00
|
|
|
|
2010-10-19 02:38:02 +08:00
|
|
|
extern void serial8250_set_isa_configurator(void (*v)
|
|
|
|
(int port, struct uart_port *up,
|
2016-11-11 02:07:54 +08:00
|
|
|
u32 *capabilities));
|
2010-10-19 02:38:02 +08:00
|
|
|
|
2020-11-12 18:58:55 +08:00
|
|
|
#ifdef CONFIG_SERIAL_8250_RT288X
|
|
|
|
unsigned int au_serial_in(struct uart_port *p, int offset);
|
|
|
|
void au_serial_out(struct uart_port *p, int offset, int value);
|
|
|
|
#endif
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|