]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/powerpc/platforms/embedded6xx/storcenter.c
powerpc/pseries: Remove RTAS_POWERMGM_EVENTS
[karo-tx-linux.git] / arch / powerpc / platforms / embedded6xx / storcenter.c
1 /*
2  * Board setup routines for the storcenter
3  *
4  * Copyright 2007 (C) Oyvind Repvik (nail@nslu2-linux.org)
5  * Copyright 2007 Andy Wilcox, Jon Loeliger
6  *
7  * Based on linkstation.c by G. Liakhovetski
8  *
9  * This file is licensed under the terms of the GNU General Public License
10  * version 2.  This program is licensed "as is" without any warranty of
11  * any kind, whether express or implied.
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
28 static __initdata struct of_device_id storcenter_of_bus[] = {
29         { .name = "soc", },
30         {},
31 };
32
33 static int __init storcenter_device_probe(void)
34 {
35         of_platform_bus_probe(NULL, storcenter_of_bus, NULL);
36         return 0;
37 }
38 machine_device_initcall(storcenter, storcenter_device_probe);
39
40
41 static 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         /* Interpret the "ranges" property */
61         /* This also maps the I/O region and sets isa_io/mem_base */
62         pci_process_bridge_OF_ranges(hose, dev, 1);
63 #endif
64
65         return 0;
66 }
67
68 static void __init storcenter_setup_arch(void)
69 {
70         struct device_node *np;
71
72         /* Lookup PCI host bridges */
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  * Interrupt setup and service.  Interrupts on the turbostation come
81  * from the four PCI slots plus onboard 8241 devices: I2C, DUART.
82  */
83 static void __init storcenter_init_IRQ(void)
84 {
85         struct mpic *mpic;
86
87         mpic = mpic_alloc(NULL, 0, 0, 16, 0, " OpenPIC  ");
88         BUG_ON(mpic == NULL);
89
90         /*
91          * 16 Serial Interrupts followed by 16 Internal Interrupts.
92          * I2C is the second internal, so it is at 17, 0x11020.
93          */
94         mpic_assign_isu(mpic, 0, mpic->paddr + 0x10200);
95         mpic_assign_isu(mpic, 1, mpic->paddr + 0x11000);
96
97         mpic_init(mpic);
98 }
99
100 static void storcenter_restart(char *cmd)
101 {
102         local_irq_disable();
103
104         /* Set exception prefix high - to the firmware */
105         _nmask_and_or_msr(0, MSR_IP);
106
107         /* Wait for reset to happen */
108         for (;;) ;
109 }
110
111 static int __init storcenter_probe(void)
112 {
113         unsigned long root = of_get_flat_dt_root();
114
115         return of_flat_dt_is_compatible(root, "iomega,storcenter");
116 }
117
118 define_machine(storcenter){
119         .name                   = "IOMEGA StorCenter",
120         .probe                  = storcenter_probe,
121         .setup_arch             = storcenter_setup_arch,
122         .init_IRQ               = storcenter_init_IRQ,
123         .get_irq                = mpic_get_irq,
124         .restart                = storcenter_restart,
125         .calibrate_decr         = generic_calibrate_decr,
126 };