blob: c2cbc2fadd271b80a1e589f9879535f7d9c2cf8b [file] [log] [blame]
Alexandru Gagniuc6d51f5d2014-01-03 04:24:35 -05001/*
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 Wernerec5e5e02014-08-20 15:29:56 -070012#include <symbols.h>
Alexandru Gagniuc6d51f5d2014-01-03 04:24:35 -050013
14
Edward O'Callaghan2c9d2cf2014-10-27 23:29:29 +110015static void cpu_enable_resources(struct device *dev)
Alexandru Gagniuc6d51f5d2014-01-03 04:24:35 -050016{
Julius Wernerec5e5e02014-08-20 15:29:56 -070017 ram_resource(dev, 0, (uintptr_t)_dram/KiB,
Alexandru Gagniuc6d51f5d2014-01-03 04:24:35 -050018 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'Callaghan2c9d2cf2014-10-27 23:29:29 +110024static void cpu_init(struct device *dev)
Alexandru Gagniuc6d51f5d2014-01-03 04:24:35 -050025{
26 /* TODO: Check if anything else needs to be explicitly initialized */
27}
28
Alexandru Gagniuc6d51f5d2014-01-03 04:24:35 -050029static struct device_operations cpu_ops = {
Edward O'Callaghan0625a8b2014-10-31 08:03:16 +110030 .read_resources = DEVICE_NOOP,
31 .set_resources = DEVICE_NOOP,
Alexandru Gagniuc6d51f5d2014-01-03 04:24:35 -050032 .enable_resources = cpu_enable_resources,
33 .init = cpu_init,
34 .scan_bus = NULL,
35};
36
Edward O'Callaghan2c9d2cf2014-10-27 23:29:29 +110037static void a1x_cpu_enable_dev(struct device *dev)
Alexandru Gagniuc6d51f5d2014-01-03 04:24:35 -050038{
39 dev->ops = &cpu_ops;
40}
41
42struct chip_operations cpu_allwinner_a10_ops = {
43 CHIP_NAME("CPU Allwinner A10")
44 .enable_dev = a1x_cpu_enable_dev,
45};