Re: [U-Boot] [PATCH 1/2] NET: NE2000: Cleanup IO accessors

2011-12-10 Thread Mike Frysinger
On Saturday 10 December 2011 20:09:30 Marek Vasut wrote:
> Introduce ne2k_register_io(in, out), which allows user to supply two
> functions. One for reading data from the card, the other for writing data
> to the card. Then introduce drivers' private data, which carry pointers to
> these functions and are passed throughout the driver.

where are the users of this new API ?  as it stands, i just see bloat.  every 
register access is now an indirect function call ?  what's the point ?
-mike


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


[U-Boot] [PATCH 1/2] NET: NE2000: Cleanup IO accessors

2011-12-10 Thread Marek Vasut
Introduce ne2k_register_io(in, out), which allows user to supply two functions.
One for reading data from the card, the other for writing data to the card. Then
introduce drivers' private data, which carry pointers to these functions and are
passed throughout the driver.

The private data will carry more entries later.

Signed-off-by: Marek Vasut 
---
 drivers/net/ne2000_base.c |  318 +++--
 include/netdev.h  |2 +
 2 files changed, 191 insertions(+), 129 deletions(-)

NOTE: Formating not cleaned up, only relevant change made!

diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index 88f2b37..35a8581 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -76,10 +76,7 @@ Add SNMP
 #include 
 #include 
 #include 
-
-/* forward definition of function used for the uboot interface */
-void uboot_push_packet_len(int len);
-void uboot_push_tx_done(int key, int val);
+#include 
 
 /* NE2000 base header file */
 #include "ne2000_base.h"
@@ -94,12 +91,37 @@ void uboot_push_tx_done(int key, int val);
 
 static dp83902a_priv_data_t nic; /* just one instance of the card supported */
 
+uint32_t ne2k_default_in(uint8_t *addr, uint32_t offset)
+{
+   uint32_t ret;
+   DP_IN(addr, offset, ret);
+   return ret;
+}
+
+void ne2k_default_out(uint8_t *addr, uint32_t offset, uint32_t val)
+{
+   DP_OUT(addr, offset, val);
+}
+
+struct ne2k_io_accessors {
+   uint32_t(*in)(uint8_t *addr, uint32_t offset);
+   void(*out)(uint8_t *addr, uint32_t offset, uint32_t val);
+};
+
+struct ne2k_private_data {
+   struct ne2k_io_accessorsio;
+};
+
+/* forward definition of function used for the uboot interface */
+void uboot_push_packet_len(struct ne2k_private_data *pdata, int len);
+void uboot_push_tx_done(int key, int val);
+
 /**
  * This function reads the MAC address from the serial EEPROM,
  * used if PROM read fails. Does nothing for ax88796 chips (sh boards)
  */
 static bool
-dp83902a_init(unsigned char *enetaddr)
+dp83902a_init(struct eth_device *dev)
 {
dp83902a_priv_data_t *dp = &nic;
u8* base;
@@ -116,13 +138,17 @@ dp83902a_init(unsigned char *enetaddr)
DEBUG_LINE();
 
 #if defined(NE2000_BASIC_INIT)
+   unsigned char *enetaddr = dev->enetaddr;
+   struct ne2k_private_data *pdata = dev->priv;
+   const struct ne2k_io_accessors *io = &pdata->io;
+
/* AX88796L doesn't need */
/* Prepare ESA */
-   DP_OUT(base, DP_CR, DP_CR_NODMA | DP_CR_PAGE1); /* Select page 1 */
+   io->out(base, DP_CR, DP_CR_NODMA | DP_CR_PAGE1);/* Select page 
1 */
/* Use the address from the serial EEPROM */
for (i = 0; i < 6; i++)
-   DP_IN(base, DP_P1_PAR0+i, dp->esa[i]);
-   DP_OUT(base, DP_CR, DP_CR_NODMA | DP_CR_PAGE0); /* Select page 0 */
+   dp->esa[i] = io->in(base, DP_P1_PAR0+i);
+   io->out(base, DP_CR, DP_CR_NODMA | DP_CR_PAGE0);/* Select page 
0 */
 
printf("NE2000 - %s ESA: %02x:%02x:%02x:%02x:%02x:%02x\n",
"eeprom",
@@ -139,16 +165,18 @@ dp83902a_init(unsigned char *enetaddr)
 }
 
 static void
-dp83902a_stop(void)
+dp83902a_stop(struct eth_device *dev)
 {
dp83902a_priv_data_t *dp = &nic;
+   struct ne2k_private_data *pdata = dev->priv;
+   const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
 
DEBUG_FUNCTION();
 
-   DP_OUT(base, DP_CR, DP_CR_PAGE0 | DP_CR_NODMA | DP_CR_STOP);/* 
Brutal */
-   DP_OUT(base, DP_ISR, 0xFF); /* Clear any pending interrupts 
*/
-   DP_OUT(base, DP_IMR, 0x00); /* Disable all interrupts */
+   io->out(base, DP_CR, DP_CR_PAGE0 | DP_CR_NODMA | DP_CR_STOP);   /* 
Brutal */
+   io->out(base, DP_ISR, 0xFF);/* Clear any pending interrupts 
*/
+   io->out(base, DP_IMR, 0x00);/* Disable all interrupts */
 
dp->running = false;
 }
@@ -160,9 +188,12 @@ dp83902a_stop(void)
  * the hardware ready to send/receive packets.
  */
 static void
-dp83902a_start(u8 * enaddr)
+dp83902a_start(struct eth_device *dev)
 {
dp83902a_priv_data_t *dp = &nic;
+   unsigned char *enaddr = dev->enetaddr;
+   struct ne2k_private_data *pdata = dev->priv;
+   const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
int i;
 
@@ -170,37 +201,37 @@ dp83902a_start(u8 * enaddr)
 
DEBUG_FUNCTION();
 
-   DP_OUT(base, DP_CR, DP_CR_PAGE0 | DP_CR_NODMA | DP_CR_STOP); /* Brutal 
*/
-   DP_OUT(base, DP_DCR, DP_DCR_INIT);
-   DP_OUT(base, DP_RBCH, 0);   /* Remote byte count */
-   DP_OUT(base, DP_RBCL, 0);
-   DP_OUT(base, DP_RCR, DP_RCR_MON);   /* Accept no packets */
-   DP_OUT(base, DP_TCR, DP_TCR_LOCAL); /* Transmitter [virtually] off 
*/
-   DP_OUT(base, DP_TPSR, dp->tx_buf1); /* Transmitter start page */
+   io->out(base, DP_CR, DP_

[U-Boot] [PATCH 2/2] NET: NE2000: Hide dp83902a_priv_data_t into ne2k_private_data

2011-12-10 Thread Marek Vasut
This patch should complete effort to let multiple ne2k cards be used. All
card-specific data shall now be hidden in per-card allocated private_data
structure.

Signed-off-by: Marek Vasut 
---
 drivers/net/ne2000_base.c |   52 +++-
 1 files changed, 27 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index 35a8581..381b334 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -89,8 +89,6 @@ Add SNMP
 #include "ne2000.h"
 #endif
 
-static dp83902a_priv_data_t nic; /* just one instance of the card supported */
-
 uint32_t ne2k_default_in(uint8_t *addr, uint32_t offset)
 {
uint32_t ret;
@@ -110,6 +108,7 @@ struct ne2k_io_accessors {
 
 struct ne2k_private_data {
struct ne2k_io_accessorsio;
+   struct dp83902a_priv_data   nic;
 };
 
 /* forward definition of function used for the uboot interface */
@@ -123,7 +122,8 @@ void uboot_push_tx_done(int key, int val);
 static bool
 dp83902a_init(struct eth_device *dev)
 {
-   dp83902a_priv_data_t *dp = &nic;
+   struct ne2k_private_data *pdata = dev->priv;
+   struct dp83902a_priv_data *dp = &pdata->nic;
u8* base;
 #if defined(NE2000_BASIC_INIT)
int i;
@@ -139,7 +139,6 @@ dp83902a_init(struct eth_device *dev)
 
 #if defined(NE2000_BASIC_INIT)
unsigned char *enetaddr = dev->enetaddr;
-   struct ne2k_private_data *pdata = dev->priv;
const struct ne2k_io_accessors *io = &pdata->io;
 
/* AX88796L doesn't need */
@@ -167,8 +166,8 @@ dp83902a_init(struct eth_device *dev)
 static void
 dp83902a_stop(struct eth_device *dev)
 {
-   dp83902a_priv_data_t *dp = &nic;
struct ne2k_private_data *pdata = dev->priv;
+   struct dp83902a_priv_data *dp = &pdata->nic;
const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
 
@@ -190,9 +189,9 @@ dp83902a_stop(struct eth_device *dev)
 static void
 dp83902a_start(struct eth_device *dev)
 {
-   dp83902a_priv_data_t *dp = &nic;
-   unsigned char *enaddr = dev->enetaddr;
struct ne2k_private_data *pdata = dev->priv;
+   struct dp83902a_priv_data *dp = &pdata->nic;
+   unsigned char *enaddr = dev->enetaddr;
const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
int i;
@@ -244,7 +243,7 @@ dp83902a_start(struct eth_device *dev)
 static void
 dp83902a_start_xmit(struct ne2k_private_data *pdata, int start_page, int len)
 {
-   dp83902a_priv_data_t *dp = (dp83902a_priv_data_t *) &nic;
+   struct dp83902a_priv_data *dp = &pdata->nic;
const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
 
@@ -273,7 +272,7 @@ dp83902a_start_xmit(struct ne2k_private_data *pdata, int 
start_page, int len)
 static void
 dp83902a_send(struct ne2k_private_data *pdata, u8 *data, int total_len, u32 
key)
 {
-   struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
+   struct dp83902a_priv_data *dp = &pdata->nic;
const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
int len, start_page, pkt_len, i, isr;
@@ -403,7 +402,7 @@ dp83902a_send(struct ne2k_private_data *pdata, u8 *data, 
int total_len, u32 key)
 static void
 dp83902a_RxEvent(struct ne2k_private_data *pdata)
 {
-   struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
+   struct dp83902a_priv_data *dp = &pdata->nic;
const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
u8 rcv_hdr[4];
@@ -475,7 +474,7 @@ dp83902a_RxEvent(struct ne2k_private_data *pdata)
 static void
 dp83902a_recv(struct ne2k_private_data *pdata, u8 *data, int len)
 {
-   struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
+   struct dp83902a_priv_data *dp = &pdata->nic;
const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
int i, mlen;
@@ -541,7 +540,7 @@ dp83902a_recv(struct ne2k_private_data *pdata, u8 *data, 
int len)
 static void
 dp83902a_TxEvent(struct ne2k_private_data *pdata)
 {
-   struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
+   struct dp83902a_priv_data *dp = &pdata->nic;
const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
u32 key;
@@ -578,7 +577,7 @@ dp83902a_TxEvent(struct ne2k_private_data *pdata)
 static void
 dp83902a_ClearCounters(struct ne2k_private_data *pdata)
 {
-   struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *) &nic;
+   struct dp83902a_priv_data *dp = &pdata->nic;
const struct ne2k_io_accessors *io = &pdata->io;
u8 *base = dp->base;
 
@@ -595,7 +594,7 @@ dp83902a_ClearCounters(struct ne2k_private_data *pdata)
 static void
 dp83902a_Overflow(struct ne2k_private_data *pdata)
 {
-   struct dp83902a_priv_data *dp = (struct dp83902a_priv_data *)&nic;
+   struct dp83902a_priv_data *dp = &pdata->

Re: [U-Boot] [PATCH v2 3/3] image: Allow images to indicate they're loadable at any address

2011-12-10 Thread Linus Walleij
On Sat, Dec 10, 2011 at 11:53 PM, Wolfgang Denk  wrote:
> [Me]
>> As explained by Nico, having the boot loader decompress the
>> kernel is *bad*.
>
> This is your point of view, but others (including me) think different.

Yes, as C. B. Roylance Kent stated in 1893:
Those are my principles, but if you don't like them, they can be changed.

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


[U-Boot] Pull request u-boot-blackfin.git (sandbox branch)

2011-12-10 Thread Mike Frysinger
This makes sandbox work again on the latest master.

The following changes since commit c90a4dd79cb17abb46689f27ff9f1c971362d6e2:

  post/post.c: Use lldiv for 64-bit divisions (2011-12-10 23:15:14 +0100)

are available in the git repository at:
  git://www.denx.de/git/u-boot-blackfin.git sandbox

Andreas Bießmann (1):
  sandbox: fix compiling of cpu/os.c

Matthias Weisser (2):
  sandbox: Add improved RAM simulation
  sandbox: Add timer simulation

 arch/sandbox/config.mk  |1 +
 arch/sandbox/cpu/Makefile   |7 ---
 arch/sandbox/cpu/cpu.c  |4 ++--
 arch/sandbox/cpu/os.c   |   34 ++
 arch/sandbox/lib/board.c|   17 ++---
 board/sandbox/sandbox/sandbox.c |4 +++-
 common/Makefile |3 ---
 include/os.h|   22 ++
 8 files changed, 76 insertions(+), 16 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/3] image: Allow images to indicate they're loadable at any address

2011-12-10 Thread Wolfgang Denk
Dear Linus Walleij,

In message  
you wrote:
> 
> > Can I assume that we have (or can have) a 'make uImage' target or
> > similar in the kernel which can pack together:
> >
> > - a compressed kernel (not zImage, I mean something that U-Boot can
> > decompress), with a rel_offset of 32KB
> 
> As explained by Nico, having the boot loader decompress the
> kernel is *bad*.

This is your point of view, but others (including me) think different.

> I configure it in like this with the config script
> (you can also use menuconfig or interactive config...):
> 
> scripts/config --file .config \
> --enable BLK_DEV_INITRD \
> --set-str INITRAMFS_SOURCE rootfs.cpio \
> --enable INITRAMFS_COMPRESSION_GZIP \
> --enable RD_GZIP
> 
> Since this was so convenient I made a patch to attach a DTB

Convenient?  Again, this is a matter of taste and aquired habits.

With U-Boot none of this is needed.

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Power is danger.
-- The Centurion, "Balance of Terror", stardate 1709.2
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 05/13] boards.cfg: sort list

2011-12-10 Thread Wolfgang Denk
Dear Mike Frysinger,

In message <201112101739.26972.vap...@gentoo.org> you wrote:
>
> maybe we should have mkconfig automatically do this ?

No. Automatic scripts should never meddle with source files.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Anarchy may not be the best form of government, but it's better  than
no government at all.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/3] image: Allow images to indicate they're loadable at any address

2011-12-10 Thread Linus Walleij
On Tue, Nov 8, 2011 at 2:10 AM, Simon Glass  wrote:

> Can I assume that we have (or can have) a 'make uImage' target or
> similar in the kernel which can pack together:
>
> - a compressed kernel (not zImage, I mean something that U-Boot can
> decompress), with a rel_offset of 32KB

As explained by Nico, having the boot loader decompress the
kernel is *bad*.

> - a DTB
> - a ramdisk

When testing various systems I already usually use a uImage with
zImage+initramfs+DTB. This is frowned upon in some places but
it works like this:

I attach the initramfs from a cpio file rather than from giving a file
path list. This is rather popular in some embedded systems.

I configure it in like this with the config script
(you can also use menuconfig or interactive config...):

scripts/config --file .config \
--enable BLK_DEV_INITRD \
--set-str INITRAMFS_SOURCE rootfs.cpio \
--enable INITRAMFS_COMPRESSION_GZIP \
--enable RD_GZIP

Since this was so convenient I made a patch to attach a DTB
the same way which was floated on devicetree-discuss:
http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg07256.html

Nico didn't like that:
http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg06828.html

Alas, I'm still using that patch though. For systems where I cannot
influence the boot loader it's easiest, since I just add another
config snippet when I want to run them with DT:

scripts/config --file .config \
--enable USE_OF \
--enable ARM_APPENDED_DTB \
--enable ARM_ATAG_DTB_COMPAT \
--enable PROC_DEVICETREE \
--set-str ARM_APPENDED_DTB_FILE my-device-tree.dtb

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


Re: [U-Boot] [PATCH 05/13] boards.cfg: sort list

2011-12-10 Thread Mike Frysinger
maybe we should have mkconfig automatically do this ?
-mike


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


Re: [U-Boot] [PATCH 2/2] post/post.c: Use lldiv for 64-bit divisions

2011-12-10 Thread Wolfgang Denk
Dear Christian Riesch,

In message <1323446043-22656-3-git-send-email-christian.rie...@omicron.at> you 
wrote:
> Signed-off-by: Christian Riesch 
> Cc: Tom Rini 
> Cc: Heiko Schocher 
> Cc: Wolfgang Denk 
> ---
>  post/post.c |3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"Obviously, a major malfunction has occurred."
  -- Steve Nesbitt, voice of Mission Control, January 28,
 1986, as the shuttle Challenger exploded within view
 of the grandstands.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] arm, davinci: Use lldiv for the 64-bit divisions in timer.c

2011-12-10 Thread Wolfgang Denk
Dear Christian Riesch,

In message <1323446043-22656-2-git-send-email-christian.rie...@omicron.at> you 
wrote:
> Signed-off-by: Christian Riesch 
> Cc: Tom Rini 
> Cc: Heiko Schocher 
> Cc: Wolfgang Denk 
> ---
>  arch/arm/cpu/arm926ejs/davinci/timer.c |6 --
>  1 files changed, 4 insertions(+), 2 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Anyone who isn't confused here doesn't really know what's going on.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 13/13] ARM: convert "omap730p2" boards to boards.cfg

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-14-git-send-email...@denx.de> you wrote:
> Signed-off-by: Wolfgang Denk 
> Dave Peverley 
> ---
>  MAKEALL|1 -
>  Makefile   |   11 ---
>  boards.cfg |3 +++
>  3 files changed, 3 insertions(+), 12 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
We fight only when there is no other choice. We prefer  the  ways  of
peaceful contact.
-- Kirk, "Spectre of the Gun", stardate 4385.3
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 12/13] board/ti/omap730p2/flash.c: Fix GCC 4.6 build warnings

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-13-git-send-email...@denx.de> you wrote:
> Fix:
> flash.c: In function 'flash_get_offsets':
> flash.c:122:10: warning: variable 'pOrgDef' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'flash_erase':
> flash.c:263:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'write_data':
> flash.c:439:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Wolfgang Denk 
> Cc: Dave Peverley 
> ---
>  board/ti/omap730p2/flash.c |   19 ---
>  1 files changed, 12 insertions(+), 7 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
The human mind ordinarily operates at only ten percent of its capaci-
ty - the rest is overhead for the operating system.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 11/13] ARM: convert "omap16xx" boards to boards.cfg

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-12-git-send-email...@denx.de> you wrote:
> Signed-off-by: Wolfgang Denk 
> Cc: Kshitij Gupta 
> ---
>  MAKEALL|2 --
>  Makefile   |   20 
>  boards.cfg |8 
>  3 files changed, 8 insertions(+), 22 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
A little suffering is good for the soul.
-- Kirk, "The Corbomite Maneuver", stardate 1514.0
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 10/13] board/ti/omap1610inn/flash.c: Fix GCC 4.6 build warnings

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-11-git-send-email...@denx.de> you wrote:
> Fix:
> flash.c: In function 'flash_get_offsets':
> flash.c:139:10: warning: variable 'pOrgDef' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'flash_erase':
> flash.c:280:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> flash.c: In function 'write_data':
> flash.c:456:6: warning: variable 'flag' set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Wolfgang Denk 
> ---
>  board/ti/omap1610inn/flash.c |   21 +
>  1 files changed, 13 insertions(+), 8 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
HR Manager to job candidate "I see you've had no  computer  training.
Although  that  qualifies  you  for upper management, it means you're
under-qualified for our entry level positions."
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 09/13] board/LaCie/edminiv2/edminiv2.c: Fix build warning

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-10-git-send-email...@denx.de> you wrote:
> Fix:
> edminiv2.c: In function 'reset_phy':
> edminiv2.c:98:2: warning: implicit declaration of function
> 'mv_phy_88e1116_init' [-Wimplicit-function-declaration]
> 
> Signed-off-by: Wolfgang Denk 
> Cc: Albert ARIBAUD 
> ---
>  board/LaCie/edminiv2/edminiv2.c |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
People seldom know what they want until you give them what  they  ask
for.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 08/13] ARM: convert "apollon" board to use boards.cfg

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-9-git-send-email...@denx.de> you wrote:
> Signed-off-by: Wolfgang Denk 
> Cc: Kyungmin Park 
> Cc: Albert Aribaud 
> ---
>  MAKEALL   |1 -
>  Makefile  |   10 --
>  boards.cfg|1 +
>  include/configs/apollon.h |2 ++
>  4 files changed, 3 insertions(+), 11 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Why is an average signature file longer than an average Perl script??
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 07/13] board/apollon/sys_info.c: Fix GCC 4.6 build warning

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-8-git-send-email...@denx.de> you wrote:
> Fix:
> sys_info.c: In function 'display_board_info':
> sys_info.c:260:16: warning: variable 'db_s' set but not used
> [-Wunused-but-set-variable]
> 
> Also fix resulting warnings:
> sys_info.c:251:7: warning: unused variable 'db_ip' [-Wunused-variable]
> sys_info.c:250:7: warning: unused variable 'db_men' [-Wunused-variable]
> 
> Signed-off-by: Wolfgang Denk 
> Cc: Kyungmin Park 
> ---
>  board/apollon/sys_info.c |9 +
>  1 files changed, 1 insertions(+), 8 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
As far as the laws of mathematics refer  to  reality,  they  are  not
certain;  and  as  far  as  they  are  certain,  they do not refer to
reality.   -- Albert Einstein
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 06/13] board/apollon/apollon.c: Fix GCc 4.6 build warnings.

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-7-git-send-email...@denx.de> you wrote:
> Fix:
> apollon.c: In function 'dram_init':
> apollon.c:188:29: warning: variable 'cpu' set but not used
> [-Wunused-but-set-variable]
> apollon.c:188:20: warning: variable 'rev' set but not used
> [-Wunused-but-set-variable]
> apollon.c:187:26: warning: variable 'size1' set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Wolfgang Denk 
> Cc: Kyungmin Park 
> ---
>  board/apollon/apollon.c |   18 +-
>  1 files changed, 9 insertions(+), 9 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Always try to do things in chronological order; it's  less  confusing
that way.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 05/13] boards.cfg: sort list

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-6-git-send-email...@denx.de> you wrote:
> Signed-off-by: Wolfgang Denk 
> ---
>  boards.cfg |  218 
> ++--
>  1 files changed, 109 insertions(+), 109 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
We have phasers, I vote we blast 'em!
-- Bailey, "The Corbomite Maneuver", stardate 1514.2
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 03/13] fs/yaffs2/yaffs_guts.c: Fix GCC 4.6 compile warning (and bug)

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-4-git-send-email...@denx.de> you wrote:
> Fix:
> yaffs_guts.c: In function 'yaffs_GarbageCollectBlock':
> yaffs_guts.c:2761:6: warning: variable 'retVal' set but not used
> [-Wunused-but-set-variable]
> 
> Here GCC actually detected a bug.  The code was always returning OK
> instead of the previously set retrun code.  Fix that.
> 
> Signed-off-by: Wolfgang Denk 
> Cc: William Juul 
> Cc: Scott Wood 
> ---
>  fs/yaffs2/yaffs_guts.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
I distrust all systematisers, and avoid them. The will  to  a  system
shows a lack of honesty.
- Friedrich Wilhelm Nietzsche _Götzen-Dämmerung [The Twilight of  the
Idols]_ ``Maxims and Missiles'' no. 26
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/13] drivers/net/at91_emac.c: Fix GCC 4.6 build warnings

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429272-26801-3-git-send-email...@denx.de> you wrote:
> Fix:
> at91_emac.c: In function 'at91emac_phy_init':
> at91_emac.c:244:20: warning: variable 'duplex' set but not used
> [-Wunused-but-set-variable]
> at91_emac.c:244:13: warning: variable 'speed' set but not used
> [-Wunused-but-set-variable]
> 
> Use new debug_cond() to fix these warnings.  In the result, anumber of
> inconsistent printf() formats are detected:
> 
> at91_emac.c: In function 'at91emac_read':
> at91_emac.c:147:2: warning: format '%x' expects argument of type
> 'unsigned int', but argument 2 has type 'struct at91_emac_t *'
> [-Wformat]
> at91_emac.c: In function 'at91emac_write':
> at91_emac.c:157:2: warning: format '%x' expects argument of type
> 'unsigned int', but argument 2 has type 'struct at91_emac_t *'
> [-Wformat]
> at91_emac.c:157:2: warning: format '%x' expects argument of type
> 'unsigned int', but argument 4 has type 'short unsigned int *'
> [-Wformat]
> at91_emac.c: In function 'at91emac_recv':
> at91_emac.c:451:3: warning: format '%d' expects argument of type
> 'int', but argument 2 has type 'long unsigned int' [-Wformat]
> at91_emac.c:451:3: warning: format '%x' expects argument of type
> 'unsigned int', but argument 4 has type 'long unsigned int' [-Wformat]
> 
> Fix these, too.
> 
> Signed-off-by: Wolfgang Denk 
> Cc: Jens Scharsig 
> Cc: Andreas Bießmann 
> Cc: Reinhard Meyer 
> ---
>  drivers/net/at91_emac.c |   42 +++---
>  1 files changed, 23 insertions(+), 19 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Boykottiert Microsoft - Kauft Eure Fenster bei OBI!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] common/usb_kbd.c: fix bug introduced in commit 00b7d6e

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323429107-26670-1-git-send-email...@denx.de> you wrote:
> During the rebase of commit 00b7d6e "USB: Squash checkpatch warnings
> in usb_kbd.c" I missed a brace, resulting in a number of build errors.
> Fix these.
> 
> Signed-off-by: Wolfgang Denk 
> ---
>  common/usb_kbd.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"Life is a garment we continuously alter, but which  never  seems  to
fit."  - David McCord
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] drivers/net/ne2000_base.c: Fix GCC 4.6 build warnings

2011-12-10 Thread Wolfgang Denk
Dear Wolfgang Denk,

In message <1323379737-10882-1-git-send-email...@denx.de> you wrote:
> Fix:
> ne2000_base.c: In function 'dp83902a_send':
> ne2000_base.c:282:7: warning: variable 'tmp' set but not used
> [-Wunused-but-set-variable]
> ne2000_base.c: In function 'dp83902a_RxEvent':
> ne2000_base.c:376:5: warning: variable 'rsr' set but not used
> [-Wunused-but-set-variable]
> ne2000_base.c: In function 'dp83902a_TxEvent':
> ne2000_base.c:513:5: warning: variable 'tsr' set but not used
> [-Wunused-but-set-variable]
> ne2000_base.c: In function 'dp83902a_ClearCounters':
> ne2000_base.c:550:17: warning: variable 'cnt3' set but not used
> [-Wunused-but-set-variable]
> ne2000_base.c:550:11: warning: variable 'cnt2' set but not used
> [-Wunused-but-set-variable]
> ne2000_base.c:550:5: warning: variable 'cnt1' set but not used
> [-Wunused-but-set-variable]
> 
> Signed-off-by: Wolfgang Denk 
> ---
>  drivers/net/ne2000_base.c |9 +
>  1 files changed, 5 insertions(+), 4 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
If some day we are defeated, well, war has  its  fortunes,  good  and
bad.
-- Commander Kor, "Errand of Mercy", stardate 3201.7
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Pull request: u-boot-usb

2011-12-10 Thread Wolfgang Denk
Dear Remy Bohmer,

In message  
you wrote:
> The following changes since commit c4eba6ec5c58083b38340724c006294c7a4fe2eb:
> 
>   common/usb_kbd.c: fix bug introduced in commit 00b7d6e (2011-12-09
> 12:09:35 +0100)
> 
> are available in the git repository at:
>   git://git.denx.de/u-boot-usb.git master

Sorry, this collides with other changes to
arch/arm/include/asm/arch-exynos/cpu.h (i. e. the rename of S5PC210
into EXYNOS4).

Most of the conflicts are trivial to resolve, but old
S5PC210_PHY_BASE (versus new EXYNOS4_USBPHY_BASE) and old
S5PC210_USB_PHY_CONTROL (no new correspondence) may require changes
in other parts of the code, too.

Can you please rebase and resubmit?

Sorry for the inconvenience.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
I've got to get something inside me. Some coffee  or  something.  And
then the world will somehow be better.
 - Terry Pratchett, _Men at Arms_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Pull request: u-boot-arm/master

2011-12-10 Thread Wolfgang Denk
Dear Albert ARIBAUD,

In message <4ee23a7f.2090...@aribaud.net> you wrote:
> Hi Wolfgang,
> 
> The following changes since commit c4eba6ec5c58083b38340724c006294c7a4fe2eb:
> 
>common/usb_kbd.c: fix bug introduced in commit 00b7d6e (2011-12-09 
> 12:09:35 +0100)
> 
> are available in the git repository at:
>git://git.denx.de/u-boot-arm.git master
> 
> Chander Kashyap (1):
>S5PC2XX: Rename S5pc2XX to exynos
> 
> Jason Liu (4):
>i.mx: introduce the armv7/imx-common folder
>i.mx: add the initial support for freescale i.MX6Q processor
>i.mx: mxc_gpio: add the i.mx6q support
>i.mx: i.mx6q: add the initial support for i.mx6q ARM2 board
> 
> Marek Vasut (4):
>M28: Document that units has to be set to sectors on SD bootcard
>M28: Fix typo
>i.MX28: Move SPL to arch/arm/cpu/arm926ejs/mx28
>M28: Cleanup memsize.o OOT build
> 
> Simon Glass (9):
>tegra2: Add arch_cpu_init() to fire up Cortex-A9
>tegra2: Simplify tegra_start() boot path
>arm: Move CP15 init out of cpu_init_crit()
>tegra2: Enable instruction cache
>tegra2: Remove unneeded boot code
>tegra2: Remove unneeded config option
>tegra2: Remove unused low-level Tegra2 UART code
>tegra2: Remove unneeded 'dynamic ram size' message
>tegra2: Don't use board pointer before it is set up
> 
> Stephen Warren (4):
>tegra2: Move board_mmc_init into board files
>tegra2: Modify MMC driver to handle power and cd GPIOs
>tegra2: Add support for Ventana
>tegra2: Use new GPIO APIs in gpio_config_uart()
> 
>   MAINTAINERS|   12 +-
>   Makefile   |   10 +-
>   arch/arm/cpu/arm926ejs/mx28/Makefile   |4 +
>   .../arm/cpu/arm926ejs/mx28/mx28_init.h |0
>   arch/arm/cpu/arm926ejs/mx28/spl_boot.c |   78 +
>   .../arm/cpu/arm926ejs/mx28/spl_mem_init.c  |2 +-
>   .../arm/cpu/arm926ejs/mx28/spl_power_init.c|2 +-
>   .../m28evk => arch/arm/cpu/arm926ejs/mx28}/start.S |0
>   .../arm/cpu/arm926ejs/mx28}/u-boot-spl.lds |   14 +-
>   arch/arm/cpu/armv7/{s5pc2xx => exynos}/Makefile|0
>   arch/arm/cpu/armv7/{s5pc2xx => exynos}/clock.c |   50 +-
>   arch/arm/cpu/armv7/{s5pc2xx => exynos}/soc.c   |0
>   arch/arm/cpu/armv7/imx-common/Makefile |   47 +
>   arch/arm/cpu/armv7/imx-common/cpu.c|  108 ++
>   arch/arm/cpu/armv7/{mx5 => imx-common}/speed.c |0
>   arch/arm/cpu/armv7/{mx5 => imx-common}/timer.c |   17 +-
>   arch/arm/cpu/armv7/mx5/Makefile|2 +-
>   arch/arm/cpu/armv7/mx5/soc.c   |   77 -
>   arch/arm/cpu/armv7/mx6/Makefile|   48 +
>   arch/arm/cpu/armv7/mx6/clock.c |  366 +
>   arch/arm/cpu/armv7/mx6/iomux-v3.c  |   71 +
>   arch/arm/cpu/armv7/mx6/lowlevel_init.S |   24 +
>   arch/arm/cpu/armv7/mx6/soc.c   |   82 +
>   arch/arm/cpu/armv7/start.S |   36 +-
>   arch/arm/cpu/armv7/tegra2/Makefile |5 +
>   arch/arm/cpu/armv7/tegra2/ap20.c   |   54 +-
>   arch/arm/cpu/armv7/tegra2/ap20.h   |   10 +-
>   arch/arm/cpu/armv7/tegra2/board.c  |   35 +-
>   arch/arm/cpu/armv7/tegra2/config.mk|7 +-
>   arch/arm/cpu/armv7/tegra2/lowlevel_init.S  |  118 --
>   .../asm/{arch-s5pc2xx => arch-exynos}/adc.h|0
>   .../asm/{arch-s5pc2xx => arch-exynos}/clk.h|0
>   .../asm/{arch-s5pc2xx => arch-exynos}/clock.h  |2 +-
>   .../asm/{arch-s5pc2xx => arch-exynos}/cpu.h|   64 +-
>   .../asm/{arch-s5pc2xx => arch-exynos}/gpio.h   |   28 +-
>   .../asm/{arch-s5pc2xx => arch-exynos}/mmc.h|0
>   .../asm/{arch-s5pc2xx => arch-exynos}/pwm.h|0
>   .../asm/{arch-s5pc2xx => arch-exynos}/sromc.h  |0
>   .../asm/{arch-s5pc2xx => arch-exynos}/sys_proto.h  |0
>   .../asm/{arch-s5pc2xx => arch-exynos}/uart.h   |0
>   arch/arm/include/asm/arch-mx28/sys_proto.h |6 +
>   arch/arm/include/asm/arch-mx6/ccm_regs.h   |  892 +++
>   arch/arm/include/asm/arch-mx6/clock.h  |   50 +
>   .../arm/include/asm/arch-mx6/gpio.h|   18 +-
>   arch/arm/include/asm/arch-mx6/imx-regs.h   |  236 +++
>   arch/arm/include/asm/arch-mx6/iomux-v3.h   |  103 ++
>   arch/arm/include/asm/arch-mx6/mx6x_pins.h  | 1683 
> 
>   arch/arm/include/asm/arch-mx6/sys_proto.h  |   38 +
>   arch/arm/include/asm/u-boot-arm.h  |3 +
>   board/denx/m28evk/Makefile |   11 +-
>   board/denx/m28evk/m28evk.c |2 +-
>   board/denx/m28evk/{mmc_boot.c => spl_boot.c}   |   

Re: [U-Boot] Pull request: u-boot-staging

2011-12-10 Thread Wolfgang Denk
Dear Anatolij Gustschin,

In message <20111209173605.6440abfd@wker> you wrote:
> Hello Wolfgang,
> 
> The following changes since commit c4eba6ec5c58083b38340724c006294c7a4fe2eb:
> 
>   common/usb_kbd.c: fix bug introduced in commit 00b7d6e (2011-12-09 12:09:35 
> +0100)
> 
> are available in the git repository at:
>   git://git.denx.de/u-boot-staging.git ag...@denx.de
> 
> Ash Charles (1):
>   omap: TWL4030 Bump VMMC1 interface voltage from 3V to 3.15V
> 
> Gabe Black (1):
>   Update pci_ids.h from current Linux sources
> 
> Steve Sakoman (1):
>   omap: overo: Use ubifs instead of jffs2 for nand
> 
>  drivers/power/twl4030.c   |4 +-
>  include/configs/omap3_overo.h |4 +-
>  include/pci_ids.h | 2068 
> -
>  include/twl4030.h |1 +
>  4 files changed, 1431 insertions(+), 646 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Every time history repeats itself the price goes up.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [GIT PULL] please pull u-boot-mpc85xx

2011-12-10 Thread Wolfgang Denk
Dear Kumar Gala,

In message  you 
wrote:
> The following changes since commit c4eba6ec5c58083b38340724c006294c7a4fe2eb:
> 
>   common/usb_kbd.c: fix bug introduced in commit 00b7d6e (2011-12-09 12:09:35 
> +0100)
> 
> are available in the git repository at:
>   git://git.denx.de/u-boot-mpc85xx.git master
> 
> Kyle Moffett (1):
>   mpc85xx: Add board support for the eXMeritus HWW-1U-1A devices
> 
>  MAINTAINERS   |4 +
>  board/exmeritus/hww1u1a/Makefile  |   48 
>  board/exmeritus/hww1u1a/ddr.c |   34 +++
>  board/exmeritus/hww1u1a/gpios.h   |   69 ++
>  board/exmeritus/hww1u1a/hww1u1a.c |  277 +++
>  board/exmeritus/hww1u1a/law.c |   34 +++
>  board/exmeritus/hww1u1a/tlb.c |  106 +
>  boards.cfg|1 +
>  include/configs/HWW1U1A.h |  451 
> +
>  9 files changed, 1024 insertions(+), 0 deletions(-)
>  create mode 100644 board/exmeritus/hww1u1a/Makefile
>  create mode 100644 board/exmeritus/hww1u1a/ddr.c
>  create mode 100644 board/exmeritus/hww1u1a/gpios.h
>  create mode 100644 board/exmeritus/hww1u1a/hww1u1a.c
>  create mode 100644 board/exmeritus/hww1u1a/law.c
>  create mode 100644 board/exmeritus/hww1u1a/tlb.c
>  create mode 100644 include/configs/HWW1U1A.h

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
I will not say that women have no character;  rather, they have a new
one every day.   -- Heine
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [GIT PULL] Pull request u-boot-staging

2011-12-10 Thread Wolfgang Denk
Dear Stefano Babic,

In message <4ee21228.7070...@denx.de> you wrote:
> Hi Wolfgang,
> 
> please pull from u-boot-staging, sba...@denx.de. There is only one patch
> in the list.
> 
> The following changes since commit c4eba6ec5c58083b38340724c006294c7a4fe2eb:
> 
>   common/usb_kbd.c: fix bug introduced in commit 00b7d6e (2011-12-09
> 12:09:35 +0100)
> 
> are available in the git repository at:
>   git://www.denx.de/git/u-boot-staging sba...@denx.de
> 
> Simon Glass (1):
>   Add board_pre_console_putc to deal with early console output
> 
>  README   |   17 +
>  common/console.c |   10 +-
>  include/common.h |7 +++
>  3 files changed, 33 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"Consistency requires you to be as ignorant today as you were a  year
ago."  - Bernard Berenson
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/9] MX5x USB support

2011-12-10 Thread Marek Vasut
> > Hi Marek,
> > 
> > 2011/12/7 Marek Vasut :
> > > This patchset adds the USB support for MX5x. Most of the code is based
> > > on work of Wolfgang Grandegger with modifications done by various
> > > other authors. I also included version of ULPI support code cleaned up
> > > by Igor Grinberg.
> > > 
> > > NOTE: I'd really love to get this code into .12 release. Remy,
> > > Wolfgang, do you think it'd be possible? I'd really help adoption of
> > > the MX5x USB code greatly as well as cleanup of the ULPI code (which
> > > is sadly in a bad shape).
> > 
> > I have no objections, except that it is unclear to me what version of
> > the ULPI code is the latest version.
> > I see:
> > * 2 'v7' versions of the same patch
> 
> Oh well, it is unclear to me how Jana versioned that stuff. When Igor
> picked it up, I think he did the v7. When I picked Igor's version, I
> dropped the changelog as it carried no useful information.
> 
> > * 1 version without a version information as part of a 9 pieces series.
> 
> Yea, that's the good one. I'll rebase it tonight.

Rebase on u-boot-usb/master and pushed to git://git.denx.de/u-boot-marex.git , 
branch "usb2" !

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


[U-Boot] reboard: generic relocation patch series

2011-12-10 Thread Simon Glass
Hi,

FYI I have sent a patch to introduce a cross-architecture relocation
feature to U-Boot. Please look for 'reboard' on the list.

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


[U-Boot] [RFC PATCH v2 07/15] bootstage: Convert IDE progress numbers to enums

2011-12-10 Thread Simon Glass
This changes over the IDE progress numbers to use enums from bootstage.h.

Signed-off-by: Simon Glass 
---

 common/cmd_ide.c|   46 +++---
 include/bootstage.h |   14 ++
 2 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index bdfa8db..46fa7d4 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -345,7 +345,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
const void *fit_hdr = NULL;
 #endif
 
-   show_boot_progress(41);
+   show_boot_progress(BOOTSTAGE_ID_IDE_START);
switch (argc) {
case 1:
addr = CONFIG_SYS_LOAD_ADDR;
@@ -360,41 +360,41 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
boot_device = argv[2];
break;
default:
-   show_boot_error(42);
+   show_boot_error(BOOTSTAGE_ID_IDE_ADDR);
return cmd_usage(cmdtp);
}
-   show_boot_progress(42);
+   show_boot_progress(BOOTSTAGE_ID_IDE_ADDR);
 
if (!boot_device) {
puts("\n** No boot device **\n");
-   show_boot_error(43);
+   show_boot_error(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
return 1;
}
-   show_boot_progress(43);
+   show_boot_progress(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
 
dev = simple_strtoul(boot_device, &ep, 16);
 
if (ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN) {
printf("\n** Device %d not available\n", dev);
-   show_boot_error(44);
+   show_boot_error(BOOTSTAGE_ID_IDE_TYPE);
return 1;
}
-   show_boot_progress(44);
+   show_boot_progress(BOOTSTAGE_ID_IDE_TYPE);
 
if (*ep) {
if (*ep != ':') {
puts("\n** Invalid boot device, use `dev[:part]' **\n");
-   show_boot_error(45);
+   show_boot_error(BOOTSTAGE_ID_IDE_PART);
return 1;
}
part = simple_strtoul(++ep, NULL, 16);
}
-   show_boot_progress(45);
+   show_boot_progress(BOOTSTAGE_ID_IDE_PART);
if (get_partition_info(&ide_dev_desc[dev], part, &info)) {
-   show_boot_error(46);
+   show_boot_error(BOOTSTAGE_ID_IDE_PART_INFO);
return 1;
}
-   show_boot_progress(46);
+   show_boot_progress(BOOTSTAGE_ID_IDE_PART_INFO);
if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0)
&&
(strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0)
@@ -402,10 +402,10 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
printf("\n** Invalid partition type \"%.32s\"" " (expect \""
BOOT_PART_TYPE "\")\n",
info.type);
-   show_boot_error(47);
+   show_boot_error(BOOTSTAGE_ID_IDE_PART_TYPE);
return 1;
}
-   show_boot_progress(47);
+   show_boot_progress(BOOTSTAGE_ID_IDE_PART_TYPE);
 
printf("\nLoading from IDE device %d, partition %d: "
   "Name: %.32s  Type: %.32s\n", dev, part, info.name, info.type);
@@ -416,23 +416,23 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
if (ide_dev_desc[dev].
block_read(dev, info.start, 1, (ulong *) addr) != 1) {
printf("** Read error on %d:%d\n", dev, part);
-   show_boot_error(48);
+   show_boot_error(BOOTSTAGE_ID_IDE_PART_READ);
return 1;
}
-   show_boot_progress(48);
+   show_boot_progress(BOOTSTAGE_ID_IDE_PART_READ);
 
switch (genimg_get_format((void *) addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *) addr;
 
-   show_boot_progress(49);
+   show_boot_progress(BOOTSTAGE_ID_IDE_FORMAT);
 
if (!image_check_hcrc(hdr)) {
puts("\n** Bad Header Checksum **\n");
-   show_boot_error(50);
+   show_boot_error(BOOTSTAGE_ID_IDE_CHECKSUM);
return 1;
}
-   show_boot_progress(50);
+   show_boot_progress(BOOTSTAGE_ID_IDE_CHECKSUM);
 
image_print_contents(hdr);
 
@@ -447,7 +447,7 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
break;
 #endif
default:
-   show_boot_error(49);
+   show_boot_error(BOOTSTAGE_ID_IDE_FORMAT);
puts("** Unknown image type\n");
return 1;
}
@@ -459,20 +459,20 @@ int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
if (ide_dev_desc[dev].block_read(dev, info.start + 1, cnt,
  

[U-Boot] [RFC PATCH v2 09/15] bootstage: Convert net progress numbers to enums

2011-12-10 Thread Simon Glass
This changes over the network-related progress numbers to use enums
from bootstage.h.

Signed-off-by: Simon Glass 
---

 board/Seagate/dockstar/dockstar.c   |2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c |2 +-
 board/pcs440ep/pcs440ep.c   |   24 
 common/cmd_net.c|   16 
 common/env_common.c |2 +-
 include/bootstage.h |   11 +++
 net/eth.c   |6 +++---
 7 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/board/Seagate/dockstar/dockstar.c 
b/board/Seagate/dockstar/dockstar.c
index 8cbfb02..38473e5 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -172,7 +172,7 @@ void show_boot_progress(int val)
case BOOTSTAGE_ID_RUN_OS:   /* booting Linux */
set_leds(BOTH_LEDS, NEITHER_LED);
break;
-   case 64:/* Ethernet initialization */
+   case BOOTSTAGE_ID_NET_ETH_START:/* Ethernet initialization */
set_leds(GREEN_LED, GREEN_LED);
break;
default:
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c 
b/board/matrix_vision/mvbc_p/mvbc_p.c
index 7e06d6c..4b48a3c 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -244,7 +244,7 @@ void show_boot_progress(int val)
case BOOTSTAGE_ID_START: /* FPGA ok */
setbits_be32(&gpio->simple_dvo, LED_G0);
break;
-   case 65:
+   case BOOTSTAGE_ID_NET_ETH_INIT:
setbits_be32(&gpio->simple_dvo, LED_G1);
break;
case BOOTSTAGE_ID_COPY_RAMDISK:
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index f67eedd..746a54c 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -117,19 +117,19 @@ void show_boot_progress (int val)
status_led_set(2, STATUS_LED_ON);
break;
 #if 0
-   case 64:
-   /* starting Ethernet configuration */
-   status_led_set (0, STATUS_LED_OFF);
-   status_led_set (1, STATUS_LED_OFF);
-   status_led_set (2, STATUS_LED_ON);
-   break;
+   case BOOTSTAGE_ID_NET_ETH_START:
+   /* starting Ethernet configuration */
+   status_led_set(0, STATUS_LED_OFF);
+   status_led_set(1, STATUS_LED_OFF);
+   status_led_set(2, STATUS_LED_ON);
+   break;
 #endif
-   case 80:
-   /* loading Image */
-   status_led_set (0, STATUS_LED_ON);
-   status_led_set (1, STATUS_LED_OFF);
-   status_led_set (2, STATUS_LED_ON);
-   break;
+   case BOOTSTAGE_ID_NET_START:
+   /* loading Image */
+   status_led_set(0, STATUS_LED_ON);
+   status_led_set(1, STATUS_LED_OFF);
+   status_led_set(2, STATUS_LED_ON);
+   break;
}
 }
 #endif
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 6798b89..72595fd 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -227,36 +227,36 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t 
*cmdtp, int argc,
break;
 #endif
default:
-   show_boot_error(80);
+   show_boot_error(BOOTSTAGE_ID_NET_START);
return cmd_usage(cmdtp);
}
 
-   show_boot_progress (80);
+   show_boot_progress(BOOTSTAGE_ID_NET_START);
if ((size = NetLoop(proto)) < 0) {
-   show_boot_error(81);
+   show_boot_error(BOOTSTAGE_ID_NET_NETLOOP_OK);
return 1;
}
 
-   show_boot_progress (81);
+   show_boot_progress(BOOTSTAGE_ID_NET_NETLOOP_OK);
/* NetLoop ok, update environment */
netboot_update_env();
 
/* done if no file was loaded (no errors though) */
if (size == 0) {
-   show_boot_error(82);
+   show_boot_error(BOOTSTAGE_ID_NET_LOADED);
return 0;
}
 
/* flush cache */
flush_cache(load_addr, size);
 
-   show_boot_progress(82);
+   show_boot_progress(BOOTSTAGE_ID_NET_LOADED);
rcode = bootm_maybe_autostart(cmdtp, argv[0]);
 
if (rcode < 0)
-   show_boot_error(83);
+   show_boot_error(BOOTSTAGE_ID_NET_DONE_ERR);
else
-   show_boot_progress (84);
+   show_boot_progress(BOOTSTAGE_ID_NET_DONE);
return rcode;
 }
 
diff --git a/common/env_common.c b/common/env_common.c
index 4060c63..bb33220 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -221,7 +221,7 @@ void env_relocate(void)
 #if defined(CONFIG_ENV_IS_NOWHERE) /* Environment not changable */
set_default_env(NULL);
 #else
-   show_

[U-Boot] [RFC PATCH v2 13/15] bootstage: Add microsecond boot time measurement

2011-12-10 Thread Simon Glass
This defines the basics of a new boot time measurement feature. This allows
logging of very accurate time measurements as the boot proceeds, by using
an available microsecond counter.

To enable the feature, define CONFIG_BOOTSTAGE in your board config file.
Also available is CONFIG_BOOTSTAGE_REPORT which will cause a report to be
printed just before handing off to the OS.

Most IDs are not named at this stage. For that I would first like to
renumber them all.

Timer summary in microseconds:
   MarkElapsed  Stage
  0  0  reset
205,000205,000  board_init_f
  6,053,000  5,848,000  bootm_start
  6,053,000  0  id=1
  6,058,000  5,000  id=101
  6,058,000  0  id=100
  6,061,000  3,000  id=103
  6,064,000  3,000  id=104
  6,093,000 29,000  id=107
  6,093,000  0  id=106
  6,093,000  0  id=105
  6,093,000  0  id=108
  7,089,000996,000  id=7
  7,089,000  0  id=15
  7,089,000  0  id=8
  7,097,000  8,000  start_kernel

Signed-off-by: Simon Glass 
---

 README  |   25 
 common/Makefile |1 +
 common/bootstage.c  |  160 +++
 include/bootstage.h |   75 +++-
 4 files changed, 259 insertions(+), 2 deletions(-)
 create mode 100644 common/bootstage.c

diff --git a/README b/README
index e9d1891..20c09e6 100644
--- a/README
+++ b/README
@@ -2198,6 +2198,31 @@ The following options need to be configured:
example, some LED's) on your board. At the moment,
the following checkpoints are implemented:
 
+- Detailed boot stage timing
+   CONFIG_BOOTSTAGE
+   Define this option to get detailed timing of each stage
+   of the boot process.
+
+   CONFIG_BOOTSTAGE_USER_COUNT
+   This is the number of available user bootstage records.
+   Each time you call bootstage_mark(BOOTSTAGE_ID_ALLOC, ...)
+   a new ID will be allocated from this stash. If you exceed
+   the limit, recording will stop.
+
+   CONFIG_BOOTSTAGE_REPORT
+   Define this to print a report before boot, similar to this:
+
+   Timer summary in microseconds:
+  MarkElapsed  Stage
+ 0  0  reset
+ 3,575,678  3,575,678  board_init_f start
+ 3,575,695 17  arch_cpu_init A9
+ 3,575,777 82  arch_cpu_init done
+ 3,659,598 83,821  board_init_r start
+ 3,910,375250,777  main_loop
+29,916,167 26,005,792  bootm_start
+30,361,327445,160  start_kernel
+
 Legacy uImage format:
 
   Arg  Where   When
diff --git a/common/Makefile b/common/Makefile
index 1be7236..5530f2c 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -175,6 +175,7 @@ SPD := y
 endif
 COBJS-$(SPD) += ddr_spd.o
 COBJS-$(CONFIG_HWCONFIG) += hwconfig.o
+COBJS-$(CONFIG_BOOTSTAGE) += bootstage.o
 COBJS-$(CONFIG_CONSOLE_MUX) += iomux.o
 COBJS-y += flash.o
 COBJS-$(CONFIG_CMD_KGDB) += kgdb.o kgdb_stubs.o
diff --git a/common/bootstage.c b/common/bootstage.c
new file mode 100644
index 000..358e1ca
--- /dev/null
+++ b/common/bootstage.c
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2011, Google Inc. All rights reserved.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+
+/*
+ * This module records the progress of boot and arbitrary commands, and
+ * permits accurate timestamping of each.
+ *
+ * TBD: Pass timings to kernel in the FDT
+ */
+
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+enum bootstage_flags {
+   BOOTSTAGEF_ERROR= 1 << 0,   /* Error record */
+   BOOTSTAGEF_ALLOC= 1 << 1,   /* Allocate an id */
+};
+
+struct bootstage_record {
+   ulong time_us;
+   const char *name;
+   int flags;  /* see enum bootstage_flags */
+   enum bootstage_id id;
+};
+
+static struct bootstage_record record[BOOTSTAGE_ID_COUNT] = { {1} };
+static int next_id = BOOTSTAGE_ID_USER;
+
+ulong bootstage_add_record(enum bootstage_id id, const char *name,
+

[U-Boot] [RFC PATCH v2 06/15] bootstage: Convert progress numbers 20-41 to enums

2011-12-10 Thread Simon Glass
Signed-off-by: Simon Glass 
---

 arch/powerpc/lib/board.c  |2 +-
 arch/sparc/lib/board.c|2 +-
 arch/x86/lib/board.c  |   18 +-
 board/hermes/hermes.c |4 +++-
 board/pcs440ep/pcs440ep.c |3 ++-
 include/bootstage.h   |   25 +
 post/post.c   |4 ++--
 7 files changed, 43 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index b11ec8c..837c82d 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -1065,7 +1065,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 void hang(void)
 {
puts("### ERROR ### Please RESET the board ###\n");
-   show_boot_error(30);
+   show_boot_error(BOOTSTAGE_ID_NEED_RESET);
for (;;)
;
 }
diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c
index fcbc666..770136b 100644
--- a/arch/sparc/lib/board.c
+++ b/arch/sparc/lib/board.c
@@ -426,7 +426,7 @@ void hang(void)
 {
puts("### ERROR ### Please RESET the board ###\n");
 #ifdef CONFIG_SHOW_BOOT_PROGRESS
-   show_boot_error(30);
+   show_boot_error(BOOTSTAGE_ID_NEED_RESET);
 #endif
for (;;) ;
 }
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index d742fec..1f677cc 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -280,7 +280,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
static gd_t gd_data;
init_fnc_t **init_fnc_ptr;
 
-   show_boot_progress(0x21);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_INIT_R);
 
/* Global data pointer is now writable */
gd = &gd_data;
@@ -291,7 +291,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
gd->bd = &bd_data;
memset(gd->bd, 0, sizeof(bd_t));
-   show_boot_progress(0x22);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_GLOBAL_DATA);
 
gd->baudrate =  CONFIG_BAUDRATE;
 
@@ -302,7 +302,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
if ((*init_fnc_ptr)() != 0)
hang();
}
-   show_boot_progress(0x23);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_INIT_SEQ);
 
 #ifdef CONFIG_SERIAL_MULTI
serial_initialize();
@@ -312,14 +312,14 @@ void board_init_r(gd_t *id, ulong dest_addr)
/* configure available FLASH banks */
size = flash_init();
display_flash_config(size);
-   show_boot_progress(0x24);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_FLASH);
 #endif
 
-   show_boot_progress(0x25);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_FLASH_37);
 
/* initialize environment */
env_relocate();
-   show_boot_progress(0x26);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_ENV);
 
 
 #ifdef CONFIG_CMD_NET
@@ -334,7 +334,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
pci_init();
 #endif
 
-   show_boot_progress(0x27);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_PCI);
 
 
stdio_init();
@@ -363,7 +363,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
/* enable exceptions */
enable_interrupts();
-   show_boot_progress(0x28);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_INTERRUPTS);
 
 #ifdef CONFIG_STATUS_LED
status_led_set(STATUS_LED_BOOT, STATUS_LED_BLINKING);
@@ -432,7 +432,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
post_run(NULL, POST_RAM | post_bootmode_get(0));
 #endif
 
-   show_boot_progress(0x29);
+   show_boot_progress(BOOTSTAGE_ID_BOARD_DONE);
 
/* main_loop() can return to retry autoboot, if so just run it again. */
for (;;)
diff --git a/board/hermes/hermes.c b/board/hermes/hermes.c
index 1b40ae8..38bab03 100644
--- a/board/hermes/hermes.c
+++ b/board/hermes/hermes.c
@@ -595,7 +595,9 @@ void show_boot_progress (int status)
 {
volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
 
-   if (status < -32) status = -1;  /* let things compatible */
+   /* let things compatible */
+   if (status < -BOOTSTAGE_ID_POST_FAIL_R)
+   status = -1;
status ^= 0x0F;
status = (status & 0x0F) << 14;
immr->im_cpm.cp_pbdat = (immr->im_cpm.cp_pbdat & ~PB_LED_ALL) | status;
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 118d81c..f67eedd 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -97,7 +97,8 @@ static void status_led_blink (void)
 void show_boot_progress (int val)
 {
/* find all valid Codes for val in README */
-   if (val == -30) return;
+   if (val == -BOOTSTAGE_ID_NEED_RESET)
+   return;
if (val < 0) {
/* smthing goes wrong */
status_led_blink ();
diff --git a/include/bootstage.h b/include/bootstage.h
index 8c5a92e..4b8d818 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -68,6 +68,31 @@ enum bootstage_id {
BOOTSTAGE_ID_NO_RAMDISK,/* No ram disk found (not an error) */
 
BOOTSTAGE_ID_RUN_OS = 15,   /* Exiti

[U-Boot] [RFC PATCH v2 15/15] bootstage: arm: Add bootstage calls in board and bootm

2011-12-10 Thread Simon Glass
Add calls to bootstage before and after relocation, and just
before jumping to the OS.

Signed-off-by: Simon Glass 
---
Changes in v2:
- Unify show_boot_progress() into this series

 arch/arm/lib/board.c |3 +++
 arch/arm/lib/bootm.c |4 
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 3d78274..e4b243b 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -266,6 +266,8 @@ void board_init_f(ulong bootflag)
ulong reg;
 #endif
 
+   bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_R, "board_init_r");
+
/* Pointer is writable since we allocated a register for it */
gd = (gd_t *) ((CONFIG_SYS_INIT_SP_ADDR) & ~0x07);
/* compiler optimization barrier needed for GCC >= 3.4 */
@@ -455,6 +457,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
gd = id;
 
gd->flags |= GD_FLG_RELOC;  /* tell others: relocation done */
+   bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f");
 
monitor_flash_len = _end_ofs;
 
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index c400a50..4cd37e9 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -83,6 +83,10 @@ void arch_lmb_reserve(struct lmb *lmb)
 static void announce_and_cleanup(void)
 {
printf("\nStarting kernel ...\n\n");
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTM_HANDOFF, "start_kernel");
+#ifdef CONFIG_BOOTSTAGE_REPORT
+   bootstage_report();
+#endif
 
 #ifdef CONFIG_USB_DEVICE
{
-- 
1.7.3.1

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


[U-Boot] [RFC PATCH v2 10/15] bootstage: Convert FIT progress numbers to enums

2011-12-10 Thread Simon Glass
This changes over all the FIT image progress numbers to use enums
from bootstage.h.

Signed-off-by: Simon Glass 
---

 common/cmd_bootm.c  |   44 ++--
 common/image.c  |   36 
 include/bootstage.h |   38 ++
 3 files changed, 80 insertions(+), 38 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 9ab1c61..44a9ded 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -222,21 +222,21 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
if (fit_image_get_type(images.fit_hdr_os,
images.fit_noffset_os, 
&images.os.type)) {
puts("Can't get image type!\n");
-   show_boot_error(109);
+   show_boot_error(BOOTSTAGE_ID_FIT_TYPE);
return 1;
}
 
if (fit_image_get_comp(images.fit_hdr_os,
images.fit_noffset_os, 
&images.os.comp)) {
puts("Can't get image compression!\n");
-   show_boot_error(110);
+   show_boot_error(BOOTSTAGE_ID_FIT_COMPRESSION);
return 1;
}
 
if (fit_image_get_os(images.fit_hdr_os,
images.fit_noffset_os, &images.os.os)) {
puts("Can't get image OS!\n");
-   show_boot_error(111);
+   show_boot_error(BOOTSTAGE_ID_FIT_OS);
return 1;
}
 
@@ -245,7 +245,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os,
&images.os.load)) {
puts("Can't get image load address!\n");
-   show_boot_error(112);
+   show_boot_error(BOOTSTAGE_ID_FIT_LOADADDR);
return 1;
}
break;
@@ -648,7 +648,7 @@ int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
} else {
puts("ERROR: new format image overwritten - "
"must RESET the board to recover\n");
-   show_boot_error(113);
+   show_boot_error(BOOTSTAGE_ID_OVERWRITTEN);
do_reset(cmdtp, flag, argc, argv);
}
}
@@ -789,28 +789,28 @@ static int fit_check_kernel(const void *fit, int 
os_noffset, int verify)
puts("   Verifying Hash Integrity ... ");
if (!fit_image_check_hashes(fit, os_noffset)) {
puts("Bad Data Hash\n");
-   show_boot_error(104);
+   show_boot_error(BOOTSTAGE_ID_FIT_CHECK_HASH);
return 0;
}
puts("OK\n");
}
-   show_boot_progress(105);
+   show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_ARCH);
 
if (!fit_image_check_target_arch(fit, os_noffset)) {
puts("Unsupported Architecture\n");
-   show_boot_error(105);
+   show_boot_error(BOOTSTAGE_ID_FIT_CHECK_ARCH);
return 0;
}
 
-   show_boot_progress(106);
+   show_boot_progress(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
if (!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL) &&
!fit_image_check_type(fit, os_noffset, IH_TYPE_KERNEL_NOLOAD)) {
puts("Not a kernel image\n");
-   show_boot_error(106);
+   show_boot_error(BOOTSTAGE_ID_FIT_CHECK_KERNEL);
return 0;
}
 
-   show_boot_progress(107);
+   show_boot_progress(BOOTSTAGE_ID_FIT_CHECKED);
return 1;
 }
 #endif /* CONFIG_FIT */
@@ -921,10 +921,10 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, 
int argc,
 
if (!fit_check_format(fit_hdr)) {
puts("Bad FIT kernel image format!\n");
-   show_boot_error(100);
+   show_boot_error(BOOTSTAGE_ID_FIT_FORMAT);
return NULL;
}
-   show_boot_progress(100);
+   show_boot_progress(BOOTSTAGE_ID_FIT_FORMAT);
 
if (!fit_uname_kernel) {
/*
@@ -933,11 +933,11 @@ static void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, 
int argc,
 * fit_conf_get_node() will try to find default config
 * node
 */
-   show_boot_progress(101);
+   show_boot_progress(BOOTSTAGE_ID_FIT_NO_UNIT_NAME);

[U-Boot] [RFC PATCH v2 14/15] bootstage: Plumb in bootstage calls for basic operations

2011-12-10 Thread Simon Glass
This inserts bootstage calls into tftp, usb start and bootm. We
could go further, but this is a reasonable start to illustrate
the concept.

Signed-off-by: Simon Glass 
---

 common/cmd_bootm.c |2 ++
 common/cmd_net.c   |7 ++-
 common/cmd_usb.c   |1 +
 net/bootp.c|4 
 net/net.c  |1 +
 5 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 7e780fb..7536f34 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -199,6 +199,8 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
 
bootm_start_lmb();
 
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTM_START, "bootm_start");
+
/* get kernel image header, start address and length */
os_hdr = boot_get_kernel(cmdtp, flag, argc, argv,
&images, &images.os.image_start, &images.os.image_len);
diff --git a/common/cmd_net.c b/common/cmd_net.c
index 71b5b20..23340d4 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -43,7 +43,12 @@ U_BOOT_CMD(
 
 int do_tftpb (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
-   return netboot_common(TFTPGET, cmdtp, argc, argv);
+   int ret;
+
+   bootstage_mark_name(BOOTSTAGE_KERNELREAD_START, "tftp_start");
+   ret = netboot_common(TFTPGET, cmdtp, argc, argv);
+   bootstage_mark_name(BOOTSTAGE_KERNELREAD_STOP, "tftp_done");
+   return ret;
 }
 
 U_BOOT_CMD(
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 8c87265..d33992b 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -512,6 +512,7 @@ int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
if ((strncmp(argv[1], "reset", 5) == 0) ||
 (strncmp(argv[1], "start", 5) == 0)) {
+   bootstage_mark_name(BOOTSTAGE_ID_USB_START, "usb_start");
usb_stop();
printf("(Re)start USB...\n");
i = usb_init();
diff --git a/net/bootp.c b/net/bootp.c
index 34124b8..9e32476 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -322,6 +322,7 @@ BootpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, 
unsigned src,
BootpVendorProcess((uchar *)&bp->bp_vend[4], len);
 
NetSetTimeout(0, (thand_f *)0);
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP, "bootp_stop");
 
debug("Got good BOOTP\n");
 
@@ -589,6 +590,7 @@ BootpRequest (void)
Bootp_t *bp;
int ext_len, pktlen, iplen;
 
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTP_START, "bootp_start");
 #if defined(CONFIG_CMD_DHCP)
dhcp_state = INIT;
 #endif
@@ -949,6 +951,8 @@ DhcpHandler(uchar *pkt, unsigned dest, IPaddr_t sip, 
unsigned src,
BootpCopyNetParams(bp); /* Store net params from reply 
*/
dhcp_state = BOUND;
printf ("DHCP client bound to address %pI4\n", 
&NetOurIP);
+   bootstage_mark_name(BOOTSTAGE_ID_BOOTP_STOP,
+   "bootp_stop");
 
net_auto_load();
return;
diff --git a/net/net.c b/net/net.c
index 045405b..c5acf8f 100644
--- a/net/net.c
+++ b/net/net.c
@@ -402,6 +402,7 @@ int NetLoop(enum proto_t protocol)
NetArpWaitTxPacketSize = 0;
}
 
+   bootstage_mark_name(BOOTSTAGE_ID_ETH_START, "eth_start");
eth_halt();
eth_set_current();
if (eth_init(bd) < 0) {
-- 
1.7.3.1

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


[U-Boot] [RFC PATCH v2 11/15] bootstage: Define an optional microsecond timer

2011-12-10 Thread Simon Glass
Define timer_get_boot_us() which returns the number of microseconds
since boot. If undefined then we use get_timer() * 1000.

We can fit this in a 32-bit register which keeps everyone happy on
the efficiency side. It will wrap around after about an hour. If we
are still looking at it after an hour then we had better not be
timing the boot.

Signed-off-by: Simon Glass 
---

 include/common.h |7 +++
 lib/time.c   |   17 +
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/include/common.h b/include/common.h
index e918ca0..af41c8f 100644
--- a/include/common.h
+++ b/include/common.h
@@ -207,6 +207,13 @@ typedef void (interrupt_handler_t)(void *);
 #endif /* CONFIG_SERIAL_MULTI */
 
 /*
+ * Return the time since boot in microseconds, This is needed for bootstage
+ * and should be defined in CPU- or board-specific code. If undefined then
+ * millisecond resolution will be used (the standard get_timer()).
+ */
+ulong timer_get_boot_us(void);
+
+/*
  * General Purpose Utilities
  */
 #define min(X, Y)  \
diff --git a/lib/time.c b/lib/time.c
index 6e2937b..69edc3d 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -47,3 +47,20 @@ void mdelay(unsigned long msec)
while (msec--)
udelay(1000);
 }
+
+ulong __timer_get_boot_us(void)
+{
+   static ulong base_time;
+
+   /*
+* We can't implement this properly. Return 0 on the first call and
+* larger values after that.
+*/
+   if (base_time)
+   return get_timer(base_time) * 1000;
+   base_time = get_timer(0);
+   return 0;
+}
+
+ulong timer_get_boot_us(void)
+   __attribute__((weak, alias("__timer_get_boot_us")));
-- 
1.7.3.1

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


[U-Boot] [RFC PATCH v2 12/15] bootstage: Replace show_boot_progress/error() with bootstage_...()

2011-12-10 Thread Simon Glass
These calls should not be made directly any more, since bootstage
will call the show_boot_...() functions as needed.

Signed-off-by: Simon Glass 
---

 arch/arm/lib/bootm.c   |2 +-
 arch/avr32/lib/bootm.c |2 +-
 arch/m68k/lib/bootm.c  |2 +-
 arch/microblaze/lib/bootm.c|2 +-
 arch/mips/lib/bootm.c  |2 +-
 arch/mips/lib/bootm_qemu_mips.c|2 +-
 arch/nds32/lib/bootm.c |2 +-
 arch/powerpc/lib/board.c   |2 +-
 arch/powerpc/lib/bootm.c   |2 +-
 arch/sparc/lib/board.c |2 +-
 arch/x86/lib/board.c   |   19 +++
 board/hermes/hermes.c  |2 +-
 board/matrix_vision/common/mv_common.c |2 +-
 board/scb9328/scb9328.c|6 --
 common/cmd_bootm.c |   92 
 common/cmd_ide.c   |   46 
 common/cmd_nand.c  |   34 ++--
 common/cmd_net.c   |   16 +++---
 common/env_common.c|2 +-
 common/image.c |   52 +-
 net/eth.c  |6 +-
 post/post.c|4 +-
 22 files changed, 147 insertions(+), 154 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 2751f44..c400a50 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -113,7 +113,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
printf ("Using machid 0x%x from environment\n", machid);
}
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef CONFIG_OF_LIBFDT
if (images->ft_len)
diff --git a/arch/avr32/lib/bootm.c b/arch/avr32/lib/bootm.c
index f180737..74ebeca 100644
--- a/arch/avr32/lib/bootm.c
+++ b/arch/avr32/lib/bootm.c
@@ -192,7 +192,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
 
