2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
9 #include <linux/init.h>
10 #include <linux/bootmem.h>
11 #include <linux/smp.h>
12 #include <asm/bootinfo.h>
13 #include <asm/bmips.h>
14 #include <asm/smp-ops.h>
15 #include <asm/mipsregs.h>
16 #include <bcm63xx_board.h>
17 #include <bcm63xx_cpu.h>
18 #include <bcm63xx_io.h>
19 #include <bcm63xx_regs.h>
20 #include <bcm63xx_gpio.h>
22 void __init
prom_init(void)
28 /* stop any running watchdog */
29 bcm_wdt_writel(WDT_STOP_1
, WDT_CTL_REG
);
30 bcm_wdt_writel(WDT_STOP_2
, WDT_CTL_REG
);
32 /* disable all hardware blocks clock for now */
34 mask
= CKCTL_3368_ALL_SAFE_EN
;
35 else if (BCMCPU_IS_6328())
36 mask
= CKCTL_6328_ALL_SAFE_EN
;
37 else if (BCMCPU_IS_6338())
38 mask
= CKCTL_6338_ALL_SAFE_EN
;
39 else if (BCMCPU_IS_6345())
40 mask
= CKCTL_6345_ALL_SAFE_EN
;
41 else if (BCMCPU_IS_6348())
42 mask
= CKCTL_6348_ALL_SAFE_EN
;
43 else if (BCMCPU_IS_6358())
44 mask
= CKCTL_6358_ALL_SAFE_EN
;
45 else if (BCMCPU_IS_6362())
46 mask
= CKCTL_6362_ALL_SAFE_EN
;
47 else if (BCMCPU_IS_6368())
48 mask
= CKCTL_6368_ALL_SAFE_EN
;
52 reg
= bcm_perf_readl(PERF_CKCTL_REG
);
54 bcm_perf_writel(reg
, PERF_CKCTL_REG
);
56 /* register gpiochip */
59 /* do low level board init */
62 if (IS_ENABLED(CONFIG_CPU_BMIPS4350
) && IS_ENABLED(CONFIG_SMP
)) {
64 register_smp_ops(&bmips_smp_ops
);
67 * BCM6328 might not have its second CPU enabled, while BCM6358
68 * needs special handling for its shared TLB, so disable SMP
71 if (BCMCPU_IS_6328()) {
72 reg
= bcm_readl(BCM_6328_OTP_BASE
+
73 OTP_USER_BITS_6328_REG(3));
75 if (reg
& OTP_6328_REG3_TP1_DISABLED
)
76 bmips_smp_enabled
= 0;
77 } else if (BCMCPU_IS_6358()) {
78 bmips_smp_enabled
= 0;
81 if (!bmips_smp_enabled
)
85 * The bootloader has set up the CPU1 reset vector at
87 * This conflicts with the special interrupt vector (IV).
88 * The bootloader has also set up CPU1 to respond to the wrong
90 * Here we will start up CPU1 in the background and ask it to
91 * reconfigure itself then go back to sleep.
93 memcpy((void *)0xa0000200, &bmips_smp_movevec
, 0x20);
96 cpumask_set_cpu(1, &bmips_booted_mask
);
99 * FIXME: we really should have some sort of hazard barrier here
104 void __init
prom_free_prom_memory(void)