Simon Glass | ec564b4 | 2016-07-04 11:58:08 -0600 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | # |
| 3 | # Copyright (C) 2016 Google, Inc |
| 4 | # Written by Simon Glass <sjg@chromium.org> |
| 5 | # |
| 6 | # SPDX-License-Identifier: GPL-2.0+ |
| 7 | # |
| 8 | |
| 9 | import struct |
| 10 | |
Simon Glass | ec564b4 | 2016-07-04 11:58:08 -0600 | [diff] [blame] | 11 | def fdt32_to_cpu(val): |
| 12 | """Convert a device tree cell to an integer |
| 13 | |
| 14 | Args: |
| 15 | Value to convert (4-character string representing the cell value) |
| 16 | |
| 17 | Return: |
| 18 | A native-endian integer value |
| 19 | """ |
| 20 | return struct.unpack(">I", val)[0] |