summaryrefslogtreecommitdiff
path: root/src/soc/cavium/cn81xx/bootblock.c
blob: 64728daf8f0c20a5a1a6411a8c2d39bff829045e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * This file is part of the coreboot project.
 *
 * Copyright 2018       Facebook, Inc.
 * Copyright 2003-2017  Cavium Inc.  <support@cavium.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * Derived from Cavium's BSD-3 Clause OCTEONTX-SDK-6.2.0.
 */

#include <commonlib/helpers.h>
#include <soc/bootblock.h>
#include <soc/sysreg.h>
#include <soc/timer.h>
#include <libbdk-arch/bdk-asm.h>

static void init_sysreg(void)
{
	/* The defaults for write buffer timeouts are poor */
	u64 cvmmemctl0;
	BDK_MRS(s3_0_c11_c0_4, cvmmemctl0);
	cvmmemctl0 |= AP_CVMMEMCTL0_EL1_WBFTONSHENA |
		AP_CVMMEMCTL0_EL1_WBFTOMRGCLRENA;
	BDK_MSR(s3_0_c11_c0_4, cvmmemctl0);
}

void bootblock_soc_early_init(void)
{
}

void bootblock_soc_init(void)
{
	/* initialize system registers */
	init_sysreg();

	/* Set watchdog to 5 seconds timeout */
	watchdog_set(0, 5000);
	watchdog_poke(0);

	/* TODO: additional clock init? */
}