Re: [U-Boot] [PATCH 6/6] arm: mx5: Add support for DENX M53EVK

2013-04-20 Thread Wolfgang Denk
Dear Marek Vasut,

In message <201304210243.05923.ma...@denx.de> you wrote:
> 
> > > > What do we need CONFIG_LOADADDR for?
> > > 
> > > For this stuff, the "loadaddr" env variable. I have kinda idea to kill
> > > this and unify it to CONFIG_SYS_LOAD_ADDR all around, what do you think?
> > 
> > Why CONFIG_SYS_* ?
> 
> What do you suggest then?

If we unify it, then we should use CONFIG_LOADADDR - this is a user
defined preference setting, not really a system / hardware dependent
one.

> > > include/env_default.h:#ifdefCONFIG_LOADADDR
> > > include/env_default.h:  "loadaddr=" __stringify(CONFIG_LOADADDR)   
> > > "\0"
> > 
> > Indeed - I missed this one.  I only checked C and asm sources, and
> > cound not find a single reference...
> 
> It's also contained in LARGE amount of config files of course :(

Yes, they set it for this single place where it gets used.

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
Successful and fortunate crime is called virtue. - Seneca
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] arm: mx5: Add support for DENX M53EVK

2013-04-20 Thread Marek Vasut
Dear Fabio Estevam,

[...]
> > +u32 get_board_rev(void)
> > +{
> > +   struct iim_regs *iim = (struct iim_regs *)IMX_IIM_BASE;
> > +   struct fuse_bank *bank = &iim->bank[0];
> > +   struct fuse_bank0_regs *fuse =
> > +   (struct fuse_bank0_regs *)bank->fuse_regs;
> > +   int rev = readl(&fuse->gp[6]);
> > +
> > +   return (get_cpu_rev() & ~(0xF << 8)) | (rev & 0xF) << 8;
> > +}
> 
> Can't you just remove this get_board_rev() from the board file and use
> the generic one instead?

There's no such thing for mx5, only for mx6.

I fixed the rest, but I left the multiline comments. It's the same on m28 and I 
consider it more readable.

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


Re: [U-Boot] [PATCH 6/6] arm: mx5: Add support for DENX M53EVK

2013-04-20 Thread Marek Vasut
Dear Wolfgang Denk,

> Dear Marek Vasut,
> 
> In message <201304191358.25181.ma...@denx.de> you wrote:
> > > > +#define CONFIG_LOADADDR0x7080
> > > > +#define CONFIG_SYS_LOAD_ADDR   CONFIG_LOADADDR
> > > 
> > > What do we need CONFIG_LOADADDR for?
> > 
> > For this stuff, the "loadaddr" env variable. I have kinda idea to kill
> > this and unify it to CONFIG_SYS_LOAD_ADDR all around, what do you think?
> 
> Why CONFIG_SYS_* ?

What do you suggest then?

> > include/env_default.h:#ifdefCONFIG_LOADADDR
> > include/env_default.h:  "loadaddr=" __stringify(CONFIG_LOADADDR)   
> > "\0"
> 
> Indeed - I missed this one.  I only checked C and asm sources, and
> cound not find a single reference...

It's also contained in LARGE amount of config files of course :(

> So arch/blackfin/include/asm/config.h and include/env_default.h are
> the only locateions that refer to  CONFIG_LOADADDR ?  This should
> indeed be cleaned up.  [But this is not related to your patch any
> longer.]
> 
> 
> Best regards,
> 
> Wolfgang Denk

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


Re: [U-Boot] [PATCH 4/6] arm: mx5: Add SPL support code to MX5

2013-04-20 Thread Marek Vasut
Dear Philip Paeps,

> On 2013-04-19 06:10:53 (+0200), Marek Vasut  wrote:
> > Fix minor adjustments needed to get SPL framework building on MX5.
> 
> The same adjustment is needed to make other mx* build.  Perhaps spl.h
> should live under arch/arm/include/asm/imx-common to avoid duplicating
> it for others?

Apparently, this doesn't work. The include isn't found.

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


Re: [U-Boot] [PATCH v2 0/45] Verified boot implementation based on FIT

2013-04-20 Thread Simon Glass
Hi Kim,

On Mon, Apr 1, 2013 at 5:13 PM, Kim Phillips  wrote:
> On Mon, 18 Mar 2013 16:51:20 -0700
> Simon Glass  wrote:
>
>> I have received a number of off-list comments - please do copy the list when
>> replying so that everyone can see your comments.
>
> I don't have time to fully review 45 patches, let alone the subject
> matter (e.g., no support for RSA in h/w, eh? ;), but I did notice
> some things that bugged me:
>
> Re: "[PATCH v2 04/45] libfdt: Add fdt_next_subnode() to permit easy subnode 
> iteration":
>
> - Where's our libfdt maintainer?  libfdt patches should be submitted
> to the dtc project first.  It appears "[PATCH v2 40/45] libfdt: Add
> fdt_find_regions()" also suffers from this problem.

The fdt_next_subnode() is a pretty trivial change. I will submit it to
the dtc project.

The fdt_find_regions() was submitted to dtc as part of the dtc fdtgrep
series. I modified the form of it in response to review feedback and
that is ongoing.

>
> - can we improve on the readability of that for loop - the improved
> one the patch gives us is this:
>
>> for (ndepth = 0,
>>   noffset = fdt_next_subnode(fit, image_noffset, &ndepth);
>>   noffset >= 0;
>>   noffset = fdt_next_subnode(fit, noffset, &ndepth)) {
>
> whereas perhaps something like this:
>
> ndepth = 0;
> noffset = fdt_next_subnode(fit, image_noffset, &ndepth);
> while (noffset >= 0) {
> // body
> noffset = fdt_next_subnode(fit, noffset, &ndepth);
> }
>
> would be much easier to quickly visually parse?

This suffers from the problem that a 'continue' will not work as
expected. I think the existing for() loop is a little better overall -
everything is in one place.

>
> this would also affect:
>
> Re: "[PATCH v2 12/45] image: Move hash checking into its own function":
> - which also adds lines like these:
>
>> + *err_msgp = " error!\nCan't get hash algo "
>> + "property";
>
> upon which a subsequent patch ("[PATCH v2 13/45] image: Move error!
> string to common place", if I'm not mistaken) corrects.  Are you
> intentionally trying to make people review the same code twice??
>

No, what is happening here is that the first patch moves the code into
a function, and the second patch removes the 'error' part of the
strings, not just from that moved code but from everywhere. I find
that doing two things at once is harder to review.

I am certainly not added 'error' to the strings in one patch and
taking it away in the next :-)

> Re: "[PATCH v2 07/45] image: Split FIT code into new image-fit.c"
> - after the code is split, it appears the rest of the patchseries
> works on improving image-fit.c instead of updating equivalent code
> still existing in image.c, IIRC, "[PATCH v2 13/45] image: Move error!
> string to common place"
> - I also found it odd that git format-patch -M on this doesn't
> produce a shorter patch with "% equivalent" statistics: what else
> changed?

Are you suggesting that more patches should affect image.c? If so,
please let me know what should specifically you want done and I will
take a look. Or perhaps we can improve it once the dust clears.

>
> Re: "[PATCH v2 22/45] env: Fix minor comment typos in cmd_nvedit":
> - I personally appreciate it when authors of such large patchseries
> put the trivial stuff first, as if to follow the logical progression
> of the complexity (and therefore acceptability) of the patches in
> the series.  Make things like this the first patch in the series -
> that way maintainers can be tempted to start applying obvious
> patches from early patchseries versions.  This also applies to
> patches like [PATCH v2 24/45] Revert "fdt- Tell the FDT library
> where the device tree is", and:
>
> Re: "[PATCH v2 25/45] Add stdarg to vsprintf.h":
> - which contains the text "TODO: Probably should drop this patch?".
> Well?  Did you mean this series to be an RFC?

Yes I am going to split this up into 3-4 series. The first one
(sandbox changes) was sent earlier today. The next one will focus on
the initial improvements to the image code, and will include these
trivial patches - I will ensure that they are at the start - I agree
it is better that way.

The series was originally RFC, but in version 2 I removed that tag.
Part 25 was added to deal with HOSTCC building vsprintf.h, but I
subsequently found that we could avoid that. I will drop it from v3.

>
> I'm stopping my already brief review here - please clean this up.

Thanks for looking at this.

>
> Kim
>

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


[U-Boot] [PATCH v5] add support for the palm treo 680 board

2013-04-20 Thread Mike Dunn
A quick overview of u-boot implementation on the treo 680...

The treo 680 has a Diskonchip G4 nand flash chip.  This device has a 2k region
that maps to the system bus at the reset vector in a NOR-like fashion so that it
can be used as the boot device.  The phone is shipped with this 2k region
configured as write-protected (can't be modified) and programmed with an initial
program loader (IPL).  At power-up, this IPL loads the contents of two flash
blocks to SDRAM and jumps to it.  The capacity of the two blocks is not large
enough to hold all of u-boot, so a u-boot SPL is used.  To conserve flash space,
these two blocks and the necessary number of subsequent blocks are programmed
with a concatenated spl + u-boot image.  That way, the IPL will also load a
portion of u-boot proper, and when the spl runs, it relocates the portion of
u-boot that the IPL has already loaded, and then resumes loading the remaining
part of u-boot before jumping to it.

The default_environment is used (CONFIG_ENV_IS_NOWHERE) because I didn't think
that having a writable environment was worth the cost of a flash block, although
adding it would be straightforward.  I abuse the CONFIG_EXTRA_ENV_SETTINGS
option to specify the usbtty for the console (CONFIG_SYS_CONSOLE_IS_IN_ENV).

Support for the LCD is included, but currently it is only useful for displaying
the u-boot splash screen.  But if u-boot is built without the usbtty console, it
does display the auto-boot progress nicely.

Signed-off-by: Mike Dunn 
---
Changelog:
  v5: do not use a custom linker script for spl build
  v4:
- use CONFIG_MACH_TYPE instead of MACH_TYPE_TREO680 to initialize
  bi_arch_number
- use offset from CONFIG_SYS_DRAM_BASE to initialize bi_boot_params,
  instead of hard-coding an absolute address
- use shift operator to set one bit when initializing gpio register
- remove memcpy() definition from spl build; use
  CONFIG_SPL_LIBGENERIC_SUPPORT to properly build and link with
  u-boot's memcpy()
- config file cleanup: remove erroneous comments, unneeded numerical
  definitions
- edited README.palmtreo680 a bit
  v3: flash_u-boot utility split into separate patch
  v2:
- tabs removed in #defines in palmtreo680.h
- utility for programming u-boot to flash moved to tools/palmtreo680

 CREDITS |4 +
 MAINTAINERS |3 +
 board/palmtreo680/Makefile  |   34 +++
 board/palmtreo680/palmtreo680.c |  154 +++
 boards.cfg  |1 +
 doc/README.palmtreo680  |  581 +++
 include/configs/palmtreo680.h   |  286 +++
 7 files changed, 1063 insertions(+), 0 deletions(-)
 create mode 100644 board/palmtreo680/Makefile
 create mode 100644 board/palmtreo680/palmtreo680.c
 create mode 100644 doc/README.palmtreo680
 create mode 100644 include/configs/palmtreo680.h

diff --git a/CREDITS b/CREDITS
index 7c1458f..3b657e9 100644
--- a/CREDITS
+++ b/CREDITS
@@ -124,6 +124,10 @@ N: James F. Dougherty
 E: j...@gigabitnetworks.com
 D: Port to the MOUSSE board
 
+N: Mike Dunn
+E: miked...@newsguy.com
+D: Palmtreo680 board, docg4 nand flash driver
+
 N: Dave Ellis
 E: d...@sixnetio.com
 D: EEPROM Speedup, SXNI855T port
diff --git a/MAINTAINERS b/MAINTAINERS
index 643a5ac..ff3724d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -650,6 +650,9 @@ Wolfgang Denk 
imx27lite   i.MX27
qongi.MX31
 
+Mike Dunn 
+   palmtreo680 pxa270
+
 Kristoffer Ericson 
 
jornada SA1110
diff --git a/board/palmtreo680/Makefile b/board/palmtreo680/Makefile
new file mode 100644
index 000..34ffb99
--- /dev/null
+++ b/board/palmtreo680/Makefile
@@ -0,0 +1,34 @@
+#
+# Palm Treo680 Support
+#
+# Copyright (C) 2013 Mike Dunn 
+#
+# This file is released under the terms of GPL v2 and any later version.
+# See the file COPYING in the root directory of the source tree for details.
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := palmtreo680.o
+
+SRCS   := $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+clean:
+   rm -f $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak $(obj).depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/palmtreo680/palmtreo680.c b/board/palmtreo680/palmtreo680.c
new file mode 100644
index 000..d721657
--- /dev/null
+++ b/board/palmtreo680/palmtreo680.c
@@ -0,0 +1,154 @@
+/*
+ * Palm Treo 680 Support
+ *
+ * Copyright (C) 2013 Mike Dunn 
+ *
+ * This file is released under the terms of GPL v2 and any later version.
+ * See the file COPYING in the root directory of the source tree for details.
+ *
+ */
+
+#include 
+#

Re: [U-Boot] [PATCH v5] palmtreo680: add utility that writes u-boot to flash

2013-04-20 Thread Mike Dunn
On 04/20/2013 11:01 AM, Marek Vasut wrote:
> Dear Mike Dunn,
> 
>> On 04/20/2013 03:25 AM, Marek Vasut wrote:
>>> Dear Mike Dunn,
>>>
>>>
>>> I fixed the calloc() semantics and applied, thanks. Please repost
>>> whatever is still missing in u-boot-pxa/master and I'll then roll pullRQ
>>> for mainline.
>>
>> Oops, the board support patch is not in your tree either.  Will repost.
> 
> Did I not ramble about it? Check that first please, I'm not sure now ;-)
> 


Yes, we went back-and-forth about it, and the latest version was v4.  But I need
to rework it because the spl build now fails due to a recent change to
arch/arm/cpu/pxa/start.S in commit 7086e91b0e9930139e703c8f9f857b52baf2bef4

  arm: relocate_code(): Use __image_copy_end for end of relocation

I was using my own linker script for the spl, which does not define the
__image_copy_end symbol that is now referenced in start.S.  I don't exactly
remember why I felt the need to avoid using the script in
arch/arm/cpu/u-boot-spl.lds, except that I didn't like all the sections created
by the --ffunction-sections and --fdata-sections compiler flags and wanted them
combined with a '*' wildcard.  But I removed my linker script and the
CONFIG_SPL_LDSCRIPT line from my config file and it is testing fine.  So I will
have to post a v5 of the patch.

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


[U-Boot] [PATCH v3 05/17] sandbox: Remove old board init code

2013-04-20 Thread Simon Glass
We can use generic board for sandbox, so the old board init code can now
be removed.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2: None

 arch/sandbox/include/asm/u-boot.h |  25 
 arch/sandbox/lib/Makefile |   3 -
 arch/sandbox/lib/board.c  | 285 --
 3 files changed, 313 deletions(-)
 delete mode 100644 arch/sandbox/lib/board.c

diff --git a/arch/sandbox/include/asm/u-boot.h 
b/arch/sandbox/include/asm/u-boot.h
index 7b93acb..5bea1f2 100644
--- a/arch/sandbox/include/asm/u-boot.h
+++ b/arch/sandbox/include/asm/u-boot.h
@@ -36,33 +36,8 @@
 #ifndef _U_BOOT_H_
 #define _U_BOOT_H_ 1
 
-#ifdef CONFIG_SYS_GENERIC_BOARD
 /* Use the generic board which requires a unified bd_info */
 #include 
-#else
-
-typedef struct bd_info {
-   unsigned long   bi_memstart;/* start of DRAM memory */
-   phys_size_t bi_memsize; /* size  of DRAM memory in bytes */
-   unsigned long   bi_flashstart;  /* start of FLASH memory */
-   unsigned long   bi_flashsize;   /* size  of FLASH memory */
-   unsigned long   bi_flashoffset; /* reserved area for startup monitor */
-   unsigned long   bi_sramstart;   /* start of SRAM memory */
-   unsigned long   bi_sramsize;/* size  of SRAM memory */
-   unsigned long   bi_bootflags;   /* boot / reboot flag (for LynxOS) */
-   unsigned short  bi_ethspeed;/* Ethernet speed in Mbps */
-   unsigned long   bi_intfreq; /* Internal Freq, in MHz */
-   unsigned long   bi_busfreq; /* Bus Freq, in MHz */
-   unsigned intbi_baudrate;/* Console Baudrate */
-   unsigned long   bi_boot_params; /* where this board expects params */
-   struct  /* RAM configuration */
-   {
-   ulong start;
-   ulong size;
-   } bi_dram[CONFIG_NR_DRAM_BANKS];
-} bd_t;
-
-#endif /* !CONFIG_SYS_GENERIC_BOARD */
 
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_SANDBOX
diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
index b1ae168..3aad574 100644
--- a/arch/sandbox/lib/Makefile
+++ b/arch/sandbox/lib/Makefile
@@ -27,9 +27,6 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(ARCH).o
 
-ifndef CONFIG_SYS_GENERIC_BOARD
-COBJS-y+= board.o
-endif
 COBJS-y+= interrupts.o
 
 SRCS   := $(COBJS-y:.o=.c)
diff --git a/arch/sandbox/lib/board.c b/arch/sandbox/lib/board.c
deleted file mode 100644
index 3752fab..000
--- a/arch/sandbox/lib/board.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright (c) 2011 The Chromium OS Authors.
- *
- * (C) Copyright 2002-2006
- * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH 
- * Marius Groeger 
- *
- * 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 file was taken from ARM and changed to remove things we don't
- * need. This is most of it, so have tried to avoid being over-zealous!
- * For example, we want to have an emulation of the 'DRAM' used by
- * U-Boot.
- *
- * has been talk upstream of unifying the architectures w.r.t board.c,
- * so the less change here the better.
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static gd_t gd_mem;
-
-/
- * Init Utilities  *
- 
- * Some of this code should be moved into the core functions,
- * or dropped completely,
- * but let's get it working (again) first...
- */
-
-static int display_banner(void)
-{
-   display_options();
-
-   return 0;
-}
-
-/**
- * Configure and report on the DRAM configuration, which in our case is
- * fairly simple.
- */
-static int display_dram_config(void)
-{
-   ulong size = 0;
-   int i;
-
-   debug("RAM Configuration:\n");
-
-   for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-#ifdef DEBUG
-   printf("Bank #%d: %08lx ", i, gd->bd->bi_dram[i].start);
-   print_size(gd->bd->bi_dram[i].size, "\n");

[U-Boot] [PATCH v3 04/17] sandbox: Use generic board init

2013-04-20 Thread Simon Glass
Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2: None

 arch/sandbox/config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index aeb9da9..988b52c 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -18,7 +18,7 @@
 # MA 02111-1307 USA
 
 PLATFORM_CPPFLAGS += -DCONFIG_SANDBOX -D__SANDBOX__ -U_FORTIFY_SOURCE
-PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM
+PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM -DCONFIG_SYS_GENERIC_BOARD
 PLATFORM_LIBS += -lrt
 
 # Support generic board on sandbox
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 17/17] sandbox: config: Enable CONFIG_FIT and CONFIG_CMD_FIT

2013-04-20 Thread Simon Glass
Enable these options to use FITs on sandbox.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2: None

 include/configs/sandbox.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index 8efaded..788207d 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -29,6 +29,8 @@
 #define CONFIG_OF_HOSTFILE
 #define CONFIG_OF_LIBFDT
 #define CONFIG_LMB
+#define CONFIG_FIT
+#define CONFIG_CMD_FDT
 
 #define CONFIG_FS_FAT
 #define CONFIG_FS_EXT4
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 10/17] sandbox: fdt: Support fdt command for sandbox

2013-04-20 Thread Simon Glass
By using map_sysmem() we can get the fdt command to work correctly with
sandbox.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2:
- Rebase to use updated fdt_valid() function

 common/cmd_fdt.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index e582961..edefd77 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define MAX_LEVEL  32  /* how deeply nested we will go */
 #define SCRATCHPAD 1024/* bytes of scratchpad memory */
@@ -55,7 +56,10 @@ struct fdt_header *working_fdt;
 
 void set_working_fdt_addr(void *addr)
 {
-   working_fdt = addr;
+   void *buf;
+
+   buf = map_sysmem((ulong)addr, 0);
+   working_fdt = buf;
setenv_addr("fdtaddr", addr);
 }
 
@@ -129,13 +133,13 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
}
 
addr = simple_strtoul(argv[0], NULL, 16);
-   blob = (struct fdt_header *)addr;
+   blob = map_sysmem(addr, 0);
if (!fdt_valid(&blob))
return 1;
if (control)
gd->fdt_blob = blob;
else
-   set_working_fdt_addr((void *)addr);
+   set_working_fdt_addr(blob);
 
if (argc >= 2) {
int  len;
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 15/17] fs: Add support for saving data to filesystems

2013-04-20 Thread Simon Glass
Add a new method for saving that filesystems can implement. This mirrors the
existing load method.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2: None

 fs/fs.c  | 74 
 include/fs.h |  2 ++
 2 files changed, 76 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 6f5063c..eee7e23 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -47,6 +47,12 @@ static inline int fs_read_unsupported(const char *filename, 
void *buf,
return -1;
 }
 
+static inline int fs_write_unsupported(const char *filename, void *buf,
+ int offset, int len)
+{
+   return -1;
+}
+
 static inline void fs_close_unsupported(void)
 {
 }
@@ -57,6 +63,7 @@ struct fstype_info {
 disk_partition_t *fs_partition);
int (*ls)(const char *dirname);
int (*read)(const char *filename, void *buf, int offset, int len);
+   int (*write)(const char *filename, void *buf, int offset, int len);
void (*close)(void);
 };
 
@@ -94,6 +101,7 @@ static struct fstype_info fstypes[] = {
.close = fs_close_unsupported,
.ls = fs_ls_unsupported,
.read = fs_read_unsupported,
+   .write = fs_write_unsupported,
},
 };
 
@@ -125,6 +133,7 @@ int fs_set_blk_dev(const char *ifname, const char 
*dev_part_str, int fstype)
info->close += gd->reloc_off;
info->ls += gd->reloc_off;
info->read += gd->reloc_off;
+   info->write += gd->reloc_off;
}
relocated = 1;
}
@@ -196,6 +205,30 @@ int fs_read(const char *filename, ulong addr, int offset, 
int len)
return ret;
 }
 
+int fs_write(const char *filename, ulong addr, int offset, int len)
+{
+   struct fstype_info *info = fs_get_info(fs_type);
+   void *buf;
+   int ret;
+
+   /*
+* We don't actually know how many bytes are being read, since len==0
+* means read the whole file.
+*/
+   buf = map_sysmem(addr, len);
+   ret = info->write(filename, buf, offset, len);
+   unmap_sysmem(buf);
+
+   /* If we requested a specific number of bytes, check we got it */
+   if (ret >= 0 && len && ret != len) {
+   printf("** Unable to write file %s **\n", filename);
+   ret = -1;
+   }
+   fs_close();
+
+   return ret;
+}
+
 int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
int fstype, int cmdline_base)
 {
@@ -277,3 +310,44 @@ int do_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[],
 
return 0;
 }
+
+int do_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
+   int fstype, int cmdline_base)
+{
+   unsigned long addr;
+   const char *filename;
+   unsigned long bytes;
+   unsigned long pos;
+   int len;
+   unsigned long time;
+
+   if (argc < 6 || argc > 7)
+   return CMD_RET_USAGE;
+
+   if (fs_set_blk_dev(argv[1], argv[2], fstype))
+   return 1;
+
+   filename = argv[3];
+   addr = simple_strtoul(argv[4], NULL, cmdline_base);
+   bytes = simple_strtoul(argv[5], NULL, cmdline_base);
+   if (argc >= 7)
+   pos = simple_strtoul(argv[6], NULL, cmdline_base);
+   else
+   pos = 0;
+
+   time = get_timer(0);
+   len = fs_write(filename, addr, pos, bytes);
+   time = get_timer(time);
+   if (len <= 0)
+   return 1;
+
+   printf("%d bytes written in %lu ms", len, time);
+   if (time > 0) {
+   puts(" (");
+   print_size(len / time * 1000, "/s");
+   puts(")");
+   }
+   puts("\n");
+
+   return 0;
+}
diff --git a/include/fs.h b/include/fs.h
index b6d69e5..c837bae 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -62,5 +62,7 @@ int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[],
int fstype, int cmdline_base);
 int do_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
int fstype);
+int do_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
+   int fstype, int cmdline_base);
 
 #endif /* _FS_H */
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 08/17] Add getenv_hex() to return an environment variable as hex

2013-04-20 Thread Simon Glass
This conversion is required in a number of places in U-Boot. Add a
standard function to provide this feature, so we avoid all the different
variations in the way it is coded.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2: None

 common/cmd_nvedit.c | 15 +++
 include/common.h| 13 +
 2 files changed, 28 insertions(+)

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 68b0f4f..d893aa1 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -315,6 +315,21 @@ int setenv_hex(const char *varname, ulong value)
return setenv(varname, str);
 }
 
+ulong getenv_hex(const char *varname, ulong default_val)
+{
+   const char *s;
+   ulong value;
+   char *endp;
+
+   s = getenv(varname);
+   if (s)
+   value = simple_strtoul(s, &endp, 16);
+   if (!s || endp == s)
+   return default_val;
+
+   return value;
+}
+
 #ifndef CONFIG_SPL_BUILD
 static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const 
