From patchwork Thu Mar 31 10:39:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 555276 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1248:0:0:0:0 with SMTP id z8csp515210mag; Thu, 31 Mar 2022 03:39:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTZvtx1ce3U+mzV7n+oZ7/x79bvhoj7fpgAM8QWnko7lIvC/bjDyePg9FJD3uE52u9bSFZ X-Received: by 2002:a17:907:1ca4:b0:6da:86a4:1ec7 with SMTP id nb36-20020a1709071ca400b006da86a41ec7mr4407218ejc.556.1648723195193; Thu, 31 Mar 2022 03:39:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648723195; cv=none; d=google.com; s=arc-20160816; b=bEFTFHBTFpj5i2vxUfbQ8KUOyq0AqCqi7fFK+N9aCJgwyZS6vHwh4M9f8pN36DEAbd cwkU77v0vU721FwT0QPYCrafMmjOxVoAjAirJRcEmOcS9bSkwgz7OVYKdX67WJtjyCEs NOzLf2V8HHLZR3fbO3CaBcnoKW2BLUE0DFeehXiyp8bNL8H6S3z/1vjWpeLUmCjxH0gF BXFu+sA7z+HV/eXMkAjd8YgcVn0XaCpTl031oFbeZN1ciPc0Ud1MqG8BEaobYJog+27k nvuLgKG9sdgLGsbJxXbc+1Br3L/evr88q/sW6wuwIrD9eklEMYebEn86GMXhMrgFbUPC zejw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=S1Qs0QvQZ7XEzh3mbbwc4nQtoo9RfIqK2KSzMRAjjuM=; b=ATn4L+wG22S26DuP9flFUqs6BgjmXTXKU08sjgj7Lxkz8tj764aghdznX4mpsAqTcD WPiBZz5QtBFAJM7slLlhyd+CViKGmNNY/GYe66PbFptEgnvAoNzjshAtpFWfTlTnjTUi fdKcfe38xCeaTtOxBkpSM3bJ3w6G3ielK9NEIntwIBEKsFus9o7i46fktbNfdvuSJpsI h3RBapovQKjN/eI3asQz1FESUm00JwPHd1RLcxY+LRatTgu3INtJ4YjXVIzKVM66j1TO rbyzjm8Vxk2h0yBTVcd3cxXyk5ENiSguqQU7AesSfcWBukK/VmItdrJIP0c8m2ygXRa2 cIyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GyECsw3S; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id y3-20020a50eb03000000b00418c2b5be7asi24611673edp.348.2022.03.31.03.39.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 03:39:55 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GyECsw3S; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C9B77841DF; Thu, 31 Mar 2022 12:39:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="GyECsw3S"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5971841DF; Thu, 31 Mar 2022 12:39:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 59A46841D5 for ; Thu, 31 Mar 2022 12:39:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=loic.poulain@linaro.org Received: by mail-wr1-x42b.google.com with SMTP id i4so14312219wrb.5 for ; Thu, 31 Mar 2022 03:39:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=S1Qs0QvQZ7XEzh3mbbwc4nQtoo9RfIqK2KSzMRAjjuM=; b=GyECsw3SgmDA1TIDwdFOr94gVSqFdygRlwwx3Cn/CbYPnwrMwxGykgytZcRaLgCQIx aBgAcl31gTwJ/U5Wqz2KFUkzgHlRJz7Dzh2XZdcMPe6InuBKEv8CyFpUG2yYJ+kE4Gdq tt7oht9FkGLcSdq95lQ0hvz1+cLMN32sdZumFvXViE0A4R2wu/kEYfeMOnqCotXxB3MO CW4xPa14mZImhBaIFrSWf2v3bPvFora6e1oA7aNdpQu3GfeL+taz9V6qQxRyXvZL/Tyw Vo+eIQQLKvFTG3iaIf9KabUMMQqmtA8/t0DaipGiSsuT4gszZdItxOLJhPKjRX2CO2kO SB8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=S1Qs0QvQZ7XEzh3mbbwc4nQtoo9RfIqK2KSzMRAjjuM=; b=ua4+UHLMbSPoj6nvTlJsDm+h/knudCxfCxJQCzQsdihbWuIITck2J2cPHIYRU7yyKY brbu8pC7Fp9doj8c2GUjMQTWj9Ro+XfhqftKKnN/E7m2bmpd+hvEdngPBkqakstAxQrl bUn4tVp6qddCM2BbUN7GRu22zodPWLLbw/J3OrnL85SsWhwh/AnaltMW+FTUrPgqyEKF Enh2tFK+/Q69R39B54aEJex2TuoX7xjPO/5oywdH8ZqHT7BmNpA5WqFfJPe1W6trZwIB j+2zrO5gTEOAIHf/QVlPr0XOCGs5wz0h37ElUN8QHfacOz5120IfxEZasjvKV2wyydnN rZwQ== X-Gm-Message-State: AOAM531zB9vp5DE8KSJr0swAGSeBkCSiLAVeyPVdYC6L24Ud8zO4qgL9 ShEUb2KYvhFlvtT1BToNWfLTyw== X-Received: by 2002:adf:a41c:0:b0:203:daeb:165f with SMTP id d28-20020adfa41c000000b00203daeb165fmr3687362wra.188.1648723179898; Thu, 31 Mar 2022 03:39:39 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:82c:5f0:dc94:1cc1:d14:97f6]) by smtp.gmail.com with ESMTPSA id y11-20020a056000168b00b002041af9a73fsm22794000wrd.84.2022.03.31.03.39.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Mar 2022 03:39:39 -0700 (PDT) From: Loic Poulain To: sbabic@denx.de, festevam@gmail.com Cc: u-boot@lists.denx.de, alice.guo@nxp.com, uboot-imx@nxp.com, ye.li@nxp.com, Loic Poulain Subject: [PATCH] imx8ulp: clock: Fix lcd clock algo Date: Thu, 31 Mar 2022 12:39:37 +0200 Message-Id: <1648723177-28218-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The div loop uses reassign and reuse parent_rate, which causes the parent rate reference to be wrong after the first loop, the resulting clock becomes incorrect for div != 1. Fixes: 829e06bf4175 ("imx8ulp: clock: Add MIPI DSI clock and DCNano clock") Signed-off-by: Loic Poulain Reviewed-by: Peng Fan --- arch/arm/mach-imx/imx8ulp/clock.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-imx/imx8ulp/clock.c b/arch/arm/mach-imx/imx8ulp/clock.c index 91580b2..dbe0f78 100644 --- a/arch/arm/mach-imx/imx8ulp/clock.c +++ b/arch/arm/mach-imx/imx8ulp/clock.c @@ -381,10 +381,9 @@ void mxs_set_lcdclk(u32 base_addr, u32 freq_in_khz) debug("PLL4 rate %ukhz\n", pll4_rate); for (pfd = 12; pfd <= 35; pfd++) { - parent_rate = pll4_rate; - parent_rate = parent_rate * 18 / pfd; - for (div = 1; div <= 64; div++) { + parent_rate = pll4_rate; + parent_rate = parent_rate * 18 / pfd; parent_rate = parent_rate / div; for (pcd = 0; pcd < 8; pcd++) {