hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/bus/mips_cdmm.c
....@@ -13,6 +13,8 @@
1313 #include <linux/cpu.h>
1414 #include <linux/cpumask.h>
1515 #include <linux/io.h>
16
+#include <linux/of_address.h>
17
+#include <linux/of.h>
1618 #include <linux/platform_device.h>
1719 #include <linux/slab.h>
1820 #include <linux/smp.h>
....@@ -337,9 +339,23 @@
337339 * Picking a suitable physical address at which to map the CDMM region is
338340 * platform specific, so this weak function can be overridden by platform
339341 * code to pick a suitable value if none is configured by the bootloader.
342
+ * By default this method tries to find a CDMM-specific node in the system
343
+ * dtb. Note that this won't work for early serial console.
340344 */
341345 phys_addr_t __weak mips_cdmm_phys_base(void)
342346 {
347
+ struct device_node *np;
348
+ struct resource res;
349
+ int err;
350
+
351
+ np = of_find_compatible_node(NULL, NULL, "mti,mips-cdmm");
352
+ if (np) {
353
+ err = of_address_to_resource(np, 0, &res);
354
+ of_node_put(np);
355
+ if (!err)
356
+ return res.start;
357
+ }
358
+
343359 return 0;
344360 }
345361