All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Jin <shawnxjin@gmail.com>
To: ppcembed <linuxppc-embedded@ozlabs.org>
Subject: [PATCH] Ebony's UBoot awareness
Date: Wed, 23 Feb 2005 10:39:34 -0800	[thread overview]
Message-ID: <c3d0340b05022310396240c8ac@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

Hi,

This adds UBoot support on Ebony board and also sets emac's PHY mode
explicitly during initialization as Eugene Surovegin provided.

Regards,
-Shawn.

[-- Attachment #2: ebony-emac.diff --]
[-- Type: text/plain, Size: 3192 bytes --]

diff -Nur orig/linux-2.6.10/arch/ppc/platforms/4xx/ebony.c code/linux-2.6.10/arch/ppc/platforms/4xx/ebony.c
--- orig/linux-2.6.10/arch/ppc/platforms/4xx/ebony.c	2004-12-24 13:35:40.000000000 -0800
+++ code/linux-2.6.10/arch/ppc/platforms/4xx/ebony.c	2005-02-23 10:05:32.043954000 -0800
@@ -49,10 +49,14 @@
 #include <asm/todc.h>
 #include <asm/bootinfo.h>
 #include <asm/ppc4xx_pic.h>
+#include <asm/ppcboot.h>
 
 #include <syslib/gen550.h>
 
+#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h"
+
 static struct ibm44x_clocks clocks __initdata;
+bd_t __res;
 
 /*
  * Ebony IRQ triggering/polarity settings
@@ -182,6 +186,41 @@
 	(writel(value, (u32)pcix_reg_base+offset))
 
 /*
+ * Set mac address for each EMAC
+ * If uboot sets MAC addresses for each EMAC, use them.
+ * Otherwise fetch from Ebony VPD.
+ *
+ */
+static void __init
+ebony_set_emacdata(void)
+{
+	unsigned char * vpd_base;
+	struct ocp_def *def;
+	struct ocp_func_emac_data *emacdata;
+
+	vpd_base = ioremap64(EBONY_VPD_BASE, EBONY_VPD_SIZE);
+
+	def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0);
+	emacdata = def->additions;
+	emacdata->phy_mode = PHY_MODE_RMII;
+	if (!strncmp(__res.bi_enetaddr, "\0xFF\0xFF\0xFF\0xFF\0xFF\0xFF", 6))
+	  	memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6);
+	else
+		memcpy(emacdata->mac_addr, EBONY_NA0_ADDR(vpd_base), 6);
+
+	def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1);
+	emacdata = def->additions;
+	emacdata->phy_mode = PHY_MODE_RMII;
+	if (!strncmp(__res.bi_enet1addr, "\0xFF\0xFF\0xFF\0xFF\0xFF\0xFF", 6))
+	  	memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6);
+	else
+		memcpy(emacdata->mac_addr, EBONY_NA1_ADDR(vpd_base), 6);
+
+	iounmap(vpd_base);
+
+}
+
+/*
  * FIXME: This is only here to "make it work".  This will move
  * to a ibm_pcix.c which will contain a generic IBM PCIX bridge
  * configuration library. -Matt
@@ -309,19 +348,7 @@
 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);
-	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);
+  	ebony_set_emacdata();
 
 	/*
 	 * Determine various clocks.
@@ -368,7 +395,20 @@
 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);
+
+	/* Copy the kernel command line arguments to a safe place. */
+	if (r6) {
+		*(char *) (r7 + KERNELBASE) = 0;
+		strcpy(cmd_line, (char *) (r6 + KERNELBASE));
+	}
 
 	ibm44x_platform_init();
 

             reply	other threads:[~2005-02-23 18:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-23 18:39 Shawn Jin [this message]
2005-02-23 19:01 ` [PATCH] Ebony's UBoot awareness Tom Rini
2005-02-23 19:12   ` Eugene Surovegin
2005-02-23 21:20     ` Matt Porter
2005-02-23 21:24 ` Matt Porter
2005-02-24 21:43   ` Shawn Jin
2005-02-24 22:27     ` Matt Porter
2005-03-01 21:02     ` Matt Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3d0340b05022310396240c8ac@mail.gmail.com \
    --to=shawnxjin@gmail.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.