blob: ad679e59b926629ad440fdaa7c26990d0f5b2242 [file] [log] [blame]
huang lin82ba4d02014-08-16 10:49:32 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2014 Rockchip 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.
huang lin82ba4d02014-08-16 10:49:32 +080014 */
15
Julius Werner7a453eb2014-10-20 13:14:55 -070016#include <arch/cache.h>
Aaron Durbinbc98cc62015-09-02 09:21:36 -050017#include <bootmode.h>
Julius Werner7a453eb2014-10-20 13:14:55 -070018#include <console/console.h>
19#include <delay.h>
20#include <device/device.h>
Julius Wernereaa9c452014-09-24 15:40:49 -070021#include <gpio.h>
huang lin40f558e2014-09-19 14:51:52 +080022#include <soc/display.h>
Julius Werner7a453eb2014-10-20 13:14:55 -070023#include <soc/soc.h>
huang linee28c862015-01-26 21:04:55 +080024#include <soc/sdram.h>
Julius Werner7a453eb2014-10-20 13:14:55 -070025#include <stddef.h>
huang lin82ba4d02014-08-16 10:49:32 +080026#include <stdlib.h>
27#include <string.h>
Julius Werner249f9cc2015-01-14 14:53:59 -080028#include <symbols.h>
Julius Werner7a453eb2014-10-20 13:14:55 -070029
huang lin82ba4d02014-08-16 10:49:32 +080030#include "chip.h"
31
Elyes HAOUASf3ca88b2018-05-25 09:52:45 +020032static void soc_init(struct device *dev)
huang lin82ba4d02014-08-16 10:49:32 +080033{
huang linee28c862015-01-26 21:04:55 +080034 ram_resource(dev, 0, (uintptr_t)_dram/KiB, sdram_size_mb()*(MiB/KiB));
Aaron Durbinbc98cc62015-09-02 09:21:36 -050035 if (display_init_required())
Julius Werner249f9cc2015-01-14 14:53:59 -080036 rk_display_init(dev, (uintptr_t)_framebuffer,
Julius Werner7e0dea62019-02-20 18:39:22 -080037 REGION_SIZE(framebuffer));
Aaron Durbinbc98cc62015-09-02 09:21:36 -050038 else
39 printk(BIOS_INFO, "Skipping display init.\n");
huang lin82ba4d02014-08-16 10:49:32 +080040}
41
huang lin82ba4d02014-08-16 10:49:32 +080042static struct device_operations soc_ops = {
Edward O'Callaghanc1a9dfe2015-03-26 20:10:09 +110043 .read_resources = DEVICE_NOOP,
44 .set_resources = DEVICE_NOOP,
huang lin40f558e2014-09-19 14:51:52 +080045 .init = soc_init,
huang lin82ba4d02014-08-16 10:49:32 +080046 .scan_bus = 0,
47};
48
Elyes HAOUASf3ca88b2018-05-25 09:52:45 +020049static void enable_rk3288_dev(struct device *dev)
huang lin82ba4d02014-08-16 10:49:32 +080050{
51 dev->ops = &soc_ops;
52}
53
54struct chip_operations soc_rockchip_rk3288_ops = {
55 CHIP_NAME("SOC Rockchip 3288")
56 .enable_dev = enable_rk3288_dev,
57};