]> git.kernelconcepts.de Git - karo-tx-linux.git/log
karo-tx-linux.git
7 years agotty: pl011: Work around QDF2400 E44 stuck BUSY bit
Christopher Covington [Wed, 15 Feb 2017 21:39:43 +0000 (16:39 -0500)]
tty: pl011: Work around QDF2400 E44 stuck BUSY bit

The Qualcomm Datacenter Technologies QDF2400 family of SoCs contains a
custom (non-PrimeCell) implementation of the SBSA UART. Occasionally the
BUSY bit in the Flag Register gets stuck as 1, erratum 44 for both 2432v1
and 2400v1 SoCs.Checking that the Transmit FIFO Empty (TXFE) bit is 0,
instead of checking that the BUSY bit is 1, works around the issue.

To facilitate this substitution of flags and values, introduce
vendor-specific inversion of Feature Register bits when UART AMBA Port
(UAP) data is available. For the earlycon case, prior to UAP availability,
implement alternative putc and early_write functions.

Similar to what how ARMv8 ACPI PCI quirks are detected during MCFG parsing,
check the OEM fields of the Serial Port Console Redirection (SPCR) ACPI
table to determine if the current platform is known to be affected by the
erratum.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Timur Tabi <timur@codeaurora.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoatmel_serial: Use the fractional divider when possible
Romain Izard [Fri, 10 Feb 2017 15:24:46 +0000 (16:24 +0100)]
atmel_serial: Use the fractional divider when possible

The fractional baud rate generator is available when using the
asynchronous mode of Atmel USART controllers. It makes it possible to
use higher baudrates, in exchange for a less precise clock with a
variable duty cycle.

The existing code restricts its use to the normal mode of the USART
controller, following the recommendation from the datasheet for the
first chip embedding this type of controller. This recommendation has
been removed from the documentation for the newer chips. After
verification, all revisions of this controller should be able to use the
fractional baud rate generator with the different asynchronous modes.

Removing the condition on ATMEL_US_USMODE makes it possible to get
correct baudrates at high speed in more cases.

This was tested with a board using an Atmel SAMA5D2 chip and a TI
WL1831 WiFi/Bluetooth combo chip at 3 Mbauds, with hardware flow control
enabled.

Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty: Remove extra include in HVC console tty framework
Sergio Valverde [Tue, 31 Jan 2017 19:33:47 +0000 (13:33 -0600)]
tty: Remove extra include in HVC console tty framework

An extra "init.h" include is found in the HVC console code. As such,
the extra line is deleted.

Signed-off-by: Sergio Valverde <vlvrdv@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: exar: Enable MSI support
Jan Kiszka [Wed, 8 Feb 2017 16:09:09 +0000 (17:09 +0100)]
serial: exar: Enable MSI support

Use pci_alloc_irq_vectors to enable MSI when available. At least the
XR17V352 supports this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: exar: Move register defines from uapi header to consumer site
Jan Kiszka [Wed, 8 Feb 2017 16:09:08 +0000 (17:09 +0100)]
serial: exar: Move register defines from uapi header to consumer site

None of these registers is relevant for the userspace API.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: pci: Remove unused pci_boards entries
Jan Kiszka [Wed, 8 Feb 2017 16:09:07 +0000 (17:09 +0100)]
serial: pci: Remove unused pci_boards entries

Became obsolete with the split-out of 8250_exar.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: exar: Move Commtech adapters to 8250_exar as well
Jan Kiszka [Wed, 8 Feb 2017 16:09:06 +0000 (17:09 +0100)]
serial: exar: Move Commtech adapters to 8250_exar as well

Those are Exar-based, too.

With the required refactoring of the code to fit into 8250_exar, we
automatically fix the same issue pci_xr17v35x_setup had before: 8XMODE,
FCTL, TXTRG and RXTRG were always only set for port 0. Now they are
initialized for the correct target port by using port.membase.

Now we can also cleanly fix the blacklist of 8250_pci so that all
Commtech devices are rejected and 8250_exar can handle them.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: exar: Fix feature control register constants
Jan Kiszka [Wed, 8 Feb 2017 16:09:05 +0000 (17:09 +0100)]
serial: exar: Fix feature control register constants

According to the XR17V352 manual, bit 4 is IrDA control and bit 5 for
485. Fortunately, no driver used them so far.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: exar: Fix initialization of EXAR registers for ports > 0
Jan Kiszka [Wed, 8 Feb 2017 16:09:04 +0000 (17:09 +0100)]
serial: exar: Fix initialization of EXAR registers for ports > 0

So far, pci_xr17v35x_setup always initialized 8XMODE, FCTR & Co. for
port 0 because it used the address of that port instead of moving the
pointer according to the port number. Fix this and remove the unneeded
temporary ioremap by moving default_setup up and reusing the membase it
fills into the port structure.

Fixes: 14faa8cce88e ("tty/8250 Add support for Commtech's Fastcom Async-335 and Fastcom Async-PCIe cards")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: exar: Fix mapping of port I/O resources
Jan Kiszka [Wed, 8 Feb 2017 16:09:03 +0000 (17:09 +0100)]
serial: exar: Fix mapping of port I/O resources

pcim_iomap_table only returns the table of mapping, it does not perform
them. For that, we need to call pcim_iomap, but only if that mapping was
not done before.

Fixes: d0aeaa83f0b0 ("serial: exar: split out the exar code from 8250_pci")
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: fix hardware RX trigger level setting
Ulrich Hecht [Wed, 8 Feb 2017 17:31:14 +0000 (18:31 +0100)]
serial: sh-sci: fix hardware RX trigger level setting

1. Do not set the RX trigger level for software timeout devices on reset;
there is no timeout by default, and data will rot.
2. Do set the RX trigger level for hardware timeout devices when set
via sysfs attribute.

Fixes SCIFA-type serial consoles.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty/serial: atmel: ensure state is restored after suspending
Alexandre Belloni [Fri, 3 Feb 2017 22:53:16 +0000 (23:53 +0100)]
tty/serial: atmel: ensure state is restored after suspending

When going to suspend, the UART registers may be lost because the power to
VDDcore is cut. This is not an issue in the normal case but when
no_console_suspend is used, we need to restore the registers in order to
get a functional console.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Reviewed-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_dw: Avoid "too much work" from bogus rx timeout interrupt
Douglas Anderson [Mon, 6 Feb 2017 23:30:00 +0000 (15:30 -0800)]
serial: 8250_dw: Avoid "too much work" from bogus rx timeout interrupt

On a Rockchip rk3399-based board during suspend/resume testing, we
found that we could get the console UART into a state where it would
print this to the console a lot:
  serial8250: too much work for irq42

Followed eventually by:
  NMI watchdog: BUG: soft lockup - CPU#0 stuck for 11s!

Upon debugging I found that we're in this state:
  iir = 0x000000cc
  lsr = 0x00000060

It appears that somehow we have a RX Timeout interrupt but there is no
actual data present to receive.  When we're in this state the UART
driver claims that it handled the interrupt but it actually doesn't
really do anything.  This means that we keep getting the interrupt
over and over again.

Normally we don't actually need to do anything special to handle a RX
Timeout interrupt.  We'll notice that there is some data ready and
we'll read it, which will end up clearing the RX Timeout.  In this
case we have a problem specifically because we got the RX TImeout
without any data.  Reading a bogus byte is confirmed to get us out of
this state.

It's unclear how exactly the UART got into this state, but it is known
that the UART lines are essentially undriven and unpowered during
suspend, so possibly during resume some garbage / half transmitted
bits are seen on the line and put the UART into this state.

