@@ -183,15 +183,44 @@ int MXC_FLC_MassErase(void)
183
183
}
184
184
185
185
//******************************************************************************
186
- __weak int MXC_FLC_UnlockInfoBlock (uint32_t address )
186
+ int MXC_FLC_UnlockInfoBlock (uint32_t address )
187
187
{
188
+ /* Flash Controller only accessible in secure world. */
189
+ #if defined(CONFIG_TRUSTED_EXECUTION_SECURE ) || (CONFIG_TRUSTED_EXECUTION_SECURE != 0 )
190
+ if ((address < MXC_INFO_MEM_BASE ) ||
191
+ (address >= (MXC_INFO_MEM_BASE + (MXC_INFO_MEM_SIZE * 2 )))) {
192
+ return E_BAD_PARAM ;
193
+ }
194
+ #else
188
195
return E_NOT_SUPPORTED ;
196
+ #endif
197
+
198
+ /* Make sure the info block is locked */
199
+ MXC_FLC -> actrl = 0x1234 ;
200
+
201
+ /* Write the unlock sequence */
202
+ MXC_FLC -> actrl = 0x55bcbe69 ;
203
+ MXC_FLC -> actrl = 0x7688c189 ;
204
+ MXC_FLC -> actrl = 0x82306612 ;
205
+
206
+ return E_NO_ERROR ;
189
207
}
190
208
191
209
//******************************************************************************
192
210
int MXC_FLC_LockInfoBlock (uint32_t address )
193
211
{
194
- return MXC_FLC_RevA_LockInfoBlock ((mxc_flc_reva_regs_t * )MXC_FLC , address );
212
+ /* Flash Controller only accessible in secure world. */
213
+ #if defined(CONFIG_TRUSTED_EXECUTION_SECURE ) || (CONFIG_TRUSTED_EXECUTION_SECURE != 0 )
214
+ if ((address < MXC_INFO_MEM_BASE ) ||
215
+ (address >= (MXC_INFO_MEM_BASE + (MXC_INFO_MEM_SIZE * 2 )))) {
216
+ return E_BAD_PARAM ;
217
+ }
218
+ #else
219
+ return E_NOT_SUPPORTED ;
220
+ #endif
221
+
222
+ MXC_FLC -> actrl = 0xDEADBEEF ;
223
+ return E_NO_ERROR ;
195
224
}
196
225
197
226
//******************************************************************************
0 commit comments