Commit graph

1339 commits

Author SHA1 Message Date
Takashi Yoshii 8c66d6d2a1 serial: sh-sci: fix common SCIFB regmap definition
About FIFO count, there are two variants of SCIFs which show
a) TX count in upper, RX count in lower byte of FDR register
b) TX count in TFDR register, RX count in RFDR register

Common SCIFB regmap in current source code is defined as "a".
At least 7372 and 73a0 HW manual say their SICFB are "b".

This patch alters the definition to "b", considering the current
one has come from a mistake. The reason is as follows.

The flag SCIFB sh-sci driver means it has 256 byte FIFO.
The count is from 0(empty) to 256(full), that makes 9-bit.
Because FDR is 16-bit register, it can not hold two 9-bits.
That's why, SCIFB can not be "a".

Signed-off-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 18:02:51 -08:00
Takashi Yoshii 63f7ad115e serial: sh-sci: mask SCTFDR/RFDR according to fifosize
Current mask 0xff to SCTFDR/RFDR damages SCIFB, because the
registers on SCIFB have 9-bit data (0 to 256).

This patch changes the mask according to port->fifosize.
Though I'm not sure if the mask is really needed (I don't know if
there are variants which have non-zero upper bits), it is safer.

Signed-off-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 18:02:37 -08:00
Takashi Yoshii 9d482cc353 serial: sh-sci: support lower baud rate
Support prescaler 1/16 and 1/64, in addition to current 1 and 1/4.

Supporting below 2400bps was dropped long time ago in mainline.
Since then, setting lower rate has been resulting in erroneous
register value, without indicating any errors through API.

This patch adds more prescaler to support lower rates again.
This still doesn't check range, but we won't hit the case because
even 50bps at 48MHz clock is now supported.

Signed-off-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 18:02:37 -08:00
Takashi Yoshii 4ffc3cdb64 serial: sh-sci: fix condition test to set SCBRR
SCBRR == 0 is valid value (divide by 1).

Signed-off-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 18:02:37 -08:00
Teppei Kamijou 0174e5ca82 serial: sh-sci: console runtime PM support (revisit)
The commit 1ba7622094 (serial: sh-sci: console Runtime PM support,
from Magnus Damm <damm@opensource.se>, 2011-08-03), tried to support
console runtime PM, but unfortunately it didn't work for us for some
reason.  We did not investigated further at that time, instead would
like to propose a different approach.

In Linux tty/serial world, to get console PM work properly, a serial
client driver does not have to maintain .runtime_suspend()/..resume()
calls itself, but can leave console power power management handling to
the serial core driver.

This patch moves the sh-sci driver in that direction.

Notes:

* There is room to optimize console runtime PM more aggressively by
  maintaining additional local runtime PM calls, but as a first step
  having .pm() operation would suffice.

* We still have a couple of direct calls to sci_port_enable/..disable
  left in the driver.  We have to live with them, because they're out
  of serial core's help.

Signed-off-by: Teppei Kamijou <teppei.kamijou.yb@renesas.com>
Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 18:02:36 -08:00
Shinya Kuribayashi 00cadbfd1e Partially revert "serial: sh-sci: console Runtime PM support"
This partially reverts commit 1ba7622094 (serial: sh-sci: console
Runtime PM support, from Magnus Damm <damm@opensource.se>, 2011-08-03).

The generic 'serial_core' can take care of console PM maintenance,
so all (or at least the first thing) we have to do to get console PM
work properly, is to implement uart_ops ->pm() operation in the sh-sci
serial client driver.

This patch partially reverts the commit above, but leaving sci_reset()
change in place, because sci_reset() is already part of another commit
(73c3d53f38 serial: sh-sci: Avoid FIFO clear for MCE toggle.).

A revised version of console PM support follows next.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 18:02:36 -08:00
Shinya Kuribayashi 8807ec6c70 Revert "sh-sci / PM: Use power.irq_safe"
This reverts commit 5a50a01bf0 (sh-sci / PM: Use power.irq_safe, from
Rafael J. Wysocki <rjw@sisk.pl>, 2011-08-24).

In order to get console PM work properly, we should implement uart_ops
->pm() operation, rather than sprinkle band-ading runtime PM calls in
the driver.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 18:02:04 -08:00
Shinya Kuribayashi cee31c52df Revert "sh-sci / PM: Avoid deadlocking runtime PM"
This reverts commit 048be431e4 (sh-sci / PM: Avoid deadlocking runtime
PM, from Rafael J. Wysocki <rjw@sisk.pl>, 2012-03-09).

In order to get console PM work properly, we should implement uart_ops
->pm() operation, rather than sprinkle band-ading runtime PM calls in
the driver.

Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi.px@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 18:02:04 -08:00
Jiri Slaby 191c5f1027 TTY: call tty_port_destroy in the rest of drivers
After commit "TTY: move tty buffers to tty_port", the tty buffers are
not freed in some drivers. This is because tty_port_destructor is not
called whenever a tty_port is freed. This was an assumption I counted
with but was unfortunately untrue. So fix the drivers to fulfil this
assumption.

