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