Path: blob/master/arch/powerpc/platforms/85xx/stx_gp3.c
10820 views
/*1* Based on MPC8560 ADS and arch/ppc stx_gp3 ports2*3* Maintained by Kumar Gala (see MAINTAINERS for contact information)4*5* Copyright 2008 Freescale Semiconductor Inc.6*7* Dan Malek <[email protected]>8* Copyright 2004 Embedded Edge, LLC9*10* Copied from mpc8560_ads.c11* Copyright 2002, 2003 Motorola Inc.12*13* Ported to 2.6, Matt Porter <[email protected]>14* Copyright 2004-2005 MontaVista Software, Inc.15*16* This program is free software; you can redistribute it and/or modify it17* under the terms of the GNU General Public License as published by the18* Free Software Foundation; either version 2 of the License, or (at your19* option) any later version.20*/2122#include <linux/stddef.h>23#include <linux/kernel.h>24#include <linux/pci.h>25#include <linux/kdev_t.h>26#include <linux/delay.h>27#include <linux/seq_file.h>28#include <linux/of_platform.h>2930#include <asm/system.h>31#include <asm/time.h>32#include <asm/machdep.h>33#include <asm/pci-bridge.h>34#include <asm/mpic.h>35#include <asm/prom.h>36#include <mm/mmu_decl.h>37#include <asm/udbg.h>3839#include <sysdev/fsl_soc.h>40#include <sysdev/fsl_pci.h>4142#ifdef CONFIG_CPM243#include <asm/cpm2.h>44#include <sysdev/cpm2_pic.h>4546static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)47{48struct irq_chip *chip = irq_desc_get_chip(desc);49int cascade_irq;5051while ((cascade_irq = cpm2_get_irq()) >= 0)52generic_handle_irq(cascade_irq);5354chip->irq_eoi(&desc->irq_data);55}56#endif /* CONFIG_CPM2 */5758static void __init stx_gp3_pic_init(void)59{60struct mpic *mpic;61struct resource r;62struct device_node *np;63#ifdef CONFIG_CPM264int irq;65#endif6667np = of_find_node_by_type(NULL, "open-pic");68if (!np) {69printk(KERN_ERR "Could not find open-pic node\n");70return;71}7273if (of_address_to_resource(np, 0, &r)) {74printk(KERN_ERR "Could not map mpic register space\n");75of_node_put(np);76return;77}7879mpic = mpic_alloc(np, r.start,80MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,810, 256, " OpenPIC ");82BUG_ON(mpic == NULL);83of_node_put(np);8485mpic_init(mpic);8687#ifdef CONFIG_CPM288/* Setup CPM2 PIC */89np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");90if (np == NULL) {91printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");92return;93}94irq = irq_of_parse_and_map(np, 0);9596if (irq == NO_IRQ) {97of_node_put(np);98printk(KERN_ERR "PIC init: got no IRQ for cpm cascade\n");99return;100}101102cpm2_pic_init(np);103of_node_put(np);104irq_set_chained_handler(irq, cpm2_cascade);105#endif106}107108/*109* Setup the architecture110*/111static void __init stx_gp3_setup_arch(void)112{113#ifdef CONFIG_PCI114struct device_node *np;115#endif116117if (ppc_md.progress)118ppc_md.progress("stx_gp3_setup_arch()", 0);119120#ifdef CONFIG_CPM2121cpm2_reset();122#endif123124#ifdef CONFIG_PCI125for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")126fsl_add_bridge(np, 1);127#endif128}129130static void stx_gp3_show_cpuinfo(struct seq_file *m)131{132uint pvid, svid, phid1;133134pvid = mfspr(SPRN_PVR);135svid = mfspr(SPRN_SVR);136137seq_printf(m, "Vendor\t\t: RPC Electronics STx\n");138seq_printf(m, "PVR\t\t: 0x%x\n", pvid);139seq_printf(m, "SVR\t\t: 0x%x\n", svid);140141/* Display cpu Pll setting */142phid1 = mfspr(SPRN_HID1);143seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));144}145146static struct of_device_id __initdata of_bus_ids[] = {147{ .compatible = "simple-bus", },148{ .compatible = "gianfar", },149{},150};151152static int __init declare_of_platform_devices(void)153{154of_platform_bus_probe(NULL, of_bus_ids, NULL);155156return 0;157}158machine_device_initcall(stx_gp3, declare_of_platform_devices);159160/*161* Called very early, device-tree isn't unflattened162*/163static int __init stx_gp3_probe(void)164{165unsigned long root = of_get_flat_dt_root();166167return of_flat_dt_is_compatible(root, "stx,gp3-8560");168}169170define_machine(stx_gp3) {171.name = "STX GP3",172.probe = stx_gp3_probe,173.setup_arch = stx_gp3_setup_arch,174.init_IRQ = stx_gp3_pic_init,175.show_cpuinfo = stx_gp3_show_cpuinfo,176.get_irq = mpic_get_irq,177.restart = fsl_rstcr_restart,178.calibrate_decr = generic_calibrate_decr,179.progress = udbg_progress,180};181182183