summaryrefslogtreecommitdiff
path: root/drivers/timer
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-01-06 06:34:43 +0300
committerTom Rini <trini@konsulko.com>2021-01-06 06:34:43 +0300
commitb11f634b1c1be6ab419758c6596c673445e5ac70 (patch)
tree2329e1ff53c6c543e01d84b7901c53621ad8b7f9 /drivers/timer
parent720620e6916ba40b9a173bb07706d2c73f3c23e7 (diff)
parent970349a96dac3ad46c33851b1a773bfe3f1d4b33 (diff)
downloadu-boot-b11f634b1c1be6ab419758c6596c673445e5ac70.tar.xz
Merge tag 'dm-pull-5jan21' of git://git.denx.de/u-boot-dm into next
Driver model: make some udevice fields private Driver model: Rename U_BOOT_DEVICE et al. dtoc: Tidy up and add more tests ns16550 code clean-up x86 and sandbox minor fixes for of-platdata dtoc prepration for adding build-time instantiation
Diffstat (limited to 'drivers/timer')
-rw-r--r--drivers/timer/ag101p_timer.c4
-rw-r--r--drivers/timer/altera_timer.c4
-rw-r--r--drivers/timer/andes_plmt_timer.c7
-rw-r--r--drivers/timer/mpc83xx_timer.c2
-rw-r--r--drivers/timer/sandbox_timer.c2
-rw-r--r--drivers/timer/sifive_clint_timer.c7
-rw-r--r--drivers/timer/timer-uclass.c4
-rw-r--r--drivers/timer/tsc_timer.c4
8 files changed, 19 insertions, 15 deletions
diff --git a/drivers/timer/ag101p_timer.c b/drivers/timer/ag101p_timer.c
index 17174345e3..27cf9b0247 100644
--- a/drivers/timer/ag101p_timer.c
+++ b/drivers/timer/ag101p_timer.c
@@ -64,7 +64,7 @@ struct atftmr_timer_plat {
static u64 atftmr_timer_get_count(struct udevice *dev)
{
- struct atftmr_timer_plat *plat = dev->plat;
+ struct atftmr_timer_plat *plat = dev_get_plat(dev);
struct atftmr_timer_regs *const regs = plat->regs;
u32 val;
val = readl(&regs->t3_counter);
@@ -73,7 +73,7 @@ static u64 atftmr_timer_get_count(struct udevice *dev)
static int atftmr_timer_probe(struct udevice *dev)
{
- struct atftmr_timer_plat *plat = dev->plat;
+ struct atftmr_timer_plat *plat = dev_get_plat(dev);
struct atftmr_timer_regs *const regs = plat->regs;
u32 cr;
writel(0, &regs->t3_load);
diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c
index 7e9abee0ef..040dc65f48 100644
--- a/drivers/timer/altera_timer.c
+++ b/drivers/timer/altera_timer.c
@@ -34,7 +34,7 @@ struct altera_timer_plat {
static u64 altera_timer_get_count(struct udevice *dev)
{
- struct altera_timer_plat *plat = dev->plat;
+ struct altera_timer_plat *plat = dev_get_plat(dev);
struct altera_timer_regs *const regs = plat->regs;
u32 val;
@@ -49,7 +49,7 @@ static u64 altera_timer_get_count(struct udevice *dev)
static int altera_timer_probe(struct udevice *dev)
{
- struct altera_timer_plat *plat = dev->plat;
+ struct altera_timer_plat *plat = dev_get_plat(dev);
struct altera_timer_regs *const regs = plat->regs;
writel(0, &regs->status);
diff --git a/drivers/timer/andes_plmt_timer.c b/drivers/timer/andes_plmt_timer.c
index cec86718c7..db2cf86f63 100644
--- a/drivers/timer/andes_plmt_timer.c
+++ b/drivers/timer/andes_plmt_timer.c
@@ -12,6 +12,7 @@
#include <dm.h>
#include <timer.h>
#include <asm/io.h>
+#include <dm/device-internal.h>
#include <linux/err.h>
/* mtime register */
@@ -19,7 +20,7 @@
static u64 andes_plmt_get_count(struct udevice *dev)
{
- return readq((void __iomem *)MTIME_REG(dev->priv));
+ return readq((void __iomem *)MTIME_REG(dev_get_priv(dev)));
}
static const struct timer_ops andes_plmt_ops = {
@@ -28,8 +29,8 @@ static const struct timer_ops andes_plmt_ops = {
static int andes_plmt_probe(struct udevice *dev)
{
- dev->priv = dev_read_addr_ptr(dev);
- if (!dev->priv)
+ dev_set_priv(dev, dev_read_addr_ptr(dev));
+ if (!dev_get_priv(dev))
return -EINVAL;
return timer_timebase_fallback(dev);
diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c
index 9b1daaadeb..2f2b8be3dc 100644
--- a/drivers/timer/mpc83xx_timer.c
+++ b/drivers/timer/mpc83xx_timer.c
@@ -206,7 +206,7 @@ static u64 mpc83xx_timer_get_count(struct udevice *dev)
static int mpc83xx_timer_probe(struct udevice *dev)
{
- struct timer_dev_priv *uc_priv = dev->uclass_priv;
+ struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
struct clk clock;
int ret;
diff --git a/drivers/timer/sandbox_timer.c b/drivers/timer/sandbox_timer.c
index 135c0f38a4..2075cd4edd 100644
--- a/drivers/timer/sandbox_timer.c
+++ b/drivers/timer/sandbox_timer.c
@@ -65,6 +65,6 @@ U_BOOT_DRIVER(sandbox_timer) = {
};
/* This is here in case we don't have a device tree */
-U_BOOT_DEVICE(sandbox_timer_non_fdt) = {
+U_BOOT_DRVINFO(sandbox_timer_non_fdt) = {
.name = "sandbox_timer",
};
diff --git a/drivers/timer/sifive_clint_timer.c b/drivers/timer/sifive_clint_timer.c
index 00ce0f08d6..de23b85404 100644
--- a/drivers/timer/sifive_clint_timer.c
+++ b/drivers/timer/sifive_clint_timer.c
@@ -9,6 +9,7 @@
#include <dm.h>
#include <timer.h>
#include <asm/io.h>
+#include <dm/device-internal.h>
#include <linux/err.h>
/* mtime register */
@@ -16,7 +17,7 @@
static u64 sifive_clint_get_count(struct udevice *dev)
{
- return readq((void __iomem *)MTIME_REG(dev->priv));
+ return readq((void __iomem *)MTIME_REG(dev_get_priv(dev)));
}
static const struct timer_ops sifive_clint_ops = {
@@ -25,8 +26,8 @@ static const struct timer_ops sifive_clint_ops = {
static int sifive_clint_probe(struct udevice *dev)
{
- dev->priv = dev_read_addr_ptr(dev);
- if (!dev->priv)
+ dev_set_priv(dev, dev_read_addr_ptr(dev));
+ if (!dev_get_priv(dev))
return -EINVAL;
return timer_timebase_fallback(dev);
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index ab53555327..da1a72f025 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -40,7 +40,7 @@ int notrace timer_get_count(struct udevice *dev, u64 *count)
unsigned long notrace timer_get_rate(struct udevice *dev)
{
- struct timer_dev_priv *uc_priv = dev->uclass_priv;
+ struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
return uc_priv->clock_rate;
}
@@ -54,7 +54,7 @@ static int timer_pre_probe(struct udevice *dev)
ulong ret;
/* It is possible that a timer device has a null ofnode */
- if (!dev_of_valid(dev))
+ if (!dev_has_ofnode(dev))
return 0;
err = clk_get_by_index(dev, 0, &timer_clk);
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index e3677704b3..706d52b830 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -477,15 +477,17 @@ static const struct timer_ops tsc_timer_ops = {
.get_count = tsc_timer_get_count,
};
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
static const struct udevice_id tsc_timer_ids[] = {
{ .compatible = "x86,tsc-timer", },
{ }
};
+#endif
U_BOOT_DRIVER(x86_tsc_timer) = {
.name = "x86_tsc_timer",
.id = UCLASS_TIMER,
- .of_match = tsc_timer_ids,
+ .of_match = of_match_ptr(tsc_timer_ids),
.probe = tsc_timer_probe,
.ops = &tsc_timer_ops,
};