-#include <asm-mips/ifxmips/ifxmips_wdt.h>
-#include <asm-mips/ifxmips/ifxmips.h>
-
-#define DRVNAME "ifxmips_wdt"
-
-// TODO remove magic numbers and weirdo macros
-extern unsigned int ifxmips_get_fpi_hz (void);
-
-static int ifxmips_wdt_inuse = 0;
-static int ifxmips_wdt_major = 0;
-
-int
-ifxmips_wdt_enable (unsigned int timeout)
-{
- unsigned int wdt_cr = 0;
- unsigned int wdt_reload = 0;
- unsigned int wdt_clkdiv, wdt_pwl, ffpi;
- int retval = 0;
-
- /* clock divider & prewarning limit */
- wdt_clkdiv = 1 << (7 * IFXMIPS_BIU_WDT_CR_CLKDIV_GET(readl(IFXMIPS_BIU_WDT_CR)));
- wdt_pwl = 0x8000 >> IFXMIPS_BIU_WDT_CR_PWL_GET(readl(IFXMIPS_BIU_WDT_CR));
-
- //TODO
- printk("WARNING FUNCTION CALL MISSING!!!");
- //ffpi = cgu_get_io_region_clock();
- printk("cpu clock = %d\n", ffpi);
-
- /* caculate reload value */
- wdt_reload = (timeout * (ffpi / wdt_clkdiv)) + wdt_pwl;
-
- printk(KERN_WARNING DRVNAME ": wdt_pwl=0x%x, wdt_clkdiv=%d, ffpi=%d, wdt_reload = 0x%x\n",
- wdt_pwl, wdt_clkdiv, ffpi, wdt_reload);
-
- if (wdt_reload > 0xFFFF)
- {
- printk(KERN_WARNING DRVNAME ": timeout too large %d\n", timeout);
- retval = -EINVAL;
- goto out;
- }
-
- /* Write first part of password access */
- writel(IFXMIPS_BIU_WDT_CR_PW_SET(IFXMIPS_WDT_PW1), IFXMIPS_BIU_WDT_CR);
-
- wdt_cr = readl(IFXMIPS_BIU_WDT_CR);
- wdt_cr &= (!IFXMIPS_BIU_WDT_CR_PW_SET(0xff) &
- !IFXMIPS_BIU_WDT_CR_PWL_SET(0x3) &
- !IFXMIPS_BIU_WDT_CR_CLKDIV_SET(0x3) &
- !IFXMIPS_BIU_WDT_CR_RELOAD_SET(0xffff));