Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2712144rdb; Tue, 12 Sep 2023 09:47:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEpxAo+WzU2k2VfFzWRe2WKsrKZQJcvIKPX0vz5NoirH9x004PkQA8TKWHrdz3bJJ5T1Ng X-Received: by 2002:a17:90a:cb06:b0:26b:24ed:e0d9 with SMTP id z6-20020a17090acb0600b0026b24ede0d9mr11837278pjt.33.1694537249794; Tue, 12 Sep 2023 09:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694537249; cv=none; d=google.com; s=arc-20160816; b=auc07oMHWmdBjvlUYZJonHRxiJS1GRYKn3Z67ADuyNF5y2WDzjRhRg6SMWYW2MA50L as2czs7Cw6QIoxIf7cUm8Cuq/qeFQBfb9lFLh1848jY2D2zbFLhM0ti818Gd3a/6FeA7 pVo8DFluFHkWuLfjUFfU/0kt/R8YHXi2+MlSPuTm7MvEGpaRWXjI+Pcluy3HarYEyP/t NJ/8zpgC65zXJEAm3KK1ws+fJtueGB6udMUYKJ1lUDpbvstzGijbc1xTFKLU4FbP7fsL ygg2z69LI54Vr3OzMp1AYvkbc7LqNf96smAPzLF+47tQrETvZokYLAHj2xERNhWfZa2G NLng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject; bh=yOkk61u+qrIjPLnRwHcu00MXCk4x9UYSq/AIP9/lSzM=; fh=Y0vKSr3+d+40V+TI/oERLHYE1C3TyP9tH+lX0Ia4e/0=; b=dFYftKNiLqcrvKSVsaEmr5b3OK6Q5MJlpsq3vgZP0CCkNFIs1clxvehmgQ9AsoZXwV k7tRm++deu2ezk7rKN+sV/f9zEd2J33s7Cz4Ne4LFAKnbHZwUdfcLfa01+EYn0sl+UJH rhg5bnEh3Qokt90nluEXwScg5U6iYLDcFmywn71S6JsmZN//8ZofU5Bvqi/iFIr8CyhK iXouEEpWGtRx7AzOBf6FvpQra8CEOYDq0STOqv0BY6SFfNXJz2bBvD8fG9OfCEEnLjnb 2dxTz4nEibQHlh5elEXgcLBrt8erpxkFDTNMWEMitz5pRDVs1bwjD3lytuaqLeDV6XRZ j4oQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id lp6-20020a17090b4a8600b00262f0035181si10175680pjb.26.2023.09.12.09.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 09:47:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 79ED181BFCD0; Tue, 12 Sep 2023 09:44:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236997AbjILQoE (ORCPT + 99 others); Tue, 12 Sep 2023 12:44:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234829AbjILQoD (ORCPT ); Tue, 12 Sep 2023 12:44:03 -0400 Received: from mx01.omp.ru (mx01.omp.ru [90.154.21.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 349DC115; Tue, 12 Sep 2023 09:43:58 -0700 (PDT) Received: from [192.168.1.103] (31.173.80.111) by msexch01.omp.ru (10.188.4.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.986.14; Tue, 12 Sep 2023 19:43:52 +0300 Subject: Re: [PATCH 08/37] clk: renesas: rzg2l: trust value returned by hardware To: Claudiu , , , , , , , , , , , , , , , , , , , , , , CC: , , , , , , , , Claudiu Beznea References: <20230912045157.177966-1-claudiu.beznea.uj@bp.renesas.com> <20230912045157.177966-9-claudiu.beznea.uj@bp.renesas.com> From: Sergey Shtylyov Organization: Open Mobile Platform Message-ID: <8490f909-c0ad-5a6d-7a97-03c80a8b47ba@omp.ru> Date: Tue, 12 Sep 2023 19:43:52 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20230912045157.177966-9-claudiu.beznea.uj@bp.renesas.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [31.173.80.111] X-ClientProxiedBy: msexch01.omp.ru (10.188.4.12) To msexch01.omp.ru (10.188.4.12) X-KSE-ServerInfo: msexch01.omp.ru, 9 X-KSE-AntiSpam-Interceptor-Info: scan successful X-KSE-AntiSpam-Version: 5.9.59, Database issued on: 09/12/2023 16:20:25 X-KSE-AntiSpam-Status: KAS_STATUS_NOT_DETECTED X-KSE-AntiSpam-Method: none X-KSE-AntiSpam-Rate: 59 X-KSE-AntiSpam-Info: Lua profiles 179815 [Sep 12 2023] X-KSE-AntiSpam-Info: Version: 5.9.59.0 X-KSE-AntiSpam-Info: Envelope from: s.shtylyov@omp.ru X-KSE-AntiSpam-Info: LuaCore: 530 530 ecb1547b3f72d1df4c71c0b60e67ba6b4aea5432 X-KSE-AntiSpam-Info: {rep_avail} X-KSE-AntiSpam-Info: {Tracking_from_domain_doesnt_match_to} X-KSE-AntiSpam-Info: {relay has no DNS name} X-KSE-AntiSpam-Info: {SMTP from is not routable} X-KSE-AntiSpam-Info: {Found in DNSBL: 31.173.80.111 in (user) b.barracudacentral.org} X-KSE-AntiSpam-Info: {Found in DNSBL: 31.173.80.111 in (user) dbl.spamhaus.org} X-KSE-AntiSpam-Info: 31.173.80.111:7.7.1,7.4.1,7.1.2,7.7.3;omp.ru:7.1.1;127.0.0.199:7.1.2;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1 X-KSE-AntiSpam-Info: {cloud_iprep_silent} X-KSE-AntiSpam-Info: FromAlignment: s X-KSE-AntiSpam-Info: {rdns complete} X-KSE-AntiSpam-Info: {fromrtbl complete} X-KSE-AntiSpam-Info: ApMailHostAddress: 31.173.80.111 X-KSE-AntiSpam-Info: Rate: 59 X-KSE-AntiSpam-Info: Status: not_detected X-KSE-AntiSpam-Info: Method: none X-KSE-AntiSpam-Info: Auth:dmarc=none header.from=omp.ru;spf=none smtp.mailfrom=omp.ru;dkim=none X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Heuristic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 09/12/2023 16:26:00 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 9/12/2023 3:17:00 PM X-KSE-Attachment-Filter-Triggered-Rules: Clean X-KSE-Attachment-Filter-Triggered-Filters: Clean X-KSE-BulkMessagesFiltering-Scan-Result: InTheLimit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 12 Sep 2023 09:44:07 -0700 (PDT) X-Spam-Status: No, score=1.3 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email On 9/12/23 7:51 AM, Claudiu wrote: > From: Claudiu Beznea > > Initial value of CPG_PL2SDHI_DSEL bits 0..1 or 4..6 is 01b. Hardware user's > manual (r01uh0914ej0130-rzg2l-rzg2lc.pdf) specifies that setting 0 is > prohibited. The rzg2l_cpg_sd_clk_mux_get_parent() should just read > CPG_PL2SDHI_DSEL, trust the value and return the proper clock parent index > based on the read value. Do this. > > Fixes: eaff33646f4cb ("clk: renesas: rzg2l: Add SDHI clk mux support") > Signed-off-by: Claudiu Beznea > --- > drivers/clk/renesas/rzg2l-cpg.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cpg.c > index 1195d4b1f545..d0d086d6dc51 100644 > --- a/drivers/clk/renesas/rzg2l-cpg.c > +++ b/drivers/clk/renesas/rzg2l-cpg.c > @@ -239,14 +239,8 @@ static u8 rzg2l_cpg_sd_clk_mux_get_parent(struct clk_hw *hw) > > val >>= GET_SHIFT(hwdata->conf); > val &= GENMASK(GET_WIDTH(hwdata->conf) - 1, 0); > - if (val) { > - val--; > - } else { > - /* Prohibited clk source, change it to 533 MHz(reset value) */ > - rzg2l_cpg_sd_clk_mux_set_parent(hw, 0); > - } > > - return val; > + return val ? --val : val; return val ? val - 1 : 0;