Skip to contentSkip to conversation

ppc_4xx: Add MCU25 board specific failes

PATCH New Niklaus Giger 2 participants 2 messages Jan 21, 2008 – Jan 29, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 3/3 ppc_4xx: Add MCU25 board specific failes

Add PPC405GPr based MCU25 board from Netstal.

---
 board/netstal/mcu25/Makefile   |   60 +++++++++++
 board/netstal/mcu25/README.txt |   60 +++++++++++
 board/netstal/mcu25/config.mk  |   29 ++++++
 board/netstal/mcu25/mcu25.c    |  212 ++++++++++++++++++++++++++++++++++++++++
 board/netstal/mcu25/u-boot.lds |  141 ++++++++++++++++++++++++++
 5 files changed, 502 insertions(+), 0 deletions(-)
 create mode 100644 board/netstal/mcu25/Makefile
 create mode 100644 board/netstal/mcu25/README.txt
 create mode 100644 board/netstal/mcu25/config.mk
 create mode 100644 board/netstal/mcu25/mcu25.c
 create mode 100644 board/netstal/mcu25/u-boot.lds
board/netstal/mcu25/Makefile new file +60 -0
new file mode 100644
index 0000000..f367f34
@@ -0,0 +1,60 @@
+#
+# (C) Copyright 2008 Netstal Maschinen AG
+# Niklaus Giger (ng at netstal.com)
+#
+# This program is free software; you can redistribute it and/or
+# modify it 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 $(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	= fixed_sdram.o hcu_flash.o nm_bsp.o
+COBJS	= $(BOARD).o
+SOBJS	=
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) ../common/$(NOBJS:.o=.c)
+COBJS	= $(BOARD).o
+SOBJS	=
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) ../common/$(NOBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS))
+NOBJS	:= $(addprefix $(obj),$(NOBJS))
+SOBJS	:= $(addprefix $(obj),$(SOBJS))
+
+$(LIB):	$(OBJS) $(SOBJS) $(NOBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS) $(SOBJS) $(NOBJS)
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
+
board/netstal/mcu25/README.txt new file +60 -0

60 lines not on this page · raw message

board/netstal/mcu25/config.mk new file +29 -0
new file mode 100644
index 0000000..12f61e7
@@ -0,0 +1,29 @@
+#
+# (C) Copyright 2005 Netstal Maschinen AG
+#     Niklaus Giger (ng at netstal.com)
+# This program is free software; you can redistribute it and/or
+# modify it 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
+#
+
+#
+# Netstal Maschinen AG: MCU25 board
+#
+
+TEXT_BASE = 0xFFFB0000
+
+ifeq ($(debug),1)
+PLATFORM_CPPFLAGS += -DDEBUG -g
+endif
+
board/netstal/mcu25/mcu25.c new file +212 -0

212 lines not on this page · raw message

board/netstal/mcu25/u-boot.lds new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
1.5.2.5
#1 lore raw

PATCH 3/3 ppc_4xx: Add MCU25 board specific failes

Hi Niklaus,

Quoted 47 lines · Niklaus Giger

Add PPC405GPr based MCU25 board from Netstal.

---
 board/netstal/mcu25/Makefile   |   60 +++++++++++
 board/netstal/mcu25/README.txt |   60 +++++++++++
 board/netstal/mcu25/config.mk  |   29 ++++++
 board/netstal/mcu25/mcu25.c    |  212
++++++++++++++++++++++++++++++++++++++++ board/netstal/mcu25/u-boot.lds | 
141 ++++++++++++++++++++++++++
 5 files changed, 502 insertions(+), 0 deletions(-)
 create mode 100644 board/netstal/mcu25/Makefile
 create mode 100644 board/netstal/mcu25/README.txt
 create mode 100644 board/netstal/mcu25/config.mk
 create mode 100644 board/netstal/mcu25/mcu25.c
 create mode 100644 board/netstal/mcu25/u-boot.lds
board/netstal/mcu25/Makefile new file +24 -0
new file mode 100644
index 0000000..f367f34
@@ -0,0 +1,60 @@
+#
+# (C) Copyright 2008 Netstal Maschinen AG
+# Niklaus Giger (ng at netstal.com)
+#
+# This program is free software; you can redistribute it and/or
+# modify it 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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(BOARD).a
+

board/netstal/mcu25/Makefile line 34

Quoted 10 lines
board/netstal/mcu25/Makefile new file +10 -0
+vpath fixed_sdram.c ../common
+vpath hcu_flash.c ../common
+vpath nm_bsp.c ../common
+
+# NOBJS : Netstal common objects
+NOBJS	= fixed_sdram.o hcu_flash.o nm_bsp.o
+COBJS	= $(BOARD).o
+SOBJS	=
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c) ../common/$(NOBJS:.o=.c)

