Skip to contentSkip to conversation

clk: imx: add imx8qxp clock support

PATCH Superseded Dong Aisheng 4 participants 18 messages Apr 27, 2018 – May 2, 2018

Subsystems (6)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover clk: imx: add imx8qxp clock support

This patch series adds i.MX8QXP clock support which is based on the clock service provided by SCU firmware.
It depends on SCU APIs patch set.

Dong Aisheng (12):
clk: imx: add configuration option for mmio clks
clk: imx: scu: add scu clock common part
clk: imx: scu: add scu clock divider
clk: imx: scu: add scu clock gpr divider
clk: imx: scu: add scu clock gate
clk: imx: scu: add scu clock gpr gate
clk: imx: scu: add scu clock mux
clk: imx: scu: add scu clock gpr mux
clk: imx: add common imx_clk_hw_fixed functions
clk: imx: add imx_check_clk_hws helper function
dt-bindings: clock: add imx8qxp clock binding doc
clk: imx: add imx8qxp clk driver

 .../devicetree/bindings/clock/imx8qxp-clk.txt      |  39 ++
 arch/arm/mach-imx/Kconfig                          |  10 +
 drivers/clk/Kconfig                                |   1 +
 drivers/clk/imx/Kconfig                            |   7 +
 drivers/clk/imx/Makefile                           |   4 +-
 drivers/clk/imx/clk-common.h                       |  27 ++
 drivers/clk/imx/scu/Kconfig                        |   5 +
 drivers/clk/imx/scu/Makefile                       |  12 +
 drivers/clk/imx/scu/clk-divider-gpr-scu.c          | 131 +++++++
 drivers/clk/imx/scu/clk-divider-scu.c              | 129 +++++++
 drivers/clk/imx/scu/clk-gate-gpr-scu.c             |  84 ++++
 drivers/clk/imx/scu/clk-gate-scu.c                 | 193 ++++++++++
 drivers/clk/imx/scu/clk-imx8qxp.c                  | 426 +++++++++++++++++++++
 drivers/clk/imx/scu/clk-mux-gpr-scu.c              |  90 +++++
 drivers/clk/imx/scu/clk-mux-scu.c                  |  89 +++++
 drivers/clk/imx/scu/clk-scu.c                      |  25 ++
 drivers/clk/imx/scu/clk-scu.h                      |  97 +++++
 include/dt-bindings/clock/imx8qxp-clock.h          | 362 +++++++++++++++++
 include/soc/imx/imx8qxp/lpcg.h                     | 186 +++++++++
 19 files changed, 1916 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8qxp-clk.txt
 create mode 100644 drivers/clk/imx/Kconfig
 create mode 100644 drivers/clk/imx/clk-common.h
 create mode 100644 drivers/clk/imx/scu/Kconfig
 create mode 100644 drivers/clk/imx/scu/Makefile
 create mode 100644 drivers/clk/imx/scu/clk-divider-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-divider-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-gate-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-gate-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-imx8qxp.c
 create mode 100644 drivers/clk/imx/scu/clk-mux-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-mux-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-scu.h
 create mode 100644 include/dt-bindings/clock/imx8qxp-clock.h
 create mode 100644 include/soc/imx/imx8qxp/lpcg.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/12 clk: imx: add configuration option for mmio clks

The patch introduces CONFIG_MXC_CLK option for legacy MMIO clocks, this is required to compile legacy MMIO clock conditionally when adding SCU based clocks for MX8 platforms later.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 arch/arm/mach-imx/Kconfig | 10 ++++++++++
 drivers/clk/Kconfig       |  1 +
 drivers/clk/imx/Kconfig   |  5 +++++
 drivers/clk/imx/Makefile  |  2 +-
 4 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/imx/Kconfig
arch/arm/mach-imx/Kconfig +10 -0
index e47fa13..45f2a08 100644
@@ -57,23 +57,27 @@ config SOC_IMX21
 	select CPU_ARM926T
 	select IMX_HAVE_IOMUX_V1
 	select MXC_AVIC
+	select MXC_CLK
 
 config SOC_IMX27
 	bool
 	select CPU_ARM926T
 	select IMX_HAVE_IOMUX_V1
 	select MXC_AVIC
+	select MXC_CLK
 	select PINCTRL_IMX27
 
 config SOC_IMX31
 	bool
 	select CPU_V6
 	select MXC_AVIC
+	select MXC_CLK
 
 config SOC_IMX35
 	bool
 	select ARCH_MXC_IOMUX_V3
 	select MXC_AVIC
+	select MXC_CLK
 	select PINCTRL_IMX35
 
 if ARCH_MULTI_V5
@@ -417,6 +421,7 @@ config SOC_IMX1
 	bool "i.MX1 support"
 	select CPU_ARM920T
 	select MXC_AVIC
+	select MXC_CLK
 	select PINCTRL_IMX1
 	help
 	  This enables support for Freescale i.MX1 processor
@@ -430,6 +435,7 @@ config SOC_IMX25
 	select ARCH_MXC_IOMUX_V3
 	select CPU_ARM926T
 	select MXC_AVIC
+	select MXC_CLK
 	select PINCTRL_IMX25
 	help
 	  This enables support for Freescale i.MX25 processor
@@ -442,6 +448,7 @@ comment "Cortex-A platforms"
 config SOC_IMX5
 	bool
 	select HAVE_IMX_SRC
+	select MXC_CLK
 	select MXC_TZIC
 
 config	SOC_IMX50
@@ -478,6 +485,7 @@ config SOC_IMX6
 	select HAVE_IMX_MMDC
 	select HAVE_IMX_SRC
 	select MFD_SYSCON
+	select MXC_CLK
 	select PL310_ERRATA_769419 if CACHE_L2X0
 
 config SOC_IMX6Q
