aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2009-10-15 12:58:00 -0400
committerGrant Likely <grant.likely@secretlab.ca>2009-10-15 12:58:00 -0400
commitb6caf2ad7ce30648b89c1cf40d8f7cf6f4b58033 (patch)
tree014b9f2c763711a52c21540ea49845d0ab497e01 /include/linux/of.h
parent50436312f47f1fd2bf82c983638fe27ca7e03238 (diff)
of: merge of_read_number() an of_read_ulong()
Merge common code between Microblaze and PowerPC Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Wolfram Sang <w.sang@pengutronix.de> Acked-by: Michal Simek <monstr@monstr.eu> Acked-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index d5f666290f6b..18e4379b8b7f 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -79,6 +79,29 @@ set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de)
79 dn->pde = de; 79 dn->pde = de;
80} 80}
81 81
82/*
83 * OF address retreival & translation
84 */
85
86/* Helper to read a big number; size is in cells (not bytes) */
87static inline u64 of_read_number(const u32 *cell, int size)
88{
89 u64 r = 0;
90 while (size--)
91 r = (r << 32) | *(cell++);
92 return r;
93}
94
95/* Like of_read_number, but we want an unsigned long result */
96#ifdef CONFIG_PPC32
97static inline unsigned long of_read_ulong(const u32 *cell, int size)
98{
99 return cell[size-1];
100}
101#else
102#define of_read_ulong(cell, size) of_read_number(cell, size)
103#endif
104
82#include <asm/prom.h> 105#include <asm/prom.h>
83 106
84/* flag descriptions */ 107/* flag descriptions */