mailbox: sm1: pass irdeto ifcp testing [1/2]
authorWayling Chen <wayling.chen@amlogic.com>
Thu, 31 Oct 2019 11:05:08 +0000 (19:05 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Mon, 23 Dec 2019 10:21:57 +0000 (03:21 -0700)
PD#SWPL-15621

Problem:
1.irdeto ifcp can't work on amlogic mailbox.

Solution:
fix completion usage and mailbox payload offset
fix mailbox send buffer size to fit bl40_msg_buf struct

Verify:
    test pass on sm1 skt

Change-Id: Iea33427125b1f221241331730e2869d3b2b369f2
Signed-off-by: Wayling Chen <wayling.chen@amlogic.com>
drivers/amlogic/mailbox/meson_mhu.c
drivers/amlogic/mailbox/scpi_protocol.c
include/linux/amlogic/scpi_protocol.h

index 88e82638bec07a4ef2524f5ba394152c1ca5e224..13d7aa3b51206d47f6537c66695391940d9aee6b 100644 (file)
@@ -150,9 +150,12 @@ static irqreturn_t mbox_handler(int irq, void *p)
                        if (is_send_isr) {
                                memcpy(data->rx_buf, payload + TX_PAYLOAD(idx),
                                       data->rx_size);
-                       } else
+                       } else {
+                               data->rx_size =
+                                       readl(mbox_base + RX_STATUS(idx));
                                memcpy(data->rx_buf, payload + RX_PAYLOAD(idx),
                                       data->rx_size);
+                       }
                }
                mbox_chan_received_data(link, data);
                if (!is_send_isr)
@@ -172,6 +175,7 @@ static int mhu_send_data(struct mbox_chan *link, void *msg)
        void __iomem *payload = ctlr->payload_base;
        struct mhu_data_buf *data = (struct mhu_data_buf *)msg;
        int idx = chan->index;
+       u8 datatmp[512] = {0};
 
        if (!data)
                return -EINVAL;
@@ -183,8 +187,10 @@ static int mhu_send_data(struct mbox_chan *link, void *msg)
                else
                        idx = 0;
        }
+       memcpy(datatmp, data->tx_buf, data->tx_size);
        if (data->tx_buf)
-               memcpy(payload + TX_PAYLOAD(idx), data->tx_buf, data->tx_size);
+               memcpy(payload + TX_PAYLOAD(idx), datatmp, data->tx_size);
+
        writel(data->cmd, mbox_base + TX_SET(idx));
 
        return 0;
index e4813165bdc67b6181d0a7ae02d2b26bbf4e4743..06a30cbf7a8346c33ac61ad4b26cad6a574cdd2e 100644 (file)
@@ -723,6 +723,6 @@ int scpi_send_bl40(unsigned int cmd, struct bl40_msg_buf *bl40_buf)
 
        SCPI_SETUP_DBUF_SIZE(sdata, mdata, SCPI_CL_NONE,
                             cmd, bl40_buf->buf, bl40_buf->size,
-                            bl40_buf, sizeof(struct bl40_msg_buf));
+                            bl40_buf->buf, sizeof(bl40_buf->buf));
        return scpi_execute_cmd(&sdata);
 }
index 7c284d7fb901ec8f45be2f5382fa3387f456c24f..65b3cbcccc02f23af5c1df4d232c5460a41bf69b 100644 (file)
@@ -100,7 +100,7 @@ struct scpi_dvfs_info {
 
 struct bl40_msg_buf {
        int size;
-       char buf[256];
+       char buf[512];
 } __packed;
 
 unsigned long scpi_clk_get_val(u16 clk_id);