TTY/Serial driver updates for 5.6-rc1

Here are the big set of tty and serial driver updates for 5.6-rc1
 
 Included in here are:
 	- dummy_con cleanups (touches lots of arch code)
 	- sysrq logic cleanups (touches lots of serial drivers)
 	- samsung driver fixes (wasn't really being built)
 	- conmakeshash move to tty subdir out of scripts
 	- lots of small tty/serial driver updates
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCXjFRBg8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+yn2VACgkge7vTeUNeZFc+6F4NWphAQ5tCQAoK/MMbU6
 0O8ef7PjFwCU4s227UTv
 =6m40
 -----END PGP SIGNATURE-----

Merge tag 'tty-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial driver updates from Greg KH:
 "Here are the big set of tty and serial driver updates for 5.6-rc1

  Included in here are:
   - dummy_con cleanups (touches lots of arch code)
   - sysrq logic cleanups (touches lots of serial drivers)
   - samsung driver fixes (wasn't really being built)
   - conmakeshash move to tty subdir out of scripts
   - lots of small tty/serial driver updates

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'tty-5.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (140 commits)
  tty: n_hdlc: Use flexible-array member and struct_size() helper
  tty: baudrate: SPARC supports few more baud rates
  tty: baudrate: Synchronise baud_table[] and baud_bits[]
  tty: serial: meson_uart: Add support for kernel debugger
  serial: imx: fix a race condition in receive path
  serial: 8250_bcm2835aux: Document struct bcm2835aux_data
  serial: 8250_bcm2835aux: Use generic remapping code
  serial: 8250_bcm2835aux: Allocate uart_8250_port on stack
  serial: 8250_bcm2835aux: Suppress register_port error on -EPROBE_DEFER
  serial: 8250_bcm2835aux: Suppress clk_get error on -EPROBE_DEFER
  serial: 8250_bcm2835aux: Fix line mismatch on driver unbind
  serial_core: Remove unused member in uart_port
  vt: Correct comment documenting do_take_over_console()
  vt: Delete comment referencing non-existent unbind_con_driver()
  arch/xtensa/setup: Drop dummy_con initialization
  arch/x86/setup: Drop dummy_con initialization
  arch/unicore32/setup: Drop dummy_con initialization
  arch/sparc/setup: Drop dummy_con initialization
  arch/sh/setup: Drop dummy_con initialization
  arch/s390/setup: Drop dummy_con initialization
  ...
This commit is contained in:
Linus Torvalds 2020-01-29 10:13:27 -08:00
commit ca9b5b6283
106 changed files with 823 additions and 933 deletions

View File

@ -6181,6 +6181,12 @@ M: Maxim Levitsky <maximlevitsky@gmail.com>
S: Maintained S: Maintained
F: drivers/media/rc/ene_ir.* F: drivers/media/rc/ene_ir.*
EPAPR HYPERVISOR BYTE CHANNEL DEVICE DRIVER
M: Laurentiu Tudor <laurentiu.tudor@nxp.com>
L: linuxppc-dev@lists.ozlabs.org
S: Maintained
F: drivers/tty/ehv_bytechan.c
EPSON S1D13XXX FRAMEBUFFER DRIVER EPSON S1D13XXX FRAMEBUFFER DRIVER
M: Kristoffer Ericson <kristoffer.ericson@gmail.com> M: Kristoffer Ericson <kristoffer.ericson@gmail.com>
S: Maintained S: Maintained

View File

@ -655,8 +655,6 @@ setup_arch(char **cmdline_p)
#ifdef CONFIG_VT #ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_VGA_CONSOLE)
conswitchp = &vga_con; conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif #endif
#endif #endif

View File

@ -572,10 +572,6 @@ void __init setup_arch(char **cmdline_p)
*/ */
root_mountflags &= ~MS_RDONLY; root_mountflags &= ~MS_RDONLY;
#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif
arc_unwind_init(); arc_unwind_init();
} }

View File

@ -1164,8 +1164,6 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_VT #ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_VGA_CONSOLE)
conswitchp = &vga_con; conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif #endif
#endif #endif

View File

@ -360,9 +360,6 @@ void __init setup_arch(char **cmdline_p)
init_task.thread_info.ttbr0 = __pa_symbol(empty_zero_page); init_task.thread_info.ttbr0 = __pa_symbol(empty_zero_page);
#endif #endif
#ifdef CONFIG_VT
conswitchp = &dummy_con;
#endif
if (boot_args[1] || boot_args[2] || boot_args[3]) { if (boot_args[1] || boot_args[2] || boot_args[3]) {
pr_err("WARNING: x1-x3 nonzero in violation of boot protocol:\n" pr_err("WARNING: x1-x3 nonzero in violation of boot protocol:\n"
"\tx1: %016llx\n\tx2: %016llx\n\tx3: %016llx\n" "\tx1: %016llx\n\tx2: %016llx\n\tx3: %016llx\n"

View File

@ -136,10 +136,6 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
kmap_init(); kmap_init();
#endif #endif
#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif
} }
unsigned long va_pa_offset; unsigned long va_pa_offset;

View File

@ -608,9 +608,6 @@ setup_arch (char **cmdline_p)
#ifdef CONFIG_VT #ifdef CONFIG_VT
if (!conswitchp) { if (!conswitchp) {
# if defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
# endif
# if defined(CONFIG_VGA_CONSOLE) # if defined(CONFIG_VGA_CONSOLE)
/* /*
* Non-legacy systems may route legacy VGA MMIO range to system * Non-legacy systems may route legacy VGA MMIO range to system

View File

@ -274,10 +274,6 @@ void __init setup_arch(char **cmdline_p)
parse_early_param(); parse_early_param();
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
switch (m68k_machtype) { switch (m68k_machtype) {
#ifdef CONFIG_AMIGA #ifdef CONFIG_AMIGA
case MACH_AMIGA: case MACH_AMIGA:

View File

@ -146,10 +146,6 @@ void __init setup_arch(char **cmdline_p)
memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
boot_command_line[COMMAND_LINE_SIZE-1] = 0; boot_command_line[COMMAND_LINE_SIZE-1] = 0;
#if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif
/* /*
* Give all the memory to the bootmap allocator, tell it to put the * Give all the memory to the bootmap allocator, tell it to put the
* boot mem_map at the start of memory. * boot mem_map at the start of memory.

View File

@ -70,7 +70,6 @@ void __init config_sun3x(void)
break; break;
default: default:
serial_console = 0; serial_console = 0;
conswitchp = &dummy_con;
break; break;
} }
#endif #endif

View File

@ -65,10 +65,6 @@ void __init setup_arch(char **cmdline_p)
microblaze_cache_init(); microblaze_cache_init();
xilinx_pci_init(); xilinx_pci_init();
#if defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif
} }
#ifdef CONFIG_MTD_UCLINUX #ifdef CONFIG_MTD_UCLINUX

View File

@ -796,8 +796,6 @@ void __init setup_arch(char **cmdline_p)
#if defined(CONFIG_VT) #if defined(CONFIG_VT)
#if defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_VGA_CONSOLE)
conswitchp = &vga_con; conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif #endif
#endif #endif

View File

@ -317,11 +317,6 @@ void __init setup_arch(char **cmdline_p)
unflatten_and_copy_device_tree(); unflatten_and_copy_device_tree();
if(IS_ENABLED(CONFIG_VT)) {
if(IS_ENABLED(CONFIG_DUMMY_CONSOLE))
conswitchp = &dummy_con;
}
*cmdline_p = boot_command_line; *cmdline_p = boot_command_line;
early_trap_init(); early_trap_init();
} }

View File

@ -196,8 +196,4 @@ void __init setup_arch(char **cmdline_p)
* get kmalloc into gear * get kmalloc into gear
*/ */
paging_init(); paging_init();
#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif
} }

View File

@ -308,11 +308,6 @@ void __init setup_arch(char **cmdline_p)
/* paging_init() sets up the MMU and marks all pages as reserved */ /* paging_init() sets up the MMU and marks all pages as reserved */
paging_init(); paging_init();
#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
if (!conswitchp)
conswitchp = &dummy_con;
#endif
*cmdline_p = boot_command_line; *cmdline_p = boot_command_line;
printk(KERN_INFO "OpenRISC Linux -- http://openrisc.io\n"); printk(KERN_INFO "OpenRISC Linux -- http://openrisc.io\n");

View File

@ -151,10 +151,6 @@ void __init setup_arch(char **cmdline_p)
dma_ops_init(); dma_ops_init();
#endif #endif
#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con; /* we use do_take_over_console() later ! */
#endif
clear_sched_clock_stable(); clear_sched_clock_stable();
} }

View File

@ -479,8 +479,10 @@ static void __init fixup_port_irq(int index,
port->irq = virq; port->irq = virq;
#ifdef CONFIG_SERIAL_8250_FSL #ifdef CONFIG_SERIAL_8250_FSL
if (of_device_is_compatible(np, "fsl,ns16550")) if (of_device_is_compatible(np, "fsl,ns16550")) {
port->handle_irq = fsl8250_handle_irq; port->handle_irq = fsl8250_handle_irq;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
}
#endif #endif
} }

View File

@ -949,9 +949,6 @@ void __init setup_arch(char **cmdline_p)
early_memtest(min_low_pfn << PAGE_SHIFT, max_low_pfn << PAGE_SHIFT); early_memtest(min_low_pfn << PAGE_SHIFT, max_low_pfn << PAGE_SHIFT);
if (IS_ENABLED(CONFIG_DUMMY_CONSOLE))
conswitchp = &dummy_con;
if (ppc_md.setup_arch) if (ppc_md.setup_arch)
ppc_md.setup_arch(); ppc_md.setup_arch();

View File

@ -240,9 +240,6 @@ static void __init cell_setup_arch(void)
init_pci_config_tokens(); init_pci_config_tokens();
cbe_pervasive_init(); cbe_pervasive_init();
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
mmio_nvram_init(); mmio_nvram_init();
} }

View File

@ -183,9 +183,6 @@ static void __init maple_setup_arch(void)
/* Lookup PCI hosts */ /* Lookup PCI hosts */
maple_pci_init(); maple_pci_init();
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
maple_use_rtas_reboot_and_halt_if_present(); maple_use_rtas_reboot_and_halt_if_present();
printk(KERN_DEBUG "Using native/NAP idle loop\n"); printk(KERN_DEBUG "Using native/NAP idle loop\n");

View File

@ -147,10 +147,6 @@ static void __init pas_setup_arch(void)
/* Lookup PCI hosts */ /* Lookup PCI hosts */
pas_pci_init(); pas_pci_init();
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
/* Remap SDC register for doing reset */ /* Remap SDC register for doing reset */
/* XXXOJN This should maybe come out of the device tree */ /* XXXOJN This should maybe come out of the device tree */
reset_reg = ioremap(0xfc101100, 4); reset_reg = ioremap(0xfc101100, 4);

View File

@ -200,10 +200,6 @@ static void __init ps3_setup_arch(void)
smp_init_ps3(); smp_init_ps3();
#endif #endif
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
prealloc_ps3fb_videomemory(); prealloc_ps3fb_videomemory();
prealloc_ps3flash_bounce_buffer(); prealloc_ps3flash_bounce_buffer();

View File

@ -78,9 +78,5 @@ void __init setup_arch(char **cmdline_p)
setup_smp(); setup_smp();
#endif #endif
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
riscv_fill_hwcap(); riscv_fill_hwcap();
} }

View File

@ -241,8 +241,6 @@ static void __init conmode_default(void)
SET_CONSOLE_SCLP; SET_CONSOLE_SCLP;
#endif #endif
} }
if (IS_ENABLED(CONFIG_VT) && IS_ENABLED(CONFIG_DUMMY_CONSOLE))
conswitchp = &dummy_con;
} }
#ifdef CONFIG_CRASH_DUMP #ifdef CONFIG_CRASH_DUMP

View File

@ -341,10 +341,6 @@ void __init setup_arch(char **cmdline_p)
paging_init(); paging_init();
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
/* Perform the machine specific initialisation */ /* Perform the machine specific initialisation */
if (likely(sh_mv.mv_setup)) if (likely(sh_mv.mv_setup))
sh_mv.mv_setup(cmdline_p); sh_mv.mv_setup(cmdline_p);

View File

@ -332,10 +332,6 @@ void __init setup_arch(char **cmdline_p)
break; break;
} }
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
idprom_init(); idprom_init();
load_mmu(); load_mmu();

View File

@ -653,10 +653,6 @@ void __init setup_arch(char **cmdline_p)
else else
pr_info("ARCH: SUN4U\n"); pr_info("ARCH: SUN4U\n");
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
idprom_init(); idprom_init();
if (!root_flags) if (!root_flags)

View File

@ -270,8 +270,6 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_VT #ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_VGA_CONSOLE)
conswitchp = &vga_con; conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif #endif
#endif #endif
early_trap_init(); early_trap_init();

View File

@ -1228,8 +1228,6 @@ void __init setup_arch(char **cmdline_p)
#if defined(CONFIG_VGA_CONSOLE) #if defined(CONFIG_VGA_CONSOLE)
if (!efi_enabled(EFI_BOOT) || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY)) if (!efi_enabled(EFI_BOOT) || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY))
conswitchp = &vga_con; conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif #endif
#endif #endif
x86_init.oem.banner(); x86_init.oem.banner();

View File

@ -405,8 +405,6 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_VT #ifdef CONFIG_VT
# if defined(CONFIG_VGA_CONSOLE) # if defined(CONFIG_VGA_CONSOLE)
conswitchp = &vga_con; conswitchp = &vga_con;
# elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
# endif # endif
#endif #endif
} }

View File

@ -15,10 +15,11 @@
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/spinlock.h>
struct ttyprintk_port { struct ttyprintk_port {
struct tty_port port; struct tty_port port;
struct mutex port_write_mutex; spinlock_t spinlock;
}; };
static struct ttyprintk_port tpk_port; static struct ttyprintk_port tpk_port;
@ -99,11 +100,12 @@ static int tpk_open(struct tty_struct *tty, struct file *filp)
static void tpk_close(struct tty_struct *tty, struct file *filp) static void tpk_close(struct tty_struct *tty, struct file *filp)
{ {
struct ttyprintk_port *tpkp = tty->driver_data; struct ttyprintk_port *tpkp = tty->driver_data;
unsigned long flags;
mutex_lock(&tpkp->port_write_mutex); spin_lock_irqsave(&tpkp->spinlock, flags);
/* flush tpk_printk buffer */ /* flush tpk_printk buffer */
tpk_printk(NULL, 0); tpk_printk(NULL, 0);
mutex_unlock(&tpkp->port_write_mutex); spin_unlock_irqrestore(&tpkp->spinlock, flags);
tty_port_close(&tpkp->port, tty, filp); tty_port_close(&tpkp->port, tty, filp);
} }
@ -115,13 +117,14 @@ static int tpk_write(struct tty_struct *tty,
const unsigned char *buf, int count) const unsigned char *buf, int count)
{ {
struct ttyprintk_port *tpkp = tty->driver_data; struct ttyprintk_port *tpkp = tty->driver_data;
unsigned long flags;
int ret; int ret;
/* exclusive use of tpk_printk within this tty */ /* exclusive use of tpk_printk within this tty */
mutex_lock(&tpkp->port_write_mutex); spin_lock_irqsave(&tpkp->spinlock, flags);
ret = tpk_printk(buf, count); ret = tpk_printk(buf, count);
mutex_unlock(&tpkp->port_write_mutex); spin_unlock_irqrestore(&tpkp->spinlock, flags);
return ret; return ret;
} }
@ -171,7 +174,7 @@ static int __init ttyprintk_init(void)
{ {
int ret = -ENOMEM; int ret = -ENOMEM;
mutex_init(&tpk_port.port_write_mutex); spin_lock_init(&tpk_port.spinlock);
ttyprintk_driver = tty_alloc_driver(1, ttyprintk_driver = tty_alloc_driver(1,
TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_RESET_TERMIOS |

View File

@ -115,11 +115,9 @@
struct n_hdlc_buf { struct n_hdlc_buf {
struct list_head list_item; struct list_head list_item;
int count; int count;
char buf[1]; char buf[];
}; };
#define N_HDLC_BUF_SIZE (sizeof(struct n_hdlc_buf) + maxframe)
struct n_hdlc_buf_list { struct n_hdlc_buf_list {
struct list_head list; struct list_head list;
int count; int count;
@ -524,7 +522,8 @@ static void n_hdlc_tty_receive(struct tty_struct *tty, const __u8 *data,
/* no buffers in free list, attempt to allocate another rx buffer */ /* no buffers in free list, attempt to allocate another rx buffer */
/* unless the maximum count has been reached */ /* unless the maximum count has been reached */
if (n_hdlc->rx_buf_list.count < MAX_RX_BUF_COUNT) if (n_hdlc->rx_buf_list.count < MAX_RX_BUF_COUNT)
buf = kmalloc(N_HDLC_BUF_SIZE, GFP_ATOMIC); buf = kmalloc(struct_size(buf, buf, maxframe),
GFP_ATOMIC);
} }
if (!buf) { if (!buf) {
@ -853,7 +852,7 @@ static struct n_hdlc *n_hdlc_alloc(void)
/* allocate free rx buffer list */ /* allocate free rx buffer list */
for(i=0;i<DEFAULT_RX_BUF_COUNT;i++) { for(i=0;i<DEFAULT_RX_BUF_COUNT;i++) {
buf = kmalloc(N_HDLC_BUF_SIZE, GFP_KERNEL); buf = kmalloc(struct_size(buf, buf, maxframe), GFP_KERNEL);
if (buf) if (buf)
n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,buf); n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,buf);
else if (debuglevel >= DEBUG_LEVEL_INFO) else if (debuglevel >= DEBUG_LEVEL_INFO)
@ -862,7 +861,7 @@ static struct n_hdlc *n_hdlc_alloc(void)
/* allocate free tx buffer list */ /* allocate free tx buffer list */
for(i=0;i<DEFAULT_TX_BUF_COUNT;i++) { for(i=0;i<DEFAULT_TX_BUF_COUNT;i++) {
buf = kmalloc(N_HDLC_BUF_SIZE, GFP_KERNEL); buf = kmalloc(struct_size(buf, buf, maxframe), GFP_KERNEL);
if (buf) if (buf)
n_hdlc_buf_put(&n_hdlc->tx_free_buf_list,buf); n_hdlc_buf_put(&n_hdlc->tx_free_buf_list,buf);
else if (debuglevel >= DEBUG_LEVEL_INFO) else if (debuglevel >= DEBUG_LEVEL_INFO)

View File

@ -115,8 +115,8 @@ int serdev_device_add(struct serdev_device *serdev)
err = device_add(&serdev->dev); err = device_add(&serdev->dev);
if (err < 0) { if (err < 0) {
dev_err(&serdev->dev, "Can't add %s, status %d\n", dev_err(&serdev->dev, "Can't add %s, status %pe\n",
dev_name(&serdev->dev), err); dev_name(&serdev->dev), ERR_PTR(err));
goto err_clear_serdev; goto err_clear_serdev;
} }
@ -540,7 +540,8 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl)
err = serdev_device_add(serdev); err = serdev_device_add(serdev);
if (err) { if (err) {
dev_err(&serdev->dev, dev_err(&serdev->dev,
"failure adding device. status %d\n", err); "failure adding device. status %pe\n",
ERR_PTR(err));
serdev_device_put(serdev); serdev_device_put(serdev);
} else } else
found = true; found = true;
@ -656,7 +657,8 @@ static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl,
err = serdev_device_add(serdev); err = serdev_device_add(serdev);
if (err) { if (err) {
dev_err(&serdev->dev, dev_err(&serdev->dev,
"failure adding ACPI serdev device. status %d\n", err); "failure adding ACPI serdev device. status %pe\n",
ERR_PTR(err));
serdev_device_put(serdev); serdev_device_put(serdev);
} }
@ -741,8 +743,8 @@ int serdev_controller_add(struct serdev_controller *ctrl)
ret_of = of_serdev_register_devices(ctrl); ret_of = of_serdev_register_devices(ctrl);
ret_acpi = acpi_serdev_register_devices(ctrl); ret_acpi = acpi_serdev_register_devices(ctrl);
if (ret_of && ret_acpi) { if (ret_of && ret_acpi) {
dev_dbg(&ctrl->dev, "no devices registered: of:%d acpi:%d\n", dev_dbg(&ctrl->dev, "no devices registered: of:%pe acpi:%pe\n",
ret_of, ret_acpi); ERR_PTR(ret_of), ERR_PTR(ret_acpi));
ret = -ENODEV; ret = -ENODEV;
goto err_rpm_disable; goto err_rpm_disable;
} }

View File

@ -41,8 +41,43 @@
static const char serial21285_name[] = "Footbridge UART"; static const char serial21285_name[] = "Footbridge UART";
#define tx_enabled(port) ((port)->unused[0]) /*
#define rx_enabled(port) ((port)->unused[1]) * We only need 2 bits of data, so instead of creating a whole structure for
* this, use bits of the private_data pointer of the uart port structure.
*/
#define tx_enabled_bit 0
#define rx_enabled_bit 1
static bool is_enabled(struct uart_port *port, int bit)
{
unsigned long private_data = (unsigned long)port->private_data;
if (test_bit(bit, &private_data))
return true;
return false;
}
static void enable(struct uart_port *port, int bit)
{
unsigned long private_data = (unsigned long)port->private_data;
set_bit(bit, &private_data);
}
static void disable(struct uart_port *port, int bit)
{
unsigned long private_data = (unsigned long)port->private_data;
clear_bit(bit, &private_data);
}
#define is_tx_enabled(port) is_enabled(port, tx_enabled_bit)
#define tx_enable(port) enable(port, tx_enabled_bit)
#define tx_disable(port) disable(port, tx_enabled_bit)
#define is_rx_enabled(port) is_enabled(port, rx_enabled_bit)
#define rx_enable(port) enable(port, rx_enabled_bit)
#define rx_disable(port) disable(port, rx_enabled_bit)
/* /*
* The documented expression for selecting the divisor is: * The documented expression for selecting the divisor is:
@ -57,25 +92,25 @@ static const char serial21285_name[] = "Footbridge UART";
static void serial21285_stop_tx(struct uart_port *port) static void serial21285_stop_tx(struct uart_port *port)
{ {
if (tx_enabled(port)) { if (is_tx_enabled(port)) {
disable_irq_nosync(IRQ_CONTX); disable_irq_nosync(IRQ_CONTX);
tx_enabled(port) = 0; tx_disable(port);
} }
} }
static void serial21285_start_tx(struct uart_port *port) static void serial21285_start_tx(struct uart_port *port)
{ {
if (!tx_enabled(port)) { if (!is_tx_enabled(port)) {
enable_irq(IRQ_CONTX); enable_irq(IRQ_CONTX);
tx_enabled(port) = 1; tx_enable(port);
} }
} }
static void serial21285_stop_rx(struct uart_port *port) static void serial21285_stop_rx(struct uart_port *port)
{ {
if (rx_enabled(port)) { if (is_rx_enabled(port)) {
disable_irq_nosync(IRQ_CONRX); disable_irq_nosync(IRQ_CONRX);
rx_enabled(port) = 0; rx_disable(port);
} }
} }
@ -185,8 +220,8 @@ static int serial21285_startup(struct uart_port *port)
{ {
int ret; int ret;
tx_enabled(port) = 1; tx_enable(port);
rx_enabled(port) = 1; rx_enable(port);
ret = request_irq(IRQ_CONRX, serial21285_rx_chars, 0, ret = request_irq(IRQ_CONRX, serial21285_rx_chars, 0,
serial21285_name, port); serial21285_name, port);

View File

@ -5,10 +5,6 @@
* Copyright (C) 2016 Jeremy Kerr <jk@ozlabs.org>, IBM Corp. * Copyright (C) 2016 Jeremy Kerr <jk@ozlabs.org>, IBM Corp.
* Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp. * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp.
*/ */
#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/device.h> #include <linux/device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_address.h> #include <linux/of_address.h>
@ -406,6 +402,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev)
port.port.unthrottle = aspeed_vuart_unthrottle; port.port.unthrottle = aspeed_vuart_unthrottle;
port.port.status = UPSTAT_SYNC_FIFO; port.port.status = UPSTAT_SYNC_FIFO;
port.port.dev = &pdev->dev; port.port.dev = &pdev->dev;
port.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);
if (rc < 0) if (rc < 0)

View File

@ -16,14 +16,19 @@
#include "8250.h" #include "8250.h"
/**
* struct bcm2835aux_data - driver private data of BCM2835 auxiliary UART
* @clk: clock producer of the port's uartclk
* @line: index of the port's serial8250_ports[] entry
*/
struct bcm2835aux_data { struct bcm2835aux_data {
struct uart_8250_port uart;
struct clk *clk; struct clk *clk;
int line; int line;
}; };
static int bcm2835aux_serial_probe(struct platform_device *pdev) static int bcm2835aux_serial_probe(struct platform_device *pdev)
{ {
struct uart_8250_port up = { };
struct bcm2835aux_data *data; struct bcm2835aux_data *data;
struct resource *res; struct resource *res;
int ret; int ret;
@ -34,23 +39,21 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
/* initialize data */ /* initialize data */
spin_lock_init(&data->uart.port.lock); up.capabilities = UART_CAP_FIFO | UART_CAP_MINI;
data->uart.capabilities = UART_CAP_FIFO | UART_CAP_MINI; up.port.dev = &pdev->dev;
data->uart.port.dev = &pdev->dev; up.port.regshift = 2;
data->uart.port.regshift = 2; up.port.type = PORT_16550;
data->uart.port.type = PORT_16550; up.port.iotype = UPIO_MEM;
data->uart.port.iotype = UPIO_MEM; up.port.fifosize = 8;
data->uart.port.fifosize = 8; up.port.flags = UPF_SHARE_IRQ | UPF_FIXED_PORT | UPF_FIXED_TYPE |
data->uart.port.flags = UPF_SHARE_IRQ | UPF_SKIP_TEST | UPF_IOREMAP;
UPF_FIXED_PORT |
UPF_FIXED_TYPE |
UPF_SKIP_TEST;
/* get the clock - this also enables the HW */ /* get the clock - this also enables the HW */
data->clk = devm_clk_get(&pdev->dev, NULL); data->clk = devm_clk_get(&pdev->dev, NULL);
ret = PTR_ERR_OR_ZERO(data->clk); ret = PTR_ERR_OR_ZERO(data->clk);
if (ret) { if (ret) {
dev_err(&pdev->dev, "could not get clk: %d\n", ret); if (ret != -EPROBE_DEFER)
dev_err(&pdev->dev, "could not get clk: %d\n", ret);
return ret; return ret;
} }
@ -58,7 +61,7 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
ret = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
if (ret < 0) if (ret < 0)
return ret; return ret;
data->uart.port.irq = ret; up.port.irq = ret;
/* map the main registers */ /* map the main registers */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@ -66,15 +69,13 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "memory resource not found"); dev_err(&pdev->dev, "memory resource not found");
return -EINVAL; return -EINVAL;
} }
data->uart.port.membase = devm_ioremap_resource(&pdev->dev, res); up.port.mapbase = res->start;
ret = PTR_ERR_OR_ZERO(data->uart.port.membase); up.port.mapsize = resource_size(res);
if (ret)
return ret;
/* Check for a fixed line number */ /* Check for a fixed line number */
ret = of_alias_get_id(pdev->dev.of_node, "serial"); ret = of_alias_get_id(pdev->dev.of_node, "serial");
if (ret >= 0) if (ret >= 0)
data->uart.port.line = ret; up.port.line = ret;
/* enable the clock as a last step */ /* enable the clock as a last step */
ret = clk_prepare_enable(data->clk); ret = clk_prepare_enable(data->clk);
@ -89,13 +90,14 @@ static int bcm2835aux_serial_probe(struct platform_device *pdev)
* so we have to multiply the actual clock by 2 * so we have to multiply the actual clock by 2
* to get identical baudrates. * to get identical baudrates.
*/ */
data->uart.port.uartclk = clk_get_rate(data->clk) * 2; up.port.uartclk = clk_get_rate(data->clk) * 2;
/* register the port */ /* register the port */
ret = serial8250_register_8250_port(&data->uart); ret = serial8250_register_8250_port(&up);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "unable to register 8250 port - %d\n", if (ret != -EPROBE_DEFER)
ret); dev_err(&pdev->dev,
"unable to register 8250 port - %d\n", ret);
goto dis_clk; goto dis_clk;
} }
data->line = ret; data->line = ret;
@ -113,7 +115,7 @@ static int bcm2835aux_serial_remove(struct platform_device *pdev)
{ {
struct bcm2835aux_data *data = platform_get_drvdata(pdev); struct bcm2835aux_data *data = platform_get_drvdata(pdev);
serial8250_unregister_port(data->uart.port.line); serial8250_unregister_port(data->line);
clk_disable_unprepare(data->clk); clk_disable_unprepare(data->clk);
return 0; return 0;

View File

@ -816,6 +816,7 @@ static int serial8250_probe(struct platform_device *dev)
uart.port.flags = p->flags; uart.port.flags = p->flags;
uart.port.mapbase = p->mapbase; uart.port.mapbase = p->mapbase;
uart.port.hub6 = p->hub6; uart.port.hub6 = p->hub6;
uart.port.has_sysrq = p->has_sysrq;
uart.port.private_data = p->private_data; uart.port.private_data = p->private_data;
uart.port.type = p->type; uart.port.type = p->type;
uart.port.serial_in = p->serial_in; uart.port.serial_in = p->serial_in;

View File

@ -186,7 +186,7 @@ static int xr17v35x_startup(struct uart_port *port)
static void exar_shutdown(struct uart_port *port) static void exar_shutdown(struct uart_port *port)
{ {
unsigned char lsr; unsigned char lsr;
bool tx_complete = 0; bool tx_complete = false;
struct uart_8250_port *up = up_to_u8250p(port); struct uart_8250_port *up = up_to_u8250p(port);
struct circ_buf *xmit = &port->state->xmit; struct circ_buf *xmit = &port->state->xmit;
int i = 0; int i = 0;
@ -194,9 +194,9 @@ static void exar_shutdown(struct uart_port *port)
do { do {
lsr = serial_in(up, UART_LSR); lsr = serial_in(up, UART_LSR);
if (lsr & (UART_LSR_TEMT | UART_LSR_THRE)) if (lsr & (UART_LSR_TEMT | UART_LSR_THRE))
tx_complete = 1; tx_complete = true;
else else
tx_complete = 0; tx_complete = false;
usleep_range(1000, 1100); usleep_range(1000, 1100);
} while (!uart_circ_empty(xmit) && !tx_complete && i++ < 1000); } while (!uart_circ_empty(xmit) && !tx_complete && i++ < 1000);

View File

@ -1,8 +1,4 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <linux/serial_8250.h> #include <linux/serial_8250.h>

View File

@ -222,8 +222,10 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
if (IS_ENABLED(CONFIG_SERIAL_8250_FSL) && if (IS_ENABLED(CONFIG_SERIAL_8250_FSL) &&
(of_device_is_compatible(np, "fsl,ns16550") || (of_device_is_compatible(np, "fsl,ns16550") ||
of_device_is_compatible(np, "fsl,16550-FIFO64"))) of_device_is_compatible(np, "fsl,16550-FIFO64"))) {
port->handle_irq = fsl8250_handle_irq; port->handle_irq = fsl8250_handle_irq;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
}
return 0; return 0;
err_unprepare: err_unprepare:

View File

@ -8,10 +8,6 @@
* *
*/ */
#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/io.h> #include <linux/io.h>
@ -1192,6 +1188,7 @@ static int omap8250_probe(struct platform_device *pdev)
up.port.throttle = omap_8250_throttle; up.port.throttle = omap_8250_throttle;
up.port.unthrottle = omap_8250_unthrottle; up.port.unthrottle = omap_8250_unthrottle;
up.port.rs485_config = omap_8250_rs485_config; up.port.rs485_config = omap_8250_rs485_config;
up.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
ret = of_alias_get_id(np, "serial"); ret = of_alias_get_id(np, "serial");
if (ret < 0) { if (ret < 0) {

View File

@ -11,10 +11,6 @@
* membase is an 'ioremapped' cookie. * membase is an 'ioremapped' cookie.
*/ */
#if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/ioport.h> #include <linux/ioport.h>
@ -1001,6 +997,9 @@ static void autoconfig_16550a(struct uart_8250_port *up)
up->port.type = PORT_16550A; up->port.type = PORT_16550A;
up->capabilities |= UART_CAP_FIFO; up->capabilities |= UART_CAP_FIFO;
if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS))
return;
/* /*
* Check for presence of the EFR when DLAB is set. * Check for presence of the EFR when DLAB is set.
* Only ST16C650V1 UARTs pass this test. * Only ST16C650V1 UARTs pass this test.
@ -3055,6 +3054,7 @@ void serial8250_init_port(struct uart_8250_port *up)
spin_lock_init(&port->lock); spin_lock_init(&port->lock);
port->ops = &serial8250_pops; port->ops = &serial8250_pops;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
up->cur_iotype = 0xFF; up->cur_iotype = 0xFF;
} }

View File

@ -60,6 +60,16 @@ config SERIAL_8250_PNP
This builds standard PNP serial support. You may be able to This builds standard PNP serial support. You may be able to
disable this feature if you only need legacy serial support. disable this feature if you only need legacy serial support.
config SERIAL_8250_16550A_VARIANTS
bool "Support for variants of the 16550A serial port"
depends on SERIAL_8250
help
The 8250 driver can probe for many variants of the venerable 16550A
serial port. Doing so takes additional time at boot.
On modern systems, especially those using serial only for a simple
console, you can say N here.
config SERIAL_8250_FINTEK config SERIAL_8250_FINTEK
bool "Support for Fintek F81216A LPC to 4 UART RS485 API" bool "Support for Fintek F81216A LPC to 4 UART RS485 API"
depends on SERIAL_8250 depends on SERIAL_8250

View File

@ -237,7 +237,7 @@ config SERIAL_CLPS711X_CONSOLE
config SERIAL_SAMSUNG config SERIAL_SAMSUNG
tristate "Samsung SoC serial support" tristate "Samsung SoC serial support"
depends on PLAT_SAMSUNG || ARCH_EXYNOS depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST
select SERIAL_CORE select SERIAL_CORE
help help
Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, Support for the on-chip UARTs on the Samsung S3C24XX series CPUs,
@ -975,7 +975,7 @@ config SERIAL_QCOM_GENI
config SERIAL_QCOM_GENI_CONSOLE config SERIAL_QCOM_GENI_CONSOLE
bool "QCOM GENI Serial Console support" bool "QCOM GENI Serial Console support"
depends on SERIAL_QCOM_GENI=y depends on SERIAL_QCOM_GENI
select SERIAL_CORE_CONSOLE select SERIAL_CORE_CONSOLE
select SERIAL_EARLYCON select SERIAL_EARLYCON
help help

View File

@ -15,10 +15,6 @@
* and hooked into this driver. * and hooked into this driver.
*/ */
#if defined(CONFIG_SERIAL_AMBA_PL010_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
@ -728,6 +724,7 @@ static int pl010_probe(struct amba_device *dev, const struct amba_id *id)
uap->port.iotype = UPIO_MEM; uap->port.iotype = UPIO_MEM;
uap->port.irq = dev->irq[0]; uap->port.irq = dev->irq[0];
uap->port.fifosize = 16; uap->port.fifosize = 16;
uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_AMBA_PL010_CONSOLE);
uap->port.ops = &amba_pl010_pops; uap->port.ops = &amba_pl010_pops;
uap->port.flags = UPF_BOOT_AUTOCONF; uap->port.flags = UPF_BOOT_AUTOCONF;
uap->port.line = i; uap->port.line = i;

View File

@ -16,11 +16,6 @@
* and hooked into this driver. * and hooked into this driver.
*/ */
#if defined(CONFIG_SERIAL_AMBA_PL011_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
@ -1452,8 +1447,6 @@ static void pl011_modem_status(struct uart_amba_port *uap)
static void check_apply_cts_event_workaround(struct uart_amba_port *uap) static void check_apply_cts_event_workaround(struct uart_amba_port *uap)
{ {
unsigned int dummy_read;
if (!uap->vendor->cts_event_workaround) if (!uap->vendor->cts_event_workaround)
return; return;
@ -1465,8 +1458,8 @@ static void check_apply_cts_event_workaround(struct uart_amba_port *uap)
* single apb access will incur 2 pclk(133.12Mhz) delay, * single apb access will incur 2 pclk(133.12Mhz) delay,
* so add 2 dummy reads * so add 2 dummy reads
*/ */
dummy_read = pl011_read(uap, REG_ICR); pl011_read(uap, REG_ICR);
dummy_read = pl011_read(uap, REG_ICR); pl011_read(uap, REG_ICR);
} }
static irqreturn_t pl011_int(int irq, void *dev_id) static irqreturn_t pl011_int(int irq, void *dev_id)
@ -2579,6 +2572,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
uap->port.mapbase = mmiobase->start; uap->port.mapbase = mmiobase->start;
uap->port.membase = base; uap->port.membase = base;
uap->port.fifosize = uap->fifosize; uap->port.fifosize = uap->fifosize;
uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_AMBA_PL011_CONSOLE);
uap->port.flags = UPF_BOOT_AUTOCONF; uap->port.flags = UPF_BOOT_AUTOCONF;
uap->port.line = index; uap->port.line = index;
@ -2769,6 +2763,7 @@ static struct platform_driver arm_sbsa_uart_platform_driver = {
.remove = sbsa_uart_remove, .remove = sbsa_uart_remove,
.driver = { .driver = {
.name = "sbsa-uart", .name = "sbsa-uart",
.pm = &pl011_dev_pm_ops,
.of_match_table = of_match_ptr(sbsa_uart_of_match), .of_match_table = of_match_ptr(sbsa_uart_of_match),
.acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match), .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match),
.suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011), .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011),

View File

@ -11,10 +11,6 @@
* Copyright (C) 2009 Kristoffer Glembo <kristoffer@gaisler.com>, Aeroflex Gaisler AB * Copyright (C) 2009 Kristoffer Glembo <kristoffer@gaisler.com>, Aeroflex Gaisler AB
*/ */
#if defined(CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/tty_flip.h> #include <linux/tty_flip.h>
@ -626,6 +622,7 @@ static int __init grlib_apbuart_configure(void)
port->irq = 0; port->irq = 0;
port->iotype = UPIO_MEM; port->iotype = UPIO_MEM;
port->ops = &grlib_apbuart_ops; port->ops = &grlib_apbuart_ops;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE);
port->flags = UPF_BOOT_AUTOCONF; port->flags = UPF_BOOT_AUTOCONF;
port->line = line; port->line = line;
port->uartclk = *freq_hz; port->uartclk = *freq_hz;

View File

@ -21,10 +21,6 @@
* -check if sysreq works * -check if sysreq works
*/ */
#if defined(CONFIG_SERIAL_ARC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/console.h> #include <linux/console.h>
@ -625,6 +621,7 @@ static int arc_serial_probe(struct platform_device *pdev)
port->flags = UPF_BOOT_AUTOCONF; port->flags = UPF_BOOT_AUTOCONF;
port->line = dev_id; port->line = dev_id;
port->ops = &arc_serial_pops; port->ops = &arc_serial_pops;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ARC_CONSOLE);
port->fifosize = ARC_UART_TX_FIFO_SIZE; port->fifosize = ARC_UART_TX_FIFO_SIZE;

View File

@ -51,10 +51,6 @@
#define ATMEL_RTS_HIGH_OFFSET 16 #define ATMEL_RTS_HIGH_OFFSET 16
#define ATMEL_RTS_LOW_OFFSET 20 #define ATMEL_RTS_LOW_OFFSET 20
#if defined(CONFIG_SERIAL_ATMEL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include "serial_mctrl_gpio.h" #include "serial_mctrl_gpio.h"
@ -196,10 +192,6 @@ struct atmel_uart_port {
static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART]; static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART];
static DECLARE_BITMAP(atmel_ports_in_use, ATMEL_MAX_UART); static DECLARE_BITMAP(atmel_ports_in_use, ATMEL_MAX_UART);
#ifdef SUPPORT_SYSRQ
static struct console atmel_console;
#endif
#if defined(CONFIG_OF) #if defined(CONFIG_OF)
static const struct of_device_id atmel_serial_dt_ids[] = { static const struct of_device_id atmel_serial_dt_ids[] = {
{ .compatible = "atmel,at91rm9200-usart-serial" }, { .compatible = "atmel,at91rm9200-usart-serial" },
@ -313,7 +305,11 @@ static int atmel_config_rs485(struct uart_port *port,
if (rs485conf->flags & SER_RS485_ENABLED) { if (rs485conf->flags & SER_RS485_ENABLED) {
dev_dbg(port->dev, "Setting UART to RS485\n"); dev_dbg(port->dev, "Setting UART to RS485\n");
atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; if (port->rs485.flags & SER_RS485_RX_DURING_TX)
atmel_port->tx_done_mask = ATMEL_US_TXRDY;
else
atmel_port->tx_done_mask = ATMEL_US_TXEMPTY;
atmel_uart_writel(port, ATMEL_US_TTGR, atmel_uart_writel(port, ATMEL_US_TTGR,
rs485conf->delay_rts_after_send); rs485conf->delay_rts_after_send);
mode |= ATMEL_US_USMODE_RS485; mode |= ATMEL_US_USMODE_RS485;
@ -831,7 +827,7 @@ static void atmel_tx_chars(struct uart_port *port)
struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
if (port->x_char && if (port->x_char &&
(atmel_uart_readl(port, ATMEL_US_CSR) & atmel_port->tx_done_mask)) { (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY)) {
atmel_uart_write_char(port, port->x_char); atmel_uart_write_char(port, port->x_char);
port->icount.tx++; port->icount.tx++;
port->x_char = 0; port->x_char = 0;
@ -839,8 +835,7 @@ static void atmel_tx_chars(struct uart_port *port)
if (uart_circ_empty(xmit) || uart_tx_stopped(port)) if (uart_circ_empty(xmit) || uart_tx_stopped(port))
return; return;
while (atmel_uart_readl(port, ATMEL_US_CSR) & while (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY) {
atmel_port->tx_done_mask) {
atmel_uart_write_char(port, xmit->buf[xmit->tail]); atmel_uart_write_char(port, xmit->buf[xmit->tail]);
xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
port->icount.tx++; port->icount.tx++;
@ -851,10 +846,20 @@ static void atmel_tx_chars(struct uart_port *port)
if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
uart_write_wakeup(port); uart_write_wakeup(port);
if (!uart_circ_empty(xmit)) if (!uart_circ_empty(xmit)) {
/* we still have characters to transmit, so we should continue
* transmitting them when TX is ready, regardless of
* mode or duplexity
*/
atmel_port->tx_done_mask |= ATMEL_US_TXRDY;
/* Enable interrupts */ /* Enable interrupts */
atmel_uart_writel(port, ATMEL_US_IER, atmel_uart_writel(port, ATMEL_US_IER,
atmel_port->tx_done_mask); atmel_port->tx_done_mask);
} else {
if (atmel_uart_is_half_duplex(port))
atmel_port->tx_done_mask &= ~ATMEL_US_TXRDY;
}
} }
static void atmel_complete_tx_dma(void *arg) static void atmel_complete_tx_dma(void *arg)
@ -1067,7 +1072,7 @@ static int atmel_prepare_tx_dma(struct uart_port *port)
chan_err: chan_err:
dev_err(port->dev, "TX channel not available, switch to pio\n"); dev_err(port->dev, "TX channel not available, switch to pio\n");
atmel_port->use_dma_tx = 0; atmel_port->use_dma_tx = false;
if (atmel_port->chan_tx) if (atmel_port->chan_tx)
atmel_release_tx_dma(port); atmel_release_tx_dma(port);
return -EINVAL; return -EINVAL;
@ -1266,7 +1271,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
chan_err: chan_err:
dev_err(port->dev, "RX channel not available, switch to pio\n"); dev_err(port->dev, "RX channel not available, switch to pio\n");
atmel_port->use_dma_rx = 0; atmel_port->use_dma_rx = false;
if (atmel_port->chan_rx) if (atmel_port->chan_rx)
atmel_release_rx_dma(port); atmel_release_rx_dma(port);
return -EINVAL; return -EINVAL;
@ -1693,7 +1698,7 @@ static int atmel_prepare_rx_pdc(struct uart_port *port)
DMA_FROM_DEVICE); DMA_FROM_DEVICE);
kfree(atmel_port->pdc_rx[0].buf); kfree(atmel_port->pdc_rx[0].buf);
} }
atmel_port->use_pdc_rx = 0; atmel_port->use_pdc_rx = false;
return -ENOMEM; return -ENOMEM;
} }
pdc->dma_addr = dma_map_single(port->dev, pdc->dma_addr = dma_map_single(port->dev,
@ -2526,8 +2531,7 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port,
* Use TXEMPTY for interrupt when rs485 or ISO7816 else TXRDY or * Use TXEMPTY for interrupt when rs485 or ISO7816 else TXRDY or
* ENDTX|TXBUFE * ENDTX|TXBUFE
*/ */
if (port->rs485.flags & SER_RS485_ENABLED || if (atmel_uart_is_half_duplex(port))
port->iso7816.flags & SER_ISO7816_ENABLED)
atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; atmel_port->tx_done_mask = ATMEL_US_TXEMPTY;
else if (atmel_use_pdc_tx(port)) { else if (atmel_use_pdc_tx(port)) {
port->fifosize = PDC_BUFFER_SIZE; port->fifosize = PDC_BUFFER_SIZE;
@ -2878,6 +2882,7 @@ static int atmel_serial_probe(struct platform_device *pdev)
atmel_port = &atmel_ports[ret]; atmel_port = &atmel_ports[ret];
atmel_port->backup_imr = 0; atmel_port->backup_imr = 0;
atmel_port->uart.line = ret; atmel_port->uart.line = ret;
atmel_port->uart.has_sysrq = IS_ENABLED(CONFIG_SERIAL_ATMEL_CONSOLE);
atmel_serial_probe_fifos(atmel_port, pdev); atmel_serial_probe_fifos(atmel_port, pdev);
atomic_set(&atmel_port->tasklet_shutdown, 0); atomic_set(&atmel_port->tasklet_shutdown, 0);

View File

@ -10,10 +10,6 @@
* my board. * my board.
*/ */
#if defined(CONFIG_SERIAL_BCM63XX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/init.h> #include <linux/init.h>
@ -858,6 +854,7 @@ static int bcm_uart_probe(struct platform_device *pdev)
port->fifosize = 16; port->fifosize = 16;
port->uartclk = clk_get_rate(clk) / 2; port->uartclk = clk_get_rate(clk) / 2;
port->line = pdev->id; port->line = pdev->id;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_BCM63XX_CONSOLE);
clk_put(clk); clk_put(clk);
ret = uart_add_one_port(&bcm_uart_driver, port); ret = uart_add_one_port(&bcm_uart_driver, port);

View File

@ -8,10 +8,6 @@
* Copyright (C) 2000 Deep Blue Solutions Ltd. * Copyright (C) 2000 Deep Blue Solutions Ltd.
*/ */
#if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/console.h> #include <linux/console.h>
@ -479,6 +475,7 @@ static int uart_clps711x_probe(struct platform_device *pdev)
s->port.mapbase = res->start; s->port.mapbase = res->start;
s->port.type = PORT_CLPS711X; s->port.type = PORT_CLPS711X;
s->port.fifosize = 16; s->port.fifosize = 16;
s->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_CLPS711X_CONSOLE);
s->port.flags = UPF_SKIP_TEST | UPF_FIXED_TYPE; s->port.flags = UPF_SKIP_TEST | UPF_FIXED_TYPE;
s->port.uartclk = clk_get_rate(uart_clk); s->port.uartclk = clk_get_rate(uart_clk);
s->port.ops = &uart_clps711x_ops; s->port.ops = &uart_clps711x_ops;

View File

@ -40,10 +40,6 @@
#include <asm/fs_pd.h> #include <asm/fs_pd.h>
#include <asm/udbg.h> #include <asm/udbg.h>
#if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/kernel.h> #include <linux/kernel.h>
@ -347,9 +343,7 @@ static void cpm_uart_int_rx(struct uart_port *port)
/* ASSUMPTION: it contains nothing valid */ /* ASSUMPTION: it contains nothing valid */
i = 0; i = 0;
} }
#ifdef SUPPORT_SYSRQ
port->sysrq = 0; port->sysrq = 0;
#endif
goto error_return; goto error_return;
} }
@ -1204,7 +1198,8 @@ static int cpm_uart_init_port(struct device_node *np,
pinfo->port.uartclk = ppc_proc_freq; pinfo->port.uartclk = ppc_proc_freq;
pinfo->port.mapbase = (unsigned long)mem; pinfo->port.mapbase = (unsigned long)mem;
pinfo->port.type = PORT_CPM; pinfo->port.type = PORT_CPM;
pinfo->port.ops = &cpm_uart_pops, pinfo->port.ops = &cpm_uart_pops;
pinfo->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_CPM_CONSOLE);
pinfo->port.iotype = UPIO_MEM; pinfo->port.iotype = UPIO_MEM;
pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize;
spin_lock_init(&pinfo->port.lock); spin_lock_init(&pinfo->port.lock);