The UART on the rk3399 is a DesignWare based 8250 UART.  From mailing
list posts, it appears that other people have run into similar
problems with DesignWare based IP.  Presumably this problem is unique
to that IP, so I have placed the workaround there to avoid possibly of
accidentally triggering bad behavior on other IP.  Also note the RX
Timeout behaves very differently in the DMA case, for for now the
workaround is only applied to the non-DMA case.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserdev: ttyport: check whether tty_init_dev() fails
Dan Carpenter [Wed, 8 Feb 2017 07:23:24 +0000 (10:23 +0300)]
serdev: ttyport: check whether tty_init_dev() fails

My static checker complains that we don't have any error handling here.
It's simple enough to add it.

Fixes: bed35c6dfa6a ("serdev: add a tty port controller driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_pci: make pciserial_detach_ports() static
Wei Yongjun [Sun, 5 Feb 2017 16:12:34 +0000 (16:12 +0000)]
serial: 8250_pci: make pciserial_detach_ports() static

Fixes the following sparse warning:

drivers/tty/serial/8250/8250_pci.c:3916:6: warning:
 symbol 'pciserial_detach_ports' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoARM: dts: STiH410-b2260: Enable HW flow-control
Lee Jones [Fri, 3 Feb 2017 10:23:19 +0000 (10:23 +0000)]
ARM: dts: STiH410-b2260: Enable HW flow-control

Hardware flow-control capability must be specified at a platform
level in order to inform the ASC driver that the platform is capable
(i.e. are the lines wired up, etc).  STiH4{07,10} devices are indeed
capable, so let's provide the property.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoARM: dts: STiH407-family: Use new Pinctrl groups
Lee Jones [Fri, 3 Feb 2017 10:23:18 +0000 (10:23 +0000)]
ARM: dts: STiH407-family: Use new Pinctrl groups

Having just defined some new Pinctrl groups for when HW flow-control
is {en,dis}abled, let's reference them for use within the driver.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoARM: dts: STiH407-pinctrl: Add Pinctrl group for HW flow-control
Lee Jones [Fri, 3 Feb 2017 10:23:17 +0000 (10:23 +0000)]
ARM: dts: STiH407-pinctrl: Add Pinctrl group for HW flow-control

Each serial port which supports HW flow-control should have 2 Pinctrl
groups.  One for when HW flow-control is in progress, where the IP
will take over controlling the lines and another group which enables
the lines to be toggled using GPIO mechanisms.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoARM: dts: STiH410-b2260: Identify the UART RTS line
Lee Jones [Fri, 3 Feb 2017 10:23:16 +0000 (10:23 +0000)]
ARM: dts: STiH410-b2260: Identify the UART RTS line

When hardware flow-control is disabled, manual toggling of the UART's
reset line (RTS) using userland applications (e.g. stty) is not
possible, since the ASC IP does not provide this functionality in the
same was as some other IPs do.  Thus, we have to do this manually.
This patch configures the UART RTS line as a GPIO for manipulation
within the UART driver when HW flow-control is not enabled.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodt-bindings: serial: Update 'uart-has-rtscts' description
Lee Jones [Fri, 3 Feb 2017 10:23:15 +0000 (10:23 +0000)]
dt-bindings: serial: Update 'uart-has-rtscts' description

'uart-has-rtscts' property and 'rts-gpios|cts-gpios' are normally
mutually exclusive, however it is possible for some drivers to have
a dynamic approach, meaning that both properties can be relevant.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: st-asc: Use generic DT binding for announcing RTS/CTS lines
Lee Jones [Fri, 3 Feb 2017 10:23:14 +0000 (10:23 +0000)]
serial: st-asc: Use generic DT binding for announcing RTS/CTS lines

The initial binding 'st,hw-flow-control' isn't used anywhere, in neither
in upstream nor downstream kernels.  It isn't even documented in
dt-bindings, so we can safely assume it's safe to swap to the generic
one.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: st-asc: (De)Register GPIOD and swap Pinctrl profiles
Lee Jones [Fri, 3 Feb 2017 10:23:13 +0000 (10:23 +0000)]
serial: st-asc: (De)Register GPIOD and swap Pinctrl profiles

When hardware flow-control is disabled, manual toggling of the UART's
reset line (RTS) using userland applications (e.g. stty) is not
possible, since the ASC IP does not provide this functionality in the
same was as some other IPs do.  Thus, we have to do this manually.

This patch ensures that when HW flow-control is disabled the RTS/CTS
lines are free to be registered via the GPIO API.  It also ensures
any registered GPIO lines are unregistered when HW flow-control is
requested, allowing the IP to control them automatically.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: st-asc: Read in all Pinctrl states
Lee Jones [Fri, 3 Feb 2017 10:23:12 +0000 (10:23 +0000)]
serial: st-asc: Read in all Pinctrl states

There are now 2 possible separate/different Pinctrl states which can
be provided from platform data.  One which encompasses the lines
required for HW flow-control (CTS/RTS) and another which does not
specify these lines, such that they can be used via GPIO mechanisms
for manually toggling (i.e. from a request by `stty`).

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: st-asc: Provide RTS functionality
Lee Jones [Fri, 3 Feb 2017 10:23:11 +0000 (10:23 +0000)]
serial: st-asc: Provide RTS functionality

Until this point, it has not been possible for userland serial
applications (e.g. stty) to toggle the UART RTS line.  This can
be useful with certain configurations. For example, when using
a Mezzanine on a Linaro 96board, RTS line is used to take the
on-board microcontroller in and out of reset.

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: st-asc: Ignore the parity error bit if 8-bit mode is enabled
Lee Jones [Fri, 3 Feb 2017 10:23:10 +0000 (10:23 +0000)]
serial: st-asc: Ignore the parity error bit if 8-bit mode is enabled

The datasheet states:

"If the MODE field selects an 8-bit frame then this [parity error] bit
 is undefined. Software should ignore this bit when reading 8-bit frames."

Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_pci: Add MKS Tenta SCOM-0800 and SCOM-0801 cards
Ian Abbott [Fri, 3 Feb 2017 20:25:00 +0000 (20:25 +0000)]
serial: 8250_pci: Add MKS Tenta SCOM-0800 and SCOM-0801 cards

The MKS Instruments SCOM-0800 and SCOM-0801 cards (originally by Tenta
Technologies) are 3U CompactPCI serial cards with 4 and 8 serial ports,
respectively.  The first 4 ports are implemented by an OX16PCI954 chip,
and the second 4 ports are implemented by an OX16C954 chip on a local
bus, bridged by the second PCI function of the OX16PCI954.  The ports
are jumper-selectable as RS-232 and RS-422/485, and the UARTs use a
non-standard oscillator frequency of 20 MHz (base_baud = 1250000).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: make RX FIFO parameters tunable via sysfs
Ulrich Hecht [Fri, 3 Feb 2017 10:38:19 +0000 (11:38 +0100)]
serial: sh-sci: make RX FIFO parameters tunable via sysfs

Allows tuning of the RX FIFO fill threshold and timeout. (The latter is
only applicable to SCIFA and SCIFB).

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: SCIFA/B RX FIFO software timeout
Ulrich Hecht [Fri, 3 Feb 2017 10:38:18 +0000 (11:38 +0100)]
serial: sh-sci: SCIFA/B RX FIFO software timeout

Implements support for FIFO fill thresholds greater than one with software
timeout.

This mechanism is not possible (or at least not useful) on SCIF family
hardware other than SCIFA and SCIFB because they do not support turning off
the DR hardware timeout interrupt separately from the RI interrupt.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: increase RX FIFO trigger defaults for (H)SCIF
Ulrich Hecht [Fri, 3 Feb 2017 10:38:17 +0000 (11:38 +0100)]
serial: sh-sci: increase RX FIFO trigger defaults for (H)SCIF

Sets reasonable trigger defaults for the various SCIF variants.
Also corrects the FIFO size for SH7705-style ports.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty_port: register tty ports with serdev bus
Rob Herring [Thu, 2 Feb 2017 19:48:09 +0000 (13:48 -0600)]
tty_port: register tty ports with serdev bus

Register a serdev controller with the serdev bus when a tty_port is
registered. This creates the serdev controller and create's serdev
devices for any DT child nodes of the tty_port's parent (i.e. the UART
device).

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Tested-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserdev: add a tty port controller driver
Rob Herring [Thu, 2 Feb 2017 19:48:08 +0000 (13:48 -0600)]
serdev: add a tty port controller driver

