Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1180720lqb; Thu, 30 May 2024 02:44:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXQXU3bfmo1sECrFHx4PtVpwfbip+qBpCpDqQyYvhhajZBwhuliLCaIceWA5ZDySSEeCPKsE1cARdK7+ZT3asp+rbijmYyyBleJd5V5Pw== X-Google-Smtp-Source: AGHT+IHOAoapNjYfhTVY/oPgYqN9vC1ro1NUqTUOEHtJcgSR2mqRaNJJ0eW5trQi9lvrfW0sMjrL X-Received: by 2002:a17:90a:ba8f:b0:2c1:b393:1c94 with SMTP id 98e67ed59e1d1-2c1b3931d9emr605397a91.14.1717062274467; Thu, 30 May 2024 02:44:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717062274; cv=pass; d=google.com; s=arc-20160816; b=yxzixOGn3fSGstRvnUQF2o4BFKV1yO5OVArfe+tGicleQt30oqxSjnP3CByt4VcHK3 HbNaU58xRdypvKnv7RU9+UuJJwpYgTKQrgNPYKL99WT8xirMawVa9aSkcz1VpPuCmF7t cIJ3dzudd/8kIRLv9NRS9GAih5mjVwsoHKshGMaVqCJXOgh6IdKQRmiF5mnixnFj1Thd qP7ZtRalCJ/b/53/jmVpQjOz1X92DJB0cKSjMq0MulL1bi1vhoaMD8C/FhHj7He7WadR 8T2o53iIFEHoi6Vh4NDa6fKEf8KHTTghbUVoioYEYTtL0Be4VLJ2DEd9pZigE5BDCeic TiDQ== 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=1ZSojRZCa4IhlyE0hELBwkAuCNm9da4KHPr8AAPO48M=; fh=fWFkqWhkEWu3rFwNeYdXbOcQQfbvrHCRIs7r20HyHeE=; b=L7iv2Snfmc3KxnKgOjCYd3I0gcX/9zddhuQZEXIEBcJoF5yZLrcJJ5hweyw7kRgvqU 4U9N2hkoeoyDP4ts8+IjvjM8lnH9c/fIgm1h6FodPON9OhHtK+/5fJ3LAhIFJAFW9NKv vZoJBl2awtnLaVDNhnGgqc6rJEb1J0xpKrfyyDphNV4/d8xclp4TG6SDa1eNTLdQNIrn ZVoFO+1K6y6HdGB1Cu2itWEOayybLHILGfzrzH9Pm1luSLsB9cYtKGisW9d8LTXU5tN9 +yLb6y2DCRGHaoYnvseLK6YhQG02ZYxZR05pbYPJqVijR8s3hEPsQhwUaLjfg731FPx4 xqFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=BCUci6gq; 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-195194-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195194-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. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c1a77ac5f0si1319422a91.172.2024.05.30.02.44.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 02:44:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195194-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=BCUci6gq; 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-195194-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195194-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 DAAF8B26D0F for ; Thu, 30 May 2024 09:37:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08D85161302; Thu, 30 May 2024 09:36:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="BCUci6gq" Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 B35BA15350D for ; Thu, 30 May 2024 09:36:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.141 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717061812; cv=none; b=mdSwfz35++ozgt13n4UfqC67Yj7OIiupdrYq7qXtV4Hl5EE6+ANo+KLvM6C3ZtyR5sr+BfIOyTcermo2V3+rmdY40GyZG+KppOMR6ub4lgzlfCNTYQTco3ebzxzsGtZ8aS3TVyiO4A8qHkT1Xu3IwAP8wr5mUBtYERsQ7qbvn98= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717061812; c=relaxed/simple; bh=/V21HXkkv8Zl3SbeFjDo8vTJ6BZA002CinUipY7YcLQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nSiGhdkRwmghIK+LQvh3D0KRUry5unktPdbQTSAEua6cmgIuZqPn7gcajxOMgDKuKvcpFviapv2kdmPKAp0EQ0tKPW4p009wHfiREVnPLSuDM7dnOKvI02rI555JafE1ll06bd0lnIe76reGZQO+/QcZeb1IW6MYMVQ+qlK/HfU= 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=BCUci6gq; arc=none smtp.client-ip=198.47.19.141 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 fllv0035.itg.ti.com ([10.64.41.0]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44U9aVQI128518; Thu, 30 May 2024 04:36:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1717061792; bh=1ZSojRZCa4IhlyE0hELBwkAuCNm9da4KHPr8AAPO48M=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=BCUci6gqJZq07zJU+7J9aueqKmsKEiB27NHdTixoku6y49MvaIlQn0HG060xkcwaD hioXfJmVltH+73tmPw0bXgav/JjnElaJow+zOgCgs4w2izZxpyzhK4bR2R4hoHd74S yLjA4jymnvUE+/y4gK2SKxWKtrRUmSWof7txNMjE= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44U9aVG1128520 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 30 May 2024 04:36:31 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 30 May 2024 04:36:31 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DLEE113.ent.ti.com (157.170.170.24) 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; Thu, 30 May 2024 04:36:31 -0500 Received: from localhost (uda0496377.dhcp.ti.com [172.24.227.31]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44U9aUQw086357; Thu, 30 May 2024 04:36:31 -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 , Nishanth Menon , Vignesh Raghavendra , Praneeth Bajjuri , Udit Kumar , Devarsh Thakkar , Jayesh Choudhary , Jai Luthra , Aradhya Bhatia Subject: [PATCH v2 5/9] drm/bridge: cdns-dsi: Wait for Clk and Data Lanes to be ready Date: Thu, 30 May 2024 15:06:17 +0530 Message-ID: <20240530093621.1925863-6-a-bhatia1@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240530093621.1925863-1-a-bhatia1@ti.com> References: <20240530093621.1925863-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. [0]: See section 12.6.5.7.3 "Start-up Procedure" in J721E SoC TRM TRM Link: http://www.ti.com/lit/pdf/spruil1 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