All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] video: fbdev: imxfb: Provide a reset mechanism
@ 2016-01-19 13:10 Fabio Estevam
  2016-01-29 12:20 ` Tomi Valkeinen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-01-19 13:10 UTC (permalink / raw)
  To: linux-fbdev

From: Fabio Estevam <fabio.estevam@nxp.com>

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.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
---
 drivers/video/fbdev/imxfb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
index cee8860..bb2f1e8 100644
--- a/drivers/video/fbdev/imxfb.c
+++ b/drivers/video/fbdev/imxfb.c
@@ -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);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] video: fbdev: imxfb: Provide a reset mechanism
  2016-01-19 13:10 [PATCH] video: fbdev: imxfb: Provide a reset mechanism Fabio Estevam
@ 2016-01-29 12:20 ` Tomi Valkeinen
  2016-02-10 19:52 ` Fabio Estevam
  2016-02-12  7:42 ` Tomi Valkeinen
  2 siblings, 0 replies; 4+ messages in thread
From: Tomi Valkeinen @ 2016-01-29 12:20 UTC (permalink / raw)
  To: linux-fbdev

[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]



On 19/01/16 15:10, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> 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.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
> ---
>  drivers/video/fbdev/imxfb.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)

Thanks. Queued for 4.5 fixes.

 Tomi


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] video: fbdev: imxfb: Provide a reset mechanism
  2016-01-19 13:10 [PATCH] video: fbdev: imxfb: Provide a reset mechanism Fabio Estevam
  2016-01-29 12:20 ` Tomi Valkeinen
@ 2016-02-10 19:52 ` Fabio Estevam
  2016-02-12  7:42 ` Tomi Valkeinen
  2 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2016-02-10 19:52 UTC (permalink / raw)
  To: linux-fbdev

Hi Tomi,

On Fri, Jan 29, 2016 at 10:20 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
>
>
> On 19/01/16 15:10, Fabio Estevam wrote:
>> From: Fabio Estevam <fabio.estevam@nxp.com>
>>
>> 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.
>>
>> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
>> ---
>>  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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] video: fbdev: imxfb: Provide a reset mechanism
  2016-01-19 13:10 [PATCH] video: fbdev: imxfb: Provide a reset mechanism Fabio Estevam
  2016-01-29 12:20 ` Tomi Valkeinen
  2016-02-10 19:52 ` Fabio Estevam
@ 2016-02-12  7:42 ` Tomi Valkeinen
  2 siblings, 0 replies; 4+ messages in thread
From: Tomi Valkeinen @ 2016-02-12  7:42 UTC (permalink / raw)
  To: linux-fbdev

[-- Attachment #1: Type: text/plain, Size: 1661 bytes --]



On 10/02/16 21:52, Fabio Estevam wrote:
> Hi Tomi,
> 
> On Fri, Jan 29, 2016 at 10:20 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
>>
>>
>> On 19/01/16 15:10, Fabio Estevam wrote:
>>> From: Fabio Estevam <fabio.estevam@nxp.com>
>>>
>>> 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.
>>>
>>> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
>>> ---
>>>  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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-12  7:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-19 13:10 [PATCH] video: fbdev: imxfb: Provide a reset mechanism Fabio Estevam
2016-01-29 12:20 ` Tomi Valkeinen
2016-02-10 19:52 ` Fabio Estevam
2016-02-12  7:42 ` Tomi Valkeinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.