2 * (C) Copyright 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
5 * SPDX-License-Identifier: GPL-2.0+
13 int dm_rtc_get(struct udevice *dev, struct rtc_time *time)
15 struct rtc_ops *ops = rtc_get_ops(dev);
20 return ops->get(dev, time);
23 int dm_rtc_set(struct udevice *dev, struct rtc_time *time)
25 struct rtc_ops *ops = rtc_get_ops(dev);
30 return ops->set(dev, time);
33 int dm_rtc_reset(struct udevice *dev)
35 struct rtc_ops *ops = rtc_get_ops(dev);
40 return ops->reset(dev);
43 int rtc_read8(struct udevice *dev, unsigned int reg)
45 struct rtc_ops *ops = rtc_get_ops(dev);
50 return ops->read8(dev, reg);
53 int rtc_write8(struct udevice *dev, unsigned int reg, int val)
55 struct rtc_ops *ops = rtc_get_ops(dev);
60 return ops->write8(dev, reg, val);
63 int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep)
69 for (i = 0; i < sizeof(value); i++) {
70 ret = rtc_read8(dev, reg + i);
73 value |= ret << (i << 3);
80 int rtc_write32(struct udevice *dev, unsigned int reg, u32 value)
84 for (i = 0; i < sizeof(value); i++) {
85 ret = rtc_write8(dev, reg + i, (value >> (i << 3)) & 0xff);
93 UCLASS_DRIVER(rtc) = {