huang lin | 82ba4d0 | 2014-08-16 10:49:32 +0800 | [diff] [blame] | 1 | /* |
| 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. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
Patrick Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 17 | * Foundation, Inc. |
huang lin | 82ba4d0 | 2014-08-16 10:49:32 +0800 | [diff] [blame] | 18 | */ |
| 19 | |
Julius Werner | 7a453eb | 2014-10-20 13:14:55 -0700 | [diff] [blame] | 20 | #include <arch/cache.h> |
Aaron Durbin | bc98cc6 | 2015-09-02 09:21:36 -0500 | [diff] [blame] | 21 | #include <bootmode.h> |
Julius Werner | 7a453eb | 2014-10-20 13:14:55 -0700 | [diff] [blame] | 22 | #include <cbmem.h> |
| 23 | #include <console/console.h> |
| 24 | #include <delay.h> |
| 25 | #include <device/device.h> |
Julius Werner | eaa9c45 | 2014-09-24 15:40:49 -0700 | [diff] [blame] | 26 | #include <gpio.h> |
huang lin | 40f558e | 2014-09-19 14:51:52 +0800 | [diff] [blame] | 27 | #include <soc/display.h> |
Julius Werner | 7a453eb | 2014-10-20 13:14:55 -0700 | [diff] [blame] | 28 | #include <soc/soc.h> |
huang lin | ee28c86 | 2015-01-26 21:04:55 +0800 | [diff] [blame] | 29 | #include <soc/sdram.h> |
Julius Werner | 7a453eb | 2014-10-20 13:14:55 -0700 | [diff] [blame] | 30 | #include <stddef.h> |
huang lin | 82ba4d0 | 2014-08-16 10:49:32 +0800 | [diff] [blame] | 31 | #include <stdlib.h> |
| 32 | #include <string.h> |
Julius Werner | 249f9cc | 2015-01-14 14:53:59 -0800 | [diff] [blame] | 33 | #include <symbols.h> |
Julius Werner | 7a453eb | 2014-10-20 13:14:55 -0700 | [diff] [blame] | 34 | |
huang lin | 82ba4d0 | 2014-08-16 10:49:32 +0800 | [diff] [blame] | 35 | #include "chip.h" |
| 36 | |
huang lin | 40f558e | 2014-09-19 14:51:52 +0800 | [diff] [blame] | 37 | static void soc_init(device_t dev) |
huang lin | 82ba4d0 | 2014-08-16 10:49:32 +0800 | [diff] [blame] | 38 | { |
huang lin | ee28c86 | 2015-01-26 21:04:55 +0800 | [diff] [blame] | 39 | ram_resource(dev, 0, (uintptr_t)_dram/KiB, sdram_size_mb()*(MiB/KiB)); |
Aaron Durbin | bc98cc6 | 2015-09-02 09:21:36 -0500 | [diff] [blame] | 40 | if (display_init_required()) |
Julius Werner | 249f9cc | 2015-01-14 14:53:59 -0800 | [diff] [blame] | 41 | rk_display_init(dev, (uintptr_t)_framebuffer, |
| 42 | _framebuffer_size); |
Aaron Durbin | bc98cc6 | 2015-09-02 09:21:36 -0500 | [diff] [blame] | 43 | else |
| 44 | printk(BIOS_INFO, "Skipping display init.\n"); |
huang lin | 82ba4d0 | 2014-08-16 10:49:32 +0800 | [diff] [blame] | 45 | } |
| 46 | |
huang lin | 82ba4d0 | 2014-08-16 10:49:32 +0800 | [diff] [blame] | 47 | static struct device_operations soc_ops = { |
Edward O'Callaghan | c1a9dfe | 2015-03-26 20:10:09 +1100 | [diff] [blame] | 48 | .read_resources = DEVICE_NOOP, |
| 49 | .set_resources = DEVICE_NOOP, |
huang lin | 40f558e | 2014-09-19 14:51:52 +0800 | [diff] [blame] | 50 | .init = soc_init, |
huang lin | 82ba4d0 | 2014-08-16 10:49:32 +0800 | [diff] [blame] | 51 | .scan_bus = 0, |
| 52 | }; |
| 53 | |
| 54 | static void enable_rk3288_dev(device_t dev) |
| 55 | { |
| 56 | dev->ops = &soc_ops; |
| 57 | } |
| 58 | |
| 59 | struct chip_operations soc_rockchip_rk3288_ops = { |
| 60 | CHIP_NAME("SOC Rockchip 3288") |
| 61 | .enable_dev = enable_rk3288_dev, |
| 62 | }; |