Path: blob/master/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
10820 views
/*1* MPC85xx RDB Board Setup2*3* Copyright 2009 Freescale Semiconductor Inc.4*5* This program is free software; you can redistribute it and/or modify it6* under the terms of the GNU General Public License as published by the7* Free Software Foundation; either version 2 of the License, or (at your8* option) any later version.9*/1011#include <linux/stddef.h>12#include <linux/kernel.h>13#include <linux/pci.h>14#include <linux/kdev_t.h>15#include <linux/delay.h>16#include <linux/seq_file.h>17#include <linux/interrupt.h>18#include <linux/of_platform.h>1920#include <asm/system.h>21#include <asm/time.h>22#include <asm/machdep.h>23#include <asm/pci-bridge.h>24#include <mm/mmu_decl.h>25#include <asm/prom.h>26#include <asm/udbg.h>27#include <asm/mpic.h>2829#include <sysdev/fsl_soc.h>30#include <sysdev/fsl_pci.h>3132#undef DEBUG3334#ifdef DEBUG35#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __func__, ## args)36#else37#define DBG(fmt, args...)38#endif394041void __init mpc85xx_rdb_pic_init(void)42{43struct mpic *mpic;44struct resource r;45struct device_node *np;46unsigned long root = of_get_flat_dt_root();4748np = of_find_node_by_type(NULL, "open-pic");49if (np == NULL) {50printk(KERN_ERR "Could not find open-pic node\n");51return;52}5354if (of_address_to_resource(np, 0, &r)) {55printk(KERN_ERR "Failed to map mpic register space\n");56of_node_put(np);57return;58}5960if (of_flat_dt_is_compatible(root, "fsl,85XXRDB-CAMP")) {61mpic = mpic_alloc(np, r.start,62MPIC_PRIMARY |63MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,640, 256, " OpenPIC ");65} else {66mpic = mpic_alloc(np, r.start,67MPIC_PRIMARY | MPIC_WANTS_RESET |68MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |69MPIC_SINGLE_DEST_CPU,700, 256, " OpenPIC ");71}7273BUG_ON(mpic == NULL);74of_node_put(np);7576mpic_init(mpic);7778}7980/*81* Setup the architecture82*/83#ifdef CONFIG_SMP84extern void __init mpc85xx_smp_init(void);85#endif86static void __init mpc85xx_rdb_setup_arch(void)87{88#ifdef CONFIG_PCI89struct device_node *np;90#endif9192if (ppc_md.progress)93ppc_md.progress("mpc85xx_rdb_setup_arch()", 0);9495#ifdef CONFIG_PCI96for_each_node_by_type(np, "pci") {97if (of_device_is_compatible(np, "fsl,mpc8548-pcie"))98fsl_add_bridge(np, 0);99}100101#endif102103#ifdef CONFIG_SMP104mpc85xx_smp_init();105#endif106107printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");108}109110static struct of_device_id __initdata mpc85xxrdb_ids[] = {111{ .type = "soc", },112{ .compatible = "soc", },113{ .compatible = "simple-bus", },114{ .compatible = "gianfar", },115{},116};117118static int __init mpc85xxrdb_publish_devices(void)119{120return of_platform_bus_probe(NULL, mpc85xxrdb_ids, NULL);121}122machine_device_initcall(p2020_rdb, mpc85xxrdb_publish_devices);123machine_device_initcall(p1020_rdb, mpc85xxrdb_publish_devices);124125/*126* Called very early, device-tree isn't unflattened127*/128static int __init p2020_rdb_probe(void)129{130unsigned long root = of_get_flat_dt_root();131132if (of_flat_dt_is_compatible(root, "fsl,P2020RDB"))133return 1;134return 0;135}136137static int __init p1020_rdb_probe(void)138{139unsigned long root = of_get_flat_dt_root();140141if (of_flat_dt_is_compatible(root, "fsl,P1020RDB"))142return 1;143return 0;144}145146define_machine(p2020_rdb) {147.name = "P2020 RDB",148.probe = p2020_rdb_probe,149.setup_arch = mpc85xx_rdb_setup_arch,150.init_IRQ = mpc85xx_rdb_pic_init,151#ifdef CONFIG_PCI152.pcibios_fixup_bus = fsl_pcibios_fixup_bus,153#endif154.get_irq = mpic_get_irq,155.restart = fsl_rstcr_restart,156.calibrate_decr = generic_calibrate_decr,157.progress = udbg_progress,158};159160define_machine(p1020_rdb) {161.name = "P1020 RDB",162.probe = p1020_rdb_probe,163.setup_arch = mpc85xx_rdb_setup_arch,164.init_IRQ = mpc85xx_rdb_pic_init,165#ifdef CONFIG_PCI166.pcibios_fixup_bus = fsl_pcibios_fixup_bus,167#endif168.get_irq = mpic_get_irq,169.restart = fsl_rstcr_restart,170.calibrate_decr = generic_calibrate_decr,171.progress = udbg_progress,172};173174175