1
2
3
4
5
6
7
8
9
10
11
12
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/initrd.h>
17#include <linux/of_platform.h>
18
19#include <asm/system.h>
20#include <asm/time.h>
21#include <asm/prom.h>
22#include <asm/mpic.h>
23#include <asm/pci-bridge.h>
24
25#include "mpc10x.h"
26
27
28static __initdata struct of_device_id storcenter_of_bus[] = {
29 { .name = "soc", },
30 {},
31};
32
33static int __init storcenter_device_probe(void)
34{
35 of_platform_bus_probe(NULL, storcenter_of_bus, NULL);
36 return 0;
37}
38machine_device_initcall(storcenter, storcenter_device_probe);
39
40
41static int __init storcenter_add_bridge(struct device_node *dev)
42{
43#ifdef CONFIG_PCI
44 int len;
45 struct pci_controller *hose;
46 const int *bus_range;
47
48 printk("Adding PCI host bridge %s\n", dev->full_name);
49
50 hose = pcibios_alloc_controller(dev);
51 if (hose == NULL)
52 return -ENOMEM;
53
54 bus_range = of_get_property(dev, "bus-range", &len);
55 hose->first_busno = bus_range ? bus_range[0] : 0;
56 hose->last_busno = bus_range ? bus_range[1] : 0xff;
57
58 setup_indirect_pci(hose, MPC10X_MAPB_CNFG_ADDR, MPC10X_MAPB_CNFG_DATA, 0);
59
60
61
62 pci_process_bridge_OF_ranges(hose, dev, 1);
63#endif
64
65 return 0;
66}
67
68static void __init storcenter_setup_arch(void)
69{
70 struct device_node *np;
71
72
73 for_each_compatible_node(np, "pci", "mpc10x-pci")
74 storcenter_add_bridge(np);
75
76 printk(KERN_INFO "IOMEGA StorCenter\n");
77}
78
79
80
81
82
83static void __init storcenter_init_IRQ(void)
84{
85 struct mpic *mpic;
86 struct device_node *dnp;
87 const void *prop;
88 int size;
89 phys_addr_t paddr;
90
91 dnp = of_find_node_by_type(NULL, "open-pic");
92 if (dnp == NULL)
93 return;
94
95 prop = of_get_property(dnp, "reg", &size);
96 if (prop == NULL) {
97 of_node_put(dnp);
98 return;
99 }
100
101 paddr = (phys_addr_t)of_translate_address(dnp, prop);
102 mpic = mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC_WANTS_RESET,
103 16, 32, " OpenPIC ");
104
105 of_node_put(dnp);
106
107 BUG_ON(mpic == NULL);
108
109
110
111
112
113 mpic_assign_isu(mpic, 0, paddr + 0x10200);
114 mpic_assign_isu(mpic, 1, paddr + 0x11000);
115
116 mpic_init(mpic);
117}
118
119static void storcenter_restart(char *cmd)
120{
121 local_irq_disable();
122
123
124 _nmask_and_or_msr(0, MSR_IP);
125
126
127 for (;;) ;
128}
129
130static int __init storcenter_probe(void)
131{
132 unsigned long root = of_get_flat_dt_root();
133
134 return of_flat_dt_is_compatible(root, "iomega,storcenter");
135}
136
137define_machine(storcenter){
138 .name = "IOMEGA StorCenter",
139 .probe = storcenter_probe,
140 .setup_arch = storcenter_setup_arch,
141 .init_IRQ = storcenter_init_IRQ,
142 .get_irq = mpic_get_irq,
143 .restart = storcenter_restart,
144 .calibrate_decr = generic_calibrate_decr,
145};
146