Commit e80c98ab authored by Guido Günther's avatar Guido Günther

nwl-dsi: Workaround imx8mq errata e11418

This works around packet corruption by zeros in [8:24].
Signed-off-by: Guido Günther's avatarGuido Günther <guido.gunther@puri.sm>
parent a0cba321
......@@ -30,6 +30,7 @@
#include <linux/of_platform.h>
#include <linux/phy/phy.h>
#include <linux/spinlock.h>
#include <soc/imx8/soc.h>
#include <video/mipi_display.h>
#include <video/videomode.h>
......@@ -770,6 +771,13 @@ static void nwl_dsi_finish_transmission(struct nwl_mipi_dsi *dsi, u32 status)
complete(&xfer->completed);
}
#define B0_SILICON_ID 0x20
static bool nwl_use_e11418_workaround(void)
{
return (imx8_get_soc_revision() == B0_SILICON_ID) ? true : false;
}
static void nwl_dsi_begin_transmission(struct nwl_mipi_dsi *dsi)
{
struct mipi_dsi_transfer *xfer = dsi->xfer;
......@@ -779,6 +787,7 @@ static void nwl_dsi_begin_transmission(struct nwl_mipi_dsi *dsi)
u16 word_count;
u8 hs_mode;
u32 val;
u32 hs_workaround = 0;
/* Send the payload, if any */
length = pkt->payload_length;
......@@ -786,6 +795,7 @@ static void nwl_dsi_begin_transmission(struct nwl_mipi_dsi *dsi)
while (length >= 4) {
val = get_unaligned_le32(payload);
hs_workaround |= !(val & 0xFFFF00);
nwl_dsi_write(dsi, TX_PAYLOAD, val);
payload += 4;
length -= 4;
......@@ -798,6 +808,7 @@ static void nwl_dsi_begin_transmission(struct nwl_mipi_dsi *dsi)
/* Fall through */
case 2:
val |= payload[1] << 8;
hs_workaround |= !(val & 0xFFFF00);
/* Fall through */
case 1:
val |= payload[0];
......@@ -814,7 +825,15 @@ static void nwl_dsi_begin_transmission(struct nwl_mipi_dsi *dsi)
* header[2] = Word Count MSB (LP) or second param (SP)
*/
word_count = pkt->header[1] | (pkt->header[2] << 8);
hs_mode = (xfer->msg->flags & MIPI_DSI_MSG_USE_LPM)?0:1;
if ((hs_workaround && nwl_use_e11418_workaround())) {
DRM_DEV_DEBUG_DRIVER(dsi->dev,
"Using hs mode workaround for cmd 0x%x",
xfer->cmd);
hs_mode = 1;
} else {
hs_mode = (xfer->msg->flags & MIPI_DSI_MSG_USE_LPM)?0:1;
}
val = WC(word_count) |
TX_VC(xfer->msg->channel) |
TX_DT(xfer->msg->type) |
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment