blob: 453dc0f59505c430ebe5be5b1e3e289d18798d5e [file] [log] [blame]
huang linc14b54d2016-03-02 18:38:40 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2015 MediaTek Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
huang linc14b54d2016-03-02 18:38:40 +080016#include <console/console.h>
Lin Huang19eb7502016-03-26 11:50:05 +080017#include <cpu/cpu.h>
huang linc14b54d2016-03-02 18:38:40 +080018#include <device/device.h>
Lin Huang19eb7502016-03-26 11:50:05 +080019#include <soc/addressmap.h>
huang linc14b54d2016-03-02 18:38:40 +080020#include <stddef.h>
Lin Huang19eb7502016-03-26 11:50:05 +080021#include <stdlib.h>
huang linc14b54d2016-03-02 18:38:40 +080022#include <string.h>
23#include <symbols.h>
24
25static void soc_read_resources(device_t dev)
26{
27 ram_resource(dev, 0, (uintptr_t)_dram / KiB,
Lin Huang19eb7502016-03-26 11:50:05 +080028 min(CONFIG_DRAM_SIZE_MB * KiB, MAX_DRAM_ADDRESS / KiB));
huang linc14b54d2016-03-02 18:38:40 +080029}
30
31static void soc_init(device_t dev)
32{
33 /* reserve bl31 image, which define in
34 * arm-trusted-firmware/plat/rockchip/rk3399/include/platform_def.h
35 */
36 mmio_resource(dev, 1, (0x500000 / KiB), (0x80000 / KiB));
37}
38
39static struct device_operations soc_ops = {
40 .read_resources = soc_read_resources,
41 .init = soc_init,
42};
43
44static void enable_soc_dev(device_t dev)
45{
46 dev->ops = &soc_ops;
47}
48
49struct chip_operations soc_rockchip_rk3399_ops = {
50 CHIP_NAME("SOC Rockchip RK3399\n")
51 .enable_dev = enable_soc_dev,
52};