All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Enrico Bartky" <DOSProfi@web.de>
To: linux-kernel@vger.kernel.org
Subject: PATCH for 2.6: Enabling disabled M7101 device (quirks.c)
Date: Tue, 18 Jan 2005 17:10:59 +0100	[thread overview]
Message-ID: <768486802@web.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

Hello,

I have ported the prog/hotplug/m7101.c module from lm_sensors for kernel 2.6. Here is the patch.

EnricoB
______________________________________________________________
Verschicken Sie romantische, coole und witzige Bilder per SMS!
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193

[-- Attachment #2: i2c.diff --]
[-- Type: application/octet-stream, Size: 1913 bytes --]

--- quirks.c.old	2004-12-24 22:33:49.000000000 +0100
+++ quirks.c	2005-01-18 16:46:57.057499248 +0100
@@ -19,6 +19,8 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 
+#include "pci.h"
+
 #undef DEBUG
 
 /* Deal with broken BIOS'es that neglect to enable passive release,
@@ -280,6 +282,74 @@
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL,	PCI_DEVICE_ID_AL_M7101,		quirk_ali7101_acpi );
 
+/* ALi 1533 fixup to enable the M7101 SMBus Controller
+ *          ported from prog/hotplug of the lm_sensors
+ *          package
+ */
+static void __devinit quirk_ali1533_smbus(struct pci_dev *dev)
+{
+	u8 val = 0;
+	struct pci_dev *m7101;
+	
+	printk ( "M7101: Looking for disabled device... " );
+	
+	m7101 = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL);
+	
+	if ( m7101 )
+	{
+		printk ( "not found!\n" );
+		return;
+	}
+
+	pci_read_config_byte ( dev, 0x5F, &val );
+
+	if ( val & 0x4 )
+	{
+		printk ( "found.\n" );	
+		printk ( "M7101: Enabling M7101 device ... " );
+
+	    	pci_write_config_byte ( dev, 0x5F, val & 0xFB );
+		pci_read_config_byte ( dev, 0x5F, &val );
+
+		if ( val & 0x4 )
+		{
+			printk ( "failed.\n" );
+			return;
+		}
+		
+		printk ( "OK.\n" );
+	}
+	else
+		printk ( "not found.\n" );
+
+	m7101 = pci_scan_single_device ( dev->bus, 0x18 );
+
+	printk ( "M7101: Do we need to unlock registers? ... " );
+
+	if ( pci_read_config_byte ( m7101, 0x05B, &val ) )
+	{
+		printk ( "Failed to read.\n");
+		return;
+	}
+
+	if ( val & 0x06 )
+	{
+		printk ( "yes\n" );
+		printk ( "M7101: Unlocking registers ..." );
+		
+		val = val & ~0x06;
+
+		if ( pci_write_config_byte ( m7101, 0x05B, val ) )
+		{
+			printk ( "failed.\n" );
+			return;
+		}
+
+		printk ( "OK.\n" );
+	}
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL,	PCI_DEVICE_ID_AL_M1533,		quirk_ali1533_smbus );
+
 /*
  * PIIX4 ACPI: Two IO regions pointed to by longwords at
  *	0x40 (64 bytes of ACPI registers)

                 reply	other threads:[~2005-01-18 16:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=768486802@web.de \
    --to=dosprofi@web.de \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.