From patchwork Tue Jul 3 08:55:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chia-Lin Kao (AceLan)" X-Patchwork-Id: 1149471 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0E841DFF72 for ; Tue, 3 Jul 2012 08:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750954Ab2GCIz0 (ORCPT ); Tue, 3 Jul 2012 04:55:26 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:61675 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750818Ab2GCIzZ (ORCPT ); Tue, 3 Jul 2012 04:55:25 -0400 Received: by pbbrp8 with SMTP id rp8so8913330pbb.19 for ; Tue, 03 Jul 2012 01:55:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:x-mailer; bh=MnQ3YTUcVbO9oCRTaRST06C60RYbaNg3WaRvgzQqrh4=; b=Bukjm4c+aElElzDVfd8oGDcUzRpDlBO1dnAlxLWjsXHyz7nsaeIXsoCd8eB+E8KenU pkGzQsDp5fstDkP+QSefKAhmXQJ1jRmP0ZE24AifNjD1QYqjmjDEkYtJ6yN4ngzbiuui 6/C1mK+GYYVpZQXWX78UizEpSKNzrRAheNZ47AZzI1vAynKW9cts2/gD5hc+/2rlbAhJ jD6vbmdb2kxv//sWtFA9JH6QqBiNJ5Rg3FvtWnyjo6JKAbUDwbJhYbACceGrIvLF/muE YYmaHufhlu4s3G4M9a5WDkABZeBSfRX6bSBOWIeTqRLstkUNyV4BuvfsMR8220ZbO5BC 7oLw== Received: by 10.68.239.9 with SMTP id vo9mr5378576pbc.41.1341305725305; Tue, 03 Jul 2012 01:55:25 -0700 (PDT) Received: from localhost ([210.242.151.101]) by mx.google.com with ESMTPS id rd7sm15121335pbc.70.2012.07.03.01.55.23 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 01:55:24 -0700 (PDT) From: AceLan Kao To: linux-pci@vger.kernel.org, Bjorn Helgaas Subject: [PATCH] PCI: Quirk for ASUS S3 issue Date: Tue, 3 Jul 2012 16:55:09 +0800 Message-Id: <1341305709-8943-1-git-send-email-acelan.kao@canonical.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Some of ASUS machines have problem to enter S3. The root cause of this issue is result from the the BIOS will try to disable USBs which was already disabled by driver. BIOS will to check the EHCI command register, if it's not zero, then BIOS will think the USB is not disabled yet, so it will try to disable USB again. To resolve this, we should clear the EHCI command register before entering S3. And this does no harm to the system, since it'll switch off the power after enter S3, so the value in memory is not important at all. Signed-off-by: AceLan Kao --- drivers/pci/quirks.c | 15 +++++++++++++++ include/linux/pci_ids.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 194b243a..684cd1f 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -2955,6 +2955,21 @@ static void __devinit asus_ehci_no_d3(struct pci_dev *dev) DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1c26, asus_ehci_no_d3); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x1c2d, asus_ehci_no_d3); +/* + * ASUS BIOS will check EHCI command register to see if USB if disabled + * or not. BIOS will try to disable USB if the command register is not + * cleared. But, actually, USB is disabled by the driver while entering S3, + * so it'll hang in BIOS when it try to disable USB. + * Since it's going to enter S3, so it does no harm to clear the command + * register. + */ +static void asus_clear_pci_command(struct pci_dev *dev) +{ + pci_write_config_word(dev, PCI_COMMAND, 0); +} +DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON_EHCI, asus_clear_memory_bit); +DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_EHCI, asus_clear_memory_bit); + static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f, struct pci_fixup *end) { diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index ab741b0..e79c469 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -216,6 +216,7 @@ #define PCI_DEVICE_ID_ATI_68800 0x4158 #define PCI_DEVICE_ID_ATI_215CT222 0x4354 #define PCI_DEVICE_ID_ATI_210888CX 0x4358 +#define PCI_DEVICE_ID_ATI_EHCI 0x4396 #define PCI_DEVICE_ID_ATI_215ET222 0x4554 /* Mach64 / Rage */ #define PCI_DEVICE_ID_ATI_215GB 0x4742 @@ -553,6 +554,7 @@ #define PCI_DEVICE_ID_AMD_8131_BRIDGE 0x7450 #define PCI_DEVICE_ID_AMD_8131_APIC 0x7451 #define PCI_DEVICE_ID_AMD_8132_BRIDGE 0x7458 +#define PCI_DEVICE_ID_AMD_HUDSON_EHCI 0x7808 #define PCI_DEVICE_ID_AMD_HUDSON2_SMBUS 0x780b #define PCI_DEVICE_ID_AMD_CS5535_IDE 0x208F #define PCI_DEVICE_ID_AMD_CS5536_ISA 0x2090