Commit 0fbd88ca authored by Steven Miao's avatar Steven Miao Committed by Bob Liu

blackfin: bf60x: add wakeup source select

Support select the wakeup source for power management on bf60x.
Signed-off-by: default avatarSteven Miao <realmz6@gmail.com>
Signed-off-by: default avatarBob Liu <lliubbo@gmail.com>
parent 7c141c1c
......@@ -1256,7 +1256,7 @@ config ARCH_SUSPEND_POSSIBLE
choice
prompt "Standby Power Saving Mode"
depends on PM
depends on PM && !BF60x
default PM_BFIN_SLEEP_DEEPER
config PM_BFIN_SLEEP_DEEPER
bool "Sleep Deeper"
......@@ -1311,6 +1311,118 @@ config PM_BFIN_WAKE_GP
On ADSP-BF549 this option enables the the same functionality on the
/MRXON pin also PH7.
config PM_BFIN_WAKE_PA15
bool "Allow Wake-Up from PA15"
depends on PM && BF60x
default n
help
Enable PA15 Wake-Up
config PM_BFIN_WAKE_PA15_POL
int "Wake-up priority"
depends on PM_BFIN_WAKE_PA15
default 0
help
Wake-Up priority 0(low) 1(high)
config PM_BFIN_WAKE_PB15
bool "Allow Wake-Up from PB15"
depends on PM && BF60x
default n
help
Enable PB15 Wake-Up
config PM_BFIN_WAKE_PB15_POL
int "Wake-up priority"
depends on PM_BFIN_WAKE_PB15
default 0
help
Wake-Up priority 0(low) 1(high)
config PM_BFIN_WAKE_PC15
bool "Allow Wake-Up from PC15"
depends on PM && BF60x
default n
help
Enable PC15 Wake-Up
config PM_BFIN_WAKE_PC15_POL
int "Wake-up priority"
depends on PM_BFIN_WAKE_PC15
default 0
help
Wake-Up priority 0(low) 1(high)
config PM_BFIN_WAKE_PD06
bool "Allow Wake-Up from PD06(ETH0_PHYINT)"
depends on PM && BF60x
default n
help
Enable PD06(ETH0_PHYINT) Wake-up
config PM_BFIN_WAKE_PD06_POL
int "Wake-up priority"
depends on PM_BFIN_WAKE_PD06
default 0
help
Wake-Up priority 0(low) 1(high)
config PM_BFIN_WAKE_PE12
bool "Allow Wake-Up from PE12(ETH1_PHYINT, PUSH BUTTON)"
depends on PM && BF60x
default n
help
Enable PE12(ETH1_PHYINT, PUSH BUTTON) Wake-up
config PM_BFIN_WAKE_PE12_POL
int "Wake-up priority"
depends on PM_BFIN_WAKE_PE12
default 0
help
Wake-Up priority 0(low) 1(high)
config PM_BFIN_WAKE_PG04
bool "Allow Wake-Up from PG04(CAN0_RX)"
depends on PM && BF60x
default n
help
Enable PG04(CAN0_RX) Wake-up
config PM_BFIN_WAKE_PG04_POL
int "Wake-up priority"
depends on PM_BFIN_WAKE_PG04
default 0
help
Wake-Up priority 0(low) 1(high)
config PM_BFIN_WAKE_PG13
bool "Allow Wake-Up from PG13"
depends on PM && BF60x
default n
help
Enable PG13 Wake-Up
config PM_BFIN_WAKE_PG13_POL
int "Wake-up priority"
depends on PM_BFIN_WAKE_PG13
default 0
help
Wake-Up priority 0(low) 1(high)
config PM_BFIN_WAKE_USB
bool "Allow Wake-Up from (USB)"
depends on PM && BF60x
default n
help
Enable (USB) Wake-up
config PM_BFIN_WAKE_USB_POL
int "Wake-up priority"
depends on PM_BFIN_WAKE_USB
default 0
help
Wake-Up priority 0(low) 1(high)
endmenu
menu "CPU Frequency scaling"
......
......@@ -33,7 +33,8 @@ CONFIG_CPLB_SWITCH_TAB_L1=y
CONFIG_NOMMU_INITIAL_TRIM_EXCESS=0
CONFIG_BINFMT_FLAT=y
CONFIG_BINFMT_ZFLAT=y
# CONFIG_SUSPEND is not set
CONFIG_PM_BFIN_WAKE_PE12=y
CONFIG_PM_BFIN_WAKE_PE12_POL=1
CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
......@@ -119,7 +120,7 @@ CONFIG_SND_SOC_BFIN_EVAL_ADAU1X61=m
CONFIG_SND_SOC_ALL_CODECS=m
CONFIG_USB=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_BLACKFIN=y
CONFIG_USB_MUSB_BLACKFIN=m
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_MUSB_HDRC=y
......
......@@ -729,6 +729,16 @@
#define VLEV_130 0x00F0 /* VLEV = 1.30 V (-5% - +10% Accuracy) */
#endif
#ifdef CONFIG_BF60x
#define PA15WE 0x00000001 /* Allow Wake-Up from PA15 */
#define PB15WE 0x00000002 /* Allow Wake-Up from PB15 */
#define PC15WE 0x00000004 /* Allow Wake-Up from PC15 */
#define PD06WE 0x00000008 /* Allow Wake-Up from PD06(ETH0_PHYINT) */
#define PE12WE 0x00000010 /* Allow Wake-Up from PE12(ETH1_PHYINT, PUSH BUTTON) */
#define PG04WE 0x00000020 /* Allow Wake-Up from PG04(CAN0_RX) */
#define PG13WE 0x00000040 /* Allow Wake-Up from PG13 */
#define USBWE 0x00000080 /* Allow Wake-Up from (USB) */
#else
#define WAKE 0x0100 /* Enable RTC/Reset Wakeup From Hibernate */
#define CANWE 0x0200 /* Enable CAN Wakeup From Hibernate */
#define PHYWE 0x0400 /* Enable PHY Wakeup From Hibernate */
......@@ -744,7 +754,7 @@
#else
#define USBWE 0x0800 /* Enable USB Wakeup From Hibernate */
#endif
#endif
#ifndef __ASSEMBLY__
......
......@@ -212,6 +212,65 @@ void bfin_hibernate(unsigned long mask)
void bf609_cpu_pm_enter(suspend_state_t state)
{
int error;
unsigned long wakeup = 0;
unsigned long wakeup_pol = 0;
#ifdef CONFIG_PM_BFIN_WAKE_PA15
wakeup |= PA15WE;
# if CONFIG_PM_BFIN_WAKE_PA15_POL
wakeup_pol |= PA15WE;
# endif
#endif
#ifdef CONFIG_PM_BFIN_WAKE_PB15
wakeup |= PB15WE;
# if CONFIG_PM_BFIN_WAKE_PA15_POL
wakeup_pol |= PB15WE;
# endif
#endif
#ifdef CONFIG_PM_BFIN_WAKE_PC15
wakeup |= PC15WE;
# if CONFIG_PM_BFIN_WAKE_PC15_POL
wakeup_pol |= PC15WE;
# endif
#endif
#ifdef CONFIG_PM_BFIN_WAKE_PD06
wakeup |= PD06WE;
# if CONFIG_PM_BFIN_WAKE_PD06_POL
wakeup_pol |= PD06WE;
# endif
#endif
#ifdef CONFIG_PM_BFIN_WAKE_PE12
wakeup |= PE12WE;
# if CONFIG_PM_BFIN_WAKE_PE12_POL
wakeup_pol |= PE12WE;
# endif
#endif
#ifdef CONFIG_PM_BFIN_WAKE_PG04
wakeup |= PG04WE;
# if CONFIG_PM_BFIN_WAKE_PG04_POL
wakeup_pol |= PG04WE;
# endif
#endif
#ifdef CONFIG_PM_BFIN_WAKE_PG13
wakeup |= PG13WE;
# if CONFIG_PM_BFIN_WAKE_PG13_POL
wakeup_pol |= PG13WE;
# endif
#endif
#ifdef CONFIG_PM_BFIN_WAKE_USB
wakeup |= USBWE;
# if CONFIG_PM_BFIN_WAKE_USB_POL
wakeup_pol |= USBWE;
# endif
#endif
error = irq_set_irq_wake(255, 1);
if(error < 0)
printk(KERN_DEBUG "Unable to get irq wake\n");
......@@ -220,9 +279,9 @@ void bf609_cpu_pm_enter(suspend_state_t state)
printk(KERN_DEBUG "Unable to get irq wake\n");
if (state == PM_SUSPEND_STANDBY)
bfin_deepsleep(0xffff);
bfin_deepsleep(wakeup);
else {
bfin_hibernate(0xffff);
bfin_hibernate(wakeup);
}
}
......@@ -263,26 +322,8 @@ static int __init bf609_init_pm(void)
{
int irq;
int error;
error = gpio_request(GPIO_PG4, "gpiopg4");
if (error < 0) {
printk(KERN_DEBUG "failed to request GPIO %d, error %d\n",
GPIO_PG4, error);
}
irq = gpio_to_irq(GPIO_PG4);
if (irq < 0) {
error = irq;
printk(KERN_DEBUG "Unable to get irq number for GPIO %d, error %d\n",
GPIO_PG4, error);
}
printk(KERN_DEBUG "%s gpio %d irq %d\n", __func__, GPIO_PG4, irq);
error = request_irq(irq, test_isr, IRQF_TRIGGER_FALLING | IRQF_NO_SUSPEND, "gpiopg4", NULL);
if(error < 0)
printk(KERN_DEBUG "Unable to get irq\n");
#if 1
#if CONFIG_PM_BFIN_WAKE_PE12
irq = gpio_to_irq(GPIO_PE12);
if (irq < 0) {
error = irq;
......
......@@ -437,7 +437,7 @@ static void bfin_internal_unmask_irq_chip(struct irq_data *d)
}
#endif
#ifdef CONFIG_PM
#if defined(CONFIG_PM) && !defined(CONFIG_BF60x)
int bfin_internal_set_wake(unsigned int irq, unsigned int state)
{
u32 bank, bit, wakeup = 0;
......@@ -496,6 +496,7 @@ static int bfin_internal_set_wake_chip(struct irq_data *d, unsigned int state)
return bfin_internal_set_wake(d->irq, state);
}
#else
# define bfin_internal_set_wake(irq, state)
# define bfin_internal_set_wake_chip NULL
#endif
......
......@@ -153,9 +153,6 @@ int bfin_pm_suspend_mem_enter(void)
#ifndef CONFIG_BF60x
wakeup = bfin_read_VR_CTL() & ~FREQ;
#else
#endif
wakeup |= SCKELOW;
#ifdef CONFIG_PM_BFIN_WAKE_PH6
......@@ -163,6 +160,7 @@ int bfin_pm_suspend_mem_enter(void)
#endif
#ifdef CONFIG_PM_BFIN_WAKE_GP
wakeup |= GPWE;
#endif
#endif
ret = blackfin_dma_suspend();
......
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