1 // SPDX-License-Identifier: GPL-2.0
5 * (C) Copyright 2022 Hewlett Packard Enterprise Development LP.
6 * Author: Nick Hawkins <nick.hawkins@hpe.com>
7 * Author: Jean-Marie Verdun <verdun@hpe.com>
18 struct gxp_timer_priv {
22 static u64 gxp_timer_get_count(struct udevice *dev)
24 struct gxp_timer_priv *priv = dev_get_priv(dev);
27 val = readl(priv->base + USTIMEHI);
28 val = (val << 32) | readl(priv->base + USTIMELO);
33 static int gxp_timer_probe(struct udevice *dev)
35 struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
36 struct gxp_timer_priv *priv = dev_get_priv(dev);
38 priv->base = dev_read_addr_ptr(dev);
42 uc_priv->clock_rate = 1000000;
47 static const struct timer_ops gxp_timer_ops = {
48 .get_count = gxp_timer_get_count,
51 static const struct udevice_id gxp_timer_ids[] = {
52 { .compatible = "hpe,gxp-timer" },
56 U_BOOT_DRIVER(gxp_timer) = {
59 .of_match = gxp_timer_ids,
60 .priv_auto = sizeof(struct gxp_timer_priv),
61 .probe = gxp_timer_probe,
62 .ops = &gxp_timer_ops,
63 .flags = DM_FLAG_PRE_RELOC,