aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-10 11:57:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-10 11:57:03 -0500
commit0bd2cbcdfaff9cb22267d66fc843fa4f73f0c281 (patch)
tree7d9732bcf5f2f646cb0c2c529c48b454b15d4ae2 /arch/powerpc/kernel
parent57cc7215b70856dc6bae8e55b00ecd7b1d7429b1 (diff)
parenta081748735c5feb96b1365e78a5ff0fb6ca7e3a4 (diff)
Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6: (29 commits) of/flattree: forward declare struct device_node in of_fdt.h ipmi: explicitly include of_address.h and of_irq.h sparc: explicitly cast negative phandle checks to s32 powerpc/405: Fix missing #{address,size}-cells in i2c node powerpc/5200: dts: refactor dts files powerpc/5200: dts: Change combatible strings on localbus powerpc/5200: dts: remove unused properties powerpc/5200: dts: rename nodes to prepare for refactoring dts files of/flattree: Update dtc to current mainline. of/device: Don't register disabled devices powerpc/dts: fix syntax bugs in bluestone.dts of: Fixes for OF probing on little endian systems of: make drivers depend on CONFIG_OF instead of CONFIG_PPC_OF of/flattree: Add of_flat_dt_match() helper function of_serial: explicitly include of_irq.h of/flattree: Refactor unflatten_device_tree and add fdt_unflatten_tree of/flattree: Reorder unflatten_dt_node of/flattree: Refactor unflatten_dt_node of/flattree: Add non-boottime device tree functions of/flattree: Add Kconfig for EARLY_FLATTREE ... Fix up trivial conflict in arch/sparc/prom/tree_32.c as per Grant.
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/prom_parse.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 88334af038e..c2b7a07cc3d 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -117,41 +117,3 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
117 cells = prop ? *(u32 *)prop : of_n_size_cells(dn); 117 cells = prop ? *(u32 *)prop : of_n_size_cells(dn);
118 *size = of_read_number(dma_window, cells); 118 *size = of_read_number(dma_window, cells);
119} 119}
120
121/**
122 * Search the device tree for the best MAC address to use. 'mac-address' is
123 * checked first, because that is supposed to contain to "most recent" MAC
124 * address. If that isn't set, then 'local-mac-address' is checked next,
125 * because that is the default address. If that isn't set, then the obsolete
126 * 'address' is checked, just in case we're using an old device tree.
127 *
128 * Note that the 'address' property is supposed to contain a virtual address of
129 * the register set, but some DTS files have redefined that property to be the
130 * MAC address.
131 *
132 * All-zero MAC addresses are rejected, because those could be properties that
133 * exist in the device tree, but were not set by U-Boot. For example, the
134 * DTS could define 'mac-address' and 'local-mac-address', with zero MAC
135 * addresses. Some older U-Boots only initialized 'local-mac-address'. In
136 * this case, the real MAC is in 'local-mac-address', and 'mac-address' exists
137 * but is all zeros.
138*/
139const void *of_get_mac_address(struct device_node *np)
140{
141 struct property *pp;
142
143 pp = of_find_property(np, "mac-address", NULL);
144 if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
145 return pp->value;
146
147 pp = of_find_property(np, "local-mac-address", NULL);
148 if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
149 return pp->value;
150
151 pp = of_find_property(np, "address", NULL);
152 if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
153 return pp->value;
154
155 return NULL;
156}
157EXPORT_SYMBOL(of_get_mac_address);