Received: by 2002:a05:7412:a9a8:b0:f9:92ae:e617 with SMTP id o40csp12928rdh; Wed, 20 Dec 2023 14:18:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFENDUHl7J/jpmZCK4UhwWTGgoZ9+sTIVR008MXIM0eBgPtdBivi8Ig7n8y2540tufgzEkP X-Received: by 2002:a05:6a00:2da1:b0:6d5:6a3b:270d with SMTP id fb33-20020a056a002da100b006d56a3b270dmr4400340pfb.1.1703110683140; Wed, 20 Dec 2023 14:18:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703110683; cv=none; d=google.com; s=arc-20160816; b=vM7LQVWrB/XL4K5IiXdiwOlbneka/fNpOFYPJo0qP8syBFb7FdzYWkH7kA+PTKcmoa 3xb4cVVTVH1ufr7n6UCI5voV8Co+aC+CJ4OUVvIkpdYxh6QDrVRal1qS0CKg9IHY3+RJ fi6eQ28Uu3/08gttP6nB7E1m9bWTeBoRrWY0y2O6lZhMZiKdJkJkoTxml/gHfKlwqeID tdsgJQLZDB/VN8ljmOWqf+GaiS4yWrt0LQ81fvODePEJhcx2pTgY1DvX/tfSN5mYSbQj hplSLCdla/lPKpnSr3+uQpHkC7kb2EX16Q/iyy3H+n4XX9KQmlQF4DwidDzQuYgrPQg+ xGNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=PHyyJwEJsELVXyenxWN25EQbJJCm8HvjgqB6ecbKFBo=; fh=VhIJx+T3y1Q1fSF7BLeWIrn14SWi7FGH0iUWQ4VsPhk=; b=w3QDK/DBhdnvte1Py+265H0QjlKh7FTctOj0SKmncQY1sxK8BBM0boyzkUloRtAIEx +w1X3QCSVALvH1GUv880vwljB1Pl6wJqTyrdD4rUoJKr/nTFxkpxbPgkLbzk+SbAi8Mf revF5vUf6oluPdimSLVrv6KHgPMZZEE6Iijhr4p8xpsE2SRqzR/5qc11k2/L6isBPuX0 r6LTUJbJc7Hk+9SKKLI3uC7ln0A8wuZt24SU2om1wpZ17OLUL8fVKOLRXAGfFGNBD+AD 5uwPeyMFpkB9HwTHQuaZWt3hbo9fd+0xk1ROetZheu3y//HAcoDPfJ3BAz5XlSp5JNMq XhyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WM2hF1qN; spf=pass (google.com: domain of linux-kernel+bounces-7499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n13-20020aa78a4d000000b006d925c51cc2si388292pfa.139.2023.12.20.14.18.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 14:18:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WM2hF1qN; spf=pass (google.com: domain of linux-kernel+bounces-7499-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7499-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C61DCB21F32 for ; Wed, 20 Dec 2023 22:17:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E1B84A995; Wed, 20 Dec 2023 22:17:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="WM2hF1qN" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 E3409208A5; Wed, 20 Dec 2023 22:17:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-40c60dfa5bfso2317585e9.0; Wed, 20 Dec 2023 14:17:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703110666; x=1703715466; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PHyyJwEJsELVXyenxWN25EQbJJCm8HvjgqB6ecbKFBo=; b=WM2hF1qNLEkOQ19yG9QT+Dmuxw8GWjc9u9hCEUxhSjoa9qBOM3Zg2y/60Er/klt6EA v7Xx/0xaKFwLUt/8C2iluOemb6pFk3y1wNNSl2sY1hfby2F/fHlxCfrtJUJFVSBcG0BH /gcs/0FmbjM6WH9otcGwVp+AiC/hPoWW6xf2edLhAmZ0DUBkBktpMoC2xtHjLbRRml5u m2ZM12BlcZ+BNjykPA1IAxVw13cs1qiKf/k0pYvIVM83SqdwzFaihlJUG2Q0YQLHdLgZ reLQiApXiIjk+JM0qjQ8I9V2ZNmb5hRA8HklD/PXbiW8gOT0bB1qpZtOjD/48+vQEQXN /32Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703110666; x=1703715466; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PHyyJwEJsELVXyenxWN25EQbJJCm8HvjgqB6ecbKFBo=; b=FhjDYVxn9ZpdztrT94O6V8t4PuA5yhHgkJhd/dU7/LOZnux91dytdxd9+lgWrP7+pX U6OpFzX105crkNzI+c1O+Onl9uR8B6GctXwjbZamrQ+GvCfLg74VmqEYFk7S5dJxQuav fXJYxPlbPtKqdUC7Re2rD+kfqifnd9LBu1i7JgBBBo9r6YcfyZY7zq7iXOnDueNt3COL akA/vjGqRPTShYajhoutKi9zSANrJFHWXuexg9P0qqK19kFJcadQKe6ej4W7nfjXi+T0 VEcVr4lGKi/FBVDmlcOnuyRqoQIm6yXIQgZS32JHlC0LQ3EBItgHIPJwWB5fgJf5366O 1WGA== X-Gm-Message-State: AOJu0YwnHvVAkD2o5OrnceUGCPxDySndQtQo4O/ccP8koSswKsCYkkIp 1N6wxiJpPrgaaaw1ecFhlAM= X-Received: by 2002:a1c:6a0b:0:b0:40d:39e9:d3d0 with SMTP id f11-20020a1c6a0b000000b0040d39e9d3d0mr169980wmc.144.1703110665627; Wed, 20 Dec 2023 14:17:45 -0800 (PST) Received: from localhost.localdomain (host-95-250-248-68.retail.telecomitalia.it. [95.250.248.68]) by smtp.googlemail.com with ESMTPSA id v14-20020a05600c444e00b0040c58e410a3sm8908826wmn.14.2023.12.20.14.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 14:17:45 -0800 (PST) From: Christian Marangi To: Bjorn Andersson , Konrad Dybcio , Michael Turquette , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [PATCH v8 0/3] clk: qcom: clk-rcg2: introduce support for multiple conf for same freq Date: Wed, 20 Dec 2023 23:17:21 +0100 Message-Id: <20231220221724.3822-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This small series fix a current problem with ipq8074 where the 2 uniphy port doesn't work in some corner case with some clk configuration. The port to correctly work require a specific frequency, using the wrong one results in the port not transmitting data. With the current code with a requested freq of 125MHz, the frequency is set to 105MHz. This is caused by the fact that there are 2 different configuration to set 125MHz and it's always selected the first one that results in 105MHz. In the original QSDK code, the frequency configuration selection is different and the CEIL FLOOR logic is not present. Instead it's used a BEST approach where the frequency table is checked and then it's checked if there are duplicate entry. This proposed implementation is more specific and introduce an entire new set of ops and a specific freq table to support this special configuration. A union is introduced in rcg2 struct to not duplicate the struct. A new set of ops clk_rcg2_fm_ops are introduced to support this new kind of frequency table. Changes v8: - Add Tested-by tag - Fix typo in commit description - Address requested fixup for Stephen Changes v7: - Improve handling of exit condition on missing parent. Changes v6: - Small rework of best_conf selection to mute Sparse warn. Changes v5: - Rework selection logic with suggestion from Konrad - Return -EINVAL and WARN if we fail to find a correct conf Changes v4: - Drop suggested but wrong re-search patch - Move everything to separate ops and struct to not affect current rcg2 users. Changes v3: - Add qcom_find_freq_exact - Drop re-search on rcg2_set_rate - Rework multiple conf patch to follow new implementation Changes v2: - Out of RFC - Fix compile warning from buildbot related to F redefinition Christian Marangi (3): clk: qcom: clk-rcg: introduce support for multiple conf for same freq clk: qcom: clk-rcg2: add support for rcg2 freq multi ops clk: qcom: gcc-ipq8074: rework nss_port5/6 clock to multiple conf drivers/clk/qcom/clk-rcg.h | 24 ++++- drivers/clk/qcom/clk-rcg2.c | 166 +++++++++++++++++++++++++++++++++ drivers/clk/qcom/common.c | 18 ++++ drivers/clk/qcom/common.h | 2 + drivers/clk/qcom/gcc-ipq8074.c | 120 +++++++++++++++--------- 5 files changed, 285 insertions(+), 45 deletions(-) -- 2.40.1