ppc_4xx resubmit: Netstal HCU5 board: added various fixes and POST
PATCH 1/1 ppc_4xx resubmit: Netstal HCU5 board: added various fixes and POST
- Moved some common code to nestal/common/nm_bsp.c.
- Added support for the vxWorks EDR.
- Enable trace for Lauterbach, if present.
- Added support for POST.
- Stylistic cleanups (multi-line comments/ enforce 80 colomn width)
--- board/netstal/hcu5/Makefile | 3 +- board/netstal/hcu5/README.txt | 3 - board/netstal/hcu5/hcu5.c | 292 +++++++++++++++++------------------------ board/netstal/hcu5/init.S | 71 +++++++--- board/netstal/hcu5/sdram.c | 74 +++++------ 5 files changed, 207 insertions(+), 236 deletions(-)
board/netstal/hcu5/Makefile +2 -1
@@ -23,9 +23,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a vpath hcu_flash.c ../common +vpath nm_bsp.c ../common # NOBJS : Netstal common objects -NOBJS = hcu_flash.o +NOBJS = hcu_flash.o nm_bsp.o COBJS = $(BOARD).o sdram.o SOBJS = init.o
board/netstal/hcu5/README.txt +0 -3
@@ -10,9 +10,6 @@ TODO: - Fix RTS/CTS problem (HW?) CONFIG_SERIAL_MULTI/CONFIG_SERIAL_SOFTWARE_FIFO hangs after Switching to interrupt driven serial input mode -- Make vxWorks start from u-boot. Possible reasons - - Does vxWorks need an entry for the Machine Check interrupt like this - tlbentry( 0x40000000, SZ_256M, 0, 1, AC_R|AC_W|AC_X|SA_G|SA_I ) ? Caveats: --------
board/netstal/hcu5/hcu5.c +122 -170
490 lines not on this page · raw message
board/netstal/hcu5/init.S +49 -22
90 lines not on this page · raw message
board/netstal/hcu5/sdram.c +34 -40
140 lines not on this page · raw message
Signature · 1 line
1.5.2.5
PATCH 1/1 ppc_4xx resubmit: netstal/common define routines used by all boards
Added some routines used by all Netstal boards:
- nm_bsp.c: - nm_show_print and
- common_misc_init_r
- set_params_for_sw_install. Bery specific code to handle our SW installation procedure
- fixed_sdram.c: Common routines for HCU4 (and upcoming) MCU25 boards to handle sdram initialization.
- nm.h: Common header
--- board/netstal/common/fixed_sdram.c | 107 +++++++++++++++++++++++++++++ board/netstal/common/nm.h | 40 +++++++++++ board/netstal/common/nm_bsp.c | 131 +++++++++++++++++++++++++++++++----- 3 files changed, 262 insertions(+), 16 deletions(-) create mode 100644 board/netstal/common/fixed_sdram.c create mode 100644 board/netstal/common/nm.h
board/netstal/common/fixed_sdram.c new file +107 -0
@@ -0,0 +1,107 @@ +/* +*(C) Copyright 2005-2008 Netstal Maschinen AG +* Niklaus Giger (Niklaus.Giger at netstal.com) +* +* This source code is free software; you can redistribute it +* and/or modify it in source code form under the terms of the GNU +* General Public License as published by the Free Software +* Foundation; either version 2 of the License, or (at your option) +* any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +*/ + +#include <common.h> +#include <ppc4xx.h> +#include <asm/processor.h> +#include "nm.h" + +#if defined(DEBUG ) +void show_sdram_registers (void ) +{ +u32 value; + +printf ("SDRAM Controller Registers --\n" ); +mfsdram (mem_mcopt1, value); +printf (" SDRAM0_CFG : 0x%08x\n" , value); +mfsdram (mem_status, value); +printf (" SDRAM0_STATUS: 0x%08x\n" , value); +mfsdram (mem_mb0cf, value); +printf (" SDRAM0_B0CR : 0x%08x\n" , value); +mfsdram (mem_mb1cf, value); +printf (" SDRAM0_B1CR : 0x%08x\n" , value); +mfsdram (mem_sdtr1, value); +printf (" SDRAM0_TR : 0x%08x\n" , value); +mfsdram (mem_rtr, value); +printf (" SDRAM0_RTR : 0x%08x\n" , value); +} +#endif + +long int fixed_hcu4_sdram (unsigned int dram_size) +{ +#ifdef DEBUG +printf (__FUNCTION__); +#endif +/* disable memory controller */ +mtdcr (memcfga, mem_mcopt1); +mtdcr (memcfgd,0x00000000 ); + +udelay (500 ); + +/* Clear SDRAM0_BESR0 (Bus Error Syndrome Register) */ +mtdcr (memcfga, mem_besra); +mtdcr (memcfgd,0xffffffff ); + +/* Clear SDRAM0_BESR1 (Bus Error Syndrome Register) */ +mtdcr (memcfga, mem_besrb); +mtdcr (memcfgd,0xffffffff ); + +/* Clear SDRAM0_ECCCFG (disable ECC) */ +mtdcr (memcfga, mem_ecccf); +mtdcr (memcfgd,0x00000000 ); + +/* Clear SDRAM0_ECCESR (ECC Error Syndrome Register) */ +mtdcr (memcfga, mem_eccerr); +mtdcr (memcfgd,0xffffffff ); + +/* Timing register: CASL=2, PTA=2, CTP=2, LDF=1, RFTA=5, RCD=2 +*/ +mtdcr (memcfga, mem_sdtr1); +mtdcr (memcfgd,0x008a4015 ); + +/* Memory Bank 0 Config == BA=0x00000000, SZ=64M, AM=3, BE=1 +*/ +mtdcr (memcfga, mem_mb0cf); +if (dram_size ==32 *1024 *1024 ) {mtdcr (memcfgd,0x00062001 ); } +if (dram_size ==64 *1024 *1024 ) {mtdcr (memcfgd,0x00084001 ); } +if (dram_size ==128 *1024 *1024 ) {mtdcr (memcfgd,0x000A4001 ); } + +/* refresh timer = 0x400 */ +mtdcr (memcfga, mem_rtr); +if (dram_size ==32 *1024 *1024 ) {mtdcr (memcfgd,0x07F00000 ); } +if (dram_size ==64 *1024 *1024 ) {mtdcr (memcfgd,0x04100000 ); } +if (dram_size ==128 *1024 *1024 ) {mtdcr (memcfgd,0x04100000 ); } + +/* Power management idle timer set to the default. */ +mtdcr (memcfga, mem_pmit); +mtdcr (memcfgd,0x07c00000 ); + +udelay (500 ); + +/* Enable banks (DCE=1, BPRF=1, ECCDD=1, EMDUL=1) TODO */ +mtdcr (memcfga, mem_mcopt1); +mtdcr (memcfgd,0x90800000 ); + +#ifdef DEBUG +printf ("%s: done\n" , __FUNCTION__); +#endif +return dram_size; +} +
board/netstal/common/nm.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +*(C) Copyright 2005-2007 Netstal Maschinen AG +* Niklaus Giger (Niklaus.Giger at netstal.com) +* +* This source code is free software; you can redistribute it +* and/or modify it in source code form under the terms of the GNU +* General Public License as published by the Free Software +* Foundation; either version 2 of the License, or (at your option) +* any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +*/ + +extern void hcu_led_set (u32 value); +extern u32 get_serial_number (void ); +extern u32 hcu_get_slot (void ); +extern int board_with_pci (void ); +extern void nm_show_print (int generation,int index,int hw_capabilities); +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_HCU3 =0x10 , +HW_GENERATION_HCU4 =0x20 , +HW_GENERATION_HCU5 =0x30 , +HW_GENERATION_MCU =0x08 , +HW_GENERATION_MCU20 =0x0a , +HW_GENERATION_MCU25 =0x09 , +}; + +
board/netstal/common/nm_bsp.c +115 -16
142 lines not on this page · raw message
Signature · 1 line
1.5.2.5
PATCH 1/1 ppc_4xx: Netstal HCU4 board: added various fixes and POST
- Moved some common code to netstal/common/nm_bsp.c.
- sdram initialisation goes go netstal/common/fixed_sdram.c.
- Added support for POST.
- Stylistic cleanups (multi-line comments/ enforce 80 colomn width)
--- board/netstal/hcu4/Makefile | 4 +- board/netstal/hcu4/hcu4.c | 340 ++++++++++--------------------------------- 2 files changed, 77 insertions(+), 267 deletions(-)
board/netstal/hcu4/Makefile +3 -1
@@ -22,10 +22,12 @@ 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 = hcu_flash.o +NOBJS = fixed_sdram.o hcu_flash.o nm_bsp.o COBJS = $(BOARD).o SOBJS =
board/netstal/hcu4/hcu4.c +74 -266
423 lines not on this page · raw message
Signature · 1 line
1.5.2.5
Stefan Roese
AppliedPATCH 1/1 ppc_4xx: Netstal HCU4 board: added various fixes and POST
Quoted 6 lines · Niklaus Giger
- Moved some common code to
netstal/common/nm_bsp.c.
- sdram initialisation goes gonetstal/common/fixed_sdram.c.
- Added support for POST.
- Stylistic cleanups (multi-line comments/ enforce 80 colomn width)Signed-off-by Niklaus Giger <[email protected]>
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
=====================================================================
PATCH 1/1 ppc_4xx resubmit: netstal/common define routines used by all boards
In reply to Niklaus GigerQuoted 8 lines · Niklaus Giger
Added some routines used by all Netstal boards:
-nm_bsp.c: -nm_show_printand
-common_misc_init_r
-set_params_for_sw_install. Bery specific code to handle our SW installation procedure
-fixed_sdram.c: Common routines for HCU4 (and upcoming) MCU25 boards to handle sdram initialization.
-nm.h: Common header
Please find some comments below.
Quoted 37 lines
Signed-off-by Niklaus Giger <[email protected]>--- board/netstal/common/fixed_sdram.c | 107 +++++++++++++++++++++++++++++ board/netstal/common/nm.h | 40 +++++++++++ board/netstal/common/nm_bsp.c | 131 +++++++++++++++++++++++++++++++----- 3 files changed, 262 insertions(+), 16 deletions(-) create mode 100644 board/netstal/common/fixed_sdram.c create mode 100644 board/netstal/common/nm.hboard/netstal/common/fixed_sdram.c new file +22
-0@@ -0,0 +1,107 @@ +/* +*(C) Copyright 2005-2008 Netstal Maschinen AG +* Niklaus Giger (Niklaus.Giger at netstal.com) +* +* This source code is free software; you can redistribute it +* and/or modify it in source code form under the terms of the GNU +* General Public License as published by the Free Software +* Foundation; either version 2 of the License, or (at your option) +* any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +*/ + +#include <common.h> +#include <ppc4xx.h>
board/netstal/common/fixed_sdram.c line 32
Quoted 10 lines
board/netstal/common/fixed_sdram.c new file +10
-0+#include <asm/processor.h> +#include "nm.h" + +#if defined(DEBUG ) +void show_sdram_registers (void ) +{ +u32 value; + +printf ("SDRAM Controller Registers --\n" ); +mfsdram (mem_mcopt1, value);
You are mixing two programming styles here. func () and func(). Please only use one style in one source file.
Quoted 9 lines
board/netstal/common/fixed_sdram.c new file +9
-0+printf (" SDRAM0_CFG : 0x%08x\n" , value); +mfsdram (mem_status, value); +printf (" SDRAM0_STATUS: 0x%08x\n" , value); +mfsdram (mem_mb0cf, value); +printf (" SDRAM0_B0CR : 0x%08x\n" , value); +mfsdram (mem_mb1cf, value); +printf (" SDRAM0_B1CR : 0x%08x\n" , value); +mfsdram (mem_sdtr1, value); +printf (" SDRAM0_TR : 0x%08x\n" , value);
board/netstal/common/fixed_sdram.c line 51
Quoted 10 lines
board/netstal/common/fixed_sdram.c new file +10
-0+mfsdram (mem_rtr, value); + printf (" SDRAM0_RTR : 0x%08x\n", value); +} +#endif + +long int fixed_hcu4_sdram (unsigned int dram_size) +{ +#ifdef DEBUG +printf (__FUNCTION__); +#endif
debug(__FUNCTION__);
board/netstal/common/fixed_sdram.c line 54
Quoted 3 lines
board/netstal/common/fixed_sdram.c new file +3
-0+/* disable memory controller */ +mtdcr (memcfga, mem_mcopt1); +mtdcr (memcfgd,0x00000000 );
mtsdram(mem_mcopt1, 0x00000000);
board/netstal/common/fixed_sdram.c line 60
Quoted 5 lines
board/netstal/common/fixed_sdram.c new file +5
-0+udelay (500 ); + +/* Clear SDRAM0_BESR0 (Bus Error Syndrome Register) */ +mtdcr (memcfga, mem_besra); +mtdcr (memcfgd,0xffffffff );
Please use the mtsdram/mfsdram everywhere in this file.
Quoted 13 lines
board/netstal/common/fixed_sdram.c new file +13
-0+/* Clear SDRAM0_BESR1 (Bus Error Syndrome Register) */ +mtdcr (memcfga, mem_besrb); +mtdcr (memcfgd,0xffffffff ); + +/* Clear SDRAM0_ECCCFG (disable ECC) */ +mtdcr (memcfga, mem_ecccf); +mtdcr (memcfgd,0x00000000 ); + +/* Clear SDRAM0_ECCESR (ECC Error Syndrome Register) */ +mtdcr (memcfga, mem_eccerr); +mtdcr (memcfgd,0xffffffff ); + +/* Timing register: CASL=2, PTA=2, CTP=2, LDF=1, RFTA=5, RCD=2
board/netstal/common/fixed_sdram.c line 84
Quoted 10 lines
board/netstal/common/fixed_sdram.c new file +10
-0+*/ +mtdcr (memcfga, mem_sdtr1); +mtdcr (memcfgd,0x008a4015 ); + +/* Memory Bank 0 Config == BA=0x00000000, SZ=64M, AM=3, BE=1 +*/ +mtdcr (memcfga, mem_mb0cf); +if (dram_size ==32 *1024 *1024 ) {mtdcr (memcfgd,0x00062001 ); } +if (dram_size ==64 *1024 *1024 ) {mtdcr (memcfgd,0x00084001 ); } +if (dram_size ==128 *1024 *1024 ) {mtdcr (memcfgd,0x000A4001 ); }
Multiple problems in this one. Why not:
switch (dram_size >> 20) {
case 32:
mtsdram(mem_mb0cf, 0x00062001);
break;
case 64:
mtsdram(mem_mb0cf, 0x00084001);
break;
case 128:
mtsdram(mem_mb0cf, 0x000A4001);
break;
default:
printf("Some error here...\n");
}board/netstal/common/fixed_sdram.c line 90
Quoted 5 lines
board/netstal/common/fixed_sdram.c new file +5
-0+/* refresh timer = 0x400 */ +mtdcr (memcfga, mem_rtr); +if (dram_size ==32 *1024 *1024 ) {mtdcr (memcfgd,0x07F00000 ); } +if (dram_size ==64 *1024 *1024 ) {mtdcr (memcfgd,0x04100000 ); } +if (dram_size ==128 *1024 *1024 ) {mtdcr (memcfgd,0x04100000 ); }
Again.
Quoted 83 lines
board/netstal/common/fixed_sdram.c new file +16
-0+/* Power management idle timer set to the default. */ +mtdcr (memcfga, mem_pmit); +mtdcr (memcfgd,0x07c00000 ); + +udelay (500 ); + +/* Enable banks (DCE=1, BPRF=1, ECCDD=1, EMDUL=1) TODO */ +mtdcr (memcfga, mem_mcopt1); +mtdcr (memcfgd,0x90800000 ); + +#ifdef DEBUG +printf ("%s: done\n" , __FUNCTION__); +#endif +return dram_size; +} +board/netstal/common/nm.h new file +40
-0@@ -0,0 +1,40 @@ +/* +*(C) Copyright 2005-2007 Netstal Maschinen AG +* Niklaus Giger (Niklaus.Giger at netstal.com) +* +* This source code is free software; you can redistribute it +* and/or modify it in source code form under the terms of the GNU +* General Public License as published by the Free Software +* Foundation; either version 2 of the License, or (at your option) +* any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA +*/ + +extern void hcu_led_set (u32 value); +extern u32 get_serial_number (void ); +extern u32 hcu_get_slot (void ); +extern int board_with_pci (void ); +extern void nm_show_print (int generation,int index,int hw_capabilities); +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_HCU3 =0x10 , +HW_GENERATION_HCU4 =0x20 , +HW_GENERATION_HCU5 =0x30 , +HW_GENERATION_MCU =0x08 , +HW_GENERATION_MCU20 =0x0a , +HW_GENERATION_MCU25 =0x09 , +}; + +board/netstal/common/nm_bsp.c +3
-4@@ -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 @@ -20,22 +20,121 @@#include <common.h> #include <command.h> +#include <net.h> +#include "nm.h" -#ifdef CONFIG_CMD_BSP -/* -* Command nm_bsp: Netstal Maschinen BSP specific command
board/netstal/common/nm_bsp.c line 33
Quoted 10 lines
board/netstal/common/nm_bsp.c +8
-2-*/ -int nm_bsp (cmd_tbl_t *cmdtp,int flag,int argc,char *argv[]) +DECLARE_GLOBAL_DATA_PTR ; + +#define DEFAULT_ETH_ADDR "ethaddr" + +typedef struct {u8 id;char *name;}generation_info ; + +generation_info generations[7 ] = +{
generation_info generations[7] = {
board/netstal/common/nm_bsp.c line 46
Quoted 13 lines
board/netstal/common/nm_bsp.c +13
-0+ {HW_GENERATION_HCU2, "HCU2"}, + {HW_GENERATION_HCU3, "HCU3"}, + {HW_GENERATION_HCU4, "HCU4"}, + {HW_GENERATION_HCU5, "HCU5"}, + {HW_GENERATION_MCU, "MCU"}, + {HW_GENERATION_MCU20, "MCU20"}, + {HW_GENERATION_MCU25, "MCU25"}, +}; + +void nm_show_print (int generation,int index,int hw_capabilities) +{ +int j; +char *generationName=0 ;
char *generationName = 0;
board/netstal/common/nm_bsp.c line 51
Quoted 5 lines
board/netstal/common/nm_bsp.c +5
-0+ +/* reset ANSI terminal color mode */ +printf ("\x1B""[0m""Netstal Maschinen AG: " ); +for (j=0 ; j < (sizeof (generations)/sizeof (generations[0 ])); j++) + {
for (j=0; j < (sizeof(generations)/sizeof(generations[0])); j++) {or even:
for (j=0; j < ARRAY_SIZE(generations); j++) {board/netstal/common/nm_bsp.c line 53
Quoted 2 lines
board/netstal/common/nm_bsp.c +2
-0+if (generations[j].id == generation) + {
if (generations[j].id == generation) {Please fix and re-submit.
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
=====================================================================
Stefan Roese
AppliedPATCH 1/1 ppc_4xx resubmit: netstal/common define routines used by all boards
In reply to Niklaus GigerQuoted 10 lines · Niklaus Giger
Added some routines used by all Netstal boards:
-nm_bsp.c: -nm_show_printand
-common_misc_init_r
-set_params_for_sw_install. Bery specific code to handle our SW installation procedure
-fixed_sdram.c: Common routines for HCU4 (and upcoming) MCU25 boards to handle sdram initialization.
-nm.h: Common headerSigned-off-by Niklaus Giger <[email protected]>
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
=====================================================================
Stefan Roese
AppliedPATCH 1/1 ppc_4xx resubmit: Netstal HCU5 board: added various fixes and POST
In reply to Niklaus GigerQuoted 7 lines · Niklaus Giger
- Moved some common code to
nestal/common/nm_bsp.c.
- Added support for the vxWorks EDR.
- Enable trace for Lauterbach, if present.
- Added support for POST.
- Stylistic cleanups (multi-line comments/ enforce 80 colomn width)Signed-off-by Niklaus Giger <[email protected]>
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
=====================================================================