John Clark | d88366e | 2023-10-13 01:19:22 +0000 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (c) 2023 Rockchip Electronics Co,. Ltd. |
| 4 | */ |
| 5 | |
| 6 | #include <fdtdec.h> |
| 7 | #include <fdt_support.h> |
| 8 | |
| 9 | #ifdef CONFIG_OF_BOARD_SETUP |
| 10 | int nanopc_t6_add_reserved_memory_fdt_nodes(void *new_blob) |
| 11 | { |
| 12 | struct fdt_memory gap1 = { |
| 13 | .start = 0x3fc000000, |
| 14 | .end = 0x3fc4fffff, |
| 15 | }; |
| 16 | struct fdt_memory gap2 = { |
| 17 | .start = 0x3fff00000, |
| 18 | .end = 0x3ffffffff, |
| 19 | }; |
| 20 | unsigned long flags = FDTDEC_RESERVED_MEMORY_NO_MAP; |
| 21 | unsigned int ret; |
| 22 | |
| 23 | /* |
| 24 | * Inject the reserved-memory nodes into the DTS |
| 25 | */ |
| 26 | ret = fdtdec_add_reserved_memory(new_blob, "gap1", &gap1, NULL, 0, |
| 27 | NULL, flags); |
| 28 | if (ret) |
| 29 | return ret; |
| 30 | |
| 31 | return fdtdec_add_reserved_memory(new_blob, "gap2", &gap2, NULL, 0, |
| 32 | NULL, flags); |
| 33 | } |
| 34 | |
| 35 | int ft_board_setup(void *blob, struct bd_info *bd) |
| 36 | { |
| 37 | return nanopc_t6_add_reserved_memory_fdt_nodes(blob); |
| 38 | } |
| 39 | #endif |