]> git.ipfire.org Git - people/ms/u-boot.git/blame - api/api_platform-powerpc.c
arm: ti: Add missing guards to headers
[people/ms/u-boot.git] / api / api_platform-powerpc.c
CommitLineData
500856eb
RJ
1/*
2 * (C) Copyright 2007 Semihalf
3 *
4 * Written by: Rafal Jaworowski <raj@semihalf.com>
5 *
1a459660 6 * SPDX-License-Identifier: GPL-2.0+
500856eb
RJ
7 *
8 * This file contains routines that fetch data from PowerPC-dependent sources
9 * (bd_info etc.)
500856eb
RJ
10 */
11
12#include <config.h>
500856eb
RJ
13#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
50258977 33#if defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
500856eb
RJ
34#define bi_bar bi_immr_base
35#elif defined(CONFIG_MPC5xxx)
36#define bi_bar bi_mbar_base
0f898604 37#elif defined(CONFIG_MPC83xx)
500856eb 38#define bi_bar bi_immrbar
500856eb
RJ
39#endif
40
41#if defined(bi_bar)
42 si->bar = gd->bd->bi_bar;
43#undef bi_bar
44#else
12c6670f 45 si->bar = 0;
500856eb
RJ
46#endif
47
48 platform_set_mr(si, gd->bd->bi_memstart, gd->bd->bi_memsize, MR_ATTR_DRAM);
49 platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, MR_ATTR_FLASH);
50 platform_set_mr(si, gd->bd->bi_sramstart, gd->bd->bi_sramsize, MR_ATTR_SRAM);
51
52 return 1;
53}