From patchwork Sun Jul 4 02:40:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 12357179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88AD9C07E9A for ; Sun, 4 Jul 2021 02:40:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5663961949 for ; Sun, 4 Jul 2021 02:40:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229811AbhGDCnZ (ORCPT ); Sat, 3 Jul 2021 22:43:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbhGDCnV (ORCPT ); Sat, 3 Jul 2021 22:43:21 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33793C061764 for ; Sat, 3 Jul 2021 19:40:47 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id j199so12820515pfd.7 for ; Sat, 03 Jul 2021 19:40:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LGTpZpcq32N1ry1LRLwc7jq58V/cDLzcGUvKzTqnKL0=; b=F83E1Q5H1nwJYdoExXJpnGKLhUHfJgiUg5f3KCJlnwZIHsFS8uG7I/BUOWqxbBHy7J nYJiJGRiVkVdtL4AuohjgJd7lg/F3Q8EstetwfzAK38CrFDd283EC15V9QFy+KwdU7tJ ThBQJlB1JEXY4gOygZw8BM/CEcbG/XwI3NVjG4rAnhthYRjUivKMWQY4U/WP0ErJ3VKb T5JN1AhNaByyK99PN3u0vowEkrEp0wCtCIWvzPVeZNIaeJAQcIGUTH3BVcLodQjTQzoS kwsGuO0qx9lEGiIqn2h50mYapkQpBthPZ4JhhLKySWs0R0RZ4oMVIoCbE8NIBb4yVJhY EJpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LGTpZpcq32N1ry1LRLwc7jq58V/cDLzcGUvKzTqnKL0=; b=edXzwDOzWNxXYt1eTfCq2j6HYx9poKceXTBB1yvG/RzdNuN0ti/vs2m8TaZa7UwIUP QhVBvJi5LbRnJ/sUvlV1NqD+0t0cxUi5jKKN6YBHvmmoum3cOSx29dDpDCQsyIpF5QeE 4pw60y622p7OQqRK6QZislUHpwUioUIvysR10HZgsOalnEkho8Zy/ZVZYZSLQad+VUbV tUeheA/lOIL6GYkagQ4x/d/vmBgkHewJg7eIXAuVzt4NLJ+dfcSpPR/yrZZyx+IfsR3t yY0dclX0yK3lLZ6/NfSBSdKsxkamZD7h1sEcCytimfHItpDEPNe8JKqdOpXTkWn3nY4W NyTA== X-Gm-Message-State: AOAM530CRpaMEhsZO/Bl7TIGkWz3/CnvHI9iR/r/Eb4ZQ/XI5tritN2Z UMBFFWeZkt+INg4IbJoUcBtzYuc+BjJL7EuW X-Google-Smtp-Source: ABdhPJzrv83//wTI/fTzoXpjitQYAV5M1F6hUvVBdBmSdECuMk27Pfe5cxAOWTBn0493YNNbjiRNNw== X-Received: by 2002:a63:6cc:: with SMTP id 195mr8146533pgg.281.1625366446801; Sat, 03 Jul 2021 19:40:46 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id g17sm9394624pgh.61.2021.07.03.19.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Jul 2021 19:40:46 -0700 (PDT) From: Shawn Guo To: Stephen Boyd Cc: Bjorn Andersson , Rob Herring , Sivaprakash Murugesan , Benjamin Li , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, Shawn Guo Subject: [PATCH v2 1/4] clk: qcom: apcs-msm8916: Flag a53mux instead of a53pll as critical Date: Sun, 4 Jul 2021 10:40:29 +0800 Message-Id: <20210704024032.11559-2-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210704024032.11559-1-shawn.guo@linaro.org> References: <20210704024032.11559-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org The clock source for MSM8916 cpu cores is like below. |\ a53pll --------| \ a53mux +------+ | |------------| cpus | gpll0_vote --------| / +------+ |/ So a53mux rather than a53pll is actually the parent clock of cpu cores. It makes more sense to flag a53mux as critical instead, so that when either a53pll or gpll0_vote is used by cpu cores, the clock will be kept enabled while the other can be disabled. Signed-off-by: Shawn Guo --- drivers/clk/qcom/a53-pll.c | 1 - drivers/clk/qcom/apcs-msm8916.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/clk/qcom/a53-pll.c b/drivers/clk/qcom/a53-pll.c index af6ac17c7dae..d6756bd777ce 100644 --- a/drivers/clk/qcom/a53-pll.c +++ b/drivers/clk/qcom/a53-pll.c @@ -70,7 +70,6 @@ static int qcom_a53pll_probe(struct platform_device *pdev) init.parent_names = (const char *[]){ "xo" }; init.num_parents = 1; init.ops = &clk_pll_sr2_ops; - init.flags = CLK_IS_CRITICAL; pll->clkr.hw.init = &init; ret = devm_clk_register_regmap(dev, &pll->clkr); diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index cf69a97d0439..d7ac6d6b15b6 100644 --- a/drivers/clk/qcom/apcs-msm8916.c +++ b/drivers/clk/qcom/apcs-msm8916.c @@ -65,7 +65,7 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) init.parent_data = pdata; init.num_parents = ARRAY_SIZE(pdata); init.ops = &clk_regmap_mux_div_ops; - init.flags = CLK_SET_RATE_PARENT; + init.flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT; a53cc->clkr.hw.init = &init; a53cc->clkr.regmap = regmap; From patchwork Sun Jul 4 02:40:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 12357183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2434DC07E9B for ; Sun, 4 Jul 2021 02:40:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E8FF861936 for ; Sun, 4 Jul 2021 02:40:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbhGDCnZ (ORCPT ); Sat, 3 Jul 2021 22:43:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229787AbhGDCnY (ORCPT ); Sat, 3 Jul 2021 22:43:24 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0146DC061764 for ; Sat, 3 Jul 2021 19:40:50 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id a2so14585020pgi.6 for ; Sat, 03 Jul 2021 19:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SJ6mWKBojJfVdE79tK2x9bM0KQ+BiVthSv3BXWqHjkA=; b=aCFrfva8wFoCWLRwo8eKYLEdNKeqnJuogWU0ePmKz+CrEJIoYiNVa1G1lfCAj2bH6r fDWc2EWpHYaAbvjaRBdcjXDdlJ0Zy8vW12pP86Mtyj58l8GuNZxzj4lrCTTMug3ml7XB 26h9lYHdQMuqyqrz4uX5Xxs6YTLRgGgH3c4QXuwePFVS4gGTib7w3ngck8BfOHaC39if mrAWQVjW3LUAFa8cFStyfKYBZhwwD35muKPPZuoQKonbjai3pEm/w52tYGya0lKNxdmw 22ORKfmPqqiLsGvUnIyWayhLvYN0lxviZxTMQO3+J1w6j/aQn3+lAfzOxx9DoqqA6ZAy tyYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SJ6mWKBojJfVdE79tK2x9bM0KQ+BiVthSv3BXWqHjkA=; b=a7E1A3OcgxnsS7X5ces//iMj1V/N53nRazxtxBNB+2py0QYMS9EeR4oECKgt/4PsTy qTgXFVdZFqSDZHqxLxduDjX+yb9IpehRH0xJW4lEXU19VPx8cDUm+g5D6kSVfk2qJ8dC XWqrsYwpdVor9F0T3CmY804hZakd1hkUfkeENqAzkp9MjPiWqvyiZWMmSoqr97It5WlA xIyxPaKwb9cSxy+Of+vO4DmGW4pqh62hdHkjyaiJbXEGzZlgc83T2Ib5HkrC5LvSfcKN +VL9q9cyIhdLiqGqTpyHbuOUwABUJc7ad8Bc8Z9fOiE81e30KUxI0GvKMhR3BafZpzm9 44sA== X-Gm-Message-State: AOAM531i+SL59y31AN0IZbnGuV2gNYvG5FlQv6oP/p1xDz58NVVzts2r gG/KcQYnCrLcZiU8VgfmhSCVQQ== X-Google-Smtp-Source: ABdhPJwVZjknSowvP1KPgjYS6i71VgkhYhJCfSnpQN6uLbbERr6blxgt9xjDrYhh+GgXgBRj29RYvw== X-Received: by 2002:a05:6a00:1508:b029:30a:2b2:b2ea with SMTP id q8-20020a056a001508b029030a02b2b2eamr7762189pfu.30.1625366449541; Sat, 03 Jul 2021 19:40:49 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id g17sm9394624pgh.61.2021.07.03.19.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Jul 2021 19:40:49 -0700 (PDT) From: Shawn Guo To: Stephen Boyd Cc: Bjorn Andersson , Rob Herring , Sivaprakash Murugesan , Benjamin Li , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, Shawn Guo Subject: [PATCH v2 2/4] clk: qcom: a53pll/mux: Use unique clock name Date: Sun, 4 Jul 2021 10:40:30 +0800 Message-Id: <20210704024032.11559-3-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210704024032.11559-1-shawn.guo@linaro.org> References: <20210704024032.11559-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Different from MSM8916 which has only one a53pll/mux clock, MSM8939 gets three for Cluster0 (little cores), Cluster1 (big cores) and CCI (Cache Coherent Interconnect). That said, a53pll/mux clock needs to be named uniquely. Append @unit-address of device node to the clock name, so that a53pll/mux will be named like below on MSM8939. a53pll@b016000 a53pll@b116000 a53pll@b1d0000 a53mux@b1d1000 a53mux@b011000 a53mux@b111000 Signed-off-by: Shawn Guo --- drivers/clk/qcom/a53-pll.c | 8 +++++++- drivers/clk/qcom/apcs-msm8916.c | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/a53-pll.c b/drivers/clk/qcom/a53-pll.c index d6756bd777ce..96a118be912d 100644 --- a/drivers/clk/qcom/a53-pll.c +++ b/drivers/clk/qcom/a53-pll.c @@ -37,6 +37,7 @@ static const struct regmap_config a53pll_regmap_config = { static int qcom_a53pll_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; struct regmap *regmap; struct resource *res; struct clk_pll *pll; @@ -66,7 +67,12 @@ static int qcom_a53pll_probe(struct platform_device *pdev) pll->status_bit = 16; pll->freq_tbl = a53pll_freq; - init.name = "a53pll"; + /* Use an unique name by appending @unit-address */ + init.name = devm_kasprintf(dev, GFP_KERNEL, "a53pll%s", + strchrnul(np->full_name, '@')); + if (!init.name) + return -ENOMEM; + init.parent_names = (const char *[]){ "xo" }; init.num_parents = 1; init.ops = &clk_pll_sr2_ops; diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index d7ac6d6b15b6..89e0730810ac 100644 --- a/drivers/clk/qcom/apcs-msm8916.c +++ b/drivers/clk/qcom/apcs-msm8916.c @@ -46,6 +46,7 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device *parent = dev->parent; + struct device_node *np = parent->of_node; struct clk_regmap_mux_div *a53cc; struct regmap *regmap; struct clk_init_data init = { }; @@ -61,7 +62,12 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) if (!a53cc) return -ENOMEM; - init.name = "a53mux"; + /* Use an unique name by appending parent's @unit-address */ + init.name = devm_kasprintf(dev, GFP_KERNEL, "a53mux%s", + strchrnul(np->full_name, '@')); + if (!init.name) + return -ENOMEM; + init.parent_data = pdata; init.num_parents = ARRAY_SIZE(pdata); init.ops = &clk_regmap_mux_div_ops; From patchwork Sun Jul 4 02:40:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 12357181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63FAFC07E9C for ; Sun, 4 Jul 2021 02:40:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 456CC61936 for ; Sun, 4 Jul 2021 02:40:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229865AbhGDCn2 (ORCPT ); Sat, 3 Jul 2021 22:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229813AbhGDCn1 (ORCPT ); Sat, 3 Jul 2021 22:43:27 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D030C061762 for ; Sat, 3 Jul 2021 19:40:52 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id l19so2950496plg.6 for ; Sat, 03 Jul 2021 19:40:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=EI7/NQoCGJxDIiM6o8K9wW0libMiYZLN48mcVrvQP9c=; b=X3nGaSDHgPmczKq5oEf7op2ydIhYldAo35HwAUI/MHekRdVfThucwc67fxv9BMFhUi 7qaCVnNfm/u5E1vtXzfWOfqdBHiwVFsFnTu2elrbNtGBRV4ntZNTIwzhIXajCLGnJY2e g0p9rC//YResjvM4ss5kZ/KVTxoL2buKLSbkZRBRlvlksdMqkHfSmZ5bv51Y7ZfQUDsA YxQzocmWagqvmBMjGgekBl5xdC5kInr7H3HUsdfEhiKlDbu93wOLjpw21569S0ziiyWh 3N82oLOnOlj9Sh7sEPjZWV08DculUwIIZfycTjMkWg8mo/1WetzuaIo80kGOBudeWuKE O2JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EI7/NQoCGJxDIiM6o8K9wW0libMiYZLN48mcVrvQP9c=; b=q+nekrADwwfGnA/TM3a2iErJK/XBXAU/VQGklvOtLxUgi12OkrEnlrJwQtXt0W9Trj GVSxrOgfAdNh7rbvooT2g091u1LOtWcQr3/FZa1erTFoA+e/pxGZ18GWe5EWk1naSHtx 1BnP/3J0EJT/6+DGlWmJ5Ck5D0ZGCAfga69iJzDDjw7ZVtKDsMbU+5hoN+3TW6TcCto2 /fDzJwzVUjVdthPL9iHgesiSu60eVJSdPm4j5Nz/LgEO9DC76/yV3qfbYe8EKJbXTGJq KgXjUBuGaB4mavdfPFvwyAsvZQ3gSWMY0Bipf3xkxL+9giMMUKVAjJNCqRCGL7FCl9jW eAHA== X-Gm-Message-State: AOAM532ByWbG6wx91qf9GRL7c/xd715DoN96PPRHLNvX1WfDV6I1lVeQ VjHLJY/DGkmMNAY93g5ioQgs2w== X-Google-Smtp-Source: ABdhPJymYbYf/FLkuFUtRlRViJAIGuXK8u5r24KVu5G7Iz3L26V+uQI+8W8V91Nkpmh7reenNsnfvQ== X-Received: by 2002:a17:90a:eb11:: with SMTP id j17mr7726052pjz.177.1625366452234; Sat, 03 Jul 2021 19:40:52 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id g17sm9394624pgh.61.2021.07.03.19.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Jul 2021 19:40:51 -0700 (PDT) From: Shawn Guo To: Stephen Boyd Cc: Bjorn Andersson , Rob Herring , Sivaprakash Murugesan , Benjamin Li , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, Shawn Guo Subject: [PATCH v2 3/4] dt-bindings: clock: Update qcom,a53pll bindings for MSM8939 support Date: Sun, 4 Jul 2021 10:40:31 +0800 Message-Id: <20210704024032.11559-4-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210704024032.11559-1-shawn.guo@linaro.org> References: <20210704024032.11559-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Update qcom,a53pll bindings for MSM8939 support: - Add optional operating-points-v2 property - Add MSM8939 specific compatible Signed-off-by: Shawn Guo Acked-by: Rob Herring --- Documentation/devicetree/bindings/clock/qcom,a53pll.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/qcom,a53pll.yaml b/Documentation/devicetree/bindings/clock/qcom,a53pll.yaml index db3d0ea6bc7a..fbd758470b88 100644 --- a/Documentation/devicetree/bindings/clock/qcom,a53pll.yaml +++ b/Documentation/devicetree/bindings/clock/qcom,a53pll.yaml @@ -18,6 +18,7 @@ properties: enum: - qcom,ipq6018-a53pll - qcom,msm8916-a53pll + - qcom,msm8939-a53pll reg: maxItems: 1 @@ -33,6 +34,8 @@ properties: items: - const: xo + operating-points-v2: true + required: - compatible - reg From patchwork Sun Jul 4 02:40:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 12357185 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C199CC07E9E for ; Sun, 4 Jul 2021 02:40:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A610761936 for ; Sun, 4 Jul 2021 02:40:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229787AbhGDCna (ORCPT ); Sat, 3 Jul 2021 22:43:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbhGDCna (ORCPT ); Sat, 3 Jul 2021 22:43:30 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A31ECC0613DC for ; Sat, 3 Jul 2021 19:40:55 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id x16so13237818pfa.13 for ; Sat, 03 Jul 2021 19:40:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=d8JSTZ8+AJaTgMTmOHganaZdhQwLLSMBu10AnlPFiu8=; b=PnY/ZDSCQHF9HQBdG9c1eAxBf+DvgnK/Fp3L2oNhBpUlIXGXseKmWkKH0t83FxzfVe 6ySklp1/zytHkgSkwaFl+PtOvzK/zeYaE8DzjHDdUO/KrLZ9it8CaaTNZO2zlfWNZWy+ FMHC6JMpOOTIJ937i3DJBh/BHNj53v3u5zIoZE5FUNJXVLB9EWjrDMB/xX1djQqgfRtu c5gRdUHkyGOl4wRVekD2GYVZtFN96P8u0tIIDKs9Q8AuHAYaJSEOq25vKcrh9L4XN5I+ lebw/BuVFLpsGTt6mdDce1WSNKnJ181mNdFOB92XdxjLet+OptG0oPA8K9c5pKZldc4h W62A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d8JSTZ8+AJaTgMTmOHganaZdhQwLLSMBu10AnlPFiu8=; b=A2qFTEjSk3Ze3GB60NTgdx/VGU3A7W+V1br/IUN1ch6WvNboLVDFyBtVZzTXdAuZib rcZOfuhOXuK0q0QhA7POJ1anPOG+Lo/yrl+X3MkUJ5W1hQ6JRv+mLqBjzGPzyu6UIqI0 Ph42evd8KKBvJ+C5RBlEBe0dctico7Ad2hm35BeyKpaFz9xoFC7yHaIU2VLOAgSzwDZk pAzllc0P2aw6g0yJYnAuGavCX8wyMD8ZaFCkK7xlayQvlMIxhYdzM59aZmFiQ7oDkKRA nRvX0dqqvq4JX0F5Y+u/TVoeNS81N8upuYfWoI6ukCMd/j/iNGzDJbZmOup3jQYR68R1 wZvA== X-Gm-Message-State: AOAM533+H7QYGSs77JH1BHiwDpbl/5s03N6diQBp3N0SmStg3yQfz38u YEGCkOqzeG2qQEeADUkO8mC4mA== X-Google-Smtp-Source: ABdhPJw30azYjSjAVyKtrYg9dwjnrZwUuxSrQwuNQdK1ZESMOLH4te0aJZ/9Jy4bxaJUh4+WFSHMUw== X-Received: by 2002:a63:de45:: with SMTP id y5mr1273481pgi.261.1625366454995; Sat, 03 Jul 2021 19:40:54 -0700 (PDT) Received: from localhost.localdomain (80.251.214.228.16clouds.com. [80.251.214.228]) by smtp.gmail.com with ESMTPSA id g17sm9394624pgh.61.2021.07.03.19.40.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Jul 2021 19:40:54 -0700 (PDT) From: Shawn Guo To: Stephen Boyd Cc: Bjorn Andersson , Rob Herring , Sivaprakash Murugesan , Benjamin Li , devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, Shawn Guo Subject: [PATCH v2 4/4] clk: qcom: a53-pll: Add MSM8939 a53pll support Date: Sun, 4 Jul 2021 10:40:32 +0800 Message-Id: <20210704024032.11559-5-shawn.guo@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210704024032.11559-1-shawn.guo@linaro.org> References: <20210704024032.11559-1-shawn.guo@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org MSM8939 has 3 a53pll clocks with different frequency table for Cluster0, Cluster1 and CCI. It adds function qcom_a53pll_get_freq_tbl() to create pll_freq_tbl from OPP, so that those a53pll frequencies can be defined in DT with operating-points-v2 bindings rather than being coded in the driver. In this case, one compatible rather than three would be needed for these 3 a53pll clocks. Signed-off-by: Shawn Guo --- drivers/clk/qcom/a53-pll.c | 59 +++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/a53-pll.c b/drivers/clk/qcom/a53-pll.c index 96a118be912d..9e6decb9c26f 100644 --- a/drivers/clk/qcom/a53-pll.c +++ b/drivers/clk/qcom/a53-pll.c @@ -6,9 +6,11 @@ * Author: Georgi Djakov */ +#include #include #include #include +#include #include #include @@ -34,6 +36,55 @@ static const struct regmap_config a53pll_regmap_config = { .fast_io = true, }; +static struct pll_freq_tbl *qcom_a53pll_get_freq_tbl(struct device *dev) +{ + struct pll_freq_tbl *freq_tbl; + unsigned long xo_freq; + unsigned long freq; + struct clk *xo_clk; + int count; + int ret; + int i; + + xo_clk = devm_clk_get(dev, "xo"); + if (IS_ERR(xo_clk)) + return NULL; + + xo_freq = clk_get_rate(xo_clk); + + ret = devm_pm_opp_of_add_table(dev); + if (ret) + return NULL; + + count = dev_pm_opp_get_opp_count(dev); + if (count <= 0) + return NULL; + + freq_tbl = devm_kcalloc(dev, count + 1, sizeof(*freq_tbl), GFP_KERNEL); + if (!freq_tbl) + return NULL; + + for (i = 0, freq = 0; i < count; i++, freq++) { + struct dev_pm_opp *opp; + + opp = dev_pm_opp_find_freq_ceil(dev, &freq); + if (IS_ERR(opp)) + return NULL; + + /* Skip the freq that is not divisible */ + if (freq % xo_freq) + continue; + + freq_tbl[i].freq = freq; + freq_tbl[i].l = freq / xo_freq; + freq_tbl[i].n = 1; + + dev_pm_opp_put(opp); + } + + return freq_tbl; +} + static int qcom_a53pll_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -65,7 +116,12 @@ static int qcom_a53pll_probe(struct platform_device *pdev) pll->mode_reg = 0x00; pll->status_reg = 0x1c; pll->status_bit = 16; - pll->freq_tbl = a53pll_freq; + + pll->freq_tbl = qcom_a53pll_get_freq_tbl(dev); + if (!pll->freq_tbl) { + /* Fall on a53pll_freq if no freq_tbl is found from OPP */ + pll->freq_tbl = a53pll_freq; + } /* Use an unique name by appending @unit-address */ init.name = devm_kasprintf(dev, GFP_KERNEL, "a53pll%s", @@ -96,6 +152,7 @@ static int qcom_a53pll_probe(struct platform_device *pdev) static const struct of_device_id qcom_a53pll_match_table[] = { { .compatible = "qcom,msm8916-a53pll" }, + { .compatible = "qcom,msm8939-a53pll" }, { } }; MODULE_DEVICE_TABLE(of, qcom_a53pll_match_table);