Skip to contentSkip to conversation

imx8qm: mek: enable dm-spl for pm

PATCH New Peng Fan 1 participant 7 messages Sep 2, 2019

Subsystems (3)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/7 imx8qm: mek: enable dm-spl for pm

with u-boot,dm-spl added for imx8qm-pm node, and SPL_SIMPLE_BUS enabled, the bind and probe code in board file could be removed.

Also we need to enlarge SYS_MALLOC_F_LEN to avoid calloc fail.

---
 arch/arm/dts/fsl-imx8qm-mek-u-boot.dtsi |  5 +++++
 board/freescale/imx8qm_mek/spl.c        | 16 ----------------
 configs/imx8qm_mek_defconfig            |  1 +
 3 files changed, 6 insertions(+), 16 deletions(-)
arch/arm/dts/fsl-imx8qm-mek-u-boot.dtsi +5 -0
index 5d50eb028e..9a4a83b70e 100644
@@ -3,6 +3,11 @@
  * Copyright 2018 NXP
  */
 
+&{/imx8qm-pm} {
+
+	u-boot,dm-spl;
+};
+
 &mu {
 	u-boot,dm-spl;
 };
board/freescale/imx8qm_mek/spl.c +0 -16
index 95ce9f37e8..cb4006eb2a 100644
@@ -18,7 +18,6 @@ DECLARE_GLOBAL_DATA_PTR;
 void spl_board_init(void)
 {
 	struct udevice *dev;
-	int offset;
 
 	uclass_find_first_device(UCLASS_MISC, &dev);
 
@@ -27,21 +26,6 @@ void spl_board_init(void)
 			continue;
 	}
 
-	offset = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "nxp,imx8-pd");
-	while (offset != -FDT_ERR_NOTFOUND) {
-		lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset),
-			       NULL, true);
-		offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset,
-						       "nxp,imx8-pd");
-	}
-
-	uclass_find_first_device(UCLASS_POWER_DOMAIN, &dev);
-
-	for (; dev; uclass_find_next_device(&dev)) {
-		if (device_probe(dev))
-			continue;
-	}
-
 	arch_cpu_init();
 
 	board_early_init_f();
configs/imx8qm_mek_defconfig +1 -0
index 3294931ef8..594eb9efb2 100644
@@ -6,6 +6,7 @@ CONFIG_SYS_TEXT_BASE=0x80020000
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x8000
 CONFIG_TARGET_IMX8QM_MEK=y
 CONFIG_SPL_MMC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH 2/7 arm: dts: imx8qxp-mek: add u-boot, dm-spl for lpuart0

lpuart0 is the uart used by SPL and U-Boot proper, and DM_SERIAL is enabled. Since uclass power domain is also enabled, to make lpuart work properly, need add u-boot,dm-spl for lpuart power domain and its parent.

---
 arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/dts/fsl-imx8qxp-mek-u-boot.dtsi +8 -0
index 201559008c..771ab635f1 100644
@@ -72,6 +72,14 @@
 	u-boot,dm-spl;
 };
 
+&pd_dma {
+	u-boot,dm-spl;
+};
+
+&pd_dma_lpuart0 {
+	u-boot,dm-spl;
+};
+
 &gpio0 {
 	u-boot,dm-spl;
 };
Signature · 1 line
2.16.4
author
#2 lore raw

PATCH 3/7 arm: dts: imx8qm-mek: add u-boot, dm-spl for lpuart0

In reply to Peng Fan

lpuart0 is the uart used by SPL and U-Boot proper, and DM_SERIAL is enabled. Since uclass power domain is also enabled, to make lpuart work properly, need add u-boot,dm-spl for lpuart power domain and its parent.

---
 arch/arm/dts/fsl-imx8qm-mek-u-boot.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/dts/fsl-imx8qm-mek-u-boot.dtsi +8 -0
index 9a4a83b70e..80d6475b7c 100644
@@ -72,6 +72,14 @@
 	u-boot,dm-spl;
 };
 
