There seem to be a few EEPROM drivers around - perhaps we should have a single standard one? This simple driver is used for sandbox testing, but could be pressed into more active service. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>master
parent
776f96f513
commit
20142019a9
@ -0,0 +1,51 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Google, Inc |
||||||
|
* |
||||||
|
* SPDX-License-Identifier: GPL-2.0+ |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <common.h> |
||||||
|
#include <dm.h> |
||||||
|
#include <i2c.h> |
||||||
|
#include <i2c_eeprom.h> |
||||||
|
|
||||||
|
static int i2c_eeprom_read(struct udevice *dev, int offset, uint8_t *buf, |
||||||
|
int size) |
||||||
|
{ |
||||||
|
return -ENODEV; |
||||||
|
} |
||||||
|
|
||||||
|
static int i2c_eeprom_write(struct udevice *dev, int offset, |
||||||
|
const uint8_t *buf, int size) |
||||||
|
{ |
||||||
|
return -ENODEV; |
||||||
|
} |
||||||
|
|
||||||
|
struct i2c_eeprom_ops i2c_eeprom_std_ops = { |
||||||
|
.read = i2c_eeprom_read, |
||||||
|
.write = i2c_eeprom_write, |
||||||
|
}; |
||||||
|
|
||||||
|
int i2c_eeprom_std_probe(struct udevice *dev) |
||||||
|
{ |
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
static const struct udevice_id i2c_eeprom_std_ids[] = { |
||||||
|
{ .compatible = "i2c-eeprom" }, |
||||||
|
{ } |
||||||
|
}; |
||||||
|
|
||||||
|
U_BOOT_DRIVER(i2c_eeprom_std) = { |
||||||
|
.name = "i2c_eeprom", |
||||||
|
.id = UCLASS_I2C_EEPROM, |
||||||
|
.of_match = i2c_eeprom_std_ids, |
||||||
|
.probe = i2c_eeprom_std_probe, |
||||||
|
.priv_auto_alloc_size = sizeof(struct i2c_eeprom), |
||||||
|
.ops = &i2c_eeprom_std_ops, |
||||||
|
}; |
||||||
|
|
||||||
|
UCLASS_DRIVER(i2c_eeprom) = { |
||||||
|
.id = UCLASS_I2C_EEPROM, |
||||||
|
.name = "i2c_eeprom", |
||||||
|
}; |
@ -0,0 +1,19 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 Google, Inc |
||||||
|
* |
||||||
|
* SPDX-License-Identifier: GPL-2.0+ |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef __I2C_EEPROM |
||||||
|
#define __I2C_EEPROM |
||||||
|
|
||||||
|
struct i2c_eeprom_ops { |
||||||
|
int (*read)(struct udevice *dev, int offset, uint8_t *buf, int size); |
||||||
|
int (*write)(struct udevice *dev, int offset, const uint8_t *buf, |
||||||
|
int size); |
||||||
|
}; |
||||||
|
|
||||||
|
struct i2c_eeprom { |
||||||
|
}; |
||||||
|
|
||||||
|
#endif |
Loading…
Reference in new issue