Commit Graph

327 Commits

Author SHA1 Message Date
Rohit Vaswani
a76e99abc5 Merge branch 'Linux 3.0.21' into msm-3.0
Merge Upstream's stable 3.0.21 branch into msm-3.0
This consists 814 commits and some merge conflicts.

The merge conflicts are because of some local changes to
msm-3.0 as well as some conflicts between google's tree and
the upstream tree.

Conflicts:
	arch/arm/kernel/head.S
	drivers/bluetooth/ath3k.c
	drivers/bluetooth/btusb.c
	drivers/mmc/core/core.c
	drivers/tty/serial/serial_core.c
	drivers/usb/host/ehci-hub.c
	drivers/usb/serial/qcserial.c
	fs/namespace.c
	fs/proc/base.c

Change-Id: I62e2edbe213f84915e27f8cd6e4f6ce23db22a21
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
2012-03-30 00:09:34 -07:00
Stepan Moskovchenko
1d4731ee97 msm_serial_hs_lite: Save UART registers if stuck
Preserve and attempt to print out relevant UARTDM core
registers, followed by panicing the system, if the
polling-mode serial console fails to print a character as a
result of the TX buffer remaining full for more than 100
character transmit times. This information is useful for
troubleshooting extremely rare cases where the serial
console unexpectedly stops producing output.

Change-Id: Iaaf13a01cf6ce33637a45f33b9ae6fce939cf7cd
Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2012-03-12 19:28:55 -07:00
Mayank Rana
ec41e93518 msm_serial_hs_lite: Fix hardware bug by using dummy read of UARTDM register
UARTDM hardware doesn't work if data is transferred immediately after
programming NO_CHARS_FOR_TX register. Hence read out UART Status
Register which introduces one AHB clock cycle delay after programming
NO_CHARS_FOR_TX register.

Change-Id: I442228e151496eddf1f61c505c15301f5deaf588
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2012-03-09 16:19:43 -08:00
Mayank Rana
9717aba580 msm_serial_hs_lite: Add missing register mapping
UARTDM v1.4 has different register offset compare to currently
supported UARTDM v1.3. Hence add missing register mapping in
driver.

Change-Id: Ibdb860feb695abd2c250ce5c0e9b62a57f145f41
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2012-02-27 18:27:04 +05:30
Mayank Rana
7fa5dc93ea msm_serial: Use new clock framework apis
Clock framework provides clk_prepare/clk_unprepare (callable from
non-atomic context only) and clk_enable/clk_disable (callable from
atomic/non-atomic context) APIs. Start using these new APIs. This
change doesn't use new clock APIs for CONFIG_SERIAL_MSM_RX_WAKEUP
and CONFIG_SERIAL_MSM_CLOCK_CONTROL selected features as these are
legacy features and has not been used since longtime and probably
broken in functionality. Hence new clock framework related change
for these two features would be added if it is required to be
supported in future.

Change-Id: I4f58f45e63bb4c2a9c320ffb18fe28532ed5ab55
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2012-02-18 14:42:17 +05:30
Mayank Rana
04570ab5d0 msm_serial: Cleanup regarding usage of clock enable/disable apis
Currently driver uses clock apis (clock_enable()/clock_disable()) before
accessing any UART Core register. Hence remove all usage of clock apis
which is just increasing the refcount of uart clock instead of turning
on/off the uart lock. Start using serial core PM functionality to enable
disable the uart clock.

Change-Id: I42e180fe6b3b92e4d9cc6d289f5f4689658e51c6
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2012-02-18 14:38:35 +05:30
Samuel Thibault
344d390bcb drivers/tty/vt/vt_ioctl.c: fix KDFONTOP 32bit compatibility layer
commit cbcb8346054073d000ecac324763372d6abd44ac upstream.

KDFONTOP(GET) currently fails with EIO when being run in a 32bit userland
with a 64bit kernel if the font width is not 8.

This is because of the setting of the KD_FONT_FLAG_OLD flag, which makes
con_font_get return EIO in such case.

This flag should *not* be set for KDFONTOP, since it's actually the whole
point of this flag (see comment in con_font_set for instance).

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Cc: Arthur Taylor <art@ified.ca>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-13 11:06:05 -08:00
Linux Build Service Account
e9f676d5e4 Merge changes I5359aee9,Ia2e526aa into msm-3.0
* changes:
  msm_serial_hs_lite: Use new clock framework apis
  msm_serial_hs_lite: Cleanup regarding usage of clock enable/disable apis
2012-02-13 07:32:57 -08:00
Mayank Rana
a580f3f96c msm_serial_hs: Cleanup regarding usage of clock enable/disable apis
Currently driver uses clock apis (clock_enable()/clock_disable()) before
accessing any UART Core register. Hence remove all usage of clock apis
which is just increasing the refcount of uart clock instead of turning
on/off the uart lock.

Change-Id: Idf39108e40b23eb7f17d55470247b339a7850a5f
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2012-02-08 10:59:33 +05:30
Mayank Rana
5d0252af48 msm_serial_hs_lite: Use new clock framework apis
Clock framework provides clk_prepare/clk_unprepare (callable from
non-atomic context only) and clk_enable/clk_disable (callable from
atomic/non-atomic context) APIs. Start using these new APIs.

Change-Id: I5359aee9b93cb432824bcf27ad7cc2147797848e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2012-02-08 10:29:43 +05:30
Mayank Rana
a4ad7b36bf msm_serial_hs_lite: Cleanup regarding usage of clock enable/disable apis
Currently driver uses clock apis (clock_enable()/clock_disable()) before
accessing any UART Core register. Hence remove all usage of clock apis
which is just increasing the refcount of uart clock instead of turning
on/off the uart lock.

Change-Id: Ia2e526aaf60b069ee7eacafb75b3f824c725e529
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2012-02-08 10:29:28 +05:30
Lucas Kannebley Tavares
d5f0416d67 jsm: Fixed EEH recovery error
commit 26aa38cafae0dbef3b2fe75ea487c83313c36d45 upstream.

There was an error on the jsm driver that would cause it to be unable to
recover after a second error is detected.

At the first error, the device recovers properly:

[72521.485691] EEH: Detected PCI bus error on device 0003:02:00.0
[72521.485695] EEH: This PCI device has failed 1 times in the last hour:
...
[72532.035693] ttyn3 at MMIO 0x0 (irq = 49) is a jsm
[72532.105689] jsm: Port 3 added

However, at the second error, it cascades until EEH disables the device:

[72631.229549] Call Trace:
...
[72641.725687] jsm: Port 3 added
[72641.725695] EEH: Detected PCI bus error on device 0003:02:00.0
[72641.725698] EEH: This PCI device has failed 3 times in the last hour:

It was caused because the PCI state was not being saved after the first
restore. Therefore, at the second recovery the PCI state would not be
restored.

Signed-off-by: Lucas Kannebley Tavares <lucaskt@linux.vnet.ibm.com>
Signed-off-by: Breno Leitao <brenohl@br.ibm.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-03 09:19:00 -08:00
Rabin Vincent
f0661faa59 serial: amba-pl011: lock console writes against interrupts
commit ef605fdb33883d687cff5ba75095a91b313b4966 upstream.

Protect against pl011_console_write() and the interrupt for
the console UART running concurrently on different CPUs.

Otherwise the console_write could spin for a long time
waiting for the UART to become not busy, while the other
CPU continuously services UART interrupts and keeps the
UART busy.

The checks for sysrq and oops_in_progress are taken
from 8250.c.

Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Reviewed-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Reviewed-by: Bibek Basu <bibek.basu@stericsson.com>
Reviewed-by: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-03 09:19:00 -08:00
Jiri Slaby
47f7a05bd0 TTY: fix UV serial console regression
commit 0eee50af5b13e00b3fb7a5fe8480419a71b8235d upstream.

Commit 74c2107759 (serial: Use block_til_ready helper) and its fixup
3f582b8c11 (serial: fix termios settings in open) introduced a
regression on UV systems. The serial eventually freezes while being
used. It's completely unpredictable and sometimes needs a heap of
traffic to happen first.

To reproduce this, yast installation was used as it turned out to be
pretty reliable in reproducing. Especially during installation process
where one doesn't have an SSH daemon running. And no monitor as the HW
is completely headless. So this was fun to find. Given the machine
doesn't boot on vanilla before 2.6.36 final. (And the commits above
are older.)

Unless there is some bad race in the code, the hardware seems to be
pretty broken. Otherwise pure MSR read should not cause such a bug,
or?

So to prevent the bug, revert to the old behavior. I.e. read modem
status only if we really have to -- for non-CLOCAL set serials.
Non-CLOCAL works on this hardware OK, I tried. See? I don't.

