]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - arch/powerpc/platforms/85xx/mpc85xx_ads.c
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
[mirror_ubuntu-hirsute-kernel.git] / arch / powerpc / platforms / 85xx / mpc85xx_ads.c
CommitLineData
2874c5fd 1// SPDX-License-Identifier: GPL-2.0-or-later
63dafe57
BB
2/*
3 * MPC85xx setup and early boot code plus other random bits.
4 *
5 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
6 *
7 * Copyright 2005 Freescale Semiconductor Inc.
63dafe57
BB
8 */
9
63dafe57
BB
10#include <linux/stddef.h>
11#include <linux/kernel.h>
63dafe57
BB
12#include <linux/pci.h>
13#include <linux/kdev_t.h>
63dafe57 14#include <linux/delay.h>
63dafe57 15#include <linux/seq_file.h>
8abc8f5f 16#include <linux/of_platform.h>
63dafe57 17
63dafe57 18#include <asm/time.h>
63dafe57 19#include <asm/machdep.h>
63dafe57 20#include <asm/pci-bridge.h>
63dafe57
BB
21#include <asm/mpic.h>
22#include <mm/mmu_decl.h>
23#include <asm/udbg.h>
24
25#include <sysdev/fsl_soc.h>
3f6c5dae 26#include <sysdev/fsl_pci.h>
63dafe57 27
902f392d
VB
28#ifdef CONFIG_CPM2
29#include <asm/cpm2.h>
30#include <sysdev/cpm2_pic.h>
902f392d
VB
31#endif
32
543a07b1
DB
33#include "mpc85xx.h"
34
27630bec 35static void __init mpc85xx_ads_pic_init(void)
63dafe57 36{
e55d7f73 37 struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN,
b533f8ae 38 0, 256, " OpenPIC ");
4c86cd9c 39 BUG_ON(mpic == NULL);
4c86cd9c 40 mpic_init(mpic);
902f392d 41
543a07b1 42 mpc85xx_cpm2_pic_init();
63dafe57
BB
43}
44
63dafe57
BB
45/*
46 * Setup the architecture
47 */
902f392d 48#ifdef CONFIG_CPM2
8abc8f5f
SW
49struct cpm_pin {
50 int port, pin, flags;
51};
52
e5091842 53static const struct cpm_pin mpc8560_ads_pins[] = {
8abc8f5f
SW
54 /* SCC1 */
55 {3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
56 {3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
57 {3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
58
59 /* SCC2 */
2308c954
VB
60 {2, 12, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
61 {2, 13, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
8abc8f5f
SW
62 {3, 26, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
63 {3, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
64 {3, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
65
66 /* FCC2 */
67 {1, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
68 {1, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
69 {1, 20, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
70 {1, 21, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
71 {1, 22, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
72 {1, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
73 {1, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
74 {1, 25, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
75 {1, 26, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
76 {1, 27, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
77 {1, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
78 {1, 29, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
79 {1, 30, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
80 {1, 31, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
81 {2, 18, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK14 */
82 {2, 19, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK13 */
83
84 /* FCC3 */
85 {1, 4, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
86 {1, 5, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
87 {1, 6, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
8abc8f5f
SW
88 {1, 8, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
89 {1, 9, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
90 {1, 10, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
91 {1, 11, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
92 {1, 12, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
93 {1, 13, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
94 {1, 14, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
95 {1, 15, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
96 {1, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
97 {1, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
2308c954
VB
98 {2, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK16 */
99 {2, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* CLK15 */
100 {2, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
8abc8f5f
SW
101};
102
103static void __init init_ioports(void)
902f392d 104{
8abc8f5f
SW
105 int i;
106
107 for (i = 0; i < ARRAY_SIZE(mpc8560_ads_pins); i++) {
a5dc66e2 108 const struct cpm_pin *pin = &mpc8560_ads_pins[i];
8abc8f5f 109 cpm2_set_pin(pin->port, pin->pin, pin->flags);
d3465c92 110 }
902f392d 111
8abc8f5f
SW
112 cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_RX);
113 cpm2_clk_setup(CPM_CLK_SCC1, CPM_BRG1, CPM_CLK_TX);
114 cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_RX);
115 cpm2_clk_setup(CPM_CLK_SCC2, CPM_BRG2, CPM_CLK_TX);
116 cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK13, CPM_CLK_RX);
117 cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK14, CPM_CLK_TX);
118 cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK15, CPM_CLK_RX);
119 cpm2_clk_setup(CPM_CLK_FCC3, CPM_CLK16, CPM_CLK_TX);
902f392d
VB
120}
121#endif
122
fbc94e7c 123static void __init mpc85xx_ads_setup_arch(void)
63dafe57 124{
63dafe57
BB
125 if (ppc_md.progress)
126 ppc_md.progress("mpc85xx_ads_setup_arch()", 0);
127
902f392d
VB
128#ifdef CONFIG_CPM2
129 cpm2_reset();
8abc8f5f 130 init_ioports();
902f392d
VB
131#endif
132
905e75c4 133 fsl_pci_assign_primary();
63dafe57
BB
134}
135
27630bec 136static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
63dafe57
BB
137{
138 uint pvid, svid, phid1;
63dafe57
BB
139
140 pvid = mfspr(SPRN_PVR);
141 svid = mfspr(SPRN_SVR);
142
143 seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
63dafe57
BB
144 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
145 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
146
147 /* Display cpu Pll setting */
148 phid1 = mfspr(SPRN_HID1);
149 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
63dafe57
BB
150}
151
905e75c4 152machine_arch_initcall(mpc85xx_ads, mpc85xx_common_publish_devices);
8abc8f5f 153
72d2c3e0
KG
154/*
155 * Called very early, device-tree isn't unflattened
156 */
157static int __init mpc85xx_ads_probe(void)
63dafe57 158{
56571384 159 return of_machine_is_compatible("MPC85xxADS");
63dafe57 160}
72d2c3e0
KG
161
162define_machine(mpc85xx_ads) {
163 .name = "MPC85xx ADS",
164 .probe = mpc85xx_ads_probe,
165 .setup_arch = mpc85xx_ads_setup_arch,
166 .init_IRQ = mpc85xx_ads_pic_init,
167 .show_cpuinfo = mpc85xx_ads_show_cpuinfo,
168 .get_irq = mpic_get_irq,
72d2c3e0
KG
169 .calibrate_decr = generic_calibrate_decr,
170 .progress = udbg_progress,
171};