Skip to contentSkip to conversation

clk: uniphier: add clock drivers for UniPhier SoCs

PATCH Superseded Masahiro Yamada 2 participants 4 messages Dec 28, 2015 – May 3, 2016

Subsystems (3)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 clk: uniphier: add clock drivers for UniPhier SoCs

This is the initial commit for the UniPhier clock drivers, including support for PH1-sLD3, PH1-LD4, PH1-Pro4, PH1-sLD8, PH1-Pro5, and ProXstream2/PH1-LD6b.

To improve the code maintainability, the driver consists of common functions (clk-uniphier-core.c) and clock data arrays needed to support each SoC.

---

Changes in v2:
- split emmc_hw_reset
- make SD clock rate-controllable
- add CLK_SET_RATE_PARENT flag to mux, gate, fixed-factor clocks

 MAINTAINERS                              |   1 +
 drivers/clk/Kconfig                      |   1 +
 drivers/clk/Makefile                     |   1 +
 drivers/clk/uniphier/Kconfig             |  35 ++++
 drivers/clk/uniphier/Makefile            |  10 +
 drivers/clk/uniphier/clk-ph1-ld4.c       | 117 ++++++++++++
 drivers/clk/uniphier/clk-ph1-pro4.c      | 117 ++++++++++++
 drivers/clk/uniphier/clk-ph1-pro5.c      | 107 +++++++++++
 drivers/clk/uniphier/clk-ph1-sld3.c      | 117 ++++++++++++
 drivers/clk/uniphier/clk-ph1-sld8.c      | 107 +++++++++++
 drivers/clk/uniphier/clk-proxstream2.c   |  88 +++++++++
 drivers/clk/uniphier/clk-uniphier-core.c | 151 +++++++++++++++
 drivers/clk/uniphier/clk-uniphier-mio.c  | 315 +++++++++++++++++++++++++++++++
 drivers/clk/uniphier/clk-uniphier-peri.c | 175 +++++++++++++++++
 drivers/clk/uniphier/clk-uniphier.h      |  68 +++++++
 15 files changed, 1410 insertions(+)
 create mode 100644 drivers/clk/uniphier/Kconfig
 create mode 100644 drivers/clk/uniphier/Makefile
 create mode 100644 drivers/clk/uniphier/clk-ph1-ld4.c
 create mode 100644 drivers/clk/uniphier/clk-ph1-pro4.c
 create mode 100644 drivers/clk/uniphier/clk-ph1-pro5.c
 create mode 100644 drivers/clk/uniphier/clk-ph1-sld3.c
 create mode 100644 drivers/clk/uniphier/clk-ph1-sld8.c
 create mode 100644 drivers/clk/uniphier/clk-proxstream2.c
 create mode 100644 drivers/clk/uniphier/clk-uniphier-core.c
 create mode 100644 drivers/clk/uniphier/clk-uniphier-mio.c
 create mode 100644 drivers/clk/uniphier/clk-uniphier-peri.c
 create mode 100644 drivers/clk/uniphier/clk-uniphier.h
MAINTAINERS +1 -0
index fc08493..6c10e9b 100644
@@ -1644,6 +1644,7 @@ F:	arch/arm/mach-uniphier/
 F:	arch/arm/mm/cache-uniphier.c
 F:	arch/arm64/boot/dts/socionext/
 F:	drivers/bus/uniphier-system-bus.c
+F:	drivers/clk/uniphier/
 F:	drivers/i2c/busses/i2c-uniphier*
 F:	drivers/pinctrl/uniphier/
 F:	drivers/tty/serial/8250/8250_uniphier.c
drivers/clk/Kconfig +1 -0
index c3e3a02..7580323 100644
@@ -191,6 +191,7 @@ config COMMON_CLK_CDCE706
 source "drivers/clk/bcm/Kconfig"
 source "drivers/clk/hisilicon/Kconfig"
 source "drivers/clk/qcom/Kconfig"
