Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp708073pxv; Thu, 15 Jul 2021 14:04:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpRfdQZcRmyTSdCFhDI0qRnmVRk1spUdLFvBp651YXBOeYGD8/pddRZCD7ixbjdwHoVzDN X-Received: by 2002:a05:6402:3089:: with SMTP id de9mr9846559edb.69.1626383058646; Thu, 15 Jul 2021 14:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626383058; cv=none; d=google.com; s=arc-20160816; b=IZ4HO88fa/XdrKwm19F82p3BsMuXl2zvgJIL3hGRZVFsOdg1YCbt+5S7ffv+K/IgCw FSP9om5YjJK7N04jZZKssWVspLnltolNa5PELFqzBbqUda1UCHfc3kQPbZM9kyLeBFwK 4sy+7MAGyd9Jw6UZo/BpgtBW8ecLu1JRQRbHl1k+Ckk96+Fmd+XE/VC63eDapDsHTZZq Yk6ZqoZOpqPHtK8g+XTbULMFLh9WLXJoHl3w/BLX0tw15YpnDLs0g6bIYHSKnDTfJKNd +l5/59/Brm4C34SPE9fI8p9hY/fn6q/It1CVT0lRJgoTZQR/cm53oOfqYV0k2Ig045te NH4A== 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=G99U51mdHuK41hhw1atBynX7p/BtRjs19yCS6ru972n/kB5bqpzukt4b1duouXoHvY iGYsetO6fl8VDJPtJ+hPIbLQCqWZs6f7PMG26ZXpGB+s1QOiRfV3cWSHiEbdTwf30Y9U WXui7cfUgco+R4FLe05vliI83kl/rYYT0U5bHIK10Wg0qn3DQTuVpWaXzVeA2fpVJpp4 oh/SAygPjwFMCQIDcimH99fOioKFJF/gOTGjjhfHcSjn1q8iOuMBxwE/dY4URcLYBXaS PT1VxA63yUGEVeSifVmGDPVj3baQ4eydT3XIF9T+CqRi+Pf8R29WqRX5ywrGVylY8V8g S67A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2kZsly+Q; 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 si7si9029375ejb.102.2021.07.15.14.03.55; Thu, 15 Jul 2021 14:04:18 -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=2kZsly+Q; 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 S244494AbhGOTOw (ORCPT + 99 others); Thu, 15 Jul 2021 15:14:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:34190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239588AbhGOS6t (ORCPT ); Thu, 15 Jul 2021 14:58:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 14751613D0; Thu, 15 Jul 2021 18:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375338; bh=J9jzMF9UE8azGOzNI1ZPfuhQllO46jyFP0pJ2whawEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2kZsly+QaX37dGnZ4iXG+RD5py9geV8mNRbF8kxOBRrKhObLiRNgwY4HUbhwMgnos VVBJfvEgXg9pN2D/A34xxZiiO+d/FgbaozzeuJdwM3U3SXalSOu79qeiJmAIvTxW+W eamX5wEmkWtWyFusocnRXDTE7lm4OeXvT+xGRZS4= 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.12 044/242] clk: tegra: Ensure that PLLU configuration is applied properly Date: Thu, 15 Jul 2021 20:36:46 +0200 Message-Id: <20210715182559.841361106@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@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