mpc85xx: add support for Watchguard Firebox T10
[openwrt/staging/jow.git] / target / linux / mpc85xx / files / arch / powerpc / platforms / 85xx / firebox_t10.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2
3 /*
4 * Watchguard Firebox T10 Board Setup
5 *
6 * Copyright (C) 2023 David Bauer <mail@david-bauer.net>
7 *
8 * Based on:
9 * p1010rdb.c:
10 * P1010 RDB Board Setup
11 * Copyright 2011 Freescale Semiconductor Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19 #include <linux/stddef.h>
20 #include <linux/kernel.h>
21 #include <linux/delay.h>
22 #include <linux/interrupt.h>
23 #include <linux/of_platform.h>
24
25 #include <asm/time.h>
26 #include <asm/machdep.h>
27 #include <asm/pci-bridge.h>
28 #include <mm/mmu_decl.h>
29 #include <asm/prom.h>
30 #include <asm/udbg.h>
31 #include <asm/mpic.h>
32
33 #include <sysdev/fsl_soc.h>
34 #include <sysdev/fsl_pci.h>
35
36 #include "mpc85xx.h"
37
38 void __init firebox_t10_pic_init(void)
39 {
40 struct mpic *mpic;
41
42 mpic = mpic_alloc(NULL, 0,
43 MPIC_BIG_ENDIAN | MPIC_SINGLE_DEST_CPU,
44 0, 256, " OpenPIC ");
45
46 BUG_ON(mpic == NULL);
47 mpic_init(mpic);
48 }
49
50 /*
51 * Setup the architecture
52 */
53 static void __init firebox_t10_setup_arch(void)
54 {
55 if (ppc_md.progress)
56 ppc_md.progress("firebox_t10_setup_arch()", 0);
57
58 fsl_pci_assign_primary();
59
60 pr_info("Firebox T10 from Watchguard\n");
61 }
62
63 machine_arch_initcall(firebox_t10, mpc85xx_common_publish_devices);
64
65 /*
66 * Called very early, device-tree isn't unflattened
67 */
68 static int __init firebox_t10_probe(void)
69 {
70 if (of_machine_is_compatible("watchguard,firebox-t10"))
71 return 1;
72 return 0;
73 }
74
75 define_machine(firebox_t10) {
76 .name = "P1010 RDB",
77 .probe = firebox_t10_probe,
78 .setup_arch = firebox_t10_setup_arch,
79 .init_IRQ = firebox_t10_pic_init,
80 #ifdef CONFIG_PCI
81 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
82 .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
83 #endif
84 .get_irq = mpic_get_irq,
85 .calibrate_decr = generic_calibrate_decr,
86 .progress = udbg_progress,
87 };