mmc: sdio: Fix SDIO 3.0 UHS-I initialization sequence

According to UHS-I initialization sequence for SDIO 3.0 cards,
the host must set bit[24] (S18R) of OCR register during OCR
handshake to know whether the SDIO card is capable of doing
1.8V I/O.

(cherry picked from commit 25248b6782085f66787f0b5ea7864bd3dd4e685c)

Change-Id: I2f53cc248f745ce884686bf68f7a9058a7af1d1c
CRs-Fixed: 424685
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
msm: sps: improve debugging support in SPS driver

1> Add the option to output partial desc FIFO.
2> Add the option to output data block header.
3> Add the option to output all registers of selected pipes.
4> Add more testbus selector options.
5> Remove the duplicate code for testbus selector values.
6> Add the options for bundle output of testbus register, BAM global
registers, pipe registers and desc FIFOs.

Change-Id: I02a77be6006015f705ee962cc35193f44b27e297
Signed-off-by: Yan He <yanhe@codeaurora.org>
msm: sps: check the result of memory allocation

Check the result of memory allocation request before use it, to avoid NULL
pointer dereference.

Change-Id: I56376b4f503d3c7134ae3ab73fccd5b0b3a40290
Signed-off-by: Yan He <yanhe@codeaurora.org>

Conflicts:

	drivers/platform/msm/sps/sps_bam.c

Signed-off-by: Dipen Parmar <dipenp@codeaurora.org>
arm: common: move cpaccess sysfs node

cpaccess uses sysdev which is being deprecated.
Move the cpaccess node out of the /sys/devices/system
directory to /sys/devices. Temporarily leave the original
sysdev node for migration purposes, until userspace
applications can be moved to the new node.

Change-Id: Iacc776968f892fc6c6463764e576d987e4371716
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
msm: ipc: Fix the logic while dumping IPC Router routing table info

IPC Router Routing table is organized as a hash table. The routing
table information is dumped based on the index into that hash table.
Update the logic to dump the routing table information based on the
subsystem's node id.

Change-Id: Ideaf24934b93349e2f2cf1d695d08841c04aa5f9
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
msm: ipc: Update HELLO message processing

When IPC Router receives a HELLO message from a remote IPC Router, the
protocol is to send a list of servers registered locally and registered
outside the mesh network where the HELLO message is received. Currently
the implementation does not follow this protocol strictly and hence
correct the implementation.

CRs-Fixed: 414147
Change-Id: I75aa089b152baea0925d127b1d9deb6684677cfa
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
msm: ipc: Reorganize server hash table

QMI server(<service_id:instance_id>) info is maintained using a hash
table. The server's instance_id is used as the key to index into that
hash table to perform maintenance operations(add, lookup, delete).
The service_id values are well distributed than the instance_id values
and hence the operations on the hash table are not optimized. Optimize
the hash table operations by using server's service_id as the key to
index into the hash table.

While accessing the server hash table, the mutexes are locked and
unlocked inside the access functions. This introduces some race
conditions once the access functions return. So lock and unlock the
server hash table mutex outside the access functions.

CRs-Fixed: 415158
Change-Id: Id1ce6bbfc677df26ff209fd62dca8553c7d2b4a5
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
msm: ipc: Fix lockdep warning by IPC message router

IPC Message Router while processing the HELLO message, sends a server list
information registered locally to the remote subsystem which has sent the
HELLO message. IPC Message Router does this operation by locking mutexes
in the following order:
1) routing_table_lock
2) server_list_lock inside msm_ipc_router_send_server_list

IPC Message Router while processing the NEW_SERVER message, accesses the
server list information to check if the server information advertised by
the remote subsystem is already known before adding that information to
the server list. IPC Message Router does this operation by locking mutexes
in the following order:
1) server_list_lock
2) routing_table_lock inside msm_ipc_router_lookup_remote_port

This leads to a deadlock if the IPC message router processes HELLO message
from one subsystem and NEW_SERVER message from another subsystem. Fix this
out of order locking scenario by locking the server_list_lock before
accessing the msm_ipc_router_send_server_list function.

CRs-Fixed: 417155
Change-Id: Ie38c1c21dccefac7a9b36ad107b13feccd986ed2
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
msm: ipc: Send REMOVE_CLIENT message when a server port is closed

When the server port is closed, only REMOVE_SERVER message is sent. If
the same port is used as a client port prior to the server registration,
then the IPC Router in the remote subsystem does not clean up the client
information associated with that port. This leads to memory leak in the
remote subsystem.

When the server exits and closes the port, IPC Router has to send both
REMOVE_SERVER and REMOVE_CLIENT messages. This ensures that the
IPC Router in the remote subsystem cleans up both the client and server
information associated with that port.

CRs-Fixed: 434981
Change-Id: I1d59aa773398d10dd5c648969b9da2e1cf481d24
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
msm: ipc: Advertise service information only from alive subsystems

