1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Passing basic information from SPL to U-Boot proper 4 * 5 * Copyright 2018 Google, Inc 6 */ 7 8#include <common.h> 9#include <handoff.h> 10 11DECLARE_GLOBAL_DATA_PTR; 12 13void handoff_save_dram(struct spl_handoff *ho) 14{ 15 ho->ram_size = gd->ram_size; 16#ifdef CONFIG_NR_DRAM_BANKS 17 { 18 struct bd_info *bd = gd->bd; 19 int i; 20 21 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { 22 ho->ram_bank[i].start = bd->bi_dram[i].start; 23 ho->ram_bank[i].size = bd->bi_dram[i].size; 24 } 25 } 26#endif 27} 28 29void handoff_load_dram_size(struct spl_handoff *ho) 30{ 31 gd->ram_size = ho->ram_size; 32} 33 34void handoff_load_dram_banks(struct spl_handoff *ho) 35{ 36#ifdef CONFIG_NR_DRAM_BANKS 37 { 38 struct bd_info *bd = gd->bd; 39 int i; 40 41 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { 42 bd->bi_dram[i].start = ho->ram_bank[i].start; 43 bd->bi_dram[i].size = ho->ram_bank[i].size; 44 } 45 } 46#endif 47} 48