View File

@ -29,10 +29,6 @@
#undef DEBUG_DZ #undef DEBUG_DZ
#if defined(CONFIG_SERIAL_DZ_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/console.h> #include <linux/console.h>
@ -787,6 +783,7 @@ static void __init dz_init_ports(void)
uport->ops = &dz_ops; uport->ops = &dz_ops;
uport->line = line; uport->line = line;
uport->mapbase = base; uport->mapbase = base;
uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_DZ_CONSOLE);
} }
} }

View File

@ -1,8 +1,4 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#if defined(CONFIG_SERIAL_EFM32_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/io.h> #include <linux/io.h>
@ -748,6 +744,7 @@ static int efm32_uart_probe(struct platform_device *pdev)
efm_port->port.type = PORT_EFMUART; efm_port->port.type = PORT_EFMUART;
efm_port->port.iotype = UPIO_MEM32; efm_port->port.iotype = UPIO_MEM32;
efm_port->port.fifosize = 2; efm_port->port.fifosize = 2;
efm_port->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_EFM32_UART_CONSOLE);
efm_port->port.ops = &efm32_uart_pops; efm_port->port.ops = &efm32_uart_pops;
efm_port->port.flags = UPF_BOOT_AUTOCONF; efm_port->port.flags = UPF_BOOT_AUTOCONF;

View File

@ -6,11 +6,6 @@
* Copyright 2017-2019 NXP * Copyright 2017-2019 NXP
*/ */
#if defined(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE) && \
defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/console.h> #include <linux/console.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/irq.h> #include <linux/irq.h>
@ -279,10 +274,8 @@ static irqreturn_t linflex_rxint(int irq, void *dev_id)
if (brk) { if (brk) {
uart_handle_break(sport); uart_handle_break(sport);
} else { } else {
#ifdef SUPPORT_SYSRQ
if (uart_handle_sysrq_char(sport, (unsigned char)rx)) if (uart_handle_sysrq_char(sport, (unsigned char)rx))
continue; continue;
#endif
tty_insert_flip_char(port, rx, flg); tty_insert_flip_char(port, rx, flg);
} }
} }
@ -863,6 +856,7 @@ static int linflex_probe(struct platform_device *pdev)
sport->irq = platform_get_irq(pdev, 0); sport->irq = platform_get_irq(pdev, 0);
sport->ops = &linflex_pops; sport->ops = &linflex_pops;
sport->flags = UPF_BOOT_AUTOCONF; sport->flags = UPF_BOOT_AUTOCONF;
sport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE);
linflex_ports[sport->line] = sport; linflex_ports[sport->line] = sport;

View File

@ -5,10 +5,6 @@
* Copyright 2012-2014 Freescale Semiconductor, Inc. * Copyright 2012-2014 Freescale Semiconductor, Inc.
*/ */
#if defined(CONFIG_SERIAL_FSL_LPUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
@ -864,9 +860,7 @@ static void lpuart_rxint(struct lpuart_port *sport)
if (sr & UARTSR1_OR) if (sr & UARTSR1_OR)
flg = TTY_OVERRUN; flg = TTY_OVERRUN;
#ifdef SUPPORT_SYSRQ
sport->port.sysrq = 0; sport->port.sysrq = 0;
#endif
} }
tty_insert_flip_char(port, rx, flg); tty_insert_flip_char(port, rx, flg);
@ -946,9 +940,7 @@ static void lpuart32_rxint(struct lpuart_port *sport)
if (sr & UARTSTAT_OR) if (sr & UARTSTAT_OR)
flg = TTY_OVERRUN; flg = TTY_OVERRUN;
#ifdef SUPPORT_SYSRQ
sport->port.sysrq = 0; sport->port.sysrq = 0;
#endif
} }
tty_insert_flip_char(port, rx, flg); tty_insert_flip_char(port, rx, flg);
@ -2376,7 +2368,9 @@ static int __init lpuart32_early_console_setup(struct earlycon_device *device,
if (!device->port.membase) if (!device->port.membase)
return -ENODEV; return -ENODEV;
device->port.iotype = UPIO_MEM32BE; if (device->port.iotype != UPIO_MEM32)
device->port.iotype = UPIO_MEM32BE;
device->con->write = lpuart32_early_write; device->con->write = lpuart32_early_write;
return 0; return 0;
} }
@ -2396,9 +2390,6 @@ static int __init lpuart32_imx_early_console_setup(struct earlycon_device *devic
OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lpuart", lpuart_early_console_setup); OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lpuart", lpuart_early_console_setup);
OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1021a-lpuart", lpuart32_early_console_setup); OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1021a-lpuart", lpuart32_early_console_setup);
OF_EARLYCON_DECLARE(lpuart32, "fsl,imx7ulp-lpuart", lpuart32_imx_early_console_setup); OF_EARLYCON_DECLARE(lpuart32, "fsl,imx7ulp-lpuart", lpuart32_imx_early_console_setup);
OF_EARLYCON_DECLARE(lpuart32, "fsl,imx8qxp-lpuart", lpuart32_imx_early_console_setup);
EARLYCON_DECLARE(lpuart, lpuart_early_console_setup);
EARLYCON_DECLARE(lpuart32, lpuart32_early_console_setup);
#define LPUART_CONSOLE (&lpuart_console) #define LPUART_CONSOLE (&lpuart_console)
#define LPUART32_CONSOLE (&lpuart32_console) #define LPUART32_CONSOLE (&lpuart32_console)
@ -2461,6 +2452,7 @@ static int lpuart_probe(struct platform_device *pdev)
sport->port.ops = &lpuart32_pops; sport->port.ops = &lpuart32_pops;
else else
sport->port.ops = &lpuart_pops; sport->port.ops = &lpuart_pops;
sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LPUART_CONSOLE);
sport->port.flags = UPF_BOOT_AUTOCONF; sport->port.flags = UPF_BOOT_AUTOCONF;
if (lpuart_is_32(sport)) if (lpuart_is_32(sport))

View File

@ -8,10 +8,6 @@
* Copyright (C) 2004 Pengutronix * Copyright (C) 2004 Pengutronix
*/ */
#if defined(CONFIG_SERIAL_IMX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
@ -700,22 +696,33 @@ static void imx_uart_start_tx(struct uart_port *port)
} }
} }
static irqreturn_t imx_uart_rtsint(int irq, void *dev_id) static irqreturn_t __imx_uart_rtsint(int irq, void *dev_id)
{ {
struct imx_port *sport = dev_id; struct imx_port *sport = dev_id;
u32 usr1; u32 usr1;
spin_lock(&sport->port.lock);
imx_uart_writel(sport, USR1_RTSD, USR1); imx_uart_writel(sport, USR1_RTSD, USR1);
usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS; usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS;
uart_handle_cts_change(&sport->port, !!usr1); uart_handle_cts_change(&sport->port, !!usr1);
wake_up_interruptible(&sport->port.state->port.delta_msr_wait); wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
spin_unlock(&sport->port.lock);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static irqreturn_t imx_uart_rtsint(int irq, void *dev_id)
{
struct imx_port *sport = dev_id;
irqreturn_t ret;
spin_lock(&sport->port.lock);
ret = __imx_uart_rtsint(irq, dev_id);
spin_unlock(&sport->port.lock);
return ret;
}
static irqreturn_t imx_uart_txint(int irq, void *dev_id) static irqreturn_t imx_uart_txint(int irq, void *dev_id)
{ {
struct imx_port *sport = dev_id; struct imx_port *sport = dev_id;
@ -726,14 +733,12 @@ static irqreturn_t imx_uart_txint(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static irqreturn_t imx_uart_rxint(int irq, void *dev_id) static irqreturn_t __imx_uart_rxint(int irq, void *dev_id)
{ {
struct imx_port *sport = dev_id; struct imx_port *sport = dev_id;
unsigned int rx, flg, ignored = 0; unsigned int rx, flg, ignored = 0;
struct tty_port *port = &sport->port.state->port; struct tty_port *port = &sport->port.state->port;
spin_lock(&sport->port.lock);
while (imx_uart_readl(sport, USR2) & USR2_RDR) { while (imx_uart_readl(sport, USR2) & USR2_RDR) {
u32 usr2; u32 usr2;
@ -779,9 +784,7 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id)
if (rx & URXD_OVRRUN) if (rx & URXD_OVRRUN)
flg = TTY_OVERRUN; flg = TTY_OVERRUN;
#ifdef SUPPORT_SYSRQ
sport->port.sysrq = 0; sport->port.sysrq = 0;
#endif
} }
if (sport->port.ignore_status_mask & URXD_DUMMY_READ) if (sport->port.ignore_status_mask & URXD_DUMMY_READ)
@ -792,11 +795,25 @@ static irqreturn_t imx_uart_rxint(int irq, void *dev_id)
} }
out: out:
spin_unlock(&sport->port.lock);
tty_flip_buffer_push(port); tty_flip_buffer_push(port);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static irqreturn_t imx_uart_rxint(int irq, void *dev_id)
{
struct imx_port *sport = dev_id;
irqreturn_t ret;
spin_lock(&sport->port.lock);
ret = __imx_uart_rxint(irq, dev_id);
spin_unlock(&sport->port.lock);
return ret;
}
static void imx_uart_clear_rx_errors(struct imx_port *sport); static void imx_uart_clear_rx_errors(struct imx_port *sport);
/* /*
@ -855,6 +872,8 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)
unsigned int usr1, usr2, ucr1, ucr2, ucr3, ucr4; unsigned int usr1, usr2, ucr1, ucr2, ucr3, ucr4;
irqreturn_t ret = IRQ_NONE; irqreturn_t ret = IRQ_NONE;
spin_lock(&sport->port.lock);
usr1 = imx_uart_readl(sport, USR1); usr1 = imx_uart_readl(sport, USR1);
usr2 = imx_uart_readl(sport, USR2); usr2 = imx_uart_readl(sport, USR2);
ucr1 = imx_uart_readl(sport, UCR1); ucr1 = imx_uart_readl(sport, UCR1);
@ -888,27 +907,25 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)
usr2 &= ~USR2_ORE; usr2 &= ~USR2_ORE;
if (usr1 & (USR1_RRDY | USR1_AGTIM)) { if (usr1 & (USR1_RRDY | USR1_AGTIM)) {
imx_uart_rxint(irq, dev_id); __imx_uart_rxint(irq, dev_id);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
if ((usr1 & USR1_TRDY) || (usr2 & USR2_TXDC)) { if ((usr1 & USR1_TRDY) || (usr2 & USR2_TXDC)) {
imx_uart_txint(irq, dev_id); imx_uart_transmit_buffer(sport);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
if (usr1 & USR1_DTRD) { if (usr1 & USR1_DTRD) {
imx_uart_writel(sport, USR1_DTRD, USR1); imx_uart_writel(sport, USR1_DTRD, USR1);
spin_lock(&sport->port.lock);
imx_uart_mctrl_check(sport); imx_uart_mctrl_check(sport);
spin_unlock(&sport->port.lock);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
if (usr1 & USR1_RTSD) { if (usr1 & USR1_RTSD) {
imx_uart_rtsint(irq, dev_id); __imx_uart_rtsint(irq, dev_id);
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
@ -923,6 +940,8 @@ static irqreturn_t imx_uart_int(int irq, void *dev_id)
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
} }
spin_unlock(&sport->port.lock);
return ret; return ret;
} }
@ -2231,6 +2250,7 @@ static int imx_uart_probe(struct platform_device *pdev)
sport->port.iotype = UPIO_MEM; sport->port.iotype = UPIO_MEM;
sport->port.irq = rxirq; sport->port.irq = rxirq;
sport->port.fifosize = 32; sport->port.fifosize = 32;
sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE);
sport->port.ops = &imx_uart_pops; sport->port.ops = &imx_uart_pops;
sport->port.rs485_config = imx_uart_rs485_config; sport->port.rs485_config = imx_uart_rs485_config;
sport->port.flags = UPF_BOOT_AUTOCONF; sport->port.flags = UPF_BOOT_AUTOCONF;

View File

@ -38,10 +38,6 @@
#include <asm/sgi/hpc3.h> #include <asm/sgi/hpc3.h>
#include <asm/sgi/ip22.h> #include <asm/sgi/ip22.h>
#if defined(CONFIG_SERIAL_IP22_ZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include "ip22zilog.h" #include "ip22zilog.h"
@ -1080,6 +1076,7 @@ static struct uart_driver ip22zilog_reg = {
static void __init ip22zilog_prepare(void) static void __init ip22zilog_prepare(void)
{ {
unsigned char sysrq_on = IS_ENABLED(CONFIG_SERIAL_IP22_ZILOG_CONSOLE);
struct uart_ip22zilog_port *up; struct uart_ip22zilog_port *up;
struct zilog_layout *rp; struct zilog_layout *rp;
int channel, chip; int channel, chip;
@ -1115,6 +1112,7 @@ static void __init ip22zilog_prepare(void)
up[(chip * 2) + 0].port.irq = zilog_irq; up[(chip * 2) + 0].port.irq = zilog_irq;
up[(chip * 2) + 0].port.uartclk = ZS_CLOCK; up[(chip * 2) + 0].port.uartclk = ZS_CLOCK;
up[(chip * 2) + 0].port.fifosize = 1; up[(chip * 2) + 0].port.fifosize = 1;
up[(chip * 2) + 0].port.has_sysrq = sysrq_on;
up[(chip * 2) + 0].port.ops = &ip22zilog_pops; up[(chip * 2) + 0].port.ops = &ip22zilog_pops;
up[(chip * 2) + 0].port.type = PORT_IP22ZILOG; up[(chip * 2) + 0].port.type = PORT_IP22ZILOG;
up[(chip * 2) + 0].port.flags = 0; up[(chip * 2) + 0].port.flags = 0;
@ -1126,6 +1124,7 @@ static void __init ip22zilog_prepare(void)
up[(chip * 2) + 1].port.irq = zilog_irq; up[(chip * 2) + 1].port.irq = zilog_irq;
up[(chip * 2) + 1].port.uartclk = ZS_CLOCK; up[(chip * 2) + 1].port.uartclk = ZS_CLOCK;
up[(chip * 2) + 1].port.fifosize = 1; up[(chip * 2) + 1].port.fifosize = 1;
up[(chip * 2) + 1].port.has_sysrq = sysrq_on;
up[(chip * 2) + 1].port.ops = &ip22zilog_pops; up[(chip * 2) + 1].port.ops = &ip22zilog_pops;
up[(chip * 2) + 1].port.type = PORT_IP22ZILOG; up[(chip * 2) + 1].port.type = PORT_IP22ZILOG;
up[(chip * 2) + 1].port.line = (chip * 2) + 1; up[(chip * 2) + 1].port.line = (chip * 2) + 1;

View File

@ -118,7 +118,7 @@ static int kgdb_nmi_poll_one_knock(void)
int c = -1; int c = -1;
const char *magic = kgdb_nmi_magic; const char *magic = kgdb_nmi_magic;
size_t m = strlen(magic); size_t m = strlen(magic);
bool printch = 0; bool printch = false;
c = dbg_io_ops->read_char(); c = dbg_io_ops->read_char();
if (c == NO_POLL_CHAR) if (c == NO_POLL_CHAR)
@ -130,7 +130,7 @@ static int kgdb_nmi_poll_one_knock(void)
n = (n + 1) % m; n = (n + 1) % m;
if (!n) if (!n)
return 1; return 1;
printch = 1; printch = true;
} else { } else {
n = 0; n = 0;
} }

View File

@ -5,15 +5,12 @@
* Copyright (C) 2014 Carlo Caione <carlo@caione.org> * Copyright (C) 2014 Carlo Caione <carlo@caione.org>
*/ */
#if defined(CONFIG_SERIAL_MESON_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/of.h> #include <linux/of.h>
@ -76,6 +73,8 @@
#define AML_UART_PORT_OFFSET 6 #define AML_UART_PORT_OFFSET 6
#define AML_UART_DEV_NAME "ttyAML" #define AML_UART_DEV_NAME "ttyAML"
#define AML_UART_POLL_USEC 5
#define AML_UART_TIMEOUT_USEC 10000
static struct uart_driver meson_uart_driver; static struct uart_driver meson_uart_driver;
@ -427,6 +426,64 @@ static void meson_uart_config_port(struct uart_port *port, int flags)
} }
} }
#ifdef CONFIG_CONSOLE_POLL
/*
* Console polling routines for writing and reading from the uart while
* in an interrupt or debug context (i.e. kgdb).
*/
static int meson_uart_poll_get_char(struct uart_port *port)
{
u32 c;
unsigned long flags;
spin_lock_irqsave(&port->lock, flags);
if (readl(port->membase + AML_UART_STATUS) & AML_UART_RX_EMPTY)
c = NO_POLL_CHAR;
else
c = readl(port->membase + AML_UART_RFIFO);
spin_unlock_irqrestore(&port->lock, flags);
return c;
}
static void meson_uart_poll_put_char(struct uart_port *port, unsigned char c)
{
unsigned long flags;
u32 reg;
int ret;
spin_lock_irqsave(&port->lock, flags);
/* Wait until FIFO is empty or timeout */
ret = readl_poll_timeout_atomic(port->membase + AML_UART_STATUS, reg,
reg & AML_UART_TX_EMPTY,
AML_UART_POLL_USEC,
AML_UART_TIMEOUT_USEC);
if (ret == -ETIMEDOUT) {
dev_err(port->dev, "Timeout waiting for UART TX EMPTY\n");
goto out;
}
/* Write the character */
writel(c, port->membase + AML_UART_WFIFO);
/* Wait until FIFO is empty or timeout */
ret = readl_poll_timeout_atomic(port->membase + AML_UART_STATUS, reg,
reg & AML_UART_TX_EMPTY,
AML_UART_POLL_USEC,
AML_UART_TIMEOUT_USEC);
if (ret == -ETIMEDOUT)
dev_err(port->dev, "Timeout waiting for UART TX EMPTY\n");
out:
spin_unlock_irqrestore(&port->lock, flags);
}
#endif /* CONFIG_CONSOLE_POLL */
static const struct uart_ops meson_uart_ops = { static const struct uart_ops meson_uart_ops = {
.set_mctrl = meson_uart_set_mctrl, .set_mctrl = meson_uart_set_mctrl,
.get_mctrl = meson_uart_get_mctrl, .get_mctrl = meson_uart_get_mctrl,
@ -442,6 +499,10 @@ static const struct uart_ops meson_uart_ops = {
.request_port = meson_uart_request_port, .request_port = meson_uart_request_port,
.release_port = meson_uart_release_port, .release_port = meson_uart_release_port,
.verify_port = meson_uart_verify_port, .verify_port = meson_uart_verify_port,
#ifdef CONFIG_CONSOLE_POLL
.poll_get_char = meson_uart_poll_get_char,
.poll_put_char = meson_uart_poll_put_char,
#endif
}; };
#ifdef CONFIG_SERIAL_MESON_CONSOLE #ifdef CONFIG_SERIAL_MESON_CONSOLE
@ -703,6 +764,7 @@ static int meson_uart_probe(struct platform_device *pdev)
port->mapsize = resource_size(res_mem); port->mapsize = resource_size(res_mem);
port->irq = res_irq->start; port->irq = res_irq->start;
port->flags = UPF_BOOT_AUTOCONF | UPF_LOW_LATENCY; port->flags = UPF_BOOT_AUTOCONF | UPF_LOW_LATENCY;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MESON_CONSOLE);
port->dev = &pdev->dev; port->dev = &pdev->dev;
port->line = pdev->id; port->line = pdev->id;
port->type = PORT_MESON; port->type = PORT_MESON;