Add a serdev controller driver for tty ports.

The controller is registered with serdev when tty ports are registered
with the TTY core. As the TTY core is built-in only, this has the side
effect of making serdev built-in as well.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Tested-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserdev: Introduce new bus for serial attached devices
Rob Herring [Thu, 2 Feb 2017 19:48:07 +0000 (13:48 -0600)]
serdev: Introduce new bus for serial attached devices

The serdev bus is designed for devices such as Bluetooth, WiFi, GPS
and NFC connected to UARTs on host processors. Tradionally these have
been handled with tty line disciplines, rfkill, and userspace glue such
as hciattach. This approach has many drawbacks since it doesn't fit
into the Linux driver model. Handling of sideband signals, power control
and firmware loading are the main issues.

This creates a serdev bus with controllers (i.e. host serial ports) and
attached devices. Typically, these are point to point connections, but
some devices have muxing protocols or a h/w mux is conceivable. Any
muxing is not yet supported with the serdev bus.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Tested-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agodt/bindings: Add a serial/UART attached device binding
Rob Herring [Thu, 2 Feb 2017 19:48:06 +0000 (13:48 -0600)]
dt/bindings: Add a serial/UART attached device binding

Add a common binding for describing serial/UART attached devices. Common
examples are Bluetooth, WiFi, NFC and GPS devices.

Serial attached devices are represented as child nodes of a UART node.
This may need to be extended for more complex devices with multiple
interfaces, but for the simple cases a child node is sufficient.

Tested-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty_port: Add port client functions
Rob Herring [Thu, 2 Feb 2017 19:48:05 +0000 (13:48 -0600)]
tty_port: Add port client functions

Introduce a client (upward direction) operations struct for tty_port
clients. Initially supported operations are for receiving data and write
wake-up. This will allow for having clients other than an ldisc.

Convert the calls to the ldisc to use the client ops as the default
operations.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Tested-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: implement FIFO threshold register setting
Ulrich Hecht [Thu, 2 Feb 2017 17:10:16 +0000 (18:10 +0100)]
serial: sh-sci: implement FIFO threshold register setting

Sets the closest match for a desired RX trigger level.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: consider DR (data ready) bit adequately
Ulrich Hecht [Thu, 2 Feb 2017 17:10:15 +0000 (18:10 +0100)]
serial: sh-sci: consider DR (data ready) bit adequately

To allow operation with a higher RX FIFO interrupt threshold in PIO
mode, it is necessary to consider the DR bit ("FIFO not full, but no
data received for 1.5 frames") as an indicator that data can be read.
Otherwise the driver will let data rot in the FIFO until the threshold
is reached.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: add FIFO trigger bits
Ulrich Hecht [Thu, 2 Feb 2017 17:10:14 +0000 (18:10 +0100)]
serial: sh-sci: add FIFO trigger bits

Defines the bits controlling FIFO thresholds, adds the additional
HSCIF registers to the register map.

Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty: serial: cpm_uart: make use of for_each_node_by_type()
Dmitry Torokhov [Wed, 1 Feb 2017 23:20:12 +0000 (15:20 -0800)]
tty: serial: cpm_uart: make use of for_each_node_by_type()

Instead of open-coding loop with of_find_node_by_type(), let's use canned
macro.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty: serial: pl011: add ttyAMA for matching pl011 console
Sudeep Holla [Wed, 1 Feb 2017 15:46:38 +0000 (15:46 +0000)]
tty: serial: pl011: add ttyAMA for matching pl011 console

Commit c7cef0a84912 ("console: Add extensible console matching") added
match() method to struct console which allows the console to perform
console command line matching instead of (or in addition to) default
console matching (ie., by fixed name and index).

Commit ad1696f6f09d ("ACPI: parse SPCR and enable matching console")
introduced support for SPCR as matching console.

Commit 10879ae5f12e ("serial: pl011: add console matching function")
added the match method for pl011 console which checks for the console
string to be "pl011"

Now on a platform which has both SPCR in the ACPI tables and ttyAMA in
the command line, the ttyAMA is chosen as "selected console" but it
doesn't pass the matching console method which results in CON_CONSDEV
not being set on the "selected console".

As a result of that, the bootconsole(SPCR in the above case) is not
unregistered and all the beginning boot messages are seen twice.

This patch adds "ttyAMA" so that it's considered to match pl011 console.

Fixes: 10879ae5f12e ("serial: pl011: add console matching function")
Cc: Russell King <linux@armlinux.org.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Aleksey Makarov <aleksey.makarov@linaro.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: samsung: enable clock before accessing interrupt mask resister
남영민 [Wed, 1 Feb 2017 10:25:46 +0000 (19:25 +0900)]
serial: samsung: enable clock before accessing interrupt mask resister

Ensure that the uart clock is enabled prior to writing to the
interrupt mask register in s3c24xx_serial_resume_noirq function.
Without enabing the uart clock, the uart register cannot be accessed.

Signed-off-by: Youngmin Nam <youngmin.nam@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_pci: remove exar code
Sudip Mukherjee [Mon, 30 Jan 2017 22:28:22 +0000 (22:28 +0000)]
serial: 8250_pci: remove exar code

Remove the Exar specific codes from 8250_pci and blacklist those chips
so that the new Exar serial driver binds to the devices.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: exar: split out the exar code from 8250_pci
Sudip Mukherjee [Mon, 30 Jan 2017 22:28:21 +0000 (22:28 +0000)]
serial: exar: split out the exar code from 8250_pci

Add the serial driver for the Exar chips. And also register the
platform device for the GPIO provided by the Exar chips.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: imx: Fix the CTS_B polarity in RS485 mode
Fabio Estevam [Mon, 30 Jan 2017 11:12:12 +0000 (09:12 -0200)]
serial: imx: Fix the CTS_B polarity in RS485 mode

When userspace passes the SER_RS485_RTS_ON_SEND flag it means that the
CTS_B pin should go to logic level high before the transmission begins.

CTS_B goes to logic level high when both CTSC and CTS bits are cleared.

When userspace passes the SER_RS485_RTS_AFTER_SEND flag it means that the
CTS_B pin should go to logic level low after the transmission finishes.

CTS_B goes to logic level low when CTSC bit is cleared and CTS bit is set.

So fix the CTS_B polarity logic.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: imx: Fix the RTS GPIO polarity in RS485 mode
Fabio Estevam [Mon, 30 Jan 2017 11:12:11 +0000 (09:12 -0200)]
serial: imx: Fix the RTS GPIO polarity in RS485 mode

On a board that needs to drive RTS GPIO high in order to enable the
transmission of a RS485 transceiver the following description is
passed in the devide tree:

&uart4 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart4>;
        rts-gpios = <&gpio6 2 GPIO_ACTIVE_HIGH>;
        status = "okay";
};

and userspace configures the uart port as follows:

/* enable RS485 mode: */
rs485conf.flags |= SER_RS485_ENABLED;

/* set logical level for RTS pin equal to 1 when sending: */
rs485conf.flags |= SER_RS485_RTS_ON_SEND;

/* set logical level for RTS pin equal to 0 after sending: */
rs485conf.flags &= ~(SER_RS485_RTS_AFTER_SEND);

However the RTS GPIO polarity observed in the oscilloscope is inverted.

When the SER_RS485_RTS_ON_SEND flag is set the imx_port_rts_active()
function should be called and following the same logic when
SER_RS485_RTS_AFTER_SEND flag is cleared the imx_port_rts_inactive()
should be called.

