Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Scott Branden | 5a5cb00 | 2014-08-11 13:58:25 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2014 Broadcom Corporation. |
Scott Branden | 5a5cb00 | 2014-08-11 13:58:25 -0700 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | 370382c | 2019-11-14 12:57:35 -0700 | [diff] [blame] | 7 | #include <cpu_func.h> |
Simon Glass | 8e16b1e | 2019-12-28 10:45:05 -0700 | [diff] [blame] | 8 | #include <init.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 9 | #include <net.h> |
| 10 | #include <asm/cache.h> |
Scott Branden | 5a5cb00 | 2014-08-11 13:58:25 -0700 | [diff] [blame] | 11 | #include <asm/io.h> |
| 12 | #include <config.h> |
Jiandong Zheng | 19b6b69 | 2015-07-15 16:28:14 -0700 | [diff] [blame] | 13 | #include <netdev.h> |
Scott Branden | 5a5cb00 | 2014-08-11 13:58:25 -0700 | [diff] [blame] | 14 | #include <asm/system.h> |
| 15 | #include <asm/iproc-common/armpll.h> |
| 16 | |
| 17 | DECLARE_GLOBAL_DATA_PTR; |
| 18 | |
| 19 | /* |
| 20 | * board_init - early hardware init |
| 21 | */ |
| 22 | int board_init(void) |
| 23 | { |
| 24 | /* |
| 25 | * Address of boot parameters passed to kernel |
| 26 | * Use default offset 0x100 |
| 27 | */ |
| 28 | gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; |
| 29 | |
| 30 | return 0; |
| 31 | } |
| 32 | |
| 33 | /* |
| 34 | * dram_init - sets u-boot's idea of sdram size |
| 35 | */ |
| 36 | int dram_init(void) |
| 37 | { |
| 38 | gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE, |
| 39 | CONFIG_SYS_SDRAM_SIZE); |
| 40 | return 0; |
| 41 | } |
| 42 | |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 43 | int dram_init_banksize(void) |
Scott Branden | 5a5cb00 | 2014-08-11 13:58:25 -0700 | [diff] [blame] | 44 | { |
| 45 | gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; |
| 46 | gd->bd->bi_dram[0].size = gd->ram_size; |
Simon Glass | 2f949c3 | 2017-03-31 08:40:32 -0600 | [diff] [blame] | 47 | |
| 48 | return 0; |
Scott Branden | 5a5cb00 | 2014-08-11 13:58:25 -0700 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | int board_early_init_f(void) |
| 52 | { |
| 53 | uint32_t status = 0; |
| 54 | |
| 55 | /* Setup PLL if required */ |
| 56 | #if defined(CONFIG_ARMCLK) |
| 57 | armpll_config(CONFIG_ARMCLK); |
| 58 | #endif |
| 59 | |
| 60 | return status; |
| 61 | } |
Steve Rae | 1c5f31c | 2014-11-11 11:32:18 -0800 | [diff] [blame] | 62 | |
Jan Kiszka | ac31b5a | 2015-04-21 07:18:24 +0200 | [diff] [blame] | 63 | #ifdef CONFIG_ARMV7_NONSEC |
Steve Rae | 1c5f31c | 2014-11-11 11:32:18 -0800 | [diff] [blame] | 64 | void smp_set_core_boot_addr(unsigned long addr, int corenr) |
| 65 | { |
| 66 | } |
| 67 | |
| 68 | void smp_kick_all_cpus(void) |
| 69 | { |
| 70 | } |
| 71 | |
| 72 | void smp_waitloop(unsigned previous_address) |
| 73 | { |
| 74 | } |
| 75 | #endif |
Jiandong Zheng | 19b6b69 | 2015-07-15 16:28:14 -0700 | [diff] [blame] | 76 | |
| 77 | #ifdef CONFIG_BCM_SF2_ETH |
| 78 | int board_eth_init(bd_t *bis) |
| 79 | { |
| 80 | int rc = -1; |
| 81 | printf("Registering BCM sf2 eth\n"); |
| 82 | rc = bcm_sf2_eth_register(bis, 0); |
| 83 | return rc; |
| 84 | } |
| 85 | #endif |