Received: by 10.213.65.68 with SMTP id h4csp3458629imn; Tue, 3 Apr 2018 05:26:36 -0700 (PDT) X-Google-Smtp-Source: AIpwx49tIS85veqecPS4AL6KoGaWohWNjb0bzOQu4nfwv+DtAXzQR0g178L/JDWaDUS9qGRXagY4 X-Received: by 2002:a17:902:d03:: with SMTP id 3-v6mr14024052plu.245.1522758396603; Tue, 03 Apr 2018 05:26:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522758396; cv=none; d=google.com; s=arc-20160816; b=AAlYcWQVi8XGz2hbbAx46gS8Ceb1NRoj3nNjo+FrWxSfFdkIMHn34uQJV/dq45X0WU wjGmkX7CaMw0NUtILYLUS5cahhGy0ZeWC0FSkGxhvrrk4nXMmUioI55pXVT5YPaVIO4H 3mWPlAbc3Lqg8U3eKkbGlUxD2Ngl0lYdMWbjVShz/ZsyBYnoPc1ifHuqJ3u7tg5wwMHy +nZSYoilSOOMr7MQAVZHaHXuMEFIS6qC6BEu80LsC4TsfQ8h2rPnHsk1HERXCEJkZEs4 Vb/IEsm02TU0jXPobKHUeeZ7pSTfoagiavlJ1Rj1SHkUxI9IOrYgJMZTui8Ob33Aw682 LuaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=wNiV+ocaYCt4PQwFZcDtrgRfdY0Avev8OSHzetzYZUg=; b=XTSA9r8QrAjDjGJjHnNNUvbwiqft4Ngbl0Zg3dumzqnFG4wIVHp/IArDWc9PRW3IZd 6Zcli8aPvGey0oy7DcvNwf/jqSXmrh2dNCUNXpbGm2+bC+hmR9qim9aiyJJfm6atVlUR emvDUA5BUKF0ABYTsmTK0+vKKn+SatQYWC4ERj91yhAZd32zZyr5xdO7uxhvjiv0OTtt lty0Yyw5CgIR+zCOv4UOdDgGNlIr0GcwCEL2FMhQmOk2slq1gcpOygdN4tAWmfdRud9n OaETnp7cswWB9uSlZMYZeOfle4XFXKMpA1O2JzwWtwgIOaNxf0uKBZyRcor3HxnIJDWH 93Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=GEOYqqX3; dkim=pass header.i=@codeaurora.org header.s=default header.b=BUyGggAA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a86si2050652pfc.207.2018.04.03.05.26.22; Tue, 03 Apr 2018 05:26:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=GEOYqqX3; dkim=pass header.i=@codeaurora.org header.s=default header.b=BUyGggAA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932101AbeDCMYp (ORCPT + 99 others); Tue, 3 Apr 2018 08:24:45 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:46788 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755300AbeDCMYn (ORCPT ); Tue, 3 Apr 2018 08:24:43 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 6C06160F8F; Tue, 3 Apr 2018 12:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522758282; bh=PFG7tyy2DdfU6+laVWMwm5l7fQVM9ho3j/oKD8uNulA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GEOYqqX3UxRNgn+RHoRTdIcLidm4q+636lUzhouEbZB5k6YPKpCTCp3h1Fm+yyF+u 1xsUPkQfBB+D9CocbTxNb5G3PDYlLSZCU/vm1Z6yMkfCGOA4CfosbmvLzsYcDOCZkS dPST+ZGTN+uumrGU0/v1dT7mlCXUfNzbE7Es1Rqo= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 6297060FA8; Tue, 3 Apr 2018 12:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1522758281; bh=PFG7tyy2DdfU6+laVWMwm5l7fQVM9ho3j/oKD8uNulA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=BUyGggAAAOMzAY0hQdHzbc9HA4nSxVsYcUd1Z27T/Jf2avL26nCoYO7GxBywqTqjX EaczbkfpwxkfD1cUpPqYpKBndMqlChnUbnIEzZ1NpXzTcWY2zXaRRsexNzpaEK0jyG LBZjRzh3cRGpiR+1HGTehCQTf8sQpLVHH7Q/60SI= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 03 Apr 2018 17:54:41 +0530 From: Amit Nischal To: Stephen Boyd Cc: Michael Turquette , Stephen Boyd , Andy Gross , David Brown , Rajendra Nayak , Odelu Kukatla , Taniya Das , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk-owner@vger.kernel.org Subject: Re: [PATCH v2 4/4] clk: qcom: Add Global Clock controller (GCC) driver for SDM845 In-Reply-To: <152150657982.254778.14132033041219278756@swboyd.mtv.corp.google.com> References: <1520493495-3084-1-git-send-email-anischal@codeaurora.org> <1520493495-3084-5-git-send-email-anischal@codeaurora.org> <152150657982.254778.14132033041219278756@swboyd.mtv.corp.google.com> Message-ID: <624665d7af39686d331c863ba7b9af4d@codeaurora.org> X-Sender: anischal@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-03-20 06:12, Stephen Boyd wrote: > Quoting Amit Nischal (2018-03-07 23:18:15) >> diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig >> index fbf4532..54d0545 100644 >> --- a/drivers/clk/qcom/Kconfig >> +++ b/drivers/clk/qcom/Kconfig >> @@ -218,6 +218,16 @@ config MSM_MMCC_8996 >> Say Y if you want to support multimedia devices such as >> display, >> graphics, video encode/decode, camera, etc. >> >> +config SDM_GCC_845 >> + tristate "SDM845 Global Clock Controller" >> + depends on COMMON_CLK_QCOM >> + help >> + Support for the global clock controller on Qualcomm >> Technologies, Inc >> + sdm845 devices. >> + Say Y if you want to use peripheral devices such as UART, >> SPI, >> + i2c, USB, UFS, SD/eMMC, PCIe, etc. >> + >> + > > Drop the double newline here please. Thanks for the review. We will fix this in next patch series. > >> config SPMI_PMIC_CLKDIV >> tristate "SPMI PMIC clkdiv Support" >> depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TEST >> @@ -226,3 +236,4 @@ config SPMI_PMIC_CLKDIV >> Technologies, Inc. SPMI PMIC. It configures the frequency of >> clkdiv outputs of the PMIC. These clocks are typically wired >> through alternate functions on GPIO pins. >> + > > Noise? We will fix this in next patch series. > >> diff --git a/drivers/clk/qcom/gcc-sdm845.c >> b/drivers/clk/qcom/gcc-sdm845.c >> new file mode 100644 >> index 0000000..3ffa098 >> --- /dev/null >> +++ b/drivers/clk/qcom/gcc-sdm845.c >> @@ -0,0 +1,3619 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * Copyright (c) 2018, The Linux Foundation. All rights reserved. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include >> + >> +#include "common.h" >> +#include "clk-regmap.h" >> +#include "clk-pll.h" >> +#include "clk-rcg.h" >> +#include "clk-branch.h" >> +#include "clk-alpha-pll.h" >> +#include "gdsc.h" >> +#include "reset.h" >> + >> +#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) } >> + >> +static struct freq_tbl cxo_safe_src_f = { >> + .pre_div = 1, >> +}; > > Still hoping this goes away. With new implementation of rcg2 shared ops, there is no need to pass safe source frequency table from the driver so we will address this in V3 patch series. > >> + >> +enum { >> + P_BI_TCXO, >> + P_AUD_REF_CLK, >> + P_CORE_BI_PLL_TEST_SE, >> + P_GPLL0_OUT_EVEN, >> + P_GPLL0_OUT_MAIN, >> + P_GPLL4_OUT_MAIN, >> + P_SLEEP_CLK, >> +}; > [...] >> + F(400000, P_BI_TCXO, 12, 1, 4), >> + F(9600000, P_BI_TCXO, 2, 0, 0), >> + F(19200000, P_BI_TCXO, 1, 0, 0), >> + F(25000000, P_GPLL0_OUT_MAIN, 12, 1, 2), >> + F(50000000, P_GPLL0_OUT_MAIN, 12, 0, 0), >> + F(100000000, P_GPLL0_OUT_MAIN, 6, 0, 0), >> + { } >> +}; >> + >> +static struct clk_rcg2 gcc_sdcc4_apps_clk_src = { >> + .cmd_rcgr = 0x1600c, >> + .mnd_width = 8, >> + .hid_width = 5, >> + .parent_map = gcc_parent_map_0, >> + .freq_tbl = ftbl_gcc_sdcc4_apps_clk_src, >> + .safe_src_freq_tbl = &cxo_safe_src_f, > > Why does sdcc have safe src stuff? Is something turning on the sdcc clk > outside of our control? I will get more details on this and will get back. > >> + .clkr.hw.init = &(struct clk_init_data){ >> + .name = "gcc_sdcc4_apps_clk_src", >> + .parent_names = gcc_parent_names_0, >> + .num_parents = 4, >> + .flags = CLK_SET_RATE_PARENT, >> + .ops = &clk_rcg2_shared_ops, >> + }, >> +}; >> + > [...] >> + >> +static struct clk_branch gcc_video_xo_clk = { >> + .halt_reg = 0xb028, >> + .halt_check = BRANCH_HALT, >> + .clkr = { >> + .enable_reg = 0xb028, >> + .enable_mask = BIT(0), >> + .hw.init = &(struct clk_init_data){ >> + .name = "gcc_video_xo_clk", >> + .flags = CLK_IS_CRITICAL, >> + .ops = &clk_branch2_ops, >> + > > These things have no parents and we mark them critical. Why are we > even exposing them to the kernel? Are they not on by default? Are we > going to change these to non-critical at some point in the future? These clocks are not enabled by default and going to video or other multimedia cores so we are marking them as critical and need to expose to the kernel. As of now, there is no plan to change these to non-critical. > >> +static const struct regmap_config gcc_sdm845_regmap_config = { >> + .reg_bits = 32, >> + .reg_stride = 4, >> + .val_bits = 32, >> + .max_register = 0x182090, > > Huge! :P > >> + .fast_io = true, >> +}; >> + >> +static const struct qcom_cc_desc gcc_sdm845_desc = { >> + .config = &gcc_sdm845_regmap_config, >> + .clks = gcc_sdm845_clocks, >> + .num_clks = ARRAY_SIZE(gcc_sdm845_clocks), >> + .resets = gcc_sdm845_resets, >> + .num_resets = ARRAY_SIZE(gcc_sdm845_resets), >> + .gdscs = gcc_sdm845_gdscs, >> + .num_gdscs = ARRAY_SIZE(gcc_sdm845_gdscs), >> +}; >> + >> +static const struct of_device_id gcc_sdm845_match_table[] = { >> + { .compatible = "qcom,gcc-sdm845" }, >> + { } >> +}; >> +MODULE_DEVICE_TABLE(of, gcc_sdm845_match_table); >> + >> +static int gcc_sdm845_probe(struct platform_device *pdev) >> +{ >> + struct device *dev = &pdev->dev; >> + struct regmap *regmap; >> + int i, ret; >> + >> + regmap = qcom_cc_map(pdev, &gcc_sdm845_desc); >> + if (IS_ERR(regmap)) >> + return PTR_ERR(regmap); >> + >> + for (i = 0; i < ARRAY_SIZE(gcc_sdm845_hws); i++) { >> + ret = devm_clk_hw_register(dev, gcc_sdm845_hws[i]); >> + if (ret) >> + return ret; >> + } >> + >> + /* Get the rate for safe source */ >> + cxo_safe_src_f.freq = clk_get_rate(bi_tcxo.hw.clk); > > Hopefully this can be dropped too. Yes, we will fix this in next patch series. > >> + >> + /* Disable the GPLL0 active input to MMSS and GPU via MISC >> registers */ >> + regmap_update_bits(regmap, 0x09FFC, 0x3, 0x3); >> + regmap_update_bits(regmap, 0x71028, 0x3, 0x3); > > Lowercase hex please. We will fix this in next patch series. > >> + >> + return qcom_cc_really_probe(pdev, &gcc_sdm845_desc, regmap); >> +} > -- > To unsubscribe from this list: send the line "unsubscribe linux-clk" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html