Thread (30 messages) 30 messages, 2 authors, 2022-12-07

Re: [PATCH 5/7] powerpc/85xx: p2020: Define just one machine description

From: Pali Rohár <pali@kernel.org>
Date: 2022-09-26 10:09:53
Also in: lkml

On Monday 26 September 2022 10:02:47 Christophe Leroy wrote:
quoted
+static int __init p2020_probe(void)
  {
-	if (of_machine_is_compatible("fsl,P2020RDB-PC"))
-		return 1;
-	return 0;
+	struct device_node *p2020_cpu;
+
+	/*
+	 * There is no common compatible string for all P2020 boards.
+	 * The only common thing is "PowerPC,P2020@0" cpu node.
+	 * So check for P2020 board via this cpu node.
+	 */
+	p2020_cpu = of_find_node_by_path("/cpus/PowerPC,P2020@0");
+	if (!p2020_cpu)
+		return 0;
This looks odd. I though all probe were using the compatible, and in 
fact I have a series in preparation that drops all 
of_machine_is_compatible() checks in probe functions and do it in the 
caller instead, after adding a .compatible string in the machine 
description.

Is there really no compatible that can be used for all p2020 ?
Really. There is none. I have looked into all available P2020 DTB files
(either externals passed by bootloader or kernel in-tree) and there is
no common compatible string. The only "common" thing is cpu node, how I
implemented it int this patch series.

And same issue is with boards with P101x and P102x DTB files.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help