Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CAB7606A31A for ; Wed, 2 Dec 2026 10:28:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.u-boot-project.org header.i=@lists.u-boot-project.org header.a=rsa-sha256 header.s=default header.b=T5DU152k; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=KEAS/Kw4 Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 58F81607CF; Wed, 2 Dec 2026 10:28:01 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id EenU7oYGa2Io; Wed, 2 Dec 2026 10:28:00 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 78C7660808 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796207280; b=lNm/gXawvZP2BIb9Ntp57pY6HwX+Y0/F8ajvwPAt2yzN0T3EEZx5GuWKbG6zkDL5Oy1s ouWqAwbcp+Y0RL6yqpyDIstBQQ9SrTRefVzanT/bMV+TZ9zrS3yGg7qfzZ2i2X0vdX01j E+cBEsEmNlB/1rNPtUzDWm7PQBCAZqHX3fAy2tinOO6H0e90qlv/V4kSe5345ypLtcwvA GVW2zjmMz6IfF4bZw/lQLIGCKRVUctTgVTrO1QfRJdV1rev/teS+b+b1iUtJ4qB4PZeqc MPj8sSkG6wQsQrDYZiQR5lmHOPmw+LFBEnL+MRd1+orR38B2/34VcZf5LdwfUqtZDJw== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796207280; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg: X-Received:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding: X-BeenThere:X-Mailman-Version:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:Errors-To; bh=j1HCAYoYh+vqUm2c3fTDbTb0oiKPVG2Nfb1gIHjtQYY=; b=jgzOCm9rG3TI8MGOx4jdnUrmiAUU24q3yBvCvzkBfXbQY1dJp2Djkbxz/DamWQSKcYnU t2lyu+Tk7AE+8B2IUabzNtKqYMk+XYB5Cd2YRu5yuPQMIUHsoMAHS/pd7lgW8YpV6s496 KEMzKkTZ58OEeFkMzM0D4EwGkr7VdyCr2vqWKApP6wNbgVHkk0YdTJc5zLbk57Kz87+tC 8qzxC6qivvJD2MSSL8AzTtUcIqbqDCEFlYyCdrqZMkG872WU1iWaDz659mTOxulDu3k4S mF2g7zu2bI4RCxGSbi48yyG3X6JOeYar/hMaQFqrBxPZ6VXbyU0Fr8HUBSCEaOrsqrQ== ARC-Authentication-Results: i=1; smtp3.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1796207280; bh=j1HCAYoYh+vqUm2c3fTDbTb0oiKPVG2Nfb1gIHjtQYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=T5DU152k1eZkTaQ+d4q3djN1jX+HS2NUuV3tG0FIJudb2nf8RLc5s/ibyNtZb2/+1 7n4QqiUPLo2l1afgwENfKTHyMvNVGcJfQ5ZsKLW4Dkzb4xGdoUEU96ial4lWjRMBe9 eUUuz4GBTSrMcyS/lSNh/C04aU0o2aIXi6MvAlnXNYf2HVbbCJUW6MN9zKqh+2A30g 8sA09w5AEOpJL3loCps7Hsf3ygNtA1FZ7lvwEDehhd/0QzRWx+HXlWdc3PpbCFLWFi KG+3hkuy7YfJQ0EoTZZgTseNRJQqOGWlVaWYWtV8Y0Phim/9kg/P9vs7aLdbCF5O5R 9sIcwKy+S0HRw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 78C7660808; Wed, 2 Dec 2026 10:28:00 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id 2E9BC9C7 for ; Wed, 2 Dec 2026 10:27:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 2104A80E67 for ; Wed, 2 Dec 2026 10:27:52 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id QN0tLaHYLhlj for ; Wed, 2 Dec 2026 10:27:51 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org 26CC580E63 Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip="2a00:1450:4864:20::32f" Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::32f; helo=mail-wm1-x32f.google.com; envelope-from=dario.binacchi@amarulasolutions.com; receiver= Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.a=rsa-sha256 header.s=google header.b=KEAS/Kw4 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by smtp1.osuosl.org (Postfix) with ESMTPS id 26CC580E63 for ; Wed, 2 Dec 2026 10:27:50 +0000 (UTC) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-49d05d51553so87917055e9.2 for ; Wed, 02 Dec 2026 02:27:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1796207269; x=1796812069; darn=lists.u-boot-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=j1HCAYoYh+vqUm2c3fTDbTb0oiKPVG2Nfb1gIHjtQYY=; b=KEAS/Kw4vsf/zKC7Y/RfQt4DoHQwSPFlVrjiJChfW/CWLmxqyKZ+KjualwHXi/NGDV R8p9TSz+pAPoblLaEIyWs6Ae6QbuXXv7n1uNOExRm6kMCaPNknaqDF7Pdb/cwtRT9qiL aIS9a1SzzrT4+fH/rm8JqiIGBPGfXihxOFgQY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796207269; x=1796812069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=j1HCAYoYh+vqUm2c3fTDbTb0oiKPVG2Nfb1gIHjtQYY=; b=ROil0Ob8KpYyR0fVvjgxme+5ZrX1W8t5uI2VR7rz7ylk1TWNxf0lwU9inuHhr3J7o3 vc0Qv+jX6wHIl0dSHGuPHgo7N2VW09bDGTqInweBUMvVbVncqErn26V3jDCklzSKtQ0f qvQ9l095FOpJWwME/maFaQu8wlxz6dWEmo+Z04NfiDyv54fY+wZ4M8LEminU8YLa1RMh DP6Vp5KqLlkRV0HVYV5Sm/pW8sdfHiZrOffh0tQVFJiEz3qw8gHnpzhbU+fnWzlydWrh 91pB9iqZtaJXJDNo8wy+7GpgAJUiy3V3rhjVGmce30dgTriHoH22EJleoBlswqOoZXyz +G+Q== X-Gm-Message-State: APuU4Z8NEvXKWd8AMGgyrEJz8w6bkY9IeJ1VR5WoT5uuia43HXuxNOej Yu+ZmmkwzHrIypp6ZZVKlPyyneiwmohZAj4kAbJmK2Iek2wP79uLtWmz9+/aCKOxTLteGzTrt4q NOT2t X-Gm-Gg: AZFdTZeKPm+Afo5Vy9lKVdj3UiCM2HUtnXZaRhYSGejlULBnfPyFx9n1l1C+u1VLqQC SFaezozYr7e/xo3QEPCm3PBU0oC8pNIrHoaNcgQfl1Frj9GR4AU4bP+EPRyaei9j53EVzAWV/9k 2ZysWoXt94a1conRW4w48xtKFVsvsxPbLolaytWh0wUZu7n0x95q36R67sMAsK+T8rk7m3gaeJu 6nfzk3PooAveTeGH6xHnfqqscy3fnqimvVwyg/2vuAGLk4LgphG9r2TYww1D58pHxtsl1UqsCiE WUhxVUE/8ipdXpEp2WbjNyGEtw2p4oQP92mA0DEiuso8kruaV69/fd5h79OcCoXyM5g1hGTIMvv cMDzzgBegL1/GijSzpfbIMn3og/NfFRWUxvA5YayMnKTdgzPU4OUZgqDyKjAk1qv3pLPHUJGFB1 Qyg2kR3wrJxTXCk10DJJg9rtzrD8bJIvhAfxkM8IlAdRR74w65d0+VLlllIpikLQQqHTmtT7Tt8 6dI7zrwTycdobunm2ijks7Qg3CHNv/UfwoCzUYt6g1SfSqcI+EgG6pVBmez23wVnl+6fKwbQ3rC /LhV8/3y54BCa2MvM7sjSyoQmufqVUVgvw2p5/IB2unz8vmnCu99a995e+C7vIE5UYeegK6Hmm2 t5TalsWmP/o+BKJ4foeKv X-Received: by 2002:a05:600c:154e:b0:4a3:59ee:86b with SMTP id 5b1f17b1804b1-4bb887c3b63mr820376455e9.4.1796207268901; Wed, 02 Dec 2026 02:27:48 -0800 (PST) Received: from localhost.localdomain ([2001:b07:6474:ebbf:6962:3ebc:7df:e6bf]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbbaeb1e4csm366823865e9.13.2026.12.02.02.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 02:27:48 -0800 (PST) From: Dario Binacchi To: u-boot@lists.u-boot-project.org Cc: Heiko Schocher , linux-amarula@amarulasolutions.com, Peng Fan , simon.holesch@bshg.com, Marek Vasut , Valeriy.Yatsenko@bshg.com, Leonhard Hesse , michael@amarulasolutions.com, Miquel Raynal , Marco Felsch , Vinod Koul , Sakari Ailus , Dario Binacchi , Joe Hershberger , Tom Rini Subject: [PATCH v3 15/26] phy: dphy: add support to calculate the timing based on hs_clk_rate Date: Wed, 2 Dec 2026 11:26:26 +0100 Message-ID: <20261202102716.572884-16-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261202102716.572884-1-dario.binacchi@amarulasolutions.com> References: <20261202102716.572884-1-dario.binacchi@amarulasolutions.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-18.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Michael Trimarchi Upstream Linux commit 22168675bae7. For MIPI-CSI sender use-case it is common to specify the allowed link-frequencies which should be used for the MIPI link and is half the hs-clock rate. This commit adds a helper to calculate the D-PHY timing based on the hs-clock rate so we don't need to calculate the timings within the driver. Signed-off-by: Marco Felsch Acked-by: Vinod Koul Signed-off-by: Sakari Ailus Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- (no changes since v1) drivers/phy/phy-core-mipi-dphy.c | 30 +++++++++++++++++++++++++----- include/phy-mipi-dphy.h | 3 +++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-dphy.c index 8fb985a1e682..727c2b040520 100644 --- a/drivers/phy/phy-core-mipi-dphy.c +++ b/drivers/phy/phy-core-mipi-dphy.c @@ -13,21 +13,23 @@ /* * Minimum D-PHY timings based on MIPI D-PHY specification. Derived * from the valid ranges specified in Section 6.9, Table 14, Page 41 - * of the D-PHY specification (v2.1). + * of the D-PHY specification (v1.2). */ -int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, +static int phy_mipi_dphy_calc_config(unsigned long pixel_clock, unsigned int bpp, unsigned int lanes, + unsigned long long hs_clk_rate, struct phy_configure_opts_mipi_dphy *cfg) { - unsigned long long hs_clk_rate; unsigned long long ui; if (!cfg) return -EINVAL; - hs_clk_rate = pixel_clock * bpp; - do_div(hs_clk_rate, lanes); + if (!hs_clk_rate) { + hs_clk_rate = pixel_clock * bpp; + do_div(hs_clk_rate, lanes); + } ui = ALIGN(PSEC_PER_SEC, hs_clk_rate); do_div(ui, hs_clk_rate); @@ -74,6 +76,24 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, return 0; } +int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, + unsigned int bpp, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg) +{ + return phy_mipi_dphy_calc_config(pixel_clock, bpp, lanes, 0, cfg); +} + +int phy_mipi_dphy_get_default_config_for_hsclk(unsigned long long hs_clk_rate, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg) +{ + if (!hs_clk_rate) + return -EINVAL; + + return phy_mipi_dphy_calc_config(0, 0, lanes, hs_clk_rate, cfg); +} + /* * Validate D-PHY configuration according to MIPI D-PHY specification * (v1.2, Section Section 6.9 "Global Operation Timing Parameters"). diff --git a/include/phy-mipi-dphy.h b/include/phy-mipi-dphy.h index a877ffee845d..1ac128d78dfe 100644 --- a/include/phy-mipi-dphy.h +++ b/include/phy-mipi-dphy.h @@ -279,6 +279,9 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, unsigned int bpp, unsigned int lanes, struct phy_configure_opts_mipi_dphy *cfg); +int phy_mipi_dphy_get_default_config_for_hsclk(unsigned long long hs_clk_rate, + unsigned int lanes, + struct phy_configure_opts_mipi_dphy *cfg); int phy_mipi_dphy_config_validate(struct phy_configure_opts_mipi_dphy *cfg); #endif /* __PHY_MIPI_DPHY_H_ */ -- 2.43.0