mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-28 14:11:29 +01:00
net: dc2114x: Clean up init code
Clean up the driver init code to bring it up to standards with U-Boot coding style, no functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
parent
69529c9120
commit
ca5cb04b7f
@ -167,20 +167,19 @@ static struct pci_device_id supported[] = {
|
|||||||
|
|
||||||
int dc21x4x_initialize(bd_t *bis)
|
int dc21x4x_initialize(bd_t *bis)
|
||||||
{
|
{
|
||||||
int idx=0;
|
|
||||||
int card_number = 0;
|
|
||||||
unsigned int cfrv;
|
|
||||||
unsigned char timer;
|
|
||||||
pci_dev_t devbusfn;
|
|
||||||
unsigned int iobase;
|
|
||||||
unsigned short status;
|
|
||||||
struct eth_device *dev;
|
struct eth_device *dev;
|
||||||
|
unsigned short status;
|
||||||
|
unsigned char timer;
|
||||||
|
unsigned int iobase;
|
||||||
|
int card_number = 0;
|
||||||
|
pci_dev_t devbusfn;
|
||||||
|
unsigned int cfrv;
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
devbusfn = pci_find_devices(supported, idx++);
|
devbusfn = pci_find_devices(supported, idx++);
|
||||||
if (devbusfn == -1) {
|
if (devbusfn == -1)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the chip configuration revision register. */
|
/* Get the chip configuration revision register. */
|
||||||
pci_read_config_dword(devbusfn, PCI_REVISION_ID, &cfrv);
|
pci_read_config_dword(devbusfn, PCI_REVISION_ID, &cfrv);
|
||||||
@ -191,9 +190,7 @@ int dc21x4x_initialize(bd_t *bis)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pci_read_config_word(devbusfn, PCI_COMMAND, &status);
|
pci_read_config_word(devbusfn, PCI_COMMAND, &status);
|
||||||
status |=
|
status |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
|
||||||
PCI_COMMAND_MEMORY |
|
|
||||||
PCI_COMMAND_MASTER;
|
|
||||||
pci_write_config_word(devbusfn, PCI_COMMAND, status);
|
pci_write_config_word(devbusfn, PCI_COMMAND, status);
|
||||||
|
|
||||||
pci_read_config_word(devbusfn, PCI_COMMAND, &status);
|
pci_read_config_word(devbusfn, PCI_COMMAND, &status);
|
||||||
@ -211,7 +208,8 @@ int dc21x4x_initialize(bd_t *bis)
|
|||||||
pci_read_config_byte(devbusfn, PCI_LATENCY_TIMER, &timer);
|
pci_read_config_byte(devbusfn, PCI_LATENCY_TIMER, &timer);
|
||||||
|
|
||||||
if (timer < 0x60) {
|
if (timer < 0x60) {
|
||||||
pci_write_config_byte(devbusfn, PCI_LATENCY_TIMER, 0x60);
|
pci_write_config_byte(devbusfn, PCI_LATENCY_TIMER,
|
||||||
|
0x60);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read BAR for memory space access */
|
/* read BAR for memory space access */
|
||||||
@ -219,12 +217,12 @@ int dc21x4x_initialize(bd_t *bis)
|
|||||||
iobase &= PCI_BASE_ADDRESS_MEM_MASK;
|
iobase &= PCI_BASE_ADDRESS_MEM_MASK;
|
||||||
debug("dc21x4x: DEC 21142 PCI Device @0x%x\n", iobase);
|
debug("dc21x4x: DEC 21142 PCI Device @0x%x\n", iobase);
|
||||||
|
|
||||||
dev = (struct eth_device*) malloc(sizeof *dev);
|
dev = (struct eth_device *)malloc(sizeof(*dev));
|
||||||
|
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
printf("Can not allocalte memory of dc21x4x\n");
|
printf("Can not allocalte memory of dc21x4x\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(dev, 0, sizeof(*dev));
|
memset(dev, 0, sizeof(*dev));
|
||||||
|
|
||||||
sprintf(dev->name, "dc21x4x#%d", card_number);
|
sprintf(dev->name, "dc21x4x#%d", card_number);
|
||||||
@ -271,8 +269,8 @@ static int dc21x4x_init(struct eth_device* dev, bd_t* bis)
|
|||||||
for (i = 0; i < NUM_RX_DESC; i++) {
|
for (i = 0; i < NUM_RX_DESC; i++) {
|
||||||
rx_ring[i].status = cpu_to_le32(R_OWN);
|
rx_ring[i].status = cpu_to_le32(R_OWN);
|
||||||
rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ);
|
rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ);
|
||||||
rx_ring[i].buf = cpu_to_le32(
|
rx_ring[i].buf =
|
||||||
phys_to_bus((u32)net_rx_packets[i]));
|
cpu_to_le32(phys_to_bus((u32)net_rx_packets[i]));
|
||||||
rx_ring[i].next = 0;
|
rx_ring[i].next = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user