Mailbox: fix mailbox rx_size issue.[2/3]
authorQiufang Dai <qiufang.dai@amlogic.com>
Mon, 30 Dec 2019 08:53:33 +0000 (16:53 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 31 Dec 2019 03:09:48 +0000 (20:09 -0700)
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 <qiufang.dai@amlogic.com>
drivers/amlogic/mailbox/meson_mhu.c

index 13d7aa3b51206d47f6537c66695391940d9aee6b..0cb578c65e8d5ca3caa4d6435eda81eab23c6383 100644 (file)
@@ -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);
                        }