Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177888
b: refs/heads/master
c: a9e8641
h: refs/heads/master
v: v3
  • Loading branch information
Wu Zhangjin authored and Ralf Baechle committed Dec 17, 2009
1 parent 0ae5570 commit f6fb1dd
Show file tree
Hide file tree
Showing 3 changed files with 80 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: f181bf60e3f31cdab48bd8b9d913201ed2f9e522
refs/heads/master: a9e8641f4c252f93875cf30cb28c0f333539f0bf
6 changes: 6 additions & 0 deletions trunk/arch/mips/loongson/lemote-2f/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
#

obj-y += irq.o reset.o

#
# Suspend Support
#

obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
73 changes: 73 additions & 0 deletions trunk/arch/mips/loongson/lemote-2f/pm.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Lemote loongson2f family machines' specific suspend support
*
* Copyright (C) 2009 Lemote Inc.
* Author: Wu Zhangjin <wuzj@lemote.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/

#include <linux/suspend.h>
#include <linux/interrupt.h>
#include <linux/pm.h>
#include <linux/i8042.h>

#include <asm/i8259.h>
#include <asm/mipsregs.h>
#include <asm/bootinfo.h>

#include <loongson.h>

#define I8042_KBD_IRQ 1
#define I8042_CTR_KBDINT 0x01
#define I8042_CTR_KBDDIS 0x10

static unsigned char i8042_ctr;

static int i8042_enable_kbd_port(void)
{
if (i8042_command(&i8042_ctr, I8042_CMD_CTL_RCTR)) {
pr_err("i8042.c: Can't read CTR while enabling i8042 kbd port."
"\n");
return -EIO;
}

i8042_ctr &= ~I8042_CTR_KBDDIS;
i8042_ctr |= I8042_CTR_KBDINT;

if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
i8042_ctr &= ~I8042_CTR_KBDINT;
i8042_ctr |= I8042_CTR_KBDDIS;
pr_err("i8042.c: Failed to enable KBD port.\n");

return -EIO;
}

return 0;
}

/*
* The i8042 is connnected to i8259A
*/
void setup_wakeup_events(void)
{
int irq_mask;

switch (mips_machtype) {
case MACH_LEMOTE_ML2F7:
case MACH_LEMOTE_YL2F89:
/* open the keyboard irq in i8259A */
outb((0xff & ~(1 << I8042_KBD_IRQ)), PIC_MASTER_IMR);
irq_mask = inb(PIC_MASTER_IMR);

/* enable keyboard port */
i8042_enable_kbd_port();
break;

default:
break;
}
}

0 comments on commit f6fb1dd

Please sign in to comment.