Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1523335 > unrolled thread

[PATCH] drm/sun4i: tcon: Initialize regmap after enabling bus clocks

Started byChen-Yu Tsai <wens@csie.org>
First post2016-11-16 10:40 +0100
Last post2016-11-18 03:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] drm/sun4i: tcon: Initialize regmap after enabling bus clocks Chen-Yu Tsai <wens@csie.org> - 2016-11-16 10:40 +0100
    Re: [PATCH] drm/sun4i: tcon: Initialize regmap after enabling bus  clocks Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-11-17 20:10 +0100
      Re: [PATCH] drm/sun4i: tcon: Initialize regmap after enabling bus clocks Chen-Yu Tsai <wens@csie.org> - 2016-11-18 03:20 +0100

#1523335 — [PATCH] drm/sun4i: tcon: Initialize regmap after enabling bus clocks

FromChen-Yu Tsai <wens@csie.org>
Date2016-11-16 10:40 +0100
Subject[PATCH] drm/sun4i: tcon: Initialize regmap after enabling bus clocks
Message-ID<sE4Rb-12s-13@gated-at.bofh.it>
If we attempt to read/write the TCON registers before the bus clock
is enabled, those accesses get ignored.

In practice this almost never occurs because U-boot had already enabled
the bus clock as part of its firmware provided framebuffer (simplefb).

Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---

I was looking around the DRM driver and noticed this sequence was off.

---
 drivers/gpu/drm/sun4i/sun4i_tcon.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
index c6afb2448655..8c2db65ea229 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
@@ -506,16 +506,16 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
 		return ret;
 	}
 
-	ret = sun4i_tcon_init_regmap(dev, tcon);
+	ret = sun4i_tcon_init_clocks(dev, tcon);
 	if (ret) {
-		dev_err(dev, "Couldn't init our TCON regmap\n");
+		dev_err(dev, "Couldn't init our TCON clocks\n");
 		goto err_assert_reset;
 	}
 
-	ret = sun4i_tcon_init_clocks(dev, tcon);
+	ret = sun4i_tcon_init_regmap(dev, tcon);
 	if (ret) {
-		dev_err(dev, "Couldn't init our TCON clocks\n");
-		goto err_assert_reset;
+		dev_err(dev, "Couldn't init our TCON regmap\n");
+		goto err_free_clocks;
 	}
 
 	ret = sun4i_tcon_init_irq(dev, tcon);
-- 
2.10.2

[toc] | [next] | [standalone]


#1524731 — Re: [PATCH] drm/sun4i: tcon: Initialize regmap after enabling bus clocks

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-11-17 20:10 +0100
SubjectRe: [PATCH] drm/sun4i: tcon: Initialize regmap after enabling bus clocks
Message-ID<sEAem-4Lb-3@gated-at.bofh.it>
In reply to#1523335

[Multipart message — attachments visible in raw view] — view raw

On Wed, Nov 16, 2016 at 05:37:32PM +0800, Chen-Yu Tsai wrote:
> If we attempt to read/write the TCON registers before the bus clock
> is enabled, those accesses get ignored.
> 
> In practice this almost never occurs because U-boot had already enabled
> the bus clock as part of its firmware provided framebuffer (simplefb).
> 
> Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
> 
> I was looking around the DRM driver and noticed this sequence was off.
> 
> ---
>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> index c6afb2448655..8c2db65ea229 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
> @@ -506,16 +506,16 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
>  		return ret;
>  	}
>  
> -	ret = sun4i_tcon_init_regmap(dev, tcon);
> +	ret = sun4i_tcon_init_clocks(dev, tcon);
>  	if (ret) {
> -		dev_err(dev, "Couldn't init our TCON regmap\n");
> +		dev_err(dev, "Couldn't init our TCON clocks\n");
>  		goto err_assert_reset;
>  	}
>  
> -	ret = sun4i_tcon_init_clocks(dev, tcon);
> +	ret = sun4i_tcon_init_regmap(dev, tcon);
>  	if (ret) {
> -		dev_err(dev, "Couldn't init our TCON clocks\n");
> -		goto err_assert_reset;
> +		dev_err(dev, "Couldn't init our TCON regmap\n");
> +		goto err_free_clocks;
>  	}

That won't work either. sun4i_tcon_init_clocks requires the regmap to
be enabled before it calls sun4i_dclk_create.

Maybe we should just move that call outside of sun4i_tcon_init_clocks
and put it directly into the bind then.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1524970

FromChen-Yu Tsai <wens@csie.org>
Date2016-11-18 03:20 +0100
Message-ID<sEGWt-MP-1@gated-at.bofh.it>
In reply to#1524731
On Fri, Nov 18, 2016 at 3:05 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> On Wed, Nov 16, 2016 at 05:37:32PM +0800, Chen-Yu Tsai wrote:
>> If we attempt to read/write the TCON registers before the bus clock
>> is enabled, those accesses get ignored.
>>
>> In practice this almost never occurs because U-boot had already enabled
>> the bus clock as part of its firmware provided framebuffer (simplefb).
>>
>> Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support")
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>
>> I was looking around the DRM driver and noticed this sequence was off.
>>
>> ---
>>  drivers/gpu/drm/sun4i/sun4i_tcon.c | 10 +++++-----
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> index c6afb2448655..8c2db65ea229 100644
>> --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
>> @@ -506,16 +506,16 @@ static int sun4i_tcon_bind(struct device *dev, struct device *master,
>>               return ret;
>>       }
>>
>> -     ret = sun4i_tcon_init_regmap(dev, tcon);
>> +     ret = sun4i_tcon_init_clocks(dev, tcon);
>>       if (ret) {
>> -             dev_err(dev, "Couldn't init our TCON regmap\n");
>> +             dev_err(dev, "Couldn't init our TCON clocks\n");
>>               goto err_assert_reset;
>>       }
>>
>> -     ret = sun4i_tcon_init_clocks(dev, tcon);
>> +     ret = sun4i_tcon_init_regmap(dev, tcon);
>>       if (ret) {
>> -             dev_err(dev, "Couldn't init our TCON clocks\n");
>> -             goto err_assert_reset;
>> +             dev_err(dev, "Couldn't init our TCON regmap\n");
>> +             goto err_free_clocks;
>>       }
>
> That won't work either. sun4i_tcon_init_clocks requires the regmap to
> be enabled before it calls sun4i_dclk_create.
>
> Maybe we should just move that call outside of sun4i_tcon_init_clocks
> and put it directly into the bind then.

That makes sense. I'll send a v2.

ChenYu

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web