mpc85xx: add support for OCEDO Panda
[openwrt/staging/wigyori.git] / target / linux / mpc85xx / files / arch / powerpc / platforms / 85xx / panda.c
1 // SPDX-License-Identifier: GPL-2.0+
2
3 /*
4 * OCEDO Panda Board Setup
5 *
6 * Copyright (C) 2019 David Bauer <mail@david-bauer.net>
7 *
8 * Based on:
9 * mpc85xx_rdb.c:
10 * MPC85xx RDB Board Setup
11 * Copyright 2013 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 #include "smp.h"
36
37 #include "mpc85xx.h"
38
39 void __init panda_pic_init(void)
40 {
41 struct mpic *mpic;
42
43 mpic = mpic_alloc(NULL, 0,
44 MPIC_BIG_ENDIAN |
45 MPIC_SINGLE_DEST_CPU,
46 0, 256, " OpenPIC ");
47
48 BUG_ON(mpic == NULL);
49 mpic_init(mpic);
50 }
51
52 /*
53 * Setup the architecture
54 */
55 static void __init panda_setup_arch(void)
56 {
57 if (ppc_md.progress)
58 ppc_md.progress("panda_setup_arch()", 0);
59
60 mpc85xx_smp_init();
61
62 fsl_pci_assign_primary();
63
64 pr_info("Panda board from OCEDO\n");
65 }
66
67 machine_arch_initcall(panda, mpc85xx_common_publish_devices);
68
69 /*
70 * Called very early, device-tree isn't unflattened
71 */
72 static int __init panda_probe(void)
73 {
74 if (of_machine_is_compatible("ocedo,panda"))
75 return 1;
76 return 0;
77 }
78
79 define_machine(panda) {
80 .name = "P1020 RDB",
81 .probe = panda_probe,
82 .setup_arch = panda_setup_arch,
83 .init_IRQ = panda_pic_init,
84 #ifdef CONFIG_PCI
85 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
86 .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
87 #endif
88 .get_irq = mpic_get_irq,
89 .calibrate_decr = generic_calibrate_decr,
90 .progress = udbg_progress,
91 };