blob: fd234728980fcb204d752f200f2ab55f8f3e76a9 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -07002/**
3 * (C) Copyright 2014, Cavium Inc.
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -07004**/
5
6#include <common.h>
Simon Glassafb02152019-12-28 10:45:01 -07007#include <cpu_func.h>
Simon Glass11c89f32017-05-17 17:18:03 -06008#include <dm.h>
Simon Glass18afe102019-11-14 12:57:47 -07009#include <init.h>
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070010#include <malloc.h>
11#include <errno.h>
Simon Glass274e0b02020-05-10 11:39:56 -060012#include <net.h>
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070013#include <linux/compiler.h>
14
Sergey Temerkhanov223f74d2015-10-14 09:55:52 -070015#include <cavium/atf.h>
Alexander Graf6b3e7ca2016-03-04 01:09:48 +010016#include <asm/armv8/mmu.h>
Sergey Temerkhanov223f74d2015-10-14 09:55:52 -070017
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070018#if !CONFIG_IS_ENABLED(OF_CONTROL)
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070019#include <dm/platform_data/serial_pl01x.h>
20
Simon Glassb75b15b2020-12-03 16:55:23 -070021static const struct pl01x_serial_plat serial0 = {
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070022 .base = CONFIG_SYS_SERIAL0,
23 .type = TYPE_PL011,
24 .clock = 0,
25 .skip_init = true,
26};
27
Simon Glass1d8364a2020-12-28 20:34:54 -070028U_BOOT_DRVINFO(thunderx_serial0) = {
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070029 .name = "serial_pl01x",
Simon Glass71fa5b42020-12-03 16:55:18 -070030 .plat = &serial0,
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070031};
32
Simon Glassb75b15b2020-12-03 16:55:23 -070033static const struct pl01x_serial_plat serial1 = {
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070034 .base = CONFIG_SYS_SERIAL1,
35 .type = TYPE_PL011,
36 .clock = 0,
37 .skip_init = true,
38};
39
Simon Glass1d8364a2020-12-28 20:34:54 -070040U_BOOT_DRVINFO(thunderx_serial1) = {
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070041 .name = "serial_pl01x",
Simon Glass71fa5b42020-12-03 16:55:18 -070042 .plat = &serial1,
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070043};
44#endif
45
46DECLARE_GLOBAL_DATA_PTR;
47
Alexander Graf6b3e7ca2016-03-04 01:09:48 +010048static struct mm_region thunderx_mem_map[] = {
49 {
York Sunc7104e52016-06-24 16:46:22 -070050 .virt = 0x000000000000UL,
51 .phys = 0x000000000000UL,
Alexander Graf6b3e7ca2016-03-04 01:09:48 +010052 .size = 0x40000000000UL,
53 .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_NON_SHARE,
54 }, {
York Sunc7104e52016-06-24 16:46:22 -070055 .virt = 0x800000000000UL,
56 .phys = 0x800000000000UL,
Alexander Graf6b3e7ca2016-03-04 01:09:48 +010057 .size = 0x40000000000UL,
58 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
59 PTE_BLOCK_NON_SHARE,
60 }, {
York Sunc7104e52016-06-24 16:46:22 -070061 .virt = 0x840000000000UL,
62 .phys = 0x840000000000UL,
Alexander Graf6b3e7ca2016-03-04 01:09:48 +010063 .size = 0x40000000000UL,
64 .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
65 PTE_BLOCK_NON_SHARE,
66 }, {
67 /* List terminator */
68 0,
69 }
70};
71
72struct mm_region *mem_map = thunderx_mem_map;
73
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -070074int board_init(void)
75{
76 return 0;
77}
78
79int timer_init(void)
80{
Sergey Temerkhanov223f74d2015-10-14 09:55:52 -070081 return 0;
82}
83
84int dram_init(void)
85{
86 ssize_t node_count = atf_node_count();
87 ssize_t dram_size;
88 int node;
89
90 printf("Initializing\nNodes in system: %zd\n", node_count);
91
92 gd->ram_size = 0;
93
94 for (node = 0; node < node_count; node++) {
95 dram_size = atf_dram_size(node);
96 printf("Node %d: %zd MBytes of DRAM\n", node, dram_size >> 20);
97 gd->ram_size += dram_size;
98 }
99
100 gd->ram_size -= MEM_BASE;
101
102 *(unsigned long *)CPU_RELEASE_ADDR = 0;
103
104 puts("DRAM size:");
105
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -0700106 return 0;
107}
108
109/*
110 * Board specific reset that is system reset.
111 */
112void reset_cpu(ulong addr)
113{
114}
115
116/*
117 * Board specific ethernet initialization routine.
118 */
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +0900119int board_eth_init(struct bd_info *bis)
Sergey Temerkhanov69f7a032015-10-14 09:55:50 -0700120{
121 int rc = 0;
122
123 return rc;
124}
125
126#ifdef CONFIG_PCI
127void pci_init_board(void)
128{
129 printf("DEBUG: PCI Init TODO *****\n");
130}
131#endif