Resent-Date: Thu, 12 Nov 1998 19:56:30 +0100 (MET)
Date: Thu, 12 Nov 1998 18:57:15 GMT
From: Jesper Skov <jskov@cygnus.co.uk>
To: linux-m68k@lists.linux-m68k.org
Subject: 2.1.127 video & char patch
Resent-From: linux-m68k@phil.uni-sb.de

Hi

A few driver patches.

Jesper

o Avoid virt_to_phys calls in video drivers.
o Fix m68kserial compile problem. Don't know if semantics are entirely 
  correct though. (btw, the driver might hang at jiffies wraparound)
o Add CONFIG_APUS to a few ifdef(__m68000__) conditions.

----------------------------------------------------------------------------
BASE: drivers/video
----------------------------------------------------------------------------

diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.127/drivers/video/clgenfb.c ./clgenfb.c
--- /home/jskov/kernel/dist/linux-2.1.127/drivers/video/clgenfb.c	Thu Nov 12 17:34:11 1998
+++ ./clgenfb.c	Thu Nov 12 17:56:52 1998
@@ -16,7 +16,6 @@
 #include <asm/amigahw.h>
 #include <asm/pgtable.h>
 #include <asm/delay.h>
-#include <asm/io.h>
 
 #include <video/fbcon.h>
 #include <video/fbcon-mfb.h>
@@ -90,6 +89,9 @@
     int btype;
     int smallboard;
     unsigned char SFR; /* Shadow of special function register */
+
+    unsigned long fbmem_phys;
+    unsigned long fbregs_phys;
     
     struct clgenfb_par currentmode;
     union {
@@ -334,7 +336,7 @@
     memset(fix, 0, sizeof(struct fb_fix_screeninfo));
     strcpy(fix->id, clgenfb_name);
 	
-    fix->smem_start	= (char*) virt_to_phys((void*)_info->fbmem);
+    fix->smem_start	= (char*) _info->fbmem_phys;
     
     /* monochrome: only 1 memory plane */
     /* 8 bit and above: Use whole memory area */
@@ -347,7 +349,7 @@
     fix->ypanstep	= 1;
     fix->ywrapstep	= 0;
     fix->line_length	= _par->line_length;
-    fix->mmio_start	= (char*) virt_to_phys ((void *)_info->regs);
+    fix->mmio_start	= (char*) _info->fbregs_phys;
     fix->mmio_len	= 0x10000;
     fix->accel		= FB_ACCEL_NONE;
 
@@ -411,7 +413,7 @@
     
     /* use highest possible virtual resolution */
     if (_par->var.xres_virtual == -1 &&
-	_par->var.xres_virtual == -1)
+	_par->var.yres_virtual == -1)
     {
 	printk("clgen: using maximum available virtual resolution\n");
 	for (i=0; modes[i].xres != -1; i++)
@@ -1535,8 +1537,10 @@
 	                                      KERNELMAP_NOCACHE_SER, NULL);
         DEBUG printk(KERN_INFO "clgen: Virtual address for board set to: $%p\n", fb_info->regs);
 	fb_info->regs += 0x600000;
+	fb_info->fbregs_phys = board_addr + 0x600000;
 
-	fb_info->fbmem = kernel_map(board_addr + 16777216, 16777216, 
+	fb_info->fbmem_phys = board_addr + 16777216;
+	fb_info->fbmem = kernel_map(fb_info->fbmem_phys, 16777216, 
 			      KERNELMAP_NOCACHE_SER, NULL);
 	DEBUG printk(KERN_INFO "clgen: (RAM start set to: $%lx)\n", fb_info->fbmem);
     }
@@ -1545,6 +1549,7 @@
         cd2 = zorro_get_board(key2);
         printk(" REG at $%lx\n", (unsigned long)cd2->cd_BoardAddr);
 
+	fb_info->fbmem_phys = board_addr;
         if (board_addr > 0x01000000)
 	    fb_info->fbmem = kernel_map(board_addr, board_size, 
 				  KERNELMAP_NOCACHE_SER, NULL);
@@ -1553,6 +1558,7 @@
 
         /* set address for REG area of board */
 	fb_info->regs = (unsigned char *)ZTWO_VADDR(cd2->cd_BoardAddr);
+	fb_info->fbregs_phys = (unsigned long) cd2->cd_BoardAddr;
 
         DEBUG printk(KERN_INFO "clgen: Virtual address for board set to: $%p\n", fb_info->regs);
 	DEBUG printk(KERN_INFO "clgen: (RAM start set to: $%lx)\n", fb_info->fbmem);
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.127/drivers/video/virgefb.c ./virgefb.c
--- /home/jskov/kernel/dist/linux-2.1.127/drivers/video/virgefb.c	Thu Nov 12 17:34:12 1998
+++ ./virgefb.c	Thu Nov 12 17:38:16 1998
@@ -153,6 +153,8 @@
 static unsigned long CyberSize;
 static volatile char *CyberRegs;
 static volatile unsigned long CyberVGARegs; /* ++Andre: for CV64/3D, see macros at the beginning */
+static unsigned long CyberMem_phys;
+static unsigned long CyberRegs_phys;
  
 
 /*
@@ -379,9 +381,9 @@
 {
 	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 	strcpy(fix->id, virgefb_name);
-	fix->smem_start = (char*) virt_to_phys((void *)CyberMem);
+	fix->smem_start = (char*) CyberMem_phys;
 	fix->smem_len = CyberSize;
-	fix->mmio_start = (char*) virt_to_phys((void *)CyberRegs);
+	fix->mmio_start = (char*) CyberRegs_phys;
 	fix->mmio_len = 0x10000; /* TODO: verify this for the CV64/3D */
 
 	fix->type = FB_TYPE_PACKED_PIXELS;
@@ -851,7 +853,7 @@
 	virgefb_get_fix(&fix, con, info);
 	if (con == -1)
 		con = 0;
-	display->screen_base = phys_to_virt ((unsigned long) fix.smem_start);
+	display->screen_base = (char*) CyberMem;
 	display->visual = fix.visual;
 	display->type = fix.type;
 	display->type_aux = fix.type_aux;
@@ -1041,7 +1043,8 @@
 		 * Ok we got the board running in Z2 space.
 		 */
 
-		CyberMem = ZTWO_VADDR(board_addr);
+		CyberMem_phys = board_addr;
+		CyberMem = ZTWO_VADDR(CyberMem_phys);
 		printk("CV3D detected running in Z2 mode ... not yet supported!\n");
 		return;
 	}
@@ -1049,10 +1052,13 @@
 	{
 		CyberVGARegs = kernel_map(board_addr +0x0c000000, 0x00010000,
 					       KERNELMAP_NOCACHE_SER, NULL);
-		CyberRegs = (char *)kernel_map(board_addr +0x05000000,
+
+		CyberRegs_phys = board_addr + 0x05000000;
+		CyberMem_phys  = board_addr + 0x04800000;
+		CyberRegs = (char *)kernel_map(CyberRegs_phys,
 					       0x00010000,
 					       KERNELMAP_NOCACHE_SER, NULL);
-		CyberMem = kernel_map(board_addr + 0x04800000, 0x00400000,
+		CyberMem = kernel_map(CyberMem_phys, 0x00400000,
 				      KERNELMAP_NOCACHE_SER, NULL);
 		printk("CV3D detected running in Z3 mode\n");
 	}


----------------------------------------------------------------------------
BASE: drivers/char
----------------------------------------------------------------------------


diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.127/drivers/char/m68kserial.c ./m68kserial.c
--- /home/jskov/kernel/dist/linux-2.1.127/drivers/char/m68kserial.c	Fri Oct  9 19:36:29 1998
+++ ./m68kserial.c	Thu Nov 12 19:00:07 1998
@@ -982,8 +982,7 @@
 		timeout = jiffies+HZ;
 		while (!(info->sw->trans_empty(info))) {
 			current->state = TASK_INTERRUPTIBLE;
-			current->timeout = jiffies + info->timeout;
-			schedule();
+			schedule_timeout(info->timeout);
 			if (signal_pending(current))
 				break;
 			if (jiffies > timeout)
@@ -1002,8 +1001,7 @@
 	if (info->blocked_open) {
 		if (info->close_delay) {
 			current->state = TASK_INTERRUPTIBLE;
-			current->timeout = jiffies + info->close_delay;
-			schedule();
+			schedule_timeout(info->close_delay);
 		}
 		wake_up_interruptible(&info->open_wait);
 	}
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.127/drivers/char/mem.c ./mem.c
--- /home/jskov/kernel/dist/linux-2.1.127/drivers/char/mem.c	Thu Nov 12 17:34:00 1998
+++ ./mem.c	Thu Nov 12 17:37:53 1998
@@ -220,7 +220,7 @@
 static ssize_t read_port(struct file * file, char * buf,
 			 size_t count, loff_t *ppos)
 {
-#if defined(__mc68000__)
+#if defined(__mc68000__) || defined(CONFIG_APUS)
 	return -EIO;
 #else
 	unsigned long i = *ppos;
@@ -242,7 +242,7 @@
 static ssize_t write_port(struct file * file, const char * buf,
 			  size_t count, loff_t *ppos)
 {
-#if defined(__mc68000__)
+#if defined(__mc68000__) || defined(CONFIG_APUS)
 	return -EIO;
 #else
 	unsigned long i = *ppos;
diff -u --recursive -B --exclude-from=/home/jskov/lib/diff-excludes -P /home/jskov/kernel/dist/linux-2.1.127/drivers/char/vt.c ./vt.c
--- /home/jskov/kernel/dist/linux-2.1.127/drivers/char/vt.c	Fri Oct  9 19:36:29 1998
+++ ./vt.c	Sun Oct 11 11:34:18 1998
@@ -27,7 +27,7 @@
 #include <asm/io.h>
 #include <asm/uaccess.h>
 
-#ifdef __mc68000__
+#if defined(__mc68000__) || defined(CONFIG_APUS)
 #include <asm/machdep.h>
 #endif
 
@@ -474,7 +474,7 @@
 		ucval = keyboard_type;
 		goto setchar;
 
-#ifdef __mc68000__
+#if defined(__mc68000__) || defined(CONFIG_APUS)
 	/* Linux/68k interface to the hardware clock */
 		
 	case KDGHWCLK:

