Skip to contentSkip to conversation

Support for Marvell Orion5x SoC and LaCie ED Mini V2 board

PATCH New Albert Aribaud 4 participants 27 messages Nov 14, 2009 – Dec 23, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover Support for Marvell Orion5x SoC and LaCie ED Mini V2 board

This series of patches is the second attempt at introducing support for the Marvell Orion5x SoC and the LaCie ED Mini V2 board. Initial support includes only serial port and Flash. Additional support will be added as Marvell devices (e.g. egiga) are made common to kirkwood and orion5x.

All comments to the first attempt have been taken into account.

The Linux checkpatch.pl script has been run on all three patches. The first patch has six errors and zero warnings, and all errors are false positives triggered by colons in 'asm volatile' statements. The second and third patches have zero errors and zero warnings.

Albert Aribaud (3):
Initial support for Marvell Orion5x SoC Add Orion5x support to 16550 serial device driver Add support for the LaCie ED Mini V2 board

 MAINTAINERS                            |    4 +
 MAKEALL                                |    1 +
 Makefile                               |    3 +
 board/LaCie/edminiv2/Makefile          |   54 +++++
 board/LaCie/edminiv2/config.mk         |   27 +++
 board/LaCie/edminiv2/edminiv2.c        |  134 +++++++++++++
 board/LaCie/edminiv2/edminiv2.h        |   43 ++++
 cpu/arm926ejs/orion5x/Makefile         |   52 +++++
 cpu/arm926ejs/orion5x/cpu.c            |  332 ++++++++++++++++++++++++++++++++
 cpu/arm926ejs/orion5x/dram.c           |   61 ++++++
 cpu/arm926ejs/orion5x/mpp.c            |   89 +++++++++
 cpu/arm926ejs/orion5x/timer.c          |  175 +++++++++++++++++
 drivers/serial/serial.c                |    3 +
 include/asm-arm/arch-orion5x/88f5182.h |   40 ++++
 include/asm-arm/arch-orion5x/cpu.h     |  213 ++++++++++++++++++++
 include/asm-arm/arch-orion5x/gpio.h    |   52 +++++
 include/asm-arm/arch-orion5x/mpp.h     |  122 ++++++++++++
 include/asm-arm/arch-orion5x/orion5x.h |   67 +++++++
 include/configs/edminiv2.h             |  143 ++++++++++++++
 19 files changed, 1615 insertions(+), 0 deletions(-)
 create mode 100644 board/LaCie/edminiv2/Makefile
 create mode 100644 board/LaCie/edminiv2/config.mk
 create mode 100644 board/LaCie/edminiv2/edminiv2.c
 create mode 100644 board/LaCie/edminiv2/edminiv2.h
 create mode 100644 cpu/arm926ejs/orion5x/Makefile
 create mode 100644 cpu/arm926ejs/orion5x/cpu.c
 create mode 100644 cpu/arm926ejs/orion5x/dram.c
 create mode 100644 cpu/arm926ejs/orion5x/mpp.c
 create mode 100644 cpu/arm926ejs/orion5x/timer.c
 create mode 100644 include/asm-arm/arch-orion5x/88f5182.h
 create mode 100644 include/asm-arm/arch-orion5x/cpu.h
 create mode 100644 include/asm-arm/arch-orion5x/gpio.h
 create mode 100644 include/asm-arm/arch-orion5x/mpp.h
 create mode 100644 include/asm-arm/arch-orion5x/orion5x.h
 create mode 100644 include/configs/edminiv2.h
#1 lore raw

PATCH v2 1/3 Initial support for Marvell Orion5x SoC

This patch adds support for the Marvell Orion5x SoC. It has no use alone, and must be followed by a patch to add Orion5x support for serial, then support for the ED Mini V2, an Orion5x-based board from LaCie.

---
 cpu/arm926ejs/orion5x/Makefile         |   52 +++++
 cpu/arm926ejs/orion5x/cpu.c            |  332 ++++++++++++++++++++++++++++++++
 cpu/arm926ejs/orion5x/dram.c           |   61 ++++++
 cpu/arm926ejs/orion5x/mpp.c            |   89 +++++++++
 cpu/arm926ejs/orion5x/timer.c          |  175 +++++++++++++++++
 include/asm-arm/arch-orion5x/88f5182.h |   40 ++++
 include/asm-arm/arch-orion5x/cpu.h     |  213 ++++++++++++++++++++
 include/asm-arm/arch-orion5x/gpio.h    |   52 +++++
 include/asm-arm/arch-orion5x/mpp.h     |  122 ++++++++++++
 include/asm-arm/arch-orion5x/orion5x.h |   67 +++++++
 10 files changed, 1203 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm926ejs/orion5x/Makefile
 create mode 100644 cpu/arm926ejs/orion5x/cpu.c
 create mode 100644 cpu/arm926ejs/orion5x/dram.c
 create mode 100644 cpu/arm926ejs/orion5x/mpp.c
 create mode 100644 cpu/arm926ejs/orion5x/timer.c
 create mode 100644 include/asm-arm/arch-orion5x/88f5182.h
 create mode 100644 include/asm-arm/arch-orion5x/cpu.h
 create mode 100644 include/asm-arm/arch-orion5x/gpio.h
 create mode 100644 include/asm-arm/arch-orion5x/mpp.h
 create mode 100644 include/asm-arm/arch-orion5x/orion5x.h
cpu/arm926ejs/orion5x/Makefile new file +52 -0
new file mode 100644
index 0000000..3343124
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2009 Albert ARIBAUD <[email protected]>
+#
+# Based on original Kirkwood support which is
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <[email protected]>
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+COBJS-y	= cpu.o
+COBJS-y	+= dram.o
+COBJS-y	+= mpp.o
+COBJS-y	+= timer.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS-y))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
cpu/arm926ejs/orion5x/cpu.c new file +332 -0

332 lines not on this page · raw message

cpu/arm926ejs/orion5x/dram.c new file +61 -0

61 lines not on this page · raw message

cpu/arm926ejs/orion5x/mpp.c new file +89 -0

89 lines not on this page · raw message

cpu/arm926ejs/orion5x/timer.c new file +175 -0

175 lines not on this page · raw message

include/asm-arm/arch-orion5x/88f5182.h new file +40 -0
new file mode 100644
index 0000000..b16b23f
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2009 Albert ARIBAUD <[email protected]>
+ *
+ * Based on original Kirkwood 88F6182 support which is
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <[email protected]>
+ *
+ * Header file for Feroceon CPU core 88F5182 SOC.
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#ifndef _CONFIG_88F5182_H
+#define _CONFIG_88F5182_H
+
+/* SOC specific definations */
+#define F88F5182_REGS_PHYS_BASE		0xf1000000
+#define ORION5X_REGS_PHY_BASE		F88F5182_REGS_PHYS_BASE
+
+/* TCLK Core Clock defination */
+#define CONFIG_SYS_TCLK			166000000 /* 166MHz */
+
+#endif /* _CONFIG_88F5182_H */
include/asm-arm/arch-orion5x/cpu.h new file +213 -0

213 lines not on this page · raw message

include/asm-arm/arch-orion5x/gpio.h new file +52 -0

52 lines not on this page · raw message

include/asm-arm/arch-orion5x/mpp.h new file +122 -0

122 lines not on this page · raw message

include/asm-arm/arch-orion5x/orion5x.h new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
1.6.4.4
#2 lore raw

PATCH v2 2/3 Add Orion5x support to 16550 serial device driver

This patch provides access to the 16550-compatible serial device of the Orion5x SoC.

---
 drivers/serial/serial.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/serial/serial.c +3 -0
index dd5f332..18686a2 100644
@@ -30,6 +30,9 @@
 #ifdef CONFIG_KIRKWOOD
 #include <asm/arch/kirkwood.h>
 #endif
+#ifdef CONFIG_ORION5X
+#include <asm/arch/orion5x.h>
+#endif
 
 #if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
Signature · 1 line
1.6.4.4
#3 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

This board is based on the Marvell Orion5x SoC.
Current support is limited to console and Flash.
Flash support uses LEGACY as the Macronix 29LV400
used on ED Mini V2 is not 100% CFI compliant.

---
 MAINTAINERS                     |    4 +
 MAKEALL                         |    1 +
 Makefile                        |    3 +
 board/LaCie/edminiv2/Makefile   |   54 +++++++++++++++
 board/LaCie/edminiv2/config.mk  |   27 +++++++
 board/LaCie/edminiv2/edminiv2.c |  134 ++++++++++++++++++++++++++++++++++++
 board/LaCie/edminiv2/edminiv2.h |   43 ++++++++++++
 include/configs/edminiv2.h      |  143 +++++++++++++++++++++++++++++++++++++++
 8 files changed, 409 insertions(+), 0 deletions(-)
 create mode 100644 board/LaCie/edminiv2/Makefile
 create mode 100644 board/LaCie/edminiv2/config.mk
 create mode 100644 board/LaCie/edminiv2/edminiv2.c
 create mode 100644 board/LaCie/edminiv2/edminiv2.h
 create mode 100644 include/configs/edminiv2.h
MAINTAINERS +4 -0
index d70a9d2..93e57f5 100644
@@ -512,6 +512,10 @@ Unknown / orphaned boards:
 #	Board		CPU						#
 #########################################################################
 
+Albert ARIBAUD <[email protected]>
+
+	edminiv2	ARM926EJS (Orion5x SoC)
+
 Rowel Atienza <[email protected]>
 
 	armadillo	ARM720T
MAKEALL +1 -0
index d63c5c2..f7b2a24 100755
@@ -548,6 +548,7 @@ LIST_ARM9="			\
 	cp926ejs		\
 	cp946es			\
 	cp966			\
+	edminiv2		\
 	imx27lite		\
 	lpd7a400		\
 	mv88f6281gtw_ge		\
Makefile +3 -0
index bcb3fe9..83b35b5 100644
@@ -2951,6 +2951,9 @@ davinci_dm365evm_config :	unconfig
 davinci_dm6467evm_config :	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs dm6467evm davinci davinci
 
+edminiv2_config: unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm926ejs $(@:_config=) LaCie orion5x
+
 imx27lite_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
 
board/LaCie/edminiv2/Makefile new file +54 -0

54 lines not on this page · raw message

board/LaCie/edminiv2/config.mk new file +27 -0
new file mode 100644
index 0000000..9c725d3
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2009 Albert ARIBAUD <[email protected]>
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <[email protected]>
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+
+TEXT_BASE = 0x00100000
board/LaCie/edminiv2/edminiv2.c new file +134 -0

134 lines not on this page · raw message

board/LaCie/edminiv2/edminiv2.h new file +43 -0

43 lines not on this page · raw message

include/configs/edminiv2.h new file +143 -0

143 lines not on this page · raw message

Signature · 1 line
1.6.4.4
#4 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

Quoted 39 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert Aribaud
Sent: Sunday, November 15, 2009 4:33 AM
To: U-Boot at lists.denx.de
Subject: [U-Boot] [PATCH V2 3/3] Add support for the LaCie ED Mini V2 board

This board is based on the Marvell Orion5x SoC.
Current support is limited to console and Flash.
Flash support uses LEGACY as the Macronix 29LV400
used on ED Mini V2 is not 100% CFI compliant.

---
 MAINTAINERS                     |    4 +
 MAKEALL                         |    1 +
 Makefile                        |    3 +
 board/LaCie/edminiv2/Makefile   |   54 +++++++++++++++
 board/LaCie/edminiv2/config.mk  |   27 +++++++
 board/LaCie/edminiv2/edminiv2.c |  134 
++++++++++++++++++++++++++++++++++++
 board/LaCie/edminiv2/edminiv2.h |   43 ++++++++++++
 include/configs/edminiv2.h      |  143 
+++++++++++++++++++++++++++++++++++++++
 8 files changed, 409 insertions(+), 0 deletions(-)
 create mode 100644 board/LaCie/edminiv2/Makefile
 create mode 100644 board/LaCie/edminiv2/config.mk
 create mode 100644 board/LaCie/edminiv2/edminiv2.c
 create mode 100644 board/LaCie/edminiv2/edminiv2.h
 create mode 100644 include/configs/edminiv2.h
MAINTAINERS +0 -0
index d70a9d2..93e57f5 100644

MAINTAINERS Unknown / orphaned boards: · line 521

Quoted 10 lines
MAINTAINERS +4 -0
@@ -512,6 +512,10 @@ Unknown / orphaned boards:
 #	Board		CPU					
 	#
 
 ##############################################################
 ###########
 
+Albert ARIBAUD <[email protected]>
+
+	edminiv2	ARM926EJS (Orion5x SoC)
+

That's good if you can move this entry above Albin Tonnerre's entry

...snip...

MAINTAINERS

Quoted 3 lines
MAINTAINERS +3 -0
+		MPP17_GPIO,
+		MPP18_GPIO,
+		MPP19_GPIO,

Why not configured rest 6 gpios ?

...snip...

MAINTAINERS

Quoted 13 lines
MAINTAINERS +13 -0
+
+/*
+ * GPIOs for LaCie ED Mini:
+ * GPIO3 is input (RTC interrupt)
+ * GPIO16 is Power LED control (0 = on, 1 = off)
+ * GPIO17 is Power LED source select (0 = CPLD, 1 = GPIO16)
+ * GPIO18 is Power Button status (0 = Released, 1 = Pressed)
+ *
+ * Default is LED ON
+ */
+
+#define EDMINIV2_OE		0xfffcffff
+#define EDMINIV2_OE_VAL		0x00020000

How about adding GPIO_OE? This settings are referred to GPIOs register

...snip...

Quoted 14 lines
MAINTAINERS +8 -0
+#define CONFIG_IDENT_STRING	" EDMiniV2"
+
+/*
+ * High Level Configuration Options (easy to change)
+ */
+#define CONFIG_MARVELL		1
+#define CONFIG_ARM926EJS	1	/* Basic Architecture */
+#define CONFIG_FEROCEON		1	/* CPU Core 

subversion */

MAINTAINERS +5 -0
+#define CONFIG_ORION5X		1	/* SOC Family Name */
+#define CONFIG_88F5182		1	/* SOC Name */
+#define CONFIG_MACH_EDMINIV2	1	/* Machine type */
+
+#define CONFIG_SKIP_LOWLEVEL_INIT	/* disable board 
Quoted 1 line

lowlevel_init */

How you are addressing DRAM configuration?
I think you need lowlevel_init.

...snip...

MAINTAINERS

Quoted 7 lines
MAINTAINERS +7 -0
+/*
+ *  Environment variables configurations
+ */
+#define CONFIG_ENV_IS_IN_FLASH		1
+#define CONFIG_ENV_SECT_SIZE		0x2000	/* 16K */
+#define CONFIG_ENV_SIZE			0x2000
+#define CONFIG_ENV_OFFSET		0x4000	/* env starts here */

I don't know how this is going to work, how much flash do you have? I hope it is mapped in the end since your reset address is 0xffff0000.

Where is the code to fetch flashed image from flash to DRAM at TEXT_BASE?

I suggest you provide some more details about your board in the commit log

Quoted 20 lines
MAINTAINERS +5 -0
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_SYS_MALLOC_LEN	(1024 * 128) /* 128kB 

for malloc() */

MAINTAINERS +13 -0
+/* size in bytes reserved for initial data */
+#define CONFIG_SYS_GBL_DATA_SIZE	128
+
+/*
+ * Other required minimal configurations
+ */
+#define CONFIG_CONSOLE_INFO_QUIET	/* some code reduction */
+#define CONFIG_ARCH_CPU_INIT	/* call arch_cpu_init() */
+#define CONFIG_ARCH_MISC_INIT	/* call arch_misc_init() */
+#define CONFIG_DISPLAY_CPUINFO	/* Display cpu info */
+#define CONFIG_NR_DRAM_BANKS	4
+#define CONFIG_STACKSIZE	0x00100000	/* regular stack- 1M */
+#define CONFIG_SYS_LOAD_ADDR	0x00800000	/* default load 

adr- 8M */

MAINTAINERS

Quoted 3 lines
MAINTAINERS +3 -0
+#define CONFIG_SYS_MEMTEST_START 0x00400000	/* 4M */
+#define CONFIG_SYS_MEMTEST_END	0x007fffff	/*(_8M -1) */
+#define CONFIG_SYS_RESET_ADDRESS 0xffff0000	/* Rst Vector Adr */

Same comment applies here

Regards..
Prafulla . .

#5 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

Prafulla Wadaskar a ?crit :

Quoted 11 lines
Quoted 11 lines
MAINTAINERS +0 -0
index d70a9d2..93e57f5 100644
@@ -512,6 +512,10 @@ Unknown / orphaned boards:
 #	Board		CPU					
 	#
 
 ##############################################################
 ###########
 
Quoted 6 lines

MAINTAINERS Unknown / orphaned boards: · line 518

Quoted 4 lines
MAINTAINERS +4 -0
+Albert ARIBAUD <[email protected]>
+
+	edminiv2	ARM926EJS (Orion5x SoC)
+

That's good if you can move this entry above Albin Tonnerre's entry

Are you sure? Seems to me like this list is ordered by last, not first, name.

Quoted 2 lines

How you are addressing DRAM configuration?
I think you need lowlevel_init.

Yes. That will be in patch V3.

Quoted 10 lines

...snip...

MAINTAINERS

Quoted 7 lines
MAINTAINERS +7 -0
+/*
+ *  Environment variables configurations
+ */
+#define CONFIG_ENV_IS_IN_FLASH		1
+#define CONFIG_ENV_SECT_SIZE		0x2000	/* 16K */
+#define CONFIG_ENV_SIZE			0x2000
+#define CONFIG_ENV_OFFSET		0x4000	/* env starts here */

I don't know how this is going to work, how much flash do you have?

51KB NOR located at fff88000 in the final mapping, and mirrored throughout f8000000-ffffffff at power-up. That's an MX29LV400CB, with a 1x16kb,2x8kb,1x32kb,7x64kb region layout, of which U-boot utilizes the 7 64K banks for code and the lowest 8K bank for environment.

Quoted 1 line

I hope it is mapped in the end since your reset address is 0xffff0000.

This *does* work, I step-debugged through the Orion init sequence. The fact is, there's ROM code in the Orion SoC apparently, at 0xffff0000, and which takes precedence over the boot CS. This ROM code checks the SoC device type and, if 5182, branches to 0xfff90000 (at this point a mirror of the boot CS).

Quoted 1 line

Where is the code to fetch flashed image from flash to DRAM at TEXT_BASE?

That's done by the start.S relocation code, subject to not defining CONFIG_SKIP_RELOCATION of course. Note that Orion has NOR flash, not NAND.

Quoted 1 line

I suggest you provide some more details about your board in the commit log

I will.

Amicalement,

Signature · 1 line
Albert.
#6 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

In reply to Albert Aribaud

Dear Albert Aribaud,

Quoted 4 lines · In message <[email protected]> you wrote:

This board is based on the Marvell Orion5x SoC.
Current support is limited to console and Flash.
Flash support uses LEGACY as the Macronix 29LV400
used on ED Mini V2 is not 100% CFI compliant.

And the differences are really so big that we cannot tweak the CFI driver?

board/LaCie/edminiv2/edminiv2.c line 133

Quoted 10 lines
board/LaCie/edminiv2/edminiv2.c new file +10 -0
+int dram_init(void)
+{
+	int i;
+
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = orion5x_sdram_bar(i);
+		gd->bd->bi_dram[i].size = orion5x_sdram_bs(i);
+	}
+	return 0;
+}

Cannot you use get_ram_size() for auto-sizing and checking?

Quoted 5 lines
include/configs/edminiv2.h new file +0 -0
new file mode 100644
index 0000000..31de164

...

include/configs/edminiv2.h line 71

Quoted 2 lines
include/configs/edminiv2.h new file +2 -0
+#define CONFIG_SYS_BAUDRATE_TABLE \
+{ 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600 }

Indentation by a TAB, please.

include/configs/edminiv2.h line 84

Quoted 2 lines
include/configs/edminiv2.h new file +2 -0
+#define CONFIG_SYS_FLASH_SECTSZ \
+{16384, 8192, 8192, 32768, 65536, 65536, 65536, 65536, 65536, 65536, 65536}

Ditto. And be careful about the line length.

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
You get a wonderful view from the point of no return.
                                    - Terry Pratchett, _Making_Money_
#7 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

Hi Albert,

Quoted 7 lines · On Wednesday 18 November 2009 23:21:58 Wolfgang Denk wrote:
Quoted 4 lines

This board is based on the Marvell Orion5x SoC. Current support is limited to console and Flash. Flash support uses LEGACY as the Macronix 29LV400 used on ED Mini V2 is not 100% CFI compliant.

And the differences are really so big that we cannot tweak the CFI driver?

It's not CFI compliant. But you can use the legacy infrastructure in this driver, which meant to support such chips. Please take a look at the following driver:

drivers/mtd/jedec_flash.c

Your board config header would need something like this:

/* Use common CFI driver */
#define CONFIG_SYS_FLASH_CFI
#define CONFIG_FLASH_CFI_DRIVER
/* board provides its own flash_init code */
#define CONFIG_FLASH_CFI_LEGACY 1
#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_8BIT
#define CONFIG_SYS_FLASH_LEGACY_512Kx8 1
...

Taken from include/configs/hcu4.h. This should give you an idea...

Cheers,
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

#8 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

Stefan Roese a ?crit :

Quoted 27 lines

Hi Albert,

Quoted 6 lines · On Wednesday 18 November 2009 23:21:58 Wolfgang Denk wrote:
Quoted 4 lines

This board is based on the Marvell Orion5x SoC. Current support is limited to console and Flash. Flash support uses LEGACY as the Macronix 29LV400 used on ED Mini V2 is not 100% CFI compliant.

And the differences are really so big that we cannot tweak the CFI driver?

It's not CFI compliant. But you can use the legacy infrastructure in this driver, which meant to support such chips. Please take a look at the following driver:

drivers/mtd/jedec_flash.c

Your board config header would need something like this:

/* Use common CFI driver */
#define CONFIG_SYS_FLASH_CFI
#define CONFIG_FLASH_CFI_DRIVER
/* board provides its own flash_init code */
#define CONFIG_FLASH_CFI_LEGACY 1
#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_8BIT
#define CONFIG_SYS_FLASH_LEGACY_512Kx8 1
...

Quoted 4 lines

Taken from include/configs/hcu4.h. This should give you an idea...

Cheers,
Stefan

Er... Precisely, I am using [CONFIG_FLASH_CFI_]LEGACY, as the patch comment says, though obviously not clearly enough.

Amicalement,

Signature · 1 line
Albert.
#9 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

Quoted 11 lines · On Thursday 19 November 2009 13:48:15 Albert ARIBAUD wrote:
Quoted 11 lines

Your board config header would need something like this:

/* Use common CFI driver */
#define CONFIG_SYS_FLASH_CFI
#define CONFIG_FLASH_CFI_DRIVER
/* board provides its own flash_init code */
#define CONFIG_FLASH_CFI_LEGACY 1
#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_8BIT
#define CONFIG_SYS_FLASH_LEGACY_512Kx8 1
...

Quoted 7 lines
Quoted 4 lines

Taken from include/configs/hcu4.h. This should give you an idea...

Cheers,
Stefan

Er... Precisely, I am using [CONFIG_FLASH_CFI_]LEGACY, as the patch comment says, though obviously not clearly enough.

Ahh, sorry I missed this.

Cheers,
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

#10 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

In reply to Wolfgang Denk

Wolfgang Denk a ?crit :

Quoted 10 lines

Dear Albert Aribaud,

Quoted 4 lines · In message <[email protected]> you wrote:

This board is based on the Marvell Orion5x SoC. Current support is limited to console and Flash. Flash support uses LEGACY as the Macronix 29LV400 used on ED Mini V2 is not 100% CFI compliant.

And the differences are really so big that we cannot tweak the CFI driver?

Apparently not.

The MX29LV400CB is 8-bit/16-bit and it configured on the ED Mini as 8-bit, but presents a pure 16-bit QRY (with zeroes between qry bytes) which causes cfi_flash to mistakenly detect it as 16-bit wide, and thus use 16-bit accesses at 16-bit addresses to read IDs and write instructions, which of course does not work.

Quoted 4 lines
Quoted 4 lines
board/LaCie/edminiv2/edminiv2.c new file +4 -0
+int dram_init(void)
+{
+	int i;
+
Quoted 8 lines

board/LaCie/edminiv2/edminiv2.c line 133

Quoted 6 lines
board/LaCie/edminiv2/edminiv2.c new file +6 -0
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = orion5x_sdram_bar(i);
+		gd->bd->bi_dram[i].size = orion5x_sdram_bs(i);
+	}
+	return 0;
+}

Cannot you use get_ram_size() for auto-sizing and checking?

As this is SoC code, not board code, and as the SoC allows to have up to four non-contiguous DRAM banks, I prefer to read the four DRAM base/size registers.

Amicalement,

Signature · 1 line
Albert.
#11 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

In reply to Wolfgang Denk

Wolfgang Denk a ?crit :

Quoted 4 lines
Quoted 4 lines
board/LaCie/edminiv2/edminiv2.c new file +4 -0
+int dram_init(void)
+{
+	int i;
+
Quoted 8 lines

board/LaCie/edminiv2/edminiv2.c line 133

Quoted 6 lines
board/LaCie/edminiv2/edminiv2.c new file +6 -0
+	for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
+		gd->bd->bi_dram[i].start = orion5x_sdram_bar(i);
+		gd->bd->bi_dram[i].size = orion5x_sdram_bs(i);
+	}
+	return 0;
+}

Cannot you use get_ram_size() for auto-sizing and checking?

The SoC allows for up to 4 banks of DRAM, not necessarily contiguous. Granted, this is not a frequent configuration, however I'd like to support it correctly, and the heuristics of get_ram_size() are based on the assumption that all DRAM is contiguous.

However I realize that this code is actually SoC-specific, not board-specific. It could be moved in cpu/arm926ejs/orion5x/dram.c, and then orion5x_sdram_{bar,bs} could be made static (or inlined).

What do you think?

Amicalement,

Signature · 1 line
Albert.
#12 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

Dear Albert ARIBAUD,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Cannot you use get_ram_size() for auto-sizing and checking?

The SoC allows for up to 4 banks of DRAM, not necessarily contiguous. Granted, this is not a frequent configuration, however I'd like to support it correctly, and the heuristics of get_ram_size() are based on the assumption that all DRAM is contiguous.

No, this is not correct. get_ram_size() is used always on a single bank of memory only.

Quoted 5 lines

However I realize that this code is actually SoC-specific, not board-specific. It could be moved in cpu/arm926ejs/orion5x/dram.c, and then orion5x_sdram_{bar,bs} could be made static (or inlined).

What do you think?

Seems to make sense.

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
A memorandum is written not to inform the reader, but to protect  the
writer.                                               -- Dean Acheson
#13 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

Wolfgang Denk a ?crit :

Quoted 11 lines

Dear Albert ARIBAUD,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 1 line

Cannot you use get_ram_size() for auto-sizing and checking?

The SoC allows for up to 4 banks of DRAM, not necessarily contiguous. Granted, this is not a frequent configuration, however I'd like to support it correctly, and the heuristics of get_ram_size() are based on the assumption that all DRAM is contiguous.

No, this is not correct. get_ram_size() is used always on a single bank of memory only.

Do you mean calling get_ram_size() four up to times based on the configured number of banks and configured sizes? I then fail to see the added value of get_ram_size() wrt using the configured sizes directly.

Quoted 7 lines
Quoted 5 lines

However I realize that this code is actually SoC-specific, not board-specific. It could be moved in cpu/arm926ejs/orion5x/dram.c, and then orion5x_sdram_{bar,bs} could be made static (or inlined).

What do you think?

Seems to make sense.

All right. Does doing that lift the requirement to use get_ram_size()?

Quoted 3 lines

Best regards,

Wolfgang Denk

Amicalement,

Signature · 1 line
Albert.
#14 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

Dear Albert ARIBAUD,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines

No, this is not correct. get_ram_size() is used always on a single bank of memory only.

Do you mean calling get_ram_size() four up to times based on the configured number of banks and configured sizes? I then fail to see the

Yes, exactly.

Quoted 1 line

added value of get_ram_size() wrt using the configured sizes directly.

The added value is that get_ram_size() will detect (1) a lot of common error situations and (2) will detect the actual size of the respective memory banks.

Assume you have a system where differentt types of memory chips can be fit, or where you can insert memory modules. Then you configure for the largest possible type, and get_ram_size() will detect what's really present, so you can adjust the configuration. See the README for details.

Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

However I realize that this code is actually SoC-specific, not board-specific. It could be moved in cpu/arm926ejs/orion5x/dram.c, and then orion5x_sdram_{bar,bs} could be made static (or inlined).

What do you think?

Seems to make sense.

All right. Does doing that lift the requirement to use get_ram_size()?

I see no reason yet why you would not want to use get_ram_size() - the memory test feature alone is useful enough, even if you never intend to use different RAM sizes.

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
Build a system that even a fool can use and only a fool will want  to
use it.
#15 lore raw

PATCH v2 3/3 Add support for the LaCie ED Mini V2 board

Wolfgang Denk a ?crit :

Quoted 26 lines

Dear Albert ARIBAUD,

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 2 lines

No, this is not correct. get_ram_size() is used always on a single bank of memory only.

Do you mean calling get_ram_size() four up to times based on the configured number of banks and configured sizes? I then fail to see the

Yes, exactly.

Quoted 1 line

added value of get_ram_size() wrt using the configured sizes directly.

The added value is that get_ram_size() will detect (1) a lot of common error situations and (2) will detect the actual size of the respective memory banks.

Assume you have a system where differentt types of memory chips can be fit, or where you can insert memory modules. Then you configure for the largest possible type, and get_ram_size() will detect what's really present, so you can adjust the configuration. See the README for details.

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

However I realize that this code is actually SoC-specific, not board-specific. It could be moved in cpu/arm926ejs/orion5x/dram.c, and then orion5x_sdram_{bar,bs} could be made static (or inlined).

Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

What do you think?

Seems to make sense.

All right. Does doing that lift the requirement to use get_ram_size()?

I see no reason yet why you would not want to use get_ram_size() - the memory test feature alone is useful enough, even if you never intend to use different RAM sizes.

Ok. Considering the machine would have had fixed sized banks but the SoC would not, get_ram_size() indeed makes sense especially if I move the code to cpu/arm926ejs/orion5x/dram.c. I'll do that in V4 of the patch, once I get complete feedback for V3.

Amicalement,

Signature · 1 line
Albert.
#16 lore raw

[U-Boot] Mixed 8/16 bits NOR FLASH support (was: [PATCH V2 3/3] Add support for the LaCie ED Mini V2 board)

In reply to Wolfgang Denk

(starting a new subject as this goes beyond simply adding support for any platform/SoC/whetever, and touches on MTD/Flash, thus also adding Stefan as To:)

Hi Wolfgang and others,

Wolfgang Denk a ?crit :

Quoted 10 lines

Dear Albert Aribaud,

Quoted 4 lines · In message <[email protected]> you wrote:

This board is based on the Marvell Orion5x SoC. Current support is limited to console and Flash. Flash support uses LEGACY as the Macronix 29LV400 used on ED Mini V2 is not 100% CFI compliant.

And the differences are really so big that we cannot tweak the CFI driver?

After deeper analysis, there are two issues:

1) there is an already known quirk in that the MX29LV400CB, reputedly compliant with the 1.0 CFI spec, has the 7th bit set in the Mfg ID byte although it should not. That can cause a mistaken region list inversion, however this kind of issue is known for other parts and can be handled in the current U-boot architecture.

2) The MX29LV400 QRY bytes appear at byte offsets 0x20, 0x22, 0x24 etc, which is normal for mixed 8/16 bit chips: the spec says they should output their QRY bytes at the same offset and with the same spacing as pure 16-bit chips. However, they also should duplicate these QRY bytes at odd addresses (0x21, 0x23, 0x25 etc) so that reading bytes from 0x20 onward would yield 'Q', 'Q', 'R', 'R', 'Y', 'Y' etc. However, the MX29LV400CB output odd bytes as zeroes, just like a pure 16-bit device, thus producing (LSB first) 'Q', #0, 'R', #0, 'Y', #0 etc.

To add insult to injury, for other JEDEC commands such as READ ID, the MX29LV400CB does behave correctly, that is, duplicates its even bytes to its odd bytes. A READ ID gives 0xC2, 0xC2, 0xBA, 0xBA which is correct as far as mixed 8/16 chip behavior is concerned.

The consequence of all this is that even a perfectly CFI-compliant code will recognize the MX29LV400CB as a 16-bit device even though it is a mixed device and could, or worse, should (as in my own unfortunate case) be used in BYTE mode.

In the case of U-boot's CFI detection code, it detects the MX29LV400CB as 16-bit because of its QRY block offset (0x20) and null upper bytes. Then it wants to talk to it using 16-bit wide writes at 16-bit mode offsets, which, in my case, fails.

Quoted 28 lines

U-Boot 2009.11-rc1-00069-g93fb3c4-dirty (dec. 02 2009 - 09:00:04) EDMiniV2

SoC:   Orion5x MV88F5182-A2
DRAM:  64 MB               

flash detect cfi
fwc addr fff80000 cmd f0 f0 8bit x 8 bit fwc addr fff80000 cmd ff ff 8bit x 8 bit fwc addr fff80055 cmd 98 98 8bit x 8 bit is= cmd 51(Q) addr fff80010 is= ff 51 fwc addr fff80555 cmd 98 98 8bit x 8 bit is= cmd 51(Q) addr fff80010 is= ff 51 fwc addr fff80000 cmd f0 f0f0 16bit x 8 bit fwc addr fff80000 cmd ff ffff 16bit x 8 bit fwc addr fff800aa cmd 98 9898 16bit x 8 bit is= cmd 51(Q) addr fff80020 is= 0051 5151 fwc addr fff80aaa cmd 98 9898 16bit x 8 bit is= cmd 51(Q) addr fff80020 is= 0051 5151 fwc addr fff80000 cmd f0 00f0 16bit x 16 bit fwc addr fff80000 cmd ff 00ff 16bit x 16 bit fwc addr fff800aa cmd 98 0098 16bit x 16 bit is= cmd 51(Q) addr fff80020 is= 0051 0051 is= cmd 52(R) addr fff80022 is= 0052 0052 is= cmd 59(Y) addr fff80024 is= 0059 0059 device interface is 2
found port 2 chip 2 port 16 bits chip 16 bits

00 : 51 52 59 02 00 40 00 00 00 00 00 27 36 00 00 04  QRY.. at .....'6...
10 : 00 0a 00 05 00 04 00 13 02 00 00 00 04 00 00 40  ...............@
20 : 00 01 00 20 00 00 00 80 00 06 00 00 01 d0 43 61  ... ..........Ca
Quoted 10 lines

fwc addr fff80000 cmd f0 00f0 16bit x 16 bit fwc addr fff80aaa cmd aa 00aa 16bit x 16 bit fwc addr fff80554 cmd 55 0055 16bit x 16 bit fwc addr fff80aaa cmd 90 0090 16bit x 16 bit fwc addr fff80000 cmd f0 00f0 16bit x 16 bit fwc addr fff800aa cmd 98 0098 16bit x 16 bit manufacturer is 2
manufacturer id is 0xff
device id is 0xffff
device id2 is 0x0

Looking at the commands and addresses displayed above and at the source code of cfi_flash.c), I think the CFI detection code never tries the 'mixed 8/16-bit chip in 8-bit mode only' case. It does try a '16bit x 8 bit' case but as it doubles the write bytes (e.g. 0xF0F0), I suspect this is meant for pairs of interleaved chips, not for a mixed-mode chip, for which commands need not be duplicated.

Actually, the U-boot code seems to assume that if QRY bytes start at 0x20 and are at even offsets, then the chip is 16-bit, period -- see how portwidth is used both to calculate offsets in QRY and other JEDEC data *and* in computing the width of writes to the flash.

If so, then this would have to be amended for mixed-mode chips in byte mode only.

Only, before I go on with proposing a fix, I'd like to be sure I'm right so far; thus comments are heartily welcome.

Amicalement,

Signature · 1 line
Albert.
#17 lore raw

[U-Boot] Mixed 8/16 bits NOR FLASH support (was: [PATCH V2 3/3] Add support for the LaCie ED Mini V2 board)

Hi Albert,

Quoted 8 lines · On Wednesday 02 December 2009 09:31:43 Albert ARIBAUD wrote:
Quoted 7 lines
Quoted 4 lines

This board is based on the Marvell Orion5x SoC. Current support is limited to console and Flash. Flash support uses LEGACY as the Macronix 29LV400 used on ED Mini V2 is not 100% CFI compliant.

And the differences are really so big that we cannot tweak the CFI driver?

Quoted 7 lines

After deeper analysis, there are two issues:

1) there is an already known quirk in that the MX29LV400CB, reputedly compliant with the 1.0 CFI spec, has the 7th bit set in the Mfg ID byte although it should not. That can cause a mistaken region list inversion, however this kind of issue is known for other parts and can be handled in the current U-boot architecture.

Yes, this should be easy to fix.

Quoted 19 lines

2) The MX29LV400 QRY bytes appear at byte offsets 0x20, 0x22, 0x24 etc, which is normal for mixed 8/16 bit chips: the spec says they should output their QRY bytes at the same offset and with the same spacing as pure 16-bit chips. However, they also should duplicate these QRY bytes at odd addresses (0x21, 0x23, 0x25 etc) so that reading bytes from 0x20 onward would yield 'Q', 'Q', 'R', 'R', 'Y', 'Y' etc. However, the MX29LV400CB output odd bytes as zeroes, just like a pure 16-bit device, thus producing (LSB first) 'Q', #0, 'R', #0, 'Y', #0 etc.

To add insult to injury, for other JEDEC commands such as READ ID, the MX29LV400CB does behave correctly, that is, duplicates its even bytes to its odd bytes. A READ ID gives 0xC2, 0xC2, 0xBA, 0xBA which is correct as far as mixed 8/16 chip behavior is concerned.

The consequence of all this is that even a perfectly CFI-compliant code will recognize the MX29LV400CB as a 16-bit device even though it is a mixed device and could, or worse, should (as in my own unfortunate case) be used in BYTE mode.

Quoted 4 lines

In the case of U-boot's CFI detection code, it detects the MX29LV400CB as 16-bit because of its QRY block offset (0x20) and null upper bytes. Then it wants to talk to it using 16-bit wide writes at 16-bit mode offsets, which, in my case, fails.

Since the CFI driver starts detection in 8bit mode and only switches to 16bit mode (32bit etc.) if this fails, we seem to have a problem with 8bit mode detection of this chip.

Quoted 40 lines
Quoted 29 lines

U-Boot 2009.11-rc1-00069-g93fb3c4-dirty (dec. 02 2009 - 09:00:04) EDMiniV2

SoC:   Orion5x MV88F5182-A2
DRAM:  64 MB

flash detect cfi
fwc addr fff80000 cmd f0 f0 8bit x 8 bit fwc addr fff80000 cmd ff ff 8bit x 8 bit fwc addr fff80055 cmd 98 98 8bit x 8 bit is= cmd 51(Q) addr fff80010 is= ff 51 fwc addr fff80555 cmd 98 98 8bit x 8 bit is= cmd 51(Q) addr fff80010 is= ff 51 fwc addr fff80000 cmd f0 f0f0 16bit x 8 bit fwc addr fff80000 cmd ff ffff 16bit x 8 bit fwc addr fff800aa cmd 98 9898 16bit x 8 bit is= cmd 51(Q) addr fff80020 is= 0051 5151 fwc addr fff80aaa cmd 98 9898 16bit x 8 bit is= cmd 51(Q) addr fff80020 is= 0051 5151 fwc addr fff80000 cmd f0 00f0 16bit x 16 bit fwc addr fff80000 cmd ff 00ff 16bit x 16 bit fwc addr fff800aa cmd 98 0098 16bit x 16 bit is= cmd 51(Q) addr fff80020 is= 0051 0051 is= cmd 52(R) addr fff80022 is= 0052 0052 is= cmd 59(Y) addr fff80024 is= 0059 0059 device interface is 2
found port 2 chip 2 port 16 bits chip 16 bits

00 : 51 52 59 02 00 40 00 00 00 00 00 27 36 00 00 04  QRY.. at .....'6...
10 : 00 0a 00 05 00 04 00 13 02 00 00 00 04 00 00 40  ...............@
20 : 00 01 00 20 00 00 00 80 00 06 00 00 01 d0 43 61  ... ..........Ca
Quoted 10 lines

fwc addr fff80000 cmd f0 00f0 16bit x 16 bit fwc addr fff80aaa cmd aa 00aa 16bit x 16 bit fwc addr fff80554 cmd 55 0055 16bit x 16 bit fwc addr fff80aaa cmd 90 0090 16bit x 16 bit fwc addr fff80000 cmd f0 00f0 16bit x 16 bit fwc addr fff800aa cmd 98 0098 16bit x 16 bit manufacturer is 2
manufacturer id is 0xff
device id is 0xffff
device id2 is 0x0

Quoted 6 lines

Looking at the commands and addresses displayed above and at the source code of cfi_flash.c), I think the CFI detection code never tries the 'mixed 8/16-bit chip in 8-bit mode only' case. It does try a '16bit x 8 bit' case but as it doubles the write bytes (e.g. 0xF0F0), I suspect this is meant for pairs of interleaved chips, not for a mixed-mode chip, for which commands need not be duplicated.

Maybe. I don't remember ever using an mixed-mode chip (8 & 16bit interface) in 8bit mode.

Quoted 10 lines

Actually, the U-boot code seems to assume that if QRY bytes start at 0x20 and are at even offsets, then the chip is 16-bit, period -- see how portwidth is used both to calculate offsets in QRY and other JEDEC data *and* in computing the width of writes to the flash.

If so, then this would have to be amended for mixed-mode chips in byte mode only.

Only, before I go on with proposing a fix, I'd like to be sure I'm right so far; thus comments are heartily welcome.

I have to admit, that I'm not totally sure about this problem. Perhaps it would be best, if you would try to "fix" to the CFI code. To verify, if your theory is correct. And then post the resulting fix to the list, so that we can discuss it here.

Thanks.

Cheers,
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

#18 lore raw

[U-Boot] Mixed 8/16 bits NOR FLASH support (was: [PATCH V2 3/3] Add support for the LaCie ED Mini V2 board)

Dear Stefan Roese,

Quoted 3 lines · In message <[email protected]> you wrote:

Maybe. I don't remember ever using an mixed-mode chip (8 & 16bit interface) in 8bit mode.

Indeed. I wonder which arguments the hardware designer has to defend such an implementation.

Quoted 4 lines

I have to admit, that I'm not totally sure about this problem. Perhaps it would be best, if you would try to "fix" to the CFI code. To verify, if your theory is correct. And then post the resulting fix to the list, so that we can discuss it here.

Agreed. Eventually the READ ID could / should be combined with the 8/16 bit test, at least for this specific device ID.

Um... what does the Linux kernel code do in this case?

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
The number you have dialed is imaginary. Please divide by 0  and  try
again.
#19 lore raw

[U-Boot] Mixed 8/16 bits NOR FLASH support

Wolfgang Denk a ?crit :

Quoted 9 lines

Dear Stefan Roese,

Quoted 4 lines

I have to admit, that I'm not totally sure about this problem. Perhaps it would be best, if you would try to "fix" to the CFI code. To verify, if your theory is correct. And then post the resulting fix to the list, so that we can discuss it here.

Agreed. Eventually the READ ID could / should be combined with the 8/16 bit test, at least for this specific device ID.

That is 'should', really, because the only way to tell apart a real pure word mode QRY from this faulty miwed-mode QRY is to try the READ ID, because i) it *is* correclty mixed-mode and ii) the Mfg and device ID are needed for verifying that we indeed had a faulty part.

Quoted 1 line

Um... what does the Linux kernel code do in this case?

Not entierly sure yet. I'll look.

Amicalement,

Signature · 1 line
Albert.
#20 lore raw

[U-Boot] Mixed 8/16 bits NOR FLASH support

In reply to Stefan Roese

Stefan Roese a ?crit :

Quoted 10 lines

Hi Albert,

Quoted 4 lines

In the case of U-boot's CFI detection code, it detects the MX29LV400CB as 16-bit because of its QRY block offset (0x20) and null upper bytes. Then it wants to talk to it using 16-bit wide writes at 16-bit mode offsets, which, in my case, fails.

Since the CFI driver starts detection in 8bit mode and only switches to 16bit mode (32bit etc.) if this fails, we seem to have a problem with 8bit mode detection of this chip.

All 8-bit mode checks assume the QRY bytes are at addresses 0x10, 0x11, 0x12 etc. So they fail too, since a mixed-mode chip outputs a word-mode QRY always, at addresses 0xx20, 0x22, 0x24 etc.

Amicalement,

Signature · 1 line
Albert.
#21 lore raw

PATCH v2 1/3 Initial support for Marvell Orion5x SoC

In reply to Albert Aribaud

Dear Albert Aribaud,

Quoted 4 lines · In message <[email protected]> you wrote:

This patch adds support for the Marvell Orion5x SoC. It has no use alone, and must be followed by a patch to add Orion5x support for serial, then support for the ED Mini V2, an Orion5x-based board from LaCie.

...

Quoted 2 lines
cpu/arm926ejs/orion5x/timer.c new file +0 -0
new file mode 100644

...

Quoted 2 lines
cpu/arm926ejs/orion5x/timer.c new file +2 -0
+#define READ_TIMER \
+	(readl(CNTMR_VAL_REG(UBOOT_CNTR)) / (CONFIG_SYS_TCLK / 1000))

...

cpu/arm926ejs/orion5x/timer.c

Quoted 2 lines
cpu/arm926ejs/orion5x/timer.c new file +2 -0
+	/* reset time */
+	lastdec = READ_TIMER;

Macros resembling functions should look like functions, i. e. have parens. Also please note that generally, inline functions are preferable to macros resembling functions.

...

Quoted 1 line

+#define UBOOT_CNTR_VAL readl(CNTMR_VAL_REG(UBOOT_CNTR))

Ditto.

cpu/arm926ejs/orion5x/timer.c

Quoted 6 lines
cpu/arm926ejs/orion5x/timer.c new file +6 -0
+void udelay(unsigned long usec)
+{
+	uint current;
+	ulong delayticks;
+
+	current = readl(CNTMR_VAL_REG(UBOOT_CNTR));

Why do you add the #define above when you then don't use it?

cpu/arm926ejs/orion5x/timer.c

Quoted 5 lines
cpu/arm926ejs/orion5x/timer.c new file +5 -0
+	delayticks = (usec * (CONFIG_SYS_TCLK / 1000000));
+
+	if (current < delayticks) {
+		delayticks -= current;
+		while (readl(CNTMR_VAL_REG(UBOOT_CNTR)) < current)

Ditto.

cpu/arm926ejs/orion5x/mpp.c new file +0 -0
new file mode 100644
index 0000000..f341747

...
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.

NAK. License must be "v2 or any later version". Ditto for some other files.

include/asm-arm/arch-orion5x/88f5182.h

Quoted 5 lines
include/asm-arm/arch-orion5x/88f5182.h new file +0 -0
new file mode 100644
index 0000000..b16b23f

88f5182 is a terrible file name. Can you not come up with something more descriptive, please?

Quoted 5 lines
include/asm-arm/arch-orion5x/gpio.h new file +0 -0
new file mode 100644
index 0000000..58592ad

...

Quoted 3 lines

+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.

NAK. See above.

include/asm-arm/arch-orion5x/gpio.h

Quoted 9 lines
include/asm-arm/arch-orion5x/gpio.h new file +9 -0
+#define GPIO_MAX		26
+#define GPIO_OUT(pin)		(ORION5X_GPIO0_BASE + 0x00)
+#define GPIO_IO_CONF(pin)	(ORION5X_GPIO0_BASE + 0x04)
+#define GPIO_BLINK_EN(pin)	(ORION5X_GPIO0_BASE + 0x08)
+#define GPIO_IN_POL(pin)	(ORION5X_GPIO0_BASE + 0x0c)
+#define GPIO_DATA_IN(pin)	(ORION5X_GPIO0_BASE + 0x10)
+#define GPIO_EDGE_CAUSE(pin)	(ORION5X_GPIO0_BASE + 0x14)
+#define GPIO_EDGE_MASK(pin)	(ORION5X_GPIO0_BASE + 0x18)
+#define GPIO_LEVEL_MASK(pin)	(ORION5X_GPIO0_BASE + 0x1c)

NAK. Please make this a C struct.

Quoted 3 lines

+/*
+ * Orion5x-specific GPIO API
+ */

Why do we need an Orion5x-specific GPIO API? Can't we use something that is more general?

Quoted 5 lines
include/asm-arm/arch-orion5x/mpp.h new file +0 -0
new file mode 100644
index 0000000..31fade7

...

Quoted 3 lines

+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.

NAK. See above.

include/asm-arm/arch-orion5x/mpp.h

Quoted 7 lines
include/asm-arm/arch-orion5x/mpp.h new file +7 -0
+#define MPP(_num, _sel, _in, _out, _F5182, _F5281) ( \
+	/* MPP number */		((_num) & 0xff) | \
+	/* MPP select value */		(((_sel) & 0xf) << 8) | \
+	/* may be input signal */	((!!(_in)) << 12) | \
+	/* may be output signal */	((!!(_out)) << 13) | \
+	/* available on F5182 */	((!!(_F5182)) << 14) | \
+	/* available on F5281 */	((!!(_F5182)) << 15))

Comments follow the code, not vice versa.

Best regards,

Wolfgang Denk

Signature · 6 lines
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: [email protected]
The night sky over the planet Krikkit is the least interesting  sight
in the entire Universe.
                 - Douglas Adams _Life, the Universe, and Everything_
#22 lore raw

PATCH v2 1/3 Initial support for Marvell Orion5x SoC

Hi Wolfgang,

Wolfgang Denk a ?crit :

Quoted 2 lines

88f5182 is a terrible file name. Can you not come up with something more descriptive, please?

Actually, the name is based on the actual name of the Marvell SoC variant.

Quoted 2 lines

Why do we need an Orion5x-specific GPIO API? Can't we use something that is more general?

If there is such a general API, I'm willing to use it.

Amicalement,

Signature · 1 line
Albert.
#23 lore raw

PATCH v2 1/3 Initial support for Marvell Orion5x SoC

In reply to Wolfgang Denk

Wolfgang Denk a ?crit :

Quoted 37 lines

Dear Albert Aribaud,

cpu/arm926ejs/orion5x/mpp.c new file +3 -0
new file mode 100644
index 0000000..f341747
...
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.

NAK. License must be "v2 or any later version". Ditto for some other files.

Quoted 5 lines
include/asm-arm/arch-orion5x/gpio.h new file +0 -0
new file mode 100644
index 0000000..58592ad

...

Quoted 3 lines

+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.

NAK. See above.

Quoted 5 lines
include/asm-arm/arch-orion5x/mpp.h new file +0 -0
new file mode 100644
index 0000000..31fade7

...

Quoted 3 lines

+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.

Quoted 5 lines

NAK. See above.

Best regards,

Wolfgang Denk

These files are derived from their kirkwood counterparts, which are GPL v2 only, so I don't have the right to simply change that to "v2 or any later version", I believe, unless the originals' copyright owner allows it (and possibly even fixes the originals). Prafulla, would you ACK this?

Amicalement,

Signature · 1 line
Albert.
#24 lore raw

PATCH v2 1/3 Initial support for Marvell Orion5x SoC

Dear Albert ARIBAUD,

Quoted 5 lines · In message <[email protected]> you wrote:

These files are derived from their kirkwood counterparts, which are GPL v2 only, so I don't have the right to simply change that to "v2 or any later version", I believe, unless the originals' copyright owner allows it (and possibly even fixes the originals). Prafulla, would you ACK this?

Indeed. These files need to be fixed ASAP, too:

	drivers/gpio/kw_gpio.c
	drivers/i2c/kirkwood_i2c.c
	include/asm-arm/arch-kirkwood/gpio.h
	include/asm-arm/arch-kirkwood/mpp.h
	include/usb/omap1510_udc.h

Best regards,

Wolfgang Denk

Signature · 4 lines
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: wd at denx.de
Old programmers never die, they just become managers.
#25 lore raw

PATCH v2 1/3 Initial support for Marvell Orion5x SoC

Quoted 14 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Saturday, December 05, 2009 6:08 AM
To: Albert ARIBAUD
Cc: U-Boot at lists.denx.de; Prafulla Wadaskar
Subject: Re: [U-Boot] [PATCH V2 1/3] Initial support for Marvell Orion5x SoC

Dear Albert ARIBAUD,

Quoted 1 line · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 1 line

These files are derived from their kirkwood counterparts,

which are GPL

Quoted 1 line

v2 only, so I don't have the right to simply change that to

"v2 or any

Quoted 1 line

later version", I believe, unless the originals' copyright

owner allows

Quoted 1 line

it (and possibly even fixes the originals). Prafulla, would

you ACK this?

Ack

Quoted 7 lines

Indeed. These files need to be fixed ASAP, too:

drivers/gpio/kw_gpio.c
drivers/i2c/kirkwood_i2c.c
include/asm-arm/arch-kirkwood/gpio.h
include/asm-arm/arch-kirkwood/mpp.h

In the kirkwood port these files are
Imported from Linux kernel source,
I will request the respective writers to update to latest GPL license.

Regards..
Prafulla . .

#26 lore raw

PATCH v2 1/3 Initial support for Marvell Orion5x SoC

In reply to Wolfgang Denk

Wolfgang Denk a ?crit :

Quoted 10 lines

Dear Albert Aribaud,

include/asm-arm/arch-orion5x/88f5182.h

Quoted 5 lines
include/asm-arm/arch-orion5x/88f5182.h new file +0 -0
new file mode 100644
index 0000000..b16b23f

88f5182 is a terrible file name. Can you not come up with something more descriptive, please?

(Pre)fixed: file is now mv88f5182.h. That's the best I can do since 88F5182 is actually the SoC variant 'name'. Expect 'mv88f5181.h', 'mv88f5281.h' in the future.

Quoted 6 lines
Quoted 5 lines
include/asm-arm/arch-orion5x/gpio.h new file +0 -0
new file mode 100644
index 0000000..58592ad

...

Quoted 6 lines
Quoted 3 lines

+/*
+ * Orion5x-specific GPIO API
+ */

Why do we need an Orion5x-specific GPIO API? Can't we use something that is more general?

I've looked at the current u-boot code and have found no generic GPIO API -- and six different, specific ones. Is there an effort going on to generalize this?

Amicalement,

Signature · 1 line
Albert.