X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Frio%2Frioinit.c;h=0d44ef464e6b28c5cdfcd5532b3d01ab6f28d3b6;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=24d2992154cce5269a1a7df690742ed3ad059ec7;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/drivers/char/rio/rioinit.c b/drivers/char/rio/rioinit.c index 24d299215..0d44ef464 100644 --- a/drivers/char/rio/rioinit.c +++ b/drivers/char/rio/rioinit.c @@ -51,12 +51,15 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; #include "linux_compat.h" +#include "typdef.h" #include "pkt.h" #include "daemon.h" #include "rio.h" #include "riospace.h" +#include "top.h" #include "cmdpkt.h" #include "map.h" +#include "riotypes.h" #include "rup.h" #include "port.h" #include "riodrvr.h" @@ -69,17 +72,22 @@ static char *_rioinit_c_sccs_ = "@(#)rioinit.c 1.3"; #include "unixrup.h" #include "board.h" #include "host.h" +#include "error.h" #include "phb.h" #include "link.h" #include "cmdblk.h" #include "route.h" +#include "control.h" #include "cirrus.h" #include "rioioctl.h" #include "rio_linux.h" +#undef bcopy +#define bcopy rio_pcicopy + int RIOPCIinit(struct rio_info *p, int Mode); -static int RIOScrub(int, u8 *, int); +static int RIOScrub(int, BYTE *, int); /** @@ -91,8 +99,12 @@ static int RIOScrub(int, u8 *, int); ** bits < 0 indicates 8 bit operation requested, ** bits > 0 indicates 16 bit operation. */ - -int RIOAssignAT(struct rio_info *p, int Base, caddr_t virtAddr, int mode) +int +RIOAssignAT(p, Base, virtAddr, mode) +struct rio_info * p; +int Base; +caddr_t virtAddr; +int mode; { int bits; struct DpRam *cardp = (struct DpRam *)virtAddr; @@ -112,25 +124,29 @@ int RIOAssignAT(struct rio_info *p, int Base, caddr_t virtAddr, int mode) /* ** Revision 01 AT host cards don't support WORD operations, */ - if (readb(&cardp->DpRevision) == 01) + if ( RBYTE(cardp->DpRevision) == 01 ) bits = BYTE_OPERATION; p->RIOHosts[p->RIONumHosts].Type = RIO_AT; - p->RIOHosts[p->RIONumHosts].Copy = rio_copy_to_card; + p->RIOHosts[p->RIONumHosts].Copy = bcopy; /* set this later */ p->RIOHosts[p->RIONumHosts].Slot = -1; p->RIOHosts[p->RIONumHosts].Mode = SLOW_LINKS | SLOW_AT_BUS | bits; - writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE , - &p->RIOHosts[p->RIONumHosts].Control); - writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); - writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | p->RIOHosts[p->RIONumHosts].Mode | INTERRUPT_DISABLE, - &p->RIOHosts[p->RIONumHosts].Control); - writeb(0xFF, &p->RIOHosts[p->RIONumHosts].ResetInt); + WBYTE(p->RIOHosts[p->RIONumHosts].Control, + BOOT_FROM_RAM | EXTERNAL_BUS_OFF | + p->RIOHosts[p->RIONumHosts].Mode | + INTERRUPT_DISABLE ); + WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); + WBYTE(p->RIOHosts[p->RIONumHosts].Control, + BOOT_FROM_RAM | EXTERNAL_BUS_OFF | + p->RIOHosts[p->RIONumHosts].Mode | + INTERRUPT_DISABLE ); + WBYTE(p->RIOHosts[p->RIONumHosts].ResetInt,0xff); p->RIOHosts[p->RIONumHosts].UniqueNum = - ((readb(&p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| - ((readb(&p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| - ((readb(&p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| - ((readb(&p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); + ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[0])&0xFF)<<0)| + ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[1])&0xFF)<<8)| + ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[2])&0xFF)<<16)| + ((RBYTE(p->RIOHosts[p->RIONumHosts].Unique[3])&0xFF)<<24); rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Uniquenum 0x%x\n",p->RIOHosts[p->RIONumHosts].UniqueNum); p->RIONumHosts++; @@ -138,7 +154,7 @@ int RIOAssignAT(struct rio_info *p, int Base, caddr_t virtAddr, int mode) return(1); } -static u8 val[] = { +static uchar val[] = { #ifdef VERY_LONG_TEST 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xa5, 0xff, 0x5a, 0x00, 0xff, 0xc9, 0x36, @@ -151,7 +167,12 @@ static u8 val[] = { ** RAM test a board. ** Nothing too complicated, just enough to check it out. */ -int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slot) +int +RIOBoardTest(paddr, caddr, type, slot) +paddr_t paddr; +caddr_t caddr; +uchar type; +int slot; { struct DpRam *DpRam = (struct DpRam *)caddr; char *ram[4]; @@ -159,8 +180,8 @@ int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slo int op, bank; int nbanks; - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=%p, slot=%d\n", - type, DpRam, slot); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Reset host type=%d, DpRam=0x%x, slot=%d\n", + type,(int)DpRam, slot); RIOHostReset(type, DpRam, slot); @@ -188,11 +209,12 @@ int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slo if (nbanks == 3) { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: %p(0x%x), %p(0x%x), %p(0x%x)\n", - ram[0], size[0], ram[1], size[1], ram[2], size[2]); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: Memory: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", + (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2]); } else { - rio_dprintk (RIO_DEBUG_INIT, "RIO-init: %p(0x%x), %p(0x%x), %p(0x%x), %p(0x%x)\n", - ram[0], size[0], ram[1], size[1], ram[2], size[2], ram[3], size[3]); + rio_dprintk (RIO_DEBUG_INIT, "RIO-init: 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x), 0x%x(0x%x)\n", + (int)ram[0], size[0], (int)ram[1], size[1], (int)ram[2], size[2], (int)ram[3], + size[3]); } /* @@ -202,7 +224,7 @@ int RIOBoardTest(unsigned long paddr, caddr_t caddr, unsigned char type, int slo */ for (op=0; opMapping[UnitId].Name, "UNKNOWN RTA X-XX", 17); + bcopy("UNKNOWN RTA X-XX",HostP->Mapping[UnitId].Name,17); HostP->Mapping[UnitId].Name[12]='1'+(HostP-p->RIOHosts); if ((UnitId+1) > 9) { HostP->Mapping[UnitId].Name[14]='0'+((UnitId+1)/10); @@ -383,7 +412,8 @@ int RIODefaultName(struct rio_info *p, struct Host *HostP, unsigned int UnitId) static struct rioVersion stVersion; -struct rioVersion *RIOVersid(void) +struct rioVersion * +RIOVersid(void) { strlcpy(stVersion.version, "RIO driver for linux V1.0", sizeof(stVersion.version)); @@ -393,31 +423,40 @@ struct rioVersion *RIOVersid(void) return &stVersion; } -void RIOHostReset(unsigned int Type, struct DpRam *DpRamP, unsigned int Slot) +void +RIOHostReset(Type, DpRamP, Slot) +uint Type; +volatile struct DpRam *DpRamP; +uint Slot; { /* ** Reset the Tpu */ rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: type 0x%x", Type); switch ( Type ) { - case RIO_AT: - rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); - writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | BYTE_OPERATION | - SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); - writeb(0xFF, &DpRamP->DpResetTpu); - udelay(3); + case RIO_AT: + rio_dprintk (RIO_DEBUG_INIT, " (RIO_AT)\n"); + WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | + INTERRUPT_DISABLE | BYTE_OPERATION | + SLOW_LINKS | SLOW_AT_BUS); + WBYTE(DpRamP->DpResetTpu, 0xFF); + udelay(3); + rio_dprintk (RIO_DEBUG_INIT, "RIOHostReset: Don't know if it worked. Try reset again\n"); - writeb(BOOT_FROM_RAM | EXTERNAL_BUS_OFF | INTERRUPT_DISABLE | - BYTE_OPERATION | SLOW_LINKS | SLOW_AT_BUS, &DpRamP->DpControl); - writeb(0xFF, &DpRamP->DpResetTpu); - udelay(3); - break; + WBYTE(DpRamP->DpControl, BOOT_FROM_RAM | EXTERNAL_BUS_OFF | + INTERRUPT_DISABLE | BYTE_OPERATION | + SLOW_LINKS | SLOW_AT_BUS); + WBYTE(DpRamP->DpResetTpu, 0xFF); + udelay(3); + break; case RIO_PCI: rio_dprintk (RIO_DEBUG_INIT, " (RIO_PCI)\n"); - writeb(RIO_PCI_BOOT_FROM_RAM, &DpRamP->DpControl); - writeb(0xFF, &DpRamP->DpResetInt); - writeb(0xFF, &DpRamP->DpResetTpu); + DpRamP->DpControl = RIO_PCI_BOOT_FROM_RAM; + DpRamP->DpResetInt = 0xFF; + DpRamP->DpResetTpu = 0xFF; udelay(100); + /* for (i=0; i<6000; i++); */ + /* suspend( 3 ); */ break; default: rio_dprintk (RIO_DEBUG_INIT, " (UNKNOWN)\n");