blob: 481ffc8e720674ce1f59fc8897b8f7806f547c85 [file] [log] [blame]
Angel Pons7c1d70e2020-04-04 18:51:19 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -07002
3#include <console/console.h>
4#include <device/device.h>
Julius Wernerec5e5e02014-08-20 15:29:56 -07005#include <symbols.h>
Vadim Bendebury7c256402015-01-13 13:07:48 -08006#include <soc/ipq_uart.h>
David Hendricks24452742014-07-02 13:50:57 -07007
8#define RESERVED_SIZE_KB (0x01500000 / KiB)
9
Elyes HAOUASd6cd2552018-05-25 10:01:13 +020010static void soc_read_resources(struct device *dev)
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -070011{
David Hendricks24452742014-07-02 13:50:57 -070012 /* Reserve bottom 0x150_0000 bytes for NSS, SMEM, etc. */
Kyösti Mälkki27d62992022-05-24 20:25:58 +030013 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 Hendricks24452742014-07-02 13:50:57 -070015 (CONFIG_DRAM_SIZE_MB * KiB) - RESERVED_SIZE_KB);
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -070016}
17
Elyes HAOUASd6cd2552018-05-25 10:01:13 +020018static void soc_init(struct device *dev)
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -070019{
Vadim Bendebury7c256402015-01-13 13:07:48 -080020 /*
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 Bendebury41a5d0d2014-05-13 17:47:57 -070026 printk(BIOS_INFO, "CPU: Qualcomm 8064\n");
27}
28
29static struct device_operations soc_ops = {
30 .read_resources = soc_read_resources,
31 .init = soc_init,
32};
33
Elyes HAOUASd6cd2552018-05-25 10:01:13 +020034static void enable_soc_dev(struct device *dev)
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -070035{
36 dev->ops = &soc_ops;
37}
38
39struct chip_operations soc_qualcomm_ipq806x_ops = {
40 CHIP_NAME("SOC Qualcomm 8064")
41 .enable_dev = enable_soc_dev,
42};