1
0
Fork 0

drivers/net/pcnet.c: Coding Style cleanup.

Signed-off-by: Wolfgang Denk <wd@denx.de>
utp
Wolfgang Denk 2008-04-24 23:44:26 +02:00
parent 899ef7b845
commit 11ea26fd1c
1 changed files with 365 additions and 355 deletions

View File

@ -195,7 +195,8 @@ int pcnet_initialize(bd_t *bis)
/*
* 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;
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_read_config_word (devbusfn, PCI_COMMAND, &status);
if ((status & command) != command) {
printf("%s: Couldn't enable IO access or Bus Mastering\n",
dev->name);
printf ("%s: Couldn't enable IO access or Bus Mastering\n", dev->name);
free (dev);
continue;
}
@ -241,6 +241,7 @@ static int pcnet_probe(struct eth_device* dev, bd_t *bis, int dev_nr)
{
int chip_version;
char *chipname;
#ifdef PCNET_HAS_PROM
int i;
#endif
@ -255,7 +256,8 @@ static int pcnet_probe(struct eth_device* dev, bd_t *bis, int dev_nr)
}
/* 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)
return -1;
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++) {
unsigned int val;
val = pcnet_read_csr (dev, i + 12) & 0x0ffff;
/* There may be endianness issues here. */
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].buf_length = cpu_to_le16 (-PKT_BUF_SZ);
lp->rx_ring[i].status = cpu_to_le16 (0x8000);
PCNET_DEBUG1("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,
PCNET_DEBUG1
("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);
}
@ -416,12 +420,14 @@ static int pcnet_init(struct eth_device* dev, bd_t *bis)
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;
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 */
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);
PCNET_DEBUG1 (" (status=0x%x)", status);
if (status & 0x20) printf(" Frame");
if (status & 0x10) printf(" Overflow");
if (status & 0x08) printf(" CRC");
if (status & 0x04) printf(" Fifo");
if (status & 0x20)
printf (" Frame");
if (status & 0x10)
printf (" Overflow");
if (status & 0x08)
printf (" CRC");
if (status & 0x04)
printf (" Fifo");
printf (" Error\n");
entry->status &= le16_to_cpu (0x03ff);
} 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) {
printf("%s: Rx%d: invalid packet length %d\n",
dev->name, lp->cur_rx, pkt_len);
printf ("%s: Rx%d: invalid packet length %d\n", dev->name, lp->cur_rx, pkt_len);
} else {
NetReceive (lp->rx_buf[lp->cur_rx], pkt_len);
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);
@ -525,5 +536,4 @@ static void pcnet_halt(struct eth_device* dev)
printf ("%s: TIMEOUT: controller reset failed\n", dev->name);
}
}
#endif