3 * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 static int do_read_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
32 for (i=0; i < 0x40; i++) {
35 dm9000_read_srom_word(i, data);
36 printf(" %02x%02x", data[1], data[0]);
42 static int do_write_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
50 offset=simple_strtoul(argv[2],NULL,16);
51 value=simple_strtoul(argv[3],NULL,16);
53 printf("Wrong offset : 0x%x\n",offset);
57 dm9000_write_srom_word(offset, value);
61 int do_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
67 if (strcmp (argv[1],"read") == 0) {
68 return (do_read_dm9000_eeprom(cmdtp,flag,argc,argv));
69 } else if (strcmp (argv[1],"write") == 0) {
70 return (do_write_dm9000_eeprom(cmdtp,flag,argc,argv));
78 dm9000ee,4,1,do_dm9000_eeprom,
79 "Read/Write eeprom connected to Ethernet Controller",
80 "\ndm9000ee write <word offset> <value> \n"
82 "\tword:\t\t00-02 : MAC Address\n"
83 "\t\t\t03-07 : DM9000 Configuration\n"
84 "\t\t\t08-63 : User data\n");