Commit 03c3ab96 authored by Geert Uytterhoeven's avatar Geert Uytterhoeven Committed by Linus Torvalds

[PATCH] M68k update (part 21)

HP300 LANCE driver updates
  - Update DIO probe code
  - Use out_8() instead of writeb() for non-PCI memory mapped I/O
  - Kill warnings
parent e76f1c88
...@@ -58,9 +58,9 @@ int hplance_probe(struct net_device *dev); ...@@ -58,9 +58,9 @@ int hplance_probe(struct net_device *dev);
static int hplance_init(struct net_device *dev, int scode); static int hplance_init(struct net_device *dev, int scode);
static int hplance_open(struct net_device *dev); static int hplance_open(struct net_device *dev);
static int hplance_close(struct net_device *dev); static int hplance_close(struct net_device *dev);
static void hplance_writerap(struct hplance_private *lp, unsigned short value); static void hplance_writerap(void *priv, unsigned short value);
static void hplance_writerdp(struct hplance_private *lp, unsigned short value); static void hplance_writerdp(void *priv, unsigned short value);
static unsigned short hplance_readrdp(struct hplance_private *lp); static unsigned short hplance_readrdp(void *priv);
#ifdef MODULE #ifdef MODULE
static struct hplance_private *root_hplance_dev; static struct hplance_private *root_hplance_dev;
...@@ -100,8 +100,7 @@ int __init hplance_probe(struct net_device *dev) ...@@ -100,8 +100,7 @@ int __init hplance_probe(struct net_device *dev)
/* Initialise a single lance board at the given select code */ /* Initialise a single lance board at the given select code */
static int __init hplance_init(struct net_device *dev, int scode) static int __init hplance_init(struct net_device *dev, int scode)
{ {
/* const char *name = dio_scodetoname(scode); */ const char *name = dio_scodetoname(scode);
static const char name[] = "HP LANCE";
void *va = dio_scodetoviraddr(scode); void *va = dio_scodetoviraddr(scode);
struct hplance_private *lp; struct hplance_private *lp;
int i; int i;
...@@ -118,10 +117,10 @@ static int __init hplance_init(struct net_device *dev, int scode) ...@@ -118,10 +117,10 @@ static int __init hplance_init(struct net_device *dev, int scode)
#endif #endif
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
printk("%s: HP LANCE; select code %d, addr", dev->name, scode); printk("%s: %s; select code %d, addr", dev->name, name, scode);
/* reset the board */ /* reset the board */
writeb(0xff,va+DIO_IDOFF); out_8(va+DIO_IDOFF, 0xff);
udelay(100); /* ariba! ariba! udelay! udelay! */ udelay(100); /* ariba! ariba! udelay! udelay! */
/* Fill the dev fields */ /* Fill the dev fields */
...@@ -138,8 +137,8 @@ static int __init hplance_init(struct net_device *dev, int scode) ...@@ -138,8 +137,8 @@ static int __init hplance_init(struct net_device *dev, int scode)
/* The NVRAM holds our ethernet address, one nibble per byte, /* The NVRAM holds our ethernet address, one nibble per byte,
* at bytes NVRAMOFF+1,3,5,7,9... * at bytes NVRAMOFF+1,3,5,7,9...
*/ */
dev->dev_addr[i] = ((readb(va + HPLANCE_NVRAMOFF + i*4 + 1) & 0xF) << 4) dev->dev_addr[i] = ((in_8(va + HPLANCE_NVRAMOFF + i*4 + 1) & 0xF) << 4)
| (readb(va + HPLANCE_NVRAMOFF + i*4 + 3) & 0xF); | (in_8(va + HPLANCE_NVRAMOFF + i*4 + 3) & 0xF);
printk("%c%2.2x", i == 0 ? ' ' : ':', dev->dev_addr[i]); printk("%c%2.2x", i == 0 ? ' ' : ':', dev->dev_addr[i]);
} }
...@@ -175,25 +174,28 @@ static int __init hplance_init(struct net_device *dev, int scode) ...@@ -175,25 +174,28 @@ static int __init hplance_init(struct net_device *dev, int scode)
/* This is disgusting. We have to check the DIO status register for ack every /* This is disgusting. We have to check the DIO status register for ack every
* time we read or write the LANCE registers. * time we read or write the LANCE registers.
*/ */
static void hplance_writerap(struct hplance_private *lp, unsigned short value) static void hplance_writerap(void *priv, unsigned short value)
{ {
struct hplance_private *lp = (struct hplance_private *)priv;
struct hplance_reg *hpregs = (struct hplance_reg *)lp->base; struct hplance_reg *hpregs = (struct hplance_reg *)lp->base;
do { do {
lp->lance.ll->rap = value; lp->lance.ll->rap = value;
} while ((hpregs->status & LE_ACK) == 0); } while ((hpregs->status & LE_ACK) == 0);
} }
static void hplance_writerdp(struct hplance_private *lp, unsigned short value) static void hplance_writerdp(void *priv, unsigned short value)
{ {
struct hplance_private *lp = (struct hplance_private *)priv;
struct hplance_reg *hpregs = (struct hplance_reg *)lp->base; struct hplance_reg *hpregs = (struct hplance_reg *)lp->base;
do { do {
lp->lance.ll->rdp = value; lp->lance.ll->rdp = value;
} while ((hpregs->status & LE_ACK) == 0); } while ((hpregs->status & LE_ACK) == 0);
} }
static unsigned short hplance_readrdp(struct hplance_private *lp) static unsigned short hplance_readrdp(void *priv)
{ {
unsigned short val; unsigned short val;
struct hplance_private *lp = (struct hplance_private *)priv;
struct hplance_reg *hpregs = (struct hplance_reg *)lp->base; struct hplance_reg *hpregs = (struct hplance_reg *)lp->base;
do { do {
val = lp->lance.ll->rdp; val = lp->lance.ll->rdp;
...@@ -211,7 +213,7 @@ static int hplance_open(struct net_device *dev) ...@@ -211,7 +213,7 @@ static int hplance_open(struct net_device *dev)
if (status) if (status)
return status; return status;
/* enable interrupts at board level. */ /* enable interrupts at board level. */
writeb(LE_IE, &(hpregs->status)); out_8(&(hpregs->status), LE_IE);
return 0; return 0;
} }
...@@ -220,7 +222,7 @@ static int hplance_close(struct net_device *dev) ...@@ -220,7 +222,7 @@ static int hplance_close(struct net_device *dev)
{ {
struct hplance_private *lp = (struct hplance_private *)dev->priv; struct hplance_private *lp = (struct hplance_private *)dev->priv;
struct hplance_reg *hpregs = (struct hplance_reg *)lp->base; struct hplance_reg *hpregs = (struct hplance_reg *)lp->base;
writeb(0,&(hpregs->status)); /* disable interrupts at boardlevel */ out_8(&(hpregs->status), 8); /* disable interrupts at boardlevel */
lance_close(dev); lance_close(dev);
return 0; return 0;
} }
......
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