Skip to contentSkip to conversation

clk: mediatek: Export CPU mux clocks for CPU frequency control

PATCH Superseded Pi-Cheng Chen 4 participants 9 messages Sep 14, 2015 – Feb 12, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 clk: mediatek: Export CPU mux clocks for CPU frequency control

From: "pi-cheng.chen" <[email protected]>

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver for intermediate clock source switching.

---
Changes in v6:
- Relace __clk_get_num_parents with clk_hw_get_num_parents to reflect API change

Changes in v5:
- Replace __initdata with __initconst to fix compiling error

Changes in v4:
- Fix some minor issues for v3
- Rebase to the patch that adds 13mhz clock for MT8173[1]

Changes in v3:
- Rebase to 4.2-rc1
- Fix some issues of v2

Changes in v2:
- Remove use of .determine_rate callback

---
 drivers/clk/mediatek/Makefile          |   2 +-
 drivers/clk/mediatek/clk-cpumux.c      | 127 +++++++++++++++++++++++++++++++++
 drivers/clk/mediatek/clk-cpumux.h      |  22 ++++++
 drivers/clk/mediatek/clk-mt8173.c      |  23 ++++++
 include/dt-bindings/clock/mt8173-clk.h |   4 +-
 5 files changed, 176 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-cpumux.c
 create mode 100644 drivers/clk/mediatek/clk-cpumux.h
drivers/clk/mediatek/Makefile +1 -1
index 8e4b2a4..299917a 100644
@@ -1,4 +1,4 @@
-obj-y += clk-mtk.o clk-pll.o clk-gate.o
+obj-y += clk-mtk.o clk-pll.o clk-gate.o clk-cpumux.o
 obj-$(CONFIG_RESET_CONTROLLER) += reset.o
 obj-y += clk-mt8135.o
 obj-y += clk-mt8173.o
drivers/clk/mediatek/clk-cpumux.c new file +127 -0

127 lines not on this page · raw message

drivers/clk/mediatek/clk-cpumux.h new file +22 -0
new file mode 100644
index 0000000..52c769f
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2015 Linaro Ltd.
+ * Author: Pi-Cheng Chen <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License 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 __DRV_CLK_CPUMUX_H
+#define __DRV_CLK_CPUMUX_H
+
+int mtk_clk_register_cpumuxes(struct device_node *node,
+			      const struct mtk_composite *clks, int num,
+			      struct clk_onecell_data *clk_data);
+
+#endif /* __DRV_CLK_CPUMUX_H */
drivers/clk/mediatek/clk-mt8173.c +23 -0
index 9ea6aa1..b02d310 100644
@@ -20,6 +20,7 @@
 
 #include "clk-mtk.h"
 #include "clk-gate.h"
+#include "clk-cpumux.h"
 
 #include <dt-bindings/clock/mt8173-clk.h>
 
@@ -518,6 +519,25 @@ static const char * const i2s3_b_ck_parents[] __initconst = {
 	"apll2_div5"
 };
 
+static const char * const ca53_parents[] __initconst = {
+	"clk26m",
+	"armca7pll",
+	"mainpll",
+	"univpll"
+};
+
+static const char * const ca57_parents[] __initconst = {
+	"clk26m",
+	"armca15pll",
+	"mainpll",
+	"univpll"
+};
+
+static const struct mtk_composite cpu_muxes[] __initconst = {
+	MUX(CLK_INFRA_CA53SEL, "infra_ca53_sel", ca53_parents, 0x0000, 0, 2),
+	MUX(CLK_INFRA_CA57SEL, "infra_ca57_sel", ca57_parents, 0x0000, 2, 2),
+};
+
 static const struct mtk_composite top_muxes[] __initconst = {
 	/* CLK_CFG_0 */
 	MUX(CLK_TOP_AXI_SEL, "axi_sel", axi_parents, 0x0040, 0, 3),
@@ -760,6 +780,9 @@ static void __init mtk_infrasys_init(struct device_node *node)
 						clk_data);
 	mtk_clk_register_factors(infra_divs, ARRAY_SIZE(infra_divs), clk_data);
 
