generic/starfive: Add syscrg reg base compatible string 66/301566/4 accepted/tizen/unified/riscv/20231123.095152
authorHoegeun Kwon <hoegeun.kwon@samsung.com>
Mon, 20 Nov 2023 04:39:44 +0000 (13:39 +0900)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Tue, 21 Nov 2023 04:24:03 +0000 (13:24 +0900)
Add "starfive,jh7110-syscrg" used for setting clk_reg_base. clkgen
uses syscrg reg base. If clkgen does not find a compatible string, it
searches for the syscrg compatible string and get the syscrg reg base.

Change-Id: I9eadbf349eab0c14c27b9db97981820e4a940b70
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
platform/generic/starfive/jh7110.c

index 6f87303d18980b9abc82d2b85913ad30b16be725..5eee472958b0ae38f63454ae30ca06506bd18611 100644 (file)
@@ -255,6 +255,13 @@ static int starfive_jh7110_inst_init(void *fdt)
        }
 
        noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-clkgen");
+       /*
+        * clkgen uses syscrg reg base with index 0.
+        * If clkgen does not find a compatible string, it searches for
+        * the syscrg compatible string and get the syscrg reg base.
+        */
+       if (noff == -FDT_ERR_NOTFOUND)
+               noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-syscrg");
        if (-1 < noff) {
                rc = fdt_get_node_addr_size(fdt, noff, 0, &addr, NULL);
                if (rc)