summaryrefslogtreecommitdiffstats
path: root/drivers/misc/i2c_eeprom.c
diff options
context:
space:
mode:
authorBaruch Siach <baruch@tkos.co.il>2019-04-07 12:38:48 +0300
committerHeiko Schocher <hs@denx.de>2019-04-11 15:21:33 +0200
commita29034d1e6d1c1535055f455b5af5906a7edbc04 (patch)
tree2045df6536fe9b1c36a89beeddfdfccdb84e55dd /drivers/misc/i2c_eeprom.c
parent9985b74bf6d6550b83370e28057f11eab2a647d7 (diff)
downloadu-boot-a29034d1e6d1c1535055f455b5af5906a7edbc04.tar.gz
u-boot-a29034d1e6d1c1535055f455b5af5906a7edbc04.tar.xz
u-boot-a29034d1e6d1c1535055f455b5af5906a7edbc04.zip
misc: i2c_eeprom: support DT pagesize property
Read the page size from DT when available. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers/misc/i2c_eeprom.c')
-rw-r--r--drivers/misc/i2c_eeprom.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c
index 29ad87c1d7..ce2cad44d8 100644
--- a/drivers/misc/i2c_eeprom.c
+++ b/drivers/misc/i2c_eeprom.c
@@ -50,6 +50,12 @@ static int i2c_eeprom_std_ofdata_to_platdata(struct udevice *dev)
{
struct i2c_eeprom *priv = dev_get_priv(dev);
u64 data = dev_get_driver_data(dev);
+ u32 pagesize;
+
+ if (dev_read_u32(dev, "pagesize", &pagesize) == 0) {
+ priv->pagesize = pagesize;
+ return 0;
+ }
/* 6 bit -> page size of up to 2^63 (should be sufficient) */
priv->pagewidth = data & 0x3F;