[PATCH 0/6] hw/nvram/eeprom_at24c: Cleanup + FRUID EEPROM init example

Peter Delevoryas posted 6 patches 1 year, 3 months ago
There is a newer version of this series
hw/arm/aspeed.c                 | 154 +++++++++++++++++++-------------
hw/arm/npcm7xx_boards.c         |  20 ++---
hw/nvram/eeprom_at24c.c         |  25 ++++++
include/hw/nvram/eeprom_at24c.h |  12 +++
4 files changed, 135 insertions(+), 76 deletions(-)
create mode 100644 include/hw/nvram/eeprom_at24c.h
[PATCH 0/6] hw/nvram/eeprom_at24c: Cleanup + FRUID EEPROM init example
Posted by Peter Delevoryas 1 year, 3 months ago
This cleans up some of the code we have creating at24c-eeprom objects in the
Aspeed and Nuvoton files, and adds an example of how to initialize a FRUID
EEPROM with static data using I2C transfers.

Initially I was going to propose a patch to update the at24c-eeprom realize
function to incorporate static data, but then I realized I could just
accomplish the same thing using i2c_send in board reset. The patch at the end
demonstrates this.

Thanks,
Peter

Peter Delevoryas (6):
  hw/nvram/eeprom_at24c: Add header w/ init helper
  hw/arm/aspeed: Remove local copy of at24c_eeprom_init
  hw/arm/aspeed: Replace aspeed_eeprom_init with at24c_eeprom_init
  hw/arm/npcm7xx: Remove local copy of at24c_eeprom_init
  hw/nvram/eeprom_at24c: Add I2C write helper
  hw/arm/aspeed: Init fby35 BMC FRUID EEPROM

 hw/arm/aspeed.c                 | 154 +++++++++++++++++++-------------
 hw/arm/npcm7xx_boards.c         |  20 ++---
 hw/nvram/eeprom_at24c.c         |  25 ++++++
 include/hw/nvram/eeprom_at24c.h |  12 +++
 4 files changed, 135 insertions(+), 76 deletions(-)
 create mode 100644 include/hw/nvram/eeprom_at24c.h

-- 
2.39.0
Re: [PATCH 0/6] hw/nvram/eeprom_at24c: Cleanup + FRUID EEPROM init example
Posted by Peter Delevoryas 1 year, 3 months ago
On Sat, Jan 14, 2023 at 09:01:45AM -0800, Peter Delevoryas wrote:
> This cleans up some of the code we have creating at24c-eeprom objects in the
> Aspeed and Nuvoton files, and adds an example of how to initialize a FRUID
> EEPROM with static data using I2C transfers.
> 
> Initially I was going to propose a patch to update the at24c-eeprom realize
> function to incorporate static data, but then I realized I could just
> accomplish the same thing using i2c_send in board reset. The patch at the end
> demonstrates this.

1. I messed up Joel's email on this thread, sorry about that.
2. I forgot to post the output of the test I used to verify this:

qemu-system-aarch64 -machine fby35-bmc -nographic -mtdblock flash-fby35
...
root@bmc-oob:~# fruid-util bmc

FRU Information           : BMC
---------------           : ------------------
Board Mfg Date            : Mon Jan 10 21:42:00 2022
Board Mfg                 : XXXXXX
Board Product             : BMC Storage Module
Board Serial              : XXXXXXXXXXXXX
Board Part Number         : XXXXXXXXXXXXXX
Board FRU ID              : 1.0
Board Custom Data 1       : XXXXXXXXX
Board Custom Data 2       : XXXXXXXXXXXXXXXXXX
Product Manufacturer      : XXXXXX
Product Name              : Yosemite V3.5 EVT2
Product Part Number       : XXXXXXXXXXXXXX
Product Version           : EVT2
Product Serial            : XXXXXXXXXXXXX
Product Asset Tag         : XXXXXXX
Product FRU ID            : 1.0
Product Custom Data 1     : XXXXXXXXX
Product Custom Data 2     : Config A

A reference flash-fby35 image can be found here:

https://github.com/facebook/openbmc/releases/download/openbmc-e2294ff5d31d/fby35.mtd

> 
> Thanks,
> Peter
> 
> Peter Delevoryas (6):
>   hw/nvram/eeprom_at24c: Add header w/ init helper
>   hw/arm/aspeed: Remove local copy of at24c_eeprom_init
>   hw/arm/aspeed: Replace aspeed_eeprom_init with at24c_eeprom_init
>   hw/arm/npcm7xx: Remove local copy of at24c_eeprom_init
>   hw/nvram/eeprom_at24c: Add I2C write helper
>   hw/arm/aspeed: Init fby35 BMC FRUID EEPROM
> 
>  hw/arm/aspeed.c                 | 154 +++++++++++++++++++-------------
>  hw/arm/npcm7xx_boards.c         |  20 ++---
>  hw/nvram/eeprom_at24c.c         |  25 ++++++
>  include/hw/nvram/eeprom_at24c.h |  12 +++
>  4 files changed, 135 insertions(+), 76 deletions(-)
>  create mode 100644 include/hw/nvram/eeprom_at24c.h
> 
> -- 
> 2.39.0
> 
>