Received: by 2002:ab2:f03:0:b0:1ef:ffd0:ce49 with SMTP id i3csp58208lqf; Tue, 26 Mar 2024 14:20:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXO1i1IUKJPzC7HUJoUhinHdidMbS704DJVxG9Q3Ikc8Kr2lJQgGHBq/Gw+2bfKn1p4CbXOexOed7GVmqKcyYR0RMa7PDqGNs/MTAB9bA== X-Google-Smtp-Source: AGHT+IGnBd1tHGeLBpj7KT10fkzbuGNv6D7HLlRdsTWL2nrWX41XR+qeusBnUVFAMHMHV1JDY0dy X-Received: by 2002:a17:903:120c:b0:1e0:fb8c:f45f with SMTP id l12-20020a170903120c00b001e0fb8cf45fmr2376141plh.2.1711488009760; Tue, 26 Mar 2024 14:20:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711488009; cv=pass; d=google.com; s=arc-20160816; b=nCyY9Dg+emk4j+Hpwn+h3213ixUXdviwkby9q8pZjPRsiAB1KzMQdmtjgozALdUB9t lH5ZFmkNDl1Lgs6DFY+ruWCF4tdcCo4SesZuWMylyJC/B7Djq7jULQ1wRYwsYhsX+Whb jKXBpLFMZAYRlBiIUTS2U2j8f8PF26WfFH6kHxL/18oRsF48c/oYsXv8mcWftOJLqSX+ lAoB9ilX6Wzkh5KpO5EeNS3djRrfA/Qhum8zLuE+mdmlVu6Ut7Kt9W+E/oef1htKoCxZ 43meuRnsDBkISB/PAygNlfXHWa2ZFaQ/43VRdBT9G+JuW7l9YxLOuoGCVuLBOHVUDs+f e1zw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=Pg/3usqzLB3tXWemVm0BR8Q8IDIeXCXs8UCvrLR1r7M=; fh=R8scUbdjQ4PR86HH8EGgemskRDIMdwDzPETUG2MlmUA=; b=op8qMeNgbIc/IJSNk5o+gfa3XGTR2PIXIIaeNBab78PBiOmAJ+/89EnRn5GmG0NBa6 vWoQ9skzAIphWULFU1OFPhrfF/kr+3BBf/6eHTkiGgEoJ8UKFMTCmGAz9O1KE69wPuRV y7GQDBoKj0xtkp1XH0m3NEopmVq22l5vlIJfFvlwzpNAruovEdxmFXSmWMlfNoX2Vpud aguDJCvVU7jQF4vX/d9fVt90r5BG1duTiRGWVp5k6gFgCvUvzfJfUurSELwQFNUB8svy kQKwYTT7xS7OaoCU97bGwbDEnkNrQmVvRIw7XHp4u8x3P1UtP9XeG29DA8IiT+BhPe7a 03jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZHmYSBwy; 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-119979-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119979-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k5-20020a170902ce0500b001e0e6b6d32csi2481764plg.407.2024.03.26.14.20.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 14:20:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-119979-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZHmYSBwy; 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-119979-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119979-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 412A2326BD6 for ; Tue, 26 Mar 2024 21:09:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D832813D8B7; Tue, 26 Mar 2024 21:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZHmYSBwy" Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 C92AF13D625 for ; Tue, 26 Mar 2024 21:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711487320; cv=none; b=duDn+GwLcw+kRU3rWm1+AyiVCtWiO+1sJKbK+WchwvrXNV8tQIR5NQnF41fiTTDhMa1zdRTPYZi1BqsUvoc4TebT5ToeMVk1LrGOeCVg3fSj4uMx1KH83ur8VlEWjeKGAIkY009f14tA/MJtubWkYFptdWJJ/6QEdU68jkFbiBg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711487320; c=relaxed/simple; bh=V09JUKCm67dliYKEgBrUKzAMRCxXKZJtHRPs4xkL2c8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YUUFABth0VojiTDw5w+qEalTXvzY6MOWubsI+L2PFcBeIv4KcEr1QSYdS2Qna5svtQb8pW3b7sm4b9Hs9oE2V+/n/PF8AkR+3tM9+aIRf6ILBKEGPIeqW4j1zGuolTTP+ixZi1d1g93U3PThhPRc+so2D8UrDGzsfT618HbyOu0= 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=ZHmYSBwy; arc=none smtp.client-ip=209.85.208.51 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-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-56b8e4f38a2so7742763a12.3 for ; Tue, 26 Mar 2024 14:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711487317; x=1712092117; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=Pg/3usqzLB3tXWemVm0BR8Q8IDIeXCXs8UCvrLR1r7M=; b=ZHmYSBwyUKk31FD26PX1yRN0i3nYYhfTHYiXRH8kWmUHwcSNH6tCiYWIoN61ODE5qY UgOcTT7/qGopLk0Ww3TlbVLSyThT7lg9En6l7S+KOvk8O+VFpOJiRB+76Whx58veOcKY GWoAc2fxyh4FWQ2Dm5QhLSWTNXNTxfVXY7tM06TisVi7J0yYfjubPIipWydt9miIaXkv Ag61t77311+SsRU/zSFgibyT0X7anDXSRB3cl6T/Ubx4jscj66rdaFz5yX1Pi1gwODWm oyJIEPqzItX7fnS11kbJbr2zyD2aqzyl5SF1yw+g9V84KGwDfq5LNC3uZLMGJ7YrA1yx pBKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711487317; x=1712092117; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pg/3usqzLB3tXWemVm0BR8Q8IDIeXCXs8UCvrLR1r7M=; b=iiN7k0gI7SuuWz7RY5kTXTVQQQ0BHRy9Qg6+3rWM2qqEij1k66nnHC8KW3Yez2NQsF 98m7PZ6eJJkhCoZAMwWN5vX9OLVOS8AC9dk6HOJ8eD0VvXFOkYd8yi/l8zKh6QctpPIy PA4e3gU/0dAdS+8Xoet7V8hFR226ZnqAgBP9tmiACYbjExJ1zzuQjZqUH+/eLk8JEQwM MH+Nc6099jx3BjKpWvqEldqdsQgDL+AW0YyZvRtATveNYD5WL+3qcG5myFX1VCgB5uzv QkPSZifllAwxAdWcxKWo3VwQhedOCYTqtmpUyak4/O4SNkFmlJqXSVEdxji+d+CFHja5 vUOA== X-Forwarded-Encrypted: i=1; AJvYcCXamT86C6YQxV86HEO3FI16QeIFItCSpVTHZlP+47bV1oEeT3+xiMGd9p1Z2cA1wGDvTaFBbZq97k29apveV5cod/1CsfCi6fO2DR40 X-Gm-Message-State: AOJu0YwSeUoLH+JhTm6+aXaNk+Koy4FgtX7+nbV1x6+L+x5OVPInIIUT YfUok9Pf91m5pyJ0khxMRD0Z2B9WBgL6KdnF1l+kD/3QyZxrk3RjeHK0fBZ1Pvs= X-Received: by 2002:a17:907:7d8e:b0:a4d:f902:f505 with SMTP id oz14-20020a1709077d8e00b00a4df902f505mr1805537ejc.43.1711487317064; Tue, 26 Mar 2024 14:08:37 -0700 (PDT) Received: from [192.168.92.47] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id l19-20020a17090612d300b00a46cffe6d06sm4621697ejb.42.2024.03.26.14.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 14:08:36 -0700 (PDT) From: Konrad Dybcio Date: Tue, 26 Mar 2024 22:08:24 +0100 Subject: [PATCH v3 2/5] clk: qcom: clk-alpha-pll: Add HUAYRA_2290 support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240219-topic-rb1_gpu-v3-2-86f67786539a@linaro.org> References: <20240219-topic-rb1_gpu-v3-0-86f67786539a@linaro.org> In-Reply-To: <20240219-topic-rb1_gpu-v3-0-86f67786539a@linaro.org> To: Bjorn Andersson , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Marijn Suijten , Konrad Dybcio , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio , Dmitry Baryshkov X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1711487311; l=4349; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=V09JUKCm67dliYKEgBrUKzAMRCxXKZJtHRPs4xkL2c8=; b=9PfBuMv3e+x8GiGLI4OsDgsq2GJ8ZkgKNXW4uVr1Lss7QnGkrW8XrqlOxsES/z1H1TUxwuBce gVOnkDxGTiFDuFJCPqs2z+5+gl6T5BbQJp1F4k/836TNLXVfeywJlQx X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Commit 134b55b7e19f ("clk: qcom: support Huayra type Alpha PLL") introduced an entry to the alpha offsets array, but diving into QCM2290 downstream and some documentation, it turned out that the name Huayra apparently has been used quite liberally across many chips, even with noticeably different hardware. Introduce another set of offsets and a new configure function for the Huayra PLL found on QCM2290. This is required e.g. for the consumers of GPUCC_PLL0 to properly start. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/clk-alpha-pll.c | 47 ++++++++++++++++++++++++++++++++++++++++ drivers/clk/qcom/clk-alpha-pll.h | 3 +++ 2 files changed, 50 insertions(+) diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c index 8a412ef47e16..27ba8aa3e577 100644 --- a/drivers/clk/qcom/clk-alpha-pll.c +++ b/drivers/clk/qcom/clk-alpha-pll.c @@ -83,6 +83,19 @@ const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = { [PLL_OFF_TEST_CTL_U] = 0x20, [PLL_OFF_STATUS] = 0x24, }, + [CLK_ALPHA_PLL_TYPE_HUAYRA_2290] = { + [PLL_OFF_L_VAL] = 0x04, + [PLL_OFF_ALPHA_VAL] = 0x08, + [PLL_OFF_USER_CTL] = 0x0c, + [PLL_OFF_CONFIG_CTL] = 0x10, + [PLL_OFF_CONFIG_CTL_U] = 0x14, + [PLL_OFF_CONFIG_CTL_U1] = 0x18, + [PLL_OFF_TEST_CTL] = 0x1c, + [PLL_OFF_TEST_CTL_U] = 0x20, + [PLL_OFF_TEST_CTL_U1] = 0x24, + [PLL_OFF_OPMODE] = 0x28, + [PLL_OFF_STATUS] = 0x38, + }, [CLK_ALPHA_PLL_TYPE_BRAMMO] = { [PLL_OFF_L_VAL] = 0x04, [PLL_OFF_ALPHA_VAL] = 0x08, @@ -779,6 +792,40 @@ static long clk_alpha_pll_round_rate(struct clk_hw *hw, unsigned long rate, return clamp(rate, min_freq, max_freq); } +void clk_huayra_2290_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap, + const struct alpha_pll_config *config) +{ + u32 val; + + clk_alpha_pll_write_config(regmap, PLL_CONFIG_CTL(pll), config->config_ctl_val); + clk_alpha_pll_write_config(regmap, PLL_CONFIG_CTL_U(pll), config->config_ctl_hi_val); + clk_alpha_pll_write_config(regmap, PLL_CONFIG_CTL_U1(pll), config->config_ctl_hi1_val); + clk_alpha_pll_write_config(regmap, PLL_TEST_CTL(pll), config->test_ctl_val); + clk_alpha_pll_write_config(regmap, PLL_TEST_CTL_U(pll), config->test_ctl_hi_val); + clk_alpha_pll_write_config(regmap, PLL_TEST_CTL_U1(pll), config->test_ctl_hi1_val); + clk_alpha_pll_write_config(regmap, PLL_L_VAL(pll), config->l); + clk_alpha_pll_write_config(regmap, PLL_ALPHA_VAL(pll), config->alpha); + clk_alpha_pll_write_config(regmap, PLL_USER_CTL(pll), config->user_ctl_val); + + /* Set PLL_BYPASSNL */ + regmap_update_bits(regmap, PLL_MODE(pll), PLL_BYPASSNL, PLL_BYPASSNL); + regmap_read(regmap, PLL_MODE(pll), &val); + + /* Wait 5 us between setting BYPASS and deasserting reset */ + udelay(5); + + /* Take PLL out from reset state */ + regmap_update_bits(regmap, PLL_MODE(pll), PLL_RESET_N, PLL_RESET_N); + regmap_read(regmap, PLL_MODE(pll), &val); + + /* Wait 50us for PLL_LOCK_DET bit to go high */ + usleep_range(50, 55); + + /* Enable PLL output */ + regmap_update_bits(regmap, PLL_MODE(pll), PLL_OUTCTRL, PLL_OUTCTRL); +} +EXPORT_SYMBOL_GPL(clk_huayra_2290_pll_configure); + static unsigned long alpha_huayra_pll_calc_rate(u64 prate, u32 l, u32 a) { diff --git a/drivers/clk/qcom/clk-alpha-pll.h b/drivers/clk/qcom/clk-alpha-pll.h index fb6d50263bb9..d1cd52158c17 100644 --- a/drivers/clk/qcom/clk-alpha-pll.h +++ b/drivers/clk/qcom/clk-alpha-pll.h @@ -15,6 +15,7 @@ enum { CLK_ALPHA_PLL_TYPE_DEFAULT, CLK_ALPHA_PLL_TYPE_HUAYRA, + CLK_ALPHA_PLL_TYPE_HUAYRA_2290, CLK_ALPHA_PLL_TYPE_BRAMMO, CLK_ALPHA_PLL_TYPE_FABIA, CLK_ALPHA_PLL_TYPE_TRION, @@ -191,6 +192,8 @@ extern const struct clk_ops clk_alpha_pll_rivian_evo_ops; void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap, const struct alpha_pll_config *config); +void clk_huayra_2290_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap, + const struct alpha_pll_config *config); void clk_fabia_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap, const struct alpha_pll_config *config); void clk_trion_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap, -- 2.44.0