Do such logic change so that RS485 communication in half duplex can
work successfully when the RTS GPIO pin is passed via device tree.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years ago8250: of: remove remnants of generic of_serial driver
Arnd Bergmann [Wed, 25 Jan 2017 22:19:01 +0000 (23:19 +0100)]
8250: of: remove remnants of generic of_serial driver

During build testing, I ran into a warning in a driver that I
had written myself at some point:

drivers/tty/serial/8250/8250_of.c: In function 'of_platform_serial_probe':
drivers/tty/serial/8250/8250_of.c:233:1: error: the frame size of 1200 bytes is larger than 1152 bytes [-Werror=frame-larger-than=]

This is harmless by itself, but it shows two other problems in
the driver:

- It still tries to be generic enough to handle all kinds of serial
  ports, where in reality the driver has been 8250-only for a while,
  and every other uart has its own DT support

- As a result of that generalization, we keep two copies of
  'struct uart_port' on the stack during probe(). This is completely
  unnessary.

Removing the last code dealing with unsupported port_type values
solves both problems nicely, and reduces the stack size.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Reformat sci_parse_dt() for git diff
Geert Uytterhoeven [Wed, 25 Jan 2017 14:55:49 +0000 (15:55 +0100)]
serial: sh-sci: Reformat sci_parse_dt() for git diff

As the function header of sci_parse_dt() is split in an unusual way,
"git diff" gets confused when changes to the body of the function are
made, and attributes them to the wrong function.

Reformat the function header to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty: serial: constify uart_ops structures
Bhumika Goyal [Wed, 25 Jan 2017 17:48:52 +0000 (23:18 +0530)]
tty: serial: constify uart_ops structures

Declare uart_ops structures as const as they are only stored in the ops
field of an uart_port structure. This field is of type const, so
uart_ops structures having this property can be made const too.

File size details before and after patching.
First line of every .o file shows the file size before patching
and second line shows the size after patching.

   text    data     bss     dec     hex filename

   2977     456      64    3497     da9 drivers/tty/serial/amba-pl010.o
   3169     272      64    3505     db1 drivers/tty/serial/amba-pl010.o

   3109     456       0    3565     ded drivers/tty/serial/efm32-uart.o
   3301     272       0    3573     df5 drivers/tty/serial/efm32-uart.o

  10668     753       1   11422    2c9e drivers/tty/serial/icom.o
  10860     561       1   11422    2c9e drivers/tty/serial/icom.o

  23904     408       8   24320    5f00 drivers/tty/serial/ioc3_serial.o
  24088     224       8   24320    5f00 drivers/tty/serial/ioc3_serial.o

  10516     560       4   11080    2b48 drivers/tty/serial/ioc4_serial.o
  10709     368       4   11081    2b49 drivers/tty/serial/ioc4_serial.o

   7853     648    1216    9717    25f5 drivers/tty/serial/mpsc.o
   8037     456    1216    9709    25ed drivers/tty/serial/mpsc.o

  10248     456       0   10704    29d0 drivers/tty/serial/omap-serial.o
  10440     272       0   10712    29d8 drivers/tty/serial/omap-serial.o

   8122     532    1984   10638    298e drivers/tty/serial/pmac_zilog.o
   8306     340    1984   10630    2986 drivers/tty/serial/pmac_zilog.o

   3808     456       0    4264    10a8 drivers/tty/serial/pxa.o
   4000     264       0    4264    10a8 drivers/tty/serial/pxa.o

  21781    3864       0   25645    642d drivers/tty/serial/serial-tegra.o
  22037    3608       0   25645    642d drivers/tty/serial/serial-tegra.o

   2481     456      96    3033     bd9 drivers/tty/serial/sprd_serial.o
   2673     272      96    3041     be1 drivers/tty/serial/sprd_serial.o

   5534     300     512    6346    18ca drivers/tty/serial/vr41xx_siu.o
   5630     204     512    6346    18ca drivers/tty/serial/vr41xx_siu.o

   6730    1576     128    8434    20f2 drivers/tty/serial/vt8500_serial.o
   6986    1320     128    8434    20f2 drivers/tty/serial/vt8500_serial.o

Cross compiled for mips architecture.

   3005     488       0    3493     da5 drivers/tty/serial/pnx8xxx_uart.o
   3189     304       0    3493     da5 drivers/tty/serial/pnx8xxx_uart.o

   4272     196    1056    5524    1594 drivers/tty/serial/dz.o
   4368     100    1056    5524    1594 drivers/tty/serial/dz.o

   6551     144      16    6711    1a37 drivers/tty/serial/ip22zilog.o
   6647      48      16    6711    1a37 drivers/tty/serial/ip22zilog.o

   9612     428    1520   11560    2d28 drivers/tty/serial/serial_txx9.o
   9708     332    1520   11560    2d28 drivers/tty/serial/serial_txx9.o

   4156     296      16    4468    1174 drivers/tty/serial/ar933x_uart.o
   4252     200      16    4468    1174 drivers/tty/serial/ar933x_uart.o

Cross compiled for arm archiecture.

  11716    1780      44   13540    34e4 drivers/tty/serial/sirfsoc_uart.o
  11808    1688      44   13540    34e4 drivers/tty/serial/sirfsoc_uart.o

  13352     596      56   14004    36b4 drivers/tty/serial/amba-pl011.o
  13444     504      56   14004    36b4 drivers/tty/serial/amba-pl011.o

Cross compiled for sparc architecture.

   4664     528      32    5224    1468 drivers/tty/serial/sunhv.o
   4848     344      32    5224    1468 drivers/tty/serial/sunhv.o

   8080     332      28    8440    20f8 drivers/tty/serial/sunzilog.o
   8184     228      28    8440    20f8 drivers/tty/serial/sunzilog.o

Cross compiled for ia64 architecture.

  10226     549     472   11247    2bef drivers/tty/serial/sn_console.o
  10414     365     472   11251    2bf3 drivers/tty/serial/sn_console.o

The files drivers/tty/serial/zs.o, drivers/tty/serial/lpc32xx_hs.o and
drivers/tty/serial/lantiq.o did not compile.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoconsole: Make persistent scrollback a boot parameter
Manuel Schölling [Fri, 13 Jan 2017 20:07:58 +0000 (21:07 +0100)]
console: Make persistent scrollback a boot parameter

The impact of the persistent scrollback feature on the code size is
rather small, so the config option is removed. The feature stays
disabled by default and can be enabled by using the boot command line
parameter 'vgacon.scrollback_persistent=1' or by setting
VGACON_SOFT_SCROLLBACK_PERSISTENT_ENABLE_BY_DEFAULT=y.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Suggested-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoconsole: Add persistent scrollback buffers for all VGA consoles
Manuel Schölling [Fri, 13 Jan 2017 20:07:57 +0000 (21:07 +0100)]
console: Add persistent scrollback buffers for all VGA consoles

Add a scrollback buffers for each VGA console. The benefit is that
the scrollback history is not flushed when switching between consoles
but is persistent.
The buffers are allocated on demand when a new console is opened.

