From patchwork Tue Jan 17 13:54:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 44677 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1767422wrn; Tue, 17 Jan 2023 05:56:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXtarRWUnp3LGvXr1KQWCeH04I0rbeiFTqlifNYXZXoogRnVesmnJ50udk6WR1hvSKviwDiP X-Received: by 2002:a17:907:8b11:b0:870:29fd:be41 with SMTP id sz17-20020a1709078b1100b0087029fdbe41mr9422100ejc.48.1673963788554; Tue, 17 Jan 2023 05:56:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673963788; cv=none; d=google.com; s=arc-20160816; b=pRPdodPYnpmODDFRyzEXCLcaSdK0ZQKqUaBP3zOwJQ+UHYsXyLTrLDplmRjRYgkq3O ezVmKAAXJgUnKR78HTdnSjVBC89HSi77ni1bXfYR1TykBfQayHxA1COUMkEfoaL/RAhy kZRuYucoxtF8Toqjfs0SviGK3Ar2nt5c+Y13NMI5l2SWGRdmCMoTmHi/hGWeTzKjlYT/ 5JpXLciS2tD8iz8S5kGPN7hOb0vArYpgtgQ4fttX6jpj3qBb/nuXJc3/VSOE79Lpc3l7 hkFUaSShbumWoJMXNWu3OxjmVKTGva+MpZGO983gOomifWnc98+EgKMuVLfdh+yJoQUc hFYQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KwWU7AdxQV1P5kT8whSf7fiDiHebnCcfByCUm7DXuys=; b=0FoUFs0ZaCBT7IUmlYk+cx/cSSARNn1GC6c6l1wBwutV3Ko4nPAxLze8yFKXAFXjJA i67LzL7XVLrqyHq6J9Lnl2j9YGabEWk1OQ9wkqhkSFsyKhW3J6JBzRV2w/gmqlDZLIvY vwGvkAJ18BUwE8en9rOmDUTAxtZVu4OREDL6kCim+blYGB0fGcyjtacfA7AxDPr2Ud1W QziCPKymvvYFDmZThbEcfOJJq9sa3zhza2rO7MQ16sd0SE1Y/Bc06myKnMPSEz88rF+y 0SOO/xB9FJYtQWfuq5wYuspYFIv5+P8oXL8PoiQjiLD1bkMJQen2RlejdkgLKSgfrV5M 9hpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=moF8JUP4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ww11-20020a170907084b00b007878c9d73a2si35901813ejb.426.2023.01.17.05.56.04; Tue, 17 Jan 2023 05:56:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=moF8JUP4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbjAQNz1 (ORCPT + 99 others); Tue, 17 Jan 2023 08:55:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbjAQNzX (ORCPT ); Tue, 17 Jan 2023 08:55:23 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB8A235B4; Tue, 17 Jan 2023 05:55:22 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id f25-20020a1c6a19000000b003da221fbf48so8189435wmc.1; Tue, 17 Jan 2023 05:55:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KwWU7AdxQV1P5kT8whSf7fiDiHebnCcfByCUm7DXuys=; b=moF8JUP4g12vZ+LyUzrSDk44FqgJDsTh6zw+IyMKvh9Fvl2OTcydCTRSA0dT7dwngW 4SztmBNasf5vBnAHvXRjG3ofaDa5SEoV8nSVQTuW/6K/WFvLvzZ0NTf8eYTZk+GCyCRI 6O2b7RuakWUa4+p570Zps+qw9w1TvUzhaptIKzYWwMlEhkf8EbBhABLcxc+QaTKBy3aF fl/4CHl5yh00mvPTkLQ0oYqlwf3Czh9NHfm7RiT9hUSqNF/DuuO4pNDIcU+iQrCbS67+ vD+Ble8ZxF52usjtmaoQUTDfUbOtsZEVc0IdzQHstRonAK2ejmKwn4j794DcyOgby2Ut 9IUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KwWU7AdxQV1P5kT8whSf7fiDiHebnCcfByCUm7DXuys=; b=jDzYWtTVvx6R1C9AGiv5iHvUpGcEwo9ZDx+WlKoNiOnKZZqrFbDfsVQkwNE1PnN42n pHtjfEV2Sn80vjaBe68DeNq+vbuokmXrHG/8c9U1vZMMxwj0lQXjzDnyqVcXr0kIYw+l Oa2uceOkFkfoMDGytIVHwnNNTXzju7nKYQqjbdq/ahZYv7rf1qqROM5BN6110q4XIwlu aaJPsjy1fF34x7OVFUibggPFcgTACXy3hVCUqeEb/86hOfozLayK/+Trf1iXoQcUQThi jz4uKdjeLQsnvcrF8J9SNKmOTlCgaW4ymfd5UojWPYgxiB8t0qXUSlLaZWYA145BHDcq G/yQ== X-Gm-Message-State: AFqh2kqKR+wxbfTq9f64lhVsVGetu+hiY2RpQM0va/nTLA61SHS7yxF6 bBMfKkOo7lusDeqQ0X+7Qq4elUl/Mp4= X-Received: by 2002:a7b:c302:0:b0:3d3:5c9e:6b27 with SMTP id k2-20020a7bc302000000b003d35c9e6b27mr11915381wmj.12.1673963721329; Tue, 17 Jan 2023 05:55:21 -0800 (PST) Received: from localhost.localdomain (93-34-92-88.ip49.fastwebnet.it. [93.34.92.88]) by smtp.googlemail.com with ESMTPSA id s7-20020a1cf207000000b003d98438a43asm35147461wmc.34.2023.01.17.05.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 05:55:21 -0800 (PST) From: Christian Marangi To: Bjorn Andersson , Andy Gross , 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 v3 1/6] clk: qcom: gcc-ipq6018: drop redundant F define Date: Tue, 17 Jan 2023 14:54:54 +0100 Message-Id: <20230117135459.16868-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230117135459.16868-1-ansuelsmth@gmail.com> References: <20230117135459.16868-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755278253566298268?= X-GMAIL-MSGID: =?utf-8?q?1755278253566298268?= The same exact F frequency table entry is defined in clk-rcg.h Drop the redundant define to cleanup code. Signed-off-by: Christian Marangi --- drivers/clk/qcom/gcc-ipq6018.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/clk/qcom/gcc-ipq6018.c b/drivers/clk/qcom/gcc-ipq6018.c index 3f9c2f61a5d9..350ead66914c 100644 --- a/drivers/clk/qcom/gcc-ipq6018.c +++ b/drivers/clk/qcom/gcc-ipq6018.c @@ -26,8 +26,6 @@ #include "clk-regmap-mux.h" #include "reset.h" -#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) } - enum { P_XO, P_BIAS_PLL, From patchwork Tue Jan 17 13:54:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 44682 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1768342wrn; Tue, 17 Jan 2023 05:58:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXvpTmHReNZ/siCV3Z/C+yNJdvmTJKyk8UbDJS7vRd735tXyv+tF+2rvGde5fFVd5v614ksd X-Received: by 2002:a05:6402:501e:b0:48e:bf0d:f3a8 with SMTP id p30-20020a056402501e00b0048ebf0df3a8mr3522159eda.38.1673963930311; Tue, 17 Jan 2023 05:58:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673963930; cv=none; d=google.com; s=arc-20160816; b=ElSfUGUaFS29UAMQ40Pgrc2bd/WXmAl6Ui07IbjtSvK5slDWSHGkUP8R9HdWtac2WM tExvrXuLs/P9d+4b9nmJ4BCskkNu0rFRFvEl6v27nSqJSapd+pmOYsWm+4K1czUN8KOZ lIm6vlOsB+gjlOZzpI9EB7hscQr3zdJCnyfJKAgYV/jXoRhWlwZvp9FYBz01E+9VnilU njruKnEG+Yc/HSJO4NjSiNBqwCHV1BjwRMDTCW1Ch6+tFcb9CtBHk9KPa7cCDj7fdfms hlrEy9yzCmSEezQzE0o7KajL80OwZE6qmCBCoVZtLR6bH78LDwD6fE/4Xbnb7OOIsX/g 25Tg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gdWr3l6Lx7GA+PzAYzrOffiqrgjBeqJI1wVp2EC7E7E=; b=OSheynOLU+iyURchcX44pDeouXJSGcY/74AKIDHCVLDyfMIyPnqj7UCHD2uh0CBsDV On3Do/+Woqr6tzTdMOFOFZu6Yd1gx04qebqcTBdPDFepM+F3rQs598DQyjyaMNnpnshz oM126AoyT0muPP61kvad6FAsITY/+ZPJ4EY43MpYV+isd/UhI0VZQiAPqR/VqFp2Mtr7 LljWgl1ro0OzQpzMeG8vOAXGXHZDIQCBiR2N/L0Uw2/lP73dQXcqE7ebKAOCC43gaMLX bB2sUhHu1adzzuKbHDzfwYZrIxtMhqDdzLvbqTiS6DUe8Cs3HmddYK7O6EiZLRjyAz6A i67Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qVjukzf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d21-20020a056402001500b0049b7f311e20si15083375edu.564.2023.01.17.05.58.26; Tue, 17 Jan 2023 05:58:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qVjukzf3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231190AbjAQNzh (ORCPT + 99 others); Tue, 17 Jan 2023 08:55:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229684AbjAQNzY (ORCPT ); Tue, 17 Jan 2023 08:55:24 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF05E7ABC; Tue, 17 Jan 2023 05:55:23 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id c4-20020a1c3504000000b003d9e2f72093so21035249wma.1; Tue, 17 Jan 2023 05:55:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gdWr3l6Lx7GA+PzAYzrOffiqrgjBeqJI1wVp2EC7E7E=; b=qVjukzf3AL4RFTbzl4nNjsVAhOPp2mmpE7QQizyXC+6PqDzg7A19WIaQ5k4BwSipla +CQRQu6nk6M2Nb8ZZn2u4x6/AExBF5u3vd4l6f1nItY/V65bX4dtgE3rKbSQlLzkYt1U ZQDY2cOS0BDP1Hd3PZUj17UoBKLV+pdCwT5bw7c4eznuC2n/WT7wdJHlg2SVulJ3WBU2 Mx8zHKPVqa1EVkW3lDAaplPoXoCKLKl49llsuXPpJIf5R1yjKlDZYOw/UocMBeWAN8hS 7prfP/6QPYpJGMhyV8sPj+X07H0rffS83rxQ5CeUX2UhcqjFpnXl5AaS6QG9ZnAuX6Ls e6WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gdWr3l6Lx7GA+PzAYzrOffiqrgjBeqJI1wVp2EC7E7E=; b=htQBPc60auRNwqqFBykyPoujtrRhD6eG7lft4j9/mdAJB2lQB93iyXZ9qIQzIo+lF6 TxCnqfsvNAlAwXO5LvoFWaVg5YQTnKpFmWeBRSgNNslVNeMwZ0e80gZayQ/6IMl3+SKk XGmpTJ3kKYpDueZTCRYFumMtI69292PkJ0y/lgHerSAhMGvqmqR3yD8hRxrx8j/3Bk+V 3mwK2zQww6LeMPZQwcKyw1+XKZyihSAvNm3D0l6PjAyqW3IUwW+INKJZnS6zyedEavUI Lv54tklklAElKvyh9a2dhUwZ5WJEb/NZQbhxYoh3IHRq0cyxKsZHcYjll5yAyAlTQVXh umdg== X-Gm-Message-State: AFqh2koadQic3+/1u+GDeU6p3sWSHrMH+bA51pch6Z43Pw+1JAAEhG8d Hvupnkd1yLeM+7s2W4epL84rdGPSx48= X-Received: by 2002:a05:600c:3acf:b0:3d9:fb89:4e3b with SMTP id d15-20020a05600c3acf00b003d9fb894e3bmr3108945wms.23.1673963722295; Tue, 17 Jan 2023 05:55:22 -0800 (PST) Received: from localhost.localdomain (93-34-92-88.ip49.fastwebnet.it. [93.34.92.88]) by smtp.googlemail.com with ESMTPSA id s7-20020a1cf207000000b003d98438a43asm35147461wmc.34.2023.01.17.05.55.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 05:55:21 -0800 (PST) From: Christian Marangi To: Bjorn Andersson , Andy Gross , 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 v3 2/6] clk: qcom: gcc-sdm660: drop redundant F define Date: Tue, 17 Jan 2023 14:54:55 +0100 Message-Id: <20230117135459.16868-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230117135459.16868-1-ansuelsmth@gmail.com> References: <20230117135459.16868-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755278402271936875?= X-GMAIL-MSGID: =?utf-8?q?1755278402271936875?= The same exact F frequency table entry is defined in clk-rcg.h Drop the redundant define to cleanup code. Signed-off-by: Christian Marangi --- drivers/clk/qcom/gcc-sdm660.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/clk/qcom/gcc-sdm660.c b/drivers/clk/qcom/gcc-sdm660.c index db918c92a522..6afce8e42ede 100644 --- a/drivers/clk/qcom/gcc-sdm660.c +++ b/drivers/clk/qcom/gcc-sdm660.c @@ -25,8 +25,6 @@ #include "reset.h" #include "gdsc.h" -#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) } - enum { P_XO, P_SLEEP_CLK, From patchwork Tue Jan 17 13:54:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 44680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1768194wrn; Tue, 17 Jan 2023 05:58:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXt7nqab+eA1ikHEOo97hy21HTp1kBfE7M9ArP5ERaB8GTmZGrvW/yeyD1yzooLWlC325yaJ X-Received: by 2002:a17:906:e0c5:b0:86d:67ee:d607 with SMTP id gl5-20020a170906e0c500b0086d67eed607mr12741648ejb.64.1673963909306; Tue, 17 Jan 2023 05:58:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673963909; cv=none; d=google.com; s=arc-20160816; b=b/CVvWuOH3XhBQYw46aDhK5kiViXH5nuNwMYOFpurzqVFJK/8jXhrvYKBdkwwGHuRw YqZbI6jxS1RszPwgXFaZ6YazxH+SHMeVNeLaNODPQMD2q6cs/rbGka+uMIThZZt3sFRv QN/Cr2X5lxY+bc7SOo96EUNgd6EtU5f6rIlj4E4kvm00NMIWjqTbAqvdjAmFAZRjGlde bTDihxADoP/rVMe3Zrdzg1QL4Hrev2nEKSNEgcZQ7vahl5gqkcVTxPtH2PqU/ADB+xVc 4s3K33CjumbFdGwrT7NZsy7l0thNvbeSlJnyi2dJa52u06HbVDxocKJoBW2072V55oy1 Ra/A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=W/YQBj43LvkuMtMLizVCG8ygRtt4qtKP2BAx3uKg5y0=; b=cADEKNIwr+tf/2fh3Oqz2J0ZaZfF8CNlEmaHEC7JG05mjDsdDYRxQQ4MRm6aC+y/ZF RO84b4cqMZwIQQQLWk4HfDe8KGzwlGM5HZOU6W64yCLrWNXDx1myyFmnSFWMTlwiplOd VL07Ask4VBybvYJpNmRSRz6IA369YbtlSk/6gvdTqghm2OpGtTQStpW1AUdANPDt6iW8 7yXQQPpWR8Mnh+6HCUIaiN97uhYoqKOWMolI6lCR8jj5ldzuSofUbpvY79I96TW1QLJI y33WJIIHQc+2X6U5fhBLYmiZ7S5TZukUX8/620iFmPOm81NjJmUFbt9CTksopoXekdOu YwJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OdHzgEo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp15-20020a170906c14f00b008716321a08fsi5624331ejc.708.2023.01.17.05.58.03; Tue, 17 Jan 2023 05:58:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=OdHzgEo6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231337AbjAQNzu (ORCPT + 99 others); Tue, 17 Jan 2023 08:55:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230220AbjAQNz0 (ORCPT ); Tue, 17 Jan 2023 08:55:26 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3D5CA5D1; Tue, 17 Jan 2023 05:55:24 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id fl11-20020a05600c0b8b00b003daf72fc844so4757711wmb.0; Tue, 17 Jan 2023 05:55:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W/YQBj43LvkuMtMLizVCG8ygRtt4qtKP2BAx3uKg5y0=; b=OdHzgEo61CAxJoYC3tyZRbSQ5t1Ix3w/mnWeZRcfXysN0zeH/HfqmnhjOeOIzjKRqx b51SfG3Q2sgY3X7M6NtioNu2Xn2vvZflbQdoqdDzIl3bFlU2nsGxKm+Ccbzoiqh5O+vQ hq9klslOQwg3PbB2CuUsbx12+qAC7zegju3FY0fxkr8yO3Tla0acf1FvGB0w69xhh9N4 fuyfvPfUfWROlFIu3gltjOFwftfIaUcoc1YIEds4fOCz/Dbn7YjoV18wTFd3Ik2tL5LF FDzQaeD90mo+OMBddt46YKScvhLrImFpub/zYfblt4cXJ62ZhfweCO1o5qs25aTBvoEu DYrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W/YQBj43LvkuMtMLizVCG8ygRtt4qtKP2BAx3uKg5y0=; b=A7ezuIzQe8ptldXCkrQJ+7WCYc/LgeN3nK1Lv1ZkacaE5By/JT9a9MnabiiJEGUd6x wENCxXzDxNkUJubAM7bFM3RqwruNW63b65M30hvs13doiIQqg3+1vgbR/zJvnzyJmd4U Vp13PK6AEOi/AgUL/qOHNpyKG4S/7lj/7pbtHv98VNKaNAhWEzXL+iC5o0LDo/8etWVb jgrY1ZRML1GDpW8FVPb3L4SnohUAhUSmMNx+lp8nDuzR+LVy9RsF3QGGsLwfGesbJqZS 0BpRbUtu921bXTzVrDcJFzQjr1FRlLmlyLsjL+TVH7xyf4j02ByGcyAZuoXYbl581p9H f9dA== X-Gm-Message-State: AFqh2kpvCCdqYRj2UHUg/tHO7CWM0s0PuC76g0G7Yp6nNRoGshcxBVXT /WleoS5MlIPX0bRo92js7Vz+dDCOhus= X-Received: by 2002:a05:600c:2046:b0:3d2:3ae8:886a with SMTP id p6-20020a05600c204600b003d23ae8886amr11807809wmg.17.1673963723187; Tue, 17 Jan 2023 05:55:23 -0800 (PST) Received: from localhost.localdomain (93-34-92-88.ip49.fastwebnet.it. [93.34.92.88]) by smtp.googlemail.com with ESMTPSA id s7-20020a1cf207000000b003d98438a43asm35147461wmc.34.2023.01.17.05.55.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 05:55:22 -0800 (PST) From: Christian Marangi To: Bjorn Andersson , Andy Gross , 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 v3 3/6] clk: qcom: common: add qcom_find_freq_exact Date: Tue, 17 Jan 2023 14:54:56 +0100 Message-Id: <20230117135459.16868-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230117135459.16868-1-ansuelsmth@gmail.com> References: <20230117135459.16868-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755278380417053887?= X-GMAIL-MSGID: =?utf-8?q?1755278380417053887?= Currently qcom_find_freq will always find a freq following a CEIL logic but we may need to find the exact requesting frequency or return NULL. Add qcom_find_freq_exact to perform a search of the exact requested frequency. Signed-off-by: Christian Marangi --- drivers/clk/qcom/common.c | 17 +++++++++++++++++ drivers/clk/qcom/common.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index 75f09e6e057e..ffa91bcc0b0a 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -57,6 +57,23 @@ const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f, } EXPORT_SYMBOL_GPL(qcom_find_freq_floor); +const +struct freq_tbl *qcom_find_freq_exact(const struct freq_tbl *f, unsigned long rate) +{ + if (!f) + return NULL; + + if (!f->freq) + return f; + + for (; f->freq; f++) + if (rate == f->freq) + return f; + + return NULL; +} +EXPORT_SYMBOL_GPL(qcom_find_freq_exact); + int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, u8 src) { int i, num_parents = clk_hw_get_num_parents(hw); diff --git a/drivers/clk/qcom/common.h b/drivers/clk/qcom/common.h index 9c8f7b798d9f..7bd935332634 100644 --- a/drivers/clk/qcom/common.h +++ b/drivers/clk/qcom/common.h @@ -45,6 +45,8 @@ extern const struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate); extern const struct freq_tbl *qcom_find_freq_floor(const struct freq_tbl *f, unsigned long rate); +extern const struct freq_tbl *qcom_find_freq_exact(const struct freq_tbl *f, + unsigned long rate); extern void qcom_pll_set_fsm_mode(struct regmap *m, u32 reg, u8 bias_count, u8 lock_count); extern int qcom_find_src_index(struct clk_hw *hw, const struct parent_map *map, From patchwork Tue Jan 17 13:54:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 44679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1767925wrn; Tue, 17 Jan 2023 05:57:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXuvWDIX2sh6mHBdfaT+LuyR4FkvERAVrbFIiXhK+blbFXDHLIwqMIcRJDA/7f1FDtNbYOan X-Received: by 2002:a17:906:6846:b0:84d:2fdf:a41b with SMTP id a6-20020a170906684600b0084d2fdfa41bmr2620023ejs.50.1673963872855; Tue, 17 Jan 2023 05:57:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673963872; cv=none; d=google.com; s=arc-20160816; b=r8pUKHGqTuj5UUl7GOBa1l2HAV2r5QeGHTXMRWn/PHPMzGngkvUNCUG+uwk41TJo2w hA5Xb/iVzS4jTht4cRifJt4Kl9H6b3a6BNYuuvdabFAgR2m65k6m0PbjEO8TyHlieqg2 xdN9FYpi8Tci99D6LLIrVeT8rywjawTMH5QSVqDApe2T+NeSwEEyR8+CyJO+3HKKLbda NMphaZvgrjIFGPN7uOV0E5f+qxqHHm0Og95sV0z/imjSiFxJxaTATrWqRD9ow6gt5000 dn+GjfTrTRRSnKONFdC18xsjkhcmVi1RmueQIZA0FhIK7Wp4mGyi3hdQTZfLWV4SGaK0 pjLw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Fl9uAlkhTt9RYlBsdPZ+Iiwc7QljNWDz/51SBuY/ELg=; b=P74GWRyPDI8nccPhYnzo1ad2WbyS0fs79eTRV4o6vBuGy12cqK2ia9tbM670Gi8od/ C1xnwIoH9eI8LITY+0JH26VFD+3+xoIwHPz0+rahMCevMAW9xJ+EY2WF0qMFNuPxOpTA sW4l0eINt2oLBo/OC5220jdrZl9iyvielNmcWvbLRZcuVFJLl+G/ITpgcafShGu0wg9v U3ekKu+X8OZcjLnfqYWlHnEVvLExUXu5ZLU5iENWm2K/w/XTvKrJf4nqCOfq7JV2FVEK Dp99Sdxz/Fcv0hEp/pcKnc4KhVaJk5WEgw3T4S3zdeIE+p8nQvg04F16Motg0dtdaQvd cwUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SHOi6CAI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ww11-20020a170907084b00b007878c9d73a2si35906016ejb.426.2023.01.17.05.57.29; Tue, 17 Jan 2023 05:57:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SHOi6CAI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231319AbjAQNzp (ORCPT + 99 others); Tue, 17 Jan 2023 08:55:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbjAQNz0 (ORCPT ); Tue, 17 Jan 2023 08:55:26 -0500 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 812CC35B4; Tue, 17 Jan 2023 05:55:25 -0800 (PST) Received: by mail-wm1-x32b.google.com with SMTP id o17-20020a05600c511100b003db021ef437so3122962wms.4; Tue, 17 Jan 2023 05:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Fl9uAlkhTt9RYlBsdPZ+Iiwc7QljNWDz/51SBuY/ELg=; b=SHOi6CAIQZ7rSBG5BxuEzyBPFJstWdOK7h2G7Ar8FpFxLmE+y4RBFp4If/5kNcNC/U jW+hHR/cw8753ZF0q9sQ7kz5ebAmQkRUMmdzEa9hyA4LagyPc+FYJQzGCLAveabAd1EV 1XDl1dcIsY3Qou5QdHqpmCJLjXUeIHxPbuKG8LUyoOSFaxyPMK9SVIqoe8+76jk9LMhZ ErhcL7k/UKkWHR1nmqqeBQfkTAur2dd/8jN2jCgI2sHdzcgRfoADMm5MrXVpWKDnxKk2 R3BRhYfJAQ7N/N/5rVd0S63ckGH6HESJbJZT9MXVh7YFv98lnF6pH418eIWHDbiENQik 9t9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fl9uAlkhTt9RYlBsdPZ+Iiwc7QljNWDz/51SBuY/ELg=; b=Xx76wQ751FzzCaTUUhvMyGl/P/bXjxvmJg+1EoxkoSOGQT44/nToTJgdFrBhtXUKMN YT5E/zp01HLbblexu7eWVhtA5SxcEBeYX3Jl2rjU2IRGvk+Ud7HyN47UNVgYhTuuL7WF J1KiEsiTnrXbgXYE/dNvGfQ/X8WogFeEn5aHeoeqXY/grKdTBE429PJ0b8k1N6jYyvo9 weyVvhsoYumXnHNtNEJyIthWHYzcSvOzW2qhbPo6CnANgpAgFfJ4uOu0JQlkulcnTbce OpZ26v5XAmNldfmdrPrykSKFHAs3c9y44IMJEqjdPzpUCWpPniS6gsQ0KIPj0ynMbJ8m sjNw== X-Gm-Message-State: AFqh2kqD5ljZx7xHKLQf4b4hz0wCjYz7Z4yv+FpRr3E6pH415xOY4eMr j3b+1Mn0ZPRyeRSR0qzCIMk= X-Received: by 2002:a05:600c:3c83:b0:3d9:e5d3:bf with SMTP id bg3-20020a05600c3c8300b003d9e5d300bfmr3110851wmb.32.1673963724002; Tue, 17 Jan 2023 05:55:24 -0800 (PST) Received: from localhost.localdomain (93-34-92-88.ip49.fastwebnet.it. [93.34.92.88]) by smtp.googlemail.com with ESMTPSA id s7-20020a1cf207000000b003d98438a43asm35147461wmc.34.2023.01.17.05.55.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 05:55:23 -0800 (PST) From: Christian Marangi To: Bjorn Andersson , Andy Gross , 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 v3 4/6] clk: qcom: clk-rcg2: don't re-search config on rcg2_set_rate Date: Tue, 17 Jan 2023 14:54:57 +0100 Message-Id: <20230117135459.16868-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230117135459.16868-1-ansuelsmth@gmail.com> References: <20230117135459.16868-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755278342100833081?= X-GMAIL-MSGID: =?utf-8?q?1755278342100833081?= Currently the rcg2 driver search the rate to apply 2 times. - In _freq_tbl_determine_rate for the determine_rate function used by core clk to understand the best rate to set with set_rate - In rcg2_set_rate where the suggested rate is not trusted and searched another time using a CEIL or FLOOR policy. This is fundamentally wrong as we are ignoring what core clock is deciding and just setting whatever clock configuration we want for the suggested clock. The problem is in the fact that the correct clock should have already be searched and selected with the determine_rate function and set_rate should just apply whatever clock was provided. Rework the function using the find_req_exact and by trusting whatever core clk is asking to set. Signed-off-by: Christian Marangi --- drivers/clk/qcom/clk-rcg2.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index 76551534f10d..3f15e993dc04 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -352,23 +352,12 @@ static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) return update_config(rcg); } -static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, - enum freq_policy policy) +static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate) { struct clk_rcg2 *rcg = to_clk_rcg2(hw); const struct freq_tbl *f; - switch (policy) { - case FLOOR: - f = qcom_find_freq_floor(rcg->freq_tbl, rate); - break; - case CEIL: - f = qcom_find_freq(rcg->freq_tbl, rate); - break; - default: - return -EINVAL; - } - + f = qcom_find_freq_exact(rcg->freq_tbl, rate); if (!f) return -EINVAL; @@ -378,25 +367,25 @@ static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, static int clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { - return __clk_rcg2_set_rate(hw, rate, CEIL); + return __clk_rcg2_set_rate(hw, rate); } static int clk_rcg2_set_floor_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { - return __clk_rcg2_set_rate(hw, rate, FLOOR); + return __clk_rcg2_set_rate(hw, rate); } static int clk_rcg2_set_rate_and_parent(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate, u8 index) { - return __clk_rcg2_set_rate(hw, rate, CEIL); + return __clk_rcg2_set_rate(hw, rate); } static int clk_rcg2_set_floor_rate_and_parent(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate, u8 index) { - return __clk_rcg2_set_rate(hw, rate, FLOOR); + return __clk_rcg2_set_rate(hw, rate); } static int clk_rcg2_get_duty_cycle(struct clk_hw *hw, struct clk_duty *duty) From patchwork Tue Jan 17 13:54:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 44678 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1767713wrn; Tue, 17 Jan 2023 05:57:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXsQ4G9Yxo4KEH59TLDhmJuWtHQMk9UUx3uEgU/hLNuhnmS2rGmqTjilYtymHIs0THkUf+QY X-Received: by 2002:a05:6402:4486:b0:48f:a9a2:29f4 with SMTP id er6-20020a056402448600b0048fa9a229f4mr3422471edb.1.1673963841689; Tue, 17 Jan 2023 05:57:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673963841; cv=none; d=google.com; s=arc-20160816; b=wCyfAR1rVvQa5b9FNPm4IpSJRslY889bghs48MdLmYennH5D0OzNhaPQrSFZIH4rQX BjBpfVzXY9XD4S3IMH31EyBZ8tYGjTRNt0LhJE4f7f2pL9yPousvdFy6bnsbXNnrEgC5 yAsxu2qcWSoZyc1txdT8xDfuN1M/GU18M9OwUpSieVivLQ3tvWk/I6sdzbSaJYHlDTxx 6nR5yoSAptG9mzJBFNC8byncX9Fo6WI6BBK/j39kCKeRnK9gVl0TlZBzgP2dhsjg8bje SSRFyg1qWBY/UlayzkxHSstUVblfLCvaQAjLybvBKOvlmXppIm1jtnsZID80eoEEteEH 7k7A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dhP2Z3yR2g3hqw76duqiBKeqsfWvBoTj0uC4C1GeBLg=; b=n0jNkvZmIWK6ZIB6i+iTxK55LSJkbVI62uaoog1QfEByrRlTy8UeSuBH4ENoDOmNfy yZum7r1beFty/1ZPo9HwgJh4E/JxA6SVQ57ddClZDlbW0nV4nnVs1Lb9mTd/JUE+2MU+ IWEm8DenJD+C48lElOifEN+x2QXscRZYuomBhoihvXYXly5oCO3byXJy7et5sNRRx4Ic 0M/FrDT74tXUGR5dAiGFcJl1VkhSeoxQeB958KKrOHQYR4iLUoDNEXt9G9L7vo9V4d3t dTVYnuGUR97GLwRNxxYGma5HL4oLHnxuGGU5JiQvdhEF6LjUJbKKQegJv79GqIrhCBxJ g0hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UsKMQ9fo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020aa7d442000000b0049e02ae1365si9126410edr.117.2023.01.17.05.56.57; Tue, 17 Jan 2023 05:57:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UsKMQ9fo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231233AbjAQNzm (ORCPT + 99 others); Tue, 17 Jan 2023 08:55:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230342AbjAQNz2 (ORCPT ); Tue, 17 Jan 2023 08:55:28 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B110846B0; Tue, 17 Jan 2023 05:55:26 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id g10so22302719wmo.1; Tue, 17 Jan 2023 05:55:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dhP2Z3yR2g3hqw76duqiBKeqsfWvBoTj0uC4C1GeBLg=; b=UsKMQ9fod7JZTu7NuyHtS7gJZKPuu1OPsXPKImDikndp9qUpsPgMNMtk5nDBJuWgdd LB+yNd1XQFeml/ASr2RqOc7b0UuLz9xIMO0ehNdNqQXe/DbSbnZXnNrjNAXh2V58cdKg UddBLjUwFy+6QidN7kRgzQPeQGNUVSwWQ70RePZdDfziRzOLCFBRhbJZ/mPpXhAQfgiO /ihJQ52vG1K1/ih6g613rnRT/XywRxQc1X5CSO/2pegQAUeXE4ZIEsKg58AO+R62qDRd XWPDB+EQVZeQON2cQA8c0T8CfzTM4WIVTbMzPOwK41kP6N2XP2D4aM0paU5HRj2wzxvs Ay2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dhP2Z3yR2g3hqw76duqiBKeqsfWvBoTj0uC4C1GeBLg=; b=QEKcNoCIzU4AcIMZlUBaCpXr1kcWQZhAbPkEfd1rX43gv/a5D+LMq8LKifnEjSQfS4 x4OY7Ax/xW7djTWSwjjv33NXPW3UUQnDHJ+IHMWZlIEe6aP9Ok34MwC/GZ+nYXG79Pqe ty6LsknjT8OUJbR/rUnfFhhcjqXjxUvcqeDWbZtyuHTwthJCSKykCORhpsTs192wLDmJ ccEh3x25QU9qf1NV3+6LWURxO0E6BnDoNh6Zv80s86zZ0tUEmQJNXNuCHLQv47IUCRcx z+1BYfYiAkPIx5edTFWB4ZDmWJBt3Wa1wOGfqBgHg1n/V9HQMcpM3Tkqg8d6kwuuvdbp XJww== X-Gm-Message-State: AFqh2ko6Rzs8pFS2/Vv5g/KqNZCieoSaWeXcvz62X5bfEi8oMPqPHsrZ cxBNeaKa6NgCXZUZuvJhyLQ= X-Received: by 2002:a05:600c:34d1:b0:3da:faf6:54d1 with SMTP id d17-20020a05600c34d100b003dafaf654d1mr3088821wmq.35.1673963724921; Tue, 17 Jan 2023 05:55:24 -0800 (PST) Received: from localhost.localdomain (93-34-92-88.ip49.fastwebnet.it. [93.34.92.88]) by smtp.googlemail.com with ESMTPSA id s7-20020a1cf207000000b003d98438a43asm35147461wmc.34.2023.01.17.05.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 05:55:24 -0800 (PST) From: Christian Marangi To: Bjorn Andersson , Andy Gross , 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 , Robert Marko Subject: [PATCH v3 5/6] clk: qcom: clk-rcg2: introduce support for multiple conf for same freq Date: Tue, 17 Jan 2023 14:54:58 +0100 Message-Id: <20230117135459.16868-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230117135459.16868-1-ansuelsmth@gmail.com> References: <20230117135459.16868-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755278246700056577?= X-GMAIL-MSGID: =?utf-8?q?1755278309357215360?= Some RCG frequency can be reached by multiple configuration. We currently declare multiple configuration for the same frequency but that is not supported and always the first configuration will be taken. These multiple configuration are needed as based on the current parent configuration, it may be needed to use a different configuration to reach the same frequency. To handle this introduce 2 new macro, FM and C. - FM is used to declare an empty freq_tbl with just the frequency and an array of confs to insert all the config for the provided frequency. - C is used to declare a freq_conf where src, pre_div, m and n are provided. The driver is changed to handle this special freq_tbl and select the correct config by calculating the final rate and deciding based on the one that is less different than the requested one. Function set_rate(_and_parent) will then select the config based on the current or the requested parent for the set_rate_and_parent variant. Tested-by: Robert Marko Signed-off-by: Christian Marangi --- drivers/clk/qcom/clk-rcg.h | 14 +++- drivers/clk/qcom/clk-rcg2.c | 129 ++++++++++++++++++++++++++++++++---- 2 files changed, 129 insertions(+), 14 deletions(-) diff --git a/drivers/clk/qcom/clk-rcg.h b/drivers/clk/qcom/clk-rcg.h index 01581f4d2c39..18f4f7b59f36 100644 --- a/drivers/clk/qcom/clk-rcg.h +++ b/drivers/clk/qcom/clk-rcg.h @@ -7,7 +7,17 @@ #include #include "clk-regmap.h" -#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) } +#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n), 0, NULL } + +#define FM(_f, _confs) { .freq = (_f), .confs_num = ARRAY_SIZE(_confs), .confs = (_confs) } +#define C(s, h, m, n) { (s), (2 * (h) - 1), (m), (n) } + +struct freq_conf { + u8 src; + u8 pre_div; + u16 m; + u16 n; +}; struct freq_tbl { unsigned long freq; @@ -15,6 +25,8 @@ struct freq_tbl { u8 pre_div; u16 m; u16 n; + int confs_num; + const struct freq_conf *confs; }; /** diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index 3f15e993dc04..dfc2ab1cd59a 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -209,11 +209,60 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) return __clk_rcg2_recalc_rate(hw, parent_rate, cfg); } +static void +_freq_tbl_determine_parent(struct clk_hw *hw, struct freq_tbl *f_tbl, + const struct freq_tbl *f, unsigned long req_rate) +{ + unsigned long best_rate = 0, parent_rate, rate; + const struct freq_conf *conf, *best_conf; + struct clk_rcg2 *rcg = to_clk_rcg2(hw); + struct clk_hw *p; + int index, i; + + /* Search in each provided config the one that is near the wanted rate */ + for (i = 0, conf = f->confs; i < f->confs_num; i++, conf++) { + index = qcom_find_src_index(hw, rcg->parent_map, conf->src); + if (index < 0) + continue; + + p = clk_hw_get_parent_by_index(hw, index); + if (!p) + continue; + + parent_rate = clk_hw_get_rate(p); + rate = calc_rate(parent_rate, conf->n, conf->m, conf->n, conf->pre_div); + + if (rate == req_rate) { + best_conf = conf; + break; + } + + if (abs(req_rate - rate) < abs(best_rate - rate)) { + best_rate = rate; + best_conf = conf; + } + } + + /* + * Very unlikely. + * Force the first conf if we can't find a correct config. + */ + if (unlikely(i == f->confs_num)) + best_conf = f->confs; + + /* Apply the config */ + f_tbl->src = best_conf->src; + f_tbl->pre_div = best_conf->pre_div; + f_tbl->m = best_conf->m; + f_tbl->n = best_conf->n; +} + static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, struct clk_rate_request *req, enum freq_policy policy) { unsigned long clk_flags, rate = req->rate; + struct freq_tbl f_tbl; struct clk_hw *p; struct clk_rcg2 *rcg = to_clk_rcg2(hw); int index; @@ -232,7 +281,15 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, if (!f) return -EINVAL; - index = qcom_find_src_index(hw, rcg->parent_map, f->src); + f_tbl = *f; + /* + * A single freq may be reached by multiple configuration. + * Try to find the bast one if we have this kind of freq_table. + */ + if (f->confs) + _freq_tbl_determine_parent(hw, &f_tbl, f, rate); + + index = qcom_find_src_index(hw, rcg->parent_map, f_tbl.src); if (index < 0) return index; @@ -242,18 +299,18 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, return -EINVAL; if (clk_flags & CLK_SET_RATE_PARENT) { - rate = f->freq; - if (f->pre_div) { + rate = f_tbl.freq; + if (f_tbl.pre_div) { if (!rate) rate = req->rate; rate /= 2; - rate *= f->pre_div + 1; + rate *= f_tbl.pre_div + 1; } if (f->n) { u64 tmp = rate; - tmp = tmp * f->n; - do_div(tmp, f->m); + tmp = tmp * f_tbl.n; + do_div(tmp, f_tbl.m); rate = tmp; } } else { @@ -261,7 +318,7 @@ static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f, } req->best_parent_hw = p; req->best_parent_rate = rate; - req->rate = f->freq; + req->rate = f_tbl.freq; return 0; } @@ -352,40 +409,86 @@ static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) return update_config(rcg); } -static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate) +static void +__clk_rcg2_select_conf(struct clk_hw *hw, struct freq_tbl *f_tbl, + const struct freq_tbl *f, u8 parent_index) +{ + const struct freq_conf *conf, *best_conf; + struct clk_rcg2 *rcg = to_clk_rcg2(hw); + int index, i; + + /* Search in each provided config the one that is near the wanted rate */ + for (i = 0, conf = f->confs; i < f->confs_num; i++, conf++) { + index = qcom_find_src_index(hw, rcg->parent_map, conf->src); + if (index < 0) + continue; + + if (index == parent_index) + break; + } + + /* + * Very unlikely. + * Force the first conf if we can't find a correct config. + */ + if (unlikely(i == f->confs_num)) + best_conf = f->confs; + + /* Apply the config */ + f_tbl->src = best_conf->src; + f_tbl->pre_div = best_conf->pre_div; + f_tbl->m = best_conf->m; + f_tbl->n = best_conf->n; +} + +static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, u8 index) { struct clk_rcg2 *rcg = to_clk_rcg2(hw); const struct freq_tbl *f; + struct freq_tbl f_tbl; f = qcom_find_freq_exact(rcg->freq_tbl, rate); if (!f) return -EINVAL; - return clk_rcg2_configure(rcg, f); + f_tbl = *f; + /* + * A single freq may be reached by multiple configuration. + * Select the conf for the requested parent. + */ + if (f->confs) { + /* Use current parent if not set */ + if (index < 0) + index = clk_hw_get_parent_index(hw); + + __clk_rcg2_select_conf(hw, &f_tbl, f, index); + } + + return clk_rcg2_configure(rcg, &f_tbl); } static int clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { - return __clk_rcg2_set_rate(hw, rate); + return __clk_rcg2_set_rate(hw, rate, -1); } static int clk_rcg2_set_floor_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { - return __clk_rcg2_set_rate(hw, rate); + return __clk_rcg2_set_rate(hw, rate, -1); } static int clk_rcg2_set_rate_and_parent(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate, u8 index) { - return __clk_rcg2_set_rate(hw, rate); + return __clk_rcg2_set_rate(hw, rate, index); } static int clk_rcg2_set_floor_rate_and_parent(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate, u8 index) { - return __clk_rcg2_set_rate(hw, rate); + return __clk_rcg2_set_rate(hw, rate, index); } static int clk_rcg2_get_duty_cycle(struct clk_hw *hw, struct clk_duty *duty) From patchwork Tue Jan 17 13:54:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 44681 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1768291wrn; Tue, 17 Jan 2023 05:58:41 -0800 (PST) X-Google-Smtp-Source: AMrXdXsvSjAE27eTn66GiJ6+WrvFrLvoE3l89oeoW/V4obVndKTlG/18rFfq4o9ch3nJCmHoDkQ7 X-Received: by 2002:a05:6402:24a4:b0:49e:1f0e:e209 with SMTP id q36-20020a05640224a400b0049e1f0ee209mr6236208eda.10.1673963921508; Tue, 17 Jan 2023 05:58:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673963921; cv=none; d=google.com; s=arc-20160816; b=0kzVIqqaElGhxsPrbw0mK/upfzv1gL0uToZY3kCkw+peRjjWhiaht8adYCjDs0QXbM fWk7AIpdzAo7nELe+AlpBNZg2zXQ7R1G/6LQCoqCvCKgeIbEudooQvNdby8s8B2/irBJ WeBEGeIWHhdaiXo630rzHc2zBsQH8Jl74l9Aq7jh8d8npeM42PN+TX0HwPs/d/7t0eEH yShpIS+WMnBobQy8t698WKIMjRSNI0/gRepyInBctf2UoMXuv0uV92YIqboZeQ6Rqgt3 319Z4z98vsjI9bWv9k5guJlRg9OJitNHKe5s7jp2EI+CzcOqpojaGoNPktem0VtqisCQ cr1A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=N+8K4EO+Daz1wxfQ80+5vMacSGUxLmGR0DsNNmoO1rU=; b=vrgynCL482KscPHLyJrcaC4nsfkbWCK5KdA0IAGPpUDtnYM97bh8J6FnUuty+vUiUP evPlF1KhqYoLOsnSU1bq3hSUSrFGFKPofnK6c5jhpRS8RUcBLfbx3xIbZOH3QdfG2YSZ xg+wZhfjXVIFXqA+naQ956GgbFKwW2LJq9tpMeAWXktxkuW9ylwY7p7HOyNWxbj8CZu9 oAJR0PL9leqQgQWe8Pxjt1WMOsv/l2/TjqRG6rqAWND1dHCiiySLL0vJU68oVN1jUVDu 13ASIzD4GMLkf9leGfo8bxMmJw1gog84pzUibAbTjg2IkT6bCK0GYbc9SS8TzYZCK9cT loIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="iyqM/nh3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a50eac7000000b0046e635ee69esi30580202edp.210.2023.01.17.05.58.17; Tue, 17 Jan 2023 05:58:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="iyqM/nh3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231354AbjAQNzz (ORCPT + 99 others); Tue, 17 Jan 2023 08:55:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbjAQNz2 (ORCPT ); Tue, 17 Jan 2023 08:55:28 -0500 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EF6F7ABC; Tue, 17 Jan 2023 05:55:27 -0800 (PST) Received: by mail-wm1-x32f.google.com with SMTP id o17-20020a05600c511100b003db021ef437so3123031wms.4; Tue, 17 Jan 2023 05:55:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=N+8K4EO+Daz1wxfQ80+5vMacSGUxLmGR0DsNNmoO1rU=; b=iyqM/nh3hh0RdHGl3qNhNtb95HDQvufWzwOZ26VK/EFYAUOOqDzhl4tAydr1xF6e+M IDwemHIQ9xRh9Pg97SaISJR90cyn8U68WRoCeB34SOOGU7smX45ErRcnJlSERmgLTHeJ vPe6ODuVM4sOaGcGTJgSLBi1J7Gp+61zMoI2D5dj+/GC/AkPzSg0oNKPq9qIAsp52EnW /1fnpzlKyqnPQdI6ncSjoOAffFOOZFo/STscOKLo5NbW9dDwSciHR5Tx6grPpjEGW2mp sjTbPwoYx3lPSHHZ44ECYo+XXkNO68f1kVkNublAm/tS9OrOt5V/fC4XrI4SNov0c4w5 Ft4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N+8K4EO+Daz1wxfQ80+5vMacSGUxLmGR0DsNNmoO1rU=; b=W94jtJRQNoC9AATwS9OoM0n2PtLT11Okhusuyq6Tnlv94irUGvpniH3J6P2Gc+KjiJ ClwheQu3NUsmiUF86jAyJQ/W1DPayv7F3Vd3jJl3rePRasq24lWvatL7reiG4zUkUH9k uvxNWMwYxca0T4cDq+EyDbliMf2u9KPS7yJ4EoaT1BgIDud5vMNyc4emau9yL35zMIes IUI+1nejUer0Wy6gj7OJtRUZlnzDmHLuMIz5hFwgEt1hDyGBEq7jrutNzm+1oXt6/uIW +M0QJFXYjTinQ91hEclNJnpR4vGpoa6fgD8meyp6Bo0Xz47+k1+Nrm8AsscnBsNGjy3y V0Ig== X-Gm-Message-State: AFqh2kpY6H0vp0euFVGqTkVzI9mjJfFe0ncBE2cIIHQTOPlO78W4YfSq 3ALsNg1lsXNFNB9DbMX2750= X-Received: by 2002:a1c:7919:0:b0:3da:79f:8953 with SMTP id l25-20020a1c7919000000b003da079f8953mr11790148wme.41.1673963725885; Tue, 17 Jan 2023 05:55:25 -0800 (PST) Received: from localhost.localdomain (93-34-92-88.ip49.fastwebnet.it. [93.34.92.88]) by smtp.googlemail.com with ESMTPSA id s7-20020a1cf207000000b003d98438a43asm35147461wmc.34.2023.01.17.05.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 05:55:25 -0800 (PST) From: Christian Marangi To: Bjorn Andersson , Andy Gross , 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 , Robert Marko Subject: [PATCH v3 6/6] clk: qcom: gcc-ipq8074: rework nss_port5/6 clock to multiple conf Date: Tue, 17 Jan 2023 14:54:59 +0100 Message-Id: <20230117135459.16868-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230117135459.16868-1-ansuelsmth@gmail.com> References: <20230117135459.16868-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755278393336836482?= X-GMAIL-MSGID: =?utf-8?q?1755278393336836482?= Rework nss_port5/6 to use the new multiple configuration implementation and correctly fix the clocks for these port under some corner case. This is particularly relevant for device that have 2.5G or 10G port connected to port5 or port 6 on ipq8074. As the parent are shared across multiple port it may be required to select the correct configuration to accomplish the desired clock. Without this patch such port doesn't work in some specific ethernet speed as the clock will be set to the wrong frequency as we just select the first configuration for the related frequency instead of selecting the best one. Tested-by: Robert Marko # ipq8074 Qnap QHora-301W Signed-off-by: Christian Marangi --- drivers/clk/qcom/gcc-ipq8074.c | 64 +++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index 42d185fe19c8..02d04a552b78 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -1787,13 +1787,21 @@ static struct clk_regmap_div nss_port4_tx_div_clk_src = { }, }; +static const struct freq_conf ftbl_nss_port5_rx_clk_src_25[] = { + C(P_UNIPHY1_RX, 12.5, 0, 0), + C(P_UNIPHY0_RX, 5, 0, 0), +}; + +static const struct freq_conf ftbl_nss_port5_rx_clk_src_125[] = { + C(P_UNIPHY1_RX, 2.5, 0, 0), + C(P_UNIPHY0_RX, 1, 0, 0), +}; + static const struct freq_tbl ftbl_nss_port5_rx_clk_src[] = { F(19200000, P_XO, 1, 0, 0), - F(25000000, P_UNIPHY1_RX, 12.5, 0, 0), - F(25000000, P_UNIPHY0_RX, 5, 0, 0), + FM(25000000, ftbl_nss_port5_rx_clk_src_25), F(78125000, P_UNIPHY1_RX, 4, 0, 0), - F(125000000, P_UNIPHY1_RX, 2.5, 0, 0), - F(125000000, P_UNIPHY0_RX, 1, 0, 0), + FM(125000000, ftbl_nss_port5_rx_clk_src_125), F(156250000, P_UNIPHY1_RX, 2, 0, 0), F(312500000, P_UNIPHY1_RX, 1, 0, 0), { } @@ -1829,13 +1837,21 @@ static struct clk_regmap_div nss_port5_rx_div_clk_src = { }, }; +static struct freq_conf ftbl_nss_port5_tx_clk_src_25[] = { + C(P_UNIPHY1_TX, 12.5, 0, 0), + C(P_UNIPHY0_TX, 5, 0, 0), +}; + +static struct freq_conf ftbl_nss_port5_tx_clk_src_125[] = { + C(P_UNIPHY1_TX, 2.5, 0, 0), + C(P_UNIPHY0_TX, 1, 0, 0), +}; + static const struct freq_tbl ftbl_nss_port5_tx_clk_src[] = { F(19200000, P_XO, 1, 0, 0), - F(25000000, P_UNIPHY1_TX, 12.5, 0, 0), - F(25000000, P_UNIPHY0_TX, 5, 0, 0), + FM(25000000, ftbl_nss_port5_tx_clk_src_25), F(78125000, P_UNIPHY1_TX, 4, 0, 0), - F(125000000, P_UNIPHY1_TX, 2.5, 0, 0), - F(125000000, P_UNIPHY0_TX, 1, 0, 0), + FM(125000000, ftbl_nss_port5_tx_clk_src_125), F(156250000, P_UNIPHY1_TX, 2, 0, 0), F(312500000, P_UNIPHY1_TX, 1, 0, 0), { } @@ -1871,13 +1887,21 @@ static struct clk_regmap_div nss_port5_tx_div_clk_src = { }, }; +static struct freq_conf ftbl_nss_port6_rx_clk_src_25[] = { + C(P_UNIPHY2_RX, 5, 0, 0), + C(P_UNIPHY2_RX, 12.5, 0, 0), +}; + +static struct freq_conf ftbl_nss_port6_rx_clk_src_125[] = { + C(P_UNIPHY2_RX, 1, 0, 0), + C(P_UNIPHY2_RX, 2.5, 0, 0), +}; + static const struct freq_tbl ftbl_nss_port6_rx_clk_src[] = { F(19200000, P_XO, 1, 0, 0), - F(25000000, P_UNIPHY2_RX, 5, 0, 0), - F(25000000, P_UNIPHY2_RX, 12.5, 0, 0), + FM(25000000, ftbl_nss_port6_rx_clk_src_25), F(78125000, P_UNIPHY2_RX, 4, 0, 0), - F(125000000, P_UNIPHY2_RX, 1, 0, 0), - F(125000000, P_UNIPHY2_RX, 2.5, 0, 0), + FM(125000000, ftbl_nss_port6_rx_clk_src_125), F(156250000, P_UNIPHY2_RX, 2, 0, 0), F(312500000, P_UNIPHY2_RX, 1, 0, 0), { } @@ -1913,13 +1937,21 @@ static struct clk_regmap_div nss_port6_rx_div_clk_src = { }, }; +static struct freq_conf ftbl_nss_port6_tx_clk_src_25[] = { + C(P_UNIPHY2_TX, 5, 0, 0), + C(P_UNIPHY2_TX, 12.5, 0, 0), +}; + +static struct freq_conf ftbl_nss_port6_tx_clk_src_125[] = { + C(P_UNIPHY2_TX, 1, 0, 0), + C(P_UNIPHY2_TX, 2.5, 0, 0), +}; + static const struct freq_tbl ftbl_nss_port6_tx_clk_src[] = { F(19200000, P_XO, 1, 0, 0), - F(25000000, P_UNIPHY2_TX, 5, 0, 0), - F(25000000, P_UNIPHY2_TX, 12.5, 0, 0), + FM(25000000, ftbl_nss_port6_tx_clk_src_25), F(78125000, P_UNIPHY2_TX, 4, 0, 0), - F(125000000, P_UNIPHY2_TX, 1, 0, 0), - F(125000000, P_UNIPHY2_TX, 2.5, 0, 0), + FM(125000000, ftbl_nss_port6_tx_clk_src_125), F(156250000, P_UNIPHY2_TX, 2, 0, 0), F(312500000, P_UNIPHY2_TX, 1, 0, 0), { }