To be sure, the TTY buffers (and later some stuff) are gone along with
the tty_port, we have to call tty_port_destroy at tear-down places.
This is mostly where the structure containing a tty_port is freed.
This patch does exactly that -- put tty_port_destroy at those places.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:20:58 -08:00
Jiri Slaby d0f59141ca TTY: isicom, fix tty buffers memory leak
After commit "TTY: move tty buffers to tty_port", the tty buffers are
not freed in some drivers. This is because tty_port_destructor is not
called whenever a tty_port is freed. This was an assumption I counted
with but was unfortunately untrue. So fix the drivers to fulfil this
assumption.

This one is special as we need more work to be done. Previously,
the tty_port was initialized at module load time, but to be able to
destroy the port and init it again, we now do the initialization in
probe and destroy in remove. I.e. at more appropriate places for that.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:20:58 -08:00
Jiri Slaby de274bfe0f TTY: introduce tty_port_destroy
After commit "TTY: move tty buffers to tty_port", the tty buffers are
not freed in some drivers. This is because tty_port_destructor is not
called whenever a tty_port is freed. This was an assumption I counted
with but was unfortunately untrue.

Those using refcounting are safe now, but for those which do not we
introduce a function to be called right before the tty_port is freed
by the drivers.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:20:58 -08:00
Jiri Slaby 9a8e62bc68 TTY: n_gsm, use kref from tty_port
After commit "TTY: move tty buffers to tty_port", the tty buffers are
not freed in some drivers. This is because tty_port_destructor is not
called whenever a tty_port is freed. This was an assumption I counted
with but was unfortunately untrue. So fix the drivers to fulfil this
assumption.

Here it is enough to switch to refcounting in tty_port.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:20:57 -08:00
Jiri Slaby 81c79838ca TTY: pty, fix tty buffers leak
After commit "TTY: move tty buffers to tty_port", the tty buffers are
not freed in some drivers. This is because tty_port_destructor is not
called whenever a tty_port is freed. This was an assumption I counted
with but was unfortunately untrue. So fix the drivers to fulfil this
assumption.

PTY is one of those, here we just need to use tty_port_put instead of
kfree. (Assuming tty_port_destructor does not need port->ops to be set
which we change here too.)

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:18:55 -08:00
Jiri Slaby 7342c59a44 TTY: isicom, stop using port->tty
Do not access unsafe port->tty pointer when we have a safe tty
already. Use the safe one.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:18:55 -08:00
Gabor Juhos 2dff8ad926 tty/serial/ar933x_uart: fix baud rate calculation
The UART of the AR933x SoC implements a fractional divisor
for generating the desired baud rate.

The current code uses a fixed value for the fractional
part of the divisor, and this leads to improperly
calculated baud rates:

   baud    scale   step  real baud         diff
     300   5207*   8192     17756     17456   5818.66%
     600   2603*   8192     35511     34911   5818.50%
    1200   1301*   8192     71023     69823   5818.58%
    2400    650*   8192     11241      8841    368.37%
    4800    324*   8192     22645     17845    371.77%
    9600    161    8192      9645        45      0.46%
   14400    107    8192     14468        68      0.47%
   19200     80    8192     19290        90      0.46%
   28800     53    8192     28935       135      0.46%
   38400     39    8192     39063       663      1.72%
   57600     26    8192     57870       270      0.46%
  115200     12    8192    120192      4992      4.33%
  230400      5    8192    260417     30017     13.02%
  460800      2    8192    520833     60033     13.02%
  921600      0    8192   1562500    640900     69.93%

After the patch, the integer and fractional parts of the
divisor will be calculated dynamically. This ensures that
the UART will use correct baud rates:

   baud    scale   step  real baud         diff
     300      6      11       300         0      0.00%
     600     54     173       600         0      0.00%
    1200     30     195      1200         0      0.00%
    2400     30     390      2400         0      0.00%
    4800     48    1233      4800         0      0.00%
    9600     78    3976      9600         0      0.00%
   14400     98    7474     14400         0      0.00%
   19200     55    5637     19200         0      0.00%
   28800    130   19780     28800         0      0.00%
   38400     36    7449     38400         0      0.00%
   57600     78   23857     57600         0      0.00%
  115200     43   26575    115200         0      0.00%
  230400     23   28991    230400         0      0.00%
  460800     11   28991    460800         0      0.00%
  921600      5   28991    921599        -1      0.00%

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:15:02 -08:00
David Rientjes 5318609519 mm, oom: ensure sysrq+f always passes valid zonelist
With hotpluggable and memoryless nodes, it's possible that node 0 will
not be online, so use the first online node's zonelist rather than
hardcoding node 0 to pass a zonelist with all zones to the oom killer.

Signed-off-by: David Rientjes <rientjes@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:13:48 -08:00
Alexander Shiyan 18e0749aa8 serial: Unneeded ARCH dependencies are removed
This patch performs a small cleanup tty/Serial/Kconfig file by removing
unneeded ARCH dependencies. This dependencies already included in
board/type symbols.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:11:42 -08:00
Feng Tang 50827fbde1 serial: mfd: Add nmi_touch_watchdog() into the console write function
This is following what 8250 driver is doing in console write function,
to avoid the hardware lockup case.

v2: incldudes the <linux/nmi.h>

Signed-off-by: Feng Tang <feng.tang@intel.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 17:06:10 -08:00
Steven Miao 9642dbe73c serial: bfin-uart: avoid dead lock in rx irq handler in smp kernel
Disabing dma irq and lock bottom half in smp kernel doesn't ensure exclusive
uart access. Call spin_lock_irqsave() instead.

