18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2007, 2008 Freescale Semiconductor, Inc. All rights reserved.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author: John Rigby, <jrigby@freescale.com>, Thur Mar 29 2007
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Description:
88c2ecf20Sopenharmony_ci * MPC5121 ADS board setup
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <linux/kernel.h>
128c2ecf20Sopenharmony_ci#include <linux/io.h>
138c2ecf20Sopenharmony_ci#include <linux/of_platform.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <asm/machdep.h>
168c2ecf20Sopenharmony_ci#include <asm/ipic.h>
178c2ecf20Sopenharmony_ci#include <asm/prom.h>
188c2ecf20Sopenharmony_ci#include <asm/time.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <sysdev/fsl_pci.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#include "mpc512x.h"
238c2ecf20Sopenharmony_ci#include "mpc5121_ads.h"
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistatic void __init mpc5121_ads_setup_arch(void)
268c2ecf20Sopenharmony_ci{
278c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI
288c2ecf20Sopenharmony_ci	struct device_node *np;
298c2ecf20Sopenharmony_ci#endif
308c2ecf20Sopenharmony_ci	printk(KERN_INFO "MPC5121 ADS board from Freescale Semiconductor\n");
318c2ecf20Sopenharmony_ci	/*
328c2ecf20Sopenharmony_ci	 * cpld regs are needed early
338c2ecf20Sopenharmony_ci	 */
348c2ecf20Sopenharmony_ci	mpc5121_ads_cpld_map();
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#ifdef CONFIG_PCI
378c2ecf20Sopenharmony_ci	for_each_compatible_node(np, "pci", "fsl,mpc5121-pci")
388c2ecf20Sopenharmony_ci		mpc83xx_add_bridge(np);
398c2ecf20Sopenharmony_ci#endif
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	mpc512x_setup_arch();
428c2ecf20Sopenharmony_ci}
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistatic void __init mpc5121_ads_init_IRQ(void)
458c2ecf20Sopenharmony_ci{
468c2ecf20Sopenharmony_ci	mpc512x_init_IRQ();
478c2ecf20Sopenharmony_ci	mpc5121_ads_cpld_pic_init();
488c2ecf20Sopenharmony_ci}
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/*
518c2ecf20Sopenharmony_ci * Called very early, MMU is off, device-tree isn't unflattened
528c2ecf20Sopenharmony_ci */
538c2ecf20Sopenharmony_cistatic int __init mpc5121_ads_probe(void)
548c2ecf20Sopenharmony_ci{
558c2ecf20Sopenharmony_ci	if (!of_machine_is_compatible("fsl,mpc5121ads"))
568c2ecf20Sopenharmony_ci		return 0;
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci	mpc512x_init_early();
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci	return 1;
618c2ecf20Sopenharmony_ci}
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_cidefine_machine(mpc5121_ads) {
648c2ecf20Sopenharmony_ci	.name			= "MPC5121 ADS",
658c2ecf20Sopenharmony_ci	.probe			= mpc5121_ads_probe,
668c2ecf20Sopenharmony_ci	.setup_arch		= mpc5121_ads_setup_arch,
678c2ecf20Sopenharmony_ci	.init			= mpc512x_init,
688c2ecf20Sopenharmony_ci	.init_IRQ		= mpc5121_ads_init_IRQ,
698c2ecf20Sopenharmony_ci	.get_irq		= ipic_get_irq,
708c2ecf20Sopenharmony_ci	.calibrate_decr		= generic_calibrate_decr,
718c2ecf20Sopenharmony_ci	.restart		= mpc512x_restart,
728c2ecf20Sopenharmony_ci};
73