Re: [U-Boot] [PATCH 10/26] Kconfig: Move CONFIG_FIT and CONFIG_OF_*_SETUP to Kconfig

2016-01-28 Thread Heiko Schocher

Hello Simon,

Am 28.01.2016 um 17:39 schrieb Simon Glass:

Move these options to Kconfig and tidy up board configuration:

CONFIG_FIT
CONFIG_OF_BOARD_SETUP
CONFIG_OF_SYSTEM_SETUP

Unfortunately the first one is a little complicated. We need to make sure
this option is not enabled in SPL by this change. Also this option is
enabled automatically in the host builds by defining CONFIG_GIT in the


CONFIG_FIT ?


image.h file. To solve this, add a new IMAGE_USE_FIT #define which can
be used in files that are built on the host but must also build for U-Boot
and SPL.

Note: Masahiro's moveconfig.py script is amazing.

Signed-off-by: Simon Glass 
---


bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 15/26] mkimage: Allow a FIT to include an image of any type

2016-01-28 Thread Simon Glass
At present FIT images are set up by providing a device tree source file
which is a file with a .its extension. We want to support automatically
creating this file based on the image supplied to mkimage. This means that
even though the final file type is always IH_TYPE_FLATDT, the image inside
may be something else.

Signed-off-by: Simon Glass 
---

 tools/imagetool.h |  1 +
 tools/mkimage.c   | 33 -
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/tools/imagetool.h b/tools/imagetool.h
index ad2deb5..e0397f7 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -61,6 +61,7 @@ struct image_tool_params {
int require_keys;   /* 1 to mark signing keys as 'required' */
int file_size;  /* Total size of output file */
int orig_file_size; /* Original size for file before padding */
+   int fit_image_type; /* Image type to put into the FIT */
 };
 
 /*
diff --git a/tools/mkimage.c b/tools/mkimage.c
index b8293f6..73367d1 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -112,10 +112,14 @@ static void usage(const char *msg)
 static void process_args(int argc, char **argv)
 {
char *ptr;
+   int type = IH_TYPE_INVALID;
+   char *datafile = NULL;
+   int expecting;
int opt;
 
+   expecting = IH_TYPE_COUNT;  /* Unknown */
while ((opt = getopt(argc, argv,
-"a:A:cC:d:D:e:f:Fk:K:ln:O:rR:sT:vVx")) != -1) {
+"-a:A:cC:d:D:e:f:Fk:K:ln:O:rR:sT:vVx")) != -1) {
switch (opt) {
case 'a':
params.addr = strtoul(optarg, , 16);
@@ -162,6 +166,7 @@ static void process_args(int argc, char **argv)
 * The flattened image tree (FIT) format
 * requires a flattened device tree image type
 */
+   params.fit_image_type = params.type;
params.type = IH_TYPE_FLATDT;
params.fflag = 1;
break;
@@ -196,11 +201,12 @@ static void process_args(int argc, char **argv)
params.skipcpy = 1;
break;
case 'T':
-   params.type = genimg_get_type_id(optarg);
-   if (params.type < 0) {
+   type = genimg_get_type_id(optarg);
+   if (type < 0) {
show_image_types();
usage("Invalid image type");
}
+   expecting = type;
break;
case 'v':
params.vflag++;
@@ -211,14 +217,31 @@ static void process_args(int argc, char **argv)
case 'x':
params.xflag++;
break;
+   case 1:
+   if (expecting == type || expecting == IH_TYPE_COUNT) {
+   params.imagefile = optarg;
+   expecting = IH_TYPE_INVALID;
+   }
+   break;
default:
usage("Invalid option");
}
}
 
-   if (optind >= argc)
+   /*
+* For auto-generated FIT images we need to know the image type to put
+* in the FIT, which is separate from the file's image type (which
+* will always be IH_TYPE_FLATDT in this case).
+*/
+   if (params.type == IH_TYPE_FLATDT) {
+   params.fit_image_type = type;
+   params.datafile = datafile;
+   } else if (type != IH_TYPE_INVALID) {
+   params.type = type;
+   }
+
+   if (!params.imagefile)
usage("Missing output filename");
-   params.imagefile = argv[optind];
 }
 
 
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 21/26] mkimage: Bring data into the FIT before processing

2016-01-28 Thread Simon Glass
Since we now support data outside the FIT image, bring it into the FIT image
first before we do any processing. This avoids adding new functionality to
the core FIT code for now.

Signed-off-by: Simon Glass 
---

 tools/fit_image.c | 97 +++
 1 file changed, 97 insertions(+)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index 5d087e3..5407b9d 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -455,6 +455,98 @@ err:
return ret;
 }
 
+static int fit_import_data(struct image_tool_params *params, const char *fname)
+{
+   void *fdt, *old_fdt;
+   int fit_size, new_size, size, data_base;
+   int fd;
+   struct stat sbuf;
+   int ret;
+   int images;
+   int node;
+
+   fd = mmap_fdt(params->cmdname, fname, 0, _fdt, , false);
+   if (fd < 0)
+   return -EIO;
+   fit_size = fdt_totalsize(old_fdt);
+   data_base = (fit_size + 3) & ~3;
+
+   /* Allocate space to hold the new FIT */
+   size = sbuf.st_size + 16384;
+   fdt = malloc(size);
+   if (!fdt) {
+   fprintf(stderr, "%s: Failed to allocate memory (%d bytes)\n",
+   __func__, size);
+   ret = -ENOMEM;
+   goto err;
+   }
+   ret = fdt_open_into(old_fdt, fdt, size);
+   if (ret) {
+   debug("%s: Failed to expand FIT: %s\n", __func__,
+ fdt_strerror(errno));
+   ret = -EINVAL;
+   goto err;
+   }
+
+   images = fdt_path_offset(fdt, FIT_IMAGES_PATH);
+   if (images < 0) {
+   debug("%s: Cannot find /images node: %d\n", __func__, images);
+   ret = -EINVAL;
+   goto err;
+   }
+
+   for (node = fdt_first_subnode(fdt, images);
+node >= 0;
+node = fdt_next_subnode(fdt, node)) {
+   int buf_ptr;
+   int len;
+
+   buf_ptr = fdtdec_get_int(fdt, node, "data-offset", -1);
+   len = fdtdec_get_int(fdt, node, "data-size", -1);
+   if (buf_ptr == -1 || len == -1)
+   continue;
+   debug("Importing data size %x\n", len);
+
+   ret = fdt_setprop(fdt, node, "data", fdt + data_base + buf_ptr,
+ len);
+   if (ret) {
+   debug("%s: Failed to write property: %s\n", __func__,
+ fdt_strerror(ret));
+   ret = -EINVAL;
+   goto err;
+   }
+   }
+
+   munmap(fdt, sbuf.st_size);
+   close(fd);
+
+   /* Pack the FDT and place the data after it */
+   fdt_pack(fdt);
+
+   new_size = fdt_totalsize(fdt);
+   debug("Size expanded from %x to %x\n", fit_size, new_size);
+
+   fd = open(fname, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0666);
+   if (fd < 0) {
+   fprintf(stderr, "%s: Can't open %s: %s\n",
+   params->cmdname, fname, strerror(errno));
+   goto err;
+   }
+   if (write(fd, fdt, new_size) != new_size) {
+   debug("%s: Failed to write external data to file %s\n",
+ __func__, strerror(errno));
+   ret = -EIO;
+   goto err;
+   }
+   close(fd);
+
+   ret = 0;
+
+err:
+   close(fd);
+   return ret;
+}
+
 /**
  * fit_handle_file - main FIT file processing function
  *
@@ -510,6 +602,11 @@ static int fit_handle_file(struct image_tool_params 
*params)
goto err_system;
}
 
+   /* Move the data so it is internal to the FIT, if needed */
+   ret = fit_import_data(params, tmpfile);
+   if (ret)
+   goto err_system;
+
/*
 * Set hashes for images in the blob. Unfortunately we may need more
 * space in either FDT, so keep trying until we succeed.
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 13/26] sunxi: Display the board model on start-up

2016-01-28 Thread Simon Glass
It is useful to know which sunxi board you are booting. Display this on
start-up to avoid confusion.

Signed-off-by: Simon Glass 
---

 include/configs/sunxi-common.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 95035d8..7707067 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -174,6 +174,7 @@
 
 #define CONFIG_SYS_MONITOR_LEN (768 << 10) /* 768 KiB */
 #define CONFIG_IDENT_STRING" Allwinner Technology"
+#define CONFIG_DISPLAY_BOARDINFO
 
 #define CONFIG_ENV_OFFSET  (544 << 10) /* (8 + 24 + 512) KiB */
 #define CONFIG_ENV_SIZE(128 << 10) /* 128 KiB */
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 04/26] mkimage: Move usage() up to the top

2016-01-28 Thread Simon Glass
To avoid a forward declaration, move the usage() function higher in the
file.

Signed-off-by: Simon Glass 
---

 tools/mkimage.c | 81 ++---
 1 file changed, 42 insertions(+), 39 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 00391d0..cf4f8db 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -13,7 +13,6 @@
 #include 
 
 static void copy_file(int, const char *, int);
-static void usage(void);
 
 /* parameters initialized by core will be used by the image type code */
 struct image_tool_params params = {
@@ -67,6 +66,48 @@ static void show_image_types(void)
fprintf(stderr, "\n");
 }
 
+static void usage(void)
+{
+   fprintf(stderr, "Usage: %s -l image\n"
+"  -l ==> list image header information\n",
+   params.cmdname);
+   fprintf(stderr,
+   "   %s [-x] -A arch -O os -T type -C comp -a addr -e ep -n 
name -d data_file[:data_file...] image\n"
+   "  -A ==> set architecture to 'arch'\n"
+   "  -O ==> set operating system to 'os'\n"
+   "  -T ==> set image type to 'type'\n"
+   "  -C ==> set compression type 'comp'\n"
+   "  -a ==> set load address to 'addr' (hex)\n"
+   "  -e ==> set entry point to 'ep' (hex)\n"
+   "  -n ==> set image name to 'name'\n"
+   "  -d ==> use image data from 'datafile'\n"
+   "  -x ==> set XIP (execute in place)\n",
+   params.cmdname);
+   fprintf(stderr,
+   "   %s [-D dtc_options] [-f fit-image.its|-F] fit-image\n",
+   params.cmdname);
+   fprintf(stderr,
+   "  -D => set all options for device tree compiler\n"
+   "  -f => input filename for FIT source\n");
+#ifdef CONFIG_FIT_SIGNATURE
+   fprintf(stderr,
+   "Signing / verified boot options: [-k keydir] [-K dtb] [ -c 
] [-r]\n"
+   "  -k => set directory containing private keys\n"
+   "  -K => write public keys to this .dtb file\n"
+   "  -c => add comment in signature node\n"
+   "  -F => re-sign existing FIT image\n"
+   "  -r => mark keys used as 'required' in dtb\n");
+#else
+   fprintf(stderr,
+   "Signing / verified boot not supported (CONFIG_FIT_SIGNATURE 
undefined)\n");
+#endif
+   fprintf(stderr, "   %s -V ==> print version information and exit\n",
+   params.cmdname);
+   fprintf(stderr, "Use -T to see a list of available image types\n");
+
+   exit(EXIT_FAILURE);
+}
+
 static void process_args(int argc, char **argv)
 {
char *ptr;
@@ -556,41 +597,3 @@ copy_file (int ifd, const char *datafile, int pad)
(void) munmap((void *)ptr, sbuf.st_size);
(void) close (dfd);
 }
-
-static void usage(void)
-{
-   fprintf (stderr, "Usage: %s -l image\n"
-"  -l ==> list image header information\n",
-   params.cmdname);
-   fprintf (stderr, "   %s [-x] -A arch -O os -T type -C comp "
-"-a addr -e ep -n name -d data_file[:data_file...] 
image\n"
-"  -A ==> set architecture to 'arch'\n"
-"  -O ==> set operating system to 'os'\n"
-"  -T ==> set image type to 'type'\n"
-"  -C ==> set compression type 'comp'\n"
-"  -a ==> set load address to 'addr' (hex)\n"
-"  -e ==> set entry point to 'ep' (hex)\n"
-"  -n ==> set image name to 'name'\n"
-"  -d ==> use image data from 'datafile'\n"
-"  -x ==> set XIP (execute in place)\n",
-   params.cmdname);
-   fprintf(stderr, "   %s [-D dtc_options] [-f fit-image.its|-F] 
fit-image\n",
-   params.cmdname);
-   fprintf(stderr, "  -D => set all options for device tree 
compiler\n"
-   "  -f => input filename for FIT source\n");
-#ifdef CONFIG_FIT_SIGNATURE
-   fprintf(stderr, "Signing / verified boot options: [-k keydir] [-K dtb] 
[ -c ] [-r]\n"
-   "  -k => set directory containing private 
keys\n"
-   "  -K => write public keys to this .dtb file\n"
-   "  -c => add comment in signature node\n"
-   "  -F => re-sign existing FIT image\n"
-   "  -r => mark keys used as 'required' in 
dtb\n");
-#else
-   fprintf(stderr, "Signing / verified boot not supported 
(CONFIG_FIT_SIGNATURE undefined)\n");
-#endif
-   

[U-Boot] [PATCH 05/26] mkimage: Show an error message when usage() is called

2016-01-28 Thread Simon Glass
Sometimes incorrect arguments are supplied but the reason is not obvious to
the user. Add some helpful messages.

Signed-off-by: Simon Glass 
---

 tools/mkimage.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index cf4f8db..5aae748 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -66,8 +66,9 @@ static void show_image_types(void)
fprintf(stderr, "\n");
 }
 
-static void usage(void)
+static void usage(const char *msg)
 {
+   fprintf(stderr, "Error: %s\n", msg);
fprintf(stderr, "Usage: %s -l image\n"
 "  -l ==> list image header information\n",
params.cmdname);
@@ -127,7 +128,7 @@ static void process_args(int argc, char **argv)
case 'A':
params.arch = genimg_get_arch_id(optarg);
if (params.arch < 0)
-   usage();
+   usage("Invalid architecture");
break;
case 'c':
params.comment = optarg;
@@ -135,7 +136,7 @@ static void process_args(int argc, char **argv)
case 'C':
params.comp = genimg_get_comp_id(optarg);
if (params.comp < 0)
-   usage();
+   usage("Invalid compression type");
break;
case 'd':
params.datafile = optarg;
@@ -179,7 +180,7 @@ static void process_args(int argc, char **argv)
case 'O':
params.os = genimg_get_os_id(optarg);
if (params.os < 0)
-   usage();
+   usage("Invalid operating system");
break;
case 'r':
params.require_keys = 1;
@@ -198,7 +199,7 @@ static void process_args(int argc, char **argv)
params.type = genimg_get_type_id(optarg);
if (params.type < 0) {
show_image_types();
-   usage();
+   usage("Invalid image type");
}
break;
case 'v':
@@ -211,12 +212,12 @@ static void process_args(int argc, char **argv)
params.xflag++;
break;
default:
-   usage();
+   usage("Invalid option");
}
}
 
if (optind >= argc)
-   usage();
+   usage("Missing output filename");
params.imagefile = argv[optind];
 }
 
@@ -251,7 +252,7 @@ int main(int argc, char **argv)
 */
if (tparams->check_params)
if (tparams->check_params ())
-   usage();
+   usage("Bad parameters for image type");
 
if (!params.eflag) {
params.ep = params.addr;
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 03/26] mkimage: Sort the option processing code by option

2016-01-28 Thread Simon Glass
Adjust the code so that option alphabetical order matches the order in the
switch() statement. This makes it easier to find options.

