All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Ebony's UBoot awareness
@ 2005-02-23 18:39 Shawn Jin
  2005-02-23 19:01 ` Tom Rini
  2005-02-23 21:24 ` Matt Porter
  0 siblings, 2 replies; 8+ messages in thread
From: Shawn Jin @ 2005-02-23 18:39 UTC (permalink / raw)
  To: ppcembed

[-- 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();
 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-03-01 21:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-23 18:39 [PATCH] Ebony's UBoot awareness Shawn Jin
2005-02-23 19:01 ` 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

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.