Path: blob/master/arch/powerpc/platforms/embedded6xx/storcenter.c
26489 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/time.h>19#include <asm/mpic.h>20#include <asm/pci-bridge.h>2122#include "mpc10x.h"232425static const struct of_device_id storcenter_of_bus[] __initconst = {26{ .name = "soc", },27{},28};2930static int __init storcenter_device_probe(void)31{32of_platform_bus_probe(NULL, storcenter_of_bus, NULL);33return 0;34}35machine_device_initcall(storcenter, storcenter_device_probe);363738static int __init storcenter_add_bridge(struct device_node *dev)39{40#ifdef CONFIG_PCI41int len;42struct pci_controller *hose;43const int *bus_range;4445printk("Adding PCI host bridge %pOF\n", dev);4647hose = pcibios_alloc_controller(dev);48if (hose == NULL)49return -ENOMEM;5051bus_range = of_get_property(dev, "bus-range", &len);52hose->first_busno = bus_range ? bus_range[0] : 0;53hose->last_busno = bus_range ? bus_range[1] : 0xff;5455setup_indirect_pci(hose, MPC10X_MAPB_CNFG_ADDR, MPC10X_MAPB_CNFG_DATA, 0);5657/* Interpret the "ranges" property */58/* This also maps the I/O region and sets isa_io/mem_base */59pci_process_bridge_OF_ranges(hose, dev, 1);60#endif6162return 0;63}6465static void __init storcenter_setup_arch(void)66{67printk(KERN_INFO "IOMEGA StorCenter\n");68}6970static void __init storcenter_setup_pci(void)71{72struct device_node *np;7374/* Lookup PCI host bridges */75for_each_compatible_node(np, "pci", "mpc10x-pci")76storcenter_add_bridge(np);77}7879/*80* Interrupt setup and service. Interrupts on the turbostation come81* from the four PCI slots plus onboard 8241 devices: I2C, DUART.82*/83static void __init storcenter_init_IRQ(void)84{85struct mpic *mpic;8687mpic = mpic_alloc(NULL, 0, 0, 16, 0, " OpenPIC ");88BUG_ON(mpic == NULL);8990/*91* 16 Serial Interrupts followed by 16 Internal Interrupts.92* I2C is the second internal, so it is at 17, 0x11020.93*/94mpic_assign_isu(mpic, 0, mpic->paddr + 0x10200);95mpic_assign_isu(mpic, 1, mpic->paddr + 0x11000);9697mpic_init(mpic);98}99100static void __noreturn storcenter_restart(char *cmd)101{102local_irq_disable();103104/* Set exception prefix high - to the firmware */105mtmsr(mfmsr() | MSR_IP);106isync();107108/* Wait for reset to happen */109for (;;) ;110}111112define_machine(storcenter){113.name = "IOMEGA StorCenter",114.compatible = "iomega,storcenter",115.setup_arch = storcenter_setup_arch,116.discover_phbs = storcenter_setup_pci,117.init_IRQ = storcenter_init_IRQ,118.get_irq = mpic_get_irq,119.restart = storcenter_restart,120};121122123