Commit Graph

219 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
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
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
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
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
Mayank Rana
00b6bffc54 msm_serial_hs: Enable clock when configuring the GSBI
Enable the bus clock when configuring the GSBI CTRL register
for UARTDM mode.

CRs-Fixed: 301746
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-03 16:15:12 -07:00
Mayank Rana
ad56d5ff8c msm_serial_hs_lite: Correct Rx Watermark Value
RFWR register's programming value is considered in Words for UARTDM
Core, whereas it is considered in Bytes for UART Core. Currently RFWR
register is programmed as 3/4 size of Rx FIFO size i.e. 48 Bytes.
For UARTDM Core this value needs to configure into Words. Hence programme
RFWR register with value as 12 instead of 48.

CRs-Fixed: 301603
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-03 16:15:05 -07:00
Axel Lin
64da3499c9 tty: Add "spi:" prefix for spi modalias
commit 8c4074cd2254606aeb788d518ccc27c9f97129e1 upstream.

Since commit e0626e38 (spi: prefix modalias with "spi:"),
the spi modalias is prefixed with "spi:".

This patch adds "spi:" prefix and removes "-spi" suffix in the modalias.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-03 11:39:49 -07:00
Al Cooper
db14205cc5 8250: Fix race condition in serial8250_backup_timeout().
commit dbb3b1ca5609d1f3848cd387d06cc60aaacf7f98 upstream.

This is to fix an issue where output will suddenly become very slow.
The problem occurs on 8250 UARTS with the hardware bug UART_BUG_THRE.

BACKGROUND
For normal UARTs (without UART_BUG_THRE): When the serial core layer
gets new transmit data and the transmitter is idle, it buffers the
data and calls the 8250s' serial8250_start_tx() routine which will
simply enable the TX interrupt in the IER register and return. This
should immediately fire a THRE interrupt and begin transmitting the
data.
For buggy UARTs (with UART_BUG_THRE): merely enabling the TX interrupt
in IER does not necessarily generate a new THRE interrupt.
Therefore, a background timer periodically checks to see if there is
pending data, and starts transmission if that is the case.

The bug happens on SMP systems when the system has nothing to transmit,
the transmit interrupt is disabled and the following sequence occurs:
- CPU0: The background timer routine serial8250_backup_timeout()
  starts and saves the state of the interrupt enable register (IER)
  and then disables all interrupts in IER. NOTE: The transmit interrupt
  (TI) bit is saved as disabled.
- CPU1: The serial core gets data to transmit, grabs the port lock and
  calls serial8250_start_tx() which enables the TI in IER.
- CPU0: serial8250_backup_timeout() waits for the port lock.
- CPU1: finishes (with TI enabled) and releases the port lock.
- CPU0: serial8250_backup_timeout() calls the interrupt routine which
  will transmit the next fifo's worth of data and then restores the
  IER from the previously saved value (TI disabled).
At this point, as long as the serial core has more transmit data
buffered, it will not call serial8250_start_tx() again and the
background timer routine will slowly transmit the data.

The fix is to have serial8250_start_tx() get the port lock before
it saves the IER state and release it after restoring IER. This will
prevent serial8250_start_tx() from running in parallel.

Signed-off-by: Al Cooper <alcooperx@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-03 11:39:48 -07:00
Eric Smith
48fb01de0a 8250_pci: add support for Rosewill RC-305 4x serial port card
commit 44178176ecc55ad370b837dd2c4b4b8bed1e3823 upstream.

This patch adds support for the Rosewill RC-305 four-port PCI serial
card, and probably any other four-port serial cards based on the
Moschip MCS9865 chip, assuming that the EEPROM on the card was
programmed in accordance with Table 6 of the MCS9865 EEPROM
Application Note version 0.3 dated 16-May-2008, available from the
Moschip web site (registration required).

This patch is based on an earlier patch [1] for the SYBA 6x serial
port card by Ira W. Snyder.

[1]: http://www.gossamer-threads.com/lists/linux/kernel/1162435

Signed-off-by: Eric Smith <eric@brouhaha.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-03 11:39:48 -07:00
Bjorn Helgaas
ecc0d72d6d serial: 8250_pnp: add Intermec CV60 touchscreen device
commit ab8ba3a2d2cba6a658ef596cd5b2e0905b6c8a9f upstream.

It would have been nice if Intermec had supplied a PNP0501 _CID for the
COM3 device, but they didn't, so we have to recognize it explicitly.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=40612
CC: Jeff Chua <jeff.chua.linux@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-03 11:39:48 -07:00
Nick Pelly
f64bd12ba5 omap-serial: Allow IXON and IXOFF to be disabled.
commit b280a97d1caf6fe1d38b51ebb31219391f5ad1a0 upstream.

Fixes logic bug that software flow control cannot be disabled, because
serial_omap_configure_xonxoff() is not called if both IXON and IXOFF bits
are cleared.

Signed-off-by: Nick Pelly <npelly@google.com>
Acked-by: Govindraj.R <govindraj.raja@ti.com>
Tested-by: Govindraj.R <govindraj.raja@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-10-03 11:39:48 -07:00
Mayank Rana
2d4d2f6bab msm_serial_hs: Disable Rx DM Interface before sending flush
The execution of Rx enqueue command, Rx flush command and setting of
rx.flush state should happen in atomic way. It happens that start_rx()
and set_termios() might be executing concurrently while doing Bluetooth
ON after some iterations, which is putting ADM into bad state and it
stalls Rx transfer showing as Bus Error.

Disable Rx DM Interface before sending flush command and changing
protocol configuration from set_termios(). This will make sure that even
enqueue/flush is not in synchronization while changing the baud rate OR
moving between different line discipline (not supposed to happen
frequently, but in some case it is seen). There is hardware signals
( uart _dm_rx_dm_req and uart _dm_rx_dm_ack ) between UARTDM core and ADM
which is used to make request and acknowledge the same. Disabling Rx DM
interface causes ADM to terminate the current RX transfer.

CRs-Fixed: 296523
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-03 10:27:51 -07:00
Mayank Rana
9825dc6c79 msm_serial_hs_lite: Add support for higher baud rate
Currently driver supports max baud rate as 115200 bps.
This change allows to use higher baud rate like 230400 bps
and 460800 bps.

CRs-fixed: 298417
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
2011-10-03 10:26:59 -07:00