2 * Copyright (c) 2008 Emcraft Systems
3 * Sergei Poselenov <sposelenov@emcraft.com>
5 * Based on MPC8560 ADS and arch/ppc tqm85xx ports
7 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
9 * Copyright 2008 Freescale Semiconductor Inc.
11 * Copyright (c) 2005-2006 DENX Software Engineering
12 * Stefan Roese <sr@denx.de>
14 * Based on original work by
15 * Kumar Gala <kumar.gala@freescale.com>
16 * Copyright 2004 Freescale Semiconductor Inc.
18 * This program is free software; you can redistribute it and/or modify it
19 * under the terms of the GNU General Public License as published by the
20 * Free Software Foundation; either version 2 of the License, or (at your
21 * option) any later version.
24 #include <linux/stddef.h>
25 #include <linux/kernel.h>
26 #include <linux/pci.h>
27 #include <linux/kdev_t.h>
28 #include <linux/delay.h>
29 #include <linux/seq_file.h>
30 #include <linux/of_platform.h>
32 #include <asm/system.h>
34 #include <asm/machdep.h>
35 #include <asm/pci-bridge.h>
38 #include <mm/mmu_decl.h>
41 #include <sysdev/fsl_soc.h>
42 #include <sysdev/fsl_pci.h>
44 #include "socrates_fpga_pic.h"
46 static void __init
socrates_pic_init(void)
50 struct device_node
*np
;
52 np
= of_find_node_by_type(NULL
, "open-pic");
54 printk(KERN_ERR
"Could not find open-pic node\n");
58 if (of_address_to_resource(np
, 0, &r
)) {
59 printk(KERN_ERR
"Could not map mpic register space\n");
64 mpic
= mpic_alloc(np
, r
.start
,
65 MPIC_PRIMARY
| MPIC_WANTS_RESET
| MPIC_BIG_ENDIAN
,
72 np
= of_find_compatible_node(NULL
, NULL
, "abb,socrates-fpga-pic");
74 printk(KERN_ERR
"Could not find socrates-fpga-pic node\n");
77 socrates_fpga_pic_init(np
);
82 * Setup the architecture
84 static void __init
socrates_setup_arch(void)
87 struct device_node
*np
;
91 ppc_md
.progress("socrates_setup_arch()", 0);
94 for_each_compatible_node(np
, "pci", "fsl,mpc8540-pci")
95 fsl_add_bridge(np
, 1);
99 static struct of_device_id __initdata socrates_of_bus_ids
[] = {
100 { .compatible
= "simple-bus", },
101 { .compatible
= "gianfar", },
105 static int __init
socrates_publish_devices(void)
107 return of_platform_bus_probe(NULL
, socrates_of_bus_ids
, NULL
);
109 machine_device_initcall(socrates
, socrates_publish_devices
);
112 * Called very early, device-tree isn't unflattened
114 static int __init
socrates_probe(void)
116 unsigned long root
= of_get_flat_dt_root();
118 if (of_flat_dt_is_compatible(root
, "abb,socrates"))
124 define_machine(socrates
) {
126 .probe
= socrates_probe
,
127 .setup_arch
= socrates_setup_arch
,
128 .init_IRQ
= socrates_pic_init
,
129 .get_irq
= mpic_get_irq
,
130 .restart
= fsl_rstcr_restart
,
131 .calibrate_decr
= generic_calibrate_decr
,
132 .progress
= udbg_progress
,