18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Generic PowerPC 44x 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 ppc44x_of_bus[] __initconst = {
258c2ecf20Sopenharmony_ci	{ .compatible = "ibm,plb4", },
268c2ecf20Sopenharmony_ci	{ .compatible = "ibm,opb", },
278c2ecf20Sopenharmony_ci	{ .compatible = "ibm,ebc", },
288c2ecf20Sopenharmony_ci	{ .compatible = "simple-bus", },
298c2ecf20Sopenharmony_ci	{},
308c2ecf20Sopenharmony_ci};
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_cistatic int __init ppc44x_device_probe(void)
338c2ecf20Sopenharmony_ci{
348c2ecf20Sopenharmony_ci	of_platform_bus_probe(NULL, ppc44x_of_bus, NULL);
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci	return 0;
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_cimachine_device_initcall(ppc44x_simple, ppc44x_device_probe);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* This is the list of boards that can be supported by this simple
418c2ecf20Sopenharmony_ci * platform code.  This does _not_ mean the boards are compatible,
428c2ecf20Sopenharmony_ci * as they most certainly are not from a device tree perspective.
438c2ecf20Sopenharmony_ci * However, their differences are handled by the device tree and the
448c2ecf20Sopenharmony_ci * drivers and therefore they don't need custom board support files.
458c2ecf20Sopenharmony_ci *
468c2ecf20Sopenharmony_ci * Again, if your board needs to do things differently then create a
478c2ecf20Sopenharmony_ci * board.c file for it rather than adding it to this list.
488c2ecf20Sopenharmony_ci */
498c2ecf20Sopenharmony_cistatic char *board[] __initdata = {
508c2ecf20Sopenharmony_ci	"amcc,arches",
518c2ecf20Sopenharmony_ci	"amcc,bamboo",
528c2ecf20Sopenharmony_ci	"apm,bluestone",
538c2ecf20Sopenharmony_ci	"amcc,glacier",
548c2ecf20Sopenharmony_ci	"ibm,ebony",
558c2ecf20Sopenharmony_ci	"amcc,eiger",
568c2ecf20Sopenharmony_ci	"amcc,katmai",
578c2ecf20Sopenharmony_ci	"amcc,rainier",
588c2ecf20Sopenharmony_ci	"amcc,redwood",
598c2ecf20Sopenharmony_ci	"amcc,sequoia",
608c2ecf20Sopenharmony_ci	"amcc,taishan",
618c2ecf20Sopenharmony_ci	"amcc,yosemite",
628c2ecf20Sopenharmony_ci	"mosaixtech,icon"
638c2ecf20Sopenharmony_ci};
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_cistatic int __init ppc44x_probe(void)
668c2ecf20Sopenharmony_ci{
678c2ecf20Sopenharmony_ci	int i = 0;
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	for (i = 0; i < ARRAY_SIZE(board); i++) {
708c2ecf20Sopenharmony_ci		if (of_machine_is_compatible(board[i])) {
718c2ecf20Sopenharmony_ci			pci_set_flags(PCI_REASSIGN_ALL_RSRC);
728c2ecf20Sopenharmony_ci			return 1;
738c2ecf20Sopenharmony_ci		}
748c2ecf20Sopenharmony_ci	}
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci	return 0;
778c2ecf20Sopenharmony_ci}
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_cidefine_machine(ppc44x_simple) {
808c2ecf20Sopenharmony_ci	.name = "PowerPC 44x Platform",
818c2ecf20Sopenharmony_ci	.probe = ppc44x_probe,
828c2ecf20Sopenharmony_ci	.progress = udbg_progress,
838c2ecf20Sopenharmony_ci	.init_IRQ = uic_init_tree,
848c2ecf20Sopenharmony_ci	.get_irq = uic_get_irq,
858c2ecf20Sopenharmony_ci	.restart = ppc4xx_reset_system,
868c2ecf20Sopenharmony_ci	.calibrate_decr = generic_calibrate_decr,
878c2ecf20Sopenharmony_ci};
88