1 // SPDX-License-Identifier: GPL-2.0-only
3 * Pistachio platform setup
5 * Copyright (C) 2014 Google, Inc.
6 * Copyright (C) 2016 Imagination Technologies
9 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/of_address.h>
13 #include <linux/of_fdt.h>
15 #include <asm/cacheflush.h>
16 #include <asm/dma-coherence.h>
17 #include <asm/fw/fw.h>
18 #include <asm/mips-boards/generic.h>
19 #include <asm/mips-cps.h>
21 #include <asm/smp-ops.h>
22 #include <asm/traps.h>
25 * Core revision register decoding
26 * Bits 23 to 20: Major rev
27 * Bits 15 to 8: Minor rev
28 * Bits 7 to 0: Maintenance rev
30 #define PISTACHIO_CORE_REV_REG 0xB81483D0
31 #define PISTACHIO_CORE_REV_A1 0x00100006
32 #define PISTACHIO_CORE_REV_B0 0x00100106
34 const char *get_system_type(void)
39 core_rev
= __raw_readl((const void *)PISTACHIO_CORE_REV_REG
);
42 case PISTACHIO_CORE_REV_B0
:
43 sys_type
= "IMG Pistachio SoC (B0)";
46 case PISTACHIO_CORE_REV_A1
:
47 sys_type
= "IMG Pistachio SoC (A1)";
51 sys_type
= "IMG Pistachio SoC";
58 void __init
*plat_get_fdt(void)
61 panic("Device-tree not present");
62 return (void *)fw_arg1
;
65 void __init
plat_mem_setup(void)
67 __dt_setup_arch(plat_get_fdt());
70 #define DEFAULT_CPC_BASE_ADDR 0x1bde0000
71 #define DEFAULT_CDMM_BASE_ADDR 0x1bdd0000
73 phys_addr_t
mips_cpc_default_phys_base(void)
75 return DEFAULT_CPC_BASE_ADDR
;
78 phys_addr_t
mips_cdmm_phys_base(void)
80 return DEFAULT_CDMM_BASE_ADDR
;
83 static void __init
mips_nmi_setup(void)
86 extern char except_vec_nmi
[];
89 (void *)(CAC_BASE
+ 0xa80) :
90 (void *)(CAC_BASE
+ 0x380);
91 memcpy(base
, except_vec_nmi
, 0x80);
92 flush_icache_range((unsigned long)base
,
93 (unsigned long)base
+ 0x80);
96 static void __init
mips_ejtag_setup(void)
99 extern char except_vec_ejtag_debug
[];
101 base
= cpu_has_veic
?
102 (void *)(CAC_BASE
+ 0xa00) :
103 (void *)(CAC_BASE
+ 0x300);
104 memcpy(base
, except_vec_ejtag_debug
, 0x80);
105 flush_icache_range((unsigned long)base
,
106 (unsigned long)base
+ 0x80);
109 void __init
prom_init(void)
111 board_nmi_handler_setup
= mips_nmi_setup
;
112 board_ejtag_handler_setup
= mips_ejtag_setup
;
116 register_cps_smp_ops();
118 pr_info("SoC Type: %s\n", get_system_type());
121 void __init
prom_free_prom_memory(void)
125 void __init
device_tree_init(void)
127 if (!initial_boot_params
)
130 unflatten_and_copy_device_tree();