diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-12 02:52:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-12 02:52:17 -0500 |
commit | 10d0c9705e80bbd3d587c5fad24599aabaca6688 (patch) | |
tree | 9456083a1b04b8d98da08d88e937cfeff80e2a7d /drivers/of/base.c | |
parent | 85b656cf1560e27a89354a23f2c10ba229d2f173 (diff) | |
parent | c11eede69b6ad0ac44ebc1e021a8d2699c5f1f8f (diff) |
Merge tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
Pull devicetree updates from Rob Herring:
"DeviceTree updates for 3.13. This is a bit larger pull request than
usual for this cycle with lots of clean-up.
- Cross arch clean-up and consolidation of early DT scanning code.
- Clean-up and removal of arch prom.h headers. Makes arch specific
prom.h optional on all but Sparc.
- Addition of interrupts-extended property for devices connected to
multiple interrupt controllers.
- Refactoring of DT interrupt parsing code in preparation for
deferred probe of interrupts.
- ARM cpu and cpu topology bindings documentation.
- Various DT vendor binding documentation updates"
* tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (82 commits)
powerpc: add missing explicit OF includes for ppc
dt/irq: add empty of_irq_count for !OF_IRQ
dt: disable self-tests for !OF_IRQ
of: irq: Fix interrupt-map entry matching
MIPS: Netlogic: replace early_init_devtree() call
of: Add Panasonic Corporation vendor prefix
of: Add Chunghwa Picture Tubes Ltd. vendor prefix
of: Add AU Optronics Corporation vendor prefix
of/irq: Fix potential buffer overflow
of/irq: Fix bug in interrupt parsing refactor.
of: set dma_mask to point to coherent_dma_mask
of: add vendor prefix for PHYTEC Messtechnik GmbH
DT: sort vendor-prefixes.txt
of: Add vendor prefix for Cadence
of: Add empty for_each_available_child_of_node() macro definition
arm/versatile: Fix versatile irq specifications.
of/irq: create interrupts-extended property
microblaze/pci: Drop PowerPC-ism from irq parsing
of/irq: Create of_irq_parse_and_map_pci() to consolidate arch code.
of/irq: Use irq_of_parse_and_map()
...
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r-- | drivers/of/base.c | 65 |
1 files changed, 46 insertions, 19 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index aace017fc452..f807d0edabf3 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -74,6 +74,13 @@ int of_n_size_cells(struct device_node *np) | |||
74 | } | 74 | } |
75 | EXPORT_SYMBOL(of_n_size_cells); | 75 | EXPORT_SYMBOL(of_n_size_cells); |
76 | 76 | ||
77 | #ifdef CONFIG_NUMA | ||
78 | int __weak of_node_to_nid(struct device_node *np) | ||
79 | { | ||
80 | return numa_node_id(); | ||
81 | } | ||
82 | #endif | ||
83 | |||
77 | #if defined(CONFIG_OF_DYNAMIC) | 84 | #if defined(CONFIG_OF_DYNAMIC) |
78 | /** | 85 | /** |
79 | * of_node_get - Increment refcount of a node | 86 | * of_node_get - Increment refcount of a node |
@@ -265,9 +272,9 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun, | |||
265 | 272 | ||
266 | ac = of_n_addr_cells(cpun); | 273 | ac = of_n_addr_cells(cpun); |
267 | cell = of_get_property(cpun, prop_name, &prop_len); | 274 | cell = of_get_property(cpun, prop_name, &prop_len); |
268 | if (!cell) | 275 | if (!cell || !ac) |
269 | return false; | 276 | return false; |
270 | prop_len /= sizeof(*cell); | 277 | prop_len /= sizeof(*cell) * ac; |
271 | for (tid = 0; tid < prop_len; tid++) { | 278 | for (tid = 0; tid < prop_len; tid++) { |
272 | hwid = of_read_number(cell, ac); | 279 | hwid = of_read_number(cell, ac); |
273 | if (arch_match_cpu_phys_id(cpu, hwid)) { | 280 | if (arch_match_cpu_phys_id(cpu, hwid)) { |
@@ -280,6 +287,31 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun, | |||
280 | return false; | 287 | return false; |
281 | } | 288 | } |
282 | 289 | ||
290 | /* | ||
291 | * arch_find_n_match_cpu_physical_id - See if the given device node is | ||
292 | * for the cpu corresponding to logical cpu 'cpu'. Return true if so, | ||
293 | * else false. If 'thread' is non-NULL, the local thread number within the | ||
294 | * core is returned in it. | ||
295 | */ | ||
296 | bool __weak arch_find_n_match_cpu_physical_id(struct device_node *cpun, | ||
297 | int cpu, unsigned int *thread) | ||
298 | { | ||
299 | /* Check for non-standard "ibm,ppc-interrupt-server#s" property | ||
300 | * for thread ids on PowerPC. If it doesn't exist fallback to | ||
301 | * standard "reg" property. | ||
302 | */ | ||
303 | if (IS_ENABLED(CONFIG_PPC) && | ||
304 | __of_find_n_match_cpu_property(cpun, | ||
305 | "ibm,ppc-interrupt-server#s", | ||
306 | cpu, thread)) | ||
307 | return true; | ||
308 | |||
309 | if (__of_find_n_match_cpu_property(cpun, "reg", cpu, thread)) | ||
310 | return true; | ||
311 | |||
312 | return false; | ||
313 | } | ||
314 | |||
283 | /** | 315 | /** |
284 | * of_get_cpu_node - Get device node associated with the given logical CPU | 316 | * of_get_cpu_node - Get device node associated with the given logical CPU |
285 | * | 317 | * |
@@ -300,24 +332,10 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun, | |||
300 | */ | 332 | */ |
301 | struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) | 333 | struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) |
302 | { | 334 | { |
303 | struct device_node *cpun, *cpus; | 335 | struct device_node *cpun; |
304 | |||
305 | cpus = of_find_node_by_path("/cpus"); | ||
306 | if (!cpus) | ||
307 | return NULL; | ||
308 | 336 | ||
309 | for_each_child_of_node(cpus, cpun) { | 337 | for_each_node_by_type(cpun, "cpu") { |
310 | if (of_node_cmp(cpun->type, "cpu")) | 338 | if (arch_find_n_match_cpu_physical_id(cpun, cpu, thread)) |
311 | continue; | ||
312 | /* Check for non-standard "ibm,ppc-interrupt-server#s" property | ||
313 | * for thread ids on PowerPC. If it doesn't exist fallback to | ||
314 | * standard "reg" property. | ||
315 | */ | ||
316 | if (IS_ENABLED(CONFIG_PPC) && | ||
317 | __of_find_n_match_cpu_property(cpun, | ||
318 | "ibm,ppc-interrupt-server#s", cpu, thread)) | ||
319 | return cpun; | ||
320 | if (__of_find_n_match_cpu_property(cpun, "reg", cpu, thread)) | ||
321 | return cpun; | 339 | return cpun; |
322 | } | 340 | } |
323 | return NULL; | 341 | return NULL; |
@@ -1174,6 +1192,15 @@ int of_property_count_strings(struct device_node *np, const char *propname) | |||
1174 | } | 1192 | } |
1175 | EXPORT_SYMBOL_GPL(of_property_count_strings); | 1193 | EXPORT_SYMBOL_GPL(of_property_count_strings); |
1176 | 1194 | ||
1195 | void of_print_phandle_args(const char *msg, const struct of_phandle_args *args) | ||
1196 | { | ||
1197 | int i; | ||
1198 | printk("%s %s", msg, of_node_full_name(args->np)); | ||
1199 | for (i = 0; i < args->args_count; i++) | ||
1200 | printk(i ? ",%08x" : ":%08x", args->args[i]); | ||
1201 | printk("\n"); | ||
1202 | } | ||
1203 | |||
1177 | static int __of_parse_phandle_with_args(const struct device_node *np, | 1204 | static int __of_parse_phandle_with_args(const struct device_node *np, |
1178 | const char *list_name, | 1205 | const char *list_name, |
1179 | const char *cells_name, | 1206 | const char *cells_name, |