Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933143AbcCHQuN (ORCPT ); Tue, 8 Mar 2016 11:50:13 -0500 Received: from ring0.de ([5.45.101.7]:33574 "EHLO ring0.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932144AbcCHQuD (ORCPT ); Tue, 8 Mar 2016 11:50:03 -0500 X-Greylist: delayed 584 seconds by postgrey-1.27 at vger.kernel.org; Tue, 08 Mar 2016 11:50:03 EST X-Spam-Report: * 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. * See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block * for more information. * [URIs: ti.com] * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail * domains are different * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] From: Sebastian Reichel To: Sebastian Reichel , Tony Lindgren , Aaro Koskinen , Tomi Valkeinen Cc: Laurent Pinchart , David Airlie , linux-omap@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/23] drm: omapdrm: dss: reset dsi module during initialization Date: Tue, 8 Mar 2016 17:39:35 +0100 Message-Id: <1457455195-1938-4-git-send-email-sre@kernel.org> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457455195-1938-1-git-send-email-sre@kernel.org> References: <1457455195-1938-1-git-send-email-sre@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1570 Lines: 57 From: Tomi Valkeinen The Nokia N950's bootloader leaves the DSI module in a non-working state. Work around this by resetting the DSI module before using it. Signed-off-By: Tomi Valkeinen Reviewed-By: Sebastian Reichel Tested-By: Sebastian Reichel --- drivers/gpu/drm/omapdrm/dss/dsi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c index 43be4b2a7b05..363a61e6aca7 100644 --- a/drivers/gpu/drm/omapdrm/dss/dsi.c +++ b/drivers/gpu/drm/omapdrm/dss/dsi.c @@ -5274,6 +5274,28 @@ static int dsi_init_pll_data(struct platform_device *dsidev) return 0; } +static int _dsi_wait_reset(struct platform_device *dsidev) +{ + int t = 0; + + while (REG_GET(dsidev, DSI_SYSSTATUS, 0, 0) == 0) { + if (++t > 5) { + DSSERR("soft reset failed\n"); + return -ENODEV; + } + udelay(1); + } + + return 0; +} + +static int _dsi_reset(struct platform_device *dsidev) +{ + /* Soft reset */ + dsi_write_reg(dsidev, DSI_SYSCONFIG, 0x2); + return _dsi_wait_reset(dsidev); +} + /* DSI1 HW IP initialisation */ static int dsi_bind(struct device *dev, struct device *master, void *data) { @@ -5432,6 +5454,8 @@ static int dsi_bind(struct device *dev, struct device *master, void *data) if (r) goto err_runtime_get; + _dsi_reset(dsidev); + rev = dsi_read_reg(dsidev, DSI_REVISION); dev_dbg(&dsidev->dev, "OMAP DSI rev %d.%d\n", FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); -- 2.7.0