Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp243960lqc; Thu, 29 Feb 2024 16:34:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWhB7QGEOkd5XJRHY3AJKOCX961Xv5tY5cDP23LaaZ+jRxn2MrdPfAwMCABotPXuoL3DrOOweU3X6Gr6xdlAC93MNo/0OXYzMk3liANjQ== X-Google-Smtp-Source: AGHT+IHiy3/meN0lLQhqmqYlSzGPg4ZINRBdFlmv/T/j8W1nyBiGSdiDMUl4HeDg7AnqOXXuRWB8 X-Received: by 2002:ac8:5e08:0:b0:42e:b4fc:196c with SMTP id h8-20020ac85e08000000b0042eb4fc196cmr103533qtx.44.1709253260056; Thu, 29 Feb 2024 16:34:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709253260; cv=pass; d=google.com; s=arc-20160816; b=rBZ/GWi88fbRyWjnCPiTbdeXPfxOCvcULAT257jWYe6WBTjsuYfSYwVzAoBuAmEN2G zY09N94mkyNyyi0b242x0EDIBRaY/d3kuw12LSwZy7uvuHB4KiTNHuOhO+qrCMG6dUf9 o6N0/6SnC6oK2iZPPvhfEKujQyfugLsF7gmqH1kRKB54CeTsW+QI6dPZ23MTBbK+jXu4 nQoVwKTcTSeZLslBJr/XP0lichiSuX7aDjgVnhK2k/OgY6iv2sARTO+yBwYc8X1dKHpP RTVANd/p+6xBlWWxBNOqG5BKCbsJSzM9gK9bXYQ59lW3cCW+FJMtRriOzZYiMBd6cGs1 cy4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=iSdkimAv7FIB+VJJwLXHXIBUn34V60qyMzBCrZfAS3c=; fh=/107VejLiGp+cQRaO6m+I1CR8vpw01gNld5mI3br2A8=; b=hTaGwGnv4M42/P5PbgSkdWq6rGBPjng2aKMiDANDzyi/Y+JT1L7qsi0YQ91ylNvYla n1Lb4RnuY4BUdXNGt3GSCYJFCaz1kgtOC3GRmGuJykMN5kKmqcjrBa11WU8sXrQtSLGc 9SZHk4o5OxYMUEScxOqwbP+Gpgsf89QAKYb3YnGAMl98uYi1qaKcrYa2k08n1NpHd4L3 JdfDeNvYIGcCt1GTGBPIMnDAjulVCR6UZsgUqSEJIiVN2jlSSymiUprsYGCrGewjAFG9 txXgtX2baKIMc/AgVEgFILypmazebDeOYLFtv7+e40T9FQbNutDoY0zmp6AfmY14x+VL 9ThQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qUuJddeg; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-87737-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87737-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o8-20020a05622a044800b0042e7765bbdasi2727685qtx.79.2024.02.29.16.34.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 16:34:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87737-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qUuJddeg; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-87737-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87737-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B7EBE1C20E46 for ; Fri, 1 Mar 2024 00:34:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BFBF3C1D; Fri, 1 Mar 2024 00:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qUuJddeg" Received: from mail-yb1-f182.google.com (mail-yb1-f182.google.com [209.85.219.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E94F323C5 for ; Fri, 1 Mar 2024 00:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709253251; cv=none; b=CKf/t3qCHC9ojUOGaPH3poAXzgVTRXhVhimKxQLXonI73kT2G3cWbDZO5kVZTIRcPeTzRO6GDyJLPFYuKodxuk6GYtfeE8wvHElhs6v0zmvzDk0O8Vk1SNp/ad0AuRUl/MsZBTpOqnEHaDJ6oKRe80Wg3wCyMOixr7hRiwtKHvQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709253251; c=relaxed/simple; bh=oPPqS797xDYUweWK6+HpZH6RKCECnkHEB/M92xm1Slc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=LBeYemoCLqEBjbzY4DmLh2ozUctBCjjqMtqIw7tGtBNmpcWgCCGmJQ02+ykN7PAnv80kQCQR/oKvWR4qRGBoMQTlHN+3dydV/YJZ8zgGUtaSLR9xqgONVtK/y57ELXyhKN3sy4WdVnj9sevyg95gKU5uG0KWmjQO4NbgoHz/b0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=qUuJddeg; arc=none smtp.client-ip=209.85.219.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f182.google.com with SMTP id 3f1490d57ef6-dc6dcd9124bso1657992276.1 for ; Thu, 29 Feb 2024 16:34:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709253248; x=1709858048; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iSdkimAv7FIB+VJJwLXHXIBUn34V60qyMzBCrZfAS3c=; b=qUuJddegDqcIzVq2Y0ZOt1COZVM7hZZo6cGfGmUKTNDAf9R2brvi8irGot2qVUzh0D rUNn77zIzLxUHF4xis0fgrwlo6me/P1mA1QOy+Kte8STZKjcs/KlLzvS0KgU6W9lh8gC t2qyuYJU93/DArK5XRLp+ujJ8zCYwbMS3XNNf9LCU869yPLEnK5dA9pmoBcxPorwfEgk pjtxV3HunexUpMlCiTMOfz02/Wwla+ZTEqf7Ti+UgrutUzUJFMtcvzjAEX863TvHLEHQ in0ArXLvALg8QQVm4JwKCbK/h6DAQszxlJtg+fkpv5Uy2cJ03TCA68tM+jONEfBQN7cn fdvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709253248; x=1709858048; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iSdkimAv7FIB+VJJwLXHXIBUn34V60qyMzBCrZfAS3c=; b=WqIMmkqOtBn++bUO1k/tdkWnHF0gy2KAZSvApR/7y7q6Lj2lTzHwcJAOXbmuOi/GPp 66PAMOm2RUwpYbxoKytMdy9clVc2XX4C99MK+dKgq1TxHrcISsvJGlrPpTw23861a2mY M81tfExHSubIVWt7I4YbxHqYKRUA7GOS6tD9pi1JxlaAwUK/f1w3wflaK2Mttuxf8xVP WsZW8Q3uFasGE/MXbyxwbxk644kyGx7ZxIAKDLhIg5jBOIdelq7D2hOvLi/THBA3NOai Vp4f+HWbIBok8OtkstgITg9HLsk0nbiezqnKpyyyjj1KGuw4kbpfIuZKSu7G3cEflHPL 3P7A== X-Forwarded-Encrypted: i=1; AJvYcCXCtmY7T/1czCQk6S9vp4oPqNv9KUUuqxTVFUuE51VaD5FVxdH7TZia1wVRf1xmMhPtuipYsUKAA3u6WChzVZcccshMtPvSunFRjIZ7 X-Gm-Message-State: AOJu0YzaAkyOGWncwKx5UR8MqBuLsG5f1W45yF637lSFzeCxd+TRFIHf mXGS9TXz2HIOgY8KUUh4rwEw16CRZ2R0EA4xQkykshCHFkxrECmzrSkezW4R/HSeaf35dlwoD2Y Q/Ii7fhX0tbERMtGIqozuBwSU9YyA4VmFpw3vUQ== X-Received: by 2002:a25:c2c1:0:b0:dc3:7041:b81b with SMTP id s184-20020a25c2c1000000b00dc37041b81bmr66412ybf.36.1709253248163; Thu, 29 Feb 2024 16:34:08 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240224202053.25313-1-semen.protsenko@linaro.org> <20240224202053.25313-14-semen.protsenko@linaro.org> In-Reply-To: From: Sam Protsenko Date: Thu, 29 Feb 2024 18:33:56 -0600 Message-ID: Subject: Re: [PATCH v3 13/15] clk: samsung: Implement manual PLL control for ARM64 SoCs To: Krzysztof Kozlowski Cc: Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Michael Turquette , Stephen Boyd , Rob Herring , Conor Dooley , Tomasz Figa , linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Feb 25, 2024 at 10:09=E2=80=AFAM Krzysztof Kozlowski wrote: > > On 24/02/2024 21:20, Sam Protsenko wrote: > > Some ARM64 Exynos chips are capable to control PLL clocks automatically= . > > For those chips, whether the PLL is controlled automatically or manuall= y > > is chosen in PLL_CON1 register with next bits: > > > > [28] ENABLE_AUTOMATIC_CLKGATING > > [1] MANUAL_PLL_CTRL > > [0] AUTO_PLL_CTRL > > > > The bl2 bootloader sets 0x10000001 value for some PLL_CON1 registers, > > which means any attempt to control those PLLs manually (e.g. > > disabling/enabling those PLLs or changing MUX parent clocks) would lead > > to PLL lock timeout with error message like this: > > > > Could not lock PLL ... > > > > At the moment, all Samsung clock drivers implement manual clock control= . > > So in order to make it possible to control PLLs, corresponding PLL_CON1 > > registers should be set to 0x2 first. > > > > Some older ARM64 chips don't implement the automatic clock control > > though. It also might be desirable to configure some PLLs for manual > > control, while keeping the default configuration for the rest. So it'd > > convenient to choose this PLL mode for each CMU separately. Introduce > > .manual_plls field to CMU structure to choose the PLL control mode. > > Because it'll be initialized with "false" in all existing CMU > > structures by default, it won't affect any existing clock drivers, > > allowing for this feature to be enabled gradually when it's needed with > > no change for the rest of users. In case .manual_plls is set, set > > PLL_CON1 registers to manual control, akin to what's already done for > > gate clocks in exynos_arm64_init_clocks(). Of course, PLL_CON1 register= s > > should be added to corresponding struct samsung_cmu_info::clk_regs arra= y > > to make sure they get initialized. > > > > No functional change. This patch adds a feature, but doesn't enable it > > for any users. > > > > Signed-off-by: Sam Protsenko > > --- > > Changes in v3: > > - none > > > > Changes in v2: > > - none > > > > drivers/clk/samsung/clk-exynos-arm64.c | 44 +++++++++++++++++--------- > > drivers/clk/samsung/clk.h | 4 +++ > > 2 files changed, 33 insertions(+), 15 deletions(-) > > > > diff --git a/drivers/clk/samsung/clk-exynos-arm64.c b/drivers/clk/samsu= ng/clk-exynos-arm64.c > > index 6fb7194df7ab..55490209b9a9 100644 > > --- a/drivers/clk/samsung/clk-exynos-arm64.c > > +++ b/drivers/clk/samsung/clk-exynos-arm64.c > > @@ -25,6 +25,19 @@ > > #define GATE_OFF_START 0x2000 > > #define GATE_OFF_END 0x2fff > > > > +/* PLL CON register offsets range */ > > +#define PLL_CON_START 0x100 > > +#define PLL_CON_END 0x600 > > + > > +/* PLL register bits */ > > +#define PLL_CON1_MANUAL BIT(1) > > + > > +/* Helper macros to check for particular clock regiter by its offset *= / > > +#define IS_GATE_REG(o) ((o) >=3D GATE_OFF_START && (o) <= =3D GATE_OFF_END) > > +#define IS_PLL_CONx_REG(o) ((o) >=3D PLL_CON_START && (o) <=3D PLL_C= ON_END) > > +#define IS_PLL_CON1_REG(o) \ > > + (IS_PLL_CONx_REG(o) && ((o) & 0xf) =3D=3D 0x4 && !((o) & 0x10)) > > These should be static functions, because it leads to trickier code. See > also checkpatch warning. > For my taste macros are more compact in this particular case. But I don't mind, will send out the reworked patches soon. > Best regards, > Krzysztof >