Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008 Emcraft Systems |
| 3 | * Sergei Poselenov <sposelenov@emcraft.com> |
| 4 | * |
| 5 | * Based on MPC8560 ADS and arch/ppc tqm85xx ports |
| 6 | * |
| 7 | * Maintained by Kumar Gala (see MAINTAINERS for contact information) |
| 8 | * |
| 9 | * Copyright 2008 Freescale Semiconductor Inc. |
| 10 | * |
| 11 | * Copyright (c) 2005-2006 DENX Software Engineering |
| 12 | * Stefan Roese <sr@denx.de> |
| 13 | * |
| 14 | * Based on original work by |
| 15 | * Kumar Gala <kumar.gala@freescale.com> |
| 16 | * Copyright 2004 Freescale Semiconductor Inc. |
| 17 | * |
| 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. |
| 22 | */ |
| 23 | |
| 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> |
| 31 | |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 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> |
| 39 | |
| 40 | #include <sysdev/fsl_soc.h> |
| 41 | #include <sysdev/fsl_pci.h> |
| 42 | |
Dmitry Eremin-Solenikov | 543a07b | 2011-11-17 21:56:16 +0400 | [diff] [blame] | 43 | #include "mpc85xx.h" |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 44 | #include "socrates_fpga_pic.h" |
| 45 | |
| 46 | static void __init socrates_pic_init(void) |
| 47 | { |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 48 | struct device_node *np; |
| 49 | |
Kyle Moffett | e55d7f7 | 2011-12-22 10:19:14 +0000 | [diff] [blame] | 50 | struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN, |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 51 | 0, 256, " OpenPIC "); |
| 52 | BUG_ON(mpic == NULL); |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 53 | mpic_init(mpic); |
| 54 | |
| 55 | np = of_find_compatible_node(NULL, NULL, "abb,socrates-fpga-pic"); |
| 56 | if (!np) { |
| 57 | printk(KERN_ERR "Could not find socrates-fpga-pic node\n"); |
| 58 | return; |
| 59 | } |
| 60 | socrates_fpga_pic_init(np); |
| 61 | of_node_put(np); |
| 62 | } |
| 63 | |
| 64 | /* |
| 65 | * Setup the architecture |
| 66 | */ |
| 67 | static void __init socrates_setup_arch(void) |
| 68 | { |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 69 | if (ppc_md.progress) |
| 70 | ppc_md.progress("socrates_setup_arch()", 0); |
| 71 | |
Jia Hongtao | 905e75c | 2012-08-28 15:44:08 +0800 | [diff] [blame] | 72 | fsl_pci_assign_primary(); |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 73 | } |
| 74 | |
Jia Hongtao | 905e75c | 2012-08-28 15:44:08 +0800 | [diff] [blame] | 75 | machine_arch_initcall(socrates, mpc85xx_common_publish_devices); |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 76 | |
| 77 | /* |
| 78 | * Called very early, device-tree isn't unflattened |
| 79 | */ |
| 80 | static int __init socrates_probe(void) |
| 81 | { |
Benjamin Herrenschmidt | 5657138 | 2016-07-05 15:04:05 +1000 | [diff] [blame] | 82 | if (of_machine_is_compatible("abb,socrates")) |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 83 | return 1; |
| 84 | |
| 85 | return 0; |
| 86 | } |
| 87 | |
| 88 | define_machine(socrates) { |
| 89 | .name = "Socrates", |
| 90 | .probe = socrates_probe, |
| 91 | .setup_arch = socrates_setup_arch, |
Wolfgang Grandegger | 393adca | 2009-03-22 14:58:43 +0100 | [diff] [blame] | 92 | .init_IRQ = socrates_pic_init, |
| 93 | .get_irq = mpic_get_irq, |
| 94 | .restart = fsl_rstcr_restart, |
| 95 | .calibrate_decr = generic_calibrate_decr, |
| 96 | .progress = udbg_progress, |
| 97 | }; |