Signed-off-by: Steven Miao <realmz6@gmail.com>
Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 16:59:58 -08:00
Alan Cox 7a876b39b5 serial: cast before shifting on port io
Without this we will shift data into oblivion and give wrong results on
some configurations

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 16:59:58 -08:00
Josh Cartwright 4bb535d2b6 serial: xilinx_uartps: kill CONFIG_OF conditional
The Zynq platform requires the use of CONFIG_OF.  Remove the #ifdef
conditionals in the uartps driver.  Make dependency explicit in Kconfig.

Signed-off-by: Josh Cartwright <josh.cartwright@ni.com>
Tested-by: Michal Simek <monstr@monstr.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 16:58:19 -08:00
Alan Cox d1519e23c2 ipwireless: don't oops if we run out of space
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=49851

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 16:53:15 -08:00
Alan Cox 4bd82136cd moxa: dcd handling of CLOCAL is backwards
We should do hangup on dcd loss if CLOCAL is false not true.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=49911
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 16:53:14 -08:00
Jun Chen e8823f1ca8 serial: ifx6x60: ifx_spi_write don't need to do mrdy_assert when fifo is not empty
This patch check whether the fifo lenth is empty before writing new data to fifo.If condition
is true,ifx_spi_write need to trigger one mrdy_assert. If condition is false,the mrdy_assert
will be trigger by the next ifx_spi_io.

Cc: Bi Chao <chao.bi@intel.com>
Signed-off-by: Chen Jun <jun.d.chen@intel.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 16:51:38 -08:00
chao bi 1b2f8a9550 serial:ifx6x60:SPI header is decoded incorrectly
This patch is to correct the bit mapping of "MORE" and "CTS" in SPI frame header.
Per SPI protocol, SPI header is encoded with length of 4 byte, which is defined
as below:
bit 0 ~ 11: current data size;
bit 12: "MORE" bit;
bit 13: reserve
bit 14 ~ 15: reserve
bit 16 ~ 27: next data size
bit 28: RI
bit 29: DCD
bit 30: CTS/RTS
bit 31: DSR/DTR

According to above SPI header structure, the bit mapping of "MORE" and "CTS" is
incorrect in function ifx_spi_decode_spi_header();

Cc: Chen Jun <jun.d.chen@intel.com>
Signed-off-by: channing <chao.bi@intel.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-15 16:47:35 -08:00
Axel Lin 1838b8c487 tty: serial: max310x: Add terminating entry for spi_device_id table
The spi_device_id table is supposed to be zero-terminated.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-14 14:49:42 -08:00
Paul Mackerras c019bc119a TTY: hvc_console, fix port reference count going to zero prematurely
Commit bdb498c200 "TTY: hvc_console, add tty install" took the port
refcounting out of hvc_open()/hvc_close(), but failed to remove the
kref_put() and tty_kref_put() calls in hvc_hangup() that were there to
remove the extra references that hvc_open() had taken.

The result was that doing a vhangup() when the current terminal was
a hvc_console, then closing the current terminal, would end up calling
destroy_hvc_struct() and making the port disappear entirely.  This
meant that Fedora 17 systems would boot up but then not display the
login prompt on the console, and attempts to open /dev/hvc0 would
give a "No such device" error.

This fixes it by removing the extra kref_put() and tty_kref_put() calls.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-14 12:27:29 -08:00
Arnd Bergmann 8a6ff8a0a2 arm: at91: mach header cleanup
This first patch serie start the cleanup of the header in mach
 by moving all the platform data to include/linux/platform_data
 
 and move the board header and drivers header next to them
 
 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
 Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJQmQMyAAoJEOrjwV5ZMRf2N8kP/1J2DI26zhNWGIdiTPFX/HXG
 o03lvElDKDDyNtC87gU2DnYkOdjFVRpagZxv089whDs4Lt22A8ClaxEFca9K1oPg
 XO0NtuHbTL3wGlPLJH4C90bpQWY4FyIQLMfPaMeifrP1OpRkeSWAYKfFUB/wOtRC
 KWNl+WmpBt9JN9H1RIezYxpRteC+wUBKpYVZkRdT3OkQ4/oMqDIWzZqkMCTKy+Bb
 Ucs9ZFqkJ/5fSGYjHLG34VpbepFKgCqeDVugz2v+7SHvIkl0/XbRhGOdxJek54GD
 0OW8Gg5Utw47YQ1uYDR3IM00cod41/l9NYMKZm/DIEUdvNP3Mp+/X0Knehov+O+7
 7Xs8eSzBHE0mRAx2as71av08PNptNVAcJh/UAO8PWE5yLGivGrp8kQWzJItnl2ma
 8GmIK26bmMAqGuR+wANrT/pCCW5kxALE8L1JnCMzjhv5TvKE88mjUZuVmNnZGCdY
 SE/hotD2c2asZ15zv52wrGGpOALW6ZaQdlRafuDli1/yHeJ1uPOWec7NKnzytDpL
 A0r22RDyvqR7N2hunFu2aO757ojAsIWS8qfF2Yztr0UaE6rC+aoYKBwTfzvC5yhh
 gaurkH8jCUJ9EHw+GBs1pZQK9wWaK7MrlNj7/mVZ1iXErWCHZYcYNbxlx/xAFzUv
 IoHsmg6lL5By3p3nvElG
 =c5hx
 -----END PGP SIGNATURE-----

Merge tag 'for-3.8-at91_header_clean' of git://github.com/at91linux/linux-at91 into next/headers

From Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>:
arm: at91: mach header cleanup

This first patch serie start the cleanup of the header in mach
by moving all the platform data to include/linux/platform_data

and move the board header and drivers header next to them

* tag 'for-3.8-at91_header_clean' of git://github.com/at91linux/linux-at91:
  arm: at91: move at91rm9200 rtc header in drivers/rtc
  arm: at91: move reset controller header to arm/arm/mach-at91
  arm: at91: move pit define to the driver
  arm: at91: move at91_shdwc.h to arch/arm/mach-at91
  arm: at91: move board header to arch/arm/mach-at91
  arn: at91: move at91_tc.h to arch/arm/mach-at91
  arm: at91 move at91_aic.h to arch/arm/mach-at91
  arm: at91 move board.h to arch/arm/mach-at91
  arm: at91: move platfarm_data to include/linux/platform_data/atmel.h
  arm: at91: drop machine defconfig

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2012-11-12 22:54:08 +01:00
Linus Walleij e59d969f44 Merge branch 'at91' into devel 2012-11-11 19:12:33 +01:00
Jean-Christophe PLAGNIOL-VILLARD bcd2360c1f arm: at91: move platfarm_data to include/linux/platform_data/atmel.h
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
2012-11-06 20:29:33 +08:00
Russell King 3af08bd7ad SERIAL: omap: fix hardware assisted flow control
When the UART device has hardware flow control enabled, it ignores the
MCR RTS bit in the MCR register, and keeps RTS asserted as long as we
continue to read characters from the UART receiver FIFO.  This means
that when the TTY buffers become full, the UART doesn't tell the remote
end to stop sending, which causes the TTY layer to start dropping
characters.

A similar problem exists with software flow control.  We need the FIFO
register to fill when software flow control is enabled to provoke the
UART to send the XOFF character.

Fix this by implementing the throttle/unthrottle callbacks, and use
these to disable receiver interrupts.  This in turn means that the UART
FIFO will fill, which will then cause the UART's hardware to deassert
the RTS signal and/or send the XOFF character, stopping the remote end.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:30:28 +00:00
Russell King 2405464083 SERIAL: omap: simplify (2)
Simplify:
	- set ECB
	...
	- LCR mode A
	- clear TCRTLR
	- LCR mode B
	- clear ECB
	- set ECB and update other bits
	- LCR mode A
	- update XONANY

to:
	- set ECB
	...
	- LCR mode B
	- set ECB and update other bits
	- LCR mode A
	- update XONANY and clear TCRTLR

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:29:35 +00:00
Russell King c533e51b22 SERIAL: omap: move xon/xoff setting earlier
Take advantage of the switch to mode B for accessing the TCR register,
and move the xon/xoff configuration there.  This allows further
simplication of this sequence.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:29:34 +00:00
Russell King c7d059cae3 SERIAL: omap: always set TCR
We always setup the TCR register in the software flow control path,
and when hardware flow control is enabled.  Remove this redundant
setup, and place it before we setup any hardware flow control.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:29:33 +00:00
Russell King 18f360f865 SERIAL: omap: simplify
We have the sequence:
	- LCR mode B
	- write EFR with ECB clear
	- LCR mode normal
	- if s/w flow
		- LCR mode B
		- write EFR with ECB clear
		...
		- LCR mode B
		- write EFR with ECB clear
		- LCR mode normal

This can be simplified to:
	- if s/w flow
		- LCR mode B
		- write EFR with ECB clear
		...
	- LCR mode B
	- write EFR with ECB clear
	- LCR mode normal

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:29:33 +00:00
Russell King 1fe8aa8803 SERIAL: omap: don't read back LCR/MCR/EFR
There's really no reason to read back these registers while setting
the termios modes, provided we keep our cached copies up to date.
Remove these readbacks.

This has the benefit that we know that the EFR_ECB and MCR_TCRTLR
bits will always be clear, so we don't need to keep masking these
bits throughout the code.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:29:32 +00:00
Russell King 01d70bb37c SERIAL: omap: serial_omap_configure_xonxoff() contents into set_termios
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:14:22 +00:00
Russell King 820344fe3d SERIAL: omap: configure xon/xoff before setting modem control lines
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:14:22 +00:00
Russell King f91b55ab72 SERIAL: omap: move driver private definitions and structures to driver
struct uart_omap_port and struct uart_omap_dma, and associated
definitions are private to the driver, so there's no point them sitting
in an include file under arch/arm.  Move them into the driver itself.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:14:20 +00:00
Russell King 4073a53b36 SERIAL: omap: remove 'irq_pending' bitfield
irq_pending is never used, so let's remove it.  It seems to be  result
of a bad rebase of d37c6cebcb (serial: omap: move uart_omap_port
definition to C file)

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 12:14:19 +00:00
Russell King 08bd4903c2 SERIAL: omap: fix MCR TCRTLR bit handling
The MCR TCRTLR bit can only be changed when ECB is set in the EFR.
Unfortunately, several places were trying to alter this bit while ECB
was clear:

- serial_omap_configure_xonxoff() was attempting to clear the bit after
  explicitly clearing the ECB bit.
- serial_omap_set_termios() was trying the same trick after setting the
  SCR, and when trying to change the TCR register when hardware flow
  control was enabled.

Fix this by ensuring that we always have ECB set whenever the TCRTLR bit
is changed.