@@ -531,6 +539,7 @@ config SOC_IMX7D
 	select HAVE_IMX_MMDC
 	select HAVE_IMX_SRC
 	select IMX_GPCV2
+	select MXC_CLK
 	help
 		This enables support for Freescale i.MX7 Dual processor.
 
@@ -551,6 +560,7 @@ if ARCH_MULTI_V7 || ARM_SINGLE_ARMV7M
 config SOC_VF610
 	bool "Vybrid Family VF610 support"
 	select ARM_GIC if ARCH_MULTI_V7
+	select MXC_CLK
 	select PINCTRL_VF610
 
 	help
drivers/clk/Kconfig +1 -0
index 41492e9..5b2e74f 100644
@@ -282,6 +282,7 @@ config COMMON_CLK_STM32H7
 source "drivers/clk/bcm/Kconfig"
 source "drivers/clk/hisilicon/Kconfig"
 source "drivers/clk/imgtec/Kconfig"
+source "drivers/clk/imx/Kconfig"
 source "drivers/clk/keystone/Kconfig"
 source "drivers/clk/mediatek/Kconfig"
 source "drivers/clk/meson/Kconfig"
drivers/clk/imx/Kconfig new file +5 -0
new file mode 100644
index 0000000..43a3ecc
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+# common clock support for NXP i.MX SoC family.
+config MXC_CLK
+	bool
+	depends on ARCH_MXC
drivers/clk/imx/Makefile +1 -1
index 8c3baa7..d447f8c 100644
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
-obj-y += \
+obj-$(CONFIG_MXC_CLK) += \
 	clk.o \
 	clk-busy.o \
 	clk-cpu.o \
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/12 clk: imx: scu: add scu clock common part

In reply to Dong Aisheng

Add scu clock common part which will be used by client clock drivers.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/Kconfig       |  2 ++
 drivers/clk/imx/Makefile      |  2 ++
 drivers/clk/imx/scu/Kconfig   |  5 +++++
 drivers/clk/imx/scu/Makefile  |  4 ++++
 drivers/clk/imx/scu/clk-scu.c | 25 +++++++++++++++++++++++++
 drivers/clk/imx/scu/clk-scu.h | 18 ++++++++++++++++++
 6 files changed, 56 insertions(+)
 create mode 100644 drivers/clk/imx/scu/Kconfig
 create mode 100644 drivers/clk/imx/scu/Makefile
 create mode 100644 drivers/clk/imx/scu/clk-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-scu.h
drivers/clk/imx/Kconfig +2 -0
index 43a3ecc..b1599bf 100644
@@ -3,3 +3,5 @@
 config MXC_CLK
 	bool
 	depends on ARCH_MXC
+
+source drivers/clk/imx/scu/Kconfig
drivers/clk/imx/Makefile +2 -0
index d447f8c..79b641a 100644
@@ -13,6 +13,8 @@ obj-$(CONFIG_MXC_CLK) += \
 	clk-pllv3.o \
 	clk-pfd.o
 
+obj-y += scu/
+
 obj-$(CONFIG_SOC_IMX1)   += clk-imx1.o
 obj-$(CONFIG_SOC_IMX21)  += clk-imx21.o
 obj-$(CONFIG_SOC_IMX25)  += clk-imx25.o
drivers/clk/imx/scu/Kconfig new file +5 -0
new file mode 100644
index 0000000..4d018fd
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+# SCU based common clock support for NXP i.MX SoC family.
+config MXC_CLK_SCU
+	bool
+	depends on ARCH_MXC && ARM64
drivers/clk/imx/scu/Makefile new file +4 -0
new file mode 100644
index 0000000..7dead13
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_MXC_CLK_SCU) += \
+	clk-scu.o
drivers/clk/imx/scu/clk-scu.c new file +25 -0
new file mode 100644
index 0000000..c19cd38
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017~2018 NXP
+ *	Dong Aisheng <[email protected]>
+ */
+
+#include <linux/errno.h>
+#include "clk-scu.h"
+
+DEFINE_SPINLOCK(imx_ccm_lock);
+sc_ipc_t ccm_ipc_handle;
+
+int imx_clk_scu_init(void)
+{
+	sc_err_t sci_err;
+
+	sci_err = sc_ipc_get_handle(&ccm_ipc_handle);
+	if (sci_err != SC_ERR_NONE) {
+		pr_err("imx_clk_scu: failed to get sc ipc handle\n");
+		return -EPROBE_DEFER;
+	}
+
+	return 0;
+}
drivers/clk/imx/scu/clk-scu.h new file +18 -0
new file mode 100644
index 0000000..6b39e4a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ * Copyright 2017~2018 NXP
+ */
+
+#ifndef __IMX_CLK_SCU_H
+#define __IMX_CLK_SCU_H
+
+#include <linux/spinlock.h>
+#include <soc/imx/sc/sci.h>
+
+extern spinlock_t imx_ccm_lock;
+extern sc_ipc_t ccm_ipc_handle;
+
+int imx_clk_scu_init(void);
+
+#endif
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/12 clk: imx: scu: add scu clock divider

In reply to Dong Aisheng

Add scu based clock divider.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/scu/Makefile          |   3 +-
 drivers/clk/imx/scu/clk-divider-scu.c | 129 ++++++++++++++++++++++++++++++++++
 drivers/clk/imx/scu/clk-scu.h         |  18 +++++
 3 files changed, 149 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/imx/scu/clk-divider-scu.c
drivers/clk/imx/scu/Makefile +2 -1
index 7dead13..7e360e2 100644
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_MXC_CLK_SCU) += \
-	clk-scu.o
+	clk-scu.o \
+	clk-divider-scu.o
drivers/clk/imx/scu/clk-divider-scu.c new file +129 -0

129 lines not on this page · raw message

drivers/clk/imx/scu/clk-scu.h +18 -0
index 6b39e4a..ee197f9 100644
@@ -7,6 +7,7 @@
 #ifndef __IMX_CLK_SCU_H
 #define __IMX_CLK_SCU_H
 
+#include <linux/clk-provider.h>
 #include <linux/spinlock.h>
 #include <soc/imx/sc/sci.h>
 
@@ -15,4 +16,21 @@ extern sc_ipc_t ccm_ipc_handle;
 
 int imx_clk_scu_init(void);
 
+struct clk_hw *imx_clk_register_divider_scu(const char *name,
+				const char *parent_name, sc_rsrc_t rsrc_id,
+				sc_pm_clk_t clk_type);
+
+static inline struct clk_hw *imx_clk_divider_scu(const char *name,
+				sc_rsrc_t rsrc_id, sc_pm_clk_t clk_type)
+{
+	return imx_clk_register_divider_scu(name, NULL, rsrc_id, clk_type);
+}
+
+static inline struct clk_hw *imx_clk_divider2_scu(const char *name,
+				const char *parent_name,
+				sc_rsrc_t rsrc_id, sc_pm_clk_t clk_type)
+{
+	return imx_clk_register_divider_scu(name, parent_name, rsrc_id, clk_type);
+}
+
 #endif
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/12 clk: imx: scu: add scu clock gpr divider

In reply to Dong Aisheng

Add scu based clock gpr divider. Unlike the normal scu divider, such dividers are controlled by GPR bits through SCU sc_misc_set_control API.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/scu/Makefile              |   3 +-
 drivers/clk/imx/scu/clk-divider-gpr-scu.c | 131 ++++++++++++++++++++++++++++++
 drivers/clk/imx/scu/clk-scu.h             |   3 +
 3 files changed, 136 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/imx/scu/clk-divider-gpr-scu.c
drivers/clk/imx/scu/Makefile +2 -1
index 7e360e2..9e7f4aa 100644
@@ -2,4 +2,5 @@
 
 obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-scu.o \
-	clk-divider-scu.o
+	clk-divider-scu.o \
+	clk-divider-gpr-scu.o
drivers/clk/imx/scu/clk-divider-gpr-scu.c new file +131 -0

131 lines not on this page · raw message

drivers/clk/imx/scu/clk-scu.h +3 -0
index ee197f9..cb9a723 100644
@@ -33,4 +33,7 @@ static inline struct clk_hw *imx_clk_divider2_scu(const char *name,
 	return imx_clk_register_divider_scu(name, parent_name, rsrc_id, clk_type);
 }
 
+struct clk_hw *imx_clk_divider_gpr_scu(const char *name, const char *parent_name,
+				sc_rsrc_t rsrc_id, sc_ctrl_t gpr_id);
+
 #endif
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/12 clk: imx: scu: add scu clock gate

In reply to Dong Aisheng

Add scu based clock gate.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/scu/Makefile       |   3 +-
 drivers/clk/imx/scu/clk-gate-scu.c | 193 +++++++++++++++++++++++++++++++++++++
 drivers/clk/imx/scu/clk-scu.h      |  23 +++++
 3 files changed, 218 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/imx/scu/clk-gate-scu.c
drivers/clk/imx/scu/Makefile +2 -1
index 9e7f4aa..2abed17 100644
@@ -3,4 +3,5 @@
 obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-scu.o \
 	clk-divider-scu.o \
-	clk-divider-gpr-scu.o
+	clk-divider-gpr-scu.o \
+	clk-gate-scu.o
drivers/clk/imx/scu/clk-gate-scu.c new file +193 -0

193 lines not on this page · raw message

drivers/clk/imx/scu/clk-scu.h +23 -0
index cb9a723..c08dca1 100644
@@ -36,4 +36,27 @@ static inline struct clk_hw *imx_clk_divider2_scu(const char *name,
 struct clk_hw *imx_clk_divider_gpr_scu(const char *name, const char *parent_name,
 				sc_rsrc_t rsrc_id, sc_ctrl_t gpr_id);
 
+struct clk_hw *clk_register_gate_scu(const char *name, const char *parent_name,
+				unsigned long flags, sc_rsrc_t rsrc_id,
+				sc_pm_clk_t clk_type, void __iomem *reg,
+				u8 bit_idx, bool hw_gate);
+
+struct clk_hw *clk_register_gate2_scu(const char *name, const char *parent_name,
+				unsigned long flags, void __iomem *reg,
+				u8 bit_idx, bool hw_gate);
+
+static inline struct clk_hw *imx_clk_gate_scu(const char *name, const char *parent,
+				sc_rsrc_t rsrc_id, sc_pm_clk_t clk_type,
+				void __iomem *reg, u8 bit_idx, bool hw_gate)
+{
+	return clk_register_gate_scu(name, parent, CLK_SET_RATE_PARENT,
+				     rsrc_id, clk_type, reg, bit_idx, hw_gate);
+}
+
+static inline struct clk_hw *imx_clk_gate2_scu(const char *name, const char *parent,
+				void __iomem *reg, u8 bit_idx, bool hw_gate)
+{
+	return clk_register_gate2_scu(name, parent, 0, reg, bit_idx, hw_gate);
+}
+
 #endif
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/12 clk: imx: scu: add scu clock gpr gate

In reply to Dong Aisheng

Add scu based clock gpr gate. Unlike the normal scu gate, such gates are controlled by GPR bits through SCU sc_misc_set_control API.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/scu/Makefile           |  3 +-
 drivers/clk/imx/scu/clk-gate-gpr-scu.c | 84 ++++++++++++++++++++++++++++++++++
 drivers/clk/imx/scu/clk-scu.h          |  9 ++++
 3 files changed, 95 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/imx/scu/clk-gate-gpr-scu.c
drivers/clk/imx/scu/Makefile +2 -1
index 2abed17..25d3511 100644
@@ -4,4 +4,5 @@ obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-scu.o \
 	clk-divider-scu.o \
 	clk-divider-gpr-scu.o \
-	clk-gate-scu.o
+	clk-gate-scu.o \
+	clk-gate-gpr-scu.o
drivers/clk/imx/scu/clk-gate-gpr-scu.c new file +84 -0

84 lines not on this page · raw message

drivers/clk/imx/scu/clk-scu.h +9 -0
index c08dca1..e419035 100644
@@ -59,4 +59,13 @@ static inline struct clk_hw *imx_clk_gate2_scu(const char *name, const char *par
 	return clk_register_gate2_scu(name, parent, 0, reg, bit_idx, hw_gate);
 }
 
+struct clk_hw *clk_register_gate_gpr_scu(const char *name, const char *parent_name,
+				sc_rsrc_t rsrc_id, sc_ctrl_t gpr_id, bool invert_flag);
+
+static inline struct clk_hw *imx_clk_gate_gpr_scu(const char *name, const char *parent,
+				sc_rsrc_t rsrc_id, sc_ctrl_t gpr_id, bool invert_flag)
+{
+	return clk_register_gate_gpr_scu(name, parent, rsrc_id, gpr_id, invert_flag);
+}
+
 #endif
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/12 clk: imx: scu: add scu clock mux

In reply to Dong Aisheng

Add scu based clock mux.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/scu/Makefile      |  3 +-
 drivers/clk/imx/scu/clk-mux-scu.c | 89 +++++++++++++++++++++++++++++++++++++++
 drivers/clk/imx/scu/clk-scu.h     | 13 ++++++
 3 files changed, 104 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/imx/scu/clk-mux-scu.c
drivers/clk/imx/scu/Makefile +2 -1
index 25d3511..aee56bf 100644
@@ -5,4 +5,5 @@ obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-divider-scu.o \
 	clk-divider-gpr-scu.o \
 	clk-gate-scu.o \
-	clk-gate-gpr-scu.o
+	clk-gate-gpr-scu.o \
+	clk-mux-scu.o
drivers/clk/imx/scu/clk-mux-scu.c new file +89 -0

89 lines not on this page · raw message

drivers/clk/imx/scu/clk-scu.h +13 -0
index e419035..672a26c 100644
@@ -68,4 +68,17 @@ static inline struct clk_hw *imx_clk_gate_gpr_scu(const char *name, const char *
 	return clk_register_gate_gpr_scu(name, parent, rsrc_id, gpr_id, invert_flag);
 }
 
+struct clk_hw *clk_register_mux_scu(const char *name, const char * const *parents,
+			int num_parents, unsigned long flags,
+			sc_rsrc_t rsrc_id, sc_pm_clk_t clk_type);
+
+static inline struct clk_hw *imx_clk_mux_scu(const char *name,
+			const char * const *parents, int num_parents,
+			sc_rsrc_t rsrc_id, sc_pm_clk_t clk_type)
+{
+	return clk_register_mux_scu(name, parents, num_parents,
+			CLK_SET_RATE_NO_REPARENT, rsrc_id,
+			clk_type);
+}
+
 #endif
Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/12 clk: imx: scu: add scu clock gpr mux

In reply to Dong Aisheng

Add scu based clock gpr mux. Unlike the normal scu mux, such muxes are controlled by GPR bits through SCU sc_misc_set_control API.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/scu/Makefile          |  3 +-
 drivers/clk/imx/scu/clk-mux-gpr-scu.c | 90 +++++++++++++++++++++++++++++++++++
 drivers/clk/imx/scu/clk-scu.h         | 11 +++++
 3 files changed, 103 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/imx/scu/clk-mux-gpr-scu.c
drivers/clk/imx/scu/Makefile +2 -1
index aee56bf..a76ed78 100644
@@ -6,4 +6,5 @@ obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-divider-gpr-scu.o \
 	clk-gate-scu.o \
 	clk-gate-gpr-scu.o \
-	clk-mux-scu.o
+	clk-mux-scu.o \
+	clk-mux-gpr-scu.o
drivers/clk/imx/scu/clk-mux-gpr-scu.c new file +90 -0

90 lines not on this page · raw message

drivers/clk/imx/scu/clk-scu.h +11 -0
index 672a26c..918056e 100644
@@ -81,4 +81,15 @@ static inline struct clk_hw *imx_clk_mux_scu(const char *name,
 			clk_type);
 }
 
+struct clk_hw *clk_register_mux_gpr_scu(const char *name, const char * const *parents,
+			int num_parents, unsigned long flags,
+			sc_rsrc_t rsrc_id, sc_ctrl_t gpr_id);
+
+static inline struct clk_hw *imx_clk_mux_gpr_scu(const char *name, const char * const *parents,
+			int num_parents, sc_rsrc_t rsrc_id, sc_ctrl_t gpr_id)
+{
+	return clk_register_mux_gpr_scu(name, parents, num_parents,
+			CLK_SET_RATE_NO_REPARENT, rsrc_id, gpr_id);
+}
+
 #endif
Signature · 1 line
2.7.4
#9 lore raw

PATCH 9/12 clk: imx: add common imx_clk_hw_fixed functions

In reply to Dong Aisheng

This may be used by both mmio and scu clks. So let's put it into a common file.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/clk-common.h  | 16 ++++++++++++++++
 drivers/clk/imx/scu/clk-scu.h |  2 ++
 2 files changed, 18 insertions(+)
 create mode 100644 drivers/clk/imx/clk-common.h
drivers/clk/imx/clk-common.h new file +16 -0
new file mode 100644
index 0000000..e3634a5
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2018 NXP
+ */
+
+#ifndef __IMX_CLK_COMMON_H
+#define __IMX_CLK_COMMON_H
+
+#include <linux/clk-provider.h>
+
+static inline struct clk_hw *imx_clk_hw_fixed(const char *name, int rate)
+{
+	return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate);
+}
+
+#endif /* __IMX_CLK_COMMON_H */
drivers/clk/imx/scu/clk-scu.h +2 -0
index 918056e..ef9e060 100644
@@ -11,6 +11,8 @@
 #include <linux/spinlock.h>
 #include <soc/imx/sc/sci.h>
 
+#include "../clk-common.h"
+
 extern spinlock_t imx_ccm_lock;
 extern sc_ipc_t ccm_ipc_handle;
 
Signature · 1 line
2.7.4
#10 lore raw

PATCH 10/12 clk: imx: add imx_check_clk_hws helper function

In reply to Dong Aisheng

Add imx_check_clk_hws helper function

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/clk-common.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/clk/imx/clk-common.h +11 -0
index e3634a5..01550fd 100644
@@ -13,4 +13,15 @@ static inline struct clk_hw *imx_clk_hw_fixed(const char *name, int rate)
 	return clk_hw_register_fixed_rate(NULL, name, NULL, 0, rate);
 }
 
+static inline void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count)
+{
+	unsigned int i;
+
+	for (i = 0; i < count; i++) {
+		if (IS_ERR(clks[i]))
+			pr_err("i.MX clk %u: register failed with %ld\n",
+				i, PTR_ERR(clks[i]));
+	}
+}
+
 #endif /* __IMX_CLK_COMMON_H */
Signature · 1 line
2.7.4
#11 lore raw

PATCH 11/12 dt-bindings: clock: add imx8qxp clock binding doc

In reply to Dong Aisheng

Add imx8qxp clock binding doc.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc devicetree at vger.kernel.org
---
 .../devicetree/bindings/clock/imx8qxp-clk.txt      |  39 +++
 include/dt-bindings/clock/imx8qxp-clock.h          | 362 +++++++++++++++++++++
 2 files changed, 401 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8qxp-clk.txt
 create mode 100644 include/dt-bindings/clock/imx8qxp-clock.h
Documentation/devicetree/bindings/clock/imx8qxp-clk.txt new file +39 -0
new file mode 100644
index 0000000..5e365d7
@@ -0,0 +1,39 @@
+NXP i.MX8QXP Clocks Based on SCFW
+--------------------------------------------------------------------
+
+Some i.MX SoCs contain a system controller that is responsible for
+providing clock control service for the IPs. Communication between
+the host processor running an OS and the system controller happens
+through a SCU protocol [1].
+
+[1] Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
+
+Required properties:
+
+- compatible:	Should be "fsl,imx8qxp-clock".
+- #clock-cells:	Should be <1>.
+
+The clock consumer should specify the desired clock by having the clock
+ID in its "clocks" phandle cell.
+See include/dt-bindings/clock/imx8qxp-clock.h
+for the full list of i.MX8QXP clock IDs.
+
+Examples:
+
+#include <dt-bindings/clock/imx8qxp-clock.h>
+
+clk: clk {
+	compatible = "fsl,imx8qxp-clk";
+	#clock-cells = <1>;
+};
+
+i2c0: i2c at 5a800000 {
+	compatible = "fsl,imx8qxp-lpi2c", "fsl,imx7ulp-lpi2c";
+	reg = <0x0 0x5a800000 0x0 0x4000>;
+	interrupts = <GIC_SPI 220 IRQ_TYPE_LEVEL_HIGH>;
+	interrupt-parent = <&gic>;
+	clocks = <&clk IMX8QXP_I2C0_CLK>,
+		 <&clk IMX8QXP_I2C0_IPG_CLK>;
+	clock-names = "per", "ipg";
+	...
+};
include/dt-bindings/clock/imx8qxp-clock.h new file +362 -0

362 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#12 lore raw

PATCH 11/12 dt-bindings: clock: add imx8qxp clock binding doc

Quoted 28 lines · Dong Aisheng

Add imx8qxp clock binding doc.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc devicetree at vger.kernel.org
---
 .../devicetree/bindings/clock/imx8qxp-clk.txt      |  39 +++
 include/dt-bindings/clock/imx8qxp-clock.h          | 362 +++++++++++++++++++++
 2 files changed, 401 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8qxp-clk.txt
 create mode 100644 include/dt-bindings/clock/imx8qxp-clock.h
Documentation/devicetree/bindings/clock/imx8qxp-clk.txt new file +4 -0
new file mode 100644
index 0000000..5e365d7
@@ -0,0 +1,39 @@
+NXP i.MX8QXP Clocks Based on SCFW
+--------------------------------------------------------------------
+
+Some i.MX SoCs contain a system controller that is responsible for

Documentation/devicetree/bindings/clock/imx8qxp-clk.txt line 14

Quoted 10 lines
Documentation/devicetree/bindings/clock/imx8qxp-clk.txt new file +10 -0
+providing clock control service for the IPs. Communication between
+the host processor running an OS and the system controller happens
+through a SCU protocol [1].
+
+[1] Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
+
+Required properties:
+
+- compatible:	Should be "fsl,imx8qxp-clock".
+- #clock-cells:	Should be <1>.

There's no reason for this node. Just make the parent (SCU) a clock provider.

Quoted 25 lines
Documentation/devicetree/bindings/clock/imx8qxp-clk.txt new file +25 -0
+
+The clock consumer should specify the desired clock by having the clock
+ID in its "clocks" phandle cell.
+See include/dt-bindings/clock/imx8qxp-clock.h
+for the full list of i.MX8QXP clock IDs.
+
+Examples:
+
+#include <dt-bindings/clock/imx8qxp-clock.h>
+
+clk: clk {
+	compatible = "fsl,imx8qxp-clk";
+	#clock-cells = <1>;
+};
+
+i2c0: i2c at 5a800000 {
+	compatible = "fsl,imx8qxp-lpi2c", "fsl,imx7ulp-lpi2c";
+	reg = <0x0 0x5a800000 0x0 0x4000>;
+	interrupts = <GIC_SPI 220 IRQ_TYPE_LEVEL_HIGH>;
+	interrupt-parent = <&gic>;
+	clocks = <&clk IMX8QXP_I2C0_CLK>,
+		 <&clk IMX8QXP_I2C0_IPG_CLK>;
+	clock-names = "per", "ipg";
+	...
+};
author
#13 lore raw

