Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp625938pxv; Thu, 15 Jul 2021 11:52:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+a7TmhF+DSzFeeQNJl5z+wcsbGqU3ICJgiEVVvaeFxcuST68ymEwEa9bjhi8MCz32JbY6 X-Received: by 2002:a92:c644:: with SMTP id 4mr3732470ill.246.1626375162644; Thu, 15 Jul 2021 11:52:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626375162; cv=none; d=google.com; s=arc-20160816; b=mnHaOoXeQG6FSlXMvKTcNYgj/8EyYsn8kFKOHi2ivQ4LZ14+54ScTOCGrhmSsh8n64 4Uab+TiWIfIdoOxLD18qRABWTIzeIIl9ZZxYSewYa/UclxudyuALe+wzj4YU4C5mUnO6 TN1BK0THtM9cSy9RMkbc+By1BOWEsZX/Nrsts8j9GXSWrd79y+ALHQ75+PUgwwFEQFoa AJFYDaPDAos8x9iLPF3JJl0yhz9B22Kf4CLTJwLohOoitcbQc14MvdhsdoJLCsP+egdm mVY7n3Bt6x3h/e45swb3pnMk6jFL8/ZcFWoWrmfXMYLo5ohFIICzOTlJfhHQ3/eZwDBH vwBQ== 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=cajhcOOAth0QVRPn+H4i419FuTnGxdJbSGMyHBAPomQ=; b=wMzI4r4Ip5tmdEG3hKHLwKb/Os9Sa1rms6u5QvABl/SWoUuE17P3KeGHkLLqK/390Y gvM6CXazyC6nnSF937O5UOLSGzYbqBAtPmJmxXWTwr6jlsPu5SLefd55U50BaHTl3AL6 O3SUUw1N0hKCBCpok9CFqrJ/79igHFLx/zqgJ/C9VCuH+sWG+s4X4wRXt2QYoMmQQNZz UwDH3HCTOkSvFc/PSHTjw+wNB9TROV+KftJhMQN3vffFzv9uACH//wI1u22VKW+y+Wvp Yhfula6spcJY0AMEggt5HD4/ptYpd9I3pHWJ8rxenVNTdgTIY84yEHVvUBr2vd0gdolC +Frw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VnJJJLS+; 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 m4si7514835ioy.95.2021.07.15.11.52.30; Thu, 15 Jul 2021 11:52:42 -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=VnJJJLS+; 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 S239058AbhGOSxC (ORCPT + 99 others); Thu, 15 Jul 2021 14:53:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:52524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239708AbhGOSt7 (ORCPT ); Thu, 15 Jul 2021 14:49:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE996613DF; Thu, 15 Jul 2021 18:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626374824; bh=J9jzMF9UE8azGOzNI1ZPfuhQllO46jyFP0pJ2whawEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VnJJJLS+bJYOf9gezOwukFz9Qok6ziHcBmNJgTrWTt5nbHSaqxj2Eon4rgwYnhWSy /8AStiwJeYZsVxUqxP212/Tdkbs7JPeKYfm9ZH5sOJFepSPu7dWFvC4uyMUfx8qIMl dKWZMfWdvIT1gDMe7gu2wrOaHrUMwrtuidTtY+ro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , Dmitry Osipenko , Sasha Levin Subject: [PATCH 5.10 041/215] clk: tegra: Ensure that PLLU configuration is applied properly Date: Thu, 15 Jul 2021 20:36:53 +0200 Message-Id: <20210715182606.551249060@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182558.381078833@linuxfoundation.org> References: <20210715182558.381078833@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: Dmitry Osipenko [ Upstream commit a7196048cd5168096c2c4f44a3939d7a6dcd06b9 ] The PLLU (USB) consists of the PLL configuration itself and configuration of the PLLU outputs. The PLLU programming is inconsistent on T30 vs T114, where T114 immediately bails out if PLLU is enabled and T30 re-enables a potentially already enabled PLL (left after bootloader) and then fully reprograms it, which could be unsafe to do. The correct way should be to skip enabling of the PLL if it's already enabled and then apply configuration to the outputs. This patch doesn't fix any known problems, it's a minor improvement. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin --- drivers/clk/tegra/clk-pll.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/clk/tegra/clk-pll.c b/drivers/clk/tegra/clk-pll.c index c5cc0a2dac6f..d709ecb7d8d7 100644 --- a/drivers/clk/tegra/clk-pll.c +++ b/drivers/clk/tegra/clk-pll.c @@ -1131,7 +1131,8 @@ static int clk_pllu_enable(struct clk_hw *hw) if (pll->lock) spin_lock_irqsave(pll->lock, flags); - _clk_pll_enable(hw); + if (!clk_pll_is_enabled(hw)) + _clk_pll_enable(hw); ret = clk_pll_wait_for_lock(pll); if (ret < 0) @@ -1748,15 +1749,13 @@ static int clk_pllu_tegra114_enable(struct clk_hw *hw) return -EINVAL; } - if (clk_pll_is_enabled(hw)) - return 0; - input_rate = clk_hw_get_rate(__clk_get_hw(osc)); if (pll->lock) spin_lock_irqsave(pll->lock, flags); - _clk_pll_enable(hw); + if (!clk_pll_is_enabled(hw)) + _clk_pll_enable(hw); ret = clk_pll_wait_for_lock(pll); if (ret < 0) -- 2.30.2