mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 15:41:40 +00:00
f3729ba6e7
With the generic watchdog driver now implemented, this patch removes some legacy stuff from the MPC8xx watchdog driver and its Kconfig integration. CONFIG_MPC8xx_WATCHDOG is completely removed and hw_watchdog_reset() is made static, as the watchdog will now get serviced via the DM infrastructure if enabled via CONFIG_WATCHDOG. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Christophe Leroy <christophe.leroy@c-s.fr>
67 lines
1.4 KiB
C
67 lines
1.4 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright 2017 CS Systemes d'Information
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <wdt.h>
|
|
#include <mpc8xx.h>
|
|
#include <asm/cpm_8xx.h>
|
|
#include <asm/io.h>
|
|
|
|
static void hw_watchdog_reset(void)
|
|
{
|
|
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
|
|
|
|
out_be16(&immap->im_siu_conf.sc_swsr, 0x556c); /* write magic1 */
|
|
out_be16(&immap->im_siu_conf.sc_swsr, 0xaa39); /* write magic2 */
|
|
}
|
|
|
|
static int mpc8xx_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
|
|
{
|
|
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
|
|
|
|
out_be32(&immap->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR);
|
|
|
|
if (!(in_be32(&immap->im_siu_conf.sc_sypcr) & SYPCR_SWE))
|
|
return -EBUSY;
|
|
return 0;
|
|
|
|
}
|
|
|
|
static int mpc8xx_wdt_stop(struct udevice *dev)
|
|
{
|
|
immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
|
|
|
|
out_be32(&immap->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR & ~SYPCR_SWE);
|
|
|
|
if (in_be32(&immap->im_siu_conf.sc_sypcr) & SYPCR_SWE)
|
|
return -EBUSY;
|
|
return 0;
|
|
}
|
|
|
|
static int mpc8xx_wdt_reset(struct udevice *dev)
|
|
{
|
|
hw_watchdog_reset();
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct wdt_ops mpc8xx_wdt_ops = {
|
|
.start = mpc8xx_wdt_start,
|
|
.reset = mpc8xx_wdt_reset,
|
|
.stop = mpc8xx_wdt_stop,
|
|
};
|
|
|
|
static const struct udevice_id mpc8xx_wdt_ids[] = {
|
|
{ .compatible = "fsl,pq1-wdt" },
|
|
{}
|
|
};
|
|
|
|
U_BOOT_DRIVER(wdt_mpc8xx) = {
|
|
.name = "wdt_mpc8xx",
|
|
.id = UCLASS_WDT,
|
|
.of_match = mpc8xx_wdt_ids,
|
|
.ops = &mpc8xx_wdt_ops,
|
|
};
|