Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5685440yba; Tue, 30 Apr 2019 20:27:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwuBv9zbfLratltxANV3uEQiM2xWqslgLxDiVCiyObbmdVM+r7wc5dljHmnsqYWS0VL7u7r X-Received: by 2002:a63:2c4a:: with SMTP id s71mr70739779pgs.373.1556681231069; Tue, 30 Apr 2019 20:27:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556681231; cv=none; d=google.com; s=arc-20160816; b=c9qgpLjKeWuRl3sRp13T6hbMlI7JwK/vYMQQ5KQ/s1NO6I6y6m6D3bZdid/OtOpUTW gK7pU3Wmv/Edjk4XwMjpcv/yvWNn3SP1ygqrgCDmlqPYshQqoSFOcSUuUfdJI5Z+6UNJ BjNuWvHITPyOGf0Dev3PykUYZj382bArtI0CKUFyrcasMZKTewScUSx1glmioHDwFAHx GME+UucfZPzK4IUEg8AK33am89yv3eAwSDyYd6RIxUTj3R2FKberY7OS1CdSrcfq/GqT ZBr9pYQ+wGVwH4LwUQPpP86DBvozYurmO7fn43nGMnlx7WwD+HqRT2IBsKBOP+BAM8Nc 2zdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PrgypJchVkXOthqiW8EugRGKE4eU23dOnNO+Q9MJg1c=; b=VO5ojxExNY53rkgKAEFSUjB/T9nMt/+uHMJ5tGXzhEg6tMEwuYnEuoEHUPWto2TgHc qOE2RTcAKWoElJxPxyI1Sf3TiMrgO6dWVBq0bVMuuqwS97DLILFkXoXXl/3WLfZzuXnX ZqbGWF7R8671SPgfBmB4mRcNGNlveDcYLOo1OmtFlI9uwg9m1JL2+zcUWGgezzc3dB++ QCdusj2YfTYxo3x9wHbZ/omMt9TSRRy6vmgOYJWpFI1QCGgSKEhVKuD5kwaWdRRdeQfp N7g4MV/MuOzYX3g2cJiDydnmhkhEPhrXlu5oHHdI/DoPHblNASqvuqZnShOiRJ7SNTwv FeMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bTp/e3F3"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h7si37561635pgj.363.2019.04.30.20.26.55; Tue, 30 Apr 2019 20:27:11 -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=@linaro.org header.s=google header.b="bTp/e3F3"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726083AbfEAD0F (ORCPT + 99 others); Tue, 30 Apr 2019 23:26:05 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38881 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfEAD0F (ORCPT ); Tue, 30 Apr 2019 23:26:05 -0400 Received: by mail-pf1-f195.google.com with SMTP id 10so8060941pfo.5 for ; Tue, 30 Apr 2019 20:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=PrgypJchVkXOthqiW8EugRGKE4eU23dOnNO+Q9MJg1c=; b=bTp/e3F3LR1UcC6Ez9JrwvETfC4QbKvQCC1jRnXChLpKqCOKzg3tXle9kPQja6SCiu O4SupA47nYzraIXoICu7s0UV8HoaINcI1VerAlw0RRqpXBy39aHgch8SDYbV7/uV655D VYvGrj/yfiK33z618S3UUZyTiuEAmKUXVk0NcQNOwLt77akQbwxPy/oyBsQvdMZy5x15 KQldz/hYsrutbH5CmS2FsncMHZqJd9k9O0h+TBSytEI1SRi7CaPjyfEtFoRcx57dVR86 R+m1ueMBNuP55uJx6vmaQ+K5hNekZfGHHDaGyDwlbpkP0H6q004Yci19sFhWJlNVHWad F7KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=PrgypJchVkXOthqiW8EugRGKE4eU23dOnNO+Q9MJg1c=; b=uNZUG9V4YzHzeW0TIax3OxPmstG21oz4JKvDHeHGl8DVEnRwm5vb06R6z4vnTXDAlc sjQ2K8F3XISGlV/DbZ8CNRnhWjvDb5yBntnzkEpENVrZL1JbD6pZl0quj65GB2hrtdWY MvO+7iKD9v+y8O7KBuHjwo0i2k7hEfuQf8CnxvwzVF+7TOfh9qNiPAwRMKNjKz3eCJ97 m/FewC0i3eaVkCxaIFb4oDIuZT8fAzMeub4khn0tmtT8DadqA6QWBxgWyU29zK8mRQXT O2O+xHeTtqyBKp/AHO0QtauxwP3nmHmUNOycnWGcb3WRc9anlnGzhJRqJCYsucAjbRim xMrQ== X-Gm-Message-State: APjAAAXdNNczldJ594GGWY2ji/AN5YwMohIlPUnpjI/jKdHQebb4QmIW lCe87NsLz4P8/x9h/EIFcnZYbw== X-Received: by 2002:aa7:842f:: with SMTP id q15mr12062413pfn.161.1556681163980; Tue, 30 Apr 2019 20:26:03 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id a19sm429171pgm.46.2019.04.30.20.26.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Apr 2019 20:26:02 -0700 (PDT) Date: Tue, 30 Apr 2019 20:26:03 -0700 From: Bjorn Andersson To: Jeffrey Hugo Cc: mturquette@baylibre.com, sboyd@kernel.org, agross@kernel.org, marc.w.gonzalez@free.fr, david.brown@linaro.org, robh+dt@kernel.org, mark.rutland@arm.com, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v3 3/6] clk: qcom: smd: Add XO clock for MSM8998 Message-ID: <20190501032603.GA2938@tuxbook-pro> References: <1556677404-29194-1-git-send-email-jhugo@codeaurora.org> <1556677576-29336-1-git-send-email-jhugo@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1556677576-29336-1-git-send-email-jhugo@codeaurora.org> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 30 Apr 19:26 PDT 2019, Jeffrey Hugo wrote: > The XO clock generally feeds into other clock controllers as the parent > for a lot of clock generators. > > Drop the "fake" XO clock in GCC now that it is redundant can will cause a > namespace conflict. > > Signed-off-by: Jeffrey Hugo > --- > drivers/clk/qcom/clk-smd-rpm.c | 24 ++++++++++++++++++++---- > drivers/clk/qcom/gcc-msm8998.c | 29 ++++++++++++----------------- > 2 files changed, 32 insertions(+), 21 deletions(-) > > diff --git a/drivers/clk/qcom/clk-smd-rpm.c b/drivers/clk/qcom/clk-smd-rpm.c > index 22dd42a..55a622df 100644 > --- a/drivers/clk/qcom/clk-smd-rpm.c > +++ b/drivers/clk/qcom/clk-smd-rpm.c > @@ -68,7 +68,7 @@ > } > > #define __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type, r_id, \ > - stat_id, r, key) \ > + stat_id, r, key, ignore_unused) \ I expect that we can revert the ignore_unused part once we have a proper way to deal with resource handover. Reviewed-by: Bjorn Andersson Regards, Bjorn > static struct clk_smd_rpm _platform##_##_active; \ > static struct clk_smd_rpm _platform##_##_name = { \ > .rpm_res_type = (type), \ > @@ -83,6 +83,7 @@ > .name = #_name, \ > .parent_names = (const char *[]){ "xo_board" }, \ > .num_parents = 1, \ > + .flags = (ignore_unused) ? CLK_IGNORE_UNUSED : 0, \ > }, \ > }; \ > static struct clk_smd_rpm _platform##_##_active = { \ > @@ -99,6 +100,7 @@ > .name = #_active, \ > .parent_names = (const char *[]){ "xo_board" }, \ > .num_parents = 1, \ > + .flags = (ignore_unused) ? CLK_IGNORE_UNUSED : 0, \ > }, \ > } > > @@ -108,7 +110,17 @@ > > #define DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type, r_id, r) \ > __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type, \ > - r_id, 0, r, QCOM_RPM_SMD_KEY_ENABLE) > + r_id, 0, r, QCOM_RPM_SMD_KEY_ENABLE, false) > + > +/* > + * Intended for XO clock where we don't want it turned off during late init > + * if we don't have a consumer by then, but can turn it off later for deep > + * sleep > + */ > +#define DEFINE_CLK_SMD_RPM_BRANCH_SKIP_UNUSED(_platform, _name, _active, type,\ > + r_id, r) \ > + __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, type, \ > + r_id, 0, r, QCOM_RPM_SMD_KEY_ENABLE, true) > > #define DEFINE_CLK_SMD_RPM_QDSS(_platform, _name, _active, type, r_id) \ > __DEFINE_CLK_SMD_RPM(_platform, _name, _active, type, r_id, \ > @@ -117,12 +129,12 @@ > #define DEFINE_CLK_SMD_RPM_XO_BUFFER(_platform, _name, _active, r_id) \ > __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, \ > QCOM_SMD_RPM_CLK_BUF_A, r_id, 0, 1000, \ > - QCOM_RPM_KEY_SOFTWARE_ENABLE) > + QCOM_RPM_KEY_SOFTWARE_ENABLE, false) > > #define DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(_platform, _name, _active, r_id) \ > __DEFINE_CLK_SMD_RPM_BRANCH(_platform, _name, _active, \ > QCOM_SMD_RPM_CLK_BUF_A, r_id, 0, 1000, \ > - QCOM_RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY) > + QCOM_RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY, false) > > #define to_clk_smd_rpm(_hw) container_of(_hw, struct clk_smd_rpm, hw) > > @@ -656,6 +668,8 @@ static int clk_smd_rpm_enable_scaling(struct qcom_smd_rpm *rpm) > }; > > /* msm8998 */ > +DEFINE_CLK_SMD_RPM_BRANCH_SKIP_UNUSED(msm8998, xo, xo_a, QCOM_SMD_RPM_MISC_CLK, > + 0, 19200000); > DEFINE_CLK_SMD_RPM(msm8998, snoc_clk, snoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 1); > DEFINE_CLK_SMD_RPM(msm8998, cnoc_clk, cnoc_a_clk, QCOM_SMD_RPM_BUS_CLK, 2); > DEFINE_CLK_SMD_RPM(msm8998, ce1_clk, ce1_a_clk, QCOM_SMD_RPM_CE_CLK, 0); > @@ -678,6 +692,8 @@ static int clk_smd_rpm_enable_scaling(struct qcom_smd_rpm *rpm) > DEFINE_CLK_SMD_RPM_XO_BUFFER(msm8998, rf_clk3, rf_clk3_a, 6); > DEFINE_CLK_SMD_RPM_XO_BUFFER_PINCTRL(msm8998, rf_clk3_pin, rf_clk3_a_pin, 6); > static struct clk_smd_rpm *msm8998_clks[] = { > + [RPM_SMD_XO_CLK_SRC] = &msm8998_xo, > + [RPM_SMD_XO_A_CLK_SRC] = &msm8998_xo_a, > [RPM_SMD_SNOC_CLK] = &msm8998_snoc_clk, > [RPM_SMD_SNOC_A_CLK] = &msm8998_snoc_a_clk, > [RPM_SMD_CNOC_CLK] = &msm8998_cnoc_clk, > diff --git a/drivers/clk/qcom/gcc-msm8998.c b/drivers/clk/qcom/gcc-msm8998.c > index 0336882..47c3163 100644 > --- a/drivers/clk/qcom/gcc-msm8998.c > +++ b/drivers/clk/qcom/gcc-msm8998.c > @@ -11,6 +11,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -117,17 +118,6 @@ enum { > "core_bi_pll_test_se", > }; > > -static struct clk_fixed_factor xo = { > - .mult = 1, > - .div = 1, > - .hw.init = &(struct clk_init_data){ > - .name = "xo", > - .parent_names = (const char *[]){ "xo_board" }, > - .num_parents = 1, > - .ops = &clk_fixed_factor_ops, > - }, > -}; > - > static struct pll_vco fabia_vco[] = { > { 250000000, 2000000000, 0 }, > { 125000000, 1000000000, 1 }, > @@ -2959,10 +2949,6 @@ enum { > .fast_io = true, > }; > > -static struct clk_hw *gcc_msm8998_hws[] = { > - &xo.hw, > -}; > - > static const struct qcom_cc_desc gcc_msm8998_desc = { > .config = &gcc_msm8998_regmap_config, > .clks = gcc_msm8998_clocks, > @@ -2971,14 +2957,23 @@ enum { > .num_resets = ARRAY_SIZE(gcc_msm8998_resets), > .gdscs = gcc_msm8998_gdscs, > .num_gdscs = ARRAY_SIZE(gcc_msm8998_gdscs), > - .clk_hws = gcc_msm8998_hws, > - .num_clk_hws = ARRAY_SIZE(gcc_msm8998_hws), > }; > > static int gcc_msm8998_probe(struct platform_device *pdev) > { > struct regmap *regmap; > int ret; > + struct clk *xo; > + > + /* > + * We must have a valid XO to continue, otherwise having a missing > + * parent on a system critical clock like the uart core clock can > + * result in strange bugs. > + */ > + xo = clk_get(&pdev->dev, "xo"); > + if (IS_ERR(xo)) > + return PTR_ERR(xo); > + clk_put(xo); > > regmap = qcom_cc_map(pdev, &gcc_msm8998_desc); > if (IS_ERR(regmap)) > -- > Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. > Qualcomm Technologies, Inc. is a member of the > Code Aurora Forum, a Linux Foundation Collaborative Project. >