blob: 03f9122404c76b6127320d7fda04c9eb659e3744 [file] [log] [blame]
David Hendricks8cbd5692017-12-01 20:49:48 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2018 Facebook, Inc.
5 * Copyright 2003-2017 Cavium Inc. <support@cavium.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * Derived from Cavium's BSD-3 Clause OCTEONTX-SDK-6.2.0.
17 */
18
19#include <bootmode.h>
20#include <console/console.h>
21#include <cpu/cpu.h>
22#include <device/device.h>
23#include <soc/addressmap.h>
24#include <soc/clock.h>
25#include <soc/sdram.h>
26#include <soc/timer.h>
27#include <stddef.h>
28#include <stdlib.h>
29#include <string.h>
30#include <symbols.h>
31#include <libbdk-boot/bdk-boot.h>
32
33static void soc_read_resources(device_t dev)
34{
35 ram_resource(dev, 0, (uintptr_t)_dram / KiB, sdram_size_mb() * KiB);
36}
37
38static void soc_init(device_t dev)
39{
40 /* Init ECAM, MDIO, PEM, PHY, QLM ... */
41 bdk_boot();
42
43 /* TODO: additional trustzone init */
44}
45
46static void soc_final(device_t dev)
47{
48 watchdog_disable(0);
49}
50
51static struct device_operations soc_ops = {
52 .read_resources = soc_read_resources,
53 .init = soc_init,
54 .final = soc_final,
55};
56
57static void enable_soc_dev(device_t dev)
58{
59 dev->ops = &soc_ops;
60}
61
62struct chip_operations soc_cavium_cn81xx_ops = {
63 CHIP_NAME("SOC Cavium CN81XX")
64 .enable_dev = enable_soc_dev,
65};