Skip to contentSkip to conversation

sun_floppy_init patch

PATCH Max Loparyev 1 participant 1 message May 5, 2004

lore
Share & tools
lore
#0 lore raw

Hi all,

I've found the following problem while developing floppy controller for sparc. 82077 or pc8477 can work in 4 modes and not in all of them they provides SRA reg, that located at 82072 status reg address. So, i think that the right way is to define the status register function pointers and than try to check it, rather than static 82072 status register.

Signature · 2 lines
Max Loparyev <[email protected]>
Moscow center for SPARC technology
asm-sparc/floppy.h.new renamed from asm-sparc/floppy.h +14 -12
@@ -327,23 +327,25 @@
 	sun_fdc = (struct sun_flpy_controller *)
 	    sbus_ioremap(&r, 0, fd_regs[0].reg_size, "floppy");
 
+
+    if(sparc_cpu_model == sun4c) {
+    	sun_fdops.fd_inb = sun_82072_fd_inb;
+    	sun_fdops.fd_outb = sun_82072_fd_outb;
+    	fdc_status = &sun_fdc->status_82072;
+        /* printk("AUXIO @0x%lx\n", auxio_register); */ /* P3 */
+    } else {
+    	sun_fdops.fd_inb = sun_82077_fd_inb;
+    	sun_fdops.fd_outb = sun_82077_fd_outb;
+    	fdc_status = &sun_fdc->status_82077;
+        /* printk("DOR @0x%p\n", &sun_fdc->dor_82077); */ /* P3 */
+	}	
+		
 	/* Last minute sanity check... */
-	if(sun_fdc->status_82072 == 0xff) {
+	if(sun_fdc->status == 0xff) {
 		sun_fdc = NULL;
 		goto no_sun_fdc;
 	}
 
-        if(sparc_cpu_model == sun4c) {
-                sun_fdops.fd_inb = sun_82072_fd_inb;
-                sun_fdops.fd_outb = sun_82072_fd_outb;
-                fdc_status = &sun_fdc->status_82072;
-                /* printk("AUXIO @0x%lx\n", auxio_register); */ /* P3 */
-        } else {
-                sun_fdops.fd_inb = sun_82077_fd_inb;
-                sun_fdops.fd_outb = sun_82077_fd_outb;
-                fdc_status = &sun_fdc->status_82077;
-                /* printk("DOR @0x%p\n", &sun_fdc->dor_82077); */ /* P3 */
-	}
 
 	/* Success... */
 	allowed_drive_mask = 0x01;