Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1978626lqz; Tue, 2 Apr 2024 03:48:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW8YptDB9dGW4iMZaGJOBnFV189mvg05XL01R7TUF+Ipq4jCRoxHbd9vfFYcWna19yochOIZ/MP6cgsEyyuSbI97r4f5oSkqzjGyqypoQ== X-Google-Smtp-Source: AGHT+IF7CZZ+XZbZ9AcQsXBT48v19TVTHkC+D5WH8EJ0p78WfenxWUkWzmnHvsmysI7VEPTMJ02Q X-Received: by 2002:a17:906:33cb:b0:a48:7cbd:8b24 with SMTP id w11-20020a17090633cb00b00a487cbd8b24mr8736906eja.17.1712054928254; Tue, 02 Apr 2024 03:48:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712054928; cv=pass; d=google.com; s=arc-20160816; b=Nc67bq/UnMhV/6yYmwRcXZqpP71GMvN52DBnMSi3KR0yb9DQCsvhSBWbChXeTmuFbB ZSxRcLxxcJ636HHedht6FiLsRJXquI7s2RK9bs9T9iQRaXAopbAkqAJLz4VnBXfy6+lp nd2j5AxiBwAiB5prdLVR9BIlTUMbGrAeQnQmWhDL8vbr4YwpBtxx1ItLdfGtwr3t6nDN uFdV0dUHdSVqZyAOkJt7YXqkg+/RZ9FrFXYJjJhIXquLsQFZZp7a9j8XZjSfQ48W/Yit srYqPkvrqcu2z+ymaPBmpo83BLVyQGIMhAoQkYqkY7+zktGSaWADqLnnU7d06V4K0nlj jj+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=mrrS39kMM3qSYmTTIfDrvL7v8BkqXr1H3y+hhGF7rb8=; fh=yqKUVRJCC8Bj01N19xLd1lekUAI+CtRlTuAYMKoqEp0=; b=w0TJNVtFYMrZZRuqqHvare1x4p6IsSQ/i6BvMLVEtfOI9Ca7nl7dhRznLCpJedBqcO n7G3rO7uodu2PXeConbSf5VF98VfYMBKndH//QeFln61J6imV1PhfsY4vbtKUrJsiXFh vmM86H1wqaWh/vXVfMBylSLkNRIryTNRCWMqHsZMpTSwb2d4a83CUVUsmZXMKVptPmwa BcNvqseTT/F4b8qYnBQrhEAe6LE25g/xIb0UAeQ+a93TeFDQwfqO6uJZkFY1fn+yIOoV JRgekuMyl0LhlXxXKkmVEFw/qDMoYbcjkOT4yOftzeZHormiaG3dgowl0osWIRLgQe1t uTwA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UkVHyRKI; 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-127770-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127770-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p14-20020a170906228e00b00a4a3d0e7464si5599261eja.357.2024.04.02.03.48.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 03:48:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127770-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UkVHyRKI; 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-127770-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127770-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 am.mirrors.kernel.org (Postfix) with ESMTPS id C82831F24B8D for ; Tue, 2 Apr 2024 10:48:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A6D060B9C; Tue, 2 Apr 2024 10:48:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UkVHyRKI" Received: from mail-yb1-f174.google.com (mail-yb1-f174.google.com [209.85.219.174]) (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 62C17604CE for ; Tue, 2 Apr 2024 10:48:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712054908; cv=none; b=dBSQAhaB1fR8eDRzU18CqxXnVdZH7+sRyBiBG40jhiuOE4cGc9s8yVzMdnW2SMof6HYfhEqPU6+OAkOtYdLMm7EAbpG8tjQwST23nW9hllWGzt0iF0VpxwHFkbk022nofc1M/0Hmg5n4u6SSHkueAkUqN6JrsbJQwwrp/JdVVhE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712054908; c=relaxed/simple; bh=3EyCUbtnMkP+cwjwavYDGusXVngaEoTsr1iaAdtpXeA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=q30tMdwCteMEJbVjoxHXlxtCpalH0UkaPQtqOa0ePtdIKEwrcZ+Y/PkZAaAi3xwRFvUEhv2hp7zmzzbESqAYirqYdiGN+gNe1+LDfpJk/QHPw9sjIAg8F9hu2W6rAdPEK2BGSswx1Wi4LiqZjHpSZt4nj2ew1savrfmgQ7TbnEw= 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=UkVHyRKI; arc=none smtp.client-ip=209.85.219.174 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-yb1-f174.google.com with SMTP id 3f1490d57ef6-dc74e33fe1bso4572599276.0 for ; Tue, 02 Apr 2024 03:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712054905; x=1712659705; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mrrS39kMM3qSYmTTIfDrvL7v8BkqXr1H3y+hhGF7rb8=; b=UkVHyRKITqATKyKjfs/CiavGPEGleKdak8ohMaHk8LcaQEZm0bB8GoFjSkDpzNw59H bkwbp7u6lRoWskZq6B8SP3HRKuG6CX8pNjMF+Cbrp7rUCXaasn5WLzMGGQmnKiW7kshI lRLfnblVRm4pQ4PCg19qVY1KY0asC+oEZSr5Oe5QIjZ7zcEvFwenhsIMToXcHBhhrfch 13aDuu5F/bIL2ppfSqIv3YwRe4rWn8CnrYw3yIQUVeQgzhteAkeJDXKMt256h/RV0Z0W SlpSNbCLR4qk7rEn0jsewuPEeIpj8Gi9bPIBiVrlkPIr+cBY5W8PyLkM8h0VXvD/ax+z x3/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712054905; x=1712659705; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mrrS39kMM3qSYmTTIfDrvL7v8BkqXr1H3y+hhGF7rb8=; b=wlV/VVQq6clEvFRRBcdNQrzXDgE14SIyvMTaw3G0zAStiYC0Z3J5Rw/Ih836P/M5fO CRWhHhYxcFwg/ED6Bkpa8N4iqliq6dwW0+9qYe/aVd6/4uqNlPKIdMKcbEbDomA1RStn f/ZNWbsY86/TW4JDMeMG/c5WL7V5Hq/t9k7AUKJAKX1ciwanwCIZYaENGsr7WPTizx87 ozMgOaY3th2v09O0+BMFtbpdCdhZZ/S1NUiJxEaKweJtKkHJ8aaqhTY78k4ssK/xJ3XD 7XhUFLzGU3JLTohMflJ9uc6S0o6SpiNNQdhfUsZtUwsqPgw2D5YqzGxttC7YNDQLc/Wo 20bQ== X-Forwarded-Encrypted: i=1; AJvYcCXRtaz5p8ht9wUBCnTQyCJuK8sBRmQsGsJbBbequWbb7ZK+T/5Re9zj5qjm1K9PjwbBlxY/K6KjSfAFqpHvs292hQyEn/b2fDS/XF+x X-Gm-Message-State: AOJu0Ywhu5B5JGIRSWYj+sZZd2ZKGaQTEDDKizUEGM0JWWBiIHHZKbfz xIyCnLCznngXgKWWzAaIsBj1e9GHrtFUYZClNTNmulBkAvUiA+Ad+v7ENWBPOUL5IkDCaIAEI3I RXDa6X/ew0tgVxeaHMi+QYu+IntftDyEbGv6hTA== X-Received: by 2002:a25:4903:0:b0:dcd:a9ad:7d67 with SMTP id w3-20020a254903000000b00dcda9ad7d67mr10780266yba.8.1712054905465; Tue, 02 Apr 2024 03:48:25 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240402103406.3638821-1-quic_varada@quicinc.com> <20240402103406.3638821-5-quic_varada@quicinc.com> In-Reply-To: <20240402103406.3638821-5-quic_varada@quicinc.com> From: Dmitry Baryshkov Date: Tue, 2 Apr 2024 13:48:14 +0300 Message-ID: Subject: Re: [PATCH v6 4/6] clk: qcom: common: Add interconnect clocks support To: Varadarajan Narayanan Cc: andersson@kernel.org, konrad.dybcio@linaro.org, mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, djakov@kernel.org, quic_anusha@quicinc.com, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Tue, 2 Apr 2024 at 13:34, Varadarajan Narayanan wrote: > > Unlike MSM platforms that manage NoC related clocks and scaling > from RPM, IPQ SoCs dont involve RPM in managing NoC related > clocks and there is no NoC scaling. > > However, there is a requirement to enable some NoC interface > clocks for accessing the peripheral controllers present on > these NoCs. Though exposing these as normal clocks would work, > having a minimalistic interconnect driver to handle these clocks > would make it consistent with other Qualcomm platforms resulting > in common code paths. This is similar to msm8996-cbf's usage of > icc-clk framework. > > Signed-off-by: Varadarajan Narayanan > --- > v6: first_id -> icc_first_node_id > Remove clock get so that the peripheral that uses the clock > can do the clock get > v5: Split changes in common.c to separate patch > Fix error handling > Use devm_icc_clk_register instead of icc_clk_register > v4: Use clk_hw instead of indices > Do icc register in qcom_cc_probe() call stream > Add icc clock info to qcom_cc_desc structure > v3: Use indexed identifiers here to avoid confusion > Fix error messages and move to common.c > v2: Move DTS to separate patch > Update commit log > Auto select CONFIG_INTERCONNECT & CONFIG_INTERCONNECT_CLK to fix build error > --- > drivers/clk/qcom/common.c | 38 +++++++++++++++++++++++++++++++++++++- > drivers/clk/qcom/common.h | 3 +++ > 2 files changed, 40 insertions(+), 1 deletion(-) > > diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c > index 75f09e6e057e..d5c008048994 100644 > --- a/drivers/clk/qcom/common.c > +++ b/drivers/clk/qcom/common.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -234,6 +235,41 @@ static struct clk_hw *qcom_cc_clk_hw_get(struct of_phandle_args *clkspec, > return cc->rclks[idx] ? &cc->rclks[idx]->hw : NULL; > } > > +static int qcom_cc_icc_register(struct device *dev, > + const struct qcom_cc_desc *desc) > +{ > + struct icc_clk_data *icd; > + int i; > + > + if (!IS_ENABLED(CONFIG_INTERCONNECT_CLK)) > + return 0; > + > + if (!desc->icc_hws) > + return 0; > + > + icd = devm_kcalloc(dev, desc->num_icc_hws, sizeof(*icd), GFP_KERNEL); > + if (!icd) > + return -ENOMEM; > + > + for (i = 0; i < desc->num_icc_hws; i++) { > + /* > + * get_clk will be done by the peripheral device using this > + * clock with devm_clk_hw_get_clk() so that we can associate > + * the clk handle with the consumer device. It would also help > + * us make it so that drivers defer probe until their > + * clk isn't an orphan. How the clock instance returned to the peripheral driver is supposed to correspond to the clock instance used by the icc-clk? > + */ > + icd[i].clk = desc->icc_hws[i]->clk; You again are abusing clk_hw->clk. Please don't do that. > + if (!icd[i].clk) > + return dev_err_probe(dev, -ENOENT, > + "(%d) clock entry is null\n", i); > + icd[i].name = clk_hw_get_name(desc->icc_hws[i]); > + } > + > + return PTR_ERR_OR_ZERO(devm_icc_clk_register(dev, desc->icc_first_node_id, > + desc->num_icc_hws, icd)); > +} > + > int qcom_cc_really_probe(struct platform_device *pdev, > const struct qcom_cc_desc *desc, struct regmap *regmap) > { > @@ -303,7 +339,7 @@ int qcom_cc_really_probe(struct platform_device *pdev, > if (ret) > return ret; > > - return 0; > + return qcom_cc_icc_register(dev, desc); > } > EXPORT_SYMBOL_GPL(qcom_cc_really_probe); > > diff --git a/drivers/clk/qcom/common.h b/drivers/clk/qcom/common.h > index 9c8f7b798d9f..9058ffd46260 100644 > --- a/drivers/clk/qcom/common.h > +++ b/drivers/clk/qcom/common.h > @@ -29,6 +29,9 @@ struct qcom_cc_desc { > size_t num_gdscs; > struct clk_hw **clk_hws; > size_t num_clk_hws; > + struct clk_hw **icc_hws; > + size_t num_icc_hws; > + unsigned int icc_first_node_id; > }; > > /** > -- > 2.34.1 > -- With best wishes Dmitry