* [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC
@ 2017-10-13 11:59 Linus Walleij
2017-10-13 11:59 ` [PATCH 2/2 v3] clk: qcom: Implement RPM clocks for MSM8660/APQ8060 Linus Walleij
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Linus Walleij @ 2017-10-13 11:59 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, Linus Walleij, devicetree
These compatible strings need to be added to extend support
for the RPM CC to cover MSM8660/APQ8060. We also need to add
enumberators to the include file for a few clocks that were
missing.
Cc: devicetree@vger.kernel.org
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Move PLL4 last, and do not provide an enumerator for the
"active" variant, we don't do that on PLL4.
ChangeLog v1->v2:
- Collect Rob's ACK
---
Documentation/devicetree/bindings/clock/qcom,rpmcc.txt | 2 ++
include/dt-bindings/clock/qcom,rpmcc.h | 3 +++
2 files changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt b/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt
index 32c6e9ce64c3..833a89f06ae0 100644
--- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt
+++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.txt
@@ -10,6 +10,8 @@ Required properties :
- compatible : shall contain only one of the following. The generic
compatible "qcom,rpmcc" should be also included.
+ "qcom,rpmcc-msm8660", "qcom,rpmcc"
+ "qcom,rpmcc-apq8060", "qcom,rpmcc"
"qcom,rpmcc-msm8916", "qcom,rpmcc"
"qcom,rpmcc-msm8974", "qcom,rpmcc"
"qcom,rpmcc-apq8064", "qcom,rpmcc"
diff --git a/include/dt-bindings/clock/qcom,rpmcc.h b/include/dt-bindings/clock/qcom,rpmcc.h
index 96b63c00249e..29dad206a74b 100644
--- a/include/dt-bindings/clock/qcom,rpmcc.h
+++ b/include/dt-bindings/clock/qcom,rpmcc.h
@@ -37,6 +37,9 @@
#define RPM_SYS_FABRIC_A_CLK 19
#define RPM_SFPB_CLK 20
#define RPM_SFPB_A_CLK 21
+#define RPM_SMI_CLK 22
+#define RPM_SMI_A_CLK 23
+#define RPM_PLL4_CLK 24
/* SMD RPM clocks */
#define RPM_SMD_XO_CLK_SRC 0
--
2.13.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2 v3] clk: qcom: Implement RPM clocks for MSM8660/APQ8060
2017-10-13 11:59 [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC Linus Walleij
@ 2017-10-13 11:59 ` Linus Walleij
2017-10-30 14:21 ` Linus Walleij
2017-11-02 6:49 ` Stephen Boyd
2017-10-30 14:20 ` [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC Linus Walleij
2017-11-02 6:49 ` Stephen Boyd
2 siblings, 2 replies; 6+ messages in thread
From: Linus Walleij @ 2017-10-13 11:59 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, Linus Walleij
The RPM clocks were missing for MSM8660/APQ8060. For this to be
completed we need to add a special fixed rate RPM clock that is used
for the PLL4 on these SoCs. The rest of the clocks are pretty
similar to the other supported platforms.
The "active" clock pattern is mirrored in all the clocks. I guess
that the PLL4 that clocks the LPASS is actually never used as
"active only" since the low-power audio subsystem should be left
on when the CPU goes to idle, so that it can be used as a stand-alone
MP3 player type of device.
The PLL4 seems to be enabled only on behalf of the booting LPASS
Hexagon - which will cast its own vote once its booted - and as
such we only configure the active state (meaning both states will
have same configuration). The result is that PLL4 will be on
from prepare() to unprepare() regardless of what the application
CPU does.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Skip the "active" state on the special, fixed PLL4 clock, just
like the vendor tree does.
- Move defines around a bit in the sort order that Bjorn wants
them.
- Make the plain "pxo" parent of the fixed PLL4 clock, not
"pxo_board"
ChangeLog v1->v2:
- Add the small hunk to the clk_rpm_handoff() function that just
skip over this for the fixed PLL4 clock. This accidentally
ended up in another patch.
---
drivers/clk/qcom/clk-rpm.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 93 insertions(+)
diff --git a/drivers/clk/qcom/clk-rpm.c b/drivers/clk/qcom/clk-rpm.c
index df3e5fe8442a..c60f61b10c7f 100644
--- a/drivers/clk/qcom/clk-rpm.c
+++ b/drivers/clk/qcom/clk-rpm.c
@@ -56,6 +56,18 @@
}, \
}
+#define DEFINE_CLK_RPM_FIXED(_platform, _name, _active, r_id, r) \
+ static struct clk_rpm _platform##_##_name = { \
+ .rpm_clk_id = (r_id), \
+ .rate = (r), \
+ .hw.init = &(struct clk_init_data){ \
+ .ops = &clk_rpm_fixed_ops, \
+ .name = #_name, \
+ .parent_names = (const char *[]){ "pxo" }, \
+ .num_parents = 1, \
+ }, \
+ }
+
#define DEFINE_CLK_RPM_PXO_BRANCH(_platform, _name, _active, r_id, r) \
static struct clk_rpm _platform##_##_active; \
static struct clk_rpm _platform##_##_name = { \
@@ -143,6 +155,13 @@ static int clk_rpm_handoff(struct clk_rpm *r)
int ret;
u32 value = INT_MAX;
+ /*
+ * The vendor tree simply reads the status for this
+ * RPM clock.
+ */
+ if (r->rpm_clk_id == QCOM_RPM_PLL_4)
+ return 0;
+
ret = qcom_rpm_write(r->rpm, QCOM_RPM_ACTIVE_STATE,
r->rpm_clk_id, &value, 1);
if (ret)
@@ -269,6 +288,32 @@ static void clk_rpm_unprepare(struct clk_hw *hw)
mutex_unlock(&rpm_clk_lock);
}
+static int clk_rpm_fixed_prepare(struct clk_hw *hw)
+{
+ struct clk_rpm *r = to_clk_rpm(hw);
+ u32 value = 1;
+ int ret;
+
+ ret = qcom_rpm_write(r->rpm, QCOM_RPM_ACTIVE_STATE,
+ r->rpm_clk_id, &value, 1);
+ if (!ret)
+ r->enabled = true;
+
+ return ret;
+}
+
+static void clk_rpm_fixed_unprepare(struct clk_hw *hw)
+{
+ struct clk_rpm *r = to_clk_rpm(hw);
+ u32 value = 0;
+ int ret;
+
+ ret = qcom_rpm_write(r->rpm, QCOM_RPM_ACTIVE_STATE,
+ r->rpm_clk_id, &value, 1);
+ if (!ret)
+ r->enabled = false;
+}
+
static int clk_rpm_set_rate(struct clk_hw *hw,
unsigned long rate, unsigned long parent_rate)
{
@@ -333,6 +378,13 @@ static unsigned long clk_rpm_recalc_rate(struct clk_hw *hw,
return r->rate;
}
+static const struct clk_ops clk_rpm_fixed_ops = {
+ .prepare = clk_rpm_fixed_prepare,
+ .unprepare = clk_rpm_fixed_unprepare,
+ .round_rate = clk_rpm_round_rate,
+ .recalc_rate = clk_rpm_recalc_rate,
+};
+
static const struct clk_ops clk_rpm_ops = {
.prepare = clk_rpm_prepare,
.unprepare = clk_rpm_unprepare,
@@ -348,6 +400,45 @@ static const struct clk_ops clk_rpm_branch_ops = {
.recalc_rate = clk_rpm_recalc_rate,
};
+/* MSM8660/APQ8060 */
+DEFINE_CLK_RPM(msm8660, afab_clk, afab_a_clk, QCOM_RPM_APPS_FABRIC_CLK);
+DEFINE_CLK_RPM(msm8660, sfab_clk, sfab_a_clk, QCOM_RPM_SYS_FABRIC_CLK);
+DEFINE_CLK_RPM(msm8660, mmfab_clk, mmfab_a_clk, QCOM_RPM_MM_FABRIC_CLK);
+DEFINE_CLK_RPM(msm8660, daytona_clk, daytona_a_clk, QCOM_RPM_DAYTONA_FABRIC_CLK);
+DEFINE_CLK_RPM(msm8660, sfpb_clk, sfpb_a_clk, QCOM_RPM_SFPB_CLK);
+DEFINE_CLK_RPM(msm8660, cfpb_clk, cfpb_a_clk, QCOM_RPM_CFPB_CLK);
+DEFINE_CLK_RPM(msm8660, mmfpb_clk, mmfpb_a_clk, QCOM_RPM_MMFPB_CLK);
+DEFINE_CLK_RPM(msm8660, smi_clk, smi_a_clk, QCOM_RPM_SMI_CLK);
+DEFINE_CLK_RPM(msm8660, ebi1_clk, ebi1_a_clk, QCOM_RPM_EBI1_CLK);
+DEFINE_CLK_RPM_FIXED(msm8660, pll4_clk, pll4_a_clk, QCOM_RPM_PLL_4, 540672000);
+
+static struct clk_rpm *msm8660_clks[] = {
+ [RPM_APPS_FABRIC_CLK] = &msm8660_afab_clk,
+ [RPM_APPS_FABRIC_A_CLK] = &msm8660_afab_a_clk,
+ [RPM_SYS_FABRIC_CLK] = &msm8660_sfab_clk,
+ [RPM_SYS_FABRIC_A_CLK] = &msm8660_sfab_a_clk,
+ [RPM_MM_FABRIC_CLK] = &msm8660_mmfab_clk,
+ [RPM_MM_FABRIC_A_CLK] = &msm8660_mmfab_a_clk,
+ [RPM_DAYTONA_FABRIC_CLK] = &msm8660_daytona_clk,
+ [RPM_DAYTONA_FABRIC_A_CLK] = &msm8660_daytona_a_clk,
+ [RPM_SFPB_CLK] = &msm8660_sfpb_clk,
+ [RPM_SFPB_A_CLK] = &msm8660_sfpb_a_clk,
+ [RPM_CFPB_CLK] = &msm8660_cfpb_clk,
+ [RPM_CFPB_A_CLK] = &msm8660_cfpb_a_clk,
+ [RPM_MMFPB_CLK] = &msm8660_mmfpb_clk,
+ [RPM_MMFPB_A_CLK] = &msm8660_mmfpb_a_clk,
+ [RPM_SMI_CLK] = &msm8660_smi_clk,
+ [RPM_SMI_A_CLK] = &msm8660_smi_a_clk,
+ [RPM_EBI1_CLK] = &msm8660_ebi1_clk,
+ [RPM_EBI1_A_CLK] = &msm8660_ebi1_a_clk,
+ [RPM_PLL4_CLK] = &msm8660_pll4_clk,
+};
+
+static const struct rpm_clk_desc rpm_clk_msm8660 = {
+ .clks = msm8660_clks,
+ .num_clks = ARRAY_SIZE(msm8660_clks),
+};
+
/* apq8064 */
DEFINE_CLK_RPM(apq8064, afab_clk, afab_a_clk, QCOM_RPM_APPS_FABRIC_CLK);
DEFINE_CLK_RPM(apq8064, cfpb_clk, cfpb_a_clk, QCOM_RPM_CFPB_CLK);
@@ -386,6 +477,8 @@ static const struct rpm_clk_desc rpm_clk_apq8064 = {
};
static const struct of_device_id rpm_clk_match_table[] = {
+ { .compatible = "qcom,rpmcc-msm8660", .data = &rpm_clk_msm8660 },
+ { .compatible = "qcom,rpmcc-apq8060", .data = &rpm_clk_msm8660 },
{ .compatible = "qcom,rpmcc-apq8064", .data = &rpm_clk_apq8064 },
{ }
};
--
2.13.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC
2017-10-13 11:59 [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC Linus Walleij
2017-10-13 11:59 ` [PATCH 2/2 v3] clk: qcom: Implement RPM clocks for MSM8660/APQ8060 Linus Walleij
@ 2017-10-30 14:20 ` Linus Walleij
2017-11-02 6:49 ` Stephen Boyd
2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2017-10-30 14:20 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: linux-clk, Linus Walleij, devicetree@vger.kernel.org
On Fri, Oct 13, 2017 at 1:59 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> These compatible strings need to be added to extend support
> for the RPM CC to cover MSM8660/APQ8060. We also need to add
> enumberators to the include file for a few clocks that were
> missing.
>
> Cc: devicetree@vger.kernel.org
> Acked-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v2->v3:
> - Move PLL4 last, and do not provide an enumerator for the
> "active" variant, we don't do that on PLL4.
> ChangeLog v1->v2:
> - Collect Rob's ACK
Gentle ping on this patch.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2 v3] clk: qcom: Implement RPM clocks for MSM8660/APQ8060
2017-10-13 11:59 ` [PATCH 2/2 v3] clk: qcom: Implement RPM clocks for MSM8660/APQ8060 Linus Walleij
@ 2017-10-30 14:21 ` Linus Walleij
2017-11-02 6:49 ` Stephen Boyd
1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2017-10-30 14:21 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, Linus Walleij
On Fri, Oct 13, 2017 at 1:59 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> The RPM clocks were missing for MSM8660/APQ8060. For this to be
> completed we need to add a special fixed rate RPM clock that is used
> for the PLL4 on these SoCs. The rest of the clocks are pretty
> similar to the other supported platforms.
>
> The "active" clock pattern is mirrored in all the clocks. I guess
> that the PLL4 that clocks the LPASS is actually never used as
> "active only" since the low-power audio subsystem should be left
> on when the CPU goes to idle, so that it can be used as a stand-alone
> MP3 player type of device.
>
> The PLL4 seems to be enabled only on behalf of the booting LPASS
> Hexagon - which will cast its own vote once its booted - and as
> such we only configure the active state (meaning both states will
> have same configuration). The result is that PLL4 will be on
> from prepare() to unprepare() regardless of what the application
> CPU does.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v2->v3:
> - Skip the "active" state on the special, fixed PLL4 clock, just
> like the vendor tree does.
> - Move defines around a bit in the sort order that Bjorn wants
> them.
> - Make the plain "pxo" parent of the fixed PLL4 clock, not
> "pxo_board"
> ChangeLog v1->v2:
> - Add the small hunk to the clk_rpm_handoff() function that just
> skip over this for the fixed PLL4 clock. This accidentally
> ended up in another patch.
Gentle ping on this patch.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC
2017-10-13 11:59 [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC Linus Walleij
2017-10-13 11:59 ` [PATCH 2/2 v3] clk: qcom: Implement RPM clocks for MSM8660/APQ8060 Linus Walleij
2017-10-30 14:20 ` [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC Linus Walleij
@ 2017-11-02 6:49 ` Stephen Boyd
2 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2017-11-02 6:49 UTC (permalink / raw)
To: Linus Walleij; +Cc: Michael Turquette, linux-clk, devicetree
On 10/13, Linus Walleij wrote:
> These compatible strings need to be added to extend support
> for the RPM CC to cover MSM8660/APQ8060. We also need to add
> enumberators to the include file for a few clocks that were
> missing.
>
> Cc: devicetree@vger.kernel.org
> Acked-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
Applied to clk-next
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2 v3] clk: qcom: Implement RPM clocks for MSM8660/APQ8060
2017-10-13 11:59 ` [PATCH 2/2 v3] clk: qcom: Implement RPM clocks for MSM8660/APQ8060 Linus Walleij
2017-10-30 14:21 ` Linus Walleij
@ 2017-11-02 6:49 ` Stephen Boyd
1 sibling, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2017-11-02 6:49 UTC (permalink / raw)
To: Linus Walleij; +Cc: Michael Turquette, linux-clk
On 10/13, Linus Walleij wrote:
> The RPM clocks were missing for MSM8660/APQ8060. For this to be
> completed we need to add a special fixed rate RPM clock that is used
> for the PLL4 on these SoCs. The rest of the clocks are pretty
> similar to the other supported platforms.
>
> The "active" clock pattern is mirrored in all the clocks. I guess
> that the PLL4 that clocks the LPASS is actually never used as
> "active only" since the low-power audio subsystem should be left
> on when the CPU goes to idle, so that it can be used as a stand-alone
> MP3 player type of device.
>
> The PLL4 seems to be enabled only on behalf of the booting LPASS
> Hexagon - which will cast its own vote once its booted - and as
> such we only configure the active state (meaning both states will
> have same configuration). The result is that PLL4 will be on
> from prepare() to unprepare() regardless of what the application
> CPU does.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
Applied to clk-next
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-02 6:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13 11:59 [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC Linus Walleij
2017-10-13 11:59 ` [PATCH 2/2 v3] clk: qcom: Implement RPM clocks for MSM8660/APQ8060 Linus Walleij
2017-10-30 14:21 ` Linus Walleij
2017-11-02 6:49 ` Stephen Boyd
2017-10-30 14:20 ` [PATCH 1/2 v3] clk: qcom: Update DT bindings for the MSM8660/APQ8060 RPMCC Linus Walleij
2017-11-02 6:49 ` 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).