Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 2 | /** |
| 3 | * (C) Copyright 2014, Cavium Inc. |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 4 | **/ |
| 5 | |
| 6 | #include <common.h> |
Simon Glass | afb0215 | 2019-12-28 10:45:01 -0700 | [diff] [blame] | 7 | #include <cpu_func.h> |
Simon Glass | 11c89f3 | 2017-05-17 17:18:03 -0600 | [diff] [blame] | 8 | #include <dm.h> |
Simon Glass | 18afe10 | 2019-11-14 12:57:47 -0700 | [diff] [blame] | 9 | #include <init.h> |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 10 | #include <malloc.h> |
| 11 | #include <errno.h> |
Simon Glass | 274e0b0 | 2020-05-10 11:39:56 -0600 | [diff] [blame] | 12 | #include <net.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 13 | #include <asm/global_data.h> |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 14 | #include <linux/compiler.h> |
| 15 | |
Sergey Temerkhanov | 223f74d | 2015-10-14 09:55:52 -0700 | [diff] [blame] | 16 | #include <cavium/atf.h> |
Alexander Graf | 6b3e7ca | 2016-03-04 01:09:48 +0100 | [diff] [blame] | 17 | #include <asm/armv8/mmu.h> |
Sergey Temerkhanov | 223f74d | 2015-10-14 09:55:52 -0700 | [diff] [blame] | 18 | |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 19 | #if !CONFIG_IS_ENABLED(OF_CONTROL) |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 20 | #include <dm/platform_data/serial_pl01x.h> |
| 21 | |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 22 | static const struct pl01x_serial_plat serial0 = { |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 23 | .base = CONFIG_SYS_SERIAL0, |
| 24 | .type = TYPE_PL011, |
| 25 | .clock = 0, |
| 26 | .skip_init = true, |
| 27 | }; |
| 28 | |
Simon Glass | 1d8364a | 2020-12-28 20:34:54 -0700 | [diff] [blame] | 29 | U_BOOT_DRVINFO(thunderx_serial0) = { |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 30 | .name = "serial_pl01x", |
Simon Glass | 71fa5b4 | 2020-12-03 16:55:18 -0700 | [diff] [blame] | 31 | .plat = &serial0, |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
Simon Glass | b75b15b | 2020-12-03 16:55:23 -0700 | [diff] [blame] | 34 | static const struct pl01x_serial_plat serial1 = { |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 35 | .base = CONFIG_SYS_SERIAL1, |
| 36 | .type = TYPE_PL011, |
| 37 | .clock = 0, |
| 38 | .skip_init = true, |
| 39 | }; |
| 40 | |
Simon Glass | 1d8364a | 2020-12-28 20:34:54 -0700 | [diff] [blame] | 41 | U_BOOT_DRVINFO(thunderx_serial1) = { |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 42 | .name = "serial_pl01x", |
Simon Glass | 71fa5b4 | 2020-12-03 16:55:18 -0700 | [diff] [blame] | 43 | .plat = &serial1, |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 44 | }; |
| 45 | #endif |
| 46 | |
| 47 | DECLARE_GLOBAL_DATA_PTR; |
| 48 | |
Alexander Graf | 6b3e7ca | 2016-03-04 01:09:48 +0100 | [diff] [blame] | 49 | static struct mm_region thunderx_mem_map[] = { |
| 50 | { |
York Sun | c7104e5 | 2016-06-24 16:46:22 -0700 | [diff] [blame] | 51 | .virt = 0x000000000000UL, |
| 52 | .phys = 0x000000000000UL, |
Alexander Graf | 6b3e7ca | 2016-03-04 01:09:48 +0100 | [diff] [blame] | 53 | .size = 0x40000000000UL, |
| 54 | .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_NON_SHARE, |
| 55 | }, { |
York Sun | c7104e5 | 2016-06-24 16:46:22 -0700 | [diff] [blame] | 56 | .virt = 0x800000000000UL, |
| 57 | .phys = 0x800000000000UL, |
Alexander Graf | 6b3e7ca | 2016-03-04 01:09:48 +0100 | [diff] [blame] | 58 | .size = 0x40000000000UL, |
| 59 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 60 | PTE_BLOCK_NON_SHARE, |
| 61 | }, { |
York Sun | c7104e5 | 2016-06-24 16:46:22 -0700 | [diff] [blame] | 62 | .virt = 0x840000000000UL, |
| 63 | .phys = 0x840000000000UL, |
Alexander Graf | 6b3e7ca | 2016-03-04 01:09:48 +0100 | [diff] [blame] | 64 | .size = 0x40000000000UL, |
| 65 | .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| 66 | PTE_BLOCK_NON_SHARE, |
| 67 | }, { |
| 68 | /* List terminator */ |
| 69 | 0, |
| 70 | } |
| 71 | }; |
| 72 | |
| 73 | struct mm_region *mem_map = thunderx_mem_map; |
| 74 | |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 75 | int board_init(void) |
| 76 | { |
| 77 | return 0; |
| 78 | } |
| 79 | |
| 80 | int timer_init(void) |
| 81 | { |
Sergey Temerkhanov | 223f74d | 2015-10-14 09:55:52 -0700 | [diff] [blame] | 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | int dram_init(void) |
| 86 | { |
| 87 | ssize_t node_count = atf_node_count(); |
| 88 | ssize_t dram_size; |
| 89 | int node; |
| 90 | |
| 91 | printf("Initializing\nNodes in system: %zd\n", node_count); |
| 92 | |
| 93 | gd->ram_size = 0; |
| 94 | |
| 95 | for (node = 0; node < node_count; node++) { |
| 96 | dram_size = atf_dram_size(node); |
| 97 | printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20); |
| 98 | gd->ram_size += dram_size; |
| 99 | } |
| 100 | |
| 101 | gd->ram_size -= MEM_BASE; |
| 102 | |
| 103 | *(unsigned long *)CPU_RELEASE_ADDR = 0; |
| 104 | |
| 105 | puts("DRAM size:"); |
| 106 | |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 107 | return 0; |
| 108 | } |
| 109 | |
| 110 | /* |
| 111 | * Board specific reset that is system reset. |
| 112 | */ |
| 113 | void reset_cpu(ulong addr) |
| 114 | { |
| 115 | } |
| 116 | |
| 117 | /* |
| 118 | * Board specific ethernet initialization routine. |
| 119 | */ |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 120 | int board_eth_init(struct bd_info *bis) |
Sergey Temerkhanov | 69f7a03 | 2015-10-14 09:55:50 -0700 | [diff] [blame] | 121 | { |
| 122 | int rc = 0; |
| 123 | |
| 124 | return rc; |
| 125 | } |
| 126 | |
| 127 | #ifdef CONFIG_PCI |
| 128 | void pci_init_board(void) |
| 129 | { |
| 130 | printf("DEBUG: PCI Init TODO *****\n"); |
| 131 | } |
| 132 | #endif |