Return-Path: Received: from localhost (bix [127.0.0.1]) by localhost.localdomain (8.12.10/8.12.10) with ESMTP id j21KYT9K014317 for ; Tue, 1 Mar 2005 12:34:29 -0800 Received: from bix [127.0.0.1] by localhost with POP3 (fetchmail-6.2.0) for akpm@localhost (single-drop); Tue, 01 Mar 2005 12:34:29 -0800 (PST) Received: from smtp.osdl.org (fire.osdl.org [65.172.181.4]) by shell0.pdx.osdl.net (8.13.1/8.11.6) with ESMTP id j21KVL15030667 for ; Tue, 1 Mar 2005 12:31:21 -0800 Received: from fed1rmmtao11.cox.net (fed1rmmtao11.cox.net [68.230.241.28]) by smtp.osdl.org (8.12.8/8.12.8) with ESMTP id j21KVJqh010431 for ; Tue, 1 Mar 2005 12:31:20 -0800 Received: from liberty.homelinux.org ([68.2.41.86]) by fed1rmmtao11.cox.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050301203114.GCVI22013.fed1rmmtao11.cox.net@liberty.homelinux.org>; Tue, 1 Mar 2005 15:31:14 -0500 Received: (from mmporter@localhost) by liberty.homelinux.org (8.9.3/8.9.3/Debian 8.9.3-21) id NAA26000; Tue, 1 Mar 2005 13:31:13 -0700 Date: Tue, 1 Mar 2005 13:31:12 -0700 From: Matt Porter To: akpm@osdl.org Cc: gjaeger@sysgo.com Subject: [PATCH][PPC32] Support OpenBIOS/U-Boot for Ebony Message-ID: <20050301133112.B24061@cox.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Received-SPF: none (domain of mmporter@cox.net does not designate permitted sender hosts) X-MIMEDefang-Filter: osdl$Revision: 1.103 $ X-Scanned-By: MIMEDefang 2.36 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on bix X-Spam-Level: X-Spam-Status: No, score=-1.7 required=2.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 Hi, 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: Gerhard Jaeger Signed-off-by: Matt Porter diff -purN linux-2.6.11-rc5/arch/ppc/boot/simple/Makefile linux-2.6.11-rc5.ob/arch/ppc/boot/simple/Makefile --- linux-2.6.11-rc5/arch/ppc/boot/simple/Makefile 2005-02-24 17:39:46.000000000 +0100 +++ linux-2.6.11-rc5.ob/arch/ppc/boot/simple/Makefile 2005-02-28 16:40:26.000000000 +0100 @@ -65,6 +65,7 @@ zimageinitrd-$(CONFIG_IBM_OPENBIOS) := z zimageinitrd-$(CONFIG_EBONY) := zImage.initrd-TREE end-$(CONFIG_EBONY) := ebony entrypoint-$(CONFIG_EBONY) := 0x01000000 + extra.o-$(CONFIG_EBONY) := openbios.o zimage-$(CONFIG_LUAN) := zImage-TREE zimageinitrd-$(CONFIG_LUAN) := zImage.initrd-TREE diff -purN linux-2.6.11-rc5/arch/ppc/boot/simple/openbios.c linux-2.6.11-rc5.ob/arch/ppc/boot/simple/openbios.c --- linux-2.6.11-rc5/arch/ppc/boot/simple/openbios.c 1970-01-01 01:00:00.000000000 +0100 +++ linux-2.6.11-rc5.ob/arch/ppc/boot/simple/openbios.c 2005-02-28 16:41:15.000000000 +0100 @@ -0,0 +1,37 @@ +/* + * 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 +#include +#include +#include +#include + +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; +} diff -purN linux-2.6.11-rc5/arch/ppc/platforms/4xx/ebony.c linux-2.6.11-rc5.ob/arch/ppc/platforms/4xx/ebony.c --- linux-2.6.11-rc5/arch/ppc/platforms/4xx/ebony.c 2005-02-24 17:40:47.000000000 +0100 +++ linux-2.6.11-rc5.ob/arch/ppc/platforms/4xx/ebony.c 2005-02-28 16:05:15.000000000 +0100 @@ -49,8 +49,19 @@ #include #include #include +#include #include +#include + +/* + * 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; @@ -258,19 +269,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,7 +327,14 @@ 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)); + 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(); diff -purN linux-2.6.11-rc5/arch/ppc/platforms/4xx/ebony.h linux-2.6.11-rc5.ob/arch/ppc/platforms/4xx/ebony.h --- linux-2.6.11-rc5/arch/ppc/platforms/4xx/ebony.h 2005-02-28 17:08:51.000000000 +0100 +++ linux-2.6.11-rc5.ob/arch/ppc/platforms/4xx/ebony.h 2005-02-28 16:33:46.000000000 +0100 @@ -23,13 +23,9 @@ /* F/W TLB mapping used in bootloader glue to reset EMAC */ #define PPC44x_EMAC0_MR0 0xE0000800 -/* Macros to get at Ebony VPD info */ -#define EBONY_VPD_BASE 0x00000001fffffe00ULL -#define EBONY_VPD_SIZE 0x24 -#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) +/* Where to find the MAC info */ +#define EBONY_OPENBIOS_MAC_BASE 0xfffffe0c +#define EBONY_OPENBIOS_MAC_OFFSET 0x0c /* Default clock rates for Rev. B and Rev. C silicon */ #define EBONY_440GP_RB_SYSCLK 33000000