1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2017 CS Systemes d'Information
10 #include <asm/cpm_8xx.h>
13 static void hw_watchdog_reset(void)
15 immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
17 out_be16(&immap->im_siu_conf.sc_swsr, 0x556c); /* write magic1 */
18 out_be16(&immap->im_siu_conf.sc_swsr, 0xaa39); /* write magic2 */
21 static int mpc8xx_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
23 immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
25 out_be32(&immap->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR);
27 if (!(in_be32(&immap->im_siu_conf.sc_sypcr) & SYPCR_SWE))
33 static int mpc8xx_wdt_stop(struct udevice *dev)
35 immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
37 out_be32(&immap->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR & ~SYPCR_SWE);
39 if (in_be32(&immap->im_siu_conf.sc_sypcr) & SYPCR_SWE)
44 static int mpc8xx_wdt_reset(struct udevice *dev)
51 static const struct wdt_ops mpc8xx_wdt_ops = {
52 .start = mpc8xx_wdt_start,
53 .reset = mpc8xx_wdt_reset,
54 .stop = mpc8xx_wdt_stop,
57 static const struct udevice_id mpc8xx_wdt_ids[] = {
58 { .compatible = "fsl,pq1-wdt" },
62 U_BOOT_DRIVER(wdt_mpc8xx) = {
65 .of_match = mpc8xx_wdt_ids,
66 .ops = &mpc8xx_wdt_ops,