Commit 74d11d4c authored by Matt Porter's avatar Matt Porter Committed by Linus Torvalds

[PATCH] ppc32: support OpenBIOS/U-Boot for Ebony

This patch adds support for OpenBios on Ebony, as Matt Porter has
suggested.  It will provide same functionality as the pibs extension for
Luan and Ocotea.
Signed-off-by: default avatarGerhard Jaeger <gjaeger@sysgo.com>
Signed-off-by: default avatarMatt Porter <mporter@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6bda0d53
...@@ -65,6 +65,7 @@ zimageinitrd-$(CONFIG_IBM_OPENBIOS) := zImage.initrd-TREE ...@@ -65,6 +65,7 @@ zimageinitrd-$(CONFIG_IBM_OPENBIOS) := zImage.initrd-TREE
zimageinitrd-$(CONFIG_EBONY) := zImage.initrd-TREE zimageinitrd-$(CONFIG_EBONY) := zImage.initrd-TREE
end-$(CONFIG_EBONY) := ebony end-$(CONFIG_EBONY) := ebony
entrypoint-$(CONFIG_EBONY) := 0x01000000 entrypoint-$(CONFIG_EBONY) := 0x01000000
extra.o-$(CONFIG_EBONY) := openbios.o
zimage-$(CONFIG_LUAN) := zImage-TREE zimage-$(CONFIG_LUAN) := zImage-TREE
zimageinitrd-$(CONFIG_LUAN) := zImage.initrd-TREE zimageinitrd-$(CONFIG_LUAN) := zImage.initrd-TREE
......
/*
* arch/ppc/boot/simple/openbios.c
*
* 2005 (c) SYSGO AG - g.jaeger@sysgo.com
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without
* any warranty of any kind, whether express or implied.
*
* Derived from arch/ppc/boot/simple/pibs.c (from MontaVista)
*/
#include <linux/types.h>
#include <linux/config.h>
#include <linux/string.h>
#include <asm/ppcboot.h>
#include <platforms/4xx/ebony.h>
extern unsigned long decompress_kernel(unsigned long load_addr, int num_words,
unsigned long cksum);
/* We need to make sure that this is before the images to ensure
* that it's in a mapped location. */
bd_t hold_resid_buf __attribute__ ((__section__ (".data.boot")));
bd_t *hold_residual = &hold_resid_buf;
void *
load_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
void *ign1, void *ign2)
{
decompress_kernel(load_addr, num_words, cksum);
/* simply copy the MAC addresses */
memcpy(hold_residual->bi_enetaddr, (char *)EBONY_OPENBIOS_MAC_BASE, 6);
memcpy(hold_residual->bi_enet1addr, (char *)(EBONY_OPENBIOS_MAC_BASE+EBONY_OPENBIOS_MAC_OFFSET), 6);
return (void *)hold_residual;
}
...@@ -49,8 +49,19 @@ ...@@ -49,8 +49,19 @@
#include <asm/todc.h> #include <asm/todc.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
#include <asm/ppc4xx_pic.h> #include <asm/ppc4xx_pic.h>
#include <asm/ppcboot.h>
#include <syslib/gen550.h> #include <syslib/gen550.h>
#include <syslib/ibm440gp_common.h>
/*
* This is a horrible kludge, we eventually need to abstract this
* generic PHY stuff, so the standard phy mode defines can be
* easily used from arch code.
*/
#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h"
bd_t __res;
static struct ibm44x_clocks clocks __initdata; static struct ibm44x_clocks clocks __initdata;
...@@ -258,19 +269,21 @@ ebony_early_serial_map(void) ...@@ -258,19 +269,21 @@ ebony_early_serial_map(void)
static void __init static void __init
ebony_setup_arch(void) ebony_setup_arch(void)
{ {
unsigned char * vpd_base;
struct ocp_def *def; struct ocp_def *def;
struct ocp_func_emac_data *emacdata; struct ocp_func_emac_data *emacdata;
/* Set mac_addr for each EMAC */ /* 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); def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0);
emacdata = def->additions; 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); def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1);
emacdata = def->additions; emacdata = def->additions;
memcpy(emacdata->mac_addr, EBONY_NA1_ADDR(vpd_base), 6); emacdata->phy_map = 0x00000001; /* Skip 0x00 */
iounmap(vpd_base); emacdata->phy_mode = PHY_MODE_RMII;
memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6);
/* /*
* Determine various clocks. * Determine various clocks.
...@@ -314,7 +327,14 @@ ebony_setup_arch(void) ...@@ -314,7 +327,14 @@ ebony_setup_arch(void)
void __init platform_init(unsigned long r3, unsigned long r4, void __init platform_init(unsigned long r3, unsigned long r4,
unsigned long r5, unsigned long r6, unsigned long r7) unsigned long r5, unsigned long r6, unsigned long r7)
{ {
parse_bootinfo((struct bi_record *) (r3 + KERNELBASE)); parse_bootinfo(find_bootinfo());
/*
* If we were passed in a board information, copy it into the
* residual data area.
*/
if (r3)
__res = *(bd_t *)(r3 + KERNELBASE);
ibm44x_platform_init(); ibm44x_platform_init();
......
...@@ -23,13 +23,9 @@ ...@@ -23,13 +23,9 @@
/* F/W TLB mapping used in bootloader glue to reset EMAC */ /* F/W TLB mapping used in bootloader glue to reset EMAC */
#define PPC44x_EMAC0_MR0 0xE0000800 #define PPC44x_EMAC0_MR0 0xE0000800
/* Macros to get at Ebony VPD info */ /* Where to find the MAC info */
#define EBONY_VPD_BASE 0x00000001fffffe00ULL #define EBONY_OPENBIOS_MAC_BASE 0xfffffe0c
#define EBONY_VPD_SIZE 0x24 #define EBONY_OPENBIOS_MAC_OFFSET 0x0c
#define EBONY_NA0_OFFSET 0x0c
#define EBONY_NA1_OFFSET 0x18
#define EBONY_NA0_ADDR(base) (base + EBONY_NA0_OFFSET)
#define EBONY_NA1_ADDR(base) (base + EBONY_NA1_OFFSET)
/* Default clock rates for Rev. B and Rev. C silicon */ /* Default clock rates for Rev. B and Rev. C silicon */
#define EBONY_440GP_RB_SYSCLK 33000000 #define EBONY_440GP_RB_SYSCLK 33000000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment