From patchwork Tue Jan 17 13:54:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 4115 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1767384wrn; Tue, 17 Jan 2023 05:56:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXtDzKJhideczIhi7XyiyaQ4LR7T6d+56NYbRaWx5MeGU9gXUvEkDVAMFrB8ioJI+p425W8z X-Received: by 2002:a17:907:6281:b0:7c4:f752:e95c with SMTP id nd1-20020a170907628100b007c4f752e95cmr4522383ejc.1.1673963781727; Tue, 17 Jan 2023 05:56:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673963781; cv=none; d=google.com; s=arc-20160816; b=qvJVolGf8xGyfQTc8H19ynRZKpf+H34OD/cUCdeT2yK7DrQ3BUtq5so44vqprPtjJL MV5d8YG6nJRDWIO5uGLrkrKqQu78FVOhCiwXvYu2A7ENkmM47feQUl16E0NYNQ+5DQ3M rgGUEV/KvrXqM4SPXG9rTGVq4CNK4+626nQsJsVZ14qs77omh+9RDCKd5TnJsQXc6P3d ARCN8mKZFrHZQt0SyZ3JPOORKgK38YmR6eb0EOzlt14ndwyWts4/6D85BbWWaTZhoWSq 6/wmy7RkLFGhgMdQmzAH+F12rFKeWHeKN0jAtedf5dEHWVV0M7dnCUgbHu+jLqitlUzW MOGA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=z60P+F5yrVPU+RcrdTjGo7YHCmfZ47F2G2bKTQG7QcQ=; b=h7DUgw2aqUohcMgRFBfCQfZ3VK9DWf5qHMAf+vSkw6moulQ2TFHOZ7JtHkrPTHrFJY AI7WxLqTp+dsIdDvSIENh1pTFDcPn/hjGVkcMvM+GfiMdAbEs3EHAFHvK4mFBOAeHqkH QuD13NDnPHlsu8vraUUNXEkW8RkwsqFCjjZl6HdTtwFIxsYoBmGpchM/0G4Q7J0rLW/8 5/nDgmIR1L5/3ERSZlaoJXpR9+dLPhG6dF5fi388kqOAJUEOKi1ftVuj5whfgzLwEudn BAcF23eH6qqUSKceJ9yZDGeLE62QktXPJie1JjeZy8AnbuH2MmszzbwlSpjtM264wf/v Zv5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZYBe+xbX; 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 sg34-20020a170907a42200b007acc6769292si35026015ejc.365.2023.01.17.05.55.57; Tue, 17 Jan 2023 05:56: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=ZYBe+xbX; 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 S230517AbjAQNzc (ORCPT + 99 others); Tue, 17 Jan 2023 08:55:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbjAQNzX (ORCPT ); Tue, 17 Jan 2023 08:55:23 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E5EB3C3E; Tue, 17 Jan 2023 05:55:22 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id q8so10501555wmo.5; 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:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=z60P+F5yrVPU+RcrdTjGo7YHCmfZ47F2G2bKTQG7QcQ=; b=ZYBe+xbXY0HrXWRYOjW1aeiRtYtxZfds1/0dMWPVBZSUa6fDFQeD1puw25NfpeJIlp qKk89WDEks39dvtQMGhl/hACUXC+H7llXvQfqVhxRq6t13lcNNooQtekL+Trj579qVrN 6mr0voeX0Zy3cdq/ehUYuO1sEazhbRwxpUtjd24Zpq+DBmTCJZ3HSEw/RiWs5Idm3quy vyNUfzJ1SFotkLsu47Op0/3ksURz3WqmPE2gAScxma+fdJ+mlTc8lpdrAUsiu6Yy7Qn3 UNzJuKTYY6Y/sG1wjIIxURu2KM8CjFDGgGD5nAOAuPXCq553H3bdzdVbCxANdlgmSwpG IoOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=z60P+F5yrVPU+RcrdTjGo7YHCmfZ47F2G2bKTQG7QcQ=; b=RLvrtAynvhsvclQ7b3raXCPCOKewOmFaVCKBRrrVlzLTmYGwDg9FlS8TUGY+nxWYnB oV/wwCIyA8W8dIpK+N4mbFD0U6m1rrjCeaLuyH78im4GaZBKehMIDFc/hHerrJR7qUyJ UpyyuxkC4u4LAyP8P7oU8Cf9xlOASLGOauNr77K9h90ENU+EEjNQevU5Z8LNk6UbYRsH esGd0OonalJt0nRO/Y10ZfAQnXGN+33mH2v7N7CjRrwXhS9uR5qBVJuUx0iWTr0y/VX0 8rb3DlSgq5SGwkb7AclGI+VLTa6IRn4WzoEiYhRTbT1MYvb3PErkJzviLpZsYkgLXUu3 s2ww== X-Gm-Message-State: AFqh2kpyYB6H5DLjt/Dc1sWbeO1b4R2hK6gdyDBm0or9L15CJwgBucEZ DTlCyQeiv5Bp+XOWHQIZrk0= X-Received: by 2002:a05:600c:54d0:b0:3da:f9c9:cec9 with SMTP id iw16-20020a05600c54d000b003daf9c9cec9mr3282729wmb.1.1673963720425; Tue, 17 Jan 2023 05:55:20 -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.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 05:55:20 -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 0/6] clk: qcom: clk-rcg2: introduce support for multiple conf for same freq Date: Tue, 17 Jan 2023 14:54:53 +0100 Message-Id: <20230117135459.16868-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.38.1 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?1755278246700056577?= 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 keep the CEIL FLOOR logic while maitaining the possibility to provide multiple configuration. The first 2 patch drop redundant F entry redefinition. The 3rd and 4th one try to align rcg2 set rate to what clock core suggest by using just what determine_clock pass to clk core. The 5th one implement the change with also some macro description on how this new implementation works. On determine the old v2 logic is used but for set the requested parent is used instead of researching. The 6th one migrate the gcc-ipq8074 driver to this new implementation. 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 (6): clk: qcom: gcc-ipq6018: drop redundant F define clk: qcom: gcc-sdm660: drop redundant F define clk: qcom: common: add qcom_find_freq_exact clk: qcom: clk-rcg2: don't re-search config on rcg2_set_rate clk: qcom: clk-rcg2: introduce support for multiple conf for same freq clk: qcom: gcc-ipq8074: rework nss_port5/6 clock to multiple conf drivers/clk/qcom/clk-rcg.h | 14 +++- drivers/clk/qcom/clk-rcg2.c | 140 +++++++++++++++++++++++++++------ drivers/clk/qcom/common.c | 17 ++++ drivers/clk/qcom/common.h | 2 + drivers/clk/qcom/gcc-ipq6018.c | 2 - drivers/clk/qcom/gcc-ipq8074.c | 64 +++++++++++---- drivers/clk/qcom/gcc-sdm660.c | 2 - 7 files changed, 196 insertions(+), 45 deletions(-)