View File

@ -3,10 +3,6 @@
* Copyright (C) 2018 Socionext Inc. * Copyright (C) 2018 Socionext Inc.
*/ */
#if defined(CONFIG_SERIAL_MILBEAUT_USIO_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/module.h> #include <linux/module.h>
@ -537,6 +533,7 @@ static int mlb_usio_probe(struct platform_device *pdev)
port->irq = mlb_usio_irq[index][RX]; port->irq = mlb_usio_irq[index][RX];
port->uartclk = clk_get_rate(clk); port->uartclk = clk_get_rate(clk);
port->fifosize = 128; port->fifosize = 128;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MILBEAUT_USIO_CONSOLE);
port->iotype = UPIO_MEM32; port->iotype = UPIO_MEM32;
port->flags = UPF_BOOT_AUTOCONF | UPF_SPD_VHI; port->flags = UPF_BOOT_AUTOCONF | UPF_SPD_VHI;
port->line = index; port->line = index;

View File

@ -44,10 +44,6 @@
#include <asm/mpc52xx.h> #include <asm/mpc52xx.h>
#include <asm/mpc52xx_psc.h> #include <asm/mpc52xx_psc.h>
#if defined(CONFIG_SERIAL_MPC52xx_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_core.h> #include <linux/serial_core.h>
@ -1382,12 +1378,8 @@ mpc52xx_uart_int_rx_chars(struct uart_port *port)
ch = psc_ops->read_char(port); ch = psc_ops->read_char(port);
/* Handle sysreq char */ /* Handle sysreq char */
#ifdef SUPPORT_SYSRQ if (uart_handle_sysrq_char(port, ch))
if (uart_handle_sysrq_char(port, ch)) {
port->sysrq = 0;
continue; continue;
}
#endif
/* Store it */ /* Store it */
@ -1770,6 +1762,7 @@ static int mpc52xx_uart_of_probe(struct platform_device *op)
spin_lock_init(&port->lock); spin_lock_init(&port->lock);
port->uartclk = uartclk; port->uartclk = uartclk;
port->fifosize = 512; port->fifosize = 512;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MPC52xx_CONSOLE);
port->iotype = UPIO_MEM; port->iotype = UPIO_MEM;
port->flags = UPF_BOOT_AUTOCONF | port->flags = UPF_BOOT_AUTOCONF |
(uart_console(port) ? 0 : UPF_IOREMAP); (uart_console(port) ? 0 : UPF_IOREMAP);

View File

@ -7,10 +7,6 @@
* Copyright (c) 2011, Code Aurora Forum. All rights reserved. * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
*/ */
#if defined(CONFIG_SERIAL_MSM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
# define SUPPORT_SYSRQ
#endif
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
@ -610,7 +606,7 @@ static void msm_start_rx_dma(struct msm_port *msm_port)
UARTDM_RX_SIZE, dma->dir); UARTDM_RX_SIZE, dma->dir);
ret = dma_mapping_error(uart->dev, dma->phys); ret = dma_mapping_error(uart->dev, dma->phys);
if (ret) if (ret)
return; goto sw_mode;
dma->desc = dmaengine_prep_slave_single(dma->chan, dma->phys, dma->desc = dmaengine_prep_slave_single(dma->chan, dma->phys,
UARTDM_RX_SIZE, DMA_DEV_TO_MEM, UARTDM_RX_SIZE, DMA_DEV_TO_MEM,
@ -661,6 +657,22 @@ static void msm_start_rx_dma(struct msm_port *msm_port)
return; return;
unmap: unmap:
dma_unmap_single(uart->dev, dma->phys, UARTDM_RX_SIZE, dma->dir); dma_unmap_single(uart->dev, dma->phys, UARTDM_RX_SIZE, dma->dir);
sw_mode:
/*
* Switch from DMA to SW/FIFO mode. After clearing Rx BAM (UARTDM_DMEN),
* receiver must be reset.
*/
msm_write(uart, UART_CR_CMD_RESET_RX, UART_CR);
msm_write(uart, UART_CR_RX_ENABLE, UART_CR);
msm_write(uart, UART_CR_CMD_RESET_STALE_INT, UART_CR);
msm_write(uart, 0xFFFFFF, UARTDM_DMRX);
msm_write(uart, UART_CR_CMD_STALE_EVENT_ENABLE, UART_CR);
/* Re-enable RX interrupts */
msm_port->imr |= (UART_IMR_RXLEV | UART_IMR_RXSTALE);
msm_write(uart, msm_port->imr, UART_IMR);
} }
static void msm_stop_rx(struct uart_port *port) static void msm_stop_rx(struct uart_port *port)
@ -1810,6 +1822,7 @@ static int msm_serial_probe(struct platform_device *pdev)
if (unlikely(irq < 0)) if (unlikely(irq < 0))
return -ENXIO; return -ENXIO;
port->irq = irq; port->irq = irq;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MSM_CONSOLE);
platform_set_drvdata(pdev, port); platform_set_drvdata(pdev, port);

View File

@ -25,11 +25,7 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/parisc-device.h> #include <asm/parisc-device.h>
#if defined(CONFIG_SERIAL_MUX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#include <linux/sysrq.h> #include <linux/sysrq.h>
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_core.h> #include <linux/serial_core.h>
#define MUX_OFFSET 0x800 #define MUX_OFFSET 0x800
@ -483,6 +479,7 @@ static int __init mux_probe(struct parisc_device *dev)
port->ops = &mux_pops; port->ops = &mux_pops;
port->flags = UPF_BOOT_AUTOCONF; port->flags = UPF_BOOT_AUTOCONF;
port->line = port_cnt; port->line = port_cnt;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MUX_CONSOLE);
/* The port->timeout needs to match what is present in /* The port->timeout needs to match what is present in
* uart_wait_until_sent in serial_core.c. Otherwise * uart_wait_until_sent in serial_core.c. Otherwise

View File

@ -12,10 +12,6 @@
* Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
*/ */
#if defined(CONFIG_SERIAL_MXS_AUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
@ -1693,6 +1689,7 @@ static int mxs_auart_probe(struct platform_device *pdev)
s->port.fifosize = MXS_AUART_FIFO_SIZE; s->port.fifosize = MXS_AUART_FIFO_SIZE;
s->port.uartclk = clk_get_rate(s->clk); s->port.uartclk = clk_get_rate(s->clk);
s->port.type = PORT_IMX; s->port.type = PORT_IMX;
s->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_MXS_AUART_CONSOLE);
mxs_init_regs(s); mxs_init_regs(s);

View File

@ -16,10 +16,6 @@
* this driver as required for the omap-platform. * this driver as required for the omap-platform.
*/ */
#if defined(CONFIG_SERIAL_OMAP_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/console.h> #include <linux/console.h>
@ -493,10 +489,13 @@ static unsigned int check_modem_status(struct uart_omap_port *up)
static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr) static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr)
{ {
unsigned int flag; unsigned int flag;
unsigned char ch = 0;
/*
* Read one data character out to avoid stalling the receiver according
* to the table 23-246 of the omap4 TRM.
*/
if (likely(lsr & UART_LSR_DR)) if (likely(lsr & UART_LSR_DR))
ch = serial_in(up, UART_RX); serial_in(up, UART_RX);
up->port.icount.rx++; up->port.icount.rx++;
flag = TTY_NORMAL; flag = TTY_NORMAL;
@ -1680,6 +1679,7 @@ static int serial_omap_probe(struct platform_device *pdev)
up->port.regshift = 2; up->port.regshift = 2;
up->port.fifosize = 64; up->port.fifosize = 64;
up->port.ops = &serial_omap_pops; up->port.ops = &serial_omap_pops;
up->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_OMAP_CONSOLE);
if (pdev->dev.of_node) if (pdev->dev.of_node)
ret = of_alias_get_id(pdev->dev.of_node, "serial"); ret = of_alias_get_id(pdev->dev.of_node, "serial");

View File

@ -2,9 +2,6 @@
/* /*
*Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. *Copyright (C) 2011 LAPIS Semiconductor Co., Ltd.
*/ */
#if defined(CONFIG_SERIAL_PCH_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <linux/slab.h> #include <linux/slab.h>
@ -587,12 +584,8 @@ static int pch_uart_hal_read(struct eg20t_port *priv, unsigned char *buf,
if (uart_handle_break(port)) if (uart_handle_break(port))
continue; continue;
} }
#ifdef SUPPORT_SYSRQ if (uart_handle_sysrq_char(port, rbr))
if (port->sysrq) { continue;
if (uart_handle_sysrq_char(port, rbr))
continue;
}
#endif
buf[i++] = rbr; buf[i++] = rbr;
} }
@ -1796,6 +1789,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
priv->port.flags = UPF_BOOT_AUTOCONF; priv->port.flags = UPF_BOOT_AUTOCONF;
priv->port.fifosize = fifosize; priv->port.fifosize = fifosize;
priv->port.line = board->line_no; priv->port.line = board->line_no;
priv->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PCH_UART_CONSOLE);
priv->trigger = PCH_UART_HAL_TRIGGER_M; priv->trigger = PCH_UART_HAL_TRIGGER_M;
snprintf(priv->irq_name, IRQ_NAME_SIZE, snprintf(priv->irq_name, IRQ_NAME_SIZE,

View File

@ -61,10 +61,6 @@
#define of_machine_is_compatible(x) (0) #define of_machine_is_compatible(x) (0)
#endif #endif
#if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
@ -1721,6 +1717,7 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
uap->control_reg = uap->port.membase; uap->control_reg = uap->port.membase;
uap->data_reg = uap->control_reg + 4; uap->data_reg = uap->control_reg + 4;
uap->port_type = 0; uap->port_type = 0;
uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PMACZILOG_CONSOLE);
pmz_convert_to_zs(uap, CS8, 0, 9600); pmz_convert_to_zs(uap, CS8, 0, 9600);

View File

@ -10,10 +10,6 @@
* Copyright (C) 2000 Deep Blue Solutions Ltd. * Copyright (C) 2000 Deep Blue Solutions Ltd.
*/ */
#if defined(CONFIG_SERIAL_PNX8XXX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
@ -220,9 +216,7 @@ static void pnx8xxx_rx_chars(struct pnx8xxx_port *sport)
else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE))
flg = TTY_FRAME; flg = TTY_FRAME;
#ifdef SUPPORT_SYSRQ
sport->port.sysrq = 0; sport->port.sysrq = 0;
#endif
} }
if (uart_handle_sysrq_char(&sport->port, ch)) if (uart_handle_sysrq_char(&sport->port, ch))
@ -800,6 +794,7 @@ static int pnx8xxx_serial_probe(struct platform_device *pdev)
if (pnx8xxx_ports[i].port.mapbase != res->start) if (pnx8xxx_ports[i].port.mapbase != res->start)
continue; continue;
pnx8xxx_ports[i].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PNX8XXX_CONSOLE);
pnx8xxx_ports[i].port.dev = &pdev->dev; pnx8xxx_ports[i].port.dev = &pdev->dev;
uart_add_one_port(&pnx8xxx_reg, &pnx8xxx_ports[i].port); uart_add_one_port(&pnx8xxx_reg, &pnx8xxx_ports[i].port);
platform_set_drvdata(pdev, &pnx8xxx_ports[i]); platform_set_drvdata(pdev, &pnx8xxx_ports[i]);

View File

@ -19,10 +19,6 @@
*/ */
#if defined(CONFIG_SERIAL_PXA_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/console.h> #include <linux/console.h>
@ -879,6 +875,7 @@ static int serial_pxa_probe(struct platform_device *dev)
sport->port.dev = &dev->dev; sport->port.dev = &dev->dev;
sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
sport->port.uartclk = clk_get_rate(sport->clk); sport->port.uartclk = clk_get_rate(sport->clk);
sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PXA_CONSOLE);
ret = serial_pxa_probe_dt(dev, sport); ret = serial_pxa_probe_dt(dev, sport);
if (ret > 0) if (ret > 0)

View File

@ -1,10 +1,6 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017-2018, The Linux foundation. All rights reserved. // Copyright (c) 2017-2018, The Linux foundation. All rights reserved.
#if defined(CONFIG_SERIAL_QCOM_GENI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
# define SUPPORT_SYSRQ
#endif
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/io.h> #include <linux/io.h>
@ -14,6 +10,7 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/pm_wakeirq.h> #include <linux/pm_wakeirq.h>
#include <linux/qcom-geni-se.h> #include <linux/qcom-geni-se.h>
#include <linux/serial.h> #include <linux/serial.h>
@ -92,7 +89,11 @@
#define DEF_TX_WM 2 #define DEF_TX_WM 2
#define DEF_FIFO_WIDTH_BITS 32 #define DEF_FIFO_WIDTH_BITS 32
#define UART_RX_WM 2 #define UART_RX_WM 2
#define MAX_LOOPBACK_CFG 3
/* SE_UART_LOOPBACK_CFG */
#define RX_TX_SORTED BIT(0)
#define CTS_RTS_SORTED BIT(1)
#define RX_TX_CTS_RTS_SORTED (RX_TX_SORTED | CTS_RTS_SORTED)
#ifdef CONFIG_CONSOLE_POLL #ifdef CONFIG_CONSOLE_POLL
#define CONSOLE_RX_BYTES_PW 1 #define CONSOLE_RX_BYTES_PW 1
@ -103,7 +104,7 @@
struct qcom_geni_serial_port { struct qcom_geni_serial_port {
struct uart_port uport; struct uart_port uport;
struct geni_se se; struct geni_se se;
char name[20]; const char *name;
u32 tx_fifo_depth; u32 tx_fifo_depth;
u32 tx_fifo_width; u32 tx_fifo_width;
u32 rx_fifo_depth; u32 rx_fifo_depth;
@ -164,30 +165,6 @@ static struct qcom_geni_serial_port qcom_geni_uart_ports[GENI_UART_PORTS] = {
}, },
}; };
static ssize_t loopback_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
return snprintf(buf, sizeof(u32), "%d\n", port->loopback);
}
static ssize_t loopback_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t size)
{
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
u32 loopback;
if (kstrtoint(buf, 0, &loopback) || loopback > MAX_LOOPBACK_CFG) {
dev_err(dev, "Invalid input\n");
return -EINVAL;
}
port->loopback = loopback;
return size;
}
static DEVICE_ATTR_RW(loopback);
static struct qcom_geni_serial_port qcom_geni_console_port = { static struct qcom_geni_serial_port qcom_geni_console_port = {
.uport = { .uport = {
.iotype = UPIO_MEM, .iotype = UPIO_MEM,
@ -237,10 +214,14 @@ static void qcom_geni_serial_set_mctrl(struct uart_port *uport,
unsigned int mctrl) unsigned int mctrl)
{ {
u32 uart_manual_rfr = 0; u32 uart_manual_rfr = 0;
struct qcom_geni_serial_port *port = to_dev_port(uport, uport);
if (uart_console(uport)) if (uart_console(uport))
return; return;
if (mctrl & TIOCM_LOOP)
port->loopback = RX_TX_CTS_RTS_SORTED;
if (!(mctrl & TIOCM_RTS)) if (!(mctrl & TIOCM_RTS))
uart_manual_rfr = UART_MANUAL_RFR_EN | UART_RFR_NOT_READY; uart_manual_rfr = UART_MANUAL_RFR_EN | UART_RFR_NOT_READY;
writel(uart_manual_rfr, uport->membase + SE_UART_MANUAL_RFR); writel(uart_manual_rfr, uport->membase + SE_UART_MANUAL_RFR);
@ -757,15 +738,6 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done,
uart_write_wakeup(uport); uart_write_wakeup(uport);
} }
static irqreturn_t qcom_geni_serial_wakeup_isr(int isr, void *dev)
{
struct uart_port *uport = dev;
pm_wakeup_event(uport->dev, 2000);
return IRQ_HANDLED;
}
static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) static irqreturn_t qcom_geni_serial_isr(int isr, void *dev)
{ {
u32 m_irq_en; u32 m_irq_en;
@ -1302,50 +1274,57 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS;
port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; port->tx_fifo_width = DEF_FIFO_WIDTH_BITS;
scnprintf(port->name, sizeof(port->name), "qcom_geni_serial_%s%d", port->name = devm_kasprintf(uport->dev, GFP_KERNEL,
(uart_console(uport) ? "console" : "uart"), uport->line); "qcom_geni_serial_%s%d",
uart_console(uport) ? "console" : "uart", uport->line);
if (!port->name)
return -ENOMEM;
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) if (irq < 0)
return irq; return irq;
uport->irq = irq; uport->irq = irq;
uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE);
if (!console)
port->wakeup_irq = platform_get_irq_optional(pdev, 1);
uport->private_data = drv;
platform_set_drvdata(pdev, port);
port->handle_rx = console ? handle_rx_console : handle_rx_uart;
ret = uart_add_one_port(drv, uport);
if (ret)
return ret;
irq_set_status_flags(uport->irq, IRQ_NOAUTOEN); irq_set_status_flags(uport->irq, IRQ_NOAUTOEN);
ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr, ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr,
IRQF_TRIGGER_HIGH, port->name, uport); IRQF_TRIGGER_HIGH, port->name, uport);
if (ret) { if (ret) {
dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret);
uart_remove_one_port(drv, uport);
return ret; return ret;
} }
if (!console) { /*
port->wakeup_irq = platform_get_irq(pdev, 1); * Set pm_runtime status as ACTIVE so that wakeup_irq gets
if (port->wakeup_irq < 0) { * enabled/disabled from dev_pm_arm_wake_irq during system
dev_err(&pdev->dev, "Failed to get wakeup IRQ %d\n", * suspend/resume respectively.
port->wakeup_irq); */
} else { pm_runtime_set_active(&pdev->dev);
irq_set_status_flags(port->wakeup_irq, IRQ_NOAUTOEN);
ret = devm_request_irq(uport->dev, port->wakeup_irq,
qcom_geni_serial_wakeup_isr,
IRQF_TRIGGER_FALLING, "uart_wakeup", uport);
if (ret) {
dev_err(uport->dev, "Failed to register wakeup IRQ ret %d\n",
ret);
return ret;
}
device_init_wakeup(&pdev->dev, true); if (port->wakeup_irq > 0) {
ret = dev_pm_set_wake_irq(&pdev->dev, port->wakeup_irq); device_init_wakeup(&pdev->dev, true);
if (unlikely(ret)) ret = dev_pm_set_dedicated_wake_irq(&pdev->dev,
dev_err(uport->dev, "%s:Failed to set IRQ wake:%d\n", port->wakeup_irq);
__func__, ret); if (ret) {
device_init_wakeup(&pdev->dev, false);
uart_remove_one_port(drv, uport);
return ret;
} }
} }
uport->private_data = drv;
platform_set_drvdata(pdev, port); return 0;
port->handle_rx = console ? handle_rx_console : handle_rx_uart;
if (!console)
device_create_file(uport->dev, &dev_attr_loopback);
return uart_add_one_port(drv, uport);
} }
static int qcom_geni_serial_remove(struct platform_device *pdev) static int qcom_geni_serial_remove(struct platform_device *pdev)
@ -1353,7 +1332,10 @@ static int qcom_geni_serial_remove(struct platform_device *pdev)
struct qcom_geni_serial_port *port = platform_get_drvdata(pdev); struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
struct uart_driver *drv = port->uport.private_data; struct uart_driver *drv = port->uport.private_data;
dev_pm_clear_wake_irq(&pdev->dev);
device_init_wakeup(&pdev->dev, false);
uart_remove_one_port(drv, &port->uport); uart_remove_one_port(drv, &port->uport);
return 0; return 0;
} }
@ -1362,12 +1344,7 @@ static int __maybe_unused qcom_geni_serial_sys_suspend(struct device *dev)
struct qcom_geni_serial_port *port = dev_get_drvdata(dev); struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
struct uart_port *uport = &port->uport; struct uart_port *uport = &port->uport;
uart_suspend_port(uport->private_data, uport); return uart_suspend_port(uport->private_data, uport);
if (port->wakeup_irq > 0)
enable_irq(port->wakeup_irq);
return 0;
} }
static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev) static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev)
@ -1375,9 +1352,6 @@ static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev)
struct qcom_geni_serial_port *port = dev_get_drvdata(dev); struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
struct uart_port *uport = &port->uport; struct uart_port *uport = &port->uport;
if (port->wakeup_irq > 0)
disable_irq(port->wakeup_irq);
return uart_resume_port(uport->private_data, uport); return uart_resume_port(uport->private_data, uport);
} }

