blob: d1b54ea4e141a9062fb7642355a6620e7e29c2c1 [file] [log] [blame]
Rafal Jaworowski500856e2008-01-09 19:39:36 +01001/*
2 * (C) Copyright 2007 Semihalf
3 *
4 * Written by: Rafal Jaworowski <raj@semihalf.com>
5 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Rafal Jaworowski500856e2008-01-09 19:39:36 +01007 *
8 * This file contains routines that fetch data from PowerPC-dependent sources
9 * (bd_info etc.)
Rafal Jaworowski500856e2008-01-09 19:39:36 +010010 */
11
12#include <config.h>
Rafal Jaworowski500856e2008-01-09 19:39:36 +010013#include <linux/types.h>
14#include <api_public.h>
15
16#include <asm/u-boot.h>
17#include <asm/global_data.h>
18
19#include "api_private.h"
20
21DECLARE_GLOBAL_DATA_PTR;
22
23/*
24 * Important notice: handling of individual fields MUST be kept in sync with
25 * include/asm-ppc/u-boot.h and include/asm-ppc/global_data.h, so any changes
26 * need to reflect their current state and layout of structures involved!
27 */
28int platform_sys_info(struct sys_info *si)
29{
30 si->clk_bus = gd->bus_clk;
31 si->clk_cpu = gd->cpu_clk;
32
Heiko Schocher50258972017-06-07 17:33:11 +020033#if defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
Rafal Jaworowski500856e2008-01-09 19:39:36 +010034#define bi_bar bi_immr_base
Peter Tyser0f898602009-05-22 17:23:24 -050035#elif defined(CONFIG_MPC83xx)
Rafal Jaworowski500856e2008-01-09 19:39:36 +010036#define bi_bar bi_immrbar
Rafal Jaworowski500856e2008-01-09 19:39:36 +010037#endif
38
39#if defined(bi_bar)
40 si->bar = gd->bd->bi_bar;
41#undef bi_bar
42#else
Matthias Fuchs12c66702008-10-04 19:26:16 +020043 si->bar = 0;
Rafal Jaworowski500856e2008-01-09 19:39:36 +010044#endif
45
46 platform_set_mr(si, gd->bd->bi_memstart, gd->bd->bi_memsize, MR_ATTR_DRAM);
47 platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, MR_ATTR_FLASH);
48 platform_set_mr(si, gd->bd->bi_sramstart, gd->bd->bi_sramsize, MR_ATTR_SRAM);
49
50 return 1;
51}