2 * Board setup routines for the storcenter
4 * Copyright 2007 (C) Oyvind Repvik (nail@nslu2-linux.org)
5 * Copyright 2007 Andy Wilcox, Jon Loeliger
7 * Based on linkstation.c by G. Liakhovetski
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.
14 #include <linux/kernel.h>
15 #include <linux/pci.h>
16 #include <linux/initrd.h>
17 #include <linux/of_platform.h>
19 #include <asm/system.h>
23 #include <asm/pci-bridge.h>
28 static __initdata struct of_device_id storcenter_of_bus[] = {
33 static int __init storcenter_device_probe(void)
35 of_platform_bus_probe(NULL, storcenter_of_bus, NULL);
38 machine_device_initcall(storcenter, storcenter_device_probe);
41 static int __init storcenter_add_bridge(struct device_node *dev)
45 struct pci_controller *hose;
48 printk("Adding PCI host bridge %s\n", dev->full_name);
50 hose = pcibios_alloc_controller(dev);
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;
58 setup_indirect_pci(hose, MPC10X_MAPB_CNFG_ADDR, MPC10X_MAPB_CNFG_DATA, 0);
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);
68 static void __init storcenter_setup_arch(void)
70 struct device_node *np;
72 /* Lookup PCI host bridges */
73 for_each_compatible_node(np, "pci", "mpc10x-pci")
74 storcenter_add_bridge(np);
76 printk(KERN_INFO "IOMEGA StorCenter\n");
80 * Interrupt setup and service. Interrrupts on the turbostation come
81 * from the four PCI slots plus onboard 8241 devices: I2C, DUART.
83 static void __init storcenter_init_IRQ(void)
86 struct device_node *dnp;
91 dnp = of_find_node_by_type(NULL, "open-pic");
95 prop = of_get_property(dnp, "reg", &size);
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 ");
107 BUG_ON(mpic == NULL);
110 * 16 Serial Interrupts followed by 16 Internal Interrupts.
111 * I2C is the second internal, so it is at 17, 0x11020.
113 mpic_assign_isu(mpic, 0, paddr + 0x10200);
114 mpic_assign_isu(mpic, 1, paddr + 0x11000);
119 static void storcenter_restart(char *cmd)
123 /* Set exception prefix high - to the firmware */
124 _nmask_and_or_msr(0, MSR_IP);
126 /* Wait for reset to happen */
130 static int __init storcenter_probe(void)
132 unsigned long root = of_get_flat_dt_root();
134 return of_flat_dt_is_compatible(root, "iomega,storcenter");
137 define_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,