Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp640840ybl; Wed, 21 Aug 2019 03:20:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPknX19Ovr6yToSxpwkCfNZCDIBzXW4GyVrgVaFyoRZpdZZxdbRdTCOLjQyZZP37/dtMXQ X-Received: by 2002:aa7:98da:: with SMTP id e26mr34766716pfm.34.1566382838565; Wed, 21 Aug 2019 03:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566382838; cv=none; d=google.com; s=arc-20160816; b=QWQb2r5kYmLgZ0vsECW2FCun3VRZ1Hq79yNBC3JABPgzPXaLUA9paERW+aMUgVpsTo B044iuLXEAXHo/Pbsbx6FZinHUzMdIsqnugpM/LVzVMSr1cvnEj8BQ0zFq0kCVuw7Mpy c8Kv8xUkqRG+nWF4y1JXHFeNRuG6kYMR9dOOr2JcPMxpt5pxP2EWsswCDiupCqKYnL5M 9fYg+ZDws/nWwVy2g+O/Ct/XewxPWZ+7qeZ1kBm+Wlpa/nRk6BKHoLoZLH86qiNWPah0 3X0x6I3Uqyg2LkhLKyZ6lk9q5fEakdC0um26cOQC9QEV8Iev1ZfDn885PiR+gm/F8fWG Xpkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=nG9AL+TZlWnk7MV7lmORwvTaPQ+rBY4+z36ZvgF7d2A=; b=mVpmpzd4bAbwl9zL2sxCf5yAfnoc9VvuQTlVisyGiairEDNlemJ2Mtw3LLYyS7gA/D QxQgnY7HRjh06qtRqA6nTVK6MlIcLqLHyfzSA44ULt1O36ktWjJanKCUpk3tlpWBOHfN NU7TaKQgKTcO2FgKRW/jmzSwhtxbsYHTtQtf9NpDPS+mGETuCY6AoyyuJcgtXu9Xcow+ KqALmSAhaomuxjEdoj2TFkEKx9bsL9Jrnma8G7M8MPBdnCikewi1HdDI7JTGgywoHKZ8 c6NYFaDooa2tk5O0CSeoMcNw3F4cKWqeBJ+3SHfGrbLbBeDkcRgQucFLVnOxJwaQvoZY X4Nw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 94si12050168plc.407.2019.08.21.03.19.53; Wed, 21 Aug 2019 03:20:38 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbfHUKRP (ORCPT + 99 others); Wed, 21 Aug 2019 06:17:15 -0400 Received: from inva020.nxp.com ([92.121.34.13]:44618 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfHUKQU (ORCPT ); Wed, 21 Aug 2019 06:16:20 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 15C6D1A02E7; Wed, 21 Aug 2019 12:16:19 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0888E1A01DF; Wed, 21 Aug 2019 12:16:19 +0200 (CEST) Received: from fsr-ub1664-120.ea.freescale.net (fsr-ub1664-120.ea.freescale.net [10.171.82.81]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 595C220612; Wed, 21 Aug 2019 12:16:18 +0200 (CEST) From: Robert Chiras To: =?UTF-8?q?Guido=20G=C3=BCnther?= , Marek Vasut , Stefan Agner , David Airlie , Daniel Vetter , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Fabio Estevam Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 04/15] drm/mxsfb: Reset vital registers for a proper initialization Date: Wed, 21 Aug 2019 13:15:44 +0300 Message-Id: <1566382555-12102-5-git-send-email-robert.chiras@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1566382555-12102-1-git-send-email-robert.chiras@nxp.com> References: <1566382555-12102-1-git-send-email-robert.chiras@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some of the registers, like LCDC_CTRL, CTRL2_OUTSTANDING_REQS and CTRL1_RECOVERY_ON_UNDERFLOW needs to be properly cleared/initialized for a better start and stop routine. Signed-off-by: Robert Chiras --- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c index b69ace8..5e44f57 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c @@ -127,6 +127,10 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb) clk_prepare_enable(mxsfb->clk_disp_axi); clk_prepare_enable(mxsfb->clk); + if (mxsfb->devdata->ipversion >= 4) + writel(CTRL2_OUTSTANDING_REQS(REQ_16), + mxsfb->base + LCDC_V4_CTRL2 + REG_SET); + /* If it was disabled, re-enable the mode again */ writel(CTRL_DOTCLK_MODE, mxsfb->base + LCDC_CTRL + REG_SET); @@ -136,12 +140,19 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb) writel(reg, mxsfb->base + LCDC_VDCTRL4); writel(CTRL_RUN, mxsfb->base + LCDC_CTRL + REG_SET); + writel(CTRL1_RECOVERY_ON_UNDERFLOW, mxsfb->base + LCDC_CTRL1 + REG_SET); } static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb) { u32 reg; + if (mxsfb->devdata->ipversion >= 4) + writel(CTRL2_OUTSTANDING_REQS(0x7), + mxsfb->base + LCDC_V4_CTRL2 + REG_CLR); + + writel(CTRL_RUN, mxsfb->base + LCDC_CTRL + REG_CLR); + /* * Even if we disable the controller here, it will still continue * until its FIFOs are running out of data @@ -295,6 +306,7 @@ void mxsfb_crtc_enable(struct mxsfb_drm_private *mxsfb) dma_addr_t paddr; mxsfb_enable_axi_clk(mxsfb); + writel(0, mxsfb->base + LCDC_CTRL); mxsfb_crtc_mode_set_nofb(mxsfb); /* Write cur_buf as well to avoid an initial corrupt frame */ -- 2.7.4