This patch introduces the same compilation problems as known from the HCU4/5 boards:

[stefan at ubuntu u-boot-ppc4xx (for-1.3.2)]$ ./MAKEALL mcu25 Configuring for mcu25 board...
ppc_4xx-gcc: hcu_flash.c: No such file or directory
ppc_4xx-gcc: no input files
ppc_4xx-gcc: nm_bsp.c: No such file or directory
ppc_4xx-gcc: no input files

Please fix.

<snip>

Quoted 31 lines
board/netstal/mcu25/Makefile new file +19 -0
+++ b/board/netstal/mcu25/mcu25.c
@@ -0,0 +1,212 @@
+/*
+ *(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 + */

board/netstal/mcu25/Makefile new file +10 -0
+
+#include ?<common.h>
+#include ?<ppc4xx.h>
+#include ?<asm/processor.h>
+#include ?<asm/io.h>
+#include ?<asm-ppc/u-boot.h>
+#include ?"../common/nm.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+

board/netstal/mcu25/Makefile

Quoted 10 lines
board/netstal/mcu25/Makefile new file +10 -0
+#define MCU25_SLOT_ADDRESS?????????????(0x7A000000 + 0x0A)
+#define MCU25_DIGITAL_IO_REGISTER??????(0x7A000000 + 0xc0)
+
+#define MCU25_LED_REGISTER_ADDRESS?????(0x7C000000 + 0x10)
+#define MCU25_VERSIONS_REGISTER????????(0x7C000000 + 0x0C)
+#define MCU25_IO_CONFIGURATION?????????(0x7C000000 + 0x0e)
+#define MCU_SW_INSTALL_REQUESTED???????0x08
+#define HW_GENERATION_MCU25????????????0x09
+
+#define SDRAM_LEN 32*1024*1024 /* 32 MB -RAM */

I suggest to always use parentheses around such defines:

How about this version:

#define SDRAM_LEN (32 << 20) /* 32 MB - RAM */

Quoted 4 lines
board/netstal/mcu25/Makefile new file +4 -0
+
+#undef DEBUG
+/*
+ * This function is run very early, out of flash, and before devices are

board/netstal/mcu25/Makefile

Quoted 10 lines
board/netstal/mcu25/Makefile new file +10 -0
+ * initialized. It is called by lib_ppc/board.c:board_init_f by virtue
+ * of being in the init_sequence array.
+ *
+ * The SDRAM has been initialized already -- start.S:start called
+ * init.S:init_sdram early on -- but it is not yet being used for
+ * anything, not even stack. So be careful.
+ */
+
+#define CPC0_CR0 ? ? ? ?0xb1???/* Chip control register 0 */
+#define CPC0_CR1 ? ? ? ?0xb2???/* Chip control register 1 */

Those should be defined in include/ppc405.h

board/netstal/mcu25/Makefile

Quoted 8 lines

+/* Attention: If you want 1 microsecs times from the external oscillator
+ * 0x00004051 is okay for u-boot/linux, but different from old vxworks values + * 0x00804051 causes problems with u-boot and linux!
+ */

board/netstal/mcu25/Makefile new file +4 -0
+#define CPC0_CR0_VALUE?0x0007F03C
+#define CPC0_CR1_VALUE?0x00004051
+#define CPC0_ECR???????0xaa????/* Edge condition register */
+#define EBC0_CFG???????0x23????/* External Peripheral Control Register */

This is already defined:

include/ppc405.h:#define EBC0_CFG 0x23 /* external bus configuration reg */

Could be that this definition is restricted for another PPC405 version. Please clean this up and use the general define.

Quoted 17 lines
board/netstal/mcu25/Makefile new file +13 -0
+#define CPC0_EIRR??????0xb6????/* External Interrupt Register */
+
+#if defined(DEBUG)
+void show_sdram_registers(void);
+#endif
+long int fixed_hcu4_sdram (unsigned int dram_size);
+
+int board_early_init_f (void)
+{
+???????/* Documented in A-1171
+??????? *
+??????? * Interrupt controller setup for the MCU25 board.
+??????? * Note: IRQ 0-15 ?405GP internally generated; high; level

sensitive +??????? * ? ? ? IRQ 16 ? ?405GP internally generated; low; level sensitive +??????? * ? ? ?IRQ 17-24 RESERVED/UNUSED
+??????? * ? ? ?IRQ 31 (EXT IRQ 6) (unused)
+??????? */

Quoted 8 lines

+???????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);