As part of processing HELLO message, IPC Router does not check the status
of a subsystem before trying to advertise the services hosted in that
subsystem. During the subsystem restart scenario, sometimes two or more
subsystems get reset together. When one of the subsystems come up, IPC
Router ends up accessing the data structures of the other subsystems that
are still in shutdown stage. This causes the IPC Router to trigger invalid
pointer dereference.

Check the status of the subsystem before trying to advertise the services
hosted in that subsystem.

CRs-Fixed: 447217
Change-Id: I50bc2bc21fcfd31ba23f6ebba5728f13268a76e5
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
msm: ipc: Cache the length of a packet being looped back

When a message is looped back to the user-space, sometimes the
receiver acts quickly, reads the contents of the packet and frees
the buffer. This leads to a scenario where the sender is trying to
dereference the packet length info of a freed packet. Hence a garbage
packet length gets returned to the user-space.

Fix this race condition by storing the packet length of the packet
being looped back into a variable and return the value of that variable
when the loopback operation is complete.

Change-Id: I595a562bfa12151b2f9154df681ce23c965dfff5
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
EHCI: HSIC: Halt the controller while resetting the port

commit 9ecc39cd (EHCI: HSIC: Implement new reset sequence to workaround
PHY lockup issue) does not halt controller before proceeding to reset
sequence.  If the controller is not halted and SOFs are transmitted, PHY
may stuck during port reset.

CRs-Fixed: 459280
Change-Id: I213ca7d41420596b91eb9b5e6803d1e237167136
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
media: dvb: Secure demux API updates

Update minor changes in the secure demux API introduced in
version 3.2: changed the write pointer error to a be reported as
a filter level status.

Change-Id: I2a85c8ba1c1d23faf15ad71c4b824e58e274efac
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
msm: socinfo: add new subtype definition for the SGLTE2 target

The SGLTE2 target is identified by subtype 9 in the platform
CDT info.

Change-Id: I61a0acea2c3bf8d5005094521a1f99c5f626bcf9
Signed-off-by: Joel King <joelking@codeaurora.org>
msm: 8064: add platform device info for the sglte2 target

The sglte2 target has two external modems, an mdm9x15
and a qsc1215.

Change-Id: I0cd5b3cb20994e706536c2bbd4c0f82ada35058d
Signed-off-by: Joel King <joelking@codeaurora.org>
mobicore: t-base-200 Engineering Release.

Support Nwd malloc() for WSM instead of forcing mcMallocWsm().
Other minor fixes.

Change-Id: I3a54da94593cba2d6dd6295e14177d494aa2ded9
Signed-off-by: Oana Medvesan <medvesan.oana@gmail.com>
[hnamgund@codeaurora.org: Drop changes to mobicore_kernelapi/main.c to
align with other branches, fix checkpatch failure in platform.h, fix
file mode on Makefile and Kconfig]
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Acked-by: Tony Hamilton <tonyh@qti.qualcomm.com>
mobicore: t-base-200 Engineering Release.

TCI handle from one client can be used by any client.

Change-Id: I0ddf2aaefaaa6f1d281d17874f4c7412ec86be57
Signed-off-by: Oana Medvesan <medvesan.oana@gmail.com>
[hnamgund@codeaurora.org: Disable logging in platform.h]
Signed-off-by: Hariprasad Dhalinarasimha <hnamgund@codeaurora.org>
Acked-by: Tony Hamilton <tonyh@qti.qualcomm.com>
wcnss: Configure bite interrupt as edge triggered

Riva bite interrupt is edge triggered

CRs-Fixed: 422014
Change-Id: Ie51d65763e11e4d9de55d7b0fe5a07b910c114e6
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
usb: f_serial: Remove unnecessary return statements in gport_setup

Driver allocates and initializes port associated with transport
for a serial interface by calling gport_setup. In case of HSIC
transport if port setup is successful gport_setup returns right
away without setting up hsuart port if it is present. As a result
if a usb composition has serial interface for both hsic and hsuart
transports then hsuart port will not be allocated and initialized.
This causes NULL pointer dereference of hsuart port later during
device enumeration.

Change-Id: I07959d88daace9e1a9351c19ee2d04900638a48b
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
msm: 8064: Add support for GSBI4 based UARTDM

GSBI4 based UARTDM is used for primary IPC between APPS
and QSC on 8064 SGLTE2 platform. Hence add required resources
and configuration (i.e. GSBI4 UARTDM as platform device, clocks,
interrupts, DMA channels) for GSBI4 based UARTDM and enable the
same for 8064 SGLTE2 platform.

Change-Id: I3623e4b09d6d3e2d344f1fb7fbbbce75fe008ff4
Signed-off-by: Mayank Rana <mrana@codeaurora.org>