提交 bb84dbf6 编写于 作者: M Michael Hennerich 提交者: Mike Frysinger

Blackfin: punt Blackfin-specific GPIO wakeup API

This patch removes a custom GPIO wakeup API which allowed GPIOs to act
as wakeup sources, which are not configured as Interrupts.
This API is a leftover from the time before irq_wake was established.
From now on people must use enable_irq_wake(GPIO_IRQx) and the GPIO in
question needs to be configured as Interrupt.
Signed-off-by: NMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: NMike Frysinger <vapier@gentoo.org>
上级 85eb0e4b
...@@ -1187,32 +1187,6 @@ config PM_BFIN_SLEEP ...@@ -1187,32 +1187,6 @@ config PM_BFIN_SLEEP
If unsure, select "Sleep Deeper". If unsure, select "Sleep Deeper".
endchoice endchoice
config PM_WAKEUP_BY_GPIO
bool "Allow Wakeup from Standby by GPIO"
depends on PM && !BF54x
config PM_WAKEUP_GPIO_NUMBER
int "GPIO number"
range 0 47
depends on PM_WAKEUP_BY_GPIO
default 2
choice
prompt "GPIO Polarity"
depends on PM_WAKEUP_BY_GPIO
default PM_WAKEUP_GPIO_POLAR_H
config PM_WAKEUP_GPIO_POLAR_H
bool "Active High"
config PM_WAKEUP_GPIO_POLAR_L
bool "Active Low"
config PM_WAKEUP_GPIO_POLAR_EDGE_F
bool "Falling EDGE"
config PM_WAKEUP_GPIO_POLAR_EDGE_R
bool "Rising EDGE"
config PM_WAKEUP_GPIO_POLAR_EDGE_B
bool "Both EDGE"
endchoice
comment "Possible Suspend Mem / Hibernate Wake-Up Sources" comment "Possible Suspend Mem / Hibernate Wake-Up Sources"
depends on PM depends on PM
......
...@@ -167,23 +167,23 @@ int bfin_special_gpio_request(unsigned gpio, const char *label); ...@@ -167,23 +167,23 @@ int bfin_special_gpio_request(unsigned gpio, const char *label);
#endif #endif
#ifdef CONFIG_PM #ifdef CONFIG_PM
int bfin_pm_standby_ctrl(unsigned ctrl);
unsigned int bfin_pm_standby_setup(void); static inline int bfin_pm_standby_setup(void)
void bfin_pm_standby_restore(void); {
return bfin_pm_standby_ctrl(1);
}
static inline void bfin_pm_standby_restore(void)
{
bfin_pm_standby_ctrl(0);
}
void bfin_gpio_pm_hibernate_restore(void); void bfin_gpio_pm_hibernate_restore(void);
void bfin_gpio_pm_hibernate_suspend(void); void bfin_gpio_pm_hibernate_suspend(void);
#ifndef CONFIG_BF54x #ifndef CONFIG_BF54x
#define PM_WAKE_RISING 0x1 int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
#define PM_WAKE_FALLING 0x2
#define PM_WAKE_HIGH 0x4
#define PM_WAKE_LOW 0x8
#define PM_WAKE_BOTH_EDGES (PM_WAKE_RISING | PM_WAKE_FALLING)
#define PM_WAKE_IGNORE 0xF0
int gpio_pm_wakeup_request(unsigned gpio, unsigned char type);
void gpio_pm_wakeup_free(unsigned gpio);
struct gpio_port_s { struct gpio_port_s {
unsigned short data; unsigned short data;
......
...@@ -475,9 +475,7 @@ GET_GPIO_P(maskb) ...@@ -475,9 +475,7 @@ GET_GPIO_P(maskb)
#ifdef CONFIG_PM #ifdef CONFIG_PM
static unsigned short wakeup_map[GPIO_BANK_NUM]; static unsigned short wakeup_map[GPIO_BANK_NUM];
static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
static const unsigned int sic_iwr_irqs[] = { static const unsigned int sic_iwr_irqs[] = {
#if defined(BF533_FAMILY) #if defined(BF533_FAMILY)
...@@ -514,112 +512,26 @@ static const unsigned int sic_iwr_irqs[] = { ...@@ -514,112 +512,26 @@ static const unsigned int sic_iwr_irqs[] = {
************************************************************* *************************************************************
* MODIFICATION HISTORY : * MODIFICATION HISTORY :
**************************************************************/ **************************************************************/
int gpio_pm_wakeup_request(unsigned gpio, unsigned char type) int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl)
{ {
unsigned long flags; unsigned long flags;
if ((check_gpio(gpio) < 0) || !type) if (check_gpio(gpio) < 0)
return -EINVAL; return -EINVAL;
local_irq_save_hw(flags); local_irq_save_hw(flags);
if (ctrl)
wakeup_map[gpio_bank(gpio)] |= gpio_bit(gpio); wakeup_map[gpio_bank(gpio)] |= gpio_bit(gpio);
wakeup_flags_map[gpio] = type; else
local_irq_restore_hw(flags);
return 0;
}
EXPORT_SYMBOL(gpio_pm_wakeup_request);
void gpio_pm_wakeup_free(unsigned gpio)
{
unsigned long flags;
if (check_gpio(gpio) < 0)
return;
local_irq_save_hw(flags);
wakeup_map[gpio_bank(gpio)] &= ~gpio_bit(gpio); wakeup_map[gpio_bank(gpio)] &= ~gpio_bit(gpio);
set_gpio_maskb(gpio, ctrl);
local_irq_restore_hw(flags); local_irq_restore_hw(flags);
}
EXPORT_SYMBOL(gpio_pm_wakeup_free);
static int bfin_gpio_wakeup_type(unsigned gpio, unsigned char type)
{
port_setup(gpio, GPIO_USAGE);
set_gpio_dir(gpio, 0);
set_gpio_inen(gpio, 1);
if (type & (PM_WAKE_RISING | PM_WAKE_FALLING))
set_gpio_edge(gpio, 1);
else
set_gpio_edge(gpio, 0);
if ((type & (PM_WAKE_BOTH_EDGES)) == (PM_WAKE_BOTH_EDGES))
set_gpio_both(gpio, 1);
else
set_gpio_both(gpio, 0);
if ((type & (PM_WAKE_FALLING | PM_WAKE_LOW)))
set_gpio_polar(gpio, 1);
else
set_gpio_polar(gpio, 0);
SSYNC();
return 0;
}
u32 bfin_pm_standby_setup(void)
{
u16 bank, mask, i, gpio;
for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
mask = wakeup_map[gpio_bank(i)];
bank = gpio_bank(i);
gpio_bank_saved[bank].maskb = gpio_array[bank]->maskb;
gpio_array[bank]->maskb = 0;
if (mask) {
#if defined(CONFIG_BF52x) || defined(BF537_FAMILY) || defined(CONFIG_BF51x)
gpio_bank_saved[bank].fer = *port_fer[bank];
#endif
gpio_bank_saved[bank].inen = gpio_array[bank]->inen;
gpio_bank_saved[bank].polar = gpio_array[bank]->polar;
gpio_bank_saved[bank].dir = gpio_array[bank]->dir;
gpio_bank_saved[bank].edge = gpio_array[bank]->edge;
gpio_bank_saved[bank].both = gpio_array[bank]->both;
gpio_bank_saved[bank].reserved =
reserved_gpio_map[bank];
gpio = i;
while (mask) {
if ((mask & 1) && (wakeup_flags_map[gpio] !=
PM_WAKE_IGNORE)) {
reserved_gpio_map[gpio_bank(gpio)] |=
gpio_bit(gpio);
bfin_gpio_wakeup_type(gpio,
wakeup_flags_map[gpio]);
set_gpio_data(gpio, 0); /*Clear*/
}
gpio++;
mask >>= 1;
}
bfin_internal_set_wake(sic_iwr_irqs[bank], 1);
gpio_array[bank]->maskb_set = wakeup_map[gpio_bank(i)];
}
}
AWA_DUMMY_READ(maskb_set);
return 0; return 0;
} }
void bfin_pm_standby_restore(void) int bfin_pm_standby_ctrl(unsigned ctrl)
{ {
u16 bank, mask, i; u16 bank, mask, i;
...@@ -627,24 +539,10 @@ void bfin_pm_standby_restore(void) ...@@ -627,24 +539,10 @@ void bfin_pm_standby_restore(void)
mask = wakeup_map[gpio_bank(i)]; mask = wakeup_map[gpio_bank(i)];
bank = gpio_bank(i); bank = gpio_bank(i);
if (mask) { if (mask)
#if defined(CONFIG_BF52x) || defined(BF537_FAMILY) || defined(CONFIG_BF51x) bfin_internal_set_wake(sic_iwr_irqs[bank], ctrl);
*port_fer[bank] = gpio_bank_saved[bank].fer;
#endif
gpio_array[bank]->inen = gpio_bank_saved[bank].inen;
gpio_array[bank]->dir = gpio_bank_saved[bank].dir;
gpio_array[bank]->polar = gpio_bank_saved[bank].polar;
gpio_array[bank]->edge = gpio_bank_saved[bank].edge;
gpio_array[bank]->both = gpio_bank_saved[bank].both;
reserved_gpio_map[bank] =
gpio_bank_saved[bank].reserved;
bfin_internal_set_wake(sic_iwr_irqs[bank], 0);
} }
return 0;
gpio_array[bank]->maskb = gpio_bank_saved[bank].maskb;
}
AWA_DUMMY_READ(maskb);
} }
void bfin_gpio_pm_hibernate_suspend(void) void bfin_gpio_pm_hibernate_suspend(void)
...@@ -708,16 +606,11 @@ void bfin_gpio_pm_hibernate_restore(void) ...@@ -708,16 +606,11 @@ void bfin_gpio_pm_hibernate_restore(void)
#else /* CONFIG_BF54x */ #else /* CONFIG_BF54x */
#ifdef CONFIG_PM #ifdef CONFIG_PM
u32 bfin_pm_standby_setup(void) int bfin_pm_standby_ctrl(unsigned ctrl)
{ {
return 0; return 0;
} }
void bfin_pm_standby_restore(void)
{
}
void bfin_gpio_pm_hibernate_suspend(void) void bfin_gpio_pm_hibernate_suspend(void)
{ {
int i, bank; int i, bank;
......
...@@ -662,14 +662,7 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) ...@@ -662,14 +662,7 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
#ifdef CONFIG_PM #ifdef CONFIG_PM
int bfin_gpio_set_wake(unsigned int irq, unsigned int state) int bfin_gpio_set_wake(unsigned int irq, unsigned int state)
{ {
unsigned gpio = irq_to_gpio(irq); return gpio_pm_wakeup_ctrl(irq_to_gpio(irq), state);
if (state)
gpio_pm_wakeup_request(gpio, PM_WAKE_IGNORE);
else
gpio_pm_wakeup_free(gpio);
return 0;
} }
#endif #endif
......
...@@ -20,35 +20,11 @@ ...@@ -20,35 +20,11 @@
#include <asm/dma.h> #include <asm/dma.h>
#include <asm/dpmc.h> #include <asm/dpmc.h>
#ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_H
#define WAKEUP_TYPE PM_WAKE_HIGH
#endif
#ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_L
#define WAKEUP_TYPE PM_WAKE_LOW
#endif
#ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_EDGE_F
#define WAKEUP_TYPE PM_WAKE_FALLING
#endif
#ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_EDGE_R
#define WAKEUP_TYPE PM_WAKE_RISING
#endif
#ifdef CONFIG_PM_WAKEUP_GPIO_POLAR_EDGE_B
#define WAKEUP_TYPE PM_WAKE_BOTH_EDGES
#endif
void bfin_pm_suspend_standby_enter(void) void bfin_pm_suspend_standby_enter(void)
{ {
unsigned long flags; unsigned long flags;
#ifdef CONFIG_PM_WAKEUP_BY_GPIO
gpio_pm_wakeup_request(CONFIG_PM_WAKEUP_GPIO_NUMBER, WAKEUP_TYPE);
#endif
local_irq_save_hw(flags); local_irq_save_hw(flags);
bfin_pm_standby_setup(); bfin_pm_standby_setup();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册