public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH 1/4: resubmit] ppc4xx: PPC405GPr fix missing register definitions
@ 2008-02-05  9:26 Niklaus Giger
  2008-02-05  9:26 ` [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx Niklaus Giger
  2008-02-16  6:03 ` [U-Boot-Users] [PATCH 1/4: resubmit] ppc4xx: PPC405GPr fix missing register definitions Stefan Roese
  0 siblings, 2 replies; 10+ messages in thread
From: Niklaus Giger @ 2008-02-05  9:26 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>
---
 include/ppc405.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/ppc405.h b/include/ppc405.h
index b5ad38f..cbfe89e 100644
--- a/include/ppc405.h
+++ b/include/ppc405.h
@@ -784,6 +784,14 @@
 #define reset   (CNTRL_DCR_BASE+0x3)  /* reset register			     */
 #define strap   (CNTRL_DCR_BASE+0x4)  /* strap register			     */

+#define CPC0_CR0  (CNTRL_DCR_BASE+0x1)  /* chip control register 0	     */
+#define CPC0_CR1  (CNTRL_DCR_BASE+0x2)  /* chip control register 1	     */
+#define CPC0_PSR  (CNTRL_DCR_BASE+0x4)  /* chip pin strapping register	     */
+
+/* CPC0_ECR/CPC0_EIRR: PPC405GPr only */
+#define CPC0_EIRR (CNTRL_DCR_BASE+0x6)	/* external interrupt routing register */
+#define CPC0_ECR  (0xaa)		/* edge conditioner register */
+
 #define ecr     (0xaa)                /* edge conditioner register (405gpr)  */

 /* Bit definitions */
--
1.5.2.5

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

* [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx
  2008-02-05  9:26 [U-Boot-Users] [PATCH 1/4: resubmit] ppc4xx: PPC405GPr fix missing register definitions Niklaus Giger
@ 2008-02-05  9:26 ` Niklaus Giger
  2008-02-05  9:26   ` [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups Niklaus Giger
  2008-02-14  6:45   ` [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx Stefan Roese
  2008-02-16  6:03 ` [U-Boot-Users] [PATCH 1/4: resubmit] ppc4xx: PPC405GPr fix missing register definitions Stefan Roese
  1 sibling, 2 replies; 10+ messages in thread
From: Niklaus Giger @ 2008-02-05  9:26 UTC (permalink / raw)
  To: u-boot


Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>
---
 Makefile                    |    2 ++
 board/netstal/hcu4/Makefile |   12 ++++--------
 board/netstal/hcu5/Makefile |   10 ++++------
 3 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 0f6cc59..b3a1d2f 100644
--- a/Makefile
+++ b/Makefile
@@ -1225,9 +1225,11 @@ G2000_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx g2000

 hcu4_config:	unconfig
+	@mkdir -p $(obj)board/netstal/common
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx hcu4 netstal

 hcu5_config:	unconfig
+	@mkdir -p $(obj)board/netstal/common
 	@$(MKCONFIG) $(@:_config=) ppc ppc4xx hcu5 netstal

 HH405_config:	unconfig
diff --git a/board/netstal/hcu4/Makefile b/board/netstal/hcu4/Makefile
index b13d9d4..3d1d65d 100644
--- a/board/netstal/hcu4/Makefile
+++ b/board/netstal/hcu4/Makefile
@@ -1,5 +1,5 @@
 #
-# (C) Copyright 2007 Netstal Maschinen AG
+# (C) Copyright 2007-2008 Netstal Maschinen AG
 # Niklaus Giger (ng at netstal.com)
 #
 # This program is free software; you can redistribute it and/or
@@ -22,18 +22,14 @@ include $(TOPDIR)/config.mk

 LIB	= $(obj)lib$(BOARD).a

-vpath fixed_sdram.c ../common
-vpath hcu_flash.c ../common
-vpath nm_bsp.c ../common
-
 # NOBJS : Netstal common objects
-NOBJS	= ../common/fixed_sdram.o ../common/hcu_flash.o ../common/nm_bsp.o
+NOBJS	= fixed_sdram.o hcu_flash.o nm_bsp.o
 COBJS	= $(BOARD).o
 SOBJS	=

-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) $(NOBJS:.o=.c)
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) $(addprefix ../common/,$(NOBJS:.o=.c))
 OBJS	:= $(addprefix $(obj),$(COBJS))
-NOBJS	:= $(addprefix $(obj),$(NOBJS))
+NOBJS	:= $(addprefix $(obj)../common/,$(NOBJS))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))

 $(LIB):	$(OBJS) $(SOBJS) $(NOBJS)
diff --git a/board/netstal/hcu5/Makefile b/board/netstal/hcu5/Makefile
index 9f248a4..349c653 100644
--- a/board/netstal/hcu5/Makefile
+++ b/board/netstal/hcu5/Makefile
@@ -1,5 +1,5 @@
 #
-# (C) Copyright 2007 Netstal Maschinen AG
+# (C) Copyright 2007-2008 Netstal Maschinen AG
 # Niklaus Giger (ng at netstal.com)
 #
 # This program is free software; you can redistribute it and/or
@@ -22,17 +22,15 @@ include $(TOPDIR)/config.mk

 LIB	= $(obj)lib$(BOARD).a

-vpath hcu_flash.c ../common
-vpath nm_bsp.c ../common

 # NOBJS : Netstal common objects
-NOBJS	= ../common/hcu_flash.o ../common/nm_bsp.o
+NOBJS	= hcu_flash.o nm_bsp.o
 COBJS	= $(BOARD).o sdram.o
 SOBJS	= init.o

-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) $(NOBJS:.o=.c)
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) $(addprefix ../common/,$(NOBJS:.o=.c))
 OBJS	:= $(addprefix $(obj),$(COBJS))
-NOBJS	:= $(addprefix $(obj),$(NOBJS))
+NOBJS	:= $(addprefix $(obj)../common/,$(NOBJS))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))

 $(LIB):	$(OBJS) $(SOBJS) $(NOBJS)
--
1.5.2.5

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

