From patchwork Sat Feb 25 08:38:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2734 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9D67B40F4F for ; Sat, 25 Feb 2023 09:38:36 +0100 (CET) Received: by mail-ed1-f71.google.com with SMTP id g33-20020a056402322100b004b0e54e03acsf1438589eda.8 for ; Sat, 25 Feb 2023 00:38:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677314316; cv=pass; d=google.com; s=arc-20160816; b=hDeQT5uNNvfpelpwBPIx3HY3i8yKcQnkDkkGR53+twehv4FSVxHFMfmhoISs1kw/Oo CmLC6MTgf+gLn13YNtdkiIiw5AZ7qC/1UDnqUAkXqtCPwaCS5/UtB3YA8h4vzZhw5Zm5 ViGAO9Uj8mapxYH3nQzCZmtaX1w9yoxkmgtk9NxJbYtAVCd+LGovTJ3dQ/+DTz/illJ6 0P0+wVTx+HYov85bFpgVAUw8ISI1Qh2AVDJbSIBqnlBUAz2Y8EmDb5nCsq/7fsIolpUI EUa7JyWYWBbz/FkcCzs6ZOZIVKOQ0aqpfYi0K1OnQBs1qbpgcqxTMkT7xnhvIHgpzFfj p69w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=lC//O4GkkGBuWyTeJlNiHAMVcvE/FpDBpna8UfDY9Wc=; b=Zt+Z+Kn0ibENW64aAbPwjllUwPMHXLv4N0nz5kJGwF50ihozi9c3eIQeocyLEAnRi6 LzmhXXvi5qNruWy2SbLvGcB95405h4M0143VchHdKi8GGeaqU3SMhA7NYVpon6s/xnGI wRtYB2wr9S8v2jTxxVCZ4Kc19t8y/j0QbA55BD20VEQ998Fi1TUtT3gLc2reD4Pg4aKb DLS4s6zvKII7dK8QVpf+sQybfR9myFZnaVAxZbjptE9i2v+SoCpsN2OgDnN8bQq3cYOC rBJEKAc16FN0Emk+ZU9z1ODlDP2NydcxE2X3V/Wr700ZuObAaWVYvYDBJCx3SYSa5+5h hrgQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XZrLfkxc; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=lC//O4GkkGBuWyTeJlNiHAMVcvE/FpDBpna8UfDY9Wc=; b=PRXwiOI+WfD2A8JOYZu8wQy/DwBBSnQdhfg7FlOYSHonyreplLIMafePGRAA/+vE+j z2il3ai2MLWEeAo1b5XNmnalVexmCOYNORPfUl6yw47M9jEUcKYBSg9zUd+VDzRgLwQc yP8bCsUa/9P0r7POs1b8grbJQw96Ekl0wSOno= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lC//O4GkkGBuWyTeJlNiHAMVcvE/FpDBpna8UfDY9Wc=; b=NLzU5NZT1/TOXzekaJ0U101G1ohbEuiAUM1WEAAWXZNXXlnGwvDcpWcKJXeNIy7bHb zQngo/zmglSxh4F7ndLtepsypP31bFpTnetY5vRRczHVkJMg32br6EsRLNWnwoxeXhOP 5E86EzZtctFhLSD42t5Ux5WkTBvIsJIA8DCy0MFbeFcemfo9ePF+yWuAMEyaHySvkdfm zM9zDbKu43FJCOzp5dyzwgFyRXrAruljnVmlihLc9OMF2OawO/zx2WtKJ8WmUa5Kl6nY FRsYs/7Qgvd1i20zW8sFKuGsW2v7c28IMOd+YYlfOdxK0FREULqUMck1lqT8RQi6SQIc Ascg== X-Gm-Message-State: AO0yUKUwFUOccD+eOdEt4l86DJIJPFWmctbgioK3cW+i4sPJ6k2CpRea 86rYZH+pB2lEdoIB1dcSgFTqdkiq X-Google-Smtp-Source: AK7set/x0lcMW0sdcqA++2R/1krm9sEXjnd4GaJYm1fCzfj0MX9iKPHfOmXIg+pTNF1oFq4oSgRTxg== X-Received: by 2002:a17:906:9419:b0:877:e539:810b with SMTP id q25-20020a170906941900b00877e539810bmr12026598ejx.2.1677314316399; Sat, 25 Feb 2023 00:38:36 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:907:c010:b0:897:68a7:5262 with SMTP id ss16-20020a170907c01000b0089768a75262ls3008986ejc.10.-pod-prod-gmail; Sat, 25 Feb 2023 00:38:35 -0800 (PST) X-Received: by 2002:a17:906:ad82:b0:8b1:7eb4:6bea with SMTP id la2-20020a170906ad8200b008b17eb46beamr28373882ejb.38.1677314314992; Sat, 25 Feb 2023 00:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677314314; cv=none; d=google.com; s=arc-20160816; b=SYCm7ePuOosH99p1V1tCUDj9odOgPKf3NZeXHBXQkdKXs0PqhO18kT8tmvJhsIBcP4 ARhJ4haZDQSMMoI/7HYySSIstBSvJAGtqRTmFnJFitykTECdd4RQ4c4QNwHntLD7Ttpx JS1SA/nnK6AU0ohu9MAG+1MMI9NivNTfQZL1pXut6OCXolMZ0eBFUCAAWweBhYPjCyX/ eneytXPr3HJQN+qcKUjjMbC9enmSXXZLB35fqOjEwBGYbACP4uKoenJBboCe/uYo3Tst BcDLw0OlR49q3FUBD5+i/2AqlzVfKC1z7X+1aZloZK7LLsOUYCRoIS2AIDAhIf+3X9Mb nLhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ziR30gGYbNwF+BWVCTJGgGS6T2Wya5Vb2HBNyjs4l0M=; b=UBarUxOH9E1KvZ72l74xmxrZ0XQC+Se7oxwvzsk6BveDYy2mmdCv58mbbGC/Fs7IFv 2DL9di4IpJnFX1En2bz14vJdiAvkZefrByN1S/y9yxcZcn50F8/hdpNytYoF1ImJ/B49 p/y2a86yBeopmTOk7/xH00ZRiYpnfkT1l2+Vjf0y9l/4/AONsofdoRfgxN3QAjvUZ34g gsBATAlDV/+1RucylVte6mgMFZc3IR8RVIFxkhkdIU5RZ1hs/y1+l2lwHEXjbOV65RD6 5dwdE6xmRc1HQ+Glz9zagPM360yckGTGFbfy/I/qFOdxDcvt1WXepxgZ5xofFRXQTh6q ME4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XZrLfkxc; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ca20-20020a170906a3d400b008f0156091c8sor504818ejb.45.2023.02.25.00.38.34 for (Google Transport Security); Sat, 25 Feb 2023 00:38:34 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:907:8b85:b0:8ee:babc:d40b with SMTP id tb5-20020a1709078b8500b008eebabcd40bmr8113130ejc.58.1677314314702; Sat, 25 Feb 2023 00:38:34 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-82-56-22-12.retail.telecomitalia.it. [82.56.22.12]) by smtp.gmail.com with ESMTPSA id u20-20020a170906655400b008f2b0c6052csm591958ejn.89.2023.02.25.00.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Feb 2023 00:38:34 -0800 (PST) From: Dario Binacchi To: u-boot@lists.denx.de Cc: Lukasz Majewski , Sean Anderson , linux-amarula@amarulasolutions.com, Dario Binacchi , Fabio Estevam , "NXP i.MX U-Boot Team" , Stefano Babic Subject: [PATCH 1/3] imx6: clock: improve calculations to get the PLL video rate Date: Sat, 25 Feb 2023 09:38:19 +0100 Message-Id: <20230225083821.472605-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230225083821.472605-1-dario.binacchi@amarulasolutions.com> References: <20230225083821.472605-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XZrLfkxc; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , During some tests to check the pixel clock rate in the transition from U-Boot to the Linux kernel, I noticed that with the same configuration of the registers the debug messages reported different rates. The same Linux kernel calculations are now used to get the PLL video rate. Signed-off-by: Dario Binacchi Reviewed-by: Michael Trimarchi --- arch/arm/mach-imx/mx6/clock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/mx6/clock.c b/arch/arm/mach-imx/mx6/clock.c index cb9d629be408..17d8dcd5c841 100644 --- a/arch/arm/mach-imx/mx6/clock.c +++ b/arch/arm/mach-imx/mx6/clock.c @@ -213,6 +213,7 @@ int enable_spi_clk(unsigned char enable, unsigned spi_num) static u32 decode_pll(enum pll_clocks pll, u32 infreq) { u32 div, test_div, pll_num, pll_denom; + u64 temp64; switch (pll) { case PLL_SYS: @@ -272,7 +273,10 @@ static u32 decode_pll(enum pll_clocks pll, u32 infreq) } test_div = 1 << (2 - test_div); - return infreq * (div + pll_num / pll_denom) / test_div; + temp64 = (u64)infreq; + temp64 *= pll_num; + do_div(temp64, pll_denom); + return infreq * div + (unsigned long)temp64; default: return 0; }