This breaks tools like clear_console that rely on flushing the
scrollback history by switching back and forth between consoles
which is why this feature is disabled by default.
Use the escape sequence \e[3J instead for flushing the buffer.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com>
Tested-by: Andrey Utkin <andrey_utkin@fastmail.com>
Tested-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoconsole: Add callback to flush scrollback buffer to consw struct
Manuel Schölling [Fri, 13 Jan 2017 20:07:56 +0000 (21:07 +0100)]
console: Add callback to flush scrollback buffer to consw struct

This new callback is in preparation for persistent scrollback buffer
support for VGA consoles.
With a single scrollback buffer for all consoles, we could flush the
buffer just by invocating consw->con_switch(). But when each VGA console
has its own scrollback buffer, we need a new callback to tell the
video console driver which buffer to flush.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com>
Tested-by: Andrey Utkin <andrey_utkin@fastmail.com>
Tested-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoconsole: Move scrollback data into its own struct
Manuel Schölling [Fri, 13 Jan 2017 20:07:55 +0000 (21:07 +0100)]
console: Move scrollback data into its own struct

This refactoring is in preparation for persistent scrollback
support for VGA console.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Reviewed-by: Andrey Utkin <andrey_utkin@fastmail.com>
Tested-by: Andrey Utkin <andrey_utkin@fastmail.com>
Tested-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_omap: Fix probe and remove for PM runtime
Tony Lindgren [Fri, 20 Jan 2017 20:22:31 +0000 (12:22 -0800)]
serial: 8250_omap: Fix probe and remove for PM runtime

Otherwise the interconnect related code implementing PM runtime will
produce these errors on a failed probe:

omap_uart 48066000.serial: omap_device: omap_device_enable() called from invalid state 1
omap_uart 48066000.serial: use pm_runtime_put_sync_suspend() in driver?

Note that we now also need to check for priv in omap8250_runtime_suspend()
as it has not yet been registered if probe fails. And we need to use
pm_runtime_put_sync() to properly idle the device like we already do
in omap8250_remove().

Fixes: 61929cf0169d ("tty: serial: Add 8250-core based omap driver")
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: hp300: mask the warning for people just doing build coverage
Paul Gortmaker [Sun, 22 Jan 2017 03:08:25 +0000 (22:08 -0500)]
serial: hp300: mask the warning for people just doing build coverage

Currently this warning is triggered for allmodconfig on m68k.  It is
well intentioned, in that if you are building the driver but not
enabling one of the platforms where the hardware exists, you get a
warning.

The warning dates back to pre-git days, and now we have COMPILE_TEST
so we can use that to mask the warning for people who are obviously
just doing build coverage on tree wide changes.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-serial@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: xuartps: Enable uart loopback mode
Yasir-Khan [Mon, 23 Jan 2017 12:26:08 +0000 (13:26 +0100)]
serial: xuartps: Enable uart loopback mode

This patch adds xilinx uart loopback support by modifying the
cdns_uart_set_mctrl function to handle the switch to loopback mode.
After this patch, the loopback mode can be enabled/disabled by
setting/clearing the TIOCM_LOOP modem bit via TIOCMBIS/TIOCMBIC
ioctls respectively.

Signed-off-by: Yasir-Khan <yasir_khan@mentor.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_omap: Remove rx_dma_broken flag
Vignesh R [Fri, 20 Jan 2017 08:16:54 +0000 (13:46 +0530)]
serial: 8250_omap: Remove rx_dma_broken flag

8250 UART DMA support was marked broken by default as it was not
possible to pause ongoing RX DMA transfer. Now that both SDMA and
EDMA can support pause operation for RX DMA transactions, don't set
rx_dma_broken to true by default. With this patch 8250_omap driver will
use DMA by default.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_omap: Add OMAP_DMA_TX_KICK quirk for AM437x
Vignesh R [Fri, 20 Jan 2017 08:16:53 +0000 (13:46 +0530)]
serial: 8250_omap: Add OMAP_DMA_TX_KICK quirk for AM437x

UART uses as EDMA as dma engine on AM437x SoC and therefore, requires
OMAP_DMA_TX_KICK quirk just like AM33xx. So, enable OMAP_DMA_TX_KICK
quirk for AM437x platform as well. While at that, drop use of
of_machine_is_compatible() and instead pass quirks via device data.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_omap: pause DMA only if DMA transfer in progress
Vignesh R [Fri, 20 Jan 2017 08:16:52 +0000 (13:46 +0530)]
serial: 8250_omap: pause DMA only if DMA transfer in progress

It is possible that DMA transfer is already complete but, completion
handler is yet to be called, when dmaengine_pause() is called in case of
error condition(like break/rx timeout). This leads to dmaengine_pause()
API to return EINVAL (as descriptor is already NULL) causing
rx_dma_broken flag to be set and effectively disabling RX DMA.
Fix this by calling dmaengine_pause() only when transfer is in progress.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty: constify tty_ldisc_receive_buf buffer pointer
Rob Herring [Mon, 16 Jan 2017 22:54:31 +0000 (16:54 -0600)]
tty: constify tty_ldisc_receive_buf buffer pointer

This is needed to work with the client operations which uses const ptrs.

Really, the flags pointer could be const, too, but this would be a tree
wide fix.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty_port: make tty_port_register_device wrap tty_port_register_device_attr
Rob Herring [Mon, 16 Jan 2017 22:54:30 +0000 (16:54 -0600)]
tty_port: make tty_port_register_device wrap tty_port_register_device_attr

tty_register_device is just a wrapper for tty_register_device_attr with
NULL passed for drvdata and attr_grp. So similarly make
tty_port_register_device a wrapper of tty_port_register_device_attr so that
additions don't have to be made in both functions.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty_port: allow a port to be opened with a tty that has no file handle
Alan Cox [Mon, 16 Jan 2017 22:54:29 +0000 (16:54 -0600)]
tty_port: allow a port to be opened with a tty that has no file handle

Let us create tty objects entirely in kernel space. Untested proposal to
show why all the ideas around rewriting half the uart stack are not needed.

With this a kernel created non file backed tty object could be used to handle
data, and set terminal modes. Not all ldiscs can cope with this as N_TTY in
particular has to work back to the fs/tty layer.

The tty_port code is however otherwise clean of file handles as far as I can
tell as is the low level tty port write path used by the ldisc, the
configuration low level interfaces and most of the ldiscs.

Currently you don't have any exposure to see tty hangups because those are
built around the file layer. However a) it's a fixed port so you probably
don't care about that b) if you do we can add a callback and c) you almost
certainly don't want the userspace tear down/rebuild behaviour anyway.

This should however be sufficient if we wanted for example to enumerate all
the bluetooth bound fixed ports via ACPI and make them directly available.
It doesn't deal with the case of a user opening a port that's also kernel
opened and that would need some locking out (so it returned EBUSY if bound
to a kernel device of some kind). That needs resolving along with how you
"up" or "down" your new bluetooth device, or enumerate it while providing
the existing tty API to avoid regressions (and to debug).

Signed-off-by: Alan Cox <alan@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty: serial: meson: allow baud-rates higher than 115200
Martin Blumenstingl [Sun, 15 Jan 2017 22:32:52 +0000 (23:32 +0100)]
tty: serial: meson: allow baud-rates higher than 115200

