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