+	mtk_clk_register_cpumuxes(node, cpu_muxes, ARRAY_SIZE(cpu_muxes),
+						clk_data);
+
 	r = of_clk_add_provider(node, of_clk_src_onecell_get, clk_data);
 	if (r)
 		pr_err("%s(): could not register clock provider: %d\n",
include/dt-bindings/clock/mt8173-clk.h +3 -1
index fa2a2bb..a17cbaa 100644
@@ -188,7 +188,9 @@
 #define CLK_INFRA_PMICSPI		10
 #define CLK_INFRA_PMICWRAP		11
 #define CLK_INFRA_CLK_13M		12
-#define CLK_INFRA_NR_CLK		13
+#define CLK_INFRA_CA53SEL		13
+#define CLK_INFRA_CA57SEL		14
+#define CLK_INFRA_NR_CLK		15
 
 /* PERI_SYS */
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH v6 1/1 clk: mediatek: Export CPU mux clocks for CPU frequency control

Hi Pi-Cheng and Michael,

Quoted 4 lines · Pi-Cheng Chen

From: "pi-cheng.chen" <[email protected]>

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver for intermediate clock source switching.

It looks like this patch was never picked up.
It is required for MT8173 cpufreq.

What is the plan to get this one merged?

-Dan

Quoted 29 lines

---
Changes in v6:
- Relace __clk_get_num_parents with clk_hw_get_num_parents to reflect API change

Changes in v5:
- Replace __initdata with __initconst to fix compiling error

Changes in v4:
- Fix some minor issues for v3
- Rebase to the patch that adds 13mhz clock for MT8173[1]

Changes in v3:
- Rebase to 4.2-rc1
- Fix some issues of v2

Changes in v2:
- Remove use of .determine_rate callback

---
 drivers/clk/mediatek/Makefile          |   2 +-
 drivers/clk/mediatek/clk-cpumux.c      | 127 +++++++++++++++++++++++++++++++++
 drivers/clk/mediatek/clk-cpumux.h      |  22 ++++++
 drivers/clk/mediatek/clk-mt8173.c      |  23 ++++++
 include/dt-bindings/clock/mt8173-clk.h |   4 +-
 5 files changed, 176 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-cpumux.c
 create mode 100644 drivers/clk/mediatek/clk-cpumux.h

[snip]

#2 lore raw

PATCH v6 1/1 clk: mediatek: Export CPU mux clocks for CPU frequency control

Quoted 5 lines · Daniel Kurtz

Hi Pi-Cheng and Michael,

Quoted 2 lines · Pi-Cheng Chen

From: "pi-cheng.chen" <[email protected]>

Quoted 7 lines
Quoted 2 lines

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver for intermediate clock source switching.

It looks like this patch was never picked up.
It is required for MT8173 cpufreq.

What is the plan to get this one merged?

Hi Dan,
Mike is working on a new CCF feature called "coordinated clock rate changes" which would help to migrate mt8173-cpufreq driver to generic cpufreq-dt driver, and I am working with him to port MT8173 clock driver on the new feature. So I think that's why this patch was not picked since it will be migrated to new implementation once the new feature's ready.

@Mike:
Are you plannig to post those patches on the mailing list ? Or is it fine for you to take this first and then I will refine it for the new feature later?

Best Regards,
Pi-Cheng

Quoted 34 lines

-Dan

Quoted 29 lines

---
Changes in v6:
- Relace __clk_get_num_parents with clk_hw_get_num_parents to reflect API change

Changes in v5:
- Replace __initdata with __initconst to fix compiling error

Changes in v4:
- Fix some minor issues for v3
- Rebase to the patch that adds 13mhz clock for MT8173[1]

Changes in v3:
- Rebase to 4.2-rc1
- Fix some issues of v2

Changes in v2:
- Remove use of .determine_rate callback

---
 drivers/clk/mediatek/Makefile          |   2 +-
 drivers/clk/mediatek/clk-cpumux.c      | 127 +++++++++++++++++++++++++++++++++
 drivers/clk/mediatek/clk-cpumux.h      |  22 ++++++
 drivers/clk/mediatek/clk-mt8173.c      |  23 ++++++
 include/dt-bindings/clock/mt8173-clk.h |   4 +-
 5 files changed, 176 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-cpumux.c
 create mode 100644 drivers/clk/mediatek/clk-cpumux.h

[snip]

#3 lore raw

PATCH v6 1/1 clk: mediatek: Export CPU mux clocks for CPU frequency control

Quoted 21 lines · Pi-Cheng Chen
Quoted 5 lines · Daniel Kurtz

Hi Pi-Cheng and Michael,

Quoted 2 lines · Pi-Cheng Chen

From: "pi-cheng.chen" <[email protected]>

Quoted 7 lines
Quoted 2 lines

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver for intermediate clock source switching.

It looks like this patch was never picked up.
It is required for MT8173 cpufreq.

What is the plan to get this one merged?

Hi Dan,
Mike is working on a new CCF feature called "coordinated clock rate changes" which would help to migrate mt8173-cpufreq driver to generic cpufreq-dt driver, and I am working with him to port MT8173 clock driver on the new feature. So I think that's why this patch was not picked since it will be migrated to new implementation once the new feature's ready.

Quoted 4 lines

@Mike:
Are you plannig to post those patches on the mailing list ? Or is it fine for you to take this first and then I will refine it for the new feature later?

I plan to post those patches next week.

Thanks,
Mike

Quoted 38 lines

Best Regards,
Pi-Cheng

Quoted 34 lines

-Dan

Quoted 29 lines

---
Changes in v6:
- Relace __clk_get_num_parents with clk_hw_get_num_parents to reflect API change

Changes in v5:
- Replace __initdata with __initconst to fix compiling error

Changes in v4:
- Fix some minor issues for v3
- Rebase to the patch that adds 13mhz clock for MT8173[1]

Changes in v3:
- Rebase to 4.2-rc1
- Fix some issues of v2

Changes in v2:
- Remove use of .determine_rate callback

---
 drivers/clk/mediatek/Makefile          |   2 +-
 drivers/clk/mediatek/clk-cpumux.c      | 127 +++++++++++++++++++++++++++++++++
 drivers/clk/mediatek/clk-cpumux.h      |  22 ++++++
 drivers/clk/mediatek/clk-mt8173.c      |  23 ++++++
 include/dt-bindings/clock/mt8173-clk.h |   4 +-
 5 files changed, 176 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clk/mediatek/clk-cpumux.c
 create mode 100644 drivers/clk/mediatek/clk-cpumux.h

[snip]

#4 lore raw

PATCH v6 1/1 clk: mediatek: Export CPU mux clocks for CPU frequency control

Hi Michael, Pi-Cheng,

Quoted 23 lines · Michael Turquette
Quoted 21 lines · Pi-Cheng Chen
Quoted 5 lines · Daniel Kurtz

Hi Pi-Cheng and Michael,

Quoted 2 lines · Pi-Cheng Chen

From: "pi-cheng.chen" <[email protected]>

Quoted 7 lines
Quoted 2 lines

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver for intermediate clock source switching.

It looks like this patch was never picked up.
It is required for MT8173 cpufreq.

What is the plan to get this one merged?

Hi Dan,
Mike is working on a new CCF feature called "coordinated clock rate changes" which would help to migrate mt8173-cpufreq driver to generic cpufreq-dt driver, and I am working with him to port MT8173 clock driver on the new feature. So I think that's why this patch was not picked since it will be migrated to new implementation once the new feature's ready.

Quoted 6 lines
Quoted 4 lines

@Mike:
Are you plannig to post those patches on the mailing list ? Or is it fine for you to take this first and then I will refine it for the new feature later?

I plan to post those patches next week.

Were these patches ever posted?
Or should we consider going ahead and trying to merge this 4-month old MTK CPU mux clock patch into v4.5 before it is too late?

Thanks,
-Dan

maintainer
#5 lore raw

PATCH v6 1/1 clk: mediatek: Export CPU mux clocks for CPU frequency control

Quoted 32 lines · Daniel Kurtz

Hi Michael, Pi-Cheng,

Quoted 28 lines · Michael Turquette
Quoted 25 lines · Pi-Cheng Chen
Quoted 5 lines · Daniel Kurtz

Hi Pi-Cheng and Michael,

Quoted 2 lines · Pi-Cheng Chen

From: "pi-cheng.chen" <[email protected]>

Quoted 7 lines
Quoted 2 lines

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver for intermediate clock source switching.

It looks like this patch was never picked up.
It is required for MT8173 cpufreq.

What is the plan to get this one merged?

Hi Dan,
Mike is working on a new CCF feature called "coordinated clock rate changes" which would help to migrate mt8173-cpufreq driver to generic cpufreq-dt driver, and I am working with him to port MT8173 clock driver on the new feature. So I think that's why this patch was not picked since it will be migrated to new implementation once the new feature's ready.

@Mike:
Are you plannig to post those patches on the mailing list ? Or is it fine for you to take this first and then I will refine it for the new feature later?

Quoted 6 lines
Quoted 1 line

I plan to post those patches next week.

Were these patches ever posted?
Or should we consider going ahead and trying to merge this 4-month old MTK CPU mux clock patch into v4.5 before it is too late?

It's already too late for v4.5. The -rc are mostly bug fixes and new features get merged after the official v4.5 release. They will show up in v4.6-rc1

#6 lore raw

PATCH v6 1/1 clk: mediatek: Export CPU mux clocks for CPU frequency control

Quoted 50 lines · Matthias Brugger
Quoted 47 lines · Daniel Kurtz

Hi Michael, Pi-Cheng,

Quoted 40 lines · Michael Turquette
Quoted 30 lines · Pi-Cheng Chen
Quoted 13 lines · Daniel Kurtz

Hi Pi-Cheng and Michael,

Quoted 6 lines · Pi-Cheng Chen

From: "pi-cheng.chen" <[email protected]>

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver
for intermediate clock source switching.

Quoted 4 lines

It looks like this patch was never picked up.
It is required for MT8173 cpufreq.

What is the plan to get this one merged?

Hi Dan,
Mike is working on a new CCF feature called "coordinated clock rate changes"
which would help to migrate mt8173-cpufreq driver to generic cpufreq-dt driver, and I am working with him to port MT8173 clock driver on the new feature. So I think that's why this patch was not picked since it will be migrated to new implementation once the new feature's ready.

Quoted 4 lines

@Mike:
Are you plannig to post those patches on the mailing list ? Or is it fine for you to take this first and then I will refine it for the new feature later?

I plan to post those patches next week.

Quoted 8 lines
Quoted 4 lines

Were these patches ever posted?
Or should we consider going ahead and trying to merge this 4-month old MTK CPU mux clock patch into v4.5 before it is too late?

It's already too late for v4.5. The -rc are mostly bug fixes and new features get merged after the official v4.5 release. They will show up in v4.6-rc1

Which will show up in v4.6-rc1? MediaTek's CPU mux clocks, or Mike's "coordinated clock rate changes"?

#7 lore raw

PATCH v6 1/1 clk: mediatek: Export CPU mux clocks for CPU frequency control

In reply to Michael Turquette

Hi Mike, Pi-Cheng,

Quoted 22 lines · Michael Turquette
Quoted 21 lines · Pi-Cheng Chen
Quoted 5 lines · Daniel Kurtz

Hi Pi-Cheng and Michael,

Quoted 2 lines · Pi-Cheng Chen

From: "pi-cheng.chen" <[email protected]>

Quoted 7 lines
Quoted 2 lines

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver for intermediate clock source switching.

It looks like this patch was never picked up.
It is required for MT8173 cpufreq.

What is the plan to get this one merged?

Hi Dan,
Mike is working on a new CCF feature called "coordinated clock rate changes" which would help to migrate mt8173-cpufreq driver to generic cpufreq-dt driver, and I am working with him to port MT8173 clock driver on the new feature. So I think that's why this patch was not picked since it will be migrated to new implementation once the new feature's ready.

Quoted 6 lines
Quoted 4 lines

@Mike:
Are you plannig to post those patches on the mailing list ? Or is it fine for you to take this first and then I will refine it for the new feature later?

I plan to post those patches next week.

Were these patches ever posted?
I'm not really sure what patch set I am looking for.

Thanks,
-Dan

#8 lore raw

PATCH v6 1/1 clk: mediatek: Export CPU mux clocks for CPU frequency control

Hi Mike, Pi-Cheng, Matthias,

Quoted 31 lines · Daniel Kurtz

Hi Mike, Pi-Cheng,

Quoted 27 lines · Michael Turquette
Quoted 25 lines · Pi-Cheng Chen
Quoted 5 lines · Daniel Kurtz

Hi Pi-Cheng and Michael,

Quoted 2 lines · Pi-Cheng Chen

From: "pi-cheng.chen" <[email protected]>

Quoted 7 lines
Quoted 2 lines

This patch adds CPU mux clocks which are used by Mediatek cpufreq driver for intermediate clock source switching.

It looks like this patch was never picked up.
It is required for MT8173 cpufreq.

What is the plan to get this one merged?

Hi Dan,
Mike is working on a new CCF feature called "coordinated clock rate changes" which would help to migrate mt8173-cpufreq driver to generic cpufreq-dt driver, and I am working with him to port MT8173 clock driver on the new feature. So I think that's why this patch was not picked since it will be migrated to new implementation once the new feature's ready.

@Mike:
Are you plannig to post those patches on the mailing list ? Or is it fine for you to take this first and then I will refine it for the new feature later?

Quoted 4 lines
Quoted 1 line

I plan to post those patches next week.

Were these patches ever posted?
I'm not really sure what patch set I am looking for.

Another friendly (+1 year) ping on the status of the "coordinated clock rate changes" patches that were a prerequisite to finally finish merging the complete Mediatek MT8173 cpufreq implementation.

Thanks,
-Dan