The vendor driver allows setting baud-rates higher than 115200 baud.
There is a check in the vendor driver which prevents using more than
115200 baud during startup, however it does not have such a check in
.set_termios.
Higher baud-rates are often used by the bluetooth modules embedded into
the SDIO wifi chips (Amlogic devices use brcmfmac based wifi chips quite
often, 2000000 baud seems to be a common value for the UART baud-rate in
Amlogic's "libbt").

I have tested this on a Meson GXL device with uart_A (to which the
bluetooth module is connected, where initialization times out with
115200 baud) and uart_AO (which I manually set to 2000000 baud  and then
connected with my USB UART adapter to that).

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty: move the non-file related parts of tty_release to new tty_release_struct
Rob Herring [Mon, 16 Jan 2017 22:54:28 +0000 (16:54 -0600)]
tty: move the non-file related parts of tty_release to new tty_release_struct

For in-kernel tty users, we need to be able to create and destroy
'struct tty' that are not associated with a file. The creation side is
fine, but tty_release() needs to be split into the file handle portion
and the struct tty portion. Introduce a new function, tty_release_struct,
to handle just the destroying of a struct tty.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty: serial: 8250: 8250_gsc:- Handle return NULL error from ioremap_nocache
Arvind Yadav [Thu, 19 Jan 2017 08:00:44 +0000 (13:30 +0530)]
tty: serial: 8250: 8250_gsc:- Handle return NULL error from ioremap_nocache

Here, If ioremap_nocache will fail. It will return NULL.
Kernel can run into a NULL-pointer dereference.
This error check will avoid NULL pointer dereference.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: omap: Add omapserial earlycon
Lokesh Vutla [Thu, 19 Jan 2017 09:59:38 +0000 (15:29 +0530)]
serial: omap: Add omapserial earlycon

Add DT earlycon for omap_serial driver. This boot console is included
with CONFIG_SERIAL_EARLYCON=y, CONFIG_OF=y, CONFIG_SERIAL_OMAP=y, and
CONFIG_OF_EARLY_FLATTREE=y.

This boot console is enabled with the command line option "earlycon"
(without "=<name>...") when the DT 'stdout-path' property matches a
compatible uart.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: pl011: Mark console as CON_ANYTIME
Alexander Sverdlin [Wed, 18 Jan 2017 09:47:33 +0000 (10:47 +0100)]
serial: pl011: Mark console as CON_ANYTIME

Exactly as in a80c49db ("serial8250: Mark console as CON_ANYTIME"),
to enable printk() during CPU hot-plugging.

Actually most of the serial console drivers do not use per-cpu resources
and can be marked as CON_ANYTIME.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Jiri Slaby <jslaby@suse.com>
Cc: linux-serial@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agotty: serial: constify dev_pm_ops structures
Bhumika Goyal [Sun, 15 Jan 2017 11:00:30 +0000 (16:30 +0530)]
tty: serial: constify dev_pm_ops structures

Declare dev_pm_ops structures as const as they are only stored in the pm
field of a device_driver structure. This field is of type const, so
dev_pm_ops structures having similar properties can be declared const
too.

Size details after cross compiling the .o file for blackfin architecture.

File size before:
  text    data     bss     dec     hex filename
   3572     320      16    3908     f44 tty/serial/bfin_sport_uart.o

File size after:
   text    data     bss     dec     hex filename
   3664     228      16    3908     f44 tty/serial/bfin_sport_uart.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_mid: set PCI master only for DMA capable device
Andy Shevchenko [Wed, 11 Jan 2017 14:31:37 +0000 (16:31 +0200)]
serial: 8250_mid: set PCI master only for DMA capable device

There is no need to set PCI bus mastering when device is not doing any DMA. It
includes MSI type of interrupts. Currently only UART on Denverton, which is DMA
capable, might have MSI enabled.

Taking above into account enable bus mastering for Denverton case only.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_mid: enable MSI on Denverton
Andy Shevchenko [Wed, 11 Jan 2017 14:31:36 +0000 (16:31 +0200)]
serial: 8250_mid: enable MSI on Denverton

Enable MSI type of interrupt if PCI BIOS supports it.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_mid: handle interrupt correctly in DMA case
Andy Shevchenko [Wed, 11 Jan 2017 14:31:35 +0000 (16:31 +0200)]
serial: 8250_mid: handle interrupt correctly in DMA case

Starting from Tangier B0 and continuing on Anniedale the HSU DMA interrupt
line is actually shared with UART. Handling them independently is racy and
quite often comes with the following traceback.

 irq 54: nobody cared (try booting with the "irqpoll" option)
 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.0-rc6-edison64-86244934+ #1
 Hardware name: Intel Corporation Merrifield/BODEGA BAY, BIOS 542 2015.01.21:18.19.48
  ffff88003f203eb0 ffffffff8130e718 ffff880032627000 ffff88003262709c
  ffff88003f203ed8 ffffffff810a3960 ffff880032627000 0000000000000000
  ffff880032627000 ffff88003f203f10 ffffffff810a3cc7 ffff880032627000
 Call Trace:
  <IRQ>
  [<ffffffff8130e718>] dump_stack+0x4d/0x65
  [<ffffffff810a3960>] __report_bad_irq+0x30/0xc0
  [<ffffffff810a3cc7>] note_interrupt+0x227/0x270
  [<ffffffff810a1380>] handle_irq_event_percpu+0x40/0x50
  [<ffffffff810a13b7>] handle_irq_event+0x27/0x50
  [<ffffffff810a42d5>] handle_fasteoi_irq+0x85/0x150
  [<ffffffff8101d7fe>] handle_irq+0x6e/0x120
  [<ffffffff8105b8bc>] ? _local_bh_enable+0x1c/0x50
  [<ffffffff8101d0d6>] do_IRQ+0x46/0xd0
  [<ffffffff818cef3f>] common_interrupt+0x7f/0x7f
  <EOI>
  [<ffffffff818cdead>] ? mwait_idle+0x7d/0x140
  [<ffffffff81024c9a>] arch_cpu_idle+0xa/0x10
  [<ffffffff818ce150>] default_idle_call+0x20/0x30
  [<ffffffff810908fd>] cpu_startup_entry+0x16d/0x1d0
  [<ffffffff818c882d>] rest_init+0x6d/0x70
  [<ffffffff81f93e8f>] start_kernel+0x3e2/0x3ef
  [<ffffffff81f9343d>] x86_64_start_reservations+0x38/0x3a
  [<ffffffff81f93529>] x86_64_start_kernel+0xea/0xed
 handlers:
 [<ffffffff81411670>] serial8250_interrupt
 Disabling IRQ #54

Fix this by handling interrupt only in one place.

The issue is discussed here: https://github.com/andy-shev/linux/issues/5

Moreover this also fixes another bug when Rx DMA returns wrong residue and we
can't rely on it.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: 8250_dw: Allow hardware flow control to be used
Jason Uy [Wed, 11 Jan 2017 19:48:20 +0000 (11:48 -0800)]
serial: 8250_dw: Allow hardware flow control to be used

In the most common use case, the Synopsys DW UART driver does not
set the set_termios callback function.  This prevents UPSTAT_AUTOCTS
from being set when the UART flag CRTSCTS is set.  As a result, the
driver will use software flow control as opposed to hardware flow
control.

To fix the problem, the set_termios callback function is set to the
DW specific function.  The logic to set UPSTAT_AUTOCTS is moved so
that any clock error will not affect setting the hardware flow
control.

Reviewed-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Signed-off-by: Jason Uy <jason.uy@broadcom.com>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Compute the regshift value for SCI ports
Laurent Pinchart [Wed, 11 Jan 2017 14:43:40 +0000 (16:43 +0200)]
serial: sh-sci: Compute the regshift value for SCI ports

SCI instances found in SH SoCs have different spacing between registers
depending on the SoC. The platform data contains a regshift field that
tells the driver by how many bits to shift the register offset to
compute its address. We can compute the regshift value automatically
based on the memory resource size, there's no need to pass the value
through platform data.

Fix the sh7750 SCI and sh7760 SIM port memory resources length to ensure
proper computation of the regshift value.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Remove unused platform data capabilities field
Laurent Pinchart [Wed, 11 Jan 2017 14:43:39 +0000 (16:43 +0200)]
serial: sh-sci: Remove unused platform data capabilities field

The field isn't set by any platform but is only used internally in the
driver to hold data parsed from DT. Move it to the sci_port structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Remove manual break debouncing
Laurent Pinchart [Wed, 11 Jan 2017 14:43:38 +0000 (16:43 +0200)]
serial: sh-sci: Remove manual break debouncing

The sh-sci driver implements manual break debouncing for a few SH
platforms by reading the value of the RX pin port register. This feature
is optional and the driver considers all negative or zero values of the
platform data port_reg field as invalid. As the four platforms that set
the field to a register address all use an address higher than
0x7fffffff, the driver will always consider the value as invalid and
never perform debouncing. The feature is unused, remove it.

Debouncing could be implemented properly in the future using the pinctrl
and GPIO APIs if desired.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Remove the platform data dma slave rx/tx channel IDs
Laurent Pinchart [Wed, 11 Jan 2017 14:43:37 +0000 (16:43 +0200)]
serial: sh-sci: Remove the platform data dma slave rx/tx channel IDs

Only SH platforms still use platform data for the sh-sci, and none of
them declare DMA channels connected to the SCI. Remove the corresponding
platform data fields and simplify the driver accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Extend sci_port_params with more port parameters
Laurent Pinchart [Wed, 11 Jan 2017 14:43:36 +0000 (16:43 +0200)]
serial: sh-sci: Extend sci_port_params with more port parameters

The fifo size, overrun register and mask, sampling rate mask and error
mask all depend on the port type only and don't need to be computed at
runtime. Add them to the sci_port_parameters structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Constify platform data
Laurent Pinchart [Wed, 11 Jan 2017 14:43:35 +0000 (16:43 +0200)]
serial: sh-sci: Constify platform data

The driver modifies platform data for internal purpose only. Fix that
and make the platform data structure const.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Replace regmap array with port parameters
Laurent Pinchart [Wed, 11 Jan 2017 14:43:34 +0000 (16:43 +0200)]
serial: sh-sci: Replace regmap array with port parameters

Turn the regmap two-dimensional array to an array of port parameters and
store a pointer to the port parameters in the sci_port structure. This
will allow handling additional port type dependent parameters.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Remove initialization of zero fields in sci_port_params
Laurent Pinchart [Wed, 11 Jan 2017 14:43:33 +0000 (16:43 +0200)]
serial: sh-sci: Remove initialization of zero fields in sci_port_params

The compiler zeros uninitialized fields, don't zero them manually.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Fix register offsets for the IRDA serial port
Laurent Pinchart [Wed, 11 Jan 2017 14:43:32 +0000 (16:43 +0200)]
serial: sh-sci: Fix register offsets for the IRDA serial port

Even though most of its registers are 8-bit wide, the IRDA has two
16-bit registers that make it a 16-bit peripheral and not a 8-bit
peripheral with addresses shifted by one. Fix the registers offset in
the driver and the platform data regshift value.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosh: Don't set the sh-sci platform data REIE bit when not implemented
Laurent Pinchart [Wed, 11 Jan 2017 14:43:31 +0000 (16:43 +0200)]
sh: Don't set the sh-sci platform data REIE bit when not implemented

According to the datasheets, the sh7760 SIM and sh7723 SCIFA instances
don't implement the REIE bit. Don't set it in platform data.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosh: Don't set the sh-sci platform data scscr CKE0 bit
Laurent Pinchart [Wed, 11 Jan 2017 14:43:30 +0000 (16:43 +0200)]
sh: Don't set the sh-sci platform data scscr CKE0 bit

The bit is only set by platforms that also set the CKE1 but, in which
case its value is ignored by the device. Don't set it, this simplifies
platform data and only leaves the CKE1 bit to be handled.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosh: Don't set sh-sci port_reg
Laurent Pinchart [Wed, 11 Jan 2017 14:43:29 +0000 (16:43 +0200)]
sh: Don't set sh-sci port_reg

The driver considers all negative or zero values of the port_reg field
as invalid. The four platforms that set the field to a register address
all use an address higher than 0x7fffffff, which is thus considered by
the driver as invalid. The feature is thus never used, remove it.

The feature could be implemented properly in the future using the
pinctrl and GPIO APIs if desired.

While at it, don't set the field to SCIx_NOT_SUPPORTED (-1) either,
leaving it unset leads to the same result. This will allow removing the
SCIx_NOT_SUPPORTED macro.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosh: Don't set the sh-sci pdata UPF_BOOT_AUTOCONF flags
Laurent Pinchart [Wed, 11 Jan 2017 14:43:28 +0000 (16:43 +0200)]
sh: Don't set the sh-sci pdata UPF_BOOT_AUTOCONF flags

The flag is set by the driver internally, don't set it in platform data.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosh: sh726[49]: Don't set sh-sci pdata scscr TOIE bit
Laurent Pinchart [Wed, 11 Jan 2017 14:43:27 +0000 (16:43 +0200)]
sh: sh726[49]: Don't set sh-sci pdata scscr TOIE bit

The SCIF ports on sh7264 and sh7269 don't support the TOIE bit according
to the datasheets.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosh: Don't set sh-sci pdata scscr TIE and RIE bits
Laurent Pinchart [Wed, 11 Jan 2017 14:43:26 +0000 (16:43 +0200)]
sh: Don't set sh-sci pdata scscr TIE and RIE bits

The scscr platform data field is used by the driver in three locations.
One of them masks out all bits except SCSCR_REIE. The two other are the
set_termios handler and the console write handler.

The set_termios handler calls sci_start_rx() to enable the receiver,
which sets the RIE bit unconditionally. It then calls sci_port_disable()
that effectively disables both the transmitter and the receiver. The
TIE bit will thus get set later when the serial cores reenables the
serial port.

The console write handler runs with interrupts disabled, and saves and
restores the SCSCR register value. The RIE and TIE bits are thus not
needed there.

The bits are thus not necessary in platform data, remove them.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agosh: Don't set sh-sci pdata scscr TE and RE bits
Laurent Pinchart [Wed, 11 Jan 2017 14:43:25 +0000 (16:43 +0200)]
sh: Don't set sh-sci pdata scscr TE and RE bits

The bits are set by the driver internally, don't set them in platform
data.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Don't rely on platform data flags when not needed
Laurent Pinchart [Wed, 11 Jan 2017 14:43:24 +0000 (16:43 +0200)]
serial: sh-sci: Don't rely on platform data flags when not needed

The UPF_BOOT_AUTOCONF platform data flag is set by all platforms,
hardcode it.

The UPF_IOREMAP flag is set by a single SH platform and thus needs to be
kept. However, for ARM platforms, we can base the decision on whether an
OF node is present and bypass the platform data flags completely.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoserial: sh-sci: Set the SCSCR TE and RE bits in the driver
Laurent Pinchart [Wed, 11 Jan 2017 14:43:23 +0000 (16:43 +0200)]
serial: sh-sci: Set the SCSCR TE and RE bits in the driver

The Transmit Enable and Receive Enable bits are set in the scscr field
of all instances of the sh-sci platform data. Set them in the driver
directly to prepare for their removal from platform data.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoMerge 4.10-rc4 into tty-next
Greg Kroah-Hartman [Mon, 16 Jan 2017 15:57:54 +0000 (16:57 +0100)]
Merge 4.10-rc4 into tty-next

We want the serial/tty fixes in here as well to build on top of.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7 years agoLinux 4.10-rc4 v4.10-rc4
Linus Torvalds [Mon, 16 Jan 2017 00:21:59 +0000 (16:21 -0800)]
Linux 4.10-rc4

7 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm...
Linus Torvalds [Mon, 16 Jan 2017 00:09:50 +0000 (16:09 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace

Pull namespace fixes from Eric Biederman:
 "This tree contains 4 fixes.

  The first is a fix for a race that can causes oopses under the right
  circumstances, and that someone just recently encountered.

  Past that are several small trivial correct fixes. A real issue that
  was blocking development of an out of tree driver, but does not appear
  to have caused any actual problems for in-tree code. A potential
  deadlock that was reported by lockdep. And a deadlock people have
  experienced and took the time to track down caused by a cleanup that
  removed the code to drop a reference count"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  sysctl: Drop reference added by grab_header in proc_sys_readdir
  pid: fix lockdep deadlock warning due to ucount_lock
  libfs: Modify mount_pseudo_xattr to be clear it is not a userspace mount
  mnt: Protect the mountpoint hashtable with mount_lock

7 years agoMerge tag 'char-misc-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregk...
Linus Torvalds [Sun, 15 Jan 2017 20:40:53 +0000 (12:40 -0800)]
Merge tag 'char-misc-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
 "Here are some small char/misc driver fixes for 4.10-rc4 that resolve
  some reported issues.

  The MEI driver issue resolves a lot of problems that people have been
  having, as does the mem driver fix. The other minor fixes resolve
  other reported issues.

  All of these have been in linux-next for a while"

* tag 'char-misc-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  vme: Fix wrong pointer utilization in ca91cx42_slave_get
  auxdisplay: fix new ht16k33 build errors
  ppdev: don't print a free'd string
  extcon: return error code on failure
  drivers: char: mem: Fix thinkos in kmem address checks
  mei: bus: enable OS version only for SPT and newer

7 years agoMerge tag 'driver-core-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 15 Jan 2017 20:38:53 +0000 (12:38 -0800)]
Merge tag 'driver-core-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core fix from Greg KH:
 "Here is a single patch being reverted to remove a feature that was
  added in 4.10-rc1 that isn't quite ready for release.

  It will be redone as a debugfs file instead of a sysfs file in the
  future"

* tag 'driver-core-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  Revert "driver core: Add deferred_probe attribute to devices in sysfs"

7 years agoMerge tag 'tty-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Sun, 15 Jan 2017 20:36:32 +0000 (12:36 -0800)]
Merge tag 'tty-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty/serial fixes from Greg KH:
 "Here are some small tty/serial driver fixes for 4.10-rc4 to resolve a
  number of reported issues.

  Nothing major here at all, one revert of a problematic patch, and some
  other tiny bugfixes. Full details are in the shortlog below.

  All have been in linux-next with no reported issues"

* tag 'tty-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  sysrq: attach sysrq handler correctly for 32-bit kernel
  Revert "tty: serial: 8250: add CON_CONSDEV to flags"
  Clearing FIFOs in RS485 emulation mode causes subsequent transmits to break
  8250_pci: Fix potential use-after-free in error path
  tty/serial: atmel: RS485 half duplex w/DMA: enable RX after TX is done
  tty/serial: atmel_serial: BUG: stop DMA from transmitting in stop_tx

7 years agoMerge tag 'usb-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Sun, 15 Jan 2017 20:34:35 +0000 (12:34 -0800)]
Merge tag 'usb-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are a few small USB driver fixes for 4.10-rc4 to resolve some
  reported issues.

  The "largest" here is a number of bugs being fixed in the ch341
  usb-serial driver, to hopefully resolve the mess of different devices
  floating around that use this driver that have been having problems
  with the 4.10-rc1 release.

  There's also a tiny musb fix that I missed in the last pull request,
  as well as the traditional xhci fix rounding out the batch.

  All have been in linux-next with no reported issues"

* tag 'usb-4.10-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  xhci: fix deadlock at host remove by running watchdog correctly
  USB: serial: ch341: fix control-message error handling
  usb: musb: fix runtime PM in debugfs
  wusbcore: Fix one more crypto-on-the-stack bug
  USB: serial: kl5kusb105: fix line-state error handling
  USB: serial: ch341: fix baud rate and line-control handling
  USB: serial: ch341: fix line settings after reset-resume
  USB: serial: ch341: fix resume after reset
  USB: serial: ch341: fix open error handling
  USB: serial: ch341: fix modem-control and B0 handling
  USB: serial: ch341: fix open and resume after B0
  USB: serial: ch341: fix initial modem-control state

7 years agoMerge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Sun, 15 Jan 2017 20:28:14 +0000 (12:28 -0800)]
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Bugfixes for I2C. Mostly core this time which is a bit unusual but
  nothing really scary in there"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: piix4: Avoid race conditions with IMC
  i2c: fix spelling mistake: "insufficent" -> "insufficient"
  i2c: print correct device invalid address
  i2c: do not enable fall back to Host Notify by default
  i2c: fix kernel memory disclosure in dev interface

7 years agoMerge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 15 Jan 2017 20:03:11 +0000 (12:03 -0800)]
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:
 "Misc fixes:

   - unwinder fixes
   - AMD CPU topology enumeration fixes
   - microcode loader fixes
   - x86 embedded platform fixes
   - fix for a bootup crash that may trigger when clearcpuid= is used
     with invalid values"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/mpx: Use compatible types in comparison to fix sparse error
  x86/tsc: Add the Intel Denverton Processor to native_calibrate_tsc()
  x86/entry: Fix the end of the stack for newly forked tasks
  x86/unwind: Include __schedule() in stack traces
  x86/unwind: Disable KASAN checks for non-current tasks
  x86/unwind: Silence warnings for non-current tasks
  x86/microcode/intel: Use correct buffer size for saving microcode data
  x86/microcode/intel: Fix allocation size of struct ucode_patch
  x86/microcode/intel: Add a helper which gives the microcode revision
  x86/microcode: Use native CPUID to tickle out microcode revision
  x86/CPU: Add native CPUID variants returning a single datum
  x86/boot: Add missing declaration of string functions
  x86/CPU/AMD: Fix Bulldozer topology
  x86/platform/intel-mid: Rename 'spidev' to 'mrfld_spidev'
  x86/cpu: Fix typo in the comment for Anniedale
  x86/cpu: Fix bootup crashes by sanitizing the argument of the 'clearcpuid=' command-line option

7 years agoMerge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 15 Jan 2017 20:00:37 +0000 (12:00 -0800)]
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull NOHZ fix from Ingo Molnar:
 "This fixes an old NOHZ race where we incorrectly calculate the next
  timer interrupt in certain circumstances where hrtimers are pending,
  that can cause hard to reproduce stalled-values artifacts in
  /proc/stat"

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  nohz: Fix collision between tick and other hrtimers

