Prabhakar Kushwaha | 2d05c39 | 2011-06-02 20:28:08 +0000 | [diff] [blame] | 1 | /* |
| 2 | * P1010RDB Board Setup |
| 3 | * |
| 4 | * Copyright 2011 Freescale Semiconductor Inc. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2 of the License, or (at your |
| 9 | * option) any later version. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/stddef.h> |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/pci.h> |
| 15 | #include <linux/delay.h> |
| 16 | #include <linux/interrupt.h> |
| 17 | #include <linux/of_platform.h> |
| 18 | |
| 19 | #include <asm/system.h> |
| 20 | #include <asm/time.h> |
| 21 | #include <asm/machdep.h> |
| 22 | #include <asm/pci-bridge.h> |
| 23 | #include <mm/mmu_decl.h> |
| 24 | #include <asm/prom.h> |
| 25 | #include <asm/udbg.h> |
| 26 | #include <asm/mpic.h> |
| 27 | |
| 28 | #include <sysdev/fsl_soc.h> |
| 29 | #include <sysdev/fsl_pci.h> |
| 30 | |
Kumar Gala | 199bfbe | 2011-11-24 01:00:10 -0600 | [diff] [blame] | 31 | #include "mpc85xx.h" |
| 32 | |
Prabhakar Kushwaha | 2d05c39 | 2011-06-02 20:28:08 +0000 | [diff] [blame] | 33 | void __init p1010_rdb_pic_init(void) |
| 34 | { |
Kyle Moffett | e55d7f7 | 2011-12-22 10:19:14 +0000 | [diff] [blame^] | 35 | struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN | |
Kyle Moffett | 5019609 | 2011-12-22 10:19:12 +0000 | [diff] [blame] | 36 | MPIC_SINGLE_DEST_CPU, |
Prabhakar Kushwaha | 2d05c39 | 2011-06-02 20:28:08 +0000 | [diff] [blame] | 37 | 0, 256, " OpenPIC "); |
| 38 | |
| 39 | BUG_ON(mpic == NULL); |
Prabhakar Kushwaha | 2d05c39 | 2011-06-02 20:28:08 +0000 | [diff] [blame] | 40 | |
| 41 | mpic_init(mpic); |
Prabhakar Kushwaha | 2d05c39 | 2011-06-02 20:28:08 +0000 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | |
| 45 | /* |
| 46 | * Setup the architecture |
| 47 | */ |
| 48 | static void __init p1010_rdb_setup_arch(void) |
| 49 | { |
| 50 | #ifdef CONFIG_PCI |
| 51 | struct device_node *np; |
| 52 | #endif |
| 53 | |
| 54 | if (ppc_md.progress) |
| 55 | ppc_md.progress("p1010_rdb_setup_arch()", 0); |
| 56 | |
| 57 | #ifdef CONFIG_PCI |
| 58 | for_each_node_by_type(np, "pci") { |
| 59 | if (of_device_is_compatible(np, "fsl,p1010-pcie")) |
| 60 | fsl_add_bridge(np, 0); |
| 61 | } |
| 62 | |
| 63 | #endif |
| 64 | |
| 65 | printk(KERN_INFO "P1010 RDB board from Freescale Semiconductor\n"); |
| 66 | } |
| 67 | |
Kumar Gala | 199bfbe | 2011-11-24 01:00:10 -0600 | [diff] [blame] | 68 | machine_device_initcall(p1010_rdb, mpc85xx_common_publish_devices); |
Prabhakar Kushwaha | 2d05c39 | 2011-06-02 20:28:08 +0000 | [diff] [blame] | 69 | machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier); |
| 70 | |
| 71 | /* |
| 72 | * Called very early, device-tree isn't unflattened |
| 73 | */ |
| 74 | static int __init p1010_rdb_probe(void) |
| 75 | { |
| 76 | unsigned long root = of_get_flat_dt_root(); |
| 77 | |
| 78 | if (of_flat_dt_is_compatible(root, "fsl,P1010RDB")) |
| 79 | return 1; |
| 80 | return 0; |
| 81 | } |
| 82 | |
| 83 | define_machine(p1010_rdb) { |
| 84 | .name = "P1010 RDB", |
| 85 | .probe = p1010_rdb_probe, |
| 86 | .setup_arch = p1010_rdb_setup_arch, |
| 87 | .init_IRQ = p1010_rdb_pic_init, |
| 88 | #ifdef CONFIG_PCI |
| 89 | .pcibios_fixup_bus = fsl_pcibios_fixup_bus, |
| 90 | #endif |
| 91 | .get_irq = mpic_get_irq, |
| 92 | .restart = fsl_rstcr_restart, |
| 93 | .calibrate_decr = generic_calibrate_decr, |
| 94 | .progress = udbg_progress, |
| 95 | }; |