Hi all,
I am working on a iMX28 platform and my U-Boot LCDIF driver is configured to write to a Sitronix ST7789V display in MPU 8080 mode.
The write function (see below) is working as expected, but I am now trying to create a read function to read the Display ID (RDDID), I've been trying for weeks now and nothing seems to work.
If anyone have already written a similar function or could help me to understand why my function is not working, it would be much appreciated.
Here is the write function (working as expected):
static int mxsfb_write_byte(uint32_t payload, const unsigned int data)
{
struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
const unsigned int timeout = 0x10000;
if (mxs_wait_mask_clr(®s->hw_lcdif_ctrl_reg, LCDIF_CTRL_RUN,
timeout))
return -ETIMEDOUT;
writel((1 << LCDIF_TRANSFER_COUNT_V_COUNT_OFFSET) |
(1 << LCDIF_TRANSFER_COUNT_H_COUNT_OFFSET),
®s->hw_lcdif_transfer_count);
writel(LCDIF_CTRL_DATA_SELECT | LCDIF_CTRL_RUN,
®s->hw_lcdif_ctrl_clr);
if (data)
writel(LCDIF_CTRL_DATA_SELECT, ®s->hw_lcdif_ctrl_set);
writel(LCDIF_CTRL_RUN, ®s->hw_lcdif_ctrl_set);
if (mxs_wait_mask_clr(®s->hw_lcdif_lcdif_stat_reg, 1 << 29,
timeout))
return -ETIMEDOUT;
writel(payload, ®s->hw_lcdif_data);
return mxs_wait_mask_clr(®s->hw_lcdif_ctrl_reg, LCDIF_CTRL_RUN,
timeout);
}
Here is my read function (value is always 0):
static int ReadPara_32Bit(uint32_t *value)
{
uint32_t returnValue = 0;
struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE;
const unsigned int timeout = 0x10000;
//wait for the RUN to be clear
if (mxs_wait_mask_clr(®s->hw_lcdif_ctrl_reg, LCDIF_CTRL_RUN,
timeout))
return -ETIMEDOUT;
writel((1 << LCDIF_TRANSFER_COUNT_V_COUNT_OFFSET) |
(4 << LCDIF_TRANSFER_COUNT_H_COUNT_OFFSET),
®s->hw_lcdif_transfer_count);
//Clear the data an run, not sure if it is needed
writel(LCDIF_CTRL_DATA_SELECT | LCDIF_CTRL_RUN,
®s->hw_lcdif_ctrl_clr);
//Set the data flag
writel(LCDIF_CTRL_DATA_SELECT, ®s->hw_lcdif_ctrl_set);
//change LCDIF from write(default) mode to read mode
writel(LCDIF_CTRL_READ_WRITEB, ®s->hw_lcdif_ctrl_set);
//Sets RUN to start the transaction
writel(LCDIF_CTRL_RUN, ®s->hw_lcdif_ctrl_set);
//wait for the RUN to be clear again
if (mxs_wait_mask_clr(®s->hw_lcdif_ctrl_reg, LCDIF_CTRL_RUN,
timeout))
return -ETIMEDOUT;
//Checks that the RX FIFO isn't empty (28_LFIFO_EMPTY)
//if (mxs_wait_mask_clr(®s->hw_lcdif_lcdif_stat_reg, 1 << 28, timeout)) return -ETIMEDOUT;
//Read the value
returnValue = readl(®s->hw_lcdif_data);
*value = returnValue;
// then set LCDIF to write(default) mode again
writel(LCDIF_CTRL_READ_WRITEB, ®s->hw_lcdif_ctrl_clr);
return 0;
}
And here is how I call the function:
uint32_t rddid = 0;
u16 rddid_cmd = 0x04;
mxsfb_write_byte(rddid_cmd,0);
int value = ReadPara_32Bit(&rddid);
Thanks in advance for your help.
Thank you for the link, unfortunately I couldn't find anything related to the read function to the display.
I'm looking at something similar to this link: https://community.nxp.com/t5/i-MX-Processors/MPU-read-problem-in-iMX28/m-p/249761
Thanks in advance
Hi durje
one can look at L3.14.52_Uboot_mpu_display.patch.zip on
Best regards
igor