提交 5ae84860 编写于 作者: B Baruch Siach 提交者: Heiko Schocher

misc: i2c_eeprom: verify that the chip is functional at probe()

Read a single byte from EEPROM to verify that it is actually there.

This is equivalent to Linux kernel commit 00f0ea70d2b8 ("eeprom: at24:
check if the chip is functional in probe()").

Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: NBaruch Siach <baruch@tkos.co.il>

hs: fixed style check prefer kernel type 'u8' over 'uint8_t'
上级 d7d86401
......@@ -84,6 +84,14 @@ static int i2c_eeprom_std_ofdata_to_platdata(struct udevice *dev)
static int i2c_eeprom_std_probe(struct udevice *dev)
{
u8 test_byte;
int ret;
/* Verify that the chip is functional */
ret = i2c_eeprom_read(dev, 0, &test_byte, 1);
if (ret)
return -ENODEV;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册