summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/omap-serial.c
AgeCommit message (Collapse)Author
2015-12-13serial/omap-serial: Deinline wait_for_xmitr, save 165 bytesDenys Vlasenko
This function compiles to 141 bytes of machine code. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com> CC: Jiri Slaby <jslaby@suse.com> CC: linux-serial@vger.kernel.org Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-04serial: omap: remove warnings about unused functionsEzequiel Garcia
They're used by only if CONFIG_PM is enabled, so enclose them with proper ifdefs. Removes these warnings: drivers/tty/serial/omap-serial.c:202:12: warning: 'serial_omap_get_context_loss_count' defined but not used [-Wunused-function] drivers/tty/serial/omap-serial.c:213:13: warning: 'serial_omap_enable_wakeup' defined but not used [-Wunused-function] Signed-off-by: Guido Martínez <guido@vanguardiasur.com.ar> Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-09serial: omap: Switch wake-up interrupt to generic wakeirqTony Lindgren
We can now use generic wakeirq handling and remove the custom handling for the wake-up interrupts. Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Tony Lindgren <tony@atomide.com>
2015-05-08serial: omap: Fix error handling in probeSemen Protsenko
There is pm_qos_add_request() being executed on serial_omap_probe(), which stores "&up->pm_qos_request" from omap-serial driver to "pm_qos_array[PM_QOS_CPU_DMA_LATENCY]->constraints". If serial_omap_probe() fails after pm_qos_add_request() (e.g. on uart_add_one_port() call), pm_qos_array still keeping pm_qos_request struct from omap-serial driver, which is not valid anymore (since driver failed). This leads further to kernel crash on pm_qos_update_target(), executing from some completely different driver. We were observing this while trying to run audio playback while having one of omap-serial driver instances failed on uart_add_one_port() call: Unable to handle kernel paging request at virtual address fffffffc Backtrace: (plist_add) from (pm_qos_update_target) (pm_qos_update_target) from (pm_qos_add_request) (pm_qos_add_request) from (snd_pcm_hw_params) (snd_pcm_hw_params) from (snd_pcm_common_ioctl1) (snd_pcm_common_ioctl1) from (snd_pcm_playback_ioctl1) (snd_pcm_playback_ioctl1) from (snd_pcm_playback_ioctl) (snd_pcm_playback_ioctl) from (do_vfs_ioctl) (do_vfs_ioctl) from (SyS_ioctl) (SyS_ioctl) from (ret_fast_syscall) This patch adds pm_qos_remove_request() on fail path in serial_omap_probe() in order to fix this issue. While at it, free the wakeup settings on fail path as well, just like it's done in serial_omap_remove(). Signed-off-by: Semen Protsenko <semen.protsenko@globallogic.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-26tty/serial: omap: fix !wakeirq messageDoug Kehn
When wakeirq is not used/enabled, "no wakeirq for uart0" is output for all TTY as the log message is generated before the port line is initialized. [ 0.802656] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled [ 0.811700] omap_uart 44e09000.serial: no wakeirq for uart0 [ 0.812379] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 88, base_baud = 3000000) is a OMAP UART0 [ 1.503622] console [ttyO0] enabled [ 1.509836] omap_uart 48022000.serial: no wakeirq for uart0 [ 1.516118] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 89, base_baud = 3000000) is a OMAP UART1 [ 1.527711] omap_uart 48024000.serial: no wakeirq for uart0 [ 1.533881] 48024000.serial: ttyO2 at MMIO 0x48024000 (irq = 90, base_baud = 3000000) is a OMAP UART2 [ 1.545324] omap_uart 481a6000.serial: no wakeirq for uart0 [ 1.551410] 481a6000.serial: ttyO3 at MMIO 0x481a6000 (irq = 60, base_baud = 3000000) is a OMAP UART3 [ 1.562946] omap_uart 481a8000.serial: no wakeirq for uart0 [ 1.569036] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 61, base_baud = 3000000) is a OMAP UART4 Fix by moving wakeirq initialization, check, and dev_info() call to after port line initialization and validation. Signed-off-by: Doug Kehn <rdkehn@yahoo.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-02serial: omap: Fix RTS handlingPeter Hurley
The OMAP UART ignores MCR[1] (ie., RTS) when in autoRTS mode. This makes it impossible for either the serial core or userspace to manually flow control the sender. Disable autoRTS mode when RTS is lowered and restore the previous mode when RTS is raised. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-02serial: core: Rework hw-assisted flow control supportPeter Hurley
hw-assisted flow control support was added to the serial core in v3.8 with commits, dba05832cbe4f ("SERIAL: core: add hardware assisted h/w flow control support") 2cbacafd7af0f ("SERIAL: core: add hardware assisted s/w flow control support") 9aba8d5b01119 ("SERIAL: core: add throttle/unthrottle callbacks for hardware assisted flow control") Since then, additional requirements for serial core support have arisen. Specifically, 1. Separate tx and rx flow control settings for UARTs which only support tx flow control (ie., autoCTS). 2. Disable sw-assisted CTS flow control in autoCTS mode 3. Support for RTS flow control by serial core and userspace in autoRTS mode Distinguish mode from capability; introduce UPSTAT_AUTORTS, UPSTAT_AUTOCTS and UPSTAT_AUTOXOFF which, when set by the uart driver, enable serial core support for hw-assisted rx, hw-assisted tx and hw-assisted in-band/IXOFF rx flow control, respectively. [Note: hw-assisted in-band/IXON tx flow control does not require serial core support/intervention and can be enabled by the uart driver when required.] These modes must be set/reset in the driver's set_termios() method, based on termios settings, and thus can be safely queried in any context in which one of the port lock, port mutex or termios rwsem are held. Set these modes in the 2 in-tree drivers, omap-serial and 8250_omap, which currently use UPF_HARD_FLOW/UPF_SOFT_FLOW support. Retain UPF_HARD_FLOW and UPF_SOFT_FLOW as capabilities; re-define UPF_HARD_FLOW as both UPF_AUTO_RTS and UPF_AUTO_CTS to allow for distinct and separate rx and tx flow control capabilities. Disable sw-assisted CTS flow control when UPSTAT_AUTOCTS is enabled. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-09trivial fixes for omap-serialPavel Machek
Trivial fixes for omap-serial. Signed-off-by: Pavel Machek <pavel@ucw.cz> index 18c30ca..f43ed2c 100644 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-12-18Merge tag 'pm+acpi-3.19-rc1-2' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull more ACPI and power management updates from Rafael Wysocki: "These are regression fixes (leds-gpio, ACPI backlight driver, operating performance points library, ACPI device enumeration messages, cpupower tool), other bug fixes (ACPI EC driver, ACPI device PM), some cleanups in the operating performance points (OPP) framework, continuation of CONFIG_PM_RUNTIME elimination, a couple of minor intel_pstate driver changes, a new MAINTAINERS entry for it and an ACPI fan driver change needed for better support of thermal management in user space. Specifics: - Fix a regression in leds-gpio introduced by a recent commit that inadvertently changed the name of one of the properties used by the driver (Fabio Estevam). - Fix a regression in the ACPI backlight driver introduced by a recent fix that missed one special case that had to be taken into account (Aaron Lu). - Drop the level of some new kernel messages from the ACPI core introduced by a recent commit to KERN_DEBUG which they should have used from the start and drop some other unuseful KERN_ERR messages printed by ACPI (Rafael J Wysocki). - Revert an incorrect commit modifying the cpupower tool (Prarit Bhargava). - Fix two regressions introduced by recent commits in the OPP library and clean up some existing minor issues in that code (Viresh Kumar). - Continue to replace CONFIG_PM_RUNTIME with CONFIG_PM throughout the tree (or drop it where that can be done) in order to make it possible to eliminate CONFIG_PM_RUNTIME (Rafael J Wysocki, Ulf Hansson, Ludovic Desroches). There will be one more "CONFIG_PM_RUNTIME removal" batch after this one, because some new uses of it have been introduced during the current merge window, but that should be sufficient to finally get rid of it. - Make the ACPI EC driver more robust against race conditions related to GPE handler installation failures (Lv Zheng). - Prevent the ACPI device PM core code from attempting to disable GPEs that it has not enabled which confuses ACPICA and makes it report errors unnecessarily (Rafael J Wysocki). - Add a "force" command line switch to the intel_pstate driver to make it possible to override the blacklisting of some systems in that driver if needed (Ethan Zhao). - Improve intel_pstate code documentation and add a MAINTAINERS entry for it (Kristen Carlson Accardi). - Make the ACPI fan driver create cooling device interfaces witn names that reflect the IDs of the ACPI device objects they are associated with, except for "generic" ACPI fans (PNP ID "PNP0C0B"). That's necessary for user space thermal management tools to be able to connect the fans with the parts of the system they are supposed to be cooling properly. From Srinivas Pandruvada" * tag 'pm+acpi-3.19-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (32 commits) MAINTAINERS: add entry for intel_pstate ACPI / video: update the skip case for acpi_video_device_in_dod() power / PM: Eliminate CONFIG_PM_RUNTIME NFC / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM SCSI / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM ACPI / EC: Fix unexpected ec_remove_handlers() invocations Revert "tools: cpupower: fix return checks for sysfs_get_idlestate_count()" tracing / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM x86 / PM: Replace CONFIG_PM_RUNTIME in io_apic.c PM: Remove the SET_PM_RUNTIME_PM_OPS() macro mmc: atmel-mci: use SET_RUNTIME_PM_OPS() macro PM / Kconfig: Replace PM_RUNTIME with PM in dependencies ARM / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM sound / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM phy / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM video / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM tty / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PM spi: Replace CONFIG_PM_RUNTIME with CONFIG_PM ACPI / PM: Do not disable wakeup GPEs that have not been enabled ACPI / utils: Drop error messages from acpi_evaluate_reference() ...
2014-12-13tty / PM: Replace CONFIG_PM_RUNTIME with CONFIG_PMRafael J. Wysocki
After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM. Replace CONFIG_PM_RUNTIME with CONFIG_PM everywhere under drivers/tty/. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-25tty: serial: omap_serial: line is unsigned, don't check < 0Sebastian Andrzej Siewior
Dan Carpenter reported: |drivers/tty/serial/8250/8250_omap.c:1025 omap8250_probe() |warn: unsigned 'up.port.line' is never less than zero. |1025 if (up.port.line < 0) { Since of_alias_get_id() and pdev->id can get negative I check for the error via ret variable. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-06tty/serial_core: Introduce lock mechanism for RS485Ricardo Ribalda Delgado
Introduce an homogeneous lock system between setting and using the rs485 data of the uart_port. This patch should not be split into multiple ones in order to avoid leaving the tree in an unstable state. Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Reviewed-by: Alan Cox <alan@linux.intel.com> Suggested-by: Alan Cox <alan@linux.intel.com> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-06serial/omap: Use the rs485 functions on serial_coreRicardo Ribalda Delgado
In order to unify all the rs485 ioctl handling Use the implementation of TIOC[GS]RS485 ioctl handling on serial_core. Reviewed-by: Alan Cox <alan@linux.intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-06tty: serial: omap: Increase max consoles and add check to prevent crashNishanth Menon
Increase the maximum number of consoles possible to 10 since DRA7 now has the maximum number of consoles possible. without doing this, for example, enabling DRA7 UART10 results in internal data structures and console cannot match up and we endup with a crash as follows: [ 1.903503] omap_uart 48424000.serial: [UART-1]: failure [serial_omap_probe]: -22 [ 1.911437] omap_uart: probe of 48424000.serial failed with error -22 [ 1.920379] Unable to handle kernel NULL pointer dereference at virtual address 00000004 [ 1.928894] pgd = c0004000 [ 1.931732] [00000004] *pgd=00000000 [ 1.935485] Internal error: Oops: 5 [#1] SMP ARM [ 1.940338] Modules linked in: [ 1.943542] CPU: 1 PID: 12 Comm: kworker/1:0 Tainted: G W 3.18.0-rc1-00001-g8821bc4-dirty #6 [ 1.953521] task: ed8a2d00 ti: ed8a4000 task.ti: ed8a4000 [ 1.959197] PC is at process_one_work+0x38/0x4a4 [ 1.964050] LR is at 0x0 [ 1.966705] pc : [<c00548e0>] lr : [<00000000>] psr: 40000093 [ 1.966705] sp : ed8a5ea8 ip : ed8a5ec8 fp : eeb9abc0 [ 1.978759] r10: ed8a4000 r9 : 00000008 r8 : ed842458 [ 1.984252] r7 : 00000000 r6 : eeb9abc0 r5 : ed842440 r4 : edbf26a8 [ 1.991119] r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : 00000000 [ 1.997985] Flags: nZcv IRQs off FIQs on Mode SVC_32 ISA ARM Segment kernel [ 2.005767] Control: 10c5387d Table: 8000406a DAC: 00000015 [ 2.011810] Process kworker/1:0 (pid: 12, stack limit = 0xed8a4248) [ 2.018371] Stack: (0xed8a5ea8 to 0xed8a6000) [ 2.022949] 5ea0: 00000001 00000000 60000093 c008346c 00000001 ed8a5ec8 [ 2.031555] 5ec0: c0054de4 eeb9abc0 ed8a4000 ed842458 00000008 ed8a4000 eeb9abc0 ed842440 [ 2.040161] 5ee0: eeb9abc0 eeb9abf0 ed8a4000 ed842458 00000008 ed8a4000 eeb9abc0 c0054ec4 [ 2.048767] 5f00: ed8a4000 eeb9ac4c a0000053 00000000 ed845bc0 ed842440 c0054d80 00000000 [ 2.057342] 5f20: 00000000 00000000 00000000 c005999c 00000001 00000000 c05eaa64 ed842440 [ 2.065948] 5f40: 00000000 00000000 dead4ead ffffffff ffffffff c097c680 00000000 00000000 [ 2.074554] 5f60: c078acd4 ed8a5f64 ed8a5f64 00000000 00000000 dead4ead ffffffff ffffffff [ 2.083160] 5f80: c097c680 00000000 00000000 c078acd4 ed8a5f90 ed8a5f90 600000d3 ed845bc0 [ 2.091766] 5fa0: c00598d4 00000000 00000000 c000e668 00000000 00000000 00000000 00000000 [ 2.100341] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 2.108947] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 90005148 11010482 [ 2.117553] [<c00548e0>] (process_one_work) from [<c0054ec4>] (worker_thread+0x144/0x498) [ 2.126159] [<c0054ec4>] (worker_thread) from [<c005999c>] (kthread+0xc8/0xe4) [ 2.133758] [<c005999c>] (kthread) from [<c000e668>] (ret_from_fork+0x14/0x2c) [ 2.141357] Code: e1a04001 e1a05000 e893000f e31e0004 (e5978004) [ 2.147766] ---[ end trace 5798e2803311b69f ]--- <snip> The final solution is to transition off to use 8250 driver and no dependency on console structures and move away from omap-serial driver, hence no major cleanups are done for this driver, so add a simple check to prevent future crashes in a similar manner in case of platform with additional ports. Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-05tty: serial: omap: Remove probe error messageMarkus Pargmann
This error message is not necessary. The driver core code will print all probe error messages. It also resolves some error codes to proper error messages. For example -EPROBE_DEFER will only be printed as an info message. This patch removes the error message as the core prints the same information. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28tty: omap-serial: pull out calculation from baud_is_mode16Frans Klaver
To determine the correct divisor, we need to know the difference between the desired baud rate and the actual baud rate. The calculation for this difference is implemented twice within omap_serial_baud_is_mode16(). Pull out the calculation for easier maintenance. While at it, remove the CamelCasing from the variable names. Signed-off-by: Frans Klaver <frans.klaver@xsens.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-28tty: omap-serial: fix division by zeroFrans Klaver
If the chosen baud rate is large enough (e.g. 3.5 megabaud), the calculated n values in serial_omap_is_baud_mode16() may become 0. This causes a division by zero when calculating the difference between calculated and desired baud rates. To prevent this, cap the n13 and n16 values on 1. Division by zero in kernel. [<c00132e0>] (unwind_backtrace) from [<c00112ec>] (show_stack+0x10/0x14) [<c00112ec>] (show_stack) from [<c01ed7bc>] (Ldiv0+0x8/0x10) [<c01ed7bc>] (Ldiv0) from [<c023805c>] (serial_omap_baud_is_mode16+0x4c/0x68) [<c023805c>] (serial_omap_baud_is_mode16) from [<c02396b4>] (serial_omap_set_termios+0x90/0x8d8) [<c02396b4>] (serial_omap_set_termios) from [<c0230a0c>] (uart_change_speed+0xa4/0xa8) [<c0230a0c>] (uart_change_speed) from [<c0231798>] (uart_set_termios+0xa0/0x1fc) [<c0231798>] (uart_set_termios) from [<c022bb44>] (tty_set_termios+0x248/0x2c0) [<c022bb44>] (tty_set_termios) from [<c022c17c>] (set_termios+0x248/0x29c) [<c022c17c>] (set_termios) from [<c022c3e4>] (tty_mode_ioctl+0x1c8/0x4e8) [<c022c3e4>] (tty_mode_ioctl) from [<c0227e70>] (tty_ioctl+0xa94/0xb18) [<c0227e70>] (tty_ioctl) from [<c00cf45c>] (do_vfs_ioctl+0x4a0/0x560) [<c00cf45c>] (do_vfs_ioctl) from [<c00cf568>] (SyS_ioctl+0x4c/0x74) [<c00cf568>] (SyS_ioctl) from [<c000e480>] (ret_fast_syscall+0x0/0x30) Signed-off-by: Frans Klaver <frans.klaver@xsens.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24tty: serial: omap: fix Sparse warningsFelipe Balbi
Fix the following Sparse warnings: drivers/tty/serial/omap-serial.c:1418:49: warning: incorrect \ type in argument 2 (different address spaces) drivers/tty/serial/omap-serial.c:1418:49: expected void const \ [noderef] <asn:1>*from drivers/tty/serial/omap-serial.c:1418:49: got struct serial_rs485 \ *<noident> drivers/tty/serial/omap-serial.c:1426:35: warning: incorrect \ type in argument 1 (different address spaces) drivers/tty/serial/omap-serial.c:1426:35: expected void [noderef] \ <asn:1>*to drivers/tty/serial/omap-serial.c:1426:35: got struct serial_rs485 \ *<noident> Reported-by: Nishanth Menon <nm@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24tty: serial: omap: remove unneeded singlethread workqueueFelipe Balbi
it wasn't used by anything, just remove it. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24tty: serial: omap: remove some dead codeFelipe Balbi
nobody passes a DTR_gpio to this driver, so this code is not necessary. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24tty: serial: omap: switch over to devm_ioremap_resourceFelipe Balbi
just using helper function to remove some duplicated code a bit. While at that, also move allocation of struct uart_omap_port higher in the code so that we return much earlier in case of no memory. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24tty: serial: omap: switch over to platform_get_resourceFelipe Balbi
this way we can remove one pointer declaration. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24tty: serial: omap: cleanup variable declarationsFelipe Balbi
cleanup only, no functional changes. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24tty: serial: omap: switch over to devm_request_gpioFelipe Balbi
this will make sure gpio gets freed automatically when this device is destroyed. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24tty: serial: add missing bracesFelipe Balbi
per CodingStyle we should have those braces, no functional changes. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-24Revert "serial: omap: unlock the port lock"Felipe Balbi
This reverts commit 0324a821029e1f54e7a7f8fed48693cfce42dc0e. That commit tried to fix a deadlock problem when using hci_ldisc, but it turns out the bug was in hci_ldsic all along where it was calling ->write() from within ->write_wakeup() callback. The problem is that ->write_wakeup() was called with port lock held and ->write() tried to grab the same port lock. Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16serial: omap: Fix missing pm_runtime_resume handling by simplifying codeTony Lindgren
The lack of pm_runtime_resume handling for the device state leads into device wake-up interrupts not working after a while for runtime PM. Also, serial-omap is confused about the use of device_may_wakeup. The checks for device_may_wakeup should only be done for suspend and resume, not for pm_runtime_suspend and pm_runtime_resume. The wake-up events for PM runtime should always be enabled. The lack of pm_runtime_resume handling leads into device wake-up interrupts not working after a while for runtime PM. Rather than try to patch over the issue of adding complex tests to the pm_runtime_resume, let's fix the issues properly: 1. Make serial_omap_enable_wakeup deal with all internal PM state handling so we don't need to test for up->wakeups_enabled elsewhere. Later on once omap3 boots in device tree only mode we can also remove the up->wakeups_enabled flag and rely on the wake-up interrupt enable/disable state alone. 2. Do the device_may_wakeup checks in suspend and resume only, for runtime PM the wake-up events need to be always enabled. 3. Finally just call serial_omap_enable_wakeup and make sure we call it also in pm_runtime_resume. 4. Note that we also have to use disable_irq_nosync as serial_omap_irq calls pm_runtime_get_sync. Fixes: 2a0b965cfb6e (serial: omap: Add support for optional wake-up) Cc: stable@vger.kernel.org # v3.13+ Signed-off-by: Tony Lindgren <tony@atomide.com> Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-04-16serial: omap: free the wakeup settings in removeSanjay Singh Rawat
Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17tty/serial: omap: empty the RX FIFO at the end of half-duplex TXDimitris Lampridis
Provided that the SER_RS485_RX_DURING_TX flag is not set, empty the RX FIFO to prevent reading back the transmitted data. Signed-off-by: Dimitris Lampridis <dlampridis@logikonlabs.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-03-17tty/serial: omap: fix RX interrupt enable/disable in half-duplex TXDimitris Lampridis
Make sure that serial_omap_stop_rx() also disables RDI (Receiver Data Interrupt), otherwise the interrupt handler will call serial_omap_rdi() to read the new data, resulting in the transmission being echoed back. When the half-duplex transmission is complete, in order to reverse the effects of serial_omap_stop_rx(), we should re-enable: * the RX interrupts _without_ overwriting up->ier * the UART_LSR_DR bit of the up->port.read_status_mask Signed-off-by: Dimitris Lampridis <dlampridis@logikonlabs.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-13serial: omap: fix rs485 probe on defered pinctrlMichael Grzeschik
If the gpio is not yet available we better also defer the probing in the rs485 case. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-02-13serial: omap-serial: Move info message to probe functionMarkus Pargmann
Currently the info message about a missing wakeirq for uart is printed every time the serial driver's startup function is called. This happens multiple times and not just once. This can cause lots of extra messages at boot time, slowing things down. It is caused by commit 2a0b965cfb6e (serial: omap: Add support for optional wake-up) which was applied for v3.13-rc1. This patch moves the infomessage to the probe function to display it only once. Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: stable <stable@vger.kernel.org> # 3.13 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-31serial: omap: fix missing commaPhilippe Proulx
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>, Signed-off-by: Philippe Proulx <philippe.proulx@savoirfairelinux.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-29serial: omap: fix a few checkpatch warningsPhilippe Proulx
Signed-off-by: Philippe Proulx <philippe.proulx@savoirfairelinux.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-29serial: omap: improve RS-485 performancePhilippe Proulx
If RS-485 is enabled, make the OMAP UART fire THR interrupts when both TX FIFO and TX shift register are empty instead of polling the equivalent status bit. This removes the burst of interrupt requests seen at every end of transmission. Also: the comment said that the TX FIFO trigger level was set at 16 characters when it's 32 in reality. Signed-off-by: Philippe Proulx <philippe.proulx@savoirfairelinux.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-29serial: omap: Add support for optional wake-upTony Lindgren
With the recent pinctrl-single changes, omaps can treat wake-up events from deeper idle states as interrupts. There's a separate "io chain" controller on most omaps that stays enabled when the device hits off-idle and the regular interrupt controller is powered off. Let's add support for the optional second interrupt for wake-up events. And then serial-omap can manage the wake-up interrupt from it's runtime PM calls to avoid spurious interrupts during runtime. Note that the wake interrupt is board specific as it uses the UART RX pin, and for omap3, there are six pin options for UART3 RX pin. Also Note that the legacy platform based booting handles the wake-ups in the legacy mux driver and does not need to pass the wake-up interrupt to the driver. And finally, to pass the wake-up interrupt in the dts file, either interrupt-map or the pending interrupts-extended property needs to be passed. It's probably best to use interrupts-extended when it's available. Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <khilman@linaro.org> Cc: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Felipe Balbi <balbi@ti.com> Reviewed-by: Roger Quadros <rogerq@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-10-16serial: omap: delete .set_wake callbackLinus Walleij
This callback is unused by the serial core since pre-git days and is not coming back. Delete it. Enabling wakeup on the OMAP serial driver is done through other runpaths these days. Cc: Tony Lindgren <tony@atomide.com> Cc: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26OMAP/serial: Fix Mode13 vs Mode16 priorityAlexey Pelykh
Make Mode16 more preferred than Mode13, to match TRM baudrates table. Signed-off-by: Alexey Pelykh <alexey.pelykh@gmail.com> Cc: Tony Lindgren <tony@atomide.com> Cc: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26OMAP/serial: Fix misnamed variableAlexey Pelykh
Fix misnamed variable to eliminate confusion. Signed-off-by: Alexey Pelykh <alexey.pelykh@gmail.com> Cc: Tony Lindgren <tony@atomide.com> Cc: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27Revert "OMAP: UART: Keep the TX fifo full when possible"Greg Kroah-Hartman
This reverts commit c4415084218c68c5ee2fc583431e89a78d896b19. Kevin writes: Hmm, another OMAP serial patch that wasn't Cc'd to linux-omap where OMAP users might have seen it. :( I just bisected a strange problem in linux-next on OMAP3 down to this patch. Reverting it fixes the problem. On OMAP3530 Beagle and Overo, after boot, doing a 'cat /proc/cpuinfo' was not returning to a prompt, suggesting something strange with the FIFO. Hitting return gets me back to a prompt. Greg, this one should also be dropped from tty-next until it can be further investgated and the problem solved. Reported-by: Kevin Hilman <khilman@linaro.org> Cc: Dmitry Fink <finik@ti.com> Cc: Alexander Savchenko <oleksandr.savchenko@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-27Revert "serial: omap: Fix IRQ handling return value"Greg Kroah-Hartman
This reverts commit 908fd7e566b4c12e36e4487d2d5946de5e5ea30f. Kevin writes: Greg, without a better justification in the changelog, I think this patch should be dropped from tty-next. Reported-by: Kevin Hilman <khilman@linaro.org> Cc: Ruchika Kharwar <ruchika@ti.com> Cc: Alexander Savchenko <oleksandr.savchenko@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-15OMAP: serial: Remove incorrect disabling of IER interruptMark Jackson
The recent patch to add RS485 contained a bug whereby the IER interrupt was cleared down incorrectly. This patch fixes the problem. Signed-off-by: Mark Jackson <mpfj@newflow.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-08-14OMAP: add RS485 supportMark Jackson
This patch adds RS485 support to the OMAP serial driver, as defined in:- Documentation/devicetree/bindings/serial/rs485.txt When a UART transmitter is connected to (eg) a RS485 driver, it is necessary to turn the driver on/off as quickly as possible. This is best achieved in the serial driver itself (rather than in userspace where the latency can be quite large). This patch allows a GPIO pin to be defined (via DT) that controls the enabling of the driver at the start of a message, and disables the driver when the message has been completed. When RS485 is disabled, the RTS pin is set to on. Signed-off-by: Mark Jackson <mpfj@newflow.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-31serial: use dev_get_platdata()Jingoo Han
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26serial: omap: enable PM runtime only when its fully configuredGrygorii Strashko
If earlyprintk is enabled and current UART is console port the platform code can mark it as RPM_ACTIVE to sync real IP state with PM Runtime and avoid resuming of already active device, but now, driver initialization will be performed in the wrong way: pm_runtime_enable(&pdev->dev); <-- PM runtime alowed (device state RPM_ACTIVE) if (omap_up_info->autosuspend_timeout == 0) omap_up_info->autosuspend_timeout = -1; device_init_wakeup(up->dev, true); pm_runtime_use_autosuspend(&pdev->dev); <-- update_autosuspend() will be called and it will disable device (device state RPM_SUSPENDED) pm_runtime_set_autosuspend_delay(&pdev->dev, omap_up_info->autosuspend_timeout); <-- update_autosuspend() will be called which will re-enable device (device state RPM_ACTIVE), because autosuspend_timeout < 0 pm_runtime_irq_safe(&pdev->dev); pm_runtime_get_sync(&pdev->dev); <-- will do nothing Such behavior isn't expected by OMAP serial drivers and causes unpredictable calls of serial_omap_runtime_suspend() and serial_omap_runtime_resume(). Hence, fix it by allowing PM runtime only after all its parameters are configured. CC: Tony Lindgren <tony@atomide.com> CC: Rajendra Nayak <rnayak@ti.com> CC: Felipe Balbi <balbi@ti.com> CC: Kevin Hilman <khilman@linaro.org> Tested-by: Mark Jackson <mpfj-list@newflow.co.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26serial: omap: Fix IRQ handling return valueRuchika Kharwar
Ensure the Interrupt handling routine return IRQ_HANDLED vs IRQ_NONE. Signed-off-by: Ruchika Kharwar <ruchika@ti.com> Signed-off-by: Alexander Savchenko <oleksandr.savchenko@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26serial: omap: Initialize platform_dataVikram Pandita
Otherwise serial driver would crash accessing platform_data that was not initialized in functions like: serial_omap_pm(...) ... if (!state && pdata->enable_wakeup) ^^^^^^^ ... Signed-off-by: Vikram Pandita <vikram.pandita@ti.com> Signed-off-by: Alexander Savchenko <oleksandr.savchenko@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26OMAP: UART: Fix the revision register read.Ruchika Kharwar
The revision register is a 32 bit register. The serial_in() function reads only the lower 16 bits of the register. This leads to an incorrect computation of the Module revision. Signed-off-by: Ruchika Kharwar <ruchika@ti.com> [oleksandr.savchenko@ti.com: add some whitespaces] Signed-off-by: Alexander Savchenko <oleksandr.savchenko@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26OMAP: UART: Keep the TX fifo full when possibleDmitry Fink
Current logic results in interrupt storm since the fifo is constantly below the threshold level. Change the logic to fill all the available spaces in the fifo as long as we have data to minimize the possibilty of underflow and elimiate excessive interrupts. Signed-off-by: Dmitry Fink <finik@ti.com> Signed-off-by: Alexander Savchenko <oleksandr.savchenko@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-26OMAP2+: UART: enable tx wakeup bit for wer regGovindraj.R
wer has TX wakeup bit available enable the same by populating the necessary tx wakeup flag for the applicable module ip blocks and use the same while configuaring wer reg. Also wer is not context restored, restore wer when context is lost. Cc: Paul Walmsley <paul@pwsan.com> Cc: Felipe Balbi <balbi@ti.com> Cc: Kevin Hilman <kevin.hilman@linaro.org> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (for drivers/tty changes) Signed-off-by: Govindraj.R <govindraj.raja@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>