Lines Matching +full:mac +full:- +full:only

1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2006, 2008-2009, 2011 Freescale Semiconductor
20 /* some boards with non-256-bytes EEPROM have special define */
21 /* for MAX_NUM_PORTS in board-specific file */
35 u8 id[4]; /* 0x00 - 0x03 EEPROM Tag 'CCID' */
38 u8 sn[10]; /* 0x06 - 0x0F Serial Number*/
39 u8 errata[2]; /* 0x10 - 0x11 Errata Level */
40 u8 date[6]; /* 0x12 - 0x17 Build Date */
41 u8 res_0[40]; /* 0x18 - 0x3f Reserved */
42 u8 mac_count; /* 0x40 Number of MAC addresses */
43 u8 mac_flag; /* 0x41 MAC table flags */
44 u8 mac[MAX_NUM_PORTS][6]; /* 0x42 - 0x71 MAC addresses */ member
48 u8 id[4]; /* 0x00 - 0x03 EEPROM Tag 'NXID' */
49 u8 sn[12]; /* 0x04 - 0x0F Serial Number */
50 u8 errata[5]; /* 0x10 - 0x14 Errata Level */
51 u8 date[6]; /* 0x15 - 0x1a Build Date */
53 u32 version; /* 0x1c - 0x1f NXID Version */
54 u8 tempcal[8]; /* 0x20 - 0x27 Temperature Calibration Factors */
55 u8 tempcalsys[2]; /* 0x28 - 0x29 System Temperature Calibration Factors */
57 u8 res_1[21]; /* 0x2b - 0x3f Reserved */
58 u8 mac_count; /* 0x40 Number of MAC addresses */
59 u8 mac_flag; /* 0x41 MAC table flags */
60 u8 mac[MAX_NUM_PORTS][6]; /* 0x42 - 0xa1 MAC addresses */ member
61 u8 res_2[90]; /* 0xa2 - 0xfb Reserved */
62 u32 crc; /* 0xfc - 0xff CRC32 checksum */
82 * show_eeprom - display the contents of the EEPROM
115 /* Show MAC addresses */ in show_eeprom()
118 u8 *p = e.mac[i]; in show_eeprom()
124 crc = crc32(0, (void *)&e, sizeof(e) - 4); in show_eeprom()
138 if (((i % 16) == 15) || (i == sizeof(e) - 1)) in show_eeprom()
145 * read_eeprom - read the EEPROM into memory
179 * update_crc - update the CRC
188 crc = crc32(0, (void *)&e, sizeof(e) - 4); in update_crc()
193 * prog_eeprom - write the EEPROM from memory
219 * The AT24C02 datasheet says that data can only be written in page in prog_eeprom()
225 p, min((int)(sizeof(e) - i), 8)); in prog_eeprom()
238 ret = -1; in prog_eeprom()
248 return -1; in prog_eeprom()
256 * h2i - converts hex character into a number
264 return p - '0'; in h2i()
267 return (p - 'A') + 10; in h2i()
270 return (p - 'a') + 10; in h2i()
276 * set_date - stores the build date into the EEPROM
279 * (2-digit year, 2-digit month, etc), converts it to a 6-byte BCD string,
287 printf("Usage: mac date YYMMDDhhmmss\n"); in set_date()
298 * set_mac_address - stores a MAC address into the EEPROM
300 * This function takes a pointer to MAC address string
301 * (i.e."XX:XX:XX:XX:XX:XX", where "XX" is a two-digit hex number) and
302 * stores it in one of the MAC address fields of the EEPROM local copy.
310 printf("Usage: mac <n> XX:XX:XX:XX:XX:XX\n"); in set_mac_address()
315 e.mac[index][i] = simple_strtoul(p, &p, 16); in set_mac_address()
372 strncpy((char *)e.sn, argv[2], sizeof(e.sn) - 1); in do_mac()
388 case 'p': /* MAC table size */ in do_mac()
392 case '0' ... '9': /* "mac 0" through "mac 22" */ in do_mac()
404 * mac_read_from_eeprom - read the MAC addresses from EEPROM
406 * This function reads the MAC addresses from EEPROM and sets the
409 * The environment variables are only set if they haven't been set already.
410 * This ensures that any user-saved variables are never overwritten.
414 * For NXID v1 EEPROMs, we support loading and up-converting the older NXID v0
415 * format. In a v0 EEPROM, there are only eight MAC addresses and the CRC is
455 * MAC address #9 in v1 occupies the same position as the CRC in v0. in mac_read_from_eeprom()
456 * Erase it so that it's not mistaken for a MAC address. We'll in mac_read_from_eeprom()
460 memset(e.mac[8], 0xff, 6); in mac_read_from_eeprom()
464 if (memcmp(&e.mac[i], "\0\0\0\0\0\0", 6) && in mac_read_from_eeprom()
465 memcmp(&e.mac[i], "\xFF\xFF\xFF\xFF\xFF\xFF", 6)) { in mac_read_from_eeprom()
470 e.mac[i][0], in mac_read_from_eeprom()
471 e.mac[i][1], in mac_read_from_eeprom()
472 e.mac[i][2], in mac_read_from_eeprom()
473 e.mac[i][3], in mac_read_from_eeprom()
474 e.mac[i][4], in mac_read_from_eeprom()
475 e.mac[i][5]); in mac_read_from_eeprom()
477 /* Only initialize environment variables that are blank in mac_read_from_eeprom()
495 * that at boot time, U-Boot will still say "NXID v0". in mac_read_from_eeprom()
509 * get_cpu_board_revision - get the CPU board revision on 85xx boards
517 * variable i2c_bus_num must be compile-time initialized to CONFIG_SYS_SPD_BUS_NUM,
518 * so that the SPD code will work. This means that all pre-relocation I2C
519 * operations can only occur on the CONFIG_SYS_SPD_BUS_NUM bus. So if
526 u32 id; /* 0x00 - 0x03 EEPROM Tag 'CCID' */ in get_cpu_board_revision()