blob: 7c18fca1e42131461bec268b1d1e042b315a1dbf [file] [log] [blame]
huang linc14b54d2016-03-02 18:38:40 +08001/*
2 * This file is part of the coreboot project.
3 *
huang linc14b54d2016-03-02 18:38:40 +08004 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
Julius Werner314b5c32019-02-20 17:50:42 -080015#include <bootmem.h>
Shunqian Zhengd1cec752016-05-04 16:21:36 +080016#include <bootmode.h>
huang linc14b54d2016-03-02 18:38:40 +080017#include <console/console.h>
18#include <device/device.h>
Lin Huang19eb7502016-03-26 11:50:05 +080019#include <soc/addressmap.h>
Julius Werner7f965892016-08-29 15:07:58 -070020#include <soc/clock.h>
Shunqian Zhengd1cec752016-05-04 16:21:36 +080021#include <soc/display.h>
Lin Huangf00af582016-11-15 11:40:58 +080022#include <soc/sdram.h>
Julius Werner314b5c32019-02-20 17:50:42 -080023#include <soc/symbols.h>
huang linc14b54d2016-03-02 18:38:40 +080024#include <stddef.h>
huang linc14b54d2016-03-02 18:38:40 +080025#include <symbols.h>
26
Julius Werner314b5c32019-02-20 17:50:42 -080027void bootmem_platform_add_ranges(void)
28{
Julius Werner7e0dea62019-02-20 18:39:22 -080029 bootmem_add_range((uintptr_t)_pmu_sram, REGION_SIZE(pmu_sram),
30 BM_MEM_BL31);
31 bootmem_add_range((uintptr_t)_bl31_sram, REGION_SIZE(bl31_sram),
32 BM_MEM_BL31);
Julius Werner314b5c32019-02-20 17:50:42 -080033}
34
Elyes HAOUASf3ca88b2018-05-25 09:52:45 +020035static void soc_read_resources(struct device *dev)
huang linc14b54d2016-03-02 18:38:40 +080036{
Lin Huangf00af582016-11-15 11:40:58 +080037 ram_resource(dev, 0, (uintptr_t)_dram / KiB, sdram_size_mb() * KiB);
huang linc14b54d2016-03-02 18:38:40 +080038}
39
Elyes HAOUASf3ca88b2018-05-25 09:52:45 +020040static void soc_init(struct device *dev)
huang linc14b54d2016-03-02 18:38:40 +080041{
Julius Wernercd49cce2019-03-05 16:53:33 -080042 if (CONFIG(MAINBOARD_DO_NATIVE_VGA_INIT) && display_init_required())
Lin Huang152e6752016-10-20 14:22:11 -070043 rk_display_init(dev);
Shunqian Zhengd1cec752016-05-04 16:21:36 +080044 else
45 printk(BIOS_INFO, "Display initialization disabled.\n");
Julius Werner7f965892016-08-29 15:07:58 -070046
47 /* We don't need big CPUs, but bring them up as a courtesy to Linux. */
48 rkclk_configure_cpu(APLL_600_MHZ, CPU_CLUSTER_BIG);
huang linc14b54d2016-03-02 18:38:40 +080049}
50
51static struct device_operations soc_ops = {
52 .read_resources = soc_read_resources,
53 .init = soc_init,
54};
55
Elyes HAOUASf3ca88b2018-05-25 09:52:45 +020056static void enable_soc_dev(struct device *dev)
huang linc14b54d2016-03-02 18:38:40 +080057{
58 dev->ops = &soc_ops;
59}
60
61struct chip_operations soc_rockchip_rk3399_ops = {
Paul Menzel37277762016-07-03 09:45:26 +020062 CHIP_NAME("SOC Rockchip RK3399")
huang linc14b54d2016-03-02 18:38:40 +080063 .enable_dev = enable_soc_dev,
64};