msm: timer: Don't check state of clock while setting next timer event

The commit fd6681cd4d0782f6e6ac918ab337016f59c2520b introduced
a silent bug that incorrectly checks state of the clock while
setting the next timer event. The bug manifests only during
failure code path of msm idle operation, which is very rare.
Due to the bug, the driver isn't be able to reprogram the timer
device.

CRs-fixed: 468902
Change-Id: I4ec14ea9c3a5d318ef98d2b13bd55efd89538df5
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
usb: chipidea: udc: fix memory access of shared memory on armv5 machines

The udc uses an shared dma memory space between hard and software. This
memory layout is described in ci13xxx_qh and ci13xxx_td which are marked
with the attribute ((packed)).

The compiler currently does not know about the alignment of the memory
layout, and will create strb and ldrb operations.

The Datasheet of the synopsys core describes, that some operations on
the mapped memory need to be atomic double word operations. I.e. the
next pointer addressing in the qhead, as otherwise the hardware will
read wrong data and totally stuck.

This is also possible while working with the current active td queue,
and preparing the td->ptr.next in software while the hardware is still
working with the current active td which is supposed to be changed:

writeb(0xde, &td->ptr.next + 0x0); /* strb */
writeb(0xad, &td->ptr.next + 0x1); /* strb */

<----- hardware reads value of td->ptr.next and get stuck!

writeb(0xbe, &td->ptr.next + 0x2); /* strb */
writeb(0xef, &td->ptr.next + 0x3); /* strb */

This appeares on armv5 machines where the hardware does not support
unaligned 32bit operations.

This patch adds the attribute ((aligned(4))) to the structures to tell
the compiler to use 32bit operations. It also adds an wmb() for the
prepared TD data before it gets enqueued into the qhead.

CRs-Fixed: 494323
Change-Id: I3fc2e0f662076572d61f97ed708026be3cd3e59c
Cc: stable <stable@vger.kernel.org> # v3.5
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: a9c174302b1590ef3ead485d804a303c5f89174b
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
[pkondeti@codeaurora.org: resolved merge conflicts]
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Merge "usb: chipidea: udc: fix memory access of shared memory on armv5 machines"
 msm:camera: Fix overflow issue in ioctl_hw_cmds function

    'len' is of type signed int 32bit,but the assigned value
    may exceed maximum unsigned int32 range.Add overflow check
    and graceful exit if 'm'exceeds UINT32_MAX value.

Change-Id: I38f0d10a0cb44d08d0054f91044fc891c246ebd1
CRs-Fixed: 493314
Signed-off-by: Monika Alekhya <malekh@codeaurora.org>
msm:camera: Fix signedness issue in hw_exec_cmds

  In hw_exec_cmds()second argument m_cmds should be
  of type unsigned interger

Change-Id: Idad2eb1a59481f3fe9f90221ff2061e8dae57013
CRs-Fixed: 493314
Signed-off-by: Monika Alekhya <malekh@codeaurora.org>
net: rmnet_usb: silence URB submission errors during disconnect

URB submissions will fail with -ENODEV while the device is being
disconnected.  The current code prints error message for an URB
submission failure.  If too many URBs are submitted during the
disconnect window, then target is crashing due to excessive
console logging.

CRs-Fixed: 507556
Change-Id: I287c5021bacb2238b62bf78a8ddf887f588b6f16
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Merge "net: rmnet_usb: silence URB submission errors during disconnect"
Merge " msm:camera: Fix overflow issue in ioctl_hw_cmds function"
Merge "msm:camera: Fix signedness issue in hw_exec_cmds"
Merge "msm: timer: Don't check state of clock while setting next timer event"
tty: n_smux: Enable IPC logging for SMUX

Using the kernel log for SMUX logging requires users to enable
debug logging and then reproduce the issue.  Enabling all
logging often affects the timing and can make issues harder
to solve.

Add SMUX IPC Logging to enable internal logging that has a
minimum impact on performance and is always on to allow
debugging of an issue either from the command line or from
a memory dump.

CRs-Fixed: 384568
Change-Id: I6f1df407e07760206a7a548c9d3fce228e249155
Signed-off-by: Angshuman Sarkar <angshuman@codeaurora.org>
n_smux: add debugfs node for printing channel states

Add debugfs node that prints detailed state information
for all smux channels.

Change-Id: I727f1c53797ee317856056b8e4d9a8686940ce0f
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
Signed-off-by: Angshuman Sarkar <angshuman@codeaurora.org>
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
tty: n_smux: Add Remote Flow Control Test

Add remote flow control test to verify external modem to Apps flow
control.

Change-Id: Id79201006614885f266a00cca5cb99667ec372b8
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
tty: n_smux: Add flow control state to overflow message

To aid in debugging, print the state of receive flow control if an
overflow condition occurs.

Change-Id: Ic425d8c3f58e22a99b746bc184a8bb62677a944e
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
tty: n_smux: Log error messages to internal log

If an error occurs, log to both the kernel log and the internal SMUX log
to aid debugging.

Change-Id: I35f7a8e44401b6c16c0d05fd9ef3368158075b77
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
tty: n_smux: Add function to determine if remote side is active

For subsystem restart unit tests, we need to know when the remote system
is back up to avoid having to add fixed delays.

Add private function to allow checking to see if the remote side is
active.

Change-Id: Ide2f5e4aba01479c2dc1e8c3b4332da7da6ad0c5
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
tty: n_smux: Update subsystem restart unit tests

For subsystem restart unit tests, add check to make sure the remote
system is back up before continuing with the tests.  This allows
removing fixed wait times in the unit tests and allows stress testing
using a shell script to call tests back-to-back.

Change-Id: I9af2164dd2ff8bc4d8a1e57f8a7aad957528a8c9
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
tty: n_smux: Mask power collapse support

If power-collapse is supported locally, then SMUX will always set the
power-collapse supported flag in an OPEN ACK which may cause confusion
for the remote side.

Mask power-collapse enabled with the value in the remote open
acknowledge message.

CRs-Fixed: 443770
Change-Id: I8ceb753e25a53d13fa5b5288457e8b1993452a18
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
tty: n_smux: Don't uselessly assign value

Don't give an unnecessary initial value to a local variable.

Change-Id: I1d9e3987970fc2108d6416159bc425da73da0e07
Signed-off-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
tty: smux_ctl: close SMUX port during SSR

If a subsystem restart occurs, the SMUX port needs to be closed when the
platform device is removed and then re-opened when the platform device
is probed again.  Without this functionality, the SMUX port state is not
properly reset resulting in a data stall.

Add code to close the SMUX port when the platform device is removed.

CRs-Fixed: 474388
Change-Id: I00039fa517a5cf6b4d9230114cac7c6c9bbba9d1
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>