And document that shit.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
References: https://lkml.org/lkml/2011/12/6/573
References: https://bugzilla.novell.com/show_bug.cgi?id=718518
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-03 09:19:00 -08:00
Claudio Scordino
630fe244a9 atmel_serial: fix spinlock lockup in RS485 code
commit dbf1115d3f8c7052788aa4e6e46abd27f3b3eeba upstream.

Patch to fix a spinlock lockup in the driver that sometimes happens when the
tasklet starts.

Signed-off-by: Claudio Scordino <claudio@evidence.eu.com>
Signed-off-by: Dave Bender <codehero@gmail.com>
Tested-by: Dave Bender <codehero@gmail.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2012-01-12 11:35:07 -08:00
Mayank Rana
22e4b386af msm_serial_hs_lite: set uart clock rate to zero after disabling clock
Change-Id: Ib6413cae2ee32cd5e6c049f4a22ee24b808cb2fa
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2012-01-12 21:59:37 +05:30
Sathish Ambley
2b331658a5 Revert "msm_serial_hs_lite: Increase RxStale timeout value"
This reverts commit 0654e27a49.

Change-Id: I1f1628cc0a50942ce99079db698778797b1b67a7
Signed-off-by: Sathish Ambley <sambley@codeaurora.org>
2011-12-13 10:34:58 -08:00
Mayank Rana
930c99cb4a msm_serial_hs_lite: Changes for enable/disable console
usage:
To disable console:
echo 0 > /sys/devices/platform/msm_serial_hsl.0/console

To enable console:
echo 1 > /sys/devices/platform/msm_serial_hsl.0/console

To see the status of console:
cat /sys/devices/platform/msm_serial_hsl.0/console

Change-Id: I3fe188cd18429641de8e48075f37a1729a36d80b
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-12-05 08:08:45 +05:30
Mayank Rana
811fc7f567 msm_serial_hs: Fix type inconsistency for tx and rx command_ptr_ptr
Both tx and rx command_ptr_ptr are of type u32*. While allocating
memory for it, sizeof(u32 *) is used as part of kmalloc API instead
of sizeof(u32). ADM Hardare requires size of command_ptr_ptr as 1 Word.
Both sizeof(u32 *) and sizeof(u32) are same on 32-bit architecture
whereas sizeof(u32 *) would be different in size compare to sizeof(u32)
on anyother architecture.

Hence correct usage of sizeof(command_ptr_ptr) for Tx and Rx with
kmalloc and dma_(map/unmap)_single APIs.

Change-Id: I668146693b3a76d3eef0d8c9f8cebae582f15c05
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-11-29 20:27:01 +05:30
Jiri Slaby
ecaaa92488 TTY: ldisc, wait for ldisc infinitely in hangup
commit 0c73c08ec73dbe080b9ec56696ee21d32754d918 upstream.

For /dev/console case, we do not kill all ldisc users. It's due to
redirected_tty_write test in __tty_hangup. In that case there still
might be a process waiting e.g. in n_tty_read for input.

We wait for such processes to disappear. The problem is that we use a
timeout. After this timeout, we continue closing the ldisc and start
freeing tty resources. It obviously leads to crashes when the other
process is woken.

So to fix this, we wait infinitely before reiniting the ldisc. (The
tiocsetd remains untouched -- times out after 5s.)

This is nicely reproducible with this run from shell:
  exec 0<>/dev/console 1<>/dev/console 2<>/dev/console
and stopping a getty like:
  systemctl stop serial-getty@ttyS0.service

The crash proper may be produced only under load or with constified
timing the same as for 92f6fa09b.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Dave Young <hidave.darkstar@gmail.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Dmitriy Matrosov <sgf.dma@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 09:09:58 -08:00
Jiri Slaby
57ee681901 TTY: ldisc, move wait idle to caller
commit 300420722e0734a4254f3b634e0f82664495d210 upstream.

It is the only place where reinit is called from. And we really need
to wait for the old ldisc to go once. Actually this is the place where
the waiting originally was (before removed and re-added later).

This will make the fix in the following patch easier to implement.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Dave Young <hidave.darkstar@gmail.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Dmitriy Matrosov <sgf.dma@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 09:09:58 -08:00
Jiri Slaby
f8b8a240e2 TTY: ldisc, allow waiting for ldisc arbitrarily long
commit df92d0561de364de53c42abc5d43e04ab6f326a5 upstream.

