From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752544AbcFBDL4 (ORCPT ); Wed, 1 Jun 2016 23:11:56 -0400 Received: from lucky1.263xmail.com ([211.157.147.131]:45316 "EHLO lucky1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752112AbcFBDLy (ORCPT ); Wed, 1 Jun 2016 23:11:54 -0400 X-263anti-spam: KSV:0; X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 X-RL-SENDER: ykk@rock-chips.com X-FST-TO: linux-rockchip@lists.infradead.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: ykk@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 Subject: Re: [PATCH] drm/rockchip: vop: do axi reset in vop initial time To: Thierry Reding References: <1464772752-9808-1-git-send-email-ykk@rock-chips.com> <20160601151956.GA29316@ulmo.ba.sec> Cc: Mark Yao , Heiko Stuebner , tfiga@chromium.org, David Airlie , daniel.vetter@ffwll.ch, dianders@chromium.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org From: Yakir Yang Message-ID: <574FA3ED.3000107@rock-chips.com> Date: Thu, 2 Jun 2016 11:11:41 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20160601151956.GA29316@ulmo.ba.sec> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/01/2016 11:19 PM, Thierry Reding wrote: > On Wed, Jun 01, 2016 at 05:19:12PM +0800, Yakir Yang wrote: >> There is a bug in RK3399 VOP, when bootloader/kernel only enable >> VOP Big or VOP Little to display, then VOP IOMMU would failed to >> reset at the initial time and VOP register couldn't write rightly. >> >> After do the pure reset of VOP module, then things back to right. >> >> Signed-off-by: Yakir Yang >> --- >> drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 15 ++++++++++++++- >> 1 file changed, 14 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c >> index 1c4d5b5..4150323 100644 >> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c >> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c >> @@ -1292,7 +1292,7 @@ static int vop_initial(struct vop *vop) >> { >> const struct vop_data *vop_data = vop->data; >> const struct vop_reg_data *init_table = vop_data->init_table; >> - struct reset_control *ahb_rst; >> + struct reset_control *ahb_rst, *axi_rst; >> int i, ret; >> >> vop->hclk = devm_clk_get(vop->dev, "hclk_vop"); >> @@ -1331,6 +1331,19 @@ static int vop_initial(struct vop *vop) >> } >> >> /* >> + * do aclk_reset, reset all vop registers. >> + */ >> + axi_rst = devm_reset_control_get(vop->dev, "axi"); > I don't think you want the managed version here since you only store > this in a local variable and hence aren't going to need it afterwards. > Just use reset_control_get() and ... Great, but seems Mark would not accept this fix now :( Maybe I should found the root cause why my bootloader/kernel would broken the VOP. Thanks, - Yakir >> + if (IS_ERR(axi_rst)) { >> + dev_err(vop->dev, "failed to get axi reset\n"); >> + ret = PTR_ERR(axi_rst); >> + goto err_disable_aclk; >> + } >> + reset_control_assert(axi_rst); >> + usleep_range(10, 20); >> + reset_control_deassert(axi_rst); > call reset_control_put() here. > >> + >> + /* >> * do hclk_reset, reset all vop registers. >> */ >> ahb_rst = devm_reset_control_get(vop->dev, "ahb"); > This uses the same pattern, so you might want to consider reworking this > as well, though it should be a separate patch. > > Thierry