Re: [U-Boot] [PATCH 1/3] arm: Add support for MB86R0x SoCs

2010-05-04 Thread Wolfgang Denk
Dear =?ISO-8859-1?Q?Matthias_Wei=DFer?=,

In message 4bd538d8.2040...@arcor.de you wrote:

   C struct, please.
...
   Ditto.
...
   Ditto.
 
 Well, the above three modules are used in assembler code only 
 (lowlevel_init.S) and I didn't found a way to use C structs here. What 
 would be the right approach in this case? Defining all these registers
 as absolute addresses?

Mode these definitions (and only these) to a separate asm-offsets.h
header file, please.

Or, if you have the time, adapt the Linux code to auto-generate
asm-offsets.h from normal header files.

 I have a also a couple of magic values in the mentioned .S file. Do I 
 have to move them also to some symbolic constants?

Yes, please.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Man is the best computer we can put aboard a spacecraft ...  and  the
only one that can be mass produced with unskilled labor.
 -- Wernher von Braun
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] arm: Add support for MB86R0x SoCs

2010-04-26 Thread Matthias Weißer
Am 22.04.2010 14:34, schrieb Wolfgang Denk:
  Dear Matthias Weisser,
 
  In message1271932257-14618-2-git-send-email-weiss...@arcor.de  you 
wrote:
  This patch adds support for MB86R0x SoCs from Fujitsu
 
  Signed-off-by: Matthias Weisserweiss...@arcor.de
  ...
  --- /dev/null
  +++ b/arch/arm/cpu/arm926ejs/mb86r0x/reset.c
  ...
  +void reset_cpu(ulong ignored)
  +{
  +writel(0x0002, MB86R0x_CRG_PHYS_BASE + CRG_CRSR);
 
  Please define some symbolic name for the magic constant 0x0002
 
  Also, we do not accept code based on a base + offset notation.
  Please use C structures instead. [Please fix globally.]

I will fix this

  +#define TIMER_LOAD_VAL0x
  +#define TIMER_BASEMB86R0x_TIMER_PHYS_BASE
  +
  +#define TIMER_REG_LOAD(TIMER_BASE + 0)
  +#define TIMER_REG_VALUE(TIMER_BASE + 4)
  +#define TIMER_REG_CONTROL(TIMER_BASE + 8)
 
  Create a proper C struct, please!

and this

  +/*
  + * Offset definitions for DRAM controller
  + */
  +#define DDR2C_DRIC0x00
  +#define DDR2C_DRIC10x02
  +#define DDR2C_DRIC20x04
  +#define DDR2C_DRCA0x06
  +#define DDR2C_DRCM0x08
  +#define DDR2C_DRCST10x0a
  +#define DDR2C_DRCST20x0c
  +#define DDR2C_DRCR0x0e
  +#define DDR2C_DRCF0x20
  +#define DDR2C_DRASR0x30
  +#define DDR2C_DRIMS0x50
  +#define DDR2C_DROS0x60
  +#define DDR2C_DRIBSLI0x62
  +#define DDR2C_DRIBSODT10x64
  +#define DDR2C_DRIBSOCD0x66
  +#define DDR2C_DRIBSOCD20x68
  +#define DDR2C_DROABA0x70
  +#define DDR2C_DROBV0x80
  +#define DDR2C_DROBS0x84
  +#define DDR2C_DROBSR10x86
  +#define DDR2C_DROBSR20x88
  +#define DDR2C_DROBSR30x8a
  +#define DDR2C_DROBSR40x8c
  +#define DDR2C_DRIMR10x90
  +#define DDR2C_DRIMR20x92
  +#define DDR2C_DRIMR30x94
  +#define DDR2C_DRIMR40x96
  +#define DDR2C_DROISR10x98
  +#define DDR2C_DROISR20x9a
 
  C struct, please.
 
  +/*
  + * Offset definitions Chip Control Module
  + */
  +#define CCNT_CCID0x00
  +#define CCNT_CSRST0x1c
  +#define CCNT_CIST0x20
  +#define CCNT_CISTM0x24
  +#define CCNT_CMUX_MD0x30
  +#define CCNT_CDCRC0xec
 
  Ditto.
 
  +/*
  + * Offset definitions clock reset generator
  + */
  +#define CRG_CRPR0x00
  +#define CRG_CRWR0x08
  +#define CRG_CRSR0x0c
  +#define CRG_CRDA0x10
  +#define CRG_CRDB0x14
  +#define CRG_CRHA0x18
  +#define CRG_CRPA0x1c
  +#define CRG_CRPB0x20
  +#define CRG_CRHB0x24
  +#define CRG_CRAM0x28
 
  Ditto.

Well, the above three modules are used in assembler code only 
(lowlevel_init.S) and I didn't found a way to use C structs here. What 
would be the right approach in this case? Defining all these registers
as absolute addresses?

I have a also a couple of magic values in the mentioned .S file. Do I 
have to move them also to some symbolic constants?

Thanks for the quick review.

Regards,
Matthias
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/3] arm: Add support for MB86R0x SoCs

