[U-Boot] which toolchain version for Microblaze

2012-10-12 Thread Stephan Linz
Hi Michal,
Hi David

which version of binutils and gcc you are currently using for embedded
Linux development? Just now I've played a little bit with the new one
I've found in the Xilinx git repository on:

git://git.xilinx.com/microblaze-gnu.git

Unfortunately both the binaries and the sources seems to be buggy. When
I try to compile U-Boot with it the final linker stage runs into a
SIGSEGV -- here is the (reduced) output:


UNDEF_SYM=`microblaze-unknown-linux-gnu-objdump -x
board/xilinx/microblaze-generic/libmicroblaze-generic.o api/libapi.o
arch/microblaze/cpu/libmicroblaze.o arch/microblaze/lib/libmicroblaze.o
**/*.o | sed  -n -e 's/.*\(__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;
cd /store/devel/MICROBLAZE/u-boot-mbref &&
microblaze-unknown-linux-gnu-ld.bfd  -T u-boot.lds -Bstatic -Ttext
0x2900 $UNDEF_SYM arch/microblaze/cpu/start.o --start-group
api/libapi.o arch/microblaze/cpu/libmicroblaze.o
arch/microblaze/lib/libmicroblaze.o **/*.o
board/xilinx/microblaze-generic/libmicroblaze-generic.o --end-group
-L 
/opt/tools-4.6.2-mb-xilinx-v3.0/microblaze-unknown-linux-gnu/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.6.2
 -lgcc -Map u-boot.map -o u-boot

/opt/tools-4.6.2-mb-xilinx-v3.0/microblaze-unknown-linux-gnu/bin/../lib/gcc/microblaze-unknown-linux-gnu/4.6.2/libgcc.a(_muldi3.o):
 In function `__muldi3':
/home/buildbot/plgx_bld/xils005/2012_06_30/toolchains/lin32-microblaze-xilinx-linux-gnu/crosstool-ng/targets/src/gcc-4.6.2/libgcc/../gcc/libgcc2.c:549:
 undefined reference to `_GLOBAL_OFFSET_TABLE_'
/bin/sh: line 1: 17792 Segmentation fault


@David: This error can be reproduced with the binaries in Xilinx git
repo. Have you any idea?

@Michal: which version did you use currently?

@all: Is there anybody who can give me a hint how I can / should handle
this error?



br,
Stephan

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


Re: [U-Boot] [PATCH 2/4] microblaze: Fix byteorder for microblaze

2012-10-11 Thread Stephan Linz
Am Freitag, den 05.10.2012, 14:58 +0200 schrieb Michal Simek: 
> Just remove ancient code.
> 
> Signed-off-by: Michal Simek 
> ---
>  arch/microblaze/include/asm/byteorder.h |   23 ---
>  1 files changed, 0 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/microblaze/include/asm/byteorder.h 
> b/arch/microblaze/include/asm/byteorder.h
> index b2757a4..f3a471d 100644
> --- a/arch/microblaze/include/asm/byteorder.h
> +++ b/arch/microblaze/include/asm/byteorder.h
> @@ -20,29 +20,6 @@
>  
>  #ifdef __GNUC__
>  
> -/* This is effectively a dupe of the arch-independent byteswap
> -   code in include/linux/byteorder/swab.h, however we force a cast
> -   of the result up to 32 bits.  This in turn forces the compiler
> -   to explicitly clear the high 16 bits, which it wasn't doing otherwise.
> -
> -   I think this is a symptom of a bug in mb-gcc.  JW 20040303
> -*/
> -
> -
> -static __inline__ __u16 ___arch__swab16 (__u16 half_word)
> -{
> - /* 32 bit temp to cast result, forcing clearing of high word */
> - __u32 temp;
> -
> - temp = ((half_word & 0x00FFU) << 8) | ((half_word & 0xFF00U) >> 8);
> -
> - return (__u16) temp;
> -}
> -
> -#define __arch__swab16(x) ___arch__swab16(x)
> -
> -/* Microblaze has no arch-specific endian conversion insns */
> -

Acked-by: Stephan Linz 

> 
>  #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
>  #  define __BYTEORDER_HAS_U64__
>  #  define __SWAB_64_THRU_32__


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


Re: [U-Boot] [PATCH 1/4] microblaze: Fix compilation warning in ext2_find_next_zero_bit

2012-10-11 Thread Stephan Linz
Am Freitag, den 05.10.2012, 14:58 +0200 schrieb Michal Simek: 
> ext2_find_next_zero_bit must be also static if __swab32 is also static.
> 
> Warning:
> include/asm/bitops.h:369:22: warning: '__fswab32' is static but
> used in inline function 'ext2_find_next_zero_bit'
> which is not static [enabled by default]
> 
> Signed-off-by: Michal Simek 
> ---
>  arch/microblaze/include/asm/bitops.h |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/microblaze/include/asm/bitops.h 
> b/arch/microblaze/include/asm/bitops.h
> index e8c835f..eafa2b5 100644
> --- a/arch/microblaze/include/asm/bitops.h
> +++ b/arch/microblaze/include/asm/bitops.h
> @@ -319,7 +319,8 @@ extern __inline__ int ext2_test_bit(int nr, const 
> volatile void * addr)
>  #define ext2_find_first_zero_bit(addr, size) \
>   ext2_find_next_zero_bit((addr), (size), 0)
>  
> -extern __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned 
> long size, unsigned long offset)
> +static inline unsigned long ext2_find_next_zero_bit(void *addr,
> + unsigned long size, unsigned long offset)

Acked-by: Stephan Linz 

> {
>   unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
>   unsigned long result = offset & ~31UL;

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


Re: [U-Boot] [PATCH] microblaze: Call spi_init function

2012-08-10 Thread Stephan Linz
Am Freitag, den 10.08.2012, 09:09 +0200 schrieb Michal Simek: 
> Initialization spi.
> 
> Signed-off-by: Michal Simek 

Acked-by: Stephan Linz 

> ---
>  arch/microblaze/lib/board.c |5 +
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index 674b573..ef4bac4 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -32,6 +32,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -166,6 +167,10 @@ void board_init_f(ulong not_used)
>   }
>  #endif
>  
> +#ifdef CONFIG_SPI
> + spi_init();
> +#endif
> +
>   /* relocate environment function pointers etc. */
>   env_relocate ();
>  

-- 
Viele Grüße,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH v2 3/7] microblaze: intc: Registering interrupt should return value

2012-08-08 Thread Stephan Linz
Am Mittwoch, den 08.08.2012, 10:27 +0200 schrieb Michal Simek: 
> On 08/07/2012 10:10 PM, Stephan Linz wrote:
> > Am Montag, den 06.08.2012, 09:46 +0200 schrieb Michal Simek:
> >> Return value to find out if un/registration was succesful.
> >>
> >> Signed-off-by: Michal Simek 
> >>
> >> ---
> >> v2: Add comment to header file to describe parameters and return codes
> >> ---
> >>   arch/microblaze/cpu/interrupts.c  |   16 +---
> >>   arch/microblaze/include/asm/microblaze_intc.h |   11 ++-
> >>   2 files changed, 19 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/arch/microblaze/cpu/interrupts.c 
> >> b/arch/microblaze/cpu/interrupts.c
> >> index ee67082..08f6bad 100644
> >> --- a/arch/microblaze/cpu/interrupts.c
> >> +++ b/arch/microblaze/cpu/interrupts.c
> >> @@ -91,14 +91,13 @@ static void disable_one_interrupt(int irq)
> >>   #endif
> >>   }
> >>
> >> -/* adding new handler for interrupt */
> >> -void install_interrupt_handler (int irq, interrupt_handler_t * hdlr, void 
> >> *arg)
> >> +int install_interrupt_handler(int irq, interrupt_handler_t *hdlr, void 
> >> *arg)
> >>   {
> >>struct irq_action *act;
> >>/* irq out of range */
> >>if ((irq < 0) || (irq > irq_no)) {
> >>puts ("IRQ out of range\n");
> >> -  return;
> >> +  return -1;
> >>}
> >>act = &vecs[irq];
> >>if (hdlr) { /* enable */
> >> @@ -106,11 +105,14 @@ void install_interrupt_handler (int irq, 
> >> interrupt_handler_t * hdlr, void *arg)
> >>act->arg = arg;
> >>act->count = 0;
> >>enable_one_interrupt (irq);
> >> -  } else {/* disable */
> >> -  act->handler = (interrupt_handler_t *) def_hdlr;
> >> -  act->arg = (void *)irq;
> >> -  disable_one_interrupt (irq);
> >> +  return 0;
> >>}
> >> +
> >> +  /* Disable */
> >> +  act->handler = (interrupt_handler_t *) def_hdlr;
> >> +  act->arg = (void *)irq;
> >> +  disable_one_interrupt(irq);
> >> +  return 1;
> >>   }
> >>
> >>   /* initialization interrupt controller - hardware */
> >> diff --git a/arch/microblaze/include/asm/microblaze_intc.h 
> >> b/arch/microblaze/include/asm/microblaze_intc.h
> >> index 6142b9c..e9640f5 100644
> >> --- a/arch/microblaze/include/asm/microblaze_intc.h
> >> +++ b/arch/microblaze/include/asm/microblaze_intc.h
> >> @@ -39,7 +39,16 @@ struct irq_action {
> >>int count; /* number of interrupt */
> >>   };
> >>
> >> -void install_interrupt_handler (int irq, interrupt_handler_t * hdlr,
> >> +/**
> >> + * Register and unregister interrupt handler rutines
> >> + *
> >> + * @param irq IRQ number
> >> + * @param hdlrInterrupt handler rutine
> >> + * @param arg Pointer to argument which is passed to int. handler 
> >> rutine
> >> + * @return0 if registration pass, 1 if unregistration pass,
> >> + *or an error code < 0 otherwise
> >> + */
> >> +int install_interrupt_handler(int irq, interrupt_handler_t *hdlr,
> >>   void *arg);
> >
> > Hi Michal,
> >
> > why not two different functions here, one for registration, another one
> > for unregistration? To mee it is puzzling to use a 'install' function
> > for unregistration ...
> 
> partially agree with that. Maybe we could introduce one macro for that.
> 
> #define uninstall_interrupt_handler(irq) install_interrupt_handler(irq, NULL, 
> NULL)

yes, that is ok ...

> 
> 
> > ... whatever, you should evaluate the return code in fsl_init2() too.
> 
> Not necessary to do it in this patch.

yes, it's another part ...

br,
Stephan

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


[U-Boot] [PATCH] spi: xilinx: Remove unused variable

2012-08-07 Thread Stephan Linz
Warning is:

xilinx_spi.c: In function 'spi_setup_slave':
xilinx_spi.c:81: warning: unused variable 'regs'

Signed-off-by: Stephan Linz 
CC: Michal Simek 
---
 drivers/spi/xilinx_spi.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index e563c19..52a4134 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -78,7 +78,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned 
int cs,
  unsigned int max_hz, unsigned int mode)
 {
struct xilinx_spi_slave *xilspi;
-   struct xilinx_spi_reg *regs;
 
if (!spi_cs_is_valid(bus, cs)) {
printf("XILSPI error: %s: unsupported bus %d / cs %d\n",
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH 2/2] serial: uartlite: Init all uartlites for serial multi

2012-08-07 Thread Stephan Linz
Am Dienstag, den 07.08.2012, 14:20 +0200 schrieb Michal Simek: 
> Initialize all possible uartlites and return the first
> initialized port. For static configuration is initialization
> done in userial_ports array.
> 
> Signed-off-by: Michal Simek 

Acked-by: Stephan Linz 

Tested with AXI system on Avnet S6LX9 micro-evaluation.

> ---
>  drivers/serial/serial_xuartlite.c |   34 +++---
>  1 files changed, 19 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/serial/serial_xuartlite.c 
> b/drivers/serial/serial_xuartlite.c
> index 3a38f9e..2bdb68b 100644
> --- a/drivers/serial/serial_xuartlite.c
> +++ b/drivers/serial/serial_xuartlite.c
> @@ -89,11 +89,17 @@ int uartlite_serial_tstc(const int port)
>   return in_be32(®s->status) & SR_RX_FIFO_VALID_DATA;
>  }
>  
> +static int uartlite_serial_init(const int port)
> +{
> + if (userial_ports[port])
> + return 0;
> + return -1;
> +}
> +
>  #if !defined(CONFIG_SERIAL_MULTI)
>  int serial_init(void)
>  {
> - /* FIXME: Nothing for now. We should initialize fifo, etc */
> - return 0;
> + return uartlite_serial_init(0);
>  }
>  
>  void serial_setbrg(void)
> @@ -126,7 +132,7 @@ int serial_tstc(void)
>  /* Multi serial device functions */
>  #define DECLARE_ESERIAL_FUNCTIONS(port) \
>   int userial##port##_init(void) \
> - { return(0); } \
> + { return uartlite_serial_init(port); } \
>   void userial##port##_setbrg(void) {} \
>   int userial##port##_getc(void) \
>   { return uartlite_serial_getc(port); } \
> @@ -163,17 +169,15 @@ struct serial_device uartlite_serial3_device =
>  
>  __weak struct serial_device *default_serial_console(void)
>  {
> -# ifdef XILINX_UARTLITE_BASEADDR
> - return &uartlite_serial0_device;
> -# endif /* XILINX_UARTLITE_BASEADDR */
> -# ifdef XILINX_UARTLITE_BASEADDR1
> - return &uartlite_serial1_device;
> -# endif /* XILINX_UARTLITE_BASEADDR1 */
> -# ifdef XILINX_UARTLITE_BASEADDR2
> - return &uartlite_serial2_device;
> -# endif /* XILINX_UARTLITE_BASEADDR2 */
> -# ifdef XILINX_UARTLITE_BASEADDR3
> - return &uartlite_serial3_device;
> -# endif /* XILINX_UARTLITE_BASEADDR3 */
> + if (userial_ports[0])
> + return &uartlite_serial0_device;
> + if (userial_ports[1])
> + return &uartlite_serial1_device;
> + if (userial_ports[2])
> + return &uartlite_serial2_device;
> + if (userial_ports[3])
> + return &uartlite_serial3_device;
> +
> + return NULL;
>  }
>  #endif /* CONFIG_SERIAL_MULTI */


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


Re: [U-Boot] [PATCH 1/2] serial: Support serial multi for Microblaze

2012-08-07 Thread Stephan Linz
Am Dienstag, den 07.08.2012, 14:20 +0200 schrieb Michal Simek: 
> enable serial multi for Microblaze.
> 
> Signed-off-by: Michal Simek 

Acked-by: Stephan Linz 

> ---
>  include/serial.h |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/include/serial.h b/include/serial.h
> index 5173499..9475779 100644
> --- a/include/serial.h
> +++ b/include/serial.h
> @@ -31,7 +31,8 @@ extern struct serial_device *default_serial_console(void);
>   defined(CONFIG_MB86R0x) || defined(CONFIG_MPC5xxx) || \
>   defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \
>   defined(CONFIG_MPC86xx) || defined(CONFIG_SYS_SC520) || \
> - defined(CONFIG_TEGRA2) || defined(CONFIG_SYS_COREBOOT)
> + defined(CONFIG_TEGRA2) || defined(CONFIG_SYS_COREBOOT) || \
> + defined(CONFIG_MICROBLAZE)
>  extern struct serial_device serial0_device;
>  extern struct serial_device serial1_device;
>  #if defined(CONFIG_SYS_NS16550_SERIAL)

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


Re: [U-Boot] [PATCH v2 7/7] microblaze: board: Use bi_flashstart instead of CONFIG_SYS_FLASH_BASE

2012-08-07 Thread Stephan Linz
Am Montag, den 06.08.2012, 09:46 +0200 schrieb Michal Simek: 
> Prepare for device-tree driven configuration.
> 
> Signed-off-by: Michal Simek 
> 

Acked-by: Stephan Linz 

Tested with AXI systems on Avnet S6LX150T and S6LX9 micro-evaluation.

> ---
> v2: Move bi_flashsize and bi_flashoffset from other patch
> ---
>  arch/microblaze/lib/board.c |   10 ++
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index b450367..674b573 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -136,9 +136,8 @@ void board_init_f(ulong not_used)
>  #if defined(CONFIG_CMD_FLASH)
>   puts ("Flash: ");
>   bd->bi_flashstart = CONFIG_SYS_FLASH_BASE;
> - if (0 < (flash_size = flash_init ())) {
> - bd->bi_flashsize = flash_size;
> - bd->bi_flashoffset = CONFIG_SYS_FLASH_BASE + flash_size;
> + flash_size = flash_init();
> + if (bd->bi_flashstart && flash_size > 0) {
>  # ifdef CONFIG_SYS_FLASH_CHECKSUM
>   print_size (flash_size, "");
>   /*
> @@ -149,13 +148,16 @@ void board_init_f(ulong not_used)
>   s = getenv ("flashchecksum");
>   if (s && (*s == 'y')) {
>   printf ("  CRC: %08X",
> - crc32 (0, (const unsigned char *) 
> CONFIG_SYS_FLASH_BASE, flash_size)
> + crc32(0, (const u8 *)bd->bi_flashstart,
> + flash_size)
>   );
>   }
>   putc ('\n');
>  # else   /* !CONFIG_SYS_FLASH_CHECKSUM */
>   print_size (flash_size, "\n");
>  # endif /* CONFIG_SYS_FLASH_CHECKSUM */
> +     bd->bi_flashsize = flash_size;
> + bd->bi_flashoffset = bd->bi_flashstart + flash_size;
>   } else {
>   puts ("Flash init FAILED");
>   bd->bi_flashstart = 0;

-- 
Viele Grüße,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH v2 6/7] microblaze: Clean microblaze initialization

2012-08-07 Thread Stephan Linz
Am Montag, den 06.08.2012, 09:46 +0200 schrieb Michal Simek: 
> Move board specific function to board_init function in board/ folder
> Remove externs from generic board.c
> Use board_init_f function in board.c file.
> 
> Signed-off-by: Michal Simek 
> 

Acked-by: Stephan Linz 

Tested with AXI systems on Avnet S6LX150T and S6LX9 micro-evaluation.

> ---
> v2: Remove global pointer
> Define board_init function in header
> ---
>  arch/microblaze/cpu/start.S|2 +-
>  arch/microblaze/include/asm/processor.h|3 +++
>  arch/microblaze/lib/board.c|   17 +++--
>  .../xilinx/microblaze-generic/microblaze-generic.c |9 +
>  4 files changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/microblaze/cpu/start.S b/arch/microblaze/cpu/start.S
> index 8a2f634..8564c4e 100644
> --- a/arch/microblaze/cpu/start.S
> +++ b/arch/microblaze/cpu/start.S
> @@ -149,7 +149,7 @@ clear_bss:
>   cmp r6, r5, r4 /* check if we have reach the end */
>   bneir6, 2b
>  3:   /* jumping to board_init */
> - braiboard_init
> + braiboard_init_f
>  1:   bri 1b
>  
>  /*
> diff --git a/arch/microblaze/include/asm/processor.h 
> b/arch/microblaze/include/asm/processor.h
> index 2295d0a..2c4d5ff 100644
> --- a/arch/microblaze/include/asm/processor.h
> +++ b/arch/microblaze/include/asm/processor.h
> @@ -28,4 +28,7 @@
>  extern char __end[];
>  extern char __text_start[];
>  
> +/* Microblaze board initialization function */
> +void board_init(void);
> +
>  #endif /* __ASM_MICROBLAZE_PROCESSOR_H */
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index fde109f..b450367 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -39,13 +39,6 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> -#ifdef CONFIG_SYS_GPIO_0
> -extern int gpio_init (void);
> -#endif
> -#ifdef CONFIG_SYS_FSL_2
> -extern void fsl_init2 (void);
> -#endif
> -
>  /*
>   * All attempts to come up with a "common" initialization sequence
>   * that works for all boards and architectures failed: some of the
> @@ -67,20 +60,14 @@ init_fnc_t *init_sequence[] = {
>  #endif
>   serial_init,
>   console_init_f,
> -#ifdef CONFIG_SYS_GPIO_0
> - gpio_init,
> -#endif
>   interrupts_init,
>   timer_init,
> -#ifdef CONFIG_SYS_FSL_2
> - fsl_init2,
> -#endif
>   NULL,
>  };
>  
>  unsigned long monitor_flash_len;
>  
> -void board_init (void)
> +void board_init_f(ulong not_used)
>  {
>   bd_t *bd;
>   init_fnc_t **init_fnc_ptr;
> @@ -189,6 +176,8 @@ void board_init (void)
>   /* Initialize the console (after the relocation and devices init) */
>   console_init_r();
>  
> + board_init();
> +
>   /* Initialize from environment */
>   load_addr = getenv_ulong("loadaddr", 16, load_addr);
>  
> diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c 
> b/board/xilinx/microblaze-generic/microblaze-generic.c
> index a1e2bfe..b75e62c 100644
> --- a/board/xilinx/microblaze-generic/microblaze-generic.c
> +++ b/board/xilinx/microblaze-generic/microblaze-generic.c
> @@ -28,6 +28,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> @@ -69,6 +70,14 @@ int fsl_init2 (void) {
>  }
>  #endif
>  
> +void board_init(void)
> +{
> + gpio_init();
> +#ifdef CONFIG_SYS_FSL_2
> + fsl_init2();
> +#endif
> +}
> +
>  int board_eth_init(bd_t *bis)
>  {
>   int ret = 0;

-- 
Viele Grüße,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH v2 5/7] microblaze: timer: Prepare for device-tree initialization

2012-08-07 Thread Stephan Linz
Hi Michal,

looks fine, but ... (see below)

Am Montag, den 06.08.2012, 09:46 +0200 schrieb Michal Simek: 
> microblaze: Fix CONFIG_SYS_HZ usage in board config
> 
> Do not use hardcoded value. Use CONFIG_SYS_HZ instead.
> Separate static configuration to single block.
> 
> Signed-off-by: Michal Simek 
> 
> ---
> v2: Fix irq type irq == -1 means no IRQ
> ---
>  arch/microblaze/cpu/timer.c|   69 ---
>  arch/microblaze/include/asm/microblaze_timer.h |3 +
>  arch/microblaze/lib/board.c|5 --
>  include/configs/microblaze-generic.h   |   12 +
>  4 files changed, 41 insertions(+), 48 deletions(-)
> 
> diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
> index cc6b897..1330401 100644
> --- a/arch/microblaze/cpu/timer.c
> +++ b/arch/microblaze/cpu/timer.c
> @@ -27,42 +27,30 @@
>  #include 
>  
>  volatile int timestamp = 0;
> +microblaze_timer_t *tmr;
>  
> -#ifdef CONFIG_SYS_TIMER_0
>  ulong get_timer (ulong base)
>  {
> - return (timestamp - base);
> + if (tmr)
> + return timestamp - base;
> + return timestamp++ - base;
>  }
> -#else
> -ulong get_timer (ulong base)
> -{
> - return (timestamp++ - base);
> -}
> -#endif
>  
> -#ifdef CONFIG_SYS_TIMER_0
>  void __udelay(unsigned long usec)
>  {
> - int i;
> + u32 i;
>  
> - i = get_timer(0);
> - while ((get_timer(0) - i) < (usec / 1000))
> - ;
> + if (tmr) {
> + i = get_timer(0);
> + while ((get_timer(0) - i) < (usec / 1000))
> + ;
> + } else {
> + for (i = 0; i < (usec * XILINX_CLOCK_FREQ / 1000); i++)
> + ;
> + }
>  }
> -#else
> -void __udelay(unsigned long usec)
> -{
> - unsigned int i;
>  
> - for (i = 0; i < (usec * CONFIG_XILINX_CLOCK_FREQ / 1000); i++)
> - ;
> -}
> -#endif
> -
> -#ifdef CONFIG_SYS_TIMER_0
> -microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
> -
> -void timer_isr (void *arg)
> +static void timer_isr(void *arg)
>  {
>   timestamp++;
>   tmr->control = tmr->control | TIMER_INTERRUPT;
> @@ -70,15 +58,30 @@ void timer_isr (void *arg)
>  
>  int timer_init (void)
>  {
> - tmr->loadreg = CONFIG_SYS_TIMER_0_PRELOAD;
> - tmr->control = TIMER_INTERRUPT | TIMER_RESET;
> - tmr->control =
> - TIMER_ENABLE | TIMER_ENABLE_INTR | TIMER_RELOAD | TIMER_DOWN_COUNT;
> - timestamp = 0;
> - install_interrupt_handler (CONFIG_SYS_TIMER_0_IRQ, timer_isr, (void 
> *)tmr);
> + int irq = -1;
> + u32 preload = 0;
> + u32 ret = 0;
> +
> +#if defined(CONFIG_SYS_TIMER_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM)
> + preload = XILINX_CLOCK_FREQ / CONFIG_SYS_HZ;
> + irq = CONFIG_SYS_TIMER_0_IRQ;
> + tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
> +#endif
> +
> + if (tmr && preload && irq >= 0) {
> + tmr->loadreg = preload;
> + tmr->control = TIMER_INTERRUPT | TIMER_RESET;
> + tmr->control = TIMER_ENABLE | TIMER_ENABLE_INTR |\
> + TIMER_RELOAD | TIMER_DOWN_COUNT;
> + timestamp = 0;
> + ret = install_interrupt_handler (irq, timer_isr, (void *)tmr);
> + if (ret)
> + tmr = NULL;
> + }
> +
> + /* No problem if timer is not found/initialized */
>   return 0;
>  }
> -#endif
>  
>  /*
>   * This function is derived from PowerPC code (read timebase as long long).
> diff --git a/arch/microblaze/include/asm/microblaze_timer.h 
> b/arch/microblaze/include/asm/microblaze_timer.h
> index 844c8db..28e8b02 100644
> --- a/arch/microblaze/include/asm/microblaze_timer.h
> +++ b/arch/microblaze/include/asm/microblaze_timer.h
> @@ -39,3 +39,6 @@ typedef volatile struct microblaze_timer_t {
>   int loadreg; /* load register TLR */
>   int counter; /* timer/counter register */
>  } microblaze_timer_t;
> +
> +int timer_init(void);
> +
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index b5f21d8..fde109f 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -42,9 +42,6 @@ DECLARE_GLOBAL_DATA_PTR;
>  #ifdef CONFIG_SYS_GPIO_0
>  extern int gpio_init (void);
>  #endif
> -#ifdef CONFIG_SYS_TIMER_0
> -extern int timer_init (void);
> -#endif
>  #ifdef CONFIG_SYS_FSL_2
>  extern void fsl_init2 (void);
>  #endif
> @@ -74,9 +71,7 @@ init_fnc_t *init_sequence[] = {
>   gpio_init,
>  #endif
>   interrupts_init,
> -#ifdef CONFIG_SYS_TIMER_0
>   timer_init,
> -#endif
>  #ifdef CONFIG_SYS_FSL_2
>   fsl_init2,
>  #endif
> diff --git a/include/configs/microblaze-generic.h 
> b/include/configs/microblaze-generic.h
> index 1266cf7..21ddb2b 100644
> --- a/include/configs/microblaze-generic.h
> +++ b/include/configs/microblaze-generic.h
> @@ -115,19 +115,11 @@
>  #endif
>  
>  /* timer */
> -#ifdef XILINX_TIMER_BASEADDR
> -# if (XILINX_TIME

Re: [U-Boot] [PATCH v2 4/7] microblaze: intc: Coding style cleanup

2012-08-07 Thread Stephan Linz
Am Montag, den 06.08.2012, 09:46 +0200 schrieb Michal Simek: 
> Just coding style cleanup.
> Remove unneeded externs.
> 
> Signed-off-by: Michal Simek 
> Acked-by: Simon Glass 
> 

Acked-by: Stephan Linz 

> --
> v2: Rebase - depends on previous intc patch
> ---
>  arch/microblaze/cpu/interrupts.c |   26 +-
>  1 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/microblaze/cpu/interrupts.c 
> b/arch/microblaze/cpu/interrupts.c
> index 08f6bad..7f2ee64 100644
> --- a/arch/microblaze/cpu/interrupts.c
> +++ b/arch/microblaze/cpu/interrupts.c
> @@ -32,15 +32,12 @@
>  
>  #undef DEBUG_INT
>  
> -extern void microblaze_disable_interrupts (void);
> -extern void microblaze_enable_interrupts (void);
> -
> -void enable_interrupts (void)
> +void enable_interrupts(void)
>  {
>   MSRSET(0x2);
>  }
>  
> -int disable_interrupts (void)
> +int disable_interrupts(void)
>  {
>   unsigned int msr;
>  
> @@ -58,20 +55,21 @@ microblaze_intc_t *intc;
>  /* default handler */
>  static void def_hdlr(void)
>  {
> - puts ("def_hdlr\n");
> + puts("def_hdlr\n");
>  }
>  
>  static void enable_one_interrupt(int irq)
>  {
>   int mask;
>   int offset = 1;
> +
>   offset <<= irq;
>   mask = intc->ier;
>   intc->ier = (mask | offset);
>  #ifdef DEBUG_INT
> - printf ("Enable one interrupt irq %x - mask %x,ier %x\n", offset, mask,
> + printf("Enable one interrupt irq %x - mask %x,ier %x\n", offset, mask,
>   intc->ier);
> - printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
> + printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
>   intc->iar, intc->mer);
>  #endif
>  }
> @@ -80,13 +78,14 @@ static void disable_one_interrupt(int irq)
>  {
>   int mask;
>   int offset = 1;
> +
>   offset <<= irq;
>   mask = intc->ier;
>   intc->ier = (mask & ~offset);
>  #ifdef DEBUG_INT
> - printf ("Disable one interrupt irq %x - mask %x,ier %x\n", irq, mask,
> + printf("Disable one interrupt irq %x - mask %x,ier %x\n", irq, mask,
>   intc->ier);
> - printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
> + printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
>   intc->iar, intc->mer);
>  #endif
>  }
> @@ -94,9 +93,10 @@ static void disable_one_interrupt(int irq)
>  int install_interrupt_handler(int irq, interrupt_handler_t *hdlr, void *arg)
>  {
>   struct irq_action *act;
> +
>   /* irq out of range */
>   if ((irq < 0) || (irq > irq_no)) {
> - puts ("IRQ out of range\n");
> + puts("IRQ out of range\n");
>   return -1;
>   }
>   act = &vecs[irq];
> @@ -124,7 +124,7 @@ static void intc_init(void)
>   /* XIntc_Start - hw_interrupt enable and all interrupt enable */
>   intc->mer = 0x3;
>  #ifdef DEBUG_INT
> - printf ("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
> + printf("INTC isr %x, ier %x, iar %x, mer %x\n", intc->isr, intc->ier,
>   intc->iar, intc->mer);
>  #endif
>  }
> @@ -159,7 +159,7 @@ int interrupts_init(void)
>   return 0;
>  }
>  
> -void interrupt_handler (void)
> +void interrupt_handler(void)
>  {
>   int irqs = intc->ivr;   /* find active interrupt */
>   int mask = 1;

-- 
Viele Grüße,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH v2 3/7] microblaze: intc: Registering interrupt should return value

2012-08-07 Thread Stephan Linz
Am Montag, den 06.08.2012, 09:46 +0200 schrieb Michal Simek: 
> Return value to find out if un/registration was succesful.
> 
> Signed-off-by: Michal Simek 
> 
> ---
> v2: Add comment to header file to describe parameters and return codes
> ---
>  arch/microblaze/cpu/interrupts.c  |   16 +---
>  arch/microblaze/include/asm/microblaze_intc.h |   11 ++-
>  2 files changed, 19 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/microblaze/cpu/interrupts.c 
> b/arch/microblaze/cpu/interrupts.c
> index ee67082..08f6bad 100644
> --- a/arch/microblaze/cpu/interrupts.c
> +++ b/arch/microblaze/cpu/interrupts.c
> @@ -91,14 +91,13 @@ static void disable_one_interrupt(int irq)
>  #endif
>  }
>  
> -/* adding new handler for interrupt */
> -void install_interrupt_handler (int irq, interrupt_handler_t * hdlr, void 
> *arg)
> +int install_interrupt_handler(int irq, interrupt_handler_t *hdlr, void *arg)
>  {
>   struct irq_action *act;
>   /* irq out of range */
>   if ((irq < 0) || (irq > irq_no)) {
>   puts ("IRQ out of range\n");
> - return;
> + return -1;
>   }
>   act = &vecs[irq];
>   if (hdlr) { /* enable */
> @@ -106,11 +105,14 @@ void install_interrupt_handler (int irq, 
> interrupt_handler_t * hdlr, void *arg)
>   act->arg = arg;
>   act->count = 0;
>   enable_one_interrupt (irq);
> - } else {/* disable */
> - act->handler = (interrupt_handler_t *) def_hdlr;
> - act->arg = (void *)irq;
> - disable_one_interrupt (irq);
> + return 0;
>   }
> +
> + /* Disable */
> + act->handler = (interrupt_handler_t *) def_hdlr;
> + act->arg = (void *)irq;
> + disable_one_interrupt(irq);
> + return 1;
>  }
>  
>  /* initialization interrupt controller - hardware */
> diff --git a/arch/microblaze/include/asm/microblaze_intc.h 
> b/arch/microblaze/include/asm/microblaze_intc.h
> index 6142b9c..e9640f5 100644
> --- a/arch/microblaze/include/asm/microblaze_intc.h
> +++ b/arch/microblaze/include/asm/microblaze_intc.h
> @@ -39,7 +39,16 @@ struct irq_action {
>   int count; /* number of interrupt */
>  };
>  
> -void install_interrupt_handler (int irq, interrupt_handler_t * hdlr,
> +/**
> + * Register and unregister interrupt handler rutines
> + *
> + * @param irqIRQ number
> + * @param hdlr   Interrupt handler rutine
> + * @param argPointer to argument which is passed to int. handler 
> rutine
> + * @return   0 if registration pass, 1 if unregistration pass,
> + *   or an error code < 0 otherwise
> + */
> +int install_interrupt_handler(int irq, interrupt_handler_t *hdlr,
>  void *arg);

Hi Michal,

why not two different functions here, one for registration, another one
for unregistration? To mee it is puzzling to use a 'install' function
for unregistration ...

... whatever, you should evaluate the return code in fsl_init2() too.

> 
>  int interrupts_init(void);


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


Re: [U-Boot] [PATCH v2 2/7] microblaze: board: Remove compilation warning

2012-08-07 Thread Stephan Linz
Am Montag, den 06.08.2012, 09:46 +0200 schrieb Michal Simek: 
> Variable is used when CONFIG_SYS_FLASH_CHECKSUM is used.
> 
> Warning log:
> board.c: In function 'board_init':
> board.c:101: warning: unused variable 's'
> 
> Signed-off-by: Michal Simek 
> 

Acked-by: Stephan Linz 

> ---
> v2: Use __mabe_unused prefix
> ---
>  arch/microblaze/lib/board.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index 942e18c..b5f21d8 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -32,6 +32,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -91,7 +92,7 @@ void board_init (void)
>   gd = (gd_t *) (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET);
>   bd = (bd_t *) (CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET \
>   - GENERATED_BD_INFO_SIZE);
> - char *s;
> + __maybe_unused char *s;
>  #if defined(CONFIG_CMD_FLASH)
>   ulong flash_size = 0;
>  #endif

-- 
Viele Grüße,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH v2 1/7] microblaze: Add support for device tree driven board configuration

2012-08-07 Thread Stephan Linz
Am Montag, den 06.08.2012, 09:46 +0200 schrieb Michal Simek: 
> This is minimum code required to be able to use device-tree
> for u-boot initialization.
> Currently only for device driver initialization.
> 
> Linker script change ensures DTB to be aligned
> for both options CONFIG_OF_EMBED and CONFIG_OF_SEPARATE.
> 
> Signed-off-by: Michal Simek 
> CC: Simon Glass 
> 

Acked-by: Stephan Linz 

Tested with AXI systems on Avnet S6LX150T and S6LX9 micro-evaluation.

> ---
> v2: Show message about DTB address in bootlog
> ---
>  arch/microblaze/config.mk |2 ++
>  arch/microblaze/cpu/u-boot.lds|1 +
>  arch/microblaze/include/asm/global_data.h |1 +
>  arch/microblaze/lib/board.c   |   24 
>  4 files changed, 28 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk
> index aca79e2..b4935f0 100644
> --- a/arch/microblaze/config.mk
> +++ b/arch/microblaze/config.mk
> @@ -31,3 +31,5 @@ CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F0
>  PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
>  
>  LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
> +
> +CONFIG_ARCH_DEVICE_TREE := microblaze
> diff --git a/arch/microblaze/cpu/u-boot.lds b/arch/microblaze/cpu/u-boot.lds
> index ee41145..d033a28 100644
> --- a/arch/microblaze/cpu/u-boot.lds
> +++ b/arch/microblaze/cpu/u-boot.lds
> @@ -45,6 +45,7 @@ SECTIONS
>   .data ALIGN(0x4):
>   {
>   __data_start = .;
> + dts/libdts.o (.data)
>   *(.data)
>   __data_end = .;
>   }
> diff --git a/arch/microblaze/include/asm/global_data.h 
> b/arch/microblaze/include/asm/global_data.h
> index 6e8537c..e802e4e 100644
> --- a/arch/microblaze/include/asm/global_data.h
> +++ b/arch/microblaze/include/asm/global_data.h
> @@ -43,6 +43,7 @@ typedef struct  global_data {
>   unsigned long   precon_buf_idx; /* Pre-Console buffer index */
>  #endif
>   unsigned long   env_addr;   /* Address  of Environment struct */
> + const void  *fdt_blob;  /* Our device tree, NULL if none */
>   unsigned long   env_valid;  /* Checksum of Environment valid? */
>   unsigned long   fb_base;/* base address of frame buffer */
>   void**jt;   /* jump table */
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index b80250a..942e18c 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -34,6 +34,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -63,6 +64,9 @@ typedef int (init_fnc_t) (void);
>  
>  init_fnc_t *init_sequence[] = {
>   env_init,
> +#ifdef CONFIG_OF_CONTROL
> + fdtdec_check_fdt,
> +#endif
>   serial_init,
>   console_init_f,
>  #ifdef CONFIG_SYS_GPIO_0
> @@ -103,6 +107,17 @@ void board_init (void)
>  
>   monitor_flash_len = __end - __text_start;
>  
> +#ifdef CONFIG_OF_EMBED
> + /* Get a pointer to the FDT */
> + gd->fdt_blob = _binary_dt_dtb_start;
> +#elif defined CONFIG_OF_SEPARATE
> + /* FDT is at end of image */
> + gd->fdt_blob = (void *)__end;
> +#endif
> + /* Allow the early environment to override the fdt address */
> + gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
> + (uintptr_t)gd->fdt_blob);
> +
>   /*
>* The Malloc area is immediately below the monitor copy in DRAM
>* aka CONFIG_SYS_MONITOR_BASE - Note there is no need for reloc_off
> @@ -121,6 +136,15 @@ void board_init (void)
>   }
>   }
>  
> +#ifdef CONFIG_OF_CONTROL
> + /* For now, put this check after the console is ready */
> + if (fdtdec_prepare_fdt()) {
> + panic("** CONFIG_OF_CONTROL defined but no FDT - please see "
> + "doc/README.fdt-control");
> + } else
> + printf("DTB: 0x%x\n", (u32)gd->fdt_blob);
> +#endif
> +
>   puts ("SDRAM :\n");
>   printf ("\t\tIcache:%s\n", icache_status() ? "ON" : "OFF");
>   printf ("\t\tDcache:%s\n", dcache_status() ? "ON" : "OFF");

-- 
Viele Grüße,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


[U-Boot] [PATCH] input: key_matrix: fix header inclusion

2012-08-02 Thread Stephan Linz
On Microblaze with device tree support enabled we run into
the error below.

I'm not sure, but I think that all source code should include
at least the common.h and just this fix the problem on
Microblaz architecture.

The error is:

In file included from key_matrix.c:29:
include/malloc.h:364: error: conflicting types for 'memset'
include/linux/string.h:71: error: previous declaration of 'memset' was here
include/malloc.h:365: error: conflicting types for 'memcpy'
include/linux/string.h:74: error: previous declaration of 'memcpy' was here

Signed-off-by: Stephan Linz 
CC: Bernie Thompson 
CC: Simon Glass 
CC: Tom Warren 
CC: Michal Simek 
---
 drivers/input/key_matrix.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c
index 84b898f..715e57a 100644
--- a/drivers/input/key_matrix.c
+++ b/drivers/input/key_matrix.c
@@ -23,6 +23,7 @@
  * MA 02111-1307 USA
  */
 
+#include 
 #include 
 #include 
 #include 
-- 
1.7.0.4

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


[U-Boot] [PATCH v2 2/2] sf: stmicro: add support N25Q128 parts

2012-08-02 Thread Stephan Linz
Adds support for Numonyx's N25Q128 SPI flash. These devices
are used on (among others) Avnet Spartan-6 LX9 micro-evaluation
boards. Tested with "sf" commands and CONFIG_ENV_IS_IN_SPI_FLASH.

Signed-off-by: Stephan Linz 
---
v2: rebase to master sha1:56249fe
---
 drivers/mtd/spi/stmicro.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index 706bb8e..600e531 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -93,6 +93,12 @@ static const struct stmicro_spi_flash_params 
stmicro_spi_flash_table[] = {
.name = "M25P128",
},
{
+   .id = 0xba18,
+   .pages_per_sector = 256,
+   .nr_sectors = 256,
+   .name = "N25Q128",
+   },
+   {
.id = 0xba19,
.pages_per_sector = 256,
.nr_sectors = 512,
-- 
1.7.0.4

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


[U-Boot] [PATCH v2 1/2] sf: stmicro: support JEDEC standard two-byte signature

2012-08-02 Thread Stephan Linz
There are more than the M25Pxx serial flashs that can be
used with the stmicro driver, for example: the M25PXxx or
N25Qxx serie. All these chips have burned in the original
stmicro manufacture id 0x20 together with a standard
two-byte signature.

In preperation to support all these chips the stmicro driver
have to decode the full two-byte signature.

Signed-off-by: Stephan Linz 
---
v2: rebase to master sha1:56249fe
add local u16 variable to store idcode[1..2] for
computation and debug print out
---
 drivers/mtd/spi/stmicro.c |   27 +++
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index dbd1fc1..706bb8e 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -37,7 +37,7 @@
 #define CMD_M25PXX_RES 0xab/* Release from DP, and Read Signature 
*/
 
 struct stmicro_spi_flash_params {
-   u8 idcode1;
+   u16 id;
u16 pages_per_sector;
u16 nr_sectors;
const char *name;
@@ -45,55 +45,55 @@ struct stmicro_spi_flash_params {
 
 static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = {
{
-   .idcode1 = 0x11,
+   .id = 0x2011,
.pages_per_sector = 128,
.nr_sectors = 4,
.name = "M25P10",
},
{
-   .idcode1 = 0x15,
+   .id = 0x2015,
.pages_per_sector = 256,
.nr_sectors = 32,
.name = "M25P16",
},
{
-   .idcode1 = 0x12,
+   .id = 0x2012,
.pages_per_sector = 256,
.nr_sectors = 4,
.name = "M25P20",
},
{
-   .idcode1 = 0x16,
+   .id = 0x2016,
.pages_per_sector = 256,
.nr_sectors = 64,
.name = "M25P32",
},
{
-   .idcode1 = 0x13,
+   .id = 0x2013,
.pages_per_sector = 256,
.nr_sectors = 8,
.name = "M25P40",
},
{
-   .idcode1 = 0x17,
+   .id = 0x2017,
.pages_per_sector = 256,
.nr_sectors = 128,
.name = "M25P64",
},
{
-   .idcode1 = 0x14,
+   .id = 0x2014,
.pages_per_sector = 256,
.nr_sectors = 16,
.name = "M25P80",
},
{
-   .idcode1 = 0x18,
+   .id = 0x2018,
.pages_per_sector = 1024,
.nr_sectors = 64,
.name = "M25P128",
},
{
-   .idcode1 = 0x19,
+   .id = 0xba19,
.pages_per_sector = 256,
.nr_sectors = 512,
.name = "N25Q256",
@@ -105,6 +105,7 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave 
*spi, u8 * idcode)
const struct stmicro_spi_flash_params *params;
struct spi_flash *flash;
unsigned int i;
+   u16 id;
 
if (idcode[0] == 0xff) {
i = spi_flash_cmd(spi, CMD_M25PXX_RES,
@@ -119,15 +120,17 @@ struct spi_flash *spi_flash_probe_stmicro(struct 
spi_slave *spi, u8 * idcode)
return NULL;
}
 
+   id = ((idcode[1] << 8) | idcode[2]);
+
for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) {
params = &stmicro_spi_flash_table[i];
-   if (params->idcode1 == idcode[2]) {
+   if (params->id == id) {
break;
}
}
 
if (i == ARRAY_SIZE(stmicro_spi_flash_table)) {
-   debug("SF: Unsupported STMicro ID %02x\n", idcode[1]);
+   debug("SF: Unsupported STMicro ID %04x\n", id);
return NULL;
}
 
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH 2/2] sf: stmicro: add support N25Q128 parts

2012-08-01 Thread Stephan Linz
Am Mittwoch, den 01.08.2012, 13:53 -0400 schrieb Mike Frysinger: 
> On Friday 13 July 2012 14:07:19 Stephan Linz wrote:
> > Adds support for Numonyx's N25Q128 SPI flash. These devices
> > are used on (among others) Avnet Spartan-6 LX9 micro-evaluation
> > boards. Tested with "sf" commands and CONFIG_ENV_IS_IN_SPI_FLASH.
> 
> needs to be rebased onto mainline.  looks fine otherwise.
> -mike

Hi Mike,

I'll do it at weekend together with the things you commented in the
second patch ...


br,
Stephan

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


[U-Boot] [PATCH 1/2] spi: microblaze: Adds driver for Xilinx SPI controller

2012-07-28 Thread Stephan Linz
This is an improved version of the driver patch original
submitted by Graeme Smecher 

The changes are:
- remove hard coded Xilinx BSP defines (XPAR_SPI_*) and
  use CONFIG_SYS_SPI_BASE from config.h instead
- add extensive register struct definitions
- remove offset calculation for register access and
  use the new register struct instead
- move default SPI controller configuration from
  spi_setup_slave() to spi_claim_bus()
- add spi_set_speed()
- insert SPI controller deactivation in spi_release_bus()
- protect while loops in spi_xfer() with counter / timeouts
- support SPI mode flags: LSB_FIRST, CPHA, CPOL, LOOP

Come from:
http://patchwork.ozlabs.org/patch/71797/

Signed-off-by: Stephan Linz 
---
v2: Remove useles information from commit message
Add newline and split variable declaration from code
---
 drivers/spi/Makefile |1 +
 drivers/spi/xilinx_spi.c |  214 ++
 drivers/spi/xilinx_spi.h |  135 +
 3 files changed, 350 insertions(+), 0 deletions(-)
 create mode 100644 drivers/spi/xilinx_spi.c
 create mode 100644 drivers/spi/xilinx_spi.h

diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index c967d87..3ae38e5 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -44,6 +44,7 @@ COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
 COBJS-$(CONFIG_SH_SPI) += sh_spi.o
 COBJS-$(CONFIG_FSL_ESPI) += fsl_espi.o
 COBJS-$(CONFIG_TEGRA2_SPI) += tegra2_spi.o
+COBJS-$(CONFIG_XILINX_SPI) += xilinx_spi.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
new file mode 100644
index 000..e563c19
--- /dev/null
+++ b/drivers/spi/xilinx_spi.c
@@ -0,0 +1,214 @@
+/*
+ * Xilinx SPI driver
+ *
+ * supports 8 bit SPI transfers only, with or w/o FIFO
+ *
+ * based on bfin_spi.c, by way of altera_spi.c
+ * Copyright (c) 2005-2008 Analog Devices Inc.
+ * Copyright (c) 2010 Thomas Chou 
+ * Copyright (c) 2010 Graeme Smecher 
+ * Copyright (c) 2012 Stephan Linz 
+ *
+ * Licensed under the GPL-2 or later.
+ *
+ * [0]: http://www.xilinx.com/support/documentation
+ *
+ * [S]:[0]/ip_documentation/xps_spi.pdf
+ * [0]/ip_documentation/axi_spi_ds742.pdf
+ */
+#include 
+#include 
+#include 
+#include 
+
+#include "xilinx_spi.h"
+
+#ifndef CONFIG_SYS_XILINX_SPI_LIST
+#define CONFIG_SYS_XILINX_SPI_LIST { CONFIG_SYS_SPI_BASE }
+#endif
+
+#ifndef CONFIG_XILINX_SPI_IDLE_VAL
+#define CONFIG_XILINX_SPI_IDLE_VAL 0xff
+#endif
+
+#define XILSPI_SPICR_DFLT_ON   (SPICR_MANUAL_SS | \
+SPICR_MASTER_MODE | \
+SPICR_SPE)
+
+#define XILSPI_SPICR_DFLT_OFF  (SPICR_MASTER_INHIBIT | \
+SPICR_MANUAL_SS)
+
+#define XILSPI_MAX_XFER_BITS   8
+
+static unsigned long xilinx_spi_base_list[] = CONFIG_SYS_XILINX_SPI_LIST;
+
+__attribute__((weak))
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+   return bus < ARRAY_SIZE(xilinx_spi_base_list) && cs < 32;
+}
+
+__attribute__((weak))
+void spi_cs_activate(struct spi_slave *slave)
+{
+   struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave);
+
+   writel(SPISSR_ACT(slave->cs), &xilspi->regs->spissr);
+}
+
+__attribute__((weak))
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+   struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave);
+
+   writel(SPISSR_OFF, &xilspi->regs->spissr);
+}
+
+void spi_init(void)
+{
+   /* do nothing */
+}
+
+void spi_set_speed(struct spi_slave *slave, uint hz)
+{
+   /* xilinx spi core does not support programmable speed */
+}
+
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+ unsigned int max_hz, unsigned int mode)
+{
+   struct xilinx_spi_slave *xilspi;
+   struct xilinx_spi_reg *regs;
+
+   if (!spi_cs_is_valid(bus, cs)) {
+   printf("XILSPI error: %s: unsupported bus %d / cs %d\n",
+   __func__, bus, cs);
+   return NULL;
+   }
+
+   xilspi = malloc(sizeof(*xilspi));
+   if (!xilspi) {
+   printf("XILSPI error: %s: malloc of SPI structure failed\n",
+   __func__);
+   return NULL;
+   }
+   xilspi->slave.bus = bus;
+   xilspi->slave.cs = cs;
+   xilspi->regs = (struct xilinx_spi_reg *)xilinx_spi_base_list[bus];
+   xilspi->freq = max_hz;
+   xilspi->mode = mode;
+   debug("%s: bus:%i cs:%i base:%p mode:%x max_hz:%d\n", __func__,
+   bus, cs, xilspi->regs, xilspi->mode, xilspi->freq);
+
+   return &xilspi->slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+   struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave);
+
+

[U-Boot] [PATCH 2/2] microblaze: Wire up SPI driver

2012-07-28 Thread Stephan Linz
Depending on XILINX_SPI_FLASH_BASEADDR enable SPI flash
and environment in SPI flash.

Expected values from xparameters.h are:
- XILINX_SPI_FLASH_BASEADDR
- XILINX_SPI_FLASH_MAX_FREQ
- XILINX_SPI_FLASH_CS

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   55 --
 1 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 56dcc02..87e7951 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -36,14 +36,22 @@
 #define CONFIG_OF_EMBED1
 #define CONFIG_DEFAULT_DEVICE_TREE microblaze
 
-/* linear flash memory */
+/* linear and spi flash memory */
 #ifdef XILINX_FLASH_START
 #defineFLASH
+#undef SPIFLASH
 #undef RAMENV  /* hold environment in flash */
 #else
+#ifdef XILINX_SPI_FLASH_BASEADDR
 #undef FLASH
+#defineSPIFLASH
+#undef RAMENV  /* hold environment in flash */
+#else
+#undef FLASH
+#undef SPIFLASH
 #defineRAMENV  /* hold environment in RAM */
 #endif
+#endif
 
 /* uart */
 #ifdef XILINX_UARTLITE_BASEADDR
@@ -218,20 +226,51 @@
 #  define CONFIG_ENV_SIZE  0x1000
 #  define CONFIG_ENV_ADDR  (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
 
-# else /* !RAMENV */
+# else /* FLASH && !RAMENV */
 #  define CONFIG_ENV_IS_IN_FLASH   1
 /* 128K(one sector) for env */
 #  define CONFIG_ENV_SECT_SIZE 0x2
 #  define CONFIG_ENV_ADDR \
(CONFIG_SYS_FLASH_BASE + (2 * CONFIG_ENV_SECT_SIZE))
 #  define CONFIG_ENV_SIZE  0x2
-# endif /* !RAMBOOT */
+# endif /* FLASH && !RAMBOOT */
 #else /* !FLASH */
+
+#ifdef SPIFLASH
+# define CONFIG_SYS_NO_FLASH   1
+# define CONFIG_SYS_SPI_BASE   XILINX_SPI_FLASH_BASEADDR
+# define CONFIG_XILINX_SPI 1
+# define CONFIG_SPI1
+# define CONFIG_SPI_FLASH  1
+# define CONFIG_SPI_FLASH_STMICRO  1
+# define CONFIG_SF_DEFAULT_MODESPI_MODE_3
+# define CONFIG_SF_DEFAULT_SPEED   XILINX_SPI_FLASH_MAX_FREQ
+# define CONFIG_SF_DEFAULT_CS  XILINX_SPI_FLASH_CS
+
+# ifdefRAMENV
+#  define CONFIG_ENV_IS_NOWHERE1
+#  define CONFIG_ENV_SIZE  0x1000
+#  define CONFIG_ENV_ADDR  (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
+
+# else /* SPIFLASH && !RAMENV */
+#  define CONFIG_ENV_IS_IN_SPI_FLASH   1
+#  define CONFIG_ENV_SPI_MODE  SPI_MODE_3
+#  define CONFIG_ENV_SPI_MAX_HZCONFIG_SF_DEFAULT_SPEED
+#  define CONFIG_ENV_SPI_CSCONFIG_SF_DEFAULT_CS
+/* 128K(two sectors) for env */
+#  define CONFIG_ENV_SECT_SIZE 0x1
+#  define CONFIG_ENV_SIZE  (2 * CONFIG_ENV_SECT_SIZE)
+/* Warning: adjust the offset in respect of other flash content and size */
+#  define CONFIG_ENV_OFFSET(128 * CONFIG_ENV_SECT_SIZE) /* at 8MB */
+# endif /* SPIFLASH && !RAMBOOT */
+#else /* !SPIFLASH */
+
 /* ENV in RAM */
 # define CONFIG_SYS_NO_FLASH   1
 # define CONFIG_ENV_IS_NOWHERE 1
 # define CONFIG_ENV_SIZE   0x1000
 # define CONFIG_ENV_ADDR   (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
+#endif /* !SPIFLASH */
 #endif /* !FLASH */
 
 /* system ace */
@@ -306,6 +345,15 @@
 #  define CONFIG_CMD_SAVEENV
 #  define CONFIG_CMD_SAVES
 # endif
+
+#else
+#if defined(SPIFLASH)
+# define CONFIG_CMD_SF
+
+# if !defined(RAMENV)
+#  define CONFIG_CMD_SAVEENV
+#  define CONFIG_CMD_SAVES
+# endif
 #else
 # undef CONFIG_CMD_IMLS
 # undef CONFIG_CMD_FLASH
@@ -313,6 +361,7 @@
 # undef CONFIG_CMD_UBI
 # undef CONFIG_CMD_UBIFS
 #endif
+#endif
 
 #if defined(CONFIG_CMD_JFFS2)
 # define CONFIG_MTD_PARTITIONS
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH 1/2] spi: microblaze: Adds driver for Xilinx SPI controller

2012-07-28 Thread Stephan Linz
Hi Michal,

I'll resubmit a new patch which fixes your notes.

br,
Stephan

Am Dienstag, den 24.07.2012, 12:56 +0200 schrieb Michal Simek: 
> On 07/14/2012 12:30 AM, Stephan Linz wrote:
> > This is an improved version of the driver patch original
> > submitted by Graeme Smecher 
> >
> > The changes are:
> >  - remove hard coded Xilinx BSP defines (XPAR_SPI_*) and
> >use CONFIG_SYS_SPI_BASE from config.h instead
> >  - add extensive register struct definitions
> >  - remove offset calculation for register access and
> >use the new register struct instead
> >  - move default SPI controller configuration from
> >spi_setup_slave() to spi_claim_bus()
> >  - add spi_set_speed()
> >  - insert SPI controller deactivation in spi_release_bus()
> >  - protect while loops in spi_xfer() with counter / timeouts
> >  - support SPI mode flags: LSB_FIRST, CPHA, CPOL, LOOP
> >
> > Come from:
> >  http://patchwork.ozlabs.org/patch/71797/
> >
> > Applied with:
> >  git apply -v --whitespace=fix --reject \
> >  U-Boot-Adds-driver-for-Xilinx-xps_spi-SPI-controller.patch
> 
> not interesting in description.
> 
> 
> >
> > Fix manual:
> >  drivers/spi/Makefile
> 
> this too.
> 
> >
> > Signed-off-by: Stephan Linz 
> > ---
> >   drivers/spi/Makefile |1 +
> >   drivers/spi/xilinx_spi.c |  210 
> > ++
> >   drivers/spi/xilinx_spi.h |  135 +
> >   3 files changed, 346 insertions(+), 0 deletions(-)
> >   create mode 100644 drivers/spi/xilinx_spi.c
> >   create mode 100644 drivers/spi/xilinx_spi.h
> >
> > diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
> > index c967d87..3ae38e5 100644
> > --- a/drivers/spi/Makefile
> > +++ b/drivers/spi/Makefile
> > @@ -44,6 +44,7 @@ COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
> >   COBJS-$(CONFIG_SH_SPI) += sh_spi.o
> >   COBJS-$(CONFIG_FSL_ESPI) += fsl_espi.o
> >   COBJS-$(CONFIG_TEGRA2_SPI) += tegra2_spi.o
> > +COBJS-$(CONFIG_XILINX_SPI) += xilinx_spi.o
> >
> >   COBJS := $(COBJS-y)
> >   SRCS  := $(COBJS:.o=.c)
> > diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
> > new file mode 100644
> > index 000..4d83bd3
> > --- /dev/null
> > +++ b/drivers/spi/xilinx_spi.c
> > @@ -0,0 +1,210 @@
> > +/*
> > + * Xilinx SPI driver
> > + *
> > + * supports 8 bit SPI transfers only, with or w/o FIFO
> > + *
> > + * based on bfin_spi.c, by way of altera_spi.c
> > + * Copyright (c) 2005-2008 Analog Devices Inc.
> > + * Copyright (c) 2010 Thomas Chou 
> > + * Copyright (c) 2010 Graeme Smecher 
> > + * Copyright (c) 2012 Stephan Linz 
> > + *
> > + * Licensed under the GPL-2 or later.
> > + *
> > + * [0]: http://www.xilinx.com/support/documentation
> > + *
> > + * [S]:[0]/ip_documentation/xps_spi.pdf
> > + * [0]/ip_documentation/axi_spi_ds742.pdf
> > + */
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "xilinx_spi.h"
> > +
> > +#ifndef CONFIG_SYS_XILINX_SPI_LIST
> > +#define CONFIG_SYS_XILINX_SPI_LIST { CONFIG_SYS_SPI_BASE }
> > +#endif
> > +
> > +#ifndef CONFIG_XILINX_SPI_IDLE_VAL
> > +#define CONFIG_XILINX_SPI_IDLE_VAL 0xff
> > +#endif
> > +
> > +#define XILSPI_SPICR_DFLT_ON   (SPICR_MANUAL_SS | \
> > +SPICR_MASTER_MODE | \
> > +SPICR_SPE)
> > +
> > +#define XILSPI_SPICR_DFLT_OFF  (SPICR_MASTER_INHIBIT | \
> > +SPICR_MANUAL_SS)
> > +
> > +#define XILSPI_MAX_XFER_BITS   8
> > +
> > +static unsigned long xilinx_spi_base_list[] = CONFIG_SYS_XILINX_SPI_LIST;
> > +
> > +__attribute__((weak))
> > +int spi_cs_is_valid(unsigned int bus, unsigned int cs)
> > +{
> > +   return bus < ARRAY_SIZE(xilinx_spi_base_list) && cs < 32;
> > +}
> > +
> > +__attribute__((weak))
> > +void spi_cs_activate(struct spi_slave *slave)
> > +{
> > +   struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave);
> 
> newline
> 
> > +   writel(SPISSR_ACT(slave->cs), &xilspi->regs->spissr);
> > +}
> > +
> > +__attribute__((weak))
> > +void spi_cs_deactivate(struct spi_slave *slave)
> > +{
> > +   struct xilinx_spi_slave

[U-Boot] [PATCH 1/2] spi: microblaze: Adds driver for Xilinx SPI controller

2012-07-13 Thread Stephan Linz
This is an improved version of the driver patch original
submitted by Graeme Smecher 

The changes are:
- remove hard coded Xilinx BSP defines (XPAR_SPI_*) and
  use CONFIG_SYS_SPI_BASE from config.h instead
- add extensive register struct definitions
- remove offset calculation for register access and
  use the new register struct instead
- move default SPI controller configuration from
  spi_setup_slave() to spi_claim_bus()
- add spi_set_speed()
- insert SPI controller deactivation in spi_release_bus()
- protect while loops in spi_xfer() with counter / timeouts
- support SPI mode flags: LSB_FIRST, CPHA, CPOL, LOOP

Come from:
http://patchwork.ozlabs.org/patch/71797/

Applied with:
git apply -v --whitespace=fix --reject \
U-Boot-Adds-driver-for-Xilinx-xps_spi-SPI-controller.patch

Fix manual:
drivers/spi/Makefile

Signed-off-by: Stephan Linz 
---
 drivers/spi/Makefile |1 +
 drivers/spi/xilinx_spi.c |  210 ++
 drivers/spi/xilinx_spi.h |  135 +
 3 files changed, 346 insertions(+), 0 deletions(-)
 create mode 100644 drivers/spi/xilinx_spi.c
 create mode 100644 drivers/spi/xilinx_spi.h

diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index c967d87..3ae38e5 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -44,6 +44,7 @@ COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
 COBJS-$(CONFIG_SH_SPI) += sh_spi.o
 COBJS-$(CONFIG_FSL_ESPI) += fsl_espi.o
 COBJS-$(CONFIG_TEGRA2_SPI) += tegra2_spi.o
+COBJS-$(CONFIG_XILINX_SPI) += xilinx_spi.o
 
 COBJS  := $(COBJS-y)
 SRCS   := $(COBJS:.o=.c)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
new file mode 100644
index 000..4d83bd3
--- /dev/null
+++ b/drivers/spi/xilinx_spi.c
@@ -0,0 +1,210 @@
+/*
+ * Xilinx SPI driver
+ *
+ * supports 8 bit SPI transfers only, with or w/o FIFO
+ *
+ * based on bfin_spi.c, by way of altera_spi.c
+ * Copyright (c) 2005-2008 Analog Devices Inc.
+ * Copyright (c) 2010 Thomas Chou 
+ * Copyright (c) 2010 Graeme Smecher 
+ * Copyright (c) 2012 Stephan Linz 
+ *
+ * Licensed under the GPL-2 or later.
+ *
+ * [0]: http://www.xilinx.com/support/documentation
+ *
+ * [S]:[0]/ip_documentation/xps_spi.pdf
+ * [0]/ip_documentation/axi_spi_ds742.pdf
+ */
+#include 
+#include 
+#include 
+#include 
+
+#include "xilinx_spi.h"
+
+#ifndef CONFIG_SYS_XILINX_SPI_LIST
+#define CONFIG_SYS_XILINX_SPI_LIST { CONFIG_SYS_SPI_BASE }
+#endif
+
+#ifndef CONFIG_XILINX_SPI_IDLE_VAL
+#define CONFIG_XILINX_SPI_IDLE_VAL 0xff
+#endif
+
+#define XILSPI_SPICR_DFLT_ON   (SPICR_MANUAL_SS | \
+SPICR_MASTER_MODE | \
+SPICR_SPE)
+
+#define XILSPI_SPICR_DFLT_OFF  (SPICR_MASTER_INHIBIT | \
+SPICR_MANUAL_SS)
+
+#define XILSPI_MAX_XFER_BITS   8
+
+static unsigned long xilinx_spi_base_list[] = CONFIG_SYS_XILINX_SPI_LIST;
+
+__attribute__((weak))
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+   return bus < ARRAY_SIZE(xilinx_spi_base_list) && cs < 32;
+}
+
+__attribute__((weak))
+void spi_cs_activate(struct spi_slave *slave)
+{
+   struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave);
+   writel(SPISSR_ACT(slave->cs), &xilspi->regs->spissr);
+}
+
+__attribute__((weak))
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+   struct xilinx_spi_slave *xilspi = to_xilinx_spi_slave(slave);
+   writel(SPISSR_OFF, &xilspi->regs->spissr);
+}
+
+void spi_init(void)
+{
+   /* do nothing */
+}
+
+void spi_set_speed(struct spi_slave *slave, uint hz)
+{
+   /* xilinx spi core does not support programmable speed */
+}
+
+struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
+ unsigned int max_hz, unsigned int mode)
+{
+   struct xilinx_spi_slave *xilspi;
+   struct xilinx_spi_reg *regs;
+
+   if (!spi_cs_is_valid(bus, cs)) {
+   printf("XILSPI error: %s: unsupported bus %d / cs %d\n",
+   __func__, bus, cs);
+   return NULL;
+   }
+
+   xilspi = malloc(sizeof(*xilspi));
+   if (!xilspi) {
+   printf("XILSPI error: %s: malloc of SPI structure failed\n",
+   __func__);
+   return NULL;
+   }
+   xilspi->slave.bus = bus;
+   xilspi->slave.cs = cs;
+   xilspi->regs = (struct xilinx_spi_reg *)xilinx_spi_base_list[bus];
+   xilspi->freq = max_hz;
+   xilspi->mode = mode;
+   debug("%s: bus:%i cs:%i base:%p mode:%x max_hz:%d\n", __func__,
+   bus, cs, xilspi->regs, xilspi->mode, xilspi->freq);
+
+   return &xilspi->slave;
+}
+
+void spi_free_slave(struct spi_slave *slave)
+{
+   struct xilinx_sp

[U-Boot] [PATCH 2/2] microblaze: Wire up SPI driver

2012-07-13 Thread Stephan Linz
Depending on XILINX_SPI_FLASH_BASEADDR enable SPI flash
and environment in SPI flash.

Expected values from xparameters.h are:
- XILINX_SPI_FLASH_BASEADDR
- XILINX_SPI_FLASH_MAX_FREQ
- XILINX_SPI_FLASH_CS

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   55 --
 1 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 56dcc02..87e7951 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -36,14 +36,22 @@
 #define CONFIG_OF_EMBED1
 #define CONFIG_DEFAULT_DEVICE_TREE microblaze
 
-/* linear flash memory */
+/* linear and spi flash memory */
 #ifdef XILINX_FLASH_START
 #defineFLASH
+#undef SPIFLASH
 #undef RAMENV  /* hold environment in flash */
 #else
+#ifdef XILINX_SPI_FLASH_BASEADDR
 #undef FLASH
+#defineSPIFLASH
+#undef RAMENV  /* hold environment in flash */
+#else
+#undef FLASH
+#undef SPIFLASH
 #defineRAMENV  /* hold environment in RAM */
 #endif
+#endif
 
 /* uart */
 #ifdef XILINX_UARTLITE_BASEADDR
@@ -218,20 +226,51 @@
 #  define CONFIG_ENV_SIZE  0x1000
 #  define CONFIG_ENV_ADDR  (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
 
-# else /* !RAMENV */
+# else /* FLASH && !RAMENV */
 #  define CONFIG_ENV_IS_IN_FLASH   1
 /* 128K(one sector) for env */
 #  define CONFIG_ENV_SECT_SIZE 0x2
 #  define CONFIG_ENV_ADDR \
(CONFIG_SYS_FLASH_BASE + (2 * CONFIG_ENV_SECT_SIZE))
 #  define CONFIG_ENV_SIZE  0x2
-# endif /* !RAMBOOT */
+# endif /* FLASH && !RAMBOOT */
 #else /* !FLASH */
+
+#ifdef SPIFLASH
+# define CONFIG_SYS_NO_FLASH   1
+# define CONFIG_SYS_SPI_BASE   XILINX_SPI_FLASH_BASEADDR
+# define CONFIG_XILINX_SPI 1
+# define CONFIG_SPI1
+# define CONFIG_SPI_FLASH  1
+# define CONFIG_SPI_FLASH_STMICRO  1
+# define CONFIG_SF_DEFAULT_MODESPI_MODE_3
+# define CONFIG_SF_DEFAULT_SPEED   XILINX_SPI_FLASH_MAX_FREQ
+# define CONFIG_SF_DEFAULT_CS  XILINX_SPI_FLASH_CS
+
+# ifdefRAMENV
+#  define CONFIG_ENV_IS_NOWHERE1
+#  define CONFIG_ENV_SIZE  0x1000
+#  define CONFIG_ENV_ADDR  (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
+
+# else /* SPIFLASH && !RAMENV */
+#  define CONFIG_ENV_IS_IN_SPI_FLASH   1
+#  define CONFIG_ENV_SPI_MODE  SPI_MODE_3
+#  define CONFIG_ENV_SPI_MAX_HZCONFIG_SF_DEFAULT_SPEED
+#  define CONFIG_ENV_SPI_CSCONFIG_SF_DEFAULT_CS
+/* 128K(two sectors) for env */
+#  define CONFIG_ENV_SECT_SIZE 0x1
+#  define CONFIG_ENV_SIZE  (2 * CONFIG_ENV_SECT_SIZE)
+/* Warning: adjust the offset in respect of other flash content and size */
+#  define CONFIG_ENV_OFFSET(128 * CONFIG_ENV_SECT_SIZE) /* at 8MB */
+# endif /* SPIFLASH && !RAMBOOT */
+#else /* !SPIFLASH */
+
 /* ENV in RAM */
 # define CONFIG_SYS_NO_FLASH   1
 # define CONFIG_ENV_IS_NOWHERE 1
 # define CONFIG_ENV_SIZE   0x1000
 # define CONFIG_ENV_ADDR   (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
+#endif /* !SPIFLASH */
 #endif /* !FLASH */
 
 /* system ace */
@@ -306,6 +345,15 @@
 #  define CONFIG_CMD_SAVEENV
 #  define CONFIG_CMD_SAVES
 # endif
+
+#else
+#if defined(SPIFLASH)
+# define CONFIG_CMD_SF
+
+# if !defined(RAMENV)
+#  define CONFIG_CMD_SAVEENV
+#  define CONFIG_CMD_SAVES
+# endif
 #else
 # undef CONFIG_CMD_IMLS
 # undef CONFIG_CMD_FLASH
@@ -313,6 +361,7 @@
 # undef CONFIG_CMD_UBI
 # undef CONFIG_CMD_UBIFS
 #endif
+#endif
 
 #if defined(CONFIG_CMD_JFFS2)
 # define CONFIG_MTD_PARTITIONS
-- 
1.7.0.4

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


[U-Boot] [PATCH 2/2] sf: stmicro: add support N25Q128 parts

2012-07-13 Thread Stephan Linz
Adds support for Numonyx's N25Q128 SPI flash. These devices
are used on (among others) Avnet Spartan-6 LX9 micro-evaluation
boards. Tested with "sf" commands and CONFIG_ENV_IS_IN_SPI_FLASH.

Signed-off-by: Stephan Linz 
---
 drivers/mtd/spi/stmicro.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index 4bee9ce..50b8aad 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -111,6 +111,13 @@ static const struct stmicro_spi_flash_params 
stmicro_spi_flash_table[] = {
.nr_sectors = 64,
.name = "M25P128",
},
+   {
+   .id = 0xba18,
+   .page_size = 256,
+   .pages_per_sector = 256,
+   .nr_sectors = 256,
+   .name = "N25Q128",
+   },
 };
 
 static int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len)
-- 
1.7.0.4

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


[U-Boot] [PATCH 1/2] sf: stmicro: support JEDEC standard two-byte signature

2012-07-13 Thread Stephan Linz
There are more than the M25Pxx serial flashs that can be
used with the stmicro driver, for example: the M25PXxx or
N25Qxx serie. All these chips have burned in the original
stmicro manufacture id 0x20 together with a standard
two-byte signature.

In preperation to support all these chips the stmicro driver
have to decode the full two-byte signature.

Signed-off-by: Stephan Linz 
---
 drivers/mtd/spi/stmicro.c |   24 
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index a9b33cf..4bee9ce 100644
--- a/drivers/mtd/spi/stmicro.c
+++ b/drivers/mtd/spi/stmicro.c
@@ -47,7 +47,7 @@
 #define CMD_M25PXX_RES 0xab/* Release from DP, and Read Signature 
*/
 
 struct stmicro_spi_flash_params {
-   u8 idcode1;
+   u16 id;
u16 page_size;
u16 pages_per_sector;
u16 nr_sectors;
@@ -56,56 +56,56 @@ struct stmicro_spi_flash_params {
 
 static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = {
{
-   .idcode1 = 0x11,
+   .id = 0x2011,
.page_size = 256,
.pages_per_sector = 128,
.nr_sectors = 4,
.name = "M25P10",
},
{
-   .idcode1 = 0x15,
+   .id = 0x2015,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 32,
.name = "M25P16",
},
{
-   .idcode1 = 0x12,
+   .id = 0x2012,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 4,
.name = "M25P20",
},
{
-   .idcode1 = 0x16,
+   .id = 0x2016,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 64,
.name = "M25P32",
},
{
-   .idcode1 = 0x13,
+   .id = 0x2013,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 8,
.name = "M25P40",
},
{
-   .idcode1 = 0x17,
+   .id = 0x2017,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 128,
.name = "M25P64",
},
{
-   .idcode1 = 0x14,
+   .id = 0x2014,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 16,
.name = "M25P80",
},
{
-   .idcode1 = 0x18,
+   .id = 0x2018,
.page_size = 256,
.pages_per_sector = 1024,
.nr_sectors = 64,
@@ -139,13 +139,13 @@ struct spi_flash *spi_flash_probe_stmicro(struct 
spi_slave *spi, u8 * idcode)
 
for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) {
params = &stmicro_spi_flash_table[i];
-   if (params->idcode1 == idcode[2]) {
+   if (params->id == ((idcode[1] << 8) | idcode[2]))
break;
-   }
}
 
if (i == ARRAY_SIZE(stmicro_spi_flash_table)) {
-   debug("SF: Unsupported STMicro ID %02x\n", idcode[1]);
+   debug("SF: Unsupported STMicro ID %02x%02x\n",
+   idcode[1], idcode[2]);
return NULL;
}
 
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH 08/12] microblaze: timer: Prepare for device-tree initialization

2012-07-10 Thread Stephan Linz
Am Dienstag, den 10.07.2012, 10:16 +0200 schrieb Michal Simek: 
> On 07/09/2012 09:06 PM, Stephan Linz wrote:
> > Am Montag, den 09.07.2012, 11:20 +0200 schrieb Michal Simek:
> >> microblaze: Fix CONFIG_SYS_HZ usage in board config
> >>
> >> Do not use hardcoded value. Use CONFIG_SYS_HZ instead.
> >> Separate static configuration to single block.
> >>
> >> Signed-off-by: Michal Simek
> >> ---
> >>   arch/microblaze/cpu/timer.c|   69 
> >> ---
> >>   arch/microblaze/include/asm/microblaze_timer.h |3 +
> >>   arch/microblaze/lib/board.c|5 --
> >>   include/configs/microblaze-generic.h   |   12 +
> >>   4 files changed, 41 insertions(+), 48 deletions(-)
> >>
> >> diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
> >> index cc6b897..dfaaaf5 100644
> >> --- a/arch/microblaze/cpu/timer.c
> >> +++ b/arch/microblaze/cpu/timer.c
> >> @@ -27,42 +27,30 @@
> >>   #include
> >>
> >>   volatile int timestamp = 0;
> >> +microblaze_timer_t *tmr;
> >>
> >> -#ifdef CONFIG_SYS_TIMER_0
> >>   ulong get_timer (ulong base)
> >>   {
> >> -  return (timestamp - base);
> >> +  if (tmr)
> >> +  return timestamp - base;
> >> +  return timestamp++ - base;
> >>   }
> >> -#else
> >> -ulong get_timer (ulong base)
> >> -{
> >> -  return (timestamp++ - base);
> >> -}
> >> -#endif
> >>
> >> -#ifdef CONFIG_SYS_TIMER_0
> >>   void __udelay(unsigned long usec)
> >>   {
> >> -  int i;
> >> +  u32 i;
> >>
> >> -  i = get_timer(0);
> >> -  while ((get_timer(0) - i)<  (usec / 1000))
> >> -  ;
> >> +  if (tmr) {
> >> +  i = get_timer(0);
> >> +  while ((get_timer(0) - i)<  (usec / 1000))
> >> +  ;
> >
> > Hi Michal,
> >
> >> +  } else {
> >> +  for (i = 0; i<  (usec * XILINX_CLOCK_FREQ / 1000); i++)
> >> +  ;
> >
> > this part should be enclosed by   #ifdef XILINX_CLOCK_FREQ
> 
> It was intentional because XILINX_CLOCK_FREQ must be define.

Hm, it's a catch-22 situation in between compilation and run time.

With a prober fdt setup you will implicitly fetch this value from dts
(as tmr->loadreg) and you will never reach this code. In the case of a
wrong dts content, for example a missing "clock-frequency" entry, this
code snipped could be a fall back solution. But what is wrong and what
is right?

I think you should make a hard cut here and make a strict distinguish
between the old (undef CONFIG_OF_CONTROL) and the new timer setup. Your
current code base leads to a hardware description with overdetermined
definition of timer clock frequency:

first one here: board/xilinx/microblaze-generic/xparameters.h
second one here: board/xilinx/microblaze-generic/dts/microblaze.dts


> Maybe it could be handle by
> 
> #ifndef XILINX_CLOCK_FREQ
> # error Please define XILINX_CLOCK_FREQ
> #endif

better would be:

#if !defined(CONFIG_OF_CONTROL) && !defined(XILINX_CLOCK_FREQ)
# error Please define XILINX_CLOCK_FREQ
#endif


br,
Stephan


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


Re: [U-Boot] [PATCH 08/12] microblaze: timer: Prepare for device-tree initialization

2012-07-09 Thread Stephan Linz
Am Montag, den 09.07.2012, 11:20 +0200 schrieb Michal Simek: 
> microblaze: Fix CONFIG_SYS_HZ usage in board config
> 
> Do not use hardcoded value. Use CONFIG_SYS_HZ instead.
> Separate static configuration to single block.
> 
> Signed-off-by: Michal Simek 
> ---
>  arch/microblaze/cpu/timer.c|   69 ---
>  arch/microblaze/include/asm/microblaze_timer.h |3 +
>  arch/microblaze/lib/board.c|5 --
>  include/configs/microblaze-generic.h   |   12 +
>  4 files changed, 41 insertions(+), 48 deletions(-)
> 
> diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
> index cc6b897..dfaaaf5 100644
> --- a/arch/microblaze/cpu/timer.c
> +++ b/arch/microblaze/cpu/timer.c
> @@ -27,42 +27,30 @@
>  #include 
>  
>  volatile int timestamp = 0;
> +microblaze_timer_t *tmr;
>  
> -#ifdef CONFIG_SYS_TIMER_0
>  ulong get_timer (ulong base)
>  {
> - return (timestamp - base);
> + if (tmr)
> + return timestamp - base;
> + return timestamp++ - base;
>  }
> -#else
> -ulong get_timer (ulong base)
> -{
> - return (timestamp++ - base);
> -}
> -#endif
>  
> -#ifdef CONFIG_SYS_TIMER_0
>  void __udelay(unsigned long usec)
>  {
> - int i;
> + u32 i;
>  
> - i = get_timer(0);
> - while ((get_timer(0) - i) < (usec / 1000))
> - ;
> + if (tmr) {
> + i = get_timer(0);
> + while ((get_timer(0) - i) < (usec / 1000))
> + ;

Hi Michal,

> + } else {
> +     for (i = 0; i < (usec * XILINX_CLOCK_FREQ / 1000); i++)
> + ;

this part should be enclosed by   #ifdef XILINX_CLOCK_FREQ


br,
Stephan Linz

> + }
>  }
> -#else
> -void __udelay(unsigned long usec)
> -{
> - unsigned int i;
>  
> - for (i = 0; i < (usec * CONFIG_XILINX_CLOCK_FREQ / 1000); i++)
> - ;
> -}
> -#endif
> -
> -#ifdef CONFIG_SYS_TIMER_0
> -microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
> -
> -void timer_isr (void *arg)
> +static void timer_isr(void *arg)
>  {
>   timestamp++;
>   tmr->control = tmr->control | TIMER_INTERRUPT;
> @@ -70,15 +58,30 @@ void timer_isr (void *arg)
>  
>  int timer_init (void)
>  {
> - tmr->loadreg = CONFIG_SYS_TIMER_0_PRELOAD;
> - tmr->control = TIMER_INTERRUPT | TIMER_RESET;
> - tmr->control =
> - TIMER_ENABLE | TIMER_ENABLE_INTR | TIMER_RELOAD | TIMER_DOWN_COUNT;
> - timestamp = 0;
> - install_interrupt_handler (CONFIG_SYS_TIMER_0_IRQ, timer_isr, (void 
> *)tmr);
> + u32 irq = 0;
> + u32 preload = 0;
> + u32 ret = 0;
> +
> +#if defined(CONFIG_SYS_TIMER_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM)
> + preload = XILINX_CLOCK_FREQ / CONFIG_SYS_HZ;
> + irq = CONFIG_SYS_TIMER_0_IRQ;
> + tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
> +#endif
> +
> + if (tmr && irq && preload) {
> + tmr->loadreg = preload;
> + tmr->control = TIMER_INTERRUPT | TIMER_RESET;
> + tmr->control = TIMER_ENABLE | TIMER_ENABLE_INTR |\
> + TIMER_RELOAD | TIMER_DOWN_COUNT;
> + timestamp = 0;
> + ret = install_interrupt_handler (irq, timer_isr, (void *)tmr);
> + if (ret)
> + tmr = NULL;
> + }
> +
> + /* No problem if timer is not found/initialized */
>   return 0;
>  }
> -#endif
>  
>  /*
>   * This function is derived from PowerPC code (read timebase as long long).
> diff --git a/arch/microblaze/include/asm/microblaze_timer.h 
> b/arch/microblaze/include/asm/microblaze_timer.h
> index 844c8db..28e8b02 100644
> --- a/arch/microblaze/include/asm/microblaze_timer.h
> +++ b/arch/microblaze/include/asm/microblaze_timer.h
> @@ -39,3 +39,6 @@ typedef volatile struct microblaze_timer_t {
>   int loadreg; /* load register TLR */
>   int counter; /* timer/counter register */
>  } microblaze_timer_t;
> +
> +int timer_init(void);
> +
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index 8cf4266..ddbc862 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -40,9 +40,6 @@ DECLARE_GLOBAL_DATA_PTR;
>  #ifdef CONFIG_SYS_GPIO_0
>  extern int gpio_init (void);
>  #endif
> -#ifdef CONFIG_SYS_TIMER_0
> -extern int timer_init (void);
> -#endif
>  #ifdef CONFIG_SYS_FSL_2
>  extern void fsl_init2 (void);
>  #endif
> @@ -72,9 +69,7 @@ init_fnc_t *init_sequence[] = {
>   gpio

Re: [U-Boot] [PATCH 08/12] microblaze: timer: Prepare for device-tree initialization

2012-07-09 Thread Stephan Linz
Hi Michal,

Am Montag, den 09.07.2012, 11:20 +0200 schrieb Michal Simek: 
> microblaze: Fix CONFIG_SYS_HZ usage in board config
> 
> Do not use hardcoded value. Use CONFIG_SYS_HZ instead.
> Separate static configuration to single block.
> 
> Signed-off-by: Michal Simek 
> ---
>  arch/microblaze/cpu/timer.c|   69 ---
>  arch/microblaze/include/asm/microblaze_timer.h |3 +
>  arch/microblaze/lib/board.c|5 --
>  include/configs/microblaze-generic.h   |   12 +
>  4 files changed, 41 insertions(+), 48 deletions(-)
> 
> diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
> index cc6b897..dfaaaf5 100644
> --- a/arch/microblaze/cpu/timer.c
> +++ b/arch/microblaze/cpu/timer.c
> @@ -27,42 +27,30 @@
>  #include 
>  
>  volatile int timestamp = 0;
> +microblaze_timer_t *tmr;
>  
> -#ifdef CONFIG_SYS_TIMER_0
>  ulong get_timer (ulong base)
>  {
> - return (timestamp - base);
> + if (tmr)
> + return timestamp - base;
> + return timestamp++ - base;
>  }
> -#else
> -ulong get_timer (ulong base)
> -{
> - return (timestamp++ - base);
> -}
> -#endif
>  
> -#ifdef CONFIG_SYS_TIMER_0
>  void __udelay(unsigned long usec)
>  {
> - int i;
> + u32 i;
>  
> - i = get_timer(0);
> - while ((get_timer(0) - i) < (usec / 1000))
> - ;
> + if (tmr) {
> + i = get_timer(0);
> + while ((get_timer(0) - i) < (usec / 1000))
> + ;
> + } else {
> + for (i = 0; i < (usec * XILINX_CLOCK_FREQ / 1000); i++)
> + ;
> + }
>  }
> -#else
> -void __udelay(unsigned long usec)
> -{
> - unsigned int i;
>  
> - for (i = 0; i < (usec * CONFIG_XILINX_CLOCK_FREQ / 1000); i++)
> - ;
> -}
> -#endif
> -
> -#ifdef CONFIG_SYS_TIMER_0
> -microblaze_timer_t *tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
> -
> -void timer_isr (void *arg)
> +static void timer_isr(void *arg)
>  {
>   timestamp++;
>   tmr->control = tmr->control | TIMER_INTERRUPT;
> @@ -70,15 +58,30 @@ void timer_isr (void *arg)
>  
>  int timer_init (void)
>  {
> - tmr->loadreg = CONFIG_SYS_TIMER_0_PRELOAD;
> - tmr->control = TIMER_INTERRUPT | TIMER_RESET;
> - tmr->control =
> - TIMER_ENABLE | TIMER_ENABLE_INTR | TIMER_RELOAD | TIMER_DOWN_COUNT;
> - timestamp = 0;
> - install_interrupt_handler (CONFIG_SYS_TIMER_0_IRQ, timer_isr, (void 
> *)tmr);
> + u32 irq = 0;

should be   int irq = -1;   (see below)

> + u32 preload = 0;
> + u32 ret = 0;
> +
> +#if defined(CONFIG_SYS_TIMER_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM)
> + preload = XILINX_CLOCK_FREQ / CONFIG_SYS_HZ;
> + irq = CONFIG_SYS_TIMER_0_IRQ;
> + tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
> +#endif
> +
> + if (tmr && irq && preload) {

it should be:

if (tmr && irq >= 0 && preload) {

irq valid --> irq >= 0
irq invalid --> irq == -1


br,
Stephan

> + tmr->loadreg = preload;
> + tmr->control = TIMER_INTERRUPT | TIMER_RESET;
> + tmr->control = TIMER_ENABLE | TIMER_ENABLE_INTR |\
> + TIMER_RELOAD | TIMER_DOWN_COUNT;
> + timestamp = 0;
> + ret = install_interrupt_handler (irq, timer_isr, (void *)tmr);
> + if (ret)
> + tmr = NULL;
> + }
> +
> + /* No problem if timer is not found/initialized */
>   return 0;
>  }
> -#endif
>  
>  /*
>   * This function is derived from PowerPC code (read timebase as long long).
> diff --git a/arch/microblaze/include/asm/microblaze_timer.h 
> b/arch/microblaze/include/asm/microblaze_timer.h
> index 844c8db..28e8b02 100644
> --- a/arch/microblaze/include/asm/microblaze_timer.h
> +++ b/arch/microblaze/include/asm/microblaze_timer.h
> @@ -39,3 +39,6 @@ typedef volatile struct microblaze_timer_t {
>   int loadreg; /* load register TLR */
>   int counter; /* timer/counter register */
>  } microblaze_timer_t;
> +
> +int timer_init(void);
> +
> diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
> index 8cf4266..ddbc862 100644
> --- a/arch/microblaze/lib/board.c
> +++ b/arch/microblaze/lib/board.c
> @@ -40,9 +40,6 @@ DECLARE_GLOBAL_DATA_PTR;
>  #ifdef CONFIG_SYS_GPIO_0
>  extern int gpio_init (void);
>  #endif
> -#ifdef CONFIG_SYS_TIMER_0
> -extern int timer_init (void);
> -#endif
>  #ifdef CONFIG_SYS_FSL_2
>  extern void fsl_init2 (void);
>  #endif
> @@ -72,9 +69,7 @@ init_fnc_t *init_sequence[] = {
>   gpio_init,
>  #endif
>   interrupts_init,
> -#ifdef CONFIG_SYS_TIMER_0
>   timer_init,
> -#endif
>  #ifdef CONFIG_SYS_FSL_2
>   fsl_init2,
>  #endif
> diff --git a/include/configs/microblaze-generic.h 
> b/include/configs/microblaze-generic.h
> index 44934eb..9f90107 100644
> --- a/include/configs/microblaze-generic.h
> +++ b/include/configs/microblaze-generic.h
> @@ -102,19 +102,11 @@
>  #endif
>  

Re: [U-Boot] [PATCH 09/12] microblaze: timer: Add device-tree driver configuration

2012-07-09 Thread Stephan Linz
Hi Michal,

Am Montag, den 09.07.2012, 11:20 +0200 schrieb Michal Simek: 
> Read configuration from DTB.
> 
> Signed-off-by: Michal Simek 
> ---
>  arch/microblaze/cpu/timer.c |   25 +
>  1 files changed, 25 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
> index dfaaaf5..91ca42b 100644
> --- a/arch/microblaze/cpu/timer.c
> +++ b/arch/microblaze/cpu/timer.c
> @@ -25,6 +25,9 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
>  
>  volatile int timestamp = 0;
>  microblaze_timer_t *tmr;
> @@ -62,11 +65,33 @@ int timer_init (void)
>   u32 preload = 0;
>   u32 ret = 0;
>  
> +#ifndef CONFIG_OF_CONTROL
>  #if defined(CONFIG_SYS_TIMER_0_ADDR) && defined(CONFIG_SYS_INTC_0_NUM)
>   preload = XILINX_CLOCK_FREQ / CONFIG_SYS_HZ;
>   irq = CONFIG_SYS_TIMER_0_IRQ;
>   tmr = (microblaze_timer_t *) (CONFIG_SYS_TIMER_0_ADDR);
>  #endif
> +#else
> + int temp;
> + int offset = 0;
> +
> + offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset,
> + "xlnx,xps-timer-1.00.a");
> + if (offset > 0) {
> + temp = fdtdec_get_addr(gd->fdt_blob, offset, "reg");
> + if (temp != FDT_ADDR_T_NONE) {
> + tmr = (microblaze_timer_t *)temp;
> + irq = fdtdec_get_int(gd->fdt_blob, offset,
> + "interrupts", -1);
> + if (irq == -1)

irq is u32 (unsigned) -- my be a problem. But yes, I'm missing a
compilation warning here ...


br,
Stephan

> + panic("Connect IRQ to system timer\n");
> + /* Set default clock frequency */
> + temp = fdtdec_get_int(gd->fdt_blob, offset,
> + "clock-frequency", 0);
> + preload = temp / CONFIG_SYS_HZ;
> + }
> + }
> +#endif
>  
>   if (tmr && irq && preload) {
>   tmr->loadreg = preload;



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


Re: [U-Boot] [PATCH 2/2] [v2] net: abort network initialization if the PHY driver fails

2012-07-09 Thread Stephan Linz
ce *dev)
>  static int ll_temac_init(struct eth_device *dev, bd_t *bis)
>  {
>   struct ll_temac *ll_temac = dev->priv;
> + int ret;
>  
>   printf("%s: Xilinx XPS LocalLink Tri-Mode Ether MAC #%d at 0x%08X.\n",
>   dev->name, dev->index, dev->iobase);
> @@ -240,7 +241,12 @@ static int ll_temac_init(struct eth_device *dev, bd_t 
> *bis)
>   return -1;
>  
>   /* Start up the PHY */
> - phy_startup(ll_temac->phydev);
> + ret = phy_startup(ll_temac->phydev);
> + if (ret) {
> + printf("%s: Could not initialize PHY %s\n",
> +dev->name, ll_temac->phydev->dev->name);
> + return ret;
> + }
>  
>   if (!ll_temac_adjust_link(dev)) {
>   ll_temac_halt(dev);
I acked Xilinx part, xilinx_axi_emac and xilinx_ll_temac. Thank you.

Acked-by: Stephan Linz 

br,
Stephan



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


Re: [U-Boot] ARM CONFIG_OF_CONTROL status

2012-07-04 Thread Stephan Linz
Am Mittwoch, den 04.07.2012, 08:24 +0200 schrieb Michal Simek: 
> On 07/03/2012 10:22 PM, Stephan Linz wrote:
> > Am Dienstag, den 03.07.2012, 12:21 -0700 schrieb Simon Glass:
> >> Hi,
> >>
> >> On Sun, Jul 1, 2012 at 10:43 PM, Michal Simek  wrote:
> >>
> >>> 2012/6/29 Stephan Linz:
> >>>> Am Freitag, den 29.06.2012, 10:18 +0200 schrieb Michal Simek:
> >>>>> On 06/29/2012 04:32 AM, Simon Glass wrote:
> >>>>>> Hi,
> >>>>>>
> >>>>>> --snip--
> >>>>>
> >>>>> 
> >>>
> >>
> >> Well there is no inherent problem with having multiple include files,
> >> except that it is hard to support with the old dtc when there are in
> >> different subdirs.
> >>
> >> As a workaround, how about putting the include files in the
> >> board/vendor/dts subdir as well for now?
> >
> > Hi,
> >
> > good idea -- but they cannot be used directly. The substitution variable
> > ARCH_CPU_DTS is already reserved for dtsi in arch/cpu. The Microblaze
> > architecture needs a board specific dts onyl. That's why I think the new
> > substitution variable BOARD_DTS can be a option to solve the CPP problem
> > today and handle the dtc -i in the future.
> >
> > BOARD_DTS can point to anything below board/vendor and perhaps with a
> > new configuration option similar to CONFIG_DEFAULT_DEVICE_TREE the
> > substitution could be affected with freely selectable file name instead
> > of DEVICE_TREE only.
> 
> 
> ok.
> 
> Stephan: go ahead and create proper patch with empty dts/dtsi files.

Hi Michal,

see my patch set, that I've already submitted. The patches are based on
your patch set from last week. I've create a bundle on patchwork:

http://patchwork.ozlabs.org/bundle/rexut/microblaze-fdt/

Further you will need a QnD hack to avoid a compilation error due to
type conflicts (I've not explored here, not yet):

In file included from key_matrix.c:28:
include/malloc.h:364: error: conflicting types for 'memset'
include/linux/string.h:71: error: previous declaration of 'memset' was
here
include/malloc.h:365: error: conflicting types for 'memcpy'
include/linux/string.h:74: error: previous declaration of 'memcpy' was
here


Here is the QnD hack:


diff --git a/drivers/input/Makefile b/drivers/input/Makefile
index 5c831b2..5efeeb3 100644
--- a/drivers/input/Makefile
+++ b/drivers/input/Makefile
@@ -32,7 +32,7 @@ COBJS-y += keyboard.o pc_keyb.o
COBJS-$(CONFIG_PS2MULT) += ps2mult.o ps2ser.o
endif
COBJS-y += input.o
-COBJS-$(CONFIG_OF_CONTROL) += key_matrix.o
+#COBJS-$(CONFIG_OF_CONTROL) += key_matrix.o

COBJS  := $(COBJS-y)
SRCS   := $(COBJS:.o=.c)




br,
Stephan


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


[U-Boot] [PATCH 3/3] microblaze: Wire up OF support for emaclite

2012-07-04 Thread Stephan Linz
- expand the condition with CONFIG_OF_CONTROL

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 386189f..01e3421 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -79,7 +79,7 @@
 
 /* ethernet */
 #undef CONFIG_SYS_ENET
-#if defined(XILINX_EMACLITE_BASEADDR)
+#if defined(XILINX_EMACLITE_BASEADDR) || defined(CONFIG_OF_CONTROL)
 # define CONFIG_XILINX_EMACLITE1
 # define CONFIG_SYS_ENET
 #endif
-- 
1.7.0.4

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


[U-Boot] [PATCH 1/3] fdt: Add board specific dts inclusion

2012-07-04 Thread Stephan Linz
Some architectures, for example Microblaze, doesn't need a
splitted device tree because every Microblaze hw design is
different. The individuell Microblaze device tree will be
auto generated by FPGA design tools and could be used directly
with dtc.

The auto generated dts for Microblaze can not processed by CPP.
Unfortunately that is the default procedure in U-Boot to merge
a splitted device tree (substitution of ARCH_CPU_DTS).

Microblaze will never use the ARCH_CPU_DTS substitution and we
introduce the new board specific substitution variable BOARD_DTS
that points into vendor/board/dts subdir with the file name
of CONFIG_DEFAULT_DEVICE_TREE. The common dts file in vendor/dts
subdir (defined by CONFIG_DEFAULT_DEVICE_TREE) contain a single
include line that can processed by CPP:

/include/ BOARD_DTS

Signed-off-by: Stephan Linz 
---
 dts/Makefile |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dts/Makefile b/dts/Makefile
index 914e479..b1f47a1 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -36,7 +36,8 @@ $(error Your architecture does not have device tree support 
enabled. \
 Please define CONFIG_ARCH_DEVICE_TREE))
 
 # We preprocess the device tree file provide a useful define
-DTS_CPPFLAGS := 
-DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\"
+DTS_CPPFLAGS := 
-DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" \
+   
-DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts\"
 
 all:   $(obj).depend $(LIB)
 
-- 
1.7.0.4

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


[U-Boot] [PATCH 2/3] microblaze: Wire up dts configuration

2012-07-04 Thread Stephan Linz
- enable OF control and embedded OF
- set default device tree file name to 'microblaze'
- add CPP to dtc proxy: board/xilinx/dts/microblaze.dts
- add an empty but processable dts for microblaze-generic

Signed-off-by: Stephan Linz 
---
 board/xilinx/dts/microblaze.dts|1 +
 board/xilinx/microblaze-generic/dts/microblaze.dts |7 +++
 include/configs/microblaze-generic.h   |5 +
 3 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100644 board/xilinx/dts/microblaze.dts
 create mode 100644 board/xilinx/microblaze-generic/dts/microblaze.dts

diff --git a/board/xilinx/dts/microblaze.dts b/board/xilinx/dts/microblaze.dts
new file mode 100644
index 000..bf984b0
--- /dev/null
+++ b/board/xilinx/dts/microblaze.dts
@@ -0,0 +1 @@
+/include/ BOARD_DTS
diff --git a/board/xilinx/microblaze-generic/dts/microblaze.dts 
b/board/xilinx/microblaze-generic/dts/microblaze.dts
new file mode 100644
index 000..2033309
--- /dev/null
+++ b/board/xilinx/microblaze-generic/dts/microblaze.dts
@@ -0,0 +1,7 @@
+/dts-v1/;
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   aliases {
+   } ;
+} ;
diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 2fd2279..386189f 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -31,6 +31,11 @@
 #defineCONFIG_MICROBLAZE   1
 #defineMICROBLAZE_V5   1
 
+/* Open Firmware DTS */
+#define CONFIG_OF_CONTROL  1
+#define CONFIG_OF_EMBED1
+#define CONFIG_DEFAULT_DEVICE_TREE microblaze
+
 /* linear flash memory */
 #ifdef XILINX_FLASH_START
 #defineFLASH
-- 
1.7.0.4

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


Re: [U-Boot] ARM CONFIG_OF_CONTROL status

2012-07-03 Thread Stephan Linz
Am Dienstag, den 03.07.2012, 12:21 -0700 schrieb Simon Glass: 
> Hi,
> 
> On Sun, Jul 1, 2012 at 10:43 PM, Michal Simek  wrote:
> 
> > 2012/6/29 Stephan Linz :
> > > Am Freitag, den 29.06.2012, 10:18 +0200 schrieb Michal Simek:
> > >> On 06/29/2012 04:32 AM, Simon Glass wrote:
> > >> > Hi,
> > >> >
> > >> > --snip--
> > >>
> > >> I have sent support for Microblaze. Currently without dts because I
> > want to clear this part a little bit.
> > >
> > > Hi Michal,
> > >
> > > looks good, I've been waiting a long time on the FDT support in U-Boot
> > > for Microblaze -- great -- PS: see my comment on patch 5 ...
> > >
> > >>
> > >> Tegra is using ./arch/arm/dts/tegra20.dtsi and
> > board/nvidia/dts/tegra2-seaboard.dts
> > >> and they are composed together in dts/Makefile by calling preprocessor.
> > >> Microblaze will be totally different case because every Microblaze hw
> > design is different.
> > >
> > > Yes, that's right. We will never be in the position to define a skeleton
> > > or a basic platform configuration.
> > >
> > >> We can use two main buses (little and big endian) and cpu is also
> > configurable.
> > >> Based on this for Microblaze is the best solution directly to use dts.
> > >> (DTS for Microblaze is also generated directly from design tool).
> > >
> > > ... directly in the context of a board, not arch/cpu, right?
> >
> > yes.
> >
> > >
> > >>
> > >>
> > >> Anyway - here is the bug message I am getting if I use full dts in
> > board//dts/microblaze.dts
> > >> and empty arch/microblaze/dts/microblaze.dtsi
> > >>
> > >> :34:3: error: invalid preprocessing directive #address
> > >> :35:3: error: invalid preprocessing directive #size
> > >> :52:4: error: invalid preprocessing directive #address
> > >> :53:4: error: invalid preprocessing directive #cpus
> > >> :54:4: error: invalid preprocessing directive #size
> > >> :155:4: error: invalid preprocessing directive #address
> > >> :156:4: error: invalid preprocessing directive #size
> > >> :160:5: error: invalid preprocessing directive #gpio
> > >> :192:5: error: invalid preprocessing directive #gpio
> > >> :209:5: error: invalid preprocessing directive #gpio
> > >> :241:5: error: invalid preprocessing directive #gpio
> > >> :267:5: error: invalid preprocessing directive #address
> > >> :268:5: error: invalid preprocessing directive #size
> > >> :394:5: error: invalid preprocessing directive #interrupt
> > >>
> > >> This is error for opposite case - empty microblaze.dts and full
> > microblaze.dtsi.
> > >
> > > That are CPP errors, because the auto generated xilinx.dts is full of
> > > CPP pragma like syntax (#something) that are wrong (invalid).
> >
> > I know what it is.
> >
> > >
> > >>
> > >> make[1]: Entering directory `/mnt/projects/u-boot/dts'
> > >> rc=$( cat /mnt/projects/u-boot/board/petalogix/dts/microblaze.dts |
> > microblaze-unknown-linux-gnu-gcc -E
> > >> -P
> > -DARCH_CPU_DTS=\"/mnt/projects/u-boot/arch/microblaze/dts/microblaze.dtsi\"
> > - | { { dtc -R 4 -p 0x1000
> > >> -O dtb -o dt.dtb - 2>&1 ; echo $? >&3 ; } | grep -v '^DTC: dts->dtb  on
> > file' ; } 3>&1 ) ; \
> > >>   exit $rc
> > >> /bin/sh: line 1: exit: too many arguments
> > >> make[1]: *** [dt.dtb] Error 1
> > >> make[1]: Leaving directory `/mnt/projects/u-boot/dts'
> > >>
> > >>
> > >> I have just tried to fix it by introducing new CONFIG option for
> > skipping that preprocessor
> > >> part.
> > >
> > > Instead of disable / skipp the CPP step you can hide the auto generated
> > > xilinx.dts with a second include stage, for example:
> > >
> > > board/microblaze/dts/microblaze.dts looks like:
> > >
> > > /include/ ARCH_CPU_DTS
> > > /include/ BOARD_DTS
> > >
> > >
> > > Right, only two lines.   The arch/microblaze/dts/microblaze.dtsi remains
> > > empty as you have said above. Just new is BOARD_DTS -- with the attached
> > > patch for dts/Makefile you can copy the auto generated xilinx.dts into
> > > t

Re: [U-Boot] ARM CONFIG_OF_CONTROL status

2012-07-03 Thread Stephan Linz
Hi,

Am Montag, den 02.07.2012, 07:43 +0200 schrieb Michal Simek: 
> 2012/6/29 Stephan Linz :
> > Am Freitag, den 29.06.2012, 10:18 +0200 schrieb Michal Simek:
> >> On 06/29/2012 04:32 AM, Simon Glass wrote:
> >> > Hi,
> >> >
> >> > --snip--
> >>
> >> I have sent support for Microblaze. Currently without dts because I want 
> >> to clear this part a little bit.
> >
> > Hi Michal,
> >
> > looks good, I've been waiting a long time on the FDT support in U-Boot
> > for Microblaze -- great -- PS: see my comment on patch 5 ...
> >
> >>
> >> Tegra is using ./arch/arm/dts/tegra20.dtsi and 
> >> board/nvidia/dts/tegra2-seaboard.dts
> >> and they are composed together in dts/Makefile by calling preprocessor.
> >> Microblaze will be totally different case because every Microblaze hw 
> >> design is different.
> >
> > Yes, that's right. We will never be in the position to define a skeleton
> > or a basic platform configuration.
> >
> >> We can use two main buses (little and big endian) and cpu is also 
> >> configurable.
> >> Based on this for Microblaze is the best solution directly to use dts.
> >> (DTS for Microblaze is also generated directly from design tool).
> >
> > ... directly in the context of a board, not arch/cpu, right?
> 
> yes.
> 
> >
> >>
> >>
> >> Anyway - here is the bug message I am getting if I use full dts in 
> >> board//dts/microblaze.dts
> >> and empty arch/microblaze/dts/microblaze.dtsi
> >>
> >> :34:3: error: invalid preprocessing directive #address
> >> :35:3: error: invalid preprocessing directive #size
> >> :52:4: error: invalid preprocessing directive #address
> >> :53:4: error: invalid preprocessing directive #cpus
> >> :54:4: error: invalid preprocessing directive #size
> >> :155:4: error: invalid preprocessing directive #address
> >> :156:4: error: invalid preprocessing directive #size
> >> :160:5: error: invalid preprocessing directive #gpio
> >> :192:5: error: invalid preprocessing directive #gpio
> >> :209:5: error: invalid preprocessing directive #gpio
> >> :241:5: error: invalid preprocessing directive #gpio
> >> :267:5: error: invalid preprocessing directive #address
> >> :268:5: error: invalid preprocessing directive #size
> >> :394:5: error: invalid preprocessing directive #interrupt
> >>
> >> This is error for opposite case - empty microblaze.dts and full 
> >> microblaze.dtsi.
> >
> > That are CPP errors, because the auto generated xilinx.dts is full of
> > CPP pragma like syntax (#something) that are wrong (invalid).
> 
> I know what it is.
> 
> >
> >>
> >> make[1]: Entering directory `/mnt/projects/u-boot/dts'
> >> rc=$( cat /mnt/projects/u-boot/board/petalogix/dts/microblaze.dts | 
> >> microblaze-unknown-linux-gnu-gcc -E
> >> -P 
> >> -DARCH_CPU_DTS=\"/mnt/projects/u-boot/arch/microblaze/dts/microblaze.dtsi\"
> >>  - | { { dtc -R 4 -p 0x1000
> >> -O dtb -o dt.dtb - 2>&1 ; echo $? >&3 ; } | grep -v '^DTC: dts->dtb  on 
> >> file' ; } 3>&1 ) ; \
> >>   exit $rc
> >> /bin/sh: line 1: exit: too many arguments
> >> make[1]: *** [dt.dtb] Error 1
> >> make[1]: Leaving directory `/mnt/projects/u-boot/dts'
> >>
> >>
> >> I have just tried to fix it by introducing new CONFIG option for skipping 
> >> that preprocessor
> >> part.
> >
> > Instead of disable / skipp the CPP step you can hide the auto generated
> > xilinx.dts with a second include stage, for example:
> >
> > board/microblaze/dts/microblaze.dts looks like:
> >
> > /include/ ARCH_CPU_DTS
> > /include/ BOARD_DTS
> >
> >
> > Right, only two lines.   The arch/microblaze/dts/microblaze.dtsi remains
> > empty as you have said above. Just new is BOARD_DTS -- with the attached
> > patch for dts/Makefile you can copy the auto generated xilinx.dts into
> > the specific board directory and the CPP step substitute the right place
> > to board/microblaze/microblaze-generic/dts/microblaze.dts
> >
> > I think there are no side effects with other ports like the tegra2.
> >
> > If you want you can omit the ARCH_CPU_DTS inclusion. The architectural
> > microblaze.dtsi file is empty and (!!) have to be empty, because the DTC
> > will break with an error on multiple "/dts-v1/;" lines

Re: [U-Boot] [PATCH 2/2] microblaze: move ENV onto top of flash

2012-07-02 Thread Stephan Linz
Am Montag, den 02.07.2012, 07:52 +0200 schrieb Michal Simek: 
> 2012/7/1 Stephan Linz :
> > On Microblaze systems with BPI configuration from CFI flash
> > the first 1-10 MB will occupied by the FPGA configuration
> > data (BIN file). So we can not use this area for the U-Boot
> > environment.
> >
> > In most of all FPGA configuration cases the upper sector in
> > flash memory will be free for individuell usage.
> 
> is it based on any statistic? I don't think so.

Hi Michal,

yes, there isn't ... you are right ;)

> 
> >
> > Signed-off-by: Stephan Linz 
> > ---
> >  include/configs/microblaze-generic.h |8 +++-
> >  1 files changed, 3 insertions(+), 5 deletions(-)
> 
> nack for this.
> One configuration file can't cover all fpga cases.
> The reason why there is only one configuration file for microblaze is
> that fpga variability.
> If you want to use this option just create new board with your configuration
> and use it.

I can live with that, but the current configuration file defines a
memory hole of 256kB in the first 2 sectors in flash. For what? -- The
environment is placed in the 3rd sector. All other sectors are free for
anything.

I think it would be more plausible if the last sector on top will be
used for environment and all other sectors down to the first would be
free for anything, or not?


br,
Stephan

> Generic microblaze board should be as simple as possible.
> I am ok with adding new command/drivers and improving config but I don't want 
> to
> support everything because it is not possible.
> 
> Thanks,
> Michal
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot



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


[U-Boot] [PATCH 1/2] microblaze: expand and correct configuration comments

2012-07-01 Thread Stephan Linz
  - fix CONFIG_SYS_MALLOC_BASE from 0x11FB_F000 to 0x13EF_F000
  - add new size calculation for CONFIG_SYS_MONITOR_LEN
and CONFIG_SYS_MALLOC_LEN derived from SIZE
  - change CONFIG_SYS_MONITOR_BASE and CONFIG_SYS_MALLOC_BASE
calculation to a symbolic equation with the corresponding
_LEN definitions
  - add a "CFI flash memory layout - Example" comment

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   36 +++--
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 2c7ed5d..e20eb08 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -122,15 +122,19 @@
 
 /*
  * memory layout - Example
- * CONFIG_SYS_TEXT_BASE = 0x1200_;
+ * CONFIG_SYS_TEXT_BASE = 0x1200_; defined in config.mk
  * CONFIG_SYS_SRAM_BASE = 0x1000_;
- * CONFIG_SYS_SRAM_SIZE = 0x0400_;
+ * CONFIG_SYS_SRAM_SIZE = 0x0400_; 64MB
+ *
+ * CONFIG_SYS_MONITOR_LEN = 0x4
+ * CONFIG_SYS_MALLOC_LEN = 3 * CONFIG_SYS_MONITOR_LEN = 0xC
  *
  * CONFIG_SYS_GBL_DATA_OFFSET = 0x1000_ + 0x0400_ - 0x1000 = 
0x13FF_F000
- * CONFIG_SYS_MONITOR_BASE = 0x13FF_F000 - 0x4 = 0x13FB_F000
- * CONFIG_SYS_MALLOC_BASE = 0x13FB_F000 - 0x4 = 0x13F7_F000
+ * CONFIG_SYS_MONITOR_BASE = 0x13FF_F000 - CONFIG_SYS_MONITOR_LEN = 0x13FB_F000
+ * CONFIG_SYS_MALLOC_BASE = 0x13FB_F000 - CONFIG_SYS_MALLOC_LEN = 0x13EF_F000
  *
  * 0x1000_ CONFIG_SYS_SDRAM_BASE
+ * MEMTEST_AREA 64kB
  * FREE
  * 0x1200_ CONFIG_SYS_TEXT_BASE
  * U-BOOT code
@@ -138,9 +142,9 @@
  * FREE
  *
  * STACK
- * 0x13F7_F000 CONFIG_SYS_MALLOC_BASE
- * MALLOC_AREA 256kB   Alloc
- * 0x11FB_F000 CONFIG_SYS_MONITOR_BASE
+ * 0x13EF_F000 CONFIG_SYS_MALLOC_BASE
+ * MALLOC_AREA 768kB   Alloc
+ * 0x13FB_F000 CONFIG_SYS_MONITOR_BASE
  * MONITOR_CODE256kB   Env
  * 0x13FF_F000 CONFIG_SYS_GBL_DATA_OFFSET
  * GLOBAL_DATA 4kB bd, gd
@@ -173,6 +177,24 @@
 /* stack */
 #defineCONFIG_SYS_INIT_SP_OFFSET   CONFIG_SYS_MALLOC_BASE
 
+/*
+ * CFI flash memory layout - Example
+ * CONFIG_SYS_FLASH_BASE = 0x2200_;
+ * CONFIG_SYS_FLASH_SIZE = 0x0080_;  8MB
+ *
+ * SECT_SIZE = 0x2;128kB is one sector
+ * CONFIG_ENV_SIZE = SECT_SIZE;128kB environment store
+ *
+ * 0x2200_ CONFIG_SYS_FLASH_BASE
+ * FREE256kB
+ * 0x2204_ CONFIG_ENV_ADDR
+ * ENV_AREA128kB
+ * 0x2206_
+ * FREE
+ * 0x2280_ CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE
+ *
+ */
+
 #ifdef FLASH
 # define CONFIG_SYS_FLASH_BASE XILINX_FLASH_START
 # define CONFIG_SYS_FLASH_SIZE XILINX_FLASH_SIZE
-- 
1.7.0.4

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


[U-Boot] [PATCH 2/2] microblaze: move ENV onto top of flash

2012-07-01 Thread Stephan Linz
On Microblaze systems with BPI configuration from CFI flash
the first 1-10 MB will occupied by the FPGA configuration
data (BIN file). So we can not use this area for the U-Boot
environment.

In most of all FPGA configuration cases the upper sector in
flash memory will be free for individuell usage.

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |8 +++-
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index e20eb08..818435d 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -186,11 +186,9 @@
  * CONFIG_ENV_SIZE = SECT_SIZE;128kB environment store
  *
  * 0x2200_ CONFIG_SYS_FLASH_BASE
- * FREE256kB
- * 0x2204_ CONFIG_ENV_ADDR
- * ENV_AREA128kB
- * 0x2206_
  * FREE
+ * 0x227E_ CONFIG_ENV_ADDR
+ * ENV_AREA128kB
  * 0x2280_ CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE
  *
  */
@@ -219,7 +217,7 @@
 /* 128K(one sector) for env */
 #  define CONFIG_ENV_SECT_SIZE 0x2
 #  define CONFIG_ENV_ADDR \
-   (CONFIG_SYS_FLASH_BASE + (2 * CONFIG_ENV_SECT_SIZE))
+   (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SIZE - CONFIG_ENV_SECT_SIZE)
 #  define CONFIG_ENV_SIZE  0x2
 # endif /* !RAMBOOT */
 #else /* !FLASH */
-- 
1.7.0.4

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


[U-Boot] [PATCH] microblaze: add missing undefs for UBI and UBIFS

2012-06-29 Thread Stephan Linz
In the case of missing flash usage disaple (undef)
all the UBI support in the same way as for JFFS2.

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 2fd2279..2c7ed5d 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -284,6 +284,8 @@
 # undef CONFIG_CMD_IMLS
 # undef CONFIG_CMD_FLASH
 # undef CONFIG_CMD_JFFS2
+# undef CONFIG_CMD_UBI
+# undef CONFIG_CMD_UBIFS
 #endif
 
 #if defined(CONFIG_CMD_JFFS2)
-- 
1.7.0.4

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


Re: [U-Boot] ARM CONFIG_OF_CONTROL status

2012-06-29 Thread Stephan Linz
Am Freitag, den 29.06.2012, 10:18 +0200 schrieb Michal Simek: 
> On 06/29/2012 04:32 AM, Simon Glass wrote:
> > Hi,
> >
> > --snip--
> 
> I have sent support for Microblaze. Currently without dts because I want to 
> clear this part a little bit.

Hi Michal,

looks good, I've been waiting a long time on the FDT support in U-Boot
for Microblaze -- great -- PS: see my comment on patch 5 ...

> 
> Tegra is using ./arch/arm/dts/tegra20.dtsi and 
> board/nvidia/dts/tegra2-seaboard.dts
> and they are composed together in dts/Makefile by calling preprocessor.
> Microblaze will be totally different case because every Microblaze hw design 
> is different.

Yes, that's right. We will never be in the position to define a skeleton
or a basic platform configuration.

> We can use two main buses (little and big endian) and cpu is also 
> configurable.
> Based on this for Microblaze is the best solution directly to use dts.
> (DTS for Microblaze is also generated directly from design tool).

... directly in the context of a board, not arch/cpu, right?

> 
> 
> Anyway - here is the bug message I am getting if I use full dts in 
> board//dts/microblaze.dts
> and empty arch/microblaze/dts/microblaze.dtsi
> 
> :34:3: error: invalid preprocessing directive #address
> :35:3: error: invalid preprocessing directive #size
> :52:4: error: invalid preprocessing directive #address
> :53:4: error: invalid preprocessing directive #cpus
> :54:4: error: invalid preprocessing directive #size
> :155:4: error: invalid preprocessing directive #address
> :156:4: error: invalid preprocessing directive #size
> :160:5: error: invalid preprocessing directive #gpio
> :192:5: error: invalid preprocessing directive #gpio
> :209:5: error: invalid preprocessing directive #gpio
> :241:5: error: invalid preprocessing directive #gpio
> :267:5: error: invalid preprocessing directive #address
> :268:5: error: invalid preprocessing directive #size
> :394:5: error: invalid preprocessing directive #interrupt
> 
> This is error for opposite case - empty microblaze.dts and full 
> microblaze.dtsi.

That are CPP errors, because the auto generated xilinx.dts is full of
CPP pragma like syntax (#something) that are wrong (invalid).

> 
> make[1]: Entering directory `/mnt/projects/u-boot/dts'
> rc=$( cat /mnt/projects/u-boot/board/petalogix/dts/microblaze.dts | 
> microblaze-unknown-linux-gnu-gcc -E
> -P 
> -DARCH_CPU_DTS=\"/mnt/projects/u-boot/arch/microblaze/dts/microblaze.dtsi\" - 
> | { { dtc -R 4 -p 0x1000
> -O dtb -o dt.dtb - 2>&1 ; echo $? >&3 ; } | grep -v '^DTC: dts->dtb  on file' 
> ; } 3>&1 ) ; \
>   exit $rc
> /bin/sh: line 1: exit: too many arguments
> make[1]: *** [dt.dtb] Error 1
> make[1]: Leaving directory `/mnt/projects/u-boot/dts'
> 
> 
> I have just tried to fix it by introducing new CONFIG option for skipping 
> that preprocessor
> part.

Instead of disable / skipp the CPP step you can hide the auto generated
xilinx.dts with a second include stage, for example:

board/microblaze/dts/microblaze.dts looks like:

/include/ ARCH_CPU_DTS
/include/ BOARD_DTS


Right, only two lines.   The arch/microblaze/dts/microblaze.dtsi remains
empty as you have said above. Just new is BOARD_DTS -- with the attached
patch for dts/Makefile you can copy the auto generated xilinx.dts into
the specific board directory and the CPP step substitute the right place
to board/microblaze/microblaze-generic/dts/microblaze.dts

I think there are no side effects with other ports like the tegra2.

If you want you can omit the ARCH_CPU_DTS inclusion. The architectural
microblaze.dtsi file is empty and (!!) have to be empty, because the DTC
will break with an error on multiple "/dts-v1/;" lines!

Here is the patch:

diff --git a/dts/Makefile b/dts/Makefile
index 914e479..b1f47a1 100644
--- a/dts/Makefile
+++ b/dts/Makefile
@@ -36,7 +36,8 @@ $(error Your architecture does not have device tree
support enabled. \
Please define CONFIG_ARCH_DEVICE_TREE))

# We preprocess the device tree file provide a useful define
-DTS_CPPFLAGS := -DARCH_CPU_DTS=
\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\"
+DTS_CPPFLAGS := -DARCH_CPU_DTS=
\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" \
+   -DBOARD_DTS=
\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts\"

all:   $(obj).depend $(LIB)


br,
Stephan

> It will be good for Microblaze (probably there is any smarter solution for 
> SKIP case not to have two cats there).
> The same situation will happen for Xilinx ppc support and partially for 
> upcoming ARM zynq where
> full DTS is generated for unique hw design.
> 
> Here is the patch to show you what phase I would like to skip.
> 
> diff --git a/dts/Makefile b/dts/Makefile
> index 914e479..d670cb8 100644
> --- a/dts/Makefile
> +++ b/dts/Makefile
> @@ -45,9 +45,15 @@ all: $(obj).depend $(LIB)
>   # the filename.
>   DT_BIN := $(obj)dt.dtb
> 
> +ifndef CONFIG_DTS_SKIP_PREPROCESSOR
> +SKIP := $(CPP) -P $(DTS_CPPFLAGS) -
> +else
> +SKIP := cat

Re: [U-Boot] [PATCH 5/5] microblaze: Wire up fdt emaclite initialization

2012-06-29 Thread Stephan Linz
Am Freitag, den 29.06.2012, 09:37 +0200 schrieb Michal Simek: 
> Call emaclite FDT registration when CONFIG_OF_CONTROL is used.
> 
> Signed-off-by: Michal Simek 
> ---
>  .../xilinx/microblaze-generic/microblaze-generic.c |5 -
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c 
> b/board/xilinx/microblaze-generic/microblaze-generic.c
> index a1e2bfe..4a719ba 100644
> --- a/board/xilinx/microblaze-generic/microblaze-generic.c
> +++ b/board/xilinx/microblaze-generic/microblaze-generic.c
> @@ -73,6 +73,9 @@ int board_eth_init(bd_t *bis)
>  {
>   int ret = 0;
>  
> +#ifdef CONFIG_OF_CONTROL
> + ret |= xilinx_emaclite_init(bis);
> +#else

First of all: I've successful tested on an AXI system on Avnet S6LX9
micro-module.

Now some words to the different configuration strategy. I prefer a
seperation between the ongoing development without device tree support
and the upcoming development with fdt support.

Could you split the development in the context of boards, for example:

OLD: Development w/o fdt in:
  - board/xilinx/microblaze-generic/*
  - configuration in include/configs/microblaze-generic.h

NEW: Development with fdt in:
  - board/xilinx/microblaze-fdt/*
  - configuration in include/configs/microblaze-fdt.h

So you can start with a really clean and slimmed board configuration for
fdt development (especially the content of config header) and the old
generic board support would be retained. Anytime in the future, when the
generic configuration will become obsolete you can remove it.


br,
Stephan

> #ifdef CONFIG_XILINX_AXIEMAC
>   ret |= xilinx_axiemac_initialize(bis, XILINX_AXIEMAC_BASEADDR,
>   XILINX_AXIDMA_BASEADDR);
> @@ -125,6 +128,6 @@ int board_eth_init(bd_t *bis)
>  #  endif
>  # endif
>  #endif
> -
> +#endif
>   return ret;
>  }




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


[U-Boot] [PATCH 1/3] microblaze: remove wrong define CONFIG_SYS_FLASH_PROTECTION

2012-06-26 Thread Stephan Linz
CONFIG_SYS_FLASH_PROTECTION will defined twice. The second one
is outside the flash configuration context and we can remove
it safely.

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 295d123..5f16820 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -200,8 +200,6 @@
 # define CONFIG_ENV_IS_NOWHERE 1
 # define CONFIG_ENV_SIZE   0x1000
 # define CONFIG_ENV_ADDR   (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
-/* hardware flash protection */
-# define CONFIG_SYS_FLASH_PROTECTION
 #endif /* !FLASH */
 
 /* system ace */
-- 
1.7.0.4

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


[U-Boot] [PATCH 2/3] microblaze: avoid compile error on systems without cfi flash

2012-06-26 Thread Stephan Linz
Use XILINX_FLASH_START to set/unset FLASH and RAMENV.

Error was:
board.c: In function 'board_init':
board.c:134: error: 'XILINX_FLASH_START' undeclared (first use in this function)
board.c:134: error: (Each undeclared identifier is reported only once
board.c:134: error: for each function it appears in.)

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 5f16820..2ef7d62 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -31,6 +31,15 @@
 #defineCONFIG_MICROBLAZE   1
 #defineMICROBLAZE_V5   1
 
+/* linear flash memory */
+#ifdef XILINX_FLASH_START
+#defineFLASH
+#undef RAMENV  /* hold environment in flash */
+#else
+#undef FLASH
+#defineRAMENV  /* hold environment in RAM */
+#endif
+
 /* uart */
 #ifdef XILINX_UARTLITE_BASEADDR
 # define CONFIG_XILINX_UARTLITE
@@ -164,9 +173,6 @@
 /* stack */
 #defineCONFIG_SYS_INIT_SP_OFFSET   CONFIG_SYS_MALLOC_BASE
 
-/*#define  RAMENV */
-#defineFLASH
-
 #ifdef FLASH
 # define CONFIG_SYS_FLASH_BASE XILINX_FLASH_START
 # define CONFIG_SYS_FLASH_SIZE XILINX_FLASH_SIZE
-- 
1.7.0.4

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


[U-Boot] [PATCH 3/3] microblaze: Enable ubi support

2012-06-26 Thread Stephan Linz
Increase malloc area for UBI to >= 512k -- foreseeing of UBIFS
set to 768k. To save memory in flash (CONFIG_SYS_MONITOR_LEN)
the UBIFS is disabled by default.

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   20 ++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 2ef7d62..2fd2279 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -166,7 +166,7 @@
- CONFIG_SYS_MONITOR_LEN - GENERATED_BD_INFO_SIZE)
 #defineCONFIG_SYS_MONITOR_END \
(CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-#defineCONFIG_SYS_MALLOC_LEN   SIZE
+#defineCONFIG_SYS_MALLOC_LEN   (SIZE * 3)
 #defineCONFIG_SYS_MALLOC_BASE \
(CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
 
@@ -273,6 +273,8 @@
 # define CONFIG_CMD_FLASH
 # define CONFIG_CMD_IMLS
 # define CONFIG_CMD_JFFS2
+# define CONFIG_CMD_UBI
+# undef CONFIG_CMD_UBIFS
 
 # if !defined(RAMENV)
 #  define CONFIG_CMD_SAVEENV
@@ -285,7 +287,21 @@
 #endif
 
 #if defined(CONFIG_CMD_JFFS2)
-/* JFFS2 partitions */
+# define CONFIG_MTD_PARTITIONS
+#endif
+
+#if defined(CONFIG_CMD_UBIFS)
+# define CONFIG_CMD_UBI
+# define CONFIG_LZO
+#endif
+
+#if defined(CONFIG_CMD_UBI)
+# define CONFIG_MTD_PARTITIONS
+# define CONFIG_RBTREE
+#endif
+
+#if defined(CONFIG_MTD_PARTITIONS)
+/* MTD partitions */
 #define CONFIG_CMD_MTDPARTS/* mtdparts command line support */
 #define CONFIG_MTD_DEVICE  /* needed for mtdparts commands */
 #define CONFIG_FLASH_CFI_MTD
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH 1/2] microblaze: avoid compile error on systems without cfi flash

2012-06-26 Thread Stephan Linz
Am Dienstag, den 26.06.2012, 10:56 +0200 schrieb Michal Simek: 
> 2012/6/25 Stephan Linz :
> > Am Montag, den 25.06.2012, 06:55 +0200 schrieb Michal Simek:
> >> On 06/21/2012 09:42 PM, Stephan Linz wrote:
> >> > Use XILINX_FLASH_START to set/unset FLASH and RAMENV.
> >> >
> >> > Error was:
> >> > board.c: In function 'board_init':
> >> > board.c:134: error: 'XILINX_FLASH_START' undeclared (first use in this 
> >> > function)
> >> > board.c:134: error: (Each undeclared identifier is reported only once
> >> > board.c:134: error: for each function it appears in.)
> >> >
> >> > Signed-off-by: Stephan Linz
> >> > ---
> >> >   include/configs/microblaze-generic.h |   14 +-
> >> >   1 files changed, 9 insertions(+), 5 deletions(-)
> >> >
> >> > --snip--
> >>
> >> What's wrong with hardware flash protection?
> >
> > Nothing, but it will defined twice. One time in line 182 and one time in
> > that line 204. I think the last one is wrong, because that define is
> > outside the Flash configuration context, or not?
> >
> > Sorry, I should split the patch. Should I do this?
> 
> Two ways.
> 1. write it to description
> 2. create separate patch
> 
> Option 2 is IMHO better.

Yes I do so. I'll split the patch and resubmit together with the UBI
support patch.

br,
Stephan

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


Re: [U-Boot] [PATCH 2/2] microblaze: Enable ubi support

2012-06-26 Thread Stephan Linz
Am Dienstag, den 26.06.2012, 10:52 +0200 schrieb Michal Simek: 
> 2012/6/25 Stephan Linz :
> > Am Montag, den 25.06.2012, 09:22 +0200 schrieb Wolfgang Denk:
> >> Dear Michal Simek,
> >>
> >> In message <4fe7f154.80...@monstr.eu> you wrote:
> >> > On 06/21/2012 09:42 PM, Stephan Linz wrote:
> >> > > To save memory the UBIFS is disabled by default.
> >> > >
> >> > > The original patch was introdused with commit:
> >> > > 0114da7b06bd47b7f5c3f20a152dd11903b38fba
> >> >
> >> > This say nothing to me.
> >> > Format is Patch name and when sha1.
> >> >
> >> > Where is this patch? I can't see it in mainline repository?
> >>
> >> Correct.  This commit does not exist in mainline.
> >
> > Yes, the commit was newer merged into mainline and lives for more than
> > one year in Microblaze custodian repo:
> >
> > http://git.denx.de/?p=u-boot/u-boot-microblaze.git;a=commitdiff;h=0114da7b06bd47b7f5c3f20a152dd11903b38fba
> 
> I have there two branches - master and uboot. uboot follows mainline
> branch and master contain one your patch
> which was merged to mainline.
> That link is correct but it points to nonexisting branch.
> That patch was definitely there but that branch was delete quite some time 
> ago.

Yes, it was in the net (?) branch that was deleted sometime.

> 
> Wolfgang: How to run git-gc on this repository?
> 
> I am ok to add this to mainline. Please add that two patches together
> and resubmit.

I'll do so (three patches -- see my other comment).

> Also I would prefer to define SYS_MALLOC_LEN based on SIZE.
> It means for example
> #defineCONFIG_SYS_MALLOC_LEN (SIZE *2)
> or similar.

OK, I'll evaluate the best factor for this multiplication.


br,
Stephan




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


Re: [U-Boot] [PATCH 1/2] microblaze: avoid compile error on systems without cfi flash

2012-06-25 Thread Stephan Linz
Am Montag, den 25.06.2012, 06:55 +0200 schrieb Michal Simek: 
> On 06/21/2012 09:42 PM, Stephan Linz wrote:
> > Use XILINX_FLASH_START to set/unset FLASH and RAMENV.
> >
> > Error was:
> > board.c: In function 'board_init':
> > board.c:134: error: 'XILINX_FLASH_START' undeclared (first use in this 
> > function)
> > board.c:134: error: (Each undeclared identifier is reported only once
> > board.c:134: error: for each function it appears in.)
> >
> > Signed-off-by: Stephan Linz
> > ---
> >   include/configs/microblaze-generic.h |   14 +-
> >   1 files changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/include/configs/microblaze-generic.h 
> > b/include/configs/microblaze-generic.h
> > index 295d123..2ef7d62 100644
> > --- a/include/configs/microblaze-generic.h
> > +++ b/include/configs/microblaze-generic.h
> > @@ -31,6 +31,15 @@
> >   #define   CONFIG_MICROBLAZE   1
> >   #define   MICROBLAZE_V5   1
> >
> > +/* linear flash memory */
> > +#ifdef XILINX_FLASH_START
> > +#defineFLASH
> > +#undef RAMENV  /* hold environment in flash */
> > +#else
> > +#undef FLASH
> > +#defineRAMENV  /* hold environment in RAM */
> > +#endif
> > +
> >   /* uart */
> >   #ifdef XILINX_UARTLITE_BASEADDR
> >   # define CONFIG_XILINX_UARTLITE
> > @@ -164,9 +173,6 @@
> >   /* stack */
> >   #define   CONFIG_SYS_INIT_SP_OFFSET   CONFIG_SYS_MALLOC_BASE
> >
> > -/*#define  RAMENV */
> > -#defineFLASH
> > -
> >   #ifdef FLASH
> >   # define CONFIG_SYS_FLASH_BASEXILINX_FLASH_START
> >   # define CONFIG_SYS_FLASH_SIZEXILINX_FLASH_SIZE
> > @@ -200,8 +206,6 @@
> >   # define CONFIG_ENV_IS_NOWHERE1
> >   # define CONFIG_ENV_SIZE  0x1000
> >   # define CONFIG_ENV_ADDR  (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
> > -/* hardware flash protection */
> > -# define CONFIG_SYS_FLASH_PROTECTION
> 
> What's wrong with hardware flash protection?

Nothing, but it will defined twice. One time in line 182 and one time in
that line 204. I think the last one is wrong, because that define is
outside the Flash configuration context, or not?

Sorry, I should split the patch. Should I do this?


br,
Stephan


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


Re: [U-Boot] [PATCH 2/2] microblaze: Enable ubi support

2012-06-25 Thread Stephan Linz
Am Montag, den 25.06.2012, 09:22 +0200 schrieb Wolfgang Denk: 
> Dear Michal Simek,
> 
> In message <4fe7f154.80...@monstr.eu> you wrote:
> > On 06/21/2012 09:42 PM, Stephan Linz wrote:
> > > To save memory the UBIFS is disabled by default.
> > >
> > > The original patch was introdused with commit:
> > > 0114da7b06bd47b7f5c3f20a152dd11903b38fba
> > 
> > This say nothing to me.
> > Format is Patch name and when sha1.
> > 
> > Where is this patch? I can't see it in mainline repository?
> 
> Correct.  This commit does not exist in mainline.

Yes, the commit was newer merged into mainline and lives for more than
one year in Microblaze custodian repo:

http://git.denx.de/?p=u-boot/u-boot-microblaze.git;a=commitdiff;h=0114da7b06bd47b7f5c3f20a152dd11903b38fba


br,
Stephan




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


[U-Boot] [PATCH 1/2] microblaze: avoid compile error on systems without cfi flash

2012-06-21 Thread Stephan Linz
Use XILINX_FLASH_START to set/unset FLASH and RAMENV.

Error was:
board.c: In function 'board_init':
board.c:134: error: 'XILINX_FLASH_START' undeclared (first use in this function)
board.c:134: error: (Each undeclared identifier is reported only once
board.c:134: error: for each function it appears in.)

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   14 +-
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 295d123..2ef7d62 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -31,6 +31,15 @@
 #defineCONFIG_MICROBLAZE   1
 #defineMICROBLAZE_V5   1
 
+/* linear flash memory */
+#ifdef XILINX_FLASH_START
+#defineFLASH
+#undef RAMENV  /* hold environment in flash */
+#else
+#undef FLASH
+#defineRAMENV  /* hold environment in RAM */
+#endif
+
 /* uart */
 #ifdef XILINX_UARTLITE_BASEADDR
 # define CONFIG_XILINX_UARTLITE
@@ -164,9 +173,6 @@
 /* stack */
 #defineCONFIG_SYS_INIT_SP_OFFSET   CONFIG_SYS_MALLOC_BASE
 
-/*#define  RAMENV */
-#defineFLASH
-
 #ifdef FLASH
 # define CONFIG_SYS_FLASH_BASE XILINX_FLASH_START
 # define CONFIG_SYS_FLASH_SIZE XILINX_FLASH_SIZE
@@ -200,8 +206,6 @@
 # define CONFIG_ENV_IS_NOWHERE 1
 # define CONFIG_ENV_SIZE   0x1000
 # define CONFIG_ENV_ADDR   (CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SIZE)
-/* hardware flash protection */
-# define CONFIG_SYS_FLASH_PROTECTION
 #endif /* !FLASH */
 
 /* system ace */
-- 
1.7.0.4

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


[U-Boot] [PATCH 2/2] microblaze: Enable ubi support

2012-06-21 Thread Stephan Linz
To save memory the UBIFS is disabled by default.

The original patch was introdused with commit:
0114da7b06bd47b7f5c3f20a152dd11903b38fba

Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   23 +++
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 2ef7d62..90f97a1 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -159,14 +159,13 @@
(CONFIG_SYS_SDRAM_SIZE - GENERATED_GBL_DATA_SIZE)
 
 /* monitor code */
-#defineSIZE0x4
-#defineCONFIG_SYS_MONITOR_LEN  SIZE
+#defineCONFIG_SYS_MONITOR_LEN  0x4
 #defineCONFIG_SYS_MONITOR_BASE \
(CONFIG_SYS_SDRAM_BASE + CONFIG_SYS_GBL_DATA_OFFSET \
- CONFIG_SYS_MONITOR_LEN - GENERATED_BD_INFO_SIZE)
 #defineCONFIG_SYS_MONITOR_END \
(CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
-#defineCONFIG_SYS_MALLOC_LEN   SIZE
+#defineCONFIG_SYS_MALLOC_LEN   0x10
 #defineCONFIG_SYS_MALLOC_BASE \
(CONFIG_SYS_MONITOR_BASE - CONFIG_SYS_MALLOC_LEN)
 
@@ -273,6 +272,8 @@
 # define CONFIG_CMD_FLASH
 # define CONFIG_CMD_IMLS
 # define CONFIG_CMD_JFFS2
+# define CONFIG_CMD_UBI
+# undef CONFIG_CMD_UBIFS
 
 # if !defined(RAMENV)
 #  define CONFIG_CMD_SAVEENV
@@ -285,7 +286,21 @@
 #endif
 
 #if defined(CONFIG_CMD_JFFS2)
-/* JFFS2 partitions */
+# define CONFIG_MTD_PARTITIONS
+#endif
+
+#if defined(CONFIG_CMD_UBIFS)
+# define CONFIG_CMD_UBI
+# define CONFIG_LZO
+#endif
+
+#if defined(CONFIG_CMD_UBI)
+# define CONFIG_MTD_PARTITIONS
+# define CONFIG_RBTREE
+#endif
+
+#if defined(CONFIG_MTD_PARTITIONS)
+/* MTD partitions */
 #define CONFIG_CMD_MTDPARTS/* mtdparts command line support */
 #define CONFIG_MTD_DEVICE  /* needed for mtdparts commands */
 #define CONFIG_FLASH_CFI_MTD
-- 
1.7.0.4

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


Re: [U-Boot] undefined reference to `net_set_upd_handler'

2012-05-23 Thread Stephan Linz
Hi Joe,

thanks, now it compiles without error, tftpput works too.

br,
Stephan

Am Mittwoch, den 23.05.2012, 17:54 -0500 schrieb Joe Hershberger: 
> Hi Stephan,
> 
> On Wed, May 23, 2012 at 5:50 PM, Joe Hershberger
>  wrote:
> > Hi Stephan,
> >
> > On Wed, May 23, 2012 at 5:46 PM, Stephan Linz  wrote:
> >> Hello Joe,
> >>
> >> just I've tried out your custodian network tree at a99acb7 and run in
> >> the link error below:
> >>
> >> net/libnet.o: In function `NetLoop':
> >> net/net.c:539: undefined reference to `net_set_upd_handler'
> >>
> >> I think it is a typo in commit 6476b33, or not?
> 
> I've pushed a fixed version.
> 
> -Joe
> _______
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

-- 
Viele Grüße,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


[U-Boot] undefined reference to `net_set_upd_handler'

2012-05-23 Thread Stephan Linz
Hello Joe,

just I've tried out your custodian network tree at a99acb7 and run in
the link error below:

net/libnet.o: In function `NetLoop':
net/net.c:539: undefined reference to `net_set_upd_handler'

I think it is a typo in commit 6476b33, or not?

The patch snipped below would fix it. It works to me.



diff --git a/net/net.c b/net/net.c
index 159b91a..9de7d92 100644
--- a/net/net.c
+++ b/net/net.c
@@ -536,7 +536,7 @@ restart:
done:
#ifdef CONFIG_CMD_TFTPPUT
/* Clear out the handlers */
-   net_set_upd_handler(NULL);
+   net_set_udp_handler(NULL);
net_set_icmp_handler(NULL);
#endif
return ret;



br,
Stephan

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


[U-Boot] [PATCH] drivers/net/xilinx_ll_temac.c: Fix compile warning

2012-05-22 Thread Stephan Linz
Fix this:
xilinx_ll_temac.c: In function 'xilinx_ll_temac_initialize':
xilinx_ll_temac.c:332: warning: assignment from incompatible pointer type
xilinx_ll_temac.c:340: warning: assignment from incompatible pointer type

Signed-off-by: Stephan Linz 
---
 drivers/net/xilinx_ll_temac_fifo.c |3 +--
 drivers/net/xilinx_ll_temac_fifo.h |3 +--
 drivers/net/xilinx_ll_temac_sdma.c |3 +--
 drivers/net/xilinx_ll_temac_sdma.h |3 +--
 4 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/xilinx_ll_temac_fifo.c 
b/drivers/net/xilinx_ll_temac_fifo.c
index 3ff0f34..d7fd989 100644
--- a/drivers/net/xilinx_ll_temac_fifo.c
+++ b/drivers/net/xilinx_ll_temac_fifo.c
@@ -102,8 +102,7 @@ int ll_temac_recv_fifo(struct eth_device *dev)
return 0;
 }
 
-int ll_temac_send_fifo(struct eth_device *dev, volatile void *packet,
-   int length)
+int ll_temac_send_fifo(struct eth_device *dev, void *packet, int length)
 {
int i;
u32 *buf = (u32 *)packet;
diff --git a/drivers/net/xilinx_ll_temac_fifo.h 
b/drivers/net/xilinx_ll_temac_fifo.h
index f0d6e68..e5b4be9 100644
--- a/drivers/net/xilinx_ll_temac_fifo.h
+++ b/drivers/net/xilinx_ll_temac_fifo.h
@@ -116,7 +116,6 @@ int ll_temac_reset_fifo(struct eth_device *dev);
 int ll_temac_recv_fifo(struct eth_device *dev);
 
 /* send buffered data to FIFO */
-int ll_temac_send_fifo(struct eth_device *dev, volatile void *packet,
-   int length);
+int ll_temac_send_fifo(struct eth_device *dev, void *packet, int length);
 
 #endif /* _XILINX_LL_TEMAC_FIFO_ */
diff --git a/drivers/net/xilinx_ll_temac_sdma.c 
b/drivers/net/xilinx_ll_temac_sdma.c
index 621d100..8637a6b 100644
--- a/drivers/net/xilinx_ll_temac_sdma.c
+++ b/drivers/net/xilinx_ll_temac_sdma.c
@@ -324,8 +324,7 @@ int ll_temac_recv_sdma(struct eth_device *dev)
return 0;
 }
 
-int ll_temac_send_sdma(struct eth_device *dev, volatile void *packet,
-   int length)
+int ll_temac_send_sdma(struct eth_device *dev, void *packet, int length)
 {
unsigned timeout = 50;  /* 1usec * 50 = 50usec */
struct cdmac_bd *tx_dp = &cdmac_bd.tx[tx_idx];
diff --git a/drivers/net/xilinx_ll_temac_sdma.h 
b/drivers/net/xilinx_ll_temac_sdma.h
index 51e258d..db00a57 100644
--- a/drivers/net/xilinx_ll_temac_sdma.h
+++ b/drivers/net/xilinx_ll_temac_sdma.h
@@ -275,7 +275,6 @@ int ll_temac_reset_sdma(struct eth_device *dev);
 int ll_temac_recv_sdma(struct eth_device *dev);
 
 /* send buffered data to SDMA */
-int ll_temac_send_sdma(struct eth_device *dev, volatile void *packet,
-   int length);
+int ll_temac_send_sdma(struct eth_device *dev, void *packet, int length);
 
 #endif /* _XILINX_LL_TEMAC_SDMA_ */
-- 
1.7.0.4

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


[U-Boot] [PATCH] drivers/net/xilinx_axi_emac.c: Fix compile warning

2012-05-22 Thread Stephan Linz
Fix this:
xilinx_axi_emac.c: In function 'xilinx_axiemac_initialize':
xilinx_axi_emac.c:646: warning: assignment from incompatible pointer type

Signed-off-by: Stephan Linz 
---
 drivers/net/xilinx_axi_emac.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 82e254b..7854a04 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -468,7 +468,7 @@ static int axiemac_init(struct eth_device *dev, bd_t * bis)
return 0;
 }
 
-static int axiemac_send(struct eth_device *dev, volatile void *ptr, int len)
+static int axiemac_send(struct eth_device *dev, void *ptr, int len)
 {
struct axidma_priv *priv = dev->priv;
u32 timeout;
-- 
1.7.0.4

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


[U-Boot] [PATCH] drivers/net/xilinx_emaclite.c: Fix compile warning

2012-05-22 Thread Stephan Linz
Fix this:
xilinx_emaclite.c: In function 'xilinx_emaclite_initialize':
xilinx_emaclite.c:371: warning: assignment from incompatible pointer type

Signed-off-by: Stephan Linz 
---
 drivers/net/xilinx_emaclite.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 9791b9a..d5bd737 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -199,7 +199,7 @@ static int xemaclite_txbufferavailable(struct eth_device 
*dev)
return !(txpingbusy && txpongbusy);
 }
 
-static int emaclite_send(struct eth_device *dev, volatile void *ptr, int len)
+static int emaclite_send(struct eth_device *dev, void *ptr, int len)
 {
u32 reg;
u32 baseaddress;
@@ -240,7 +240,7 @@ static int emaclite_send(struct eth_device *dev, volatile 
void *ptr, int len)
 
debug("Send packet from 0x%x\n", baseaddress);
/* Write the frame to the buffer */
-   xemaclite_alignedwrite((void *) ptr, baseaddress, len);
+   xemaclite_alignedwrite(ptr, baseaddress, len);
out_be32 (baseaddress + XEL_TPLR_OFFSET,(len &
(XEL_TPLR_LENGTH_MASK_HI | XEL_TPLR_LENGTH_MASK_LO)));
reg = in_be32 (baseaddress + XEL_TSR_OFFSET);
@@ -261,7 +261,7 @@ static int emaclite_send(struct eth_device *dev, volatile 
void *ptr, int len)
& XEL_TSR_XMIT_ACTIVE_MASK) == 0)) {
debug("Send packet from 0x%x\n", baseaddress);
/* Write the frame to the buffer */
-   xemaclite_alignedwrite((void *) ptr, baseaddress, len);
+   xemaclite_alignedwrite(ptr, baseaddress, len);
out_be32 (baseaddress + XEL_TPLR_OFFSET, (len &
(XEL_TPLR_LENGTH_MASK_HI |
XEL_TPLR_LENGTH_MASK_LO)));
-- 
1.7.0.4

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


Re: [U-Boot] [STATUS] v2012.04-rc2 and -rc3 are out

2012-04-20 Thread Stephan Linz
Am Mittwoch, den 18.04.2012, 23:10 +0200 schrieb Wolfgang Denk: 
> Hi everybody,
> 
> sorry, I forgot to announce the 2012.04-rc2 pre-release two days ago,
> so I will atleast announce that we have
> 
>   v2012.04-rc3

fine ...

> 
> now.
> 
> Please help testing, so we can fix the remaining issues before the
> release, which I still want to push out April 21, 2012.
> 
> Thanks to all who helped.
> 
> 
> Please make sure that all your important bug fixes have been included!

I'm missing my last patch to fix a CPP issue in ll_temac network driver:
http://patchwork.ozlabs.org/patch/151672/

br,
Stephan

> 
> 
> I will also start a "next" branch now, so if you have anything
> pending there, please feel free to send pull requests for "next" !
> 
> Best regards,
> 
> Wolfgang Denk
> 



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


[U-Boot] [PATCH] net: ll_temac: drop obsolete "NAMESIZE" define

2012-04-10 Thread Stephan Linz
... after commit "net/miiphy/serial: drop duplicate NAMESIZE
define" (sha1:f6add13) was applied. The building of the new
LL TEMAC network driver fails with error below:

xilinx_ll_temac.c: In function 'xilinx_ll_temac_initialize':
xilinx_ll_temac.c:301: error: 'NAMESIZE' undeclared (first use in this function)
xilinx_ll_temac.c:301: error: (Each undeclared identifier is reported only once
xilinx_ll_temac.c:301: error: for each function it appears in.)

Signed-off-by: Stephan Linz 
---
 drivers/net/xilinx_ll_temac.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/xilinx_ll_temac.c b/drivers/net/xilinx_ll_temac.c
index 85660c0..27dafc1 100644
--- a/drivers/net/xilinx_ll_temac.c
+++ b/drivers/net/xilinx_ll_temac.c
@@ -298,9 +298,9 @@ int xilinx_ll_temac_initialize(bd_t *bis, struct 
ll_temac_info *devinf)
 
/* use given name or generate its own unique name */
if (devinf->devname) {
-   strncpy(dev->name, devinf->devname, NAMESIZE);
+   strncpy(dev->name, devinf->devname, sizeof(dev->name));
} else {
-   snprintf(dev->name, NAMESIZE, "lltemac.%lx", devinf->base_addr);
+   snprintf(dev->name, sizeof(dev->name), "lltemac.%lx", 
devinf->base_addr);
devinf->devname = dev->name;
}
 
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH 1/4] net: ll_temac: Add LL TEMAC driver to u-boot

2012-03-30 Thread Stephan Linz
Hello Joe and Michal,

Am Mittwoch, den 28.03.2012, 09:53 +0200 schrieb Michal Simek: 
> Hi Joe,
> 
> >> Stephan Linz wrote:
> >>> Xilinx LocalLink Tri-Mode Ether MAC driver can be
> >>> used by Xilinx Microblaze or Xilinx ppc405/440 in
> >>> SDMA and FIFO mode. DCR or XPS bus can be used.
> >> Joe, Wolfgang: I don't agree with this driver because it is doing the same
> >> things as my origin
> >> version but on 800 lines instead of 1860lines. The next thing is that plb
> >> bus on Xilinx fpgas
> >> is getting obsolete.
> > 
> > Are you meaning that you already have a driver in u-boot that works on
> > this hardware or do you mean the original version somewhere else, like
> > Linux?

No, there is no u-boot custodian tree with an already merged driver.

> 
> There is really long history about this u-boot driver. The origin version for 
> ppc was sent to mailing list
> April 26, 2008 by Yoshio Kashiwagi. I have tried to add it to mainline 
> several times
> and my latest attempts end with result that I didn't want to follow u-boot 
> coding style because
> of ppc/microblaze differences (not using offset with structure because of 
> ppc/microblaze differences - dcr/plb access).
> That driver has 800 lines.
> Based on this strict rule I decided not to continue to push this driver to 
> mainline
> because it is just a lot of work to change it and especially test it. My 
> origin driver is used by many our customers
> on microblaze and ppc and none reported any problem with it.
> 
> After this Stephan decided to change it to be acceptable to mainline 
> submission.

Yes, I've reworked the driver since November 2011 and now, in contrast
to the "800 lines" driver submitted by Michal, the new driver has more
features than the differnet memory access methods for ppc/microblaze:

  - eliminates all private data exchange buffer
  - supports the NetBuf handling for FIFO and DMA mode
  - supports the new MII bus framework
  - supports potentially more than just the two memory access methods
  - includes a complete register description (structs and defines)
  - split into differnet parts for better overview and readability

> 
> 
> > As for plb being near obsolescence, are you recommending a change to
> > the driver to drop support for that bus option? Or do you mean for
> > that reason the driver itself should be omitted?
> 
> should be obsolete in a year or so and if you add it to mainline it will be 
> there
> but in 2013 there will be minimal number of users for it.

No! It may be that PLB will no longer be interesting for new designs.
But there are many existing FPGA solutions which will use the latest
software releases on it.

Moreover, this also aplied to the PowerPC@FPGA world (DCR part).

> 
> >> I am not going to add it to my microblaze custodian tree.
> >> If you like this patch please add it to u-boot-net tree or directly to
> >> mainline.

I like it ;) but unfortunately I have no custodian tree :(

> > 
> > I was actually going to recommend that it go through the microblaze
> > branch if it is primarily for microblaze targets.  If you don't want
> > it, then I think Stephan needs to work to convince you by making
> > revisions.
> 
> None can convince me that 1860 code lines which fulfill all u-boot rules
> is better than origin well tested 800 code lines (and commercially used)
> which break one u-boot rule.

Why not? The currently submitted driver has changes undergone a long
review process by different submitters and maintainers of U-Boot. This
driver is ready for future use (ex. the new MII bus and PHY device
abstraction, fully qualified register description for further extensions
if needed).

> I agree with rules but none can expect that I will assist and help to add
> it to mainline. I don't want to have responsibility for that.
> 
> BTW: Target is also ppc because there is DCR support.

If the DCR support is a problem, I can split the patches and separate
the DCR support. Currently the DCR related code is about 80 LOCs and
already enclosed by CONFIG_XILINX_440 and CONFIG_XILINX_405.


br,
Stephan


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


Re: [U-Boot] [PATCH 2/4] microblaze: Enable several ethernet driver compilation

2012-02-25 Thread Stephan Linz
Note: this patch depends on commit "microblaze: Enable phylib and mii
support" (http://patchwork.ozlabs.org/patch/142957/)

br-
Stephan

Am Samstag, den 25.02.2012, 11:48 +0100 schrieb Stephan Linz: 
> U-Boot's multipple network supports enables to use
> several ethernet drivers but microblaze-generic
> platform config file select only one driver.
> 
> Reported-by: Michal Simek 
> Signed-off-by: Stephan Linz 
> ---
>  include/configs/microblaze-generic.h |   11 ++-
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/include/configs/microblaze-generic.h 
> b/include/configs/microblaze-generic.h
> index 9f66fbf..efca136 100644
> --- a/include/configs/microblaze-generic.h
> +++ b/include/configs/microblaze-generic.h
> @@ -65,11 +65,12 @@
>  
>  /* ethernet */
>  #undef CONFIG_SYS_ENET
> -#ifdef XILINX_EMACLITE_BASEADDR
> -# define CONFIG_XILINX_EMACLITE  1
> +#if defined(XILINX_EMACLITE_BASEADDR)
> +# define CONFIG_XILINX_EMACLITE  1
>  # define CONFIG_SYS_ENET
> -#elif XILINX_LLTEMAC_BASEADDR
> -# define CONFIG_XILINX_LL_TEMAC  1
> +#endif
> +#if defined(XILINX_LLTEMAC_BASEADDR)
> +# define CONFIG_XILINX_LL_TEMAC  1
>  # define CONFIG_SYS_ENET
>  #endif
>  #if defined(XILINX_AXIEMAC_BASEADDR)
> @@ -339,7 +340,7 @@
>  #define CONFIG_FIT   1
>  #define CONFIG_OF_LIBFDT 1
>  
> -#if defined(CONFIG_XILINX_AXIEMAC)
> +#if defined(CONFIG_XILINX_LL_TEMAC) || defined(CONFIG_XILINX_AXIEMAC)
>  # define CONFIG_MII  1
>  # define CONFIG_CMD_MII  1
>  # define CONFIG_PHY_GIGE 1

-- 
Viele Grüße,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


[U-Boot] [PATCH 4/4] microblaze: Wire up LL_TEMAC driver initialization

2012-02-25 Thread Stephan Linz
Initialize ll_temac driver.

Reported-by: Michal Simek 
Signed-off-by: Stephan Linz 
---
 .../xilinx/microblaze-generic/microblaze-generic.c |   36 
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c 
b/board/xilinx/microblaze-generic/microblaze-generic.c
index c4c13a6..a1e2bfe 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -90,5 +90,41 @@ int board_eth_init(bd_t *bis)
ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR,
txpp, rxpp);
 #endif
+
+#ifdef CONFIG_XILINX_LL_TEMAC
+# ifdef XILINX_LLTEMAC_BASEADDR
+#  ifdef XILINX_LLTEMAC_FIFO_BASEADDR
+   ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR,
+   XILINX_LL_TEMAC_M_FIFO, XILINX_LLTEMAC_FIFO_BASEADDR);
+#  elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR
+#   if XILINX_LLTEMAC_SDMA_USE_DCR == 1
+   ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR,
+   XILINX_LL_TEMAC_M_SDMA_DCR,
+   XILINX_LLTEMAC_SDMA_CTRL_BASEADDR);
+#   else
+   ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR,
+   XILINX_LL_TEMAC_M_SDMA_PLB,
+   XILINX_LLTEMAC_SDMA_CTRL_BASEADDR);
+#   endif
+#  endif
+# endif
+# ifdef XILINX_LLTEMAC_BASEADDR1
+#  ifdef XILINX_LLTEMAC_FIFO_BASEADDR1
+   ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR1,
+   XILINX_LL_TEMAC_M_FIFO, XILINX_LLTEMAC_FIFO_BASEADDR1);
+#  elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1
+#   if XILINX_LLTEMAC_SDMA_USE_DCR == 1
+   ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR1,
+   XILINX_LL_TEMAC_M_SDMA_DCR,
+   XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1);
+#   else
+   ret |= xilinx_ll_temac_eth_init(bis, XILINX_LLTEMAC_BASEADDR1,
+   XILINX_LL_TEMAC_M_SDMA_PLB,
+   XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1);
+#   endif
+#  endif
+# endif
+#endif
+
return ret;
 }
-- 
1.7.0.4

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


[U-Boot] [PATCH 3/4] microblaze: Add faked LL_TEMAC driver configuration

2012-02-25 Thread Stephan Linz
Expand the specific configuration for the microblaze-generic
board in xparameters.h with a faked setup to enable the
LL_TEMAC driver.

Note: From now the microblaze-generic board is no longer a
valid board configuration for a real piece of hardware. Rather
than, we use the file config.mk and xparameters.h as a faked
board configuration to force the compilation of all potential
driver code for Microblaze systems.

Signed-off-by: Stephan Linz 
---
 board/xilinx/microblaze-generic/config.mk |6 --
 board/xilinx/microblaze-generic/xparameters.h |   12 ++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/board/xilinx/microblaze-generic/config.mk 
b/board/xilinx/microblaze-generic/config.mk
index f8d7e26..9fd1015 100644
--- a/board/xilinx/microblaze-generic/config.mk
+++ b/board/xilinx/microblaze-generic/config.mk
@@ -21,8 +21,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-# CAUTION: This file is automatically generated by libgen.
-# Version: Xilinx EDK 6.3 EDK_Gmm.12.3
+# CAUTION: This file is a faked configuration !!!
+#  There is no real target for the microblaze-generic
+#  configuration. You have to replace this file with
+#  the generated file from your Xilinx design flow.
 #
 
 CONFIG_SYS_TEXT_BASE = 0x2900
diff --git a/board/xilinx/microblaze-generic/xparameters.h 
b/board/xilinx/microblaze-generic/xparameters.h
index fae03bf..50a82d9 100644
--- a/board/xilinx/microblaze-generic/xparameters.h
+++ b/board/xilinx/microblaze-generic/xparameters.h
@@ -21,8 +21,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  *
- * CAUTION: This file is automatically generated by libgen.
- * Version: Xilinx EDK 8.2.02 EDK_Im_Sp2.4
+ * CAUTION: This file is a faked configuration !!!
+ *  There is no real target for the microblaze-generic
+ *  configuration. You have to replace this file with
+ *  the generated file from your Xilinx design flow.
  */
 
 #define XILINX_BOARD_NAME  microblaze-generic
@@ -69,3 +71,9 @@
 
 /* Ethernet controller is Ethernet_MAC */
 #define XILINX_EMACLITE_BASEADDR   0x40C0
+
+/* LL_TEMAC Ethernet controller */
+#define XILINX_LLTEMAC_BASEADDR0x4400
+#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR  0x42000180
+#define XILINX_LLTEMAC_BASEADDR1   0x4420
+#define XILINX_LLTEMAC_FIFO_BASEADDR1  0x4210
-- 
1.7.0.4

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


[U-Boot] [PATCH 2/4] microblaze: Enable several ethernet driver compilation

2012-02-25 Thread Stephan Linz
U-Boot's multipple network supports enables to use
several ethernet drivers but microblaze-generic
platform config file select only one driver.

Reported-by: Michal Simek 
Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 9f66fbf..efca136 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -65,11 +65,12 @@
 
 /* ethernet */
 #undef CONFIG_SYS_ENET
-#ifdef XILINX_EMACLITE_BASEADDR
-# define CONFIG_XILINX_EMACLITE1
+#if defined(XILINX_EMACLITE_BASEADDR)
+# define CONFIG_XILINX_EMACLITE1
 # define CONFIG_SYS_ENET
-#elif XILINX_LLTEMAC_BASEADDR
-# define CONFIG_XILINX_LL_TEMAC1
+#endif
+#if defined(XILINX_LLTEMAC_BASEADDR)
+# define CONFIG_XILINX_LL_TEMAC1
 # define CONFIG_SYS_ENET
 #endif
 #if defined(XILINX_AXIEMAC_BASEADDR)
@@ -339,7 +340,7 @@
 #define CONFIG_FIT 1
 #define CONFIG_OF_LIBFDT   1
 
-#if defined(CONFIG_XILINX_AXIEMAC)
+#if defined(CONFIG_XILINX_LL_TEMAC) || defined(CONFIG_XILINX_AXIEMAC)
 # define CONFIG_MII1
 # define CONFIG_CMD_MII1
 # define CONFIG_PHY_GIGE   1
-- 
1.7.0.4

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


[U-Boot] [PATCH] microblaze: Enable phylib and mii support

2012-02-24 Thread Stephan Linz
Enable phylib and mii support for AXI EMAC
ethernet drivers on Microblaze systems.

Signed-off-by: Stephan Linz 
Reported-by: Michal Simek 
---
 include/configs/microblaze-generic.h |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 03a6f5a..b76bbcf 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -338,4 +338,25 @@
 #define CONFIG_FIT 1
 #define CONFIG_OF_LIBFDT   1
 
+#if defined(CONFIG_XILINX_AXIEMAC)
+# define CONFIG_MII1
+# define CONFIG_CMD_MII1
+# define CONFIG_PHY_GIGE   1
+# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN   1
+# define CONFIG_PHYLIB 1
+# define CONFIG_PHY_ATHEROS1
+# define CONFIG_PHY_BROADCOM   1
+# define CONFIG_PHY_DAVICOM1
+# define CONFIG_PHY_LXT1
+# define CONFIG_PHY_MARVELL1
+# define CONFIG_PHY_MICREL 1
+# define CONFIG_PHY_NATSEMI1
+# define CONFIG_PHY_REALTEK1
+# define CONFIG_PHY_VITESSE1
+#else
+# undef CONFIG_MII
+# undef CONFIG_CMD_MII
+# undef CONFIG_PHYLIB
+#endif
+
 #endif /* __CONFIG_H */
-- 
1.7.0.4

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


Re: [U-Boot] [PREVIEW] LL TEMAC v10 refactored -- for evaluation only

2012-02-23 Thread Stephan Linz
Am Donnerstag, den 23.02.2012, 13:22 +0100 schrieb Michal Simek: 
> Hi Stephan,

Hi Michal,

I will take your comments seriously and ar working on a solution without
a complex conversion matrix and a ll_temac standard initialization. Give
me some time to do so ...

Stephan

> 
> Stephan Linz wrote:
> > Hi Michal,
> > 
> > back to your requests and objections I've built up a new patch set for
> > evaluation. Some of the changes relate to the Microblaze platform rather
> > than the network driver.
> > 
> > 1) U-Boot configuration variables vs. xparameters.h
> > --
> > I've tried to find a compromise between the U-Boot coding and
> > configuration style and your preference. But at least in the point of
> > the many many CPP conditional directives I can not reduce the code. I
> > can move the code only to another place. I need a converstion from the
> > automaticaly generated content of xparameters.h to the U-Boot
> > configuration space. Now you can find this conversion matrix in a new
> > platform header, xconversions.h -- I've placed the header in
> > board/xilinx/microblaze-generic/ I think, we can find a better place.
> 
> Sorry I don't like that idea in general. I think that make no sense to
> create infrastructure for several ll_temac driver in bootloader.
> 
> The same code in different location is the same solution which I won't like.
> 
> > 
> > The conversion matrix avoids all the wrong configuration variables
> > inside U-Boot code beginning with XILINX_ (and not CONFIG_) and we can
> > expand the configuration to new software related options we never get
> > from hardware (example special interface naming). This mechanism can
> > also be used by other driver and platform code, for example
> > arch/microblaze/cpu/cache.c and arch/microblaze/lib/bootm.c (use
> > XILINX_USE_DCACHE instead of ex. CONFIG_XILINX_DCACHE),
> > common/cmd_mfsl.c (use XILINX_FSL_NUMBER instead of ex.
> > CONFIG_XILINX_FSL), serial_xuartlite.c (use XILINX_UARTLITE_BASEADDR,
> > XILINX_UARTLITE_BASEADDR1, ...), and probably also in xilinx_emaclite.c
> > and xilinx_axi_emac.c when we extand a multi-IP support as we have done
> > for the LL TEMAC now. Sure we have to work on, but it's another case (I
> > can make some patches if you want)
> 
> I agree that we should use the same variable name if has to start with CONFIG_
> prefix.
> Based on my experience make more sense to move all functionality and 
> configuration
> thing to BSP and keep them out of mainline code because none cares in 
> community
> that we can change almost everything.
> That's why u-boot uses xparamters.h, linux dts and 5 kernel parameters.
> 
> Creating any conversions out of BSPs is just wrong way and I won't agree with 
> that.
> If you want to talk about renaming some variables I am ok to do so and I can 
> also
> change my bsp to cover backward compatibility.
> 
> Pretty soon the same situation will be with u-boot for Xilinx Zynq arm 
> platform
> where we will have to use the same style to be acceptable.
> 
> > Another but not currently existing feasibility would be to generate a
> > U-Boot conform xparameters.h, for example
> > CONFIG_XILINX_LL_TEMAC0_BASE_ADDR instead of XILINX_LLTEMAC_BASEADDR.
> > You and I, we have it in hand. We can change the Xilinx BSP in the near
> > future. You in PataLinux and I in my own home-brewed BSP generator TPOS.
> 
> As I wrote above. Suggest what we should change and we can do that.
> 
> > 
> > 2) Standard initialization vs. multiple direct calls from platform
> > --
> > Returning to the topic "standard" initialization. The last patch will
> > show the differences bwetween your prefered way to do all in board init
> > and my applicable standard initializition (a single call to the driver).
> > Please look at it in the code and decide for yourself.
> 
> IRC. I describe you how I would like to see that configuration. It should be
> the same as I use for axiemac and emaclite.
> 
> > 
> > We need a forward-looking decision, what kind of initialization, we want
> > to use. Do we want to copy and paste the standard initialization steps
> > from ip core to ip core (board init) and from platform to platform
> > (Microplace, PPC405, PPC440) or make a simple call to the driver?
> > 
> > My preferences is to call the driver from platform and let him run all
> > the necessary steps, that I do not want knowing on platform side.
> 
> You

Re: [U-Boot] [PATCH 8/8] microblaze: ll_temac: export xilinx_ll_temac_eth_init() for evaluation

2012-02-23 Thread Stephan Linz
Am Donnerstag, den 23.02.2012, 12:56 +0100 schrieb Michal Simek: 
> Stephan Linz wrote:
> > Signed-off-by: Stephan Linz 
> > ---
> >  .../xilinx/microblaze-generic/microblaze-generic.c |   57 
> > 
> >  drivers/net/xilinx_ll_temac.c  |2 +-
> >  include/xilinx_ll_temac.h  |3 +
> >  3 files changed, 61 insertions(+), 1 deletions(-)
> > 
> > diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c 
> > b/board/xilinx/microblaze-generic/microblaze-generic.c
> > index 517b2f1..d2f56b9 100644
> > --- a/board/xilinx/microblaze-generic/microblaze-generic.c
> > +++ b/board/xilinx/microblaze-generic/microblaze-generic.c
> > @@ -31,6 +31,10 @@
> >  #include 
> >  #include 
> >  
> > +#ifdef CONFIG_XILINX_LL_TEMAC
> > +#include 
> > +#endif
> > +
> >  int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> >  {
> >  #ifdef CONFIG_SYS_GPIO_0
> > @@ -92,7 +96,60 @@ int board_eth_init(bd_t *bis)
> >  #endif
> >  
> >  #ifdef CONFIG_XILINX_LL_TEMAC
> > +#if 1
> > +   /* This should be the preferred way to initialize
> > +* all the interfaces. */
> > ret |= xilinx_ll_temac_standard_init(bis);
> 
> if 1 is not the best for mainline because it means that below is dead code.

:) right -- This snippet was only intended for illustration of the
differences


Stephan 



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


[U-Boot] [PATCH] microblaze: fix build failure due to undefined reference to `get_ticks'

2012-02-22 Thread Stephan Linz
after commit "common: add possibility for readline_into_buffer
timeout" (sha1:9c34831) was applied. The Microblaze generic build
fails with error below:

common/libcommon.o: In function `cread_line':
/devel/u-boot/common/main.c:717: undefined reference to `get_ticks'
/devel/u-boot/common/main.c:717: undefined reference to `get_tbclk'
/devel/u-boot/common/main.c:720: undefined reference to `get_ticks'

Signed-off-by: Stephan Linz 
Acked-by: Michal Simek 
---
 arch/microblaze/cpu/timer.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
index a167755..1952804 100644
--- a/arch/microblaze/cpu/timer.c
+++ b/arch/microblaze/cpu/timer.c
@@ -62,3 +62,21 @@ int timer_init (void)
 }
 #endif
 #endif
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On Microblaze it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+   return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On Microblaze it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+   return CONFIG_SYS_HZ;
+}
-- 
1.7.0.4

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


[U-Boot] state of LL TEMAC evaluation

2012-02-22 Thread Stephan Linz
Hi Michal,

have you ever found time to evaluate the V10 patch set of the refactored
LL TEMAC driver ?

http://lists.denx.de/pipermail/u-boot/2012-January/116807.html

I would like to resubmit the patch set with some corrections:

include/configs/microblaze-generic.h: use XILINX_LLTEMAC_BASEADDR only
for the if-condition of CONFIG_XILINX_LL_TEMAC -- at least we have
defined the first BASEADDR at every time

drivers/net/xilinx_ll_temac.c
board/xilinx/microblaze-generic/xparameters.h
board/xilinx/microblaze-generic/xconversions.h: support only two TEMAC
instances in xilinx_ll_temac_standard_init() -- we can easily expand in
the future


-- 
Best regards,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


[U-Boot] [PATCH] microblaze: fix build failure due to undefined reference to `get_ticks'

2012-02-22 Thread Stephan Linz
after commit 9c34831 was applied. The Microblaze generic build
fails with error below:

common/libcommon.o: In function `cread_line':
/devel/u-boot/common/main.c:717: undefined reference to `get_ticks'
/devel/u-boot/common/main.c:717: undefined reference to `get_tbclk'
/devel/u-boot/common/main.c:720: undefined reference to `get_ticks'

Signed-off-by: Stephan Linz 
Acked-by: Michal Simek 
---
 arch/microblaze/cpu/timer.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
index a167755..1952804 100644
--- a/arch/microblaze/cpu/timer.c
+++ b/arch/microblaze/cpu/timer.c
@@ -62,3 +62,21 @@ int timer_init (void)
 }
 #endif
 #endif
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On Microblaze it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+   return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On Microblaze it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+   return CONFIG_SYS_HZ;
+}
-- 
1.7.0.4

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


[U-Boot] [PATCH] microblaze: avoid interrupt race conditions

2012-02-22 Thread Stephan Linz
The interrupt acknowledge action have to run after the
registered interrupt handler. So we have a chance to
bear out the corresponding interrupt request in the
corresponding controller hardware.

With this reordering, we optain a proper interrupt
handling for level triggered interrupt sources -- for
example the new axi_timer v1.02.a introduced in ISE 13.2.

Signed-off-by: Stephan Linz 
Acked-by: Michal Simek 
---
 arch/microblaze/cpu/interrupts.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index 5a13211..e7ca859 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -155,8 +155,6 @@ void interrupt_handler (void)
 #endif
struct irq_action *act = vecs + irqs;
 
-   intc->iar = mask << irqs;
-
 #ifdef DEBUG_INT
printf
("Jumping to interrupt handler rutine addr %x,count %x,arg %x\n",
@@ -165,6 +163,8 @@ void interrupt_handler (void)
act->handler (act->arg);
act->count++;
 
+   intc->iar = mask << irqs;
+
 #ifdef DEBUG_INT
printf ("Dump INTC reg, isr %x, ier %x, iar %x, mer %x\n", intc->isr,
intc->ier, intc->iar, intc->mer);
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH] microblaze: fix build failure due to undefined reference to `get_ticks'

2012-02-22 Thread Stephan Linz
Am Mittwoch, den 22.02.2012, 10:52 +0100 schrieb Michal Simek: 
> Stephan Linz wrote:
> > after http://patchwork.ozlabs.org/patch/136415/ was applied.
> > The Microblaze generic build fails with below error
> 
> Please sure patch subject + sha1 sum instead of link to system
> which doesn't need to work in future. Git reference will work.

OK, I'll resend the patch. Can I already add your ACK ?


-- 
Best regards,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


[U-Boot] [PATCH] microblaze: fix build failure due to undefined reference to `get_ticks'

2012-02-18 Thread Stephan Linz
after http://patchwork.ozlabs.org/patch/136415/ was applied.
The Microblaze generic build fails with below error

common/libcommon.o: In function `cread_line':
/devel/u-boot/common/main.c:717: undefined reference to `get_ticks'
/devel/u-boot/common/main.c:717: undefined reference to `get_tbclk'
/devel/u-boot/common/main.c:720: undefined reference to `get_ticks'

Signed-off-by: Stephan Linz 
---
 arch/microblaze/cpu/timer.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
index a167755..1952804 100644
--- a/arch/microblaze/cpu/timer.c
+++ b/arch/microblaze/cpu/timer.c
@@ -62,3 +62,21 @@ int timer_init (void)
 }
 #endif
 #endif
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On Microblaze it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+   return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On Microblaze it returns the number of timer ticks per second.
+ */
+ulong get_tbclk(void)
+{
+   return CONFIG_SYS_HZ;
+}
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH] microblaze: fix build failure due to undefined reference to `get_ticks'

2012-02-18 Thread Stephan Linz

Oops, I've given a wrong sender. Please drop the patch. I'll resend ...

br,
Stephan

Am Samstag, den 18.02.2012, 11:41 +0100 schrieb y: 
> From: Stephan Linz 
> 
> after http://patchwork.ozlabs.org/patch/136415/ was applied.
> The Microblaze generic build fails with below error
> 
> common/libcommon.o: In function `cread_line':
> /devel/u-boot/common/main.c:717: undefined reference to `get_ticks'
> /devel/u-boot/common/main.c:717: undefined reference to `get_tbclk'
> /devel/u-boot/common/main.c:720: undefined reference to `get_ticks'
> 
> Signed-off-by: Stephan Linz 
> ---
>  arch/microblaze/cpu/timer.c |   18 ++
>  1 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
> index a167755..1952804 100644
> --- a/arch/microblaze/cpu/timer.c
> +++ b/arch/microblaze/cpu/timer.c
> @@ -62,3 +62,21 @@ int timer_init (void)
>  }
>  #endif
>  #endif
> +
> +/*
> + * This function is derived from PowerPC code (read timebase as long long).
> + * On Microblaze it just returns the timer value.
> + */
> +unsigned long long get_ticks(void)
> +{
> + return get_timer(0);
> +}
> +
> +/*
> + * This function is derived from PowerPC code (timebase clock frequency).
> + * On Microblaze it returns the number of timer ticks per second.
> + */
> +ulong get_tbclk(void)
> +{
> + return CONFIG_SYS_HZ;
> +}

-- 
Viele Grüße,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


[U-Boot] [PATCH] microblaze: avoid interrupt race conditions

2012-02-17 Thread Stephan Linz
The interrupt acknowledge action have to run after the
registered interrupt handler. So we have a chance to
bear out the corresponding interrupt request in the
corresponding controller hardware.

With this reorderng, we optain a proper interrupt
handling for level triggerd interrupt sources -- for
example the new axi_timer v1.02.a introduced in ISE 13.2

Signed-off-by: Stephan Linz 
---
 arch/microblaze/cpu/interrupts.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index 5a13211..e7ca859 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -155,8 +155,6 @@ void interrupt_handler (void)
 #endif
struct irq_action *act = vecs + irqs;
 
-   intc->iar = mask << irqs;
-
 #ifdef DEBUG_INT
printf
("Jumping to interrupt handler rutine addr %x,count %x,arg %x\n",
@@ -165,6 +163,8 @@ void interrupt_handler (void)
act->handler (act->arg);
act->count++;
 
+   intc->iar = mask << irqs;
+
 #ifdef DEBUG_INT
printf ("Dump INTC reg, isr %x, ier %x, iar %x, mer %x\n", intc->isr,
intc->ier, intc->iar, intc->mer);
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH 1/3 v2] common: add possibility for readline_into_buffer timeout

2012-02-17 Thread Stephan Linz
Hello Heiko,

it seems there is a problem with this patch for some architectures. On
Microblaze I run into linker errors:

common/libcommon.o: In function `cread_line':
u-boot-bref/common/main.c:717: undefined reference to `get_ticks'
u-boot-mbref/common/main.c:717: undefined reference to `get_tbclk'
u-boot-mbref/common/main.c:720: undefined reference to `get_ticks'

AFAICS some architectures lacking these symbols. What is the default
U-Boot design line here. Should we implement the missing symbols for
Microblaze or can you introduce a CONFIG_ option to disable this new
feature?

br,
Stephan

Am Dienstag, den 17.01.2012, 08:13 +0100 schrieb Heiko Schocher: 
> add possibility to add a timeout when reading a line
> into a buffer.
> 
> Signed-off-by: Heiko Schocher 
> Cc: Mike Frysinger 
> 
> ---
> - changes for v2:
>   - add comments from Mike Frysinger :
> - remove useless inner parens
> - rework timeout handling in readline_into_buffer():
>   use endtick(), drop CONIG_SYS_HZ usage
> 
>  common/cmd_nvedit.c |2 +-
>  common/main.c   |   20 
>  common/menu.c   |3 ++-
>  include/common.h|3 ++-
>  4 files changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
> index 63afc82..20080dc 100644
> --- a/common/cmd_nvedit.c
> +++ b/common/cmd_nvedit.c
> @@ -502,7 +502,7 @@ int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc, 
> char * const argv[])
>   else
>   buffer[0] = '\0';
>  
> - readline_into_buffer("edit: ", buffer);
> + readline_into_buffer("edit: ", buffer, 0);
>  
>   return setenv(argv[1], buffer);
>  }
> diff --git a/common/main.c b/common/main.c
> index e96c95a..248744b 100644
> --- a/common/main.c
> +++ b/common/main.c
> @@ -685,7 +685,8 @@ static void cread_add_str(char *str, int strsize, int 
> insert, unsigned long *num
>   }
>  }
>  
> -static int cread_line(const char *const prompt, char *buf, unsigned int *len)
> +static int cread_line(const char *const prompt, char *buf, unsigned int *len,
> + int timeout)
>  {
>   unsigned long num = 0;
>   unsigned long eol_num = 0;
> @@ -695,6 +696,7 @@ static int cread_line(const char *const prompt, char 
> *buf, unsigned int *len)
>   int esc_len = 0;
>   char esc_save[8];
>   int init_len = strlen(buf);
> + int first = 1;
>  
>   if (init_len)
>   cread_add_str(buf, init_len, 1, &num, &eol_num, buf, *len);
> @@ -707,6 +709,16 @@ static int cread_line(const char *const prompt, char 
> *buf, unsigned int *len)
>   WATCHDOG_RESET();
>   }
>  #endif
> + if (first && timeout) {
> + uint64_t etime = endtick(timeout);
> +
> + while (!tstc()) {   /* while no incoming data */
> + if (get_ticks() >= etime)
> + return -2;  /* timed out */
> + WATCHDOG_RESET();
> + }
> + first = 0;
> + }
>  
>   ichar = getcmd_getch();
>  
> @@ -922,11 +934,11 @@ int readline (const char *const prompt)
>*/
>   console_buffer[0] = '\0';
>  
> - return readline_into_buffer(prompt, console_buffer);
> + return readline_into_buffer(prompt, console_buffer, 0);
>  }
>  
> 
> -int readline_into_buffer (const char *const prompt, char * buffer)
> +int readline_into_buffer(const char *const prompt, char *buffer, int timeout)
>  {
>   char *p = buffer;
>  #ifdef CONFIG_CMDLINE_EDITING
> @@ -949,7 +961,7 @@ int readline_into_buffer (const char *const prompt, char 
> * buffer)
>   if (prompt)
>   puts (prompt);
>  
> - rc = cread_line(prompt, p, &len);
> + rc = cread_line(prompt, p, &len, timeout);
>   return rc < 0 ? rc : len;
>  
>   } else {
> diff --git a/common/menu.c b/common/menu.c
> index 5e0817c..3b1e0d0 100644
> --- a/common/menu.c
> +++ b/common/menu.c
> @@ -222,7 +222,8 @@ static inline int menu_interactive_choice(struct menu *m, 
> void **choice)
>  
>   menu_display(m);
>  
> - readret = readline_into_buffer("Enter choice: ", cbuf);
> + readret = readline_into_buffer("Enter choice: ", cbuf,
> + m->timeout);
>  
>   if (readret >= 0) {
>   choice_item = menu_item_by_key(m, cbuf);
> diff --git a/include/common.h b/include/common.h
> index 3df1def..7a9b3a2 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -265,7 +265,8 @@ int   run_command (const char *cmd, int flag);
>  int run_command2(const char *cmd, int flag);
>  #endif
>  int  readline(const char *const prompt);
> -int  readline_into_buffer(const char *const prompt, char * buffer);
> +int  readline_into_buffer(const char *const prompt, char *buffer,
> + int timeou

Re: [U-Boot] [PATCH 6/8] microblaze: Add faked LL_TEMAC driver configuration

2012-01-31 Thread Stephan Linz
Am Dienstag, den 31.01.2012, 10:01 +0100 schrieb Michal Simek: 
> Stephan Linz wrote:
> > Expand the specific configuration for the microblaze-generic
> > board in xparameters.h with a faked setup to enable the
> > LL_TEMAC driver.
> > 
> > Note: From now the microblaze-generic board is no longer a
> > valid board configuration for a real piece of hardware. Rather
> > than, we use the file config.mk and xparameters.h as a faked
> > board configuration to force the compilation of all potential
> > driver code for Microblaze systems.
> > 
> > Signed-off-by: Stephan Linz 
> > ---
> >  board/xilinx/microblaze-generic/config.mk |6 --
> >  board/xilinx/microblaze-generic/xparameters.h |   24 
> > ++--
> >  2 files changed, 26 insertions(+), 4 deletions(-)
> > 
> > diff --git a/board/xilinx/microblaze-generic/config.mk 
> > b/board/xilinx/microblaze-generic/config.mk
> > index f8d7e26..9fd1015 100644
> > --- a/board/xilinx/microblaze-generic/config.mk
> > +++ b/board/xilinx/microblaze-generic/config.mk
> > @@ -21,8 +21,10 @@
> >  # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> >  # MA 02111-1307 USA
> >  #
> > -# CAUTION: This file is automatically generated by libgen.
> > -# Version: Xilinx EDK 6.3 EDK_Gmm.12.3
> > +# CAUTION: This file is a faked configuration !!!
> > +#  There is no real target for the microblaze-generic
> > +#  configuration. You have to replace this file with
> > +#  the generated file from your Xilinx design flow.
> >  #
> >  
> >  CONFIG_SYS_TEXT_BASE = 0x2900
> > diff --git a/board/xilinx/microblaze-generic/xparameters.h 
> > b/board/xilinx/microblaze-generic/xparameters.h
> > index fae03bf..69758c3 100644
> > --- a/board/xilinx/microblaze-generic/xparameters.h
> > +++ b/board/xilinx/microblaze-generic/xparameters.h
> > @@ -21,8 +21,10 @@
> >   * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> >   * MA 02111-1307 USA
> >   *
> > - * CAUTION: This file is automatically generated by libgen.
> > - * Version: Xilinx EDK 8.2.02 EDK_Im_Sp2.4
> > + * CAUTION: This file is a faked configuration !!!
> > + *  There is no real target for the microblaze-generic
> > + *  configuration. You have to replace this file with
> > + *  the generated file from your Xilinx design flow.
> >   */
> >  
> >  #define XILINX_BOARD_NAME  microblaze-generic
> > @@ -69,3 +71,21 @@
> >  
> >  /* Ethernet controller is Ethernet_MAC */
> >  #define XILINX_EMACLITE_BASEADDR   0x40C0
> > +
> > +/* Ethernet controller is Ethernet_MAC */
> > +#define XILINX_LLTEMAC_BASEADDR0x4400
> > +#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR  0x42000180
> > +#define XILINX_LLTEMAC_BASEADDR1   0x4440
> > +#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1 0x42000200
> 
> > +#define XILINX_LLTEMAC_BASEADDR2   0x4410
> > +#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR2 0x42000280
> > +#define XILINX_LLTEMAC_BASEADDR3   0x44100040
> > +#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR3 0x42000300
> 
> Do these two options test anything?

This is a faked configuration to evaluate the preprocessor stage in
xconversions.h and the ll_temac driver setup in
xilinx_ll_temac_standard_init().

I do not known any FPGA design / board on which I could test it in real
live. But I've run a simple test with BASEADDR1 set to same value of
BASEADDR. So I could test faked memory access to a single TEMAC in
hardware by two driver instance in software -- it works.

> 
> > +#define XILINX_LLTEMAC_BASEADDR4   0x4420
> > +#define XILINX_LLTEMAC_FIFO_BASEADDR4  0x4210
> > +#define XILINX_LLTEMAC_BASEADDR5   0x44200040
> > +#define XILINX_LLTEMAC_FIFO_BASEADDR5  0x4211
> 
> > +#define XILINX_LLTEMAC_BASEADDR6   0x4430
> > +#define XILINX_LLTEMAC_FIFO_BASEADDR6  0x4212
> > +#define XILINX_LLTEMAC_BASEADDR7   0x44300040
> > +#define XILINX_LLTEMAC_FIFO_BASEADDR7  0x4213
> 
> The same here.

The ll_temac driver supports up to eight TEMAC entities in hardware.
That's why I've expand the faked Xilinx parameter list to eight.


br
Stephan

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


Re: [U-Boot] [PATCH 2/8] microblaze: Enable several ethernet driver compilation

2012-01-31 Thread Stephan Linz
Am Dienstag, den 31.01.2012, 10:00 +0100 schrieb Michal Simek: 
> Stephan Linz wrote:
> > U-Boot's multipple network supports enables to use
> > several ethernet drivers but microblaze-generic
> > platform config file select only one driver.
> > 
> > Reported-by: Michal Simek 
> > Signed-off-by: Stephan Linz 
> > ---
> >  include/configs/microblaze-generic.h |   12 
> >  1 files changed, 8 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/configs/microblaze-generic.h 
> > b/include/configs/microblaze-generic.h
> > index 03a6f5a..09ac870 100644
> > --- a/include/configs/microblaze-generic.h
> > +++ b/include/configs/microblaze-generic.h
> > @@ -65,11 +65,15 @@
> >  
> >  /* ethernet */
> >  #undef CONFIG_SYS_ENET
> > -#ifdef XILINX_EMACLITE_BASEADDR
> > -# define CONFIG_XILINX_EMACLITE1
> > +#if defined(XILINX_EMACLITE_BASEADDR)
> > +# define CONFIG_XILINX_EMACLITE1
> >  # define CONFIG_SYS_ENET
> > -#elif XILINX_LLTEMAC_BASEADDR
> > -# define CONFIG_XILINX_LL_TEMAC1
> > +#endif
> > +#if defined(XILINX_LLTEMAC_BASEADDR)  || defined(XILINX_LLTEMAC_BASEADDR1) 
> > || \
> > +defined(XILINX_LLTEMAC_BASEADDR2) || defined(XILINX_LLTEMAC_BASEADDR3) 
> > || \
> > +defined(XILINX_LLTEMAC_BASEADDR4) || defined(XILINX_LLTEMAC_BASEADDR5) 
> > || \
> > +defined(XILINX_LLTEMAC_BASEADDR6) || defined(XILINX_LLTEMAC_BASEADDR7)
> > +# define CONFIG_XILINX_LL_TEMAC1
> 
> Why to do it in this way? I believe that the first lltemac driver will have 
> XILINX_LLTEMAC_BASEADDR
> and then others.

Right, but we need a definitive agreement that it is so (Xilinx BSP
generator). Did we them? If yes I will drop this part and insert your
original condition (test only XILINX_LLTEMAC_BASEADDR).

> But for all configurations if there is lltemac driver then will have anyone 
> just BASEADDR.
yep


br,
Stephan

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


[U-Boot] [PATCH 3/8] microblaze: Enable phylib and mii support

2012-01-29 Thread Stephan Linz
From: Michal Simek 

Enable phylib and mii support for LLTEMAC or AXI EMAC
ethernet drivers on Microblaze systems.

Signed-off-by: Michal Simek 
Acked-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 09ac870..69fcdb6 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -342,4 +342,25 @@
 #define CONFIG_FIT 1
 #define CONFIG_OF_LIBFDT   1
 
+#if defined(CONFIG_XILINX_LL_TEMAC) || defined(CONFIG_XILINX_AXIEMAC)
+# define CONFIG_MII1
+# define CONFIG_CMD_MII1
+# define CONFIG_PHY_GIGE   1
+# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN   1
+# define CONFIG_PHYLIB 1
+# define CONFIG_PHY_ATHEROS1
+# define CONFIG_PHY_BROADCOM   1
+# define CONFIG_PHY_DAVICOM1
+# define CONFIG_PHY_LXT1
+# define CONFIG_PHY_MARVELL1
+# define CONFIG_PHY_MICREL 1
+# define CONFIG_PHY_NATSEMI1
+# define CONFIG_PHY_REALTEK1
+# define CONFIG_PHY_VITESSE1
+#else
+# undef CONFIG_MII
+# undef CONFIG_CMD_MII
+# undef CONFIG_PHYLIB
+#endif
+
 #endif /* __CONFIG_H */
-- 
1.7.0.4

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


[U-Boot] [PATCH 4/8] microblaze: Enable TFTP put command

2012-01-29 Thread Stephan Linz
Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 69fcdb6..71d4767 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -259,6 +259,7 @@
 #else
 # define CONFIG_CMD_PING
 # define CONFIG_CMD_DHCP
+# define CONFIG_CMD_TFTPPUT
 #endif
 
 #if defined(CONFIG_SYSTEMACE)
-- 
1.7.0.4

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


[U-Boot] [PATCH 5/8] microblaze: Xilinx BSP to U-Boot conversion matrix

2012-01-29 Thread Stephan Linz
This matrix converts values from the automaticaly generated header
xparameters.h to U-Boot configuration values as needed.

Signed-off-by: Stephan Linz 
---
 board/xilinx/microblaze-generic/xconversions.h |  167 
 include/configs/microblaze-generic.h   |1 +
 2 files changed, 168 insertions(+), 0 deletions(-)
 create mode 100644 board/xilinx/microblaze-generic/xconversions.h

diff --git a/board/xilinx/microblaze-generic/xconversions.h 
b/board/xilinx/microblaze-generic/xconversions.h
new file mode 100644
index 000..1b94afc
--- /dev/null
+++ b/board/xilinx/microblaze-generic/xconversions.h
@@ -0,0 +1,167 @@
+/*
+ * This is the Xilinx BSP to U-Boot converstion matrix. You have
+ * to include this header immediately after xparameters.h in your
+ * board configuration header. All U-Boot configuration values
+ * have to become constant to avoid unexpected compilation failure.
+ *
+ * (C) Copyright 2012 Li-Pro.Net
+ * Stephan Linz 
+ *
+ * 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
+ */
+
+#if (XILINX_LLTEMAC_SDMA_USE_DCR == 1)
+# define XILINX_LLTEMAC_SDMA_BUSMODE   LL_TEMAC_M_SDMA_DCR
+#else
+# define XILINX_LLTEMAC_SDMA_BUSMODE   LL_TEMAC_M_SDMA_PLB
+#endif
+
+/* default parameters for the 1st LLTEMAC */
+#if defined(XILINX_LLTEMAC_BASEADDR)
+# define CONFIG_PHY_ADDR   -1
+# define CONFIG_XILINX_LL_TEMAC0_NAME  NULL
+# define CONFIG_XILINX_LL_TEMAC0_MII_NAME  NULL
+# define CONFIG_XILINX_LL_TEMAC0_BASE_ADDR XILINX_LLTEMAC_BASEADDR
+# if defined(XILINX_LLTEMAC_FIFO_BASEADDR)
+#  define CONFIG_XILINX_LL_TEMAC0_CTRL_ADDRXILINX_LLTEMAC_FIFO_BASEADDR
+#  define CONFIG_XILINX_LL_TEMAC0_CTRL_MODELL_TEMAC_M_FIFO
+# elif defined(XILINX_LLTEMAC_SDMA_CTRL_BASEADDR)
+#  define CONFIG_XILINX_LL_TEMAC0_CTRL_ADDR
XILINX_LLTEMAC_SDMA_CTRL_BASEADDR
+#  define CONFIG_XILINX_LL_TEMAC0_CTRL_MODEXILINX_LLTEMAC_SDMA_BUSMODE
+# else
+#  error "missing sub-controller base address for LLTEMAC0"
+# endif
+#endif
+
+/* default parameters for the 2nd LLTEMAC */
+#if defined(XILINX_LLTEMAC_BASEADDR1)
+# define CONFIG_PHY1_ADDR  -1
+# define CONFIG_XILINX_LL_TEMAC1_NAME  NULL
+# define CONFIG_XILINX_LL_TEMAC1_MII_NAME  NULL
+# define CONFIG_XILINX_LL_TEMAC1_BASE_ADDR XILINX_LLTEMAC_BASEADDR1
+# if defined(XILINX_LLTEMAC_FIFO_BASEADDR1)
+#  define CONFIG_XILINX_LL_TEMAC1_CTRL_ADDRXILINX_LLTEMAC_FIFO_BASEADDR1
+#  define CONFIG_XILINX_LL_TEMAC1_CTRL_MODELL_TEMAC_M_FIFO
+# elif defined(XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1)
+#  define CONFIG_XILINX_LL_TEMAC1_CTRL_ADDR
XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1
+#  define CONFIG_XILINX_LL_TEMAC1_CTRL_MODEXILINX_LLTEMAC_SDMA_BUSMODE
+# else
+#  error "missing sub-controller base address for LLTEMAC1"
+# endif
+#endif
+
+/* default parameters for the 3rd LLTEMAC */
+#if defined(XILINX_LLTEMAC_BASEADDR2)
+# define CONFIG_PHY2_ADDR  -1
+# define CONFIG_XILINX_LL_TEMAC2_NAME  NULL
+# define CONFIG_XILINX_LL_TEMAC2_MII_NAME  NULL
+# define CONFIG_XILINX_LL_TEMAC2_BASE_ADDR XILINX_LLTEMAC_BASEADDR2
+# if defined(XILINX_LLTEMAC_FIFO_BASEADDR2)
+#  define CONFIG_XILINX_LL_TEMAC2_CTRL_ADDRXILINX_LLTEMAC_FIFO_BASEADDR2
+#  define CONFIG_XILINX_LL_TEMAC2_CTRL_MODELL_TEMAC_M_FIFO
+# elif defined(XILINX_LLTEMAC_SDMA_CTRL_BASEADDR2)
+#  define CONFIG_XILINX_LL_TEMAC2_CTRL_ADDR
XILINX_LLTEMAC_SDMA_CTRL_BASEADDR2
+#  define CONFIG_XILINX_LL_TEMAC2_CTRL_MODEXILINX_LLTEMAC_SDMA_BUSMODE
+# else
+#  error "missing sub-controller base address for LLTEMAC2"
+# endif
+#endif
+
+/* default parameters for the 4th LLTEMAC */
+#if defined(XILINX_LLTEMAC_BASEADDR3)
+# define CONFIG_PHY3_ADDR  -1
+# define CONFIG_XILINX_LL_TEMAC3_NAME  NULL
+# define CONFIG_XILINX_LL_TEMAC3_MII_NAME  NULL
+# define CONFIG_XILINX_LL_TEMAC3_BASE_ADDR XILINX_LLTEMAC_BASEADDR3
+# if defined(XILINX_LLTEMAC_FIFO_BASEADDR3)
+#  define CONFIG_XILINX_LL_TEMAC3_CTRL_ADDRXILINX_LLTEMAC_FIFO_BASEADDR3
+#  define CONFIG_XILINX_LL_TEMAC3_CTRL_MODELL_TEMAC_M_FIFO
+# elif defined(XILINX_LLTEMAC_SDMA_CTRL_BASEADDR3)
+#  define CONFIG_XILINX_LL_TEMAC3_CTRL_ADDR
XILINX_LLTEMAC_SDMA_CTRL_BASEADDR3
+#  define CON

[U-Boot] [PATCH 8/8] microblaze: ll_temac: export xilinx_ll_temac_eth_init() for evaluation

2012-01-29 Thread Stephan Linz
Signed-off-by: Stephan Linz 
---
 .../xilinx/microblaze-generic/microblaze-generic.c |   57 
 drivers/net/xilinx_ll_temac.c  |2 +-
 include/xilinx_ll_temac.h  |3 +
 3 files changed, 61 insertions(+), 1 deletions(-)

diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c 
b/board/xilinx/microblaze-generic/microblaze-generic.c
index 517b2f1..d2f56b9 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -31,6 +31,10 @@
 #include 
 #include 
 
+#ifdef CONFIG_XILINX_LL_TEMAC
+#include 
+#endif
+
 int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 #ifdef CONFIG_SYS_GPIO_0
@@ -92,7 +96,60 @@ int board_eth_init(bd_t *bis)
 #endif
 
 #ifdef CONFIG_XILINX_LL_TEMAC
+#if 1
+   /* This should be the preferred way to initialize
+* all the interfaces. */
ret |= xilinx_ll_temac_standard_init(bis);
+#else
+   /
+* NOTE: This part is for evaluation and will help achieve
+*   the right way to initialize all LL TEMAC ethernet
+*   interfaces. There can be more than this two i/f!
+/
+   struct ll_temac_info devinf;
+
+# ifdef XILINX_LLTEMAC_BASEADDR
+   memset(&devinf, 0, sizeof(devinf));
+   devinf.phyaddr = -1;
+   devinf.base_addr = XILINX_LLTEMAC_BASEADDR;
+#  ifdef XILINX_LLTEMAC_FIFO_BASEADDR
+   devinf.flags = LL_TEMAC_M_FIFO;
+   devinf.ctrl_addr = XILINX_LLTEMAC_FIFO_BASEADDR;
+   ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#  elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR
+#   if XILINX_LLTEMAC_SDMA_USE_DCR == 1
+   devinf.flags = LL_TEMAC_M_SDMA_DCR;
+   devinf.ctrl_addr = XILINX_LLTEMAC_SDMA_CTRL_BASEADDR;
+   ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#   else
+   devinf.flags = LL_TEMAC_M_SDMA_PLB;
+   devinf.ctrl_addr = XILINX_LLTEMAC_SDMA_CTRL_BASEADDR;
+   ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#   endif
+#  endif
+# endif
+
+# ifdef XILINX_LLTEMAC_BASEADDR1
+   memset(&devinf, 0, sizeof(devinf));
+   devinf.phyaddr = -1;
+   devinf.base_addr = XILINX_LLTEMAC_BASEADDR1;
+#  ifdef XILINX_LLTEMAC_FIFO_BASEADDR1
+   devinf.flags = LL_TEMAC_M_FIFO;
+   devinf.ctrl_addr = XILINX_LLTEMAC_FIFO_BASEADDR1;
+   ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#  elif XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1
+#   if XILINX_LLTEMAC_SDMA_USE_DCR == 1
+   devinf.flags = LL_TEMAC_M_SDMA_DCR;
+   devinf.ctrl_addr = XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1;
+   ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#   else
+   devinf.flags = LL_TEMAC_M_SDMA_PLB;
+   devinf.ctrl_addr = XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1;
+   ret |= xilinx_ll_temac_eth_init(bis, &devinf);
+#   endif
+#  endif
+# endif
+#endif /* if 0 */
 #endif
 
return ret;
diff --git a/drivers/net/xilinx_ll_temac.c b/drivers/net/xilinx_ll_temac.c
index 28bc4cd..f6c5fc1 100644
--- a/drivers/net/xilinx_ll_temac.c
+++ b/drivers/net/xilinx_ll_temac.c
@@ -352,7 +352,7 @@ int xilinx_ll_temac_initialize(bd_t *bis, struct 
ll_temac_info *devinf)
  * Returns 1 if the ll_temac device and the mdio bus were initialized
  * otherwise returns 0
  */
-static int xilinx_ll_temac_eth_init(bd_t *bis, struct ll_temac_info *devinf)
+int xilinx_ll_temac_eth_init(bd_t *bis, struct ll_temac_info *devinf)
 {
struct ll_temac_mdio_info mdioinf;
int ret;
diff --git a/include/xilinx_ll_temac.h b/include/xilinx_ll_temac.h
index af4a09f..8fdce22 100644
--- a/include/xilinx_ll_temac.h
+++ b/include/xilinx_ll_temac.h
@@ -355,4 +355,7 @@ struct ll_temac_info {
 
 int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf);
 
+/* FIXME: xilinx_ll_temac_eth_init() must be again private ? */
+int xilinx_ll_temac_eth_init(bd_t *bis, struct ll_temac_info *devinf);
+
 #endif /* _XILINX_LL_TEMAC_ */
-- 
1.7.0.4

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


[U-Boot] [PATCH 6/8] microblaze: Add faked LL_TEMAC driver configuration

2012-01-29 Thread Stephan Linz
Expand the specific configuration for the microblaze-generic
board in xparameters.h with a faked setup to enable the
LL_TEMAC driver.

Note: From now the microblaze-generic board is no longer a
valid board configuration for a real piece of hardware. Rather
than, we use the file config.mk and xparameters.h as a faked
board configuration to force the compilation of all potential
driver code for Microblaze systems.

Signed-off-by: Stephan Linz 
---
 board/xilinx/microblaze-generic/config.mk |6 --
 board/xilinx/microblaze-generic/xparameters.h |   24 ++--
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/board/xilinx/microblaze-generic/config.mk 
b/board/xilinx/microblaze-generic/config.mk
index f8d7e26..9fd1015 100644
--- a/board/xilinx/microblaze-generic/config.mk
+++ b/board/xilinx/microblaze-generic/config.mk
@@ -21,8 +21,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-# CAUTION: This file is automatically generated by libgen.
-# Version: Xilinx EDK 6.3 EDK_Gmm.12.3
+# CAUTION: This file is a faked configuration !!!
+#  There is no real target for the microblaze-generic
+#  configuration. You have to replace this file with
+#  the generated file from your Xilinx design flow.
 #
 
 CONFIG_SYS_TEXT_BASE = 0x2900
diff --git a/board/xilinx/microblaze-generic/xparameters.h 
b/board/xilinx/microblaze-generic/xparameters.h
index fae03bf..69758c3 100644
--- a/board/xilinx/microblaze-generic/xparameters.h
+++ b/board/xilinx/microblaze-generic/xparameters.h
@@ -21,8 +21,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  *
- * CAUTION: This file is automatically generated by libgen.
- * Version: Xilinx EDK 8.2.02 EDK_Im_Sp2.4
+ * CAUTION: This file is a faked configuration !!!
+ *  There is no real target for the microblaze-generic
+ *  configuration. You have to replace this file with
+ *  the generated file from your Xilinx design flow.
  */
 
 #define XILINX_BOARD_NAME  microblaze-generic
@@ -69,3 +71,21 @@
 
 /* Ethernet controller is Ethernet_MAC */
 #define XILINX_EMACLITE_BASEADDR   0x40C0
+
+/* Ethernet controller is Ethernet_MAC */
+#define XILINX_LLTEMAC_BASEADDR0x4400
+#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR  0x42000180
+#define XILINX_LLTEMAC_BASEADDR1   0x4440
+#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1 0x42000200
+#define XILINX_LLTEMAC_BASEADDR2   0x4410
+#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR2 0x42000280
+#define XILINX_LLTEMAC_BASEADDR3   0x44100040
+#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR3 0x42000300
+#define XILINX_LLTEMAC_BASEADDR4   0x4420
+#define XILINX_LLTEMAC_FIFO_BASEADDR4  0x4210
+#define XILINX_LLTEMAC_BASEADDR5   0x44200040
+#define XILINX_LLTEMAC_FIFO_BASEADDR5  0x4211
+#define XILINX_LLTEMAC_BASEADDR6   0x4430
+#define XILINX_LLTEMAC_FIFO_BASEADDR6  0x4212
+#define XILINX_LLTEMAC_BASEADDR7   0x44300040
+#define XILINX_LLTEMAC_FIFO_BASEADDR7  0x4213
-- 
1.7.0.4

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


[U-Boot] [PATCH 7/8] microblaze: Wire up LL_TEMAC driver initialization

2012-01-29 Thread Stephan Linz
Initialize ll_temac driver.

Reported-by: Michal Simek 
Signed-off-by: Stephan Linz 
---
 .../xilinx/microblaze-generic/microblaze-generic.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c 
b/board/xilinx/microblaze-generic/microblaze-generic.c
index c4c13a6..517b2f1 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -90,5 +90,10 @@ int board_eth_init(bd_t *bis)
ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR,
txpp, rxpp);
 #endif
+
+#ifdef CONFIG_XILINX_LL_TEMAC
+   ret |= xilinx_ll_temac_standard_init(bis);
+#endif
+
return ret;
 }
-- 
1.7.0.4

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


[U-Boot] [PATCH 2/8] microblaze: Enable several ethernet driver compilation

2012-01-29 Thread Stephan Linz
U-Boot's multipple network supports enables to use
several ethernet drivers but microblaze-generic
platform config file select only one driver.

Reported-by: Michal Simek 
Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   12 
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 03a6f5a..09ac870 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -65,11 +65,15 @@
 
 /* ethernet */
 #undef CONFIG_SYS_ENET
-#ifdef XILINX_EMACLITE_BASEADDR
-# define CONFIG_XILINX_EMACLITE1
+#if defined(XILINX_EMACLITE_BASEADDR)
+# define CONFIG_XILINX_EMACLITE1
 # define CONFIG_SYS_ENET
-#elif XILINX_LLTEMAC_BASEADDR
-# define CONFIG_XILINX_LL_TEMAC1
+#endif
+#if defined(XILINX_LLTEMAC_BASEADDR)  || defined(XILINX_LLTEMAC_BASEADDR1) || \
+defined(XILINX_LLTEMAC_BASEADDR2) || defined(XILINX_LLTEMAC_BASEADDR3) || \
+defined(XILINX_LLTEMAC_BASEADDR4) || defined(XILINX_LLTEMAC_BASEADDR5) || \
+defined(XILINX_LLTEMAC_BASEADDR6) || defined(XILINX_LLTEMAC_BASEADDR7)
+# define CONFIG_XILINX_LL_TEMAC1
 # define CONFIG_SYS_ENET
 #endif
 #if defined(XILINX_AXIEMAC_BASEADDR)
-- 
1.7.0.4

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


[U-Boot] [PREVIEW] LL TEMAC v10 refactored -- for evaluation only

2012-01-29 Thread Stephan Linz
Hi Michal,

back to your requests and objections I've built up a new patch set for
evaluation. Some of the changes relate to the Microblaze platform rather
than the network driver.

1) U-Boot configuration variables vs. xparameters.h
--
I've tried to find a compromise between the U-Boot coding and
configuration style and your preference. But at least in the point of
the many many CPP conditional directives I can not reduce the code. I
can move the code only to another place. I need a converstion from the
automaticaly generated content of xparameters.h to the U-Boot
configuration space. Now you can find this conversion matrix in a new
platform header, xconversions.h -- I've placed the header in
board/xilinx/microblaze-generic/ I think, we can find a better place.

The conversion matrix avoids all the wrong configuration variables
inside U-Boot code beginning with XILINX_ (and not CONFIG_) and we can
expand the configuration to new software related options we never get
from hardware (example special interface naming). This mechanism can
also be used by other driver and platform code, for example
arch/microblaze/cpu/cache.c and arch/microblaze/lib/bootm.c (use
XILINX_USE_DCACHE instead of ex. CONFIG_XILINX_DCACHE),
common/cmd_mfsl.c (use XILINX_FSL_NUMBER instead of ex.
CONFIG_XILINX_FSL), serial_xuartlite.c (use XILINX_UARTLITE_BASEADDR,
XILINX_UARTLITE_BASEADDR1, ...), and probably also in xilinx_emaclite.c
and xilinx_axi_emac.c when we extand a multi-IP support as we have done
for the LL TEMAC now. Sure we have to work on, but it's another case (I
can make some patches if you want)

Another but not currently existing feasibility would be to generate a
U-Boot conform xparameters.h, for example
CONFIG_XILINX_LL_TEMAC0_BASE_ADDR instead of XILINX_LLTEMAC_BASEADDR.
You and I, we have it in hand. We can change the Xilinx BSP in the near
future. You in PataLinux and I in my own home-brewed BSP generator TPOS.

2) Standard initialization vs. multiple direct calls from platform
--
Returning to the topic "standard" initialization. The last patch will
show the differences bwetween your prefered way to do all in board init
and my applicable standard initializition (a single call to the driver).
Please look at it in the code and decide for yourself.

We need a forward-looking decision, what kind of initialization, we want
to use. Do we want to copy and paste the standard initialization steps
from ip core to ip core (board init) and from platform to platform
(Microplace, PPC405, PPC440) or make a simple call to the driver?

My preferences is to call the driver from platform and let him run all
the necessary steps, that I do not want knowing on platform side.


-- 
Best regards,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH 2/6] microblaze: Enable several ethernet driver compilation

2012-01-28 Thread Stephan Linz
Hi Mike,

Am Donnerstag, den 26.01.2012, 22:58 -0500 schrieb Mike Frysinger: 
> On Saturday 21 January 2012 16:02:54 Stephan Linz wrote:
> > NET_MULTI enables to use several ethernet drivers but
> > microblaze-generic platform config file select only
> > one driver.
> 
> NET_MULTI no longer exists because the code is always enabled now :)

right, that is not defined anywhere -- the comment means that we will
use the multipple network interface support from U-Boot. I can write a
more precise comment ...


> 
> >  #defineCONFIG_ETHADDR  00:E0:0C:00:00:FD
> > +#defineCONFIG_ETH1ADDR 00:E0:0C:00:00:FC
> 
> err, i think these need to get dropped.  boards should not be hardcoding mac 
> addresses in their configs.

OK, I think so too. I can left at least one MAC address as it was in the
original board configuration. I think we need this for a rapid system
startup without a default configuration in ROM. IMHO there are many many
boards that are going this way ...


-- 
Best regards,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH 1/6] net: ll_temac: Add LL TEMAC driver to u-boot

2012-01-26 Thread Stephan Linz
Am Donnerstag, den 26.01.2012, 16:07 +0100 schrieb Michal Simek: 
> Hi Stephan,

Hi Michal,

> 
> Stephan Linz wrote:
> > Xilinx LocalLink Tri-Mode Ether MAC driver can be
> > used by Xilinx Microblaze or Xilinx ppc405/440 in
> > SDMA and FIFO mode. DCR or XPS bus can be used.
> > 
> > --snip--
> > ---
> >  drivers/net/Makefile   |2 +
> >  drivers/net/xilinx_ll_temac.c  |  386 
> >  drivers/net/xilinx_ll_temac_fifo.c |  143 
> >  drivers/net/xilinx_ll_temac_mdio.c |  165 ++
> >  drivers/net/xilinx_ll_temac_sdma.c |  370 +++
> >  include/netdev.h   |1 +
> >  include/xilinx_ll_temac.h  |  430 
> > 
> >  include/xilinx_ll_temac_fifo.h |  122 ++
> >  include/xilinx_ll_temac_mdio.h |   53 +
> >  include/xilinx_ll_temac_sdma.h |  281 +++
> >  10 files changed, 1953 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/net/xilinx_ll_temac.c
> >  create mode 100644 drivers/net/xilinx_ll_temac_fifo.c
> >  create mode 100644 drivers/net/xilinx_ll_temac_mdio.c
> >  create mode 100644 drivers/net/xilinx_ll_temac_sdma.c
> >  create mode 100644 include/xilinx_ll_temac.h
> >  create mode 100644 include/xilinx_ll_temac_fifo.h
> >  create mode 100644 include/xilinx_ll_temac_mdio.h
> >  create mode 100644 include/xilinx_ll_temac_sdma.h
> 
> Wolfgang: I just wanted to know what it is the rule for adding headers.
> I would prefer to add these headers to drivers/net/ folder instead include.

Hm, the reason was the more and more growing up of public interfaces,
for example xilinx_ll_temac_mdio_initialize() and
xilinx_ll_temac_initialize() can be used outside of the driver instead
of it's own standard setup. Yes, I've read your consider, see below. But
if I want to use the xilinx_ll_temac_initialize() outside I need to
export the interface, especially mode flag definitions (FIFO/SDMA/DCR).
So I need public access to the header.

@Wolfgang: What will be the best solution here?

> 
> 
> > 
> > diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> > index f4f7ea3..430f90c 100644
> > --- a/drivers/net/Makefile
> > +++ b/drivers/net/Makefile
> > @@ -77,6 +77,8 @@ COBJS-$(CONFIG_ULI526X) += uli526x.o
> >  COBJS-$(CONFIG_VSC7385_ENET) += vsc7385.o
> >  COBJS-$(CONFIG_XILINX_AXIEMAC) += xilinx_axi_emac.o
> >  COBJS-$(CONFIG_XILINX_EMACLITE) += xilinx_emaclite.o
> > +COBJS-$(CONFIG_XILINX_LL_TEMAC) += xilinx_ll_temac.o 
> > xilinx_ll_temac_mdio.o \
> > +   xilinx_ll_temac_fifo.o xilinx_ll_temac_sdma.o
> > --snip--
> > +
> > +/*
> > + * Initialize a single ll_temac device with its mdio bus behind ll_temac
> > + *
> > + * Returns 1 if the ll_temac device and the mdio bus were initialized
> > + * otherwise returns 0
> > + */
> > +static int xilinx_ll_temac_eth_init(bd_t *bis, struct ll_temac_info 
> > *devinf)
> > +{
> > +   struct ll_temac_mdio_info mdioinf;
> > +   int ret;
> > +
> > +   mdioinf.name = devinf->mdio_busname;
> > +   mdioinf.regs = (struct temac_reg *)devinf->base_addr;
> > +   ret = xilinx_ll_temac_mdio_initialize(bis, &mdioinf);
> > +   if (ret >= 0) {
> > +   ret = xilinx_ll_temac_initialize(bis, devinf);
> > +   if (ret > 0)
> > +   return 1;
> > +   }
> > +
> > +   return 0;
> > +}
> > +
> > +/*
> > + * Initialize all the ll_temac devices
> > + *
> > + * Returns the number of ll_temac devices that were initialized
> > + */
> > +int xilinx_ll_temac_standard_init(bd_t *bis)
> > +{
> 
> name seems to me bogus because I can't see any non-standard init.
> 
> 
> > +   struct ll_temac_info devinf;
> > +   int count = 0;
> > +
> > +#if defined(CONFIG_XILINX_LL_TEMAC0_BASE_ADDR)
> > +   SET_STD_LL_TEMAC_INFO(devinf, 0);
> > +   count += xilinx_ll_temac_eth_init(bis, &devinf);
> > +#endif
> > +
> > +#if defined(CONFIG_XILINX_LL_TEMAC1_BASE_ADDR)
> > +   SET_STD_LL_TEMAC_INFO(devinf, 1);
> > +   count += xilinx_ll_temac_eth_init(bis, &devinf);
> > +#endif
> 
> I understand what you want to do but it seems to me better
> to call xilinx_ll_temac_eth_init(bis, BASE_ADDR, DMA/FIFO, flags, phyaddr)

I believe, function with more than three arguments is bad code. So I've
introduced a driver information struct, We can bundle all the specific
IP options in this struct.

> or similar instead of tr

[U-Boot] [PATCH 3/6] microblaze: Wire up LL_TEMAC driver initialization

2012-01-21 Thread Stephan Linz
Initialize ll_temac driver.

Reported-by: Michal Simek 
Signed-off-by: Stephan Linz 
---
 .../xilinx/microblaze-generic/microblaze-generic.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c 
b/board/xilinx/microblaze-generic/microblaze-generic.c
index c4c13a6..517b2f1 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -90,5 +90,10 @@ int board_eth_init(bd_t *bis)
ret |= xilinx_emaclite_initialize(bis, XILINX_EMACLITE_BASEADDR,
txpp, rxpp);
 #endif
+
+#ifdef CONFIG_XILINX_LL_TEMAC
+   ret |= xilinx_ll_temac_standard_init(bis);
+#endif
+
return ret;
 }
-- 
1.7.0.4

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


[U-Boot] [PATCH 5/6] microblaze: Enable TFTP put command

2012-01-21 Thread Stephan Linz
Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index ec2e49e..a4cdcd8 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -256,6 +256,7 @@
 #else
 # define CONFIG_CMD_PING
 # define CONFIG_CMD_DHCP
+# define CONFIG_CMD_TFTPPUT
 #endif
 
 #if defined(CONFIG_SYSTEMACE)
-- 
1.7.0.4

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


[U-Boot] [PATCH 2/6] microblaze: Enable several ethernet driver compilation

2012-01-21 Thread Stephan Linz
NET_MULTI enables to use several ethernet drivers but
microblaze-generic platform config file select only
one driver.

Reported-by: Michal Simek 
Signed-off-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 03a6f5a..29a86d1 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -65,11 +65,12 @@
 
 /* ethernet */
 #undef CONFIG_SYS_ENET
-#ifdef XILINX_EMACLITE_BASEADDR
-# define CONFIG_XILINX_EMACLITE1
+#if defined(XILINX_EMACLITE_BASEADDR)
+# define CONFIG_XILINX_EMACLITE1
 # define CONFIG_SYS_ENET
-#elif XILINX_LLTEMAC_BASEADDR
-# define CONFIG_XILINX_LL_TEMAC1
+#endif
+#if defined(XILINX_LLTEMAC_BASEADDR) || defined(XILINX_LLTEMAC_BASEADDR1)
+# define CONFIG_XILINX_LL_TEMAC1
 # define CONFIG_SYS_ENET
 #endif
 #if defined(XILINX_AXIEMAC_BASEADDR)
@@ -312,6 +313,7 @@
 #defineCONFIG_SERVERIP 192.168.0.5
 #defineCONFIG_GATEWAYIP192.168.0.1
 #defineCONFIG_ETHADDR  00:E0:0C:00:00:FD
+#defineCONFIG_ETH1ADDR 00:E0:0C:00:00:FC
 
 /* architecture dependent code */
 #defineCONFIG_SYS_USR_EXCEP/* user exception */
-- 
1.7.0.4

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


[U-Boot] [PATCH 4/6] microblaze: Enable phylib and mii support

2012-01-21 Thread Stephan Linz
From: Michal Simek 

Enable phylib and mii support for LLTEMAC or AXI EMAC
ethernet drivers on Microblaze systems.

Signed-off-by: Michal Simek 
Acked-by: Stephan Linz 
---
 include/configs/microblaze-generic.h |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/include/configs/microblaze-generic.h 
b/include/configs/microblaze-generic.h
index 29a86d1..ec2e49e 100644
--- a/include/configs/microblaze-generic.h
+++ b/include/configs/microblaze-generic.h
@@ -340,4 +340,25 @@
 #define CONFIG_FIT 1
 #define CONFIG_OF_LIBFDT   1
 
+#if defined(CONFIG_XILINX_LL_TEMAC) || defined(CONFIG_XILINX_AXIEMAC)
+# define CONFIG_MII1
+# define CONFIG_CMD_MII1
+# define CONFIG_PHY_GIGE   1
+# define CONFIG_SYS_FAULT_ECHO_LINK_DOWN   1
+# define CONFIG_PHYLIB 1
+# define CONFIG_PHY_ATHEROS1
+# define CONFIG_PHY_BROADCOM   1
+# define CONFIG_PHY_DAVICOM1
+# define CONFIG_PHY_LXT1
+# define CONFIG_PHY_MARVELL1
+# define CONFIG_PHY_MICREL 1
+# define CONFIG_PHY_NATSEMI1
+# define CONFIG_PHY_REALTEK1
+# define CONFIG_PHY_VITESSE1
+#else
+# undef CONFIG_MII
+# undef CONFIG_CMD_MII
+# undef CONFIG_PHYLIB
+#endif
+
 #endif /* __CONFIG_H */
-- 
1.7.0.4

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


[U-Boot] [PATCH 6/6] microblaze: Add faked LL_TEMAC driver configuration

2012-01-21 Thread Stephan Linz
Expand the specific configuration for the microblaze-generic
board in xparameters.h with a faked setup to enable the
LL_TEMAC driver.

Note: From now the microblaze-generic board is no longer a
valid board configuration for a real piece of hardware. Rather
than, we use the file config.mk and xparameters.h as a faked
board configuration to force the compilation of all potential
driver code for Microblaze systems.

Signed-off-by: Stephan Linz 
---
 board/xilinx/microblaze-generic/config.mk |6 --
 board/xilinx/microblaze-generic/xparameters.h |   12 ++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/board/xilinx/microblaze-generic/config.mk 
b/board/xilinx/microblaze-generic/config.mk
index f8d7e26..9fd1015 100644
--- a/board/xilinx/microblaze-generic/config.mk
+++ b/board/xilinx/microblaze-generic/config.mk
@@ -21,8 +21,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-# CAUTION: This file is automatically generated by libgen.
-# Version: Xilinx EDK 6.3 EDK_Gmm.12.3
+# CAUTION: This file is a faked configuration !!!
+#  There is no real target for the microblaze-generic
+#  configuration. You have to replace this file with
+#  the generated file from your Xilinx design flow.
 #
 
 CONFIG_SYS_TEXT_BASE = 0x2900
diff --git a/board/xilinx/microblaze-generic/xparameters.h 
b/board/xilinx/microblaze-generic/xparameters.h
index fae03bf..fcbd55e 100644
--- a/board/xilinx/microblaze-generic/xparameters.h
+++ b/board/xilinx/microblaze-generic/xparameters.h
@@ -21,8 +21,10 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  *
- * CAUTION: This file is automatically generated by libgen.
- * Version: Xilinx EDK 8.2.02 EDK_Im_Sp2.4
+ * CAUTION: This file is a faked configuration !!!
+ *  There is no real target for the microblaze-generic
+ *  configuration. You have to replace this file with
+ *  the generated file from your Xilinx design flow.
  */
 
 #define XILINX_BOARD_NAME  microblaze-generic
@@ -69,3 +71,9 @@
 
 /* Ethernet controller is Ethernet_MAC */
 #define XILINX_EMACLITE_BASEADDR   0x40C0
+
+/* Ethernet controller is Ethernet_MAC */
+#define XILINX_LLTEMAC_BASEADDR0x4400
+#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR  0x42000180
+#define XILINX_LLTEMAC_BASEADDR1   0x4440
+#define XILINX_LLTEMAC_SDMA_CTRL_BASEADDR1 0x42000200
-- 
1.7.0.4

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


[U-Boot] LL TEMAC v9 refactored

2012-01-21 Thread Stephan Linz
Back to the discussion from the last three months I have refactored the
LL TEMAC driver again. The version v9 is ready to next review and
testing (I hope the last one). I myself have tested it successfully on
an ML605 (TEMAC hard core) and on a SP3ADSP1800 (TEMAC soft core).
Thanks to Marek, Wolfgang, Andy, Mike and Michal to review v4..8.
Special thanks to Ricardo. He has tested the driver v6 on a Xilinx
Virtex5 FX (PPC440) platform.

To use the driver on Microblaze, you will need all additional platform
patches by Michal Simek and me. All related patches are bundled on
patchwork:
  - http://patchwork.ozlabs.org/bundle/rexut/net-ll_temac/

@Michal: Please merge the patches into the custodian git tree for final
testing.

@Ricardo: Please could you test again the new v9 patch on your PPC440
platform.


-- 
Best regards,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH 1/5] net: ll_temac: Add LL TEMAC driver to u-boot

2012-01-17 Thread Stephan Linz
Am Sonntag, den 15.01.2012, 13:47 -0500 schrieb Mike Frysinger: 
> On Sunday 15 January 2012 13:29:26 Stephan Linz wrote:
> > Am Sonntag, den 15.01.2012, 12:28 -0500 schrieb Mike Frysinger:
> > > On Sunday 15 January 2012 10:46:02 Stephan Linz wrote:
> > > > +/* Data buffer for LL TEMAC Rx and Tx direction */
> > > > +static unsigned char rx_buffer[PKTSIZE_ALIGN]
> > > > __attribute((aligned(DMAALIGN)));
> > > > +static unsigned char tx_buffer[PKTSIZE_ALIGN]
> > > > __attribute((aligned(DMAALIGN)));
> > > 
> > > come code already declares PktBuf ... can't you use that ?
> > 
> > Hm, what do you mean exactly here?
> > 
> > These are the two DMA transfer buffers. I have no idea if there are
> > buffers in the upper layer (NET) and how I can use it for DMA transfers.
> > Therfore I create my own rx/tx buffers and copy data. That reduce the
> > performance a little bit, but it's OK. Furthermore I have to use DMA
> > safe buffers here (no cache, 32 byte alignment).
> 
> from doc/README.drivers.eth:
> The recv function should process packets as long as the hardware has them 
> readily available before returning.  i.e. you should drain the hardware fifo. 
> For each packet you receive, you should call the NetReceive() function on it 
> along with the packet length.  The common code sets up packet buffers for you 
> already in the .bss (NetRxPackets), so there should be no need to allocate 
> your own.
> 
> so you already have an array of packet buffers declared for you.  the first 
> one 
> is &NetRxPackets[0], etc...  since you're just DMA-ing to random external 
> memory, i don't think the address matters.

Hello Mike
and all others,

is there already a simple ETH driver that use these kind of buffer
handling? Up to now I've learned from the Freescale TSEC driver,
especially the MDIO bus implementation. It seems this driver implement
this packet buffer, or not?

> 
> the core code atm however doesn't align things at all, so we'll have to fix 
> that before this driver could use it.

Is the TSEC driver DMA alignment safe (especially the DMA buffer data,
not the DMA buffer descriptor)? What do I need to make the internal
array of packet buffer DMA secure (cache, alignment)?


-- 
Best regards,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH 1/5] net: ll_temac: Add LL TEMAC driver to u-boot

2012-01-16 Thread Stephan Linz
Am Montag, den 16.01.2012, 09:14 +0100 schrieb Wolfgang Denk: 
> Dear Stephan Linz,

Hi Wolfgang,

you are right in all points. I'll go into the next round and handle all
new request.

br,
Stephan

> 
> In message <1326652166.18981.213.camel@keto> you wrote:
> >
> > > come code already declares PktBuf ... can't you use that ?
> > 
> > Hm, what do you mean exactly here?
> > 
> > These are the two DMA transfer buffers. I have no idea if there are
> > buffers in the upper layer (NET) and how I can use it for DMA transfers.
> 
> It's a bad thing not to look at common code, but thnings like that
> happen too easily.
> 
> However, now that this has been pointed out, you cannot simply ignore
> such a request.
> 
> > Therfore I create my own rx/tx buffers and copy data. That reduce the
> > performance a little bit, but it's OK. Furthermore I have to use DMA
> > safe buffers here (no cache, 32 byte alignment).
> 
> I could imagine this to be a pretty common requirement.
> 
> > > this looks like a struct that should get allocated on the fly based on 
> > > arguments given to the driver's registration func
> > 
> > OK, it wast a little bit RAM. We can optimize the code later. I want to
> > see more testing results on differnet Microblaze and PPC platforms.
> 
> we can fix this now, right?
> 
> > > the memory is already zero-ed by the call to calloc, so this for loop is 
> > > useless (and if it wasn't, you'd still use memset())
> > 
> > Sure, we can remove this part in one of the next code optimization.
> 
> No.  Please fix this now, and then add a cleaned up driver.  This is
> what the peer review process is all about.
> 
> Best regards,
> 
> Wolfgang Denk
> 


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


Re: [U-Boot] [PATCH] net: ll_temac: Remove useless memory erasing

2012-01-16 Thread Stephan Linz
Am Sonntag, den 15.01.2012, 18:44 -0500 schrieb Mike Frysinger: 
> On Sunday 15 January 2012 14:46:07 Stephan Linz wrote:
> > In xilinx_ll_temac_initialize() the memory is already zero-ed
> > by the call to calloc, so this loop is useless.
> 
> has this driver already been merged ?  if not, the process is to update the 
> patch and send the new version to the list as a v2 ...
> -mike

You are right, I will post a new V9 patch ...

-- 
Best regards,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


[U-Boot] [PATCH] net: ll_temac: Remove useless memory erasing

2012-01-15 Thread Stephan Linz
In xilinx_ll_temac_initialize() the memory is already zero-ed
by the call to calloc, so this loop is useless.

Signed-off-by: Stephan Linz 
---
 drivers/net/xilinx_ll_temac.c |4 
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/net/xilinx_ll_temac.c b/drivers/net/xilinx_ll_temac.c
index 8533358..e050250 100644
--- a/drivers/net/xilinx_ll_temac.c
+++ b/drivers/net/xilinx_ll_temac.c
@@ -387,10 +387,6 @@ int xilinx_ll_temac_initialize(bd_t *bis, struct 
ll_temac_info *devinf)
else
ll_temac->phyaddr = devinf->phyaddr;
 
-   /* Tell u-boot to get the addr from the env */
-   for (i = 0; i < 6; i++)
-   dev->enetaddr[i] = 0;
-
eth_register(dev);
 
/* Try to initialize PHY here, and return */
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH 1/5] net: ll_temac: Add LL TEMAC driver to u-boot

2012-01-15 Thread Stephan Linz
Am Sonntag, den 15.01.2012, 13:47 -0500 schrieb Mike Frysinger: 
> On Sunday 15 January 2012 13:29:26 Stephan Linz wrote:
> > Am Sonntag, den 15.01.2012, 12:28 -0500 schrieb Mike Frysinger:
> > > On Sunday 15 January 2012 10:46:02 Stephan Linz wrote:
> > > > +/* Data buffer for LL TEMAC Rx and Tx direction */
> > > > +static unsigned char rx_buffer[PKTSIZE_ALIGN]
> > > > __attribute((aligned(DMAALIGN)));
> > > > +static unsigned char tx_buffer[PKTSIZE_ALIGN]
> > > > __attribute((aligned(DMAALIGN)));
> > > 
> > > come code already declares PktBuf ... can't you use that ?
> > 
> > Hm, what do you mean exactly here?
> > 
> > These are the two DMA transfer buffers. I have no idea if there are
> > buffers in the upper layer (NET) and how I can use it for DMA transfers.
> > Therfore I create my own rx/tx buffers and copy data. That reduce the
> > performance a little bit, but it's OK. Furthermore I have to use DMA
> > safe buffers here (no cache, 32 byte alignment).
> 
> from doc/README.drivers.eth:
> The recv function should process packets as long as the hardware has them 
> readily available before returning.  i.e. you should drain the hardware fifo. 
> For each packet you receive, you should call the NetReceive() function on it 
> along with the packet length.  The common code sets up packet buffers for you 
> already in the .bss (NetRxPackets), so there should be no need to allocate 
> your own.

OK, I'll try to change the buffer handling as soon as possible in one of
the next optimization stages of this driver. Looks interesting and
important to me ...

> 
> so you already have an array of packet buffers declared for you.  the first 
> one 
> is &NetRxPackets[0], etc...  since you're just DMA-ing to random external 
> memory, i don't think the address matters.
> 
> the core code atm however doesn't align things at all, so we'll have to fix 
> that before this driver could use it.

The alignment is essential for the LL TEMAC driver, especially the 32
byte alignment. I look to continue to optimize this part after the patch
has been added.

> 
> > > > +static struct ll_temac_info ll_temac_info[] = {
> > > 
> > > this looks like a struct that should get allocated on the fly based on
> > > arguments given to the driver's registration func
> > 
> > OK, it wast a little bit RAM. We can optimize the code later. I want to
> > see more testing results on differnet Microblaze and PPC platforms.
> 
> the point wasn't optimization but to kill off defines influencing how the 
> code 
> behaves.  drivers should operate based on on their per-device state 
> (addresses/settings/etc...) which is given to them via their registration 
> func.  that way multiple devices can be registered in different modes.
> 
> > > > +int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info
> > > > *devinf) ...
> > > > +   dev = calloc(1, sizeof(*dev));
> > > > ...
> > > > +   /* Tell u-boot to get the addr from the env */
> > > > +   for (i = 0; i < 6; i++)
> > > > +   dev->enetaddr[i] = 0;
> > > 
> > > the memory is already zero-ed by the call to calloc, so this for loop is
> > > useless (and if it wasn't, you'd still use memset())
> > 
> > Sure, we can remove this part in one of the next code optimization.
> 
> or do it now and re-submit a v2 ...

I have already done. Patch is coming up ... :-)


-- 
Best regards,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


Re: [U-Boot] [PATCH 1/5] net: ll_temac: Add LL TEMAC driver to u-boot

2012-01-15 Thread Stephan Linz
Am Sonntag, den 15.01.2012, 12:28 -0500 schrieb Mike Frysinger: 
> On Sunday 15 January 2012 10:46:02 Stephan Linz wrote:
> > +/* Data buffer for LL TEMAC Rx and Tx direction */
> > +static unsigned char rx_buffer[PKTSIZE_ALIGN]
> > __attribute((aligned(DMAALIGN)));
> > +static unsigned char tx_buffer[PKTSIZE_ALIGN]
> > __attribute((aligned(DMAALIGN)));
> 
> come code already declares PktBuf ... can't you use that ?

Hm, what do you mean exactly here?

These are the two DMA transfer buffers. I have no idea if there are
buffers in the upper layer (NET) and how I can use it for DMA transfers.
Therfore I create my own rx/tx buffers and copy data. That reduce the
performance a little bit, but it's OK. Furthermore I have to use DMA
safe buffers here (no cache, 32 byte alignment).

> 
> > +static struct ll_temac_info ll_temac_info[] = {
> 
> this looks like a struct that should get allocated on the fly based on 
> arguments given to the driver's registration func

OK, it wast a little bit RAM. We can optimize the code later. I want to
see more testing results on differnet Microblaze and PPC platforms.

> 
> > +int xilinx_ll_temac_initialize(bd_t *bis, struct ll_temac_info *devinf)
> > ...
> > +   dev = calloc(1, sizeof(*dev));
> > ...
> > +   /* Tell u-boot to get the addr from the env */
> > +   for (i = 0; i < 6; i++)
> > +   dev->enetaddr[i] = 0;
> 
> the memory is already zero-ed by the call to calloc, so this for loop is 
> useless (and if it wasn't, you'd still use memset())

Sure, we can remove this part in one of the next code optimization.


-- 
Best regards,
Stephan Linz
__
MB-Ref: http://www.li-pro.de/xilinx_mb:mbref:start
OpenDCC: http://www.li-pro.net/opendcc.phtml
PC/M: http://www.li-pro.net/pcm.phtml
Sourceforge: http://sourceforge.net/users/slz
Gitorious: https://gitorious.org/~slz

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


  1   2   >