1 /*****************************************************************************
2 * Copyright 2009 Broadcom Corporation. All rights reserved.
4 * Unless you and Broadcom execute a separate written software license
5 * agreement governing use of this software, this software is licensed to you
6 * under the terms of the GNU General Public License version 2, available at
7 * http://www.broadcom.com/licenses/GPLv2.php (the "GPL").
9 * Notwithstanding the above, under no circumstances may you combine this
10 * software in any way with any other Broadcom software provided under a
11 * license other than the GPL, without Broadcom's express prior written
13 *****************************************************************************/
18 /* ---- Include Files ---------------------------------------------------- */
19 #include <mach/csp/cap.h>
20 #include <cfg_global.h>
22 /* ---- Public Constants and Types --------------------------------------- */
23 #define CAP_CONFIG0_VPM_DIS 0x00000001
24 #define CAP_CONFIG0_ETH_PHY0_DIS 0x00000002
25 #define CAP_CONFIG0_ETH_PHY1_DIS 0x00000004
26 #define CAP_CONFIG0_ETH_GMII0_DIS 0x00000008
27 #define CAP_CONFIG0_ETH_GMII1_DIS 0x00000010
28 #define CAP_CONFIG0_ETH_SGMII0_DIS 0x00000020
29 #define CAP_CONFIG0_ETH_SGMII1_DIS 0x00000040
30 #define CAP_CONFIG0_USB0_DIS 0x00000080
31 #define CAP_CONFIG0_USB1_DIS 0x00000100
32 #define CAP_CONFIG0_TSC_DIS 0x00000200
33 #define CAP_CONFIG0_EHSS0_DIS 0x00000400
34 #define CAP_CONFIG0_EHSS1_DIS 0x00000800
35 #define CAP_CONFIG0_SDIO0_DIS 0x00001000
36 #define CAP_CONFIG0_SDIO1_DIS 0x00002000
37 #define CAP_CONFIG0_UARTB_DIS 0x00004000
38 #define CAP_CONFIG0_KEYPAD_DIS 0x00008000
39 #define CAP_CONFIG0_CLCD_DIS 0x00010000
40 #define CAP_CONFIG0_GE_DIS 0x00020000
41 #define CAP_CONFIG0_LEDM_DIS 0x00040000
42 #define CAP_CONFIG0_BBL_DIS 0x00080000
43 #define CAP_CONFIG0_VDEC_DIS 0x00100000
44 #define CAP_CONFIG0_PIF_DIS 0x00200000
45 #define CAP_CONFIG0_RESERVED1_DIS 0x00400000
46 #define CAP_CONFIG0_RESERVED2_DIS 0x00800000
48 #define CAP_CONFIG1_APMA_DIS 0x00000001
49 #define CAP_CONFIG1_APMB_DIS 0x00000002
50 #define CAP_CONFIG1_APMC_DIS 0x00000004
51 #define CAP_CONFIG1_CLCD_RES_MASK 0x00000600
52 #define CAP_CONFIG1_CLCD_RES_SHIFT 9
53 #define CAP_CONFIG1_CLCD_RES_WVGA (CAP_LCD_WVGA << CAP_CONFIG1_CLCD_RES_SHIFT)
54 #define CAP_CONFIG1_CLCD_RES_VGA (CAP_LCD_VGA << CAP_CONFIG1_CLCD_RES_SHIFT)
55 #define CAP_CONFIG1_CLCD_RES_WQVGA (CAP_LCD_WQVGA << CAP_CONFIG1_CLCD_RES_SHIFT)
56 #define CAP_CONFIG1_CLCD_RES_QVGA (CAP_LCD_QVGA << CAP_CONFIG1_CLCD_RES_SHIFT)
58 #define CAP_CONFIG2_SPU_DIS 0x00000010
59 #define CAP_CONFIG2_PKA_DIS 0x00000020
60 #define CAP_CONFIG2_RNG_DIS 0x00000080
62 #if (CFG_GLOBAL_CHIP == BCM11107)
64 #define capConfig1 CAP_CONFIG1_CLCD_RES_WVGA
66 #define CAP_APM_MAX_NUM_CHANS 3
67 #elif (CFG_GLOBAL_CHIP == FPGA11107)
69 #define capConfig1 CAP_CONFIG1_CLCD_RES_WVGA
71 #define CAP_APM_MAX_NUM_CHANS 3
72 #elif (CFG_GLOBAL_CHIP == BCM11109)
73 #define capConfig0 (CAP_CONFIG0_USB1_DIS | CAP_CONFIG0_EHSS1_DIS | CAP_CONFIG0_SDIO1_DIS | CAP_CONFIG0_GE_DIS | CAP_CONFIG0_BBL_DIS | CAP_CONFIG0_VDEC_DIS)
74 #define capConfig1 (CAP_CONFIG1_APMC_DIS | CAP_CONFIG1_CLCD_RES_WQVGA)
75 #define capConfig2 (CAP_CONFIG2_SPU_DIS | CAP_CONFIG2_PKA_DIS)
76 #define CAP_APM_MAX_NUM_CHANS 2
77 #elif (CFG_GLOBAL_CHIP == BCM11170)
78 #define capConfig0 (CAP_CONFIG0_ETH_GMII0_DIS | CAP_CONFIG0_ETH_GMII1_DIS | CAP_CONFIG0_USB0_DIS | CAP_CONFIG0_USB1_DIS | CAP_CONFIG0_TSC_DIS | CAP_CONFIG0_EHSS1_DIS | CAP_CONFIG0_SDIO0_DIS | CAP_CONFIG0_SDIO1_DIS | CAP_CONFIG0_UARTB_DIS | CAP_CONFIG0_CLCD_DIS | CAP_CONFIG0_GE_DIS | CAP_CONFIG0_BBL_DIS | CAP_CONFIG0_VDEC_DIS)
79 #define capConfig1 (CAP_CONFIG1_APMC_DIS | CAP_CONFIG1_CLCD_RES_WQVGA)
80 #define capConfig2 (CAP_CONFIG2_SPU_DIS | CAP_CONFIG2_PKA_DIS)
81 #define CAP_APM_MAX_NUM_CHANS 2
82 #elif (CFG_GLOBAL_CHIP == BCM11110)
83 #define capConfig0 (CAP_CONFIG0_USB1_DIS | CAP_CONFIG0_TSC_DIS | CAP_CONFIG0_EHSS1_DIS | CAP_CONFIG0_SDIO0_DIS | CAP_CONFIG0_SDIO1_DIS | CAP_CONFIG0_UARTB_DIS | CAP_CONFIG0_GE_DIS | CAP_CONFIG0_BBL_DIS | CAP_CONFIG0_VDEC_DIS)
84 #define capConfig1 CAP_CONFIG1_APMC_DIS
85 #define capConfig2 (CAP_CONFIG2_SPU_DIS | CAP_CONFIG2_PKA_DIS)
86 #define CAP_APM_MAX_NUM_CHANS 2
87 #elif (CFG_GLOBAL_CHIP == BCM11211)
88 #define capConfig0 (CAP_CONFIG0_ETH_PHY0_DIS | CAP_CONFIG0_ETH_GMII0_DIS | CAP_CONFIG0_ETH_GMII1_DIS | CAP_CONFIG0_ETH_SGMII0_DIS | CAP_CONFIG0_ETH_SGMII1_DIS | CAP_CONFIG0_CLCD_DIS)
89 #define capConfig1 CAP_CONFIG1_APMC_DIS
91 #define CAP_APM_MAX_NUM_CHANS 2
93 #error CFG_GLOBAL_CHIP type capabilities not defined
96 #if ((CFG_GLOBAL_CHIP == BCM11107) || (CFG_GLOBAL_CHIP == FPGA11107))
97 #define CAP_HW_CFG_ARM_CLK_HZ 500000000
98 #elif ((CFG_GLOBAL_CHIP == BCM11109) || (CFG_GLOBAL_CHIP == BCM11170) || (CFG_GLOBAL_CHIP == BCM11110))
99 #define CAP_HW_CFG_ARM_CLK_HZ 300000000
100 #elif (CFG_GLOBAL_CHIP == BCM11211)
101 #define CAP_HW_CFG_ARM_CLK_HZ 666666666
103 #error CFG_GLOBAL_CHIP type capabilities not defined
106 #if ((CFG_GLOBAL_CHIP == BCM11107) || (CFG_GLOBAL_CHIP == BCM11211) || (CFG_GLOBAL_CHIP == FPGA11107))
107 #define CAP_HW_CFG_VPM_CLK_HZ 333333333
108 #elif ((CFG_GLOBAL_CHIP == BCM11109) || (CFG_GLOBAL_CHIP == BCM11170) || (CFG_GLOBAL_CHIP == BCM11110))
109 #define CAP_HW_CFG_VPM_CLK_HZ 200000000
111 #error CFG_GLOBAL_CHIP type capabilities not defined
114 /* ---- Public Variable Externs ------------------------------------------ */
115 /* ---- Public Function Prototypes --------------------------------------- */
117 /****************************************************************************
121 * Determines if the chip has a certain capability present
124 * capability - type of capability to determine if present
127 * CAP_PRESENT or CAP_NOT_PRESENT
128 ****************************************************************************/
129 static inline CAP_RC_T
cap_isPresent(CAP_CAPABILITY_T capability
, int index
)
131 CAP_RC_T returnVal
= CAP_NOT_PRESENT
;
133 switch (capability
) {
136 if (!(capConfig0
& CAP_CONFIG0_VPM_DIS
)) {
137 returnVal
= CAP_PRESENT
;
145 && (!(capConfig0
& CAP_CONFIG0_ETH_PHY0_DIS
))) {
146 returnVal
= CAP_PRESENT
;
149 && (!(capConfig0
& CAP_CONFIG0_ETH_PHY1_DIS
))) {
150 returnVal
= CAP_PRESENT
;
158 && (!(capConfig0
& CAP_CONFIG0_ETH_GMII0_DIS
))) {
159 returnVal
= CAP_PRESENT
;
162 && (!(capConfig0
& CAP_CONFIG0_ETH_GMII1_DIS
))) {
163 returnVal
= CAP_PRESENT
;
171 && (!(capConfig0
& CAP_CONFIG0_ETH_SGMII0_DIS
))) {
172 returnVal
= CAP_PRESENT
;
175 && (!(capConfig0
& CAP_CONFIG0_ETH_SGMII1_DIS
))) {
176 returnVal
= CAP_PRESENT
;
184 && (!(capConfig0
& CAP_CONFIG0_USB0_DIS
))) {
185 returnVal
= CAP_PRESENT
;
188 && (!(capConfig0
& CAP_CONFIG0_USB1_DIS
))) {
189 returnVal
= CAP_PRESENT
;
196 if (!(capConfig0
& CAP_CONFIG0_TSC_DIS
)) {
197 returnVal
= CAP_PRESENT
;
205 && (!(capConfig0
& CAP_CONFIG0_EHSS0_DIS
))) {
206 returnVal
= CAP_PRESENT
;
209 && (!(capConfig0
& CAP_CONFIG0_EHSS1_DIS
))) {
210 returnVal
= CAP_PRESENT
;
218 && (!(capConfig0
& CAP_CONFIG0_SDIO0_DIS
))) {
219 returnVal
= CAP_PRESENT
;
222 && (!(capConfig0
& CAP_CONFIG0_SDIO1_DIS
))) {
223 returnVal
= CAP_PRESENT
;
230 if (!(capConfig0
& CAP_CONFIG0_UARTB_DIS
)) {
231 returnVal
= CAP_PRESENT
;
238 if (!(capConfig0
& CAP_CONFIG0_KEYPAD_DIS
)) {
239 returnVal
= CAP_PRESENT
;
246 if (!(capConfig0
& CAP_CONFIG0_CLCD_DIS
)) {
247 returnVal
= CAP_PRESENT
;
254 if (!(capConfig0
& CAP_CONFIG0_GE_DIS
)) {
255 returnVal
= CAP_PRESENT
;
262 if (!(capConfig0
& CAP_CONFIG0_LEDM_DIS
)) {
263 returnVal
= CAP_PRESENT
;
270 if (!(capConfig0
& CAP_CONFIG0_BBL_DIS
)) {
271 returnVal
= CAP_PRESENT
;
278 if (!(capConfig0
& CAP_CONFIG0_VDEC_DIS
)) {
279 returnVal
= CAP_PRESENT
;
286 if (!(capConfig0
& CAP_CONFIG0_PIF_DIS
)) {
287 returnVal
= CAP_PRESENT
;
295 && (!(capConfig1
& CAP_CONFIG1_APMA_DIS
))) {
296 returnVal
= CAP_PRESENT
;
299 && (!(capConfig1
& CAP_CONFIG1_APMB_DIS
))) {
300 returnVal
= CAP_PRESENT
;
303 && (!(capConfig1
& CAP_CONFIG1_APMC_DIS
))) {
304 returnVal
= CAP_PRESENT
;
311 if (!(capConfig2
& CAP_CONFIG2_SPU_DIS
)) {
312 returnVal
= CAP_PRESENT
;
319 if (!(capConfig2
& CAP_CONFIG2_PKA_DIS
)) {
320 returnVal
= CAP_PRESENT
;
327 if (!(capConfig2
& CAP_CONFIG2_RNG_DIS
)) {
328 returnVal
= CAP_PRESENT
;
341 /****************************************************************************
342 * cap_getMaxArmSpeedHz -
345 * Determines the maximum speed of the ARM CPU
351 * clock speed in Hz that the ARM processor is able to run at
352 ****************************************************************************/
353 static inline uint32_t cap_getMaxArmSpeedHz(void)
355 #if ((CFG_GLOBAL_CHIP == BCM11107) || (CFG_GLOBAL_CHIP == FPGA11107))
357 #elif ((CFG_GLOBAL_CHIP == BCM11109) || (CFG_GLOBAL_CHIP == BCM11170) || (CFG_GLOBAL_CHIP == BCM11110))
359 #elif (CFG_GLOBAL_CHIP == BCM11211)
362 #error CFG_GLOBAL_CHIP type capabilities not defined
366 /****************************************************************************
367 * cap_getMaxVpmSpeedHz -
370 * Determines the maximum speed of the VPM
376 * clock speed in Hz that the VPM is able to run at
377 ****************************************************************************/
378 static inline uint32_t cap_getMaxVpmSpeedHz(void)
380 #if ((CFG_GLOBAL_CHIP == BCM11107) || (CFG_GLOBAL_CHIP == BCM11211) || (CFG_GLOBAL_CHIP == FPGA11107))
382 #elif ((CFG_GLOBAL_CHIP == BCM11109) || (CFG_GLOBAL_CHIP == BCM11170) || (CFG_GLOBAL_CHIP == BCM11110))
385 #error CFG_GLOBAL_CHIP type capabilities not defined
389 /****************************************************************************
393 * Determines the maximum LCD resolution capabilities
399 * CAP_LCD_WVGA, CAP_LCD_VGA, CAP_LCD_WQVGA or CAP_LCD_QVGA
401 ****************************************************************************/
402 static inline CAP_LCD_RES_T
cap_getMaxLcdRes(void)
404 return (CAP_LCD_RES_T
)
405 ((capConfig1
& CAP_CONFIG1_CLCD_RES_MASK
) >>
406 CAP_CONFIG1_CLCD_RES_SHIFT
);