--- linux-2.6.9/drivers/char/watchdog/scx200_wdt.c	Mon Oct 18 23:54:38 2004
+++ linux-2.6.9_sc1200/drivers/char/watchdog/scx200_wdt.c	Sun Nov 28 00:34:28 2004
@@ -55,6 +55,8 @@
 static struct semaphore open_semaphore;
 static char expect_close;
 
+static unsigned short  cpu_base;
+
 /* Bits of the WDCNFG register */
 #define W_ENABLE 0x00fa		/* Enable watchdog */
 #define W_DISABLE 0x0000	/* Disable watchdog */
@@ -64,7 +66,7 @@
 
 static void scx200_wdt_ping(void)
 {
-	outw(wdto_restart, SCx200_CB_BASE + SCx200_WDT_WDTO);
+	outw(wdto_restart, cpu_base + SCx200_WDT_WDTO);
 }
 
 static void scx200_wdt_update_margin(void)
@@ -78,9 +80,9 @@
 	printk(KERN_DEBUG NAME ": enabling watchdog timer, wdto_restart = %d\n",
 	       wdto_restart);
 
-	outw(0, SCx200_CB_BASE + SCx200_WDT_WDTO);
-	outb(SCx200_WDT_WDSTS_WDOVF, SCx200_CB_BASE + SCx200_WDT_WDSTS);
-	outw(W_ENABLE, SCx200_CB_BASE + SCx200_WDT_WDCNFG);
+	outw(0, cpu_base + SCx200_WDT_WDTO);
+	outb(SCx200_WDT_WDSTS_WDOVF, cpu_base + SCx200_WDT_WDSTS);
+	outw(W_ENABLE, cpu_base + SCx200_WDT_WDCNFG);
 
 	scx200_wdt_ping();
 }
@@ -89,9 +91,9 @@
 {
 	printk(KERN_DEBUG NAME ": disabling watchdog timer\n");
 
-	outw(0, SCx200_CB_BASE + SCx200_WDT_WDTO);
-	outb(SCx200_WDT_WDSTS_WDOVF, SCx200_CB_BASE + SCx200_WDT_WDSTS);
-	outw(W_DISABLE, SCx200_CB_BASE + SCx200_WDT_WDCNFG);
+	outw(0, cpu_base + SCx200_WDT_WDTO);
+	outb(SCx200_WDT_WDSTS_WDOVF, cpu_base + SCx200_WDT_WDSTS);
+	outw(W_DISABLE, cpu_base + SCx200_WDT_WDCNFG);
 }
 
 static int scx200_wdt_open(struct inode *inode, struct file *file)
@@ -217,6 +219,8 @@
 static int __init scx200_wdt_init(void)
 {
 	int r;
+	struct pci_dev  *dev;
+	unsigned int     cw;
 
 	printk(KERN_DEBUG NAME ": NatSemi SCx200 Watchdog Driver\n");
 
@@ -234,11 +238,20 @@
 
 	/* More sanity checks, verify that the configuration block is there */
 	if (!scx200_cb_probe(SCx200_CB_BASE)) {
-		printk(KERN_WARNING NAME ": no configuration block found\n");
-		return -ENODEV;
-	}
+		dev = pci_find_device(PCI_VENDOR_ID_NS,0x0515,0);
+                if (dev == NULL) {
+		   printk(KERN_WARNING NAME ": no configuration block found\n");
+                   printk(KERN_WARNING NAME ": Can not find bridge device.\n");
+                   return -ENODEV;
+                }
+
+                pci_read_config_dword(dev, 0x64, &cw);
+                cpu_base = (unsigned short )cw;
+	} else {
+	   cpu_base = SCx200_CB_BASE;
+        }
 
-	if (!request_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+	if (!request_region(cpu_base + SCx200_WDT_OFFSET,
 			    SCx200_WDT_SIZE,
 			    "NatSemi SCx200 Watchdog")) {
 		printk(KERN_WARNING NAME ": watchdog I/O region busy\n");
@@ -252,7 +265,7 @@
 
 	r = misc_register(&scx200_wdt_miscdev);
 	if (r) {
-		release_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+		release_region(cpu_base + SCx200_WDT_OFFSET,
 				SCx200_WDT_SIZE);
 		return r;
 	}
@@ -261,7 +274,7 @@
 	if (r) {
 		printk(KERN_ERR NAME ": unable to register reboot notifier");
 		misc_deregister(&scx200_wdt_miscdev);
-		release_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+		release_region(cpu_base + SCx200_WDT_OFFSET,
 				SCx200_WDT_SIZE);
 		return r;
 	}
@@ -273,7 +286,7 @@
 {
 	unregister_reboot_notifier(&scx200_wdt_notifier);
 	misc_deregister(&scx200_wdt_miscdev);
-	release_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+	release_region(cpu_base + SCx200_WDT_OFFSET,
 		       SCx200_WDT_SIZE);
 }
 
