Add Broadcom's code for bcm63xx support
[project/bcm63xx/atf.git] / plat / bcm / include / pmc_drv_special.h
1 /*
2 <:copyright-BRCM:2019:DUAL/GPL:standard
3
4 Copyright (c) 2019 Broadcom
5 All Rights Reserved
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License, version 2, as published by
9 the Free Software Foundation (the "GPL").
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16
17 A copy of the GPL is available at http://www.broadcom.com/licenses/GPLv2.php, or by
18 writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.
20
21 :>
22 */
23
24 /*****************************************************************************
25 * Description:
26 * This contains special header for different flavors of PMC drivers.
27 *****************************************************************************/
28
29 #ifndef PMC_DRV_SPECIAL_H__
30 #define PMC_DRV_SPECIAL_H__
31
32 #if defined(__KERNEL__) || defined(_ATF_)
33 #define CFG_RAMAPP
34 #endif
35
36 #include "bcm_map_part.h"
37 #include "bcm_mem_reserve.h"
38
39 #ifndef IS_BCMCHIP
40 #define IS_BCMCHIP(num) (defined(_BCM9##num##_) || \
41 defined(CONFIG_BCM9##num) || defined(CONFIG_BCM##num))
42 #endif
43
44 #if IS_BCMCHIP(63138)
45 #include "pmc_addr_63138.h"
46 #elif IS_BCMCHIP(63148)
47 #include "pmc_addr_63148.h"
48 #elif IS_BCMCHIP(6858)
49 #include "pmc_addr_6858.h"
50 #elif IS_BCMCHIP(6846)
51 #include "pmc_addr_6846.h"
52 #elif IS_BCMCHIP(6878)
53 #include "pmc_addr_6878.h"
54 #elif IS_BCMCHIP(4908)
55 #include "pmc_addr_4908.h"
56 #elif IS_BCMCHIP(63158)
57 #include "pmc_addr_63158.h"
58 #elif IS_BCMCHIP(63178)
59 #include "pmc_addr_63178.h"
60 #elif IS_BCMCHIP(47622)
61 #include "pmc_addr_47622.h"
62 #elif IS_BCMCHIP(6856)
63 #include "pmc_addr_6856.h"
64 #elif IS_BCMCHIP(63146)
65 #include "pmc_addr_63146.h"
66 #elif IS_BCMCHIP(4912)
67 #include "pmc_addr_4912.h"
68 #elif IS_BCMCHIP(6855)
69 #include "pmc_addr_6855.h"
70 #elif IS_BCMCHIP(6756)
71 #include "pmc_addr_6756.h"
72 #endif
73
74 #ifndef __ASSEMBLER__
75 #if defined(_CFE_) && !defined(_ATF_)
76 #include "lib_printf.h"
77 #include "lib_types.h"
78 #include "lib_string.h"
79 #include "cfe_iocb.h"
80 #include "bsp_config.h"
81 #include "bcm63xx_util.h"
82 #include "shared_utils.h"
83
84 #define MAX_PMC_ROM_SIZE 0x8000
85 #define MAX_PMC_LOG_SIZE 0x8000
86
87 #if defined(_BCM963158_) && !defined(CONFIG_BRCM_IKOS)
88 #define PMC_SHARED_MEMORY 0x80204000
89
90 #if MAX_PMC_ROM_SIZE + MAX_PMC_LOG_SIZE > CFG_BOOT_PMC_SIZE
91 #error ROM and LOG buffer size needs to be re-adjusted
92 #endif
93 #endif /* _BCM963158_ */
94
95 extern void _cfe_flushcache(int, uint8_t *, uint8_t *);
96 extern int getAVSConfig(void);
97 #define is_pmcfw_code_loaded(void) (0)
98 #define is_pmcfw_data_loaded(void) (0)
99 #endif /* _CFE_ */
100
101 #ifdef __KERNEL__
102 #include <linux/module.h>
103 #include <linux/delay.h>
104 void pmc_spin_lock(void);
105 void pmc_spin_unlock(void);
106 #if defined(CONFIG_BCM96878) || defined(CONFIG_BCM96855)
107 void keyhole_spin_lock(void);
108 void keyhole_spin_unlock(void);
109 #endif
110 #else // #ifdef __KERNEL__
111 #ifndef EXPORT_SYMBOL
112 #define EXPORT_SYMBOL(a)
113 #endif
114 #define pmc_spin_lock(...) do { } while (0)
115 #define pmc_spin_unlock(...) do { } while (0)
116 #if defined(CONFIG_BCM96878) || defined(CONFIG_BCM96855)
117 #define keyhole_spin_lock(...) do { } while (0)
118 #define keyhole_spin_unlock(...) do { } while (0)
119 #endif
120 #define printk printf
121
122 #ifndef phys_to_virt
123 #define phys_to_virt(a) (a)
124 #endif
125 #endif // #ifdef __KERNEL__
126 #endif // #ifndef __ASSEMBLER__
127
128 #endif // #ifndef PMC_DRV_SPECIAL_H__