powerpc: refactor of_get_cpu_node to support other architectures
authorSudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Thu, 15 Aug 2013 12:34:18 +0000 (13:34 +0100)
committerSudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
Wed, 21 Aug 2013 09:24:38 +0000 (10:24 +0100)
commit819d596568d82ffb85b0b5989a1567810fe66098
tree3be30cd02feff35df069b36af55b77c975282f8a
parent007fb9aedc7544f67ffbdce95283b1c6c58999c3
powerpc: refactor of_get_cpu_node to support other architectures

Currently different drivers requiring to access cpu device node are
parsing the device tree themselves. Since the ordering in the DT need
not match the logical cpu ordering, the parsing logic needs to consider
that. However, this has resulted in lots of code duplication and in some
cases even incorrect logic.

It's better to consolidate them by adding support for getting cpu
device node for a given logical cpu index in DT core library. However
logical to physical index mapping can be architecture specific.

PowerPC has it's own implementation to get the cpu node for a given
logical index.

This patch refactors the current implementation of of_get_cpu_node.
This in preparation to move the implementation to DT core library.
It separates out the logical to physical mapping so that a default
matching of the physical id to the logical cpu index can be added
when moved to common code. Architecture specific code can override it.

Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Grant Likely <grant.likely@linaro.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Sudeep KarkadaNagesha <sudeep.karkadanagesha@arm.com>
arch/powerpc/kernel/prom.c