Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1129605lqo; Sat, 11 May 2024 08:31:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVplj7NlV/FElyIzTPj3PfkEh16gsgmIZtlm+6Zn1QyEkCytUZELZzsCRQ8T9W7+TRAFEygAbopvftqD0rY8Xp2GCr/n8TVlTmAhX4sUw== X-Google-Smtp-Source: AGHT+IGpJ7xzdVNRSUKSjFV8KDOjA/hY1ZB+AnyZW15Xhb/uWwX7TBijX6xI5gdZCgblXX+3hGDC X-Received: by 2002:a17:902:9896:b0:1e5:1158:74f6 with SMTP id d9443c01a7336-1ef4404e0bamr66464555ad.66.1715441514253; Sat, 11 May 2024 08:31:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715441514; cv=pass; d=google.com; s=arc-20160816; b=pIgStKhJDfCIVREnzUJMwCcfHX9PmGc8pyg9Cov8h8SsnKjHa6LEUZQuVQ5ysrvSsG v+0kuK2ieY9XC+LyhAYpACSBroEWfZBkAYjPYC1eEqbd19RNuQYNE/q23yeOVTfDINhl MKwfp/yXET27bvgvIx/rCxUDHI8hRDKQIavP/N/9/t1bv9UqXfzIquhoIKu0nXhtBCem e7ze6TZc0peA0uNHTbPRuV7U/8bGJHGmHLM4RvsotcNpZRGUQ8t42gITZewYY7yjgFvi VKWixK1ICCvb3kWpNjKmxYqxUh2MPFwr49sbI3yKkUwHjN9BvFxldz4XuS+KQ+zDOIKt /c+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=x/pvU5rR0a3PNbNa2MowlDacRschbmWjyicuIb3k5Qc=; fh=S9bpg2GSVUyHrOpz7OrTZKhBuXBWSWpC7FsdxUCOuBM=; b=EAesiV3SMGw0OpwEngulI4Est8fcUY914ef0bv8Gvybk+vj8MOn1Ox4bVpzK7rt5+A lbS5W3aw/NL7ic4KwPQ8OwnQ6uajCvjD5GmH/JdXD4X7Yeb7vNjm9Np7IxCDsb75PLe9 Nlc8aCqGWrMJroPUZB6QiSj0YtXP6aqjfA9HeEJliLuaQ5Sr36btGYNjbOe8F/s1hMQ4 K18lnSYnqNVuLt2m4Kqpk5JIjSc7NDKEJk1+WhlT3ybYjY2MPz+MSzI1YPRb9QpgXhCF bIwmW9G/WOpBwkX+uhJW1uMNpRXNGqO1mYiZOtLZoSvxCGUI/aG9vYq3/38/mgxKF/3S FmZg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=D4yJdfVN; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-176605-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176605-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c038b52si55182655ad.352.2024.05.11.08.31.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 May 2024 08:31:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176605-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=D4yJdfVN; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-176605-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176605-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 397F5B2104D for ; Sat, 11 May 2024 15:31:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DB2056773; Sat, 11 May 2024 15:31:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="D4yJdfVN" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B457756459 for ; Sat, 11 May 2024 15:31:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715441489; cv=none; b=evWIUtVUobtI76GlrMlEuhjhDi6K18wxu1zrIbKhdp9x19vWZ+N3LM+HY+pjQacfrUMXNK8wZXw7Q1bU4UVCyeY5Gevl2inKyWm+nFfhVKoCPnBhJXiyLiEe/1b0wZjSlfGZ8FyUuJqsneJ2T3hLZScN3bKUZP2RZtpCDNnkLnY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715441489; c=relaxed/simple; bh=aJLlP1xZGilRbOMuDf2KpXBdUG4Gs4qkD3DCEsbueRU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MsGdu/gfla89HSfeQUxkpVnOFRmX9KHTsLoh4/2yyvmlWfdujBn5Eo1/rFqDSEz+6wlDykWRtjYXKpDwMEAgR6RnitvXJzRZoJsvQPljaz4NXevuKtcq2waTv+GeSBZ52SsdftRUvY+XVCNkGrAf0jAuPsiZ+CsDD1KxEJMWYQg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=D4yJdfVN; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44BFUvP3024724; Sat, 11 May 2024 10:30:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1715441457; bh=x/pvU5rR0a3PNbNa2MowlDacRschbmWjyicuIb3k5Qc=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=D4yJdfVNoOsDAST3X8/k681dqr6pl4zCwa663i28WiPgjS8YjKANqeaqmguc0LhXG jzm+zJWUEHGTPT+l652HyrRI9Cyx5MmpEHOFxekTG3NSNBjZDURKbBhblrv+daf3// V7/+1FATVrF6tce7oBuRqSLhleolHaM/6BGK2jL4= Received: from DFLE106.ent.ti.com (dfle106.ent.ti.com [10.64.6.27]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44BFUvYj033016 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 11 May 2024 10:30:57 -0500 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE106.ent.ti.com (10.64.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Sat, 11 May 2024 10:30:57 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Sat, 11 May 2024 10:30:57 -0500 Received: from localhost (uda0496377.dhcp.ti.com [172.24.227.31]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44BFUut8043225; Sat, 11 May 2024 10:30:57 -0500 From: Aradhya Bhatia To: Tomi Valkeinen , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Jyri Sarha , Thomas Zimmermann , David Airlie , Daniel Vetter CC: DRI Development List , Linux Kernel List , Sam Ravnborg , Thierry Reding , Kieran Bingham , Boris Brezillon , Nishanth Menon , Vignesh Raghavendra , Praneeth Bajjuri , Udit Kumar , Devarsh Thakkar , Jayesh Choudhary , Jai Luthra , Aradhya Bhatia Subject: [PATCH 3/7] drm/bridge: cdns-dsi: Wait for Clk and Data Lanes to be ready Date: Sat, 11 May 2024 21:00:47 +0530 Message-ID: <20240511153051.1355825-4-a-bhatia1@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240511153051.1355825-1-a-bhatia1@ti.com> References: <20240511153051.1355825-1-a-bhatia1@ti.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Once the DSI Link and DSI Phy are initialized, the code needs to wait for Clk and Data Lanes to be ready, before continuing configuration. This is in accordance with the DSI Start-up procedure, found in the Technical Reference Manual of Texas Instrument's J721E SoC[0] which houses this DSI TX controller. If the previous bridge (or crtc/encoder) are configured pre-maturely, the input signal FIFO gets corrupt. This introduces a color-shift on the display. Allow the driver to wait for the clk and data lanes to get ready during DSI enable. Fixes: e19233955d9e ("drm/bridge: Add Cadence DSI driver") Signed-off-by: Aradhya Bhatia --- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c index 557b037bbc67..05d2f4cc50da 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c @@ -761,7 +761,7 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge) struct phy_configure_opts_mipi_dphy *phy_cfg = &output->phy_opts.mipi_dphy; unsigned long tx_byte_period; struct cdns_dsi_cfg dsi_cfg; - u32 tmp, reg_wakeup, div; + u32 tmp, reg_wakeup, div, status; int nlanes; if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0)) @@ -778,6 +778,17 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge) cdns_dsi_init_link(dsi); cdns_dsi_hs_init(dsi); + /* + * Now that the DSI Link and DSI Phy are initialized, + * wait for the CLK and Data Lanes to be ready. + */ + tmp = CLK_LANE_RDY; + for (int i = 0; i < nlanes; i++) + tmp |= DATA_LANE_RDY(i); + + WARN_ON_ONCE(readl_poll_timeout(dsi->regs + MCTL_MAIN_STS, status, + status & tmp, 100, 0)); + writel(HBP_LEN(dsi_cfg.hbp) | HSA_LEN(dsi_cfg.hsa), dsi->regs + VID_HSIZE1); writel(HFP_LEN(dsi_cfg.hfp) | HACT_LEN(dsi_cfg.hact), -- 2.34.1