public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PATCH for 2.6: Enabling disabled M7101 device (quirks.c)
@ 2005-01-18 16:10 Enrico Bartky
  0 siblings, 0 replies; only message in thread
From: Enrico Bartky @ 2005-01-18 16:10 UTC (permalink / raw)
  To: linux-kernel

[-- 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-18 16:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-18 16:10 PATCH for 2.6: Enabling disabled M7101 device (quirks.c) Enrico Bartky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox