[U-Boot] [PATCH] LZMA: Avoid free on null pointer.

2010-12-05 Thread Luigi 'Comio' Mantellini
Hi ML,

This patch has been moved out from the previous [PATCH 0/6 v2] Support for 
Bootstrap Code patchset.

This change should be safe because just add some check in order to avoid some 
possible free on null pointers in the LZMA decoder initialization.
I noticed the error tracing all malloc/free of the code during a code profiling 
session.

Kindly, add this fix in the master branch.

best regards,

luigi

Luigi 'Comio' Mantellini (1):
  LZMA: Avoid free on null pointer.

 lib/lzma/LzmaDec.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

-- 
1.7.2.3

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


[U-Boot] [PATCH] LZMA: Avoid free on null pointer.

2010-12-05 Thread Luigi 'Comio' Mantellini
On structure Initialization, LZMA code tries to free the dictionary
and probs buffers, also when these are null pointers. Add some
check in order to prevent the free on null pointers.

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib/lzma/LzmaDec.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/lzma/LzmaDec.c b/lib/lzma/LzmaDec.c
index f941da2..e2dab44 100644
--- a/lib/lzma/LzmaDec.c
+++ b/lib/lzma/LzmaDec.c
@@ -960,7 +960,8 @@ static SRes LzmaDec_AllocateProbs2(CLzmaDec *p, const 
CLzmaProps *propNew, ISzAl
   UInt32 numProbs = LzmaProps_GetNumProbs(propNew);
   if (p-probs == 0 || numProbs != p-numProbs)
   {
-LzmaDec_FreeProbs(p, alloc);
+if (p-probs)
+  LzmaDec_FreeProbs(p, alloc);
 p-probs = (CLzmaProb *)alloc-Alloc(alloc, numProbs * sizeof(CLzmaProb));
 p-numProbs = numProbs;
 if (p-probs == 0)
@@ -987,7 +988,8 @@ SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, 
unsigned propsSize, ISzAll
   dicBufSize = propNew.dicSize;
   if (p-dic == 0 || dicBufSize != p-dicBufSize)
   {
-LzmaDec_FreeDict(p, alloc);
+if (p-dic)
+  LzmaDec_FreeDict(p, alloc);
 p-dic = (Byte *)alloc-Alloc(alloc, dicBufSize);
 if (p-dic == 0)
 {
-- 
1.7.2.3

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


[U-Boot] [PATCH] Enable garbage collection of unused input sections.

2010-12-05 Thread Luigi 'Comio' Mantellini
: Removing unused section '.text.is_valid_ether_addr' in 
file 'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.post_word_load' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.post_word_store' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.getenv_IPaddr' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.NetCopyLong' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.NetCopyIP' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.NetWriteIP' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.NetReadLong' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.NetReadIP' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section 
'.text.fit_image_check_target_arch' in file 'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.fit_get_name' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.image_set_name' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.fdt_setprop_cell' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.fdt_property_cell' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.fdt_setprop_inplace_cell' 
in file 'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.fdt_getprop_w' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.fdt_get_property_w' in 
file 'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.fdt_offset_ptr_w' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.virt_to_phys' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.map_physmem' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.__swab64p' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.text.__swab64s' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.sdata.otherpattern' in file 
'post/libpost.o'
powerpc-linux-gnu-ld: Removing unused section '.eh_frame' in file 
'../lib/gcc/powerpc-linux-gnu/4.4.1/nof/libgcc.a(_udivdi3.o)'
powerpc-linux-gnu-ld: Removing unused section '.eh_frame' in file 
'../lib/gcc/powerpc-linux-gnu/4.4.1/nof/libgcc.a(_umoddi3.o)'


Any comments is welcome.

best regards,

luigi


Luigi 'Comio' Mantellini (1):
  Enable garbage collection of unused input sections.

 config.mk |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

-- 
1.7.3

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


[U-Boot] [PATCH] Enable garbage collection of unused input sections.

2010-12-05 Thread Luigi 'Comio' Mantellini
When available, enable the CC -ffunction-sections/-fdata-sections options and
the LD --gc-sections in order to isolate and remove from final executable the
unused functions.

From ld manpages:

--gc-sections
--no-gc-sections

Enable garbage collection of unused input sections. It is ignored on targets
that do not support this option. The default behaviour (of not performing this
garbage collection) can be restored by specifying --no-gc-sections on the
command line.

--gc-sections decides which input sections are used by examining symbols and
relocations. The section containing the entry symbol and all sections
containing symbols undefined on the command-line will be kept, as will sections
containing symbols referenced by dynamic objects. Note that when building shared
libraries, the linker must assume that any visible symbol is referenced. Once
this initial set of sections has been determined, the linker recursively marks
as used any section referenced by their relocations. See --entry and 
--undefined.

From gcc manpages:

-ffunction-sections
-fdata-sections

Place each function or data item into its own section in the output file if the
target supports arbitrary sections.  The name of the function or the name of the
data item determines the section's name in the output file.

Use these options on systems where the linker can perform optimizations to
improve locality of reference in the instruction space.  Most systems using the
ELF object format and SPARC processors running Solaris 2 have linkers with such
optimizations. AIX may have these optimizations in the future.

Only use these options when there are significant benefits from doing so.  When
you specify these options, the assembler and linker will create larger object
and executable files and will also be slower. You will not be able to use 
gprof
on all systems if you specify this option and you may have problems with
debugging if you specify both this option and -g.

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 config.mk |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/config.mk b/config.mk
index c6d6f7b..94ca033 100644
--- a/config.mk
+++ b/config.mk
@@ -97,6 +97,8 @@ HOSTCFLAGS+= -pedantic
 #
 cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
 /dev/null 21; then echo $(1); else echo $(2); fi ;)
+ld-option = $(shell if $(CC) -Wl,$(1) -nostdlib -xc /dev/null -o /dev/null \
+/dev/null 21; then echo $(1); else echo $(2); fi ;)
 
 #
 # Include the make variables (CC, etc...)
@@ -191,6 +193,13 @@ endif
 
 CFLAGS += $(call cc-option,-fno-stack-protector)
 
+# Create a section for each function or data (useful for sections garbage 
collector)
+CFLAGS += $(call cc-option,-ffunction-sections)
+CFLAGS += $(call cc-option,-fdata-sections)
+
+# Enable sections garbage collector
+LDFLAGS += $(call ld-option,--gc-sections)
+
 # $(CPPFLAGS) sets -g, which causes gcc to pass a suitable -gformat
 # option to the assembler.
 AFLAGS_DEBUG :=
-- 
1.7.3

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


[U-Boot] [PATCH 2/2] Add XZ compressed uImage support

2010-12-05 Thread Luigi 'Comio' Mantellini
This patch permits to use XZ compressed uImages using the XZ embedded library
code.

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 common/cmd_bootm.c |   27 +--
 common/image.c |1 +
 include/image.h|1 +
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 1a024f1..066b908 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -61,6 +61,10 @@
 #include linux/lzo.h
 #endif /* CONFIG_LZO */
 
+#ifdef CONFIG_XZ
+#include unxz.h
+#endif /* CONFIG_XZ */
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifndef CONFIG_SYS_BOOTM_LEN
@@ -338,9 +342,9 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
ulong image_start = os.image_start;
ulong image_len = os.image_len;
uint unc_len = CONFIG_SYS_BOOTM_LEN;
-#if defined(CONFIG_LZMA) || defined(CONFIG_LZO)
+#if defined(CONFIG_LZMA) || defined(CONFIG_LZO) || defined(CONFIG_XZ)
int ret;
-#endif /* defined(CONFIG_LZMA) || defined(CONFIG_LZO) */
+#endif /* defined(CONFIG_LZMA) || defined(CONFIG_LZO) || defined(CONFIG_XZ) */
 
const char *type_name = genimg_get_type_name (os.type);
 
@@ -430,6 +434,25 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
*load_end = load + unc_len;
break;
 #endif /* CONFIG_LZO */
+#ifdef CONFIG_XZ
+   case IH_COMP_XZ: {
+   int in_used = unc_len;
+   printf (   Uncompressing %s ... , type_name);
+   ret = unxz(
+   (unsigned char *)image_start, image_len,
+   (unsigned char *)load, in_used);
+   unc_len = in_used;
+   if (ret != 0) {
+   printf (XZ: uncompress or overwrite error %d 
+   - must RESET board to recover\n, ret);
+   show_boot_progress (-6);
+   return BOOTM_ERR_RESET;
+   }
+   *load_end = load + unc_len;
+   break;
+   }
+   break;
+#endif /* CONFIG_XZ */
default:
printf (Unimplemented compression type %d\n, comp);
return BOOTM_ERR_UNIMPLEMENTED;
diff --git a/common/image.c b/common/image.c
index 42f5b79..4e31691 100644
--- a/common/image.c
+++ b/common/image.c
@@ -150,6 +150,7 @@ static table_entry_t uimage_comp[] = {
{   IH_COMP_GZIP,   gzip, gzip compressed,  },
{   IH_COMP_LZMA,   lzma, lzma compressed,  },
{   IH_COMP_LZO,lzo,  lzo compressed,   },
+   {   IH_COMP_XZ, xz,   xz compressed,},
{   -1, , , },
 };
 
diff --git a/include/image.h b/include/image.h
index 49d6280..5ba5afa 100644
--- a/include/image.h
+++ b/include/image.h
@@ -166,6 +166,7 @@
 #define IH_COMP_BZIP2  2   /* bzip2 Compression Used   */
 #define IH_COMP_LZMA   3   /* lzma  Compression Used   */
 #define IH_COMP_LZO4   /* lzo   Compression Used   */
+#define IH_COMP_XZ 5   /* xzCompression Used   */
 
 #define IH_MAGIC   0x27051956  /* Image Magic Number   */
 #define IH_NMLEN   32  /* Image Name Length*/
-- 
1.7.3

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


[U-Boot] [PATCH 2/6 v2] LZMA: Avoid free on null pointer

2010-12-04 Thread Luigi 'Comio' Mantellini

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib/lzma/LzmaDec.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/lzma/LzmaDec.c b/lib/lzma/LzmaDec.c
index f941da2..b2a3aec 100644
--- a/lib/lzma/LzmaDec.c
+++ b/lib/lzma/LzmaDec.c
@@ -913,7 +913,9 @@ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT 
*destLen, const Byte *sr
 
 void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
 {
-  alloc-Free(alloc, p-probs);
+  if (p-probs) {
+alloc-Free(alloc, p-probs);
+  }
   p-probs = 0;
 }
 
-- 
1.7.3

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


[U-Boot] [PATCH 3/6 v2] Enable garbage collelction of unused input sections.

2010-12-04 Thread Luigi 'Comio' Mantellini
When available, enable the CC -ffunction-sections option and the LD 
--gc-sections in order to isolate and remove from final executable the unused 
functions.

From ld manpages:

--gc-sections
--no-gc-sections

Enable garbage collection of unused input sections.  It is ignored on targets 
that do not support this option.  The default behaviour (of not performing this 
garbage collection) can be restored by specifying --no-gc-sections on the 
command line.

--gc-sections decides which input sections are used by examining symbols and 
relocations.  The section containing the entry symbol and all sections 
containing symbols undefined on the command-line will be kept, as will sections 
containing symbols referenced by dynamic objects.  Note that when building 
shared libraries, the linker must assume that any visible symbol is referenced. 
 Once this initial set of sections has been determined, the linker recursively 
marks as used any section referenced by their relocations.  See --entry and 
--undefined.

From gcc manpages:

-ffunction-sections
-fdata-sections

Place each function or data item into its own section in the output file if the 
target supports arbitrary sections.  The name of the function or the name of 
the data item determines the section's name in the output file.

Use these options on systems where the linker can perform optimizations to 
improve locality of reference in the instruction space.  Most systems using the 
ELF object format and SPARC processors running Solaris 2 have linkers with such 
optimizations.  AIX may have these optimizations in the future.

Only use these options when there are significant benefits from doing so.  When 
you specify these options, the assembler and linker will create larger object 
and executable files and will also be slower. You will not be able to use 
gprof on all systems if you specify this option and you may have problems 
with debugging if you specify both this option and -g.

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 config.mk |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/config.mk b/config.mk
index c6d6f7b..591b490 100644
--- a/config.mk
+++ b/config.mk
@@ -23,6 +23,10 @@
 
 #
 
+comma := ,
+empty :=
+space := $(empty) $(empty)
+
 ifneq ($(OBJTREE),$(SRCTREE))
 ifeq ($(CURDIR),$(SRCTREE))
 dir :=
@@ -97,6 +101,8 @@ HOSTCFLAGS   += -pedantic
 #
 cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
 /dev/null 21; then echo $(1); else echo $(2); fi ;)
+ld-option = $(shell if $(CC) -Wl$(comma)$(1) -nostdlib -xc /dev/null -o 
/dev/null \
+/dev/null 21; then echo $(1); else echo $(2); fi ;)
 
 #
 # Include the make variables (CC, etc...)
@@ -191,6 +197,13 @@ endif
 
 CFLAGS += $(call cc-option,-fno-stack-protector)
 
+# Create a section for each function or data (useful for sections garbage 
collector)
+CFLAGS += $(call cc-option,-ffunction-sections)
+CFLAGS += $(call cc-option,-fdata-sections)
+
+# Sections garbage collector
+LDFLAGS += $(call ld-option,--gc-sections)
+
 # $(CPPFLAGS) sets -g, which causes gcc to pass a suitable -gformat
 # option to the assembler.
 AFLAGS_DEBUG :=
-- 
1.7.3

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


[U-Boot] [PATCH 0/6 v2] Support for Bootstrap Code

2010-12-04 Thread Luigi 'Comio' Mantellini
The following patch set add the support for Bootstrap code.
This permits to have a compressed full featured U-Boot binary.

See README file in the U-Boot root.

The patchset includes also the XZ format support and a fix to LZMA code.

Luigi 'Comio' Mantellini (6):
  Add support for XZ decompression algorithm.
  LZMA: Avoid free on null pointer
  Enable garbage collelction of unused input sections.
  Add support for Bootstrap infrastructure.
  Enable bootstrap support for MIPS architecture.
  Enable bootstrap code for QEMU-MIPS board.

 .gitignore|   25 +-
 Makefile  |  175 +-
 README|   56 ++
 arch/mips/config.mk   |2 +-
 arch/mips/cpu/Makefile|   28 +-
 arch/mips/cpu/cpu.c   |   12 -
 arch/mips/cpu/reset.c |   39 ++
 arch/mips/cpu/reset_bootstrap.c   |   39 ++
 arch/mips/cpu/start_bootstrap.S   |  455 +
 arch/mips/lib/Makefile|   15 +-
 arch/mips/lib/board_bootstrap.c   |  331 +
 board/qemu-mips/Makefile  |   15 +-
 board/qemu-mips/config.mk |7 +-
 board/qemu-mips/qemu-mips_bootstrap.c |   48 ++
 board/qemu-mips/u-boot-bootstrap.lds  |   73 ++
 common/Makefile   |   16 +-
 common/cmd_bootm.c|   27 +-
 common/console_bootstrap.c|   85 +++
 common/image.c|1 +
 config.mk |   29 +
 include/bootstrap.h   |   59 ++
 include/common.h  |   21 +
 include/configs/qemu-mips.h   |   15 +-
 include/image.h   |1 +
 include/unxz.h|   16 +
 include/xz.h  |  237 +++
 lib/Makefile  |   29 +-
 lib/bootstrap.c   |   97 +++
 lib/lzma/LzmaDec.c|4 +-
 lib/lzma/Makefile |4 +-
 lib/lzo/Makefile  |4 +-
 lib/xz/Makefile   |   53 ++
 lib/xz/decompress_unxz.c  |  231 +++
 lib/xz/xz_dec_bcj.c   |  564 
 lib/xz/xz_dec_lzma2.c | 1175 +
 lib/xz/xz_dec_stream.c|  823 +++
 lib/xz/xz_lzma2.h |  204 ++
 lib/xz/xz_private.h   |  154 +
 lib/xz/xz_stream.h|   50 ++
 tools/xz_wrap.sh  |   45 ++
 40 files changed, 5232 insertions(+), 32 deletions(-)
 create mode 100644 arch/mips/cpu/reset.c
 create mode 100644 arch/mips/cpu/reset_bootstrap.c
 create mode 100644 arch/mips/cpu/start_bootstrap.S
 create mode 100644 arch/mips/lib/board_bootstrap.c
 create mode 100644 board/qemu-mips/qemu-mips_bootstrap.c
 create mode 100644 board/qemu-mips/u-boot-bootstrap.lds
 create mode 100644 common/console_bootstrap.c
 create mode 100644 include/bootstrap.h
 create mode 100644 include/unxz.h
 create mode 100644 include/xz.h
 create mode 100644 lib/bootstrap.c
 create mode 100644 lib/xz/Makefile
 create mode 100644 lib/xz/decompress_unxz.c
 create mode 100644 lib/xz/xz_dec_bcj.c
 create mode 100644 lib/xz/xz_dec_lzma2.c
 create mode 100644 lib/xz/xz_dec_stream.c
 create mode 100644 lib/xz/xz_lzma2.h
 create mode 100644 lib/xz/xz_private.h
 create mode 100644 lib/xz/xz_stream.h
 create mode 100755 tools/xz_wrap.sh

-- 
1.7.3

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


[U-Boot] [PATCH 4/6 v2] Add support for Bootstrap infrastructure.

2010-12-04 Thread Luigi 'Comio' Mantellini
See README file for details regarding ho bootstrap code works.

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 .gitignore |   25 ++-
 Makefile   |  174 +++-
 README |   47 
 common/Makefile|   16 -
 common/console_bootstrap.c |   85 +
 config.mk  |   16 
 include/bootstrap.h|   59 +++
 include/common.h   |   21 +
 lib/Makefile   |   29 +++-
 lib/bootstrap.c|   97 
 lib/lzma/Makefile  |4 +-
 lib/lzo/Makefile   |4 +-
 lib/xz/Makefile|4 +-
 tools/xz_wrap.sh   |   45 +++
 14 files changed, 618 insertions(+), 8 deletions(-)
 create mode 100644 common/console_bootstrap.c
 create mode 100644 include/bootstrap.h
 create mode 100644 lib/bootstrap.c
 create mode 100755 tools/xz_wrap.sh

diff --git a/.gitignore b/.gitignore
index e71f6ac..8db8f0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,12 @@
 /u-boot.hex
 /u-boot.map
 /u-boot.bin
+/u-boot.bin.bz2
+/u-boot.bin.gz
+/u-boot.bin.lzma
+/u-boot.bin.lzo
+/u-boot.bin.xz
+/u-boot.dis
 /u-boot.srec
 /u-boot.ldr
 /u-boot.ldr.hex
@@ -30,6 +36,20 @@
 /u-boot.lds
 /u-boot-onenand.bin
 /u-boot-flexonenand.bin
+/u-boot-bootstrap
+/u-boot-bootstrap.hex
+/u-boot-bootstrap.map
+/u-boot-bootstrap.bin
+/u-boot-bootstrap.bin.bz2
+/u-boot-bootstrap.bin.gz
+/u-boot-bootstrap.bin.lzma
+/u-boot-bootstrap.bin.lzo
+/u-boot-bootstrap.dis
+/u-boot-bootstrap.srec
+/u-boot-bootstrap.ldr
+/u-boot-bootstrap.ldr.hex
+/u-boot-bootstrap.ldr.srec
+/u-boot-bootstrap.lds
 
 #
 # Generated files
@@ -39,7 +59,7 @@
 /LOG
 /errlog
 /reloc_off
-
+/.payload.s
 /include/generated/
 /lib/asm-offsets.s
 
@@ -66,3 +86,6 @@ cscope.*
 /onenand_ipl/onenand-ipl*
 /onenand_ipl/board/*/onenand*
 /onenand_ipl/board/*/*.S
+examples/standalone/
+
+setvars
diff --git a/Makefile b/Makefile
index ba832a4..cbd9a57 100644
--- a/Makefile
+++ b/Makefile
@@ -180,6 +180,13 @@ endif
 
 OBJS := $(addprefix $(obj),$(OBJS))
 
+ifeq ($(CONFIG_BOOTSTRAP),y)
+BOOTSTRAP_OBJS  = $(CPUDIR)/start_bootstrap.o
+
+BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_OBJS))
+endif
+
+
 LIBS  = lib/libgeneric.o
 LIBS += lib/lzma/liblzma.o
 LIBS += lib/lzo/liblzo.o
@@ -270,6 +277,24 @@ LIBS := $(addprefix $(obj),$(sort $(LIBS)))
 LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).o
 LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
 
+ifeq ($(CONFIG_BOOTSTRAP),y)
+BOOTSTRAP_LIBS =  lib/libgeneric_bootstrap.o
+BOOTSTRAP_LIBS += arch/$(ARCH)/cpu/lib$(ARCH)_bootstrap.o
+BOOTSTRAP_LIBS += arch/$(ARCH)/lib/lib$(ARCH)_bootstrap.o
+BOOTSTRAP_LIBS += common/libcommon_bootstrap.o
+BOOTSTRAP_LIBS += drivers/serial/libserial.o
+
+BOOTSTRAP_LIBS-$(CONFIG_BOOTSTRAP_LZMA) += lib/lzma/liblzma.o
+BOOTSTRAP_LIBS-$(CONFIG_BOOTSTRAP_LZO) += lib/lzo/liblzo.o
+BOOTSTRAP_LIBS-$(CONFIG_BOOTSTRAP_XZ) += lib/xz/libxz.o
+BOOTSTRAP_LIBS += $(BOOTSTRAP_LIBS-y)
+
+.PHONY : $(BOOTSTRAP_LIBS)
+
+BOOTSTRAP_LIBBOARD = board/$(BOARDDIR)/lib$(BOARD)_bootstrap.o
+BOOTSTRAP_LIBBOARD := $(addprefix $(obj),$(BOOTSTRAP_LIBBOARD))
+endif
+
 # Add GCC lib
 ifdef USE_PRIVATE_LIBGCC
 ifeq ($(USE_PRIVATE_LIBGCC), yes)
@@ -283,6 +308,9 @@ endif
 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 export PLATFORM_LIBS
 
+BOOTSTRAP_PLATFORM_LIBS += $(PLATFORM_LIBGCC)
+export BOOTSTRAP_PLATFORM_LIBS
+
 # Special flags for CPP when processing the linker script.
 # Pass the version down so we can handle backwards compatibility
 # on the fly.
@@ -305,6 +333,9 @@ endif
 __OBJS := $(subst $(obj),,$(OBJS))
 __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
 
+__BOOTSTRAP_OBJS := $(subst $(obj),,$(BOOTSTRAP_OBJS))
+__BOOTSTRAP_LIBS := $(subst $(obj),,$(BOOTSTRAP_LIBS)) $(subst 
$(obj),,$(BOOTSTRAP_LIBBOARD))
+
 #
 #
 
@@ -326,6 +357,10 @@ endif
 # Always append ALL so that arch config.mk's can add custom ones
 ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) 
$(U_BOOT_ONENAND)
 
+ifeq ($(CONFIG_BOOTSTRAP),y)
+ALL += $(obj)u-boot-bootstrap.srec $(obj)u-boot-bootstrap.bin
+endif
+
 all:   $(ALL)
 
 $(obj)u-boot.hex:  $(obj)u-boot
@@ -338,6 +373,21 @@ $(obj)u-boot.bin:  $(obj)u-boot
$(OBJCOPY) ${OBJCFLAGS} -O binary $ $@
$(BOARD_SIZE_CHECK)
 
+$(obj)u-boot.bin.gz:   $(obj)u-boot.bin
+   gzip -c $  $@
+
+$(obj)u-boot.bin.lzma: $(obj)u-boot.bin
+   lzma -e -z -c $  $@
+
+$(obj)u-boot.bin.xz:  $(obj)u-boot.bin
+   tools/xz_wrap.sh misc  $  $@
+
+$(obj)u-boot.bin.lzo:  $(obj)u-boot.bin
+   lzop -9 -c $  $@
+
+$(obj)u-boot.bin.bz2:  $(obj)u-boot.bin
+   bzip2 --best -z -c $  $@
+
 $(obj)u-boot.ldr:  $(obj)u-boot

[U-Boot] [PATCH 5/6 v2] Enable bootstrap support for MIPS architecture.

