2 * Copyright(c) 2015 EZchip Technologies.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
17 #ifndef _PLAT_EZNPS_MTM_H
18 #define _PLAT_EZNPS_MTM_H
20 #include <plat/ctop.h>
22 static inline void *nps_mtm_reg_addr(u32 cpu
, u32 reg
)
29 blkid
= (((core
& 0x0C) << 2) | (core
& 0x03));
31 return nps_host_reg(cpu
, blkid
, reg
);
34 #ifdef CONFIG_EZNPS_MTM_EXT
35 #define NPS_CPU_TO_THREAD_NUM(cpu) \
36 ({ struct global_id gid; gid.value = cpu; gid.thread; })
39 #define MTM_CFG(cpu) nps_mtm_reg_addr(cpu, 0x81)
40 #define MTM_THR_INIT(cpu) nps_mtm_reg_addr(cpu, 0x92)
41 #define MTM_THR_INIT_STS(cpu) nps_mtm_reg_addr(cpu, 0x93)
43 #define get_thread(map) map.thread
44 #define eznps_max_cpus 4096
45 #define eznps_cpus_per_cluster 256
47 void mtm_enable_core(unsigned int cpu
);
48 int mtm_enable_thread(int cpu
);
49 #else /* !CONFIG_EZNPS_MTM_EXT */
51 #define get_thread(map) 0
52 #define eznps_max_cpus 256
53 #define eznps_cpus_per_cluster 16
54 #define mtm_enable_core(cpu)
55 #define mtm_enable_thread(cpu) 1
56 #define NPS_CPU_TO_THREAD_NUM(cpu) 0
58 #endif /* CONFIG_EZNPS_MTM_EXT */
60 #endif /* _PLAT_EZNPS_MTM_H */