From d8958b1047f304015bd9e5c580f11a2134108604 Mon Sep 17 00:00:00 2001 From: Qiufang Dai Date: Mon, 30 Dec 2019 16:53:33 +0800 Subject: [PATCH] Mailbox: fix mailbox rx_size issue.[2/3] PD#SWPL-19014 Problem: m3 channel (low mailbox) use wrong rx_size in mbox_handler Solution: m4 channel use read back rx_size, m3 use rx_size from package Verify: S905X3-AC214 Change-Id: I44a5a038b14f3d6860ffb01e733d56795696024f Signed-off-by: Qiufang Dai --- drivers/amlogic/mailbox/meson_mhu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/amlogic/mailbox/meson_mhu.c b/drivers/amlogic/mailbox/meson_mhu.c index 13d7aa3b5120..0cb578c65e8d 100644 --- a/drivers/amlogic/mailbox/meson_mhu.c +++ b/drivers/amlogic/mailbox/meson_mhu.c @@ -151,8 +151,12 @@ static irqreturn_t mbox_handler(int irq, void *p) memcpy(data->rx_buf, payload + TX_PAYLOAD(idx), data->rx_size); } else { - data->rx_size = - readl(mbox_base + RX_STATUS(idx)); + /*idx=0 means there is an old machenism: + * AP SET0 send/ MCU SET1 ack + */ + if (idx) + data->rx_size = + readl(mbox_base + RX_STATUS(idx)); memcpy(data->rx_buf, payload + RX_PAYLOAD(idx), data->rx_size); } -- 2.20.1