Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182143
b: refs/heads/master
c: e275ed5
h: refs/heads/master
i:
  182141: 6f979f6
  182139: fed5204
  182135: 49e6a3c
  182127: 4f3f461
  182111: 6fc68cf
  182079: 7af2a49
  182015: 2aa4647
v: v3
  • Loading branch information
Manuel Lauss authored and Ralf Baechle committed Feb 27, 2010
1 parent 074fe09 commit 4459327
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 81fc0179541dd52763cf62a52f0c09a05bcc6439
refs/heads/master: e275ed5ee94b358964a0dae1c8b49f0bff260b60
32 changes: 32 additions & 0 deletions trunk/arch/mips/alchemy/devboards/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/sysfs.h>
#include <asm/mach-au1x00/au1000.h>
#include <asm/mach-au1x00/gpio.h>
#include <asm/mach-db1x00/bcsr.h>

/*
* Generic suspend userspace interface for Alchemy development boards.
Expand All @@ -26,6 +27,20 @@ static unsigned long db1x_pm_last_wakesrc;

static int db1x_pm_enter(suspend_state_t state)
{
unsigned short bcsrs[16];
int i, j, hasint;

/* save CPLD regs */
hasint = bcsr_read(BCSR_WHOAMI);
hasint = BCSR_WHOAMI_BOARD(hasint) >= BCSR_WHOAMI_DB1200;
j = (hasint) ? BCSR_MASKSET : BCSR_SYSTEM;

for (i = BCSR_STATUS; i <= j; i++)
bcsrs[i] = bcsr_read(i);

/* shut off hexleds */
bcsr_write(BCSR_HEXCLEAR, 3);

/* enable GPIO based wakeup */
alchemy_gpio1_input_enable();

Expand All @@ -52,6 +67,23 @@ static int db1x_pm_enter(suspend_state_t state)
/* ...and now the sandman can come! */
au_sleep();


/* restore CPLD regs */
for (i = BCSR_STATUS; i <= BCSR_SYSTEM; i++)
bcsr_write(i, bcsrs[i]);

/* restore CPLD int registers */
if (hasint) {
bcsr_write(BCSR_INTCLR, 0xffff);
bcsr_write(BCSR_MASKCLR, 0xffff);
bcsr_write(BCSR_INTSTAT, 0xffff);
bcsr_write(BCSR_INTSET, bcsrs[BCSR_INTSET]);
bcsr_write(BCSR_MASKSET, bcsrs[BCSR_MASKSET]);
}

/* light up hexleds */
bcsr_write(BCSR_HEXCLEAR, 0);

return 0;
}

Expand Down

0 comments on commit 4459327

Please sign in to comment.