argv[])
 {
diff --git a/include/common.h b/include/common.h
index 76c79ae..28aa4b9 100644
--- a/include/common.h
+++ b/include/common.h
@@ -352,6 +352,19 @@ intenvmatch (uchar *, int);
 char   *getenv  (const char *);
 intgetenv_f (const char *name, char *buf, unsigned len);
 ulong getenv_ulong(const char *name, int base, ulong default_val);
+
+/**
+ * getenv_hex() - Return an environment variable as a hex value
+ *
+ * Decode an environment as a hex number (it may or may not have a 0x
+ * prefix). If the environment variable cannot be found, or does not start
+ * with hex digits, the default value is returned.
+ *
+ * @varname:   Variable to decode
+ * @default_val:   Value to return on error
+ */
+ulong getenv_hex(const char *varname, ulong default_val);
+
 /*
  * Read an environment variable as a boolean
  * Return -1 if variable does not exist (default to true)
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 16/17] sandbox: fs: Add support for saving files to host filesystem

2013-04-20 Thread Simon Glass
This allows write of files from the host filesystem in sandbox. There is
currently no concept of overwriting the file and removing its existing
contents - all writing is done on top of what is there. This means that
writing 10 bytes to the start of a 1KB file will only update those 10
bytes, not truncate the file to 10 byte slong.

If the file does not exist it is created.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2: None

 common/cmd_sandbox.c   | 18 ++
 fs/fs.c|  1 +
 fs/sandbox/sandboxfs.c | 33 +
 include/sandboxfs.h|  1 +
 4 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/common/cmd_sandbox.c b/common/cmd_sandbox.c
index 206a486..a28a844 100644
--- a/common/cmd_sandbox.c
+++ b/common/cmd_sandbox.c
@@ -32,9 +32,16 @@ static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int 
argc,
return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
+static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int argc,
+  char * const argv[])
+{
+   return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX, 16);
+}
+
 static cmd_tbl_t cmd_sandbox_sub[] = {
-   U_BOOT_CMD_MKENT(load, 3, 0, do_sandbox_load, "", ""),
+   U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""),
U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""),
+   U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""),
 };
 
 static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
@@ -56,8 +63,11 @@ static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc,
 }
 
 U_BOOT_CMD(
-   sb, 6,  1,  do_sandbox,
+   sb, 8,  1,  do_sandbox,
"Miscellaneous sandbox commands",
-   "load host   [ ]  - load a file from 
host\n"
-   "sb ls host   - save a file to host"
+   "load host[ ]  - "
+   "load a file from host\n"
+   "sb ls host   - list files on host\n"
+   "sb save host [] - "
+   "save a file to host\n"
 );
diff --git a/fs/fs.c b/fs/fs.c
index eee7e23..99e516a 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -93,6 +93,7 @@ static struct fstype_info fstypes[] = {
.close = sandbox_fs_close,
.ls = sandbox_fs_ls,
.read = fs_read_sandbox,
+   .write = fs_write_sandbox,
},
 #endif
{
diff --git a/fs/sandbox/sandboxfs.c b/fs/sandbox/sandboxfs.c
index 02d26ff..89769e8 100644
--- a/fs/sandbox/sandboxfs.c
+++ b/fs/sandbox/sandboxfs.c
@@ -48,6 +48,26 @@ long sandbox_fs_read_at(const char *filename, unsigned long 
pos,
return size;
 }
 
+long sandbox_fs_write_at(const char *filename, unsigned long pos,
+void *buffer, unsigned long towrite)
+{
+   ssize_t size;
+   int fd, ret;
+
+   fd = os_open(filename, OS_O_RDWR | OS_O_CREAT);
+   if (fd < 0)
+   return fd;
+   ret = os_lseek(fd, pos, OS_SEEK_SET);
+   if (ret == -1) {
+   os_close(fd);
+   return ret;
+   }
+   size = os_write(fd, buffer, towrite);
+   os_close(fd);
+
+   return size;
+}
+
 int sandbox_fs_ls(const char *dirname)
 {
struct os_dirent_node *head, *node;
@@ -81,3 +101,16 @@ int fs_read_sandbox(const char *filename, void *buf, int 
offset, int len)
 
return len_read;
 }
+
+int fs_write_sandbox(const char *filename, void *buf, int offset, int len)
+{
+   int len_written;
+
+   len_written = sandbox_fs_write_at(filename, offset, buf, len);
+   if (len_written == -1) {
+   printf("** Unable to write file %s **\n", filename);
+   return -1;
+   }
+
+   return len_written;
+}
diff --git a/include/sandboxfs.h b/include/sandboxfs.h
index f5213ac..8ea8cb7 100644
--- a/include/sandboxfs.h
+++ b/include/sandboxfs.h
@@ -26,5 +26,6 @@ long sandbox_fs_read_at(const char *filename, unsigned long 
pos,
 void sandbox_fs_close(void);
 int sandbox_fs_ls(const char *dirname);
 int fs_read_sandbox(const char *filename, void *buf, int offset, int len);
+int fs_write_sandbox(const char *filename, void *buf, int offset, int len);
 
 #endif
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 11/17] fdt: Skip checking FDT if the pointer is NULL

2013-04-20 Thread Simon Glass
If we have no FDT, don't attempt to read from it. This allows sandbox to
run without an FDT if required.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2:
- Fix checkpatch checks about parenthesis alignment

 lib/fdtdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 60369fb..ac1fe0b 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -354,7 +354,8 @@ int fdtdec_check_fdt(void)
  */
 int fdtdec_prepare_fdt(void)
 {
-   if (((uintptr_t)gd->fdt_blob & 3) || fdt_check_header(gd->fdt_blob)) {
+   if (!gd->fdt_blob || ((uintptr_t)gd->fdt_blob & 3) ||
+   fdt_check_header(gd->fdt_blob)) {
printf("No valid FDT found - please append one to U-Boot "
"binary, use u-boot-dtb.bin or define "
"CONFIG_OF_EMBED. For sandbox, use -d \n");
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 06/17] sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file

2013-04-20 Thread Simon Glass
With sandbox it is tricky to add an FDT to the image at build time (or
later) since we build an ELF file, not a plain binary, and the address
space of the whole U-Boot is not accessible in the emulated memory map
of sandbox.

Sandbox can read files directly from the host, though, so add an option
to read an FDT from a host file on start-up.

Signed-off-by: Simon Glass 
---
Changes in v3:
- Add CONFIG_OF_HOSTFILE support to generic board instead of sandbox

Changes in v2:
- Fix typo "os defined" -> "is defined"
- Use gd->arch.ram_buf instead of gd->ram_buf (now that generic board is in)
- Fix checkpatch warnings about split strings

 arch/sandbox/cpu/start.c |  7 +
 arch/sandbox/include/asm/state.h |  1 +
 common/board_f.c | 55 
 doc/README.fdt-control   |  6 -
 include/configs/sandbox.h|  2 ++
 5 files changed, 70 insertions(+), 1 deletion(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 5287fd5..2fcec8b 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -104,6 +104,13 @@ static int sb_cmdline_cb_command(struct sandbox_state 
*state, const char *arg)
 }
 SB_CMDLINE_OPT_SHORT(command, 'c', 1, "Execute U-Boot command");
 
+static int sb_cmdline_cb_fdt(struct sandbox_state *state, const char *arg)
+{
+   state->fdt_fname = arg;
+   return 0;
+}
+SB_CMDLINE_OPT_SHORT(fdt, 'd', 1, "Specify U-Boot's control FDT");
+
 int main(int argc, char *argv[])
 {
struct sandbox_state *state;
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index 2b62b46..9552708 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -34,6 +34,7 @@ enum exit_type_id {
 /* The complete state of the test system */
 struct sandbox_state {
const char *cmd;/* Command to execute */
+   const char *fdt_fname;  /* Filename of FDT binary */
enum exit_type_id exit_type;/* How we exited U-Boot */
const char *parse_err;  /* Error to report from parsing */
int argc;   /* Program arguments */
diff --git a/common/board_f.c b/common/board_f.c
index 2045055..3a6638f 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 #if defined(CONFIG_CMD_IDE)
 #include 
 #endif
@@ -305,6 +306,55 @@ __weak int arch_cpu_init(void)
return 0;
 }
 
+#ifdef CONFIG_OF_HOSTFILE
+
+#define CHECK(x)   err = (x); if (err) goto failed;
+
+/* Create an empty device tree blob */
+static int make_empty_fdt(void *fdt)
+{
+   int err;
+
+   CHECK(fdt_create(fdt, 256));
+   CHECK(fdt_finish_reservemap(fdt));
+   CHECK(fdt_begin_node(fdt, ""));
+   CHECK(fdt_end_node(fdt));
+   CHECK(fdt_finish(fdt));
+
+   return 0;
+failed:
+   printf("Unable to create empty FDT: %s\n", fdt_strerror(err));
+   return -EACCES;
+}
+
+static int read_fdt_from_file(void)
+{
+   struct sandbox_state *state = state_get_current();
+   void *blob;
+   int size;
+   int err;
+
+   blob = map_sysmem(CONFIG_SYS_FDT_LOAD_ADDR, 0);
+   if (!state->fdt_fname) {
+   err = make_empty_fdt(blob);
+   if (!err)
+   goto done;
+   return err;
+   }
+   err = fs_set_blk_dev("host", NULL, FS_TYPE_SANDBOX);
+   if (err)
+   return err;
+   size = fs_read(state->fdt_fname, CONFIG_SYS_FDT_LOAD_ADDR, 0, 0);
+   if (size < 0)
+   return -EIO;
+
+done:
+   gd->fdt_blob = blob;
+
+   return 0;
+}
+#endif
+
 #ifdef CONFIG_SANDBOX
 static int setup_ram_buf(void)
 {
@@ -328,6 +378,11 @@ static int setup_fdt(void)
 # else
gd->fdt_blob = (ulong *)&_end;
 # endif
+#elif defined(CONFIG_OF_HOSTFILE)
+   if (read_fdt_from_file()) {
+   puts("Failed to read control FDT\n");
+   return -1;
+   }
 #endif
/* Allow the early environment to override the fdt address */
gd->fdt_blob = (void *)getenv_ulong("fdtcontroladdr", 16,
diff --git a/doc/README.fdt-control b/doc/README.fdt-control
index 8352835..5963f78 100644
--- a/doc/README.fdt-control
+++ b/doc/README.fdt-control
@@ -142,7 +142,11 @@ join the two:
 
 and then flash image.bin onto your board.
 
-You cannot use both of these options at the same time.
+If CONFIG_OF_HOSTFILE is defined, then it will be read from a file on
+startup. This is only useful for sandbox. Use the -d flag to U-Boot to
+specify the file to read.
+
+You cannot use more than one of these options at the same time.
 
 If you wish to put the fdt at a different address in memory, you can
 define the "fdtcontroladdr" environment variable. This is the hex
diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h
index da7cc9a..8efaded 100644
--- a/include/configs/sandbox.h
+++ b/include/configs/sandbox.h
@@ -26,6 +2

[U-Boot] [PATCH v3 12/17] Revert "fdt- Tell the FDT library where the device tree is"

2013-04-20 Thread Simon Glass
This reverts commit 3b73459ea3421e9f8c6c8c62e1d3fe458ca5bc56.

In practice it doesn't seem like a good idea to make the the working
FDT point to the control FDT. Now that we can access the control FDT
using the 'fdt' command, there is no need for this feature. Remove it.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2:
- Revert the whole change including the set_working_fdt_addr() part

 common/main.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/common/main.c b/common/main.c
index a15f020..953ef29 100644
--- a/common/main.c
+++ b/common/main.c
@@ -45,10 +45,6 @@
 #include 
 #endif
 
-#ifdef CONFIG_OF_LIBFDT
-#include 
-#endif /* CONFIG_OF_LIBFDT */
-
 #include 
 #include 
 #include 
@@ -376,10 +372,6 @@ void main_loop (void)
 
bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
 
-#if defined CONFIG_OF_CONTROL
-   set_working_fdt_addr((void *)gd->fdt_blob);
-#endif /* CONFIG_OF_CONTROL */
-
 #ifdef CONFIG_BOOTCOUNT_LIMIT
bootcount = bootcount_load();
bootcount++;
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 13/17] sandbox: Allow -c argument to provide a command list

2013-04-20 Thread Simon Glass
This allows passing of entire scripts to sandbox with the -c argument,
which is useful for testing. Commands can be delimited with a newline
or semicolon.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2:
- Move sandbox's command list patch from a later series

 arch/sandbox/cpu/start.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 2fcec8b..ae6e16c 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -90,7 +90,7 @@ int sandbox_main_loop_init(void)
 
/* Execute command if required */
if (state->cmd) {
-   run_command(state->cmd, 0);
+   run_command_list(state->cmd, -1, 0);
os_exit(state->exit_type);
}
 
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 03/17] sandbox: Add support for generic board

2013-04-20 Thread Simon Glass
Add generic board support for sandbox.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2: None

 arch/sandbox/config.mk|  3 +++
 arch/sandbox/include/asm/io.h |  5 
 arch/sandbox/include/asm/u-boot.h |  7 ++
 arch/sandbox/lib/Makefile |  2 ++
 board/sandbox/sandbox/sandbox.c   |  2 +-
 common/board_f.c  | 51 ---
 common/board_r.c  |  8 --
 include/asm-generic/sections.h|  2 +-
 include/configs/sandbox.h |  7 +++---
 lib/fdtdec.c  |  2 +-
 10 files changed, 72 insertions(+), 17 deletions(-)

diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk
index 4fd0d4e..aeb9da9 100644
--- a/arch/sandbox/config.mk
+++ b/arch/sandbox/config.mk
@@ -20,3 +20,6 @@
 PLATFORM_CPPFLAGS += -DCONFIG_SANDBOX -D__SANDBOX__ -U_FORTIFY_SOURCE
 PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM
 PLATFORM_LIBS += -lrt
+
+# Support generic board on sandbox
+__HAVE_ARCH_GENERIC_BOARD := y
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index 54051a3..0c022f1 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -20,6 +20,9 @@
  * MA 02111-1307 USA
  */
 
+#ifndef __SANDBOX_ASM_IO_H
+#define __SANDBOX_ASM_IO_H
+
 /*
  * Given a physical address and a length, return a virtual address
  * that can be used to access the memory range with the caching
@@ -52,3 +55,5 @@ static inline void unmap_sysmem(const void *vaddr)
 
 /* Map from a pointer to our RAM buffer */
 phys_addr_t map_to_sysmem(void *ptr);
+
+#endif
diff --git a/arch/sandbox/include/asm/u-boot.h 
b/arch/sandbox/include/asm/u-boot.h
index de8120a..7b93acb 100644
--- a/arch/sandbox/include/asm/u-boot.h
+++ b/arch/sandbox/include/asm/u-boot.h
@@ -36,6 +36,11 @@
 #ifndef _U_BOOT_H_
 #define _U_BOOT_H_ 1
 
+#ifdef CONFIG_SYS_GENERIC_BOARD
+/* Use the generic board which requires a unified bd_info */
+#include 
+#else
+
 typedef struct bd_info {
unsigned long   bi_memstart;/* start of DRAM memory */
phys_size_t bi_memsize; /* size  of DRAM memory in bytes */
@@ -57,6 +62,8 @@ typedef struct bd_info {
} bi_dram[CONFIG_NR_DRAM_BANKS];
 } bd_t;
 
+#endif /* !CONFIG_SYS_GENERIC_BOARD */
+
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_SANDBOX
 
diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
index fbe579b..b1ae168 100644
--- a/arch/sandbox/lib/Makefile
+++ b/arch/sandbox/lib/Makefile
@@ -27,7 +27,9 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(ARCH).o
 
+ifndef CONFIG_SYS_GENERIC_BOARD
 COBJS-y+= board.o
+endif
 COBJS-y+= interrupts.o
 
 SRCS   := $(COBJS-y:.o=.c)
diff --git a/board/sandbox/sandbox/sandbox.c b/board/sandbox/sandbox/sandbox.c
index 9883013..8bdba92 100644
--- a/board/sandbox/sandbox/sandbox.c
+++ b/board/sandbox/sandbox/sandbox.c
@@ -56,6 +56,6 @@ int timer_init(void)
 
 int dram_init(void)
 {
-   gd->ram_size = CONFIG_DRAM_SIZE;
+   gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
return 0;
 }
diff --git a/common/board_f.c b/common/board_f.c
index 00ca811..2045055 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -49,9 +49,11 @@
 #include 
 #endif
 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #ifdef CONFIG_MP
 #include 
@@ -61,6 +63,9 @@
 #include 
 #include 
 #endif
+#ifdef CONFIG_SANDBOX
+#include 
+#endif
 #include 
 
 /*
@@ -155,6 +160,7 @@ static int init_baud_rate(void)
 
 static int display_text_info(void)
 {
+#ifndef CONFIG_SANDBOX
ulong bss_start, bss_end;
 
 #ifdef CONFIG_SYS_SYM_OFFSETS
@@ -166,6 +172,7 @@ static int display_text_info(void)
 #endif
debug("U-Boot code: %08X -> %08lX  BSS: -> %08lX\n",
  CONFIG_SYS_TEXT_BASE, bss_start, bss_end);
+#endif
 
 #ifdef CONFIG_MODEM_SUPPORT
debug("Modem Support enabled\n");
@@ -284,6 +291,8 @@ static int setup_mon_len(void)
 {
 #ifdef CONFIG_SYS_SYM_OFFSETS
gd->mon_len = _bss_end_ofs;
+#elif defined(CONFIG_SANDBOX)
+   gd->mon_len = (ulong)&_end - (ulong)_init;
 #else
/* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */
gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
@@ -296,6 +305,17 @@ __weak int arch_cpu_init(void)
return 0;
 }
 
+#ifdef CONFIG_SANDBOX
+static int setup_ram_buf(void)
+{
+   gd->arch.ram_buf = os_malloc(CONFIG_SYS_SDRAM_SIZE);
+   assert(gd->arch.ram_buf);
+   gd->ram_size = CONFIG_SYS_SDRAM_SIZE;
+
+   return 0;
+}
+#endif
+
 static int setup_fdt(void)
 {
 #ifdef CONFIG_OF_EMBED
@@ -470,7 +490,7 @@ static int reserve_malloc(void)
 static int reserve_board(void)
 {
gd->dest_addr_sp -= sizeof(bd_t);
-   gd->bd = (bd_t *)gd->dest_addr_sp;
+   gd->bd = (bd_t *)map_sysmem(gd->dest_addr_sp, sizeof(bd_t));
memset(gd->bd, '\0', sizeof(bd_t));
debug("Reserving %zu Bytes for Board Info at: %08lx\n",
   

[U-Boot] [PATCH v3 02/17] sandbox: Provide a way to map from host RAM to U-Boot RAM

2013-04-20 Thread Simon Glass
In many cases, pointers to memory are passed around, and these pointers
refer to U-Boot memory, not host memory. This in itself is not a
problem.

However, in a few places, we cast that pointer back to a ulong (being
a U-Boot memory address). It is possible to convert many of these cases
to avoid this. However there are data structures (e.g. struct
bootm_headers) which use pointers. We could with a lot of effort adjust
the structs and all code that uses them to use ulong instead of pointers.

This seems like an unacceptable cost, since our objective with sandbox
is to minimise the impact on U-Boot code while maximising the features
available to sandbox.

Therefore, create a map_to_sysmem() function which converts from a
pointer to a U-Boot address. This can be used sparingly when needed.

Signed-off-by: Simon Glass 
---
Changes in v3:
- Rebase on master, to take account of generic board

Changes in v2:
- Use gd->arch.ram_buf instead of gd->ram_buf (now that generic board is in)

 arch/sandbox/cpu/cpu.c| 5 +
 arch/sandbox/include/asm/io.h | 3 +++
 include/common.h  | 5 +
 3 files changed, 13 insertions(+)

diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index b2788d5..dd8d495 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -57,6 +57,11 @@ void *map_physmem(phys_addr_t paddr, unsigned long len, 
unsigned long flags)
return (void *)(gd->arch.ram_buf + paddr);
 }
 
+phys_addr_t map_to_sysmem(void *ptr)
+{
+   return (u8 *)ptr - gd->arch.ram_buf;
+}
+
 void flush_dcache_range(unsigned long start, unsigned long stop)
 {
 }
diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h
index d8c0236..54051a3 100644
--- a/arch/sandbox/include/asm/io.h
+++ b/arch/sandbox/include/asm/io.h
@@ -49,3 +49,6 @@ static inline void *map_sysmem(phys_addr_t paddr, unsigned 
long len)
 static inline void unmap_sysmem(const void *vaddr)
 {
 }
+
+/* Map from a pointer to our RAM buffer */
+phys_addr_t map_to_sysmem(void *ptr);
diff --git a/include/common.h b/include/common.h
index 0cfa6a8..76c79ae 100644
--- a/include/common.h
+++ b/include/common.h
@@ -897,6 +897,11 @@ static inline void *map_sysmem(phys_addr_t paddr, unsigned 
long len)
 static inline void unmap_sysmem(const void *vaddr)
 {
 }
+
+static inline phys_addr_t map_to_sysmem(void *ptr)
+{
+   return (phys_addr_t)(uintptr_t)ptr;
+}
 # endif
 
 #endif /* __ASSEMBLY__ */
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 09/17] fdt: Allow fdt command to check and update control FDT

2013-04-20 Thread Simon Glass
There is an existing fdt command to deal with the working FDT. Enhance this
to support the control FDT also (CONFIG_OF_CONTROL).

Signed-off-by: Simon Glass 
---
Changes in v3:
- Remove #ifdefs which are not needed now that we have generic global_data

Changes in v2:
- Correct bug in setting control FDT
- Fix checkpatch checks about parenthesis alignment

 common/cmd_fdt.c | 47 ++-
 1 file changed, 34 insertions(+), 13 deletions(-)

diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 07072f3..e582961 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -100,38 +100,59 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 */
if (argv[1][0] == 'a') {
unsigned long addr;
+   int control = 0;
+   struct fdt_header *blob;
/*
 * Set the address [and length] of the fdt.
 */
-   if (argc == 2) {
-   if (!fdt_valid(&working_fdt))
+   argc -= 2;
+   argv += 2;
+/* Temporary #ifdef - some archs don't have fdt_blob yet */
+#ifdef CONFIG_OF_CONTROL
+   if (argc && !strcmp(*argv, "-c")) {
+   control = 1;
+   argc--;
+   argv++;
+   }
+#endif
+   if (argc == 0) {
+   if (control)
+   blob = (struct fdt_header *)gd->fdt_blob;
+   else
+   blob = working_fdt;
+   if (!blob || !fdt_valid(&blob))
return 1;
-   printf("The address of the fdt is %p\n", working_fdt);
+   printf("The address of the fdt is %#08lx\n",
+  control ? (ulong)blob :
+   getenv_hex("fdtaddr", 0));
return 0;
}
 
-   addr = simple_strtoul(argv[2], NULL, 16);
-   set_working_fdt_addr((void *)addr);
-
-   if (!fdt_valid(&working_fdt))
+   addr = simple_strtoul(argv[0], NULL, 16);
+   blob = (struct fdt_header *)addr;
+   if (!fdt_valid(&blob))
return 1;
+   if (control)
+   gd->fdt_blob = blob;
+   else
+   set_working_fdt_addr((void *)addr);
 
-   if (argc >= 4) {
+   if (argc >= 2) {
int  len;
int  err;
/*
 * Optional new length
 */
-   len = simple_strtoul(argv[3], NULL, 16);
-   if (len < fdt_totalsize(working_fdt)) {
+   len = simple_strtoul(argv[1], NULL, 16);
+   if (len < fdt_totalsize(blob)) {
printf ("New length %d < existing length %d, "
"ignoring.\n",
-   len, fdt_totalsize(working_fdt));
+   len, fdt_totalsize(blob));
} else {
/*
 * Open in place with a new length.
 */
-   err = fdt_open_into(working_fdt, working_fdt, 
len);
+   err = fdt_open_into(blob, blob, len);
if (err != 0) {
printf ("libfdt fdt_open_into(): %s\n",
fdt_strerror(err));
@@ -960,7 +981,7 @@ static int fdt_print(const char *pathp, char *prop, int 
depth)
 //
 #ifdef CONFIG_SYS_LONGHELP
 static char fdt_help_text[] =
-   "addr[]- Set the fdt location to \n"
+   "addr [-c]   []   - Set the [control] fdt location to 
\n"
 #ifdef CONFIG_OF_BOARD_SETUP
"fdt boardsetup  - Do board-specific set up\n"
 #endif
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 07/17] fdt: Add a parameter to fdt_valid()

2013-04-20 Thread Simon Glass
At present this only checks working_fdt, but we want to check other FDTs
also. So add the FDT to check as a parameter to fdt_valid().

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2:
- fdt_valid() sets the FDT pointer to NULL on error, to simplify callers
- Allow the control FDT to be set even if there is currently no control FDT

 common/cmd_fdt.c | 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index ac77a08..07072f3 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -43,7 +43,7 @@
  */
 DECLARE_GLOBAL_DATA_PTR;
 
-static int fdt_valid(void);
+static int fdt_valid(struct fdt_header **blobp);
 static int fdt_parse_prop(char *const*newval, int count, char *data, int *len);
 static int fdt_print(const char *pathp, char *prop, int depth);
 static int is_printable_string(const void *data, int len);
@@ -104,9 +104,8 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 * Set the address [and length] of the fdt.
 */
if (argc == 2) {
-   if (!fdt_valid()) {
+   if (!fdt_valid(&working_fdt))
return 1;
-   }
printf("The address of the fdt is %p\n", working_fdt);
return 0;
}
@@ -114,9 +113,8 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
addr = simple_strtoul(argv[2], NULL, 16);
set_working_fdt_addr((void *)addr);
 
-   if (!fdt_valid()) {
+   if (!fdt_valid(&working_fdt))
return 1;
-   }
 
if (argc >= 4) {
int  len;
@@ -167,9 +165,8 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 * Set the address and length of the fdt.
 */
working_fdt = (struct fdt_header *)simple_strtoul(argv[2], 
NULL, 16);
-   if (!fdt_valid()) {
+   if (!fdt_valid(&working_fdt))
return 1;
-   }
 
newaddr = (struct fdt_header *)simple_strtoul(argv[3],NULL,16);
 
@@ -592,16 +589,23 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 
 //
 
-static int fdt_valid(void)
+/**
+ * fdt_valid() - Check if an FDT is valid. If not, change it to NULL
+ *
+ * @blobp: Pointer to FDT pointer
+ * @return 1 if OK, 0 if bad (in which case *blobp is set to NULL)
+ */
+static int fdt_valid(struct fdt_header **blobp)
 {
-   int  err;
+   const void *blob = *blobp;
+   int err;
 
-   if (working_fdt == NULL) {
+   if (blob == NULL) {
printf ("The address of the fdt is invalid (NULL).\n");
return 0;
}
 
-   err = fdt_check_header(working_fdt);
+   err = fdt_check_header(blob);
if (err == 0)
return 1;   /* valid */
 
@@ -611,23 +615,21 @@ static int fdt_valid(void)
 * Be more informative on bad version.
 */
if (err == -FDT_ERR_BADVERSION) {
-   if (fdt_version(working_fdt) <
+   if (fdt_version(blob) <
FDT_FIRST_SUPPORTED_VERSION) {
printf (" - too old, fdt %d < %d",
-   fdt_version(working_fdt),
+   fdt_version(blob),
FDT_FIRST_SUPPORTED_VERSION);
-   working_fdt = NULL;
}
-   if (fdt_last_comp_version(working_fdt) >
+   if (fdt_last_comp_version(blob) >
FDT_LAST_SUPPORTED_VERSION) {
printf (" - too new, fdt %d > %d",
-   fdt_version(working_fdt),
+   fdt_version(blob),
FDT_LAST_SUPPORTED_VERSION);
-   working_fdt = NULL;
}
-   return 0;
}
printf("\n");
+   *blobp = NULL;
return 0;
}
return 1;
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 14/17] sandbox: Support 'source' command

2013-04-20 Thread Simon Glass
Enhance the source command to work with sandbox, by using map_sysmem() to
convert a ulong address into a pointer.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2: None

 common/cmd_source.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/common/cmd_source.c b/common/cmd_source.c
index 02a862c..f0d7f52 100644
--- a/common/cmd_source.c
+++ b/common/cmd_source.c
@@ -36,6 +36,7 @@
 #include 
 #include 
 #include 
+#include 
 #if defined(CONFIG_8xx)
 #include 
 #endif
@@ -44,9 +45,10 @@ int
 source (ulong addr, const char *fit_uname)
 {
ulong   len;
-   image_header_t  *hdr;
+   const image_header_t *hdr;
ulong   *data;
int verify;
+   void *buf;
 #if defined(CONFIG_FIT)
const void* fit_hdr;
int noffset;
@@ -56,9 +58,10 @@ source (ulong addr, const char *fit_uname)
 
verify = getenv_yesno ("verify");
 
-   switch (genimg_get_format ((void *)addr)) {
+   buf = map_sysmem(addr, 0);
+   switch (genimg_get_format(buf)) {
case IMAGE_FORMAT_LEGACY:
-   hdr = (image_header_t *)addr;
+   hdr = buf;
 
if (!image_check_magic (hdr)) {
puts ("Bad magic number\n");
@@ -104,7 +107,7 @@ source (ulong addr, const char *fit_uname)
return 1;
}
 
-   fit_hdr = (const void *)addr;
+   fit_hdr = buf;
if (!fit_check_format (fit_hdr)) {
puts ("Bad FIT image format\n");
return 1;
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 01/17] Trigger generic board error only when building

2013-04-20 Thread Simon Glass
At present the generic board error can occur when configuring U-Boot, or
during distclean, but this is incorrect. The existing autoconf.mk may come
from an earlier U-Boot configuration which is about to be overwritten.

Make the error conditional so that it will only be triggered when we are
actually building U-Boot.

This avoids a problem where the system is being reconfigured to remove
CONFIG_SYS_GENERIC_BOARD on an architecture that does not support it.
Currently this will print an error and require the manual removal of
include/autoconf.mk.

Signed-off-by: Simon Glass 
---
Changes in v3: None
Changes in v2: None

 Makefile  | 10 ++
 config.mk |  4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 3fd6d15..42f2b02 100644
--- a/Makefile
+++ b/Makefile
@@ -183,6 +183,16 @@ endif
 # load other configuration
 include $(TOPDIR)/config.mk
 
+# Targets which don't build the source code
+NON_BUILD_TARGETS = backup clean clobber distclean mkproper tidy unconfig
+
+# Only do the generic board check when actually building, not configuring
+ifeq ($(filter $(NON_BUILD_TARGETS),$(MAKECMDGOALS)),)
+ifeq ($(findstring _config,$(MAKECMDGOALS)),)
+$(CHECK_GENERIC_BOARD)
+endif
+endif
+
 # If board code explicitly specified LDSCRIPT or CONFIG_SYS_LDSCRIPT, use
 # that (or fail if absent).  Otherwise, search for a linker script in a
 # standard location.
diff --git a/config.mk b/config.mk
index 1fd109f..16a4fdb 100644
--- a/config.mk
+++ b/config.mk
@@ -229,8 +229,8 @@ endif
 # Does this architecture support generic board init?
 ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
 ifneq ($(CONFIG_SYS_GENERIC_BOARD),)
-$(error Your architecture does not support generic board. Please undefined \
-CONFIG_SYS_GENERIC_BOARD in your board config file)
+CHECK_GENERIC_BOARD = $(error Your architecture does not support generic 
board. \
+Please undefined CONFIG_SYS_GENERIC_BOARD in your board config file)
 endif
 endif
 
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 0/17] sandbox: Generic board support and other improvements

2013-04-20 Thread Simon Glass
This series adds generic board support to sandbox and switches to use this
always.

With sandbox it was noticed that turning CONFIG_SYS_GENERIC_BOARD off
can cause a build failure if a previous autoconf.mk exists which indicates
that generic board is not supported, so a patch is provided to fix this.

It is useful to convert a pointer into an 'address' in the sandbox RAM
buffer - the opposite of map_sysmem(). This is added in this series and
used in several places.

With sandbox it is easier to read a file from the host than to use the
CONFIG_OF_SEPARATE option, since this option requires knowledge of the
executable image structure which is not really appropriate on the host
system. A new CONFIG_OF_HOSTFILE provides this.

A few related FDT changes are included in this series also.

The -c option is enhanced to support passing entire scripts to sandbox.
This is useful when writing non-trivial test code.

Most of these patches were previously submitted as part of the verified
boot effort. This series collects the independent sandbox-related patches
together to make it easier to review. THe whole series is marked as
version 3 for this reason.

Changes in v3:
- Rebase on master, to take account of generic board
- Add CONFIG_OF_HOSTFILE support to generic board instead of sandbox
- Remove #ifdefs which are not needed now that we have generic global_data

Changes in v2:
- Use gd->arch.ram_buf instead of gd->ram_buf (now that generic board is in)
- Fix typo "os defined" -> "is defined"
- Use gd->arch.ram_buf instead of gd->ram_buf (now that generic board is in)
- Fix checkpatch warnings about split strings
- fdt_valid() sets the FDT pointer to NULL on error, to simplify callers
- Allow the control FDT to be set even if there is currently no control FDT
- Correct bug in setting control FDT
- Fix checkpatch checks about parenthesis alignment
- Rebase to use updated fdt_valid() function
- Fix checkpatch checks about parenthesis alignment
- Revert the whole change including the set_working_fdt_addr() part
- Move sandbox's command list patch from a later series

Simon Glass (17):
  Trigger generic board error only when building
  sandbox: Provide a way to map from host RAM to U-Boot RAM
  sandbox: Add support for generic board
  sandbox: Use generic board init
  sandbox: Remove old board init code
  sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file
  fdt: Add a parameter to fdt_valid()
  Add getenv_hex() to return an environment variable as hex
  fdt: Allow fdt command to check and update control FDT
  sandbox: fdt: Support fdt command for sandbox
  fdt: Skip checking FDT if the pointer is NULL
  Revert "fdt- Tell the FDT library where the device tree is"
  sandbox: Allow -c argument to provide a command list
  sandbox: Support 'source' command
  fs: Add support for saving data to filesystems
  sandbox: fs: Add support for saving files to host filesystem
  sandbox: config: Enable CONFIG_FIT and CONFIG_CMD_FIT

 Makefile  |  10 ++
 arch/sandbox/config.mk|   5 +-
 arch/sandbox/cpu/cpu.c|   5 +
 arch/sandbox/cpu/start.c  |   9 +-
 arch/sandbox/include/asm/io.h |   8 ++
 arch/sandbox/include/asm/state.h  |   1 +
 arch/sandbox/include/asm/u-boot.h |  22 +--
 arch/sandbox/lib/Makefile |   1 -
 arch/sandbox/lib/board.c  | 285 --
 board/sandbox/sandbox/sandbox.c   |   2 +-
 common/board_f.c  | 106 --
 common/board_r.c  |   8 +-
 common/cmd_fdt.c  |  87 
 common/cmd_nvedit.c   |  15 ++
 common/cmd_sandbox.c  |  18 ++-
 common/cmd_source.c   |  11 +-
 common/main.c |   8 --
 config.mk |   4 +-
 doc/README.fdt-control|   6 +-
 fs/fs.c   |  75 ++
 fs/sandbox/sandboxfs.c|  33 +
 include/asm-generic/sections.h|   2 +-
 include/common.h  |  18 +++
 include/configs/sandbox.h |  11 +-
 include/fs.h  |   2 +
 include/sandboxfs.h   |   1 +
 lib/fdtdec.c  |   5 +-
 27 files changed, 383 insertions(+), 375 deletions(-)
 delete mode 100644 arch/sandbox/lib/board.c

-- 
1.8.2.1

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


Re: [U-Boot] [PATCH v5] palmtreo680: add utility that writes u-boot to flash

2013-04-20 Thread Marek Vasut
Dear Mike Dunn,

> On 04/20/2013 03:25 AM, Marek Vasut wrote:
> > Dear Mike Dunn,
> > 
> > 
> > I fixed the calloc() semantics and applied, thanks. Please repost
> > whatever is still missing in u-boot-pxa/master and I'll then roll pullRQ
> > for mainline.
> 
> Oops, the board support patch is not in your tree either.  Will repost.

Did I not ramble about it? Check that first please, I'm not sure now ;-)

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


Re: [U-Boot] [PATCH v5] palmtreo680: add utility that writes u-boot to flash

2013-04-20 Thread Mike Dunn
On 04/20/2013 03:25 AM, Marek Vasut wrote:
> Dear Mike Dunn,
> 
> 
> I fixed the calloc() semantics and applied, thanks. Please repost whatever is 
> still missing in u-boot-pxa/master and I'll then roll pullRQ for mainline.


Oops, the board support patch is not in your tree either.  Will repost.

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


Re: [U-Boot] [PATCH RESEND] arm: bootm: call udc_disable() before booting linux

2013-04-20 Thread Marek Vasut
Dear Otavio Salvador,

> On Sat, Apr 20, 2013 at 1:42 PM, Mike Dunn  wrote:
> > On the pxa270, if the udc device is not disabled before jumping to linux,
> > the device fails to initialize in linux because it was left in a running
> > state, and the linux driver assumes that it is in a disabled state.
> > 
> > Signed-off-by: Mike Dunn 
> 
> Shouldn't it be fixed in Linux, in this case?

There is a whole thread about this in the previous version if this patch, dig 
it 
up in the mailing list, you'll surely find your answer there shortly.

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


Re: [U-Boot] [PATCH RESEND] arm: bootm: call udc_disable() before booting linux

2013-04-20 Thread Otavio Salvador
On Sat, Apr 20, 2013 at 1:42 PM, Mike Dunn  wrote:
> On the pxa270, if the udc device is not disabled before jumping to linux, the
> device fails to initialize in linux because it was left in a running state, 
> and
> the linux driver assumes that it is in a disabled state.
>
> Signed-off-by: Mike Dunn 

Shouldn't it be fixed in Linux, in this case?

--
Otavio Salvador O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854  http://projetos.ossystems.com.br
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5] palmtreo680: add utility that writes u-boot to flash

2013-04-20 Thread Marek Vasut
Dear Mike Dunn,

> On 04/20/2013 03:25 AM, Marek Vasut wrote:
> > Dear Mike Dunn,
> 
> [...]
> 
> > I fixed the calloc() semantics and applied, thanks. Please repost
> > whatever is still missing in u-boot-pxa/master and I'll then roll pullRQ
> > for mainline.
> 
> Thanks Marek.  Now I see your point regarding calloc() semantics.  Only
> 
> arm: bootm: call udc_disable() before booting linux
> 
> is not in your tree; I think you were worried about testing on musb boards.
> I'll repost, but no reason to take a risk; I hope to get a patch for the
> Linux udc driver upstream soon.

Ah yes, sorry about that. I wonder if Tom tested it or maybe Albert.

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


Re: [U-Boot] [PATCH 2/6] nand: Add SPL_NAND support to mxc_nand_spl

2013-04-20 Thread Marek Vasut
Dear Benoît Thébaudeau,

> Dear Marek Vasut,
> 
> On Friday, April 19, 2013 7:06:39 PM, Marek Vasut wrote:
> > Subject: Re: [PATCH 2/6] nand: Add SPL_NAND support to mxc_nand_spl
> > 
> > Dear Benoît Thébaudeau,
> > 
> > > Dear Marek Vasut,
> > > 
> > > On Friday, April 19, 2013 1:14:16 PM, Marek Vasut wrote:
> > > > Dear Benoît Thébaudeau,
> > > > 
> > > > > On Friday, April 19, 2013 10:38:48 AM, Benoît Thébaudeau wrote:
> > > > > > Dear Marek Vasut,
> > > > > > 
> > > > > > On Friday, April 19, 2013 6:10:51 AM, Marek Vasut wrote:
> > > > > > > Add support for generic NAND SPL via the SPL framework into the
> > > > > > > mxc_nand_spl driver. This is basically just a simple rename and
> > > > > > > publication of the already implemented functions. To avoid the
> > > > > > > old function which are used with the nand_spl/ stuff getting in
> > > > > > > the way of NAND SPL framework, the macro CONFIG_SPL_NAND_LEGACY
> > > > > > > was introduced and two remaining legacy boards were adjusted.
> > > > > > > These board need to be either fixed or removed in the long run,
> > > > > > > but I don't have either.
> > > > > > > 
> > > > > > > Also make sure the requested payload is aligned to full pages,
> > > > > > > otherwise this simple driver fails to load the last page.
> > > > > > > 
> > > > > > > Signed-off-by: Marek Vasut 
> > > > > > > Cc: Albert ARIBAUD 
> > > > > > > Cc: Benoît Thébaudeau 
> > > > > > > Cc: Fabio Estevam 
> > > > > > > Cc: Scott Wood 
> > > > > > > Cc: Stefano Babic 
> > > > > > > Cc: Tom Rini 
> > > > > > > ---
> > > > > > > 
> > > > > > >  drivers/mtd/nand/mxc_nand_spl.c | 13 ++---
> > > > > > >  include/configs/mx31pdk.h   |  1 +
> > > > > > >  include/configs/tx25.h  |  1 +
> > > > > > >  3 files changed, 12 insertions(+), 3 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > > b/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > > index 09f23c3..8ff03c9 100644
> > > > > > > --- a/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > > +++ b/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > > @@ -290,7 +290,7 @@ static int is_badblock(int pagenumber)
> > > > > > > 
> > > > > > >   return 0;
> > > > > > >  
> > > > > > >  }
> > > > > > > 
> > > > > > > -static int nand_load(unsigned int from, unsigned int size,
> > > > > > > unsigned char *buf)
> > > > > > > +int nand_spl_load_image(uint32_t from, unsigned int size, void
> > > > > > > *buf)
> > > > > > > 
> > > > > > >  {
> > > > > > >  
> > > > > > >   int i;
> > > > > > >   unsigned int page;
> > > > > > > 
> > > > > > > @@ -303,6 +303,7 @@ static int nand_load(unsigned int from,
> > > > > > > unsigned int size, unsigned char *buf)
> > > > > > > 
> > > > > > >   page = from / CONFIG_SYS_NAND_PAGE_SIZE;
> > > > > > >   i = 0;
> > > > > > > 
> > > > > > > + size = roundup(size, CONFIG_SYS_NAND_PAGE_SIZE);
> > > > > > > 
> > > > > > >   while (i < size / CONFIG_SYS_NAND_PAGE_SIZE) {
> > > > > > >   
> > > > > > >   if (nfc_read_page(page, buf) < 0)
> > > > > > >   
> > > > > > >   return -1;
> > > > > > > 
> > > > > > > @@ -332,6 +333,7 @@ static int nand_load(unsigned int from,
> > > > > > > unsigned int size, unsigned char *buf)
> > > > > > > 
> > > > > > >   return 0;
> > > > > > >  
> > > > > > >  }
> > > > > > > 
> > > > > > > +#ifdef CONFIG_SPL_NAND_SUPPORT_LEGACY
> > > > > > > 
> > > > > > >  /*
> > > > > > >  
> > > > > > >   * The main entry for NAND booting. It's necessary that SDRAM
> > > > > > >   is already * configured and available since this code loads
> > > > > > >   the main U-Boot image
> > > > > > > 
> > > > > > > @@ -345,8 +347,9 @@ void nand_boot(void)
> > > > > > > 
> > > > > > >* CONFIG_SYS_NAND_U_BOOT_OFFS and
> > > > > > >CONFIG_SYS_NAND_U_BOOT_SIZE must * be aligned to full pages
> > > > > > >*/
> > > > > > > 
> > > > > > > - if (!nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS,
> > > > > > > CONFIG_SYS_NAND_U_BOOT_SIZE, -   (uchar
> > > > > > > *)CONFIG_SYS_NAND_U_BOOT_DST)) {
> > > > > > > + if (!nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
> > > > > > > + CONFIG_SYS_NAND_U_BOOT_SIZE,
> > > > > > > + (uchar *)CONFIG_SYS_NAND_U_BOOT_DST)) {
> > > > > > > 
> > > > > > >   /* Copy from NAND successful, start U-boot */
> > > > > > >   uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
> > > > > > >   uboot();
> > > > > > > 
> > > > > > > @@ -364,3 +367,7 @@ void hang(void)
> > > > > > > 
> > > > > > >   /* Loop forever */
> > > > > > >   while (1) ;
> > > > > > >  
> > > > > > >  }
> > > > > > > 
> > > > > > > +#endif
> > > > > > > +
> > > > > > > +void nand_init(void) {}
> > > > > > > +void nand_deselect(void) {}
> > > > > > > diff --git a/include/configs/mx31pdk.h
> > > > > > > b/include/configs/mx31pdk.h index 1754595..217552e 100644
> > > > > > > --- a/include/configs/mx31pdk.h
> > > > > > > +++ b/include/configs/mx31pdk.h
> > > > > > > @@ -50,6 +50,7 @@
> > > > >

[U-Boot] [PATCH RESEND] arm: bootm: call udc_disable() before booting linux

2013-04-20 Thread Mike Dunn
On the pxa270, if the udc device is not disabled before jumping to linux, the
device fails to initialize in linux because it was left in a running state, and
the linux driver assumes that it is in a disabled state.

Signed-off-by: Mike Dunn 
---
Arguably, this is a bug in the linux driver, but it seemed pretty simple and
benign to just disable it in u-boot.  I'll also send a patch to upstream kernel
to fix its udc driver.

 arch/arm/include/asm/bootm.h |1 +
 arch/arm/lib/bootm.c |1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/bootm.h b/arch/arm/include/asm/bootm.h
index db2ff94..68189cc 100644
--- a/arch/arm/include/asm/bootm.h
+++ b/arch/arm/include/asm/bootm.h
@@ -21,6 +21,7 @@
 
 #ifdef CONFIG_USB_DEVICE
 extern void udc_disconnect(void);
+extern void udc_disable(void);
 #endif
 
 #endif
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index f3b30c5..6daa7bf 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -105,6 +105,7 @@ static void announce_and_cleanup(void)
 
 #ifdef CONFIG_USB_DEVICE
udc_disconnect();
+   udc_disable();
 #endif
cleanup_before_linux();
 }
-- 
1.7.8.6

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


Re: [U-Boot] [PATCH v5] palmtreo680: add utility that writes u-boot to flash

2013-04-20 Thread Mike Dunn
On 04/20/2013 03:25 AM, Marek Vasut wrote:
> Dear Mike Dunn,

[...]

> 
> I fixed the calloc() semantics and applied, thanks. Please repost whatever is 
> still missing in u-boot-pxa/master and I'll then roll pullRQ for mainline.

Thanks Marek.  Now I see your point regarding calloc() semantics.  Only

arm: bootm: call udc_disable() before booting linux

is not in your tree; I think you were worried about testing on musb boards.
I'll repost, but no reason to take a risk; I hope to get a patch for the Linux
udc driver upstream soon.

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


Re: [U-Boot] [PATCH 2/6] nand: Add SPL_NAND support to mxc_nand_spl

2013-04-20 Thread Benoît Thébaudeau
Dear Marek Vasut,

On Friday, April 19, 2013 7:06:39 PM, Marek Vasut wrote:
> Subject: Re: [PATCH 2/6] nand: Add SPL_NAND support to mxc_nand_spl
> 
> Dear Benoît Thébaudeau,
> 
> > Dear Marek Vasut,
> > 
> > On Friday, April 19, 2013 1:14:16 PM, Marek Vasut wrote:
> > > Dear Benoît Thébaudeau,
> > > 
> > > > On Friday, April 19, 2013 10:38:48 AM, Benoît Thébaudeau wrote:
> > > > > Dear Marek Vasut,
> > > > > 
> > > > > On Friday, April 19, 2013 6:10:51 AM, Marek Vasut wrote:
> > > > > > Add support for generic NAND SPL via the SPL framework into the
> > > > > > mxc_nand_spl driver. This is basically just a simple rename and
> > > > > > publication of the already implemented functions. To avoid the
> > > > > > old function which are used with the nand_spl/ stuff getting in
> > > > > > the way of NAND SPL framework, the macro CONFIG_SPL_NAND_LEGACY
> > > > > > was introduced and two remaining legacy boards were adjusted.
> > > > > > These board need to be either fixed or removed in the long run,
> > > > > > but I don't have either.
> > > > > > 
> > > > > > Also make sure the requested payload is aligned to full pages,
> > > > > > otherwise this simple driver fails to load the last page.
> > > > > > 
> > > > > > Signed-off-by: Marek Vasut 
> > > > > > Cc: Albert ARIBAUD 
> > > > > > Cc: Benoît Thébaudeau 
> > > > > > Cc: Fabio Estevam 
> > > > > > Cc: Scott Wood 
> > > > > > Cc: Stefano Babic 
> > > > > > Cc: Tom Rini 
> > > > > > ---
> > > > > > 
> > > > > >  drivers/mtd/nand/mxc_nand_spl.c | 13 ++---
> > > > > >  include/configs/mx31pdk.h   |  1 +
> > > > > >  include/configs/tx25.h  |  1 +
> > > > > >  3 files changed, 12 insertions(+), 3 deletions(-)
> > > > > > 
> > > > > > diff --git a/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > b/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > index 09f23c3..8ff03c9 100644
> > > > > > --- a/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > +++ b/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > @@ -290,7 +290,7 @@ static int is_badblock(int pagenumber)
> > > > > > 
> > > > > > return 0;
> > > > > >  
> > > > > >  }
> > > > > > 
> > > > > > -static int nand_load(unsigned int from, unsigned int size,
> > > > > > unsigned char *buf)
> > > > > > +int nand_spl_load_image(uint32_t from, unsigned int size, void
> > > > > > *buf)
> > > > > > 
> > > > > >  {
> > > > > >  
> > > > > > int i;
> > > > > > unsigned int page;
> > > > > > 
> > > > > > @@ -303,6 +303,7 @@ static int nand_load(unsigned int from,
> > > > > > unsigned int size, unsigned char *buf)
> > > > > > 
> > > > > > page = from / CONFIG_SYS_NAND_PAGE_SIZE;
> > > > > > i = 0;
> > > > > > 
> > > > > > +   size = roundup(size, CONFIG_SYS_NAND_PAGE_SIZE);
> > > > > > 
> > > > > > while (i < size / CONFIG_SYS_NAND_PAGE_SIZE) {
> > > > > > 
> > > > > > if (nfc_read_page(page, buf) < 0)
> > > > > > 
> > > > > > return -1;
> > > > > > 
> > > > > > @@ -332,6 +333,7 @@ static int nand_load(unsigned int from,
> > > > > > unsigned int size, unsigned char *buf)
> > > > > > 
> > > > > > return 0;
> > > > > >  
> > > > > >  }
> > > > > > 
> > > > > > +#ifdef CONFIG_SPL_NAND_SUPPORT_LEGACY
> > > > > > 
> > > > > >  /*
> > > > > >  
> > > > > >   * The main entry for NAND booting. It's necessary that SDRAM is
> > > > > >   already * configured and available since this code loads the main
> > > > > >   U-Boot image
> > > > > > 
> > > > > > @@ -345,8 +347,9 @@ void nand_boot(void)
> > > > > > 
> > > > > >  * CONFIG_SYS_NAND_U_BOOT_OFFS and CONFIG_SYS_NAND_U_BOOT_SIZE
> > > > > >  must * be aligned to full pages
> > > > > >  */
> > > > > > 
> > > > > > -   if (!nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS,
> > > > > > CONFIG_SYS_NAND_U_BOOT_SIZE, - (uchar
> > > > > > *)CONFIG_SYS_NAND_U_BOOT_DST)) {
> > > > > > +   if (!nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
> > > > > > +   CONFIG_SYS_NAND_U_BOOT_SIZE,
> > > > > > +   (uchar *)CONFIG_SYS_NAND_U_BOOT_DST)) {
> > > > > > 
> > > > > > /* Copy from NAND successful, start U-boot */
> > > > > > uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
> > > > > > uboot();
> > > > > > 
> > > > > > @@ -364,3 +367,7 @@ void hang(void)
> > > > > > 
> > > > > > /* Loop forever */
> > > > > > while (1) ;
> > > > > >  
> > > > > >  }
> > > > > > 
> > > > > > +#endif
> > > > > > +
> > > > > > +void nand_init(void) {}
> > > > > > +void nand_deselect(void) {}
> > > > > > diff --git a/include/configs/mx31pdk.h b/include/configs/mx31pdk.h
> > > > > > index 1754595..217552e 100644
> > > > > > --- a/include/configs/mx31pdk.h
> > > > > > +++ b/include/configs/mx31pdk.h
> > > > > > @@ -50,6 +50,7 @@
> > > > > > 
> > > > > >  #define CONFIG_SPL_LDSCRIPT
> > > > > > "arch/$(ARCH)/cpu/u-boot-spl.lds"
> > > > > >  #define CONFIG_SPL_MAX_SIZE2048
> > > > > >  #define CONFIG_SPL_NAND_SUPPORT
> > > > > > 
> > > > > > +#d

Re: [U-Boot] [PATCH 2/6] nand: Add SPL_NAND support to mxc_nand_spl

2013-04-20 Thread Benoît Thébaudeau
Dear Marek Vasut,

On Friday, April 19, 2013 7:08:06 PM, Marek Vasut wrote:
> Dear Benoît Thébaudeau,
> 
> > Dear Marek Vasut,
> > 
> > On Friday, April 19, 2013 1:55:31 PM, Benoît Thébaudeau wrote:
> > > Dear Marek Vasut,
> > > 
> > > On Friday, April 19, 2013 1:14:16 PM, Marek Vasut wrote:
> > > > Dear Benoît Thébaudeau,
> > > > 
> > > > > On Friday, April 19, 2013 10:38:48 AM, Benoît Thébaudeau wrote:
> > > > > > Dear Marek Vasut,
> > > > > > 
> > > > > > On Friday, April 19, 2013 6:10:51 AM, Marek Vasut wrote:
> > > > > > > Add support for generic NAND SPL via the SPL framework into the
> > > > > > > mxc_nand_spl driver. This is basically just a simple rename and
> > > > > > > publication of the already implemented functions. To avoid the
> > > > > > > old function which are used with the nand_spl/ stuff getting in
> > > > > > > the way of NAND SPL framework, the macro CONFIG_SPL_NAND_LEGACY
> > > > > > > was introduced and two remaining legacy boards were adjusted.
> > > > > > > These board need to be either fixed or removed in the long run,
> > > > > > > but I don't have either.
> > > > > > > 
> > > > > > > Also make sure the requested payload is aligned to full pages,
> > > > > > > otherwise this simple driver fails to load the last page.
> > > > > > > 
> > > > > > > Signed-off-by: Marek Vasut 
> > > > > > > Cc: Albert ARIBAUD 
> > > > > > > Cc: Benoît Thébaudeau 
> > > > > > > Cc: Fabio Estevam 
> > > > > > > Cc: Scott Wood 
> > > > > > > Cc: Stefano Babic 
> > > > > > > Cc: Tom Rini 
> > > > > > > ---
> > > > > > > 
> > > > > > >  drivers/mtd/nand/mxc_nand_spl.c | 13 ++---
> > > > > > >  include/configs/mx31pdk.h   |  1 +
> > > > > > >  include/configs/tx25.h  |  1 +
> > > > > > >  3 files changed, 12 insertions(+), 3 deletions(-)
> > > > > > > 
> > > > > > > diff --git a/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > > b/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > > index 09f23c3..8ff03c9 100644
> > > > > > > --- a/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > > +++ b/drivers/mtd/nand/mxc_nand_spl.c
> > > > > > > @@ -290,7 +290,7 @@ static int is_badblock(int pagenumber)
> > > > > > > 
> > > > > > >   return 0;
> > > > > > >  
> > > > > > >  }
> > > > > > > 
> > > > > > > -static int nand_load(unsigned int from, unsigned int size,
> > > > > > > unsigned char *buf)
> > > > > > > +int nand_spl_load_image(uint32_t from, unsigned int size, void
> > > > > > > *buf)
> > > > > > > 
> > > > > > >  {
> > > > > > >  
> > > > > > >   int i;
> > > > > > >   unsigned int page;
> > > > > > > 
> > > > > > > @@ -303,6 +303,7 @@ static int nand_load(unsigned int from,
> > > > > > > unsigned int size, unsigned char *buf)
> > > > > > > 
> > > > > > >   page = from / CONFIG_SYS_NAND_PAGE_SIZE;
> > > > > > >   i = 0;
> > > > > > > 
> > > > > > > + size = roundup(size, CONFIG_SYS_NAND_PAGE_SIZE);
> > > > > > > 
> > > > > > >   while (i < size / CONFIG_SYS_NAND_PAGE_SIZE) {
> > > > > > >   
> > > > > > >   if (nfc_read_page(page, buf) < 0)
> > > > > > >   
> > > > > > >   return -1;
> > > > > > > 
> > > > > > > @@ -332,6 +333,7 @@ static int nand_load(unsigned int from,
> > > > > > > unsigned int size, unsigned char *buf)
> > > > > > > 
> > > > > > >   return 0;
> > > > > > >  
> > > > > > >  }
> > > > > > > 
> > > > > > > +#ifdef CONFIG_SPL_NAND_SUPPORT_LEGACY
> > > > > > > 
> > > > > > >  /*
> > > > > > >  
> > > > > > >   * The main entry for NAND booting. It's necessary that SDRAM is
> > > > > > >   already * configured and available since this code loads the
> > > > > > >   main U-Boot image
> > > > > > > 
> > > > > > > @@ -345,8 +347,9 @@ void nand_boot(void)
> > > > > > > 
> > > > > > >* CONFIG_SYS_NAND_U_BOOT_OFFS and CONFIG_SYS_NAND_U_BOOT_SIZE
> > > > > > >must * be aligned to full pages
> > > > > > >*/
> > > > > > > 
> > > > > > > - if (!nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS,
> > > > > > > CONFIG_SYS_NAND_U_BOOT_SIZE, -   (uchar
> > > > > > > *)CONFIG_SYS_NAND_U_BOOT_DST)) {
> > > > > > > + if (!nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
> > > > > > > + CONFIG_SYS_NAND_U_BOOT_SIZE,
> > > > > > > + (uchar *)CONFIG_SYS_NAND_U_BOOT_DST)) {
> > > > > > > 
> > > > > > >   /* Copy from NAND successful, start U-boot */
> > > > > > >   uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
> > > > > > >   uboot();
> > > > > > > 
> > > > > > > @@ -364,3 +367,7 @@ void hang(void)
> > > > > > > 
> > > > > > >   /* Loop forever */
> > > > > > >   while (1) ;
> > > > > > >  
> > > > > > >  }
> > > > > > > 
> > > > > > > +#endif
> > > > > > > +
> > > > > > > +void nand_init(void) {}
> > > > > > > +void nand_deselect(void) {}
> > > > > > > diff --git a/include/configs/mx31pdk.h
> > > > > > > b/include/configs/mx31pdk.h index 1754595..217552e 100644
> > > > > > > --- a/include/configs/mx31pdk.h
> > > > > > > +++ b/include/configs/mx31pdk.h
> > > > > > > @@ -50,6 +50,7 @@
> > > > > > > 
> > > > > > 

Re: [U-Boot] [PATCH 4/6] arm: mx5: Add SPL support code to MX5

2013-04-20 Thread Marek Vasut
Dear Philip Paeps,

> On 2013-04-19 06:10:53 (+0200), Marek Vasut  wrote:
> > Fix minor adjustments needed to get SPL framework building on MX5.
> 
> The same adjustment is needed to make other mx* build.  Perhaps spl.h
> should live under arch/arm/include/asm/imx-common to avoid duplicating
> it for others?

Yes, sounds reasonable.

>  - Philip
>
> -- 
> Philip Paeps
> Senior Reality Engineer
> Ministry of Information

Is that from 1984 ? :-)

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


Re: [U-Boot] [PATCH v5] palmtreo680: add utility that writes u-boot to flash

2013-04-20 Thread Marek Vasut
Dear Mike Dunn,

> This adds a userspace linux utility that writes the u-boot image to an mtd
> partition on the docg4 nand flash.
> 
> A special utility is required to do this because u-boot is partially loaded
> by an initial program loader (IPL) that is permanently programmed to the
> boot region of the flash.  This IPL expects the image to be written in a
> unique format. The characteristics of this format can be summarized as
> follows: - Flash blocks to be loaded must have a magic number in the oob
> bytes of the first page of the block.
>   - Each page must be written redundantly in the subsequent page.
>   - The integrated flash controller's "reliable mode" is used, requiring
> that alternate 2k regions (4 pages) are skipped when writing.
> For these reasons, a u-boot image can not be written using nandwrite from
> mtd-utils.

I fixed the calloc() semantics and applied, thanks. Please repost whatever is 
still missing in u-boot-pxa/master and I'll then roll pullRQ for mainline.

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


Re: [U-Boot] [U-Boot, v3, 6/8] USB: SS: Add support for Super Speed USB interface

2013-04-20 Thread Marek Vasut
Dear Julius Werner,

> These patches haven't gone in yet, right? I think Vivek wants to
> discuss/update them himself, he just asked me to move my reviews to
> this thread.

They're not in, but they're already pushed in my tree. It'd be also easier to 
review diff instead of full patches again.

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