watchdog: imx2_wdt: Add power management support.
[cascardo/linux.git] / drivers / watchdog / iTCO_vendor_support.c
index 2721d29..b6b2f90 100644 (file)
 
 #include "iTCO_vendor.h"
 
-/* iTCO defines */
-#define        SMI_EN          (acpibase + 0x30) /* SMI Control and Enable Register */
-#define        TCOBASE         (acpibase + 0x60) /* TCO base address */
-#define        TCO1_STS        (TCOBASE + 0x04)  /* TCO1 Status Register */
-
 /* List of vendor support modes */
 /* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */
 #define SUPERMICRO_OLD_BOARD   1
@@ -82,24 +77,24 @@ MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default="
  *         20.6 seconds.
  */
 
-static void supermicro_old_pre_start(unsigned long acpibase)
+static void supermicro_old_pre_start(struct resource *smires)
 {
        unsigned long val32;
 
        /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */
-       val32 = inl(SMI_EN);
+       val32 = inl(smires->start);
        val32 &= 0xffffdfff;    /* Turn off SMI clearing watchdog */
-       outl(val32, SMI_EN);    /* Needed to activate watchdog */
+       outl(val32, smires->start);     /* Needed to activate watchdog */
 }
 
-static void supermicro_old_pre_stop(unsigned long acpibase)
+static void supermicro_old_pre_stop(struct resource *smires)
 {
        unsigned long val32;
 
        /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */
-       val32 = inl(SMI_EN);
+       val32 = inl(smires->start);
        val32 |= 0x00002000;    /* Turn on SMI clearing watchdog */
-       outl(val32, SMI_EN);    /* Needed to deactivate watchdog */
+       outl(val32, smires->start);     /* Needed to deactivate watchdog */
 }
 
 /*
@@ -270,66 +265,66 @@ static void supermicro_new_pre_set_heartbeat(unsigned int heartbeat)
  *     Don't use this fix if you don't need to!!!
  */
 
-static void broken_bios_start(unsigned long acpibase)
+static void broken_bios_start(struct resource *smires)
 {
        unsigned long val32;
 
-       val32 = inl(SMI_EN);
+       val32 = inl(smires->start);
        /* Bit 13: TCO_EN     -> 0 = Disables TCO logic generating an SMI#
           Bit  0: GBL_SMI_EN -> 0 = No SMI# will be generated by ICH. */
        val32 &= 0xffffdffe;
-       outl(val32, SMI_EN);
+       outl(val32, smires->start);
 }
 
-static void broken_bios_stop(unsigned long acpibase)
+static void broken_bios_stop(struct resource *smires)
 {
        unsigned long val32;
 
-       val32 = inl(SMI_EN);
+       val32 = inl(smires->start);
        /* Bit 13: TCO_EN     -> 1 = Enables TCO logic generating an SMI#
           Bit  0: GBL_SMI_EN -> 1 = Turn global SMI on again. */
        val32 |= 0x00002001;
-       outl(val32, SMI_EN);
+       outl(val32, smires->start);
 }
 
 /*
  *     Generic Support Functions
  */
 
-void iTCO_vendor_pre_start(unsigned long acpibase,
+void iTCO_vendor_pre_start(struct resource *smires,
                           unsigned int heartbeat)
 {
        switch (vendorsupport) {
        case SUPERMICRO_OLD_BOARD:
-               supermicro_old_pre_start(acpibase);
+               supermicro_old_pre_start(smires);
                break;
        case SUPERMICRO_NEW_BOARD:
                supermicro_new_pre_start(heartbeat);
                break;
        case BROKEN_BIOS:
-               broken_bios_start(acpibase);
+               broken_bios_start(smires);
                break;
        }
 }
 EXPORT_SYMBOL(iTCO_vendor_pre_start);
 
-void iTCO_vendor_pre_stop(unsigned long acpibase)
+void iTCO_vendor_pre_stop(struct resource *smires)
 {
        switch (vendorsupport) {
        case SUPERMICRO_OLD_BOARD:
-               supermicro_old_pre_stop(acpibase);
+               supermicro_old_pre_stop(smires);
                break;
        case SUPERMICRO_NEW_BOARD:
                supermicro_new_pre_stop();
                break;
        case BROKEN_BIOS:
-               broken_bios_stop(acpibase);
+               broken_bios_stop(smires);
                break;
        }
 }
 EXPORT_SYMBOL(iTCO_vendor_pre_stop);
 
-void iTCO_vendor_pre_keepalive(unsigned long acpibase, unsigned int heartbeat)
+void iTCO_vendor_pre_keepalive(struct resource *smires, unsigned int heartbeat)
 {
        if (vendorsupport == SUPERMICRO_NEW_BOARD)
                supermicro_new_pre_set_heartbeat(heartbeat);