ram: k3-ddrss: Add support for number of controllers under MSMC
authorNeha Malcom Francis <n-francis@ti.com>
Tue, 12 Aug 2025 12:43:21 +0000 (18:13 +0530)
committerTom Rini <trini@konsulko.com>
Tue, 19 Aug 2025 17:26:20 +0000 (11:26 -0600)
In K3 multi-DDR systems, the MSMC is responsible for the interleave
mechanism across all the DDR controllers. Add support for MSMC to obtain
the number of controllers it's responsible for using the DT.

Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
drivers/ram/k3-ddrss/k3-ddrss.c

index 61d4f3d..075e664 100644 (file)
@@ -134,6 +134,7 @@ struct k3_msmc {
        enum ecc_enable enable;
        enum emif_config config;
        enum emif_active active;
+       u32 num_ddr_controllers;
 };
 
 struct k3_ddrss_desc {
@@ -1013,6 +1014,13 @@ static int k3_msmc_probe(struct udevice *dev)
                return -EINVAL;
        }
 
+       ret = device_get_child_count(dev);
+       if (ret <= 0) {
+               dev_err(dev, "no child ddr nodes present");
+               return -EINVAL;
+       }
+       msmc->num_ddr_controllers = ret;
+
        return 0;
 }