#include <linux/cpu.h>
 #include <linux/cpumask.h>
 #include <linux/io.h>
+#include <linux/of_address.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/smp.h>
  * Picking a suitable physical address at which to map the CDMM region is
  * platform specific, so this weak function can be overridden by platform
  * code to pick a suitable value if none is configured by the bootloader.
+ * By default this method tries to find a CDMM-specific node in the system
+ * dtb. Note that this won't work for early serial console.
  */
 phys_addr_t __weak mips_cdmm_phys_base(void)
 {
+       struct device_node *np;
+       struct resource res;
+       int err;
+
+       np = of_find_compatible_node(NULL, NULL, "mti,mips-cdmm");
+       if (np) {
+               err = of_address_to_resource(np, 0, &res);
+               if (!err)
+                       return res.start;
+       }
+
        return 0;
 }