To fix a nasty bug in ldisc hup vs. reinit we need to wait infinitely
long for ldisc to be gone. So here we add a parameter to
tty_ldisc_wait_idle to allow that.

This is only a preparation for the real fix which is done in the
following patches.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Dave Young <hidave.darkstar@gmail.com>
Cc: Dave Jones <davej@redhat.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Dmitriy Matrosov <sgf.dma@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 09:09:58 -08:00
Stephen Boyd
5e3092bd68 tty: hvc_dcc: Fix duplicate character inputs
commit c2a3e84f950e7ddba1f3914b005861d46ae60359 upstream.

Reading from the DCC grabs a character from the buffer and
clears the status bit. Since this is a context-changing
operation, instructions following the character read that rely on
the status bit being accurate need to be synchronized with an
ISB.

In this case, the status bit check needs to execute after the
character read otherwise we run the risk of reading the character
and checking the status bit before the read can clear the status
bit in the first place. When this happens, the user will see the
same character they typed twice, instead of once.

Add an ISB after the read and the write, so that the status check
is synchronized with the read/write operations.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 09:09:57 -08:00
Tomoya MORINAGA
6e6d3ebc51 pch_uart: Support new device LAPIS Semiconductor ML7831 IOH
commit 8249f743f732ccbc3056428945ab1d9bd36d46bf upstream.

ML7831 is companion chip for Intel Atom E6xx series.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 09:09:57 -08:00
Tomoya MORINAGA
b74d0a317e pch_uart: Fix DMA resource leak issue
commit 90f04c2926cfb5bf74533b0a7766bc896f6a0c0e upstream.

Changing UART mode PIO->DMA->PIO->DMA like below, pch_uart driver can't get
DMA channel resource.

setserial /dev/ttyPCH0 ^low_latency
setserial /dev/ttyPCH0 low_latency

CAUSE:
Changing mode using setserial command, ".startup" function which gets DMA
channel is called before ".verify_port" function which sets
dma-flag(use_dma/use_dma_flag) as 1.

PIO->DMA
  .startup: Since dma-flag is 0, DMA channel is not requested.
  .verify_port: dma-flag is set as 1.
  .shutdown: N/A

DMA->PIO
  .startup: Since dma-flag is 1, DMA channel is requested.
  .verify_port: dma-flag is set as 0.
  .shutdown: Since dma-flag is 0, DMA channel is not released.

This means DMA channel resource leak occurs.
Next time, this driver can't get DMA channel resource forever.

MODIFICATION:
  Currently, when release DMA channel resource, this driver checks dma-flag.
  However, this specification occurs the above issue.
  This driver must check whether dma_request_channel is executed or not.
  The values are saved in private data variable "chan_tx/chan_tx".
  These variables mean if the value is NULL, DMA channel is not requested,
  if not NULL, DMA channel is requested.

This patch fixes the issue.

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 09:09:57 -08:00
Tomoya MORINAGA
3f04930ad5 pch_uart: Fix hw-flow control issue
commit a1d7cfe29f13cf45f8094929864b9c66bf0cd91b upstream.

Using hardware flow control,
currently, register of the control-bit(AFE) is not set.
This patch fixes the issue.

Signed-off-by: Tomoya MORINAGA <tomoya-linux@dsn.lapis-semi.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-26 09:09:57 -08:00
Mayank Rana
774fb74d46 msm_serial_hs: Fix runtime PM sleeping bug
Call pm_runtime_disable() function outside spin clock to
fix "sleeping function called from invalid context" bug.

Change-Id: I964ca09b1f8b1a984736df6b6d72d4b6cd6aed1e
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-11-25 16:53:15 +05:30
Bryan Huntsman
d074fa2796 Merge remote-tracking branch 'common/android-3.0' into msm-3.0
* common/android-3.0: (570 commits)
  misc: remove kernel debugger core
  ARM: common: fiq_debugger: dump sysrq directly to console if enabled
  ARM: common: fiq_debugger: add irq context debug functions
  net: wireless: bcmdhd: Call init_ioctl() only if was started properly for WEXT
  net: wireless: bcmdhd: Call init_ioctl() only if was started properly
  net: wireless: bcmdhd: Fix possible memory leak in escan/iscan
  cpufreq: interactive governor: default 20ms timer
  cpufreq: interactive governor: go to intermediate hi speed before max
  cpufreq: interactive governor: scale to max only if at min speed
  cpufreq: interactive governor: apply intermediate load on current speed
  ARM: idle: update idle ticks before call idle end notifier
  input: gpio_input: don't print debounce message unless flag is set
  net: wireless: bcm4329: Skip dhd_bus_stop() if bus is already down
  net: wireless: bcmdhd: Skip dhd_bus_stop() if bus is already down
  net: wireless: bcmdhd: Improve suspend/resume processing
  net: wireless: bcmdhd: Check if FW is Ok for internal FW call
  tcp: Don't nuke connections for the wrong protocol
  ARM: common: fiq_debugger: make uart irq be no_suspend
  net: wireless: Skip connect warning for CONFIG_CFG80211_ALLOW_RECONNECT
  mm: avoid livelock on !__GFP_FS allocations
  ...

Conflicts:
	arch/arm/mm/cache-l2x0.c
	arch/arm/vfp/vfpmodule.c
	drivers/mmc/core/host.c
	kernel/power/wakelock.c
	net/bluetooth/hci_event.c

Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
2011-11-16 13:52:50 -08:00
Thadeu Lima de Souza Cascardo
6c3ad7aee6 jsm: remove buggy write queue
commit 9d898966c4a07e4a5092215b5a2829d0ef02baa2 upstream.

jsm uses a write queue that copies from uart_core circular buffer. This
copying however has some bugs, like not wrapping the head counter. Since
this write queue is also a circular buffer, the consumer function is
ready to use the uart_core circular buffer directly.

This buggy copying function was making some bytes be dropped when
transmitting to a raw tty, doing something like this.

[root@hostname ~]$ cat /dev/ttyn1 > cascardo/dump &
[1] 2658
[root@hostname ~]$ cat /proc/tty/drivers > /dev/ttyn0
[root@hostname ~]$ cat /proc/tty/drivers
/dev/tty             /dev/tty        5       0 system:/dev/tty
/dev/console         /dev/console    5       1 system:console
/dev/ptmx            /dev/ptmx       5       2 system
/dev/vc/0            /dev/vc/0       4       0 system:vtmaster
jsm                  /dev/ttyn     250 0-31 serial
serial               /dev/ttyS       4 64-95 serial
hvc                  /dev/hvc      229 0-7 system
pty_slave            /dev/pts      136 0-1048575 pty:slave
pty_master           /dev/ptm      128 0-1048575 pty:master
unknown              /dev/tty        4 1-63 console
[root@hostname ~]$ cat cascardo/dump
/dev/tty             /dev/tty        5       0 system:/dev/tty
/dev/console         /dev/console    5       1 system:console
/dev/ptmx            /dev/ptmx       5       2 system
/dev/vc/0            /dev/vc/0       4       0 system:vtmaste[root@hostname ~]$

This patch drops the driver write queue entirely, using the circular
buffer from uart_core only.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-11 09:36:24 -08:00
Ning Jiang
3e9efdd45f serial-core: power up uart port early before we do set_termios when resuming
commit 94abc56f4d90f289ea32a0a11d3577fcd8cb28fb upstream.

The following patch removed uart_change_pm() in uart_resume_port():

commit 5933a161ab
Author: Yin Kangkai <kangkai.yin@linux.intel.com>
    serial-core: reset the console speed on resume

It will break the pxa serial driver when the system resumes from suspend mode
as it will try to set baud rate divider register in set_termios but with
clock off. The register value can not be set correctly on some platform if
the clock is disabled. The pxa driver will check the value and report the
following warning:

