Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2823740pxv; Mon, 12 Jul 2021 02:49:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSfRDUUZS8g7HqBB/u05YHoc7bPFuj4tNtT463edkN0mOCLYk2WgNEF6dH8zjA120LPXv9 X-Received: by 2002:a02:942e:: with SMTP id a43mr44631552jai.74.1626083396214; Mon, 12 Jul 2021 02:49:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626083396; cv=none; d=google.com; s=arc-20160816; b=TZwz2b+Oaxjplg2nQeOYA8BN14rygz0xVcFm4qIyPo5A+zqDFAvf59EGc+fUmj4pFc +23TLUU6+qo4m8fCCl2Q6osUEJl5LVyzqwUzHR159L6TAEv3tAM8HDwHrKLtTIADX5xu riJOzMdvLECsI5lEhYOsy3HTldZ8TH5zDoSW7XG+FAslMQIyFMERf79aOvPIBYV4x5Ay oBrWhHC+QBfkIzF1UX4yLSBlV9bvcpQC7/da30LQIRLcfozM3dNY0RXT98KDE6rrQrnH De+h5xMyRUo42++YHMKnAn2OfEkGxcGCUIcE0BoOJMRsIzbWB9QAGKzN2E+mO0faM9lG HqwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zS32CziMIw0RHTupO3u3yzBJuKL3DCUQhkINx6mJpvw=; b=E8xLGEiYTONLmL6dL9C79WAr1EZir6bZMjpGlg6JwPyW9vMxdtV668uhjFUYLXXUul kR398Y+/N7dePsBMnCXhKyd19goSNoYKArQmtulQbXEykeJ7aECi2p3Ln7SxVUewRZWV g2JYGKAmcq1bPFj/4ykSKckjV80uKeC5B6tRk9ofmNCfkCmELtyURfxPKAoBngdDDMLO /8MZ+fuPeU8JUV/AU8DsIH+ydvj+ztr2x14PD1Cp88mig+QVnKYOJMRlDUrjUauZpdyP xpcPhMQIW8nMAvvZe9j2akoc2lFdbnLKy7Ol3S4jLK7qmpQIGqKBCmFVRk3nAcUyZT9U AOmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BdGI3jb2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r9si16857446jad.24.2021.07.12.02.49.44; Mon, 12 Jul 2021 02:49:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BdGI3jb2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236738AbhGLGpe (ORCPT + 99 others); Mon, 12 Jul 2021 02:45:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:54932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236436AbhGLGfO (ORCPT ); Mon, 12 Jul 2021 02:35:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9D6D260FE3; Mon, 12 Jul 2021 06:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071534; bh=dV9evPm4c2ZbaBBpgB8FzfTBMxhDUnAlW3rio1MYS8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BdGI3jb2TZ+9mRuNMwARZw7UazRfJ5acR+TZqPzU0ZrxY43gfQckuHgnsLNXp0hCd wj7Np+DAWeZNg+GMaxzsB5Xh9hfODKd2FlpX6BWU+KMH3TjwrSHW0flei3SVVRT0Qo LjYyr5/m3XiwXqSwdx3Z9HsL5mxdJC+WGkom8NrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinh Nguyen , Stephen Boyd Subject: [PATCH 5.10 068/593] clk: agilex/stratix10/n5x: fix how the bypass_reg is handled Date: Mon, 12 Jul 2021 08:03:48 +0200 Message-Id: <20210712060850.646680444@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060843.180606720@linuxfoundation.org> References: <20210712060843.180606720@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dinh Nguyen commit dfd1427c3769ba51297777dbb296f1802d72dbf6 upstream. If the bypass_reg is set, then we can return the bypass parent, however, if there is not a bypass_reg, we need to figure what the correct parent mux is. The previous code never handled the parent mux if there was a bypass_reg. Fixes: 80c6b7a0894f ("clk: socfpga: agilex: add clock driver for the Agilex platform") Cc: stable@vger.kernel.org Signed-off-by: Dinh Nguyen Link: https://lore.kernel.org/r/20210611025201.118799-4-dinguyen@kernel.org Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/clk/socfpga/clk-periph-s10.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/clk/socfpga/clk-periph-s10.c +++ b/drivers/clk/socfpga/clk-periph-s10.c @@ -49,16 +49,21 @@ static u8 clk_periclk_get_parent(struct { struct socfpga_periph_clk *socfpgaclk = to_periph_clk(hwclk); u32 clk_src, mask; - u8 parent; + u8 parent = 0; + /* handle the bypass first */ if (socfpgaclk->bypass_reg) { mask = (0x1 << socfpgaclk->bypass_shift); parent = ((readl(socfpgaclk->bypass_reg) & mask) >> socfpgaclk->bypass_shift); - } else { + if (parent) + return parent; + } + + if (socfpgaclk->hw.reg) { clk_src = readl(socfpgaclk->hw.reg); parent = (clk_src >> CLK_MGR_FREE_SHIFT) & - CLK_MGR_FREE_MASK; + CLK_MGR_FREE_MASK; } return parent; }