Moreover, we start out by reading the EFR and MCR registers, which may
have indeterminent bit settings for the ECB and TCRTLR bits.  Ensure
that these bits always start off in a known state.

In order to avoid any undesired behaviour appearing through fixing this,
we also ensure that hardware assisted flow control is disabled while new
driver specific parts are not in place.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:54:31 +00:00
Russell King 9363f8fa89 SERIAL: omap: fix set_mctrl() breakage
c538d20c7f (and maybe previous commits) broke set_mctrl() by making
it only capable of setting bits in the MCR register.  This prevents
software controlled flow control and modem control line manipulation
via TIOCMSET/TIOCMBIC from working correctly.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:26:00 +00:00
Russell King 511e74f330 SERIAL: omap: no need to re-read EFR
There's no need to re-read EFR after we've recently written it; the
register is a configuration register which doesn't change its value
without us writing to it.  The last value which was written to this
register was up->efr.

Removing this re-reading avoids the possibility that we end up with
up->efr having unintended bits set, which should only be temporarily
set when accessing the enhanced features.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:26:00 +00:00
Russell King d864c03bfc SERIAL: omap: remove setting of EFR SCD bit
The SCD (special character detect) bit enables comparisons with XOFF2,
which we do not program.  As the XOFF2 character remains unprogrammed,
there's little point enabling this feature along with its associated
interrupt.  Remove this, and ensure that the SCD bit is cleared.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:25:58 +00:00
Russell King da5d01f23b SERIAL: omap: allow hardware assisted IXANY mode to be disabled
Nothing was clearing the UART_MCR_XONANY bit, so once the ixany
mode gets set, there's no possibility to disable it.  Clear this
bit when IXANY mode is cleared.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:25:57 +00:00
Russell King 0d5b166395 SERIAL: omap: allow hardware assisted rts/cts modes to be disabled
There is nothing which clears the auto RTS/CTS bits, so once hardware
flow control gets enabled, there's no possibility to disable it.
So, clear these bits when CRTSCTS is cleared.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:25:57 +00:00
Russell King 9aba8d5b01 SERIAL: core: add throttle/unthrottle callbacks for hardware assisted flow control
Add two callbacks for hardware assisted flow control; we need to know
when the tty layers want us to stop and restart due to their buffer
levels.

Call a driver specific throttle/unthrottle function if and only if the
driver indicates that it is using an enabled hardware assisted flow
control method, otherwise fall back to the non-hardware assisted
methods.

Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:25:56 +00:00
Russell King dba05832cb SERIAL: core: add hardware assisted h/w flow control support
Ports which are handling h/w flow control in hardware must not have
their RTS state altered depending on the tty's hardware-stopped state.
Avoid this additional logic when setting the termios state.

Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:25:55 +00:00
Russell King 2cbacafd7a SERIAL: core: add hardware assisted s/w flow control support
Ports which are capable of handling s/w flow control in hardware to
know when the s/w flow control termios settings are changed.  Add a
flag to allow the low level serial drivers to indicate that they
support this, and these changes should be propagated to them.

Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:25:54 +00:00
Russell King dec94e70e1 SERIAL: core: use local variable uport in uart_set_termios()
This is to make the following change more clear.

Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2012-11-04 11:25:53 +00:00
Wei Yongjun 76cc43868c tty: of_serial: fix return value check in of_platform_serial_setup()
In case of error, the function clk_get() returns ERR_PTR()
and never returns NULL. The NULL test in the return value
check should be replaced with IS_ERR().

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-01 08:50:01 -07:00
chao bi 31fe990488 serial:ifx6x60:Prevent data transfer when IFX6x60 port is shutdown
This patch is to implement following 2 places to avoid potential error when IFX6x60 port shutdown:
1) Clear Flag IFX_SPI_STATE_IO_AVAILABLE to disable data transfer when Modem port is shutdown;
2) Clear Flag IFX_SPI_STATE_IO_IN_PROGRESS and IFX_SPI_STATE_IO_READY when reopen port.
This is because last port shutdown may happen when SPI/DMA transfer is in progress, if the last
data transfer is not completed(for example due to modem reset), the Flag IFX_SPI_STATE_IO_IN_PROGRESS
will be set forever, so when IFX port is activated again, IFX_SPI_STATE_IO_IN_PROGRESS will prevent
transferring data forever. And if don't clear IFX_SPI_STATE_IO_READY, it may cause one more SPI frame
transferring in spit there is not data need to be transfer.

cc: liu chuansheng <chuansheng.liu@intel.com>
cc: Chen Jun <jun.d.chen@intel.com>
Signed-off-by: channing <chao.bi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-01 08:50:01 -07:00
Vineet Gupta 2ac4ad2a14 serial/arc-uart: Add new driver
Driver for non-standard on-chip UART, instantiated in the ARC (Synopsys)
FPGA Boards such as ARCAngel4/ML50x

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-30 14:06:52 -07:00
Alan Cox 373bac4cf4 uart: add other serial core layer get attributes
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-30 14:05:32 -07:00
Alan Cox 9f1096943a uart: tidy the uart_get_info API
We pass both port and state because the original caller had both to hand.
With all the attribute callers this won't be true so do the conversion in
the function itself.