2010-04-22 Thread Matthias Weisser
This patch adds support for MB86R0x SoCs from Fujitsu

Signed-off-by: Matthias Weisser weiss...@arcor.de
---
 arch/arm/cpu/arm926ejs/mb86r0x/Makefile  |   47 +++
 arch/arm/cpu/arm926ejs/mb86r0x/reset.c   |   37 ++
 arch/arm/cpu/arm926ejs/mb86r0x/timer.c   |  129 +++
 arch/arm/include/asm/arch-mb86r0x/hardware.h |   31 +
 arch/arm/include/asm/arch-mb86r0x/mb86r0x.h  |  170 ++
 5 files changed, 414 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/cpu/arm926ejs/mb86r0x/Makefile
 create mode 100644 arch/arm/cpu/arm926ejs/mb86r0x/reset.c
 create mode 100644 arch/arm/cpu/arm926ejs/mb86r0x/timer.c
 create mode 100644 arch/arm/include/asm/arch-mb86r0x/hardware.h
 create mode 100644 arch/arm/include/asm/arch-mb86r0x/mb86r0x.h

diff --git a/arch/arm/cpu/arm926ejs/mb86r0x/Makefile 
b/arch/arm/cpu/arm926ejs/mb86r0x/Makefile
new file mode 100644
index 000..360f046
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/mb86r0x/Makefile
@@ -0,0 +1,47 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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$(SOC).a
+
+COBJS  = timer.o reset.o
+SOBJS  =
+
+SRCS   := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS) $(SOBJS))
+START  := $(addprefix $(obj),$(START))
+
+all:   $(obj).depend $(LIB)
+
+$(LIB):$(OBJS)
+   $(AR) $(ARFLAGS) $@ $(OBJS)
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/arch/arm/cpu/arm926ejs/mb86r0x/reset.c 
b/arch/arm/cpu/arm926ejs/mb86r0x/reset.c
new file mode 100644
index 000..6acb5bb
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/mb86r0x/reset.c
@@ -0,0 +1,37 @@
+/*
+ * (C) Copyright 2010
+ * Matthias Weisser weiss...@arcor.de
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 common.h
+#include asm/io.h
+#include asm/arch/hardware.h
+
+/*
+ * Reset the cpu by setting software reset request bit
+ */
+void reset_cpu(ulong ignored)
+{
+   writel(0x0002, MB86R0x_CRG_PHYS_BASE + CRG_CRSR);
+   while (1)
+   /* NOP */;
+   /* Never reached */
+}
diff --git a/arch/arm/cpu/arm926ejs/mb86r0x/timer.c 
b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
new file mode 100644
index 000..640b80e
--- /dev/null
+++ b/arch/arm/cpu/arm926ejs/mb86r0x/timer.c
@@ -0,0 +1,129 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop stelian@leadtechdesign.com
+ * Lead Tech Design www.leadtechdesign.com
+ *
+ * (C) Copyright 2010
+ * Matthias Weisser weiss...@arcor.de
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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