Rafal Jaworowski | 500856e | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2007 Semihalf |
| 3 | * |
| 4 | * Written by: Rafal Jaworowski <raj@semihalf.com> |
| 5 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Rafal Jaworowski | 500856e | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 7 | * |
| 8 | * This file contains routines that fetch data from PowerPC-dependent sources |
| 9 | * (bd_info etc.) |
Rafal Jaworowski | 500856e | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <config.h> |
Rafal Jaworowski | 500856e | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 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 | |
| 21 | DECLARE_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 | */ |
| 28 | int platform_sys_info(struct sys_info *si) |
| 29 | { |
| 30 | si->clk_bus = gd->bus_clk; |
| 31 | si->clk_cpu = gd->cpu_clk; |
| 32 | |
Masahiro Yamada | 58dac32 | 2014-03-05 17:40:10 +0900 | [diff] [blame] | 33 | #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || defined(CONFIG_MPC8260) || \ |
Rafal Jaworowski | 500856e | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 34 | defined(CONFIG_E500) || defined(CONFIG_MPC86xx) |
| 35 | #define bi_bar bi_immr_base |
| 36 | #elif defined(CONFIG_MPC5xxx) |
| 37 | #define bi_bar bi_mbar_base |
Peter Tyser | 0f89860 | 2009-05-22 17:23:24 -0500 | [diff] [blame] | 38 | #elif defined(CONFIG_MPC83xx) |
Rafal Jaworowski | 500856e | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 39 | #define bi_bar bi_immrbar |
Rafal Jaworowski | 500856e | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 40 | #endif |
| 41 | |
| 42 | #if defined(bi_bar) |
| 43 | si->bar = gd->bd->bi_bar; |
| 44 | #undef bi_bar |
| 45 | #else |
Matthias Fuchs | 12c6670 | 2008-10-04 19:26:16 +0200 | [diff] [blame] | 46 | si->bar = 0; |
Rafal Jaworowski | 500856e | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 47 | #endif |
| 48 | |
| 49 | platform_set_mr(si, gd->bd->bi_memstart, gd->bd->bi_memsize, MR_ATTR_DRAM); |
| 50 | platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, MR_ATTR_FLASH); |
| 51 | platform_set_mr(si, gd->bd->bi_sramstart, gd->bd->bi_sramsize, MR_ATTR_SRAM); |
| 52 | |
| 53 | return 1; |
| 54 | } |