------------[ cut here ]------------
WARNING: at drivers/tty/serial/pxa.c:545 serial_pxa_set_termios+0x1dc/0x250()
Modules linked in:
[<c0281f30>] (unwind_backtrace+0x0/0xf0) from [<c029341c>] (warn_slowpath_common+0x4c/0x64)
[<c029341c>] (warn_slowpath_common+0x4c/0x64) from [<c029344c>] (warn_slowpath_null+0x18/0x1c)
[<c029344c>] (warn_slowpath_null+0x18/0x1c) from [<c044b1e4>] (serial_pxa_set_termios+0x1dc/0x250)
[<c044b1e4>] (serial_pxa_set_termios+0x1dc/0x250) from [<c044a840>] (uart_resume_port+0x128/0x2dc)
[<c044a840>] (uart_resume_port+0x128/0x2dc) from [<c044bbe0>] (serial_pxa_resume+0x18/0x24)
[<c044bbe0>] (serial_pxa_resume+0x18/0x24) from [<c0454d34>] (platform_pm_resume+0x40/0x4c)
[<c0454d34>] (platform_pm_resume+0x40/0x4c) from [<c0457ebc>] (pm_op+0x68/0xb4)
[<c0457ebc>] (pm_op+0x68/0xb4) from [<c0458368>] (device_resume+0xb0/0xec)
[<c0458368>] (device_resume+0xb0/0xec) from [<c04584c8>] (dpm_resume+0xe0/0x194)
[<c04584c8>] (dpm_resume+0xe0/0x194) from [<c0458588>] (dpm_resume_end+0xc/0x18)
[<c0458588>] (dpm_resume_end+0xc/0x18) from [<c02c518c>] (suspend_devices_and_enter+0x16c/0x1ac)
[<c02c518c>] (suspend_devices_and_enter+0x16c/0x1ac) from [<c02c5278>] (enter_state+0xac/0xdc)
[<c02c5278>] (enter_state+0xac/0xdc) from [<c02c48ec>] (state_store+0xa0/0xbc)
[<c02c48ec>] (state_store+0xa0/0xbc) from [<c0408f7c>] (kobj_attr_store+0x18/0x1c)
[<c0408f7c>] (kobj_attr_store+0x18/0x1c) from [<c034a6a4>] (sysfs_write_file+0x108/0x140)
[<c034a6a4>] (sysfs_write_file+0x108/0x140) from [<c02fb798>] (vfs_write+0xac/0x134)
[<c02fb798>] (vfs_write+0xac/0x134) from [<c02fb8cc>] (sys_write+0x3c/0x68)
[<c02fb8cc>] (sys_write+0x3c/0x68) from [<c027c700>] (ret_fast_syscall+0x0/0x2c)
---[ end trace 88289eceb4675b04 ]---

This patch fix the problem by adding the power on opertion back for uart
console when console_suspend_enabled is true.

Signed-off-by: Ning Jiang <ning.jiang@marvell.com>
Tested-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-11 09:35:15 -08:00
Marcus Folkesson
d5fe5d1648 serial: pxa: work around for errata #20
commit e44aabd649c80e8be16ede3ed3cbff6fb2561ca9 upstream.

Errata E20: UART: Character Timeout interrupt remains set under certain
software conditions.

Implication: The software servicing the UART can be trapped in an infinite loop.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-11 09:35:15 -08:00
Jiri Slaby
eece93cccb TTY: pty, release tty in all ptmx_open fail paths
commit 1177c0efc04d032644895b8d757f55b433912596 upstream.

Mistakenly, commit 64ba3dc314 (tty: never hold BTM while getting
tty_mutex) switched one fail path in ptmx_open to not free the newly
allocated tty.

Fix that by jumping to the appropriate place. And rename the labels so
that it's clear what is going on there.

Introduced-in: v2.6.36-rc2
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-11 09:35:13 -08:00
Jiri Slaby
0c1f111ae7 TTY: make tty_add_file non-failing
commit fa90e1c935472281de314e6d7c9a37db9cbc2e4e upstream.

If tty_add_file fails at the point it is now, we have to revert all
the changes we did to the tty. It means either decrease all refcounts
if this was a tty reopen or delete the tty if it was newly allocated.

There was a try to fix this in v3.0-rc2 using tty_release in 0259894c7
(TTY: fix fail path in tty_open). But instead it introduced a NULL
dereference. It's because tty_release dereferences
filp->private_data, but that one is set even in our tty_add_file. And
when tty_add_file fails, it's still NULL/garbage. Hence tty_release
cannot be called there.

To circumvent the original leak (and the current NULL deref) we split
tty_add_file into two functions, making the latter non-failing. In
that case we may do the former early in open, where handling failures
is easy. The latter stays as it is now. So there is no change in
functionality.

The original bug (leak) was introduced by f573bd176 (tty: Remove
__GFP_NOFAIL from tty_add_file()). Thanks Dan for reporting this.

Later, we may split tty_release into more functions and call only some
of them in this fail path instead. (If at all possible.)

Introduced-in: v2.6.37-rc2
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-11 09:35:12 -08:00
Jiri Slaby
36174dd629 TTY: drop driver reference in tty_open fail path
commit c290f8358acaeffd8e0c551ddcc24d1206143376 upstream.

When tty_driver_lookup_tty fails in tty_open, we forget to drop a
reference to the tty driver. This was added by commit 4a2b5fddd5 (Move
tty lookup/reopen to caller).

Fix that by adding tty_driver_kref_put to the fail path.

