This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: FEC driver (MPC860T) - minor bug


Christoph Csebits wrote:
> 
> hi
> 
> perhaps there is a bug in if_fec.c (CVS snapshot 12Jun2001):
> 
>     asm volatile ("mfspr   %0,638 \n\t" : "=r" (proc_rev) : );
>     #define PROC_REVB 0x0020
>     if ((proc_rev & 0x0000FFFF) == PROC_REVB) {
>       eppc->pio_pddir = 0x1C58;
>     } else {
>       eppc->pio_pddir = 0x1FFF;
>     }
> 
> Reading from PowerPC SPR 638 gives the
> Internal Memory Mapping Register (IMMR).
> 
> I think SPR 287, the Processor
> Version Register (PVR) is the right one
> for determining the revision number.
> (if this is what the code above should do)

Good catch. This should be all it takes to fix it:

Jifl

Index: src/if_fec.c
===================================================================
RCS file: /home/cvs/ecc/ecc/devs/eth/powerpc/fec/current/src/if_fec.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -5 -p -r1.7 -r1.8
--- src/if_fec.c	2001/05/07 22:36:20	1.7
+++ src/if_fec.c	2001/06/26 14:35:53	1.8
@@ -57,10 +57,11 @@
 #include <cyg/hal/hal_arch.h>
 #include <cyg/hal/hal_cache.h>
 #include <cyg/hal/hal_intr.h>
 #include <cyg/hal/drv_api.h>
 #include <cyg/hal/hal_if.h>
+#include <cyg/hal/ppc_regs.h>
 
 #include <netdev.h>
 #include <eth_drv.h>
 
 #include "fec.h"
@@ -258,11 +259,11 @@ fec_eth_init(struct cyg_netdevtab_entry 
     txbd--;
     txbd->ctrl |= FEC_BD_Tx_Wrap;  // Last buffer
 
     // Set up parallel port for connection to ethernet tranceiver
     eppc->pio_pdpar = 0x1FFF;
-    asm volatile ("mfspr   %0,638 \n\t"	: "=r" (proc_rev) : );
+    CYGARC_MFSPR( proc_rev, CYGARC_REG_PVR );
 #define PROC_REVB 0x0020
     if ((proc_rev & 0x0000FFFF) == PROC_REVB) {
         eppc->pio_pddir = 0x1C58;
     } else {
         eppc->pio_pddir = 0x1FFF;

-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine
Come to the Red Hat TechWorld open source conference in Brussels!
Keynotes, techie talks and exhibitions    http://www.redhat-techworld.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]