blob: dd3617c531d74260e01cbd88640e586a9f9ea2bd [file] [log] [blame]
Kumar Galaab2f4892009-10-22 16:35:07 -05001/*
2 * Corenet based SoC DS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
Kumar Galab9a43342011-05-09 15:08:57 -05006 * Copyright 2009-2011 Freescale Semiconductor Inc.
Kumar Galaab2f4892009-10-22 16:35:07 -05007 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
Yinghai Lu95f72d12010-07-12 14:36:09 +100019#include <linux/memblock.h>
Kumar Galaab2f4892009-10-22 16:35:07 -050020
Kumar Galaab2f4892009-10-22 16:35:07 -050021#include <asm/time.h>
22#include <asm/machdep.h>
23#include <asm/pci-bridge.h>
Kumar Gala6d251dd2011-05-19 21:59:23 -050024#include <asm/ppc-pci.h>
Kumar Galaab2f4892009-10-22 16:35:07 -050025#include <mm/mmu_decl.h>
26#include <asm/prom.h>
27#include <asm/udbg.h>
28#include <asm/mpic.h>
29
30#include <linux/of_platform.h>
31#include <sysdev/fsl_soc.h>
32#include <sysdev/fsl_pci.h>
Kyle Moffett582d3e02011-12-02 06:27:58 +000033#include "smp.h"
Kumar Galaab2f4892009-10-22 16:35:07 -050034
35void __init corenet_ds_pic_init(void)
36{
37 struct mpic *mpic;
Kyle Moffette55d7f72011-12-22 10:19:14 +000038 unsigned int flags = MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU |
39 MPIC_NO_RESET;
Kumar Galaab2f4892009-10-22 16:35:07 -050040
Kumar Galaab2f4892009-10-22 16:35:07 -050041 if (ppc_md.get_irq == mpic_get_coreint_irq)
42 flags |= MPIC_ENABLE_COREINT;
43
Kyle Moffett996983b2011-12-02 06:28:02 +000044 mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC ");
Kumar Galaab2f4892009-10-22 16:35:07 -050045 BUG_ON(mpic == NULL);
46
47 mpic_init(mpic);
48}
49
Kumar Galaab2f4892009-10-22 16:35:07 -050050/*
51 * Setup the architecture
52 */
Kumar Galaab2f4892009-10-22 16:35:07 -050053void __init corenet_ds_setup_arch(void)
54{
55#ifdef CONFIG_PCI
56 struct device_node *np;
57 struct pci_controller *hose;
58#endif
59 dma_addr_t max = 0xffffffff;
60
Kumar Galaab2f4892009-10-22 16:35:07 -050061 mpc85xx_smp_init();
Kumar Galaab2f4892009-10-22 16:35:07 -050062
63#ifdef CONFIG_PCI
Kumar Galab9a43342011-05-09 15:08:57 -050064 for_each_node_by_type(np, "pci") {
65 if (of_device_is_compatible(np, "fsl,p4080-pcie") ||
66 of_device_is_compatible(np, "fsl,qoriq-pcie-v2.2")) {
Kumar Galaab2f4892009-10-22 16:35:07 -050067 fsl_add_bridge(np, 0);
Kumar Galab9a43342011-05-09 15:08:57 -050068 hose = pci_find_hose_for_OF_device(np);
69 max = min(max, hose->dma_window_base_cur +
70 hose->dma_window_size);
71 }
Kumar Galaab2f4892009-10-22 16:35:07 -050072 }
Kumar Gala6d251dd2011-05-19 21:59:23 -050073
74#ifdef CONFIG_PPC64
75 pci_devs_phb_init();
76#endif
Kumar Galaab2f4892009-10-22 16:35:07 -050077#endif
78
79#ifdef CONFIG_SWIOTLB
Yinghai Lu95f72d12010-07-12 14:36:09 +100080 if (memblock_end_of_DRAM() > max) {
Kumar Galaab2f4892009-10-22 16:35:07 -050081 ppc_swiotlb_enable = 1;
82 set_pci_dma_ops(&swiotlb_dma_ops);
83 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
84 }
85#endif
86 pr_info("%s board from Freescale Semiconductor\n", ppc_md.name);
87}
88
89static const struct of_device_id of_device_ids[] __devinitconst = {
90 {
91 .compatible = "simple-bus"
92 },
93 {
Kai Jiang077200c2011-11-12 20:02:31 +080094 .compatible = "fsl,srio",
Kumar Galaab2f4892009-10-22 16:35:07 -050095 },
Kumar Galab9a43342011-05-09 15:08:57 -050096 {
97 .compatible = "fsl,p4080-pcie",
98 },
99 {
100 .compatible = "fsl,qoriq-pcie-v2.2",
101 },
Timur Tabi3907ab22011-05-19 08:54:30 -0500102 /* The following two are for the Freescale hypervisor */
103 {
104 .name = "hypervisor",
105 },
106 {
107 .name = "handles",
108 },
Kumar Galaab2f4892009-10-22 16:35:07 -0500109 {}
110};
111
112int __init corenet_ds_publish_devices(void)
113{
114 return of_platform_bus_probe(NULL, of_device_ids, NULL);
115}