aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dtc/libfdt/libfdt_env.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 12:44:08 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 12:44:08 -0400
commita54dfb1a845c38a97686268d8c4086a63d9493aa (patch)
tree3b31c81672fa89102aae929cc6c1e48e6e9382f4 /scripts/dtc/libfdt/libfdt_env.h
parenteb0ad9c06d51edb5d18a7007fd4d77a8805b2ba7 (diff)
parent36165f55055781a0e4bf32d775241796414504b0 (diff)
Merge tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linux
Pull devicetree updates from Rob Herring: - Import of latest upstream device tree compiler (dtc) - New function of_get_child_by_name - Support for #size-cells of 0 and #addr-cells of >2 - Couple of DT binding documentation updates Fix up trivial conflicts due to of_get_child_by_name() having been added next to the new of_get_next_available_child(). * tag 'dt-for-3.7' of git://sources.calxeda.com/kernel/linux: MAINTAINERS: add scripts/dtc under Devicetree maintainers dtc: import latest upstream dtc dt: Document general interrupt controller bindings dt/s3c64xx/spi: Use of_get_child_by_name to get a named child dt: introduce of_get_child_by_name to get child node by name of: i2c: add support for wakeup-source property of/address: Handle #address-cells > 2 specially DT: export of_irq_to_resource_table() devicetree: serial: Add documentation for imx serial devicetree: pwm: mxs-pwm.txt: Fix reg field annotation of: Allow busses with #size-cells=0
Diffstat (limited to 'scripts/dtc/libfdt/libfdt_env.h')
-rw-r--r--scripts/dtc/libfdt/libfdt_env.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/scripts/dtc/libfdt/libfdt_env.h b/scripts/dtc/libfdt/libfdt_env.h
index 449bf602daf1..213d7fb81c42 100644
--- a/scripts/dtc/libfdt/libfdt_env.h
+++ b/scripts/dtc/libfdt/libfdt_env.h
@@ -5,19 +5,25 @@
5#include <stdint.h> 5#include <stdint.h>
6#include <string.h> 6#include <string.h>
7 7
8#define _B(n) ((unsigned long long)((uint8_t *)&x)[n]) 8#define EXTRACT_BYTE(n) ((unsigned long long)((uint8_t *)&x)[n])
9static inline uint16_t fdt16_to_cpu(uint16_t x)
10{
11 return (EXTRACT_BYTE(0) << 8) | EXTRACT_BYTE(1);
12}
13#define cpu_to_fdt16(x) fdt16_to_cpu(x)
14
9static inline uint32_t fdt32_to_cpu(uint32_t x) 15static inline uint32_t fdt32_to_cpu(uint32_t x)
10{ 16{
11 return (_B(0) << 24) | (_B(1) << 16) | (_B(2) << 8) | _B(3); 17 return (EXTRACT_BYTE(0) << 24) | (EXTRACT_BYTE(1) << 16) | (EXTRACT_BYTE(2) << 8) | EXTRACT_BYTE(3);
12} 18}
13#define cpu_to_fdt32(x) fdt32_to_cpu(x) 19#define cpu_to_fdt32(x) fdt32_to_cpu(x)
14 20
15static inline uint64_t fdt64_to_cpu(uint64_t x) 21static inline uint64_t fdt64_to_cpu(uint64_t x)
16{ 22{
17 return (_B(0) << 56) | (_B(1) << 48) | (_B(2) << 40) | (_B(3) << 32) 23 return (EXTRACT_BYTE(0) << 56) | (EXTRACT_BYTE(1) << 48) | (EXTRACT_BYTE(2) << 40) | (EXTRACT_BYTE(3) << 32)
18 | (_B(4) << 24) | (_B(5) << 16) | (_B(6) << 8) | _B(7); 24 | (EXTRACT_BYTE(4) << 24) | (EXTRACT_BYTE(5) << 16) | (EXTRACT_BYTE(6) << 8) | EXTRACT_BYTE(7);
19} 25}
20#define cpu_to_fdt64(x) fdt64_to_cpu(x) 26#define cpu_to_fdt64(x) fdt64_to_cpu(x)
21#undef _B 27#undef EXTRACT_BYTE
22 28
23#endif /* _LIBFDT_ENV_H */ 29#endif /* _LIBFDT_ENV_H */