+source "drivers/clk/uniphier/Kconfig"
 
 endmenu
 
drivers/clk/Makefile +1 -0
index 820714c..ab9d1bd 100644
@@ -76,6 +76,7 @@ obj-$(CONFIG_ARCH_STI)			+= st/
 obj-$(CONFIG_ARCH_SUNXI)		+= sunxi/
 obj-$(CONFIG_ARCH_TEGRA)		+= tegra/
 obj-$(CONFIG_ARCH_OMAP2PLUS)		+= ti/
+obj-$(CONFIG_CLK_UNIPHIER)		+= uniphier/
 obj-$(CONFIG_ARCH_U8500)		+= ux500/
 obj-$(CONFIG_COMMON_CLK_VERSATILE)	+= versatile/
 obj-$(CONFIG_X86)			+= x86/
drivers/clk/uniphier/Kconfig new file +35 -0
new file mode 100644
index 0000000..7606f27
@@ -0,0 +1,35 @@
+menuconfig CLK_UNIPHIER
+	bool "Clock drivers for UniPhier SoCs"
+	depends on ARCH_UNIPHIER
+	depends on OF
+	default y
+	help
+	  Supports clock drivers for UniPhier SoCs.
+
+if CLK_UNIPHIER
+
+config CLK_UNIPHIER_PH1_SLD3
+	bool "Clock driver for UniPhier PH1-sLD3 SoC"
+	default y
+
+config CLK_UNIPHIER_PH1_LD4
+	bool "Clock driver for UniPhier PH1-LD4 SoC"
+	default y
+
+config CLK_UNIPHIER_PH1_PRO4
+	bool "Clock driver for UniPhier PH1-Pro4 SoC"
+	default y
+
+config CLK_UNIPHIER_PH1_SLD8
+	bool "Clock driver for UniPhier PH1-sLD8 SoC"
+	default y
+
+config CLK_UNIPHIER_PH1_PRO5
+	bool "Clock driver for UniPhier PH1-Pro5 SoC"
+	default y
+
+config CLK_UNIPHIER_PROXSTREAM2
+	bool "Clock driver for UniPhier ProXstream2/PH1-LD6b SoC"
+	default y
+
+endif
drivers/clk/uniphier/Makefile new file +10 -0
new file mode 100644
index 0000000..3be1a17
@@ -0,0 +1,10 @@
+obj-y += clk-uniphier-core.o
+obj-y += clk-uniphier-peri.o
+obj-y += clk-uniphier-mio.o
+
+obj-$(CONFIG_CLK_UNIPHIER_PH1_SLD3)	+= clk-ph1-sld3.o
+obj-$(CONFIG_CLK_UNIPHIER_PH1_LD4)	+= clk-ph1-ld4.o
+obj-$(CONFIG_CLK_UNIPHIER_PH1_PRO4)	+= clk-ph1-pro4.o
+obj-$(CONFIG_CLK_UNIPHIER_PH1_SLD8)	+= clk-ph1-sld8.o
+obj-$(CONFIG_CLK_UNIPHIER_PH1_PRO5)	+= clk-ph1-pro5.o
+obj-$(CONFIG_CLK_UNIPHIER_PROXSTREAM2)	+= clk-proxstream2.o
drivers/clk/uniphier/clk-ph1-ld4.c new file +117 -0

117 lines not on this page · raw message

drivers/clk/uniphier/clk-ph1-pro4.c new file +117 -0

117 lines not on this page · raw message

drivers/clk/uniphier/clk-ph1-pro5.c new file +107 -0

107 lines not on this page · raw message

drivers/clk/uniphier/clk-ph1-sld3.c new file +117 -0

117 lines not on this page · raw message

drivers/clk/uniphier/clk-ph1-sld8.c new file +107 -0

107 lines not on this page · raw message

drivers/clk/uniphier/clk-proxstream2.c new file +88 -0

88 lines not on this page · raw message

drivers/clk/uniphier/clk-uniphier-core.c new file +151 -0

151 lines not on this page · raw message