View File

@ -7,10 +7,6 @@
* Copyright (C) 2000 Deep Blue Solutions Ltd. * Copyright (C) 2000 Deep Blue Solutions Ltd.
*/ */
#if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
@ -214,9 +210,7 @@ sa1100_rx_chars(struct sa1100_port *sport)
else if (status & UTSR1_TO_SM(UTSR1_FRE)) else if (status & UTSR1_TO_SM(UTSR1_FRE))
flg = TTY_FRAME; flg = TTY_FRAME;
#ifdef SUPPORT_SYSRQ
sport->port.sysrq = 0; sport->port.sysrq = 0;
#endif
} }
if (uart_handle_sysrq_char(&sport->port, ch)) if (uart_handle_sysrq_char(&sport->port, ch))
@ -860,6 +854,7 @@ static int sa1100_serial_resume(struct platform_device *dev)
static int sa1100_serial_add_one_port(struct sa1100_port *sport, struct platform_device *dev) static int sa1100_serial_add_one_port(struct sa1100_port *sport, struct platform_device *dev)
{ {
sport->port.dev = &dev->dev; sport->port.dev = &dev->dev;
sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SA1100_CONSOLE);
// mctrl_gpio_init() requires that the GPIO driver supports interrupts, // mctrl_gpio_init() requires that the GPIO driver supports interrupts,
// but we need to support GPIO drivers for hardware that has no such // but we need to support GPIO drivers for hardware that has no such

View File

@ -1,147 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
#ifndef __SAMSUNG_H
#define __SAMSUNG_H
/*
* Driver for Samsung SoC onboard UARTs.
*
* Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
* http://armlinux.simtec.co.uk/
*/
#include <linux/dmaengine.h>
struct s3c24xx_uart_info {
char *name;
unsigned int type;
unsigned int fifosize;
unsigned long rx_fifomask;
unsigned long rx_fifoshift;
unsigned long rx_fifofull;
unsigned long tx_fifomask;
unsigned long tx_fifoshift;
unsigned long tx_fifofull;
unsigned int def_clk_sel;
unsigned long num_clks;
unsigned long clksel_mask;
unsigned long clksel_shift;
/* uart port features */
unsigned int has_divslot:1;
/* uart controls */
int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);
};
struct s3c24xx_serial_drv_data {
struct s3c24xx_uart_info *info;
struct s3c2410_uartcfg *def_cfg;
unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS];
};
struct s3c24xx_uart_dma {
unsigned int rx_chan_id;
unsigned int tx_chan_id;
struct dma_slave_config rx_conf;
struct dma_slave_config tx_conf;
struct dma_chan *rx_chan;
struct dma_chan *tx_chan;
dma_addr_t rx_addr;
dma_addr_t tx_addr;
dma_cookie_t rx_cookie;
dma_cookie_t tx_cookie;
char *rx_buf;
dma_addr_t tx_transfer_addr;
size_t rx_size;
size_t tx_size;
struct dma_async_tx_descriptor *tx_desc;
struct dma_async_tx_descriptor *rx_desc;
int tx_bytes_requested;
int rx_bytes_requested;
};
struct s3c24xx_uart_port {
unsigned char rx_claimed;
unsigned char tx_claimed;
unsigned int pm_level;
unsigned long baudclk_rate;
unsigned int min_dma_size;
unsigned int rx_irq;
unsigned int tx_irq;
unsigned int tx_in_progress;
unsigned int tx_mode;
unsigned int rx_mode;
struct s3c24xx_uart_info *info;
struct clk *clk;
struct clk *baudclk;
struct uart_port port;
struct s3c24xx_serial_drv_data *drv_data;
/* reference to platform data */
struct s3c2410_uartcfg *cfg;
struct s3c24xx_uart_dma *dma;
#ifdef CONFIG_ARM_S3C24XX_CPUFREQ
struct notifier_block freq_transition;
#endif
};
/* conversion functions */
#define s3c24xx_dev_to_port(__dev) dev_get_drvdata(__dev)
/* register access controls */
#define portaddr(port, reg) ((port)->membase + (reg))
#define portaddrl(port, reg) \
((unsigned long *)(unsigned long)((port)->membase + (reg)))
#define rd_regb(port, reg) (readb_relaxed(portaddr(port, reg)))
#define rd_regl(port, reg) (readl_relaxed(portaddr(port, reg)))
#define wr_regb(port, reg, val) writeb_relaxed(val, portaddr(port, reg))
#define wr_regl(port, reg, val) writel_relaxed(val, portaddr(port, reg))
/* Byte-order aware bit setting/clearing functions. */
static inline void s3c24xx_set_bit(struct uart_port *port, int idx,
unsigned int reg)
{
unsigned long flags;
u32 val;
local_irq_save(flags);
val = rd_regl(port, reg);
val |= (1 << idx);
wr_regl(port, reg, val);
local_irq_restore(flags);
}
static inline void s3c24xx_clear_bit(struct uart_port *port, int idx,
unsigned int reg)
{
unsigned long flags;
u32 val;
local_irq_save(flags);
val = rd_regl(port, reg);
val &= ~(1 << idx);
wr_regl(port, reg, val);
local_irq_restore(flags);
}
#endif

View File

@ -4,7 +4,7 @@
* *
* Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics
* http://armlinux.simtec.co.uk/ * http://armlinux.simtec.co.uk/
*/ */
/* Hote on 2410 error handling /* Hote on 2410 error handling
* *
@ -19,11 +19,7 @@
* and change the policy on BREAK * and change the policy on BREAK
* *
* BJD, 04-Nov-2004 * BJD, 04-Nov-2004
*/ */
#if defined(CONFIG_SERIAL_SAMSUNG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
@ -44,33 +40,8 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/cpufreq.h> #include <linux/cpufreq.h>
#include <linux/of.h> #include <linux/of.h>
#include <asm/irq.h> #include <asm/irq.h>
#include "samsung.h"
#if defined(CONFIG_SERIAL_SAMSUNG_DEBUG) && \
!defined(MODULE)
extern void printascii(const char *);
__printf(1, 2)
static void dbg(const char *fmt, ...)
{
va_list va;
char buff[256];
va_start(va, fmt);
vscnprintf(buff, sizeof(buff), fmt, va);
va_end(va);
printascii(buff);
}
#else
#define dbg(fmt, ...) do { if (0) no_printk(fmt, ##__VA_ARGS__); } while (0)
#endif
/* UART name and device definitions */ /* UART name and device definitions */
#define S3C24XX_SERIAL_NAME "ttySAC" #define S3C24XX_SERIAL_NAME "ttySAC"
@ -81,14 +52,142 @@ static void dbg(const char *fmt, ...)
#define S3C24XX_TX_DMA 2 #define S3C24XX_TX_DMA 2
#define S3C24XX_RX_PIO 1 #define S3C24XX_RX_PIO 1
#define S3C24XX_RX_DMA 2 #define S3C24XX_RX_DMA 2
/* macros to change one thing to another */
#define tx_enabled(port) ((port)->unused[0])
#define rx_enabled(port) ((port)->unused[1])
/* flag to ignore all characters coming in */ /* flag to ignore all characters coming in */
#define RXSTAT_DUMMY_READ (0x10000000) #define RXSTAT_DUMMY_READ (0x10000000)
struct s3c24xx_uart_info {
char *name;
unsigned int type;
unsigned int fifosize;
unsigned long rx_fifomask;
unsigned long rx_fifoshift;
unsigned long rx_fifofull;
unsigned long tx_fifomask;
unsigned long tx_fifoshift;
unsigned long tx_fifofull;
unsigned int def_clk_sel;
unsigned long num_clks;
unsigned long clksel_mask;
unsigned long clksel_shift;
/* uart port features */
unsigned int has_divslot:1;
};
struct s3c24xx_serial_drv_data {
struct s3c24xx_uart_info *info;
struct s3c2410_uartcfg *def_cfg;
unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS];
};
struct s3c24xx_uart_dma {
unsigned int rx_chan_id;
unsigned int tx_chan_id;
struct dma_slave_config rx_conf;
struct dma_slave_config tx_conf;
struct dma_chan *rx_chan;
struct dma_chan *tx_chan;
dma_addr_t rx_addr;
dma_addr_t tx_addr;
dma_cookie_t rx_cookie;
dma_cookie_t tx_cookie;
char *rx_buf;
dma_addr_t tx_transfer_addr;
size_t rx_size;
size_t tx_size;
struct dma_async_tx_descriptor *tx_desc;
struct dma_async_tx_descriptor *rx_desc;
int tx_bytes_requested;
int rx_bytes_requested;
};
struct s3c24xx_uart_port {
unsigned char rx_claimed;
unsigned char tx_claimed;
unsigned char rx_enabled;
unsigned char tx_enabled;
unsigned int pm_level;
unsigned long baudclk_rate;
unsigned int min_dma_size;
unsigned int rx_irq;
unsigned int tx_irq;
unsigned int tx_in_progress;
unsigned int tx_mode;
unsigned int rx_mode;
struct s3c24xx_uart_info *info;
struct clk *clk;
struct clk *baudclk;
struct uart_port port;
struct s3c24xx_serial_drv_data *drv_data;
/* reference to platform data */
struct s3c2410_uartcfg *cfg;
struct s3c24xx_uart_dma *dma;
#ifdef CONFIG_ARM_S3C24XX_CPUFREQ
struct notifier_block freq_transition;
#endif
};
/* conversion functions */
#define s3c24xx_dev_to_port(__dev) dev_get_drvdata(__dev)
/* register access controls */
#define portaddr(port, reg) ((port)->membase + (reg))
#define portaddrl(port, reg) \
((unsigned long *)(unsigned long)((port)->membase + (reg)))
#define rd_regb(port, reg) (readb_relaxed(portaddr(port, reg)))
#define rd_regl(port, reg) (readl_relaxed(portaddr(port, reg)))
#define wr_regb(port, reg, val) writeb_relaxed(val, portaddr(port, reg))
#define wr_regl(port, reg, val) writel_relaxed(val, portaddr(port, reg))
/* Byte-order aware bit setting/clearing functions. */
static inline void s3c24xx_set_bit(struct uart_port *port, int idx,
unsigned int reg)
{
unsigned long flags;
u32 val;
local_irq_save(flags);
val = rd_regl(port, reg);
val |= (1 << idx);
wr_regl(port, reg, val);
local_irq_restore(flags);
}
static inline void s3c24xx_clear_bit(struct uart_port *port, int idx,
unsigned int reg)
{
unsigned long flags;
u32 val;
local_irq_save(flags);
val = rd_regl(port, reg);
val &= ~(1 << idx);
wr_regl(port, reg, val);
local_irq_restore(flags);
}
static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port) static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port)
{ {
return container_of(port, struct s3c24xx_uart_port, port); return container_of(port, struct s3c24xx_uart_port, port);
@ -118,6 +217,7 @@ static int s3c24xx_serial_has_interrupt_mask(struct uart_port *port)
static void s3c24xx_serial_rx_enable(struct uart_port *port) static void s3c24xx_serial_rx_enable(struct uart_port *port)
{ {
struct s3c24xx_uart_port *ourport = to_ourport(port);
unsigned long flags; unsigned long flags;
unsigned int ucon, ufcon; unsigned int ucon, ufcon;
int count = 10000; int count = 10000;
@ -135,12 +235,13 @@ static void s3c24xx_serial_rx_enable(struct uart_port *port)
ucon |= S3C2410_UCON_RXIRQMODE; ucon |= S3C2410_UCON_RXIRQMODE;
wr_regl(port, S3C2410_UCON, ucon); wr_regl(port, S3C2410_UCON, ucon);
rx_enabled(port) = 1; ourport->rx_enabled = 1;
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
} }
static void s3c24xx_serial_rx_disable(struct uart_port *port) static void s3c24xx_serial_rx_disable(struct uart_port *port)
{ {
struct s3c24xx_uart_port *ourport = to_ourport(port);
unsigned long flags; unsigned long flags;
unsigned int ucon; unsigned int ucon;
@ -150,7 +251,7 @@ static void s3c24xx_serial_rx_disable(struct uart_port *port)
ucon &= ~S3C2410_UCON_RXIRQMODE; ucon &= ~S3C2410_UCON_RXIRQMODE;
wr_regl(port, S3C2410_UCON, ucon); wr_regl(port, S3C2410_UCON, ucon);
rx_enabled(port) = 0; ourport->rx_enabled = 0;
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
} }
@ -162,7 +263,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)
struct dma_tx_state state; struct dma_tx_state state;
int count; int count;
if (!tx_enabled(port)) if (!ourport->tx_enabled)
return; return;
if (s3c24xx_serial_has_interrupt_mask(port)) if (s3c24xx_serial_has_interrupt_mask(port))
@ -182,7 +283,7 @@ static void s3c24xx_serial_stop_tx(struct uart_port *port)
port->icount.tx += count; port->icount.tx += count;
} }
tx_enabled(port) = 0; ourport->tx_enabled = 0;
ourport->tx_in_progress = 0; ourport->tx_in_progress = 0;
if (port->flags & UPF_CONS_FLOW) if (port->flags & UPF_CONS_FLOW)
@ -340,11 +441,11 @@ static void s3c24xx_serial_start_tx(struct uart_port *port)
struct s3c24xx_uart_port *ourport = to_ourport(port); struct s3c24xx_uart_port *ourport = to_ourport(port);
struct circ_buf *xmit = &port->state->xmit; struct circ_buf *xmit = &port->state->xmit;
if (!tx_enabled(port)) { if (!ourport->tx_enabled) {
if (port->flags & UPF_CONS_FLOW) if (port->flags & UPF_CONS_FLOW)
s3c24xx_serial_rx_disable(port); s3c24xx_serial_rx_disable(port);
tx_enabled(port) = 1; ourport->tx_enabled = 1;
if (!ourport->dma || !ourport->dma->tx_chan) if (!ourport->dma || !ourport->dma->tx_chan)
s3c24xx_serial_start_tx_pio(ourport); s3c24xx_serial_start_tx_pio(ourport);
} }
@ -389,14 +490,14 @@ static void s3c24xx_serial_stop_rx(struct uart_port *port)
enum dma_status dma_status; enum dma_status dma_status;
unsigned int received; unsigned int received;
if (rx_enabled(port)) { if (ourport->rx_enabled) {
dbg("s3c24xx_serial_stop_rx: port=%p\n", port); dev_dbg(port->dev, "stopping rx\n");
if (s3c24xx_serial_has_interrupt_mask(port)) if (s3c24xx_serial_has_interrupt_mask(port))
s3c24xx_set_bit(port, S3C64XX_UINTM_RXD, s3c24xx_set_bit(port, S3C64XX_UINTM_RXD,
S3C64XX_UINTM); S3C64XX_UINTM);
else else
disable_irq_nosync(ourport->rx_irq); disable_irq_nosync(ourport->rx_irq);
rx_enabled(port) = 0; ourport->rx_enabled = 0;
} }
if (dma && dma->rx_chan) { if (dma && dma->rx_chan) {
dmaengine_pause(dma->tx_chan); dmaengine_pause(dma->tx_chan);
@ -546,7 +647,7 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport);
static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id) static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id)
{ {
unsigned int utrstat, ufstat, received; unsigned int utrstat, received;
struct s3c24xx_uart_port *ourport = dev_id; struct s3c24xx_uart_port *ourport = dev_id;
struct uart_port *port = &ourport->port; struct uart_port *port = &ourport->port;
struct s3c24xx_uart_dma *dma = ourport->dma; struct s3c24xx_uart_dma *dma = ourport->dma;
@ -556,7 +657,7 @@ static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id)
struct dma_tx_state state; struct dma_tx_state state;
utrstat = rd_regl(port, S3C2410_UTRSTAT); utrstat = rd_regl(port, S3C2410_UTRSTAT);
ufstat = rd_regl(port, S3C2410_UFSTAT); rd_regl(port, S3C2410_UFSTAT);
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
@ -618,9 +719,9 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
if (port->flags & UPF_CONS_FLOW) { if (port->flags & UPF_CONS_FLOW) {
int txe = s3c24xx_serial_txempty_nofifo(port); int txe = s3c24xx_serial_txempty_nofifo(port);
if (rx_enabled(port)) { if (ourport->rx_enabled) {
if (!txe) { if (!txe) {
rx_enabled(port) = 0; ourport->rx_enabled = 0;
continue; continue;
} }
} else { } else {
@ -628,7 +729,7 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
ufcon = rd_regl(port, S3C2410_UFCON); ufcon = rd_regl(port, S3C2410_UFCON);
ufcon |= S3C2410_UFCON_RESETRX; ufcon |= S3C2410_UFCON_RESETRX;
wr_regl(port, S3C2410_UFCON, ufcon); wr_regl(port, S3C2410_UFCON, ufcon);
rx_enabled(port) = 1; ourport->rx_enabled = 1;
return; return;
} }
continue; continue;
@ -641,12 +742,13 @@ static void s3c24xx_serial_rx_drain_fifo(struct s3c24xx_uart_port *ourport)
port->icount.rx++; port->icount.rx++;
if (unlikely(uerstat & S3C2410_UERSTAT_ANY)) { if (unlikely(uerstat & S3C2410_UERSTAT_ANY)) {
dbg("rxerr: port ch=0x%02x, rxs=0x%08x\n", dev_dbg(port->dev,
ch, uerstat); "rxerr: port ch=0x%02x, rxs=0x%08x\n",
ch, uerstat);
/* check for break */ /* check for break */
if (uerstat & S3C2410_UERSTAT_BREAK) { if (uerstat & S3C2410_UERSTAT_BREAK) {
dbg("break!\n"); dev_dbg(port->dev, "break!\n");
port->icount.brk++; port->icount.brk++;
if (uart_handle_break(port)) if (uart_handle_break(port))
continue; /* Ignore character */ continue; /* Ignore character */
@ -732,7 +834,7 @@ static irqreturn_t s3c24xx_serial_tx_chars(int irq, void *id)
/* if there isn't anything more to transmit, or the uart is now /* if there isn't anything more to transmit, or the uart is now
* stopped, disable the uart and exit * stopped, disable the uart and exit
*/ */
if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {
s3c24xx_serial_stop_tx(port); s3c24xx_serial_stop_tx(port);
@ -978,7 +1080,7 @@ static void s3c24xx_serial_shutdown(struct uart_port *port)
if (ourport->tx_claimed) { if (ourport->tx_claimed) {
if (!s3c24xx_serial_has_interrupt_mask(port)) if (!s3c24xx_serial_has_interrupt_mask(port))
free_irq(ourport->tx_irq, ourport); free_irq(ourport->tx_irq, ourport);
tx_enabled(port) = 0; ourport->tx_enabled = 0;
ourport->tx_claimed = 0; ourport->tx_claimed = 0;
ourport->tx_mode = 0; ourport->tx_mode = 0;
} }
@ -987,7 +1089,7 @@ static void s3c24xx_serial_shutdown(struct uart_port *port)
if (!s3c24xx_serial_has_interrupt_mask(port)) if (!s3c24xx_serial_has_interrupt_mask(port))
free_irq(ourport->rx_irq, ourport); free_irq(ourport->rx_irq, ourport);
ourport->rx_claimed = 0; ourport->rx_claimed = 0;
rx_enabled(port) = 0; ourport->rx_enabled = 0;
} }
/* Clear pending interrupts and mask all interrupts */ /* Clear pending interrupts and mask all interrupts */
@ -1009,10 +1111,7 @@ static int s3c24xx_serial_startup(struct uart_port *port)
struct s3c24xx_uart_port *ourport = to_ourport(port); struct s3c24xx_uart_port *ourport = to_ourport(port);
int ret; int ret;
dbg("s3c24xx_serial_startup: port=%p (%08llx,%p)\n", ourport->rx_enabled = 1;
port, (unsigned long long)port->mapbase, port->membase);
rx_enabled(port) = 1;
ret = request_irq(ourport->rx_irq, s3c24xx_serial_rx_chars, 0, ret = request_irq(ourport->rx_irq, s3c24xx_serial_rx_chars, 0,
s3c24xx_serial_portname(port), ourport); s3c24xx_serial_portname(port), ourport);
@ -1024,9 +1123,9 @@ static int s3c24xx_serial_startup(struct uart_port *port)
ourport->rx_claimed = 1; ourport->rx_claimed = 1;
dbg("requesting tx irq...\n"); dev_dbg(port->dev, "requesting tx irq...\n");
tx_enabled(port) = 1; ourport->tx_enabled = 1;
ret = request_irq(ourport->tx_irq, s3c24xx_serial_tx_chars, 0, ret = request_irq(ourport->tx_irq, s3c24xx_serial_tx_chars, 0,
s3c24xx_serial_portname(port), ourport); s3c24xx_serial_portname(port), ourport);
@ -1038,10 +1137,9 @@ static int s3c24xx_serial_startup(struct uart_port *port)
ourport->tx_claimed = 1; ourport->tx_claimed = 1;
dbg("s3c24xx_serial_startup ok\n");
/* the port reset code should have done the correct /* the port reset code should have done the correct
* register setup for the port controls */ * register setup for the port controls
*/
return ret; return ret;
@ -1057,9 +1155,6 @@ static int s3c64xx_serial_startup(struct uart_port *port)
unsigned int ufcon; unsigned int ufcon;
int ret; int ret;
dbg("s3c64xx_serial_startup: port=%p (%08llx,%p)\n",
port, (unsigned long long)port->mapbase, port->membase);
wr_regl(port, S3C64XX_UINTM, 0xf); wr_regl(port, S3C64XX_UINTM, 0xf);
if (ourport->dma) { if (ourport->dma) {
ret = s3c24xx_serial_request_dma(ourport); ret = s3c24xx_serial_request_dma(ourport);
@ -1077,9 +1172,9 @@ static int s3c64xx_serial_startup(struct uart_port *port)
} }
/* For compatibility with s3c24xx Soc's */ /* For compatibility with s3c24xx Soc's */
rx_enabled(port) = 1; ourport->rx_enabled = 1;
ourport->rx_claimed = 1; ourport->rx_claimed = 1;
tx_enabled(port) = 0; ourport->tx_enabled = 0;
ourport->tx_claimed = 1; ourport->tx_claimed = 1;
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
@ -1097,7 +1192,6 @@ static int s3c64xx_serial_startup(struct uart_port *port)
/* Enable Rx Interrupt */ /* Enable Rx Interrupt */
s3c24xx_clear_bit(port, S3C64XX_UINTM_RXD, S3C64XX_UINTM); s3c24xx_clear_bit(port, S3C64XX_UINTM_RXD, S3C64XX_UINTM);
dbg("s3c64xx_serial_startup ok\n");
return ret; return ret;
} }
@ -1145,7 +1239,7 @@ static void s3c24xx_serial_pm(struct uart_port *port, unsigned int level,
* baud clocks (and the resultant actual baud rates) and then tries to * baud clocks (and the resultant actual baud rates) and then tries to
* pick the closest one and select that. * pick the closest one and select that.
* *
*/ */
#define MAX_CLK_NAME_LENGTH 15 #define MAX_CLK_NAME_LENGTH 15
@ -1315,29 +1409,30 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
if (cfg->has_fracval) { if (cfg->has_fracval) {
udivslot = (div & 15); udivslot = (div & 15);
dbg("fracval = %04x\n", udivslot); dev_dbg(port->dev, "fracval = %04x\n", udivslot);
} else { } else {
udivslot = udivslot_table[div & 15]; udivslot = udivslot_table[div & 15];
dbg("udivslot = %04x (div %d)\n", udivslot, div & 15); dev_dbg(port->dev, "udivslot = %04x (div %d)\n",
udivslot, div & 15);
} }
} }
switch (termios->c_cflag & CSIZE) { switch (termios->c_cflag & CSIZE) {
case CS5: case CS5:
dbg("config: 5bits/char\n"); dev_dbg(port->dev, "config: 5bits/char\n");
ulcon = S3C2410_LCON_CS5; ulcon = S3C2410_LCON_CS5;
break; break;
case CS6: case CS6:
dbg("config: 6bits/char\n"); dev_dbg(port->dev, "config: 6bits/char\n");
ulcon = S3C2410_LCON_CS6; ulcon = S3C2410_LCON_CS6;
break; break;
case CS7: case CS7:
dbg("config: 7bits/char\n"); dev_dbg(port->dev, "config: 7bits/char\n");
ulcon = S3C2410_LCON_CS7; ulcon = S3C2410_LCON_CS7;
break; break;
case CS8: case CS8:
default: default:
dbg("config: 8bits/char\n"); dev_dbg(port->dev, "config: 8bits/char\n");
ulcon = S3C2410_LCON_CS8; ulcon = S3C2410_LCON_CS8;
break; break;
} }
@ -1359,8 +1454,9 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
dbg("setting ulcon to %08x, brddiv to %d, udivslot %08x\n", dev_dbg(port->dev,
ulcon, quot, udivslot); "setting ulcon to %08x, brddiv to %d, udivslot %08x\n",
ulcon, quot, udivslot);
wr_regl(port, S3C2410_ULCON, ulcon); wr_regl(port, S3C2410_ULCON, ulcon);
wr_regl(port, S3C2410_UBRDIV, quot); wr_regl(port, S3C2410_UBRDIV, quot);
@ -1381,10 +1477,11 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
if (ourport->info->has_divslot) if (ourport->info->has_divslot)
wr_regl(port, S3C2443_DIVSLOT, udivslot); wr_regl(port, S3C2443_DIVSLOT, udivslot);
dbg("uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n", dev_dbg(port->dev,
rd_regl(port, S3C2410_ULCON), "uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n",
rd_regl(port, S3C2410_UCON), rd_regl(port, S3C2410_ULCON),
rd_regl(port, S3C2410_UFCON)); rd_regl(port, S3C2410_UCON),
rd_regl(port, S3C2410_UFCON));
/* /*
* Update the per-port timeout. * Update the per-port timeout.
@ -1442,6 +1539,7 @@ static void s3c24xx_serial_release_port(struct uart_port *port)
static int s3c24xx_serial_request_port(struct uart_port *port) static int s3c24xx_serial_request_port(struct uart_port *port)
{ {
const char *name = s3c24xx_serial_portname(port); const char *name = s3c24xx_serial_portname(port);
return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY; return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY;
} }
@ -1583,7 +1681,7 @@ s3c24xx_serial_ports[CONFIG_SERIAL_SAMSUNG_UARTS] = {
/* s3c24xx_serial_resetport /* s3c24xx_serial_resetport
* *
* reset the fifos and other the settings. * reset the fifos and other the settings.
*/ */
static void s3c24xx_serial_resetport(struct uart_port *port, static void s3c24xx_serial_resetport(struct uart_port *port,
struct s3c2410_uartcfg *cfg) struct s3c2410_uartcfg *cfg)
@ -1637,7 +1735,8 @@ static int s3c24xx_serial_cpufreq_transition(struct notifier_block *nb,
if (val == CPUFREQ_PRECHANGE) { if (val == CPUFREQ_PRECHANGE) {
/* we should really shut the port down whilst the /* we should really shut the port down whilst the
* frequency change is in progress. */ * frequency change is in progress.
*/
} else if (val == CPUFREQ_POSTCHANGE) { } else if (val == CPUFREQ_POSTCHANGE) {
struct ktermios *termios; struct ktermios *termios;
@ -1743,8 +1842,6 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
struct resource *res; struct resource *res;
int ret; int ret;
dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev);
if (platdev == NULL) if (platdev == NULL)
return -ENODEV; return -ENODEV;
@ -1761,7 +1858,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
port->uartclk = 1; port->uartclk = 1;
if (cfg->uart_flags & UPF_CONS_FLOW) { if (cfg->uart_flags & UPF_CONS_FLOW) {
dbg("s3c24xx_serial_init_port: enabling flow control\n"); dev_dbg(port->dev, "enabling flow control\n");
port->flags |= UPF_CONS_FLOW; port->flags |= UPF_CONS_FLOW;
} }
@ -1773,7 +1870,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
return -EINVAL; return -EINVAL;
} }
dbg("resource %pR)\n", res); dev_dbg(port->dev, "resource %pR)\n", res);
port->membase = devm_ioremap(port->dev, res->start, resource_size(res)); port->membase = devm_ioremap(port->dev, res->start, resource_size(res));
if (!port->membase) { if (!port->membase) {
@ -1835,9 +1932,9 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
wr_regl(port, S3C64XX_UINTSP, 0xf); wr_regl(port, S3C64XX_UINTSP, 0xf);
} }
dbg("port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n", dev_dbg(port->dev, "port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n",
&port->mapbase, port->membase, port->irq, &port->mapbase, port->membase, port->irq,
ourport->rx_irq, ourport->tx_irq, port->uartclk); ourport->rx_irq, ourport->tx_irq, port->uartclk);
/* reset the fifos (and setup the uart) */ /* reset the fifos (and setup the uart) */
s3c24xx_serial_resetport(port, cfg); s3c24xx_serial_resetport(port, cfg);
@ -1851,7 +1948,10 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
/* Device driver serial port probe */ /* Device driver serial port probe */
#ifdef CONFIG_OF
static const struct of_device_id s3c24xx_uart_dt_match[]; static const struct of_device_id s3c24xx_uart_dt_match[];
#endif
static int probe_index; static int probe_index;
static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data( static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data(
@ -1860,6 +1960,7 @@ static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data(
#ifdef CONFIG_OF #ifdef CONFIG_OF
if (pdev->dev.of_node) { if (pdev->dev.of_node) {
const struct of_device_id *match; const struct of_device_id *match;
match = of_match_node(s3c24xx_uart_dt_match, pdev->dev.of_node); match = of_match_node(s3c24xx_uart_dt_match, pdev->dev.of_node);
return (struct s3c24xx_serial_drv_data *)match->data; return (struct s3c24xx_serial_drv_data *)match->data;
} }
@ -1881,8 +1982,6 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
index = ret; index = ret;
} }
dbg("s3c24xx_serial_probe(%p) %d\n", pdev, index);
if (index >= ARRAY_SIZE(s3c24xx_serial_ports)) { if (index >= ARRAY_SIZE(s3c24xx_serial_ports)) {
dev_err(&pdev->dev, "serial%d out of range\n", index); dev_err(&pdev->dev, "serial%d out of range\n", index);
return -EINVAL; return -EINVAL;
@ -1909,6 +2008,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
ourport->port.fifosize = ourport->drv_data->fifosize[index]; ourport->port.fifosize = ourport->drv_data->fifosize[index];
else if (ourport->info->fifosize) else if (ourport->info->fifosize)
ourport->port.fifosize = ourport->info->fifosize; ourport->port.fifosize = ourport->info->fifosize;
ourport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SAMSUNG_CONSOLE);
/* /*
* DMA transfers must be aligned at least to cache line size, * DMA transfers must be aligned at least to cache line size,
@ -1917,7 +2017,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
ourport->min_dma_size = max_t(int, ourport->port.fifosize, ourport->min_dma_size = max_t(int, ourport->port.fifosize,
dma_get_cache_alignment()); dma_get_cache_alignment());
dbg("%s: initialising port %p...\n", __func__, ourport); dev_dbg(&pdev->dev, "%s: initialising port %p...\n", __func__, ourport);
ret = s3c24xx_serial_init_port(ourport, pdev); ret = s3c24xx_serial_init_port(ourport, pdev);
if (ret < 0) if (ret < 0)
@ -1931,7 +2031,7 @@ static int s3c24xx_serial_probe(struct platform_device *pdev)
} }
} }
dbg("%s: adding port\n", __func__); dev_dbg(&pdev->dev, "%s: adding port\n", __func__);
uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); uart_add_one_port(&s3c24xx_uart_drv, &ourport->port);
platform_set_drvdata(pdev, &ourport->port); platform_set_drvdata(pdev, &ourport->port);
@ -2008,9 +2108,10 @@ static int s3c24xx_serial_resume_noirq(struct device *dev)
/* restore IRQ mask */ /* restore IRQ mask */
if (s3c24xx_serial_has_interrupt_mask(port)) { if (s3c24xx_serial_has_interrupt_mask(port)) {
unsigned int uintm = 0xf; unsigned int uintm = 0xf;
if (tx_enabled(port))
if (ourport->tx_enabled)
uintm &= ~S3C64XX_UINTM_TXD_MSK; uintm &= ~S3C64XX_UINTM_TXD_MSK;
if (rx_enabled(port)) if (ourport->rx_enabled)
uintm &= ~S3C64XX_UINTM_RXD_MSK; uintm &= ~S3C64XX_UINTM_RXD_MSK;
clk_prepare_enable(ourport->clk); clk_prepare_enable(ourport->clk);
if (!IS_ERR(ourport->baudclk)) if (!IS_ERR(ourport->baudclk))
@ -2143,10 +2244,6 @@ s3c24xx_serial_get_options(struct uart_port *port, int *baud,
ucon = rd_regl(port, S3C2410_UCON); ucon = rd_regl(port, S3C2410_UCON);
ubrdiv = rd_regl(port, S3C2410_UBRDIV); ubrdiv = rd_regl(port, S3C2410_UBRDIV);
dbg("s3c24xx_serial_get_options: port=%p\n"
"registers: ulcon=%08x, ucon=%08x, ubdriv=%08x\n",
port, ulcon, ucon, ubrdiv);
if (s3c24xx_port_configured(ucon)) { if (s3c24xx_port_configured(ucon)) {
switch (ulcon & S3C2410_LCON_CSMASK) { switch (ulcon & S3C2410_LCON_CSMASK) {
case S3C2410_LCON_CS5: case S3C2410_LCON_CS5:
@ -2190,7 +2287,7 @@ s3c24xx_serial_get_options(struct uart_port *port, int *baud,
rate = 1; rate = 1;
*baud = rate / (16 * (ubrdiv + 1)); *baud = rate / (16 * (ubrdiv + 1));
dbg("calculated baud %d\n", *baud); dev_dbg(port->dev, "calculated baud %d\n", *baud);
} }
} }
@ -2204,9 +2301,6 @@ s3c24xx_serial_console_setup(struct console *co, char *options)
int parity = 'n'; int parity = 'n';
int flow = 'n'; int flow = 'n';
dbg("s3c24xx_serial_console_setup: co=%p (%d), %s\n",
co, co->index, options);
/* is this a valid port */ /* is this a valid port */
if (co->index == -1 || co->index >= CONFIG_SERIAL_SAMSUNG_UARTS) if (co->index == -1 || co->index >= CONFIG_SERIAL_SAMSUNG_UARTS)
@ -2221,8 +2315,6 @@ s3c24xx_serial_console_setup(struct console *co, char *options)
cons_uart = port; cons_uart = port;
dbg("s3c24xx_serial_console_setup: port=%p (%d)\n", port, co->index);
/* /*
* Check whether an invalid uart number has been specified, and * Check whether an invalid uart number has been specified, and
* if so, search for the first available port that does have * if so, search for the first available port that does have
@ -2233,7 +2325,7 @@ s3c24xx_serial_console_setup(struct console *co, char *options)
else else
s3c24xx_serial_get_options(port, &baud, &parity, &bits); s3c24xx_serial_get_options(port, &baud, &parity, &bits);
dbg("s3c24xx_serial_console_setup: baud %d\n", baud); dev_dbg(port->dev, "baud %d\n", baud);
return uart_set_options(port, co, baud, parity, bits, flow); return uart_set_options(port, co, baud, parity, bits, flow);
} }
@ -2523,7 +2615,8 @@ static void samsung_early_putc(struct uart_port *port, int c)
writeb(c, port->membase + S3C2410_UTXH); writeb(c, port->membase + S3C2410_UTXH);
} }
static void samsung_early_write(struct console *con, const char *s, unsigned n) static void samsung_early_write(struct console *con, const char *s,
unsigned int n)
{ {
struct earlycon_device *dev = con->data; struct earlycon_device *dev = con->data;
@ -2572,7 +2665,7 @@ OF_EARLYCON_DECLARE(s3c2440, "samsung,s3c2440-uart",
OF_EARLYCON_DECLARE(s3c6400, "samsung,s3c6400-uart", OF_EARLYCON_DECLARE(s3c6400, "samsung,s3c6400-uart",
s3c2440_early_console_setup); s3c2440_early_console_setup);
/* S5PV210, EXYNOS */ /* S5PV210, Exynos */
static struct samsung_early_console_data s5pv210_early_console_data = { static struct samsung_early_console_data s5pv210_early_console_data = {
.txfull_mask = S5PV210_UFSTAT_TXFULL, .txfull_mask = S5PV210_UFSTAT_TXFULL,
}; };

View File

@ -15,10 +15,6 @@
* "BCM1250/BCM1125/BCM1125H User Manual", Broadcom Corporation * "BCM1250/BCM1125/BCM1125H User Manual", Broadcom Corporation
*/ */
#if defined(CONFIG_SERIAL_SB1250_DUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/delay.h> #include <linux/delay.h>
@ -813,6 +809,7 @@ static void __init sbd_probe_duarts(void)
uport->ops = &sbd_ops; uport->ops = &sbd_ops;
uport->line = line; uport->line = line;
uport->mapbase = SBD_CHANREGS(line); uport->mapbase = SBD_CHANREGS(line);
uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_SB1250_DUART_CONSOLE);
} }
} }
} }

View File

@ -7,10 +7,6 @@
* Based on sc26xx.c, by Thomas Bogendörfer (tsbogend@alpha.franken.de) * Based on sc26xx.c, by Thomas Bogendörfer (tsbogend@alpha.franken.de)
*/ */
#if defined(CONFIG_SERIAL_SCCNXP_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
@ -1000,6 +996,7 @@ static int sccnxp_probe(struct platform_device *pdev)
s->port[i].regshift = s->pdata.reg_shift; s->port[i].regshift = s->pdata.reg_shift;
s->port[i].uartclk = uartclk; s->port[i].uartclk = uartclk;
s->port[i].ops = &sccnxp_ops; s->port[i].ops = &sccnxp_ops;
s->port[i].has_sysrq = IS_ENABLED(CONFIG_SERIAL_SCCNXP_CONSOLE);
uart_add_one_port(&s->uart, &s->port[i]); uart_add_one_port(&s->uart, &s->port[i]);
/* Set direction to input */ /* Set direction to input */
if (s->chip->flags & SCCNXP_HAVE_IO) if (s->chip->flags & SCCNXP_HAVE_IO)

View File

@ -141,6 +141,7 @@ struct tegra_uart_port {
int configured_rate; int configured_rate;
bool use_rx_pio; bool use_rx_pio;
bool use_tx_pio; bool use_tx_pio;
bool rx_dma_active;
}; };
static void tegra_uart_start_next_tx(struct tegra_uart_port *tup); static void tegra_uart_start_next_tx(struct tegra_uart_port *tup);
@ -533,11 +534,12 @@ static int tegra_uart_start_tx_dma(struct tegra_uart_port *tup,
struct circ_buf *xmit = &tup->uport.state->xmit; struct circ_buf *xmit = &tup->uport.state->xmit;
dma_addr_t tx_phys_addr; dma_addr_t tx_phys_addr;
dma_sync_single_for_device(tup->uport.dev, tup->tx_dma_buf_phys,
UART_XMIT_SIZE, DMA_TO_DEVICE);
tup->tx_bytes = count & ~(0xF); tup->tx_bytes = count & ~(0xF);
tx_phys_addr = tup->tx_dma_buf_phys + xmit->tail; tx_phys_addr = tup->tx_dma_buf_phys + xmit->tail;
dma_sync_single_for_device(tup->uport.dev, tx_phys_addr,
tup->tx_bytes, DMA_TO_DEVICE);
tup->tx_dma_desc = dmaengine_prep_slave_single(tup->tx_dma_chan, tup->tx_dma_desc = dmaengine_prep_slave_single(tup->tx_dma_chan,
tx_phys_addr, tup->tx_bytes, DMA_MEM_TO_DEV, tx_phys_addr, tup->tx_bytes, DMA_MEM_TO_DEV,
DMA_PREP_INTERRUPT); DMA_PREP_INTERRUPT);
@ -679,7 +681,7 @@ static void tegra_uart_copy_rx_to_tty(struct tegra_uart_port *tup,
return; return;
dma_sync_single_for_cpu(tup->uport.dev, tup->rx_dma_buf_phys, dma_sync_single_for_cpu(tup->uport.dev, tup->rx_dma_buf_phys,
TEGRA_UART_RX_DMA_BUFFER_SIZE, DMA_FROM_DEVICE); count, DMA_FROM_DEVICE);
copied = tty_insert_flip_string(tty, copied = tty_insert_flip_string(tty,
((unsigned char *)(tup->rx_dma_buf_virt)), count); ((unsigned char *)(tup->rx_dma_buf_virt)), count);
if (copied != count) { if (copied != count) {
@ -687,7 +689,7 @@ static void tegra_uart_copy_rx_to_tty(struct tegra_uart_port *tup,
dev_err(tup->uport.dev, "RxData copy to tty layer failed\n"); dev_err(tup->uport.dev, "RxData copy to tty layer failed\n");
} }
dma_sync_single_for_device(tup->uport.dev, tup->rx_dma_buf_phys, dma_sync_single_for_device(tup->uport.dev, tup->rx_dma_buf_phys,
TEGRA_UART_RX_DMA_BUFFER_SIZE, DMA_TO_DEVICE); count, DMA_TO_DEVICE);
} }
static void tegra_uart_rx_buffer_push(struct tegra_uart_port *tup, static void tegra_uart_rx_buffer_push(struct tegra_uart_port *tup,
@ -731,6 +733,7 @@ static void tegra_uart_rx_dma_complete(void *args)
if (tup->rts_active) if (tup->rts_active)
set_rts(tup, false); set_rts(tup, false);
tup->rx_dma_active = false;
tegra_uart_rx_buffer_push(tup, 0); tegra_uart_rx_buffer_push(tup, 0);
tegra_uart_start_rx_dma(tup); tegra_uart_start_rx_dma(tup);
@ -742,18 +745,27 @@ static void tegra_uart_rx_dma_complete(void *args)
spin_unlock_irqrestore(&u->lock, flags); spin_unlock_irqrestore(&u->lock, flags);
} }
static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup) static void tegra_uart_terminate_rx_dma(struct tegra_uart_port *tup)
{ {
struct dma_tx_state state; struct dma_tx_state state;
if (!tup->rx_dma_active)
return;
dmaengine_terminate_all(tup->rx_dma_chan);
dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state);
tegra_uart_rx_buffer_push(tup, state.residue);
tup->rx_dma_active = false;
}
static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup)
{
/* Deactivate flow control to stop sender */ /* Deactivate flow control to stop sender */
if (tup->rts_active) if (tup->rts_active)
set_rts(tup, false); set_rts(tup, false);
dmaengine_terminate_all(tup->rx_dma_chan); tegra_uart_terminate_rx_dma(tup);
dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state);
tegra_uart_rx_buffer_push(tup, state.residue);
tegra_uart_start_rx_dma(tup);
if (tup->rts_active) if (tup->rts_active)
set_rts(tup, true); set_rts(tup, true);
@ -763,6 +775,9 @@ static int tegra_uart_start_rx_dma(struct tegra_uart_port *tup)
{ {
unsigned int count = TEGRA_UART_RX_DMA_BUFFER_SIZE; unsigned int count = TEGRA_UART_RX_DMA_BUFFER_SIZE;
if (tup->rx_dma_active)
return 0;
tup->rx_dma_desc = dmaengine_prep_slave_single(tup->rx_dma_chan, tup->rx_dma_desc = dmaengine_prep_slave_single(tup->rx_dma_chan,
tup->rx_dma_buf_phys, count, DMA_DEV_TO_MEM, tup->rx_dma_buf_phys, count, DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT); DMA_PREP_INTERRUPT);
@ -771,10 +786,9 @@ static int tegra_uart_start_rx_dma(struct tegra_uart_port *tup)
return -EIO; return -EIO;
} }
tup->rx_dma_active = true;
tup->rx_dma_desc->callback = tegra_uart_rx_dma_complete; tup->rx_dma_desc->callback = tegra_uart_rx_dma_complete;
tup->rx_dma_desc->callback_param = tup; tup->rx_dma_desc->callback_param = tup;
dma_sync_single_for_device(tup->uport.dev, tup->rx_dma_buf_phys,
count, DMA_TO_DEVICE);
tup->rx_bytes_requested = count; tup->rx_bytes_requested = count;
tup->rx_cookie = dmaengine_submit(tup->rx_dma_desc); tup->rx_cookie = dmaengine_submit(tup->rx_dma_desc);
dma_async_issue_pending(tup->rx_dma_chan); dma_async_issue_pending(tup->rx_dma_chan);
@ -820,6 +834,7 @@ static irqreturn_t tegra_uart_isr(int irq, void *data)
struct uart_port *u = &tup->uport; struct uart_port *u = &tup->uport;
unsigned long iir; unsigned long iir;
unsigned long ier; unsigned long ier;
bool is_rx_start = false;
bool is_rx_int = false; bool is_rx_int = false;
unsigned long flags; unsigned long flags;
@ -832,10 +847,12 @@ static irqreturn_t tegra_uart_isr(int irq, void *data)
if (tup->rx_in_progress) { if (tup->rx_in_progress) {
ier = tup->ier_shadow; ier = tup->ier_shadow;
ier |= (UART_IER_RLSI | UART_IER_RTOIE | ier |= (UART_IER_RLSI | UART_IER_RTOIE |
TEGRA_UART_IER_EORD); TEGRA_UART_IER_EORD | UART_IER_RDI);
tup->ier_shadow = ier; tup->ier_shadow = ier;
tegra_uart_write(tup, ier, UART_IER); tegra_uart_write(tup, ier, UART_IER);
} }
} else if (is_rx_start) {
tegra_uart_start_rx_dma(tup);
} }
spin_unlock_irqrestore(&u->lock, flags); spin_unlock_irqrestore(&u->lock, flags);
return IRQ_HANDLED; return IRQ_HANDLED;
@ -854,17 +871,23 @@ static irqreturn_t tegra_uart_isr(int irq, void *data)
case 4: /* End of data */ case 4: /* End of data */
case 6: /* Rx timeout */ case 6: /* Rx timeout */
case 2: /* Receive */ if (!tup->use_rx_pio) {
if (!tup->use_rx_pio && !is_rx_int) { is_rx_int = tup->rx_in_progress;
is_rx_int = true;
/* Disable Rx interrupts */ /* Disable Rx interrupts */
ier = tup->ier_shadow; ier = tup->ier_shadow;
ier |= UART_IER_RDI;
tegra_uart_write(tup, ier, UART_IER);
ier &= ~(UART_IER_RDI | UART_IER_RLSI | ier &= ~(UART_IER_RDI | UART_IER_RLSI |
UART_IER_RTOIE | TEGRA_UART_IER_EORD); UART_IER_RTOIE | TEGRA_UART_IER_EORD);
tup->ier_shadow = ier; tup->ier_shadow = ier;
tegra_uart_write(tup, ier, UART_IER); tegra_uart_write(tup, ier, UART_IER);
break;
}
/* Fall through */
case 2: /* Receive */
if (!tup->use_rx_pio) {
is_rx_start = tup->rx_in_progress;
tup->ier_shadow &= ~UART_IER_RDI;
tegra_uart_write(tup, tup->ier_shadow,
UART_IER);
} else { } else {
do_handle_rx_pio(tup); do_handle_rx_pio(tup);
} }
@ -886,7 +909,6 @@ static void tegra_uart_stop_rx(struct uart_port *u)
{ {
struct tegra_uart_port *tup = to_tegra_uport(u); struct tegra_uart_port *tup = to_tegra_uport(u);
struct tty_port *port = &tup->uport.state->port; struct tty_port *port = &tup->uport.state->port;
struct dma_tx_state state;
unsigned long ier; unsigned long ier;
if (tup->rts_active) if (tup->rts_active)
@ -903,13 +925,11 @@ static void tegra_uart_stop_rx(struct uart_port *u)
tup->ier_shadow = ier; tup->ier_shadow = ier;
tegra_uart_write(tup, ier, UART_IER); tegra_uart_write(tup, ier, UART_IER);
tup->rx_in_progress = 0; tup->rx_in_progress = 0;
if (tup->rx_dma_chan && !tup->use_rx_pio) {
dmaengine_terminate_all(tup->rx_dma_chan); if (!tup->use_rx_pio)
dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state); tegra_uart_terminate_rx_dma(tup);
tegra_uart_rx_buffer_push(tup, state.residue); else
} else {
tegra_uart_handle_rx_pio(tup, port); tegra_uart_handle_rx_pio(tup, port);
}
} }
static void tegra_uart_hw_deinit(struct tegra_uart_port *tup) static void tegra_uart_hw_deinit(struct tegra_uart_port *tup)
@ -1052,12 +1072,6 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
tup->lcr_shadow = TEGRA_UART_DEFAULT_LSR; tup->lcr_shadow = TEGRA_UART_DEFAULT_LSR;
tup->fcr_shadow |= UART_FCR_DMA_SELECT; tup->fcr_shadow |= UART_FCR_DMA_SELECT;
tegra_uart_write(tup, tup->fcr_shadow, UART_FCR); tegra_uart_write(tup, tup->fcr_shadow, UART_FCR);
ret = tegra_uart_start_rx_dma(tup);
if (ret < 0) {
dev_err(tup->uport.dev, "Not able to start Rx DMA\n");
return ret;
}
} else { } else {
tegra_uart_write(tup, tup->fcr_shadow, UART_FCR); tegra_uart_write(tup, tup->fcr_shadow, UART_FCR);
} }
@ -1067,10 +1081,6 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
* Enable IE_RXS for the receive status interrupts like line errros. * Enable IE_RXS for the receive status interrupts like line errros.
* Enable IE_RX_TIMEOUT to get the bytes which cannot be DMA'd. * Enable IE_RX_TIMEOUT to get the bytes which cannot be DMA'd.
* *
* If using DMA mode, enable EORD instead of receive interrupt which
* will interrupt after the UART is done with the receive instead of
* the interrupt when the FIFO "threshold" is reached.
*
* EORD is different interrupt than RX_TIMEOUT - RX_TIMEOUT occurs when * EORD is different interrupt than RX_TIMEOUT - RX_TIMEOUT occurs when
* the DATA is sitting in the FIFO and couldn't be transferred to the * the DATA is sitting in the FIFO and couldn't be transferred to the
* DMA as the DMA size alignment (4 bytes) is not met. EORD will be * DMA as the DMA size alignment (4 bytes) is not met. EORD will be
@ -1081,11 +1091,14 @@ static int tegra_uart_hw_init(struct tegra_uart_port *tup)
* both the EORD as well as RX_TIMEOUT - SW sees RX_TIMEOUT first * both the EORD as well as RX_TIMEOUT - SW sees RX_TIMEOUT first
* then the EORD. * then the EORD.
*/ */
tup->ier_shadow = UART_IER_RLSI | UART_IER_RTOIE | UART_IER_RDI;
/*
* If using DMA mode, enable EORD interrupt to notify about RX
* completion.
*/
if (!tup->use_rx_pio) if (!tup->use_rx_pio)
tup->ier_shadow = UART_IER_RLSI | UART_IER_RTOIE | tup->ier_shadow |= TEGRA_UART_IER_EORD;
TEGRA_UART_IER_EORD;
else
tup->ier_shadow = UART_IER_RLSI | UART_IER_RTOIE | UART_IER_RDI;
tegra_uart_write(tup, tup->ier_shadow, UART_IER); tegra_uart_write(tup, tup->ier_shadow, UART_IER);
return 0; return 0;
@ -1140,6 +1153,9 @@ static int tegra_uart_dma_channel_allocate(struct tegra_uart_port *tup,
dma_release_channel(dma_chan); dma_release_channel(dma_chan);
return -ENOMEM; return -ENOMEM;
} }
dma_sync_single_for_device(tup->uport.dev, dma_phys,
TEGRA_UART_RX_DMA_BUFFER_SIZE,
DMA_TO_DEVICE);
dma_sconfig.src_addr = tup->uport.mapbase; dma_sconfig.src_addr = tup->uport.mapbase;
dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
dma_sconfig.src_maxburst = tup->cdata->max_dma_burst_bytes; dma_sconfig.src_maxburst = tup->cdata->max_dma_burst_bytes;

