Skip to contentSkip to conversation

some dead code and redundant files for nios?

U-Boot Robert P. J. Day 1 participant 2 messages Feb 1, 2013 – Feb 2, 2013

lore
Share & tools
lore
#0 lore raw

another observation about header files, this time related to
nios/nios2:

$ grep -r CONFIG_NIOS *
arch/nios2/config.mk:PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
arch/nios2/cpu/epcs.c:#endif /* CONFIG_NIOS_EPCS */
board/psyent/common/AMDLV065D.c:#if defined(CONFIG_NIOS)  <-- ???
board/altera/common/AMDLV065D.c:#if defined(CONFIG_NIOS)  <-- ???
common/cmd_bdinfo.c:#elif defined(CONFIG_NIOS2)
examples/standalone/stubs.c:#elif defined(CONFIG_NIOS2)
$

first, given that there is no "nios" architecture anymore, isn't
that preprocessor test of:

  #if defined(CONFIG_NIOS)

in those two files always going to be false? the usage is:

#if defined(CONFIG_NIOS)
#include <nios.h>
#else
#include <asm/io.h>
#endif

and there *is* no nios.h file, anyway, so that pretty clearly looks like a removable test. more to the point, the same source file -- AMDLV065D.c -- is in two different directories, and they differ slightly:

$ diff board/{altera,psyent}/common/AMDLV065D.c
175c175
< 		writeb (b, dst);
---
Quoted 1 line
		writeb (dst, b);

$

that looks kind of weird, doesn't it? i haven't looked any more
closely but for two source files with the same name to have that single, subtle difference just looks strange.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw
Quoted 7 lines · Robert P. J. Day

... the same source file -- AMDLV065D.c -- is in two different directories, and they differ slightly:

$ diff board/{altera,psyent}/common/AMDLV065D.c
175c175
< 		writeb (b, dst);
---
Quoted 6 lines
Quoted 1 line
		writeb (dst, b);

$

that looks kind of weird, doesn't it? i haven't looked any more
closely but for two source files with the same name to have that single, subtle difference just looks strange.

i took a couple minutes with "git blame" to discover this:

$ git show 3d22d0b8
board/psyent/common/AMDLV065D.c +0 -0

... snip ...

-               *cmd = 0xaa;
-               *cmd = 0x55;
-               *cmd = 0xa0;
-               *dst = b;
+               writeb (cmd,  0xaa);
+               writeb (cmd,  0x55);
+               writeb (cmd,  0xa0);
+               writeb (dst, b);

... snip ...

while over in the (almost) identical file:

git show 9e486ab1
commit 9e486ab1c98ea7ab357520307fe5d5a0847cd1bb

Author: Scott McNutt <[email protected]>
Date:   Tue Mar 30 20:26:15 2010 -0400

nios2: Fix AMDLV065D flash write bug in altera board common tree.

board/altera/common/AMDLV065D.c +1 -1
index 72b0a9f..7a1b4d3 100644
@@ -172,7 +172,7 @@ int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
                writeb (0xaa, cmd);
                writeb (0x55, cmd);
                writeb (0xa0, cmd);
-               writeb (dst, b);
+               writeb (b, dst);
 
                /* Verify write */
                start = get_timer (0);

$

i don't know what the above is doing, but it would certainly seem
that if a flash write bug was being fixed in one of those files, it would be fixed in the other. beyond that, i cannot say.

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================