I will refactor the code later. This is for the ease of backporting to
stable.

Introduced-in: v2.6.28-rc2
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Acked-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-11 09:35:12 -08:00
WANG Cong
47bbdafa8a cris: fix a build error in drivers/tty/serial/crisv10.c
commit 2f7861de111bb8e33e6ab9f9607583c6fbc00132 upstream.

This patch fixes the following build error:

drivers/tty/serial/crisv10.c:4453: error: 'if_ser0' undeclared (first use in this function): 2 errors in 2 logs
        v3.1-rc4/cris/cris-allmodconfig v3.1-rc4/cris/cris-allyesconfig
drivers/tty/serial/crisv10.c:4453: error: (Each undeclared identifier is reported only once: 2 errors in 2 logs
        v3.1-rc4/cris/cris-allmodconfig v3.1-rc4/cris/cris-allyesconfig
drivers/tty/serial/crisv10.c:4453: error: for each function it appears in.): 2 errors in 2 logs
        v3.1-rc4/cris/cris-allmodconfig v3.1-rc4/cris/cris-allyesconfig

"if_ser0" is a typo, it should be "if_serial_0".

Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-11 09:35:11 -08:00
Sathish Ambley
0654e27a49 msm_serial_hs_lite: Increase RxStale timeout value
This change to increase the RxStale timeout is temporary
until the correct BCR register support is available in
the simulator model.

Change-Id: Ibd307d65ebf9093dd1ff6b16eb35f8515f708324
Signed-off-by: Sathish Ambley <sambley@codeaurora.org>
2011-11-02 11:31:18 -07:00
Sathish Ambley
99e2a24151 msm_serial_hs_lite: Update register mappings
Update driver to support UARTDM v1.4 and prior versions
register mappings.

Change-Id: I22a50b260fb228eabb6311c9d411f3fd1fe671ce
Signed-off-by: Sathish Ambley <sambley@codeaurora.org>
2011-11-02 11:31:17 -07:00
Sathish Ambley
3d50c76eb2 msm_serial_hs_lite: Add devicetree support
Support to retrieve iomem resources by name does not currently
exist in device tree, access these by index until support for
this comes in.

Clocks are still queried by direct name from the driver until
device tree clock support is implemented.

Change-Id: I6e4e7d7968573959f652abb950729b851fe491b8
Signed-off-by: Sathish Ambley <sambley@codeaurora.org>
2011-11-02 11:31:10 -07:00
Mayank Rana
53a2c77234 msm: serial: Add check to avoid dereferencing NULL pointer
Add check to avoid dereferencing NULL Pointer in serial drivers where
retrieving of resource may fail.

CRs-Fixed: 313390
Change-Id: I4a64039ea33c39a5e1853b2d52a26140ae080d5b
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-11-02 12:25:39 +05:30
Colin Cross
2bb3e31015 Merge commit 'v3.0.8' into android-3.0 2011-10-27 15:01:19 -07:00
Mayank Rana
72fef236d0 msm_serial_hs_lite: Fix Klockwork reported issues
This patch fixes following issues:
1. typecast unsigned int variable (irq) to integer
   compare with zero.
2. Intializing baud variable

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-04 17:14:13 -07:00
Mayank Rana
18958b0b1c msm_serial_hs: Fix Klockwork reported issues
This patch fixes following issues:
1. Using snprintf instead of sprintf(deprecated api)
2. Typecast unsigned int variable (irq) to integer
to compare with zero.

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-04 17:14:12 -07:00
Mayank Rana
a44182a20c msm_serial: Use spin_lock_irqsave() and spin_lock_irqrestore() apis
Currently spin_lock() and spin_unlock() apis are used while handling
interrupts for synchronization which may create deadlock or schedule
out current interrupt processing part if any other interrupt comes on
the same cpu. Hence use spin_lock_irqsave() and spin_lock_irqrestore()
apis to make driver smp-safe.

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-04 17:13:38 -07:00
Mayank Rana
cf41e61d4f msm_serial: Fix uninitialized variable
baud variable might be used uninitialized. Hence initialized
the same.

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-04 17:13:35 -07:00
Mayank Rana
bbfd269f5c msm_serial_hs: Fix issue related to sleeping in invalid context
msm_hs_config_port function acquires spinlock before calling
msm_hs_request_port function where it calls request_mem_region to
claim gsbi resource and ioremap the same. As request_mem_region calls
kmem_cache_alloc which can sleep, enabling CONFIG_DEBUG_SPINLOCK_SLEEP
shows below stacktrace complaining about sleeping in invalid context.

