Path: blob/master/arch/powerpc/platforms/embedded6xx/storcenter.c
10819 views
/*1* Board setup routines for the storcenter2*3* Copyright 2007 (C) Oyvind Repvik ([email protected])4* Copyright 2007 Andy Wilcox, Jon Loeliger5*6* Based on linkstation.c by G. Liakhovetski7*8* This file is licensed under the terms of the GNU General Public License9* version 2. This program is licensed "as is" without any warranty of10* any kind, whether express or implied.11*/1213#include <linux/kernel.h>14#include <linux/pci.h>15#include <linux/initrd.h>16#include <linux/of_platform.h>1718#include <asm/system.h>19#include <asm/time.h>20#include <asm/prom.h>21#include <asm/mpic.h>22#include <asm/pci-bridge.h>2324#include "mpc10x.h"252627static __initdata struct of_device_id storcenter_of_bus[] = {28{ .name = "soc", },29{},30};3132static int __init storcenter_device_probe(void)33{34of_platform_bus_probe(NULL, storcenter_of_bus, NULL);35return 0;36}37machine_device_initcall(storcenter, storcenter_device_probe);383940static int __init storcenter_add_bridge(struct device_node *dev)41{42#ifdef CONFIG_PCI43int len;44struct pci_controller *hose;45const int *bus_range;4647printk("Adding PCI host bridge %s\n", dev->full_name);4849hose = pcibios_alloc_controller(dev);50if (hose == NULL)51return -ENOMEM;5253bus_range = of_get_property(dev, "bus-range", &len);54hose->first_busno = bus_range ? bus_range[0] : 0;55hose->last_busno = bus_range ? bus_range[1] : 0xff;5657setup_indirect_pci(hose, MPC10X_MAPB_CNFG_ADDR, MPC10X_MAPB_CNFG_DATA, 0);5859/* Interpret the "ranges" property */60/* This also maps the I/O region and sets isa_io/mem_base */61pci_process_bridge_OF_ranges(hose, dev, 1);62#endif6364return 0;65}6667static void __init storcenter_setup_arch(void)68{69struct device_node *np;7071/* Lookup PCI host bridges */72for_each_compatible_node(np, "pci", "mpc10x-pci")73storcenter_add_bridge(np);7475printk(KERN_INFO "IOMEGA StorCenter\n");76}7778/*79* Interrupt setup and service. Interrrupts on the turbostation come80* from the four PCI slots plus onboard 8241 devices: I2C, DUART.81*/82static void __init storcenter_init_IRQ(void)83{84struct mpic *mpic;85struct device_node *dnp;86const void *prop;87int size;88phys_addr_t paddr;8990dnp = of_find_node_by_type(NULL, "open-pic");91if (dnp == NULL)92return;9394prop = of_get_property(dnp, "reg", &size);95if (prop == NULL) {96of_node_put(dnp);97return;98}99100paddr = (phys_addr_t)of_translate_address(dnp, prop);101mpic = mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC_WANTS_RESET,10216, 32, " OpenPIC ");103104of_node_put(dnp);105106BUG_ON(mpic == NULL);107108/*109* 16 Serial Interrupts followed by 16 Internal Interrupts.110* I2C is the second internal, so it is at 17, 0x11020.111*/112mpic_assign_isu(mpic, 0, paddr + 0x10200);113mpic_assign_isu(mpic, 1, paddr + 0x11000);114115mpic_init(mpic);116}117118static void storcenter_restart(char *cmd)119{120local_irq_disable();121122/* Set exception prefix high - to the firmware */123_nmask_and_or_msr(0, MSR_IP);124125/* Wait for reset to happen */126for (;;) ;127}128129static int __init storcenter_probe(void)130{131unsigned long root = of_get_flat_dt_root();132133return of_flat_dt_is_compatible(root, "iomega,storcenter");134}135136define_machine(storcenter){137.name = "IOMEGA StorCenter",138.probe = storcenter_probe,139.setup_arch = storcenter_setup_arch,140.init_IRQ = storcenter_init_IRQ,141.get_irq = mpic_get_irq,142.restart = storcenter_restart,143.calibrate_decr = generic_calibrate_decr,144};145146147