*/
-#include <common.h>
-#include <board.h>
+#include <config.h>
#include <clk.h>
#include <dm.h>
#include <irq_func.h>
#include <log.h>
#include <status_led.h>
+#include <sysinfo.h>
#include <time.h>
#include <timer.h>
#include <watchdog.h>
+#include <asm/global_data.h>
#include <asm/ptrace.h>
#include <linux/bitops.h>
DECLARE_GLOBAL_DATA_PTR;
+#ifndef CFG_SYS_WATCHDOG_FREQ
+#define CFG_SYS_WATCHDOG_FREQ (CONFIG_SYS_HZ / 2)
+#endif
+
/**
* struct mpc83xx_timer_priv - Private data structure for MPC83xx timer driver
* @decrementer_count: Value to which the decrementer register should be re-set
{
immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
struct udevice *csb;
- struct udevice *board;
+ struct udevice *sysinfo;
struct udevice *timer;
struct mpc83xx_timer_priv *timer_priv;
struct clk clock;
timer_priv = dev_get_priv(timer);
- if (board_get(&board)) {
- debug("%s: board device could not be fetched.\n", __func__);
+ if (sysinfo_get(&sysinfo)) {
+ debug("%s: sysinfo device could not be fetched.\n", __func__);
return -ENOENT;
}
- ret = uclass_get_device_by_phandle(UCLASS_SIMPLE_BUS, board,
+ ret = uclass_get_device_by_phandle(UCLASS_SIMPLE_BUS, sysinfo,
"csb", &csb);
if (ret) {
debug("%s: Could not retrieve CSB device (error: %d)",
priv->timestamp++;
#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG)
- if ((timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0)
- WATCHDOG_RESET();
+ if (CFG_SYS_WATCHDOG_FREQ && (priv->timestamp % (CFG_SYS_WATCHDOG_FREQ)) == 0)
+ schedule();
#endif /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */
#ifdef CONFIG_LED_STATUS
ulong end = get_ticks() + ticks;
while (end > get_ticks())
- WATCHDOG_RESET();
+ schedule();
}
-static int mpc83xx_timer_get_count(struct udevice *dev, u64 *count)
+static u64 mpc83xx_timer_get_count(struct udevice *dev)
{
u32 tbu, tbl;
tbl = mftb();
} while (tbu != mftbu());
- *count = (tbu * 0x10000ULL) + tbl;
-
- return 0;
+ return (tbu * 0x10000ULL) + tbl;
}
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;
.of_match = mpc83xx_timer_ids,
.probe = mpc83xx_timer_probe,
.ops = &mpc83xx_timer_ops,
- .priv_auto_alloc_size = sizeof(struct mpc83xx_timer_priv),
+ .priv_auto = sizeof(struct mpc83xx_timer_priv),
};