Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; version 2 of the License. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #include <console/console.h> |
| 16 | #include <device/device.h> |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 17 | #include <symbols.h> |
Vadim Bendebury | 7c25640 | 2015-01-13 13:07:48 -0800 | [diff] [blame] | 18 | #include <soc/ipq_uart.h> |
David Hendricks | 2445274 | 2014-07-02 13:50:57 -0700 | [diff] [blame] | 19 | |
| 20 | #define RESERVED_SIZE_KB (0x01500000 / KiB) |
| 21 | |
Elyes HAOUAS | d6cd255 | 2018-05-25 10:01:13 +0200 | [diff] [blame] | 22 | static void soc_read_resources(struct device *dev) |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 23 | { |
David Hendricks | 2445274 | 2014-07-02 13:50:57 -0700 | [diff] [blame] | 24 | /* Reserve bottom 0x150_0000 bytes for NSS, SMEM, etc. */ |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 25 | reserved_ram_resource(dev, 0, (uintptr_t)_dram / KiB, RESERVED_SIZE_KB); |
| 26 | ram_resource(dev, 0, (uintptr_t)_dram / KiB + RESERVED_SIZE_KB, |
David Hendricks | 2445274 | 2014-07-02 13:50:57 -0700 | [diff] [blame] | 27 | (CONFIG_DRAM_SIZE_MB * KiB) - RESERVED_SIZE_KB); |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 28 | } |
| 29 | |
Elyes HAOUAS | d6cd255 | 2018-05-25 10:01:13 +0200 | [diff] [blame] | 30 | static void soc_init(struct device *dev) |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 31 | { |
Vadim Bendebury | 7c25640 | 2015-01-13 13:07:48 -0800 | [diff] [blame] | 32 | /* |
| 33 | * Do this in case console is not enabled: kernel's earlyprintk() |
| 34 | * should work no matter what the firmware console configuration is. |
| 35 | */ |
| 36 | ipq806x_uart_init(); |
| 37 | |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 38 | printk(BIOS_INFO, "CPU: Qualcomm 8064\n"); |
| 39 | } |
| 40 | |
| 41 | static struct device_operations soc_ops = { |
| 42 | .read_resources = soc_read_resources, |
| 43 | .init = soc_init, |
| 44 | }; |
| 45 | |
Elyes HAOUAS | d6cd255 | 2018-05-25 10:01:13 +0200 | [diff] [blame] | 46 | static void enable_soc_dev(struct device *dev) |
Vadim Bendebury | 41a5d0d | 2014-05-13 17:47:57 -0700 | [diff] [blame] | 47 | { |
| 48 | dev->ops = &soc_ops; |
| 49 | } |
| 50 | |
| 51 | struct chip_operations soc_qualcomm_ipq806x_ops = { |
| 52 | CHIP_NAME("SOC Qualcomm 8064") |
| 53 | .enable_dev = enable_soc_dev, |
| 54 | }; |