1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * (C) Copyright 2007 Semihalf
4  *
5  * Written by: Rafal Jaworowski <raj@semihalf.com>
6  *
7  * This file contains a routine to fetch data from the global_data structure.
8  */
9 
10 #include <api_public.h>
11 #include <asm/global_data.h>
12 #include "api_private.h"
13 
14 DECLARE_GLOBAL_DATA_PTR;
15 
platform_sys_info(struct sys_info * si)16 int platform_sys_info(struct sys_info *si)
17 {
18 	int i;
19 
20 	si->clk_bus = gd->bus_clk;
21 	si->clk_cpu = gd->cpu_clk;
22 
23 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
24 		platform_set_mr(si, gd->bd->bi_dram[i].start,
25 				gd->bd->bi_dram[i].size, MR_ATTR_DRAM);
26 
27 	platform_set_mr(si, gd->ram_base, gd->ram_size, MR_ATTR_DRAM);
28 	platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, MR_ATTR_FLASH);
29 
30 	return 1;
31 }
32