Commit 4a88d0ce authored by Michael Hennerich's avatar Michael Hennerich Committed by Bryan Wu

Blackfin arch: Functional power management support

Merge VR Regulator Hibernate wakeups into set_irq_wake for internal
interrupts.
Signed-off-by: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarBryan Wu <cooloney@kernel.org>
parent 5400c5aa
...@@ -933,13 +933,6 @@ endchoice ...@@ -933,13 +933,6 @@ endchoice
comment "Possible Suspend Mem / Hibernate Wake-Up Sources" comment "Possible Suspend Mem / Hibernate Wake-Up Sources"
depends on PM depends on PM
config PM_BFIN_WAKE_RTC
bool "Allow Wake-Up from RESET and on-chip RTC"
depends on PM
default n
help
Enable RTC Wake-Up (Voltage Regulator Power-Up)
config PM_BFIN_WAKE_PH6 config PM_BFIN_WAKE_PH6
bool "Allow Wake-Up from on-chip PHY or PH6 GP" bool "Allow Wake-Up from on-chip PHY or PH6 GP"
depends on PM && (BF52x || BF534 || BF536 || BF537) depends on PM && (BF52x || BF534 || BF536 || BF537)
...@@ -947,41 +940,12 @@ config PM_BFIN_WAKE_PH6 ...@@ -947,41 +940,12 @@ config PM_BFIN_WAKE_PH6
help help
Enable PHY and PH6 GP Wake-Up (Voltage Regulator Power-Up) Enable PHY and PH6 GP Wake-Up (Voltage Regulator Power-Up)
config PM_BFIN_WAKE_CAN
bool "Allow Wake-Up from on-chip CAN0/1"
depends on PM && (BF54x || BF534 || BF536 || BF537)
default n
help
Enable CAN0/1 Wake-Up (Voltage Regulator Power-Up)
config PM_BFIN_WAKE_GP config PM_BFIN_WAKE_GP
bool "Allow Wake-Up from GPIOs" bool "Allow Wake-Up from GPIOs"
depends on PM && BF54x depends on PM && BF54x
default n default n
help help
Enable General-Purpose Wake-Up (Voltage Regulator Power-Up) Enable General-Purpose Wake-Up (Voltage Regulator Power-Up)
config PM_BFIN_WAKE_USB
bool "Allow Wake-Up from on-chip USB"
depends on PM && (BF54x || BF52x)
default n
help
Enable USB Wake-Up (Voltage Regulator Power-Up)
config PM_BFIN_WAKE_KEYPAD
bool "Allow Wake-Up from on-chip Keypad"
depends on PM && BF54x
default n
help
Enable Keypad Wake-Up (Voltage Regulator Power-Up)
config PM_BFIN_WAKE_ROTARY
bool "Allow Wake-Up from on-chip Rotary"
depends on PM && BF54x
default n
help
Enable Rotary Wake-Up (Voltage Regulator Power-Up)
endmenu endmenu
menu "CPU Frequency scaling" menu "CPU Frequency scaling"
......
...@@ -71,6 +71,7 @@ atomic_t num_spurious; ...@@ -71,6 +71,7 @@ atomic_t num_spurious;
#ifdef CONFIG_PM #ifdef CONFIG_PM
unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */ unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */
unsigned vr_wakeup;
#endif #endif
struct ivgx { struct ivgx {
...@@ -184,17 +185,56 @@ static void bfin_internal_unmask_irq(unsigned int irq) ...@@ -184,17 +185,56 @@ static void bfin_internal_unmask_irq(unsigned int irq)
#ifdef CONFIG_PM #ifdef CONFIG_PM
int bfin_internal_set_wake(unsigned int irq, unsigned int state) int bfin_internal_set_wake(unsigned int irq, unsigned int state)
{ {
unsigned bank, bit; unsigned bank, bit, wakeup = 0;
unsigned long flags; unsigned long flags;
bank = SIC_SYSIRQ(irq) / 32; bank = SIC_SYSIRQ(irq) / 32;
bit = SIC_SYSIRQ(irq) % 32; bit = SIC_SYSIRQ(irq) % 32;
switch (irq) {
#ifdef IRQ_RTC
case IRQ_RTC:
wakeup |= WAKE;
break;
#endif
#ifdef IRQ_CAN0_RX
case IRQ_CAN0_RX:
wakeup |= CANWE;
break;
#endif
#ifdef IRQ_CAN1_RX
case IRQ_CAN1_RX:
wakeup |= CANWE;
break;
#endif
#ifdef IRQ_USB_INT0
case IRQ_USB_INT0:
wakeup |= USBWE;
break;
#endif
#ifdef IRQ_KEY
case IRQ_KEY:
wakeup |= KPADWE;
break;
#endif
#ifdef IRQ_CNT
case IRQ_CNT:
wakeup |= ROTWE;
break;
#endif
default:
break;
}
local_irq_save(flags); local_irq_save(flags);
if (state) if (state) {
bfin_sic_iwr[bank] |= (1 << bit); bfin_sic_iwr[bank] |= (1 << bit);
else vr_wakeup |= wakeup;
} else {
bfin_sic_iwr[bank] &= ~(1 << bit); bfin_sic_iwr[bank] &= ~(1 << bit);
vr_wakeup &= ~wakeup;
}
local_irq_restore(flags); local_irq_restore(flags);
......
...@@ -229,28 +229,12 @@ int bfin_pm_suspend_mem_enter(void) ...@@ -229,28 +229,12 @@ int bfin_pm_suspend_mem_enter(void)
wakeup = bfin_read_VR_CTL() & ~FREQ; wakeup = bfin_read_VR_CTL() & ~FREQ;
wakeup |= SCKELOW; wakeup |= SCKELOW;
/* FIXME: merge this somehow with set_irq_wake */
#ifdef CONFIG_PM_BFIN_WAKE_RTC
wakeup |= WAKE;
#endif
#ifdef CONFIG_PM_BFIN_WAKE_PH6 #ifdef CONFIG_PM_BFIN_WAKE_PH6
wakeup |= PHYWE; wakeup |= PHYWE;
#endif #endif
#ifdef CONFIG_PM_BFIN_WAKE_CAN
wakeup |= CANWE;
#endif
#ifdef CONFIG_PM_BFIN_WAKE_GP #ifdef CONFIG_PM_BFIN_WAKE_GP
wakeup |= GPWE; wakeup |= GPWE;
#endif #endif
#ifdef CONFIG_PM_BFIN_WAKE_USB
wakeup |= USBWE;
#endif
#ifdef CONFIG_PM_BFIN_WAKE_KEYPAD
wakeup |= KPADWE;
#endif
#ifdef CONFIG_PM_BFIN_WAKE_ROTARY
wakeup |= ROTWE;
#endif
local_irq_save(flags); local_irq_save(flags);
...@@ -268,7 +252,7 @@ int bfin_pm_suspend_mem_enter(void) ...@@ -268,7 +252,7 @@ int bfin_pm_suspend_mem_enter(void)
icache_disable(); icache_disable();
bf53x_suspend_l1_mem(memptr); bf53x_suspend_l1_mem(memptr);
do_hibernate(wakeup); /* Goodbye */ do_hibernate(wakeup | vr_wakeup); /* Goodbye */
bf53x_resume_l1_mem(memptr); bf53x_resume_l1_mem(memptr);
......
...@@ -113,6 +113,7 @@ extern const char bfin_board_name[]; ...@@ -113,6 +113,7 @@ extern const char bfin_board_name[];
extern unsigned long wall_jiffies; extern unsigned long wall_jiffies;
extern unsigned long bfin_sic_iwr[]; extern unsigned long bfin_sic_iwr[];
extern unsigned vr_wakeup;
extern u16 _bfin_swrst; /* shadow for Software Reset Register (SWRST) */ extern u16 _bfin_swrst; /* shadow for Software Reset Register (SWRST) */
extern struct file_operations dpmc_fops; extern struct file_operations dpmc_fops;
extern unsigned long _ramstart, _ramend, _rambase; extern unsigned long _ramstart, _ramend, _rambase;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment