ssb: Fix the horrible crash of innocent cardbus cards.
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / files / arch / mips / bcm947xx / setup.c
index 2fcf68443532f4ba048d54f69b3c838dca5f7873..85ff1cf813e2d9c76b0641c1ad654ae21a7e87ea 100644 (file)
@@ -2,7 +2,7 @@
  *  Copyright (C) 2004 Florian Schirmer (jolt@tuxbox.org)
  *  Copyright (C) 2005 Waldemar Brodkorb <wbx@openwrt.org>
  *  Copyright (C) 2006 Felix Fietkau <nbd@openwrt.org>
- *  Copyright (C) 2006 Michael Buesch
+ *  Copyright (C) 2006-2008 Michael Buesch <mb@bu3sch.de>
  *
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
@@ -38,6 +38,7 @@
 #include <asm/cfe.h>
 #include <linux/pm.h>
 #include <linux/ssb/ssb.h>
+#include <linux/ssb/ssb_embedded.h>
 
 #include <nvram.h>
 
@@ -55,7 +56,8 @@ static void bcm47xx_machine_restart(char *command)
         */
 
        /* Set the watchdog timer to reset immediately */
-       ssb_chipco_watchdog_timer_set(&ssb.chipco, 1);
+       if (ssb_watchdog_timer_set(&ssb, 1))
+               printk(KERN_EMERG "SSB watchdog-triggered reboot failed!\n");
        while (1)
                cpu_relax();
 }
@@ -64,7 +66,8 @@ static void bcm47xx_machine_halt(void)
 {
        /* Disable interrupts and watchdog and spin forever */
        local_irq_disable();
-       ssb_chipco_watchdog_timer_set(&ssb.chipco, 0);
+       if (ssb_watchdog_timer_set(&ssb, 0))
+               printk(KERN_EMERG "Failed to disable SSB watchdog!\n");
        while (1)
                cpu_relax();
 }
@@ -155,6 +158,9 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus, struct ssb_init_invariant
 
        bcm47xx_fill_sprom(&iv->sprom);
 
+       if ((s = nvram_get("cardbus")))
+               iv->has_cardbus_slot = !!simple_strtoul(s, NULL, 10);
+
        return 0;
 }