mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Carlos Corbacho <cathectic@slackadelic.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org,
	Mikko Tiihonen <mikko.tiihonen@iki.fi>,
	Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Subject: [PATCH] x86: Force enable HPET for CK804 (nForce 4) chipsets
Date: Fri, 19 Oct 2007 18:51:27 +0100	[thread overview]
Message-ID: <200710191851.28639.cathectic@slackadelic.com> (raw)
In-Reply-To: <alpine.LFD.0.9999.0710191736280.22770@localhost.localdomain>

From: Carlos Corbacho <cathectic@gmail.com>

This patch adds a quirk from LinuxBIOS to force enable HPET on
the nVidia CK804 (nForce 4) chipset.

This quirk can very likely support more than just nForce 4
(LinuxBIOS use the same code for nForce 5), and possibly nForce 3,
but I don't have those chipsets, so cannot add and test them.

Tested on an Abit KN9 (CK804).

Signed-off-by: Carlos Corbacho <cathectic@gmail.com>
---
Thomas,

I've rewritten the code based on what LinuxBIOS does, since they have a better idea
of how to drive the HPET than I do. I've tested this code, and it's also working
fine here on my system.

 Documentation/kernel-parameters.txt |    3 +-
 arch/x86/kernel/quirks.c            |   36 ++++++++++++++++++++++++++++++++++-
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 983f631..8abbfe6 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -434,7 +434,8 @@ and is between 256 and 4096 characters. It is defined in the file
 	hpet=		[X86-32,HPET] option to control HPET usage
 			Format: { enable (default) | disable | force }
 			disable: disable HPET and use PIT instead
-			force: allow force enabled of undocumented chips (ICH4, VIA)
+			force: allow force enabled of undocumented chips (ICH4,
+			VIA, nVidia)
 
 	com20020=	[HW,NET] ARCnet - COM20020 chipset
 			Format:
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index a4ce191..cb21bcb 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -60,7 +60,8 @@ static enum {
 	NONE_FORCE_HPET_RESUME,
 	OLD_ICH_FORCE_HPET_RESUME,
 	ICH_FORCE_HPET_RESUME,
-	VT8237_FORCE_HPET_RESUME
+	VT8237_FORCE_HPET_RESUME,
+	NVIDIA_FORCE_HPET_RESUME,
 } force_hpet_resume_type;
 
 static void __iomem *rcba_base;
@@ -321,6 +322,36 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235,
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237,
 			 vt8237_force_enable_hpet);
 
+/*
+ * Undocumented chipset feature taken from LinuxBIOS.
+ */
+static void nvidia_force_hpet_resume(void)
+{
+	pci_write_config_dword(cached_dev, 0x44, 0xfed00001);
+	printk(KERN_DEBUG "Force enabled HPET at resume\n");
+}
+
+static void nvidia_force_enable_hpet(struct pci_dev *dev)
+{
+	u32 uninitialized_var(val);
+
+	if (!hpet_force_user || hpet_address || force_hpet_address)
+		return;
+
+	pci_write_config_dword(dev, 0x44, 0xfed00001);
+	pci_read_config_dword(dev, 0x44, &val);
+	force_hpet_address = val & 0xfffffffe;
+	printk(KERN_DEBUG "Force enabled HPET at base address 0x%lx\n",
+		force_hpet_address);
+	cached_dev = dev;
+	return;
+}
+
+/* ISA Bridges */
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0050,
+			nvidia_force_enable_hpet);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_NVIDIA, 0x0051,
+			nvidia_force_enable_hpet);
 
 void force_hpet_resume(void)
 {
@@ -334,6 +365,9 @@ void force_hpet_resume(void)
 	    case VT8237_FORCE_HPET_RESUME:
 		return vt8237_force_hpet_resume();
 
+	    case NVIDIA_FORCE_HPET_RESUME:
+		return nvidia_force_hpet_resume();
+
 	    default:
 		break;
 	}
-- 
1.5.2.2

  reply	other threads:[~2007-10-19 17:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-19  3:23 nVidia HPET force enable - merge requirements? (resend) Carlos Corbacho
2007-10-19  6:50 ` Thomas Gleixner
2007-10-19 15:29   ` Carlos Corbacho
2007-10-19 16:19     ` Thomas Gleixner
2007-10-19 17:51       ` Carlos Corbacho [this message]
2007-10-19 17:58         ` [PATCH] x86: Force enable HPET for CK804 (nForce 4) chipsets Thomas Gleixner
2007-10-19 18:07           ` [PATCH] x86: Fix resume for nVidia and force_hpet Carlos Corbacho
2007-10-19 18:15             ` Thomas Gleixner
2007-10-19 18:34               ` x86: Add HPET force support for MCP55 (nForce 5) chipsets Carlos Corbacho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200710191851.28639.cathectic@slackadelic.com \
    --to=cathectic@slackadelic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikko.tiihonen@iki.fi \
    --cc=tglx@linutronix.de \
    --cc=venkatesh.pallipadi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome