Krait clocks + Krait CPUfreq
Subsystems (6)
v4 cover Krait clocks + Krait CPUfreq
Mostly a resend of the v3 posted by Stephen quite some time back [1] except for few changes.
Based on reading some feedback from list,
* Dropped the patch "clk: Add safe switch hook" from v3 [2].
Now this is taken care by patch#10 in this series only for Krait.
* Dropped the path "clk: Avoid sending high rates to downstream clocks during set_rate" from v3 [3].
* Rebased on top of clk-next.
* Dropped the DT update from the series. Will send seperately
* Now with cpufreq-dt+opp supporting voltage scaling, registering the krait cpu supplies in DT should be sufficient. But one issue is, the qcom-cpufreq drivers reads the efuse and based on that registers the opp data and then registers the cpufreq-dt device. So when cpufreq-dt driver probes and registers the regulator to the OPP framework, it expects that the opp data for the device should not be registered before the regulator. Will send a RFC patch removing that check, to find out the right way of doing it.
These patches provide cpufreq scaling on devices with Krait CPUs. In Krait CPU designs there's one PLL and two muxes per CPU, allowing us to switch CPU frequencies independently.
secondary +-----+ + | QSB |-------+------------|\ +-----+ | | |-+ | +-------|/ | | | + | +-----+ | | | | PLL |----+-------+ | primary +-----+ | | | + | | +-----|\ +------+ +-------+ | | | \ | | | HFPLL |----------+-----------------| |-----| CPU0 | +-------+ | | | | | | | | | | +-----+ | / +------+ | | +-| / 2 |---------|/ | | +-----+ + | | secondary | | + | +------------|\ | | |-+ +---------------|/ | primary + | + +-----|\ +------+ +-------+ | \ | | | HFPLL |----------------------------| |-----| CPU1 | +-------+ | | | | | | +-----+ | / +------+ +-| / 2 |---------|/ +-----+ +
To support this in the common clock framework we model the muxes, dividers, and PLLs as different clocks. CPUfreq only interacts with the primary mux (farthest right in the diagram). When CPUfreq sets a rate, the mux code finds the best parent that can provide the rate. Due to the design, QSB and the top PLL are always a fixed rate and thus only support one frequency each. These sources provide the lowest frequencies for the CPUs. The HFPLLs are where we can make the CPU go faster (GHz range). Sometimes we need to run the HFPLL twice as fast and divide it by two to get a particular frequency.
When switching rates we can't leave the CPU clocked by the HFPLL because we need to turn off the output of the PLL when changing its frequency. This means we have to switch over to the secondary mux and use one of the fixed sources. This is why we need something like the safe parent patch.
[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/332607.html
[2] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/332615.html
[3] http://lists.infradead.org/pipermail/linux-arm-kernel/2015-March/332608.html
Sricharan R (2):
clk: qcom: Add safe switch hook for krait mux clocks
cpufreq: dt: Reintroduce independent_clocks platform data
Stephen Boyd (10):
ARM: Add Krait L2 register accessor functions
clk: mux: Split out register accessors for reuse
clk: qcom: Add support for High-Frequency PLLs (HFPLLs)
clk: qcom: Add HFPLL driver
clk: qcom: Add MSM8960/APQ8064's HFPLLs
clk: qcom: Add IPQ806X's HFPLLs
clk: qcom: Add support for Krait clocks
clk: qcom: Add KPSS ACC/GCC driver
clk: qcom: Add Krait clock controller driver
cpufreq: Add module to register cpufreq on Krait CPUs
.../devicetree/bindings/arm/msm/qcom,kpss-acc.txt | 7 + .../devicetree/bindings/arm/msm/qcom,kpss-gcc.txt | 28 ++ .../devicetree/bindings/arm/msm/qcom,pvs.txt | 38 ++ .../devicetree/bindings/clock/qcom,hfpll.txt | 40 ++ .../devicetree/bindings/clock/qcom,krait-cc.txt | 22 ++ arch/arm/common/Kconfig | 3 + arch/arm/common/Makefile | 1 + arch/arm/common/krait-l2-accessors.c | 58 +++ arch/arm/include/asm/krait-l2-accessors.h | 20 + drivers/clk/clk-mux.c | 75 ++-- drivers/clk/qcom/Kconfig | 28 ++ drivers/clk/qcom/Makefile | 5 + drivers/clk/qcom/clk-hfpll.c | 253 +++++++++++++ drivers/clk/qcom/clk-hfpll.h | 54 +++ drivers/clk/qcom/clk-krait.c | 136 +++++++ drivers/clk/qcom/clk-krait.h | 51 +++ drivers/clk/qcom/gcc-ipq806x.c | 82 +++++ drivers/clk/qcom/gcc-msm8960.c | 172 +++++++++ drivers/clk/qcom/hfpll.c | 106 ++++++ drivers/clk/qcom/kpss-xcc.c | 96 +++++ drivers/clk/qcom/krait-cc.c | 406 +++++++++++++++++++++ drivers/cpufreq/Kconfig.arm | 9 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/cpufreq-dt.c | 7 +- drivers/cpufreq/cpufreq-dt.h | 6 + drivers/cpufreq/qcom-cpufreq.c | 204 +++++++++++ include/dt-bindings/clock/qcom,gcc-msm8960.h | 2 + include/linux/clk-provider.h | 9 +- 28 files changed, 1888 insertions(+), 31 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,pvs.txt create mode 100644 Documentation/devicetree/bindings/clock/qcom,hfpll.txt create mode 100644 Documentation/devicetree/bindings/clock/qcom,krait-cc.txt create mode 100644 arch/arm/common/krait-l2-accessors.c create mode 100644 arch/arm/include/asm/krait-l2-accessors.h create mode 100644 drivers/clk/qcom/clk-hfpll.c create mode 100644 drivers/clk/qcom/clk-hfpll.h create mode 100644 drivers/clk/qcom/clk-krait.c create mode 100644 drivers/clk/qcom/clk-krait.h create mode 100644 drivers/clk/qcom/hfpll.c create mode 100644 drivers/clk/qcom/kpss-xcc.c create mode 100644 drivers/clk/qcom/krait-cc.c create mode 100644 drivers/cpufreq/qcom-cpufreq.c
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 1/12 ARM: Add Krait L2 register accessor functions
From: Stephen Boyd <[email protected]>
Krait CPUs have a handful of L2 cache controller registers that live behind a cp15 based indirection register. First you program the indirection register (l2cpselr) to point the L2 'window' register (l2cpdr) at what you want to read/write. Then you read/write the 'window' register to do what you want. The l2cpselr register is not banked per-cpu so we must lock around accesses to it to prevent other CPUs from re-pointing l2cpdr underneath us.
--- arch/arm/common/Kconfig | 3 ++ arch/arm/common/Makefile | 1 + arch/arm/common/krait-l2-accessors.c | 58 +++++++++++++++++++++++++++++++ arch/arm/include/asm/krait-l2-accessors.h | 20 +++++++++++ 4 files changed, 82 insertions(+) create mode 100644 arch/arm/common/krait-l2-accessors.c create mode 100644 arch/arm/include/asm/krait-l2-accessors.h
arch/arm/common/Kconfig +3 -0
@@ -7,6 +7,9 @@ config DMABOUNCE bool select ZONE_DMA +config KRAIT_L2_ACCESSORS + bool + config SHARP_LOCOMO bool
arch/arm/common/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-y += firmware.o obj-$(CONFIG_SA1111) += sa1111.o obj-$(CONFIG_DMABOUNCE) += dmabounce.o +obj-$(CONFIG_KRAIT_L2_ACCESSORS) += krait-l2-accessors.o obj-$(CONFIG_SHARP_LOCOMO) += locomo.o obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o obj-$(CONFIG_SHARP_SCOOP) += scoop.o
arch/arm/common/krait-l2-accessors.c new file +58 -0
58 lines not on this page · raw message
arch/arm/include/asm/krait-l2-accessors.h new file +20 -0
@@ -0,0 +1,20 @@ +/* +* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __ASMARM_KRAIT_L2_ACCESSORS_H +#define __ASMARM_KRAIT_L2_ACCESSORS_H + +extern void krait_set_l2_indirect_reg (u32 addr,u32 val); +extern u32 krait_get_l2_indirect_reg (u32 addr); + +#endif
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 2/12 clk: mux: Split out register accessors for reuse
In reply to Sricharan RFrom: Stephen Boyd <[email protected]>
We want to reuse the logic in clk-mux.c for other clock drivers that don't use readl as register accessors. Fortunately, there really isn't much to the mux code besides the table indirection and quirk flags if you assume any bit shifting and masking has been done already. Pull that logic out into reusable functions that operate on an optional table and some flags so that other drivers can use the same logic.
--- drivers/clk/clk-mux.c | 75 +++++++++++++++++++++++++++----------------- include/linux/clk-provider.h | 9 ++++-- 2 files changed, 54 insertions(+), 30 deletions(-)
drivers/clk/clk-mux.c +47 -28
@@ -26,35 +26,24 @@* parent - parent is adjustable through clk_set_parent */ -static u8 clk_mux_get_parent (struct clk_hw *hw) +unsigned int clk_mux_get_parent (struct clk_hw *hw,unsigned int val, +unsigned int *table,unsigned long flags) { -struct clk_mux *mux =to_clk_mux (hw);int num_parents =clk_hw_get_num_parents (hw); -u32 val; - -/* -* FIXME need a mux-specific flag to determine if val is bitwise or numeric -* e.g. sys_clkin_ck's clksel field is 3 bits wide, but ranges from 0x1 -* to 0x7 (index starts at one) -* OTOH, pmd_trace_clk_mux_ck uses a separate bit for each clock, so -* val = 0x4 really means "bit 2, index starts at bit 0" -*/ - val =clk_readl (mux->reg) >> mux->shift; - val &= mux->mask; -if (mux->table) { +if (table) {int i;for (i =0 ; i < num_parents; i++) -if (mux->table[i] == val) +if (table[i] == val)return i;return -EINVAL ; } -if (val && (mux->flags &CLK_MUX_INDEX_BIT )) +if (val && (flags &CLK_MUX_INDEX_BIT )) val =ffs (val) -1 ; -if (val && (mux->flags &CLK_MUX_INDEX_ONE )) +if (val && (flags &CLK_MUX_INDEX_ONE )) val--;if (val >= num_parents)
@@ -62,23 +51,53 @@ static u8 clk_mux_get_parent(struct clk_hw *hw)return val; } +EXPORT_SYMBOL_GPL (clk_mux_get_parent); -static int clk_mux_set_parent (struct clk_hw *hw,u8 index) +static u8 _clk_mux_get_parent (struct clk_hw *hw) {struct clk_mux *mux =to_clk_mux (hw);u32 val; -unsigned long flags =0 ; -if (mux->table) { - index = mux->table[index]; +/* +* FIXME need a mux-specific flag to determine if val is bitwise or +* numeric e.g. sys_clkin_ck's clksel field is 3 bits wide, +* but ranges from 0x1 to 0x7 (index starts at one) +* OTOH, pmd_trace_clk_mux_ck uses a separate bit for each clock, so +* val = 0x4 really means "bit 2, index starts at bit 0" +*/ + val =clk_readl (mux->reg) >> mux->shift; + val &= mux->mask; + +return clk_mux_get_parent (hw, val, mux->table, mux->flags); +} + +unsigned int clk_mux_reindex (u8 index,unsigned int *table, +unsigned long flags) +{ +unsigned int val = index; + +if (table) { + val = table[val]; }else { -if (mux->flags &CLK_MUX_INDEX_BIT ) - index =1 << index; +if (flags &CLK_MUX_INDEX_BIT ) + val =1 << index; -if (mux->flags &CLK_MUX_INDEX_ONE ) - index++; +if (flags &CLK_MUX_INDEX_ONE ) + val++; } +return val; +} +EXPORT_SYMBOL_GPL (clk_mux_reindex); + +static int clk_mux_set_parent (struct clk_hw *hw,u8 index) +{ +struct clk_mux *mux =to_clk_mux (hw); +u32 val; +unsigned long flags =0 ; + + index =clk_mux_reindex (index, mux->table, mux->flags); +if (mux->lock)spin_lock_irqsave (mux->lock, flags);else
@@ -102,14 +121,14 @@ static int clk_mux_set_parent(struct clk_hw *hw, u8 index) }const struct clk_ops clk_mux_ops = { - .get_parent = clk_mux_get_parent, + .get_parent = _clk_mux_get_parent, .set_parent = clk_mux_set_parent, .determine_rate = __clk_mux_determine_rate, };EXPORT_SYMBOL_GPL (clk_mux_ops);const struct clk_ops clk_mux_ro_ops = { - .get_parent = clk_mux_get_parent, + .get_parent = _clk_mux_get_parent, };EXPORT_SYMBOL_GPL (clk_mux_ro_ops);
@@ -117,7 +136,7 @@ struct clk_hw *clk_hw_register_mux_table(struct device *dev, const char *name, const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, - u8 clk_mux_flags, u32 *table, spinlock_t *lock) + u8 clk_mux_flags, unsigned int *table, spinlock_t *lock) { struct clk_mux *mux;struct clk_hw *hw;
include/linux/clk-provider.h +7 -2
@@ -468,7 +468,7 @@ struct clk_hw *clk_hw_register_divider_table(struct device *dev,struct clk_mux {struct clk_hw hw;void __iomem *reg; -u32 *table; +unsigned int *table;u32 mask;u8 shift;u8 flags;
@@ -486,6 +486,11 @@ struct clk_mux {extern const struct clk_ops clk_mux_ops;extern const struct clk_ops clk_mux_ro_ops; +unsigned int clk_mux_get_parent (struct clk_hw *hw,unsigned int val, +unsigned int *table,unsigned long flags); +unsigned int clk_mux_reindex (u8 index,unsigned int *table, +unsigned long flags); + struct clk *clk_register_mux(struct device *dev, const char *name, const char * const *parent_names, u8 num_parents, unsigned long flags,
@@ -506,7 +511,7 @@ struct clk_hw *clk_hw_register_mux_table(struct device *dev, const char *name, const char * const *parent_names, u8 num_parents, unsigned long flags, void __iomem *reg, u8 shift, u32 mask, - u8 clk_mux_flags, u32 *table, spinlock_t *lock); + u8 clk_mux_flags, unsigned int *table, spinlock_t *lock);void clk_unregister_mux (struct clk *clk);void clk_hw_unregister_mux (struct clk_hw *hw);
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 3/12 clk: qcom: Add support for High-Frequency PLLs (HFPLLs)
In reply to Sricharan RFrom: Stephen Boyd <[email protected]>
HFPLLs are the main frequency source for Krait CPU clocks. Add support for changing the rate of these PLLs.
--- drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clk-hfpll.c | 253 +++++++++++++++++++++++++++++++++++++++++++ drivers/clk/qcom/clk-hfpll.h | 54 +++++++++ 3 files changed, 308 insertions(+) create mode 100644 drivers/clk/qcom/clk-hfpll.c create mode 100644 drivers/clk/qcom/clk-hfpll.h
drivers/clk/qcom/Makefile +1 -0
@@ -10,6 +10,7 @@ clk-qcom-y += clk-rcg2.o clk-qcom-y += clk-branch.o clk-qcom-y += clk-regmap-divider.o clk-qcom-y += clk-regmap-mux.o +clk-qcom-y += clk-hfpll.o clk-qcom-y += reset.o clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o
drivers/clk/qcom/clk-hfpll.c new file +253 -0
253 lines not on this page · raw message
drivers/clk/qcom/clk-hfpll.h new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 4/12 clk: qcom: Add HFPLL driver
In reply to Sricharan RFrom: Stephen Boyd <[email protected]>
On some devices (MSM8974 for example), the HFPLLs are instantiated within the Krait processor subsystem as separate register regions. Add a driver for these PLLs so that we can provide HFPLL clocks for use by the system.
--- .../devicetree/bindings/clock/qcom,hfpll.txt | 40 ++++++++ drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/hfpll.c | 106 +++++++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,hfpll.txt create mode 100644 drivers/clk/qcom/hfpll.c
Documentation/devicetree/bindings/clock/qcom,hfpll.txt new file +40 -0
@@ -0,0 +1,40 @@ +High-Frequency PLL (HFPLL) + +PROPERTIES + +- compatible: + Usage: required + Value type: <string> + Definition: must be "qcom,hfpll" + +- reg: + Usage: required + Value type: <prop-encoded-array> + Definition: address and size of HPLL registers. An optional second + element specifies the address and size of the alias + register region. + +- clock-output-names: + Usage: required + Value type: <string> + Definition: Name of the PLL. Typically hfpllX where X is a CPU number + starting at 0. Otherwise hfpll_Y where Y is more specific + such as "l2". + +Example: + +1) An HFPLL for the L2 cache. + + clock-controller at f9016000 { + compatible = "qcom,hfpll"; + reg = <0xf9016000 0x30>; + clock-output-names = "hfpll_l2"; + }; + +2) An HFPLL for CPU0. This HFPLL has the alias register region. + + clock-controller at f908a000 { + compatible = "qcom,hfpll"; + reg = <0xf908a000 0x30>, <0xf900a000 0x30>; + clock-output-names = "hfpll0"; + };
drivers/clk/qcom/Kconfig +8 -0
@@ -205,3 +205,11 @@ 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. + +config QCOM_HFPLL + tristate "High-Frequency PLL (HFPLL) Clock Controller" + depends on COMMON_CLK_QCOM + help + Support for the high-frequency PLLs present on Qualcomm devices. + Say Y if you want to support CPU frequency scaling on devices + such as MSM8974, APQ8084, etc.
drivers/clk/qcom/Makefile +1 -0
@@ -36,3 +36,4 @@ obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o +obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
drivers/clk/qcom/hfpll.c new file +106 -0
106 lines not on this page · raw message
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 5/12 clk: qcom: Add MSM8960/APQ8064's HFPLLs
In reply to Sricharan RFrom: Stephen Boyd <[email protected]>
Describe the HFPLLs present on MSM8960 and APQ8064 devices.
--- drivers/clk/qcom/gcc-msm8960.c | 172 +++++++++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-msm8960.h | 2 + 2 files changed, 174 insertions(+)
drivers/clk/qcom/gcc-msm8960.c +172 -0
@@ -30,6 +30,7 @@#include "clk-pll.h" #include "clk-rcg.h" #include "clk-branch.h" +#include "clk-hfpll.h" #include "reset.h" static struct clk_pll pll3 = {
@@ -86,6 +87,164 @@ }, }; +static struct hfpll_data hfpll0_data = { + .mode_reg =0x3200 , + .l_reg =0x3208 , + .m_reg =0x320c , + .n_reg =0x3210 , + .config_reg =0x3204 , + .status_reg =0x321c , + .config_val =0x7845c665 , + .droop_reg =0x3214 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct clk_hfpll hfpll0 = { + .d = &hfpll0_data, + .clkr.hw.init = &(struct clk_init_data ){ + .parent_names = (const char *[]){"pxo" }, + .num_parents =1 , + .name ="hfpll0" , + .ops = &clk_ops_hfpll, + .flags =CLK_IGNORE_UNUSED , + }, + .lock =__SPIN_LOCK_UNLOCKED (hfpll0.lock), +}; + +static struct hfpll_data hfpll1_8064_data = { + .mode_reg =0x3240 , + .l_reg =0x3248 , + .m_reg =0x324c , + .n_reg =0x3250 , + .config_reg =0x3244 , + .status_reg =0x325c , + .config_val =0x7845c665 , + .droop_reg =0x3254 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct hfpll_data hfpll1_data = { + .mode_reg =0x3300 , + .l_reg =0x3308 , + .m_reg =0x330c , + .n_reg =0x3310 , + .config_reg =0x3304 , + .status_reg =0x331c , + .config_val =0x7845c665 , + .droop_reg =0x3314 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct clk_hfpll hfpll1 = { + .d = &hfpll1_data, + .clkr.hw.init = &(struct clk_init_data ){ + .parent_names = (const char *[]){"pxo" }, + .num_parents =1 , + .name ="hfpll1" , + .ops = &clk_ops_hfpll, + .flags =CLK_IGNORE_UNUSED , + }, + .lock =__SPIN_LOCK_UNLOCKED (hfpll1.lock), +}; + +static struct hfpll_data hfpll2_data = { + .mode_reg =0x3280 , + .l_reg =0x3288 , + .m_reg =0x328c , + .n_reg =0x3290 , + .config_reg =0x3284 , + .status_reg =0x329c , + .config_val =0x7845c665 , + .droop_reg =0x3294 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct clk_hfpll hfpll2 = { + .d = &hfpll2_data, + .clkr.hw.init = &(struct clk_init_data ){ + .parent_names = (const char *[]){"pxo" }, + .num_parents =1 , + .name ="hfpll2" , + .ops = &clk_ops_hfpll, + .flags =CLK_IGNORE_UNUSED , + }, + .lock =__SPIN_LOCK_UNLOCKED (hfpll2.lock), +}; + +static struct hfpll_data hfpll3_data = { + .mode_reg =0x32c0 , + .l_reg =0x32c8 , + .m_reg =0x32cc , + .n_reg =0x32d0 , + .config_reg =0x32c4 , + .status_reg =0x32dc , + .config_val =0x7845c665 , + .droop_reg =0x32d4 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct clk_hfpll hfpll3 = { + .d = &hfpll3_data, + .clkr.hw.init = &(struct clk_init_data ){ + .parent_names = (const char *[]){"pxo" }, + .num_parents =1 , + .name ="hfpll3" , + .ops = &clk_ops_hfpll, + .flags =CLK_IGNORE_UNUSED , + }, + .lock =__SPIN_LOCK_UNLOCKED (hfpll3.lock), +}; + +static struct hfpll_data hfpll_l2_8064_data = { + .mode_reg =0x3300 , + .l_reg =0x3308 , + .m_reg =0x330c , + .n_reg =0x3310 , + .config_reg =0x3304 , + .status_reg =0x331c , + .config_val =0x7845c665 , + .droop_reg =0x3314 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct hfpll_data hfpll_l2_data = { + .mode_reg =0x3400 , + .l_reg =0x3408 , + .m_reg =0x340c , + .n_reg =0x3410 , + .config_reg =0x3404 , + .status_reg =0x341c , + .config_val =0x7845c665 , + .droop_reg =0x3414 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct clk_hfpll hfpll_l2 = { + .d = &hfpll_l2_data, + .clkr.hw.init = &(struct clk_init_data ){ + .parent_names = (const char *[]){"pxo" }, + .num_parents =1 , + .name ="hfpll_l2" , + .ops = &clk_ops_hfpll, + .flags =CLK_IGNORE_UNUSED , + }, + .lock =__SPIN_LOCK_UNLOCKED (hfpll_l2.lock), +}; +static struct clk_pll pll14 = { .l_reg =0x31c4 , .m_reg =0x31c8 ,
@@ -3112,6 +3271,9 @@ enum { [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr, [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr, [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr, + [PLL9] = &hfpll0.clkr, + [PLL10] = &hfpll1.clkr, + [PLL12] = &hfpll_l2.clkr, };static const struct qcom_reset_map gcc_msm8960_resets[] = {
@@ -3323,6 +3485,11 @@ enum { [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr, [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr, [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr, + [PLL9] = &hfpll0.clkr, + [PLL10] = &hfpll1.clkr, + [PLL12] = &hfpll_l2.clkr, + [PLL16] = &hfpll2.clkr, + [PLL17] = &hfpll3.clkr, };static const struct qcom_reset_map gcc_apq8064_resets[] = {
@@ -3482,6 +3649,11 @@ static int gcc_msm8960_probe(struct platform_device *pdev)if (ret)return ret; +if (match->data == &gcc_apq8064_desc) { + hfpll1.d = &hfpll1_8064_data; + hfpll_l2.d = &hfpll_l2_8064_data; + } + tsens =platform_device_register_data (&pdev->dev,"qcom-tsens" ,-1 ,NULL ,0 );if (IS_ERR (tsens))
include/dt-bindings/clock/qcom,gcc-msm8960.h +2 -0
@@ -319,5 +319,7 @@#define CE3_SRC 303#define CE3_CORE_CLK 304#define CE3_H_CLK 305 +#define PLL16 306 +#define PLL17 307#endif
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 6/12 clk: qcom: Add IPQ806X's HFPLLs
In reply to Sricharan RFrom: Stephen Boyd <[email protected]>
Describe the HFPLLs present on IPQ806X devices.
--- drivers/clk/qcom/gcc-ipq806x.c | 82 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)
drivers/clk/qcom/gcc-ipq806x.c +82 -0
@@ -30,6 +30,7 @@#include "clk-pll.h" #include "clk-rcg.h" #include "clk-branch.h" +#include "clk-hfpll.h" #include "reset.h" static struct clk_pll pll0 = {
@@ -113,6 +114,84 @@ }, }; +static struct hfpll_data hfpll0_data = { + .mode_reg =0x3200 , + .l_reg =0x3208 , + .m_reg =0x320c , + .n_reg =0x3210 , + .config_reg =0x3204 , + .status_reg =0x321c , + .config_val =0x7845c665 , + .droop_reg =0x3214 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct clk_hfpll hfpll0 = { + .d = &hfpll0_data, + .clkr.hw.init = &(struct clk_init_data ){ + .parent_names = (const char *[]){"pxo" }, + .num_parents =1 , + .name ="hfpll0" , + .ops = &clk_ops_hfpll, + .flags =CLK_IGNORE_UNUSED , + }, + .lock =__SPIN_LOCK_UNLOCKED (hfpll0.lock), +}; + +static struct hfpll_data hfpll1_data = { + .mode_reg =0x3240 , + .l_reg =0x3248 , + .m_reg =0x324c , + .n_reg =0x3250 , + .config_reg =0x3244 , + .status_reg =0x325c , + .config_val =0x7845c665 , + .droop_reg =0x3314 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct clk_hfpll hfpll1 = { + .d = &hfpll1_data, + .clkr.hw.init = &(struct clk_init_data ){ + .parent_names = (const char *[]){"pxo" }, + .num_parents =1 , + .name ="hfpll1" , + .ops = &clk_ops_hfpll, + .flags =CLK_IGNORE_UNUSED , + }, + .lock =__SPIN_LOCK_UNLOCKED (hfpll1.lock), +}; + +static struct hfpll_data hfpll_l2_data = { + .mode_reg =0x3300 , + .l_reg =0x3308 , + .m_reg =0x330c , + .n_reg =0x3310 , + .config_reg =0x3304 , + .status_reg =0x331c , + .config_val =0x7845c665 , + .droop_reg =0x3314 , + .droop_val =0x0108c000 , + .min_rate =600000000UL , + .max_rate =1800000000UL , +}; + +static struct clk_hfpll hfpll_l2 = { + .d = &hfpll_l2_data, + .clkr.hw.init = &(struct clk_init_data ){ + .parent_names = (const char *[]){"pxo" }, + .num_parents =1 , + .name ="hfpll_l2" , + .ops = &clk_ops_hfpll, + .flags =CLK_IGNORE_UNUSED , + }, + .lock =__SPIN_LOCK_UNLOCKED (hfpll_l2.lock), +}; +static struct clk_pll pll14 = { .l_reg =0x31c4 , .m_reg =0x31c8 ,
@@ -2800,6 +2879,9 @@ enum { [UBI32_CORE2_CLK_SRC] = &ubi32_core2_src_clk.clkr, [NSSTCM_CLK_SRC] = &nss_tcm_src.clkr, [NSSTCM_CLK] = &nss_tcm_clk.clkr, + [PLL9] = &hfpll0.clkr, + [PLL10] = &hfpll1.clkr, + [PLL12] = &hfpll_l2.clkr, };static const struct qcom_reset_map gcc_ipq806x_resets[] = {
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 7/12 clk: qcom: Add support for Krait clocks
In reply to Sricharan RFrom: Stephen Boyd <[email protected]>
The Krait clocks are made up of a series of muxes and a divider that choose between a fixed rate clock and dedicated HFPLLs for each CPU. Instead of using mmio accesses to remux parents, the Krait implementation exposes the remux control via cp15 registers. Support these clocks.
--- drivers/clk/qcom/Kconfig | 4 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clk-krait.c | 134 +++++++++++++++++++++++++++++++++++++++++++ drivers/clk/qcom/clk-krait.h | 48 ++++++++++++++++ 4 files changed, 187 insertions(+) create mode 100644 drivers/clk/qcom/clk-krait.c create mode 100644 drivers/clk/qcom/clk-krait.h
drivers/clk/qcom/Kconfig +4 -0
@@ -213,3 +213,7 @@ config QCOM_HFPLL Support for the high-frequency PLLs present on Qualcomm devices. Say Y if you want to support CPU frequency scaling on devices such as MSM8974, APQ8084, etc. + +config KRAIT_CLOCKS + bool + select KRAIT_L2_ACCESSORS
drivers/clk/qcom/Makefile +1 -0
@@ -10,6 +10,7 @@ clk-qcom-y += clk-rcg2.o clk-qcom-y += clk-branch.o clk-qcom-y += clk-regmap-divider.o clk-qcom-y += clk-regmap-mux.o +clk-qcom-$(CONFIG_KRAIT_CLOCKS) += clk-krait.o clk-qcom-y += clk-hfpll.o clk-qcom-y += reset.o clk-qcom-$(CONFIG_QCOM_GDSC) += gdsc.o
drivers/clk/qcom/clk-krait.c new file +134 -0
134 lines not on this page · raw message
drivers/clk/qcom/clk-krait.h new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 8/12 clk: qcom: Add KPSS ACC/GCC driver
In reply to Sricharan RFrom: Stephen Boyd <[email protected]>
The ACC and GCC regions present in KPSSv1 contain registers to control clocks and power to each Krait CPU and L2. For CPUfreq purposes probe these devices and expose a mux clock that chooses between PXO and PLL8.
--- .../devicetree/bindings/arm/msm/qcom,kpss-acc.txt | 7 ++ .../devicetree/bindings/arm/msm/qcom,kpss-gcc.txt | 28 +++++++ drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/kpss-xcc.c | 96 ++++++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt create mode 100644 drivers/clk/qcom/kpss-xcc.c
Documentation/devicetree/bindings/arm/msm/qcom,kpss-acc.txt +7 -0
@@ -21,10 +21,17 @@ PROPERTIES the register region. An optional second element specifies the base address and size of the alias register region. +- clock-output-names: + Usage: optional + Value type: <string> + Definition: Name of the output clock. Typically acpuX_aux where X is a + CPU number starting at 0. + Example: clock-controller at 2088000 { compatible = "qcom,kpss-acc-v2"; reg = <0x02088000 0x1000>, <0x02008000 0x1000>; + clock-output-names = "acpu0_aux"; };
Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt new file +28 -0
@@ -0,0 +1,28 @@ +Krait Processor Sub-system (KPSS) Global Clock Controller (GCC) + +PROPERTIES + +- compatible: + Usage: required + Value type: <string> + Definition: should be one of: + "qcom,kpss-gcc" + +- reg: + Usage: required + Value type: <prop-encoded-array> + Definition: base address and size of the register region + +- clock-output-names: + Usage: required + Value type: <string> + Definition: Name of the output clock. Typically acpu_l2_aux indicating + an L2 cache auxiliary clock. + +Example: + + l2cc: clock-controller at 2011000 { + compatible = "qcom,kpss-gcc"; + reg = <0x2011000 0x1000>; + clock-output-names = "acpu_l2_aux"; + };
drivers/clk/qcom/Kconfig +8 -0
@@ -214,6 +214,14 @@ config QCOM_HFPLL Say Y if you want to support CPU frequency scaling on devices such as MSM8974, APQ8084, etc. +config KPSS_XCC + tristate "KPSS Clock Controller" + depends on COMMON_CLK_QCOM + help + Support for the Krait ACC and GCC clock controllers. Say Y + if you want to support CPU frequency scaling on devices such + as MSM8960, APQ8064, etc. + config KRAIT_CLOCKS bool select KRAIT_L2_ACCESSORS
drivers/clk/qcom/Makefile +1 -0
@@ -37,4 +37,5 @@ obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o +obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
drivers/clk/qcom/kpss-xcc.c new file +96 -0
96 lines not on this page · raw message
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 9/12 clk: qcom: Add Krait clock controller driver
In reply to Sricharan RFrom: Stephen Boyd <[email protected]>
The Krait CPU clocks are made up of a primary mux and secondary mux for each CPU and the L2, controlled via cp15 accessors. For Kraits within KPSSv1 each secondary mux accepts a different aux source, but on KPSSv2 each secondary mux accepts the same aux source.
--- .../devicetree/bindings/clock/qcom,krait-cc.txt | 22 ++ drivers/clk/qcom/Kconfig | 8 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/krait-cc.c | 350 +++++++++++++++++++++ 4 files changed, 381 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,krait-cc.txt create mode 100644 drivers/clk/qcom/krait-cc.c
Documentation/devicetree/bindings/clock/qcom,krait-cc.txt new file +22 -0
@@ -0,0 +1,22 @@ +Krait Clock Controller + +PROPERTIES + +- compatible: + Usage: required + Value type: <string> + Definition: must be one of: + "qcom,krait-cc-v1" + "qcom,krait-cc-v2" + +- #clock-cells: + Usage: required + Value type: <u32> + Definition: must be 1 + +Example: + + kraitcc: clock-controller { + compatible = "qcom,krait-cc-v1"; + #clock-cells = <1>; + };
drivers/clk/qcom/Kconfig +8 -0
@@ -222,6 +222,14 @@ config KPSS_XCC if you want to support CPU frequency scaling on devices such as MSM8960, APQ8064, etc. +config KRAITCC + tristate "Krait Clock Controller" + depends on COMMON_CLK_QCOM && ARM + select KRAIT_CLOCKS + help + Support for the Krait CPU clocks on Qualcomm devices. + Say Y if you want to support CPU frequency scaling. + config KRAIT_CLOCKS bool select KRAIT_L2_ACCESSORS
drivers/clk/qcom/Makefile +1 -0
@@ -39,3 +39,4 @@ obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o obj-$(CONFIG_QCOM_HFPLL) += hfpll.o +obj-$(CONFIG_KRAITCC) += krait-cc.o
drivers/clk/qcom/krait-cc.c new file +350 -0
350 lines not on this page · raw message
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 10/12 clk: qcom: Add safe switch hook for krait mux clocks
In reply to Sricharan RWhen the Hfplls are reprogrammed during the rate change, the primary muxes which are sourced from the same hfpll for higher frequencies, needs to be switched to the 'safe secondary mux' as the parent for that small window. This is done by registering a clk notifier for the muxes and switching to the safe parent in the PRE_RATE_CHANGE notifier and back to the original parent in the POST_RATE_CHANGE notifier.
--- drivers/clk/qcom/clk-krait.c | 2 ++ drivers/clk/qcom/clk-krait.h | 3 +++ drivers/clk/qcom/krait-cc.c | 56 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+)
drivers/clk/qcom/clk-krait.c +2 -0
@@ -60,6 +60,8 @@ static int krait_mux_set_parent(struct clk_hw *hw, u8 index)if (__clk_is_enabled (hw->clk))__krait_mux_set_sel (mux, sel); + mux->reparent = true; +return 0 ; }
drivers/clk/qcom/clk-krait.h +3 -0
@@ -23,6 +23,9 @@ struct krait_mux_clk {u32 shift;u32 en_mask;bool lpl; +u8 safe_sel; +u8 old_index; +bool reparent;struct clk_hw hw;struct notifier_block clk_nb;
drivers/clk/qcom/krait-cc.c +56 -0
98 lines not on this page · raw message
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 11/12 cpufreq: Add module to register cpufreq on Krait CPUs
In reply to Sricharan RFrom: Stephen Boyd <[email protected]>
Register a cpufreq-generic device whenever we detect that a "qcom,krait" compatible CPU is present in DT.
--- .../devicetree/bindings/arm/msm/qcom,pvs.txt | 38 ++++ drivers/cpufreq/Kconfig.arm | 9 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/qcom-cpufreq.c | 204 +++++++++++++++++++++ 4 files changed, 252 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,pvs.txt create mode 100644 drivers/cpufreq/qcom-cpufreq.c
Documentation/devicetree/bindings/arm/msm/qcom,pvs.txt new file +38 -0
@@ -0,0 +1,38 @@ +Qualcomm Process Voltage Scaling Tables + +The node name is required to be "qcom,pvs". There shall only be one +such node present in the root of the tree. + +PROPERTIES + +- qcom,pvs-format-a or qcom,pvs-format-b: + Usage: required + Value type: <empty> + Definition: Indicates the format of qcom,speedX-pvsY-bin-vZ properties. + If qcom,pvs-format-a is used the table is two columns + (frequency and voltage in that order). If qcom,pvs-format-b is used the table is three columns (frequency, voltage, + and current in that order). + +- qcom,speedX-pvsY-bin-vZ: + Usage: required + Value type: <prop-encoded-array> + Definition: The PVS table corresponding to the speed bin X, pvs bin Y, + and version Z. +Example: + + qcom,pvs { + qcom,pvs-format-a; + qcom,speed0-pvs0-bin-v0 = + < 384000000 950000 >, + < 486000000 975000 >, + < 594000000 1000000 >, + < 702000000 1025000 >, + < 810000000 1075000 >, + < 918000000 1100000 >, + < 1026000000 1125000 >, + < 1134000000 1175000 >, + < 1242000000 1200000 >, + < 1350000000 1225000 >, + < 1458000000 1237500 >, + < 1512000000 1250000 >; + };
drivers/cpufreq/Kconfig.arm +9 -0
@@ -100,6 +100,15 @@ config ARM_OMAP2PLUS_CPUFREQ depends on ARCH_OMAP2PLUS default ARCH_OMAP2PLUS +config ARM_QCOM_CPUFREQ + tristate "Qualcomm based" + depends on ARCH_QCOM + select PM_OPP + help + This adds the CPUFreq driver for Qualcomm SoC based boards. + + If in doubt, say N. + config ARM_S3C_CPUFREQ bool help
drivers/cpufreq/Makefile +1 -0
@@ -62,6 +62,7 @@ obj-$(CONFIG_ARM_MEDIATEK_CPUFREQ) += mediatek-cpufreq.o obj-$(CONFIG_ARM_OMAP2PLUS_CPUFREQ) += omap-cpufreq.o obj-$(CONFIG_ARM_PXA2xx_CPUFREQ) += pxa2xx-cpufreq.o obj-$(CONFIG_PXA3xx) += pxa3xx-cpufreq.o +obj-$(CONFIG_ARM_QCOM_CPUFREQ) += qcom-cpufreq.o obj-$(CONFIG_ARM_S3C24XX_CPUFREQ) += s3c24xx-cpufreq.o obj-$(CONFIG_ARM_S3C24XX_CPUFREQ_DEBUGFS) += s3c24xx-cpufreq-debugfs.o obj-$(CONFIG_ARM_S3C2410_CPUFREQ) += s3c2410-cpufreq.o
drivers/cpufreq/qcom-cpufreq.c new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 12/12 cpufreq: dt: Reintroduce independent_clocks platform data
In reply to Sricharan RThe Platform data was removed earlier by, 'commit eb96924acddc ("cpufreq: dt: Kill platform-data")' since there were no users at that time.
Now this is required when the each of the cpu clocks can be scaled independently, which is the case for krait cores. So reintroduce it.
--- drivers/cpufreq/cpufreq-dt.c | 7 ++++++- drivers/cpufreq/cpufreq-dt.h | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/cpufreq/cpufreq-dt.c +6 -1
@@ -228,7 +228,10 @@ static int cpufreq_init(struct cpufreq_policy *policy) }if (fallback) { -cpumask_setall (policy->cpus); +struct cpufreq_dt_platform_data *pd =cpufreq_get_driver_data (); + +if (!pd || !pd->independent_clocks) +cpumask_setall (policy->cpus);/* * OPP tables are initialized only for policy->cpu, do it for
@@ -380,6 +383,8 @@ static int dt_cpufreq_probe(struct platform_device *pdev)if (data && data->have_governor_per_policy) dt_cpufreq_driver.flags |=CPUFREQ_HAVE_GOVERNOR_PER_POLICY ; + dt_cpufreq_driver.driver_data = data; + ret =cpufreq_register_driver (&dt_cpufreq_driver);if (ret)dev_err (&pdev->dev,"failed register driver: %d\n" , ret);
drivers/cpufreq/cpufreq-dt.h +6 -0
@@ -13,6 +13,12 @@#include <linux/types.h> struct cpufreq_dt_platform_data { +/* +* True when each CPU has its own clock to control its +* frequency, false when all CPUs are controlled by a single +* clock. +*/ +bool independent_clocks;bool have_governor_per_policy; };
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Viresh Kumar
maintainerRe: [PATCH v4 12/12] cpufreq: dt: Reintroduce independent_clocks platform data
Quoted 7 lines · Sricharan R
The Platform data was removed earlier by, 'commit
eb96924acddc("cpufreq: dt: Kill platform-data")' since there were no users at that time.
Now this is required when the each of the cpu clocks can be scaled independently, which is the case for krait cores. So reintroduce it.
Quoted 5 lines
Signed-off-by Sricharan R <[email protected]>--- drivers/cpufreq/cpufreq-dt.c | 7 ++++++- drivers/cpufreq/cpufreq-dt.h | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-)
Nack. This information should come from the OPP layer (Hint:dev_pm_opp_of_get_sharing_cpus()).
Signature · 1 line
viresh
Viresh Kumar
maintainerRe: [PATCH v4 11/12] cpufreq: Add module to register cpufreq on Krait CPUs
In reply to Sricharan RQuoted 7 lines · Sricharan R
From: Stephen Boyd <[email protected]>
Register a cpufreq-generic device whenever we detect that a "qcom,krait" compatible CPU is present in DT.
Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>
Quoted 8 lines
--- .../devicetree/bindings/arm/msm/qcom,pvs.txt | 38 ++++ drivers/cpufreq/Kconfig.arm | 9 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/qcom-cpufreq.c | 204 +++++++++++++++++++++ 4 files changed, 252 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,pvs.txt create mode 100644 drivers/cpufreq/qcom-cpufreq.c
This must be done differently as we have enhanced OPP core to support such hardware. Look at: dev_pm_opp_set_prop_name() and the binding around it (opp-microvolt-<name>). Talk to Stephen, he was part of all those discussions.
Signature · 1 line
viresh
Re: [PATCH v4 11/12] cpufreq: Add module to register cpufreq on Krait CPUs
Hi Viresh,
Quoted 17 lines · Viresh Kumar
Quoted 7 lines · Sricharan R
From: Stephen Boyd <[email protected]>
Register a cpufreq-generic device whenever we detect that a "qcom,krait" compatible CPU is present in DT.
Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>Quoted 8 lines
--- .../devicetree/bindings/arm/msm/qcom,pvs.txt | 38 ++++ drivers/cpufreq/Kconfig.arm | 9 + drivers/cpufreq/Makefile | 1 + drivers/cpufreq/qcom-cpufreq.c | 204 +++++++++++++++++++++ 4 files changed, 252 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,pvs.txt create mode 100644 drivers/cpufreq/qcom-cpufreq.c
Quoted 4 lines
This must be done differently as we have enhanced OPP core to support such hardware. Look at:
dev_pm_opp_set_prop_name()and the binding around it (opp-microvolt-<name>). Talk to Stephen, he was part of all those discussions.
Thanks. Using opp-microvolt-<name> and setting the right name extension(dev_pm_opp_set_prop_name) after reading the version from efuse, makes it to work with proper opp-v2 bindings. Will repost with the updates. Also with opp-v2, just not having opp-shared property is enough to scale the cpu independently. As you have Nacked the other patch (correctly), will drop that patch to reintroduce the platform data. Testing this on ipq8064. Will check with Stephen once to make sure changes hold good for rest of the krait cores as well.
Regards,
Sricharan
Signature · 5 lines
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Re: [PATCH v4 12/12] cpufreq: dt: Reintroduce independent_clocks platform data
In reply to Viresh KumarHi Viresh,
Quoted 8 lines · Viresh Kumar
Quoted 7 lines · Sricharan R
The Platform data was removed earlier by, 'commit
eb96924acddc("cpufreq: dt: Kill platform-data")' since there were no users at that time.
Now this is required when the each of the cpu clocks can be scaled independently, which is the case for krait cores. So reintroduce it.
Quoted 9 lines
Quoted 5 lines
Signed-off-by Sricharan R <[email protected]>--- drivers/cpufreq/cpufreq-dt.c | 7 ++++++- drivers/cpufreq/cpufreq-dt.h | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-)Nack. This information should come from the OPP layer (Hint:
dev_pm_opp_of_get_sharing_cpus()).
Thanks. Understand. As replied on the other patch, after using dev_pm_opp_set_prop_name and opp-v2 bindings, this patch is no more required.
Regards,
Sricharan
Signature · 5 lines
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Rob Herring
maintainerRe: [PATCH v4 04/12] clk: qcom: Add HFPLL driver
In reply to Sricharan RQuoted 24 lines · Sricharan R
From: Stephen Boyd <[email protected]>
On some devices (MSM8974 for example), the HFPLLs are instantiated within the Krait processor subsystem as separate register regions. Add a driver for these PLLs so that we can provide HFPLL clocks for use by the system.
Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- .../devicetree/bindings/clock/qcom,hfpll.txt | 40 ++++++++ drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/hfpll.c | 106 +++++++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,hfpll.txt create mode 100644 drivers/clk/qcom/hfpll.cDocumentation/devicetree/bindings/clock/qcom,hfpll.txt new file +0
-0
Documentation/devicetree/bindings/clock/qcom,hfpll.txt line 8
Quoted 8 lines
Documentation/devicetree/bindings/clock/qcom,hfpll.txt new file +8
-0@@ -0,0 +1,40 @@ +High-Frequency PLL (HFPLL) + +PROPERTIES + +- compatible: + Usage: required + Value type: <string> + Definition: must be "qcom,hfpll"
Fine for a fallback, but please add SoC specific compatibles.
Quoted 63 lines
Documentation/devicetree/bindings/clock/qcom,hfpll.txt new file +32
-0+ +- reg: + Usage: required + Value type: <prop-encoded-array> + Definition: address and size of HPLL registers. An optional second + element specifies the address and size of the alias + register region. + +- clock-output-names: + Usage: required + Value type: <string> + Definition: Name of the PLL. Typically hfpllX where X is a CPU number + starting at 0. Otherwise hfpll_Y where Y is more specific + such as "l2". + +Example: + +1) An HFPLL for the L2 cache. + + clock-controller at f9016000 { + compatible = "qcom,hfpll"; + reg = <0xf9016000 0x30>; + clock-output-names = "hfpll_l2"; + }; + +2) An HFPLL for CPU0. This HFPLL has the alias register region. + + clock-controller at f908a000 { + compatible = "qcom,hfpll"; + reg = <0xf908a000 0x30>, <0xf900a000 0x30>; + clock-output-names = "hfpll0"; + };drivers/clk/qcom/Kconfig +8
-0@@ -205,3 +205,11 @@ 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. + +config QCOM_HFPLL + tristate "High-Frequency PLL (HFPLL) Clock Controller" + depends on COMMON_CLK_QCOM + help + Support for the high-frequency PLLs present on Qualcomm devices. + Say Y if you want to support CPU frequency scaling on devices + such as MSM8974, APQ8084, etc.drivers/clk/qcom/Makefile +1
-0@@ -36,3 +36,4 @@ obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o +obj-$(CONFIG_QCOM_HFPLL) += hfpll.odrivers/clk/qcom/hfpll.c new file +0
-0
drivers/clk/qcom/hfpll.c line 2
Quoted 2 lines
drivers/clk/qcom/hfpll.c new file +2
-0@@ -0,0 +1,106 @@ +/* +* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
It's 2017.
drivers/clk/qcom/hfpll.c line 11
Quoted 9 lines
drivers/clk/qcom/hfpll.c new file +9
-0+* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details.
Use SPDX tags.
Rob
Re: [PATCH v4 05/12] clk: qcom: Add MSM8960/APQ8064's HFPLLs
In reply to Sricharan RQuoted 8 lines · Sricharan R
From: Stephen Boyd <[email protected]>
Describe the HFPLLs present on MSM8960 and APQ8064 devices.
Signed-off-by Stephen Boyd <[email protected]>--- drivers/clk/qcom/gcc-msm8960.c | 172 +++++++++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-msm8960.h | 2 +
For the binding,
Quoted 1 line
2 files changed, 174 insertions(+)
Rob Herring
maintainerRe: [PATCH v4 08/12] clk: qcom: Add KPSS ACC/GCC driver
In reply to Sricharan RQuoted 7 lines · Sricharan R
From: Stephen Boyd <[email protected]>
The ACC and GCC regions present in KPSSv1 contain registers to control clocks and power to each Krait CPU and L2. For CPUfreq purposes probe these devices and expose a mux clock that chooses between PXO and PLL8.
Quoted 5 lines
Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- .../devicetree/bindings/arm/msm/qcom,kpss-acc.txt | 7 ++ .../devicetree/bindings/arm/msm/qcom,kpss-gcc.txt | 28 +++++++
Please make bindings a separate patch.
Quoted 35 lines
drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/kpss-xcc.c | 96 ++++++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt create mode 100644 drivers/clk/qcom/kpss-xcc.cDocumentation/devicetree/bindings/arm/msm/qcom,kpss-acc.txt +7
-0@@ -21,10 +21,17 @@ PROPERTIES the register region. An optional second element specifies the base address and size of the alias register region. +- clock-output-names: + Usage: optional + Value type: <string> + Definition: Name of the output clock. Typically acpuX_aux where X is a + CPU number starting at 0. + Example: clock-controller at 2088000 { compatible = "qcom,kpss-acc-v2"; reg = <0x02088000 0x1000>, <0x02008000 0x1000>; + clock-output-names = "acpu0_aux"; };Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt new file +0
-0
Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt line 9
Quoted 9 lines
Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt new file +9
-0@@ -0,0 +1,28 @@ +Krait Processor Sub-system (KPSS) Global Clock Controller (GCC) + +PROPERTIES + +- compatible: + Usage: required + Value type: <string> + Definition: should be one of: + "qcom,kpss-gcc"
Only one implementation?
Quoted 19 lines
Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt new file +19
-0+ +- reg: + Usage: required + Value type: <prop-encoded-array> + Definition: base address and size of the register region + +- clock-output-names: + Usage: required + Value type: <string> + Definition: Name of the output clock. Typically acpu_l2_aux indicating + an L2 cache auxiliary clock. + +Example: + + l2cc: clock-controller at 2011000 { + compatible = "qcom,kpss-gcc"; + reg = <0x2011000 0x1000>; + clock-output-names = "acpu_l2_aux"; + };
Rob Herring
maintainerRe: [PATCH v4 09/12] clk: qcom: Add Krait clock controller driver
In reply to Sricharan RQuoted 8 lines · Sricharan R
From: Stephen Boyd <[email protected]>
The Krait CPU clocks are made up of a primary mux and secondary mux for each CPU and the L2, controlled via cp15 accessors. For Kraits within KPSSv1 each secondary mux accepts a different aux source, but on KPSSv2 each secondary mux accepts the same aux source.
Quoted 4 lines
Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- .../devicetree/bindings/clock/qcom,krait-cc.txt | 22 ++
Please make bindings a separate patch.
Quoted 6 lines
drivers/clk/qcom/Kconfig | 8 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/krait-cc.c | 350 +++++++++++++++++++++ 4 files changed, 381 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,krait-cc.txt create mode 100644 drivers/clk/qcom/krait-cc.c
Re: [PATCH v4 04/12] clk: qcom: Add HFPLL driver
In reply to Rob HerringHi Rob,
Thanks for the review.
Quoted 19 lines · Rob Herring
Quoted 18 lines · Sricharan R
From: Stephen Boyd <[email protected]>
On some devices (MSM8974 for example), the HFPLLs are instantiated within the Krait processor subsystem as separate register regions. Add a driver for these PLLs so that we can provide HFPLL clocks for use by the system.
Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- .../devicetree/bindings/clock/qcom,hfpll.txt | 40 ++++++++ drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/hfpll.c | 106 +++++++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,hfpll.txt create mode 100644 drivers/clk/qcom/hfpll.c
Quoted 17 lines
Quoted 6 lines
Documentation/devicetree/bindings/clock/qcom,hfpll.txt new file +0
-0Documentation/devicetree/bindings/clock/qcom,hfpll.txt line 8
Quoted 8 lines
Documentation/devicetree/bindings/clock/qcom,hfpll.txt new file +8
-0@@ -0,0 +1,40 @@ +High-Frequency PLL (HFPLL) + +PROPERTIES + +- compatible: + Usage: required + Value type: <string> + Definition: must be "qcom,hfpll"Fine for a fallback, but please add SoC specific compatibles.
sure, will all add them.
Quoted 59 lines
Quoted 59 lines
Documentation/devicetree/bindings/clock/qcom,hfpll.txt new file +32
-0+ +- reg: + Usage: required + Value type: <prop-encoded-array> + Definition: address and size of HPLL registers. An optional second + element specifies the address and size of the alias + register region. + +- clock-output-names: + Usage: required + Value type: <string> + Definition: Name of the PLL. Typically hfpllX where X is a CPU number + starting at 0. Otherwise hfpll_Y where Y is more specific + such as "l2". + +Example: + +1) An HFPLL for the L2 cache. + + clock-controller at f9016000 { + compatible = "qcom,hfpll"; + reg = <0xf9016000 0x30>; + clock-output-names = "hfpll_l2"; + }; + +2) An HFPLL for CPU0. This HFPLL has the alias register region. + + clock-controller at f908a000 { + compatible = "qcom,hfpll"; + reg = <0xf908a000 0x30>, <0xf900a000 0x30>; + clock-output-names = "hfpll0"; + };drivers/clk/qcom/Kconfig +8
-0@@ -205,3 +205,11 @@ 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. + +config QCOM_HFPLL + tristate "High-Frequency PLL (HFPLL) Clock Controller" + depends on COMMON_CLK_QCOM + help + Support for the high-frequency PLLs present on Qualcomm devices. + Say Y if you want to support CPU frequency scaling on devices + such as MSM8974, APQ8084, etc.drivers/clk/qcom/Makefile +1
-0@@ -36,3 +36,4 @@ obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o +obj-$(CONFIG_QCOM_HFPLL) += hfpll.odrivers/clk/qcom/hfpll.c new file +0
-0
Quoted 9 lines
drivers/clk/qcom/hfpll.c line 2
Quoted 6 lines
index 0000000..7405bb6
drivers/clk/qcom/hfpll.c new file +2
-0@@ -0,0 +1,106 @@ +/* +* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. It's 2017.
ok.
Quoted 10 lines
drivers/clk/qcom/hfpll.c line 11
Quoted 9 lines
drivers/clk/qcom/hfpll.c new file +9
-0+* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details.
Quoted 2 lines
Use SPDX tags.
ok.
Regards,
Sricharan
Signature · 5 lines
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Re: [PATCH v4 05/12] clk: qcom: Add MSM8960/APQ8064's HFPLLs
In reply to Rob HerringHi Rob,
Quoted 5 lines · Rob Herring
Quoted 4 lines · Sricharan R
From: Stephen Boyd <[email protected]>
Describe the HFPLLs present on MSM8960 and APQ8064 devices.
Quoted 9 lines
Quoted 4 lines
Signed-off-by Stephen Boyd <[email protected]>--- drivers/clk/qcom/gcc-msm8960.c | 172 +++++++++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-msm8960.h | 2 +For the binding,
Acked-by Rob Herring <[email protected]>
Thanks.
Regards,
Sricharan
Signature · 5 lines
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Re: [PATCH v4 09/12] clk: qcom: Add Krait clock controller driver
In reply to Rob HerringHi Rob,
Quoted 9 lines · Rob Herring
Quoted 8 lines · Sricharan R
From: Stephen Boyd <[email protected]>
The Krait CPU clocks are made up of a primary mux and secondary mux for each CPU and the L2, controlled via cp15 accessors. For Kraits within KPSSv1 each secondary mux accepts a different aux source, but on KPSSv2 each secondary mux accepts the same aux source.
Quoted 7 lines
Quoted 4 lines
Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- .../devicetree/bindings/clock/qcom,krait-cc.txt | 22 ++Please make bindings a separate patch.
ok.
Regards,
Sricharan
Signature · 5 lines
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Re: [PATCH v4 08/12] clk: qcom: Add KPSS ACC/GCC driver
In reply to Rob HerringHi Rob,
Quoted 8 lines · Rob Herring
Quoted 7 lines · Sricharan R
From: Stephen Boyd <[email protected]>
The ACC and GCC regions present in KPSSv1 contain registers to control clocks and power to each Krait CPU and L2. For CPUfreq purposes probe these devices and expose a mux clock that chooses between PXO and PLL8.
Quoted 7 lines
Quoted 5 lines
Cc <[email protected]>Signed-off-by Stephen Boyd <[email protected]>--- .../devicetree/bindings/arm/msm/qcom,kpss-acc.txt | 7 ++ .../devicetree/bindings/arm/msm/qcom,kpss-gcc.txt | 28 +++++++Please make bindings a separate patch.
ok.
Quoted 39 lines
Quoted 39 lines
drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/kpss-xcc.c | 96 ++++++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt create mode 100644 drivers/clk/qcom/kpss-xcc.cDocumentation/devicetree/bindings/arm/msm/qcom,kpss-acc.txt +7
-0@@ -21,10 +21,17 @@ PROPERTIES the register region. An optional second element specifies the base address and size of the alias register region. +- clock-output-names: + Usage: optional + Value type: <string> + Definition: Name of the output clock. Typically acpuX_aux where X is a + CPU number starting at 0. + Example: clock-controller at 2088000 { compatible = "qcom,kpss-acc-v2"; reg = <0x02088000 0x1000>, <0x02008000 0x1000>; + clock-output-names = "acpu0_aux"; };Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt new file +3
-0@@ -0,0 +1,28 @@ +Krait Processor Sub-system (KPSS) Global Clock Controller (GCC) + +PROPERTIES
Quoted 8 lines
Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt line 9
Quoted 6 lines
Documentation/devicetree/bindings/arm/msm/qcom,kpss-gcc.txt new file +6
-0+ +- compatible: + Usage: required + Value type: <string> + Definition: should be one of: + "qcom,kpss-gcc"Only one implementation?
hmm, missed "qcom,kpss-acc-v1", will add that too.
Regards,
Sricharan
Signature · 5 lines
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus