[U-Boot] [PATCH 2/4] apf27: add support for the armadeus APF27 board

2012-10-29 Thread Philippe Reynes
Signed-off-by: Philippe Reynes 
Signed-off-by: Eric Jarrige 
Signed-off-by: Nicolas Colombain 

 create mode 100644 board/armadeus/apf27/Makefile
 create mode 100644 board/armadeus/apf27/apf27.c
 create mode 100644 board/armadeus/apf27/apf27.h
 create mode 100644 include/configs/apf27.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 1b2da94..297467a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1011,6 +1011,11 @@ Nobuhiro Iwamatsu 
 
armadillo-800evaR8A7740 (RMOBILE SoC)
 
+Eric Jarrige 
+Philippe Reynes 
+
+   apf27   ARM926EJS (imx27 SoC)
+
 -
 
 Unknown / orphaned boards:
diff --git a/board/armadeus/apf27/Makefile b/board/armadeus/apf27/Makefile
new file mode 100644
index 000..1da9548
--- /dev/null
+++ b/board/armadeus/apf27/Makefile
@@ -0,0 +1,45 @@
+#
+# (C) Copyright 2000-2004
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+# (C) Copyright 2012
+# Eric Jarrige 
+#
+# 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$(BOARD).o
+
+COBJS  := apf27.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#
+
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/armadeus/apf27/apf27.c b/board/armadeus/apf27/apf27.c
new file mode 100644
index 000..4f2b821
--- /dev/null
+++ b/board/armadeus/apf27/apf27.c
@@ -0,0 +1,408 @@
+/*
+ * Copyright (C) 2007 Sascha Hauer, Pengutronix
+ * Copyright (C) 2008-2012 Eric Jarrige 
+ *
+ * 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 
+#include "crc.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "apf27.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Fuse bank 1 row 8 is "reserved for future use" and therefore available for
+ * custormer use. The APF27 board uses this fuse to store the board revision:
+ * 0: initial board revision
+ * 1: first revision - Presence of the second RAM chip on the board is blown in
+ * fuse bank 1 row 9  bit 0 - No hardware change
+ * N: to be defined
+ */
+u32 get_board_rev(void)
+{
+   struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
+
+   return readl(&iim->bank[1].fuse_regs[8]);
+}
+
+/*
+ * Fuse bank 1 row 9 is "reserved for future use" and therefore available for
+ * custormer use. The APF27 board revision 1 uses the bit 0 to permanently 
store
+ * the presence of the second RAM chip
+ * 0: AFP27 with 1 RAM of 64 MiB
+ * 1: AFP27 with 2 RAM chips of 64 MiB each (128MB)
+ */
+int get_num_ram_bank(void)
+{
+   struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
+   int nr_dram_banks = 1;
+
+   if ((get_board_rev() > 0) && (CONFIG_NR_DRAM_BANKS > 1))
+   nr_dram_banks += readl(&iim->bank[1].fuse_regs[9]) & 0x01;
+   else
+   nr_dram_banks = CONFIG_NR_DRAM_POPULATED;
+
+   return nr_dram_banks;
+}
+
+static void apf27_gpio_init(void)
+{
+   struct gpio_port_regs *regs = (struct gpio_port_regs *)IMX_GPIO_BASE;
+
+   /* PORT A */
+   writel(ACFG_DR_A_VAL,®s->port[PORTA].gpio_dr);
+   writel(ACFG_OCR1_A_VAL,  ®s->port[PORTA].ocr1);
+   writel(ACFG_OCR2_A_VAL,  ®s->port[PORTA].ocr2);
+   wri

Re: [U-Boot] [PATCH 2/4] apf27: add support for the armadeus APF27 board

2012-11-26 Thread Albert ARIBAUD
Hi Philippe,

On Mon, 29 Oct 2012 18:35:55 +0100, Philippe Reynes 
wrote:

> Signed-off-by: Philippe Reynes 
> Signed-off-by: Eric Jarrige 
> Signed-off-by: Nicolas Colombain 
> 
>  create mode 100644 board/armadeus/apf27/Makefile
>  create mode 100644 board/armadeus/apf27/apf27.c
>  create mode 100644 board/armadeus/apf27/apf27.h
>  create mode 100644 include/configs/apf27.h

This patch alone barely supports APF27, since the resulting U-Boot
cannot be flashed on the board and booted cold; for this it needs the
SPL from patch 3/4. Please merge 2/4 and 3/4.

> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1b2da94..297467a 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1011,6 +1011,11 @@ Nobuhiro Iwamatsu 
>  
>   armadillo-800evaR8A7740 (RMOBILE SoC)
>  
> +Eric Jarrige 
> +Philippe Reynes 
> +
> + apf27   ARM926EJS (imx27 SoC)
> +
>  -
>  
>  Unknown / orphaned boards:

Please sort MAINTAINERS by maintainer name as stated in the file
heading.

> diff --git a/board/armadeus/apf27/Makefile b/board/armadeus/apf27/Makefile
> new file mode 100644
> index 000..1da9548
> --- /dev/null
> +++ b/board/armadeus/apf27/Makefile
> @@ -0,0 +1,45 @@
> +#
> +# (C) Copyright 2000-2004
> +# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
> +# (C) Copyright 2012
> +# Eric Jarrige 
> +#
> +# 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$(BOARD).o
> +
> +COBJS:= apf27.o
> +
> +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
> +OBJS := $(addprefix $(obj),$(COBJS))
> +SOBJS:= $(addprefix $(obj),$(SOBJS))
> +
> +$(LIB):  $(obj).depend $(OBJS) $(SOBJS)
> + $(call cmd_link_o_target, $(OBJS) $(SOBJS))
> +
> +#
> +
> +include $(SRCTREE)/rules.mk
> +
> +sinclude $(obj).depend
> +
> +#
> diff --git a/board/armadeus/apf27/apf27.c b/board/armadeus/apf27/apf27.c
> new file mode 100644
> index 000..4f2b821
> --- /dev/null
> +++ b/board/armadeus/apf27/apf27.c
> @@ -0,0 +1,408 @@
> +/*
> + * Copyright (C) 2007 Sascha Hauer, Pengutronix
> + * Copyright (C) 2008-2012 Eric Jarrige 
> + *
> + * 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 
> +#include "crc.h"
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include "apf27.h"
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +/*
> + * Fuse bank 1 row 8 is "reserved for future use" and therefore available for
> + * custormer use. The APF27 board uses this fuse to store the board revision:
> + * 0: initial board revision
> + * 1: first revision - Presence of the second RAM chip on the board is blown 
> in
> + * fuse bank 1 row 9  bit 0 - No hardware change
> + * N: to be defined

(aside: I am somewhat surprised that something "reserved for future
use" can be considered "available for customer use": reserved areas
are... reserved... thus probably not available -- future revisions of
the *IC* may actually exercize the reservation, causing a conflict
with the *board* assumptions. But hey, that's not a U-boot issue)

> + */
> +u32 get_board_rev(void)
> +{
> + struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
> +
> + return readl(&iim->bank[1].fuse_regs[8]);
> +}
> +
> +/*
> + * Fuse bank 1 row 9 is "reserved for future use" a

Re: [U-Boot] [PATCH 2/4] apf27: add support for the armadeus APF27 board

2012-12-02 Thread trem

On 26/11/12 18:55, Albert ARIBAUD wrote:

+/*
+ * Fuse bank 1 row 8 is "reserved for future use" and therefore available for
+ * custormer use. The APF27 board uses this fuse to store the board revision:
+ * 0: initial board revision
+ * 1: first revision - Presence of the second RAM chip on the board is blown in
+ * fuse bank 1 row 9  bit 0 - No hardware change
+ * N: to be defined


(aside: I am somewhat surprised that something "reserved for future
use" can be considered "available for customer use": reserved areas
are... reserved... thus probably not available -- future revisions of
the *IC* may actually exercize the reservation, causing a conflict
with the *board* assumptions. But hey, that's not a U-boot issue)


This is a reference to the freescale documentation.
It means that customer (here Armadeus) can use it to store
informations.

...
 

+int
+misc_init_r(void)
+{
+   char *s;
+   u_char * firmware_buffer = (u_char *)(CONFIG_SYS_LOAD_ADDR + \
+ CONFIG_SYS_MONITOR_LEN);
+   size_t size = 0;
+   size_t offset   = -1;
+   char *autoload = getenv("firmware_autoload");


Is this used?


Yes, this function can be used if it's enable in the u-boot environment.

...


+{
+   /* Enable D-cache. I-cache is already enabled in start.S */
+   dcache_enable();
+}
+
+inline void lowlevel_init(void) {}


What's the point of defining lowlevel_init? If you don't do low level
inits, then you can define CONFIG_SKIP_LOWLEVEL_INIT in the board
config header file.


In fact lowlevel_init isn't only the call of a function, this is also
some "low level" init (like cache). I need this low level init, but
I don't need to call a function, so I only define an empty function.

...


regards,
Philippe

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