26 Jul, 2017
1 commit
-
Add port.lock to protect register accessing in suspend/resume function.
Disable RIE and ILIE before DMA chan is ternminated in suspend function.Signed-off-by: Fugang Duan
(cherry picked from commit: 51f874a9205cbcbbdb55642f5502bf18aaf245bd)
25 Jul, 2017
2 commits
-
Add port.icount to stat. the DMA RX received count.
Signed-off-by: Fugang Duan
Reviewed-by: Robin Gong
(cherry picked from commit: 9580def59011d50312cd722eddaf681388064230) -
When use lpuart with DMA mode as wake up source, it still switch to
cpu mode in .suspend() that enable cpu interrupts RIE and ILIE as
wakkup source. When the wakeup signal coming while rx dma chan is
already teminated down, then driver should not call irq handler to
submit the new dma descriptor.Enable the wakeup irq bits in .suspend_noirq() and disable the wakeup
irq bits in .resume_noirq().Signed-off-by: Fugang Duan
09 Jun, 2017
15 commits
-
This is very similar to an older patch:
commit e1cbbcd1d1ac ("MLK-12161 tty: serial: imx: only enable RTSD
interrupt for hw flow control")The difference is that it adds the same check on the suspend path. This
fixes suspend not working on imx6sl-evk when uart wakeup is enabled.
What happens instead is that an interrupt is imediately received on the
suspend path.Signed-off-by: Leonard Crestez
---
On this board RTS is not connected. Couldn't we ensure that no noise is
received using pinctrl settings?To: Fugang Duan
-
By default, .of_dma_configure() init dev.coherent_dma_mask to BIT(32) that
match the eDMA address range. If re-init dev.coherent_dma_mask to zero, then
streaming dma mapping will go swiotlb dma_map, if swiotlb is not initalized
then it causes mapping failed.Signed-off-by: Fugang Duan
-
The current driver don't support lpuart32 DMA mode.
The patch add lpuart32 tx/rx DMA support, there have two main changes:
- lpuart32 tx dma resue lpuart tx dma mode to reduce code duplication.
- lpuart32 rx dma still use prep_sg mode since imx7ulp don't support
eeop mode that also ailgned with 4.1.y.If don't use DMA mode, remove dma chan property in dts file.
Signed-off-by: Fugang Duan
-
earlycon con->write() should call .uart_console_write() to process
'\n' character.Signed-off-by: Fugang Duan
-
Some i.MX SoCs lpuart has ipg_clk and per_clk, ipg_clk for bus and register
accessing, per_clk is lpuart module clock. Add per_clk support in
driver.Signed-off-by: Fugang Duan
-
tty_port flag "ASYNC_SUSPENDED" has been discarded from kernel upgrade, then
use .tty_port_suspended() instead of the flag check.Signed-off-by: Fugang Duan
-
Add modem device reset, wthether to reset depend on dts configuration.
Signed-off-by: Fugang Duan
-
Pass ->dev to dma_alloc_coherent() API to avoid kernel dump.
Signed-off-by: Fugang Duan
-
Before then DMA tx path, init the DMA tx path synchronal flags
sport->flags.Signed-off-by: Fugang Duan
-
Only enable RTSD interrupt for hw flow control, otherwise RTS_B signal
has some external signal disturbance without config RTS_B select input.Signed-off-by: Fugang Duan
(cherry picked from commit: 471e8c43aca3)Conflicts:
drivers/tty/serial/imx.c -
Add dma memory check before free it.
Signed-off-by: Fugang Duan
-
Align tx path with kernel 3.14, otherwise there have data loss.
The patch is cherry-picked from commit:47c1570ac934, and merge
the patch 1afe15219403.Signed-off-by: Fugang Duan
-
Kernel upgrade to 4.1.8 from 4.1.4 has one conflict: commit:3cd6a7db4c2c and
commit:4eede03b97bf, and there introduces one issue during the merge. The issue
cause pio mode cannot work.The patch fix the error that move the dma init function to .startup().
Signed-off-by: Fugang Duan
-
When uart port (non-console port) in dma mode and use uart as remote wakeup
source, after resume back, the AWAKE bit is not cleared most of interrupts
are disabled. And then let system suspend state, system resume back immediately
without any wake up action. So we need to clear the AWAKE bit after resume
back in DMA mode.Merge comments: it is necessary to clear AWAKE or RTSD bit.
Signed-off-by: Fugang Duan
(merge patch from commit: d4b6b6b20eb2c5cca47292f89ab588b15d3be0a9) -
The commmunity driver uart DMA don't work, it better to use
4.1.y DMA process mechanism, so there have many conflict during
code merging. Decisively, to use 4.1.y commit f00cf8855eaa in the
merge point for DMA implemention.In DMA mode, don't involve CPU interrupt, remove .imx_dma_rxint()
function.After the patch, DMA and CPU mode both work fine with the current
SDMA driver.Signed-off-by: Fugang Duan
08 Jun, 2017
4 commits
-
Signed-off-by: Octavian Purdila
-
Add magic SysRq key support.
Signed-off-by: Fugang Duan
-
Add FSL LPUART earlycon support.
Signed-off-by: Anson Huang
Signed-off-by: Robin Gong
Signed-off-by: Ranjani Vaidyanathan
Signed-off-by: Fugang Duan -
This prevents unwanted interrupts coming in early suspend.
Loosely based on 81e8e7d91d81351d9fea4ad7c289b122706640fd from imx_4.1.y:
MLK-11382 tty: serial: imx: disable irq after suspend
Disable rx irq after suspend to avoid interrupt coming in early
resume.Signed-off-by: Fugang Duan
Signed-off-by: Leonard Crestez
23 Feb, 2017
5 commits
-
Only enable RTSD interrupt for hw flow control, otherwise RTS_B signal
has some external signal disturbance without config RTS_B select input.Signed-off-by: Fugang Duan
(cherry picked from commit: 471e8c43aca3)Conflicts:
drivers/tty/serial/imx.c -
For LPSR mode, UART iomux settings will be lost after resume,
so add pinctrl sleep mode support.Signed-off-by: Anson Huang
Signed-off-by: Fugang Duan -
Also disable rx fifo overrun interrupt during uart port shutdown.
Signed-off-by: Fugang Duan
(cherry picked from commit: 39eb703f6c9f9359723f3fa22e798b1d21b44c67) -
Add return value check for clk_set_rate() to avoid set clock
rate fail.Signed-off-by: Fugang Duan
(cherry picked from commit: bcd9d743ef534cf58d2d007e6333270be12c9f06) -
When UART module clock is great than 80Mhz, there may have risk after
confirming with IC owner. So set the maximum module clock to 80Mhz.Signed-off-by: Fugang Duan
(cherry picked from commit: 330a1245cb91583d9bc916bbb6d8c7d2c86b26f3)
20 Jan, 2017
5 commits
-
commit 2bed8a8e70729f996af92042d3ad0f11870acc1f upstream.
When in RS485 emulation mode, __do_stop_tx_rs485() calls
serial8250_clear_fifos(). This not only clears the FIFOs, but also sets
all bits in their control register (UART_FCR) to 0.One of the effects of this is the disabling of the FIFOs, which turns
them into single-byte holding registers. The rest of the driver doesn't
know this, which results in the lions share of characters passed into a
write call to be dropped.(I can supply logic analyzer screenshots if necessary)
This fix replaces the serial8250_clear_fifos() call to
serial8250_clear_and_reinit_fifos() - this prevents the "dropped
characters" issue from manifesting again while retaining the requirement
of clearing the RX FIFO after transmission if the SER_RS485_RX_DURING_TX
flag is disabled.Signed-off-by: Daniel Jedrychowski
Signed-off-by: Greg Kroah-Hartman -
commit 802c03881f29844af0252b6e22be5d2f65f93fd0 upstream.
The sysrq input handler should be attached to the input device which has
a left alt key.On 32-bit kernels, some input devices which has a left alt key cannot
attach sysrq handler. Because the keybit bitmap in struct input_device_id
for sysrq is not correctly initialized. KEY_LEFTALT is 56 which is
greater than BITS_PER_LONG on 32-bit kernels.I found this problem when using a matrix keypad device which defines
a KEY_LEFTALT (56) but doesn't have a KEY_O (24 == 56%32).Cc: Jiri Slaby
Signed-off-by: Akinobu Mita
Acked-by: Dmitry Torokhov
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Greg Kroah-Hartman -
commit 89d8232411a85b9a6b12fd5da4d07d8a138a8e0c upstream.
If we don't disable the transmitter in atmel_stop_tx, the DMA buffer
continues to send data until it is emptied.
This cause problems with the flow control (CTS is asserted and data are
still sent).So, disabling the transmitter in atmel_stop_tx is a sane thing to do.
Tested on at91sam9g35-cm(DMA)
Tested for regressions on sama5d2-xplained(Fifo) and at91sam9g20ek(PDC)Signed-off-by: Richard Genoud
Acked-by: Nicolas Ferre
Signed-off-by: Greg Kroah-Hartman -
commit b389f173aaa1204d6dc1f299082a162eb0491545 upstream.
When using RS485 in half duplex, RX should be enabled when TX is
finished, and stopped when TX starts.Before commit 0058f0871efe7b01c6 ("tty/serial: atmel: fix RS485 half
duplex with DMA"), RX was not disabled in atmel_start_tx() if the DMA
was used. So, collisions could happened.But disabling RX in atmel_start_tx() uncovered another bug:
RX was enabled again in the wrong place (in atmel_tx_dma) instead of
being enabled when TX is finished (in atmel_complete_tx_dma), so the
transmission simply stopped.This bug was not triggered before commit 0058f0871efe7b01c6
("tty/serial: atmel: fix RS485 half duplex with DMA") because RX was
never disabled before.Moving atmel_start_rx() in atmel_complete_tx_dma() corrects the problem.
Reported-by: Gil Weber
Fixes: 0058f0871efe7b01c6
Tested-by: Gil Weber
Signed-off-by: Richard Genoud
Acked-by: Alexandre Belloni
Signed-off-by: Greg Kroah-Hartman -
commit 6741f551a0b26479de2532ffa43a366747e6dbf3 upstream.
This commit needs to be reverted because it prevents people from
using the serial console as a secondary console with input being
directed to tty0.IOW, if you boot with console=ttyS0 console=tty0 then all kernels
prior to this commit will produce output on both ttyS0 and tty0
but input will only be taken from tty0. With this patch the serial
console will always be the primary console instead of tty0,
potentially preventing people from getting into their machines in
emergency situations.Fixes: d03516df8375 ("tty: serial: 8250: add CON_CONSDEV to flags")
Signed-off-by: Herbert Xu
Signed-off-by: Greg Kroah-Hartman
09 Jan, 2017
2 commits
-
commit 04da73803c05dc1150ccc31cbf93e8cd56679c09 upstream.
The use of IRQF_ONESHOT when registering an interrupt handler with
request_irq() is non-sensical.Not only that, it also prevents the handler from being threaded when it
otherwise should be w/ IRQ_FORCED_THREADING is enabled. This causes the
following deadlock observed by Sean Nyekjaer on -rt:Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[..]
rt_spin_lock_slowlock from queue_kthread_work
queue_kthread_work from sc16is7xx_irq
sc16is7xx_irq [sc16is7xx] from handle_irq_event_percpu
handle_irq_event_percpu from handle_irq_event
handle_irq_event from handle_level_irq
handle_level_irq from generic_handle_irq
generic_handle_irq from mxc_gpio_irq_handler
mxc_gpio_irq_handler from mx3_gpio_irq_handler
mx3_gpio_irq_handler from generic_handle_irq
generic_handle_irq from __handle_domain_irq
__handle_domain_irq from gic_handle_irq
gic_handle_irq from __irq_svc
__irq_svc from rt_spin_unlock
rt_spin_unlock from kthread_worker_fn
kthread_worker_fn from kthread
kthread from ret_from_forkFixes: 9e6f4ca3e567 ("sc16is7xx: use kthread_worker for tx_work and irq")
Reported-by: Sean Nyekjaer
Signed-off-by: Josh Cartwright
Cc: linux-rt-users@vger.kernel.org
Cc: Jakub Kicinski
Cc: linux-serial@vger.kernel.org
Cc: Sebastian Andrzej Siewior
Signed-off-by: Julia Cartwright
Acked-by: Jakub Kicinski
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Greg Kroah-Hartman -
commit 31b5929d533f5183972cf57a7844b456ed996f3c upstream.
There is a disagreement between drivers/tty/vt/keyboard.c and
drivers/input/input-leds.c with regard to what is a Scroll Lock LED
trigger name: input calls it "kbd-scrolllock", but vt calls it
"kbd-scrollock" (two l's).
This prevents Scroll Lock LED trigger from binding to this LED by default.Since it is a scroLL Lock LED, this interface was introduced only about a
year ago and in an Internet search people seem to reference this trigger
only to set it to this LED let's simply rename it to "kbd-scrolllock".Also, it looks like this was supposed to be changed before this code was
merged: https://lkml.org/lkml/2015/6/9/697 but it was done only on
the input side.Signed-off-by: Maciej S. Szmigiero
Acked-by: Samuel Thibault
Signed-off-by: Greg Kroah-Hartman
28 Oct, 2016
3 commits
-
Since commit 761ed4a94582ab29 ("tty: serial_core: convert uart_close to
use tty_port_close"), the serial console is broken on various systems
and typing "reboot" splats the following on the serial console:INIT: Sending p[ 427.863916] BUG: unable to handle kernel NULL pointer dereference at 00000000000001e0
[ 427.885156] IP: [] tty_wakeup+0xc/0x70
[ 427.898337] PGD 0 [ 427.902051]
[ 427.907498] Oops: 0000 [#1] PREEMPT SMP
[ 427.917635] Modules linked in: nfsv3 nfs_acl nfs fscache lockd
sunrpc grace edd af_packet cpufreq_conservative cpufreq_userspace
cpufreq_powersave fuse loop md_mod dm_mod joydev hid_generic usbhid
ipmi_ssif ohci_pci ohci_hcd ehci_pci ehci_hcd e1000e ptp firewire_ohci
edac_core pps_core tpm_infineon sp5100_tco firewire_core acpi_cpufreq
serio_raw pcspkr fjes usbcore shpchp edac_mce_amd tpm_tis ipmi_si
tpm_tis_core i2c_piix4 k10temp sg ipmi_msghandler tpm sr_mod button
cdrom kvm_amd kvm irqbypass crc_itu_t ast ttm drm_kms_helper drm
fb_sys_fops sysimgblt sysfillrect syscopyarea i2c_algo_bit scsi_dh_rdac
scsi_dh_alua scsi_dh_emc scsi_dh_hp_sw ata_generic pata_atiixp
[ 428.054179] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.9.0-rc1-1.g73e3f23-default #1
[ 428.072868] Hardware name: System manufacturer System Product Name/KGP(M)E-D16, BIOS 0902 12/03/2010
[ 428.094755] task: ffffffffa2c0d500 task.stack: ffffffffa2c00000
[ 428.109717] RIP: 0010:[] [] tty_wakeup+0xc/0x70
[ 428.128407] RSP: 0018:ffff9a1a5fc03df8 EFLAGS: 00010086
[ 428.142184] RAX: ffff9a1857258000 RBX: ffffffffa3050ea0 RCX: 0000000000000000
[ 428.159649] RDX: 000000000000001b RSI: 0000000000000000 RDI: 0000000000000000
[ 428.177109] RBP: ffff9a1a5fc03e08 R08: 0000000000000000 R09: 0000000000000000
[ 428.194547] R10: 0000000000021c77 R11: 0000000000000000 R12: ffff9a1857258000
[ 428.212002] R13: 0000000000000000 R14: 0000000000000020 R15: 0000000000000020
[ 428.229481] FS: 0000000000000000(0000) GS:ffff9a1a5fc00000(0000) knlGS:0000000000000000
[ 428.248938] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 428.263726] CR2: 00000000000001e0 CR3: 0000000390c06000 CR4: 00000000000006f0
[ 428.281331] Stack:
[ 428.288696] ffffffffa3050ea0 ffff9a1857258000 ffff9a1a5fc03e18 ffffffffa24e0ab1
[ 428.307064] ffff9a1a5fc03e40 ffffffffa24e8865 ffffffffa3050ea0 00000000000000c2
[ 428.325456] 0000000000000046 ffff9a1a5fc03e78 ffffffffa24e8a5f ffffffffa3050ea0
[ 428.343905] Call Trace:
[ 428.352319] [ 428.356216] [] uart_write_wakeup+0x21/0x30The problem is for console ports, the serial port is not shutdown and
interrupts may fire after the struct tty is gone. Simply calling the
tty_port helper tty_port_tty_wakeup instead of tty_wakeup directly will
ensure there is a valid struct tty.Fixes: 761ed4a94582ab29 ("tty: serial_core: convert uart_close to use tty_port_close")
Reported-by: Borislav Petkov
Reported-by: Mike Galbraith
Cc: Jiri Slaby
Cc: Greg Kroah-Hartman
Cc: linux-serial@vger.kernel.org
Signed-off-by: Rob Herring
Signed-off-by: Greg Kroah-Hartman -
The port->console flag is always false, as uart_console() is called
before the serial console has been registered.Hence for a serial port used as the console, uart_tty_port_shutdown()
will still be called when userspace closes the port, powering it down.
This may lead to a system lock up when the serial console driver writes
to the serial port's registers.To fix this, move the setting of port->console after the call to
uart_configure_port(), which registers the serial console.Fixes: 761ed4a94582ab29 ("tty: serial_core: convert uart_close to use tty_port_close")
Reported-by: Niklas Söderlund
Signed-off-by: Geert Uytterhoeven
Acked-by: Rob Herring
Tested-by: Mugunthan V N
Tested-by: Niklas Söderlund
[robh: rebased on tty-linus]
Signed-off-by: Rob Herring
Signed-off-by: Greg Kroah-Hartman -
After commit 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management
when hardware handshake is enabled"), the hardware handshake wasn't
functional anymore on Atmel platforms (beside SAMA5D2).To understand why, one has to understand the flag ATMEL_US_USMODE_HWHS
first:
Before commit 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management
when hardware handshake is enabled"), this flag was never set.
Thus, the CTS/RTS where only handled by serial_core (and everything
worked just fine).This commit introduced the use of the ATMEL_US_USMODE_HWHS flag,
enabling it for all boards when the user space enables flow control.When the ATMEL_US_USMODE_HWHS is set, the Atmel USART controller
handles a part of the flow control job:
- disable the transmitter when the CTS pin gets high.
- drive the RTS pin high when the DMA buffer transfer is completed or
PDC RX buffer full or RX FIFO is beyond threshold. (depending on the
controller version).NB: This feature is *not* mandatory for the flow control to work.
(Nevertheless, it's very useful if low latencies are needed.)Now, the specifics of the ATMEL_US_USMODE_HWHS flag:
- For platforms with DMAC and no FIFOs (sam9x25, sam9x35, sama5D3,
sama5D4, sam9g15, sam9g25, sam9g35)* this feature simply doesn't work.
( source: https://lkml.org/lkml/2016/9/7/598 )
Tested it on sam9g35, the RTS pins always stays up, even when RXEN=1
or a new DMA transfer descriptor is set.
=> ATMEL_US_USMODE_HWHS must not be used for those platforms- For platforms with a PDC (sam926{0,1,3}, sam9g10, sam9g20, sam9g45,
sam9g46)*, there's another kind of problem. Once the flag
ATMEL_US_USMODE_HWHS is set, the RTS pin can't be driven anymore via
RTSEN/RTSDIS in USART Control Register. The RTS pin can only be driven
by enabling/disabling the receiver or setting RCR=RNCR=0 in the PDC
(Receive (Next) Counter Register).
=> Doing this is beyond the scope of this patch and could add other
bugs, so the original (and working) behaviour should be set for those
platforms (meaning ATMEL_US_USMODE_HWHS flag should be unset).- For platforms with a FIFO (sama5d2)*, the RTS pin is driven according
to the RX FIFO thresholds, and can be also driven by RTSEN/RTSDIS in
USART Control Register. No problem here.
(This was the use case of commit 1cf6e8fc8341 ("tty/serial: at91: fix
RTS line management when hardware handshake is enabled"))
NB: If the CTS pin declared as a GPIO in the DTS, (for instance
cts-gpios = ), the transmitter will be
disabled.
=> ATMEL_US_USMODE_HWHS flag can be set for this platform ONLY IF the
CTS pin is not a GPIO.So, the only case when ATMEL_US_USMODE_HWHS can be enabled is when
(atmel_use_fifo(port) &&
!mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS))Tested on all Atmel USART controller flavours:
AT91SAM9G35-CM (DMAC flavour), AT91SAM9G20-EK (PDC flavour),
SAMA5D2xplained (FIFO flavour).* the list may not be exhaustive
Cc: #4.4+ (beware, missing atmel_port variable)
Fixes: 1cf6e8fc8341 ("tty/serial: at91: fix RTS line management when hardware handshake is enabled")
Signed-off-by: Richard Genoud
Acked-by: Alexandre Belloni
Acked-by: Cyrille Pitchen
Acked-by: Uwe Kleine-König
Acked-by: Nicolas Ferre
Signed-off-by: Greg Kroah-Hartman
27 Oct, 2016
3 commits
-
When resizing a vt its selection may exceed the new size, resulting in
an invalid memory access [1]. Clear the selection before resizing.[1] http://lkml.kernel.org/r/CACT4Y+acDTwy4umEvf5ROBGiRJNrxHN4Cn5szCXE5Jw-d1B=Xw@mail.gmail.com
Reported-and-tested-by: Dmitry Vyukov
Signed-off-by: Scot Doyle
Cc: stable
Signed-off-by: Greg Kroah-Hartman -
The regmap_update first reads the IOState register and then triggers
a write if needed. However, GPIOS might be configured as an input so
the read to IOState on this GPIO is the current state which might
be random.Signed-off-by: Francois Berder
Signed-off-by: Greg Kroah-Hartman -
NXP SC16C2552 requires that we always write a reset to the RX FIFO and
TX FIFO whenever we enable the FIFOsCc: xe-kernel@external.cisco.com
Signed-off-by: Steve Shih
Signed-off-by: David Singleton
Signed-off-by: Greg Kroah-Hartman