Commit a11a5442 authored by Joe Perches's avatar Joe Perches Committed by Michael Grzeschik

arcnet: com90xx: Use arcnet_readb/writeb routines

Simplify and make consistent the current uses of readb/writeb
by using the newly introduced arcnet_<I/O> equivalents.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
parent 4e2f9f1b
...@@ -88,6 +88,8 @@ static int numcards; ...@@ -88,6 +88,8 @@ static int numcards;
#define COM9026_REG_W_ADDR_LO 14 /* Control registers for said */ #define COM9026_REG_W_ADDR_LO 14 /* Control registers for said */
#define COM9026_REG_W_ADDR_HI 15 #define COM9026_REG_W_ADDR_HI 15
#define COM9026_REG_R_STATION 1 /* Station ID */
static int com90xx_skip_probe __initdata = 0; static int com90xx_skip_probe __initdata = 0;
/* Module parameters */ /* Module parameters */
...@@ -239,9 +241,10 @@ static void __init com90xx_probe(void) ...@@ -239,9 +241,10 @@ static void __init com90xx_probe(void)
numprint = 0; numprint = 0;
goto out1; goto out1;
} }
if (readb(base) != TESTvalue) { if (arcnet_readb(base, COM9026_REG_R_STATUS) != TESTvalue) {
arc_cont(D_INIT_REASONS, "(%02Xh != %02Xh)\n", arc_cont(D_INIT_REASONS, "(%02Xh != %02Xh)\n",
readb(base), TESTvalue); arcnet_readb(base, COM9026_REG_R_STATUS),
TESTvalue);
arc_cont(D_INIT_REASONS, "S3: "); arc_cont(D_INIT_REASONS, "S3: ");
if (BUGLVL(D_INIT_REASONS)) if (BUGLVL(D_INIT_REASONS))
numprint = 0; numprint = 0;
...@@ -252,8 +255,8 @@ static void __init com90xx_probe(void) ...@@ -252,8 +255,8 @@ static void __init com90xx_probe(void)
* in another pass through this loop, they will be discarded * in another pass through this loop, they will be discarded
* because *cptr != TESTvalue. * because *cptr != TESTvalue.
*/ */
writeb(0x42, base); arcnet_writeb(0x42, base, COM9026_REG_W_INTMASK);
if (readb(base) != 0x42) { if (arcnet_readb(base, COM9026_REG_R_STATUS) != 0x42) {
arc_cont(D_INIT_REASONS, "(read only)\n"); arc_cont(D_INIT_REASONS, "(read only)\n");
arc_cont(D_INIT_REASONS, "S3: "); arc_cont(D_INIT_REASONS, "S3: ");
goto out2; goto out2;
...@@ -384,7 +387,8 @@ static void __init com90xx_probe(void) ...@@ -384,7 +387,8 @@ static void __init com90xx_probe(void)
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]); arcnet_writeb(TESTvalue, iomem[0],
COM9026_REG_W_INTMASK);
} }
#else #else
arcnet_inb(ioaddr, COM9026_REG_R_RESET); arcnet_inb(ioaddr, COM9026_REG_R_RESET);
...@@ -395,7 +399,7 @@ static void __init com90xx_probe(void) ...@@ -395,7 +399,7 @@ static void __init com90xx_probe(void)
u_long ptr = shmems[index]; u_long ptr = shmems[index];
void __iomem *base = iomem[index]; void __iomem *base = iomem[index];
if (readb(base) == TESTvalue) { /* found one */ if (arcnet_readb(base, COM9026_REG_R_STATUS) == TESTvalue) { /* found one */
arc_cont(D_INIT, "%lXh)\n", *p); arc_cont(D_INIT, "%lXh)\n", *p);
openparen = 0; openparen = 0;
...@@ -409,7 +413,8 @@ static void __init com90xx_probe(void) ...@@ -409,7 +413,8 @@ static void __init com90xx_probe(void)
iomem[index] = iomem[numshmems]; iomem[index] = iomem[numshmems];
break; /* go to the next I/O port */ break; /* go to the next I/O port */
} else { } else {
arc_cont(D_INIT_REASONS, "%Xh-", readb(base)); arc_cont(D_INIT_REASONS, "%Xh-",
arcnet_readb(base, COM9026_REG_R_STATUS));
} }
} }
...@@ -431,7 +436,7 @@ static void __init com90xx_probe(void) ...@@ -431,7 +436,7 @@ static void __init com90xx_probe(void)
/* Now put back TESTvalue on all leftover shmems. */ /* Now put back TESTvalue on all leftover shmems. */
for (index = 0; index < numshmems; index++) { for (index = 0; index < numshmems; index++) {
writeb(TESTvalue, iomem[index]); arcnet_writeb(TESTvalue, iomem[index], COM9026_REG_W_INTMASK);
iounmap(iomem[index]); iounmap(iomem[index]);
release_mem_region(shmems[index], MIRROR_SIZE); release_mem_region(shmems[index], MIRROR_SIZE);
} }
...@@ -449,7 +454,7 @@ static int check_mirror(unsigned long addr, size_t size) ...@@ -449,7 +454,7 @@ static int check_mirror(unsigned long addr, size_t size)
p = ioremap(addr, size); p = ioremap(addr, size);
if (p) { if (p) {
if (readb(p) == TESTvalue) if (arcnet_readb(p, COM9026_REG_R_STATUS) == TESTvalue)
res = 1; res = 1;
else else
res = 0; res = 0;
...@@ -487,7 +492,7 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem, ...@@ -487,7 +492,7 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem,
* 2k (or there are no mirrors at all) but on some, it's 4k. * 2k (or there are no mirrors at all) but on some, it's 4k.
*/ */
mirror_size = MIRROR_SIZE; mirror_size = MIRROR_SIZE;
if (readb(p) == TESTvalue && if (arcnet_readb(p, COM9026_REG_R_STATUS) == TESTvalue &&
check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0 && check_mirror(shmem - MIRROR_SIZE, MIRROR_SIZE) == 0 &&
check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1) check_mirror(shmem - 2 * MIRROR_SIZE, MIRROR_SIZE) == 1)
mirror_size = 2 * MIRROR_SIZE; mirror_size = 2 * MIRROR_SIZE;
...@@ -537,7 +542,7 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem, ...@@ -537,7 +542,7 @@ static int __init com90xx_found(int ioaddr, int airq, u_long shmem,
} }
/* get and check the station ID from offset 1 in shmem */ /* get and check the station ID from offset 1 in shmem */
dev->dev_addr[0] = readb(lp->mem_start + 1); dev->dev_addr[0] = arcnet_readb(lp->mem_start, COM9026_REG_R_STATION);
dev->base_addr = ioaddr; dev->base_addr = ioaddr;
...@@ -616,7 +621,7 @@ static int com90xx_reset(struct net_device *dev, int really_reset) ...@@ -616,7 +621,7 @@ static int com90xx_reset(struct net_device *dev, int really_reset)
#endif #endif
/* verify that the ARCnet signature byte is present */ /* verify that the ARCnet signature byte is present */
if (readb(lp->mem_start) != TESTvalue) { if (arcnet_readb(lp->mem_start, COM9026_REG_R_STATUS) != TESTvalue) {
if (really_reset) if (really_reset)
arc_printk(D_NORMAL, dev, "reset failed: TESTvalue not present.\n"); arc_printk(D_NORMAL, dev, "reset failed: TESTvalue not present.\n");
return 1; return 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment