diff mbox series

[U-Boot] imx: imx8m: fix boot when CONFIG_$(SPL_)CLK not defined

Message ID 20191016031909.7614-1-peng.fan@nxp.com
State Accepted
Commit cd7c806f4f58fe66895f4355b1ddd88460925a01
Delegated to: Stefano Babic
Headers show
Series [U-Boot] imx: imx8m: fix boot when CONFIG_$(SPL_)CLK not defined | expand

Commit Message

Peng Fan Oct. 16, 2019, 3:01 a.m. UTC
When CONFIG_$(SPL_)CLK not defined, the clock controller device
not exist, so to avoid boot failure for platform not have
CONFIG_$(SPL_)CLK, add a check.

Reviewed-by: Patrick Wildt <patrick@blueri.se>
Tested-by: Patrick Wildt <patrick@blueri.se>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V1:
 Based on pull request https://github.com/MrVan/u-boot/tree/imx-master-10-15

 arch/arm/mach-imx/imx8m/soc.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index c46031dd12..3e73ca3cca 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -236,12 +236,14 @@  int arch_cpu_init_dm(void)
 	struct udevice *dev;
 	int ret;
 
-	ret = uclass_get_device_by_name(UCLASS_CLK,
-					"clock-controller@30380000",
-					&dev);
-	if (ret < 0) {
-		printf("Failed to find clock node. Check device tree\n");
-		return ret;
+	if (CONFIG_IS_ENABLED(CLK)) {
+		ret = uclass_get_device_by_name(UCLASS_CLK,
+						"clock-controller@30380000",
+						&dev);
+		if (ret < 0) {
+			printf("Failed to find clock node. Check device tree\n");
+			return ret;
+		}
 	}
 
 	return 0;