misc: i2c_eeprom: support DT pagesize property
authorBaruch Siach <baruch@tkos.co.il>
Sun, 7 Apr 2019 09:38:48 +0000 (12:38 +0300)
committerHeiko Schocher <hs@denx.de>
Thu, 11 Apr 2019 13:21:33 +0000 (15:21 +0200)
Read the page size from DT when available.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Heiko Schocher <hs@denx.de>
drivers/misc/i2c_eeprom.c

index 29ad87c..ce2cad4 100644 (file)
@@ -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;