xref: /openbmc/u-boot/drivers/misc/i2c_eeprom.c (revision 2bb1cd53)
1 /*
2  * Copyright (c) 2014 Google, Inc
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #include <common.h>
8 #include <linux/err.h>
9 #include <dm.h>
10 #include <i2c.h>
11 #include <i2c_eeprom.h>
12 
13 static int i2c_eeprom_read(struct udevice *dev, int offset, uint8_t *buf,
14 			   int size)
15 {
16 	return -ENODEV;
17 }
18 
19 static int i2c_eeprom_write(struct udevice *dev, int offset,
20 			    const uint8_t *buf, int size)
21 {
22 	return -ENODEV;
23 }
24 
25 struct i2c_eeprom_ops i2c_eeprom_std_ops = {
26 	.read	= i2c_eeprom_read,
27 	.write	= i2c_eeprom_write,
28 };
29 
30 int i2c_eeprom_std_probe(struct udevice *dev)
31 {
32 	return 0;
33 }
34 
35 static const struct udevice_id i2c_eeprom_std_ids[] = {
36 	{ .compatible = "i2c-eeprom" },
37 	{ }
38 };
39 
40 U_BOOT_DRIVER(i2c_eeprom_std) = {
41 	.name		= "i2c_eeprom",
42 	.id		= UCLASS_I2C_EEPROM,
43 	.of_match	= i2c_eeprom_std_ids,
44 	.probe		= i2c_eeprom_std_probe,
45 	.priv_auto_alloc_size = sizeof(struct i2c_eeprom),
46 	.ops		= &i2c_eeprom_std_ops,
47 };
48 
49 UCLASS_DRIVER(i2c_eeprom) = {
50 	.id		= UCLASS_I2C_EEPROM,
51 	.name		= "i2c_eeprom",
52 };
53