From patchwork Wed Jul 15 11:24:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 11665021 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04876618 for ; Wed, 15 Jul 2020 11:27:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CF2C72063A for ; Wed, 15 Jul 2020 11:27:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ww571w5z"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="2StrSXMg" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF2C72063A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4ryiESyJkd1Jfw9uQrnTQqnWtbSPLE3mICD0O3TP8FM=; b=ww571w5z+k6lE8sOzqkOB4gCf bG8YXSw8HPOp3ZbqZYpEMd+Sqse3hk3DsuHVl5/35UME0yhTyGo2pzoWEIWeBslfKbHgUWFsUYhGx xJ61RcbyrmX2E6vPCTB4C/2ohhgQonI4gL+zP/lLMG7qcyl3aH024LkaWRzxKicJ7m4C2RycvtYO7 YVxzIWe3PoqbmtC5vUWxqumvvevCkvFJ5Mds039JWi22+1dir/63RNtsiicAZu77WwcN+LInpybBn fp3IHOk9aJKLnfFTSdcYhH52nhSXdcPRANz1JFYWWH6xZcRICAZaXTVsUr9DAbwlbWRCWINIl9rwo pvgf+rYoA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvfXR-0004Yk-4d; Wed, 15 Jul 2020 11:25:25 +0000 Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jvfX7-0004Oq-RD for linux-arm-kernel@lists.infradead.org; Wed, 15 Jul 2020 11:25:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594812305; x=1626348305; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=RsPoKJ4J3O4xPV4BROlwwQyvlKQvA1BW5zhI6GJXNbI=; b=2StrSXMgTZq6lIGsszg86v9SsLRy4BiHRhxM/f8O5FbDzOqanlLXzinx +yqjOgb7Dhm0gDTH10ZroIt59p8kZR+o43BGk+VdGTqSVFQjYw12qGRA2 MMt9CfwrtyWy7ME84tgkvXLJHnyCZpic/e5XyCGKC/eQ3H4zAYfBw8h1V NAniS8WkVxNk55vkkJbpCfulK+U5yBVwlWVl4sg4jRy0P/2aBG5Cfpey3 CypECxR+RVtGFUDos/CmTFy6wwp9I9ONElR8pjnFHdck4Hj56mS8V4ews yLL7D4+h+3JOI93mmHbSW5TKK4bmCAm/cheiWiwr1AlcdHvYzthdf2TZB w==; IronPort-SDR: Ax53Xeo1wb4lypR1a1vJiOWikC00R9LmsXKlzPc/MWYnjtssmZPDxpLqHPwn33UoxvTNeAmTJ7 yGBYCGK+MGUuJ+cdRqFhqOBmW7ElPjze9+VXXoXAWSAhz12PioenQdlKccJcb2iDFkQcymlfAi LfaO4+XEFv1yVDSBvY5z0dmww5Z9tfMrZg28t300vsq7KhHGH7hN78H7x9mu/Vjfu+M8XRgeK7 Itl2qf6KYHzzAWw8O9kXU0FR55cbHMT/sM1DeBAl5eNSXON3M8Yh5+PgWx27CH6dKslPJYsgY0 JvU= X-IronPort-AV: E=Sophos;i="5.75,355,1589266800"; d="scan'208";a="79986126" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Jul 2020 04:25:01 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 15 Jul 2020 04:24:29 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 15 Jul 2020 04:24:25 -0700 From: Claudiu Beznea To: , , , , Subject: [PATCH 07/19] clk: at91: sam9x60-pll: use frac when setting frequency Date: Wed, 15 Jul 2020 14:24:15 +0300 Message-ID: <1594812267-6697-8-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594812267-6697-1-git-send-email-claudiu.beznea@microchip.com> References: <1594812267-6697-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200715_072506_021897_BAEBA8C2 X-CRM114-Status: GOOD ( 10.04 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [68.232.154.123 listed in wl.mailspike.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Claudiu Beznea , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bbrezillon@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org In commit a436c2a447e59 ("clk: at91: add sam9x60 PLL driver") the fractional part of PLL wasn't set on registers but it was calculated and taken into account for determining div and mul (see sam9x60_pll_get_best_div_mul()). Fixes: a436c2a447e59 ("clk: at91: add sam9x60 PLL driver") Signed-off-by: Claudiu Beznea --- drivers/clk/at91/clk-sam9x60-pll.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/clk/at91/clk-sam9x60-pll.c b/drivers/clk/at91/clk-sam9x60-pll.c index 00f2afd6e9b6..13e15bd48770 100644 --- a/drivers/clk/at91/clk-sam9x60-pll.c +++ b/drivers/clk/at91/clk-sam9x60-pll.c @@ -16,6 +16,7 @@ #define PMC_PLL_CTRL0_DIV_MSK GENMASK(7, 0) #define PMC_PLL_CTRL1_MUL_MSK GENMASK(31, 24) +#define PMC_PLL_CTRL1_FRACR_MSK GENMASK(21, 0) #define PLL_DIV_MAX (FIELD_GET(PMC_PLL_CTRL0_DIV_MSK, UINT_MAX) + 1) #define UPLL_DIV 2 @@ -55,7 +56,7 @@ static int sam9x60_pll_prepare(struct clk_hw *hw) unsigned long flags; u8 div; u16 mul; - u32 val; + u32 val, frac; spin_lock_irqsave(pll->lock, flags); regmap_write(regmap, AT91_PMC_PLL_UPDT, pll->id); @@ -65,9 +66,10 @@ static int sam9x60_pll_prepare(struct clk_hw *hw) regmap_read(regmap, AT91_PMC_PLL_CTRL1, &val); mul = FIELD_GET(PMC_PLL_CTRL1_MUL_MSK, val); + frac = FIELD_GET(PMC_PLL_CTRL1_FRACR_MSK, val); if (sam9x60_pll_ready(regmap, pll->id) && - (div == pll->div && mul == pll->mul)) { + (div == pll->div && mul == pll->mul && frac == pll->frac)) { spin_unlock_irqrestore(pll->lock, flags); return 0; } @@ -80,7 +82,8 @@ static int sam9x60_pll_prepare(struct clk_hw *hw) regmap_write(regmap, AT91_PMC_PLL_ACR, val); regmap_write(regmap, AT91_PMC_PLL_CTRL1, - FIELD_PREP(PMC_PLL_CTRL1_MUL_MSK, pll->mul)); + FIELD_PREP(PMC_PLL_CTRL1_MUL_MSK, pll->mul) | + FIELD_PREP(PMC_PLL_CTRL1_FRACR_MSK, pll->frac)); if (pll->characteristics->upll) { /* Enable the UTMI internal bandgap */