3 * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
5 * SPDX-License-Identifier: GPL-2.0+
12 static int do_read_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
16 for (i=0; i < 0x40; i++) {
19 dm9000_read_srom_word(i, data);
20 printf(" %02x%02x", data[1], data[0]);
26 static int do_write_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
30 return cmd_usage(cmdtp);
32 offset=simple_strtoul(argv[2],NULL,16);
33 value=simple_strtoul(argv[3],NULL,16);
35 printf("Wrong offset : 0x%x\n",offset);
36 return cmd_usage(cmdtp);
38 dm9000_write_srom_word(offset, value);
42 int do_dm9000_eeprom ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {
44 return cmd_usage(cmdtp);
46 if (strcmp (argv[1],"read") == 0)
47 return (do_read_dm9000_eeprom(cmdtp,flag,argc,argv));
48 else if (strcmp (argv[1],"write") == 0)
49 return (do_write_dm9000_eeprom(cmdtp,flag,argc,argv));
51 return cmd_usage(cmdtp);
55 dm9000ee,4,1,do_dm9000_eeprom,
56 "Read/Write eeprom connected to Ethernet Controller",
57 "\ndm9000ee write <word offset> <value> \n"
59 "\tword:\t\t00-02 : MAC Address\n"
60 "\t\t\t03-07 : DM9000 Configuration\n"
61 "\t\t\t08-63 : User data"