theKernel = (void *)images->ep;
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
params = params_start = (struct tag *)gd->bd->bi_boot_params;
params = setup_start_tag(params);
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 233782b..d506d0c 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -104,7 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
debug("## Transferring control to Linux (at address %08lx) ...\n",
  (ulong) kernel);
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
/*
 * Linux Kernel Parameters (passing board info data):
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 24b9e09..95cee50 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -59,7 +59,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
if (ret)
return 1;
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
if (!of_flat_tree && argc > 3)
of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16);
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 5b7e74f..9930abf 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -56,7 +56,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images->ep;
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef DEBUG
printf ("## Transferring control to Linux (at address %08lx) ...\n",
diff --git a/arch/mips/lib/bootm_qemu_mips.c b/arch/mips/lib/bootm_qemu_mips.c
index 47f5310..bb6442a 100644
--- a/arch/mips/lib/bootm_qemu_mips.c
+++ b/arch/mips/lib/bootm_qemu_mips.c
@@ -39,7 +39,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images->ep;
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
debug ("## Transferring control to Linux (at address %08lx) ...\n",
(ulong) theKernel);
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index 5ae90fb..03f58bf 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -69,7 +69,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
printf("Using machid 0x%x from environment\n", machid);
}
 
-   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
+   bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
debug(

[U-Boot] [RFC PATCH v2 08/15] bootstage: Convert NAND progress numbers to enums

2011-12-10 Thread Simon Glass
This changes over the NAND progress numbers to use enums from
bootstage.h.

Signed-off-by: Simon Glass 
---

 common/cmd_nand.c   |   34 +-
 include/bootstage.h |   15 +++
 2 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index e294b3e..1cfa247 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -787,7 +787,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t 
*nand,
if (s != NULL &&
(strcmp(s, ".jffs2") && strcmp(s, ".e") && strcmp(s, ".i"))) {
printf("Unknown nand load suffix '%s'\n", s);
-   show_boot_error(53);
+   show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
return 1;
}
 
@@ -797,16 +797,16 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t 
*nand,
r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
if (r) {
puts("** Read error\n");
-   show_boot_error(56);
+   show_boot_error(BOOTSTAGE_ID_NAND_HDR_READ);
return 1;
}
-   show_boot_progress (56);
+   show_boot_progress(BOOTSTAGE_ID_NAND_HDR_READ);
 
switch (genimg_get_format ((void *)addr)) {
case IMAGE_FORMAT_LEGACY:
hdr = (image_header_t *)addr;
 
-   show_boot_progress (57);
+   show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
image_print_contents (hdr);
 
cnt = image_get_image_size (hdr);
@@ -820,29 +820,29 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t 
*nand,
break;
 #endif
default:
-   show_boot_error(57);
+   show_boot_error(BOOTSTAGE_ID_NAND_TYPE);
puts ("** Unknown image type\n");
return 1;
}
-   show_boot_progress (57);
+   show_boot_progress(BOOTSTAGE_ID_NAND_TYPE);
 
r = nand_read_skip_bad(nand, offset, &cnt, (u_char *) addr);
if (r) {
puts("** Read error\n");
-   show_boot_error(58);
+   show_boot_error(BOOTSTAGE_ID_NAND_READ);
return 1;
}
-   show_boot_progress (58);
+   show_boot_progress(BOOTSTAGE_ID_NAND_READ);
 
 #if defined(CONFIG_FIT)
/* This cannot be done earlier, we need complete FIT image in RAM first 
*/
if (genimg_get_format ((void *)addr) == IMAGE_FORMAT_FIT) {
if (!fit_check_format (fit_hdr)) {
-   show_boot_error(150);
+   show_boot_error(BOOTSTAGE_ID_NAND_FIT_READ);
puts ("** Bad FIT image format\n");
return 1;
}
-   show_boot_progress (151);
+   show_boot_progress(BOOTSTAGE_ID_NAND_FIT_READ_OK);
fit_print_contents (fit_hdr);
}
 #endif
@@ -884,7 +884,7 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, char 
* const argv[])
}
 #endif
 
-   show_boot_progress(52);
+   show_boot_progress(BOOTSTAGE_ID_NAND_PART);
switch (argc) {
case 1:
addr = CONFIG_SYS_LOAD_ADDR;
@@ -907,26 +907,26 @@ int do_nandboot(cmd_tbl_t * cmdtp, int flag, int argc, 
char * const argv[])
 #if defined(CONFIG_CMD_MTDPARTS)
 usage:
 #endif
-   show_boot_error(53);
+   show_boot_error(BOOTSTAGE_ID_NAND_SUFFIX);
return cmd_usage(cmdtp);
}
 
-   show_boot_progress(53);
+   show_boot_progress(BOOTSTAGE_ID_NAND_SUFFIX);
if (!boot_device) {
puts("\n** No boot device **\n");
-   show_boot_error(54);
+   show_boot_error(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
return 1;
}
-   show_boot_progress(54);
+   show_boot_progress(BOOTSTAGE_ID_NAND_BOOT_DEVICE);
 
idx = simple_strtoul(boot_device, NULL, 16);
 
if (idx < 0 || idx >= CONFIG_SYS_MAX_NAND_DEVICE || 
!nand_info[idx].name) {
printf("\n** Device %d not available\n", idx);
-   show_boot_error(55);
+   show_boot_error(BOOTSTAGE_ID_NAND_AVAILABLE);
return 1;
}
-   show_boot_progress(55);
+   show_boot_progress(BOOTSTAGE_ID_NAND_AVAILABLE);
 
return nand_load_image(cmdtp, &nand_info[idx], offset, addr, argv[0]);
 }
diff --git a/include/bootstage.h b/include/bootstage.h
index 676c38e..6e0cb39 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -107,6 +107,21 @@ enum bootstage_id {
 
BOOTSTAGE_ID_IDE_CHECKSUM,  /* 50 */
BOOTSTAGE_ID_IDE_READ,
+
+   /* Boot stages related to loading a kernel from an NAND device */
+   BOOTSTAGE_ID_NAND_PART,
+   BOOTSTAGE_ID_NAND_SUFFIX,
+   BOOTSTAGE_ID_NAND_BOOT_DEVICE,
+   BOOTSTAGE_ID_NAND_HDR_READ = 55,
+   BOOTSTAGE_ID_NAND_AVAILABLE = 55,
+   BOOTSTAGE_ID_NAND_TYPE = 57,
+   BOOTSTAGE_ID_NAND_

[U-Boot] [RFC PATCH v2 03/15] bootstage: Use show_boot_error() for -ve progress numbers

2011-12-10 Thread Simon Glass
Rather than the caller negating our progress numbers to indicate an
error has occurred, which seems hacky, add a function to indicate this.

Signed-off-by: Simon Glass 
---

 arch/powerpc/lib/board.c |2 +-
 arch/sparc/lib/board.c   |2 +-
 common/cmd_bootm.c   |   50 +++---
 common/cmd_ide.c |   22 ++--
 common/cmd_nand.c|   16 +++---
 common/cmd_net.c |8 +++---
 common/env_common.c  |2 +-
 common/image.c   |   22 ++--
 include/bootstage.h  |4 +++
 net/eth.c|2 +-
 post/post.c  |4 +-
 11 files changed, 69 insertions(+), 65 deletions(-)

diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index ff5888e..b11ec8c 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -1065,7 +1065,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 void hang(void)
 {
puts("### ERROR ### Please RESET the board ###\n");
-   show_boot_progress(-30);
+   show_boot_error(30);
for (;;)
;
 }
diff --git a/arch/sparc/lib/board.c b/arch/sparc/lib/board.c
index 519a4fb..fcbc666 100644
--- a/arch/sparc/lib/board.c
+++ b/arch/sparc/lib/board.c
@@ -426,7 +426,7 @@ void hang(void)
 {
puts("### ERROR ### Please RESET the board ###\n");
 #ifdef CONFIG_SHOW_BOOT_PROGRESS
-   show_boot_progress(-30);
+   show_boot_error(30);
 #endif
for (;;) ;
 }
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 6edee3f..450fa5c 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -222,21 +222,21 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
if (fit_image_get_type(images.fit_hdr_os,
images.fit_noffset_os, 
&images.os.type)) {
puts("Can't get image type!\n");
-   show_boot_progress(-109);
+   show_boot_error(109);
return 1;
}
 
if (fit_image_get_comp(images.fit_hdr_os,
images.fit_noffset_os, 
&images.os.comp)) {
puts("Can't get image compression!\n");
-   show_boot_progress(-110);
+   show_boot_error(110);
return 1;
}
 
if (fit_image_get_os(images.fit_hdr_os,
images.fit_noffset_os, &images.os.os)) {
puts("Can't get image OS!\n");
-   show_boot_progress(-111);
+   show_boot_error(111);
return 1;
}
 
@@ -245,7 +245,7 @@ static int bootm_start(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[]
if (fit_image_get_load(images.fit_hdr_os, images.fit_noffset_os,
&images.os.load)) {
puts("Can't get image load address!\n");
-   show_boot_progress(-112);
+   show_boot_error(112);
return 1;
}
break;
@@ -348,7 +348,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
puts("GUNZIP: uncompress, out-of-mem or overwrite "
"error - must RESET board to recover\n");
if (boot_progress)
-   show_boot_progress(-6);
+   show_boot_error(6);
return BOOTM_ERR_RESET;
}
 
@@ -370,7 +370,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
printf("BUNZIP2: uncompress or overwrite error %d "
"- must RESET board to recover\n", i);
if (boot_progress)
-   show_boot_progress(-6);
+   show_boot_error(6);
return BOOTM_ERR_RESET;
}
 
@@ -389,7 +389,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
if (ret != SZ_OK) {
printf("LZMA: uncompress or overwrite error %d "
"- must RESET board to recover\n", ret);
-   show_boot_progress(-6);
+   show_boot_error(6);
return BOOTM_ERR_RESET;
}
*load_end = load + unc_len;
@@ -407,7 +407,7 @@ static int bootm_load_os(image_info_t os, ulong *load_end, 
int boot_progress)
printf("LZO: uncompress or overwrite error %d "
  "- must RESET board to recover\n", ret);
if (boot_progress)
-   show

[U-Boot] [RFC PATCH v2 05/15] bootstage: Convert progress numbers 10-19 to enums

2011-12-10 Thread Simon Glass
Signed-off-by: Simon Glass 
---

 board/bf533-stamp/bf533-stamp.c |   10 +-
 board/matrix_vision/mvbc_p/mvbc_p.c |2 +-
 common/image.c  |   20 ++--
 include/bootstage.h |7 +++
 4 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index 07a988a..4d36160 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -112,11 +112,11 @@ void show_boot_progress(int status)
stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
break;
case BOOTSTAGE_ID_BOOT_OS_RETURNED:
-   case 10:
-   case 11:
-   case 12:
-   case 13:
-   case 14:
+   case BOOTSTAGE_ID_RD_MAGIC:
+   case BOOTSTAGE_ID_RD_HDR_CHECKSUM:
+   case BOOTSTAGE_ID_RD_CHECKSUM:
+   case BOOTSTAGE_ID_RAMDISK:
+   case BOOTSTAGE_ID_NO_RAMDISK:
case BOOTSTAGE_ID_RUN_OS:
stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
break;
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c 
b/board/matrix_vision/mvbc_p/mvbc_p.c
index a5dc2f0..7e06d6c 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -247,7 +247,7 @@ void show_boot_progress(int val)
case 65:
setbits_be32(&gpio->simple_dvo, LED_G1);
break;
-   case 12:
+   case BOOTSTAGE_ID_COPY_RAMDISK:
setbits_be32(&gpio->simple_dvo, LED_Y);
break;
case BOOTSTAGE_ID_RUN_OS:
diff --git a/common/image.c b/common/image.c
index 7933446..20f3f82 100644
--- a/common/image.c
+++ b/common/image.c
@@ -372,37 +372,37 @@ static const image_header_t *image_get_ramdisk(ulong 
rd_addr, uint8_t arch,
 
if (!image_check_magic(rd_hdr)) {
puts("Bad Magic Number\n");
-   show_boot_error(10);
+   show_boot_error(BOOTSTAGE_ID_RD_MAGIC);
return NULL;
}
 
if (!image_check_hcrc(rd_hdr)) {
puts("Bad Header Checksum\n");
-   show_boot_error(11);
+   show_boot_error(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
return NULL;
}
 
-   show_boot_progress(10);
+   show_boot_progress(BOOTSTAGE_ID_RD_MAGIC);
image_print_contents(rd_hdr);
 
if (verify) {
puts("   Verifying Checksum ... ");
if (!image_check_dcrc(rd_hdr)) {
puts("Bad Data CRC\n");
-   show_boot_error(12);
+   show_boot_error(BOOTSTAGE_ID_RD_CHECKSUM);
return NULL;
}
puts("OK\n");
}
 
-   show_boot_progress(11);
+   show_boot_progress(BOOTSTAGE_ID_RD_HDR_CHECKSUM);
 
if (!image_check_os(rd_hdr, IH_OS_LINUX) ||
!image_check_arch(rd_hdr, arch) ||
!image_check_type(rd_hdr, IH_TYPE_RAMDISK)) {
printf("No Linux %s Ramdisk Image\n",
genimg_get_arch_name(arch));
-   show_boot_error(13);
+   show_boot_error(BOOTSTAGE_ID_RAMDISK);
return NULL;
}
 
@@ -894,7 +894,7 @@ int boot_get_ramdisk(int argc, char * const argv[], 
bootm_headers_t *images,
printf("## Loading init Ramdisk from Legacy "
"Image at %08lx ...\n", rd_addr);
 
-   show_boot_progress(BOOTSTAGE_ID_LOAD_RAMDISK);
+   show_boot_progress(BOOTSTAGE_ID_CHECK_RAMDISK);
rd_hdr = image_get_ramdisk(rd_addr, arch,
images->verify);
 
@@ -1001,7 +1001,7 @@ int boot_get_ramdisk(int argc, char * const argv[], 
bootm_headers_t *images,
 * Now check if we have a legacy mult-component image,
 * get second entry data start address and len.
 */
-   show_boot_progress(13);
+   show_boot_progress(BOOTSTAGE_ID_RAMDISK);
printf("## Loading init Ramdisk from multi component "
"Legacy Image at %08lx ...\n",
(ulong)images->legacy_hdr_os);
@@ -1011,7 +1011,7 @@ int boot_get_ramdisk(int argc, char * const argv[], 
bootm_headers_t *images,
/*
 * no initrd image
 */
-   show_boot_progress(14);
+   show_boot_progress(BOOTSTAGE_ID_NO_RAMDISK);
rd_len = rd_data = 0;
}
 
@@ -1095,7 +1095,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, 
ulong rd_len,
puts("ramdisk - allocation error\n");
goto error;
}
-   show_boot_progress(12);
+   

[U-Boot] [RFC PATCH v2 02/15] bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()

2011-12-10 Thread Simon Glass
This changes the number 15 as used in boot_stage_progress() to use the
new name provided for it. This is a separate patch because it touches
so many files.

Signed-off-by: Simon Glass 
---

 arch/arm/lib/bootm.c|2 +-
 arch/avr32/lib/bootm.c  |2 +-
 arch/m68k/lib/bootm.c   |2 +-
 arch/microblaze/lib/bootm.c |2 +-
 arch/mips/lib/bootm.c   |2 +-
 arch/mips/lib/bootm_qemu_mips.c |2 +-
 arch/nds32/lib/bootm.c  |2 +-
 arch/powerpc/lib/bootm.c|2 +-
 board/Seagate/dockstar/dockstar.c   |2 +-
 board/a4m072/a4m072.c   |2 +-
 board/bf533-stamp/bf533-stamp.c |2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c |2 +-
 board/pcs440ep/pcs440ep.c   |3 +--
 board/sixnet/sixnet.c   |2 +-
 board/ti/beagle/beagle.c|2 +-
 common/cmd_bootm.c  |8 
 16 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 802e833..2751f44 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -113,7 +113,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
printf ("Using machid 0x%x from environment\n", machid);
}
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef CONFIG_OF_LIBFDT
if (images->ft_len)
diff --git a/arch/avr32/lib/bootm.c b/arch/avr32/lib/bootm.c
index c9a55ff..f180737 100644
--- a/arch/avr32/lib/bootm.c
+++ b/arch/avr32/lib/bootm.c
@@ -192,7 +192,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
 
theKernel = (void *)images->ep;
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
params = params_start = (struct tag *)gd->bd->bi_boot_params;
params = setup_start_tag(params);
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 1229ac7..233782b 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -104,7 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
debug("## Transferring control to Linux (at address %08lx) ...\n",
  (ulong) kernel);
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
/*
 * Linux Kernel Parameters (passing board info data):
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 9f6d6d6..24b9e09 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -59,7 +59,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
if (ret)
return 1;
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
if (!of_flat_tree && argc > 3)
of_flat_tree = (char *)simple_strtoul(argv[3], NULL, 16);
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index 40a5647..5b7e74f 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -56,7 +56,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images->ep;
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
 #ifdef DEBUG
printf ("## Transferring control to Linux (at address %08lx) ...\n",
diff --git a/arch/mips/lib/bootm_qemu_mips.c b/arch/mips/lib/bootm_qemu_mips.c
index f1906c6..47f5310 100644
--- a/arch/mips/lib/bootm_qemu_mips.c
+++ b/arch/mips/lib/bootm_qemu_mips.c
@@ -39,7 +39,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], 
bootm_headers_t *ima
/* find kernel entry point */
theKernel = (void (*)(int, char **, char **, int *))images->ep;
 
-   show_boot_progress (15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
debug ("## Transferring control to Linux (at address %08lx) ...\n",
(ulong) theKernel);
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index b0a5a0d..5ae90fb 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -69,7 +69,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], 
bootm_headers_t *images)
printf("Using machid 0x%x from environment\n", machid);
}
 
-   show_boot_progress(15);
+   show_boot_progress(BOOTSTAGE_ID_RUN_OS);
 
debug("## Transferring control to Linux (at address %08lx) ...\n",
   (ulong)theKernel);
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 8233f1f..e448f6c 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -69,7 +69,7 @@ static void boot_jump_linux(bootm_headers_t *images)
debug ("## Transferring control to Linux (at address %08lx) ...\n",
(ulong)kernel);
 
-   show_boot_progress (15);
+ 

[U-Boot] [RFC PATCH v2 04/15] bootstage: Convert progress numbers 1-9 into enums

2011-12-10 Thread Simon Glass
Signed-off-by: Simon Glass 
---

 board/bf533-stamp/bf533-stamp.c|   18 +++---
 board/hermes/hermes.c  |2 +-
 board/ivm/ivm.c|2 +-
 board/matrix_vision/common/mv_common.c |2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c|2 +-
 board/pcs440ep/pcs440ep.c  |   22 
 common/cmd_bootm.c |   41 +++
 common/image.c |2 +-
 include/bootstage.h|   14 +++
 9 files changed, 59 insertions(+), 46 deletions(-)

diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index b1134e9..07a988a 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -91,27 +91,27 @@ static void stamp_led_set(int LED1, int LED2, int LED3)
 void show_boot_progress(int status)
 {
switch (status) {
-   case 1:
+   case BOOTSTAGE_ID_CHECK_MAGIC:
stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
break;
-   case 2:
+   case BOOTSTAGE_ID_CHECK_HEADER:
stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
break;
-   case 3:
+   case BOOTSTAGE_ID_CHECK_CHECKSUM:
stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
break;
-   case 4:
+   case BOOTSTAGE_ID_CHECK_ARCH:
stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
break;
-   case 5:
-   case 6:
+   case BOOTSTAGE_ID_CHECK_IMAGETYPE:
+   case BOOTSTAGE_ID_DECOMP_IMAGE:
stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
break;
-   case 7:
-   case 8:
+   case BOOTSTAGE_ID_KERNEL_LOADED:
+   case BOOTSTAGE_ID_CHECK_BOOT_OS:
stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
break;
-   case 9:
+   case BOOTSTAGE_ID_BOOT_OS_RETURNED:
case 10:
case 11:
case 12:
diff --git a/board/hermes/hermes.c b/board/hermes/hermes.c
index acf364e..1b40ae8 100644
--- a/board/hermes/hermes.c
+++ b/board/hermes/hermes.c
@@ -370,7 +370,7 @@ static ulong board_init (void)
immr->im_ioport.iop_pcdat |= PC_REP_RES;
}
}
-   SHOW_BOOT_PROGRESS (0x00);
+   SHOW_BOOT_PROGRESS(BOOTSTAGE_ID_CHECK_MAGIC);
 
return ((revision << 16) | (speed & 0x));
 }
diff --git a/board/ivm/ivm.c b/board/ivm/ivm.c
index 9bec198..71d64d4 100644
--- a/board/ivm/ivm.c
+++ b/board/ivm/ivm.c
@@ -322,7 +322,7 @@ void show_boot_progress (int status)
(status < 0) ? STATUS_LED_ON : STATUS_LED_OFF);
 # endif/* STATUS_LED_YELLOW */
 # if defined(STATUS_LED_BOOT)
-   if (status == 6)
+   if (status == BOOTSTAGE_ID_DECOMP_IMAGE)
status_led_set (STATUS_LED_BOOT, STATUS_LED_OFF);
 # endif/* STATUS_LED_BOOT */
 #endif /* CONFIG_STATUS_LED */
diff --git a/board/matrix_vision/common/mv_common.c 
b/board/matrix_vision/common/mv_common.c
index acb72c5..7fde4ac 100644
--- a/board/matrix_vision/common/mv_common.c
+++ b/board/matrix_vision/common/mv_common.c
@@ -95,7 +95,7 @@ int mv_load_fpga(void)
 
result = fpga_load(0, fpga_data, data_size);
if (!result)
-   show_boot_progress(0);
+   show_boot_progress(BOOTSTAGE_ID_START);
 
return result;
 }
diff --git a/board/matrix_vision/mvbc_p/mvbc_p.c 
b/board/matrix_vision/mvbc_p/mvbc_p.c
index 9dffedc..a5dc2f0 100644
--- a/board/matrix_vision/mvbc_p/mvbc_p.c
+++ b/board/matrix_vision/mvbc_p/mvbc_p.c
@@ -241,7 +241,7 @@ void show_boot_progress(int val)
struct mpc5xxx_gpio *gpio = (struct mpc5xxx_gpio*)MPC5XXX_GPIO;
 
switch(val) {
-   case 0: /* FPGA ok */
+   case BOOTSTAGE_ID_START: /* FPGA ok */
setbits_be32(&gpio->simple_dvo, LED_G0);
break;
case 65:
diff --git a/board/pcs440ep/pcs440ep.c b/board/pcs440ep/pcs440ep.c
index 36994b5..118d81c 100644
--- a/board/pcs440ep/pcs440ep.c
+++ b/board/pcs440ep/pcs440ep.c
@@ -104,17 +104,17 @@ void show_boot_progress (int val)
return;
}
switch (val) {
-   case 1:
-   /* validating Image */
-   status_led_set (0, STATUS_LED_OFF);
-   status_led_set (1, STATUS_LED_ON);
-   status_led_set (2, STATUS_LED_ON);
-   break;
-   case BOOTSTAGE_ID_RUN_OS:
-   status_led_set (0, STATUS_LED_ON);
-   status_led_set (1, STATUS_LED_ON);
-   status_led_set (2, STATUS_LED_ON);
-   break;
+   case BOOTSTAGE_ID_CHECK_MAGIC:
+   /* validating Image */
+   status_led_set(0, STATUS_LED_OFF);
+   status_led

[U-Boot] [RFC PATCH v2 01/15] bootstage: Create an initial header for boot progress integers

2011-12-10 Thread Simon Glass
At present boot_stage_progress() is called with various magic numbers. The
new bootstage.h header will be used to turn these into symbolic names
throughout the code.

Signed-off-by: Simon Glass 
---

 include/bootstage.h |   61 +++
 include/common.h|6 +---
 2 files changed, 63 insertions(+), 4 deletions(-)
 create mode 100644 include/bootstage.h

diff --git a/include/bootstage.h b/include/bootstage.h
new file mode 100644
index 000..4a4300f
--- /dev/null
+++ b/include/bootstage.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _BOOTSTAGE_H
+#define _BOOTSTAGE_H
+
+/*
+ * This file implements recording of each stage of the boot process. It is
+ * intended to implement timing of each stage, reporting this information
+ * to the user and passing it to the OS for logging / further analysis.
+ */
+
+/*
+ * A list of boot stages that we know about. Each of these indicates the
+ * state that we are at, and the action that we are about to perform. For
+ * errors, we issue an error for an item when it fails. Therefore the
+ * normal sequence is:
+ *
+ * progres action1
+ * progres action2
+ * progres action3
+ *
+ * and an error condition where action 3 failed would be:
+ *
+ * progres action1
+ * progres action2
+ * progres action3
+ * error on action3
+ */
+enum bootstage_id {
+   BOOTSTAGE_ID_RUN_OS = 15,   /* Exiting U-Boot, entering OS */
+};
+
+/*
+ * Board-specific platform code can implement show_boot_progress () if
+ * needed.
+ *
+ * @param val  Progress state (enum bootstage_id), or -id if an error
+ * has occurred.
+ */
+void show_boot_progress(int val);
+
+#endif
diff --git a/include/common.h b/include/common.h
index 05a658c..e918ca0 100644
--- a/include/common.h
+++ b/include/common.h
@@ -801,10 +801,8 @@ intpcmcia_init (void);
 #ifdef CONFIG_STATUS_LED
 # include 
 #endif
-/*
- * Board-specific Platform code can reimplement show_boot_progress () if needed
- */
-void show_boot_progress(int val);
+
+#include 
 
 /* Multicore arch functions */
 #ifdef CONFIG_MP
-- 
1.7.3.1

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


[U-Boot] [RFC PATCH v2 0/15] bootstage: record and publish boot progress timing

2011-12-10 Thread Simon Glass
This series creates a simple boot progress timing feature in U-Boot.

Previous discussion on this is here:

http://lists.denx.de/pipermail/u-boot/2011-May/thread.html#92584

A request was made to unify this with show_boot_progress(). As discussed
in the v1 RFC patch, this series addresses this the following way:

1. Create bootstage.h with the intent of replacing integers with enums. This
will allow the values to be easily changed or rationalised later as required.
It also makes it more explicit that (for example) 15 means we are about to
run an OS.

2. Change show_boot_progress() to use these enums. This first patch just
shows doing this with one (commonly used) integer value.

3. Create bootstage.c file which permits recording of bootstage timestamps.

4. Change the existing show_boot_progress() handlers within board files to
use a provided bootstage progress handler instead. This is easy enough as
there are few users.

5. Change show_boot_progress() to call into bootstage, which in turns calls
the board-provided progress handler, if defined, after recording a timestamp.
The function signature will stay the same for now.

Ultimately I would like boot timing available from before U-Boot to user
space in Linux. See RFC patch for Linux here:

http://lwn.net/Articles/460432/

and discussion here:

http://comments.gmane.org/gmane.linux.kernel/1194861

Still to do: change the microsecond time printout to use the Linux
seconds.microseconds format.

Changes in v2:
- Unify show_boot_progress() into this series

Simon Glass (15):
  bootstage: Create an initial header for boot progress integers
  bootstage: Make use of BOOTSTAGE_ID_RUN_OS in show_boot_progress()
  bootstage: Use show_boot_error() for -ve progress numbers
  bootstage: Convert progress numbers 1-9 into enums
  bootstage: Convert progress numbers 10-19 to enums
  bootstage: Convert progress numbers 20-41 to enums
  bootstage: Convert IDE progress numbers to enums
  bootstage: Convert NAND progress numbers to enums
  bootstage: Convert net progress numbers to enums
  bootstage: Convert FIT progress numbers to enums
  bootstage: Define an optional microsecond timer
  bootstage: Replace show_boot_progress/error() with bootstage_...()
  bootstage: Add microsecond boot time measurement
  bootstage: Plumb in bootstage calls for basic operations
  bootstage: arm: Add bootstage calls in board and bootm

 README |   25 +++
 arch/arm/lib/board.c   |3 +
 arch/arm/lib/bootm.c   |6 +-
 arch/avr32/lib/bootm.c |2 +-
 arch/m68k/lib/bootm.c  |2 +-
 arch/microblaze/lib/bootm.c|2 +-
 arch/mips/lib/bootm.c  |2 +-
 arch/mips/lib/bootm_qemu_mips.c|2 +-
 arch/nds32/lib/bootm.c |2 +-
 arch/powerpc/lib/board.c   |2 +-
 arch/powerpc/lib/bootm.c   |2 +-
 arch/sparc/lib/board.c |2 +-
 arch/x86/lib/board.c   |   19 +--
 board/Seagate/dockstar/dockstar.c  |4 +-
 board/a4m072/a4m072.c  |2 +-
 board/bf533-stamp/bf533-stamp.c|   30 ++--
 board/hermes/hermes.c  |8 +-
 board/ivm/ivm.c|2 +-
 board/matrix_vision/common/mv_common.c |2 +-
 board/matrix_vision/mvbc_p/mvbc_p.c|8 +-
 board/pcs440ep/pcs440ep.c  |   50 +++---
 board/scb9328/scb9328.c|6 -
 board/sixnet/sixnet.c  |2 +-
 board/ti/beagle/beagle.c   |2 +-
 common/Makefile|1 +
 common/bootstage.c |  160 
 common/cmd_bootm.c |   95 ++--
 common/cmd_ide.c   |   46 +++---
 common/cmd_nand.c  |   34 ++--
 common/cmd_net.c   |   23 ++-
 common/cmd_usb.c   |1 +
 common/env_common.c|2 +-
 common/image.c |   56 ---
 include/bootstage.h|  260 
 include/common.h   |   13 +-
 lib/time.c |   17 ++
 net/bootp.c|4 +
 net/eth.c  |6 +-
 net/net.c  |1 +
 post/post.c|4 +-
 40 files changed, 698 insertions(+), 212 deletions(-)
 create mode 100644 common/bootstage.c
 create mode 100644 include/bootstage.h

-- 
1.7.3.1

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


Re: [U-Boot] is the online DULG-tqm8xxL guide reasonably up to date?

2011-12-10 Thread Anatolij Gustschin
Hello Robert,

On Sat, 10 Dec 2011 09:13:26 -0500 (EST)
"Robert P. J. Day"  wrote:
...
> > So the answer is: no, this document has notbeen maintained for a long.
> > long time.
> 
>   so ... if i ask questions *before* reading the docs, you'll snap at
> me.  and if i propose that i will *now* read the docs before asking
> any further technical questions, you will ... apparently snap at me.

i'm sorry i'm stepping in here, i'm sorry if my answer will offend you
in some way. My intention is surely not to offend you. But please, can
we stay constructive here.  The list is to discuss U-Boot development
and issues and to ask U-Boot related questions. I hope you got help
and some answers for your questions and could proceed. If something is
not clear, one can always ask again. If the documentation is not up
to date, there may be many reasons for this. tqm8xx is quite old HW
and most developers are focused on much newer hardware today.

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


[U-Boot] [PATCH v2 2/6] reboard: define CONFIG_SYS_SKIP_RELOC for all archs

2011-12-10 Thread Simon Glass
We are introducing a new generic relocation features and we want this to
be the default. So we need to opt all architectures out first. Some may
never have relocation, but those that do will eventually move over to
this generic relocation framework.

This is part of the unified board effort, but since we are only dealing
with relocation in this series, CONFIG_SYS_SKIP_RELOC is more appropriate
than CONFIG_SYS_LEGACY_BOARD.

Signed-off-by: Simon Glass 
---
Changes in v2:
- Use CONFIG_SYS_SKIP_RELOC instead of CONFIG_SYS_LEGACY_BOARD

 README|4 
 arch/arm/config.mk|3 +++
 arch/avr32/config.mk  |3 +++
 arch/blackfin/config.mk   |3 +++
 arch/m68k/config.mk   |3 +++
 arch/microblaze/config.mk |3 +++
 arch/mips/config.mk   |3 +++
 arch/nds32/config.mk  |3 +++
 arch/nios2/config.mk  |3 +++
 arch/powerpc/config.mk|3 +++
 arch/sandbox/config.mk|3 +++
 arch/sh/config.mk |3 +++
 arch/sparc/config.mk  |3 +++
 arch/x86/config.mk|3 +++
 14 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/README b/README
index e9d1891..be4bbf8 100644
--- a/README
+++ b/README
@@ -2707,6 +2707,10 @@ Configuration Settings:
cases. This setting can be used to tune behaviour; see
lib/hashtable.c for details.
 
+- CONFIG_SYS_SKIP_RELOC
+   This makes U-Boot skip relocation for those architectures which
+   don't support it. It is normally defined in arch/xxx/config.mk
+
 The following definitions that deal with the placement and management
 of environment data (variable area); in general, we support the
 following configurations:
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 45f9dca..f47d4f7 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -81,3 +81,6 @@ endif
 ifndef CONFIG_NAND_SPL
 LDFLAGS_u-boot += -pie
 endif
+
+# We use legacy relocation for now
+CONFIG_SYS_SKIP_RELOC := y
diff --git a/arch/avr32/config.mk b/arch/avr32/config.mk
index d8e7ebb..1995983 100644
--- a/arch/avr32/config.mk
+++ b/arch/avr32/config.mk
@@ -31,3 +31,6 @@ PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
 LDFLAGS_u-boot = --gc-sections --relax
 
 LDSCRIPT   = $(SRCTREE)/$(CPUDIR)/u-boot.lds
+
+# We use legacy relocation for now
+CONFIG_SYS_SKIP_RELOC := y
diff --git a/arch/blackfin/config.mk b/arch/blackfin/config.mk
index 3595aa2..56047c8 100644
--- a/arch/blackfin/config.mk
+++ b/arch/blackfin/config.mk
@@ -37,6 +37,9 @@ CONFIG_BFIN_BOOT_MODE := $(strip $(subst 
",,$(CONFIG_BFIN_BOOT_MODE)))
 PLATFORM_RELFLAGS += -ffixed-P3 -fomit-frame-pointer -mno-fdpic
 PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN
 
+# Blackfin does not do relocation
+CONFIG_SYS_SKIP_RELOC := y
+
 LDFLAGS_FINAL += --gc-sections
 LDFLAGS += -m elf32bfin
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
diff --git a/arch/m68k/config.mk b/arch/m68k/config.mk
index 11ba334..52bfc81 100644
--- a/arch/m68k/config.mk
+++ b/arch/m68k/config.mk
@@ -29,3 +29,6 @@ PLATFORM_CPPFLAGS += -DCONFIG_M68K -D__M68K__
 PLATFORM_LDFLAGS  += -n
 PLATFORM_RELFLAGS  += -ffunction-sections -fdata-sections
 LDFLAGS_FINAL  += --gc-sections
+
+# We use legacy relocation for now
+CONFIG_SYS_SKIP_RELOC := y
diff --git a/arch/microblaze/config.mk b/arch/microblaze/config.mk
index abea70b..7645f2e 100644
--- a/arch/microblaze/config.mk
+++ b/arch/microblaze/config.mk
@@ -29,3 +29,6 @@ CROSS_COMPILE ?= mb-
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x80F0
 
 PLATFORM_CPPFLAGS += -ffixed-r31 -D__microblaze__
+
+# Microblaze does not do relocation
+CONFIG_SYS_SKIP_RELOC := y
diff --git a/arch/mips/config.mk b/arch/mips/config.mk
index 6ab8acd..832b93f 100644
--- a/arch/mips/config.mk
+++ b/arch/mips/config.mk
@@ -52,3 +52,6 @@ PLATFORM_CPPFLAGS += -msoft-float
 PLATFORM_LDFLAGS   += -G 0 -static -n -nostdlib
 PLATFORM_RELFLAGS  += -ffunction-sections -fdata-sections
 LDFLAGS_FINAL  += --gc-sections
+
+# We use legacy relocation for now
+CONFIG_SYS_SKIP_RELOC := y
diff --git a/arch/nds32/config.mk b/arch/nds32/config.mk
index c589829..4a4499b 100644
--- a/arch/nds32/config.mk
+++ b/arch/nds32/config.mk
@@ -33,3 +33,6 @@ PLATFORM_RELFLAGS += -gdwarf-2
 PLATFORM_CPPFLAGS  += -DCONFIG_NDS32 -D__nds32__ -G0 -ffixed-10 -fpie
 
 LDFLAGS_u-boot = --gc-sections --relax
+
+# We use legacy relocation for now
+CONFIG_SYS_SKIP_RELOC := y
diff --git a/arch/nios2/config.mk b/arch/nios2/config.mk
index 7b03ed8..cde7f82 100644
--- a/arch/nios2/config.mk
+++ b/arch/nios2/config.mk
@@ -31,3 +31,6 @@ PLATFORM_CPPFLAGS += -G0
 
 LDFLAGS_FINAL += --gc-sections
 PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
+
+# NIOS2 does not do relocation
+CONFIG_SYS_SKIP_RELOC := y
diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk
index a307154..eba562f 100644
--- a/arch/powerpc/config.mk
+++ b/arch/powerpc/config.mk
@@

[U-Boot] [PATCH v2 5/6] reboard: arm: Move over to generic relocation

2011-12-10 Thread Simon Glass
Add a function to process a single ELF relocation and switch ARM over
to use generic relocation.

Unfortunately a few boards need to be modified to make this work
(mostly adding link symbols to the .lds files).

Signed-off-by: Simon Glass 
---
Changes in v2:
- Use an inline relocation function to reduce code size

 arch/arm/config.mk  |3 -
 arch/arm/include/asm/reloc.h|   56 +++
 nand_spl/board/freescale/mx31pdk/Makefile   |8 +++-
 nand_spl/board/freescale/mx31pdk/u-boot.lds |1 +
 nand_spl/board/karo/tx25/Makefile   |8 +++-
 nand_spl/board/karo/tx25/u-boot.lds |1 +
 6 files changed, 72 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/include/asm/reloc.h

diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index f47d4f7..45f9dca 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -81,6 +81,3 @@ endif
 ifndef CONFIG_NAND_SPL
 LDFLAGS_u-boot += -pie
 endif
-
-# We use legacy relocation for now
-CONFIG_SYS_SKIP_RELOC := y
diff --git a/arch/arm/include/asm/reloc.h b/arch/arm/include/asm/reloc.h
new file mode 100644
index 000..3b6491d
--- /dev/null
+++ b/arch/arm/include/asm/reloc.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+
+/**
+ * Process a single ELF relocation entry
+ *
+ * @param addr Pointer to address of intruction/data to relocate
+ * @param info The ELF information word / flags
+ * @param symtab   The ELF relocation symbol table
+ * @param reloc_offOffset of relocated U-Boot relative to load address
+ * @return 0 if ok, -1 on error
+ */
+static inline int arch_elf_relocate_entry(Elf32_Addr *addr, Elf32_Word info,
+   Elf32_Sym *symtab, ulong reloc_off)
+{
+   int sym;
+
+   switch (ELF32_R_TYPE(info)) {
+   /* relative fix: increase location by offset */
+   case 23: /* TODO: add R_ARM_... defines to elf.h */
+   *addr += reloc_off;
+   break;
+
+   /* absolute fix: set location to (offset) symbol value */
+   case 2:
+   sym = ELF32_R_SYM(info);
+   *addr = symtab[sym].st_value + reloc_off;
+   break;
+
+   default:
+   debug("*** Invalid relocation\n");
+   return -1;
+   }
+   return 0;
+}
diff --git a/nand_spl/board/freescale/mx31pdk/Makefile 
b/nand_spl/board/freescale/mx31pdk/Makefile
index 87784d2..470e320 100644
--- a/nand_spl/board/freescale/mx31pdk/Makefile
+++ b/nand_spl/board/freescale/mx31pdk/Makefile
@@ -11,7 +11,7 @@ LDFLAGS := -T $(nandobj)u-boot.lds -Ttext 
$(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 AFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 CFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 
-SOBJS  = start.o lowlevel_init.o
+SOBJS  = start.o lowlevel_init.o proc.o reloc.o
 COBJS  = nand_boot_fsl_nfc.o
 
 SRCS   := $(SRCTREE)/nand_spl/nand_boot_fsl_nfc.c
@@ -50,6 +50,12 @@ $(obj)%.o:   $(SRCTREE)/board/freescale/mx31pdk/%.S
 $(obj)%.o: $(SRCTREE)/nand_spl/%.c
$(CC) $(CFLAGS) -c -o $@ $<
 
+$(obj)%.o: $(SRCTREE)/common/%.c
+   $(CC) $(CFLAGS) -c -o $@ $<
+
+$(obj)%.o: $(SRCTREE)/arch/arm/lib/%.S
+   $(CC) $(AFLAGS) -c -o $@ $<
+
 # defines $(obj).depend target
 include $(SRCTREE)/rules.mk
 
diff --git a/nand_spl/board/freescale/mx31pdk/u-boot.lds 
b/nand_spl/board/freescale/mx31pdk/u-boot.lds
index d2b08f6..2273e9b 100644
--- a/nand_spl/board/freescale/mx31pdk/u-boot.lds
+++ b/nand_spl/board/freescale/mx31pdk/u-boot.lds
@@ -51,6 +51,7 @@ SECTIONS
__u_boot_cmd_end = .;
 
. = ALIGN(4);
+   __image_copy_end = .;
 
.rel.dyn : {
__rel_dyn_start = .;
diff --git a/nand_spl/board/karo/tx25/Makefile 
b/nand_spl/board/karo/tx25/Makefile
index 0336346..cac5600 100644
--- a/nand_spl/board/karo/tx25/Makefile
+++ b/nand_spl/board/karo/tx25/Makefile
@@ -32,7 +32,7 @@ LDFLAGS := -T $(nandobj)u-boot.lds -Ttext 
$(CONFIG_SYS_TEXT_BASE) $(LDFLAGS) \
 AFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 CFLAGS += -DCONFIG_SPL_BUILD -DCONFIG_NAND_SPL
 
-SOBJS  = start.o lowlevel_init.o
+SOBJS  = start.o lowle

[U-Boot] [PATCH v2 3/6] reboard: Add generic relocation feature

2011-12-10 Thread Simon Glass
Add a relocation implementation as the first thing in the generic board
library. This library is needed by SPL also.

We create a separate header file for link symbols defined by the link
scripts. It is helpful to have these all in one place and try to
make them common across architectures. Since Linux already has a similar
file, we bring this in even though many of the symbols there are not
relevant to us.

The __relocate_code() function is what we expect all architectures which
support relocation will use eventually. For now, they all override this
with their own version.

Signed-off-by: Simon Glass 
---
Changes in v2:
- Import asm-generic/sections.h from Linux and add U-Boot extras
- Squash generic link symbols patch into generic relocation patch
- Move reloc.c into common/
- Add function comments
- Use memset, memcpy instead of inline code
- Add README file for relocation

 common/Makefile|4 +
 common/reloc.c |  121 
 doc/README.relocation  |   87 
 include/asm-generic/sections.h |   92 ++
 include/reloc.h|   15 +
 5 files changed, 319 insertions(+), 0 deletions(-)
 create mode 100644 common/reloc.c
 create mode 100644 doc/README.relocation
 create mode 100644 include/asm-generic/sections.h

diff --git a/common/Makefile b/common/Makefile
index 1be7236..f64fea8 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -192,6 +192,10 @@ COBJS-y += dlmalloc.o
 COBJS-y += memsize.o
 COBJS-y += stdio.o
 
+ifndef CONFIG_SYS_SKIP_RELOC
+COBJS-y += reloc.o
+endif
+
 
 COBJS  := $(sort $(COBJS-y))
 XCOBJS := $(sort $(XCOBJS-y))
diff --git a/common/reloc.c b/common/reloc.c
new file mode 100644
index 000..2344e98
--- /dev/null
+++ b/common/reloc.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int reloc_make_copy(void)
+{
+   char *dst_addr = (char *)gd->relocaddr;
+
+   /* TODO: __text_start would be better when we have it */
+   char *src_addr = (char *)_start;
+   /* TODO: switch over to __image_copy_end when we can */
+#ifdef CONFIG_SPL_BUILD
+   char *end_addr = src_addr + _image_copy_end_ofs;
+#else
+   char *end_addr = src_addr + _rel_dyn_start_ofs;
+#endif
+
+   if (dst_addr != src_addr) {
+   size_t size = end_addr - src_addr;
+
+   debug("%s: copy code %p-%p to %p-%p\n", __func__,
+ src_addr, end_addr, dst_addr, dst_addr + size);
+   memcpy(dst_addr, src_addr, size);
+   }
+   return 0;
+}
+
+static int reloc_elf(void)
+{
+#ifndef CONFIG_SPL_BUILD
+   const Elf32_Rel *ptr, *end;
+   Elf32_Addr *addr;
+   char *src_addr = (char *)_start;
+   Elf32_Sym *dynsym;
+   ulong reloc_ofs = gd->reloc_off;
+
+   /* scan the relocation table for relevant entries */
+   ptr = (Elf32_Rel *)(src_addr + _rel_dyn_start_ofs);
+   end = (Elf32_Rel *)(src_addr + _rel_dyn_end_ofs);
+   dynsym = (Elf32_Sym *)(src_addr + _dynsym_start_ofs);
+   debug("%s: process reloc entries %p-%p, dynsym at %p\n", __func__,
+ ptr, end, dynsym);
+   for (; ptr < end; ptr++) {
+   addr = (Elf32_Addr *)(ptr->r_offset + reloc_ofs);
+   if (arch_elf_relocate_entry(addr, ptr->r_info, dynsym,
+   reloc_ofs))
+   return -1;
+   }
+#endif
+   return 0;
+}
+
+static int reloc_clear_bss(void)
+{
+   char *dst_addr = (char *)_start + _bss_start_ofs;
+   size_t size = _bss_end_ofs - _bss_start_ofs;
+
+#ifndef CONFIG_SPL_BUILD
+   /* No relocation for SPL (TBD: better to set reloc_off to zero) */
+   dst_addr += gd->reloc_off;
+#endif
+
+   /* TODO: use memset */
+   debug("%s: zero bss %p-%p\n", __func__, dst_addr, dst_addr + size);
+   memset(dst_addr, '\0', size);
+
+   return 0;
+}
+
+void __relocate_code(ulong dest_addr_sp, gd_t *new_gd, ulong dest_addr)
+{
+   ulong new_board_init_r = (uintptr_t)board_init_r + gd-

[U-Boot] [PATCH v2 4/6] reboard: arm: Add processor function library

2011-12-10 Thread Simon Glass
Add a library to hold ARM assembler code which is generic across all
ARM CPUs. At first it just holds some basic relocation code. The
plan is to move more start.S code here.

Signed-off-by: Simon Glass 
---
Changes in v2:
- Invalidate I-cache when we jump to relocated code

 arch/arm/lib/Makefile |2 ++
 arch/arm/lib/proc.S   |   40 
 2 files changed, 42 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/lib/proc.S

diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 300c8fa..213c76f 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -48,6 +48,8 @@ SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
 SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
 endif
 
+SOBJS-y += proc.o
+
 SRCS   := $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
   $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
diff --git a/arch/arm/lib/proc.S b/arch/arm/lib/proc.S
new file mode 100644
index 000..dba7c11
--- /dev/null
+++ b/arch/arm/lib/proc.S
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2011 The Chromium OS Authors.
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+
+/**
+ * Jump to board_init_r with a new stack pointer
+ *
+ * @param gd   Pointer to global data
+ * @param dest_addrDestination address from global data
+ * @param func Address of board_init_r function (relocated)
+ * @param sp   New stack pointer
+ */
+.globl proc_call_board_init_r
+proc_call_board_init_r:
+#ifndef CONFIG_SYS_ICACHE_OFF
+   mcr p15, 0, r0, c7, c5, 0   @ invalidate icache
+   mcr p15, 0, r0, c7, c10, 4  @ DSB
+   mcr p15, 0, r0, c7, c5, 4   @ ISB
+#endif
+   mov sp, r3
+   /* jump to it ... */
+   mov pc, r2
-- 
1.7.3.1

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


[U-Boot] [PATCH v2 1/6] reboard: Create reloc.h and include it where needed

2011-12-10 Thread Simon Glass
Before adding new relocation functions, move this prototype out of
common.h where things are pretty crowded.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/arm926ejs/davinci/spl.c  |1 +
 arch/arm/cpu/armv7/omap-common/spl.c  |1 +
 arch/arm/lib/board.c  |1 +
 arch/avr32/lib/board.c|1 +
 arch/m68k/lib/board.c |1 +
 arch/mips/lib/board.c |1 +
 arch/nds32/lib/board.c|1 +
 arch/powerpc/lib/board.c  |1 +
 arch/x86/lib/board.c  |1 +
 board/freescale/mpc8313erdb/mpc8313erdb.c |1 +
 board/freescale/mpc8315erdb/mpc8315erdb.c |1 +
 board/samsung/smdk6400/smdk6400_nand_spl.c|1 +
 board/sheldon/simpc8313/simpc8313.c   |1 +
 include/common.h  |2 +-
 include/reloc.h   |   39 +
 nand_spl/board/freescale/mpc8536ds/nand_boot.c|1 +
 nand_spl/board/freescale/mpc8569mds/nand_boot.c   |1 +
 nand_spl/board/freescale/mpc8572ds/nand_boot.c|1 +
 nand_spl/board/freescale/p1010rdb/nand_boot.c |1 +
 nand_spl/board/freescale/p1023rds/nand_boot.c |1 +
 nand_spl/board/freescale/p1_p2_rdb/nand_boot.c|1 +
 nand_spl/board/freescale/p1_p2_rdb_pc/nand_boot.c |1 +
 nand_spl/nand_boot_fsl_nfc.c  |1 +
 23 files changed, 61 insertions(+), 1 deletions(-)
 create mode 100644 include/reloc.h

diff --git a/arch/arm/cpu/arm926ejs/davinci/spl.c 
b/arch/arm/cpu/arm926ejs/davinci/spl.c
index d9b9398..aba50d1 100644
--- a/arch/arm/cpu/arm926ejs/davinci/spl.c
+++ b/arch/arm/cpu/arm926ejs/davinci/spl.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/arch/arm/cpu/armv7/omap-common/spl.c 
b/arch/arm/cpu/armv7/omap-common/spl.c
index 9c35a09..06039fe 100644
--- a/arch/arm/cpu/armv7/omap-common/spl.c
+++ b/arch/arm/cpu/armv7/omap-common/spl.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 3d78274..bf1bf79 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
index 63fe297..a7eaf76 100644
--- a/arch/avr32/lib/board.c
+++ b/arch/avr32/lib/board.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c
index 259b71c..85495cc 100644
--- a/arch/m68k/lib/board.c
+++ b/arch/m68k/lib/board.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/arch/mips/lib/board.c b/arch/mips/lib/board.c
index d998f0e..e5bdcfc 100644
--- a/arch/mips/lib/board.c
+++ b/arch/mips/lib/board.c
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c
index 66e4537..9295f46 100644
--- a/arch/nds32/lib/board.c
+++ b/arch/nds32/lib/board.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index ff5888e..248d452 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #ifdef CONFIG_8xx
 #include 
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index d742fec..3d00f20 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/mpc8313erdb/mpc8313erdb.c 
b/board/freescale/mpc8313erdb/mpc8313erdb.c
index 08f873d..89a4832 100644
--- a/board/freescale/mpc8313erdb/mpc8313erdb.c
+++ b/board/freescale/mpc8313erdb/mpc8313erdb.c
@@ -27,6 +27,7 @@
 #include 
 #endif
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/board/freescale/mpc8315erdb/mpc8315erdb.c 
b/board/freescale/mpc8315erdb/mpc8315erdb.c
index 5dc558a..848847b 100644
--- a/board/freescale/mpc8315erdb/mpc8315erdb.c
+++ b/board/freescale/mpc8315erdb/mpc8315erdb.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/samsung/smdk6400/smdk6400_nand_spl.c 
b/board/samsung/smdk6400/smdk6400_nand_spl.c
index a023284..23bbad3 100644
--- a/board/samsung/smdk6400/smdk6400_nand_spl.c
+++ b/board/samsung/smdk6400/smdk6400_nand_spl.c
@@ -29,6 +29,7 @@
  */
 
 #include 
+#include 
 
 void board_init_f(unsigned long bootflag)
 {
diff --git a/board/sheldon/simpc8313/simpc8313.c 
b/board/sheldon/simpc8313/simpc8313.c
index 9126c42..09d754b 100644
--- a/

[U-Boot] [PATCH v2 0/6] reboard: Introduce generic relocation feature

2011-12-10 Thread Simon Glass
This is the second patch series aiming to unify the various board.c files
in each architecture into a single one. This series implements a generic
relocation feature, which is the bridge between board_init_f() and
board_init_r(). It then moves ARM over to use this framework, as an
example.

On ARM the relocation code is duplicated for each CPU yet it
is the same. We can bring this up to the arch level. But since (I believe)
Elf relocation is basically the same process for all archs, there is no
reason not to bring it up to the generic level.

Each architecture which uses this framework needs to provide a function
called arch_elf_relocate_entry() which processes a single relocation
entry. This is a static inline function to reduce code size overhead.

For ARM, a new arch/arm/lib/proc.S file is created, which holds generic
ARM assembler code (things that cannot be written in C and are common
functions used by all ARM CPUs). This helps reduce duplication. Interrupt
handling code and perhaps even some startup code can move there later.

It may be useful for other architectures with a lot of different CPUs
to have a similar file.

Code size on my ARMv7 system increases by 54 bytes with generic
relocation. This overhead is mostly just literal pool access and setting
up to call the relocated U-Boot at the end.

On my system, execution time increases from 10.8ms to 15.6ms due to the
less efficient C implementations of the copy and zero loops. If execution
time is of concern, you can define CONFIG_USE_ARCH_MEMSET and
CONFIG_USE_ARCH_MEMCPY to reduce it. For met this reduces relocation time
to 5.4ms, i.e. twice as fast as the old system.

One problem remains which causes mx31pdk to fail to build. It doesn't
have string.c in its SPL code and the architecture-specific versions of
memset()/memcpy() are too large. I propose to add a local change to
reloc.c that uses inline code for boards that use the old legacy SPL
framework. We can remove it later. This is not included in v2 but I am
interested in comments on this approach. An alternative would be just
to add simple memset()/memcpy() functions just for this board (and one
other affected MX31 board).

Changes in v2:
- Use CONFIG_SYS_SKIP_RELOC instead of CONFIG_SYS_LEGACY_BOARD
- Import asm-generic/sections.h from Linux and add U-Boot extras
- Squash generic link symbols patch into generic relocation patch
- Move reloc.c into common/
- Add function comments
- Use memset, memcpy instead of inline code
- Add README file for relocation
- Invalidate I-cache when we jump to relocated code
- Use an inline relocation function to reduce code size
- Make relocation symbols global so we can use them outside start.S

Simon Glass (6):
  reboard: Create reloc.h and include it where needed
  reboard: define CONFIG_SYS_SKIP_RELOC for all archs
  reboard: Add generic relocation feature
  reboard: arm: Add processor function library
  reboard: arm: Move over to generic relocation
  reboard: arm: Remove unused code in start.S

 README|4 +
 arch/arm/cpu/arm1136/start.S  |  133 ++
 arch/arm/cpu/arm1176/start.S  |  214 ++---
 arch/arm/cpu/arm720t/start.S  |  127 ++---
 arch/arm/cpu/arm920t/start.S  |  135 ++
 arch/arm/cpu/arm925t/start.S  |  135 ++
 arch/arm/cpu/arm926ejs/davinci/spl.c  |1 +
 arch/arm/cpu/arm926ejs/start.S|  144 ++-
 arch/arm/cpu/arm946es/start.S |  130 ++---
 arch/arm/cpu/arm_intcm/start.S|  135 ++
 arch/arm/cpu/armv7/omap-common/spl.c  |1 +
 arch/arm/cpu/armv7/start.S|  141 ++
 arch/arm/cpu/ixp/start.S  |  127 ++---
 arch/arm/cpu/lh7a40x/start.S  |  124 ++---
 arch/arm/cpu/pxa/start.S  |  138 ++
 arch/arm/cpu/s3c44b0/start.S  |  127 ++---
 arch/arm/cpu/sa1100/start.S   |  124 ++---
 arch/arm/include/asm/reloc.h  |   56 ++
 arch/arm/lib/Makefile |2 +
 arch/arm/lib/board.c  |1 +
 arch/arm/lib/proc.S   |   40 
 arch/avr32/config.mk  |3 +
 arch/avr32/lib/board.c|1 +
 arch/blackfin/config.mk   |3 +
 arch/m68k/config.mk   |3 +
 arch/m68k/lib/board.c |1 +
 arch/microblaze/config.mk |3 +
 arch/mips/config.mk   |3 +
 arch/mips/lib/board.c |1 +
 arch/nds32/config.mk  |3 +
 arch/

Re: [U-Boot] [PATCH 0/9] MX5x USB support

2011-12-10 Thread Marek Vasut
> Hi Marek,
> 
> 2011/12/7 Marek Vasut :
> > This patchset adds the USB support for MX5x. Most of the code is based on
> > work of Wolfgang Grandegger with modifications done by various other
> > authors. I also included version of ULPI support code cleaned up by Igor
> > Grinberg.
> > 
> > NOTE: I'd really love to get this code into .12 release. Remy, Wolfgang,
> > do you think it'd be possible? I'd really help adoption of the MX5x USB
> > code greatly as well as cleanup of the ULPI code (which is sadly in a
> > bad shape).
> 
> I have no objections, except that it is unclear to me what version of
> the ULPI code is the latest version.
> I see:
> * 2 'v7' versions of the same patch

Oh well, it is unclear to me how Jana versioned that stuff. When Igor picked it 
up, I think he did the v7. When I picked Igor's version, I dropped the 
changelog 
as it carried no useful information.

> * 1 version without a version information as part of a 9 pieces series.

Yea, that's the good one. I'll rebase it tonight.

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


Re: [U-Boot] [PATCH v2 11/17] usb: Add support for data alignment

2011-12-10 Thread Simon Glass
Hi Remy,

On Sat, Dec 10, 2011 at 8:04 AM, Remy Bohmer  wrote:
> Hi Simon,
>
> 2011/12/6 Simon Glass :
>>>
>>> I do not really like this solution. Maybe we can introduce something
>>> like an usbbuf_alloc() function that takes care of the alignment.
>>> This saves the memcpy() for every transmit. I know it has more impact
>>> if we do it like that, but I think it is cleaner.
>>
>> This is called from usb_bulk_msg() which is called from usb_storage
>> and USB ethernet drivers. A similar problem happened in the MMC stack
>> and was fixed by changing all the callers to cache-align their
>> buffers.
>>
>> Do you mean that you want a patch which changes the callers so that
>> they align their data to a cache boundary as with MMC? Given the small
>> number of callers at this stage it shouldn't be too hard. Then we
>> could drop this patch.
>>
>> Please let me know.
>
> That is fine with me too.

OK I will look at that. I dropped this patch from the v3 series.

Regards,
Simon

>
> Kind regards,
>
> Remy
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 8/9] Add cmd_process() to process commands in one place

2011-12-10 Thread Simon Glass
We currently have the same code in hush.c and main.c. This brings the
code into one place.

As an added feature, if the command function returns CMD_RET_USAGE then
U-Boot will print a usage message for the command.

ARM code size increases about 32 bytes with this clean-up.

Signed-off-by: Simon Glass 
---

 common/command.c  |   43 ++-
 common/hush.c |   56 +++-
 common/main.c |   39 +++-
 include/command.h |   21 ++-
 4 files changed, 81 insertions(+), 78 deletions(-)

diff --git a/common/command.c b/common/command.c
index d402e0f..990e901 100644
--- a/common/command.c
+++ b/common/command.c
@@ -497,9 +497,9 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
  * @param flag Some flags normally 0 (see CMD_FLAG_.. above)
  * @param argc Number of arguments (arg 0 must be the command text)
  * @param argv Arguments
- * @return 0 if command succeeded, else non-zero
+ * @return 0 if command succeeded, else non-zero (CMD_RET_...)
  */
-int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
int result;
 
@@ -508,3 +508,42 @@ int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
debug("Command failed, result=%d", result);
return result;
 }
+
+enum command_ret_t cmd_process(int flag, int argc, char * const argv[])
+{
+   enum command_ret_t rc = CMD_RET_ERROR;
+   cmd_tbl_t *cmdtp;
+
+   /* Look up command in command table */
+   cmdtp = find_cmd(argv[0]);
+   if (cmdtp == NULL)
+   printf("Unknown command '%s' - try 'help'\n", argv[0]);
+
+   /* found - check max args */
+   else if (argc > cmdtp->maxargs)
+   rc = CMD_RET_USAGE;
+
+#if defined(CONFIG_CMD_BOOTD)
+   /* avoid "bootd" recursion */
+   else if (cmdtp->cmd == do_bootd) {
+   if (flag & CMD_FLAG_BOOTD)
+   puts("'bootd' recursion detected\n");
+   else {
+   flag |= CMD_FLAG_BOOTD;
+   rc = CMD_RET_OK;
+   }
+   }
+#endif
+   else
+   rc = CMD_RET_OK;
+
+   /* If OK so far, then do the command */
+   if (!rc)
+   rc = cmd_call(cmdtp, flag, argc, argv);
+
+   if (rc == CMD_RET_USAGE)
+   cmd_usage(cmdtp);
+   else if (rc == CMD_RET_OK && !cmdtp->repeatable)
+   return CMD_RET_NO_REPEAT;
+   return rc;
+}
diff --git a/common/hush.c b/common/hush.c
index 3aa9d50..f8df3fc 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1538,8 +1538,8 @@ static int run_pipe_real(struct pipe *pi)
int nextin;
int flag = do_repeat ? CMD_FLAG_REPEAT : 0;
struct child_prog *child;
-   cmd_tbl_t *cmdtp;
char *p;
+   enum command_ret_t rc;
 # if __GNUC__
/* Avoid longjmp clobbering */
(void) &i;
@@ -1652,47 +1652,23 @@ static int run_pipe_real(struct pipe *pi)
return rcode;
}
 #else
-   /* check ";", because ,example , argv consist from
-* "help;flinfo" must not execute
-*/
-   if (strchr(child->argv[i], ';')) {
-   printf ("Unknown command '%s' - try 'help' or 
use 'run' command\n",
-   child->argv[i]);
-   return -1;
-   }
-   /* Look up command in command table */
-
-
-   if ((cmdtp = find_cmd(child->argv[i])) == NULL) {
-   printf ("Unknown command '%s' - try 'help'\n", 
child->argv[i]);
-   return -1;  /* give up after bad command */
-   } else {
-   int rcode;
-#if defined(CONFIG_CMD_BOOTD)
-   /* avoid "bootd" recursion */
-   if (cmdtp->cmd == do_bootd) {
-   if (flag & CMD_FLAG_BOOTD) {
-   printf ("'bootd' recursion 
detected\n");
-   return -1;
-   }
-   else
-   flag |= CMD_FLAG_BOOTD;
-   }
-#endif
-   /* found - check max args */
-   if ((child->argc - i) > cmdtp->maxargs)
-   return cmd_usage(cmdtp);
-#endif
-   /* OK - call function to do the command */
-   rcode = cmd_call(cmdtp, flag,  child->argc,
- 

[U-Boot] [PATCH v2 6/9] Create a single cmd_call() function to handle command execution

2011-12-10 Thread Simon Glass
We should aim for a single point of entry to the commands, whichever
parser is used.

Signed-off-by: Simon Glass 
---

 common/command.c  |   21 +
 common/hush.c |9 +++--
 common/main.c |3 +--
 include/command.h |5 +
 4 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/common/command.c b/common/command.c
index c5cecd3..d402e0f 100644
--- a/common/command.c
+++ b/common/command.c
@@ -487,3 +487,24 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
}
 }
 #endif
+
+/**
+ * Call a command function. This should be the only route in U-Boot to call
+ * a command, so that we can track whether we are waiting for input or
+ * executing a command.
+ *
+ * @param cmdtpPointer to the command to execute
+ * @param flag Some flags normally 0 (see CMD_FLAG_.. above)
+ * @param argc Number of arguments (arg 0 must be the command text)
+ * @param argv Arguments
+ * @return 0 if command succeeded, else non-zero
+ */
+int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   int result;
+
+   result = (cmdtp->cmd)(cmdtp, flag, argc, argv);
+   if (result)
+   debug("Command failed, result=%d", result);
+   return result;
+}
diff --git a/common/hush.c b/common/hush.c
index e8e24d7..6cb921d 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1679,13 +1679,10 @@ static int run_pipe_real(struct pipe *pi)
rcode = x->function(child);
 #else
/* OK - call function to do the command */
-
-   rcode = (cmdtp->cmd)
-(cmdtp, flag,child->argc-i,&child->argv[i]);
-   if ( !cmdtp->repeatable )
+   rcode = cmd_call(cmdtp, flag,  child->argc-i,
+&child->argv[i]);
+   if (!cmdtp->repeatable)
flag_repeat = 0;
-
-
 #endif
child->argv-=i;  /* XXX restore hack so free() 
can work right */
 #ifndef __U_BOOT__
diff --git a/common/main.c b/common/main.c
index 11027f7..f34ba71 100644
--- a/common/main.c
+++ b/common/main.c
@@ -1354,9 +1354,8 @@ static int builtin_run_command(const char *cmd, int flag)
 #endif
 
/* OK - call function to do the command */
-   if ((cmdtp->cmd) (cmdtp, flag, argc, argv) != 0) {
+   if (cmd_call(cmdtp, flag, argc, argv) != 0)
rc = -1;
-   }
 
repeatable &= cmdtp->repeatable;
 
diff --git a/include/command.h b/include/command.h
index 3912b80..4316610 100644
--- a/include/command.h
+++ b/include/command.h
@@ -150,4 +150,9 @@ extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[]);
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 void fixup_cmdtable(cmd_tbl_t *cmdtp, int size);
 #endif
+
+#ifndef__ASSEMBLY__
+int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+#endif /* __ASSEMBLY__ */
+
 #endif /* __COMMAND_H */
-- 
1.7.3.1

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


[U-Boot] [PATCH v2 7/9] Remove interleave of non-U-Boot code in hush

2011-12-10 Thread Simon Glass
There is a nasty interleave of #ifdefs in hush.c where the two code
paths have different indents. Remove this ickiness.

Signed-off-by: Simon Glass 
---

 common/hush.c |   24 +++-
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/common/hush.c b/common/hush.c
index 6cb921d..3aa9d50 100644
--- a/common/hush.c
+++ b/common/hush.c
@@ -1642,6 +1642,15 @@ static int run_pipe_real(struct pipe *pi)
 * Is it really safe for inline use?  
Experimentally,
 * things seem to work with glibc. */
setup_redirects(child, squirrel);
+
+   child->argv += i;  /* XXX horrible hack */
+   rcode = x->function(child);
+   /* XXX restore hack so free() can work right */
+   child->argv -= i;
+   restore_redirects(squirrel);
+   }
+   return rcode;
+   }
 #else
/* check ";", because ,example , argv consist from
 * "help;flinfo" must not execute
@@ -1674,22 +1683,11 @@ static int run_pipe_real(struct pipe *pi)
if ((child->argc - i) > cmdtp->maxargs)
return cmd_usage(cmdtp);
 #endif
-   child->argv+=i;  /* XXX horrible hack */
-#ifndef __U_BOOT__
-   rcode = x->function(child);
-#else
/* OK - call function to do the command */
-   rcode = cmd_call(cmdtp, flag,  child->argc-i,
-&child->argv[i]);
+   rcode = cmd_call(cmdtp, flag,  child->argc,
+child->argv);
if (!cmdtp->repeatable)
flag_repeat = 0;
-#endif
-   child->argv-=i;  /* XXX restore hack so free() 
can work right */
-#ifndef __U_BOOT__
-
-   restore_redirects(squirrel);
-#endif
-
return rcode;
}
}
-- 
1.7.3.1

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


[U-Boot] [PATCH v2 9/9] Convert cmd_usage() calls in common to use a return value

2011-12-10 Thread Simon Glass
Change all files in common/ to use CMD_RET_USAGE instead of calling
cmd_usage() directly. I'm not completely sure about this patch since
the code since impact is small (100 byte or so on ARM) and it might
need splitting into smaller patches. But for now here it is.

Signed-off-by: Simon Glass 
---
Changes in v2:
- Fix minor errors one of which created a warning
- Squash i2c patch into the common/ patch

 common/cmd_bedbug.c|4 ++--
 common/cmd_bmp.c   |6 +++---
 common/cmd_boot.c  |2 +-
 common/cmd_bootm.c |4 ++--
 common/cmd_cache.c |4 ++--
 common/cmd_dataflash_mmc_mux.c |2 +-
 common/cmd_date.c  |3 +--
 common/cmd_dcr.c   |8 
 common/cmd_df.c|2 +-
 common/cmd_eeprom.c|2 +-
 common/cmd_ext2.c  |4 ++--
 common/cmd_fdc.c   |2 +-
 common/cmd_fdos.c  |2 +-
 common/cmd_fdt.c   |   14 +++---
 common/cmd_fitupd.c|2 +-
 common/cmd_flash.c |   14 +++---
 common/cmd_fpga.c  |4 ++--
 common/cmd_gpio.c  |2 +-
 common/cmd_i2c.c   |   32 
 common/cmd_ide.c   |   10 +-
 common/cmd_irq.c   |2 +-
 common/cmd_itest.c |2 +-
 common/cmd_led.c   |6 +++---
 common/cmd_load.c  |2 +-
 common/cmd_log.c   |4 ++--
 common/cmd_md5sum.c|2 +-
 common/cmd_mdio.c  |2 +-
 common/cmd_mem.c   |   22 +++---
 common/cmd_mfsl.c  |   10 +-
 common/cmd_mgdisk.c|2 +-
 common/cmd_mii.c   |4 ++--
 common/cmd_misc.c  |2 +-
 common/cmd_mmc.c   |   14 +++---
 common/cmd_mmc_spi.c   |3 +--
 common/cmd_mp.c|8 
 common/cmd_mtdparts.c  |2 +-
 common/cmd_nand.c  |6 +++---
 common/cmd_net.c   |6 +++---
 common/cmd_nvedit.c|   22 +++---
 common/cmd_onenand.c   |   12 ++--
 common/cmd_otp.c   |2 +-
 common/cmd_pci.c   |2 +-
 common/cmd_portio.c|4 ++--
 common/cmd_pxe.c   |8 
 common/cmd_reiser.c|4 ++--
 common/cmd_sata.c  |8 
 common/cmd_scsi.c  |   15 ---
 common/cmd_setexpr.c   |2 +-
 common/cmd_sf.c|2 +-
 common/cmd_sha1sum.c   |2 +-
 common/cmd_strings.c   |2 +-
 common/cmd_time.c  |4 ++--
 common/cmd_ubi.c   |4 ++--
 common/cmd_ubifs.c |   10 +-
 common/cmd_unzip.c |2 +-
 common/cmd_usb.c   |6 +++---
 common/main.c  |2 +-
 57 files changed, 167 insertions(+), 168 deletions(-)

diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c
index 5b08123..9791423 100644
--- a/common/cmd_bedbug.c
+++ b/common/cmd_bedbug.c
@@ -84,7 +84,7 @@ int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, 
char * const argv[])
len = dis_last_len;
 
if (argc < 2)
-   return cmd_usage(cmdtp);
+   return CMD_RET_USAGE;
 
if ((flag & CMD_FLAG_REPEAT) == 0) {
/* New command */
@@ -123,7 +123,7 @@ int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, 
char * const argv[])
int rcode = 0;
 
if (argc < 2)
-   return cmd_usage(cmdtp);
+   return CMD_RET_USAGE;
 
printf ("\nEnter '.' when done\n");
mem_addr = simple_strtoul (argv[1], NULL, 16);
diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c
index 682f395..4c29fa3 100644
--- a/common/cmd_bmp.c
+++ b/common/cmd_bmp.c
@@ -102,7 +102,7 @@ static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int 
argc, char * const argv[
addr = simple_strtoul(argv[1], NULL, 16);
break;
default:
-   return cmd_usage(cmdtp);
+   return CMD_RET_USAGE;
}
 
return (bmp_info(addr));
@@ -126,7 +126,7 @@ static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int 
argc, char * const ar
y = simple_strtoul(argv[3], NULL, 10);
break;
default:
-   return cmd_usage(cmdtp);
+   return CMD_RET_USAGE;
}
 
 return (bmp_display(addr, x, y));
@@ -166,7 +166,7 @@ static int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
if (c)
return  c->cmd(cmdtp, flag, argc, argv);
else
-   return cmd_usage(cmdtp);
+   return CMD_RET_USAGE;
 }
 
 U_BOOT_CMD(
diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index 0afd939..a799b33 100644
--- a/

[U-Boot] [PATCH v2 5/9] Don't include standard parser if hush is used

2011-12-10 Thread Simon Glass
This saves about 1KB of code space on ARM with CONFIG_SYS_HUSH_PARSER
defined.

Signed-off-by: Simon Glass 
---

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

diff --git a/common/main.c b/common/main.c
index 59b87a1..11027f7 100644
--- a/common/main.c
+++ b/common/main.c
@@ -1116,6 +1116,7 @@ int parse_line (char *line, char *argv[])
 
 //
 
+#ifndef CONFIG_SYS_HUSH_PARSER
 static void process_macros (const char *input, char *output)
 {
char c, prev;
@@ -1366,6 +1367,7 @@ static int builtin_run_command(const char *cmd, int flag)
 
return rc ? rc : repeatable;
 }
+#endif
 
 /*
  * Return 0 on success, or != 0 on error.
-- 
1.7.3.1

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


[U-Boot] [PATCH v2 4/9] Stop using builtin_run_command()

2011-12-10 Thread Simon Glass
This function is only one of the parser options, so use run_command()
instead. It knows how to use hush if selected.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c |7 +
 board/esd/common/auto_update.c|2 +-
 board/esd/common/cmd_loadpci.c|2 +-
 board/esd/du440/du440.c   |2 +-
 common/cmd_bedbug.c   |2 +-
 common/cmd_bootm.c|8 +-
 common/cmd_source.c   |4 +-
 common/main.c |   43 -
 include/common.h  |1 -
 9 files changed, 29 insertions(+), 42 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c 
b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index 54d15ea..fba5e01 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -226,12 +226,7 @@ static void kw_sysrst_action(void)
}
 
debug("Starting %s process...\n", __FUNCTION__);
-#if !defined(CONFIG_SYS_HUSH_PARSER)
-   ret = builtin_run_command(s, 0);
-#else
-   ret = parse_string_outer(s, FLAG_PARSE_SEMICOLON
- | FLAG_EXIT_FROM_LOOP);
-#endif
+   ret = run_command(s, 0);
if (ret < 0)
debug("Error.. %s failed\n", __FUNCTION__);
else
diff --git a/board/esd/common/auto_update.c b/board/esd/common/auto_update.c
index 4cc15fa..fc60545 100644
--- a/board/esd/common/auto_update.c
+++ b/board/esd/common/auto_update.c
@@ -169,7 +169,7 @@ int au_do_update(int i, long sz)
k++;
}
 
-   builtin_run_command(addr, 0);
+   run_command(addr, 0);
return 0;
}
 
diff --git a/board/esd/common/cmd_loadpci.c b/board/esd/common/cmd_loadpci.c
index c2bf279..8fcae63 100644
--- a/board/esd/common/cmd_loadpci.c
+++ b/board/esd/common/cmd_loadpci.c
@@ -110,7 +110,7 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 * Call run_cmd
 */
printf("running command at addr 0x%s ...\n", addr);
-   builtin_run_command((char *)la, 0);
+   run_command((char *)la, 0);
break;
 
default:
diff --git a/board/esd/du440/du440.c b/board/esd/du440/du440.c
index 75fb200..1ada1bc 100644
--- a/board/esd/du440/du440.c
+++ b/board/esd/du440/du440.c
@@ -831,7 +831,7 @@ int do_time(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
*d = '\0';
 
start = get_ticks();
-   ret = builtin_run_command(cmd, 0);
+   ret = run_command(cmd, 0);
end = get_ticks();
 
printf("ticks=%ld\n", (ulong)(end - start));
diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c
index 0228ee8..5b08123 100644
--- a/common/cmd_bedbug.c
+++ b/common/cmd_bedbug.c
@@ -237,7 +237,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs 
*regs)
if (len == -1)
printf ("\n");
else
-   rc = builtin_run_command(lastcommand, flag);
+   rc = run_command(lastcommand, flag);
 
if (rc <= 0) {
/* invalid command or not repeatable, forget it */
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 2e3e159..6bfef62 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -1045,14 +1045,8 @@ int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 {
int rcode = 0;
 
-#ifndef CONFIG_SYS_HUSH_PARSER
-   if (builtin_run_command(getenv("bootcmd"), flag) < 0)
+   if (run_command(getenv("bootcmd"), flag) < 0)
rcode = 1;
-#else
-   if (parse_string_outer(getenv("bootcmd"),
-   FLAG_PARSE_SEMICOLON | FLAG_EXIT_FROM_LOOP) != 0)
-   rcode = 1;
-#endif
return rcode;
 }
 
diff --git a/common/cmd_source.c b/common/cmd_source.c
index 481241c..32fff5c 100644
--- a/common/cmd_source.c
+++ b/common/cmd_source.c
@@ -179,7 +179,7 @@ source (ulong addr, const char *fit_uname)
if (*line) {
debug ("** exec: \"%s\"\n",
line);
-   if (builtin_run_command(line, 0) < 0) {
+   if (run_command(line, 0) < 0) {
rcode = 1;
break;
}
@@ -189,7 +189,7 @@ source (ulong addr, const char *fit_uname)
++next;
}
if (rcode == 0 && *line)
-   rcode = (builtin_run_command(line, 0) >= 0);
+   rcode = (run_command(line, 0) >= 0);
}
 

[U-Boot] [PATCH v2 3/9] Rename run_command2() to run_command()

2011-12-10 Thread Simon Glass
This is a more sensible name, so rename it.

Signed-off-by: Simon Glass 
---

 common/cmd_pxe.c |2 +-
 common/main.c|   10 +-
 include/common.h |2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/common/cmd_pxe.c b/common/cmd_pxe.c
index 9426f5b..673ca61 100644
--- a/common/cmd_pxe.c
+++ b/common/cmd_pxe.c
@@ -537,7 +537,7 @@ static int label_localboot(struct pxe_label *label)
 
printf("running: %s\n", dupcmd);
 
-   ret = run_command2(dupcmd, 0);
+   ret = run_command(dupcmd, 0);
 
free(dupcmd);
 
diff --git a/common/main.c b/common/main.c
index c3cae13..62de019 100644
--- a/common/main.c
+++ b/common/main.c
@@ -269,7 +269,7 @@ int abortboot(int bootdelay)
 /*
  * Return 0 on success, or != 0 on error.
  */
-int run_command2(const char *cmd, int flag)
+int run_command(const char *cmd, int flag)
 {
 #ifndef CONFIG_SYS_HUSH_PARSER
/*
@@ -351,7 +351,7 @@ void main_loop (void)
int prev = disable_ctrlc(1);/* disable Control C checking */
 # endif
 
-   run_command2(p, 0);
+   run_command(p, 0);
 
 # ifdef CONFIG_AUTOBOOT_KEYED
disable_ctrlc(prev);/* restore Control C checking */
@@ -396,7 +396,7 @@ void main_loop (void)
int prev = disable_ctrlc(1);/* disable Control C checking */
 # endif
 
-   run_command2(s, 0);
+   run_command(s, 0);
 
 # ifdef CONFIG_AUTOBOOT_KEYED
disable_ctrlc(prev);/* restore Control C checking */
@@ -407,7 +407,7 @@ void main_loop (void)
if (menukey == CONFIG_MENUKEY) {
s = getenv("menucmd");
if (s)
-   run_command2(s, 0);
+   run_command(s, 0);
}
 #endif /* CONFIG_MENUKEY */
 #endif /* CONFIG_BOOTDELAY */
@@ -1405,7 +1405,7 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char * 
const argv[])
return 1;
}
 
-   if (run_command2(arg, flag) != 0)
+   if (run_command(arg, flag) != 0)
return 1;
}
return 0;
diff --git a/include/common.h b/include/common.h
index a2132a2..0ae0ea2 100644
--- a/include/common.h
+++ b/include/common.h
@@ -261,7 +261,7 @@ int print_buffer (ulong addr, void* data, uint width, uint 
count, uint linelen);
 /* common/main.c */
 void   main_loop   (void);
 int builtin_run_command(const char *cmd, int flag);
-int run_command2(const char *cmd, int flag);
+int run_command(const char *cmd, int flag);
 intreadline(const char *const prompt);
 intreadline_into_buffer(const char *const prompt, char * buffer);
 intparse_line (char *, char *[]);
-- 
1.7.3.1

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


[U-Boot] [PATCH v2 1/9] Remove CMD_PXE's static on run_command()

2011-12-10 Thread Simon Glass
It really isn't clear why this is here and there is no comment, so
drop it.


Signed-off-by: Simon Glass 
---

 common/main.c|3 ---
 include/common.h |2 --
 2 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/common/main.c b/common/main.c
index e96c95a..3ebe9f1 100644
--- a/common/main.c
+++ b/common/main.c
@@ -269,9 +269,6 @@ int abortboot(int bootdelay)
 /*
  * Return 0 on success, or != 0 on error.
  */
-#ifndef CONFIG_CMD_PXE
-static inline
-#endif
 int run_command2(const char *cmd, int flag)
 {
 #ifndef CONFIG_SYS_HUSH_PARSER
diff --git a/include/common.h b/include/common.h
index 05a658c..a7d4904 100644
--- a/include/common.h
+++ b/include/common.h
@@ -261,9 +261,7 @@ int print_buffer (ulong addr, void* data, uint width, uint 
count, uint linelen);
 /* common/main.c */
 void   main_loop   (void);
 intrun_command (const char *cmd, int flag);
-#ifdef CONFIG_CMD_PXE
 int run_command2(const char *cmd, int flag);
-#endif
 intreadline(const char *const prompt);
 intreadline_into_buffer(const char *const prompt, char * buffer);
 intparse_line (char *, char *[]);
-- 
1.7.3.1

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


[U-Boot] [PATCH v2 2/9] Rename run_command() to builtin_run_command()

2011-12-10 Thread Simon Glass
The current run_command() is only one of the options, with
hush providing the other. It really shouldn't be called directly
in case the hush parser is being used, so rename this function to
better explain its purpose.

Signed-off-by: Simon Glass 
---

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c |2 +-
 board/esd/common/auto_update.c|2 +-
 board/esd/common/cmd_loadpci.c|2 +-
 board/esd/du440/du440.c   |2 +-
 common/cmd_bedbug.c   |2 +-
 common/cmd_bootm.c|2 +-
 common/cmd_source.c   |4 ++--
 common/main.c |6 +++---
 include/common.h  |2 +-
 9 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c 
b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
index 8f04ddb..54d15ea 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c
@@ -227,7 +227,7 @@ static void kw_sysrst_action(void)
 
debug("Starting %s process...\n", __FUNCTION__);
 #if !defined(CONFIG_SYS_HUSH_PARSER)
-   ret = run_command (s, 0);
+   ret = builtin_run_command(s, 0);
 #else
ret = parse_string_outer(s, FLAG_PARSE_SEMICOLON
  | FLAG_EXIT_FROM_LOOP);
diff --git a/board/esd/common/auto_update.c b/board/esd/common/auto_update.c
index fc60545..4cc15fa 100644
--- a/board/esd/common/auto_update.c
+++ b/board/esd/common/auto_update.c
@@ -169,7 +169,7 @@ int au_do_update(int i, long sz)
k++;
}
 
-   run_command(addr, 0);
+   builtin_run_command(addr, 0);
return 0;
}
 
diff --git a/board/esd/common/cmd_loadpci.c b/board/esd/common/cmd_loadpci.c
index 8f4ad84..c2bf279 100644
--- a/board/esd/common/cmd_loadpci.c
+++ b/board/esd/common/cmd_loadpci.c
@@ -110,7 +110,7 @@ int do_loadpci(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 * Call run_cmd
 */
printf("running command at addr 0x%s ...\n", addr);
-   run_command((char*)la, 0);
+   builtin_run_command((char *)la, 0);
break;
 
default:
diff --git a/board/esd/du440/du440.c b/board/esd/du440/du440.c
index 426321e..75fb200 100644
--- a/board/esd/du440/du440.c
+++ b/board/esd/du440/du440.c
@@ -831,7 +831,7 @@ int do_time(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
*d = '\0';
 
start = get_ticks();
-   ret = run_command (cmd, 0);
+   ret = builtin_run_command(cmd, 0);
end = get_ticks();
 
printf("ticks=%ld\n", (ulong)(end - start));
diff --git a/common/cmd_bedbug.c b/common/cmd_bedbug.c
index 87b108f..0228ee8 100644
--- a/common/cmd_bedbug.c
+++ b/common/cmd_bedbug.c
@@ -237,7 +237,7 @@ void bedbug_main_loop (unsigned long addr, struct pt_regs 
*regs)
if (len == -1)
printf ("\n");
else
-   rc = run_command (lastcommand, flag);
+   rc = builtin_run_command(lastcommand, flag);
 
if (rc <= 0) {
/* invalid command or not repeatable, forget it */
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index d5745b1..2e3e159 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -1046,7 +1046,7 @@ int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
int rcode = 0;
 
 #ifndef CONFIG_SYS_HUSH_PARSER
-   if (run_command(getenv("bootcmd"), flag) < 0)
+   if (builtin_run_command(getenv("bootcmd"), flag) < 0)
rcode = 1;
 #else
if (parse_string_outer(getenv("bootcmd"),
diff --git a/common/cmd_source.c b/common/cmd_source.c
index 16a627a..481241c 100644
--- a/common/cmd_source.c
+++ b/common/cmd_source.c
@@ -179,7 +179,7 @@ source (ulong addr, const char *fit_uname)
if (*line) {
debug ("** exec: \"%s\"\n",
line);
-   if (run_command (line, 0) < 0) {
+   if (builtin_run_command(line, 0) < 0) {
rcode = 1;
break;
}
@@ -189,7 +189,7 @@ source (ulong addr, const char *fit_uname)
++next;
}
if (rcode == 0 && *line)
-   rcode = (run_command(line, 0) >= 0);
+   rcode = (builtin_run_command(line, 0) >= 0);
}
 #endif
free (cmd);
diff --git a/common/main.c b/common/main.c
index 3ebe9f1..c3cae13 100644
--- a/common/main.c
+++ b/common/main.c
@@ -275,7 +275,7 @@ int run_command2(con

[U-Boot] [PATCH v2 0/9] Unified command execution in one place

2011-12-10 Thread Simon Glass
At present two parsers have similar code to execute commands. Also
cmd_usage() is called all over the place. This series adds a single
function which processes commands called cmd_process().

This new function understands return codes, and in particular
CMD_RET_USAGE to indicate a usage error. So rather than calling
cmd_usage() themselves, the command handlers can just return this
error.

There appears to be a run_command2() which is used to run commands
with the selected parser. This series changes this in two separate
steps to just run_command(), and renames the old run_command() to
builtin_run_command(). No one should call this outside main.c since
if the hush parser is being used it is wrong to call it. The
built-in parser code could move into a separate file perhaps in a
future patch.

The overall series reduces code size on ARM by about 1KB on
my ~160KB U-Boot text region when the hush parser is used, and around
60 bytes when it isn't.

As an aside the only user of parse_line() is fsl_ddr_interactive()
which seems to have its own command line interface which operates
before DRAM is set up. Do I have this right? Is there no way this
could be done later from a normal U-Boot command?

(I have run this through MAKEALL and it seems clean)

Changes in v2:
- Fix minor errors one of which created a warning
- Squash i2c patch into the common/ patch

Simon Glass (9):
  Remove CMD_PXE's static on run_command()
  Rename run_command() to builtin_run_command()
  Rename run_command2() to run_command()
  Stop using builtin_run_command()
  Don't include standard parser if hush is used
  Create a single cmd_call() function to handle command execution
  Remove interleave of non-U-Boot code in hush
  Add cmd_process() to process commands in one place
  Convert cmd_usage() calls in common to use a return value

 arch/arm/cpu/arm926ejs/kirkwood/cpu.c |7 +--
 board/esd/common/cmd_loadpci.c|2 +-
 board/esd/du440/du440.c   |2 +-
 common/cmd_bedbug.c   |6 +-
 common/cmd_bmp.c  |6 +-
 common/cmd_boot.c |2 +-
 common/cmd_bootm.c|   10 +---
 common/cmd_cache.c|4 +-
 common/cmd_dataflash_mmc_mux.c|2 +-
 common/cmd_date.c |3 +-
 common/cmd_dcr.c  |8 +-
 common/cmd_df.c   |2 +-
 common/cmd_eeprom.c   |2 +-
 common/cmd_ext2.c |4 +-
 common/cmd_fdc.c  |2 +-
 common/cmd_fdos.c |2 +-
 common/cmd_fdt.c  |   14 ++--
 common/cmd_fitupd.c   |2 +-
 common/cmd_flash.c|   14 ++--
 common/cmd_fpga.c |4 +-
 common/cmd_gpio.c |2 +-
 common/cmd_i2c.c  |   32 +-
 common/cmd_ide.c  |   10 ++--
 common/cmd_irq.c  |2 +-
 common/cmd_itest.c|2 +-
 common/cmd_led.c  |6 +-
 common/cmd_load.c |2 +-
 common/cmd_log.c  |4 +-
 common/cmd_md5sum.c   |2 +-
 common/cmd_mdio.c |2 +-
 common/cmd_mem.c  |   22 
 common/cmd_mfsl.c |   10 ++--
 common/cmd_mgdisk.c   |2 +-
 common/cmd_mii.c  |4 +-
 common/cmd_misc.c |2 +-
 common/cmd_mmc.c  |   14 ++--
 common/cmd_mmc_spi.c  |3 +-
 common/cmd_mp.c   |8 +-
 common/cmd_mtdparts.c |2 +-
 common/cmd_nand.c |6 +-
 common/cmd_net.c  |6 +-
 common/cmd_nvedit.c   |   22 
 common/cmd_onenand.c  |   12 ++--
 common/cmd_otp.c  |2 +-
 common/cmd_pci.c  |2 +-
 common/cmd_portio.c   |4 +-
 common/cmd_pxe.c  |   10 ++--
 common/cmd_reiser.c   |4 +-
 common/cmd_sata.c |8 +-
 common/cmd_scsi.c |   15 +++--
 common/cmd_setexpr.c  |2 +-
 common/cmd_sf.c   |2 +-
 common/cmd_sha1sum.c  |2 +-
 common/cmd_source.c   |2 +-
 common/cmd_strings.c  |2 +-
 common/cmd_time.c |4 +-
 common/cmd_ubi.c  |4 +-
 common/cmd_ubifs.c|   10 ++--
 common/cmd_unzip.c|2 +-
 common/cmd_usb.c  |6 +-
 common/command.c  |   60 
 common/hush.c |   73 +++-
 common/main.c |   98 +

Re: [U-Boot] [PATCH 0/9] MX5x USB support

2011-12-10 Thread Remy Bohmer
Hi Marek,

>
> If some of the patches didn't make it through gmail because of the different
> From:, please check git://git.denx.de/u-boot-marex.git, "usb" branch.

Pulling it failed. Can you please rebase it on top of current
u-boot-usb, then I will pull it from there.

Kind regards,

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


Re: [U-Boot] [PATCH 0/9] MX5x USB support

2011-12-10 Thread Remy Bohmer
Hi Marek,

2011/12/7 Marek Vasut :
> This patchset adds the USB support for MX5x. Most of the code is based on work
> of Wolfgang Grandegger with modifications done by various other authors. I 
> also
> included version of ULPI support code cleaned up by Igor Grinberg.
>
> NOTE: I'd really love to get this code into .12 release. Remy, Wolfgang, do 
> you
> think it'd be possible? I'd really help adoption of the MX5x USB code greatly 
> as
> well as cleanup of the ULPI code (which is sadly in a bad shape).

I have no objections, except that it is unclear to me what version of
the ULPI code is the latest version.
I see:
* 2 'v7' versions of the same patch
* 1 version without a version information as part of a 9 pieces series.

Kind regards,

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


Re: [U-Boot] [PATCH v3 11/16] usb: Add support for txfifo threshold

2011-12-10 Thread Remy Bohmer
Hi,

2011/12/7 Simon Glass :
> CONFIG_USB_EHCI_TXFIFO_THRESH enables setting of the txfilltuning
> field in the EHCI controller on reset.
>
> Signed-off-by: Simon Glass 
> ---
>
>  README                      |    3 +++
>  drivers/usb/host/ehci-hcd.c |    7 +++
>  drivers/usb/host/ehci.h     |    6 +-
>  3 files changed, 15 insertions(+), 1 deletions(-)


Since it is part of a bigger series:
Acked-by: Remy Bohmer 

Kind regards,

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


Re: [U-Boot] Cache function change breaks zmx25

2011-12-10 Thread Matthias Weisser
Am 09.12.2011 16:03, schrieb Ilya Yanok:
> Hi Matthias,
> 
> On 09.12.2011 18:24, Matthias Weißer wrote:
>> breaks zmx25 booting with the following command:
>>
>> tftpboot 0x8200 foo.img; dcache on; bootm 0x8200
>>
>> It is stuck then in an endless loop after dcache is disabled before
>> jumping to the OS.
>>
>> 
>> WARNING: cache operations are not implemented!
>> WARNING: disabling D-Cache now, you can re-enable itlater with 'dcache
>> on' command
>> 
> 
> Argh.. That's really bad. May I ask you to debug this a little bit?
>
> What is exact cache function being called? Where from?
> How comes that dcache_status() returns true after dcache_disable()? Or
> does somebody call dcache_enable() in between?

The call trace in may case should be something like (not debuged, only
looked at the code):

cmd_elf.c: do_bootelf()
cmd_elf.c: do_bootelf_exec()
cache-cp15.c : dcache_disable()
cache-cp15.c : cache_disable(CR_C); -> Cache is not disabled in this
 function before
cache.c  : flush_dcache_all();   is called
cache.c  : dcache_noop();
cache-cp15.c : dcache_status() -> returns true
cache-cp15.c : dcache_disable()
cache-cp15.c : cache_disable(CR_C)
cache.c  : flush_dcache_all();


And we have the endless loop. I think this impacts not only zmx25 but
other boards enabling dcache.

If you need additional informations: I will have access to the board on
monday again.

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


Re: [U-Boot] [PATCH] ehci: speed up initialization

2011-12-10 Thread Remy Bohmer
Hi,

2011/12/5 Vincent Palatin :
> According to EHCI specification v1.0, the controller should stabilize
> the power on a port at most 20 ms after the port power bit transition.
> So, we put this setting in the virtual descriptor corresponding field,
> (bPwrOn2PwrGood = 10 => 10 x 2ms = 20ms), this saves about 500ms at each
> controller initialization/enumeration.
>
> Signed-off-by: Vincent Palatin 
> ---
>  drivers/usb/host/ehci-hcd.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied to u-boot-usb.

Kind regards,

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


Re: [U-Boot] [PATCH v2 11/17] usb: Add support for data alignment

2011-12-10 Thread Remy Bohmer
Hi Simon,

2011/12/6 Simon Glass :
>>
>> I do not really like this solution. Maybe we can introduce something
>> like an usbbuf_alloc() function that takes care of the alignment.
>> This saves the memcpy() for every transmit. I know it has more impact
>> if we do it like that, but I think it is cleaner.
>
> This is called from usb_bulk_msg() which is called from usb_storage
> and USB ethernet drivers. A similar problem happened in the MMC stack
> and was fixed by changing all the callers to cache-align their
> buffers.
>
> Do you mean that you want a patch which changes the callers so that
> they align their data to a cache boundary as with MMC? Given the small
> number of callers at this stage it shouldn't be too hard. Then we
> could drop this patch.
>
> Please let me know.

That is fine with me too.

Kind regards,

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


[U-Boot] Pull request: u-boot-usb

2011-12-10 Thread Remy Bohmer
The following changes since commit c4eba6ec5c58083b38340724c006294c7a4fe2eb:

  common/usb_kbd.c: fix bug introduced in commit 00b7d6e (2011-12-09
12:09:35 +0100)

are available in the git repository at:
  git://git.denx.de/u-boot-usb.git master

Lei Wen (1):
  USB: gadaget: add Marvell controller support

Lukasz Majewski (3):
  usb:gadget:s5p USB Device Controller (UDC) implementation
  usb:gadget:s5p Enable the USB Gadget framework at GONI
  usb:gadget:s5p Enable the USB Gadget framework at C210 Universal

Marek Vasut (5):
  USB: Add functionality to poll the USB keyboard via control EP
  USB: Rework usb_kbd.c
  USB: Drop dead code from usb_kbd.c
  USB: Fix complaints about strict aliasing in OHCI-HCD
  USB: Add usb_event_poll() to get keyboards working with EHCI

Stefan Herbrechtsmeier (4):
  pxa: fix usb host register mismatch
  pxa: activate the first usb host port on pxa27x by default
  pxa: convert pxa27x_udc to use read and write functions
  usbtty: init endpoints prior to startup events

Stefan Kristiansson (1):
  usb: align usb_endpoint_descriptor to 16-bit boundary

Veli-Pekka Peltola (2):
  cosmetic: remove excess whitespace from usb command help
  usb: add help for missing start subcommand

Wolfgang Grandegger (1):
  ehci-fsl: correct size of ehci caplength

 arch/arm/cpu/pxa/usb.c|6 +-
 arch/arm/include/asm/arch-pxa/pxa-regs.h  |   10 +-
 arch/arm/include/asm/arch-s5pc1xx/cpu.h   |4 +
 arch/arm/include/asm/arch-s5pc2xx/cpu.h   |3 +
 board/samsung/goni/goni.c |   48 +-
 board/samsung/universal_c210/universal.c  |   48 +
 common/cmd_usb.c  |   16 +-
 common/usb_kbd.c  |  928 +++
 drivers/serial/usbtty.c   |4 +-
 drivers/usb/gadget/Makefile   |5 +
 drivers/usb/gadget/gadget_chips.h |7 +
 drivers/usb/gadget/mv_udc.c   |  499 ++
 drivers/usb/gadget/pxa27x_udc.c   |  183 ++--
 drivers/usb/gadget/regs-otg.h |  271 ++
 drivers/usb/gadget/s3c_udc_otg.c  |  892 ++
 drivers/usb/gadget/s3c_udc_otg_xfer_dma.c | 1444 +
 drivers/usb/host/ehci-hcd.c   |   33 +-
 drivers/usb/host/ohci-hcd.c   |   75 +-
 include/configs/s5p_goni.h|3 +
 include/configs/s5pc210_universal.h   |4 +
 include/usb/ehci-fsl.h|   25 +-
 include/usb/lin_gadget_compat.h   |   62 ++
 include/usb/mv_udc.h  |  151 +++
 include/usb/s3c_udc.h |  175 
 include/usbdescriptors.h  |2 +-
 25 files changed, 4148 insertions(+), 750 deletions(-)
 create mode 100644 drivers/usb/gadget/mv_udc.c
 create mode 100644 drivers/usb/gadget/regs-otg.h
 create mode 100644 drivers/usb/gadget/s3c_udc_otg.c
 create mode 100644 drivers/usb/gadget/s3c_udc_otg_xfer_dma.c
 create mode 100644 include/usb/lin_gadget_compat.h
 create mode 100644 include/usb/mv_udc.h
 create mode 100644 include/usb/s3c_udc.h
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] ext4 support?

2011-12-10 Thread Jason
Dominic,

On Fri, Dec 09, 2011 at 09:53:03PM -0800, Dominic Lemire wrote:
> Just wondering if anyone is working on ext4 support? (ext2ls, ext2load)

Have you tried ext2ls and ext2load on an ext4 partition?  It's been a
while for me, but I seem to recall it worked.  Which make sense, since I
can mount ext3/4 as ext2 in userspace.

Are you trying to use any features of ext4 not in ext2 from u-boot?  eg
writing with journal?

thx,

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


Re: [U-Boot] is the online DULG-tqm8xxL guide reasonably up to date?

2011-12-10 Thread Robert P. J. Day
On Sat, 10 Dec 2011, Wolfgang Denk wrote:

> Dear "Robert P. J. Day",
>
> In message  you wrote:
> >
> >   rather than cast around looking for a solution, i figure i can
> > better invest my time just reading this end to end:
> >
> > http://www.denx.de/wiki/publish/DULG/DULG-tqm8xxl.html
> >
> > and testing it as i go.  should i expect it to be relatively current?
> > i'll make notes about anything that looks odd -- already noticed some
> > minor typoes.
>
> Well, did you actually read it?
>
> It says:
>
> This document was generated at 01 Mar 2008 - 16:53.
>
> So the answer is: no, this document has notbeen maintained for a long.
> long time.

  so ... if i ask questions *before* reading the docs, you'll snap at
me.  and if i propose that i will *now* read the docs before asking
any further technical questions, you will ... apparently snap at me.

  keep up the good work.

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


Re: [U-Boot] is the online DULG-tqm8xxL guide reasonably up to date?

2011-12-10 Thread Wolfgang Denk
Dear "Robert P. J. Day",

In message  you wrote:
> 
>   rather than cast around looking for a solution, i figure i can
> better invest my time just reading this end to end:
> 
> http://www.denx.de/wiki/publish/DULG/DULG-tqm8xxl.html
> 
> and testing it as i go.  should i expect it to be relatively current?
> i'll make notes about anything that looks odd -- already noticed some
> minor typoes.

Well, did you actually read it?

It says:

This document was generated at 01 Mar 2008 - 16:53. 

So the answer is: no, this document has notbeen maintained for a long.
long time.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
You're dead, Jim.
-- McCoy, "The Tholian Web", stardate unknown
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] is the online DULG-tqm8xxL guide reasonably up to date?

2011-12-10 Thread Robert P. J. Day

  rather than cast around looking for a solution, i figure i can
better invest my time just reading this end to end:

http://www.denx.de/wiki/publish/DULG/DULG-tqm8xxl.html

and testing it as i go.  should i expect it to be relatively current?
i'll make notes about anything that looks odd -- already noticed some
minor typoes.

rday

-- 


Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca

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

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


[U-Boot] [PATCH] common/cmd_nvedit.c: Add missing 'env save' preproc guard

2011-12-10 Thread Horst Kronstorfer
Signed-off-by: Horst Kronstorfer 
---
 common/cmd_nvedit.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 5995354..baaa513 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -977,7 +977,9 @@ U_BOOT_CMD(
 #if defined(CONFIG_CMD_RUN)
"env run var [...] - run commands in an environment variable\n"
 #endif
+#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
"env save - save environment\n"
+#endif
"env set [-f] name [arg ...]\n"
 );
 
-- 
1.7.7.3

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


Re: [U-Boot] [PATCH] Fix compilation warnings when building eNET

2011-12-10 Thread Graeme Russ
Hi Vadim,

Oops, dropped the ML...

On Dec 10, 2011 9:20 PM, "Graeme Russ"  wrote:
>
> Hi Vadim,
>
> On Dec 10, 2011 12:14 PM, "Graeme Russ"  wrote:
> >
> > Hi Vadim,
> >
> > On Dec 10, 2011 12:08 PM, "Vadim Bendebury" 
wrote:
> > >
> > > On Fri, Dec 9, 2011 at 3:57 PM, Graeme Russ 
wrote:
> > > >
> > > > Hi Vadim,
> > > >
> > > > On Dec 10, 2011 10:31 AM, "Vadim Bendebury" 
wrote:
> > > > >
> > > > > There have been a couple of unused variable cases, causing
compilation
> > > > > warnings when building the eNET target.
> > > > >
> > > > > While the board/eNET/eNET.c:last_stage_init() case seems a
leftover
> > > > > from a quick edit, the
arch/x86/cpu/sc520/sc520_timer.c:sc520_udelay()
> > > > > seems to actually require accessing the registers discarding the
> > > > > values.
> > > >
> > > > Thanks for picking this up, I've been a bit preoccupie lately.
> > > >
> > > > I'll need to look a bit more closely, but there should be no need
for such trickery...
> > > >
> > > > Regards,
> > > >
> > > > Graeme
> > > >
> > > >
> > >
> > > Hi Graeme, thank you for a quick response.
> > >
> > > Do you mean that there is no need to read the registers before the
> > > actual udelay functionality or do you have another way of pacifying
> > > the compiler in mind?
> >
> > On closer inspection, I can't think of a better way
> >
> > Acked-by: Graeme Russ 
>
> Sorry, bit I just had a closer look at this and after reading the
datasheet I've come to the realization that the udelay function is broken -
not badly, but it can timeout up to 1ms early.
>
> The read of swtmrmilli reads the current value of the millisecond timer,
latches the value of the internal microsecond timer and resets the
millisecond timer to zero
>
> The read of swtmrmicro reads the latched microsecond value
>
> The code assumes that reading swtmrmicro resets the microsecond counter,
which it does not. So if the internal microsecond timer is, say, 900 then
udelay(500) for example will return without any delay at all
>
> I need to fix this, but cannot do so any time soon...
>
> I have no objection to the compiler warning fix, but is there any point
in applying a cosmetic fix to broken code?
>

I'm not near my dev PC so the formatting is all wrong, but this should fix
the bug and the compiler warning:

void sc520_udelay(unsigned long usec)
{
   int m;
   long u;
   long start_us;

   /* Reset millisecond counter */
   m = readw(&sc520_mmcr->swtmrmilli);
   m = 0;

   /* Read initial microsecond count */
   start_us = readw(&sc520_mmcr->swtmrmicro);

   do {
  m += readw(&sc520_mmcr->swtmrmilli);
  u = readw(&sc520_mmcr->swtmrmicro) + (m * 1000);
   } while ((u - start_us) < usec);
}

Regards,

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


Re: [U-Boot] p2020 and Micron MT47H64M16HR memory and u-boot

2011-12-10 Thread Felix Radensky

Hi Wojtek,

On 12/09/2011 08:20 AM, wzab  wrote:


Well, it seems that the integrated DDR controller is able to perform
the full initialization procedure with DLL reset.
Anyway we are not able to read data written into the DDR.

Could someone share the correct P2020 DDR controller settings for
MT47H64M16HR-25E working with 667MT/s rate?
--
TIA&  Regards,
Wojtek



I have P2020 based board with 512MB of MT47H64M16HR-25:H memory
running at 800MHz rate. It works fine with u-boot-2010.06.  Something
have changed in later u-boot versions, because I had no luck with 
u-boot-2011.03

on P1022 based based board with the same memory, and had to switch back to
u-boot-2010.06. Unfortunately I had no time to find out the root of 
the problem.


Below is my DDR controller configuration. I hope you'll find it useful.
Please note that I had to extend struct fsl_ddr_cfg_regs_s, defined in
arch/powerpc/include/asm/fsl_ddr_sdram.h, adding cdr1 and cdr2 registers,
so that I can control ODT values. I've also added code to 
fsl_ddr_set_memctl_regs()
routine, defined in arch/powerpc/cpu/mpc85xx/ddr-gen3.c  to configure 
these registers.



#define CONFIG_SYS_DDR_CS0_BNDS0x001F
#define CONFIG_SYS_DDR_CS0_CONFIG 0x80014102
#define CONFIG_SYS_DDR_CS0_CONFIG_2 0x
#define CONFIG_SYS_DDR_INIT_ADDR   0x
#define CONFIG_SYS_DDR_INIT_EXT_ADDR   0x
#define CONFIG_SYS_DDR_MODE_CONTROL 0x
#define CONFIG_SYS_DDR_ZQ_CONTROL   0x
#define CONFIG_SYS_DDR_WRLVL_CONTROL0x
#define CONFIG_SYS_DDR_SR_CNTR 0x
#define CONFIG_SYS_DDR_RCW_1 0x
#define CONFIG_SYS_DDR_RCW_2 0x
#define CONFIG_SYS_DDR_CONTROL 0x0308
#define CONFIG_SYS_DDR_CONTROL_2 0x24401010
#define CONFIG_SYS_DDR_TIMING_40x
#define CONFIG_SYS_DDR_TIMING_50x
#define CONFIG_SYS_DDR_CDR1  0x
#define CONFIG_SYS_DDR_CDR2  0x

#define CONFIG_SYS_DDR_TIMING_3_8000x0002
#define CONFIG_SYS_DDR_TIMING_0_8000x00220A02
#define CONFIG_SYS_DDR_TIMING_1_8000x606BB643
#define CONFIG_SYS_DDR_TIMING_2_8000x032868D2
#define CONFIG_SYS_DDR_CLK_CTRL_800   0x0200
#define CONFIG_SYS_DDR_MODE_1_800  0x40440862
#define CONFIG_SYS_DDR_MODE_2_800  0x
#define CONFIG_SYS_DDR_INTERVAL_8000x0A28

fsl_ddr_cfg_regs_t ddr_cfg_regs_800 = {
.cs[0].bnds = CONFIG_SYS_DDR_CS0_BNDS,
.cs[0].config = CONFIG_SYS_DDR_CS0_CONFIG,
.cs[0].config_2 = CONFIG_SYS_DDR_CS0_CONFIG_2,
.timing_cfg_3 = CONFIG_SYS_DDR_TIMING_3_800,
.timing_cfg_0 = CONFIG_SYS_DDR_TIMING_0_800,
.timing_cfg_1 = CONFIG_SYS_DDR_TIMING_1_800,
.timing_cfg_2 = CONFIG_SYS_DDR_TIMING_2_800,
.ddr_sdram_cfg = CONFIG_SYS_DDR_CONTROL,
.ddr_sdram_cfg_2 = CONFIG_SYS_DDR_CONTROL_2,
.ddr_sdram_mode = CONFIG_SYS_DDR_MODE_1_800,
.ddr_sdram_mode_2 = CONFIG_SYS_DDR_MODE_2_800,
.ddr_sdram_md_cntl = CONFIG_SYS_DDR_MODE_CONTROL,
.ddr_sdram_interval = CONFIG_SYS_DDR_INTERVAL_800,
.ddr_data_init = CONFIG_MEM_INIT_VALUE,
.ddr_sdram_clk_cntl = CONFIG_SYS_DDR_CLK_CTRL_800,
.ddr_init_addr = CONFIG_SYS_DDR_INIT_ADDR,
.ddr_init_ext_addr = CONFIG_SYS_DDR_INIT_EXT_ADDR,
.timing_cfg_4 = CONFIG_SYS_DDR_TIMING_4,
.timing_cfg_5 = CONFIG_SYS_DDR_TIMING_5,
.ddr_zq_cntl = CONFIG_SYS_DDR_ZQ_CONTROL,
.ddr_wrlvl_cntl = CONFIG_SYS_DDR_WRLVL_CONTROL,
.ddr_sr_cntr = CONFIG_SYS_DDR_SR_CNTR,
.ddr_sdram_rcw_1 = CONFIG_SYS_DDR_RCW_1,
.ddr_sdram_rcw_2 = CONFIG_SYS_DDR_RCW_2,
.ddr_cdr1 = CONFIG_SYS_DDR_CDR1,
.ddr_cdr2 = CONFIG_SYS_DDR_CDR2
};

Felix.

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


[U-Boot] ext4 support?

2011-12-10 Thread Dominic Lemire
Hi,

Just wondering if anyone is working on ext4 support? (ext2ls, ext2load)
I have seen ext4 support code in Grub 2, it should be easy to bring to
U-Boot. Is there a license issue?

Sorry if this has been asked before, I did a search in the archive and
couldn't find the answer.

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