projects
/
platform
/
kernel
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
e1000: Allow direct access to the E1000 SPI EEPROM device
[platform/kernel/u-boot.git]
/
drivers
/
net
/
dc2114x.c
diff --git
a/drivers/net/dc2114x.c
b/drivers/net/dc2114x.c
index
8117239
..
0fb616a
100644
(file)
--- a/
drivers/net/dc2114x.c
+++ b/
drivers/net/dc2114x.c
@@
-21,6
+21,7
@@
#include <common.h>
#include <malloc.h>
#include <net.h>
#include <common.h>
#include <malloc.h>
#include <net.h>
+#include <netdev.h>
#include <pci.h>
#undef DEBUG_SROM
#include <pci.h>
#undef DEBUG_SROM
@@
-244,15
+245,17
@@
int dc21x4x_initialize(bd_t *bis)
pci_write_config_word(devbusfn, PCI_COMMAND, status);
pci_read_config_word(devbusfn, PCI_COMMAND, &status);
pci_write_config_word(devbusfn, PCI_COMMAND, status);
pci_read_config_word(devbusfn, PCI_COMMAND, &status);
+#ifdef CONFIG_TULIP_USE_IO
if (!(status & PCI_COMMAND_IO)) {
printf("Error: Can not enable I/O access.\n");
continue;
}
if (!(status & PCI_COMMAND_IO)) {
printf("Error: Can not enable I/O access.\n");
continue;
}
-
- if (!(status & PCI_COMMAND_
IO
)) {
- printf("Error: Can not enable
I/O
access.\n");
+#else
+ if (!(status & PCI_COMMAND_
MEMORY
)) {
+ printf("Error: Can not enable
MEMORY
access.\n");
continue;
}
continue;
}
+#endif
if (!(status & PCI_COMMAND_MASTER)) {
printf("Error: Can not enable Bus Mastering.\n");
if (!(status & PCI_COMMAND_MASTER)) {
printf("Error: Can not enable Bus Mastering.\n");
@@
-279,6
+282,12
@@
int dc21x4x_initialize(bd_t *bis)
dev = (struct eth_device*) malloc(sizeof *dev);
dev = (struct eth_device*) malloc(sizeof *dev);
+ if (!dev) {
+ printf("Can not allocalte memory of dc21x4x\n");
+ break;
+ }
+ memset(dev, 0, sizeof(*dev));
+
#ifdef CONFIG_TULIP_FIX_DAVICOM
sprintf(dev->name, "Davicom#%d", card_number);
#else
#ifdef CONFIG_TULIP_FIX_DAVICOM
sprintf(dev->name, "Davicom#%d", card_number);
#else
@@
-751,11
+760,14
@@
static void update_srom(struct eth_device *dev, bd_t *bis)
0x0000, 0x0000, 0x0000, 0x0000, /* 38 */
0x0000, 0x0000, 0x0000, 0x4e07, /* 3c */
};
0x0000, 0x0000, 0x0000, 0x0000, /* 38 */
0x0000, 0x0000, 0x0000, 0x4e07, /* 3c */
};
+ uchar enetaddr[6];
/* Ethernet Addr... */
/* Ethernet Addr... */
- eeprom[0x0a] = ((bis->bi_enetaddr[1] & 0xff) << 8) | (bis->bi_enetaddr[0] & 0xff);
- eeprom[0x0b] = ((bis->bi_enetaddr[3] & 0xff) << 8) | (bis->bi_enetaddr[2] & 0xff);
- eeprom[0x0c] = ((bis->bi_enetaddr[5] & 0xff) << 8) | (bis->bi_enetaddr[4] & 0xff);
+ if (!eth_getenv_enetaddr("ethaddr", enetaddr))
+ return;
+ eeprom[0x0a] = (enetaddr[1] << 8) | enetaddr[0];
+ eeprom[0x0b] = (enetaddr[3] << 8) | enetaddr[2];
+ eeprom[0x0c] = (enetaddr[5] << 8) | enetaddr[4];
for (i=0; i<0x40; i++) {
write_srom(dev, DE4X5_APROM, i, eeprom[i]);
for (i=0; i<0x40; i++) {
write_srom(dev, DE4X5_APROM, i, eeprom[i]);