12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
277e03a22SKumar Gala /*
377e03a22SKumar Gala  * Based on MPC8560 ADS and arch/ppc stx_gp3 ports
477e03a22SKumar Gala  *
577e03a22SKumar Gala  * Maintained by Kumar Gala (see MAINTAINERS for contact information)
677e03a22SKumar Gala  *
777e03a22SKumar Gala  * Copyright 2008 Freescale Semiconductor Inc.
877e03a22SKumar Gala  *
977e03a22SKumar Gala  * Dan Malek <dan@embeddededge.com>
1077e03a22SKumar Gala  * Copyright 2004 Embedded Edge, LLC
1177e03a22SKumar Gala  *
1277e03a22SKumar Gala  * Copied from mpc8560_ads.c
1377e03a22SKumar Gala  * Copyright 2002, 2003 Motorola Inc.
1477e03a22SKumar Gala  *
1577e03a22SKumar Gala  * Ported to 2.6, Matt Porter <mporter@kernel.crashing.org>
1677e03a22SKumar Gala  * Copyright 2004-2005 MontaVista Software, Inc.
1777e03a22SKumar Gala  */
1877e03a22SKumar Gala 
1977e03a22SKumar Gala #include <linux/stddef.h>
2077e03a22SKumar Gala #include <linux/kernel.h>
2177e03a22SKumar Gala #include <linux/pci.h>
2277e03a22SKumar Gala #include <linux/kdev_t.h>
2377e03a22SKumar Gala #include <linux/delay.h>
2477e03a22SKumar Gala #include <linux/seq_file.h>
25*81d7cac4SRob Herring #include <linux/of.h>
2677e03a22SKumar Gala 
2777e03a22SKumar Gala #include <asm/time.h>
2877e03a22SKumar Gala #include <asm/machdep.h>
2977e03a22SKumar Gala #include <asm/pci-bridge.h>
3077e03a22SKumar Gala #include <asm/mpic.h>
3177e03a22SKumar Gala #include <mm/mmu_decl.h>
3277e03a22SKumar Gala #include <asm/udbg.h>
3377e03a22SKumar Gala 
3477e03a22SKumar Gala #include <sysdev/fsl_soc.h>
3577e03a22SKumar Gala #include <sysdev/fsl_pci.h>
3677e03a22SKumar Gala 
37543a07b1SDmitry Eremin-Solenikov #include "mpc85xx.h"
38543a07b1SDmitry Eremin-Solenikov 
3977e03a22SKumar Gala #ifdef CONFIG_CPM2
4077e03a22SKumar Gala #include <asm/cpm2.h>
4177e03a22SKumar Gala #endif /* CONFIG_CPM2 */
4277e03a22SKumar Gala 
stx_gp3_pic_init(void)4377e03a22SKumar Gala static void __init stx_gp3_pic_init(void)
4477e03a22SKumar Gala {
45e55d7f73SKyle Moffett 	struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
4677e03a22SKumar Gala 			0, 256, " OpenPIC  ");
4777e03a22SKumar Gala 	BUG_ON(mpic == NULL);
4877e03a22SKumar Gala 	mpic_init(mpic);
4977e03a22SKumar Gala 
50543a07b1SDmitry Eremin-Solenikov 	mpc85xx_cpm2_pic_init();
5177e03a22SKumar Gala }
5277e03a22SKumar Gala 
5377e03a22SKumar Gala /*
5477e03a22SKumar Gala  * Setup the architecture
5577e03a22SKumar Gala  */
stx_gp3_setup_arch(void)5677e03a22SKumar Gala static void __init stx_gp3_setup_arch(void)
5777e03a22SKumar Gala {
5877e03a22SKumar Gala 	if (ppc_md.progress)
5977e03a22SKumar Gala 		ppc_md.progress("stx_gp3_setup_arch()", 0);
6077e03a22SKumar Gala 
61905e75c4SJia Hongtao 	fsl_pci_assign_primary();
62905e75c4SJia Hongtao 
6377e03a22SKumar Gala #ifdef CONFIG_CPM2
6477e03a22SKumar Gala 	cpm2_reset();
6577e03a22SKumar Gala #endif
6677e03a22SKumar Gala }
6777e03a22SKumar Gala 
stx_gp3_show_cpuinfo(struct seq_file * m)6877e03a22SKumar Gala static void stx_gp3_show_cpuinfo(struct seq_file *m)
6977e03a22SKumar Gala {
7077e03a22SKumar Gala 	uint pvid, svid, phid1;
7177e03a22SKumar Gala 
7277e03a22SKumar Gala 	pvid = mfspr(SPRN_PVR);
7377e03a22SKumar Gala 	svid = mfspr(SPRN_SVR);
7477e03a22SKumar Gala 
7577e03a22SKumar Gala 	seq_printf(m, "Vendor\t\t: RPC Electronics STx\n");
7677e03a22SKumar Gala 	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
7777e03a22SKumar Gala 	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
7877e03a22SKumar Gala 
7977e03a22SKumar Gala 	/* Display cpu Pll setting */
8077e03a22SKumar Gala 	phid1 = mfspr(SPRN_HID1);
8177e03a22SKumar Gala 	seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
8277e03a22SKumar Gala }
8377e03a22SKumar Gala 
84905e75c4SJia Hongtao machine_arch_initcall(stx_gp3, mpc85xx_common_publish_devices);
8577e03a22SKumar Gala 
define_machine(stx_gp3)8677e03a22SKumar Gala define_machine(stx_gp3) {
8777e03a22SKumar Gala 	.name			= "STX GP3",
881c96fcdeSChristophe Leroy 	.compatible		= "stx,gp3-8560",
8977e03a22SKumar Gala 	.setup_arch		= stx_gp3_setup_arch,
9077e03a22SKumar Gala 	.init_IRQ		= stx_gp3_pic_init,
9177e03a22SKumar Gala 	.show_cpuinfo		= stx_gp3_show_cpuinfo,
9277e03a22SKumar Gala 	.get_irq		= mpic_get_irq,
9377e03a22SKumar Gala 	.progress		= udbg_progress,
9477e03a22SKumar Gala };
95