aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2014-02-28 12:09:20 -0500
committerPaul Burton <paul.burton@imgtec.com>2014-05-02 11:39:10 -0400
commiteaa38d6343adbb5070c27af29aeeb3df126f47f2 (patch)
tree34eac81c7f8ad150cd2e41ffa544dfa44179183b
parent61d73044fe4cb8b9b50fa2a612cb4492b9db43cd (diff)
MIPS: tlb-r4k: Add CPU PM callback to reconfigure TLB
Add a CPU power management callback for the r4k TLB which reconfigures it after the CPU leaves a powered down state. Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
-rw-r--r--arch/mips/mm/tlb-r4k.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index eeaf50f5df2b..89e3fabcb98c 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -8,6 +8,7 @@
8 * Carsten Langgaard, carstenl@mips.com 8 * Carsten Langgaard, carstenl@mips.com
9 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved. 9 * Copyright (C) 2002 MIPS Technologies, Inc. All rights reserved.
10 */ 10 */
11#include <linux/cpu_pm.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/sched.h> 13#include <linux/sched.h>
13#include <linux/smp.h> 14#include <linux/smp.h>
@@ -421,7 +422,10 @@ static int __init set_ntlb(char *str)
421 422
422__setup("ntlb=", set_ntlb); 423__setup("ntlb=", set_ntlb);
423 424
424void tlb_init(void) 425/*
426 * Configure TLB (for init or after a CPU has been powered off).
427 */
428static void r4k_tlb_configure(void)
425{ 429{
426 /* 430 /*
427 * You should never change this register: 431 * You should never change this register:
@@ -453,6 +457,11 @@ void tlb_init(void)
453 local_flush_tlb_all(); 457 local_flush_tlb_all();
454 458
455 /* Did I tell you that ARC SUCKS? */ 459 /* Did I tell you that ARC SUCKS? */
460}
461
462void tlb_init(void)
463{
464 r4k_tlb_configure();
456 465
457 if (ntlb) { 466 if (ntlb) {
458 if (ntlb > 1 && ntlb <= current_cpu_data.tlbsize) { 467 if (ntlb > 1 && ntlb <= current_cpu_data.tlbsize) {
@@ -466,3 +475,26 @@ void tlb_init(void)
466 475
467 build_tlb_refill_handler(); 476 build_tlb_refill_handler();
468} 477}
478
479static int r4k_tlb_pm_notifier(struct notifier_block *self, unsigned long cmd,
480 void *v)
481{
482 switch (cmd) {
483 case CPU_PM_ENTER_FAILED:
484 case CPU_PM_EXIT:
485 r4k_tlb_configure();
486 break;
487 }
488
489 return NOTIFY_OK;
490}
491
492static struct notifier_block r4k_tlb_pm_notifier_block = {
493 .notifier_call = r4k_tlb_pm_notifier,
494};
495
496static int __init r4k_tlb_init_pm(void)
497{
498 return cpu_pm_register_notifier(&r4k_tlb_pm_notifier_block);
499}
500arch_initcall(r4k_tlb_init_pm);