
Currently this argument is not used. To eventually support multiple DM9000's these public-facing functions will need a new argument - the ethernet device. Fix-up the one board using this part of the DM9000 API. Compile-tested only.
Signed-off-by: Andrew Ruder andrew.ruder@elecsyscorp.com Cc: Joe Hershberger joe.hershberger@gmail.com Cc: Stefano Babic sbabic@denx.de --- board/trizepsiv/eeprom.c | 5 +++-- drivers/net/dm9000x.c | 10 +++++----- include/dm9000.h | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/board/trizepsiv/eeprom.c b/board/trizepsiv/eeprom.c index 1318edc..d9045dd 100644 --- a/board/trizepsiv/eeprom.c +++ b/board/trizepsiv/eeprom.c @@ -8,6 +8,7 @@ #include <common.h> #include <command.h> #include <dm9000.h> +#include <net.h>
static int do_read_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned int i; @@ -16,7 +17,7 @@ static int do_read_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char * for (i=0; i < 0x40; i++) { if (!(i % 0x10)) printf("\n%08x:", i); - dm9000_read_srom_word(i, data); + dm9000_read_srom_word(eth_get_dev_by_index(0), i, data); printf(" %02x%02x", data[1], data[0]); } printf ("\n"); @@ -35,7 +36,7 @@ static int do_write_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char * printf("Wrong offset : 0x%x\n",offset); return cmd_usage(cmdtp); } - dm9000_write_srom_word(offset, value); + dm9000_write_srom_word(eth_get_dev_by_index(0), offset, value); return (0); }
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index 50a36f3..230f368 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -534,9 +534,9 @@ static int dm9000_rx(struct eth_device *netdev) /* Read a word data from SROM */ -#if !defined(CONFIG_DM9000_NO_SROM) -void dm9000_read_srom_word(int offset, u8 *to) +void dm9000_read_srom_word(struct eth_device *dev, int offset, u8 *to) { + (void)dev; DM9000_iow(DM9000_EPAR, offset); DM9000_iow(DM9000_EPCR, 0x4); udelay(8000); @@ -545,8 +545,9 @@ void dm9000_read_srom_word(int offset, u8 *to) to[1] = DM9000_ior(DM9000_EPDRH); }
-void dm9000_write_srom_word(int offset, u16 val) +void dm9000_write_srom_word(struct eth_device *dev, int offset, u16 val) { + (void)dev; DM9000_iow(DM9000_EPAR, offset); DM9000_iow(DM9000_EPDRH, ((val >> 8) & 0xff)); DM9000_iow(DM9000_EPDRL, (val & 0xff)); @@ -554,14 +555,13 @@ void dm9000_write_srom_word(int offset, u16 val) udelay(8000); DM9000_iow(DM9000_EPCR, 0); } -#endif
static void dm9000_get_enetaddr(struct eth_device *dev) { #if !defined(CONFIG_DM9000_NO_SROM) int i; for (i = 0; i < 3; i++) - dm9000_read_srom_word(i, dev->enetaddr + (2 * i)); + dm9000_read_srom_word(dev, i, dev->enetaddr + (2 * i)); #endif }
diff --git a/include/dm9000.h b/include/dm9000.h index 42b04fa..825c32a 100644 --- a/include/dm9000.h +++ b/include/dm9000.h @@ -8,10 +8,10 @@ #ifndef __DM9000_H__ #define __DM9000_H__
+struct eth_device; + /****************** function prototypes **********************/ -#if !defined(CONFIG_DM9000_NO_SROM) -void dm9000_write_srom_word(int offset, u16 val); -void dm9000_read_srom_word(int offset, u8 *to); -#endif +void dm9000_write_srom_word(struct eth_device *dev, int offset, u16 val); +void dm9000_read_srom_word(struct eth_device *dev, int offset, u8 *to);
#endif /* __DM9000_H__ */