drivers/clk/uniphier/clk-uniphier-mio.c new file +315 -0

315 lines not on this page · raw message

drivers/clk/uniphier/clk-uniphier-peri.c new file +175 -0

175 lines not on this page · raw message

drivers/clk/uniphier/clk-uniphier.h new file +68 -0

68 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw
Quoted 10 lines · Masahiro Yamada

This is the initial commit for the UniPhier clock drivers, including support for PH1-sLD3, PH1-LD4, PH1-Pro4, PH1-sLD8, PH1-Pro5, and ProXstream2/PH1-LD6b.

To improve the code maintainability, the driver consists of common functions (clk-uniphier-core.c) and clock data arrays needed to support each SoC.

---

Where's the DT binding? Also, can these clks be registered from a platform device driver instead of from

drivers/clk/uniphier/Kconfig line 3

Quoted 10 lines
drivers/clk/uniphier/Kconfig new file +3 -0
new file mode 100644
index 0000000..7606f27
@@ -0,0 +1,35 @@
+menuconfig CLK_UNIPHIER
+	bool "Clock drivers for UniPhier SoCs"
+	depends on ARCH_UNIPHIER

Can we have COMPILE_TEST here?

drivers/clk/uniphier/Kconfig line 5

Quoted 2 lines
drivers/clk/uniphier/Kconfig new file +2 -0
+	depends on OF
+	default y

And then default ARCH_UNIPHIER instead.

drivers/clk/uniphier/Kconfig line 13

Quoted 8 lines
drivers/clk/uniphier/Kconfig new file +8 -0
+	help
+	  Supports clock drivers for UniPhier SoCs.
+
+if CLK_UNIPHIER
+
+config CLK_UNIPHIER_PH1_SLD3
+	bool "Clock driver for UniPhier PH1-sLD3 SoC"
+	default y

These would all become default ARCH_UNIPHIER as well.

drivers/clk/uniphier/clk-uniphier-core.c

Quoted 23 lines
drivers/clk/uniphier/Kconfig new file +22 -0
+
+config CLK_UNIPHIER_PH1_LD4
+	bool "Clock driver for UniPhier PH1-LD4 SoC"
+	default y
+
+config CLK_UNIPHIER_PH1_PRO4
+	bool "Clock driver for UniPhier PH1-Pro4 SoC"
+	default y
+
+config CLK_UNIPHIER_PH1_SLD8
+	bool "Clock driver for UniPhier PH1-sLD8 SoC"
+	default y
+
+config CLK_UNIPHIER_PH1_PRO5
+	bool "Clock driver for UniPhier PH1-Pro5 SoC"
+	default y
+
+config CLK_UNIPHIER_PROXSTREAM2
+	bool "Clock driver for UniPhier ProXstream2/PH1-LD6b SoC"
+	default y
+
+endif
drivers/clk/uniphier/clk-uniphier-core.c +0 -0

Maybe this patch can be split between core code and SoC specific data? That way we can focus on the core code without wading through all the random clk data arrays.

Quoted 33 lines

new file mode 100644
index 0000000..8680101

