* [PATCH v5] Patches for QCOM IPQ4019 clock driver @ 2016-12-22 14:40 Abhishek Sahu 2016-12-22 14:40 ` [PATCH v5] clk: qcom: ipq4019: Add the cpu clock frequency change notifier Abhishek Sahu 0 siblings, 1 reply; 3+ messages in thread From: Abhishek Sahu @ 2016-12-22 14:40 UTC (permalink / raw) To: mturquette, sboyd Cc: andy.gross, david.brown, varada, snlakshm, pradeepb, linux-arm-msm, linux-soc, linux-clk, linux-kernel, Abhishek Sahu These patches are related to Qualcomm IPQ4019 GCC (Global Clock Controller) driver code mainly adding the nodes for clock marked as fixed in current IPQ4019 clock driver and support for multiple CPU frequencies. [v5] 1. Hardcoded the safe parent index for APSS CPU frequency change notifier 2. Removed all other patches which are already reviewed and applied [V4] 1. Addressed the review comments given in v3 patches. 2. Removed the intermediate VCO clocks and make VCO as part of final divider clock. 3. Changed some variable and structure names. 4. Removed intermediate frequency change patch and merged in the main patch itself. 5. Added the APSS CPU frequency change notifier patch 6. Removed i2c node frequency table which is already reviewed. [V3] 1. Addressed the review comments given in v2 patches. 2. Replaced the do_div with normal division. 3. Marked the PCNOC node as critical. 4. Modified the frequency values for the recent change done in IPQ4019 bootloader. 5. Changed the i2c node frequency table for 19.05 MHz clock. [V2] 1. Removed the fixed clock references and add the same as clock nodes with recalc_rate operation. Abhishek Sahu (1): clk: qcom: ipq4019: Add the cpu clock frequency change notifier drivers/clk/qcom/gcc-ipq4019.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v5] clk: qcom: ipq4019: Add the cpu clock frequency change notifier 2016-12-22 14:40 [PATCH v5] Patches for QCOM IPQ4019 clock driver Abhishek Sahu @ 2016-12-22 14:40 ` Abhishek Sahu 2016-12-27 21:45 ` Stephen Boyd 0 siblings, 1 reply; 3+ messages in thread From: Abhishek Sahu @ 2016-12-22 14:40 UTC (permalink / raw) To: mturquette, sboyd Cc: andy.gross, david.brown, varada, snlakshm, pradeepb, linux-arm-msm, linux-soc, linux-clk, linux-kernel, Abhishek Sahu The current driver code gives the crash or gets hang while switching the CPU frequency some time. The APSS CPU Clock divider is not glitch free so it the APPS clock need to be switched for stable clock during the change. This patch adds the frequency change notifier for APSS CPU clock. It changes the parent of this clock to stable PLL FEPLL500 for PRE_RATE_CHANGE event. This event will be generated before actual clock set operations. The clock set operation will again change its corresponding parent by getting the same from frequency table. Signed-off-by: Abhishek Sahu <absahu@codeaurora.org> --- drivers/clk/qcom/gcc-ipq4019.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-ipq4019.c b/drivers/clk/qcom/gcc-ipq4019.c index eeafca2..9771fd2 100644 --- a/drivers/clk/qcom/gcc-ipq4019.c +++ b/drivers/clk/qcom/gcc-ipq4019.c @@ -22,6 +22,7 @@ #include <linux/reset-controller.h> #include <linux/math64.h> #include <linux/delay.h> +#include <linux/clk.h> #include <dt-bindings/clock/qcom,gcc-ipq4019.h> @@ -165,6 +166,12 @@ struct clk_fepll { { P_DDRPLLAPSS, 1 }, }; +/* + * Contains index for safe clock during APSS freq change. + * fepll500 is being used as safe clock so initialize it + * with its index in parents list gcc_xo_ddr_500_200. + */ +static const int gcc_ipq4019_cpu_safe_parent = 2; static const char * const gcc_xo_ddr_500_200[] = { "xo", "fepll200", @@ -1736,13 +1743,44 @@ static int clk_cpu_div_set_rate(struct clk_hw *hw, unsigned long rate, }; MODULE_DEVICE_TABLE(of, gcc_ipq4019_match_table); +static int +gcc_ipq4019_cpu_clk_notifier_fn(struct notifier_block *nb, + unsigned long action, void *data) +{ + int err = 0; + + if (action == PRE_RATE_CHANGE) + err = clk_rcg2_ops.set_parent(&apps_clk_src.clkr.hw, + gcc_ipq4019_cpu_safe_parent); + + return notifier_from_errno(err); +} + +static struct notifier_block gcc_ipq4019_cpu_clk_notifier = { + .notifier_call = gcc_ipq4019_cpu_clk_notifier_fn, +}; + static int gcc_ipq4019_probe(struct platform_device *pdev) { - return qcom_cc_probe(pdev, &gcc_ipq4019_desc); + int err; + + err = qcom_cc_probe(pdev, &gcc_ipq4019_desc); + if (!err) + err = clk_notifier_register(apps_clk_src.clkr.hw.clk, + &gcc_ipq4019_cpu_clk_notifier); + + return err; +} + +static int gcc_ipq4019_remove(struct platform_device *pdev) +{ + return clk_notifier_unregister(apps_clk_src.clkr.hw.clk, + &gcc_ipq4019_cpu_clk_notifier); } static struct platform_driver gcc_ipq4019_driver = { .probe = gcc_ipq4019_probe, + .remove = gcc_ipq4019_remove, .driver = { .name = "qcom,gcc-ipq4019", .of_match_table = gcc_ipq4019_match_table, -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v5] clk: qcom: ipq4019: Add the cpu clock frequency change notifier 2016-12-22 14:40 ` [PATCH v5] clk: qcom: ipq4019: Add the cpu clock frequency change notifier Abhishek Sahu @ 2016-12-27 21:45 ` Stephen Boyd 0 siblings, 0 replies; 3+ messages in thread From: Stephen Boyd @ 2016-12-27 21:45 UTC (permalink / raw) To: Abhishek Sahu Cc: mturquette, andy.gross, david.brown, varada, snlakshm, pradeepb, linux-arm-msm, linux-soc, linux-clk, linux-kernel On 12/22, Abhishek Sahu wrote: > The current driver code gives the crash or gets hang while switching > the CPU frequency some time. The APSS CPU Clock divider is not glitch > free so it the APPS clock need to be switched for stable clock during > the change. > > This patch adds the frequency change notifier for APSS CPU clock. It > changes the parent of this clock to stable PLL FEPLL500 for > PRE_RATE_CHANGE event. This event will be generated before actual > clock set operations. The clock set operation will again change its > corresponding parent by getting the same from frequency table. > > Signed-off-by: Abhishek Sahu <absahu@codeaurora.org> > --- Applied to clk-ipq4019 and merged into clk-next. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-12-27 21:45 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-12-22 14:40 [PATCH v5] Patches for QCOM IPQ4019 clock driver Abhishek Sahu 2016-12-22 14:40 ` [PATCH v5] clk: qcom: ipq4019: Add the cpu clock frequency change notifier Abhishek Sahu 2016-12-27 21:45 ` Stephen Boyd
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).