summaryrefslogtreecommitdiffstats
path: root/drivers/tty
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'for-linus-4.1b-rc4-tag' of ↵Linus Torvalds2015-05-211-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip Pull two xen bugfixes from David Vrabel: - fix ARM build regression. - fix VIRQ_CONSOLE related oops. * tag 'for-linus-4.1b-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/events: don't bind non-percpu VIRQs with percpu chip xen/arm: Define xen_arch_suspend()
| * xen/events: don't bind non-percpu VIRQs with percpu chipDavid Vrabel2015-05-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A non-percpu VIRQ (e.g., VIRQ_CONSOLE) may be freed on a different VCPU than it is bound to. This can result in a race between handle_percpu_irq() and removing the action in __free_irq() because handle_percpu_irq() does not take desc->lock. The interrupt handler sees a NULL action and oopses. Only use the percpu chip/handler for per-CPU VIRQs (like VIRQ_TIMER). # cat /proc/interrupts | grep virq 40: 87246 0 xen-percpu-virq timer0 44: 0 0 xen-percpu-virq debug0 47: 0 20995 xen-percpu-virq timer1 51: 0 0 xen-percpu-virq debug1 69: 0 0 xen-dyn-virq xen-pcpu 74: 0 0 xen-dyn-virq mce 75: 29 0 xen-dyn-virq hvc_console Signed-off-by: David Vrabel <david.vrabel@citrix.com> Cc: <stable@vger.kernel.org>
* | Merge tag 'tty-4.1-rc4' of ↵Linus Torvalds2015-05-168-33/+60
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty Pull tty/serial fixes from Greg KH: "Here's some TTY and serial driver fixes for reported issues. All of these have been in linux-next successfully" * tag 'tty-4.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: pty: Fix input race when closing tty/n_gsm.c: fix a memory leak when gsmtty is removed Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open" serial: omap: Fix error handling in probe earlycon: Revert log warnings
| * | pty: Fix input race when closingPeter Hurley2015-05-104-22/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A read() from a pty master may mistakenly indicate EOF (errno == -EIO) after the pty slave has closed, even though input data remains to be read. For example, pty slave | input worker | pty master | | | | n_tty_read() pty_write() | | input avail? no add data | | sleep schedule worker --->| | . |---> flush_to_ldisc() | . pty_close() | fill read buffer | . wait for worker | wakeup reader --->| . | read buffer full? |---> input avail ? yes |<--- yes - exit worker | copy 4096 bytes to user TTY_OTHER_CLOSED <---| |<--- kick worker | | **** New read() before worker starts **** | | n_tty_read() | | input avail? no | | TTY_OTHER_CLOSED? yes | | return -EIO Several conditions are required to trigger this race: 1. the ldisc read buffer must become full so the input worker exits 2. the read() count parameter must be >= 4096 so the ldisc read buffer is empty 3. the subsequent read() occurs before the kicked worker has processed more input However, the underlying cause of the race is that data is pipelined, while tty state is not; ie., data already written by the pty slave end is not yet visible to the pty master end, but state changes by the pty slave end are visible to the pty master end immediately. Pipeline the TTY_OTHER_CLOSED state through input worker to the reader. 1. Introduce TTY_OTHER_DONE which is set by the input worker when TTY_OTHER_CLOSED is set and either the input buffers are flushed or input processing has completed. Readers/polls are woken when TTY_OTHER_DONE is set. 2. Reader/poll checks TTY_OTHER_DONE instead of TTY_OTHER_CLOSED. 3. A new input worker is started from pty_close() after setting TTY_OTHER_CLOSED, which ensures the TTY_OTHER_DONE state will be set if the last input worker is already finished (or just about to exit). Remove tty_flush_to_ldisc(); no in-tree callers. Fixes: 52bce7f8d4fc ("pty, n_tty: Simplify input processing on final close") Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96311 BugLink: http://bugs.launchpad.net/bugs/1429756 Cc: <stable@vger.kernel.org> # 3.19+ Reported-by: Andy Whitcroft <apw@canonical.com> Reported-by: H.J. Lu <hjl.tools@gmail.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | tty/n_gsm.c: fix a memory leak when gsmtty is removedPan Xinhui2015-05-101-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | when gsmtty_remove put dlci, it will cause memory leak if dlci->port's refcount is zero. So we do the cleanup work in .cleanup callback instead. dlci will be last put in two call chains. 1) gsmld_close -> gsm_cleanup_mux -> gsm_dlci_release -> dlci_put 2) gsmld_remove -> dlci_put so there is a race. the memory leak depends on the race. In call chain 2. we hit the memory leak. below comment tells. release_tty -> tty_driver_remove_tty -> gsmtty_remove -> dlci_put -> tty_port_destructor (WARN_ON(port->itty) and return directly) | tty->port->itty = NULL; | tty_kref_put ---> release_one_tty -> gsmtty_cleanup (added by our patch) So our patch fix the memory leak by doing the cleanup work after tty core did. Signed-off-by: Pan Xinhui <xinhuix.pan@intel.com> Fixes: dfabf7ffa30585 Cc: stable <stable@vger.kernel.org> # 3.14+ Acked-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | Revert "serial/amba-pl011: Leave the TX IRQ alone when the UART is not open"Dave Martin2015-05-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit f2ee6dfa0e8597eea8b98d240b0033994e20d215. Jakub Kiciński observed that this patch can cause the pl011 driver to hang if if the only process with a pl011 port open is killed by a signal, pl011_shutdown() can get called with an arbitrary amount of data still in the FIFO. Calling _shutdown() with the TX FIFO non-empty is questionable behaviour and my itself be a bug. Since the affected patch was speculative anyway, and brings limited benefit, the simplest course is to remove the assumption that TXIS will always be left asserted after the port is shut down. Signed-off-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | serial: omap: Fix error handling in probeSemen Protsenko2015-05-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is pm_qos_add_request() being executed on serial_omap_probe(), which stores "&up->pm_qos_request" from omap-serial driver to "pm_qos_array[PM_QOS_CPU_DMA_LATENCY]->constraints". If serial_omap_probe() fails after pm_qos_add_request() (e.g. on uart_add_one_port() call), pm_qos_array still keeping pm_qos_request struct from omap-serial driver, which is not valid anymore (since driver failed). This leads further to kernel crash on pm_qos_update_target(), executing from some completely different driver. We were observing this while trying to run audio playback while having one of omap-serial driver instances failed on uart_add_one_port() call: Unable to handle kernel paging request at virtual address fffffffc Backtrace: (plist_add) from (pm_qos_update_target) (pm_qos_update_target) from (pm_qos_add_request) (pm_qos_add_request) from (snd_pcm_hw_params) (snd_pcm_hw_params) from (snd_pcm_common_ioctl1) (snd_pcm_common_ioctl1) from (snd_pcm_playback_ioctl1) (snd_pcm_playback_ioctl1) from (snd_pcm_playback_ioctl) (snd_pcm_playback_ioctl) from (do_vfs_ioctl) (do_vfs_ioctl) from (SyS_ioctl) (SyS_ioctl) from (ret_fast_syscall) This patch adds pm_qos_remove_request() on fail path in serial_omap_probe() in order to fix this issue. While at it, free the wakeup settings on fail path as well, just like it's done in serial_omap_remove(). Signed-off-by: Semen Protsenko <semen.protsenko@globallogic.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | earlycon: Revert log warningsPeter Hurley2015-05-081-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Log warnings meant to help diagnose problems setting up earlycon are reporting false positives for 'console='. Revert to the previous behavior which reported nothing. Cc: Maciej W. Rozycki <macro@linux-mips.org> Cc: Robert Schwebel <r.schwebel@pengutronix.de> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | | Merge tag 'for-linus-4.1b-rc2-tag' of ↵Linus Torvalds2015-05-061-1/+17
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip Pull xen bug fixes from David Vrabel: - fix blkback regression if using persistent grants - fix various event channel related suspend/resume bugs - fix AMD x86 regression with X86_BUG_SYSRET_SS_ATTRS - SWIOTLB on ARM now uses frames <4 GiB (if available) so device only capable of 32-bit DMA work. * tag 'for-linus-4.1b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen: Add __GFP_DMA flag when xen_swiotlb_init gets free pages on ARM hypervisor/x86/xen: Unset X86_BUG_SYSRET_SS_ATTRS on Xen PV guests xen/events: Set irq_info->evtchn before binding the channel to CPU in __startup_pirq() xen/console: Update console event channel on resume xen/xenbus: Update xenbus event channel on resume xen/events: Clear cpu_evtchn_mask before resuming xen-pciback: Add name prefix to global 'permissive' variable xen: Suspend ticks on all CPUs during suspend xen/grant: introduce func gnttab_unmap_refs_sync() xen/blkback: safely unmap purge persistent grants
| * xen/console: Update console event channel on resumeBoris Ostrovsky2015-05-051-1/+17
| | | | | | | | | | | | | | | | | | After a resume the hypervisor/tools may change console event channel number. We should re-query it. Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: <stable@vger.kernel.org> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
* | serial: 8250_pci: Add support for 16 port Exar boardsSoeren Grunewald2015-04-281-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Exar XR17V358 chip usually provides only 8 ports. But two chips can be combined to act as a single 16 port chip. Therefor one chip is configured as master the second as slave by connecting the mode pin to VCC (master) or GND (slave). Then the master chip is reporting a different device-id depending on whether a slave is detected or not. The UARTs 8-15 are addressed from 0x2000-0x3fff. So the offset of 0x400 from UART to UART can be used to address all 16 ports as before. See: https://www.exar.com/common/content/document.ashx?id=1587 page 11 Signed-off-by: Soeren Grunewald <soeren.grunewald@desy.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: samsung: fix serial console breakRobert Baldyga2015-04-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes problems with serial console break. When function s3c64xx_serial_startup() was started while serial console has been working, it caused lose of characters written to TX FIFO. This effect was particularly observable with systemd, which closes serial port every time when it's not currently needed, hence function s3c64xx_serial_startup() is called quite often there. To fix this problem we avoid resetting TX FIFO if port is used as serial console. Example of broken console log: [ 1086.7 Expecting device dev-ttySAC1.device... [ 1086.[ OK ] Reached target Paths. [ 1086.756416] s[ OK ] Reached target Swap. [ 1086.776413] systemd[1]: Reached target Swap. [ 1086.776642] systemd[1]: Starting Root Slice. [ 5.53403[ OK ] Created slice Root Slice. [ 5.548433] systemd[1]: Create[ OK ] Created slice User and Session Slice. [ 5.568414] sys[ OK ] Listening on /dev/initctl Compatibility Named Pipe. [ 5.588388] s[ OK ] Listening on Delayed Shutdown Socket. [ 5.608376] sy[ OK ] Listening on Journal Socket (/dev/log). [ 5.628361] [ OK ] Listening on udev Kernel Socket. [ 5.648357] s[ OK ] Listening on udev Control Socket. [ 5.668353] s[ OK ] Listening on Journal Socket. [ 5.688366] systemd[1]: Listeni[ OK ] Created slice System Slice. [ 5.708393] Mounting Temporary Directory... [ 7139.067436] Starting prepare device daemon... [ 7139.091726] sy Starting Generate environment from /etc/profile.d... [ 5.792867] system Starting Create Static Device Nodes in /dev... [ 7848.718 Mounting Debug File System... [ 7848.7384 Mounting Configuration File System... [ 5.852 Starting Apply Kernel Variables... [ 5.8720 Starting Setup Virtual Console... [ 7848.798 Starting udev Coldplug all Devices... [ 7848.817 Starting Journal Service... [ OK ] Started Journal Service. [ 7848.854222] s[ OK ] Reached target Slices. Starting Remount Root and Kernel File Systems... [ OK ] Mounted Configuration File System. Reported-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty/serial: at91: maxburst was missing for dma transfersLudovic Desroches2015-04-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | Maxburst was not set when doing the dma slave configuration. This value is checked by the recently introduced xdmac. It causes an error when doing the slave configuration and so prevents from using dma. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> Cc: <stable@vger.kernel.org> # 3.12 and later Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: of-serial: Remove device_type = "serial" registrationMichal Simek2015-04-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not probe all serial drivers by of_serial.c which are using device_type = "serial"; property. Only drivers which have valid compatible strings listed in the driver should be probed. When PORT_UNKNOWN is setup probe will fail anyway. Arnd quotation about driver historical background: "when I wrote that driver initially, the idea was that it would get used as a stub to hook up all other serial drivers but after that, the common code learned to create platform devices from DT" This patch fix the problem with on the system with xilinx_uartps and 16550a where of_serial failed to register for xilinx_uartps and because of irq_dispose_mapping() removed irq_desc. Then when xilinx_uartps was asking for irq with request_irq() EINVAL is returned. Signed-off-by: Michal Simek <michal.simek@xilinx.com> CC: <stable@vger.kernel.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: xilinx: Use platform_get_irq to get irq description structureMichal Simek2015-04-282-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For systems with CONFIG_SERIAL_OF_PLATFORM=y and device_type = "serial"; property in DT of_serial.c driver maps and unmaps IRQ (because driver probe fails). Then a driver is called but irq mapping is not created that's why driver is failing again in again on request_irq(). Based on this use platform_get_irq() instead of platform_get_resource() which is doing irq_desc allocation and driver itself can request IRQ. Fix both xilinx serial drivers in the tree. Signed-off-by: Michal Simek <michal.simek@xilinx.com> CC: <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: core: Fix kernel-doc build warningsPeter Hurley2015-04-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fix uart_console_write() kernel-doc build warnings. Warning(drivers/tty/serial/serial_core.c:1778): No description found for parameter 'putchar' Warning(drivers/tty/serial/serial_core.c:1778): Excess function parameter 'write' description in 'uart_console_write' Fixes: 1cfe42b7fd29 ("serial: core: Fix kernel doc for uart_console_write()") Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty: Re-add external interface for tty_set_termios()Frederic Danis2015-04-281-1/+2
|/ | | | | | | | | | This is needed by Bluetooth hci_uart module to be able to change speed of Bluetooth controller and local UART. Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge tag 'devicetree-for-4.1' of ↵Linus Torvalds2015-04-243-1/+27
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux Pull second batch of devicetree updates from Rob Herring: "As Grant mentioned in the first devicetree pull request, here is the 2nd batch of DT changes for 4.1. The main remaining item here is the endianness bindings and related 8250 driver support. - DT endianness specification bindings - big-endian 8250 serial support - DT overlay unittest updates - various DT doc updates - compile fixes for OF_IRQ=n" * tag 'devicetree-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: frv: add io{read,write}{16,32}be functions mn10300: add io{read,write}{16,32}be functions Documentation: DT bindings: add doc for Altera's SoCFPGA platform of: base: improve of_get_next_child() kernel-doc Doc: dt: arch_timer: discourage clock-frequency use of: unittest: overlay: Keep track of created overlays of/fdt: fix allocation size for device node path serial: of_serial: Support big-endian register accesses serial: 8250: Add support for big-endian MMIO accesses of: Document {little,big,native}-endian bindings of/fdt: Add endianness helper function for early init code of: Add helper function to check MMIO register endianness of/fdt: Remove "reg" data prints from early_init_dt_scan_memory of: add vendor prefix for Artesyn of: Add dummy of_irq_to_resource_table() for IRQ_OF=n of: OF_IRQ should depend on IRQ_DOMAIN
| * serial: of_serial: Support big-endian register accessesKevin Cernekee2015-04-141-1/+2
| | | | | | | | | | | | | | | | | | If the device node has a "big-endian" property and 32-bit registers, tell the serial driver to use UPIO_MEM32BE instead of UPIO_MEM32. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Rob Herring <robh@kernel.org>
| * serial: 8250: Add support for big-endian MMIO accessesKevin Cernekee2015-04-142-0/+25
| | | | | | | | | | | | | | | | | | | | Add cases for UPIO_MEM32BE wherever there are currently cases handling UPIO_MEM32. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Rob Herring <robh@kernel.org>
* | Merge tag 'tty-4.1-rc1' of ↵Linus Torvalds2015-04-2152-4438/+1442
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty Pull tty/serial updates from Greg KH: "Here's the big tty/serial driver update for 4.1-rc1. It was delayed for a bit due to some questions surrounding some of the console command line parsing changes that are in here. There's still one tiny regression for people who were previously putting multiple console command lines and expecting them all to be ignored for some odd reason, but Peter is working on fixing that. If not, I'll send a revert for the offending patch, but I have faith that Peter can address it. Other than the console work here, there's the usual serial driver updates and changes, and a buch of 8250 reworks to try to make that driver easier to maintain over time, and have it support more devices in the future. All of these have been in linux-next for a while" * tag 'tty-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (119 commits) n_gsm: Drop unneeded cast on netdev_priv sc16is7xx: expose RTS inversion in RS-485 mode serial: 8250_pci: port failed after wakeup from S3 earlycon: 8250: Document kernel command line options earlycon: 8250: Fix command line regression earlycon: Fix __earlycon_table stride tty: clean up the tty time logic a bit serial: 8250_dw: only get the clock rate in one place serial: 8250_dw: remove useless ACPI ID check dmaengine: hsu: move memory allocation to GFP_NOWAIT dmaengine: hsu: remove redundant pieces of code serial: 8250_pci: add Intel Tangier support dmaengine: hsu: add Intel Tangier PCI ID serial: 8250_pci: replace switch-case by formula for Intel MID serial: 8250_pci: replace switch-case by formula tty: cpm_uart: replace CONFIG_8xx by CONFIG_CPM1 serial: jsm: some off by one bugs serial: xuartps: Fix check in console_setup(). serial: xuartps: Get rid of register access macros. serial: xuartps: Fix iobase use. ...
| * | n_gsm: Drop unneeded cast on netdev_privJulia Lawall2015-04-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The result of netdev_priv is already implicitly cast to the type of the left side of the assignment. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ type T; T *x; @@ x = - (T *) netdev_priv(...) // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | sc16is7xx: expose RTS inversion in RS-485 modeJakub Kicinski2015-04-101-9/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hardware is capable of inverting RTS signal when working in RS-485 mode. Expose this functionality to user space. Relay on a matching combination of standard flags (SER_RS485_RTS_ON_SEND and SER_RS485_RTS_AFTER_SEND) to detect when user space is requesting inverted RTS mode. Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Signed-off-by: Jon Ringle <jringle@gridpoint.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | serial: 8250_pci: port failed after wakeup from S3Peter Hung2015-04-101-64/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Serial ports of F81504/F81508/F81512 will failed when wakeup from S3(STR). It's due to when the system wakeup from S3(STR), this PCI device's configuration space from 0x40 to 0x40 + max_port * 0x08 should be re-configured. We move all initialization from pci_fintek_setup() to pci_fintek_init() and set it to pci_serial_quirks .init section. It's will re-init this device when system wakeup from pciserial_resume_ports(). Signed-off-by: Peter Hung <hpeter+linux_kernel@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | earlycon: 8250: Document kernel command line optionsPeter Hurley2015-04-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Document the expected behavior of kernel command lines of the forms: console=uart[8250],io|mmio|mmio32,<addr>[,options] console=uart[8250],<addr>[,options] and earlycon=uart[8250],io|mmio|mmio32,<addr>[,options] earlycon=uart[8250],<addr>[,options] Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | earlycon: 8250: Fix command line regressionPeter Hurley2015-04-102-26/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restore undocumented behavior of kernel command line parameters of the forms: console=uart[8250],io|mmio|mmio32,<addr>[,options] console=uart[8250],<addr>[,options] where 'options' have not been specified; in this case, the hardware is assumed to be initialized. Fixes: c7cef0a84912cab3c9df8 ("console: Add extensible console matching") Reported-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | Merge 4.0-rc7 into tty-nextGreg Kroah-Hartman2015-04-072-0/+6
| |\ \ | | | | | | | | | | | | | | | | | | | | We want the fixes in here as well, also to help out with merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | tty: clean up the tty time logic a bitGreg Kroah-Hartman2015-03-261-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only care if anything other than the lower 3 bits of the tty has changed, so just check that way, which makes it a bit faster, and more obvious what is going on. Also, document this for future developers to understand why we did this. Reported-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
| * | | serial: 8250_dw: only get the clock rate in one placeHeikki Krogerus2015-03-261-17/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The clock rate is requested from a property called "clock-frequency" in both dw8250_probe_of and dw8250_probe_acpi. Moving the requests to dw8250_probe. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: 8250_dw: remove useless ACPI ID checkHeikki Krogerus2015-03-261-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having ACPI handle does not mean the same as having ACPI identifier. The check is in any case useless, but having it prevents this driver from being used for example with multifunctional PCI devices, such as the newer Intel LPSS devices. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: 8250_pci: add Intel Tangier supportAndy Shevchenko2015-03-261-0/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Intel Tangier contains 4 HSUART ports as found on Intel Edison board which are 8250 compatible. The patch adds necessary bits to the driver. Note that the HSU port0 is currently unavailable and thus not supported. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: 8250_pci: replace switch-case by formula for Intel MIDAndy Shevchenko2015-03-261-44/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces a switch-case by a formula using rational best approximation that does necessary calculations for intel_mid_set_termios(). Below is a list of the calculations done for all defined baud rates. Each line in a format: 1) nominator, 2) denominator, 3) prescaler, 4) Fuart, 5) port UART clock, 6) list of baud rates with DLAB values. 24 25 12 48000000 64000000 4000000(1) 49 50 14 49000000 56000000 3500000(1) 4 5 16 40000000 40000000 2500000(1) 16 25 16 32000000 32000000 500000(4),1000000(2),2000000(1) 24 25 16 48000000 48000000 1500000(2),3000000(1) 2304 3125 16 36864000 36864000 576000(4),1152000(2) 8192 15625 16 26214400 26214400 50(32768),200(8192) 9216 15625 16 29491200 29491200 1800(1024),57600(32),115200(16), 230400(8),460800(4),921600(2),1843200(1) 12288 15625 16 39321600 39321600 75(32768),150(16384),300(8192), 600(4096),1200(2048),2400(1024),4800(512), 9600(256),19200(128),38400(64) 45056 78125 16 28835840 28835840 110(16384) 274432 390625 16 35127296 35127296 134(16384) Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: 8250_pci: replace switch-case by formulaAndy Shevchenko2015-03-262-31/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces a switch-case by a formula using rational best approximation that does necessary calculations for byt_set_termios(). Below is a list of the calculations done for all defined baud rates. Each line in a format: 1) numerator, 2) denominator, 3) prescaler, 4) Fuart, 5) port UART clock, 6) list of baud rates with DLAB values. 4 5 16 80000000 80000000 2500000(2) 14 25 16 56000000 56000000 3500000(1) 16 25 16 64000000 64000000 500000(8),1000000(4),2000000(2), 4000000(1) 24 25 16 96000000 96000000 1500000(4),3000000(2) 2180 3103 16 70254592 70254592 134(32768) 2304 3125 16 73728000 73728000 576000(8),1152000(4) 8192 15625 16 52428800 52428800 50(65536),200(16384) 9216 15625 16 58982400 58982400 1800(2048),57600(64),115200(32), 230400(16),460800(8),921600(4),1843200(2) 12288 15625 16 78643200 78643200 75(65536),150(32768),300(16384), 600(8192),1200(4096),2400(2048), 4800(1024),9600(512),19200(256),38400(128) 9893 17154 16 57671680 57671680 110(32768) Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | tty: cpm_uart: replace CONFIG_8xx by CONFIG_CPM1Christophe Leroy2015-03-263-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two config options exist to define powerpc MPC8xx: * CONFIG_PPC_8xx * CONFIG_8xx In addition, CONFIG_PPC_8xx also defines CONFIG_CPM1 as communication co-processor arch/powerpc/platforms/Kconfig.cputype has contained the following comment about CONFIG_8xx item for some years: "# this is temp to handle compat with arch=ppc" It looks like not many places still have that old CONFIG_8xx used, so it is likely to be a good time to get rid of it completely ? Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: jsm: some off by one bugsDan Carpenter2015-03-262-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "brd->nasync" amd "brd->maxports" are the same. They hold the number of filled out channels in the brd->channels[] array. These tests should be ">=" instead of ">" so that we don't read one element past the end. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: xuartps: Fix check in console_setup().Thomas Betker2015-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cdns_uart_console_setup() checks port->mapbase != 0, but the port may not be initialized yet even if this condition is met [e.g., ioremap() may have failed]. Check port->membase != NULL instead, similar to cdns_early_console_setup(). Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: xuartps: Get rid of register access macros.Thomas Betker2015-03-261-112/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Get rid of cdns_uart_readl() and cdns_uart_writel() and just call readl() and writel() directly. Most of the patch was created by search-and-replace (I had to convert a few lines manually, and break some lines longer than 80 columns): * s/cdns_uart_readl(/readl(port->membase + /g * s/cdns_uart_writel(\([^,]*\),/writel(\1, port->membase +/g Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: xuartps: Fix iobase use.Thomas Betker2015-03-261-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cdns_uart_get_port() sets port->iobase = 1 to "mark port in use", but this "in use" condition is not checked anywhere else in the code. So remove the line, keeping port->iobase = 0 (which also makes more sense). Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: xuartps: Fix cdns_uart_port[] definition.Thomas Betker2015-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code assumes that the array cdns_uart_port[] has dimension CDNS_UART_NR_PORTS, so let us define it this way. Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: xuartps: Fix register space size.Thomas Betker2015-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The register space size is 0x1000, and this value [not 0xfff] should be provided to request_mem_region(), ioremap(), etc. Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: of: set port iomem size from devicetreeMans Rullgard2015-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the 8250 driver reserve exactly the mmio region specified in the devicetree. This prevents conflicts between UPIO_AU type UARTs and other devices mapped closer than the default size of 0x1000 (or 0x100 for RT2880). Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: 8250: allow specifying iomem size in addition to addressMans Rullgard2015-03-261-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a mapsize field to struct uart_port to be used in conjunction with mapbase. If set, it overrides whatever value serial8250_port_size() would otherwise report. Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: 8250_dw: add support for AMD SOC CarrizoKen Xue2015-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add ACPI identifier for UART on AMD SOC Carrizo. Signed-off-by: Ken Xue <Ken.Xue@amd.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | tty: constify of_device_id arrayFabian Frederick2015-03-2614-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> Acked-by: Peter Korsgaard <peter@korsgaard.com> Acked-by: Timur Tabi <timur@tabi.org> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | tty/hvc_opal: constify of_device_id arrayFabian Frederick2015-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: sh-sci: Update calculation of timeout for DMANobuhiro Iwamatsu2015-03-261-9/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current calculation method in the case of 9600bps, rounding error occurs has become setting that occur timeout faster than the required time. When we use 9600bps, 32byte buffer, 10 bit (CS8) and 100 HZ, it becomes 3 jiffies (30msec). In fact it is necessary 33msec. This updates to the calculation that are not actually less than the value set by the rounding error. Also, this is nothing will be calculated value when there is no load. If there are a lot of case load, overrun error will occur immediately. This is by the buffer size to be calculated twice the DMA buffer, and add the change of setting a sufficient time-out value. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: sh-sci: Add overrun handling of SCIFA and SCIFBNobuhiro Iwamatsu2015-03-261-12/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SCIFA and SCIFB can detect the overrun, but it does not support. This adds overrun handling of SCIFA and SCIFB. Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | sc16is7xx: enable the clockJakub Kicinski2015-03-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although clk_disable_unprepare() is called both on .remove() and in .probe() error path, the clock is never actually enabled. Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Signed-off-by: Jon Ringle <jringle@gridpoint.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | sc16is7xx: don't wipe out port configuration on shutdownJakub Kicinski2015-03-261-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EFCR register contains RS-485 configuration which should not be changed by shutdown. Instead of doing a write only update the appropriate bits. Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Signed-off-by: Jon Ringle <jringle@gridpoint.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | sc16is7xx: remove ports on probe error pathJakub Kicinski2015-03-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If ports are not explicitly removed on the error path the device will not get properly unregistered leaving /dev/ttySC* nodes in the filesystem. Signed-off-by: Jakub Kicinski <kubakici@wp.pl> Signed-off-by: Jon Ringle <jringle@gridpoint.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>