drivers/clk/uniphier/clk-uniphier-core.c new file +28 -0
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2015 Masahiro Yamada <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+#define pr_fmt(fmt)		"uniphier-clk: " fmt
+
+#include <linux/clk-provider.h>
+#include <linux/log2.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/slab.h>
+
+#include "clk-uniphier.h"
+
+static void __init uniphier_clk_update_parent_name(struct device_node *np,
+						   const char **parent_name)
+{
+	const char *new_name;

drivers/clk/uniphier/clk-uniphier-core.c line 38

Quoted 10 lines
drivers/clk/uniphier/clk-uniphier-core.c new file +10 -0
+	int index;
+
+	if (!parent_name || !*parent_name)
+		return;
+
+	if (strncmp(*parent_name, UNIPHIER_CLK_EXT, strlen(UNIPHIER_CLK_EXT)))
+		return;
+
+	index = of_property_match_string(np, "clock-names",
+				*parent_name + strlen(UNIPHIER_CLK_EXT));

If possible please don't use clock-names to set up clock hierarchy.

Quoted 51 lines
drivers/clk/uniphier/clk-uniphier-core.c new file +51 -0
+	new_name = of_clk_get_parent_name(np, index);
+	if (new_name)
+		*parent_name = new_name;
+}
+
+static struct clk * __init uniphier_clk_register(struct device_node *np,
+						 void __iomem *regbase,
+					  struct uniphier_clk_init_data *idata)
+{
+	int i;
+
+	switch (idata->type) {
+	case UNIPHIER_CLK_TYPE_FIXED_FACTOR:
+		uniphier_clk_update_parent_name(np,
+					&idata->data.factor.parent_name);
+		return clk_register_fixed_factor(NULL, idata->name,
+						 idata->data.factor.parent_name,
+						 CLK_SET_RATE_PARENT,
+						 idata->data.factor.mult,
+						 idata->data.factor.div);
+	case UNIPHIER_CLK_TYPE_FIXED_RATE:
+		return clk_register_fixed_rate(NULL, idata->name, NULL,
+					       CLK_IS_ROOT,
+					       idata->data.rate.fixed_rate);
+	case UNIPHIER_CLK_TYPE_GATE:
+		uniphier_clk_update_parent_name(np,
+						&idata->data.gate.parent_name);
+		return clk_register_gate(NULL, idata->name,
+					 idata->data.gate.parent_name,
+					 idata->data.gate.parent_name ?
+					 CLK_SET_RATE_PARENT : CLK_IS_ROOT,
+					 regbase + idata->data.gate.reg,
+					 idata->data.gate.bit_idx, 0, NULL);
+	case UNIPHIER_CLK_TYPE_MUX:
+		for (i = 0; i < idata->data.mux.num_parents; i++)
+			uniphier_clk_update_parent_name(np,
+					&idata->data.mux.parent_names[i]);
+		return clk_register_mux(NULL, idata->name,
+					idata->data.mux.parent_names,
+					idata->data.mux.num_parents,
+					CLK_SET_RATE_PARENT,
+					regbase + idata->data.mux.reg,
+					idata->data.mux.shift,
+					ilog2(idata->data.mux.num_parents),
+					0, NULL);
+	default:
+		WARN(1, "unsupported clock type\n");
+		return ERR_PTR(-EINVAL);
+	}
+}
+

drivers/clk/uniphier/clk-uniphier-core.c line 99

