mpc85xx: Add Aerohive HiveAP-330 Access Point
[openwrt/staging/hauke.git] / target / linux / mpc85xx / files / arch / powerpc / platforms / 85xx / hiveap-330.c
1 /*
2 * Aerohive HiveAP-330 Board Setup
3 *
4 * Copyright (C) 2017 Chris Blake <chrisrblake93@gmail.com>
5 *
6 * Based on:
7 * mpc85xx_rdb.c:
8 * MPC85xx RDB Board Setup
9 * Copyright 2013 Freescale Semiconductor Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16
17 #include <linux/stddef.h>
18 #include <linux/kernel.h>
19 #include <linux/delay.h>
20 #include <linux/interrupt.h>
21 #include <linux/of_platform.h>
22
23 #include <asm/time.h>
24 #include <asm/machdep.h>
25 #include <asm/pci-bridge.h>
26 #include <mm/mmu_decl.h>
27 #include <asm/prom.h>
28 #include <asm/udbg.h>
29 #include <asm/mpic.h>
30
31 #include <sysdev/fsl_soc.h>
32 #include <sysdev/fsl_pci.h>
33 #include "smp.h"
34
35 #include "mpc85xx.h"
36
37 void __init hiveap_330_pic_init(void)
38 {
39 struct mpic *mpic;
40
41 mpic = mpic_alloc(NULL, 0,
42 MPIC_BIG_ENDIAN |
43 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 hiveap_330_setup_arch(void)
54 {
55 if (ppc_md.progress)
56 ppc_md.progress("hiveap_330_setup_arch()", 0);
57
58 mpc85xx_smp_init();
59
60 fsl_pci_assign_primary();
61
62 printk(KERN_INFO "HiveAP-330 board from Aerohive\n");
63 }
64
65 machine_arch_initcall(hiveap_330, mpc85xx_common_publish_devices);
66
67 /*
68 * Called very early, device-tree isn't unflattened
69 */
70 static int __init hiveap_330_probe(void)
71 {
72 if (of_machine_is_compatible("aerohive,hiveap-330"))
73 return 1;
74 return 0;
75 }
76
77 define_machine(hiveap_330) {
78 .name = "P1020 RDB",
79 .probe = hiveap_330_probe,
80 .setup_arch = hiveap_330_setup_arch,
81 .init_IRQ = hiveap_330_pic_init,
82 #ifdef CONFIG_PCI
83 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
84 .pcibios_fixup_phb = fsl_pcibios_fixup_phb,
85 #endif
86 .get_irq = mpic_get_irq,
87 .calibrate_decr = generic_calibrate_decr,
88 .progress = udbg_progress,
89 };