View File

@ -2603,6 +2603,7 @@ struct tty_driver *uart_console_device(struct console *co, int *index)
*index = co->index; *index = co->index;
return p->tty_driver; return p->tty_driver;
} }
EXPORT_SYMBOL_GPL(uart_console_device);
static ssize_t uart_get_attr_uartclk(struct device *dev, static ssize_t uart_get_attr_uartclk(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
@ -3081,6 +3082,89 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
} }
EXPORT_SYMBOL_GPL(uart_insert_char); EXPORT_SYMBOL_GPL(uart_insert_char);
int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch)
{
if (!IS_ENABLED(CONFIG_MAGIC_SYSRQ_SERIAL))
return 0;
if (!port->has_sysrq || !port->sysrq)
return 0;
if (ch && time_before(jiffies, port->sysrq)) {
handle_sysrq(ch);
port->sysrq = 0;
return 1;
}
port->sysrq = 0;
return 0;
}
EXPORT_SYMBOL_GPL(uart_handle_sysrq_char);
int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch)
{
if (!IS_ENABLED(CONFIG_MAGIC_SYSRQ_SERIAL))
return 0;
if (!port->has_sysrq || !port->sysrq)
return 0;
if (ch && time_before(jiffies, port->sysrq)) {
port->sysrq_ch = ch;
port->sysrq = 0;
return 1;
}
port->sysrq = 0;
return 0;
}
EXPORT_SYMBOL_GPL(uart_prepare_sysrq_char);
void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags)
{
int sysrq_ch;
if (!port->has_sysrq) {
spin_unlock_irqrestore(&port->lock, irqflags);
return;
}
sysrq_ch = port->sysrq_ch;
port->sysrq_ch = 0;
spin_unlock_irqrestore(&port->lock, irqflags);
if (sysrq_ch)
handle_sysrq(sysrq_ch);
}
EXPORT_SYMBOL_GPL(uart_unlock_and_check_sysrq);
/*
* We do the SysRQ and SAK checking like this...
*/
int uart_handle_break(struct uart_port *port)
{
struct uart_state *state = port->state;
if (port->handle_break)
port->handle_break(port);
if (port->has_sysrq) {
if (port->cons && port->cons->index == port->line) {
if (!port->sysrq) {
port->sysrq = jiffies + HZ*5;
return 1;
}
port->sysrq = 0;
}
}
if (port->flags & UPF_SAK)
do_SAK(state->port.tty);
return 0;
}
EXPORT_SYMBOL_GPL(uart_handle_break);
EXPORT_SYMBOL(uart_write_wakeup); EXPORT_SYMBOL(uart_write_wakeup);
EXPORT_SYMBOL(uart_register_driver); EXPORT_SYMBOL(uart_register_driver);
EXPORT_SYMBOL(uart_unregister_driver); EXPORT_SYMBOL(uart_unregister_driver);

View File

@ -12,10 +12,6 @@
* Serial driver for TX3927/TX4927/TX4925/TX4938 internal SIO controller * Serial driver for TX3927/TX4927/TX4925/TX4938 internal SIO controller
*/ */
#if defined(CONFIG_SERIAL_TXX9_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/ioport.h> #include <linux/ioport.h>
#include <linux/init.h> #include <linux/init.h>
@ -1095,6 +1091,7 @@ static int serial_txx9_probe(struct platform_device *dev)
port.flags = p->flags; port.flags = p->flags;
port.mapbase = p->mapbase; port.mapbase = p->mapbase;
port.dev = &dev->dev; port.dev = &dev->dev;
port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_TXX9_CONSOLE);
ret = serial_txx9_register_port(&port); ret = serial_txx9_register_port(&port);
if (ret < 0) { if (ret < 0) {
dev_err(&dev->dev, "unable to register port at index %d " dev_err(&dev->dev, "unable to register port at index %d "

View File

@ -15,10 +15,6 @@
* Modified to support SH7300 SCIF. Takashi Kusuda (Jun 2003). * Modified to support SH7300 SCIF. Takashi Kusuda (Jun 2003).
* Removed SH7300 support (Jul 2007). * Removed SH7300 support (Jul 2007).
*/ */
#if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#undef DEBUG #undef DEBUG
#include <linux/clk.h> #include <linux/clk.h>
@ -2887,6 +2883,7 @@ static int sci_init_single(struct platform_device *dev,
port->ops = &sci_uart_ops; port->ops = &sci_uart_ops;
port->iotype = UPIO_MEM; port->iotype = UPIO_MEM;
port->line = index; port->line = index;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_SH_SCI_CONSOLE);
res = platform_get_resource(dev, IORESOURCE_MEM, 0); res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (res == NULL) if (res == NULL)
@ -3015,12 +3012,9 @@ static void serial_console_write(struct console *co, const char *s,
unsigned long flags; unsigned long flags;
int locked = 1; int locked = 1;
#if defined(SUPPORT_SYSRQ)
if (port->sysrq) if (port->sysrq)
locked = 0; locked = 0;
else else if (oops_in_progress)
#endif
if (oops_in_progress)
locked = spin_trylock_irqsave(&port->lock, flags); locked = spin_trylock_irqsave(&port->lock, flags);
else else
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);

View File

@ -3,10 +3,6 @@
* Copyright (C) 2012-2015 Spreadtrum Communications Inc. * Copyright (C) 2012-2015 Spreadtrum Communications Inc.
*/ */
#if defined(CONFIG_SERIAL_SPRD_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/delay.h> #include <linux/delay.h>
@ -1230,6 +1226,7 @@ static int sprd_probe(struct platform_device *pdev)
up->fifosize = SPRD_FIFO_SIZE; up->fifosize = SPRD_FIFO_SIZE;
up->ops = &serial_sprd_ops; up->ops = &serial_sprd_ops;
up->flags = UPF_BOOT_AUTOCONF; up->flags = UPF_BOOT_AUTOCONF;
up->has_sysrq = IS_ENABLED(CONFIG_SERIAL_SPRD_CONSOLE);
ret = sprd_clk_init(up); ret = sprd_clk_init(up);
if (ret) if (ret)

View File

@ -5,10 +5,6 @@
* Copyright (C) 2003-2013 STMicroelectronics (R&D) Limited * Copyright (C) 2003-2013 STMicroelectronics (R&D) Limited
*/ */
#if defined(CONFIG_SERIAL_ST_ASC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/console.h> #include <linux/console.h>
@ -508,7 +504,6 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
struct ktermios *old) struct ktermios *old)
{ {
struct asc_port *ascport = to_asc_port(port); struct asc_port *ascport = to_asc_port(port);
struct device_node *np = port->dev->of_node;
struct gpio_desc *gpiod; struct gpio_desc *gpiod;
unsigned int baud; unsigned int baud;
u32 ctrl_val; u32 ctrl_val;
@ -570,13 +565,12 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
pinctrl_select_state(ascport->pinctrl, pinctrl_select_state(ascport->pinctrl,
ascport->states[NO_HW_FLOWCTRL]); ascport->states[NO_HW_FLOWCTRL]);
gpiod = devm_fwnode_get_gpiod_from_child(port->dev, gpiod = devm_gpiod_get(port->dev, "rts", GPIOD_OUT_LOW);
"rts", if (!IS_ERR(gpiod)) {
&np->fwnode, gpiod_set_consumer_name(gpiod,
GPIOD_OUT_LOW, port->dev->of_node->name);
np->name);
if (!IS_ERR(gpiod))
ascport->rts = gpiod; ascport->rts = gpiod;
}
} }
} }
@ -730,6 +724,7 @@ static int asc_init_port(struct asc_port *ascport,
port->fifosize = ASC_FIFO_SIZE; port->fifosize = ASC_FIFO_SIZE;
port->dev = &pdev->dev; port->dev = &pdev->dev;
port->irq = platform_get_irq(pdev, 0); port->irq = platform_get_irq(pdev, 0);
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ST_ASC_CONSOLE);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
port->membase = devm_ioremap_resource(&pdev->dev, res); port->membase = devm_ioremap_resource(&pdev->dev, res);

View File

@ -8,10 +8,6 @@
* Inspired by st-asc.c from STMicroelectronics (c) * Inspired by st-asc.c from STMicroelectronics (c)
*/ */
#if defined(CONFIG_SERIAL_STM32_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/delay.h> #include <linux/delay.h>
@ -926,6 +922,7 @@ static int stm32_init_port(struct stm32_port *stm32port,
port->ops = &stm32_uart_ops; port->ops = &stm32_uart_ops;
port->dev = &pdev->dev; port->dev = &pdev->dev;
port->fifosize = stm32port->info->cfg.fifosize; port->fifosize = stm32port->info->cfg.fifosize;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_STM32_CONSOLE);
ret = platform_get_irq(pdev, 0); ret = platform_get_irq(pdev, 0);
if (ret <= 0) if (ret <= 0)

View File

@ -25,10 +25,6 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/setup.h> #include <asm/setup.h>
#if defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/sunserialcore.h> #include <linux/sunserialcore.h>
@ -552,6 +548,7 @@ static int hv_probe(struct platform_device *op)
sunhv_port = port; sunhv_port = port;
port->has_sysrq = 1;
port->line = 0; port->line = 0;
port->ops = &sunhv_pops; port->ops = &sunhv_pops;
port->type = PORT_SUNHV; port->type = PORT_SUNHV;

View File

@ -40,10 +40,6 @@
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/setup.h> #include <asm/setup.h>
#if defined(CONFIG_SERIAL_SUNSAB_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/sunserialcore.h> #include <linux/sunserialcore.h>
@ -985,6 +981,7 @@ static int sunsab_init_one(struct uart_sunsab_port *up,
up->port.fifosize = SAB82532_XMIT_FIFO_SIZE; up->port.fifosize = SAB82532_XMIT_FIFO_SIZE;
up->port.iotype = UPIO_MEM; up->port.iotype = UPIO_MEM;
up->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNSAB_CONSOLE);
writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc); writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc);

View File

@ -44,10 +44,6 @@
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/setup.h> #include <asm/setup.h>
#if defined(CONFIG_SERIAL_SUNSU_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/sunserialcore.h> #include <linux/sunserialcore.h>
@ -1475,6 +1471,7 @@ static int su_probe(struct platform_device *op)
up->port.type = PORT_UNKNOWN; up->port.type = PORT_UNKNOWN;
up->port.uartclk = (SU_BASE_BAUD * 16); up->port.uartclk = (SU_BASE_BAUD * 16);
up->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNSU_CONSOLE);
err = 0; err = 0;
if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) { if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) {

View File

@ -40,10 +40,6 @@
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/setup.h> #include <asm/setup.h>
#if defined(CONFIG_SERIAL_SUNZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/sunserialcore.h> #include <linux/sunserialcore.h>
@ -1444,6 +1440,7 @@ static int zs_probe(struct platform_device *op)
up[0].port.line = (inst * 2) + 0; up[0].port.line = (inst * 2) + 0;
up[0].port.dev = &op->dev; up[0].port.dev = &op->dev;
up[0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; up[0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A;
up[0].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNZILOG_CONSOLE);
if (keyboard_mouse) if (keyboard_mouse)
up[0].flags |= SUNZILOG_FLAG_CONS_KEYB; up[0].flags |= SUNZILOG_FLAG_CONS_KEYB;
sunzilog_init_hw(&up[0]); sunzilog_init_hw(&up[0]);
@ -1461,6 +1458,7 @@ static int zs_probe(struct platform_device *op)
up[1].port.line = (inst * 2) + 1; up[1].port.line = (inst * 2) + 1;
up[1].port.dev = &op->dev; up[1].port.dev = &op->dev;
up[1].flags |= 0; up[1].flags |= 0;
up[1].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNZILOG_CONSOLE);
if (keyboard_mouse) if (keyboard_mouse)
up[1].flags |= SUNZILOG_FLAG_CONS_MOUSE; up[1].flags |= SUNZILOG_FLAG_CONS_MOUSE;
sunzilog_init_hw(&up[1]); sunzilog_init_hw(&up[1]);

View File

@ -332,8 +332,6 @@ static int qe_uart_tx_pump(struct uart_qe_port *qe_port)
struct uart_port *port = &qe_port->port; struct uart_port *port = &qe_port->port;
struct circ_buf *xmit = &port->state->xmit; struct circ_buf *xmit = &port->state->xmit;
bdp = qe_port->rx_cur;
/* Handle xon/xoff */ /* Handle xon/xoff */
if (port->x_char) { if (port->x_char) {
/* Pick next descriptor and fill from buffer */ /* Pick next descriptor and fill from buffer */
@ -551,9 +549,7 @@ static void qe_uart_int_rx(struct uart_qe_port *qe_port)
/* Overrun does not affect the current character ! */ /* Overrun does not affect the current character ! */
if (status & BD_SC_OV) if (status & BD_SC_OV)
tty_insert_flip_char(tport, 0, TTY_OVERRUN); tty_insert_flip_char(tport, 0, TTY_OVERRUN);
#ifdef SUPPORT_SYSRQ
port->sysrq = 0; port->sysrq = 0;
#endif
goto error_return; goto error_return;
} }

View File

@ -7,10 +7,6 @@
* Based on drivers/serial/8250.c, by Russell King. * Based on drivers/serial/8250.c, by Russell King.
*/ */
#if defined(CONFIG_SERIAL_VR41XX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/console.h> #include <linux/console.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
@ -869,6 +865,7 @@ static int siu_probe(struct platform_device *dev)
port = &siu_uart_ports[i]; port = &siu_uart_ports[i];
port->ops = &siu_uart_ops; port->ops = &siu_uart_ops;
port->dev = &dev->dev; port->dev = &dev->dev;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_VR41XX_CONSOLE);
retval = uart_add_one_port(&siu_uart_driver, port); retval = uart_add_one_port(&siu_uart_driver, port);
if (retval < 0) { if (retval < 0) {

View File

@ -7,10 +7,6 @@
* Author: Robert Love <rlove@google.com> * Author: Robert Love <rlove@google.com>
*/ */
#if defined(CONFIG_SERIAL_VT8500_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
# define SUPPORT_SYSRQ
#endif
#include <linux/hrtimer.h> #include <linux/hrtimer.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/io.h> #include <linux/io.h>
@ -703,6 +699,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
vt8500_port->uart.line = port; vt8500_port->uart.line = port;
vt8500_port->uart.dev = &pdev->dev; vt8500_port->uart.dev = &pdev->dev;
vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;
vt8500_port->uart.has_sysrq = IS_ENABLED(CONFIG_SERIAL_VT8500_CONSOLE);
/* Serial core uses the magic "16" everywhere - adjust for it */ /* Serial core uses the magic "16" everywhere - adjust for it */
vt8500_port->uart.uartclk = 16 * clk_get_rate(vt8500_port->clk) / vt8500_port->uart.uartclk = 16 * clk_get_rate(vt8500_port->clk) /

View File

@ -9,10 +9,6 @@
* in the code. * in the code.
*/ */
#if defined(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/console.h> #include <linux/console.h>
@ -157,6 +153,16 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255");
#define CDNS_UART_MODEMCR_RTS 0x00000002 /* Request to send output control */ #define CDNS_UART_MODEMCR_RTS 0x00000002 /* Request to send output control */
#define CDNS_UART_MODEMCR_DTR 0x00000001 /* Data Terminal Ready */ #define CDNS_UART_MODEMCR_DTR 0x00000001 /* Data Terminal Ready */
/*
* Modem Status register:
* The read/write Modem Status register reports the interface with the modem
* or data set, or a peripheral device emulating a modem.
*/
#define CDNS_UART_MODEMSR_DCD BIT(7) /* Data Carrier Detect */
#define CDNS_UART_MODEMSR_RI BIT(6) /* Ting Indicator */
#define CDNS_UART_MODEMSR_DSR BIT(5) /* Data Set Ready */
#define CDNS_UART_MODEMSR_CTS BIT(4) /* Clear To Send */
/* /*
* Channel Status Register: * Channel Status Register:
* The channel status register (CSR) is provided to enable the control logic * The channel status register (CSR) is provided to enable the control logic
@ -684,7 +690,7 @@ static void cdns_uart_break_ctl(struct uart_port *port, int ctl)
static void cdns_uart_set_termios(struct uart_port *port, static void cdns_uart_set_termios(struct uart_port *port,
struct ktermios *termios, struct ktermios *old) struct ktermios *termios, struct ktermios *old)
{ {
unsigned int cval = 0; u32 cval = 0;
unsigned int baud, minbaud, maxbaud; unsigned int baud, minbaud, maxbaud;
unsigned long flags; unsigned long flags;
unsigned int ctrl_reg, mode_reg, val; unsigned int ctrl_reg, mode_reg, val;
@ -805,6 +811,13 @@ static void cdns_uart_set_termios(struct uart_port *port,
cval |= mode_reg & 1; cval |= mode_reg & 1;
writel(cval, port->membase + CDNS_UART_MR); writel(cval, port->membase + CDNS_UART_MR);
cval = readl(port->membase + CDNS_UART_MODEMCR);
if (termios->c_cflag & CRTSCTS)
cval |= CDNS_UART_MODEMCR_FCM;
else
cval &= ~CDNS_UART_MODEMCR_FCM;
writel(cval, port->membase + CDNS_UART_MODEMCR);
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
} }
@ -1007,12 +1020,24 @@ static void cdns_uart_config_port(struct uart_port *port, int flags)
*/ */
static unsigned int cdns_uart_get_mctrl(struct uart_port *port) static unsigned int cdns_uart_get_mctrl(struct uart_port *port)
{ {
u32 val;
unsigned int mctrl = 0;
struct cdns_uart *cdns_uart_data = port->private_data; struct cdns_uart *cdns_uart_data = port->private_data;
if (cdns_uart_data->cts_override) if (cdns_uart_data->cts_override)
return 0; return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; val = readl(port->membase + CDNS_UART_MODEMSR);
if (val & CDNS_UART_MODEMSR_CTS)
mctrl |= TIOCM_CTS;
if (val & CDNS_UART_MODEMSR_DSR)
mctrl |= TIOCM_DSR;
if (val & CDNS_UART_MODEMSR_RI)
mctrl |= TIOCM_RNG;
if (val & CDNS_UART_MODEMSR_DCD)
mctrl |= TIOCM_CAR;
return mctrl;
} }
static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
@ -1027,12 +1052,13 @@ static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl)
val = readl(port->membase + CDNS_UART_MODEMCR); val = readl(port->membase + CDNS_UART_MODEMCR);
mode_reg = readl(port->membase + CDNS_UART_MR); mode_reg = readl(port->membase + CDNS_UART_MR);
val &= ~(CDNS_UART_MODEMCR_RTS | CDNS_UART_MODEMCR_DTR | val &= ~(CDNS_UART_MODEMCR_RTS | CDNS_UART_MODEMCR_DTR);
CDNS_UART_MODEMCR_FCM);
mode_reg &= ~CDNS_UART_MR_CHMODE_MASK; mode_reg &= ~CDNS_UART_MR_CHMODE_MASK;
if (mctrl & TIOCM_RTS || mctrl & TIOCM_DTR) if (mctrl & TIOCM_RTS)
val |= CDNS_UART_MODEMCR_FCM; val |= CDNS_UART_MODEMCR_RTS;
if (mctrl & TIOCM_DTR)
val |= CDNS_UART_MODEMCR_DTR;
if (mctrl & TIOCM_LOOP) if (mctrl & TIOCM_LOOP)
mode_reg |= CDNS_UART_MR_CHMODE_L_LOOP; mode_reg |= CDNS_UART_MR_CHMODE_L_LOOP;
else else
@ -1634,6 +1660,7 @@ static int cdns_uart_probe(struct platform_device *pdev)
port->flags = UPF_BOOT_AUTOCONF; port->flags = UPF_BOOT_AUTOCONF;
port->ops = &cdns_uart_ops; port->ops = &cdns_uart_ops;
port->fifosize = CDNS_UART_FIFO_SIZE; port->fifosize = CDNS_UART_FIFO_SIZE;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE);
/* /*
* Register the port. * Register the port.

View File

@ -44,10 +44,6 @@
* complicated and prevents the use of some automatic modes of operation. * complicated and prevents the use of some automatic modes of operation.
*/ */
#if defined(CONFIG_SERIAL_ZS_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
#define SUPPORT_SYSRQ
#endif
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/console.h> #include <linux/console.h>
#include <linux/delay.h> #include <linux/delay.h>
@ -1106,6 +1102,7 @@ static int __init zs_probe_sccs(void)
zport->scc = &zs_sccs[chip]; zport->scc = &zs_sccs[chip];
zport->clk_mode = 16; zport->clk_mode = 16;
uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ZS_CONSOLE);
uport->irq = zs_parms.irq[chip]; uport->irq = zs_parms.irq[chip];
uport->uartclk = ZS_CLOCK; uport->uartclk = ZS_CLOCK;
uport->fifosize = 1; uport->fifosize = 1;

View File

@ -1334,10 +1334,10 @@ static void throttle(struct tty_struct * tty)
DBGINFO(("%s throttle\n", info->device_name)); DBGINFO(("%s throttle\n", info->device_name));
if (I_IXOFF(tty)) if (I_IXOFF(tty))
send_xchar(tty, STOP_CHAR(tty)); send_xchar(tty, STOP_CHAR(tty));
if (C_CRTSCTS(tty)) { if (C_CRTSCTS(tty)) {
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
info->signals &= ~SerialSignal_RTS; info->signals &= ~SerialSignal_RTS;
set_signals(info); set_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
} }
} }
@ -1359,10 +1359,10 @@ static void unthrottle(struct tty_struct * tty)
else else
send_xchar(tty, START_CHAR(tty)); send_xchar(tty, START_CHAR(tty));
} }
if (C_CRTSCTS(tty)) { if (C_CRTSCTS(tty)) {
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
info->signals |= SerialSignal_RTS; info->signals |= SerialSignal_RTS;
set_signals(info); set_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
} }
} }
@ -2098,7 +2098,7 @@ static void isr_rxdata(struct slgt_info *info)
if (desc_complete(info->rbufs[i])) { if (desc_complete(info->rbufs[i])) {
/* all buffers full */ /* all buffers full */
rx_stop(info); rx_stop(info);
info->rx_restart = 1; info->rx_restart = true;
continue; continue;
} }
info->rbufs[i].buf[count++] = (unsigned char)reg; info->rbufs[i].buf[count++] = (unsigned char)reg;
@ -2560,8 +2560,8 @@ static void change_params(struct slgt_info *info)
info->read_status_mask = IRQ_RXOVER; info->read_status_mask = IRQ_RXOVER;
if (I_INPCK(info->port.tty)) if (I_INPCK(info->port.tty))
info->read_status_mask |= MASK_PARITY | MASK_FRAMING; info->read_status_mask |= MASK_PARITY | MASK_FRAMING;
if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
info->read_status_mask |= MASK_BREAK; info->read_status_mask |= MASK_BREAK;
if (I_IGNPAR(info->port.tty)) if (I_IGNPAR(info->port.tty))
info->ignore_status_mask |= MASK_PARITY | MASK_FRAMING; info->ignore_status_mask |= MASK_PARITY | MASK_FRAMING;
if (I_IGNBRK(info->port.tty)) { if (I_IGNBRK(info->port.tty)) {
@ -3192,7 +3192,7 @@ static int tiocmset(struct tty_struct *tty,
info->signals &= ~SerialSignal_DTR; info->signals &= ~SerialSignal_DTR;
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
set_signals(info); set_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
return 0; return 0;
} }
@ -3203,7 +3203,7 @@ static int carrier_raised(struct tty_port *port)
struct slgt_info *info = container_of(port, struct slgt_info, port); struct slgt_info *info = container_of(port, struct slgt_info, port);
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
get_signals(info); get_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
return (info->signals & SerialSignal_DCD) ? 1 : 0; return (info->signals & SerialSignal_DCD) ? 1 : 0;
} }
@ -3218,7 +3218,7 @@ static void dtr_rts(struct tty_port *port, int on)
info->signals |= SerialSignal_RTS | SerialSignal_DTR; info->signals |= SerialSignal_RTS | SerialSignal_DTR;
else else
info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR); info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
set_signals(info); set_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
} }

View File

@ -1453,10 +1453,10 @@ static void throttle(struct tty_struct * tty)
if (I_IXOFF(tty)) if (I_IXOFF(tty))
send_xchar(tty, STOP_CHAR(tty)); send_xchar(tty, STOP_CHAR(tty));
if (C_CRTSCTS(tty)) { if (C_CRTSCTS(tty)) {
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
info->serial_signals &= ~SerialSignal_RTS; info->serial_signals &= ~SerialSignal_RTS;
set_signals(info); set_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
} }
} }
@ -1482,10 +1482,10 @@ static void unthrottle(struct tty_struct * tty)
send_xchar(tty, START_CHAR(tty)); send_xchar(tty, START_CHAR(tty));
} }
if (C_CRTSCTS(tty)) { if (C_CRTSCTS(tty)) {
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
info->serial_signals |= SerialSignal_RTS; info->serial_signals |= SerialSignal_RTS;
set_signals(info); set_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
} }
} }
@ -2470,7 +2470,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status )
if (status & SerialSignal_CTS) { if (status & SerialSignal_CTS) {
if ( debug_level >= DEBUG_LEVEL_ISR ) if ( debug_level >= DEBUG_LEVEL_ISR )
printk("CTS tx start..."); printk("CTS tx start...");
info->port.tty->hw_stopped = 0; info->port.tty->hw_stopped = 0;
tx_start(info); tx_start(info);
info->pending_bh |= BH_TRANSMIT; info->pending_bh |= BH_TRANSMIT;
return; return;
@ -2479,7 +2479,7 @@ static void isr_io_pin( SLMP_INFO *info, u16 status )
if (!(status & SerialSignal_CTS)) { if (!(status & SerialSignal_CTS)) {
if ( debug_level >= DEBUG_LEVEL_ISR ) if ( debug_level >= DEBUG_LEVEL_ISR )
printk("CTS tx stop..."); printk("CTS tx stop...");
info->port.tty->hw_stopped = 1; info->port.tty->hw_stopped = 1;
tx_stop(info); tx_stop(info);
} }
} }
@ -2806,8 +2806,8 @@ static void change_params(SLMP_INFO *info)
info->read_status_mask2 = OVRN; info->read_status_mask2 = OVRN;
if (I_INPCK(info->port.tty)) if (I_INPCK(info->port.tty))
info->read_status_mask2 |= PE | FRME; info->read_status_mask2 |= PE | FRME;
if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty))
info->read_status_mask1 |= BRKD; info->read_status_mask1 |= BRKD;
if (I_IGNPAR(info->port.tty)) if (I_IGNPAR(info->port.tty))
info->ignore_status_mask2 |= PE | FRME; info->ignore_status_mask2 |= PE | FRME;
if (I_IGNBRK(info->port.tty)) { if (I_IGNBRK(info->port.tty)) {
@ -3177,7 +3177,7 @@ static int tiocmget(struct tty_struct *tty)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
get_signals(info); get_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS : 0) | result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS : 0) |
@ -3215,7 +3215,7 @@ static int tiocmset(struct tty_struct *tty,
info->serial_signals &= ~SerialSignal_DTR; info->serial_signals &= ~SerialSignal_DTR;
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
set_signals(info); set_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
return 0; return 0;
@ -3227,7 +3227,7 @@ static int carrier_raised(struct tty_port *port)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&info->lock,flags); spin_lock_irqsave(&info->lock,flags);
get_signals(info); get_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
return (info->serial_signals & SerialSignal_DCD) ? 1 : 0; return (info->serial_signals & SerialSignal_DCD) ? 1 : 0;
@ -3243,7 +3243,7 @@ static void dtr_rts(struct tty_port *port, int on)
info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR;
else else
info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
set_signals(info); set_signals(info);
spin_unlock_irqrestore(&info->lock,flags); spin_unlock_irqrestore(&info->lock,flags);
} }

View File

@ -967,8 +967,6 @@ static struct input_handler sysrq_handler = {
.id_table = sysrq_ids, .id_table = sysrq_ids,
}; };
static bool sysrq_handler_registered;
static inline void sysrq_register_handler(void) static inline void sysrq_register_handler(void)
{ {
int error; int error;
@ -978,16 +976,11 @@ static inline void sysrq_register_handler(void)
error = input_register_handler(&sysrq_handler); error = input_register_handler(&sysrq_handler);
if (error) if (error)
pr_err("Failed to register input handler, error %d", error); pr_err("Failed to register input handler, error %d", error);
else
sysrq_handler_registered = true;
} }
static inline void sysrq_unregister_handler(void) static inline void sysrq_unregister_handler(void)
{ {
if (sysrq_handler_registered) { input_unregister_handler(&sysrq_handler);
input_unregister_handler(&sysrq_handler);
sysrq_handler_registered = false;
}
} }
static int sysrq_reset_seq_param_set(const char *buffer, static int sysrq_reset_seq_param_set(const char *buffer,

View File

@ -17,32 +17,28 @@
* include/asm/termbits.h file. * include/asm/termbits.h file.
*/ */
static const speed_t baud_table[] = { static const speed_t baud_table[] = {
0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400,
9600, 19200, 38400, 57600, 115200, 230400, 460800, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800,
#ifdef __sparc__ #ifdef __sparc__
76800, 153600, 307200, 614400, 921600 76800, 153600, 307200, 614400, 921600, 500000, 576000,
1000000, 1152000, 1500000, 2000000
#else #else
500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000,
2500000, 3000000, 3500000, 4000000 2500000, 3000000, 3500000, 4000000
#endif #endif
}; };
#ifndef __sparc__
static const tcflag_t baud_bits[] = { static const tcflag_t baud_bits[] = {
B0, B50, B75, B110, B134, B150, B200, B300, B600, B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400,
B1200, B1800, B2400, B4800, B9600, B19200, B38400, B4800, B9600, B19200, B38400, B57600, B115200, B230400, B460800,
B57600, B115200, B230400, B460800, B500000, B576000, #ifdef __sparc__
B921600, B1000000, B1152000, B1500000, B2000000, B2500000, B76800, B153600, B307200, B614400, B921600, B500000, B576000,
B3000000, B3500000, B4000000 B1000000, B1152000, B1500000, B2000000
};
#else #else
static const tcflag_t baud_bits[] = { B500000, B576000, B921600, B1000000, B1152000, B1500000, B2000000,
B0, B50, B75, B110, B134, B150, B200, B300, B600, B2500000, B3000000, B3500000, B4000000
B1200, B1800, B2400, B4800, B9600, B19200, B38400,
B57600, B115200, B230400, B460800, B76800, B153600,
B307200, B614400, B921600
};
#endif #endif
};
static int n_baud_table = ARRAY_SIZE(baud_table); static int n_baud_table = ARRAY_SIZE(baud_table);

View File

@ -1893,7 +1893,7 @@ static struct tty_driver *tty_lookup_driver(dev_t device, struct file *filp,
struct tty_struct *tty_kopen(dev_t device) struct tty_struct *tty_kopen(dev_t device)
{ {
struct tty_struct *tty; struct tty_struct *tty;
struct tty_driver *driver = NULL; struct tty_driver *driver;
int index = -1; int index = -1;
mutex_lock(&tty_mutex); mutex_lock(&tty_mutex);

View File

@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
conmakehash
consolemap_deftbl.c consolemap_deftbl.c
defkeymap.c defkeymap.c

View File

@ -12,10 +12,12 @@ obj-$(CONFIG_HW_CONSOLE) += vt.o defkeymap.o
# Files generated that shall be removed upon make clean # Files generated that shall be removed upon make clean
clean-files := consolemap_deftbl.c defkeymap.c clean-files := consolemap_deftbl.c defkeymap.c
quiet_cmd_conmk = CONMK $@ hostprogs-y += conmakehash
cmd_conmk = scripts/conmakehash $< > $@
$(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) quiet_cmd_conmk = CONMK $@
cmd_conmk = $(obj)/conmakehash $< > $@
$(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash
$(call cmd,conmk) $(call cmd,conmk)
$(obj)/defkeymap.o: $(obj)/defkeymap.c $(obj)/defkeymap.o: $(obj)/defkeymap.c

Some files were not shown because too many files have changed in this diff Show More