@@ -1447,18 +1447,17 @@ static void DFPROC floppy_deregister(void)
14471447 set_irq ();
14481448}
14491449
1450- /* Try to determine the floppy controller type */
1451- static int DFPROC get_fdc_version (void )
1450+ /* Try to determine the floppy controller type; sets fdc_version global */
1451+ static void DFPROC get_fdc_version (void )
14521452{
14531453 int type = FDC_TYPE_8272A ;
14541454 const char * name ;
14551455
14561456 do_floppy = ignore_interrupt ;
14571457 output_byte (FD_VERSION ); /* get FDC version code */
1458- if (result () != 1 ) {
1459- printk ("df: can't get FDC version\n" );
1460- return 0 ;
1461- }
1458+ if (result () != 1 )
1459+ reply_buffer [0 ] = 0 ; /* NOTE: fixes unimplemented command in MartyPC */
1460+
14621461 switch (reply_buffer [0 ]) {
14631462 case 0x80 :
14641463 if (arch_cpu >= CPU_80286 ) { /* PC/AT or better */
@@ -1473,19 +1472,18 @@ static int DFPROC get_fdc_version(void)
14731472 name = "82077" ;
14741473 break ;
14751474 default :
1476- name = "Unknown " ;
1475+ name = "8272A assumed " ;
14771476 }
14781477 printk ("df: direct floppy FDC %s (0x%x), irq %d, dma %d\n" ,
14791478 name , reply_buffer [0 ], FLOPPY_IRQ , FLOPPY_DMA );
1479+ fdc_version = type ; /* must set version before reset_floppy called */
14801480
14811481 /* Not all FDCs seem to be able to handle the version command
14821482 * properly, so force a reset for the standard FDC clones,
14831483 * to avoid interrupt garbage.
14841484 */
14851485 initial_reset_flag = 1 ;
14861486 reset_floppy ();
1487-
1488- return type ;
14891487}
14901488
14911489static int DFPROC floppy_register (void )
@@ -1502,7 +1500,7 @@ static int DFPROC floppy_register(void)
15021500 return err ;
15031501 }
15041502
1505- fdc_version = get_fdc_version ();
1503+ get_fdc_version ();
15061504 if (!fdc_version ) return - EIO ;
15071505 return 0 ;
15081506}
0 commit comments