blob: ad0510f02125b11db9813403c7e6e33a6f8ab2b2 [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
Kyösti Mälkkif35c0742021-06-26 14:12:54 +03008#define RESERVED_SIZE 0x01500000 /* 21 MiB */
David Hendricks24452742014-07-02 13:50:57 -07009
Elyes HAOUASd6cd2552018-05-25 10:01:13 +020010static void soc_read_resources(struct device *dev)
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -070011{
Kyösti Mälkkif35c0742021-06-26 14:12:54 +030012 /* Reserve bottom 21 MiB for NSS, SMEM, etc. */
13 uintptr_t reserve_ram_end = (uintptr_t)_dram + RESERVED_SIZE;
14 uint64_t ram_end = CONFIG_DRAM_SIZE_MB * (uint64_t)MiB;
15
16 reserved_ram_from_to(dev, 0, (uintptr_t)_dram, reserve_ram_end);
17 ram_from_to(dev, 1, reserve_ram_end, ram_end);
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -070018}
19
Elyes HAOUASd6cd2552018-05-25 10:01:13 +020020static void soc_init(struct device *dev)
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -070021{
Vadim Bendebury7c256402015-01-13 13:07:48 -080022 /*
23 * Do this in case console is not enabled: kernel's earlyprintk()
24 * should work no matter what the firmware console configuration is.
25 */
26 ipq806x_uart_init();
27
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -070028 printk(BIOS_INFO, "CPU: Qualcomm 8064\n");
29}
30
31static struct device_operations soc_ops = {
32 .read_resources = soc_read_resources,
33 .init = soc_init,
34};
35
Elyes HAOUASd6cd2552018-05-25 10:01:13 +020036static void enable_soc_dev(struct device *dev)
Vadim Bendebury41a5d0d2014-05-13 17:47:57 -070037{
38 dev->ops = &soc_ops;
39}
40
41struct chip_operations soc_qualcomm_ipq806x_ops = {
42 CHIP_NAME("SOC Qualcomm 8064")
43 .enable_dev = enable_soc_dev,
44};