Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * Copyright (c) 2008 Emcraft Systems
0004  * Sergei Poselenov <sposelenov@emcraft.com>
0005  *
0006  * Based on MPC8560 ADS and arch/ppc tqm85xx ports
0007  *
0008  * Maintained by Kumar Gala (see MAINTAINERS for contact information)
0009  *
0010  * Copyright 2008 Freescale Semiconductor Inc.
0011  *
0012  * Copyright (c) 2005-2006 DENX Software Engineering
0013  * Stefan Roese <sr@denx.de>
0014  *
0015  * Based on original work by
0016  *  Kumar Gala <kumar.gala@freescale.com>
0017  *      Copyright 2004 Freescale Semiconductor Inc.
0018  */
0019 
0020 #include <linux/stddef.h>
0021 #include <linux/kernel.h>
0022 #include <linux/pci.h>
0023 #include <linux/kdev_t.h>
0024 #include <linux/delay.h>
0025 #include <linux/seq_file.h>
0026 #include <linux/of_platform.h>
0027 
0028 #include <asm/time.h>
0029 #include <asm/machdep.h>
0030 #include <asm/pci-bridge.h>
0031 #include <asm/mpic.h>
0032 #include <mm/mmu_decl.h>
0033 #include <asm/udbg.h>
0034 
0035 #include <sysdev/fsl_soc.h>
0036 #include <sysdev/fsl_pci.h>
0037 
0038 #include "mpc85xx.h"
0039 #include "socrates_fpga_pic.h"
0040 
0041 static void __init socrates_pic_init(void)
0042 {
0043     struct device_node *np;
0044 
0045     struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
0046             0, 256, " OpenPIC  ");
0047     BUG_ON(mpic == NULL);
0048     mpic_init(mpic);
0049 
0050     np = of_find_compatible_node(NULL, NULL, "abb,socrates-fpga-pic");
0051     if (!np) {
0052         printk(KERN_ERR "Could not find socrates-fpga-pic node\n");
0053         return;
0054     }
0055     socrates_fpga_pic_init(np);
0056     of_node_put(np);
0057 }
0058 
0059 /*
0060  * Setup the architecture
0061  */
0062 static void __init socrates_setup_arch(void)
0063 {
0064     if (ppc_md.progress)
0065         ppc_md.progress("socrates_setup_arch()", 0);
0066 
0067     fsl_pci_assign_primary();
0068 }
0069 
0070 machine_arch_initcall(socrates, mpc85xx_common_publish_devices);
0071 
0072 /*
0073  * Called very early, device-tree isn't unflattened
0074  */
0075 static int __init socrates_probe(void)
0076 {
0077     if (of_machine_is_compatible("abb,socrates"))
0078         return 1;
0079 
0080     return 0;
0081 }
0082 
0083 define_machine(socrates) {
0084     .name           = "Socrates",
0085     .probe          = socrates_probe,
0086     .setup_arch     = socrates_setup_arch,
0087     .init_IRQ       = socrates_pic_init,
0088     .get_irq        = mpic_get_irq,
0089     .calibrate_decr     = generic_calibrate_decr,
0090     .progress       = udbg_progress,
0091 };