add new switch configuration api
[openwrt/staging/wigyori.git] / target / linux / brcm47xx / files / arch / mips / bcm947xx / setup.c
index 2fcf68443532f4ba048d54f69b3c838dca5f7873..41d7b0b7587290ec73e32cc7e38d092b38ad7c68 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>
 
@@ -46,6 +47,20 @@ extern void bcm47xx_time_init(void);
 
 struct ssb_bus ssb;
 
+
+int pcibios_plat_dev_init(struct pci_dev *dev)
+{
+       int err;
+
+       err = ssb_pcibios_plat_dev_init(dev);
+       if (err) {
+               printk(KERN_ALERT "PCI: Failed to init device %s\n",
+                      pci_name(dev));
+       }
+
+       return err;
+}
+
 static void bcm47xx_machine_restart(char *command)
 {
        printk(KERN_ALERT "Please stand by while rebooting the system...\n");
@@ -55,7 +70,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 +80,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 +172,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;
 }
 
@@ -206,4 +226,21 @@ void __init plat_mem_setup(void)
        board_time_init = bcm47xx_time_init;
 }
 
+static int __init bcm47xx_register_gpiodev(void)
+{
+       static struct resource res = {
+               .start = 0xFFFFFFFF,
+       };
+       struct platform_device *pdev;
+
+       pdev = platform_device_register_simple("GPIODEV", 0, &res, 1);
+       if (!pdev) {
+               printk(KERN_ERR "bcm47xx: GPIODEV init failed\n");
+               return -ENODEV;
+       }
+
+       return 0;
+}
+device_initcall(bcm47xx_register_gpiodev);
+
 EXPORT_SYMBOL(ssb);