File tree Expand file tree Collapse file tree 2 files changed +12
-18
lines changed Expand file tree Collapse file tree 2 files changed +12
-18
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,12 @@ void l2cc_enable(void)
437
437
/* Invalidate and enable the cache (must be disabled to do this!) */
438
438
439
439
flags = enter_critical_section ();
440
+
441
+ if ((getreg32 (L2CC_CR ) & L2CC_CR_L2CEN ) != 0 )
442
+ {
443
+ l2cc_disable ();
444
+ }
445
+
440
446
l2cc_invalidate_all ();
441
447
putreg32 (L2CC_CR_L2CEN , L2CC_CR );
442
448
ARM_DSB ();
@@ -520,17 +526,11 @@ void l2cc_sync(void)
520
526
void l2cc_invalidate_all (void )
521
527
{
522
528
irqstate_t flags ;
523
- uint32_t regval ;
524
529
525
530
/* Invalidate all ways */
526
531
527
532
flags = enter_critical_section ();
528
533
529
- /* Disable the L2 cache while we invalidate it */
530
-
531
- regval = getreg32 (L2CC_CR );
532
- l2cc_disable ();
533
-
534
534
/* Invalidate all ways by writing the bit mask of ways to be invalidated
535
535
* the Invalidate Way Register (IWR).
536
536
*/
@@ -547,9 +547,6 @@ void l2cc_invalidate_all(void)
547
547
548
548
putreg32 (0 , L2CC_CSR );
549
549
550
- /* Then re-enable the L2 cache if it was enabled before */
551
-
552
- putreg32 (regval , L2CC_CR );
553
550
leave_critical_section (flags );
554
551
}
555
552
Original file line number Diff line number Diff line change @@ -437,6 +437,12 @@ void l2cc_enable(void)
437
437
/* Invalidate and enable the cache (must be disabled to do this!) */
438
438
439
439
flags = enter_critical_section ();
440
+
441
+ if ((getreg32 (L2CC_CR ) & L2CC_CR_L2CEN ) != 0 )
442
+ {
443
+ l2cc_disable ();
444
+ }
445
+
440
446
l2cc_invalidate_all ();
441
447
putreg32 (L2CC_CR_L2CEN , L2CC_CR );
442
448
ARM_DSB ();
@@ -520,17 +526,11 @@ void l2cc_sync(void)
520
526
void l2cc_invalidate_all (void )
521
527
{
522
528
irqstate_t flags ;
523
- uint32_t regval ;
524
529
525
530
/* Invalidate all ways */
526
531
527
532
flags = enter_critical_section ();
528
533
529
- /* Disable the L2 cache while we invalidate it */
530
-
531
- regval = getreg32 (L2CC_CR );
532
- l2cc_disable ();
533
-
534
534
/* Invalidate all ways by writing the bit mask of ways to be invalidated
535
535
* the Invalidate Way Register (IWR).
536
536
*/
@@ -547,9 +547,6 @@ void l2cc_invalidate_all(void)
547
547
548
548
putreg32 (0 , L2CC_CSR );
549
549
550
- /* Then re-enable the L2 cache if it was enabled before */
551
-
552
- putreg32 (regval , L2CC_CR );
553
550
leave_critical_section (flags );
554
551
}
555
552
You can’t perform that action at this time.
0 commit comments