| .. | .. |
|---|
| 13 | 13 | #include <linux/cpu.h> |
|---|
| 14 | 14 | #include <linux/cpumask.h> |
|---|
| 15 | 15 | #include <linux/io.h> |
|---|
| 16 | +#include <linux/of_address.h> |
|---|
| 17 | +#include <linux/of.h> |
|---|
| 16 | 18 | #include <linux/platform_device.h> |
|---|
| 17 | 19 | #include <linux/slab.h> |
|---|
| 18 | 20 | #include <linux/smp.h> |
|---|
| .. | .. |
|---|
| 337 | 339 | * Picking a suitable physical address at which to map the CDMM region is |
|---|
| 338 | 340 | * platform specific, so this weak function can be overridden by platform |
|---|
| 339 | 341 | * 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. |
|---|
| 340 | 344 | */ |
|---|
| 341 | 345 | phys_addr_t __weak mips_cdmm_phys_base(void) |
|---|
| 342 | 346 | { |
|---|
| 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 | + |
|---|
| 343 | 359 | return 0; |
|---|
| 344 | 360 | } |
|---|
| 345 | 361 | |
|---|