2 * Boot ROM Entry Points and such
5 /* These Blackfins all have a Boot ROM that is not reusable (at all):
6 * BF531 / BF532 / BF533
9 * So there is nothing for us to export ;(
11 * These Blackfins started to roll with the idea that the Boot ROM can
12 * provide useful functions, but still only a few (and not really useful):
13 * BF534 / BF536 / BF537
15 * Looking forward, Boot ROM's on newer Blackfins have quite a few
16 * nice entry points that are usable at runtime and beyond. We'll
17 * only define known legacy parts (listed above) and otherwise just
18 * assume it's a newer part.
20 * These entry points are accomplished by placing a small jump table at
21 * the start of the Boot ROM. This way the addresses are fixed forever.
24 #ifndef __BFIN_PERIPHERAL_BOOTROM__
25 #define __BFIN_PERIPHERAL_BOOTROM__
27 /* All Blackfin's have the Boot ROM entry point at the same address */
28 #define _BOOTROM_RESET 0xEF000000
30 #if defined(__ADSPBF531__) || defined(__ADSPBF532__) || defined(__ADSPBF533__) || \
31 defined(__ADSPBF538__) || defined(__ADSPBF539__) || \
32 defined(__ADSPBF561__)
34 /* Nothing to export */
36 #elif defined(__ADSPBF534__) || defined(__ADSPBF536__) || defined(__ADSPBF537__)
38 /* The BF537 family */
40 #define _BOOTROM_FINAL_INIT 0xEF000002
41 /* reserved 0xEF000004 */
42 #define _BOOTROM_DO_MEMORY_DMA 0xEF000006
43 #define _BOOTROM_BOOT_DXE_FLASH 0xEF000008
44 #define _BOOTROM_BOOT_DXE_SPI 0xEF00000A
45 #define _BOOTROM_BOOT_DXE_TWI 0xEF00000C
46 /* reserved 0xEF00000E */
47 #define _BOOTROM_GET_DXE_ADDRESS_FLASH 0xEF000010
48 #define _BOOTROM_GET_DXE_ADDRESS_SPI 0xEF000012
49 #define _BOOTROM_GET_DXE_ADDRESS_TWI 0xEF000014
50 /* reserved 0xEF000016 */
51 /* reserved 0xEF000018 */
53 /* Glue to newer Boot ROMs */
54 #define _BOOTROM_MDMA _BOOTROM_DO_MEMORY_DMA
55 #define _BOOTROM_MEMBOOT _BOOTROM_BOOT_DXE_FLASH
56 #define _BOOTROM_SPIBOOT _BOOTROM_BOOT_DXE_FLASH
57 #define _BOOTROM_TWIBOOT _BOOTROM_BOOT_DXE_TWI
61 /* All the newer Boot ROMs */
63 #define _BOOTROM_FINAL_INIT 0xEF000002
64 #define _BOOTROM_PDMA 0xEF000004
65 #define _BOOTROM_MDMA 0xEF000006
66 #define _BOOTROM_MEMBOOT 0xEF000008
67 #define _BOOTROM_SPIBOOT 0xEF00000A
68 #define _BOOTROM_TWIBOOT 0xEF00000C
69 /* reserved 0xEF00000E */
70 /* reserved 0xEF000010 */
71 /* reserved 0xEF000012 */
72 /* reserved 0xEF000014 */
73 /* reserved 0xEF000016 */
74 #define _BOOTROM_OTP_COMMAND 0xEF000018
75 #define _BOOTROM_OTP_READ 0xEF00001A
76 #define _BOOTROM_OTP_WRITE 0xEF00001C
77 #define _BOOTROM_ECC_TABLE 0xEF00001E
78 #define _BOOTROM_BOOTKERNEL 0xEF000020
79 #define _BOOTROM_GETPORT 0xEF000022
80 #define _BOOTROM_NMI 0xEF000024
81 #define _BOOTROM_HWERROR 0xEF000026
82 #define _BOOTROM_EXCEPTION 0xEF000028
83 #define _BOOTROM_CRC32 0xEF000030
84 #define _BOOTROM_CRC32POLY 0xEF000032
85 #define _BOOTROM_CRC32CALLBACK 0xEF000034
86 #define _BOOTROM_CRC32INITCODE 0xEF000036
87 #define _BOOTROM_SYSCONTROL 0xEF000038
88 #define _BOOTROM_REV 0xEF000040
89 #define _BOOTROM_SESR 0xEF001000
91 #define BOOTROM_CAPS_ADI_BOOT_STRUCTS 1
93 /* Not available on initial BF54x or BF52x */
94 #if (defined(__ADSPBF54x__) && __SILICON_REVISION__ < 1) || \
95 (defined(__ADSPBF52x__) && __SILICON_REVISION__ < 2)
96 #define BOOTROM_CAPS_SYSCONTROL 0
98 #define BOOTROM_CAPS_SYSCONTROL 1
103 #ifndef BOOTROM_CAPS_ADI_BOOT_STRUCTS
104 #define BOOTROM_CAPS_ADI_BOOT_STRUCTS 0
106 #ifndef BOOTROM_CAPS_SYSCONTROL
107 #define BOOTROM_CAPS_SYSCONTROL 0
112 /* Structures for the syscontrol() function */
113 typedef struct ADI_SYSCTRL_VALUES {
117 uint16_t uwPllLockCnt;
119 } ADI_SYSCTRL_VALUES;
121 #ifndef _BOOTROM_SYSCONTROL
122 #define _BOOTROM_SYSCONTROL 0
124 static uint32_t (* const syscontrol)(uint32_t action_flags, ADI_SYSCTRL_VALUES *power_settings, void *reserved) = (void *)_BOOTROM_SYSCONTROL;
126 #endif /* __ASSEMBLY__ */
128 /* Possible syscontrol action flags */
129 #define SYSCTRL_READ 0x00000000 /* read registers */
130 #define SYSCTRL_WRITE 0x00000001 /* write registers */
131 #define SYSCTRL_SYSRESET 0x00000002 /* perform system reset */
132 #define SYSCTRL_SOFTRESET 0x00000004 /* perform core and system reset */
133 #define SYSCTRL_VRCTL 0x00000010 /* read/write VR_CTL register */
134 #define SYSCTRL_EXTVOLTAGE 0x00000020 /* VDDINT supplied externally */
135 #define SYSCTRL_INTVOLTAGE 0x00000000 /* VDDINT generated by on-chip regulator */
136 #define SYSCTRL_OTPVOLTAGE 0x00000040 /* For Factory Purposes Only */
137 #define SYSCTRL_PLLCTL 0x00000100 /* read/write PLL_CTL register */
138 #define SYSCTRL_PLLDIV 0x00000200 /* read/write PLL_DIV register */
139 #define SYSCTRL_LOCKCNT 0x00000400 /* read/write PLL_LOCKCNT register */
140 #define SYSCTRL_PLLSTAT 0x00000800 /* read/write PLL_STAT register */
144 /* Structures for working with LDRs and boot rom callbacks */
145 typedef struct ADI_BOOT_HEADER {
147 void *pTargetAddress;
152 typedef struct ADI_BOOT_BUFFER {
157 typedef struct ADI_BOOT_DATA {
160 int16_t *pControlRegister;
161 int16_t *pDmaControlRegister;
162 int32_t dControlValue;
166 int16_t uwSrcModifyMult;
167 int16_t uwDstModifyMult;
173 void *pErrorFunction;
175 void *pCallBackFunction;
176 ADI_BOOT_HEADER *pHeader;
179 int32_t dTempByteCount;
184 int32_t dLogByteCount;
187 #endif /* __ASSEMBLY__ */
189 /* Bit defines for ADI_BOOT_DATA->dFlags */
190 #define BFLAG_DMACODE_MASK 0x0000000F
191 #define BFLAG_SAFE 0x00000010
192 #define BFLAG_AUX 0x00000020
193 #define BFLAG_FILL 0x00000100
194 #define BFLAG_QUICKBOOT 0x00000200
195 #define BFLAG_CALLBACK 0x00000400
196 #define BFLAG_INIT 0x00000800
197 #define BFLAG_IGNORE 0x00001000
198 #define BFLAG_INDIRECT 0x00002000
199 #define BFLAG_FIRST 0x00004000
200 #define BFLAG_FINAL 0x00008000
201 #define BFLAG_HOOK 0x00400000
202 #define BFLAG_HDRINDIRECT 0x00800000
203 #define BFLAG_TYPE_MASK 0x00300000
204 #define BFLAG_TYPE_1 0x00000000
205 #define BFLAG_TYPE_2 0x00100000
206 #define BFLAG_TYPE_3 0x00200000
207 #define BFLAG_TYPE_4 0x00300000
208 #define BFLAG_FASTREAD 0x00400000
209 #define BFLAG_NOAUTO 0x01000000
210 #define BFLAG_PERIPHERAL 0x02000000
211 #define BFLAG_SLAVE 0x04000000
212 #define BFLAG_WAKEUP 0x08000000
213 #define BFLAG_NEXTDXE 0x10000000
214 #define BFLAG_RETURN 0x20000000
215 #define BFLAG_RESET 0x40000000
216 #define BFLAG_NONRESTORE 0x80000000