+&pd_dma {
+	u-boot,dm-spl;
+};
+
+&pd_dma_lpuart0 {
+	u-boot,dm-spl;
+};
+
 &gpio0 {
 	u-boot,dm-spl;
 };
Signature · 1 line
2.16.4
author
#3 lore raw

PATCH 4/7 misc: imx8: scu: simplify code to make it extendable

In reply to Peng Fan

clk and pinctrl will be get(probed) during each device probe, we don't need to probe them in scu driver. Only need to bind the sub-nodes (clk and iomuxc) of MU node with their drivers.

So drop the code to probe the clk/pinctrl, and this patch will make it easy to add more subnodes.

---
 drivers/misc/imx8/scu.c | 46 +++++++---------------------------------------
 1 file changed, 7 insertions(+), 39 deletions(-)
drivers/misc/imx8/scu.c +7 -39
index 9ec00457b8..a7654a7817 100644
@@ -26,8 +26,6 @@ struct mu_type {
 
 struct imx8_scu {
 	struct mu_type *base;
-	struct udevice *clk;
-	struct udevice *pinclk;
 };
 
 #define MU_CR_GIE_MASK		0xF0000000u
@@ -202,9 +200,6 @@ static int imx8_scu_probe(struct udevice *dev)
 
 	gd->arch.scu_dev = dev;
 
-	device_probe(plat->clk);
-	device_probe(plat->pinclk);
-
 	return 0;
 }
 
@@ -215,44 +210,17 @@ static int imx8_scu_remove(struct udevice *dev)
 
 static int imx8_scu_bind(struct udevice *dev)
 {
-	struct imx8_scu *plat = dev_get_platdata(dev);
 	int ret;
 	struct udevice *child;
-	int node;
-	char *clk_compatible, *iomuxc_compatible;
-
-	if (IS_ENABLED(CONFIG_IMX8QXP)) {
-		clk_compatible = "fsl,imx8qxp-clk";
-		iomuxc_compatible = "fsl,imx8qxp-iomuxc";
-	} else if (IS_ENABLED(CONFIG_IMX8QM)) {
-		clk_compatible = "fsl,imx8qm-clk";
-		iomuxc_compatible = "fsl,imx8qm-iomuxc";
-	} else {
-		return -EINVAL;
-	}
+	ofnode node;
 
 	debug("%s(dev=%p)\n", __func__, dev);
-
-	node = fdt_node_offset_by_compatible(gd->fdt_blob, -1, clk_compatible);
-	if (node < 0)
-		panic("No clk node found\n");
-
-	ret = lists_bind_fdt(dev, offset_to_ofnode(node), &child, true);
-	if (ret)
-		return ret;
-
-	plat->clk = child;
-
-	node = fdt_node_offset_by_compatible(gd->fdt_blob, -1,
-					     iomuxc_compatible);
-	if (node < 0)
-		panic("No iomuxc node found\n");
-
-	ret = lists_bind_fdt(dev, offset_to_ofnode(node), &child, true);
-	if (ret)
-		return ret;
-
-	plat->pinclk = child;
+	ofnode_for_each_subnode(node, dev_ofnode(dev)) {
+		ret = lists_bind_fdt(dev, node, &child, true);
+		if (ret)
+			return ret;
+		debug("bind child dev %s\n", child->name);
+	}
 
 	return 0;
 }
Signature · 1 line
2.16.4
author
#4 lore raw

PATCH 5/7 misc: scu: Increase the timeout for MU communication

In reply to Peng Fan

From: Ye Li <[email protected]>

When power on some sources in Video system, current timeout 10ms is too short and returns before SCU response. So increase the timeout to 1s.

---
 drivers/misc/imx8/scu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/imx8/scu.c +1 -1
index a7654a7817..6916b754f6 100644
@@ -74,7 +74,7 @@ static int mu_hal_receivemsg(struct mu_type *base, u32 reg_index, u32 *msg)
 	assert(reg_index < MU_TR_COUNT);
 
 	/* Wait RX register to be full. */
-	ret = readl_poll_timeout(&base->sr, val, val & mask, 10000);
+	ret = readl_poll_timeout(&base->sr, val, val & mask, 1000000);
 	if (ret < 0) {
 		printf("%s timeout\n", __func__);
 		return -ETIMEDOUT;
Signature · 1 line
2.16.4
author
#5 lore raw

PATCH 6/7 power: domain: make imx8-power-domain.c legacy

In reply to Peng Fan

The current i.MX8 power domain driver is based on i.MX vendor power domain tree which will retire later.

The Linux upstream use a single pd node for power domain driver, and U-Boot will adopt that. When U-Boot i.MX8 dts synced with Linux Kernel upstream and related driver ready, the legacy driver will be removed.

---
 drivers/power/domain/Makefile                                           | 2 +-
 .../power/domain/{imx8-power-domain.c => imx8-power-domain-legacy.c}    | 0
 2 files changed, 1 insertion(+), 1 deletion(-)
 rename drivers/power/domain/{imx8-power-domain.c => imx8-power-domain-legacy.c} (100%)
drivers/power/domain/Makefile +1 -1
index 695aafe17d..97194787c0 100644
@@ -5,7 +5,7 @@
 
 obj-$(CONFIG_$(SPL_)POWER_DOMAIN) += power-domain-uclass.o
 obj-$(CONFIG_BCM6328_POWER_DOMAIN) += bcm6328-power-domain.o
-obj-$(CONFIG_IMX8_POWER_DOMAIN) += imx8-power-domain.o
+obj-$(CONFIG_IMX8_POWER_DOMAIN) += imx8-power-domain-legacy.o
 obj-$(CONFIG_MTK_POWER_DOMAIN) += mtk-power-domain.o
 obj-$(CONFIG_MESON_GX_VPU_POWER_DOMAIN) += meson-gx-pwrc-vpu.o
 obj-$(CONFIG_SANDBOX_POWER_DOMAIN) += sandbox-power-domain.o
drivers/power/domain/imx8-power-domain-legacy.c renamed from drivers/power/domain/imx8-power-domain.c +0 -0
similarity index 100%
rename from drivers/power/domain/imx8-power-domain.c
rename to drivers/power/domain/imx8-power-domain-legacy.c
Signature · 1 line
2.16.4
author
#6 lore raw

PATCH 7/7 power: domain: add i.MX8 scu power domain driver

In reply to Peng Fan

The power domain tree is not accepted by Linux Kernel upstream. only a single pd node is used currently, as following:

		pd: imx8qx-pd {
			compatible = "fsl,imx8qm-scu-pd", "fsl,scu-pd";
			#power-domain-cells = <1>;
		};

So to migrate to use upstream linux dts, we also need a driver to support this.

This patch is to support the new method, compared with legacy power domain tree, it will be simpiler, because each device will has resource id as power domain index, it will be directly passed to scfw, and no need to let power domain build that tree. If multiple power domain is needed, it is the dts node should has correctly power domains entry added and sequence correct.

---
 drivers/power/domain/Makefile            |  2 +-
 drivers/power/domain/imx8-power-domain.c | 87 ++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 drivers/power/domain/imx8-power-domain.c
drivers/power/domain/Makefile +1 -1
index 97194787c0..81fbd89e15 100644
@@ -5,7 +5,7 @@
 
 obj-$(CONFIG_$(SPL_)POWER_DOMAIN) += power-domain-uclass.o
 obj-$(CONFIG_BCM6328_POWER_DOMAIN) += bcm6328-power-domain.o
-obj-$(CONFIG_IMX8_POWER_DOMAIN) += imx8-power-domain-legacy.o
+obj-$(CONFIG_IMX8_POWER_DOMAIN) += imx8-power-domain-legacy.o imx8-power-domain.o
 obj-$(CONFIG_MTK_POWER_DOMAIN) += mtk-power-domain.o
 obj-$(CONFIG_MESON_GX_VPU_POWER_DOMAIN) += meson-gx-pwrc-vpu.o
 obj-$(CONFIG_SANDBOX_POWER_DOMAIN) += sandbox-power-domain.o
drivers/power/domain/imx8-power-domain.c new file +87 -0

87 lines not on this page · raw message

Signature · 1 line
2.16.4