spi_qsd: Remove check for unaligned length during input_irq.

QUP_IRQ  complete is triggered  before  dmov_rx callback.
Which will initiate SPI to start next transfer, due to
this earlier DMOV_CMD is blocked  and results in kernel panic.

Current  Implementation  make sure that transfer complete waits
For  DMOV callback only in case of aligned lengths , This patch
ensures   transfer trigger only after DMOV  RX call back for
unaligned length also.

Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: Add support for bam pipe flush on timeout

BAM pipes must be flushed when a transfer timeout
leaving dangling descriptors.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: Verify pointers prior to redirection

Redirection on a NULL pointer leads to a system crash.
Here we verify pointers which potentially may be NULL
before a redirection.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: Correct an error reporting check

When reading values from the device tree, the error
check on BAM producer pipe must be negated.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: Remove redundant input first setting in bam mode

The HW is not mandating the use of input first in bam mode,
therefore, that statement is removed.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: Fix SPI L2 Crash

Work queue is scheduled to process
SPI messages  during system suspend
state which leads to crash.

This patch make sure all the messages
in queue are processed before system
suspends.

Signed-off-by: Sana Venkat Raju <c_vsana@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: Config GPIOs by name rather then by index

Currently GPIOs are identified (MISO/MOSI/CLK or CS0..3)
by their index in the device-tree entry's array.
Further, chipselect GPIOs must be declared in order.
This allows to set a value for GPIO number three only
if the values for GPIOs one and two are also set.
This patch allows the driver to identify GPIOs by a
unique name, thus allows to specify any arbitrary
chipselect GPIO and reduces chances of simple
user configuration error.

Signed-off-by: Gilad Avidov <gavidov@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: Correction in DMA mode check

Due to a bug in the if() condition msm_spi_use_dma
function is always returning '0' when cs_change
is true. Due to this issue the DMA mode is not being used
when it has to be.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
spi_qsd: correct the chip select gpios valid field entry

During probe Chip select gpio's valid field is set to non-zero.
This is causing gpio free to get called for not-used gpios
during runtime suspend.

Signed-off-by: Alok Chauhan <alokc@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>