[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/5] hw/arm: Extract at24c_eeprom_init helper from Aspeed
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v2 1/5] hw/arm: Extract at24c_eeprom_init helper from Aspeed and Nuvoton boards |
Date: |
Tue, 17 Jan 2023 09:00:34 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 |
On 17/1/23 00:56, Peter Delevoryas wrote:
This helper is useful in board initialization because lets users initialize and
realize an EEPROM on an I2C bus with a single function call.
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
---
hw/arm/aspeed.c | 10 +---------
hw/arm/npcm7xx_boards.c | 20 +++++---------------
hw/nvram/eeprom_at24c.c | 12 ++++++++++++
include/hw/nvram/eeprom_at24c.h | 10 ++++++++++
4 files changed, 28 insertions(+), 24 deletions(-)
create mode 100644 include/hw/nvram/eeprom_at24c.h
diff --git a/include/hw/nvram/eeprom_at24c.h b/include/hw/nvram/eeprom_at24c.h
new file mode 100644
index 000000000000..79a36b53ca87
--- /dev/null
+++ b/include/hw/nvram/eeprom_at24c.h
@@ -0,0 +1,10 @@
+/* Copyright (c) Meta Platforms, Inc. and affiliates. */
What license for this copyright?
+#ifndef EEPROM_AT24C_H
+#define EEPROM_AT24C_H
+
+#include "hw/i2c/i2c.h"
/**
* Create and realize an AT24C EEPROM device on the heap.
* @bus: I2C bus to put it on
* @addr: I2C address of the EEPROM slave when put on a bus
* @rom_size: size of the EEPROM
*
* Create the device state structure, initialize it, put it on
* the specified @bus, and drop the reference to it (the device
* is realized).
*/
I2CSlave *at24c_eeprom_create_simple(I2CBus *bus, uint8_t addr,
size_t rom_size);
+I2CSlave *at24c_eeprom_init(I2CBus *bus, uint8_t address, uint32_t rom_size);
+
+#endif