fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / ppc / platforms / 4xx / ebony.c
index 86ef9bb..f0f9cc8 100644 (file)
@@ -1,13 +1,11 @@
 /*
- * arch/ppc/platforms/4xx/ebony.c
- *
  * Ebony board specific routines
  *
  * Matt Porter <mporter@kernel.crashing.org>
  * Copyright 2002-2005 MontaVista Software Inc.
  *
  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
- * Copyright (c) 2003, 2004 Zultys Technologies
+ * Copyright (c) 2003-2005 Zultys Technologies
  *
  * 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
@@ -15,7 +13,6 @@
  * option) any later version.
  */
 
-#include <linux/config.h>
 #include <linux/stddef.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -30,7 +27,6 @@
 #include <linux/delay.h>
 #include <linux/ide.h>
 #include <linux/initrd.h>
-#include <linux/irq.h>
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
 #include <linux/tty.h>
 #include <asm/todc.h>
 #include <asm/bootinfo.h>
 #include <asm/ppc4xx_pic.h>
+#include <asm/ppcboot.h>
+#include <asm/tlbflush.h>
 
 #include <syslib/gen550.h>
+#include <syslib/ibm440gp_common.h>
+
+extern bd_t __res;
 
 static struct ibm44x_clocks clocks __initdata;
 
@@ -86,15 +87,10 @@ ebony_calibrate_decr(void)
         * on Rev. C silicon then errata forces us to
         * use the internal clock.
         */
-       switch (PVR_REV(mfspr(PVR))) {
-               case PVR_REV(PVR_440GP_RB):
-                       freq = EBONY_440GP_RB_SYSCLK;
-                       break;
-               case PVR_REV(PVR_440GP_RC1):
-               default:
-                       freq = EBONY_440GP_RC_SYSCLK;
-                       break;
-       }
+       if (strcmp(cur_cpu_spec->cpu_name, "440GP Rev. B") == 0)
+               freq = EBONY_440GP_RB_SYSCLK;
+       else
+               freq = EBONY_440GP_RC_SYSCLK;
 
        ibm44x_calibrate_decr(freq);
 }
@@ -138,7 +134,7 @@ ebony_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
 static void __init
 ebony_setup_pcix(void)
 {
-       void *pcix_reg_base;
+       void __iomem *pcix_reg_base;
 
        pcix_reg_base = ioremap64(PCIX0_REG_BASE, PCIX_REG_SIZE);
 
@@ -199,9 +195,8 @@ ebony_setup_hose(void)
        hose->io_space.end = EBONY_PCI_UPPER_IO;
        hose->mem_space.start = EBONY_PCI_LOWER_MEM;
        hose->mem_space.end = EBONY_PCI_UPPER_MEM;
-       isa_io_base =
-               (unsigned long)ioremap64(EBONY_PCI_IO_BASE, EBONY_PCI_IO_SIZE);
-       hose->io_base_virt = (void *)isa_io_base;
+       hose->io_base_virt = ioremap64(EBONY_PCI_IO_BASE, EBONY_PCI_IO_SIZE);
+       isa_io_base = (unsigned long)hose->io_base_virt;
 
        setup_indirect_pci(hose,
                        EBONY_PCI_CFGA_PLB32,
@@ -227,8 +222,8 @@ ebony_early_serial_map(void)
        port.irq = 0;
        port.uartclk = clocks.uart0;
        port.regshift = 0;
-       port.iotype = SERIAL_IO_MEM;
-       port.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
+       port.iotype = UPIO_MEM;
+       port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
        port.line = 0;
 
        if (early_serial_setup(&port) != 0) {
@@ -238,6 +233,9 @@ ebony_early_serial_map(void)
 #if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
        /* Configure debug serial access */
        gen550_init(0, &port);
+
+       /* Purge TLB entry added in head_44x.S for early serial access */
+       _tlbie(UART0_IO_BASE);
 #endif
 
        port.membase = ioremap64(PPC440GP_UART1_ADDR, 8);
@@ -258,19 +256,21 @@ ebony_early_serial_map(void)
 static void __init
 ebony_setup_arch(void)
 {
-       unsigned char * vpd_base;
        struct ocp_def *def;
        struct ocp_func_emac_data *emacdata;
 
        /* Set mac_addr for each EMAC */
-       vpd_base = ioremap64(EBONY_VPD_BASE, EBONY_VPD_SIZE);
        def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0);
        emacdata = def->additions;
-       memcpy(emacdata->mac_addr, EBONY_NA0_ADDR(vpd_base), 6);
+       emacdata->phy_map = 0x00000001; /* Skip 0x00 */
+       emacdata->phy_mode = PHY_MODE_RMII;
+       memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6);
+
        def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1);
        emacdata = def->additions;
-       memcpy(emacdata->mac_addr, EBONY_NA1_ADDR(vpd_base), 6);
-       iounmap(vpd_base);
+       emacdata->phy_map = 0x00000001; /* Skip 0x00 */
+       emacdata->phy_mode = PHY_MODE_RMII;
+       memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6);
 
        /*
         * Determine various clocks.
@@ -314,9 +314,7 @@ ebony_setup_arch(void)
 void __init platform_init(unsigned long r3, unsigned long r4,
                unsigned long r5, unsigned long r6, unsigned long r7)
 {
-       parse_bootinfo((struct bi_record *) (r3 + KERNELBASE));
-
-       ibm44x_platform_init();
+       ibm44x_platform_init(r3, r4, r5, r6, r7);
 
        ppc_md.setup_arch = ebony_setup_arch;
        ppc_md.show_cpuinfo = ebony_show_cpuinfo;