Skip to contentSkip to conversation

drm: mxsfb: Clear FIFO_CLEAR bit

PATCH In review Marek Vasut 3 participants 13 messages Jun 20, 2021 – Jul 14, 2021

Subsystems (4)
lore
Share & tools
lore

Marek Vasut

author maintainer
#0 lore raw

PATCH 1/1 drm: mxsfb: Clear FIFO_CLEAR bit

Make sure the FIFO_CLEAR bit is latched in when configuring the controller, so that the FIFO is really cleared. And then clear the FIFO_CLEAR bit, since it is not self-clearing.

Fixes 45d59d704080 ("drm: Add new driver for MXSFB controller")
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Stefan Agner <[email protected]>
---
 drivers/gpu/drm/mxsfb/mxsfb_kms.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +3 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
 	/* Clear the FIFOs */
 	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);
+	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_CLR);
+	readl(mxsfb->base + LCDC_CTRL1);
 
 	if (mxsfb->devdata->has_overlay)
 		writel(0, mxsfb->base + LCDC_AS_CTRL);
Signature · 1 line
2.30.2
#1 lore raw

Am Montag, dem 21.06.2021 um 00:49 +0200 schrieb Marek Vasut:

Quoted 20 lines

Make sure the FIFO_CLEAR bit is latched in when configuring the controller, so that the FIFO is really cleared. And then clear the FIFO_CLEAR bit, since it is not self-clearing.

Fixes 45d59d704080 ("drm: Add new driver for MXSFB controller")
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Stefan Agner <[email protected]>
---
 drivers/gpu/drm/mxsfb/mxsfb_kms.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +0 -0
index 98d8ba0bae84..22cb749fc9bc 100644

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 4 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
 	/* Clear the FIFOs */
 	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

Quoted 5 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +2 -0
+	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_CLR);
+	readl(mxsfb->base + LCDC_CTRL1);
 
 	if (mxsfb->devdata->has_overlay)
 		writel(0, mxsfb->base + LCDC_AS_CTRL);
author maintainer
#2 lore raw

On 6/21/21 2:14 PM, Lucas Stach wrote:

[...]

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +0 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
Quoted 7 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 3 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
  	/* Clear the FIFOs */
  	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

#3 lore raw

Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut:

Quoted 18 lines · Lucas Stach

[...]

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +0 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
Quoted 7 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 3 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
  	/* Clear the FIFOs */
  	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

Quoted 2 lines

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

There are a lot of more writes with barriers to the controller slave interface in that function after clearing the FIFO. I don't see why this readback would be required.

Regards,
Lucas

author maintainer
#4 lore raw
Quoted 19 lines · Lucas Stach

Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut:

Quoted 18 lines · Lucas Stach

[...]

Quoted 13 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 9 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
   	/* Clear the FIFOs */
   	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

Quoted 6 lines
Quoted 2 lines

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

There are a lot of more writes with barriers to the controller slave interface in that function after clearing the FIFO. I don't see why this readback would be required.

Because you really do want to make sure the fifo is cleared before you start doing any of those other writes or configuring the controller in any way.

#5 lore raw

Am Dienstag, dem 22.06.2021 um 11:33 +0200 schrieb Marek Vasut:

Quoted 23 lines · Lucas Stach
Quoted 22 lines

Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut:

Quoted 20 lines · Lucas Stach

[...]

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +0 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
Quoted 7 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 3 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
   	/* Clear the FIFOs */
   	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

Quoted 7 lines
Quoted 3 lines

There are a lot of more writes with barriers to the controller slave interface in that function after clearing the FIFO. I don't see why this readback would be required.

Because you really do want to make sure the fifo is cleared before you start doing any of those other writes or configuring the controller in any way.

I still don't see the reason. What additional properties do you think the readback provides that isn't already provided by the barriers in the following writes?

Regards,
Lucas

author maintainer
#6 lore raw
Quoted 28 lines · Lucas Stach

Am Dienstag, dem 22.06.2021 um 11:33 +0200 schrieb Marek Vasut:

Quoted 27 lines · Lucas Stach
Quoted 25 lines

Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut:

Quoted 18 lines · Lucas Stach

[...]

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +0 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
Quoted 7 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 3 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
    	/* Clear the FIFOs */
    	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

Quoted 2 lines

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

There are a lot of more writes with barriers to the controller slave interface in that function after clearing the FIFO. I don't see why this readback would be required.

Quoted 7 lines
Quoted 3 lines

Because you really do want to make sure the fifo is cleared before you start doing any of those other writes or configuring the controller in any way.

I still don't see the reason. What additional properties do you think the readback provides that isn't already provided by the barriers in the following writes?

See the paragraph above -- we have to make sure the writes that trigger the FIFO clearing really take place before any other writes do.

#7 lore raw

Am Samstag, dem 26.06.2021 um 20:15 +0200 schrieb Marek Vasut:

Quoted 33 lines · Lucas Stach
Quoted 32 lines

Am Dienstag, dem 22.06.2021 um 11:33 +0200 schrieb Marek Vasut:

Quoted 30 lines · Lucas Stach
Quoted 19 lines

Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut:

Quoted 18 lines · Lucas Stach

[...]

Quoted 13 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 9 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
    	/* Clear the FIFOs */
    	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

Quoted 6 lines
Quoted 2 lines

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

There are a lot of more writes with barriers to the controller slave interface in that function after clearing the FIFO. I don't see why this readback would be required.

Because you really do want to make sure the fifo is cleared before you start doing any of those other writes or configuring the controller in any way.

Quoted 6 lines
Quoted 3 lines

I still don't see the reason. What additional properties do you think the readback provides that isn't already provided by the barriers in the following writes?

See the paragraph above -- we have to make sure the writes that trigger the FIFO clearing really take place before any other writes do.

And they do, as there are write barriers prepended to the writes following the FIFO clear. The readback just lets the CPU wait until the write reached the peripheral, which I don't see a reason to do here. The ordering of the writes from the perspective of the peripheral is completely the same with or without the readback. The later writes can not overtake the FIFO clear writes due to the barriers.

I'm strongly against adding stuff because it "might have an effect", if it isn't required by architectural rules. It clutters the code and some months/years down the line nobody dares to cleanup/remove this stuff anymore, because everyone assumes that there was a good reason for adding those things.

Regards,
Lucas

author maintainer
#8 lore raw
Quoted 48 lines · Lucas Stach

Am Samstag, dem 26.06.2021 um 20:15 +0200 schrieb Marek Vasut:

Quoted 33 lines · Lucas Stach
Quoted 32 lines

Am Dienstag, dem 22.06.2021 um 11:33 +0200 schrieb Marek Vasut:

Quoted 30 lines · Lucas Stach
Quoted 19 lines

Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut:

Quoted 18 lines · Lucas Stach

[...]

Quoted 13 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 9 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
     	/* Clear the FIFOs */
     	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

Quoted 6 lines
Quoted 2 lines

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

There are a lot of more writes with barriers to the controller slave interface in that function after clearing the FIFO. I don't see why this readback would be required.

Because you really do want to make sure the fifo is cleared before you start doing any of those other writes or configuring the controller in any way.

Quoted 6 lines
Quoted 3 lines

I still don't see the reason. What additional properties do you think the readback provides that isn't already provided by the barriers in the following writes?

See the paragraph above -- we have to make sure the writes that trigger the FIFO clearing really take place before any other writes do.

And they do, as there are write barriers prepended to the writes following the FIFO clear. The readback just lets the CPU wait until the write reached the peripheral, which I don't see a reason to do here. The ordering of the writes from the perspective of the peripheral is completely the same with or without the readback. The later writes can not overtake the FIFO clear writes due to the barriers.

Quoted 5 lines

I'm strongly against adding stuff because it "might have an effect", if it isn't required by architectural rules. It clutters the code and some months/years down the line nobody dares to cleanup/remove this stuff anymore, because everyone assumes that there was a good reason for adding those things.

Since there is no RTL for any of the iMXes or their IPs, how do you propose anyone except NXP can validate what is and what is not required ?

This patch helps with a problem where I sporadically observe shifted image on boot on mx8mm.

#9 lore raw

Am Dienstag, dem 29.06.2021 um 05:04 +0200 schrieb Marek Vasut:

Quoted 55 lines · Lucas Stach
Quoted 48 lines

Am Samstag, dem 26.06.2021 um 20:15 +0200 schrieb Marek Vasut:

Quoted 33 lines · Lucas Stach
Quoted 32 lines

Am Dienstag, dem 22.06.2021 um 11:33 +0200 schrieb Marek Vasut:

Quoted 30 lines · Lucas Stach
Quoted 19 lines

Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut:

Quoted 18 lines · Lucas Stach

[...]

Quoted 13 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 9 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
     	/* Clear the FIFOs */
     	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

Quoted 6 lines
Quoted 2 lines

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

There are a lot of more writes with barriers to the controller slave interface in that function after clearing the FIFO. I don't see why this readback would be required.

Because you really do want to make sure the fifo is cleared before you start doing any of those other writes or configuring the controller in any way.

Quoted 6 lines
Quoted 3 lines

I still don't see the reason. What additional properties do you think the readback provides that isn't already provided by the barriers in the following writes?

See the paragraph above -- we have to make sure the writes that trigger the FIFO clearing really take place before any other writes do.

And they do, as there are write barriers prepended to the writes following the FIFO clear. The readback just lets the CPU wait until the write reached the peripheral, which I don't see a reason to do here. The ordering of the writes from the perspective of the peripheral is completely the same with or without the readback. The later writes can not overtake the FIFO clear writes due to the barriers.

Quoted 5 lines

I'm strongly against adding stuff because it "might have an effect", if it isn't required by architectural rules. It clutters the code and some months/years down the line nobody dares to cleanup/remove this stuff anymore, because everyone assumes that there was a good reason for adding those things.

Quoted 5 lines

Since there is no RTL for any of the iMXes or their IPs, how do you propose anyone except NXP can validate what is and what is not required ?

This patch helps with a problem where I sporadically observe shifted image on boot on mx8mm.

The order of writes to a device mapped region are defined by the ARM architecture and the AMBA bus standard, not the peripheral. I'm not saying this patch isn't needed. I'm saying the readbacks look bogus.

Have you checked that just adding the write to the REG_CLR doesn't fix your issue?

Regards,
Lucas

author maintainer
#10 lore raw
Quoted 62 lines · Lucas Stach

Am Dienstag, dem 29.06.2021 um 05:04 +0200 schrieb Marek Vasut:

Quoted 55 lines · Lucas Stach
Quoted 48 lines

Am Samstag, dem 26.06.2021 um 20:15 +0200 schrieb Marek Vasut:

Quoted 33 lines · Lucas Stach
Quoted 32 lines

Am Dienstag, dem 22.06.2021 um 11:33 +0200 schrieb Marek Vasut:

Quoted 30 lines · Lucas Stach
Quoted 19 lines

Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut:

Quoted 18 lines · Lucas Stach

[...]

Quoted 13 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 9 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
      	/* Clear the FIFOs */
      	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

Quoted 6 lines
Quoted 2 lines

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

There are a lot of more writes with barriers to the controller slave interface in that function after clearing the FIFO. I don't see why this readback would be required.

Because you really do want to make sure the fifo is cleared before you start doing any of those other writes or configuring the controller in any way.

Quoted 6 lines
Quoted 3 lines

I still don't see the reason. What additional properties do you think the readback provides that isn't already provided by the barriers in the following writes?

See the paragraph above -- we have to make sure the writes that trigger the FIFO clearing really take place before any other writes do.

And they do, as there are write barriers prepended to the writes following the FIFO clear. The readback just lets the CPU wait until the write reached the peripheral, which I don't see a reason to do here. The ordering of the writes from the perspective of the peripheral is completely the same with or without the readback. The later writes can not overtake the FIFO clear writes due to the barriers.

Quoted 5 lines

I'm strongly against adding stuff because it "might have an effect", if it isn't required by architectural rules. It clutters the code and some months/years down the line nobody dares to cleanup/remove this stuff anymore, because everyone assumes that there was a good reason for adding those things.

Quoted 5 lines