You are mixing different conding styles here:

	funcabc();

and

	funcabc ();

Please only use one style in a file. My preference is the Linux version without the space.

Quoted 6 lines

+???????mtdcr(CPC0_ECR, ?0x60606000);
+???????mtdcr(CPC0_EIRR, 0x7C000000);
+???????out32(GPIO0_OR,?????????CFG_GPIO0_OR );
+ ? ? ? out32(GPIO0_TCR,????????CFG_GPIO0_TCR);
+ ? ? ? out32(GPIO0_ODR,????????CFG_GPIO0_ODR);
+???????mtspr(ccr0, ? ? ?0x00700000);

Alignment doesn't look good to me.

Quoted 5 lines
board/netstal/mcu25/Makefile new file +5 -0
+
+???????return 0;
+}
+
+#ifdef CONFIG_BOARD_PRE_INIT

board/netstal/mcu25/Makefile

Quoted 10 lines
board/netstal/mcu25/Makefile new file +10 -0
+int board_pre_init (void)
+{
+???????return board_early_init_f ();
+}
+#endif
+
+int sys_install_requested(void)
+{
+???????u16 *ioValuePtr = (u16 *)MCU25_DIGITAL_IO_REGISTER;
+???????return (*ioValuePtr & MCU_SW_INSTALL_REQUESTED) != 0;

Use in_be16() here.

board/netstal/mcu25/Makefile

Quoted 8 lines
board/netstal/mcu25/Makefile new file +8 -0
+}
+
+int checkboard (void)
+{
+???????u16 *boardVersReg = (u16 *) MCU25_VERSIONS_REGISTER;
+???????u16 *hwConfig ?= (u16 *) MCU25_IO_CONFIGURATION;
+???????u16 generation = *boardVersReg & 0x0f;
+???????u16 index ? ? ?= *boardVersReg & 0xf0;

Empty line missing here.

And please use the correct accessor functions: in_be16().

Quoted 5 lines

+???????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. */

Wrong multi-line comment style.

Quoted 1 line

+???????writeb (readb (0xef600404) | 0x03, 0xef600404);

in_8() and out_8() please.

board/netstal/mcu25/Makefile

Quoted 8 lines

+???????/* reset ANSI terminal color mode */ +???????nm_show_print(generation, index, *hwConfig); +???????return 0;

board/netstal/mcu25/Makefile new file +5 -0
+}
+
+u32 hcu_led_get(void)
+{
+???????return (*(u16 *)MCU25_LED_REGISTER_ADDRESS)& 0x3ff;

in_be16()

board/netstal/mcu25/Makefile

Quoted 8 lines
board/netstal/mcu25/Makefile new file +8 -0
+}
+
+/*
+ * hcu_led_set ?value to be placed into the LEDs (max 6 bit)
+ */
+void hcu_led_set(u32 value)
+{
+ ? *(u16 *)MCU25_LED_REGISTER_ADDRESS = value;

in_be16()

Quoted 8 lines
board/netstal/mcu25/Makefile new file +8 -0
+}
+
+/*
+ * sdram_init - Dummy implementation for start.S, spd_sdram ?or initdram
+ *?????????????used for HCUx
+ */
+void sdram_init(void)
+{

board/netstal/mcu25/Makefile

Quoted 10 lines
board/netstal/mcu25/Makefile new file +10 -0
+???????return;
+}
+
+/*
+ * hcu_get_slot
+ */
+u32 hcu_get_slot(void)
+{
+???????u16 *slot = (u16 *)MCU25_SLOT_ADDRESS;
+???????return (*slot) & 0x7f;

in_be16()

Quoted 20 lines
board/netstal/mcu25/Makefile new file +20 -0
+}
+
+/*
+ * get_serial_number
+ */
+u32 get_serial_number(void)
+{
+???????u32 *serial = (u32 *)CFG_FLASH_BASE;
+
+???????if (*serial == 0xffffffff)
+???????????????return 0;
+
+???????return *serial;
+}
+
+
+/*
+ * misc_init_r.
+ */
+

board/netstal/mcu25/Makefile

Quoted 10 lines
board/netstal/mcu25/Makefile new file +10 -0
+int misc_init_r(void)
+{
+???????common_misc_init_r();
+???????set_params_for_sw_install( sys_install_requested(), "mcu25" );
+???????return 0;
+}
+
+long int initdram(int board_type)
+{
+???????long int dram_size = 64*1024*1024;

So here is different dram_size than defined above? Why the define then?

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 at denx.de
=====================================================================