Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp650946pxv; Thu, 15 Jul 2021 12:29:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyd8xf/0Ymm15/8ngGvxgGrPZLoKoQAFKENIJOAvt8zWKM5GYYkvvMJZgEHkmKQcdjkEnV8 X-Received: by 2002:aa7:c801:: with SMTP id a1mr9328872edt.293.1626377368724; Thu, 15 Jul 2021 12:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377368; cv=none; d=google.com; s=arc-20160816; b=0K/rcHcXn0MM0wL0BuyaRhdyNovNyBi4t0p4sWmGwbdhQsUKUaJFMW0oTVfmuySzq1 xTNzp63ZMzSO9SagoXH2EOyE5BbV86NP1RPl9S1j0FtRYOovHLZ0nghXcmToD2A5JcVf O428ymTO+5NIw7Pa9nEjOzXhWMBKTuOQVq8X/QnqSVP2cu/pLiuigFCF191fTYdDzC+H vqSl4nntCvDY8Orpl3TFbDGj3ANRUrxRRH4b7ZihVOWrCBw/ye5cOk6SXqogKEH/Iy0t DiEfoAYIlVFZGHQI20/8WWQVrkqCQVmnesZcpZaXfv4QtuwFZ7IvRpPS9t02zbRS0Hzh VhTg== 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=sx6W/B95IbfJNcnEp6Adb+moXPCg4Glq883UYN/byP0=; b=skEG8i65Qv8WtJuf/GyERXU+mVuU7MsT41Oqfn8v0SJckzrA6/XcjpgF1KseoIUqZL Mo8ZBY2unQJ73ahp1Hpf+uspVpBIh39ivx+mld0vUyIiy++Qdt3E5gjiRbLlumpvF8SW rq3tjX/jUo04q9AKaZwOnv8IEMZYmz1dujN6gizXn2fDELW7wUg3gTq1VX5QYLITrH6E 2fTGO9U265g5PyAejltW/UXDWcrw7X5d2Ql8QzFr20/1Kh1RvbKRiygYnrxKHUrwRUnh gDtedDv1VKt4Qx4Pf4iu1IpDLjIgg2Fh6Awig/diJSV2yr37R0gzvjMQF1kihComOcPi kzXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PNYAmIyN; 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 z15si8225571edc.64.2021.07.15.12.29.04; Thu, 15 Jul 2021 12:29:28 -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=PNYAmIyN; 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 S244242AbhGOT3A (ORCPT + 99 others); Thu, 15 Jul 2021 15:29:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:46430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243281AbhGOTJn (ORCPT ); Thu, 15 Jul 2021 15:09:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id ECF3261413; Thu, 15 Jul 2021 19:05:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375930; bh=NRQzqqSYsm7AbEbLBHZ5NA9N/4A7aXKe4//RNlcehj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PNYAmIyN39EflNb2Y2JAVXuN/ilGanlId97rB6bORn0Ns3SbhIaYfU7YYgEUct5Xp eCoarqngZ7/wklQPKSGR+izdyCp5Uqp+8ue/xNZ9LK/7Il9YuCddDR8mxlzuQ1BzIf vkCChB5chsiHyAs4KeFBwNyQwZHyr0Tzoh4oCy/c= 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.13 054/266] clk: tegra: Ensure that PLLU configuration is applied properly Date: Thu, 15 Jul 2021 20:36:49 +0200 Message-Id: <20210715182623.754605609@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182613.933608881@linuxfoundation.org> References: <20210715182613.933608881@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 0193cebe8c5a..823a567f2adc 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