Lokesh Vutla | 0911d95 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Board specific initialization for AM654 EVM |
| 4 | * |
| 5 | * Copyright (C) 2017-2018 Texas Instruments Incorporated - http://www.ti.com/ |
| 6 | * Lokesh Vutla <lokeshvutla@ti.com> |
| 7 | * |
| 8 | */ |
| 9 | |
| 10 | #include <common.h> |
| 11 | #include <asm/io.h> |
| 12 | #include <spl.h> |
Lokesh Vutla | 5582c03 | 2019-03-08 11:47:35 +0530 | [diff] [blame^] | 13 | #include <asm/arch/sys_proto.h> |
Lokesh Vutla | 0911d95 | 2018-08-27 15:59:06 +0530 | [diff] [blame] | 14 | |
| 15 | DECLARE_GLOBAL_DATA_PTR; |
| 16 | |
| 17 | int board_init(void) |
| 18 | { |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | int dram_init(void) |
| 23 | { |
| 24 | #ifdef CONFIG_PHYS_64BIT |
| 25 | gd->ram_size = 0x100000000; |
| 26 | #else |
| 27 | gd->ram_size = 0x80000000; |
| 28 | #endif |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | ulong board_get_usable_ram_top(ulong total_size) |
| 34 | { |
| 35 | #ifdef CONFIG_PHYS_64BIT |
| 36 | /* Limit RAM used by U-Boot to the DDR low region */ |
| 37 | if (gd->ram_top > 0x100000000) |
| 38 | return 0x100000000; |
| 39 | #endif |
| 40 | |
| 41 | return gd->ram_top; |
| 42 | } |
| 43 | |
| 44 | int dram_init_banksize(void) |
| 45 | { |
| 46 | /* Bank 0 declares the memory available in the DDR low region */ |
| 47 | gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; |
| 48 | gd->bd->bi_dram[0].size = 0x80000000; |
| 49 | |
| 50 | #ifdef CONFIG_PHYS_64BIT |
| 51 | /* Bank 1 declares the memory available in the DDR high region */ |
| 52 | gd->bd->bi_dram[1].start = CONFIG_SYS_SDRAM_BASE1; |
| 53 | gd->bd->bi_dram[1].size = 0x80000000; |
| 54 | #endif |
| 55 | |
| 56 | return 0; |
| 57 | } |
Lokesh Vutla | ea8ad1d | 2018-08-27 15:59:08 +0530 | [diff] [blame] | 58 | |
| 59 | #ifdef CONFIG_SPL_LOAD_FIT |
| 60 | int board_fit_config_name_match(const char *name) |
| 61 | { |
| 62 | #ifdef CONFIG_TARGET_AM654_A53_EVM |
| 63 | if (!strcmp(name, "k3-am654-base-board")) |
| 64 | return 0; |
| 65 | #endif |
| 66 | |
| 67 | return -1; |
| 68 | } |
| 69 | #endif |
Lokesh Vutla | 5582c03 | 2019-03-08 11:47:35 +0530 | [diff] [blame^] | 70 | |
| 71 | #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) |
| 72 | int ft_board_setup(void *blob, bd_t *bd) |
| 73 | { |
| 74 | int ret; |
| 75 | |
| 76 | ret = fdt_fixup_msmc_ram(blob, "/interconnect@100000", "sram@70000000"); |
| 77 | if (ret) |
| 78 | printf("%s: fixing up msmc ram failed %d\n", __func__, ret); |
| 79 | |
| 80 | return ret; |
| 81 | } |
| 82 | #endif |