BUG: sleeping function called from invalid context at mm/slub.c:795
in_atomic(): 1, irqs_disabled(): 128, pid: 1, name: swapper
INFO: lockdep is turned off.
irq event stamp: 52269
hardirqs last  enabled at (52268): kmem_cache_free+0xc8/0xd8
hardirqs last disabled at (52269): _raw_spin_lock_irqsave+0x18/0x5c
softirqs last  enabled at (49209): irq_exit+0x54/0xa8
softirqs last disabled at (49192): irq_exit+0x54/0xa8
(unwind_backtrace+0x0/0x124) from (kmem_cache_alloc+0x3c/0xf0)
(kmem_cache_alloc+0x3c/0xf0) from (__request_region+0x64/0x150)
(__request_region+0x64/0x150) from (msm_hs_request_port+0x4c/0x9c)
(msm_hs_request_port+0x4c/0x9c) from (msm_hs_config_port+0x2c/0x78)
(msm_hs_config_port+0x2c/0x78) from (uart_add_one_port+0x144/0x370)
(uart_add_one_port+0x144/0x370) from (msm_hs_probe+0x5c8/0x678)
(msm_hs_probe+0x5c8/0x678) from (platform_drv_probe+0x18/0x1c)
(platform_drv_probe+0x18/0x1c) from (driver_probe_device+0x140/0x254)
(driver_probe_device+0x140/0x254) from (__driver_attach+0x68/0x8c)
(__driver_attach+0x68/0x8c) from (bus_for_each_dev+0x44/0x74)
(bus_for_each_dev+0x44/0x74) from (bus_add_driver+0xc8/0x254)
(bus_add_driver+0xc8/0x254) from (driver_register+0xa8/0x134)
(driver_register+0xa8/0x134) from (platform_driver_probe+0x18/0x8c)
(platform_driver_probe+0x18/0x8c) from (msm_serial_hs_init+0x68/0xc8)
(msm_serial_hs_init+0x68/0xc8) from (do_one_initcall+0xc8/0x1a0)
(do_one_initcall+0xc8/0x1a0) from (kernel_init+0x150/0x218)
(kernel_init+0x150/0x218) from (kernel_thread_exit+0x0/0x8)

This change fixes the above mentioned issue.

CRs-Fixed: 307667
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-03 16:20:19 -07:00
Jeff Ohlstein
dc39f977d2 msm: dma: remove crci conflict checking
The crci conflict checking code was designed for a system where a crci's
mux could be changed at runtime. In reality, our chips configure these
statically, so it is not necessary.

Signed-off-by: Jeff Ohlstein <johlstei@codeaurora.org>
2011-10-03 16:18:14 -07:00
Mayank Rana
70a8e7d29d msm_serial_hs_lite: Set UART Clock rate to zero, only when it is disable
UART Core clock set rate is getting called before actually disabling uart
core clock. This problem has been seen with console suspend due to setting
clock rate to zero from msm_hsl_power api. This change makes sure that uart
core clock is actually disabled before it is set to zero.

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-03 16:17:14 -07:00
Matt Wagantall
e252237237 msm: clock: Rename all UART clocks to 'core_clk' or 'iface_clk'
Drivers should now use their device names to distinguish between
clocks of the same type rather than the clock name.

Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
2011-10-03 16:16:07 -07:00
Stepan Moskovchenko
72029d6bca msm_serial_hs_lite: Enable clocks when adding the port
Enable the GSBI bus clock when calling uart_add_one_port in
the probe function to allow a clean transition from the
early console to the regular console. The TTY layer may try
to configure the port before the early console became
deactivated, which will prematurely disable the clocks and
cause a lockup.

Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
2011-10-03 16:16:04 -07:00
Mayank Rana
ffdf530c31 msm_serial_hs_lite: Correct AUTO RFR Level value
MR1 register (AUTO_RFR_LEVEL) programming value is considered in
Words for UARTDM Core, whereas it is considered in Bytes for UART
Core. Currently MR1 register is programmed for AUTO_RFR_LEVEL value
as 3/4 size of Rx FIFO size i.e. 48 Bytes. For UARTDM Core this
value needs to configure into Words. Hence programme AUTO_RFR_LEVEL
value using MR1 register as 12 instead of 48.

Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-03 16:15:50 -07:00