aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-04-09Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linuxLinus Torvalds1-1/+1
Pull s390 updates from Martin Schwidefsky: - Improvements for the spectre defense: * The spectre related code is consolidated to a single file nospec-branch.c * Automatic enable/disable for the spectre v2 defenses (expoline vs. nobp) * Syslog messages for specve v2 are added * Enable CONFIG_GENERIC_CPU_VULNERABILITIES and define the attribute functions for spectre v1 and v2 - Add helper macros for assembler alternatives and use them to shorten the code in entry.S. - Add support for persistent configuration data via the SCLP Store Data interface. The H/W interface requires a page table that uses 4K pages only, the code to setup such an address space is added as well. - Enable virtio GPU emulation in QEMU. To do this the depends statements for a few common Kconfig options are modified. - Add support for format-3 channel path descriptors and add a binary sysfs interface to export the associated utility strings. - Add a sysfs attribute to control the IFCC handling in case of constant channel errors. - The vfio-ccw changes from Cornelia. - Bug fixes and cleanups. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (40 commits) s390/kvm: improve stack frame constants in entry.S s390/lpp: use assembler alternatives for the LPP instruction s390/entry.S: use assembler alternatives s390: add assembler macros for CPU alternatives s390: add sysfs attributes for spectre s390: report spectre mitigation via syslog s390: add automatic detection of the spectre defense s390: move nobp parameter functions to nospec-branch.c s390/cio: add util_string sysfs attribute s390/chsc: query utility strings via fmt3 channel path descriptor s390/cio: rename struct channel_path_desc s390/cio: fix unbind of io_subchannel_driver s390/qdio: split up CCQ handling for EQBS / SQBS s390/qdio: don't retry EQBS after CCQ 96 s390/qdio: restrict buffer merging to eligible devices s390/qdio: don't merge ERROR output buffers s390/qdio: simplify math in get_*_buffer_frontier() s390/decompressor: trim uncompressed image head during the build s390/crypto: Fix kernel crash on aes_s390 module remove. s390/defkeymap: fix global init to zero ...
2018-04-04Merge tag 'tty-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/ttyLinus Torvalds31-632/+2367
Pull tty/serial driver updates from Greg KH: "Here is the big set of tty and serial driver patches for 4.17-rc1 Not all that big really, most are just small fixes and additions to existing drivers. There's a bunch of work on the imx serial driver recently for some reason, and a new embedded serial driver added as well. Full details are in the shortlog. All of these have been in the linux-next tree for a while with no reported issues" * tag 'tty-4.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (66 commits) serial: expose buf_overrun count through proc interface serial: mvebu-uart: fix tx lost characters tty: serial: msm_geni_serial: Fix return value check in qcom_geni_serial_probe() tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP 8250-men-mcb: add support for 16z025 and 16z057 powerpc: Mark the variable earlycon_acpi_spcr_enable maybe_unused serial: stm32: fix initialization of RS485 mode ARM: dts: STi: Remove "console=ttyASN" from bootargs for STi boards vt: change SGR 21 to follow the standards serdev: Fix typo in serdev_device_alloc ARM: dts: STi: Fix aliases property name for STi boards tty: st-asc: Update tty alias serial: stm32: add support for RS485 hardware control mode dt-bindings: serial: stm32: add RS485 optional properties selftests: add devpts selftests devpts: comment devpts_mntget() devpts: resolve devpts bind-mounts devpts: hoist out check for DEVPTS_SUPER_MAGIC serial: 8250: Add Nuvoton NPCM UART serial: mxs-auart: disable clks of Alphascale ASM9260 ...
2018-04-02Merge branch 'syscalls-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linuxLinus Torvalds2-4/+4
Pull removal of in-kernel calls to syscalls from Dominik Brodowski: "System calls are interaction points between userspace and the kernel. Therefore, system call functions such as sys_xyzzy() or compat_sys_xyzzy() should only be called from userspace via the syscall table, but not from elsewhere in the kernel. At least on 64-bit x86, it will likely be a hard requirement from v4.17 onwards to not call system call functions in the kernel: It is better to use use a different calling convention for system calls there, where struct pt_regs is decoded on-the-fly in a syscall wrapper which then hands processing over to the actual syscall function. This means that only those parameters which are actually needed for a specific syscall are passed on during syscall entry, instead of filling in six CPU registers with random user space content all the time (which may cause serious trouble down the call chain). Those x86-specific patches will be pushed through the x86 tree in the near future. Moreover, rules on how data may be accessed may differ between kernel data and user data. This is another reason why calling sys_xyzzy() is generally a bad idea, and -- at most -- acceptable in arch-specific code. This patchset removes all in-kernel calls to syscall functions in the kernel with the exception of arch/. On top of this, it cleans up the three places where many syscalls are referenced or prototyped, namely kernel/sys_ni.c, include/linux/syscalls.h and include/linux/compat.h" * 'syscalls-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux: (109 commits) bpf: whitelist all syscalls for error injection kernel/sys_ni: remove {sys_,sys_compat} from cond_syscall definitions kernel/sys_ni: sort cond_syscall() entries syscalls/x86: auto-create compat_sys_*() prototypes syscalls: sort syscall prototypes in include/linux/compat.h net: remove compat_sys_*() prototypes from net/compat.h syscalls: sort syscall prototypes in include/linux/syscalls.h kexec: move sys_kexec_load() prototype to syscalls.h x86/sigreturn: use SYSCALL_DEFINE0 x86: fix sys_sigreturn() return type to be long, not unsigned long x86/ioport: add ksys_ioperm() helper; remove in-kernel calls to sys_ioperm() mm: add ksys_readahead() helper; remove in-kernel calls to sys_readahead() mm: add ksys_mmap_pgoff() helper; remove in-kernel calls to sys_mmap_pgoff() mm: add ksys_fadvise64_64() helper; remove in-kernel call to sys_fadvise64_64() fs: add ksys_fallocate() wrapper; remove in-kernel calls to sys_fallocate() fs: add ksys_p{read,write}64() helpers; remove in-kernel calls to syscalls fs: add ksys_truncate() wrapper; remove in-kernel calls to sys_truncate() fs: add ksys_sync_file_range helper(); remove in-kernel calls to syscall kernel: add ksys_setsid() helper; remove in-kernel call to sys_setsid() kernel: add ksys_unshare() helper; remove in-kernel calls to sys_unshare() ...
2018-04-02Merge tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-genericLinus Torvalds19-11368/+0
Pul removal of obsolete architecture ports from Arnd Bergmann: "This removes the entire architecture code for blackfin, cris, frv, m32r, metag, mn10300, score, and tile, including the associated device drivers. I have been working with the (former) maintainers for each one to ensure that my interpretation was right and the code is definitely unused in mainline kernels. Many had fond memories of working on the respective ports to start with and getting them included in upstream, but also saw no point in keeping the port alive without any users. In the end, it seems that while the eight architectures are extremely different, they all suffered the same fate: There was one company in charge of an SoC line, a CPU microarchitecture and a software ecosystem, which was more costly than licensing newer off-the-shelf CPU cores from a third party (typically ARM, MIPS, or RISC-V). It seems that all the SoC product lines are still around, but have not used the custom CPU architectures for several years at this point. In contrast, CPU instruction sets that remain popular and have actively maintained kernel ports tend to all be used across multiple licensees. [ See the new nds32 port merged in the previous commit for the next generation of "one company in charge of an SoC line, a CPU microarchitecture and a software ecosystem" - Linus ] The removal came out of a discussion that is now documented at https://lwn.net/Articles/748074/. Unlike the original plans, I'm not marking any ports as deprecated but remove them all at once after I made sure that they are all unused. Some architectures (notably tile, mn10300, and blackfin) are still being shipped in products with old kernels, but those products will never be updated to newer kernel releases. After this series, we still have a few architectures without mainline gcc support: - unicore32 and hexagon both have very outdated gcc releases, but the maintainers promised to work on providing something newer. At least in case of hexagon, this will only be llvm, not gcc. - openrisc, risc-v and nds32 are still in the process of finishing their support or getting it added to mainline gcc in the first place. They all have patched gcc-7.3 ports that work to some degree, but complete upstream support won't happen before gcc-8.1. Csky posted their first kernel patch set last week, their situation will be similar [ Palmer Dabbelt points out that RISC-V support is in mainline gcc since gcc-7, although gcc-7.3.0 is the recommended minimum - Linus ]" This really says it all: 2498 files changed, 95 insertions(+), 467668 deletions(-) * tag 'arch-removal' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (74 commits) MAINTAINERS: UNICORE32: Change email account staging: iio: remove iio-trig-bfin-timer driver tty: hvc: remove tile driver tty: remove bfin_jtag_comm and hvc_bfin_jtag drivers serial: remove tile uart driver serial: remove m32r_sio driver serial: remove blackfin drivers serial: remove cris/etrax uart drivers usb: Remove Blackfin references in USB support usb: isp1362: remove blackfin arch glue usb: musb: remove blackfin port usb: host: remove tilegx platform glue pwm: remove pwm-bfin driver i2c: remove bfin-twi driver spi: remove blackfin related host drivers watchdog: remove bfin_wdt driver can: remove bfin_can driver mmc: remove bfin_sdh driver input: misc: remove blackfin rotary driver input: keyboard: remove bf54x driver ...
2018-04-02x86/ioport: add ksys_ioperm() helper; remove in-kernel calls to sys_ioperm()Dominik Brodowski1-3/+3
Using this helper allows us to avoid the in-kernel calls to the sys_ioperm() syscall. The ksys_ prefix denotes that this function is meant as a drop-in replacement for the syscall. In particular, it uses the same calling convention as sys_ioperm(). This patch is part of a series which removes in-kernel calls to syscalls. On this basis, the syscall entry path can be streamlined. For details, see http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Slaby <jslaby@suse.com> Cc: x86@kernel.org Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2018-04-02fs: add ksys_sync() helper; remove in-kernel calls to sys_sync()Dominik Brodowski1-1/+1
Using this helper allows us to avoid the in-kernel calls to the sys_sync() syscall. The ksys_ prefix denotes that this function is meant as a drop-in replacement for the syscall. In particular, it uses the same calling convention as sys_sync(). This patch is part of a series which removes in-kernel calls to syscalls. On this basis, the syscall entry path can be streamlined. For details, see http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net Cc: Alexander Viro <viro@zeniv.linux.org.uk> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
2018-03-26tty: hvc: remove tile driverArnd Bergmann2-197/+0
The Tile architecture is obsolete and getting removed from the kernel, this removes the corresponding console driver as well. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-03-26tty: remove bfin_jtag_comm and hvc_bfin_jtag driversArnd Bergmann6-481/+0
The blackfin architecture is getting removed, so these drivers are not needed any more. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Aaron Wu <aaron.wu@analog.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-03-26serial: remove tile uart driverArnd Bergmann3-699/+0
The tile architecture is getting removed, and this driver is useless without it. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-03-26serial: remove m32r_sio driverArnd Bergmann4-1233/+0
The m32r architecture is getting removed, so we don't need this any more. Acked-by: Nicolas Pitre <nico@fluxnic.net> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-03-26serial: remove blackfin driversArnd Bergmann5-2725/+0
The blackfin architecture is getting removed, so both the bfin_uart and bfin_sport_uart can be removed as well. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Aaron Wu <aaron.wu@analog.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-03-26serial: remove cris/etrax uart driversArnd Bergmann5-5354/+0
The cris architecture is getting removed, so we don't need the uart driver any more. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2018-03-25tty: vt: fix up tabstops properlyLinus Torvalds1-4/+4
Tabs on a console with long lines do not wrap properly, so correctly account for the line length when computing the tab placement location. Reported-by: James Holderness <j4_james@hotmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-03-23serial: expose buf_overrun count through proc interfaceJeremy Kerr1-0/+2
The buf_overrun count is only every written, and not exposed to userspace anywhere. This means that dropped characters due to flip buffer overruns are never visible to userspace. The /proc/tty/driver/serial file exports a bunch of metrics (including hardware overruns) already, so add the buf_overrun (as "bo:") to this file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22serial: mvebu-uart: fix tx lost charactersGabriel Matni1-1/+1
Fixes missing characters on kernel console at low baud rates (i.e.9600). The driver should poll TX_RDY or TX_FIFO_EMP instead of TX_EMP to ensure that the transmitter holding register (THR) is ready to receive a new byte. TX_EMP tells us when it is possible to send a break sequence via SND_BRK_SEQ. While this also indicates that both the THR and the TSR are empty, it does not guarantee that a new byte can be written just yet. Fixes: 30530791a7a0 ("serial: mvebu-uart: initial support for Armada-3700 serial port") Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Gregory CLEMENT <gregory.clement@bootlin.com> Signed-off-by: Gabriel Matni <gabriel.matni@exfo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-22tty: serial: msm_geni_serial: Fix return value check in qcom_geni_serial_probe()Wei Yongjun1-2/+2
In case of error, the function platform_get_resource() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: c4f528795d1a ("tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-20Merge 4.16-rc6 into tty-nextGreg Kroah-Hartman8-5/+41
We want the serial/tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-20tty: serial: msm_geni_serial: Add serial driver support for GENI based QUPKarthikeyan Ramasubramanian3-0/+1174
This driver supports GENI based UART Controller in the Qualcomm SOCs. The Qualcomm Generic Interface (GENI) is a programmable module supporting a wide range of serial interfaces including UART. This driver support console operations using FIFO mode of transfer. Signed-off-by: Girish Mahadevan <girishm@codeaurora.org> Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org> Signed-off-by: Sagar Dharia <sdharia@codeaurora.org> Signed-off-by: Doug Anderson <dianders@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-18s390/setup : enable display support for KVM guestFarhan Ali1-1/+1
The S390 architecture does not support any graphics hardware, but with the latest support for Virtio GPU in Linux and Virtio GPU emulation in QEMU, it's possible to enable graphics for S390 using the Virtio GPU device. To enable display we need to enable the Linux Virtual Terminal (VT) layer for S390. But the VT subsystem initializes quite early at boot so we need a dummy console driver till the Virtio GPU driver is initialized and we can run the framebuffer console. The framebuffer console over a Virtio GPU device can be run in combination with the serial SCLP console (default on S390). The SCLP console can still be accessed by management applications (eg: via Libvirt's virsh console). Signed-off-by: Farhan Ali <alifm@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <e23b61f4f599ba23881727a1e8880e9d60cc6a48.1519315352.git.alifm@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2018-03-158250-men-mcb: add support for 16z025 and 16z057Michael Moese2-36/+94
Add support for two MEN UARTs (16z025 and 16z057) to the 8250_men_mcb driver. The 16z025 consists of up to four ports, the 16z057 has exactly four ports. Apart from that, all of them share the Port settings. Signed-off-by: Michael Moese <mmoese@suse.de> Reported-by: Ben Turner <ben.turner@21net.com> Tested-by: Ben Turner <ben.turner@21net.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-15serial: stm32: fix initialization of RS485 modeBich HEMON1-0/+4
Configure RS485 mode during port initialization. Fixes: 1bcda09d2910 ("serial: stm32: add support for RS485 hardware control mode") Signed-off-by: Bich Hemon <bich.hemon@st.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14vt: change SGR 21 to follow the standardsMike Frysinger1-1/+5
ECMA-48 [1] (aka ISO 6429) has defined SGR 21 as "doubly underlined" since at least March 1984. The Linux kernel has treated it as SGR 22 "normal intensity" since it was added in Linux-0.96b in June 1992. Before that, it was simply ignored. Other terminal emulators have either ignored it, or treat it as double underline now. xterm for example added support in its 304 release (May 2014) [2] where it was previously ignoring it. Changing this behavior shouldn't be an issue: - It isn't a named capability in ncurses's terminfo database, so no script is using libtinfo/libcurses to look this up, or using tput to query & output the right sequence. - Any script assuming SGR 21 will reset intensity in all terminals already do not work correctly on non-Linux VTs (including running under screen/tmux/etc...). - If someone has written a script that only runs in the Linux VT, and they're using SGR 21 (instead of SGR 22), the output should still be readable. imo it's important to change this as the Linux VT's non-conformance is sometimes used as an argument for other terminal emulators to not implement SGR 21 at all, or do so incorrectly. [1]: https://www.ecma-international.org/publications/standards/Ecma-048.htm [2]: https://github.com/ThomasDickey/xterm-snapshots/commit/2fd29cb98d214cb536bcafbee00bc73b3f1eeb9d Signed-off-by: Mike Frysinger <vapier@chromium.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14serdev: Fix typo in serdev_device_allocFrédéric Danis1-1/+1
Fix function name in serdev_device_alloc() definition Signed-off-by: Frédéric Danis <frederic.danis.oss@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14tty: st-asc: Update tty aliasPatrice Chotard1-1/+3
Since dtc v1.4.6-9-gaadd0b65c987, aliases property name must include only lowercase and '-'. After having updated all STi boards serial aliases from "ttyASN" to "serialN", st-asc driver need to be updated accordingly as tty aliases id is retrieved using of_alias_get_id(). Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14serial: stm32: add support for RS485 hardware control modeBich HEMON2-1/+132
Implement Driver Enable signal (DE) to activate the transmission mode of the external transceiver. Signed-off-by: Yves Coppeaux <yves.coppeaux@st.com> Signed-off-by: Bich Hemon <bich.hemon@st.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: 8250: Add Nuvoton NPCM UARTJoel Stanley2-0/+34
The Nuvoton UART is almost compatible with the 8250 driver when probed via the 8250_of driver, however it requires some extra configuration at startup. Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Joel Stanley <joel@jms.id.au> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: mxs-auart: disable clks of Alphascale ASM9260Alexey Khoroshilov1-13/+23
In case of Alphascale ASM9260 probe() enables s->clk and s->clk_ahb via mxs_get_clks(), but there is no disable of the clocks. The patch adds it to error paths and to mxs_auart_remove(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Fixes: 254da0d753fb ("serial: mxs-auart: add Alphascale ASM9260 support") Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: 8250_dw: Switch to use acpi_dev_present()Andy Shevchenko1-11/+5
Special settings for APMC0D08 are applied when device is present in the system. To check its presence we may use acpi_dev_present() instead of current open coded variant. Cc: Feng Kan <fkan@apm.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: consistently use imx_uart_ as prefix for all functionsUwe Kleine-König1-213/+213
Having a fixed prefix helps at several places. It ensures that another driver doesn't use the same function name which confuses the linker and tools like ctags. It simplifies working with function tracing and dynamic printk() support which can filter on function names. And last but not least it helps the human source code reader to understand if a given function belongs to a driver or a more general part of the kernel. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: don't prepare to send if no data is availableUwe Kleine-König1-0/+3
serial_core might call the .start_tx callback without any data being available to send. In this case return early instead of going through all the setup needed for sending which might include disabling RX in RS485 half-duplex mode. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: Fix handling of TC irq in combination with DMAUwe Kleine-König1-6/+20
When using RS485 half duplex the Transmitter Complete irq is needed to determine the moment when the transmitter can be disabled. When using DMA this irq must only be enabled when DMA has completed to transfer all data. Otherwise the CPU might busily trigger this irq which is not properly handled and so the also pending irq for the DMA transfer cannot trigger. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: Also enable the aging timer in PIO modeUwe Kleine-König1-3/+12
This allows to increase the RX waterlevel which allows to delay the RRDY irq. The desired effect is that less irqs are needed to handle characters and so reduce irq count of the system. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: ensure that RX irqs are off if RX is offUwe Kleine-König1-28/+64
Make sure that UCR1.RXDMAEN and UCR1.ATDMAEN (for the DMA case) and UCR1.RRDYEN (for the PIO case) are off iff UCR1.RXEN is disabled. This ensures that the fifo isn't read with RX disabled which results in an exception. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: Stop to receive in .stop_rx()Uwe Kleine-König1-9/+0
When the UART is used in DMA mode, .stop_rx() does nothing if the port isn't suspended. This is wrong as .stop_rx() should stop receiving characters unconditionally. When the port is about to be closed the DMA channel is stopped in .shutdown(), so this isn't necessary to be in .stop_rx() here, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: setup fifo waterlevel before enabling aging timerUwe Kleine-König1-2/+2
The aging timer fires if there are characters in the RX fifo but the water level isn't reached yet. Make sure that the waterlevel is configured before the aging timer is enabled to trigger a DMA request (UCR1_ATDMAEN). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: use u32 variables with matching names for registersUwe Kleine-König1-167/+179
The serial/imx driver is full of inconsistently named and typed variables that hold different register values. Consistently use u32 as type (matching what readl and writel use) and name the variables after the register whose value they are holding. This makes it easier to notice when UCR2_RTSEN is written to UCR1. The only difference introduced by this commit in the compiled driver is that twice the second argument to warn_slowpath_null() changed because the two WARN_ON in dma_rx_callback() pass __LINE__ to warn_slowpath_null(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: simplify check that prevents starting PIO when DMA is in useUwe Kleine-König1-2/+1
The original code looks as follows: if (sport->dma_is_enabled) { ... make sure TX DMA is running, i.e. .dma_is_txing = 1 } if (sport->dma_is_txing) return; As .dma_is_txing can only be true if .dma_is_enabled is, the return can go at the end of the first if body without an additional check. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: simplify some conditions related to dmaUwe Kleine-König1-3/+3
Neither .dma_is_txing nor .dma_is_rxing can evaluate to true if .dma_is_enabled evaluates to false: The only function that sets .dma_is_txing to a non-zero value is imx_dma_tx() which is only called if .dma_is_enabled is true. Same for .dma_is_rxing and start_rx_dma(). And before .dma_is_enabled is set to 0 when imx_shutdown calls imx_disable_dma(), .dma_is_rxing and .dma_is_txing are reset to zero before, too. For this reason sport->dma_is_enabled && sport->dma_is_rxing has the same value as sport->dma_is_rxing which allows to simplify three if conditions. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: implement shadow registers for UCRx and UFCRUwe Kleine-König1-1/+59
This reduces the amount of read accesses to the register space by shadowing the values for five registers that only change on writing them. There is a single bit in UCR2 that might change without being written to it, this is handled accordingly. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09serial: imx: add wrappers for writel and readlUwe Kleine-König1-184/+199
This prepares implementing shadow copies for the control registers and additionally provides a good place to hook in debug code to trace register usage. Most of this patch was done using pattern substitution: perl -p -i -e ' s/\breadl(?:_relaxed)?\((?:sport->port\.|port->)membase \+/imx_uart_readl(sport,/; s/\bwritel(?:_relaxed)?\(([^,]*), (sport->port\.|port->)membase \+/imx_uart_writel(sport, $1,/; ' drivers/tty/serial/imx.c Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-09tty: New RISC-V SBI console driverPalmer Dabbelt3-0/+71
The RISC-V ISA defines a simple console that is availiable via SBI calls on all systems. The SBI console is designed to be availiable at all times, so while it's most natural to use this as an early printk target it's also possible to use this as the system console when there isn't a better one availiable. This patch adds support for the RISC-V SBI console via the HVC infastructure. It's entirely independent from our early printk support, which results in early boot messages appearing twice over the SBI console. As far as I can tell that's the fault of our early printk support (we should support earlycon) as opposed to this driver. There is one checkpatch.pl warning here: to check the MAINTAINERS file. They're all matched by the "K: riscv" line. Signed-off-by: Palmer Dabbelt <palmer@sifive.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-05tty: Remove metag DA TTY and console driverJames Hogan3-679/+0
Now that arch/metag/ has been removed, remove the metag DA TTY and console driver. It is of no value without the architecture code. Signed-off-by: James Hogan <jhogan@kernel.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-metag@vger.kernel.org
2018-02-28serial: imx: document functions that are called with port.lock takenUwe Kleine-König1-12/+11
Consistently indicate being called with irqs off and the port lock taken for all functions that this applies to. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-28serial: imx: Rename register fields to match newer reference manualsUwe Kleine-König1-9/+9
Only the reference manual for the i.MX1 (I have MC9328MX1RM/D Rev 5 from 2004) uses TDMAEN and RDMAEN for these. All reference manuals for the newer chips use TXDMAEN and RXDMAEN. Update to the newer name with the assumption that most imx users don't use an imx1 any more. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-28serial, pci_ids: Move duplicate IDs to PCI IDs databaseAndy Shevchenko1-3/+0
PCI ID database is for IDs used across several drivers. Here is the case for SUNIX combo cards. No functional change intended. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-28serial: xuartps: Fix out-of-bounds access through DT aliasGeert Uytterhoeven1-1/+1
The cdns_uart_port[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access. Fix this by adding a range check. Fixes: 928e9263492069ee ("tty: xuartps: Initialize ports according to aliases") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-28serial: sirf: Fix out-of-bounds access through DT aliasGeert Uytterhoeven1-0/+5
The sirf_ports[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access. Fix this by adding a range check. Fixes: a6ffe8966acbb66b ("serial: sirf: use dynamic method allocate uart structure") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-28serial: sh-sci: Fix out-of-bounds access through DT aliasGeert Uytterhoeven1-0/+4
The sci_ports[] array is indexed using a value derived from the "serialN" alias in DT, which may lead to an out-of-bounds access. Fix this by adding a range check. Note that the array size is defined by a Kconfig symbol (CONFIG_SERIAL_SH_SCI_NR_UARTS), so this can even be triggered using a legitimate DTB. Fixes: 97ed9790c514066b ("serial: sh-sci: Remove unused platform data capabilities field") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-28serial: samsung: Fix out-of-bounds access through serial port indexGeert Uytterhoeven1-0/+4
The s3c24xx_serial_ports[] array is indexed using a value derived from the "serialN" alias in DT, or from an incrementing probe index, which may lead to an out-of-bounds access. Fix this by adding a range check. Note that the array size is defined by a Kconfig symbol (CONFIG_SERIAL_SAMSUNG_UARTS), so this can even be triggered using a legitimate DTB or legitimate board code. Fixes: 13a9f6c64fdc55eb ("serial: samsung: Consider DT alias when probing ports") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-28serial: pxa: Fix out-of-bounds access through serial port indexGeert Uytterhoeven1-0/+4
The serial_pxa_ports[] array is indexed using a value derived from the "serialN" alias in DT, or from platform data, which may lead to an out-of-bounds access. Fix this by adding a range check. Fixes: 699c20f3e6310aa2 ("serial: pxa: add OF support") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>