From 854bc8da75709f13dab4cfa6e9094c0cb49b5c5a Mon Sep 17 00:00:00 2001
From: Stefan Roese <sr@denx.de>
Date: Wed, 13 Sep 2006 13:51:58 +0200
Subject: [PATCH] Add support for AMCC Rainier PPX440GRx eval board Patch by
 Stefan Roese, 13 Sep 2006

---
 CHANGELOG                    |  3 +++
 Makefile                     | 15 +++++++++++++++
 board/amcc/sequoia/sequoia.c |  8 ++++++++
 cpu/ppc4xx/4xx_enet.c        |  2 +-
 cpu/ppc4xx/vecnum.h          |  2 +-
 include/configs/sequoia.h    | 13 ++++++++++++-
 6 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index a896e253a9..0f4b4d561e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -7,6 +7,9 @@ Changes since U-Boot 1.1.4:
 
 * Cleanup examples binaries
 
+* Add support for AMCC Rainier PPX440GRx eval board
+  Patch by Stefan Roese, 13 Sep 2006
+
 * Add NAND environment support for PPC440EPx Sequoia NAND boot config
   Patch by Stefan Roese, 12 Sep 2006
 
diff --git a/Makefile b/Makefile
index ccf7f9f88f..f48ca6cebb 100644
--- a/Makefile
+++ b/Makefile
@@ -1142,6 +1142,21 @@ PPChameleonEVB_HI_33_config:	unconfig
 		}
 	@$(MKCONFIG) -a $(call xtract_4xx,$@) ppc ppc4xx PPChameleonEVB dave
 
+rainier_config:	unconfig
+	@echo "#define CONFIG_RAINIER" > include/config.h
+	@echo "Configuring for rainier board as subset of sequoia..."
+	@$(MKCONFIG) -a sequoia ppc ppc4xx sequoia amcc
+
+rainier_nand_config:	unconfig
+	@echo "#define CONFIG_RAINIER" > include/config.h
+	@echo "Configuring for rainier board as subset of sequoia..."
+	@ln -s board/amcc/sequoia/Makefile nand_spl/Makefile
+	@echo "#define CONFIG_NAND_U_BOOT" >> include/config.h
+	@echo "Compile NAND boot image for sequoia"
+	@$(MKCONFIG) -a sequoia ppc ppc4xx sequoia amcc
+	@echo "TEXT_BASE = 0x01000000" >board/amcc/sequoia/config.tmp
+	@echo "CONFIG_NAND_U_BOOT = y" >> include/config.mk
+
 sbc405_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx sbc405
 
diff --git a/board/amcc/sequoia/sequoia.c b/board/amcc/sequoia/sequoia.c
index 95734b9c57..a8ba2c0831 100644
--- a/board/amcc/sequoia/sequoia.c
+++ b/board/amcc/sequoia/sequoia.c
@@ -140,10 +140,12 @@ int misc_init_r(void)
 {
 	uint pbcr;
 	int size_val = 0;
+#ifdef CONFIG_440EPX
 	unsigned long usb2d0cr = 0;
 	unsigned long usb2phy0cr, usb2h0cr = 0;
 	unsigned long sdr0_pfc1;
 	char *act = getenv("usbact");
+#endif
 
 	/*
 	 * FLASH stuff...
@@ -211,6 +213,7 @@ int misc_init_r(void)
 	/*
 	 * USB suff...
 	 */
+#ifdef CONFIG_440EPX
 	if (act == NULL || strcmp(act, "hostdev") == 0)	{
 		/* SDR Setting */
         	mfsdr(SDR0_PFC1, sdr0_pfc1);
@@ -322,6 +325,7 @@ int misc_init_r(void)
 
 		printf("USB:   Device(int phy)\n");
 	}
+#endif /* CONFIG_440EPX */
 
 	return 0;
 }
@@ -330,7 +334,11 @@ int checkboard(void)
 {
 	char *s = getenv("serial#");
 
+#ifdef CONFIG_440EPX
 	printf("Board: Sequoia - AMCC PPC440EPx Evaluation Board");
+#else
+	printf("Board: Rainier - AMCC PPC440GRx Evaluation Board");
+#endif
 	if (s != NULL) {
 		puts(", serial# ");
 		puts(s);
diff --git a/cpu/ppc4xx/4xx_enet.c b/cpu/ppc4xx/4xx_enet.c
index 5b1c17c351..81d49ffdfe 100644
--- a/cpu/ppc4xx/4xx_enet.c
+++ b/cpu/ppc4xx/4xx_enet.c
@@ -133,7 +133,7 @@
 #define BI_PHYMODE_GMII  3
 #define BI_PHYMODE_RTBI  4
 #define BI_PHYMODE_TBI   5
-#if defined (CONFIG_440EPX)
+#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
 #define BI_PHYMODE_SMII  6
 #define BI_PHYMODE_MII   7
 #endif
diff --git a/cpu/ppc4xx/vecnum.h b/cpu/ppc4xx/vecnum.h
index 70e436aab2..685d48bcf6 100644
--- a/cpu/ppc4xx/vecnum.h
+++ b/cpu/ppc4xx/vecnum.h
@@ -31,7 +31,7 @@
 #ifndef _VECNUMS_H_
 #define _VECNUMS_H_
 
-#if defined(CONFIG_440EPX) || defined(CONFIG_440_GRX)
+#if defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
 
 /* UIC 0 */
 #define VECNUM_U0                   0  /* UART 0                        */
diff --git a/include/configs/sequoia.h b/include/configs/sequoia.h
index 639765d599..f67fd9163d 100644
--- a/include/configs/sequoia.h
+++ b/include/configs/sequoia.h
@@ -31,8 +31,13 @@
 /*-----------------------------------------------------------------------
  * High Level Configuration Options
  *----------------------------------------------------------------------*/
+/* This config file is used for Sequoia (440EPx) and Rainier (440GRx) */
+#ifndef CONFIG_RAINIER
 #define CONFIG_SEQUOIA		1		/* Board is Sequoia	*/
 #define CONFIG_440EPX		1		/* Specific PPC440EPx	*/
+#else
+#define CONFIG_440GRX		1		/* Specific PPC440GRx	*/
+#endif
 #define CONFIG_4xx		1		/* ... PPC4xx family	*/
 #define CONFIG_SYS_CLK_FREQ	33333333	/* external freq to pll	*/
 
@@ -272,12 +277,18 @@
 #define CONFIG_PHY1_ADDR	1
 
 /* USB */
+#ifdef CONFIG_440EPX
 #define CONFIG_USB_OHCI
 #define CONFIG_USB_STORAGE
 
 /* Comment this out to enable USB 1.1 device */
 #define USB_2_0_DEVICE
 
+#define CMD_USB			CFG_CMD_USB
+#else
+#define CMD_USB			0	/* no USB on 440GRx		*/
+#endif /* CONFIG_440EPX */
+
 /* Partitions */
 #define CONFIG_MAC_PARTITION
 #define CONFIG_DOS_PARTITION
@@ -301,7 +312,7 @@
 			       CFG_CMD_PING	|	\
 			       CFG_CMD_REGINFO	|	\
 			       CFG_CMD_SDRAM	|	\
-			       CFG_CMD_USB    )
+			       CMD_USB)
 
 #define CONFIG_SUPPORT_VFAT
 
-- 
2.39.5