diff options
author | Peter Delevoryas <peter@pjd.dev> | 2023-02-07 09:02:04 +0100 |
---|---|---|
committer | Cédric Le Goater <clg@kaod.org> | 2023-02-07 09:02:04 +0100 |
commit | 9618ebae453f2492a60e741d40f5212103f48ad3 (patch) | |
tree | 58271d4186260f525d0b841d4a70390c86b71a67 /include/hw/nvram | |
parent | ddbf7bd73c9c79dc48f5981100876242df533d8e (diff) | |
download | qemu-9618ebae453f2492a60e741d40f5212103f48ad3.zip qemu-9618ebae453f2492a60e741d40f5212103f48ad3.tar.gz qemu-9618ebae453f2492a60e741d40f5212103f48ad3.tar.bz2 |
hw/arm: Extract at24c_eeprom_init helper from Aspeed and Nuvoton boards
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>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
Link: https://lore.kernel.org/r/20230128060543.95582-2-peter@pjd.dev
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'include/hw/nvram')
-rw-r--r-- | include/hw/nvram/eeprom_at24c.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/hw/nvram/eeprom_at24c.h b/include/hw/nvram/eeprom_at24c.h new file mode 100644 index 0000000..196db30 --- /dev/null +++ b/include/hw/nvram/eeprom_at24c.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +#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 + * @address: 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_init(I2CBus *bus, uint8_t address, uint32_t rom_size); + +#endif |