From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Liu Date: Tue, 5 Dec 2017 10:51:24 +1100 Subject: [U-Boot] [linux-sunxi] [PATCHv6 12/28] net: Add ability to set MAC address via EEPROM In-Reply-To: <20170515080244.21345-13-oliver@schinagl.nl> References: <20170515080244.21345-1-oliver@schinagl.nl> <20170515080244.21345-13-oliver@schinagl.nl> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Olliver, On 15 May 2017 at 18:02, Olliver Schinagl wrote: > This patch allows Kconfig to enable and set parameters to make it > possible to read the MAC address from an EEPROM. The net core layer then > uses this information to read MAC addresses from this EEPROM. > > Besides the various tuneables as to how to access the eeprom (bus, > address, addressing mode/length, 2 configurable that are EEPROM generic > (e.g. SPI or some other form of access) which are: > > NET_ETHADDR_EEPROM_OFFSET, indicating where in the EEPROM the start of > the MAC address is. The default is 8 allowing for 8 bytes before the MAC > for other purposes (header MAGIC for example). Note that Olimex has started to write their own data to the EEPROM for their A20 boards: https://github.com/OLIMEX/OLINUXINO/blob/master/SOFTWARE/A20/A20-eeprom-contents/Olimex-A20-EEPROM-september-2017.pdf > > NET_ETHADDR_EEPROM_CRC8, indicating the MAC is appended with a CRC8-CCIT > checksum that should be verified. > > Currently only I2C eeproms have been tested and thus only those options > are available, but shouldn't be a limit. NET_ETHADDR_EEPROM_SPI can be > just as created and added. > > The code currently first checks if there is a non-zero MAC address in > the eeprom. If that fails to be the case, the read_rom_hwaddr can be > used by a board to supply the MAC in other ways. > > If both these fails, the other code is still in place to query the > environent, which then can be used to override the hardware supplied > data. > > Signed-off-by: Olliver Schinagl Regards, Jonathan