From patchwork Tue Sep 12 04:51:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13380663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79893CA0EC9 for ; Tue, 12 Sep 2023 04:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=X1rQyWyK5rRjLwFKBUkZoY79ZwF5P3hYQ6b5XTapi5g=; b=jnnJj1nE/m3sTu Hn2oElg/IH3Nwc2y55/qZdIz9TZEzmsqda8bZ18xbUeQ+rWYkdYycTlMj85WKBJ6LMzTACLN5OPIQ upEPACSmBeR+5PtpVgOmPiyORPWzH6zhHoDPBeACORdvQlxk5exlZ8lY4dP9P3L+SN71ROwCbeZv1 BjpTYCsLJuW9Dv24P+jrzCWAziFcCoYqGZFumd2Us1ckbxmPoJgJKC+4ww9xXsDMrETLpWAn8tWco l9ScIxKS+iOFMXgqPafU6BNUNw9pC6GC/Ie1cqJCYheJWTWtyOsJaa6534lyqJ7JtUUG6IRWQbUpF Dw+57imzexL3MkZv48IA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qfvOB-0027RV-30; Tue, 12 Sep 2023 04:52:39 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qfvO6-0027O2-1m for linux-arm-kernel@lists.infradead.org; Tue, 12 Sep 2023 04:52:35 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-52eed139ec2so5037214a12.2 for ; Mon, 11 Sep 2023 21:52:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1694494353; x=1695099153; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=snUK6IGdcPPH31oyrmWJb6PGm1SWgHHvAW8FtA1dRGY=; b=WkmrhdlUldKupswmy/Fg+hprWFqH1/gh1ICO9HQm/z1h8Wd9sGSbyR+XB1EC7fob4i 0VZS7YkHmcDV4QCbnNlRuNDd1WGBJkEkSWV2vtiv52hHCEn82IQQ+c67cMHqjSVeh9vB PQn05RBxT/2Px933v5UhtatkM9Xo1qdC0AhyS+0shJuAboH3s43MtisXeNXiy40qRARW QYLi6esyvGBu4PDU3nyKkHAAajefg1GEd71aPL9M+/rA14UZcIz3erI8uOzK5JCiqWIB 7150Qwv1aTTr0gEGrdXFn8TFSJJLA2yh8yufwFotPJHcarmbDtGaSE7cEo3hY85bVYrE 4Dpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694494353; x=1695099153; h=content-transfer-encoding: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=snUK6IGdcPPH31oyrmWJb6PGm1SWgHHvAW8FtA1dRGY=; b=OyvM2YJfVVSSuA9GjkGi0MQTCuHk6EhiMEnSG53gwhLnPjPH+39DWPRayi4VLt18hH qxm6Jj9Xa5WLxBinxW4oJSu4RijkuPphNyw14ctYlkx3bVKk81KLrnYv6OuADkQc1Qyx L0xwA5Hum6s036T7fhV4JAu3Rk+c15XRAYaSJySxOJle9KTjT9xUUdK2vxcOvEod+Ilx xrNbhnwREIs280uCSNcnTv30IHa/pO0qfhemcFNCORMsqGV3qtqNJ9O0y+8fyFldlrYw 2lzpWjvnJXS4FQilEJLKHOa1bxlJpFE7ta6JpEmsRZZFtH6Smv6hi4uH8kGPi87Xg1nQ hwXw== X-Gm-Message-State: AOJu0Ywb0RZtzreeatuh3USh5l3wxYowrDaKA8XALQNgvDRabwRN+zss BVI7rWs/czbAYH0n+n7Hp4hGNw== X-Google-Smtp-Source: AGHT+IFPU8acqypJwJGWtWMHEWY4tPoDnTqyGjoIpvI9ATueUsR1/PPIgOlRCJv9LKZVFhbCP8k9Pg== X-Received: by 2002:aa7:df08:0:b0:52e:585a:e9c with SMTP id c8-20020aa7df08000000b0052e585a0e9cmr8579509edy.2.1694494353384; Mon, 11 Sep 2023 21:52:33 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.145]) by smtp.gmail.com with ESMTPSA id f21-20020a05640214d500b0051e22660835sm5422415edx.46.2023.09.11.21.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 21:52:33 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: geert+renesas@glider.be, mturquette@baylibre.com, sboyd@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, magnus.damm@gmail.com, catalin.marinas@arm.com, will@kernel.org, prabhakar.mahadev-lad.rj@bp.renesas.com, biju.das.jz@bp.renesas.com, quic_bjorande@quicinc.com, arnd@arndb.de, konrad.dybcio@linaro.org, neil.armstrong@linaro.org, nfraprado@collabora.com, rafal@milecki.pl, wsa+renesas@sang-engineering.com Cc: linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Claudiu Beznea Subject: [PATCH 08/37] clk: renesas: rzg2l: trust value returned by hardware Date: Tue, 12 Sep 2023 07:51:28 +0300 Message-Id: <20230912045157.177966-9-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230912045157.177966-1-claudiu.beznea.uj@bp.renesas.com> References: <20230912045157.177966-1-claudiu.beznea.uj@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230911_215234_592728_B67B093F X-CRM114-Status: GOOD ( 11.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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; } static const struct clk_ops rzg2l_cpg_sd_clk_mux_ops = {