Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp300121lqp; Fri, 12 Apr 2024 20:02:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVh188piC97R7nc+NYQBKybs5AQKC8kwsANp5nBEfPh1fyxBxfTqHqtctTz10dwQGy+Z2OOxTvUCDm3M9vUokMJ0CQYNLmmQTm1mnNP+g== X-Google-Smtp-Source: AGHT+IEJUbjhfdNXxRpTXTMeH+D3MvUw5OTaTCunQVMb5C0+vns+q+J3JgA+x9BiCvHgIYt9a7Rf X-Received: by 2002:a17:90a:989:b0:2a7:a36c:140b with SMTP id 9-20020a17090a098900b002a7a36c140bmr86488pjo.36.1712977339255; Fri, 12 Apr 2024 20:02:19 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bv5-20020a17090af18500b002a2c4433db2si4381942pjb.85.2024.04.12.20.02.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 20:02:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143529-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=fXyK82n3; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-143529-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143529-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E5438283687 for ; Sat, 13 Apr 2024 03:02:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64D3C182B9; Sat, 13 Apr 2024 03:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b="fXyK82n3" Received: from IND01-BMX-obe.outbound.protection.outlook.com (mail-bmxind01olkn2094.outbound.protection.outlook.com [40.92.103.94]) (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 F319E17C6B; Sat, 13 Apr 2024 03:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.92.103.94 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712977331; cv=fail; b=AS732bIbinp2RBzTAme5ULAVXKKgT/LokWqPCWN3ZNZGp78kFvn0+n725cKmJICIcjo1j/iigvASlkiFS8XI8deW6jafE2fGpafnMW/C79FElm1x4XZUQwsed+G+LzrBZ5G9wq9V0a0SxvCrk4SyZNZ91thA93h3nHUzF4z7Rj8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712977331; c=relaxed/simple; bh=eI3/cGQVs7cD0+cEk8GrEaUn/OHxY86iYBSv9/mljlg=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=XNGzaFyqoAjae76WxYD4ZcvANh1bPXYANAC4YSPUxT9MAKDQXWtI6OSD/yC5lioqxtfxCMVMYkOpesHb7Tgs6a+RnFrYGKjaNq9762xmtbzTm7DektIUkv4hGmfcsY78yqNz2c/XspDUjfIu4OXU4Y2WK1oHny9UmCpzmg8QBZA= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com; spf=pass smtp.mailfrom=outlook.com; dkim=pass (2048-bit key) header.d=outlook.com header.i=@outlook.com header.b=fXyK82n3; arc=fail smtp.client-ip=40.92.103.94 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=outlook.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ll9Smud7Oj+XdhPg7HJNxwvll6DEjzkhH1On9IuGNwYDaTEDiKMh4EvrySAGX6vupOV927W0jxImAFlA/mLwTl4Hrsd/xNo+vlHJJ8PAnHiwh2dyD22sNPlP5sQteCZ4cE+YolYStP94Z5GEVI++LDuVCY2Al7dnDdwnjjw+7Y1nd0RufYweFelS/MjrwVHpgndNKdeaETwrwa7u1ijmpmrB0Q+d2OBqcZsTHBEGackYCRcIXGM/OjHhj7OFUl4xq7MqK5RZEOlqy1WkZW9/FCK2ZVhnFBkQf48xjaXKZZ4Rof6nxxP86b5fBK768dkIbcv5Ue2LPXozaCgcD4Mg3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zMXcLgEhEt/s6IyuoMWXRDR4rg/L1N7i7CS14TddycY=; b=XNcgvANuzSk9sZz/x3fFEWAN844vWMiOgA4+ZIw6cTa9HZgZMhxBeIol4NlBkhm8Oep9tw9kXGKfPBzxtjoUzMpt1/3SlDu4eUWfwS4ue0VMMgJeCsq2DzKlplmFw46NvHadQxcUZSCevp4+olLRPLzyztQOCYODMbkvN68wb4kUNk4pRc9AaanZhuIdx5bvB1lKGj1MA99O9YHz1qVHAXachLOYIy59Y5AWbjY7ApPw5Zb4x5WtMstaFCgXqBPwWKh6jAGJLZXvbt//g1x3kU50+q6bocJCh7lM5X6b/YuhqFtg4LHr1tcNK8HbADq//L32uNdylZOYPoo+TLXcFA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zMXcLgEhEt/s6IyuoMWXRDR4rg/L1N7i7CS14TddycY=; b=fXyK82n3/BQOKFObGBxIhL0gesI8JH9Ahv1PxQmyPhQKuZRBLkMw6Z1wdbWoow+t8kE9XG4Bob/ab1tNCZrAUbgVJ/AkgKIt74PmuG+9ex6T5dnIEX+0NmQBLFnUZT8YQIZou7AuAKWboa3fe9mlzuECenkfOdbOWfnYUVqEfGYvBIHO35X2eDbRbs2TQCZ3ebWCmwhhYM4TtbBqM3aFHWnq8JsdQpHm30YucDLXW9m/E7YC1mQHz2m5CFKGwsfuU3LTKR8wjY/KJE6mXK53EyoGT8U6FyU8++Y8zPQuGKjkqDw9pc5DAwPrX5CAeP+KUVrUJRpli/tI0aXj7LJESw== Received: from MA0P287MB2822.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:138::5) by PN2P287MB0125.INDP287.PROD.OUTLOOK.COM (2603:1096:c01:dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.55; Sat, 13 Apr 2024 03:02:04 +0000 Received: from MA0P287MB2822.INDP287.PROD.OUTLOOK.COM ([fe80::664:2ecc:c36:1f2c]) by MA0P287MB2822.INDP287.PROD.OUTLOOK.COM ([fe80::664:2ecc:c36:1f2c%3]) with mapi id 15.20.7409.046; Sat, 13 Apr 2024 03:02:04 +0000 Message-ID: Date: Sat, 13 Apr 2024 11:01:58 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] clk: sophgo: Use div64 for fpll rate calculation To: Inochi Amaoto , Michael Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot References: From: Chen Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TMN: [2oKf9PP2sQW6ZR2T+9uvxRwUsdp2z0Qu] X-ClientProxiedBy: TYCPR01CA0175.jpnprd01.prod.outlook.com (2603:1096:400:2b2::15) To MA0P287MB2822.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:138::5) X-Microsoft-Original-Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MA0P287MB2822:EE_|PN2P287MB0125:EE_ X-MS-Office365-Filtering-Correlation-Id: 0dd1d5ac-1754-46be-0ce7-08dc5b6618d4 X-MS-Exchange-SLBlob-MailProps: P1EfU6pZOd+ZDkBo6jAcVAy+QTb9tiEWMm5bHjFmdrD8ZE+bzWlkFd3fNKlyHL+0FkewdtPGeTtVWAfA9aAC2SuDwy4RufXjGnUYhwHHaD54Vbya6MDqsNtQEQJexe1yxLuAJ/pE9MzO42m9WstGHuwTkrTaObWmfcq6jT6scY2gF9XRBWIlLONqfcNyNYiMH1DpQrIrn0buBTrewpdLGbpUuqv6K//C/pgzBDN4d7sQoAZaxzbTthutOTvxBunnQCdPhPnSRkKcUEIGInbSgTTYMrCcHL0ixkDGath9K4RZDYx130xTpKA0qbe6WkZ8qGrUxx0alLxP1u29lJQnNV1lJPqzkIwAF2BNR3lGiI1SIppjOwT9V/yoZpN/38PNLFUttZdEO0yXKjLFWQ6O6flAF3Cf48+O64dNGbJCLNePywOzJAx5w3Efx1sH2RCUsdey01EEpka0hlVaPPsx0kuMGI1B0SgQ/BxYikxs5Ys+7YMcK8aAfTxLhvFCCVBbwrWhiCIcDYLuIxpGtpyTjpZcYOw1bYmG1KctlGz29cTSfC48SrcAbUZub5v6rGhmq4XitcId96mJHbCVyCRBfCze7jTiQdGx5U3tEOOlVv9+a2LElMyF9D11uExEYwidhIEWqdZX8g+MBAOs1/JeYJ/Z2R64dlCtmdEk6hqJB7BpWMaOebXdW0NkyaJmDoS+1JYY2sCihfeo1y/MxVKlw/sxfUlyqtLeBJyVUcVh/9e7ibiyVF5DEwt+fyexUGg+1zuw+JgPMLWbliLmXr/1JS1UW8od49SO1418GfKInuON5sM8BfgCSg== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: o59+HQCaBkyQKUORIK5lT64x0dbGsLoAHa4xSz0/dDJkyWdWVTzV+hTC557gHMCZB2D7zaZkiMeFQBl1SenP50Qt6wMb4e5q1sO4ujvrqYKyhZRhMiRVVDBi+endf5Rha1E3rGHSbmaxSGF7fwrTXRp2qClIdgXhCtMtlb3dzBAUyQ1ngYy+FXcmV1EFJ4Z5H/CbxpEhDM62LYFL38Wcb/4Z0nOtrThpm6zeDxNHc8p/BclzIxILjLndEs+F+agLHSDsC3uGq3p9iB+AB5GQPsdPZJn54nUafBnR9VjeZTmR60+oOGKE4wdhOso7Bl+NotLMnyvSoHlhJq+H21YHMNPzUhAGDQLWoFgzRGhEFNYnDtPKdTvJ0jlPaHz5d+Tw0P8SS1ZFZZC7b206FII3kaU+xFy1WzE7xKoMZM6oih77MTRdL8u+uri4z561J33hMKuNbTpIzfcxcMwRKv/323Kjbq20gS8MGs2KuR7Cj3mgjJlbEqnhOXQinq+BoD59WSvxCOT8w07jqXxMAoCdC0BpoK56202Adms7xESsHjAAxswTjRidluAZzcDG0Jv/sgfAMYwo+1I49R8aHOLDZ5gwN2OFniMV/sqbVx3QAgxr28qcKv7brSQdzgMP/NPVrGKvlB0zSQ45RfjrOTnbIMPYWfhAr8TR26MhG8v5bYH8Bx7Wf0A7uJgPRcLlmrCC7+eASOaAhZREsufgLsDTKA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?a2JZOEI3emx6d01TbmdjNUZMV0t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MktqaGlRa09EdVBXMEd0bnp5VU8zUzRQb2xCTHl6a2pDeExsaSsw?= =?utf-8?B?RXVsdzBKN016cDc1WjRzcW50NTh6dFJXWTN5N3l6U2w5Y1EzcEkxeFZaZ01R?= =?utf-8?B?NlN6ZGw5M2RwbE9TdUMyU2tXZFF1WkplWTdJV2xsNXBSSWJUNXkzYTkyMGdz?= =?utf-8?B?NFdyaUc3ME8vOHdJSFYzL09oMnc4WHE1ajZOL3VQY3ZuTmV5QTFlYXNvTnNI?= =?utf-8?B?N0toOTBOSmlRTkVRWDVXREdxV25SSllvbUY4WGhvTzYvY1pqcE1ocFVkcG9p?= =?utf-8?B?cEF0K3lYaHBKWm5GUFQrNXVwTkNuTUpxYkh1MHE2MzZySDZEYy9uVGI0dmM3?= =?utf-8?B?OTFQL1B6VHF0NkdjVmlMWnN1RkxUWWVXRnA2UENXRys2Mmw5Y3hvQk13cHNh?= =?utf-8?B?MWtJUkdWTXVQQVdLbGtIc1ZMOFJaMFVlakp5UFo1NVVpU1ZZam05VGU2UmEx?= =?utf-8?B?ZlRlbHJRc3Z2bUVzZEpTOWE5cXRETmR3U2lpakZwVmVUNGFxaEhiei9xOWQv?= =?utf-8?B?ek56cWc1T244WWJ2LzM4bGJQVDFsZjYyTlZ4dG9iVUlNR3FJVmpiQm1kUXNP?= =?utf-8?B?VCtKZzIzeVBDWUQxcE14MFhVSEJVREI2ZWtqRklucXM3MEZFelIvQi9BQlBr?= =?utf-8?B?WlZZeHdoNVMrNVd6NEltVkFRNXA4QmhMVkNwODdOQ0k0OWp4SHVhNGRUYXRL?= =?utf-8?B?bjJBSHpzcVBQTjFpbklxZk9wWTB1L3RSL2owOC8yNzkwMVpNa3U4ejU4M2h1?= =?utf-8?Q?lm9U/yHfwC8D6uQY52W3?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0dd1d5ac-1754-46be-0ce7-08dc5b6618d4 X-MS-Exchange-CrossTenant-AuthSource: MA0P287MB2822.INDP287.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2024 03:02:04.3748 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: PN2P287MB0125 Just a minor suggestion to add soc name in email title to differ against other sophgo products. This can be handled in later patch if any. Reviewed-by: Chen Wang On 2024/4/13 8:53, Inochi Amaoto wrote: > The CV1800 SoC needs to use 64-bit division for fpll rate > calculation, which will cause problem on 32-bit system. > Use div64 series function to avoid this problem. > > Fixes: 80fd61ec4612 ("clk: sophgo: Add clock support for CV1800 SoC") > Signed-off-by: Inochi Amaoto > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-kbuild-all/202404122344.d5pb2N1I-lkp@intel.com/ > --- > drivers/clk/sophgo/clk-cv18xx-pll.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/clk/sophgo/clk-cv18xx-pll.c b/drivers/clk/sophgo/clk-cv18xx-pll.c > index c546dad1791c..65aba3b95cf7 100644 > --- a/drivers/clk/sophgo/clk-cv18xx-pll.c > +++ b/drivers/clk/sophgo/clk-cv18xx-pll.c > @@ -6,6 +6,7 @@ > #include > #include > #include > +#include > #include > > #include "clk-cv18xx-pll.h" > @@ -202,18 +203,18 @@ static unsigned long fpll_calc_rate(unsigned long parent_rate, > { > u64 dividend = parent_rate * div_sel; > u64 factor = ssc_syn_set * pre_div_sel * post_div_sel; > + u64 remainder; > unsigned long rate; > > dividend <<= PLL_SYN_FACTOR_DOT_POS - 1; > - rate = dividend / factor; > - dividend %= factor; > + rate = div64_u64_rem(dividend, factor, &remainder); > > if (is_full_parent) { > - dividend <<= 1; > + remainder <<= 1; > rate <<= 1; > } > > - rate += DIV64_U64_ROUND_CLOSEST(dividend, factor); > + rate += DIV64_U64_ROUND_CLOSEST(remainder, factor); > > return rate; > } > -- > 2.44.0 >