blob: 02d528b9f071bd6e3fea0636bda732ee0db9509f [file] [log] [blame]
Sheetal Tigadoliad0943e2019-12-18 19:44:43 +05301/*
2 * Copyright (c) 2016 - 2020, Broadcom
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef SR_CHIMP_H
8#define SR_CHIMP_H
9
10#include <common/bl_common.h>
11#include <common/debug.h>
12#include <lib/mmio.h>
13
14#include <platform_def.h>
15
16#define CHIMP_WINDOW_SIZE 0x400000
17#define CHIMP_ERROR_OFFSET 28
18#define CHIMP_ERROR_MASK 0xf0000000
19
20#ifndef EMULATION_SETUP
21#define CHIMP_HANDSHAKE_TIMEOUT_MS 10000
22#else
23/*
24 * 1hr timeout for test in emulator
25 * By doing this ChiMP is given a chance to boot
26 * fully from the QSPI
27 * (on Palladium this takes upto 50 min depending on QSPI clk)
28 */
29
30#define CHIMP_HANDSHAKE_TIMEOUT_MS 3600000
31#endif
32
33#define CHIMP_BPE_MODE_ID_PATTERN (0x25000000)
34#define CHIMP_BPE_MODE_ID_MASK (0x7f000000)
35#define NIC_RESET_RELEASE_TIMEOUT_US (10)
36
37/* written by M0, used by ChiMP ROM */
38#define SR_IN_SMARTNIC_MODE_BIT 0
39/* written by M0, used by ChiMP ROM */
40#define SR_CHIMP_SECURE_BOOT_BIT 1
41/* cleared by AP, set by ChiMP BC2 code */
42#define SR_FLASH_ACCESS_DONE_BIT 2
43
44#ifdef USE_CHIMP
45void bcm_chimp_write(uintptr_t addr, uint32_t value);
46uint32_t bcm_chimp_read(uintptr_t addr);
47uint32_t bcm_chimp_read_ctrl(uint32_t offset);
48void bcm_chimp_clrbits(uintptr_t addr, uint32_t bits);
49void bcm_chimp_setbits(uintptr_t addr, uint32_t bits);
50int bcm_chimp_is_nic_mode(void);
51void bcm_chimp_fru_prog_done(bool status);
52int bcm_chimp_handshake_done(void);
53int bcm_chimp_wait_handshake(void);
54/* Fastboot-related*/
55int bcm_chimp_initiate_fastboot(int fastboot_type);
56#else
57static inline void bcm_chimp_write(uintptr_t addr, uint32_t value)
58{
59}
60static inline uint32_t bcm_chimp_read(uintptr_t addr)
61{
62 return 0;
63}
64static inline uint32_t bcm_chimp_read_ctrl(uint32_t offset)
65{
66 return 0;
67}
68static inline void bcm_chimp_clrbits(uintptr_t addr, uint32_t bits)
69{
70}
71static inline void bcm_chimp_setbits(uintptr_t addr, uint32_t bits)
72{
73}
74static inline int bcm_chimp_is_nic_mode(void)
75{
76 return 0;
77}
78static inline void bcm_chimp_fru_prog_done(bool status)
79{
80}
81static inline int bcm_chimp_handshake_done(void)
82{
83 return 0;
84}
85static inline int bcm_chimp_wait_handshake(void)
86{
87 return 0;
88}
89static inline int bcm_chimp_initiate_fastboot(int fastboot_type)
90{
91 return 0;
92}
93#endif /* USE_CHIMP */
94#endif