X60: use EC events 0x50/0x58 instead of GPIO GPE for Docking/Undocking

Change-Id: I674e5166f5fb7ba299e6f1231f30434a5bf731c5
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Reviewed-on: http://review.coreboot.org/161
Tested-by: build bot (Jenkins)
This commit is contained in:
Sven Schnelle 2011-07-11 18:36:16 +02:00
parent d819853f85
commit 8d0b86c9ab
6 changed files with 57 additions and 19 deletions

View File

@ -39,7 +39,6 @@ Scope (\_SB)
Method(_DCK, 1, NotSerialized)
{
if (Arg0) {
Sleep(250)
/* connect dock */
TRAP(SMI_DOCK_CONNECT)
} else {
@ -53,7 +52,7 @@ Scope (\_SB)
Method(_STA, 0, NotSerialized)
{
Return (DSTA)
Return (DSTA)
}
}
}
@ -64,4 +63,15 @@ Scope(\_SB.PCI0.LPCB.EC)
{
Notify(\_SB.DOCK, 3)
}
Method(_Q50, 0, NotSerialized)
{
Notify(\_SB.DOCK, 3)
}
Method(_Q58, 0, NotSerialized)
{
Notify(\_SB.DOCK, 0)
}
}

View File

@ -27,16 +27,4 @@ Scope (\_GPE)
/* Read EC register to clear wake status */
Store(\_SB.PCI0.LPCB.EC.WAKE, Local0)
}
/* SLICE_ON_3M GPE (Dock status) */
Method(_L1D, 0, NotSerialized)
{
if (GP13) {
Or(GIV1, 0x20, GIV1)
Notify(\_SB.DOCK, 3)
} else {
And(GIV1, 0xdf, GIV1)
Notify(\_SB.DOCK, 0)
}
}
}

View File

@ -86,6 +86,7 @@ chip northbridge/intel/i945
device pnp ff.1 on # dummy
end
register "backlight_enable" = "0x01"
register "dock_event_enable" = "0x01"
end
chip ec/lenovo/h8
device pnp ff.2 on # dummy
@ -98,7 +99,7 @@ chip northbridge/intel/i945
register "config0" = "0xa6"
register "config1" = "0x05"
register "config2" = "0xa0"
register "config3" = "0x05"
register "config3" = "0x01"
register "beepmask0" = "0xfe"
register "beepmask1" = "0x96"
@ -107,7 +108,15 @@ chip northbridge/intel/i945
register "event3_enable" = "0xff"
register "event4_enable" = "0xf4"
register "event5_enable" = "0x3c"
register "event6_enable" = "0x80"
register "event7_enable" = "0x01"
register "eventc_enable" = "0x3c"
register "event8_enable" = "0x01"
register "event9_enable" = "0xff"
register "eventa_enable" = "0xff"
register "eventb_enable" = "0xff"
register "eventc_enable" = "0xff"
register "eventd_enable" = "0xff"
register "wlan_enable" = "0x01"
register "trackpoint_enable" = "0x03"

View File

@ -132,10 +132,12 @@ int dock_connect(void)
/* Assert D_PLTRST# */
outb(0xfe, 0x1680);
udelay(1000);
udelay(100000);
/* Deassert D_PLTRST# */
outb(0xff, 0x1680);
udelay(1000);
/* startup 14.318MHz Clock */
dock_write_register(0x29, 0x06);
/* wait until clock is settled */
@ -232,11 +234,17 @@ int dock_connect(void)
/* Enable USB and Ultrabay power */
outb(0x03, 0x1628);
dock_write_register(0x07, 0x03);
dock_write_register(0x30, 0x01);
console_init();
return 0;
}
void dock_disconnect(void)
{
/* disable Ultrabay and USB Power */
outb(0x00, 0x1628);
/* disconnect LPC bus */
outb(0x00, 0x164c);
/* Assert PLTRST and DLPCPD */

View File

@ -45,6 +45,12 @@ static void mainboard_enable(device_t dev)
/* enable Audio */
h8_set_audio_mute(0);
ec_clr_bit(0x03, 2);
if (inb(0x164c) & 0x08) {
ec_set_bit(0x03, 2);
ec_write(0x0c, 0x88);
}
/* If we're resuming from suspend, blink suspend LED */
dev0 = dev_find_slot(0, PCI_DEVFN(0,0));
if (dev0 && pci_read_config32(dev0, SKPAD) == SKPAD_ACPI_S3_MAGIC)

View File

@ -71,19 +71,23 @@ int mainboard_io_trap_handler(int smif)
switch (smif) {
case SMI_DOCK_CONNECT:
ec_clr_bit(0x03, 2);
dlpc_init();
if (!dock_connect()) {
if (!dlpc_init() && !dock_connect()) {
ec_set_bit(0x03, 2);
/* set dock LED to indicate status */
ec_write(0x0c, 0x09);
ec_write(0x0c, 0x88);
} else {
/* blink dock LED to indicate failure */
ec_write(0x0c, 0xc8);
ec_write(0x0c, 0x08);
ec_write(0x0c, 0xc9);
}
break;
case SMI_DOCK_DISCONNECT:
ec_clr_bit(0x03, 2);
dock_disconnect();
ec_write(0x0c, 0x08);
break;
case SMI_SAVE_CMOS:
@ -136,6 +140,19 @@ static void mainboard_smi_handle_ec_sci(void)
mainboard_smi_brightness_down();
mainboard_smi_save_cmos();
break;
/* Fn-F9 key */
case 0x18:
/* Power loss */
case 0x27:
/* Undock Key */
case 0x50:
mainboard_io_trap_handler(SMI_DOCK_DISCONNECT);
break;
/* Dock Event */
case 0x37:
case 0x58:
mainboard_io_trap_handler(SMI_DOCK_CONNECT);
break;
default:
break;
}