From patchwork Tue Mar 28 08:11:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emiliano Ingrassia X-Patchwork-Id: 9648309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 09879601E9 for ; Tue, 28 Mar 2017 08:11:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF571271CB for ; Tue, 28 Mar 2017 08:11:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3D7627F9F; Tue, 28 Mar 2017 08:11:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71684271CB for ; Tue, 28 Mar 2017 08:11:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0402389E65; Tue, 28 Mar 2017 08:11:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6611289E65 for ; Tue, 28 Mar 2017 08:11:36 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id u18so707103wrc.0 for ; Tue, 28 Mar 2017 01:11:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=c6NrQWMsG5NnSchDUd1bxPMUI6odtGUiUgwnU6gsufU=; b=DCDb3nC6W+8/UWDJOQHWa+waII4T2GZ264GWBE2PtkWuuyYvBqUQMvZ3F88O01/8Ak Twagp8sIuI1Bzknw89cwnB+KOm+IDlApEioRNoiWHYmh+a3Re9NiUQrTikh8p7QQGWHn Ni7cCCX02lKxMrUIuIZyenSz17pbdIxUKoyTjuaaFNTLIp19ziM3D5u27wcjNubGazq6 AtvevuuZ3lNJwSU9HfOlwFy1bDdA+WswR6Fu0QjbU/sp40OnFruHxRqpOBzg17A8lnEX MKwcupkDp0lupzMN8UhK0jxHjibMSe4fSRkhaHIn6BYaU8EnzoUv06xTBKz/kDQ65vzC CrwQ== X-Gm-Message-State: AFeK/H2Pi0rP5B/y7UQYsf3ph/WYn71Z8hRmI+Rt7/c+YrVVMhu6aPeMoSV8mqcLVKtvdA== X-Received: by 10.28.152.11 with SMTP id a11mr13275483wme.64.1490688695034; Tue, 28 Mar 2017 01:11:35 -0700 (PDT) Received: from ingrassia.epigenesys.com (93-63-241-174.ip30.fastwebnet.it. [93.63.241.174]) by smtp.gmail.com with ESMTPSA id h76sm2516318wmd.33.2017.03.28.01.11.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 01:11:34 -0700 (PDT) Date: Tue, 28 Mar 2017 10:11:31 +0200 From: Emiliano Ingrassia To: Jyri Sarha Subject: [PATCH] drm/tilcdc: do the complete reset sequence if the LCDC is enabled Message-ID: <20170328081131.GA3585@ingrassia.epigenesys.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.2 (2016-11-26) Cc: Tomi Valkeinen , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP If the LCD controller was already enabled (e.g. by the bootloader), do the complete software reset sequence to avoid time out while loading the palette and a consequent time out waiting for vblank. Signed-off-by: Emiliano Ingrassia --- drivers/gpu/drm/tilcdc/tilcdc_crtc.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c index 3621ff42979f..589156b2f76c 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_crtc.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_crtc.c @@ -208,10 +208,33 @@ static void reset(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; struct tilcdc_drm_private *priv = dev->dev_private; + struct tilcdc_crtc *tilcdc_crtc = to_tilcdc_crtc(crtc); + int ret; if (priv->rev != 2) return; + /* + * If the LCDC was already enabled (e.g. by the bootloader) + * do the complete software reset sequence. + */ + if (tilcdc_read(dev, LCDC_RASTER_CTRL_REG) & LCDC_RASTER_ENABLE) { + + /* Enable DMA Frame Done Interrupt */ + tilcdc_write(dev, LCDC_INT_ENABLE_SET_REG, LCDC_FRAME_DONE); + tilcdc_clear_irqstatus(dev, 0xffffffff); + + tilcdc_crtc->frame_done = false; + tilcdc_clear(dev, LCDC_RASTER_CTRL_REG, LCDC_RASTER_ENABLE); + + ret = wait_event_timeout(tilcdc_crtc->frame_done_wq, + tilcdc_crtc->frame_done, + msecs_to_jiffies(500)); + if (ret == 0) + dev_err(dev->dev, "%s: timeout waiting for framedone while resetting LCDC\n", + __func__); + } + tilcdc_set(dev, LCDC_CLK_RESET_REG, LCDC_CLK_MAIN_RESET); usleep_range(250, 1000); tilcdc_clear(dev, LCDC_CLK_RESET_REG, LCDC_CLK_MAIN_RESET);