Path: blob/master/arch/powerpc/platforms/85xx/mpc8536_ds.c
10820 views
/*1* MPC8536 DS Board Setup2*3* Copyright 2008 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>19#include <linux/memblock.h>2021#include <asm/system.h>22#include <asm/time.h>23#include <asm/machdep.h>24#include <asm/pci-bridge.h>25#include <mm/mmu_decl.h>26#include <asm/prom.h>27#include <asm/udbg.h>28#include <asm/mpic.h>29#include <asm/swiotlb.h>3031#include <sysdev/fsl_soc.h>32#include <sysdev/fsl_pci.h>3334void __init mpc8536_ds_pic_init(void)35{36struct mpic *mpic;37struct resource r;38struct device_node *np;3940np = of_find_node_by_type(NULL, "open-pic");41if (np == NULL) {42printk(KERN_ERR "Could not find open-pic node\n");43return;44}4546if (of_address_to_resource(np, 0, &r)) {47printk(KERN_ERR "Failed to map mpic register space\n");48of_node_put(np);49return;50}5152mpic = mpic_alloc(np, r.start,53MPIC_PRIMARY | MPIC_WANTS_RESET |54MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,550, 256, " OpenPIC ");56BUG_ON(mpic == NULL);57of_node_put(np);5859mpic_init(mpic);60}6162/*63* Setup the architecture64*/65static void __init mpc8536_ds_setup_arch(void)66{67#ifdef CONFIG_PCI68struct device_node *np;69struct pci_controller *hose;70#endif71dma_addr_t max = 0xffffffff;7273if (ppc_md.progress)74ppc_md.progress("mpc8536_ds_setup_arch()", 0);7576#ifdef CONFIG_PCI77for_each_node_by_type(np, "pci") {78if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||79of_device_is_compatible(np, "fsl,mpc8548-pcie")) {80struct resource rsrc;81of_address_to_resource(np, 0, &rsrc);82if ((rsrc.start & 0xfffff) == 0x8000)83fsl_add_bridge(np, 1);84else85fsl_add_bridge(np, 0);8687hose = pci_find_hose_for_OF_device(np);88max = min(max, hose->dma_window_base_cur +89hose->dma_window_size);90}91}9293#endif9495#ifdef CONFIG_SWIOTLB96if (memblock_end_of_DRAM() > max) {97ppc_swiotlb_enable = 1;98set_pci_dma_ops(&swiotlb_dma_ops);99ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;100}101#endif102103printk("MPC8536 DS board from Freescale Semiconductor\n");104}105106static struct of_device_id __initdata mpc8536_ds_ids[] = {107{ .type = "soc", },108{ .compatible = "soc", },109{ .compatible = "simple-bus", },110{ .compatible = "gianfar", },111{},112};113114static int __init mpc8536_ds_publish_devices(void)115{116return of_platform_bus_probe(NULL, mpc8536_ds_ids, NULL);117}118machine_device_initcall(mpc8536_ds, mpc8536_ds_publish_devices);119120machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier);121122/*123* Called very early, device-tree isn't unflattened124*/125static int __init mpc8536_ds_probe(void)126{127unsigned long root = of_get_flat_dt_root();128129return of_flat_dt_is_compatible(root, "fsl,mpc8536ds");130}131132define_machine(mpc8536_ds) {133.name = "MPC8536 DS",134.probe = mpc8536_ds_probe,135.setup_arch = mpc8536_ds_setup_arch,136.init_IRQ = mpc8536_ds_pic_init,137#ifdef CONFIG_PCI138.pcibios_fixup_bus = fsl_pcibios_fixup_bus,139#endif140.get_irq = mpic_get_irq,141.restart = fsl_rstcr_restart,142.calibrate_decr = generic_calibrate_decr,143.progress = udbg_progress,144};145146147