Path: blob/master/arch/powerpc/platforms/85xx/sbc8548.c
10820 views
/*1* Wind River SBC8548 setup and early boot code.2*3* Copyright 2007 Wind River Systems Inc.4*5* By Paul Gortmaker (see MAINTAINERS for contact information)6*7* Based largely on the MPC8548CDS support - Copyright 2005 Freescale Inc.8*9*10* This program is free software; you can redistribute it and/or modify it11* under the terms of the GNU General Public License as published by the12* Free Software Foundation; either version 2 of the License, or (at your13* option) any later version.14*/1516#include <linux/stddef.h>17#include <linux/kernel.h>18#include <linux/init.h>19#include <linux/errno.h>20#include <linux/reboot.h>21#include <linux/pci.h>22#include <linux/kdev_t.h>23#include <linux/major.h>24#include <linux/console.h>25#include <linux/delay.h>26#include <linux/seq_file.h>27#include <linux/initrd.h>28#include <linux/module.h>29#include <linux/interrupt.h>30#include <linux/fsl_devices.h>31#include <linux/of_platform.h>3233#include <asm/system.h>34#include <asm/pgtable.h>35#include <asm/page.h>36#include <asm/atomic.h>37#include <asm/time.h>38#include <asm/io.h>39#include <asm/machdep.h>40#include <asm/ipic.h>41#include <asm/pci-bridge.h>42#include <asm/irq.h>43#include <mm/mmu_decl.h>44#include <asm/prom.h>45#include <asm/udbg.h>46#include <asm/mpic.h>4748#include <sysdev/fsl_soc.h>49#include <sysdev/fsl_pci.h>5051static int sbc_rev;5253static void __init sbc8548_pic_init(void)54{55struct mpic *mpic;56struct resource r;57struct device_node *np = NULL;5859np = of_find_node_by_type(np, "open-pic");6061if (np == NULL) {62printk(KERN_ERR "Could not find open-pic node\n");63return;64}6566if (of_address_to_resource(np, 0, &r)) {67printk(KERN_ERR "Failed to map mpic register space\n");68of_node_put(np);69return;70}7172mpic = mpic_alloc(np, r.start,73MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,740, 256, " OpenPIC ");75BUG_ON(mpic == NULL);7677/* Return the mpic node */78of_node_put(np);7980mpic_init(mpic);81}8283/* Extract the HW Rev from the EPLD on the board */84static int __init sbc8548_hw_rev(void)85{86struct device_node *np;87struct resource res;88unsigned int *rev;89int board_rev = 0;9091np = of_find_compatible_node(NULL, NULL, "hw-rev");92if (np == NULL) {93printk("No HW-REV found in DTB.\n");94return -ENODEV;95}9697of_address_to_resource(np, 0, &res);98of_node_put(np);99100rev = ioremap(res.start,sizeof(unsigned int));101board_rev = (*rev) >> 28;102iounmap(rev);103104return board_rev;105}106107/*108* Setup the architecture109*/110static void __init sbc8548_setup_arch(void)111{112#ifdef CONFIG_PCI113struct device_node *np;114#endif115116if (ppc_md.progress)117ppc_md.progress("sbc8548_setup_arch()", 0);118119#ifdef CONFIG_PCI120for_each_node_by_type(np, "pci") {121if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||122of_device_is_compatible(np, "fsl,mpc8548-pcie")) {123struct resource rsrc;124of_address_to_resource(np, 0, &rsrc);125if ((rsrc.start & 0xfffff) == 0x8000)126fsl_add_bridge(np, 1);127else128fsl_add_bridge(np, 0);129}130}131#endif132sbc_rev = sbc8548_hw_rev();133}134135static void sbc8548_show_cpuinfo(struct seq_file *m)136{137uint pvid, svid, phid1;138139pvid = mfspr(SPRN_PVR);140svid = mfspr(SPRN_SVR);141142seq_printf(m, "Vendor\t\t: Wind River\n");143seq_printf(m, "Machine\t\t: SBC8548 v%d\n", sbc_rev);144seq_printf(m, "PVR\t\t: 0x%x\n", pvid);145seq_printf(m, "SVR\t\t: 0x%x\n", svid);146147/* Display cpu Pll setting */148phid1 = mfspr(SPRN_HID1);149seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));150}151152static struct of_device_id __initdata of_bus_ids[] = {153{ .name = "soc", },154{ .type = "soc", },155{ .compatible = "simple-bus", },156{ .compatible = "gianfar", },157{},158};159160static int __init declare_of_platform_devices(void)161{162of_platform_bus_probe(NULL, of_bus_ids, NULL);163164return 0;165}166machine_device_initcall(sbc8548, declare_of_platform_devices);167168/*169* Called very early, device-tree isn't unflattened170*/171static int __init sbc8548_probe(void)172{173unsigned long root = of_get_flat_dt_root();174175return of_flat_dt_is_compatible(root, "SBC8548");176}177178define_machine(sbc8548) {179.name = "SBC8548",180.probe = sbc8548_probe,181.setup_arch = sbc8548_setup_arch,182.init_IRQ = sbc8548_pic_init,183.show_cpuinfo = sbc8548_show_cpuinfo,184.get_irq = mpic_get_irq,185.restart = fsl_rstcr_restart,186#ifdef CONFIG_PCI187.pcibios_fixup_bus = fsl_pcibios_fixup_bus,188#endif189.calibrate_decr = generic_calibrate_decr,190.progress = udbg_progress,191};192193194