Path: blob/master/arch/powerpc/platforms/85xx/socrates.c
10820 views
/*1* Copyright (c) 2008 Emcraft Systems2* Sergei Poselenov <[email protected]>3*4* Based on MPC8560 ADS and arch/ppc tqm85xx ports5*6* Maintained by Kumar Gala (see MAINTAINERS for contact information)7*8* Copyright 2008 Freescale Semiconductor Inc.9*10* Copyright (c) 2005-2006 DENX Software Engineering11* Stefan Roese <[email protected]>12*13* Based on original work by14* Kumar Gala <[email protected]>15* Copyright 2004 Freescale Semiconductor Inc.16*17* This program is free software; you can redistribute it and/or modify it18* under the terms of the GNU General Public License as published by the19* Free Software Foundation; either version 2 of the License, or (at your20* option) any later version.21*/2223#include <linux/stddef.h>24#include <linux/kernel.h>25#include <linux/pci.h>26#include <linux/kdev_t.h>27#include <linux/delay.h>28#include <linux/seq_file.h>29#include <linux/of_platform.h>3031#include <asm/system.h>32#include <asm/time.h>33#include <asm/machdep.h>34#include <asm/pci-bridge.h>35#include <asm/mpic.h>36#include <asm/prom.h>37#include <mm/mmu_decl.h>38#include <asm/udbg.h>3940#include <sysdev/fsl_soc.h>41#include <sysdev/fsl_pci.h>4243#include "socrates_fpga_pic.h"4445static void __init socrates_pic_init(void)46{47struct mpic *mpic;48struct resource r;49struct device_node *np;5051np = of_find_node_by_type(NULL, "open-pic");52if (!np) {53printk(KERN_ERR "Could not find open-pic node\n");54return;55}5657if (of_address_to_resource(np, 0, &r)) {58printk(KERN_ERR "Could not map mpic register space\n");59of_node_put(np);60return;61}6263mpic = mpic_alloc(np, r.start,64MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,650, 256, " OpenPIC ");66BUG_ON(mpic == NULL);67of_node_put(np);6869mpic_init(mpic);7071np = of_find_compatible_node(NULL, NULL, "abb,socrates-fpga-pic");72if (!np) {73printk(KERN_ERR "Could not find socrates-fpga-pic node\n");74return;75}76socrates_fpga_pic_init(np);77of_node_put(np);78}7980/*81* Setup the architecture82*/83static void __init socrates_setup_arch(void)84{85#ifdef CONFIG_PCI86struct device_node *np;87#endif8889if (ppc_md.progress)90ppc_md.progress("socrates_setup_arch()", 0);9192#ifdef CONFIG_PCI93for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")94fsl_add_bridge(np, 1);95#endif96}9798static struct of_device_id __initdata socrates_of_bus_ids[] = {99{ .compatible = "simple-bus", },100{ .compatible = "gianfar", },101{},102};103104static int __init socrates_publish_devices(void)105{106return of_platform_bus_probe(NULL, socrates_of_bus_ids, NULL);107}108machine_device_initcall(socrates, socrates_publish_devices);109110/*111* Called very early, device-tree isn't unflattened112*/113static int __init socrates_probe(void)114{115unsigned long root = of_get_flat_dt_root();116117if (of_flat_dt_is_compatible(root, "abb,socrates"))118return 1;119120return 0;121}122123define_machine(socrates) {124.name = "Socrates",125.probe = socrates_probe,126.setup_arch = socrates_setup_arch,127.init_IRQ = socrates_pic_init,128.get_irq = mpic_get_irq,129.restart = fsl_rstcr_restart,130.calibrate_decr = generic_calibrate_decr,131.progress = udbg_progress,132};133134135