2 * This file is part of the coreboot project.
4 * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
5 * Copyright 2014 Google Inc.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #include <arch/cache.h>
23 #include <arch/spintable.h>
26 #include <console/console.h>
27 #include <device/device.h>
28 #include <soc/addressmap.h>
29 #include <soc/clock.h>
31 #include <soc/nvidia/tegra/apbmisc.h>
34 #include <vendorcode/google/chromeos/chromeos.h>
38 static void soc_read_resources(device_t dev
)
40 unsigned long index
= 0;
41 int i
; uintptr_t begin
, end
;
44 for (i
= 0; i
< CARVEOUT_NUM
; i
++) {
45 carveout_range(i
, &begin
, &size
);
48 reserved_ram_resource(dev
, index
++, begin
* KiB
, size
* KiB
);
51 memory_in_range_below_4gb(&begin
, &end
);
53 ram_resource(dev
, index
++, begin
* KiB
, size
* KiB
);
55 memory_in_range_above_4gb(&begin
, &end
);
57 ram_resource(dev
, index
++, begin
* KiB
, size
* KiB
);
60 static size_t cntrl_total_cpus(void)
62 return CONFIG_MAX_CPUS
;
65 static int cntrl_start_cpu(unsigned int id
, void (*entry
)(void))
73 static struct cpu_control_ops cntrl_ops
= {
74 .total_cpus
= cntrl_total_cpus
,
75 .start_cpu
= cntrl_start_cpu
,
78 static void soc_init(device_t dev
)
80 struct soc_nvidia_tegra132_config
*cfg
;
82 clock_init_arm_generic_timer();
85 spintable_init((void *)cfg
->spintable_addr
);
86 arch_initialize_cpus(dev
, &cntrl_ops
);
89 static struct device_operations soc_ops
= {
90 .read_resources
= soc_read_resources
,
91 .set_resources
= DEVICE_NOOP
,
92 .enable_resources
= DEVICE_NOOP
,
97 static void enable_tegra132_dev(device_t dev
)
99 if (dev
->path
.type
== DEVICE_PATH_CPU_CLUSTER
)
103 static void tegra132_init(void *chip_info
)
105 struct tegra_revision rev
;
107 tegra_revision_info(&rev
);
109 printk(BIOS_INFO
, "chip %x rev %02x.%x\n",
110 rev
.chip_id
, rev
.major
, rev
.minor
);
112 printk(BIOS_INFO
, "MTS build %u\n", raw_read_aidr_el1());
115 struct chip_operations soc_nvidia_tegra132_ops
= {
116 CHIP_NAME("SOC Nvidia Tegra132")
117 .init
= tegra132_init
,
118 .enable_dev
= enable_tegra132_dev
,
121 static void tegra132_cpu_init(device_t cpu
)
125 static const struct cpu_device_id ids
[] = {
130 static struct device_operations cpu_dev_ops
= {
131 .init
= tegra132_cpu_init
,
134 static const struct cpu_driver driver __cpu_driver
= {