blob: ff87e8adca3a0f9fb2d76d03efca57b537ba3709 [file] [log] [blame]
Mario Sixfa44b532018-08-06 10:23:44 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2018
4 * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <cpu.h>
10
11int cpu_sandbox_get_desc(struct udevice *dev, char *buf, int size)
12{
13 snprintf(buf, size, "LEG Inc. SuperMegaUltraTurbo CPU No. 1");
14
15 return 0;
16}
17
18int cpu_sandbox_get_info(struct udevice *dev, struct cpu_info *info)
19{
20 info->cpu_freq = 42 * 42 * 42 * 42 * 42;
21 info->features = 0x42424242;
22
23 return 0;
24}
25
26int cpu_sandbox_get_count(struct udevice *dev)
27{
28 return 42;
29}
30
31int cpu_sandbox_get_vendor(struct udevice *dev, char *buf, int size)
32{
33 snprintf(buf, size, "Languid Example Garbage Inc.");
34
35 return 0;
36}
37
38static const struct cpu_ops cpu_sandbox_ops = {
39 .get_desc = cpu_sandbox_get_desc,
40 .get_info = cpu_sandbox_get_info,
41 .get_count = cpu_sandbox_get_count,
42 .get_vendor = cpu_sandbox_get_vendor,
43};
44
45int cpu_sandbox_probe(struct udevice *dev)
46{
47 return 0;
48}
49
50static const struct udevice_id cpu_sandbox_ids[] = {
51 { .compatible = "sandbox,cpu_sandbox" },
52 { }
53};
54
55U_BOOT_DRIVER(cpu_sandbox) = {
56 .name = "cpu_sandbox",
57 .id = UCLASS_CPU,
58 .ops = &cpu_sandbox_ops,
59 .of_match = cpu_sandbox_ids,
60 .probe = cpu_sandbox_probe,
61};