2010-12-04 Thread Luigi 'Comio' Mantellini

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 arch/mips/config.mk |2 +-
 arch/mips/cpu/Makefile  |   28 ++-
 arch/mips/cpu/cpu.c |   12 -
 arch/mips/cpu/reset.c   |   39 
 arch/mips/cpu/reset_bootstrap.c |   39 
 arch/mips/cpu/start_bootstrap.S |  455 +++
 arch/mips/lib/Makefile  |   15 ++-
 arch/mips/lib/board_bootstrap.c |  331 
 8 files changed, 903 insertions(+), 18 deletions(-)
 create mode 100644 arch/mips/cpu/reset.c
 create mode 100644 arch/mips/cpu/reset_bootstrap.c
 create mode 100644 arch/mips/cpu/start_bootstrap.S
 create mode 100644 arch/mips/lib/board_bootstrap.c

diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index aa06761..4655169 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -47,6 +47,6 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 # On the other hand, we want PIC in the U-Boot code to relocate it from ROM
 # to RAM. $28 is always used as gp.
 #
-PLATFORM_CPPFLAGS  += -G 0 -mabicalls -fpic
+PLATFORM_CPPFLAGS  += -G 0 -mabicalls -fpic -g
 PLATFORM_CPPFLAGS  += -msoft-float
 PLATFORM_LDFLAGS   += -G 0 -static -n -nostdlib
diff --git a/arch/mips/cpu/Makefile b/arch/mips/cpu/Makefile
index 06df8d1..6a9a2af 100644
--- a/arch/mips/cpu/Makefile
+++ b/arch/mips/cpu/Makefile
@@ -24,25 +24,45 @@
 include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(CPU).o
+BOOTSTRAP_LIB = $(obj)lib$(CPU)_bootstrap.o
+
+BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB)
 
 START  = start.o
 SOBJS-y= cache.o
-COBJS-y= cpu.o interrupts.o
+COBJS-y= cpu.o reset.o interrupts.o
 
 SOBJS-$(CONFIG_INCA_IP)+= incaip_wdt.o
 COBJS-$(CONFIG_INCA_IP)+= asc_serial.o incaip_clock.o
+COBJS-$(CONFIG_IFX_ASC) += ifx_asc.o
 COBJS-$(CONFIG_PURPLE) += asc_serial.o
 COBJS-$(CONFIG_SOC_AU1X00) += au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o
 
-SRCS   := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+BOOTSTRAP_START = start_bootstrap.o
+BOOTSTRAP_START-$(CONFIG_BOOTSTRAP) += $(BOOTSTRAP_START)
+BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += cpu.o interrupts.o reset_bootstrap.o
+BOOTSTRAP_SOBJS-$(CONFIG_BOOTSTRAP) += cache.o
+BOOTSTRAP_COBJS-$(CONFIG_IFX_ASC) += ifx_asc.o
+
+BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_SOBJS-y) $(BOOTSTRAP_COBJS-y))
+BOOTSTRAP_START:= $(addprefix $(obj),$(BOOTSTRAP_START-y))
+
+SRCS   := $(sort $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) 
$(BOOTSTRAP_START-y:.o=.S) $(BOOTSTRAP_SOBJS-y:.o=.S) 
$(BOOTSTRAP_COBJS-y:.o=.c))
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
 START  := $(addprefix $(obj),$(START))
 
-all:   $(obj).depend $(START) $(LIB)
+all:   $(START) $(LIB) $(BOOTSTRAP_START-y) $(BOOTSTRAP_LIB-y)
 
-$(LIB):$(OBJS)
+$(START):  $(obj).depend
+
+$(LIB):$(obj).depend $(OBJS)
$(call cmd_link_o_target, $(OBJS))
 
+$(BOOTSTRAP_START):$(obj).depend
+
+$(BOOTSTRAP_LIB):  $(obj).depend $(BOOTSTRAP_OBJS)
+   $(call cmd_link_o_target, $(BOOTSTRAP_OBJS))
+
 #
 
 # defines $(obj).depend target
diff --git a/arch/mips/cpu/cpu.c b/arch/mips/cpu/cpu.c
index 3ae397c..45bf07c 100644
--- a/arch/mips/cpu/cpu.c
+++ b/arch/mips/cpu/cpu.c
@@ -38,18 +38,6 @@
:   \
: i (op), R (*(unsigned char *)(addr)))
 
-void __attribute__((weak)) _machine_restart(void)
-{
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   _machine_restart();
-
-   fprintf(stderr, *** reset failed ***\n);
-   return 0;
-}
-
 void flush_cache(ulong start_addr, ulong size)
 {
unsigned long lsize = CONFIG_SYS_CACHELINE_SIZE;
diff --git a/arch/mips/cpu/reset.c b/arch/mips/cpu/reset.c
new file mode 100644
index 000..397fb62
--- /dev/null
+++ b/arch/mips/cpu/reset.c
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2003
+ * 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 common.h
+#include command.h
+#include asm/mipsregs.h

[U-Boot] [PATCH 6/6 v2] Enable bootstrap code for QEMU-MIPS board.

2010-12-04 Thread Luigi 'Comio' Mantellini

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 board/qemu-mips/Makefile  |   15 ++-
 board/qemu-mips/config.mk |7 ++-
 board/qemu-mips/qemu-mips_bootstrap.c |   48 +
 board/qemu-mips/u-boot-bootstrap.lds  |   73 +
 include/configs/qemu-mips.h   |   15 ++-
 5 files changed, 154 insertions(+), 4 deletions(-)
 create mode 100644 board/qemu-mips/qemu-mips_bootstrap.c
 create mode 100644 board/qemu-mips/u-boot-bootstrap.lds

diff --git a/board/qemu-mips/Makefile b/board/qemu-mips/Makefile
index 6251bb8..bcb6fd5 100644
--- a/board/qemu-mips/Makefile
+++ b/board/qemu-mips/Makefile
@@ -24,17 +24,30 @@
 include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
+BOOTSTRAP_LIB = $(obj)lib$(BOARD)_bootstrap.o
+
+BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB)
 
 COBJS  = $(BOARD).o
 SOBJS  = lowlevel_init.o
 
-SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) = $(BOARD)_bootstrap.o
+BOOTSTRAP_SOBJS-$(CONFIG_BOOTSTRAP) = lowlevel_init.o
+
+BOOTSTRAP_SRCS := $(BOOTSTRAP_SOBJS-y:.o=.S) $(BOOTSTRAP_COBJS-y:.o=.c)
+BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_COBJS-y))
+BOOTSTRAP_SOBJS:= $(addprefix $(obj),$(BOOTSTRAP_SOBJS-y))
+
+SRCS   := $(sort $(SOBJS:.o=.S) $(COBJS:.o=.c) $(BOOTSTRAP_SOBJS))
 OBJS   := $(addprefix $(obj),$(COBJS))
 SOBJS  := $(addprefix $(obj),$(SOBJS))
 
 $(LIB): $(OBJS) $(SOBJS)
$(call cmd_link_o_target, $(OBJS) $(SOBJS))
 
+$(BOOTSTRAP_LIB):   $(BOOTSTRAP_OBJS) $(BOOTSTRAP_SOBJS)
+   $(call cmd_link_o_target, $(BOOTSTRAP_OBJS) $(BOOTSTRAP_SOBJS))
+
 #
 
 # defines $(obj).depend target
diff --git a/board/qemu-mips/config.mk b/board/qemu-mips/config.mk
index 27cd34a..50276ff 100644
--- a/board/qemu-mips/config.mk
+++ b/board/qemu-mips/config.mk
@@ -3,8 +3,11 @@
 # See http://fabrice.bellard.free.fr/qemu
 #
 
+ifeq ($(CONFIG_BOOTSTRAP),)
 # ROM version
 CONFIG_SYS_TEXT_BASE = 0xbfc0
-
+else
 # RAM version
-#CONFIG_SYS_TEXT_BASE = 0x80001000
+CONFIG_SYS_TEXT_BASE = 0x80001000
+CONFIG_BOOTSTRAP_TEXT_BASE = 0xbfc0
+endif
\ No newline at end of file
diff --git a/board/qemu-mips/qemu-mips_bootstrap.c 
b/board/qemu-mips/qemu-mips_bootstrap.c
new file mode 100644
index 000..e139d67
--- /dev/null
+++ b/board/qemu-mips/qemu-mips_bootstrap.c
@@ -0,0 +1,48 @@
+/*
+ * (C) Copyright 2010 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini, luigi.mantell...@idf-hit.com
+ *
+ * (C) Copyright 2007
+ * Vlad Lungu vlad.lu...@windriver.com
+ *
+ * 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 command.h
+#include asm/mipsregs.h
+#include asm/io.h
+
+phys_size_t bootstrap_initdram(int board_type)
+{
+   /* Sdram is setup by assembler code */
+   /* If memory could be changed, we should return the true value here */
+   return MEM_SIZE*1024*1024;
+}
+
+int bootstrap_checkboard(void)
+{
+   return 0;
+}
+
+int bootstrap_misc_init_r(void)
+{
+   set_io_port_base(0);
+   return 0;
+}
diff --git a/board/qemu-mips/u-boot-bootstrap.lds 
b/board/qemu-mips/u-boot-bootstrap.lds
new file mode 100644
index 000..0e74580
--- /dev/null
+++ b/board/qemu-mips/u-boot-bootstrap.lds
@@ -0,0 +1,73 @@
+/*
+ * (C) Copyright 2010 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini, luigi.mantell...@idf-hit.com
+ *
+ * (C) Copyright 2003
+ * Wolfgang Denk 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

[U-Boot] [PATCH 0/6 v2] Support for Bootstrap Code

2010-12-04 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

The following patch set add the support for Bootstrap code.
This permits to have a compressed full featured U-Boot binary.

See README file in the U-Boot root.

The patchset includes also the XZ format support and a fix to LZMA code.

Luigi 'Comio' Mantellini (6):
  Add support for XZ decompression algorithm.
  LZMA: Avoid free on null pointer
  Enable garbage collelction of unused input sections.
  Add support for Bootstrap infrastructure.
  Enable bootstrap support for MIPS architecture.
  Enable bootstrap code for QEMU-MIPS board.

 .gitignore|   25 +-
 Makefile  |  175 +-
 README|   56 ++
 arch/mips/config.mk   |2 +-
 arch/mips/cpu/Makefile|   28 +-
 arch/mips/cpu/cpu.c   |   12 -
 arch/mips/cpu/reset.c |   39 ++
 arch/mips/cpu/reset_bootstrap.c   |   39 ++
 arch/mips/cpu/start_bootstrap.S   |  455 +
 arch/mips/lib/Makefile|   15 +-
 arch/mips/lib/board_bootstrap.c   |  331 +
 board/qemu-mips/Makefile  |   15 +-
 board/qemu-mips/config.mk |7 +-
 board/qemu-mips/qemu-mips_bootstrap.c |   48 ++
 board/qemu-mips/u-boot-bootstrap.lds  |   73 ++
 common/Makefile   |   16 +-
 common/cmd_bootm.c|   27 +-
 common/console_bootstrap.c|   85 +++
 common/image.c|1 +
 config.mk |   29 +
 include/bootstrap.h   |   59 ++
 include/common.h  |   21 +
 include/configs/qemu-mips.h   |   15 +-
 include/image.h   |1 +
 include/unxz.h|   16 +
 include/xz.h  |  237 +++
 lib/Makefile  |   29 +-
 lib/bootstrap.c   |   97 +++
 lib/lzma/LzmaDec.c|4 +-
 lib/lzma/Makefile |4 +-
 lib/lzo/Makefile  |4 +-
 lib/xz/Makefile   |   53 ++
 lib/xz/decompress_unxz.c  |  231 +++
 lib/xz/xz_dec_bcj.c   |  564 
 lib/xz/xz_dec_lzma2.c | 1175 +
 lib/xz/xz_dec_stream.c|  823 +++
 lib/xz/xz_lzma2.h |  204 ++
 lib/xz/xz_private.h   |  154 +
 lib/xz/xz_stream.h|   50 ++
 tools/xz_wrap.sh  |   45 ++
 40 files changed, 5232 insertions(+), 32 deletions(-)
 create mode 100644 arch/mips/cpu/reset.c
 create mode 100644 arch/mips/cpu/reset_bootstrap.c
 create mode 100644 arch/mips/cpu/start_bootstrap.S
 create mode 100644 arch/mips/lib/board_bootstrap.c
 create mode 100644 board/qemu-mips/qemu-mips_bootstrap.c
 create mode 100644 board/qemu-mips/u-boot-bootstrap.lds
 create mode 100644 common/console_bootstrap.c
 create mode 100644 include/bootstrap.h
 create mode 100644 include/unxz.h
 create mode 100644 include/xz.h
 create mode 100644 lib/bootstrap.c
 create mode 100644 lib/xz/Makefile
 create mode 100644 lib/xz/decompress_unxz.c
 create mode 100644 lib/xz/xz_dec_bcj.c
 create mode 100644 lib/xz/xz_dec_lzma2.c
 create mode 100644 lib/xz/xz_dec_stream.c
 create mode 100644 lib/xz/xz_lzma2.h
 create mode 100644 lib/xz/xz_private.h
 create mode 100644 lib/xz/xz_stream.h
 create mode 100755 tools/xz_wrap.sh

-- 
1.7.3

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


[U-Boot] [PATCH 4/6 v2] Add support for Bootstrap infrastructure.

2010-12-04 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

See README file for details regarding ho bootstrap code works.

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 .gitignore |   25 ++-
 Makefile   |  174 +++-
 README |   47 
 common/Makefile|   16 -
 common/console_bootstrap.c |   85 +
 config.mk  |   16 
 include/bootstrap.h|   59 +++
 include/common.h   |   21 +
 lib/Makefile   |   29 +++-
 lib/bootstrap.c|   97 
 lib/lzma/Makefile  |4 +-
 lib/lzo/Makefile   |4 +-
 lib/xz/Makefile|4 +-
 tools/xz_wrap.sh   |   45 +++
 14 files changed, 618 insertions(+), 8 deletions(-)
 create mode 100644 common/console_bootstrap.c
 create mode 100644 include/bootstrap.h
 create mode 100644 lib/bootstrap.c
 create mode 100755 tools/xz_wrap.sh

diff --git a/.gitignore b/.gitignore
index e71f6ac..8db8f0f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,12 @@
 /u-boot.hex
 /u-boot.map
 /u-boot.bin
+/u-boot.bin.bz2
+/u-boot.bin.gz
+/u-boot.bin.lzma
+/u-boot.bin.lzo
+/u-boot.bin.xz
+/u-boot.dis
 /u-boot.srec
 /u-boot.ldr
 /u-boot.ldr.hex
@@ -30,6 +36,20 @@
 /u-boot.lds
 /u-boot-onenand.bin
 /u-boot-flexonenand.bin
+/u-boot-bootstrap
+/u-boot-bootstrap.hex
+/u-boot-bootstrap.map
+/u-boot-bootstrap.bin
+/u-boot-bootstrap.bin.bz2
+/u-boot-bootstrap.bin.gz
+/u-boot-bootstrap.bin.lzma
+/u-boot-bootstrap.bin.lzo
+/u-boot-bootstrap.dis
+/u-boot-bootstrap.srec
+/u-boot-bootstrap.ldr
+/u-boot-bootstrap.ldr.hex
+/u-boot-bootstrap.ldr.srec
+/u-boot-bootstrap.lds
 
 #
 # Generated files
@@ -39,7 +59,7 @@
 /LOG
 /errlog
 /reloc_off
-
+/.payload.s
 /include/generated/
 /lib/asm-offsets.s
 
@@ -66,3 +86,6 @@ cscope.*
 /onenand_ipl/onenand-ipl*
 /onenand_ipl/board/*/onenand*
 /onenand_ipl/board/*/*.S
+examples/standalone/
+
+setvars
diff --git a/Makefile b/Makefile
index ba832a4..cbd9a57 100644
--- a/Makefile
+++ b/Makefile
@@ -180,6 +180,13 @@ endif
 
 OBJS := $(addprefix $(obj),$(OBJS))
 
+ifeq ($(CONFIG_BOOTSTRAP),y)
+BOOTSTRAP_OBJS  = $(CPUDIR)/start_bootstrap.o
+
+BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_OBJS))
+endif
+
+
 LIBS  = lib/libgeneric.o
 LIBS += lib/lzma/liblzma.o
 LIBS += lib/lzo/liblzo.o
@@ -270,6 +277,24 @@ LIBS := $(addprefix $(obj),$(sort $(LIBS)))
 LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).o
 LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
 
+ifeq ($(CONFIG_BOOTSTRAP),y)
+BOOTSTRAP_LIBS =  lib/libgeneric_bootstrap.o
+BOOTSTRAP_LIBS += arch/$(ARCH)/cpu/lib$(ARCH)_bootstrap.o
+BOOTSTRAP_LIBS += arch/$(ARCH)/lib/lib$(ARCH)_bootstrap.o
+BOOTSTRAP_LIBS += common/libcommon_bootstrap.o
+BOOTSTRAP_LIBS += drivers/serial/libserial.o
+
+BOOTSTRAP_LIBS-$(CONFIG_BOOTSTRAP_LZMA) += lib/lzma/liblzma.o
+BOOTSTRAP_LIBS-$(CONFIG_BOOTSTRAP_LZO) += lib/lzo/liblzo.o
+BOOTSTRAP_LIBS-$(CONFIG_BOOTSTRAP_XZ) += lib/xz/libxz.o
+BOOTSTRAP_LIBS += $(BOOTSTRAP_LIBS-y)
+
+.PHONY : $(BOOTSTRAP_LIBS)
+
+BOOTSTRAP_LIBBOARD = board/$(BOARDDIR)/lib$(BOARD)_bootstrap.o
+BOOTSTRAP_LIBBOARD := $(addprefix $(obj),$(BOOTSTRAP_LIBBOARD))
+endif
+
 # Add GCC lib
 ifdef USE_PRIVATE_LIBGCC
 ifeq ($(USE_PRIVATE_LIBGCC), yes)
@@ -283,6 +308,9 @@ endif
 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 export PLATFORM_LIBS
 
+BOOTSTRAP_PLATFORM_LIBS += $(PLATFORM_LIBGCC)
+export BOOTSTRAP_PLATFORM_LIBS
+
 # Special flags for CPP when processing the linker script.
 # Pass the version down so we can handle backwards compatibility
 # on the fly.
@@ -305,6 +333,9 @@ endif
 __OBJS := $(subst $(obj),,$(OBJS))
 __LIBS := $(subst $(obj),,$(LIBS)) $(subst $(obj),,$(LIBBOARD))
 
+__BOOTSTRAP_OBJS := $(subst $(obj),,$(BOOTSTRAP_OBJS))
+__BOOTSTRAP_LIBS := $(subst $(obj),,$(BOOTSTRAP_LIBS)) $(subst 
$(obj),,$(BOOTSTRAP_LIBBOARD))
+
 #
 #
 
@@ -326,6 +357,10 @@ endif
 # Always append ALL so that arch config.mk's can add custom ones
 ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(U_BOOT_NAND) 
$(U_BOOT_ONENAND)
 
+ifeq ($(CONFIG_BOOTSTRAP),y)
+ALL += $(obj)u-boot-bootstrap.srec $(obj)u-boot-bootstrap.bin
+endif
+
 all:   $(ALL)
 
 $(obj)u-boot.hex:  $(obj)u-boot
@@ -338,6 +373,21 @@ $(obj)u-boot.bin:  $(obj)u-boot
$(OBJCOPY) ${OBJCFLAGS} -O binary $ $@
$(BOARD_SIZE_CHECK)
 
+$(obj)u-boot.bin.gz:   $(obj)u-boot.bin
+   gzip -c $  $@
+
+$(obj)u-boot.bin.lzma: $(obj)u-boot.bin
+   lzma -e -z -c $  $@
+
+$(obj)u-boot.bin.xz:  $(obj)u-boot.bin
+   tools/xz_wrap.sh misc  $  $@
+
+$(obj)u-boot.bin.lzo:  $(obj)u-boot.bin
+   lzop -9 -c $  $@
+
+$(obj)u-boot.bin.bz2:  $(obj)u-boot.bin
+   bzip2 --best

[U-Boot] [PATCH 5/6 v2] Enable bootstrap support for MIPS architecture.

2010-12-04 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com


Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 arch/mips/config.mk |2 +-
 arch/mips/cpu/Makefile  |   28 ++-
 arch/mips/cpu/cpu.c |   12 -
 arch/mips/cpu/reset.c   |   39 
 arch/mips/cpu/reset_bootstrap.c |   39 
 arch/mips/cpu/start_bootstrap.S |  455 +++
 arch/mips/lib/Makefile  |   15 ++-
 arch/mips/lib/board_bootstrap.c |  331 
 8 files changed, 903 insertions(+), 18 deletions(-)
 create mode 100644 arch/mips/cpu/reset.c
 create mode 100644 arch/mips/cpu/reset_bootstrap.c
 create mode 100644 arch/mips/cpu/start_bootstrap.S
 create mode 100644 arch/mips/lib/board_bootstrap.c

diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index aa06761..4655169 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -47,6 +47,6 @@ PLATFORM_CPPFLAGS += -DCONFIG_MIPS -D__MIPS__
 # On the other hand, we want PIC in the U-Boot code to relocate it from ROM
 # to RAM. $28 is always used as gp.
 #
-PLATFORM_CPPFLAGS  += -G 0 -mabicalls -fpic
+PLATFORM_CPPFLAGS  += -G 0 -mabicalls -fpic -g
 PLATFORM_CPPFLAGS  += -msoft-float
 PLATFORM_LDFLAGS   += -G 0 -static -n -nostdlib
diff --git a/arch/mips/cpu/Makefile b/arch/mips/cpu/Makefile
index 06df8d1..6a9a2af 100644
--- a/arch/mips/cpu/Makefile
+++ b/arch/mips/cpu/Makefile
@@ -24,25 +24,45 @@
 include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(CPU).o
+BOOTSTRAP_LIB = $(obj)lib$(CPU)_bootstrap.o
+
+BOOTSTRAP_LIB-$(CONFIG_BOOTSTRAP) = $(BOOTSTRAP_LIB)
 
 START  = start.o
 SOBJS-y= cache.o
-COBJS-y= cpu.o interrupts.o
+COBJS-y= cpu.o reset.o interrupts.o
 
 SOBJS-$(CONFIG_INCA_IP)+= incaip_wdt.o
 COBJS-$(CONFIG_INCA_IP)+= asc_serial.o incaip_clock.o
+COBJS-$(CONFIG_IFX_ASC) += ifx_asc.o
 COBJS-$(CONFIG_PURPLE) += asc_serial.o
 COBJS-$(CONFIG_SOC_AU1X00) += au1x00_eth.o au1x00_serial.o au1x00_usb_ohci.o
 
-SRCS   := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+BOOTSTRAP_START = start_bootstrap.o
+BOOTSTRAP_START-$(CONFIG_BOOTSTRAP) += $(BOOTSTRAP_START)
+BOOTSTRAP_COBJS-$(CONFIG_BOOTSTRAP) += cpu.o interrupts.o reset_bootstrap.o
+BOOTSTRAP_SOBJS-$(CONFIG_BOOTSTRAP) += cache.o
+BOOTSTRAP_COBJS-$(CONFIG_IFX_ASC) += ifx_asc.o
+
+BOOTSTRAP_OBJS := $(addprefix $(obj),$(BOOTSTRAP_SOBJS-y) $(BOOTSTRAP_COBJS-y))
+BOOTSTRAP_START:= $(addprefix $(obj),$(BOOTSTRAP_START-y))
+
+SRCS   := $(sort $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c) 
$(BOOTSTRAP_START-y:.o=.S) $(BOOTSTRAP_SOBJS-y:.o=.S) 
$(BOOTSTRAP_COBJS-y:.o=.c))
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
 START  := $(addprefix $(obj),$(START))
 
-all:   $(obj).depend $(START) $(LIB)
+all:   $(START) $(LIB) $(BOOTSTRAP_START-y) $(BOOTSTRAP_LIB-y)
 
-$(LIB):$(OBJS)
+$(START):  $(obj).depend
+
+$(LIB):$(obj).depend $(OBJS)
$(call cmd_link_o_target, $(OBJS))
 
+$(BOOTSTRAP_START):$(obj).depend
+
+$(BOOTSTRAP_LIB):  $(obj).depend $(BOOTSTRAP_OBJS)
+   $(call cmd_link_o_target, $(BOOTSTRAP_OBJS))
+
 #
 
 # defines $(obj).depend target
diff --git a/arch/mips/cpu/cpu.c b/arch/mips/cpu/cpu.c
index 3ae397c..45bf07c 100644
--- a/arch/mips/cpu/cpu.c
+++ b/arch/mips/cpu/cpu.c
@@ -38,18 +38,6 @@
:   \
: i (op), R (*(unsigned char *)(addr)))
 
-void __attribute__((weak)) _machine_restart(void)
-{
-}
-
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-   _machine_restart();
-
-   fprintf(stderr, *** reset failed ***\n);
-   return 0;
-}
-
 void flush_cache(ulong start_addr, ulong size)
 {
unsigned long lsize = CONFIG_SYS_CACHELINE_SIZE;
diff --git a/arch/mips/cpu/reset.c b/arch/mips/cpu/reset.c
new file mode 100644
index 000..397fb62
--- /dev/null
+++ b/arch/mips/cpu/reset.c
@@ -0,0 +1,39 @@
+/*
+ * (C) Copyright 2003
+ * 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

[U-Boot] [PATCH 2/6 v2] LZMA: Avoid free on null pointer

2010-12-04 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com


Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib/lzma/LzmaDec.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/lzma/LzmaDec.c b/lib/lzma/LzmaDec.c
index f941da2..b2a3aec 100644
--- a/lib/lzma/LzmaDec.c
+++ b/lib/lzma/LzmaDec.c
@@ -913,7 +913,9 @@ SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT 
*destLen, const Byte *sr
 
 void LzmaDec_FreeProbs(CLzmaDec *p, ISzAlloc *alloc)
 {
-  alloc-Free(alloc, p-probs);
+  if (p-probs) {
+alloc-Free(alloc, p-probs);
+  }
   p-probs = 0;
 }
 
-- 
1.7.3

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


Re: [U-Boot] [RFC 0/2] Add support for bootstrap stage and compressed U-Boot image

2010-11-30 Thread Luigi 'Comio' Mantellini
Look the following benchmark (qemu-mips board):

U-Boot Vanilla
179600 bytes u-boot.bin

Bootstrap code w/o compresion (memcpy)
189224 bytes u-boot-bootstrap.bin
-- size 105%

Bootstrap code using BZIP2 compression
114388 bytes u-boot-bootstrap.bin
--size 64%

Bootstrap code using GZIP compression
114204 bytes u-boot-bootstrap.bin
--size 64%

Bootstrap code using LZMA compression
89456 bytes u-boot-bootstrap.bin
--size 50% -- BEST

Bootstrap code using LZO compression
104388 bytes u-boot-bootstrap.bin
--size 58%

ciao ciao

luigi

martedì 30 novembre 2010 11:30 luigi.mantell...@idf-hit.com ha scritto:
 From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
 
 Hi All,
 
 The following patches introduce the bootstrap support that enable to have a
 compressed U-Boot image. The bootstrap code supports the uncompressed as
 well as compressed payloads, using LZMA, GZIP, BZIP2 and LZO.
 
 Actually I developed just the mips version (using qemu-mips board)...
 
 Please see the Patch #1 for the required defines to enable the required
 features.
 
 Of course, any suggestion is welcome.
 
 ciao
 
 luigi
 
 Luigi 'Comio' Mantellini (2):
   Add support for bootstrap stage that allows to have a compressed
 U-Boot image. The final image will named u-boot-bootstrap.
   Add support for bootstrap stage to QEMU-MIPS board.
 
  .gitignore|   24 ++-
  Makefile  |  172 -
  arch/mips/config.mk   |2 +-
  arch/mips/cpu/Makefile|   28 ++-
  arch/mips/cpu/cpu.c   |   12 -
  arch/mips/cpu/reset.c |   39 +++
  arch/mips/cpu/reset_bootstrap.c   |   39 +++
  arch/mips/cpu/start_bootstrap.S   |  452
 + arch/mips/lib/Makefile| 
  15 +-
  arch/mips/lib/board_bootstrap.c   |  261 +++
  board/qemu-mips/Makefile  |   15 +-
  board/qemu-mips/config.mk |7 +-
  board/qemu-mips/qemu-mips_bootstrap.c |   48 
  board/qemu-mips/u-boot-bootstrap.lds  |   73 ++
  common/Makefile   |   15 +-
  common/console_bootstrap.c|   85 ++
  config.mk |   19 ++-
  include/common.h  |   21 ++
  include/configs/qemu-mips.h   |   14 +-
  lib/Makefile  |   28 ++-
  lib/bootstrap.c   |   89 +++
  lib/lzma/Makefile |4 +-
  lib/lzo/Makefile  |4 +-
  23 files changed, 1434 insertions(+), 32 deletions(-)
  create mode 100644 arch/mips/cpu/reset.c
  create mode 100644 arch/mips/cpu/reset_bootstrap.c
  create mode 100644 arch/mips/cpu/start_bootstrap.S
  create mode 100644 arch/mips/lib/board_bootstrap.c
  create mode 100644 board/qemu-mips/qemu-mips_bootstrap.c
  create mode 100644 board/qemu-mips/u-boot-bootstrap.lds
  create mode 100644 common/console_bootstrap.c
  create mode 100644 lib/bootstrap.c

-- 


Luigi 'Comio' Mantellini
RD - Software

Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI) Italy
Tel.: +39 02 5167 2813
Fax: +39 02 5167 2459 
E-mail: luigi.mantell...@idf-hit.com 
Website: http://www.idf-hit.com


Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle 
persone indicate. La diffusione, copia o qualsiasi altra azione derivante dalla 
conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate 
ricevuto questo documento per errore siete cortesemente pregati di darne 
immediata comunicazione al mittente e di provvedere alla sua distruzione, 
Grazie.

Rispetta l'ambiente. Non stampare questa mail se non è realmente necessario.

This e-mail and any attachments is confidential and may contain privileged 
information intended for the addressee(s) only. Dissemination, copying, 
printing or use by anybody else is unauthorized. If you are not the intended 
recipient, please delete this message and any attachments and advise the 
sender by return e-mail, Thanks.

Help the environment. Please do not print this email unless it is absolutely 
necessary.
idf_logo.png

signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC] Double-stage u-boot to reduce footprint

2010-11-29 Thread Luigi 'Comio' Mantellini
Hi ML,

I'm working to have a small but also full-featured u-boot bootloader.
The idea, that I already see on lantiq sources, is to have a small bootstrap 
code that decompresses the final u-boot.

The code is divided into two stages:

 1) bootstrap: initializes the ram in order to decompress the u-boot binary. 
After that, bootstrap jumps to final u-boot 2)
 2) u-boot: the state of the art of the boot loaders.

Can be interesting for you to have these pieces of code?

I ask before to send any patch, because the boards to support the bootstrap 
code should define some symbols (CONFIG_BOOTSTRAP_*) and provides a linker 
script, and the lowlevel init code for the ram.

Thanks for any comments,

luigi


-- 


Luigi 'Comio' Mantellini
RD - Software

Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI) Italy
Tel.: +39 02 5167 2813
Fax: +39 02 5167 2459 
E-mail: luigi.mantell...@idf-hit.com 
Website: http://www.idf-hit.com


Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle 
persone indicate. La diffusione, copia o qualsiasi altra azione derivante dalla 
conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate 
ricevuto questo documento per errore siete cortesemente pregati di darne 
immediata comunicazione al mittente e di provvedere alla sua distruzione, 
Grazie.

Rispetta l'ambiente. Non stampare questa mail se non è realmente necessario.

This e-mail and any attachments is confidential and may contain privileged 
information intended for the addressee(s) only. Dissemination, copying, 
printing or use by anybody else is unauthorized. If you are not the intended 
recipient, please delete this message and any attachments and advise the 
sender by return e-mail, Thanks.

Help the environment. Please do not print this email unless it is absolutely 
necessary.
idf_logo.png

signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC] Double-stage u-boot to reduce footprint

2010-11-29 Thread Luigi 'Comio' Mantellini
Hi ML,

I'm working to have a small but also full-featured u-boot bootloader.
The idea, that I already see on lantiq sources, is to have a small bootstrap 
code that decompresses the final u-boot.

The code is divided into two stages:

 1) bootstrap: initializes the ram in order to decompress the u-boot binary. 
After that, bootstrap jumps to final u-boot 2)
 2) u-boot: the state of the art of the boot loaders.

Can be interesting for you to have these pieces of code?

I ask before to send any patch, because the boards to support the bootstrap 
code should define some symbols (CONFIG_BOOTSTRAP_*) and provides a linker 
script, and the lowlevel init code for the ram.

Thanks for any comments,

luigi


-- 


Luigi 'Comio' Mantellini
RD - Software

Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI) Italy
Tel.: +39 02 5167 2813
Fax: +39 02 5167 2459 
E-mail: luigi.mantell...@idf-hit.com 
Website: http://www.idf-hit.com


Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle 
persone indicate. La diffusione, copia o qualsiasi altra azione derivante dalla 
conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate 
ricevuto questo documento per errore siete cortesemente pregati di darne 
immediata comunicazione al mittente e di provvedere alla sua distruzione, 
Grazie.

Rispetta l'ambiente. Non stampare questa mail se non è realmente necessario.

This e-mail and any attachments is confidential and may contain privileged 
information intended for the addressee(s) only. Dissemination, copying, 
printing or use by anybody else is unauthorized. If you are not the intended 
recipient, please delete this message and any attachments and advise the 
sender by return e-mail, Thanks.

Help the environment. Please do not print this email unless it is absolutely 
necessary.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] *** SUBJECT HERE ***

2010-05-26 Thread Luigi 'Comio' Mantellini
This trivial patch remove the 64-bit division into print_size code.


Luigi 'Comio' Mantellini (1):
  [OLT-M68K] Avoid 64bit division in print_size

 lib/display_options.c |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

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


[U-Boot] [PATCH] [OLT-M68K] Avoid 64bit division in print_size

2010-05-26 Thread Luigi 'Comio' Mantellini

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib/display_options.c |   15 ---
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/lib/display_options.c b/lib/display_options.c
index 86df05d..eca5415 100644
--- a/lib/display_options.c
+++ b/lib/display_options.c
@@ -45,14 +45,14 @@ int display_options (void)
  */
 void print_size(unsigned long long size, const char *s)
 {
-   unsigned long m = 0, n;
+   unsigned long m = 0, n, rem;
static const char names[] = {'E', 'P', 'T', 'G', 'M', 'K'};
-   unsigned long long d = 1ULL  (10 * ARRAY_SIZE(names));
+   unsigned int d_shift = 10 * ARRAY_SIZE(names);
char c = 0;
unsigned int i;
 
-   for (i = 0; i  ARRAY_SIZE(names); i++, d = 10) {
-   if (size = d) {
+   for (i = 0; i  ARRAY_SIZE(names); i++, d_shift -= 10) {
+   if (size = (1ULL  d_shift)) {
c = names[i];
break;
}
@@ -63,11 +63,12 @@ void print_size(unsigned long long size, const char *s)
return;
}
 
-   n = size / d;
+   n = size  d_shift;
+   rem = size - (n  d_shift);
 
/* If there's a remainder, deal with it */
-   if(size % d) {
-   m = (10 * (size - (n * d)) + (d / 2) ) / d;
+   if(rem) {
+   m = (10 * rem + (1ULL  (d_shift -1 )))  d_shift;
 
if (m = 10) {
m -= 10;
-- 
1.7.0.5

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


Re: [U-Boot] [PATCH] [OLT-M68K] Avoid 64bit division in print_size

2010-05-26 Thread Luigi 'Comio' Mantellini
I'm sorry! my tree is out of date (2010/05/15) :) 

I'm using the toolchain coldfire-4.4 from Codesourcery (Sourcery G++ Lite 
4.4-217)

Today I tried to build the cf547x_8x target and I noticed a div by 0 issue on 
the __udivdi3 (n = size / d) ... I checked the operands that were ok, but I 
wasn't able to understand the real problem. In order to avoid the (bugged?) 
__udivdi3 call I wrote this workaroud. Any idea regarding this issue?

Of course, avoiding the __udivdi3  call, the u-boot works fine.

best regards,

luigi

mercoledì 26 maggio 2010 17:32 Timur Tabi timur.t...@gmail.com ha scritto:
 On Wed, May 26, 2010 at 9:01 AM, Luigi 'Comio' Mantellini
 
 luigi.mantell...@idf-hit.com wrote:
  Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
  ---
 
 You're a little late:
 
 http://git.denx.de/?p=u-boot.git;a=commit;h=f2d76ae4fdde180e120ea2d29d6ef88
 1360b3cba

-- 


Luigi 'Comio' Mantellini
RD - Software

Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI) Italy
Tel.: +39 02 5167 2813
Fax: +39 02 5167 2459 
E-mail: luigi.mantell...@idf-hit.com 
Website: http://www.idf-hit.com


Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle 
persone indicate. La diffusione, copia o qualsiasi altra azione derivante dalla 
conoscenza di queste informazioni sono rigorosamente vietate. Qualora abbiate 
ricevuto questo documento per errore siete cortesemente pregati di darne 
immediata comunicazione al mittente e di provvedere alla sua distruzione, 
Grazie.

Rispetta l'ambiente. Non stampare questa mail se non è realmente necessario.

This e-mail and any attachments is confidential and may contain privileged 
information intended for the addressee(s) only. Dissemination, copying, 
printing or use by anybody else is unauthorized. If you are not the intended 
recipient, please delete this message and any attachments and advise the 
sender by return e-mail, Thanks.

Help the environment. Please do not print this email unless it is absolutely 
necessary.
idf_logo.png

signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Low BogoMIPS on MPC8541

2009-10-27 Thread Luigi 'Comio' Mantellini
Hi All,

I'm working on a stripped-down mpc8541 board (that has just 
a serian and twe enets).
I have an issue on delay calibration. In fact at boot time, I see the 
following linux printk message on the serial console:


Calibrating delay loop... 83.20 BogoMIPS (lpj=166400)


This value seems to be too low and I suspect an error propagated from u-boot.

Can anyone help me to understand a good way to investigate this problem? which 
registers or configuration values I need to check?

I will post the necessary snips of code or configuration if required.

Thanks a lot for your help,

ciao

luigi


-- 
Luigi 'Comio' Mantellini

RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantell...@idf-hit.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Help on U-Boot and Linux integration on PPC cpus

2009-10-23 Thread Luigi 'Comio' Mantellini
Hi Ml,

I'm working on a ppc8541 based board. I ported the U-boot board just creationg 
a strip-down version of frescale8541 board (I don't use TSEC and Quicc, 
...)-
My next task is to have the first boot with linux and I'm a lot confused by fdt 
usage.

In the past I always worked on mips based SoC and the ppc is a new world for 
me, then my apologies for my stupid questions.

I have a couple of (trivial) question/doubts  regarding the fdt usage:

1) I created my dts/dtb (exentially copying a 8541 board): How can this object 
be used by u-boot? should I copy it into the flash (for example)?
2) is there a how-to or a survey regarding the fdt usage into u-boot (and 
linux kernel)?

thanks for help,

luigi



-- 

Luigi 'Comio' Mantellini

RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantell...@idf-hit.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Help on U-Boot and Linux integration on PPC cpus

2009-10-23 Thread Luigi 'Comio' Mantellini
Hi Jerry and Wolfgang,

Thanks for your suggestions.

ciao ciao

luigi


venerdì 23 ottobre 2009 13:39 Jerry Van Baren gerald.vanba...@ge.com ha 
scritto:
Luigi 'Comio' Mantellini wrote:
 Hi Ml,
 
 I'm working on a ppc8541 based board. I ported the U-boot board just 
creationg 
 a strip-down version of frescale8541 board (I don't use TSEC and Quicc, 
 ...)-
 My next task is to have the first boot with linux and I'm a lot confused by 
fdt 
 usage.
 
 In the past I always worked on mips based SoC and the ppc is a new world for 
 me, then my apologies for my stupid questions.

s/ppc/powerpc/ - the linux ppc arch doesn't support fdt. ;-)

 I have a couple of (trivial) question/doubts  regarding the fdt usage:
 
 1) I created my dts/dtb (exentially copying a 8541 board): How can this 
object 
 be used by u-boot? should I copy it into the flash (for example)?

Strictly speaking, it isn't *used* by u-boot, but it is manipulated by 
u-boot to fix it up / augment it to describe the board's hardware.  It 
is then *used* by linux - it allows one linux image to boot on a wide 
variety of boards (MAJOR win).

You need to pass a fdt blob to the linux kernel.  As always, there are 
many ways to do this.  One way is to program it into flash.  This is 
great if your blob is stable (e.g. good for manufacturing).  Another way 
is to tftp the blob over from your server along with your linux image.

The *slickest* way by far is to use a FIT image - this wraps 
*everything* (kernel, board fdt blob, ramdisk) in a fdt blob.  See
   u-boot/doc/uimage.FIT

http://git.denx.de/?p=u-
boot.git;a=tree;f=doc/uImage.FIT;h=f1d03d7350a164ee6c951ea239a0e0e72db0e81b;hb=HEAD

 2) is there a how-to or a survey regarding the fdt usage into u-boot (and 
 linux kernel)?

There are various fdt whitepapers out there and *how* the fdt is used by 
linux is documented in the linux source tree.  For PowerPC processors:
   linux/Documentation/powerpc

http://git.denx.de/?p=linux-2.6-
denx.git;a=tree;f=Documentation/powerpc;h=01939ab891de2b352c4e9185d1f6bc667436bfb3;hb=HEAD

 thanks for help,
 
 luigi

Best regards,
gvb



-- 
Luigi 'Comio' Mantellini

RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantell...@idf-hit.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/3 v5] New MIIPHYBB implementation with multi-bus support

2009-10-10 Thread Luigi 'Comio' Mantellini
This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
support an arbitrary number of mii buses. This feature is useful when your
board uses different mii buses for different phys and all (or a part) of these
buses are implemented via bit-banging mode.

The driver requires that the following macros should be defined into the board
configuration file:

CONFIG_BITBANGMII   - Enable the miiphybb driver
CONFIG_BITBANGMII_MULTI - Enable the multi bus support

If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs
to define at least the following macros:

MII_INIT  - Generic code to enable the MII bus (optional)
MDIO_DECLARE  - Declaration needed to access to the MDIO pin (optional)
MDIO_ACTIVE   - Activate the MDIO pin as out pin
MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
MDIO_READ - Read the MDIO pin
MDIO(v)   - Write v on the MDIO pin
MDC_DECLARE   - Declaration needed to access to the MDC pin (optional)
MDC(v)- Write v on the MDC pin

