@@ -156,7 +156,7 @@ static int esirisc_flash_disable_protect(struct flash_bank *bank)
156
156
if (!(control & CONTROL_WP ))
157
157
return ERROR_OK ;
158
158
159
- esirisc_flash_unlock (bank );
159
+ ( void ) esirisc_flash_unlock (bank );
160
160
161
161
control &= ~CONTROL_WP ;
162
162
@@ -175,7 +175,7 @@ static int esirisc_flash_enable_protect(struct flash_bank *bank)
175
175
if (control & CONTROL_WP )
176
176
return ERROR_OK ;
177
177
178
- esirisc_flash_unlock (bank );
178
+ ( void ) esirisc_flash_unlock (bank );
179
179
180
180
control |= CONTROL_WP ;
181
181
@@ -261,7 +261,7 @@ static int esirisc_flash_erase(struct flash_bank *bank, int first, int last)
261
261
if (target -> state != TARGET_HALTED )
262
262
return ERROR_TARGET_NOT_HALTED ;
263
263
264
- esirisc_flash_disable_protect (bank );
264
+ ( void ) esirisc_flash_disable_protect (bank );
265
265
266
266
for (int page = first ; page < last ; ++ page ) {
267
267
uint32_t address = page * PAGE_SIZE ;
@@ -275,7 +275,7 @@ static int esirisc_flash_erase(struct flash_bank *bank, int first, int last)
275
275
}
276
276
}
277
277
278
- esirisc_flash_enable_protect (bank );
278
+ ( void ) esirisc_flash_enable_protect (bank );
279
279
280
280
return retval ;
281
281
}
@@ -289,15 +289,15 @@ static int esirisc_flash_mass_erase(struct flash_bank *bank)
289
289
if (target -> state != TARGET_HALTED )
290
290
return ERROR_TARGET_NOT_HALTED ;
291
291
292
- esirisc_flash_disable_protect (bank );
292
+ ( void ) esirisc_flash_disable_protect (bank );
293
293
294
294
target_write_u32 (target , esirisc_info -> cfg + ADDRESS , 0 );
295
295
296
296
retval = esirisc_flash_control (bank , CONTROL_E );
297
297
if (retval != ERROR_OK )
298
298
LOG_ERROR ("%s: failed to mass erase" , bank -> name );
299
299
300
- esirisc_flash_enable_protect (bank );
300
+ ( void ) esirisc_flash_enable_protect (bank );
301
301
302
302
return retval ;
303
303
}
@@ -315,32 +315,17 @@ static int esirisc_flash_ref_erase(struct flash_bank *bank)
315
315
if (target -> state != TARGET_HALTED )
316
316
return ERROR_TARGET_NOT_HALTED ;
317
317
318
- esirisc_flash_disable_protect (bank );
318
+ ( void ) esirisc_flash_disable_protect (bank );
319
319
320
320
retval = esirisc_flash_control (bank , CONTROL_ERC );
321
321
if (retval != ERROR_OK )
322
322
LOG_ERROR ("%s: failed to erase reference cell" , bank -> name );
323
323
324
- esirisc_flash_enable_protect (bank );
324
+ ( void ) esirisc_flash_enable_protect (bank );
325
325
326
326
return retval ;
327
327
}
328
328
329
- static int esirisc_flash_protect (struct flash_bank * bank , int set , int first , int last )
330
- {
331
- struct target * target = bank -> target ;
332
-
333
- if (target -> state != TARGET_HALTED )
334
- return ERROR_TARGET_NOT_HALTED ;
335
-
336
- if (set )
337
- esirisc_flash_enable_protect (bank );
338
- else
339
- esirisc_flash_disable_protect (bank );
340
-
341
- return ERROR_OK ;
342
- }
343
-
344
329
static int esirisc_flash_fill_pb (struct flash_bank * bank ,
345
330
const uint8_t * buffer , uint32_t count )
346
331
{
@@ -382,7 +367,7 @@ static int esirisc_flash_write(struct flash_bank *bank,
382
367
if (target -> state != TARGET_HALTED )
383
368
return ERROR_TARGET_NOT_HALTED ;
384
369
385
- esirisc_flash_disable_protect (bank );
370
+ ( void ) esirisc_flash_disable_protect (bank );
386
371
387
372
/*
388
373
* The address register is auto-incremented based on the contents of
@@ -413,7 +398,7 @@ static int esirisc_flash_write(struct flash_bank *bank,
413
398
count -= num_bytes ;
414
399
}
415
400
416
- esirisc_flash_enable_protect (bank );
401
+ ( void ) esirisc_flash_enable_protect (bank );
417
402
418
403
return retval ;
419
404
}
@@ -439,7 +424,7 @@ static int esirisc_flash_init(struct flash_bank *bank)
439
424
uint32_t value ;
440
425
int retval ;
441
426
442
- esirisc_flash_disable_protect (bank );
427
+ ( void ) esirisc_flash_disable_protect (bank );
443
428
444
429
/* initialize timing registers */
445
430
value = TIMING0_F (esirisc_flash_num_cycles (bank , TNVH ))
@@ -465,7 +450,7 @@ static int esirisc_flash_init(struct flash_bank *bank)
465
450
if (retval != ERROR_OK )
466
451
LOG_ERROR ("%s: failed to recall trim code" , bank -> name );
467
452
468
- esirisc_flash_enable_protect (bank );
453
+ ( void ) esirisc_flash_enable_protect (bank );
469
454
470
455
return retval ;
471
456
}
@@ -482,13 +467,6 @@ static int esirisc_flash_probe(struct flash_bank *bank)
482
467
bank -> num_sectors = bank -> size / PAGE_SIZE ;
483
468
bank -> sectors = alloc_block_array (0 , PAGE_SIZE , bank -> num_sectors );
484
469
485
- /*
486
- * Register write protection is enforced using a single protection
487
- * block for the entire bank. This is as good as it gets.
488
- */
489
- bank -> num_prot_blocks = 1 ;
490
- bank -> prot_blocks = alloc_block_array (0 , bank -> size , bank -> num_prot_blocks );
491
-
492
470
retval = esirisc_flash_init (bank );
493
471
if (retval != ERROR_OK ) {
494
472
LOG_ERROR ("%s: failed to initialize bank" , bank -> name );
@@ -510,23 +488,6 @@ static int esirisc_flash_auto_probe(struct flash_bank *bank)
510
488
return esirisc_flash_probe (bank );
511
489
}
512
490
513
- static int esirisc_flash_protect_check (struct flash_bank * bank )
514
- {
515
- struct esirisc_flash_bank * esirisc_info = bank -> driver_priv ;
516
- struct target * target = bank -> target ;
517
- uint32_t control ;
518
-
519
- if (target -> state != TARGET_HALTED )
520
- return ERROR_TARGET_NOT_HALTED ;
521
-
522
- target_read_u32 (target , esirisc_info -> cfg + CONTROL , & control );
523
-
524
- /* single protection block (also see: esirisc_flash_probe()) */
525
- bank -> prot_blocks [0 ].is_protected = !!(control & CONTROL_WP );
526
-
527
- return ERROR_OK ;
528
- }
529
-
530
491
static int esirisc_flash_info (struct flash_bank * bank , char * buf , int buf_size )
531
492
{
532
493
struct esirisc_flash_bank * esirisc_info = bank -> driver_priv ;
@@ -616,13 +577,11 @@ struct flash_driver esirisc_flash = {
616
577
"cfg_address clock_hz wait_states" ,
617
578
.flash_bank_command = esirisc_flash_bank_command ,
618
579
.erase = esirisc_flash_erase ,
619
- .protect = esirisc_flash_protect ,
620
580
.write = esirisc_flash_write ,
621
581
.read = default_flash_read ,
622
582
.probe = esirisc_flash_probe ,
623
583
.auto_probe = esirisc_flash_auto_probe ,
624
584
.erase_check = default_flash_blank_check ,
625
- .protect_check = esirisc_flash_protect_check ,
626
585
.info = esirisc_flash_info ,
627
586
.free_driver_priv = default_flash_free_driver_priv ,
628
587
};
0 commit comments