xref: /openbmc/linux/arch/powerpc/platforms/44x/fsp2.c (revision 9c4c3746)
1 /*
2  * FSP-2 board specific routines
3  *
4  * Based on earlier code:
5  *    Matt Porter <mporter@kernel.crashing.org>
6  *    Copyright 2002-2005 MontaVista Software Inc.
7  *
8  *    Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
9  *    Copyright (c) 2003-2005 Zultys Technologies
10  *
11  *    Rewritten and ported to the merged powerpc tree:
12  *    Copyright 2007 David Gibson <dwg@au1.ibm.com>, IBM Corporation.
13  *
14  * This program is free software; you can redistribute  it and/or modify it
15  * under  the terms of  the GNU General  Public License as published by the
16  * Free Software Foundation;  either version 2 of the  License, or (at your
17  * option) any later version.
18  */
19 
20 #include <linux/init.h>
21 #include <linux/of_platform.h>
22 #include <linux/rtc.h>
23 
24 #include <asm/machdep.h>
25 #include <asm/prom.h>
26 #include <asm/udbg.h>
27 #include <asm/time.h>
28 #include <asm/uic.h>
29 #include <asm/ppc4xx.h>
30 #include <asm/dcr.h>
31 #include "fsp2.h"
32 
33 static __initdata struct of_device_id fsp2_of_bus[] = {
34 	{ .compatible = "ibm,plb4", },
35 	{ .compatible = "ibm,plb6", },
36 	{ .compatible = "ibm,opb", },
37 	{},
38 };
39 
40 static int __init fsp2_device_probe(void)
41 {
42 	of_platform_bus_probe(NULL, fsp2_of_bus, NULL);
43 	return 0;
44 }
45 machine_device_initcall(fsp2, fsp2_device_probe);
46 
47 static int __init fsp2_probe(void)
48 {
49 	u32 val;
50 	unsigned long root = of_get_flat_dt_root();
51 
52 	if (!of_flat_dt_is_compatible(root, "ibm,fsp2"))
53 		return 0;
54 
55 	/* Clear BC_ERR and mask snoopable request plb errors. */
56 	val = mfdcr(DCRN_PLB6_CR0);
57 	val |= 0x20000000;
58 	mtdcr(DCRN_PLB6_BASE, val);
59 	mtdcr(DCRN_PLB6_HD, 0xffff0000);
60 	mtdcr(DCRN_PLB6_SHD, 0xffff0000);
61 
62 	/* L2 machine checks */
63 	mtl2(L2PLBMCKEN0, 0xffffffff);
64 	mtl2(L2PLBMCKEN1, 0x0000ffff);
65 	mtl2(L2ARRMCKEN0, 0xffffffff);
66 	mtl2(L2ARRMCKEN1, 0xffffffff);
67 	mtl2(L2ARRMCKEN2, 0xfffff000);
68 	mtl2(L2CPUMCKEN,  0xffffffff);
69 	mtl2(L2RACMCKEN0, 0xffffffff);
70 	mtl2(L2WACMCKEN0, 0xffffffff);
71 	mtl2(L2WACMCKEN1, 0xffffffff);
72 	mtl2(L2WACMCKEN2, 0xffffffff);
73 	mtl2(L2WDFMCKEN,  0xffffffff);
74 
75 	/* L2 interrupts */
76 	mtl2(L2PLBINTEN1, 0xffff0000);
77 
78 	/*
79 	 * At a global level, enable all L2 machine checks and interrupts
80 	 * reported by the L2 subsystems, except for the external machine check
81 	 * input (UIC0.1).
82 	 */
83 	mtl2(L2MCKEN, 0x000007ff);
84 	mtl2(L2INTEN, 0x000004ff);
85 
86 	/* Enable FSP-2 configuration logic parity errors */
87 	mtdcr(DCRN_CONF_EIR_RS, 0x80000000);
88 	return 1;
89 }
90 
91 define_machine(fsp2) {
92 	.name			= "FSP-2",
93 	.probe			= fsp2_probe,
94 	.progress		= udbg_progress,
95 	.init_IRQ		= uic_init_tree,
96 	.get_irq		= uic_get_irq,
97 	.restart		= ppc4xx_reset_system,
98 	.calibrate_decr		= generic_calibrate_decr,
99 };
100