Received: by 10.213.65.68 with SMTP id h4csp39291imn; Mon, 19 Mar 2018 18:50:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELvdZwzGGOFbqk0Pxon4A5BZY432FE+1SBJJHTLBtOY8kMVgVMTowqEjJ+WpbPKlQE+rtdDB X-Received: by 10.99.140.8 with SMTP id m8mr10956259pgd.320.1521510601920; Mon, 19 Mar 2018 18:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510601; cv=none; d=google.com; s=arc-20160816; b=U7RKDOnVDlUR2c0BTzeSicOjqZtJs1FSh7SxwsbdDwQgSwPdc8b+u9Lv9XvY7/XUa8 290Wwgg87BAl3sSdVC9aDhJTDhAQ1ccUMEkez9bhsgbwYSYLhpOeTIlgK5daUpZgOuip 6XG7cAbnFg73FNsOgvcIPBHaULqE5eJ1q9gBgjdrEQWMAJVrxS6ZvhqMP4Sm8L4LqDeJ kGi1w9exzHD3sAv5UrrKQHAdUYXvIMt1NzujPKqe6OjtRqu7fJuflgX2Nx5IK+6sK6Cx E57RshbfQ4kr9xH45vTVYxq8AkQgyv1gJCITgsK+3dcx9BgZXAl2Zzcn9h/38uLLySgU jj+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=NGaDjAoY/bx14iyI9Z2HYdOBJfnWy714SdrZ1884hzQ=; b=GOOYOHkRJPrV0xKd4raSuxE4IFgcX8P9QhSdgziYpW/v4RahaLFiFHWK81JIBQDBfH XGprBFdw9mTIB81lkVWrwT2OzkIN33g0R68bBtbKfxtIA39KaMS4XcP7ban2Ni3QBTBM 6/2wgE8S/SXrcv0cIcTl0Pd2f1Rwzrapsiq+ugPq7BrakylOR0McJVl6+UOC+Y4Y97/v ZMNI6RVK+Q9VXjD/8ZQQhxJQV3tzuZBWjw3pOjtPjMCrUYKJWlTsYX7gIiNwh7LknaYh fHUh5LC8F6vnEot6jZni4ceBhO/6N4AxeRlYkRDX32zfTha0iNVN9eJnbFJTYWd9Iqb0 VafQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z10si389138pgz.781.2018.03.19.18.49.48; Mon, 19 Mar 2018 18:50:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031090AbeCSUA5 (ORCPT + 99 others); Mon, 19 Mar 2018 16:00:57 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46552 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969327AbeCSSSa (ORCPT ); Mon, 19 Mar 2018 14:18:30 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 23887E02; Mon, 19 Mar 2018 18:18:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Maxime Ripard , Sasha Levin Subject: [PATCH 4.9 016/241] drm/sun4i: Fix TCON clock and regmap initialization sequence Date: Mon, 19 Mar 2018 19:04:41 +0100 Message-Id: <20180319180751.842712764@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen-Yu Tsai [ Upstream commit 4c7f16d14a33a9cfb4af9cb780d8a73bcca64a92 ] The TCON driver calls sun4i_tcon_init_regmap and sun4i_tcon_init_clocks in its bind function. The former creates a regmap and writes to several register to clear its configuration to a known default. The latter initializes various clocks. This includes enabling the bus clock for register access and creating the dotclock. In order for the first step's writes to work, the bus clock must be enabled which is done in the second step. but the dotclock's ops use the regmap created in the first step. Rearrange the function calls such that the clocks are initialized before the regmap, and split out the dot clock creation to after the regmap is initialized. Fixes: 9026e0d122ac ("drm: Add Allwinner A10 Display Engine support") Signed-off-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -336,12 +336,11 @@ static int sun4i_tcon_init_clocks(struct } } - return sun4i_dclk_create(dev, tcon); + return 0; } static void sun4i_tcon_free_clocks(struct sun4i_tcon *tcon) { - sun4i_dclk_free(tcon); clk_disable_unprepare(tcon->clk); } @@ -506,22 +505,28 @@ static int sun4i_tcon_bind(struct device return ret; } + ret = sun4i_tcon_init_clocks(dev, tcon); + if (ret) { + dev_err(dev, "Couldn't init our TCON clocks\n"); + goto err_assert_reset; + } + ret = sun4i_tcon_init_regmap(dev, tcon); if (ret) { dev_err(dev, "Couldn't init our TCON regmap\n"); - goto err_assert_reset; + goto err_free_clocks; } - ret = sun4i_tcon_init_clocks(dev, tcon); + ret = sun4i_dclk_create(dev, tcon); if (ret) { - dev_err(dev, "Couldn't init our TCON clocks\n"); - goto err_assert_reset; + dev_err(dev, "Couldn't create our TCON dot clock\n"); + goto err_free_clocks; } ret = sun4i_tcon_init_irq(dev, tcon); if (ret) { dev_err(dev, "Couldn't init our TCON interrupts\n"); - goto err_free_clocks; + goto err_free_dotclock; } ret = sun4i_rgb_init(drm); @@ -530,6 +535,8 @@ static int sun4i_tcon_bind(struct device return 0; +err_free_dotclock: + sun4i_dclk_free(tcon); err_free_clocks: sun4i_tcon_free_clocks(tcon); err_assert_reset: @@ -542,6 +549,7 @@ static void sun4i_tcon_unbind(struct dev { struct sun4i_tcon *tcon = dev_get_drvdata(dev); + sun4i_dclk_free(tcon); sun4i_tcon_free_clocks(tcon); }