18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * C293PCIE Board Setup
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2013 Freescale Semiconductor Inc.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#include <linux/stddef.h>
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci#include <linux/of_fdt.h>
118c2ecf20Sopenharmony_ci#include <linux/of_platform.h>
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <asm/machdep.h>
148c2ecf20Sopenharmony_ci#include <asm/udbg.h>
158c2ecf20Sopenharmony_ci#include <asm/mpic.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include <sysdev/fsl_soc.h>
188c2ecf20Sopenharmony_ci#include <sysdev/fsl_pci.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include "mpc85xx.h"
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_civoid __init c293_pcie_pic_init(void)
238c2ecf20Sopenharmony_ci{
248c2ecf20Sopenharmony_ci	struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
258c2ecf20Sopenharmony_ci	  MPIC_SINGLE_DEST_CPU, 0, 256, " OpenPIC  ");
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	BUG_ON(mpic == NULL);
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci	mpic_init(mpic);
308c2ecf20Sopenharmony_ci}
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/*
348c2ecf20Sopenharmony_ci * Setup the architecture
358c2ecf20Sopenharmony_ci */
368c2ecf20Sopenharmony_cistatic void __init c293_pcie_setup_arch(void)
378c2ecf20Sopenharmony_ci{
388c2ecf20Sopenharmony_ci	if (ppc_md.progress)
398c2ecf20Sopenharmony_ci		ppc_md.progress("c293_pcie_setup_arch()", 0);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	fsl_pci_assign_primary();
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	printk(KERN_INFO "C293 PCIE board from Freescale Semiconductor\n");
448c2ecf20Sopenharmony_ci}
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_cimachine_arch_initcall(c293_pcie, mpc85xx_common_publish_devices);
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/*
498c2ecf20Sopenharmony_ci * Called very early, device-tree isn't unflattened
508c2ecf20Sopenharmony_ci */
518c2ecf20Sopenharmony_cistatic int __init c293_pcie_probe(void)
528c2ecf20Sopenharmony_ci{
538c2ecf20Sopenharmony_ci	if (of_machine_is_compatible("fsl,C293PCIE"))
548c2ecf20Sopenharmony_ci		return 1;
558c2ecf20Sopenharmony_ci	return 0;
568c2ecf20Sopenharmony_ci}
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cidefine_machine(c293_pcie) {
598c2ecf20Sopenharmony_ci	.name			= "C293 PCIE",
608c2ecf20Sopenharmony_ci	.probe			= c293_pcie_probe,
618c2ecf20Sopenharmony_ci	.setup_arch		= c293_pcie_setup_arch,
628c2ecf20Sopenharmony_ci	.init_IRQ		= c293_pcie_pic_init,
638c2ecf20Sopenharmony_ci	.get_irq		= mpic_get_irq,
648c2ecf20Sopenharmony_ci	.calibrate_decr		= generic_calibrate_decr,
658c2ecf20Sopenharmony_ci	.progress		= udbg_progress,
668c2ecf20Sopenharmony_ci};
67