Skip to contentSkip to conversation

Support Analogue Micro's ASP8347DB board.

PATCH New Wolfgang Denk 2 participants 3 messages Nov 29, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 4/5 Support Analogue Micro's ASP8347DB board.

Dear Pantelis,

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

Add support for Analogue Micro's ASP8347DB board. The board is originally shipped with RedBoot. All appropriate settings are migrated to u-boot & the old kernel booted; a drop in bootloader replacement.

In addition to my previous comments abot necessary coding style cleanup ((indentation by TABs, trailing white space, C++ comments, line length, etc.) please cleanup the following items:

MAKEALL LIST_8260=" \ · line 133

Quoted 8 lines
MAKEALL +1 -1
@@ -130,7 +130,7 @@ LIST_8260="	\
 #########################################################################
 
 LIST_83xx="	\
-	TQM834x		MPC8349EMDS					\
+	TQM834x		MPC8349EMDS	ASP8347DB			\

Please keep lists sorted.

Makefile TQM834x_config: unconfig · line 1602

Quoted 9 lines
Makefile +3 -0
@@ -1597,6 +1597,9 @@ TQM834x_config:	unconfig
 MPC8349EMDS_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc mpc83xx mpc8349emds
 
+ASP8347DB_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) ppc mpc83xx asp8347db
+

Please keep lists sorted.

Quoted 2 lines
board/asp8347db/asp8347db.c new file +0 -0

...

Quoted 6 lines
board/asp8347db/asp8347db.c new file +6 -0
+long int initdram (int board_type)
+{
+	long size, known_size;
+
+	/* 128MB */
+	known_size = 128 << 20;

...

board/asp8347db/asp8347db.c

Quoted 5 lines
board/asp8347db/asp8347db.c new file +5 -0
+	/* size detection */
+	debug("\n");
+	size = get_ram_size(CFG_DDR_BASE, known_size);
+	if (size != known_size)
+		debug("Detected other size than what expected!\n");

You probably want to remove this for the production version?

...

board/asp8347db/asp8347db.c

Quoted 3 lines
board/asp8347db/asp8347db.c new file +3 -0
+static void move64(unsigned long long *src, unsigned long long *dest)
+{
+#if defined(CONFIG_MPC8260) || defined(CONFIG_MPC824X)

Isn't it unlikely that any of these conditions is true on a 834x board?

Quoted 17 lines
board/asp8347db/asp8347db.c new file +17 -0
+#if defined (CFG_DRAM_TEST_DATA)
+
+unsigned long long pattern[] = {
+	0xaaaaaaaaaaaaaaaaULL,
+	0xccccccccccccccccULL,
+	0xf0f0f0f0f0f0f0f0ULL,
+	0xff00ff00ff00ff00ULL,
+	0xffff0000ffff0000ULL,
+	0xffffffff00000000ULL,
+	0x00000000ffffffffULL,
+	0x0000ffff0000ffffULL,
+	0x00ff00ff00ff00ffULL,
+	0x0f0f0f0f0f0f0f0fULL,
+	0x3333333333333333ULL,
+	0x5555555555555555ULL,
+};
+

board/asp8347db/asp8347db.c

Quoted 10 lines
board/asp8347db/asp8347db.c new file +10 -0
+/*********************************************************************/
+/* NAME:  mem_test_data() -  test data lines for shorts and opens    */
+/*								     */
+/* DESCRIPTION:							     */
+/*   Tests data lines for shorts and opens by forcing adjacent data  */
+/*   to opposite states. Because the data lines could be routed in   */
+/*   an arbitrary manner the must ensure test patterns ensure that   */
+/*   every case is tested. By using the following series of binary   */
+/*   patterns every combination of adjacent bits is test regardless  */
+/*   of routing.						     */

Do we really need yet another copy of this code?

board/asp8347db/asp8347db.c

Quoted 2 lines
board/asp8347db/asp8347db.c new file +2 -0
+/*********************************************************************/
+/* NAME:    testdram() -  calls any enabled memory tests	     */

...

This would be at least the 5th copy of this code.

Please don't do this. Let's clean this up and use one common verion - if needed at all, as there is other memtest code, too.

Quoted 2 lines
board/asp8347db/fpga.c new file +0 -0

...

board/asp8347db/fpga.c

Quoted 9 lines
board/asp8347db/fpga.c new file +9 -0
+static void mdelay(int ms)
+{
+	ulong start = get_timer(0);
+	ulong delay;
+
+	delay = (ms * CFG_HZ) / 1000;
+	while (get_timer(start) < delay) {
+		udelay (1000);
+		WATCHDOG_RESET();	/* Trigger watchdog, if needed */

Note: this is redundant, as udelay() will already trigger the watchdog.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Consistency requires you to be as ignorant today as you were a  year
ago."                                              - Bernard Berenson
#2 lore raw

PATCH 4/5 Support Analogue Micro's ASP8347DB board.

Quoted 18 lines · Wolfgang Denk

Dear Pantelis,

in message <[email protected]> you

Quoted 5 lines · wrote:

Add support for Analogue Micro's ASP8347DB board. The board is originally shipped with RedBoot. All appropriate settings are migrated to u-boot & the old kernel booted; a drop in bootloader replacement.

In addition to my previous comments abot necessary coding style cleanup ((indentation by TABs, trailing white space, C++ comments, line length, etc.) please cleanup the following items:

Quoted 4 lines
MAKEALL +0 -0
@@ -130,7 +130,7 @@ LIST_8260="	\
 
Quoted 9 lines

MAKEALL LIST_8260=" \ · line 135

Quoted 6 lines
MAKEALL +1 -1
 ##################################################################### 
 ####
 
 LIST_83xx="	\
-	TQM834x		MPC8349EMDS					\
+	TQM834x		MPC8349EMDS	ASP8347DB			\

Please keep lists sorted.

OK

Quoted 6 lines
Quoted 6 lines
Makefile +0 -0
@@ -1597,6 +1597,9 @@ TQM834x_config:	unconfig
 MPC8349EMDS_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) ppc mpc83xx mpc8349emds
 
Quoted 6 lines

Makefile TQM834x_config: unconfig · line 1602

Quoted 3 lines
Makefile +3 -0
+ASP8347DB_config:	unconfig
+	@$(MKCONFIG) $(@:_config=) ppc mpc83xx asp8347db
+

Please keep lists sorted.

OK

Quoted 10 lines
Quoted 2 lines
board/asp8347db/asp8347db.c new file +0 -0

...

Quoted 6 lines
board/asp8347db/asp8347db.c new file +6 -0
+long int initdram (int board_type)
+{
+	long size, known_size;
+
+	/* 128MB */
+	known_size = 128 << 20;

...

Quoted 8 lines

board/asp8347db/asp8347db.c

Quoted 5 lines
board/asp8347db/asp8347db.c new file +5 -0
+	/* size detection */
+	debug("\n");
+	size = get_ram_size(CFG_DDR_BASE, known_size);
+	if (size != known_size)
+		debug("Detected other size than what expected!\n");

You probably want to remove this for the production version?

Well, here's the thing, if the board's DRAM is not soldered properly this will
probably trigger - think of it as a cheap memory test.

But it's not biggie to go...

Quoted 9 lines

...

board/asp8347db/asp8347db.c

Quoted 4 lines

+static void move64(unsigned long long *src, unsigned long long *dest)

board/asp8347db/asp8347db.c new file +2 -0
+{
+#if defined(CONFIG_MPC8260) || defined(CONFIG_MPC824X)

Isn't it unlikely that any of these conditions is true on a 834x board?

OK

Quoted 45 lines
Quoted 27 lines
board/asp8347db/asp8347db.c new file +18 -0
+#if defined (CFG_DRAM_TEST_DATA)
+
+unsigned long long pattern[] = {
+	0xaaaaaaaaaaaaaaaaULL,
+	0xccccccccccccccccULL,
+	0xf0f0f0f0f0f0f0f0ULL,
+	0xff00ff00ff00ff00ULL,
+	0xffff0000ffff0000ULL,
+	0xffffffff00000000ULL,
+	0x00000000ffffffffULL,
+	0x0000ffff0000ffffULL,
+	0x00ff00ff00ff00ffULL,
+	0x0f0f0f0f0f0f0f0fULL,
+	0x3333333333333333ULL,
+	0x5555555555555555ULL,
+};
+
+/ 

*********************************************************************
/
+/* NAME: mem_test_data() - test data lines for shorts and
opens */

board/asp8347db/asp8347db.c new file +3 -0
+/*								     */
+/* DESCRIPTION:							     */
+/*   Tests data lines for shorts and opens by forcing adjacent  

data */
+/* to opposite states. Because the data lines could be routed

Quoted 8 lines

in */
+/* an arbitrary manner the must ensure test patterns ensure
that */
+/* every case is tested. By using the following series of
binary */
+/* patterns every combination of adjacent bits is test
regardless */
+/* of routing. */

Do we really need yet another copy of this code?

Quoted 4 lines

+/
*********************************************************************
/
+/* NAME: testdram() - calls any enabled memory tests */

...

Quoted 5 lines

This would be at least the 5th copy of this code.

Please don't do this. Let's clean this up and use one common verion - if needed at all, as there is other memtest code, too.

Well, there is not a common memory test code. I could move this to a common
area. But I'll only modify this board to use it; the rest is the job of their
respective maintainers.

Quoted 16 lines
Quoted 2 lines
board/asp8347db/fpga.c new file +0 -0

...

board/asp8347db/fpga.c

Quoted 9 lines
board/asp8347db/fpga.c new file +9 -0
+static void mdelay(int ms)
+{
+	ulong start = get_timer(0);
+	ulong delay;
+
+	delay = (ms * CFG_HZ) / 1000;
+	while (get_timer(start) < delay) {
+		udelay (1000);
+		WATCHDOG_RESET();	/* Trigger watchdog, if needed */

Note: this is redundant, as udelay() will already trigger the watchdog.

Nice catch - forgot it.

Quoted 10 lines

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Consistency requires you to be as ignorant today as you were a  year
ago."                                              - Bernard Berenson

Regards

Pantelis

#3 lore raw

PATCH 4/5 Support Analogue Micro's ASP8347DB board.

Dear Pantelis,

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

Well, here's the thing, if the board's DRAM is not soldered properly this will
probably trigger - think of it as a cheap memory test.

Well, you would see the unexpected size printed with the startup messages. That's something you should always look for: memory sizes, clock frequencies, etc.

Quoted 4 lines
Quoted 2 lines

Please don't do this. Let's clean this up and use one common verion - if needed at all, as there is other memtest code, too.

Well, there is not a common memory test code. I could move this to a

Wrong, there is.

First, there is common/memsize.c which includes a simple but pretty efficient (and fast) memory test.

Then there is common/cmd_mem.c with it's two different implementations of do_mem_mtest(), depending if CFG_ALT_MEMTEST is set or not.

And finally, there is post/memory.c which is where you copied the code from. Why didn't you use post/memory.c ?

Quoted 3 lines

area. But I'll only modify this board to use it; the rest is the job of their
respective maintainers.

Agreed.

Best regards,

Wolfgang Denk

Signature · 6 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The Buddha, the Godhead, resides quite as comfortably in the circuits
of a digital computer or the gears of a cycle transmission as he does
at the top of a mountain or in the petals of a flower.
            - R.  Pirsig, "Zen and the Art of Motorcycle Maintenance"