From patchwork Thu Sep 28 11:36:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 13402848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6674FE732C5 for ; Thu, 28 Sep 2023 11:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Wy/Lu6e1tL7CTBhgGtp9xYQ+bMCGtNUUEXmCsDGXUds=; b=LvDithKliJ+T5Y Wn8sRdqDFFSKqGQGwqkKlN6MC2uiVcOjnhhEVGXJp4Y8M+b2fC7ni3Py3dkA/6kaurRPbJqrEFsP/ 4YpcQqPG2YKQUs+4i4hujhzUPIkQCGbTywYZSOfmmaZ172Qy6ZZ7gR+lbtcGChA2E+2YgnVKD9GG1 KCDNtti9VEpAMD7W5eVMrGw5dvIgSU3xWyYsqVQTOjU/cB80tksfZ6O3OzmdzRXN2Ws5SUavi7Ice e78npAbyyYrptSxYwmxfiHT6ABX1jYHBVY0WfJSosuESHND1eVZlgt53b1T6/6ADqMOToeG0mtjcW mwX9JHXNRTYOqSD51/8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qlpKE-003H31-2T; Thu, 28 Sep 2023 11:36:58 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qlpJr-003GhO-01 for linux-arm-kernel@lists.infradead.org; Thu, 28 Sep 2023 11:36:37 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qlpJm-0001s0-1z; Thu, 28 Sep 2023 13:36:30 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1qlpJl-009Z8S-KS; Thu, 28 Sep 2023 13:36:29 +0200 From: Lucas Stach To: Marek Vasut , Liu Ying Cc: Pengutronix Kernel Team , NXP Linux Team , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, patchwork-lst@pengutronix.de Subject: [PATCH v3 3/8] drm: lcdif: enable DMA before display Date: Thu, 28 Sep 2023 13:36:24 +0200 Message-Id: <20230928113629.103188-3-l.stach@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230928113629.103188-1-l.stach@pengutronix.de> References: <20230928113629.103188-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230928_043635_080345_824C8303 X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Otherwise the DMA enable races with the fetch start, which causes wrong or no data to be scanned out on the first frame. Also there is no point in waiting for the DMA disable when the controller is going to shut down. Simply disable the display first so no further fetches are triggered and then shut down DMA. Signed-off-by: Lucas Stach --- v3: new patch --- drivers/gpu/drm/mxsfb/lcdif_kms.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/mxsfb/lcdif_kms.c b/drivers/gpu/drm/mxsfb/lcdif_kms.c index e277592e5fa5..6a292f4b332b 100644 --- a/drivers/gpu/drm/mxsfb/lcdif_kms.c +++ b/drivers/gpu/drm/mxsfb/lcdif_kms.c @@ -358,34 +358,27 @@ static void lcdif_enable_controller(struct lcdif_drm_private *lcdif) writel(INT_ENABLE_D1_PLANE_PANIC_EN, lcdif->base + LCDC_V8_INT_ENABLE_D1); - reg = readl(lcdif->base + LCDC_V8_DISP_PARA); - reg |= DISP_PARA_DISP_ON; - writel(reg, lcdif->base + LCDC_V8_DISP_PARA); - reg = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5); reg |= CTRLDESCL0_5_EN; writel(reg, lcdif->base + LCDC_V8_CTRLDESCL0_5); + + reg = readl(lcdif->base + LCDC_V8_DISP_PARA); + reg |= DISP_PARA_DISP_ON; + writel(reg, lcdif->base + LCDC_V8_DISP_PARA); } static void lcdif_disable_controller(struct lcdif_drm_private *lcdif) { u32 reg; - int ret; - - reg = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5); - reg &= ~CTRLDESCL0_5_EN; - writel(reg, lcdif->base + LCDC_V8_CTRLDESCL0_5); - - ret = readl_poll_timeout(lcdif->base + LCDC_V8_CTRLDESCL0_5, - reg, !(reg & CTRLDESCL0_5_EN), - 0, 36000); /* Wait ~2 frame times max */ - if (ret) - drm_err(lcdif->drm, "Failed to disable controller!\n"); reg = readl(lcdif->base + LCDC_V8_DISP_PARA); reg &= ~DISP_PARA_DISP_ON; writel(reg, lcdif->base + LCDC_V8_DISP_PARA); + reg = readl(lcdif->base + LCDC_V8_CTRLDESCL0_5); + reg &= ~CTRLDESCL0_5_EN; + writel(reg, lcdif->base + LCDC_V8_CTRLDESCL0_5); + /* Disable FIFO Panic NoC priority booster. */ writel(0, lcdif->base + LCDC_V8_INT_ENABLE_D1); }