Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
awilliam
GitHub Repository: awilliam/linux-vfio
Path: blob/master/arch/powerpc/platforms/wsp/psr2.c
10818 views
1
/*
2
* Copyright 2008-2011, IBM Corporation
3
*
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version
7
* 2 of the License, or (at your option) any later version.
8
*/
9
10
#include <linux/delay.h>
11
#include <linux/init.h>
12
#include <linux/irq.h>
13
#include <linux/kernel.h>
14
#include <linux/mm.h>
15
#include <linux/of.h>
16
#include <linux/smp.h>
17
18
#include <asm/machdep.h>
19
#include <asm/system.h>
20
#include <asm/time.h>
21
#include <asm/udbg.h>
22
23
#include "ics.h"
24
#include "wsp.h"
25
26
27
static void psr2_spin(void)
28
{
29
hard_irq_disable();
30
for (;;) ;
31
}
32
33
static void psr2_restart(char *cmd)
34
{
35
psr2_spin();
36
}
37
38
static int psr2_probe_devices(void)
39
{
40
struct device_node *np;
41
42
/* Our RTC is a ds1500. It seems to be programatically compatible
43
* with the ds1511 for which we have a driver so let's use that
44
*/
45
np = of_find_compatible_node(NULL, NULL, "dallas,ds1500");
46
if (np != NULL) {
47
struct resource res;
48
if (of_address_to_resource(np, 0, &res) == 0)
49
platform_device_register_simple("ds1511", 0, &res, 1);
50
}
51
return 0;
52
}
53
machine_arch_initcall(psr2_md, psr2_probe_devices);
54
55
static void __init psr2_setup_arch(void)
56
{
57
/* init to some ~sane value until calibrate_delay() runs */
58
loops_per_jiffy = 50000000;
59
60
scom_init_wsp();
61
62
/* Setup SMP callback */
63
#ifdef CONFIG_SMP
64
a2_setup_smp();
65
#endif
66
}
67
68
static int __init psr2_probe(void)
69
{
70
unsigned long root = of_get_flat_dt_root();
71
72
if (!of_flat_dt_is_compatible(root, "ibm,psr2"))
73
return 0;
74
75
return 1;
76
}
77
78
static void __init psr2_init_irq(void)
79
{
80
wsp_init_irq();
81
opb_pic_init();
82
}
83
84
define_machine(psr2_md) {
85
.name = "PSR2 A2",
86
.probe = psr2_probe,
87
.setup_arch = psr2_setup_arch,
88
.restart = psr2_restart,
89
.power_off = psr2_spin,
90
.halt = psr2_spin,
91
.calibrate_decr = generic_calibrate_decr,
92
.init_IRQ = psr2_init_irq,
93
.progress = udbg_progress,
94
.power_save = book3e_idle,
95
};
96
97