From patchwork Thu Apr 27 15:07:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 8740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp609923vqo; Thu, 27 Apr 2023 17:22:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5AkUFLLG8N9U690xWFhv4bp7YHpCEUwRfGXNJ5wQz/m70uNbtt6JFBlz51XesWpPTmdsvg X-Received: by 2002:a17:902:ecca:b0:19c:be57:9c82 with SMTP id a10-20020a170902ecca00b0019cbe579c82mr3842745plh.65.1682641363030; Thu, 27 Apr 2023 17:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682641363; cv=none; d=google.com; s=arc-20160816; b=zfUJzpy1hWOU1I81nIUAz7d5UekbCaouyRC3S2VWfiMe5es9S9az4+EEKjqjTJNLqS JhxVwu1/S/rqm/B1x2FC1eZ2Ott4vaEym35OFT77OlrqwziLN0Mkdam3FkLn67rr8bTj rbLI6TeyZ1kBXK7ggaOzlOBlc0x8HPtqq/XM8Nx6FtrUB0jPrJhNBhmucRydRJY0qkdA 17t9zI+SH/o4yCSt/6zHncjr97lV9nPmLd0EgzRm4R3rAfqpxvmo4q60G9Oz8RHPomX+ 8XGdVI5hf8B+26KdpvAWsLdDlimsSGEiMGjre4cC2CT3EAgnjHZWA4mKVwPIxMJCkOu3 NI4A== 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=ve7uIoGJf2kkE3oRGUKMXB38f7f45Vy05Bqy3ZgBaus=; b=jYYAzmqYT5Cq7nFsWTvGchtRWvLZ4sbBf/EUUFxiB7vh7IArDSnAcizXcHaGNK4j/M pVhTXsZXnRFDir8izboKqnUw2ubJvJ4M5NnjukGjYu/iLdoh8qd2B3YarIAAtYAIuTYA TCfdD7PPm7l1QXpUS9rnZ1gnVyLpaYUZ+DS4YMiRcYyVqvVOc5q8JykfTEyIeVemn/nk roMDU6oFTazhzsoqr4gYYONX6PeNt3uCzbMpswMMk7Z33UoqKd/7lnMnpRRWEZ7eNM1w RKuST7cQG0Wra77XShLZ30zkYR46zaasd9RQGz5joaHOxwQ+Vh09XVZbWlpxbYeWaEH+ HlwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=h9ulxNNY; 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 i12-20020a170902cf0c00b001a6a3954e0fsi16654148plg.18.2023.04.27.17.22.28; Thu, 27 Apr 2023 17:22:43 -0700 (PDT) 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=20221208 header.b=h9ulxNNY; 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 S1344401AbjD1AUC (ORCPT + 99 others); Thu, 27 Apr 2023 20:20:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjD1AUA (ORCPT ); Thu, 27 Apr 2023 20:20:00 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 897502D40; Thu, 27 Apr 2023 17:19:59 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-2f46348728eso5664047f8f.3; Thu, 27 Apr 2023 17:19:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682641198; x=1685233198; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ve7uIoGJf2kkE3oRGUKMXB38f7f45Vy05Bqy3ZgBaus=; b=h9ulxNNYhVzeT/m2EroqDmWk5YQGS9/8o7FJwIgRwI1b+YuCYDkpLgQlfdJvQIxNts 0BLwDEc9YeLxcDihKrRNCsRDBQRSXJO8Q6hZMMkKt1c1bBTFOL/ryL+NxU4b3D4ie7iE CShIknkSa3ckIlOWcf6nqMCaeZqHha5Zql7M4+67frCfADy/WDUEU9jKQqMBwJLiotfj 2w/SYcILiGlxFbw4IOLKiycdcUM/B4e6xx2UvdMgoL+SuEcHOYA6lnBCV+9Pe67/AOov iEtDq3WQp3dvxO2ThVIIapjKdR2WhfRDza1ONuac2UR8+KK19QhaJtCQrJOvhlN2qMf3 UUCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682641198; x=1685233198; 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=ve7uIoGJf2kkE3oRGUKMXB38f7f45Vy05Bqy3ZgBaus=; b=QCLmtBIK6rqCpnjBTneww3PnMK7eSRe3XjCf/ewrnNZ8loI5DTWoCY+bgrLi8DF/+F ZCL+eHzRPXv745ABEbDQ8w9YKpiv+KlJl1BMiTXkQxxCPl4Tplb+ZrnN6gMrePCiyI3J kBYxNa51iOvZnU+GbQ5PKSIKHLsrCAJ8pvVSD9CTP8o8aUUrs5X+LyHcGn8ArLkDAnJt EurK62VKxEU6tshQ499AwS9pIJ7c97RoAqmMd4/fCCvG9jchEIFMx7HdHJG8kllRNDyM 0VJQDqIq/hUx5bvM1xRR49wu6DhQPZy6Tw2HrrLUq1sO2TxErqIAo+L4Y1joMLYcc2E6 GY+Q== X-Gm-Message-State: AC+VfDw8XFPMX1FwkE05hbLPKtI7TxNHlLdX31Cq+lSg2xvVxazk7dIA Mlsa3RLFkTSzQZipZ6WGtxQ= X-Received: by 2002:a05:600c:b45:b0:3f1:987b:7a13 with SMTP id k5-20020a05600c0b4500b003f1987b7a13mr2464939wmr.4.1682641197399; Thu, 27 Apr 2023 17:19:57 -0700 (PDT) Received: from localhost.localdomain (93-34-93-173.ip49.fastwebnet.it. [93.34.93.173]) by smtp.googlemail.com with ESMTPSA id d3-20020a05600c3ac300b003f19b3d89e9sm16362095wms.33.2023.04.27.17.19.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 17:19:56 -0700 (PDT) From: Christian Marangi To: Andy Gross , 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 v4 0/3] clk: qcom: clk-rcg2: introduce support for multiple conf for same freq Date: Thu, 27 Apr 2023 17:07:14 +0200 Message-Id: <20230427150717.20860-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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?1764377349835602822?= X-GMAIL-MSGID: =?utf-8?q?1764377349835602822?= 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 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 | 152 +++++++++++++++++++++++++++++++++ drivers/clk/qcom/common.c | 18 ++++ drivers/clk/qcom/common.h | 2 + drivers/clk/qcom/gcc-ipq8074.c | 120 ++++++++++++++++---------- 5 files changed, 271 insertions(+), 45 deletions(-)