Quoted 10 lines
drivers/clk/uniphier/clk-uniphier-core.c new file +10 -0
+int __init uniphier_clk_init(struct device_node *np,
+			     struct uniphier_clk_init_data *idata)
+{
+	struct clk_onecell_data *clk_data;
+	struct uniphier_clk_init_data *p;
+	void __iomem *regbase;
+	int max_index = 0;
+	int ret;
+
+	regbase = of_iomap(np, 0);

If not a platform device, use of_io_request_and_map()?

Quoted 27 lines
drivers/clk/uniphier/clk-uniphier-core.c new file +13 -0
+	if (!regbase)
+		return -ENOMEM;
+
+	for (p = idata; p->name; p++)
+		max_index = max(max_index, p->output_index);
+
+	clk_data = kzalloc(sizeof(*clk_data), GFP_KERNEL);
+	if (!clk_data)
+		return -ENOMEM;
+
+	clk_data->clk_num = max_index + 1;
+	clk_data->clks = kcalloc(clk_data->clk_num, sizeof(struct clk *),
+				 GFP_KERNEL);
drivers/clk/uniphier/clk-uniphier.h new file +8 -0
new file mode 100644
index 0000000..05277b6
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 Masahiro Yamada <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *

drivers/clk/uniphier/clk-uniphier.h line 18

Quoted 10 lines
drivers/clk/uniphier/clk-uniphier.h new file +10 -0
+ * 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 __CLK_UNIPHIER_H__
+#define __CLK_UNIPHIER_H__
+
+#include <linux/kernel.h>

What's this include for?

Quoted 34 lines
drivers/clk/uniphier/clk-uniphier.h new file +34 -0
+
+#define UNIPHIER_CLK_EXT	"[EXT]"
+
+enum uniphier_clk_type {
+	UNIPHIER_CLK_TYPE_FIXED_FACTOR,
+	UNIPHIER_CLK_TYPE_FIXED_RATE,
+	UNIPHIER_CLK_TYPE_GATE,
+	UNIPHIER_CLK_TYPE_MUX,
+};
+
+struct uniphier_clk_fixed_factor_data {
+	const char *parent_name;
+	unsigned int mult;
+	unsigned int div;
+};
+
+struct uniphier_clk_fixed_rate_data {
+	unsigned long fixed_rate;
+};
+
+struct uniphier_clk_gate_data {
+	const char *parent_name;
+	unsigned int reg;
+	u8 bit_idx;
+};
+
+struct uniphier_clk_mux_data {
+	const char *parent_names[4];
+	u8 num_parents;
+	unsigned int reg;
+	u8 shift;
+};
+
+struct uniphier_clk_init_data {

drivers/clk/uniphier/clk-uniphier.h line 62

Quoted 10 lines
drivers/clk/uniphier/clk-uniphier.h new file +10 -0
+	const char *name;
+	enum uniphier_clk_type type;
+	int output_index;
+	union {
+		struct uniphier_clk_fixed_factor_data factor;
+		struct uniphier_clk_fixed_rate_data rate;
+		struct uniphier_clk_gate_data gate;
+		struct uniphier_clk_mux_data mux;
+	} data;
+	struct clk *clk;

Probably need to forward declare this struct.

drivers/clk/uniphier/clk-uniphier.h line 65

Quoted 3 lines
drivers/clk/uniphier/clk-uniphier.h new file +3 -0
+};
+
+int uniphier_clk_init(struct device_node *np,

Same for device_node.

Quoted 6 lines
drivers/clk/uniphier/clk-uniphier.h new file +3 -0
+		      struct uniphier_clk_init_data *idata);
+
+#endif /* __CLK_UNIPHIER_H__ */
Signature · 1 line
1.9.1
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

Hi Stephen,

I am back after long silence.

2016-02-26 9:07 GMT+09:00 Stephen Boyd <[email protected]>:

Quoted 15 lines · Masahiro Yamada
Quoted 10 lines

This is the initial commit for the UniPhier clock drivers, including support for PH1-sLD3, PH1-LD4, PH1-Pro4, PH1-sLD8, PH1-Pro5, and ProXstream2/PH1-LD6b.

To improve the code maintainability, the driver consists of common functions (clk-uniphier-core.c) and clock data arrays needed to support each SoC.

---

Where's the DT binding? Also, can these clks be registered from a platform device driver instead of from

Quoted 1 line
Quoted 11 lines

drivers/clk/uniphier/Kconfig line 3

Quoted 9 lines
drivers/clk/uniphier/Kconfig new file +3 -0
new file mode 100644
index 0000000..7606f27
@@ -0,0 +1,35 @@
+menuconfig CLK_UNIPHIER
+     bool "Clock drivers for UniPhier SoCs"
+     depends on ARCH_UNIPHIER

Can we have COMPILE_TEST here?

OK.
But if you recommend to drop "depends on ARCH_UNIPHIER", COMPILE_TEST is not necessary.

Quoted 4 lines

drivers/clk/uniphier/Kconfig line 5

Quoted 2 lines
drivers/clk/uniphier/Kconfig new file +2 -0
+     depends on OF
+     default y

And then default ARCH_UNIPHIER instead.

The problem is that CLK_UNIPHIER is not enabled along with ARCH_UNIPHIER in "make menuconfig".

If we use "depends on ARCH_UNIPHIER"
and we enable ARCH_UNIPHIER from "make menuconfig", CLK_UNIPHIER is automatically enabled as well.

Is the latter more like what we expect?

Quoted 6 lines

drivers/clk/uniphier/clk-uniphier-core.c

Quoted 2 lines
drivers/clk/uniphier/Kconfig new file +1 -0
+endif
drivers/clk/uniphier/clk-uniphier-core.c +0 -0

Maybe this patch can be split between core code and SoC specific data? That way we can focus on the core code without wading through all the random clk data arrays.

OK. will do so.

Quoted 9 lines
Quoted 9 lines
drivers/clk/uniphier/clk-uniphier-core.c +9 -0
+static void __init uniphier_clk_update_parent_name(struct device_node *np,
+                                                const char **parent_name)
+{
+     const char *new_name;
+     int index;
+
+     if (!parent_name || !*parent_name)
+             return;
+
Quoted 8 lines

drivers/clk/uniphier/clk-uniphier-core.c line 38

Quoted 5 lines
drivers/clk/uniphier/clk-uniphier-core.c +5 -0
+     if (strncmp(*parent_name, UNIPHIER_CLK_EXT, strlen(UNIPHIER_CLK_EXT)))
+             return;
+
+     index = of_property_match_string(np, "clock-names",
+                             *parent_name + strlen(UNIPHIER_CLK_EXT));

If possible please don't use clock-names to set up clock hierarchy.

So, what shall I do instead?

I am not comfortable with hard-coding the parents' names for clock-cascading.

Maybe, can we support clk registration
with clk_hw of parents, not names of parents?

For example, by adding "struct clk_hw **parents" to struct clk_init_data.

Quoted 4 lines
Quoted 4 lines
drivers/clk/uniphier/clk-uniphier-core.c +4 -0
+int __init uniphier_clk_init(struct device_node *np,
+                          struct uniphier_clk_init_data *idata)
+{
+     struct clk_onecell_data *clk_data;
Quoted 8 lines

drivers/clk/uniphier/clk-uniphier-core.c line 99

Quoted 6 lines
drivers/clk/uniphier/clk-uniphier-core.c +6 -0
+     struct uniphier_clk_init_data *p;
+     void __iomem *regbase;
+     int max_index = 0;
+     int ret;
+
+     regbase = of_iomap(np, 0);

If not a platform device, use of_io_request_and_map()?

I am planning to change all of them into platform drivers in the next version.

Quoted 6 lines

drivers/clk/uniphier/clk-uniphier-core.c

Quoted 4 lines
drivers/clk/uniphier/clk-uniphier-core.c +4 -0
+#ifndef __CLK_UNIPHIER_H__
+#define __CLK_UNIPHIER_H__
+
+#include <linux/kernel.h>

What's this include for?

Probably my mistake. Will remove.

Quoted 38 lines
Quoted 38 lines
drivers/clk/uniphier/clk-uniphier-core.c +38 -0
+
+#define UNIPHIER_CLK_EXT     "[EXT]"
+
+enum uniphier_clk_type {
+     UNIPHIER_CLK_TYPE_FIXED_FACTOR,
+     UNIPHIER_CLK_TYPE_FIXED_RATE,
+     UNIPHIER_CLK_TYPE_GATE,
+     UNIPHIER_CLK_TYPE_MUX,
+};
+
+struct uniphier_clk_fixed_factor_data {
+     const char *parent_name;
+     unsigned int mult;
+     unsigned int div;
+};
+
+struct uniphier_clk_fixed_rate_data {
+     unsigned long fixed_rate;
+};
+
+struct uniphier_clk_gate_data {
+     const char *parent_name;
+     unsigned int reg;
+     u8 bit_idx;
+};
+
+struct uniphier_clk_mux_data {
+     const char *parent_names[4];
+     u8 num_parents;
+     unsigned int reg;
+     u8 shift;
+};
+
+struct uniphier_clk_init_data {
+     const char *name;
+     enum uniphier_clk_type type;
+     int output_index;
+     union {
Quoted 8 lines

drivers/clk/uniphier/clk-uniphier-core.c

Quoted 6 lines
drivers/clk/uniphier/clk-uniphier-core.c +6 -0
+             struct uniphier_clk_fixed_factor_data factor;
+             struct uniphier_clk_fixed_rate_data rate;
+             struct uniphier_clk_gate_data gate;
+             struct uniphier_clk_mux_data mux;
+     } data;
+     struct clk *clk;

Probably need to forward declare this struct.

OK, thanks.

Quoted 5 lines

drivers/clk/uniphier/clk-uniphier-core.c

Quoted 3 lines
drivers/clk/uniphier/clk-uniphier-core.c +3 -0
+};
+
+int uniphier_clk_init(struct device_node *np,

Same for device_node.

Signature · 2 lines
Best Regards
Masahiro Yamada
#3 lore raw
Quoted 16 lines · Masahiro Yamada

2016-02-26 9:07 GMT+09:00 Stephen Boyd <[email protected]>:

Quoted 13 lines · Masahiro Yamada

drivers/clk/uniphier/Kconfig line 3

Quoted 10 lines
drivers/clk/uniphier/Kconfig new file +3 -0
new file mode 100644
index 0000000..7606f27
@@ -0,0 +1,35 @@
+menuconfig CLK_UNIPHIER
+     bool "Clock drivers for UniPhier SoCs"
+     depends on ARCH_UNIPHIER

Can we have COMPILE_TEST here?

Quoted 3 lines

OK.
But if you recommend to drop "depends on ARCH_UNIPHIER", COMPILE_TEST is not necessary.

Right, I wasn't recommending removing the depends on ARCH_UNIPHIER. Sorry if that wasn't clear.

Quoted 9 lines
Quoted 6 lines

drivers/clk/uniphier/Kconfig line 5

Quoted 4 lines
drivers/clk/uniphier/Kconfig new file +2 -0
+     depends on OF
+     default y

And then default ARCH_UNIPHIER instead.

Quoted 8 lines

The problem is that CLK_UNIPHIER is not enabled along with ARCH_UNIPHIER in "make menuconfig".

If we use "depends on ARCH_UNIPHIER"
and we enable ARCH_UNIPHIER from "make menuconfig", CLK_UNIPHIER is automatically enabled as well.

Is the latter more like what we expect?

I'm thinking

menuconfig CLK_UNIPHIER
bool "Clock drivers for UniPhier SoCs" depends on ARCH_UNIPHIER || COMPILE_TEST depends on OF
default ARCH_UNIPHIER

That way we can build it even if we're not the arch, and it's defaulted to be built if we have the arch enabled, but it isn't defaulted to be built if that arch isn't enabled and compile test is enabled.

Quoted 7 lines
Quoted 4 lines

If possible please don't use clock-names to set up clock hierarchy.

So, what shall I do instead?

Quoted 9 lines

I am not comfortable with hard-coding the parents' names for clock-cascading.

Maybe, can we support clk registration
with clk_hw of parents, not names of parents?

For example, by adding "struct clk_hw **parents" to struct clk_init_data.

Sounds like it isn't possible to avoid clock-names DT property then. Not a big deal.

We've been trying to figure out some way to register clks without requiring strings, but so far nothing has really happened. The clk_hw approach would work, except for the case where some of the provider's clks rely on another provider's clks that also rely on the first provider (sort of a spiral of dependencies). In that case we want to break the provider level loop by letting clks say something besides clk_hw pointers are parents.

Strings work well here because we have support for clock-names and string based parent-child descriptions already, but maybe we'd be better off having some way to say that this clk we're registering uses provider X's 24th output as its second parent. It would be good if we avoided tying it to any DT construct though, because DT isn't the only way clks are registered and provided to the system.

This is all because we know that forcing driver authors to come up with globally unique names for clks just doesn't work when it comes to things like the same clk controller IP instantiated twice in the hardware and thus the same driver matches both device instances.

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project