18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Generic PowerPC 40x platform support
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2008 IBM Corporation
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * This implements simple platform support for PowerPC 44x chips.  This is
88c2ecf20Sopenharmony_ci * mostly used for eval boards or other simple and "generic" 44x boards.  If
98c2ecf20Sopenharmony_ci * your board has custom functions or hardware, then you will likely want to
108c2ecf20Sopenharmony_ci * implement your own board.c file to accommodate it.
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <asm/machdep.h>
148c2ecf20Sopenharmony_ci#include <asm/pci-bridge.h>
158c2ecf20Sopenharmony_ci#include <asm/ppc4xx.h>
168c2ecf20Sopenharmony_ci#include <asm/prom.h>
178c2ecf20Sopenharmony_ci#include <asm/time.h>
188c2ecf20Sopenharmony_ci#include <asm/udbg.h>
198c2ecf20Sopenharmony_ci#include <asm/uic.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#include <linux/init.h>
228c2ecf20Sopenharmony_ci#include <linux/of_platform.h>
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistatic const struct of_device_id ppc40x_of_bus[] __initconst = {
258c2ecf20Sopenharmony_ci	{ .compatible = "ibm,plb3", },
268c2ecf20Sopenharmony_ci	{ .compatible = "ibm,plb4", },
278c2ecf20Sopenharmony_ci	{ .compatible = "ibm,opb", },
288c2ecf20Sopenharmony_ci	{ .compatible = "ibm,ebc", },
298c2ecf20Sopenharmony_ci	{ .compatible = "simple-bus", },
308c2ecf20Sopenharmony_ci	{},
318c2ecf20Sopenharmony_ci};
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cistatic int __init ppc40x_device_probe(void)
348c2ecf20Sopenharmony_ci{
358c2ecf20Sopenharmony_ci	of_platform_bus_probe(NULL, ppc40x_of_bus, NULL);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	return 0;
388c2ecf20Sopenharmony_ci}
398c2ecf20Sopenharmony_cimachine_device_initcall(ppc40x_simple, ppc40x_device_probe);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* This is the list of boards that can be supported by this simple
428c2ecf20Sopenharmony_ci * platform code.  This does _not_ mean the boards are compatible,
438c2ecf20Sopenharmony_ci * as they most certainly are not from a device tree perspective.
448c2ecf20Sopenharmony_ci * However, their differences are handled by the device tree and the
458c2ecf20Sopenharmony_ci * drivers and therefore they don't need custom board support files.
468c2ecf20Sopenharmony_ci *
478c2ecf20Sopenharmony_ci * Again, if your board needs to do things differently then create a
488c2ecf20Sopenharmony_ci * board.c file for it rather than adding it to this list.
498c2ecf20Sopenharmony_ci */
508c2ecf20Sopenharmony_cistatic const char * const board[] __initconst = {
518c2ecf20Sopenharmony_ci	"amcc,acadia",
528c2ecf20Sopenharmony_ci	"amcc,haleakala",
538c2ecf20Sopenharmony_ci	"amcc,kilauea",
548c2ecf20Sopenharmony_ci	"amcc,makalu",
558c2ecf20Sopenharmony_ci	"apm,klondike",
568c2ecf20Sopenharmony_ci	"est,hotfoot",
578c2ecf20Sopenharmony_ci	"plathome,obs600",
588c2ecf20Sopenharmony_ci	NULL
598c2ecf20Sopenharmony_ci};
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_cistatic int __init ppc40x_probe(void)
628c2ecf20Sopenharmony_ci{
638c2ecf20Sopenharmony_ci	if (of_device_compatible_match(of_root, board)) {
648c2ecf20Sopenharmony_ci		pci_set_flags(PCI_REASSIGN_ALL_RSRC);
658c2ecf20Sopenharmony_ci		return 1;
668c2ecf20Sopenharmony_ci	}
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci	return 0;
698c2ecf20Sopenharmony_ci}
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cidefine_machine(ppc40x_simple) {
728c2ecf20Sopenharmony_ci	.name = "PowerPC 40x Platform",
738c2ecf20Sopenharmony_ci	.probe = ppc40x_probe,
748c2ecf20Sopenharmony_ci	.progress = udbg_progress,
758c2ecf20Sopenharmony_ci	.init_IRQ = uic_init_tree,
768c2ecf20Sopenharmony_ci	.get_irq = uic_get_irq,
778c2ecf20Sopenharmony_ci	.restart = ppc4xx_reset_system,
788c2ecf20Sopenharmony_ci	.calibrate_decr = generic_calibrate_decr,
798c2ecf20Sopenharmony_ci};
80