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