]> err.no Git - linux-2.6/blobdiff - arch/powerpc/platforms/52xx/lite5200.c
[POWERPC] Enable restart support for lite5200 board
[linux-2.6] / arch / powerpc / platforms / 52xx / lite5200.c
index e11d27f9c4f000963e247c366181239fc287e096..25d2bfa3d9dc0237c0c7d2299e94c863eaeade20 100644 (file)
 
 #undef DEBUG
 
-#include <linux/stddef.h>
-#include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
 #include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
+#include <linux/of.h>
 #include <linux/root_dev.h>
 #include <linux/initrd.h>
-
-#include <asm/system.h>
-#include <asm/atomic.h>
 #include <asm/time.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/irq.h>
 #include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/of_platform.h>
-
 #include <asm/mpc52xx.h>
 
 /* ************************************************************************
  *
  */
 
+/*
+ * Fix clock configuration.
+ *
+ * Firmware is supposed to be responsible for this.  If you are creating a
+ * new board port, do *NOT* duplicate this code.  Fix your boot firmware
+ * to set it correctly in the first place
+ */
+static void __init
+lite5200_fix_clock_config(void)
+{
+       struct mpc52xx_cdm  __iomem *cdm;
+
+       /* Map zones */
+       cdm = mpc52xx_find_and_map("mpc5200-cdm");
+       if (!cdm) {
+               printk(KERN_ERR "%s() failed; expect abnormal behaviour\n",
+                      __FUNCTION__);
+               return;
+       }
+
+       /* Use internal 48 Mhz */
+       out_8(&cdm->ext_48mhz_en, 0x00);
+       out_8(&cdm->fd_enable, 0x01);
+       if (in_be32(&cdm->rstcfg) & 0x40)       /* Assumes 33Mhz clock */
+               out_be16(&cdm->fd_counters, 0x0001);
+       else
+               out_be16(&cdm->fd_counters, 0x5555);
+
+       /* Unmap the regs */
+       iounmap(cdm);
+}
+
+/*
+ * Fix setting of port_config register.
+ *
+ * Firmware is supposed to be responsible for this.  If you are creating a
+ * new board port, do *NOT* duplicate this code.  Fix your boot firmware
+ * to set it correctly in the first place
+ */
 static void __init
-lite5200_setup_cpu(void)
+lite5200_fix_port_config(void)
 {
        struct mpc52xx_gpio __iomem *gpio;
        u32 port_config;
 
-       /* Map zones */
        gpio = mpc52xx_find_and_map("mpc5200-gpio");
        if (!gpio) {
-               printk(KERN_ERR __FILE__ ": "
-                       "Error while mapping GPIO register for port config. "
-                       "Expect some abnormal behavior\n");
-               goto error;
+               printk(KERN_ERR "%s() failed. expect abnormal behavior\n",
+                      __FUNCTION__);
+               return;
        }
 
        /* Set port config */
@@ -80,7 +100,6 @@ lite5200_setup_cpu(void)
        out_be32(&gpio->port_config, port_config);
 
        /* Unmap zone */
-error:
        iounmap(gpio);
 }
 
@@ -119,9 +138,15 @@ static void __init lite5200_setup_arch(void)
        if (ppc_md.progress)
                ppc_md.progress("lite5200_setup_arch()", 0);
 
-       /* CPU & Port mux setup */
-       mpc52xx_setup_cpu();    /* Generic */
-       lite5200_setup_cpu();   /* Platorm specific */
+       /* Fix things that firmware should have done. */
+       lite5200_fix_clock_config();
+       lite5200_fix_port_config();
+
+       /* Some mpc5200 & mpc5200b related configuration */
+       mpc5200_setup_xlb_arbiter();
+
+       /* Map wdt for mpc52xx_restart() */
+       mpc52xx_map_wdt();
 
 #ifdef CONFIG_PM
        mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare;
@@ -136,32 +161,6 @@ static void __init lite5200_setup_arch(void)
                of_node_put(np);
        }
 #endif
-
-#ifdef CONFIG_BLK_DEV_INITRD
-       if (initrd_start)
-               ROOT_DEV = Root_RAM0;
-       else
-#endif
-#ifdef  CONFIG_ROOT_NFS
-               ROOT_DEV = Root_NFS;
-#else
-               ROOT_DEV = Root_HDA1;
-#endif
-
-}
-
-static void lite5200_show_cpuinfo(struct seq_file *m)
-{
-       struct device_node* np = of_find_all_nodes(NULL);
-       const char *model = NULL;
-
-       if (np)
-               model = of_get_property(np, "model", NULL);
-
-       seq_printf(m, "vendor\t\t:      Freescale Semiconductor\n");
-       seq_printf(m, "machine\t\t:     %s\n", model ? model : "unknown");
-
-       of_node_put(np);
 }
 
 /*
@@ -187,6 +186,6 @@ define_machine(lite5200) {
        .init           = mpc52xx_declare_of_platform_devices,
        .init_IRQ       = mpc52xx_init_irq,
        .get_irq        = mpc52xx_get_irq,
-       .show_cpuinfo   = lite5200_show_cpuinfo,
+       .restart        = mpc52xx_restart,
        .calibrate_decr = generic_calibrate_decr,
 };