blob: e34ca09d065af04e64eef211340622760220c19c [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
Shunqian Zhengd1cec752016-05-04 16:21:36 +080016#include <bootmode.h>
huang linc14b54d2016-03-02 18:38:40 +080017#include <console/console.h>
Lin Huang19eb7502016-03-26 11:50:05 +080018#include <cpu/cpu.h>
huang linc14b54d2016-03-02 18:38:40 +080019#include <device/device.h>
Lin Huang19eb7502016-03-26 11:50:05 +080020#include <soc/addressmap.h>
Julius Werner7f965892016-08-29 15:07:58 -070021#include <soc/clock.h>
Shunqian Zhengd1cec752016-05-04 16:21:36 +080022#include <soc/display.h>
huang linc14b54d2016-03-02 18:38:40 +080023#include <stddef.h>
Lin Huang19eb7502016-03-26 11:50:05 +080024#include <stdlib.h>
huang linc14b54d2016-03-02 18:38:40 +080025#include <string.h>
26#include <symbols.h>
27
28static void soc_read_resources(device_t dev)
29{
30 ram_resource(dev, 0, (uintptr_t)_dram / KiB,
Lin Huang19eb7502016-03-26 11:50:05 +080031 min(CONFIG_DRAM_SIZE_MB * KiB, MAX_DRAM_ADDRESS / KiB));
huang linc14b54d2016-03-02 18:38:40 +080032}
33
34static void soc_init(device_t dev)
35{
36 /* reserve bl31 image, which define in
37 * arm-trusted-firmware/plat/rockchip/rk3399/include/platform_def.h
38 */
Caesar Wang905a9332016-04-28 14:37:48 +080039 mmio_resource(dev, 1, (0x10000 / KiB), (0x80000 / KiB));
Shunqian Zhengd1cec752016-05-04 16:21:36 +080040
41 if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) && display_init_required())
Lin Huang152e6752016-10-20 14:22:11 -070042 rk_display_init(dev);
Shunqian Zhengd1cec752016-05-04 16:21:36 +080043 else
44 printk(BIOS_INFO, "Display initialization disabled.\n");
Julius Werner7f965892016-08-29 15:07:58 -070045
46 /* We don't need big CPUs, but bring them up as a courtesy to Linux. */
47 rkclk_configure_cpu(APLL_600_MHZ, CPU_CLUSTER_BIG);
huang linc14b54d2016-03-02 18:38:40 +080048}
49
50static struct device_operations soc_ops = {
51 .read_resources = soc_read_resources,
52 .init = soc_init,
53};
54
55static void enable_soc_dev(device_t dev)
56{
57 dev->ops = &soc_ops;
58}
59
60struct chip_operations soc_rockchip_rk3399_ops = {
Paul Menzel37277762016-07-03 09:45:26 +020061 CHIP_NAME("SOC Rockchip RK3399")
huang linc14b54d2016-03-02 18:38:40 +080062 .enable_dev = enable_soc_dev,
63};