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.