The previous macros make the driver compatible with the previous version
(that didn't support the multi-bus).

When the CONFIG_BITBANGMII_MULTI is also defined, the board code needs to fill
the bb_miiphy_buses[] array with a record for each required bus and declare
the bb_miiphy_buses_num variable with the number of mii buses.
The record (struct bb_miiphy_bus) has the following fields/callbacks (see
miiphy.h for details):

char name[]- The symbolic name that must be equal to the MII bus
registered name
int (*init)()  - Initialization function called at startup time (just
before the Ethernet initialization)
int (*mdio_active)()   - Activate the MDIO pin as output
int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
int (*set_mdio)()  - Write the MDIO pin
int (*get_mdio)()  - Read the MDIO pin
int (*set_mdc)()   - Write the MDC pin
int (*delay)() - Delay function
void *priv - Private data used by board specific code

The board code will look like:

struct bb_miiphy_bus bb_miiphy_buses[] = {
 { .name = miibus#1, .init = b1_init, .mdio_active = b1_mdio_active, ... },
 { .name = miibus#2, .init = b2_init, .mdio_active = b2_mdio_active, ... },
 ...
};
int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
 sizeof(bb_miiphy_buses[0]);

Patch Changelog:

v1 -- First (broken) release
v2 -- Fix some typos and disable callbacks pointers relacation (if
 CONFIG_RELOC_FIXUP_WORKS is not defined)
v3 -- Do not relocate NULL pointers
v4 -- Code Cleanup.
v5 -- Fix typos and cleanup config files

Luigi 'Comio' Mantellini (3):
  This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in
order to support an arbitrary number of mii buses. This feature is
useful when your board uses different mii buses for different phys
and all (or a part) of these buses are implemented via bit-banging
mode.
  Add bb_miiphy_init call before any ethernet bring-up code.
  Update all board to support new bbmiiphy driver (with multibus
support)

 doc/README.bitbangMII|   56 +++
 drivers/net/phy/miiphybb.c   |  346 +-
 include/configs/ISPAN.h  |4 +
 include/configs/MPC8260ADS.h |3 +
 include/configs/MPC8266ADS.h |4 +
 include/configs/MPC8560ADS.h |4 +
 include/configs/Rattler.h|4 +
 include/configs/SBC8540.h|4 +
 include/configs/TQM8272.h|3 +
 include/configs/VoVPN-GW.h   |5 +
 include/configs/ZPC1900.h|4 +
 include/configs/ep8248.h |1 +
 include/configs/ep82xxm.h|1 +
 include/configs/gw8260.h |5 +
 include/configs/hymod.h  |   12 ++
 include/configs/muas3001.h   |4 +
 include/configs/ppmc8260.h   |4 +
 include/configs/sacsng.h |4 +
 include/configs/sbc8260.h|4 +
 include/configs/sbc8560.h|4 +
 include/miiphy.h |   25 +++-
 lib_arm/board.c  |7 +
 lib_avr32/board.c|7 +
 lib_blackfin/board.c |7 +
 lib_i386/board.c |9 +-
 lib_m68k/board.c |7 +
 lib_mips/board.c |7 +
 lib_ppc/board.c  |7 +
 lib_sh/board.c   |7 +
 lib_sparc/board.c|7 +
 30 files changed, 460 insertions(+), 106 deletions(-)
 create mode 100644 doc/README.bitbangMII

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


[U-Boot] [PATCH 3/3 v5] Update all board to support new bbmiiphy driver (with multibus support)

2009-10-10 Thread Luigi 'Comio' Mantellini
Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 include/configs/ISPAN.h  |4 
 include/configs/MPC8260ADS.h |3 +++
 include/configs/MPC8266ADS.h |4 
 include/configs/MPC8560ADS.h |4 
 include/configs/Rattler.h|4 
 include/configs/SBC8540.h|4 
 include/configs/TQM8272.h|3 +++
 include/configs/VoVPN-GW.h   |5 +
 include/configs/ZPC1900.h|4 
 include/configs/ep8248.h |1 +
 include/configs/ep82xxm.h|1 +
 include/configs/gw8260.h |5 +
 include/configs/hymod.h  |   12 
 include/configs/muas3001.h   |4 
 include/configs/ppmc8260.h   |4 
 include/configs/sacsng.h |4 
 include/configs/sbc8260.h|4 
 include/configs/sbc8560.h|4 
 18 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/include/configs/ISPAN.h b/include/configs/ISPAN.h
index 6eb466a..c0b1d86 100644
--- a/include/configs/ISPAN.h
+++ b/include/configs/ISPAN.h
@@ -84,6 +84,10 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  3   /* Port D */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ( \
+   (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
+#define MDC_DECLAREMDIO_DECLARE
+
 
 #define CONFIG_SYS_MDIO_PIN0x0004  /* PD13 */
 #define CONFIG_SYS_MDC_PIN 0x0008  /* PD12 */
diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h
index 39b8b8f..ffd37fd 100644
--- a/include/configs/MPC8260ADS.h
+++ b/include/configs/MPC8260ADS.h
@@ -150,6 +150,9 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ( \
+   (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
+#define MDC_DECLAREMDIO_DECLARE
 
 #if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
 #define CONFIG_SYS_MDIO_PIN0x2000  /* PC18 */
diff --git a/include/configs/MPC8266ADS.h b/include/configs/MPC8266ADS.h
index b0162c3..55d77f8 100644
--- a/include/configs/MPC8266ADS.h
+++ b/include/configs/MPC8266ADS.h
@@ -96,6 +96,10 @@
  * Port pins used for bit-banged MII communictions (if applicable).
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ( \
+   (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h
index 8ddce5c..df59aca 100644
--- a/include/configs/MPC8560ADS.h
+++ b/include/configs/MPC8560ADS.h
@@ -363,6 +363,10 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ( \
+   (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/Rattler.h b/include/configs/Rattler.h
index 5b6f271..e630afe 100644
--- a/include/configs/Rattler.h
+++ b/include/configs/Rattler.h
@@ -103,6 +103,10 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ( \
+   (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/SBC8540.h b/include/configs/SBC8540.h
index 7cde39b..1989e5a 100644
--- a/include/configs/SBC8540.h
+++ b/include/configs/SBC8540.h
@@ -290,6 +290,10 @@
* GPIO pins used for bit-banged MII communications
*/
   #define MDIO_PORT2   /* Port C */
+  #define MDIO_DECLARE volatile ioport_t *iop = ioport_addr ( \
+   (immap_t *) CONFIG_SYS_IMMR, MDIO_PORT )
+  #define MDC_DECLARE  MDIO_DECLARE
+
   #define MDIO_ACTIVE  (iop-pdir |=  0x0040)
   #define MDIO_TRISTATE(iop-pdir = ~0x0040)
   #define MDIO_READ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/TQM8272.h b/include/configs/TQM8272.h
index 6c462af..6eaa61d 100644
--- a/include/configs/TQM8272.h
+++ b/include/configs/TQM8272.h
@@ -219,6 +219,9 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE

[U-Boot] [PATCH 1/3 v5] Rewrite the miiphybb (Bit-banged MII bus driver) in order to support an arbitrary number of mii buses.

2009-10-10 Thread Luigi 'Comio' Mantellini
This feature is useful when your board uses different mii buses for different
phys and all (or a part) of these buses are implemented via bit-banging mode.

The driver requires that the following macros should be defined into the board
configuration file:

CONFIG_BITBANGMII   - Enable the miiphybb driver
CONFIG_BITBANGMII_MULTI - Enable the multi bus support

If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs
to define at least the following macros:

MII_INIT  - Generic code to enable the MII bus (optional)
MDIO_DECLARE  - Declaration needed to access to the MDIO pin (optional)
MDIO_ACTIVE   - Activate the MDIO pin as out pin
MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
MDIO_READ - Read the MDIO pin
MDIO(v)   - Write v on the MDIO pin
MDC_DECLARE   - Declaration needed to access to the MDC pin (optional)
MDC(v)- Write v on the MDC pin

The previous macros make the driver compatible with the previous version
(that didn't support the multi-bus).

When the CONFIG_BITBANGMII_MULTI is also defined, the board code needs to fill
the bb_miiphy_buses[] array with a record for each required bus and declare
the bb_miiphy_buses_num variable with the number of mii buses.
The record (struct bb_miiphy_bus) has the following fields/callbacks (see
miiphy.h for details):

char name[]- The symbolic name that must be equal to the MII bus
 registered name
int (*init)()  - Initialization function called at startup time (just
 before the Ethernet initialization)
int (*mdio_active)()   - Activate the MDIO pin as output
int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
int (*set_mdio)()  - Write the MDIO pin
int (*get_mdio)()  - Read the MDIO pin
int (*set_mdc)()   - Write the MDC pin
int (*delay)() - Delay function
void *priv - Private data used by board specific code

The board code will look like:

struct bb_miiphy_bus bb_miiphy_buses[] = {
 { .name = miibus#1, .init = b1_init, .mdio_active = b1_mdio_active, ... },
 { .name = miibus#2, .init = b2_init, .mdio_active = b2_mdio_active, ... },
 ...
int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
  sizeof(bb_miiphy_buses[0]);

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 doc/README.bitbangMII  |   56 +++
 drivers/net/phy/miiphybb.c |  346 +++-
 include/miiphy.h   |   25 +++-
 3 files changed, 322 insertions(+), 105 deletions(-)
 create mode 100644 doc/README.bitbangMII

diff --git a/doc/README.bitbangMII b/doc/README.bitbangMII
new file mode 100644
index 000..edd0856
--- /dev/null
+++ b/doc/README.bitbangMII
@@ -0,0 +1,56 @@
+This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
+support an arbitrary number of mii buses. This feature is useful when your
+board uses different mii buses for different phys and all (or a part) of these
+buses are implemented via bit-banging mode.
+
+The driver requires that the following macros should be defined into the board
+configuration file:
+
+CONFIG_BITBANGMII   - Enable the miiphybb driver
+CONFIG_BITBANGMII_MULTI - Enable the multi bus support
+
+If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs
+to define at least the following macros:
+
+MII_INIT  - Generic code to enable the MII bus (optional)
+MDIO_DECLARE  - Declaration needed to access to the MDIO pin (optional)
+MDIO_ACTIVE   - Activate the MDIO pin as out pin
+MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
+MDIO_READ - Read the MDIO pin
+MDIO(v)   - Write v on the MDIO pin
+MDC_DECLARE   - Declaration needed to access to the MDC pin (optional)
+MDC(v)- Write v on the MDC pin
+
+The previous macros make the driver compatible with the previous version
+(that didn't support the multi-bus).
+
+When the CONFIG_BITBANGMII_MULTI is also defined, the board code needs to fill
+the bb_miiphy_buses[] array with a record for each required bus and declare
+the bb_miiphy_buses_num variable with the number of mii buses.
+The record (struct bb_miiphy_bus) has the following fields/callbacks (see
+miiphy.h for details):
+
+char name[]- The symbolic name that must be equal to the MII bus
+ registered name
+int (*init)()  - Initialization function called at startup time (just
+ before the Ethernet initialization)
+int (*mdio_active)()   - Activate the MDIO pin as output
+int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
+int (*set_mdio)()  - Write the MDIO pin
+int (*get_mdio)()  - Read the MDIO pin
+int (*set_mdc)()   - Write the MDC pin
+int (*delay)() - Delay function
+void *priv - Private data used by board specific code
+
+The board code will look like:
+
+struct bb_miiphy_bus bb_miiphy_buses

[U-Boot] [PATCH 2/3 v5] Add bb_miiphy_init call before any ethernet bring-up code.

2009-10-10 Thread Luigi 'Comio' Mantellini
Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib_arm/board.c  |7 +++
 lib_avr32/board.c|7 +++
 lib_blackfin/board.c |7 +++
 lib_i386/board.c |9 -
 lib_m68k/board.c |7 +++
 lib_mips/board.c |7 +++
 lib_ppc/board.c  |7 +++
 lib_sh/board.c   |7 +++
 lib_sparc/board.c|7 +++
 9 files changed, 64 insertions(+), 1 deletions(-)

diff --git a/lib_arm/board.c b/lib_arm/board.c
index a0e56d5..5e3d7f6 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -50,6 +50,10 @@
 #include onenand_uboot.h
 #include mmc.h
 
+#ifdef CONFIG_BITBANGMII
+#include miiphy.h
+#endif
+
 #ifdef CONFIG_DRIVER_SMC9
 #include ../drivers/net/smc9.h
 #endif
@@ -417,6 +421,9 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
mmc_initialize (gd-bd);
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_avr32/board.c b/lib_avr32/board.c
index 2d8..917ed6c 100644
--- a/lib_avr32/board.c
+++ b/lib_avr32/board.c
@@ -27,6 +27,10 @@
 #include version.h
 #include net.h
 
+#ifdef CONFIG_BITBANGMII
+#include miiphy.h
+#endif
+
 #include asm/initcalls.h
 #include asm/sections.h
 
@@ -337,6 +341,9 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
if (s)
load_addr = simple_strtoul(s, NULL, 16);
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
s = getenv(bootfile);
if (s)
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index 1053f69..3670d2c 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -26,6 +26,10 @@
 #include nand.h  /* cannot even include nand.h if it isnt configured */
 #endif
 
+#ifdef CONFIG_BITBANGMII
+#include miiphy.h
+#endif
+
 #if defined(CONFIG_POST)
 #include post.h
 int post_flag;
@@ -270,6 +274,9 @@ void board_init_f(ulong bootflag)
 
 static void board_net_init_r(bd_t *bd)
 {
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #ifdef CONFIG_CMD_NET
uchar enetaddr[6];
char *s;
diff --git a/lib_i386/board.c b/lib_i386/board.c
index 0262b5e..12ca20f 100644
--- a/lib_i386/board.c
+++ b/lib_i386/board.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, dan...@omicron.se
+ * Daniel Engstr�m, Omicron Ceti AB, dan...@omicron.se
  *
  * (C) Copyright 2002
  * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
@@ -39,6 +39,10 @@
 #include ide.h
 #include asm/u-boot-i386.h
 
+#ifdef CONFIG_BITBANGMII
+#include miiphy.h
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 extern long _i386boot_start;
@@ -351,6 +355,9 @@ void start_i386boot (void)
doc_init();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET();
diff --git a/lib_m68k/board.c b/lib_m68k/board.c
index 3d88530..732023d 100644
--- a/lib_m68k/board.c
+++ b/lib_m68k/board.c
@@ -63,6 +63,10 @@
 #include spi.h
 #endif
 
+#ifdef CONFIG_BITBANGMII
+#include miiphy.h
+#endif
+
 #include nand.h
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -630,6 +634,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
nand_init();/* go init the NAND */
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
WATCHDOG_RESET();
 #if defined(FEC_ENET)
diff --git a/lib_mips/board.c b/lib_mips/board.c
index f62a46a..b2d113e 100644
--- a/lib_mips/board.c
+++ b/lib_mips/board.c
@@ -33,6 +33,10 @@
 #include onenand_uboot.h
 #include spi.h
 
+#ifdef CONFIG_BITBANGMII
+#include miiphy.h
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #if ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)  CONFIG_SYS_MONITOR_BASE) || \
@@ -407,6 +411,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
misc_init_r ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 8b8ddb5..796d002 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -83,6 +83,10 @@
 #include asm/mp.h
 #endif
 
+#ifdef CONFIG_BITBANGMII
+#include miiphy.h
+#endif
+
 #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
 extern int update_flash_size (int flash_size);
 #endif
@@ -942,6 +946,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
doc_init ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET ();
diff --git a/lib_sh/board.c b/lib_sh/board.c
index 5d61f0d..5ed40e9 100644
--- a/lib_sh/board.c
+++ b/lib_sh/board.c
@@ -28,6 +28,10 @@
 #include net.h
 #include environment.h
 
+#ifdef CONFIG_BITBANGMII
+#include miiphy.h
+#endif
+
 extern void malloc_bin_reloc (void);
 extern int cpu_init(void);
 extern int board_init(void);
@@ -178,6

[U-Boot] [PATCH 0/3 v4] New MIIPHYBB implementation with multi-bus support

2009-10-06 Thread Luigi 'Comio' Mantellini
This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
support an arbitrary number of mii buses. This feature is useful when your
board uses different mii buses for different phys and all (or a part) of these
buses are implemented via bit-banging mode.

The driver requires that the following macros should be defined into the board
configuration file:

CONFIG_BITBANGMII   - Enable the miiphybb driver
CONFIG_BITBANGMII_MULTI - Enable the multi bus support

If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs
to define at least the following macros:

MII_INIT  - Generic code to enable the MII bus (optional)
MDIO_DECLARE  - Declaration needed to access to the MDIO pin (optional)
MDIO_ACTIVE   - Activate the MDIO pin as out pin
MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
MDIO_READ - Read the MDIO pin
MDIO(v)   - Write v on the MDIO pin
MDC_DECLARE   - Declaration needed to access to the MDC pin (optional)
MDC(v)- Write v on the MDC pin

The previous macros make the driver compatible with the previous version
(that didn't support the multi-bus).

When the CONFIG_BITBANGMII_MULTI is also defined, the board code needs to fill
the bb_miiphy_buses[] array with a record for each required bus and declare
the bb_miiphy_buses_num variable with the number of mii buses.
The record (struct bb_miiphy_bus) has the following fields/callbacks (see
miiphy.h for details):

char name[]- The symbolic name that must be equal to the MII bus
 registered name
int (*init)()  - Initialization function called at startup time (just
 before the Ethernet initialization)
int (*mdio_active)()   - Activate the MDIO pin as output
int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
int (*set_mdio)()  - Write the MDIO pin
int (*get_mdio)()  - Read the MDIO pin
int (*set_mdc)()   - Write the MDC pin
int (*delay)() - Delay function
void *priv - Private data used by board specific code

The board code will look like:

struct bb_miiphy_bus bb_miiphy_buses[] = {
 { .name = miibus#1, .init = b1_init, .mdio_active = b1_mdio_active, ... },
 { .name = miibus#2, .init = b2_init, .mdio_active = b2_mdio_active, ... },
 ...
};
int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
  sizeof(bb_miiphy_buses[0]);

Patch Changelog:

v1 -- First (broken) release
v2 -- Fix some typos and disable callbacks pointers relacation (if
  CONFIG_RELOC_FIXUP_WORKS is not defined)
v3 -- Do not relocate NULL pointers
v4 -- Code Cleanup.

Luigi 'Comio' Mantellini (3):
  New Bit-banged MII driver (MIIPHYBB) implementation with multi-bus
support.
  Add bb_miiphy_init call before any ethernet bring-up code.
  Update all board to support new bbmiiphy driver (with multibus
support)

 drivers/net/phy/miiphybb.c   |  346 +-
 include/configs/ISPAN.h  |4 +
 include/configs/MPC8260ADS.h |3 +
 include/configs/MPC8266ADS.h |4 +
 include/configs/MPC8560ADS.h |4 +
 include/configs/Rattler.h|4 +
 include/configs/SBC8540.h|4 +
 include/configs/TQM8272.h|3 +
 include/configs/VoVPN-GW.h   |4 +
 include/configs/ZPC1900.h|4 +
 include/configs/ep8248.h |4 +
 include/configs/ep82xxm.h|4 +
 include/configs/gw8260.h |4 +
 include/configs/hymod.h  |   12 ++
 include/configs/muas3001.h   |4 +
 include/configs/ppmc8260.h   |4 +
 include/configs/sacsng.h |4 +
 include/configs/sbc8260.h|4 +
 include/configs/sbc8560.h|4 +
 include/miiphy.h |   25 +++-
 lib_arm/board.c  |7 +
 lib_avr32/board.c|7 +
 lib_blackfin/board.c |7 +
 lib_i386/board.c |9 +-
 lib_m68k/board.c |7 +
 lib_mips/board.c |7 +
 lib_ppc/board.c  |7 +
 lib_sh/board.c   |7 +
 lib_sparc/board.c|7 +
 29 files changed, 408 insertions(+), 106 deletions(-)

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


[U-Boot] [PATCH 1/3 v4] New Bit-banged MII driver (MIIPHYBB) implementation with multi-bus support.

2009-10-06 Thread Luigi 'Comio' Mantellini
This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
support an arbitrary number of mii buses. This feature is useful when your
board uses different mii buses for different phys and all (or a part) of these
buses are implemented via bit-banging mode.

The driver requires that the following macros should be defined into the board
configuration file:

CONFIG_BITBANGMII   - Enable the miiphybb driver
CONFIG_BITBANGMII_MULTI - Enable the multi bus support

If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs
to define at least the following macros:

MII_INIT  - Generic code to enable the MII bus (optional)
MDIO_DECLARE  - Declaration needed to access to the MDIO pin (optional)
MDIO_ACTIVE   - Activate the MDIO pin as out pin
MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
MDIO_READ - Read the MDIO pin
MDIO(v)   - Write v on the MDIO pin
MDC_DECLARE   - Declaration needed to access to the MDC pin (optional)
MDC(v)- Write v on the MDC pin

The previous macros make the driver compatible with the previous version
(that didn't support the multi-bus).

When the CONFIG_BITBANGMII_MULTI is also defined, the board code needs to fill
the bb_miiphy_buses[] array with a record for each required bus and declare
the bb_miiphy_buses_num variable with the number of mii buses.
The record (struct bb_miiphy_bus) has the following fields/callbacks (see
miiphy.h for details):

char name[]- The symbolic name that must be equal to the MII bus
 registered name
int (*init)()  - Initialization function called at startup time (just
 before the Ethernet initialization)
int (*mdio_active)()   - Activate the MDIO pin as output
int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
int (*set_mdio)()  - Write the MDIO pin
int (*get_mdio)()  - Read the MDIO pin
int (*set_mdc)()   - Write the MDC pin
int (*delay)() - Delay function
void *priv - Private data used by board specific code

The board code will look like:

struct bb_miiphy_bus bb_miiphy_buses[] = {
 { .name = miibus#1, .init = b1_init, .mdio_active = b1_mdio_active, ... },
 { .name = miibus#2, .init = b2_init, .mdio_active = b2_mdio_active, ... },
 ...
};
int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
  sizeof(bb_miiphy_buses[0]);

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 drivers/net/phy/miiphybb.c |  346 +++-
 include/miiphy.h   |   25 +++-
 2 files changed, 266 insertions(+), 105 deletions(-)

diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c
index b77c917..259b3ff 100644
--- a/drivers/net/phy/miiphybb.c
+++ b/drivers/net/phy/miiphybb.c
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2009 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
+ *
  * (C) Copyright 2001
  * Gerald Van Baren, Custom IDEAS, vanba...@cideas.com.
  *
@@ -29,18 +32,144 @@
 #include common.h
 #include ioports.h
 #include ppc_asm.tmpl
+#include miiphy.h
+
+#define BB_MII_RELOCATE(v,off) (v += (v?off:0))
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifndef CONFIG_BITBANGMII_MULTI
+
+/*
+ * If CONFIG_BITBANGMII_MULTI is not defined we use a
+ * compatibility layer with the previous miiphybb implementation
+ * based on macros usage.
+ *
+ */
+static int bb_mii_init_wrap(struct bb_miiphy_bus *bus)
+{
+#ifdef MII_INIT
+   MII_INIT;
+#endif
+   return 0;
+}
+
+static int bb_mdio_active_wrap(struct bb_miiphy_bus *bus)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO_ACTIVE;
+   return 0;
+}
+
+static int bb_mdio_tristate_wrap(struct bb_miiphy_bus *bus)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO_TRISTATE;
+   return 0;
+}
+
+static int bb_set_mdio_wrap(struct bb_miiphy_bus *bus, int v)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO(v);
+   return 0;
+}
+
+static int bb_get_mdio_wrap(struct bb_miiphy_bus *bus, int *v)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   *v = MDIO_READ;
+   return 0;
+}
+
+static int bb_set_mdc_wrap(struct bb_miiphy_bus *bus, int v)
+{
+#ifdef MDC_DECLARE
+   MDC_DECLARE;
+#endif
+   MDC(v);
+   return 0;
+}
+
+static int bb_delay_wrap(struct bb_miiphy_bus *bus)
+{
+   MIIDELAY;
+   return 0;
+}
+
+struct bb_miiphy_bus bb_miiphy_buses[] = {
+   {
+   .name = BB_MII_DEVNAME,
+   .init = bb_mii_init_wrap,
+   .mdio_active = bb_mdio_active_wrap,
+   .mdio_tristate = bb_mdio_tristate_wrap,
+   .set_mdio = bb_set_mdio_wrap,
+   .get_mdio = bb_get_mdio_wrap,
+   .set_mdc = bb_set_mdc_wrap,
+   .delay = bb_delay_wrap,
+   }
+};
+
+extern int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
+ sizeof(bb_miiphy_buses[0

[U-Boot] [PATCH 2/3] Add bb_miiphy_init call before any ethernet bring-up code.

2009-10-06 Thread Luigi 'Comio' Mantellini
Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib_arm/board.c  |7 +++
 lib_avr32/board.c|7 +++
 lib_blackfin/board.c |7 +++
 lib_i386/board.c |9 -
 lib_m68k/board.c |7 +++
 lib_mips/board.c |7 +++
 lib_ppc/board.c  |7 +++
 lib_sh/board.c   |7 +++
 lib_sparc/board.c|7 +++
 9 files changed, 64 insertions(+), 1 deletions(-)

diff --git a/lib_arm/board.c b/lib_arm/board.c
index a0e56d5..057cc21 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -50,6 +50,10 @@
 #include onenand_uboot.h
 #include mmc.h
 
+#ifdef CONFIG_BITBANGMII
+#include miihpy.h
+#endif
+
 #ifdef CONFIG_DRIVER_SMC9
 #include ../drivers/net/smc9.h
 #endif
@@ -417,6 +421,9 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
mmc_initialize (gd-bd);
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_avr32/board.c b/lib_avr32/board.c
index 2d8..1f5e681 100644
--- a/lib_avr32/board.c
+++ b/lib_avr32/board.c
@@ -27,6 +27,10 @@
 #include version.h
 #include net.h
 
+#ifdef CONFIG_BITBANGMII
+#include miihpy.h
+#endif
+
 #include asm/initcalls.h
 #include asm/sections.h
 
@@ -337,6 +341,9 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
if (s)
load_addr = simple_strtoul(s, NULL, 16);
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
s = getenv(bootfile);
if (s)
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index 1053f69..6ce17d4 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -26,6 +26,10 @@
 #include nand.h  /* cannot even include nand.h if it isnt configured */
 #endif
 
+#ifdef CONFIG_BITBANGMII
+#include miihpy.h
+#endif
+
 #if defined(CONFIG_POST)
 #include post.h
 int post_flag;
@@ -270,6 +274,9 @@ void board_init_f(ulong bootflag)
 
 static void board_net_init_r(bd_t *bd)
 {
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #ifdef CONFIG_CMD_NET
uchar enetaddr[6];
char *s;
diff --git a/lib_i386/board.c b/lib_i386/board.c
index 0262b5e..452a5fc 100644
--- a/lib_i386/board.c
+++ b/lib_i386/board.c
@@ -1,6 +1,6 @@
 /*
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, dan...@omicron.se
+ * Daniel Engstr�m, Omicron Ceti AB, dan...@omicron.se
  *
  * (C) Copyright 2002
  * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
@@ -39,6 +39,10 @@
 #include ide.h
 #include asm/u-boot-i386.h
 
+#ifdef CONFIG_BITBANGMII
+#include miihpy.h
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 extern long _i386boot_start;
@@ -351,6 +355,9 @@ void start_i386boot (void)
doc_init();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET();
diff --git a/lib_m68k/board.c b/lib_m68k/board.c
index 3d88530..768a55c 100644
--- a/lib_m68k/board.c
+++ b/lib_m68k/board.c
@@ -63,6 +63,10 @@
 #include spi.h
 #endif
 
+#ifdef CONFIG_BITBANGMII
+#include miihpy.h
+#endif
+
 #include nand.h
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -630,6 +634,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
nand_init();/* go init the NAND */
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
WATCHDOG_RESET();
 #if defined(FEC_ENET)
diff --git a/lib_mips/board.c b/lib_mips/board.c
index f62a46a..81d6681 100644
--- a/lib_mips/board.c
+++ b/lib_mips/board.c
@@ -33,6 +33,10 @@
 #include onenand_uboot.h
 #include spi.h
 
+#ifdef CONFIG_BITBANGMII
+#include miihpy.h
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #if ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE)  CONFIG_SYS_MONITOR_BASE) || \
@@ -407,6 +411,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
misc_init_r ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index f9dbdb9..b19e6be 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -83,6 +83,10 @@
 #include asm/mp.h
 #endif
 
+#ifdef CONFIG_BITBANGMII
+#include miihpy.h
+#endif
+
 #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
 extern int update_flash_size (int flash_size);
 #endif
@@ -992,6 +996,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
doc_init ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET ();
diff --git a/lib_sh/board.c b/lib_sh/board.c
index 5d61f0d..b769788 100644
--- a/lib_sh/board.c
+++ b/lib_sh/board.c
@@ -28,6 +28,10 @@
 #include net.h
 #include environment.h
 
+#ifdef CONFIG_BITBANGMII
+#include miihpy.h
+#endif
+
 extern void malloc_bin_reloc (void);
 extern int cpu_init(void);
 extern int board_init(void);
@@ -178,6

[U-Boot] [PATCH 3/3] Update all board to support new bbmiiphy driver (with multibus support)

2009-10-06 Thread Luigi 'Comio' Mantellini
Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 include/configs/ISPAN.h  |4 
 include/configs/MPC8260ADS.h |3 +++
 include/configs/MPC8266ADS.h |4 
 include/configs/MPC8560ADS.h |4 
 include/configs/Rattler.h|4 
 include/configs/SBC8540.h|4 
 include/configs/TQM8272.h|3 +++
 include/configs/VoVPN-GW.h   |4 
 include/configs/ZPC1900.h|4 
 include/configs/ep8248.h |4 
 include/configs/ep82xxm.h|4 
 include/configs/gw8260.h |4 
 include/configs/hymod.h  |   12 
 include/configs/muas3001.h   |4 
 include/configs/ppmc8260.h   |4 
 include/configs/sacsng.h |4 
 include/configs/sbc8260.h|4 
 include/configs/sbc8560.h|4 
 18 files changed, 78 insertions(+), 0 deletions(-)

diff --git a/include/configs/ISPAN.h b/include/configs/ISPAN.h
index 6eb466a..02a188d 100644
--- a/include/configs/ISPAN.h
+++ b/include/configs/ISPAN.h
@@ -84,6 +84,10 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  3   /* Port D */
+#define MDIO_DECLARE   volatile ioport_t *iop = \
+   ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 
 #define CONFIG_SYS_MDIO_PIN0x0004  /* PD13 */
 #define CONFIG_SYS_MDC_PIN 0x0008  /* PD12 */
diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h
index 39b8b8f..078cb6a 100644
--- a/include/configs/MPC8260ADS.h
+++ b/include/configs/MPC8260ADS.h
@@ -150,6 +150,9 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = \
+   ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
 
 #if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
 #define CONFIG_SYS_MDIO_PIN0x2000  /* PC18 */
diff --git a/include/configs/MPC8266ADS.h b/include/configs/MPC8266ADS.h
index b0162c3..fdfefc0 100644
--- a/include/configs/MPC8266ADS.h
+++ b/include/configs/MPC8266ADS.h
@@ -96,6 +96,10 @@
  * Port pins used for bit-banged MII communictions (if applicable).
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = \
+   ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h
index 8ddce5c..54320e5 100644
--- a/include/configs/MPC8560ADS.h
+++ b/include/configs/MPC8560ADS.h
@@ -363,6 +363,10 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = \
+   ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/Rattler.h b/include/configs/Rattler.h
index 5b6f271..b2427b2 100644
--- a/include/configs/Rattler.h
+++ b/include/configs/Rattler.h
@@ -103,6 +103,10 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = \
+   ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/SBC8540.h b/include/configs/SBC8540.h
index 7cde39b..58b0a68 100644
--- a/include/configs/SBC8540.h
+++ b/include/configs/SBC8540.h
@@ -290,6 +290,10 @@
* GPIO pins used for bit-banged MII communications
*/
   #define MDIO_PORT2   /* Port C */
+  #define MDIO_DECLARE volatile ioport_t *iop = \
+   ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+  #define MDC_DECLARE  MDIO_DECLARE
+
   #define MDIO_ACTIVE  (iop-pdir |=  0x0040)
   #define MDIO_TRISTATE(iop-pdir = ~0x0040)
   #define MDIO_READ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/TQM8272.h b/include/configs/TQM8272.h
index 6c462af..22df917 100644
--- a/include/configs/TQM8272.h
+++ b/include/configs/TQM8272.h
@@ -219,6 +219,9 @@
  * GPIO pins used for bit-banged MII

Re: [U-Boot] [PATCH 1/3 v3] Bit-banged MII driver with multi-bus support.

2009-09-24 Thread Luigi 'Comio' Mantellini
(autoreview)

Hi Ben,

I make some changes to the patch, but I will post after your review.
See my annotation, that will be present into the next patch release.

best regards.

Il mercoledì 23 settembre 2009 15:10:54 Luigi 'Comio' Mantellini ha scritto:
 From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
 
 Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
 ---
  drivers/net/phy/miiphybb.c |  324
  +++- include/miiphy.h   | 
   22 +++
  2 files changed, 250 insertions(+), 96 deletions(-)
 
 diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c
 index b77c917..1ed27f1 100644
 --- a/drivers/net/phy/miiphybb.c
 +++ b/drivers/net/phy/miiphybb.c

...

 +
 +struct bbmiibus bbmiibusses[] = {

[COMIO] s/busses/buses - Sorry for the typo.

...

 +
 +void bb_miiphy_init(void)
 +{
 + int i;
 + for (i = 0; i  sizeof(bbmiibusses)/sizeof(bbmiibusses[0]); i++) {

[COMIO] Add bbmiibuses_num external variable. The board specific code need
to instance it as:

int bbmiibuses_num = sizeof(bbmiibuses)/sizeof(bbmiibuses[0])

I need this because I cannot know the array size at compile time. The other 
solution may be to use a dummy value at the array end... What do you suggest?

...
 +static inline struct bbmiibus *bb_miiphy_getbus(char *devname)
 +{
 +#ifdef CONFIG_BITBANGMII_MULTI
 + /* Search the correct bus */
 + for (j = 0; j  sizeof(bbmiibusses)/sizeof(bbmmis[0]); j++) {

[COMIO] Changed j to i and add i declaration.

 diff --git a/include/miiphy.h b/include/miiphy.h
 index fa33ec7..478c050 100644
 --- a/include/miiphy.h
 +++ b/include/miiphy.h
 @@ -19,6 +19,8 @@
 +
 +extern struct bbmiibus bbmiibusses[];

[COMIO] Change bbmiibusses to bbmiibuses and add the following declaration:

extern int bbmiibuses_num

Any comment is welcome

best regards,

luigi


-- 

Luigi 'Comio' Mantellini
RD - Software

Industrie Dial Face S.p.A.
Via Canzo, 4 
20068 Peschiera Borromeo (MI) Italy
Tel.: +39 02 5167 2813
Fax: +39 02 5167 2459
E-mail: luigi.mantell...@idf-hit.com

Questo messaggio e i suoi allegati sono indirizzati esclusivamente alle 
persone indicate. La diffusione, copia o qualsiasi altra azione derivante 
dalla conoscenza di queste informazioni sono rigorosamente vietate. Qualora 
abbiate ricevuto questo documento per errore siete cortesemente pregati di 
darne immediata comunicazione al mittente e di provvedere alla sua 
distruzione, Grazie.

Rispetta l'ambiente. Non stampare questa mail se non è realmente necessario.

This e-mail and any attachments is confidential and may contain privileged 
information intended for the addressee(s) only. Dissemination, copying, 
printing or use by anybody else is unauthorized. If you are not the intended 
recipient, please delete this message and any attachments and advise the 
sender by return e-mail, Thanks.

Help the environment. Please do not print this email unless it is absolutely 
necessary.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/3 v3] New MIIPHYBB implementation with multi-bus support

2009-09-23 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
support an arbitrary number of buses. This feature is useful when your board
uses different mii buses for different phys and all (or a part) of these buses
are implemented via bit-banging mode.

The driver requires that the following macros should be defined into the board
configuration file:

CONFIG_BITBANGMII   - Enable the miiphybb driver
CONFIG_BITBANGMII_MULTI - Enable the multi bus support

If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs to 
define
the following macros:

MII_INIT  - Generic cod to enable the MII bus (like gpios setup)
MDIO_DECLARE  - Declaration needed to access to the MDIO pin
MDIO_ACTIVE   - Activate the MDIO pin as out pin
MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
MDIO_READ - Read the MDIO pin
MDIO(v)   - Write v on the MDIO pin
MDC_DECLARE   - Declaration needed to access to the MDC pin
MDC(v)- Write v on the MDC pin

The previous macros make the driver compatible with the previous version
(that didn't support the multi-bus).

When the CONFIG_BITBANGMII_MULTI is defined, the board code needs to fill the
bbmiibusses[] array with a record for each required bus.
The record (struct bbmiibus) has the following fields/callbacks (see miiphy.h 
for
details):

char name[]- The symbolic name that must be equal to the MII bus 
registered
 name
int (*init)()  - Initialization function called at startup time (just 
before the
 Ethernet initialization)
int (*mdio_active)()   - Activate the MDIO pin as output
int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
int (*set_mdio)()  - Write the MDIO pin
int (*get_mdio)()  - Read the MDIO pin
int (*set_mdc)()   - Write the MDC pin
int (*delay)() - Delay function
void *priv - Private data used by board specific code

The board code will look like:

struct bbmiibus bbmiibusses[] = {
 { .name = miibus#1, .init = b1_init, .mdio_active = b1_mdio_active, ... },
 { .name = miibus#2, .init = b2_init, .mdio_active = b2_mdio_active, ... },
 ...
};

Patch Changelog:

v1 -- First (broken) release
v2 -- Fix some typos and disable callbacks pointers relacation (if
  CONFIG_RELOC_FIXUP_WORKS is not defined)
v3 -- Do not relocate NULL pointers

Luigi 'Comio' Mantellini (3):
  Bit-banged MII driver with multi-bus support.
  Add bb_miiphy_init call before any ethernet bring-up code.
  Update all board to support new bbmiiphy driver (with multibus
support)

 drivers/net/phy/miiphybb.c   |  324 +-
 include/configs/ISPAN.h  |3 +
 include/configs/MPC8260ADS.h |2 +
 include/configs/MPC8266ADS.h |3 +
 include/configs/MPC8560ADS.h |3 +
 include/configs/Rattler.h|3 +
 include/configs/SBC8540.h|3 +
 include/configs/TQM8272.h|2 +
 include/configs/VoVPN-GW.h   |3 +
 include/configs/ZPC1900.h|3 +
 include/configs/ep8248.h |3 +
 include/configs/ep82xxm.h|3 +
 include/configs/gw8260.h |3 +
 include/configs/hymod.h  |9 ++
 include/configs/muas3001.h   |3 +
 include/configs/ppmc8260.h   |3 +
 include/configs/sacsng.h |3 +
 include/configs/sbc8260.h|3 +
 include/configs/sbc8560.h|3 +
 include/miiphy.h |   22 +++
 lib_arm/board.c  |3 +
 lib_avr32/board.c|3 +
 lib_blackfin/board.c |3 +
 lib_i386/board.c |3 +
 lib_m68k/board.c |3 +
 lib_mips/board.c |3 +
 lib_ppc/board.c  |4 +-
 lib_sh/board.c   |3 +
 lib_sparc/board.c|3 +
 29 files changed, 335 insertions(+), 97 deletions(-)

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


[U-Boot] [PATCH 1/3 v3] Bit-banged MII driver with multi-bus support.

2009-09-23 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 drivers/net/phy/miiphybb.c |  324 +++-
 include/miiphy.h   |   22 +++
 2 files changed, 250 insertions(+), 96 deletions(-)

diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c
index b77c917..1ed27f1 100644
--- a/drivers/net/phy/miiphybb.c
+++ b/drivers/net/phy/miiphybb.c
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2009 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
+ *
  * (C) Copyright 2001
  * Gerald Van Baren, Custom IDEAS, vanba...@cideas.com.
  *
@@ -29,18 +32,137 @@
 #include common.h
 #include ioports.h
 #include ppc_asm.tmpl
+#include miiphy.h
+
+#define BBMII_RELOATE(v,off) (v += (v?off:0))
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifndef CONFIG_BITBANGMII_MULTI
+/*
+ * If CONFIG_BITBANGMII_MULTI is not defined we use a
+ * compatibility layer with the previous miiphybb implementation
+ * based on macros usage.
+ *
+ */
+static int bb_mii_init_wrap(struct bbmiibus *bus)
+{
+#ifdef MII_INIT
+   MII_INIT;
+#endif
+   return 0;
+}
+
+static int bb_mdio_active_wrap(struct bbmiibus *bus)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO_ACTIVE;
+   return 0;
+}
+
+static int bb_mdio_tristate_wrap(struct bbmiibus *bus)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO_TRISTATE;
+   return 0;
+}
+
+static int bb_set_mdio_wrap(struct bbmiibus *bus, int v)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO (v);
+   return 0;
+}
+
+static int bb_get_mdio_wrap(struct bbmiibus *bus, int *v)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   *v = MDIO_READ;
+   return 0;
+}
+
+static int bb_set_mdc_wrap(struct bbmiibus *bus, int v)
+{
+#ifdef MDC_DECLARE
+   MDC_DECLARE;
+#endif
+   MDC (v);
+   return 0;
+}
+
+static int bb_delay_wrap(struct bbmiibus *bus)
+{
+   MIIDELAY;
+   return 0;
+}
+
+struct bbmiibus bbmiibusses[] = {
+   {
+   .name = BB_MII_DEVNAME,
+   .init = bb_mii_init_wrap,
+   .mdio_active = bb_mdio_active_wrap,
+   .mdio_tristate = bb_mdio_tristate_wrap,
+   .set_mdio = bb_set_mdio_wrap,
+   .get_mdio = bb_get_mdio_wrap,
+   .set_mdc = bb_set_mdc_wrap,
+   .delay = bb_delay_wrap,
+   }
+};
+#endif
+
+void bb_miiphy_init(void)
+{
+   int i;
+   for (i = 0; i  sizeof(bbmiibusses)/sizeof(bbmiibusses[0]); i++) {
+#if !defined(CONFIG_RELOC_FIXUP_WORKS)
+   /* Reloate the hooks pointers*/
+   BBMII_RELOATE(bbmiibusses[i].init, gd-reloc_off);
+   BBMII_RELOATE(bbmiibusses[i].mdio_active, gd-reloc_off);
+   BBMII_RELOATE(bbmiibusses[i].mdio_tristate, gd-reloc_off);
+   BBMII_RELOATE(bbmiibusses[i].set_mdio, gd-reloc_off);
+   BBMII_RELOATE(bbmiibusses[i].get_mdio, gd-reloc_off);
+   BBMII_RELOATE(bbmiibusses[i].set_mdc, gd-reloc_off);
+   BBMII_RELOATE(bbmiibusses[i].delay, gd-reloc_off);
+#endif
+
+   if (bbmiibusses[i].init != NULL) {
+   bbmiibusses[i].init(bbmiibusses[i]);
+   }
+   }
+}
+
+static inline struct bbmiibus *bb_miiphy_getbus(char *devname)
+{
+#ifdef CONFIG_BITBANGMII_MULTI
+   /* Search the correct bus */
+   for (j = 0; j  sizeof(bbmiibusses)/sizeof(bbmmis[0]); j++) {
+   if (!strcmp(bbmiibusses[i].name, devname)) {
+   return bbmiibusses[i];
+   }
+   }
+   return NULL;
+#else
+   /* We have just one bitbanging bus */
+   return bbmiibusses[0];
+#endif
+}
 
 /*
  *
  * Utility to send the preamble, address, and register (common to read
  * and write).
  */
-static void miiphy_pre (char read, unsigned char addr, unsigned char reg)
+static void miiphy_pre (struct bbmiibus *bus, char read, unsigned char addr, 
unsigned char reg)
 {
int j;  /* counter */
-#if !(defined(CONFIG_EP8248) || defined(CONFIG_EP82XXM))
-   volatile ioport_t *iop = ioport_addr ((immap_t *) CONFIG_SYS_IMMR, 
MDIO_PORT);
-#endif
 
/*
 * Send a 32 bit preamble ('1's) with an extra '1' bit for good measure.
@@ -50,67 +172,66 @@ static void miiphy_pre (char read, unsigned char addr, 
unsigned char reg)
 * but it is safer and will be much more robust.
 */
 
-   MDIO_ACTIVE;
-   MDIO (1);
+   bus-mdio_active(bus);
+   bus-set_mdio (bus, 1);
for (j = 0; j  32; j++) {
-   MDC (0);
-   MIIDELAY;
-   MDC (1);
-   MIIDELAY;
+   bus-set_mdc (bus, 0);
+   bus-delay(bus);
+   bus-set_mdc (bus, 1);
+   bus-delay(bus

[U-Boot] [PATCH 2/3 v3] Add bb_miiphy_init call before any ethernet bring-up code.

2009-09-23 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib_arm/board.c  |3 +++
 lib_avr32/board.c|3 +++
 lib_blackfin/board.c |3 +++
 lib_i386/board.c |3 +++
 lib_m68k/board.c |3 +++
 lib_mips/board.c |3 +++
 lib_ppc/board.c  |4 +++-
 lib_sh/board.c   |3 +++
 lib_sparc/board.c|3 +++
 9 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/lib_arm/board.c b/lib_arm/board.c
index a0e56d5..6e77468 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -417,6 +417,9 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
mmc_initialize (gd-bd);
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_avr32/board.c b/lib_avr32/board.c
index 2d8..e715872 100644
--- a/lib_avr32/board.c
+++ b/lib_avr32/board.c
@@ -337,6 +337,9 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
if (s)
load_addr = simple_strtoul(s, NULL, 16);
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
s = getenv(bootfile);
if (s)
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index 1053f69..f1a7479 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -270,6 +270,9 @@ void board_init_f(ulong bootflag)
 
 static void board_net_init_r(bd_t *bd)
 {
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #ifdef CONFIG_CMD_NET
uchar enetaddr[6];
char *s;
diff --git a/lib_i386/board.c b/lib_i386/board.c
index 0262b5e..821713a 100644
--- a/lib_i386/board.c
+++ b/lib_i386/board.c
@@ -351,6 +351,9 @@ void start_i386boot (void)
doc_init();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET();
diff --git a/lib_m68k/board.c b/lib_m68k/board.c
index 3d88530..32ae592 100644
--- a/lib_m68k/board.c
+++ b/lib_m68k/board.c
@@ -630,6 +630,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
nand_init();/* go init the NAND */
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
WATCHDOG_RESET();
 #if defined(FEC_ENET)
diff --git a/lib_mips/board.c b/lib_mips/board.c
index f62a46a..fd12e68 100644
--- a/lib_mips/board.c
+++ b/lib_mips/board.c
@@ -407,6 +407,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
misc_init_r ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index e8509ee..0bb159e 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -1002,6 +1002,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
doc_init ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET ();
@@ -1009,7 +1012,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
eth_initialize (bd);
 #endif
-
 #if defined(CONFIG_CMD_NET)  ( \
 defined(CONFIG_CCM)|| \
 defined(CONFIG_ELPT860)|| \
diff --git a/lib_sh/board.c b/lib_sh/board.c
index 5d61f0d..52bbc6d 100644
--- a/lib_sh/board.c
+++ b/lib_sh/board.c
@@ -178,6 +178,9 @@ void sh_generic_init(void)
 #endif /* CONFIG_WATCHDOG*/
 
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
{
char *s;
diff --git a/lib_sparc/board.c b/lib_sparc/board.c
index 6aadb56..56192a7 100644
--- a/lib_sparc/board.c
+++ b/lib_sparc/board.c
@@ -405,6 +405,9 @@ void board_init_f(ulong bootflag)
doc_init();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET();
-- 
1.6.3.3

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


[U-Boot] [PATCH 3/3 v3] Update all board to support new bbmiiphy driver (with multibus support)

2009-09-23 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 include/configs/ISPAN.h  |3 +++
 include/configs/MPC8260ADS.h |2 ++
 include/configs/MPC8266ADS.h |3 +++
 include/configs/MPC8560ADS.h |3 +++
 include/configs/Rattler.h|3 +++
 include/configs/SBC8540.h|3 +++
 include/configs/TQM8272.h|2 ++
 include/configs/VoVPN-GW.h   |3 +++
 include/configs/ZPC1900.h|3 +++
 include/configs/ep8248.h |3 +++
 include/configs/ep82xxm.h|3 +++
 include/configs/gw8260.h |3 +++
 include/configs/hymod.h  |9 +
 include/configs/muas3001.h   |3 +++
 include/configs/ppmc8260.h   |3 +++
 include/configs/sacsng.h |3 +++
 include/configs/sbc8260.h|3 +++
 include/configs/sbc8560.h|3 +++
 18 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/include/configs/ISPAN.h b/include/configs/ISPAN.h
index 6eb466a..be41f37 100644
--- a/include/configs/ISPAN.h
+++ b/include/configs/ISPAN.h
@@ -84,6 +84,9 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  3   /* Port D */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 
 #define CONFIG_SYS_MDIO_PIN0x0004  /* PD13 */
 #define CONFIG_SYS_MDC_PIN 0x0008  /* PD12 */
diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h
index 942a4cc..255b4aa 100644
--- a/include/configs/MPC8260ADS.h
+++ b/include/configs/MPC8260ADS.h
@@ -149,6 +149,8 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
 
 #if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
 #define CONFIG_SYS_MDIO_PIN0x2000  /* PC18 */
diff --git a/include/configs/MPC8266ADS.h b/include/configs/MPC8266ADS.h
index 4fd86d3..eb35fc4 100644
--- a/include/configs/MPC8266ADS.h
+++ b/include/configs/MPC8266ADS.h
@@ -95,6 +95,9 @@
  * Port pins used for bit-banged MII communictions (if applicable).
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h
index c1a1a6d..1b9f624 100644
--- a/include/configs/MPC8560ADS.h
+++ b/include/configs/MPC8560ADS.h
@@ -362,6 +362,9 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/Rattler.h b/include/configs/Rattler.h
index 5b6f271..249667c 100644
--- a/include/configs/Rattler.h
+++ b/include/configs/Rattler.h
@@ -103,6 +103,9 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/SBC8540.h b/include/configs/SBC8540.h
index 7239f84..ede7c10 100644
--- a/include/configs/SBC8540.h
+++ b/include/configs/SBC8540.h
@@ -286,6 +286,9 @@
* GPIO pins used for bit-banged MII communications
*/
   #define MDIO_PORT2   /* Port C */
+  #define MDIO_DECLARE volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+  #define MDC_DECLARE  MDIO_DECLARE
+
   #define MDIO_ACTIVE  (iop-pdir |=  0x0040)
   #define MDIO_TRISTATE(iop-pdir = ~0x0040)
   #define MDIO_READ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/TQM8272.h b/include/configs/TQM8272.h
index 6c462af..522e29e 100644
--- a/include/configs/TQM8272.h
+++ b/include/configs/TQM8272.h
@@ -219,6 +219,8 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
 
 #if STK82xx_150
 #define CONFIG_SYS_MDIO_PIN

[U-Boot] [PATCH 0/3] New MIIPHYBB implementation with multi-bus support

2009-09-22 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com


This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
support an arbitrary number of buses. This feature is useful when your board
uses different mii buses for different phys and all (or a part) of these buses
are implemented via bit-banging mode.

The driver requires that the following macros should be defined into the board
configuration file:

CONFIG_BITBANGMII   - Enable the miiphybb driver
CONFIG_BITBANGMII_MULTI - Enable the multi bus support

If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs to 
define
the following macros:

MII_INIT  - Generic cod to enable the MII bus (like gpios setup)
MDIO_DECLARE  - Declaration needed to access to the MDIO pin
MDIO_ACTIVE   - Activate the MDIO pin as out pin
MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
MDIO_READ - Read the MDIO pin
MDIO(v)   - Write v on the MDIO pin
MDC_DECLARE   - Declaration needed to access to the MDC pin
MDC(v)- Write v on the MDC pin

The previous macros makes the driver at most compatible with the previous 
version
(that didn't support the multi-bus).

If the CONFIG_BITBANGMII_MULTI is defined, the board code needs to fill the
bbmiibusses[] array with a record for each required bus.
The record (struct bbmiibus) has the following fields/callbacks (see miiphy.h 
for
details):

char name[]- The symbolic name that must be equal to the MII bus 
registered
 name
int (*init)()  - Initialization function called at startup time (just 
before the
 Ethernet initialization)
int (*mdio_active)()   - Activate the MDIO pin as output
int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
int (*set_mdio)()  - Write the MDIO pin
int (*get_mdio)()  - Read the MDIO pin
int (*set_mdc)()   - Write the MDC pin
int (*delay)() - Delay function
void *priv - Private data used by board specific code

The board code will look like:

struct bbmiibus bbmiibusses[] = {
 { .name = miibus#1, .init = b1_init, .mdio_active = b1_mdio_active, ... },
 { .name = miibus#2, .init = b2_init, .mdio_active = b2_mdio_active, ... },
 ...
};

Luigi 'Comio' Mantellini (3):
  Bit-banged MII driver with multi-bus support.
  Add bb_miiphy_init call before any ethernet bring-up code.
  Update all board to support new bbmiiphy driver (with multibus
support)

 drivers/net/phy/miiphybb.c   |  321 +-
 include/configs/ISPAN.h  |3 +
 include/configs/MPC8260ADS.h |2 +
 include/configs/MPC8266ADS.h |3 +
 include/configs/MPC8560ADS.h |3 +
 include/configs/Rattler.h|3 +
 include/configs/SBC8540.h|3 +
 include/configs/TQM8272.h|2 +
 include/configs/VoVPN-GW.h   |3 +
 include/configs/ZPC1900.h|3 +
 include/configs/ep8248.h |3 +
 include/configs/ep82xxm.h|3 +
 include/configs/gw8260.h |3 +
 include/configs/hymod.h  |9 ++
 include/configs/muas3001.h   |3 +
 include/configs/ppmc8260.h   |3 +
 include/configs/sacsng.h |3 +
 include/configs/sbc8260.h|3 +
 include/configs/sbc8560.h|3 +
 include/miiphy.h |   22 +++
 lib_arm/board.c  |3 +
 lib_avr32/board.c|3 +
 lib_blackfin/board.c |3 +
 lib_i386/board.c |3 +
 lib_m68k/board.c |3 +
 lib_mips/board.c |3 +
 lib_ppc/board.c  |4 +-
 lib_sh/board.c   |3 +
 lib_sparc/board.c|3 +
 29 files changed, 332 insertions(+), 97 deletions(-)

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


[U-Boot] [PATCH 1/3] Bit-banged MII driver with multi-bus support.

2009-09-22 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 drivers/net/phy/miiphybb.c |  321 +++-
 include/miiphy.h   |   22 +++
 2 files changed, 247 insertions(+), 96 deletions(-)

diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c
index b77c917..a60ca69 100644
--- a/drivers/net/phy/miiphybb.c
+++ b/drivers/net/phy/miiphybb.c
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2009 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
+ *
  * (C) Copyright 2001
  * Gerald Van Baren, Custom IDEAS, vanba...@cideas.com.
  *
@@ -29,18 +32,134 @@
 #include common.h
 #include ioports.h
 #include ppc_asm.tmpl
+#include miiphy.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifndef CONFIG_BITBANGMII_MULTI
+/*
+ * If CONFIG_BITBANGMII_MULTI is not defined we use a
+ * compatibility layer with the previous miiphybb implementation
+ * based on macros usage.
+ *
+ */
+static int bb_mii_init_wrap(bbmiibus *bus)
+{
+#ifdef MII_INIT
+   MII_INIT;
+#endif
+   return 0;
+}
+
+static int bb_mdio_active_wrap(struct bbmiibus *bus)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO_ACTIVE;
+   return 0;
+}
+
+static int bb_mdio_tristate_wrap(struct bbmiibus *bus)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO_TRISTATE;
+   return 0;
+}
+
+static int bb_set_mdio_wrap(struct bbmiibus *bus, int v)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO (v);
+   return 0;
+}
+
+static int bb_get_mdio_wrap(struct bbmiibus *bus, int *v)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   *v = MDIO_READ;
+   return 0;
+}
+
+static int bb_set_mdc_wrap(struct bbmiibus *bus, int v)
+{
+#ifdef MDC_DECLARE
+   MDC_DECLARE;
+#endif
+   MDC (v);
+   return 0;
+}
+
+static int bb_delay_wrap(struct bbmiibus *bus)
+{
+   MIIDELAY;
+   return 0;
+}
+
+struct bbmiibus bbmiibusses[] = {
+   {
+   .name = BB_MII_DEVNAME,
+   .init = bb_mii_init_wrap,
+   .mdio_active = bb_mdio_active_wrap,
+   .mdio_tristate = bb_mdio_tristate_wrap,
+   .set_mdio = bb_set_mdio_wrap,
+   .get_mdio = bb_get_mdio_wrap,
+   .set_mdc = bb_set_mdc_wrap,
+   .delay = bb_delay_wrap,
+   }
+};
+#endif
+
+void bb_miiphy_init(void)
+{
+   int i;
+   for (i = 0; i  sizeof(bbmiibusses)/sizeof(bbmiibusses[0]); i++) {
+   /* Reloate the hooks pointers*/
+   bbmiibusses[i].init += gd-reloc_off;
+   bbmiibusses[i].done += gd-reloc_off;
+   bbmiibusses[i].mdio_active += gd-reloc_off;
+   bbmiibusses[i].mdio_tristate += gd-reloc_off;
+   bbmiibusses[i].set_mdio += gd-reloc_off;
+   bbmiibusses[i].get_mdio += gd-reloc_off;
+   bbmiibusses[i].set_mdc += gd-reloc_off;
+   bbmiibusses[i].delay += gd-reloc_off;
+
+   if (bbmiibusses[i].init != NULL) {
+   bbmiibusses[i].init(bbmiibusses[i]);
+   }
+   }
+}
+
+static inline struct bbmiibus *bb_miiphy_getbus(char *devname)
+{
+#ifdef CONFIG_BITBANGMII_MULTI
+   /* Search the correct bus */
+   for (j = 0; j  sizeof(bbmiibusses)/sizeof(bbmmis[0]); j++) {
+   if (!strcmp(bbmiibusses[i].name, devname)) {
+   return bbmiibusses[i];
+   }
+   }
+   return NULL;
+#else
+   /* We have just one bitbanging bus */
+   return bbmiibusses[0];
+#endif
+}
 
 /*
  *
  * Utility to send the preamble, address, and register (common to read
  * and write).
  */
-static void miiphy_pre (char read, unsigned char addr, unsigned char reg)
+static void miiphy_pre (struct bbmiibus *bus, char read, unsigned char addr, 
unsigned char reg)
 {
int j;  /* counter */
-#if !(defined(CONFIG_EP8248) || defined(CONFIG_EP82XXM))
-   volatile ioport_t *iop = ioport_addr ((immap_t *) CONFIG_SYS_IMMR, 
MDIO_PORT);
-#endif
 
/*
 * Send a 32 bit preamble ('1's) with an extra '1' bit for good measure.
@@ -50,67 +169,66 @@ static void miiphy_pre (char read, unsigned char addr, 
unsigned char reg)
 * but it is safer and will be much more robust.
 */
 
-   MDIO_ACTIVE;
-   MDIO (1);
+   bus-mdio_active(bus);
+   bus-set_mdio (bus, 1);
for (j = 0; j  32; j++) {
-   MDC (0);
-   MIIDELAY;
-   MDC (1);
-   MIIDELAY;
+   bus-set_mdc (bus, 0);
+   bus-delay(bus);
+   bus-set_mdc (bus, 1);
+   bus-delay(bus);
}
 
/* send the start bit (01) and the read opcode (10) or write (10) */
-   MDC (0);
-   MDIO (0);
-   MIIDELAY;
-   MDC (1

[U-Boot] [PATCH 2/3] Add bb_miiphy_init call before any ethernet bring-up code.

2009-09-22 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib_arm/board.c  |3 +++
 lib_avr32/board.c|3 +++
 lib_blackfin/board.c |3 +++
 lib_i386/board.c |3 +++
 lib_m68k/board.c |3 +++
 lib_mips/board.c |3 +++
 lib_ppc/board.c  |4 +++-
 lib_sh/board.c   |3 +++
 lib_sparc/board.c|3 +++
 9 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/lib_arm/board.c b/lib_arm/board.c
index a0e56d5..6e77468 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -417,6 +417,9 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
mmc_initialize (gd-bd);
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_avr32/board.c b/lib_avr32/board.c
index 2d8..e715872 100644
--- a/lib_avr32/board.c
+++ b/lib_avr32/board.c
@@ -337,6 +337,9 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
if (s)
load_addr = simple_strtoul(s, NULL, 16);
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
s = getenv(bootfile);
if (s)
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index 1053f69..f1a7479 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -270,6 +270,9 @@ void board_init_f(ulong bootflag)
 
 static void board_net_init_r(bd_t *bd)
 {
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #ifdef CONFIG_CMD_NET
uchar enetaddr[6];
char *s;
diff --git a/lib_i386/board.c b/lib_i386/board.c
index 0262b5e..821713a 100644
--- a/lib_i386/board.c
+++ b/lib_i386/board.c
@@ -351,6 +351,9 @@ void start_i386boot (void)
doc_init();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET();
diff --git a/lib_m68k/board.c b/lib_m68k/board.c
index 3d88530..32ae592 100644
--- a/lib_m68k/board.c
+++ b/lib_m68k/board.c
@@ -630,6 +630,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
nand_init();/* go init the NAND */
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
WATCHDOG_RESET();
 #if defined(FEC_ENET)
diff --git a/lib_mips/board.c b/lib_mips/board.c
index f62a46a..fd12e68 100644
--- a/lib_mips/board.c
+++ b/lib_mips/board.c
@@ -407,6 +407,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
misc_init_r ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index e8509ee..0bb159e 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -1002,6 +1002,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
doc_init ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET ();
@@ -1009,7 +1012,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
eth_initialize (bd);
 #endif
-
 #if defined(CONFIG_CMD_NET)  ( \
 defined(CONFIG_CCM)|| \
 defined(CONFIG_ELPT860)|| \
diff --git a/lib_sh/board.c b/lib_sh/board.c
index 5d61f0d..52bbc6d 100644
--- a/lib_sh/board.c
+++ b/lib_sh/board.c
@@ -178,6 +178,9 @@ void sh_generic_init(void)
 #endif /* CONFIG_WATCHDOG*/
 
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
{
char *s;
diff --git a/lib_sparc/board.c b/lib_sparc/board.c
index 6aadb56..56192a7 100644
--- a/lib_sparc/board.c
+++ b/lib_sparc/board.c
@@ -405,6 +405,9 @@ void board_init_f(ulong bootflag)
doc_init();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET();
-- 
1.6.3.3

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


[U-Boot] [PATCH 0/3 v2] New MIIPHYBB implementation with multi-bus support

2009-09-22 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
support an arbitrary number of buses. This feature is useful when your board
uses different mii buses for different phys and all (or a part) of these buses
are implemented via bit-banging mode.

The driver requires that the following macros should be defined into the board
configuration file:

CONFIG_BITBANGMII   - Enable the miiphybb driver
CONFIG_BITBANGMII_MULTI - Enable the multi bus support

If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs to 
define
the following macros:

MII_INIT  - Generic cod to enable the MII bus (like gpios setup)
MDIO_DECLARE  - Declaration needed to access to the MDIO pin
MDIO_ACTIVE   - Activate the MDIO pin as out pin
MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
MDIO_READ - Read the MDIO pin
MDIO(v)   - Write v on the MDIO pin
MDC_DECLARE   - Declaration needed to access to the MDC pin
MDC(v)- Write v on the MDC pin

The previous macros make the driver compatible with the previous version
(that didn't support the multi-bus).

When the CONFIG_BITBANGMII_MULTI is defined, the board code needs to fill the
bbmiibusses[] array with a record for each required bus.
The record (struct bbmiibus) has the following fields/callbacks (see miiphy.h 
for
details):

char name[]- The symbolic name that must be equal to the MII bus 
registered
 name
int (*init)()  - Initialization function called at startup time (just 
before the
 Ethernet initialization)
int (*mdio_active)()   - Activate the MDIO pin as output
int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
int (*set_mdio)()  - Write the MDIO pin
int (*get_mdio)()  - Read the MDIO pin
int (*set_mdc)()   - Write the MDC pin
int (*delay)() - Delay function
void *priv - Private data used by board specific code

The board code will look like:

struct bbmiibus bbmiibusses[] = {
 { .name = miibus#1, .init = b1_init, .mdio_active = b1_mdio_active, ... },
 { .name = miibus#2, .init = b2_init, .mdio_active = b2_mdio_active, ... },
 ...
};

Patch Changelog:

v1 -- First (broken) release
v2 -- Fix some typos and disable callbacks pointers relacation (if
  CONFIG_RELOC_FIXUP_WORKS is not defined)

Luigi 'Comio' Mantellini (3):
  Bit-banged MII driver with multi-bus support.
  Add bb_miiphy_init call before any ethernet bring-up code.
  Update all board to support new bbmiiphy driver (with multibus
support)

 drivers/net/phy/miiphybb.c   |  322 +-
 include/configs/ISPAN.h  |3 +
 include/configs/MPC8260ADS.h |2 +
 include/configs/MPC8266ADS.h |3 +
 include/configs/MPC8560ADS.h |3 +
 include/configs/Rattler.h|3 +
 include/configs/SBC8540.h|3 +
 include/configs/TQM8272.h|2 +
 include/configs/VoVPN-GW.h   |3 +
 include/configs/ZPC1900.h|3 +
 include/configs/ep8248.h |3 +
 include/configs/ep82xxm.h|3 +
 include/configs/gw8260.h |3 +
 include/configs/hymod.h  |9 ++
 include/configs/muas3001.h   |3 +
 include/configs/ppmc8260.h   |3 +
 include/configs/sacsng.h |3 +
 include/configs/sbc8260.h|3 +
 include/configs/sbc8560.h|3 +
 include/miiphy.h |   22 +++
 lib_arm/board.c  |3 +
 lib_avr32/board.c|3 +
 lib_blackfin/board.c |3 +
 lib_i386/board.c |3 +
 lib_m68k/board.c |3 +
 lib_mips/board.c |3 +
 lib_ppc/board.c  |4 +-
 lib_sh/board.c   |3 +
 lib_sparc/board.c|3 +
 29 files changed, 333 insertions(+), 97 deletions(-)

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


[U-Boot] [PATCH 1/3 v2] Bit-banged MII driver with multi-bus support.

2009-09-22 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 drivers/net/phy/miiphybb.c |  322 +++-
 include/miiphy.h   |   22 +++
 2 files changed, 248 insertions(+), 96 deletions(-)

diff --git a/drivers/net/phy/miiphybb.c b/drivers/net/phy/miiphybb.c
index b77c917..ccc7a81 100644
--- a/drivers/net/phy/miiphybb.c
+++ b/drivers/net/phy/miiphybb.c
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2009 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
+ *
  * (C) Copyright 2001
  * Gerald Van Baren, Custom IDEAS, vanba...@cideas.com.
  *
@@ -29,18 +32,135 @@
 #include common.h
 #include ioports.h
 #include ppc_asm.tmpl
+#include miiphy.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifndef CONFIG_BITBANGMII_MULTI
+/*
+ * If CONFIG_BITBANGMII_MULTI is not defined we use a
+ * compatibility layer with the previous miiphybb implementation
+ * based on macros usage.
+ *
+ */
+static int bb_mii_init_wrap(struct bbmiibus *bus)
+{
+#ifdef MII_INIT
+   MII_INIT;
+#endif
+   return 0;
+}
+
+static int bb_mdio_active_wrap(struct bbmiibus *bus)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO_ACTIVE;
+   return 0;
+}
+
+static int bb_mdio_tristate_wrap(struct bbmiibus *bus)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO_TRISTATE;
+   return 0;
+}
+
+static int bb_set_mdio_wrap(struct bbmiibus *bus, int v)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   MDIO (v);
+   return 0;
+}
+
+static int bb_get_mdio_wrap(struct bbmiibus *bus, int *v)
+{
+#ifdef MDIO_DECLARE
+   MDIO_DECLARE;
+#endif
+   *v = MDIO_READ;
+   return 0;
+}
+
+static int bb_set_mdc_wrap(struct bbmiibus *bus, int v)
+{
+#ifdef MDC_DECLARE
+   MDC_DECLARE;
+#endif
+   MDC (v);
+   return 0;
+}
+
+static int bb_delay_wrap(struct bbmiibus *bus)
+{
+   MIIDELAY;
+   return 0;
+}
+
+struct bbmiibus bbmiibusses[] = {
+   {
+   .name = BB_MII_DEVNAME,
+   .init = bb_mii_init_wrap,
+   .mdio_active = bb_mdio_active_wrap,
+   .mdio_tristate = bb_mdio_tristate_wrap,
+   .set_mdio = bb_set_mdio_wrap,
+   .get_mdio = bb_get_mdio_wrap,
+   .set_mdc = bb_set_mdc_wrap,
+   .delay = bb_delay_wrap,
+   }
+};
+#endif
+
+void bb_miiphy_init(void)
+{
+   int i;
+   for (i = 0; i  sizeof(bbmiibusses)/sizeof(bbmiibusses[0]); i++) {
+#if !defined(CONFIG_RELOC_FIXUP_WORKS)
+   /* Reloate the hooks pointers*/
+   bbmiibusses[i].init += gd-reloc_off;
+   bbmiibusses[i].mdio_active += gd-reloc_off;
+   bbmiibusses[i].mdio_tristate += gd-reloc_off;
+   bbmiibusses[i].set_mdio += gd-reloc_off;
+   bbmiibusses[i].get_mdio += gd-reloc_off;
+   bbmiibusses[i].set_mdc += gd-reloc_off;
+   bbmiibusses[i].delay += gd-reloc_off;
+#endif
+
+   if (bbmiibusses[i].init != NULL) {
+   bbmiibusses[i].init(bbmiibusses[i]);
+   }
+   }
+}
+
+static inline struct bbmiibus *bb_miiphy_getbus(char *devname)
+{
+#ifdef CONFIG_BITBANGMII_MULTI
+   /* Search the correct bus */
+   for (j = 0; j  sizeof(bbmiibusses)/sizeof(bbmmis[0]); j++) {
+   if (!strcmp(bbmiibusses[i].name, devname)) {
+   return bbmiibusses[i];
+   }
+   }
+   return NULL;
+#else
+   /* We have just one bitbanging bus */
+   return bbmiibusses[0];
+#endif
+}
 
 /*
  *
  * Utility to send the preamble, address, and register (common to read
  * and write).
  */
-static void miiphy_pre (char read, unsigned char addr, unsigned char reg)
+static void miiphy_pre (struct bbmiibus *bus, char read, unsigned char addr, 
unsigned char reg)
 {
int j;  /* counter */
-#if !(defined(CONFIG_EP8248) || defined(CONFIG_EP82XXM))
-   volatile ioport_t *iop = ioport_addr ((immap_t *) CONFIG_SYS_IMMR, 
MDIO_PORT);
-#endif
 
/*
 * Send a 32 bit preamble ('1's) with an extra '1' bit for good measure.
@@ -50,67 +170,66 @@ static void miiphy_pre (char read, unsigned char addr, 
unsigned char reg)
 * but it is safer and will be much more robust.
 */
 
-   MDIO_ACTIVE;
-   MDIO (1);
+   bus-mdio_active(bus);
+   bus-set_mdio (bus, 1);
for (j = 0; j  32; j++) {
-   MDC (0);
-   MIIDELAY;
-   MDC (1);
-   MIIDELAY;
+   bus-set_mdc (bus, 0);
+   bus-delay(bus);
+   bus-set_mdc (bus, 1);
+   bus-delay(bus);
}
 
/* send the start bit (01) and the read opcode (10) or write (10) */
-   MDC (0);
-   MDIO (0);
-   MIIDELAY;
-   MDC (1

[U-Boot] [PATCH 3/3 v2] Update all board to support new bbmiiphy driver (with multibus support)

2009-09-22 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 include/configs/ISPAN.h  |3 +++
 include/configs/MPC8260ADS.h |2 ++
 include/configs/MPC8266ADS.h |3 +++
 include/configs/MPC8560ADS.h |3 +++
 include/configs/Rattler.h|3 +++
 include/configs/SBC8540.h|3 +++
 include/configs/TQM8272.h|2 ++
 include/configs/VoVPN-GW.h   |3 +++
 include/configs/ZPC1900.h|3 +++
 include/configs/ep8248.h |3 +++
 include/configs/ep82xxm.h|3 +++
 include/configs/gw8260.h |3 +++
 include/configs/hymod.h  |9 +
 include/configs/muas3001.h   |3 +++
 include/configs/ppmc8260.h   |3 +++
 include/configs/sacsng.h |3 +++
 include/configs/sbc8260.h|3 +++
 include/configs/sbc8560.h|3 +++
 18 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/include/configs/ISPAN.h b/include/configs/ISPAN.h
index 6eb466a..be41f37 100644
--- a/include/configs/ISPAN.h
+++ b/include/configs/ISPAN.h
@@ -84,6 +84,9 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  3   /* Port D */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 
 #define CONFIG_SYS_MDIO_PIN0x0004  /* PD13 */
 #define CONFIG_SYS_MDC_PIN 0x0008  /* PD12 */
diff --git a/include/configs/MPC8260ADS.h b/include/configs/MPC8260ADS.h
index 942a4cc..255b4aa 100644
--- a/include/configs/MPC8260ADS.h
+++ b/include/configs/MPC8260ADS.h
@@ -149,6 +149,8 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
 
 #if CONFIG_ADSTYPE == CONFIG_SYS_8272ADS
 #define CONFIG_SYS_MDIO_PIN0x2000  /* PC18 */
diff --git a/include/configs/MPC8266ADS.h b/include/configs/MPC8266ADS.h
index 4fd86d3..eb35fc4 100644
--- a/include/configs/MPC8266ADS.h
+++ b/include/configs/MPC8266ADS.h
@@ -95,6 +95,9 @@
  * Port pins used for bit-banged MII communictions (if applicable).
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h
index c1a1a6d..1b9f624 100644
--- a/include/configs/MPC8560ADS.h
+++ b/include/configs/MPC8560ADS.h
@@ -362,6 +362,9 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/Rattler.h b/include/configs/Rattler.h
index 5b6f271..249667c 100644
--- a/include/configs/Rattler.h
+++ b/include/configs/Rattler.h
@@ -103,6 +103,9 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
+
 #define MDIO_ACTIVE(iop-pdir |=  0x0040)
 #define MDIO_TRISTATE  (iop-pdir = ~0x0040)
 #define MDIO_READ  ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/SBC8540.h b/include/configs/SBC8540.h
index 7239f84..ede7c10 100644
--- a/include/configs/SBC8540.h
+++ b/include/configs/SBC8540.h
@@ -286,6 +286,9 @@
* GPIO pins used for bit-banged MII communications
*/
   #define MDIO_PORT2   /* Port C */
+  #define MDIO_DECLARE volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+  #define MDC_DECLARE  MDIO_DECLARE
+
   #define MDIO_ACTIVE  (iop-pdir |=  0x0040)
   #define MDIO_TRISTATE(iop-pdir = ~0x0040)
   #define MDIO_READ((iop-pdat   0x0040) != 0)
diff --git a/include/configs/TQM8272.h b/include/configs/TQM8272.h
index 6c462af..522e29e 100644
--- a/include/configs/TQM8272.h
+++ b/include/configs/TQM8272.h
@@ -219,6 +219,8 @@
  * GPIO pins used for bit-banged MII communications
  */
 #define MDIO_PORT  2   /* Port C */
+#define MDIO_DECLARE   volatile ioport_t *iop = ioport_addr ((immap_t *) 
CONFIG_SYS_IMMR, MDIO_PORT)
+#define MDC_DECLAREMDIO_DECLARE
 
 #if STK82xx_150
 #define CONFIG_SYS_MDIO_PIN

[U-Boot] [PATCH 2/3 v2] Add bb_miiphy_init call before any ethernet bring-up code.

2009-09-22 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib_arm/board.c  |3 +++
 lib_avr32/board.c|3 +++
 lib_blackfin/board.c |3 +++
 lib_i386/board.c |3 +++
 lib_m68k/board.c |3 +++
 lib_mips/board.c |3 +++
 lib_ppc/board.c  |4 +++-
 lib_sh/board.c   |3 +++
 lib_sparc/board.c|3 +++
 9 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/lib_arm/board.c b/lib_arm/board.c
index a0e56d5..6e77468 100644
--- a/lib_arm/board.c
+++ b/lib_arm/board.c
@@ -417,6 +417,9 @@ extern void davinci_eth_set_mac_addr (const u_int8_t *addr);
mmc_initialize (gd-bd);
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_avr32/board.c b/lib_avr32/board.c
index 2d8..e715872 100644
--- a/lib_avr32/board.c
+++ b/lib_avr32/board.c
@@ -337,6 +337,9 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
if (s)
load_addr = simple_strtoul(s, NULL, 16);
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
s = getenv(bootfile);
if (s)
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index 1053f69..f1a7479 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -270,6 +270,9 @@ void board_init_f(ulong bootflag)
 
 static void board_net_init_r(bd_t *bd)
 {
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #ifdef CONFIG_CMD_NET
uchar enetaddr[6];
char *s;
diff --git a/lib_i386/board.c b/lib_i386/board.c
index 0262b5e..821713a 100644
--- a/lib_i386/board.c
+++ b/lib_i386/board.c
@@ -351,6 +351,9 @@ void start_i386boot (void)
doc_init();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET();
diff --git a/lib_m68k/board.c b/lib_m68k/board.c
index 3d88530..32ae592 100644
--- a/lib_m68k/board.c
+++ b/lib_m68k/board.c
@@ -630,6 +630,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
nand_init();/* go init the NAND */
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
WATCHDOG_RESET();
 #if defined(FEC_ENET)
diff --git a/lib_mips/board.c b/lib_mips/board.c
index f62a46a..fd12e68 100644
--- a/lib_mips/board.c
+++ b/lib_mips/board.c
@@ -407,6 +407,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
misc_init_r ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
puts (Net:   );
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index e8509ee..0bb159e 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -1002,6 +1002,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
doc_init ();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET ();
@@ -1009,7 +1012,6 @@ void board_init_r (gd_t *id, ulong dest_addr)
 #endif
eth_initialize (bd);
 #endif
-
 #if defined(CONFIG_CMD_NET)  ( \
 defined(CONFIG_CCM)|| \
 defined(CONFIG_ELPT860)|| \
diff --git a/lib_sh/board.c b/lib_sh/board.c
index 5d61f0d..52bbc6d 100644
--- a/lib_sh/board.c
+++ b/lib_sh/board.c
@@ -178,6 +178,9 @@ void sh_generic_init(void)
 #endif /* CONFIG_WATCHDOG*/
 
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
{
char *s;
diff --git a/lib_sparc/board.c b/lib_sparc/board.c
index 6aadb56..56192a7 100644
--- a/lib_sparc/board.c
+++ b/lib_sparc/board.c
@@ -405,6 +405,9 @@ void board_init_f(ulong bootflag)
doc_init();
 #endif
 
+#ifdef CONFIG_BITBANGMII
+   bb_miiphy_init();
+#endif
 #if defined(CONFIG_CMD_NET)
 #if defined(CONFIG_NET_MULTI)
WATCHDOG_RESET();
-- 
1.6.3.3

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


[U-Boot] [PATCH] MII Bus BitBang Imlementation for MPC85xx FCC ports

2009-09-19 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

This patch add a MII Bus support for FCC port using a simple bitbang 
implementation (derived from miiphy driver).
In order to enable mii bus, you need to define the following additional macros:

CONFIG_MPC85XX_BITBANGMII - Enable the mii bus support code
CONFIG_SYS_FCC1_MDIO  - Pin used for MDIO signal
CONFIG_SYS_FCC2_MDIO
CONFIG_SYS_FCC3_MDIO
CONFIG_SYS_FCC1_MDC   - Pin used for MDC signal
CONFIG_SYS_FCC2_MDC
CONFIG_SYS_FCC3_MDC
CONFIG_SYS_FCC1_PHYADDR   - Phy address
CONFIG_SYS_FCC2_PHYADDR
CONFIG_SYS_FCC3_PHYADDR

Notice that all Pins are refered to the Parallel IO Ports (A, B, C, D). The pin 
number is gived by the following formula:

AbsIoPin# = (Port#) * 32 + IoPin#
 
where:

Port# is 0 for port A, 1 for port B, etc...
IoPin# is the pin is a value from 0 to 31 refered to the port
AbsIoPin# is the value request bt *_MDIO and *_MDC macros.

Any feedback is welcome.

best regards,

luigi

Luigi 'Comio' Mantellini (1):
  [OLT] Add MII bus implementation for FCC ports (using bitbanging)

 cpu/mpc85xx/ether_fcc.c |  400 ---
 1 files changed, 379 insertions(+), 21 deletions(-)

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


[U-Boot] [PATCH] Add MII bus implementation for FCC ports (using bitbanging)

2009-09-19 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com

Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 cpu/mpc85xx/ether_fcc.c |  400 ---
 1 files changed, 379 insertions(+), 21 deletions(-)

diff --git a/cpu/mpc85xx/ether_fcc.c b/cpu/mpc85xx/ether_fcc.c
index 5f1414d..7d8234e 100644
--- a/cpu/mpc85xx/ether_fcc.c
+++ b/cpu/mpc85xx/ether_fcc.c
@@ -1,5 +1,9 @@
 /*
  * MPC8560 FCC Fast Ethernet
+ *
+ * Copyright (c) 2009 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
+ *
  * Copyright (c) 2003 Motorola,Inc.
  * Xianghua Xiao, (x.x...@motorola.com)
  *
@@ -55,7 +59,11 @@
 #if defined(CONFIG_ETHER_ON_FCC)  defined(CONFIG_CMD_NET)  \
defined(CONFIG_NET_MULTI)
 
-static struct ether_fcc_info_s
+extern int mpc85xx_init_phy(struct eth_device *dev);
+
+struct ether_fcc_info_s;
+
+struct ether_fcc_info_s
 {
int ether_index;
int proff_enet;
@@ -63,39 +71,60 @@ static struct ether_fcc_info_s
ulong cpm_cr_enet_page;
ulong cmxfcr_mask;
ulong cmxfcr_value;
-}
-   ether_fcc_info[] =
+#ifdef CONFIG_MPC85XX_BITBANGMII
+   int mdiopin;
+   int mdcpin;
+   uint phyaddr;
+#endif
+};
+
+static struct ether_fcc_info_s ether_fcc_info[] =
 {
 #ifdef CONFIG_ETHER_ON_FCC1
 {
-   0,
-   PROFF_FCC1,
-   CPM_CR_FCC1_SBLOCK,
-   CPM_CR_FCC1_PAGE,
-   CONFIG_SYS_CMXFCR_MASK1,
-   CONFIG_SYS_CMXFCR_VALUE1
+   .ether_index = 0,
+   .proff_enet = PROFF_FCC1,
+   .cpm_cr_enet_sblock = CPM_CR_FCC1_SBLOCK,
+   .cpm_cr_enet_page = CPM_CR_FCC1_PAGE,
+   .cmxfcr_mask = CONFIG_SYS_CMXFCR_MASK1,
+   .cmxfcr_value = CONFIG_SYS_CMXFCR_VALUE1,
+#ifdef CONFIG_MPC85XX_BITBANGMII
+   .mdiopin = CONFIG_SYS_FCC1_MDIO,
+   .mdcpin = CONFIG_SYS_FCC1_MDC,
+   .phyaddr = CONFIG_SYS_FCC1_PHYADDR
+#endif
 },
 #endif
 
 #ifdef CONFIG_ETHER_ON_FCC2
 {
-   1,
-   PROFF_FCC2,
-   CPM_CR_FCC2_SBLOCK,
-   CPM_CR_FCC2_PAGE,
-   CONFIG_SYS_CMXFCR_MASK2,
-   CONFIG_SYS_CMXFCR_VALUE2
+   .ether_index = 1,
+   .proff_enet = PROFF_FCC2,
+   .cpm_cr_enet_sblock = CPM_CR_FCC2_SBLOCK,
+   .cpm_cr_enet_page = CPM_CR_FCC2_PAGE,
+   .cmxfcr_mask = CONFIG_SYS_CMXFCR_MASK2,
+   .cmxfcr_value = CONFIG_SYS_CMXFCR_VALUE2,
+#ifdef CONFIG_MPC85XX_BITBANGMII
+   .mdiopin =CONFIG_SYS_FCC2_MDIO,
+   .mdcpin = CONFIG_SYS_FCC2_MDC,
+   .phyaddr = CONFIG_SYS_FCC2_PHYADDR
+#endif
 },
 #endif
 
 #ifdef CONFIG_ETHER_ON_FCC3
 {
-   2,
-   PROFF_FCC3,
-   CPM_CR_FCC3_SBLOCK,
-   CPM_CR_FCC3_PAGE,
-   CONFIG_SYS_CMXFCR_MASK3,
-   CONFIG_SYS_CMXFCR_VALUE3
+   .ether_index = 2,
+   .proff_enet = PROFF_FCC3,
+   .cpm_cr_enet_sblock = CPM_CR_FCC3_SBLOCK,
+   .cpm_cr_enet_page = CPM_CR_FCC3_PAGE,
+   .cmxfcr_mask = CONFIG_SYS_CMXFCR_MASK3,
+   .cmxfcr_value = CONFIG_SYS_CMXFCR_VALUE3,
+#ifdef CONFIG_MPC85XX_BITBANGMII
+   .mdiopin =CONFIG_SYS_FCC3_MDIO,
+   .mdcpin = CONFIG_SYS_FCC3_MDC,
+   .phyaddr = CONFIG_SYS_FCC3_PHYADDR
+#endif
 },
 #endif
 };
@@ -139,6 +168,329 @@ static RTXBD rtx __attribute__ ((aligned(8)));
 
 #undef ET_DEBUG
 
+#ifdef CONFIG_MPC85XX_BITBANGMII
+
+#include asm/iopin_85xx.h
+
+#define DECLARE_IOPIN(iopin, pin) \
+   iopin_t iopin; \
+   iopin.port = pin / 32; \
+   iopin.pin = pin % 32; \
+   iopin.flag = 0;
+
+static inline void mpc85xx_udelay(unsigned long delay)
+{
+   udelay(delay);
+}
+
+static void mpc85xx_mdio_active(int pin)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   iopin_set_act(iopin);
+   iopin_set_gen(iopin);
+   iopin_set_out(iopin);
+   iopin_set_high(iopin);
+}
+
+static inline void mpc85xx_mdc_active(int pin)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   iopin_set_act(iopin);
+   iopin_set_gen(iopin);
+   iopin_set_out(iopin);
+   iopin_set_high(iopin);
+}
+
+static void mpc85xx_mdio_tristate(int pin)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   iopin_set_odr(iopin);
+   iopin_set_gen(iopin);
+   iopin_set_in(iopin);
+   iopin_set_high(iopin);
+}
+
+static void mpc85xx_mdio_set(int pin, int value)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   if (value)
+   iopin_set_high(iopin);
+   else
+   iopin_set_low(iopin);
+}
+
+static inline void mpc85xx_mdc_set(int pin, int value)
+{
+   mpc85xx_mdio_set(pin, value);
+}
+
+static int mpc85xx_mdio_get(int pin)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   if (iopin_is_high(iopin))
+   return 1;
+   else
+   return 0;
+}
+
+/*
+ *
+ * Utility to send the preamble, address, and register (common to read
+ * and write).
+ */
+static void mpc85xx_miiphy_pre (struct ether_fcc_info_s *info, char read, 
unsigned char addr, unsigned char reg)
+{
+   int j

[U-Boot] [PATCH] Add MII bus implementation for FCC ports (using bitbanging)

2009-09-19 Thread Luigi 'Comio' Mantellini
Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 cpu/mpc85xx/ether_fcc.c |  400 ---
 1 files changed, 379 insertions(+), 21 deletions(-)

diff --git a/cpu/mpc85xx/ether_fcc.c b/cpu/mpc85xx/ether_fcc.c
index 5f1414d..7d8234e 100644
--- a/cpu/mpc85xx/ether_fcc.c
+++ b/cpu/mpc85xx/ether_fcc.c
@@ -1,5 +1,9 @@
 /*
  * MPC8560 FCC Fast Ethernet
+ *
+ * Copyright (c) 2009 Industrie Dial Face S.p.A.
+ * Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
+ *
  * Copyright (c) 2003 Motorola,Inc.
  * Xianghua Xiao, (x.x...@motorola.com)
  *
@@ -55,7 +59,11 @@
 #if defined(CONFIG_ETHER_ON_FCC)  defined(CONFIG_CMD_NET)  \
defined(CONFIG_NET_MULTI)
 
-static struct ether_fcc_info_s
+extern int mpc85xx_init_phy(struct eth_device *dev);
+
+struct ether_fcc_info_s;
+
+struct ether_fcc_info_s
 {
int ether_index;
int proff_enet;
@@ -63,39 +71,60 @@ static struct ether_fcc_info_s
ulong cpm_cr_enet_page;
ulong cmxfcr_mask;
ulong cmxfcr_value;
-}
-   ether_fcc_info[] =
+#ifdef CONFIG_MPC85XX_BITBANGMII
+   int mdiopin;
+   int mdcpin;
+   uint phyaddr;
+#endif
+};
+
+static struct ether_fcc_info_s ether_fcc_info[] =
 {
 #ifdef CONFIG_ETHER_ON_FCC1
 {
-   0,
-   PROFF_FCC1,
-   CPM_CR_FCC1_SBLOCK,
-   CPM_CR_FCC1_PAGE,
-   CONFIG_SYS_CMXFCR_MASK1,
-   CONFIG_SYS_CMXFCR_VALUE1
+   .ether_index = 0,
+   .proff_enet = PROFF_FCC1,
+   .cpm_cr_enet_sblock = CPM_CR_FCC1_SBLOCK,
+   .cpm_cr_enet_page = CPM_CR_FCC1_PAGE,
+   .cmxfcr_mask = CONFIG_SYS_CMXFCR_MASK1,
+   .cmxfcr_value = CONFIG_SYS_CMXFCR_VALUE1,
+#ifdef CONFIG_MPC85XX_BITBANGMII
+   .mdiopin = CONFIG_SYS_FCC1_MDIO,
+   .mdcpin = CONFIG_SYS_FCC1_MDC,
+   .phyaddr = CONFIG_SYS_FCC1_PHYADDR
+#endif
 },
 #endif
 
 #ifdef CONFIG_ETHER_ON_FCC2
 {
-   1,
-   PROFF_FCC2,
-   CPM_CR_FCC2_SBLOCK,
-   CPM_CR_FCC2_PAGE,
-   CONFIG_SYS_CMXFCR_MASK2,
-   CONFIG_SYS_CMXFCR_VALUE2
+   .ether_index = 1,
+   .proff_enet = PROFF_FCC2,
+   .cpm_cr_enet_sblock = CPM_CR_FCC2_SBLOCK,
+   .cpm_cr_enet_page = CPM_CR_FCC2_PAGE,
+   .cmxfcr_mask = CONFIG_SYS_CMXFCR_MASK2,
+   .cmxfcr_value = CONFIG_SYS_CMXFCR_VALUE2,
+#ifdef CONFIG_MPC85XX_BITBANGMII
+   .mdiopin =CONFIG_SYS_FCC2_MDIO,
+   .mdcpin = CONFIG_SYS_FCC2_MDC,
+   .phyaddr = CONFIG_SYS_FCC2_PHYADDR
+#endif
 },
 #endif
 
 #ifdef CONFIG_ETHER_ON_FCC3
 {
-   2,
-   PROFF_FCC3,
-   CPM_CR_FCC3_SBLOCK,
-   CPM_CR_FCC3_PAGE,
-   CONFIG_SYS_CMXFCR_MASK3,
-   CONFIG_SYS_CMXFCR_VALUE3
+   .ether_index = 2,
+   .proff_enet = PROFF_FCC3,
+   .cpm_cr_enet_sblock = CPM_CR_FCC3_SBLOCK,
+   .cpm_cr_enet_page = CPM_CR_FCC3_PAGE,
+   .cmxfcr_mask = CONFIG_SYS_CMXFCR_MASK3,
+   .cmxfcr_value = CONFIG_SYS_CMXFCR_VALUE3,
+#ifdef CONFIG_MPC85XX_BITBANGMII
+   .mdiopin =CONFIG_SYS_FCC3_MDIO,
+   .mdcpin = CONFIG_SYS_FCC3_MDC,
+   .phyaddr = CONFIG_SYS_FCC3_PHYADDR
+#endif
 },
 #endif
 };
@@ -139,6 +168,329 @@ static RTXBD rtx __attribute__ ((aligned(8)));
 
 #undef ET_DEBUG
 
+#ifdef CONFIG_MPC85XX_BITBANGMII
+
+#include asm/iopin_85xx.h
+
+#define DECLARE_IOPIN(iopin, pin) \
+   iopin_t iopin; \
+   iopin.port = pin / 32; \
+   iopin.pin = pin % 32; \
+   iopin.flag = 0;
+
+static inline void mpc85xx_udelay(unsigned long delay)
+{
+   udelay(delay);
+}
+
+static void mpc85xx_mdio_active(int pin)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   iopin_set_act(iopin);
+   iopin_set_gen(iopin);
+   iopin_set_out(iopin);
+   iopin_set_high(iopin);
+}
+
+static inline void mpc85xx_mdc_active(int pin)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   iopin_set_act(iopin);
+   iopin_set_gen(iopin);
+   iopin_set_out(iopin);
+   iopin_set_high(iopin);
+}
+
+static void mpc85xx_mdio_tristate(int pin)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   iopin_set_odr(iopin);
+   iopin_set_gen(iopin);
+   iopin_set_in(iopin);
+   iopin_set_high(iopin);
+}
+
+static void mpc85xx_mdio_set(int pin, int value)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   if (value)
+   iopin_set_high(iopin);
+   else
+   iopin_set_low(iopin);
+}
+
+static inline void mpc85xx_mdc_set(int pin, int value)
+{
+   mpc85xx_mdio_set(pin, value);
+}
+
+static int mpc85xx_mdio_get(int pin)
+{
+   DECLARE_IOPIN(iopin, pin);
+
+   if (iopin_is_high(iopin))
+   return 1;
+   else
+   return 0;
+}
+
+/*
+ *
+ * Utility to send the preamble, address, and register (common to read
+ * and write).
+ */
+static void mpc85xx_miiphy_pre (struct ether_fcc_info_s *info, char read, 
unsigned char addr, unsigned char reg)
+{
+   int j;  /* counter */
+
+   int mdio = info-mdiopin

[U-Boot] [PATCH] MII Bus BitBang Imlementation for MPC85xx FCC ports

2009-09-19 Thread Luigi 'Comio' Mantellini
This patch add a MII Bus support for FCC port using a simple bitbang 
implementation (derived from miiphy driver).
In order to enable mii bus, you need to define the following additional macros:

CONFIG_MPC85XX_BITBANGMII - Enable the mii bus support code
CONFIG_SYS_FCC1_MDIO  - Pin used for MDIO signal
CONFIG_SYS_FCC2_MDIO
CONFIG_SYS_FCC3_MDIO
CONFIG_SYS_FCC1_MDC   - Pin used for MDC signal
CONFIG_SYS_FCC2_MDC
CONFIG_SYS_FCC3_MDC
CONFIG_SYS_FCC1_PHYADDR   - Phy address
CONFIG_SYS_FCC2_PHYADDR
CONFIG_SYS_FCC3_PHYADDR

Notice that all Pins are refered to the Parallel IO Ports (A, B, C, D). The pin 
number is gived by the following formula:

AbsIoPin# = (Port#) * 32 + IoPin#
 
where:

Port# is 0 for port A, 1 for port B, etc...
IoPin# is the pin is a value from 0 to 31 refered to the port
AbsIoPin# is the value request bt *_MDIO and *_MDC macros.

Any feedback is welcome.

best regards,

luigi

Luigi 'Comio' Mantellini (1):
  [OLT] Add MII bus implementation for FCC ports (using bitbanging)

 cpu/mpc85xx/ether_fcc.c |  400 ---
 1 files changed, 379 insertions(+), 21 deletions(-)

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


[U-Boot] [PATCH] Fix LZMA string.h header inclusion issue and remove unused variables.

2009-07-28 Thread Luigi 'Comio' Mantellini
From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com


Signed-off-by: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
---
 lib_generic/lzma/LzmaDec.c   |2 +-
 lib_generic/lzma/LzmaTools.c |1 -
 lib_generic/lzma/Makefile|2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib_generic/lzma/LzmaDec.c b/lib_generic/lzma/LzmaDec.c
index acffb14..f941da2 100644
--- a/lib_generic/lzma/LzmaDec.c
+++ b/lib_generic/lzma/LzmaDec.c
@@ -6,7 +6,7 @@
 #include watchdog.h
 #include LzmaDec.h
 
-#include string.h
+#include linux/string.h
 
 #define kNumTopBits 24
 #define kTopValue ((UInt32)1  kNumTopBits)
diff --git a/lib_generic/lzma/LzmaTools.c b/lib_generic/lzma/LzmaTools.c
index 88ba399..408b577 100644
--- a/lib_generic/lzma/LzmaTools.c
+++ b/lib_generic/lzma/LzmaTools.c
@@ -61,7 +61,6 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT 
*uncompressedSize,
 ISzAlloc g_Alloc;
 
 SizeT outSizeFull = 0x; /* 4GBytes limit */
-SizeT inProcessed;
 SizeT outProcessed;
 SizeT outSize;
 SizeT outSizeHigh;
diff --git a/lib_generic/lzma/Makefile b/lib_generic/lzma/Makefile
index 2916f21..57f03b0 100644
--- a/lib_generic/lzma/Makefile
+++ b/lib_generic/lzma/Makefile
@@ -30,7 +30,7 @@ LIB   = $(obj)liblzma.a
 
 SOBJS  =
 
-CFLAGS += -D_LZMA_PROB32 -I$(TOPDIR)/include/linux
+CFLAGS += -D_LZMA_PROB32
 
 COBJS-$(CONFIG_LZMA) += LzmaDec.o LzmaTools.o
 
-- 
1.6.0.4

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


Re: [U-Boot] [PATCH] Refresh LZMA-lib to v4.65

2009-07-22 Thread Luigi 'Comio' Mantellini
thanks

 Dear Luigi 'Comio' Mantellini,

 In message
 1248165949-5845-2-git-send-email-luigi.mantellini...@gmail.com
 you wrote:
 --===0963718385==

 From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com


 Signed-off-by: Luigi 'Comio' Mantellini
 luigi.mantell...@idf-hit.com
 ---
  common/cmd_bootm.c |5 +-
  include/configs/qemu-mips.h|2 +
  include/lzma/LzmaDec.h |   31 +
  include/lzma/LzmaDecode.h  |   31 -
  include/lzma/LzmaTools.h   |2 +-
  include/lzma/LzmaTypes.h   |   15 +-
  lib_generic/lzma/LGPL.txt  |  502 --
  lib_generic/lzma/LzmaDec.c | 1007
 +
  lib_generic/lzma/LzmaDec.h |  223 +++
  lib_generic/lzma/LzmaDecode.c  |  584 -
  lib_generic/lzma/LzmaDecode.h  |  113 
  lib_generic/lzma/LzmaTools.c   |  165 +++---
  lib_generic/lzma/LzmaTools.h   |4 +-
  lib_generic/lzma/LzmaTypes.h   |   45 --
  lib_generic/lzma/Makefile  |4 +-
  lib_generic/lzma/README.txt|8 +-
  lib_generic/lzma/Types.h   |  208 ++
  lib_generic/lzma/history.txt   |  434 +++--
  lib_generic/lzma/import_lzmasdk.sh |8 +-
  lib_generic/lzma/license.txt   |3 +
  lib_generic/lzma/lzma.txt  | 1257
 +---
  21 files changed, 2404 insertions(+), 2247 deletions(-)
  create mode 100644 include/lzma/LzmaDec.h
  delete mode 100644 include/lzma/LzmaDecode.h
  delete mode 100644 lib_generic/lzma/LGPL.txt
  create mode 100644 lib_generic/lzma/LzmaDec.c
  create mode 100644 lib_generic/lzma/LzmaDec.h
  delete mode 100644 lib_generic/lzma/LzmaDecode.c
  delete mode 100644 lib_generic/lzma/LzmaDecode.h
  delete mode 100644 lib_generic/lzma/LzmaTypes.h
  create mode 100644 lib_generic/lzma/Types.h
  create mode 100644 lib_generic/lzma/license.txt

 Applying: Refresh LZMA-lib to v4.65
 /home/wd/git/u-boot/work/.git/rebase-apply/patch:854: trailing
 whitespace.

 /home/wd/git/u-boot/work/.git/rebase-apply/patch:1038: trailing
 whitespace.

 /home/wd/git/u-boot/work/.git/rebase-apply/patch:1437: trailing
 whitespace.

 /home/wd/git/u-boot/work/.git/rebase-apply/patch:1483: trailing
 whitespace.

 /home/wd/git/u-boot/work/.git/rebase-apply/patch:1614: trailing
 whitespace.

 warning: squelched 100 whitespace errors
 warning: 105 lines applied after fixing whitespace errors.


 Applied.

 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
 miracle:  an  extremely  outstanding  or  unusual  event,
 thing,  or
 accomplishment.- Webster's
 Dictionary


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


[U-Boot] Refresh LZMA-lib to v4.65 (v2)

2009-07-21 Thread Luigi \'Comio\' Mantellini

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


[U-Boot] Refresh LZMA-lib to v4.65 (v3 resend)

2009-07-21 Thread Luigi 'Comio' Mantellini

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


Re: [U-Boot] [PATCH] Refresh LZMA-lib to 4.65

2009-07-21 Thread Luigi 'Comio' Mantellini
Dear Wolfgang,

Sorry for my silence, but in the last time I have too things  in my agenda.
I sent again the patch with the required fix but you need to approve my mail 
because it is very huge.

Thanks and best regards,

luigi

Il lunedì 20 luglio 2009 23:46:32 Wolfgang Denk ha scritto:
 Dear Luigi 'Comio' Mantellini,

 In message 1246985548-24183-1-git-send-email-luigi.mantellini...@gmail.com 
you wrote:
  --===1785671948==
 
  From: Luigi 'Comio' Mantellini luigi.mantell...@idf-hit.com
 
  ---
   common/cmd_bootm.c |5 +-
   include/lzma/LzmaDec.h |   31 +
   include/lzma/LzmaDecode.h  |   31 -
   include/lzma/LzmaTools.h   |2 +-
   include/lzma/LzmaTypes.h   |   15 +-
   lib_generic/lzma/LGPL.txt  |  502 --
   lib_generic/lzma/LzmaDec.c | 1007 +
   lib_generic/lzma/LzmaDec.h |  223 +++
   lib_generic/lzma/LzmaDecode.c  |  584 -
   lib_generic/lzma/LzmaDecode.h  |  113 
   lib_generic/lzma/LzmaTools.c   |  164 +++---
   lib_generic/lzma/LzmaTools.h   |4 +-
   lib_generic/lzma/LzmaTypes.h   |   45 --
   lib_generic/lzma/Makefile  |4 +-
   lib_generic/lzma/README.txt|8 +-
   lib_generic/lzma/Types.h   |  208 ++
   lib_generic/lzma/history.txt   |  434 +++--
   lib_generic/lzma/import_lzmasdk.sh |8 +-
   lib_generic/lzma/lzma.txt  | 1257
  +--- 19 files changed, 2398
  insertions(+), 2247 deletions(-)
   create mode 100644 include/lzma/LzmaDec.h
   delete mode 100644 include/lzma/LzmaDecode.h
   delete mode 100644 lib_generic/lzma/LGPL.txt
   create mode 100644 lib_generic/lzma/LzmaDec.c
   create mode 100644 lib_generic/lzma/LzmaDec.h
   delete mode 100644 lib_generic/lzma/LzmaDecode.c
   delete mode 100644 lib_generic/lzma/LzmaDecode.h
   delete mode 100644 lib_generic/lzma/LzmaTypes.h
   create mode 100644 lib_generic/lzma/Types.h

 Are you going to resend an updated version of this patch any time
 soon so it can go into this upcoming release?

 Thanks in advance.

 Best regards,

 Wolfgang Denk

-- 

Luigi Mantellini
RD - Software

Industrie Dial Face S.p.A.
Via Canzo, 4 
20068 Peschiera Borromeo (MI) Italy
Tel.: +39 02 5167 2813
Fax: +39 02 5167 2459
E-mail: luigi.mantell...@idf-hit.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] IP_t should be a packed struct

2009-01-28 Thread Luigi 'Comio' Mantellini
Hi ML,

I noticed that also the others headers structs have the same potential 
problem.
I attached the patch to fix the net.h header file.

best regards,

luigi

On Tuesday 27 January 2009 19:32:10 Luigi 'Comio' Mantellini wrote:
 Hi ML,

 I'm working on a mips target and I used qemu_mips target to simulate my
 target (that I hope to have in the next week...)

 Following my activities I noticed that IP_t structure is no defined with
 attribute packed. I noticed this issue because using a self-made
 toolchain (gcc4.2.4+binutils2.8+uclibc0.9.30) the compiler has aligned all
 bytes to 32bit boundary. This is not ok, because the packets IP_t can be
 non aligned (see the /net/net.c PingSend function, for an example).

 The dirty solution is to define the structure with the
 __attribute__((__packed__))... but, from my point of view, a better packet
 forging mechanism should be implemented into the net.c stack.

 I attached a trivial patch that solved the issue on my target.

 Any comments is welcome.

 best regards,

 luigi

-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantell...@idf-hit.com

diff --git a/include/net.h b/include/net.h
index d2d394f..f14df6c 100644
--- a/include/net.h
+++ b/include/net.h
@@ -154,7 +154,7 @@ typedef struct {
 	uchar		et_snap2;
 	uchar		et_snap3;
 	ushort		et_prot;	/* 802 protocol			*/
-} Ethernet_t;
+} __attribute__((__packed__)) Ethernet_t;
 
 #define ETHER_HDR_SIZE	14		/* Ethernet header size		*/
 #define E802_HDR_SIZE	22		/* 802 ethernet header size	*/
@@ -168,7 +168,7 @@ typedef struct {
 	ushort		vet_vlan_type;	/* PROT_VLAN			*/
 	ushort		vet_tag;	/* TAG of VLAN			*/
 	ushort		vet_type;	/* protocol type		*/
-} VLAN_Ethernet_t;
+} __attribute__((__packed__)) VLAN_Ethernet_t;
 
 #define VLAN_ETHER_HDR_SIZE	18	/* VLAN Ethernet header size	*/
 
@@ -198,7 +198,7 @@ typedef struct {
 	ushort		udp_dst;	/* UDP destination port		*/
 	ushort		udp_len;	/* Length of UDP packet		*/
 	ushort		udp_xsum;	/* Checksum			*/
-} IP_t;
+} __attribute__((__packed__)) IP_t;
 
 #define IP_OFFS		0x1fff /* ip offset *= 8 */
 #define IP_FLAGS	0xe000 /* first 3 bits */
@@ -239,7 +239,7 @@ typedef struct
 	uchar		ar_tha[];	/* Target hardware address	*/
 	uchar		ar_tpa[];	/* Target protocol address	*/
 #endif /* 0 */
-} ARP_t;
+} __attribute__((__packed__)) ARP_t;
 
 #define ARP_HDR_SIZE	(8+20)		/* Size assuming ethernet	*/
 
@@ -269,7 +269,7 @@ typedef struct icmphdr {
 			ushort	mtu;
 		} frag;
 	} un;
-} ICMP_t;
+} __attribute__((__packed__)) ICMP_t;
 
 
 /*
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] IP_t should be a packed struct

2009-01-27 Thread Luigi 'Comio' Mantellini
Hi ML,

I'm working on a mips target and I used qemu_mips target to simulate my target 
(that I hope to have in the next week...)

Following my activities I noticed that IP_t structure is no defined with 
attribute packed. I noticed this issue because using a self-made toolchain 
(gcc4.2.4+binutils2.8+uclibc0.9.30) the compiler has aligned all bytes to 
32bit boundary. This is not ok, because the packets IP_t can be non aligned 
(see the /net/net.c PingSend function, for an example).

The dirty solution is to define the structure with the 
__attribute__((__packed__))... but, from my point of view, a better packet 
forging mechanism should be implemented into the net.c stack.

I attached a trivial patch that solved the issue on my target.

Any comments is welcome.

best regards,

luigi

-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantell...@idf-hit.com

diff --git a/include/net.h b/include/net.h
index d2d394f..c04f84c 100644
--- a/include/net.h
+++ b/include/net.h
@@ -198,7 +198,7 @@ typedef struct {
 	ushort		udp_dst;	/* UDP destination port		*/
 	ushort		udp_len;	/* Length of UDP packet		*/
 	ushort		udp_xsum;	/* Checksum			*/
-} IP_t;
+} __attribute__((__packed__)) IP_t;
 
 #define IP_OFFS		0x1fff /* ip offset *= 8 */
 #define IP_FLAGS	0xe000 /* first 3 bits */
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] qemu-mips usage

2009-01-26 Thread Luigi 'Comio' Mantellini
Hi ML,

I'm evaluating the qemu-mips to simulate a mips 4kec/24kec board. I'm working 
on the high level booting sequence (linux init scripts), and qemu+uboot should 
be a good choice to emulate a basic system (flash + dram + 4kec cpu).

Furthermore, also following the doc/README.qemu_mips, I'm not able to see the 
u-boot prompt on my qemu because the flash is not recognized. I haven't 
experience with qemu-mips and I don't understand where the flash is placed 
(canonical 0xbf address?) and how it is managed. Reading the 
configs/qemu_mips.h, It seems that the flash is managed as a common CFI flash 
placed to 0xbfc0 address... but u-boot shows always Unknown FLASH on Bank 
1 on startup.

Has anyone tried to use qemu-mips to boot a standard u-boot image (qemu_mips 
target on u-boot)?


Thanks for any suggestion.

luigi

### Useful Infos 

This is the qemu banner (on Ubuntu 8.10):

EMU PC emulator version 0.9.1, Copyright (c) 2003-2008 Fabrice Bellard

This is the execution log:

$ cp ../u-boot-vanilla/u-boot.bin mips_bios.bin
$ dd of=flash bs=1k count=4k if=/dev/zero
4096+0 records in
4096+0 records out
4194304 bytes (4,2 MB) copied, 0,046865 s, 89,5 MB/s
$ dd of=flash bs=1k conv=notrunc if=../u-boot-vanilla/u-boot.bin
163+1 records in
163+1 records out
167076 bytes (167 kB) copied, 0,00124954 s, 134 MB/s
$ qemu-system-mips -M mips -pflash flash -monitor null -nographic
qemu: Warning, could not load MIPS bios '/usr/share/qemu/mips_bios.bin'
Terminated

$ qemu-system-mips -L . -M mips -pflash flash -monitor null -nographic


U-Boot 2009.01-00080-g8f86a36 (gen 26 2009 - 09:23:04)

Board: Qemu -M mips CPU: 24Kf proc_id=0x19300
DRAM:  128 MB
## Unknown FLASH on Bank 1 - Size = 0x = 0 MB
Terminated
$



-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantell...@idf-hit.com

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


Re: [U-Boot] qemu-mips usage

2009-01-26 Thread Luigi 'Comio' Mantellini
Dear All,

thanks for the help.
I used the last svn copy and it works fine:
URL: svn://svn.savannah.nongnu.org/qemu/trunk
Repository Root: svn://svn.savannah.nongnu.org/qemu
Repository UUID: c046a42c-6fe2-441c-8c8c-71466251a162
Revision: 6436

Anyway I created a trivial patch in order to permit to have an arbitrary flash 
size on mips board (I'm need to simulate a board with 32MB instead the usual 
4M). Using the patch, the flash memory placed at the end of 0xbf  
memory space:

4MB flash: start bfc0 - end bfff
8MB flash: start bf80 - end bfff
16MB flash: start bf00 - end bfff
32MB flash: start be00 - end bfff

The firmware must be placed always at address 0xbfc0. these are the 
relative address on the file:

4MB flash: firmware offset +0
8MB flash: firmware offset +4MB
16MB flash: firmware offset +12MB
32MB flash: firmware offset +28MB

To create the image files, use the following  trivial script:

dd if=/dev/zero of=flash.img bs=$flashsize count=1 conv=sync
dd if=u-boot.bi of=flash.img bs=1 seek=$biosbase conv=notrunc


Thanks again for your support.

luigi


On Monday 26 January 2009 13:53:07 Jean-Christophe PLAGNIOL-VILLARD wrote:
 On 10:13 Mon 26 Jan , Luigi 'Comio' Mantellini wrote:
  Hi ML,
 
  I'm evaluating the qemu-mips to simulate a mips 4kec/24kec board. I'm
  working on the high level booting sequence (linux init scripts), and
  qemu+uboot should be a good choice to emulate a basic system (flash +
  dram + 4kec cpu).
 
  Furthermore, also following the doc/README.qemu_mips, I'm not able to see
  the u-boot prompt on my qemu because the flash is not recognized. I
  haven't experience with qemu-mips and I don't understand where the flash
  is placed (canonical 0xbf address?) and how it is managed. Reading
  the configs/qemu_mips.h, It seems that the flash is managed as a common
  CFI flash placed to 0xbfc0 address... but u-boot shows always
  Unknown FLASH on Bank 1 on startup.
 
  Has anyone tried to use qemu-mips to boot a standard u-boot image
  (qemu_mips target on u-boot)?
 
 
  Thanks for any suggestion.
 
  luigi
 
  ### Useful Infos 
 
  This is the qemu banner (on Ubuntu 8.10):
 
  EMU PC emulator version 0.9.1, Copyright (c) 2003-2008 Fabrice Bellard

 Please use the SVN version of qemu for the current u-boot version

 I'll update the README.qemu_mips to specify the last u-boot version for the
 old qemu

 Best Regards,
 J.

-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: luigi.mantell...@idf-hit.com

Index: hw/mips_r4k.c
===
--- hw/mips_r4k.c	(revision 6436)
+++ hw/mips_r4k.c	(working copy)
@@ -16,7 +16,10 @@
 #include boards.h
 #include flash.h
 #include qemu-log.h
+#include block_int.h
 
+#include sys/stat.h
+
 #ifdef TARGET_WORDS_BIGENDIAN
 #define BIOS_FILENAME mips_bios.bin
 #else
@@ -205,10 +208,16 @@
 	cpu_register_physical_memory(0x1fc0,
  BIOS_SIZE, bios_offset | IO_MEM_ROM);
 } else if ((index = drive_get_index(IF_PFLASH, 0, 0))  -1) {
+struct stat infobuf;  /* place to store info */
 uint32_t mips_rom = 0x0040;
-cpu_register_physical_memory(0x1fc0, mips_rom,
+
+if (stat(drives_table[index].bdrv-filename, infobuf) == 0) {
+mips_rom = infobuf.st_size;
+}
+		
+cpu_register_physical_memory(0x2000 - mips_rom, mips_rom,
 	 qemu_ram_alloc(mips_rom) | IO_MEM_ROM);
-if (!pflash_cfi01_register(0x1fc0, qemu_ram_alloc(mips_rom),
+if (!pflash_cfi01_register(0x2000 - mips_rom, qemu_ram_alloc(mips_rom),
 drives_table[index].bdrv, sector_len, mips_rom / sector_len,
 4, 0, 0, 0, 0)) {
 fprintf(stderr, qemu: Error registering flash memory.\n);
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] lookup tables: how can i manage them?

2008-10-19 Thread Luigi 'Comio' Mantellini
Hi ML,

in my code (for now a stupid SMI interface) I'm using a jump table like this:

struct reg:{
callback_1 c1,
callback_2 c2,
...
};

struct reg mytable[100]={ . }

c1 and c2 are pointer to functions.

My problem is that U-boot relocates itself into ram and these pointers are 
calculated at linking time.

Which is the best practice (into u.boot) to manage these loolup tables/jmps 
tables? is there a suggest way or a common place to put the needed relocation 
code (adding the gd-reloc_off to the pointers)?

I'm working on mips, but I thinks that this is a general question.

thanks in advance.

best regards,

luigi


PS.: I made a stupid driver to manage smi interface, that is a theme 
variation on mii bus, to manage a tantos switch. I can send the code if there 
is interest.
-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: [EMAIL PROTECTED]

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


Re: [U-Boot] [U-Boot-Users] [PATCH] Add support for LZMA uncompression algorithm.

2008-09-17 Thread Luigi 'Comio' Mantellini
Hi Xinhe Guo,

Il mercoledì 17 settembre 2008 05:36:16 Xinhe Guo ha scritto:
 Hi luigi,



 Thank you. Seems solution is:

 Add lzma decompress initrd support
- Into the Linux Kernel

 Add u-boot support mkimage's lzma format is enough.

- into U-boot


ciao

luigi






 Thanks



 Xinhe Guo



 

 From: Luigi 'Comio' Mantellini [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, September 16, 2008 10:16 PM
 To: u-boot@lists.denx.de
 Cc: Xinhe Guo
 Subject: Re: [U-Boot] [U-Boot-Users] [PATCH] Add support for LZMA
 uncompression algorithm.

 Il martedì 16 settembre 2008 10:48:19 Xinhe Guo ha scritto:
  Hi Luigi,
 
 
 
 
 
 
 
  I am trying to add lzma decompress support in my u-boot-1.1.6 source
 
  code to load a lzma compressed linux initrd. Is there a lzma patch for
 
  u-boot source code available for download?

 Warning! the initrd decompression is in charge to the Linux Kernel. U-boot
 code unpacks only the kernel image without ___Filesystem___

 ciao

 luigi

  Thank you very much.
 
 
 
 
 
 
 
  Guo Xinhe

-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: [EMAIL PROTECTED]

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


Re: [U-Boot] [PATCH 1/1 V3] Add support for LZMA uncompression algorithm.

2008-09-14 Thread Luigi 'Comio' Mantellini
Sorry again, but I cannot use git-send-email. This is the corrected patch.

Best regards,

luigi

Il domenica 14 settembre 2008 00:58:10 Wolfgang Denk ha scritto:
 Dear Luigi 'Comio' Mantellini,

 In message [EMAIL PROTECTED] you wrote:
  I noticed a typo in the lzma uncompress invocation (image_start
  instead=20 image_len).
 
  This patch correct the mistake.

 Please add your Signed-off-by: line...

 Best regards,

 Wolfgang Denk

-- 

Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: [EMAIL PROTECTED]

From 565ecc8ff0a21a9a9f3381c0bfaea629598b7c00 Mon Sep 17 00:00:00 2001
From: Luigi 'Comio' Mantellini [EMAIL PROTECTED]
Date: Sat, 13 Sep 2008 10:04:32 +0200
Subject: [PATCH] Fix lzma uncompress call (image_start wrongly used instead image_len)


Signed-off-by: Luigi 'Comio' Mantellini [EMAIL PROTECTED]
---
 common/cmd_bootm.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 19257bb..897e9f6 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -347,7 +347,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 
 		int ret = lzmaBuffToBuffDecompress(
 			(unsigned char *)load, unc_len,
-			(unsigned char *)image_start, image_start);
+			(unsigned char *)image_start, image_len);
 		if (ret != LZMA_RESULT_OK) {
 			printf (LZMA: uncompress or overwrite error %d 
 - must RESET board to recover\n, ret);
-- 
1.5.4.3

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


[U-Boot] Watchdog support.

2008-09-14 Thread Luigi 'Comio' Mantellini
Hi ML,

I'm working  on a mips based SoC with an external watchdog. The watchdog 
should be touched every 5 seconds in order to avoid the system reboot.

I tried to define macros like CONFIG_HW_WATCHDOG / CONFIG_WATCHDOG, but I'm not 
happy for the result. For example, the serial port driver (ns16550 in my case) 
don't touch the watchdog during the status polling, as well as a lot of 
commands (copy in flash, tftp, ...).

I don't understand if u-boot supports or not watchdogs in a structural 
manner.

Kindly, if you have experience on Watchdog under u-boot, tell my any comments 
or suggestion in my application the watchdog is mandatory (i cannot stop 
the _watchdog_).

Thanks again and best regards,

luigi

-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: [EMAIL PROTECTED]

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


Re: [U-Boot] [PATCH 1/1 V3] Add support for LZMA uncompression algorithm.

2008-09-13 Thread Luigi 'Comio' Mantellini
I noticed a typo in the lzma uncompress invocation (image_start instead 
image_len).

This patch correct the mistake.

best regards.

luigi

(I'm sorry but I cannot use the git-send-email)


Il lunedì 08 settembre 2008 02:46:13 Jean-Christophe PLAGNIOL-VILLARD ha 
scritto:
 From: Luigi 'Comio' Mantellini [EMAIL PROTECTED]

 Signed-off-by: Luigi 'Comio' Mantellini [EMAIL PROTECTED]
 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD [EMAIL PROTECTED]
 ---
 Add missing lzma/Makefile
  Makefile   |1 +
  README |   23 ++
  common/cmd_bootm.c |   23 ++
  common/image.c |1 +
  include/image.h|1 +
  include/lzma/LzmaDecode.h  |   31 ++
  include/lzma/LzmaTools.h   |   31 ++
  include/lzma/LzmaTypes.h   |   31 ++
  lib_generic/lzma/LGPL.txt  |  504 +++
  lib_generic/lzma/LzmaDecode.c  |  584 +++
  lib_generic/lzma/LzmaDecode.h  |  113 ++
  lib_generic/lzma/LzmaTools.c   |  142 
  lib_generic/lzma/LzmaTools.h   |   35 ++
  lib_generic/lzma/LzmaTypes.h   |   45 +++
  lib_generic/lzma/Makefile  |   50 +++
  lib_generic/lzma/README.txt|   28 ++
  lib_generic/lzma/history.txt   |  198 +++
  lib_generic/lzma/import_lzmasdk.sh |   38 ++
  lib_generic/lzma/lzma.txt  |  663
  19 files changed, 2542 insertions(+),
 0 deletions(-)
  create mode 100644 include/lzma/LzmaDecode.h
  create mode 100644 include/lzma/LzmaTools.h
  create mode 100644 include/lzma/LzmaTypes.h
  create mode 100644 lib_generic/lzma/LGPL.txt
  create mode 100644 lib_generic/lzma/LzmaDecode.c
  create mode 100644 lib_generic/lzma/LzmaDecode.h
  create mode 100644 lib_generic/lzma/LzmaTools.c
  create mode 100644 lib_generic/lzma/LzmaTools.h
  create mode 100644 lib_generic/lzma/LzmaTypes.h
  create mode 100644 lib_generic/lzma/Makefile
  create mode 100644 lib_generic/lzma/README.txt
  create mode 100644 lib_generic/lzma/history.txt
  create mode 100644 lib_generic/lzma/import_lzmasdk.sh
  create mode 100644 lib_generic/lzma/lzma.txt
-- 

Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: [EMAIL PROTECTED]

From 565ecc8ff0a21a9a9f3381c0bfaea629598b7c00 Mon Sep 17 00:00:00 2001
From: Luigi 'Comio' Mantellini [EMAIL PROTECTED]
Date: Sat, 13 Sep 2008 10:04:32 +0200
Subject: [PATCH] Fix lzma uncompress call (image_start wrongly used instead image_len)

---
 common/cmd_bootm.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 19257bb..897e9f6 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -347,7 +347,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, int boot_progress)
 
 		int ret = lzmaBuffToBuffDecompress(
 			(unsigned char *)load, unc_len,
-			(unsigned char *)image_start, image_start);
+			(unsigned char *)image_start, image_len);
 		if (ret != LZMA_RESULT_OK) {
 			printf (LZMA: uncompress or overwrite error %d 
 - must RESET board to recover\n, ret);
-- 
1.5.4.3

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


Re: [U-Boot] [Announce][RFC] CFG_ macro re naming

2008-09-13 Thread Luigi 'Comio' Mantellini
Hi Jean-Christophe,
Hi Wolfgang,

Can you create a deprecated_cfg.h file that contains directives like:

#ifdef CFG_OLD_PARAMATER
#error CFG_OLD_PARAMETER renamed! Use CONIFIG_NEW_PARAMETER instead!
#endif

for each CFG_* renamed directive?

This should avoid to lost some configuration parameters during this 
transitory.phase. this file should be included by common.h for example.

my2cents

best regards,

luigi


Il martedì 02 settembre 2008 02:59:58 Jean-Christophe PLAGNIOL-VILLARD ha 
scritto:
 2) Extra config
  
 For memory settings CONFIG_MEM_ or CONFIG_SYS_MEM_
  
 For PCI settings CONFIG_PCI_ or CONFIG_SYS_PCI_
  
 For USB settings CONFIG_USE or CONFIG_SYS_PCI_
  
 For flash settings CONFIG_FLASH or CONFIG_SYS_FLASH_
  
 For nand settins CONFIG_NAND or CONFIG_SYS_NAND_
  
 For dtt settgins CONFIG_DTT or CONFIG_SYS_DTT
  
 etc...
 
  Please do not do that, as it will interfere with  a  lot  of  already
  existing definitions. Stick with CONFIG_SYS_ in general. There may be
  some  cases  where  your suggestion makes sense, but these need to be
  carefully hand-selected,  i.  e.  this  must  not  be  done  by  some
  automatically running script.

 As you point this part was plain to be done manually.

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

-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: [EMAIL PROTECTED]

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


Re: [U-Boot] [Announce][RFC] CFG_ macro re naming

2008-09-13 Thread Luigi 'Comio' Mantellini
Hi J.

see inline comments.
Il sabato 13 settembre 2008 23:41:55 Jean-Christophe PLAGNIOL-VILLARD ha 
scritto:
 On 23:38 Sat 13 Sep , Luigi 'Comio' Mantellini wrote:
  Hi Jean-Christophe,
  Hi Wolfgang,
 
  Can you create a deprecated_cfg.h file that contains directives like:
 
  #ifdef CFG_OLD_PARAMATER
  #error CFG_OLD_PARAMETER renamed! Use CONIFIG_NEW_PARAMETER instead!
  #endif
 
  for each CFG_* renamed directive?
 
  This should avoid to lost some configuration parameters during this
  transitory.phase. this file should be included by common.h for example.

 IMHO, I do not think it's needed due to there is no lost possible with
 this kind of script

 git-grep CFG_ | cut -d: -f1 | grep -v -e CHANGELOG* | xargs sed -i -e
 s:CFG_:CONFIG_SYS_:g


This doesn't apply on CFG_ENV_IS_* / CONFIG_ENV_IS_* macros (for example). and 
I should use this grep/sed only at the end of the macro renaming. I'm speaking 
about the transitory time.

Best regards,

luigi

 Best Regards,
 J.

-- 


?
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4 
20068 Peschiera Borromeo (MI), Italy
Tel.:   +39 02 5167 2813
Fax:    +39 02 5167 2459
E-mail: [EMAIL PROTECTED]


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


Re: [U-Boot] Run hello_world.c example code at u-boot prompt using ARM Board

2008-09-06 Thread Luigi 'Comio' Mantellini
Il sabato 06 settembre 2008 12:17:54 naveen yadav ha scritto:
 Hi All,

 I want to run hello_world.c example with printf enable . I load tftp
 hello_world.bin using at 0x20

 tftp 0x2 hello_world.bin
 go 0x20

the address where you load is different that the address where you jump... is 
it a typo?

ciao

luigi


 After this System get freeze. I am very thankfull if any body have any
 Idea. I am using ARM 11.

 Best Regards
 Naveen

-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: [EMAIL PROTECTED]

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


Re: [U-Boot] U-Boot Versioning

2008-08-31 Thread Luigi 'Comio' Mantellini
Il sabato 30 agosto 2008 01:12:31 Wolfgang Denk ha scritto:
 Dear Jerry Van Baren,

 In message [EMAIL PROTECTED] you wrote:
  Of course, we need silly alphabetical animal names for code names.

 Do we?

  No, wait, that's been done before.  I know!  We can use u-boat names for
  the code names.  We can start with the code name Unterseeboot 1.
 http://en.wikipedia.org/wiki/List_of_U-boats
 
  ;-P

 Or use colors.

 The next release will then be the Yellow Submarine :)

Anyway give a name to the realeases is good idea.

my2eurocents

luigi


 Best regards,

 Wolfgang Denk

-- 
Luigi Mantellini
RD - Software
Industrie Dial Face S.p.A.
Via Canzo, 4
20068 Peschiera Borromeo (MI), Italy
Tel.:  +39 02 5167 2813
Fax:   +39 02 5167 2459
Email: [EMAIL PROTECTED]

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