Skip to contentSkip to conversation

i.MX8MM + CCF

PATCH New Peng Fan 4 participants 84 messages Apr 30, 2019 – May 16, 2019

Subsystems (6)
lore
Share & tools
lore

Peng Fan

author reviewer
#0 lore raw

cover i.MX8MM + CCF

This patch set is based Lukasz V3 CCF patchset,
[PATCH v3 00/11] clk: Port Linux common clock framework [CCF] to U-boot (tag: 5.0-rc3)
https://github.com/lmajewski/u-boot-dfu/commits/CCF-v3

Added a few fixes to Lukasz's v3 patchset.
Introduced clk-gate/composite
Added set rate support
Per my understanding, U-Boot CCF will not support mux reparent, and support rate prograte setting to parent automatically. So new clk feature added follow this rule.

There are many warnings when importing linux ccf code, I did not modify them all.

The rest patches are for i.MX8MM, part of legacy clk code are still kept, because we are hard to enable CCF at very early stage, we set malloc space to DRAM when dram initialized in spl stage, so we have limited SRAM for uclass dm and dm clk, so keep the DRAM PLL related setting with legacy clk code which use small ram.

The u-boot-spl.bin now is about 100KB without ddr firmware,usb stack and hab, so really large......
I am thinking what we could do to shrink the size, welcome any suggestions.

Not expect this patchset could be merged, because of the CCF/clock code change, but since the clock part blocks i.MX8MM upstream, just would like to speed up the development with community and move on.

Peng Fan (40):
clk: correct get clk_x pointer
clk: fixed-factor: fix get clk_fixed_factor
clk: introduce clk_dev_binded
clk: use clk_dev_binded
clk-provider: sync more clk flags from Linux Kernel
cmd: clk: print err value when clk_get_rate failed
clk: mux: add set parent support
clk: export mux/divider ops
clk: add clk-gate support
divider set rate supporrt
clk: fixed_rate: export clk_fixed_rate
clk: fixed_rate: add pre reloc flag
clk: imx: import clk heplers
clk: imx: gate2 add set rate
linux: compat: guard PAGE_SIZE
drivers: core: use strcmp when find device by name
ddr: imx8m: fix ddr firmware location when enable SPL OF
imx: add IMX8MQ kconfig entry
imx: add IMX8MM kconfig entry
imx: imx8mm: add clock bindings header
imx: add i.MX8MM cpu type
imx: spl: add spl_board_boot_device for i.MX8MM
imx8m: update imx-regs for i.MX8MM
imx: add get_cpu_rev support for i.MX8MM
imx8m: rename clock to clock_imx8mq
imx8m: restructure clock.h
imx8m: add clk support for i.MX8MM
imx8m: soc: probe clk before relocation
imx8m: add pin header for i.MX8MM
imx: add i.MX8MM PE property
imx8m: Fix MMU table issue for OPTEE memory
imx8m: set BYPASS ID SWAP to avoid AXI bus errors
imx8m: soc: enable SCTR clock before timer init
serial: Kconfig: make MXC_UART usable for MX7 and IMX8M
clk: imx: add Kconfig entry for i.MX8MM
clk: imx: add pll14xx driver
clk: add composite clk support
clk: imx: add i.MX8MM composite clk support
clk: imx: add i.MX8MM clk driver
imx: add i.MX8MM EVK board support

Ye Li (1):
imx8m: Configure trustzone region 0 for non-secure access

 arch/arm/dts/Makefile                              |    3 +-
 arch/arm/dts/imx8mm-evk-u-boot.dtsi                |   92 +
 arch/arm/dts/imx8mm-evk.dts                        |  235 +++
 arch/arm/dts/imx8mm-pinfunc.h                      |  629 +++++++
 arch/arm/dts/imx8mm.dtsi                           |  733 ++++++++
 arch/arm/include/asm/arch-imx/cpu.h                |    6 +
 arch/arm/include/asm/arch-imx8m/clock.h            |  493 +----
 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h     |  387 ++++
 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h     |  424 +++++
 arch/arm/include/asm/arch-imx8m/imx-regs.h         |   75 +-
 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h      |  691 +++++++
 arch/arm/include/asm/mach-imx/iomux-v3.h           |    4 +
 arch/arm/include/asm/mach-imx/sys_proto.h          |    8 +
 arch/arm/mach-imx/cpu.c                            |   12 +
 arch/arm/mach-imx/imx8m/Kconfig                    |   17 +-
 arch/arm/mach-imx/imx8m/Makefile                   |    4 +-
 arch/arm/mach-imx/imx8m/clock_imx8mm.c             |  292 +++
 .../arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} |    5 +-
 arch/arm/mach-imx/imx8m/clock_slice.c              |  461 +++++
 arch/arm/mach-imx/imx8m/soc.c                      |  112 +-
 arch/arm/mach-imx/spl.c                            |    8 +
 board/freescale/imx8mm_evk/Kconfig                 |   12 +
 board/freescale/imx8mm_evk/MAINTAINERS             |    6 +
 board/freescale/imx8mm_evk/Makefile                |   12 +
 board/freescale/imx8mm_evk/imx8mm_evk.c            |   90 +
 board/freescale/imx8mm_evk/lpddr4_timing.c         | 1980 ++++++++++++++++++++
 board/freescale/imx8mm_evk/spl.c                   |  216 +++
 cmd/clk.c                                          |    2 +
 configs/imx8mm_evk_defconfig                       |   52 +
 drivers/clk/Kconfig                                |   14 +
 drivers/clk/Makefile                               |    3 +-
 drivers/clk/clk-composite.c                        |  165 ++
 drivers/clk/clk-divider.c                          |   92 +-
 drivers/clk/clk-fixed-factor.c                     |    2 +-
 drivers/clk/clk-gate.c                             |  151 ++
 drivers/clk/clk-mux.c                              |   76 +-
 drivers/clk/clk.c                                  |    8 +
 drivers/clk/clk_fixed_rate.c                       |    9 +-
 drivers/clk/imx/Kconfig                            |    9 +
 drivers/clk/imx/Makefile                           |    1 +
 drivers/clk/imx/clk-composite-8m.c                 |  170 ++
 drivers/clk/imx/clk-gate2.c                        |   15 +-
 drivers/clk/imx/clk-imx8mm.c                       |  415 ++++
 drivers/clk/imx/clk-pfd.c                          |    2 +-
 drivers/clk/imx/clk-pll14xx.c                      |  377 ++++
 drivers/clk/imx/clk-pllv3.c                        |    2 +-
 drivers/clk/imx/clk.h                              |  106 ++
 drivers/core/uclass.c                              |    2 +-
 drivers/ddr/imx/imx8m/helper.c                     |   12 +-
 drivers/serial/Kconfig                             |    2 +-
 include/clk.h                                      |    9 +
 include/configs/imx8mm_evk.h                       |  199 ++
 include/dt-bindings/clock/imx8mm-clock.h           |  244 +++
 include/linux/clk-provider.h                       |   74 +
 include/linux/compat.h                             |    2 +
 55 files changed, 8728 insertions(+), 494 deletions(-)
 create mode 100644 arch/arm/dts/imx8mm-evk-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-evk.dts
 create mode 100644 arch/arm/dts/imx8mm-pinfunc.h
 create mode 100644 arch/arm/dts/imx8mm.dtsi
 create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h
 create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h
 create mode 100644 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h
 create mode 100644 arch/arm/mach-imx/imx8m/clock_imx8mm.c
 rename arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} (99%)
 create mode 100644 board/freescale/imx8mm_evk/Kconfig
 create mode 100644 board/freescale/imx8mm_evk/MAINTAINERS
 create mode 100644 board/freescale/imx8mm_evk/Makefile
 create mode 100644 board/freescale/imx8mm_evk/imx8mm_evk.c
 create mode 100644 board/freescale/imx8mm_evk/lpddr4_timing.c
 create mode 100644 board/freescale/imx8mm_evk/spl.c
 create mode 100644 configs/imx8mm_evk_defconfig
 create mode 100644 drivers/clk/clk-composite.c
 create mode 100644 drivers/clk/clk-gate.c
 create mode 100644 drivers/clk/imx/clk-composite-8m.c
 create mode 100644 drivers/clk/imx/clk-imx8mm.c
 create mode 100644 drivers/clk/imx/clk-pll14xx.c
 create mode 100644 include/configs/imx8mm_evk.h
 create mode 100644 include/dt-bindings/clock/imx8mm-clock.h
Signature · 1 line
2.16.4
author reviewer
#1 lore raw

PATCH 1/41 clk: correct get clk_x pointer

Directly use driver data is wrong, need to the helper to get the correct clk_divider and etc

---
 drivers/clk/clk-divider.c   | 2 +-
 drivers/clk/imx/clk-gate2.c | 4 ++--
 drivers/clk/imx/clk-pfd.c   | 2 +-
 drivers/clk/imx/clk-pllv3.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/clk/clk-divider.c +1 -1
index 3841d8bfbb..1d2c1b1ec4 100644
@@ -70,7 +70,7 @@ unsigned long divider_recalc_rate(struct clk *hw, unsigned long parent_rate,
 static ulong clk_divider_recalc_rate(struct clk *clk)
 {
 	struct clk_divider *divider =
-		(struct clk_divider *)dev_get_driver_data(clk->dev);
+		to_clk_divider((struct clk *)dev_get_driver_data(clk->dev));
 	unsigned long parent_rate = clk_get_parent_rate(clk);
 	unsigned int val;
 
drivers/clk/imx/clk-gate2.c +2 -2
index 1e53e4f9db..83589b9206 100644
@@ -38,7 +38,7 @@ struct clk_gate2 {
 static int clk_gate2_enable(struct clk *clk)
 {
 	struct clk_gate2 *gate =
-		(struct clk_gate2 *)dev_get_driver_data(clk->dev);
+		to_clk_gate2((struct clk *)dev_get_driver_data(clk->dev));
 	u32 reg;
 
 	reg = readl(gate->reg);
@@ -52,7 +52,7 @@ static int clk_gate2_enable(struct clk *clk)
 static int clk_gate2_disable(struct clk *clk)
 {
 	struct clk_gate2 *gate =
-		(struct clk_gate2 *)dev_get_driver_data(clk->dev);
+		to_clk_gate2((struct clk *)dev_get_driver_data(clk->dev));
 	u32 reg;
 
 	reg = readl(gate->reg);
drivers/clk/imx/clk-pfd.c +1 -1
index 2293d481d4..51521ccee6 100644
@@ -41,7 +41,7 @@ struct clk_pfd {
 static unsigned long clk_pfd_recalc_rate(struct clk *clk)
 {
 	struct clk_pfd *pfd =
-		(struct clk_pfd *)dev_get_driver_data(clk->dev);
+		to_clk_pfd((struct clk *)dev_get_driver_data(clk->dev));
 	unsigned long parent_rate = clk_get_parent_rate(clk);
 	u64 tmp = parent_rate;
 	u8 frac = (readl(pfd->reg) >> (pfd->idx * 8)) & 0x3f;
drivers/clk/imx/clk-pllv3.c +1 -1
index 3fe9b7c03d..28c0439878 100644
@@ -27,7 +27,7 @@ struct clk_pllv3 {
 static ulong clk_pllv3_get_rate(struct clk *clk)
 {
 	struct clk_pllv3 *pll =
-		(struct clk_pllv3 *)dev_get_driver_data(clk->dev);
+		to_clk_pllv3((struct clk *)dev_get_driver_data(clk->dev));
 	unsigned long parent_rate = clk_get_parent_rate(clk);
 
 	u32 div = (readl(pll->base) >> pll->div_shift) & pll->div_mask;
Signature · 1 line
2.16.4
#2 lore raw

PATCH 1/41 clk: correct get clk_x pointer

Hi Peng,

Quoted 2 lines

Directly use driver data is wrong, need to the helper to get the correct clk_divider and etc

I just followed the kernel approach.

This works as the address of first element of struct clk_XXX is always struct clk clk address;

But yes, this may be the preferred (more readable) approach.

Quoted 70 lines
---
 drivers/clk/clk-divider.c   | 2 +-
 drivers/clk/imx/clk-gate2.c | 4 ++--
 drivers/clk/imx/clk-pfd.c   | 2 +-
 drivers/clk/imx/clk-pllv3.c | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/clk/clk-divider.c +0 -0
index 3841d8bfbb..1d2c1b1ec4 100644
@@ -70,7 +70,7 @@ unsigned long divider_recalc_rate(struct clk *hw,

unsigned long parent_rate, static ulong
clk_divider_recalc_rate(struct clk *clk) {

drivers/clk/clk-divider.c +1 -1
 	struct clk_divider *divider =
-		(struct clk_divider *)dev_get_driver_data(clk->dev);
+		to_clk_divider((struct clk

*)dev_get_driver_data(clk->dev)); unsigned long parent_rate = clk_get_parent_rate(clk); unsigned int val;

drivers/clk/imx/clk-gate2.c +2 -2
index 1e53e4f9db..83589b9206 100644
@@ -38,7 +38,7 @@ struct clk_gate2 {
 static int clk_gate2_enable(struct clk *clk)
 {
 	struct clk_gate2 *gate =
-		(struct clk_gate2 *)dev_get_driver_data(clk->dev);
+		to_clk_gate2((struct clk
 *)dev_get_driver_data(clk->dev)); u32 reg;
 
 	reg = readl(gate->reg);
@@ -52,7 +52,7 @@ static int clk_gate2_enable(struct clk *clk)
 static int clk_gate2_disable(struct clk *clk)
 {
 	struct clk_gate2 *gate =
-		(struct clk_gate2 *)dev_get_driver_data(clk->dev);
+		to_clk_gate2((struct clk
 *)dev_get_driver_data(clk->dev)); u32 reg;
 
 	reg = readl(gate->reg);
drivers/clk/imx/clk-pfd.c +1 -1
index 2293d481d4..51521ccee6 100644
@@ -41,7 +41,7 @@ struct clk_pfd {
 static unsigned long clk_pfd_recalc_rate(struct clk *clk)
 {
 	struct clk_pfd *pfd =
-		(struct clk_pfd *)dev_get_driver_data(clk->dev);
+		to_clk_pfd((struct clk
 *)dev_get_driver_data(clk->dev)); unsigned long parent_rate =
 clk_get_parent_rate(clk); u64 tmp = parent_rate;
 	u8 frac = (readl(pfd->reg) >> (pfd->idx * 8)) & 0x3f;
drivers/clk/imx/clk-pllv3.c +1 -1
index 3fe9b7c03d..28c0439878 100644
@@ -27,7 +27,7 @@ struct clk_pllv3 {
 static ulong clk_pllv3_get_rate(struct clk *clk)
 {
 	struct clk_pllv3 *pll =
-		(struct clk_pllv3 *)dev_get_driver_data(clk->dev);
+		to_clk_pllv3((struct clk
 *)dev_get_driver_data(clk->dev)); unsigned long parent_rate =
 clk_get_parent_rate(clk); 
 	u32 div = (readl(pll->base) >> pll->div_shift) &
Quoted 1 line

pll->div_mask;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190506/97a5ff1c/attachment.sig>

author reviewer
#3 lore raw

PATCH 2/41 clk: fixed-factor: fix get clk_fixed_factor

In reply to Peng Fan

driver data is not clk, not clk_fixed_factor, fix it.

---
 drivers/clk/clk-fixed-factor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-fixed-factor.c +1 -1
index acbc0909b4..c535aadc48 100644
@@ -19,7 +19,7 @@
 static ulong clk_factor_recalc_rate(struct clk *clk)
 {
 	struct clk_fixed_factor *fix =
-		(struct clk_fixed_factor *)dev_get_driver_data(clk->dev);
+		to_clk_fixed_factor((struct clk *)dev_get_driver_data(clk->dev));
 	unsigned long parent_rate = clk_get_parent_rate(clk);
 	unsigned long long int rate;
 
Signature · 1 line
2.16.4
#4 lore raw

PATCH 2/41 clk: fixed-factor: fix get clk_fixed_factor

Quoted 1 line · On Tue, 30 Apr 2019 10:17:36 +0000 Peng Fan <[email protected]> wrote:

driver data is not clk, not clk_fixed_factor, fix it.

This description is a bit misleading, IMHO.

The dev->driver_data holds pointer to corresponding struct clk clk element (as described [1]).

This patch resembles changes from PATCH [1/42].

Quoted 12 lines
---
 drivers/clk/clk-fixed-factor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/clk/clk-fixed-factor.c index acbc0909b4..c535aadc48 100644

drivers/clk/clk-fixed-factor.c line 25

Quoted 8 lines
drivers/clk/clk-fixed-factor.c +1 -1
@@ -19,7 +19,7 @@
 static ulong clk_factor_recalc_rate(struct clk *clk)
 {
 	struct clk_fixed_factor *fix =
-		(struct clk_fixed_factor
 *)dev_get_driver_data(clk->dev);
+		to_clk_fixed_factor((struct clk
 *)dev_get_driver_data(clk->dev)); unsigned long parent_rate =
 clk_get_parent_rate(clk); unsigned long long int rate;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190506/7e0be5fa/attachment.sig>

author reviewer
#5 lore raw

PATCH 3/41 clk: introduce clk_dev_binded

In reply to Peng Fan

When support Clock Common Framework, U-Boot use dev for clk tree information, there is no clk->parent. When support composite clk, it contains mux/gate/divider, but the mux/gate/divider is not binded with device. So we could not use dev_get_driver_data to get the correct clk_mux/gate/divider. So add clk_dev_binded to let choose the correct method.

---
 drivers/clk/clk.c | 8 ++++++++
 include/clk.h     | 9 +++++++++
 2 files changed, 17 insertions(+)
drivers/clk/clk.c +8 -0
index 0a0fffb50b..025bb99ecc 100644
@@ -54,3 +54,11 @@ const char *clk_hw_get_name(const struct clk *hw)
 {
 	return hw->dev->name;
 }
+
+bool clk_dev_binded(struct clk *clk)
+{
+	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
+		return true;
+
+	return false;
+}
include/clk.h +9 -0
index a4ecca9fbc..8199119d01 100644
@@ -337,4 +337,13 @@ static inline bool clk_valid(struct clk *clk)
  * @return zero on success, or -ENOENT on error
  */
 int clk_get_by_id(ulong id, struct clk **clkp);
+
+/**
+ * clk_dev_binded() - Check whether the clk has a device binded
+ *
+ * @clk		A pointer to the clk
+ *
+ * @return true on binded, or false on no
+ */
+bool clk_dev_binded(struct clk *clk);
 #endif
Signature · 1 line
2.16.4
#6 lore raw

PATCH 3/41 clk: introduce clk_dev_binded

Quoted 2 lines · On Tue, 30 Apr 2019 10:17:40 +0000 Peng Fan <[email protected]> wrote:

When support Clock Common Framework, U-Boot use dev for clk tree information, there is no clk->parent.

There is a function in clk uclass named:
clk_get_parent() to provide parent of the clock.

Quoted 3 lines

When
support composite clk, it contains mux/gate/divider, but the mux/gate/divider is not binded with device.

There is a binding:

struct clk_pllv3 {
	struct clk	clk;
	...
};

The clk.dev points to corresponding device.

In the opposite direction we do have dev->driver_data, which points to struct clk embedded in for example struct clk_pllv3.
(as struct clk_pllv3 and struct clk share the same address it is up to us to cast it properly).

I've written my thoughts and considerations about using dev->private and dev->driver_data in the patch cover letter [1]

Quoted 2 lines

So we could not use dev_get_driver_data to get the correct clk_mux/gate/divider.

Maybe I've overlooked something, but dev_get_driver_data() shall provide correct reference to udevice.

Quoted 3 lines

So add clk_dev_binded to let
choose the correct method.

[1] - http://patchwork.ozlabs.org/cover/1090669/

Quoted 30 lines
---
 drivers/clk/clk.c | 8 ++++++++
 include/clk.h     | 9 +++++++++
 2 files changed, 17 insertions(+)
drivers/clk/clk.c +8 -0
index 0a0fffb50b..025bb99ecc 100644
@@ -54,3 +54,11 @@ const char *clk_hw_get_name(const struct clk *hw)
 {
 	return hw->dev->name;
 }
+
+bool clk_dev_binded(struct clk *clk)
+{
+	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
+		return true;
+
+	return false;
+}
include/clk.h +0 -0
index a4ecca9fbc..8199119d01 100644
@@ -337,4 +337,13 @@ static inline bool clk_valid(struct clk *clk)
  * @return zero on success, or -ENOENT on error
  */
 int clk_get_by_id(ulong id, struct clk **clkp);

include/clk.h static inline bool clk_valid(struct clk *clk) · line 349

Quoted 10 lines
include/clk.h +9 -0
+
+/**
+ * clk_dev_binded() - Check whether the clk has a device binded
+ *
+ * @clk		A pointer to the clk
+ *
+ * @return true on binded, or false on no
+ */
+bool clk_dev_binded(struct clk *clk);
 #endif

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190506/664e7444/attachment.sig>

author reviewer
#7 lore raw

PATCH 3/41 clk: introduce clk_dev_binded

Quoted 32 lines

Subject: Re: [i.MX8MM+CCF 03/41] clk: introduce clk_dev_binded

Quoted 2 lines · On Tue, 30 Apr 2019 10:17:40 +0000 Peng Fan <[email protected]> wrote:

When support Clock Common Framework, U-Boot use dev for clk tree information, there is no clk->parent.

There is a function in clk uclass named:
clk_get_parent() to provide parent of the clock.

Quoted 3 lines

When
support composite clk, it contains mux/gate/divider, but the mux/gate/divider is not binded with device.

There is a binding:

struct clk_pllv3 {
	struct clk	clk;
	...
};

The clk.dev points to corresponding device.

In the opposite direction we do have dev->driver_data, which points to struct clk embedded in for example struct clk_pllv3.
(as struct clk_pllv3 and struct clk share the same address it is up to us to cast it properly).

I've written my thoughts and considerations about using dev->private and dev->driver_data in the patch cover letter [1]

Quoted 5 lines
Quoted 2 lines

So we could not use dev_get_driver_data to get the correct clk_mux/gate/divider.

Maybe I've overlooked something, but dev_get_driver_data() shall provide correct reference to udevice.

A composite clk contains a mux/gate/divider clk. Only the composite clk needs to binded with a udevice. The mux/gate/divider inside a composite clk should not bind a device, because they needs to be hidden from dm tree or clk dumps.

If bind the mux/gate/divider insides a composite clk, that will be mess. The reason to introduce composite clk is to make clk tree cleaner/simplier.

Regards,
Peng.

Quoted 60 lines
Quoted 4 lines

So add clk_dev_binded to let
choose the correct method.

[1] - http://patchwork.ozlabs.org/cover/1090669/

Quoted 29 lines
---
 drivers/clk/clk.c | 8 ++++++++
 include/clk.h     | 9 +++++++++
 2 files changed, 17 insertions(+)
drivers/clk/clk.c index renamed from drivers/clk/clk.c +0 -0

0a0fffb50b..025bb99ecc 100644

drivers/clk/clk.c +8 -0
@@ -54,3 +54,11 @@ const char *clk_hw_get_name(const struct clk *hw)
 {
 	return hw->dev->name;
 }
+
+bool clk_dev_binded(struct clk *clk)
+{
+	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
+		return true;
+
+	return false;
+}
include/clk.h index renamed from include/clk.h +0 -0

a4ecca9fbc..8199119d01 100644

include/clk.h +0 -0
@@ -337,4 +337,13 @@ static inline bool clk_valid(struct clk *clk)
  * @return zero on success, or -ENOENT on error
  */

include/clk.h static inline bool clk_valid(struct clk *clk) · line 348

Quoted 10 lines
include/clk.h +8 -0
 int clk_get_by_id(ulong id, struct clk **clkp);
+
+/**
+ * clk_dev_binded() - Check whether the clk has a device binded
+ *
+ * @clk		A pointer to the clk
+ *
+ * @return true on binded, or false on no  */ bool
+clk_dev_binded(struct clk *clk);
 #endif

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#8 lore raw

PATCH 3/41 clk: introduce clk_dev_binded

Quoted 32 lines · On Tue, 7 May 2019 13:22:24 +0000 Peng Fan <[email protected]> wrote:
Quoted 32 lines

Subject: Re: [i.MX8MM+CCF 03/41] clk: introduce clk_dev_binded

Quoted 2 lines · On Tue, 30 Apr 2019 10:17:40 +0000 Peng Fan <[email protected]> wrote:

When support Clock Common Framework, U-Boot use dev for clk tree information, there is no clk->parent.

There is a function in clk uclass named:
clk_get_parent() to provide parent of the clock.

Quoted 3 lines

When
support composite clk, it contains mux/gate/divider, but the mux/gate/divider is not binded with device.

There is a binding:

struct clk_pllv3 {
	struct clk	clk;
	...
};

The clk.dev points to corresponding device.

In the opposite direction we do have dev->driver_data, which points to struct clk embedded in for example struct clk_pllv3. (as struct clk_pllv3 and struct clk share the same address it is up to us to cast it properly).

I've written my thoughts and considerations about using dev->private and dev->driver_data in the patch cover letter [1]

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

So we could not use dev_get_driver_data to get the correct clk_mux/gate/divider.

Maybe I've overlooked something, but dev_get_driver_data() shall provide correct reference to udevice.

A composite clk contains a mux/gate/divider clk. Only the composite clk needs to binded with a udevice.

So, if I understood correctly we do need to have another reference to udevice (or clock)?

Please correct my understanding:

- Composite clock would use clk->dev (to have pointer to struct udevice) and dev->driver_data to have pointer to clk.

- Then we use udevice flag DM_FLAG_BOUND to indicate if this device has other udevices (i.e. clk) bound.

- If it has bounded device then we use dev->driver_data to get it's struct clk (or clock IP - like mux). If not, then we just use this clk.

Considering the above - the commit message needs detailed explanation of the "binding" concept.

Quoted 6 lines

The mux/gate/divider inside a
composite clk should not bind a device, because they needs to be hidden from dm tree or clk dumps.

If bind the mux/gate/divider insides a composite clk, that will be mess.

But the composite clock itself would be printed in 'dm tree' ?

If yes, maybe we can add some kind of indication that it is a "container" and that it has some clocks "binded" ?

Quoted 2 lines

The reason to introduce composite clk is to make clk tree cleaner/simplier.

Ok. No problem with this.

Quoted 64 lines

Regards,
Peng.

Quoted 60 lines
Quoted 4 lines

So add clk_dev_binded to let
choose the correct method.

[1] - http://patchwork.ozlabs.org/cover/1090669/

Quoted 29 lines
---
 drivers/clk/clk.c | 8 ++++++++
 include/clk.h     | 9 +++++++++
 2 files changed, 17 insertions(+)
drivers/clk/clk.c index renamed from drivers/clk/clk.c +0 -0

0a0fffb50b..025bb99ecc 100644

drivers/clk/clk.c +8 -0
@@ -54,3 +54,11 @@ const char *clk_hw_get_name(const struct clk
 *hw) {
 	return hw->dev->name;
 }
+
+bool clk_dev_binded(struct clk *clk)
+{
+	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
+		return true;
+
+	return false;
+}
include/clk.h index renamed from include/clk.h +0 -0

a4ecca9fbc..8199119d01 100644

include/clk.h +0 -0
@@ -337,4 +337,13 @@ static inline bool clk_valid(struct clk *clk)
  * @return zero on success, or -ENOENT on error
  */

include/clk.h static inline bool clk_valid(struct clk *clk) · line 348

Quoted 10 lines
include/clk.h +8 -0
 int clk_get_by_id(ulong id, struct clk **clkp);
+
+/**
+ * clk_dev_binded() - Check whether the clk has a device binded
+ *
+ * @clk		A pointer to the clk
+ *
+ * @return true on binded, or false on no  */ bool
+clk_dev_binded(struct clk *clk);
 #endif  

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/362bed09/attachment.sig>

author reviewer
#9 lore raw

PATCH 3/41 clk: introduce clk_dev_binded

Quoted 49 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 15:31
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org; jagan at amarulasolutions.com; sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 03/41] clk: introduce clk_dev_binded

Quoted 35 lines · On Tue, 7 May 2019 13:22:24 +0000 Peng Fan <[email protected]> wrote:
Quoted 35 lines

Subject: Re: [i.MX8MM+CCF 03/41] clk: introduce clk_dev_binded

Quoted 2 lines · On Tue, 30 Apr 2019 10:17:40 +0000 Peng Fan <[email protected]> wrote:

When support Clock Common Framework, U-Boot use dev for clk tree information, there is no clk->parent.

There is a function in clk uclass named:
clk_get_parent() to provide parent of the clock.

Quoted 3 lines

When
support composite clk, it contains mux/gate/divider, but the mux/gate/divider is not binded with device.

There is a binding:

struct clk_pllv3 {
	struct clk	clk;
	...
};

The clk.dev points to corresponding device.

In the opposite direction we do have dev->driver_data, which points to struct clk embedded in for example struct clk_pllv3. (as struct clk_pllv3 and struct clk share the same address it is up to us to cast it properly).

I've written my thoughts and considerations about using dev->private and dev->driver_data in the patch cover letter [1]

Quoted 2 lines

So we could not use dev_get_driver_data to get the correct clk_mux/gate/divider.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Maybe I've overlooked something, but dev_get_driver_data() shall provide correct reference to udevice.

A composite clk contains a mux/gate/divider clk. Only the composite clk needs to binded with a udevice.

So, if I understood correctly we do need to have another reference to udevice (or clock)?

The composite clk structure

struct clk_composite {
        struct clk      clk;
        struct clk_ops  ops;

        struct clk      *mux;
        struct clk      *rate;
        struct clk      *gate;

        const struct clk_ops    *mux_ops;
        const struct clk_ops    *rate_ops;
        const struct clk_ops    *gate_ops;
};

Only the first clk needs to be binded with a udevice. The mux/rate/gate pointer is only used for composite clk internal usage and no udevice will be binded with them.

Quoted 5 lines

Please correct my understanding:

- Composite clock would use clk->dev (to have pointer to struct udevice) and dev->driver_data to have pointer to clk.

Yes, for the composite clk.

Quoted 3 lines

- Then we use udevice flag DM_FLAG_BOUND to indicate if this device has other udevices (i.e. clk) bound.

Yes, DM_FLAG_BOUND means the clk has a udevice binded.

Quoted 4 lines

- If it has bounded device then we use dev->driver_data to get it's struct clk (or clock IP - like mux). If not, then we just use this clk.

Yes.

Quoted 4 lines

Considering the above - the commit message needs detailed explanation of the "binding" concept.

Quoted 8 lines
Quoted 6 lines

The mux/gate/divider inside a
composite clk should not bind a device, because they needs to be hidden from dm tree or clk dumps.

If bind the mux/gate/divider insides a composite clk, that will be mess.

But the composite clock itself would be printed in 'dm tree' ?

Yes.

Quoted 3 lines

If yes, maybe we can add some kind of indication that it is a "container" and that it has some clocks "binded" ?

Looking at clk summary from Linux /sys/kernel/debug/clk/clk_summary, There is no flag shows that it is a composite clk or not.

I think only add a flag to show the clk is a container does not make much sense.

Thanks,
Peng.

Quoted 83 lines
Quoted 3 lines

The reason to introduce composite clk is to make clk tree cleaner/simplier.

Ok. No problem with this.

Quoted 63 lines

Regards,
Peng.

Quoted 59 lines
Quoted 4 lines

So add clk_dev_binded to let
choose the correct method.

[1] - http://patchwork.ozlabs.org/cover/1090669/

Quoted 28 lines
---
 drivers/clk/clk.c | 8 ++++++++
 include/clk.h     | 9 +++++++++
 2 files changed, 17 insertions(+)
drivers/clk/clk.c index renamed from drivers/clk/clk.c +0 -0

0a0fffb50b..025bb99ecc 100644

drivers/clk/clk.c +7 -0
@@ -54,3 +54,11 @@ const char *clk_hw_get_name(const struct clk
 *hw) {
 	return hw->dev->name;
 }
+
+bool clk_dev_binded(struct clk *clk) {
+	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
+		return true;
+
+	return false;
+}
include/clk.h index renamed from include/clk.h +0 -0

a4ecca9fbc..8199119d01 100644

include/clk.h +0 -0
@@ -337,4 +337,13 @@ static inline bool clk_valid(struct clk *clk)
  * @return zero on success, or -ENOENT on error
  */

include/clk.h static inline bool clk_valid(struct clk *clk) · line 348

Quoted 10 lines
include/clk.h +8 -0
 int clk_get_by_id(ulong id, struct clk **clkp);
+
+/**
+ * clk_dev_binded() - Check whether the clk has a device binded
+ *
+ * @clk		A pointer to the clk
+ *
+ * @return true on binded, or false on no  */ bool
+clk_dev_binded(struct clk *clk);
 #endif

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#10 lore raw

PATCH 3/41 clk: introduce clk_dev_binded

Quoted 111 lines · On Wed, 8 May 2019 07:41:18 +0000 Peng Fan <[email protected]> wrote:
Quoted 47 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 15:31
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org; jagan at amarulasolutions.com; sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 03/41] clk: introduce clk_dev_binded

Quoted 35 lines · On Tue, 7 May 2019 13:22:24 +0000 Peng Fan <[email protected]> wrote:
Quoted 35 lines

Subject: Re: [i.MX8MM+CCF 03/41] clk: introduce clk_dev_binded

Quoted 2 lines · On Tue, 30 Apr 2019 10:17:40 +0000 Peng Fan <[email protected]> wrote:

When support Clock Common Framework, U-Boot use dev for clk tree information, there is no clk->parent.

There is a function in clk uclass named:
clk_get_parent() to provide parent of the clock.

Quoted 3 lines

When
support composite clk, it contains mux/gate/divider, but the mux/gate/divider is not binded with device.

There is a binding:

struct clk_pllv3 {
	struct clk	clk;
	...
};

The clk.dev points to corresponding device.

In the opposite direction we do have dev->driver_data, which points to struct clk embedded in for example struct clk_pllv3. (as struct clk_pllv3 and struct clk share the same address it is up to us to cast it properly).

I've written my thoughts and considerations about using dev->private and dev->driver_data in the patch cover letter [1]

Quoted 2 lines

So we could not use dev_get_driver_data to get the correct clk_mux/gate/divider.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Maybe I've overlooked something, but dev_get_driver_data() shall provide correct reference to udevice.

A composite clk contains a mux/gate/divider clk. Only the composite clk needs to binded with a udevice.

So, if I understood correctly we do need to have another reference to udevice (or clock)?

The composite clk structure

struct clk_composite {
        struct clk      clk;
        struct clk_ops  ops;

        struct clk      *mux;
        struct clk      *rate;
        struct clk      *gate;

        const struct clk_ops    *mux_ops;
        const struct clk_ops    *rate_ops;
        const struct clk_ops    *gate_ops;
};

Only the first clk needs to be binded with a udevice. The mux/rate/gate pointer is only used for composite clk internal usage and no udevice will be binded with them.

Quoted 5 lines

Please correct my understanding:

- Composite clock would use clk->dev (to have pointer to struct udevice) and dev->driver_data to have pointer to clk.

Yes, for the composite clk.

Quoted 3 lines

- Then we use udevice flag DM_FLAG_BOUND to indicate if this device has other udevices (i.e. clk) bound.

Yes, DM_FLAG_BOUND means the clk has a udevice binded.

Quoted 4 lines

- If it has bounded device then we use dev->driver_data to get it's struct clk (or clock IP - like mux). If not, then we just use this clk.

Yes.

Quoted 4 lines

Considering the above - the commit message needs detailed explanation of the "binding" concept.

Quoted 8 lines
Quoted 6 lines

The mux/gate/divider inside a
composite clk should not bind a device, because they needs to be hidden from dm tree or clk dumps.

If bind the mux/gate/divider insides a composite clk, that will be mess.

But the composite clock itself would be printed in 'dm tree' ?

Yes.

Quoted 1 line
Quoted 8 lines
Quoted 2 lines

If yes, maybe we can add some kind of indication that it is a "container" and that it has some clocks "binded" ?

Looking at clk summary from Linux /sys/kernel/debug/clk/clk_summary, There is no flag shows that it is a composite clk or not.

I think only add a flag to show the clk is a container does not make much sense.

Ok. I see.

Quoted 89 lines

Thanks,
Peng.

Quoted 85 lines
Quoted 3 lines

The reason to introduce composite clk is to make clk tree cleaner/simplier.

Ok. No problem with this.

Quoted 65 lines

Regards,
Peng.

Quoted 61 lines
Quoted 4 lines

So add clk_dev_binded to let
choose the correct method.

[1] - http://patchwork.ozlabs.org/cover/1090669/

Quoted 33 lines
---
 drivers/clk/clk.c | 8 ++++++++
 include/clk.h     | 9 +++++++++
 2 files changed, 17 insertions(+)
drivers/clk/clk.c index renamed from drivers/clk/clk.c +0 -0

0a0fffb50b..025bb99ecc 100644

drivers/clk/clk.c +7 -0
@@ -54,3 +54,11 @@ const char *clk_hw_get_name(const struct
 clk *hw) {
 	return hw->dev->name;
 }
+
+bool clk_dev_binded(struct clk *clk) {
+	if (clk->dev && (clk->dev->flags & DM_FLAG_BOUND))
+		return true;
+
+	return false;
+}
include/clk.h index renamed from include/clk.h +0 -0

a4ecca9fbc..8199119d01 100644

include/clk.h +3 -0
@@ -337,4 +337,13 @@ static inline bool clk_valid(struct clk
 *clk)
  * @return zero on success, or -ENOENT on error
  */
 int clk_get_by_id(ulong id, struct clk **clkp);
+
+/**
+ * clk_dev_binded() - Check whether the clk has a device
Quoted 7 lines

binded
+ *
+ * @clk A pointer to the clk
+ *
+ * @return true on binded, or false on no */ bool +clk_dev_binded(struct clk *clk);
#endif

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190509/1e68595c/attachment.sig>

author reviewer
#11 lore raw

PATCH 4/41 clk: use clk_dev_binded

In reply to Peng Fan

Preparing to support composite clk.

---
 drivers/clk/clk-divider.c | 4 ++--
 drivers/clk/clk-mux.c     | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/clk/clk-divider.c +2 -2
index 1d2c1b1ec4..2f09e0bb58 100644
@@ -69,8 +69,8 @@ unsigned long divider_recalc_rate(struct clk *hw, unsigned long parent_rate,
 
 static ulong clk_divider_recalc_rate(struct clk *clk)
 {
-	struct clk_divider *divider =
-		to_clk_divider((struct clk *)dev_get_driver_data(clk->dev));
+	struct clk_divider *divider = to_clk_divider(clk_dev_binded(clk) ?
+			(struct clk *)dev_get_driver_data(clk->dev) : clk);
 	unsigned long parent_rate = clk_get_parent_rate(clk);
 	unsigned int val;
 
drivers/clk/clk-mux.c +4 -2
index 2c85f2052c..55fc97367a 100644
@@ -35,7 +35,8 @@
 int clk_mux_val_to_index(struct clk *clk, u32 *table, unsigned int flags,
 			 unsigned int val)
 {
-	struct clk_mux *mux = to_clk_mux(clk);
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk *)dev_get_driver_data(clk->dev) : clk);
 	int num_parents = mux->num_parents;
 
 	if (table) {
@@ -61,7 +62,8 @@ int clk_mux_val_to_index(struct clk *clk, u32 *table, unsigned int flags,
 
 static u8 clk_mux_get_parent(struct clk *clk)
 {
-	struct clk_mux *mux = to_clk_mux(clk);
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk *)dev_get_driver_data(clk->dev) : clk);
 	u32 val;
 
 	val = readl(mux->reg) >> mux->shift;
Signature · 1 line
2.16.4
#12 lore raw

PATCH 4/41 clk: use clk_dev_binded

Quoted 21 lines · On Tue, 30 Apr 2019 10:17:43 +0000 Peng Fan <[email protected]> wrote:

Preparing to support composite clk.

---
 drivers/clk/clk-divider.c | 4 ++--
 drivers/clk/clk-mux.c     | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/clk/clk-divider.c +1 -2
index 1d2c1b1ec4..2f09e0bb58 100644
@@ -69,8 +69,8 @@ unsigned long divider_recalc_rate(struct clk *hw,
 unsigned long parent_rate, 
 static ulong clk_divider_recalc_rate(struct clk *clk)
 {
-	struct clk_divider *divider =
-		to_clk_divider((struct clk
 *)dev_get_driver_data(clk->dev));
+	struct clk_divider *divider =

to_clk_divider(clk_dev_binded(clk) ?

drivers/clk/clk-divider.c

Quoted 1 line
drivers/clk/clk-divider.c +1 -0
+			(struct clk

As I've wrote in the previous mail - in iMX6Q there was no issues. Could you provide an explanation in what respect the iMX8MM is different ?

What exactly is missing?

Quoted 18 lines

*)dev_get_driver_data(clk->dev) : clk); unsigned long parent_rate = clk_get_parent_rate(clk); unsigned int val;

drivers/clk/clk-mux.c +2 -1
index 2c85f2052c..55fc97367a 100644
@@ -35,7 +35,8 @@
 int clk_mux_val_to_index(struct clk *clk, u32 *table, unsigned int
 flags, unsigned int val)
 {
-	struct clk_mux *mux = to_clk_mux(clk);
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk
 *)dev_get_driver_data(clk->dev) : clk); int num_parents =
 mux->num_parents; 
 	if (table) {

drivers/clk/clk-mux.c int clk_mux_val_to_index(struct clk *clk, u32 · line 69

Quoted 9 lines
drivers/clk/clk-mux.c +2 -1
@@ -61,7 +62,8 @@ int clk_mux_val_to_index(struct clk *clk, u32
 *table, unsigned int flags, 
 static u8 clk_mux_get_parent(struct clk *clk)
 {
-	struct clk_mux *mux = to_clk_mux(clk);
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk
 *)dev_get_driver_data(clk->dev) : clk); u32 val;
 
 	val = readl(mux->reg) >> mux->shift;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190506/7dd44ee1/attachment.sig>

#13 lore raw

PATCH 4/41 clk: use clk_dev_binded

In reply to Peng Fan
Quoted 40 lines · On Tue, 30 Apr 2019 10:17:43 +0000 Peng Fan <[email protected]> wrote:

Preparing to support composite clk.

---
 drivers/clk/clk-divider.c | 4 ++--
 drivers/clk/clk-mux.c     | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/clk/clk-divider.c +1 -2
index 1d2c1b1ec4..2f09e0bb58 100644
@@ -69,8 +69,8 @@ unsigned long divider_recalc_rate(struct clk *hw,
 unsigned long parent_rate, 
 static ulong clk_divider_recalc_rate(struct clk *clk)
 {
-	struct clk_divider *divider =
-		to_clk_divider((struct clk
 *)dev_get_driver_data(clk->dev));
+	struct clk_divider *divider =

to_clk_divider(clk_dev_binded(clk) ?

drivers/clk/clk-divider.c +1 -0
+			(struct clk

*)dev_get_driver_data(clk->dev) : clk); unsigned long parent_rate = clk_get_parent_rate(clk); unsigned int val;

drivers/clk/clk-mux.c +2 -1
index 2c85f2052c..55fc97367a 100644
@@ -35,7 +35,8 @@
 int clk_mux_val_to_index(struct clk *clk, u32 *table, unsigned int
 flags, unsigned int val)
 {
-	struct clk_mux *mux = to_clk_mux(clk);
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk
 *)dev_get_driver_data(clk->dev) : clk); int num_parents =
 mux->num_parents; 
 	if (table) {

drivers/clk/clk-mux.c int clk_mux_val_to_index(struct clk *clk, u32 · line 67

Quoted 7 lines
drivers/clk/clk-mux.c +2 -1
@@ -61,7 +62,8 @@ int clk_mux_val_to_index(struct clk *clk, u32
 *table, unsigned int flags, 
 static u8 clk_mux_get_parent(struct clk *clk)
 {
-	struct clk_mux *mux = to_clk_mux(clk);
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk
 *)dev_get_driver_data(clk->dev) : clk); u32 val;

Maybe the

(clk_dev_binded(clk) ? (struct clk *)dev_get_driver_data(clk->dev) :
clk)

Could be an inline function or macro?

drivers/clk/clk-mux.c int clk_mux_val_to_index(struct clk *clk, u32 *table, unsigned int flags, · line 69

Quoted 2 lines
drivers/clk/clk-mux.c +0 -0
 	val = readl(mux->reg) >> mux->shift;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/222344e2/attachment.sig>

author reviewer
#14 lore raw

PATCH 5/41 clk-provider: sync more clk flags from Linux Kernel

In reply to Peng Fan

Sync more clk flags that might be used in U-Boot CCF.

---
 include/linux/clk-provider.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
include/linux/clk-provider.h +21 -0
index eac045c5f8..3458746a60 100644
@@ -9,8 +9,29 @@
 #ifndef __LINUX_CLK_PROVIDER_H
 #define __LINUX_CLK_PROVIDER_H
 
+/*
+ * flags used across common struct clk.  these flags should only affect the
+ * top-level framework.  custom flags for dealing with hardware specifics
+ * belong in struct clk_foo
+ *
+ * Please update clk_flags[] in drivers/clk/clk.c when making changes here!
+ */
+#define CLK_SET_RATE_GATE	BIT(0) /* must be gated across rate change */
+#define CLK_SET_PARENT_GATE	BIT(1) /* must be gated across re-parent */
 #define CLK_SET_RATE_PARENT	BIT(2) /* propagate rate change up one level */
+#define CLK_IGNORE_UNUSED	BIT(3) /* do not gate even if unused */
+				/* unused */
+#define CLK_IS_BASIC		BIT(5) /* Basic clk, can't do a to_clk_foo() */
+#define CLK_GET_RATE_NOCACHE	BIT(6) /* do not use the cached clk rate */
 #define CLK_SET_RATE_NO_REPARENT BIT(7) /* don't re-parent on rate change */
+#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */
+#define CLK_RECALC_NEW_RATES	BIT(9) /* recalc rates after notifications */
+#define CLK_SET_RATE_UNGATE	BIT(10) /* clock needs to run to set rate */
+#define CLK_IS_CRITICAL		BIT(11) /* do not gate, ever */
+/* parents need enable during gate/ungate, set rate and re-parent */
+#define CLK_OPS_PARENT_ENABLE	BIT(12)
+/* duty cycle call may be forwarded to the parent clock */
+#define CLK_DUTY_CYCLE_PARENT	BIT(13)
 
 #define CLK_MUX_INDEX_ONE		BIT(0)
 #define CLK_MUX_INDEX_BIT		BIT(1)
Signature · 1 line
2.16.4
#15 lore raw

PATCH 5/41 clk-provider: sync more clk flags from Linux Kernel

Quoted 34 lines · On Tue, 30 Apr 2019 10:17:47 +0000 Peng Fan <[email protected]> wrote:

Sync more clk flags that might be used in U-Boot CCF.

---
 include/linux/clk-provider.h | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
(quoted diff) +0 -0

b/include/linux/clk-provider.h index eac045c5f8..3458746a60 100644

include/linux/clk-provider.h +2 -0
@@ -9,8 +9,29 @@
 #ifndef __LINUX_CLK_PROVIDER_H
 #define __LINUX_CLK_PROVIDER_H
 
+/*
+ * flags used across common struct clk.  these flags should only

affect the
+ * top-level framework. custom flags for dealing with hardware specifics
+ * belong in struct clk_foo
+ *
+ * Please update clk_flags[] in drivers/clk/clk.c when making changes here!
+ */
+#define CLK_SET_RATE_GATE BIT(0) /* must be gated across rate
change */ +#define CLK_SET_PARENT_GATE BIT(1) /* must be gated
across re-parent */ #define CLK_SET_RATE_PARENT BIT(2) /*
propagate rate change up one level */ +#define
CLK_IGNORE_UNUSED BIT(3) /* do not gate even if unused */

include/linux/clk-provider.h +2 -0
+				/* unused */
+#define CLK_IS_BASIC		BIT(5) /* Basic clk, can't do a

to_clk_foo() */

Quoted 2 lines

+#define CLK_GET_RATE_NOCACHE BIT(6) /* do not
use the cached clk rate */

I guess that this is what your requested for the NOCACHE (to always recalculate the rate).

Quoted 5 lines

#define CLK_SET_RATE_NO_REPARENT BIT(7) /*
don't re-parent on rate change */ +#define CLK_GET_ACCURACY_NOCACHE BIT(8) /* do not use the cached clk accuracy */ +#define
CLK_RECALC_NEW_RATES BIT(9) /* recalc rates after
notifications */ +#define CLK_SET_RATE_UNGATE BIT(10) /* clock

Quoted 8 lines

needs to run to set rate */ +#define CLK_IS_CRITICAL BIT(11) /* do not gate, ever */ +/* parents need enable during gate/ungate, set rate and re-parent */ +#define
CLK_OPS_PARENT_ENABLE BIT(12) +/* duty cycle call may be
forwarded to the parent clock */ +#define
CLK_DUTY_CYCLE_PARENT BIT(13) #define
CLK_MUX_INDEX_ONE BIT(0) #define
CLK_MUX_INDEX_BIT BIT(1)

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190507/89996389/attachment.sig>

author reviewer
#16 lore raw

PATCH 6/41 cmd: clk: print err value when clk_get_rate failed

In reply to Peng Fan

Print err value when clk_get_rate failed

---
 cmd/clk.c | 2 ++
 1 file changed, 2 insertions(+)
cmd/clk.c +2 -0
index 2ea82176aa..73d963184d 100644
@@ -41,6 +41,8 @@ int __weak soc_clk_dump(void)
 		rate = clk_get_rate(&clk);
 		if (!IS_ERR_VALUE(rate))
 			printf("%-30.30s : %lu Hz\n", dev->name, rate);
+		else
+			printf("%-30.30s : err=%ld\n", dev->name, rate);
 
 		clk_free(&clk);
 	}
Signature · 1 line
2.16.4
#17 lore raw

PATCH 6/41 cmd: clk: print err value when clk_get_rate failed

Quoted 20 lines · On Tue, 30 Apr 2019 10:17:50 +0000 Peng Fan <[email protected]> wrote:

Print err value when clk_get_rate failed

---
 cmd/clk.c | 2 ++
 1 file changed, 2 insertions(+)
cmd/clk.c +2 -0
index 2ea82176aa..73d963184d 100644
@@ -41,6 +41,8 @@ int __weak soc_clk_dump(void)
 		rate = clk_get_rate(&clk);
 		if (!IS_ERR_VALUE(rate))
 			printf("%-30.30s : %lu Hz\n", dev->name,
 rate);
+		else
+			printf("%-30.30s : err=%ld\n", dev->name,
 rate); 
 		clk_free(&clk);
Quoted 1 line

}

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190507/40305ad1/attachment.sig>

author reviewer
#18 lore raw

PATCH 7/41 clk: mux: add set parent support

In reply to Peng Fan

Add set parent support for clk mux

---
 drivers/clk/clk-mux.c        | 70 ++++++++++++++++++++++++++++++++++++++++++--
 include/linux/clk-provider.h |  2 ++
 2 files changed, 70 insertions(+), 2 deletions(-)
drivers/clk/clk-mux.c +68 -2
index 55fc97367a..1a937bf923 100644
@@ -60,7 +60,24 @@ int clk_mux_val_to_index(struct clk *clk, u32 *table, unsigned int flags,
 	return val;
 }
 
-static u8 clk_mux_get_parent(struct clk *clk)
+unsigned int clk_mux_index_to_val(u32 *table, unsigned int flags, u8 index)
+{
+	unsigned int val = index;
+
+	if (table) {
+		val = table[index];
+	} else {
+		if (flags & CLK_MUX_INDEX_BIT)
+			val = 1 << index;
+
+		if (flags & CLK_MUX_INDEX_ONE)
+			val++;
+	}
+
+	return val;
+}
+
+u8 clk_mux_get_parent(struct clk *clk)
 {
 	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
 			(struct clk *)dev_get_driver_data(clk->dev) : clk);
@@ -72,8 +89,57 @@ static u8 clk_mux_get_parent(struct clk *clk)
 	return clk_mux_val_to_index(clk, mux->table, mux->flags, val);
 }
 
+static int clk_fetch_parent_index(struct clk *clk,
+				  struct clk *parent)
+{
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk *)dev_get_driver_data(clk->dev) : clk);
+
+	int i;
+
+	if (!parent)
+		return -EINVAL;
+
+	for (i = 0; i < mux->num_parents; i++) {
+		if (!strcmp(parent->dev->name, mux->parent_names[i]))
+			return i;
+	}
+
+	return -EINVAL;
+}
+
+static int clk_mux_set_parent(struct clk *clk, struct clk *parent)
+{
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk *)dev_get_driver_data(clk->dev) : clk);
+	int index;
+	u32 val;
+	u32 reg;
+
+	index = clk_fetch_parent_index(clk, parent);
+	if (index < 0) {
+		printf("Could not fetch index\n");
+		return index;
+	}
+
+	val = clk_mux_index_to_val(mux->table, mux->flags, index);
+
+	if (mux->flags & CLK_MUX_HIWORD_MASK) {
+		reg = mux->mask << (mux->shift + 16);
+	} else {
+		reg = readl(mux->reg);
+		reg &= ~(mux->mask << mux->shift);
+	}
+	val = val << mux->shift;
+	reg |= val;
+	writel(reg, mux->reg);
+
+	return 0;
+}
+
 const struct clk_ops clk_mux_ops = {
-		.get_rate = clk_generic_get_rate,
+	.get_rate = clk_generic_get_rate,
+	.set_parent = clk_mux_set_parent,
 };
 
 struct clk *clk_hw_register_mux_table(struct device *dev, const char *name,
include/linux/clk-provider.h +2 -0
index 3458746a60..216095d28c 100644
@@ -56,6 +56,8 @@ struct clk_mux {
 };
 
 #define to_clk_mux(_clk) container_of(_clk, struct clk_mux, clk)
+extern const struct clk_ops clk_mux_ops;
+u8 clk_mux_get_parent(struct clk *clk);
 
 struct clk_div_table {
 	unsigned int	val;
Signature · 1 line
2.16.4
#19 lore raw

PATCH 7/41 clk: mux: add set parent support

Quoted 2 lines · On Tue, 30 Apr 2019 10:17:54 +0000 Peng Fan <[email protected]> wrote:

Add set parent support for clk mux

I suppose that it was ported from Linux kernel directly?

If yes, please state the SHA1 of Linux master (or exact tag).

Quoted 102 lines
---
 drivers/clk/clk-mux.c        | 70

++++++++++++++++++++++++++++++++++++++++++--
include/linux/clk-provider.h | 2 ++ 2 files changed, 70 insertions(+), 2 deletions(-)

drivers/clk/clk-mux.c +17 -1
index 55fc97367a..1a937bf923 100644
@@ -60,7 +60,24 @@ int clk_mux_val_to_index(struct clk *clk, u32
 *table, unsigned int flags, return val;
 }
 
-static u8 clk_mux_get_parent(struct clk *clk)
+unsigned int clk_mux_index_to_val(u32 *table, unsigned int flags, u8
 index) +{
+	unsigned int val = index;
+
+	if (table) {
+		val = table[index];
+	} else {
+		if (flags & CLK_MUX_INDEX_BIT)
+			val = 1 << index;
+
+		if (flags & CLK_MUX_INDEX_ONE)
+			val++;
+	}
+
+	return val;
+}
+
+u8 clk_mux_get_parent(struct clk *clk)
 {
 	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
 			(struct clk

*)dev_get_driver_data(clk->dev) : clk); @@ -72,8 +89,57 @@ static u8 clk_mux_get_parent(struct clk *clk) return clk_mux_val_to_index(clk, mux->table, mux->flags, val); }

drivers/clk/clk-mux.c +5 -0
+static int clk_fetch_parent_index(struct clk *clk,
+				  struct clk *parent)
+{
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk

*)dev_get_driver_data(clk->dev) : clk); +

drivers/clk/clk-mux.c +17 -0
+	int i;
+
+	if (!parent)
+		return -EINVAL;
+
+	for (i = 0; i < mux->num_parents; i++) {
+		if (!strcmp(parent->dev->name, mux->parent_names[i]))
+			return i;
+	}
+
+	return -EINVAL;
+}
+
+static int clk_mux_set_parent(struct clk *clk, struct clk *parent)
+{
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk

*)dev_get_driver_data(clk->dev) : clk);

drivers/clk/clk-mux.c +27 -1
+	int index;
+	u32 val;
+	u32 reg;
+
+	index = clk_fetch_parent_index(clk, parent);
+	if (index < 0) {
+		printf("Could not fetch index\n");
+		return index;
+	}
+
+	val = clk_mux_index_to_val(mux->table, mux->flags, index);
+
+	if (mux->flags & CLK_MUX_HIWORD_MASK) {
+		reg = mux->mask << (mux->shift + 16);
+	} else {
+		reg = readl(mux->reg);
+		reg &= ~(mux->mask << mux->shift);
+	}
+	val = val << mux->shift;
+	reg |= val;
+	writel(reg, mux->reg);
+
+	return 0;
+}
+
 const struct clk_ops clk_mux_ops = {
-		.get_rate = clk_generic_get_rate,
+	.get_rate = clk_generic_get_rate,
+	.set_parent = clk_mux_set_parent,
 };
 
 struct clk *clk_hw_register_mux_table(struct device *dev, const char

*name, diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 3458746a60..216095d28c 100644

include/linux/clk-provider.h struct clk_mux { · line 63

Quoted 8 lines
include/linux/clk-provider.h +2 -0
@@ -56,6 +56,8 @@ struct clk_mux {
 };
 
 #define to_clk_mux(_clk) container_of(_clk, struct clk_mux, clk)
+extern const struct clk_ops clk_mux_ops;
+u8 clk_mux_get_parent(struct clk *clk);
 
 struct clk_div_table {
 	unsigned int	val;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190507/1cc312cc/attachment.sig>

author reviewer
#20 lore raw

PATCH 7/41 clk: mux: add set parent support

Quoted 11 lines

Subject: Re: [i.MX8MM+CCF 07/41] clk: mux: add set parent support

Quoted 2 lines · On Tue, 30 Apr 2019 10:17:54 +0000 Peng Fan <[email protected]> wrote:

Add set parent support for clk mux

I suppose that it was ported from Linux kernel directly?

If yes, please state the SHA1 of Linux master (or exact tag).

Modified from 5.1-rc5. Will add it in next version.

Thanks,
Peng.

Quoted 123 lines
Quoted 101 lines
---
 drivers/clk/clk-mux.c        | 70

++++++++++++++++++++++++++++++++++++++++++--
include/linux/clk-provider.h | 2 ++ 2 files changed, 70 insertions(+), 2 deletions(-)

drivers/clk/clk-mux.c index renamed from drivers/clk/clk-mux.c +0 -0

55fc97367a..1a937bf923 100644

drivers/clk/clk-mux.c +17 -1
@@ -60,7 +60,24 @@ int clk_mux_val_to_index(struct clk *clk, u32
 *table, unsigned int flags, return val;  }
 
-static u8 clk_mux_get_parent(struct clk *clk)
+unsigned int clk_mux_index_to_val(u32 *table, unsigned int flags, u8
 index) +{
+	unsigned int val = index;
+
+	if (table) {
+		val = table[index];
+	} else {
+		if (flags & CLK_MUX_INDEX_BIT)
+			val = 1 << index;
+
+		if (flags & CLK_MUX_INDEX_ONE)
+			val++;
+	}
+
+	return val;
+}
+
+u8 clk_mux_get_parent(struct clk *clk)
 {
 	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
 			(struct clk

*)dev_get_driver_data(clk->dev) : clk); @@ -72,8 +89,57 @@ static u8 clk_mux_get_parent(struct clk *clk) return clk_mux_val_to_index(clk, mux->table, mux->flags, val); }

drivers/clk/clk-mux.c +5 -0
+static int clk_fetch_parent_index(struct clk *clk,
+				  struct clk *parent)
+{
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk

*)dev_get_driver_data(clk->dev) : clk); +

drivers/clk/clk-mux.c +16 -0
+	int i;
+
+	if (!parent)
+		return -EINVAL;
+
+	for (i = 0; i < mux->num_parents; i++) {
+		if (!strcmp(parent->dev->name, mux->parent_names[i]))
+			return i;
+	}
+
+	return -EINVAL;
+}
+
+static int clk_mux_set_parent(struct clk *clk, struct clk *parent) {
+	struct clk_mux *mux = to_clk_mux(clk_dev_binded(clk) ?
+			(struct clk

*)dev_get_driver_data(clk->dev) : clk);

drivers/clk/clk-mux.c +27 -1
+	int index;
+	u32 val;
+	u32 reg;
+
+	index = clk_fetch_parent_index(clk, parent);
+	if (index < 0) {
+		printf("Could not fetch index\n");
+		return index;
+	}
+
+	val = clk_mux_index_to_val(mux->table, mux->flags, index);
+
+	if (mux->flags & CLK_MUX_HIWORD_MASK) {
+		reg = mux->mask << (mux->shift + 16);
+	} else {
+		reg = readl(mux->reg);
+		reg &= ~(mux->mask << mux->shift);
+	}
+	val = val << mux->shift;
+	reg |= val;
+	writel(reg, mux->reg);
+
+	return 0;
+}
+
 const struct clk_ops clk_mux_ops = {
-		.get_rate = clk_generic_get_rate,
+	.get_rate = clk_generic_get_rate,
+	.set_parent = clk_mux_set_parent,
 };
 
 struct clk *clk_hw_register_mux_table(struct device *dev, const char

*name, diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 3458746a60..216095d28c 100644

include/linux/clk-provider.h struct clk_mux { · line 63

Quoted 8 lines
include/linux/clk-provider.h +2 -0
@@ -56,6 +56,8 @@ struct clk_mux {
 };
 
 #define to_clk_mux(_clk) container_of(_clk, struct clk_mux, clk)
+extern const struct clk_ops clk_mux_ops;
+u8 clk_mux_get_parent(struct clk *clk);
 
 struct clk_div_table {
 	unsigned int	val;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

author reviewer
#21 lore raw

PATCH 8/41 clk: export mux/divider ops

In reply to Peng Fan

Export mux/divider ops for composite usage

---
 include/linux/clk-provider.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/clk-provider.h +1 -0
index 216095d28c..a60cf6e833 100644
@@ -83,6 +83,7 @@ struct clk_divider {
 #define CLK_DIVIDER_ROUND_CLOSEST	BIT(4)
 #define CLK_DIVIDER_READ_ONLY		BIT(5)
 #define CLK_DIVIDER_MAX_AT_ZERO		BIT(6)
+extern const struct clk_ops clk_divider_ops;
 
 struct clk_fixed_factor {
 	struct clk	clk;
Signature · 1 line
2.16.4
#22 lore raw

PATCH 8/41 clk: export mux/divider ops

Quoted 12 lines · On Tue, 30 Apr 2019 10:17:58 +0000 Peng Fan <[email protected]> wrote:

Export mux/divider ops for composite usage

---
 include/linux/clk-provider.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/linux/clk-provider.h index 216095d28c..a60cf6e833 100644

include/linux/clk-provider.h struct clk_divider { · line 87

Quoted 5 lines
include/linux/clk-provider.h +1 -0
@@ -83,6 +83,7 @@ struct clk_divider {
 #define CLK_DIVIDER_ROUND_CLOSEST	BIT(4)
 #define CLK_DIVIDER_READ_ONLY		BIT(5)
 #define CLK_DIVIDER_MAX_AT_ZERO		BIT(6)
+extern const struct clk_ops clk_divider_ops;
 

Why do we need to export clk_divider_ops? Why iMX8MM requires it?

include/linux/clk-provider.h struct clk_divider { · line 89

Quoted 2 lines
include/linux/clk-provider.h +0 -0
 struct clk_fixed_factor {
 	struct clk	clk;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190507/c23f7be2/attachment.sig>

author reviewer
#23 lore raw

PATCH 8/41 clk: export mux/divider ops

Quoted 13 lines

Subject: Re: [i.MX8MM+CCF 08/41] clk: export mux/divider ops

Quoted 7 lines · On Tue, 30 Apr 2019 10:17:58 +0000 Peng Fan <[email protected]> wrote:

Export mux/divider ops for composite usage

---
 include/linux/clk-provider.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines

include/linux/clk-provider.h struct clk_divider { · line 87

Quoted 10 lines
(quoted diff) +0 -0

b/include/linux/clk-provider.h index 216095d28c..a60cf6e833 100644

include/linux/clk-provider.h +1 -0
@@ -83,6 +83,7 @@ struct clk_divider {
 #define CLK_DIVIDER_ROUND_CLOSEST	BIT(4)
 #define CLK_DIVIDER_READ_ONLY		BIT(5)
 #define CLK_DIVIDER_MAX_AT_ZERO		BIT(6)
+extern const struct clk_ops clk_divider_ops;
 

Why do we need to export clk_divider_ops? Why iMX8MM requires it?

The composite driver will use that to set ops for divider clk inside composite clk. The Linux CCF also exports it.

You could check the clk-composite-imx8m and clk-composite driver in this patchset.

Regards,
Peng.

Quoted 17 lines

include/linux/clk-provider.h struct clk_divider { · line 89

Quoted 3 lines
include/linux/clk-provider.h +0 -0
 struct clk_fixed_factor {
 	struct clk	clk;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#24 lore raw

PATCH 8/41 clk: export mux/divider ops

Quoted 26 lines · On Tue, 7 May 2019 13:25:00 +0000 Peng Fan <[email protected]> wrote:
Quoted 12 lines

Subject: Re: [i.MX8MM+CCF 08/41] clk: export mux/divider ops

Quoted 7 lines · On Tue, 30 Apr 2019 10:17:58 +0000 Peng Fan <[email protected]> wrote:

Export mux/divider ops for composite usage

---
 include/linux/clk-provider.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines

include/linux/clk-provider.h struct clk_divider { · line 87

Quoted 10 lines
(quoted diff) +0 -0

b/include/linux/clk-provider.h index 216095d28c..a60cf6e833 100644

include/linux/clk-provider.h +1 -0
@@ -83,6 +83,7 @@ struct clk_divider {
 #define CLK_DIVIDER_ROUND_CLOSEST	BIT(4)
 #define CLK_DIVIDER_READ_ONLY		BIT(5)
 #define CLK_DIVIDER_MAX_AT_ZERO		BIT(6)
+extern const struct clk_ops clk_divider_ops;
 

Why do we need to export clk_divider_ops? Why iMX8MM requires it?

Quoted 2 lines

The composite driver will use that to set ops for divider clk inside composite clk.

Please then write a detailed rationale for this change in commit message or a comment in the header file.

The one from the original message seems to be not enough.

Quoted 25 lines

The Linux CCF also exports it.

You could check the clk-composite-imx8m and clk-composite driver in this patchset.

Regards,
Peng.

Quoted 17 lines

include/linux/clk-provider.h struct clk_divider { · line 89

Quoted 3 lines
include/linux/clk-provider.h +0 -0
 struct clk_fixed_factor {
 	struct clk	clk;  

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/f1faeca8/attachment.sig>

author reviewer
#25 lore raw

PATCH 8/41 clk: export mux/divider ops

Quoted 32 lines

Subject: Re: [i.MX8MM+CCF 08/41] clk: export mux/divider ops

Quoted 26 lines · On Tue, 7 May 2019 13:25:00 +0000 Peng Fan <[email protected]> wrote:
Quoted 24 lines

Subject: Re: [i.MX8MM+CCF 08/41] clk: export mux/divider ops

Quoted 12 lines · On Tue, 30 Apr 2019 10:17:58 +0000 Peng Fan <[email protected]> wrote:

Export mux/divider ops for composite usage

---
 include/linux/clk-provider.h | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/include/linux/clk-provider.h index 216095d28c..a60cf6e833 100644

include/linux/clk-provider.h struct clk_divider { · line 87

Quoted 5 lines
include/linux/clk-provider.h +1 -0
@@ -83,6 +83,7 @@ struct clk_divider {
 #define CLK_DIVIDER_ROUND_CLOSEST	BIT(4)
 #define CLK_DIVIDER_READ_ONLY		BIT(5)
 #define CLK_DIVIDER_MAX_AT_ZERO		BIT(6)
+extern const struct clk_ops clk_divider_ops;
 

Why do we need to export clk_divider_ops? Why iMX8MM requires it?

Quoted 7 lines
Quoted 2 lines

The composite driver will use that to set ops for divider clk inside composite clk.

Please then write a detailed rationale for this change in commit message or a comment in the header file.

The one from the original message seems to be not enough.

Will fix in new version.

Thanks,
Peng.

Quoted 41 lines
Quoted 27 lines

The Linux CCF also exports it.

You could check the clk-composite-imx8m and clk-composite driver in this patchset.

Regards,
Peng.

Quoted 17 lines

include/linux/clk-provider.h struct clk_divider { · line 89

Quoted 3 lines
include/linux/clk-provider.h +0 -0
 struct clk_fixed_factor {
 	struct clk	clk;

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

author reviewer
#26 lore raw

PATCH 9/41 clk: add clk-gate support

In reply to Peng Fan

Import clk-gate support from Linux Kernel 5.1-rc5

---
 drivers/clk/Makefile         |   2 +-
 drivers/clk/clk-gate.c       | 151 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/clk-provider.h |  18 ++++++
 3 files changed, 170 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/clk-gate.c
drivers/clk/Makefile +1 -1
index 9fcc75e0ea..0bc8f7e5ce 100644
@@ -7,7 +7,7 @@
 obj-$(CONFIG_$(SPL_TPL_)CLK) += clk-uclass.o
 obj-$(CONFIG_$(SPL_TPL_)CLK) += clk_fixed_rate.o
 obj-$(CONFIG_$(SPL_TPL_)CLK) += clk_fixed_factor.o
-obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk.o clk-divider.o clk-mux.o
+obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk.o clk-divider.o clk-mux.o clk-gate.o
 obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk-fixed-factor.o
 
 obj-y += imx/
drivers/clk/clk-gate.c new file +151 -0

151 lines not on this page · raw message

include/linux/clk-provider.h +18 -0
index a60cf6e833..3ed0db86d2 100644
@@ -59,6 +59,24 @@ struct clk_mux {
 extern const struct clk_ops clk_mux_ops;
 u8 clk_mux_get_parent(struct clk *clk);
 
+struct clk_gate {
+	struct clk	clk;
+	void __iomem	*reg;
+	u8		bit_idx;
+	u8		flags;
+};
+
+#define to_clk_gate(_clk) container_of(_clk, struct clk_gate, clk)
+
+#define CLK_GATE_SET_TO_DISABLE		BIT(0)
+#define CLK_GATE_HIWORD_MASK		BIT(1)
+
+extern const struct clk_ops clk_gate_ops;
+struct clk *clk_register_gate(struct device *dev, const char *name,
+			      const char *parent_name, unsigned long flags,
+			      void __iomem *reg, u8 bit_idx,
+			      u8 clk_gate_flags, spinlock_t *lock);
+
 struct clk_div_table {
 	unsigned int	val;
 	unsigned int	div;
Signature · 1 line
2.16.4
author reviewer
#27 lore raw

PATCH 10/41 divider set rate supporrt

In reply to Peng Fan
---
 drivers/clk/clk-divider.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)
drivers/clk/clk-divider.c +88 -0
index 2f09e0bb58..8615f9815d 100644
@@ -18,6 +18,7 @@
 #include <dm/lists.h>
 #include <dm/device-internal.h>
 #include <linux/clk-provider.h>
+#include <linux/log2.h>
 #include <div64.h>
 #include <clk.h>
 #include "clk.h"
@@ -81,8 +82,95 @@ static ulong clk_divider_recalc_rate(struct clk *clk)
 				   divider->flags, divider->width);
 }
 
+static bool _is_valid_table_div(const struct clk_div_table *table,
+				unsigned int div)
+{
+	const struct clk_div_table *clkt;
+
+	for (clkt = table; clkt->div; clkt++)
+		if (clkt->div == div)
+			return true;
+	return false;
+}
+
+static bool _is_valid_div(const struct clk_div_table *table, unsigned int div,
+			  unsigned long flags)
+{
+	if (flags & CLK_DIVIDER_POWER_OF_TWO)
+		return is_power_of_2(div);
+	if (table)
+		return _is_valid_table_div(table, div);
+	return true;
+}
+
+static unsigned int _get_table_val(const struct clk_div_table *table,
+				   unsigned int div)
+{
+	const struct clk_div_table *clkt;
+
+	for (clkt = table; clkt->div; clkt++)
+		if (clkt->div == div)
+			return clkt->val;
+	return 0;
+}
+
+static unsigned int _get_val(const struct clk_div_table *table,
+			     unsigned int div, unsigned long flags, u8 width)
+{
+	if (flags & CLK_DIVIDER_ONE_BASED)
+		return div;
+	if (flags & CLK_DIVIDER_POWER_OF_TWO)
+		return __ffs(div);
+	if (flags & CLK_DIVIDER_MAX_AT_ZERO)
+		return (div == clk_div_mask(width) + 1) ? 0 : div;
+	if (table)
+		return  _get_table_val(table, div);
+	return div - 1;
+}
+int divider_get_val(unsigned long rate, unsigned long parent_rate,
+		    const struct clk_div_table *table, u8 width,
+		    unsigned long flags)
+{
+	unsigned int div, value;
+
+	div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
+
+	if (!_is_valid_div(table, div, flags))
+		return -EINVAL;
+
+	value = _get_val(table, div, flags, width);
+
+	return min_t(unsigned int, value, clk_div_mask(width));
+}
+
+static ulong clk_divider_set_rate(struct clk *clk, unsigned long rate)
+{
+	struct clk_divider *divider = to_clk_divider(clk_dev_binded(clk) ?
+			(struct clk *)dev_get_driver_data(clk->dev) : clk);
+	unsigned long parent_rate = clk_get_parent_rate(clk);
+	int value;
+	u32 val;
+
+	value = divider_get_val(rate, parent_rate, divider->table,
+				divider->width, divider->flags);
+	if (value < 0)
+		return value;
+
+	if (divider->flags & CLK_DIVIDER_HIWORD_MASK) {
+		val = clk_div_mask(divider->width) << (divider->shift + 16);
+	} else {
+		val = readl(divider->reg);
+		val &= ~(clk_div_mask(divider->width) << divider->shift);
+	}
+	val |= (u32)value << divider->shift;
+	writel(val, divider->reg);
+
+	return clk_get_rate(clk);
+}
+
 const struct clk_ops clk_divider_ops = {
 	.get_rate = clk_divider_recalc_rate,
+	.set_rate = clk_divider_set_rate,
 };
 
 static struct clk *_register_divider(struct device *dev, const char *name,
Signature · 1 line
2.16.4
#28 lore raw

PATCH 10/41 divider set rate supporrt

On Tue, 30 Apr 2019 10:18:05 +0000
Peng Fan <[email protected]> wrote:

Please state the exact SHA1 or tag when porting the code from Linux kernel.

Quoted 119 lines
---
 drivers/clk/clk-divider.c | 88

+++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+)

drivers/clk/clk-divider.c +63 -0
index 2f09e0bb58..8615f9815d 100644
@@ -18,6 +18,7 @@
 #include <dm/lists.h>
 #include <dm/device-internal.h>
 #include <linux/clk-provider.h>
+#include <linux/log2.h>
 #include <div64.h>
 #include <clk.h>
 #include "clk.h"
@@ -81,8 +82,95 @@ static ulong clk_divider_recalc_rate(struct clk
 *clk) divider->flags, divider->width);
 }
 
+static bool _is_valid_table_div(const struct clk_div_table *table,
+				unsigned int div)
+{
+	const struct clk_div_table *clkt;
+
+	for (clkt = table; clkt->div; clkt++)
+		if (clkt->div == div)
+			return true;
+	return false;
+}
+
+static bool _is_valid_div(const struct clk_div_table *table,
 unsigned int div,
+			  unsigned long flags)
+{
+	if (flags & CLK_DIVIDER_POWER_OF_TWO)
+		return is_power_of_2(div);
+	if (table)
+		return _is_valid_table_div(table, div);
+	return true;
+}
+
+static unsigned int _get_table_val(const struct clk_div_table *table,
+				   unsigned int div)
+{
+	const struct clk_div_table *clkt;
+
+	for (clkt = table; clkt->div; clkt++)
+		if (clkt->div == div)
+			return clkt->val;
+	return 0;
+}
+
+static unsigned int _get_val(const struct clk_div_table *table,
+			     unsigned int div, unsigned long flags,
 u8 width) +{
+	if (flags & CLK_DIVIDER_ONE_BASED)
+		return div;
+	if (flags & CLK_DIVIDER_POWER_OF_TWO)
+		return __ffs(div);
+	if (flags & CLK_DIVIDER_MAX_AT_ZERO)
+		return (div == clk_div_mask(width) + 1) ? 0 : div;
+	if (table)
+		return  _get_table_val(table, div);
+	return div - 1;
+}
+int divider_get_val(unsigned long rate, unsigned long parent_rate,
+		    const struct clk_div_table *table, u8 width,
+		    unsigned long flags)
+{
+	unsigned int div, value;
+
+	div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
+
+	if (!_is_valid_div(table, div, flags))
+		return -EINVAL;
+
+	value = _get_val(table, div, flags, width);
+
+	return min_t(unsigned int, value, clk_div_mask(width));
+}
+
+static ulong clk_divider_set_rate(struct clk *clk, unsigned long
 rate) +{
+	struct clk_divider *divider =

to_clk_divider(clk_dev_binded(clk) ?

drivers/clk/clk-divider.c +1 -0
+			(struct clk

*)dev_get_driver_data(clk->dev) : clk);

drivers/clk/clk-divider.c +11 -0
+	unsigned long parent_rate = clk_get_parent_rate(clk);
+	int value;
+	u32 val;
+
+	value = divider_get_val(rate, parent_rate, divider->table,
+				divider->width, divider->flags);
+	if (value < 0)
+		return value;
+
+	if (divider->flags & CLK_DIVIDER_HIWORD_MASK) {
+		val = clk_div_mask(divider->width) <<

(divider->shift + 16);

drivers/clk/clk-divider.c +3 -0
+	} else {
+		val = readl(divider->reg);
+		val &= ~(clk_div_mask(divider->width) <<

divider->shift);

drivers/clk/clk-divider.c +8 -0
+	}
+	val |= (u32)value << divider->shift;
+	writel(val, divider->reg);
+
+	return clk_get_rate(clk);
+}
+
 const struct clk_ops clk_divider_ops = {
 	.get_rate = clk_divider_recalc_rate,
+	.set_rate = clk_divider_set_rate,
 };
 
 static struct clk *_register_divider(struct device *dev, const char
Quoted 1 line

*name,

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190507/5be3f1c4/attachment.sig>

author reviewer
#29 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

In reply to Peng Fan

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
 include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
drivers/clk/clk_fixed_rate.c +1 -7
index 089f060a23..069e643fbc 100644
@@ -6,13 +6,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
-
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate *)dev_get_platdata(dev))
+#include <linux/clk-provider.h>
 
 static ulong clk_fixed_rate_get_rate(struct clk *clk)
 {
include/linux/clk-provider.h +7 -0
index 3ed0db86d2..b2bed768b6 100644
@@ -112,6 +112,13 @@ struct clk_fixed_factor {
 #define to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\
 					       clk)
 
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate;
+};
+
+#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate *)dev_get_platdata(dev))
+
 int clk_register(struct clk *clk, const char *drv_name,
 		 ulong drv_data, const char *name,
 		 const char *parent_name);
Signature · 1 line
2.16.4
#30 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 32 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
 include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 089f060a23..069e643fbc 100644

drivers/clk/clk_fixed_rate.c +0 -7
@@ -6,13 +6,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
-
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate
 *)dev_get_platdata(dev)) +#include <linux/clk-provider.h>
 
 static ulong clk_fixed_rate_get_rate(struct clk *clk)
 {
(quoted diff) +0 -0

b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644

include/linux/clk-provider.h struct clk_fixed_factor { · line 118

Quoted 7 lines
include/linux/clk-provider.h +4 -0
@@ -112,6 +112,13 @@ struct clk_fixed_factor {
 #define to_clk_fixed_factor(_clk) container_of(_clk, struct
 clk_fixed_factor,\ clk)
 
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate;
+};

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property - the 24MHz OSC)

include/linux/clk-provider.h struct clk_fixed_factor { · line 124

Quoted 6 lines
include/linux/clk-provider.h +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate
 *)dev_get_platdata(dev)) +
 int clk_register(struct clk *clk, const char *drv_name,
 		 ulong drv_data, const char *name,
 		 const char *parent_name);

Please explain why iMX8MM needs such global export?

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190507/bc932787/attachment.sig>

author reviewer
#31 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 50 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 31 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 089f060a23..069e643fbc 100644

drivers/clk/clk_fixed_rate.c +0 -7
@@ -6,13 +6,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
-
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate
 *)dev_get_platdata(dev)) +#include <linux/clk-provider.h>
 
 static ulong clk_fixed_rate_get_rate(struct clk *clk)  { diff --git

a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644

include/linux/clk-provider.h struct clk_fixed_factor { #define · line 118

Quoted 7 lines
include/linux/clk-provider.h +4 -0
@@ -112,6 +112,13 @@ struct clk_fixed_factor {  #define
 to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\
 clk)
 
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate;
+};

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property - the 24MHz OSC)

Quoted 8 lines

include/linux/clk-provider.h struct clk_fixed_factor { · line 124

Quoted 6 lines
include/linux/clk-provider.h +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate
 *)dev_get_platdata(dev)) +
 int clk_register(struct clk *clk, const char *drv_name,
 		 ulong drv_data, const char *name,
 		 const char *parent_name);

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK, "clock-osc-24m", &devp);
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);

Regards,
Peng.

Quoted 12 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#32 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 62 lines · On Tue, 7 May 2019 13:27:45 +0000 Peng Fan <[email protected]> wrote:
Quoted 51 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 34 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 089f060a23..069e643fbc 100644

drivers/clk/clk_fixed_rate.c +0 -8
@@ -6,13 +6,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
-
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate
 *)dev_get_platdata(dev)) +#include <linux/clk-provider.h>
 
 static ulong clk_fixed_rate_get_rate(struct clk *clk)  { diff
--git a/include/linux/clk-provider.h

b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644

include/linux/clk-provider.h +0 -0
@@ -112,6 +112,13 @@ struct clk_fixed_factor {  #define

to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\ clk)

include/linux/clk-provider.h struct clk_fixed_factor { · line 118

Quoted 4 lines
include/linux/clk-provider.h +4 -0
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate;
+};  

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property - the 24MHz OSC)

Quoted 8 lines

include/linux/clk-provider.h struct clk_fixed_factor { · line 124

Quoted 6 lines
include/linux/clk-provider.h +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate

*)dev_get_platdata(dev)) +
int clk_register(struct clk *clk, const char *drv_name,

include/linux/clk-provider.h +0 -0
 		 ulong drv_data, const char *name,
 		 const char *parent_name);  

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

Review

Quoted 5 lines
(quoted diff) +5 -0
+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK, "clock-osc-24m", &devp);
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);

This code looks a bit strange to me. Why imx8mm sets parent here?

In the imx6q I write "osc" as a part of the clock tree:

        clk_dm(IMX6QDL_CLK_PLL2,
               imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc",
                             base + 0x30, 0x1));

And here the parent is set as "osc".

Moreover, the "osc" or in your case "clock-osc-24m" shall be available in "clocks" DTS node and hence parsed / setup from there (and be available in the clk uclass list).

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);

Shouldn't this be set in DTS ? As it is now - it seems like a hardcoded value for early SPL clock setup. Am I right?

Quoted 8 lines
(quoted diff) +7 -0
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);
Quoted 15 lines

Regards,
Peng.

Quoted 12 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/91c383b9/attachment.sig>

author reviewer
#33 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 79 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:46
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org; jagan at amarulasolutions.com; sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 62 lines · On Tue, 7 May 2019 13:27:45 +0000 Peng Fan <[email protected]> wrote:
Quoted 51 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 34 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 089f060a23..069e643fbc 100644

drivers/clk/clk_fixed_rate.c +0 -8
@@ -6,13 +6,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
-
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate
 *)dev_get_platdata(dev)) +#include <linux/clk-provider.h>
 
 static ulong clk_fixed_rate_get_rate(struct clk *clk)  { diff
--git a/include/linux/clk-provider.h

b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644

include/linux/clk-provider.h +0 -0
@@ -112,6 +112,13 @@ struct clk_fixed_factor {  #define

to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\ clk)

include/linux/clk-provider.h struct clk_fixed_factor { · line 118

Quoted 4 lines
include/linux/clk-provider.h +4 -0
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate;
+};

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property
- the 24MHz OSC)

Quoted 8 lines

include/linux/clk-provider.h struct clk_fixed_factor { · line 124

Quoted 6 lines
include/linux/clk-provider.h +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate

*)dev_get_platdata(dev)) +
int clk_register(struct clk *clk, const char *drv_name,

include/linux/clk-provider.h +0 -0
 		 ulong drv_data, const char *name,
 		 const char *parent_name);

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

Review

Quoted 3 lines
(quoted diff) +3 -0
+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK, "clock-osc-24m",
Quoted 5 lines

&devp);

Review

Quoted 2 lines
(quoted diff) +2 -0
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);

This code looks a bit strange to me. Why imx8mm sets parent here?

The A53 clk could not change on the fly. There is a mux here, one is PLL, one is OSC, And there are others. If we want to change the pll clock which is currently being used by A53, we need first switch the A53 clk to source from OSC, then change pll clock, then switch A53 clk back to PLL.

Quoted 13 lines

In the imx6q I write "osc" as a part of the clock tree:

        clk_dm(IMX6QDL_CLK_PLL2,
               imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc",
                             base + 0x30, 0x1));

And here the parent is set as "osc".

Moreover, the "osc" or in your case "clock-osc-24m" shall be available in "clocks" DTS node and hence parsed / setup from there (and be available in the clk uclass list).

Quoted 7 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);

Shouldn't this be set in DTS ? As it is now - it seems like a hardcoded value for early SPL clock setup. Am I right?

You mean get freq from cpu opp and set cpu freq? I do not have good idea how to set in DTS.

Thanks,
Peng.

Quoted 38 lines
Quoted 9 lines
(quoted diff) +7 -0
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);
Quoted 15 lines

Regards,
Peng.

Quoted 12 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#34 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 83 lines · On Wed, 8 May 2019 06:51:46 +0000 Peng Fan <[email protected]> wrote:
Quoted 83 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:46
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org; jagan at amarulasolutions.com; sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 63 lines · On Tue, 7 May 2019 13:27:45 +0000 Peng Fan <[email protected]> wrote:
Quoted 52 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 34 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 089f060a23..069e643fbc 100644 --- a/drivers/clk/clk_fixed_rate.c
+++ b/drivers/clk/clk_fixed_rate.c

drivers/clk/clk_fixed_rate.c +0 -8
@@ -6,13 +6,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
-
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate
 *)dev_get_platdata(dev)) +#include <linux/clk-provider.h>
 
 static ulong clk_fixed_rate_get_rate(struct clk *clk)  { diff
--git a/include/linux/clk-provider.h

b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644 --- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h

(quoted diff) +0 -0
@@ -112,6 +112,13 @@ struct clk_fixed_factor {  #define

to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\ clk)

include/linux/clk-provider.h struct clk_fixed_factor { · line 118

Quoted 4 lines
include/linux/clk-provider.h +4 -0
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate;
+};  

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property
- the 24MHz OSC)

Quoted 8 lines

include/linux/clk-provider.h struct clk_fixed_factor { · line 124

Quoted 6 lines
(quoted diff) +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate

*)dev_get_platdata(dev)) +
int clk_register(struct clk *clk, const char *drv_name,

include/linux/clk-provider.h +0 -0
 		 ulong drv_data, const char *name,
 		 const char *parent_name);  

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

Review

Quoted 3 lines
(quoted diff) +3 -0
+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK, "clock-osc-24m",  

&devp);

Quoted 2 lines
(quoted diff) +2 -0
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);  
Quoted 7 lines
Quoted 1 line

This code looks a bit strange to me. Why imx8mm sets parent here?

The A53 clk could not change on the fly. There is a mux here, one is PLL, one is OSC, And there are others. If we want to change the pll clock which is currently being used by A53, we need first switch the A53 clk to source from OSC, then change pll clock, then switch A53 clk back to PLL.

The above description looks like a "standard" procedure for bypassing PLL when it is going to be locked.

The same is also performed on IMX6Q:

https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx6q.c#L88

But I've not ported that part from the original Linux source code.

Quoted 19 lines
Quoted 19 lines

In the imx6q I write "osc" as a part of the clock tree:

        clk_dm(IMX6QDL_CLK_PLL2,
               imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc",
                             base + 0x30, 0x1));

And here the parent is set as "osc".

Moreover, the "osc" or in your case "clock-osc-24m" shall be available in "clocks" DTS node and hence parsed / setup from there (and be available in the clk uclass list).

Quoted 4 lines
(quoted diff) +4 -0
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);  
Quoted 5 lines
Quoted 2 lines

Shouldn't this be set in DTS ? As it is now - it seems like a hardcoded value for early SPL clock setup. Am I right?

You mean get freq from cpu opp and set cpu freq? I do not have good idea how to set in DTS.

I'm thinking about following description of the "osc" fixed clock:
https://elixir.bootlin.com/linux/v5.1/source/arch/arm/boot/dts/imx6qdl.dtsi#L64

and

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/dts/imx6qdl.dtsi;h=c0a94780087382a6e2805b7d6572f3e5e294e302;hb=HEAD#l53

The "fixed-clock" code has been adjusted to comply with the above DTS (which is provided in pre-reloc SPL - even before console and ddr setup).

(I had to use debug uart for debugging).

Quoted 42 lines

Thanks,
Peng.

Quoted 38 lines
Quoted 9 lines
(quoted diff) +7 -0
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);
Quoted 15 lines

Regards,
Peng.

Quoted 12 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/c8c9ec12/attachment.sig>

author reviewer
#35 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 106 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 15:40
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org; jagan at amarulasolutions.com; sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 06:51:46 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:46
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 77 lines
Quoted 77 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 63 lines · On Tue, 7 May 2019 13:27:45 +0000 Peng Fan <[email protected]> wrote:
Quoted 52 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 34 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 089f060a23..069e643fbc 100644 --- a/drivers/clk/clk_fixed_rate.c
+++ b/drivers/clk/clk_fixed_rate.c

drivers/clk/clk_fixed_rate.c +0 -8
@@ -6,13 +6,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
-
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate
 *)dev_get_platdata(dev)) +#include <linux/clk-provider.h>
 
 static ulong clk_fixed_rate_get_rate(struct clk *clk)  { diff
--git a/include/linux/clk-provider.h

b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644 --- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h

(quoted diff) +0 -0
@@ -112,6 +112,13 @@ struct clk_fixed_factor {  #define

to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\ clk)

include/linux/clk-provider.h struct clk_fixed_factor { · line 118

Quoted 4 lines
include/linux/clk-provider.h +4 -0
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate;
+};

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property
- the 24MHz OSC)

Quoted 8 lines

include/linux/clk-provider.h struct clk_fixed_factor { · line 124

Quoted 6 lines
(quoted diff) +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct clk_fixed_rate

*)dev_get_platdata(dev)) +
int clk_register(struct clk *clk, const char *drv_name,

include/linux/clk-provider.h +0 -0
 		 ulong drv_data, const char *name,
 		 const char *parent_name);

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

Review

Quoted 3 lines
(quoted diff) +3 -0
+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK, "clock-osc-24m",

&devp);

Quoted 2 lines
(quoted diff) +2 -0
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);
Quoted 7 lines
Quoted 1 line

This code looks a bit strange to me. Why imx8mm sets parent here?

The A53 clk could not change on the fly. There is a mux here, one is PLL, one is OSC, And there are others. If we want to change the pll clock which is currently being used by A53, we need first switch the A53 clk to source from OSC, then change pll clock, then switch A53 clk back to PLL.

Quoted 8 lines

The above description looks like a "standard" procedure for bypassing PLL when it is going to be locked.

The same is also performed on IMX6Q:

https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx6q.c#L88

But I've not ported that part from the original Linux source code.

i.MX8MM is different.

This is how Linux change cpu's clock.
https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx8mm.c#L655

It has a new cpu clk driver, I do not want to introduce that complexity in U-Boot.

This patch is just a simplified step of the upper Linux code.

The reason to configure the clk here is that ROM not configure the clock following datasheet even it not hurt, but better to configure it right in SPL.

Thanks,
Peng.

Quoted 97 lines
Quoted 20 lines
Quoted 20 lines

In the imx6q I write "osc" as a part of the clock tree:

        clk_dm(IMX6QDL_CLK_PLL2,
               imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus", "osc",
                             base + 0x30, 0x1));

And here the parent is set as "osc".

Moreover, the "osc" or in your case "clock-osc-24m" shall be available in "clocks" DTS node and hence parsed / setup from there (and be available in the clk uclass list).

Quoted 4 lines
(quoted diff) +4 -0
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);
Quoted 5 lines
Quoted 2 lines

Shouldn't this be set in DTS ? As it is now - it seems like a hardcoded value for early SPL clock setup. Am I right?

You mean get freq from cpu opp and set cpu freq? I do not have good idea how to set in DTS.

I'm thinking about following description of the "osc" fixed clock:
https://elixir.bootlin.com/linux/v5.1/source/arch/arm/boot/dts/imx6qdl.dtsi#
L64

and

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/dts/imx6qdl.
dtsi;h=c0a94780087382a6e2805b7d6572f3e5e294e302;hb=HEAD#l53

The "fixed-clock" code has been adjusted to comply with the above DTS (which is provided in pre-reloc SPL - even before console and ddr setup).

(I had to use debug uart for debugging).

Quoted 25 lines

Thanks,
Peng.

Quoted 21 lines
Quoted 21 lines
(quoted diff) +7 -0
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);

Regards,
Peng.

Quoted 9 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#36 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 118 lines · On Wed, 8 May 2019 07:45:39 +0000 Peng Fan <[email protected]> wrote:
Quoted 109 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 15:40
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org; jagan at amarulasolutions.com; sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 06:51:46 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:46
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 80 lines
Quoted 80 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 68 lines · On Tue, 7 May 2019 13:27:45 +0000 Peng Fan <[email protected]> wrote:
Quoted 54 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 36 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index
089f060a23..069e643fbc 100644 ---
a/drivers/clk/clk_fixed_rate.c +++
b/drivers/clk/clk_fixed_rate.c @@ -6,13 +6,7 @@
#include <common.h>
#include <clk-uclass.h>
#include <dm.h>

(quoted diff) +0 -7
-
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) +#include
<linux/clk-provider.h>

static ulong clk_fixed_rate_get_rate(struct clk *clk)
{ diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -112,6 +112,13 @@ struct clk_fixed_factor { #define to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\ clk)

Review

Quoted 4 lines
(quoted diff) +4 -0
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate;
+};  

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property
- the 24MHz OSC)

Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) +
int clk_register(struct clk *clk, const char *drv_name,

(quoted diff) +0 -0
 		 ulong drv_data, const char *name,
 		 const char *parent_name);  

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

(quoted diff) +3 -0
+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK,
Quoted 1 line

"clock-osc-24m",

&devp);

Quoted 2 lines
(quoted diff) +2 -0
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);  
Quoted 8 lines
Quoted 2 lines

This code looks a bit strange to me. Why imx8mm sets parent here?

The A53 clk could not change on the fly. There is a mux here, one is PLL, one is OSC, And there are others. If we want to change the pll clock which is currently being used by A53, we need first switch the A53 clk to source from OSC, then change pll clock, then switch A53 clk back to PLL.

Quoted 8 lines

The above description looks like a "standard" procedure for bypassing PLL when it is going to be locked.

The same is also performed on IMX6Q:

https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx6q.c#L88

But I've not ported that part from the original Linux source code.

Quoted 7 lines

i.MX8MM is different.

This is how Linux change cpu's clock.
https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx8mm.c#L655

It has a new cpu clk driver, I do not want to introduce that complexity in U-Boot.

Ok.

Quoted 2 lines

This patch is just a simplified step of the upper Linux code.

My point is that this driver pollutes the fixed-clock code and makes it imx8 specific.

Quoted 4 lines

The reason to configure the clk here is that ROM not configure the clock following datasheet even it not hurt, but better to configure it right in SPL.

So this code is for fixing bugs (incomplete initialisation) in SoC's ROM?

Quoted 102 lines

Thanks,
Peng.

Quoted 98 lines
Quoted 20 lines
Quoted 20 lines

In the imx6q I write "osc" as a part of the clock tree:

        clk_dm(IMX6QDL_CLK_PLL2,
               imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus",

"osc", base + 0x30, 0x1));

And here the parent is set as "osc".

Moreover, the "osc" or in your case "clock-osc-24m" shall be available in "clocks" DTS node and hence parsed / setup from there (and be available in the clk uclass list).

Quoted 4 lines
(quoted diff) +4 -0
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);  
Quoted 5 lines
Quoted 2 lines

Shouldn't this be set in DTS ? As it is now - it seems like a hardcoded value for early SPL clock setup. Am I right?

You mean get freq from cpu opp and set cpu freq? I do not have good idea how to set in DTS.

I'm thinking about following description of the "osc" fixed clock:
https://elixir.bootlin.com/linux/v5.1/source/arch/arm/boot/dts/imx6qdl.dtsi#
L64

and

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/dts/imx6qdl.
dtsi;h=c0a94780087382a6e2805b7d6572f3e5e294e302;hb=HEAD#l53

The "fixed-clock" code has been adjusted to comply with the above DTS (which is provided in pre-reloc SPL - even before console and ddr setup).

(I had to use debug uart for debugging).

Quoted 25 lines

Thanks,
Peng.

Quoted 21 lines
Quoted 21 lines
(quoted diff) +7 -0
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);

Regards,
Peng.

Quoted 9 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190509/30c7aa3c/attachment.sig>

author reviewer
#37 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 131 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 07:45:39 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 15:40
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 110 lines
Quoted 103 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 06:51:46 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:46
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 77 lines
Quoted 77 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 65 lines · On Tue, 7 May 2019 13:27:45 +0000 Peng Fan <[email protected]> wrote:
Quoted 51 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 34 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 089f060a23..069e643fbc 100644 --- a/drivers/clk/clk_fixed_rate.c +++ b/drivers/clk/clk_fixed_rate.c @@ -6,13 +6,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h>

(quoted diff) +0 -7
-
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) +#include
<linux/clk-provider.h>

static ulong clk_fixed_rate_get_rate(struct clk *clk) {

(quoted diff) +0 -0

b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -112,6 +112,13 @@ struct clk_fixed_factor { #define to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\ clk)

Review

Quoted 3 lines
(quoted diff) +3 -0
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate; };

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property
- the 24MHz OSC)

Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) + int clk_register(struct clk *clk, const char *drv_name,

(quoted diff) +0 -0
 		 ulong drv_data, const char *name,
 		 const char *parent_name);

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

(quoted diff) +3 -0
+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK,
Quoted 1 line

"clock-osc-24m",

&devp);

Quoted 2 lines
(quoted diff) +2 -0
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);
Quoted 8 lines
Quoted 2 lines

This code looks a bit strange to me. Why imx8mm sets parent here?

The A53 clk could not change on the fly. There is a mux here, one is PLL, one is OSC, And there are others. If we want to change the pll clock which is currently being used by A53, we need first switch the A53 clk to source from OSC, then change pll clock, then switch A53 clk back to PLL.

The above description looks like a "standard" procedure for bypassing PLL when it is going to be locked.

Quoted 6 lines

The same is also performed on IMX6Q:

https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx
6q.c#L88

But I've not ported that part from the original Linux source code.

Quoted 8 lines

i.MX8MM is different.

This is how Linux change cpu's clock.
https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx8m
m.c#L655

It has a new cpu clk driver, I do not want to introduce that complexity in U-Boot.

Quoted 7 lines

Ok.

Quoted 2 lines

This patch is just a simplified step of the upper Linux code.

My point is that this driver pollutes the fixed-clock code and makes it imx8 specific.

If i.MX7 switch to CCF, it also has such requirement.

I am not sure others, Linux exports
grep "to_clk_fix" ./include/linux/clk-provider.h -rn
313:#define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw) 575:#define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)

I think it does not hurt for uboot also export it.

Quoted 7 lines
Quoted 5 lines

The reason to configure the clk here is that ROM not configure the clock following datasheet even it not hurt, but better to configure it right in SPL.

So this code is for fixing bugs (incomplete initialisation) in SoC's ROM?

Strictly speaking it is not a bug. The datasheet opp has 1.2GHz, but not 1GHz configured by ROM. But actually when power up, the initial freq is 24MHz. Just configure in uboot to follow datasheet and might make Linux kernel happy.

Thanks,
Peng.

Quoted 120 lines
Quoted 39 lines

Thanks,
Peng.

Quoted 34 lines
Quoted 20 lines
Quoted 20 lines

In the imx6q I write "osc" as a part of the clock tree:

        clk_dm(IMX6QDL_CLK_PLL2,
               imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus",

"osc", base + 0x30, 0x1));

And here the parent is set as "osc".

Moreover, the "osc" or in your case "clock-osc-24m" shall be available in "clocks" DTS node and hence parsed / setup from there (and be available in the clk uclass list).

Quoted 4 lines
(quoted diff) +4 -0
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);
Quoted 5 lines
Quoted 2 lines

Shouldn't this be set in DTS ? As it is now - it seems like a hardcoded value for early SPL clock setup. Am I right?

You mean get freq from cpu opp and set cpu freq? I do not have good idea how to set in DTS.

I'm thinking about following description of the "osc" fixed clock:
https://elixir.bootlin.com/linux/v5.1/source/arch/arm/boot/dts/imx6q
dl.dtsi#
L64

and

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/dts/imx6qdl.

Quoted 41 lines
Quoted 41 lines

dtsi;h=c0a94780087382a6e2805b7d6572f3e5e294e302;hb=HEAD#l53

The "fixed-clock" code has been adjusted to comply with the above DTS (which is provided in pre-reloc SPL - even before console and ddr setup).

(I had to use debug uart for debugging).

Quoted 25 lines

Thanks,
Peng.

Quoted 21 lines
Quoted 21 lines
(quoted diff) +7 -0
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);

Regards,
Peng.

Quoted 9 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#38 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 157 lines · On Thu, 9 May 2019 01:13:15 +0000 Peng Fan <[email protected]> wrote:
Quoted 133 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 07:45:39 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 15:40
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 111 lines
Quoted 103 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 06:51:46 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:46
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 77 lines
Quoted 77 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 65 lines · On Tue, 7 May 2019 13:27:45 +0000 Peng Fan <[email protected]> wrote:
Quoted 51 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 34 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index
089f060a23..069e643fbc 100644 ---
a/drivers/clk/clk_fixed_rate.c +++
b/drivers/clk/clk_fixed_rate.c @@ -6,13 +6,7 @@
#include <common.h> #include <clk-uclass.h>
#include <dm.h> -

(quoted diff) +0 -6
-struct clk_fixed_rate {
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) +#include
<linux/clk-provider.h>

static ulong clk_fixed_rate_get_rate(struct clk
*clk) { diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -112,6 +112,13 @@ struct clk_fixed_factor { #define to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\ clk)

Review

Quoted 3 lines
(quoted diff) +3 -0
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate; };  

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property
- the 24MHz OSC)

Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) + int clk_register(struct clk *clk, const char *drv_name,

(quoted diff) +0 -0
 		 ulong drv_data, const char *name,
 		 const char *parent_name);  

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

(quoted diff) +3 -0
+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK,
Quoted 1 line

"clock-osc-24m",

&devp);

Quoted 2 lines
(quoted diff) +2 -0
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);  
Quoted 8 lines
Quoted 2 lines

This code looks a bit strange to me. Why imx8mm sets parent here?

The A53 clk could not change on the fly. There is a mux here, one is PLL, one is OSC, And there are others. If we want to change the pll clock which is currently being used by A53, we need first switch the A53 clk to source from OSC, then change pll clock, then switch A53 clk back to PLL.

The above description looks like a "standard" procedure for bypassing PLL when it is going to be locked.

Quoted 7 lines

The same is also performed on IMX6Q:

https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx
6q.c#L88

But I've not ported that part from the original Linux source code.

Quoted 8 lines

i.MX8MM is different.

This is how Linux change cpu's clock.
https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-imx8m
m.c#L655

It has a new cpu clk driver, I do not want to introduce that complexity in U-Boot.

Quoted 7 lines

Ok.

Quoted 2 lines

This patch is just a simplified step of the upper Linux code.

My point is that this driver pollutes the fixed-clock code and makes it imx8 specific.

If i.MX7 switch to CCF, it also has such requirement.

I am not sure others, Linux exports
grep "to_clk_fix" ./include/linux/clk-provider.h -rn 313:#define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw) 575:#define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)

I think it does not hurt for uboot also export it.

Quoted 6 lines
Quoted 5 lines

The reason to configure the clk here is that ROM not configure the clock following datasheet even it not hurt, but better to configure it right in SPL.

Quoted 7 lines
Quoted 2 lines

So this code is for fixing bugs (incomplete initialisation) in SoC's ROM?

Strictly speaking it is not a bug. The datasheet opp has 1.2GHz, but not 1GHz configured by ROM. But actually when power up, the initial freq is 24MHz. Just configure in uboot to follow datasheet and might make Linux kernel happy.

For IMX6Q there is a table in the User Manual, which describes the state (i.e. the clock frequencies of the IP blocks) in which is the board when ROM handles the execution to SPL.

I also assume that 24 MHz Core frequency is too low and will be fixed in next ROM (SoC) revisions ?

Quoted 125 lines

Thanks,
Peng.

Quoted 121 lines
Quoted 39 lines

Thanks,
Peng.

Quoted 34 lines
Quoted 20 lines
Quoted 20 lines

In the imx6q I write "osc" as a part of the clock tree:

        clk_dm(IMX6QDL_CLK_PLL2,
               imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2_bus",

"osc", base + 0x30, 0x1));

And here the parent is set as "osc".

Moreover, the "osc" or in your case "clock-osc-24m" shall be available in "clocks" DTS node and hence parsed / setup from there (and be available in the clk uclass list).

Quoted 4 lines
(quoted diff) +4 -0
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);  
Quoted 5 lines
Quoted 2 lines

Shouldn't this be set in DTS ? As it is now - it seems like a hardcoded value for early SPL clock setup. Am I right?

You mean get freq from cpu opp and set cpu freq? I do not have good idea how to set in DTS.

I'm thinking about following description of the "osc" fixed clock:
https://elixir.bootlin.com/linux/v5.1/source/arch/arm/boot/dts/imx6q
dl.dtsi# L64

and

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/dts/imx6qdl.

Quoted 42 lines
Quoted 42 lines

dtsi;h=c0a94780087382a6e2805b7d6572f3e5e294e302;hb=HEAD#l53

The "fixed-clock" code has been adjusted to comply with the above DTS (which is provided in pre-reloc SPL - even before console and ddr setup).

(I had to use debug uart for debugging).

Quoted 26 lines

Thanks,
Peng.

Quoted 22 lines
Quoted 22 lines
(quoted diff) +7 -0
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);

Regards,
Peng.

Quoted 10 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing
Director:

Wolfgang

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190516/31822349/attachment.sig>

author reviewer
#39 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 171 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 158 lines · On Thu, 9 May 2019 01:13:15 +0000 Peng Fan <[email protected]> wrote:
Quoted 134 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 07:45:39 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 15:40
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 113 lines
Quoted 102 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 06:51:46 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:46
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 76 lines
Quoted 76 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 64 lines · On Tue, 7 May 2019 13:27:45 +0000 Peng Fan <[email protected]> wrote:
Quoted 50 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Hi Peng,

Quoted 33 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 089f060a23..069e643fbc 100644 --- a/drivers/clk/clk_fixed_rate.c +++ b/drivers/clk/clk_fixed_rate.c @@ -6,13 +6,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> - -struct clk_fixed_rate {

(quoted diff) +0 -5
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) +#include
<linux/clk-provider.h>

static ulong clk_fixed_rate_get_rate(struct clk
*clk) { diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 3ed0db86d2..b2bed768b6 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -112,6 +112,13 @@ struct clk_fixed_factor { #define to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\ clk)

Review

Quoted 3 lines
(quoted diff) +3 -0
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate; };

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property
- the 24MHz OSC)

Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) + int clk_register(struct clk *clk, const char *drv_name,

(quoted diff) +0 -0
 		 ulong drv_data, const char *name,
 		 const char *parent_name);

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

(quoted diff) +3 -0
+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK,
Quoted 1 line

"clock-osc-24m",

&devp);

Quoted 2 lines
(quoted diff) +2 -0
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);
Quoted 8 lines
Quoted 2 lines

This code looks a bit strange to me. Why imx8mm sets parent here?

The A53 clk could not change on the fly. There is a mux here, one is PLL, one is OSC, And there are others. If we want to change the pll clock which is currently being used by A53, we need first switch the A53 clk to source from OSC, then change pll clock, then switch A53 clk back to PLL.

The above description looks like a "standard" procedure for bypassing PLL when it is going to be locked.

Quoted 8 lines

The same is also performed on IMX6Q:

https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk
-imx
6q.c#L88

But I've not ported that part from the original Linux source code.

i.MX8MM is different.

Quoted 7 lines

This is how Linux change cpu's clock.
https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-i
mx8m
m.c#L655

It has a new cpu clk driver, I do not want to introduce that complexity in U-Boot.

Quoted 7 lines

Ok.

Quoted 2 lines

This patch is just a simplified step of the upper Linux code.

My point is that this driver pollutes the fixed-clock code and makes it imx8 specific.

If i.MX7 switch to CCF, it also has such requirement.

I am not sure others, Linux exports
grep "to_clk_fix" ./include/linux/clk-provider.h -rn 313:#define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw) 575:#define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)

I think it does not hurt for uboot also export it.

Quoted 6 lines
Quoted 5 lines

The reason to configure the clk here is that ROM not configure the clock following datasheet even it not hurt, but better to configure it right in SPL.

Quoted 7 lines
Quoted 2 lines

So this code is for fixing bugs (incomplete initialisation) in SoC's ROM?

Strictly speaking it is not a bug. The datasheet opp has 1.2GHz, but not 1GHz configured by ROM. But actually when power up, the initial freq is 24MHz. Just configure in uboot to follow datasheet and might make Linux kernel happy.

Quoted 6 lines

For IMX6Q there is a table in the User Manual, which describes the state (i.e. the clock frequencies of the IP blocks) in which is the board when ROM handles the execution to SPL.

I also assume that 24 MHz Core frequency is too low and will be fixed in next ROM (SoC) revisions ?

When power up, before ROM configure PLL, the core will runs at osc clock, After ROM configures ARM PLL, the core will runs at higher frequency.

It is just ROM not configure ARM PLL following datasheet, but it is not actually an issue here. U-Boot just following spec to reconfigure the ARM PLL.

Regards,
Peng.

Quoted 144 lines
Quoted 17 lines

Thanks,
Peng.

Quoted 12 lines
Quoted 12 lines

Thanks,
Peng.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

In the imx6q I write "osc" as a part of the clock tree:

        clk_dm(IMX6QDL_CLK_PLL2,
               imx_clk_pllv3(IMX_PLLV3_GENERIC,

"pll2_bus",

Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
Quoted 13 lines
Quoted 13 lines

"osc", base + 0x30, 0x1));

And here the parent is set as "osc".

Moreover, the "osc" or in your case "clock-osc-24m" shall be available in "clocks" DTS node and hence parsed / setup from there (and be available in the clk uclass list).

Quoted 4 lines
(quoted diff) +4 -0
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);
Quoted 5 lines
Quoted 2 lines

Shouldn't this be set in DTS ? As it is now - it seems like a hardcoded value for early SPL clock setup. Am I right?

You mean get freq from cpu opp and set cpu freq? I do not have good idea how to set in DTS.

I'm thinking about following description of the "osc" fixed clock:
https://elixir.bootlin.com/linux/v5.1/source/arch/arm/boot/dts/i
mx6q
dl.dtsi# L64

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

and

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/dts/imx6qdl.

Quoted 57 lines
Quoted 57 lines
Quoted 42 lines
Quoted 42 lines

dtsi;h=c0a94780087382a6e2805b7d6572f3e5e294e302;hb=HEAD#l53

The "fixed-clock" code has been adjusted to comply with the above DTS (which is provided in pre-reloc SPL - even before console and ddr setup).

(I had to use debug uart for debugging).

Quoted 26 lines

Thanks,
Peng.

Quoted 22 lines
Quoted 22 lines
(quoted diff) +7 -0
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);

Regards,
Peng.

Quoted 10 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing
Director:

Wolfgang

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#40 lore raw

PATCH 11/41 clk: fixed_rate: export clk_fixed_rate

Quoted 182 lines · On Thu, 16 May 2019 09:58:17 +0000 Peng Fan <[email protected]> wrote:
Quoted 175 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 161 lines · On Thu, 9 May 2019 01:13:15 +0000 Peng Fan <[email protected]> wrote:
Quoted 136 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 07:45:39 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 15:40
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 115 lines
Quoted 104 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 6 lines · On Wed, 8 May 2019 06:51:46 +0000 Peng Fan <[email protected]> wrote:
Quoted 6 lines

-----Original Message-----
From: Lukasz Majewski [mailto:lukma at denx.de]
Sent: 2019年5月8日 14:46
To: Peng Fan <[email protected]>
Cc: sbabic at denx.de; festevam at gmail.com; dl-uboot-imx <[email protected]>; sjg at chromium.org;

jagan at amarulasolutions.com;

Quoted 80 lines
Quoted 73 lines

sr at denx.de; u-boot at lists.denx.de; trini at konsulko.com
Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate: export clk_fixed_rate

Quoted 65 lines · On Tue, 7 May 2019 13:27:45 +0000 Peng Fan <[email protected]> wrote:
Quoted 50 lines

Subject: Re: [i.MX8MM+CCF 11/41] clk: fixed_rate:
export clk_fixed_rate

Hi Peng,

Quoted 33 lines

Export the structure for others to use.

---
 drivers/clk/clk_fixed_rate.c | 8 +-------
include/linux/clk-provider.h | 7 +++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index
089f060a23..069e643fbc 100644 ---
a/drivers/clk/clk_fixed_rate.c +++
b/drivers/clk/clk_fixed_rate.c @@ -6,13 +6,7 @@
#include <common.h> #include <clk-uclass.h>
#include <dm.h> - -struct clk_fixed_rate {

(quoted diff) +0 -5
-	struct clk clk;
-	unsigned long fixed_rate;
-};
-
-#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) +#include
<linux/clk-provider.h>

static ulong clk_fixed_rate_get_rate(struct clk
*clk) { diff --git a/include/linux/clk-provider.h
b/include/linux/clk-provider.h index
3ed0db86d2..b2bed768b6 100644 ---
a/include/linux/clk-provider.h +++
b/include/linux/clk-provider.h @@ -112,6 +112,13
@@ struct clk_fixed_factor { #define
to_clk_fixed_factor(_clk) container_of(_clk,
struct clk_fixed_factor,\ clk)

Review

Quoted 3 lines
(quoted diff) +3 -0
+struct clk_fixed_rate {
+	struct clk clk;
+	unsigned long fixed_rate; };  

I think that this struct shall stay where it was. Moreover, the clk-provider.h is not the API to be used by other parts of the clock API.

The clk_fixed_rate shall be accessed via get_rate() only and in IMX6Q it is available in early SPL (parsed from dts /clocks property
- the 24MHz OSC)

Quoted 9 lines
Quoted 6 lines
(quoted diff) +2 -0
+
+#define to_clk_fixed_rate(dev)	((struct

clk_fixed_rate *)dev_get_platdata(dev)) + int
clk_register(struct clk *clk, const char
*drv_name, ulong drv_data, const char *name,
const char *parent_name);

Please explain why iMX8MM needs such global export?

In clk-imx8mm.c, first configure ARM clk to osc24M fixed clk to change pll clock.

(quoted diff) +3 -0
+       /* Configure ARM to osc24M */
+       clk_get_by_id(IMX8MM_CLK_A53_SRC, &clkp);
+       uclass_get_device_by_name(UCLASS_CLK,
Quoted 1 line

"clock-osc-24m",

Quoted 6 lines

&devp);

Review

Quoted 2 lines
(quoted diff) +2 -0
+       clkp1 = &to_clk_fixed_rate(devp)->clk;
+       clk_set_parent(clkp, clkp1);  

This code looks a bit strange to me. Why imx8mm sets parent here?

Quoted 6 lines

The A53 clk could not change on the fly. There is a mux here, one is PLL, one is OSC, And there are others. If we want to change the pll clock which is currently being used by A53, we need first switch the A53 clk to source from OSC, then change pll clock, then switch A53 clk back to PLL.

The above description looks like a "standard" procedure for bypassing PLL when it is going to be locked.

Quoted 8 lines

The same is also performed on IMX6Q:

https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk
-imx
6q.c#L88

But I've not ported that part from the original Linux source code.

i.MX8MM is different.

Quoted 7 lines

This is how Linux change cpu's clock.
https://elixir.bootlin.com/linux/v5.1/source/drivers/clk/imx/clk-i
mx8m
m.c#L655

It has a new cpu clk driver, I do not want to introduce that complexity in U-Boot.

Quoted 8 lines

Ok.

Quoted 3 lines

This patch is just a simplified step of the upper Linux code.

My point is that this driver pollutes the fixed-clock code and makes it imx8 specific.

If i.MX7 switch to CCF, it also has such requirement.

I am not sure others, Linux exports
grep "to_clk_fix" ./include/linux/clk-provider.h -rn 313:#define to_clk_fixed_rate(_hw) container_of(_hw, struct clk_fixed_rate, hw) 575:#define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)

I think it does not hurt for uboot also export it.

Quoted 6 lines
Quoted 5 lines

The reason to configure the clk here is that ROM not configure the clock following datasheet even it not hurt, but better to configure it right in SPL.

Quoted 7 lines
Quoted 2 lines

So this code is for fixing bugs (incomplete initialisation) in SoC's ROM?

Strictly speaking it is not a bug. The datasheet opp has 1.2GHz, but not 1GHz configured by ROM. But actually when power up, the initial freq is 24MHz. Just configure in uboot to follow datasheet and might make Linux kernel happy.

Quoted 6 lines

For IMX6Q there is a table in the User Manual, which describes the state (i.e. the clock frequencies of the IP blocks) in which is the board when ROM handles the execution to SPL.

I also assume that 24 MHz Core frequency is too low and will be fixed in next ROM (SoC) revisions ?

Quoted 7 lines

When power up, before ROM configure PLL, the core will runs at osc clock, After ROM configures ARM PLL, the core will runs at higher frequency.

It is just ROM not configure ARM PLL following datasheet, but it is not actually an issue here. U-Boot just following spec to reconfigure the ARM PLL.

Ach... OK. I must have misunderstood the last e-mail. The issue is with difference between 1.2 GHz and 1.0 GHz PLL configuration.

Quoted 151 lines

Regards,
Peng.

Quoted 147 lines
Quoted 17 lines

Thanks,
Peng.

Quoted 12 lines
Quoted 12 lines

Thanks,
Peng.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

In the imx6q I write "osc" as a part of the clock tree:

        clk_dm(IMX6QDL_CLK_PLL2,
               imx_clk_pllv3(IMX_PLLV3_GENERIC,  

"pll2_bus",

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 13 lines
Quoted 13 lines

"osc", base + 0x30, 0x1));

And here the parent is set as "osc".

Moreover, the "osc" or in your case "clock-osc-24m" shall be available in "clocks" DTS node and hence parsed / setup from there (and be available in the clk uclass list).

Quoted 4 lines
(quoted diff) +4 -0
+
+       /* Configure ARM PLL to 1.2GHz */
+       clk_get_by_id(IMX8MM_ARM_PLL, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);  
Quoted 6 lines
Quoted 3 lines

Shouldn't this be set in DTS ? As it is now - it seems like a hardcoded value for early SPL clock setup. Am I right?

You mean get freq from cpu opp and set cpu freq? I do not have good idea how to set in DTS.

I'm thinking about following description of the "osc" fixed clock:
https://elixir.bootlin.com/linux/v5.1/source/arch/arm/boot/dts/i
mx6q
dl.dtsi# L64

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
Quoted 3 lines

and

http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/dts/imx6qdl.

Quoted 59 lines
Quoted 59 lines
Quoted 43 lines
Quoted 43 lines

dtsi;h=c0a94780087382a6e2805b7d6572f3e5e294e302;hb=HEAD#l53

The "fixed-clock" code has been adjusted to comply with the above DTS (which is provided in pre-reloc SPL - even before console and ddr setup).

(I had to use debug uart for debugging).

Quoted 26 lines

Thanks,
Peng.

Quoted 22 lines
Quoted 22 lines
(quoted diff) +7 -0
+       clk_get_by_id(IMX8MM_ARM_PLL_OUT, &clkp1);
+       clk_enable(clkp1);
+       clk_set_parent(clkp, clkp1);
+
+       /* Configure DIV to 1.2GHz */
+       clk_get_by_id(IMX8MM_CLK_A53_DIV, &clkp1);
+       clk_set_rate(clkp1, 1200000000UL);

Regards,
Peng.

Quoted 10 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing
Director:

Wolfgang

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone:
(+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing
Director:

Wolfgang

Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director:

Wolfgang

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines

Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
(+49)-8142-66989-80 Email: lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190516/ddd985ed/attachment.sig>

author reviewer
#41 lore raw

PATCH 12/41 clk: fixed_rate: add pre reloc flag

In reply to Peng Fan

Add pre reloc flag to use this driver before relocation

---
 drivers/clk/clk_fixed_rate.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/clk_fixed_rate.c +1 -0
index 069e643fbc..debada1463 100644
@@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
 	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
 	.ops = &clk_fixed_rate_ops,
+	.flags = DM_FLAG_PRE_RELOC,
 };
Signature · 1 line
2.16.4
#42 lore raw

PATCH 12/41 clk: fixed_rate: add pre reloc flag

Quoted 12 lines · On Tue, 30 Apr 2019 10:18:12 +0000 Peng Fan <[email protected]> wrote:

Add pre reloc flag to use this driver before relocation

---
 drivers/clk/clk_fixed_rate.c | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644

drivers/clk/clk_fixed_rate.c U_BOOT_DRIVER(clk_fixed_rate) = { · line 49

Quoted 5 lines
drivers/clk/clk_fixed_rate.c +1 -0
@@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
 	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
 	.ops = &clk_fixed_rate_ops,
+	.flags = DM_FLAG_PRE_RELOC,
 };

This probably shall be done with proper dts file (from TPC70 - imx6q conversion code):

+#include "imx6qdl-u-boot.dtsi"
+
+/ {
+ clocks {
+ u-boot,dm-spl;
+ osc {
+ u-boot,dm-spl;
+ };
+ };
+};
+
+&clks {
+ u-boot,dm-pre-reloc;
+};

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190507/255a22d8/attachment.sig>

author reviewer
#43 lore raw

PATCH 12/41 clk: fixed_rate: add pre reloc flag

Quoted 12 lines

Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag

Quoted 7 lines · On Tue, 30 Apr 2019 10:18:12 +0000 Peng Fan <[email protected]> wrote:

Add pre reloc flag to use this driver before relocation

---
 drivers/clk/clk_fixed_rate.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/clk/clk_fixed_rate.c U_BOOT_DRIVER(clk_fixed_rate) = { · line 49

Quoted 10 lines
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644

drivers/clk/clk_fixed_rate.c +1 -0
@@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
 	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
 	.ops = &clk_fixed_rate_ops,
+	.flags = DM_FLAG_PRE_RELOC,
 };

This probably shall be done with proper dts file (from TPC70 - imx6q conversion code):

My understanding is DM_FLAG_PRE_RELOC will let the driver could be used before relocation. The dts u-boot,dm-spl or u-boot,dm-pre-reloc is just to mark the device could be used at the corresponding stage. Only modify dts will not make it work without the DM_FLAG_PRE_RELOC, Right?

Thanks,
Peng.

Quoted 28 lines
(quoted diff) +14 -0
+#include "imx6qdl-u-boot.dtsi"
+
+/ {
+	clocks {
+		u-boot,dm-spl;
+		osc {
+			u-boot,dm-spl;
+		};
+	};
+};
+
+&clks {
+	u-boot,dm-pre-reloc;
+};

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

#44 lore raw

PATCH 12/41 clk: fixed_rate: add pre reloc flag

Hi Peng,

Quoted 27 lines · Peng Fan
Quoted 13 lines

Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag

Quoted 7 lines · On Tue, 30 Apr 2019 10:18:12 +0000 Peng Fan <[email protected]> wrote:

Add pre reloc flag to use this driver before relocation

---
 drivers/clk/clk_fixed_rate.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/clk/clk_fixed_rate.c U_BOOT_DRIVER(clk_fixed_rate) = { · line 49

Quoted 10 lines
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644

drivers/clk/clk_fixed_rate.c +1 -0
@@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
    .ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
    .platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
    .ops = &clk_fixed_rate_ops,
+   .flags = DM_FLAG_PRE_RELOC,
 };

This probably shall be done with proper dts file (from TPC70 - imx6q conversion code):

Quoted 6 lines

My understanding is DM_FLAG_PRE_RELOC will let the driver could be used before relocation. The dts u-boot,dm-spl or u-boot,dm-pre-reloc is just to mark the device could be used at the corresponding stage. Only modify dts will not make it work without the DM_FLAG_PRE_RELOC, Right?

I think your understanding is correct. For device tree that cannot be modified by U-Boot, eg: DT passed from previous bootloader, the only way to support pre-relocation binding is to add DM_FLAG_PRE_RELOC in the U-Boot driver.

Regards,
Bin

#45 lore raw

PATCH 12/41 clk: fixed_rate: add pre reloc flag

Quoted 38 lines · On Tue, 7 May 2019 22:00:14 +0800 Bin Meng <[email protected]> wrote:

Hi Peng,

Quoted 28 lines · Peng Fan
Quoted 14 lines

Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag

Quoted 7 lines · On Tue, 30 Apr 2019 10:18:12 +0000 Peng Fan <[email protected]> wrote:

Add pre reloc flag to use this driver before relocation

---
 drivers/clk/clk_fixed_rate.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/clk/clk_fixed_rate.c U_BOOT_DRIVER(clk_fixed_rate) = { · line 49

Quoted 10 lines
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644 --- a/drivers/clk/clk_fixed_rate.c
+++ b/drivers/clk/clk_fixed_rate.c

drivers/clk/clk_fixed_rate.c +1 -0
@@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
    .ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
    .platdata_auto_alloc_size = sizeof(struct clk_fixed_rate),
    .ops = &clk_fixed_rate_ops,
+   .flags = DM_FLAG_PRE_RELOC,
 };  

This probably shall be done with proper dts file (from TPC70 - imx6q conversion code):

Quoted 6 lines

My understanding is DM_FLAG_PRE_RELOC will let the driver could be used before relocation. The dts u-boot,dm-spl or u-boot,dm-pre-reloc is just to mark the device could be used at the corresponding stage. Only modify dts will not make it work without the DM_FLAG_PRE_RELOC, Right?

Quoted 4 lines

I think your understanding is correct. For device tree that cannot be modified by U-Boot, eg: DT passed from previous bootloader, the only way to support pre-relocation binding is to add DM_FLAG_PRE_RELOC in the U-Boot driver.

But as fair as I understand - the discussion is about SPL, not u-boot's proper pre-location stage.

Please correct me if I'm wrong, but the recent code removes from u-boot's proper DTS u-boot,dm-* properties.

Quoted 5 lines

Regards,
Bin

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/e6534bb9/attachment.sig>

#46 lore raw

PATCH 12/41 clk: fixed_rate: add pre reloc flag

In reply to Peng Fan
Quoted 26 lines · On Tue, 7 May 2019 13:29:41 +0000 Peng Fan <[email protected]> wrote:
Quoted 12 lines

Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag

Quoted 7 lines · On Tue, 30 Apr 2019 10:18:12 +0000 Peng Fan <[email protected]> wrote:

Add pre reloc flag to use this driver before relocation

---
 drivers/clk/clk_fixed_rate.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/clk/clk_fixed_rate.c U_BOOT_DRIVER(clk_fixed_rate) = { · line 49

Quoted 10 lines
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644

drivers/clk/clk_fixed_rate.c +1 -0
@@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
 	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct
 clk_fixed_rate), .ops = &clk_fixed_rate_ops,
+	.flags = DM_FLAG_PRE_RELOC,
 };  

This probably shall be done with proper dts file (from TPC70 - imx6q conversion code):

Quoted 2 lines

My understanding is DM_FLAG_PRE_RELOC will let the driver could be used before relocation.

I think that there is OR -> DM_FLAG_PRE_RELOC OR DTS attribute (u-boot,dm-spl {pre-reloc}) to use device in early SPL.

Please look into drivers/core/lists.c Line 175:

if (pre_reloc_only) {
if (!dm_ofnode_pre_reloc(node)·&&

	!(entry->flags & DM_FLAG_PRE_RELOC))
	return 0;
}                                                                                                                                                                                                                             

We do not bind device only if there is NO DM_FLAG_PRE_RELOC set AND the u-boot,dm-* property is not set in corresponding DTS node.

Quoted 28 lines

The dts u-boot,dm-spl or u-boot,dm-pre-reloc
is just to mark the device could be used at the corresponding stage. Only modify dts will not make it work without the DM_FLAG_PRE_RELOC, Right?

Thanks,
Peng.

Quoted 20 lines
(quoted diff) +14 -0
+#include "imx6qdl-u-boot.dtsi"
+
+/ {
+	clocks {
+		u-boot,dm-spl;
+		osc {
+			u-boot,dm-spl;
+		};
+	};
+};
+
+&clks {
+	u-boot,dm-pre-reloc;
+};

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190508/e44944fb/attachment.sig>

author reviewer
#47 lore raw

PATCH 12/41 clk: fixed_rate: add pre reloc flag

Quoted 38 lines

Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag

Quoted 26 lines · On Tue, 7 May 2019 13:29:41 +0000 Peng Fan <[email protected]> wrote:
Quoted 12 lines

Subject: Re: [i.MX8MM+CCF 12/41] clk: fixed_rate: add pre reloc flag

Quoted 7 lines · On Tue, 30 Apr 2019 10:18:12 +0000 Peng Fan <[email protected]> wrote:

Add pre reloc flag to use this driver before relocation

---
 drivers/clk/clk_fixed_rate.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 13 lines

drivers/clk/clk_fixed_rate.c U_BOOT_DRIVER(clk_fixed_rate) = { · line 49

Quoted 10 lines
(quoted diff) +0 -0

b/drivers/clk/clk_fixed_rate.c index 069e643fbc..debada1463 100644

drivers/clk/clk_fixed_rate.c +1 -0
@@ -45,4 +45,5 @@ U_BOOT_DRIVER(clk_fixed_rate) = {
 	.ofdata_to_platdata = clk_fixed_rate_ofdata_to_platdata,
 	.platdata_auto_alloc_size = sizeof(struct clk_fixed_rate), .ops
 = &clk_fixed_rate_ops,
+	.flags = DM_FLAG_PRE_RELOC,
 };

This probably shall be done with proper dts file (from TPC70 - imx6q conversion code):

Quoted 2 lines

My understanding is DM_FLAG_PRE_RELOC will let the driver could be used before relocation.

I think that there is OR -> DM_FLAG_PRE_RELOC OR DTS attribute (u-boot,dm-spl {pre-reloc}) to use device in early SPL.

Quoted 7 lines

Please look into drivers/core/lists.c Line 175:

if (pre_reloc_only) {
if (!dm_ofnode_pre_reloc(node)·&&

	!(entry->flags & DM_FLAG_PRE_RELOC))
	return 0;
}

ok, this is new code from Bin.
According this code, only need dts change is enough, no need this driver flag. I'll drop this patch.

Thanks,
Peng.

Quoted 54 lines

We do not bind device only if there is NO DM_FLAG_PRE_RELOC set AND the u-boot,dm-* property is not set in corresponding DTS node.

Quoted 28 lines

The dts u-boot,dm-spl or u-boot,dm-pre-reloc is just to mark the device could be used at the corresponding stage.
Only modify dts will not make it work without the DM_FLAG_PRE_RELOC, Right?

Thanks,
Peng.

Quoted 20 lines
(quoted diff) +14 -0
+#include "imx6qdl-u-boot.dtsi"
+
+/ {
+	clocks {
+		u-boot,dm-spl;
+		osc {
+			u-boot,dm-spl;
+		};
+	};
+};
+
+&clks {
+	u-boot,dm-pre-reloc;
+};

Best regards,

Quoted 8 lines
Quoted 8 lines

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang
Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de

author reviewer
#48 lore raw

PATCH 13/41 clk: imx: import clk heplers

In reply to Peng Fan

Import some clk helpers from Linux Kernel for i.MX8MM usage

---
 drivers/clk/imx/clk.h | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)
drivers/clk/imx/clk.h +81 -0
index 864a215a22..aa6e81ff13 100644
@@ -42,6 +42,23 @@ static inline struct clk *imx_clk_gate2(const char *name, const char *parent,
 			shift, 0x3, 0);
 }
 
+static inline struct clk *imx_clk_gate4(const char *name, const char *parent,
+		void __iomem *reg, u8 shift)
+{
+	return clk_register_gate2(NULL, name, parent,
+			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
+			reg, shift, 0x3, 0);
+}
+
+static inline struct clk *imx_clk_gate4_flags(const char *name,
+		const char *parent, void __iomem *reg, u8 shift,
+		unsigned long flags)
+{
+	return clk_register_gate2(NULL, name, parent,
+			flags | CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
+			reg, shift, 0x3, 0);
+}
+
 static inline struct clk *imx_clk_fixed_factor(const char *name,
 		const char *parent, unsigned int mult, unsigned int div)
 {
@@ -56,6 +73,14 @@ static inline struct clk *imx_clk_divider(const char *name, const char *parent,
 			reg, shift, width, 0);
 }
 
+static inline struct clk *imx_clk_divider2(const char *name, const char *parent,
+		void __iomem *reg, u8 shift, u8 width)
+{
+	return clk_register_divider(NULL, name, parent,
+			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
+			reg, shift, width, 0);
+}
+
 struct clk *imx_clk_pfd(const char *name, const char *parent_name,
 			void __iomem *reg, u8 idx);
 
@@ -63,6 +88,16 @@ struct clk *imx_clk_fixup_mux(const char *name, void __iomem *reg,
 			      u8 shift, u8 width, const char * const *parents,
 			      int num_parents, void (*fixup)(u32 *val));
 
+static inline struct clk *imx_clk_mux_flags(const char *name,
+			void __iomem *reg, u8 shift, u8 width,
+			const char * const *parents, int num_parents,
+			unsigned long flags)
+{
+	return clk_register_mux(NULL, name, parents, num_parents,
+				flags | CLK_SET_RATE_NO_REPARENT, reg, shift,
+				width, 0);
+}
+
 static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg,
 			u8 shift, u8 width, const char * const *parents,
 			int num_parents)
@@ -72,4 +107,50 @@ static inline struct clk *imx_clk_mux(const char *name, void __iomem *reg,
 			width, 0);
 }
 
+static inline struct clk *imx_clk_mux2(const char *name, void __iomem *reg,
+			u8 shift, u8 width, const char * const *parents,
+			int num_parents)
+{
+	return clk_register_mux(NULL, name, parents, num_parents,
+			CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE,
+			reg, shift, width, 0);
+}
+
+static inline struct clk *imx_clk_gate(const char *name, const char *parent,
+		void __iomem *reg, u8 shift)
+{
+	return clk_register_gate(NULL, name, parent, CLK_SET_RATE_PARENT, reg,
+			shift, 0, NULL);
+}
+
+static inline struct clk *imx_clk_gate_flags(const char *name, const char *parent,
+		void __iomem *reg, u8 shift, unsigned long flags)
+{
+	return clk_register_gate(NULL, name, parent, flags | CLK_SET_RATE_PARENT, reg,
+			shift, 0, NULL);
+}
+
+static inline struct clk *imx_clk_gate3(const char *name, const char *parent,
+		void __iomem *reg, u8 shift)
+{
+	return clk_register_gate(NULL, name, parent,
+			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
+			reg, shift, 0, NULL);
+}
+
+struct clk *imx8m_clk_composite_flags(const char *name,
+		const char * const *parent_names,
+		int num_parents, void __iomem *reg, unsigned long flags);
+
+#define __imx8m_clk_composite(name, parent_names, reg, flags) \
+	imx8m_clk_composite_flags(name, parent_names, \
+		ARRAY_SIZE(parent_names), reg, \
+		flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)
+
+#define imx8m_clk_composite(name, parent_names, reg) \
+	__imx8m_clk_composite(name, parent_names, reg, 0)
+
+#define imx8m_clk_composite_critical(name, parent_names, reg) \
+	__imx8m_clk_composite(name, parent_names, reg, CLK_IS_CRITICAL)
+
 #endif /* __MACH_IMX_CLK_H */
Signature · 1 line
2.16.4
#49 lore raw

PATCH 13/41 clk: imx: import clk heplers

Quoted 2 lines · On Tue, 30 Apr 2019 10:18:15 +0000 Peng Fan <[email protected]> wrote:

Import some clk helpers from Linux Kernel for i.MX8MM usage

Please globally provide SHA1 and tag of ported code from Linux kernel.

Quoted 127 lines
---
 drivers/clk/imx/clk.h | 81

+++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+)

drivers/clk/imx/clk.h +17 -0
index 864a215a22..aa6e81ff13 100644
@@ -42,6 +42,23 @@ static inline struct clk *imx_clk_gate2(const char
 *name, const char *parent, shift, 0x3, 0);
 }
 
+static inline struct clk *imx_clk_gate4(const char *name, const char
 *parent,
+		void __iomem *reg, u8 shift)
+{
+	return clk_register_gate2(NULL, name, parent,
+			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
+			reg, shift, 0x3, 0);
+}
+
+static inline struct clk *imx_clk_gate4_flags(const char *name,
+		const char *parent, void __iomem *reg, u8 shift,
+		unsigned long flags)
+{
+	return clk_register_gate2(NULL, name, parent,
+			flags | CLK_SET_RATE_PARENT |
 CLK_OPS_PARENT_ENABLE,
+			reg, shift, 0x3, 0);
+}
+
 static inline struct clk *imx_clk_fixed_factor(const char *name,

const char *parent, unsigned int mult, unsigned int
div) {

drivers/clk/imx/clk.h +18 -0
@@ -56,6 +73,14 @@ static inline struct clk *imx_clk_divider(const
 char *name, const char *parent, reg, shift, width, 0);
 }
 
+static inline struct clk *imx_clk_divider2(const char *name, const
 char *parent,
+		void __iomem *reg, u8 shift, u8 width)
+{
+	return clk_register_divider(NULL, name, parent,
+			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
+			reg, shift, width, 0);
+}
+
 struct clk *imx_clk_pfd(const char *name, const char *parent_name,
 			void __iomem *reg, u8 idx);
@@ -63,6 +88,16 @@ struct clk *imx_clk_fixup_mux(const char *name,
 void __iomem *reg, u8 shift, u8 width, const char * const *parents,
 			      int num_parents, void (*fixup)(u32
 *val)); 
+static inline struct clk *imx_clk_mux_flags(const char *name,
+			void __iomem *reg, u8 shift, u8 width,
+			const char * const *parents, int num_parents,
+			unsigned long flags)
+{
+	return clk_register_mux(NULL, name, parents, num_parents,
+				flags | CLK_SET_RATE_NO_REPARENT,
 reg, shift,
+				width, 0);
+}
+
 static inline struct clk *imx_clk_mux(const char *name, void __iomem
 *reg, u8 shift, u8 width, const char * const *parents,
drivers/clk/imx/clk.h +2 -0
 			int num_parents)
@@ -72,4 +107,50 @@ static inline struct clk *imx_clk_mux(const char
 *name, void __iomem *reg, width, 0);
 }
 
+static inline struct clk *imx_clk_mux2(const char *name, void
 __iomem *reg,
+			u8 shift, u8 width, const char * const

*parents,

drivers/clk/imx/clk.h +4 -0
+			int num_parents)
+{
+	return clk_register_mux(NULL, name, parents, num_parents,
+			CLK_SET_RATE_NO_REPARENT |

CLK_OPS_PARENT_ENABLE,

drivers/clk/imx/clk.h +4 -0
+			reg, shift, width, 0);
+}
+
+static inline struct clk *imx_clk_gate(const char *name, const char

*parent,

drivers/clk/imx/clk.h +3 -0
+		void __iomem *reg, u8 shift)
+{
+	return clk_register_gate(NULL, name, parent,

CLK_SET_RATE_PARENT, reg,

drivers/clk/imx/clk.h +4 -0
+			shift, 0, NULL);
+}
+
+static inline struct clk *imx_clk_gate_flags(const char *name, const

char *parent,

drivers/clk/imx/clk.h +3 -0
+		void __iomem *reg, u8 shift, unsigned long flags)
+{
+	return clk_register_gate(NULL, name, parent, flags |

CLK_SET_RATE_PARENT, reg,

drivers/clk/imx/clk.h +4 -0
+			shift, 0, NULL);
+}
+
+static inline struct clk *imx_clk_gate3(const char *name, const char

*parent,

drivers/clk/imx/clk.h +10 -0
+		void __iomem *reg, u8 shift)
+{
+	return clk_register_gate(NULL, name, parent,
+			CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE,
+			reg, shift, 0, NULL);
+}
+
+struct clk *imx8m_clk_composite_flags(const char *name,
+		const char * const *parent_names,
+		int num_parents, void __iomem *reg, unsigned long

flags); +

drivers/clk/imx/clk.h +4 -0
+#define __imx8m_clk_composite(name, parent_names, reg, flags) \
+	imx8m_clk_composite_flags(name, parent_names, \
+		ARRAY_SIZE(parent_names), reg, \
+		flags | CLK_SET_RATE_NO_REPARENT |

CLK_OPS_PARENT_ENABLE) +

drivers/clk/imx/clk.h +5 -0
+#define imx8m_clk_composite(name, parent_names, reg) \
+	__imx8m_clk_composite(name, parent_names, reg, 0)
+
+#define imx8m_clk_composite_critical(name, parent_names, reg) \
+	__imx8m_clk_composite(name, parent_names, reg,
Quoted 2 lines

CLK_IS_CRITICAL) +
#endif /* __MACH_IMX_CLK_H */

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 484 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190507/2c9f98c7/attachment.sig>

author reviewer
#50 lore raw

PATCH 14/41 clk: imx: gate2 add set rate

In reply to Peng Fan

Add set rate for imx clk-gate2

---
 drivers/clk/imx/clk-gate2.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/clk/imx/clk-gate2.c +11 -0
index 83589b9206..75b6b85e07 100644
@@ -62,7 +62,18 @@ static int clk_gate2_disable(struct clk *clk)
 	return 0;
 }
 
+static ulong clk_gate2_set_rate(struct clk *clk, ulong rate)
+{
+	struct clk *parent = clk_get_parent(clk);
+
+	if (parent)
+		return clk_set_rate(parent, rate);
+
+	return -ENODEV;
+}
+
 static const struct clk_ops clk_gate2_ops = {
+	.set_rate = clk_gate2_set_rate,
 	.enable = clk_gate2_enable,
 	.disable = clk_gate2_disable,
 	.get_rate = clk_generic_get_rate,
Signature · 1 line
2.16.4
author reviewer
#51 lore raw

PATCH 15/41 linux: compat: guard PAGE_SIZE

In reply to Peng Fan

Some archs defined PAGE_SIZE, such as ARMv8, to avoid build warning, guard PAGE_SIZE.

---
 include/linux/compat.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/compat.h +2 -0
index d0f51baab4..c1f8bdf8f2 100644
@@ -123,7 +123,9 @@ static inline void kmem_cache_destroy(struct kmem_cache *cachep)
 
 #define KERNEL_VERSION(a,b,c)	(((a) << 16) + ((b) << 8) + (c))
 
+#ifndef PAGE_SIZE
 #define PAGE_SIZE	4096
+#endif
 
 /* drivers/char/random.c */
 #define get_random_bytes(...)
Signature · 1 line
2.16.4
author reviewer
#52 lore raw

PATCH 16/41 drivers: core: use strcmp when find device by name

In reply to Peng Fan

if (!strncmp(dev->name, name, strlen(name))) might find out the wrong device, it might find out dram_pll_ref_sel, when name is dram_pll. So use strcmp to avoid such issue.

---
 drivers/core/uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/core/uclass.c +1 -1
index fc3157de39..e2f35393a9 100644
@@ -260,7 +260,7 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
 		return ret;
 
 	uclass_foreach_dev(dev, uc) {
-		if (!strncmp(dev->name, name, strlen(name))) {
+		if (!strcmp(dev->name, name)) {
 			*devp = dev;
 			return 0;
 		}
Signature · 1 line
2.16.4
author reviewer
#53 lore raw

PATCH 17/41 ddr: imx8m: fix ddr firmware location when enable SPL OF

In reply to Peng Fan

With SPL_OF_SPERATE, the device tree will be padded to end of the u-boot-spl-nodtb.bin, however we also put the ddr firmware file to this location, so need to adapt the code with SPL OF and align to 16bytes to ease copy firmware.

---
 drivers/ddr/imx/imx8m/helper.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/ddr/imx/imx8m/helper.c +11 -1
index 61cd4f6db1..1bf580d306 100644
@@ -31,7 +31,17 @@ void ddr_load_train_firmware(enum fw_type type)
 	unsigned long pr_to32, pr_from32;
 	unsigned long fw_offset = type ? IMEM_2D_OFFSET : 0;
 	unsigned long imem_start = (unsigned long)&_end + fw_offset;
-	unsigned long dmem_start = imem_start + IMEM_LEN;
+	unsigned long dmem_start;
+
+#ifdef CONFIG_SPL_OF_CONTROL
+	if (gd->fdt_blob && !fdt_check_header(gd->fdt_blob)) {
+		imem_start = roundup((unsigned long)&_end +
+				     fdt_totalsize(gd->fdt_blob), 16) +
+			fw_offset;
+	}
+#endif
+
+	dmem_start = imem_start + IMEM_LEN;
 
 	pr_from32 = imem_start;
 	pr_to32 = DDR_TRAIN_CODE_BASE_ADDR + 4 * IMEM_OFFSET_ADDR;
Signature · 1 line
2.16.4
author reviewer
#54 lore raw

PATCH 18/41 imx: add IMX8MQ kconfig entry

In reply to Peng Fan

Add IMX8MQ kconfig entry, preparing support IMX8MM

---
 arch/arm/mach-imx/imx8m/Kconfig | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-imx/imx8m/Kconfig +5 -1
index 317dee9bc1..9c487870a6 100644
@@ -4,6 +4,10 @@ config IMX8M
 	bool
 	select ROM_UNIFIED_SECTIONS
 
+config IMX8MQ
+	bool
+	select IMX8M
+
 config SYS_SOC
 	default "imx8m"
 
@@ -13,7 +17,7 @@ choice
 
 config TARGET_IMX8MQ_EVK
 	bool "imx8mq_evk"
-	select IMX8M
+	select IMX8MQ
 	select IMX8M_LPDDR4
 
 endchoice
Signature · 1 line
2.16.4
author reviewer
#55 lore raw

PATCH 19/41 imx: add IMX8MM kconfig entry

In reply to Peng Fan

Add IMX8MM kconfig entry

---
 arch/arm/mach-imx/imx8m/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mach-imx/imx8m/Kconfig +4 -0
index 9c487870a6..35c978e863 100644
@@ -8,6 +8,10 @@ config IMX8MQ
 	bool
 	select IMX8M
 
+config IMX8MM
+	bool
+	select IMX8M
+
 config SYS_SOC
 	default "imx8m"
 
Signature · 1 line
2.16.4
author reviewer
#56 lore raw

PATCH 20/41 imx: imx8mm: add clock bindings header

In reply to Peng Fan

Add i.MX8MM clock binding header for i.MX8MM

---
 include/dt-bindings/clock/imx8mm-clock.h | 244 +++++++++++++++++++++++++++++++
 1 file changed, 244 insertions(+)
 create mode 100644 include/dt-bindings/clock/imx8mm-clock.h
include/dt-bindings/clock/imx8mm-clock.h new file +244 -0
new file mode 100644
index 0000000000..1b4353e7b4
@@ -0,0 +1,244 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright 2017-2018 NXP
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_IMX8MM_H
+#define __DT_BINDINGS_CLOCK_IMX8MM_H
+
+#define IMX8MM_CLK_DUMMY			0
+#define IMX8MM_CLK_32K				1
+#define IMX8MM_CLK_24M				2
+#define IMX8MM_OSC_HDMI_CLK			3
+#define IMX8MM_CLK_EXT1				4
+#define IMX8MM_CLK_EXT2				5
+#define IMX8MM_CLK_EXT3				6
+#define IMX8MM_CLK_EXT4				7
+#define IMX8MM_AUDIO_PLL1_REF_SEL		8
+#define IMX8MM_AUDIO_PLL2_REF_SEL		9
+#define IMX8MM_VIDEO_PLL1_REF_SEL		10
+#define IMX8MM_DRAM_PLL_REF_SEL			11
+#define IMX8MM_GPU_PLL_REF_SEL			12
+#define IMX8MM_VPU_PLL_REF_SEL			13
+#define IMX8MM_ARM_PLL_REF_SEL			14
+#define IMX8MM_SYS_PLL1_REF_SEL			15
+#define IMX8MM_SYS_PLL2_REF_SEL			16
+#define IMX8MM_SYS_PLL3_REF_SEL			17
+#define IMX8MM_AUDIO_PLL1			18
+#define IMX8MM_AUDIO_PLL2			19
+#define IMX8MM_VIDEO_PLL1			20
+#define IMX8MM_DRAM_PLL				21
+#define IMX8MM_GPU_PLL				22
+#define IMX8MM_VPU_PLL				23
+#define IMX8MM_ARM_PLL				24
+#define IMX8MM_SYS_PLL1				25
+#define IMX8MM_SYS_PLL2				26
+#define IMX8MM_SYS_PLL3				27
+#define IMX8MM_AUDIO_PLL1_BYPASS		28
+#define IMX8MM_AUDIO_PLL2_BYPASS		29
+#define IMX8MM_VIDEO_PLL1_BYPASS		30
+#define IMX8MM_DRAM_PLL_BYPASS			31
+#define IMX8MM_GPU_PLL_BYPASS			32
+#define IMX8MM_VPU_PLL_BYPASS			33
+#define IMX8MM_ARM_PLL_BYPASS			34
+#define IMX8MM_SYS_PLL1_BYPASS			35
+#define IMX8MM_SYS_PLL2_BYPASS			36
+#define IMX8MM_SYS_PLL3_BYPASS			37
+#define IMX8MM_AUDIO_PLL1_OUT			38
+#define IMX8MM_AUDIO_PLL2_OUT			39
+#define IMX8MM_VIDEO_PLL1_OUT			40
+#define IMX8MM_DRAM_PLL_OUT			41
+#define IMX8MM_GPU_PLL_OUT			42
+#define IMX8MM_VPU_PLL_OUT			43
+#define IMX8MM_ARM_PLL_OUT			44
+#define IMX8MM_SYS_PLL1_OUT			45
+#define IMX8MM_SYS_PLL2_OUT			46
+#define IMX8MM_SYS_PLL3_OUT			47
+#define IMX8MM_SYS_PLL1_40M			48
+#define IMX8MM_SYS_PLL1_80M			49
+#define IMX8MM_SYS_PLL1_100M			50
+#define IMX8MM_SYS_PLL1_133M			51
+#define IMX8MM_SYS_PLL1_160M			52
+#define IMX8MM_SYS_PLL1_200M			53
+#define IMX8MM_SYS_PLL1_266M			54
+#define IMX8MM_SYS_PLL1_400M			55
+#define IMX8MM_SYS_PLL1_800M			56
+#define IMX8MM_SYS_PLL2_50M			57
+#define IMX8MM_SYS_PLL2_100M			58
+#define IMX8MM_SYS_PLL2_125M			59
+#define IMX8MM_SYS_PLL2_166M			60
+#define IMX8MM_SYS_PLL2_200M			61
+#define IMX8MM_SYS_PLL2_250M			62
+#define IMX8MM_SYS_PLL2_333M			63
+#define IMX8MM_SYS_PLL2_500M			64
+#define IMX8MM_SYS_PLL2_1000M			65
+
+/* core */
+#define IMX8MM_CLK_A53_SRC			66
+#define IMX8MM_CLK_M4_SRC			67
+#define IMX8MM_CLK_VPU_SRC			68
+#define IMX8MM_CLK_GPU3D_SRC			69
+#define IMX8MM_CLK_GPU2D_SRC			70
+#define IMX8MM_CLK_A53_CG			71
+#define IMX8MM_CLK_M4_CG			72
+#define IMX8MM_CLK_VPU_CG			73
+#define IMX8MM_CLK_GPU3D_CG			74
+#define IMX8MM_CLK_GPU2D_CG			75
+#define IMX8MM_CLK_A53_DIV			76
+#define IMX8MM_CLK_M4_DIV			77
+#define IMX8MM_CLK_VPU_DIV			78
+#define IMX8MM_CLK_GPU3D_DIV			79
+#define IMX8MM_CLK_GPU2D_DIV			80
+
+/* bus */
+#define IMX8MM_CLK_MAIN_AXI			81
+#define IMX8MM_CLK_ENET_AXI			82
+#define IMX8MM_CLK_NAND_USDHC_BUS		83
+#define IMX8MM_CLK_VPU_BUS			84
+#define IMX8MM_CLK_DISP_AXI			85
+#define IMX8MM_CLK_DISP_APB			86
+#define IMX8MM_CLK_DISP_RTRM			87
+#define IMX8MM_CLK_USB_BUS			88
+#define IMX8MM_CLK_GPU_AXI			89
+#define IMX8MM_CLK_GPU_AHB			90
+#define IMX8MM_CLK_NOC				91
+#define IMX8MM_CLK_NOC_APB			92
+
+#define IMX8MM_CLK_AHB				93
+#define IMX8MM_CLK_AUDIO_AHB			94
+#define IMX8MM_CLK_IPG_ROOT			95
+#define IMX8MM_CLK_IPG_AUDIO_ROOT		96
+
+#define IMX8MM_CLK_DRAM_ALT			97
+#define IMX8MM_CLK_DRAM_APB			98
+#define IMX8MM_CLK_VPU_G1			99
+#define IMX8MM_CLK_VPU_G2			100
+#define IMX8MM_CLK_DISP_DTRC			101
+#define IMX8MM_CLK_DISP_DC8000			102
+#define IMX8MM_CLK_PCIE1_CTRL			103
+#define IMX8MM_CLK_PCIE1_PHY			104
+#define IMX8MM_CLK_PCIE1_AUX			105
+#define IMX8MM_CLK_DC_PIXEL			106
+#define IMX8MM_CLK_LCDIF_PIXEL			107
+#define IMX8MM_CLK_SAI1				108
+#define IMX8MM_CLK_SAI2				109
+#define IMX8MM_CLK_SAI3				110
+#define IMX8MM_CLK_SAI4				111
+#define IMX8MM_CLK_SAI5				112
+#define IMX8MM_CLK_SAI6				113
+#define IMX8MM_CLK_SPDIF1			114
+#define IMX8MM_CLK_SPDIF2			115
+#define IMX8MM_CLK_ENET_REF			116
+#define IMX8MM_CLK_ENET_TIMER			117
+#define IMX8MM_CLK_ENET_PHY_REF			118
+#define IMX8MM_CLK_NAND				119
+#define IMX8MM_CLK_QSPI				120
+#define IMX8MM_CLK_USDHC1			121
+#define IMX8MM_CLK_USDHC2			122
+#define IMX8MM_CLK_I2C1				123
+#define IMX8MM_CLK_I2C2				124
+#define IMX8MM_CLK_I2C3				125
+#define IMX8MM_CLK_I2C4				126
+#define IMX8MM_CLK_UART1			127
+#define IMX8MM_CLK_UART2			128
+#define IMX8MM_CLK_UART3			129
+#define IMX8MM_CLK_UART4			130
+#define IMX8MM_CLK_USB_CORE_REF			131
+#define IMX8MM_CLK_USB_PHY_REF			132
+#define IMX8MM_CLK_ECSPI1			133
+#define IMX8MM_CLK_ECSPI2			134
+#define IMX8MM_CLK_PWM1				135
+#define IMX8MM_CLK_PWM2				136
+#define IMX8MM_CLK_PWM3				137
+#define IMX8MM_CLK_PWM4				138
+#define IMX8MM_CLK_GPT1				139
+#define IMX8MM_CLK_WDOG				140
+#define IMX8MM_CLK_WRCLK			141
+#define IMX8MM_CLK_DSI_CORE			142
+#define IMX8MM_CLK_DSI_PHY_REF			143
+#define IMX8MM_CLK_DSI_DBI			144
+#define IMX8MM_CLK_USDHC3			145
+#define IMX8MM_CLK_CSI1_CORE			146
+#define IMX8MM_CLK_CSI1_PHY_REF			147
+#define IMX8MM_CLK_CSI1_ESC			148
+#define IMX8MM_CLK_CSI2_CORE			149
+#define IMX8MM_CLK_CSI2_PHY_REF			150
+#define IMX8MM_CLK_CSI2_ESC			151
+#define IMX8MM_CLK_PCIE2_CTRL			152
+#define IMX8MM_CLK_PCIE2_PHY			153
+#define IMX8MM_CLK_PCIE2_AUX			154
+#define IMX8MM_CLK_ECSPI3			155
+#define IMX8MM_CLK_PDM				156
+#define IMX8MM_CLK_VPU_H1			157
+#define IMX8MM_CLK_CLKO1			158
+
+#define IMX8MM_CLK_ECSPI1_ROOT			159
+#define IMX8MM_CLK_ECSPI2_ROOT			160
+#define IMX8MM_CLK_ECSPI3_ROOT			161
+#define IMX8MM_CLK_ENET1_ROOT			162
+#define IMX8MM_CLK_GPT1_ROOT			163
+#define IMX8MM_CLK_I2C1_ROOT			164
+#define IMX8MM_CLK_I2C2_ROOT			165
+#define IMX8MM_CLK_I2C3_ROOT			166
+#define IMX8MM_CLK_I2C4_ROOT			167
+#define IMX8MM_CLK_OCOTP_ROOT			168
+#define IMX8MM_CLK_PCIE1_ROOT			169
+#define IMX8MM_CLK_PWM1_ROOT			170
+#define IMX8MM_CLK_PWM2_ROOT			171
+#define IMX8MM_CLK_PWM3_ROOT			172
+#define IMX8MM_CLK_PWM4_ROOT			173
+#define IMX8MM_CLK_QSPI_ROOT			174
+#define IMX8MM_CLK_NAND_ROOT			175
+#define IMX8MM_CLK_SAI1_ROOT			176
+#define IMX8MM_CLK_SAI1_IPG			177
+#define IMX8MM_CLK_SAI2_ROOT			178
+#define IMX8MM_CLK_SAI2_IPG			179
+#define IMX8MM_CLK_SAI3_ROOT			180
+#define IMX8MM_CLK_SAI3_IPG			181
+#define IMX8MM_CLK_SAI4_ROOT			182
+#define IMX8MM_CLK_SAI4_IPG			183
+#define IMX8MM_CLK_SAI5_ROOT			184
+#define IMX8MM_CLK_SAI5_IPG			185
+#define IMX8MM_CLK_SAI6_ROOT			186
+#define IMX8MM_CLK_SAI6_IPG			187
+#define IMX8MM_CLK_UART1_ROOT			188
+#define IMX8MM_CLK_UART2_ROOT			189
+#define IMX8MM_CLK_UART3_ROOT			190
+#define IMX8MM_CLK_UART4_ROOT			191
+#define IMX8MM_CLK_USB1_CTRL_ROOT		192
+#define IMX8MM_CLK_GPU3D_ROOT			193
+#define IMX8MM_CLK_USDHC1_ROOT			194
+#define IMX8MM_CLK_USDHC2_ROOT			195
+#define IMX8MM_CLK_WDOG1_ROOT			196
+#define IMX8MM_CLK_WDOG2_ROOT			197
+#define IMX8MM_CLK_WDOG3_ROOT			198
+#define IMX8MM_CLK_VPU_G1_ROOT			199
+#define IMX8MM_CLK_GPU_BUS_ROOT			200
+#define IMX8MM_CLK_VPU_H1_ROOT			201
+#define IMX8MM_CLK_VPU_G2_ROOT			202
+#define IMX8MM_CLK_PDM_ROOT			203
+#define IMX8MM_CLK_DISP_ROOT			204
+#define IMX8MM_CLK_DISP_AXI_ROOT		205
+#define IMX8MM_CLK_DISP_APB_ROOT		206
+#define IMX8MM_CLK_DISP_RTRM_ROOT		207
+#define IMX8MM_CLK_USDHC3_ROOT			208
+#define IMX8MM_CLK_TMU_ROOT			209
+#define IMX8MM_CLK_VPU_DEC_ROOT			210
+#define IMX8MM_CLK_SDMA1_ROOT			211
+#define IMX8MM_CLK_SDMA2_ROOT			212
+#define IMX8MM_CLK_SDMA3_ROOT			213
+#define IMX8MM_CLK_GPT_3M			214
+#define IMX8MM_CLK_ARM				215
+#define IMX8MM_CLK_PDM_IPG			216
+#define IMX8MM_CLK_GPU2D_ROOT			217
+#define IMX8MM_CLK_MU_ROOT			218
+#define IMX8MM_CLK_CSI1_ROOT			219
+
+#define IMX8MM_CLK_DRAM_CORE			220
+#define IMX8MM_CLK_DRAM_ALT_ROOT		221
+
+#define IMX8MM_CLK_NAND_USDHC_BUS_RAWNAND_CLK	222
+
+#define IMX8MM_CLK_END				223
+
+#endif
Signature · 1 line
2.16.4
author reviewer
#57 lore raw

PATCH 21/41 imx: add i.MX8MM cpu type

In reply to Peng Fan

Add i.MX8MM cpu type and related helper functions

---
 arch/arm/include/asm/arch-imx/cpu.h       |  6 ++++++
 arch/arm/include/asm/mach-imx/sys_proto.h |  8 ++++++++
 arch/arm/mach-imx/cpu.c                   | 12 ++++++++++++
 3 files changed, 26 insertions(+)
arch/arm/include/asm/arch-imx/cpu.h +6 -0
index 667badbc06..fab530e324 100644
@@ -25,6 +25,12 @@
 #define MXC_CPU_MX7S		0x71 /* dummy ID */
 #define MXC_CPU_MX7D		0x72
 #define MXC_CPU_IMX8MQ		0x82
+#define MXC_CPU_IMX8MM		0x85 /* dummy ID */
+#define MXC_CPU_IMX8MML		0x86 /* dummy ID */
+#define MXC_CPU_IMX8MMD		0x87 /* dummy ID */
+#define MXC_CPU_IMX8MMDL	0x88 /* dummy ID */
+#define MXC_CPU_IMX8MMS		0x89 /* dummy ID */
+#define MXC_CPU_IMX8MMSL	0x8a /* dummy ID */
 #define MXC_CPU_IMX8QXP_A0	0x90 /* dummy ID */
 #define MXC_CPU_IMX8QXP		0x92 /* dummy ID */
 #define MXC_CPU_MX7ULP		0xE1 /* Temporally hard code */
arch/arm/include/asm/mach-imx/sys_proto.h +8 -0
index d0f866b630..88927aeb6b 100644
@@ -43,6 +43,14 @@
 #define is_mx7ulp() (is_cpu_type(MXC_CPU_MX7ULP))
 
 #define is_imx8mq() (is_cpu_type(MXC_CPU_IMX8MQ))
+#define is_imx8mm() (is_cpu_type(MXC_CPU_IMX8MM) || is_cpu_type(MXC_CPU_IMX8MML) ||\
+	is_cpu_type(MXC_CPU_IMX8MMD) || is_cpu_type(MXC_CPU_IMX8MMDL) || \
+	is_cpu_type(MXC_CPU_IMX8MMS) || is_cpu_type(MXC_CPU_IMX8MMSL))
+#define is_imx8mml() (is_cpu_type(MXC_CPU_IMX8MML))
+#define is_imx8mmd() (is_cpu_type(MXC_CPU_IMX8MMD))
+#define is_imx8mmdl() (is_cpu_type(MXC_CPU_IMX8MMDL))
+#define is_imx8mms() (is_cpu_type(MXC_CPU_IMX8MMS))
+#define is_imx8mmsl() (is_cpu_type(MXC_CPU_IMX8MMSL))
 #define is_imx8qxp() (is_cpu_type(MXC_CPU_IMX8QXP))
 
 #ifdef CONFIG_MX6
arch/arm/mach-imx/cpu.c +12 -0
index 6b83f92662..14370929de 100644
@@ -145,6 +145,18 @@ unsigned imx_ddr_size(void)
 const char *get_imx_type(u32 imxtype)
 {
 	switch (imxtype) {
+	case MXC_CPU_IMX8MM:
+		return "8MMQ";	/* Quad-core version of the imx8mm */
+	case MXC_CPU_IMX8MML:
+		return "8MMQL";	/* Quad-core Lite version of the imx8mm */
+	case MXC_CPU_IMX8MMD:
+		return "8MMD";	/* Dual-core version of the imx8mm */
+	case MXC_CPU_IMX8MMDL:
+		return "8MMDL";	/* Dual-core Lite version of the imx8mm */
+	case MXC_CPU_IMX8MMS:
+		return "8MMS";	/* Single-core version of the imx8mm */
+	case MXC_CPU_IMX8MMSL:
+		return "8MMSL";	/* Single-core Lite version of the imx8mm */
 	case MXC_CPU_IMX8MQ:
 		return "8MQ";	/* Quad-core version of the imx8m */
 	case MXC_CPU_MX7S:
Signature · 1 line
2.16.4
author reviewer
#58 lore raw

PATCH 22/41 imx: spl: add spl_board_boot_device for i.MX8MM

In reply to Peng Fan

Differnet board has different controller used, it is hard to use one layout for them all.

---
 arch/arm/mach-imx/spl.c | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/mach-imx/spl.c +8 -0
index 9f1e0f6a72..a6d7b69ad8 100644
@@ -18,6 +18,11 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+__weak int spl_board_boot_device(enum boot_device boot_dev_spl)
+{
+	return 0;
+}
+
 #if defined(CONFIG_MX6)
 /* determine boot device from SRC_SBMR1 (BOOT_CFG[4:1]) or SRC_GPR9 register */
 u32 spl_boot_device(void)
@@ -125,6 +130,9 @@ u32 spl_boot_device(void)
 
 	enum boot_device boot_device_spl = get_boot_device();
 
+	if (IS_ENABLED(CONFIG_IMX8MM))
+		return spl_board_boot_device(boot_device_spl);
+
 	switch (boot_device_spl) {
 #if defined(CONFIG_MX7)
 	case SD1_BOOT:
Signature · 1 line
2.16.4
author reviewer
#59 lore raw

PATCH 23/41 imx8m: update imx-regs for i.MX8MM

In reply to Peng Fan

i.MX8MM has similar architecture with i.MX8MQ, but it has totally different PLL design and some register layout change.

Note: Some registers in this file are not updated because not used now.

---
 arch/arm/include/asm/arch-imx8m/imx-regs.h | 75 ++++++++++++++++++++++++++++--
 1 file changed, 71 insertions(+), 4 deletions(-)
arch/arm/include/asm/arch-imx8m/imx-regs.h +71 -4
index 3facd5450c..44b2f728ee 100644
@@ -8,8 +8,8 @@
 
 #include <asm/mach-imx/regs-lcdif.h>
 
-#define ROM_VERSION_A0		0x800
-#define ROM_VERSION_B0		0x83C
+#define ROM_VERSION_A0		IS_ENABLED(CONFIG_IMX8MQ) ? 0x800 : 0x800
+#define ROM_VERSION_B0		IS_ENABLED(CONFIG_IMX8MQ) ? 0x83C : 0x800
 
 #define M4_BOOTROM_BASE_ADDR	0x007E0000
 
@@ -91,7 +91,11 @@
 #define SEMAPHOR_HS_BASE_ADDR	0x30AC0000
 #define USDHC1_BASE_ADDR	0x30B40000
 #define USDHC2_BASE_ADDR	0x30B50000
+#ifdef CONFIG_IMX8MM
+#define USDHC3_BASE_ADDR	0x30B60000
+#else
 #define MIPI_CS2_BASE_ADDR	0x30B60000
+#endif
 #define MIPI_CSI_PHY2_BASE_ADDR	0x30B70000
 #define CSI2_BASE_ADDR		0x30B80000
 #define QSPI0_BASE_ADDR		0x30BB0000
@@ -118,7 +122,8 @@
 #define USB1_PHY_BASE_ADDR	0x381F0000
 #define USB2_PHY_BASE_ADDR	0x382F0000
 
-#define MXS_LCDIF_BASE		LCDIF_BASE_ADDR
+#define MXS_LCDIF_BASE		is_enable(CONFIG_IMX8MQ) ? \
+					0x30320000 : 0x32e00000
 
 #define SRC_IPS_BASE_ADDR	0x30390000
 #define SRC_DDRC_RCR_ADDR	0x30391000
@@ -147,6 +152,9 @@
 #define SRC_DDR1_RCR_CORE_RESET_N_MASK	BIT(1)
 #define SRC_DDR1_RCR_PRESET_N_MASK	BIT(0)
 
+#define IOMUXC_GPR_GPR1_GPR_ENET1_TX_CLK_SEL_MASK 0x2000u
+#define IOMUXC_GPR_GPR1_GPR_ENET1_TX_CLK_SEL_SHIFT 13
+
 struct iomuxc_gpr_base_regs {
 	u32 gpr[47];
 };
@@ -203,6 +211,7 @@ struct fuse_bank1_regs {
 	u32 rsvd3[3];
 };
 
+#ifdef CONFIG_IMX8MQ
 struct anamix_pll {
 	u32 audio_pll1_cfg0;
 	u32 audio_pll1_cfg1;
@@ -237,6 +246,60 @@ struct anamix_pll {
 	u32 frac_pllout_div_cfg;
 	u32 sscg_pllout_div_cfg;
 };
+#else
+struct anamix_pll {
+	u32 audio_pll1_gnrl_ctl;
+	u32 audio_pll1_fdiv_ctl0;
+	u32 audio_pll1_fdiv_ctl1;
+	u32 audio_pll1_sscg_ctl;
+	u32 audio_pll1_mnit_ctl;
+	u32 audio_pll2_gnrl_ctl;
+	u32 audio_pll2_fdiv_ctl0;
+	u32 audio_pll2_fdiv_ctl1;
+	u32 audio_pll2_sscg_ctl;
+	u32 audio_pll2_mnit_ctl;
+	u32 video_pll1_gnrl_ctl;
+	u32 video_pll1_fdiv_ctl0;
+	u32 video_pll1_fdiv_ctl1;
+	u32 video_pll1_sscg_ctl;
+	u32 video_pll1_mnit_ctl;
+	u32 reserved[5];
+	u32 dram_pll_gnrl_ctl;
+	u32 dram_pll_fdiv_ctl0;
+	u32 dram_pll_fdiv_ctl1;
+	u32 dram_pll_sscg_ctl;
+	u32 dram_pll_mnit_ctl;
+	u32 gpu_pll_gnrl_ctl;
+	u32 gpu_pll_div_ctl;
+	u32 gpu_pll_locked_ctl1;
+	u32 gpu_pll_mnit_ctl;
+	u32 vpu_pll_gnrl_ctl;
+	u32 vpu_pll_div_ctl;
+	u32 vpu_pll_locked_ctl1;
+	u32 vpu_pll_mnit_ctl;
+	u32 arm_pll_gnrl_ctl;
+	u32 arm_pll_div_ctl;
+	u32 arm_pll_locked_ctl1;
+	u32 arm_pll_mnit_ctl;
+	u32 sys_pll1_gnrl_ctl;
+	u32 sys_pll1_div_ctl;
+	u32 sys_pll1_locked_ctl1;
+	u32 reserved2[24];
+	u32 sys_pll1_mnit_ctl;
+	u32 sys_pll2_gnrl_ctl;
+	u32 sys_pll2_div_ctl;
+	u32 sys_pll2_locked_ctl1;
+	u32 sys_pll2_mnit_ctl;
+	u32 sys_pll3_gnrl_ctl;
+	u32 sys_pll3_div_ctl;
+	u32 sys_pll3_locked_ctl1;
+	u32 sys_pll3_mnit_ctl;
+	u32 anamix_misc_ctl;
+	u32 anamix_clk_mnit_ctl;
+	u32 reserved3[437];
+	u32 digprog;
+};
+#endif
 
 struct fuse_bank9_regs {
 	u32 mac_addr0;
@@ -256,11 +319,13 @@ struct src {
 	u32 usbophy2_rcr;
 	u32 mipiphy_rcr;
 	u32 pciephy_rcr;
+	/* Exits on i.MX8MQ */
 	u32 hdmi_rcr;
 	u32 disp_rcr;
 	u32 reserved2[2];
 	u32 gpu_rcr;
 	u32 vpu_rcr;
+	/* The following four exits on i.MX8MQ */
 	u32 pcie2_rcr;
 	u32 mipiphy1_rcr;
 	u32 mipiphy2_rcr;
@@ -283,6 +348,7 @@ struct src {
 	u32 gpr10;
 	u32 reserved5[985];
 	u32 ddr1_rcr;
+	/* Exist on i.MX8MQ */
 	u32 ddr2_rcr;
 };
 
@@ -457,7 +523,8 @@ struct bootrom_sw_info {
 	u32 reserved_3[3];
 };
 
-#define ROM_SW_INFO_ADDR_B0	0x00000968
+#define ROM_SW_INFO_ADDR_B0	(IS_ENABLED(CONFIG_IMX8MQ) ? 0x00000968 :\
+				 0x000009e8)
 #define ROM_SW_INFO_ADDR_A0	0x000009e8
 
 #define ROM_SW_INFO_ADDR is_soc_rev(CHIP_REV_1_0) ? \
Signature · 1 line
2.16.4
author reviewer
#60 lore raw

PATCH 24/41 imx: add get_cpu_rev support for i.MX8MM

In reply to Peng Fan

There are several variants based on i.MX8MM, add the support in get_cpu_rev

---
 arch/arm/mach-imx/imx8m/soc.c | 57 +++++++++++++++++++++++++++++++++++--------
 1 file changed, 47 insertions(+), 10 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +47 -10
index 11251c5f9a..42b99945b4 100644
@@ -130,25 +130,62 @@ static struct mm_region imx8m_mem_map[] = {
 
 struct mm_region *mem_map = imx8m_mem_map;
 
+static u32 get_cpu_variant_type(u32 type)
+{
+	struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+	struct fuse_bank *bank = &ocotp->bank[1];
+	struct fuse_bank1_regs *fuse =
+		(struct fuse_bank1_regs *)bank->fuse_regs;
+
+	u32 value = readl(&fuse->tester4);
+
+	if (type == MXC_CPU_IMX8MM) {
+		switch (value & 0x3) {
+		case 2:
+			if (value & 0x1c0000)
+				return MXC_CPU_IMX8MMDL;
+			else
+				return MXC_CPU_IMX8MMD;
+		case 3:
+			if (value & 0x1c0000)
+				return MXC_CPU_IMX8MMSL;
+			else
+				return MXC_CPU_IMX8MMS;
+		default:
+			if (value & 0x1c0000)
+				return MXC_CPU_IMX8MML;
+			break;
+		}
+	}
+
+	return type;
+}
+
 u32 get_cpu_rev(void)
 {
 	struct anamix_pll *ana_pll = (struct anamix_pll *)ANATOP_BASE_ADDR;
 	u32 reg = readl(&ana_pll->digprog);
 	u32 type = (reg >> 16) & 0xff;
+	u32 major_low = (reg >> 8) & 0xff;
 	u32 rom_version;
 
 	reg &= 0xff;
 
-	if (reg == CHIP_REV_1_0) {
-		/*
-		 * For B0 chip, the DIGPROG is not updated, still TO1.0.
-		 * we have to check ROM version further
-		 */
-		rom_version = readl((void __iomem *)ROM_VERSION_A0);
-		if (rom_version != CHIP_REV_1_0) {
-			rom_version = readl((void __iomem *)ROM_VERSION_B0);
-			if (rom_version >= CHIP_REV_2_0)
-				reg = CHIP_REV_2_0;
+	/* i.MX8MM */
+	if (major_low == 0x41) {
+		type = get_cpu_variant_type(MXC_CPU_IMX8MM);
+	} else {
+		if (reg == CHIP_REV_1_0) {
+			/*
+			 * For B0 chip, the DIGPROG is not updated, still TO1.0.
+			 * we have to check ROM version further
+			 */
+			rom_version = readl((void __iomem *)ROM_VERSION_A0);
+			if (rom_version != CHIP_REV_1_0) {
+				rom_version = readl((void __iomem *)ROM_VERSION_B0);
+				if (rom_version >= CHIP_REV_2_0)
+					reg = CHIP_REV_2_0;
+			}
 		}
 	}
 
Signature · 1 line
2.16.4
author reviewer
#61 lore raw

PATCH 25/41 imx8m: rename clock to clock_imx8mq

In reply to Peng Fan

i.MX8MQ and i.MX8MM has totally different pll design, so rename clock to clock_imx8mq.

---
 arch/arm/mach-imx/imx8m/Makefile                    | 3 ++-
 arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} | 0
 2 files changed, 2 insertions(+), 1 deletion(-)
 rename arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} (100%)
arch/arm/mach-imx/imx8m/Makefile +2 -1
index feff4941c1..42a1544c6b 100644
@@ -3,4 +3,5 @@
 # Copyright 2017 NXP
 
 obj-y += lowlevel_init.o
-obj-y += clock.o clock_slice.o soc.o
+obj-y += clock_slice.o soc.o
+obj-$(CONFIG_IMX8MQ) += clock_imx8mq.o
arch/arm/mach-imx/imx8m/clock_imx8mq.c renamed from arch/arm/mach-imx/imx8m/clock.c +0 -0
similarity index 100%
rename from arch/arm/mach-imx/imx8m/clock.c
rename to arch/arm/mach-imx/imx8m/clock_imx8mq.c
Signature · 1 line
2.16.4
author reviewer
#62 lore raw

PATCH 26/41 imx8m: restructure clock.h

In reply to Peng Fan

i.MX8MQ and i.MX8MM use different analog pll design, but they share same ccm design.
Add clock_imx8mq.h for i.MX8MQ
keep common part in clock.h

---
 arch/arm/include/asm/arch-imx8m/clock.h        | 491 +++----------------------
 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h | 424 +++++++++++++++++++++
 arch/arm/mach-imx/imx8m/clock_imx8mq.c         |   5 +-
 3 files changed, 467 insertions(+), 453 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h
arch/arm/include/asm/arch-imx8m/clock.h +42 -449
index e7c1670f6b..7225c760fe 100644
@@ -1,28 +1,29 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Copyright 2017 NXP
- *
- * Peng Fan <[email protected]>
+ * Copyright 2017-2019 NXP
  */
 
-#ifndef _ASM_ARCH_IMX8M_CLOCK_H
-#define _ASM_ARCH_IMX8M_CLOCK_H
-
 #include <linux/bitops.h>
 
+#ifdef CONFIG_IMX8MQ
+#include <asm/arch/clock_imx8mq.h>
+#else
+#error "Error no clock.h"
+#endif
+
 #define MHZ(X)	((X) * 1000000UL)
 
-enum pll_clocks {
-	ANATOP_ARM_PLL,
-	ANATOP_GPU_PLL,
-	ANATOP_SYSTEM_PLL1,
-	ANATOP_SYSTEM_PLL2,
-	ANATOP_SYSTEM_PLL3,
-	ANATOP_AUDIO_PLL1,
-	ANATOP_AUDIO_PLL2,
-	ANATOP_VIDEO_PLL1,
-	ANATOP_VIDEO_PLL2,
-	ANATOP_DRAM_PLL,
+/* Mainly for compatible to imx common code. */
+enum mxc_clock {
+	MXC_ARM_CLK = 0,
+	MXC_IPG_CLK,
+	MXC_CSPI_CLK,
+	MXC_ESDHC_CLK,
+	MXC_ESDHC2_CLK,
+	MXC_ESDHC3_CLK,
+	MXC_I2C_CLK,
+	MXC_UART_CLK,
+	MXC_QSPI_CLK,
 };
 
 enum clk_slice_type {
@@ -35,297 +36,6 @@ enum clk_slice_type {
 	DRAM_SEL_CLOCK_SLICE,
 };
 
-enum clk_root_index {
-	MXC_ARM_CLK			= 0,
-	ARM_A53_CLK_ROOT		= 0,
-	ARM_M4_CLK_ROOT			= 1,
-	VPU_A53_CLK_ROOT		= 2,
-	GPU_CORE_CLK_ROOT		= 3,
-	GPU_SHADER_CLK_ROOT		= 4,
-	MAIN_AXI_CLK_ROOT		= 16,
-	ENET_AXI_CLK_ROOT		= 17,
-	NAND_USDHC_BUS_CLK_ROOT		= 18,
-	VPU_BUS_CLK_ROOT		= 19,
-	DISPLAY_AXI_CLK_ROOT		= 20,
-	DISPLAY_APB_CLK_ROOT		= 21,
-	DISPLAY_RTRM_CLK_ROOT		= 22,
-	USB_BUS_CLK_ROOT		= 23,
-	GPU_AXI_CLK_ROOT		= 24,
-	GPU_AHB_CLK_ROOT		= 25,
-	NOC_CLK_ROOT			= 26,
-	NOC_APB_CLK_ROOT		= 27,
-	AHB_CLK_ROOT			= 32,
-	IPG_CLK_ROOT			= 33,
-	MXC_IPG_CLK			= 33,
-	AUDIO_AHB_CLK_ROOT		= 34,
-	MIPI_DSI_ESC_RX_CLK_ROOT	= 36,
-	DRAM_SEL_CFG			= 48,
-	CORE_SEL_CFG			= 49,
-	DRAM_ALT_CLK_ROOT		= 64,
-	DRAM_APB_CLK_ROOT		= 65,
-	VPU_G1_CLK_ROOT			= 66,
-	VPU_G2_CLK_ROOT			= 67,
-	DISPLAY_DTRC_CLK_ROOT		= 68,
-	DISPLAY_DC8000_CLK_ROOT		= 69,
-	PCIE1_CTRL_CLK_ROOT		= 70,
-	PCIE1_PHY_CLK_ROOT		= 71,
-	PCIE1_AUX_CLK_ROOT		= 72,
-	DC_PIXEL_CLK_ROOT		= 73,
-	LCDIF_PIXEL_CLK_ROOT		= 74,
-	SAI1_CLK_ROOT			= 75,
-	SAI2_CLK_ROOT			= 76,
-	SAI3_CLK_ROOT			= 77,
-	SAI4_CLK_ROOT			= 78,
-	SAI5_CLK_ROOT			= 79,
-	SAI6_CLK_ROOT			= 80,
-	SPDIF1_CLK_ROOT			= 81,
-	SPDIF2_CLK_ROOT			= 82,
-	ENET_REF_CLK_ROOT		= 83,
-	ENET_TIMER_CLK_ROOT		= 84,
-	ENET_PHY_REF_CLK_ROOT		= 85,
-	NAND_CLK_ROOT			= 86,
-	QSPI_CLK_ROOT			= 87,
-	MXC_ESDHC_CLK			= 88,
-	USDHC1_CLK_ROOT			= 88,
-	MXC_ESDHC2_CLK			= 89,
-	USDHC2_CLK_ROOT			= 89,
-	I2C1_CLK_ROOT			= 90,
-	MXC_I2C_CLK			= 90,
-	I2C2_CLK_ROOT			= 91,
-	I2C3_CLK_ROOT			= 92,
-	I2C4_CLK_ROOT			= 93,
-	UART1_CLK_ROOT			= 94,
-	UART2_CLK_ROOT			= 95,
-	UART3_CLK_ROOT			= 96,
-	UART4_CLK_ROOT			= 97,
-	USB_CORE_REF_CLK_ROOT		= 98,
-	USB_PHY_REF_CLK_ROOT		= 99,
-	GIC_CLK_ROOT			= 100,
-	ECSPI1_CLK_ROOT			= 101,
-	ECSPI2_CLK_ROOT			= 102,
-	PWM1_CLK_ROOT			= 103,
-	PWM2_CLK_ROOT			= 104,
-	PWM3_CLK_ROOT			= 105,
-	PWM4_CLK_ROOT			= 106,
-	GPT1_CLK_ROOT			= 107,
-	GPT2_CLK_ROOT			= 108,
-	GPT3_CLK_ROOT			= 109,
-	GPT4_CLK_ROOT			= 110,
-	GPT5_CLK_ROOT			= 111,
-	GPT6_CLK_ROOT			= 112,
-	TRACE_CLK_ROOT			= 113,
-	WDOG_CLK_ROOT			= 114,
-	WRCLK_CLK_ROOT			= 115,
-	IPP_DO_CLKO1			= 116,
-	IPP_DO_CLKO2			= 117,
-	MIPI_DSI_CORE_CLK_ROOT		= 118,
-	MIPI_DSI_PHY_REF_CLK_ROOT	= 119,
-	MIPI_DSI_DBI_CLK_ROOT		= 120,
-	OLD_MIPI_DSI_ESC_CLK_ROOT	= 121,
-	MIPI_CSI1_CORE_CLK_ROOT		= 122,
-	MIPI_CSI1_PHY_REF_CLK_ROOT	= 123,
-	MIPI_CSI1_ESC_CLK_ROOT		= 124,
-	MIPI_CSI2_CORE_CLK_ROOT		= 125,
-	MIPI_CSI2_PHY_REF_CLK_ROOT	= 126,
-	MIPI_CSI2_ESC_CLK_ROOT		= 127,
-	PCIE2_CTRL_CLK_ROOT		= 128,
-	PCIE2_PHY_CLK_ROOT		= 129,
-	PCIE2_AUX_CLK_ROOT		= 130,
-	ECSPI3_CLK_ROOT			= 131,
-	OLD_MIPI_DSI_ESC_RX_ROOT	= 132,
-	DISPLAY_HDMI_CLK_ROOT		= 133,
-	CLK_ROOT_MAX,
-};
-
-enum clk_root_src {
-	OSC_25M_CLK,
-	ARM_PLL_CLK,
-	DRAM_PLL1_CLK,
-	VIDEO_PLL2_CLK,
-	VPU_PLL_CLK,
-	GPU_PLL_CLK,
-	SYSTEM_PLL1_800M_CLK,
-	SYSTEM_PLL1_400M_CLK,
-	SYSTEM_PLL1_266M_CLK,
-	SYSTEM_PLL1_200M_CLK,
-	SYSTEM_PLL1_160M_CLK,
-	SYSTEM_PLL1_133M_CLK,
-	SYSTEM_PLL1_100M_CLK,
-	SYSTEM_PLL1_80M_CLK,
-	SYSTEM_PLL1_40M_CLK,
-	SYSTEM_PLL2_1000M_CLK,
-	SYSTEM_PLL2_500M_CLK,
-	SYSTEM_PLL2_333M_CLK,
-	SYSTEM_PLL2_250M_CLK,
-	SYSTEM_PLL2_200M_CLK,
-	SYSTEM_PLL2_166M_CLK,
-	SYSTEM_PLL2_125M_CLK,
-	SYSTEM_PLL2_100M_CLK,
-	SYSTEM_PLL2_50M_CLK,
-	SYSTEM_PLL3_CLK,
-	AUDIO_PLL1_CLK,
-	AUDIO_PLL2_CLK,
-	VIDEO_PLL_CLK,
-	OSC_32K_CLK,
-	EXT_CLK_1,
-	EXT_CLK_2,
-	EXT_CLK_3,
-	EXT_CLK_4,
-	OSC_27M_CLK,
-};
-
-/* CCGR index */
-enum clk_ccgr_index {
-	CCGR_DVFS = 0,
-	CCGR_ANAMIX = 1,
-	CCGR_CPU = 2,
-	CCGR_CSU = 4,
-	CCGR_DRAM1 = 5,
-	CCGR_DRAM2_OBSOLETE = 6,
-	CCGR_ECSPI1 = 7,
-	CCGR_ECSPI2 = 8,
-	CCGR_ECSPI3 = 9,
-	CCGR_ENET1 = 10,
-	CCGR_GPIO1 = 11,
-	CCGR_GPIO2 = 12,
-	CCGR_GPIO3 = 13,
-	CCGR_GPIO4 = 14,
-	CCGR_GPIO5 = 15,
-	CCGR_GPT1 = 16,
-	CCGR_GPT2 = 17,
-	CCGR_GPT3 = 18,
-	CCGR_GPT4 = 19,
-	CCGR_GPT5 = 20,
-	CCGR_GPT6 = 21,
-	CCGR_HS = 22,
-	CCGR_I2C1 = 23,
-	CCGR_I2C2 = 24,
-	CCGR_I2C3 = 25,
-	CCGR_I2C4 = 26,
-	CCGR_IOMUX = 27,
-	CCGR_IOMUX1 = 28,
-	CCGR_IOMUX2 = 29,
-	CCGR_IOMUX3 = 30,
-	CCGR_IOMUX4 = 31,
-	CCGR_M4 = 32,
-	CCGR_MU = 33,
-	CCGR_OCOTP = 34,
-	CCGR_OCRAM = 35,
-	CCGR_OCRAM_S = 36,
-	CCGR_PCIE = 37,
-	CCGR_PERFMON1 = 38,
-	CCGR_PERFMON2 = 39,
-	CCGR_PWM1 = 40,
-	CCGR_PWM2 = 41,
-	CCGR_PWM3 = 42,
-	CCGR_PWM4 = 43,
-	CCGR_QOS = 44,
-	CCGR_DISMIX = 45,
-	CCGR_MEGAMIX = 46,
-	CCGR_QSPI = 47,
-	CCGR_RAWNAND = 48,
-	CCGR_RDC = 49,
-	CCGR_ROM = 50,
-	CCGR_SAI1 = 51,
-	CCGR_SAI2 = 52,
-	CCGR_SAI3 = 53,
-	CCGR_SAI4 = 54,
-	CCGR_SAI5 = 55,
-	CCGR_SAI6 = 56,
-	CCGR_SCTR = 57,
-	CCGR_SDMA1 = 58,
-	CCGR_SDMA2 = 59,
-	CCGR_SEC_DEBUG = 60,
-	CCGR_SEMA1 = 61,
-	CCGR_SEMA2 = 62,
-	CCGR_SIM_DISPLAY = 63,
-	CCGR_SIM_ENET = 64,
-	CCGR_SIM_M = 65,
-	CCGR_SIM_MAIN = 66,
-	CCGR_SIM_S = 67,
-	CCGR_SIM_WAKEUP = 68,
-	CCGR_SIM_USB = 69,
-	CCGR_SIM_VPU = 70,
-	CCGR_SNVS = 71,
-	CCGR_TRACE = 72,
-	CCGR_UART1 = 73,
-	CCGR_UART2 = 74,
-	CCGR_UART3 = 75,
-	CCGR_UART4 = 76,
-	CCGR_USB_CTRL1 = 77,
-	CCGR_USB_CTRL2 = 78,
-	CCGR_USB_PHY1 = 79,
-	CCGR_USB_PHY2 = 80,
-	CCGR_USDHC1 = 81,
-	CCGR_USDHC2 = 82,
-	CCGR_WDOG1 = 83,
-	CCGR_WDOG2 = 84,
-	CCGR_WDOG3 = 85,
-	CCGR_VA53 = 86,
-	CCGR_GPU = 87,
-	CCGR_HEVC = 88,
-	CCGR_AVC = 89,
-	CCGR_VP9 = 90,
-	CCGR_HEVC_INTER = 91,
-	CCGR_GIC = 92,
-	CCGR_DISPLAY = 93,
-	CCGR_HDMI = 94,
-	CCGR_HDMI_PHY = 95,
-	CCGR_XTAL = 96,
-	CCGR_PLL = 97,
-	CCGR_TSENSOR = 98,
-	CCGR_VPU_DEC = 99,
-	CCGR_PCIE2 = 100,
-	CCGR_MIPI_CSI1 = 101,
-	CCGR_MIPI_CSI2 = 102,
-	CCGR_MAX,
-};
-
-/* src index */
-enum clk_src_index {
-	CLK_SRC_CKIL_SYNC_REQ = 0,
-	CLK_SRC_ARM_PLL_EN = 1,
-	CLK_SRC_GPU_PLL_EN = 2,
-	CLK_SRC_VPU_PLL_EN = 3,
-	CLK_SRC_DRAM_PLL_EN = 4,
-	CLK_SRC_SYSTEM_PLL1_EN = 5,
-	CLK_SRC_SYSTEM_PLL2_EN = 6,
-	CLK_SRC_SYSTEM_PLL3_EN = 7,
-	CLK_SRC_AUDIO_PLL1_EN = 8,
-	CLK_SRC_AUDIO_PLL2_EN = 9,
-	CLK_SRC_VIDEO_PLL1_EN = 10,
-	CLK_SRC_VIDEO_PLL2_EN = 11,
-	CLK_SRC_ARM_PLL = 12,
-	CLK_SRC_GPU_PLL = 13,
-	CLK_SRC_VPU_PLL = 14,
-	CLK_SRC_DRAM_PLL = 15,
-	CLK_SRC_SYSTEM_PLL1_800M = 16,
-	CLK_SRC_SYSTEM_PLL1_400M = 17,
-	CLK_SRC_SYSTEM_PLL1_266M = 18,
-	CLK_SRC_SYSTEM_PLL1_200M = 19,
-	CLK_SRC_SYSTEM_PLL1_160M = 20,
-	CLK_SRC_SYSTEM_PLL1_133M = 21,
-	CLK_SRC_SYSTEM_PLL1_100M = 22,
-	CLK_SRC_SYSTEM_PLL1_80M = 23,
-	CLK_SRC_SYSTEM_PLL1_40M = 24,
-	CLK_SRC_SYSTEM_PLL2_1000M = 25,
-	CLK_SRC_SYSTEM_PLL2_500M = 26,
-	CLK_SRC_SYSTEM_PLL2_333M = 27,
-	CLK_SRC_SYSTEM_PLL2_250M = 28,
-	CLK_SRC_SYSTEM_PLL2_200M = 29,
-	CLK_SRC_SYSTEM_PLL2_166M = 30,
-	CLK_SRC_SYSTEM_PLL2_125M = 31,
-	CLK_SRC_SYSTEM_PLL2_100M = 32,
-	CLK_SRC_SYSTEM_PLL2_50M = 33,
-	CLK_SRC_SYSTEM_PLL3 = 34,
-	CLK_SRC_AUDIO_PLL1 = 35,
-	CLK_SRC_AUDIO_PLL2 = 36,
-	CLK_SRC_VIDEO_PLL1 = 37,
-	CLK_SRC_VIDEO_PLL2 = 38,
-	CLK_SRC_OSC_25M = 39,
-	CLK_SRC_OSC_27M = 40,
-};
-
 enum root_pre_div {
 	CLK_ROOT_PRE_DIV1 = 0,
 	CLK_ROOT_PRE_DIV2,
@@ -466,6 +176,29 @@ struct ccm_reg {
 	struct ccm_root ip_root[78];
 };
 
+enum enet_freq {
+	ENET_25MHZ = 0,
+	ENET_50MHZ,
+	ENET_125MHZ,
+};
+
+#define DRAM_BYPASS_ROOT_CONFIG(_rate, _m, _p, _s, _k)			\
+	{								\
+		.clk		=	(_rate),			\
+		.alt_root_sel	=	(_m),				\
+		.alt_pre_div	=	(_p),				\
+		.apb_root_sel	=	(_s),				\
+		.apb_pre_div	=	(_k),				\
+	}
+
+struct dram_bypass_clk_setting {
+	ulong clk;
+	int alt_root_sel;
+	enum root_pre_div alt_pre_div;
+	int apb_root_sel;
+	enum root_pre_div apb_pre_div;
+};
+
 #define CCGR_CLK_ON_MASK	0x03
 #define CLK_SRC_ON_MASK		0x03
 
@@ -503,117 +236,6 @@ struct ccm_reg {
 #define CLK_ROOT_IPG_POST_DIV_MASK	0x3
 #define CLK_ROOT_POST_DIV_SHIFT		0
 #define CLK_ROOT_POST_DIV(n)		((n) & 0x3f)
-
-/* AUDIO PLL1/2 VIDEO PLL1 GPU PLL VPU PLL ARM PLL*/
-#define FRAC_PLL_LOCK_MASK		BIT(31)
-#define FRAC_PLL_CLKE_MASK		BIT(21)
-#define FRAC_PLL_PD_MASK		BIT(19)
-#define FRAC_PLL_REFCLK_SEL_MASK	BIT(16)
-#define FRAC_PLL_LOCK_SEL_MASK		BIT(15)
-#define FRAC_PLL_BYPASS_MASK		BIT(14)
-#define FRAC_PLL_COUNTCLK_SEL_MASK	BIT(13)
-#define FRAC_PLL_NEWDIV_VAL_MASK	BIT(12)
-#define FRAC_PLL_NEWDIV_ACK_MASK	BIT(11)
-#define FRAC_PLL_REFCLK_DIV_VAL(n)	(((n) << 5) & (0x3f << 5))
-#define FRAC_PLL_REFCLK_DIV_VAL_MASK	(0x3f << 5)
-#define FRAC_PLL_REFCLK_DIV_VAL_SHIFT	5
-#define FRAC_PLL_OUTPUT_DIV_VAL_MASK	0x1f
-#define FRAC_PLL_OUTPUT_DIV_VAL(n)	((n) & 0x1f)
-
-#define FRAC_PLL_REFCLK_SEL_OSC_25M	(0 << 16)
-#define FRAC_PLL_REFCLK_SEL_OSC_27M	BIT(16)
-#define FRAC_PLL_REFCLK_SEL_HDMI_PHY_27M (2 << 16)
-#define FRAC_PLL_REFCLK_SEL_CLK_PN	(3 << 16)
-
-#define FRAC_PLL_FRAC_DIV_CTL_MASK	(0x1ffffff << 7)
-#define FRAC_PLL_FRAC_DIV_CTL_SHIFT	7
-#define FRAC_PLL_INT_DIV_CTL_MASK	0x7f
-#define FRAC_PLL_INT_DIV_CTL_VAL(n)	((n) & 0x7f)
-
-/* SYS PLL1/2/3 VIDEO PLL2 DRAM PLL */
-#define SSCG_PLL_LOCK_MASK		BIT(31)
-#define SSCG_PLL_CLKE_MASK		BIT(25)
-#define SSCG_PLL_DIV2_CLKE_MASK		BIT(23)
-#define SSCG_PLL_DIV3_CLKE_MASK		BIT(21)
-#define SSCG_PLL_DIV4_CLKE_MASK		BIT(19)
-#define SSCG_PLL_DIV5_CLKE_MASK		BIT(17)
-#define SSCG_PLL_DIV6_CLKE_MASK		BIT(15)
-#define SSCG_PLL_DIV8_CLKE_MASK		BIT(13)
-#define SSCG_PLL_DIV10_CLKE_MASK	BIT(11)
-#define SSCG_PLL_DIV20_CLKE_MASK	BIT(9)
-#define SSCG_PLL_VIDEO_PLL2_CLKE_MASK	BIT(9)
-#define SSCG_PLL_DRAM_PLL_CLKE_MASK	BIT(9)
-#define SSCG_PLL_PLL3_CLKE_MASK		BIT(9)
-#define SSCG_PLL_PD_MASK		BIT(7)
-#define SSCG_PLL_BYPASS1_MASK		BIT(5)
-#define SSCG_PLL_BYPASS2_MASK		BIT(4)
-#define SSCG_PLL_LOCK_SEL_MASK		BIT(3)
-#define SSCG_PLL_COUNTCLK_SEL_MASK	BIT(2)
-#define SSCG_PLL_REFCLK_SEL_MASK	0x3
-#define SSCG_PLL_REFCLK_SEL_OSC_25M	(0 << 16)
-#define SSCG_PLL_REFCLK_SEL_OSC_27M	BIT(16)
-#define SSCG_PLL_REFCLK_SEL_HDMI_PHY_27M (2 << 16)
-#define SSCG_PLL_REFCLK_SEL_CLK_PN	(3 << 16)
-
-#define SSCG_PLL_SSDS_MASK		BIT(8)
-#define SSCG_PLL_SSMD_MASK		(0x7 << 5)
-#define SSCG_PLL_SSMF_MASK		(0xf << 1)
-#define SSCG_PLL_SSE_MASK		0x1
-
-#define SSCG_PLL_REF_DIVR1_MASK		(0x7 << 25)
-#define SSCG_PLL_REF_DIVR1_SHIFT	25
-#define SSCG_PLL_REF_DIVR1_VAL(n)	(((n) << 25) & SSCG_PLL_REF_DIVR1_MASK)
-#define SSCG_PLL_REF_DIVR2_MASK		(0x3f << 19)
-#define SSCG_PLL_REF_DIVR2_SHIFT	19
-#define SSCG_PLL_REF_DIVR2_VAL(n)	(((n) << 19) & SSCG_PLL_REF_DIVR2_MASK)
-#define SSCG_PLL_FEEDBACK_DIV_F1_MASK	(0x3f << 13)
-#define SSCG_PLL_FEEDBACK_DIV_F1_SHIFT	13
-#define SSCG_PLL_FEEDBACK_DIV_F1_VAL(n)	(((n) << 13) & \
-					 SSCG_PLL_FEEDBACK_DIV_F1_MASK)
-#define SSCG_PLL_FEEDBACK_DIV_F2_MASK	(0x3f << 7)
-#define SSCG_PLL_FEEDBACK_DIV_F2_SHIFT	7
-#define SSCG_PLL_FEEDBACK_DIV_F2_VAL(n)	(((n) << 7) & \
-					 SSCG_PLL_FEEDBACK_DIV_F2_MASK)
-#define SSCG_PLL_OUTPUT_DIV_VAL_MASK	(0x3f << 1)
-#define SSCG_PLL_OUTPUT_DIV_VAL_SHIFT	1
-#define SSCG_PLL_OUTPUT_DIV_VAL(n)	(((n) << 1) & \
-					 SSCG_PLL_OUTPUT_DIV_VAL_MASK)
-#define SSCG_PLL_FILTER_RANGE_MASK	0x1
-
-#define HW_DIGPROG_MAJOR_UPPER_MASK	(0xff << 16)
-#define HW_DIGPROG_MAJOR_LOWER_MASK	(0xff << 8)
-#define HW_DIGPROG_MINOR_MASK		0xff
-
-#define HW_OSC_27M_CLKE_MASK		BIT(4)
-#define HW_OSC_25M_CLKE_MASK		BIT(2)
-#define HW_OSC_32K_SEL_MASK		0x1
-#define HW_OSC_32K_SEL_RTC		0x1
-#define HW_OSC_32K_SEL_25M_DIV800	0x0
-
-#define HW_FRAC_ARM_PLL_DIV_MASK	(0x7 << 20)
-#define HW_FRAC_ARM_PLL_DIV_SHIFT	20
-#define HW_FRAC_VPU_PLL_DIV_MASK	(0x7 << 16)
-#define HW_FRAC_VPU_PLL_DIV_SHIFT	16
-#define HW_FRAC_GPU_PLL_DIV_MASK	(0x7 << 12)
-#define HW_FRAC_GPU_PLL_DIV_SHIFT	12
-#define HW_FRAC_VIDEO_PLL1_DIV_MASK	(0x7 << 10)
-#define HW_FRAC_VIDEO_PLL1_DIV_SHIFT	10
-#define HW_FRAC_AUDIO_PLL2_DIV_MASK	(0x7 << 4)
-#define HW_FRAC_AUDIO_PLL2_DIV_SHIFT	4
-#define HW_FRAC_AUDIO_PLL1_DIV_MASK	0x7
-#define HW_FRAC_AUDIO_PLL1_DIV_SHIFT	0
-
-#define HW_SSCG_VIDEO_PLL2_DIV_MASK	(0x7 << 16)
-#define HW_SSCG_VIDEO_PLL2_DIV_SHIFT	16
-#define HW_SSCG_DRAM_PLL_DIV_MASK	(0x7 << 14)
-#define HW_SSCG_DRAM_PLL_DIV_SHIFT	14
-#define HW_SSCG_SYSTEM_PLL3_DIV_MASK	(0x7 << 8)
-#define HW_SSCG_SYSTEM_PLL3_DIV_SHIFT	8
-#define HW_SSCG_SYSTEM_PLL2_DIV_MASK	(0x7 << 4)
-#define HW_SSCG_SYSTEM_PLL2_DIV_SHIFT	4
-#define HW_SSCG_SYSTEM_PLL1_DIV_MASK	0x7
-#define HW_SSCG_SYSTEM_PLL1_DIV_SHIFT	0
-
 #define ENET1_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_125M_CLK		0x01000000
 #define ENET1_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_50M_CLK		0x02000000
 #define ENET1_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_25M_CLK		0x03000000
@@ -622,34 +244,6 @@ struct ccm_reg {
 #define ENET1_TIME_CLK_ROOT_FROM_PLL_ENET_MAIN_100M_CLK		0x01000000
 #define ENET_PHY_REF_CLK_ROOT_FROM_PLL_ENET_MAIN_25M_CLK	0x01000000
 
-enum enet_freq {
-	ENET_25MHZ = 0,
-	ENET_50MHZ,
-	ENET_125MHZ,
-};
-
-enum frac_pll_out_val {
-	FRAC_PLL_OUT_1000M,
-	FRAC_PLL_OUT_1600M,
-};
-
-#define DRAM_BYPASS_ROOT_CONFIG(_rate, _m, _p, _s, _k)			\
-	{								\
-		.clk		=	(_rate),			\
-		.alt_root_sel	=	(_m),				\
-		.alt_pre_div	=	(_p),				\
-		.apb_root_sel	=	(_s),				\
-		.apb_pre_div	=	(_k),				\
-	}
-
-struct dram_bypass_clk_setting {
-	ulong clk;
-	int alt_root_sel;
-	enum root_pre_div alt_pre_div;
-	int apb_root_sel;
-	enum root_pre_div apb_pre_div;
-};
-
 void dram_pll_init(ulong pll_val);
 void dram_enable_bypass(ulong clk_val);
 void dram_disable_bypass(void);
@@ -659,7 +253,7 @@ int clock_init(void);
 void init_clk_usdhc(u32 index);
 void init_uart_clk(u32 index);
 void init_wdog_clk(void);
-unsigned int mxc_get_clock(enum clk_root_index clk);
+unsigned int mxc_get_clock(enum mxc_clock clk);
 int clock_enable(enum clk_ccgr_index index, bool enable);
 int clock_root_enabled(enum clk_root_index clock_id);
 int clock_root_cfg(enum clk_root_index clock_id, enum root_pre_div pre_div,
@@ -675,4 +269,3 @@ int set_clk_qspi(void);
 void enable_ocotp_clk(unsigned char enable);
 int enable_i2c_clk(unsigned char enable, unsigned int i2c_num);
 int set_clk_enet(enum enet_freq type);
-#endif
arch/arm/include/asm/arch-imx8m/clock_imx8mq.h new file +424 -0

424 lines not on this page · raw message

arch/arm/mach-imx/imx8m/clock_imx8mq.c +1 -4
index 289b9417aa..feecdb50f6 100644
@@ -322,13 +322,10 @@ int enable_i2c_clk(unsigned char enable, unsigned int i2c_num)
 	return 0;
 }
 
-unsigned int mxc_get_clock(enum clk_root_index clk)
+unsigned int mxc_get_clock(enum mxc_clock clk)
 {
 	u32 val;
 
-	if (clk >= CLK_ROOT_MAX)
-		return 0;
-
 	if (clk == MXC_ARM_CLK)
 		return get_root_clk(ARM_A53_CLK_ROOT);
 
Signature · 1 line
2.16.4
author reviewer
#63 lore raw

PATCH 27/41 imx8m: add clk support for i.MX8MM

In reply to Peng Fan

Introduce clk implementation for i.MX8MM, including pll configuration, ccm configuration. Mostly will be done clk dm driver,
but such as DRAM part, we still use non clk dm driver, because we have limited sram.

---
 arch/arm/include/asm/arch-imx8m/clock.h        |   2 +
 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h | 387 +++++++++++++++++++++
 arch/arm/mach-imx/imx8m/Makefile               |   1 +
 arch/arm/mach-imx/imx8m/clock_imx8mm.c         | 292 ++++++++++++++++
 arch/arm/mach-imx/imx8m/clock_slice.c          | 461 +++++++++++++++++++++++++
 5 files changed, 1143 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h
 create mode 100644 arch/arm/mach-imx/imx8m/clock_imx8mm.c
arch/arm/include/asm/arch-imx8m/clock.h +2 -0
index 7225c760fe..ead4b8d3dc 100644
@@ -7,6 +7,8 @@
 
 #ifdef CONFIG_IMX8MQ
 #include <asm/arch/clock_imx8mq.h>
+#elif defined(CONFIG_IMX8MM)
+#include <asm/arch/clock_imx8mm.h>
 #else
 #error "Error no clock.h"
 #endif
arch/arm/include/asm/arch-imx8m/clock_imx8mm.h new file +387 -0

387 lines not on this page · raw message

arch/arm/mach-imx/imx8m/Makefile +1 -0
index 42a1544c6b..92184f3135 100644
@@ -5,3 +5,4 @@
 obj-y += lowlevel_init.o
 obj-y += clock_slice.o soc.o
 obj-$(CONFIG_IMX8MQ) += clock_imx8mq.o
+obj-$(CONFIG_IMX8MM) += clock_imx8mm.o
arch/arm/mach-imx/imx8m/clock_imx8mm.c new file +292 -0

292 lines not on this page · raw message

arch/arm/mach-imx/imx8m/clock_slice.c +461 -0

473 lines not on this page · raw message

Signature · 1 line
2.16.4
author reviewer
#64 lore raw

PATCH 28/41 imx8m: soc: probe clk before relocation

In reply to Peng Fan

probe clk device before relocation to get cpu clk.

---
 arch/arm/mach-imx/imx8m/soc.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
arch/arm/mach-imx/imx8m/soc.c +21 -0
index 42b99945b4..07cda86bdd 100644
@@ -14,6 +14,10 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/syscounter.h>
 #include <asm/armv8/mmu.h>
+#include <dm/uclass.h>
+#include <dm/device.h>
+#include <dm/uclass-internal.h>
+#include <dm/device-internal.h>
 #include <errno.h>
 #include <fdt_support.h>
 #include <fsl_wdog.h>
@@ -277,3 +281,20 @@ void reset_cpu(ulong addr)
 		 */
 	}
 }
+
+/* TODO: Add i.MX8MQ */
+#ifdef CONFIG_IMX8MM
+int arch_cpu_init_dm(void)
+{
+	struct udevice *dev;
+
+	uclass_find_first_device(UCLASS_CLK, &dev);
+
+	for (; dev; uclass_find_next_device(&dev)) {
+		if (device_probe(dev))
+			continue;
+	}
+
+	return 0;
+}
+#endif
Signature · 1 line
2.16.4
author reviewer
#65 lore raw

PATCH 29/41 imx8m: add pin header for i.MX8MM

In reply to Peng Fan

Add pin header file for i.MX8MM

To IMX8MM_PAD_NAND_WE_B_USDHC3_CLK, IOMUX_CONFIG_SION needs to be selected.

---
 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h | 691 ++++++++++++++++++++++++++
 1 file changed, 691 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h
arch/arm/include/asm/arch-imx8m/imx8mm_pins.h new file +691 -0
new file mode 100644
index 0000000000..210e96e1db
@@ -0,0 +1,691 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2018-2019 NXP
+ */
+
+#ifndef __ASM_ARCH_IMX8MM_PINS_H__
+#define __ASM_ARCH_IMX8MM_PINS_H__
+
+#include <asm/mach-imx/iomux-v3.h>
+
+enum {
+	IMX8MM_PAD_GPIO1_IO00_GPIO1_IO0                               =  IOMUX_PAD(0x0290, 0x0028, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO00_CCM_ENET_PHY_REF_CLK_ROOT               =  IOMUX_PAD(0x0290, 0x0028, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO00_XTALOSC_REF_CLK_32K                     =  IOMUX_PAD(0x0290, 0x0028, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO00_CCM_EXT_CLK1                            =  IOMUX_PAD(0x0290, 0x0028, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO01_GPIO1_IO1                               =  IOMUX_PAD(0x0294, 0x002C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO01_PWM1_OUT                                =  IOMUX_PAD(0x0294, 0x002C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO01_XTALOSC_REF_CLK_24M                     =  IOMUX_PAD(0x0294, 0x002C, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO01_CCM_EXT_CLK2                            =  IOMUX_PAD(0x0294, 0x002C, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO02_GPIO1_IO2                               =  IOMUX_PAD(0x0298, 0x0030, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO02_WDOG1_WDOG_B                            =  IOMUX_PAD(0x0298, 0x0030, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO02_WDOG1_WDOG_ANY                          =  IOMUX_PAD(0x0298, 0x0030, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO03_GPIO1_IO3                               =  IOMUX_PAD(0x029C, 0x0034, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO03_USDHC1_VSELECT                          =  IOMUX_PAD(0x029C, 0x0034, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO03_SDMA1_EXT_EVENT0                        =  IOMUX_PAD(0x029C, 0x0034, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO04_GPIO1_IO4                               =  IOMUX_PAD(0x02A0, 0x0038, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO04_USDHC2_VSELECT                          =  IOMUX_PAD(0x02A0, 0x0038, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO04_SDMA1_EXT_EVENT1                        =  IOMUX_PAD(0x02A0, 0x0038, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO05_GPIO1_IO5                               =  IOMUX_PAD(0x02A4, 0x003C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO05_ARM_PLATFORM_M4_NMI                     =  IOMUX_PAD(0x02A4, 0x003C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO05_CCM_PMIC_READY                          =  IOMUX_PAD(0x02A4, 0x003C, 5, 0x04BC, 0, 0),
+	IMX8MM_PAD_GPIO1_IO05_SRC_INT_BOOT                            =  IOMUX_PAD(0x02A4, 0x003C, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO06_GPIO1_IO6                               =  IOMUX_PAD(0x02A8, 0x0040, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO06_ENET1_MDC                               =  IOMUX_PAD(0x02A8, 0x0040, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO06_USDHC1_CD_B                             =  IOMUX_PAD(0x02A8, 0x0040, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO06_CCM_EXT_CLK3                            =  IOMUX_PAD(0x02A8, 0x0040, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO07_GPIO1_IO7                               =  IOMUX_PAD(0x02AC, 0x0044, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO07_ENET1_MDIO                              =  IOMUX_PAD(0x02AC, 0x0044, 1, 0x04C0, 0, 0),
+	IMX8MM_PAD_GPIO1_IO07_USDHC1_WP                               =  IOMUX_PAD(0x02AC, 0x0044, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO07_CCM_EXT_CLK4                            =  IOMUX_PAD(0x02AC, 0x0044, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO08_GPIO1_IO8                               =  IOMUX_PAD(0x02B0, 0x0048, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO08_ENET1_1588_EVENT0_IN                    =  IOMUX_PAD(0x02B0, 0x0048, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO08_USDHC2_RESET_B                          =  IOMUX_PAD(0x02B0, 0x0048, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO08_CCM_WAIT                                =  IOMUX_PAD(0x02B0, 0x0048, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO09_GPIO1_IO9                               =  IOMUX_PAD(0x02B4, 0x004C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO09_ENET1_1588_EVENT0_OUT                   =  IOMUX_PAD(0x02B4, 0x004C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO09_USDHC3_RESET_B                          =  IOMUX_PAD(0x02B4, 0x004C, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO09_SDMA2_EXT_EVENT0                        =  IOMUX_PAD(0x02B4, 0x004C, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO09_CCM_STOP                                =  IOMUX_PAD(0x02B4, 0x004C, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO10_GPIO1_IO10                              =  IOMUX_PAD(0x02B8, 0x0050, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO10_USB1_OTG_ID                             =  IOMUX_PAD(0x02B8, 0x0050, 1, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO11_GPIO1_IO11                              =  IOMUX_PAD(0x02BC, 0x0054, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO11_USB2_OTG_ID                             =  IOMUX_PAD(0x02BC, 0x0054, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO11_USDHC3_VSELECT                          =  IOMUX_PAD(0x02BC, 0x0054, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO11_CCM_PMIC_READY                          =  IOMUX_PAD(0x02BC, 0x0054, 5, 0x04BC, 1, 0),
+	IMX8MM_PAD_GPIO1_IO11_CCM_OUT0                                =  IOMUX_PAD(0x02BC, 0x0054, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO12_GPIO1_IO12                              =  IOMUX_PAD(0x02C0, 0x0058, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO12_USB1_OTG_PWR                            =  IOMUX_PAD(0x02C0, 0x0058, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO12_SDMA2_EXT_EVENT1                        =  IOMUX_PAD(0x02C0, 0x0058, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO12_CCM_OUT1                                =  IOMUX_PAD(0x02C0, 0x0058, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO13_GPIO1_IO13                              =  IOMUX_PAD(0x02C4, 0x005C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO13_USB1_OTG_OC                             =  IOMUX_PAD(0x02C4, 0x005C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO13_PWM2_OUT                                =  IOMUX_PAD(0x02C4, 0x005C, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO13_CCM_OUT2                                =  IOMUX_PAD(0x02C4, 0x005C, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO14_GPIO1_IO14                              =  IOMUX_PAD(0x02C8, 0x0060, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO14_USB2_OTG_PWR                            =  IOMUX_PAD(0x02C8, 0x0060, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO14_USDHC3_CD_B                             =  IOMUX_PAD(0x02C8, 0x0060, 4, 0x0544, 2, 0),
+	IMX8MM_PAD_GPIO1_IO14_PWM3_OUT                                =  IOMUX_PAD(0x02C8, 0x0060, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO14_CCM_CLKO1                               =  IOMUX_PAD(0x02C8, 0x0060, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_GPIO1_IO15_GPIO1_IO15                              =  IOMUX_PAD(0x02CC, 0x0064, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO15_USB2_OTG_OC                             =  IOMUX_PAD(0x02CC, 0x0064, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO15_USDHC3_WP                               =  IOMUX_PAD(0x02CC, 0x0064, 4, 0x0548, 2, 0),
+	IMX8MM_PAD_GPIO1_IO15_PWM4_OUT                                =  IOMUX_PAD(0x02CC, 0x0064, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_GPIO1_IO15_CCM_CLKO2                               =  IOMUX_PAD(0x02CC, 0x0064, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_MDC_ENET1_MDC                                 =  IOMUX_PAD(0x02D0, 0x0068, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_MDC_GPIO1_IO16                                =  IOMUX_PAD(0x02D0, 0x0068, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_MDIO_ENET1_MDIO                               =  IOMUX_PAD(0x02D4, 0x006C, 0, 0x04C0, 1, 0),
+	IMX8MM_PAD_ENET_MDIO_GPIO1_IO17                               =  IOMUX_PAD(0x02D4, 0x006C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_TD3_ENET1_RGMII_TD3                           =  IOMUX_PAD(0x02D8, 0x0070, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_TD3_GPIO1_IO18                                =  IOMUX_PAD(0x02D8, 0x0070, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_TD2_ENET1_RGMII_TD2                           =  IOMUX_PAD(0x02DC, 0x0074, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_TD2_ENET1_TX_CLK                              =  IOMUX_PAD(0x02DC, 0x0074, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_TD2_CCM_ENET_REF_CLK_ROOT                     =  IOMUX_PAD(0x02DC, 0x0074, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_TD2_GPIO1_IO19                                =  IOMUX_PAD(0x02DC, 0x0074, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_TD1_ENET1_RGMII_TD1                           =  IOMUX_PAD(0x02E0, 0x0078, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_TD1_GPIO1_IO20                                =  IOMUX_PAD(0x02E0, 0x0078, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_TD0_ENET1_RGMII_TD0                           =  IOMUX_PAD(0x02E4, 0x007C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_TD0_GPIO1_IO21                                =  IOMUX_PAD(0x02E4, 0x007C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_TX_CTL_ENET1_RGMII_TX_CTL                     =  IOMUX_PAD(0x02E8, 0x0080, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_TX_CTL_GPIO1_IO22                             =  IOMUX_PAD(0x02E8, 0x0080, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_TXC_ENET1_RGMII_TXC                           =  IOMUX_PAD(0x02EC, 0x0084, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_TXC_ENET1_TX_ER                               =  IOMUX_PAD(0x02EC, 0x0084, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_TXC_GPIO1_IO23                                =  IOMUX_PAD(0x02EC, 0x0084, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_RX_CTL_ENET1_RGMII_RX_CTL                     =  IOMUX_PAD(0x02F0, 0x0088, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_RX_CTL_GPIO1_IO24                             =  IOMUX_PAD(0x02F0, 0x0088, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_RXC_ENET1_RGMII_RXC                           =  IOMUX_PAD(0x02F4, 0x008C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_RXC_ENET1_RX_ER                               =  IOMUX_PAD(0x02F4, 0x008C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_RXC_GPIO1_IO25                                =  IOMUX_PAD(0x02F4, 0x008C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_RD0_ENET1_RGMII_RD0                           =  IOMUX_PAD(0x02F8, 0x0090, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_RD0_GPIO1_IO26                                =  IOMUX_PAD(0x02F8, 0x0090, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_RD1_ENET1_RGMII_RD1                           =  IOMUX_PAD(0x02FC, 0x0094, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_RD1_GPIO1_IO27                                =  IOMUX_PAD(0x02FC, 0x0094, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_RD2_ENET1_RGMII_RD2                           =  IOMUX_PAD(0x0300, 0x0098, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_RD2_GPIO1_IO28                                =  IOMUX_PAD(0x0300, 0x0098, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ENET_RD3_ENET1_RGMII_RD3                           =  IOMUX_PAD(0x0304, 0x009C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ENET_RD3_GPIO1_IO29                                =  IOMUX_PAD(0x0304, 0x009C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_CLK_USDHC1_CLK                                 =  IOMUX_PAD(0x0308, 0x00A0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_CLK_GPIO2_IO0                                  =  IOMUX_PAD(0x0308, 0x00A0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_CMD_USDHC1_CMD                                 =  IOMUX_PAD(0x030C, 0x00A4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_CMD_GPIO2_IO1                                  =  IOMUX_PAD(0x030C, 0x00A4, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_DATA0_USDHC1_DATA0                             =  IOMUX_PAD(0x0310, 0x00A8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_DATA0_GPIO2_IO2                                =  IOMUX_PAD(0x0310, 0x00A8, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_DATA1_USDHC1_DATA1                             =  IOMUX_PAD(0x0314, 0x00AC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_DATA1_GPIO2_IO3                                =  IOMUX_PAD(0x0314, 0x00AC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_DATA2_USDHC1_DATA2                             =  IOMUX_PAD(0x0318, 0x00B0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_DATA2_GPIO2_IO4                                =  IOMUX_PAD(0x0318, 0x00B0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_DATA3_USDHC1_DATA3                             =  IOMUX_PAD(0x031C, 0x00B4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_DATA3_GPIO2_IO5                                =  IOMUX_PAD(0x031C, 0x00B4, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_DATA4_USDHC1_DATA4                             =  IOMUX_PAD(0x0320, 0x00B8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_DATA4_GPIO2_IO6                                =  IOMUX_PAD(0x0320, 0x00B8, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_DATA5_USDHC1_DATA5                             =  IOMUX_PAD(0x0324, 0x00BC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_DATA5_GPIO2_IO7                                =  IOMUX_PAD(0x0324, 0x00BC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_DATA6_USDHC1_DATA6                             =  IOMUX_PAD(0x0328, 0x00C0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_DATA6_GPIO2_IO8                                =  IOMUX_PAD(0x0328, 0x00C0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_DATA7_USDHC1_DATA7                             =  IOMUX_PAD(0x032C, 0x00C4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_DATA7_GPIO2_IO9                                =  IOMUX_PAD(0x032C, 0x00C4, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_RESET_B_USDHC1_RESET_B                         =  IOMUX_PAD(0x0330, 0x00C8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_RESET_B_GPIO2_IO10                             =  IOMUX_PAD(0x0330, 0x00C8, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD1_STROBE_USDHC1_STROBE                           =  IOMUX_PAD(0x0334, 0x00CC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD1_STROBE_GPIO2_IO11                              =  IOMUX_PAD(0x0334, 0x00CC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD2_CD_B_USDHC2_CD_B                               =  IOMUX_PAD(0x0338, 0x00D0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_CD_B_GPIO2_IO12                                =  IOMUX_PAD(0x0338, 0x00D0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD2_CLK_USDHC2_CLK                                 =  IOMUX_PAD(0x033C, 0x00D4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_CLK_GPIO2_IO13                                 =  IOMUX_PAD(0x033C, 0x00D4, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_CLK_CCM_OBSERVE0                               =  IOMUX_PAD(0x033C, 0x00D4, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD2_CMD_USDHC2_CMD                                 =  IOMUX_PAD(0x0340, 0x00D8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_CMD_GPIO2_IO14                                 =  IOMUX_PAD(0x0340, 0x00D8, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_CMD_CCM_OBSERVE1                               =  IOMUX_PAD(0x0340, 0x00D8, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD2_DATA0_USDHC2_DATA0                             =  IOMUX_PAD(0x0344, 0x00DC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_DATA0_GPIO2_IO15                               =  IOMUX_PAD(0x0344, 0x00DC, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_DATA0_CCM_OBSERVE2                             =  IOMUX_PAD(0x0344, 0x00DC, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD2_DATA1_USDHC2_DATA1                             =  IOMUX_PAD(0x0348, 0x00E0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_DATA1_GPIO2_IO16                               =  IOMUX_PAD(0x0348, 0x00E0, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_DATA1_CCM_WAIT                                 =  IOMUX_PAD(0x0348, 0x00E0, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD2_DATA2_USDHC2_DATA2                             =  IOMUX_PAD(0x034C, 0x00E4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_DATA2_GPIO2_IO17                               =  IOMUX_PAD(0x034C, 0x00E4, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_DATA2_CCM_STOP                                 =  IOMUX_PAD(0x034C, 0x00E4, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD2_DATA3_USDHC2_DATA3                             =  IOMUX_PAD(0x0350, 0x00E8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_DATA3_GPIO2_IO18                               =  IOMUX_PAD(0x0350, 0x00E8, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_DATA3_SRC_EARLY_RESET                          =  IOMUX_PAD(0x0350, 0x00E8, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD2_RESET_B_USDHC2_RESET_B                         =  IOMUX_PAD(0x0354, 0x00EC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_RESET_B_GPIO2_IO19                             =  IOMUX_PAD(0x0354, 0x00EC, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_RESET_B_SRC_SYSTEM_RESET                       =  IOMUX_PAD(0x0354, 0x00EC, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SD2_WP_USDHC2_WP                                   =  IOMUX_PAD(0x0358, 0x00F0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SD2_WP_GPIO2_IO20                                  =  IOMUX_PAD(0x0358, 0x00F0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_ALE_RAWNAND_ALE                               =  IOMUX_PAD(0x035C, 0x00F4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_ALE_QSPI_A_SCLK                               =  IOMUX_PAD(0x035C, 0x00F4, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_ALE_GPIO3_IO0                                 =  IOMUX_PAD(0x035C, 0x00F4, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_CE0_B_RAWNAND_CE0_B                           =  IOMUX_PAD(0x0360, 0x00F8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE0_B_QSPI_A_SS0_B                            =  IOMUX_PAD(0x0360, 0x00F8, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE0_B_GPIO3_IO1                               =  IOMUX_PAD(0x0360, 0x00F8, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_CE1_B_RAWNAND_CE1_B                           =  IOMUX_PAD(0x0364, 0x00FC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE1_B_QSPI_A_SS1_B                            =  IOMUX_PAD(0x0364, 0x00FC, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE1_B_USDHC3_STROBE                           =  IOMUX_PAD(0x0364, 0x00FC, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE1_B_GPIO3_IO2                               =  IOMUX_PAD(0x0364, 0x00FC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_CE2_B_RAWNAND_CE2_B                           =  IOMUX_PAD(0x0368, 0x0100, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE2_B_QSPI_B_SS0_B                            =  IOMUX_PAD(0x0368, 0x0100, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE2_B_USDHC3_DATA5                            =  IOMUX_PAD(0x0368, 0x0100, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE2_B_GPIO3_IO3                               =  IOMUX_PAD(0x0368, 0x0100, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_CE3_B_RAWNAND_CE3_B                           =  IOMUX_PAD(0x036C, 0x0104, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE3_B_QSPI_B_SS1_B                            =  IOMUX_PAD(0x036C, 0x0104, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE3_B_USDHC3_DATA6                            =  IOMUX_PAD(0x036C, 0x0104, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CE3_B_GPIO3_IO4                               =  IOMUX_PAD(0x036C, 0x0104, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_CLE_RAWNAND_CLE                               =  IOMUX_PAD(0x0370, 0x0108, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CLE_QSPI_B_SCLK                               =  IOMUX_PAD(0x0370, 0x0108, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CLE_USDHC3_DATA7                              =  IOMUX_PAD(0x0370, 0x0108, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_CLE_GPIO3_IO5                                 =  IOMUX_PAD(0x0370, 0x0108, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_DATA00_RAWNAND_DATA00                         =  IOMUX_PAD(0x0374, 0x010C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA00_QSPI_A_DATA0                           =  IOMUX_PAD(0x0374, 0x010C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA00_GPIO3_IO6                              =  IOMUX_PAD(0x0374, 0x010C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_DATA01_RAWNAND_DATA01                         =  IOMUX_PAD(0x0378, 0x0110, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA01_QSPI_A_DATA1                           =  IOMUX_PAD(0x0378, 0x0110, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA01_GPIO3_IO7                              =  IOMUX_PAD(0x0378, 0x0110, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_DATA02_RAWNAND_DATA02                         =  IOMUX_PAD(0x037C, 0x0114, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA02_QSPI_A_DATA2                           =  IOMUX_PAD(0x037C, 0x0114, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA02_USDHC3_CD_B                            =  IOMUX_PAD(0x037C, 0x0114, 2, 0x0544, 0, 0),
+	IMX8MM_PAD_NAND_DATA02_GPIO3_IO8                              =  IOMUX_PAD(0x037C, 0x0114, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_DATA03_RAWNAND_DATA03                         =  IOMUX_PAD(0x0380, 0x0118, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA03_QSPI_A_DATA3                           =  IOMUX_PAD(0x0380, 0x0118, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA03_USDHC3_WP                              =  IOMUX_PAD(0x0380, 0x0118, 2, 0x0548, 0, 0),
+	IMX8MM_PAD_NAND_DATA03_GPIO3_IO9                              =  IOMUX_PAD(0x0380, 0x0118, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_DATA04_RAWNAND_DATA04                         =  IOMUX_PAD(0x0384, 0x011C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA04_QSPI_B_DATA0                           =  IOMUX_PAD(0x0384, 0x011C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA04_USDHC3_DATA0                           =  IOMUX_PAD(0x0384, 0x011C, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA04_GPIO3_IO10                             =  IOMUX_PAD(0x0384, 0x011C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_DATA05_RAWNAND_DATA05                         =  IOMUX_PAD(0x0388, 0x0120, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA05_QSPI_B_DATA1                           =  IOMUX_PAD(0x0388, 0x0120, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA05_USDHC3_DATA1                           =  IOMUX_PAD(0x0388, 0x0120, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA05_GPIO3_IO11                             =  IOMUX_PAD(0x0388, 0x0120, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_DATA06_RAWNAND_DATA06                         =  IOMUX_PAD(0x038C, 0x0124, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA06_QSPI_B_DATA2                           =  IOMUX_PAD(0x038C, 0x0124, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA06_USDHC3_DATA2                           =  IOMUX_PAD(0x038C, 0x0124, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA06_GPIO3_IO12                             =  IOMUX_PAD(0x038C, 0x0124, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_DATA07_RAWNAND_DATA07                         =  IOMUX_PAD(0x0390, 0x0128, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA07_QSPI_B_DATA3                           =  IOMUX_PAD(0x0390, 0x0128, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA07_USDHC3_DATA3                           =  IOMUX_PAD(0x0390, 0x0128, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DATA07_GPIO3_IO13                             =  IOMUX_PAD(0x0390, 0x0128, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_DQS_RAWNAND_DQS                               =  IOMUX_PAD(0x0394, 0x012C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DQS_QSPI_A_DQS                                =  IOMUX_PAD(0x0394, 0x012C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_DQS_GPIO3_IO14                                =  IOMUX_PAD(0x0394, 0x012C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_RE_B_RAWNAND_RE_B                             =  IOMUX_PAD(0x0398, 0x0130, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_RE_B_QSPI_B_DQS                               =  IOMUX_PAD(0x0398, 0x0130, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_RE_B_USDHC3_DATA4                             =  IOMUX_PAD(0x0398, 0x0130, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_RE_B_GPIO3_IO15                               =  IOMUX_PAD(0x0398, 0x0130, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_READY_B_RAWNAND_READY_B                       =  IOMUX_PAD(0x039C, 0x0134, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_READY_B_USDHC3_RESET_B                        =  IOMUX_PAD(0x039C, 0x0134, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_READY_B_GPIO3_IO16                            =  IOMUX_PAD(0x039C, 0x0134, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_WE_B_RAWNAND_WE_B                             =  IOMUX_PAD(0x03A0, 0x0138, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_WE_B_USDHC3_CLK                               =  IOMUX_PAD(0x03A0, 0x0138, 2 | IOMUX_CONFIG_SION, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_WE_B_GPIO3_IO17                               =  IOMUX_PAD(0x03A0, 0x0138, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_NAND_WP_B_RAWNAND_WP_B                             =  IOMUX_PAD(0x03A4, 0x013C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_WP_B_USDHC3_CMD                               =  IOMUX_PAD(0x03A4, 0x013C, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_NAND_WP_B_GPIO3_IO18                               =  IOMUX_PAD(0x03A4, 0x013C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI5_RXFS_SAI5_RX_SYNC                             =  IOMUX_PAD(0x03A8, 0x0140, 0, 0x04E4, 0, 0),
+	IMX8MM_PAD_SAI5_RXFS_SAI1_TX_DATA0                            =  IOMUX_PAD(0x03A8, 0x0140, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI5_RXFS_GPIO3_IO19                               =  IOMUX_PAD(0x03A8, 0x0140, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI5_RXC_SAI5_RX_BCLK                              =  IOMUX_PAD(0x03AC, 0x0144, 0, 0x04D0, 0, 0),
+	IMX8MM_PAD_SAI5_RXC_SAI1_TX_DATA1                             =  IOMUX_PAD(0x03AC, 0x0144, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI5_RXC_PDM_CLK                                   =  IOMUX_PAD(0x03AC, 0x0144, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI5_RXC_GPIO3_IO20                                =  IOMUX_PAD(0x03AC, 0x0144, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI5_RXD0_SAI5_RX_DATA0                            =  IOMUX_PAD(0x03B0, 0x0148, 0, 0x04D4, 0, 0),
+	IMX8MM_PAD_SAI5_RXD0_SAI1_TX_DATA2                            =  IOMUX_PAD(0x03B0, 0x0148, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI5_RXD0_PDM_BIT_STREAM0                          =  IOMUX_PAD(0x03B0, 0x0148, 4, 0x0534, 0, 0),
+	IMX8MM_PAD_SAI5_RXD0_GPIO3_IO21                               =  IOMUX_PAD(0x03B0, 0x0148, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI5_RXD1_SAI5_RX_DATA1                            =  IOMUX_PAD(0x03B4, 0x014C, 0, 0x04D8, 0, 0),
+	IMX8MM_PAD_SAI5_RXD1_SAI1_TX_DATA3                            =  IOMUX_PAD(0x03B4, 0x014C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI5_RXD1_SAI1_TX_SYNC                             =  IOMUX_PAD(0x03B4, 0x014C, 2, 0x04CC, 0, 0),
+	IMX8MM_PAD_SAI5_RXD1_SAI5_TX_SYNC                             =  IOMUX_PAD(0x03B4, 0x014C, 3, 0x04EC, 0, 0),
+	IMX8MM_PAD_SAI5_RXD1_PDM_BIT_STREAM1                          =  IOMUX_PAD(0x03B4, 0x014C, 4, 0x0538, 0, 0),
+	IMX8MM_PAD_SAI5_RXD1_GPIO3_IO22                               =  IOMUX_PAD(0x03B4, 0x014C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI5_RXD2_SAI5_RX_DATA2                            =  IOMUX_PAD(0x03B8, 0x0150, 0, 0x04DC, 0, 0),
+	IMX8MM_PAD_SAI5_RXD2_SAI1_TX_DATA4                            =  IOMUX_PAD(0x03B8, 0x0150, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI5_RXD2_SAI1_TX_SYNC                             =  IOMUX_PAD(0x03B8, 0x0150, 2, 0x04CC, 1, 0),
+	IMX8MM_PAD_SAI5_RXD2_SAI5_TX_BCLK                             =  IOMUX_PAD(0x03B8, 0x0150, 3, 0x04E8, 0, 0),
+	IMX8MM_PAD_SAI5_RXD2_PDM_BIT_STREAM2                          =  IOMUX_PAD(0x03B8, 0x0150, 4, 0x053C, 0, 0),
+	IMX8MM_PAD_SAI5_RXD2_GPIO3_IO23                               =  IOMUX_PAD(0x03B8, 0x0150, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI5_RXD3_SAI5_RX_DATA3                            =  IOMUX_PAD(0x03BC, 0x0154, 0, 0x04E0, 0, 0),
+	IMX8MM_PAD_SAI5_RXD3_SAI1_TX_DATA5                            =  IOMUX_PAD(0x03BC, 0x0154, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI5_RXD3_SAI1_TX_SYNC                             =  IOMUX_PAD(0x03BC, 0x0154, 2, 0x04CC, 2, 0),
+	IMX8MM_PAD_SAI5_RXD3_SAI5_TX_DATA0                            =  IOMUX_PAD(0x03BC, 0x0154, 3, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI5_RXD3_PDM_BIT_STREAM3                          =  IOMUX_PAD(0x03BC, 0x0154, 4, 0x0540, 0, 0),
+	IMX8MM_PAD_SAI5_RXD3_GPIO3_IO24                               =  IOMUX_PAD(0x03BC, 0x0154, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI5_MCLK_SAI5_MCLK                                =  IOMUX_PAD(0x03C0, 0x0158, 0, 0x052C, 0, 0),
+	IMX8MM_PAD_SAI5_MCLK_SAI1_TX_BCLK                             =  IOMUX_PAD(0x03C0, 0x0158, 1, 0x04C8, 0, 0),
+	IMX8MM_PAD_SAI5_MCLK_GPIO3_IO25                               =  IOMUX_PAD(0x03C0, 0x0158, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI5_MCLK_SRC_TESTER_ACK                           =  IOMUX_PAD(0x03C0, 0x0158, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXFS_SAI1_RX_SYNC                             =  IOMUX_PAD(0x03C4, 0x015C, 0, 0x04C4, 0, 0),
+	IMX8MM_PAD_SAI1_RXFS_SAI5_RX_SYNC                             =  IOMUX_PAD(0x03C4, 0x015C, 1, 0x04E4, 1, 0),
+	IMX8MM_PAD_SAI1_RXFS_ARM_PLATFORM_TRACE_CLK                   =  IOMUX_PAD(0x03C4, 0x015C, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXFS_GPIO4_IO0                                =  IOMUX_PAD(0x03C4, 0x015C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXC_SAI1_RX_BCLK                              =  IOMUX_PAD(0x03C8, 0x0160, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXC_SAI5_RX_BCLK                              =  IOMUX_PAD(0x03C8, 0x0160, 1, 0x04D0, 1, 0),
+	IMX8MM_PAD_SAI1_RXC_ARM_PLATFORM_TRACE_CTL                    =  IOMUX_PAD(0x03C8, 0x0160, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXC_GPIO4_IO1                                 =  IOMUX_PAD(0x03C8, 0x0160, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXD0_SAI1_RX_DATA0                            =  IOMUX_PAD(0x03CC, 0x0164, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD0_SAI5_RX_DATA0                            =  IOMUX_PAD(0x03CC, 0x0164, 1, 0x04D4, 1, 0),
+	IMX8MM_PAD_SAI1_RXD0_SAI1_TX_DATA1                            =  IOMUX_PAD(0x03CC, 0x0164, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD0_PDM_BIT_STREAM0                          =  IOMUX_PAD(0x03CC, 0x0164, 3, 0x0534, 1, 0),
+	IMX8MM_PAD_SAI1_RXD0_ARM_PLATFORM_TRACE0                      =  IOMUX_PAD(0x03CC, 0x0164, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD0_GPIO4_IO2                                =  IOMUX_PAD(0x03CC, 0x0164, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD0_SRC_BOOT_CFG0                            =  IOMUX_PAD(0x03CC, 0x0164, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXD1_SAI1_RX_DATA1                            =  IOMUX_PAD(0x03D0, 0x0168, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD1_SAI5_RX_DATA1                            =  IOMUX_PAD(0x03D0, 0x0168, 1, 0x04D8, 1, 0),
+	IMX8MM_PAD_SAI1_RXD1_PDM_BIT_STREAM1                          =  IOMUX_PAD(0x03D0, 0x0168, 3, 0x0538, 1, 0),
+	IMX8MM_PAD_SAI1_RXD1_ARM_PLATFORM_TRACE1                      =  IOMUX_PAD(0x03D0, 0x0168, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD1_GPIO4_IO3                                =  IOMUX_PAD(0x03D0, 0x0168, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD1_SRC_BOOT_CFG1                            =  IOMUX_PAD(0x03D0, 0x0168, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXD2_SAI1_RX_DATA2                            =  IOMUX_PAD(0x03D4, 0x016C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD2_SAI5_RX_DATA2                            =  IOMUX_PAD(0x03D4, 0x016C, 1, 0x04DC, 1, 0),
+	IMX8MM_PAD_SAI1_RXD2_PDM_BIT_STREAM2                          =  IOMUX_PAD(0x03D4, 0x016C, 3, 0x053C, 1, 0),
+	IMX8MM_PAD_SAI1_RXD2_ARM_PLATFORM_TRACE2                      =  IOMUX_PAD(0x03D4, 0x016C, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD2_GPIO4_IO4                                =  IOMUX_PAD(0x03D4, 0x016C, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD2_SRC_BOOT_CFG2                            =  IOMUX_PAD(0x03D4, 0x016C, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXD3_SAI1_RX_DATA3                            =  IOMUX_PAD(0x03D8, 0x0170, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD3_SAI5_RX_DATA3                            =  IOMUX_PAD(0x03D8, 0x0170, 1, 0x04E0, 1, 0),
+	IMX8MM_PAD_SAI1_RXD3_PDM_BIT_STREAM3                          =  IOMUX_PAD(0x03D8, 0x0170, 3, 0x0540, 1, 0),
+	IMX8MM_PAD_SAI1_RXD3_ARM_PLATFORM_TRACE3                      =  IOMUX_PAD(0x03D8, 0x0170, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD3_GPIO4_IO5                                =  IOMUX_PAD(0x03D8, 0x0170, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD3_SRC_BOOT_CFG3                            =  IOMUX_PAD(0x03D8, 0x0170, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXD4_SAI1_RX_DATA4                            =  IOMUX_PAD(0x03DC, 0x0174, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD4_SAI6_TX_BCLK                             =  IOMUX_PAD(0x03DC, 0x0174, 1, 0x051C, 0, 0),
+	IMX8MM_PAD_SAI1_RXD4_SAI6_RX_BCLK                             =  IOMUX_PAD(0x03DC, 0x0174, 2, 0x0510, 0, 0),
+	IMX8MM_PAD_SAI1_RXD4_ARM_PLATFORM_TRACE4                      =  IOMUX_PAD(0x03DC, 0x0174, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD4_GPIO4_IO6                                =  IOMUX_PAD(0x03DC, 0x0174, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD4_SRC_BOOT_CFG4                            =  IOMUX_PAD(0x03DC, 0x0174, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXD5_SAI1_RX_DATA5                            =  IOMUX_PAD(0x03E0, 0x0178, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD5_SAI6_TX_DATA0                            =  IOMUX_PAD(0x03E0, 0x0178, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD5_SAI6_RX_DATA0                            =  IOMUX_PAD(0x03E0, 0x0178, 2, 0x0514, 0, 0),
+	IMX8MM_PAD_SAI1_RXD5_SAI1_RX_SYNC                             =  IOMUX_PAD(0x03E0, 0x0178, 3, 0x04C4, 1, 0),
+	IMX8MM_PAD_SAI1_RXD5_ARM_PLATFORM_TRACE5                      =  IOMUX_PAD(0x03E0, 0x0178, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD5_GPIO4_IO7                                =  IOMUX_PAD(0x03E0, 0x0178, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD5_SRC_BOOT_CFG5                            =  IOMUX_PAD(0x03E0, 0x0178, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXD6_SAI1_RX_DATA6                            =  IOMUX_PAD(0x03E4, 0x017C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD6_SAI6_TX_SYNC                             =  IOMUX_PAD(0x03E4, 0x017C, 1, 0x0520, 0, 0),
+	IMX8MM_PAD_SAI1_RXD6_SAI6_RX_SYNC                             =  IOMUX_PAD(0x03E4, 0x017C, 2, 0x0518, 0, 0),
+	IMX8MM_PAD_SAI1_RXD6_ARM_PLATFORM_TRACE6                      =  IOMUX_PAD(0x03E4, 0x017C, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD6_GPIO4_IO8                                =  IOMUX_PAD(0x03E4, 0x017C, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD6_SRC_BOOT_CFG6                            =  IOMUX_PAD(0x03E4, 0x017C, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_RXD7_SAI1_RX_DATA7                            =  IOMUX_PAD(0x03E8, 0x0180, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD7_SAI6_MCLK                                =  IOMUX_PAD(0x03E8, 0x0180, 1, 0x0530, 0, 0),
+	IMX8MM_PAD_SAI1_RXD7_SAI1_TX_SYNC                             =  IOMUX_PAD(0x03E8, 0x0180, 2, 0x04CC, 4, 0),
+	IMX8MM_PAD_SAI1_RXD7_SAI1_TX_DATA4                            =  IOMUX_PAD(0x03E8, 0x0180, 3, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD7_ARM_PLATFORM_TRACE7                      =  IOMUX_PAD(0x03E8, 0x0180, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD7_GPIO4_IO9                                =  IOMUX_PAD(0x03E8, 0x0180, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_RXD7_SRC_BOOT_CFG7                            =  IOMUX_PAD(0x03E8, 0x0180, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXFS_SAI1_TX_SYNC                             =  IOMUX_PAD(0x03EC, 0x0184, 0, 0x04CC, 3, 0),
+	IMX8MM_PAD_SAI1_TXFS_SAI5_TX_SYNC                             =  IOMUX_PAD(0x03EC, 0x0184, 1, 0x04EC, 1, 0),
+	IMX8MM_PAD_SAI1_TXFS_ARM_PLATFORM_EVENTO                      =  IOMUX_PAD(0x03EC, 0x0184, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXFS_GPIO4_IO10                               =  IOMUX_PAD(0x03EC, 0x0184, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXC_SAI1_TX_BCLK                              =  IOMUX_PAD(0x03F0, 0x0188, 0, 0x04C8, 1, 0),
+	IMX8MM_PAD_SAI1_TXC_SAI5_TX_BCLK                              =  IOMUX_PAD(0x03F0, 0x0188, 1, 0x04E8, 1, 0),
+	IMX8MM_PAD_SAI1_TXC_ARM_PLATFORM_EVENTI                       =  IOMUX_PAD(0x03F0, 0x0188, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXC_GPIO4_IO11                                =  IOMUX_PAD(0x03F0, 0x0188, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXD0_SAI1_TX_DATA0                            =  IOMUX_PAD(0x03F4, 0x018C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD0_SAI5_TX_DATA0                            =  IOMUX_PAD(0x03F4, 0x018C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD0_ARM_PLATFORM_TRACE8                      =  IOMUX_PAD(0x03F4, 0x018C, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD0_GPIO4_IO12                               =  IOMUX_PAD(0x03F4, 0x018C, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD0_SRC_BOOT_CFG8                            =  IOMUX_PAD(0x03F4, 0x018C, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXD1_SAI1_TX_DATA1                            =  IOMUX_PAD(0x03F8, 0x0190, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD1_SAI5_TX_DATA1                            =  IOMUX_PAD(0x03F8, 0x0190, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD1_ARM_PLATFORM_TRACE9                      =  IOMUX_PAD(0x03F8, 0x0190, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD1_GPIO4_IO13                               =  IOMUX_PAD(0x03F8, 0x0190, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD1_SRC_BOOT_CFG9                            =  IOMUX_PAD(0x03F8, 0x0190, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXD2_SAI1_TX_DATA2                            =  IOMUX_PAD(0x03FC, 0x0194, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD2_SAI5_TX_DATA2                            =  IOMUX_PAD(0x03FC, 0x0194, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD2_ARM_PLATFORM_TRACE10                     =  IOMUX_PAD(0x03FC, 0x0194, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD2_GPIO4_IO14                               =  IOMUX_PAD(0x03FC, 0x0194, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD2_SRC_BOOT_CFG10                           =  IOMUX_PAD(0x03FC, 0x0194, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXD3_SAI1_TX_DATA3                            =  IOMUX_PAD(0x0400, 0x0198, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD3_SAI5_TX_DATA3                            =  IOMUX_PAD(0x0400, 0x0198, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD3_ARM_PLATFORM_TRACE11                     =  IOMUX_PAD(0x0400, 0x0198, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD3_GPIO4_IO15                               =  IOMUX_PAD(0x0400, 0x0198, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD3_SRC_BOOT_CFG11                           =  IOMUX_PAD(0x0400, 0x0198, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXD4_SAI1_TX_DATA4                            =  IOMUX_PAD(0x0404, 0x019C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD4_SAI6_RX_BCLK                             =  IOMUX_PAD(0x0404, 0x019C, 1, 0x0510, 1, 0),
+	IMX8MM_PAD_SAI1_TXD4_SAI6_TX_BCLK                             =  IOMUX_PAD(0x0404, 0x019C, 2, 0x051C, 1, 0),
+	IMX8MM_PAD_SAI1_TXD4_ARM_PLATFORM_TRACE12                     =  IOMUX_PAD(0x0404, 0x019C, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD4_GPIO4_IO16                               =  IOMUX_PAD(0x0404, 0x019C, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD4_SRC_BOOT_CFG12                           =  IOMUX_PAD(0x0404, 0x019C, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXD5_SAI1_TX_DATA5                            =  IOMUX_PAD(0x0408, 0x01A0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD5_SAI6_RX_DATA0                            =  IOMUX_PAD(0x0408, 0x01A0, 1, 0x0514, 1, 0),
+	IMX8MM_PAD_SAI1_TXD5_SAI6_TX_DATA0                            =  IOMUX_PAD(0x0408, 0x01A0, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD5_ARM_PLATFORM_TRACE13                     =  IOMUX_PAD(0x0408, 0x01A0, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD5_GPIO4_IO17                               =  IOMUX_PAD(0x0408, 0x01A0, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD5_SRC_BOOT_CFG13                           =  IOMUX_PAD(0x0408, 0x01A0, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXD6_SAI1_TX_DATA6                            =  IOMUX_PAD(0x040C, 0x01A4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD6_SAI6_RX_SYNC                             =  IOMUX_PAD(0x040C, 0x01A4, 1, 0x0518, 1, 0),
+	IMX8MM_PAD_SAI1_TXD6_SAI6_TX_SYNC                             =  IOMUX_PAD(0x040C, 0x01A4, 2, 0x0520, 1, 0),
+	IMX8MM_PAD_SAI1_TXD6_ARM_PLATFORM_TRACE14                     =  IOMUX_PAD(0x040C, 0x01A4, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD6_GPIO4_IO18                               =  IOMUX_PAD(0x040C, 0x01A4, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD6_SRC_BOOT_CFG14                           =  IOMUX_PAD(0x040C, 0x01A4, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_TXD7_SAI1_TX_DATA7                            =  IOMUX_PAD(0x0410, 0x01A8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD7_SAI6_MCLK                                =  IOMUX_PAD(0x0410, 0x01A8, 1, 0x0530, 1, 0),
+	IMX8MM_PAD_SAI1_TXD7_PDM_CLK                                  =  IOMUX_PAD(0x0410, 0x01A8, 3, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD7_ARM_PLATFORM_TRACE15                     =  IOMUX_PAD(0x0410, 0x01A8, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD7_GPIO4_IO19                               =  IOMUX_PAD(0x0410, 0x01A8, 5, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_TXD7_SRC_BOOT_CFG15                           =  IOMUX_PAD(0x0410, 0x01A8, 6, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI1_MCLK_SAI1_MCLK                                =  IOMUX_PAD(0x0414, 0x01AC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_MCLK_SAI5_MCLK                                =  IOMUX_PAD(0x0414, 0x01AC, 1, 0x052C, 1, 0),
+	IMX8MM_PAD_SAI1_MCLK_SAI1_TX_BCLK                             =  IOMUX_PAD(0x0414, 0x01AC, 2, 0x04C8, 2, 0),
+	IMX8MM_PAD_SAI1_MCLK_PDM_CLK                                  =  IOMUX_PAD(0x0414, 0x01AC, 3, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI1_MCLK_GPIO4_IO20                               =  IOMUX_PAD(0x0414, 0x01AC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI2_RXFS_SAI2_RX_SYNC                             =  IOMUX_PAD(0x0418, 0x01B0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_RXFS_SAI5_TX_SYNC                             =  IOMUX_PAD(0x0418, 0x01B0, 1, 0x04EC, 2, 0),
+	IMX8MM_PAD_SAI2_RXFS_SAI5_TX_DATA1                            =  IOMUX_PAD(0x0418, 0x01B0, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_RXFS_SAI2_RX_DATA1                            =  IOMUX_PAD(0x0418, 0x01B0, 3, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_RXFS_UART1_TX                                 =  IOMUX_PAD(0x0418, 0x01B0, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_RXFS_UART1_RX                                 =  IOMUX_PAD(0x0418, 0x01B0, 4, 0x04F4, 2, 0),
+	IMX8MM_PAD_SAI2_RXFS_GPIO4_IO21                               =  IOMUX_PAD(0x0418, 0x01B0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI2_RXC_SAI2_RX_BCLK                              =  IOMUX_PAD(0x041C, 0x01B4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_RXC_SAI5_TX_BCLK                              =  IOMUX_PAD(0x041C, 0x01B4, 1, 0x04E8, 2, 0),
+	IMX8MM_PAD_SAI2_RXC_UART1_RX                                  =  IOMUX_PAD(0x041C, 0x01B4, 4, 0x04F4, 3, 0),
+	IMX8MM_PAD_SAI2_RXC_UART1_TX                                  =  IOMUX_PAD(0x041C, 0x01B4, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_RXC_GPIO4_IO22                                =  IOMUX_PAD(0x041C, 0x01B4, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI2_RXD0_SAI2_RX_DATA0                            =  IOMUX_PAD(0x0420, 0x01B8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_RXD0_SAI5_TX_DATA0                            =  IOMUX_PAD(0x0420, 0x01B8, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_RXD0_UART1_RTS_B                              =  IOMUX_PAD(0x0420, 0x01B8, 4, 0x04F0, 2, 0),
+	IMX8MM_PAD_SAI2_RXD0_UART1_CTS_B                              =  IOMUX_PAD(0x0420, 0x01B8, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_RXD0_GPIO4_IO23                               =  IOMUX_PAD(0x0420, 0x01B8, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI2_TXFS_SAI2_TX_SYNC                             =  IOMUX_PAD(0x0424, 0x01BC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_TXFS_SAI5_TX_DATA1                            =  IOMUX_PAD(0x0424, 0x01BC, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_TXFS_SAI2_TX_DATA1                            =  IOMUX_PAD(0x0424, 0x01BC, 3, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_TXFS_UART1_CTS_B                              =  IOMUX_PAD(0x0424, 0x01BC, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_TXFS_UART1_RTS_B                              =  IOMUX_PAD(0x0424, 0x01BC, 4, 0x04F0, 3, 0),
+	IMX8MM_PAD_SAI2_TXFS_GPIO4_IO24                               =  IOMUX_PAD(0x0424, 0x01BC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI2_TXC_SAI2_TX_BCLK                              =  IOMUX_PAD(0x0428, 0x01C0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_TXC_SAI5_TX_DATA2                             =  IOMUX_PAD(0x0428, 0x01C0, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_TXC_GPIO4_IO25                                =  IOMUX_PAD(0x0428, 0x01C0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI2_TXD0_SAI2_TX_DATA0                            =  IOMUX_PAD(0x042C, 0x01C4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_TXD0_SAI5_TX_DATA3                            =  IOMUX_PAD(0x042C, 0x01C4, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_TXD0_GPIO4_IO26                               =  IOMUX_PAD(0x042C, 0x01C4, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI2_MCLK_SAI2_MCLK                                =  IOMUX_PAD(0x0430, 0x01C8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI2_MCLK_SAI5_MCLK                                =  IOMUX_PAD(0x0430, 0x01C8, 1, 0x052C, 2, 0),
+	IMX8MM_PAD_SAI2_MCLK_GPIO4_IO27                               =  IOMUX_PAD(0x0430, 0x01C8, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI3_RXFS_SAI3_RX_SYNC                             =  IOMUX_PAD(0x0434, 0x01CC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_RXFS_GPT1_CAPTURE1                            =  IOMUX_PAD(0x0434, 0x01CC, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_RXFS_SAI5_RX_SYNC                             =  IOMUX_PAD(0x0434, 0x01CC, 2, 0x04E4, 2, 0),
+	IMX8MM_PAD_SAI3_RXFS_SAI3_RX_DATA1                            =  IOMUX_PAD(0x0434, 0x01CC, 3, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_RXFS_GPIO4_IO28                               =  IOMUX_PAD(0x0434, 0x01CC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI3_RXC_SAI3_RX_BCLK                              =  IOMUX_PAD(0x0438, 0x01D0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_RXC_GPT1_CLK                                  =  IOMUX_PAD(0x0438, 0x01D0, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_RXC_SAI5_RX_BCLK                              =  IOMUX_PAD(0x0438, 0x01D0, 2, 0x04D0, 2, 0),
+	IMX8MM_PAD_SAI3_RXC_UART2_CTS_B                               =  IOMUX_PAD(0x0438, 0x01D0, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_RXC_UART2_RTS_B                               =  IOMUX_PAD(0x0438, 0x01D0, 4, 0x04F8, 2, 0),
+	IMX8MM_PAD_SAI3_RXC_GPIO4_IO29                                =  IOMUX_PAD(0x0438, 0x01D0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI3_RXD_SAI3_RX_DATA0                             =  IOMUX_PAD(0x043C, 0x01D4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_RXD_GPT1_COMPARE1                             =  IOMUX_PAD(0x043C, 0x01D4, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_RXD_SAI5_RX_DATA0                             =  IOMUX_PAD(0x043C, 0x01D4, 2, 0x04D4, 2, 0),
+	IMX8MM_PAD_SAI3_RXD_UART2_RTS_B                               =  IOMUX_PAD(0x043C, 0x01D4, 4, 0x04F8, 3, 0),
+	IMX8MM_PAD_SAI3_RXD_UART2_CTS_B                               =  IOMUX_PAD(0x043C, 0x01D4, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_RXD_GPIO4_IO30                                =  IOMUX_PAD(0x043C, 0x01D4, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI3_TXFS_SAI3_TX_SYNC                             =  IOMUX_PAD(0x0440, 0x01D8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_TXFS_GPT1_CAPTURE2                            =  IOMUX_PAD(0x0440, 0x01D8, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_TXFS_SAI5_RX_DATA1                            =  IOMUX_PAD(0x0440, 0x01D8, 2, 0x04D8, 2, 0),
+	IMX8MM_PAD_SAI3_TXFS_SAI3_TX_DATA1                            =  IOMUX_PAD(0x0440, 0x01D8, 3, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_TXFS_UART2_RX                                 =  IOMUX_PAD(0x0440, 0x01D8, 4, 0x04FC, 2, 0),
+	IMX8MM_PAD_SAI3_TXFS_UART2_TX                                 =  IOMUX_PAD(0x0440, 0x01D8, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_TXFS_GPIO4_IO31                               =  IOMUX_PAD(0x0440, 0x01D8, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI3_TXC_SAI3_TX_BCLK                              =  IOMUX_PAD(0x0444, 0x01DC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_TXC_GPT1_COMPARE2                             =  IOMUX_PAD(0x0444, 0x01DC, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_TXC_SAI5_RX_DATA2                             =  IOMUX_PAD(0x0444, 0x01DC, 2, 0x04DC, 2, 0),
+	IMX8MM_PAD_SAI3_TXC_UART2_TX                                  =  IOMUX_PAD(0x0444, 0x01DC, 4, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_TXC_UART2_RX                                  =  IOMUX_PAD(0x0444, 0x01DC, 4, 0x04FC, 3, 0),
+	IMX8MM_PAD_SAI3_TXC_GPIO5_IO0                                 =  IOMUX_PAD(0x0444, 0x01DC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI3_TXD_SAI3_TX_DATA0                             =  IOMUX_PAD(0x0448, 0x01E0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_TXD_GPT1_COMPARE3                             =  IOMUX_PAD(0x0448, 0x01E0, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_TXD_SAI5_RX_DATA3                             =  IOMUX_PAD(0x0448, 0x01E0, 2, 0x04E0, 2, 0),
+	IMX8MM_PAD_SAI3_TXD_GPIO5_IO1                                 =  IOMUX_PAD(0x0448, 0x01E0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SAI3_MCLK_SAI3_MCLK                                =  IOMUX_PAD(0x044C, 0x01E4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_MCLK_PWM4_OUT                                 =  IOMUX_PAD(0x044C, 0x01E4, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SAI3_MCLK_SAI5_MCLK                                =  IOMUX_PAD(0x044C, 0x01E4, 2, 0x052C, 3, 0),
+	IMX8MM_PAD_SAI3_MCLK_GPIO5_IO2                                =  IOMUX_PAD(0x044C, 0x01E4, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SPDIF_TX_SPDIF1_OUT                                =  IOMUX_PAD(0x0450, 0x01E8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SPDIF_TX_PWM3_OUT                                  =  IOMUX_PAD(0x0450, 0x01E8, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SPDIF_TX_GPIO5_IO3                                 =  IOMUX_PAD(0x0450, 0x01E8, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SPDIF_RX_SPDIF1_IN                                 =  IOMUX_PAD(0x0454, 0x01EC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SPDIF_RX_PWM2_OUT                                  =  IOMUX_PAD(0x0454, 0x01EC, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SPDIF_RX_GPIO5_IO4                                 =  IOMUX_PAD(0x0454, 0x01EC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_SPDIF_EXT_CLK_SPDIF1_EXT_CLK                       =  IOMUX_PAD(0x0458, 0x01F0, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_SPDIF_EXT_CLK_PWM1_OUT                             =  IOMUX_PAD(0x0458, 0x01F0, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_SPDIF_EXT_CLK_GPIO5_IO5                            =  IOMUX_PAD(0x0458, 0x01F0, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ECSPI1_SCLK_ECSPI1_SCLK                            =  IOMUX_PAD(0x045C, 0x01F4, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI1_SCLK_UART3_RX                               =  IOMUX_PAD(0x045C, 0x01F4, 1, 0x0504, 0, 0),
+	IMX8MM_PAD_ECSPI1_SCLK_UART3_TX                               =  IOMUX_PAD(0x045C, 0x01F4, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI1_SCLK_GPIO5_IO6                              =  IOMUX_PAD(0x045C, 0x01F4, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ECSPI1_MOSI_ECSPI1_MOSI                            =  IOMUX_PAD(0x0460, 0x01F8, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI1_MOSI_UART3_TX                               =  IOMUX_PAD(0x0460, 0x01F8, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI1_MOSI_UART3_RX                               =  IOMUX_PAD(0x0460, 0x01F8, 1, 0x0504, 1, 0),
+	IMX8MM_PAD_ECSPI1_MOSI_GPIO5_IO7                              =  IOMUX_PAD(0x0460, 0x01F8, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ECSPI1_MISO_ECSPI1_MISO                            =  IOMUX_PAD(0x0464, 0x01FC, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI1_MISO_UART3_CTS_B                            =  IOMUX_PAD(0x0464, 0x01FC, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI1_MISO_UART3_RTS_B                            =  IOMUX_PAD(0x0464, 0x01FC, 1, 0x0500, 0, 0),
+	IMX8MM_PAD_ECSPI1_MISO_GPIO5_IO8                              =  IOMUX_PAD(0x0464, 0x01FC, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ECSPI1_SS0_ECSPI1_SS0                              =  IOMUX_PAD(0x0468, 0x0200, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI1_SS0_UART3_RTS_B                             =  IOMUX_PAD(0x0468, 0x0200, 1, 0x0500, 1, 0),
+	IMX8MM_PAD_ECSPI1_SS0_UART3_CTS_B                             =  IOMUX_PAD(0x0468, 0x0200, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI1_SS0_GPIO5_IO9                               =  IOMUX_PAD(0x0468, 0x0200, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ECSPI2_SCLK_ECSPI2_SCLK                            =  IOMUX_PAD(0x046C, 0x0204, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI2_SCLK_UART4_RX                               =  IOMUX_PAD(0x046C, 0x0204, 1, 0x050C, 0, 0),
+	IMX8MM_PAD_ECSPI2_SCLK_UART4_TX                               =  IOMUX_PAD(0x046C, 0x0204, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI2_SCLK_GPIO5_IO10                             =  IOMUX_PAD(0x046C, 0x0204, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ECSPI2_MOSI_ECSPI2_MOSI                            =  IOMUX_PAD(0x0470, 0x0208, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI2_MOSI_UART4_TX                               =  IOMUX_PAD(0x0470, 0x0208, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI2_MOSI_UART4_RX                               =  IOMUX_PAD(0x0470, 0x0208, 1, 0x050C, 1, 0),
+	IMX8MM_PAD_ECSPI2_MOSI_GPIO5_IO11                             =  IOMUX_PAD(0x0470, 0x0208, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ECSPI2_MISO_ECSPI2_MISO                            =  IOMUX_PAD(0x0474, 0x020C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI2_MISO_UART4_CTS_B                            =  IOMUX_PAD(0x0474, 0x020C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI2_MISO_UART4_RTS_B                            =  IOMUX_PAD(0x0474, 0x020C, 1, 0x0508, 0, 0),
+	IMX8MM_PAD_ECSPI2_MISO_GPIO5_IO12                             =  IOMUX_PAD(0x0474, 0x020C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_ECSPI2_SS0_ECSPI2_SS0                              =  IOMUX_PAD(0x0478, 0x0210, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI2_SS0_UART4_RTS_B                             =  IOMUX_PAD(0x0478, 0x0210, 1, 0x0508, 1, 0),
+	IMX8MM_PAD_ECSPI2_SS0_UART4_CTS_B                             =  IOMUX_PAD(0x0478, 0x0210, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_ECSPI2_SS0_GPIO5_IO13                              =  IOMUX_PAD(0x0478, 0x0210, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_I2C1_SCL_I2C1_SCL                                  =  IOMUX_PAD(0x047C, 0x0214, 0 | IOMUX_CONFIG_SION, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C1_SCL_ENET1_MDC                                 =  IOMUX_PAD(0x047C, 0x0214, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C1_SCL_GPIO5_IO14                                =  IOMUX_PAD(0x047C, 0x0214, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_I2C1_SDA_I2C1_SDA                                  =  IOMUX_PAD(0x0480, 0x0218, 0 | IOMUX_CONFIG_SION, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C1_SDA_ENET1_MDIO                                =  IOMUX_PAD(0x0480, 0x0218, 1, 0x04C0, 2, 0),
+	IMX8MM_PAD_I2C1_SDA_GPIO5_IO15                                =  IOMUX_PAD(0x0480, 0x0218, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_I2C2_SCL_I2C2_SCL                                  =  IOMUX_PAD(0x0484, 0x021C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C2_SCL_ENET1_1588_EVENT1_IN                      =  IOMUX_PAD(0x0484, 0x021C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C2_SCL_USDHC3_CD_B                               =  IOMUX_PAD(0x0484, 0x021C, 2, 0x0544, 1, 0),
+	IMX8MM_PAD_I2C2_SCL_GPIO5_IO16                                =  IOMUX_PAD(0x0484, 0x021C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_I2C2_SDA_I2C2_SDA                                  =  IOMUX_PAD(0x0488, 0x0220, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C2_SDA_ENET1_1588_EVENT1_OUT                     =  IOMUX_PAD(0x0488, 0x0220, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C2_SDA_USDHC3_WP                                 =  IOMUX_PAD(0x0488, 0x0220, 2, 0x0548, 1, 0),
+	IMX8MM_PAD_I2C2_SDA_GPIO5_IO17                                =  IOMUX_PAD(0x0488, 0x0220, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_I2C3_SCL_I2C3_SCL                                  =  IOMUX_PAD(0x048C, 0x0224, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C3_SCL_PWM4_OUT                                  =  IOMUX_PAD(0x048C, 0x0224, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C3_SCL_GPT2_CLK                                  =  IOMUX_PAD(0x048C, 0x0224, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C3_SCL_GPIO5_IO18                                =  IOMUX_PAD(0x048C, 0x0224, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_I2C3_SDA_I2C3_SDA                                  =  IOMUX_PAD(0x0490, 0x0228, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C3_SDA_PWM3_OUT                                  =  IOMUX_PAD(0x0490, 0x0228, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C3_SDA_GPT3_CLK                                  =  IOMUX_PAD(0x0490, 0x0228, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C3_SDA_GPIO5_IO19                                =  IOMUX_PAD(0x0490, 0x0228, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_I2C4_SCL_I2C4_SCL                                  =  IOMUX_PAD(0x0494, 0x022C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C4_SCL_PWM2_OUT                                  =  IOMUX_PAD(0x0494, 0x022C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C4_SCL_PCIE1_CLKREQ_B                            =  IOMUX_PAD(0x0494, 0x022C, 2, 0x0524, 0, 0),
+	IMX8MM_PAD_I2C4_SCL_GPIO5_IO20                                =  IOMUX_PAD(0x0494, 0x022C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_I2C4_SDA_I2C4_SDA                                  =  IOMUX_PAD(0x0498, 0x0230, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C4_SDA_PWM1_OUT                                  =  IOMUX_PAD(0x0498, 0x0230, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_I2C4_SDA_GPIO5_IO21                                =  IOMUX_PAD(0x0498, 0x0230, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_UART1_RXD_UART1_RX                                 =  IOMUX_PAD(0x049C, 0x0234, 0, 0x04F4, 0, 0),
+	IMX8MM_PAD_UART1_RXD_UART1_TX                                 =  IOMUX_PAD(0x049C, 0x0234, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_UART1_RXD_ECSPI3_SCLK                              =  IOMUX_PAD(0x049C, 0x0234, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_UART1_RXD_GPIO5_IO22                               =  IOMUX_PAD(0x049C, 0x0234, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_UART1_TXD_UART1_TX                                 =  IOMUX_PAD(0x04A0, 0x0238, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_UART1_TXD_UART1_RX                                 =  IOMUX_PAD(0x04A0, 0x0238, 0, 0x04F4, 1, 0),
+	IMX8MM_PAD_UART1_TXD_ECSPI3_MOSI                              =  IOMUX_PAD(0x04A0, 0x0238, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_UART1_TXD_GPIO5_IO23                               =  IOMUX_PAD(0x04A0, 0x0238, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_UART2_RXD_UART2_RX                                 =  IOMUX_PAD(0x04A4, 0x023C, 0, 0x04FC, 0, 0),
+	IMX8MM_PAD_UART2_RXD_UART2_TX                                 =  IOMUX_PAD(0x04A4, 0x023C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_UART2_RXD_ECSPI3_MISO                              =  IOMUX_PAD(0x04A4, 0x023C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_UART2_RXD_GPIO5_IO24                               =  IOMUX_PAD(0x04A4, 0x023C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_UART2_TXD_UART2_TX                                 =  IOMUX_PAD(0x04A8, 0x0240, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_UART2_TXD_UART2_RX                                 =  IOMUX_PAD(0x04A8, 0x0240, 0, 0x04FC, 1, 0),
+	IMX8MM_PAD_UART2_TXD_ECSPI3_SS0                               =  IOMUX_PAD(0x04A8, 0x0240, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_UART2_TXD_GPIO5_IO25                               =  IOMUX_PAD(0x04A8, 0x0240, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_UART3_RXD_UART3_RX                                 =  IOMUX_PAD(0x04AC, 0x0244, 0, 0x0504, 2, 0),
+	IMX8MM_PAD_UART3_RXD_UART3_TX                                 =  IOMUX_PAD(0x04AC, 0x0244, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_UART3_RXD_UART1_CTS_B                              =  IOMUX_PAD(0x04AC, 0x0244, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_UART3_RXD_UART1_RTS_B                              =  IOMUX_PAD(0x04AC, 0x0244, 1, 0x04F0, 0, 0),
+	IMX8MM_PAD_UART3_RXD_USDHC3_RESET_B                           =  IOMUX_PAD(0x04AC, 0x0244, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_UART3_RXD_GPIO5_IO26                               =  IOMUX_PAD(0x04AC, 0x0244, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_UART3_TXD_UART3_TX                                 =  IOMUX_PAD(0x04B0, 0x0248, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_UART3_TXD_UART3_RX                                 =  IOMUX_PAD(0x04B0, 0x0248, 0, 0x0504, 3, 0),
+	IMX8MM_PAD_UART3_TXD_UART1_RTS_B                              =  IOMUX_PAD(0x04B0, 0x0248, 1, 0x04F0, 1, 0),
+	IMX8MM_PAD_UART3_TXD_UART1_CTS_B                              =  IOMUX_PAD(0x04B0, 0x0248, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_UART3_TXD_USDHC3_VSELECT                           =  IOMUX_PAD(0x04B0, 0x0248, 2, 0x0000, 0, 0),
+	IMX8MM_PAD_UART3_TXD_GPIO5_IO27                               =  IOMUX_PAD(0x04B0, 0x0248, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_UART4_RXD_UART4_RX                                 =  IOMUX_PAD(0x04B4, 0x024C, 0, 0x050C, 2, 0),
+	IMX8MM_PAD_UART4_RXD_UART4_TX                                 =  IOMUX_PAD(0x04B4, 0x024C, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_UART4_RXD_UART2_CTS_B                              =  IOMUX_PAD(0x04B4, 0x024C, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_UART4_RXD_UART2_RTS_B                              =  IOMUX_PAD(0x04B4, 0x024C, 1, 0x04F8, 0, 0),
+	IMX8MM_PAD_UART4_RXD_PCIE1_CLKREQ_B                           =  IOMUX_PAD(0x04B4, 0x024C, 2, 0x0524, 1, 0),
+	IMX8MM_PAD_UART4_RXD_GPIO5_IO28                               =  IOMUX_PAD(0x04B4, 0x024C, 5, 0x0000, 0, 0),
+
+	IMX8MM_PAD_UART4_TXD_UART4_TX                                 =  IOMUX_PAD(0x04B8, 0x0250, 0, 0x0000, 0, 0),
+	IMX8MM_PAD_UART4_TXD_UART4_RX                                 =  IOMUX_PAD(0x04B8, 0x0250, 0, 0x050C, 3, 0),
+	IMX8MM_PAD_UART4_TXD_UART2_RTS_B                              =  IOMUX_PAD(0x04B8, 0x0250, 1, 0x04F8, 1, 0),
+	IMX8MM_PAD_UART4_TXD_UART2_CTS_B                              =  IOMUX_PAD(0x04B8, 0x0250, 1, 0x0000, 0, 0),
+	IMX8MM_PAD_UART4_TXD_GPIO5_IO29                               =  IOMUX_PAD(0x04B8, 0x0250, 5, 0x0000, 0, 0),
+};
+#endif
Signature · 1 line
2.16.4
author reviewer
#66 lore raw

PATCH 30/41 imx: add i.MX8MM PE property

In reply to Peng Fan

i.MX8MM does not have LVTTL, it has a PE property

---
 arch/arm/include/asm/mach-imx/iomux-v3.h | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/include/asm/mach-imx/iomux-v3.h +4 -0
index b899a4ff6f..720e8f7043 100644
@@ -104,7 +104,11 @@ typedef u64 iomux_v3_cfg_t;
 #define PAD_CTL_ODE		(0x1 << 5)
 #define PAD_CTL_PUE		(0x1 << 6)
 #define PAD_CTL_HYS		(0x1 << 7)
+#ifdef CONFIG_IMX8MM
+#define PAD_CTL_PE		(0x1 << 8)
+#else
 #define PAD_CTL_LVTTL		(0x1 << 8)
+#endif
 
 #elif defined CONFIG_MX7
 
Signature · 1 line
2.16.4
author reviewer
#67 lore raw

PATCH 31/41 imx8m: Fix MMU table issue for OPTEE memory

In reply to Peng Fan

When running with OPTEE, the MMU table in u-boot does not remove the OPTEE memory from its settings. So ARM speculative prefetch in u-boot may access that OPTEE memory. Due to trust zone is enabled by OPTEE and that memory is set to secure access, then the speculative prefetch will fail and cause various memory issue in u-boot.
The fail address register and int_status register in trustzone has logged that speculative access from u-boot.

---
 arch/arm/mach-imx/imx8m/soc.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +18 -2
index 07cda86bdd..5e9481c565 100644
@@ -116,16 +116,18 @@ static struct mm_region imx8m_mem_map[] = {
 		/* DRAM1 */
 		.virt = 0x40000000UL,
 		.phys = 0x40000000UL,
-		.size = 0xC0000000UL,
+		.size = PHYS_SDRAM_SIZE,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_OUTER_SHARE
+#ifdef PHYS_SDRAM_2_SIZE
 	}, {
 		/* DRAM2 */
 		.virt = 0x100000000UL,
 		.phys = 0x100000000UL,
-		.size = 0x040000000UL,
+		.size = PHYS_SDRAM_2_SIZE,
 		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
 			 PTE_BLOCK_OUTER_SHARE
+#endif
 	}, {
 		/* List terminator */
 		0,
@@ -134,6 +136,20 @@ static struct mm_region imx8m_mem_map[] = {
 
 struct mm_region *mem_map = imx8m_mem_map;
 
+void enable_caches(void)
+{
+	/*
+	 * If OPTEE runs, remove OPTEE memory from MMU table to
+	 * avoid speculative prefetch. OPTEE runs at the top of
+	 * the first memory bank
+	 */
+	if (rom_pointer[1])
+		imx8m_mem_map[5].size -= rom_pointer[1];
+
+	icache_enable();
+	dcache_enable();
+}
+
 static u32 get_cpu_variant_type(u32 type)
 {
 	struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
Signature · 1 line
2.16.4
author reviewer
#68 lore raw

PATCH 32/41 imx8m: set BYPASS ID SWAP to avoid AXI bus errors

In reply to Peng Fan

set the BYPASS ID SWAP bit (GPR10 bit 1) in order for GPU not to generated AXI bus errors with TZC380 enabled.

---
 arch/arm/mach-imx/imx8m/soc.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-imx/imx8m/soc.c +2 -0
index 5e9481c565..3918578399 100644
@@ -59,6 +59,8 @@ void enable_tzc380(void)
 	/* Enable TZASC and lock setting */
 	setbits_le32(&gpr->gpr[10], GPR_TZASC_EN);
 	setbits_le32(&gpr->gpr[10], GPR_TZASC_EN_LOCK);
+	if (IS_ENABLED(CONFIG_IMX8MM))
+		setbits_le32(&gpr->gpr[10], BIT(1));
 }
 
 void set_wdog_reset(struct wdog_regs *wdog)
Signature · 1 line
2.16.4
author reviewer
#69 lore raw

PATCH 33/41 imx8m: Configure trustzone region 0 for non-secure access

In reply to Peng Fan

From: Ye Li <[email protected]>

Set trustzone region 0 to allow both non-secure and secure access when trust zone is enabled. We found USB controller fails to access DDR if the default region 0 is secure access only.

---
 arch/arm/mach-imx/imx8m/soc.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/mach-imx/imx8m/soc.c +6 -0
index 3918578399..abf526bc68 100644
@@ -61,6 +61,12 @@ void enable_tzc380(void)
 	setbits_le32(&gpr->gpr[10], GPR_TZASC_EN_LOCK);
 	if (IS_ENABLED(CONFIG_IMX8MM))
 		setbits_le32(&gpr->gpr[10], BIT(1));
+	/*
+	 * set Region 0 attribute to allow secure and non-secure
+	 * read/write permission. Found some masters like usb dwc3
+	 * controllers can't work with secure memory.
+	 */
+	writel(0xf0000000, TZASC_BASE_ADDR + 0x108);
 }
 
 void set_wdog_reset(struct wdog_regs *wdog)
Signature · 1 line
2.16.4
author reviewer
#70 lore raw

PATCH 34/41 imx8m: soc: enable SCTR clock before timer init

In reply to Peng Fan

To i.MX8MM SCTR clock is disabled by ROM, so before timer init need to enable it.
To i.MX8MQ, it does not hurt the clock is enabled again.

---
 arch/arm/mach-imx/imx8m/soc.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/mach-imx/imx8m/soc.c +6 -0
index abf526bc68..ea83a495c2 100644
@@ -234,6 +234,12 @@ static void imx_set_wdog_powerdown(bool enable)
 
 int arch_cpu_init(void)
 {
+	/*
+	 * ROM might disable clock for SCTR,
+	 * enable the clock before timer_init.
+	 */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		clock_enable(CCGR_SCTR, 1);
 	/*
 	 * Init timer at very early state, because sscg pll setting
 	 * will use it
Signature · 1 line
2.16.4
author reviewer
#71 lore raw

PATCH 35/41 serial: Kconfig: make MXC_UART usable for MX7 and IMX8M

In reply to Peng Fan

i.MX7 and i.MX8M use mxc uart driver, so let's make the SoC could use MXC_UART kconfig.

---
 drivers/serial/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/serial/Kconfig +1 -1
index fcbb0a81ed..a37b2d60f2 100644
@@ -561,7 +561,7 @@ config MVEBU_A3700_UART
 
 config MXC_UART
 	bool "IMX serial port support"
-	depends on MX5 || MX6
+	depends on MX5 || MX6 || MX7 || IMX8M
 	help
 	  If you have a machine based on a Motorola IMX CPU you
 	  can enable its onboard serial port by enabling this option.
Signature · 1 line
2.16.4
author reviewer
#72 lore raw

PATCH 36/41 clk: imx: add Kconfig entry for i.MX8MM

In reply to Peng Fan

Add Kconfig entry for i.MX8MM, select CLK_CCF and SPL_CLK_CCF

---
 drivers/clk/imx/Kconfig | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/clk/imx/Kconfig +9 -0
index 469768b5c3..0e4c68659c 100644
@@ -13,3 +13,12 @@ config CLK_IMX8
 	select CLK
 	help
 	  This enables support clock driver for i.MX8 platforms.
+
+config CLK_IMX8MM
+	bool "Clock support for i.MX8MM"
+	depends on IMX8MM
+	select CLK
+	select CLK_CCF
+	select SPL_CLK_CCF
+	help
+	  This enables support clock driver for i.MX8 platforms.
Signature · 1 line
2.16.4
author reviewer
#73 lore raw

PATCH 37/41 clk: imx: add pll14xx driver

In reply to Peng Fan

Add pll14xx driver

---
 drivers/clk/imx/clk-pll14xx.c | 377 ++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/imx/clk.h         |  25 +++
 2 files changed, 402 insertions(+)
 create mode 100644 drivers/clk/imx/clk-pll14xx.c
drivers/clk/imx/clk-pll14xx.c new file +377 -0
new file mode 100644
index 0000000000..a398b0bbc4
@@ -0,0 +1,377 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2017-2019 NXP.
+ *
+ * Peng Fan <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <malloc.h>
+#include <clk-uclass.h>
+#include <dm/device.h>
+#include <linux/clk-provider.h>
+#include <linux/iopoll.h>
+#include <clk.h>
+#include <div64.h>
+
+#include "clk.h"
+
+#define UBOOT_DM_CLK_IMX_PLL1443X "imx_clk_pll1443x"
+#define UBOOT_DM_CLK_IMX_PLL1416X "imx_clk_pll1416x"
+
+#define GNRL_CTL	0x0
+#define DIV_CTL		0x4
+#define LOCK_STATUS	BIT(31)
+#define LOCK_SEL_MASK	BIT(29)
+#define CLKE_MASK	BIT(11)
+#define RST_MASK	BIT(9)
+#define BYPASS_MASK	BIT(4)
+#define MDIV_SHIFT	12
+#define MDIV_MASK	GENMASK(21, 12)
+#define PDIV_SHIFT	4
+#define PDIV_MASK	GENMASK(9, 4)
+#define SDIV_SHIFT	0
+#define SDIV_MASK	GENMASK(2, 0)
+#define KDIV_SHIFT	0
+#define KDIV_MASK	GENMASK(15, 0)
+
+#define LOCK_TIMEOUT_US		10000
+
+struct clk_pll14xx {
+	struct clk			clk;
+	void __iomem			*base;
+	enum imx_pll14xx_type		type;
+	const struct imx_pll14xx_rate_table *rate_table;
+	int rate_count;
+};
+
+#define to_clk_pll14xx(_clk) container_of(_clk, struct clk_pll14xx, clk)
+
+static const struct imx_pll14xx_rate_table *imx_get_pll_settings(
+		struct clk_pll14xx *pll, unsigned long rate)
+{
+	const struct imx_pll14xx_rate_table *rate_table = pll->rate_table;
+	int i;
+
+	for (i = 0; i < pll->rate_count; i++)
+		if (rate == rate_table[i].rate)
+			return &rate_table[i];
+
+	return NULL;
+}
+
+static unsigned long clk_pll1416x_recalc_rate(struct clk *clk)
+{
+	struct clk_pll14xx *pll = to_clk_pll14xx(
+		(struct clk *)dev_get_driver_data(clk->dev));
+	u32 mdiv, pdiv, sdiv, pll_div;
+	u64 fvco = clk_get_parent_rate(clk);
+
+	pll_div = readl(pll->base + 4);
+	mdiv = (pll_div & MDIV_MASK) >> MDIV_SHIFT;
+	pdiv = (pll_div & PDIV_MASK) >> PDIV_SHIFT;
+	sdiv = (pll_div & SDIV_MASK) >> SDIV_SHIFT;
+
+	fvco *= mdiv;
+	do_div(fvco, pdiv << sdiv);
+
+	return fvco;
+}
+
+static unsigned long clk_pll1443x_recalc_rate(struct clk *clk)
+{
+	struct clk_pll14xx *pll = to_clk_pll14xx(
+		(struct clk *)dev_get_driver_data(clk->dev));
+	u32 mdiv, pdiv, sdiv, pll_div_ctl0, pll_div_ctl1;
+	short int kdiv;
+	u64 fvco = clk_get_parent_rate(clk);
+
+	pll_div_ctl0 = readl(pll->base + 4);
+	pll_div_ctl1 = readl(pll->base + 8);
+	mdiv = (pll_div_ctl0 & MDIV_MASK) >> MDIV_SHIFT;
+	pdiv = (pll_div_ctl0 & PDIV_MASK) >> PDIV_SHIFT;
+	sdiv = (pll_div_ctl0 & SDIV_MASK) >> SDIV_SHIFT;
+	kdiv = pll_div_ctl1 & KDIV_MASK;
+
+	/* fvco = (m * 65536 + k) * Fin / (p * 65536) */
+	fvco *= (mdiv * 65536 + kdiv);
+	pdiv *= 65536;
+
+	do_div(fvco, pdiv << sdiv);
+
+	return fvco;
+}
+
+static inline bool clk_pll1416x_mp_change(const struct imx_pll14xx_rate_table *rate,
+					  u32 pll_div)
+{
+	u32 old_mdiv, old_pdiv;
+
+	old_mdiv = (pll_div >> MDIV_SHIFT) & MDIV_MASK;
+	old_pdiv = (pll_div >> PDIV_SHIFT) & PDIV_MASK;
+
+	return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv;
+}
+
+static inline bool clk_pll1443x_mpk_change(const struct imx_pll14xx_rate_table *rate,
+					  u32 pll_div_ctl0, u32 pll_div_ctl1)
+{
+	u32 old_mdiv, old_pdiv, old_kdiv;
+
+	old_mdiv = (pll_div_ctl0 >> MDIV_SHIFT) & MDIV_MASK;
+	old_pdiv = (pll_div_ctl0 >> PDIV_SHIFT) & PDIV_MASK;
+	old_kdiv = (pll_div_ctl1 >> KDIV_SHIFT) & KDIV_MASK;
+
+	return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv ||
+		rate->kdiv != old_kdiv;
+}
+
+static inline bool clk_pll1443x_mp_change(const struct imx_pll14xx_rate_table *rate,
+					  u32 pll_div_ctl0, u32 pll_div_ctl1)
+{
+	u32 old_mdiv, old_pdiv, old_kdiv;
+
+	old_mdiv = (pll_div_ctl0 >> MDIV_SHIFT) & MDIV_MASK;
+	old_pdiv = (pll_div_ctl0 >> PDIV_SHIFT) & PDIV_MASK;
+	old_kdiv = (pll_div_ctl1 >> KDIV_SHIFT) & KDIV_MASK;
+
+	return rate->mdiv != old_mdiv || rate->pdiv != old_pdiv ||
+		rate->kdiv != old_kdiv;
+}
+
+static int clk_pll14xx_wait_lock(struct clk_pll14xx *pll)
+{
+	u32 val;
+
+	return readl_poll_timeout(pll->base, val, val & LOCK_TIMEOUT_US,
+			LOCK_TIMEOUT_US);
+}
+
+static ulong clk_pll1416x_set_rate(struct clk *clk, unsigned long drate)
+{
+	struct clk_pll14xx *pll = to_clk_pll14xx(
+		(struct clk *)dev_get_driver_data(clk->dev));
+	const struct imx_pll14xx_rate_table *rate;
+	u32 tmp, div_val;
+	int ret;
+
+	rate = imx_get_pll_settings(pll, drate);
+	if (!rate) {
+		pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__,
+		       drate, "xxxx");
+		return -EINVAL;
+	}
+
+	tmp = readl(pll->base + 4);
+
+	if (!clk_pll1416x_mp_change(rate, tmp)) {
+		tmp &= ~(SDIV_MASK) << SDIV_SHIFT;
+		tmp |= rate->sdiv << SDIV_SHIFT;
+		writel(tmp, pll->base + 4);
+
+		return clk_pll1416x_recalc_rate(clk);
+	}
+
+	/* Bypass clock and set lock to pll output lock */
+	tmp = readl(pll->base);
+	tmp |= LOCK_SEL_MASK;
+	writel(tmp, pll->base);
+
+	/* Enable RST */
+	tmp &= ~RST_MASK;
+	writel(tmp, pll->base);
+
+	div_val = (rate->mdiv << MDIV_SHIFT) | (rate->pdiv << PDIV_SHIFT) |
+		(rate->sdiv << SDIV_SHIFT);
+	writel(div_val, pll->base + 0x4);
+
+	/*
+	 * According to SPEC, t3 - t2 need to be greater than
+	 * 1us and 1/FREF, respectively.
+	 * FREF is FIN / Prediv, the prediv is [1, 63], so choose
+	 * 3us.
+	 */
+	udelay(3);
+
+	/* Disable RST */
+	tmp |= RST_MASK;
+	writel(tmp, pll->base);
+
+	/* Wait Lock */
+	ret = clk_pll14xx_wait_lock(pll);
+	if (ret)
+		return ret;
+
+	/* Bypass */
+	tmp &= ~BYPASS_MASK;
+	writel(tmp, pll->base);
+
+	return clk_pll1416x_recalc_rate(clk);
+}
+
+static ulong clk_pll1443x_set_rate(struct clk *clk, unsigned long drate)
+{
+	struct clk_pll14xx *pll = to_clk_pll14xx(
+		(struct clk *)dev_get_driver_data(clk->dev));
+	const struct imx_pll14xx_rate_table *rate;
+	u32 tmp, div_val;
+	int ret;
+
+	rate = imx_get_pll_settings(pll, drate);
+	if (!rate) {
+		pr_err("%s: Invalid rate : %lu for pll clk %s\n", __func__,
+		       drate, "===");
+		return -EINVAL;
+	}
+
+	tmp = readl(pll->base + 4);
+	div_val = readl(pll->base + 8);
+
+	if (!clk_pll1443x_mpk_change(rate, tmp, div_val)) {
+		tmp &= ~(SDIV_MASK) << SDIV_SHIFT;
+		tmp |= rate->sdiv << SDIV_SHIFT;
+		writel(tmp, pll->base + 4);
+
+		return clk_pll1443x_recalc_rate(clk);
+	}
+
+	/* Enable RST */
+	tmp = readl(pll->base);
+	tmp &= ~RST_MASK;
+	writel(tmp, pll->base);
+
+	div_val = (rate->mdiv << MDIV_SHIFT) | (rate->pdiv << PDIV_SHIFT) |
+		(rate->sdiv << SDIV_SHIFT);
+	writel(div_val, pll->base + 0x4);
+	writel(rate->kdiv << KDIV_SHIFT, pll->base + 0x8);
+
+	/*
+	 * According to SPEC, t3 - t2 need to be greater than
+	 * 1us and 1/FREF, respectively.
+	 * FREF is FIN / Prediv, the prediv is [1, 63], so choose
+	 * 3us.
+	 */
+	udelay(3);
+
+	/* Disable RST */
+	tmp |= RST_MASK;
+	writel(tmp, pll->base);
+
+	/* Wait Lock*/
+	ret = clk_pll14xx_wait_lock(pll);
+	if (ret)
+		return ret;
+
+	/* Bypass */
+	tmp &= ~BYPASS_MASK;
+	writel(tmp, pll->base);
+
+	return clk_pll1443x_recalc_rate(clk);
+}
+
+static int clk_pll14xx_prepare(struct clk *clk)
+{
+	struct clk_pll14xx *pll = to_clk_pll14xx(
+		(struct clk *)dev_get_driver_data(clk->dev));
+	u32 val;
+
+	/*
+	 * RESETB = 1 from 0, PLL starts its normal
+	 * operation after lock time
+	 */
+	val = readl(pll->base + GNRL_CTL);
+	val |= RST_MASK;
+	writel(val, pll->base + GNRL_CTL);
+
+	return clk_pll14xx_wait_lock(pll);
+}
+
+static int clk_pll14xx_unprepare(struct clk *clk)
+{
+	struct clk_pll14xx *pll = to_clk_pll14xx(
+		(struct clk *)dev_get_driver_data(clk->dev));
+	u32 val;
+
+	/*
+	 * Set RST to 0, power down mode is enabled and
+	 * every digital block is reset
+	 */
+	val = readl(pll->base + GNRL_CTL);
+	val &= ~RST_MASK;
+	writel(val, pll->base + GNRL_CTL);
+
+	return 0;
+}
+
+static const struct clk_ops clk_pll1416x_ops = {
+	.enable		= clk_pll14xx_prepare,
+	.disable	= clk_pll14xx_unprepare,
+	.set_rate	= clk_pll1416x_set_rate,
+	.get_rate	= clk_pll1416x_recalc_rate,
+};
+
+static const struct clk_ops clk_pll1443x_ops = {
+	.enable		= clk_pll14xx_prepare,
+	.disable	= clk_pll14xx_unprepare,
+	.set_rate	= clk_pll1443x_set_rate,
+	.get_rate	= clk_pll1443x_recalc_rate,
+};
+
+struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
+			    void __iomem *base,
+			    const struct imx_pll14xx_clk *pll_clk)
+{
+	struct clk_pll14xx *pll;
+	struct clk *clk;
+	char *type_name;
+	int ret;
+
+	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
+
+	switch (pll_clk->type) {
+	case PLL_1416X:
+		type_name = UBOOT_DM_CLK_IMX_PLL1416X;
+		break;
+	case PLL_1443X:
+		type_name = UBOOT_DM_CLK_IMX_PLL1443X;
+		break;
+	default:
+		pr_err("%s: Unknown pll type for pll clk %s\n",
+		       __func__, name);
+		return ERR_PTR(-EINVAL);
+	};
+
+	pll->base = base;
+	pll->type = pll_clk->type;
+	pll->rate_table = pll_clk->rate_table;
+	pll->rate_count = pll_clk->rate_count;
+
+	clk = &pll->clk;
+
+	ret = clk_register(clk, type_name, (ulong)clk, name, parent_name);
+	if (ret) {
+		pr_err("%s: failed to register pll %s %d\n",
+		       __func__, name, ret);
+		kfree(pll);
+		return ERR_PTR(ret);
+	}
+
+	return clk;
+}
+
+U_BOOT_DRIVER(clk_pll1443x) = {
+	.name	= UBOOT_DM_CLK_IMX_PLL1443X,
+	.id	= UCLASS_CLK,
+	.ops	= &clk_pll1443x_ops,
+	.flags = DM_FLAG_PRE_RELOC,
+};
+
+U_BOOT_DRIVER(clk_pll1416x) = {
+	.name	= UBOOT_DM_CLK_IMX_PLL1416X,
+	.id	= UCLASS_CLK,
+	.ops	= &clk_pll1416x_ops,
+	.flags = DM_FLAG_PRE_RELOC,
+};
drivers/clk/imx/clk.h +25 -0
index aa6e81ff13..b5330cdf51 100644
@@ -26,6 +26,31 @@ enum imx_pllv3_type {
 	IMX_PLLV3_DDR_IMX7,
 };
 
+enum imx_pll14xx_type {
+	PLL_1416X,
+	PLL_1443X,
+};
+
+/* NOTE: Rate table should be kept sorted in descending order. */
+struct imx_pll14xx_rate_table {
+	unsigned int rate;
+	unsigned int pdiv;
+	unsigned int mdiv;
+	unsigned int sdiv;
+	unsigned int kdiv;
+};
+
+struct imx_pll14xx_clk {
+	enum imx_pll14xx_type type;
+	const struct imx_pll14xx_rate_table *rate_table;
+	int rate_count;
+	int flags;
+};
+
+struct clk *imx_clk_pll14xx(const char *name, const char *parent_name,
+			    void __iomem *base,
+			    const struct imx_pll14xx_clk *pll_clk);
+
 struct clk *clk_register_gate2(struct device *dev, const char *name,
 		const char *parent_name, unsigned long flags,
 		void __iomem *reg, u8 bit_idx, u8 cgr_val,
Signature · 1 line
2.16.4
author reviewer
#74 lore raw

PATCH 38/41 clk: add composite clk support

In reply to Peng Fan

Import clk composite clk support from Linux Kernel 5.1-rc5

---
 drivers/clk/Kconfig          |  14 ++++
 drivers/clk/Makefile         |   1 +
 drivers/clk/clk-composite.c  | 165 +++++++++++++++++++++++++++++++++++++++++++
 include/linux/clk-provider.h |  22 ++++++
 4 files changed, 202 insertions(+)
 create mode 100644 drivers/clk/clk-composite.c
drivers/clk/Kconfig +14 -0
index 9df3bc731a..3735e235f5 100644
@@ -53,6 +53,13 @@ config SPL_CLK_CCF
 	  Enable this option if you want to (re-)use the Linux kernel's Common
 	  Clock Framework [CCF] code in U-Boot's SPL.
 
+config SPL_CLK_COMPOSITE_CCF
+	bool "SPL Common Clock Framework [CCF] composite clk support "
+	depends on SPL_CLK_CCF
+	help
+	  Enable this option if you want to (re-)use the Linux kernel's Common
+	  Clock Framework [CCF] composite code in U-Boot's SPL.
+
 config CLK_CCF
 	bool "Common Clock Framework [CCF] support "
 	depends on CLK
@@ -60,6 +67,13 @@ config CLK_CCF
 	  Enable this option if you want to (re-)use the Linux kernel's Common
 	  Clock Framework [CCF] code in U-Boot's clock driver.
 
+config CLK_COMPOSITE_CCF
+	bool "Common Clock Framework [CCF] composite clk support "
+	depends on CLK_CCF
+	help
+	  Enable this option if you want to (re-)use the Linux kernel's Common
+	  Clock Framework [CCF] composite code in U-Boot's clock driver.
+
 config CLK_STM32F
 	bool "Enable clock driver support for STM32F family"
 	depends on CLK && (STM32F7 || STM32F4)
drivers/clk/Makefile +1 -0
index 0bc8f7e5ce..6c71b0fc16 100644
@@ -9,6 +9,7 @@ obj-$(CONFIG_$(SPL_TPL_)CLK) += clk_fixed_rate.o
 obj-$(CONFIG_$(SPL_TPL_)CLK) += clk_fixed_factor.o
 obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk.o clk-divider.o clk-mux.o clk-gate.o
 obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk-fixed-factor.o
+obj-$(CONFIG_$(SPL_TPL_)CLK_COMPOSITE_CCF) += clk-composite.o
 
 obj-y += imx/
 obj-y += tegra/
drivers/clk/clk-composite.c new file +165 -0

165 lines not on this page · raw message

include/linux/clk-provider.h +22 -0
index b2bed768b6..490713adb6 100644
@@ -119,6 +119,28 @@ struct clk_fixed_rate {
 
 #define to_clk_fixed_rate(dev)	((struct clk_fixed_rate *)dev_get_platdata(dev))
 
+struct clk_composite {
+	struct clk	clk;
+	struct clk_ops	ops;
+
+	struct clk	*mux;
+	struct clk	*rate;
+	struct clk	*gate;
+
+	const struct clk_ops	*mux_ops;
+	const struct clk_ops	*rate_ops;
+	const struct clk_ops	*gate_ops;
+};
+
+#define to_clk_composite(_clk) container_of(_clk, struct clk_composite, clk)
+
+struct clk *clk_register_composite(struct device *dev, const char *name,
+		const char * const *parent_names, int num_parents,
+		struct clk *mux_clk, const struct clk_ops *mux_ops,
+		struct clk *rate_clk, const struct clk_ops *rate_ops,
+		struct clk *gate_clk, const struct clk_ops *gate_ops,
+		unsigned long flags);
+
 int clk_register(struct clk *clk, const char *drv_name,
 		 ulong drv_data, const char *name,
 		 const char *parent_name);
Signature · 1 line
2.16.4
author reviewer
#75 lore raw

PATCH 39/41 clk: imx: add i.MX8MM composite clk support

In reply to Peng Fan

Import i.MX8MM composite clk from Linux Kernel

---
 drivers/clk/imx/clk-composite-8m.c | 170 +++++++++++++++++++++++++++++++++++++
 include/linux/clk-provider.h       |   3 +
 2 files changed, 173 insertions(+)
 create mode 100644 drivers/clk/imx/clk-composite-8m.c
drivers/clk/imx/clk-composite-8m.c new file +170 -0
new file mode 100644
index 0000000000..57ebbc3bb0
@@ -0,0 +1,170 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 NXP
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <malloc.h>
+#include <clk-uclass.h>
+#include <dm/device.h>
+#include <linux/clk-provider.h>
+#include <clk.h>
+#include "clk.h"
+
+#define UBOOT_DM_CLK_IMX_COMPOSITE "imx_clk_composite"
+
+#define PCG_PREDIV_SHIFT	16
+#define PCG_PREDIV_WIDTH	3
+#define PCG_PREDIV_MAX		8
+
+#define PCG_DIV_SHIFT		0
+#define PCG_DIV_WIDTH		6
+#define PCG_DIV_MAX		64
+
+#define PCG_PCS_SHIFT		24
+#define PCG_PCS_MASK		0x7
+
+#define PCG_CGC_SHIFT		28
+
+static unsigned long imx8m_clk_composite_divider_recalc_rate(struct clk *clk)
+{
+	struct clk_divider *divider = (struct clk_divider *)to_clk_divider(clk);
+	struct clk_composite *composite = (struct clk_composite *)clk->data;
+	ulong parent_rate = clk_get_parent_rate(&composite->clk);
+	unsigned long prediv_rate;
+	unsigned int prediv_value;
+	unsigned int div_value;
+
+	debug("%s: name %s prate: %lu reg: %p\n", __func__,
+	      (&composite->clk)->dev->name, parent_rate, divider->reg);
+	prediv_value = readl(divider->reg) >> divider->shift;
+	prediv_value &= clk_div_mask(divider->width);
+
+	prediv_rate = divider_recalc_rate(clk, parent_rate, prediv_value,
+					  NULL, divider->flags,
+					  divider->width);
+
+	div_value = readl(divider->reg) >> PCG_DIV_SHIFT;
+	div_value &= clk_div_mask(PCG_DIV_WIDTH);
+
+	return divider_recalc_rate(clk, prediv_rate, div_value, NULL,
+				   divider->flags, PCG_DIV_WIDTH);
+}
+
+static int imx8m_clk_composite_compute_dividers(unsigned long rate,
+						unsigned long parent_rate,
+						int *prediv, int *postdiv)
+{
+	int div1, div2;
+	int error = INT_MAX;
+	int ret = -EINVAL;
+
+	*prediv = 1;
+	*postdiv = 1;
+
+	for (div1 = 1; div1 <= PCG_PREDIV_MAX; div1++) {
+		for (div2 = 1; div2 <= PCG_DIV_MAX; div2++) {
+			int new_error = ((parent_rate / div1) / div2) - rate;
+
+			if (abs(new_error) < abs(error)) {
+				*prediv = div1;
+				*postdiv = div2;
+				error = new_error;
+				ret = 0;
+			}
+		}
+	}
+	return ret;
+}
+
+/*
+ * The clk are not binded to a dev, because it is part of composite clk
+ * use composite clk to get dev
+ */
+static ulong imx8m_clk_composite_divider_set_rate(struct clk *clk,
+						  unsigned long rate)
+{
+	struct clk_divider *divider = (struct clk_divider *)to_clk_divider(clk);
+	struct clk_composite *composite = (struct clk_composite *)clk->data;
+	ulong parent_rate = clk_get_parent_rate(&composite->clk);
+	int prediv_value;
+	int div_value;
+	int ret;
+	u32 val;
+
+	ret = imx8m_clk_composite_compute_dividers(rate, parent_rate,
+						   &prediv_value, &div_value);
+	if (ret)
+		return -EINVAL;
+
+	val = readl(divider->reg);
+	val &= ~((clk_div_mask(divider->width) << divider->shift) |
+			(clk_div_mask(PCG_DIV_WIDTH) << PCG_DIV_SHIFT));
+
+	val |= (u32)(prediv_value  - 1) << divider->shift;
+	val |= (u32)(div_value - 1) << PCG_DIV_SHIFT;
+	writel(val, divider->reg);
+
+	return clk_get_rate(&composite->clk);
+}
+
+static const struct clk_ops imx8m_clk_composite_divider_ops = {
+	.get_rate = imx8m_clk_composite_divider_recalc_rate,
+	.set_rate = imx8m_clk_composite_divider_set_rate,
+};
+
+struct clk *imx8m_clk_composite_flags(const char *name,
+				      const char * const *parent_names,
+				      int num_parents, void __iomem *reg,
+				      unsigned long flags)
+{
+	struct clk *clk = ERR_PTR(-ENOMEM);
+	struct clk_divider *div = NULL;
+	struct clk_gate *gate = NULL;
+	struct clk_mux *mux = NULL;
+
+	mux = kzalloc(sizeof(*mux), GFP_KERNEL);
+	if (!mux)
+		goto fail;
+
+	mux->reg = reg;
+	mux->shift = PCG_PCS_SHIFT;
+	mux->mask = PCG_PCS_MASK;
+	mux->num_parents = num_parents;
+	mux->flags = flags;
+	mux->parent_names = parent_names;
+
+	div = kzalloc(sizeof(*div), GFP_KERNEL);
+	if (!div)
+		goto fail;
+
+	div->reg = reg;
+	div->shift = PCG_PREDIV_SHIFT;
+	div->width = PCG_PREDIV_WIDTH;
+	div->flags = CLK_DIVIDER_ROUND_CLOSEST | flags;
+
+	gate = kzalloc(sizeof(*gate), GFP_KERNEL);
+	if (!gate)
+		goto fail;
+
+	gate->reg = reg;
+	gate->bit_idx = PCG_CGC_SHIFT;
+	gate->flags = flags;
+
+	clk = clk_register_composite(NULL, name,
+				     parent_names, num_parents,
+				     &mux->clk, &clk_mux_ops, &div->clk,
+				     &imx8m_clk_composite_divider_ops,
+				     &gate->clk, &clk_gate_ops, flags);
+	if (IS_ERR(clk))
+		goto fail;
+
+	return clk;
+
+fail:
+	kfree(gate);
+	kfree(div);
+	kfree(mux);
+	return ERR_CAST(clk);
+}
include/linux/clk-provider.h +3 -0
index 490713adb6..568a0e87d6 100644
@@ -102,6 +102,9 @@ struct clk_divider {
 #define CLK_DIVIDER_READ_ONLY		BIT(5)
 #define CLK_DIVIDER_MAX_AT_ZERO		BIT(6)
 extern const struct clk_ops clk_divider_ops;
+unsigned long divider_recalc_rate(struct clk *hw, unsigned long parent_rate,
+		unsigned int val, const struct clk_div_table *table,
+		unsigned long flags, unsigned long width);
 
 struct clk_fixed_factor {
 	struct clk	clk;
Signature · 1 line
2.16.4
author reviewer
#76 lore raw

PATCH 40/41 clk: imx: add i.MX8MM clk driver

In reply to Peng Fan

Add i.MX8MM clk driver support.

---
 drivers/clk/imx/Makefile     |   1 +
 drivers/clk/imx/clk-imx8mm.c | 415 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 416 insertions(+)
 create mode 100644 drivers/clk/imx/clk-imx8mm.c
drivers/clk/imx/Makefile +1 -0
index beba3bff39..e8cac4127a 100644
@@ -5,3 +5,4 @@
 obj-$(CONFIG_$(SPL_TPL_)CLK_CCF) += clk-gate2.o clk-pllv3.o clk-pfd.o
 obj-$(CONFIG_CLK_IMX6Q) += clk-imx6q.o
 obj-$(CONFIG_CLK_IMX8) += clk-imx8.o
+obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o clk-pll14xx.o clk-composite-8m.o
drivers/clk/imx/clk-imx8mm.c new file +415 -0

415 lines not on this page · raw message

Signature · 1 line
2.16.4
author reviewer
#77 lore raw

PATCH 41/41 imx: add i.MX8MM EVK board support

In reply to Peng Fan

Add i.MX8MM EVK board support.

Add board and SoC dts
Add ddr training code
support SD/MMC/GPIO/PINCTRL/UART

---
 arch/arm/dts/Makefile                      |    3 +-
 arch/arm/dts/imx8mm-evk-u-boot.dtsi        |   92 ++
 arch/arm/dts/imx8mm-evk.dts                |  235 ++++
 arch/arm/dts/imx8mm-pinfunc.h              |  629 +++++++++
 arch/arm/dts/imx8mm.dtsi                   |  733 ++++++++++
 arch/arm/mach-imx/imx8m/Kconfig            |    7 +
 board/freescale/imx8mm_evk/Kconfig         |   12 +
 board/freescale/imx8mm_evk/MAINTAINERS     |    6 +
 board/freescale/imx8mm_evk/Makefile        |   12 +
 board/freescale/imx8mm_evk/imx8mm_evk.c    |   90 ++
 board/freescale/imx8mm_evk/lpddr4_timing.c | 1980 ++++++++++++++++++++++++++++
 board/freescale/imx8mm_evk/spl.c           |  216 +++
 configs/imx8mm_evk_defconfig               |   52 +
 include/configs/imx8mm_evk.h               |  199 +++
 14 files changed, 4265 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx8mm-evk-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-evk.dts
 create mode 100644 arch/arm/dts/imx8mm-pinfunc.h
 create mode 100644 arch/arm/dts/imx8mm.dtsi
 create mode 100644 board/freescale/imx8mm_evk/Kconfig
 create mode 100644 board/freescale/imx8mm_evk/MAINTAINERS
 create mode 100644 board/freescale/imx8mm_evk/Makefile
 create mode 100644 board/freescale/imx8mm_evk/imx8mm_evk.c
 create mode 100644 board/freescale/imx8mm_evk/lpddr4_timing.c
 create mode 100644 board/freescale/imx8mm_evk/spl.c
 create mode 100644 configs/imx8mm_evk_defconfig
 create mode 100644 include/configs/imx8mm_evk.h
arch/arm/dts/Makefile +2 -1
index 0aee8dfde0..b556bc72d2 100644
@@ -563,7 +563,8 @@ dtb-$(CONFIG_ARCH_MX7ULP) += imx7ulp-evk.dtb
 
 dtb-$(CONFIG_ARCH_IMX8) += fsl-imx8qxp-mek.dtb
 
-dtb-$(CONFIG_ARCH_IMX8M) += fsl-imx8mq-evk.dtb
+dtb-$(CONFIG_ARCH_IMX8M) += fsl-imx8mq-evk.dtb \
+	imx8mm-evk.dtb
 
 dtb-$(CONFIG_RCAR_GEN2) += \
 	r8a7790-lager-u-boot.dtb \
arch/arm/dts/imx8mm-evk-u-boot.dtsi new file +92 -0

92 lines not on this page · raw message

arch/arm/dts/imx8mm-evk.dts new file +235 -0

235 lines not on this page · raw message

arch/arm/dts/imx8mm-pinfunc.h new file +629 -0

629 lines not on this page · raw message

arch/arm/dts/imx8mm.dtsi new file +733 -0

733 lines not on this page · raw message

arch/arm/mach-imx/imx8m/Kconfig +7 -0
index 35c978e863..f520075875 100644
@@ -24,8 +24,15 @@ config TARGET_IMX8MQ_EVK
 	select IMX8MQ
 	select IMX8M_LPDDR4
 
+config TARGET_IMX8MM_EVK
+	bool "imx8mm LPDDR4 EVK board"
+	select IMX8MM
+	select SUPPORT_SPL
+	select IMX8M_LPDDR4
+
 endchoice
 
 source "board/freescale/imx8mq_evk/Kconfig"
+source "board/freescale/imx8mm_evk/Kconfig"
 
 endif
board/freescale/imx8mm_evk/Kconfig new file +12 -0
new file mode 100644
index 0000000000..299691a619
@@ -0,0 +1,12 @@
+if TARGET_IMX8MM_EVK
+
+config SYS_BOARD
+	default "imx8mm_evk"
+
+config SYS_VENDOR
+	default "freescale"
+
+config SYS_CONFIG_NAME
+	default "imx8mm_evk"
+
+endif
board/freescale/imx8mm_evk/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..b031bb0674
@@ -0,0 +1,6 @@
+i.MX8MM EVK BOARD
+M:	Peng Fan <[email protected]>
+S:	Maintained
+F:	board/freescale/imx8mm_evk/
+F:	include/configs/imx8mm_evk.h
+F:	configs/imx8mm_evk_defconfig
board/freescale/imx8mm_evk/Makefile new file +12 -0
new file mode 100644
index 0000000000..1db7b62caf
@@ -0,0 +1,12 @@
+#
+# Copyright 2018 NXP
+#
+# SPDX-License-Identifier:      GPL-2.0+
+#
+
+obj-y += imx8mm_evk.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+endif
board/freescale/imx8mm_evk/imx8mm_evk.c new file +90 -0

90 lines not on this page · raw message

board/freescale/imx8mm_evk/lpddr4_timing.c new file +1980 -0

1,167 lines not on this page · raw message

board/freescale/imx8mm_evk/spl.c new file +216 -0

216 lines not on this page · raw message

configs/imx8mm_evk_defconfig new file +52 -0

52 lines not on this page · raw message

include/configs/imx8mm_evk.h new file +199 -0

199 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.16.4

Part of the diff is not shown here. View the raw message.

#78 lore raw

cover i.MX8MM + CCF

In reply to Peng Fan

Hi Peng,

I'm trying to add support for a board with i.MX8MM. First I applied Lukasz's CCF patches and your patches to U-Boot 2019.04 and tried to build imx8mm_evk config. But I'm getting build errors (see below).

Are there any other patches needed?
What things are still missing to get i.MX8MM running in U-Boot?

Thanks,
Frieder

| aarch64-ktn-linux-ld.bfd: cmd/built-in.o: in function `do_fuse':
| /home/frieder/repos/u-boot/cmd/fuse.c:68: undefined reference to `fuse_read'
| aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:86:
undefined reference to `fuse_sense'
| aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:105:
undefined reference to `fuse_prog'
| aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:119:
undefined reference to `fuse_override'
| aarch64-ktn-linux-ld.bfd: drivers/i2c/built-in.o: in function `mxc_i2c_probe':
| /home/frieder/repos/u-boot/drivers/i2c/mxc_i2c.c:824: undefined reference to `enable_i2c_clk'
| aarch64-ktn-linux-ld.bfd:
/home/frieder/repos/u-boot/drivers/i2c/mxc_i2c.c:853: undefined reference to `enable_i2c_clk'

Quoted 153 lines · Peng Fan

This patch set is based Lukasz V3 CCF patchset,
[PATCH v3 00/11] clk: Port Linux common clock framework [CCF] to U-boot (tag: 5.0-rc3)
https://github.com/lmajewski/u-boot-dfu/commits/CCF-v3

Added a few fixes to Lukasz's v3 patchset.
Introduced clk-gate/composite
Added set rate support
Per my understanding, U-Boot CCF will not support mux reparent, and support rate prograte setting to parent automatically. So new clk feature added follow this rule.

There are many warnings when importing linux ccf code, I did not modify them all.

The rest patches are for i.MX8MM, part of legacy clk code are still kept, because we are hard to enable CCF at very early stage, we set malloc space to DRAM when dram initialized in spl stage, so we have limited SRAM for uclass dm and dm clk, so keep the DRAM PLL related setting with legacy clk code which use small ram.

The u-boot-spl.bin now is about 100KB without ddr firmware,usb stack and hab, so really large......
I am thinking what we could do to shrink the size, welcome any suggestions.

Not expect this patchset could be merged, because of the CCF/clock code change, but since the clock part blocks i.MX8MM upstream, just would like to speed up the development with community and move on.

Peng Fan (40):
clk: correct get clk_x pointer
clk: fixed-factor: fix get clk_fixed_factor
clk: introduce clk_dev_binded
clk: use clk_dev_binded
clk-provider: sync more clk flags from Linux Kernel
cmd: clk: print err value when clk_get_rate failed
clk: mux: add set parent support
clk: export mux/divider ops
clk: add clk-gate support
divider set rate supporrt
clk: fixed_rate: export clk_fixed_rate
clk: fixed_rate: add pre reloc flag
clk: imx: import clk heplers
clk: imx: gate2 add set rate
linux: compat: guard PAGE_SIZE
drivers: core: use strcmp when find device by name
ddr: imx8m: fix ddr firmware location when enable SPL OF
imx: add IMX8MQ kconfig entry
imx: add IMX8MM kconfig entry
imx: imx8mm: add clock bindings header
imx: add i.MX8MM cpu type
imx: spl: add spl_board_boot_device for i.MX8MM
imx8m: update imx-regs for i.MX8MM
imx: add get_cpu_rev support for i.MX8MM
imx8m: rename clock to clock_imx8mq
imx8m: restructure clock.h
imx8m: add clk support for i.MX8MM
imx8m: soc: probe clk before relocation
imx8m: add pin header for i.MX8MM
imx: add i.MX8MM PE property
imx8m: Fix MMU table issue for OPTEE memory
imx8m: set BYPASS ID SWAP to avoid AXI bus errors
imx8m: soc: enable SCTR clock before timer init
serial: Kconfig: make MXC_UART usable for MX7 and IMX8M
clk: imx: add Kconfig entry for i.MX8MM
clk: imx: add pll14xx driver
clk: add composite clk support
clk: imx: add i.MX8MM composite clk support
clk: imx: add i.MX8MM clk driver
imx: add i.MX8MM EVK board support

Ye Li (1):
imx8m: Configure trustzone region 0 for non-secure access

  arch/arm/dts/Makefile                              |    3 +-
  arch/arm/dts/imx8mm-evk-u-boot.dtsi                |   92 +
  arch/arm/dts/imx8mm-evk.dts                        |  235 +++
  arch/arm/dts/imx8mm-pinfunc.h                      |  629 +++++++
  arch/arm/dts/imx8mm.dtsi                           |  733 ++++++++
  arch/arm/include/asm/arch-imx/cpu.h                |    6 +
  arch/arm/include/asm/arch-imx8m/clock.h            |  493 +----
  arch/arm/include/asm/arch-imx8m/clock_imx8mm.h     |  387 ++++
  arch/arm/include/asm/arch-imx8m/clock_imx8mq.h     |  424 +++++
  arch/arm/include/asm/arch-imx8m/imx-regs.h         |   75 +-
  arch/arm/include/asm/arch-imx8m/imx8mm_pins.h      |  691 +++++++
  arch/arm/include/asm/mach-imx/iomux-v3.h           |    4 +
  arch/arm/include/asm/mach-imx/sys_proto.h          |    8 +
  arch/arm/mach-imx/cpu.c                            |   12 +
  arch/arm/mach-imx/imx8m/Kconfig                    |   17 +-
  arch/arm/mach-imx/imx8m/Makefile                   |    4 +-
  arch/arm/mach-imx/imx8m/clock_imx8mm.c             |  292 +++
  .../arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} |    5 +-
  arch/arm/mach-imx/imx8m/clock_slice.c              |  461 +++++
  arch/arm/mach-imx/imx8m/soc.c                      |  112 +-
  arch/arm/mach-imx/spl.c                            |    8 +
  board/freescale/imx8mm_evk/Kconfig                 |   12 +
  board/freescale/imx8mm_evk/MAINTAINERS             |    6 +
  board/freescale/imx8mm_evk/Makefile                |   12 +
  board/freescale/imx8mm_evk/imx8mm_evk.c            |   90 +
  board/freescale/imx8mm_evk/lpddr4_timing.c         | 1980 ++++++++++++++++++++
  board/freescale/imx8mm_evk/spl.c                   |  216 +++
  cmd/clk.c                                          |    2 +
  configs/imx8mm_evk_defconfig                       |   52 +
  drivers/clk/Kconfig                                |   14 +
  drivers/clk/Makefile                               |    3 +-
  drivers/clk/clk-composite.c                        |  165 ++
  drivers/clk/clk-divider.c                          |   92 +-
  drivers/clk/clk-fixed-factor.c                     |    2 +-
  drivers/clk/clk-gate.c                             |  151 ++
  drivers/clk/clk-mux.c                              |   76 +-
  drivers/clk/clk.c                                  |    8 +
  drivers/clk/clk_fixed_rate.c                       |    9 +-
  drivers/clk/imx/Kconfig                            |    9 +
  drivers/clk/imx/Makefile                           |    1 +
  drivers/clk/imx/clk-composite-8m.c                 |  170 ++
  drivers/clk/imx/clk-gate2.c                        |   15 +-
  drivers/clk/imx/clk-imx8mm.c                       |  415 ++++
  drivers/clk/imx/clk-pfd.c                          |    2 +-
  drivers/clk/imx/clk-pll14xx.c                      |  377 ++++
  drivers/clk/imx/clk-pllv3.c                        |    2 +-
  drivers/clk/imx/clk.h                              |  106 ++
  drivers/core/uclass.c                              |    2 +-
  drivers/ddr/imx/imx8m/helper.c                     |   12 +-
  drivers/serial/Kconfig                             |    2 +-
  include/clk.h                                      |    9 +
  include/configs/imx8mm_evk.h                       |  199 ++
  include/dt-bindings/clock/imx8mm-clock.h           |  244 +++
  include/linux/clk-provider.h                       |   74 +
  include/linux/compat.h                             |    2 +
  55 files changed, 8728 insertions(+), 494 deletions(-)

create mode 100644 arch/arm/dts/imx8mm-evk-u-boot.dtsi create mode 100644 arch/arm/dts/imx8mm-evk.dts
create mode 100644 arch/arm/dts/imx8mm-pinfunc.h create mode 100644 arch/arm/dts/imx8mm.dtsi
create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h create mode 100644 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h create mode 100644 arch/arm/mach-imx/imx8m/clock_imx8mm.c rename arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} (99%) create mode 100644 board/freescale/imx8mm_evk/Kconfig create mode 100644 board/freescale/imx8mm_evk/MAINTAINERS create mode 100644 board/freescale/imx8mm_evk/Makefile create mode 100644 board/freescale/imx8mm_evk/imx8mm_evk.c create mode 100644 board/freescale/imx8mm_evk/lpddr4_timing.c create mode 100644 board/freescale/imx8mm_evk/spl.c create mode 100644 configs/imx8mm_evk_defconfig
create mode 100644 drivers/clk/clk-composite.c
create mode 100644 drivers/clk/clk-gate.c
create mode 100644 drivers/clk/imx/clk-composite-8m.c create mode 100644 drivers/clk/imx/clk-imx8mm.c
create mode 100644 drivers/clk/imx/clk-pll14xx.c create mode 100644 include/configs/imx8mm_evk.h
create mode 100644 include/dt-bindings/clock/imx8mm-clock.h

#79 lore raw

cover i.MX8MM + CCF

Quoted 5 lines · Frieder Schrempf

Hi Peng,

I'm trying to add support for a board with i.MX8MM. First I applied Lukasz's CCF patches and your patches to U-Boot 2019.04 and tried to build imx8mm_evk config. But I'm getting build errors (see below).

The build works if I enable the OTP fuse driver and disable I2C support. In clock_imx8mm.c enable_i2c_clk() seems to be missing, or maybe the i2c driver needs to use the new clock framework now?

Quoted 3 lines

Are there any other patches needed?
What things are still missing to get i.MX8MM running in U-Boot?

It seems like this still needs a bit of work. I also see some CONFIG options defined in the headers, that should be moved to defconfig.

Quoted 180 lines

Thanks,
Frieder

| aarch64-ktn-linux-ld.bfd: cmd/built-in.o: in function `do_fuse':
| /home/frieder/repos/u-boot/cmd/fuse.c:68: undefined reference to `fuse_read'
| aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:86:
undefined reference to `fuse_sense'
| aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:105:
undefined reference to `fuse_prog'
| aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:119:
undefined reference to `fuse_override'
| aarch64-ktn-linux-ld.bfd: drivers/i2c/built-in.o: in function `mxc_i2c_probe':
| /home/frieder/repos/u-boot/drivers/i2c/mxc_i2c.c:824: undefined reference to `enable_i2c_clk'
| aarch64-ktn-linux-ld.bfd:
/home/frieder/repos/u-boot/drivers/i2c/mxc_i2c.c:853: undefined reference to `enable_i2c_clk'

Quoted 157 lines · Peng Fan

This patch set is based Lukasz V3 CCF patchset,
[PATCH v3 00/11] clk: Port Linux common clock framework [CCF] to U-boot (tag: 5.0-rc3)
https://github.com/lmajewski/u-boot-dfu/commits/CCF-v3

Added a few fixes to Lukasz's v3 patchset.
Introduced clk-gate/composite
Added set rate support
Per my understanding, U-Boot CCF will not support mux reparent, and support rate prograte setting to parent automatically. So new clk feature added follow this rule.

There are many warnings when importing linux ccf code, I did not modify them all.

The rest patches are for i.MX8MM, part of legacy clk code are still kept, because we are hard to enable CCF at very early stage, we set malloc space to DRAM when dram initialized in spl stage, so we have limited SRAM for uclass dm and dm clk, so keep the DRAM PLL related setting with legacy clk code which use small ram.

The u-boot-spl.bin now is about 100KB without ddr firmware,usb stack and hab,
so really large......
I am thinking what we could do to shrink the size, welcome any suggestions.

Not expect this patchset could be merged, because of the CCF/clock code change, but since the clock part blocks i.MX8MM upstream, just would like to speed up the development with community and move on.

Peng Fan (40):
   clk: correct get clk_x pointer
   clk: fixed-factor: fix get clk_fixed_factor
   clk: introduce clk_dev_binded
   clk: use clk_dev_binded
   clk-provider: sync more clk flags from Linux Kernel
   cmd: clk: print err value when clk_get_rate failed
   clk: mux: add set parent support
   clk: export mux/divider ops
   clk: add clk-gate support
   divider set rate supporrt
   clk: fixed_rate: export clk_fixed_rate
   clk: fixed_rate: add pre reloc flag
   clk: imx: import clk heplers
   clk: imx: gate2 add set rate
   linux: compat: guard PAGE_SIZE
   drivers: core: use strcmp when find device by name
   ddr: imx8m: fix ddr firmware location when enable SPL OF
   imx: add IMX8MQ kconfig entry
   imx: add IMX8MM kconfig entry
   imx: imx8mm: add clock bindings header
   imx: add i.MX8MM cpu type
   imx: spl: add spl_board_boot_device for i.MX8MM
   imx8m: update imx-regs for i.MX8MM
   imx: add get_cpu_rev support for i.MX8MM
   imx8m: rename clock to clock_imx8mq
   imx8m: restructure clock.h
   imx8m: add clk support for i.MX8MM
   imx8m: soc: probe clk before relocation
   imx8m: add pin header for i.MX8MM
   imx: add i.MX8MM PE property
   imx8m: Fix MMU table issue for OPTEE memory
   imx8m: set BYPASS ID SWAP to avoid AXI bus errors
   imx8m: soc: enable SCTR clock before timer init
   serial: Kconfig: make MXC_UART usable for MX7 and IMX8M
   clk: imx: add Kconfig entry for i.MX8MM
   clk: imx: add pll14xx driver
   clk: add composite clk support
   clk: imx: add i.MX8MM composite clk support
   clk: imx: add i.MX8MM clk driver
   imx: add i.MX8MM EVK board support

Ye Li (1):
   imx8m: Configure trustzone region 0 for non-secure access

  arch/arm/dts/Makefile                              |    3 +- arch/arm/dts/imx8mm-evk-u-boot.dtsi                |   92 + arch/arm/dts/imx8mm-evk.dts                        |  235 +++ arch/arm/dts/imx8mm-pinfunc.h                      |  629 +++++++ arch/arm/dts/imx8mm.dtsi                           |  733 ++++++++ arch/arm/include/asm/arch-imx/cpu.h                |    6 + arch/arm/include/asm/arch-imx8m/clock.h            |  493 +---- arch/arm/include/asm/arch-imx8m/clock_imx8mm.h     |  387 ++++ arch/arm/include/asm/arch-imx8m/clock_imx8mq.h     |  424 +++++ arch/arm/include/asm/arch-imx8m/imx-regs.h         |   75 +- arch/arm/include/asm/arch-imx8m/imx8mm_pins.h      |  691 +++++++ arch/arm/include/asm/mach-imx/iomux-v3.h           |    4 + arch/arm/include/asm/mach-imx/sys_proto.h          |    8 + arch/arm/mach-imx/cpu.c                            |   12 + arch/arm/mach-imx/imx8m/Kconfig                    |   17 +- arch/arm/mach-imx/imx8m/Makefile                   |    4 +- arch/arm/mach-imx/imx8m/clock_imx8mm.c             |  292 +++ .../arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} |    5 +- arch/arm/mach-imx/imx8m/clock_slice.c              |  461 +++++ arch/arm/mach-imx/imx8m/soc.c                      |  112 +- arch/arm/mach-imx/spl.c                            |    8 + board/freescale/imx8mm_evk/Kconfig                 |   12 + board/freescale/imx8mm_evk/MAINTAINERS             |    6 + board/freescale/imx8mm_evk/Makefile                |   12 + board/freescale/imx8mm_evk/imx8mm_evk.c            |   90 + board/freescale/imx8mm_evk/lpddr4_timing.c         | 1980
++++++++++++++++++++
  board/freescale/imx8mm_evk/spl.c                   |  216 +++ cmd/clk.c                                          |    2 + configs/imx8mm_evk_defconfig                       |   52 + drivers/clk/Kconfig                                |   14 + drivers/clk/Makefile                               |    3 +- drivers/clk/clk-composite.c                        |  165 ++ drivers/clk/clk-divider.c                          |   92 +- drivers/clk/clk-fixed-factor.c                     |    2 +- drivers/clk/clk-gate.c                             |  151 ++ drivers/clk/clk-mux.c                              |   76 +- drivers/clk/clk.c                                  |    8 + drivers/clk/clk_fixed_rate.c                       |    9 +- drivers/clk/imx/Kconfig                            |    9 + drivers/clk/imx/Makefile                           |    1 + drivers/clk/imx/clk-composite-8m.c                 |  170 ++ drivers/clk/imx/clk-gate2.c                        |   15 +- drivers/clk/imx/clk-imx8mm.c                       |  415 ++++ drivers/clk/imx/clk-pfd.c                          |    2 +- drivers/clk/imx/clk-pll14xx.c                      |  377 ++++ drivers/clk/imx/clk-pllv3.c                        |    2 +- drivers/clk/imx/clk.h                              |  106 ++ drivers/core/uclass.c                              |    2 +- drivers/ddr/imx/imx8m/helper.c                     |   12 +- drivers/serial/Kconfig                             |    2 +- include/clk.h                                      |    9 + include/configs/imx8mm_evk.h                       |  199 ++ include/dt-bindings/clock/imx8mm-clock.h           |  244 +++ include/linux/clk-provider.h                       |   74 + include/linux/compat.h                             |    2 +

  55 files changed, 8728 insertions(+), 494 deletions(-)

  create mode 100644 arch/arm/dts/imx8mm-evk-u-boot.dtsi create mode 100644 arch/arm/dts/imx8mm-evk.dts
  create mode 100644 arch/arm/dts/imx8mm-pinfunc.h create mode 100644 arch/arm/dts/imx8mm.dtsi
  create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h create mode 100644 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h create mode 100644 arch/arm/mach-imx/imx8m/clock_imx8mm.c rename arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} (99%) create mode 100644 board/freescale/imx8mm_evk/Kconfig create mode 100644 board/freescale/imx8mm_evk/MAINTAINERS create mode 100644 board/freescale/imx8mm_evk/Makefile create mode 100644 board/freescale/imx8mm_evk/imx8mm_evk.c create mode 100644 board/freescale/imx8mm_evk/lpddr4_timing.c create mode 100644 board/freescale/imx8mm_evk/spl.c create mode 100644 configs/imx8mm_evk_defconfig
  create mode 100644 drivers/clk/clk-composite.c
  create mode 100644 drivers/clk/clk-gate.c
  create mode 100644 drivers/clk/imx/clk-composite-8m.c create mode 100644 drivers/clk/imx/clk-imx8mm.c
  create mode 100644 drivers/clk/imx/clk-pll14xx.c create mode 100644 include/configs/imx8mm_evk.h
  create mode 100644 include/dt-bindings/clock/imx8mm-clock.h

author reviewer
#80 lore raw

cover i.MX8MM + CCF

Hi Frieder,

Quoted 8 lines

Subject: Re: [U-Boot] [i.MX8MM+CCF 00/41] i.MX8MM + CCF

Quoted 5 lines · Frieder Schrempf

Hi Peng,

I'm trying to add support for a board with i.MX8MM. First I applied Lukasz's CCF patches and your patches to U-Boot 2019.04 and tried to build imx8mm_evk config. But I'm getting build errors (see below).

Thanks for trying. There was no build error, might be some new change, I'll fix that in new version patchset.

Quoted 4 lines

The build works if I enable the OTP fuse driver and disable I2C support. In clock_imx8mm.c enable_i2c_clk() seems to be missing, or maybe the i2c driver needs to use the new clock framework now?

I have the i2c mxc driver adapted to this new framework, clock is ok, but i2c probe not work as expected, I am still trying to find out what's wrong.

Quoted 7 lines
Quoted 4 lines

Are there any other patches needed?
What things are still missing to get i.MX8MM running in U-Boot?

It seems like this still needs a bit of work. I also see some CONFIG options defined in the headers, that should be moved to defconfig.

I'll clean up those in new version. Since this patchset depends on Lukasz's CCF, so I expect Lukasz's new version patchset, then I'll post new version.

Lukasz,

There are a few CCF fixes that need you to check, or you could take those into your patches.

Thanks,
Peng.

Quoted 243 lines
Quoted 23 lines

Thanks,
Frieder

| aarch64-ktn-linux-ld.bfd: cmd/built-in.o: in function `do_fuse':
| /home/frieder/repos/u-boot/cmd/fuse.c:68: undefined reference to `fuse_read'
| aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:86:
undefined reference to `fuse_sense'
| aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:105:
undefined reference to `fuse_prog'
| aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:119:
undefined reference to `fuse_override'
| aarch64-ktn-linux-ld.bfd: drivers/i2c/built-in.o: in function `mxc_i2c_probe':
| /home/frieder/repos/u-boot/drivers/i2c/mxc_i2c.c:824: undefined reference to `enable_i2c_clk'
| aarch64-ktn-linux-ld.bfd:
/home/frieder/repos/u-boot/drivers/i2c/mxc_i2c.c:853: undefined reference to `enable_i2c_clk'

Quoted 5 lines
Quoted 4 lines · Peng Fan

This patch set is based Lukasz V3 CCF patchset, [PATCH v3 00/11] clk:
Port Linux common clock framework [CCF] to U-boot (tag: 5.0-rc3)
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit

hub.com%2Flmajewski%2Fu-boot-dfu%2Fcommits%2FCCF-v3&amp;data=02 %7C01%

Quoted 1 line
Quoted 1 line

7Cpeng.fan%40nxp.com%7C92e3d4126a6a485ca3e808d6d1fc8fcb%7C686ea 1d3bc2

Quoted 1 line
Quoted 1 line

b4c6fa92cd99c5c301635%7C0%7C0%7C636927280011703542&amp;sdata= 5hIVJtM6

Quoted 69 lines
Quoted 69 lines

PZOy2o3NywWIrI7Ogmgjjz%2B92S1tdFTmTso%3D&amp;reserved=0

Added a few fixes to Lukasz's v3 patchset.
Introduced clk-gate/composite
Added set rate support
Per my understanding, U-Boot CCF will not support mux reparent, and support rate prograte setting to parent automatically. So new clk feature added follow this rule.

There are many warnings when importing linux ccf code, I did not modify them all.

The rest patches are for i.MX8MM, part of legacy clk code are still kept, because we are hard to enable CCF at very early stage, we set malloc space to DRAM when dram initialized in spl stage, so we have limited SRAM for uclass dm and dm clk, so keep the DRAM PLL related setting with legacy clk code which use small ram.

The u-boot-spl.bin now is about 100KB without ddr firmware,usb stack and hab, so really large......
I am thinking what we could do to shrink the size, welcome any suggestions.

Not expect this patchset could be merged, because of the CCF/clock code change, but since the clock part blocks i.MX8MM upstream, just would like to speed up the development with community and move on.

Peng Fan (40):
   clk: correct get clk_x pointer
   clk: fixed-factor: fix get clk_fixed_factor
   clk: introduce clk_dev_binded
   clk: use clk_dev_binded
   clk-provider: sync more clk flags from Linux Kernel
   cmd: clk: print err value when clk_get_rate failed
   clk: mux: add set parent support
   clk: export mux/divider ops
   clk: add clk-gate support
   divider set rate supporrt
   clk: fixed_rate: export clk_fixed_rate
   clk: fixed_rate: add pre reloc flag
   clk: imx: import clk heplers
   clk: imx: gate2 add set rate
   linux: compat: guard PAGE_SIZE
   drivers: core: use strcmp when find device by name
   ddr: imx8m: fix ddr firmware location when enable SPL OF
   imx: add IMX8MQ kconfig entry
   imx: add IMX8MM kconfig entry
   imx: imx8mm: add clock bindings header
   imx: add i.MX8MM cpu type
   imx: spl: add spl_board_boot_device for i.MX8MM
   imx8m: update imx-regs for i.MX8MM
   imx: add get_cpu_rev support for i.MX8MM
   imx8m: rename clock to clock_imx8mq
   imx8m: restructure clock.h
   imx8m: add clk support for i.MX8MM
   imx8m: soc: probe clk before relocation
   imx8m: add pin header for i.MX8MM
   imx: add i.MX8MM PE property
   imx8m: Fix MMU table issue for OPTEE memory
   imx8m: set BYPASS ID SWAP to avoid AXI bus errors
   imx8m: soc: enable SCTR clock before timer init
   serial: Kconfig: make MXC_UART usable for MX7 and IMX8M
   clk: imx: add Kconfig entry for i.MX8MM
   clk: imx: add pll14xx driver
   clk: add composite clk support
   clk: imx: add i.MX8MM composite clk support
   clk: imx: add i.MX8MM clk driver
   imx: add i.MX8MM EVK board support

Quoted 4 lines
Quoted 4 lines

Ye Li (1):
   imx8m: Configure trustzone region 0 for non-secure access

  arch/arm/dts/Makefile                              |

   3 +-

Quoted 1 line
Quoted 1 line

  arch/arm/dts/imx8mm-evk-u-boot.dtsi                |   92

+

Quoted 1 line
Quoted 1 line

  arch/arm/dts/imx8mm-evk.dts                        |

235 +++

Quoted 1 line
Quoted 1 line

  arch/arm/dts/imx8mm-pinfunc.h                      |

629 +++++++

Quoted 1 line
Quoted 1 line

  arch/arm/dts/imx8mm.dtsi                           |

733 ++++++++

Quoted 1 line
Quoted 1 line

  arch/arm/include/asm/arch-imx/cpu.h                |

6 +

Quoted 1 line
Quoted 1 line

  arch/arm/include/asm/arch-imx8m/clock.h            |  493

+----
>>   arch/arm/include/asm/arch-imx8m/clock_imx8mm.h     |  387

++++

Quoted 1 line
Quoted 1 line

  arch/arm/include/asm/arch-imx8m/clock_imx8mq.h     |  424

+++++

Quoted 2 lines
Quoted 2 lines

  arch/arm/include/asm/arch-imx8m/imx-regs.h         |   75 +- arch/arm/include/asm/arch-imx8m/imx8mm_pins.h      |  691

+++++++

Quoted 1 line
Quoted 1 line

  arch/arm/include/asm/mach-imx/iomux-v3.h           |    4

+

Quoted 2 lines
Quoted 2 lines

  arch/arm/include/asm/mach-imx/sys_proto.h          |    8 + arch/arm/mach-imx/cpu.c                            |

   12 +

Quoted 1 line
Quoted 1 line

  arch/arm/mach-imx/imx8m/Kconfig                    |

17 +-

Quoted 1 line
Quoted 1 line

  arch/arm/mach-imx/imx8m/Makefile                   |

  4 +-

Quoted 1 line
Quoted 1 line

  arch/arm/mach-imx/imx8m/clock_imx8mm.c             |  2

92 +++

Quoted 2 lines
Quoted 2 lines

  .../arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} |    5 +- arch/arm/mach-imx/imx8m/clock_slice.c              |  461

+++++

Quoted 1 line
Quoted 1 line

  arch/arm/mach-imx/imx8m/soc.c                      |

112 +-

Quoted 1 line
Quoted 1 line

  arch/arm/mach-imx/spl.c                            |

   8 +

Quoted 1 line
Quoted 1 line

  board/freescale/imx8mm_evk/Kconfig                 |   1

2 +

Quoted 1 line
Quoted 1 line

  board/freescale/imx8mm_evk/MAINTAINERS             |

6 +

Quoted 1 line
Quoted 1 line

  board/freescale/imx8mm_evk/Makefile                |   1

2 +

Quoted 1 line
Quoted 1 line

  board/freescale/imx8mm_evk/imx8mm_evk.c            |   9

0 +

Quoted 3 lines
Quoted 3 lines

  board/freescale/imx8mm_evk/lpddr4_timing.c         | 1980
++++++++++++++++++++
  board/freescale/imx8mm_evk/spl.c                   |  21

6 +++

Quoted 1 line
Quoted 1 line

  cmd/clk.c

  |    2 +

Quoted 1 line
Quoted 1 line

  configs/imx8mm_evk_defconfig                       |

52 +

Quoted 1 line
Quoted 1 line

  drivers/clk/Kconfig                                |

14 +

Quoted 1 line
Quoted 1 line

  drivers/clk/Makefile                               |

   3 +-

Quoted 1 line
Quoted 1 line

  drivers/clk/clk-composite.c                        |  165

++

Quoted 1 line
Quoted 1 line

  drivers/clk/clk-divider.c                          |   92

+-
>>   drivers/clk/clk-fixed-factor.c                     |    2 +-
>>   drivers/clk/clk-gate.c                             |  1

51 ++

Quoted 1 line
Quoted 1 line

  drivers/clk/clk-mux.c                              |

76 +-

Quoted 1 line
Quoted 1 line

  drivers/clk/clk.c                                  |

   8 +

Quoted 1 line
Quoted 1 line

  drivers/clk/clk_fixed_rate.c                       |    9

+-
>>   drivers/clk/imx/Kconfig                            |

9 +

Quoted 1 line
Quoted 1 line

  drivers/clk/imx/Makefile                           |

  1 +

Quoted 1 line
Quoted 1 line

  drivers/clk/imx/clk-composite-8m.c                 |  170

++

Quoted 1 line
Quoted 1 line

  drivers/clk/imx/clk-gate2.c                        |   15

+-
>>   drivers/clk/imx/clk-imx8mm.c                       |  4

15 ++++

Quoted 1 line
Quoted 1 line

  drivers/clk/imx/clk-pfd.c                          |

2 +-

Quoted 1 line
Quoted 1 line

  drivers/clk/imx/clk-pll14xx.c                      |  377

++++

Quoted 1 line
Quoted 1 line

  drivers/clk/imx/clk-pllv3.c                        |    2

+-
>>   drivers/clk/imx/clk.h                              |

106 ++

Quoted 1 line
Quoted 1 line

  drivers/core/uclass.c                              |

  2 +-

Quoted 1 line
Quoted 1 line

  drivers/ddr/imx/imx8m/helper.c                     |   1

2 +-

Quoted 1 line
Quoted 1 line

  drivers/serial/Kconfig                             |

2 +-

Quoted 1 line
Quoted 1 line

  include/clk.h

|    9 +

Quoted 1 line
Quoted 1 line

  include/configs/imx8mm_evk.h                       |  1

99 ++

Quoted 1 line
Quoted 1 line

  include/dt-bindings/clock/imx8mm-clock.h           |  244

+++

Quoted 1 line
Quoted 1 line

  include/linux/clk-provider.h                       |   74

+

Quoted 1 line
Quoted 1 line

  include/linux/compat.h                             |

  2 +

Quoted 6 lines
Quoted 6 lines
  55 files changed, 8728 insertions(+), 494 deletions(-)

  create mode 100644 arch/arm/dts/imx8mm-evk-u-boot.dtsi create mode 100644 arch/arm/dts/imx8mm-evk.dts create mode 100644 arch/arm/dts/imx8mm-pinfunc.h create mode 100644 arch/arm/dts/imx8mm.dtsi create mode 100644

arch/arm/include/asm/arch-imx8m/clock_imx8mm.h

Quoted 1 line
Quoted 1 line

  create mode 100644

arch/arm/include/asm/arch-imx8m/clock_imx8mq.h

Quoted 1 line
Quoted 1 line

  create mode 100644

arch/arm/include/asm/arch-imx8m/imx8mm_pins.h

Quoted 2 lines
Quoted 2 lines

  create mode 100644 arch/arm/mach-imx/imx8m/clock_imx8mm.c rename arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c}

(99%)

Quoted 15 lines
Quoted 15 lines

  create mode 100644 board/freescale/imx8mm_evk/Kconfig create mode 100644 board/freescale/imx8mm_evk/MAINTAINERS create mode 100644 board/freescale/imx8mm_evk/Makefile create mode 100644 board/freescale/imx8mm_evk/imx8mm_evk.c create mode 100644 board/freescale/imx8mm_evk/lpddr4_timing.c create mode 100644 board/freescale/imx8mm_evk/spl.c create mode 100644 configs/imx8mm_evk_defconfig create mode 100644 drivers/clk/clk-composite.c create mode 100644 drivers/clk/clk-gate.c
  create mode 100644 drivers/clk/imx/clk-composite-8m.c create mode 100644 drivers/clk/imx/clk-imx8mm.c create mode 100644 drivers/clk/imx/clk-pll14xx.c create mode 100644 include/configs/imx8mm_evk.h create mode 100644 include/dt-bindings/clock/imx8mm-clock.h

#81 lore raw

cover i.MX8MM + CCF

Quoted 33 lines · On Mon, 6 May 2019 09:08:46 +0000 Peng Fan <[email protected]> wrote:

Hi Frieder,

Quoted 9 lines

Subject: Re: [U-Boot] [i.MX8MM+CCF 00/41] i.MX8MM + CCF

Quoted 6 lines · Frieder Schrempf

Hi Peng,

I'm trying to add support for a board with i.MX8MM. First I applied Lukasz's CCF patches and your patches to U-Boot 2019.04 and tried to build imx8mm_evk config. But I'm getting build errors (see below).

Thanks for trying. There was no build error, might be some new change, I'll fix that in new version patchset.

Quoted 4 lines

The build works if I enable the OTP fuse driver and disable I2C support. In clock_imx8mm.c enable_i2c_clk() seems to be missing, or maybe the i2c driver needs to use the new clock framework now?

I have the i2c mxc driver adapted to this new framework, clock is ok, but i2c probe not work as expected, I am still trying to find out what's wrong.

Quoted 8 lines
Quoted 4 lines

Are there any other patches needed?
What things are still missing to get i.MX8MM running in U-Boot?

It seems like this still needs a bit of work. I also see some CONFIG options defined in the headers, that should be moved to defconfig.

Quoted 8 lines

I'll clean up those in new version. Since this patchset depends on Lukasz's CCF, so I expect Lukasz's new version patchset, then I'll post new version.

Lukasz,

There are a few CCF fixes that need you to check, or you could take those into your patches.

Till the end of today I will review your patches. As I did not received any more feedback regarding last posted patches - I will add the cached clock stuff and repost them.

(I'm out of office from 09.05 - 14.05, so I want to repost my patches by then to not block the development).

Quoted 249 lines

Thanks,
Peng.

Quoted 245 lines
Quoted 23 lines

Thanks,
Frieder

| aarch64-ktn-linux-ld.bfd: cmd/built-in.o: in function `do_fuse':
| /home/frieder/repos/u-boot/cmd/fuse.c:68: undefined reference to `fuse_read'
|
aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:86:
undefined reference to `fuse_sense' | aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:105:
undefined reference to `fuse_prog' | aarch64-ktn-linux-ld.bfd: /home/frieder/repos/u-boot/cmd/fuse.c:119:
undefined reference to fuse_override' | aarch64-ktn-linux-ld.bfd: drivers/i2c/built-in.o: in function mxc_i2c_probe':
| /home/frieder/repos/u-boot/drivers/i2c/mxc_i2c.c:824: undefined reference to `enable_i2c_clk' | aarch64-ktn-linux-ld.bfd:
/home/frieder/repos/u-boot/drivers/i2c/mxc_i2c.c:853: undefined reference to `enable_i2c_clk'

Quoted 5 lines
Quoted 4 lines · Peng Fan

This patch set is based Lukasz V3 CCF patchset, [PATCH v3 00/11]
clk: Port Linux common clock framework [CCF] to U-boot (tag:
5.0-rc3)
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit

hub.com%2Flmajewski%2Fu-boot-dfu%2Fcommits%2FCCF-v3&amp;data=02 %7C01%

Quoted 1 line
Quoted 1 line

7Cpeng.fan%40nxp.com%7C92e3d4126a6a485ca3e808d6d1fc8fcb%7C686ea 1d3bc2

Quoted 1 line
Quoted 1 line

b4c6fa92cd99c5c301635%7C0%7C0%7C636927280011703542&amp;sdata= 5hIVJtM6

Quoted 71 lines
Quoted 71 lines

PZOy2o3NywWIrI7Ogmgjjz%2B92S1tdFTmTso%3D&amp;reserved=0

Added a few fixes to Lukasz's v3 patchset.
Introduced clk-gate/composite
Added set rate support
Per my understanding, U-Boot CCF will not support mux reparent, and support rate prograte setting to parent automatically. So new clk feature added follow this rule.

There are many warnings when importing linux ccf code, I did not modify them all.

The rest patches are for i.MX8MM, part of legacy clk code are still kept, because we are hard to enable CCF at very early stage, we set malloc space to DRAM when dram initialized in spl stage, so we have limited SRAM for uclass dm and dm clk, so keep the DRAM PLL related setting with legacy clk code which use small ram.

The u-boot-spl.bin now is about 100KB without ddr firmware,usb stack and hab, so really large......
I am thinking what we could do to shrink the size, welcome any suggestions.

Not expect this patchset could be merged, because of the CCF/clock code change, but since the clock part blocks i.MX8MM upstream, just would like to speed up the development with community and move on.

Peng Fan (40):
   clk: correct get clk_x pointer
   clk: fixed-factor: fix get clk_fixed_factor
   clk: introduce clk_dev_binded
   clk: use clk_dev_binded
   clk-provider: sync more clk flags from Linux Kernel
   cmd: clk: print err value when clk_get_rate failed
   clk: mux: add set parent support
   clk: export mux/divider ops
   clk: add clk-gate support
   divider set rate supporrt
   clk: fixed_rate: export clk_fixed_rate
   clk: fixed_rate: add pre reloc flag
   clk: imx: import clk heplers
   clk: imx: gate2 add set rate
   linux: compat: guard PAGE_SIZE
   drivers: core: use strcmp when find device by name
   ddr: imx8m: fix ddr firmware location when enable SPL OF
   imx: add IMX8MQ kconfig entry
   imx: add IMX8MM kconfig entry
   imx: imx8mm: add clock bindings header
   imx: add i.MX8MM cpu type
   imx: spl: add spl_board_boot_device for i.MX8MM
   imx8m: update imx-regs for i.MX8MM
   imx: add get_cpu_rev support for i.MX8MM
   imx8m: rename clock to clock_imx8mq
   imx8m: restructure clock.h
   imx8m: add clk support for i.MX8MM
   imx8m: soc: probe clk before relocation
   imx8m: add pin header for i.MX8MM
   imx: add i.MX8MM PE property
   imx8m: Fix MMU table issue for OPTEE memory
   imx8m: set BYPASS ID SWAP to avoid AXI bus errors
   imx8m: soc: enable SCTR clock before timer init
   serial: Kconfig: make MXC_UART usable for MX7 and IMX8M
   clk: imx: add Kconfig entry for i.MX8MM
   clk: imx: add pll14xx driver
   clk: add composite clk support
   clk: imx: add i.MX8MM composite clk support
   clk: imx: add i.MX8MM clk driver
   imx: add i.MX8MM EVK board support

Quoted 4 lines
Quoted 4 lines

Ye Li (1):
   imx8m: Configure trustzone region 0 for non-secure access

  arch/arm/dts/Makefile                              |

   3 +-

Quoted 1 line
Quoted 1 line

  arch/arm/dts/imx8mm-evk-u-boot.dtsi                |   92

+

Quoted 1 line
Quoted 1 line

  arch/arm/dts/imx8mm-evk.dts                        |

235 +++

Quoted 1 line
Quoted 1 line

  arch/arm/dts/imx8mm-pinfunc.h                      |

629 +++++++

Quoted 1 line
Quoted 1 line

  arch/arm/dts/imx8mm.dtsi                           |

733 ++++++++

Quoted 1 line
Quoted 1 line

  arch/arm/include/asm/arch-imx/cpu.h                |

6 +

Quoted 1 line
Quoted 1 line

  arch/arm/include/asm/arch-imx8m/clock.h            |  493

+----  
>>   arch/arm/include/asm/arch-imx8m/clock_imx8mm.h     |  387  
++++  
>>   arch/arm/include/asm/arch-imx8m/clock_imx8mq.h     |  424  
+++++  
>>   arch/arm/include/asm/arch-imx8m/imx-regs.h         |   75 +-
>>   arch/arm/include/asm/arch-imx8m/imx8mm_pins.h      |  691  
+++++++  
>>   arch/arm/include/asm/mach-imx/iomux-v3.h           |    4  
+  
>>   arch/arm/include/asm/mach-imx/sys_proto.h          |    8 +
>>   arch/arm/mach-imx/cpu.c                            |  
   12 +  
>>   arch/arm/mach-imx/imx8m/Kconfig                    |  
 17 +-  
>>   arch/arm/mach-imx/imx8m/Makefile                   |  
  4 +-  
>>   arch/arm/mach-imx/imx8m/clock_imx8mm.c             |  2  
92 +++  
>>   .../arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} |    5 +-
>>   arch/arm/mach-imx/imx8m/clock_slice.c              |  461  
+++++  
>>   arch/arm/mach-imx/imx8m/soc.c                      |  
 112 +-  
>>   arch/arm/mach-imx/spl.c                            |  
   8 +  
>>   board/freescale/imx8mm_evk/Kconfig                 |   1  
2 +  
>>   board/freescale/imx8mm_evk/MAINTAINERS             |  
 6 +  
>>   board/freescale/imx8mm_evk/Makefile                |   1  
2 +  
>>   board/freescale/imx8mm_evk/imx8mm_evk.c            |   9  
0 +  
>>   board/freescale/imx8mm_evk/lpddr4_timing.c         | 1980
Quoted 2 lines
Quoted 2 lines

++++++++++++++++++++
  board/freescale/imx8mm_evk/spl.c                   |  21

6 +++

Quoted 1 line
Quoted 1 line

  cmd/clk.c

  |    2 +

Quoted 1 line
Quoted 1 line

  configs/imx8mm_evk_defconfig                       |

52 +

Quoted 1 line
Quoted 1 line

  drivers/clk/Kconfig                                |

14 +

Quoted 1 line
Quoted 1 line

  drivers/clk/Makefile                               |

   3 +-

Quoted 1 line
Quoted 1 line

  drivers/clk/clk-composite.c                        |  165

++

Quoted 1 line
Quoted 1 line

  drivers/clk/clk-divider.c                          |   92

+-  
>>   drivers/clk/clk-fixed-factor.c                     |    2 +-
>>   drivers/clk/clk-gate.c                             |  1  
51 ++  
>>   drivers/clk/clk-mux.c                              |  
 76 +-  
>>   drivers/clk/clk.c                                  |  
   8 +  
>>   drivers/clk/clk_fixed_rate.c                       |    9  
+-  
>>   drivers/clk/imx/Kconfig                            |  
 9 +  
>>   drivers/clk/imx/Makefile                           |  
  1 +  
>>   drivers/clk/imx/clk-composite-8m.c                 |  170  
++  
>>   drivers/clk/imx/clk-gate2.c                        |   15  
+-  
>>   drivers/clk/imx/clk-imx8mm.c                       |  4  
15 ++++  
>>   drivers/clk/imx/clk-pfd.c                          |  
2 +-  
>>   drivers/clk/imx/clk-pll14xx.c                      |  377  
++++  
>>   drivers/clk/imx/clk-pllv3.c                        |    2  
+-  
>>   drivers/clk/imx/clk.h                              |  
106 ++  
>>   drivers/core/uclass.c                              |  
  2 +-  
>>   drivers/ddr/imx/imx8m/helper.c                     |   1  
2 +-  
>>   drivers/serial/Kconfig                             |  
 2 +-  
>>   include/clk.h  
|    9 +  
>>   include/configs/imx8mm_evk.h                       |  1  
99 ++  
>>   include/dt-bindings/clock/imx8mm-clock.h           |  244  
+++  
>>   include/linux/clk-provider.h                       |   74  
+  
>>   include/linux/compat.h                             |  
  2 +  
Quoted 6 lines
Quoted 6 lines
  55 files changed, 8728 insertions(+), 494 deletions(-)

  create mode 100644 arch/arm/dts/imx8mm-evk-u-boot.dtsi create mode 100644 arch/arm/dts/imx8mm-evk.dts create mode 100644 arch/arm/dts/imx8mm-pinfunc.h create mode 100644 arch/arm/dts/imx8mm.dtsi create mode 100644

arch/arm/include/asm/arch-imx8m/clock_imx8mm.h

Quoted 1 line
Quoted 1 line

  create mode 100644

arch/arm/include/asm/arch-imx8m/clock_imx8mq.h

Quoted 1 line
Quoted 1 line

  create mode 100644

arch/arm/include/asm/arch-imx8m/imx8mm_pins.h

Quoted 2 lines
Quoted 2 lines

  create mode 100644 arch/arm/mach-imx/imx8m/clock_imx8mm.c rename arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c}

(99%)

Quoted 15 lines
Quoted 15 lines

  create mode 100644 board/freescale/imx8mm_evk/Kconfig create mode 100644 board/freescale/imx8mm_evk/MAINTAINERS create mode 100644 board/freescale/imx8mm_evk/Makefile create mode 100644 board/freescale/imx8mm_evk/imx8mm_evk.c create mode 100644 board/freescale/imx8mm_evk/lpddr4_timing.c create mode 100644 board/freescale/imx8mm_evk/spl.c create mode 100644 configs/imx8mm_evk_defconfig create mode 100644 drivers/clk/clk-composite.c create mode 100644 drivers/clk/clk-gate.c
  create mode 100644 drivers/clk/imx/clk-composite-8m.c create mode 100644 drivers/clk/imx/clk-imx8mm.c create mode 100644 drivers/clk/imx/clk-pll14xx.c create mode 100644 include/configs/imx8mm_evk.h create mode 100644 include/dt-bindings/clock/imx8mm-clock.h

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190506/4b77d175/attachment.sig>

#82 lore raw

cover i.MX8MM + CCF

In reply to Peng Fan

Hi Peng,

Quoted 10 lines

This patch set is based Lukasz V3 CCF patchset,
[PATCH v3 00/11] clk: Port Linux common clock framework [CCF] to U-boot (tag: 5.0-rc3)
https://github.com/lmajewski/u-boot-dfu/commits/CCF-v3

Added a few fixes to Lukasz's v3 patchset.
Introduced clk-gate/composite
Added set rate support
Per my understanding, U-Boot CCF will not support mux reparent, and support rate prograte setting to parent automatically.

I think that we shall keep the code as small as possible and hence add only necessary features (that is why my code only supports gating and muxing for 'downstream' settings).

Quoted 5 lines

So new clk
feature added follow this rule.

There are many warnings when importing linux ccf code, I did not modify them all.

I've removed some not needed arguments (like spinlocks) when porting the code.

Quoted 3 lines

The rest patches are for i.MX8MM, part of legacy clk code are still kept, because we are hard to enable CCF at very early stage,

Yes, CCF in SPL is a challenging task.

Quoted 3 lines

we set
malloc space to DRAM when dram initialized in spl stage, so we have limited SRAM for uclass dm and dm clk,

I'm puzzled about this sentence. The malloc is set to be in DRAM, but also SRAM is used for uclass dm and CCF.

As fair as I remember on iMX6Q it is possible to setup early malloc to be in SRAM (OCRAM). Having it in DRAM is a bit late, IMHO as clocks are already setup in this moment.

Quoted 2 lines

so keep the DRAM PLL related
setting with legacy clk code which use small ram.

What is the 'ram' ? I suppose that the legacy clk code uses OCRAM to allocate variables ?

Quoted 3 lines

The u-boot-spl.bin now is about 100KB without ddr firmware,usb stack and hab, so really large......

I think that 100KiB is too much (without DDR, USB stack and HAB). For one IMX6Q setup (before DM/DTS conversion) I had SPL size ~30 KiB.

After the conversion it is 55 KiB ...

Quoted 2 lines

I am thinking what we could do to shrink the size, welcome any suggestions.

Please consider using:

- TINY_PRINTF
- TINY_FIT support (just support for single image in FIT)
- OF_PLATDATA (the in-device-tree code is compiled in as C structures) - no need to include DTS parsing / handling code in SPL. Also the *.dts file is not needed.

Drawback is that you need to extend drivers to support OF_PLATDATA (RK3399 have some examples of such approach).

- Check if thumb2 is uses for SPL compilation
- I simply do find *.o files and sort them regarding the size. Then I do know where to start with optimisations.

Quoted 124 lines

Not expect this patchset could be merged, because of the CCF/clock code change, but since the clock part blocks i.MX8MM upstream, just would like to speed up the development with community and move on.

Peng Fan (40):
clk: correct get clk_x pointer
clk: fixed-factor: fix get clk_fixed_factor
clk: introduce clk_dev_binded
clk: use clk_dev_binded
clk-provider: sync more clk flags from Linux Kernel
cmd: clk: print err value when clk_get_rate failed
clk: mux: add set parent support
clk: export mux/divider ops
clk: add clk-gate support
divider set rate supporrt
clk: fixed_rate: export clk_fixed_rate
clk: fixed_rate: add pre reloc flag
clk: imx: import clk heplers
clk: imx: gate2 add set rate
linux: compat: guard PAGE_SIZE
drivers: core: use strcmp when find device by name
ddr: imx8m: fix ddr firmware location when enable SPL OF
imx: add IMX8MQ kconfig entry
imx: add IMX8MM kconfig entry
imx: imx8mm: add clock bindings header
imx: add i.MX8MM cpu type
imx: spl: add spl_board_boot_device for i.MX8MM
imx8m: update imx-regs for i.MX8MM
imx: add get_cpu_rev support for i.MX8MM
imx8m: rename clock to clock_imx8mq
imx8m: restructure clock.h
imx8m: add clk support for i.MX8MM
imx8m: soc: probe clk before relocation
imx8m: add pin header for i.MX8MM
imx: add i.MX8MM PE property
imx8m: Fix MMU table issue for OPTEE memory
imx8m: set BYPASS ID SWAP to avoid AXI bus errors
imx8m: soc: enable SCTR clock before timer init
serial: Kconfig: make MXC_UART usable for MX7 and IMX8M
clk: imx: add Kconfig entry for i.MX8MM
clk: imx: add pll14xx driver
clk: add composite clk support
clk: imx: add i.MX8MM composite clk support
clk: imx: add i.MX8MM clk driver
imx: add i.MX8MM EVK board support

Ye Li (1):
imx8m: Configure trustzone region 0 for non-secure access

 arch/arm/dts/Makefile                              |    3 +-
 arch/arm/dts/imx8mm-evk-u-boot.dtsi                |   92 +
 arch/arm/dts/imx8mm-evk.dts                        |  235 +++
 arch/arm/dts/imx8mm-pinfunc.h                      |  629 +++++++
 arch/arm/dts/imx8mm.dtsi                           |  733 ++++++++
 arch/arm/include/asm/arch-imx/cpu.h                |    6 +
 arch/arm/include/asm/arch-imx8m/clock.h            |  493 +----
 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h     |  387 ++++
 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h     |  424 +++++
 arch/arm/include/asm/arch-imx8m/imx-regs.h         |   75 +-
 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h      |  691 +++++++
 arch/arm/include/asm/mach-imx/iomux-v3.h           |    4 +
 arch/arm/include/asm/mach-imx/sys_proto.h          |    8 +
 arch/arm/mach-imx/cpu.c                            |   12 +
 arch/arm/mach-imx/imx8m/Kconfig                    |   17 +-
 arch/arm/mach-imx/imx8m/Makefile                   |    4 +-
 arch/arm/mach-imx/imx8m/clock_imx8mm.c             |  292 +++
 .../arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} |    5 +-
 arch/arm/mach-imx/imx8m/clock_slice.c              |  461 +++++
 arch/arm/mach-imx/imx8m/soc.c                      |  112 +-
 arch/arm/mach-imx/spl.c                            |    8 +
 board/freescale/imx8mm_evk/Kconfig                 |   12 +
 board/freescale/imx8mm_evk/MAINTAINERS             |    6 +
 board/freescale/imx8mm_evk/Makefile                |   12 +
 board/freescale/imx8mm_evk/imx8mm_evk.c            |   90 +
 board/freescale/imx8mm_evk/lpddr4_timing.c         | 1980
++++++++++++++++++++
board/freescale/imx8mm_evk/spl.c                   |  216 +++
cmd/clk.c                                          |    2 +
configs/imx8mm_evk_defconfig                       |   52 +
drivers/clk/Kconfig                                |   14 +
drivers/clk/Makefile                               |    3 +-
drivers/clk/clk-composite.c                        |  165 ++
drivers/clk/clk-divider.c                          |   92 +-
drivers/clk/clk-fixed-factor.c                     |    2 +-
drivers/clk/clk-gate.c                             |  151 ++
drivers/clk/clk-mux.c                              |   76 +-
drivers/clk/clk.c                                  |    8 +
drivers/clk/clk_fixed_rate.c                       |    9 +-
drivers/clk/imx/Kconfig                            |    9 +
drivers/clk/imx/Makefile                           |    1 +
drivers/clk/imx/clk-composite-8m.c                 |  170 ++
drivers/clk/imx/clk-gate2.c                        |   15 +-
drivers/clk/imx/clk-imx8mm.c                       |  415 ++++
drivers/clk/imx/clk-pfd.c                          |    2 +-
drivers/clk/imx/clk-pll14xx.c                      |  377 ++++
drivers/clk/imx/clk-pllv3.c                        |    2 +-
drivers/clk/imx/clk.h                              |  106 ++
drivers/core/uclass.c                              |    2 +-
drivers/ddr/imx/imx8m/helper.c                     |   12 +-
drivers/serial/Kconfig                             |    2 +-
include/clk.h                                      |    9 +
include/configs/imx8mm_evk.h                       |  199 ++
include/dt-bindings/clock/imx8mm-clock.h           |  244 +++
include/linux/clk-provider.h                       |   74 +
include/linux/compat.h                             |    2 + 55 files

changed, 8728 insertions(+), 494 deletions(-) create mode 100644 arch/arm/dts/imx8mm-evk-u-boot.dtsi create mode 100644 arch/arm/dts/imx8mm-evk.dts create mode 100644 arch/arm/dts/imx8mm-pinfunc.h create mode 100644 arch/arm/dts/imx8mm.dtsi create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h create mode 100644 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h create mode 100644 arch/arm/mach-imx/imx8m/clock_imx8mm.c rename arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} (99%) create mode 100644 board/freescale/imx8mm_evk/Kconfig create mode 100644 board/freescale/imx8mm_evk/MAINTAINERS create mode 100644 board/freescale/imx8mm_evk/Makefile create mode 100644 board/freescale/imx8mm_evk/imx8mm_evk.c create mode 100644 board/freescale/imx8mm_evk/lpddr4_timing.c create mode 100644 board/freescale/imx8mm_evk/spl.c create mode 100644 configs/imx8mm_evk_defconfig create mode 100644 drivers/clk/clk-composite.c create mode 100644 drivers/clk/clk-gate.c

Quoted 6 lines
 create mode 100644 drivers/clk/imx/clk-composite-8m.c
 create mode 100644 drivers/clk/imx/clk-imx8mm.c
 create mode 100644 drivers/clk/imx/clk-pll14xx.c
 create mode 100644 include/configs/imx8mm_evk.h
 create mode 100644 include/dt-bindings/clock/imx8mm-clock.h

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190506/6668a266/attachment.sig>

author reviewer
#83 lore raw

cover i.MX8MM + CCF

Quoted 14 lines

Subject: Re: [i.MX8MM+CCF 00/41] i.MX8MM + CCF

Hi Peng,

Quoted 9 lines

This patch set is based Lukasz V3 CCF patchset, [PATCH v3 00/11] clk:
Port Linux common clock framework [CCF] to U-boot (tag: 5.0-rc3)
https://github.com/lmajewski/u-boot-dfu/commits/CCF-v3

Added a few fixes to Lukasz's v3 patchset.
Introduced clk-gate/composite
Added set rate support
Per my understanding, U-Boot CCF will not support mux reparent, and support rate prograte setting to parent automatically.

Quoted 3 lines

I think that we shall keep the code as small as possible and hence add only necessary features (that is why my code only supports gating and muxing for 'downstream' settings).

I understand. But when we want to set freq, we need set mux, set divider. I suggest add kconfig entry for each clk-xx.c and ro/rw ops.

Quoted 9 lines
Quoted 6 lines

So new clk
feature added follow this rule.

There are many warnings when importing linux ccf code, I did not modify them all.

I've removed some not needed arguments (like spinlocks) when porting the code.

I just set to NULL.

Quoted 5 lines
Quoted 4 lines

The rest patches are for i.MX8MM, part of legacy clk code are still kept, because we are hard to enable CCF at very early stage,

Quoted 8 lines

Yes, CCF in SPL is a challenging task.

Quoted 3 lines

we set
malloc space to DRAM when dram initialized in spl stage, so we have limited SRAM for uclass dm and dm clk,

I'm puzzled about this sentence. The malloc is set to be in DRAM, but also SRAM is used for uclass dm and CCF.

CONFIG_SYS_SPL_MALLOC_START is set to DRAM space.

Quoted 4 lines

As fair as I remember on iMX6Q it is possible to setup early malloc to be in SRAM (OCRAM). Having it in DRAM is a bit late, IMHO as clocks are already setup in this moment.

We do dram initialization in spl board_init_f. Using CCF to configure dram clock is complicated and kernel clock driver not have that, I need add it to uboot if choose use CCF to configure the dram clock.
However use original clock code to set dram clock is simpler and cleaner.

Quoted 6 lines
Quoted 3 lines

so keep the DRAM PLL related
setting with legacy clk code which use small ram.

What is the 'ram' ? I suppose that the legacy clk code uses OCRAM to allocate variables ?

Yes.

Quoted 9 lines
Quoted 4 lines

The u-boot-spl.bin now is about 100KB without ddr firmware,usb stack and hab, so really large......

I think that 100KiB is too much (without DDR, USB stack and HAB). For one IMX6Q setup (before DM/DTS conversion) I had SPL size ~30 KiB.

After the conversion it is 55 KiB ...

I'll check more, but mostly DM related code. The DM CCF related code cost about 15KB space.

Quoted 12 lines
Quoted 3 lines

I am thinking what we could do to shrink the size, welcome any suggestions.

Please consider using:

- TINY_PRINTF
- TINY_FIT support (just support for single image in FIT)
- OF_PLATDATA (the in-device-tree code is compiled in as C structures) - no need to include DTS parsing / handling code in SPL. Also the *.dts file is not needed.

Quoted 6 lines

Drawback is that you need to extend drivers to support OF_PLATDATA (RK3399 have some examples of such approach).

- Check if thumb2 is uses for SPL compilation
- I simply do find *.o files and sort them regarding the size. Then I do know where to start with optimisations.

Thanks for suggestions.

Thanks,
Peng.

Quoted 151 lines
Quoted 48 lines

Not expect this patchset could be merged, because of the CCF/clock code change, but since the clock part blocks i.MX8MM upstream, just would like to speed up the development with community and move on.

Peng Fan (40):
clk: correct get clk_x pointer
clk: fixed-factor: fix get clk_fixed_factor
clk: introduce clk_dev_binded
clk: use clk_dev_binded
clk-provider: sync more clk flags from Linux Kernel
cmd: clk: print err value when clk_get_rate failed
clk: mux: add set parent support
clk: export mux/divider ops
clk: add clk-gate support
divider set rate supporrt
clk: fixed_rate: export clk_fixed_rate
clk: fixed_rate: add pre reloc flag
clk: imx: import clk heplers
clk: imx: gate2 add set rate
linux: compat: guard PAGE_SIZE
drivers: core: use strcmp when find device by name
ddr: imx8m: fix ddr firmware location when enable SPL OF
imx: add IMX8MQ kconfig entry
imx: add IMX8MM kconfig entry
imx: imx8mm: add clock bindings header
imx: add i.MX8MM cpu type
imx: spl: add spl_board_boot_device for i.MX8MM
imx8m: update imx-regs for i.MX8MM
imx: add get_cpu_rev support for i.MX8MM
imx8m: rename clock to clock_imx8mq
imx8m: restructure clock.h
imx8m: add clk support for i.MX8MM
imx8m: soc: probe clk before relocation
imx8m: add pin header for i.MX8MM
imx: add i.MX8MM PE property
imx8m: Fix MMU table issue for OPTEE memory
imx8m: set BYPASS ID SWAP to avoid AXI bus errors
imx8m: soc: enable SCTR clock before timer init
serial: Kconfig: make MXC_UART usable for MX7 and IMX8M
clk: imx: add Kconfig entry for i.MX8MM
clk: imx: add pll14xx driver
clk: add composite clk support
clk: imx: add i.MX8MM composite clk support
clk: imx: add i.MX8MM clk driver
imx: add i.MX8MM EVK board support

Quoted 7 lines

Ye Li (1):
imx8m: Configure trustzone region 0 for non-secure access

 arch/arm/dts/Makefile                              |    3 +-
 arch/arm/dts/imx8mm-evk-u-boot.dtsi                |   92 +
 arch/arm/dts/imx8mm-evk.dts                        |  235 +++
 arch/arm/dts/imx8mm-pinfunc.h                      |  629

+++++++

Quoted 1 line
 arch/arm/dts/imx8mm.dtsi                           |  733

++++++++

Quoted 6 lines
 arch/arm/include/asm/arch-imx/cpu.h                |    6 +
 arch/arm/include/asm/arch-imx8m/clock.h            |  493 +----
 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h     |  387 ++++
 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h     |  424 +++++
 arch/arm/include/asm/arch-imx8m/imx-regs.h         |   75 +-
 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h      |  691

+++++++

Quoted 37 lines
 arch/arm/include/asm/mach-imx/iomux-v3.h           |    4 +
 arch/arm/include/asm/mach-imx/sys_proto.h          |    8 +
 arch/arm/mach-imx/cpu.c                            |   12 +
 arch/arm/mach-imx/imx8m/Kconfig                    |   17 +-
 arch/arm/mach-imx/imx8m/Makefile                   |    4 +-
 arch/arm/mach-imx/imx8m/clock_imx8mm.c             |  292 +++
 .../arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} |    5 +-
 arch/arm/mach-imx/imx8m/clock_slice.c              |  461 +++++
 arch/arm/mach-imx/imx8m/soc.c                      |  112 +-
 arch/arm/mach-imx/spl.c                            |    8 +
 board/freescale/imx8mm_evk/Kconfig                 |   12 +
 board/freescale/imx8mm_evk/MAINTAINERS             |    6 +
 board/freescale/imx8mm_evk/Makefile                |   12 +
 board/freescale/imx8mm_evk/imx8mm_evk.c            |   90 +
 board/freescale/imx8mm_evk/lpddr4_timing.c         | 1980
++++++++++++++++++++
board/freescale/imx8mm_evk/spl.c                   |  216 +++
cmd/clk.c                                          |    2 +
configs/imx8mm_evk_defconfig                       |   52 +
drivers/clk/Kconfig                                |   14 +
drivers/clk/Makefile                               |    3 +-
drivers/clk/clk-composite.c                        |  165 ++
drivers/clk/clk-divider.c                          |   92 +-
drivers/clk/clk-fixed-factor.c                     |    2 +-
drivers/clk/clk-gate.c                             |  151 ++
drivers/clk/clk-mux.c                              |   76 +-
drivers/clk/clk.c                                  |    8 +
drivers/clk/clk_fixed_rate.c                       |    9 +-
drivers/clk/imx/Kconfig                            |    9 +
drivers/clk/imx/Makefile                           |    1 +
drivers/clk/imx/clk-composite-8m.c                 |  170 ++
drivers/clk/imx/clk-gate2.c                        |   15 +-
drivers/clk/imx/clk-imx8mm.c                       |  415 ++++
drivers/clk/imx/clk-pfd.c                          |    2 +-
drivers/clk/imx/clk-pll14xx.c                      |  377 ++++
drivers/clk/imx/clk-pllv3.c                        |    2 +-
drivers/clk/imx/clk.h                              |  106 ++
Quoted 8 lines
drivers/core/uclass.c                              |    2 +-
drivers/ddr/imx/imx8m/helper.c                     |   12 +-
drivers/serial/Kconfig                             |    2 +-
include/clk.h                                      |    9 +
include/configs/imx8mm_evk.h                       |  199 ++
include/dt-bindings/clock/imx8mm-clock.h           |  244 +++
include/linux/clk-provider.h                       |   74 +
include/linux/compat.h                             |    2 + 55

files

Quoted 10 lines

changed, 8728 insertions(+), 494 deletions(-) create mode 100644 arch/arm/dts/imx8mm-evk-u-boot.dtsi create mode 100644 arch/arm/dts/imx8mm-evk.dts create mode 100644 arch/arm/dts/imx8mm-pinfunc.h create mode 100644 arch/arm/dts/imx8mm.dtsi create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mm.h create mode 100644 arch/arm/include/asm/arch-imx8m/clock_imx8mq.h create mode 100644 arch/arm/include/asm/arch-imx8m/imx8mm_pins.h create mode 100644 arch/arm/mach-imx/imx8m/clock_imx8mm.c rename arch/arm/mach-imx/imx8m/{clock.c => clock_imx8mq.c} (99%) create

mode

Quoted 10 lines

100644 board/freescale/imx8mm_evk/Kconfig create mode 100644 board/freescale/imx8mm_evk/MAINTAINERS create mode 100644 board/freescale/imx8mm_evk/Makefile create mode 100644 board/freescale/imx8mm_evk/imx8mm_evk.c create mode 100644 board/freescale/imx8mm_evk/lpddr4_timing.c create mode 100644 board/freescale/imx8mm_evk/spl.c create mode 100644 configs/imx8mm_evk_defconfig create mode 100644 drivers/clk/clk-composite.c create mode 100644 drivers/clk/clk-gate.c create mode 100644 drivers/clk/imx/clk-composite-8m.c

 create mode 100644 drivers/clk/imx/clk-imx8mm.c  create mode

100644

Quoted 4 lines

drivers/clk/imx/clk-pll14xx.c create mode 100644
include/configs/imx8mm_evk.h create mode 100644
include/dt-bindings/clock/imx8mm-clock.h

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
lukma at denx.de