Received: by 10.192.165.156 with SMTP id m28csp1208705imm; Wed, 18 Apr 2018 06:05:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ks3Bl9UYBMPZKHf3V44lMNdEXaNrU16k8ooG8cXQj0bxQp3PUs3Vlbf9PFUJjfhaaj7eV X-Received: by 2002:a17:902:6c4b:: with SMTP id h11-v6mr2088022pln.33.1524056731392; Wed, 18 Apr 2018 06:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524056731; cv=none; d=google.com; s=arc-20160816; b=qeFj+u7MutSUEOtBtt9UIQ0wYl2K0GHI9S2pL5m4S49Bk0orvoPZkSbxosT/HN4NME HSa8nu/Y9fYCi4XktQ563xpSUuXa2+d1Z2s8LzmmVR7BdXAlMGJbne10w3ldCjb5dlTe 6Dc22lc5SbEkPdtgPp0j3VR3cS5nMT1SkAlBqIp96COs01YhBX4FW0/qEi5Je1CwpbK3 8qzc3GlDdYP+BeGEMCvOhg57ouxpX1093f9a4lzh/cicYxgGszyb/HnM6CJnIV0H1lOs sd8h8NrNo7cCJRpjEj3/KqtH4xainiOezmn+wiGgfKprIQLISvnzPcUlEOc2CKpB+r6v YkxQ== 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=9VuRlbMbH93FB0Fhu0rZfbx2IAB1WxEWr48VPGCQNpc=; b=XHGX/G3bjrXo5oNaZicrkEEKsJXmR/CinIe0QIc+/LfDJbXMQ03MWjDCMUCCzSmtgO 5sXWqeTo2zI4pQq0rULH/IiPfwd0FbP2GxZzzzFFPjPDCz2/bmNxhPz0qZQBl8GQH+WK fYjhuaHQvhNVWWWedDlRjDzYqDM+UtTlBuoHe8wTO9suBdvpS4cujDekKJ0rcn6Z+rb9 yYCPhMk1PdAlQq5+xQJ2j1o/aynTu0c0OK7+9jspGk7gPTna6bavTnpPiI+q+9MN0164 nIzo6J8TxjsRg6/ltiv0KmY1DHHGx0nQIL6m0HQqyOuR6rd1hvKKvq8FNpqyQJXTsQu2 fpZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=HBm3lhWX; dkim=pass header.i=@codeaurora.org header.s=default header.b=HBm3lhWX; 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 h1-v6si1201466plh.375.2018.04.18.06.05.16; Wed, 18 Apr 2018 06:05:31 -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=HBm3lhWX; dkim=pass header.i=@codeaurora.org header.s=default header.b=HBm3lhWX; 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 S1753811AbeDRNDx (ORCPT + 99 others); Wed, 18 Apr 2018 09:03:53 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:47690 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752027AbeDRNDv (ORCPT ); Wed, 18 Apr 2018 09:03:51 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E7E3A6076A; Wed, 18 Apr 2018 13:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524056630; bh=hvP+N28slUzR6+8Lt7oezFudUpd7Ghu8EYlttN10xX8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HBm3lhWXvyz+Yrf/QNx635sKTRoNPmSaqCTn8T+m7PNfhihFfM0bEd6i8JtND32kR Xa/Yew5ucwR3Sj1TBthRo6hf87L3x6CA6rfqrvzvD9t8KvkNA+r32vA6ZE9/soAO8V 1AyvpBFjkOh0y0Yza5KQeX/kYzyhuLEk0zOoZmj4= 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 F3757602BD; Wed, 18 Apr 2018 13:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1524056630; bh=hvP+N28slUzR6+8Lt7oezFudUpd7Ghu8EYlttN10xX8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=HBm3lhWXvyz+Yrf/QNx635sKTRoNPmSaqCTn8T+m7PNfhihFfM0bEd6i8JtND32kR Xa/Yew5ucwR3Sj1TBthRo6hf87L3x6CA6rfqrvzvD9t8KvkNA+r32vA6ZE9/soAO8V 1AyvpBFjkOh0y0Yza5KQeX/kYzyhuLEk0zOoZmj4= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 18 Apr 2018 18:33:49 +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 Subject: Re: [PATCH v3 3/3] clk: qcom: Add Global Clock controller (GCC) driver for SDM845 In-Reply-To: <152393708031.51482.15076025836699678476@swboyd.mtv.corp.google.com> References: <1522761761-15262-1-git-send-email-anischal@codeaurora.org> <1522761761-15262-4-git-send-email-anischal@codeaurora.org> <152393708031.51482.15076025836699678476@swboyd.mtv.corp.google.com> Message-ID: 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-04-17 09:21, Stephen Boyd wrote: > Quoting Amit Nischal (2018-04-03 06:22:41) >> diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig >> index fbf4532..c961e89 100644 >> --- a/drivers/clk/qcom/Kconfig >> +++ b/drivers/clk/qcom/Kconfig >> @@ -218,6 +218,15 @@ 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. > > Is there eMMC? Thanks for the review comments. There is no eMMC for SDM845. I will fix the above in next patch series. > >> + >> config SPMI_PMIC_CLKDIV >> tristate "SPMI PMIC clkdiv Support" >> depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TEST >> diff --git a/drivers/clk/qcom/gcc-sdm845.c >> b/drivers/clk/qcom/gcc-sdm845.c >> new file mode 100644 >> index 0000000..b1b7a1e >> --- /dev/null >> +++ b/drivers/clk/qcom/gcc-sdm845.c >> @@ -0,0 +1,3546 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * Copyright (c) 2018, The Linux Foundation. All rights reserved. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include >> +#include > > Is this include used? No, it is not getting used. We will remove this in next patch series. > >> +#include >> +#include >> +#include >> + > [...] >> + >> +static struct clk_rcg2 gcc_usb30_prim_mock_utmi_clk_src = { >> + .cmd_rcgr = 0xf030, >> + .mnd_width = 0, >> + .hid_width = 5, >> + .parent_map = gcc_parent_map_0, >> + .freq_tbl = ftbl_gcc_usb30_prim_mock_utmi_clk_src, >> + .clkr.hw.init = &(struct clk_init_data){ >> + .name = "gcc_usb30_prim_mock_utmi_clk_src", >> + .parent_names = gcc_parent_names_0, >> + .num_parents = 4, >> + .ops = &clk_rcg2_shared_ops, > > Still shared? Why? We would require the shared_ops for clocks which are configured by bootloader. > >> + >> +static struct clk_branch gcc_video_ahb_clk = { >> + .halt_reg = 0xb004, >> + .halt_check = BRANCH_HALT, >> + .hwcg_reg = 0xb004, >> + .hwcg_bit = 1, >> + .clkr = { >> + .enable_reg = 0xb004, >> + .enable_mask = BIT(0), >> + .hw.init = &(struct clk_init_data){ >> + .name = "gcc_video_ahb_clk", >> + .flags = CLK_IS_CRITICAL, >> + .ops = &clk_branch2_ops, >> + }, >> + }, >> +}; >> + >> + > > Weird double space here. We will fix this in next patch series. > >> +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, > > For these "critical" clks that don't have parents can you just throw > the > enable part in the gcc driver probe and remove these clks from being > exposed? They don't seem to provide any value to expose them as clks > when they don't hook into the final clk tree. > For all of the "critical" clocks which don't have parents, we have removed the CRITICAL flag and mandate the clients to put their vote to enable/disable them. Other than this, some of the "critical" clock instances we have completely removed and enabled them in the probe. This will be fixed in the next patch series. >> + .ops = &clk_branch2_ops, >> + }, >> + }, >> +}; >> + >> +static struct clk_branch gcc_vs_ctrl_ahb_clk = { >> + .halt_reg = 0x7a014, >> + .halt_check = BRANCH_HALT, >> + .hwcg_reg = 0x7a014, >> + .hwcg_bit = 1, >> + .clkr = { >> + .enable_reg = 0x7a014, >> + .enable_mask = BIT(0), >> + .hw.init = &(struct clk_init_data){ >> + .name = "gcc_vs_ctrl_ahb_clk", >> + .ops = &clk_branch2_ops, >> + }, >> + }, >> +}; >> + >> +static struct clk_branch gcc_vs_ctrl_clk = { >> + .halt_reg = 0x7a010, >> + .halt_check = BRANCH_HALT, >> + .clkr = { >> + .enable_reg = 0x7a010, >> + .enable_mask = BIT(0), >> + .hw.init = &(struct clk_init_data){ >> + .name = "gcc_vs_ctrl_clk", >> + .parent_names = (const char *[]){ >> + "gcc_vs_ctrl_clk_src", >> + }, >> + .num_parents = 1, >> + .flags = CLK_SET_RATE_PARENT, >> + .ops = &clk_branch2_ops, >> + }, >> + }, >> +}; >> + >> + >> +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; >> + } >> + >> + /* 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); > > I think we'll have to throw in the pipe clk branch stuff in here too? > And then drop the pipe clks from the driver? All the USB pipe clocks would be taken care. The PCIE pipe branch clocks would have to be explicitly disabled so as to retain the memory logic. Otherwise, it would lead to memory corruption in case the external source is directly disabled without disabling the branch clock. > >> + >> + return qcom_cc_really_probe(pdev, &gcc_sdm845_desc, regmap); >> +} >> + >> diff --git a/include/dt-bindings/clock/qcom,gcc-sdm845.h >> b/include/dt-bindings/clock/qcom,gcc-sdm845.h >> new file mode 100644 >> index 0000000..e27d8e2 >> --- /dev/null >> +++ b/include/dt-bindings/clock/qcom,gcc-sdm845.h >> @@ -0,0 +1,242 @@ > [...] >> +#define GCC_VDDA_VS_CLK >> 180 >> +#define GCC_VDDCX_VS_CLK 181 >> +#define GCC_VDDMX_VS_CLK 182 >> +#define GCC_VS_CTRL_AHB_CLK 183 >> +#define GCC_VS_CTRL_CLK >> 184 >> +#define GCC_VS_CTRL_CLK_SRC 185 >> +#define GCC_VSENSOR_CLK_SRC 186 >> +#define GPLL4 187 > > Do you have the define for the quad spi clks? And the implementation > for > it? > In SDM845, Quad SPI clocks are part of gcc_qupv*_wrap*_s* clock group. >> + >> +/* GCC reset clocks */ > > They're just resets, not reset clks. Will fix this in next patch series. > >> +#define GCC_MMSS_BCR 0 >> +#define GCC_PCIE_0_BCR 1 >> +#define GCC_PCIE_1_BCR 2 >> +#define GCC_PCIE_PHY_BCR 3 >> +#define GCC_PDM_BCR 4 >> +#define GCC_PRNG_BCR 5 >> +#define GCC_QUPV3_WRAPPER_0_BCR >> 6 >> +#define GCC_QUPV3_WRAPPER_1_BCR >> 7