From: Maxime Ripard Subject: Re: [PATCH] drm/sun4i: tcon: Initialize regmap after enabling bus clocks Date: Thu, 17 Nov 2016 20:05:01 +0100 Message-ID: <20161117190501.hjpwposqzidwhwdc@lukather> References: <20161116093732.12828-1-wens@csie.org> <20161116093732.12828-2-wens@csie.org> Reply-To: maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xtxjraet2xxibjjj" Return-path: Sender: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Content-Disposition: inline In-Reply-To: <20161116093732.12828-2-wens-jdAy2FN1RRM@public.gmane.org> List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , To: Chen-Yu Tsai Cc: David Airlie , linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: dri-devel@lists.freedesktop.org --xtxjraet2xxibjjj Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline 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 > --- > > 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 --xtxjraet2xxibjjj--