Angel Pons | 7c1d70e | 2020-04-04 18:51:19 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 2 | |
| 3 | #include <console/console.h> |
| 4 | #include <device/device.h> |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 5 | #include <symbols.h> |
Vadim Bendebury | 7c25640 | 2015-01-13 13:07:48 -0800 | [diff] [blame] | 6 | #include <soc/ipq_uart.h> |
David Hendricks | 2445274 | 2014-07-02 13:50:57 -0700 | [diff] [blame] | 7 | |
| 8 | #define RESERVED_SIZE_KB (0x01500000 / KiB) |
| 9 | |
Elyes HAOUAS | d6cd255 | 2018-05-25 10:01:13 +0200 | [diff] [blame] | 10 | static void soc_read_resources(struct device *dev) |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 11 | { |
David Hendricks | 2445274 | 2014-07-02 13:50:57 -0700 | [diff] [blame] | 12 | /* Reserve bottom 0x150_0000 bytes for NSS, SMEM, etc. */ |
Kyösti Mälkki | 27d6299 | 2022-05-24 20:25:58 +0300 | [diff] [blame^] | 13 | reserved_ram_resource_kb(dev, 0, (uintptr_t)_dram / KiB, RESERVED_SIZE_KB); |
| 14 | ram_resource_kb(dev, 0, (uintptr_t)_dram / KiB + RESERVED_SIZE_KB, |
David Hendricks | 2445274 | 2014-07-02 13:50:57 -0700 | [diff] [blame] | 15 | (CONFIG_DRAM_SIZE_MB * KiB) - RESERVED_SIZE_KB); |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 16 | } |
| 17 | |
Elyes HAOUAS | d6cd255 | 2018-05-25 10:01:13 +0200 | [diff] [blame] | 18 | static void soc_init(struct device *dev) |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 19 | { |
Vadim Bendebury | 7c25640 | 2015-01-13 13:07:48 -0800 | [diff] [blame] | 20 | /* |
| 21 | * Do this in case console is not enabled: kernel's earlyprintk() |
| 22 | * should work no matter what the firmware console configuration is. |
| 23 | */ |
| 24 | ipq806x_uart_init(); |
| 25 | |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 26 | printk(BIOS_INFO, "CPU: Qualcomm 8064\n"); |
| 27 | } |
| 28 | |
| 29 | static struct device_operations soc_ops = { |
| 30 | .read_resources = soc_read_resources, |
| 31 | .init = soc_init, |
| 32 | }; |
| 33 | |
Elyes HAOUAS | d6cd255 | 2018-05-25 10:01:13 +0200 | [diff] [blame] | 34 | static void enable_soc_dev(struct device *dev) |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 35 | { |
| 36 | dev->ops = &soc_ops; |
| 37 | } |
| 38 | |
| 39 | struct chip_operations soc_qualcomm_ipq806x_ops = { |
| 40 | CHIP_NAME("SOC Qualcomm 8064") |
| 41 | .enable_dev = enable_soc_dev, |
| 42 | }; |