From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 E7A3C30C630 for ; Tue, 26 May 2026 18:06:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779818821; cv=none; b=tP/n+l2zwfbZqOozn7/564SFOUhpxsQZqE8bdZFEARDemSKh7vtw/VAo4PQL3pLfDFTJgKm17WcWUc++wvghlp7lx8Qqp6jDyqw3SPkj8pm+SIRSFeAIyiTVpoqqgc+0kYJzfZSSyY0UfMfA0e3OrxfpL4YaW+a1l1mgiT9fvr4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779818821; c=relaxed/simple; bh=V0Tna2lGH7kfeiYnCrun8PNvpd//QWqXS+gJzoPXz1I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rk6OPD7kWPE+3y1l46+lJz8NQNXmOQEdvnS+/KdzCnAt9MPN7Ki2qIpkG+pPjEsakAlno51Al7XPY6VMiUlkTyK18z+n+/0sDBx3Y1CGUCaFSkY5l8qnoxTx5QD8wcnLIiRu/H09IKHx817WXBPTWexKsTjKA7dqb1xL60ENWbY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BnNJ/25y; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Apk2Qa+w; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BnNJ/25y"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Apk2Qa+w" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779818818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=mtuYbvQl5xGtavWlu1yVakqj5t0N5rS/4aiatiahmNA=; b=BnNJ/25ywGM0NXIyVLLpItuaSh2Hk3yF61M90YqWq4axvAZ0mNPultl4vMGKabqafTklOK oe5IYpxGgKYAKsQTIfrP1TSyBX7LhmixVXvUBG2fvqTuHiDxpdhbcPtzCjKkSqt7WhM1Xg +JwTc/ct6MFfA6ESq7S1CjiKRYZ1O54= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-96-dXMvLOshOBaSOkxoTXpnDA-1; Tue, 26 May 2026 14:06:56 -0400 X-MC-Unique: dXMvLOshOBaSOkxoTXpnDA-1 X-Mimecast-MFC-AGG-ID: dXMvLOshOBaSOkxoTXpnDA_1779818816 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-914d0312a2eso281206685a.1 for ; Tue, 26 May 2026 11:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1779818816; x=1780423616; darn=vger.kernel.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=mtuYbvQl5xGtavWlu1yVakqj5t0N5rS/4aiatiahmNA=; b=Apk2Qa+wwRZ2JVh1pTLlqcRyqvQm3nbQPZFv8njvXoBE1ElxVpYO0F0Gv3rnkzqG9b UHv7Xr6kPNKrfl5z0ayC3RP3B3l27+oxe58rb4me1oVa++hSyB51o/G2sXa4/IqAjozu KoSKqD9kMALaNVb48vpnadTQfKajv5zdS6FGCkduewjz9HpgFSu24HqvkqehiHqYnr9+ jIS5ZZR2zZUbK9IqYwjeoIGQ/v+ghH+GLy7W6Nm92I1WqxY8xblPjNbQ4DZUo3UjVGw3 Z9mluy9ZxIgSPGKDayLfy2m9oHhmuVfIbS+vXkQNSl4wrrbpNC7aH3zd4xFLoKoPqKGr e0EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779818816; x=1780423616; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mtuYbvQl5xGtavWlu1yVakqj5t0N5rS/4aiatiahmNA=; b=DawOaq9BQDQ5sS5rTBJ2Y/ouojKfwOvVHNTjEtnLPWsqDtKHKGGH9IV7i4iFsVXCOG DYq5+C5zT0U6ErBGdWcagYbtXDFFX5agYen8BPoHRBH1BWXaiHtyYmUQBrtxrLWK+bC/ l3P44vSYXNG4cMT+wZ5B0zIyTI9BJ915CVVBRSxZdK6LhHCmmhEEwwizwyqsttUED8CY u2eqm/iWm0tePUnvhn7Z/ww+Sg/uZs2++/jgm/EcOxxQ+0hkC+Pt0Ra4Cksp3FCW/4I7 HXE6H8sjSKpYQ+HNIwp3sWnmM1VIRBariW2Sa269JWwOuA8t89H84/dWUZCr6FngB+V/ RaFw== X-Forwarded-Encrypted: i=1; AFNElJ9yVEDiTCLhv5Z50EbD8U+nXVVwmJHbdQB2BBl7Hp6Of0eP49vVWwYJx4yBrPEsacRWGfJulGhdBzBLxaE=@vger.kernel.org X-Gm-Message-State: AOJu0Ywk0eip/c32vDa87NenhGJUNwwKa0FprLmRNOqqxIPaLRz6l8y6 GLgj2+vICPwDN2lmvTgU+DuVtAObpOUy3dDHOh+9Jofh1ce5Tos9sKBLffvL7bkqozAlaNyu6dF itFmxV7sASd01Ucuy5aGs3q+lCNrYM0Dy3Zd7eaHzLvFeBhr3c4k/KqZusswmOHTOxg== X-Gm-Gg: Acq92OFWck1deEpWvlRhON6KyW4AEsCgOpXZpDutq/f06wB2+yB+Qfnfg2QUyCdSMhQ sUf3p8HEJGD1IBICtQP6P1arUkH8b5wyitq3Cg7o3rbqSXvxsLIXtT1+/6Vnmw7z0sB3ERubWaq LS6MPLqy5D22E0bW+E3JuPOnuZplW2IFFAHeJCwE3++5Bbv3GjdREdp0fXPjyz04khBU3dfajyb dUhjeXfS2+6g5+h8vmk46xn5b4VCCFpsA4sQiDiApSN4zchfGQjskPb+eCg2fw8KadNnJyhAKz/ eey9TW0bugSHRuRp4IhXKba464Ft6ouNJNBsr7rmY6c/fNgnQhHc2G+XREPZ77gHcL+lc4m/zKI AevhFKlcAIROKaYyyYr2W7XSFPbyBLaZwKijqIZZN7kQ65cd/mM0LLgMs X-Received: by 2002:a05:620a:25cd:b0:909:e4dc:fb27 with SMTP id af79cd13be357-914b499fca8mr2868925885a.28.1779818816184; Tue, 26 May 2026 11:06:56 -0700 (PDT) X-Received: by 2002:a05:620a:25cd:b0:909:e4dc:fb27 with SMTP id af79cd13be357-914b499fca8mr2868919685a.28.1779818815704; Tue, 26 May 2026 11:06:55 -0700 (PDT) Received: from redhat.com (c-73-183-52-120.hsd1.pa.comcast.net. [73.183.52.120]) by smtp.gmail.com with ESMTPSA id af79cd13be357-914f881d91csm270637885a.44.2026.05.26.11.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2026 11:06:55 -0700 (PDT) Date: Tue, 26 May 2026 14:06:53 -0400 From: Brian Masney To: Joey Lu Cc: mturquette@baylibre.com, sboyd@kernel.org, ychuang3@nuvoton.com, schung@nuvoton.com, yclu4@nuvoton.com, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 2/3] clk: nuvoton: ma35d1: fix PLL_CTL1_FRAC bit field width and fractional calc Message-ID: References: <20260521014220.77955-1-a0987203069@gmail.com> <20260521014220.77955-3-a0987203069@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260521014220.77955-3-a0987203069@gmail.com> User-Agent: Mutt/2.3.1 (2026-03-20) On Thu, May 21, 2026 at 09:42:19AM +0800, Joey Lu wrote: > PLL_CTL1_FRAC was defined as GENMASK(31, 24), covering only 8 bits. > The hardware fractional field occupies bits [31:8] (24 bits), so the > mask must be GENMASK(31, 8). > > The previous fractional-mode calculation used FIELD_MAX(PLL_CTL1_FRAC) > as the denominator to obtain 2 decimal places. With the corrected 24-bit > mask the old divisor is wrong; replace the arithmetic with a proper > 24-bit fixed-point rounding to 3 decimal places using the kernel's > DIV_ROUND_CLOSEST_ULL helper: > > n_frac = n * 1000 + DIV_ROUND_CLOSEST_ULL(x * 1000, 1 << 24) > > Fixes: 691521a367cf ("clk: nuvoton: Add clock driver for ma35d1 clock controller") > Signed-off-by: Joey Lu Reviewed-by: Brian Masney