Since there is no RTL for any of the iMXes or their IPs, how do you propose anyone except NXP can validate what is and what is not required ?

This patch helps with a problem where I sporadically observe shifted image on boot on mx8mm.

Quoted 6 lines

The order of writes to a device mapped region are defined by the ARM architecture and the AMBA bus standard, not the peripheral. I'm not saying this patch isn't needed. I'm saying the readbacks look bogus.

Have you checked that just adding the write to the REG_CLR doesn't fix your issue?

No, it does not help with the issue.

Acked-by
#11 lore raw

Am Donnerstag, dem 01.07.2021 um 00:50 +0200 schrieb Marek Vasut:

Quoted 63 lines · Lucas Stach
Quoted 62 lines

Am Dienstag, dem 29.06.2021 um 05:04 +0200 schrieb Marek Vasut:

Quoted 60 lines · Lucas Stach
Quoted 48 lines

Am Samstag, dem 26.06.2021 um 20:15 +0200 schrieb Marek Vasut:

Quoted 33 lines · Lucas Stach
Quoted 32 lines

Am Dienstag, dem 22.06.2021 um 11:33 +0200 schrieb Marek Vasut:

Quoted 30 lines · Lucas Stach
Quoted 19 lines

Am Montag, dem 21.06.2021 um 18:30 +0200 schrieb Marek Vasut:

Quoted 18 lines · Lucas Stach

[...]

Quoted 13 lines

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, · line 244

Quoted 9 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
index 98d8ba0bae84..22cb749fc9bc 100644
@@ -241,6 +241,9 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb,
 
      	/* Clear the FIFOs */
      	writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
+	readl(mxsfb->base + LCDC_CTRL1);

Do you really need those readbacks? As both writes are targeting the same slave interface, the memory barrier in the clear write should push the set write.

Quoted 6 lines
Quoted 2 lines

What would push the clear write then ? We can drop one of the readl()s, but not the last one.

There are a lot of more writes with barriers to the controller slave interface in that function after clearing the FIFO. I don't see why this readback would be required.

Because you really do want to make sure the fifo is cleared before you start doing any of those other writes or configuring the controller in any way.

Quoted 6 lines
Quoted 3 lines

I still don't see the reason. What additional properties do you think the readback provides that isn't already provided by the barriers in the following writes?

See the paragraph above -- we have to make sure the writes that trigger the FIFO clearing really take place before any other writes do.

And they do, as there are write barriers prepended to the writes following the FIFO clear. The readback just lets the CPU wait until the write reached the peripheral, which I don't see a reason to do here. The ordering of the writes from the perspective of the peripheral is completely the same with or without the readback. The later writes can not overtake the FIFO clear writes due to the barriers.

Quoted 5 lines

I'm strongly against adding stuff because it "might have an effect", if it isn't required by architectural rules. It clutters the code and some months/years down the line nobody dares to cleanup/remove this stuff anymore, because everyone assumes that there was a good reason for adding those things.

Since there is no RTL for any of the iMXes or their IPs, how do you propose anyone except NXP can validate what is and what is not required ?

This patch helps with a problem where I sporadically observe shifted image on boot on mx8mm.

Quoted 8 lines
Quoted 6 lines

The order of writes to a device mapped region are defined by the ARM architecture and the AMBA bus standard, not the peripheral. I'm not saying this patch isn't needed. I'm saying the readbacks look bogus.

Have you checked that just adding the write to the REG_CLR doesn't fix your issue?

No, it does not help with the issue.

Okay, i don't want to hold up this patch over technicalities if it fixes the issue, in which case the readbacks probably provide just the right amount of delay for the FIFO clear to happen in hardware. FWIW:

Regards,
Lucas

Reviewed-by Tested-by on v1 1/1
#12 lore raw
In reply to Marek Vasut
Quoted 5 lines · Marek Vasut

Make sure the FIFO_CLEAR bit is latched in when configuring the controller, so that the FIFO is really cleared. And then clear the FIFO_CLEAR bit, since it is not self-clearing.

Quoted 8 lines
Fixes 45d59d704080 ("drm: Add new driver for MXSFB controller")
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Stefan Agner <[email protected]>

---