From: Wayling Chen Date: Thu, 31 Oct 2019 11:05:08 +0000 (+0800) Subject: mailbox: sm1: pass irdeto ifcp testing [1/2] X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f41c50e2d7129029b4b006024ac0cf853b739fec;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git mailbox: sm1: pass irdeto ifcp testing [1/2] 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 --- diff --git a/drivers/amlogic/mailbox/meson_mhu.c b/drivers/amlogic/mailbox/meson_mhu.c index 88e82638bec0..13d7aa3b5120 100644 --- a/drivers/amlogic/mailbox/meson_mhu.c +++ b/drivers/amlogic/mailbox/meson_mhu.c @@ -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; diff --git a/drivers/amlogic/mailbox/scpi_protocol.c b/drivers/amlogic/mailbox/scpi_protocol.c index e4813165bdc6..06a30cbf7a83 100644 --- a/drivers/amlogic/mailbox/scpi_protocol.c +++ b/drivers/amlogic/mailbox/scpi_protocol.c @@ -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); } diff --git a/include/linux/amlogic/scpi_protocol.h b/include/linux/amlogic/scpi_protocol.h index 7c284d7fb901..65b3cbcccc02 100644 --- a/include/linux/amlogic/scpi_protocol.h +++ b/include/linux/amlogic/scpi_protocol.h @@ -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);