test: Load mac address with i2c eeprom
This uses an i2c eeprom to load a mac address using the nvmem interface. Enable I2C_EEPROM for sandbox SPL since it is the only sandbox config which doesn't enable it eeprom. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
97d0f9bfdd
commit
472caa69e3
@ -538,7 +538,8 @@
|
|||||||
eth_3: sbe5 {
|
eth_3: sbe5 {
|
||||||
compatible = "sandbox,eth";
|
compatible = "sandbox,eth";
|
||||||
reg = <0x10005000 0x1000>;
|
reg = <0x10005000 0x1000>;
|
||||||
mac-address = [ 02 00 11 22 33 45 ];
|
nvmem-cells = <ð3_addr>;
|
||||||
|
nvmem-cell-names = "mac-address";
|
||||||
};
|
};
|
||||||
|
|
||||||
eth@10004000 {
|
eth@10004000 {
|
||||||
@ -701,6 +702,8 @@
|
|||||||
pinctrl-0 = <&pinmux_i2c0_pins>;
|
pinctrl-0 = <&pinmux_i2c0_pins>;
|
||||||
|
|
||||||
eeprom@2c {
|
eeprom@2c {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
reg = <0x2c>;
|
reg = <0x2c>;
|
||||||
compatible = "i2c-eeprom";
|
compatible = "i2c-eeprom";
|
||||||
sandbox,emul = <&emul_eeprom>;
|
sandbox,emul = <&emul_eeprom>;
|
||||||
@ -712,6 +715,10 @@
|
|||||||
reg = <10 2>;
|
reg = <10 2>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
eth3_addr: mac-address@24 {
|
||||||
|
reg = <24 6>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
rtc_0: rtc@43 {
|
rtc_0: rtc@43 {
|
||||||
|
@ -155,6 +155,7 @@ CONFIG_CROS_EC_SPI=y
|
|||||||
CONFIG_P2SB=y
|
CONFIG_P2SB=y
|
||||||
CONFIG_PWRSEQ=y
|
CONFIG_PWRSEQ=y
|
||||||
CONFIG_SPL_PWRSEQ=y
|
CONFIG_SPL_PWRSEQ=y
|
||||||
|
CONFIG_I2C_EEPROM=y
|
||||||
CONFIG_MMC_SANDBOX=y
|
CONFIG_MMC_SANDBOX=y
|
||||||
CONFIG_SPI_FLASH_SANDBOX=y
|
CONFIG_SPI_FLASH_SANDBOX=y
|
||||||
CONFIG_SPI_FLASH_ATMEL=y
|
CONFIG_SPI_FLASH_ATMEL=y
|
||||||
|
@ -171,11 +171,15 @@ static int sandbox_i2c_eeprom_probe(struct udevice *dev)
|
|||||||
{
|
{
|
||||||
struct sandbox_i2c_flash_plat_data *plat = dev_get_plat(dev);
|
struct sandbox_i2c_flash_plat_data *plat = dev_get_plat(dev);
|
||||||
struct sandbox_i2c_flash *priv = dev_get_priv(dev);
|
struct sandbox_i2c_flash *priv = dev_get_priv(dev);
|
||||||
|
/* For eth3 */
|
||||||
|
const u8 mac[] = { 0x02, 0x00, 0x11, 0x22, 0x33, 0x45 };
|
||||||
|
|
||||||
priv->data = calloc(1, plat->size);
|
priv->data = calloc(1, plat->size);
|
||||||
if (!priv->data)
|
if (!priv->data)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
memcpy(&priv->data[24], mac, sizeof(mac));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user