* [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups
  2008-02-05  9:26 ` [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx Niklaus Giger
@ 2008-02-05  9:26   ` Niklaus Giger
  2008-02-05  9:26     ` [U-Boot-Users] [PATCH 4/4: resubmit] ppc4xx: HCU4/5. Cleanup configs Niklaus Giger
  2008-02-05 10:11     ` [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups Stefan Roese
  2008-02-14  6:45   ` [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx Stefan Roese
  1 sibling, 2 replies; 10+ messages in thread
From: Niklaus Giger @ 2008-02-05  9:26 UTC (permalink / raw)
  To: u-boot

- Fix some coding style violations.
- Use in/out_u16/32 where appropriate.
- Use register names from ppc405.h.
- Fix trace useage for Lauterbach.
- Remove obsolete generation HCU2.
- Renamed fixed_hcu4_sdram to init_ppc405_sdram.

Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>
---
 board/netstal/common/fixed_sdram.c |    2 +-
 board/netstal/common/hcu_flash.c   |   14 ------
 board/netstal/common/nm.h          |   11 ++++-
 board/netstal/common/nm_bsp.c      |    4 +-
 board/netstal/hcu4/hcu4.c          |   79 ++++++++++++++++--------------------
 board/netstal/hcu5/hcu5.c          |    8 +--
 board/netstal/hcu5/sdram.c         |   32 +++++++++------
 7 files changed, 69 insertions(+), 81 deletions(-)

diff --git a/board/netstal/common/fixed_sdram.c b/board/netstal/common/fixed_sdram.c
index 8082f60..f7baed6 100644
--- a/board/netstal/common/fixed_sdram.c
+++ b/board/netstal/common/fixed_sdram.c
@@ -44,7 +44,7 @@ void show_sdram_registers(void)
 }
 #endif

-long int fixed_hcu4_sdram (unsigned int dram_size)
+long int init_ppc405_sdram(unsigned int dram_size)
 {
 #ifdef DEBUG
 	printf(__FUNCTION__);
diff --git a/board/netstal/common/hcu_flash.c b/board/netstal/common/hcu_flash.c
index be2cb37..d0322f2 100644
--- a/board/netstal/common/hcu_flash.c
+++ b/board/netstal/common/hcu_flash.c
@@ -21,18 +21,6 @@
  * MA 02111-1307 USA
  */

-/*
- * Modified 4/5/2001
- * Wait for completion of each sector erase command issued
- * 4/5/2001
- * Chris Hallinan - DS4.COM, Inc. - clh at net1plus.com
- *
- * Modified 6/6/2007
- * Added isync
- * Niklaus Giger, Netstal Maschinen, niklaus.giger at netstal.com
- *
- */
-
 #include <common.h>
 #include <ppc4xx.h>
 #include <asm/processor.h>
@@ -387,7 +375,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	/* wait at least 80us - let's wait 1 ms */
 	udelay (1000);

-#if 0
 	/*
 	 * We wait for the last triggered sector
 	 */
@@ -396,7 +383,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	wait_for_DQ7 (info, l_sect);

 DONE:
-#endif
 	/* reset to read mode */
 	addr = (FLASH_WORD_SIZE *) info->start[0];
 	addr[0] = (FLASH_WORD_SIZE) 0x00F000F0;	/* reset bank */
diff --git a/board/netstal/common/nm.h b/board/netstal/common/nm.h
index 2801e13..9357f3a 100644
--- a/board/netstal/common/nm.h
+++ b/board/netstal/common/nm.h
@@ -27,8 +27,7 @@ extern void set_params_for_sw_install(int install_requested, char *board_name );
 extern void common_misc_init_r(void);

 enum {
-	/* HW_GENERATION_HCU1 is no longer supported */
-	HW_GENERATION_HCU2  = 0x10,
+	/* HW_GENERATION_HCU1/2 is no longer supported */
 	HW_GENERATION_HCU3  = 0x10,
 	HW_GENERATION_HCU4  = 0x20,
 	HW_GENERATION_HCU5  = 0x30,
@@ -36,3 +35,11 @@ enum {
 	HW_GENERATION_MCU20 = 0x0a,
 	HW_GENERATION_MCU25 = 0x09,
 };
+
+#ifdef CONFIG_405GP
+#if defined(DEBUG)
+void show_sdram_registers(void);
+#endif
+long int init_ppc405_sdram(unsigned int dram_size);
+#endif
+
diff --git a/board/netstal/common/nm_bsp.c b/board/netstal/common/nm_bsp.c
index c4265bb..89c697c 100644
--- a/board/netstal/common/nm_bsp.c
+++ b/board/netstal/common/nm_bsp.c
@@ -29,8 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;

 typedef struct {u8	id;	char *name;} generation_info;

-generation_info generations[7] = {
-	{HW_GENERATION_HCU2,	"HCU2"},
+generation_info generations[6] = {
 	{HW_GENERATION_HCU3,	"HCU3"},
 	{HW_GENERATION_HCU4,	"HCU4"},
 	{HW_GENERATION_HCU5,	"HCU5"},
@@ -134,3 +133,4 @@ void common_misc_init_r(void)
 		saveenv();
 	}
 }
+
diff --git a/board/netstal/hcu4/hcu4.c b/board/netstal/hcu4/hcu4.c
index 4fbe701..ed2b863 100644
--- a/board/netstal/hcu4/hcu4.c
+++ b/board/netstal/hcu4/hcu4.c
@@ -1,5 +1,5 @@
 /*
- *(C) Copyright 2005-2007 Netstal Maschinen AG
+ *(C) Copyright 2005-2008 Netstal Maschinen AG
  *    Niklaus Giger (Niklaus.Giger at netstal.com)
  *
  *    This source code is free software; you can redistribute it
@@ -28,17 +28,10 @@
 DECLARE_GLOBAL_DATA_PTR;

 #define HCU_MACH_VERSIONS_REGISTER	(0x7C000000 + 0xF00000)
-#define SYS_SLOT_ADDRESS		(0x7C000000 + 0x400000)
-#define HCU3_DIGITAL_IO_REGISTER	(0x7C000000 + 0x500000)
+#define HCU_SLOT_ADDRESS		(0x7C000000 + 0x400000)
+#define HCU_DIGITAL_IO_REGISTER		(0x7C000000 + 0x500000)
 #define HCU_SW_INSTALL_REQUESTED	0x10

-#undef DEBUG
-
-#if defined(DEBUG)
-void show_sdram_registers(void);
-#endif
-long int fixed_hcu4_sdram (unsigned int dram_size);
-
 /*
  * This function is run very early, out of flash, and before devices are
  * initialized. It is called by lib_ppc/board.c:board_init_f by virtue
@@ -49,17 +42,12 @@ long int fixed_hcu4_sdram (unsigned int dram_size);
  * anything, not even stack. So be careful.
  */

-#define CPC0_CR0	0xb1	/* Chip control register 0 */
-#define CPC0_CR1        0xb2	/* Chip control register 1 */
 /* Attention: If you want 1 microsecs times from the external oscillator
- * use  0x00804051. But this causes problems with u-boot and linux!
+ * 0x00004051 is okay for u-boot/linux, but different from old vxworks values
+ * 0x00804051 causes problems with u-boot and linux!
  */
 #define CPC0_CR0_VALUE	0x0030103c
 #define CPC0_CR1_VALUE	0x00004051
-#define CPC0_ECR	0xaa	/* Edge condition register */
-#define EBC0_CFG	0x23	/* External Peripheral Control Register */
-#define CPC0_EIRR	0xb6	/* External Interrupt Register */
-

 int board_early_init_f (void)
 {
@@ -70,16 +58,16 @@ int board_early_init_f (void)
 	 *      IRQ 17-24 RESERVED/UNUSED
 	 *      IRQ 31 (EXT IRQ 6) (unused)
 	 */
-	mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
-	mtdcr (uicer, 0x00000000); /* disable all ints */
-	mtdcr (uiccr, 0x00000000); /* set all to be non-critical */
-	mtdcr (uicpr, 0xFFFFE000); /* set int polarities */
-	mtdcr (uictr, 0x00000000); /* set int trigger levels */
-	mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
+	mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
+	mtdcr(uicer, 0x00000000); /* disable all ints */
+	mtdcr(uiccr, 0x00000000); /* set all to be non-critical */
+	mtdcr(uicpr, 0xFFFFE000); /* set int polarities */
+	mtdcr(uictr, 0x00000000); /* set int trigger levels */
+	mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */

-	mtdcr(CPC0_CR1,  CPC0_CR1_VALUE);
-	mtdcr(CPC0_ECR,  0x60606000);
-	mtdcr(CPC0_EIRR, 0x7c000000);
+	mtdcr(CPC0_CR1, CPC0_CR1_VALUE);
+	mtdcr(CPC0_ECR, 0x60606000);
+	mtdcr(CPC0_EIRR, 0x7C000000);

 	return 0;
 }
@@ -93,18 +81,19 @@ int board_pre_init (void)

 int sys_install_requested(void)
 {
-	u16 *ioValuePtr = (u16 *)HCU3_DIGITAL_IO_REGISTER;
-	return (in_be16(ioValuePtr) & HCU_SW_INSTALL_REQUESTED) != 0;
+	u16 ioValue = in_be16((u16 *)HCU_DIGITAL_IO_REGISTER);
+	return (ioValue & HCU_SW_INSTALL_REQUESTED) != 0;
 }

 int checkboard (void)
 {
-	u16 *boardVersReg = (u16 *)HCU_MACH_VERSIONS_REGISTER;
-	u16 generation = in_be16(boardVersReg) & 0xf0;
-	u16 index      = in_be16(boardVersReg) & 0x0f;
+	u16 boardVersReg = in_be16((u16 *)HCU_MACH_VERSIONS_REGISTER);
+	u16 generation = boardVersReg & 0xf0;
+	u16 index      = boardVersReg & 0x0f;
+
+	/* Cannot be done in board_early_init */
+	mtdcr(cntrl0,  CPC0_CR0_VALUE);

-	/* Cannot be done, in board_early_init */
-	mtdcr(CPC0_CR0,  CPC0_CR0_VALUE);
 	/* Force /RTS to active. The board it not wired quite
 	 *  correctly to use cts/rtc flow control, so just force the
 	 *  /RST active and forget about it.
@@ -145,8 +134,8 @@ void sdram_init(void)
  */
 u32 hcu_get_slot(void)
 {
-	u16 *slot = (u16 *)SYS_SLOT_ADDRESS;
-	return in_be16(slot) & 0x7f;
+	u16 slot = in_be16((u16 *)HCU_SLOT_ADDRESS);
+	return slot & 0x7f;
 }

 /*
@@ -154,12 +143,12 @@ u32 hcu_get_slot(void)
  */
 u32 get_serial_number(void)
 {
-	u32 *serial = (u32 *)CFG_FLASH_BASE;
+	u32 serial = in_be32((u32 *)CFG_FLASH_BASE);

-	if (in_be32(serial) == 0xffffffff)
+	if (serial == 0xffffffff)
 		return 0;

-	return in_be32(serial);
+	return serial;
 }


@@ -177,12 +166,14 @@ int misc_init_r(void)
 long int initdram(int board_type)
 {
 	long dram_size = 0;
-	u16 *boardVersReg = (u16 *) HCU_MACH_VERSIONS_REGISTER;
-	u16 generation = in_be16(boardVersReg) & 0xf0;
-	if (generation == HW_GENERATION_HCU3)
-		dram_size = 32*1024*1024;
-	else dram_size = 64*1024*1024;
-	fixed_hcu4_sdram(dram_size);
+	u16 boardVersReg = in_be16((u16 *)HCU_MACH_VERSIONS_REGISTER);
+	u16 generation = boardVersReg & 0xf0;
+	u16 index      = boardVersReg & 0x0f;
+
+	if (generation == HW_GENERATION_HCU3 && index < 0xf)
+		dram_size = 32 << 20; /* 32 MB - RAM */
+	else dram_size = 64 << 20;    /* 64 MB - RAM */
+	init_ppc405_sdram(dram_size);

 #ifdef DEBUG
 	show_sdram_registers();
diff --git a/board/netstal/hcu5/hcu5.c b/board/netstal/hcu5/hcu5.c
index 2c7afe2..c494e93 100644
--- a/board/netstal/hcu5/hcu5.c
+++ b/board/netstal/hcu5/hcu5.c
@@ -309,15 +309,13 @@ int misc_init_r(void)
 	 */
 	if (mfspr(dbcr0) & 0x80000000) {
 		/* External debugger alive
-		 * enable trace facilty for Lauterback
-		 * CCR0[DAPUIB]=0 	Enable broadcast of instruction data
-		 *			to auxiliary processor interface
+		 * enable trace facilty for Lauterbach
 		 * CCR0[DTB]=0 		Enable broadcast of trace information
 		 * SDR0_PFC0[TRE] 	Trace signals are enabled instead of
 		 *			GPIO49-63
 		 */
-		mtspr(ccr0, mfspr(ccr0)  &~ 0x00108000);
-		mtsdr(SDR0_PFC0, sdr0_pfc1 | 0x00000100);
+	        mtspr(ccr0, mfspr(ccr0)  &~ (CCR0_DTB));
+		mtsdr(SDR0_PFC0, sdr0_pfc1 | SDR0_PFC0_TRE_ENABLE);
 	}
 	return 0;
 }
diff --git a/board/netstal/hcu5/sdram.c b/board/netstal/hcu5/sdram.c
index 5435de1..d3c2233 100644
--- a/board/netstal/hcu5/sdram.c
+++ b/board/netstal/hcu5/sdram.c
@@ -165,19 +165,25 @@ static void program_ecc(unsigned long start_address, unsigned long num_bytes)
 	u32 val;
 	char str[] = "ECC generation -";
 #if defined(CONFIG_PRAM)
-	u32 *magic;
-
-	/* Check whether vxWorks is using EDR logging, if yes zero */
-	/* also PostMortem and user reserved memory */
-	magic = (u32 *)in_be32((u32 *)(start_address + num_bytes -
-				       (CONFIG_PRAM*1024) + sizeof(u32)));
-
-	debug("\n%s:  CONFIG_PRAM %d kB magic 0x%x 0x%p -> 0x%x\n", __FUNCTION__,
-	       CONFIG_PRAM,
-	       start_address + num_bytes - (CONFIG_PRAM*1024) + sizeof(u32),
-	       magic, in_be32(magic));
-	if (in_be32(magic) == 0xbeefbabe)
-		num_bytes -= (CONFIG_PRAM*1024) - PM_RESERVED_MEM;
+	u32 *magicPtr;
+	u32 magic;
+
+	if ((mfspr(dbcr0) & 0x80000000) == 0) {
+		/* only if no external debugger is alive!
+		 * Check whether vxWorks is using EDR logging, if yes zero
+		 * also PostMortem and user reserved memory
+		 */
+		magicPtr = (u32 *)(start_address + num_bytes -
+				(CONFIG_PRAM*1024) + sizeof(u32));
+		magic = in_be32(magicPtr);
+		debug("%s:  CONFIG_PRAM %d kB magic 0x%x 0x%p\n",
+		      __FUNCTION__, CONFIG_PRAM,
+		      magicPtr, magic);
+		if (magic == 0xbeefbabe) {
+			printf("%s: preserving at %p\n", __FUNCTION__, magicPtr);
+			num_bytes -= (CONFIG_PRAM*1024) - PM_RESERVED_MEM;
+		}
+	}
 #endif

 	sync();
--
1.5.2.5

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

* [U-Boot-Users] [PATCH 4/4: resubmit] ppc4xx: HCU4/5. Cleanup configs
  2008-02-05  9:26   ` [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups Niklaus Giger
@ 2008-02-05  9:26     ` Niklaus Giger
  2008-02-16  6:04       ` Stefan Roese
  2008-02-05 10:11     ` [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups Stefan Roese
  1 sibling, 1 reply; 10+ messages in thread
From: Niklaus Giger @ 2008-02-05  9:26 UTC (permalink / raw)
  To: u-boot

- hcu4.h: Removed define of CONFIG_PPC405GPr
- Corrected phy addresses
- Fix boot variables
- Respect line length of 80 chars

Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>
---
 include/configs/hcu4.h |   26 ++++++++------------------
 include/configs/hcu5.h |   47 +++++++++++++++++++----------------------------
 2 files changed, 27 insertions(+), 46 deletions(-)

diff --git a/include/configs/hcu4.h b/include/configs/hcu4.h
index cb51406..9242d2c 100644
--- a/include/configs/hcu4.h
+++ b/include/configs/hcu4.h
@@ -33,7 +33,6 @@
  *----------------------------------------------------------------------*/
 #define CONFIG_HCU4		1		/* Board is HCU4	*/
 #define CONFIG_4xx		1		/* ... PPC4xx family	*/
-#define CONFIG_405GPr 1 /* HCU4 has a 405GPr */
 #define CONFIG_405GP 1
 #define CONFIG_4xx   1

@@ -176,7 +175,7 @@

 #define CFG_TFTP_LOADADDR 0x01000000 /* @16 MB */

-#define	CONFIG_EXTRA_ENV_SETTINGS					\
+#define	CONFIG_EXTRA_ENV_SETTINGS				\
 	"netdev=eth0\0"							\
 	"loadaddr=0x01000000\0"						\
 	"nfsargs=setenv bootargs root=/dev/nfs rw "			\
@@ -190,14 +189,14 @@
 	        "bootm\0"						\
 	"rootpath=/home/diagnose/eldk/ppc_4xx\0"			\
 	"bootfile=/tftpboot/hcu4/uImage\0"				\
-	"load=tftp 100000 hcu4/u-boot.bin\0"			\
-	"update=protect off FFFB0000 FFFFFFFF;era FFFC0000 FFFFFFFF;"	\
+	"load=tftp 100000 hcu4/u-boot.bin\0"				\
+	"update=protect off FFFB0000 FFFFFFFF;era FFFB0000 FFFFFFFF;"	\
 		"cp.b 100000 FFFB0000 50000\0"			        \
 	"upd=run load;run update\0"					\
-	"vx=tftp ${loadaddr} hcu4_vx_rom;"				\
-	"vx=tftp ${loadaddr} hcu4/hcu4_vx_rom;"				\
-	"setenv bootargs emac(0,0)c:hcu4/hcu4_vx_rom e=${ipaddr} "	\
-	"bootvx ${loadaddr}\0" 						\
+	"vx_rom=hcu4/hcu4_vx_rom\0"					\
+	"vx=tftp ${loadaddr} ${vx_rom};run vxargs; bootvx\0"		\
+	"vxargs=setenv bootargs emac(0,0)c:${vx_rom} e=${ipaddr}"	\
+	" h=${serverip} u=dpu pw=netstal8752 tn=hcu5 f=0x3008\0"	\
 	""
 #define CONFIG_BOOTCOMMAND	"run vx"

@@ -207,7 +206,7 @@
 #define CFG_LOADS_BAUD_CHANGE	1	/* allow baudrate change	*/

 #define CONFIG_MII		1	/* MII PHY management		*/
-#define CONFIG_PHY_ADDR		1	/* PHY address			*/
+#define CONFIG_PHY_ADDR	1	/* PHY address			*/

 #define CONFIG_PHY_RESET        1	/* reset phy upon startup */

@@ -334,15 +333,6 @@
 /* Configuration Port location */
 #define CONFIG_PORT_ADDR	0xF0000500

-
-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD	0x01		/* Normal Power-On: Boot from FLASH */
-#define BOOTFLAG_WARM	0x02		/* Software reboot */
-
 #define CFG_HUSH_PARSER                 /* use "hush" command parser    */
 #ifdef  CFG_HUSH_PARSER
 #define CFG_PROMPT_HUSH_PS2	"> "
diff --git a/include/configs/hcu5.h b/include/configs/hcu5.h
index d66c47a..8c26613 100644
--- a/include/configs/hcu5.h
+++ b/include/configs/hcu5.h
@@ -123,7 +123,7 @@
 /* Put the environment in Flash */
 #define CFG_ENV_SECT_SIZE	0x10000 /* size of one complete sector	*/
 #define CFG_ENV_ADDR		((-CFG_MONITOR_LEN)-CFG_ENV_SECT_SIZE)
-#define	CFG_ENV_SIZE		8*1024	/* 8 KB Environment Sector	*/
+#define CFG_ENV_SIZE		8*1024	/* 8 KB Environment Sector	*/

 /* Address and size of Redundant Environment Sector	*/
 #define CFG_ENV_ADDR_REDUND	(CFG_ENV_ADDR-CFG_ENV_SECT_SIZE)
@@ -148,9 +148,9 @@
  * I2C stuff for a ATMEL AT24C16 (2kB holding ENV, we are using the
  * the second internal I2C controller of the PPC440EPx
  *----------------------------------------------------------------------*/
-#define CFG_SPD_BUS_NUM		1
+#define CFG_SPD_BUS_NUM	1

-#define CONFIG_HARD_I2C		1	/* I2C with hardware support	*/
+#define CONFIG_HARD_I2C	1	/* I2C with hardware support	*/
 #undef	CONFIG_SOFT_I2C			/* I2C bit-banged		*/
 #define CFG_I2C_SPEED		400000	/* I2C speed and slave address	*/
 #define CFG_I2C_SLAVE		0x7F
@@ -182,7 +182,7 @@

 #define CFG_TFTP_LOADADDR 0x01000000 /* @16 MB */

-#define	CONFIG_EXTRA_ENV_SETTINGS					\
+#define	CONFIG_EXTRA_ENV_SETTINGS				\
 	"netdev=eth0\0"							\
 	"loadaddr=0x01000000\0"						\
 	"nfsargs=setenv bootargs root=/dev/nfs rw "			\
@@ -197,14 +197,13 @@
 		"bootfile=hcu5/uImage\0" 				\
 		"rootpath=/home/hcu/eldk/ppc_4xxFP\0"		 	\
 		"load=tftp 100000 hcu5/u-boot.bin\0"		 	\
-	"update=protect off FFFb0000 FFFFFFFF;era FFFb0000 FFFFFFFF;"	\
-		"cp.b 100000 FFFb0000 50000\0"			        \
+	"update=protect off FFFB0000 FFFFFFFF;era FFFB0000 FFFFFFFF;"	\
+		"cp.b 100000 FFFB0000 50000\0"			        \
 	"upd=run load;run update\0"					\
-	"vx=tftp ${loadaddr} hcu5/hcu5_vx_rom; run vxboot\0"		\
-	"vxusb=usb start; fatload usb 0 ${loadaddr} vxWorks.st; run vxboot\0" \
-	"vxargs=emac(0,0)c:hcu5/hcu5_vx_rom e=${ipaddr} h=${serverip}"	\
-		" u=dpu pw=netstal8752 tn=hcu5 f=0x3008\0" \
-	"vxboot=setenv bootargs $(vxargs); bootvx ${loadaddr}\0"     	\
+	"vx_rom=hcu5/hcu5_vx_rom\0"					\
+	"vx=tftp ${loadaddr} ${vx_rom};run vxargs; bootvx\0"		\
+	"vxargs=setenv bootargs emac(0,0)c:${vx_rom} e=${ipaddr}"	\
+	" h=${serverip} u=dpu pw=netstal8752 tn=hcu5 f=0x3008\0"	\
 	"usbargs=setenv bootargs root=/dev/sda1 ro\0"     	     	\
 	"linux=usb start; ext2load usb 0 ${loadaddr} /boot/uImage;"     \
 	"run usbargs addip addtty; bootm\0"     			\
@@ -225,16 +224,16 @@
 #define CONFIG_M88E1111_PHY	1
 #define	CONFIG_IBM_EMAC4_V4	1
 #define CONFIG_MII		1	/* MII PHY management		*/
-#define CONFIG_PHY_ADDR		0	/* PHY address, See schematics	*/
+#define CONFIG_PHY_ADDR	1	/* PHY address, like on HCU4	*/

-#define CONFIG_PHY_RESET        1	/* reset phy upon startup         */
+#define CONFIG_PHY_RESET       1	/* reset phy upon startup         */

 #define CONFIG_HAS_ETH0
 #define CFG_RX_ETH_BUFFER	32 /* Number of ethernet rx buffers & desc. */

 #define CONFIG_NET_MULTI	1
-#define CONFIG_HAS_ETH1		1	/* add support for "eth1addr"	*/
-#define CONFIG_PHY1_ADDR	1
+#define CONFIG_HAS_ETH1	1	/* add support for "eth1addr" */
+#define CONFIG_PHY1_ADDR	2

 /* USB */
 #define CONFIG_USB_OHCI
@@ -311,7 +310,7 @@
 #define CFG_BARGSIZE	        CFG_CBSIZE /* Boot Argument Buffer Size	*/

 #define CFG_MEMTEST_START	0x0400000 /* memtest works on		*/
-#define CFG_MEMTEST_END		0x0C00000 /* 4 ... 12 MB in DRAM	*/
+#define CFG_MEMTEST_END	0x0C00000 /* 4 ... 12 MB in DRAM	*/

 #define CFG_LOAD_ADDR		0x100000  /* default load address	*/
 #define CFG_EXTBDINFO		1	/* To use extended board_into (bd_t) */
@@ -350,11 +349,11 @@
  * Flash
  *----------------------------------------------------------------------*/

-#define CFG_MAX_FLASH_BANKS	1	/* max number of memory banks		*/
-#define CFG_MAX_FLASH_SECT	8	/* max number of sectors on one chip	*/
+#define CFG_MAX_FLASH_BANKS	1	/* max number of memory banks */
+#define CFG_MAX_FLASH_SECT	8	/* max number of sectors on one chip */

-#define CFG_FLASH_ERASE_TOUT	120000	/* Timeout for Flash Erase (in ms)	*/
-#define CFG_FLASH_WRITE_TOUT	500	/* Timeout for Flash Write (in ms)	*/
+#define CFG_FLASH_ERASE_TOUT	120000	/* Timeout for Flash Erase (in ms) */
+#define CFG_FLASH_WRITE_TOUT	500	/* Timeout for Flash Write (in ms) */

 /*-----------------------------------------------------------------------
  * External Bus Controller (EBC) Setup
@@ -393,14 +392,6 @@
 #define HCU_CPLD_VERSION_REGISTER ( CFG_CPLD + 0x0F00000 )
 #define HCU_HW_VERSION_REGISTER   ( CFG_CPLD + 0x1400000 )

-/*
- * Internal Definitions
- *
- * Boot Flags
- */
-#define BOOTFLAG_COLD	0x01		/* Normal Power-On: Boot from FLASH */
-#define BOOTFLAG_WARM	0x02		/* Software reboot		*/
-
 #define CFG_HUSH_PARSER                 /* use "hush" command parser    */
 #ifdef  CFG_HUSH_PARSER
 	#define CFG_PROMPT_HUSH_PS2     "> "
--
1.5.2.5

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

* [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups
  2008-02-05  9:26   ` [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups Niklaus Giger
  2008-02-05  9:26     ` [U-Boot-Users] [PATCH 4/4: resubmit] ppc4xx: HCU4/5. Cleanup configs Niklaus Giger
@ 2008-02-05 10:11     ` Stefan Roese
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Roese @ 2008-02-05 10:11 UTC (permalink / raw)
  To: u-boot

On Tuesday 05 February 2008, Niklaus Giger wrote:
> - Fix some coding style violations.
> - Use in/out_u16/32 where appropriate.
> - Use register names from ppc405.h.
> - Fix trace useage for Lauterbach.
> - Remove obsolete generation HCU2.
> - Renamed fixed_hcu4_sdram to init_ppc405_sdram.

One comment still. Please see below.

<snip>

> diff --git a/board/netstal/hcu4/hcu4.c b/board/netstal/hcu4/hcu4.c
> index 4fbe701..ed2b863 100644
> --- a/board/netstal/hcu4/hcu4.c
> +++ b/board/netstal/hcu4/hcu4.c
> @@ -1,5 +1,5 @@
>  /*
> - *(C) Copyright 2005-2007 Netstal Maschinen AG
> + *(C) Copyright 2005-2008 Netstal Maschinen AG
>   *    Niklaus Giger (Niklaus.Giger at netstal.com)
>   *
>   *    This source code is free software; you can redistribute it
> @@ -28,17 +28,10 @@
>  DECLARE_GLOBAL_DATA_PTR;
>
>  #define HCU_MACH_VERSIONS_REGISTER	(0x7C000000 + 0xF00000)
> -#define SYS_SLOT_ADDRESS		(0x7C000000 + 0x400000)
> -#define HCU3_DIGITAL_IO_REGISTER	(0x7C000000 + 0x500000)
> +#define HCU_SLOT_ADDRESS		(0x7C000000 + 0x400000)
> +#define HCU_DIGITAL_IO_REGISTER		(0x7C000000 + 0x500000)
>  #define HCU_SW_INSTALL_REQUESTED	0x10
>
> -#undef DEBUG
> -
> -#if defined(DEBUG)
> -void show_sdram_registers(void);
> -#endif
> -long int fixed_hcu4_sdram (unsigned int dram_size);
> -
>  /*
>   * This function is run very early, out of flash, and before devices are
>   * initialized. It is called by lib_ppc/board.c:board_init_f by virtue
> @@ -49,17 +42,12 @@ long int fixed_hcu4_sdram (unsigned int dram_size);
>   * anything, not even stack. So be careful.
>   */
>
> -#define CPC0_CR0	0xb1	/* Chip control register 0 */
> -#define CPC0_CR1        0xb2	/* Chip control register 1 */
>  /* Attention: If you want 1 microsecs times from the external oscillator
> - * use  0x00804051. But this causes problems with u-boot and linux!
> + * 0x00004051 is okay for u-boot/linux, but different from old vxworks
> values + * 0x00804051 causes problems with u-boot and linux!
>   */
>  #define CPC0_CR0_VALUE	0x0030103c
>  #define CPC0_CR1_VALUE	0x00004051
> -#define CPC0_ECR	0xaa	/* Edge condition register */
> -#define EBC0_CFG	0x23	/* External Peripheral Control Register */
> -#define CPC0_EIRR	0xb6	/* External Interrupt Register */
> -
>
>  int board_early_init_f (void)
>  {
> @@ -70,16 +58,16 @@ int board_early_init_f (void)
>  	 *      IRQ 17-24 RESERVED/UNUSED
>  	 *      IRQ 31 (EXT IRQ 6) (unused)
>  	 */
> -	mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
> -	mtdcr (uicer, 0x00000000); /* disable all ints */
> -	mtdcr (uiccr, 0x00000000); /* set all to be non-critical */
> -	mtdcr (uicpr, 0xFFFFE000); /* set int polarities */
> -	mtdcr (uictr, 0x00000000); /* set int trigger levels */
> -	mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
> +	mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
> +	mtdcr(uicer, 0x00000000); /* disable all ints */
> +	mtdcr(uiccr, 0x00000000); /* set all to be non-critical */
> +	mtdcr(uicpr, 0xFFFFE000); /* set int polarities */
> +	mtdcr(uictr, 0x00000000); /* set int trigger levels */
> +	mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
>
> -	mtdcr(CPC0_CR1,  CPC0_CR1_VALUE);
> -	mtdcr(CPC0_ECR,  0x60606000);
> -	mtdcr(CPC0_EIRR, 0x7c000000);
> +	mtdcr(CPC0_CR1, CPC0_CR1_VALUE);
> +	mtdcr(CPC0_ECR, 0x60606000);
> +	mtdcr(CPC0_EIRR, 0x7C000000);
>
>  	return 0;
>  }
> @@ -93,18 +81,19 @@ int board_pre_init (void)
>
>  int sys_install_requested(void)
>  {
> -	u16 *ioValuePtr = (u16 *)HCU3_DIGITAL_IO_REGISTER;
> -	return (in_be16(ioValuePtr) & HCU_SW_INSTALL_REQUESTED) != 0;
> +	u16 ioValue = in_be16((u16 *)HCU_DIGITAL_IO_REGISTER);
> +	return (ioValue & HCU_SW_INSTALL_REQUESTED) != 0;
>  }
>
>  int checkboard (void)
>  {
> -	u16 *boardVersReg = (u16 *)HCU_MACH_VERSIONS_REGISTER;
> -	u16 generation = in_be16(boardVersReg) & 0xf0;
> -	u16 index      = in_be16(boardVersReg) & 0x0f;
> +	u16 boardVersReg = in_be16((u16 *)HCU_MACH_VERSIONS_REGISTER);
> +	u16 generation = boardVersReg & 0xf0;
> +	u16 index      = boardVersReg & 0x0f;
> +
> +	/* Cannot be done in board_early_init */
> +	mtdcr(cntrl0,  CPC0_CR0_VALUE);
>
> -	/* Cannot be done, in board_early_init */
> -	mtdcr(CPC0_CR0,  CPC0_CR0_VALUE);
>  	/* Force /RTS to active. The board it not wired quite
>  	 *  correctly to use cts/rtc flow control, so just force the
>  	 *  /RST active and forget about it.
> @@ -145,8 +134,8 @@ void sdram_init(void)
>   */
>  u32 hcu_get_slot(void)
>  {
> -	u16 *slot = (u16 *)SYS_SLOT_ADDRESS;
> -	return in_be16(slot) & 0x7f;
> +	u16 slot = in_be16((u16 *)HCU_SLOT_ADDRESS);
> +	return slot & 0x7f;
>  }
>
>  /*
> @@ -154,12 +143,12 @@ u32 hcu_get_slot(void)
>   */
>  u32 get_serial_number(void)
>  {
> -	u32 *serial = (u32 *)CFG_FLASH_BASE;
> +	u32 serial = in_be32((u32 *)CFG_FLASH_BASE);
>
> -	if (in_be32(serial) == 0xffffffff)
> +	if (serial == 0xffffffff)
>  		return 0;
>
> -	return in_be32(serial);
> +	return serial;
>  }
>
>
> @@ -177,12 +166,14 @@ int misc_init_r(void)
>  long int initdram(int board_type)
>  {
>  	long dram_size = 0;
> -	u16 *boardVersReg = (u16 *) HCU_MACH_VERSIONS_REGISTER;
> -	u16 generation = in_be16(boardVersReg) & 0xf0;
> -	if (generation == HW_GENERATION_HCU3)
> -		dram_size = 32*1024*1024;
> -	else dram_size = 64*1024*1024;
> -	fixed_hcu4_sdram(dram_size);
> +	u16 boardVersReg = in_be16((u16 *)HCU_MACH_VERSIONS_REGISTER);
> +	u16 generation = boardVersReg & 0xf0;
> +	u16 index      = boardVersReg & 0x0f;
> +
> +	if (generation == HW_GENERATION_HCU3 && index < 0xf)
> +		dram_size = 32 << 20; /* 32 MB - RAM */
> +	else dram_size = 64 << 20;    /* 64 MB - RAM */

	if (generation == HW_GENERATION_HCU3 && index < 0xf)
		dram_size = 32 << 20;	/* 32 MB - RAM */
	else
		dram_size = 64 << 20;	/* 64 MB - RAM */

please.

Please fix and resubmit. Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office@denx.de
=====================================================================

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

* [U-Boot-Users] [PATCH 3/4:resubmit] ppc4xx: HCU4/5. Cleanups
@ 2008-02-05 10:31 Niklaus Giger
  2008-02-16  6:03 ` Stefan Roese
  0 siblings, 1 reply; 10+ messages in thread
From: Niklaus Giger @ 2008-02-05 10:31 UTC (permalink / raw)
  To: u-boot

- Fix some coding style violations.
- Use in/out_u16/32 where appropriate.
- Use register names from ppc405.h.
- Fix trace useage for Lauterbach.
- Remove obsolete generation HCU2.
- Renamed fixed_hcu4_sdram to init_ppc405_sdram.

Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>
---
 board/netstal/common/fixed_sdram.c |    2 +-
 board/netstal/common/hcu_flash.c   |   14 ------
 board/netstal/common/nm.h          |   11 ++++-
 board/netstal/common/nm_bsp.c      |    4 +-
 board/netstal/hcu4/hcu4.c          |   80 ++++++++++++++++--------------------
 board/netstal/hcu5/hcu5.c          |    8 +--
 board/netstal/hcu5/sdram.c         |   32 ++++++++------
 7 files changed, 70 insertions(+), 81 deletions(-)

diff --git a/board/netstal/common/fixed_sdram.c b/board/netstal/common/fixed_sdram.c
index 8082f60..f7baed6 100644
--- a/board/netstal/common/fixed_sdram.c
+++ b/board/netstal/common/fixed_sdram.c
@@ -44,7 +44,7 @@ void show_sdram_registers(void)
 }
 #endif

-long int fixed_hcu4_sdram (unsigned int dram_size)
+long int init_ppc405_sdram(unsigned int dram_size)
 {
 #ifdef DEBUG
 	printf(__FUNCTION__);
diff --git a/board/netstal/common/hcu_flash.c b/board/netstal/common/hcu_flash.c
index be2cb37..d0322f2 100644
--- a/board/netstal/common/hcu_flash.c
+++ b/board/netstal/common/hcu_flash.c
@@ -21,18 +21,6 @@
  * MA 02111-1307 USA
  */

-/*
- * Modified 4/5/2001
- * Wait for completion of each sector erase command issued
- * 4/5/2001
- * Chris Hallinan - DS4.COM, Inc. - clh at net1plus.com
- *
- * Modified 6/6/2007
- * Added isync
- * Niklaus Giger, Netstal Maschinen, niklaus.giger at netstal.com
- *
- */
-
 #include <common.h>
 #include <ppc4xx.h>
 #include <asm/processor.h>
@@ -387,7 +375,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	/* wait at least 80us - let's wait 1 ms */
 	udelay (1000);

-#if 0
 	/*
 	 * We wait for the last triggered sector
 	 */
@@ -396,7 +383,6 @@ int flash_erase (flash_info_t * info, int s_first, int s_last)
 	wait_for_DQ7 (info, l_sect);

 DONE:
-#endif
 	/* reset to read mode */
 	addr = (FLASH_WORD_SIZE *) info->start[0];
 	addr[0] = (FLASH_WORD_SIZE) 0x00F000F0;	/* reset bank */
diff --git a/board/netstal/common/nm.h b/board/netstal/common/nm.h
index 2801e13..9357f3a 100644
--- a/board/netstal/common/nm.h
+++ b/board/netstal/common/nm.h
@@ -27,8 +27,7 @@ extern void set_params_for_sw_install(int install_requested, char *board_name );
 extern void common_misc_init_r(void);

 enum {
-	/* HW_GENERATION_HCU1 is no longer supported */
-	HW_GENERATION_HCU2  = 0x10,
+	/* HW_GENERATION_HCU1/2 is no longer supported */
 	HW_GENERATION_HCU3  = 0x10,
 	HW_GENERATION_HCU4  = 0x20,
 	HW_GENERATION_HCU5  = 0x30,
@@ -36,3 +35,11 @@ enum {
 	HW_GENERATION_MCU20 = 0x0a,
 	HW_GENERATION_MCU25 = 0x09,
 };
+
+#ifdef CONFIG_405GP
+#if defined(DEBUG)
+void show_sdram_registers(void);
+#endif
+long int init_ppc405_sdram(unsigned int dram_size);
+#endif
+
diff --git a/board/netstal/common/nm_bsp.c b/board/netstal/common/nm_bsp.c
index c4265bb..89c697c 100644
--- a/board/netstal/common/nm_bsp.c
+++ b/board/netstal/common/nm_bsp.c
@@ -29,8 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;

 typedef struct {u8	id;	char *name;} generation_info;

-generation_info generations[7] = {
-	{HW_GENERATION_HCU2,	"HCU2"},
+generation_info generations[6] = {
 	{HW_GENERATION_HCU3,	"HCU3"},
 	{HW_GENERATION_HCU4,	"HCU4"},
 	{HW_GENERATION_HCU5,	"HCU5"},
@@ -134,3 +133,4 @@ void common_misc_init_r(void)
 		saveenv();
 	}
 }
+
diff --git a/board/netstal/hcu4/hcu4.c b/board/netstal/hcu4/hcu4.c
index 4fbe701..bb610e2 100644
--- a/board/netstal/hcu4/hcu4.c
+++ b/board/netstal/hcu4/hcu4.c
@@ -1,5 +1,5 @@
 /*
- *(C) Copyright 2005-2007 Netstal Maschinen AG
+ *(C) Copyright 2005-2008 Netstal Maschinen AG
  *    Niklaus Giger (Niklaus.Giger at netstal.com)
  *
  *    This source code is free software; you can redistribute it
@@ -28,17 +28,10 @@
 DECLARE_GLOBAL_DATA_PTR;

 #define HCU_MACH_VERSIONS_REGISTER	(0x7C000000 + 0xF00000)
-#define SYS_SLOT_ADDRESS		(0x7C000000 + 0x400000)
-#define HCU3_DIGITAL_IO_REGISTER	(0x7C000000 + 0x500000)
+#define HCU_SLOT_ADDRESS		(0x7C000000 + 0x400000)
+#define HCU_DIGITAL_IO_REGISTER		(0x7C000000 + 0x500000)
 #define HCU_SW_INSTALL_REQUESTED	0x10

-#undef DEBUG
-
-#if defined(DEBUG)
-void show_sdram_registers(void);
-#endif
-long int fixed_hcu4_sdram (unsigned int dram_size);
-
 /*
  * This function is run very early, out of flash, and before devices are
  * initialized. It is called by lib_ppc/board.c:board_init_f by virtue
@@ -49,17 +42,12 @@ long int fixed_hcu4_sdram (unsigned int dram_size);
  * anything, not even stack. So be careful.
  */

-#define CPC0_CR0	0xb1	/* Chip control register 0 */
-#define CPC0_CR1        0xb2	/* Chip control register 1 */
 /* Attention: If you want 1 microsecs times from the external oscillator
- * use  0x00804051. But this causes problems with u-boot and linux!
+ * 0x00004051 is okay for u-boot/linux, but different from old vxworks values
+ * 0x00804051 causes problems with u-boot and linux!
  */
 #define CPC0_CR0_VALUE	0x0030103c
 #define CPC0_CR1_VALUE	0x00004051
-#define CPC0_ECR	0xaa	/* Edge condition register */
-#define EBC0_CFG	0x23	/* External Peripheral Control Register */
-#define CPC0_EIRR	0xb6	/* External Interrupt Register */
-

 int board_early_init_f (void)
 {
@@ -70,16 +58,16 @@ int board_early_init_f (void)
 	 *      IRQ 17-24 RESERVED/UNUSED
 	 *      IRQ 31 (EXT IRQ 6) (unused)
 	 */
-	mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
-	mtdcr (uicer, 0x00000000); /* disable all ints */
-	mtdcr (uiccr, 0x00000000); /* set all to be non-critical */
-	mtdcr (uicpr, 0xFFFFE000); /* set int polarities */
-	mtdcr (uictr, 0x00000000); /* set int trigger levels */
-	mtdcr (uicsr, 0xFFFFFFFF); /* clear all ints */
+	mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
+	mtdcr(uicer, 0x00000000); /* disable all ints */
+	mtdcr(uiccr, 0x00000000); /* set all to be non-critical */
+	mtdcr(uicpr, 0xFFFFE000); /* set int polarities */
+	mtdcr(uictr, 0x00000000); /* set int trigger levels */
+	mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */

-	mtdcr(CPC0_CR1,  CPC0_CR1_VALUE);
-	mtdcr(CPC0_ECR,  0x60606000);
-	mtdcr(CPC0_EIRR, 0x7c000000);
+	mtdcr(CPC0_CR1, CPC0_CR1_VALUE);
+	mtdcr(CPC0_ECR, 0x60606000);
+	mtdcr(CPC0_EIRR, 0x7C000000);

 	return 0;
 }
@@ -93,18 +81,19 @@ int board_pre_init (void)

 int sys_install_requested(void)
 {
-	u16 *ioValuePtr = (u16 *)HCU3_DIGITAL_IO_REGISTER;
-	return (in_be16(ioValuePtr) & HCU_SW_INSTALL_REQUESTED) != 0;
+	u16 ioValue = in_be16((u16 *)HCU_DIGITAL_IO_REGISTER);
+	return (ioValue & HCU_SW_INSTALL_REQUESTED) != 0;
 }

 int checkboard (void)
 {
-	u16 *boardVersReg = (u16 *)HCU_MACH_VERSIONS_REGISTER;
-	u16 generation = in_be16(boardVersReg) & 0xf0;
-	u16 index      = in_be16(boardVersReg) & 0x0f;
+	u16 boardVersReg = in_be16((u16 *)HCU_MACH_VERSIONS_REGISTER);
+	u16 generation = boardVersReg & 0xf0;
+	u16 index      = boardVersReg & 0x0f;
+
+	/* Cannot be done in board_early_init */
+	mtdcr(cntrl0,  CPC0_CR0_VALUE);

-	/* Cannot be done, in board_early_init */
-	mtdcr(CPC0_CR0,  CPC0_CR0_VALUE);
 	/* Force /RTS to active. The board it not wired quite
 	 *  correctly to use cts/rtc flow control, so just force the
 	 *  /RST active and forget about it.
@@ -145,8 +134,8 @@ void sdram_init(void)
  */
 u32 hcu_get_slot(void)
 {
-	u16 *slot = (u16 *)SYS_SLOT_ADDRESS;
-	return in_be16(slot) & 0x7f;
+	u16 slot = in_be16((u16 *)HCU_SLOT_ADDRESS);
+	return slot & 0x7f;
 }

 /*
@@ -154,12 +143,12 @@ u32 hcu_get_slot(void)
  */
 u32 get_serial_number(void)
 {
-	u32 *serial = (u32 *)CFG_FLASH_BASE;
+	u32 serial = in_be32((u32 *)CFG_FLASH_BASE);

-	if (in_be32(serial) == 0xffffffff)
+	if (serial == 0xffffffff)
 		return 0;

-	return in_be32(serial);
+	return serial;
 }


@@ -177,12 +166,15 @@ int misc_init_r(void)
 long int initdram(int board_type)
 {
 	long dram_size = 0;
-	u16 *boardVersReg = (u16 *) HCU_MACH_VERSIONS_REGISTER;
-	u16 generation = in_be16(boardVersReg) & 0xf0;
-	if (generation == HW_GENERATION_HCU3)
-		dram_size = 32*1024*1024;
-	else dram_size = 64*1024*1024;
-	fixed_hcu4_sdram(dram_size);
+	u16 boardVersReg = in_be16((u16 *)HCU_MACH_VERSIONS_REGISTER);
+	u16 generation = boardVersReg & 0xf0;
+	u16 index      = boardVersReg & 0x0f;
+
+	if (generation == HW_GENERATION_HCU3 && index < 0xf)
+		dram_size = 32 << 20;	/* 32 MB - RAM */
+	else
+		dram_size = 64 << 20;	/* 64 MB - RAM */
+	init_ppc405_sdram(dram_size);

 #ifdef DEBUG
 	show_sdram_registers();
diff --git a/board/netstal/hcu5/hcu5.c b/board/netstal/hcu5/hcu5.c
index 2c7afe2..c494e93 100644
--- a/board/netstal/hcu5/hcu5.c
+++ b/board/netstal/hcu5/hcu5.c
@@ -309,15 +309,13 @@ int misc_init_r(void)
 	 */
 	if (mfspr(dbcr0) & 0x80000000) {
 		/* External debugger alive
-		 * enable trace facilty for Lauterback
-		 * CCR0[DAPUIB]=0 	Enable broadcast of instruction data
-		 *			to auxiliary processor interface
+		 * enable trace facilty for Lauterbach
 		 * CCR0[DTB]=0 		Enable broadcast of trace information
 		 * SDR0_PFC0[TRE] 	Trace signals are enabled instead of
 		 *			GPIO49-63
 		 */
-		mtspr(ccr0, mfspr(ccr0)  &~ 0x00108000);
-		mtsdr(SDR0_PFC0, sdr0_pfc1 | 0x00000100);
+	        mtspr(ccr0, mfspr(ccr0)  &~ (CCR0_DTB));
+		mtsdr(SDR0_PFC0, sdr0_pfc1 | SDR0_PFC0_TRE_ENABLE);
 	}
 	return 0;
 }
diff --git a/board/netstal/hcu5/sdram.c b/board/netstal/hcu5/sdram.c
index 5435de1..d3c2233 100644
--- a/board/netstal/hcu5/sdram.c
+++ b/board/netstal/hcu5/sdram.c
@@ -165,19 +165,25 @@ static void program_ecc(unsigned long start_address, unsigned long num_bytes)
 	u32 val;
 	char str[] = "ECC generation -";
 #if defined(CONFIG_PRAM)
-	u32 *magic;
-
-	/* Check whether vxWorks is using EDR logging, if yes zero */
-	/* also PostMortem and user reserved memory */
-	magic = (u32 *)in_be32((u32 *)(start_address + num_bytes -
-				       (CONFIG_PRAM*1024) + sizeof(u32)));
-
-	debug("\n%s:  CONFIG_PRAM %d kB magic 0x%x 0x%p -> 0x%x\n", __FUNCTION__,
-	       CONFIG_PRAM,
-	       start_address + num_bytes - (CONFIG_PRAM*1024) + sizeof(u32),
-	       magic, in_be32(magic));
-	if (in_be32(magic) == 0xbeefbabe)
-		num_bytes -= (CONFIG_PRAM*1024) - PM_RESERVED_MEM;
+	u32 *magicPtr;
+	u32 magic;
+
+	if ((mfspr(dbcr0) & 0x80000000) == 0) {
+		/* only if no external debugger is alive!
+		 * Check whether vxWorks is using EDR logging, if yes zero
+		 * also PostMortem and user reserved memory
+		 */
+		magicPtr = (u32 *)(start_address + num_bytes -
+				(CONFIG_PRAM*1024) + sizeof(u32));
+		magic = in_be32(magicPtr);
+		debug("%s:  CONFIG_PRAM %d kB magic 0x%x 0x%p\n",
+		      __FUNCTION__, CONFIG_PRAM,
+		      magicPtr, magic);
+		if (magic == 0xbeefbabe) {
+			printf("%s: preserving at %p\n", __FUNCTION__, magicPtr);
+			num_bytes -= (CONFIG_PRAM*1024) - PM_RESERVED_MEM;
+		}
+	}
 #endif

 	sync();
--
1.5.2.5

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

* [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx
  2008-02-05  9:26 ` [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx Niklaus Giger
  2008-02-05  9:26   ` [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups Niklaus Giger
@ 2008-02-14  6:45   ` Stefan Roese
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Roese @ 2008-02-14  6:45 UTC (permalink / raw)
  To: u-boot

On Tuesday 05 February 2008, Niklaus Giger wrote:
> Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>

Added to for-1.3.2 branch. Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

* [U-Boot-Users] [PATCH 1/4: resubmit] ppc4xx: PPC405GPr fix missing register definitions
  2008-02-05  9:26 [U-Boot-Users] [PATCH 1/4: resubmit] ppc4xx: PPC405GPr fix missing register definitions Niklaus Giger
  2008-02-05  9:26 ` [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx Niklaus Giger
@ 2008-02-16  6:03 ` Stefan Roese
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Roese @ 2008-02-16  6:03 UTC (permalink / raw)
  To: u-boot

On Tuesday 05 February 2008, Niklaus Giger wrote:
> Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>

Applied. Thanks.

Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

* [U-Boot-Users] [PATCH 3/4:resubmit] ppc4xx: HCU4/5. Cleanups
  2008-02-05 10:31 [U-Boot-Users] [PATCH 3/4:resubmit] ppc4xx: HCU4/5. Cleanups Niklaus Giger
@ 2008-02-16  6:03 ` Stefan Roese
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Roese @ 2008-02-16  6:03 UTC (permalink / raw)
  To: u-boot

On Tuesday 05 February 2008, Niklaus Giger wrote:
> - Fix some coding style violations.
> - Use in/out_u16/32 where appropriate.
> - Use register names from ppc405.h.
> - Fix trace useage for Lauterbach.
> - Remove obsolete generation HCU2.
> - Renamed fixed_hcu4_sdram to init_ppc405_sdram.
>
> Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>

Applied. Thanks.

Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

* [U-Boot-Users] [PATCH 4/4: resubmit] ppc4xx: HCU4/5. Cleanup configs
  2008-02-05  9:26     ` [U-Boot-Users] [PATCH 4/4: resubmit] ppc4xx: HCU4/5. Cleanup configs Niklaus Giger
@ 2008-02-16  6:04       ` Stefan Roese
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Roese @ 2008-02-16  6:04 UTC (permalink / raw)
  To: u-boot

On Tuesday 05 February 2008, Niklaus Giger wrote:
> - hcu4.h: Removed define of CONFIG_PPC405GPr
> - Corrected phy addresses
> - Fix boot variables
> - Respect line length of 80 chars
>
> Signed-off-by: Niklaus Giger <niklaus.giger@netstal.com>

Applied. Thanks.

Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

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

end of thread, other threads:[~2008-02-16  6:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-05  9:26 [U-Boot-Users] [PATCH 1/4: resubmit] ppc4xx: PPC405GPr fix missing register definitions Niklaus Giger
2008-02-05  9:26 ` [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx Niklaus Giger
2008-02-05  9:26   ` [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups Niklaus Giger
2008-02-05  9:26     ` [U-Boot-Users] [PATCH 4/4: resubmit] ppc4xx: HCU4/5. Cleanup configs Niklaus Giger
2008-02-16  6:04       ` Stefan Roese
2008-02-05 10:11     ` [U-Boot-Users] [PATCH 3/4: resubmit] ppc4xx: HCU4/5. Cleanups Stefan Roese
2008-02-14  6:45   ` [U-Boot-Users] [PATCH 2/4: resubmit] ppc4xx: HCU4/5. Fix make O=../xx Stefan Roese
2008-02-16  6:03 ` [U-Boot-Users] [PATCH 1/4: resubmit] ppc4xx: PPC405GPr fix missing register definitions Stefan Roese
  -- strict thread matches above, loose matches on Subject: below --
2008-02-05 10:31 [U-Boot-Users] [PATCH 3/4:resubmit] ppc4xx: HCU4/5. Cleanups Niklaus Giger
2008-02-16  6:03 ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox