From: Alexander Feilke <[email protected]> Supported devices:
- generic PCF85063 / PCF85063TP (no alarm regs) - PCF85063A / PCF85073A (alarm regs) Tested with TQMa8MPxL SOM from TQ-Systems GmbH. Also add missing .data field to rv8263 which represents the number of available registers (= linux `pcf85063_config.max_register + 1`). Signed-off-by: Markus Niebel <[email protected]> Signed-off-by: Alexander Feilke <[email protected]> --- drivers/rtc/pcf85063.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/rtc/pcf85063.c b/drivers/rtc/pcf85063.c index 21640b039c1..183a214a3e9 100644 --- a/drivers/rtc/pcf85063.c +++ b/drivers/rtc/pcf85063.c @@ -80,12 +80,18 @@ static int pcf85063_reset(struct udevice *dev) static int pcf85063_read(struct udevice *dev, unsigned int offset, u8 *buf, unsigned int len) { + if (offset + len > dev->driver_data) + return -EINVAL; + return dm_i2c_read(dev, offset, buf, len); } static int pcf85063_write(struct udevice *dev, unsigned int offset, const u8 *buf, unsigned int len) { + if (offset + len > dev->driver_data) + return -EINVAL; + return dm_i2c_write(dev, offset, buf, len); } @@ -105,7 +111,11 @@ static int pcf85063_probe(struct udevice *dev) } static const struct udevice_id pcf85063_of_id[] = { - { .compatible = "microcrystal,rv8263" }, + { .compatible = "microcrystal,rv8263", .data = 0x12 }, + { .compatible = "nxp,pcf85063", .data = 0xb }, + { .compatible = "nxp,pcf85063a", .data = 0x12 }, + { .compatible = "nxp,pcf85063tp", .data = 0xb }, + { .compatible = "nxp,pcf85073a", .data = 0x12 }, { } }; -- 2.34.1

