summaryrefslogtreecommitdiffstats
path: root/drivers/tty
Commit message (Collapse)AuthorAgeFilesLines
* tty: serial: 8250_core: remove UART_IER_RDI in serial8250_stop_rx()Sebastian Andrzej Siewior2014-09-261-1/+1
| | | | | | | | | | | | | serial8250_do_startup() adds UART_IER_RDI and UART_IER_RLSI to ier. serial8250_stop_rx() should remove both. This is what the serial-omap driver has been doing and is now moved to the 8250-core since it does no look to be *that* omap specific. Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Tony Lindgren <tony@atomide.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: 8250_core: use the ->line argument as a hint in ↵Sebastian Andrzej Siewior2014-09-261-0/+5
| | | | | | | | | | | | | | | | | | | | | serial8250_find_match_or_unused() Tony noticed that the old omap-serial driver picked the uart "number" based on the hint given from device tree or platform device's id. The 8250 based omap driver doesn't do this because the core code does not honour the ->line argument which is passed by the driver. This patch aims to keep the same behaviour as with omap-serial. The function will first try to use the line suggested ->line argument and then fallback to the old strategy in case the port is taken. That means the the third uart will always be ttyS2 even if the previous two have not been enabled in DT. Reviewed-by: Tony Lindgren <tony@atomide.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: 8250_core: read only RX if there is something in the FIFOSebastian Andrzej Siewior2014-09-261-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The serial8250_do_startup() function unconditionally clears the interrupts and for that it reads from the RX-FIFO without checking if there is a byte in the FIFO or not. This works fine on OMAP4+ HW like AM335x or DRA7. OMAP3630 ES1.1 (which means probably all OMAP3 and earlier) does not like this: |Unhandled fault: external abort on non-linefetch (0x1028) at 0xfb020000 |Internal error: : 1028 [#1] ARM |Modules linked in: |CPU: 0 PID: 1 Comm: swapper Not tainted 3.16.0-00022-g7edcb57-dirty #1213 |task: de0572c0 ti: de058000 task.ti: de058000 |PC is at mem32_serial_in+0xc/0x1c |LR is at serial8250_do_startup+0x220/0x85c |Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel |Control: 10c5387d Table: 80004019 DAC: 00000015 |[<c03051d4>] (mem32_serial_in) from [<c0307fe8>] (serial8250_do_startup+0x220/0x85c) |[<c0307fe8>] (serial8250_do_startup) from [<c0309e00>] (omap_8250_startup+0x5c/0xe0) |[<c0309e00>] (omap_8250_startup) from [<c030863c>] (serial8250_startup+0x18/0x2c) |[<c030863c>] (serial8250_startup) from [<c030394c>] (uart_startup+0x78/0x1d8) |[<c030394c>] (uart_startup) from [<c0304678>] (uart_open+0xe8/0x114) |[<c0304678>] (uart_open) from [<c02e9e10>] (tty_open+0x1a8/0x5a4) Reviewed-by: Tony Lindgren <tony@atomide.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: 8250_core: add run time pmSebastian Andrzej Siewior2014-09-262-13/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While comparing the OMAP-serial and the 8250 part of this I noticed that the latter does not use run time-pm. Here are the pieces. It is basically a get before first register access and a last_busy + put after last access. This has to be enabled from userland _and_ UART_CAP_RPM is required for this. The runtime PM can usually work transparently in the background however there is one exception to this: After serial8250_tx_chars() completes there still may be unsent bytes in the FIFO (depending on CPU speed vs baud rate + flow control). Even if the TTY-buffer is empty we do not want RPM to disable the device because it won't send the remaining bytes. Instead we leave serial8250_tx_chars() with RPM enabled and wait for the FIFO empty interrupt. Once we enter serial8250_tx_chars() with an empty buffer we know that the FIFO is empty and since we are not going to send anything, we can disable the device. That xchg() is to ensure that serial8250_tx_chars() can be called multiple times and only the first invocation will actually invoke the runtime PM function. So that the last invocation of __stop_tx() will disable runtime pm. NOTE: do not enable RPM on the device unless you know what you do! If the device goes idle, it won't be woken up by incomming RX data _unless_ there is a wakeup irq configured which is usually the RX pin configure for wakeup via the reset module. The RX activity will then wake up the device from idle. However the first character is garbage and lost. The following bytes will be received once the device is up in time. On the beagle board xm (omap3) it takes approx 13ms from the first wakeup byte until the first byte that is received properly if the device was in core-off. v5…v8: - drop RPM from serial8250_set_mctrl() it will be used in restore path which already has RPM active and holds dev->power.lock v4…v5: - add a wrapper around rpm function and introduce UART_CAP_RPM to ensure RPM put is invoked after the TX FIFO is empty. v3…v4: - added runtime to the console code - removed device_may_wakeup() from serial8250_set_sleep() Cc: mika.westerberg@linux.intel.com Reviewed-by: Tony Lindgren <tony@atomide.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial: 8250_core: allow to set ->throttle / ->unthrottle callbacksSebastian Andrzej Siewior2014-09-261-0/+14
| | | | | | | | | | | | | | The OMAP UART provides support for HW assisted flow control. What is missing is the support to throttle / unthrottle callbacks which are used by the omap-serial driver at the moment. This patch adds the callbacks. It should be safe to add them since they are only invoked from the serial_core (uart_throttle()) if the feature flags are set. Reviewed-by: Tony Lindgren <tony@atomide.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Hold termios_rwsem for tcflow(TCIxxx)Peter Hurley2014-09-231-3/+7
| | | | | | | | | While transmitting a START/STOP char for tcflow(TCION/TCIOFF), prevent a termios change. Otherwise, a garbage in-band flow control char may be sent, if the termios change overlaps the transmission setup. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Move and rename send_prio_char() as tty_send_xchar()Peter Hurley2014-09-232-33/+33
| | | | | | | | | Relocate the file-scope function, send_prio_char(), as a global helper tty_send_xchar(). Remove the global declarations for tty_write_lock()/tty_write_unlock(), as these are file-scope only now. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Serialize tcflow() with other tty flow control changesPeter Hurley2014-09-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | Use newly-introduced tty->flow_lock to serialize updates to tty->flow_stopped (via tcflow()) and with concurrent tty flow control changes from other sources. Merge the storage for ->stopped and ->flow_stopped, now that both flags are serialized by ->flow_lock. The padding bits are necessary to force the compiler to allocate the type specified; otherwise, gcc will ignore the type specifier and allocate the minimum number of bytes necessary to store the bitfield. In turn, this would allow Alpha EV4 and EV5 cpus to corrupt adjacent byte storage because those cpus use RMW to store byte and short data. gcc versions < 4.7.2 will also corrupt storage adjacent to bitfields smaller than unsigned long on ia64, ppc64, hppa64 and sparc64, thus requiring more than unsigned int storage (which would otherwise be sufficient to workaround the Alpha non-atomic byte/short storage problem). Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Move packet mode flow control notifications to pty driverPeter Hurley2014-09-232-27/+45
| | | | | | | | | | | | | | | When a master pty is set to packet mode, flow control changes to the slave pty cause notifications to the master pty via reads and polls. However, these tests are occurring for all ttys, not just ptys. Implement flow control packet mode notifications in the pty driver. Only the slave side implements the flow control handlers since packet mode is asymmetric; the master pty receives notifications for slave-side changes, but not vice versa. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: Serialize tty flow control changes with flow_lockPeter Hurley2014-09-231-11/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | Without serialization, the flow control state can become inverted wrt. the actual hardware state. For example, CPU 0 | CPU 1 stop_tty() | lock ctrl_lock | tty->stopped = 1 | unlock ctrl_lock | | start_tty() | lock ctrl_lock | tty->stopped = 0 | unlock ctrl_lock | driver->start() driver->stop() | In this case, the flow control state now indicates the tty has been started, but the actual hardware state has actually been stopped. Introduce tty->flow_lock spinlock to serialize tty flow control changes. Split out unlocked __start_tty()/__stop_tty() flavors for use by ioctl(TCXONC) in follow-on patch. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: core: Use spin_lock_irq() in uart_set_termios()Peter Hurley2014-09-231-5/+4
| | | | | | | | uart_set_termios() is called with interrupts enabled; no need to save and restore the interrupt state when taking the uart port lock. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: bfin-uart: Fix auto CTSPeter Hurley2014-09-231-1/+2
| | | | | | | | | | | | | | Commit 64851636d568ae9f167cd5d1dcdbfe17e6eef73c, serial: bfin-uart: Remove ASYNC_CTS_FLOW flag for hardware automatic CTS, open-codes uart_handle_cts_change() when CONFIG_SERIAL_BFIN_HARD_CTSRTS to skip start and stop tx. But the CTS interrupt handler _still_ calls uart_handle_cts_change(); only call uart_handle_cts_change() if !CONFIG_SERIAL_BFIN_HARD_CTSRTS. cc: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: core: Privatize tty->hw_stoppedPeter Hurley2014-09-232-22/+20
| | | | | | | | | | | | | | tty->hw_stopped is not used by the tty core and is thread-unsafe; hw_stopped is a member of a bitfield whose fields are updated non-atomically and no lock is suitable for serializing updates. Replace serial core usage of tty->hw_stopped with uport->hw_stopped. Use int storage which works around Alpha EV4/5 non-atomic byte storage, since uart_port uses different locks to protect certain fields within the structure. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: core: Privatize modem status enable flagsPeter Hurley2014-09-232-13/+18
| | | | | | | | | | | | | | The serial core uses the tty port flags, ASYNC_CTS_FLOW and ASYNC_CD_CHECK, to track whether CTS and DCD changes should be ignored or handled. However, the tty port flags are not safe for atomic bit operations and no lock provides serialized updates. Introduce the struct uart_port status field to track CTS and DCD enable states, and serialize access with uart port lock. Substitute uart_cts_enabled() helper for tty_port_cts_enabled(). Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* serial: core: Document and assert lock requirements for irq helpersPeter Hurley2014-09-231-0/+8
| | | | | | | | | | | | | The serial core provides two helper functions, uart_handle_dcd_change() and uart_handle_cts_change(), for UART drivers to use at interrupt time. The serial core expects the UART driver to hold the uart port lock when calling these helpers to prevent state corruption. If lockdep enabled, trigger a warning if the uart port lock is not held when calling these helper functions. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tty: serial_mctrl_gpio: Fix COMPILE_TEST build for architectures with custom ↵Alexander Shiyan2014-09-201-1/+1
| | | | | | | | | | | | | | | | | | termios.h This patch fixes COMPILE_TEST build of serial_mctrl_gpio module for architectures with custom termios.h header. sparc64:allmodconfig: In file included from drivers/tty/serial/serial_mctrl_gpio.c:21:0: include/uapi/asm-generic/termios.h:22:8: error: redefinition of 'struct termio' ./arch/sparc/include/uapi/asm/termbits.h:16:8: note: originally defined here make[3]: *** [drivers/tty/serial/serial_mctrl_gpio.o] Error 1 Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge 3.17-rc5 into tty-nextGreg Kroah-Hartman2014-09-143-2/+44
|\ | | | | | | | | | | We want those fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * tty: xuartps: Fix tx_emtpy() callbackLars-Peter Clausen2014-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The tx_empty() callback currently checks the TXEMPTY bit in the interrupt status register to decided whether the FIFO should be reported as empty or not. The bit in this register gets set when the FIFO state transitions from non-empty to empty but is cleared again in the interrupt handler. This means it is not suitable to be used to decided whether the FIFO is currently empty or not. Instead use the TXEMPTY bit from the status register which will be set as long as the FIFO is empty. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * tty/serial: at91: BUG: disable interrupts when !UART_ENABLE_MS()Richard Genoud2014-09-081-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | In set_termios(), interrupts where not disabled if UART_ENABLE_MS() was false. Tested on at91sam9g35. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Cc: stable <stable@vger.kernel.org> # >= 3.16 Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * serial: 8250_dw: Add ACPI ID for Intel BraswellAlan Cox2014-09-081-0/+1
| | | | | | | | | | | | | | | | | | Another new ACPI identifier for the 8250 dw bindings to cover newer Intel SoCs such as Braswell. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty: serial: 8250: Add Mediatek UART driverMatthias Brugger2014-09-103-0/+301
| | | | | | | | | | | | | | | | | | | | | | The device has a highspeed register which influences the calcualtion of the divisor. The chip lacks support for some baudrates. When requested, we set the divisor to the next smaller baudrate and adjust the c_cflag accordingly. Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com> Reviewed-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: asc: Adopt readl_/writel_relaxed()Daniel Thompson2014-09-101-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The architectures supported by this driver, arm and sh, have expensive implementations of writel(), reliant on spin locks and explicit L2 cache management. These architectures provide a cheaper writel_relaxed() which is much better suited to peripherals that do not perform DMA. The situation with readl()/readl_relaxed()is similar although less acute. This driver does not use DMA and will be more power efficient and more robust (due to absence of spin locks during console I/O) if it uses the relaxed variants. The driver supports COMPILE_TEST and therefore falls back to writel() when writel_relaxed() does not exist. Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Acked-by: Srinivas Kandagatla <srinivas.kandagatla@gmail.com> Cc: Maxime Coquelin <maxime.coquelin@st.com> Cc: Patrice Chotard <patrice.chotard@st.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: kernel@stlinux.com Cc: linux-serial@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: clps711x: Fix COMPILE_TEST build for target without GPIOLIB supportAlexander Shiyan2014-09-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch fixes the following build error of CLPS711X serial driver for targets without GPIOLIB support: >> drivers/tty/serial/serial_mctrl_gpio.c:44:6: error: redefinition of 'mctrl_gpio_set' void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl) ^ In file included from drivers/tty/serial/serial_mctrl_gpio.c:23:0: drivers/tty/serial/serial_mctrl_gpio.h:80:6: note: previous definition of 'mctrl_gpio_set' was here void mctrl_gpio_set(struct mctrl_gpios *gpios, unsigned int mctrl) ^ Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial/8250_core: Add reference to uacess.hRicardo Ribalda Delgado2014-09-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit: e676253b19b2d269cccf67fdb1592120a0cd0676 [3/21] serial/8250: Add support for RS485 IOCTLs, adds a building error on arch m32r. All error/warnings: drivers/tty/serial/8250/8250_core.c: In function 'serial8250_ioctl': >> drivers/tty/serial/8250/8250_core.c:2859:3: error: implicit declaration of function 'copy_from_user' [-Werror=implicit-function-declaration] if (copy_from_user(&rs485_config, (void __user *)arg, ^ >> drivers/tty/serial/8250/8250_core.c:2871:3: error: implicit declaration of function 'copy_to_user' [-Werror=implicit-function-declaration] if (copy_to_user((void __user *)arg, &up->rs485, ^ cc1: some warnings being treated as errors Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty: serial: 8250_core: allow to overwrite & export serial8250_startup()Sebastian Andrzej Siewior2014-09-081-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | The OMAP version of the 8250 can actually use 1:1 serial8250_startup(). However it needs to be extended by a wake up irq which should to be requested & enabled at ->startup() time and disabled at ->shutdown() time. v2…v3: properly copy callbacks v1…v2: add shutdown callback Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty: serial: 8250_core: provide a function to export uart_8250_portSebastian Andrzej Siewior2014-09-082-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no way to access a struct uart_8250_port for a specific line. This is only required outside of the 8250/uart callbacks like for devices' suspend & remove callbacks. For those the 8250-core provides a wrapper like serial8250_unregister_port() which passes the struct to the proper function based on the line argument. For run time suspend I need access to this struct not only to make serial_out() work but also to properly restore up->ier and up->mcr. Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty/vt/keyboard: Resolve many shadow warningsMark Rustad2014-09-081-83/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many local variables were given the same name as a global. This is valid, but generates many shadow warnings in W=2 builds. Resolve them by changing the local names. Also change local variables named "up" because they shadow the semaphore "up" function. Also moved the outer declaration of the variable "a" because it is only used in one block, and that resolves all of the shadow warnings for the other declarations of "a" that have different types. Change diacr => dia, kbd => kb, rep => rpt, up => udp. Signed-off-by: Mark Rustad <mark.d.rustad@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty: vt8500_serial: explicitly calculate base baud rateAlexey Charkov2014-09-081-6/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Current code relies on the UART clock pre-divisor to be already configured in the baud rate register. Calculate it in the driver and set explicitly instead, also return the "real" effective baud rate, which is generally slightly different from the requested value. While at this, also ensure that break signal timing is updated when baud rate changes. Signed-off-by: Alexey Charkov <alchark@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty: vt8500_serial: add polled console functionsAlexey Charkov2014-09-081-0/+31
| | | | | | | | | | | | | | | | This adds simple polling functions for single-character transmit and receive, as used by kgdb. Signed-off-by: Alexey Charkov <alchark@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty: vt8500_serial: add missing support for RTS settingAlexey Charkov2014-09-081-0/+8
| | | | | | | | | | Signed-off-by: Alexey Charkov <alchark@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty: vt8500_serial: add support for UART in WM8880 chipsAlexey Charkov2014-09-081-14/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Newer WonderMedia chips introduced another flag in the UART line control register, which controls whether RTS/CTS signalling should be handled in the driver or by the hardware itself. This patch ensures that the kernel can control RTS/CTS (including disabling it altogether) by forcing this flag to software mode on affected chips (only WM8880 so far). Also remove the redundant copy of the binding doc, while we are here. Signed-off-by: Alexey Charkov <alchark@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: kgdb_nmi: No CON_ENABLED by defaultDaniel Thompson2014-09-081-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present this console is optionally registered by NULL checking arch_kgdb_ops.enable_nmi. In practice this requires the architecture dependant code to implement some kind of control (e.g. module arguments) to enable/disable this feature. The kernel already provides us the perfectly adequate console= argument to enable/disable consoles. Let's use that instead! Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Cc: Jiri Slaby <jslaby@suse.cz> Cc: linux-serial@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: amba-pl011: Use container_of() to get uart_amba_portDaniel Thompson2014-09-081-18/+36
| | | | | | | | | | | | | | | | | | | | | | | | Universally adopt container_of() for all pointer conversion from uart_port to uart_amba_port. Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Cc: Peter Hurley <peter@hurleysoftware.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Jiri Slaby <jslaby@suse.cz> Cc: linux-serial@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: imx: clean up imx_poll_get_char()Dirk Behme2014-09-081-25/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looking at the get_poll_char() function of the 8250.c serial driver, we learn: * poll_get_char() doesn't have to save/disable/restore the interrupt registers. No interrupt handling is needed in this function at all. Remove it. * Don't block in case there is no data available. So instead blocking in the do {} while loop, just return with NO_POLL_CHAR, immediately . Additionally, while the i.MX6 register URXD[7-0] contain the RX_DATA, the upper bits of this register (URXD[15-10]) might contain some control flags. To ensure that these are not returned with the data read, just mask out URXD[7-0]. These changes fix the 'hang' working with kdb: $ echo ttymxc3 > /sys/module/kgdboc/parameters/kgdboc $ echo g >/proc/sysrq-trigger [0]kdb> help ... <hang> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org> Cc: Jiri Slaby <jslaby@suse.cz> Cc: linux-serial@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: core: Unwrap tertiary assignment in uart_handle_dcd_change()Peter Hurley2014-09-081-5/+8
| | | | | | | | | | | | | | | | Prepare for spin lock assertion; move non-trivial assignment into function body. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: 8250: Document serial8250_modem_status() lockingPeter Hurley2014-09-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Existing callers of serial8250_modem_status() [1] hold the uart port lock; document. [1] In-tree callers of serial8250_modem_status() drivers/tty/serial/8250/8250_fsl.c fsl8250_handle_irq() drivers/tty/serial/8250/8250_core.c serial8250_handle_irq() serial8250_console_write() serial8250_get_mctrl() * * Call graphs for callers of serial8250_get_mctrl() from the function which acquires the uart port lock drivers/tty/serial/serial_core.c uart_port_startup() uart_tiocmget() uart_set_termios() uart_carrier_raised() ops->get_mctrl() ---> serial8250_get_mctrl() Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: blackfin: Fix missing gpio.hPeter Hurley2014-09-081-0/+1
| | | | | | | | | | | | | | | | If CONFIG_SERIAL_BFIN_CTSRTS is set, compile fails because of missing declarations for the gpio_* api. Include necessary header. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: sunsab: Don't enable tx if tx stoppedPeter Hurley2014-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The serial core may call the UART driver's start_tx() even if tx is stopped; the UART driver must verify tx should be enabled before transmitting. Reported-by: Sam Ravnborg <sam@ravnborg.org> cc: David S. Miller <davem@davemloft.net> cc: <sparclinux@vger.kernel.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: mpc52xx: Use default serial core x_char handlerPeter Hurley2014-09-081-17/+0
| | | | | | | | | | | | | | | | | | | | mpc52xx_uart_send_xchar() is _identical_ to the default serial core x_char handling behavior in uart_send_xchar(). Remove mpc52xx_uart_send_xchar(). Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: Fix send_xchar() handlersPeter Hurley2014-09-082-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | START_CHAR() & STOP_CHAR() can be disabled if set to '\0' (__DISABLED_CHAR). UART drivers which define a send_xchar() handler must not transmit __DISABLED_CHAR. Document requirement. Affected drivers: sunsab sunhv cc: David S. Miller <davem@davemloft.net> cc: <sparclinux@vger.kernel.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: core: Remove unsafe x_char optimizationPeter Hurley2014-09-081-6/+2
| | | | | | | | | | | | | | | | | | | | | | uart_unthrottle() attempts to avoid sending START and the previous x_char if the previous x_char has not yet been sent. However, this optimization could leave the sender in a throttled state; for example, if the sender is throttled and this unthrottle coincides with a manual tcflow(TCION) from user-space, then neither START would be sent. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: core: Fix x_char racePeter Hurley2014-09-081-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UART driver is expected to clear port->x_char after transmission while holding the port->lock. However, the serial core fails to take the port->lock before assigning port->xchar. This allows for the following race CPU 0 | CPU 1 | | serial8250_handle_irq | ... | serial8250_tx_chars | if (port->x_char) | serial_out(up, UART_TX, port->x_char) uart_send_xchar | port->x_char = ch | | port->x_char = 0 port->ops->start_tx() | | The x_char on CPU 0 will never be sent. Take the port->lock in uart_send_xchar() before assigning port->x_char. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: imx: Fix x_char handling and tx flow controlPeter Hurley2014-09-081-23/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The serial core expects the UART driver to transmit x_char (START/STOP chars) even if tx is stopped and before data already in the tx ring buffer if possible. Also, sending x_char must not cause additional data in the tx ring buffer to transmit if tx is stopped. Cause x_char to be transmitted before any other data is sent. Auto-stop tx if the tx ring buffer is empty or tx should be stopped. Only perform one write wakeup if tx ring buffer space is below threshold. x_char handling in DMA mode is still broken; add FIXME. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: Style fixPeter Hurley2014-09-081-2/+1
| | | | | | | | | | | | | | Unwrap if() conditional; no functional change. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | Revert "serial: uart: add hw flow control support configuration"Peter Hurley2014-09-083-17/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 06aa82e498c144c7784a6f3d3b55458b272d6146. This commit purports to enable auto CTS flow control for the 8250 UART driver. However, the 8250 UART driver already supports auto CTS flow control via UART_CAP_AFE and UART_CAP_EFR. Indeed, this patch introduces another DT attribute for which an existing firmware flag already exists ("auto-flow-control"). Furthermore, the use of UPF_HARD_FLOW requires the UART driver to define .throttle and .unthrottle methods, neither of which are defined for the 8250 UART driver (which will result in a NULL ptr dereference). Finally, this patch supposes to fix existing bugs in the serial core for auto CTS-enabled hardware, but does not include the class of hardware for which these bugs exist. CC: Murali Karicheri <m-karicheri2@ti.com> CC: Rob Herring <robh+dt@kernel.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | tty/serial: samsung: enable usage for 64-bit Exynos platformsNaveen Krishna Chatradhi2014-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | Allow Samsung serial driver to be usable on Exynos 64-bit SoC based platforms. Signed-off-by: Pankaj Dubey <pankaj.dubey@samsung.com> Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: vr41xx_siu: delete double assignmentJulia Lawall2014-09-081-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Delete successive assignments to the same location. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ expression i; @@ *i = ...; i = ...; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | serial: Fix build failure caused by missing header filePranith Kumar2014-09-081-0/+1
| | | | | | | | | | | | | | | | | | | | Fix build failure caused by missing header file: drivers/tty/serial/nwpserial.c: In function 'wait_for_bits': drivers/tty/serial/nwpserial.c:53:3: error: implicit declaration of function 'udelay' [-Werror=implicit-function-declaration] Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | ARM: meson: serial: add MesonX SoC on-chip uart driverCarlo Caione2014-09-083-0/+653
| | | | | | | | | | | | | | | | | | The SoC has four fully functional UARTs which use the same programming model. They are named UART_A, UART_B, UART_C and UART_AO (Always-On) which cannot be powered off. Signed-off-by: Carlo Caione <carlo@caione.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | drivers/tty/nozomi.c: Use 'nozomi_setup_memory' instead of 'setup_memory'Chen Gang2014-09-081-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several architectures (e.g. microblaze, um, and score) have already have extern 'setup_memory', so need use 'nozomi_setup_memory' instead of, or will cause compiling issue. The related error (with allmodconfig for microblaze): CC [M] drivers/tty/nozomi.o drivers/tty/nozomi.c:526:13: error: conflicting types for 'setup_memory' static void setup_memory(struct nozomi *dc) ^ In file included from include/linux/mm.h:51:0, from ./arch/microblaze/include/asm/io.h:17, from include/linux/io.h:22, from include/linux/pci.h:31, from drivers/tty/nozomi.c:46: ./arch/microblaze/include/asm/pgtable.h:569:6: note: previous declaration of 'setup_memory' was here void setup_memory(void); ^ Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Acked-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OpenPOWER on IntegriCloud