Angel Pons | bbc99cf | 2020-04-04 18:51:23 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
huang lin | c14b54d | 2016-03-02 18:38:40 +0800 | [diff] [blame] | 2 | |
Julius Werner | 314b5c3 | 2019-02-20 17:50:42 -0800 | [diff] [blame] | 3 | #include <bootmem.h> |
Shunqian Zheng | d1cec75 | 2016-05-04 16:21:36 +0800 | [diff] [blame] | 4 | #include <bootmode.h> |
huang lin | c14b54d | 2016-03-02 18:38:40 +0800 | [diff] [blame] | 5 | #include <console/console.h> |
| 6 | #include <device/device.h> |
Lin Huang | 19eb750 | 2016-03-26 11:50:05 +0800 | [diff] [blame] | 7 | #include <soc/addressmap.h> |
Julius Werner | 7f96589 | 2016-08-29 15:07:58 -0700 | [diff] [blame] | 8 | #include <soc/clock.h> |
Shunqian Zheng | d1cec75 | 2016-05-04 16:21:36 +0800 | [diff] [blame] | 9 | #include <soc/display.h> |
Lin Huang | f00af58 | 2016-11-15 11:40:58 +0800 | [diff] [blame] | 10 | #include <soc/sdram.h> |
Julius Werner | 314b5c3 | 2019-02-20 17:50:42 -0800 | [diff] [blame] | 11 | #include <soc/symbols.h> |
huang lin | c14b54d | 2016-03-02 18:38:40 +0800 | [diff] [blame] | 12 | #include <symbols.h> |
| 13 | |
Julius Werner | 314b5c3 | 2019-02-20 17:50:42 -0800 | [diff] [blame] | 14 | void bootmem_platform_add_ranges(void) |
| 15 | { |
Julius Werner | 7e0dea6 | 2019-02-20 18:39:22 -0800 | [diff] [blame] | 16 | bootmem_add_range((uintptr_t)_pmu_sram, REGION_SIZE(pmu_sram), |
| 17 | BM_MEM_BL31); |
| 18 | bootmem_add_range((uintptr_t)_bl31_sram, REGION_SIZE(bl31_sram), |
| 19 | BM_MEM_BL31); |
Julius Werner | 314b5c3 | 2019-02-20 17:50:42 -0800 | [diff] [blame] | 20 | } |
| 21 | |
Elyes HAOUAS | f3ca88b | 2018-05-25 09:52:45 +0200 | [diff] [blame] | 22 | static void soc_read_resources(struct device *dev) |
huang lin | c14b54d | 2016-03-02 18:38:40 +0800 | [diff] [blame] | 23 | { |
Kyösti Mälkki | 84a9360a | 2021-06-26 14:10:39 +0300 | [diff] [blame^] | 24 | ram_range(dev, 0, (uintptr_t)_dram, sdram_size_mb() * MiB); |
huang lin | c14b54d | 2016-03-02 18:38:40 +0800 | [diff] [blame] | 25 | } |
| 26 | |
Elyes HAOUAS | f3ca88b | 2018-05-25 09:52:45 +0200 | [diff] [blame] | 27 | static void soc_init(struct device *dev) |
huang lin | c14b54d | 2016-03-02 18:38:40 +0800 | [diff] [blame] | 28 | { |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 29 | if (CONFIG(MAINBOARD_DO_NATIVE_VGA_INIT) && display_init_required()) |
Lin Huang | 152e675 | 2016-10-20 14:22:11 -0700 | [diff] [blame] | 30 | rk_display_init(dev); |
Shunqian Zheng | d1cec75 | 2016-05-04 16:21:36 +0800 | [diff] [blame] | 31 | else |
| 32 | printk(BIOS_INFO, "Display initialization disabled.\n"); |
Julius Werner | 7f96589 | 2016-08-29 15:07:58 -0700 | [diff] [blame] | 33 | |
| 34 | /* We don't need big CPUs, but bring them up as a courtesy to Linux. */ |
| 35 | rkclk_configure_cpu(APLL_600_MHZ, CPU_CLUSTER_BIG); |
huang lin | c14b54d | 2016-03-02 18:38:40 +0800 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | static struct device_operations soc_ops = { |
| 39 | .read_resources = soc_read_resources, |
| 40 | .init = soc_init, |
| 41 | }; |
| 42 | |
Elyes HAOUAS | f3ca88b | 2018-05-25 09:52:45 +0200 | [diff] [blame] | 43 | static void enable_soc_dev(struct device *dev) |
huang lin | c14b54d | 2016-03-02 18:38:40 +0800 | [diff] [blame] | 44 | { |
| 45 | dev->ops = &soc_ops; |
| 46 | } |
| 47 | |
| 48 | struct chip_operations soc_rockchip_rk3399_ops = { |
Paul Menzel | 3727776 | 2016-07-03 09:45:26 +0200 | [diff] [blame] | 49 | CHIP_NAME("SOC Rockchip RK3399") |
huang lin | c14b54d | 2016-03-02 18:38:40 +0800 | [diff] [blame] | 50 | .enable_dev = enable_soc_dev, |
| 51 | }; |