2 * Pistachio platform setup
4 * Copyright (C) 2014 Google, Inc.
5 * Copyright (C) 2016 Imagination Technologies
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
12 #include <linux/init.h>
14 #include <linux/kernel.h>
15 #include <linux/of_address.h>
16 #include <linux/of_fdt.h>
18 #include <asm/cacheflush.h>
19 #include <asm/dma-coherence.h>
20 #include <asm/fw/fw.h>
21 #include <asm/mips-boards/generic.h>
22 #include <asm/mips-cm.h>
23 #include <asm/mips-cpc.h>
25 #include <asm/smp-ops.h>
26 #include <asm/traps.h>
29 * Core revision register decoding
30 * Bits 23 to 20: Major rev
31 * Bits 15 to 8: Minor rev
32 * Bits 7 to 0: Maintenance rev
34 #define PISTACHIO_CORE_REV_REG 0xB81483D0
35 #define PISTACHIO_CORE_REV_A1 0x00100006
36 #define PISTACHIO_CORE_REV_B0 0x00100106
38 const char *get_system_type(void)
43 core_rev
= __raw_readl((const void *)PISTACHIO_CORE_REV_REG
);
46 case PISTACHIO_CORE_REV_B0
:
47 sys_type
= "IMG Pistachio SoC (B0)";
50 case PISTACHIO_CORE_REV_A1
:
51 sys_type
= "IMG Pistachio SoC (A1)";
55 sys_type
= "IMG Pistachio SoC";
62 void __init
*plat_get_fdt(void)
65 panic("Device-tree not present");
66 return (void *)fw_arg1
;
69 void __init
plat_mem_setup(void)
71 __dt_setup_arch(plat_get_fdt());
74 #define DEFAULT_CPC_BASE_ADDR 0x1bde0000
75 #define DEFAULT_CDMM_BASE_ADDR 0x1bdd0000
77 phys_addr_t
mips_cpc_default_phys_base(void)
79 return DEFAULT_CPC_BASE_ADDR
;
82 phys_addr_t
mips_cdmm_phys_base(void)
84 return DEFAULT_CDMM_BASE_ADDR
;
87 static void __init
mips_nmi_setup(void)
90 extern char except_vec_nmi
;
93 (void *)(CAC_BASE
+ 0xa80) :
94 (void *)(CAC_BASE
+ 0x380);
95 memcpy(base
, &except_vec_nmi
, 0x80);
96 flush_icache_range((unsigned long)base
,
97 (unsigned long)base
+ 0x80);
100 static void __init
mips_ejtag_setup(void)
103 extern char except_vec_ejtag_debug
;
105 base
= cpu_has_veic
?
106 (void *)(CAC_BASE
+ 0xa00) :
107 (void *)(CAC_BASE
+ 0x300);
108 memcpy(base
, &except_vec_ejtag_debug
, 0x80);
109 flush_icache_range((unsigned long)base
,
110 (unsigned long)base
+ 0x80);
113 void __init
prom_init(void)
115 board_nmi_handler_setup
= mips_nmi_setup
;
116 board_ejtag_handler_setup
= mips_ejtag_setup
;
120 register_cps_smp_ops();
122 pr_info("SoC Type: %s\n", get_system_type());
125 void __init
prom_free_prom_memory(void)
129 void __init
device_tree_init(void)
131 if (!initial_boot_params
)
134 unflatten_and_copy_device_tree();