summaryrefslogtreecommitdiffstats
path: root/drivers/net/arcnet/com20020.c
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2015-04-15 11:43:57 +0200
committerMichael Grzeschik <m.grzeschik@pengutronix.de>2015-09-23 08:44:28 +0200
commit84286f191a01f198ccfc15759d01320e3847accd (patch)
treeec40ec6e0decf8e2c4b878cf737a715718020ee0 /drivers/net/arcnet/com20020.c
parentarcnet: reformat structs to C99 format (diff)
downloadlinux-84286f191a01f198ccfc15759d01320e3847accd.tar.xz
linux-84286f191a01f198ccfc15759d01320e3847accd.zip
arcnet: com20020: replace magic numbers with readable macros
This patch replaces all magic numbers in the driver with proper named macros. For the case of XTOcfg and STARTIOcmd it introduces the new macros. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Diffstat (limited to 'drivers/net/arcnet/com20020.c')
-rw-r--r--drivers/net/arcnet/com20020.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/net/arcnet/com20020.c b/drivers/net/arcnet/com20020.c
index d4162750a354..c82f323a8c2b 100644
--- a/drivers/net/arcnet/com20020.c
+++ b/drivers/net/arcnet/com20020.c
@@ -94,9 +94,9 @@ int com20020_check(struct net_device *dev)
int ioaddr = dev->base_addr, status;
struct arcnet_local *lp = netdev_priv(dev);
- arcnet_outb(0x18 | 0x80, ioaddr, COM20020_REG_W_CONFIG);
+ arcnet_outb(XTOcfg(3) | RESETcfg, ioaddr, COM20020_REG_W_CONFIG);
udelay(5);
- arcnet_outb(0x18 , ioaddr, COM20020_REG_W_CONFIG);
+ arcnet_outb(XTOcfg(3), ioaddr, COM20020_REG_W_CONFIG);
mdelay(RESETtime);
lp->setup = lp->clockm ? 0 : (lp->clockp << 1);
@@ -115,10 +115,10 @@ int com20020_check(struct net_device *dev)
/* must now write the magic "restart operation" command */
mdelay(1);
- arcnet_outb(0x18, ioaddr, COM20020_REG_W_COMMAND);
+ arcnet_outb(STARTIOcmd, ioaddr, COM20020_REG_W_COMMAND);
}
- lp->config = 0x21 | (lp->timeout << 3) | (lp->backplane << 2);
+ lp->config = TXENcfg | (lp->timeout << 3) | (lp->backplane << 2) | SUB_NODE;
/* set node ID to 0x42 (but transmitter is disabled, so it's okay) */
arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
arcnet_outb(0x42, ioaddr, COM20020_REG_W_XREG);
@@ -132,7 +132,8 @@ int com20020_check(struct net_device *dev)
arc_printk(D_INIT_REASONS, dev, "status after reset: %X\n", status);
/* Enable TX */
- arcnet_outb(0x39, ioaddr, COM20020_REG_W_CONFIG);
+ lp->config |= TXENcfg;
+ arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
arcnet_outb(arcnet_inb(ioaddr, 8), ioaddr, COM20020_REG_W_XREG);
arcnet_outb(CFLAGScmd | RESETclear | CONFIGclear,
@@ -211,10 +212,10 @@ int com20020_found(struct net_device *dev, int shared)
/* must now write the magic "restart operation" command */
mdelay(1);
- arcnet_outb(0x18, ioaddr, COM20020_REG_W_COMMAND);
+ arcnet_outb(STARTIOcmd, ioaddr, COM20020_REG_W_COMMAND);
}
- lp->config = 0x20 | (lp->timeout << 3) | (lp->backplane << 2) | 1;
+ lp->config = TXENcfg | (lp->timeout << 3) | (lp->backplane << 2) | SUB_NODE;
/* Default 0x38 + register: Node ID */
arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
arcnet_outb(dev->dev_addr[0], ioaddr, COM20020_REG_W_XREG);
@@ -280,7 +281,7 @@ static int com20020_reset(struct net_device *dev, int really_reset)
if (really_reset) {
/* reset the card */
- arcnet_outb(lp->config | 0x80, ioaddr, COM20020_REG_W_CONFIG);
+ arcnet_outb(lp->config | RESETcfg, ioaddr, COM20020_REG_W_CONFIG);
udelay(5);
arcnet_outb(lp->config, ioaddr, COM20020_REG_W_CONFIG);
mdelay(RESETtime * 2);