summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/imx.c
AgeCommit message (Collapse)Author
2012-10-02tty: serial: imx: console write routing is unsafe on SMPXinyu Chen
commit 9ec1882df244c4ee1baa692676fef5e8b0f5487d upstream. The console feature's write routing is unsafe on SMP with the startup/shutdown call. There could be several consumers of the console * the kernel printk * the init process using /dev/kmsg to call printk to show log * shell, which open /dev/console and write with sys_write() The shell goes into the normal uart open/write routing, but the other two go into the console operations. The open routing calls imx serial startup, which will write USR1/2 register without any lock and critical with imx_console_write call. Add a spin_lock for startup/shutdown/console_write routing. This patch is a port from Freescale's Android kernel. Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com> Tested-by: Dirk Behme <dirk.behme@de.bosch.com> CC: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-01serial: imx: add clk_prepare/clk_unprepareRichard Zhao
It's for migrating to generic clk framework API. Signed-off-by: Richard Zhao <richard.zhao@linaro.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2012-01-04tty: serial: imx: move del_timer_sync() to avoid potential deadlockEric Miao
del_timer_sync() acquires its own lock and doesn't have to be nested within the spinlock of sport->port.lock in imx_set_termios(), which will cause potential deadlock. Fix this by moving it outside. Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Shawn Guo <shawn.guo@linaro.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Eric Miao <eric.miao@linaro.org> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-04imx: add polled io uart methodsSaleem Abdulrasool
These methods are invoked if the iMX uart is used in conjuction with kgdb during early boot. In order to access the UART without the interrupts, the kernel uses the basic polling methods for IO with the device. With these methods implemented, it is now possible to enable kgdb during early boot over serial. Signed-off-by: Saleem Abdulrasool <compnerd@compnerd.org> Signed-off-by: Dirk Behme <dirk.behme@gmail.com> CC: Sascha Hauer <s.hauer@pengutronix.de> CC: Fabio Estevam <festevam@gmail.com> CC: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> CC: linux-serial@vger.kernel.org CC: Alan Cox <alan@linux.intel.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-04imx: Add save/restore functions for UART control regsDirk Behme
Factor out the uart save/restore functionality instead of having the same code several times in the driver. Signed-off-by: Dirk Behme <dirk.behme@gmail.com> CC: Saleem Abdulrasool <compnerd@compnerd.org> CC: Sascha Hauer <s.hauer@pengutronix.de> CC: Fabio Estevam <festevam@gmail.com> CC: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> CC: linux-serial@vger.kernel.org CC: Alan Cox <alan@linux.intel.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-04serial/imx: let probing fail for the dt case without a valid aliasUwe Kleine-König
When the uart device is instantiated by dt but dt doesn't provide an alias then better let probing fail instead of falling back to an unrelated device id used for the line number and no platform data. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-04serial/imx: propagate error from of_alias_get_id instead of using -ENODEVUwe Kleine-König
A quick look at of_alias_get_id shows that in the error case it returns -ENODEV, too, but still it's better style to propagate the value as is. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: Shawn Guo <shawn.guo@linaro.org> Cc: Alan Cox <alan@linux.intel.com> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Jeremy Kerr <jeremy.kerr@canonical.com> Cc: Jason Liu <jason.hui@linaro.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Jason Liu <jason.hui@linaro.org> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-04tty: serial: imx: Allow UART to be a source for wakeupFabio Estevam
Allow UART to be a source for wakeup from low power mode. Tested on a MX27PDK by doing: echo enabled > /sys/devices/platform/imx21-uart.0/tty/ttymxc0/power/wakeup echo mem > /sys/power/state and then pressing a key in the console will wakeup the sytem. Suggested-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Tested-by: Richard Zhao <richard.zhao@freescale.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26serial/imx: propagate error of platform_driver_register in init routineUwe Kleine-König
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-27Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6Linus Torvalds
* 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6: of_mdio: Don't phy_scan_fixups() twice Devicetree: Expand on ARM Primecell binding documentation dt: Add empty of_match_node() macro dt: add empty dt helpers for non-dt build devicetree: fix build error on drivers/tty/serial/altera_jtaguart.c devicetree: Add ARM pl022 spi controller binding doc devicetree: Add ARM pl061 gpio controller binding doc of/irq: of_irq_find_parent: check for parent equal to child MAINTAINERS: update devicetree maintainers dt: add helper to read 64-bit integers tty: use of_match_ptr() for of_match_table entry OF: Add of_match_ptr() macro dt: add empty for_each_child_of_node, of_find_property devicetree: Document Qualcomm and Atmel prefixes serial/imx: add of_alias_get_id() reference back dt: add of_alias_scan and of_alias_get_id devicetree: Add a registry of vendor prefixes
2011-09-22serial/imx: add of_alias_get_id() reference backShawn Guo
As of_alias_get_id() gets fixed and ready for use, the patch adds the of_alias_get_id() reference back to imx serial driver. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> [grant.likely: changed pr_err() to dev_err(), dropped unnecessary else] Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-08-24serial/imx: support to handle break characterHui Wang
The imx UART hardware controller can identify BREAK character and the imx_set_termios() can accept BRKINT set by users, but current existing imx_rxint() can't pass BREAK character and TTY_BREAK to the tty layer as other serial drivers do (8250.c omap_serial.c). Here add code to handle BREAK character and pass it to tty layer. To detect error occurrence, i use URXD_ERR to replace (URXD_OVRRUN | URXD_FRMERR | ...) because any kind of error occurs, URXD_ERR will always be set to 1. I put the URXD_BRK to the first place to check since when BREAK error occurs, not only URXD_BRK is set to 1, but also URXD_PRERR and URXD_FRMERR are all set to 1. This arrangement can filter out fake parity and frame errors when BREAK error occurs. Signed-off-by: Hui Wang <jason77.wang@gmail.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-04dt: remove of_alias_get_id() referenceGrant Likely
of_alias_get_id() is broken and being reverted. Remove the reference to it and replace with a single incrementing id number. There is no risk of regression here on the imx driver since the imx change to use of_alias_get_id() is commit 22698aa2, "serial/imx: add device tree probe support" which is new for v3.1, and it won't get used unless CONFIG_OF is enabled and the board is booted using a device tree. A single incrementing integer is sufficient for now. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Shawn Guo <shawn.guo@linaro.org>
2011-07-27serial/imx: add device tree probe supportShawn Guo
It adds device tree probe support for imx tty/serial driver. Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com> Signed-off-by: Jason Liu <jason.hui@linaro.org> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Alan Cox <alan@linux.intel.com> Cc: Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Grant Likely <grant.likely@secretlab.ca> Acked-by: Grant Likely <grant.likely@secretlab.ca>
2011-07-27serial/imx: get rid of the uses of cpu_is_mx1()Shawn Guo
The patch removes all the uses of cpu_is_mx1(). Instead, it uses the .id_table of platform_driver to distinguish the uart device type, IMX1_UART and IMX21_UART. The IMX21_UART type runs on all i.mx except i.mx1. A couple of !cpu_is_mx1 logic gets turned into is_imx21_uart, as the codes wrapped there are really IMX21 type uart specific. It also removes macro MX1_UCR3_REF25 and MX1_UCR3_REF30 which are not used anywhere. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: Sascha Hauer <s.hauer@pengutronix.de> Cc: Alan Cox <alan@linux.intel.com> Cc: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Grant Likely <grant.likely@secretlab.ca>
2011-06-10treewide: Convert uses of struct resource to resource_size(ptr)Joe Perches
Several fixes as well where the +1 was missing. Done via coccinelle scripts like: @@ struct resource *ptr; @@ - ptr->end - ptr->start + 1 + resource_size(ptr) and some grep and typing. Mostly uncompiled, no cross-compilers. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2011-05-23Merge branch 'tty-next' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6 * 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (48 commits) serial: 8250_pci: add support for Cronyx Omega PCI multiserial board. tty/serial: Fix break handling for PORT_TEGRA tty/serial: Add explicit PORT_TEGRA type n_tracerouter and n_tracesink ldisc additions. Intel PTI implementaiton of MIPI 1149.7. Kernel documentation for the PTI feature. export kernel call get_task_comm(). tty: Remove to support serial for S5P6442 pch_phub: Support new device ML7223 8250_pci: Add support for the Digi/IBM PCIe 2-port Adapter ASoC: Update cx20442 for TTY API change pch_uart: Support new device ML7223 IOH parport: Use request_muxed_region for IT87 probe and lock tty/serial: add support for Xilinx PS UART n_gsm: Use print_hex_dump_bytes drivers/tty/moxa.c: Put correct tty value TTY: tty_io, annotate locking functions TTY: serial_core, remove superfluous set_task_state TTY: serial_core, remove invalid test Char: moxa, fix locking in moxa_write ... Fix up trivial conflicts in drivers/bluetooth/hci_ldisc.c and drivers/tty/serial/Makefile. I did the hci_ldisc thing as an evil merge, cleaning things up.
2011-04-19serial/imx: read cts state only after acking cts change irqUwe Kleine-König
If cts changes between reading the level at the cts input (USR1_RTSS) and acking the irq (USR1_RTSD) the last edge doesn't generate an irq and uart_handle_cts_change is called with a outdated value for cts. The race was introduced by commit ceca629 ([ARM] 2971/1: i.MX uart handle rts irq) Reported-by: Arwed Springer <Arwed.Springer@de.trumpf.com> Tested-by: Arwed Springer <Arwed.Springer@de.trumpf.com> Cc: stable@kernel.org # 2.6.14+ Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-04-19tty: remove invalid location line in file headerJovi Zhang
remove invalid location line in each file header after location moved from driver/char to driver/tty Signed-off-by: Jovi Zhang <bookjovi@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-03-31Fix common misspellingsLucas De Marchi
Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
2011-01-13tty: move drivers/serial/ to drivers/tty/serial/Greg Kroah-Hartman
The serial drivers are really just tty drivers, so move them to drivers/tty/ to make things a bit neater overall. This is part of the tty/serial driver movement proceedure as proposed by Arnd Bergmann and approved by everyone involved a number of months ago. Cc: Arnd Bergmann <arnd@arndb.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Rogier Wolff <R.E.Wolff@bitwizard.nl> Cc: Michael H. Warfield <mhw@wittsend.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>