Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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
...

+823 -933
+6
MAINTAINERS
··· 6181 6181 S: Maintained 6182 6182 F: drivers/media/rc/ene_ir.* 6183 6183 6184 + EPAPR HYPERVISOR BYTE CHANNEL DEVICE DRIVER 6185 + M: Laurentiu Tudor <laurentiu.tudor@nxp.com> 6186 + L: linuxppc-dev@lists.ozlabs.org 6187 + S: Maintained 6188 + F: drivers/tty/ehv_bytechan.c 6189 + 6184 6190 EPSON S1D13XXX FRAMEBUFFER DRIVER 6185 6191 M: Kristoffer Ericson <kristoffer.ericson@gmail.com> 6186 6192 S: Maintained
-2
arch/alpha/kernel/setup.c
··· 655 655 #ifdef CONFIG_VT 656 656 #if defined(CONFIG_VGA_CONSOLE) 657 657 conswitchp = &vga_con; 658 - #elif defined(CONFIG_DUMMY_CONSOLE) 659 - conswitchp = &dummy_con; 660 658 #endif 661 659 #endif 662 660
-4
arch/arc/kernel/setup.c
··· 572 572 */ 573 573 root_mountflags &= ~MS_RDONLY; 574 574 575 - #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) 576 - conswitchp = &dummy_con; 577 - #endif 578 - 579 575 arc_unwind_init(); 580 576 } 581 577
-2
arch/arm/kernel/setup.c
··· 1164 1164 #ifdef CONFIG_VT 1165 1165 #if defined(CONFIG_VGA_CONSOLE) 1166 1166 conswitchp = &vga_con; 1167 - #elif defined(CONFIG_DUMMY_CONSOLE) 1168 - conswitchp = &dummy_con; 1169 1167 #endif 1170 1168 #endif 1171 1169
-3
arch/arm64/kernel/setup.c
··· 360 360 init_task.thread_info.ttbr0 = __pa_symbol(empty_zero_page); 361 361 #endif 362 362 363 - #ifdef CONFIG_VT 364 - conswitchp = &dummy_con; 365 - #endif 366 363 if (boot_args[1] || boot_args[2] || boot_args[3]) { 367 364 pr_err("WARNING: x1-x3 nonzero in violation of boot protocol:\n" 368 365 "\tx1: %016llx\n\tx2: %016llx\n\tx3: %016llx\n"
-4
arch/csky/kernel/setup.c
··· 136 136 #ifdef CONFIG_HIGHMEM 137 137 kmap_init(); 138 138 #endif 139 - 140 - #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) 141 - conswitchp = &dummy_con; 142 - #endif 143 139 } 144 140 145 141 unsigned long va_pa_offset;
-3
arch/ia64/kernel/setup.c
··· 608 608 609 609 #ifdef CONFIG_VT 610 610 if (!conswitchp) { 611 - # if defined(CONFIG_DUMMY_CONSOLE) 612 - conswitchp = &dummy_con; 613 - # endif 614 611 # if defined(CONFIG_VGA_CONSOLE) 615 612 /* 616 613 * Non-legacy systems may route legacy VGA MMIO range to system
-4
arch/m68k/kernel/setup_mm.c
··· 274 274 275 275 parse_early_param(); 276 276 277 - #ifdef CONFIG_DUMMY_CONSOLE 278 - conswitchp = &dummy_con; 279 - #endif 280 - 281 277 switch (m68k_machtype) { 282 278 #ifdef CONFIG_AMIGA 283 279 case MACH_AMIGA:
-4
arch/m68k/kernel/setup_no.c
··· 146 146 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 147 147 boot_command_line[COMMAND_LINE_SIZE-1] = 0; 148 148 149 - #if defined(CONFIG_FRAMEBUFFER_CONSOLE) && defined(CONFIG_DUMMY_CONSOLE) 150 - conswitchp = &dummy_con; 151 - #endif 152 - 153 149 /* 154 150 * Give all the memory to the bootmap allocator, tell it to put the 155 151 * boot mem_map at the start of memory.
-1
arch/m68k/sun3x/config.c
··· 70 70 break; 71 71 default: 72 72 serial_console = 0; 73 - conswitchp = &dummy_con; 74 73 break; 75 74 } 76 75 #endif
-4
arch/microblaze/kernel/setup.c
··· 65 65 microblaze_cache_init(); 66 66 67 67 xilinx_pci_init(); 68 - 69 - #if defined(CONFIG_DUMMY_CONSOLE) 70 - conswitchp = &dummy_con; 71 - #endif 72 68 } 73 69 74 70 #ifdef CONFIG_MTD_UCLINUX
-2
arch/mips/kernel/setup.c
··· 796 796 #if defined(CONFIG_VT) 797 797 #if defined(CONFIG_VGA_CONSOLE) 798 798 conswitchp = &vga_con; 799 - #elif defined(CONFIG_DUMMY_CONSOLE) 800 - conswitchp = &dummy_con; 801 799 #endif 802 800 #endif 803 801
-5
arch/nds32/kernel/setup.c
··· 317 317 318 318 unflatten_and_copy_device_tree(); 319 319 320 - if(IS_ENABLED(CONFIG_VT)) { 321 - if(IS_ENABLED(CONFIG_DUMMY_CONSOLE)) 322 - conswitchp = &dummy_con; 323 - } 324 - 325 320 *cmdline_p = boot_command_line; 326 321 early_trap_init(); 327 322 }
-4
arch/nios2/kernel/setup.c
··· 196 196 * get kmalloc into gear 197 197 */ 198 198 paging_init(); 199 - 200 - #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) 201 - conswitchp = &dummy_con; 202 - #endif 203 199 }
-5
arch/openrisc/kernel/setup.c
··· 308 308 /* paging_init() sets up the MMU and marks all pages as reserved */ 309 309 paging_init(); 310 310 311 - #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) 312 - if (!conswitchp) 313 - conswitchp = &dummy_con; 314 - #endif 315 - 316 311 *cmdline_p = boot_command_line; 317 312 318 313 printk(KERN_INFO "OpenRISC Linux -- http://openrisc.io\n");
-4
arch/parisc/kernel/setup.c
··· 151 151 dma_ops_init(); 152 152 #endif 153 153 154 - #if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE) 155 - conswitchp = &dummy_con; /* we use do_take_over_console() later ! */ 156 - #endif 157 - 158 154 clear_sched_clock_stable(); 159 155 } 160 156
+3 -1
arch/powerpc/kernel/legacy_serial.c
··· 479 479 port->irq = virq; 480 480 481 481 #ifdef CONFIG_SERIAL_8250_FSL 482 - if (of_device_is_compatible(np, "fsl,ns16550")) 482 + if (of_device_is_compatible(np, "fsl,ns16550")) { 483 483 port->handle_irq = fsl8250_handle_irq; 484 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); 485 + } 484 486 #endif 485 487 } 486 488
-3
arch/powerpc/kernel/setup-common.c
··· 949 949 950 950 early_memtest(min_low_pfn << PAGE_SHIFT, max_low_pfn << PAGE_SHIFT); 951 951 952 - if (IS_ENABLED(CONFIG_DUMMY_CONSOLE)) 953 - conswitchp = &dummy_con; 954 - 955 952 if (ppc_md.setup_arch) 956 953 ppc_md.setup_arch(); 957 954
-3
arch/powerpc/platforms/cell/setup.c
··· 240 240 init_pci_config_tokens(); 241 241 242 242 cbe_pervasive_init(); 243 - #ifdef CONFIG_DUMMY_CONSOLE 244 - conswitchp = &dummy_con; 245 - #endif 246 243 247 244 mmio_nvram_init(); 248 245 }
-3
arch/powerpc/platforms/maple/setup.c
··· 183 183 /* Lookup PCI hosts */ 184 184 maple_pci_init(); 185 185 186 - #ifdef CONFIG_DUMMY_CONSOLE 187 - conswitchp = &dummy_con; 188 - #endif 189 186 maple_use_rtas_reboot_and_halt_if_present(); 190 187 191 188 printk(KERN_DEBUG "Using native/NAP idle loop\n");
-4
arch/powerpc/platforms/pasemi/setup.c
··· 147 147 /* Lookup PCI hosts */ 148 148 pas_pci_init(); 149 149 150 - #ifdef CONFIG_DUMMY_CONSOLE 151 - conswitchp = &dummy_con; 152 - #endif 153 - 154 150 /* Remap SDC register for doing reset */ 155 151 /* XXXOJN This should maybe come out of the device tree */ 156 152 reset_reg = ioremap(0xfc101100, 4);
-4
arch/powerpc/platforms/ps3/setup.c
··· 200 200 smp_init_ps3(); 201 201 #endif 202 202 203 - #ifdef CONFIG_DUMMY_CONSOLE 204 - conswitchp = &dummy_con; 205 - #endif 206 - 207 203 prealloc_ps3fb_videomemory(); 208 204 prealloc_ps3flash_bounce_buffer(); 209 205
-4
arch/riscv/kernel/setup.c
··· 78 78 setup_smp(); 79 79 #endif 80 80 81 - #ifdef CONFIG_DUMMY_CONSOLE 82 - conswitchp = &dummy_con; 83 - #endif 84 - 85 81 riscv_fill_hwcap(); 86 82 }
-2
arch/s390/kernel/setup.c
··· 241 241 SET_CONSOLE_SCLP; 242 242 #endif 243 243 } 244 - if (IS_ENABLED(CONFIG_VT) && IS_ENABLED(CONFIG_DUMMY_CONSOLE)) 245 - conswitchp = &dummy_con; 246 244 } 247 245 248 246 #ifdef CONFIG_CRASH_DUMP
-4
arch/sh/kernel/setup.c
··· 341 341 342 342 paging_init(); 343 343 344 - #ifdef CONFIG_DUMMY_CONSOLE 345 - conswitchp = &dummy_con; 346 - #endif 347 - 348 344 /* Perform the machine specific initialisation */ 349 345 if (likely(sh_mv.mv_setup)) 350 346 sh_mv.mv_setup(cmdline_p);
-4
arch/sparc/kernel/setup_32.c
··· 332 332 break; 333 333 } 334 334 335 - #ifdef CONFIG_DUMMY_CONSOLE 336 - conswitchp = &dummy_con; 337 - #endif 338 - 339 335 idprom_init(); 340 336 load_mmu(); 341 337
-4
arch/sparc/kernel/setup_64.c
··· 653 653 else 654 654 pr_info("ARCH: SUN4U\n"); 655 655 656 - #ifdef CONFIG_DUMMY_CONSOLE 657 - conswitchp = &dummy_con; 658 - #endif 659 - 660 656 idprom_init(); 661 657 662 658 if (!root_flags)
-2
arch/unicore32/kernel/setup.c
··· 270 270 #ifdef CONFIG_VT 271 271 #if defined(CONFIG_VGA_CONSOLE) 272 272 conswitchp = &vga_con; 273 - #elif defined(CONFIG_DUMMY_CONSOLE) 274 - conswitchp = &dummy_con; 275 273 #endif 276 274 #endif 277 275 early_trap_init();
-2
arch/x86/kernel/setup.c
··· 1228 1228 #if defined(CONFIG_VGA_CONSOLE) 1229 1229 if (!efi_enabled(EFI_BOOT) || (efi_mem_type(0xa0000) != EFI_CONVENTIONAL_MEMORY)) 1230 1230 conswitchp = &vga_con; 1231 - #elif defined(CONFIG_DUMMY_CONSOLE) 1232 - conswitchp = &dummy_con; 1233 1231 #endif 1234 1232 #endif 1235 1233 x86_init.oem.banner();
-2
arch/xtensa/kernel/setup.c
··· 405 405 #ifdef CONFIG_VT 406 406 # if defined(CONFIG_VGA_CONSOLE) 407 407 conswitchp = &vga_con; 408 - # elif defined(CONFIG_DUMMY_CONSOLE) 409 - conswitchp = &dummy_con; 410 408 # endif 411 409 #endif 412 410 }
+9 -6
drivers/char/ttyprintk.c
··· 15 15 #include <linux/serial.h> 16 16 #include <linux/tty.h> 17 17 #include <linux/module.h> 18 + #include <linux/spinlock.h> 18 19 19 20 struct ttyprintk_port { 20 21 struct tty_port port; 21 - struct mutex port_write_mutex; 22 + spinlock_t spinlock; 22 23 }; 23 24 24 25 static struct ttyprintk_port tpk_port; ··· 100 99 static void tpk_close(struct tty_struct *tty, struct file *filp) 101 100 { 102 101 struct ttyprintk_port *tpkp = tty->driver_data; 102 + unsigned long flags; 103 103 104 - mutex_lock(&tpkp->port_write_mutex); 104 + spin_lock_irqsave(&tpkp->spinlock, flags); 105 105 /* flush tpk_printk buffer */ 106 106 tpk_printk(NULL, 0); 107 - mutex_unlock(&tpkp->port_write_mutex); 107 + spin_unlock_irqrestore(&tpkp->spinlock, flags); 108 108 109 109 tty_port_close(&tpkp->port, tty, filp); 110 110 } ··· 117 115 const unsigned char *buf, int count) 118 116 { 119 117 struct ttyprintk_port *tpkp = tty->driver_data; 118 + unsigned long flags; 120 119 int ret; 121 120 122 121 123 122 /* exclusive use of tpk_printk within this tty */ 124 - mutex_lock(&tpkp->port_write_mutex); 123 + spin_lock_irqsave(&tpkp->spinlock, flags); 125 124 ret = tpk_printk(buf, count); 126 - mutex_unlock(&tpkp->port_write_mutex); 125 + spin_unlock_irqrestore(&tpkp->spinlock, flags); 127 126 128 127 return ret; 129 128 } ··· 174 171 { 175 172 int ret = -ENOMEM; 176 173 177 - mutex_init(&tpk_port.port_write_mutex); 174 + spin_lock_init(&tpk_port.spinlock); 178 175 179 176 ttyprintk_driver = tty_alloc_driver(1, 180 177 TTY_DRIVER_RESET_TERMIOS |
+5 -6
drivers/tty/n_hdlc.c
··· 115 115 struct n_hdlc_buf { 116 116 struct list_head list_item; 117 117 int count; 118 - char buf[1]; 118 + char buf[]; 119 119 }; 120 - 121 - #define N_HDLC_BUF_SIZE (sizeof(struct n_hdlc_buf) + maxframe) 122 120 123 121 struct n_hdlc_buf_list { 124 122 struct list_head list; ··· 522 524 /* no buffers in free list, attempt to allocate another rx buffer */ 523 525 /* unless the maximum count has been reached */ 524 526 if (n_hdlc->rx_buf_list.count < MAX_RX_BUF_COUNT) 525 - buf = kmalloc(N_HDLC_BUF_SIZE, GFP_ATOMIC); 527 + buf = kmalloc(struct_size(buf, buf, maxframe), 528 + GFP_ATOMIC); 526 529 } 527 530 528 531 if (!buf) { ··· 852 853 853 854 /* allocate free rx buffer list */ 854 855 for(i=0;i<DEFAULT_RX_BUF_COUNT;i++) { 855 - buf = kmalloc(N_HDLC_BUF_SIZE, GFP_KERNEL); 856 + buf = kmalloc(struct_size(buf, buf, maxframe), GFP_KERNEL); 856 857 if (buf) 857 858 n_hdlc_buf_put(&n_hdlc->rx_free_buf_list,buf); 858 859 else if (debuglevel >= DEBUG_LEVEL_INFO) ··· 861 862 862 863 /* allocate free tx buffer list */ 863 864 for(i=0;i<DEFAULT_TX_BUF_COUNT;i++) { 864 - buf = kmalloc(N_HDLC_BUF_SIZE, GFP_KERNEL); 865 + buf = kmalloc(struct_size(buf, buf, maxframe), GFP_KERNEL); 865 866 if (buf) 866 867 n_hdlc_buf_put(&n_hdlc->tx_free_buf_list,buf); 867 868 else if (debuglevel >= DEBUG_LEVEL_INFO)
+8 -6
drivers/tty/serdev/core.c
··· 115 115 116 116 err = device_add(&serdev->dev); 117 117 if (err < 0) { 118 - dev_err(&serdev->dev, "Can't add %s, status %d\n", 119 - dev_name(&serdev->dev), err); 118 + dev_err(&serdev->dev, "Can't add %s, status %pe\n", 119 + dev_name(&serdev->dev), ERR_PTR(err)); 120 120 goto err_clear_serdev; 121 121 } 122 122 ··· 540 540 err = serdev_device_add(serdev); 541 541 if (err) { 542 542 dev_err(&serdev->dev, 543 - "failure adding device. status %d\n", err); 543 + "failure adding device. status %pe\n", 544 + ERR_PTR(err)); 544 545 serdev_device_put(serdev); 545 546 } else 546 547 found = true; ··· 657 656 err = serdev_device_add(serdev); 658 657 if (err) { 659 658 dev_err(&serdev->dev, 660 - "failure adding ACPI serdev device. status %d\n", err); 659 + "failure adding ACPI serdev device. status %pe\n", 660 + ERR_PTR(err)); 661 661 serdev_device_put(serdev); 662 662 } 663 663 ··· 743 741 ret_of = of_serdev_register_devices(ctrl); 744 742 ret_acpi = acpi_serdev_register_devices(ctrl); 745 743 if (ret_of && ret_acpi) { 746 - dev_dbg(&ctrl->dev, "no devices registered: of:%d acpi:%d\n", 747 - ret_of, ret_acpi); 744 + dev_dbg(&ctrl->dev, "no devices registered: of:%pe acpi:%pe\n", 745 + ERR_PTR(ret_of), ERR_PTR(ret_acpi)); 748 746 ret = -ENODEV; 749 747 goto err_rpm_disable; 750 748 }
+45 -10
drivers/tty/serial/21285.c
··· 41 41 42 42 static const char serial21285_name[] = "Footbridge UART"; 43 43 44 - #define tx_enabled(port) ((port)->unused[0]) 45 - #define rx_enabled(port) ((port)->unused[1]) 44 + /* 45 + * We only need 2 bits of data, so instead of creating a whole structure for 46 + * this, use bits of the private_data pointer of the uart port structure. 47 + */ 48 + #define tx_enabled_bit 0 49 + #define rx_enabled_bit 1 50 + 51 + static bool is_enabled(struct uart_port *port, int bit) 52 + { 53 + unsigned long private_data = (unsigned long)port->private_data; 54 + 55 + if (test_bit(bit, &private_data)) 56 + return true; 57 + return false; 58 + } 59 + 60 + static void enable(struct uart_port *port, int bit) 61 + { 62 + unsigned long private_data = (unsigned long)port->private_data; 63 + 64 + set_bit(bit, &private_data); 65 + } 66 + 67 + static void disable(struct uart_port *port, int bit) 68 + { 69 + unsigned long private_data = (unsigned long)port->private_data; 70 + 71 + clear_bit(bit, &private_data); 72 + } 73 + 74 + #define is_tx_enabled(port) is_enabled(port, tx_enabled_bit) 75 + #define tx_enable(port) enable(port, tx_enabled_bit) 76 + #define tx_disable(port) disable(port, tx_enabled_bit) 77 + 78 + #define is_rx_enabled(port) is_enabled(port, rx_enabled_bit) 79 + #define rx_enable(port) enable(port, rx_enabled_bit) 80 + #define rx_disable(port) disable(port, rx_enabled_bit) 46 81 47 82 /* 48 83 * The documented expression for selecting the divisor is: ··· 92 57 93 58 static void serial21285_stop_tx(struct uart_port *port) 94 59 { 95 - if (tx_enabled(port)) { 60 + if (is_tx_enabled(port)) { 96 61 disable_irq_nosync(IRQ_CONTX); 97 - tx_enabled(port) = 0; 62 + tx_disable(port); 98 63 } 99 64 } 100 65 101 66 static void serial21285_start_tx(struct uart_port *port) 102 67 { 103 - if (!tx_enabled(port)) { 68 + if (!is_tx_enabled(port)) { 104 69 enable_irq(IRQ_CONTX); 105 - tx_enabled(port) = 1; 70 + tx_enable(port); 106 71 } 107 72 } 108 73 109 74 static void serial21285_stop_rx(struct uart_port *port) 110 75 { 111 - if (rx_enabled(port)) { 76 + if (is_rx_enabled(port)) { 112 77 disable_irq_nosync(IRQ_CONRX); 113 - rx_enabled(port) = 0; 78 + rx_disable(port); 114 79 } 115 80 } 116 81 ··· 220 185 { 221 186 int ret; 222 187 223 - tx_enabled(port) = 1; 224 - rx_enabled(port) = 1; 188 + tx_enable(port); 189 + rx_enable(port); 225 190 226 191 ret = request_irq(IRQ_CONRX, serial21285_rx_chars, 0, 227 192 serial21285_name, port);
+1 -4
drivers/tty/serial/8250/8250_aspeed_vuart.c
··· 5 5 * Copyright (C) 2016 Jeremy Kerr <jk@ozlabs.org>, IBM Corp. 6 6 * Copyright (C) 2006 Arnd Bergmann <arnd@arndb.de>, IBM Corp. 7 7 */ 8 - #if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 9 - #define SUPPORT_SYSRQ 10 - #endif 11 - 12 8 #include <linux/device.h> 13 9 #include <linux/module.h> 14 10 #include <linux/of_address.h> ··· 402 406 port.port.unthrottle = aspeed_vuart_unthrottle; 403 407 port.port.status = UPSTAT_SYNC_FIFO; 404 408 port.port.dev = &pdev->dev; 409 + port.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); 405 410 406 411 rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group); 407 412 if (rc < 0)
+26 -24
drivers/tty/serial/8250/8250_bcm2835aux.c
··· 16 16 17 17 #include "8250.h" 18 18 19 + /** 20 + * struct bcm2835aux_data - driver private data of BCM2835 auxiliary UART 21 + * @clk: clock producer of the port's uartclk 22 + * @line: index of the port's serial8250_ports[] entry 23 + */ 19 24 struct bcm2835aux_data { 20 - struct uart_8250_port uart; 21 25 struct clk *clk; 22 26 int line; 23 27 }; 24 28 25 29 static int bcm2835aux_serial_probe(struct platform_device *pdev) 26 30 { 31 + struct uart_8250_port up = { }; 27 32 struct bcm2835aux_data *data; 28 33 struct resource *res; 29 34 int ret; ··· 39 34 return -ENOMEM; 40 35 41 36 /* initialize data */ 42 - spin_lock_init(&data->uart.port.lock); 43 - data->uart.capabilities = UART_CAP_FIFO | UART_CAP_MINI; 44 - data->uart.port.dev = &pdev->dev; 45 - data->uart.port.regshift = 2; 46 - data->uart.port.type = PORT_16550; 47 - data->uart.port.iotype = UPIO_MEM; 48 - data->uart.port.fifosize = 8; 49 - data->uart.port.flags = UPF_SHARE_IRQ | 50 - UPF_FIXED_PORT | 51 - UPF_FIXED_TYPE | 52 - UPF_SKIP_TEST; 37 + up.capabilities = UART_CAP_FIFO | UART_CAP_MINI; 38 + up.port.dev = &pdev->dev; 39 + up.port.regshift = 2; 40 + up.port.type = PORT_16550; 41 + up.port.iotype = UPIO_MEM; 42 + up.port.fifosize = 8; 43 + up.port.flags = UPF_SHARE_IRQ | UPF_FIXED_PORT | UPF_FIXED_TYPE | 44 + UPF_SKIP_TEST | UPF_IOREMAP; 53 45 54 46 /* get the clock - this also enables the HW */ 55 47 data->clk = devm_clk_get(&pdev->dev, NULL); 56 48 ret = PTR_ERR_OR_ZERO(data->clk); 57 49 if (ret) { 58 - dev_err(&pdev->dev, "could not get clk: %d\n", ret); 50 + if (ret != -EPROBE_DEFER) 51 + dev_err(&pdev->dev, "could not get clk: %d\n", ret); 59 52 return ret; 60 53 } 61 54 ··· 61 58 ret = platform_get_irq(pdev, 0); 62 59 if (ret < 0) 63 60 return ret; 64 - data->uart.port.irq = ret; 61 + up.port.irq = ret; 65 62 66 63 /* map the main registers */ 67 64 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 69 66 dev_err(&pdev->dev, "memory resource not found"); 70 67 return -EINVAL; 71 68 } 72 - data->uart.port.membase = devm_ioremap_resource(&pdev->dev, res); 73 - ret = PTR_ERR_OR_ZERO(data->uart.port.membase); 74 - if (ret) 75 - return ret; 69 + up.port.mapbase = res->start; 70 + up.port.mapsize = resource_size(res); 76 71 77 72 /* Check for a fixed line number */ 78 73 ret = of_alias_get_id(pdev->dev.of_node, "serial"); 79 74 if (ret >= 0) 80 - data->uart.port.line = ret; 75 + up.port.line = ret; 81 76 82 77 /* enable the clock as a last step */ 83 78 ret = clk_prepare_enable(data->clk); ··· 90 89 * so we have to multiply the actual clock by 2 91 90 * to get identical baudrates. 92 91 */ 93 - data->uart.port.uartclk = clk_get_rate(data->clk) * 2; 92 + up.port.uartclk = clk_get_rate(data->clk) * 2; 94 93 95 94 /* register the port */ 96 - ret = serial8250_register_8250_port(&data->uart); 95 + ret = serial8250_register_8250_port(&up); 97 96 if (ret < 0) { 98 - dev_err(&pdev->dev, "unable to register 8250 port - %d\n", 99 - ret); 97 + if (ret != -EPROBE_DEFER) 98 + dev_err(&pdev->dev, 99 + "unable to register 8250 port - %d\n", ret); 100 100 goto dis_clk; 101 101 } 102 102 data->line = ret; ··· 115 113 { 116 114 struct bcm2835aux_data *data = platform_get_drvdata(pdev); 117 115 118 - serial8250_unregister_port(data->uart.port.line); 116 + serial8250_unregister_port(data->line); 119 117 clk_disable_unprepare(data->clk); 120 118 121 119 return 0;
+1
drivers/tty/serial/8250/8250_core.c
··· 816 816 uart.port.flags = p->flags; 817 817 uart.port.mapbase = p->mapbase; 818 818 uart.port.hub6 = p->hub6; 819 + uart.port.has_sysrq = p->has_sysrq; 819 820 uart.port.private_data = p->private_data; 820 821 uart.port.type = p->type; 821 822 uart.port.serial_in = p->serial_in;
+3 -3
drivers/tty/serial/8250/8250_exar.c
··· 186 186 static void exar_shutdown(struct uart_port *port) 187 187 { 188 188 unsigned char lsr; 189 - bool tx_complete = 0; 189 + bool tx_complete = false; 190 190 struct uart_8250_port *up = up_to_u8250p(port); 191 191 struct circ_buf *xmit = &port->state->xmit; 192 192 int i = 0; ··· 194 194 do { 195 195 lsr = serial_in(up, UART_LSR); 196 196 if (lsr & (UART_LSR_TEMT | UART_LSR_THRE)) 197 - tx_complete = 1; 197 + tx_complete = true; 198 198 else 199 - tx_complete = 0; 199 + tx_complete = false; 200 200 usleep_range(1000, 1100); 201 201 } while (!uart_circ_empty(xmit) && !tx_complete && i++ < 1000); 202 202
-4
drivers/tty/serial/8250/8250_fsl.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - #if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 3 - #define SUPPORT_SYSRQ 4 - #endif 5 - 6 2 #include <linux/serial_reg.h> 7 3 #include <linux/serial_8250.h> 8 4
+3 -1
drivers/tty/serial/8250/8250_of.c
··· 222 222 223 223 if (IS_ENABLED(CONFIG_SERIAL_8250_FSL) && 224 224 (of_device_is_compatible(np, "fsl,ns16550") || 225 - of_device_is_compatible(np, "fsl,16550-FIFO64"))) 225 + of_device_is_compatible(np, "fsl,16550-FIFO64"))) { 226 226 port->handle_irq = fsl8250_handle_irq; 227 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); 228 + } 227 229 228 230 return 0; 229 231 err_unprepare:
+1 -4
drivers/tty/serial/8250/8250_omap.c
··· 8 8 * 9 9 */ 10 10 11 - #if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 12 - #define SUPPORT_SYSRQ 13 - #endif 14 - 15 11 #include <linux/clk.h> 16 12 #include <linux/device.h> 17 13 #include <linux/io.h> ··· 1188 1192 up.port.throttle = omap_8250_throttle; 1189 1193 up.port.unthrottle = omap_8250_unthrottle; 1190 1194 up.port.rs485_config = omap_8250_rs485_config; 1195 + up.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); 1191 1196 1192 1197 ret = of_alias_get_id(np, "serial"); 1193 1198 if (ret < 0) {
+4 -4
drivers/tty/serial/8250/8250_port.c
··· 11 11 * membase is an 'ioremapped' cookie. 12 12 */ 13 13 14 - #if defined(CONFIG_SERIAL_8250_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 15 - #define SUPPORT_SYSRQ 16 - #endif 17 - 18 14 #include <linux/module.h> 19 15 #include <linux/moduleparam.h> 20 16 #include <linux/ioport.h> ··· 996 1000 997 1001 up->port.type = PORT_16550A; 998 1002 up->capabilities |= UART_CAP_FIFO; 1003 + 1004 + if (!IS_ENABLED(CONFIG_SERIAL_8250_16550A_VARIANTS)) 1005 + return; 999 1006 1000 1007 /* 1001 1008 * Check for presence of the EFR when DLAB is set. ··· 3054 3055 3055 3056 spin_lock_init(&port->lock); 3056 3057 port->ops = &serial8250_pops; 3058 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE); 3057 3059 3058 3060 up->cur_iotype = 0xFF; 3059 3061 }
+10
drivers/tty/serial/8250/Kconfig
··· 60 60 This builds standard PNP serial support. You may be able to 61 61 disable this feature if you only need legacy serial support. 62 62 63 + config SERIAL_8250_16550A_VARIANTS 64 + bool "Support for variants of the 16550A serial port" 65 + depends on SERIAL_8250 66 + help 67 + The 8250 driver can probe for many variants of the venerable 16550A 68 + serial port. Doing so takes additional time at boot. 69 + 70 + On modern systems, especially those using serial only for a simple 71 + console, you can say N here. 72 + 63 73 config SERIAL_8250_FINTEK 64 74 bool "Support for Fintek F81216A LPC to 4 UART RS485 API" 65 75 depends on SERIAL_8250
+2 -2
drivers/tty/serial/Kconfig
··· 237 237 238 238 config SERIAL_SAMSUNG 239 239 tristate "Samsung SoC serial support" 240 - depends on PLAT_SAMSUNG || ARCH_EXYNOS 240 + depends on PLAT_SAMSUNG || ARCH_EXYNOS || COMPILE_TEST 241 241 select SERIAL_CORE 242 242 help 243 243 Support for the on-chip UARTs on the Samsung S3C24XX series CPUs, ··· 975 975 976 976 config SERIAL_QCOM_GENI_CONSOLE 977 977 bool "QCOM GENI Serial Console support" 978 - depends on SERIAL_QCOM_GENI=y 978 + depends on SERIAL_QCOM_GENI 979 979 select SERIAL_CORE_CONSOLE 980 980 select SERIAL_EARLYCON 981 981 help
+1 -4
drivers/tty/serial/amba-pl010.c
··· 15 15 * and hooked into this driver. 16 16 */ 17 17 18 - #if defined(CONFIG_SERIAL_AMBA_PL010_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 19 - #define SUPPORT_SYSRQ 20 - #endif 21 - 22 18 #include <linux/module.h> 23 19 #include <linux/ioport.h> 24 20 #include <linux/init.h> ··· 724 728 uap->port.iotype = UPIO_MEM; 725 729 uap->port.irq = dev->irq[0]; 726 730 uap->port.fifosize = 16; 731 + uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_AMBA_PL010_CONSOLE); 727 732 uap->port.ops = &amba_pl010_pops; 728 733 uap->port.flags = UPF_BOOT_AUTOCONF; 729 734 uap->port.line = i;
+4 -9
drivers/tty/serial/amba-pl011.c
··· 16 16 * and hooked into this driver. 17 17 */ 18 18 19 - 20 - #if defined(CONFIG_SERIAL_AMBA_PL011_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 21 - #define SUPPORT_SYSRQ 22 - #endif 23 - 24 19 #include <linux/module.h> 25 20 #include <linux/ioport.h> 26 21 #include <linux/init.h> ··· 1447 1452 1448 1453 static void check_apply_cts_event_workaround(struct uart_amba_port *uap) 1449 1454 { 1450 - unsigned int dummy_read; 1451 - 1452 1455 if (!uap->vendor->cts_event_workaround) 1453 1456 return; 1454 1457 ··· 1458 1465 * single apb access will incur 2 pclk(133.12Mhz) delay, 1459 1466 * so add 2 dummy reads 1460 1467 */ 1461 - dummy_read = pl011_read(uap, REG_ICR); 1462 - dummy_read = pl011_read(uap, REG_ICR); 1468 + pl011_read(uap, REG_ICR); 1469 + pl011_read(uap, REG_ICR); 1463 1470 } 1464 1471 1465 1472 static irqreturn_t pl011_int(int irq, void *dev_id) ··· 2572 2579 uap->port.mapbase = mmiobase->start; 2573 2580 uap->port.membase = base; 2574 2581 uap->port.fifosize = uap->fifosize; 2582 + uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_AMBA_PL011_CONSOLE); 2575 2583 uap->port.flags = UPF_BOOT_AUTOCONF; 2576 2584 uap->port.line = index; 2577 2585 ··· 2763 2769 .remove = sbsa_uart_remove, 2764 2770 .driver = { 2765 2771 .name = "sbsa-uart", 2772 + .pm = &pl011_dev_pm_ops, 2766 2773 .of_match_table = of_match_ptr(sbsa_uart_of_match), 2767 2774 .acpi_match_table = ACPI_PTR(sbsa_uart_acpi_match), 2768 2775 .suppress_bind_attrs = IS_BUILTIN(CONFIG_SERIAL_AMBA_PL011),
+1 -4
drivers/tty/serial/apbuart.c
··· 11 11 * Copyright (C) 2009 Kristoffer Glembo <kristoffer@gaisler.com>, Aeroflex Gaisler AB 12 12 */ 13 13 14 - #if defined(CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 15 - #define SUPPORT_SYSRQ 16 - #endif 17 - 18 14 #include <linux/module.h> 19 15 #include <linux/tty.h> 20 16 #include <linux/tty_flip.h> ··· 622 626 port->irq = 0; 623 627 port->iotype = UPIO_MEM; 624 628 port->ops = &grlib_apbuart_ops; 629 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE); 625 630 port->flags = UPF_BOOT_AUTOCONF; 626 631 port->line = line; 627 632 port->uartclk = *freq_hz;
+1 -4
drivers/tty/serial/arc_uart.c
··· 21 21 * -check if sysreq works 22 22 */ 23 23 24 - #if defined(CONFIG_SERIAL_ARC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 25 - #define SUPPORT_SYSRQ 26 - #endif 27 - 28 24 #include <linux/module.h> 29 25 #include <linux/serial.h> 30 26 #include <linux/console.h> ··· 621 625 port->flags = UPF_BOOT_AUTOCONF; 622 626 port->line = dev_id; 623 627 port->ops = &arc_serial_pops; 628 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ARC_CONSOLE); 624 629 625 630 port->fifosize = ARC_UART_TX_FIFO_SIZE; 626 631
+23 -18
drivers/tty/serial/atmel_serial.c
··· 51 51 #define ATMEL_RTS_HIGH_OFFSET 16 52 52 #define ATMEL_RTS_LOW_OFFSET 20 53 53 54 - #if defined(CONFIG_SERIAL_ATMEL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 55 - #define SUPPORT_SYSRQ 56 - #endif 57 - 58 54 #include <linux/serial_core.h> 59 55 60 56 #include "serial_mctrl_gpio.h" ··· 192 196 static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART]; 193 197 static DECLARE_BITMAP(atmel_ports_in_use, ATMEL_MAX_UART); 194 198 195 - #ifdef SUPPORT_SYSRQ 196 - static struct console atmel_console; 197 - #endif 198 - 199 199 #if defined(CONFIG_OF) 200 200 static const struct of_device_id atmel_serial_dt_ids[] = { 201 201 { .compatible = "atmel,at91rm9200-usart-serial" }, ··· 305 313 306 314 if (rs485conf->flags & SER_RS485_ENABLED) { 307 315 dev_dbg(port->dev, "Setting UART to RS485\n"); 308 - atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; 316 + if (port->rs485.flags & SER_RS485_RX_DURING_TX) 317 + atmel_port->tx_done_mask = ATMEL_US_TXRDY; 318 + else 319 + atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; 320 + 309 321 atmel_uart_writel(port, ATMEL_US_TTGR, 310 322 rs485conf->delay_rts_after_send); 311 323 mode |= ATMEL_US_USMODE_RS485; ··· 827 831 struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); 828 832 829 833 if (port->x_char && 830 - (atmel_uart_readl(port, ATMEL_US_CSR) & atmel_port->tx_done_mask)) { 834 + (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY)) { 831 835 atmel_uart_write_char(port, port->x_char); 832 836 port->icount.tx++; 833 837 port->x_char = 0; ··· 835 839 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) 836 840 return; 837 841 838 - while (atmel_uart_readl(port, ATMEL_US_CSR) & 839 - atmel_port->tx_done_mask) { 842 + while (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY) { 840 843 atmel_uart_write_char(port, xmit->buf[xmit->tail]); 841 844 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 842 845 port->icount.tx++; ··· 846 851 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 847 852 uart_write_wakeup(port); 848 853 849 - if (!uart_circ_empty(xmit)) 854 + if (!uart_circ_empty(xmit)) { 855 + /* we still have characters to transmit, so we should continue 856 + * transmitting them when TX is ready, regardless of 857 + * mode or duplexity 858 + */ 859 + atmel_port->tx_done_mask |= ATMEL_US_TXRDY; 860 + 850 861 /* Enable interrupts */ 851 862 atmel_uart_writel(port, ATMEL_US_IER, 852 863 atmel_port->tx_done_mask); 864 + } else { 865 + if (atmel_uart_is_half_duplex(port)) 866 + atmel_port->tx_done_mask &= ~ATMEL_US_TXRDY; 867 + } 853 868 } 854 869 855 870 static void atmel_complete_tx_dma(void *arg) ··· 1072 1067 1073 1068 chan_err: 1074 1069 dev_err(port->dev, "TX channel not available, switch to pio\n"); 1075 - atmel_port->use_dma_tx = 0; 1070 + atmel_port->use_dma_tx = false; 1076 1071 if (atmel_port->chan_tx) 1077 1072 atmel_release_tx_dma(port); 1078 1073 return -EINVAL; ··· 1271 1266 1272 1267 chan_err: 1273 1268 dev_err(port->dev, "RX channel not available, switch to pio\n"); 1274 - atmel_port->use_dma_rx = 0; 1269 + atmel_port->use_dma_rx = false; 1275 1270 if (atmel_port->chan_rx) 1276 1271 atmel_release_rx_dma(port); 1277 1272 return -EINVAL; ··· 1698 1693 DMA_FROM_DEVICE); 1699 1694 kfree(atmel_port->pdc_rx[0].buf); 1700 1695 } 1701 - atmel_port->use_pdc_rx = 0; 1696 + atmel_port->use_pdc_rx = false; 1702 1697 return -ENOMEM; 1703 1698 } 1704 1699 pdc->dma_addr = dma_map_single(port->dev, ··· 2531 2526 * Use TXEMPTY for interrupt when rs485 or ISO7816 else TXRDY or 2532 2527 * ENDTX|TXBUFE 2533 2528 */ 2534 - if (port->rs485.flags & SER_RS485_ENABLED || 2535 - port->iso7816.flags & SER_ISO7816_ENABLED) 2529 + if (atmel_uart_is_half_duplex(port)) 2536 2530 atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; 2537 2531 else if (atmel_use_pdc_tx(port)) { 2538 2532 port->fifosize = PDC_BUFFER_SIZE; ··· 2882 2878 atmel_port = &atmel_ports[ret]; 2883 2879 atmel_port->backup_imr = 0; 2884 2880 atmel_port->uart.line = ret; 2881 + atmel_port->uart.has_sysrq = IS_ENABLED(CONFIG_SERIAL_ATMEL_CONSOLE); 2885 2882 atmel_serial_probe_fifos(atmel_port, pdev); 2886 2883 2887 2884 atomic_set(&atmel_port->tasklet_shutdown, 0);
+1 -4
drivers/tty/serial/bcm63xx_uart.c
··· 10 10 * my board. 11 11 */ 12 12 13 - #if defined(CONFIG_SERIAL_BCM63XX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 14 - #define SUPPORT_SYSRQ 15 - #endif 16 - 17 13 #include <linux/kernel.h> 18 14 #include <linux/platform_device.h> 19 15 #include <linux/init.h> ··· 854 858 port->fifosize = 16; 855 859 port->uartclk = clk_get_rate(clk) / 2; 856 860 port->line = pdev->id; 861 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_BCM63XX_CONSOLE); 857 862 clk_put(clk); 858 863 859 864 ret = uart_add_one_port(&bcm_uart_driver, port);
+1 -4
drivers/tty/serial/clps711x.c
··· 8 8 * Copyright (C) 2000 Deep Blue Solutions Ltd. 9 9 */ 10 10 11 - #if defined(CONFIG_SERIAL_CLPS711X_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 12 - #define SUPPORT_SYSRQ 13 - #endif 14 - 15 11 #include <linux/module.h> 16 12 #include <linux/device.h> 17 13 #include <linux/console.h> ··· 475 479 s->port.mapbase = res->start; 476 480 s->port.type = PORT_CLPS711X; 477 481 s->port.fifosize = 16; 482 + s->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_CLPS711X_CONSOLE); 478 483 s->port.flags = UPF_SKIP_TEST | UPF_FIXED_TYPE; 479 484 s->port.uartclk = clk_get_rate(uart_clk); 480 485 s->port.ops = &uart_clps711x_ops;
+2 -7
drivers/tty/serial/cpm_uart/cpm_uart_core.c
··· 40 40 #include <asm/fs_pd.h> 41 41 #include <asm/udbg.h> 42 42 43 - #if defined(CONFIG_SERIAL_CPM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 44 - #define SUPPORT_SYSRQ 45 - #endif 46 - 47 43 #include <linux/serial_core.h> 48 44 #include <linux/kernel.h> 49 45 ··· 343 347 /* ASSUMPTION: it contains nothing valid */ 344 348 i = 0; 345 349 } 346 - #ifdef SUPPORT_SYSRQ 347 350 port->sysrq = 0; 348 - #endif 349 351 goto error_return; 350 352 } 351 353 ··· 1198 1204 pinfo->port.uartclk = ppc_proc_freq; 1199 1205 pinfo->port.mapbase = (unsigned long)mem; 1200 1206 pinfo->port.type = PORT_CPM; 1201 - pinfo->port.ops = &cpm_uart_pops, 1207 + pinfo->port.ops = &cpm_uart_pops; 1208 + pinfo->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_CPM_CONSOLE); 1202 1209 pinfo->port.iotype = UPIO_MEM; 1203 1210 pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; 1204 1211 spin_lock_init(&pinfo->port.lock);
+1 -4
drivers/tty/serial/dz.c
··· 29 29 30 30 #undef DEBUG_DZ 31 31 32 - #if defined(CONFIG_SERIAL_DZ_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 33 - #define SUPPORT_SYSRQ 34 - #endif 35 - 36 32 #include <linux/bitops.h> 37 33 #include <linux/compiler.h> 38 34 #include <linux/console.h> ··· 783 787 uport->ops = &dz_ops; 784 788 uport->line = line; 785 789 uport->mapbase = base; 790 + uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_DZ_CONSOLE); 786 791 } 787 792 } 788 793
+1 -4
drivers/tty/serial/efm32-uart.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 - #if defined(CONFIG_SERIAL_EFM32_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 3 - #define SUPPORT_SYSRQ 4 - #endif 5 - 6 2 #include <linux/kernel.h> 7 3 #include <linux/module.h> 8 4 #include <linux/io.h> ··· 744 748 efm_port->port.type = PORT_EFMUART; 745 749 efm_port->port.iotype = UPIO_MEM32; 746 750 efm_port->port.fifosize = 2; 751 + efm_port->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_EFM32_UART_CONSOLE); 747 752 efm_port->port.ops = &efm32_uart_pops; 748 753 efm_port->port.flags = UPF_BOOT_AUTOCONF; 749 754
+1 -7
drivers/tty/serial/fsl_linflexuart.c
··· 6 6 * Copyright 2017-2019 NXP 7 7 */ 8 8 9 - #if defined(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE) && \ 10 - defined(CONFIG_MAGIC_SYSRQ) 11 - #define SUPPORT_SYSRQ 12 - #endif 13 - 14 9 #include <linux/console.h> 15 10 #include <linux/io.h> 16 11 #include <linux/irq.h> ··· 274 279 if (brk) { 275 280 uart_handle_break(sport); 276 281 } else { 277 - #ifdef SUPPORT_SYSRQ 278 282 if (uart_handle_sysrq_char(sport, (unsigned char)rx)) 279 283 continue; 280 - #endif 281 284 tty_insert_flip_char(port, rx, flg); 282 285 } 283 286 } ··· 856 863 sport->irq = platform_get_irq(pdev, 0); 857 864 sport->ops = &linflex_pops; 858 865 sport->flags = UPF_BOOT_AUTOCONF; 866 + sport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE); 859 867 860 868 linflex_ports[sport->line] = sport; 861 869
+4 -12
drivers/tty/serial/fsl_lpuart.c
··· 5 5 * Copyright 2012-2014 Freescale Semiconductor, Inc. 6 6 */ 7 7 8 - #if defined(CONFIG_SERIAL_FSL_LPUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 9 - #define SUPPORT_SYSRQ 10 - #endif 11 - 12 8 #include <linux/clk.h> 13 9 #include <linux/console.h> 14 10 #include <linux/dma-mapping.h> ··· 860 864 if (sr & UARTSR1_OR) 861 865 flg = TTY_OVERRUN; 862 866 863 - #ifdef SUPPORT_SYSRQ 864 867 sport->port.sysrq = 0; 865 - #endif 866 868 } 867 869 868 870 tty_insert_flip_char(port, rx, flg); ··· 940 946 if (sr & UARTSTAT_OR) 941 947 flg = TTY_OVERRUN; 942 948 943 - #ifdef SUPPORT_SYSRQ 944 949 sport->port.sysrq = 0; 945 - #endif 946 950 } 947 951 948 952 tty_insert_flip_char(port, rx, flg); ··· 2368 2376 if (!device->port.membase) 2369 2377 return -ENODEV; 2370 2378 2371 - device->port.iotype = UPIO_MEM32BE; 2379 + if (device->port.iotype != UPIO_MEM32) 2380 + device->port.iotype = UPIO_MEM32BE; 2381 + 2372 2382 device->con->write = lpuart32_early_write; 2373 2383 return 0; 2374 2384 } ··· 2390 2396 OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lpuart", lpuart_early_console_setup); 2391 2397 OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1021a-lpuart", lpuart32_early_console_setup); 2392 2398 OF_EARLYCON_DECLARE(lpuart32, "fsl,imx7ulp-lpuart", lpuart32_imx_early_console_setup); 2393 - OF_EARLYCON_DECLARE(lpuart32, "fsl,imx8qxp-lpuart", lpuart32_imx_early_console_setup); 2394 - EARLYCON_DECLARE(lpuart, lpuart_early_console_setup); 2395 - EARLYCON_DECLARE(lpuart32, lpuart32_early_console_setup); 2396 2399 2397 2400 #define LPUART_CONSOLE (&lpuart_console) 2398 2401 #define LPUART32_CONSOLE (&lpuart32_console) ··· 2452 2461 sport->port.ops = &lpuart32_pops; 2453 2462 else 2454 2463 sport->port.ops = &lpuart_pops; 2464 + sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_FSL_LPUART_CONSOLE); 2455 2465 sport->port.flags = UPF_BOOT_AUTOCONF; 2456 2466 2457 2467 if (lpuart_is_32(sport))
+39 -19
drivers/tty/serial/imx.c
··· 8 8 * Copyright (C) 2004 Pengutronix 9 9 */ 10 10 11 - #if defined(CONFIG_SERIAL_IMX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 12 - #define SUPPORT_SYSRQ 13 - #endif 14 - 15 11 #include <linux/module.h> 16 12 #include <linux/ioport.h> 17 13 #include <linux/init.h> ··· 696 700 } 697 701 } 698 702 699 - static irqreturn_t imx_uart_rtsint(int irq, void *dev_id) 703 + static irqreturn_t __imx_uart_rtsint(int irq, void *dev_id) 700 704 { 701 705 struct imx_port *sport = dev_id; 702 706 u32 usr1; 703 - 704 - spin_lock(&sport->port.lock); 705 707 706 708 imx_uart_writel(sport, USR1_RTSD, USR1); 707 709 usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS; 708 710 uart_handle_cts_change(&sport->port, !!usr1); 709 711 wake_up_interruptible(&sport->port.state->port.delta_msr_wait); 710 712 711 - spin_unlock(&sport->port.lock); 712 713 return IRQ_HANDLED; 714 + } 715 + 716 + static irqreturn_t imx_uart_rtsint(int irq, void *dev_id) 717 + { 718 + struct imx_port *sport = dev_id; 719 + irqreturn_t ret; 720 + 721 + spin_lock(&sport->port.lock); 722 + 723 + ret = __imx_uart_rtsint(irq, dev_id); 724 + 725 + spin_unlock(&sport->port.lock); 726 + 727 + return ret; 713 728 } 714 729 715 730 static irqreturn_t imx_uart_txint(int irq, void *dev_id) ··· 733 726 return IRQ_HANDLED; 734 727 } 735 728 736 - static irqreturn_t imx_uart_rxint(int irq, void *dev_id) 729 + static irqreturn_t __imx_uart_rxint(int irq, void *dev_id) 737 730 { 738 731 struct imx_port *sport = dev_id; 739 732 unsigned int rx, flg, ignored = 0; 740 733 struct tty_port *port = &sport->port.state->port; 741 - 742 - spin_lock(&sport->port.lock); 743 734 744 735 while (imx_uart_readl(sport, USR2) & USR2_RDR) { 745 736 u32 usr2; ··· 784 779 if (rx & URXD_OVRRUN) 785 780 flg = TTY_OVERRUN; 786 781 787 - #ifdef SUPPORT_SYSRQ 788 782 sport->port.sysrq = 0; 789 - #endif 790 783 } 791 784 792 785 if (sport->port.ignore_status_mask & URXD_DUMMY_READ) ··· 795 792 } 796 793 797 794 out: 798 - spin_unlock(&sport->port.lock); 799 795 tty_flip_buffer_push(port); 796 + 800 797 return IRQ_HANDLED; 798 + } 799 + 800 + static irqreturn_t imx_uart_rxint(int irq, void *dev_id) 801 + { 802 + struct imx_port *sport = dev_id; 803 + irqreturn_t ret; 804 + 805 + spin_lock(&sport->port.lock); 806 + 807 + ret = __imx_uart_rxint(irq, dev_id); 808 + 809 + spin_unlock(&sport->port.lock); 810 + 811 + return ret; 801 812 } 802 813 803 814 static void imx_uart_clear_rx_errors(struct imx_port *sport); ··· 872 855 unsigned int usr1, usr2, ucr1, ucr2, ucr3, ucr4; 873 856 irqreturn_t ret = IRQ_NONE; 874 857 858 + spin_lock(&sport->port.lock); 859 + 875 860 usr1 = imx_uart_readl(sport, USR1); 876 861 usr2 = imx_uart_readl(sport, USR2); 877 862 ucr1 = imx_uart_readl(sport, UCR1); ··· 907 888 usr2 &= ~USR2_ORE; 908 889 909 890 if (usr1 & (USR1_RRDY | USR1_AGTIM)) { 910 - imx_uart_rxint(irq, dev_id); 891 + __imx_uart_rxint(irq, dev_id); 911 892 ret = IRQ_HANDLED; 912 893 } 913 894 914 895 if ((usr1 & USR1_TRDY) || (usr2 & USR2_TXDC)) { 915 - imx_uart_txint(irq, dev_id); 896 + imx_uart_transmit_buffer(sport); 916 897 ret = IRQ_HANDLED; 917 898 } 918 899 919 900 if (usr1 & USR1_DTRD) { 920 901 imx_uart_writel(sport, USR1_DTRD, USR1); 921 902 922 - spin_lock(&sport->port.lock); 923 903 imx_uart_mctrl_check(sport); 924 - spin_unlock(&sport->port.lock); 925 904 926 905 ret = IRQ_HANDLED; 927 906 } 928 907 929 908 if (usr1 & USR1_RTSD) { 930 - imx_uart_rtsint(irq, dev_id); 909 + __imx_uart_rtsint(irq, dev_id); 931 910 ret = IRQ_HANDLED; 932 911 } 933 912 ··· 939 922 imx_uart_writel(sport, USR2_ORE, USR2); 940 923 ret = IRQ_HANDLED; 941 924 } 925 + 926 + spin_unlock(&sport->port.lock); 942 927 943 928 return ret; 944 929 } ··· 2250 2231 sport->port.iotype = UPIO_MEM; 2251 2232 sport->port.irq = rxirq; 2252 2233 sport->port.fifosize = 32; 2234 + sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE); 2253 2235 sport->port.ops = &imx_uart_pops; 2254 2236 sport->port.rs485_config = imx_uart_rs485_config; 2255 2237 sport->port.flags = UPF_BOOT_AUTOCONF;
+3 -4
drivers/tty/serial/ip22zilog.c
··· 38 38 #include <asm/sgi/hpc3.h> 39 39 #include <asm/sgi/ip22.h> 40 40 41 - #if defined(CONFIG_SERIAL_IP22_ZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 42 - #define SUPPORT_SYSRQ 43 - #endif 44 - 45 41 #include <linux/serial_core.h> 46 42 47 43 #include "ip22zilog.h" ··· 1076 1080 1077 1081 static void __init ip22zilog_prepare(void) 1078 1082 { 1083 + unsigned char sysrq_on = IS_ENABLED(CONFIG_SERIAL_IP22_ZILOG_CONSOLE); 1079 1084 struct uart_ip22zilog_port *up; 1080 1085 struct zilog_layout *rp; 1081 1086 int channel, chip; ··· 1112 1115 up[(chip * 2) + 0].port.irq = zilog_irq; 1113 1116 up[(chip * 2) + 0].port.uartclk = ZS_CLOCK; 1114 1117 up[(chip * 2) + 0].port.fifosize = 1; 1118 + up[(chip * 2) + 0].port.has_sysrq = sysrq_on; 1115 1119 up[(chip * 2) + 0].port.ops = &ip22zilog_pops; 1116 1120 up[(chip * 2) + 0].port.type = PORT_IP22ZILOG; 1117 1121 up[(chip * 2) + 0].port.flags = 0; ··· 1124 1126 up[(chip * 2) + 1].port.irq = zilog_irq; 1125 1127 up[(chip * 2) + 1].port.uartclk = ZS_CLOCK; 1126 1128 up[(chip * 2) + 1].port.fifosize = 1; 1129 + up[(chip * 2) + 1].port.has_sysrq = sysrq_on; 1127 1130 up[(chip * 2) + 1].port.ops = &ip22zilog_pops; 1128 1131 up[(chip * 2) + 1].port.type = PORT_IP22ZILOG; 1129 1132 up[(chip * 2) + 1].port.line = (chip * 2) + 1;
+2 -2
drivers/tty/serial/kgdb_nmi.c
··· 118 118 int c = -1; 119 119 const char *magic = kgdb_nmi_magic; 120 120 size_t m = strlen(magic); 121 - bool printch = 0; 121 + bool printch = false; 122 122 123 123 c = dbg_io_ops->read_char(); 124 124 if (c == NO_POLL_CHAR) ··· 130 130 n = (n + 1) % m; 131 131 if (!n) 132 132 return 1; 133 - printch = 1; 133 + printch = true; 134 134 } else { 135 135 n = 0; 136 136 }
+66 -4
drivers/tty/serial/meson_uart.c
··· 5 5 * Copyright (C) 2014 Carlo Caione <carlo@caione.org> 6 6 */ 7 7 8 - #if defined(CONFIG_SERIAL_MESON_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 9 - #define SUPPORT_SYSRQ 10 - #endif 11 - 12 8 #include <linux/clk.h> 13 9 #include <linux/console.h> 14 10 #include <linux/delay.h> 15 11 #include <linux/init.h> 16 12 #include <linux/io.h> 13 + #include <linux/iopoll.h> 17 14 #include <linux/module.h> 18 15 #include <linux/kernel.h> 19 16 #include <linux/of.h> ··· 73 76 #define AML_UART_PORT_OFFSET 6 74 77 #define AML_UART_DEV_NAME "ttyAML" 75 78 79 + #define AML_UART_POLL_USEC 5 80 + #define AML_UART_TIMEOUT_USEC 10000 76 81 77 82 static struct uart_driver meson_uart_driver; 78 83 ··· 426 427 } 427 428 } 428 429 430 + #ifdef CONFIG_CONSOLE_POLL 431 + /* 432 + * Console polling routines for writing and reading from the uart while 433 + * in an interrupt or debug context (i.e. kgdb). 434 + */ 435 + 436 + static int meson_uart_poll_get_char(struct uart_port *port) 437 + { 438 + u32 c; 439 + unsigned long flags; 440 + 441 + spin_lock_irqsave(&port->lock, flags); 442 + 443 + if (readl(port->membase + AML_UART_STATUS) & AML_UART_RX_EMPTY) 444 + c = NO_POLL_CHAR; 445 + else 446 + c = readl(port->membase + AML_UART_RFIFO); 447 + 448 + spin_unlock_irqrestore(&port->lock, flags); 449 + 450 + return c; 451 + } 452 + 453 + static void meson_uart_poll_put_char(struct uart_port *port, unsigned char c) 454 + { 455 + unsigned long flags; 456 + u32 reg; 457 + int ret; 458 + 459 + spin_lock_irqsave(&port->lock, flags); 460 + 461 + /* Wait until FIFO is empty or timeout */ 462 + ret = readl_poll_timeout_atomic(port->membase + AML_UART_STATUS, reg, 463 + reg & AML_UART_TX_EMPTY, 464 + AML_UART_POLL_USEC, 465 + AML_UART_TIMEOUT_USEC); 466 + if (ret == -ETIMEDOUT) { 467 + dev_err(port->dev, "Timeout waiting for UART TX EMPTY\n"); 468 + goto out; 469 + } 470 + 471 + /* Write the character */ 472 + writel(c, port->membase + AML_UART_WFIFO); 473 + 474 + /* Wait until FIFO is empty or timeout */ 475 + ret = readl_poll_timeout_atomic(port->membase + AML_UART_STATUS, reg, 476 + reg & AML_UART_TX_EMPTY, 477 + AML_UART_POLL_USEC, 478 + AML_UART_TIMEOUT_USEC); 479 + if (ret == -ETIMEDOUT) 480 + dev_err(port->dev, "Timeout waiting for UART TX EMPTY\n"); 481 + 482 + out: 483 + spin_unlock_irqrestore(&port->lock, flags); 484 + } 485 + 486 + #endif /* CONFIG_CONSOLE_POLL */ 487 + 429 488 static const struct uart_ops meson_uart_ops = { 430 489 .set_mctrl = meson_uart_set_mctrl, 431 490 .get_mctrl = meson_uart_get_mctrl, ··· 499 442 .request_port = meson_uart_request_port, 500 443 .release_port = meson_uart_release_port, 501 444 .verify_port = meson_uart_verify_port, 445 + #ifdef CONFIG_CONSOLE_POLL 446 + .poll_get_char = meson_uart_poll_get_char, 447 + .poll_put_char = meson_uart_poll_put_char, 448 + #endif 502 449 }; 503 450 504 451 #ifdef CONFIG_SERIAL_MESON_CONSOLE ··· 764 703 port->mapsize = resource_size(res_mem); 765 704 port->irq = res_irq->start; 766 705 port->flags = UPF_BOOT_AUTOCONF | UPF_LOW_LATENCY; 706 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MESON_CONSOLE); 767 707 port->dev = &pdev->dev; 768 708 port->line = pdev->id; 769 709 port->type = PORT_MESON;
+1 -4
drivers/tty/serial/milbeaut_usio.c
··· 3 3 * Copyright (C) 2018 Socionext Inc. 4 4 */ 5 5 6 - #if defined(CONFIG_SERIAL_MILBEAUT_USIO_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 7 - #define SUPPORT_SYSRQ 8 - #endif 9 - 10 6 #include <linux/clk.h> 11 7 #include <linux/console.h> 12 8 #include <linux/module.h> ··· 533 537 port->irq = mlb_usio_irq[index][RX]; 534 538 port->uartclk = clk_get_rate(clk); 535 539 port->fifosize = 128; 540 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MILBEAUT_USIO_CONSOLE); 536 541 port->iotype = UPIO_MEM32; 537 542 port->flags = UPF_BOOT_AUTOCONF | UPF_SPD_VHI; 538 543 port->line = index;
+2 -9
drivers/tty/serial/mpc52xx_uart.c
··· 44 44 #include <asm/mpc52xx.h> 45 45 #include <asm/mpc52xx_psc.h> 46 46 47 - #if defined(CONFIG_SERIAL_MPC52xx_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 48 - #define SUPPORT_SYSRQ 49 - #endif 50 - 51 47 #include <linux/serial_core.h> 52 48 53 49 ··· 1378 1382 ch = psc_ops->read_char(port); 1379 1383 1380 1384 /* Handle sysreq char */ 1381 - #ifdef SUPPORT_SYSRQ 1382 - if (uart_handle_sysrq_char(port, ch)) { 1383 - port->sysrq = 0; 1385 + if (uart_handle_sysrq_char(port, ch)) 1384 1386 continue; 1385 - } 1386 - #endif 1387 1387 1388 1388 /* Store it */ 1389 1389 ··· 1762 1770 spin_lock_init(&port->lock); 1763 1771 port->uartclk = uartclk; 1764 1772 port->fifosize = 512; 1773 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MPC52xx_CONSOLE); 1765 1774 port->iotype = UPIO_MEM; 1766 1775 port->flags = UPF_BOOT_AUTOCONF | 1767 1776 (uart_console(port) ? 0 : UPF_IOREMAP);
+18 -5
drivers/tty/serial/msm_serial.c
··· 7 7 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 8 8 */ 9 9 10 - #if defined(CONFIG_SERIAL_MSM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 11 - # define SUPPORT_SYSRQ 12 - #endif 13 - 14 10 #include <linux/kernel.h> 15 11 #include <linux/atomic.h> 16 12 #include <linux/dma-mapping.h> ··· 606 610 UARTDM_RX_SIZE, dma->dir); 607 611 ret = dma_mapping_error(uart->dev, dma->phys); 608 612 if (ret) 609 - return; 613 + goto sw_mode; 610 614 611 615 dma->desc = dmaengine_prep_slave_single(dma->chan, dma->phys, 612 616 UARTDM_RX_SIZE, DMA_DEV_TO_MEM, ··· 657 661 return; 658 662 unmap: 659 663 dma_unmap_single(uart->dev, dma->phys, UARTDM_RX_SIZE, dma->dir); 664 + 665 + sw_mode: 666 + /* 667 + * Switch from DMA to SW/FIFO mode. After clearing Rx BAM (UARTDM_DMEN), 668 + * receiver must be reset. 669 + */ 670 + msm_write(uart, UART_CR_CMD_RESET_RX, UART_CR); 671 + msm_write(uart, UART_CR_RX_ENABLE, UART_CR); 672 + 673 + msm_write(uart, UART_CR_CMD_RESET_STALE_INT, UART_CR); 674 + msm_write(uart, 0xFFFFFF, UARTDM_DMRX); 675 + msm_write(uart, UART_CR_CMD_STALE_EVENT_ENABLE, UART_CR); 676 + 677 + /* Re-enable RX interrupts */ 678 + msm_port->imr |= (UART_IMR_RXLEV | UART_IMR_RXSTALE); 679 + msm_write(uart, msm_port->imr, UART_IMR); 660 680 } 661 681 662 682 static void msm_stop_rx(struct uart_port *port) ··· 1822 1810 if (unlikely(irq < 0)) 1823 1811 return -ENXIO; 1824 1812 port->irq = irq; 1813 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MSM_CONSOLE); 1825 1814 1826 1815 platform_set_drvdata(pdev, port); 1827 1816
+1 -4
drivers/tty/serial/mux.c
··· 25 25 #include <asm/irq.h> 26 26 #include <asm/parisc-device.h> 27 27 28 - #if defined(CONFIG_SERIAL_MUX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 29 28 #include <linux/sysrq.h> 30 - #define SUPPORT_SYSRQ 31 - #endif 32 - 33 29 #include <linux/serial_core.h> 34 30 35 31 #define MUX_OFFSET 0x800 ··· 479 483 port->ops = &mux_pops; 480 484 port->flags = UPF_BOOT_AUTOCONF; 481 485 port->line = port_cnt; 486 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_MUX_CONSOLE); 482 487 483 488 /* The port->timeout needs to match what is present in 484 489 * uart_wait_until_sent in serial_core.c. Otherwise
+1 -4
drivers/tty/serial/mxs-auart.c
··· 12 12 * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. 13 13 */ 14 14 15 - #if defined(CONFIG_SERIAL_MXS_AUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 16 - #define SUPPORT_SYSRQ 17 - #endif 18 - 19 15 #include <linux/kernel.h> 20 16 #include <linux/errno.h> 21 17 #include <linux/init.h> ··· 1689 1693 s->port.fifosize = MXS_AUART_FIFO_SIZE; 1690 1694 s->port.uartclk = clk_get_rate(s->clk); 1691 1695 s->port.type = PORT_IMX; 1696 + s->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_MXS_AUART_CONSOLE); 1692 1697 1693 1698 mxs_init_regs(s); 1694 1699
+6 -6
drivers/tty/serial/omap-serial.c
··· 16 16 * this driver as required for the omap-platform. 17 17 */ 18 18 19 - #if defined(CONFIG_SERIAL_OMAP_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 20 - #define SUPPORT_SYSRQ 21 - #endif 22 - 23 19 #include <linux/module.h> 24 20 #include <linux/init.h> 25 21 #include <linux/console.h> ··· 489 493 static void serial_omap_rlsi(struct uart_omap_port *up, unsigned int lsr) 490 494 { 491 495 unsigned int flag; 492 - unsigned char ch = 0; 493 496 497 + /* 498 + * Read one data character out to avoid stalling the receiver according 499 + * to the table 23-246 of the omap4 TRM. 500 + */ 494 501 if (likely(lsr & UART_LSR_DR)) 495 - ch = serial_in(up, UART_RX); 502 + serial_in(up, UART_RX); 496 503 497 504 up->port.icount.rx++; 498 505 flag = TTY_NORMAL; ··· 1679 1680 up->port.regshift = 2; 1680 1681 up->port.fifosize = 64; 1681 1682 up->port.ops = &serial_omap_pops; 1683 + up->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_OMAP_CONSOLE); 1682 1684 1683 1685 if (pdev->dev.of_node) 1684 1686 ret = of_alias_get_id(pdev->dev.of_node, "serial");
+3 -9
drivers/tty/serial/pch_uart.c
··· 2 2 /* 3 3 *Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. 4 4 */ 5 - #if defined(CONFIG_SERIAL_PCH_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 6 - #define SUPPORT_SYSRQ 7 - #endif 8 5 #include <linux/kernel.h> 9 6 #include <linux/serial_reg.h> 10 7 #include <linux/slab.h> ··· 584 587 if (uart_handle_break(port)) 585 588 continue; 586 589 } 587 - #ifdef SUPPORT_SYSRQ 588 - if (port->sysrq) { 589 - if (uart_handle_sysrq_char(port, rbr)) 590 - continue; 591 - } 592 - #endif 590 + if (uart_handle_sysrq_char(port, rbr)) 591 + continue; 593 592 594 593 buf[i++] = rbr; 595 594 } ··· 1789 1796 priv->port.flags = UPF_BOOT_AUTOCONF; 1790 1797 priv->port.fifosize = fifosize; 1791 1798 priv->port.line = board->line_no; 1799 + priv->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PCH_UART_CONSOLE); 1792 1800 priv->trigger = PCH_UART_HAL_TRIGGER_M; 1793 1801 1794 1802 snprintf(priv->irq_name, IRQ_NAME_SIZE,
+1 -4
drivers/tty/serial/pmac_zilog.c
··· 61 61 #define of_machine_is_compatible(x) (0) 62 62 #endif 63 63 64 - #if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 65 - #define SUPPORT_SYSRQ 66 - #endif 67 - 68 64 #include <linux/serial.h> 69 65 #include <linux/serial_core.h> 70 66 ··· 1717 1721 uap->control_reg = uap->port.membase; 1718 1722 uap->data_reg = uap->control_reg + 4; 1719 1723 uap->port_type = 0; 1724 + uap->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PMACZILOG_CONSOLE); 1720 1725 1721 1726 pmz_convert_to_zs(uap, CS8, 0, 9600); 1722 1727
+1 -6
drivers/tty/serial/pnx8xxx_uart.c
··· 10 10 * Copyright (C) 2000 Deep Blue Solutions Ltd. 11 11 */ 12 12 13 - #if defined(CONFIG_SERIAL_PNX8XXX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 14 - #define SUPPORT_SYSRQ 15 - #endif 16 - 17 13 #include <linux/module.h> 18 14 #include <linux/ioport.h> 19 15 #include <linux/init.h> ··· 216 220 else if (status & FIFO_TO_SM(PNX8XXX_UART_FIFO_RXFE)) 217 221 flg = TTY_FRAME; 218 222 219 - #ifdef SUPPORT_SYSRQ 220 223 sport->port.sysrq = 0; 221 - #endif 222 224 } 223 225 224 226 if (uart_handle_sysrq_char(&sport->port, ch)) ··· 794 800 if (pnx8xxx_ports[i].port.mapbase != res->start) 795 801 continue; 796 802 803 + pnx8xxx_ports[i].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PNX8XXX_CONSOLE); 797 804 pnx8xxx_ports[i].port.dev = &pdev->dev; 798 805 uart_add_one_port(&pnx8xxx_reg, &pnx8xxx_ports[i].port); 799 806 platform_set_drvdata(pdev, &pnx8xxx_ports[i]);
+1 -4
drivers/tty/serial/pxa.c
··· 19 19 */ 20 20 21 21 22 - #if defined(CONFIG_SERIAL_PXA_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 23 - #define SUPPORT_SYSRQ 24 - #endif 25 - 26 22 #include <linux/ioport.h> 27 23 #include <linux/init.h> 28 24 #include <linux/console.h> ··· 875 879 sport->port.dev = &dev->dev; 876 880 sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; 877 881 sport->port.uartclk = clk_get_rate(sport->clk); 882 + sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_PXA_CONSOLE); 878 883 879 884 ret = serial_pxa_probe_dt(dev, sport); 880 885 if (ret > 0)
+50 -76
drivers/tty/serial/qcom_geni_serial.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 // Copyright (c) 2017-2018, The Linux foundation. All rights reserved. 3 3 4 - #if defined(CONFIG_SERIAL_QCOM_GENI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 5 - # define SUPPORT_SYSRQ 6 - #endif 7 - 8 4 #include <linux/clk.h> 9 5 #include <linux/console.h> 10 6 #include <linux/io.h> ··· 10 14 #include <linux/of.h> 11 15 #include <linux/of_device.h> 12 16 #include <linux/platform_device.h> 17 + #include <linux/pm_runtime.h> 13 18 #include <linux/pm_wakeirq.h> 14 19 #include <linux/qcom-geni-se.h> 15 20 #include <linux/serial.h> ··· 89 92 #define DEF_TX_WM 2 90 93 #define DEF_FIFO_WIDTH_BITS 32 91 94 #define UART_RX_WM 2 92 - #define MAX_LOOPBACK_CFG 3 95 + 96 + /* SE_UART_LOOPBACK_CFG */ 97 + #define RX_TX_SORTED BIT(0) 98 + #define CTS_RTS_SORTED BIT(1) 99 + #define RX_TX_CTS_RTS_SORTED (RX_TX_SORTED | CTS_RTS_SORTED) 93 100 94 101 #ifdef CONFIG_CONSOLE_POLL 95 102 #define CONSOLE_RX_BYTES_PW 1 ··· 104 103 struct qcom_geni_serial_port { 105 104 struct uart_port uport; 106 105 struct geni_se se; 107 - char name[20]; 106 + const char *name; 108 107 u32 tx_fifo_depth; 109 108 u32 tx_fifo_width; 110 109 u32 rx_fifo_depth; ··· 165 164 }, 166 165 }; 167 166 168 - static ssize_t loopback_show(struct device *dev, 169 - struct device_attribute *attr, char *buf) 170 - { 171 - struct qcom_geni_serial_port *port = dev_get_drvdata(dev); 172 - 173 - return snprintf(buf, sizeof(u32), "%d\n", port->loopback); 174 - } 175 - 176 - static ssize_t loopback_store(struct device *dev, 177 - struct device_attribute *attr, const char *buf, 178 - size_t size) 179 - { 180 - struct qcom_geni_serial_port *port = dev_get_drvdata(dev); 181 - u32 loopback; 182 - 183 - if (kstrtoint(buf, 0, &loopback) || loopback > MAX_LOOPBACK_CFG) { 184 - dev_err(dev, "Invalid input\n"); 185 - return -EINVAL; 186 - } 187 - port->loopback = loopback; 188 - return size; 189 - } 190 - static DEVICE_ATTR_RW(loopback); 191 - 192 167 static struct qcom_geni_serial_port qcom_geni_console_port = { 193 168 .uport = { 194 169 .iotype = UPIO_MEM, ··· 214 237 unsigned int mctrl) 215 238 { 216 239 u32 uart_manual_rfr = 0; 240 + struct qcom_geni_serial_port *port = to_dev_port(uport, uport); 217 241 218 242 if (uart_console(uport)) 219 243 return; 244 + 245 + if (mctrl & TIOCM_LOOP) 246 + port->loopback = RX_TX_CTS_RTS_SORTED; 220 247 221 248 if (!(mctrl & TIOCM_RTS)) 222 249 uart_manual_rfr = UART_MANUAL_RFR_EN | UART_RFR_NOT_READY; ··· 736 755 737 756 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) 738 757 uart_write_wakeup(uport); 739 - } 740 - 741 - static irqreturn_t qcom_geni_serial_wakeup_isr(int isr, void *dev) 742 - { 743 - struct uart_port *uport = dev; 744 - 745 - pm_wakeup_event(uport->dev, 2000); 746 - 747 - return IRQ_HANDLED; 748 758 } 749 759 750 760 static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) ··· 1274 1302 port->rx_fifo_depth = DEF_FIFO_DEPTH_WORDS; 1275 1303 port->tx_fifo_width = DEF_FIFO_WIDTH_BITS; 1276 1304 1277 - scnprintf(port->name, sizeof(port->name), "qcom_geni_serial_%s%d", 1278 - (uart_console(uport) ? "console" : "uart"), uport->line); 1305 + port->name = devm_kasprintf(uport->dev, GFP_KERNEL, 1306 + "qcom_geni_serial_%s%d", 1307 + uart_console(uport) ? "console" : "uart", uport->line); 1308 + if (!port->name) 1309 + return -ENOMEM; 1310 + 1279 1311 irq = platform_get_irq(pdev, 0); 1280 1312 if (irq < 0) 1281 1313 return irq; 1282 1314 uport->irq = irq; 1315 + uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_QCOM_GENI_CONSOLE); 1316 + 1317 + if (!console) 1318 + port->wakeup_irq = platform_get_irq_optional(pdev, 1); 1319 + 1320 + uport->private_data = drv; 1321 + platform_set_drvdata(pdev, port); 1322 + port->handle_rx = console ? handle_rx_console : handle_rx_uart; 1323 + 1324 + ret = uart_add_one_port(drv, uport); 1325 + if (ret) 1326 + return ret; 1283 1327 1284 1328 irq_set_status_flags(uport->irq, IRQ_NOAUTOEN); 1285 1329 ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr, 1286 1330 IRQF_TRIGGER_HIGH, port->name, uport); 1287 1331 if (ret) { 1288 1332 dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret); 1333 + uart_remove_one_port(drv, uport); 1289 1334 return ret; 1290 1335 } 1291 1336 1292 - if (!console) { 1293 - port->wakeup_irq = platform_get_irq(pdev, 1); 1294 - if (port->wakeup_irq < 0) { 1295 - dev_err(&pdev->dev, "Failed to get wakeup IRQ %d\n", 1296 - port->wakeup_irq); 1297 - } else { 1298 - irq_set_status_flags(port->wakeup_irq, IRQ_NOAUTOEN); 1299 - ret = devm_request_irq(uport->dev, port->wakeup_irq, 1300 - qcom_geni_serial_wakeup_isr, 1301 - IRQF_TRIGGER_FALLING, "uart_wakeup", uport); 1302 - if (ret) { 1303 - dev_err(uport->dev, "Failed to register wakeup IRQ ret %d\n", 1304 - ret); 1305 - return ret; 1306 - } 1337 + /* 1338 + * Set pm_runtime status as ACTIVE so that wakeup_irq gets 1339 + * enabled/disabled from dev_pm_arm_wake_irq during system 1340 + * suspend/resume respectively. 1341 + */ 1342 + pm_runtime_set_active(&pdev->dev); 1307 1343 1308 - device_init_wakeup(&pdev->dev, true); 1309 - ret = dev_pm_set_wake_irq(&pdev->dev, port->wakeup_irq); 1310 - if (unlikely(ret)) 1311 - dev_err(uport->dev, "%s:Failed to set IRQ wake:%d\n", 1312 - __func__, ret); 1344 + if (port->wakeup_irq > 0) { 1345 + device_init_wakeup(&pdev->dev, true); 1346 + ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, 1347 + port->wakeup_irq); 1348 + if (ret) { 1349 + device_init_wakeup(&pdev->dev, false); 1350 + uart_remove_one_port(drv, uport); 1351 + return ret; 1313 1352 } 1314 1353 } 1315 - uport->private_data = drv; 1316 - platform_set_drvdata(pdev, port); 1317 - port->handle_rx = console ? handle_rx_console : handle_rx_uart; 1318 - if (!console) 1319 - device_create_file(uport->dev, &dev_attr_loopback); 1320 - return uart_add_one_port(drv, uport); 1354 + 1355 + return 0; 1321 1356 } 1322 1357 1323 1358 static int qcom_geni_serial_remove(struct platform_device *pdev) ··· 1332 1353 struct qcom_geni_serial_port *port = platform_get_drvdata(pdev); 1333 1354 struct uart_driver *drv = port->uport.private_data; 1334 1355 1356 + dev_pm_clear_wake_irq(&pdev->dev); 1357 + device_init_wakeup(&pdev->dev, false); 1335 1358 uart_remove_one_port(drv, &port->uport); 1359 + 1336 1360 return 0; 1337 1361 } 1338 1362 ··· 1344 1362 struct qcom_geni_serial_port *port = dev_get_drvdata(dev); 1345 1363 struct uart_port *uport = &port->uport; 1346 1364 1347 - uart_suspend_port(uport->private_data, uport); 1348 - 1349 - if (port->wakeup_irq > 0) 1350 - enable_irq(port->wakeup_irq); 1351 - 1352 - return 0; 1365 + return uart_suspend_port(uport->private_data, uport); 1353 1366 } 1354 1367 1355 1368 static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev) 1356 1369 { 1357 1370 struct qcom_geni_serial_port *port = dev_get_drvdata(dev); 1358 1371 struct uart_port *uport = &port->uport; 1359 - 1360 - if (port->wakeup_irq > 0) 1361 - disable_irq(port->wakeup_irq); 1362 1372 1363 1373 return uart_resume_port(uport->private_data, uport); 1364 1374 }
+1 -6
drivers/tty/serial/sa1100.c
··· 7 7 * Copyright (C) 2000 Deep Blue Solutions Ltd. 8 8 */ 9 9 10 - #if defined(CONFIG_SERIAL_SA1100_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 11 - #define SUPPORT_SYSRQ 12 - #endif 13 - 14 10 #include <linux/module.h> 15 11 #include <linux/ioport.h> 16 12 #include <linux/init.h> ··· 210 214 else if (status & UTSR1_TO_SM(UTSR1_FRE)) 211 215 flg = TTY_FRAME; 212 216 213 - #ifdef SUPPORT_SYSRQ 214 217 sport->port.sysrq = 0; 215 - #endif 216 218 } 217 219 218 220 if (uart_handle_sysrq_char(&sport->port, ch)) ··· 854 860 static int sa1100_serial_add_one_port(struct sa1100_port *sport, struct platform_device *dev) 855 861 { 856 862 sport->port.dev = &dev->dev; 863 + sport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SA1100_CONSOLE); 857 864 858 865 // mctrl_gpio_init() requires that the GPIO driver supports interrupts, 859 866 // but we need to support GPIO drivers for hardware that has no such
-147
drivers/tty/serial/samsung.h
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #ifndef __SAMSUNG_H 3 - #define __SAMSUNG_H 4 - 5 - /* 6 - * Driver for Samsung SoC onboard UARTs. 7 - * 8 - * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics 9 - * http://armlinux.simtec.co.uk/ 10 - */ 11 - 12 - #include <linux/dmaengine.h> 13 - 14 - struct s3c24xx_uart_info { 15 - char *name; 16 - unsigned int type; 17 - unsigned int fifosize; 18 - unsigned long rx_fifomask; 19 - unsigned long rx_fifoshift; 20 - unsigned long rx_fifofull; 21 - unsigned long tx_fifomask; 22 - unsigned long tx_fifoshift; 23 - unsigned long tx_fifofull; 24 - unsigned int def_clk_sel; 25 - unsigned long num_clks; 26 - unsigned long clksel_mask; 27 - unsigned long clksel_shift; 28 - 29 - /* uart port features */ 30 - 31 - unsigned int has_divslot:1; 32 - 33 - /* uart controls */ 34 - int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *); 35 - }; 36 - 37 - struct s3c24xx_serial_drv_data { 38 - struct s3c24xx_uart_info *info; 39 - struct s3c2410_uartcfg *def_cfg; 40 - unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; 41 - }; 42 - 43 - struct s3c24xx_uart_dma { 44 - unsigned int rx_chan_id; 45 - unsigned int tx_chan_id; 46 - 47 - struct dma_slave_config rx_conf; 48 - struct dma_slave_config tx_conf; 49 - 50 - struct dma_chan *rx_chan; 51 - struct dma_chan *tx_chan; 52 - 53 - dma_addr_t rx_addr; 54 - dma_addr_t tx_addr; 55 - 56 - dma_cookie_t rx_cookie; 57 - dma_cookie_t tx_cookie; 58 - 59 - char *rx_buf; 60 - 61 - dma_addr_t tx_transfer_addr; 62 - 63 - size_t rx_size; 64 - size_t tx_size; 65 - 66 - struct dma_async_tx_descriptor *tx_desc; 67 - struct dma_async_tx_descriptor *rx_desc; 68 - 69 - int tx_bytes_requested; 70 - int rx_bytes_requested; 71 - }; 72 - 73 - struct s3c24xx_uart_port { 74 - unsigned char rx_claimed; 75 - unsigned char tx_claimed; 76 - unsigned int pm_level; 77 - unsigned long baudclk_rate; 78 - unsigned int min_dma_size; 79 - 80 - unsigned int rx_irq; 81 - unsigned int tx_irq; 82 - 83 - unsigned int tx_in_progress; 84 - unsigned int tx_mode; 85 - unsigned int rx_mode; 86 - 87 - struct s3c24xx_uart_info *info; 88 - struct clk *clk; 89 - struct clk *baudclk; 90 - struct uart_port port; 91 - struct s3c24xx_serial_drv_data *drv_data; 92 - 93 - /* reference to platform data */ 94 - struct s3c2410_uartcfg *cfg; 95 - 96 - struct s3c24xx_uart_dma *dma; 97 - 98 - #ifdef CONFIG_ARM_S3C24XX_CPUFREQ 99 - struct notifier_block freq_transition; 100 - #endif 101 - }; 102 - 103 - /* conversion functions */ 104 - 105 - #define s3c24xx_dev_to_port(__dev) dev_get_drvdata(__dev) 106 - 107 - /* register access controls */ 108 - 109 - #define portaddr(port, reg) ((port)->membase + (reg)) 110 - #define portaddrl(port, reg) \ 111 - ((unsigned long *)(unsigned long)((port)->membase + (reg))) 112 - 113 - #define rd_regb(port, reg) (readb_relaxed(portaddr(port, reg))) 114 - #define rd_regl(port, reg) (readl_relaxed(portaddr(port, reg))) 115 - 116 - #define wr_regb(port, reg, val) writeb_relaxed(val, portaddr(port, reg)) 117 - #define wr_regl(port, reg, val) writel_relaxed(val, portaddr(port, reg)) 118 - 119 - /* Byte-order aware bit setting/clearing functions. */ 120 - 121 - static inline void s3c24xx_set_bit(struct uart_port *port, int idx, 122 - unsigned int reg) 123 - { 124 - unsigned long flags; 125 - u32 val; 126 - 127 - local_irq_save(flags); 128 - val = rd_regl(port, reg); 129 - val |= (1 << idx); 130 - wr_regl(port, reg, val); 131 - local_irq_restore(flags); 132 - } 133 - 134 - static inline void s3c24xx_clear_bit(struct uart_port *port, int idx, 135 - unsigned int reg) 136 - { 137 - unsigned long flags; 138 - u32 val; 139 - 140 - local_irq_save(flags); 141 - val = rd_regl(port, reg); 142 - val &= ~(1 << idx); 143 - wr_regl(port, reg, val); 144 - local_irq_restore(flags); 145 - } 146 - 147 - #endif
+204 -111
drivers/tty/serial/samsung_tty.c
··· 4 4 * 5 5 * Ben Dooks, Copyright (c) 2003-2008 Simtec Electronics 6 6 * http://armlinux.simtec.co.uk/ 7 - */ 7 + */ 8 8 9 9 /* Hote on 2410 error handling 10 10 * ··· 19 19 * and change the policy on BREAK 20 20 * 21 21 * BJD, 04-Nov-2004 22 - */ 23 - 24 - #if defined(CONFIG_SERIAL_SAMSUNG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 25 - #define SUPPORT_SYSRQ 26 - #endif 22 + */ 27 23 28 24 #include <linux/dmaengine.h> 29 25 #include <linux/dma-mapping.h> ··· 40 44 #include <linux/clk.h> 41 45 #include <linux/cpufreq.h> 42 46 #include <linux/of.h> 43 - 44 47 #include <asm/irq.h> 45 - 46 - #include "samsung.h" 47 - 48 - #if defined(CONFIG_SERIAL_SAMSUNG_DEBUG) && \ 49 - !defined(MODULE) 50 - 51 - extern void printascii(const char *); 52 - 53 - __printf(1, 2) 54 - static void dbg(const char *fmt, ...) 55 - { 56 - va_list va; 57 - char buff[256]; 58 - 59 - va_start(va, fmt); 60 - vscnprintf(buff, sizeof(buff), fmt, va); 61 - va_end(va); 62 - 63 - printascii(buff); 64 - } 65 - 66 - #else 67 - #define dbg(fmt, ...) do { if (0) no_printk(fmt, ##__VA_ARGS__); } while (0) 68 - #endif 69 48 70 49 /* UART name and device definitions */ 71 50 ··· 52 81 #define S3C24XX_TX_DMA 2 53 82 #define S3C24XX_RX_PIO 1 54 83 #define S3C24XX_RX_DMA 2 55 - /* macros to change one thing to another */ 56 - 57 - #define tx_enabled(port) ((port)->unused[0]) 58 - #define rx_enabled(port) ((port)->unused[1]) 59 84 60 85 /* flag to ignore all characters coming in */ 61 86 #define RXSTAT_DUMMY_READ (0x10000000) 87 + 88 + struct s3c24xx_uart_info { 89 + char *name; 90 + unsigned int type; 91 + unsigned int fifosize; 92 + unsigned long rx_fifomask; 93 + unsigned long rx_fifoshift; 94 + unsigned long rx_fifofull; 95 + unsigned long tx_fifomask; 96 + unsigned long tx_fifoshift; 97 + unsigned long tx_fifofull; 98 + unsigned int def_clk_sel; 99 + unsigned long num_clks; 100 + unsigned long clksel_mask; 101 + unsigned long clksel_shift; 102 + 103 + /* uart port features */ 104 + 105 + unsigned int has_divslot:1; 106 + }; 107 + 108 + struct s3c24xx_serial_drv_data { 109 + struct s3c24xx_uart_info *info; 110 + struct s3c2410_uartcfg *def_cfg; 111 + unsigned int fifosize[CONFIG_SERIAL_SAMSUNG_UARTS]; 112 + }; 113 + 114 + struct s3c24xx_uart_dma { 115 + unsigned int rx_chan_id; 116 + unsigned int tx_chan_id; 117 + 118 + struct dma_slave_config rx_conf; 119 + struct dma_slave_config tx_conf; 120 + 121 + struct dma_chan *rx_chan; 122 + struct dma_chan *tx_chan; 123 + 124 + dma_addr_t rx_addr; 125 + dma_addr_t tx_addr; 126 + 127 + dma_cookie_t rx_cookie; 128 + dma_cookie_t tx_cookie; 129 + 130 + char *rx_buf; 131 + 132 + dma_addr_t tx_transfer_addr; 133 + 134 + size_t rx_size; 135 + size_t tx_size; 136 + 137 + struct dma_async_tx_descriptor *tx_desc; 138 + struct dma_async_tx_descriptor *rx_desc; 139 + 140 + int tx_bytes_requested; 141 + int rx_bytes_requested; 142 + }; 143 + 144 + struct s3c24xx_uart_port { 145 + unsigned char rx_claimed; 146 + unsigned char tx_claimed; 147 + unsigned char rx_enabled; 148 + unsigned char tx_enabled; 149 + unsigned int pm_level; 150 + unsigned long baudclk_rate; 151 + unsigned int min_dma_size; 152 + 153 + unsigned int rx_irq; 154 + unsigned int tx_irq; 155 + 156 + unsigned int tx_in_progress; 157 + unsigned int tx_mode; 158 + unsigned int rx_mode; 159 + 160 + struct s3c24xx_uart_info *info; 161 + struct clk *clk; 162 + struct clk *baudclk; 163 + struct uart_port port; 164 + struct s3c24xx_serial_drv_data *drv_data; 165 + 166 + /* reference to platform data */ 167 + struct s3c2410_uartcfg *cfg; 168 + 169 + struct s3c24xx_uart_dma *dma; 170 + 171 + #ifdef CONFIG_ARM_S3C24XX_CPUFREQ 172 + struct notifier_block freq_transition; 173 + #endif 174 + }; 175 + 176 + /* conversion functions */ 177 + 178 + #define s3c24xx_dev_to_port(__dev) dev_get_drvdata(__dev) 179 + 180 + /* register access controls */ 181 + 182 + #define portaddr(port, reg) ((port)->membase + (reg)) 183 + #define portaddrl(port, reg) \ 184 + ((unsigned long *)(unsigned long)((port)->membase + (reg))) 185 + 186 + #define rd_regb(port, reg) (readb_relaxed(portaddr(port, reg))) 187 + #define rd_regl(port, reg) (readl_relaxed(portaddr(port, reg))) 188 + 189 + #define wr_regb(port, reg, val) writeb_relaxed(val, portaddr(port, reg)) 190 + #define wr_regl(port, reg, val) writel_relaxed(val, portaddr(port, reg)) 191 + 192 + /* Byte-order aware bit setting/clearing functions. */ 193 + 194 + static inline void s3c24xx_set_bit(struct uart_port *port, int idx, 195 + unsigned int reg) 196 + { 197 + unsigned long flags; 198 + u32 val; 199 + 200 + local_irq_save(flags); 201 + val = rd_regl(port, reg); 202 + val |= (1 << idx); 203 + wr_regl(port, reg, val); 204 + local_irq_restore(flags); 205 + } 206 + 207 + static inline void s3c24xx_clear_bit(struct uart_port *port, int idx, 208 + unsigned int reg) 209 + { 210 + unsigned long flags; 211 + u32 val; 212 + 213 + local_irq_save(flags); 214 + val = rd_regl(port, reg); 215 + val &= ~(1 << idx); 216 + wr_regl(port, reg, val); 217 + local_irq_restore(flags); 218 + } 62 219 63 220 static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port) 64 221 { ··· 217 118 218 119 static void s3c24xx_serial_rx_enable(struct uart_port *port) 219 120 { 121 + struct s3c24xx_uart_port *ourport = to_ourport(port); 220 122 unsigned long flags; 221 123 unsigned int ucon, ufcon; 222 124 int count = 10000; ··· 235 135 ucon |= S3C2410_UCON_RXIRQMODE; 236 136 wr_regl(port, S3C2410_UCON, ucon); 237 137 238 - rx_enabled(port) = 1; 138 + ourport->rx_enabled = 1; 239 139 spin_unlock_irqrestore(&port->lock, flags); 240 140 } 241 141 242 142 static void s3c24xx_serial_rx_disable(struct uart_port *port) 243 143 { 144 + struct s3c24xx_uart_port *ourport = to_ourport(port); 244 145 unsigned long flags; 245 146 unsigned int ucon; 246 147 ··· 251 150 ucon &= ~S3C2410_UCON_RXIRQMODE; 252 151 wr_regl(port, S3C2410_UCON, ucon); 253 152 254 - rx_enabled(port) = 0; 153 + ourport->rx_enabled = 0; 255 154 spin_unlock_irqrestore(&port->lock, flags); 256 155 } 257 156 ··· 263 162 struct dma_tx_state state; 264 163 int count; 265 164 266 - if (!tx_enabled(port)) 165 + if (!ourport->tx_enabled) 267 166 return; 268 167 269 168 if (s3c24xx_serial_has_interrupt_mask(port)) ··· 283 182 port->icount.tx += count; 284 183 } 285 184 286 - tx_enabled(port) = 0; 185 + ourport->tx_enabled = 0; 287 186 ourport->tx_in_progress = 0; 288 187 289 188 if (port->flags & UPF_CONS_FLOW) ··· 441 340 struct s3c24xx_uart_port *ourport = to_ourport(port); 442 341 struct circ_buf *xmit = &port->state->xmit; 443 342 444 - if (!tx_enabled(port)) { 343 + if (!ourport->tx_enabled) { 445 344 if (port->flags & UPF_CONS_FLOW) 446 345 s3c24xx_serial_rx_disable(port); 447 346 448 - tx_enabled(port) = 1; 347 + ourport->tx_enabled = 1; 449 348 if (!ourport->dma || !ourport->dma->tx_chan) 450 349 s3c24xx_serial_start_tx_pio(ourport); 451 350 } ··· 490 389 enum dma_status dma_status; 491 390 unsigned int received; 492 391 493 - if (rx_enabled(port)) { 494 - dbg("s3c24xx_serial_stop_rx: port=%p\n", port); 392 + if (ourport->rx_enabled) { 393 + dev_dbg(port->dev, "stopping rx\n"); 495 394 if (s3c24xx_serial_has_interrupt_mask(port)) 496 395 s3c24xx_set_bit(port, S3C64XX_UINTM_RXD, 497 396 S3C64XX_UINTM); 498 397 else 499 398 disable_irq_nosync(ourport->rx_irq); 500 - rx_enabled(port) = 0; 399 + ourport->rx_enabled = 0; 501 400 } 502 401 if (dma && dma->rx_chan) { 503 402 dmaengine_pause(dma->tx_chan); ··· 647 546 648 547 static irqreturn_t s3c24xx_serial_rx_chars_dma(void *dev_id) 649 548 { 650 - unsigned int utrstat, ufstat, received; 549 + unsigned int utrstat, received; 651 550 struct s3c24xx_uart_port *ourport = dev_id; 652 551 struct uart_port *port = &ourport->port; 653 552 struct s3c24xx_uart_dma *dma = ourport->dma; ··· 657 556 struct dma_tx_state state; 658 557 659 558 utrstat = rd_regl(port, S3C2410_UTRSTAT); 660 - ufstat = rd_regl(port, S3C2410_UFSTAT); 559 + rd_regl(port, S3C2410_UFSTAT); 661 560 662 561 spin_lock_irqsave(&port->lock, flags); 663 562 ··· 719 618 if (port->flags & UPF_CONS_FLOW) { 720 619 int txe = s3c24xx_serial_txempty_nofifo(port); 721 620 722 - if (rx_enabled(port)) { 621 + if (ourport->rx_enabled) { 723 622 if (!txe) { 724 - rx_enabled(port) = 0; 623 + ourport->rx_enabled = 0; 725 624 continue; 726 625 } 727 626 } else { ··· 729 628 ufcon = rd_regl(port, S3C2410_UFCON); 730 629 ufcon |= S3C2410_UFCON_RESETRX; 731 630 wr_regl(port, S3C2410_UFCON, ufcon); 732 - rx_enabled(port) = 1; 631 + ourport->rx_enabled = 1; 733 632 return; 734 633 } 735 634 continue; ··· 742 641 port->icount.rx++; 743 642 744 643 if (unlikely(uerstat & S3C2410_UERSTAT_ANY)) { 745 - dbg("rxerr: port ch=0x%02x, rxs=0x%08x\n", 746 - ch, uerstat); 644 + dev_dbg(port->dev, 645 + "rxerr: port ch=0x%02x, rxs=0x%08x\n", 646 + ch, uerstat); 747 647 748 648 /* check for break */ 749 649 if (uerstat & S3C2410_UERSTAT_BREAK) { 750 - dbg("break!\n"); 650 + dev_dbg(port->dev, "break!\n"); 751 651 port->icount.brk++; 752 652 if (uart_handle_break(port)) 753 653 continue; /* Ignore character */ ··· 834 732 835 733 /* if there isn't anything more to transmit, or the uart is now 836 734 * stopped, disable the uart and exit 837 - */ 735 + */ 838 736 839 737 if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { 840 738 s3c24xx_serial_stop_tx(port); ··· 1080 978 if (ourport->tx_claimed) { 1081 979 if (!s3c24xx_serial_has_interrupt_mask(port)) 1082 980 free_irq(ourport->tx_irq, ourport); 1083 - tx_enabled(port) = 0; 981 + ourport->tx_enabled = 0; 1084 982 ourport->tx_claimed = 0; 1085 983 ourport->tx_mode = 0; 1086 984 } ··· 1089 987 if (!s3c24xx_serial_has_interrupt_mask(port)) 1090 988 free_irq(ourport->rx_irq, ourport); 1091 989 ourport->rx_claimed = 0; 1092 - rx_enabled(port) = 0; 990 + ourport->rx_enabled = 0; 1093 991 } 1094 992 1095 993 /* Clear pending interrupts and mask all interrupts */ ··· 1111 1009 struct s3c24xx_uart_port *ourport = to_ourport(port); 1112 1010 int ret; 1113 1011 1114 - dbg("s3c24xx_serial_startup: port=%p (%08llx,%p)\n", 1115 - port, (unsigned long long)port->mapbase, port->membase); 1116 - 1117 - rx_enabled(port) = 1; 1012 + ourport->rx_enabled = 1; 1118 1013 1119 1014 ret = request_irq(ourport->rx_irq, s3c24xx_serial_rx_chars, 0, 1120 1015 s3c24xx_serial_portname(port), ourport); ··· 1123 1024 1124 1025 ourport->rx_claimed = 1; 1125 1026 1126 - dbg("requesting tx irq...\n"); 1027 + dev_dbg(port->dev, "requesting tx irq...\n"); 1127 1028 1128 - tx_enabled(port) = 1; 1029 + ourport->tx_enabled = 1; 1129 1030 1130 1031 ret = request_irq(ourport->tx_irq, s3c24xx_serial_tx_chars, 0, 1131 1032 s3c24xx_serial_portname(port), ourport); ··· 1137 1038 1138 1039 ourport->tx_claimed = 1; 1139 1040 1140 - dbg("s3c24xx_serial_startup ok\n"); 1141 - 1142 1041 /* the port reset code should have done the correct 1143 - * register setup for the port controls */ 1042 + * register setup for the port controls 1043 + */ 1144 1044 1145 1045 return ret; 1146 1046 ··· 1154 1056 unsigned long flags; 1155 1057 unsigned int ufcon; 1156 1058 int ret; 1157 - 1158 - dbg("s3c64xx_serial_startup: port=%p (%08llx,%p)\n", 1159 - port, (unsigned long long)port->mapbase, port->membase); 1160 1059 1161 1060 wr_regl(port, S3C64XX_UINTM, 0xf); 1162 1061 if (ourport->dma) { ··· 1172 1077 } 1173 1078 1174 1079 /* For compatibility with s3c24xx Soc's */ 1175 - rx_enabled(port) = 1; 1080 + ourport->rx_enabled = 1; 1176 1081 ourport->rx_claimed = 1; 1177 - tx_enabled(port) = 0; 1082 + ourport->tx_enabled = 0; 1178 1083 ourport->tx_claimed = 1; 1179 1084 1180 1085 spin_lock_irqsave(&port->lock, flags); ··· 1192 1097 /* Enable Rx Interrupt */ 1193 1098 s3c24xx_clear_bit(port, S3C64XX_UINTM_RXD, S3C64XX_UINTM); 1194 1099 1195 - dbg("s3c64xx_serial_startup ok\n"); 1196 1100 return ret; 1197 1101 } 1198 1102 ··· 1239 1145 * baud clocks (and the resultant actual baud rates) and then tries to 1240 1146 * pick the closest one and select that. 1241 1147 * 1242 - */ 1148 + */ 1243 1149 1244 1150 #define MAX_CLK_NAME_LENGTH 15 1245 1151 ··· 1409 1315 1410 1316 if (cfg->has_fracval) { 1411 1317 udivslot = (div & 15); 1412 - dbg("fracval = %04x\n", udivslot); 1318 + dev_dbg(port->dev, "fracval = %04x\n", udivslot); 1413 1319 } else { 1414 1320 udivslot = udivslot_table[div & 15]; 1415 - dbg("udivslot = %04x (div %d)\n", udivslot, div & 15); 1321 + dev_dbg(port->dev, "udivslot = %04x (div %d)\n", 1322 + udivslot, div & 15); 1416 1323 } 1417 1324 } 1418 1325 1419 1326 switch (termios->c_cflag & CSIZE) { 1420 1327 case CS5: 1421 - dbg("config: 5bits/char\n"); 1328 + dev_dbg(port->dev, "config: 5bits/char\n"); 1422 1329 ulcon = S3C2410_LCON_CS5; 1423 1330 break; 1424 1331 case CS6: 1425 - dbg("config: 6bits/char\n"); 1332 + dev_dbg(port->dev, "config: 6bits/char\n"); 1426 1333 ulcon = S3C2410_LCON_CS6; 1427 1334 break; 1428 1335 case CS7: 1429 - dbg("config: 7bits/char\n"); 1336 + dev_dbg(port->dev, "config: 7bits/char\n"); 1430 1337 ulcon = S3C2410_LCON_CS7; 1431 1338 break; 1432 1339 case CS8: 1433 1340 default: 1434 - dbg("config: 8bits/char\n"); 1341 + dev_dbg(port->dev, "config: 8bits/char\n"); 1435 1342 ulcon = S3C2410_LCON_CS8; 1436 1343 break; 1437 1344 } ··· 1454 1359 1455 1360 spin_lock_irqsave(&port->lock, flags); 1456 1361 1457 - dbg("setting ulcon to %08x, brddiv to %d, udivslot %08x\n", 1458 - ulcon, quot, udivslot); 1362 + dev_dbg(port->dev, 1363 + "setting ulcon to %08x, brddiv to %d, udivslot %08x\n", 1364 + ulcon, quot, udivslot); 1459 1365 1460 1366 wr_regl(port, S3C2410_ULCON, ulcon); 1461 1367 wr_regl(port, S3C2410_UBRDIV, quot); ··· 1477 1381 if (ourport->info->has_divslot) 1478 1382 wr_regl(port, S3C2443_DIVSLOT, udivslot); 1479 1383 1480 - dbg("uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n", 1481 - rd_regl(port, S3C2410_ULCON), 1482 - rd_regl(port, S3C2410_UCON), 1483 - rd_regl(port, S3C2410_UFCON)); 1384 + dev_dbg(port->dev, 1385 + "uart: ulcon = 0x%08x, ucon = 0x%08x, ufcon = 0x%08x\n", 1386 + rd_regl(port, S3C2410_ULCON), 1387 + rd_regl(port, S3C2410_UCON), 1388 + rd_regl(port, S3C2410_UFCON)); 1484 1389 1485 1390 /* 1486 1391 * Update the per-port timeout. ··· 1539 1442 static int s3c24xx_serial_request_port(struct uart_port *port) 1540 1443 { 1541 1444 const char *name = s3c24xx_serial_portname(port); 1445 + 1542 1446 return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY; 1543 1447 } 1544 1448 ··· 1681 1583 /* s3c24xx_serial_resetport 1682 1584 * 1683 1585 * reset the fifos and other the settings. 1684 - */ 1586 + */ 1685 1587 1686 1588 static void s3c24xx_serial_resetport(struct uart_port *port, 1687 1589 struct s3c2410_uartcfg *cfg) ··· 1735 1637 1736 1638 if (val == CPUFREQ_PRECHANGE) { 1737 1639 /* we should really shut the port down whilst the 1738 - * frequency change is in progress. */ 1640 + * frequency change is in progress. 1641 + */ 1739 1642 1740 1643 } else if (val == CPUFREQ_POSTCHANGE) { 1741 1644 struct ktermios *termios; ··· 1842 1743 struct resource *res; 1843 1744 int ret; 1844 1745 1845 - dbg("s3c24xx_serial_init_port: port=%p, platdev=%p\n", port, platdev); 1846 - 1847 1746 if (platdev == NULL) 1848 1747 return -ENODEV; 1849 1748 ··· 1858 1761 port->uartclk = 1; 1859 1762 1860 1763 if (cfg->uart_flags & UPF_CONS_FLOW) { 1861 - dbg("s3c24xx_serial_init_port: enabling flow control\n"); 1764 + dev_dbg(port->dev, "enabling flow control\n"); 1862 1765 port->flags |= UPF_CONS_FLOW; 1863 1766 } 1864 1767 ··· 1870 1773 return -EINVAL; 1871 1774 } 1872 1775 1873 - dbg("resource %pR)\n", res); 1776 + dev_dbg(port->dev, "resource %pR)\n", res); 1874 1777 1875 1778 port->membase = devm_ioremap(port->dev, res->start, resource_size(res)); 1876 1779 if (!port->membase) { ··· 1932 1835 wr_regl(port, S3C64XX_UINTSP, 0xf); 1933 1836 } 1934 1837 1935 - dbg("port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n", 1936 - &port->mapbase, port->membase, port->irq, 1937 - ourport->rx_irq, ourport->tx_irq, port->uartclk); 1838 + dev_dbg(port->dev, "port: map=%pa, mem=%p, irq=%d (%d,%d), clock=%u\n", 1839 + &port->mapbase, port->membase, port->irq, 1840 + ourport->rx_irq, ourport->tx_irq, port->uartclk); 1938 1841 1939 1842 /* reset the fifos (and setup the uart) */ 1940 1843 s3c24xx_serial_resetport(port, cfg); ··· 1948 1851 1949 1852 /* Device driver serial port probe */ 1950 1853 1854 + #ifdef CONFIG_OF 1951 1855 static const struct of_device_id s3c24xx_uart_dt_match[]; 1856 + #endif 1857 + 1952 1858 static int probe_index; 1953 1859 1954 1860 static inline struct s3c24xx_serial_drv_data *s3c24xx_get_driver_data( ··· 1960 1860 #ifdef CONFIG_OF 1961 1861 if (pdev->dev.of_node) { 1962 1862 const struct of_device_id *match; 1863 + 1963 1864 match = of_match_node(s3c24xx_uart_dt_match, pdev->dev.of_node); 1964 1865 return (struct s3c24xx_serial_drv_data *)match->data; 1965 1866 } ··· 1981 1880 if (ret >= 0) 1982 1881 index = ret; 1983 1882 } 1984 - 1985 - dbg("s3c24xx_serial_probe(%p) %d\n", pdev, index); 1986 1883 1987 1884 if (index >= ARRAY_SIZE(s3c24xx_serial_ports)) { 1988 1885 dev_err(&pdev->dev, "serial%d out of range\n", index); ··· 2008 1909 ourport->port.fifosize = ourport->drv_data->fifosize[index]; 2009 1910 else if (ourport->info->fifosize) 2010 1911 ourport->port.fifosize = ourport->info->fifosize; 1912 + ourport->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SAMSUNG_CONSOLE); 2011 1913 2012 1914 /* 2013 1915 * DMA transfers must be aligned at least to cache line size, ··· 2017 1917 ourport->min_dma_size = max_t(int, ourport->port.fifosize, 2018 1918 dma_get_cache_alignment()); 2019 1919 2020 - dbg("%s: initialising port %p...\n", __func__, ourport); 1920 + dev_dbg(&pdev->dev, "%s: initialising port %p...\n", __func__, ourport); 2021 1921 2022 1922 ret = s3c24xx_serial_init_port(ourport, pdev); 2023 1923 if (ret < 0) ··· 2031 1931 } 2032 1932 } 2033 1933 2034 - dbg("%s: adding port\n", __func__); 1934 + dev_dbg(&pdev->dev, "%s: adding port\n", __func__); 2035 1935 uart_add_one_port(&s3c24xx_uart_drv, &ourport->port); 2036 1936 platform_set_drvdata(pdev, &ourport->port); 2037 1937 ··· 2108 2008 /* restore IRQ mask */ 2109 2009 if (s3c24xx_serial_has_interrupt_mask(port)) { 2110 2010 unsigned int uintm = 0xf; 2111 - if (tx_enabled(port)) 2011 + 2012 + if (ourport->tx_enabled) 2112 2013 uintm &= ~S3C64XX_UINTM_TXD_MSK; 2113 - if (rx_enabled(port)) 2014 + if (ourport->rx_enabled) 2114 2015 uintm &= ~S3C64XX_UINTM_RXD_MSK; 2115 2016 clk_prepare_enable(ourport->clk); 2116 2017 if (!IS_ERR(ourport->baudclk)) ··· 2244 2143 ucon = rd_regl(port, S3C2410_UCON); 2245 2144 ubrdiv = rd_regl(port, S3C2410_UBRDIV); 2246 2145 2247 - dbg("s3c24xx_serial_get_options: port=%p\n" 2248 - "registers: ulcon=%08x, ucon=%08x, ubdriv=%08x\n", 2249 - port, ulcon, ucon, ubrdiv); 2250 - 2251 2146 if (s3c24xx_port_configured(ucon)) { 2252 2147 switch (ulcon & S3C2410_LCON_CSMASK) { 2253 2148 case S3C2410_LCON_CS5: ··· 2287 2190 rate = 1; 2288 2191 2289 2192 *baud = rate / (16 * (ubrdiv + 1)); 2290 - dbg("calculated baud %d\n", *baud); 2193 + dev_dbg(port->dev, "calculated baud %d\n", *baud); 2291 2194 } 2292 2195 2293 2196 } ··· 2300 2203 int bits = 8; 2301 2204 int parity = 'n'; 2302 2205 int flow = 'n'; 2303 - 2304 - dbg("s3c24xx_serial_console_setup: co=%p (%d), %s\n", 2305 - co, co->index, options); 2306 2206 2307 2207 /* is this a valid port */ 2308 2208 ··· 2315 2221 2316 2222 cons_uart = port; 2317 2223 2318 - dbg("s3c24xx_serial_console_setup: port=%p (%d)\n", port, co->index); 2319 - 2320 2224 /* 2321 2225 * Check whether an invalid uart number has been specified, and 2322 2226 * if so, search for the first available port that does have ··· 2325 2233 else 2326 2234 s3c24xx_serial_get_options(port, &baud, &parity, &bits); 2327 2235 2328 - dbg("s3c24xx_serial_console_setup: baud %d\n", baud); 2236 + dev_dbg(port->dev, "baud %d\n", baud); 2329 2237 2330 2238 return uart_set_options(port, co, baud, parity, bits, flow); 2331 2239 } ··· 2615 2523 writeb(c, port->membase + S3C2410_UTXH); 2616 2524 } 2617 2525 2618 - static void samsung_early_write(struct console *con, const char *s, unsigned n) 2526 + static void samsung_early_write(struct console *con, const char *s, 2527 + unsigned int n) 2619 2528 { 2620 2529 struct earlycon_device *dev = con->data; 2621 2530 ··· 2665 2572 OF_EARLYCON_DECLARE(s3c6400, "samsung,s3c6400-uart", 2666 2573 s3c2440_early_console_setup); 2667 2574 2668 - /* S5PV210, EXYNOS */ 2575 + /* S5PV210, Exynos */ 2669 2576 static struct samsung_early_console_data s5pv210_early_console_data = { 2670 2577 .txfull_mask = S5PV210_UFSTAT_TXFULL, 2671 2578 };
+1 -4
drivers/tty/serial/sb1250-duart.c
··· 15 15 * "BCM1250/BCM1125/BCM1125H User Manual", Broadcom Corporation 16 16 */ 17 17 18 - #if defined(CONFIG_SERIAL_SB1250_DUART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 19 - #define SUPPORT_SYSRQ 20 - #endif 21 - 22 18 #include <linux/compiler.h> 23 19 #include <linux/console.h> 24 20 #include <linux/delay.h> ··· 809 813 uport->ops = &sbd_ops; 810 814 uport->line = line; 811 815 uport->mapbase = SBD_CHANREGS(line); 816 + uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_SB1250_DUART_CONSOLE); 812 817 } 813 818 } 814 819 }
+1 -4
drivers/tty/serial/sccnxp.c
··· 7 7 * Based on sc26xx.c, by Thomas Bogendörfer (tsbogend@alpha.franken.de) 8 8 */ 9 9 10 - #if defined(CONFIG_SERIAL_SCCNXP_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 11 - #define SUPPORT_SYSRQ 12 - #endif 13 - 14 10 #include <linux/clk.h> 15 11 #include <linux/delay.h> 16 12 #include <linux/err.h> ··· 996 1000 s->port[i].regshift = s->pdata.reg_shift; 997 1001 s->port[i].uartclk = uartclk; 998 1002 s->port[i].ops = &sccnxp_ops; 1003 + s->port[i].has_sysrq = IS_ENABLED(CONFIG_SERIAL_SCCNXP_CONSOLE); 999 1004 uart_add_one_port(&s->uart, &s->port[i]); 1000 1005 /* Set direction to input */ 1001 1006 if (s->chip->flags & SCCNXP_HAVE_IO)
+55 -39
drivers/tty/serial/serial-tegra.c
··· 141 141 int configured_rate; 142 142 bool use_rx_pio; 143 143 bool use_tx_pio; 144 + bool rx_dma_active; 144 145 }; 145 146 146 147 static void tegra_uart_start_next_tx(struct tegra_uart_port *tup); ··· 534 533 struct circ_buf *xmit = &tup->uport.state->xmit; 535 534 dma_addr_t tx_phys_addr; 536 535 537 - dma_sync_single_for_device(tup->uport.dev, tup->tx_dma_buf_phys, 538 - UART_XMIT_SIZE, DMA_TO_DEVICE); 539 - 540 536 tup->tx_bytes = count & ~(0xF); 541 537 tx_phys_addr = tup->tx_dma_buf_phys + xmit->tail; 538 + 539 + dma_sync_single_for_device(tup->uport.dev, tx_phys_addr, 540 + tup->tx_bytes, DMA_TO_DEVICE); 541 + 542 542 tup->tx_dma_desc = dmaengine_prep_slave_single(tup->tx_dma_chan, 543 543 tx_phys_addr, tup->tx_bytes, DMA_MEM_TO_DEV, 544 544 DMA_PREP_INTERRUPT); ··· 681 679 return; 682 680 683 681 dma_sync_single_for_cpu(tup->uport.dev, tup->rx_dma_buf_phys, 684 - TEGRA_UART_RX_DMA_BUFFER_SIZE, DMA_FROM_DEVICE); 682 + count, DMA_FROM_DEVICE); 685 683 copied = tty_insert_flip_string(tty, 686 684 ((unsigned char *)(tup->rx_dma_buf_virt)), count); 687 685 if (copied != count) { ··· 689 687 dev_err(tup->uport.dev, "RxData copy to tty layer failed\n"); 690 688 } 691 689 dma_sync_single_for_device(tup->uport.dev, tup->rx_dma_buf_phys, 692 - TEGRA_UART_RX_DMA_BUFFER_SIZE, DMA_TO_DEVICE); 690 + count, DMA_TO_DEVICE); 693 691 } 694 692 695 693 static void tegra_uart_rx_buffer_push(struct tegra_uart_port *tup, ··· 733 731 if (tup->rts_active) 734 732 set_rts(tup, false); 735 733 734 + tup->rx_dma_active = false; 736 735 tegra_uart_rx_buffer_push(tup, 0); 737 736 tegra_uart_start_rx_dma(tup); 738 737 ··· 745 742 spin_unlock_irqrestore(&u->lock, flags); 746 743 } 747 744 748 - static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup) 745 + static void tegra_uart_terminate_rx_dma(struct tegra_uart_port *tup) 749 746 { 750 747 struct dma_tx_state state; 751 748 749 + if (!tup->rx_dma_active) 750 + return; 751 + 752 + dmaengine_terminate_all(tup->rx_dma_chan); 753 + dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state); 754 + 755 + tegra_uart_rx_buffer_push(tup, state.residue); 756 + tup->rx_dma_active = false; 757 + } 758 + 759 + static void tegra_uart_handle_rx_dma(struct tegra_uart_port *tup) 760 + { 752 761 /* Deactivate flow control to stop sender */ 753 762 if (tup->rts_active) 754 763 set_rts(tup, false); 755 764 756 - dmaengine_terminate_all(tup->rx_dma_chan); 757 - dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state); 758 - tegra_uart_rx_buffer_push(tup, state.residue); 759 - tegra_uart_start_rx_dma(tup); 765 + tegra_uart_terminate_rx_dma(tup); 760 766 761 767 if (tup->rts_active) 762 768 set_rts(tup, true); ··· 775 763 { 776 764 unsigned int count = TEGRA_UART_RX_DMA_BUFFER_SIZE; 777 765 766 + if (tup->rx_dma_active) 767 + return 0; 768 + 778 769 tup->rx_dma_desc = dmaengine_prep_slave_single(tup->rx_dma_chan, 779 770 tup->rx_dma_buf_phys, count, DMA_DEV_TO_MEM, 780 771 DMA_PREP_INTERRUPT); ··· 786 771 return -EIO; 787 772 } 788 773 774 + tup->rx_dma_active = true; 789 775 tup->rx_dma_desc->callback = tegra_uart_rx_dma_complete; 790 776 tup->rx_dma_desc->callback_param = tup; 791 - dma_sync_single_for_device(tup->uport.dev, tup->rx_dma_buf_phys, 792 - count, DMA_TO_DEVICE); 793 777 tup->rx_bytes_requested = count; 794 778 tup->rx_cookie = dmaengine_submit(tup->rx_dma_desc); 795 779 dma_async_issue_pending(tup->rx_dma_chan); ··· 834 820 struct uart_port *u = &tup->uport; 835 821 unsigned long iir; 836 822 unsigned long ier; 823 + bool is_rx_start = false; 837 824 bool is_rx_int = false; 838 825 unsigned long flags; 839 826 ··· 847 832 if (tup->rx_in_progress) { 848 833 ier = tup->ier_shadow; 849 834 ier |= (UART_IER_RLSI | UART_IER_RTOIE | 850 - TEGRA_UART_IER_EORD); 835 + TEGRA_UART_IER_EORD | UART_IER_RDI); 851 836 tup->ier_shadow = ier; 852 837 tegra_uart_write(tup, ier, UART_IER); 853 838 } 839 + } else if (is_rx_start) { 840 + tegra_uart_start_rx_dma(tup); 854 841 } 855 842 spin_unlock_irqrestore(&u->lock, flags); 856 843 return IRQ_HANDLED; ··· 871 854 872 855 case 4: /* End of data */ 873 856 case 6: /* Rx timeout */ 874 - case 2: /* Receive */ 875 - if (!tup->use_rx_pio && !is_rx_int) { 876 - is_rx_int = true; 857 + if (!tup->use_rx_pio) { 858 + is_rx_int = tup->rx_in_progress; 877 859 /* Disable Rx interrupts */ 878 860 ier = tup->ier_shadow; 879 - ier |= UART_IER_RDI; 880 - tegra_uart_write(tup, ier, UART_IER); 881 861 ier &= ~(UART_IER_RDI | UART_IER_RLSI | 882 862 UART_IER_RTOIE | TEGRA_UART_IER_EORD); 883 863 tup->ier_shadow = ier; 884 864 tegra_uart_write(tup, ier, UART_IER); 865 + break; 866 + } 867 + /* Fall through */ 868 + case 2: /* Receive */ 869 + if (!tup->use_rx_pio) { 870 + is_rx_start = tup->rx_in_progress; 871 + tup->ier_shadow &= ~UART_IER_RDI; 872 + tegra_uart_write(tup, tup->ier_shadow, 873 + UART_IER); 885 874 } else { 886 875 do_handle_rx_pio(tup); 887 876 } ··· 909 886 { 910 887 struct tegra_uart_port *tup = to_tegra_uport(u); 911 888 struct tty_port *port = &tup->uport.state->port; 912 - struct dma_tx_state state; 913 889 unsigned long ier; 914 890 915 891 if (tup->rts_active) ··· 925 903 tup->ier_shadow = ier; 926 904 tegra_uart_write(tup, ier, UART_IER); 927 905 tup->rx_in_progress = 0; 928 - if (tup->rx_dma_chan && !tup->use_rx_pio) { 929 - dmaengine_terminate_all(tup->rx_dma_chan); 930 - dmaengine_tx_status(tup->rx_dma_chan, tup->rx_cookie, &state); 931 - tegra_uart_rx_buffer_push(tup, state.residue); 932 - } else { 906 + 907 + if (!tup->use_rx_pio) 908 + tegra_uart_terminate_rx_dma(tup); 909 + else 933 910 tegra_uart_handle_rx_pio(tup, port); 934 - } 935 911 } 936 912 937 913 static void tegra_uart_hw_deinit(struct tegra_uart_port *tup) ··· 1072 1052 tup->lcr_shadow = TEGRA_UART_DEFAULT_LSR; 1073 1053 tup->fcr_shadow |= UART_FCR_DMA_SELECT; 1074 1054 tegra_uart_write(tup, tup->fcr_shadow, UART_FCR); 1075 - 1076 - ret = tegra_uart_start_rx_dma(tup); 1077 - if (ret < 0) { 1078 - dev_err(tup->uport.dev, "Not able to start Rx DMA\n"); 1079 - return ret; 1080 - } 1081 1055 } else { 1082 1056 tegra_uart_write(tup, tup->fcr_shadow, UART_FCR); 1083 1057 } ··· 1080 1066 /* 1081 1067 * Enable IE_RXS for the receive status interrupts like line errros. 1082 1068 * Enable IE_RX_TIMEOUT to get the bytes which cannot be DMA'd. 1083 - * 1084 - * If using DMA mode, enable EORD instead of receive interrupt which 1085 - * will interrupt after the UART is done with the receive instead of 1086 - * the interrupt when the FIFO "threshold" is reached. 1087 1069 * 1088 1070 * EORD is different interrupt than RX_TIMEOUT - RX_TIMEOUT occurs when 1089 1071 * the DATA is sitting in the FIFO and couldn't be transferred to the ··· 1091 1081 * both the EORD as well as RX_TIMEOUT - SW sees RX_TIMEOUT first 1092 1082 * then the EORD. 1093 1083 */ 1084 + tup->ier_shadow = UART_IER_RLSI | UART_IER_RTOIE | UART_IER_RDI; 1085 + 1086 + /* 1087 + * If using DMA mode, enable EORD interrupt to notify about RX 1088 + * completion. 1089 + */ 1094 1090 if (!tup->use_rx_pio) 1095 - tup->ier_shadow = UART_IER_RLSI | UART_IER_RTOIE | 1096 - TEGRA_UART_IER_EORD; 1097 - else 1098 - tup->ier_shadow = UART_IER_RLSI | UART_IER_RTOIE | UART_IER_RDI; 1091 + tup->ier_shadow |= TEGRA_UART_IER_EORD; 1099 1092 1100 1093 tegra_uart_write(tup, tup->ier_shadow, UART_IER); 1101 1094 return 0; ··· 1153 1140 dma_release_channel(dma_chan); 1154 1141 return -ENOMEM; 1155 1142 } 1143 + dma_sync_single_for_device(tup->uport.dev, dma_phys, 1144 + TEGRA_UART_RX_DMA_BUFFER_SIZE, 1145 + DMA_TO_DEVICE); 1156 1146 dma_sconfig.src_addr = tup->uport.mapbase; 1157 1147 dma_sconfig.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; 1158 1148 dma_sconfig.src_maxburst = tup->cdata->max_dma_burst_bytes;
+84
drivers/tty/serial/serial_core.c
··· 2603 2603 *index = co->index; 2604 2604 return p->tty_driver; 2605 2605 } 2606 + EXPORT_SYMBOL_GPL(uart_console_device); 2606 2607 2607 2608 static ssize_t uart_get_attr_uartclk(struct device *dev, 2608 2609 struct device_attribute *attr, char *buf) ··· 3081 3080 ++port->icount.buf_overrun; 3082 3081 } 3083 3082 EXPORT_SYMBOL_GPL(uart_insert_char); 3083 + 3084 + int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) 3085 + { 3086 + if (!IS_ENABLED(CONFIG_MAGIC_SYSRQ_SERIAL)) 3087 + return 0; 3088 + 3089 + if (!port->has_sysrq || !port->sysrq) 3090 + return 0; 3091 + 3092 + if (ch && time_before(jiffies, port->sysrq)) { 3093 + handle_sysrq(ch); 3094 + port->sysrq = 0; 3095 + return 1; 3096 + } 3097 + port->sysrq = 0; 3098 + 3099 + return 0; 3100 + } 3101 + EXPORT_SYMBOL_GPL(uart_handle_sysrq_char); 3102 + 3103 + int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) 3104 + { 3105 + if (!IS_ENABLED(CONFIG_MAGIC_SYSRQ_SERIAL)) 3106 + return 0; 3107 + 3108 + if (!port->has_sysrq || !port->sysrq) 3109 + return 0; 3110 + 3111 + if (ch && time_before(jiffies, port->sysrq)) { 3112 + port->sysrq_ch = ch; 3113 + port->sysrq = 0; 3114 + return 1; 3115 + } 3116 + port->sysrq = 0; 3117 + 3118 + return 0; 3119 + } 3120 + EXPORT_SYMBOL_GPL(uart_prepare_sysrq_char); 3121 + 3122 + void uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) 3123 + { 3124 + int sysrq_ch; 3125 + 3126 + if (!port->has_sysrq) { 3127 + spin_unlock_irqrestore(&port->lock, irqflags); 3128 + return; 3129 + } 3130 + 3131 + sysrq_ch = port->sysrq_ch; 3132 + port->sysrq_ch = 0; 3133 + 3134 + spin_unlock_irqrestore(&port->lock, irqflags); 3135 + 3136 + if (sysrq_ch) 3137 + handle_sysrq(sysrq_ch); 3138 + } 3139 + EXPORT_SYMBOL_GPL(uart_unlock_and_check_sysrq); 3140 + 3141 + /* 3142 + * We do the SysRQ and SAK checking like this... 3143 + */ 3144 + int uart_handle_break(struct uart_port *port) 3145 + { 3146 + struct uart_state *state = port->state; 3147 + 3148 + if (port->handle_break) 3149 + port->handle_break(port); 3150 + 3151 + if (port->has_sysrq) { 3152 + if (port->cons && port->cons->index == port->line) { 3153 + if (!port->sysrq) { 3154 + port->sysrq = jiffies + HZ*5; 3155 + return 1; 3156 + } 3157 + port->sysrq = 0; 3158 + } 3159 + } 3160 + 3161 + if (port->flags & UPF_SAK) 3162 + do_SAK(state->port.tty); 3163 + return 0; 3164 + } 3165 + EXPORT_SYMBOL_GPL(uart_handle_break); 3084 3166 3085 3167 EXPORT_SYMBOL(uart_write_wakeup); 3086 3168 EXPORT_SYMBOL(uart_register_driver);
+1 -4
drivers/tty/serial/serial_txx9.c
··· 12 12 * Serial driver for TX3927/TX4927/TX4925/TX4938 internal SIO controller 13 13 */ 14 14 15 - #if defined(CONFIG_SERIAL_TXX9_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 16 - #define SUPPORT_SYSRQ 17 - #endif 18 - 19 15 #include <linux/module.h> 20 16 #include <linux/ioport.h> 21 17 #include <linux/init.h> ··· 1091 1095 port.flags = p->flags; 1092 1096 port.mapbase = p->mapbase; 1093 1097 port.dev = &dev->dev; 1098 + port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_TXX9_CONSOLE); 1094 1099 ret = serial_txx9_register_port(&port); 1095 1100 if (ret < 0) { 1096 1101 dev_err(&dev->dev, "unable to register port at index %d "
+2 -8
drivers/tty/serial/sh-sci.c
··· 15 15 * Modified to support SH7300 SCIF. Takashi Kusuda (Jun 2003). 16 16 * Removed SH7300 support (Jul 2007). 17 17 */ 18 - #if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 19 - #define SUPPORT_SYSRQ 20 - #endif 21 - 22 18 #undef DEBUG 23 19 24 20 #include <linux/clk.h> ··· 2883 2887 port->ops = &sci_uart_ops; 2884 2888 port->iotype = UPIO_MEM; 2885 2889 port->line = index; 2890 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_SH_SCI_CONSOLE); 2886 2891 2887 2892 res = platform_get_resource(dev, IORESOURCE_MEM, 0); 2888 2893 if (res == NULL) ··· 3012 3015 unsigned long flags; 3013 3016 int locked = 1; 3014 3017 3015 - #if defined(SUPPORT_SYSRQ) 3016 3018 if (port->sysrq) 3017 3019 locked = 0; 3018 - else 3019 - #endif 3020 - if (oops_in_progress) 3020 + else if (oops_in_progress) 3021 3021 locked = spin_trylock_irqsave(&port->lock, flags); 3022 3022 else 3023 3023 spin_lock_irqsave(&port->lock, flags);
+1 -4
drivers/tty/serial/sprd_serial.c
··· 3 3 * Copyright (C) 2012-2015 Spreadtrum Communications Inc. 4 4 */ 5 5 6 - #if defined(CONFIG_SERIAL_SPRD_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 7 - #define SUPPORT_SYSRQ 8 - #endif 9 - 10 6 #include <linux/clk.h> 11 7 #include <linux/console.h> 12 8 #include <linux/delay.h> ··· 1226 1230 up->fifosize = SPRD_FIFO_SIZE; 1227 1231 up->ops = &serial_sprd_ops; 1228 1232 up->flags = UPF_BOOT_AUTOCONF; 1233 + up->has_sysrq = IS_ENABLED(CONFIG_SERIAL_SPRD_CONSOLE); 1229 1234 1230 1235 ret = sprd_clk_init(up); 1231 1236 if (ret)
+6 -11
drivers/tty/serial/st-asc.c
··· 5 5 * Copyright (C) 2003-2013 STMicroelectronics (R&D) Limited 6 6 */ 7 7 8 - #if defined(CONFIG_SERIAL_ST_ASC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 9 - #define SUPPORT_SYSRQ 10 - #endif 11 - 12 8 #include <linux/module.h> 13 9 #include <linux/serial.h> 14 10 #include <linux/console.h> ··· 504 508 struct ktermios *old) 505 509 { 506 510 struct asc_port *ascport = to_asc_port(port); 507 - struct device_node *np = port->dev->of_node; 508 511 struct gpio_desc *gpiod; 509 512 unsigned int baud; 510 513 u32 ctrl_val; ··· 565 570 pinctrl_select_state(ascport->pinctrl, 566 571 ascport->states[NO_HW_FLOWCTRL]); 567 572 568 - gpiod = devm_fwnode_get_gpiod_from_child(port->dev, 569 - "rts", 570 - &np->fwnode, 571 - GPIOD_OUT_LOW, 572 - np->name); 573 - if (!IS_ERR(gpiod)) 573 + gpiod = devm_gpiod_get(port->dev, "rts", GPIOD_OUT_LOW); 574 + if (!IS_ERR(gpiod)) { 575 + gpiod_set_consumer_name(gpiod, 576 + port->dev->of_node->name); 574 577 ascport->rts = gpiod; 578 + } 575 579 } 576 580 } 577 581 ··· 724 730 port->fifosize = ASC_FIFO_SIZE; 725 731 port->dev = &pdev->dev; 726 732 port->irq = platform_get_irq(pdev, 0); 733 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ST_ASC_CONSOLE); 727 734 728 735 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 729 736 port->membase = devm_ioremap_resource(&pdev->dev, res);
+1 -4
drivers/tty/serial/stm32-usart.c
··· 8 8 * Inspired by st-asc.c from STMicroelectronics (c) 9 9 */ 10 10 11 - #if defined(CONFIG_SERIAL_STM32_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 12 - #define SUPPORT_SYSRQ 13 - #endif 14 - 15 11 #include <linux/clk.h> 16 12 #include <linux/console.h> 17 13 #include <linux/delay.h> ··· 922 926 port->ops = &stm32_uart_ops; 923 927 port->dev = &pdev->dev; 924 928 port->fifosize = stm32port->info->cfg.fifosize; 929 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_STM32_CONSOLE); 925 930 926 931 ret = platform_get_irq(pdev, 0); 927 932 if (ret <= 0)
+1 -4
drivers/tty/serial/sunhv.c
··· 25 25 #include <asm/irq.h> 26 26 #include <asm/setup.h> 27 27 28 - #if defined(CONFIG_MAGIC_SYSRQ) 29 - #define SUPPORT_SYSRQ 30 - #endif 31 - 32 28 #include <linux/serial_core.h> 33 29 #include <linux/sunserialcore.h> 34 30 ··· 548 552 549 553 sunhv_port = port; 550 554 555 + port->has_sysrq = 1; 551 556 port->line = 0; 552 557 port->ops = &sunhv_pops; 553 558 port->type = PORT_SUNHV;
+1 -4
drivers/tty/serial/sunsab.c
··· 40 40 #include <asm/prom.h> 41 41 #include <asm/setup.h> 42 42 43 - #if defined(CONFIG_SERIAL_SUNSAB_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 44 - #define SUPPORT_SYSRQ 45 - #endif 46 - 47 43 #include <linux/serial_core.h> 48 44 #include <linux/sunserialcore.h> 49 45 ··· 981 985 982 986 up->port.fifosize = SAB82532_XMIT_FIFO_SIZE; 983 987 up->port.iotype = UPIO_MEM; 988 + up->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNSAB_CONSOLE); 984 989 985 990 writeb(SAB82532_IPC_IC_ACT_LOW, &up->regs->w.ipc); 986 991
+1 -4
drivers/tty/serial/sunsu.c
··· 44 44 #include <asm/prom.h> 45 45 #include <asm/setup.h> 46 46 47 - #if defined(CONFIG_SERIAL_SUNSU_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 48 - #define SUPPORT_SYSRQ 49 - #endif 50 - 51 47 #include <linux/serial_core.h> 52 48 #include <linux/sunserialcore.h> 53 49 ··· 1471 1475 1472 1476 up->port.type = PORT_UNKNOWN; 1473 1477 up->port.uartclk = (SU_BASE_BAUD * 16); 1478 + up->port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNSU_CONSOLE); 1474 1479 1475 1480 err = 0; 1476 1481 if (up->su_type == SU_PORT_KBD || up->su_type == SU_PORT_MS) {
+2 -4
drivers/tty/serial/sunzilog.c
··· 40 40 #include <asm/prom.h> 41 41 #include <asm/setup.h> 42 42 43 - #if defined(CONFIG_SERIAL_SUNZILOG_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 44 - #define SUPPORT_SYSRQ 45 - #endif 46 - 47 43 #include <linux/serial_core.h> 48 44 #include <linux/sunserialcore.h> 49 45 ··· 1440 1444 up[0].port.line = (inst * 2) + 0; 1441 1445 up[0].port.dev = &op->dev; 1442 1446 up[0].flags |= SUNZILOG_FLAG_IS_CHANNEL_A; 1447 + up[0].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNZILOG_CONSOLE); 1443 1448 if (keyboard_mouse) 1444 1449 up[0].flags |= SUNZILOG_FLAG_CONS_KEYB; 1445 1450 sunzilog_init_hw(&up[0]); ··· 1458 1461 up[1].port.line = (inst * 2) + 1; 1459 1462 up[1].port.dev = &op->dev; 1460 1463 up[1].flags |= 0; 1464 + up[1].port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_SUNZILOG_CONSOLE); 1461 1465 if (keyboard_mouse) 1462 1466 up[1].flags |= SUNZILOG_FLAG_CONS_MOUSE; 1463 1467 sunzilog_init_hw(&up[1]);
-4
drivers/tty/serial/ucc_uart.c
··· 332 332 struct uart_port *port = &qe_port->port; 333 333 struct circ_buf *xmit = &port->state->xmit; 334 334 335 - bdp = qe_port->rx_cur; 336 - 337 335 /* Handle xon/xoff */ 338 336 if (port->x_char) { 339 337 /* Pick next descriptor and fill from buffer */ ··· 549 551 /* Overrun does not affect the current character ! */ 550 552 if (status & BD_SC_OV) 551 553 tty_insert_flip_char(tport, 0, TTY_OVERRUN); 552 - #ifdef SUPPORT_SYSRQ 553 554 port->sysrq = 0; 554 - #endif 555 555 goto error_return; 556 556 } 557 557
+1 -4
drivers/tty/serial/vr41xx_siu.c
··· 7 7 * Based on drivers/serial/8250.c, by Russell King. 8 8 */ 9 9 10 - #if defined(CONFIG_SERIAL_VR41XX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 11 - #define SUPPORT_SYSRQ 12 - #endif 13 - 14 10 #include <linux/console.h> 15 11 #include <linux/errno.h> 16 12 #include <linux/init.h> ··· 865 869 port = &siu_uart_ports[i]; 866 870 port->ops = &siu_uart_ops; 867 871 port->dev = &dev->dev; 872 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_VR41XX_CONSOLE); 868 873 869 874 retval = uart_add_one_port(&siu_uart_driver, port); 870 875 if (retval < 0) {
+1 -4
drivers/tty/serial/vt8500_serial.c
··· 7 7 * Author: Robert Love <rlove@google.com> 8 8 */ 9 9 10 - #if defined(CONFIG_SERIAL_VT8500_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 11 - # define SUPPORT_SYSRQ 12 - #endif 13 - 14 10 #include <linux/hrtimer.h> 15 11 #include <linux/delay.h> 16 12 #include <linux/io.h> ··· 699 703 vt8500_port->uart.line = port; 700 704 vt8500_port->uart.dev = &pdev->dev; 701 705 vt8500_port->uart.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; 706 + vt8500_port->uart.has_sysrq = IS_ENABLED(CONFIG_SERIAL_VT8500_CONSOLE); 702 707 703 708 /* Serial core uses the magic "16" everywhere - adjust for it */ 704 709 vt8500_port->uart.uartclk = 16 * clk_get_rate(vt8500_port->clk) /
+38 -11
drivers/tty/serial/xilinx_uartps.c
··· 9 9 * in the code. 10 10 */ 11 11 12 - #if defined(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 13 - #define SUPPORT_SYSRQ 14 - #endif 15 - 16 12 #include <linux/platform_device.h> 17 13 #include <linux/serial.h> 18 14 #include <linux/console.h> ··· 152 156 #define CDNS_UART_MODEMCR_FCM 0x00000020 /* Automatic flow control mode */ 153 157 #define CDNS_UART_MODEMCR_RTS 0x00000002 /* Request to send output control */ 154 158 #define CDNS_UART_MODEMCR_DTR 0x00000001 /* Data Terminal Ready */ 159 + 160 + /* 161 + * Modem Status register: 162 + * The read/write Modem Status register reports the interface with the modem 163 + * or data set, or a peripheral device emulating a modem. 164 + */ 165 + #define CDNS_UART_MODEMSR_DCD BIT(7) /* Data Carrier Detect */ 166 + #define CDNS_UART_MODEMSR_RI BIT(6) /* Ting Indicator */ 167 + #define CDNS_UART_MODEMSR_DSR BIT(5) /* Data Set Ready */ 168 + #define CDNS_UART_MODEMSR_CTS BIT(4) /* Clear To Send */ 155 169 156 170 /* 157 171 * Channel Status Register: ··· 690 684 static void cdns_uart_set_termios(struct uart_port *port, 691 685 struct ktermios *termios, struct ktermios *old) 692 686 { 693 - unsigned int cval = 0; 687 + u32 cval = 0; 694 688 unsigned int baud, minbaud, maxbaud; 695 689 unsigned long flags; 696 690 unsigned int ctrl_reg, mode_reg, val; ··· 810 804 } 811 805 cval |= mode_reg & 1; 812 806 writel(cval, port->membase + CDNS_UART_MR); 807 + 808 + cval = readl(port->membase + CDNS_UART_MODEMCR); 809 + if (termios->c_cflag & CRTSCTS) 810 + cval |= CDNS_UART_MODEMCR_FCM; 811 + else 812 + cval &= ~CDNS_UART_MODEMCR_FCM; 813 + writel(cval, port->membase + CDNS_UART_MODEMCR); 813 814 814 815 spin_unlock_irqrestore(&port->lock, flags); 815 816 } ··· 1020 1007 */ 1021 1008 static unsigned int cdns_uart_get_mctrl(struct uart_port *port) 1022 1009 { 1010 + u32 val; 1011 + unsigned int mctrl = 0; 1023 1012 struct cdns_uart *cdns_uart_data = port->private_data; 1024 1013 1025 1014 if (cdns_uart_data->cts_override) 1026 - return 0; 1015 + return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; 1027 1016 1028 - return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; 1017 + val = readl(port->membase + CDNS_UART_MODEMSR); 1018 + if (val & CDNS_UART_MODEMSR_CTS) 1019 + mctrl |= TIOCM_CTS; 1020 + if (val & CDNS_UART_MODEMSR_DSR) 1021 + mctrl |= TIOCM_DSR; 1022 + if (val & CDNS_UART_MODEMSR_RI) 1023 + mctrl |= TIOCM_RNG; 1024 + if (val & CDNS_UART_MODEMSR_DCD) 1025 + mctrl |= TIOCM_CAR; 1026 + 1027 + return mctrl; 1029 1028 } 1030 1029 1031 1030 static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) ··· 1052 1027 val = readl(port->membase + CDNS_UART_MODEMCR); 1053 1028 mode_reg = readl(port->membase + CDNS_UART_MR); 1054 1029 1055 - val &= ~(CDNS_UART_MODEMCR_RTS | CDNS_UART_MODEMCR_DTR | 1056 - CDNS_UART_MODEMCR_FCM); 1030 + val &= ~(CDNS_UART_MODEMCR_RTS | CDNS_UART_MODEMCR_DTR); 1057 1031 mode_reg &= ~CDNS_UART_MR_CHMODE_MASK; 1058 1032 1059 - if (mctrl & TIOCM_RTS || mctrl & TIOCM_DTR) 1060 - val |= CDNS_UART_MODEMCR_FCM; 1033 + if (mctrl & TIOCM_RTS) 1034 + val |= CDNS_UART_MODEMCR_RTS; 1035 + if (mctrl & TIOCM_DTR) 1036 + val |= CDNS_UART_MODEMCR_DTR; 1061 1037 if (mctrl & TIOCM_LOOP) 1062 1038 mode_reg |= CDNS_UART_MR_CHMODE_L_LOOP; 1063 1039 else ··· 1660 1634 port->flags = UPF_BOOT_AUTOCONF; 1661 1635 port->ops = &cdns_uart_ops; 1662 1636 port->fifosize = CDNS_UART_FIFO_SIZE; 1637 + port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_XILINX_PS_UART_CONSOLE); 1663 1638 1664 1639 /* 1665 1640 * Register the port.
+1 -4
drivers/tty/serial/zs.c
··· 44 44 * complicated and prevents the use of some automatic modes of operation. 45 45 */ 46 46 47 - #if defined(CONFIG_SERIAL_ZS_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) 48 - #define SUPPORT_SYSRQ 49 - #endif 50 - 51 47 #include <linux/bug.h> 52 48 #include <linux/console.h> 53 49 #include <linux/delay.h> ··· 1102 1106 zport->scc = &zs_sccs[chip]; 1103 1107 zport->clk_mode = 16; 1104 1108 1109 + uport->has_sysrq = IS_ENABLED(CONFIG_SERIAL_ZS_CONSOLE); 1105 1110 uport->irq = zs_parms.irq[chip]; 1106 1111 uport->uartclk = ZS_CLOCK; 1107 1112 uport->fifosize = 1;
+12 -12
drivers/tty/synclinkmp.c
··· 1453 1453 if (I_IXOFF(tty)) 1454 1454 send_xchar(tty, STOP_CHAR(tty)); 1455 1455 1456 - if (C_CRTSCTS(tty)) { 1456 + if (C_CRTSCTS(tty)) { 1457 1457 spin_lock_irqsave(&info->lock,flags); 1458 1458 info->serial_signals &= ~SerialSignal_RTS; 1459 - set_signals(info); 1459 + set_signals(info); 1460 1460 spin_unlock_irqrestore(&info->lock,flags); 1461 1461 } 1462 1462 } ··· 1482 1482 send_xchar(tty, START_CHAR(tty)); 1483 1483 } 1484 1484 1485 - if (C_CRTSCTS(tty)) { 1485 + if (C_CRTSCTS(tty)) { 1486 1486 spin_lock_irqsave(&info->lock,flags); 1487 1487 info->serial_signals |= SerialSignal_RTS; 1488 - set_signals(info); 1488 + set_signals(info); 1489 1489 spin_unlock_irqrestore(&info->lock,flags); 1490 1490 } 1491 1491 } ··· 2470 2470 if (status & SerialSignal_CTS) { 2471 2471 if ( debug_level >= DEBUG_LEVEL_ISR ) 2472 2472 printk("CTS tx start..."); 2473 - info->port.tty->hw_stopped = 0; 2473 + info->port.tty->hw_stopped = 0; 2474 2474 tx_start(info); 2475 2475 info->pending_bh |= BH_TRANSMIT; 2476 2476 return; ··· 2479 2479 if (!(status & SerialSignal_CTS)) { 2480 2480 if ( debug_level >= DEBUG_LEVEL_ISR ) 2481 2481 printk("CTS tx stop..."); 2482 - info->port.tty->hw_stopped = 1; 2482 + info->port.tty->hw_stopped = 1; 2483 2483 tx_stop(info); 2484 2484 } 2485 2485 } ··· 2806 2806 info->read_status_mask2 = OVRN; 2807 2807 if (I_INPCK(info->port.tty)) 2808 2808 info->read_status_mask2 |= PE | FRME; 2809 - if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) 2810 - info->read_status_mask1 |= BRKD; 2809 + if (I_BRKINT(info->port.tty) || I_PARMRK(info->port.tty)) 2810 + info->read_status_mask1 |= BRKD; 2811 2811 if (I_IGNPAR(info->port.tty)) 2812 2812 info->ignore_status_mask2 |= PE | FRME; 2813 2813 if (I_IGNBRK(info->port.tty)) { ··· 3177 3177 unsigned long flags; 3178 3178 3179 3179 spin_lock_irqsave(&info->lock,flags); 3180 - get_signals(info); 3180 + get_signals(info); 3181 3181 spin_unlock_irqrestore(&info->lock,flags); 3182 3182 3183 3183 result = ((info->serial_signals & SerialSignal_RTS) ? TIOCM_RTS : 0) | ··· 3215 3215 info->serial_signals &= ~SerialSignal_DTR; 3216 3216 3217 3217 spin_lock_irqsave(&info->lock,flags); 3218 - set_signals(info); 3218 + set_signals(info); 3219 3219 spin_unlock_irqrestore(&info->lock,flags); 3220 3220 3221 3221 return 0; ··· 3227 3227 unsigned long flags; 3228 3228 3229 3229 spin_lock_irqsave(&info->lock,flags); 3230 - get_signals(info); 3230 + get_signals(info); 3231 3231 spin_unlock_irqrestore(&info->lock,flags); 3232 3232 3233 3233 return (info->serial_signals & SerialSignal_DCD) ? 1 : 0; ··· 3243 3243 info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR; 3244 3244 else 3245 3245 info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR); 3246 - set_signals(info); 3246 + set_signals(info); 3247 3247 spin_unlock_irqrestore(&info->lock,flags); 3248 3248 } 3249 3249
+1 -8
drivers/tty/sysrq.c
··· 967 967 .id_table = sysrq_ids, 968 968 }; 969 969 970 - static bool sysrq_handler_registered; 971 - 972 970 static inline void sysrq_register_handler(void) 973 971 { 974 972 int error; ··· 976 978 error = input_register_handler(&sysrq_handler); 977 979 if (error) 978 980 pr_err("Failed to register input handler, error %d", error); 979 - else 980 - sysrq_handler_registered = true; 981 981 } 982 982 983 983 static inline void sysrq_unregister_handler(void) 984 984 { 985 - if (sysrq_handler_registered) { 986 - input_unregister_handler(&sysrq_handler); 987 - sysrq_handler_registered = false; 988 - } 985 + input_unregister_handler(&sysrq_handler); 989 986 } 990 987 991 988 static int sysrq_reset_seq_param_set(const char *buffer,
+12 -16
drivers/tty/tty_baudrate.c
··· 17 17 * include/asm/termbits.h file. 18 18 */ 19 19 static const speed_t baud_table[] = { 20 - 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 21 - 9600, 19200, 38400, 57600, 115200, 230400, 460800, 20 + 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 21 + 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 22 22 #ifdef __sparc__ 23 - 76800, 153600, 307200, 614400, 921600 23 + 76800, 153600, 307200, 614400, 921600, 500000, 576000, 24 + 1000000, 1152000, 1500000, 2000000 24 25 #else 25 26 500000, 576000, 921600, 1000000, 1152000, 1500000, 2000000, 26 27 2500000, 3000000, 3500000, 4000000 27 28 #endif 28 29 }; 29 30 30 - #ifndef __sparc__ 31 31 static const tcflag_t baud_bits[] = { 32 - B0, B50, B75, B110, B134, B150, B200, B300, B600, 33 - B1200, B1800, B2400, B4800, B9600, B19200, B38400, 34 - B57600, B115200, B230400, B460800, B500000, B576000, 35 - B921600, B1000000, B1152000, B1500000, B2000000, B2500000, 36 - B3000000, B3500000, B4000000 37 - }; 32 + B0, B50, B75, B110, B134, B150, B200, B300, B600, B1200, B1800, B2400, 33 + B4800, B9600, B19200, B38400, B57600, B115200, B230400, B460800, 34 + #ifdef __sparc__ 35 + B76800, B153600, B307200, B614400, B921600, B500000, B576000, 36 + B1000000, B1152000, B1500000, B2000000 38 37 #else 39 - static const tcflag_t baud_bits[] = { 40 - B0, B50, B75, B110, B134, B150, B200, B300, B600, 41 - B1200, B1800, B2400, B4800, B9600, B19200, B38400, 42 - B57600, B115200, B230400, B460800, B76800, B153600, 43 - B307200, B614400, B921600 44 - }; 38 + B500000, B576000, B921600, B1000000, B1152000, B1500000, B2000000, 39 + B2500000, B3000000, B3500000, B4000000 45 40 #endif 41 + }; 46 42 47 43 static int n_baud_table = ARRAY_SIZE(baud_table); 48 44
+1 -1
drivers/tty/tty_io.c
··· 1893 1893 struct tty_struct *tty_kopen(dev_t device) 1894 1894 { 1895 1895 struct tty_struct *tty; 1896 - struct tty_driver *driver = NULL; 1896 + struct tty_driver *driver; 1897 1897 int index = -1; 1898 1898 1899 1899 mutex_lock(&tty_mutex);
+1
drivers/tty/vt/.gitignore
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 + conmakehash 2 3 consolemap_deftbl.c 3 4 defkeymap.c
+5 -3
drivers/tty/vt/Makefile
··· 12 12 # Files generated that shall be removed upon make clean 13 13 clean-files := consolemap_deftbl.c defkeymap.c 14 14 15 - quiet_cmd_conmk = CONMK $@ 16 - cmd_conmk = scripts/conmakehash $< > $@ 15 + hostprogs-y += conmakehash 17 16 18 - $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) 17 + quiet_cmd_conmk = CONMK $@ 18 + cmd_conmk = $(obj)/conmakehash $< > $@ 19 + 20 + $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash 19 21 $(call cmd,conmk) 20 22 21 23 $(obj)/defkeymap.o: $(obj)/defkeymap.c
+4 -4
drivers/tty/vt/vt.c
··· 3326 3326 3327 3327 console_lock(); 3328 3328 3329 - if (conswitchp) 3330 - display_desc = conswitchp->con_startup(); 3329 + if (!conswitchp) 3330 + conswitchp = &dummy_con; 3331 + display_desc = conswitchp->con_startup(); 3331 3332 if (!display_desc) { 3332 3333 fg_console = 0; 3333 3334 console_unlock(); ··· 3568 3567 3569 3568 3570 3569 #ifdef CONFIG_VT_HW_CONSOLE_BINDING 3571 - /* unlocked version of unbind_con_driver() */ 3572 3570 int do_unbind_con_driver(const struct consw *csw, int first, int last, int deflt) 3573 3571 { 3574 3572 struct module *owner = csw->owner; ··· 4095 4095 * when a driver wants to take over some existing consoles 4096 4096 * and become default driver for newly opened ones. 4097 4097 * 4098 - * do_take_over_console is basically a register followed by unbind 4098 + * do_take_over_console is basically a register followed by bind 4099 4099 */ 4100 4100 int do_take_over_console(const struct consw *csw, int first, int last, int deflt) 4101 4101 {
-1
drivers/video/console/Kconfig
··· 93 93 94 94 config DUMMY_CONSOLE 95 95 bool 96 - depends on VGA_CONSOLE!=y || SGI_NEWPORT_CONSOLE!=y 97 96 default y 98 97 99 98 config DUMMY_CONSOLE_COLUMNS
+1
include/linux/serial_8250.h
··· 25 25 unsigned char regshift; /* register shift */ 26 26 unsigned char iotype; /* UPIO_* */ 27 27 unsigned char hub6; 28 + unsigned char has_sysrq; /* supports magic SysRq */ 28 29 upf_t flags; /* UPF_* flags */ 29 30 unsigned int type; /* If UPF_FIXED_TYPE */ 30 31 unsigned int (*serial_in)(struct uart_port *, int);
+10 -81
include/linux/serial_core.h
··· 161 161 struct uart_icount icount; /* statistics */ 162 162 163 163 struct console *cons; /* struct console, if any */ 164 - #if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(SUPPORT_SYSRQ) 165 - unsigned long sysrq; /* sysrq timeout */ 166 - unsigned int sysrq_ch; /* char for sysrq */ 167 - #endif 168 - 169 164 /* flags must be updated while holding port mutex */ 170 165 upf_t flags; 171 166 ··· 239 244 resource_size_t mapbase; /* for ioremap */ 240 245 resource_size_t mapsize; 241 246 struct device *dev; /* parent device */ 247 + 248 + unsigned long sysrq; /* sysrq timeout */ 249 + unsigned int sysrq_ch; /* char for sysrq */ 250 + unsigned char has_sysrq; 251 + 242 252 unsigned char hub6; /* this should be in the 8250 driver */ 243 253 unsigned char suspended; 244 - unsigned char unused[2]; 245 254 const char *name; /* port name */ 246 255 struct attribute_group *attr_group; /* port specific attributes */ 247 256 const struct attribute_group **tty_groups; /* all attributes (serial core use only) */ ··· 459 460 extern void uart_insert_char(struct uart_port *port, unsigned int status, 460 461 unsigned int overrun, unsigned int ch, unsigned int flag); 461 462 462 - #if defined(SUPPORT_SYSRQ) && defined(CONFIG_MAGIC_SYSRQ_SERIAL) 463 - static inline int 464 - uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) 465 - { 466 - if (port->sysrq) { 467 - if (ch && time_before(jiffies, port->sysrq)) { 468 - handle_sysrq(ch); 469 - port->sysrq = 0; 470 - return 1; 471 - } 472 - port->sysrq = 0; 473 - } 474 - return 0; 475 - } 476 - static inline int 477 - uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) 478 - { 479 - if (port->sysrq) { 480 - if (ch && time_before(jiffies, port->sysrq)) { 481 - port->sysrq_ch = ch; 482 - port->sysrq = 0; 483 - return 1; 484 - } 485 - port->sysrq = 0; 486 - } 487 - return 0; 488 - } 489 - static inline void 490 - uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) 491 - { 492 - int sysrq_ch; 493 - 494 - sysrq_ch = port->sysrq_ch; 495 - port->sysrq_ch = 0; 496 - 497 - spin_unlock_irqrestore(&port->lock, irqflags); 498 - 499 - if (sysrq_ch) 500 - handle_sysrq(sysrq_ch); 501 - } 502 - #else 503 - static inline int 504 - uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) { return 0; } 505 - static inline int 506 - uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch) { return 0; } 507 - static inline void 508 - uart_unlock_and_check_sysrq(struct uart_port *port, unsigned long irqflags) 509 - { 510 - spin_unlock_irqrestore(&port->lock, irqflags); 511 - } 512 - #endif 513 - 514 - /* 515 - * We do the SysRQ and SAK checking like this... 516 - */ 517 - static inline int uart_handle_break(struct uart_port *port) 518 - { 519 - struct uart_state *state = port->state; 520 - 521 - if (port->handle_break) 522 - port->handle_break(port); 523 - 524 - #ifdef SUPPORT_SYSRQ 525 - if (port->cons && port->cons->index == port->line) { 526 - if (!port->sysrq) { 527 - port->sysrq = jiffies + HZ*5; 528 - return 1; 529 - } 530 - port->sysrq = 0; 531 - } 532 - #endif 533 - if (port->flags & UPF_SAK) 534 - do_SAK(state->port.tty); 535 - return 0; 536 - } 463 + extern int uart_handle_sysrq_char(struct uart_port *port, unsigned int ch); 464 + extern int uart_prepare_sysrq_char(struct uart_port *port, unsigned int ch); 465 + extern void uart_unlock_and_check_sysrq(struct uart_port *port, 466 + unsigned long irqflags); 467 + extern int uart_handle_break(struct uart_port *port); 537 468 538 469 /* 539 470 * UART_ENABLE_MS - determine if port should enable modem status irqs
-1
scripts/.gitignore
··· 2 2 # Generated files 3 3 # 4 4 bin2c 5 - conmakehash 6 5 kallsyms 7 6 unifdef 8 7 recordmcount
-3
scripts/Makefile
··· 4 4 # the kernel for the build process. 5 5 # --------------------------------------------------------------------------- 6 6 # kallsyms: Find all symbols in vmlinux 7 - # conmakehash: Create chartable 8 - # conmakehash: Create arrays for initializing the kernel console tables 9 7 10 8 HOST_EXTRACFLAGS += -I$(srctree)/tools/include 11 9 12 10 hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c 13 11 hostprogs-$(CONFIG_KALLSYMS) += kallsyms 14 - hostprogs-$(CONFIG_VT) += conmakehash 15 12 hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount 16 13 hostprogs-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable 17 14 hostprogs-$(CONFIG_ASN1) += asn1_compiler
scripts/conmakehash.c drivers/tty/vt/conmakehash.c