The current callers all do lock/query/unlock. This won't be true for future
set based cases but there are plenty of get ones that will exist so split
the code with a helper for the future cases.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-30 14:05:31 -07:00
Alan Cox bebe73e31d uart: update the sysfs handler to use uart_get_info
The two patches needed are now in the tree. The first added the sysfs
interface and directly accesses the uartclk. The second provides a
proper interface for getting the values.

Wire them together.

This formes a basis for both get and set methods for any of the other uart
properties and we can now fill them out further.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-30 14:05:31 -07:00
Wei Yongjun 15a12e83da serial: 8250_pci: use module_pci_driver to simplify the code
Use the module_pci_driver() macro to make the code simpler
by eliminating module_init and module_exit calls.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-30 14:04:52 -07:00
Joe Perches 669fef4644 serial: jsm: Convert jsm_printk to jsm_dbg
These printks should all be emitted at KERN_DEBUG level.
Make them dependent on CONFIG_DEBUG or (#define DEBUG)
simplify the code a bit.

Add missing newlines where appropriate.

Most all of these messages could be deleted too.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-30 14:04:52 -07:00
Marcelo Tosatti 19bf7f8ac3 Merge remote-tracking branch 'master' into queue
Merge reason: development work has dependency on kvm patches merged
upstream.

Conflicts:
	arch/powerpc/include/asm/Kbuild
	arch/powerpc/include/asm/kvm_para.h

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-10-29 19:15:32 -02:00
Greg Kroah-Hartman ca364d8388 Merge 3.7-rc3 into tty-next
This merges the tty changes in 3.7-rc3 into tty-next

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-29 09:00:57 -07:00
Jiri Kosina 3bd7bf1f0f Merge branch 'master' into for-next
Sync up with Linus' tree to be able to apply Cesar's patch
against newer version of the code.

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-10-28 19:29:19 +01:00
Cyrill Gorcunov 84fd7bdf12 tty: Add get- ioctls to fetch tty status v3
For checkpoint/restore we need to know if tty has
exclusive or packet mode set, as well as if pty
is currently locked. Just to be able to restore
this characteristics.

For this sake the following ioctl codes are introduced

 - TIOCGPKT to get packet mode state
 - TIOCGPTLCK to get Pty locked state
 - TIOCGEXCL to get Exclusive mode state

Note this ioctls are a bit unsafe in terms of data
obtained consistency. The tty characteristics might
be changed right after ioctl complete. Keep it in
mind and use this ioctl carefully.

v2:
 - Use TIOC prefix for ioctl codes (by jslaby@)

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Alan Cox <alan@lxorguk.ukuu.org.uk>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Pavel Emelyanov <xemul@parallels.com>
CC: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 12:07:18 -07:00
Cyrill Gorcunov 06026d911c tty: pty - Move TIOCPKT handling into pty.c
Since this ioctl is for pty devices only move it to pty.c.

v2:
 - drop PTY_TYPE_MASTER test since it's master peer
   ioctl anyway (by jslaby@)

Suggested-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Pavel Emelyanov <xemul@parallels.com>
CC: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 12:07:18 -07:00
Murali Karicheri 0bbeb3c3e8 of serial port driver - add clk_get_rate() support
Currently this driver expects the clock-frequency attribute. This
patch allows getting clock-frequency through clk driver API
clk_get_rate() if clock-frequency attribute is not defined.

So in the device bindings for serial device, one can add clocks
phandle to refer to the clk device to get the rate.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 11:32:29 -07:00
Sasha Levin cadf748690 tty: add missing newlines to WARN_RATELIMIT
WARN_RATELIMIT() expects the warning to end with a newline if one
is needed.

Not doing so results in odd looking warnings such as:

[ 1339.454272] tty is NULLPid: 7147, comm: kworker/4:0 Tainted: G        W    3.7.0-rc2-next-20121025-sasha-00001-g673f98e-dirty #75

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 11:30:27 -07:00
Jun Chen 2e30802625 serial: ifx6x60: del_timer_sync must not be called in interrupt context.
This patch make use of del_timer instead of del_timer_sync in the
interrupt context.
The spi_timer function don't use any resources that may release after
running del_timer,
so using the del_timer is also safe and enough in this context.

Signed-off-by: Chen Jun <jun.d.chen@intel.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Tested-by: Chuansheng Liu <chuansheng.liu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 11:29:58 -07:00
Jun Chen c73ba2ae43 serial: ifx6x60: add_timer is not safe in the mrdy_assert function
This patch make use of mod_timer instead of add_timer in the mrdy_assert function.
Because the srdy interrupter can go high when we are running function mrdy_assert and mrdy_assert
can be called by multi-entry. In our medfield platform, spi stress test can encounter this
error logs triggered by the BUG_ON of add_timer function.This patch had been tested on
our medfield platform.

the scenario:
      CPU0							CPU1
mrdy_assert
set_bit(IFX_SPI_STATE_TIMER_PENDING)
								ifx_spi_handle_srdy
								...
								clear_bit(IFX_SPI_STATE_TIMER_PENDING)
								...
								mrdy_assert
								set_bit(IFX_SPI_STATE_TIMER_PENDING)
								...
								add_timer
...
add_timer

Cc: liu chuansheng <chuansheng.liu@intel.com>
Cc: Bi Chao <chao.bi@intel.com>
Signed-off-by: Chen Jun <jun.d.chen@intel.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 11:29:58 -07:00
chao bi 319fb0d219 serial: ifx6x60: different SPI word width configure requires different swap process
SPI protocol driver only provide one function (swap_buf()) to swap SPI
data into big endian format, which is only available when SPI
controller's word width is 16 bits. But word width could be configured
as 8/16/32 bits, different word width configure should be mapped to
different swap methods.This patch is to make SPI protocol driver choose
the right swap function corresponding to SPI word width configuration.

cc: liu chuansheng <chuansheng.liu@intel.com>
cc: Chen Jun <jun.d.chen@intel.com>
Signed-off-by: channing <chao.bi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 11:29:58 -07:00
Linus Walleij de60958207 serial/amba-pl011: use devm_* managed resources
This switches a bunch of allocation and remapping to use the
devm_* garbage collected methods and cleans up the error
path and remove() paths consequently.

devm_ioremap() is only in <linux/io.h> so fix up the
erroneous <asm/*> include as well.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: Domenico Andreoli <domenico.andreoli@linux.com>
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 11:29:44 -07:00
Shubhrajyoti D 40477d0e04 serial: omap: Remove the hardcode serial_omap_console_ports array.
Currently the array serial_omap_console_ports is hard coded to 4.
Make it depend on the maximum uart count.
Post to [cfc55bc ARM: OMAP2+: serial: Change MAX_HSUART_PORTS to 6]
the max ports is 6.

Cc: AnilKumar Ch <anilkumar@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 11:29:11 -07:00
Shubhrajyoti D 7ba897d77c serial: omap: Remove the default setting of special character
Special character detect enable if enabled by default.Received data
comparison with XOFF2 data happens by default.

tty provides only XOFF1 no X0FF2 is provided so no need
to enable check for XOFF2.

Keeping this enabled might give some slow transfers due to dummy xoff2
comparison with xoff2 reset value.

Since not all want the XOFF2 support lets not enable it by
default.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 11:29:11 -07:00
Shubhrajyoti D 39aee51d43 serial: omap: Make context_loss_cnt signed
get_context_loss_count returns an int however it is stored in
unsigned integer context_loss_cnt . This patch tries to make
context_loss_cnt int. So that in case of errors the value
(which may be negative) is not interpreted wrongly.

In serial_omap_runtime_resume in case of errors returned by
get_context_loss_count print a warning and do a restore.

Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-25 11:29:10 -07:00
Masanari Iida 46e99c4a1d tty: Fix typo in tty drivers
Correct spelling typo in debug messages within tty drivers.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-10-25 18:05:32 +02:00
Felipe Balbi a4f743851f Revert "serial: omap: fix software flow control"
This reverts commit 957ee7270d
(serial: omap: fix software flow control).

As Russell has pointed out, that commit isn't fixing
Software Flow Control at all, and it actually makes
it even more broken.

It was agreed to revert this commit and use Russell's
latest UART patches instead.

Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:57:21 -07:00
Alexander Shiyan a1c25f2b98 serial: clps711x: Cleanup driver
This patch performs cleanup on clps711x serial driver. This include:
- Change functions naming style.
- Removed unused includes.
- Removed unneeded comments.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:48 -07:00
Alexander Shiyan 7ae75e94ec serial: clps711x: Fix TERMIOS-flags handling
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:48 -07:00
Alexander Shiyan f52ede2ac1 serial: clps711x: Disable "break"-state before port startup
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:48 -07:00
Alexander Shiyan 135cc79035 serial: clps711x: Using resource-managed functions
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:48 -07:00
Alexander Shiyan f27de95c2a serial: clps711x: Check for valid TTY in RX-interrupt
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:48 -07:00
Alexander Shiyan ec335526b4 serial: clps711x: Fix break control handling
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:47 -07:00
Alexander Shiyan 1593daf9a8 serial: clps711x: Return valid modem controls for port that not support it
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:47 -07:00
Alexander Shiyan cf03a884b9 serial: clps711x: Improved TX FIFO handling
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:47 -07:00
Alexander Shiyan c08f0153f5 serial: clps711x: Using CPU clock subsystem for getting base UART speed
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:47 -07:00
Alexander Shiyan 3c7e9eb160 serial: clps711x: Do not use "uart_port->unused" field
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:47 -07:00
Alexander Shiyan 117d5d424a serial: clps711x: Convert all static variables to dynamic
This patch converts all static variables of clps711x serial driver
to dynamic allocating. In this case we are should remove console_initcall()
and declare console during driver registration. Early kernel messages can
be retrieved by add "earlyprintk" option to the kernel command line.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:47 -07:00
Alexander Shiyan 95113728f0 serial: clps711x: Add platform_driver interface to clps711x driver
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:39:47 -07:00
Denis V. Lunev e1a9c17969 tty: serial: KGDB support for PXA
Actually, in order to support KGDB over serial console one must
implement two callbacks for character polling. Clone them from
8250 driver with a bit of tuning.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Marko Katic <dromede@gmail.com>
CC: Eric Miao <eric.y.miao@gmail.com>
CC: Russell King <linux@arm.linux.org.uk>
Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com>

 drivers/tty/serial/pxa.c |   55 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:38:28 -07:00
Ivo Sieben c97399418a tty: Use raw spin lock to protect TTY ldisc administration
The global "normal" spin lock that guards the line discipline
administration is replaced by a raw spin lock. On a PREEMPT_RT system this
prevents unwanted scheduling overhead around the line discipline administration.

On a 200 MHz AT91SAM9261 processor setup this fixes about 100us of scheduling
overhead on a TTY read or write call.

Signed-off-by: Ivo Sieben <meltedpianoman@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:37:02 -07:00
Wei Yongjun ad3d1e5fc9 TTY: hvcs: fix missing unlock on error in hvcs_initialize()
Add the missing unlock on the error handling path in function
hvcs_initialize().

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:37:02 -07:00
Maxime Bizon 08ec212c0f x86: ce4100: allow second UART usage
The current CE4100 and 8250_pci code have both a limitation preventing the
registration and usage of CE4100's second UART. This patch changes the
platform code fixing up the UART port to work on a relative UART port
base address, as well as the 8250_pci code to make it register 2 UART ports
for CE4100 and pass the port index down to all consumers.

Signed-off-by: Florian Fainelli <ffainelli@freebox.fr>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:34:51 -07:00
Sangho Yi 7a0c4edae9 tty: tty_mutex.c: Fixed coding style warning (using printk)
Here I fixed from printk(KERN_ERR, ... to pr_err(... on tty_mutex.c

Signed-off-by: Sangho Yi <antiroot@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:34:51 -07:00
James Hogan b61c5ed571 tty: serial: 8250_dw: Implement suspend/resume
Implement suspend and resume callbacks for DesignWare 8250 driver.
They're simple wrappers around serial8250_{suspend,resume}_port.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:34:51 -07:00
Wei Yongjun 59c2e855e4 serial: vt8500: fix possible memory leak in vt8500_serial_probe()
vt8500_port is malloced in vt8500_serial_probe() and should be freed
before leaving from the error handling cases, otherwise it will
cause memory leak.
Fix it by move the allocation of vt8500_port after those test.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:34:51 -07:00
Tony Lindgren 54ec52b6dd tty/serial/8250: Make omap hardware workarounds local to 8250.h
This allows us to get rid of the ifdefs in 8250.c.

Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:30:57 -07:00
Alexey Brodkin b15d5380e4 serial/8250/8250_early: Prevent rounding error in uartclk
Modify divisor to select the nearest baud rate divider rather than the
lowest. It minimizes baud rate errors especially on low UART clock
frequencies.

For example, if uartclk is 33000000 and baud is 115200 the ratio is
about 17.9 The current code selects 17 (5% error) but should select 18
(0.5% error).

This 5% error in baud rate leads to garbage on receiving end, while 0.5%
doesn't.

The issue showed up when using the stock 8250 driver for
Synopsys DW UART. This was on a FPGA with ~12MHz UART clock.
When we enabled early serial, we saw garbage which was narrowed down
to the rounding error.

So the bug had been latent and it only showed up with such low clock rates.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:29:30 -07:00
Thomas Abraham 9484b009b5 serial: samsung: use clk_prepare_enable and clk_disable_unprepare
Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare
calls as required by common clock framework.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:29:30 -07:00
Ivo Sieben b8b345bae8 TTY: Report warning when low_latency flag is wrongly used
When a driver has the low_latency flag set and uses the schedule_flip()
function to initiate copying data to the line discipline, a workqueue is
scheduled in but never actually flushed. This is incorrect use of the
low_latency flag (driver should not support the low_latency flag, or use
the tty_flip_buffer_push() function instead). Make sure a warning is
reported to catch incorrect use of the low_latency flag.

This patch goes with: cee4ad1ed9

Signed-off-by: Ivo Sieben <meltedpianoman@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-24 11:21:32 -07:00
Jiri Slaby ecbbfd44a0 TTY: move tty buffers to tty_port
So this is it. The big step why we did all the work over the past
kernel releases. Now everything is prepared, so nothing protects us
from doing that big step.

           |  |            \  \ nnnn/^l      |  |
           |  |             \  /     /       |  |
           |  '-,.__   =>    \/   ,-`    =>  |  '-,.__
           | O __.´´)        (  .`           | O __.´´)
            ~~~   ~~          ``              ~~~   ~~
The buffers are now in the tty_port structure and we can start
teaching the buffer helpers (insert char/string, flip etc.) to use
tty_port instead of tty_struct all around.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 16:58:28 -07:00
Jiri Slaby 967fab6916 TTY: add port -> tty link
For that purpose we have to temporarily introduce a second tty back
pointer into tty_port. It is because serial layer, and maybe others,
still do not use tty_port_tty_set/get. So that we cannot set the
tty_port->tty to NULL at will now.

Yes, the fix would be to convert whole serial layer and all its users
to tty_port_tty_set/get. However we are in the process of removing the
need of tty in most of the call sites, so this would lead to a
duplicated work.

Instead we have now tty_port->itty (internal tty) which will be used
only in flush_to_ldisc. For that one it is ensured that itty is valid
wherever the work is run. IOW, the work is synchronously cancelled
before we set itty to NULL and also before hangup is processed.

After we need only tty_port and not tty_struct in most code, this
shall be changed to tty_port_tty_set/get and itty removed completely.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 16:53:40 -07:00
Jiri Slaby 5cff39c69b TTY: tty_buffer, cache pointer to tty->buf
During the move of tty buffers from tty_struct to tty_port, we will
need to switch all users of buf to tty->port->buf. There are many
functions where this is accessed directly in their code many times.
Cache the tty->buf pointer in such functions now and change only
single lines in each function in the next patch.

Not that it is convenient for the next patch, but the code is now also
more readable.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-22 16:53:21 -07:00