blob: e0508002b0861437021443838bcda14be97c4e43 [file] [log] [blame]
Kumar Gala77e03a22008-01-23 23:42:44 -06001/*
2 * Based on MPC8560 ADS and arch/ppc stx_gp3 ports
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2008 Freescale Semiconductor Inc.
7 *
8 * Dan Malek <dan@embeddededge.com>
9 * Copyright 2004 Embedded Edge, LLC
10 *
11 * Copied from mpc8560_ads.c
12 * Copyright 2002, 2003 Motorola Inc.
13 *
14 * Ported to 2.6, Matt Porter <mporter@kernel.crashing.org>
15 * Copyright 2004-2005 MontaVista Software, Inc.
16 *
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2 of the License, or (at your
20 * option) any later version.
21 */
22
23#include <linux/stddef.h>
24#include <linux/kernel.h>
25#include <linux/pci.h>
26#include <linux/kdev_t.h>
27#include <linux/delay.h>
28#include <linux/seq_file.h>
29#include <linux/of_platform.h>
30
Kumar Gala77e03a22008-01-23 23:42:44 -060031#include <asm/time.h>
32#include <asm/machdep.h>
33#include <asm/pci-bridge.h>
34#include <asm/mpic.h>
35#include <asm/prom.h>
36#include <mm/mmu_decl.h>
37#include <asm/udbg.h>
38
39#include <sysdev/fsl_soc.h>
40#include <sysdev/fsl_pci.h>
41
Dmitry Eremin-Solenikov543a07b2011-11-17 21:56:16 +040042#include "mpc85xx.h"
43
Kumar Gala77e03a22008-01-23 23:42:44 -060044#ifdef CONFIG_CPM2
45#include <asm/cpm2.h>
Kumar Gala77e03a22008-01-23 23:42:44 -060046#endif /* CONFIG_CPM2 */
47
48static void __init stx_gp3_pic_init(void)
49{
Kyle Moffette55d7f72011-12-22 10:19:14 +000050 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
Kumar Gala77e03a22008-01-23 23:42:44 -060051 0, 256, " OpenPIC ");
52 BUG_ON(mpic == NULL);
Kumar Gala77e03a22008-01-23 23:42:44 -060053 mpic_init(mpic);
54
Dmitry Eremin-Solenikov543a07b2011-11-17 21:56:16 +040055 mpc85xx_cpm2_pic_init();
Kumar Gala77e03a22008-01-23 23:42:44 -060056}
57
58/*
59 * Setup the architecture
60 */
61static void __init stx_gp3_setup_arch(void)
62{
63#ifdef CONFIG_PCI
64 struct device_node *np;
65#endif
66
67 if (ppc_md.progress)
68 ppc_md.progress("stx_gp3_setup_arch()", 0);
69
70#ifdef CONFIG_CPM2
71 cpm2_reset();
72#endif
73
74#ifdef CONFIG_PCI
75 for_each_compatible_node(np, "pci", "fsl,mpc8540-pci")
76 fsl_add_bridge(np, 1);
77#endif
78}
79
80static void stx_gp3_show_cpuinfo(struct seq_file *m)
81{
82 uint pvid, svid, phid1;
Kumar Gala77e03a22008-01-23 23:42:44 -060083
84 pvid = mfspr(SPRN_PVR);
85 svid = mfspr(SPRN_SVR);
86
Frans Pop8354be92010-02-06 07:47:20 +000087 seq_printf(m, "Vendor\t\t: RPC Electronics STx\n");
Kumar Gala77e03a22008-01-23 23:42:44 -060088 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
89 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
90
91 /* Display cpu Pll setting */
92 phid1 = mfspr(SPRN_HID1);
93 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
Kumar Gala77e03a22008-01-23 23:42:44 -060094}
95
Dmitry Eremin-Solenikov46d026a2011-11-17 21:56:17 +040096machine_device_initcall(stx_gp3, mpc85xx_common_publish_devices);
Kumar Gala77e03a22008-01-23 23:42:44 -060097
98/*
99 * Called very early, device-tree isn't unflattened
100 */
101static int __init stx_gp3_probe(void)
102{
103 unsigned long root = of_get_flat_dt_root();
104
105 return of_flat_dt_is_compatible(root, "stx,gp3-8560");
106}
107
108define_machine(stx_gp3) {
109 .name = "STX GP3",
110 .probe = stx_gp3_probe,
111 .setup_arch = stx_gp3_setup_arch,
112 .init_IRQ = stx_gp3_pic_init,
113 .show_cpuinfo = stx_gp3_show_cpuinfo,
114 .get_irq = mpic_get_irq,
115 .restart = fsl_rstcr_restart,
116 .calibrate_decr = generic_calibrate_decr,
117 .progress = udbg_progress,
118};