PATCH 11/12 dt-bindings: clock: add imx8qxp clock binding doc

Quoted 47 lines

-----Original Message-----
From: Rob Herring [mailto:robh at kernel.org]
Sent: Tuesday, May 1, 2018 11:37 PM
To: A.s. Dong <[email protected]>
Cc: linux-clk at vger.kernel.org; linux-arm-kernel at lists.infradead.org; sboyd at kernel.org; mturquette at baylibre.com; shawnguo at kernel.org; Fabio Estevam <[email protected]>; dl-linux-imx <[email protected]>; kernel at pengutronix.de; Mark Rutland <[email protected]>; devicetree at vger.kernel.org
Subject: Re: [PATCH 11/12] dt-bindings: clock: add imx8qxp clock binding doc

Quoted 11 lines · Dong Aisheng

Add imx8qxp clock binding doc.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
Cc Rob Herring <[email protected]>
Cc Mark Rutland <[email protected]>
Cc devicetree at vger.kernel.org
Quoted 3 lines
---
 .../devicetree/bindings/clock/imx8qxp-clk.txt      |  39 +++
 include/dt-bindings/clock/imx8qxp-clock.h          | 362

+++++++++++++++++++++

Quoted 20 lines
 2 files changed, 401 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/clock/imx8qxp-clk.txt
 create mode 100644 include/dt-bindings/clock/imx8qxp-clock.h
Documentation/devicetree/bindings/clock/imx8qxp-clk.txt new file +8 -0
new file mode 100644
index 0000000..5e365d7
@@ -0,0 +1,39 @@
+NXP i.MX8QXP Clocks Based on SCFW
+--------------------------------------------------------------------
+
+Some i.MX SoCs contain a system controller that is responsible for
+providing clock control service for the IPs. Communication between
+the host processor running an OS and the system controller happens
+through a SCU protocol [1].
+
Quoted 9 lines

Documentation/devicetree/bindings/clock/imx8qxp-clk.txt line 14

Quoted 6 lines
Documentation/devicetree/bindings/clock/imx8qxp-clk.txt new file +6 -0
+[1] Documentation/devicetree/bindings/arm/freescale/fsl,scu.txt
+
+Required properties:
+
+- compatible:	Should be "fsl,imx8qxp-clock".
+- #clock-cells:	Should be <1>.

There's no reason for this node. Just make the parent (SCU) a clock provider.

It can be done, but do I need to also remove other nodes like pinctrl, power domain in the same sub-nodes Of SCU?

BTW i saw arm,scpi.txt also keep the clk node under scpi node. Documentation/devicetree/bindings/arm/arm,scpi.txt

Seems like SCU like ARM SCPI is more like a protocol node while still needs different drivers to provide services.

Regards
Dong Aisheng

Quoted 25 lines
Quoted 25 lines
Documentation/devicetree/bindings/clock/imx8qxp-clk.txt new file +25 -0
+
+The clock consumer should specify the desired clock by having the
+clock ID in its "clocks" phandle cell.
+See include/dt-bindings/clock/imx8qxp-clock.h
+for the full list of i.MX8QXP clock IDs.
+
+Examples:
+
+#include <dt-bindings/clock/imx8qxp-clock.h>
+
+clk: clk {
+	compatible = "fsl,imx8qxp-clk";
+	#clock-cells = <1>;
+};
+
+i2c0: i2c at 5a800000 {
+	compatible = "fsl,imx8qxp-lpi2c", "fsl,imx7ulp-lpi2c";
+	reg = <0x0 0x5a800000 0x0 0x4000>;
+	interrupts = <GIC_SPI 220 IRQ_TYPE_LEVEL_HIGH>;
+	interrupt-parent = <&gic>;
+	clocks = <&clk IMX8QXP_I2C0_CLK>,
+		 <&clk IMX8QXP_I2C0_IPG_CLK>;
+	clock-names = "per", "ipg";
+	...
+};
#14 lore raw

PATCH 12/12 clk: imx: add imx8qxp clk driver

In reply to Dong Aisheng

Add imx8qxp clk driver which is based on SCU firmware clock service.

Cc Shawn Guo <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stephen Boyd <[email protected]>
Cc Michael Turquette <[email protected]>
---
 drivers/clk/imx/scu/Makefile      |   2 +
 drivers/clk/imx/scu/clk-imx8qxp.c | 426 ++++++++++++++++++++++++++++++++++++++
 include/soc/imx/imx8qxp/lpcg.h    | 186 +++++++++++++++++
 3 files changed, 614 insertions(+)
 create mode 100644 drivers/clk/imx/scu/clk-imx8qxp.c
 create mode 100644 include/soc/imx/imx8qxp/lpcg.h
drivers/clk/imx/scu/Makefile +2 -0
index a76ed78..68e2d7f 100644
@@ -8,3 +8,5 @@ obj-$(CONFIG_MXC_CLK_SCU) += \
 	clk-gate-gpr-scu.o \
 	clk-mux-scu.o \
 	clk-mux-gpr-scu.o
+
+obj-$(CONFIG_SOC_IMX8QXP)	+= clk-imx8qxp.o
drivers/clk/imx/scu/clk-imx8qxp.c new file +426 -0

426 lines not on this page · raw message

include/soc/imx/imx8qxp/lpcg.h new file +186 -0

186 lines not on this page · raw message

Signature · 1 line
2.7.4
#15 lore raw

cover clk: imx: add imx8qxp clock support

In reply to Dong Aisheng

Hi,

same functionality is actually needed on iMX7d and many other non NXP socs.
IMO proper solution is to introduce generic clock proxy or some thing like this on top of rpmsg/virtio

Quoted 60 lines · Dong Aisheng

This patch series adds i.MX8QXP clock support which is based on the clock service provided by SCU firmware.
It depends on SCU APIs patch set.

Dong Aisheng (12):
clk: imx: add configuration option for mmio clks
clk: imx: scu: add scu clock common part
clk: imx: scu: add scu clock divider
clk: imx: scu: add scu clock gpr divider
clk: imx: scu: add scu clock gate
clk: imx: scu: add scu clock gpr gate
clk: imx: scu: add scu clock mux
clk: imx: scu: add scu clock gpr mux
clk: imx: add common imx_clk_hw_fixed functions
clk: imx: add imx_check_clk_hws helper function
dt-bindings: clock: add imx8qxp clock binding doc
clk: imx: add imx8qxp clk driver

 .../devicetree/bindings/clock/imx8qxp-clk.txt      |  39 ++
 arch/arm/mach-imx/Kconfig                          |  10 +
 drivers/clk/Kconfig                                |   1 +
 drivers/clk/imx/Kconfig                            |   7 +
 drivers/clk/imx/Makefile                           |   4 +-
 drivers/clk/imx/clk-common.h                       |  27 ++
 drivers/clk/imx/scu/Kconfig                        |   5 +
 drivers/clk/imx/scu/Makefile                       |  12 +
 drivers/clk/imx/scu/clk-divider-gpr-scu.c          | 131 +++++++
 drivers/clk/imx/scu/clk-divider-scu.c              | 129 +++++++
 drivers/clk/imx/scu/clk-gate-gpr-scu.c             |  84 ++++
 drivers/clk/imx/scu/clk-gate-scu.c                 | 193 ++++++++++
 drivers/clk/imx/scu/clk-imx8qxp.c                  | 426 +++++++++++++++++++++
 drivers/clk/imx/scu/clk-mux-gpr-scu.c              |  90 +++++
 drivers/clk/imx/scu/clk-mux-scu.c                  |  89 +++++
 drivers/clk/imx/scu/clk-scu.c                      |  25 ++
 drivers/clk/imx/scu/clk-scu.h                      |  97 +++++
 include/dt-bindings/clock/imx8qxp-clock.h          | 362 +++++++++++++++++
 include/soc/imx/imx8qxp/lpcg.h                     | 186 +++++++++
 19 files changed, 1916 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8qxp-clk.txt
 create mode 100644 drivers/clk/imx/Kconfig
 create mode 100644 drivers/clk/imx/clk-common.h
 create mode 100644 drivers/clk/imx/scu/Kconfig
 create mode 100644 drivers/clk/imx/scu/Makefile
 create mode 100644 drivers/clk/imx/scu/clk-divider-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-divider-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-gate-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-gate-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-imx8qxp.c
 create mode 100644 drivers/clk/imx/scu/clk-mux-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-mux-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-scu.h
 create mode 100644 include/dt-bindings/clock/imx8qxp-clock.h
 create mode 100644 include/soc/imx/imx8qxp/lpcg.h
Signature · 1 line
2.7.4
Signature · 11 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180501/ca47fb4d/attachment.sig>
#16 lore raw

cover clk: imx: add imx8qxp clock support

Quoted 4 lines · Oleksij Rempel

Hi,

same functionality is actually needed on iMX7d and many other non NXP socs.

How is this needed on iMX7D?

Afaik, on i.MX8QXP Linux does not have any direct access to the clock registers. It is all managed by SCU. However, on i.MX 7 Linux as is today accesses the clocks registers directly...

Quoted 2 lines

IMO proper solution is to introduce generic clock proxy or some thing like this on top of rpmsg/virtio

Given that NXP already used rpmsg in the past, I was wondering too why a new messaging mechanism had to be invented.

Dong, do you know why?

--
Stefan

Quoted 67 lines · Dong Aisheng
Quoted 55 lines

This patch series adds i.MX8QXP clock support which is based on the clock service provided by SCU firmware.
It depends on SCU APIs patch set.

Dong Aisheng (12):
clk: imx: add configuration option for mmio clks
clk: imx: scu: add scu clock common part
clk: imx: scu: add scu clock divider
clk: imx: scu: add scu clock gpr divider
clk: imx: scu: add scu clock gate
clk: imx: scu: add scu clock gpr gate
clk: imx: scu: add scu clock mux
clk: imx: scu: add scu clock gpr mux
clk: imx: add common imx_clk_hw_fixed functions
clk: imx: add imx_check_clk_hws helper function
dt-bindings: clock: add imx8qxp clock binding doc
clk: imx: add imx8qxp clk driver

 .../devicetree/bindings/clock/imx8qxp-clk.txt      |  39 ++
 arch/arm/mach-imx/Kconfig                          |  10 +
 drivers/clk/Kconfig                                |   1 +
 drivers/clk/imx/Kconfig                            |   7 +
 drivers/clk/imx/Makefile                           |   4 +-
 drivers/clk/imx/clk-common.h                       |  27 ++
 drivers/clk/imx/scu/Kconfig                        |   5 +
 drivers/clk/imx/scu/Makefile                       |  12 +
 drivers/clk/imx/scu/clk-divider-gpr-scu.c          | 131 +++++++
 drivers/clk/imx/scu/clk-divider-scu.c              | 129 +++++++
 drivers/clk/imx/scu/clk-gate-gpr-scu.c             |  84 ++++
 drivers/clk/imx/scu/clk-gate-scu.c                 | 193 ++++++++++
 drivers/clk/imx/scu/clk-imx8qxp.c                  | 426 +++++++++++++++++++++
 drivers/clk/imx/scu/clk-mux-gpr-scu.c              |  90 +++++
 drivers/clk/imx/scu/clk-mux-scu.c                  |  89 +++++
 drivers/clk/imx/scu/clk-scu.c                      |  25 ++
 drivers/clk/imx/scu/clk-scu.h                      |  97 +++++
 include/dt-bindings/clock/imx8qxp-clock.h          | 362 +++++++++++++++++
 include/soc/imx/imx8qxp/lpcg.h                     | 186 +++++++++
 19 files changed, 1916 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8qxp-clk.txt
 create mode 100644 drivers/clk/imx/Kconfig
 create mode 100644 drivers/clk/imx/clk-common.h
 create mode 100644 drivers/clk/imx/scu/Kconfig
 create mode 100644 drivers/clk/imx/scu/Makefile
 create mode 100644 drivers/clk/imx/scu/clk-divider-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-divider-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-gate-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-gate-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-imx8qxp.c
 create mode 100644 drivers/clk/imx/scu/clk-mux-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-mux-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-scu.h
 create mode 100644 include/dt-bindings/clock/imx8qxp-clock.h
 create mode 100644 include/soc/imx/imx8qxp/lpcg.h
Quoted 5 lines

--
2.7.4

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#17 lore raw

cover clk: imx: add imx8qxp clock support

Quoted 11 lines · Stefan Agner
Quoted 4 lines · Oleksij Rempel

Hi,

same functionality is actually needed on iMX7d and many other non NXP socs.

How is this needed on iMX7D?

Afaik, on i.MX8QXP Linux does not have any direct access to the clock registers. It is all managed by SCU. However, on i.MX 7 Linux as is today accesses the clocks registers directly...

iMX7D and iMX6SX provide access to same register set from Cortex A and Cortex M side. Since it is just dangerous to toggle same bits from two systems, only one should control it. After implementing imx_rproc driver and bringing up system on Cortex M4 side, we faced a problem of needing to properly control clocks and pins for other side. Clocks and pins should be configured only if some functionality is requested, so we can't just force defaults which will always work.
I assume that only right solution for this problem is to introduce some generic clock-to-rpmsg, pinmux-to-rpmsg bridge. So far I know, many system vendors have same problem with different SoCs (Renesas, TI, ST, QCOM) and I assume it is a generic AMP issue. If each vendor will upstream firmware specific kernel side implementation to solve common problem, we will have tons on unmaintainable SoC/Firmware specific code.

Quoted 79 lines
Quoted 2 lines

IMO proper solution is to introduce generic clock proxy or some thing like this on top of rpmsg/virtio

Given that NXP already used rpmsg in the past, I was wondering too why a new messaging mechanism had to be invented.

Dong, do you know why?

--
Stefan

Quoted 67 lines · Dong Aisheng
Quoted 55 lines

This patch series adds i.MX8QXP clock support which is based on the clock service provided by SCU firmware.
It depends on SCU APIs patch set.

Dong Aisheng (12):
clk: imx: add configuration option for mmio clks
clk: imx: scu: add scu clock common part
clk: imx: scu: add scu clock divider
clk: imx: scu: add scu clock gpr divider
clk: imx: scu: add scu clock gate
clk: imx: scu: add scu clock gpr gate
clk: imx: scu: add scu clock mux
clk: imx: scu: add scu clock gpr mux
clk: imx: add common imx_clk_hw_fixed functions
clk: imx: add imx_check_clk_hws helper function
dt-bindings: clock: add imx8qxp clock binding doc
clk: imx: add imx8qxp clk driver

 .../devicetree/bindings/clock/imx8qxp-clk.txt      |  39 ++
 arch/arm/mach-imx/Kconfig                          |  10 +
 drivers/clk/Kconfig                                |   1 +
 drivers/clk/imx/Kconfig                            |   7 +
 drivers/clk/imx/Makefile                           |   4 +-
 drivers/clk/imx/clk-common.h                       |  27 ++
 drivers/clk/imx/scu/Kconfig                        |   5 +
 drivers/clk/imx/scu/Makefile                       |  12 +
 drivers/clk/imx/scu/clk-divider-gpr-scu.c          | 131 +++++++
 drivers/clk/imx/scu/clk-divider-scu.c              | 129 +++++++
 drivers/clk/imx/scu/clk-gate-gpr-scu.c             |  84 ++++
 drivers/clk/imx/scu/clk-gate-scu.c                 | 193 ++++++++++
 drivers/clk/imx/scu/clk-imx8qxp.c                  | 426 +++++++++++++++++++++
 drivers/clk/imx/scu/clk-mux-gpr-scu.c              |  90 +++++
 drivers/clk/imx/scu/clk-mux-scu.c                  |  89 +++++
 drivers/clk/imx/scu/clk-scu.c                      |  25 ++
 drivers/clk/imx/scu/clk-scu.h                      |  97 +++++
 include/dt-bindings/clock/imx8qxp-clock.h          | 362 +++++++++++++++++
 include/soc/imx/imx8qxp/lpcg.h                     | 186 +++++++++
 19 files changed, 1916 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/imx8qxp-clk.txt
 create mode 100644 drivers/clk/imx/Kconfig
 create mode 100644 drivers/clk/imx/clk-common.h
 create mode 100644 drivers/clk/imx/scu/Kconfig
 create mode 100644 drivers/clk/imx/scu/Makefile
 create mode 100644 drivers/clk/imx/scu/clk-divider-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-divider-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-gate-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-gate-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-imx8qxp.c
 create mode 100644 drivers/clk/imx/scu/clk-mux-gpr-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-mux-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-scu.c
 create mode 100644 drivers/clk/imx/scu/clk-scu.h
 create mode 100644 include/dt-bindings/clock/imx8qxp-clock.h
 create mode 100644 include/soc/imx/imx8qxp/lpcg.h
Quoted 5 lines

--
2.7.4

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 11 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180501/5ea31b9b/attachment.sig>