Skip to contentSkip to conversation

video: fbdev: imxfb: Provide a reset mechanism

PATCH In review Fabio Estevam 2 participants 4 messages Jan 19, 2016 – Feb 12, 2016

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 video: fbdev: imxfb: Provide a reset mechanism

From: Fabio Estevam <[email protected]>

Currently when we boot the kernel on a mx25pdk the LCDC controller does not show the Linux logo on boot.

This problem is well explained by Sascha Hauer:

"Unfortunately this LCD controller does not have an enable bit. The controller starts directly when the clocks are enabled. If the clocks are enabled when the controller is not yet programmed with proper register values then it just goes into some undefined state. What I suspect is that the clocks already were enabled before driver probe, presumably by the bootloader, so the controller is already in undefined state when entering Linux. Now by dis/enabling the ipg clock you effectively reset the controller. Since you have programmed it with valid register values in the mean time it starts working after this reset."

So do as suggested and force a reset of the LCDC hardware by enabling and disabling the IPG clock.

With this change the Linux logo can be seen on boot on a mx25pdk.

---
 drivers/video/fbdev/imxfb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/video/fbdev/imxfb.c +15 -0
index cee8860..bb2f1e8 100644
@@ -902,6 +902,21 @@ static int imxfb_probe(struct platform_device *pdev)
 		goto failed_getclock;
 	}
 
+	/*
+	 * The LCDC controller does not have an enable bit. The
+	 * controller starts directly when the clocks are enabled.
+	 * If the clocks are enabled when the controller is not yet
+	 * programmed with proper register values (enabled at the
+	 * bootloader, for example) then it just goes into some undefined
+	 * state.
+	 * To avoid this issue, let's enable and disable LCDC IPG clock
+	 * so that we force some kind of 'reset' to the LCDC block.
+	 */
+	ret = clk_prepare_enable(fbi->clk_ipg);
+	if (ret)
+		goto failed_getclock;
+	clk_disable_unprepare(fbi->clk_ipg);
+
 	fbi->clk_ahb = devm_clk_get(&pdev->dev, "ahb");
 	if (IS_ERR(fbi->clk_ahb)) {
 		ret = PTR_ERR(fbi->clk_ahb);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 21 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently when we boot the kernel on a mx25pdk the LCDC controller does not show the Linux logo on boot.

This problem is well explained by Sascha Hauer:

"Unfortunately this LCD controller does not have an enable bit. The controller starts directly when the clocks are enabled. If the clocks are enabled when the controller is not yet programmed with proper register values then it just goes into some undefined state. What I suspect is that the clocks already were enabled before driver probe, presumably by the bootloader, so the controller is already in undefined state when entering Linux. Now by dis/enabling the ipg clock you effectively reset the controller. Since you have programmed it with valid register values in the mean time it starts working after this reset."

So do as suggested and force a reset of the LCDC hardware by enabling and disabling the IPG clock.

Quoted 6 lines

With this change the Linux logo can be seen on boot on a mx25pdk.

---
 drivers/video/fbdev/imxfb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Thanks. Queued for 4.5 fixes.

Tomi

author reviewer
#2 lore raw
In reply to Fabio Estevam

Hi Tomi,

Quoted 24 lines · Tomi Valkeinen
Quoted 21 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently when we boot the kernel on a mx25pdk the LCDC controller does not show the Linux logo on boot.

This problem is well explained by Sascha Hauer:

"Unfortunately this LCD controller does not have an enable bit. The controller starts directly when the clocks are enabled. If the clocks are enabled when the controller is not yet programmed with proper register values then it just goes into some undefined state. What I suspect is that the clocks already were enabled before driver probe, presumably by the bootloader, so the controller is already in undefined state when entering Linux. Now by dis/enabling the ipg clock you effectively reset the controller. Since you have programmed it with valid register values in the mean time it starts working after this reset."

So do as suggested and force a reset of the LCDC hardware by enabling and disabling the IPG clock.

Quoted 8 lines
Quoted 6 lines

With this change the Linux logo can be seen on boot on a mx25pdk.

---
 drivers/video/fbdev/imxfb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Thanks. Queued for 4.5 fixes.

Still don't see this one applied in Linus nor linux-next tree yet.

#3 lore raw
In reply to Fabio Estevam
Quoted 29 lines · Fabio Estevam

Hi Tomi,

Quoted 26 lines · Tomi Valkeinen
Quoted 23 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Currently when we boot the kernel on a mx25pdk the LCDC controller does not show the Linux logo on boot.

This problem is well explained by Sascha Hauer:

"Unfortunately this LCD controller does not have an enable bit. The controller starts directly when the clocks are enabled. If the clocks are enabled when the controller is not yet programmed with proper register values then it just goes into some undefined state. What I suspect is that the clocks already were enabled before driver probe, presumably by the bootloader, so the controller is already in undefined state when entering Linux. Now by dis/enabling the ipg clock you effectively reset the controller. Since you have programmed it with valid register values in the mean time it starts working after this reset."

So do as suggested and force a reset of the LCDC hardware by enabling and disabling the IPG clock.

With this change the Linux logo can be seen on boot on a mx25pdk.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
---
 drivers/video/fbdev/imxfb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Thanks. Queued for 4.5 fixes.

Still don't see this one applied in Linus nor linux-next tree yet.

I've been a bit preoccupied, but I hope I get to send the pull request today.

Tomi