Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2007 Semihalf |
| 4 | * |
| 5 | * Written by: Rafal Jaworowski <raj@semihalf.com> |
| 6 | * |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 7 | * This file contains routines that fetch data from PowerPC-dependent sources |
| 8 | * (bd_info etc.) |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 9 | */ |
| 10 | |
| 11 | #include <config.h> |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 12 | #include <linux/types.h> |
| 13 | #include <api_public.h> |
| 14 | |
| 15 | #include <asm/u-boot.h> |
| 16 | #include <asm/global_data.h> |
| 17 | |
| 18 | #include "api_private.h" |
| 19 | |
| 20 | DECLARE_GLOBAL_DATA_PTR; |
| 21 | |
| 22 | /* |
| 23 | * Important notice: handling of individual fields MUST be kept in sync with |
| 24 | * include/asm-ppc/u-boot.h and include/asm-ppc/global_data.h, so any changes |
| 25 | * need to reflect their current state and layout of structures involved! |
| 26 | */ |
| 27 | int platform_sys_info(struct sys_info *si) |
| 28 | { |
| 29 | si->clk_bus = gd->bus_clk; |
| 30 | si->clk_cpu = gd->cpu_clk; |
| 31 | |
Christophe Leroy | b3510fb | 2018-03-16 17:20:41 +0100 | [diff] [blame] | 32 | #if defined(CONFIG_MPC8xx) || defined(CONFIG_E500) || defined(CONFIG_MPC86xx) |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 33 | #define bi_bar bi_immr_base |
Peter Tyser | 62e7398 | 2009-05-22 17:23:24 -0500 | [diff] [blame] | 34 | #elif defined(CONFIG_MPC83xx) |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 35 | #define bi_bar bi_immrbar |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 36 | #endif |
| 37 | |
| 38 | #if defined(bi_bar) |
| 39 | si->bar = gd->bd->bi_bar; |
| 40 | #undef bi_bar |
| 41 | #else |
Matthias Fuchs | 6e31d91 | 2008-10-04 19:26:16 +0200 | [diff] [blame] | 42 | si->bar = 0; |
Rafal Jaworowski | a19be78 | 2008-01-09 19:39:36 +0100 | [diff] [blame] | 43 | #endif |
| 44 | |
| 45 | platform_set_mr(si, gd->bd->bi_memstart, gd->bd->bi_memsize, MR_ATTR_DRAM); |
| 46 | platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, MR_ATTR_FLASH); |
| 47 | platform_set_mr(si, gd->bd->bi_sramstart, gd->bd->bi_sramsize, MR_ATTR_SRAM); |
| 48 | |
| 49 | return 1; |
| 50 | } |