arcnet: com90xx: Use arcnet_<I/O> routines
Simplify and make consistent the current uses of inb/outb by using the newly introduced arcnet_<I/O> equivalents. o Add new #defines for register offsets o Remove old #defines that included the ioaddr o Remove obfuscating macros by expanding them in-place where appropriate Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
This commit is contained in:
parent
f0b9c27c0c
commit
09dfbcd5d1
@ -79,22 +79,14 @@ static int numcards;
|
|||||||
#define MIRROR_SIZE (BUFFER_SIZE * 4)
|
#define MIRROR_SIZE (BUFFER_SIZE * 4)
|
||||||
|
|
||||||
/* COM 9026 controller chip --> ARCnet register addresses */
|
/* COM 9026 controller chip --> ARCnet register addresses */
|
||||||
#define _INTMASK (ioaddr + 0) /* writable */
|
#define COM9026_REG_W_INTMASK 0 /* writable */
|
||||||
#define _STATUS (ioaddr + 0) /* readable */
|
#define COM9026_REG_R_STATUS 0 /* readable */
|
||||||
#define _COMMAND (ioaddr + 1) /* writable, returns random vals on read (?) */
|
#define COM9026_REG_W_COMMAND 1 /* writable, returns random vals on read (?) */
|
||||||
#define _CONFIG (ioaddr + 2) /* Configuration register */
|
#define COM9026_REG_RW_CONFIG 2 /* Configuration register */
|
||||||
#define _RESET (ioaddr + 8) /* software reset (on read) */
|
#define COM9026_REG_R_RESET 8 /* software reset (on read) */
|
||||||
#define _MEMDATA (ioaddr + 12) /* Data port for IO-mapped memory */
|
#define COM9026_REG_RW_MEMDATA 12 /* Data port for IO-mapped memory */
|
||||||
#define _ADDR_HI (ioaddr + 15) /* Control registers for said */
|
#define COM9026_REG_W_ADDR_LO 14 /* Control registers for said */
|
||||||
#define _ADDR_LO (ioaddr + 14)
|
#define COM9026_REG_W_ADDR_HI 15
|
||||||
|
|
||||||
#undef ASTATUS
|
|
||||||
#undef ACOMMAND
|
|
||||||
#undef AINTMASK
|
|
||||||
|
|
||||||
#define ASTATUS() inb(_STATUS)
|
|
||||||
#define ACOMMAND(cmd) outb((cmd), _COMMAND)
|
|
||||||
#define AINTMASK(msk) outb((msk), _INTMASK)
|
|
||||||
|
|
||||||
static int com90xx_skip_probe __initdata = 0;
|
static int com90xx_skip_probe __initdata = 0;
|
||||||
|
|
||||||
@ -175,7 +167,7 @@ static void __init com90xx_probe(void)
|
|||||||
*port-- = ports[--numports];
|
*port-- = ports[--numports];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (ASTATUS() == 0xFF) {
|
if (arcnet_inb(ioaddr, COM9026_REG_R_STATUS) == 0xFF) {
|
||||||
arc_cont(D_INIT_REASONS, "(empty)\n");
|
arc_cont(D_INIT_REASONS, "(empty)\n");
|
||||||
arc_cont(D_INIT_REASONS, "S1: ");
|
arc_cont(D_INIT_REASONS, "S1: ");
|
||||||
if (BUGLVL(D_INIT_REASONS))
|
if (BUGLVL(D_INIT_REASONS))
|
||||||
@ -184,7 +176,8 @@ static void __init com90xx_probe(void)
|
|||||||
*port-- = ports[--numports];
|
*port-- = ports[--numports];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
inb(_RESET); /* begin resetting card */
|
/* begin resetting card */
|
||||||
|
arcnet_inb(ioaddr, COM9026_REG_R_RESET);
|
||||||
|
|
||||||
arc_cont(D_INIT_REASONS, "\n");
|
arc_cont(D_INIT_REASONS, "\n");
|
||||||
arc_cont(D_INIT_REASONS, "S1: ");
|
arc_cont(D_INIT_REASONS, "S1: ");
|
||||||
@ -324,7 +317,7 @@ static void __init com90xx_probe(void)
|
|||||||
arc_cont(D_INIT, "%Xh ", *port);
|
arc_cont(D_INIT, "%Xh ", *port);
|
||||||
|
|
||||||
ioaddr = *port;
|
ioaddr = *port;
|
||||||
status = ASTATUS();
|
status = arcnet_inb(ioaddr, COM9026_REG_R_STATUS);
|
||||||
|
|
||||||
if ((status & 0x9D)
|
if ((status & 0x9D)
|
||||||
!= (NORXflag | RECONflag | TXFREEflag | RESETflag)) {
|
!= (NORXflag | RECONflag | TXFREEflag | RESETflag)) {
|
||||||
@ -336,8 +329,9 @@ static void __init com90xx_probe(void)
|
|||||||
*port-- = ports[--numports];
|
*port-- = ports[--numports];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ACOMMAND(CFLAGScmd | RESETclear | CONFIGclear);
|
arcnet_outb(CFLAGScmd | RESETclear | CONFIGclear,
|
||||||
status = ASTATUS();
|
ioaddr, COM9026_REG_W_COMMAND);
|
||||||
|
status = arcnet_inb(ioaddr, COM9026_REG_R_STATUS);
|
||||||
if (status & RESETflag) {
|
if (status & RESETflag) {
|
||||||
arc_cont(D_INIT_REASONS, " (eternal reset, status=%Xh)\n",
|
arc_cont(D_INIT_REASONS, " (eternal reset, status=%Xh)\n",
|
||||||
status);
|
status);
|
||||||
@ -357,9 +351,9 @@ static void __init com90xx_probe(void)
|
|||||||
* we tell it to start receiving.
|
* we tell it to start receiving.
|
||||||
*/
|
*/
|
||||||
airqmask = probe_irq_on();
|
airqmask = probe_irq_on();
|
||||||
AINTMASK(NORXflag);
|
arcnet_outb(NORXflag, ioaddr, COM9026_REG_W_INTMASK);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
AINTMASK(0);
|
arcnet_outb(0, ioaddr, COM9026_REG_W_INTMASK);
|
||||||
airq = probe_irq_off(airqmask);
|
airq = probe_irq_off(airqmask);
|
||||||
|
|
||||||
if (airq <= 0) {
|
if (airq <= 0) {
|
||||||
@ -386,14 +380,14 @@ static void __init com90xx_probe(void)
|
|||||||
*/
|
*/
|
||||||
#ifdef FAST_PROBE
|
#ifdef FAST_PROBE
|
||||||
if (numports > 1 || numshmems > 1) {
|
if (numports > 1 || numshmems > 1) {
|
||||||
inb(_RESET);
|
arcnet_inb(ioaddr, COM9026_REG_R_RESET);
|
||||||
mdelay(RESETtime);
|
mdelay(RESETtime);
|
||||||
} else {
|
} else {
|
||||||
/* just one shmem and port, assume they match */
|
/* just one shmem and port, assume they match */
|
||||||
writeb(TESTvalue, iomem[0]);
|
writeb(TESTvalue, iomem[0]);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
inb(_RESET);
|
arcnet_inb(ioaddr, COM9026_REG_R_RESET);
|
||||||
mdelay(RESETtime);
|
mdelay(RESETtime);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -574,21 +568,21 @@ static void com90xx_command(struct net_device *dev, int cmd)
|
|||||||
{
|
{
|
||||||
short ioaddr = dev->base_addr;
|
short ioaddr = dev->base_addr;
|
||||||
|
|
||||||
ACOMMAND(cmd);
|
arcnet_outb(cmd, ioaddr, COM9026_REG_W_COMMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int com90xx_status(struct net_device *dev)
|
static int com90xx_status(struct net_device *dev)
|
||||||
{
|
{
|
||||||
short ioaddr = dev->base_addr;
|
short ioaddr = dev->base_addr;
|
||||||
|
|
||||||
return ASTATUS();
|
return arcnet_inb(ioaddr, COM9026_REG_R_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void com90xx_setmask(struct net_device *dev, int mask)
|
static void com90xx_setmask(struct net_device *dev, int mask)
|
||||||
{
|
{
|
||||||
short ioaddr = dev->base_addr;
|
short ioaddr = dev->base_addr;
|
||||||
|
|
||||||
AINTMASK(mask);
|
arcnet_outb(mask, ioaddr, COM9026_REG_W_INTMASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do a hardware reset on the card, and set up necessary registers.
|
/* Do a hardware reset on the card, and set up necessary registers.
|
||||||
@ -603,18 +597,23 @@ static int com90xx_reset(struct net_device *dev, int really_reset)
|
|||||||
struct arcnet_local *lp = netdev_priv(dev);
|
struct arcnet_local *lp = netdev_priv(dev);
|
||||||
short ioaddr = dev->base_addr;
|
short ioaddr = dev->base_addr;
|
||||||
|
|
||||||
arc_printk(D_INIT, dev, "Resetting (status=%02Xh)\n", ASTATUS());
|
arc_printk(D_INIT, dev, "Resetting (status=%02Xh)\n",
|
||||||
|
arcnet_inb(ioaddr, COM9026_REG_R_STATUS));
|
||||||
|
|
||||||
if (really_reset) {
|
if (really_reset) {
|
||||||
/* reset the card */
|
/* reset the card */
|
||||||
inb(_RESET);
|
arcnet_inb(ioaddr, COM9026_REG_R_RESET);
|
||||||
mdelay(RESETtime);
|
mdelay(RESETtime);
|
||||||
}
|
}
|
||||||
ACOMMAND(CFLAGScmd | RESETclear); /* clear flags & end reset */
|
/* clear flags & end reset */
|
||||||
ACOMMAND(CFLAGScmd | CONFIGclear);
|
arcnet_outb(CFLAGScmd | RESETclear, ioaddr, COM9026_REG_W_COMMAND);
|
||||||
|
arcnet_outb(CFLAGScmd | CONFIGclear, ioaddr, COM9026_REG_W_COMMAND);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* don't do this until we verify that it doesn't hurt older cards! */
|
/* don't do this until we verify that it doesn't hurt older cards! */
|
||||||
/* outb(inb(_CONFIG) | ENABLE16flag, _CONFIG); */
|
arcnet_outb(arcnet_inb(ioaddr, COM9026_REG_RW_CONFIG) | ENABLE16flag,
|
||||||
|
ioaddr, COM9026_REG_RW_CONFIG);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* verify that the ARCnet signature byte is present */
|
/* verify that the ARCnet signature byte is present */
|
||||||
if (readb(lp->mem_start) != TESTvalue) {
|
if (readb(lp->mem_start) != TESTvalue) {
|
||||||
@ -623,7 +622,7 @@ static int com90xx_reset(struct net_device *dev, int really_reset)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* enable extended (512-byte) packets */
|
/* enable extended (512-byte) packets */
|
||||||
ACOMMAND(CONFIGcmd | EXTconf);
|
arcnet_outb(CONFIGcmd | EXTconf, ioaddr, COM9026_REG_W_COMMAND);
|
||||||
|
|
||||||
/* clean out all the memory to make debugging make more sense :) */
|
/* clean out all the memory to make debugging make more sense :) */
|
||||||
if (BUGLVL(D_DURING))
|
if (BUGLVL(D_DURING))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user