summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-11-08tty: Remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all tty files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Jiri Slaby <jslaby@suse.com> Cc: James Hogan <jhogan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serdev: Remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all tty files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Rob Herring <robh@kernel.org> Cc: Jiri Slaby <jslaby@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: hvc: Remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all tty files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Jiri Slaby <jslaby@suse.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Chris Metcalf <cmetcalf@mellanox.com> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serial: Remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all tty files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Jiri Slaby <jslaby@suse.com> Cc: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Ray Jui <rjui@broadcom.com> Cc: Scott Branden <sbranden@broadcom.com> Cc: bcm-kernel-feedback-list@broadcom.com Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: Joachim Eastwood <manabian@gmail.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Tobias Klauser <tklauser@distanz.ch> Cc: Russell King <linux@armlinux.org.uk> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Richard Genoud <richard.genoud@gmail.com> Cc: Alexander Shiyan <shc_work@mail.ru> Cc: Baruch Siach <baruch@tkos.co.il> Cc: Pat Gefre <pfg@sgi.com> Cc: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Vladimir Zapolskiy <vz@mleia.com> Cc: Sylvain Lemieux <slemieux.tyco@gmail.com> Cc: Carlo Caione <carlo@caione.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Andy Gross <andy.gross@linaro.org> Cc: David Brown <david.brown@linaro.org> Cc: "Andreas Färber" <afaerber@suse.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Laxman Dewangan <ldewangan@nvidia.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Jonathan Hunter <jonathanh@nvidia.com> Cc: Barry Song <baohua@kernel.org> Cc: Patrice Chotard <patrice.chotard@st.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Cc: Chris Metcalf <cmetcalf@mellanox.com> Cc: Peter Korsgaard <jacmet@sunsite.dk> Cc: Timur Tabi <timur@tabi.org> Cc: Tony Prisk <linux@prisktech.co.nz> Cc: Michal Simek <michal.simek@xilinx.com> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: add SPDX identifiers to all remaining files in drivers/tty/Greg Kroah-Hartman
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/tty files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Jiri Slaby <jslaby@suse.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Chris Metcalf <cmetcalf@mellanox.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: David Sterba <dsterba@suse.com> Cc: James Hogan <jhogan@kernel.org> Cc: Rob Herring <robh@kernel.org> Cc: Eric Anholt <eric@anholt.net> Cc: Stefan Wahren <stefan.wahren@i2se.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Ray Jui <rjui@broadcom.com> Cc: Scott Branden <sbranden@broadcom.com> Cc: bcm-kernel-feedback-list@broadcom.com Cc: "James E.J. Bottomley" <jejb@parisc-linux.org> Cc: Helge Deller <deller@gmx.de> Cc: Joachim Eastwood <manabian@gmail.com> Cc: Matthias Brugger <matthias.bgg@gmail.com> Cc: Masahiro Yamada <yamada.masahiro@socionext.com> Cc: Tobias Klauser <tklauser@distanz.ch> Cc: Russell King <linux@armlinux.org.uk> Cc: Vineet Gupta <vgupta@synopsys.com> Cc: Richard Genoud <richard.genoud@gmail.com> Cc: Alexander Shiyan <shc_work@mail.ru> Cc: Baruch Siach <baruch@tkos.co.il> Cc: "Maciej W. Rozycki" <macro@linux-mips.org> Cc: "Uwe Kleine-König" <kernel@pengutronix.de> Cc: Pat Gefre <pfg@sgi.com> Cc: "Guilherme G. Piccoli" <gpiccoli@linux.vnet.ibm.com> Cc: Jason Wessel <jason.wessel@windriver.com> Cc: Vladimir Zapolskiy <vz@mleia.com> Cc: Sylvain Lemieux <slemieux.tyco@gmail.com> Cc: Carlo Caione <carlo@caione.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Liviu Dudau <liviu.dudau@arm.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Andy Gross <andy.gross@linaro.org> Cc: David Brown <david.brown@linaro.org> Cc: "Andreas Färber" <afaerber@suse.de> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Laxman Dewangan <ldewangan@nvidia.com> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Jonathan Hunter <jonathanh@nvidia.com> Cc: Barry Song <baohua@kernel.org> Cc: Patrice Chotard <patrice.chotard@st.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Peter Korsgaard <jacmet@sunsite.dk> Cc: Timur Tabi <timur@tabi.org> Cc: Tony Prisk <linux@prisktech.co.nz> Cc: Michal Simek <michal.simek@xilinx.com> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Cc: Jiri Slaby <jslaby@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serial: jsm: remove redundant pointer tsColin Ian King
Pointer ts is assigned a value that is never read, ts is therefore redundant and can be removed. Cleans up clang warning: drivers/tty/serial/jsm/jsm_tty.c:285:2: warning: Value stored to 'ts' is never read Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serial: jsm: add space before the open parenthesis '('Gimcuan Hui
This patch fixes the checkpatch.pl complains: space required before the open parenthesis '('. Signed-off-by: Gimcuan Hui <gimcuan@gmail.com> Acked-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serial: jsm: fix coding styleGimcuan Hui
This patch fixes the checkpatch.pl complain: ERROR: else should follow close brace '}'. Signed-off-by: Gimcuan Hui <gimcuan@gmail.com> Acked-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serial: jsm: delete space between function name and '('Gimcuan Hui
This patch fixes checkpatch.pl warning: space prohibited between function name and open parenthesis '('. Signed-off-by: Gimcuan Hui <gimcuan@gmail.com> Acked-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serial: jsm: add blank line after declarationsGimcuan Hui
This patch fixes checkpatch.pl warning: Missing a blank line after declarations. Signed-off-by: Gimcuan Hui <gimcuan@gmail.com> Acked-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-08tty: serial: jsm: change the type of local variableGimcuan Hui
The return type of jsm_get_mstat was int, and the local var result was for the return should be int, make the change. This patch fixes the checkpatch.pl warning: Prefer 'unsigned int' to bare use of 'unsigned'. Signed-off-by: Gimcuan Hui <gimcuan@gmail.com> Acked-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04tty: serial: imx: remove dead code imx_dma_rxintTroy Kisky
Since commit 4dec2f119e86 ("imx-serial: RX DMA startup latency") the interrupt routine no longer will start rx dma. imx_dma_rxint no longer needs to be called to try and start dma. It won't start dma because dma_is_rxing is already true meaning dma is already started. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04tty: serial: imx: disable ageing timer interrupt if dma in useTroy Kisky
Since commit 4dec2f119e86 ("imx-serial: RX DMA startup latency") the interrupt routine no longer will start rx dma. So, we no longer need to enable this interrupt to start dma. Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: 8250: fix potential deadlock in rs485-modeTomas Melin
Canceling hrtimer when holding uart spinlock can deadlock. CPU0: syscall write -> get uart port spinlock -> write uart -> start_tx_rs485 -> hrtimer_cancel -> wait for hrtimer callback to finish CPU1: hrtimer IRQ -> run hrtimer -> em485_handle_stop_tx -> get uart port spinlock CPU0 is waiting for the hrtimer callback to finish, but the hrtimer callback running on CPU1 is waiting to get the uart port spinlock. This deadlock can be avoided by not canceling the hrtimers in these paths. Setting active_timer=NULL can be done without accessing hrtimer, and that will effectively cancel operations that would otherwise have been performed by the hrtimer callback. Signed-off-by: Tomas Melin <tomas.melin@vaisala.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: m32r_sio: Drop redundant .data assignmentKees Cook
With the timer converted to using the new timer_setup()/from_timer() API, setting the .data field is redundant (and the field will be removed soon), so drop it. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: imx: add hibernation supportPhilipp Zabel
During hibernation, freeze/thaw/restore dev_pm_ops are called instead of suspend/resume. Hook up the hibernation ops. The _noirq parts are identical, but suspend/resume are replaced with variants that do not enable wakeup from i.MX UART. There is no need to restore register contents in thaw_noirq. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: pl011: Adopt generic flag to store auto RTS statusLukas Wunner
Back in 2010, commit 3b43816f685f ("ARM: 5933/1: amba-pl011: support hardware flow control") added an autorts flag to this driver to store whether automatic hardware flow control is requested. In 2015, commit 391f93f2ec9f ("serial: core: Rework hw-assisted flow control support") added a flag with identical functionality to generic code. Switch over to that flag and drop the driver-specific one. Cc: Rabin Vincent <rabin.vincent@stericsson.com> Cc: Peter Hurley <peter@hurleysoftware.com> Cc: Russell King <linux@armlinux.org.uk> Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: 8250_fintek: Fix rs485 disablement on invalid ioctl()Lukas Wunner
This driver's ->rs485_config callback checks if SER_RS485_RTS_ON_SEND and SER_RS485_RTS_AFTER_SEND have the same value. If they do, it means the user has passed in invalid data with the TIOCSRS485 ioctl() since RTS must have a different polarity when sending and when not sending. In this case, rs485 mode is not enabled (the RS485_URA bit is not set in the RS485 Enable Register) and this is supposed to be signaled back to the user by clearing the SER_RS485_ENABLED bit in struct serial_rs485 ... except a missing tilde character is preventing that from happening. Fixes: 28e3fb6c4dce ("serial: Add support for Fintek F81216A LPC to 4 UART") Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Cc: "Ji-Ze Hong (Peter Hong)" <hpeter@gmail.com> Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: core: remove redundant assignment to portColin Ian King
The final assignment to port is never read, hence it is redundant and can be removed. Also move the declaration of port to a more local scope. Cleans up clang warning: drivers/tty/serial/serial_core.c:1498:2: warning: Value stored to 'port' is never read Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: sh-sci: Fix unlocked access to SCSCR registerTakatoshi Akiyama
The SCSCR register access in sci_break_ctl() is not locked. sci_start_tx() and sci_set_termios() changes the SCSCR register, but does not lock sci_port. Therefore, this patch adds lock during register access. Also, remove the log output that leads to a double lock. Some analysis of where locks are not taken is as follows. It appears that the lock is not taken in: - sci_start_tx(), sci_stop_tx() as this is installed as a callback. And all callers of the callback take the lock. - start_rx as callers take the lock. - stop_rx. this is both installed as a callback and called directly. In both cases the caller takes the lock. Signed-off-by: Takatoshi Akiyama <takatoshi.akiyama.kj@ps.hitachi-solutions.com> Signed-off-by: Takeshi Kihara <takeshi.kihara.df@renesas.com> Signed-off-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: mvebu-uart: drop incorrect memsetArnd Bergmann
gcc points out that the length passed into memset here is wrong: drivers/tty/serial/mvebu-uart.c: In function 'mvebu_uart_probe': arch/x86/include/asm/string_32.h:324:29: error: 'memset' used with length equal to number of elements without multiplication by element size [-Werror=memset-elt-size] Moreover, the structure was allocated with kzalloc a few lines earlier, so that memset is also unnecessary. Let's drop it to shut up the compiler warning. Fixes: 95f787685a22 ("serial: mvebu-uart: dissociate RX and TX interrupts") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04tty: max3100: remove unused variable rts and remove unused assignmentColin Ian King
Variable rts is being assigned but it is never read, hence it can be removed. The assignment to param_new to zero is redundant as it is being updates a few statements later, so remove this redundant assignment. Cleans up two clang warnings: drivers/tty/serial/max3100.c:277:3: warning: Value stored to 'rts' is never read drivers/tty/serial/max3100.c:439:2: warning: Value stored to 'param_new' is never read Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04tty: fix tty_ldisc_receive_buf() documentationJohan Hovold
The tty_ldisc_receive_buf() helper returns the number of bytes processed so drop the bogus "not" from the kernel doc comment. Fixes: 8d082cd300ab ("tty: Unify receive_buf() code paths") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04tty/serial: atmel: Convert timers to use timer_setup()Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Richard Genoud <richard.genoud@gmail.com> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04tty: cyclades: Convert timers to use timer_setup()Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Moves timer structures from global to attached to struct cyclades_port. Cc: Jiri Slaby <jslaby@suse.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04tty: vcc: Convert timers to use timer_setup()Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: "David S. Miller" <davem@davemloft.net> Cc: Jiri Slaby <jslaby@suse.com> Cc: sparclinux@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04tty/serial: altera_uart: Convert timers to use timer_setup()Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Tobias Klauser <tklauser@distanz.ch> Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Cc: nios2-dev@lists.rocketboards.org Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: sccnxp: Convert timers to use timer_setup()Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Jiri Slaby <jslaby@suse.com> Cc: linux-serial@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: bfin_uart: Convert timers to use timer_setup()Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Jiri Slaby <jslaby@suse.com> Cc: adi-buildroot-devel@lists.sourceforge.net Cc: linux-serial@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-04serial: 8250: Convert timers to use timer_setup()Kees Cook
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Jiri Slaby <jslaby@suse.com> Cc: Vignesh R <vigneshr@ti.com> Cc: Ed Blake <ed.blake@imgtec.com> Cc: Matthias Brugger <mbrugger@suse.com> Cc: Sean Young <sean@mess.org> Cc: linux-serial@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-23serdev: fix controller-allocation error handlingJohan Hovold
Reorder controller initialisation so that in the unlikely event that id allocation fails, we don't end up releasing id 0 in the destructor. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-23serdev: fix registration of second slaveJohan Hovold
Serdev currently only supports a single slave device, but the required sanity checks to prevent further registration attempts were missing. If a serial-port node has two child nodes with compatible properties, the OF code would try to register two slave devices using the same id and name. Driver core will not allow this (and there will be loud complaints), but the controller's slave pointer would already have been set to address of the soon to be deallocated second struct serdev_device. As the first slave device remains registered, this can lead to later use-after-free issues when the slave callbacks are accessed. Note that while the serdev registration helpers are exported, they are typically only called by serdev core. Any other (out-of-tree) callers must serialise registration and deregistration themselves. Fixes: cd6484e1830b ("serdev: Introduce new bus for serial attached devices") Cc: stable <stable@vger.kernel.org> # 4.11 Cc: Rob Herring <robh@kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-23serdev: ttyport: add missing open() error handlingJohan Hovold
Add missing error handling for tty-driver open() which may fail (e.g. if resource allocation fails or if a port is being disconnected). Note that close() must be called also in case of failed open() and that the operation sanity check is amended to catch buggy drivers. Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-23serdev: ttyport: enforce tty-driver open() requirementJohan Hovold
The tty-driver open routine is mandatory, but the serdev tty-port-controller implementation did not treat it as such and would instead fall back to calling tty_port_open() directly. Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-23serial: omap: Fix EFR write on RTS deassertionLukas Wunner
Commit 348f9bb31c56 ("serial: omap: Fix RTS handling") sought to enable auto RTS upon manual RTS assertion and disable it on deassertion. However it seems the latter was done incorrectly, it clears all bits in the Extended Features Register *except* auto RTS. Fixes: 348f9bb31c56 ("serial: omap: Fix RTS handling") Cc: Peter Hurley <peter@hurleysoftware.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-23omap_serial: Removing superfluous check on no interrupt pending.Martin Townsend
The do .. while loop checks for interrupt pending at the start of the loop and exits if there is none, it then checks again for this condition at the end of the loop. Signed-off-by: Martin Townsend <mtownsend1973@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20ACPI / scan: Fix enumeration for special UART devicesFrédéric Danis
UART devices is expected to be enumerated by SerDev subsystem. During ACPI scan, serial devices behind SPI, I2C or UART buses are not enumerated, allowing them to be enumerated by their respective parents. Rename *spi_i2c_slave* to *serial_bus_slave* as this will be used for serial devices on serial buses (SPI, I2C or UART). On Macs an empty ResourceTemplate is returned for uart slaves. Instead the device properties "baud", "parity", "dataBits", "stopBits" are provided. Add a check for "baud" in acpi_is_serial_bus_slave(). Signed-off-by: Frédéric Danis <frederic.danis.oss@gmail.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Tested-by: Ronald Tschalär <ronald@innovation.ch> Tested-by: Peter Y. Chuang <peteryuchuang@gmail.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serdev: Add ACPI supportFrédéric Danis
This patch allows SerDev module to manage serial devices declared as attached to an UART in ACPI table. acpi_serdev_add_device() callback will only take into account entries without enumerated flag set. This flags is set for all entries during ACPI scan, except for SPI and I2C serial devices, and for UART with 2nd patch in the series. Check if a serdev device as been allocated during acpi_walk_namespace() to prevent serdev controller registration instead of the tty-class device. Signed-off-by: Frédéric Danis <frederic.danis.oss@gmail.com> Reviewed-by: Rob Herring <robh@kernel.org> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Reviewed-by: Johan Hovold <johan@kernel.org> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: support extended port registers layoutMiquel Raynal
Define the missing register offsets and bit fields for the extended UART port. Add a second driver data structure filled with its port data, selected with the right compatible (marvell,armada-3700-uart-ext). Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: augment the maximum number of portsMiquel Raynal
A3700 boards may have up to two UART ports. Set the new limit to two maximum UART ports. Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: dissociate RX and TX interruptsMiquel Raynal
While the standard UART port can use a single IRQ that 'sums' both RX and TX interrupts, the extended port cannot and has to use two different ISR, one for each direction. The standard port also has the hability to use two separate interrupts (one for each direction). The logic is then: either there is only one unnamed interrupt on the standard port and this interrupt must be used for both directions (this is legacy bindings); or all the interrupts must be described and named 'uart-sum' (if available), 'uart-rx', 'uart-tx' and two separate handlers for each direction will be used. Suggested-by: Allen Yan <yanwei@marvell.com> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: add TX interrupt trigger for pulse interruptsAllen Yan
Pulse interrupts (extended UART only) needs a change of state to trigger the TX interrupt. In addition to enabling the TX_READY_INT_EN flag, produce a FIFO state change from 'empty' to 'not full'. For this, write only one data byte in TX start, making the TX FIFO not empty, and wait for the TX interrupt to continue the transfer. Signed-off-by: Allen Yan <yanwei@marvell.com> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: clear state register before IRQ requestAllen Yan
When receiving data on RX pin before ->uart_startup() is called, some error bits in the state register could be set up (like BRK_DET). This is harmless when using only the standard UART (error bits are read-only), but may procude an endless loop once in the extended UART RX interrupt handler (error bits must be cleared). Clear the status register in ->uart_startup() to avoid this situation. Signed-off-by: Allen Yan <yanwei@marvell.com> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: add function to change baudrateAllen Yan
Until now, the first UART port baudrate was set by the bootloader. Add a function allowing to change the baudrate. Changes may be done from userspace but also at probe time by the kernel. Use the simplest method: baudrate divisor. Works for all UART ports until 230400 baud. To achieve higher baudrates, software should implement the fractional divisor feature that allows more accuracy for higher rates. Signed-off-by: Allen Yan <yanwei@marvell.com> [<miquel.raynal@free-electrons.com>: changed termios handling] Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: add soft reset at probeAllen Yan
The existing UART driver relies on the bootloader to initialize the port(s). However, the secondary uart port may not be initialized properly in early boot stage. This patch adds the UART soft reset when probing, for all ports. Signed-off-by: Allen Yan <yanwei@marvell.com> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: use a generic way to access the registersMiquel Raynal
There are two UART ports on Armada3700. The second UART is based on the first one, plus additional features, but it has a different register layout (some bit fields are also moved inside the registers). Clearly separate register offsets and bit fields that differ between the standard and the extended IP. Access them in a generic way. Rename the defines with the "STD" prefix for future distinction with "EXT" defines. Point to these defines in the main driver data structure. The early console only uses the standard port (not extended). Suggested-by: Wilson Ding <dingwei@marvell.com> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: support probe of multiple portsAllen Yan
Until now, the mvebu-uart driver only supported probing a single UART port. However, some platforms have multiple instances of this UART controller, and therefore the driver should support multiple ports. In order to achieve this, we make sure to assign port->line properly, instead of hardcoding it to zero. Signed-off-by: Allen Yan <yanwei@marvell.com> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial: mvebu-uart: use driver name when requesting an interruptYehuda Yitschak
Use the driver name when requesting an interrupt for consistency. Avoids possible confusion with DW8250 driver interrupt names in /proc/interrupts. Signed-off-by: Yehuda Yitschak <yehuday@marvell.com> Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serial-uartlite: pr_err() strings should end with newlinesArvind Yadav
pr_err() messages should end with a new-line to avoid other messages being concatenated. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-20serdev: enable TTY port controller support by defaultJohan Hovold
Amend the Serial device bus Kconfig entries to clarify that you most likely also want to enable TTY port controller support, and make SERIAL_DEV_CTRL_TTYPORT default to Y (when bus support is enabled). Note that the TTY port controller is currently the only in-kernel serdev controller implementation. Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>