Signed-off-by: Simon Glass 
---

 tools/mkimage.c | 50 +-
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 97ab05a..00391d0 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -75,8 +75,13 @@ static void process_args(int argc, char **argv)
while ((opt = getopt(argc, argv,
 "a:A:cC:d:D:e:f:Fk:K:ln:O:rR:sT:vVx")) != -1) {
switch (opt) {
-   case 'l':
-   params.lflag = 1;
+   case 'a':
+   params.addr = strtoul(optarg, , 16);
+   if (*ptr) {
+   fprintf(stderr, "%s: invalid load address %s\n",
+   params.cmdname, optarg);
+   exit(EXIT_FAILURE);
+   }
break;
case 'A':
params.arch = genimg_get_arch_id(optarg);
@@ -91,33 +96,13 @@ static void process_args(int argc, char **argv)
if (params.comp < 0)
usage();
break;
-   case 'D':
-   params.dtc = optarg;
-   break;
-   case 'O':
-   params.os = genimg_get_os_id(optarg);
-   if (params.os < 0)
-   usage();
-   break;
-   case 'T':
-   params.type = genimg_get_type_id(optarg);
-   if (params.type < 0) {
-   show_image_types();
-   usage();
-   }
-   break;
-   case 'a':
-   params.addr = strtoul(optarg, , 16);
-   if (*ptr) {
-   fprintf(stderr, "%s: invalid load address %s\n",
-   params.cmdname, optarg);
-   exit(EXIT_FAILURE);
-   }
-   break;
case 'd':
params.datafile = optarg;
params.dflag = 1;
break;
+   case 'D':
+   params.dtc = optarg;
+   break;
case 'e':
params.ep = strtoul(optarg, , 16);
if (*ptr) {
@@ -144,9 +129,17 @@ static void process_args(int argc, char **argv)
case 'K':
params.keydest = optarg;
break;
+   case 'l':
+   params.lflag = 1;
+   break;
case 'n':
params.imagename = optarg;
break;
+   case 'O':
+   params.os = genimg_get_os_id(optarg);
+   if (params.os < 0)
+   usage();
+   break;
case 'r':
params.require_keys = 1;
break;
@@ -160,6 +153,13 @@ static void process_args(int argc, char **argv)
case 's':
params.skipcpy = 1;
break;
+   case 'T':
+   params.type = genimg_get_type_id(optarg);
+   if (params.type < 0) {
+   show_image_types();
+   usage();
+   }
+   break;
case 'v':
params.vflag++;
break;
-- 
2.7.0.rc3.207.g0ac5344

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


Re: [U-Boot] Include patchwork patch ID in commit message?

2016-01-28 Thread Joe Hershberger
Hi Heiko,

On Thu, Jan 28, 2016 at 12:39 AM, Heiko Schocher  wrote:
> Hello Tom,
>
> Am 28.01.2016 um 00:45 schrieb Tom Rini:
>>
>> On Wed, Jan 27, 2016 at 05:15:17PM -0600, Joe Hershberger wrote:
>>>
>>> On Wed, Jan 27, 2016 at 4:22 PM, Tom Rini  wrote:

 On Wed, Jan 27, 2016 at 03:08:09PM -0600, Joe Hershberger wrote:
>
> Hi Tom,
>
> I'm playing with the idea of including the patchwork patch ID in the
> commit message of each commit that I apply to provide better
> cross-reference ability.
>
> * Access to comments on patches
> * Clarity on exactly which version of a patch was applied
> * No need to search by patch subject
>
> Here is an example in a working branch:
>
>
> http://git.denx.de/?p=u-boot/u-boot-net.git;a=commit;h=48f9a0c786d0a3cbfdf45846567deaebe27a334a


 I'd prfer Patchwork or Patchwork-ID or something not just Patch.
>>>
>>>
>>> Would it be more or less compelling if it had a format similar this?
>>>
>>> Patchwork: https://patchwork.ozlabs.org/patch/571773/
>>
>>
>> Yes.
>
>
> Sorry, for dummy question ... what should I see in the above link?

The link is the think to see, not what it points to. The idea is that
instead of just the patch number, include the patch number in a full
URL for even easier access to the patch.

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


[U-Boot] [PATCH] autoboot.c: Fill env vars in process_fdt_options() only if TEXT_BASE is set

2016-01-28 Thread Stefan Roese
The x86 build target "efi-x86" has no TEXT_BASE configured. And with the
introduction of CONFIG_BOOTDELAY for x86, this function is now called
for this board as well. Resulting in compile errors for this target.

Without TEXT_BASE it makes no sense to fill these values. So lets only
configure the env variable if TEXT_BASE is defined.

Signed-off-by: Stefan Roese 
Cc: Simon Glass 
Cc: Bin Meng 
Cc: Tom Rini 
---
 common/autoboot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index c11fb31..223e062 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -287,7 +287,7 @@ static int abortboot(int bootdelay)
 
 static void process_fdt_options(const void *blob)
 {
-#if defined(CONFIG_OF_CONTROL)
+#if defined(CONFIG_OF_CONTROL) && defined(CONFIG_SYS_TEXT_BASE)
ulong addr;
 
/* Add an env variable to point to a kernel payload, if available */
@@ -299,7 +299,7 @@ static void process_fdt_options(const void *blob)
addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
if (addr)
setenv_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
-#endif /* CONFIG_OF_CONTROL */
+#endif /* CONFIG_OF_CONTROL && CONFIG_SYS_TEXT_BASE */
 }
 
 const char *bootdelay_process(void)
-- 
2.7.0

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


[U-Boot] [PATCH 00/26] spl: Support loading a FIT image containing U-Boot

2016-01-28 Thread Simon Glass
We need a way to support more than one board per binary in U-Boot with
device tree. Various methods have been discussed. The one that seems to make
the most sense is to adjust SPL so that it can load a FIT which contains
U-Boot and several device tree binaries. This is how things with with Linux:
load a FIT and select the correct device tree to pass to Linux.

This series:

- Adjusts the build system to optionally build a u-boot.img in FIT format
that includes the U-Boot binary and >1 device tree files
- Adjusts SPL to support loading this
- Adds a way for SPL to determine which device tree to select (by calling a
board-specific function)
- Adjusts SPL to pass this selected device tree to U-Boot when it starts

It would be painful to require an .its file for each board just to support
this feature. In any case various people have commented that it would be
nice not to have to write this file in general. Therefore, this series
enhances mkimage to automatically generate a FIT without a .its file. So far
it understands how to add a main image and a number of device tree files. It
does not support hashing or verified boot as yet.

One problem with the FIT format as it stands is that all the data is inline.
This means that the entire file must be read in order to figure out what
device-tree files are available. It is then possible to copy the images into
place.

This is not really suitable for SPL since copying can be slow, and reading
unnecessary data would make the FIT format less efficient than the legacy
format.

Therefore this series adds a new feature to FIT which allows the images to
be stored immediately after the FIT itself ends. This makes the FIT very
small. It can be read quickly and in its entirety. Then the images can be
loaded one by one as needed. This allows SPL to support FITs containing lots
of images very efficiently.

To achieve this, mkimage is enhanced to convert between the 'normal' and
'external' version of a FIT file. The latter is only used for the SPL loader.
The main difference is that viewing an 'external' FIT will not show the
contents of each image.

This series also includes a few other tidy-ups, such as moving mkimage's
tricky argument-processing code to use getopt().

NOTE: There are a few problems remaining with the Kconfig conversion. I'm
still fiddling with this but thought it best to send this series out for
comment in the meantime.

This series is available at u-boot-fdt/spl-working.


Simon Glass (26):
  mkimage: Move argument processing into its own function
  mkimage: Convert to use getopt()
  mkimage: Sort the option processing code by option
  mkimage: Move usage() up to the top
  mkimage: Show an error message when usage() is called
  mkimage: Make 'params' static
  libfdt: Add a function to write a property placeholder
  Correct defconfig ordering
  Move CONFIG_OF_LIBFDT to Kconfig
  Kconfig: Move CONFIG_FIT and CONFIG_OF_*_SETUP to Kconfig
  fdt: Adjust DEFAULT_DEVICE_TREE to device on OF_CONTROL
  fdt: Allow libfdt to be used in SPL
  sunxi: Display the board model on start-up
  tools: Include fdt_sw.o in libfdt for mkimage
  mkimage: Allow a FIT to include an image of any type
  tools: Add a function to obtain the size of a file
  image: Add functions to obtain short names
  mkimage: Support automatic creating of a FIT without a .its
  mkimage: Support adding device tree files to a FIT
  mkimage: Support placing data outside the FIT
  mkimage: Bring data into the FIT before processing
  spl: Add a way for boards to select which device tree to load
  spl: Add an option to load a FIT containing U-Boot
  spl: Add a way to specify a list of device trees to include
  spl: Support loading a FIT from MMC
  RFC: sunxi: Enable SPL FIT support

 Kconfig|  11 +
 Makefile   |  10 +-
 arch/arm/cpu/armv7/sunxi/board.c   |   5 +
 cmd/disk.c |   6 +-
 common/Kconfig |  28 ++
 common/Makefile|   6 +-
 common/bootm.c |  14 +-
 common/image-fdt.c |   8 +-
 common/image-fit.c |   3 +-
 common/image.c |  50 +-
 common/spl/Makefile|   1 +
 common/spl/spl_fit.c   | 192 
 common/spl/spl_mmc.c   |  75 ++-
 configs/10m50_defconfig|   1 +
 configs/3c120_defconfig|   1 +
 configs/A10-OLinuXino-Lime_defconfig   |   1 +
 configs/A10s-OLinuXino-M_defconfig |   1 +
 configs/A13-OLinuXinoM_defconfig   |   1 +
 configs/A13-OLinuXino_defconfig|   1 +
 configs/A20-OLinuXino-Lime2_defconfig  |   1 +
 

[U-Boot] [PATCH 01/26] mkimage: Move argument processing into its own function

2016-01-28 Thread Simon Glass
At present main() is very long. Split out the argument processing to make
it easier to follow.

Signed-off-by: Simon Glass 
---

 tools/mkimage.c | 56 
 1 file changed, 32 insertions(+), 24 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 8f8b6df..0d74a69 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -67,18 +67,9 @@ static void show_image_types(void)
fprintf(stderr, "\n");
 }
 
-int main(int argc, char **argv)
+static void process_args(int argc, char **argv)
 {
-   int ifd = -1;
-   struct stat sbuf;
char *ptr;
-   int retval = 0;
-   struct image_type_params *tparams = NULL;
-   int pad_len = 0;
-   int dfd;
-
-   params.cmdname = *argv;
-   params.addr = params.ep = 0;
 
while (--argc > 0 && **++argv == '-') {
while (*++*argv) {
@@ -90,7 +81,7 @@ int main(int argc, char **argv)
if ((--argc <= 0) ||
(params.arch =
genimg_get_arch_id (*++argv)) < 0)
-   usage ();
+   usage();
goto NXTARG;
case 'c':
if (--argc <= 0)
@@ -101,11 +92,11 @@ int main(int argc, char **argv)
if ((--argc <= 0) ||
(params.comp =
genimg_get_comp_id (*++argv)) < 0)
-   usage ();
+   usage();
goto NXTARG;
case 'D':
if (--argc <= 0)
-   usage ();
+   usage();
params.dtc = *++argv;
goto NXTARG;
 
@@ -113,7 +104,7 @@ int main(int argc, char **argv)
if ((--argc <= 0) ||
(params.os =
genimg_get_os_id (*++argv)) < 0)
-   usage ();
+   usage();
goto NXTARG;
case 'T':
params.type = -1;
@@ -128,7 +119,7 @@ int main(int argc, char **argv)
goto NXTARG;
case 'a':
if (--argc <= 0)
-   usage ();
+   usage();
params.addr = strtoul (*++argv, , 16);
if (*ptr) {
fprintf (stderr,
@@ -139,13 +130,13 @@ int main(int argc, char **argv)
goto NXTARG;
case 'd':
if (--argc <= 0)
-   usage ();
+   usage();
params.datafile = *++argv;
params.dflag = 1;
goto NXTARG;
case 'e':
if (--argc <= 0)
-   usage ();
+   usage();
params.ep = strtoul (*++argv, , 16);
if (*ptr) {
fprintf (stderr,
@@ -157,7 +148,7 @@ int main(int argc, char **argv)
goto NXTARG;
case 'f':
if (--argc <= 0)
-   usage ();
+   usage();
params.datafile = *++argv;
/* no break */
case 'F':
@@ -180,7 +171,7 @@ int main(int argc, char **argv)
goto NXTARG;
case 'n':
if (--argc <= 0)
-   usage ();
+   usage();
params.imagename = *++argv;
goto NXTARG;
case 'r':
@@ -208,14 +199,33 @@ int main(int argc, char **argv)
params.xflag++;
break;
default:
-   usage ();
+   usage();
}
}
 NXTARG:;
}
 
if (argc != 1)
-   usage ();
+   usage();
+   

[U-Boot] [PATCH 02/26] mkimage: Convert to use getopt()

2016-01-28 Thread Simon Glass
The current way of parsing arguments is a bit clumsy. It seems better to
use getopt() which is commonly used for this purpose.

Convert the code to use getopt() and make a few minor adjustments as needed.

Signed-off-by: Simon Glass 
---

 tools/mkimage.c | 233 
 1 file changed, 101 insertions(+), 132 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 0d74a69..97ab05a 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -70,144 +70,113 @@ static void show_image_types(void)
 static void process_args(int argc, char **argv)
 {
char *ptr;
-
-   while (--argc > 0 && **++argv == '-') {
-   while (*++*argv) {
-   switch (**argv) {
-   case 'l':
-   params.lflag = 1;
-   break;
-   case 'A':
-   if ((--argc <= 0) ||
-   (params.arch =
-   genimg_get_arch_id (*++argv)) < 0)
-   usage();
-   goto NXTARG;
-   case 'c':
-   if (--argc <= 0)
-   usage();
-   params.comment = *++argv;
-   goto NXTARG;
-   case 'C':
-   if ((--argc <= 0) ||
-   (params.comp =
-   genimg_get_comp_id (*++argv)) < 0)
-   usage();
-   goto NXTARG;
-   case 'D':
-   if (--argc <= 0)
-   usage();
-   params.dtc = *++argv;
-   goto NXTARG;
-
-   case 'O':
-   if ((--argc <= 0) ||
-   (params.os =
-   genimg_get_os_id (*++argv)) < 0)
-   usage();
-   goto NXTARG;
-   case 'T':
-   params.type = -1;
-   if (--argc >= 0 && argv[1]) {
-   params.type =
-   genimg_get_type_id(*++argv);
-   }
-   if (params.type < 0) {
-   show_image_types();
-   usage();
-   }
-   goto NXTARG;
-   case 'a':
-   if (--argc <= 0)
-   usage();
-   params.addr = strtoul (*++argv, , 16);
-   if (*ptr) {
-   fprintf (stderr,
-   "%s: invalid load address %s\n",
-   params.cmdname, *argv);
-   exit (EXIT_FAILURE);
-   }
-   goto NXTARG;
-   case 'd':
-   if (--argc <= 0)
-   usage();
-   params.datafile = *++argv;
-   params.dflag = 1;
-   goto NXTARG;
-   case 'e':
-   if (--argc <= 0)
-   usage();
-   params.ep = strtoul (*++argv, , 16);
-   if (*ptr) {
-   fprintf (stderr,
-   "%s: invalid entry point %s\n",
-   params.cmdname, *argv);
-   exit (EXIT_FAILURE);
-   }
-   params.eflag = 1;
-   goto NXTARG;
-   case 'f':
-   if (--argc <= 0)
-   usage();
-   params.datafile = *++argv;
-   /* no break */
-   case 'F':
-   /*
-* The flattened image tree (FIT) format
-* requires a flattened device tree image type
-*/
-   params.type = IH_TYPE_FLATDT;
-   params.fflag = 1;
-  

[U-Boot] [PATCH 17/26] image: Add functions to obtain short names

2016-01-28 Thread Simon Glass
Sometimes it is useful to obtain the short name for an Operating System,
architecture or compression mechanism. Provide functions for this.

Signed-off-by: Simon Glass 
---

 common/image.c  | 26 ++
 include/image.h | 27 +++
 2 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/common/image.c b/common/image.c
index fad31b2..e72a979 100644
--- a/common/image.c
+++ b/common/image.c
@@ -603,11 +603,9 @@ const char *genimg_get_type_name(uint8_t type)
return (get_table_entry_name(uimage_type, "Unknown Image", type));
 }
 
-const char *genimg_get_type_short_name(uint8_t type)
+static const char *genimg_get_short_name(const table_entry_t *table, int val)
 {
-   const table_entry_t *table;
-
-   table = get_table_entry(uimage_type, type);
+   table = get_table_entry(table, val);
if (!table)
return "unknown";
 #if defined(USE_HOSTCC) || !defined(CONFIG_NEEDS_MANUAL_RELOC)
@@ -617,12 +615,32 @@ const char *genimg_get_type_short_name(uint8_t type)
 #endif
 }
 
+const char *genimg_get_type_short_name(uint8_t type)
+{
+   return genimg_get_short_name(uimage_type, type);
+}
+
 const char *genimg_get_comp_name(uint8_t comp)
 {
return (get_table_entry_name(uimage_comp, "Unknown Compression",
comp));
 }
 
+const char *genimg_get_comp_short_name(uint8_t comp)
+{
+   return genimg_get_short_name(uimage_comp, comp);
+}
+
+const char *genimg_get_os_short_name(uint8_t os)
+{
+   return genimg_get_short_name(uimage_os, os);
+}
+
+const char *genimg_get_arch_short_name(uint8_t arch)
+{
+   return genimg_get_short_name(uimage_arch, arch);
+}
+
 /**
  * get_table_entry_id - translate short entry name to id
  * @table: pointer to a translation table for entries of a specific type
diff --git a/include/image.h b/include/image.h
index 9eb3616..fa201d7 100644
--- a/include/image.h
+++ b/include/image.h
@@ -414,7 +414,25 @@ int get_table_entry_id(const table_entry_t *table,
 char *get_table_entry_name(const table_entry_t *table, char *msg, int id);
 
 const char *genimg_get_os_name(uint8_t os);
+
+/**
+ * genimg_get_os_short_name() - get the short name for an OS
+ *
+ * @param os   OS (IH_OS_...)
+ * @return OS short name, or "unknown" if unknown
+ */
+const char *genimg_get_os_short_name(uint8_t comp);
+
 const char *genimg_get_arch_name(uint8_t arch);
+
+/**
+ * genimg_get_arch_short_name() - get the short name for an architecture
+ *
+ * @param arch Architecture type (IH_ARCH_...)
+ * @return architecture short name, or "unknown" if unknown
+ */
+const char *genimg_get_arch_short_name(uint8_t arch);
+
 const char *genimg_get_type_name(uint8_t type);
 
 /**
@@ -426,6 +444,15 @@ const char *genimg_get_type_name(uint8_t type);
 const char *genimg_get_type_short_name(uint8_t type);
 
 const char *genimg_get_comp_name(uint8_t comp);
+
+/**
+ * genimg_get_comp_short_name() - get the short name for a compression method
+ *
+ * @param comp compression method (IH_COMP_...)
+ * @return compression method short name, or "unknown" if unknown
+ */
+const char *genimg_get_comp_short_name(uint8_t comp);
+
 int genimg_get_os_id(const char *name);
 int genimg_get_arch_id(const char *name);
 int genimg_get_type_id(const char *name);
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 26/26] RFC: sunxi: Enable SPL FIT support

2016-01-28 Thread Simon Glass
Enable SPL FIT support for the Linksprite pcDuino3 as an example of how this
feature is used.

This is only for demonstration purposes and is not to be applied.
Signed-off-by: Simon Glass 
---

 arch/arm/cpu/armv7/sunxi/board.c  | 5 +
 configs/Linksprite_pcDuino3_defconfig | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index eb5f4b6..407adb5 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -103,6 +103,11 @@ static int gpio_init(void)
return 0;
 }
 
+int board_fit_config_name_match(const char *name)
+{
+   return strcmp(name, "sun7i-a20-pcduino3");
+}
+
 int spl_board_load_image(void)
 {
debug("Returning to FEL sp=%x, lr=%x\n", fel_stash.sp, fel_stash.lr);
diff --git a/configs/Linksprite_pcDuino3_defconfig 
b/configs/Linksprite_pcDuino3_defconfig
index 0b7ee98..74d11a0 100644
--- a/configs/Linksprite_pcDuino3_defconfig
+++ b/configs/Linksprite_pcDuino3_defconfig
@@ -14,3 +14,6 @@ CONFIG_OF_BOARD_SETUP=y
 CONFIG_CMD_GPIO=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_USB_EHCI_HCD=y
+CONFIG_FIT=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_OF_LIST="sun7i-a20-pcduino3 sun7i-a20-bananapro"
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 22/26] spl: Add a way for boards to select which device tree to load

2016-01-28 Thread Simon Glass
SPL calls this function with each device tree it can find in the FIT. The
board should implement this function, using whatever hardware detection it
can muster to determine the correct device tree.

Signed-off-by: Simon Glass 
---

 include/image.h | 13 +
 1 file changed, 13 insertions(+)

diff --git a/include/image.h b/include/image.h
index fa201d7..922104d 100644
--- a/include/image.h
+++ b/include/image.h
@@ -1155,4 +1155,17 @@ ulong android_image_get_kload(const struct andr_img_hdr 
*hdr);
 
 #endif /* CONFIG_ANDROID_BOOT_IMAGE */
 
+/**
+ * board_fit_config_name_match() - Check for a matching board name
+ *
+ * This is used when SPL loads a FIT containing multiple device tree files
+ * and wants to work out which one to use. The description of each one is
+ * passed to this function. The description comes from the 'description' field
+ * in each (FDT) image node.
+ *
+ * @name: Device tree description
+ * @return 0 if this device tree should be used, non-zero to try the next
+ */
+int board_fit_config_name_match(const char *name);
+
 #endif /* __IMAGE_H__ */
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 0/2] dfu: samsung: Commits to allow sending and storing large files via DFU

2016-01-28 Thread Lukasz Majewski
Those commits allow sending and storing large files (e.g. 26 MiB) on the Odroid 
XU3 board.

On purpose they are sent together to shed light on the process of tunning board 
to
be capable of large files transfer.

I would be _REALLY_ grateful for excessive testing, since I'm not able to test 
this code
on NAND based devices. Please support me and test this patch for potential 
regressions.

This change applies on the u-boot-master tree.
SHA1: aada3d062a0cacde1e783af2ac560f2a0fdf3682

Lukasz Majewski (2):
  dfu: usb: f_dfu: Set deferred call for dfu_flush() function
  dfu: odroid xu3: Define DFU_MANIFEST_POLL_TIMEOUT to handle large
files transmission and storage

 common/cmd_dfu.c | 20 
 drivers/usb/gadget/f_dfu.c   | 11 +++
 include/configs/odroid_xu3.h |  1 +
 include/dfu.h| 25 +
 4 files changed, 49 insertions(+), 8 deletions(-)

-- 
2.0.0.rc2

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


Re: [U-Boot] [PATCH 1/2] x86: x86-common.h: Add CONFIG_BOOTDELAY

2016-01-28 Thread Stefan Roese

Hi Bin,

(added Simon to Cc)

On 26.01.2016 07:48, Bin Meng wrote:

On Tue, Jan 19, 2016 at 2:19 PM, Bin Meng  wrote:

On Mon, Jan 18, 2016 at 9:49 PM, Stefan Roese  wrote:

Without this CONFIG_BOOTDELAY, autobooting does not work at all. As
autoboot_command() from common/* will not get called. So lets define
CONFIG_BOOTDELAY, so that auto-booting works on x86.

Signed-off-by: Stefan Roese 
Cc: Miao Yan 
Cc: Bin Meng 
Cc: Simon Glass 
---
  include/configs/x86-common.h | 2 ++
  1 file changed, 2 insertions(+)



Acked-by: Bin Meng 


Sorry, this patch does not build for efi-x86.

x86:  +   efi-x86
+../common/autoboot.c: In function 'process_fdt_options':
+../common/autoboot.c:296:36: error: 'CONFIG_SYS_TEXT_BASE' undeclared
(first use in this function)
+   setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+^
+../common/autoboot.c:296:36: note: each undeclared identifier is
reported only once for each function it appears in
+make[2]: *** [common/autoboot.o] Error 1
+make[1]: *** [common] Error 2
+make: *** [sub-make] Error 2

Could you please fix this? Sorry I did not run buildman earlier.


I'm a bit hesitant on how to fix this. As I don't really know this
"efi-x86" target in detail. Is this code in process_fdt_options()
really needed for this target? To configure the env variables
"kernaddr" and "rootaddr" dynamically from the DT properties
"kernel-offset" and "rootdisk-offset". I can't find any references
to these DT properties anywhere?

Simon, you introduced this env variable handling with the patch
[fdt: Set kernaddr if fdt indicates a kernel is present] (git ID
fcabc24f) in October 2012.

Perhaps its best to assign TEXT_BASE to 0 if its not defined at
all? Or is this in general the correct value for the "efi-x86"
target and should be set specifically for it?

Thanks,
Stefan

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


[U-Boot] [PATCH 11/26] fdt: Adjust DEFAULT_DEVICE_TREE to device on OF_CONTROL

2016-01-28 Thread Simon Glass
This option has no meaning without OF_CONTROL, so add a dependency.

Signed-off-by: Simon Glass 
---

 dts/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dts/Kconfig b/dts/Kconfig
index fb2d79e..ba83d5f 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -53,6 +53,7 @@ endchoice
 
 config DEFAULT_DEVICE_TREE
string "Default Device Tree for DT control"
+   depends on OF_CONTROL
help
  This option specifies the default Device Tree used for DT control.
  It can be overridden from the command line:
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 14/26] tools: Include fdt_sw.o in libfdt for mkimage

2016-01-28 Thread Simon Glass
At present this file is omitted. It is used to build up a binary device
tree. We plan to do this in mkimage, so include this file in the build.

Signed-off-by: Simon Glass 
---

 tools/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/Makefile b/tools/Makefile
index 1382b05..e34df26 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -59,7 +59,7 @@ FIT_SIG_OBJS-$(CONFIG_FIT_SIGNATURE) := common/image-sig.o
 # Flattened device tree objects
 LIBFDT_OBJS := $(addprefix lib/libfdt/, \
fdt.o fdt_ro.o fdt_rw.o fdt_strerror.o fdt_wip.o \
-   fdt_region.o)
+   fdt_region.o fdt_sw.o)
 RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
rsa-sign.o rsa-verify.o rsa-checksum.o \
rsa-mod-exp.o)
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 08/26] Correct defconfig ordering

2016-01-28 Thread Simon Glass
Various boards have the wrong Kconfig ordering now. To avoid a misleading
diff in the next patch, reorder the configuration correctly.

Signed-off-by: Simon Glass 
---

 configs/am335x_gp_evm_defconfig  |  2 +-
 configs/am437x_sk_evm_defconfig  |  6 +++---
 configs/apalis_t30_defconfig |  1 -
 configs/bayleybay_defconfig  |  4 ++--
 configs/cgtqmx6eval_defconfig|  4 +---
 configs/chromebook_link_defconfig|  4 ++--
 configs/chromebox_panther_defconfig  |  4 ++--
 configs/coreboot-x86_defconfig   |  4 ++--
 configs/crownbay_defconfig   |  4 ++--
 configs/dra72_evm_defconfig  |  4 ++--
 configs/dra74_evm_defconfig  |  6 +++---
 configs/efi-x86_defconfig|  1 -
 configs/evb-rk3036_defconfig | 25 +++--
 configs/firefly-rk3288_defconfig |  2 +-
 configs/galileo_defconfig|  4 ++--
 configs/h8_homlet_v2_defconfig   |  6 --
 configs/igep0020_defconfig   |  2 +-
 configs/igep0020_nand_defconfig  |  2 +-
 configs/igep0032_defconfig   |  2 +-
 configs/kylin-rk3036_defconfig   | 16 +++-
 configs/ls1043aqds_defconfig |  4 ++--
 configs/ls1043aqds_nand_defconfig|  4 ++--
 configs/ls1043aqds_sdcard_ifc_defconfig  |  4 ++--
 configs/ls1043ardb_SECURE_BOOT_defconfig |  6 +++---
 configs/ls1043ardb_defconfig |  6 +++---
 configs/ls1043ardb_nand_defconfig|  6 +++---
 configs/ls1043ardb_sdcard_defconfig  |  6 +++---
 configs/minnowmax_defconfig  |  4 ++--
 configs/nsa310s_defconfig|  8 
 configs/orangepi_pc_defconfig|  2 +-
 configs/p2371-2180_defconfig |  2 +-
 configs/qemu-x86_defconfig   |  4 ++--
 configs/rock2_defconfig  |  2 +-
 configs/sandbox_defconfig|  8 
 configs/socfpga_arria5_defconfig |  7 +++
 configs/socfpga_cyclone5_defconfig   |  7 +++
 configs/socfpga_de0_nano_soc_defconfig   |  3 +--
 configs/socfpga_mcvevk_defconfig |  3 +--
 configs/socfpga_sockit_defconfig |  5 ++---
 configs/socfpga_socrates_defconfig   |  5 ++---
 configs/socfpga_sr1500_defconfig |  9 -
 configs/uniphier_ld4_sld8_defconfig  |  1 -
 configs/uniphier_pro4_defconfig  |  1 -
 configs/uniphier_pro5_defconfig  |  1 -
 configs/uniphier_pxs2_ld6b_defconfig |  1 -
 configs/zynq_zybo_defconfig  |  4 ++--
 46 files changed, 95 insertions(+), 121 deletions(-)

diff --git a/configs/am335x_gp_evm_defconfig b/configs/am335x_gp_evm_defconfig
index 49461e2..2ebc3cb 100644
--- a/configs/am335x_gp_evm_defconfig
+++ b/configs/am335x_gp_evm_defconfig
@@ -15,6 +15,6 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_DM_ETH=y
 CONFIG_SYS_NS16550=y
-CONFIG_RSA=y
 CONFIG_TIMER=y
 CONFIG_OMAP_TIMER=y
+CONFIG_RSA=y
diff --git a/configs/am437x_sk_evm_defconfig b/configs/am437x_sk_evm_defconfig
index 9eb41f9..5af748d 100644
--- a/configs/am437x_sk_evm_defconfig
+++ b/configs/am437x_sk_evm_defconfig
@@ -1,6 +1,8 @@
 CONFIG_ARM=y
 CONFIG_TARGET_AM43XX_EVM=y
 CONFIG_DM_SERIAL=y
+CONFIG_DM_SPI=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_DM_GPIO=y
 CONFIG_SPL_STACK_R_ADDR=0x8200
 CONFIG_DEFAULT_DEVICE_TREE="am437x-sk-evm"
@@ -15,11 +17,9 @@ CONFIG_OF_CONTROL=y
 CONFIG_DM=y
 CONFIG_DM_MMC=y
 CONFIG_SPI_FLASH=y
+CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SYS_NS16550=y
 CONFIG_TI_QSPI=y
-CONFIG_DM_SPI=y
-CONFIG_DM_SPI_FLASH=y
-CONFIG_SPI_FLASH_BAR=y
 CONFIG_TIMER=y
 CONFIG_OMAP_TIMER=y
diff --git a/configs/apalis_t30_defconfig b/configs/apalis_t30_defconfig
index f939bdb..4c363c7 100644
--- a/configs/apalis_t30_defconfig
+++ b/configs/apalis_t30_defconfig
@@ -11,7 +11,6 @@ CONFIG_SYS_PROMPT="Apalis T30 # "
 # CONFIG_CMD_FPGA is not set
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_NFS is not set
-CONFIG_NETDEVICES=y
 CONFIG_E1000=y
 CONFIG_PCI_TEGRA=y
 CONFIG_SYS_NS16550=y
diff --git a/configs/bayleybay_defconfig b/configs/bayleybay_defconfig
index 0879d1e..4f0c41f 100644
--- a/configs/bayleybay_defconfig
+++ b/configs/bayleybay_defconfig
@@ -9,14 +9,14 @@ CONFIG_HAVE_VGA_BIOS=y
 CONFIG_VGA_BIOS_ADDR=0xfffa
 CONFIG_GENERATE_PIRQ_TABLE=y
 CONFIG_GENERATE_MP_TABLE=y
+CONFIG_BOOTSTAGE=y
+CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_CMD_CPU=y
 # CONFIG_CMD_IMLS is not set
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
 # CONFIG_CMD_NFS is not set
-CONFIG_BOOTSTAGE=y
-CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_CMD_BOOTSTAGE=y
 CONFIG_OF_CONTROL=y
 CONFIG_CPU=y
diff --git a/configs/cgtqmx6eval_defconfig b/configs/cgtqmx6eval_defconfig
index 02008ea..a0c146c 100644
--- a/configs/cgtqmx6eval_defconfig
+++ b/configs/cgtqmx6eval_defconfig
@@ -3,10 +3,8 @@ CONFIG_ARCH_MX6=y
 CONFIG_TARGET_CGTQMX6EVAL=y
 CONFIG_SPL=y
 

Re: [U-Boot] Include patchwork patch ID in commit message?

2016-01-28 Thread Tom Rini
On Thu, Jan 28, 2016 at 07:39:54AM +0100, Heiko Schocher wrote:

[snip]
> Out of topic  maybe tbot can help you here a lot. I have an automated
> build for example for the smartweb board [1], which does:
> 
> +  - clone u-boot.git
> +  - set toolchain
> +  - get a list of patchwork patches from my U-Boots ToDo list
> +  - download all of them, and check them with checkpatch
> +and apply them to u-boot.git
> +  - compile U-Boot for the smartweb board
> +  - install the resulting images on the smartweb board
> +  - boot U-boot
> +  - test DFU
> +  - more TC should be added here for testing U-Boot

I do need to play with tbot and kind of want to use that locally.  For
my build tests however, it's a shared server elsewhere that doesn't have
access to the targets.

-- 
Tom


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


[U-Boot] [PATCH 25/26] spl: Support loading a FIT from MMC

2016-01-28 Thread Simon Glass
Detect a FIT when loading from MMC and handle it using the new FIT SPL
support.

Signed-off-by: Simon Glass 
---

 common/spl/spl_mmc.c | 75 +++-
 1 file changed, 57 insertions(+), 18 deletions(-)

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index c3931c6..a71a98b 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -18,41 +18,80 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static int mmc_load_legacy(struct mmc *mmc, ulong sector,
+  struct image_header *header)
+{
+   u32 image_size_sectors;
+   unsigned long count;
+
+   spl_parse_image_header(header);
+   /* convert size to sectors - round up */
+   image_size_sectors = (spl_image.size + mmc->read_bl_len - 1) /
+mmc->read_bl_len;
+
+   /* Read the header too to avoid extra memcpy */
+   count = mmc->block_dev.block_read(>block_dev, sector,
+ image_size_sectors,
+ (void *)(ulong)spl_image.load_addr);
+   debug("read %x sectors to %x\n", image_size_sectors,
+ spl_image.load_addr);
+   if (count != image_size_sectors)
+   return -EIO;
+
+   return 0;
+}
+
+#ifdef CONFIG_SPL_LOAD_FIT
+static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
+ulong count, void *buf)
+{
+   struct mmc *mmc = load->dev;
+
+   return mmc->block_dev.block_read(>block_dev, sector, count, buf);
+}
+#endif
+
 static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
 {
unsigned long count;
-   u32 image_size_sectors;
struct image_header *header;
+   int ret = 0;
 
header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
 sizeof(struct image_header));
 
/* read image header to find the image size & load address */
count = mmc->block_dev.block_read(>block_dev, sector, 1, header);
-   debug("read sector %lx, count=%lu\n", sector, count);
-   if (count == 0)
+   debug("hdr read sector %lx, count=%lu\n", sector, count);
+   if (count == 0) {
+   ret = -EIO;
goto end;
+   }
 
-   if (image_get_magic(header) != IH_MAGIC) {
+   switch (image_get_magic(header)) {
+   case IH_MAGIC:
+   ret = mmc_load_legacy(mmc, sector, header);
+   break;
+#ifdef CONFIG_SPL_LOAD_FIT
+   case FDT_MAGIC: {
+   struct spl_load_info load;
+
+   debug("Found FIT\n");
+   load.dev = mmc;
+   load.priv = NULL;
+   load.bl_len = mmc->read_bl_len;
+   load.read = h_spl_load_read;
+   ret = spl_load_simple_fit(, sector, header);
+   break;
+   }
+#endif
+   default:
puts("bad magic\n");
return -1;
}
 
-   spl_parse_image_header(header);
-
-   /* convert size to sectors - round up */
-   image_size_sectors = (spl_image.size + mmc->read_bl_len - 1) /
-mmc->read_bl_len;
-
-   /* Read the header too to avoid extra memcpy */
-   count = mmc->block_dev.block_read(>block_dev, sector,
- image_size_sectors,
- (void *)(ulong)spl_image.load_addr);
-   debug("read %x sectors to %x\n", image_size_sectors,
- spl_image.load_addr);
-
 end:
-   if (count == 0) {
+   if (ret) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
puts("spl: mmc block read error\n");
 #endif
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 19/26] mkimage: Support adding device tree files to a FIT

2016-01-28 Thread Simon Glass
To make the auto-FIT feature useful we need to be able to provide a list of
device tree files on the command line for mkimage to add into the FIT. Add
support for this feature.

So far there is no support for hashing or verified boot using this method.
For those cases, a .its file must still be provided.

Signed-off-by: Simon Glass 
---

 doc/mkimage.1 | 17 ++
 tools/fit_image.c | 96 ++-
 tools/imagetool.h |  9 ++
 tools/mkimage.c   | 38 +-
 4 files changed, 151 insertions(+), 9 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 146c114..b1b45d7 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -97,6 +97,10 @@ Set XIP (execute in place) flag.
 .B Create FIT image:
 
 .TP
+.BI "\-b
+Specifies that the following arguments are device tree binary files (.dtb).
+
+.TP
 .BI "\-c [" "comment" "]"
 Specifies a comment to be added when signing. This is typically a useful
 message which describes how the image was signed or some other useful
@@ -125,6 +129,10 @@ This can be used to sign images with additional keys after 
initial image
 creation.
 
 .TP
+.BI "\-i
+Specifies that the following arguments are image files.
+
+.TP
 .BI "\-k [" "key_directory" "]"
 Specifies the directory containing keys to use for signing. This directory
 should contain a private key file .key for use with signing and a
@@ -191,6 +199,15 @@ is required.
 .br
 .B -c """Kernel 4.4 image for production devices""" -d vmlinuz kernel.itb
 .fi
+.P
+Create a FIT image containing a kernel and some device tree files, using
+automatic mode. No .its file is required.
+.nf
+.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e0 -e 0 
+.br
+.B -c """Kernel 4.4 image for production devices""" -d vmlinuz 
+.B -b rk3288-firefly.dts rk3288-jerry.dts -i kernel.itb
+.fi
 
 .SH HOMEPAGE
 http://www.denx.de/wiki/U-Boot/WebHome
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 343de60..0d8007b 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -77,6 +77,7 @@ err_keydest:
  */
 static int fit_calc_size(struct image_tool_params *params)
 {
+   struct content_info *cont;
int size, total_size;
 
size = imagetool_get_filesize(params, params->datafile);
@@ -84,8 +85,14 @@ static int fit_calc_size(struct image_tool_params *params)
return -1;
 
total_size = size;
+   for (cont = params->content_head; cont; cont = cont->next) {
+   size = imagetool_get_filesize(params, cont->fname);
+   if (size < 0)
+   return -1;
 
-   /* TODO(s...@chromium.org): Add in the size of any other files */
+   /* Add space for properties */
+   total_size += size + 300;
+   }
 
/* Add plenty of space for headers, properties, nodes, etc. */
total_size += 4096;
@@ -141,15 +148,40 @@ static int fdt_property_strf(void *fdt, const char *name, 
const char *fmt, ...)
return fdt_property_string(fdt, name, str);
 }
 
+static void get_basename(char *str, int size, const char *fname)
+{
+   const char *p, *start, *end;
+   int len;
+
+   /*
+* Use the base name as the 'name' field. So for example:
+*
+* "arch/arm/dts/sun7i-a20-bananapro.dtb"
+* becomes "sun7i-a20-bananapro"
+*/
+   p = strrchr(fname, '/');
+   start = p ? p + 1 : fname;
+   p = strrchr(fname, '.');
+   end = p ? p : fname + strlen(fname);
+   len = end - start;
+   if (len >= size)
+   len = size - 1;
+   memcpy(str, start, len);
+   str[len] = '\0';
+}
+
 /**
  * fit_write_images() - Write out a list of images to the FIT
  *
- * Include the main image (params->datafile).
+ * We always include the main image (params->datafile). If there are device
+ * tree files, we include an fdt@ node for each of those too.
  */
 static int fit_write_images(struct image_tool_params *params, char *fdt)
 {
+   struct content_info *cont;
const char *typename;
char str[100];
+   int upto;
int ret;
 
fdt_begin_node(fdt, "images");
@@ -176,6 +208,27 @@ static int fit_write_images(struct image_tool_params 
*params, char *fdt)
return ret;
fdt_end_node(fdt);
 
+   /* Now the device tree files if available */
+   upto = 0;
+   for (cont = params->content_head; cont; cont = cont->next) {
+   if (cont->type != IH_TYPE_FLATDT)
+   continue;
+   snprintf(str, sizeof(str), "%s@%d", FIT_FDT_PROP, ++upto);
+   fdt_begin_node(fdt, str);
+
+   get_basename(str, sizeof(str), cont->fname);
+   fdt_property_string(fdt, "description", str);
+   ret = fdt_property_file(params, fdt, "data", cont->fname);
+   if (ret)
+   return ret;
+   fdt_property_string(fdt, "type", 

[U-Boot] [PATCH 16/26] tools: Add a function to obtain the size of a file

2016-01-28 Thread Simon Glass
This will be used in mkimage when working out the required size of the FIT
based on the files to be placed into it.

Signed-off-by: Simon Glass 
---

 doc/mkimage.1 |  4 ++--
 tools/imagetool.c | 22 ++
 tools/imagetool.h | 12 
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index b48f70b..1b9d18c 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -164,7 +164,7 @@ skipping those for which keys cannot be found. Also add a 
comment.
 .nf
 .B mkimage -f kernel.its -k /public/signing-keys -K u-boot.dtb 
 .br
-.B -c "Kernel 3.8 image for production devices" kernel.itb
+.B -c """Kernel 3.8 image for production devices""" kernel.itb
 .fi
 
 .P
@@ -175,7 +175,7 @@ with unavailable keys are skipped.
 .nf
 .B mkimage -F -k /secret/signing-keys -K u-boot.dtb 
 .br
-.B -c "Kernel 3.8 image for production devices" kernel.itb
+.B -c """Kernel 3.8 image for production devices""" kernel.itb
 .fi
 
 .SH HOMEPAGE
diff --git a/tools/imagetool.c b/tools/imagetool.c
index 4b0b73d..351211c 100644
--- a/tools/imagetool.c
+++ b/tools/imagetool.c
@@ -91,3 +91,25 @@ int imagetool_save_subimage(
 
return 0;
 }
+
+int imagetool_get_filesize(struct image_tool_params *params, const char *fname)
+{
+   struct stat sbuf;
+   int fd;
+
+   fd = open(fname, O_RDONLY | O_BINARY);
+   if (fd < 0) {
+   fprintf(stderr, "%s: Can't open %s: %s\n",
+   params->cmdname, fname, strerror(errno));
+   return -1;
+   }
+
+   if (fstat(fd, ) < 0) {
+   fprintf(stderr, "%s: Can't stat %s: %s\n",
+   params->cmdname, fname, strerror(errno));
+   return -1;
+   }
+   close(fd);
+
+   return sbuf.st_size;
+}
diff --git a/tools/imagetool.h b/tools/imagetool.h
index e0397f7..3cf42ac 100644
--- a/tools/imagetool.h
+++ b/tools/imagetool.h
@@ -181,6 +181,18 @@ int imagetool_save_subimage(
ulong file_data,
ulong file_len);
 
+/**
+ * imagetool_get_filesize() - Utility function to obtain the size of a file
+ *
+ * This function prints a message if an error occurs, showing the error that
+ * was obtained.
+ *
+ * @params:mkimage parameters
+ * @fname: filename to check
+ * @return size of file, or -ve value on error
+ */
+int imagetool_get_filesize(struct image_tool_params *params, const char 
*fname);
+
 /*
  * There is a c file associated with supported image type low level code
  * for ex. default_image.c, fit_image.c
-- 
2.7.0.rc3.207.g0ac5344

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


Re: [U-Boot] [PATCH v2] armv7: add cacheline sizes where missing

2016-01-28 Thread Albert ARIBAUD
On Wed, 27 Jan 2016 08:46:11 +0100, Albert ARIBAUD
 wrote:
> Some armv7 targets are missing a cache line size declaration.
> In preparation for "arm: cache: Implement cache range check for v7"
> patch, add these declarations with the appropriate value for
> the target's SoC or CPU.
> 
> Signed-off-by: Albert ARIBAUD 
> ---
> 
> Changes in v2:
> - fix include/configs/at91-sama5_common.h (Cortex-A5: 32 bytes)

Applied to u-boot-arm/master, adding Tom's Reviewed-by from V1 since
there was no change to TI boards in V2.

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


Re: [U-Boot] [PATCH 0/2] dfu: samsung: Commits to allow sending and storing large files via DFU

2016-01-28 Thread Heiko Schocher

Hello Lukasz,

Am 28.01.2016 um 17:46 schrieb Lukasz Majewski:

Those commits allow sending and storing large files (e.g. 26 MiB) on the Odroid 
XU3 board.

On purpose they are sent together to shed light on the process of tunning board 
to
be capable of large files transfer.

I would be _REALLY_ grateful for excessive testing, since I'm not able to test 
this code
on NAND based devices. Please support me and test this patch for potential 
regressions.

This change applies on the u-boot-master tree.
SHA1: aada3d062a0cacde1e783af2ac560f2a0fdf3682

Lukasz Majewski (2):
   dfu: usb: f_dfu: Set deferred call for dfu_flush() function
   dfu: odroid xu3: Define DFU_MANIFEST_POLL_TIMEOUT to handle large
 files transmission and storage

  common/cmd_dfu.c | 20 
  drivers/usb/gadget/f_dfu.c   | 11 +++
  include/configs/odroid_xu3.h |  1 +
  include/dfu.h| 25 +
  4 files changed, 49 insertions(+), 8 deletions(-)


Tested on the smartweb board (NAND):
http://xeidos.ddns.net/buildbot/builders/smartweb_dfu/builds/49/steps/shell/logs/tbotlog

with current U-Boot mainline.

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH] dfu: allow get_medium_size() to return bigger medium sizes than 2GiB

2016-01-28 Thread Heiko Schocher

Hello Joe,

Am 28.01.2016 um 16:03 schrieb Joe Hershberger:

On Thu, Jan 28, 2016 at 8:24 AM, Heiko Schocher  wrote:

change the get_medium_size() function from
-   long (*get_medium_size)(struct dfu_entity *dfu);
+   int (*get_medium_size)(struct dfu_entity *dfu, u64 *size);

so it can return bigger medium sizes than 2GiB, and the return
value is seperate from the size.

Signed-off-by: Heiko Schocher 

---
I just have a DDP nand with a size of 4GiB, and the
mtd partition layout is:
device nand2 , # parts = 9
  #: namesizeoffset  mask_flags
  0: spl 0x0008  0x  0
  1: spl.backup1 0x0008  0x0008  0
  2: spl.backup2 0x0008  0x0010  0
  3: spl.backup3 0x0008  0x0018  0
  4: u-boot  0x0078  0x0020  0
  5: u-boot.env0 0x0020  0x0098  0
  6: u-boot.env1 0x0020  0x00b8  0
  7: mtdoops 0x0020  0x00d8  0
  8: rootfs  0xff08  0x00f8  0

so the last partition is to big for returning the size in a long.


to -> too



  drivers/dfu/dfu.c  | 8 
  drivers/dfu/dfu_mmc.c  | 8 +---
  drivers/dfu/dfu_nand.c | 5 +++--
  drivers/dfu/dfu_ram.c  | 5 +++--
  drivers/dfu/dfu_sf.c   | 5 +++--
  include/dfu.h  | 4 ++--
  6 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 8f5915e..daa2eb9 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -335,11 +335,11 @@ int dfu_read(struct dfu_entity *dfu, void *buf, int size, 
int blk_seq_num)
 if (dfu->i_buf_start == NULL)
 return -ENOMEM;

-   dfu->r_left = dfu->get_medium_size(dfu);
-   if (dfu->r_left < 0)
-   return dfu->r_left;
+   ret = dfu->get_medium_size(dfu, >r_left);
+   if (ret < 0)
+   return ret;

-   debug("%s: %s %ld [B]\n", __func__, dfu->name, dfu->r_left);
+   debug("%s: %s %lld [B]\n", __func__, dfu->name, dfu->r_left);

 dfu->i_blk_seq_num = 0;
 dfu->crc = 0;
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 395d472..5c1c1d1 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -205,14 +205,15 @@ int dfu_flush_medium_mmc(struct dfu_entity *dfu)
 return ret;
  }

-long dfu_get_medium_size_mmc(struct dfu_entity *dfu)
+int dfu_get_medium_size_mmc(struct dfu_entity *dfu, u64 *size)


i64 size? Same for all other places.


Lukasz mentioned "long long" ...


  {
 int ret;
 long len;

 switch (dfu->layout) {
 case DFU_RAW_ADDR:
-   return dfu->data.mmc.lba_size * dfu->data.mmc.lba_blk_size;
+   *size = dfu->data.mmc.lba_size * dfu->data.mmc.lba_blk_size;


You need to check that size is not NULL before dereferencing it. Same
for all other places.


Correct, add it.


+   return 0;
 case DFU_FS_FAT:
 case DFU_FS_EXT4:
 dfu_file_buf_filled = -1;
@@ -221,7 +222,8 @@ long dfu_get_medium_size_mmc(struct dfu_entity *dfu)
 return ret;
 if (len > CONFIG_SYS_DFU_MAX_FILE_SIZE)
 return -1;
-   return len;
+   *size = len;
+   return 0;
 default:
 printf("%s: Layout (%s) not (yet) supported!\n", __func__,
dfu_get_layout(dfu->layout));
diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index a975492..4612e09 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -114,9 +114,10 @@ static int dfu_write_medium_nand(struct dfu_entity *dfu,
 return ret;
  }

-long dfu_get_medium_size_nand(struct dfu_entity *dfu)
+int dfu_get_medium_size_nand(struct dfu_entity *dfu, u64 *size)
  {
-   return dfu->data.nand.size;
+   *size = dfu->data.nand.size;
+   return 0;
  }

  static int dfu_read_medium_nand(struct dfu_entity *dfu, u64 offset, void *buf,
diff --git a/drivers/dfu/dfu_ram.c b/drivers/dfu/dfu_ram.c
index e094a94..466759d 100644
--- a/drivers/dfu/dfu_ram.c
+++ b/drivers/dfu/dfu_ram.c
@@ -41,9 +41,10 @@ static int dfu_write_medium_ram(struct dfu_entity *dfu, u64 
offset,
 return dfu_transfer_medium_ram(DFU_OP_WRITE, dfu, offset, buf, len);
  }

-long dfu_get_medium_size_ram(struct dfu_entity *dfu)
+int dfu_get_medium_size_ram(struct dfu_entity *dfu, u64 *size)
  {
-   return dfu->data.ram.size;
+   *size = dfu->data.ram.size;
+   return 0;
  }

  static int dfu_read_medium_ram(struct dfu_entity *dfu, u64 offset,
diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index 9702eee..35c5fa1 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -12,9 +12,10 @@
  #include 
  

Re: [U-Boot] Include patchwork patch ID in commit message?

2016-01-28 Thread Joe Hershberger
On Thu, Jan 28, 2016 at 12:13 AM, Heiko Schocher  wrote:
> Hello Joe,
>
> Am 27.01.2016 um 22:08 schrieb Joe Hershberger:
>>
>> Hi Tom,
>>
>> I'm playing with the idea of including the patchwork patch ID in the
>> commit message of each commit that I apply to provide better
>> cross-reference ability.
>>
>> * Access to comments on patches
>> * Clarity on exactly which version of a patch was applied
>> * No need to search by patch subject
>>
>> Here is an example in a working branch:
>>
>>
>> http://git.denx.de/?p=u-boot/u-boot-net.git;a=commit;h=48f9a0c786d0a3cbfdf45846567deaebe27a334a
>>
>> What do you (or anyone else) think?
>
>
> Good idea, I would prefer:
>
> X-Patchwork-Id: 561384
>
> Thats what is in the mbox file, you download from patchwork ...

Good point. I think that makes sense if we end up not including the link.

> bye,
> Heiko
> --
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2] net: Add bootfile in DHCP Request

2016-01-28 Thread amessier . tyco
From: Alexandre Messier 

Add the bootfile name in the DHCP Request packet, in addition
to it already being sent in the DHCP Discover.

This is needed by some DHCP servers so that the bootfile name is
properly returned by the server to the client in the DHCP Ack, as
expected by U-Boot.

Signed-off-by: Alexandre Messier 
---

Changes since v1:
 - Addressed Joe Hershberger's comment: Removed the config option, always
   send the bootfile name.
 - Removed from patch series. v1 was in a series, but now the patch
   stands alone.

v1 can be found here:
Patchwork: https://patchwork.ozlabs.org/patch/571775/
Mailing list: http://lists.denx.de/pipermail/u-boot/2016-January/242839.html

 net/bootp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/bootp.c b/net/bootp.c
index 8aeddb0..036d9ff 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -949,6 +949,7 @@ static void dhcp_send_request_packet(struct bootp_hdr 
*bp_offer)
net_write_ip(>bp_giaddr, zero_ip);
 
memcpy(bp->bp_chaddr, net_ethaddr, 6);
+   copy_filename(bp->bp_file, net_boot_file_name, sizeof(bp->bp_file));
 
/*
 * ID is the id of the OFFER packet
-- 
2.7.0

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


Re: [U-Boot] [PATCH 1/2] x86: x86-common.h: Add CONFIG_BOOTDELAY

2016-01-28 Thread Stefan Roese

Hi Simon,

On 28.01.2016 17:16, Simon Glass wrote:

Hi Stefan,

On 28 January 2016 at 09:13, Stefan Roese  wrote:


Hi Bin,

(added Simon to Cc)

On 26.01.2016 07:48, Bin Meng wrote:


On Tue, Jan 19, 2016 at 2:19 PM, Bin Meng  wrote:


On Mon, Jan 18, 2016 at 9:49 PM, Stefan Roese  wrote:


Without this CONFIG_BOOTDELAY, autobooting does not work at all. As
autoboot_command() from common/* will not get called. So lets define
CONFIG_BOOTDELAY, so that auto-booting works on x86.

Signed-off-by: Stefan Roese 
Cc: Miao Yan 
Cc: Bin Meng 
Cc: Simon Glass 
---
   include/configs/x86-common.h | 2 ++
   1 file changed, 2 insertions(+)



Acked-by: Bin Meng 



Sorry, this patch does not build for efi-x86.

 x86:  +   efi-x86
+../common/autoboot.c: In function 'process_fdt_options':
+../common/autoboot.c:296:36: error: 'CONFIG_SYS_TEXT_BASE' undeclared
(first use in this function)
+   setenv_addr("kernaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
+^
+../common/autoboot.c:296:36: note: each undeclared identifier is
reported only once for each function it appears in
+make[2]: *** [common/autoboot.o] Error 1
+make[1]: *** [common] Error 2
+make: *** [sub-make] Error 2

Could you please fix this? Sorry I did not run buildman earlier.



I'm a bit hesitant on how to fix this. As I don't really know this
"efi-x86" target in detail. Is this code in process_fdt_options()
really needed for this target? To configure the env variables
"kernaddr" and "rootaddr" dynamically from the DT properties
"kernel-offset" and "rootdisk-offset". I can't find any references
to these DT properties anywhere?

Simon, you introduced this env variable handling with the patch
[fdt: Set kernaddr if fdt indicates a kernel is present] (git ID
fcabc24f) in October 2012.

Perhaps its best to assign TEXT_BASE to 0 if its not defined at
all? Or is this in general the correct value for the "efi-x86"
target and should be set specifically for it?


It is a funny target since we actually produce a relocatable ELF. I'd
suggest putting #ifdef CONFIG_SYS_TEXT_BASE around it.


Okay. I'll "solve" it this way.

Thanks,
Stefan

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


[U-Boot] [PATCH 12/26] fdt: Allow libfdt to be used in SPL

2016-01-28 Thread Simon Glass
Add an option to enable libfdt in SPL. This can be useful when decoding
FIT files in SPL.

We need to make sure this option is not enabled in SPL by this change.
Also this option needs to be enabled in host builds. Si add a new
IMAGE_USE_LIBFDT #define which can be used in files that are built on the
host but must also build for U-Boot and SPL.

Signed-off-by: Simon Glass 
---

 common/Makefile  |  4 ++--
 common/bootm.c   |  4 ++--
 common/image.c   |  4 ++--
 include/common.h |  4 ++--
 include/image.h  |  8 ++--
 lib/Kconfig  | 10 ++
 lib/Makefile |  4 +---
 7 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/common/Makefile b/common/Makefile
index 25083a4..2639e57 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -55,7 +55,7 @@ obj-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o
 obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o
 
 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
-obj-$(CONFIG_OF_LIBFDT) += fdt_support.o
+obj-$(CONFIG_$(SPL_)OF_LIBFDT) += fdt_support.o
 
 obj-$(CONFIG_MII) += miiphyutil.o
 obj-$(CONFIG_CMD_MII) += miiphyutil.o
@@ -130,7 +130,7 @@ obj-y += malloc_simple.o
 endif
 obj-y += image.o
 obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o
-obj-$(CONFIG_OF_LIBFDT) += image-fdt.o
+obj-$(CONFIG_$(SPL_)OF_LIBFDT) += image-fdt.o
 obj-$(CONFIG_$(SPL_)FIT) += image-fit.o
 obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o
 obj-$(CONFIG_IO_TRACE) += iotrace.o
diff --git a/common/bootm.c b/common/bootm.c
index 686d28b..947d19e 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -234,7 +234,7 @@ int bootm_find_images(int flag, int argc, char * const 
argv[])
return 1;
}
 
-#if defined(CONFIG_OF_LIBFDT)
+#if IMAGE_ENABLE_OF_LIBFDT
/* find flattened device tree */
ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, ,
   _addr, _len);
@@ -644,7 +644,7 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[],
}
}
 #endif
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_LMB)
+#if IMAGE_ENABLE_OF_LIBFDT && defined(CONFIG_LMB)
if (!ret && (states & BOOTM_STATE_FDT)) {
boot_fdt_add_mem_rsv_regions(>lmb, images->ft_addr);
ret = boot_relocate_fdt(>lmb, >ft_addr,
diff --git a/common/image.c b/common/image.c
index ca43763..fad31b2 100644
--- a/common/image.c
+++ b/common/image.c
@@ -29,7 +29,7 @@
 #include 
 #include 
 
-#if IMAGE_USE_FIT || defined(CONFIG_OF_LIBFDT)
+#if IMAGE_USE_FIT || IMAGE_ENABLE_OF_LIBFDT
 #include 
 #include 
 #endif
@@ -757,7 +757,7 @@ int genimg_get_format(const void *img_addr)
if (image_check_magic(hdr))
return IMAGE_FORMAT_LEGACY;
 #endif
-#if IMAGE_USE_FIT || defined(CONFIG_OF_LIBFDT)
+#if IMAGE_USE_FIT || IMAGE_ENABLE_OF_LIBFDT
if (fdt_check_header(img_addr) == 0)
return IMAGE_FORMAT_FIT;
 #endif
diff --git a/include/common.h b/include/common.h
index 1563d64..5153680 100644
--- a/include/common.h
+++ b/include/common.h
@@ -596,7 +596,7 @@ voidupmconfig (unsigned int, unsigned int *, 
unsigned int);
 ulong  get_tbclk (void);
 void   reset_misc(void);
 void   reset_cpu (ulong addr);
-#if defined (CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP)
+#if IMAGE_ENABLE_OF_LIBFDT && defined(CONFIG_OF_BOARD_SETUP)
 void ft_cpu_setup(void *blob, bd_t *bd);
 #ifdef CONFIG_PCI
 void ft_pci_setup(void *blob, bd_t *bd);
@@ -660,7 +660,7 @@ int get_serial_clock(void);
 #if defined(CONFIG_MPC85xx)
 typedef MPC85xx_SYS_INFO sys_info_t;
 void   get_sys_info  ( sys_info_t * );
-#  if defined(CONFIG_OF_LIBFDT)
+#  if IMAGE_ENABLE_OF_LIBFDT
void ft_fixup_cpu(void *, u64);
void ft_fixup_num_cores(void *);
 #  endif
diff --git a/include/image.h b/include/image.h
index 061d6ed..9eb3616 100644
--- a/include/image.h
+++ b/include/image.h
@@ -28,6 +28,7 @@ struct lmb;
 /* new uImage format support enabled on host */
 #define CONFIG_FIT 1
 #define IMAGE_USE_FIT  1
+#define IMAGE_ENABLE_OF_LIBFDT 1
 #define CONFIG_FIT_VERBOSE 1 /* enable fit_format_{error,warning}() */
 
 #define IMAGE_ENABLE_IGNORE0
@@ -44,6 +45,7 @@ struct lmb;
 #define IMAGE_INDENT_STRING"   "
 
 #define IMAGE_USE_FIT  CONFIG_IS_ENABLED(FIT)
+#define IMAGE_ENABLE_OF_LIBFDT CONFIG_IS_ENABLED(OF_LIBFDT)
 
 #endif /* USE_HOSTCC */
 
@@ -104,12 +106,6 @@ struct lmb;
 # define IMAGE_ENABLE_RAMDISK_HIGH 0
 #endif
 
-#ifdef CONFIG_OF_LIBFDT
-# define IMAGE_ENABLE_OF_LIBFDT1
-#else
-# define IMAGE_ENABLE_OF_LIBFDT0
-#endif
-
 #ifdef CONFIG_SYS_BOOT_GET_CMDLINE
 # define IMAGE_BOOT_GET_CMDLINE1
 #else
diff --git a/lib/Kconfig b/lib/Kconfig
index 90ed497..e382f97 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -138,6 +138,16 @@ config OF_LIBFDT
  particular compatible nodes. The library operates on a flattened
  version of the device tree.
 
+config SPL_OF_LIBFDT
+   bool "Enable the 

[U-Boot] [PATCH 07/26] libfdt: Add a function to write a property placeholder

2016-01-28 Thread Simon Glass
The existing function to add a new property to a tree being built requires
that the entire contents of the new property be passed in. For some
applications it is more convenient to be able to add the property contents
later, perhaps by reading from a file. This avoids double-buffering of the
contents.

Add a new function to support this and adust the existing fdt_property() to
use it.

Signed-off-by: Simon Glass 
---

 include/libfdt.h| 16 
 lib/libfdt/fdt_sw.c | 16 ++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/include/libfdt.h b/include/libfdt.h
index e48c21a..c3f37ee 100644
--- a/include/libfdt.h
+++ b/include/libfdt.h
@@ -1181,6 +1181,22 @@ static inline int fdt_property_cell(void *fdt, const 
char *name, uint32_t val)
 {
return fdt_property_u32(fdt, name, val);
 }
+
+/**
+ * fdt_property_val - add a new property and return a pointer to its value
+ *
+ * @fdt: pointer to the device tree blob
+ * @name: name of property to add
+ * @len: length of property value in bytes
+ * @valp: returns a pointer to where where the value should be placed
+ *
+ * returns:
+ * 0, on success
+ * -FDT_ERR_BADMAGIC,
+ * -FDT_ERR_NOSPACE, standard meanings
+ */
+int fdt_property_val(void *fdt, const char *name, int len, void **valp);
+
 #define fdt_property_string(fdt, name, str) \
fdt_property(fdt, name, str, strlen(str)+1)
 int fdt_end_node(void *fdt);
diff --git a/lib/libfdt/fdt_sw.c b/lib/libfdt/fdt_sw.c
index 320a914..9c1df3d 100644
--- a/lib/libfdt/fdt_sw.c
+++ b/lib/libfdt/fdt_sw.c
@@ -175,7 +175,7 @@ static int _fdt_find_add_string(void *fdt, const char *s)
return offset;
 }
 
-int fdt_property(void *fdt, const char *name, const void *val, int len)
+int fdt_property_val(void *fdt, const char *name, int len, void **valp)
 {
struct fdt_property *prop;
int nameoff;
@@ -193,7 +193,19 @@ int fdt_property(void *fdt, const char *name, const void 
*val, int len)
prop->tag = cpu_to_fdt32(FDT_PROP);
prop->nameoff = cpu_to_fdt32(nameoff);
prop->len = cpu_to_fdt32(len);
-   memcpy(prop->data, val, len);
+   *valp = prop->data;
+   return 0;
+}
+
+int fdt_property(void *fdt, const char *name, const void *val, int len)
+{
+   void *ptr;
+   int ret;
+
+   ret = fdt_property_val(fdt, name, len, );
+   if (ret)
+   return ret;
+   memcpy(ptr, val, len);
return 0;
 }
 
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 2/2] dfu: odroid xu3: Define DFU_MANIFEST_POLL_TIMEOUT to handle large files transmission and storage

2016-01-28 Thread Lukasz Majewski
As tested on the Odroid XU3, large files to be stored on the file system
require considerable time to be physically written to the medium.

The default 300 ms is not enough to store large file (e.g. 26 MiB).
To fix this situation the DFU_MANIFEST_POLL_TIMEOUT has been defined.

It is used to cease the communication with dfu-util and allow the target
board to store the data on file system.

Signed-off-by: Lukasz Majewski 
---
 include/configs/odroid_xu3.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/odroid_xu3.h b/include/configs/odroid_xu3.h
index 648e48b..500f0f9 100644
--- a/include/configs/odroid_xu3.h
+++ b/include/configs/odroid_xu3.h
@@ -69,6 +69,7 @@
 #define CONFIG_CMD_DFU
 #define CONFIG_SYS_DFU_DATA_BUF_SIZE   SZ_32M
 #define DFU_DEFAULT_POLL_TIMEOUT   300
+#define DFU_MANIFEST_POLL_TIMEOUT   25000
 
 /* THOR */
 #define CONFIG_G_DNL_THOR_VENDOR_NUM   CONFIG_G_DNL_VENDOR_NUM
-- 
2.0.0.rc2

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


[U-Boot] [PATCH 1/2] dfu: usb: f_dfu: Set deferred call for dfu_flush() function

2016-01-28 Thread Lukasz Majewski
This patch fixes situation when one would like to write large file into
medium with the file system (fat, ext4, etc).
This change sets file size limitation to the DFU internal buffer size.

Since u-boot is not supporting interrupts and seek on file systems, it
becomes challenging to store large file appropriately.

To reproduce this error - create large file (around 26 MiB) and sent it
to the target board.

Lets examine the flow of USB transactions:

0. DFU uses EP0 with 64B MPS [Max Packet Size]

1. Send file - OUT (PC->target) - dat_26MiB.img is sent with 4096 B transactions

2. Get status - OUT (PC->target) - wait for DFU_STATE_dfuDNLOAD_IDLE (0x05) sent
   from target board - IN transaction
   (target->PC)

3. The whole file content is sent to target - OUT (PC->target) with ZLP [Zero
  Length Packet]

Now the interesting part starts:

4. OUT (PC->target) Setup transaction (request to share DFU state)

5. IN (target->PC) - reply the current DFU state
- In the UDC driver the req->completion (with dfu_flush) is called
  after successful IN transfer.
- The dfu_flush() (called from req->completion callback) saves the
  whole file at once (u-boot doesn't support seek on fs).
  Such operation takes considerable time. When the file
  is large - e.g. 26MiB - this time may be more than 5 seconds.

6. OUT (PC->target) - ZLP, is send in the same time when dfu_flush()
 writes data to eMMC memory.
 The dfu-util application has hard coded timeout on USB transaction
 completion set to 5 seconds (it uses libusb calls).

When the file to store is large (e.g. 26 MiB) the time needed to write it
may excess the dfu-util timeout and following error message will be displayed:
"unable to read DFU status" on the HOST PC console.

This change is supposed to leverage DFU's part responsible for storing files
on file systems. Other DFU operations - i.e. raw/partition write to NAND and
eMMC should work as before.

The only functional change is the error reporting. When dfu_flush() fails
the u-boot prompt will exit with error information and dfu-util application
exits afterwards as well.

Test HW:
- Odroid XU3 (Exynos5433) - test with large file
- Trats (Exynos4210) - test for regression - eMMC, raw,

Signed-off-by: Lukasz Majewski 
Reported-by: Alex Gdalevich 
---
 common/cmd_dfu.c   | 20 
 drivers/usb/gadget/f_dfu.c | 11 +++
 include/dfu.h  | 25 +
 3 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 6d95ce9..d8aae26 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -79,6 +79,26 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
if (ctrlc())
goto exit;
 
+   if (dfu_get_defer_flush()) {
+   /*
+* Call to usb_gadget_handle_interrupts() is necessary
+* to act on ZLP OUT transaction from HOST PC after
+* transmitting the whole file.
+*
+* If this ZLP OUT packet is NAK'ed, the HOST libusb
+* function fails after timeout (by default it is set to
+* 5 seconds). In such situation the dfu-util program
+* exits with error message.
+*/
+   usb_gadget_handle_interrupts(controller_index);
+   ret = dfu_flush(dfu_get_defer_flush(), NULL, 0, 0);
+   dfu_set_defer_flush(NULL);
+   if (ret) {
+   error("Deferred dfu_flush() failed!");
+   goto exit;
+   }
+   }
+
WATCHDOG_RESET();
usb_gadget_handle_interrupts(controller_index);
}
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 77a1567..7d88008 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -44,6 +44,8 @@ struct f_dfu {
unsigned intpoll_timeout;
 };
 
+struct dfu_entity *dfu_defer_flush;
+
 typedef int (*dfu_state_fn) (struct f_dfu *,
 const struct usb_ctrlrequest *,
 struct usb_gadget *,
@@ -167,14 +169,7 @@ static void dnload_request_complete(struct usb_ep *ep, 
struct usb_request *req)
 static void dnload_request_flush(struct usb_ep *ep, struct usb_request *req)
 {
struct f_dfu *f_dfu = req->context;
-   int ret;
-
-   ret = dfu_flush(dfu_get_entity(f_dfu->altsetting), req->buf,
-   req->length, f_dfu->blk_seq_num);
-   if (ret) {
-   f_dfu->dfu_status 

[U-Boot] Olinuxino A13 NAND boot (Sunxi)

2016-01-28 Thread Kevin Kowalewski
Hi,

I've been trying for a few days now to get u-boot loaded onto NAND and
actually booting here on my Olinuxino A13 which is an Allwinner CPU so the
sunxi side of things. I've had no such luck using the 2016-01 RC2 nor the
CHIP u-Boot branch, which is based off the the R8. My understanding is SPL
replaces boot0 / boot1 for Allwinner/sunxi boards.

The board uses 8K page sizes with 640 B OOB. ECC Strength is reported
online as 1024/40 and I've changed the dts to match as there are a few
floating around online for the A13.

There are 3 ways I've tried to get u-boot with SPL loading from NAND and
none of them have been successful.

1. Use the same fel write script that CHIP uses. With their pre-compiled
uBoot and my dts nand is visible and writable by uBoot for both write and
write.raw. Theirs separate the sunxi-spl and uboot and flashes it to
different locations.
2. Use 2016-01 RC2 compiled with the a13 dts with the added nand entry.
Flash the whole u-boot-sunxi-with-spl.bin to the beginning of nand. The
size lined up with 8K pages so no padding was needed (or so I assume). For
some reason the write locks up when trying to write something large than
~100K or so...
3. Boot buildroot and use mtd_debug erase & nandwrite to write the
u-boot-sunxi-with-spl.bin to the beginning of NAND.

I saw this post: http://lists.denx.de/pipermail/u-boot/2015-May/214959.html
about someone trying something similar, but I find it strange none of my
images work.

Adding the chip to the nand_ids.c file, just enabled ONFI, without it
u-Boot claims the ONFI header can't be found, doesn't seem like a big deal.

Any help would be greatly appreciated.

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


Re: [U-Boot] [PATCH] ARM: tegra: rm Jetson TK1 PMIC GPIO programming

2016-01-28 Thread Tom Warren
OK. I was waiting to see if Simon's dm display driver changes would go in via 
the Tegra repo (they apply / build OK now, but I've had no time for testing).

With the merge window closing, I'll send a PR with just this fix. Thanks.

Tom

> -Original Message-
> From: Stephen Warren [mailto:swar...@wwwdotorg.org]
> Sent: Thursday, January 28, 2016 10:11 AM
> To: Tom Warren 
> Cc: u-boot@lists.denx.de; Simon Glass ; Stephen Warren
> ; Thierry Reding 
> Subject: Re: [PATCH] ARM: tegra: rm Jetson TK1 PMIC GPIO programming
> 
> On 01/18/2016 12:16 PM, Tom Warren wrote:
> > Stephen Warren wrotea tMonday, January 18, 2016 11:23 AM:
> >> The PMIC is configured such that its GPIOs have the correct
> >> configuration at power-up, so no programming is required.
> >>
> >> In fact, the current programming is actively wrong, since:
> >>
> >> (a) the AS3722 driver configures the GPIO to be an output before
> >> setting its output value, which causes a 0v glitch on the output.
> >>
> >> (b) the AS3722 driver configures the GPIO to drive a high voltage
> >> from its VSUP_GPIO power source rather than its VDD_GPIO_LV power
> >> source, so the pin drives 5V not 1.8V as desired.
> >>
> >> Solve these problems by removing the code which configures the PMIC
> GPIOs.
> >>
> >> Note that this patch was tested directly on top of v2016.01; since
> >> then, commit
> >> 96350f729c42 "dm: tegra: net: Convert tegra boards to driver model
> >> for Ethernet" prevents PCIe from being initialized. Alternatively,
> >> simply revert that commit to get PCIe Ethernet working again, then apply
> this patch to test.
> >>
> > Acked-by: Tom Warren  I'll apply this to
> > u-boot-tegra/next ASAP.
> 
> I don't see this patch there yet. It'd be good to get it pulled upstream ASAP
> since the merge window for v2016.03 closes this weekend.
---
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
---
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] Pull request, u-boot-tegra/master

2016-01-28 Thread Tom Warren
Tom,

Please pull u-boot-tegra/master into U-Boot/master. Thanks!

All tegra builds are OK (32-bit and 64-bit).

The following changes since commit b20c38a973a51bf3f663bd298c63ad1b8e0de445:

  arm: mvebu: Add support for the Armada XP theadorable board (2016-01-27
07:45:43 +0100)

are available in the git repository at:

  git://git.denx.de/u-boot-tegra.git master

for you to fetch changes up to 7fb82986be6252acf5aa05ac1ba7225548134a18:

  ARM: tegra: rm Jetson TK1 PMIC GPIO programming (2016-01-28 10:32:31
-0700)


Stephen Warren (1):
  ARM: tegra: rm Jetson TK1 PMIC GPIO programming

 board/nvidia/jetson-tk1/jetson-tk1.c | 13 -
 1 file changed, 13 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] dfu: usb: f_dfu: Set deferred call for dfu_flush() function

2016-01-28 Thread Stephen Warren

On 01/28/2016 09:46 AM, Lukasz Majewski wrote:

This patch fixes situation when one would like to write large file into
medium with the file system (fat, ext4, etc).
This change sets file size limitation to the DFU internal buffer size.


Tested-by: Stephen Warren 

I tested this on NVIDIA's Jetson TX1 using test/py's test_dfu, with 
existing transfer sizes (63 bytes ... 8MB) rather than attempting to do 
anything with large files.

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


[U-Boot] [PATCH 24/26] spl: Add a way to specify a list of device trees to include

2016-01-28 Thread Simon Glass
When building a FIT, more than one device tree can be included. The board
can select (at run-time) the one that it wants.

Add a Kconfig option to allow the list of devices trees (supported by the
board) to be specified.

When using SPL_LOAD_FIT, build u-boot.img in FIT format instead of the
legacy image format. Include all the listed device tree files in this FIT.

Signed-off-by: Simon Glass 
---

 Makefile| 10 +-
 dts/Kconfig | 10 ++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 8b9f622..d01cd3e 100644
--- a/Makefile
+++ b/Makefile
@@ -903,9 +903,16 @@ quiet_cmd_cpp_cfg = CFG $@
 cmd_cpp_cfg = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
-DDO_DEPS_ONLY -D__ASSEMBLY__ -x assembler-with-cpp -P -dM -E -o $@ $<
 
+ifdef CONFIG_SPL_LOAD_FIT
+MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
+   -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
+   -n "U-Boot $(UBOOTRELEASE) for $(BOARD) board" -E \
+   -b $(patsubst %,arch/$(ARCH)/dts/%.dtb,$(subst ",,$(CONFIG_OF_LIST))) -i
+else
 MKIMAGEFLAGS_u-boot.img = -A $(ARCH) -T firmware -C none -O u-boot \
-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_UBOOT_START) \
-n "U-Boot $(UBOOTRELEASE) for $(BOARD) board"
+endif
 
 MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
 
@@ -918,7 +925,8 @@ MKIMAGEFLAGS_u-boot-spl.kwb = -n 
$(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
 MKIMAGEFLAGS_u-boot.pbl = -n $(srctree)/$(CONFIG_SYS_FSL_PBL_RCW:"%"=%) \
-R $(srctree)/$(CONFIG_SYS_FSL_PBL_PBI:"%"=%) -T pblimage
 
-u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl: u-boot.bin FORCE
+u-boot-dtb.img u-boot.img u-boot.kwb u-boot.pbl: \
+   $(if $(CONFIG_SPL_LOAD_FIT),u-boot-nodtb.bin 
dts/dt.dtb,u-boot.bin) FORCE
$(call if_changed,mkimage)
 
 u-boot-spl.kwb: u-boot.img spl/u-boot-spl.bin FORCE
diff --git a/dts/Kconfig b/dts/Kconfig
index ba83d5f..9ef2660 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -59,6 +59,16 @@ config DEFAULT_DEVICE_TREE
  It can be overridden from the command line:
  $ make DEVICE_TREE=
 
+config OF_LIST
+   string "List of device tree files to include for DT control"
+   depends on SPL_LOAD_FIT
+   help
+ This option specifies a list of device tree files to use for DT
+ control. These will be packaged into a FIT. At run-time, SPL will
+ select the correct DT to use by examining the hardware (e.g.
+ reading a board ID value). This is a list of device tree files
+ (without the directory or .dtb suffix) separated by .
+
 config OF_SPL_REMOVE_PROPS
string "List of device tree properties to drop for SPL"
depends on SPL_OF_CONTROL
-- 
2.7.0.rc3.207.g0ac5344

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


[U-Boot] [PATCH 18/26] mkimage: Support automatic creating of a FIT without a .its

2016-01-28 Thread Simon Glass
At present, when generating a FIT, mkimage requires a .its file containing
the structure of the FIT and referring to the images to be included.

Creating the .its file is a separate step that makes it harder to use FIT.
This is not required for creating legacy images.

Often the FIT is pretty standard, consisting of an OS image, some device
tree files and a single configuration. We can handle this case automatically
and avoid needing a .its file at all.

To start with, support automatically generate the FIT using a new '-f auto'
option. Initially this only supports adding a single image (e.g. a linux
kernel) and a single configuration.

Signed-off-by: Simon Glass 
---

 doc/mkimage.1 |  16 +++-
 tools/fit_image.c | 216 +-
 tools/imagetool.h |   1 +
 tools/mkimage.c   |   8 +-
 4 files changed, 235 insertions(+), 6 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index 1b9d18c..146c114 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -108,10 +108,15 @@ Provide special options to the device tree compiler that 
is used to
 create the image.
 
 .TP
-.BI "\-f [" "image tree source file" "]"
+.BI "\-f [" "image tree source file" " | " "auto" "]"
 Image tree source file that describes the structure and contents of the
 FIT image.
 
+This can be automatically generated for some simple cases.
+Use "-f auto" for this. In that case the arguments -d, -A, -O, -T, -C, -a
+and -e are used to specify the image to include in the FIT and its attributes.
+No .its file is required.
+
 .TP
 .BI "\-F"
 Indicates that an existing FIT image should be modified. No dtc
@@ -178,6 +183,15 @@ with unavailable keys are skipped.
 .B -c """Kernel 3.8 image for production devices""" kernel.itb
 .fi
 
+.P
+Create a FIT image containing a kernel, using automatic mode. No .its file
+is required.
+.nf
+.B mkimage -f auto -A arm -O linux -T kernel -C none -a 43e0 -e 0 
+.br
+.B -c """Kernel 4.4 image for production devices""" -d vmlinuz kernel.itb
+.fi
+
 .SH HOMEPAGE
 http://www.denx.de/wiki/U-Boot/WebHome
 .PP
diff --git a/tools/fit_image.c b/tools/fit_image.c
index eb2a25e..343de60 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -18,6 +18,8 @@
 #include "fit_common.h"
 #include "mkimage.h"
 #include 
+#include 
+#include 
 #include 
 
 static image_header_t header;
@@ -71,6 +73,207 @@ err_keydest:
 }
 
 /**
+ * fit_calc_size() - Calculate the approximate size of the FIT we will generate
+ */
+static int fit_calc_size(struct image_tool_params *params)
+{
+   int size, total_size;
+
+   size = imagetool_get_filesize(params, params->datafile);
+   if (size < 0)
+   return -1;
+
+   total_size = size;
+
+   /* TODO(s...@chromium.org): Add in the size of any other files */
+
+   /* Add plenty of space for headers, properties, nodes, etc. */
+   total_size += 4096;
+
+   return total_size;
+}
+
+static int fdt_property_file(struct image_tool_params *params,
+void *fdt, const char *name, const char *fname)
+{
+   struct stat sbuf;
+   void *ptr;
+   int ret;
+   int fd;
+
+   fd = open(fname, O_RDWR | O_BINARY);
+   if (fd < 0) {
+   fprintf(stderr, "%s: Can't open %s: %s\n",
+   params->cmdname, fname, strerror(errno));
+   return -1;
+   }
+
+   if (fstat(fd, ) < 0) {
+   fprintf(stderr, "%s: Can't stat %s: %s\n",
+   params->cmdname, fname, strerror(errno));
+   goto err;
+   }
+
+   ret = fdt_property_val(fdt, "data", sbuf.st_size, );
+   if (ret)
+   return ret;
+   ret = read(fd, ptr, sbuf.st_size);
+   if (ret != sbuf.st_size) {
+   fprintf(stderr, "%s: Can't read %s: %s\n",
+   params->cmdname, fname, strerror(errno));
+   goto err;
+   }
+
+   return 0;
+err:
+   close(fd);
+   return -1;
+}
+
+static int fdt_property_strf(void *fdt, const char *name, const char *fmt, ...)
+{
+   char str[100];
+   va_list ptr;
+
+   va_start(ptr, fmt);
+   vsnprintf(str, sizeof(str), fmt, ptr);
+   va_end(ptr);
+   return fdt_property_string(fdt, name, str);
+}
+
+/**
+ * fit_write_images() - Write out a list of images to the FIT
+ *
+ * Include the main image (params->datafile).
+ */
+static int fit_write_images(struct image_tool_params *params, char *fdt)
+{
+   const char *typename;
+   char str[100];
+   int ret;
+
+   fdt_begin_node(fdt, "images");
+
+   /* First the main image */
+   typename = genimg_get_type_short_name(params->fit_image_type);
+   snprintf(str, sizeof(str), "%s@1", typename);
+   fdt_begin_node(fdt, str);
+   fdt_property_string(fdt, "description", params->imagename);
+   fdt_property_string(fdt, "type", typename);
+   fdt_property_string(fdt, "arch", 

[U-Boot] [PATCH 20/26] mkimage: Support placing data outside the FIT

2016-01-28 Thread Simon Glass
One limitation of FIT is that all the data is 'inline' within it, using a
'data' property in each image node. This means that to find out what is in
the FIT it is necessary to scan the entire file. Once loaded it can be
scanned and then the images can be copied to the correct place in memory.

In SPL it can take a significant amount of time to copy images around in
memory. Also loading data that does not end up being used is wasteful. It
would be useful if the FIT were small, acting as a directory, with the
actual data stored elsewhere.

This allows SPL to load the entire FIT, without the images, then load the
images it wants later.

Add a -E option to mkimage to request that it output an 'external' FIT.

Signed-off-by: Simon Glass 
---

 doc/mkimage.1 |   9 +++
 doc/uImage.FIT/source_file_format.txt |  20 ++-
 tools/fit_image.c | 109 ++
 tools/imagetool.h |   1 +
 tools/mkimage.c   |   5 +-
 5 files changed, 142 insertions(+), 2 deletions(-)

diff --git a/doc/mkimage.1 b/doc/mkimage.1
index b1b45d7..d9ffc75 100644
--- a/doc/mkimage.1
+++ b/doc/mkimage.1
@@ -112,6 +112,15 @@ Provide special options to the device tree compiler that 
is used to
 create the image.
 
 .TP
+.BI "\-E
+After processing, move the image data outside the FIT and store a data offset
+in the FIT. Images will be placed one after the other immediately after the
+FIT, with each one aligned to a 4-byte boundary. The existing 'data' property
+in each image will be replaced with 'data-offset' and 'data-size' properties.
+A 'data-offset' of 0 indicates that it starts in the first (4-byte aligned)
+byte after the FIT.
+
+.TP
 .BI "\-f [" "image tree source file" " | " "auto" "]"
 Image tree source file that describes the structure and contents of the
 FIT image.
diff --git a/doc/uImage.FIT/source_file_format.txt 
b/doc/uImage.FIT/source_file_format.txt
index 029f481..e39b38c 100644
--- a/doc/uImage.FIT/source_file_format.txt
+++ b/doc/uImage.FIT/source_file_format.txt
@@ -2,6 +2,7 @@ U-boot new uImage source file format (bindings definition)
 ==
 
 Author: Marian Balakowicz 
+External data additions, 25/1/16 Simon Glass 
 
 1) Introduction
 ---
@@ -262,7 +263,24 @@ Older, 2.4 kernel and 2.6 non-FDT kernel do not use FDT 
blob, in such cases
 not* be specified in a configuration node.
 
 
-8) Examples
+8) External data
+
+
+The above format shows a 'data' property which holds the data for each image.
+It is also possible for this data to reside outside the FIT itself. This
+allows the FIT to be quite small, so that it can be loaded and scanned
+without loading a large amount of data. Then when an image is needed it can
+be loaded from an external source.
+
+In this case the 'data' property is omitted. Instead you can use:
+
+  - data-offset : offset of the data in a separate image store. The image
+store is placed immediately after the last byte of the device tree binary,
+aligned to a 4-byte boundary.
+  - data-size : size of the data in bytes
+
+
+9) Examples
 ---
 
 Please see doc/uImage.FIT/*.its for actual image source files.
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 0d8007b..5d087e3 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -354,6 +354,108 @@ err:
 }
 
 /**
+ * fit_extract_data() - Move all data outside the FIT
+ *
+ * This takes a normal FIT file and removes all the 'data' properties from it.
+ * The data is placed in an area after the FIT so that it can be accessed
+ * using an offset into that area. The 'data' properties turn into
+ * 'data-offset' properties.
+ *
+ * This function cannot cope with FITs with 'data-offset' properties. All
+ * data must be in 'data' properties on entry.
+ */
+static int fit_extract_data(struct image_tool_params *params, const char 
*fname)
+{
+   void *buf;
+   int buf_ptr;
+   int fit_size, new_size;
+   int fd;
+   struct stat sbuf;
+   void *fdt;
+   int ret;
+   int images;
+   int node;
+
+   fd = mmap_fdt(params->cmdname, fname, 0, , , false);
+   if (fd < 0)
+   return -EIO;
+   fit_size = fdt_totalsize(fdt);
+
+   /* Allocate space to hold the image data we will extract */
+   buf = malloc(fit_size);
+   if (!buf) {
+   ret = -ENOMEM;
+   goto err;
+   }
+   buf_ptr = 0;
+
+   images = fdt_path_offset(fdt, FIT_IMAGES_PATH);
+   if (images < 0) {
+   debug("%s: Cannot find /images node: %d\n", __func__, images);
+   ret = -EINVAL;
+   goto err;
+   }
+
+   for (node = fdt_first_subnode(fdt, images);
+node >= 0;
+node = fdt_next_subnode(fdt, node)) {
+   const char *data;
+   int len;
+
+   

Re: [U-Boot] [PATCH v2 01/15] armv8: ls2080: Add SFP Configs for LS2080/LS2085

2016-01-28 Thread york sun
On 01/28/2016 05:22 AM, Saksham Jain wrote:
> In LS2080/LS2085, SFP is LE and Ver is 3.4
> The base address is 0x01e80200
> SFP will be used in Secure Boot to read fuses.
> Signed-off-by: Aneesh Bansal 
> Signed-off-by: Saksham Jain 
> ---

Please insert a blank line before your signature for future patches.

York


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


[U-Boot] [PATCH 23/26] spl: Add an option to load a FIT containing U-Boot

2016-01-28 Thread Simon Glass
This provides a way to load a FIT containing U-Boot and a selection of device
tree files. The board can select the correct device tree by probing the
hardware. Then U-Boot is started with the selected device tree.

Signed-off-by: Simon Glass 
---

 Kconfig  |  11 +++
 common/spl/Makefile  |   1 +
 common/spl/spl_fit.c | 192 +++
 include/spl.h|  18 +
 4 files changed, 222 insertions(+)
 create mode 100644 common/spl/spl_fit.c

diff --git a/Kconfig b/Kconfig
index 3ce5ba1..f32c6c7 100644
--- a/Kconfig
+++ b/Kconfig
@@ -215,6 +215,17 @@ config SYS_TEXT_BASE
help
  TODO: Move CONFIG_SYS_TEXT_BASE for all the architecture
 
+config SPL_LOAD_FIT
+   bool "Enable SPL loading U-Boot as a FIT"
+   depends on FIT
+   help
+ Normally with the SPL framework a legacy image is generated as part
+ of the build. This contains U-Boot along with information as to
+ where it should be loaded. This option instead enables generation
+ of a FIT (Flat Image Tree) which provides more flexibility. In
+ particular it can handle selecting from multiple device tree
+ and passing the correct one to U-Boot.
+
 config SYS_CLK_FREQ
depends on ARC || ARCH_SUNXI
int "CPU clock frequency"
diff --git a/common/spl/Makefile b/common/spl/Makefile
index 10a4589..2e0f695 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -10,6 +10,7 @@
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
+obj-$(CONFIG_SPL_LOAD_FIT) += spl_fit.o
 obj-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
 obj-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
new file mode 100644
index 000..f225f64
--- /dev/null
+++ b/common/spl/spl_fit.c
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2016 Google, Inc
+ * Written by Simon Glass 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+
+static ulong fdt_getprop_u32(const void *fdt, int node, const char *prop)
+{
+   const u32 *cell;
+   int len;
+
+   cell = fdt_getprop(fdt, node, prop, );
+   if (len != sizeof(*cell))
+   return -1U;
+   return fdt32_to_cpu(*cell);
+}
+
+static int spl_fit_select_fdt(const void *fdt, int images, int *fdt_offsetp)
+{
+   const char *name, *fdt_name;
+   int conf, node, fdt_node;
+   int len;
+
+   *fdt_offsetp = 0;
+   conf = fdt_path_offset(fdt, FIT_CONFS_PATH);
+   if (conf < 0) {
+   debug("%s: Cannot find /configurations node: %d\n", __func__,
+ conf);
+   return -EINVAL;
+   }
+   for (node = fdt_first_subnode(fdt, conf);
+node >= 0;
+node = fdt_next_subnode(fdt, node)) {
+   name = fdt_getprop(fdt, node, "description", );
+   if (!name)
+   return -EINVAL;
+   if (board_fit_config_name_match(name))
+   continue;
+
+   debug("Selecting config '%s'", name);
+   fdt_name = fdt_getprop(fdt, node, FIT_FDT_PROP, );
+   if (!fdt_name) {
+   debug("%s: Cannot find fdt name property: %d\n",
+ __func__, len);
+   return -EINVAL;
+   }
+
+   debug(", fdt '%s'\n", fdt_name);
+   fdt_node = fdt_subnode_offset(fdt, images, fdt_name);
+   if (fdt_node < 0) {
+   debug("%s: Cannot find fdt node '%s': %d\n",
+ __func__, fdt_name, fdt_node);
+   return -EINVAL;
+   }
+
+   *fdt_offsetp = fdt_getprop_u32(fdt, fdt_node, "data-offset");
+   len = fdt_getprop_u32(fdt, fdt_node, "data-size");
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+   printf("FIT: Selected '%s'\n", name);
+#endif
+
+   return len;
+   }
+
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+   printf("No matching DT out of these options:\n");
+   for (node = fdt_first_subnode(fdt, conf);
+node >= 0;
+node = fdt_next_subnode(fdt, node)) {
+   name = fdt_getprop(fdt, node, "name", );
+   printf("   %s\n", name);
+   }
+#endif
+
+   return -ENOENT;
+}
+
+int spl_load_simple_fit(struct spl_load_info *info, ulong sector, void *fit)
+{
+   int sectors;
+   ulong size, load;
+   unsigned long count;
+   int node, images;
+   void *load_ptr;
+   int fdt_offset, fdt_len;
+   int data_offset, data_size;
+   int base_offset;
+   int src_sector;
+   void *dst;
+
+   /*
+* Figure out where the external images start. This is the base for the
+* data-offset properties in each image.
+*/
+   size = fdt_totalsize(fit);
+  

Re: [U-Boot] [PATCH] ARM: tegra: rm Jetson TK1 PMIC GPIO programming

2016-01-28 Thread Stephen Warren

On 01/18/2016 12:16 PM, Tom Warren wrote:

Stephen Warren wrotea tMonday, January 18, 2016 11:23 AM:

The PMIC is configured such that its GPIOs have the correct configuration at
power-up, so no programming is required.

In fact, the current programming is actively wrong, since:

(a) the AS3722 driver configures the GPIO to be an output before setting its
output value, which causes a 0v glitch on the output.

(b) the AS3722 driver configures the GPIO to drive a high voltage from its
VSUP_GPIO power source rather than its VDD_GPIO_LV power source, so the
pin drives 5V not 1.8V as desired.

Solve these problems by removing the code which configures the PMIC GPIOs.

Note that this patch was tested directly on top of v2016.01; since then, commit
96350f729c42 "dm: tegra: net: Convert tegra boards to driver model for
Ethernet" prevents PCIe from being initialized. Alternatively, simply revert 
that
commit to get PCIe Ethernet working again, then apply this patch to test.


Acked-by: Tom Warren 
I'll apply this to u-boot-tegra/next ASAP.


I don't see this patch there yet. It'd be good to get it pulled upstream 
ASAP since the merge window for v2016.03 closes this weekend.

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


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

2016-01-28 Thread Tom Rini
On Thu, Jan 28, 2016 at 10:46:47AM -0700, Tom Warren wrote:

> Tom,
> 
> Please pull u-boot-tegra/master into U-Boot/master. Thanks!
> 
> All tegra builds are OK (32-bit and 64-bit).
> 
> The following changes since commit b20c38a973a51bf3f663bd298c63ad1b8e0de445:
> 
>   arm: mvebu: Add support for the Armada XP theadorable board (2016-01-27
> 07:45:43 +0100)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-tegra.git master
> 
> for you to fetch changes up to 7fb82986be6252acf5aa05ac1ba7225548134a18:
> 
>   ARM: tegra: rm Jetson TK1 PMIC GPIO programming (2016-01-28 10:32:31
> -0700)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] net: tftp: Add TFTP specific config for retry count

2016-01-28 Thread MESSIER, ALEXANDRE
Hi Joe,

It turns out that commit f5fb734 "net: TFTP: variables cleanup and addition"
implements the same functionality as this patch.

Please disregard this patch.

Thanks!

> -Original Message-
> From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
> Sent: January-22-16 2:29 PM
> To: amessier.t...@gmail.com
> Cc: u-boot; Joe Hershberger; MESSIER, ALEXANDRE
> Subject: Re: [U-Boot] [PATCH] net: tftp: Add TFTP specific config for retry
> count
>
> On Fri, Jan 22, 2016 at 1:18 PM,   wrote:
> > From: Alexandre Messier 
> >
> > There is currently one config option (CONFIG_NET_RETRY_COUNT) that is
> > available to tune the retries of the network stack.
> > Unfortunately, it is global to all protocols, and the value is
> > interpreted differently in all of them.
> >
> > Add a new config option that sets directly the number of retries
> > specifically for TFTP.
> >
> > Signed-off-by: Alexandre Messier 
> > ---
> >  README | 5 +
> >  net/tftp.c | 4 
> >  2 files changed, 9 insertions(+)
> >
> > diff --git a/README b/README
> > index ece4793..9d53c2e 100644
> > --- a/README
> > +++ b/README
> > @@ -2845,6 +2845,11 @@ CBFS (Coreboot Filesystem) support
> > before giving up the operation. If not defined, a
> > default value of 5 is used.
> >
> > +   CONFIG_NET_RETRY_COUNT_TFTP
> > +
> > +   Override CONFIG_NET_RETRY_COUNT for TFTP. If not defined,
> > +   falls back to CONFIG_NET_RETRY_COUNT.
> > +
>
> If you want to add a new config option, it needs to be in the Kconfig system.
>
> > CONFIG_ARP_TIMEOUT
> >
> > Timeout waiting for an ARP reply in milliseconds.
> > diff --git a/net/tftp.c b/net/tftp.c
> > index f2889fe..884cfaa 100644
> > --- a/net/tftp.c
> > +++ b/net/tftp.c
> > @@ -20,12 +20,16 @@
> >  #define WELL_KNOWN_PORT69
> >  /* Millisecs to timeout for lost pkt */
> >  #define TIMEOUT5000UL
> > +#ifndef CONFIG_NET_RETRY_COUNT_TFTP
> >  #ifndefCONFIG_NET_RETRY_COUNT
> >  /* # of timeouts before giving up */
> >  # define TIMEOUT_COUNT 10
> >  #else
> >  # define TIMEOUT_COUNT  (CONFIG_NET_RETRY_COUNT * 2)  #endif
> > +#else
> > +# define TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT_TFTP #endif
> >  /* Number of "loading" hashes per line (for checking the image size) */
> >  #define HASHES_PER_LINE65
> >
> > --
> > 2.7.0
> >
> > ___
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.denx.de_mail
> > man_listinfo_u-2Dboot=CwIBaQ=0YGvTs3tT-
> VMy8_v51yLDw=adEdfGeVvAp5
> > D3jUKeOClnVoZZOSb93LtGg4Qgmpmjw=9unHvE5XXKyF-
> lM3U6pF9XpWvcC8xlNgyTBS
> > nEPIi6k=iNlpx7rwu413FslQ29XOXe1QNlTHfFNrF_Ej2NKr2T8=



This e-mail contains privileged and confidential information intended for the 
use of the addressees named above. If you are not the intended recipient of 
this e-mail, you are hereby notified that you must not disseminate, copy or 
take any action in respect of any information contained in it. If you have 
received this e-mail in error, please notify the sender immediately by e-mail 
and immediately destroy this e-mail and its attachments.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please pull u-boot-x86

2016-01-28 Thread Tom Rini
On Thu, Jan 28, 2016 at 03:13:18PM +0800, Bin Meng wrote:

> Hi Tom,
> 
> The following changes since commit b20c38a973a51bf3f663bd298c63ad1b8e0de445:
> 
>   arm: mvebu: Add support for the Armada XP theadorable board
> (2016-01-27 07:45:43 +0100)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-x86.git master
> 
> for you to fetch changes up to 81aaa3d9fce5ce9641e5f0c3354da876d859b3b6:
> 
>   x86: Correct spi node alias (2016-01-28 13:53:30 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [GIT PULL] Xilinx changes

2016-01-28 Thread Tom Rini
On Wed, Jan 27, 2016 at 04:42:09PM +0100, Michal Simek wrote:

> Hi Tom,
> 
> here is the branch with xilinx changes which are flying around.
> It is targeting PowerPC, Microblaze, ARM and ARM64.
> I can't see any build problem via buildman.
> 
> Thanks,
> Michal
> 
> 
> The following changes since commit 9e4de7fd4acc8f99b6d383c711d21c0159849629:
> 
>   Merge branch 'master' of http://git.denx.de/u-boot-sunxi (2016-01-26
> 17:45:37 -0500)
> 
> are available in the git repository at:
> 
> 
>   git://www.denx.de/git/u-boot-microblaze.git master
> 
> for you to fetch changes up to f36919a8138ed7ecd3dbce4630e02936b13907da:
> 
>   ppc: xilinx-ppc440-generic: Wire LL_TEMAC driver (2016-01-27 15:57:20
> +0100)
> 

Applied to u-boot/master, thanks!

But note:
+(xilinx-ppc405-generic) Device Tree Source is not correctly specified.
+(xilinx-ppc405-generic) Please define 'CONFIG_DEFAULT_DEVICE_TREE'
+(xilinx-ppc405-generic) or build with 'DEVICE_TREE=' argument
+(xilinx-ppc405-generic) make[2]: *** 
[arch/powerpc/dts/xilinx-ppc440-generic.dtb] Error 1
+(xilinx-ppc405-generic) make[1]: *** [dts] Error 2

-- 
Tom


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


Re: [U-Boot] Please pull u-boot-fsl-qoriq.git master

2016-01-28 Thread Tom Rini
On Wed, Jan 27, 2016 at 05:30:45PM +, york sun wrote:

> Tom,
> 
> The following changes since commit 12f229ea8f6c8e20f8fd07906eafc853c4c354a9:
> 
>   Merge git://git.denx.de/u-boot-fdt (2016-01-22 17:01:22 -0500)
> 
> are available in the git repository at:
> 
> 
>   git://git.denx.de/u-boot-fsl-qoriq.git master
> 
> for you to fetch changes up to b0f20caf6570fbc4d19c41dcedf9679784042860:
> 
>   armv8/ls1043aqds: add QSPI boot support (2016-01-27 08:29:09 -0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Please pull u-boot-marvell/master

2016-01-28 Thread Tom Rini
On Wed, Jan 27, 2016 at 07:58:00AM +0100, Stefan Roese wrote:

> Hi Tom,
> 
> please pull the following patch.
> 
> Thanks,
> Stefan
> 
> The following changes since commit 9e4de7fd4acc8f99b6d383c711d21c0159849629:
> 
>   Merge branch 'master' of http://git.denx.de/u-boot-sunxi
> (2016-01-26 17:45:37 -0500)
> 
> are available in the git repository at:
> 
>   git://www.denx.de/git/u-boot-marvell.git
> 
> for you to fetch changes up to b20c38a973a51bf3f663bd298c63ad1b8e0de445:
> 
>   arm: mvebu: Add support for the Armada XP theadorable board
> (2016-01-27 07:45:43 +0100)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [PATCH] test/py: fix a couple typos in comments

2016-01-28 Thread Stephen Warren
From: Stephen Warren 

s/updata/update/.

Signed-off-by: Stephen Warren 
---
 test/py/tests/test_env.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index 651303f8cd69..c41aa5a9d9c7 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -94,7 +94,7 @@ def unset_var(state_test_env, var):
 object.
 
 Args:
-state_test_env: The StateTestEnv object to updata.
+state_test_env: The StateTestEnv object to update.
 var: The variable name to unset.
 
 Returns:
@@ -112,7 +112,7 @@ def set_var(state_test_env, var, value):
 object.
 
 Args:
-state_test_env: The StateTestEnv object to updata.
+state_test_env: The StateTestEnv object to update.
 var: The variable name to set.
 value: The value to set the variable to.
 
-- 
2.7.0

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


[U-Boot] [PATCH] test/py: dfu: allow boardenv to specify test sizes

2016-01-28 Thread Stephen Warren
From: Stephen Warren 

Allow the env__dfu_configs boardenv data to specify the set of DFU
transfer sizes to test. Manually specifying test sizes is useful if you
wish to test multiple DFU configurations (e.g. SD card ext4 filesystem, SD
card whole raw partition, RAM, etc.), but don't want to test every
single transfer size on each, to avoid bloating the overall time taken by
testing. If the boardenv doesn't specify a set of sizes, the built-in list
is used as a default, preserving backwards-compatibility.

Signed-off-by: Stephen Warren 
---
 test/py/tests/test_dfu.py | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/test/py/tests/test_dfu.py b/test/py/tests/test_dfu.py
index bb70008af300..093e8d067871 100644
--- a/test/py/tests/test_dfu.py
+++ b/test/py/tests/test_dfu.py
@@ -36,6 +36,14 @@ env__dfu_configs = (
 "fixture_id": "emmc",
 "alt_info": "/dfu_test.bin ext4 0 1;/dfu_dummy.bin ext4 0 1",
 "cmd_params": "mmc 0",
+# This value is optional.
+# If present, it specified the set of transfer sizes tested.
+# If missing, a default list of sizes will be used, which covers
+#   various useful corner cases.
+# Manually specifying test sizes is useful if you wish to test 4 DFU
+# configurations, but don't want to test every single transfer size
+# on each, to avoid bloating the overall time taken by testing.
+"test_sizes": (63, 64, 65),
 },
 )
 
@@ -52,7 +60,7 @@ device.)
 # The set of file sizes to test. These values trigger various edge-cases such
 # as one less than, equal to, and one greater than typical USB max packet
 # sizes, and similar boundary conditions.
-test_sizes = (
+test_sizes_default = (
 64 - 1,
 64,
 64 + 1,
@@ -245,7 +253,7 @@ def test_dfu(u_boot_console, env__usb_dev_port, 
env__dfu_config):
 if not first_usb_dev_port:
 first_usb_dev_port = env__usb_dev_port
 if env__usb_dev_port == first_usb_dev_port:
-sizes = test_sizes
+sizes = env__dfu_config.get('test_sizes', test_sizes_default)
 else:
 sizes = []
 
-- 
2.7.0

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


[U-Boot] [PATCH] common/memsize.c: Simplify RAM size detection

2016-01-28 Thread Eddy Petrișor
The case of memory of size 0 is not that different from a memory of any other
size, so we remove the duplicate code and treat the small differences when it
is the case.

Series-to: u-boot
Signed-off-by: Eddy Petrișor 
---
 common/memsize.c | 47 +--
 1 file changed, 21 insertions(+), 26 deletions(-)

diff --git a/common/memsize.c b/common/memsize.c
index 0fb9ba5..5c0d279 100644
--- a/common/memsize.c
+++ b/common/memsize.c
@@ -33,38 +33,28 @@ long get_ram_size(long *base, long maxsize)
long   size;
inti = 0;
 
-   for (cnt = (maxsize / sizeof(long)) >> 1; cnt > 0; cnt >>= 1) {
+   for (cnt = (maxsize / sizeof(long)) >> 1; cnt >= 0; cnt >>= 1) {
addr = base + cnt;  /* pointer arith! */
sync();
-   save[i++] = *addr;
+   save[i] = *addr;
sync();
-   *addr = ~cnt;
-   }
-
-   addr = base;
-   sync();
-   save[i] = *addr;
-   sync();
-   *addr = 0;
-
-   sync();
-   if ((val = *addr) != 0) {
-   /* Restore the original data before leaving the function. */
-   sync();
-   *addr = save[i];
-   for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) {
-   addr  = base + cnt;
-   sync();
-   *addr = save[--i];
+   if (cnt) {
+   i++;
+   *addr = ~cnt;
+   } else {
+   *addr = 0;
}
-   return (0);
}
 
-   for (cnt = 1; cnt < maxsize / sizeof(long); cnt <<= 1) {
+   sync();
+   cnt = 0;
+   do {
addr = base + cnt;  /* pointer arith! */
val = *addr;
-   *addr = save[--i];
-   if (val != ~cnt) {
+   *addr = save[i--];
+   sync();
+   if (((cnt == 0) && (val != 0)) ||
+   ((cnt != 0) && (val != ~cnt))) {
size = cnt * sizeof(long);
/*
 * Restore the original data
@@ -74,11 +64,16 @@ long get_ram_size(long *base, long maxsize)
 cnt < maxsize / sizeof(long);
 cnt <<= 1) {
addr  = base + cnt;
-   *addr = save[--i];
+   *addr = save[i--];
}
return (size);
}
-   }
+
+   if (cnt)
+   cnt = cnt << 1;
+   else
+   cnt = 1;
+   } while (cnt < maxsize / sizeof(long));
 
return (maxsize);
 }
-- 
2.1.4

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


[U-Boot] ARMv8: Use U-Boot to boot Xen?

2016-01-28 Thread Dirk Behme

Hi,

are there any U-Boot examples/patches to boot Xen on an ARMv8/aarch64 
system?


I've found

http://lists.denx.de/pipermail/u-boot/2015-October/230077.html

what might be helpful.

But maybe I missed anything else?

Many thanks

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


Re: [U-Boot] [PATCH] Use correct spelling of "U-Boot"

2016-01-28 Thread Simon Glass
On 27 January 2016 at 00:28, Bin Meng  wrote:
> Correct spelling of "U-Boot" shall be used in all written text
> (documentation, comments in source files etc.).
>
> Signed-off-by: Bin Meng 
>
> ---
> I cc'ed all maintainers, please help review in case I made any
> mistakes. Also we should keep an eye on this when reviewing
> patches in the future.

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


[U-Boot] Pull request: u-boot-net.git master

2016-01-28 Thread Joe Hershberger
Hi Tom,

Here are the network patches for this round. Should be pretty basic stuff.

Thanks!
-Joe

The following changes since commit 077678eb0c226e52a1f90edabd3369ab26065b32:

  Merge git://git.denx.de/u-boot-dm (2016-01-12 18:12:42 -0500)

are available in the git repository at:


  git://git.denx.de/u-boot-net.git master

for you to fetch changes up to b2b7fbc33ff1b990804e481153dd45de579cff75:

  net: Add bootfile in DHCP Request (2016-01-28 17:19:43 -0600)


Alexandre Messier (4):
  net: phy: micrel: Disable B_CAST on config
  net: phy: Set ANRESTART in setup_forced
  net: phy: Use 'autoneg' flag from phydev
  net: Add bootfile in DHCP Request

Alexey Brodkin (4):
  drivers/net/phy: introduce phy_set_supported()
  include/net.h: add max_speed member in struct eth_pdata
  net/designware: do explicit port selection for 1Gb mode
  net/designware: add support of max-speed device tree property

Bin Meng (15):
  powerpc: bsc9132qds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
  powerpc: c29xpcie: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
  powerpc: mpc8572ds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
  powerpc: mpc8548cds: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
  powerpc: p1010rdb: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
  arm: ls1021atwr: Do not wrap pci_eth_init() with CONFIG_TSEC_ENET
  net: tsec: fsl_mdio: Fix several cosmetic issues
  net: tsec: Move rx_idx and tx_idx to struct tsec_private
  net: tsec: Move rxbd and txbd to struct tsec_private
  net: tsec: Adjust orders to avoid forward declaration of tsec_send()
  net: tsec: Use tsec_private pointer as the parameter for internal routines
  doc: dt-bindings: Describe Freescale TSEC ethernet controller
  net: tsec: Add driver model ethernet support
  net: tsec: Use priv->tbiaddr to initialize TBI PHY address
  arm: ls102xa: Rewrite the logic of ft_fixup_enet_phy_connect_type()

Codrin Ciubotariu (5):
  drivers: net: vsc9953: Fix number of reserved registers
  drivers: net: vsc9953: Fix FDB aging time
  doc: t1040-l2switch: Update README
  common: cmd_ethsw: Spelling fixes
  drivers: net: vsc9953: Add LAG support

Dinh Nguyen (2):
  net: phy: micrel: add documentation for Micrel KSZ90x1 binding
  net: phy: micrel: fix divisor value for KSZ9031 phy skew

Florian Fainelli (2):
  net: phy: ensure Gigabit features are masked off if requested
  net: phy: breakdown PHY_*_FEATURES defines

Peng Fan (1):
  net: bootp: Ignore packets whose yiaddr is 0

Sascha Hauer (1):
  net: phy: genphy: Allow overwriting features

Shaohui Xie (2):
  net: phy: introduce a quirk PHY_FLAG_BROKEN_RESET
  net: phy: implements probe for Cortina phy

Simon Glass (7):
  tegra: Report errors from PCI init
  net: Don't call board/cpu_eth_init() with driver model
  net: Move common init into a new eth_common.c file
  net: Move environment functions to the common file
  net: Move remaining common functions to eth_common.c
  net: Move driver-model code into its own file
  net: Rename eth.c to eth_lecacy.c

Stefan Agner (1):
  net: phy: do not read configuration register on reset

 arch/arm/cpu/armv7/ls102xa/fdt.c|  16 +-
 board/freescale/bsc9132qds/bsc9132qds.c |   4 +-
 board/freescale/c29xpcie/c29xpcie.c |   4 +-
 board/freescale/ls1021atwr/ls1021atwr.c |   4 +-
 board/freescale/mpc8548cds/mpc8548cds.c |   4 +-
 board/freescale/mpc8572ds/mpc8572ds.c   |   4 +-
 board/freescale/p1010rdb/p1010rdb.c |   4 +-
 common/cmd_ethsw.c  |  78 +++-
 doc/README.t1040-l2switch   |  29 +-
 doc/device-tree-bindings/net/fsl-tsec-phy.txt   |  64 +++
 doc/device-tree-bindings/net/micrel-ksz90x1.txt | 165 +++
 drivers/net/designware.c|  16 +-
 drivers/net/designware.h|   1 +
 drivers/net/fsl_mdio.c  |   4 +-
 drivers/net/phy/cortina.c   |   7 +
 drivers/net/phy/micrel.c|  25 +-
 drivers/net/phy/phy.c   | 102 ++--
 drivers/net/tsec.c  | 536 ++---
 drivers/net/vsc9953.c   | 354 +-
 drivers/pci/pci_tegra.c |   6 +-
 include/ethsw.h |   6 +
 include/fsl_mdio.h  |   7 +-
 include/net.h   |   2 +
 include/phy.h   |  25 +-
 include/tsec.h  |  69 +--
 include/vsc9953.h   |  24 +-
 net/Makefile|   7 +-
 net/bootp.c |   4 +
 

Re: [U-Boot] [PATCH] autoboot.c: Fill env vars in process_fdt_options() only if TEXT_BASE is set

2016-01-28 Thread Simon Glass
On 28 January 2016 at 09:34, Stefan Roese  wrote:
>
> The x86 build target "efi-x86" has no TEXT_BASE configured. And with the
> introduction of CONFIG_BOOTDELAY for x86, this function is now called
> for this board as well. Resulting in compile errors for this target.
>
> Without TEXT_BASE it makes no sense to fill these values. So lets only
> configure the env variable if TEXT_BASE is defined.
>
> Signed-off-by: Stefan Roese 
> Cc: Simon Glass 
> Cc: Bin Meng 
> Cc: Tom Rini 
> ---
>  common/autoboot.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)


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


Re: [U-Boot] [PATCH] test/py: fix a couple typos in comments

2016-01-28 Thread Simon Glass
On 28 January 2016 at 10:18, Stephen Warren  wrote:
> From: Stephen Warren 
>
> s/updata/update/.
>
> Signed-off-by: Stephen Warren 
> ---
>  test/py/tests/test_env.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH 0/7] fdt: Replace u-boot-dtb.bin with u-boot.bin

2016-01-28 Thread Simon Glass
Hi Hans,

On 28 January 2016 at 01:25, Hans de Goede  wrote:
> Hi,
>
> On 28-01-16 04:58, Simon Glass wrote:
>>
>> Hi Hans,
>>
>> On 25 January 2016 at 13:30, Simon Glass  wrote:
>>>
>>>
>>> At present u-boot.bin holds the plain U-Boot binary without the device
>>> tree.
>>> This is somewhat annoying since you need either u-boot.bin or
>>> u-boot-dtb.bin
>>> depending on whether device tree is used.
>>>
>>> This series adjusts the build such that u-boot.bin includes a device
>>> tree,
>>> and the plain binary is in u-boot-nodtb.bin. For now u-boot-dtb.bin
>>> remains
>>> the same.
>>>
>>> This should be acceptable since:
>>>
>>> - without OF_CONTROL, u-boot.bin still does not include a device tree
>>> - with OF_CONTROL, u-boot-dtb.bin does not change
>>>
>>> The main impact is build systems which are set up to use u-boot.bin as
>>> the output file and then add a device tree. These will have to change to
>>> use
>>> u-boot-nodtb.bin instead.
>>>
>>> The original decision to use a separate u-boot-dtb.bin was aimed at
>>> allowing
>>> any device tree file to be concatenated to the u-boot.bin image after the
>>> build. However this no-longer seems so important. More important is the
>>> convenience of using the same output file regardless of the setting for
>>> OF_CONTROL.
>>
>>
>> Do you have any comments on this series please?
>
>
> I'm fine with this series, all normal sunxi use-cases use
> u-boot-sunxi-with-spl.bin
> which is generated like this:
>
> ifneq ($(CONFIG_SUNXI),)
> OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \
>--pad-to=$(CONFIG_SPL_PAD_TO)
> --gap-fill=0xff
> u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin \
> u-boot$(if $(CONFIG_OF_CONTROL),-dtb,).img FORCE
> $(call if_changed,pad_cat)
> endif
>
> Which should stay working just fine, although it might be slightly
> simplified after your patch to simply always use u-boot.img.
>
> sunxi spl does not use a dtb, so nothing should change there.

OK thanks. I'll respin the series with the comments address and send v2.

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


[U-Boot] [PATCH] test/py: make each unit test a pytest

2016-01-28 Thread Stephen Warren
From: Stephen Warren 

A custom fixture named ut_subtest is implemented which is parametrized
with the names of all unit tests that the U-Boot binary supports. This
causes each U-Boot unit test to be exposes as a separate pytest. In turn,
this allows more fine-grained pass/fail counts and test selection, e.g.:

test.py --bd sandbox -k ut_dm_usb

... will run about 8 tests at present.

Signed-off-by: Stephen Warren 
---
This depends on at least my recently sent "test/py: run C-based unit tests".

 test/py/conftest.py  | 105 ---
 test/py/tests/test_ut.py |  14 +++
 2 files changed, 86 insertions(+), 33 deletions(-)

diff --git a/test/py/conftest.py b/test/py/conftest.py
index 3e162cafcc4a..05491a2453c0 100644
--- a/test/py/conftest.py
+++ b/test/py/conftest.py
@@ -21,7 +21,9 @@ import pexpect
 import pytest
 from _pytest.runner import runtestprotocol
 import ConfigParser
+import re
 import StringIO
+import subprocess
 import sys
 
 # Globals: The HTML log file, and the connection to the U-Boot console.
@@ -189,8 +191,43 @@ def pytest_configure(config):
 import u_boot_console_exec_attach
 console = u_boot_console_exec_attach.ConsoleExecAttach(log, ubconfig)
 
-def pytest_generate_tests(metafunc):
-"""pytest hook: parameterize test functions based on custom rules.
+re_ut_test_list = 
re.compile(r'_u_boot_list_2_(dm|env)_test_2_\1_test_(.*)\s*$')
+def generate_ut_subtest(metafunc, fixture_name):
+"""Provide parametrization for a ut_subtest fixture.
+
+Determines the set of unit tests built into a U-Boot binary by parsing the
+list of symbols present in the U-Boot binary. Provides this information to
+test functions by parameterizing their ut_subtest fixture parameter.
+
+Args:
+metafunc: The pytest test function.
+fixture_name: The fixture name to test.
+
+Returns:
+Nothing.
+"""
+
+# This does rely on an objdump binary, but that's quite likely to be
+# present. This approach trivially takes care of any source or Makefile-
+# level conditional compilation which may occur, and matches the test
+# execution order of a plain "ut dm" command. A source-scanning approach
+# would not do neither. This approach also doesn't require access to the
+# U-Boot source tree when running tests.
+
+cmd = 'objdump -t "%s" | sort' % (console.config.build_dir + '/u-boot')
+out = subprocess.check_output(cmd, shell=True)
+vals = []
+for l in out.splitlines():
+m = re_ut_test_list.search(l)
+if not m:
+continue
+vals.append(m.group(1) + ' ' + m.group(2))
+
+ids = ['ut_' + s.replace(' ', '_') for s in vals]
+metafunc.parametrize(fixture_name, vals, ids=ids)
+
+def generate_config(metafunc, fixture_name):
+"""Provide parametrization for {env,brd}__ fixtures.
 
 If a test function takes parameter(s) (fixture names) of the form brd__xxx
 or env__xxx, the brd and env configuration dictionaries are consulted to
@@ -199,6 +236,7 @@ def pytest_generate_tests(metafunc):
 
 Args:
 metafunc: The pytest test function.
+fixture_name: The fixture name to test.
 
 Returns:
 Nothing.
@@ -208,30 +246,49 @@ def pytest_generate_tests(metafunc):
 'brd': console.config.brd,
 'env': console.config.env,
 }
+parts = fixture_name.split('__')
+if len(parts) < 2:
+return
+if parts[0] not in subconfigs:
+return
+subconfig = subconfigs[parts[0]]
+vals = []
+val = subconfig.get(fixture_name, [])
+# If that exact name is a key in the data source:
+if val:
+# ... use the dict value as a single parameter value.
+vals = (val, )
+else:
+# ... otherwise, see if there's a key that contains a list of
+# values to use instead.
+vals = subconfig.get(fixture_name+ 's', [])
+def fixture_id(index, val):
+try:
+return val['fixture_id']
+except:
+return fixture_name + str(index)
+ids = [fixture_id(index, val) for (index, val) in enumerate(vals)]
+metafunc.parametrize(fixture_name, vals, ids=ids)
+
+def pytest_generate_tests(metafunc):
+"""pytest hook: parameterize test functions based on custom rules.
+
+Check each test function parameter (fixture name) to see if it is one of
+our custom names, and if so, provide the correct parametrization for that
+parameter.
+
+Args:
+metafunc: The pytest test function.
+
+Returns:
+Nothing.
+"""
+
 for fn in metafunc.fixturenames:
-parts = fn.split('__')
-if len(parts) < 2:
+if fn == 'ut_subtest':
+generate_ut_subtest(metafunc, fn)
 continue
-if parts[0] not in subconfigs:
-continue
-subconfig = subconfigs[parts[0]]
-vals = []
-val = subconfig.get(fn, [])

Re: [U-Boot] ARMv8: Use U-Boot to boot Xen?

2016-01-28 Thread Simon Glass
Hi Dirk,

On 28 January 2016 at 12:06, Dirk Behme  wrote:
>
> Hi,
>
> are there any U-Boot examples/patches to boot Xen on an ARMv8/aarch64 system?
>
> I've found
>
> http://lists.denx.de/pipermail/u-boot/2015-October/230077.html
>
> what might be helpful.
>
> But maybe I missed anything else?

I'm aware of these:

http://lists.denx.de/pipermail/u-boot/2015-April/211789.html

http://events.linuxfoundation.org/sites/events/files/slides/U-Boot%20FIT%20for%20Xen.pdf

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

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


[U-Boot] [PATCH V2 1/3] imx: mx7dsabresd: move mmc_get_env_devno to soc code

2016-01-28 Thread Peng Fan
From: Peng Fan 

Move mmc_get_env_devno to soc.c and rename to mmc_get_env_dev to
match the one in common/env_mmc.c.
Introduce a weak function board_mmc_get_env_dev. Different
boards can implement this according to sdhc controller which
is used by the board.

Signed-off-by: Peng Fan 
Cc: Stefano Babic 
---

V2:
 Use CONFIG_ENV_IS_IN_MMC to wrap soc code.
 Since mmc_get_env_dev already upstreamed by this commit:
 "
 commit e92029c0f4e88ae3e738d83b25ef2d3c178ea082
 Author: Clemens Gruber 
 Date:   Wed Jan 20 15:43:37 2016 +0100

 env_mmc: support overriding mmc dev from board code
 "
 I discard the V1 2/4 patch in my patch set.

 This patch set depends on https://patchwork.ozlabs.org/patch/573336/

 arch/arm/cpu/armv7/mx7/soc.c  | 21 +
 board/freescale/mx7dsabresd/mx7dsabresd.c | 20 +---
 2 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
index ede7d53..ba6cfb9 100644
--- a/arch/arm/cpu/armv7/mx7/soc.c
+++ b/arch/arm/cpu/armv7/mx7/soc.c
@@ -388,6 +388,27 @@ enum boot_device get_boot_device(void)
return boot_dev;
 }
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+__weak int board_mmc_get_env_dev(int devno)
+{
+   return CONFIG_SYS_MMC_ENV_DEV;
+}
+
+int mmc_get_env_dev(void)
+{
+   struct bootrom_sw_info **p =
+   (struct bootrom_sw_info **)ROM_SW_INFO_ADDR;
+   int devno = (*p)->boot_dev_instance;
+   u8 boot_type = (*p)->boot_dev_type;
+
+   /* If not boot from sd/mmc, use default value */
+   if ((boot_type != BOOT_TYPE_SD) && (boot_type != BOOT_TYPE_MMC))
+   return CONFIG_SYS_MMC_ENV_DEV;
+
+   return board_mmc_get_env_dev(devno);
+}
+#endif
+
 void s_init(void)
 {
 #if !defined CONFIG_SPL_BUILD
diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c 
b/board/freescale/mx7dsabresd/mx7dsabresd.c
index bbcc5bb..20e56f2 100644
--- a/board/freescale/mx7dsabresd/mx7dsabresd.c
+++ b/board/freescale/mx7dsabresd/mx7dsabresd.c
@@ -328,22 +328,12 @@ static struct fsl_esdhc_cfg usdhc_cfg[3] = {
{USDHC3_BASE_ADDR},
 };
 
-static int mmc_get_env_devno(void)
+int board_mmc_get_env_dev(int devno)
 {
-   struct bootrom_sw_info **p =
-   (struct bootrom_sw_info **)ROM_SW_INFO_ADDR;
+   if (devno == 2)
+   devno--;
 
-   u8 boot_type = (*p)->boot_dev_type;
-   u8 dev_no = (*p)->boot_dev_instance;
-
-   /* If not boot from sd/mmc, use default value */
-   if ((boot_type != BOOT_TYPE_SD) && (boot_type != BOOT_TYPE_MMC))
-   return CONFIG_SYS_MMC_ENV_DEV;
-
-   if (dev_no == 2)
-   dev_no--;
-
-   return dev_no;
+   return devno;
 }
 
 static int mmc_map_to_kernel_blk(int dev_no)
@@ -432,7 +422,7 @@ static void mmc_late_init(void)
 {
char cmd[32];
char mmcblk[32];
-   u32 dev_no = mmc_get_env_devno();
+   u32 dev_no = mmc_get_env_dev();
 
if (!check_mmc_autodetect())
return;
-- 
2.6.2

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


[U-Boot] [PATCH V2 3/3] imx: mx6: implement board_mmc_get_env_dev

2016-01-28 Thread Peng Fan
From: Peng Fan 

Implement board_mmc_get_env_dev for the boards.

Following is examples:
SD1/SD2/SD3: return devno;
SD2/SD3: return devno - 1;
SD2/SD4: if (devno == 2), return dev - 2; return dev - 1;

Signed-off-by: Peng Fan 
Cc: Stefano Babic 
---

V2:
 no change

 board/freescale/mx6qarm2/mx6qarm2.c | 5 +
 board/freescale/mx6sabresd/mx6sabresd.c | 5 +
 board/freescale/mx6slevk/mx6slevk.c | 5 +
 board/freescale/mx6sxsabresd/mx6sxsabresd.c | 5 +
 4 files changed, 20 insertions(+)

diff --git a/board/freescale/mx6qarm2/mx6qarm2.c 
b/board/freescale/mx6qarm2/mx6qarm2.c
index 98ccdb7..5aae721 100644
--- a/board/freescale/mx6qarm2/mx6qarm2.c
+++ b/board/freescale/mx6qarm2/mx6qarm2.c
@@ -110,6 +110,11 @@ struct fsl_esdhc_cfg usdhc_cfg[2] = {
{USDHC4_BASE_ADDR},
 };
 
+int board_mmc_get_env_dev(int devno)
+{
+   return devno - 2;
+}
+
 int board_mmc_getcd(struct mmc *mmc)
 {
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c 
b/board/freescale/mx6sabresd/mx6sabresd.c
index d20953d..4af0e3e 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -235,6 +235,11 @@ struct fsl_esdhc_cfg usdhc_cfg[3] = {
 #define USDHC2_CD_GPIO IMX_GPIO_NR(2, 2)
 #define USDHC3_CD_GPIO IMX_GPIO_NR(2, 0)
 
+int board_mmc_get_env_dev(int devno)
+{
+   return devno - 1;
+}
+
 int board_mmc_getcd(struct mmc *mmc)
 {
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
diff --git a/board/freescale/mx6slevk/mx6slevk.c 
b/board/freescale/mx6slevk/mx6slevk.c
index 5eab4b5..295b781 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -170,6 +170,11 @@ static struct fsl_esdhc_cfg usdhc_cfg[3] = {
{USDHC3_BASE_ADDR, 0, 4},
 };
 
+int board_mmc_get_env_dev(int devno)
+{
+   return devno;
+}
+
 int board_mmc_getcd(struct mmc *mmc)
 {
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c 
b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index 56dc020..0c664b5 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -313,6 +313,11 @@ static struct fsl_esdhc_cfg usdhc_cfg[3] = {
 #define USDHC3_PWR_GPIOIMX_GPIO_NR(2, 11)
 #define USDHC4_CD_GPIO IMX_GPIO_NR(6, 21)
 
+int board_mmc_get_env_dev(int devno)
+{
+   return devno - 1;
+}
+
 int board_mmc_getcd(struct mmc *mmc)
 {
struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-- 
2.6.2

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


[U-Boot] [PATCH V2 2/3] imx: mx6: implement mmc_get_env_dev

2016-01-28 Thread Peng Fan
From: Peng Fan 

Implement mmc_get_env_dev, devno can be got from smbr1 of SRC.
Introduce a weak function board_mmc_get_env_dev, different
boards can implement it according to different sdhc controllers
that used by the board.

Signed-off-by: Peng Fan 
Cc: Stefano Babic 
---

V2:
 Use CONFIG_ENV_IS_IN_MMC to wrap code

 arch/arm/cpu/armv7/mx6/soc.c | 32 
 1 file changed, 32 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index ab0ccb0..80a4828 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -349,6 +349,38 @@ int arch_cpu_init(void)
return 0;
 }
 
+#ifdef CONFIG_ENV_IS_IN_MMC
+__weak int board_mmc_get_env_dev(int devno)
+{
+   return CONFIG_SYS_MMC_ENV_DEV;
+}
+
+int mmc_get_env_dev(void)
+{
+   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+   u32 soc_sbmr = readl(_regs->sbmr1);
+   u32 bootsel;
+   int devno;
+
+   /*
+* Refer to
+* "i.MX 6Dual/6Quad Applications Processor Reference Manual"
+* Chapter "8.5.3.1 Expansion Device eFUSE Configuration"
+* i.MX6SL/SX/UL has same layout.
+*/
+   bootsel = (soc_sbmr & 0x00FF) >> 6;
+
+   /* If not boot from sd/mmc, use default value */
+   if (bootsel != 1)
+   return CONFIG_SYS_MMC_ENV_DEV;
+
+   /* BOOT_CFG2[3] and BOOT_CFG2[4] */
+   devno = (soc_sbmr & 0x1800) >> 11;
+
+   return board_mmc_get_env_dev(devno);
+}
+#endif
+
 int board_postclk_init(void)
 {
set_ldo_voltage(LDO_SOC, 1175); /* Set VDDSOC to 1.175V */
-- 
2.6.2

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


Re: [U-Boot] [PATCH 0/7] fdt: Replace u-boot-dtb.bin with u-boot.bin

2016-01-28 Thread Hans de Goede

Hi,

On 28-01-16 04:58, Simon Glass wrote:

Hi Hans,

On 25 January 2016 at 13:30, Simon Glass  wrote:


At present u-boot.bin holds the plain U-Boot binary without the device tree.
This is somewhat annoying since you need either u-boot.bin or u-boot-dtb.bin
depending on whether device tree is used.

This series adjusts the build such that u-boot.bin includes a device tree,
and the plain binary is in u-boot-nodtb.bin. For now u-boot-dtb.bin remains
the same.

This should be acceptable since:

- without OF_CONTROL, u-boot.bin still does not include a device tree
- with OF_CONTROL, u-boot-dtb.bin does not change

The main impact is build systems which are set up to use u-boot.bin as
the output file and then add a device tree. These will have to change to use
u-boot-nodtb.bin instead.

The original decision to use a separate u-boot-dtb.bin was aimed at allowing
any device tree file to be concatenated to the u-boot.bin image after the
build. However this no-longer seems so important. More important is the
convenience of using the same output file regardless of the setting for
OF_CONTROL.


Do you have any comments on this series please?


I'm fine with this series, all normal sunxi use-cases use 
u-boot-sunxi-with-spl.bin
which is generated like this:

ifneq ($(CONFIG_SUNXI),)
OBJCOPYFLAGS_u-boot-sunxi-with-spl.bin = -I binary -O binary \
   --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff
u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin \
u-boot$(if $(CONFIG_OF_CONTROL),-dtb,).img FORCE
$(call if_changed,pad_cat)
endif

Which should stay working just fine, although it might be slightly
simplified after your patch to simply always use u-boot.img.

sunxi spl does not use a dtb, so nothing should change there.

Regards,

Hans







Simon Glass (7):
   tegra: Drop generation of -nodtb file with OF_CONTROL
   fdt: Build a U-Boot binary without device tree
   fdt: Build an SPL binary without device tree
   tegra: Always build a boot image with the same filename
   socfpga: Simplify Makefile filenames
   Makefile: Make u-boot.img the same as u-boot-dtb.img
   Makefile: Drop unnecessary -dtb suffixes

  Makefile | 67 ++--
  scripts/Makefile.spl | 26 +---
  2 files changed, 50 insertions(+), 43 deletions(-)

--
2.7.0.rc3.207.g0ac5344



Regards,
Simon


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


Re: [U-Boot] [PATCH v2] armv7: add cacheline sizes where missing

2016-01-28 Thread Albert ARIBAUD
On Wed, 27 Jan 2016 08:46:11 +0100, Albert ARIBAUD
 wrote:
> Some armv7 targets are missing a cache line size declaration.
> In preparation for "arm: cache: Implement cache range check for v7"
> patch, add these declarations with the appropriate value for
> the target's SoC or CPU.
> 
> Signed-off-by: Albert ARIBAUD 
> ---
> 
> Changes in v2:
> - fix include/configs/at91-sama5_common.h (Cortex-A5: 32 bytes)

Absent any complaint today, I will apply this as a prerequisite for
Marek's "arm: cache: Implement cache range check for v7".

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


[U-Boot] [PATCH V2 04/11] imx: mx7d: Add RDC support

2016-01-28 Thread Peng Fan
From: Peng Fan 

Add the peripherals/masters definitions and registers base addresses
for mx7d RDC.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
 no change

 arch/arm/include/asm/arch-mx7/imx-rdc.h  |  16 +++
 arch/arm/include/asm/arch-mx7/imx-regs.h |   3 +
 arch/arm/include/asm/arch-mx7/mx7d_rdc.h | 163 +++
 3 files changed, 182 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-mx7/imx-rdc.h
 create mode 100644 arch/arm/include/asm/arch-mx7/mx7d_rdc.h

diff --git a/arch/arm/include/asm/arch-mx7/imx-rdc.h 
b/arch/arm/include/asm/arch-mx7/imx-rdc.h
new file mode 100644
index 000..dbeed56
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx7/imx-rdc.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:  GPL-2.0+
+ */
+
+#ifndef __IMX_RDC_H__
+#define __IMX_RDC_H__
+
+#if defined(CONFIG_MX7D)
+#include "mx7d_rdc.h"
+#else
+#error "Please select cpu"
+#endif /* CONFIG_MX7D */
+
+#endif /* __IMX_RDC_H__*/
diff --git a/arch/arm/include/asm/arch-mx7/imx-regs.h 
b/arch/arm/include/asm/arch-mx7/imx-regs.h
index 58a25c7..8e66d3d 100644
--- a/arch/arm/include/asm/arch-mx7/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx7/imx-regs.h
@@ -212,6 +212,9 @@
 #define DEBUG_MONITOR_BASE_ADDR IP2APB_AXIMON_IPS_BASE_ADDR
 
 #define USB_BASE_ADDR USBOTG1_IPS_BASE_ADDR
+#define SEMAPHORE1_BASE_ADDR SEMA41_IPS_BASE_ADDR
+#define SEMAPHORE2_BASE_ADDR SEMA42_IPS_BASE_ADDR
+#define RDC_BASE_ADDR RDC_IPS_BASE_ADDR
 
 #define FEC_QUIRK_ENET_MAC
 #define SNVS_LPGPR 0x68
diff --git a/arch/arm/include/asm/arch-mx7/mx7d_rdc.h 
b/arch/arm/include/asm/arch-mx7/mx7d_rdc.h
new file mode 100644
index 000..9073cbd
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx7/mx7d_rdc.h
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:  GPL-2.0+
+ */
+
+#ifndef __MX7D_RDC_H__
+#define __MX7D_RDC_H__
+
+#define RDC_SEMA_PROC_ID 2  /* The processor ID for main CPU */
+
+enum {
+   RDC_PER_GPIO1 = 0,
+   RDC_PER_GPIO2,
+   RDC_PER_GPIO3,
+   RDC_PER_GPIO4,
+   RDC_PER_GPIO5,
+   RDC_PER_GPIO6,
+   RDC_PER_GPIO7,
+   RDC_PER_IOMUXC_LPSR_GPR,
+   RDC_PER_WDOG1,
+   RDC_PER_WDOG2,
+   RDC_PER_WDOG3,
+   RDC_PER_WDOG4,
+   RDC_PER_IOMUXC_LPSR,
+   RDC_PER_GPT1,
+   RDC_PER_GPT2,
+   RDC_PER_GPT3,
+   RDC_PER_GPT4,
+   RDC_PER_ROMCP,
+   RDC_PER_KPP,
+   RDC_PER_IOMUXC,
+   RDC_PER_IOMUXCGPR,
+   RDC_PER_OCOTP,
+   RDC_PER_ANATOP_DIG,
+   RDC_PER_SNVS_HP,
+   RDC_PER_CCM,
+   RDC_PER_SRC,
+   RDC_PER_GPC,
+   RDC_PER_SEMA1,
+   RDC_PER_SEMA2,
+   RDC_PER_RDC,
+   RDC_PER_CSU,
+   RDC_PER_RESERVED1,
+   RDC_PER_RESERVED2,
+   RDC_PER_ADC1,
+   RDC_PER_ADC2,
+   RDC_PER_ECSPI4,
+   RDC_PER_FLEX_TIMER1,
+   RDC_PER_FLEX_TIMER2,
+   RDC_PER_PWM1,
+   RDC_PER_PWM2,
+   RDC_PER_PWM3,
+   RDC_PER_PWM4,
+   RDC_PER_SYSTEM_COUNTER_READ,
+   RDC_PER_SYSTEM_COUNTER_COMPARE,
+   RDC_PER_SYSTEM_COUNTER_CONTROL,
+   RDC_PER_PCIE_PHY,
+   RDC_PER_RESERVED3,
+   RDC_PER_EPDC,
+   RDC_PER_PXP,
+   RDC_PER_CSI,
+   RDC_PER_RESERVED4,
+   RDC_PER_LCDIF,
+   RDC_PER_RESERVED5,
+   RDC_PER_MIPI_CSI,
+   RDC_PER_MIPI_DSI,
+   RDC_PER_RESERVED6,
+   RDC_PER_TZASC,
+   RDC_PER_DDR_PHY,
+   RDC_PER_DDRC,
+   RDC_PER_RESERVED7,
+   RDC_PER_PERFMON1,
+   RDC_PER_PERFMON2,
+   RDC_PER_AXI_DEBUG_MON,
+   RDC_PER_QOSC,
+   RDC_PER_FLEXCAN1,
+   RDC_PER_FLEXCAN2,
+   RDC_PER_I2C1,
+   RDC_PER_I2C2,
+   RDC_PER_I2C3,
+   RDC_PER_I2C4,
+   RDC_PER_UART4,
+   RDC_PER_UART5,
+   RDC_PER_UART6,
+   RDC_PER_UART7,
+   RDC_PER_MU_A,
+   RDC_PER_MU_B,
+   RDC_PER_SEMAPHORE_HS,
+   RDC_PER_USB_PL301,
+   RDC_PER_RESERVED8,
+   RDC_PER_RESERVED9,
+   RDC_PER_RESERVED10,
+   RDC_PER_USB1,
+   RDC_PER_USB2,
+   RDC_PER_USB3,
+   RDC_PER_USDHC1,
+   RDC_PER_USDHC2,
+   RDC_PER_USDHC3,
+   RDC_PER_RESERVED11,
+   RDC_PER_RESERVED12,
+   RDC_PER_SIM1,
+   RDC_PER_SIM2,
+   RDC_PER_QSPI,
+   RDC_PER_WEIM,
+   RDC_PER_SDMA,
+   RDC_PER_ENET1,
+   RDC_PER_ENET2,
+   RDC_PER_RESERVED13,
+   RDC_PER_RESERVED14,
+   RDC_PER_ECSPI1,
+   RDC_PER_ECSPI2,
+   RDC_PER_ECSPI3,
+   RDC_PER_RESERVED15,
+   RDC_PER_UART1,
+   RDC_PER_UART2,
+   RDC_PER_UART3,
+   RDC_PER_RESERVED16,
+   RDC_PER_SAI1,
+   RDC_PER_SAI2,
+   RDC_PER_SAI3,
+   RDC_PER_RESERVED17,
+   RDC_PER_RESERVED18,
+   RDC_PER_SPBA,
+   RDC_PER_DAP,
+   RDC_PER_RESERVED19,
+   RDC_PER_RESERVED20,
+   RDC_PER_RESERVED21,
+   RDC_PER_CAAM,
+   RDC_PER_RESERVED22,
+};
+
+enum {
+  

[U-Boot] [PATCH V2 05/11] imx: mx7d: clock support for RDC

2016-01-28 Thread Peng Fan
From: Peng Fan 

If CONFIG_IMX_RDC is enabled, enable clock for RDC and SEMAPHORE.

Signed-off-by: Peng Fan 
---

V2: no change

 arch/arm/cpu/armv7/mx7/clock.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx7/clock.c b/arch/arm/cpu/armv7/mx7/clock.c
index 77db6e8..4d68ad2 100644
--- a/arch/arm/cpu/armv7/mx7/clock.c
+++ b/arch/arm/cpu/armv7/mx7/clock.c
@@ -1067,6 +1067,12 @@ void clock_init(void)
 #ifdef CONFIG_NAND_MXS
clock_enable(CCGR_RAWNAND, 1);
 #endif
+
+   if (IS_ENABLED(CONFIG_IMX_RDC)) {
+   clock_enable(CCGR_RDC, 1);
+   clock_enable(CCGR_SEMA1, 1);
+   clock_enable(CCGR_SEMA2, 1);
+   }
 }
 
 #ifdef CONFIG_SECURE_BOOT
-- 
2.6.2

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


[U-Boot] [PATCH V2 06/11] imx: imx-common: introduce boot auxiliary core

2016-01-28 Thread Peng Fan
From: Peng Fan 

To boot a auxiliary core in asymmetric multicore system, introduce the
new command "bootaux" to do it. Example of boot auxliary core from
0x7000 where stores the boot head information that should be
parsed by auxiliary core, "bootaux 0x7000".
Introduce Kconfig option IMX_BOOTAUX.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
  add more comments for bootaux command

 arch/arm/imx-common/Kconfig   |  6 
 arch/arm/imx-common/Makefile  |  1 +
 arch/arm/imx-common/imx_bootaux.c | 72 +++
 3 files changed, 79 insertions(+)
 create mode 100644 arch/arm/imx-common/imx_bootaux.c

diff --git a/arch/arm/imx-common/Kconfig b/arch/arm/imx-common/Kconfig
index c4f48bb..1b7da5a 100644
--- a/arch/arm/imx-common/Kconfig
+++ b/arch/arm/imx-common/Kconfig
@@ -11,3 +11,9 @@ config IMX_RDC
  i.MX Resource domain controller is used to assign masters
  and peripherals to differet domains. This can be used to
  isolate resources.
+
+config IMX_BOOTAUX
+   bool "Support boot auxiliary core"
+   depends on ARCH_MX7 || ARCH_MX6
+   help
+ bootaux [addr] to boot auxiliary core.
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index 568f41c..30e66ba 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -28,6 +28,7 @@ obj-y += cache.o init.o
 obj-$(CONFIG_CMD_SATA) += sata.o
 obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
 obj-$(CONFIG_IMX_RDC) += rdc-sema.o
+obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o
 obj-$(CONFIG_SECURE_BOOT)+= hab.o
 endif
 ifeq ($(SOC),$(filter $(SOC),vf610))
diff --git a/arch/arm/imx-common/imx_bootaux.c 
b/arch/arm/imx-common/imx_bootaux.c
new file mode 100644
index 000..69026df
--- /dev/null
+++ b/arch/arm/imx-common/imx_bootaux.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+
+/* Allow for arch specific config before we boot */
+static int __arch_auxiliary_core_up(u32 core_id, u32 boot_private_data)
+{
+   /* please define platform specific arch_auxiliary_core_up() */
+   return CMD_RET_FAILURE;
+}
+
+int arch_auxiliary_core_up(u32 core_id, u32 boot_private_data)
+   __attribute__((weak, alias("__arch_auxiliary_core_up")));
+
+/* Allow for arch specific config before we boot */
+static int __arch_auxiliary_core_check_up(u32 core_id)
+{
+   /* please define platform specific arch_auxiliary_core_check_up() */
+   return 0;
+}
+
+int arch_auxiliary_core_check_up(u32 core_id)
+   __attribute__((weak, alias("__arch_auxiliary_core_check_up")));
+
+/*
+ * To i.MX6SX and i.MX7D, the image supported by bootaux needs
+ * the reset vector at the head for the image, with SP and PC
+ * as the first two words.
+ *
+ * Per the cortex-M reference manual, the reset vector of M4 needs
+ * to exist at 0x0 (TCMUL). The PC and SP are the first two addresses
+ * of that vector.  So to boot M4, the A core must build the M4's reset
+ * vector with getting the PC and SP from image and filling them to
+ * TCMUL. When M4 is kicked, it will load the PC and SP by itself.
+ * The TCMUL is mapped to (M4_BOOTROM_BASE_ADDR) at A core side for
+ * accessing the M4 TCMUL.
+ */
+int do_bootaux(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   ulong addr;
+   int ret, up;
+
+   if (argc < 2)
+   return CMD_RET_USAGE;
+
+   up = arch_auxiliary_core_check_up(0);
+   if (up) {
+   printf("## Auxiliary core is already up\n");
+   return CMD_RET_SUCCESS;
+   }
+
+   addr = simple_strtoul(argv[1], NULL, 16);
+
+   printf("## Starting auxiliary core at 0x%08lX ...\n", addr);
+
+   ret = arch_auxiliary_core_up(0, addr);
+   if (ret)
+   return CMD_RET_FAILURE;
+
+   return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(
+   bootaux, CONFIG_SYS_MAXARGS, 1, do_bootaux,
+   "Start auxiliary core",
+   ""
+);
-- 
2.6.2

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


[U-Boot] [PATCH V2 09/11] imx: mx7: implement functions to boot auxiliary core

2016-01-28 Thread Peng Fan
From: Peng Fan 

Implement arch_auxiliary_core_up and arch_auxiliary_core_check_up.

arch_auxiliary_core_check_up is used to check whether M4 is running
or not. arch_auxiliary_core_up is to boot M4 core, the m4 core will
use the pc and stack which is set in arch_auxiliary_core_up to set R15
and R13 register and boot.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
 no change

 arch/arm/cpu/armv7/mx7/soc.c | 36 
 arch/arm/include/asm/arch-mx7/imx-regs.h |  5 +
 2 files changed, 41 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
index 1d8e470..2121ff2 100644
--- a/arch/arm/cpu/armv7/mx7/soc.c
+++ b/arch/arm/cpu/armv7/mx7/soc.c
@@ -211,6 +211,42 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 }
 #endif
 
+#ifdef CONFIG_IMX_BOOTAUX
+int arch_auxiliary_core_up(u32 core_id, u32 boot_private_data)
+{
+   u32 stack, pc;
+   struct src *src_reg = (struct src *)SRC_BASE_ADDR;
+
+   if (!boot_private_data)
+   return 1;
+
+   stack = *(u32 *)boot_private_data;
+   pc = *(u32 *)(boot_private_data + 4);
+
+   /* Set the stack and pc to M4 bootROM */
+   writel(stack, M4_BOOTROM_BASE_ADDR);
+   writel(pc, M4_BOOTROM_BASE_ADDR + 4);
+
+   /* Enable M4 */
+   clrsetbits_le32(_reg->m4rcr, SRC_M4RCR_M4C_NON_SCLR_RST_MASK,
+   SRC_M4RCR_ENABLE_M4_MASK);
+
+   return 0;
+}
+
+int arch_auxiliary_core_check_up(u32 core_id)
+{
+   uint32_t val;
+   struct src *src_reg = (struct src *)SRC_BASE_ADDR;
+
+   val = readl(_reg->m4rcr);
+   if (val & 0x0001)
+   return 0; /* assert in reset */
+
+   return 1;
+}
+#endif
+
 void set_wdog_reset(struct wdog_regs *wdog)
 {
u32 reg = readw(>wcr);
diff --git a/arch/arm/include/asm/arch-mx7/imx-regs.h 
b/arch/arm/include/asm/arch-mx7/imx-regs.h
index 8e66d3d..5253b1e 100644
--- a/arch/arm/include/asm/arch-mx7/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx7/imx-regs.h
@@ -260,6 +260,11 @@ struct src {
u32 ddrc_rcr;
 };
 
+#define SRC_M4RCR_M4C_NON_SCLR_RST_OFFSET  0
+#define SRC_M4RCR_M4C_NON_SCLR_RST_MASK(1 << 0)
+#define SRC_M4RCR_ENABLE_M4_OFFSET 3
+#define SRC_M4RCR_ENABLE_M4_MASK   (1 << 3)
+
 /* GPR0 Bit Fields */
 #define IOMUXC_GPR_GPR0_DMAREQ_MUX_SEL0_MASK 0x1u
 #define IOMUXC_GPR_GPR0_DMAREQ_MUX_SEL0_SHIFT0
-- 
2.6.2

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


[U-Boot] [PATCH V2 07/11] imx: mx6: implement functions to boot auxiliary core

2016-01-28 Thread Peng Fan
From: Peng Fan 

Implement arch_auxiliary_core_up and arch_auxiliary_core_check_up.

arch_auxiliary_core_check_up is used to check whether M4 is running
or not. arch_auxiliary_core_up is to boot M4 core, the m4 core will
use the pc and stack which is set in arch_auxiliary_core_up to set R15
and R13 register and boot.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
 no change

 arch/arm/cpu/armv7/mx6/soc.c | 38 
 arch/arm/include/asm/arch-mx6/imx-regs.h |  5 +
 2 files changed, 43 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index bf5ae8c..ab0ccb0 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -491,3 +491,41 @@ void imx_setup_hdmi(void)
writel(reg, _ccm->chsccdr);
 }
 #endif
+
+#ifdef CONFIG_IMX_BOOTAUX
+int arch_auxiliary_core_up(u32 core_id, u32 boot_private_data)
+{
+   struct src *src_reg;
+   u32 stack, pc;
+
+   if (!boot_private_data)
+   return -EINVAL;
+
+   stack = *(u32 *)boot_private_data;
+   pc = *(u32 *)(boot_private_data + 4);
+
+   /* Set the stack and pc to M4 bootROM */
+   writel(stack, M4_BOOTROM_BASE_ADDR);
+   writel(pc, M4_BOOTROM_BASE_ADDR + 4);
+
+   /* Enable M4 */
+   src_reg = (struct src *)SRC_BASE_ADDR;
+   clrsetbits_le32(_reg->scr, SRC_SCR_M4C_NON_SCLR_RST_MASK,
+   SRC_SCR_M4_ENABLE_MASK);
+
+   return 0;
+}
+
+int arch_auxiliary_core_check_up(u32 core_id)
+{
+   struct src *src_reg = (struct src *)SRC_BASE_ADDR;
+   unsigned val;
+
+   val = readl(_reg->scr);
+
+   if (val & SRC_SCR_M4C_NON_SCLR_RST_MASK)
+   return 0;  /* assert in reset */
+
+   return 1;
+}
+#endif
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index b1de751..f5ce31c 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -438,6 +438,11 @@ struct src {
u32 gpr10;
 };
 
+#define SRC_SCR_M4_ENABLE_OFFSET22
+#define SRC_SCR_M4_ENABLE_MASK  (1 << 22)
+#define SRC_SCR_M4C_NON_SCLR_RST_OFFSET 4
+#define SRC_SCR_M4C_NON_SCLR_RST_MASK   (1 << 4)
+
 /* GPR1 bitfields */
 #define IOMUXC_GPR1_APP_CLK_REQ_N  BIT(30)
 #define IOMUXC_GPR1_PCIE_EXIT_L1   BIT(28)
-- 
2.6.2

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


[U-Boot] [PATCH V2 08/11] imx: mx6sxsabresd: add command and macros for boot m4 core

2016-01-28 Thread Peng Fan
From: Peng Fan 

Introduce macros and command to support booting M4 core for
i.MX6SX SabreSD board.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
 no change

 include/configs/mx6sxsabresd.h | 24 
 1 file changed, 24 insertions(+)

diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index 0aec296..325e470 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -26,7 +26,31 @@
 #define CONFIG_MXC_UART
 #define CONFIG_MXC_UART_BASE   UART1_BASE
 
+#ifdef CONFIG_IMX_BOOTAUX
+/* Set to QSPI2 B flash at default */
+#define CONFIG_SYS_AUXCORE_BOOTDATA 0x7800
+#define CONFIG_CMD_SETEXPR
+
+#define UPDATE_M4_ENV \
+   "m4image=m4_qspi.bin\0" \
+   "loadm4image=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4image}\0" 
\
+   "update_m4_from_sd=" \
+   "if sf probe 1:0; then " \
+   "if run loadm4image; then " \
+   "setexpr fw_sz ${filesize} + 0x; " \
+   "setexpr fw_sz ${fw_sz} / 0x1; "\
+   "setexpr fw_sz ${fw_sz} * 0x1; "\
+   "sf erase 0x0 ${fw_sz}; " \
+   "sf write ${loadaddr} 0x0 ${filesize}; " \
+   "fi; " \
+   "fi\0" \
+   "m4boot=sf probe 1:0; bootaux 
"__stringify(CONFIG_SYS_AUXCORE_BOOTDATA)"\0"
+#else
+#define UPDATE_M4_ENV ""
+#endif
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
+   UPDATE_M4_ENV \
"script=boot.scr\0" \
"image=zImage\0" \
"console=ttymxc0\0" \
-- 
2.6.2

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


[U-Boot] [PATCH V2 11/11] imx: mx7d: isolate resources to domain 0 for A7 core

2016-01-28 Thread Peng Fan
From: Peng Fan 

In current design, if any peripheral was assigned to both A7 and M4,
it will receive ipg_stop or ipg_wait when any of the 2 platforms
enter low power mode. We will have a risk that, if A7 enter wait,
M4 enter stop, peripheral will have chance to get ipg_stop and ipg_wait
asserted same time. Also if M4 enters stop mode, A7 will have no
chance to access the peripheral.
There are 26 peripherals affected by this IC issue:
SIM2(sim2/emvsim2)
SIM1(sim1/emvsim1)
UART1/UART2/UART3/UART4/UART5/UART6/UART7
SAI1/SAI2/SAI3
WDOG1/WDOG2/WDOG3/WDOG4
GPT1/GPT2/GPT3/GPT4
PWM1/PWM2/PWM3/PWM4
ENET1/ENET2
Software Workaround:
The solution is to set the peripherals to Domain0 by A core, since A core
in Domain0. The peripherals which will be used by M4, will be set to Domain1
by M4.
For example, A core set WDOG4 to domain0, but when M4 boots up, M4 will
set WDOG4 to domain1, because M4 will use WDOG4.

So the peripherals are not shared by them. This way requires
the uboot implemented the RDC driver and set the 26 IPs above
to domain 0 only. M4 image will set the M4 to domain 1 and
set peripheral which it will use to domain 1.

This patch enables the CONFIG_IMX_RDC and CONFIG_IMX_BOOTAUX for
i.MX7D SABRESD board, and setup the 26 IP resources to domain 0.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
 update commit log

 arch/arm/cpu/armv7/mx7/soc.c  | 64 +++
 configs/mx7dsabresd_defconfig |  2 ++
 2 files changed, 66 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
index 2121ff2..ede7d53 100644
--- a/arch/arm/cpu/armv7/mx7/soc.c
+++ b/arch/arm/cpu/armv7/mx7/soc.c
@@ -12,6 +12,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -29,6 +31,65 @@ U_BOOT_DEVICE(imx7_thermal) = {
 };
 #endif
 
+#ifdef CONFIG_IMX_RDC
+/*
+ * In current design, if any peripheral was assigned to both A7 and M4,
+ * it will receive ipg_stop or ipg_wait when any of the 2 platforms enter
+ * low power mode. So M4 sleep will cause some peripherals fail to work
+ * at A7 core side. At default, all resources are in domain 0 - 3.
+ *
+ * There are 26 peripherals impacted by this IC issue:
+ * SIM2(sim2/emvsim2)
+ * SIM1(sim1/emvsim1)
+ * UART1/UART2/UART3/UART4/UART5/UART6/UART7
+ * SAI1/SAI2/SAI3
+ * WDOG1/WDOG2/WDOG3/WDOG4
+ * GPT1/GPT2/GPT3/GPT4
+ * PWM1/PWM2/PWM3/PWM4
+ * ENET1/ENET2
+ * Software Workaround:
+ * Here we setup some resources to domain 0 where M4 codes will move
+ * the M4 out of this domain. Then M4 is not able to access them any longer.
+ * This is a workaround for ic issue. So the peripherals are not shared
+ * by them. This way requires the uboot implemented the RDC driver and
+ * set the 26 IPs above to domain 0 only. M4 code will assign resource
+ * to its own domain, if it want to use the resource.
+ */
+static rdc_peri_cfg_t const resources[] = {
+   (RDC_PER_SIM1 | RDC_DOMAIN(0)),
+   (RDC_PER_SIM2 | RDC_DOMAIN(0)),
+   (RDC_PER_UART1 | RDC_DOMAIN(0)),
+   (RDC_PER_UART2 | RDC_DOMAIN(0)),
+   (RDC_PER_UART3 | RDC_DOMAIN(0)),
+   (RDC_PER_UART4 | RDC_DOMAIN(0)),
+   (RDC_PER_UART5 | RDC_DOMAIN(0)),
+   (RDC_PER_UART6 | RDC_DOMAIN(0)),
+   (RDC_PER_UART7 | RDC_DOMAIN(0)),
+   (RDC_PER_SAI1 | RDC_DOMAIN(0)),
+   (RDC_PER_SAI2 | RDC_DOMAIN(0)),
+   (RDC_PER_SAI3 | RDC_DOMAIN(0)),
+   (RDC_PER_WDOG1 | RDC_DOMAIN(0)),
+   (RDC_PER_WDOG2 | RDC_DOMAIN(0)),
+   (RDC_PER_WDOG3 | RDC_DOMAIN(0)),
+   (RDC_PER_WDOG4 | RDC_DOMAIN(0)),
+   (RDC_PER_GPT1 | RDC_DOMAIN(0)),
+   (RDC_PER_GPT2 | RDC_DOMAIN(0)),
+   (RDC_PER_GPT3 | RDC_DOMAIN(0)),
+   (RDC_PER_GPT4 | RDC_DOMAIN(0)),
+   (RDC_PER_PWM1 | RDC_DOMAIN(0)),
+   (RDC_PER_PWM2 | RDC_DOMAIN(0)),
+   (RDC_PER_PWM3 | RDC_DOMAIN(0)),
+   (RDC_PER_PWM4 | RDC_DOMAIN(0)),
+   (RDC_PER_ENET1 | RDC_DOMAIN(0)),
+   (RDC_PER_ENET2 | RDC_DOMAIN(0)),
+};
+
+static void isolate_resource(void)
+{
+   imx_rdc_setup_peripherals(resources, ARRAY_SIZE(resources));
+}
+#endif
+
 #if defined(CONFIG_SECURE_BOOT)
 struct imx_sec_config_fuse_t const imx_sec_config_fuse = {
.bank = 1,
@@ -163,6 +224,9 @@ int arch_cpu_init(void)
mxs_dma_init();
 #endif
 
+   if (IS_ENABLED(CONFIG_IMX_RDC))
+   isolate_resource();
+
return 0;
 }
 
diff --git a/configs/mx7dsabresd_defconfig b/configs/mx7dsabresd_defconfig
index 420d13e..1d262c1 100644
--- a/configs/mx7dsabresd_defconfig
+++ b/configs/mx7dsabresd_defconfig
@@ -1,6 +1,8 @@
 CONFIG_ARM=y
 CONFIG_ARCH_MX7=y
 CONFIG_TARGET_MX7DSABRESD=y
+CONFIG_IMX_RDC=y
+CONFIG_IMX_BOOTAUX=y
 
CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx7dsabresd/imximage.cfg,MX7D"
 # CONFIG_CMD_BOOTD is not set
 # CONFIG_CMD_IMI is not set
-- 
2.6.2

___
U-Boot mailing list
U-Boot@lists.denx.de

[U-Boot] [PATCH V2 10/11] imx: mx7dsabresd: add command and macros for boot m4 core

2016-01-28 Thread Peng Fan
From: Peng Fan 

Introduce macros and command to support booting M4 core for
i.MX7D SabreSD board.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
 no change

 include/configs/mx7dsabresd.h | 24 
 1 file changed, 24 insertions(+)

diff --git a/include/configs/mx7dsabresd.h b/include/configs/mx7dsabresd.h
index d23e4f3..2c981e0 100644
--- a/include/configs/mx7dsabresd.h
+++ b/include/configs/mx7dsabresd.h
@@ -57,6 +57,29 @@
 #define CONFIG_SUPPORT_EMMC_BOOT   /* eMMC specific */
 #define CONFIG_SYS_MMC_IMG_LOAD_PART   1
 
+#ifdef CONFIG_IMX_BOOTAUX
+/* Set to QSPI1 A flash at default */
+#define CONFIG_SYS_AUXCORE_BOOTDATA 0x6000
+#define CONFIG_CMD_SETEXPR
+
+#define UPDATE_M4_ENV \
+   "m4image=m4_qspi.bin\0" \
+   "loadm4image=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${m4image}\0" 
\
+   "update_m4_from_sd=" \
+   "if sf probe 0:0; then " \
+   "if run loadm4image; then " \
+   "setexpr fw_sz ${filesize} + 0x; " \
+   "setexpr fw_sz ${fw_sz} / 0x1; "\
+   "setexpr fw_sz ${fw_sz} * 0x1; "\
+   "sf erase 0x0 ${fw_sz}; " \
+   "sf write ${loadaddr} 0x0 ${filesize}; " \
+   "fi; " \
+   "fi\0" \
+   "m4boot=sf probe 0:0; bootaux 
"__stringify(CONFIG_SYS_AUXCORE_BOOTDATA)"\0"
+#else
+#define UPDATE_M4_ENV ""
+#endif
+
 #define CONFIG_MFG_ENV_SETTINGS \
"mfgtool_args=setenv bootargs console=${console},${baudrate} " \
"rdinit=/linuxrc " \
@@ -76,6 +99,7 @@
"rootfs part 0 2\0" \
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
+   UPDATE_M4_ENV \
CONFIG_MFG_ENV_SETTINGS \
CONFIG_DFU_ENV_SETTINGS \
"script=boot.scr\0" \
-- 
2.6.2

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


Re: [U-Boot] [PATCH] pci: gate print info of reading vender id with CONFIG_DM_PCI

2016-01-28 Thread Bin Meng
On Thu, Jan 28, 2016 at 3:43 PM, Qianyu Gong  wrote:
> Hi,
>
>> -Original Message-
>> From: Bin Meng [mailto:bmeng...@gmail.com]
>> Sent: Thursday, January 28, 2016 3:30 PM
>> To: Qianyu Gong 
>> Cc: U-Boot Mailing List 
>> Subject: Re: [U-Boot] [PATCH] pci: gate print info of reading vender id with
>> CONFIG_DM_PCI
>>
>> On Thu, Jan 28, 2016 at 3:15 PM, Gong Qianyu  wrote:
>> > From: Mingkai Hu 
>> >
>> > Referring to 'commit ff3e077bd23c ("dm: pci: Add a uclass for PCI")'.
>> >
>> > For legacy PCIe driver, it needs loop to read the vender_id from devie
>> > 0 to devie 255 to check if there is device available.
>> > Reading non-existen device will trigger the "Cannot read bus
>> > configuration: -1" information.
>> >
>> > Signed-off-by: Mingkai Hu 
>> > Signed-off-by: Gong Qianyu 
>> > ---
>>
>> Which pci controller are you testing?
>>
>> [snip]
>>
>> Regards,
>> Bin
>
> Designware PCIe controller on LS2085A.
>

Please check commit 7ba34ff09f1ef105521f914e4ad4e4ac19975bac "pci:
layerscape: Adjust the return value when ls_pcie_addr_valid() fails"
which is already in mainline.

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


Re: [U-Boot] [PATCH][RE-SUBMIT] usb: gadget: dwc2_udc_otg: modified the check condition for max packet size of ep_in in high speed

2016-01-28 Thread Lukasz Majewski
Hi Steve,

> From: Frank Wang 
> 
> In current high speed fastboot, fs_ep_in.wMaxPacketSize is configured
> 64 bytes as default, as a result, it failed to match the size at
> initialization stage in usb controller.
> Actually, hardware can support less than or equal to 512 bytes in
> high speed mode, so I changed the condition from  '!=' to '>' to fix
> this issue.

I'm aware of this problem, however now I'm busy with fixing dfu issue
regarding sending large files (e.g. 26 MiB). Patches are under
testing now.

After sending them I'll fix the fastboot problem.

> 
> Signed-off-by: Frank Wang 
> Tested-by: Steve Rae 
> ---
> 
>  drivers/usb/gadget/dwc2_udc_otg.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c
> b/drivers/usb/gadget/dwc2_udc_otg.c index 90ed5ff..19d6dcd 100644
> --- a/drivers/usb/gadget/dwc2_udc_otg.c
> +++ b/drivers/usb/gadget/dwc2_udc_otg.c
> @@ -565,8 +565,8 @@ static int dwc2_ep_enable(struct usb_ep *_ep,
>   }
>  
>   /* hardware _could_ do smaller, but driver doesn't */
> - if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK
> -  && le16_to_cpu(get_unaligned(>wMaxPacketSize)) !=
> + if ((desc->bmAttributes == USB_ENDPOINT_XFER_BULK &&
> +  le16_to_cpu(get_unaligned(>wMaxPacketSize)) >
>ep_maxpacket(ep))
> || !get_unaligned(>wMaxPacketSize)) { 
>   debug("%s: bad %s maxpacket\n", __func__, _ep->name);



-- 
Best regards,

Lukasz Majewski

Samsung R Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] pci: gate print info of reading vender id with CONFIG_DM_PCI

2016-01-28 Thread Qianyu Gong

> -Original Message-
> From: Bin Meng [mailto:bmeng...@gmail.com]
> Sent: Thursday, January 28, 2016 4:02 PM
> To: Qianyu Gong 
> Cc: u-boot@lists.denx.de
> Subject: Re: [U-Boot] [PATCH] pci: gate print info of reading vender id with
> CONFIG_DM_PCI
> 
> On Thu, Jan 28, 2016 at 3:43 PM, Qianyu Gong  wrote:
> > Hi,
> >
> >> -Original Message-
> >> From: Bin Meng [mailto:bmeng...@gmail.com]
> >> Sent: Thursday, January 28, 2016 3:30 PM
> >> To: Qianyu Gong 
> >> Cc: U-Boot Mailing List 
> >> Subject: Re: [U-Boot] [PATCH] pci: gate print info of reading vender
> >> id with CONFIG_DM_PCI
> >>
> >> On Thu, Jan 28, 2016 at 3:15 PM, Gong Qianyu  wrote:
> >> > From: Mingkai Hu 
> >> >
> >> > Referring to 'commit ff3e077bd23c ("dm: pci: Add a uclass for PCI")'.
> >> >
> >> > For legacy PCIe driver, it needs loop to read the vender_id from
> >> > devie
> >> > 0 to devie 255 to check if there is device available.
> >> > Reading non-existen device will trigger the "Cannot read bus
> >> > configuration: -1" information.
> >> >
> >> > Signed-off-by: Mingkai Hu 
> >> > Signed-off-by: Gong Qianyu 
> >> > ---
> >>
> >> Which pci controller are you testing?
> >>
> >> [snip]
> >>
> >> Regards,
> >> Bin
> >
> > Designware PCIe controller on LS2085A.
> >
> 
> Please check commit 7ba34ff09f1ef105521f914e4ad4e4ac19975bac "pci:
> layerscape: Adjust the return value when ls_pcie_addr_valid() fails"
> which is already in mainline.
> 
> Regards,
> Bin

Ok. That's nice of you. 
And we also find another commit cab24b3407189a12 "dm: pci: Convert 'pci' 
command to driver model" submitted by Simon has fixed the issue. So no 
need of this patch.
Thanks a lot.

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


[U-Boot] [PATCH V2 02/11] imx: imx-common: introduce Resource Domain Controller support

2016-01-28 Thread Peng Fan
From: Peng Fan 

Introduce Resource Domain Controller support for i.MX.
Now i.MX6SX and i.MX7D supports this feature to assign masters
and peripherals to different domains.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
 change imx_rdc_check_permission to support checking domain id.

 arch/arm/imx-common/Kconfig|   8 ++
 arch/arm/imx-common/Makefile   |   1 +
 arch/arm/imx-common/rdc-sema.c | 183 +
 arch/arm/include/asm/arch-mx6/imx-rdc.h|  12 ++
 arch/arm/include/asm/imx-common/rdc-sema.h | 100 
 5 files changed, 304 insertions(+)
 create mode 100644 arch/arm/imx-common/rdc-sema.c
 create mode 100644 arch/arm/include/asm/arch-mx6/imx-rdc.h
 create mode 100644 arch/arm/include/asm/imx-common/rdc-sema.h

diff --git a/arch/arm/imx-common/Kconfig b/arch/arm/imx-common/Kconfig
index 2296239..c4f48bb 100644
--- a/arch/arm/imx-common/Kconfig
+++ b/arch/arm/imx-common/Kconfig
@@ -3,3 +3,11 @@ config IMX_CONFIG
 
 config ROM_UNIFIED_SECTIONS
bool
+
+config IMX_RDC
+   bool "i.MX Resource domain controller driver"
+   depends on ARCH_MX6 || ARCH_MX7
+   help
+ i.MX Resource domain controller is used to assign masters
+ and peripherals to differet domains. This can be used to
+ isolate resources.
diff --git a/arch/arm/imx-common/Makefile b/arch/arm/imx-common/Makefile
index e7190c3..568f41c 100644
--- a/arch/arm/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -27,6 +27,7 @@ ifeq ($(SOC),$(filter $(SOC),mx6 mx7))
 obj-y  += cache.o init.o
 obj-$(CONFIG_CMD_SATA) += sata.o
 obj-$(CONFIG_IMX_VIDEO_SKIP) += video.o
+obj-$(CONFIG_IMX_RDC) += rdc-sema.o
 obj-$(CONFIG_SECURE_BOOT)+= hab.o
 endif
 ifeq ($(SOC),$(filter $(SOC),vf610))
diff --git a/arch/arm/imx-common/rdc-sema.c b/arch/arm/imx-common/rdc-sema.c
new file mode 100644
index 000..dcb5c41
--- /dev/null
+++ b/arch/arm/imx-common/rdc-sema.c
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2016 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:  GPL-2.0+
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * Check if the RDC Semaphore is required for this peripheral.
+ */
+static inline int imx_rdc_check_sema_required(int per_id)
+{
+   struct rdc_regs *imx_rdc = (struct rdc_regs *)RDC_BASE_ADDR;
+   u32 reg;
+
+   reg = readl(_rdc->pdap[per_id]);
+   /*
+* No semaphore:
+* Intial value or this peripheral is assigned to only one domain
+*/
+   if (!(reg & RDC_PDAP_SREQ_MASK))
+   return -ENOENT;
+
+   return 0;
+}
+
+/*
+ * Check the peripheral read / write access permission on Domain [dom_id].
+ */
+int imx_rdc_check_permission(int per_id, int dom_id)
+{
+   struct rdc_regs *imx_rdc = (struct rdc_regs *)RDC_BASE_ADDR;
+   u32 reg;
+
+   reg = readl(_rdc->pdap[per_id]);
+   if (!(reg & RDC_PDAP_DRW_MASK(dom_id)))
+   return -EACCES;  /*No access*/
+
+   return 0;
+}
+
+/*
+ * Lock up the RDC semaphore for this peripheral if semaphore is required.
+ */
+int imx_rdc_sema_lock(int per_id)
+{
+   struct rdc_sema_regs *imx_rdc_sema;
+   int ret;
+   u8 reg;
+
+   ret = imx_rdc_check_sema_required(per_id);
+   if (ret)
+   return ret;
+
+   if (per_id < SEMA_GATES_NUM)
+   imx_rdc_sema  = (struct rdc_sema_regs *)SEMAPHORE1_BASE_ADDR;
+   else
+   imx_rdc_sema  = (struct rdc_sema_regs *)SEMAPHORE2_BASE_ADDR;
+
+   do {
+   writeb(RDC_SEMA_PROC_ID,
+  _rdc_sema->gate[per_id % SEMA_GATES_NUM]);
+   reg = readb(_rdc_sema->gate[per_id % SEMA_GATES_NUM]);
+   if ((reg & RDC_SEMA_GATE_GTFSM_MASK) == RDC_SEMA_PROC_ID)
+   break;  /* Get the Semaphore*/
+   } while (1);
+
+   return 0;
+}
+
+/*
+ * Unlock the RDC semaphore for this peripheral if main CPU is the
+ * semaphore owner.
+ */
+int imx_rdc_sema_unlock(int per_id)
+{
+   struct rdc_sema_regs *imx_rdc_sema;
+   int ret;
+   u8 reg;
+
+   ret = imx_rdc_check_sema_required(per_id);
+   if (ret)
+   return ret;
+
+   if (per_id < SEMA_GATES_NUM)
+   imx_rdc_sema  = (struct rdc_sema_regs *)SEMAPHORE1_BASE_ADDR;
+   else
+   imx_rdc_sema  = (struct rdc_sema_regs *)SEMAPHORE2_BASE_ADDR;
+
+   reg = readb(_rdc_sema->gate[per_id % SEMA_GATES_NUM]);
+   if ((reg & RDC_SEMA_GATE_GTFSM_MASK) != RDC_SEMA_PROC_ID)
+   return 1;   /*Not the semaphore owner */
+
+   writeb(0x0, _rdc_sema->gate[per_id % SEMA_GATES_NUM]);
+
+   return 0;
+}
+
+/*
+ * Setup RDC setting for one peripheral
+ */
+int imx_rdc_setup_peri(rdc_peri_cfg_t p)
+{
+   struct rdc_regs *imx_rdc = (struct rdc_regs *)RDC_BASE_ADDR;
+   u32 reg = 0;
+   u32 share_count = 0;
+   u32 

[U-Boot] [PATCH V2 00/11] imx: introduce rdc and boot auxiliary core

2016-01-28 Thread Peng Fan
From: Peng Fan 

To i.MX6SX and i.MX7D, there is a M4 core embedded. Resources
can be shared or occupied exclusively by setting Resource
domain controller between A9/7 core and M4 core.

Refer "Chapter 52 Resource Domain Controller (RDC)" of i.MX 6SoloX
RM and "Chapter 3.2 Resource Domain Controller (RDC)" of i.MX 7Dual RM
for detailed infomation.

To bootup M4 core, a new command 'bootaux' is introduced. To i.MX7D,
we need to setting RDC when booting M4 core, so make RDC and boot
auxiliary core patches into one patch set.

Since we also sometimes put the M4 image in QSPI to let M4 directly fecth
code in the memory mapped QSPI space, we can not support such as libz
compressed image.

Peng Fan (11):
  imx: mx6: introduce rdc regs
  imx: imx-common: introduce Resource Domain Controller support
  imx: mx6sx Add RDC mappings of masters and peripherals
  imx: mx7d: Add RDC support
  imx: mx7d: clock support for RDC
  imx: imx-common: introduce boot auxiliary core
  imx: mx6: implement functions to boot auxiliary core
  imx: mx6sxsabresd: add command and macros for boot m4 core
  imx: mx7: implement functions to boot auxiliary core
  imx: mx7dsabresd: add command and macros for boot m4 core
  imx: mx7d: isolate resources to domain 0 for A7 core

 arch/arm/cpu/armv7/mx6/soc.c   |  38 ++
 arch/arm/cpu/armv7/mx7/clock.c |   6 +
 arch/arm/cpu/armv7/mx7/soc.c   | 100 
 arch/arm/imx-common/Kconfig|  14 +++
 arch/arm/imx-common/Makefile   |   2 +
 arch/arm/imx-common/imx_bootaux.c  |  72 
 arch/arm/imx-common/rdc-sema.c | 183 +
 arch/arm/include/asm/arch-mx6/imx-rdc.h|  16 +++
 arch/arm/include/asm/arch-mx6/imx-regs.h   |  29 +
 arch/arm/include/asm/arch-mx6/mx6sx_rdc.h  | 155 
 arch/arm/include/asm/arch-mx7/imx-rdc.h|  16 +++
 arch/arm/include/asm/arch-mx7/imx-regs.h   |   8 ++
 arch/arm/include/asm/arch-mx7/mx7d_rdc.h   | 163 +
 arch/arm/include/asm/imx-common/rdc-sema.h | 100 
 configs/mx7dsabresd_defconfig  |   2 +
 include/configs/mx6sxsabresd.h |  24 
 include/configs/mx7dsabresd.h  |  24 
 17 files changed, 952 insertions(+)
 create mode 100644 arch/arm/imx-common/imx_bootaux.c
 create mode 100644 arch/arm/imx-common/rdc-sema.c
 create mode 100644 arch/arm/include/asm/arch-mx6/imx-rdc.h
 create mode 100644 arch/arm/include/asm/arch-mx6/mx6sx_rdc.h
 create mode 100644 arch/arm/include/asm/arch-mx7/imx-rdc.h
 create mode 100644 arch/arm/include/asm/arch-mx7/mx7d_rdc.h
 create mode 100644 arch/arm/include/asm/imx-common/rdc-sema.h

-- 
2.6.2

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


[U-Boot] [PATCH V2 03/11] imx: mx6sx Add RDC mappings of masters and peripherals

2016-01-28 Thread Peng Fan
From: Peng Fan 

Add the definitions for the RDC mappings for i.MX6 SoloX.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
 no change

 arch/arm/include/asm/arch-mx6/imx-rdc.h   |   4 +
 arch/arm/include/asm/arch-mx6/mx6sx_rdc.h | 155 ++
 2 files changed, 159 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-mx6/mx6sx_rdc.h

diff --git a/arch/arm/include/asm/arch-mx6/imx-rdc.h 
b/arch/arm/include/asm/arch-mx6/imx-rdc.h
index 5754f04..c4d3bb4 100644
--- a/arch/arm/include/asm/arch-mx6/imx-rdc.h
+++ b/arch/arm/include/asm/arch-mx6/imx-rdc.h
@@ -7,6 +7,10 @@
 #ifndef __IMX_RDC_H__
 #define __IMX_RDC_H__
 
+#if defined(CONFIG_MX6SX)
+#include "mx6sx_rdc.h"
+#else
 #error "Please select cpu"
+#endif /* CONFIG_MX6SX */
 
 #endif /* __IMX_RDC_H__*/
diff --git a/arch/arm/include/asm/arch-mx6/mx6sx_rdc.h 
b/arch/arm/include/asm/arch-mx6/mx6sx_rdc.h
new file mode 100644
index 000..addfe01
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx6/mx6sx_rdc.h
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2014 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:  GPL-2.0+
+ */
+
+#ifndef __MX6SX_RDC_H__
+#define __MX6SX_RDC_H__
+
+#define RDC_SEMA_PROC_ID 2  /* The processor ID for main CPU */
+
+enum {
+   RDC_PER_PWM1 = 0,
+   RDC_PER_PWM2,
+   RDC_PER_PWM3,
+   RDC_PER_PWM4,
+   RDC_PER_CAN1,
+   RDC_PER_CAN2,
+   RDC_PER_GPT,
+   RDC_PER_GPIO1,
+   RDC_PER_GPIO2,
+   RDC_PER_GPIO3,
+   RDC_PER_GPIO4,
+   RDC_PER_GPIO5,
+   RDC_PER_GPIO6,
+   RDC_PER_GPIO7,
+   RDC_PER_KPP,
+   RDC_PER_WDOG1,
+   RDC_PER_WODG2,
+   RDC_PER_CCM,
+   RDC_PER_ANATOPDIG,
+   RDC_PER_SNVSHP,
+   RDC_PER_EPIT1,
+   RDC_PER_EPIT2,
+   RDC_PER_SRC,
+   RDC_PER_GPC,
+   RDC_PER_IOMUXC,
+   RDC_PER_IOMUXCGPR,
+   RDC_PER_CANFD1,
+   RDC_PER_SDMA,
+   RDC_PER_CANFD2,
+   RDC_PER_SEMA1,
+   RDC_PER_SEMA2,
+   RDC_PER_RDC,
+   RDC_PER_AIPSTZ1_GE1,
+   RDC_PER_AIPSTZ2_GE2,
+   RDC_PER_USBO2H_PL301,
+   RDC_PER_USBO2H_USB,
+   RDC_PER_ENET1,
+   RDC_PER_MLB25,
+   RDC_PER_USDHC1,
+   RDC_PER_USDHC2,
+   RDC_PER_USDHC3,
+   RDC_PER_USDHC4,
+   RDC_PER_I2C1,
+   RDC_PER_I2C2,
+   RDC_PER_I2C3,
+   RDC_PER_ROMCP,
+   RDC_PER_MMDC,
+   RDC_PER_ENET2,
+   RDC_PER_EIM,
+   RDC_PER_OCOTP,
+   RDC_PER_CSU,
+   RDC_PER_PERFMON1,
+   RDC_PER_PERFMON2,
+   RDC_PER_AXIMON,
+   RDC_PER_TZASC1,
+   RDC_PER_SAI1,
+   RDC_PER_AUDMUX,
+   RDC_PER_SAI2,
+   RDC_PER_QSPI1,
+   RDC_PER_QSPI2,
+   RDC_PER_UART2,
+   RDC_PER_UART3,
+   RDC_PER_UART4,
+   RDC_PER_UART5,
+   RDC_PER_I2C4,
+   RDC_PER_QOSC,
+   RDC_PER_CAAM,
+   RDC_PER_DAP,
+   RDC_PER_ADC1,
+   RDC_PER_ADC2,
+   RDC_PER_WDOG3,
+   RDC_PER_ECSPI5,
+   RDC_PER_SEMA4,
+   RDC_PER_MUPORT1,
+   RDC_PER_CANFD_CPU,
+   RDC_PER_MUPORT2,
+   RDC_PER_UART6,
+   RDC_PER_PWM5,
+   RDC_PER_PWM6,
+   RDC_PER_PWM7,
+   RDC_PER_PWM8,
+   RDC_PER_AIPSTZ3_GE0,
+   RDC_PER_AIPSTZ3_GE1,
+   RDC_PER_RESERVED1,
+   RDC_PER_SPDIF,
+   RDC_PER_ECSPI1,
+   RDC_PER_ECSPI2,
+   RDC_PER_ECSPI3,
+   RDC_PER_ECSPI4,
+   RDC_PER_RESERVED2,
+   RDC_PER_RESERVED3,
+   RDC_PER_UART1,
+   RDC_PER_ESAI,
+   RDC_PER_SSI1,
+   RDC_PER_SSI2,
+   RDC_PER_SSI3,
+   RDC_PER_ASRC,
+   RDC_PER_RESERVED4,
+   RDC_PER_SPBA_MA,
+   RDC_PER_GIS,
+   RDC_PER_DCIC1,
+   RDC_PER_DCIC2,
+   RDC_PER_CSI1,
+   RDC_PER_PXP,
+   RDC_PER_CSI2,
+   RDC_PER_LCDIF1,
+   RDC_PER_LCDIF2,
+   RDC_PER_VADC,
+   RDC_PER_VDEC,
+   RDC_PER_SPBA_DISPLAYMIX,
+};
+
+enum {
+   RDC_MA_A9_L2CACHE = 0,
+   RDC_MA_M4,
+   RDC_MA_GPU,
+   RDC_MA_CSI1,
+   RDC_MA_CSI2,
+   RDC_MA_LCDIF1,
+   RDC_MA_LCDIF2,
+   RDC_MA_PXP,
+   RDC_MA_PCIE_CTRL,
+   RDC_MA_DAP,
+   RDC_MA_CAAM,
+   RDC_MA_SDMA_PERI,
+   RDC_MA_SDMA_BURST,
+   RDC_MA_APBHDMA,
+   RDC_MA_RAWNAND,
+   RDC_MA_USDHC1,
+   RDC_MA_USDHC2,
+   RDC_MA_USDHC3,
+   RDC_MA_USDHC4,
+   RDC_MA_USB,
+   RDC_MA_MLB,
+   RDC_MA_TEST,
+   RDC_MA_ENET1_TX,
+   RDC_MA_ENET1_RX,
+   RDC_MA_ENET2_TX,
+   RDC_MA_ENET2_RX,
+   RDC_MA_SDMA,
+};
+
+#endif /* __MX6SX_RDC_H__*/
-- 
2.6.2

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


[U-Boot] [PATCH V2 01/11] imx: mx6: introduce rdc regs

2016-01-28 Thread Peng Fan
From: Peng Fan 

Introudce rdc regs structure and rdc sema reg structure for i.MX6.
For now, to i.MX6, only i.MX6SX supports this.

Signed-off-by: Ye.Li 
Signed-off-by: Peng Fan 
---

V2:
 no change

 arch/arm/include/asm/arch-mx6/imx-regs.h | 24 
 1 file changed, 24 insertions(+)

diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index f24525e..b1de751 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -356,6 +356,30 @@ extern void imx_get_mac_from_fuse(int dev_id, unsigned 
char *mac);
 #define SRC_SCR_CORE_3_ENABLE_OFFSET24
 #define SRC_SCR_CORE_3_ENABLE_MASK  (1<

Re: [U-Boot] [PATCH 1/3] mips: ath79: Fix compiler warning on const assignment

2016-01-28 Thread Wills Wang



On Thursday, January 28, 2016 07:51 AM, Marek Vasut wrote:

The assignment const T var; var = value; is illegal, since var is
constant. Drop the const to fix the compiler warning.

Signed-off-by: Marek Vasut 
Cc: Daniel Schwierzeck 
Cc: Wills Wang 
---
  arch/mips/mach-ath79/reset.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/mach-ath79/reset.c b/arch/mips/mach-ath79/reset.c
index 504b833..e8f5796 100644
--- a/arch/mips/mach-ath79/reset.c
+++ b/arch/mips/mach-ath79/reset.c
@@ -46,7 +46,7 @@ void _machine_restart(void)
  
  u32 get_bootstrap(void)

  {
-   const void __iomem *base;
+   void __iomem *base;
u32 reg = 0;
  
  	base = map_physmem(AR71XX_RESET_BASE, AR71XX_RESET_SIZE,

I have dropped "const" in the coming v8.

--
Best Regards
Wills

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


Re: [U-Boot] [PATCH 2/3] mips: ath79: Drop SYS_MIPS_CACHE_INIT_RAM_LOAD

2016-01-28 Thread Wills Wang



On Thursday, January 28, 2016 07:51 AM, Marek Vasut wrote:

Drop SYS_MIPS_CACHE_INIT_RAM_LOAD from the Kconfig, since this option
is bogus. The DRAM is not active when this option comes into play, so
any attempt to restore valid cache state from invalid DRAM must fail.
Disable this option to prevent such failure and potential undefined
behavior.

Signed-off-by: Marek Vasut 
Cc: Daniel Schwierzeck 
Cc: Wills Wang 
---
  arch/mips/mach-ath79/Kconfig | 2 --
  1 file changed, 2 deletions(-)

diff --git a/arch/mips/mach-ath79/Kconfig b/arch/mips/mach-ath79/Kconfig
index f61efd2..95f7de9 100644
--- a/arch/mips/mach-ath79/Kconfig
+++ b/arch/mips/mach-ath79/Kconfig
@@ -12,7 +12,6 @@ config SOC_AR933X
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
select SUPPORTS_CPU_MIPS32_R2
-   select SYS_MIPS_CACHE_INIT_RAM_LOAD
select MIPS_TUNE_24KC
help
  This supports QCA/Atheros ar933x family SOCs.
@@ -22,7 +21,6 @@ config SOC_QCA953X
select SUPPORTS_BIG_ENDIAN
select SUPPORTS_CPU_MIPS32_R1
select SUPPORTS_CPU_MIPS32_R2
-   select SYS_MIPS_CACHE_INIT_RAM_LOAD
select MIPS_TUNE_24KC
help
  This supports QCA/Atheros qca953x family SOCs.

I will remove this option in the coming v8.

--
Best Regards
Wills

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


Re: [U-Boot] [PATCH 1/3] mips: ath79: Fix compiler warning on const assignment

2016-01-28 Thread Marek Vasut
On Thursday, January 28, 2016 at 02:23:48 PM, Wills Wang wrote:
> On Thursday, January 28, 2016 07:51 AM, Marek Vasut wrote:
> > The assignment const T var; var = value; is illegal, since var is
> > constant. Drop the const to fix the compiler warning.
> > 
> > Signed-off-by: Marek Vasut 
> > Cc: Daniel Schwierzeck 
> > Cc: Wills Wang 
> > ---
> > 
> >   arch/mips/mach-ath79/reset.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/mips/mach-ath79/reset.c b/arch/mips/mach-ath79/reset.c
> > index 504b833..e8f5796 100644
> > --- a/arch/mips/mach-ath79/reset.c
> > +++ b/arch/mips/mach-ath79/reset.c
> > @@ -46,7 +46,7 @@ void _machine_restart(void)
> > 
> >   u32 get_bootstrap(void)
> >   {
> > 
> > -   const void __iomem *base;
> > +   void __iomem *base;
> > 
> > u32 reg = 0;
> > 
> > base = map_physmem(AR71XX_RESET_BASE, AR71XX_RESET_SIZE,
> 
> I have dropped "const" in the coming v8.

Fine

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/2] include:configs: Add usb device-tree fixup for all fsl platforms

2016-01-28 Thread Ramneek Mehresh


> -Original Message-
> From: Marek Vasut [mailto:ma...@denx.de]
> Sent: Thursday, January 28, 2016 5:04 PM
> To: Ramneek Mehresh 
> Cc: Ramneek Mehresh ; u-
> b...@lists.denx.de; Simon Glass 
> Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all 
> fsl
> platforms
> 
> On Thursday, January 28, 2016 at 12:05:29 PM, Ramneek Mehresh wrote:
> > > -Original Message-
> > > From: Marek Vasut [mailto:ma...@denx.de]
> > > Sent: Wednesday, January 27, 2016 5:13 PM
> > > To: Ramneek Mehresh 
> > > Cc: Ramneek Mehresh ; u-
> > > b...@lists.denx.de; Simon Glass 
> > > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup
> > > for all fsl platforms
> > >
> > > On Wednesday, January 27, 2016 at 12:33:04 PM, Ramneek Mehresh
> wrote:
> > > > > -Original Message-
> > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > Sent: Wednesday, January 27, 2016 1:57 PM
> > > > > To: Ramneek Mehresh 
> > > > > Cc: Ramneek Mehresh ; u-
> > > > > b...@lists.denx.de; Simon Glass 
> > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree
> > > > > fixup for all fsl platforms
> > > > >
> > > > > On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek Mehresh
> > >
> > > wrote:
> > > > > > > -Original Message-
> > > > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > > > Sent: Wednesday, January 27, 2016 1:05 PM
> > > > > > > To: Ramneek Mehresh 
> > > > > > > Cc: Ramneek Mehresh ; u-
> > > > > > > b...@lists.denx.de; Simon Glass 
> > > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb
> > > > > > > device-tree fixup for all fsl platforms
> > > > > > >
> > > > > > > On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek
> > > > > > > Mehresh
> > > > >
> > > > > wrote:
> > > > > > > > > -Original Message-
> > > > > > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > > > > > Sent: Wednesday, January 27, 2016 9:57 AM
> > > > > > > > > To: Ramneek Mehresh 
> > > > > > > > > Cc: Ramneek Mehresh ;
> u-
> > > > > > > > > b...@lists.denx.de; Simon Glass 
> > > > > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb
> > > > > > > > > device-tree fixup for all fsl platforms
> > > > > > > > >
> > > > > > > > > On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek
> > >
> > > Mehresh
> > >
> > > > > > > wrote:
> > > > > > > > > > > -Original Message-
> > > > > > > > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > > > > > > > Sent: Tuesday, January 26, 2016 4:58 PM
> > > > > > > > > > > To: Ramneek Mehresh
> 
> > > > > > > > > > > Cc: u-boot@lists.denx.de
> > > > > > > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb
> > > > > > > > > > > device-tree fixup for all fsl platforms
> > > > > > > > > > >
> > > > > > > > > > > On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek
> > >
> > > Mehresh
> > >
> > > > > > > wrote:
> > > > > > > > > > > > Add usb device-tree fixup for all relevant fsl ppc
> > > > > > > > > > > > and arm platforms
> > > > > > > > > > > >
> > > > > > > > > > > > Signed-off-by: Ramneek Mehresh
> > > > > > > > >
> > > > > > > > > 
> > > > > > > > >
> > > > > > > > > > > > ---
> > > > > > > > > > > >
> > > > > > > > > > > >  board/freescale/b4860qds/b4860qds.c | 2 +-
> > > > > > > > > > > >  board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++
> > > > > > > > > > > >  board/freescale/bsc9132qds/bsc9132qds.c | 2 ++
> > > > > > > > > > > >  board/freescale/corenet_ds/corenet_ds.c | 4 
> > > > > > > > > > > >  board/freescale/ls2080aqds/ls2080aqds.c | 4 
> > > > > > > > > > > >  board/freescale/ls2080ardb/ls2080ardb.c | 4 
> > > > > > > > > > > >  board/freescale/mpc8308rdb/mpc8308rdb.c | 4 
> > > > > > > > > > > >  board/freescale/mpc8315erdb/mpc8315erdb.c   | 2 ++
> > > > > > > > > > > >  board/freescale/mpc837xemds/mpc837xemds.c   | 2 ++
> > > > > > > > > > > >  board/freescale/mpc837xerdb/mpc837xerdb.c   | 2 ++
> > > > > > > > > > > >  board/freescale/mpc8536ds/mpc8536ds.c   | 2 +-
> > > > > > > > > > > >  board/freescale/p1010rdb/p1010rdb.c | 2 +-
> > > > > > > > > > > >  board/freescale/p1022ds/p1022ds.c   | 2 +-
> > > > > > > > > > > >  board/freescale/p1023rdb/p1023rdb.c | 2 +-
> > > > > > > > > > > >  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +-
> > > > > > > > > > > >  board/freescale/p1_twr/p1_twr.c | 3 +++
> > > > > > > > > > > >  board/freescale/p2041rdb/p2041rdb.c | 2 +-
> > > > > > > > > > > >  board/freescale/t102xqds/t102xqds.c | 2 +-
> > > 

Re: [U-Boot] [PATCH 2/3] mips: ath79: Drop SYS_MIPS_CACHE_INIT_RAM_LOAD

2016-01-28 Thread Marek Vasut
On Thursday, January 28, 2016 at 02:25:08 PM, Wills Wang wrote:
> On Thursday, January 28, 2016 07:51 AM, Marek Vasut wrote:
> > Drop SYS_MIPS_CACHE_INIT_RAM_LOAD from the Kconfig, since this option
> > is bogus. The DRAM is not active when this option comes into play, so
> > any attempt to restore valid cache state from invalid DRAM must fail.
> > Disable this option to prevent such failure and potential undefined
> > behavior.
> > 
> > Signed-off-by: Marek Vasut 
> > Cc: Daniel Schwierzeck 
> > Cc: Wills Wang 
> > ---
> > 
> >   arch/mips/mach-ath79/Kconfig | 2 --
> >   1 file changed, 2 deletions(-)
> > 
> > diff --git a/arch/mips/mach-ath79/Kconfig b/arch/mips/mach-ath79/Kconfig
> > index f61efd2..95f7de9 100644
> > --- a/arch/mips/mach-ath79/Kconfig
> > +++ b/arch/mips/mach-ath79/Kconfig
> > @@ -12,7 +12,6 @@ config SOC_AR933X
> > 
> > select SUPPORTS_BIG_ENDIAN
> > select SUPPORTS_CPU_MIPS32_R1
> > select SUPPORTS_CPU_MIPS32_R2
> > 
> > -   select SYS_MIPS_CACHE_INIT_RAM_LOAD
> > 
> > select MIPS_TUNE_24KC
> > help
> > 
> >   This supports QCA/Atheros ar933x family SOCs.
> > 
> > @@ -22,7 +21,6 @@ config SOC_QCA953X
> > 
> > select SUPPORTS_BIG_ENDIAN
> > select SUPPORTS_CPU_MIPS32_R1
> > select SUPPORTS_CPU_MIPS32_R2
> > 
> > -   select SYS_MIPS_CACHE_INIT_RAM_LOAD
> > 
> > select MIPS_TUNE_24KC
> > help
> > 
> >   This supports QCA/Atheros qca953x family SOCs.
> 
> I will remove this option in the coming v8.

Fine

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/2] include:configs: Add usb device-tree fixup for all fsl platforms

2016-01-28 Thread Marek Vasut
On Thursday, January 28, 2016 at 12:05:29 PM, Ramneek Mehresh wrote:
> > -Original Message-
> > From: Marek Vasut [mailto:ma...@denx.de]
> > Sent: Wednesday, January 27, 2016 5:13 PM
> > To: Ramneek Mehresh 
> > Cc: Ramneek Mehresh ; u-
> > b...@lists.denx.de; Simon Glass 
> > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for
> > all fsl platforms
> > 
> > On Wednesday, January 27, 2016 at 12:33:04 PM, Ramneek Mehresh wrote:
> > > > -Original Message-
> > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > Sent: Wednesday, January 27, 2016 1:57 PM
> > > > To: Ramneek Mehresh 
> > > > Cc: Ramneek Mehresh ; u-
> > > > b...@lists.denx.de; Simon Glass 
> > > > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup
> > > > for all fsl platforms
> > > > 
> > > > On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek Mehresh
> > 
> > wrote:
> > > > > > -Original Message-
> > > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > > Sent: Wednesday, January 27, 2016 1:05 PM
> > > > > > To: Ramneek Mehresh 
> > > > > > Cc: Ramneek Mehresh ; u-
> > > > > > b...@lists.denx.de; Simon Glass 
> > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree
> > > > > > fixup for all fsl platforms
> > > > > > 
> > > > > > On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek Mehresh
> > > > 
> > > > wrote:
> > > > > > > > -Original Message-
> > > > > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > > > > Sent: Wednesday, January 27, 2016 9:57 AM
> > > > > > > > To: Ramneek Mehresh 
> > > > > > > > Cc: Ramneek Mehresh ; u-
> > > > > > > > b...@lists.denx.de; Simon Glass 
> > > > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree
> > > > > > > > fixup for all fsl platforms
> > > > > > > > 
> > > > > > > > On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek
> > 
> > Mehresh
> > 
> > > > > > wrote:
> > > > > > > > > > -Original Message-
> > > > > > > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > > > > > > Sent: Tuesday, January 26, 2016 4:58 PM
> > > > > > > > > > To: Ramneek Mehresh 
> > > > > > > > > > Cc: u-boot@lists.denx.de
> > > > > > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb
> > > > > > > > > > device-tree fixup for all fsl platforms
> > > > > > > > > > 
> > > > > > > > > > On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek
> > 
> > Mehresh
> > 
> > > > > > wrote:
> > > > > > > > > > > Add usb device-tree fixup for all relevant fsl ppc and
> > > > > > > > > > > arm platforms
> > > > > > > > > > > 
> > > > > > > > > > > Signed-off-by: Ramneek Mehresh
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > > > > ---
> > > > > > > > > > > 
> > > > > > > > > > >  board/freescale/b4860qds/b4860qds.c | 2 +-
> > > > > > > > > > >  board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++
> > > > > > > > > > >  board/freescale/bsc9132qds/bsc9132qds.c | 2 ++
> > > > > > > > > > >  board/freescale/corenet_ds/corenet_ds.c | 4 
> > > > > > > > > > >  board/freescale/ls2080aqds/ls2080aqds.c | 4 
> > > > > > > > > > >  board/freescale/ls2080ardb/ls2080ardb.c | 4 
> > > > > > > > > > >  board/freescale/mpc8308rdb/mpc8308rdb.c | 4 
> > > > > > > > > > >  board/freescale/mpc8315erdb/mpc8315erdb.c   | 2 ++
> > > > > > > > > > >  board/freescale/mpc837xemds/mpc837xemds.c   | 2 ++
> > > > > > > > > > >  board/freescale/mpc837xerdb/mpc837xerdb.c   | 2 ++
> > > > > > > > > > >  board/freescale/mpc8536ds/mpc8536ds.c   | 2 +-
> > > > > > > > > > >  board/freescale/p1010rdb/p1010rdb.c | 2 +-
> > > > > > > > > > >  board/freescale/p1022ds/p1022ds.c   | 2 +-
> > > > > > > > > > >  board/freescale/p1023rdb/p1023rdb.c | 2 +-
> > > > > > > > > > >  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +-
> > > > > > > > > > >  board/freescale/p1_twr/p1_twr.c | 3 +++
> > > > > > > > > > >  board/freescale/p2041rdb/p2041rdb.c | 2 +-
> > > > > > > > > > >  board/freescale/t102xqds/t102xqds.c | 2 +-
> > > > > > > > > > >  board/freescale/t102xrdb/t102xrdb.c | 3 +++
> > > > > > > > > > >  board/freescale/t1040qds/t1040qds.c | 2 +-
> > > > > > > > > > >  board/freescale/t104xrdb/t104xrdb.c | 2 +-
> > > > > > > > > > >  board/freescale/t208xqds/t208xqds.c | 3 +++
> > > > > > > > > > >  board/freescale/t208xrdb/t208xrdb.c | 3 +++
> > > > > > > > > > >  board/freescale/t4qds/t4240emu.c| 3 +++
> > > > > > > > > > >  board/freescale/t4qds/t4240qds.c| 3 +++
> > > > > > > > > > >  

Re: [U-Boot] [PATCH 3/3] mips: ath79: Move SYS_SOC and SYS_VENDOR to board Kconfig

2016-01-28 Thread Wills Wang



On Thursday, January 28, 2016 07:51 AM, Marek Vasut wrote:

In order to support boards with ath79 from different vendors and
thus located under /board/$VENDOR/ , we need to define SYS_VENDOR
and SYS_SOC in the board-level Kconfig. Move these two variables
into board-level Kconfig for both ap121 and ap143 boards.

Signed-off-by: Marek Vasut 
Cc: Daniel Schwierzeck 
Cc: Wills Wang 
---
  arch/mips/mach-ath79/Kconfig | 6 --
  board/ath79/ap121/Kconfig| 6 ++
  board/ath79/ap143/Kconfig| 6 ++
  3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/mips/mach-ath79/Kconfig b/arch/mips/mach-ath79/Kconfig
index 95f7de9..8f07a77 100644
--- a/arch/mips/mach-ath79/Kconfig
+++ b/arch/mips/mach-ath79/Kconfig
@@ -1,12 +1,6 @@
  menu "QCA/Athroes 7xxx/9xxx platforms"
depends on ARCH_ATH79
  
-config SYS_VENDOR

-   default "ath79"
-
-config SYS_SOC
-   default "ath79"
-
  config SOC_AR933X
bool
select SUPPORTS_BIG_ENDIAN
diff --git a/board/ath79/ap121/Kconfig b/board/ath79/ap121/Kconfig
index ec72914..a4e5690 100644
--- a/board/ath79/ap121/Kconfig
+++ b/board/ath79/ap121/Kconfig
@@ -1,5 +1,11 @@
  if BOARD_AP121
  
+config SYS_VENDOR

+   default "ath79"
+
+config SYS_SOC
+   default "ath79"
+
  config SYS_BOARD
default "ap121"
  
diff --git a/board/ath79/ap143/Kconfig b/board/ath79/ap143/Kconfig

index 118b9b5..2e54fa7 100644
--- a/board/ath79/ap143/Kconfig
+++ b/board/ath79/ap143/Kconfig
@@ -1,5 +1,11 @@
  if BOARD_AP143
  
+config SYS_VENDOR

+   default "ath79"
+
+config SYS_SOC
+   default "ath79"
+
  config SYS_BOARD
default "ap143"
  

I plan to place ap121 and ap143 into board/qca, and then
move these into board directory.

--
Best Regards
Wills

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


[U-Boot] [PATCH v4 12/13] drivers: net: Add ethernet driver for Microchip PIC32.

2016-01-28 Thread Purna Chandra Mandal
This driver implements MAC and MII layer of the ethernet controller.
Network data transfer is handled by controller internal DMA engine.
Ethernet controller is configurable through device-tree file.

Signed-off-by: Purna Chandra Mandal 


---

Changes in v4:
- drop ioremap() success check
- drop _dcache_flush/invalidate() helpers for flash/invalidate_dcache_range().

Changes in v3:
- merge wrappers with eth operation callbacks
- read phy address from device-tree
- rename functions (e.g. _eth_xyz() with pic32_eth_xyz())

Changes in v2: None

 drivers/net/Kconfig  |   8 +
 drivers/net/Makefile |   1 +
 drivers/net/pic32_eth.c  | 605 +++
 drivers/net/pic32_eth.h  | 164 +
 drivers/net/pic32_mdio.c | 121 ++
 5 files changed, 899 insertions(+)
 create mode 100644 drivers/net/pic32_eth.c
 create mode 100644 drivers/net/pic32_eth.h
 create mode 100644 drivers/net/pic32_mdio.c

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index de54ca8..1502f8e 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -109,4 +109,12 @@ config ZYNQ_GEM
help
  This MAC is present in Xilinx Zynq and ZynqMP SoCs.
 
+config PIC32_ETH
+   bool "Microchip PIC32 Ethernet Support"
+   depends on DM_ETH && MACH_PIC32
+   select PHYLIB
+   help
+ This driver implements 10/100 Mbps Ethernet and MAC layer for
+ Microchip PIC32 microcontrollers.
+
 endif # NETDEVICES
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 150470c..33a81ee 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -72,3 +72,4 @@ obj-$(CONFIG_FSL_MC_ENET) += fsl-mc/
 obj-$(CONFIG_FSL_MC_ENET) += ldpaa_eth/
 obj-$(CONFIG_FSL_MEMAC) += fm/memac_phy.o
 obj-$(CONFIG_VSC9953) += vsc9953.o
+obj-$(CONFIG_PIC32_ETH) += pic32_mdio.o pic32_eth.o
diff --git a/drivers/net/pic32_eth.c b/drivers/net/pic32_eth.c
new file mode 100644
index 000..167af8b
--- /dev/null
+++ b/drivers/net/pic32_eth.c
@@ -0,0 +1,605 @@
+/*
+ * (c) 2015 Purna Chandra Mandal 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pic32_eth.h"
+
+#define MAX_RX_BUF_SIZE1536
+#define MAX_RX_DESCR   PKTBUFSRX
+#define MAX_TX_DESCR   2
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct pic32eth_dev {
+   struct eth_dma_desc rxd_ring[MAX_RX_DESCR];
+   struct eth_dma_desc txd_ring[MAX_TX_DESCR];
+   u32 rxd_idx; /* index of RX desc to read */
+   /* regs */
+   struct pic32_ectl_regs *ectl_regs;
+   struct pic32_emac_regs *emac_regs;
+   /* Phy */
+   struct phy_device *phydev;
+   phy_interface_t phyif;
+   u32 phy_addr;
+   struct gpio_desc rst_gpio;
+};
+
+void __weak board_netphy_reset(void *dev)
+{
+   struct pic32eth_dev *priv = dev;
+
+   if (!dm_gpio_is_valid(>rst_gpio))
+   return;
+
+   /* phy reset */
+   dm_gpio_set_value(>rst_gpio, 0);
+   udelay(300);
+   dm_gpio_set_value(>rst_gpio, 1);
+   udelay(300);
+}
+
+/* Initialize mii(MDIO) interface, discover which PHY is
+ * attached to the device, and configure it properly.
+ */
+static int pic32_mii_init(struct pic32eth_dev *priv)
+{
+   struct pic32_ectl_regs *ectl_p = priv->ectl_regs;
+   struct pic32_emac_regs *emac_p = priv->emac_regs;
+
+   /* board phy reset */
+   board_netphy_reset(priv);
+
+   /* disable RX, TX & all transactions */
+   writel(ETHCON_ON | ETHCON_TXRTS | ETHCON_RXEN, _p->con1.clr);
+
+   /* wait till busy */
+   wait_for_bit(__func__, _p->stat.raw, ETHSTAT_BUSY, false,
+CONFIG_SYS_HZ, false);
+
+   /* turn controller ON to access PHY over MII */
+   writel(ETHCON_ON, _p->con1.set);
+
+   mdelay(10);
+
+   /* reset MAC */
+   writel(EMAC_SOFTRESET, _p->cfg1.set); /* reset assert */
+   mdelay(10);
+   writel(EMAC_SOFTRESET, _p->cfg1.clr); /* reset deassert */
+
+   /* initialize MDIO/MII */
+   if (priv->phyif == PHY_INTERFACE_MODE_RMII) {
+   writel(EMAC_RMII_RESET, _p->supp.set);
+   mdelay(10);
+   writel(EMAC_RMII_RESET, _p->supp.clr);
+   }
+
+   return pic32_mdio_init(PIC32_MDIO_NAME, (ulong)_p->mii);
+}
+
+static int pic32_phy_init(struct pic32eth_dev *priv, struct udevice *dev)
+{
+   struct mii_dev *mii;
+
+   mii = miiphy_get_dev_by_name(PIC32_MDIO_NAME);
+
+   /* find & connect PHY */
+   priv->phydev = phy_connect(mii, priv->phy_addr,
+  dev, priv->phyif);
+   if (!priv->phydev) {
+   printf("%s: %s: Error, PHY connect\n", __FILE__, __func__);
+   return 0;
+   }
+
+   /* Wait for phy to complete reset */
+   mdelay(10);
+
+   /* configure supported modes */
+   priv->phydev->supported = 

[U-Boot] [PATCH v4 13/13] board: Enable ethernet, tftpboot support to pic32mzdask board.

2016-01-28 Thread Purna Chandra Mandal
This adds ethernet, TFTP support for PIC32MZ[DA] Starter Kit. Also
custom environment variables/scripts are added to help boot from network.

Signed-off-by: Purna Chandra Mandal 

---

Changes in v4: None
Changes in v3: None
Changes in v2:
- replace unbounded loop with wait_for_bit()
- replace register access as readl/writel(base + offset)
- translate (dts provided) physical address to MIPS kseg1 address before use

 arch/mips/dts/pic32mzda.dtsi   | 10 ++
 arch/mips/dts/pic32mzda_sk.dts | 10 ++
 configs/pic32mzdask_defconfig  |  9 ++---
 include/configs/pic32mzdask.h  | 22 +-
 4 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/arch/mips/dts/pic32mzda.dtsi b/arch/mips/dts/pic32mzda.dtsi
index f1894ec..7d180d9 100644
--- a/arch/mips/dts/pic32mzda.dtsi
+++ b/arch/mips/dts/pic32mzda.dtsi
@@ -161,4 +161,14 @@
bus-width = <4>;
status = "disabled";
};
+
+   ethernet: ethernet@1f882000 {
+   compatible = "microchip,pic32mzda-eth";
+   reg = <0x1f882000 0x1000>;
+   interrupts = <153 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = < PB5CLK>;
+   status = "disabled";
+   #address-cells = <1>;
+   #size-cells = <0>;
+   };
 };
diff --git a/arch/mips/dts/pic32mzda_sk.dts b/arch/mips/dts/pic32mzda_sk.dts
index f886a0f..e5ce0bd 100644
--- a/arch/mips/dts/pic32mzda_sk.dts
+++ b/arch/mips/dts/pic32mzda_sk.dts
@@ -42,4 +42,14 @@
 
  {
status = "okay";
+};
+
+ {
+   reset-gpios = < 15 0>;
+   status = "okay";
+   phy-mode = "rmii";
+   phy-handle = <_phy>;
+   ethernet_phy: lan8740_phy@0 {
+   reg = <0>;
+   };
 };
\ No newline at end of file
diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
index 55ba3f8..169a2ac 100644
--- a/configs/pic32mzdask_defconfig
+++ b/configs/pic32mzdask_defconfig
@@ -16,16 +16,19 @@ CONFIG_CMD_MEMINFO=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
 CONFIG_CMD_GPIO=y
-# CONFIG_CMD_NET is not set
-# CONFIG_CMD_NFS is not set
+CONFIG_CMD_RARP=y
+CONFIG_CMD_DHCP=y
+CONFIG_CMD_PING=y
 CONFIG_CMD_TIME=y
 CONFIG_OF_EMBED=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_CLK=y
 CONFIG_DM_MMC=y
 CONFIG_PIC32_SDHCI=y
+CONFIG_DM_ETH=y
+CONFIG_PIC32_ETH=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_FULL is not set
 CONFIG_SYS_VSNPRINTF=y
 CONFIG_USE_TINY_PRINTF=y
-CONFIG_REGEX=y
 CONFIG_CMD_DHRYSTONE=y
diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h
index b258038..3ea1194 100644
--- a/include/configs/pic32mzdask.h
+++ b/include/configs/pic32mzdask.h
@@ -73,6 +73,25 @@
(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
 #define CONFIG_CMDLINE_EDITING 1
 
+/*---
+ * Networking Configuration
+ */
+#define CONFIG_MII
+#define CONFIG_PHY_SMSC
+#define CONFIG_SYS_RX_ETH_BUFFER   8
+#define CONFIG_NET_RETRY_COUNT 20
+#define CONFIG_ARP_TIMEOUT 500 /* millisec */
+
+#define CONFIG_CMD_MII
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+
 /*
  * Handover flattened device tree (dtb file) to Linux kernel
  */
@@ -133,7 +152,8 @@
"fi; \0"
 
 #define BOOT_TARGET_DEVICES(func)  \
-   func(MMC, mmc, 0)
+   func(MMC, mmc, 0)   \
+   func(DHCP, dhcp, na)
 
 #include 
 
-- 
1.8.3.1

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


[U-Boot] [PATCH v4 11/13] drivers: net: phy: add SMSC LAN8740 Phy support.

2016-01-28 Thread Purna Chandra Mandal
Add SMSC LAN8740 Phy support required for PIC32MZDA devices.

Signed-off-by: Purna Chandra Mandal 
Reviewed-by: Tom Rini 
Reviewed-by: Daniel Schwierzeck 

---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/net/phy/smsc.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c
index bfd9815..34986a2 100644
--- a/drivers/net/phy/smsc.c
+++ b/drivers/net/phy/smsc.c
@@ -69,11 +69,21 @@ static struct phy_driver lan8710_driver = {
.shutdown = _shutdown,
 };
 
+static struct phy_driver lan8740_driver = {
+   .name = "SMSC LAN8740",
+   .uid = 0x0007c110,
+   .mask = 0x0,
+   .features = PHY_BASIC_FEATURES,
+   .config = _config_aneg,
+   .startup = _startup,
+   .shutdown = _shutdown,
+};
 int phy_smsc_init(void)
 {
phy_register(_driver);
phy_register(_driver);
phy_register(_driver);
+   phy_register(_driver);
 
return 0;
 }
-- 
1.8.3.1

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


Re: [U-Boot] [PATCH 1/2] net: phy: introduce a quirk PHY_BROKEN_RESET

2016-01-28 Thread Shaohui Xie
> -Original Message-
> From: Joe Hershberger [mailto:joe.hershber...@gmail.com]
> Sent: Wednesday, January 27, 2016 11:37 PM
> To: shaohui 谢 
> Cc: u-boot ; Joe Hershberger ;
> Shaohui Xie ; York Sun 
> Subject: Re: [U-Boot] [PATCH 1/2] net: phy: introduce a quirk PHY_BROKEN_RESET
> 
> On Tue, Jan 12, 2016 at 3:55 AM,   wrote:
> > From: Shaohui Xie 
> >
> > Current driver always performs a phy soft reset when connecting the
> > phy device, but soft reset is not always supported by a phy device, so
> > introduce a quirk PHY_BROKEN_RESET to let such a phy device to skip
> > soft reset. This commit uses 'flags' of phy device structure to store
> > the quirk.
> >
> > Signed-off-by: Shaohui Xie 
> > ---
> >  drivers/net/phy/phy.c | 3 +++
> >  include/phy.h | 1 +
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index
> > 51b5746..2a36ae7 100644
> > --- a/drivers/net/phy/phy.c
> > +++ b/drivers/net/phy/phy.c
> > @@ -707,6 +707,9 @@ int phy_reset(struct phy_device *phydev)
> > int timeout = 500;
> > int devad = MDIO_DEVAD_NONE;
> >
> > +   if (phydev->flags == PHY_BROKEN_RESET)
> 
> Please mask off this bit so this test still work if someone adds a different 
> flag.
> 
> E.g.: if (phydev->flags & PHY_BROKEN_RESET)
[S.H] OK. Will fix it.

> 
> > +   return 0;
> > +
> >  #ifdef CONFIG_PHYLIB_10G
> > /* If it's 10G, we need to issue reset through one of the MMDs */
> > if (is_10g_interface(phydev->interface)) { diff --git
> > a/include/phy.h b/include/phy.h index 66cf61b..5f604a1 100644
> > --- a/include/phy.h
> > +++ b/include/phy.h
> > @@ -16,6 +16,7 @@
> >  #include 
> >
> >  #define PHY_MAX_ADDR 32
> > +#define PHY_BROKEN_RESET   (1 << 0) /* soft reset not supported */
> 
> Please name this something like PHY_FLAG_BROKEN_RESET.
[S.H] OK. Will do.

Thank you!
Shaohui
> 
> >
> >  #define PHY_BASIC_FEATURES (SUPPORTED_10baseT_Half | \
> >  SUPPORTED_10baseT_Full | \
> > --
> > 2.1.0.27.g96db324
> >
> > ___
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Use correct spelling of "U-Boot"

2016-01-28 Thread Heiko Schocher

Hello Bin,

Am 27.01.2016 um 08:28 schrieb Bin Meng:

Correct spelling of "U-Boot" shall be used in all written text
(documentation, comments in source files etc.).

Signed-off-by: Bin Meng 

---
I cc'ed all maintainers, please help review in case I made any
mistakes. Also we should keep an eye on this when reviewing
patches in the future.


Reviewed-by: Heiko Schocher 

bye,
Heiko
--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] include:configs: Add usb device-tree fixup for all fsl platforms

2016-01-28 Thread Ramneek Mehresh


> -Original Message-
> From: Marek Vasut [mailto:ma...@denx.de]
> Sent: Wednesday, January 27, 2016 5:13 PM
> To: Ramneek Mehresh 
> Cc: Ramneek Mehresh ; u-
> b...@lists.denx.de; Simon Glass 
> Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for all 
> fsl
> platforms
> 
> On Wednesday, January 27, 2016 at 12:33:04 PM, Ramneek Mehresh wrote:
> > > -Original Message-
> > > From: Marek Vasut [mailto:ma...@denx.de]
> > > Sent: Wednesday, January 27, 2016 1:57 PM
> > > To: Ramneek Mehresh 
> > > Cc: Ramneek Mehresh ; u-
> > > b...@lists.denx.de; Simon Glass 
> > > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup for
> > > all fsl platforms
> > >
> > > On Wednesday, January 27, 2016 at 09:26:08 AM, Ramneek Mehresh
> wrote:
> > > > > -Original Message-
> > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > Sent: Wednesday, January 27, 2016 1:05 PM
> > > > > To: Ramneek Mehresh 
> > > > > Cc: Ramneek Mehresh ; u-
> > > > > b...@lists.denx.de; Simon Glass 
> > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree fixup
> > > > > for all fsl platforms
> > > > >
> > > > > On Wednesday, January 27, 2016 at 05:30:51 AM, Ramneek Mehresh
> > >
> > > wrote:
> > > > > > > -Original Message-
> > > > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > > > Sent: Wednesday, January 27, 2016 9:57 AM
> > > > > > > To: Ramneek Mehresh 
> > > > > > > Cc: Ramneek Mehresh ; u-
> > > > > > > b...@lists.denx.de; Simon Glass 
> > > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb device-tree
> > > > > > > fixup for all fsl platforms
> > > > > > >
> > > > > > > On Wednesday, January 27, 2016 at 05:14:00 AM, Ramneek
> Mehresh
> > > > >
> > > > > wrote:
> > > > > > > > > -Original Message-
> > > > > > > > > From: Marek Vasut [mailto:ma...@denx.de]
> > > > > > > > > Sent: Tuesday, January 26, 2016 4:58 PM
> > > > > > > > > To: Ramneek Mehresh 
> > > > > > > > > Cc: u-boot@lists.denx.de
> > > > > > > > > Subject: Re: [PATCH 2/2] include:configs: Add usb
> > > > > > > > > device-tree fixup for all fsl platforms
> > > > > > > > >
> > > > > > > > > On Tuesday, January 26, 2016 at 12:36:58 PM, Ramneek
> Mehresh
> > > > >
> > > > > wrote:
> > > > > > > > > > Add usb device-tree fixup for all relevant fsl ppc and arm
> > > > > > > > > > platforms
> > > > > > > > > >
> > > > > > > > > > Signed-off-by: Ramneek Mehresh
> > > > > > >
> > > > > > > 
> > > > > > >
> > > > > > > > > > ---
> > > > > > > > > >
> > > > > > > > > >  board/freescale/b4860qds/b4860qds.c | 2 +-
> > > > > > > > > >  board/freescale/bsc9131rdb/bsc9131rdb.c | 2 ++
> > > > > > > > > >  board/freescale/bsc9132qds/bsc9132qds.c | 2 ++
> > > > > > > > > >  board/freescale/corenet_ds/corenet_ds.c | 4 
> > > > > > > > > >  board/freescale/ls2080aqds/ls2080aqds.c | 4 
> > > > > > > > > >  board/freescale/ls2080ardb/ls2080ardb.c | 4 
> > > > > > > > > >  board/freescale/mpc8308rdb/mpc8308rdb.c | 4 
> > > > > > > > > >  board/freescale/mpc8315erdb/mpc8315erdb.c   | 2 ++
> > > > > > > > > >  board/freescale/mpc837xemds/mpc837xemds.c   | 2 ++
> > > > > > > > > >  board/freescale/mpc837xerdb/mpc837xerdb.c   | 2 ++
> > > > > > > > > >  board/freescale/mpc8536ds/mpc8536ds.c   | 2 +-
> > > > > > > > > >  board/freescale/p1010rdb/p1010rdb.c | 2 +-
> > > > > > > > > >  board/freescale/p1022ds/p1022ds.c   | 2 +-
> > > > > > > > > >  board/freescale/p1023rdb/p1023rdb.c | 2 +-
> > > > > > > > > >  board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +-
> > > > > > > > > >  board/freescale/p1_twr/p1_twr.c | 3 +++
> > > > > > > > > >  board/freescale/p2041rdb/p2041rdb.c | 2 +-
> > > > > > > > > >  board/freescale/t102xqds/t102xqds.c | 2 +-
> > > > > > > > > >  board/freescale/t102xrdb/t102xrdb.c | 3 +++
> > > > > > > > > >  board/freescale/t1040qds/t1040qds.c | 2 +-
> > > > > > > > > >  board/freescale/t104xrdb/t104xrdb.c | 2 +-
> > > > > > > > > >  board/freescale/t208xqds/t208xqds.c | 3 +++
> > > > > > > > > >  board/freescale/t208xrdb/t208xrdb.c | 3 +++
> > > > > > > > > >  board/freescale/t4qds/t4240emu.c| 3 +++
> > > > > > > > > >  board/freescale/t4qds/t4240qds.c| 3 +++
> > > > > > > > > >  board/freescale/t4rdb/t4240rdb.c| 3 +++
> > > > > > > > > >  include/configs/B4860QDS.h  | 1 +
> > > > > > > > > >  include/configs/BSC9131RDB.h| 1 +
> > > > > > > > > >  include/configs/BSC9132QDS.h| 3 ++-
> > > > > > > 

[U-Boot] [PATCH v4 09/13] drivers: mmc: add driver for Microchip PIC32 SDHCI controller.

2016-01-28 Thread Purna Chandra Mandal
From: Andrei Pistirica 

This driver implements platform specific glue and fixups for
PIC32 internal SDHCI controller.

Signed-off-by: Andrei Pistirica 
Signed-off-by: Sandeep Sheriker Mallikarjun 

Signed-off-by: Purna Chandra Mandal 
Reviewed-by: Tom Rini 
Reviewed-by: Daniel Schwierzeck 

---

Changes in v4:
- update Kconfig help message
- add CD errata under SDHCI_QUIRK_NO_CD

Changes in v3:
- remove ofdata_to_platdata, and replace platdata with priv
- replace pic32_ioremap() with ioremap()

Changes in v2:
- drop sdhci shared bus configuration (for shared interrupt, clock pins)

 drivers/mmc/Kconfig   |  6 +
 drivers/mmc/Makefile  |  2 +-
 drivers/mmc/pic32_sdhci.c | 58 +++
 drivers/mmc/sdhci.c   |  7 ++
 4 files changed, 72 insertions(+), 1 deletion(-)
 create mode 100644 drivers/mmc/pic32_sdhci.c

diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig
index ceae7bc..9f4b766 100644
--- a/drivers/mmc/Kconfig
+++ b/drivers/mmc/Kconfig
@@ -31,4 +31,10 @@ config SH_SDHI
help
  Support for the on-chip SDHI host controller on SuperH/Renesas ARM 
SoCs platform
 
+config PIC32_SDHCI
+   bool "Microchip PIC32 on-chip SDHCI support"
+   depends on DM_MMC && MACH_PIC32
+   help
+ Support for Microchip PIC32 SDHCI controller.
+
 endmenu
diff --git a/drivers/mmc/Makefile b/drivers/mmc/Makefile
index 5d35705..c9c3e3e 100644
--- a/drivers/mmc/Makefile
+++ b/drivers/mmc/Makefile
@@ -48,4 +48,4 @@ obj-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
 else
 obj-$(CONFIG_GENERIC_MMC) += mmc_write.o
 endif
-
+obj-$(CONFIG_PIC32_SDHCI) += pic32_sdhci.o
diff --git a/drivers/mmc/pic32_sdhci.c b/drivers/mmc/pic32_sdhci.c
new file mode 100644
index 000..28da55d
--- /dev/null
+++ b/drivers/mmc/pic32_sdhci.c
@@ -0,0 +1,58 @@
+/*
+ * Support of SDHCI for Microchip PIC32 SoC.
+ *
+ * Copyright (C) 2015 Microchip Technology Inc.
+ * Andrei Pistirica 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static int pic32_sdhci_probe(struct udevice *dev)
+{
+   struct sdhci_host *host = dev_get_priv(dev);
+   const void *fdt = gd->fdt_blob;
+   u32 f_min_max[2];
+   fdt_addr_t addr;
+   fdt_size_t size;
+   int ret;
+
+   addr = fdtdec_get_addr_size(fdt, dev->of_offset, "reg", );
+   if (addr == FDT_ADDR_T_NONE)
+   return -EINVAL;
+
+   host->ioaddr= ioremap(addr, size);
+   host->name  = (char *)dev->name;
+   host->quirks= SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_NO_CD;
+   host->bus_width = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
+   "bus-width", 4);
+
+   ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset,
+  "clock-freq-min-max", f_min_max, 2);
+   if (ret) {
+   printf("sdhci: clock-freq-min-max not found\n");
+   return ret;
+   }
+
+   return add_sdhci(host, f_min_max[1], f_min_max[0]);
+}
+
+static const struct udevice_id pic32_sdhci_ids[] = {
+   { .compatible = "microchip,pic32mzda-sdhci" },
+   { }
+};
+
+U_BOOT_DRIVER(pic32_sdhci_drv) = {
+   .name   = "pic32_sdhci",
+   .id = UCLASS_MMC,
+   .of_match   = pic32_sdhci_ids,
+   .probe  = pic32_sdhci_probe,
+   .priv_auto_alloc_size   = sizeof(struct sdhci_host),
+};
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 02d71b9..f77b707 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -443,6 +443,12 @@ static int sdhci_init(struct mmc *mmc)
sdhci_set_power(host, fls(mmc->cfg->voltages) - 1);
 
if (host->quirks & SDHCI_QUIRK_NO_CD) {
+#if defined(CONFIG_PIC32_SDHCI)
+   /* PIC32 SDHCI CD errata:
+* - set CD_TEST and clear CD_TEST_INS bit
+*/
+   sdhci_writeb(host, SDHCI_CTRL_CD_TEST, SDHCI_HOST_CONTROL);
+#else
unsigned int status;
 
sdhci_writeb(host, SDHCI_CTRL_CD_TEST_INS | SDHCI_CTRL_CD_TEST,
@@ -453,6 +459,7 @@ static int sdhci_init(struct mmc *mmc)
(!(status & SDHCI_CARD_STATE_STABLE)) ||
(!(status & SDHCI_CARD_DETECT_PIN_LEVEL)))
status = sdhci_readl(host, SDHCI_PRESENT_STATE);
+#endif
}
 
/* Enable only interrupts served by the SD controller */
-- 
1.8.3.1

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


[U-Boot] [PATCH v4 06/13] drivers: ddr: Add DDR2 SDRAM controller driver for Microchip PIC32.

2016-01-28 Thread Purna Chandra Mandal
This driver initializes PIC32 DDR2 SDRAM controller and internal DDR2 Phy 
module.
DDR2 controller operates in half-rate mode (upto 533MHZ frequency).

Signed-off-by: Paul Thacker 
Signed-off-by: Purna Chandra Mandal 
Reviewed-by: Daniel Schwierzeck 
Reviewed-by: Tom Rini 
Reviewed-by: Simon Glass 


---

Changes in v4: None
Changes in v3:
- annotating fixed table with const
- fix camel-case in ddr2 timing parameters
- fix cmd index parameter of host_load_cmd().
- fix compilation warning

Changes in v2:
- move ddr2 initialization from board/microchip/ to drivers/ddr/microchip

 arch/mips/mach-pic32/include/mach/ddr.h |  32 
 drivers/Makefile|   1 +
 drivers/ddr/microchip/Makefile  |   6 +
 drivers/ddr/microchip/ddr2.c| 278 
 drivers/ddr/microchip/ddr2_regs.h   | 148 +
 drivers/ddr/microchip/ddr2_timing.h |  65 
 6 files changed, 530 insertions(+)
 create mode 100644 arch/mips/mach-pic32/include/mach/ddr.h
 create mode 100644 drivers/ddr/microchip/Makefile
 create mode 100644 drivers/ddr/microchip/ddr2.c
 create mode 100644 drivers/ddr/microchip/ddr2_regs.h
 create mode 100644 drivers/ddr/microchip/ddr2_timing.h

diff --git a/arch/mips/mach-pic32/include/mach/ddr.h 
b/arch/mips/mach-pic32/include/mach/ddr.h
new file mode 100644
index 000..00abfa3
--- /dev/null
+++ b/arch/mips/mach-pic32/include/mach/ddr.h
@@ -0,0 +1,32 @@
+/*
+ * (c) 2015 Purna Chandra Mandal 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ *
+ */
+
+#ifndef __MICROCHIP_PIC32_DDR_H
+#define __MICROCHIP_PIC32_DDR_H
+
+/* called by initdram() function */
+void ddr2_phy_init(void);
+void ddr2_ctrl_init(void);
+phys_size_t ddr2_calculate_size(void);
+
+/* Maximum number of agents */
+#define NUM_AGENTS 5
+
+/* Board can provide agent specific parameters for arbitration by
+ * filling struct ddr2_arbiter_params for all the agents and
+ * implementing board_get_ddr_arbiter_params() to return the filled
+ * structure.
+ */
+struct ddr2_arbiter_params {
+   u32 min_limit;  /* min bursts to execute per arbitration */
+   u32 req_period; /* request period threshold for accepted cmds */
+   u32 min_cmd_acpt; /* min number of accepted cmds */
+};
+
+const struct ddr2_arbiter_params *board_get_ddr_arbiter_params(void);
+
+#endif /* __MICROCHIP_PIC32_DDR_H */
diff --git a/drivers/Makefile b/drivers/Makefile
index 6294048..e7eab66 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -69,4 +69,5 @@ obj-y += soc/
 obj-$(CONFIG_REMOTEPROC) += remoteproc/
 obj-y += thermal/
 
+obj-$(CONFIG_MACH_PIC32) += ddr/microchip/
 endif
diff --git a/drivers/ddr/microchip/Makefile b/drivers/ddr/microchip/Makefile
new file mode 100644
index 000..305c48b
--- /dev/null
+++ b/drivers/ddr/microchip/Makefile
@@ -0,0 +1,6 @@
+#
+# Copyright (C) 2015 Microchip Technology Inc.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+obj-$(CONFIG_MACH_PIC32) += ddr2.o
diff --git a/drivers/ddr/microchip/ddr2.c b/drivers/ddr/microchip/ddr2.c
new file mode 100644
index 000..6056418
--- /dev/null
+++ b/drivers/ddr/microchip/ddr2.c
@@ -0,0 +1,278 @@
+/*
+ * (c) 2015 Paul Thacker 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "ddr2_regs.h"
+#include "ddr2_timing.h"
+
+/* init DDR2 Phy */
+void ddr2_phy_init(void)
+{
+   struct ddr2_phy_regs *ddr2_phy;
+   u32 pad_ctl;
+
+   ddr2_phy = ioremap(PIC32_DDR2P_BASE, sizeof(*ddr2_phy));
+
+   /* PHY_DLL_RECALIB */
+   writel(DELAY_START_VAL(3) | DISABLE_RECALIB(0) |
+  RECALIB_CNT(0x10), _phy->dll_recalib);
+
+   /* PHY_PAD_CTRL */
+   pad_ctl = ODT_SEL | ODT_EN | DRIVE_SEL(0) |
+ ODT_PULLDOWN(2) | ODT_PULLUP(3) |
+ EXTRA_OEN_CLK(0) | NOEXT_DLL |
+ DLR_DFT_WRCMD | HALF_RATE |
+ DRVSTR_PFET(0xe) | DRVSTR_NFET(0xe) |
+ RCVR_EN | PREAMBLE_DLY(2);
+   writel(pad_ctl, _phy->pad_ctrl);
+
+   /* SCL_CONFIG_0 */
+   writel(SCL_BURST8 | SCL_DDR_CONNECTED | SCL_RCAS_LAT(RL) |
+  SCL_ODTCSWW, _phy->scl_config_1);
+
+   /* SCL_CONFIG_1 */
+   writel(SCL_CSEN | SCL_WCAS_LAT(WL), _phy->scl_config_2);
+
+   /* SCL_LAT */
+   writel(SCL_CAPCLKDLY(3) | SCL_DDRCLKDLY(4), _phy->scl_latency);
+}
+
+/* start phy self calibration logic */
+static int ddr2_phy_calib_start(void)
+{
+   struct ddr2_phy_regs *ddr2_phy;
+
+   ddr2_phy = ioremap(PIC32_DDR2P_BASE, sizeof(*ddr2_phy));
+
+   /* DDR Phy SCL Start */
+   writel(SCL_START | SCL_EN, _phy->scl_start);
+
+   /* Wait for SCL for data byte to pass */
+   return wait_for_bit(__func__, _phy->scl_start, SCL_LUBPASS,
+

[U-Boot] [PATCH v4 07/13] MIPS: Add support for Microchip PIC32MZ[DA] SoC family.

2016-01-28 Thread Purna Chandra Mandal
Add Microchip PIC32MZ[DA] SoC family support.

Signed-off-by: Purna Chandra Mandal 

---

Changes in v4:
- drop forcing DM_SERIAL, PIC32_SERIAL, PIC32_PINCTRL in mach-pic32/Kconfig
- drop extra include
- rename clock compatible to "pic32mzda-clk" from "pic32mzda_clk".
- fix typo 'clock-cells' to '#clock-cells'

Changes in v3:
- drop forcing CONFIG_MIPS_BOOT_* selection in mach-pic32/Kconfig
- indent assembly instructions in delay slot
- made GPIO-nodes child of pinctrl-node in devicetree
- replace pic32_ioremap() with ioremap()

Changes in v2:
- drop board_early_init_f
- use macro LEAF(), END() for lowlevel_init
- move initialization of board_init_f() argument to common start.S
- move initdram() from board/microchip/ to mach-pic32/cpu.c
- remove MIPS virtual address in favor physical one in dts file

 arch/mips/dts/pic32mzda.dtsi  | 153 ++
 arch/mips/mach-pic32/Kconfig  |  17 +++-
 arch/mips/mach-pic32/Makefile |   2 +-
 arch/mips/mach-pic32/cpu.c| 143 
 arch/mips/mach-pic32/include/mach/pic32.h |   3 +
 arch/mips/mach-pic32/lowlevel_init.S  |  27 ++
 arch/mips/mach-pic32/reset.c  |  36 +++
 7 files changed, 379 insertions(+), 2 deletions(-)
 create mode 100644 arch/mips/dts/pic32mzda.dtsi
 create mode 100644 arch/mips/mach-pic32/lowlevel_init.S
 create mode 100644 arch/mips/mach-pic32/reset.c

diff --git a/arch/mips/dts/pic32mzda.dtsi b/arch/mips/dts/pic32mzda.dtsi
new file mode 100644
index 000..c67cfa9
--- /dev/null
+++ b/arch/mips/dts/pic32mzda.dtsi
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2015 Microchip Technology, Inc.
+ * Purna Chandra Mandal, 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include "skeleton.dtsi"
+
+/ {
+   compatible = "microchip,pic32mzda", "microchip,pic32mz";
+
+   aliases {
+   gpio0 = 
+   gpio1 = 
+   gpio2 = 
+   gpio3 = 
+   gpio4 = 
+   gpio5 = 
+   gpio6 = 
+   gpio7 = 
+   gpio8 = 
+   gpio9 = 
+   };
+
+   cpus {
+   cpu@0 {
+   compatible = "mips,mips14kc";
+   };
+   };
+
+   clock: clk@1f801200 {
+   compatible = "microchip,pic32mzda-clk";
+   reg = <0x1f801200 0x1000>;
+   #clock-cells = <1>;
+   };
+
+   uart1: serial@1f822000 {
+   compatible = "microchip,pic32mzda-uart";
+   reg = <0x1f822000 0x50>;
+   interrupts = <112 IRQ_TYPE_LEVEL_HIGH>;
+   status = "disabled";
+   clocks = < PB2CLK>;
+   };
+
+   uart2: serial@1f822200 {
+   compatible = "microchip,pic32mzda-uart";
+   reg = <0x1f822200 0x50>;
+   interrupts = <145 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = < PB2CLK>;
+   status = "disabled";
+   };
+
+   uart6: serial@1f822a00 {
+   compatible = "microchip,pic32mzda-uart";
+   reg = <0x1f822a00 0x50>;
+   interrupts = <188 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = < PB2CLK>;
+   status = "disabled";
+   };
+
+   evic: interrupt-controller@1f81 {
+   compatible = "microchip,pic32mzda-evic";
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   reg = <0x1f81 0x1000>;
+   };
+
+   pinctrl: pinctrl@1f801400 {
+   compatible = "microchip,pic32mzda-pinctrl";
+   reg = <0x1f801400 0x100>, /* in  */
+ <0x1f801500 0x200>, /* out */
+ <0x1f86 0xa00>; /* port */
+   reg-names = "ppsin","ppsout","port";
+   status = "disabled";
+
+   ranges = <0 0x1f86 0xa00>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+   gpioA: gpio0@0 {
+   compatible = "microchip,pic32mzda-gpio";
+   reg = <0x000 0x48>;
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
+   gpioB: gpio1@100 {
+   compatible = "microchip,pic32mzda-gpio";
+   reg = <0x100 0x48>;
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
+   gpioC: gpio2@200 {
+   compatible = "microchip,pic32mzda-gpio";
+   reg = <0x200 0x48>;
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
+   gpioD: gpio3@300 {
+   compatible = "microchip,pic32mzda-gpio";
+   reg = <0x300 0x48>;
+   gpio-controller;
+ 

[U-Boot] [PATCH v4 08/13] board: Add Microchip PIC32MZ[DA]-Starter-Kit board.

2016-01-28 Thread Purna Chandra Mandal
This adds support for Microchip PIC32MZ[DA] StarterKit board
based on a PIC32MZ[DA] family of microcontroller.

Signed-off-by: Purna Chandra Mandal 


---

Changes in v4:
- create defconfig by 'make savedefconfig'
- drop explicit SYS_BAUDRATE_TABLE in favor of default one

Changes in v3:
- drop SKIP_LOWLEVEL_INIT, GBL_DATA_OFFSET from config header
- move CMD_MEMTEST, CMD_MEMINFO to defconfig
- increase SYS_MALLOC_F_LEN to 0x600
- use auto-generated defconfig - no hand edit

Changes in v2:
- move CONFIG_SYS_TEXT_BASE (from board/*/config.mk) to 
include/configs/.h

 arch/mips/dts/Makefile|  2 +-
 arch/mips/dts/pic32mzda_sk.dts| 38 ++
 arch/mips/mach-pic32/Kconfig  | 13 +
 board/microchip/pic32mzda/Kconfig | 13 +
 board/microchip/pic32mzda/MAINTAINERS |  6 +++
 board/microchip/pic32mzda/Makefile|  7 +++
 board/microchip/pic32mzda/README  | 22 +
 board/microchip/pic32mzda/pic32mzda.c | 31 
 configs/pic32mzdask_defconfig | 30 +++
 include/configs/pic32mzdask.h | 93 +++
 10 files changed, 254 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/dts/pic32mzda_sk.dts
 create mode 100644 board/microchip/pic32mzda/Kconfig
 create mode 100644 board/microchip/pic32mzda/MAINTAINERS
 create mode 100644 board/microchip/pic32mzda/Makefile
 create mode 100644 board/microchip/pic32mzda/README
 create mode 100644 board/microchip/pic32mzda/pic32mzda.c
 create mode 100644 configs/pic32mzdask_defconfig
 create mode 100644 include/configs/pic32mzdask.h

diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile
index 47b6eb5..b513918 100644
--- a/arch/mips/dts/Makefile
+++ b/arch/mips/dts/Makefile
@@ -2,7 +2,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-dtb-y +=
+dtb-$(CONFIG_TARGET_PIC32MZDASK) += pic32mzda_sk.dtb
 
 targets += $(dtb-y)
 
diff --git a/arch/mips/dts/pic32mzda_sk.dts b/arch/mips/dts/pic32mzda_sk.dts
new file mode 100644
index 000..99e7f64
--- /dev/null
+++ b/arch/mips/dts/pic32mzda_sk.dts
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2015 Purna Chandra Mandal, purna.man...@microchip.com
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+/dts-v1/;
+
+#include "pic32mzda.dtsi"
+
+/ {
+   model = "Microchip PIC32MZDASK";
+   compatible = "microchip,pic32mzdask", "microchip,pic32mzda";
+
+   aliases {
+   console = 
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+};
+
+ {
+   status = "okay";
+   u-boot,dm-pre-reloc;
+};
+
+ {
+   status = "okay";
+   u-boot,dm-pre-reloc;
+};
+
+ {
+   status = "okay";
+   u-boot,dm-pre-reloc;
+};
diff --git a/arch/mips/mach-pic32/Kconfig b/arch/mips/mach-pic32/Kconfig
index f636266..2e38bb7 100644
--- a/arch/mips/mach-pic32/Kconfig
+++ b/arch/mips/mach-pic32/Kconfig
@@ -19,4 +19,17 @@ config SOC_PIC32MZDA
 
 endchoice
 
+choice
+   prompt "Board select"
+
+config TARGET_PIC32MZDASK
+   bool "Microchip PIC32MZ[DA] Starter Kit"
+   depends on SOC_PIC32MZDA
+   help
+ This supports Microchip PIC32MZ[DA] Starter Kit.
+
+endchoice
+
+source "board/microchip/pic32mzda/Kconfig"
+
 endmenu
diff --git a/board/microchip/pic32mzda/Kconfig 
b/board/microchip/pic32mzda/Kconfig
new file mode 100644
index 000..8acb393
--- /dev/null
+++ b/board/microchip/pic32mzda/Kconfig
@@ -0,0 +1,13 @@
+
+if TARGET_PIC32MZDASK
+
+config SYS_BOARD
+   default "pic32mzda"
+
+config SYS_VENDOR
+   default "microchip"
+
+config SYS_CONFIG_NAME
+   default "pic32mzdask"
+
+endif
diff --git a/board/microchip/pic32mzda/MAINTAINERS 
b/board/microchip/pic32mzda/MAINTAINERS
new file mode 100644
index 000..c934f1a
--- /dev/null
+++ b/board/microchip/pic32mzda/MAINTAINERS
@@ -0,0 +1,6 @@
+PIC32MZDASK BOARD
+M: Purna Chandra Mandal 
+S: Maintained
+F: board/microchip/pic32mzda/
+F: include/configs/pic32mzdask.h
+F: configs/pic32mzdask_defconfig
diff --git a/board/microchip/pic32mzda/Makefile 
b/board/microchip/pic32mzda/Makefile
new file mode 100644
index 000..3629530
--- /dev/null
+++ b/board/microchip/pic32mzda/Makefile
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2015
+# Purna Chandra Mandal, purna.man...@microchip.com.
+#
+# SPDX-License-Identifier:  GPL-2.0+
+#
+obj-y := pic32mzda.o
diff --git a/board/microchip/pic32mzda/README b/board/microchip/pic32mzda/README
new file mode 100644
index 000..91d16ab
--- /dev/null
+++ b/board/microchip/pic32mzda/README
@@ -0,0 +1,22 @@
+/*
+ * (c) 2015 Purna Chandra Mandal 
+ */
+
+PIC32MZ[DA] Starter Kit
+
+PIC32MZ[DA] Starter Kit is based on PIC32MZ[DA] family of micro-controller.
+This family is powered by MIPS M14KEC 32bit general purpose core and has
+advanced microcontroller features and peripherals.
+
+This processor 

[U-Boot] [PATCH v4 04/13] drivers: gpio: add driver for Microchip PIC32 GPIO controller.

2016-01-28 Thread Purna Chandra Mandal
In PIC32 GPIO controller is part of PIC32 pin controller.
PIC32 has ten independently programmable ports and each with multiple pins.
Each of these pins can be configured and used as GPIO, provided they
are not in use for other peripherals.

Signed-off-by: Purna Chandra Mandal 
Reviewed-by: Tom Rini 
Reviewed-by: Simon Glass 
Reviewed-by: Daniel Schwierzeck 

---

Changes in v4:
- update kconfig dependency on DM && MACH_PIC32, and default y
- drop ioremap failure check
- return -EPERM if the pin is found in analog mode
- drop desc->offset setting in _gpio_xlate()

Changes in v3:
- add check on dev_get_addr()

Changes in v2: None

 drivers/gpio/Kconfig  |   7 ++
 drivers/gpio/Makefile |   2 +-
 drivers/gpio/pic32_gpio.c | 174 ++
 3 files changed, 182 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpio/pic32_gpio.c

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index e60e9fd..845dc72 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -83,4 +83,11 @@ config VYBRID_GPIO
help
  Say yes here to support Vybrid vf610 GPIOs.
 
+config PIC32_GPIO
+   bool "Microchip PIC32 GPIO driver"
+   depends on DM_GPIO && MACH_PIC32
+   default y
+   help
+ Say yes here to support Microchip PIC32 GPIOs.
+
 endmenu
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index fb4fd25..845a6d4 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -46,4 +46,4 @@ obj-$(CONFIG_STM32_GPIO)  += stm32_gpio.o
 obj-$(CONFIG_ZYNQ_GPIO)+= zynq_gpio.o
 obj-$(CONFIG_VYBRID_GPIO)  += vybrid_gpio.o
 obj-$(CONFIG_HIKEY_GPIO)   += hi6220_gpio.o
-
+obj-$(CONFIG_PIC32_GPIO)   += pic32_gpio.o
diff --git a/drivers/gpio/pic32_gpio.c b/drivers/gpio/pic32_gpio.c
new file mode 100644
index 000..499b4fa
--- /dev/null
+++ b/drivers/gpio/pic32_gpio.c
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2015 Microchip Technology Inc
+ * Purna Chandra Mandal 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* Peripheral Pin Control */
+struct pic32_reg_port {
+   struct pic32_reg_atomic ansel;
+   struct pic32_reg_atomic tris;
+   struct pic32_reg_atomic port;
+   struct pic32_reg_atomic lat;
+   struct pic32_reg_atomic open_drain;
+   struct pic32_reg_atomic cnpu;
+   struct pic32_reg_atomic cnpd;
+   struct pic32_reg_atomic cncon;
+};
+
+enum {
+   MICROCHIP_GPIO_DIR_OUT,
+   MICROCHIP_GPIO_DIR_IN,
+   MICROCHIP_GPIOS_PER_BANK = 16,
+};
+
+struct pic32_gpio_priv {
+   struct pic32_reg_port *regs;
+   char name[2];
+};
+
+static int pic32_gpio_get_value(struct udevice *dev, unsigned offset)
+{
+   struct pic32_gpio_priv *priv = dev_get_priv(dev);
+
+   return !!(readl(>regs->port.raw) & BIT(offset));
+}
+
+static int pic32_gpio_set_value(struct udevice *dev, unsigned offset,
+   int value)
+{
+   struct pic32_gpio_priv *priv = dev_get_priv(dev);
+   int mask = BIT(offset);
+
+   if (value)
+   writel(mask, >regs->port.set);
+   else
+   writel(mask, >regs->port.clr);
+
+   return 0;
+}
+
+static int pic32_gpio_direction(struct udevice *dev, unsigned offset)
+{
+   struct pic32_gpio_priv *priv = dev_get_priv(dev);
+
+   /* pin in analog mode ? */
+   if (readl(>regs->ansel.raw) & BIT(offset))
+   return -EPERM;
+
+   if (readl(>regs->tris.raw) & BIT(offset))
+   return MICROCHIP_GPIO_DIR_IN;
+   else
+   return MICROCHIP_GPIO_DIR_OUT;
+}
+
+static int pic32_gpio_direction_input(struct udevice *dev, unsigned offset)
+{
+   struct pic32_gpio_priv *priv = dev_get_priv(dev);
+   int mask = BIT(offset);
+
+   writel(mask, >regs->ansel.clr);
+   writel(mask, >regs->tris.set);
+
+   return 0;
+}
+
+static int pic32_gpio_direction_output(struct udevice *dev,
+  unsigned offset, int value)
+{
+   struct pic32_gpio_priv *priv = dev_get_priv(dev);
+   int mask = BIT(offset);
+
+   writel(mask, >regs->ansel.clr);
+   writel(mask, >regs->tris.clr);
+
+   pic32_gpio_set_value(dev, offset, value);
+   return 0;
+}
+
+static int pic32_gpio_xlate(struct udevice *dev, struct gpio_desc *desc,
+   struct fdtdec_phandle_args *args)
+{
+   desc->flags = args->args[1] & GPIO_ACTIVE_LOW ? GPIOD_ACTIVE_LOW : 0;
+
+   return 0;
+}
+
+static int pic32_gpio_get_function(struct udevice *dev, unsigned offset)
+{
+   int ret = GPIOF_UNUSED;
+
+   switch (pic32_gpio_direction(dev, offset)) {
+   case MICROCHIP_GPIO_DIR_OUT:
+   ret = GPIOF_OUTPUT;
+

[U-Boot] [PATCH v4 10/13] board: add SDHCI support for PIC32MZDASK board.

2016-01-28 Thread Purna Chandra Mandal
Enable MMC, SDHCI, FAT_FS support for PIC32MZ[DA] StarterKit.
Also add custom scripts, rules to boot Linux from microSD card.

Signed-off-by: Purna Chandra Mandal 

---

Changes in v4: None
Changes in v3:
- use distro boot commands from config_distro_bootcmd.h
- separate old booting logic as legacy_bootcmd

Changes in v2:
- drop shared bus (shared pin selection) configuration.

 arch/mips/dts/pic32mzda.dtsi   | 11 
 arch/mips/dts/pic32mzda_sk.dts |  7 +
 configs/pic32mzdask_defconfig  |  3 ++-
 include/configs/pic32mzdask.h  | 59 --
 4 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/arch/mips/dts/pic32mzda.dtsi b/arch/mips/dts/pic32mzda.dtsi
index c67cfa9..f1894ec 100644
--- a/arch/mips/dts/pic32mzda.dtsi
+++ b/arch/mips/dts/pic32mzda.dtsi
@@ -150,4 +150,15 @@
#gpio-cells = <2>;
};
};
+
+   sdhci: sdhci@1f8ec000 {
+   compatible = "microchip,pic32mzda-sdhci";
+   reg = <0x1f8ec000 0x100>;
+   interrupts = <191 IRQ_TYPE_LEVEL_HIGH>;
+   clocks = < REF4CLK>, < PB5CLK>;
+   clock-names = "base_clk", "sys_clk";
+   clock-freq-min-max = <2500>,<2500>;
+   bus-width = <4>;
+   status = "disabled";
+   };
 };
diff --git a/arch/mips/dts/pic32mzda_sk.dts b/arch/mips/dts/pic32mzda_sk.dts
index 99e7f64..f886a0f 100644
--- a/arch/mips/dts/pic32mzda_sk.dts
+++ b/arch/mips/dts/pic32mzda_sk.dts
@@ -23,6 +23,9 @@
 };
 
  {
+   microchip,refo2-frequency = <5000>;
+   microchip,refo4-frequency = <2500>;
+   microchip,refo5-frequency = <4000>;
status = "okay";
u-boot,dm-pre-reloc;
 };
@@ -36,3 +39,7 @@
status = "okay";
u-boot,dm-pre-reloc;
 };
+
+ {
+   status = "okay";
+};
\ No newline at end of file
diff --git a/configs/pic32mzdask_defconfig b/configs/pic32mzdask_defconfig
index 1c968fc..55ba3f8 100644
--- a/configs/pic32mzdask_defconfig
+++ b/configs/pic32mzdask_defconfig
@@ -9,7 +9,6 @@ CONFIG_DEFAULT_DEVICE_TREE="pic32mzda_sk"
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="dask # "
 # CONFIG_CMD_IMLS is not set
-# CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_SAVEENV is not set
 CONFIG_LOOPW=y
 CONFIG_CMD_MEMTEST=y
@@ -22,6 +21,8 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_TIME=y
 CONFIG_OF_EMBED=y
 CONFIG_CLK=y
+CONFIG_DM_MMC=y
+CONFIG_PIC32_SDHCI=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_FULL is not set
 CONFIG_SYS_VSNPRINTF=y
diff --git a/include/configs/pic32mzdask.h b/include/configs/pic32mzdask.h
index 5ba2a19..b258038 100644
--- a/include/configs/pic32mzdask.h
+++ b/include/configs/pic32mzdask.h
@@ -46,6 +46,7 @@
 
 #define CONFIG_SYS_LOAD_ADDR   0x8850 /* default load address */
 #define CONFIG_SYS_ENV_ADDR0x8830
+#define CONFIG_SYS_FDT_ADDR0x89d0
 
 /* Memory Test */
 #define CONFIG_SYS_MEMTEST_START   0x8800
@@ -77,6 +78,33 @@
  */
 #define CONFIG_OF_LIBFDT   1
 
+/*---
+ * SDHC Configuration
+ */
+#define CONFIG_SDHCI
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_MMC
+
+/*---
+ * File System Configuration
+ */
+/* FAT FS */
+#define CONFIG_DOS_PARTITION
+#define CONFIG_PARTITION_UUIDS
+#define CONFIG_SUPPORT_VFAT
+#define CONFIG_FS_FAT
+#define CONFIG_FAT_WRITE
+#define CONFIG_CMD_FS_GENERIC
+#define CONFIG_CMD_PART
+#define CONFIG_CMD_FAT
+
+/* EXT4 FS */
+#define CONFIG_FS_EXT4
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
+
 /* -
  * Environment
  */
@@ -87,7 +115,34 @@
  * Board boot configuration
  */
 #define CONFIG_TIMESTAMP   /* Print image info with timestamp */
-#define CONFIG_BOOTDELAY   5 /* autoboot after X seconds */
-#undef CONFIG_BOOTARGS
+#define CONFIG_BOOTDELAY   5
+
+#define MEM_LAYOUT_ENV_SETTINGS\
+   "kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0"   \
+   "fdt_addr_r="__stringify(CONFIG_SYS_FDT_ADDR)"\0"   \
+   "scriptaddr="__stringify(CONFIG_SYS_ENV_ADDR)"\0"
+
+#define CONFIG_LEGACY_BOOTCMD_ENV  \
+   "legacy_bootcmd= "  \
+   "if load mmc 0 ${scriptaddr} uEnv.txt; then "   \
+   "env import -tr ${scriptaddr} ${filesize}; "\
+   "if test -n \"${bootcmd_uenv}\" ; then "\
+   "echo Running bootcmd_uenv ...; "   \
+   "run bootcmd_uenv; "\
+   "fi; "  \
+   "fi; \0"
+
+#define BOOT_TARGET_DEVICES(func)  \
+   func(MMC, 

  1   2   3   >