diff options
Diffstat (limited to 'drivers/bus/mips_cdmm.c')
-rw-r--r-- | drivers/bus/mips_cdmm.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c index 1b14256376d2..fca0d0669aa9 100644 --- a/drivers/bus/mips_cdmm.c +++ b/drivers/bus/mips_cdmm.c @@ -13,6 +13,8 @@ #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> @@ -337,9 +339,23 @@ static phys_addr_t mips_cdmm_cur_base(void) * 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); + of_node_put(np); + if (!err) + return res.start; + } + return 0; } @@ -544,10 +560,8 @@ static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus) dev_set_name(&dev->dev, "cdmm%u-%u", cpu, id); ++id; ret = device_register(&dev->dev); - if (ret) { + if (ret) put_device(&dev->dev); - kfree(dev); - } } } |