rpmsg: glink: reset read/write index after ssr

While system is going down fifo index are not reset which can
cause remote subsystem to read stale index.

Now resetting the index while system is going down.

CRs-Fixed: 2543040
Change-Id: Icb4010c120f4735da206a44a4eb1bcf06ae0a1b7
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
This commit is contained in:
Deepak Kumar Singh 2019-10-18 15:23:31 +05:30 committed by Chris Lew
parent a2420135bd
commit 466924d268

View File

@ -46,6 +46,12 @@ struct glink_smem_pipe {
#define to_smem_pipe(p) container_of(p, struct glink_smem_pipe, native)
static void glink_smem_rx_reset(struct qcom_glink_pipe *np)
{
struct glink_smem_pipe *pipe = to_smem_pipe(np);
*pipe->tail = 0;
}
static size_t glink_smem_rx_avail(struct qcom_glink_pipe *np)
{
struct glink_smem_pipe *pipe = to_smem_pipe(np);
@ -120,6 +126,12 @@ static void glink_smem_rx_advance(struct qcom_glink_pipe *np,
*pipe->tail = cpu_to_le32(tail);
}
static void glink_smem_tx_reset(struct qcom_glink_pipe *np)
{
struct glink_smem_pipe *pipe = to_smem_pipe(np);
*pipe->head = 0;
}
static size_t glink_smem_tx_avail(struct qcom_glink_pipe *np)
{
struct glink_smem_pipe *pipe = to_smem_pipe(np);
@ -279,11 +291,13 @@ struct qcom_glink *qcom_glink_smem_register(struct device *parent,
goto err_put_dev;
}
rx_pipe->native.reset = glink_smem_rx_reset;
rx_pipe->native.avail = glink_smem_rx_avail;
rx_pipe->native.peak = glink_smem_rx_peak;
rx_pipe->native.advance = glink_smem_rx_advance;
rx_pipe->remote_pid = remote_pid;
tx_pipe->native.reset = glink_smem_tx_reset;
tx_pipe->native.avail = glink_smem_tx_avail;
tx_pipe->native.write = glink_smem_tx_write;
tx_pipe->remote_pid = remote_pid;