drivers/net/pcnet.c: Coding Style cleanup.
Signed-off-by: Wolfgang Denk <wd@denx.de>
This commit is contained in:
parent
899ef7b845
commit
11ea26fd1c
|
@ -195,7 +195,8 @@ int pcnet_initialize(bd_t *bis)
|
||||||
/*
|
/*
|
||||||
* Setup the PCI device.
|
* Setup the PCI device.
|
||||||
*/
|
*/
|
||||||
pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, (unsigned int *)&dev->iobase);
|
pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
|
||||||
|
(unsigned int *) &dev->iobase);
|
||||||
dev->iobase &= ~0xf;
|
dev->iobase &= ~0xf;
|
||||||
|
|
||||||
PCNET_DEBUG1 ("%s: devbusfn=0x%x iobase=0x%x: ",
|
PCNET_DEBUG1 ("%s: devbusfn=0x%x iobase=0x%x: ",
|
||||||
|
@ -205,8 +206,7 @@ int pcnet_initialize(bd_t *bis)
|
||||||
pci_write_config_word (devbusfn, PCI_COMMAND, command);
|
pci_write_config_word (devbusfn, PCI_COMMAND, command);
|
||||||
pci_read_config_word (devbusfn, PCI_COMMAND, &status);
|
pci_read_config_word (devbusfn, PCI_COMMAND, &status);
|
||||||
if ((status & command) != command) {
|
if ((status & command) != command) {
|
||||||
printf("%s: Couldn't enable IO access or Bus Mastering\n",
|
printf ("%s: Couldn't enable IO access or Bus Mastering\n", dev->name);
|
||||||
dev->name);
|
|
||||||
free (dev);
|
free (dev);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -241,6 +241,7 @@ static int pcnet_probe(struct eth_device* dev, bd_t *bis, int dev_nr)
|
||||||
{
|
{
|
||||||
int chip_version;
|
int chip_version;
|
||||||
char *chipname;
|
char *chipname;
|
||||||
|
|
||||||
#ifdef PCNET_HAS_PROM
|
#ifdef PCNET_HAS_PROM
|
||||||
int i;
|
int i;
|
||||||
#endif
|
#endif
|
||||||
|
@ -255,7 +256,8 @@ static int pcnet_probe(struct eth_device* dev, bd_t *bis, int dev_nr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Identify the chip */
|
/* Identify the chip */
|
||||||
chip_version = pcnet_read_csr(dev, 88) | (pcnet_read_csr(dev,89) << 16);
|
chip_version =
|
||||||
|
pcnet_read_csr (dev, 88) | (pcnet_read_csr (dev, 89) << 16);
|
||||||
if ((chip_version & 0xfff) != 0x003)
|
if ((chip_version & 0xfff) != 0x003)
|
||||||
return -1;
|
return -1;
|
||||||
chip_version = (chip_version >> 12) & 0xffff;
|
chip_version = (chip_version >> 12) & 0xffff;
|
||||||
|
@ -289,6 +291,7 @@ static int pcnet_probe(struct eth_device* dev, bd_t *bis, int dev_nr)
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
val = pcnet_read_csr (dev, i + 12) & 0x0ffff;
|
val = pcnet_read_csr (dev, i + 12) & 0x0ffff;
|
||||||
/* There may be endianness issues here. */
|
/* There may be endianness issues here. */
|
||||||
dev->enetaddr[2 * i] = val & 0x0ff;
|
dev->enetaddr[2 * i] = val & 0x0ff;
|
||||||
|
@ -352,8 +355,9 @@ static int pcnet_init(struct eth_device* dev, bd_t *bis)
|
||||||
lp->rx_ring[i].base = PCI_TO_MEM_LE (dev, lp->rx_buf[i]);
|
lp->rx_ring[i].base = PCI_TO_MEM_LE (dev, lp->rx_buf[i]);
|
||||||
lp->rx_ring[i].buf_length = cpu_to_le16 (-PKT_BUF_SZ);
|
lp->rx_ring[i].buf_length = cpu_to_le16 (-PKT_BUF_SZ);
|
||||||
lp->rx_ring[i].status = cpu_to_le16 (0x8000);
|
lp->rx_ring[i].status = cpu_to_le16 (0x8000);
|
||||||
PCNET_DEBUG1("Rx%d: base=0x%x buf_length=0x%hx status=0x%hx\n",
|
PCNET_DEBUG1
|
||||||
i, lp->rx_ring[i].base, lp->rx_ring[i].buf_length,
|
("Rx%d: base=0x%x buf_length=0x%hx status=0x%hx\n", i,
|
||||||
|
lp->rx_ring[i].base, lp->rx_ring[i].buf_length,
|
||||||
lp->rx_ring[i].status);
|
lp->rx_ring[i].status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,12 +420,14 @@ static int pcnet_init(struct eth_device* dev, bd_t *bis)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pcnet_send(struct eth_device* dev, volatile void *packet, int pkt_len)
|
static int pcnet_send (struct eth_device *dev, volatile void *packet,
|
||||||
|
int pkt_len)
|
||||||
{
|
{
|
||||||
int i, status;
|
int i, status;
|
||||||
struct pcnet_tx_head *entry = &lp->tx_ring[lp->cur_tx];
|
struct pcnet_tx_head *entry = &lp->tx_ring[lp->cur_tx];
|
||||||
|
|
||||||
PCNET_DEBUG2("Tx%d: %d bytes from 0x%p ", lp->cur_tx, pkt_len, packet);
|
PCNET_DEBUG2 ("Tx%d: %d bytes from 0x%p ", lp->cur_tx, pkt_len,
|
||||||
|
packet);
|
||||||
|
|
||||||
/* Wait for completion by testing the OWN bit */
|
/* Wait for completion by testing the OWN bit */
|
||||||
for (i = 1000; i > 0; i--) {
|
for (i = 1000; i > 0; i--) {
|
||||||
|
@ -479,23 +485,28 @@ static int pcnet_recv(struct eth_device* dev)
|
||||||
|
|
||||||
printf ("%s: Rx%d", dev->name, lp->cur_rx);
|
printf ("%s: Rx%d", dev->name, lp->cur_rx);
|
||||||
PCNET_DEBUG1 (" (status=0x%x)", status);
|
PCNET_DEBUG1 (" (status=0x%x)", status);
|
||||||
if (status & 0x20) printf(" Frame");
|
if (status & 0x20)
|
||||||
if (status & 0x10) printf(" Overflow");
|
printf (" Frame");
|
||||||
if (status & 0x08) printf(" CRC");
|
if (status & 0x10)
|
||||||
if (status & 0x04) printf(" Fifo");
|
printf (" Overflow");
|
||||||
|
if (status & 0x08)
|
||||||
|
printf (" CRC");
|
||||||
|
if (status & 0x04)
|
||||||
|
printf (" Fifo");
|
||||||
printf (" Error\n");
|
printf (" Error\n");
|
||||||
entry->status &= le16_to_cpu (0x03ff);
|
entry->status &= le16_to_cpu (0x03ff);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
pkt_len = (le32_to_cpu(entry->msg_length) & 0xfff) - 4;
|
pkt_len =
|
||||||
|
(le32_to_cpu (entry->msg_length) & 0xfff) - 4;
|
||||||
if (pkt_len < 60) {
|
if (pkt_len < 60) {
|
||||||
printf("%s: Rx%d: invalid packet length %d\n",
|
printf ("%s: Rx%d: invalid packet length %d\n", dev->name, lp->cur_rx, pkt_len);
|
||||||
dev->name, lp->cur_rx, pkt_len);
|
|
||||||
} else {
|
} else {
|
||||||
NetReceive (lp->rx_buf[lp->cur_rx], pkt_len);
|
NetReceive (lp->rx_buf[lp->cur_rx], pkt_len);
|
||||||
PCNET_DEBUG2 ("Rx%d: %d bytes from 0x%p\n",
|
PCNET_DEBUG2 ("Rx%d: %d bytes from 0x%p\n",
|
||||||
lp->cur_rx, pkt_len, lp->rx_buf[lp->cur_rx]);
|
lp->cur_rx, pkt_len,
|
||||||
|
lp->rx_buf[lp->cur_rx]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
entry->status |= cpu_to_le16 (0x8000);
|
entry->status |= cpu_to_le16 (0x8000);
|
||||||
|
@ -525,5 +536,4 @@ static void pcnet_halt(struct eth_device* dev)
|
||||||
printf ("%s: TIMEOUT: controller reset failed\n", dev->name);
|
printf ("%s: TIMEOUT: controller reset failed\n", dev->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue