patch-2.3.16 linux/drivers/sbus/char/flash.c

Next file: linux/drivers/sbus/char/openprom.c
Previous file: linux/drivers/sbus/char/envctrl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.15/linux/drivers/sbus/char/flash.c linux/drivers/sbus/char/flash.c
@@ -1,4 +1,4 @@
-/* $Id: flash.c,v 1.11 1999/03/09 14:06:45 davem Exp $
+/* $Id: flash.c,v 1.13 1999/08/31 06:58:06 davem Exp $
  * flash.c: Allow mmap access to the OBP Flash, for OBP updates.
  *
  * Copyright (C) 1997  Eddie C. Dost  (ecd@skynet.be)
@@ -22,11 +22,11 @@
 #include <asm/ebus.h>
 
 static struct {
-	unsigned long read_base;
-	unsigned long write_base;
-	unsigned long read_size;
-	unsigned long write_size;
-	unsigned long busy;
+	unsigned long read_base;	/* Physical read address */
+	unsigned long write_base;	/* Physical write address */
+	unsigned long read_size;	/* Size of read area */
+	unsigned long write_size;	/* Size of write area */
+	unsigned long busy;		/* In use? */
 } flash;
 
 #define FLASH_MINOR	152
@@ -41,7 +41,7 @@
 		return -ENXIO;
 
 	if (flash.read_base == flash.write_base) {
-		addr = __pa(flash.read_base);
+		addr = flash.read_base;
 		size = flash.read_size;
 	} else {
 		if ((vma->vm_flags & VM_READ) &&
@@ -49,10 +49,10 @@
 			return -EINVAL;
 
 		if (vma->vm_flags & VM_READ) {
-			addr = __pa(flash.read_base);
+			addr = flash.read_base;
 			size = flash.read_size;
 		} else if (vma->vm_flags & VM_WRITE) {
-			addr = __pa(flash.write_base);
+			addr = flash.write_base;
 			size = flash.write_size;
 		} else
 			return -ENXIO;
@@ -152,7 +152,7 @@
 #ifdef MODULE
 int init_module(void)
 #else
-__initfunc(int flash_init(void))
+int __init flash_init(void)
 #endif
 {
 	struct linux_sbus *sbus;
@@ -167,20 +167,17 @@
 			prom_apply_sbus_ranges(sdev->my_bus, &sdev->reg_addrs[0],
 					       sdev->num_registers, sdev);
 			if (sdev->reg_addrs[0].phys_addr == sdev->reg_addrs[1].phys_addr) {
-				flash.read_base = (unsigned long)sparc_alloc_io(sdev->reg_addrs[0].phys_addr, 0,
-								 sdev->reg_addrs[0].reg_size, "flashprom",
-								 sdev->reg_addrs[0].which_io, 0);
+				flash.read_base = ((unsigned long)sdev->reg_addrs[0].phys_addr) |
+					(((unsigned long)sdev->reg_addrs[0].which_io)<<32UL);
 				flash.read_size = sdev->reg_addrs[0].reg_size;
 				flash.write_base = flash.read_base;
 				flash.write_size = flash.read_size;
 			} else {
-				flash.read_base = (unsigned long)sparc_alloc_io(sdev->reg_addrs[0].phys_addr, 0,
-								 sdev->reg_addrs[0].reg_size, "flashprom",
-								 sdev->reg_addrs[0].which_io, 0);
+				flash.read_base = ((unsigned long)sdev->reg_addrs[0].phys_addr) |
+					(((unsigned long)sdev->reg_addrs[0].which_io)<<32UL);
 				flash.read_size = sdev->reg_addrs[0].reg_size;
-				flash.write_base = (unsigned long)sparc_alloc_io(sdev->reg_addrs[1].phys_addr, 0,
-								 sdev->reg_addrs[1].reg_size, "flashprom",
-								 sdev->reg_addrs[1].which_io, 0);
+				flash.write_base = ((unsigned long)sdev->reg_addrs[1].phys_addr) |
+					(((unsigned long)sdev->reg_addrs[1].which_io)<<32UL);
 				flash.write_size = sdev->reg_addrs[1].reg_size;
 			}
 			flash.busy = 0;
@@ -207,14 +204,14 @@
 
 		nregs = len / sizeof(regs[0]);
 
-		flash.read_base = edev->base_address[0];
+		flash.read_base = edev->resource[0].start;
 		flash.read_size = regs[0].reg_size;
 
 		if (nregs == 1) {
-			flash.write_base = edev->base_address[0];
+			flash.write_base = edev->resource[0].start;
 			flash.write_size = regs[0].reg_size;
 		} else if (nregs == 2) {
-			flash.write_base = edev->base_address[1];
+			flash.write_base = edev->resource[1].start;
 			flash.write_size = regs[1].reg_size;
 		} else {
 			printk("flash: Strange number of regs %d\n", nregs);
@@ -229,8 +226,8 @@
 	}
 
 	printk("OBP Flash: RD %lx[%lx] WR %lx[%lx]\n",
-	       __pa(flash.read_base), flash.read_size,
-	       __pa(flash.write_base), flash.write_size);
+	       flash.read_base, flash.read_size,
+	       flash.write_base, flash.write_size);
 
 	err = misc_register(&flash_dev);
 	if (err) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)