]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
Add config option for disabling DM9000-SROM support.
authorRemy Bohmer <linux@bohmer.net>
Sun, 3 May 2009 10:11:40 +0000 (12:11 +0200)
committerBen Warren <biggerbadderben@gmail.com>
Tue, 9 Jun 2009 05:57:21 +0000 (22:57 -0700)
Some boards do not have SROM support for the DM9000 network adapter.
Instead of listing these board names in the driver code, make this
option configurable from the board config file.

It also removes a build warning for the at91sam9261ek board:
'dm9000x.c:545: warning: 'read_srom_word' defined but not used'

And it repaires the trizepsiv board build which was broken around the
same routines

Signed-off-by: Remy Bohmer <linux@bohmer.net>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
board/trizepsiv/eeprom.c
drivers/net/dm9000x.c
include/configs/at91sam9261ek.h
include/dm9000.h [new file with mode: 0644]

index 63f1c6cdf799a4fbe40a246f5261b21e1598b1d2..9fa7aef9a29864fa14a78df9fa32641801d9a046 100644 (file)
 
 #include <common.h>
 #include <command.h>
-
-extern u16 read_srom_word(int);
-extern void write_srom_word(int offset, u16 val);
+#include <dm9000.h>
 
 static int do_read_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
-       int i;
+       unsigned int i;
+       u8 data[2];
 
        for (i=0; i < 0x40; i++) {
                if (!(i % 0x10))
-                       printf("\n%08lx:", i);
-               printf(" %04x", read_srom_word(i));
+                       printf("\n%08x:", i);
+               dm9000_read_srom_word(i, data);
+               printf(" %02x%02x", data[1], data[0]);
        }
        printf ("\n");
        return (0);
@@ -54,7 +54,7 @@ static int do_write_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *
                cmd_usage(cmdtp);
                return 1;
        }
-       write_srom_word(offset, value);
+       dm9000_write_srom_word(offset, value);
        return (0);
 }
 
index 8ca2bf715c0bd203ae6c960c5a449ad257e97849..f1394354eb39350c5690ebd58839489db19a53c6 100644 (file)
@@ -53,7 +53,7 @@ v1.2   03/18/2003       Weilun Huang <weilun_huang@davicom.com.tw>:
                          notes (i.e. double reset)
                        - some minor code cleanups
                        These changes are tested with DM9000{A,EP,E} together
-                       with a 200MHz Atmel AT91SAM92161 core
+                       with a 200MHz Atmel AT91SAM9261 core
 
 TODO: external MII is not functional, only internal at the moment.
 */
@@ -62,6 +62,7 @@ TODO: external MII is not functional, only internal at the moment.
 #include <command.h>
 #include <net.h>
 #include <asm/io.h>
+#include <dm9000.h>
 
 #include "dm9000x.h"
 
@@ -113,7 +114,6 @@ void eth_halt(void);
 static int dm9000_probe(void);
 static u16 phy_read(int);
 static void phy_write(int, u16);
-static void read_srom_word(int, u8 *);
 static u8 DM9000_ior(int);
 static void DM9000_iow(int reg, u8 value);
 
@@ -347,9 +347,9 @@ eth_init(bd_t * bd)
 
        /* Set Node address */
        if (!eth_getenv_enetaddr("ethaddr", enetaddr)) {
-#if !defined(CONFIG_AT91SAM9261EK)
+#if !defined(CONFIG_DM9000_NO_SROM)
                for (i = 0; i < 3; i++)
-                       read_srom_word(i, enetaddr + 2 * i);
+                       dm9000_read_srom_word(i, enetaddr + 2 * i);
                eth_setenv_enetaddr("ethaddr", enetaddr);
 #endif
        }
@@ -541,7 +541,8 @@ eth_rx(void)
 /*
   Read a word data from SROM
 */
-static void read_srom_word(int offset, u8 *to)
+#if !defined(CONFIG_DM9000_NO_SROM)
+void dm9000_read_srom_word(int offset, u8 *to)
 {
        DM9000_iow(DM9000_EPAR, offset);
        DM9000_iow(DM9000_EPCR, 0x4);
@@ -551,8 +552,7 @@ static void read_srom_word(int offset, u8 *to)
        to[1] = DM9000_ior(DM9000_EPDRH);
 }
 
-void
-write_srom_word(int offset, u16 val)
+void dm9000_write_srom_word(int offset, u16 val)
 {
        DM9000_iow(DM9000_EPAR, offset);
        DM9000_iow(DM9000_EPDRH, ((val >> 8) & 0xff));
@@ -561,7 +561,7 @@ write_srom_word(int offset, u16 val)
        udelay(8000);
        DM9000_iow(DM9000_EPCR, 0);
 }
-
+#endif
 
 /*
    Read a byte from I/O port
index fdaa71cfcc354da25b1a72b00a077e4ac37d2ad4..9621b7cb324e01a61c17c488b70dd5dc4532f180 100644 (file)
 #define DM9000_IO                      CONFIG_DM9000_BASE
 #define DM9000_DATA                    (CONFIG_DM9000_BASE + 4)
 #define CONFIG_DM9000_USE_16BIT                1
+#define CONFIG_DM9000_NO_SROM          1
 #define CONFIG_NET_RETRY_COUNT         20
 #define CONFIG_RESET_PHY_R             1
 
diff --git a/include/dm9000.h b/include/dm9000.h
new file mode 100644 (file)
index 0000000..76f9bfd
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * NOTE:        DAVICOM DM9000 ethernet driver interface
+ *
+ * Authors:     Remy Bohmer <linux@bohmer.net>
+ *
+ *              This program is free software; you can redistribute it and/or
+ *              modify it under the terms of the GNU General Public License
+ *              as published by the Free Software Foundation; either version
+ *              2 of the License, or (at your option) any later version.
+ */
+#ifndef __DM9000_H__
+#define __DM9000_H__
+
+/******************  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
+
+#endif /* __DM9000_H__ */