Alexandru Gagniuc | 6d51f5d | 2014-01-03 04:24:35 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Ramstage initialization for Allwinner CPUs |
| 3 | * |
| 4 | * Copyright (C) 2014 Alexandru Gagniuc <mr.nuke.me@gmail.com> |
| 5 | * Subject to the GNU GPL v2, or (at your option) any later version. |
| 6 | */ |
| 7 | |
| 8 | #include <console/console.h> |
| 9 | #include <device/device.h> |
| 10 | #include <cpu/cpu.h> |
| 11 | #include <cbmem.h> |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 12 | #include <symbols.h> |
Alexandru Gagniuc | 6d51f5d | 2014-01-03 04:24:35 -0500 | [diff] [blame] | 13 | |
| 14 | |
Edward O'Callaghan | 2c9d2cf | 2014-10-27 23:29:29 +1100 | [diff] [blame] | 15 | static void cpu_enable_resources(struct device *dev) |
Alexandru Gagniuc | 6d51f5d | 2014-01-03 04:24:35 -0500 | [diff] [blame] | 16 | { |
Julius Werner | ec5e5e0 | 2014-08-20 15:29:56 -0700 | [diff] [blame] | 17 | ram_resource(dev, 0, (uintptr_t)_dram/KiB, |
Alexandru Gagniuc | 6d51f5d | 2014-01-03 04:24:35 -0500 | [diff] [blame] | 18 | CONFIG_DRAM_SIZE_MB << 10); |
| 19 | /* TODO: Declare CBFS cache as reserved? There's no guarantee we won't |
| 20 | * overwrite it. It seems to stay intact, being so high in RAM |
| 21 | */ |
| 22 | } |
| 23 | |
Edward O'Callaghan | 2c9d2cf | 2014-10-27 23:29:29 +1100 | [diff] [blame] | 24 | static void cpu_init(struct device *dev) |
Alexandru Gagniuc | 6d51f5d | 2014-01-03 04:24:35 -0500 | [diff] [blame] | 25 | { |
| 26 | /* TODO: Check if anything else needs to be explicitly initialized */ |
| 27 | } |
| 28 | |
Alexandru Gagniuc | 6d51f5d | 2014-01-03 04:24:35 -0500 | [diff] [blame] | 29 | static struct device_operations cpu_ops = { |
Edward O'Callaghan | 0625a8b | 2014-10-31 08:03:16 +1100 | [diff] [blame] | 30 | .read_resources = DEVICE_NOOP, |
| 31 | .set_resources = DEVICE_NOOP, |
Alexandru Gagniuc | 6d51f5d | 2014-01-03 04:24:35 -0500 | [diff] [blame] | 32 | .enable_resources = cpu_enable_resources, |
| 33 | .init = cpu_init, |
| 34 | .scan_bus = NULL, |
| 35 | }; |
| 36 | |
Edward O'Callaghan | 2c9d2cf | 2014-10-27 23:29:29 +1100 | [diff] [blame] | 37 | static void a1x_cpu_enable_dev(struct device *dev) |
Alexandru Gagniuc | 6d51f5d | 2014-01-03 04:24:35 -0500 | [diff] [blame] | 38 | { |
| 39 | dev->ops = &cpu_ops; |
| 40 | } |
| 41 | |
| 42 | struct chip_operations cpu_allwinner_a10_ops = { |
| 43 | CHIP_NAME("CPU Allwinner A10") |
| 44 | .enable_dev = a1x_cpu_enable_dev, |
| 45 | }; |