7 years agoMerge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 15 Jan 2017 19:37:43 +0000 (11:37 -0800)]
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf fixes from Ingo Molnar:
 "Misc race fixes uncovered by fuzzing efforts, a Sparse fix, two PMU
  driver fixes, plus miscellanous tooling fixes"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/x86: Reject non sampling events with precise_ip
  perf/x86/intel: Account interrupts for PEBS errors
  perf/core: Fix concurrent sys_perf_event_open() vs. 'move_group' race
  perf/core: Fix sys_perf_event_open() vs. hotplug
  perf/x86/intel: Use ULL constant to prevent undefined shift behaviour
  perf/x86/intel/uncore: Fix hardcoded socket 0 assumption in the Haswell init code
  perf/x86: Set pmu->module in Intel PMU modules
  perf probe: Fix to probe on gcc generated symbols for offline kernel
  perf probe: Fix --funcs to show correct symbols for offline module
  perf symbols: Robustify reading of build-id from sysfs
  perf tools: Install tools/lib/traceevent plugins with install-bin
  tools lib traceevent: Fix prev/next_prio for deadline tasks
  perf record: Fix --switch-output documentation and comment
  perf record: Make __record_options static
  tools lib subcmd: Add OPT_STRING_OPTARG_SET option
  perf probe: Fix to get correct modname from elf header
  samples/bpf trace_output_user: Remove duplicate sys/ioctl.h include
  samples/bpf sock_example: Avoid getting ethhdr from two includes
  perf sched timehist: Show total scheduling time

7 years agoMerge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 15 Jan 2017 18:54:39 +0000 (10:54 -0800)]
Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull EFI fixes from Ingo Molnar:
 "A number of regression fixes:

   - Fix a boot hang on machines that have somewhat unusual memory map
     entries of phys_addr=0x0 num_pages=0, which broke due to a recent
     commit. This commit got cherry-picked from the v4.11 queue because
     the bug is affecting real machines.

   - Fix a boot hang also reported by KASAN, caused by incorrect init
     ordering introduced by a recent optimization.

   - Fix a recent robustification fix to allocate_new_fdt_and_exit_boot()
     that introduced an invalid assumption. Neither bugs were seen in
     the wild AFAIK"

* 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  efi/x86: Prune invalid memory map entries and fix boot regression
  x86/efi: Don't allocate memmap through memblock after mm_init()
  efi/libstub/arm*: Pass latest memory map to the kernel