[U-Boot] [PATCH v2 6/6] test: add rsa_verify() unit test

2019-10-28 Thread AKASHI Takahiro
In this patch, a very simple test is added to verify that rsa_verify()
using rsa_verify_with_pkey() work correctly.

To keep the code simple, all the test data, either public key and
verified binary data, are embedded in the source.

Signed-off-by: AKASHI Takahiro 
---
 test/lib/Kconfig  |  12 +++
 test/lib/Makefile |   1 +
 test/lib/rsa.c| 207 ++
 3 files changed, 220 insertions(+)
 create mode 100644 test/lib/rsa.c

diff --git a/test/lib/Kconfig b/test/lib/Kconfig
index f8bf36bf65f1..ef8504d9dc6e 100644
--- a/test/lib/Kconfig
+++ b/test/lib/Kconfig
@@ -20,4 +20,16 @@ config UT_LIB_ASN1
  Enables a test which exercises asn1 compiler and decoder function
  via various parsers.
 
+config UT_LIB_RSA
+   bool "Unit test for rsa_verify() function"
+   imply RSA
+   imply ASYMMETRIC_KEY_TYPE
+   imply ASYMMETRIC_PUBLIC_KEY_SUBTYPE
+   imply RSA_PUBLIC_KEY_PARSER
+   imply RSA_VERIFY_WITH_PKEY
+   default y
+   help
+ Enables rsa_verify() test, currently rsa_verify_with_pkey only()
+ only, at the 'ut lib' command.
+
 endif
diff --git a/test/lib/Makefile b/test/lib/Makefile
index 50a07e717d27..a40ccbbc0dc4 100644
--- a/test/lib/Makefile
+++ b/test/lib/Makefile
@@ -8,3 +8,4 @@ obj-y += lmb.o
 obj-y += string.o
 
 obj-$(CONFIG_UT_LIB_ASN1) += asn1.o
+obj-$(CONFIG_UT_LIB_RSA) += rsa.o
diff --git a/test/lib/rsa.c b/test/lib/rsa.c
new file mode 100644
index ..ef3860b59a2b
--- /dev/null
+++ b/test/lib/rsa.c
@@ -0,0 +1,207 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2019 Linaro Limited
+ * Author: AKASHI Takahiro
+ *
+ * Unit test for rsa_verify() function
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#ifdef CONFIG_RSA_VERIFY_WITH_PKEY
+/*
+ * openssl genrsa 2048 -out private.pem
+ * openssl rsa -in private.pem -pubout -outform der -out public.der
+ * dd if=public.der of=public.raw bs=24 skip=1
+ */
+static unsigned char public_key[] = {
+   0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xca, 0x25, 0x23,
+   0xe0, 0x0a, 0x4d, 0x8f, 0x56, 0xfc, 0xc9, 0x06, 0x4c, 0xcc, 0x94, 0x43,
+   0xe0, 0x56, 0x44, 0x6e, 0x37, 0x54, 0x87, 0x12, 0x84, 0xf9, 0x07, 0x4f,
+   0xe4, 0x23, 0x40, 0xc3, 0x43, 0x84, 0x37, 0x86, 0xd3, 0x9d, 0x95, 0x1c,
+   0xe4, 0x8a, 0x66, 0x02, 0x09, 0xe2, 0x3d, 0xce, 0x2c, 0xc6, 0x02, 0x6a,
+   0xd4, 0x65, 0x61, 0xff, 0x85, 0x6f, 0x88, 0x63, 0xba, 0x31, 0x62, 0x1e,
+   0xb7, 0x95, 0xe9, 0x08, 0x3c, 0xe9, 0x35, 0xde, 0xfd, 0x65, 0x92, 0xb8,
+   0x9e, 0x71, 0xa4, 0xcd, 0x47, 0xfd, 0x04, 0x26, 0xb9, 0x78, 0xbf, 0x05,
+   0x0d, 0xfc, 0x00, 0x84, 0x08, 0xfc, 0xc4, 0x4b, 0xea, 0xf5, 0x97, 0x68,
+   0x0d, 0x97, 0xd7, 0xff, 0x4f, 0x92, 0x82, 0xd7, 0xbb, 0xef, 0xb7, 0x67,
+   0x8e, 0x72, 0x54, 0xe8, 0xc5, 0x9e, 0xfd, 0xd8, 0x38, 0xe9, 0xbe, 0x19,
+   0x37, 0x5b, 0x36, 0x8b, 0xbf, 0x49, 0xa1, 0x59, 0x3a, 0x9d, 0xad, 0x92,
+   0x08, 0x0b, 0xe3, 0xa4, 0xa4, 0x7d, 0xd3, 0x70, 0xc0, 0xb8, 0xfb, 0xc7,
+   0xda, 0xd3, 0x19, 0x86, 0x37, 0x9a, 0xcd, 0xab, 0x30, 0x96, 0xab, 0xa4,
+   0xa2, 0x31, 0xa0, 0x38, 0xfb, 0xbf, 0x85, 0xd3, 0x24, 0x39, 0xed, 0xbf,
+   0xe1, 0x31, 0xed, 0x6c, 0x39, 0xc1, 0xe5, 0x05, 0x2e, 0x12, 0x30, 0x36,
+   0x73, 0x5d, 0x62, 0xf3, 0x82, 0xaf, 0x38, 0xc8, 0xca, 0xfa, 0xa1, 0x99,
+   0x57, 0x3c, 0xe1, 0xc1, 0x7b, 0x05, 0x0b, 0xcc, 0x2e, 0xa9, 0x10, 0xc8,
+   0x68, 0xbd, 0x27, 0xb6, 0x19, 0x9c, 0xd2, 0xad, 0xb3, 0x1f, 0xca, 0x35,
+   0x6e, 0x84, 0x23, 0xa1, 0xe9, 0xa4, 0x4c, 0xab, 0x19, 0x09, 0x79, 0x6e,
+   0x3c, 0x7b, 0x74, 0xfc, 0x33, 0x05, 0xcf, 0xa4, 0x2e, 0xeb, 0x55, 0x60,
+   0x05, 0xc7, 0xcf, 0x3f, 0x92, 0xac, 0x2d, 0x69, 0x0b, 0x19, 0x16, 0x79,
+   0x75, 0x02, 0x03, 0x01, 0x00, 0x01
+};
+
+static unsigned int public_key_len = 270;
+
+/*
+ * dd if=/dev/urandom of=data.raw bs=512 count=1
+ */
+static unsigned char data_raw[] = {
+   0x3e, 0x48, 0x6e, 0xef, 0x83, 0xd1, 0x4c, 0xfd, 0x92, 0x47, 0x92, 0xd7,
+   0xf6, 0x16, 0x25, 0x0a, 0xdf, 0xe2, 0xb6, 0x6c, 0xe7, 0xe0, 0x55, 0xb2,
+   0x70, 0x66, 0xf0, 0xe5, 0xdc, 0xaf, 0xd3, 0x2e, 0xc1, 0x3e, 0x5c, 0x4b,
+   0xb5, 0xa7, 0x23, 0x1f, 0x2c, 0xce, 0xf8, 0x83, 0x00, 0x6d, 0xeb, 0xdd,
+   0x19, 0x71, 0x13, 0xb4, 0xae, 0x5c, 0xa8, 0xae, 0x52, 0xc8, 0xe1, 0x77,
+   0x9e, 0x98, 0x75, 0xbc, 0xef, 0x36, 0x9f, 0x0c, 0x14, 0xed, 0x1a, 0x0a,
+   0x4f, 0x6c, 0xa4, 0xb1, 0xbb, 0x0e, 0x43, 0x93, 0x12, 0xfc, 0x2e, 0x82,
+   0x93, 0x4e, 0xcb, 0xa2, 0xcd, 0x59, 0x3f, 0xc5, 0x11, 0x38, 0x3a, 0x88,
+   0xc3, 0xcf, 0xf9, 0x61, 0xa8, 0x9e, 0x96, 0xb6, 0xbf, 0xa6, 0x5b, 0x0d,
+   0xd9, 0xbd, 0x05, 0x4c, 0xbe, 0xed, 0x86, 0xca, 0x10, 0x63, 0x72, 0x75,
+   0x4b, 0xbd, 0x86, 0x42, 0x30, 0x9d, 0x54, 0x4e, 0x12, 0xda, 0xf4, 0xb4,
+   0xfd, 0xd9, 0x54, 0x95, 0x8f, 0x83, 0xc2, 0x63, 0x44, 0xdd, 0x96, 0x1a,
+   0xd0, 0x7c, 0xcf, 0xcb, 0x16, 0xd6, 0xf

[U-Boot] [PATCH v2 4/6] lib: rsa: generate additional parameters for public key

2019-10-28 Thread AKASHI Takahiro
In the current implementation of FIT_SIGNATURE, five parameters for
a RSA public key are required while only two of them are essential.
(See rsa-mod-exp.h and uImage.FIT/signature.txt)
This is a result of considering relatively limited computer power
and resources on embedded systems, while such a assumption may not
be quite practical for other use cases.

In this patch, added is a function, rsa_gen_key_prop(), which will
generate additional parameters for other uses, in particular
UEFI secure boot, on the fly.

Note: the current code uses some "big number" routines from BearSSL
for the calculation.

Signed-off-by: AKASHI Takahiro 
---
 include/u-boot/rsa-mod-exp.h |  21 +
 lib/rsa/Kconfig  |   1 +
 lib/rsa/Makefile |   1 +
 lib/rsa/rsa-keyprop.c| 717 +++
 4 files changed, 740 insertions(+)
 create mode 100644 lib/rsa/rsa-keyprop.c

diff --git a/include/u-boot/rsa-mod-exp.h b/include/u-boot/rsa-mod-exp.h
index 8a428c4b6a1a..374169b8304e 100644
--- a/include/u-boot/rsa-mod-exp.h
+++ b/include/u-boot/rsa-mod-exp.h
@@ -26,6 +26,27 @@ struct key_prop {
uint32_t exp_len;   /* Exponent length in number of uint8_t */
 };
 
+/**
+ * rsa_gen_key_prop() - Generate key properties of RSA public key
+ * @key:   Specifies key data in DER format
+ * @keylen:Length of @key
+ *
+ * This function takes a blob of encoded RSA public key data in DER
+ * format, parse it and generate all the relevant properties
+ * in key_prop structure.
+ *
+ * Return: Pointer to struct key_prop on success, NULL on error
+ */
+struct key_prop *rsa_gen_key_prop(const void *key, uint32_t keylen);
+
+/**
+ * rsa_free_key_prop() - Free key properties
+ * @prop:  Pointer to struct key_prop
+ *
+ * This function frees all the memories allocated by rsa_gen_key_prop().
+ */
+void rsa_free_key_prop(struct key_prop *prop);
+
 /**
  * rsa_mod_exp_sw() - Perform RSA Modular Exponentiation in sw
  *
diff --git a/lib/rsa/Kconfig b/lib/rsa/Kconfig
index 71e4c06bf883..d1d6f6cf64a3 100644
--- a/lib/rsa/Kconfig
+++ b/lib/rsa/Kconfig
@@ -33,6 +33,7 @@ config RSA_VERIFY
 config RSA_VERIFY_WITH_PKEY
bool "Execute RSA verification without key parameters from FDT"
depends on RSA
+   imply RSA_PUBLIC_KEY_PARSER
help
  The standard RSA-signature verification code (FIT_SIGNATURE) uses
  pre-calculated key properties, that are stored in fdt blob, in
diff --git a/lib/rsa/Makefile b/lib/rsa/Makefile
index c07305188e0c..14ed3cb4012b 100644
--- a/lib/rsa/Makefile
+++ b/lib/rsa/Makefile
@@ -6,4 +6,5 @@
 # Wolfgang Denk, DENX Software Engineering, w...@denx.de.
 
 obj-$(CONFIG_$(SPL_)RSA_VERIFY) += rsa-verify.o rsa-checksum.o
+obj-$(CONFIG_RSA_VERIFY_WITH_PKEY) += rsa-keyprop.o
 obj-$(CONFIG_RSA_SOFTWARE_EXP) += rsa-mod-exp.o
diff --git a/lib/rsa/rsa-keyprop.c b/lib/rsa/rsa-keyprop.c
new file mode 100644
index ..9458337cc608
--- /dev/null
+++ b/lib/rsa/rsa-keyprop.c
@@ -0,0 +1,717 @@
+// SPDX-License-Identifier: GPL-2.0+ and MIT
+/*
+ * RSA library - generate parameters for a public key
+ *
+ * Copyright (c) 2019 Linaro Limited
+ * Author: AKASHI Takahiro
+ *
+ * Big number routines in this file come from BearSSL:
+ * Copyright (c) 2016 Thomas Pornin 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+ * br_dec16be() - Convert 16-bit big-endian integer to native
+ * @src:   Pointer to data
+ * Return: Native-endian integer
+ */
+static unsigned br_dec16be(const void *src)
+{
+   return be16_to_cpup(src);
+}
+
+/**
+ * br_dec32be() - Convert 32-bit big-endian integer to native
+ * @src:   Pointer to data
+ * Return: Native-endian integer
+ */
+static uint32_t br_dec32be(const void *src)
+{
+   return be32_to_cpup(src);
+}
+
+/**
+ * br_enc32be() - Convert native 32-bit integer to big-endian
+ * @dst:   Pointer to buffer to store big-endian integer in
+ * @x: Native 32-bit integer
+ */
+static void br_enc32be(void *dst, uint32_t x)
+{
+   __be32 tmp;
+
+   tmp = cpu_to_be32(x);
+   memcpy(dst, &tmp, sizeof(tmp));
+}
+
+/* from BearSSL's src/inner.h */
+
+/*
+ * Negate a boolean.
+ */
+static uint32_t NOT(uint32_t ctl)
+{
+   return ctl ^ 1;
+}
+
+/*
+ * Multiplexer: returns x if ctl == 1, y if ctl == 0.
+ */
+static uint32_t MUX(uint32_t ctl, uint32_t x, uint32_t y)
+{
+   return y ^ (-ctl & (x ^ y));
+}
+
+/*
+ * Equality check: returns 1 if x == y, 0 otherwise.
+ */
+static uint32_t EQ(uint32_t x, uint32_t y)
+{
+   uint32_t q;
+
+   q = x ^ y;
+   return NOT((q | -q) >> 31);
+}
+
+/*
+ * Inequality check: returns 1 if x != y, 0 otherwise.
+ */
+static uint32_t NEQ(uint32_t x, uint32_t y)
+{
+   uint32_t q;
+
+   q = x ^ y;
+   return (q | -q) >> 31;
+}
+
+/*
+ * Comparison: returns 1 if x > y, 0 otherwise.
+ */
+static uint32_t GT(uint32_t x, uint32_t y)
+{
+   /*
+* If both x < 2^31 and y < 2^31, then y-x wil

[U-Boot] [PATCH v2 5/6] lib: rsa: add rsa_verify_with_pkey()

2019-10-28 Thread AKASHI Takahiro
This function, and hence rsa_verify(), will perform RSA verification
with two essential parameters for a RSA public key in contract of
rsa_verify_with_keynode(), which requires additional three parameters
stored in FIT image.

It will be used in implementing UEFI secure boot, i.e. image authentication
and variable authentication.

Signed-off-by: AKASHI Takahiro 
---
 lib/rsa/rsa-verify.c | 129 +--
 1 file changed, 99 insertions(+), 30 deletions(-)

diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
index 1df42f28c64a..43271a10bb84 100644
--- a/lib/rsa/rsa-verify.c
+++ b/lib/rsa/rsa-verify.c
@@ -17,9 +17,14 @@
 #include "mkimage.h"
 #include 
 #endif
+#include 
 #include 
 #include 
 
+#ifndef __UBOOT__ /* for host tools */
+#undef CONFIG_RSA_VERIFY_WITH_PKEY
+#endif
+
 /* Default public exponent for backward compatibility */
 #define RSA_DEFAULT_PUBEXP 65537
 
@@ -344,6 +349,50 @@ static int rsa_verify_key(struct image_sign_info *info,
 }
 #endif
 
+#ifdef CONFIG_RSA_VERIFY_WITH_PKEY
+/**
+ * rsa_verify_with_pkey() - Verify a signature against some data using
+ * only modulus and exponent as RSA key properties.
+ * @info:  Specifies key information
+ * @hash:  Pointer to the expected hash
+ * @sig:   Signature
+ * @sig_len:   Number of bytes in signature
+ *
+ * Parse a RSA public key blob in DER format pointed to in @info and fill
+ * a key_prop structure with properties of the key. Then verify a RSA PKCS1.5
+ * signature against an expected hash using the calculated properties.
+ *
+ * Return  0 if verified, -ve on error
+ */
+static int rsa_verify_with_pkey(struct image_sign_info *info,
+   const void *hash, uint8_t *sig, uint sig_len)
+{
+   struct key_prop *prop;
+   int ret;
+
+   /* Public key is self-described to fill key_prop */
+   prop = rsa_gen_key_prop(info->key, info->keylen);
+   if (!prop) {
+   debug("Generating necessary parameter for decoding failed\n");
+   return -EACCES;
+   }
+
+   ret = rsa_verify_key(info, prop, sig, sig_len, hash,
+info->crypto->key_len);
+
+   rsa_free_key_prop(prop);
+
+   return ret;
+}
+#else
+static int rsa_verify_with_pkey(struct image_sign_info *info,
+   const void *hash, uint8_t *sig, uint sig_len)
+{
+   return -EACCES;
+}
+#endif
+
+#if CONFIG_IS_ENABLED(FIT_SIGNATURE)
 /**
  * rsa_verify_with_keynode() - Verify a signature against some data using
  * information in node with prperties of RSA Key like modulus, exponent etc.
@@ -397,18 +446,22 @@ static int rsa_verify_with_keynode(struct image_sign_info 
*info,
 
return ret;
 }
+#else
+static int rsa_verify_with_keynode(struct image_sign_info *info,
+  const void *hash, uint8_t *sig,
+  uint sig_len, int node)
+{
+   return -EACCES;
+}
+#endif
 
 int rsa_verify(struct image_sign_info *info,
   const struct image_region region[], int region_count,
   uint8_t *sig, uint sig_len)
 {
-   const void *blob = info->fdt_blob;
/* Reserve memory for maximum checksum-length */
uint8_t hash[info->crypto->key_len];
-   int ndepth, noffset;
-   int sig_node, node;
-   char name[100];
-   int ret;
+   int ret = -EACCES;
 
/*
 * Verify that the checksum-length does not exceed the
@@ -421,12 +474,6 @@ int rsa_verify(struct image_sign_info *info,
return -EINVAL;
}
 
-   sig_node = fdt_subnode_offset(blob, 0, FIT_SIG_NODENAME);
-   if (sig_node < 0) {
-   debug("%s: No signature node found\n", __func__);
-   return -ENOENT;
-   }
-
/* Calculate checksum with checksum-algorithm */
ret = info->checksum->calculate(info->checksum->name,
region, region_count, hash);
@@ -435,30 +482,52 @@ int rsa_verify(struct image_sign_info *info,
return -EINVAL;
}
 
-   /* See if we must use a particular key */
-   if (info->required_keynode != -1) {
-   ret = rsa_verify_with_keynode(info, hash, sig, sig_len,
-   info->required_keynode);
-   if (!ret)
-   return ret;
-   }
+   if (IS_ENABLED(CONFIG_RSA_VERIFY_WITH_PKEY) && !info->fdt_blob) {
+   /* don't rely on fdt properties */
+   ret = rsa_verify_with_pkey(info, hash, sig, sig_len);
 
-   /* Look for a key that matches our hint */
-   snprintf(name, sizeof(name), "key-%s", info->keyname);
-   node = fdt_subnode_offset(blob, sig_node, name);
-   ret = rsa_verify_with_keynode(info, hash, sig, sig_len, node);
-   if (!ret)
return ret;
+   }
+
+   if (CONFIG_IS_ENABLED(FIT_SIGNATURE)) {
+   const void *blob = info->fdt_blob;
+ 

[U-Boot] [PATCH v2 3/6] include: image.h: add key info to image_sign_info

2019-10-28 Thread AKASHI Takahiro
For FIT verification, all the properties of a public key come from
"control fdt" pointed to by fdt_blob. In UEFI secure boot, on the other
hand, a public key is located and retrieved from dedicated signature
database stored as UEFI variables.

Added two fields may hold values of a public key if fdt_blob is NULL, and
will be used in rsa_verify_with_pkey() to verify a signature in UEFI
sub-system.

Signed-off-by: AKASHI Takahiro 
---
 include/image.h | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/include/image.h b/include/image.h
index ecf10f96b9f2..a97d5bc6304c 100644
--- a/include/image.h
+++ b/include/image.h
@@ -1142,6 +1142,16 @@ struct image_sign_info {
int required_keynode;   /* Node offset of key to use: -1=any */
const char *require_keys;   /* Value for 'required' property */
const char *engine_id;  /* Engine to use for signing */
+   /*
+* Note: the following two fields
+* are always valid even w/o
+* RSA_VERIFY_WITH_PKEY in order
+* to make sure this structure is
+* the same on target and host.
+* Otherwise, vboot test may fail.
+*/
+   const void *key;/* Pointer to public key in DER */
+   int keylen; /* Length of public key */
 };
 
 /* A part of an image, used for hashing */
-- 
2.21.0

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


[U-Boot] [PATCH v2 1/6] lib: rsa: decouple rsa from FIT image verification

2019-10-28 Thread AKASHI Takahiro
Introduce new configuration, CONFIG_RSA_VERIFY which will decouple building
RSA functions from FIT verification and allow for adding a RSA-based
signature verification for other file formats, in particular PE file
for UEFI secure boot.

Signed-off-by: AKASHI Takahiro 
---
 Kconfig|   1 +
 common/Makefile|   3 +-
 common/image-fit-sig.c | 417 +
 common/image-fit.c |   6 +-
 common/image-sig.c | 396 --
 include/image.h|  13 +-
 lib/rsa/Kconfig|  12 ++
 lib/rsa/Makefile   |   2 +-
 lib/rsa/rsa-verify.c   |   2 +
 tools/Makefile |   2 +-
 10 files changed, 448 insertions(+), 406 deletions(-)
 create mode 100644 common/image-fit-sig.c

diff --git a/Kconfig b/Kconfig
index 1f0904f7045e..cf885fc2750f 100644
--- a/Kconfig
+++ b/Kconfig
@@ -416,6 +416,7 @@ config SPL_FIT_SIGNATURE
depends on SPL_DM
select SPL_FIT
select SPL_RSA
+   select SPL_RSA_VERIFY
 
 config SPL_LOAD_FIT
bool "Enable SPL loading U-Boot as a FIT (basic fitImage features)"
diff --git a/common/Makefile b/common/Makefile
index 302d8beaf356..d66c0068bb88 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -112,7 +112,8 @@ obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o
 obj-$(CONFIG_$(SPL_TPL_)FIT) += image-fit.o
 obj-$(CONFIG_$(SPL_)MULTI_DTB_FIT) += boot_fit.o common_fit.o
-obj-$(CONFIG_$(SPL_TPL_)FIT_SIGNATURE) += image-sig.o
+obj-$(CONFIG_$(SPL_)RSA_VERIFY) += image-sig.o
+obj-$(CONFIG_$(SPL_TPL_)FIT_SIGNATURE) += image-fit-sig.o
 obj-$(CONFIG_IO_TRACE) += iotrace.o
 obj-y += memsize.o
 obj-y += stdio.o
diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c
new file mode 100644
index ..f6caeb0c5901
--- /dev/null
+++ b/common/image-fit-sig.c
@@ -0,0 +1,417 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2013, Google Inc.
+ */
+
+#ifdef USE_HOSTCC
+#include "mkimage.h"
+#include 
+#else
+#include 
+#include 
+DECLARE_GLOBAL_DATA_PTR;
+#endif /* !USE_HOSTCC*/
+#include 
+#include 
+#include 
+
+#define IMAGE_MAX_HASHED_NODES 100
+
+#ifdef USE_HOSTCC
+void *host_blob;
+
+void image_set_host_blob(void *blob)
+{
+   host_blob = blob;
+}
+
+void *image_get_host_blob(void)
+{
+   return host_blob;
+}
+#endif
+
+/**
+ * fit_region_make_list() - Make a list of image regions
+ *
+ * Given a list of fdt_regions, create a list of image_regions. This is a
+ * simple conversion routine since the FDT and image code use different
+ * structures.
+ *
+ * @fit: FIT image
+ * @fdt_regions: Pointer to FDT regions
+ * @count: Number of FDT regions
+ * @region: Pointer to image regions, which must hold @count records. If
+ * region is NULL, then (except for an SPL build) the array will be
+ * allocated.
+ * @return: Pointer to image regions
+ */
+struct image_region *fit_region_make_list(const void *fit,
+ struct fdt_region *fdt_regions,
+ int count,
+ struct image_region *region)
+{
+   int i;
+
+   debug("Hash regions:\n");
+   debug("%10s %10s\n", "Offset", "Size");
+
+   /*
+* Use malloc() except in SPL (to save code size). In SPL the caller
+* must allocate the array.
+*/
+#ifndef CONFIG_SPL_BUILD
+   if (!region)
+   region = calloc(sizeof(*region), count);
+#endif
+   if (!region)
+   return NULL;
+   for (i = 0; i < count; i++) {
+   debug("%10x %10x\n", fdt_regions[i].offset,
+ fdt_regions[i].size);
+   region[i].data = fit + fdt_regions[i].offset;
+   region[i].size = fdt_regions[i].size;
+   }
+
+   return region;
+}
+
+static int fit_image_setup_verify(struct image_sign_info *info,
+ const void *fit, int noffset,
+ int required_keynode, char **err_msgp)
+{
+   char *algo_name;
+   const char *padding_name;
+
+   if (fdt_totalsize(fit) > CONFIG_FIT_SIGNATURE_MAX_SIZE) {
+   *err_msgp = "Total size too large";
+   return 1;
+   }
+
+   if (fit_image_hash_get_algo(fit, noffset, &algo_name)) {
+   *err_msgp = "Can't get hash algo property";
+   return -1;
+   }
+
+   padding_name = fdt_getprop(fit, noffset, "padding", NULL);
+   if (!padding_name)
+   padding_name = RSA_DEFAULT_PADDING_NAME;
+
+   memset(info, '\0', sizeof(*info));
+   info->keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
+   info->fit = (void *)fit;
+   info->node_offset = noffset;
+   info->name = algo_name;
+   info->checksum = image_get_checksum_algo(algo_name);
+   info->crypto = image_get_crypto_algo(algo_name);
+   info->padding = image_get_padding_algo(padding_

[U-Boot] [PATCH v2 2/6] rsa: add RSA_VERIFY_WITH_PKEY

2019-10-28 Thread AKASHI Takahiro
In the next couple of commits, under new RSA_VERIFY_WITH_PKEY,
rsa_verify() will be extended to enable RSA decryption without
additional RSA key properties from FIT image, i.e. rr and n0inv.

Signed-off-by: AKASHI Takahiro 
---
 lib/rsa/Kconfig | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/lib/rsa/Kconfig b/lib/rsa/Kconfig
index 03ffa2969048..71e4c06bf883 100644
--- a/lib/rsa/Kconfig
+++ b/lib/rsa/Kconfig
@@ -30,6 +30,20 @@ config RSA_VERIFY
help
  Add RSA signature verification support.
 
+config RSA_VERIFY_WITH_PKEY
+   bool "Execute RSA verification without key parameters from FDT"
+   depends on RSA
+   help
+ The standard RSA-signature verification code (FIT_SIGNATURE) uses
+ pre-calculated key properties, that are stored in fdt blob, in
+ decrypting a signature.
+ This does not suit the use case where there is no way defined to
+ provide such additional key properties in standardized form,
+ particularly UEFI secure boot.
+ This options enables RSA signature verification with a public key
+ directly specified in image_sign_info, where all the necessary
+ key properties will be calculated on the fly in verification code.
+
 config RSA_SOFTWARE_EXP
bool "Enable driver for RSA Modular Exponentiation in software"
depends on DM
-- 
2.21.0

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


[U-Boot] [PATCH v2 0/6] rsa: extend rsa_verify() for UEFI secure boot

2019-10-28 Thread AKASHI Takahiro
# Please note that this patch set is based on v2 of my "importing
# x509/pkcs7 parsers from linux" patch[2] and will have to be updated
# due to remval of test/lib/Kconfig once v3 or later is submitted.
# The needed change is trivial, though.

The current rsa_verify() requires five parameters for a RSA public key
for efficiency while RSA, in theory, requires only two. In addition,
those parameters are expected to come from FIT image.

So this function won't fit very well when we want to use it for the purpose
of implementing UEFI secure boot, in particular, image authentication
as well as variable authentication, where the essential two parameters
are set to be retrieved from one of X509 certificates in signature
database.

So, in this patch, additional three parameters will be calculated
on the fly when rsa_verify() is called without fdt which should contain
parameters above.

This calculation heavily relies on "big-number (or multi-precision)
library." Therefore some routines from BearSSL[1] under MIT license are
imported in this implementation. See Patch#4.
# Please let me know if this is not appropriate.

# Checkpatch will complain with lots of warnings/errors, but
# I intentionally don't fix them for maximum maintainability.

  [1] https://bearssl.org/
  [2] https://lists.denx.de/pipermail/u-boot/2019-October/388263.html

Changes in v2 (Oct 29, 2019)
* fix build errors at Travis CI
* not include linux/kconfig.h (patch#1)
* add a separate patch for adding CONFIG_RSA_VERIFY_WITH_PKEY (patch#2)
* take a prerequisite patch from my "secure boot patch" (patch#3)
* add a dependency on RSA_PUBLIC_KEY_PARSER (patch#4)
* remove "inline" directives (patch#4)
* add function descriptions, which mostly come from BearSSL's src/inner.h
  (patch#4)
* improve Kconfig help text after Simon's comment (patch#5)
* add function description of rsa_verify_with_pkey() (patch#5)
* modify rsa_verify() to use "if (CONFIG_IS_ENABLED(...) " style
  rather than "#ifdef CONFIG_..." (patch#5)
* add function tests (patch#6)

Changes in v1 (Oct 9, 2019)
* fix a build error on pine64-lts_defconfig (reported by Heinrich)
  by defining FIT_IMAGE_ENABLE_VERIFY flag and adding
  SPL_RSA_VERIFY config (patch#1)
* remove FIT-specific code from image-sig.c and put them to new
  image-fit-sig.c to allow us to disable CONFIG_FIT_SIGNATURE (patch#1)
* compile rsa-keyprop.c only if necessary (i.e. if
  CONFIG_RSA_VERIFY_WITH_PKEY) (patch#2)
* add SPDX license identifier in rsa-keyprop.c (patch#2)
* include  instead of  (patch#2)
* use U-Boot's byteorder helper functions instead of BearSSL's (patch#2)

AKASHI Takahiro (6):
  lib: rsa: decouple rsa from FIT image verification
  rsa: add RSA_VERIFY_WITH_PKEY
  include: image.h: add key info to image_sign_info
  lib: rsa: generate additional parameters for public key
  lib: rsa: add rsa_verify_with_pkey()
  test: add rsa_verify() unit test

 Kconfig  |   1 +
 common/Makefile  |   3 +-
 common/image-fit-sig.c   | 417 
 common/image-fit.c   |   6 +-
 common/image-sig.c   | 396 ---
 include/image.h  |  23 +-
 include/u-boot/rsa-mod-exp.h |  21 +
 lib/rsa/Kconfig  |  27 ++
 lib/rsa/Makefile |   3 +-
 lib/rsa/rsa-keyprop.c| 717 +++
 lib/rsa/rsa-verify.c | 131 +--
 test/lib/Kconfig |  12 +
 test/lib/Makefile|   1 +
 test/lib/rsa.c   | 207 ++
 tools/Makefile   |   2 +-
 15 files changed, 1531 insertions(+), 436 deletions(-)
 create mode 100644 common/image-fit-sig.c
 create mode 100644 lib/rsa/rsa-keyprop.c
 create mode 100644 test/lib/rsa.c

-- 
2.21.0

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


Re: [U-Boot] [PATCH 20/30] ti: am654: Drop duplicate dm.h inclusion

2019-10-28 Thread Lokesh Vutla


On 27/10/19 9:24 PM, Simon Glass wrote:
> We only need to include this header once. Drop the duplicate.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Lokesh Vutla 

Thanks and regards,
Lokesh

> ---
> 
>  drivers/ram/k3-am654-ddrss.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/ram/k3-am654-ddrss.c b/drivers/ram/k3-am654-ddrss.c
> index 7015d8cfe7..00673e80a9 100644
> --- a/drivers/ram/k3-am654-ddrss.c
> +++ b/drivers/ram/k3-am654-ddrss.c
> @@ -12,7 +12,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include "k3-am654-ddrss.h"
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC 06/15] secure boot: rename CONFIG_SECURE_BOOT

2019-10-28 Thread AKASHI Takahiro
Priyanka, Stefano and Tom,

On Wed, Sep 25, 2019 at 04:19:43AM +, Priyanka Jain wrote:
> 
> 
> >-Original Message-
> >From: Stefano Babic 
> >Sent: Thursday, September 19, 2019 8:40 PM
> >To: Tom Rini ; AKASHI Takahiro
> >; Priyanka Jain ;
> >Stefano Babic 
> >Cc: xypron.g...@gmx.de; ag...@csgraf.de; u-boot@lists.denx.de
> >Subject: Re: [U-Boot] [RFC 06/15] secure boot: rename CONFIG_SECURE_BOOT
> >
> >On 19/09/19 17:02, Tom Rini wrote:
> >> On Wed, Sep 18, 2019 at 10:26:34AM +0900, AKASHI Takahiro wrote:
> >>
> >>> The configuration, CONFIG_SECURE_BOOT, was scattered among different
> >>> architecture directories for different implementation. This will
> >>> prevent UEFI secure boot from being added later.
> >>>
> >>> So let's rename them, giving each implementation to different
> >>> configuration option. CONFIG_SECURE_BOOT still remains not to break
> >>> existing implicit dependency.
> >>>
> >>> Signed-off-by: AKASHI Takahiro 
> >>> ---
> >>>  Kconfig   | 7 +++
> >>>  arch/arm/cpu/armv7/ls102xa/Kconfig| 3 ++-
> >>>  arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 3 ++-
> >>>  arch/arm/mach-imx/Kconfig | 3 ++-
> >>>  arch/powerpc/cpu/mpc85xx/Kconfig  | 3 ++-
> >>>  5 files changed, 15 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/Kconfig b/Kconfig
> >>> index 1f0904f7045e..c11fc102a7d4 100644
> >>> --- a/Kconfig
> >>> +++ b/Kconfig
> >>> @@ -282,6 +282,13 @@ config SYS_LDSCRIPT
> >>>
> >>>  endmenu  # General setup
> >>>
> >>> +config SECURE_BOOT
> >>> + bool "Secure Boot"
> >>> + imply SHA256
> >>> + help
> >>> +   Enable Secure Boot feature. The actual behavior may vary
> >>> +   from architecture to architecture.
> >>> +
> >>>  menu "Boot images"
> >>>
> >>>  config ANDROID_BOOT_IMAGE
> >>> diff --git a/arch/arm/cpu/armv7/ls102xa/Kconfig
> >>> b/arch/arm/cpu/armv7/ls102xa/Kconfig
> >>> index 94fa68250ddf..ce1bc580d23d 100644
> >>> --- a/arch/arm/cpu/armv7/ls102xa/Kconfig
> >>> +++ b/arch/arm/cpu/armv7/ls102xa/Kconfig
> >>> @@ -50,8 +50,9 @@ config MAX_CPUS
> >>> cores, count the reserved ports. This will allocate enough memory
> >>> in spin table to properly handle all cores.
> >>>
> >>> -config SECURE_BOOT
> >>> +config FSL_ARMV7_ENABLE_SECURE_BOOT
> >>>   bool"Secure Boot"
> >>> + depends on SECURE_BOOT
> >>>   help
> >>>   Enable Freescale Secure Boot feature. Normally selected
> >>>   by defconfig. If unsure, do not change.
> >>> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> >>> b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> >>> index 42d31fdab0a0..d4cfe31f8ebf 100644
> >>> --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> >>> +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
> >>> @@ -383,8 +383,9 @@ config EMC2305
> >>>Enable the EMC2305 fan controller for configuration of fan
> >>>speed.
> >>>
> >>> -config SECURE_BOOT
> >>> +config FSI_ARMV8_ENABLE_SECURE_BOOT
> >>>   bool "Secure Boot"
> >>> + depends on SECURE_BOOT
> >>>   help
> >>>   Enable Freescale Secure Boot feature
> >>>
> >>> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
> >>> index aeb54934888d..e1602fd5f0e8 100644
> >>> --- a/arch/arm/mach-imx/Kconfig
> >>> +++ b/arch/arm/mach-imx/Kconfig
> >>> @@ -34,8 +34,9 @@ config USE_IMXIMG_PLUGIN
> >>> i.MX6/7 supports DCD and Plugin. Enable this configuration
> >>> to use Plugin, otherwise DCD will be used.
> >>>
> >>> -config SECURE_BOOT
> >>> +config FSL_IMX_ENABLE_SECURE_BOOT
> >>>   bool "Support i.MX HAB features"
> >>> + depends on SECURE_BOOT
> >>>   depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX5
> >>>   select FSL_CAAM if HAS_CAAM
> >>>   imply CMD_DEKBLOB
> >>> diff --git a/arch/powerpc/cpu/mpc85xx/Kconfig
> >>> b/arch/powerpc/cpu/mpc85xx/Kconfig
> >>> index c038a6ddb0f4..9cf6ebbfe3ce 100644
> >>> --- a/arch/powerpc/cpu/mpc85xx/Kconfig
> >>> +++ b/arch/powerpc/cpu/mpc85xx/Kconfig
> >>> @@ -1208,8 +1208,9 @@ config FSL_LAW
> >>>   help
> >>>   Use Freescale common code for Local Access Window
> >>>
> >>> -config SECURE_BOOT
> >>> +config FSL_MPC_ENABLE_SECURE_BOOT
> >>>   bool"Secure Boot"
> >>> + depends on SECURE_BOOT
> >>>   help
> >>>   Enable Freescale Secure Boot feature. Normally selected
> >>>   by defconfig. If unsure, do not change.
> >>
> >> I've added Priyanka Jain to the thread as the custodian for PowerPC
> >> and NXP stuff and Stefano Babic as the custodian for i.MX stuff.  I
> >> don't want to see "CONFIG_SECURE_BOOT" continue on as a config option,
> >> it's too broad.  Can we please rename and update the existing NXP
> >> CONFIG option (and I assume split it into a few ones to reflect better
> >> where things really changed fundamentally from one SoC/arch to the
> >> next) and update the help text?  Thanks!
> >
> >Sure - SECURE_BOOT for NXP means enabling HAB, a config can be rename to
> >identify the component itself (CONFIG_HAB for example).
> >
> >Regards,
> >Stefan

Re: [U-Boot] [PATCH v2 2/5] tools: buildman: Remove useless mkdir() in Make() in test.py

2019-10-28 Thread Simon Glass
Hi Bin,

On Mon, 28 Oct 2019 at 08:25, Bin Meng  wrote:
>
> In the 'Make' function, the codes tries to create a directory
> if current stage is 'build'. But the directory isn't used at
> all anywhere.
>
> Signed-off-by: Bin Meng 
>
> ---
>
> Changes in v2:
> - remove the unneeded debug codes
>
>  tools/buildman/test.py | 8 
>  1 file changed, 8 deletions(-)

Can you check this works OK when there is no output dir at all? E.g.

-o /path/to/a/deep/non-existent/dir

Reviewed-by: Simon Glass 

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


Re: [U-Boot] [PATCH v2 3/5] arm: mvebu: Avoid generating kwbimage.cfg in the source tree

2019-10-28 Thread Simon Glass
On Mon, 28 Oct 2019 at 08:25, Bin Meng  wrote:
>
> At present some boards generate kwbimage.cfg in the source tree
> during the build. This breaks buildman testing on some systems
> where the source tree is read-only. Update makefile rules to
> generate it in the build tree instead.
>
> Note some other boards have the kwbimage.cfg file written in
> advance, hence we need check if the file exists in the build
> tree first, otherwise we fall back to one in the source tree.
>
> Signed-off-by: Bin Meng 
> Reviewed-by: Chris Packham 
> Reviewed-by: Stefan Roese 
> ---
>
> Changes in v2: None
>
>  Makefile | 15 +--
>  arch/arm/mach-mvebu/Makefile |  4 ++--
>  board/Marvell/db-88f6281-bp/Makefile |  4 ++--
>  board/Marvell/db-xc3-24g4xg/Makefile |  4 ++--
>  board/mikrotik/crs305-1g-4s/Makefile |  4 ++--
>  5 files changed, 21 insertions(+), 10 deletions(-)
>

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


Re: [U-Boot] [PATCH v2 4/5] .travis.yml: Remove the unneeded '&' for ls20xx buildman

2019-10-28 Thread Simon Glass
On Mon, 28 Oct 2019 at 08:25, Bin Meng  wrote:
>
> Signed-off-by: Bin Meng 
> Reviewed-by: Tom Rini 
> ---
>
> Changes in v2: None
>
>  .travis.yml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Simon Glass 
> diff --git a/.travis.yml b/.travis.yml
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] fdt: Switch to the latest libfdt, sort-of

2019-10-28 Thread Simon Glass
Hi Tom,

On Mon, 28 Oct 2019 at 08:04, Tom Rini  wrote:
>
> On Sun, Oct 27, 2019 at 09:47:38AM -0600, Simon Glass wrote:
>
> > This series brings over the latest libfdt with some changes to deal with
> > the recent code-size bloat.
> >
> > With this change U-Boot size increases about 2.5KB on 'rock' and SPL
> > reduces by about 128 bytes. This should be acceptable.
> >
> > The 'assumptions' series is still under review, so we can sync that up
> > later when complete.
>
> Does this address the problem you have when moving binman to python3 as
> well?  Thanks!

Yes it does, I figured that out.

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


Re: [U-Boot] [PATCH v2 1/5] tools: buildman: Honor output directory when generating boards.cfg

2019-10-28 Thread Simon Glass
Hi Bin,

On Mon, 28 Oct 2019 at 08:25, Bin Meng  wrote:
>
> buildman always generates boards.cfg in the U-Boot source tree.
> When '-o' is given, we should generate boards.cfg to the given
> output directory.
>
> Signed-off-by: Bin Meng 
> ---
>
> Changes in v2: None
>
>  tools/buildman/control.py | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>

Reviewed-by: Simon Glass 

Does this preserve existing behaviour when -o is not given? I suppose
it doesn't matter so long as buildman uses the right file?

> diff --git a/tools/buildman/control.py b/tools/buildman/control.py
> index fcf531c..9787b86 100644
> --- a/tools/buildman/control.py
> +++ b/tools/buildman/control.py
> @@ -201,14 +201,14 @@ def DoBuildman(options, args, toolchains=None, 
> make_func=None, boards=None,
>
>  # Work out what subset of the boards we are building
>  if not boards:
> -board_file = os.path.join(options.git, 'boards.cfg')
> -status = subprocess.call([os.path.join(options.git,
> -'tools/genboardscfg.py')])
> +board_file = os.path.join(options.output_dir, 'boards.cfg')
> +genboardscfg = os.path.join(options.git, 'tools/genboardscfg.py')
> +status = subprocess.call([genboardscfg, '-o', board_file])
>  if status != 0:
> -sys.exit("Failed to generate boards.cfg")
> +sys.exit("Failed to generate boards.cfg")
>
>  boards = board.Boards()
> -boards.ReadBoards(os.path.join(options.git, 'boards.cfg'))
> +boards.ReadBoards(board_file)
>
>  exclude = []
>  if options.exclude:
> --
> 2.7.4
>

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


Re: [U-Boot] [PATCH v2 1/8] image: android: Add functions for handling dtb field

2019-10-28 Thread Eugeniu Rosca
Hi Sam,

On Wed, Oct 23, 2019 at 05:34:20PM +0300, Sam Protsenko wrote:
> Android Boot Image v2 adds "DTB" payload (and corresponding field in the
> image header). Provide functions for its handling:

I believe this totally new degree of freedom brought by "Android Boot
Image v2" might unintentionally make some users more unhappy [0], since
it enables yet another way of passing a DTB to the Android kernel.

It looks to me that there are at least three valid design choices for
DTB storage/passing which platform maintainers have to consider:
 A. Android Image second area [1-2]
 B. Dedicated DTB/DTBO partitions on a block device
 C. DTB area in Android Image v2

While there are some major disadvantages for [A][1-2], [B] and [C] look
more or less equivalent and will most likely only differ in the tooling
used to generate and extract the useful/relevant artifacts.

Not to mention that hybrids [B+C] are also possible.
Which solution should we pick as a long-term one?

[0] https://en.wikipedia.org/wiki/The_Paradox_of_Choice
[1] 104816142f9c6a ("parse the second area of android image")
[2] 6a7b406aa8b981 ("fdt: support booting with dtb in Android image")

[..]

>  common/Makefile|   2 +-
>  common/image-android.c | 215 +
>  include/image.h|   5 +
>  3 files changed, 221 insertions(+), 1 deletion(-)
> 
> diff --git a/common/Makefile b/common/Makefile
> index 302d8beaf3..7e5f5058b3 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -108,7 +108,7 @@ endif
>  
>  obj-y += image.o
>  obj-$(CONFIG_ANDROID_AB) += android_ab.o
> -obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o
> +obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o image-android-dt.o

I expect that in a not so distant future, Android users who care
about performance aspects of their system (e.g. in automotive sector,
where boot time is paramount to achieve ~2s to Rear View Camera) will
attempt optimizing U-Boot by compiling out features they don't need.

With this background:
 - Would it make sense to allow users to selectively enable and disable
   support for A/B-capable and non-A/B devices? My guess is that it
   is currently not an important development/review criteria, since
   particularly image-android-dt.c implements functions, some of which
   are A/B-specific, some non-A/B-specific (e.g. android_image_get_dtbo)
   and some are common.
 - I would try to avoid wiring the same compilation unit to Kbuild
   (e.g. image-android-dt.o) via multiple Kconfig symbols
   (CONFIG_ANDROID_BOOT_IMAGE and CONFIG_CMD_DTIMG) since this makes
   the relationship between the CONFIG symbols unclear. As a user, I
   would like to see a simple mapping between compiled objects and
   Kconfig symbols, eventually reflecting a hierarchy/dependency:

   config ANDROID_BOOT_IMAGE
  select ANDROID_BOOT_IMAGE_DT

   config DTIMG
  select ANDROID_BOOT_IMAGE_DT

[..]

> diff --git a/common/image-android.c b/common/image-android.c
> index 3564a64221..5e721a27a7 100644
> --- a/common/image-android.c
> +++ b/common/image-android.c
> @@ -6,10 +6,12 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #define ANDROID_IMAGE_DEFAULT_KERNEL_ADDR0x10008000
>  
> @@ -195,6 +197,122 @@ int android_image_get_second(const struct andr_img_hdr 
> *hdr,
>   return 0;
>  }
>  
> +/**
> + * android_image_get_dtb_img_addr() - Get the address of DTB area in boot 
> image.
> + * @hdr_addr: Boot image header address
> + * @addr: Will contain the address of DTB area in boot image
> + *
> + * Return: true on success or false on fail.
> + */
> +static bool android_image_get_dtb_img_addr(ulong hdr_addr, ulong *addr)
> +{
> + const struct andr_img_hdr *hdr;
> + ulong dtb_img_addr;
> + bool res = true;
> +
> + hdr = map_sysmem(hdr_addr, sizeof(*hdr));
> + if (android_image_check_header(hdr)) {
> + printf("Error: Boot Image header is incorrect\n");
> + res = false;
> + goto exit;
> + }
> +
> + if (hdr->header_version < 2) {
> + printf("Error: header_version must be >= 2 to get dtb\n");
> + res = false;
> + goto exit;
> + }
> +
> + if (hdr->dtb_size == 0) {
> + printf("Error: dtb_size is 0\n");
> + res = false;
> + goto exit;
> + }
> +
> + /* Calculate the address of DTB area in boot image */
> + dtb_img_addr = hdr_addr;
> + dtb_img_addr += hdr->page_size;
> + dtb_img_addr += ALIGN(hdr->kernel_size, hdr->page_size);
> + dtb_img_addr += ALIGN(hdr->ramdisk_size, hdr->page_size);
> + dtb_img_addr += ALIGN(hdr->second_size, hdr->page_size);
> + dtb_img_addr += ALIGN(hdr->recovery_dtbo_size, hdr->page_size);
> +
> + if (addr)
> + *addr = dtb_img_addr;

In this recent series, I noticed a consistent preference towards
doing a lot of processing with returning nothing to 

Re: [U-Boot] [PATCH v2 2/5] sifive: fu540: Enable OF_SEPARATE

2019-10-28 Thread Rick Chen
Hi Jagan

Please check the following typos.
Or if you don't mind. I can fix it directly on the patches. :)

> From: Jagan Teki [mailto:ja...@amarulasolutions.com]
> Sent: Wednesday, October 16, 2019 10:58 PM
> To: Rick Jian-Zhi Chen(陳建志); Paul Walmsley; Palmer Dabbelt; Anup Patel;
> Atish Patra; Bin Meng
> Cc: u-boot@lists.denx.de; linux-amar...@amarulasolutions.com; Jagan Teki
> Subject: [PATCH v2 2/5] sifive: fu540: Enable OF_SEPARATE
>
> Use dts support from U-Boot via OF_SEPARATE instead of depending from
> opensbi.
>
> This would help to make the necessary changes in drivers and devicetrees in

device trees

> uboot tree itself. this feature would also be helpful to not pass dtb during

U-Boot  . This feature ...

opensbi builds.

> Signed-off-by: Jagan Teki 
> ---
>  configs/sifive_fu540_defconfig | 3 ++-
>  doc/board/sifive/fu540.rst | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/configs/sifive_fu540_defconfig b/configs/sifive_fu540_defconfig
> index 48865e5f11..979d0a0418 100644
> --- a/configs/sifive_fu540_defconfig
> +++ b/configs/sifive_fu540_defconfig
> @@ -6,6 +6,7 @@ CONFIG_RISCV_SMODE=y
>  CONFIG_DISTRO_DEFAULTS=y
>  CONFIG_FIT=y
>  CONFIG_MISC_INIT_R=y
> +CONFIG_DEFAULT_DEVICE_TREE="hifive-unleashed-a00"
>  CONFIG_DISPLAY_CPUINFO=y
>  CONFIG_DISPLAY_BOARDINFO=y
> -CONFIG_OF_PRIOR_STAGE=y
> +CONFIG_OF_SEPARATE=y
> diff --git a/doc/board/sifive/fu540.rst b/doc/board/sifive/fu540.rst index
> 7807f5b2c1..91b94ee06f 100644
> --- a/doc/board/sifive/fu540.rst
> +++ b/doc/board/sifive/fu540.rst
> @@ -58,7 +58,7 @@ firmware. We need to compile OpenSBI with below
> command:
>
>  .. code-block:: none
>
> -make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH=
> FW_PAYLOAD_FDT_PATH=
> +make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH= u-boot-dtb.bin>
>
>  (Note: Prefer hifive-unleashed-a00.dtb from Linux-5.3 or higher)
>  (Note: Linux-5.2 is also fine but it does not have ethernet DT node)

Thanks
Rick
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [GIT] Pull request: u-boot-dfu (15.10.2019)

2019-10-28 Thread Lukasz Majewski
Hi Marek,

> On 10/28/19 5:51 PM, Lukasz Majewski wrote:
> > Hi Marek,  
> 
> Hi,
> 
> >> Hi Marek,
> >>  
> >>> On 10/15/19 9:45 AM, Lukasz Majewski wrote:
>  Dear Marek,  
> >>>
> >>> Hello Lukasz,
> >>> 
>  The following changes since commit
>  7a779ed1755c2d5011bd9598da90291f759ae760:
> 
>    travis: Exclude MIPS from the bcm job (2019-10-13 11:21:56
>  -0400)
> 
>  are available in the Git repository at:
> 
>    g...@gitlab.denx.de:u-boot/custodians/u-boot-dfu.git 
> 
>  for you to fetch changes up to
>  5d897631065bb2f36bbc1bd7fabb670ce5da3ce8:
> 
>    dfu: add callback for flush and initiated operation (2019-10-14
>    12:26:19 +0200)  
> >>>
> >>> Which branch shall I pull ? This information is missing from the
> >>> PR, again :-(
> >>
> >> Ach. I'm still (unfortunately) use my old script for PR.
> >>
> >> You shall use the -master branch:
> >> https://gitlab.denx.de/u-boot/custodians/u-boot-dfu/commits/master
> >>
> >> I've written also the merge tag for this PR:
> >> https://gitlab.denx.de/u-boot/custodians/u-boot-dfu/-/tags
> >>
> >> Sorry for inconvenience and confusion.  
> > 
> > Marek, are there any issues with this PR? 
> > 
> > Unfortunately, I did not noticed it being applied to your u-boot-usb
> > tree. Do you need any help?  
> 
> The USB tree was stuck due to multiple patchsets which had issues. It
> is unstuck now, so rebase the PR on u-boot-usb/master and resubmit it.

Thanks for the update. I will prepare updated PR.

> 
> Thanks




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lu...@denx.de


pgpd7ytTHzkQG.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] usb: ehci: add ehci max xfer size ehci config entry

2019-10-28 Thread Marek Vasut
On 10/28/19 6:35 PM, Robert Hancock wrote:
> On 2019-10-25 8:30 a.m., Gilles DOFFE wrote:
>> Some USB sticks cannot handle SIZE_MAX bytes (65535) blocks transfer,
>> leading to 'EHCI timed out on TD' errors.
>> As it is hardly predictable, this commit adds a configuration option
>> to easily reduce this EHCI max transfer size. The default value is 65535
>> which corresponds to size_t max value (SIZE_MAX).
> 
> This doesn't seem like an ideal solution, as one would have to rebuild
> U-Boot to cope with such a device. Do you know how the Linux kernel EHCI
> driver deals with this problem?

I presume this is already fixed in u-boot-usb/next by:
https://gitlab.denx.de/u-boot/custodians/u-boot-usb/commit/78d49f89e1dd9bdfa891389343bc3016bcaaeee4
https://gitlab.denx.de/u-boot/custodians/u-boot-usb/commit/b43c016256a5eb1070fbca24309e0e66590b7771
https://gitlab.denx.de/u-boot/custodians/u-boot-usb/commit/4bf7e8b7ad6231cf161fcf95d5c3cc6f1de9fff9
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [GIT] Pull request: u-boot-dfu (15.10.2019)

2019-10-28 Thread Marek Vasut
On 10/28/19 5:51 PM, Lukasz Majewski wrote:
> Hi Marek,

Hi,

>> Hi Marek,
>>
>>> On 10/15/19 9:45 AM, Lukasz Majewski wrote:  
 Dear Marek,
>>>
>>> Hello Lukasz,
>>>   
 The following changes since commit
 7a779ed1755c2d5011bd9598da90291f759ae760:

   travis: Exclude MIPS from the bcm job (2019-10-13 11:21:56
 -0400)

 are available in the Git repository at:

   g...@gitlab.denx.de:u-boot/custodians/u-boot-dfu.git 

 for you to fetch changes up to
 5d897631065bb2f36bbc1bd7fabb670ce5da3ce8:

   dfu: add callback for flush and initiated operation (2019-10-14
   12:26:19 +0200)
>>>
>>> Which branch shall I pull ? This information is missing from the PR,
>>> again :-(  
>>
>> Ach. I'm still (unfortunately) use my old script for PR.
>>
>> You shall use the -master branch:
>> https://gitlab.denx.de/u-boot/custodians/u-boot-dfu/commits/master
>>
>> I've written also the merge tag for this PR:
>> https://gitlab.denx.de/u-boot/custodians/u-boot-dfu/-/tags
>>
>> Sorry for inconvenience and confusion.
> 
> Marek, are there any issues with this PR? 
> 
> Unfortunately, I did not noticed it being applied to your u-boot-usb
> tree. Do you need any help?

The USB tree was stuck due to multiple patchsets which had issues. It is
unstuck now, so rebase the PR on u-boot-usb/master and resubmit it.

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


[U-Boot] [PATCH] rtc: s35392a: add compatible strings

2019-10-28 Thread Robert Beckett
Add compatible strings used by Linux.
Allows for simpler syncing of device trees.

Signed-off-by: Robert Beckett 
---

 drivers/rtc/s35392a.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/s35392a.c b/drivers/rtc/s35392a.c
index 844f1b72c7..4f478ccfd7 100644
--- a/drivers/rtc/s35392a.c
+++ b/drivers/rtc/s35392a.c
@@ -350,6 +350,8 @@ static const struct rtc_ops s35392a_rtc_ops = {
 
 static const struct udevice_id s35392a_rtc_ids[] = {
{ .compatible = "sii,s35392a-rtc" },
+   { .compatible = "sii,s35392a" },
+   { .compatible = "s35392a" },
{ }
 };
 
-- 
2.20.1

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


[U-Boot] [PATCH] rtc: rx8010sj: fix DM initialization

2019-10-28 Thread Robert Beckett
pass the udevice by reference instead of double ref

Signed-off-by: Robert Beckett 
---

 drivers/rtc/rx8010sj.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rx8010sj.c b/drivers/rtc/rx8010sj.c
index 81560e16ce..2876692a37 100644
--- a/drivers/rtc/rx8010sj.c
+++ b/drivers/rtc/rx8010sj.c
@@ -349,7 +349,7 @@ void rtc_init(void)
 
 static int rx8010sj_probe(struct udevice *dev)
 {
-   rx8010sj_rtc_init(&dev);
+   rx8010sj_rtc_init(dev);
 
return 0;
 }
-- 
2.20.1

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


[U-Boot] [PATCH] bootcount: add a DM i2c eeprom backing store for bootcount

2019-10-28 Thread Robert Beckett
This driver allows the use of i2c eeprom device or partition as backing
store for boot counter values with DM enabled.

Signed-off-by: Robert Beckett 
---

 drivers/bootcount/Kconfig  | 10 
 drivers/bootcount/Makefile |  1 +
 drivers/bootcount/i2c-eeprom.c | 95 ++
 3 files changed, 106 insertions(+)
 create mode 100644 drivers/bootcount/i2c-eeprom.c

diff --git a/drivers/bootcount/Kconfig b/drivers/bootcount/Kconfig
index b7c29f2fd3..0e506c9ea2 100644
--- a/drivers/bootcount/Kconfig
+++ b/drivers/bootcount/Kconfig
@@ -96,6 +96,16 @@ config DM_BOOTCOUNT_RTC
  Accesses to the backing store are performed using the write16
  and read16 ops of DM RTC devices.
 
+config DM_BOOTCOUNT_I2C_EEPROM
+   bool "Support i2c eeprom devices as a backing store for bootcount"
+   depends on I2C_EEPROM
+   help
+ Enabled reading/writing the bootcount in a DM i2c eeprom device.
+ The wrapper device is to be specified with the compatible string
+ 'u-boot,bootcount-i2c-eeprom' and the 'i2c-eeprom'-property (a phandle
+ pointing to the underlying i2c eeprom device) and an optional 'offset'
+ property are supported.
+
 endmenu
 
 endif
diff --git a/drivers/bootcount/Makefile b/drivers/bootcount/Makefile
index f9841d8615..73ccfb5a08 100644
--- a/drivers/bootcount/Makefile
+++ b/drivers/bootcount/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_BOOTCOUNT_EXT)   += bootcount_ext.o
 
 obj-$(CONFIG_DM_BOOTCOUNT)  += bootcount-uclass.o
 obj-$(CONFIG_DM_BOOTCOUNT_RTC)  += rtc.o
+obj-$(CONFIG_DM_BOOTCOUNT_I2C_EEPROM)  += i2c-eeprom.o
diff --git a/drivers/bootcount/i2c-eeprom.c b/drivers/bootcount/i2c-eeprom.c
new file mode 100644
index 00..ee760a2742
--- /dev/null
+++ b/drivers/bootcount/i2c-eeprom.c
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Collabora
+ * (C) Copyright 2019 GE
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+static const u8 bootcount_magic = 0xbc;
+
+struct bootcount_i2c_eeprom_priv {
+   struct udevice *i2c_eeprom;
+   u32 offset;
+};
+
+static int bootcount_i2c_eeprom_set(struct udevice *dev, const u32 a)
+{
+   struct bootcount_i2c_eeprom_priv *priv = dev_get_priv(dev);
+   const u16 val = bootcount_magic << 8 | (a & 0xff);
+
+   if (i2c_eeprom_write(priv->i2c_eeprom, priv->offset,
+(uint8_t *)&val, 2) < 0) {
+   debug("%s: write failed\n", __func__);
+   return -EIO;
+   }
+
+   return 0;
+}
+
+static int bootcount_i2c_eeprom_get(struct udevice *dev, u32 *a)
+{
+   struct bootcount_i2c_eeprom_priv *priv = dev_get_priv(dev);
+   u16 val;
+
+   if (i2c_eeprom_read(priv->i2c_eeprom, priv->offset,
+   (uint8_t *)&val, 2) < 0) {
+   debug("%s: read failed\n", __func__);
+   return -EIO;
+   }
+
+   if (val >> 8 == bootcount_magic) {
+   *a = val & 0xff;
+   return 0;
+   }
+
+   debug("%s: bootcount magic does not match on %04x\n", __func__, val);
+   return -EIO;
+}
+
+static int bootcount_i2c_eeprom_probe(struct udevice *dev)
+{
+   struct ofnode_phandle_args phandle_args;
+   struct bootcount_i2c_eeprom_priv *priv = dev_get_priv(dev);
+   struct udevice *i2c_eeprom;
+
+   if (dev_read_phandle_with_args(dev, "i2c-eeprom", NULL, 0, 0,
+  &phandle_args)) {
+   debug("%s: i2c-eeprom backing device not specified\n",
+ dev->name);
+   return -ENOENT;
+   }
+
+   if (uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, phandle_args.node,
+   &i2c_eeprom)) {
+   debug("%s: could not get backing device\n", dev->name);
+   return -ENODEV;
+   }
+
+   priv->i2c_eeprom = i2c_eeprom;
+   priv->offset = dev_read_u32_default(dev, "offset", 0);
+
+   return 0;
+}
+
+static const struct bootcount_ops bootcount_i2c_eeprom_ops = {
+   .get = bootcount_i2c_eeprom_get,
+   .set = bootcount_i2c_eeprom_set,
+};
+
+static const struct udevice_id bootcount_i2c_eeprom_ids[] = {
+   { .compatible = "u-boot,bootcount-i2c-eeprom" },
+   { }
+};
+
+U_BOOT_DRIVER(bootcount_spi_flash) = {
+   .name   = "bootcount-i2c-eeprom",
+   .id = UCLASS_BOOTCOUNT,
+   .priv_auto_alloc_size = sizeof(struct bootcount_i2c_eeprom_priv),
+   .probe  = bootcount_i2c_eeprom_probe,
+   .of_match = bootcount_i2c_eeprom_ids,
+   .ops= &bootcount_i2c_eeprom_ops,
+};
-- 
2.20.1

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


[U-Boot] [PATCH 0/2] misc: i2c_eeprom: add paritioning and size query

2019-10-28 Thread Robert Beckett
Add ability to specify paritions for eeprom in device tree, and query
eeprom device sizes.
Each partition creates a child device, allowing board code to
find the eeprom parition by name.


Robert Beckett (2):
  misc: i2c_eeprom: add fixed partitions support
  misc: i2c_eeprom: add size query

 drivers/misc/i2c_eeprom.c | 243 +++---
 include/i2c_eeprom.h  |  12 ++
 2 files changed, 236 insertions(+), 19 deletions(-)

-- 
2.20.1

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


[U-Boot] [PATCH 2/2] misc: i2c_eeprom: add size query

2019-10-28 Thread Robert Beckett
Add ability to query size of eeprom device and partitions

Signed-off-by: Robert Beckett 
---

 drivers/misc/i2c_eeprom.c | 145 +-
 include/i2c_eeprom.h  |  12 
 2 files changed, 138 insertions(+), 19 deletions(-)

diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c
index 7add8fcc0f..c948ed937a 100644
--- a/drivers/misc/i2c_eeprom.c
+++ b/drivers/misc/i2c_eeprom.c
@@ -11,6 +11,11 @@
 #include 
 #include 
 
+struct i2c_eeprom_drv_data {
+   u32 size; /* size in bytes */
+   u32 pagewidth; /* pagesize = 2^pagewidth */
+};
+
 int i2c_eeprom_read(struct udevice *dev, int offset, uint8_t *buf, int size)
 {
const struct i2c_eeprom_ops *ops = device_get_ops(dev);
@@ -31,6 +36,16 @@ int i2c_eeprom_write(struct udevice *dev, int offset, 
uint8_t *buf, int size)
return ops->write(dev, offset, buf, size);
 }
 
+int i2c_eeprom_size(struct udevice *dev)
+{
+   const struct i2c_eeprom_ops *ops = device_get_ops(dev);
+
+   if (!ops->size)
+   return -ENOSYS;
+
+   return ops->size(dev);
+}
+
 static int i2c_eeprom_std_read(struct udevice *dev, int offset, uint8_t *buf,
   int size)
 {
@@ -60,25 +75,39 @@ static int i2c_eeprom_std_write(struct udevice *dev, int 
offset,
return 0;
 }
 
+static int i2c_eeprom_std_size(struct udevice *dev)
+{
+   struct i2c_eeprom *priv = dev_get_priv(dev);
+
+   return priv->size;
+}
+
 static const struct i2c_eeprom_ops i2c_eeprom_std_ops = {
.read   = i2c_eeprom_std_read,
.write  = i2c_eeprom_std_write,
+   .size   = i2c_eeprom_std_size,
 };
 
 static int i2c_eeprom_std_ofdata_to_platdata(struct udevice *dev)
 {
struct i2c_eeprom *priv = dev_get_priv(dev);
-   u64 data = dev_get_driver_data(dev);
+   struct i2c_eeprom_drv_data *data =
+   (struct i2c_eeprom_drv_data *)dev_get_driver_data(dev);
u32 pagesize;
+   u32 size;
 
if (dev_read_u32(dev, "pagesize", &pagesize) == 0) {
priv->pagesize = pagesize;
-   return 0;
+   } else {
+   /* 6 bit -> page size of up to 2^63 (should be sufficient) */
+   priv->pagewidth = data->pagewidth;
+   priv->pagesize = (1 << priv->pagewidth);
}
 
-   /* 6 bit -> page size of up to 2^63 (should be sufficient) */
-   priv->pagewidth = data & 0x3F;
-   priv->pagesize = (1 << priv->pagewidth);
+   if (dev_read_u32(dev, "size", &size) == 0)
+   priv->size = size;
+   else
+   priv->size = data->size;
 
return 0;
 }
@@ -119,21 +148,91 @@ static int i2c_eeprom_std_probe(struct udevice *dev)
return 0;
 }
 
+static const struct i2c_eeprom_drv_data eeprom_data = {
+   .size = 0,
+   .pagewidth = 0,
+};
+
+static const struct i2c_eeprom_drv_data mc24aa02e48_data = {
+   .size = 256,
+   .pagewidth = 3,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c01a_data = {
+   .size = 128,
+   .pagewidth = 3,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c02_data = {
+   .size = 256,
+   .pagewidth = 3,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c04_data = {
+   .size = 512,
+   .pagewidth = 4,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c08_data = {
+   .size = 1024,
+   .pagewidth = 4,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c08a_data = {
+   .size = 1024,
+   .pagewidth = 4,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c16a_data = {
+   .size = 2048,
+   .pagewidth = 4,
+};
+
+static const struct i2c_eeprom_drv_data atmel24mac402_data = {
+   .size = 256,
+   .pagewidth = 4,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c32_data = {
+   .size = 4096,
+   .pagewidth = 5,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c64_data = {
+   .size = 8192,
+   .pagewidth = 5,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c128_data = {
+   .size = 16384,
+   .pagewidth = 6,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c256_data = {
+   .size = 32768,
+   .pagewidth = 6,
+};
+
+static const struct i2c_eeprom_drv_data atmel24c512_data = {
+   .size = 65536,
+   .pagewidth = 6,
+};
+
 static const struct udevice_id i2c_eeprom_std_ids[] = {
-   { .compatible = "i2c-eeprom", .data = 0 },
-   { .compatible = "microchip,24aa02e48", .data = 3 },
-   { .compatible = "atmel,24c01a", .data = 3 },
-   { .compatible = "atmel,24c02", .data = 3 },
-   { .compatible = "atmel,24c04", .data = 4 },
-   { .compatible = "atmel,24c08", .data = 4 },
-   { .compatible = "atmel,24c08a", .data = 4 },
-   { .compatible = "atmel,24c16a", .data = 4 },
-   { .compatible = "atmel,24mac402", .data = 4 },
-   { .compatible = "atmel,24c32", .data = 5 },
-   { .compatible = "atmel,24c64", .data = 5 },
-   { .compatible = "atm

[U-Boot] [PATCH 1/2] misc: i2c_eeprom: add fixed partitions support

2019-10-28 Thread Robert Beckett
Add ability to partition eeprom via devicetree bindings

Signed-off-by: Robert Beckett 
---

 drivers/misc/i2c_eeprom.c | 98 +++
 1 file changed, 98 insertions(+)

diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c
index 8f2349ad5a..7add8fcc0f 100644
--- a/drivers/misc/i2c_eeprom.c
+++ b/drivers/misc/i2c_eeprom.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -82,6 +83,29 @@ static int i2c_eeprom_std_ofdata_to_platdata(struct udevice 
*dev)
return 0;
 }
 
+static int i2c_eeprom_std_bind(struct udevice *dev)
+{
+   ofnode partitions = ofnode_find_subnode(dev_ofnode(dev), "partitions");
+   ofnode partition;
+   const char *name;
+
+   if (!ofnode_valid(partitions))
+   return 0;
+   if (!ofnode_device_is_compatible(partitions, "fixed-partitions"))
+   return -ENOTSUPP;
+
+   ofnode_for_each_subnode(partition, partitions) {
+   name = ofnode_get_name(partition);
+   if (!name)
+   continue;
+
+   device_bind_ofnode(dev, DM_GET_DRIVER(i2c_eeprom_partition),
+  name, NULL, partition, NULL);
+   }
+
+   return 0;
+}
+
 static int i2c_eeprom_std_probe(struct udevice *dev)
 {
u8 test_byte;
@@ -117,12 +141,86 @@ U_BOOT_DRIVER(i2c_eeprom_std) = {
.name   = "i2c_eeprom",
.id = UCLASS_I2C_EEPROM,
.of_match   = i2c_eeprom_std_ids,
+   .bind   = i2c_eeprom_std_bind,
.probe  = i2c_eeprom_std_probe,
.ofdata_to_platdata = i2c_eeprom_std_ofdata_to_platdata,
.priv_auto_alloc_size   = sizeof(struct i2c_eeprom),
.ops= &i2c_eeprom_std_ops,
 };
 
+struct i2c_eeprom_partition {
+   u32 offset;
+   u32 size;
+};
+
+static int i2c_eeprom_partition_probe(struct udevice *dev)
+{
+   return 0;
+}
+
+static int i2c_eeprom_partition_ofdata_to_platdata(struct udevice *dev)
+{
+   struct i2c_eeprom_partition *priv = dev_get_priv(dev);
+   u32 offset, size;
+   int ret;
+
+   ret = dev_read_u32(dev, "offset", &offset);
+   if (ret)
+   return ret;
+
+   ret = dev_read_u32(dev, "size", &size);
+   if (ret)
+   return ret;
+
+   priv->offset = offset;
+   priv->size = size;
+
+   return 0;
+}
+
+static int i2c_eeprom_partition_read(struct udevice *dev, int offset,
+u8 *buf, int size)
+{
+   struct i2c_eeprom_partition *priv = dev_get_priv(dev);
+   struct udevice *parent = dev_get_parent(dev);
+
+   if (!parent)
+   return -ENODEV;
+   if (offset + size > priv->size)
+   return -EINVAL;
+
+   return i2c_eeprom_read(parent, offset + priv->offset, buf, size);
+}
+
+static int i2c_eeprom_partition_write(struct udevice *dev, int offset,
+ const u8 *buf, int size)
+{
+   struct i2c_eeprom_partition *priv = dev_get_priv(dev);
+   struct udevice *parent = dev_get_parent(dev);
+
+   if (!parent)
+   return -ENODEV;
+   if (offset + size > priv->size)
+   return -EINVAL;
+
+   return i2c_eeprom_write(parent, offset + priv->offset, (uint8_t *)buf,
+   size);
+}
+
+static const struct i2c_eeprom_ops i2c_eeprom_partition_ops = {
+   .read   = i2c_eeprom_partition_read,
+   .write  = i2c_eeprom_partition_write,
+};
+
+U_BOOT_DRIVER(i2c_eeprom_partition) = {
+   .name   = "i2c_eeprom_partition",
+   .id = UCLASS_I2C_EEPROM,
+   .probe  = i2c_eeprom_partition_probe,
+   .ofdata_to_platdata = i2c_eeprom_partition_ofdata_to_platdata,
+   .priv_auto_alloc_size   = sizeof(struct i2c_eeprom_partition),
+   .ops= &i2c_eeprom_partition_ops,
+};
+
 UCLASS_DRIVER(i2c_eeprom) = {
.id = UCLASS_I2C_EEPROM,
.name   = "i2c_eeprom",
-- 
2.20.1

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


[U-Boot] [PATCH V4] pytest: add a new test for aes

2019-10-28 Thread Philippe Reynes
This commit add a simple test to check that
a text may be ciphered and unciphered. Each
step are checked with the known result.

Signed-off-by: Philippe Reynes 
---
 test/py/tests/test_aes.py | 101 ++
 1 file changed, 101 insertions(+)
 create mode 100644 test/py/tests/test_aes.py

Changelog:
v4:
- use function to clean the code
- add new test to check key and iv corruption

Before, this patch was in a serie accepted, excepted this patch:
v3:
- add unmap_sysmem (thanks Simon)
v2:
- add binary file (key128.bin, iv128.bin and plaintext.bin)

diff --git a/test/py/tests/test_aes.py b/test/py/tests/test_aes.py
new file mode 100644
index 000..01d514e
--- /dev/null
+++ b/test/py/tests/test_aes.py
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2019, Softathome
+
+# Test U-Boot's "aes" command.
+
+import pytest
+
+def test_aes(u_boot_console):
+"""
+Test the aes command, and validate that it can
+cipher and uncipher a random data
+"""
+
+def generate_key_iv_data():
+# Generate random key
+output = cons.run_command('random 1000 0x10 0')
+assert('16 bytes filled with random data' in ''.join(output))
+
+# Generate random IV
+output = cons.run_command('random 2000 0x10 0')
+assert('16 bytes filled with random data' in ''.join(output))
+
+# Generate random data
+output = cons.run_command('random 3000 0x20 0')
+assert('32 bytes filled with random data' in ''.join(output))
+
+def test_nominal():
+# Generate random key, iv and data
+generate_key_iv_data()
+
+# Encrypt random data
+output = cons.run_command('aes enc 1000 2000 3000 4000 0x20')
+
+# Check that ciphered data are different than unciphered data
+output = cons.run_command('cmp.b 3000 4000 0x20')
+assert('Total of 0 byte(s) were the same' in ''.join(output))
+
+# Decrypt ciphered data
+output = cons.run_command('aes dec 1000 2000 4000 5000 0x20')
+
+# Check that unciphered data are the same than initial data
+output = cons.run_command('cmp.b 3000 5000 0x20')
+assert('Total of 32 byte(s) were the same' in ''.join(output))
+
+def test_corrupted_key(seed):
+# Generate random key, iv and data
+generate_key_iv_data()
+
+# Encrypt random data
+output = cons.run_command('aes enc 1000 2000 3000 4000 0x20')
+
+# Check that ciphered data are different than unciphered data
+output = cons.run_command('cmp.b 3000 4000 0x20')
+assert('Total of 0 byte(s) were the same' in ''.join(output))
+
+# Corrupt the key (simply generate a new one)
+output = cons.run_command('random 1000 0x10 %d' % seed)
+assert('16 bytes filled with random data' in ''.join(output))
+
+# Decrypt ciphered data
+output = cons.run_command('aes dec 1000 2000 4000 5000 0x20')
+
+# Check that unciphered data are different than initial data
+output = cons.run_command('cmp.b 3000 5000 0x20')
+assert('Total of 32 byte(s) were the same' not in ''.join(output))
+
+def test_corrupted_iv(seed):
+# Generate random key, iv and data
+generate_key_iv_data()
+
+# Encrypt random data
+output = cons.run_command('aes enc 1000 2000 3000 4000 0x20')
+
+# Check that ciphered data are different than unciphered data
+output = cons.run_command('cmp.b 3000 4000 0x20')
+assert('Total of 0 byte(s) were the same' in ''.join(output))
+
+# Corrupt the iv (simply generate a new one)
+output = cons.run_command('random 2000 0x10 %d' % seed)
+assert('16 bytes filled with random data' in ''.join(output))
+
+# Decrypt ciphered data
+output = cons.run_command('aes dec 1000 2000 4000 5000 0x20')
+
+# Check that unciphered data are different than initial data
+output = cons.run_command('cmp.b 3000 5000 0x20')
+assert('Total of 32 byte(s) were the same' not in ''.join(output))
+
+cons = u_boot_console
+
+# Check that the option cmd_aes is enabled in the config
+if cons.config.buildconfig.get('config_cmd_aes', 'n') != 'y':
+pytest.skip('aes command not supported')
+
+# Send a command with no argument ...
+output = cons.run_command('aes')
+assert('AES 128 CBC encryption' in ''.join(output))
+
+test_nominal()
+test_corrupted_key(666)
+test_corrupted_iv(666)
-- 
2.7.4

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


[U-Boot] [PATCH 1/3] i2c: add support for offset overflow in to address

2019-10-28 Thread Robert Beckett
Some devices (2 wire eeproms for example) use some bits from the chip
address to represent the high bits of the offset instead of or as well
as using multiple bytes for the offset, effectively stealing chip
addresses on the bus.

Add a chip offset mask that can be set for any i2c chip which gets
filled with the offset overflow during offset setup.

Signed-off-by: Robert Beckett 
Signed-off-by: Ian Ray 
---

 drivers/i2c/i2c-uclass.c | 34 +++---
 include/i2c.h| 33 +
 2 files changed, 60 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
index e47abf1833..44aace3a36 100644
--- a/drivers/i2c/i2c-uclass.c
+++ b/drivers/i2c/i2c-uclass.c
@@ -52,16 +52,19 @@ void i2c_dump_msgs(struct i2c_msg *msg, int nmsgs)
 static int i2c_setup_offset(struct dm_i2c_chip *chip, uint offset,
uint8_t offset_buf[], struct i2c_msg *msg)
 {
-   int offset_len;
+   int offset_len = chip->offset_len;
 
msg->addr = chip->chip_addr;
+   if (chip->chip_addr_offset_mask)
+   msg->addr |= (offset >> (8 * offset_len)) &
+   chip->chip_addr_offset_mask;
msg->flags = chip->flags & DM_I2C_CHIP_10BIT ? I2C_M_TEN : 0;
msg->len = chip->offset_len;
msg->buf = offset_buf;
-   if (!chip->offset_len)
+   if (!offset_len)
return -EADDRNOTAVAIL;
-   assert(chip->offset_len <= I2C_MAX_OFFSET_LEN);
-   offset_len = chip->offset_len;
+   assert(offset_len <= I2C_MAX_OFFSET_LEN);
+
while (offset_len--)
*offset_buf++ = offset >> (8 * offset_len);
 
@@ -83,7 +86,7 @@ static int i2c_read_bytewise(struct udevice *dev, uint offset,
if (i2c_setup_offset(chip, offset + i, offset_buf, msg))
return -EINVAL;
ptr = msg + 1;
-   ptr->addr = chip->chip_addr;
+   ptr->addr = msg->addr;
ptr->flags = msg->flags | I2C_M_RD;
ptr->len = 1;
ptr->buf = &buffer[i];
@@ -139,7 +142,7 @@ int dm_i2c_read(struct udevice *dev, uint offset, uint8_t 
*buffer, int len)
ptr++;
 
if (len) {
-   ptr->addr = chip->chip_addr;
+   ptr->addr = msg->addr;
ptr->flags = chip->flags & DM_I2C_CHIP_10BIT ? I2C_M_TEN : 0;
ptr->flags |= I2C_M_RD;
ptr->len = len;
@@ -323,7 +326,8 @@ int i2c_get_chip(struct udevice *bus, uint chip_addr, uint 
offset_len,
struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
int ret;
 
-   if (chip->chip_addr == chip_addr) {
+   if (chip->chip_addr == (chip_addr &
+   ~chip->chip_addr_offset_mask)) {
ret = device_probe(dev);
debug("found, ret=%d\n", ret);
if (ret)
@@ -465,6 +469,22 @@ int i2c_get_chip_offset_len(struct udevice *dev)
return chip->offset_len;
 }
 
+int i2c_set_chip_addr_offset_mask(struct udevice *dev, uint mask)
+{
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
+
+   chip->chip_addr_offset_mask = mask;
+
+   return 0;
+}
+
+uint i2c_get_chip_addr_offset_mask(struct udevice *dev)
+{
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
+
+   return chip->chip_addr_offset_mask;
+}
+
 #ifdef CONFIG_DM_GPIO
 static void i2c_gpio_set_pin(struct gpio_desc *pin, int bit)
 {
diff --git a/include/i2c.h b/include/i2c.h
index 33570f5404..72e2e8e426 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -45,12 +45,26 @@ struct udevice;
  * represent up to 256 bytes. A value larger than 1 may be
  * needed for larger devices.
  * @flags: Flags for this chip (dm_i2c_chip_flags)
+ * @chip_addr_offset_mask: Mask of offset bits within chip_addr. Used for
+ *devices which steal addresses as part of offset.
+ *If offset_len is zero, then the offset is encoded
+ *completely within the chip address itself.
+ *e.g. a devce with chip address of 0x2c with 512
+ *registers might use the bottom bit of the address
+ *to indicate which half of the address space is being
+ *accessed while still only using 1 byte offset.
+ *This means it will respond to  chip address 0x2c and
+ *0x2d.
+ *A real world example is the Atmel AT24C04. It's
+ *datasheet explains it's usage of this addressing
+ *mode.
  * @emul: Emulator for this chip address (only used for emulation)
  */
 struct dm_i2c_chip {
uint chip_addr;
uint offset_len;
uint flags;
+   uint chip_

[U-Boot] [PATCH 0/3] i2c: add support for offset overflow in to chip address

2019-10-28 Thread Robert Beckett
Add support for devices that can overflow the offset in to the chip
address. This makes the devices effectively steal consecutive chip
addresses.

Also improve i2c testing and add new test for this new addressing mode.


Robert Beckett (3):
  i2c: add support for offset overflow in to address
  dm: i2c: EEPROM simulator allow tests visibility of addr and offset
  dm: i2c: EEPROM simulator add tests for addr offset mask

 arch/sandbox/include/asm/test.h |   7 ++
 drivers/i2c/i2c-uclass.c|  34 --
 drivers/misc/i2c_eeprom_emul.c  |  80 +--
 include/i2c.h   |  33 ++
 test/dm/i2c.c   | 112 
 5 files changed, 226 insertions(+), 40 deletions(-)

-- 
2.20.1

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


[U-Boot] [PATCH 3/3] dm: i2c: EEPROM simulator add tests for addr offset mask

2019-10-28 Thread Robert Beckett
Add support for setting the chip address offset mask to EEPROM sumulator
and add tests to test it.

Signed-off-by: Robert Beckett 
---

 arch/sandbox/include/asm/test.h |  3 ++
 drivers/misc/i2c_eeprom_emul.c  | 19 +++---
 test/dm/i2c.c   | 64 +
 3 files changed, 81 insertions(+), 5 deletions(-)

diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index 73cb451e7f..28c4c7bcef 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -72,6 +72,9 @@ void sandbox_i2c_eeprom_set_test_mode(struct udevice *dev,
 
 void sandbox_i2c_eeprom_set_offset_len(struct udevice *dev, int offset_len);
 
+void sandbox_i2c_eeprom_set_chip_addr_offset_mask(struct udevice *dev,
+ uint mask);
+
 uint sanbox_i2c_eeprom_get_prev_addr(struct udevice *dev);
 
 uint sanbox_i2c_eeprom_get_prev_offset(struct udevice *dev);
diff --git a/drivers/misc/i2c_eeprom_emul.c b/drivers/misc/i2c_eeprom_emul.c
index 284267f2ea..16758a0ef9 100644
--- a/drivers/misc/i2c_eeprom_emul.c
+++ b/drivers/misc/i2c_eeprom_emul.c
@@ -23,6 +23,7 @@ struct sandbox_i2c_flash_plat_data {
const char *filename;
int offset_len; /* Length of an offset in bytes */
int size;   /* Size of data buffer */
+   uint chip_addr_offset_mask; /* mask of addr bits used for offset */
 };
 
 struct sandbox_i2c_flash {
@@ -46,6 +47,14 @@ void sandbox_i2c_eeprom_set_offset_len(struct udevice *dev, 
int offset_len)
plat->offset_len = offset_len;
 }
 
+void sandbox_i2c_eeprom_set_chip_addr_offset_mask(struct udevice *dev,
+ uint mask)
+{
+   struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(dev);
+
+   plat->chip_addr_offset_mask = mask;
+}
+
 uint sanbox_i2c_eeprom_get_prev_addr(struct udevice *dev)
 {
struct sandbox_i2c_flash *priv = dev_get_priv(dev);
@@ -64,7 +73,8 @@ static int sandbox_i2c_eeprom_xfer(struct udevice *emul, 
struct i2c_msg *msg,
  int nmsgs)
 {
struct sandbox_i2c_flash *priv = dev_get_priv(emul);
-   uint offset = 0;
+   struct sandbox_i2c_flash_plat_data *plat = dev_get_platdata(emul);
+   uint offset = msg->addr & plat->chip_addr_offset_mask;
 
debug("\n%s\n", __func__);
debug_buffer(0, priv->data, 1, 16, 0);
@@ -73,17 +83,15 @@ static int sandbox_i2c_eeprom_xfer(struct udevice *emul, 
struct i2c_msg *msg,
priv->prev_addr = msg->addr;
 
for (; nmsgs > 0; nmsgs--, msg++) {
-   struct sandbox_i2c_flash_plat_data *plat =
-   dev_get_platdata(emul);
int len;
u8 *ptr;
 
if (!plat->size)
return -ENODEV;
len = msg->len;
-   debug("   %s: msg->len=%d",
+   debug("   %s: msg->addr=%x msg->len=%d",
  msg->flags & I2C_M_RD ? "read" : "write",
- msg->len);
+ msg->addr, msg->len);
if (msg->flags & I2C_M_RD) {
if (plat->test_mode == SIE_TEST_MODE_SINGLE_BYTE)
len = 1;
@@ -153,6 +161,7 @@ static int sandbox_i2c_eeprom_ofdata_to_platdata(struct 
udevice *dev)
}
plat->test_mode = SIE_TEST_MODE_NONE;
plat->offset_len = 1;
+   plat->chip_addr_offset_mask = 0;
 
return 0;
 }
diff --git a/test/dm/i2c.c b/test/dm/i2c.c
index bf5597b7a6..4035f82f46 100644
--- a/test/dm/i2c.c
+++ b/test/dm/i2c.c
@@ -241,3 +241,67 @@ static int dm_test_i2c_offset(struct unit_test_state *uts)
return 0;
 }
 DM_TEST(dm_test_i2c_offset, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+static int dm_test_i2c_addr_offset(struct unit_test_state *uts)
+{
+   struct udevice *eeprom;
+   struct udevice *dev;
+   u8 buf[5];
+
+   ut_assertok(i2c_get_chip_for_busnum(busnum, chip, 1, &dev));
+
+   /* Do a transfer so we can find the emulator */
+   ut_assertok(dm_i2c_read(dev, 0, buf, 5));
+   ut_assertok(uclass_first_device(UCLASS_I2C_EMUL, &eeprom));
+
+   /* Offset length 0 */
+   sandbox_i2c_eeprom_set_offset_len(eeprom, 0);
+   sandbox_i2c_eeprom_set_chip_addr_offset_mask(eeprom, 0x3);
+   ut_assertok(i2c_set_chip_offset_len(dev, 0));
+   ut_assertok(i2c_set_chip_addr_offset_mask(dev, 0x3));
+   ut_assertok(dm_i2c_write(dev, 0x3, (uint8_t *)"AB", 2));
+   ut_assertok(dm_i2c_read(dev, 0x3, buf, 5));
+   ut_asserteq_mem("AB\0\0\0\0", buf, sizeof(buf));
+   ut_asserteq(0x3, sanbox_i2c_eeprom_get_prev_offset(eeprom));
+   ut_asserteq(chip | 0x3, sanbox_i2c_eeprom_get_prev_addr(eeprom));
+
+   /* Offset length 1 */
+   sandbox_i2c_eeprom_set_offset_len(eeprom, 1);
+   sandbox_i2c_eeprom_set_chip_addr_offset_mask(eeprom, 0x3);
+   ut_assertok(i2c_set_chip

[U-Boot] [PATCH 2/3] dm: i2c: EEPROM simulator allow tests visibility of addr and offset

2019-10-28 Thread Robert Beckett
Improve i2c EEPROM simulator testing by providing access functions to
check the previous chip addr and offset.

Given that we can now directly test the offsets, also simplified the
offset mapping and allow for wrapping acceses.

Signed-off-by: Robert Beckett 
---

 arch/sandbox/include/asm/test.h |  4 +++
 drivers/misc/i2c_eeprom_emul.c  | 61 +
 test/dm/i2c.c   | 50 +++
 3 files changed, 86 insertions(+), 29 deletions(-)

diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h
index cd2b9e3155..73cb451e7f 100644
--- a/arch/sandbox/include/asm/test.h
+++ b/arch/sandbox/include/asm/test.h
@@ -72,6 +72,10 @@ void sandbox_i2c_eeprom_set_test_mode(struct udevice *dev,
 
 void sandbox_i2c_eeprom_set_offset_len(struct udevice *dev, int offset_len);
 
+uint sanbox_i2c_eeprom_get_prev_addr(struct udevice *dev);
+
+uint sanbox_i2c_eeprom_get_prev_offset(struct udevice *dev);
+
 /**
  * sandbox_i2c_rtc_set_offset() - set the time offset from system/base time
  *
diff --git a/drivers/misc/i2c_eeprom_emul.c b/drivers/misc/i2c_eeprom_emul.c
index 29ed45923f..284267f2ea 100644
--- a/drivers/misc/i2c_eeprom_emul.c
+++ b/drivers/misc/i2c_eeprom_emul.c
@@ -27,6 +27,8 @@ struct sandbox_i2c_flash_plat_data {
 
 struct sandbox_i2c_flash {
uint8_t *data;
+   uint prev_addr; /* slave address of previous access */
+   uint prev_offset;   /* offset of previous access */
 };
 
 void sandbox_i2c_eeprom_set_test_mode(struct udevice *dev,
@@ -44,6 +46,20 @@ void sandbox_i2c_eeprom_set_offset_len(struct udevice *dev, 
int offset_len)
plat->offset_len = offset_len;
 }
 
+uint sanbox_i2c_eeprom_get_prev_addr(struct udevice *dev)
+{
+   struct sandbox_i2c_flash *priv = dev_get_priv(dev);
+
+   return priv->prev_addr;
+}
+
+uint sanbox_i2c_eeprom_get_prev_offset(struct udevice *dev)
+{
+   struct sandbox_i2c_flash *priv = dev_get_priv(dev);
+
+   return priv->prev_offset;
+}
+
 static int sandbox_i2c_eeprom_xfer(struct udevice *emul, struct i2c_msg *msg,
  int nmsgs)
 {
@@ -52,6 +68,10 @@ static int sandbox_i2c_eeprom_xfer(struct udevice *emul, 
struct i2c_msg *msg,
 
debug("\n%s\n", __func__);
debug_buffer(0, priv->data, 1, 16, 0);
+
+   /* store addr for testing visibity */
+   priv->prev_addr = msg->addr;
+
for (; nmsgs > 0; nmsgs--, msg++) {
struct sandbox_i2c_flash_plat_data *plat =
dev_get_platdata(emul);
@@ -60,11 +80,6 @@ static int sandbox_i2c_eeprom_xfer(struct udevice *emul, 
struct i2c_msg *msg,
 
if (!plat->size)
return -ENODEV;
-   if (msg->addr + msg->len > plat->size) {
-   debug("%s: Address %x, len %x is outside range 0..%x\n",
- __func__, msg->addr, msg->len, plat->size);
-   return -EINVAL;
-   }
len = msg->len;
debug("   %s: msg->len=%d",
  msg->flags & I2C_M_RD ? "read" : "write",
@@ -73,7 +88,16 @@ static int sandbox_i2c_eeprom_xfer(struct udevice *emul, 
struct i2c_msg *msg,
if (plat->test_mode == SIE_TEST_MODE_SINGLE_BYTE)
len = 1;
debug(", offset %x, len %x: ", offset, len);
-   memcpy(msg->buf, priv->data + offset, len);
+   if (offset + len > plat->size) {
+   int overflow = offset + len - plat->size;
+   int initial = len - overflow;
+
+   memcpy(msg->buf, priv->data + offset, initial);
+   memcpy(msg->buf + initial, priv->data,
+  overflow);
+   } else {
+   memcpy(msg->buf, priv->data + offset, len);
+   }
memset(msg->buf + len, '\xff', msg->len - len);
debug_buffer(0, msg->buf, 1, msg->len, 0);
} else if (len >= plat->offset_len) {
@@ -87,15 +111,24 @@ static int sandbox_i2c_eeprom_xfer(struct udevice *emul, 
struct i2c_msg *msg,
if (plat->test_mode == SIE_TEST_MODE_SINGLE_BYTE)
len = min(len, 1);
 
-   /* For testing, map offsets into our limited buffer */
-   for (i = 24; i > 0; i -= 8) {
-   if (offset > (1 << i)) {
-   offset = (offset >> i) |
-   (offset & ((1 << i) - 1));
-   offset += i;
-   }
+   /* store offset for testing visibility */
+   priv->prev_offset = offset;
+

Re: [U-Boot] [PATCH] usb: ehci: add ehci max xfer size ehci config entry

2019-10-28 Thread Robert Hancock
On 2019-10-25 8:30 a.m., Gilles DOFFE wrote:
> Some USB sticks cannot handle SIZE_MAX bytes (65535) blocks transfer,
> leading to 'EHCI timed out on TD' errors.
> As it is hardly predictable, this commit adds a configuration option
> to easily reduce this EHCI max transfer size. The default value is 65535
> which corresponds to size_t max value (SIZE_MAX).

This doesn't seem like an ideal solution, as one would have to rebuild
U-Boot to cope with such a device. Do you know how the Linux kernel EHCI
driver deals with this problem?

> 
> Signed-off-by: Gilles DOFFE 
> ---
>  drivers/usb/host/Kconfig| 7 +++
>  drivers/usb/host/ehci-hcd.c | 2 +-
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index 30c6b69be8..62054c9c7a 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -222,6 +222,13 @@ config USB_EHCI_FSL
>   select  CONFIG_EHCI_HCD_INIT_AFTER_RESET
>   ---help---
> Enables support for the on-chip EHCI controller on FSL chips.
> +
> +config USB_EHCI_MAX_XFER_SIZE
> +int "USB EHCI max transfer size. The default value is 65535 which
> +corresponds to size_t max value (SIZE_MAX)."
> +default 65535
> +range 1 65535
> +
>  endif # USB_EHCI_HCD
>  
>  config USB_OHCI_HCD
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 61a61abb21..8be1319079 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -1614,7 +1614,7 @@ static int ehci_get_max_xfer_size(struct udevice *dev, 
> size_t *size)
>* EHCD can handle any transfer length as long as there is enough
>* free heap space left, hence set the theoretical max number here.
>*/
> - *size = SIZE_MAX;
> + *size = CONFIG_USB_EHCI_MAX_XFER_SIZE;
>  
>   return 0;
>  }
> 

-- 
Robert Hancock
Senior Software Developer
SED Systems, a division of Calian Ltd.
Email: hanc...@sedsystems.ca
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 09/10] board: ge: bx50v3: use imx wdt

2019-10-28 Thread Robert Beckett
Enable DM imx WDT
Enable SYSRESET_WATCHDOG to maintain WDT based reset ability

Signed-off-by: Robert Beckett 
---

 arch/arm/dts/imx6q-bx50v3-uboot.dtsi | 12 
 arch/arm/dts/imx6q-bx50v3.dtsi   |  1 +
 configs/ge_bx50v3_defconfig  |  3 +++
 3 files changed, 16 insertions(+)
 create mode 100644 arch/arm/dts/imx6q-bx50v3-uboot.dtsi

diff --git a/arch/arm/dts/imx6q-bx50v3-uboot.dtsi 
b/arch/arm/dts/imx6q-bx50v3-uboot.dtsi
new file mode 100644
index 00..88dd7e2939
--- /dev/null
+++ b/arch/arm/dts/imx6q-bx50v3-uboot.dtsi
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * Copyright 2019 Collabora Ltd
+ * Copyright 2019 General Electric Company
+ */
+
+/ {
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <&wdog1>;
+   };
+};
diff --git a/arch/arm/dts/imx6q-bx50v3.dtsi b/arch/arm/dts/imx6q-bx50v3.dtsi
index 009f88e305..bb8f562307 100644
--- a/arch/arm/dts/imx6q-bx50v3.dtsi
+++ b/arch/arm/dts/imx6q-bx50v3.dtsi
@@ -42,6 +42,7 @@
  */
 
 #include "imx6q-ba16.dtsi"
+#include "imx6q-bx50v3-uboot.dtsi"
 
 / {
mclk: clock-mclk {
diff --git a/configs/ge_bx50v3_defconfig b/configs/ge_bx50v3_defconfig
index 7bc2f40077..c24a0ba347 100644
--- a/configs/ge_bx50v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -68,6 +68,9 @@ CONFIG_DM_VIDEO=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=6000
 CONFIG_IMX_WATCHDOG=y
+CONFIG_WDT=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 # CONFIG_EFI_LOADER is not set
 CONFIG_SYS_MALLOC_F_LEN=0x4000
 CONFIG_SYS_WHITE_ON_BLACK=y
-- 
2.20.1

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


[U-Boot] [PATCH 10/10] board: ge: mx53ppd: use imx wdt

2019-10-28 Thread Robert Beckett
Enable DM imx WDT
Enable SYSRESET_WATCHDOG to maintain WDT based reset ability

Signed-off-by: Robert Beckett 
---

 arch/arm/dts/imx53-ppd-uboot.dtsi | 12 
 arch/arm/dts/imx53-ppd.dts|  1 +
 board/ge/mx53ppd/mx53ppd.c|  1 -
 configs/mx53ppd_defconfig |  3 +++
 4 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx53-ppd-uboot.dtsi

diff --git a/arch/arm/dts/imx53-ppd-uboot.dtsi 
b/arch/arm/dts/imx53-ppd-uboot.dtsi
new file mode 100644
index 00..88dd7e2939
--- /dev/null
+++ b/arch/arm/dts/imx53-ppd-uboot.dtsi
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * Copyright 2019 Collabora Ltd
+ * Copyright 2019 General Electric Company
+ */
+
+/ {
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <&wdog1>;
+   };
+};
diff --git a/arch/arm/dts/imx53-ppd.dts b/arch/arm/dts/imx53-ppd.dts
index 8f3864998c..ae98361f9a 100644
--- a/arch/arm/dts/imx53-ppd.dts
+++ b/arch/arm/dts/imx53-ppd.dts
@@ -43,6 +43,7 @@
 /dts-v1/;
 
 #include "imx53.dtsi"
+#include "imx53-ppd-uboot.dtsi"
 #include 
 
 / {
diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c
index b4d08a11ee..ad37995624 100644
--- a/board/ge/mx53ppd/mx53ppd.c
+++ b/board/ge/mx53ppd/mx53ppd.c
@@ -296,7 +296,6 @@ int board_late_init(void)
return res;
 
print_cpuinfo();
-   hw_watchdog_init();
 
check_time();
 
diff --git a/configs/mx53ppd_defconfig b/configs/mx53ppd_defconfig
index e1992e91ad..8822b74864 100644
--- a/configs/mx53ppd_defconfig
+++ b/configs/mx53ppd_defconfig
@@ -52,5 +52,8 @@ CONFIG_VIDEO=y
 # CONFIG_VIDEO_SW_CURSOR is not set
 CONFIG_WATCHDOG_TIMEOUT_MSECS=8000
 CONFIG_IMX_WATCHDOG=y
+CONFIG_WDT=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_USB=y
-- 
2.20.1

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


[U-Boot] [PATCH 07/10] board: ge: bx50v3: Enable DM for PCI and ethernet

2019-10-28 Thread Robert Beckett
From: Denis Zalevskiy 

DM for PCI pulls DM for ethernet that also needs other changes described
below to build u-boot and keep existing functionality - ability to update
MAC addresses of FEC ethernet adapter and I210 adapter connected to the
Marvell switch.

- fec_mxc driver with DM needs PHYLIB;

- configuration items are moved from ge_bx50v3.h to ge_bx50v3_defconfig;

- FEC is marked as eth0 because it is always present, so indices changed:
  I210 are still probed in the same order;

- board_eth_init() was used by legacy ethernet, setup for enet iomux and
  pcie is moved to the board_late_init();

- pci_init() is called from the board_late_init() to initiate PCI bus
  probing, so I210 devices are propagated to the device tree;

Signed-off-by: Denis Zalevskiy 
[Describe PHY reset in device tree]
Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 board/ge/bx50v3/bx50v3.c| 75 +++--
 configs/ge_bx50v3_defconfig |  8 
 include/configs/ge_bx50v3.h | 12 --
 3 files changed, 21 insertions(+), 74 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 988d3b19b5..05fa792ed8 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -35,6 +35,8 @@
 #include "../common/ge_common.h"
 #include "../common/vpd_reader.h"
 #include "../../../drivers/net/e1000.h"
+#include 
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static int confidx;  /* Default to generic. */
@@ -82,38 +84,6 @@ static iomux_v3_cfg_t const uart4_pads[] = {
MX6_PAD_KEY_ROW0__UART4_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
-static iomux_v3_cfg_t const enet_pads[] = {
-   MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_ENET_MDC__ENET_MDC   | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_ENET_REF_CLK__ENET_TX_CLK  | MUX_PAD_CTRL(ENET_CLK_PAD_CTRL),
-   MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   /* AR8033 PHY Reset */
-   MX6_PAD_ENET_TX_EN__GPIO1_IO28 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-static void setup_iomux_enet(void)
-{
-   imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
-
-   /* Reset AR8033 PHY */
-   gpio_request(IMX_GPIO_NR(1, 28), "fec_rst");
-   gpio_direction_output(IMX_GPIO_NR(1, 28), 0);
-   mdelay(10);
-   gpio_set_value(IMX_GPIO_NR(1, 28), 1);
-   mdelay(1);
-}
-
 static struct i2c_pads_info i2c_pad_info1 = {
.scl = {
.i2c_mode = MX6_PAD_CSI0_DAT9__I2C1_SCL | I2C_PAD,
@@ -153,16 +123,6 @@ static struct i2c_pads_info i2c_pad_info3 = {
}
 };
 
-static iomux_v3_cfg_t const pcie_pads[] = {
-   MX6_PAD_GPIO_5__GPIO1_IO05 | MUX_PAD_CTRL(NO_PAD_CTRL),
-   MX6_PAD_GPIO_17__GPIO7_IO12 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-static void setup_pcie(void)
-{
-   imx_iomux_v3_setup_multiple_pads(pcie_pads, ARRAY_SIZE(pcie_pads));
-}
-
 static void setup_iomux_uart(void)
 {
imx_iomux_v3_setup_multiple_pads(uart3_pads, ARRAY_SIZE(uart3_pads));
@@ -454,7 +414,7 @@ static int vpd_callback(struct vpd_cache *vpd, u8 id, u8 
version, u8 type,
 
 static void process_vpd(struct vpd_cache *vpd)
 {
-   int fec_index = -1;
+   int fec_index = 0;
int i210_index = -1;
 
if (!vpd->is_read) {
@@ -462,41 +422,30 @@ static void process_vpd(struct vpd_cache *vpd)
return;
}
 
+   if (vpd->has & VPD_HAS_MAC1)
+   eth_env_set_enetaddr_by_index("eth", fec_index, vpd->mac1);
+
+   env_set("ethact", "eth0");
+
switch (vpd->product_id) {
case VPD_PRODUCT_B450:
env_set("confidx", "1");
-   i210_index = 0;
-   fec_index = 1;
+   i210_index = 1;
break;
case VPD_PRODUCT_B650:
env_set("confidx", "2");
-   i210_index = 0;
-   fec_index = 1;
+   i210_index = 1;
break;
case VPD_PRODUCT_B850:
env_set("confidx", "3");
-   i210_index = 1;
-   fec_index = 2;
+   i210_index = 2;
break;
}
 
-   if (fec_index >= 0 && (vpd->has & VPD_HAS_MAC1))
-   eth_env_set_

[U-Boot] [PATCH 08/10] board: ge: pass rtc_status via device tree

2019-10-28 Thread Robert Beckett
From: Ian Ray 

Pass rtc_status via the device tree, instead of on kernel command line.
Additionally, the 2038 mitigation is reported, if applied successfully.

Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 board/ge/bx50v3/bx50v3.c|  7 ++-
 board/ge/common/ge_common.c | 20 +---
 board/ge/mx53ppd/mx53ppd.c  |  7 ++-
 include/configs/ge_bx50v3.h |  2 +-
 include/configs/mx53ppd.h   |  2 +-
 5 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 05fa792ed8..ea2564ecf3 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -648,8 +648,13 @@ int checkboard(void)
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
+   char *rtc_status = env_get("rtc_status");
+
fdt_setprop(blob, 0, "ge,boot-ver", version_string,
-   strlen(version_string) + 1);
+   strlen(version_string) + 1);
+
+   fdt_setprop(blob, 0, "ge,rtc-status", rtc_status,
+   strlen(rtc_status) + 1);
return 0;
 }
 #endif
diff --git a/board/ge/common/ge_common.c b/board/ge/common/ge_common.c
index 501c8b2daf..d7e21deca7 100644
--- a/board/ge/common/ge_common.c
+++ b/board/ge/common/ge_common.c
@@ -17,8 +17,10 @@ void check_time(void)
unsigned int current_i2c_bus = i2c_get_bus_num();
 
ret = i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM);
-   if (ret < 0)
+   if (ret < 0) {
+   env_set("rtc_status", "FAIL");
return;
+   }
 
rtc_init();
 
@@ -28,10 +30,7 @@ void check_time(void)
break;
}
 
-   if (ret < 0)
-   env_set("rtc_status", "RTC_ERROR");
-
-   if (tm.tm_year > 2037) {
+   if (!ret && tm.tm_year > 2037) {
tm.tm_sec  = 0;
tm.tm_min  = 0;
tm.tm_hour = 0;
@@ -46,10 +45,17 @@ void check_time(void)
break;
}
 
-   if (ret < 0)
-   env_set("rtc_status", "RTC_ERROR");
+   if (ret >= 0)
+   ret = 2038;
}
 
+   if (ret < 0)
+   env_set("rtc_status", "FAIL");
+   else if (ret == 2038)
+   env_set("rtc_status", "2038");
+   else
+   env_set("rtc_status", "OK");
+
i2c_set_bus_num(current_i2c_bus);
 }
 
diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c
index 5448567298..b4d08a11ee 100644
--- a/board/ge/mx53ppd/mx53ppd.c
+++ b/board/ge/mx53ppd/mx53ppd.c
@@ -313,8 +313,13 @@ int checkboard(void)
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
+   char *rtc_status = env_get("rtc_status");
+
fdt_setprop(blob, 0, "ge,boot-ver", version_string,
-   strlen(version_string) + 1);
+   strlen(version_string) + 1);
+
+   fdt_setprop(blob, 0, "ge,rtc-status", rtc_status,
+   strlen(rtc_status) + 1);
return 0;
 }
 #endif
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index d572424831..7c26608aa7 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -93,7 +93,7 @@
"setargs=setenv bootargs root=/dev/${rootdev}${partnum} " \
"ro rootwait cma=128M " \
"bootcause=${bootcause} " \
-   "${quiet} console=${console} ${rtc_status} " \
+   "${quiet} console=${console} " \
"${videoargs}" "\0" \
"doquiet=" \
"if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \
diff --git a/include/configs/mx53ppd.h b/include/configs/mx53ppd.h
index 59988efc9b..26e4b729bb 100644
--- a/include/configs/mx53ppd.h
+++ b/include/configs/mx53ppd.h
@@ -101,7 +101,7 @@
"lvds=ldb\0" \
"setargs=setenv bootargs ${lvds} jtag=on mem=2G " \
"vt.global_cursor_default=0 bootcause=${bootcause} ${quiet} " \
-   "console=${console} ${rtc_status}\0" \
+   "console=${console}\0" \
"bootargs_emmc=setenv bootargs root=/dev/${rootdev}${partnum} ro " \
"rootwait ${bootargs}\0" \
"doquiet=if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \
-- 
2.20.1

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


[U-Boot] [PATCH 06/10] configs: ppd: DM for USB and regulators PPD

2019-10-28 Thread Robert Beckett
From: Denis Zalevskiy 

DM should be used for USB since 2019.07, it also requires DM for
regulators.

Signed-off-by: Denis Zalevskiy 
Signed-off-by: Robert Beckett 
---

 configs/mx53ppd_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/mx53ppd_defconfig b/configs/mx53ppd_defconfig
index 7f293c8e9a..e1992e91ad 100644
--- a/configs/mx53ppd_defconfig
+++ b/configs/mx53ppd_defconfig
@@ -52,3 +52,5 @@ CONFIG_VIDEO=y
 # CONFIG_VIDEO_SW_CURSOR is not set
 CONFIG_WATCHDOG_TIMEOUT_MSECS=8000
 CONFIG_IMX_WATCHDOG=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_USB=y
-- 
2.20.1

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


[U-Boot] [PATCH 05/10] board: ge: bx50v3: Fix message output to video console

2019-10-28 Thread Robert Beckett
From: Ian Ray 

Use vidconsole for output to the LCD, now that DM_VIDEO is used.  Write
white text on a black background, like before migrating to DM_VIDEO.

Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 board/ge/bx50v3/bx50v3.c| 21 ++---
 configs/ge_bx50v3_defconfig |  1 +
 include/configs/ge_bx50v3.h |  9 -
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 747171bf19..988d3b19b5 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -218,13 +218,6 @@ static void do_enable_hdmi(struct display_info_t const 
*dev)
imx_enable_hdmi_phy();
 }
 
-int board_cfb_skip(void)
-{
-   gpio_direction_output(LVDS_POWER_GP, 1);
-
-   return 0;
-}
-
 static int is_b850v3(void)
 {
return confidx == 3;
@@ -712,8 +705,14 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 static int do_backlight_enable(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 {
+#if CONFIG_IS_ENABLED(DM_VIDEO)
+   int ret;
+   struct udevice *dev;
+
 #ifdef CONFIG_VIDEO_IPUV3
if (!is_b850v3()) {
+   gpio_direction_output(LVDS_POWER_GP, 1);
+
/* We need at least 200ms between power on and backlight on
 * as per specifications from CHI MEI
 */
@@ -732,6 +731,14 @@ static int do_backlight_enable(cmd_tbl_t *cmdtp, int flag, 
int argc, char * cons
}
 #endif
 
+   /* Probe, to find a video device to be used to show a message on
+* the vidconsole.
+*/
+   ret = uclass_get_device(UCLASS_VIDEO, 0, &dev);
+   if (ret)
+   return ret;
+#endif
+
return 0;
 }
 
diff --git a/configs/ge_bx50v3_defconfig b/configs/ge_bx50v3_defconfig
index 0c34abdf6f..e81ae91c5f 100644
--- a/configs/ge_bx50v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -70,3 +70,4 @@ CONFIG_WATCHDOG_TIMEOUT_MSECS=6000
 CONFIG_IMX_WATCHDOG=y
 # CONFIG_EFI_LOADER is not set
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SYS_WHITE_ON_BLACK=y
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index 6de5119d7f..92a927bb82 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -114,12 +114,11 @@
"swappartitions=" \
"setexpr partnum 3 - ${partnum}\0" \
"failbootcmd=" \
+   "echo reached failbootcmd; " \
"bx50_backlight_enable; " \
-   "msg=\"Monitor failed to start.  Try again, or contact GE 
Service for support.\"; " \
-   "echo $msg; " \
-   "setenv stdout vga; " \
-   "echo \"\n\n\n\n\" $msg; " \
-   "setenv stdout serial; " \
+   "setcurs 5 4; " \
+   "lcdputs \"Monitor failed to start. " \
+   "Try again, or contact GE Service for support.\"; " \
"mw.b 0x7000A000 0xbc; " \
"mw.b 0x7000A001 0x00; " \
"ext4write ${dev} ${devnum}:5 0x7000A000 /boot/failures 2\0" \
-- 
2.20.1

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


[U-Boot] [PATCH 04/10] board: ge: bx50v3: Fix run-time warning

2019-10-28 Thread Robert Beckett
From: Ian Ray 

Fix GPIO reservation warning on code paths that do not need LVDS power.

Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 board/ge/bx50v3/bx50v3.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 530b106ba5..747171bf19 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -713,20 +713,23 @@ int ft_board_setup(void *blob, bd_t *bd)
 static int do_backlight_enable(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 {
 #ifdef CONFIG_VIDEO_IPUV3
-   /* We need at least 200ms between power on and backlight on
-* as per specifications from CHI MEI */
-   mdelay(250);
+   if (!is_b850v3()) {
+   /* We need at least 200ms between power on and backlight on
+* as per specifications from CHI MEI
+*/
+   mdelay(250);
 
-   /* enable backlight PWM 1 */
-   pwm_init(0, 0, 0);
+   /* enable backlight PWM 1 */
+   pwm_init(0, 0, 0);
 
-   /* duty cycle 500ns, period: 500ns */
-   pwm_config(0, 500, 500);
+   /* duty cycle 500ns, period: 500ns */
+   pwm_config(0, 500, 500);
 
-   /* Backlight Power */
-   gpio_direction_output(LVDS_BACKLIGHT_GP, 1);
+   /* Backlight Power */
+   gpio_direction_output(LVDS_BACKLIGHT_GP, 1);
 
-   pwm_enable(0);
+   pwm_enable(0);
+   }
 #endif
 
return 0;
-- 
2.20.1

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


[U-Boot] [PATCH 03/10] configs: bx50v3: Fix boot hang with video

2019-10-28 Thread Robert Beckett
From: Ian Ray 

Fixes commit: 0b09f7b15052bb419e318e38da453be46e5a13e5, which converted
to DM_VIDEO, but requires more memory.

[Inspired by 9002e735e71754a90adbb9676c0ffb1964dbc288]

Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 configs/ge_bx50v3_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/ge_bx50v3_defconfig b/configs/ge_bx50v3_defconfig
index 8c838587eb..0c34abdf6f 100644
--- a/configs/ge_bx50v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -69,3 +69,4 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=6000
 CONFIG_IMX_WATCHDOG=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_SYS_MALLOC_F_LEN=0x4000
-- 
2.20.1

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


[U-Boot] [PATCH 02/10] board: ge: ppd: sync device tree from Linux

2019-10-28 Thread Robert Beckett
Copy device tree from linux for PPD.

Signed-off-by: Robert Beckett 
---

 arch/arm/dts/imx53-ppd.dts | 1080 +++-
 1 file changed, 1061 insertions(+), 19 deletions(-)

diff --git a/arch/arm/dts/imx53-ppd.dts b/arch/arm/dts/imx53-ppd.dts
index f89d6f4672..8f3864998c 100644
--- a/arch/arm/dts/imx53-ppd.dts
+++ b/arch/arm/dts/imx53-ppd.dts
@@ -1,43 +1,1085 @@
-/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
+// SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2018 General Electric Company
- * Based on imx53-ppd.dts from kernel 4.20.5.
+ * Copyright 2014 General Electric Company
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
 
 #include "imx53.dtsi"
+#include 
 
 / {
model = "General Electric CS ONE";
compatible = "ge,imx53-cpuvo", "fsl,imx53";
+
+   aliases {
+   spi0 = &cspi;
+   spi1 = &ecspi1;
+   spi2 = &ecspi2;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@7000 {
+   device_type = "memory";
+   reg = <0x7000 0x2000>,
+ <0xb000 0x2000>;
+   };
+
+   cko2_11M: sgtl-clock-cko2 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <11289600>;
+   };
+
+   sgtlsound: sound {
+   compatible = "fsl,imx53-cpuvo-sgtl5000",
+"fsl,imx-audio-sgtl5000";
+   model = "imx53-cpuvo-sgtl5000";
+   ssi-controller = <&ssi2>;
+   audio-codec = <&sgtl5000>;
+   audio-routing =
+   "MIC_IN", "Mic Jack",
+   "Mic Jack", "Mic Bias",
+   "Headphone Jack", "HP_OUT";
+   mux-int-port = <2>;
+   mux-ext-port = <6>;
+   };
+
+   reg_sgtl5k: regulator-sgtl5k {
+   compatible = "regulator-fixed";
+   regulator-name = "regulator-sgtl5k";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-always-on;
+   };
+
+   reg_usb_otg_vbus: regulator-usb-otg-vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usbotg_vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   pinctrl-0 = <&pinctrl_usb_otg_vbus>;
+   gpio = <&gpio4 15 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
+
+   reg_usb_vbus: regulator-usb-vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usbh1_vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   regulator-always-on;
+   };
+
+   reg_usbh2_vbus: regulator-usbh2-vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usbh2_vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <5000

[U-Boot] [PATCH 01/10] board: ge: bx50v3: sync devicetrees from Linux

2019-10-28 Thread Robert Beckett
Copy device trees from linux, keeping them as separate files for
each board to ease future sync.

Update board code to use generic bx50v3 dt initially, then select
the specific dt based on board detection.

Signed-off-by: Robert Beckett 
---

 arch/arm/dts/Makefile  |   7 +-
 arch/arm/dts/imx6q-b450v3.dts  | 160 +
 arch/arm/dts/imx6q-b650v3.dts  | 159 
 arch/arm/dts/imx6q-b850v3.dts  | 302 
 arch/arm/dts/imx6q-ba16.dtsi   | 640 +
 arch/arm/dts/imx6q-bx50v3.dts  |  78 +---
 arch/arm/dts/imx6q-bx50v3.dtsi | 380 
 board/ge/bx50v3/bx50v3.c   |  34 +-
 configs/ge_bx50v3_defconfig|   5 +
 9 files changed, 1689 insertions(+), 76 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-b450v3.dts
 create mode 100644 arch/arm/dts/imx6q-b650v3.dts
 create mode 100644 arch/arm/dts/imx6q-b850v3.dts
 create mode 100644 arch/arm/dts/imx6q-ba16.dtsi
 create mode 100644 arch/arm/dts/imx6q-bx50v3.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 6a7dbb6309..6eaa0b6f26 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -821,7 +821,12 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7629-rfb.dtb \
mt8516-pumpkin.dtb
 
-dtb-$(CONFIG_TARGET_GE_BX50V3) += imx6q-bx50v3.dtb
+dtb-$(CONFIG_TARGET_GE_BX50V3) += \
+   imx6q-bx50v3.dtb \
+   imx6q-b850v3.dtb \
+   imx6q-b650v3.dtb \
+   imx6q-b450v3.dtb
+
 dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
 
 dtb-$(CONFIG_TARGET_VEXPRESS_CA5X2) += vexpress-v2p-ca5s.dtb
diff --git a/arch/arm/dts/imx6q-b450v3.dts b/arch/arm/dts/imx6q-b450v3.dts
new file mode 100644
index 00..7fca833cbf
--- /dev/null
+++ b/arch/arm/dts/imx6q-b450v3.dts
@@ -0,0 +1,160 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * Copyright 2015 Timesys Corporation.
+ * Copyright 2015 General Electric Company
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "imx6q-bx50v3.dtsi"
+
+/ {
+   model = "General Electric B450v3";
+   compatible = "ge,imx6q-b450v3", "advantech,imx6q-ba16", "fsl,imx6q";
+
+   chosen {
+   stdout-path = &uart3;
+   };
+
+   panel-lvds0 {
+   compatible = "innolux,g121x1-l03";
+   backlight = <&backlight_lvds>;
+   power-supply = <®_lvds>;
+
+   port {
+   panel_in_lvds0: endpoint {
+   remote-endpoint = <&lvds0_out>;
+   };
+   };
+   };
+};
+
+&clks {
+   assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+ <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
+   assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
+<&clks IMX6QDL_CLK_PLL3_USB_OTG>;
+};
+
+&ldb {
+   status = "okay";
+
+   lvds0: lvds-channel@0 {
+   fsl,data-mapping = "spwg";
+   fsl,data-width = <24>;
+   status = "okay";
+
+   port@4 {
+   reg = <4>;
+
+   lvds0_out: endpoint {
+   remote-endpoi

[U-Boot] [PATCH 00/10] GE boards initial DM conversion

2019-10-28 Thread Robert Beckett

This searies syncs the device trees from Linux, fixes a couple of issues
and starts enabling DM features for GE boards.


Denis Zalevskiy (2):
  configs: ppd: DM for USB and regulators PPD
  board: ge: bx50v3: Enable DM for PCI and ethernet

Ian Ray (4):
  configs: bx50v3: Fix boot hang with video
  board: ge: bx50v3: Fix run-time warning
  board: ge: bx50v3: Fix message output to video console
  board: ge: pass rtc_status via device tree

Robert Beckett (4):
  board: ge: bx50v3: sync devicetrees from Linux
  board: ge: ppd: sync device tree from Linux
  board: ge: bx50v3: use imx wdt
  board: ge: mx53ppd: use imx wdt

 arch/arm/dts/Makefile|7 +-
 arch/arm/dts/imx53-ppd-uboot.dtsi|   12 +
 arch/arm/dts/imx53-ppd.dts   | 1081 +-
 arch/arm/dts/imx6q-b450v3.dts|  160 
 arch/arm/dts/imx6q-b650v3.dts|  159 
 arch/arm/dts/imx6q-b850v3.dts|  302 +++
 arch/arm/dts/imx6q-ba16.dtsi |  640 +++
 arch/arm/dts/imx6q-bx50v3-uboot.dtsi |   12 +
 arch/arm/dts/imx6q-bx50v3.dts|   78 +-
 arch/arm/dts/imx6q-bx50v3.dtsi   |  381 +
 board/ge/bx50v3/bx50v3.c |  160 ++--
 board/ge/common/ge_common.c  |   20 +-
 board/ge/mx53ppd/mx53ppd.c   |8 +-
 configs/ge_bx50v3_defconfig  |   18 +
 configs/mx53ppd_defconfig|5 +
 include/configs/ge_bx50v3.h  |   23 +-
 include/configs/mx53ppd.h|2 +-
 17 files changed, 2865 insertions(+), 203 deletions(-)
 create mode 100644 arch/arm/dts/imx53-ppd-uboot.dtsi
 create mode 100644 arch/arm/dts/imx6q-b450v3.dts
 create mode 100644 arch/arm/dts/imx6q-b650v3.dts
 create mode 100644 arch/arm/dts/imx6q-b850v3.dts
 create mode 100644 arch/arm/dts/imx6q-ba16.dtsi
 create mode 100644 arch/arm/dts/imx6q-bx50v3-uboot.dtsi
 create mode 100644 arch/arm/dts/imx6q-bx50v3.dtsi

-- 
2.20.1

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


Re: [U-Boot] [GIT] Pull request: u-boot-dfu (15.10.2019)

2019-10-28 Thread Lukasz Majewski
Hi Marek,

> Hi Marek,
> 
> > On 10/15/19 9:45 AM, Lukasz Majewski wrote:  
> > > Dear Marek,
> > 
> > Hello Lukasz,
> >   
> > > The following changes since commit
> > > 7a779ed1755c2d5011bd9598da90291f759ae760:
> > > 
> > >   travis: Exclude MIPS from the bcm job (2019-10-13 11:21:56
> > > -0400)
> > > 
> > > are available in the Git repository at:
> > > 
> > >   g...@gitlab.denx.de:u-boot/custodians/u-boot-dfu.git 
> > > 
> > > for you to fetch changes up to
> > > 5d897631065bb2f36bbc1bd7fabb670ce5da3ce8:
> > > 
> > >   dfu: add callback for flush and initiated operation (2019-10-14
> > >   12:26:19 +0200)
> > 
> > Which branch shall I pull ? This information is missing from the PR,
> > again :-(  
> 
> Ach. I'm still (unfortunately) use my old script for PR.
> 
> You shall use the -master branch:
> https://gitlab.denx.de/u-boot/custodians/u-boot-dfu/commits/master
> 
> I've written also the merge tag for this PR:
> https://gitlab.denx.de/u-boot/custodians/u-boot-dfu/-/tags
> 
> Sorry for inconvenience and confusion.

Marek, are there any issues with this PR? 

Unfortunately, I did not noticed it being applied to your u-boot-usb
tree. Do you need any help?

> 
> 
> Best regards,
> 
> Lukasz Majewski
> 
> --
> 
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> lu...@denx.de




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lu...@denx.de


pgpKSjRnrRBnR.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 6/9] phy: atheros: fix delay configuration

2019-10-28 Thread Vladimir Oltean
On Sat, 26 Oct 2019 at 03:31, Michael Walle  wrote:
>
> The delay_config() code could only set the delay bit. Thus, it could
> only enable the delay mode, but not disable it. To make things worse,
> the RX delay mode is enabled by default after a hardware reset, so it
> could never be disabled. Fix this, by always setting or clearing the
> bits. This is also how the linux kernel configures the PHY.
>
> If bisecting shows that this commit breaks your board you probably have
> a wrong PHY interface mode. You probably want the
> PHY_INTERFACE_MODE_RGMII_RXID or PHY_INTERFACE_MODE_RGMII_ID mode.
>
> Signed-off-by: Michael Walle 
> ---
>  drivers/net/phy/atheros.c | 10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c
> index 4b7a1fb9c4..8bf26626ff 100644
> --- a/drivers/net/phy/atheros.c
> +++ b/drivers/net/phy/atheros.c
> @@ -78,6 +78,11 @@ static int ar803x_delay_config(struct phy_device *phydev)
> 0, AR803x_RGMII_TX_CLK_DLY);
> if (ret < 0)
> return ret;
> +   } else {
> +   ret = ar803x_debug_reg_mask(phydev, AR803x_DEBUG_REG_5,
> +   AR803x_RGMII_TX_CLK_DLY, 0);
> +   if (ret < 0)
> +   return ret;
> }
>
> if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID ||
> @@ -86,6 +91,11 @@ static int ar803x_delay_config(struct phy_device *phydev)
> 0, AR803x_RGMII_RX_CLK_DLY);
> if (ret < 0)
> return ret;
> +   } else {
> +   ret = ar803x_debug_reg_mask(phydev, AR803x_DEBUG_REG_0,
> +   AR803x_RGMII_RX_CLK_DLY, 0);
> +   if (ret < 0)
> +   return ret;
> }
>
> return 0;
> --
> 2.20.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot

Hi Michael,

Are you aware of this discussion thread?
https://www.mail-archive.com/u-boot@lists.denx.de/msg326821.html

Thanks,
-Vladimir
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 09/10] board: ge: bx50v3: use imx wdt

2019-10-28 Thread Robert Beckett
Enable DM imx WDT
Enable SYSRESET_WATCHDOG to maintain WDT based reset ability

Signed-off-by: Robert Beckett 
---

 arch/arm/dts/imx6q-bx50v3-uboot.dtsi | 12 
 arch/arm/dts/imx6q-bx50v3.dtsi   |  1 +
 configs/ge_bx50v3_defconfig  |  3 +++
 3 files changed, 16 insertions(+)
 create mode 100644 arch/arm/dts/imx6q-bx50v3-uboot.dtsi

diff --git a/arch/arm/dts/imx6q-bx50v3-uboot.dtsi 
b/arch/arm/dts/imx6q-bx50v3-uboot.dtsi
new file mode 100644
index 00..88dd7e2939
--- /dev/null
+++ b/arch/arm/dts/imx6q-bx50v3-uboot.dtsi
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * Copyright 2019 Collabora Ltd
+ * Copyright 2019 General Electric Company
+ */
+
+/ {
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <&wdog1>;
+   };
+};
diff --git a/arch/arm/dts/imx6q-bx50v3.dtsi b/arch/arm/dts/imx6q-bx50v3.dtsi
index 009f88e305..bb8f562307 100644
--- a/arch/arm/dts/imx6q-bx50v3.dtsi
+++ b/arch/arm/dts/imx6q-bx50v3.dtsi
@@ -42,6 +42,7 @@
  */
 
 #include "imx6q-ba16.dtsi"
+#include "imx6q-bx50v3-uboot.dtsi"
 
 / {
mclk: clock-mclk {
diff --git a/configs/ge_bx50v3_defconfig b/configs/ge_bx50v3_defconfig
index 7bc2f40077..c24a0ba347 100644
--- a/configs/ge_bx50v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -68,6 +68,9 @@ CONFIG_DM_VIDEO=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=6000
 CONFIG_IMX_WATCHDOG=y
+CONFIG_WDT=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 # CONFIG_EFI_LOADER is not set
 CONFIG_SYS_MALLOC_F_LEN=0x4000
 CONFIG_SYS_WHITE_ON_BLACK=y
-- 
2.20.1

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


[U-Boot] [PATCH 10/10] board: ge: mx53ppd: use imx wdt

2019-10-28 Thread Robert Beckett
Enable DM imx WDT
Enable SYSRESET_WATCHDOG to maintain WDT based reset ability

Signed-off-by: Robert Beckett 
---

 arch/arm/dts/imx53-ppd-uboot.dtsi | 12 
 arch/arm/dts/imx53-ppd.dts|  1 +
 board/ge/mx53ppd/mx53ppd.c|  1 -
 configs/mx53ppd_defconfig |  3 +++
 4 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/imx53-ppd-uboot.dtsi

diff --git a/arch/arm/dts/imx53-ppd-uboot.dtsi 
b/arch/arm/dts/imx53-ppd-uboot.dtsi
new file mode 100644
index 00..88dd7e2939
--- /dev/null
+++ b/arch/arm/dts/imx53-ppd-uboot.dtsi
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * Copyright 2019 Collabora Ltd
+ * Copyright 2019 General Electric Company
+ */
+
+/ {
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <&wdog1>;
+   };
+};
diff --git a/arch/arm/dts/imx53-ppd.dts b/arch/arm/dts/imx53-ppd.dts
index 8f3864998c..ae98361f9a 100644
--- a/arch/arm/dts/imx53-ppd.dts
+++ b/arch/arm/dts/imx53-ppd.dts
@@ -43,6 +43,7 @@
 /dts-v1/;
 
 #include "imx53.dtsi"
+#include "imx53-ppd-uboot.dtsi"
 #include 
 
 / {
diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c
index b4d08a11ee..ad37995624 100644
--- a/board/ge/mx53ppd/mx53ppd.c
+++ b/board/ge/mx53ppd/mx53ppd.c
@@ -296,7 +296,6 @@ int board_late_init(void)
return res;
 
print_cpuinfo();
-   hw_watchdog_init();
 
check_time();
 
diff --git a/configs/mx53ppd_defconfig b/configs/mx53ppd_defconfig
index e1992e91ad..8822b74864 100644
--- a/configs/mx53ppd_defconfig
+++ b/configs/mx53ppd_defconfig
@@ -52,5 +52,8 @@ CONFIG_VIDEO=y
 # CONFIG_VIDEO_SW_CURSOR is not set
 CONFIG_WATCHDOG_TIMEOUT_MSECS=8000
 CONFIG_IMX_WATCHDOG=y
+CONFIG_WDT=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_DM_REGULATOR=y
 CONFIG_DM_USB=y
-- 
2.20.1

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


[U-Boot] [PATCH 07/10] board: ge: bx50v3: Enable DM for PCI and ethernet

2019-10-28 Thread Robert Beckett
From: Denis Zalevskiy 

DM for PCI pulls DM for ethernet that also needs other changes described
below to build u-boot and keep existing functionality - ability to update
MAC addresses of FEC ethernet adapter and I210 adapter connected to the
Marvell switch.

- fec_mxc driver with DM needs PHYLIB;

- configuration items are moved from ge_bx50v3.h to ge_bx50v3_defconfig;

- FEC is marked as eth0 because it is always present, so indices changed:
  I210 are still probed in the same order;

- board_eth_init() was used by legacy ethernet, setup for enet iomux and
  pcie is moved to the board_late_init();

- pci_init() is called from the board_late_init() to initiate PCI bus
  probing, so I210 devices are propagated to the device tree;

Signed-off-by: Denis Zalevskiy 
[Describe PHY reset in device tree]
Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 board/ge/bx50v3/bx50v3.c| 75 +++--
 configs/ge_bx50v3_defconfig |  8 
 include/configs/ge_bx50v3.h | 12 --
 3 files changed, 21 insertions(+), 74 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 988d3b19b5..05fa792ed8 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -35,6 +35,8 @@
 #include "../common/ge_common.h"
 #include "../common/vpd_reader.h"
 #include "../../../drivers/net/e1000.h"
+#include 
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static int confidx;  /* Default to generic. */
@@ -82,38 +84,6 @@ static iomux_v3_cfg_t const uart4_pads[] = {
MX6_PAD_KEY_ROW0__UART4_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
-static iomux_v3_cfg_t const enet_pads[] = {
-   MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_ENET_MDC__ENET_MDC   | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
-   MX6_PAD_ENET_REF_CLK__ENET_TX_CLK  | MUX_PAD_CTRL(ENET_CLK_PAD_CTRL),
-   MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
-   /* AR8033 PHY Reset */
-   MX6_PAD_ENET_TX_EN__GPIO1_IO28 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-static void setup_iomux_enet(void)
-{
-   imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
-
-   /* Reset AR8033 PHY */
-   gpio_request(IMX_GPIO_NR(1, 28), "fec_rst");
-   gpio_direction_output(IMX_GPIO_NR(1, 28), 0);
-   mdelay(10);
-   gpio_set_value(IMX_GPIO_NR(1, 28), 1);
-   mdelay(1);
-}
-
 static struct i2c_pads_info i2c_pad_info1 = {
.scl = {
.i2c_mode = MX6_PAD_CSI0_DAT9__I2C1_SCL | I2C_PAD,
@@ -153,16 +123,6 @@ static struct i2c_pads_info i2c_pad_info3 = {
}
 };
 
-static iomux_v3_cfg_t const pcie_pads[] = {
-   MX6_PAD_GPIO_5__GPIO1_IO05 | MUX_PAD_CTRL(NO_PAD_CTRL),
-   MX6_PAD_GPIO_17__GPIO7_IO12 | MUX_PAD_CTRL(NO_PAD_CTRL),
-};
-
-static void setup_pcie(void)
-{
-   imx_iomux_v3_setup_multiple_pads(pcie_pads, ARRAY_SIZE(pcie_pads));
-}
-
 static void setup_iomux_uart(void)
 {
imx_iomux_v3_setup_multiple_pads(uart3_pads, ARRAY_SIZE(uart3_pads));
@@ -454,7 +414,7 @@ static int vpd_callback(struct vpd_cache *vpd, u8 id, u8 
version, u8 type,
 
 static void process_vpd(struct vpd_cache *vpd)
 {
-   int fec_index = -1;
+   int fec_index = 0;
int i210_index = -1;
 
if (!vpd->is_read) {
@@ -462,41 +422,30 @@ static void process_vpd(struct vpd_cache *vpd)
return;
}
 
+   if (vpd->has & VPD_HAS_MAC1)
+   eth_env_set_enetaddr_by_index("eth", fec_index, vpd->mac1);
+
+   env_set("ethact", "eth0");
+
switch (vpd->product_id) {
case VPD_PRODUCT_B450:
env_set("confidx", "1");
-   i210_index = 0;
-   fec_index = 1;
+   i210_index = 1;
break;
case VPD_PRODUCT_B650:
env_set("confidx", "2");
-   i210_index = 0;
-   fec_index = 1;
+   i210_index = 1;
break;
case VPD_PRODUCT_B850:
env_set("confidx", "3");
-   i210_index = 1;
-   fec_index = 2;
+   i210_index = 2;
break;
}
 
-   if (fec_index >= 0 && (vpd->has & VPD_HAS_MAC1))
-   eth_env_set_

[U-Boot] [PATCH 08/10] board: ge: pass rtc_status via device tree

2019-10-28 Thread Robert Beckett
From: Ian Ray 

Pass rtc_status via the device tree, instead of on kernel command line.
Additionally, the 2038 mitigation is reported, if applied successfully.

Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 board/ge/bx50v3/bx50v3.c|  7 ++-
 board/ge/common/ge_common.c | 20 +---
 board/ge/mx53ppd/mx53ppd.c  |  7 ++-
 include/configs/ge_bx50v3.h |  2 +-
 include/configs/mx53ppd.h   |  2 +-
 5 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 05fa792ed8..ea2564ecf3 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -648,8 +648,13 @@ int checkboard(void)
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
+   char *rtc_status = env_get("rtc_status");
+
fdt_setprop(blob, 0, "ge,boot-ver", version_string,
-   strlen(version_string) + 1);
+   strlen(version_string) + 1);
+
+   fdt_setprop(blob, 0, "ge,rtc-status", rtc_status,
+   strlen(rtc_status) + 1);
return 0;
 }
 #endif
diff --git a/board/ge/common/ge_common.c b/board/ge/common/ge_common.c
index 501c8b2daf..d7e21deca7 100644
--- a/board/ge/common/ge_common.c
+++ b/board/ge/common/ge_common.c
@@ -17,8 +17,10 @@ void check_time(void)
unsigned int current_i2c_bus = i2c_get_bus_num();
 
ret = i2c_set_bus_num(CONFIG_SYS_RTC_BUS_NUM);
-   if (ret < 0)
+   if (ret < 0) {
+   env_set("rtc_status", "FAIL");
return;
+   }
 
rtc_init();
 
@@ -28,10 +30,7 @@ void check_time(void)
break;
}
 
-   if (ret < 0)
-   env_set("rtc_status", "RTC_ERROR");
-
-   if (tm.tm_year > 2037) {
+   if (!ret && tm.tm_year > 2037) {
tm.tm_sec  = 0;
tm.tm_min  = 0;
tm.tm_hour = 0;
@@ -46,10 +45,17 @@ void check_time(void)
break;
}
 
-   if (ret < 0)
-   env_set("rtc_status", "RTC_ERROR");
+   if (ret >= 0)
+   ret = 2038;
}
 
+   if (ret < 0)
+   env_set("rtc_status", "FAIL");
+   else if (ret == 2038)
+   env_set("rtc_status", "2038");
+   else
+   env_set("rtc_status", "OK");
+
i2c_set_bus_num(current_i2c_bus);
 }
 
diff --git a/board/ge/mx53ppd/mx53ppd.c b/board/ge/mx53ppd/mx53ppd.c
index 5448567298..b4d08a11ee 100644
--- a/board/ge/mx53ppd/mx53ppd.c
+++ b/board/ge/mx53ppd/mx53ppd.c
@@ -313,8 +313,13 @@ int checkboard(void)
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
+   char *rtc_status = env_get("rtc_status");
+
fdt_setprop(blob, 0, "ge,boot-ver", version_string,
-   strlen(version_string) + 1);
+   strlen(version_string) + 1);
+
+   fdt_setprop(blob, 0, "ge,rtc-status", rtc_status,
+   strlen(rtc_status) + 1);
return 0;
 }
 #endif
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index d572424831..7c26608aa7 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -93,7 +93,7 @@
"setargs=setenv bootargs root=/dev/${rootdev}${partnum} " \
"ro rootwait cma=128M " \
"bootcause=${bootcause} " \
-   "${quiet} console=${console} ${rtc_status} " \
+   "${quiet} console=${console} " \
"${videoargs}" "\0" \
"doquiet=" \
"if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \
diff --git a/include/configs/mx53ppd.h b/include/configs/mx53ppd.h
index 59988efc9b..26e4b729bb 100644
--- a/include/configs/mx53ppd.h
+++ b/include/configs/mx53ppd.h
@@ -101,7 +101,7 @@
"lvds=ldb\0" \
"setargs=setenv bootargs ${lvds} jtag=on mem=2G " \
"vt.global_cursor_default=0 bootcause=${bootcause} ${quiet} " \
-   "console=${console} ${rtc_status}\0" \
+   "console=${console}\0" \
"bootargs_emmc=setenv bootargs root=/dev/${rootdev}${partnum} ro " \
"rootwait ${bootargs}\0" \
"doquiet=if ext2load ${dev} ${devnum}:5 0x7000A000 /boot/console; " \
-- 
2.20.1

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


[U-Boot] [PATCH 04/10] board: ge: bx50v3: Fix run-time warning

2019-10-28 Thread Robert Beckett
From: Ian Ray 

Fix GPIO reservation warning on code paths that do not need LVDS power.

Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 board/ge/bx50v3/bx50v3.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 530b106ba5..747171bf19 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -713,20 +713,23 @@ int ft_board_setup(void *blob, bd_t *bd)
 static int do_backlight_enable(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 {
 #ifdef CONFIG_VIDEO_IPUV3
-   /* We need at least 200ms between power on and backlight on
-* as per specifications from CHI MEI */
-   mdelay(250);
+   if (!is_b850v3()) {
+   /* We need at least 200ms between power on and backlight on
+* as per specifications from CHI MEI
+*/
+   mdelay(250);
 
-   /* enable backlight PWM 1 */
-   pwm_init(0, 0, 0);
+   /* enable backlight PWM 1 */
+   pwm_init(0, 0, 0);
 
-   /* duty cycle 500ns, period: 500ns */
-   pwm_config(0, 500, 500);
+   /* duty cycle 500ns, period: 500ns */
+   pwm_config(0, 500, 500);
 
-   /* Backlight Power */
-   gpio_direction_output(LVDS_BACKLIGHT_GP, 1);
+   /* Backlight Power */
+   gpio_direction_output(LVDS_BACKLIGHT_GP, 1);
 
-   pwm_enable(0);
+   pwm_enable(0);
+   }
 #endif
 
return 0;
-- 
2.20.1

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


[U-Boot] [PATCH 06/10] configs: ppd: DM for USB and regulators PPD

2019-10-28 Thread Robert Beckett
From: Denis Zalevskiy 

DM should be used for USB since 2019.07, it also requires DM for
regulators.

Signed-off-by: Denis Zalevskiy 
Signed-off-by: Robert Beckett 
---

 configs/mx53ppd_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/mx53ppd_defconfig b/configs/mx53ppd_defconfig
index 7f293c8e9a..e1992e91ad 100644
--- a/configs/mx53ppd_defconfig
+++ b/configs/mx53ppd_defconfig
@@ -52,3 +52,5 @@ CONFIG_VIDEO=y
 # CONFIG_VIDEO_SW_CURSOR is not set
 CONFIG_WATCHDOG_TIMEOUT_MSECS=8000
 CONFIG_IMX_WATCHDOG=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_USB=y
-- 
2.20.1

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


[U-Boot] [PATCH 05/10] board: ge: bx50v3: Fix message output to video console

2019-10-28 Thread Robert Beckett
From: Ian Ray 

Use vidconsole for output to the LCD, now that DM_VIDEO is used.  Write
white text on a black background, like before migrating to DM_VIDEO.

Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 board/ge/bx50v3/bx50v3.c| 21 ++---
 configs/ge_bx50v3_defconfig |  1 +
 include/configs/ge_bx50v3.h |  9 -
 3 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 747171bf19..988d3b19b5 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -218,13 +218,6 @@ static void do_enable_hdmi(struct display_info_t const 
*dev)
imx_enable_hdmi_phy();
 }
 
-int board_cfb_skip(void)
-{
-   gpio_direction_output(LVDS_POWER_GP, 1);
-
-   return 0;
-}
-
 static int is_b850v3(void)
 {
return confidx == 3;
@@ -712,8 +705,14 @@ int ft_board_setup(void *blob, bd_t *bd)
 
 static int do_backlight_enable(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 {
+#if CONFIG_IS_ENABLED(DM_VIDEO)
+   int ret;
+   struct udevice *dev;
+
 #ifdef CONFIG_VIDEO_IPUV3
if (!is_b850v3()) {
+   gpio_direction_output(LVDS_POWER_GP, 1);
+
/* We need at least 200ms between power on and backlight on
 * as per specifications from CHI MEI
 */
@@ -732,6 +731,14 @@ static int do_backlight_enable(cmd_tbl_t *cmdtp, int flag, 
int argc, char * cons
}
 #endif
 
+   /* Probe, to find a video device to be used to show a message on
+* the vidconsole.
+*/
+   ret = uclass_get_device(UCLASS_VIDEO, 0, &dev);
+   if (ret)
+   return ret;
+#endif
+
return 0;
 }
 
diff --git a/configs/ge_bx50v3_defconfig b/configs/ge_bx50v3_defconfig
index 0c34abdf6f..e81ae91c5f 100644
--- a/configs/ge_bx50v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -70,3 +70,4 @@ CONFIG_WATCHDOG_TIMEOUT_MSECS=6000
 CONFIG_IMX_WATCHDOG=y
 # CONFIG_EFI_LOADER is not set
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SYS_WHITE_ON_BLACK=y
diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
index 6de5119d7f..92a927bb82 100644
--- a/include/configs/ge_bx50v3.h
+++ b/include/configs/ge_bx50v3.h
@@ -114,12 +114,11 @@
"swappartitions=" \
"setexpr partnum 3 - ${partnum}\0" \
"failbootcmd=" \
+   "echo reached failbootcmd; " \
"bx50_backlight_enable; " \
-   "msg=\"Monitor failed to start.  Try again, or contact GE 
Service for support.\"; " \
-   "echo $msg; " \
-   "setenv stdout vga; " \
-   "echo \"\n\n\n\n\" $msg; " \
-   "setenv stdout serial; " \
+   "setcurs 5 4; " \
+   "lcdputs \"Monitor failed to start. " \
+   "Try again, or contact GE Service for support.\"; " \
"mw.b 0x7000A000 0xbc; " \
"mw.b 0x7000A001 0x00; " \
"ext4write ${dev} ${devnum}:5 0x7000A000 /boot/failures 2\0" \
-- 
2.20.1

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


[U-Boot] [PATCH 03/10] configs: bx50v3: Fix boot hang with video

2019-10-28 Thread Robert Beckett
From: Ian Ray 

Fixes commit: 0b09f7b15052bb419e318e38da453be46e5a13e5, which converted
to DM_VIDEO, but requires more memory.

[Inspired by 9002e735e71754a90adbb9676c0ffb1964dbc288]

Signed-off-by: Ian Ray 
Signed-off-by: Robert Beckett 
---

 configs/ge_bx50v3_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/ge_bx50v3_defconfig b/configs/ge_bx50v3_defconfig
index 8c838587eb..0c34abdf6f 100644
--- a/configs/ge_bx50v3_defconfig
+++ b/configs/ge_bx50v3_defconfig
@@ -69,3 +69,4 @@ CONFIG_VIDEO_IPUV3=y
 CONFIG_WATCHDOG_TIMEOUT_MSECS=6000
 CONFIG_IMX_WATCHDOG=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_SYS_MALLOC_F_LEN=0x4000
-- 
2.20.1

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


[U-Boot] [PATCH 02/10] board: ge: ppd: sync device tree from Linux

2019-10-28 Thread Robert Beckett
Copy device tree from linux for PPD.

Signed-off-by: Robert Beckett 
---

 arch/arm/dts/imx53-ppd.dts | 1080 +++-
 1 file changed, 1061 insertions(+), 19 deletions(-)

diff --git a/arch/arm/dts/imx53-ppd.dts b/arch/arm/dts/imx53-ppd.dts
index f89d6f4672..8f3864998c 100644
--- a/arch/arm/dts/imx53-ppd.dts
+++ b/arch/arm/dts/imx53-ppd.dts
@@ -1,43 +1,1085 @@
-/* SPDX-License-Identifier: GPL-2.0+ OR X11 */
+// SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright 2018 General Electric Company
- * Based on imx53-ppd.dts from kernel 4.20.5.
+ * Copyright 2014 General Electric Company
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 /dts-v1/;
 
 #include "imx53.dtsi"
+#include 
 
 / {
model = "General Electric CS ONE";
compatible = "ge,imx53-cpuvo", "fsl,imx53";
+
+   aliases {
+   spi0 = &cspi;
+   spi1 = &ecspi1;
+   spi2 = &ecspi2;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   memory@7000 {
+   device_type = "memory";
+   reg = <0x7000 0x2000>,
+ <0xb000 0x2000>;
+   };
+
+   cko2_11M: sgtl-clock-cko2 {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <11289600>;
+   };
+
+   sgtlsound: sound {
+   compatible = "fsl,imx53-cpuvo-sgtl5000",
+"fsl,imx-audio-sgtl5000";
+   model = "imx53-cpuvo-sgtl5000";
+   ssi-controller = <&ssi2>;
+   audio-codec = <&sgtl5000>;
+   audio-routing =
+   "MIC_IN", "Mic Jack",
+   "Mic Jack", "Mic Bias",
+   "Headphone Jack", "HP_OUT";
+   mux-int-port = <2>;
+   mux-ext-port = <6>;
+   };
+
+   reg_sgtl5k: regulator-sgtl5k {
+   compatible = "regulator-fixed";
+   regulator-name = "regulator-sgtl5k";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   regulator-always-on;
+   };
+
+   reg_usb_otg_vbus: regulator-usb-otg-vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usbotg_vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   pinctrl-0 = <&pinctrl_usb_otg_vbus>;
+   gpio = <&gpio4 15 GPIO_ACTIVE_HIGH>;
+   enable-active-high;
+   };
+
+   reg_usb_vbus: regulator-usb-vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usbh1_vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   regulator-always-on;
+   };
+
+   reg_usbh2_vbus: regulator-usbh2-vbus {
+   compatible = "regulator-fixed";
+   regulator-name = "usbh2_vbus";
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <5000

[U-Boot] [PATCH 01/10] board: ge: bx50v3: sync devicetrees from Linux

2019-10-28 Thread Robert Beckett
Copy device trees from linux, keeping them as separate files for
each board to ease future sync.

Update board code to use generic bx50v3 dt initially, then select
the specific dt based on board detection.

Signed-off-by: Robert Beckett 
---

 arch/arm/dts/Makefile  |   7 +-
 arch/arm/dts/imx6q-b450v3.dts  | 160 +
 arch/arm/dts/imx6q-b650v3.dts  | 159 
 arch/arm/dts/imx6q-b850v3.dts  | 302 
 arch/arm/dts/imx6q-ba16.dtsi   | 640 +
 arch/arm/dts/imx6q-bx50v3.dts  |  78 +---
 arch/arm/dts/imx6q-bx50v3.dtsi | 380 
 board/ge/bx50v3/bx50v3.c   |  34 +-
 configs/ge_bx50v3_defconfig|   5 +
 9 files changed, 1689 insertions(+), 76 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-b450v3.dts
 create mode 100644 arch/arm/dts/imx6q-b650v3.dts
 create mode 100644 arch/arm/dts/imx6q-b850v3.dts
 create mode 100644 arch/arm/dts/imx6q-ba16.dtsi
 create mode 100644 arch/arm/dts/imx6q-bx50v3.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 6a7dbb6309..6eaa0b6f26 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -821,7 +821,12 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
mt7629-rfb.dtb \
mt8516-pumpkin.dtb
 
-dtb-$(CONFIG_TARGET_GE_BX50V3) += imx6q-bx50v3.dtb
+dtb-$(CONFIG_TARGET_GE_BX50V3) += \
+   imx6q-bx50v3.dtb \
+   imx6q-b850v3.dtb \
+   imx6q-b650v3.dtb \
+   imx6q-b450v3.dtb
+
 dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
 
 dtb-$(CONFIG_TARGET_VEXPRESS_CA5X2) += vexpress-v2p-ca5s.dtb
diff --git a/arch/arm/dts/imx6q-b450v3.dts b/arch/arm/dts/imx6q-b450v3.dts
new file mode 100644
index 00..7fca833cbf
--- /dev/null
+++ b/arch/arm/dts/imx6q-b450v3.dts
@@ -0,0 +1,160 @@
+// SPDX-License-Identifier: GPL-2.0+ OR X11
+/*
+ * Copyright 2015 Timesys Corporation.
+ * Copyright 2015 General Electric Company
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "imx6q-bx50v3.dtsi"
+
+/ {
+   model = "General Electric B450v3";
+   compatible = "ge,imx6q-b450v3", "advantech,imx6q-ba16", "fsl,imx6q";
+
+   chosen {
+   stdout-path = &uart3;
+   };
+
+   panel-lvds0 {
+   compatible = "innolux,g121x1-l03";
+   backlight = <&backlight_lvds>;
+   power-supply = <®_lvds>;
+
+   port {
+   panel_in_lvds0: endpoint {
+   remote-endpoint = <&lvds0_out>;
+   };
+   };
+   };
+};
+
+&clks {
+   assigned-clocks = <&clks IMX6QDL_CLK_LDB_DI0_SEL>,
+ <&clks IMX6QDL_CLK_LDB_DI1_SEL>;
+   assigned-clock-parents = <&clks IMX6QDL_CLK_PLL3_USB_OTG>,
+<&clks IMX6QDL_CLK_PLL3_USB_OTG>;
+};
+
+&ldb {
+   status = "okay";
+
+   lvds0: lvds-channel@0 {
+   fsl,data-mapping = "spwg";
+   fsl,data-width = <24>;
+   status = "okay";
+
+   port@4 {
+   reg = <4>;
+
+   lvds0_out: endpoint {
+   remote-endpoi

[U-Boot] [PATCH 00/10] GE boards initial DM conversion

2019-10-28 Thread Robert Beckett

This searies syncs the device trees from Linux, fixes a couple of issues
and starts enabling DM features for GE boards.


Denis Zalevskiy (2):
  configs: ppd: DM for USB and regulators PPD
  board: ge: bx50v3: Enable DM for PCI and ethernet

Ian Ray (4):
  configs: bx50v3: Fix boot hang with video
  board: ge: bx50v3: Fix run-time warning
  board: ge: bx50v3: Fix message output to video console
  board: ge: pass rtc_status via device tree

Robert Beckett (4):
  board: ge: bx50v3: sync devicetrees from Linux
  board: ge: ppd: sync device tree from Linux
  board: ge: bx50v3: use imx wdt
  board: ge: mx53ppd: use imx wdt

 arch/arm/dts/Makefile|7 +-
 arch/arm/dts/imx53-ppd-uboot.dtsi|   12 +
 arch/arm/dts/imx53-ppd.dts   | 1081 +-
 arch/arm/dts/imx6q-b450v3.dts|  160 
 arch/arm/dts/imx6q-b650v3.dts|  159 
 arch/arm/dts/imx6q-b850v3.dts|  302 +++
 arch/arm/dts/imx6q-ba16.dtsi |  640 +++
 arch/arm/dts/imx6q-bx50v3-uboot.dtsi |   12 +
 arch/arm/dts/imx6q-bx50v3.dts|   78 +-
 arch/arm/dts/imx6q-bx50v3.dtsi   |  381 +
 board/ge/bx50v3/bx50v3.c |  160 ++--
 board/ge/common/ge_common.c  |   20 +-
 board/ge/mx53ppd/mx53ppd.c   |8 +-
 configs/ge_bx50v3_defconfig  |   18 +
 configs/mx53ppd_defconfig|5 +
 include/configs/ge_bx50v3.h  |   23 +-
 include/configs/mx53ppd.h|2 +-
 17 files changed, 2865 insertions(+), 203 deletions(-)
 create mode 100644 arch/arm/dts/imx53-ppd-uboot.dtsi
 create mode 100644 arch/arm/dts/imx6q-b450v3.dts
 create mode 100644 arch/arm/dts/imx6q-b650v3.dts
 create mode 100644 arch/arm/dts/imx6q-b850v3.dts
 create mode 100644 arch/arm/dts/imx6q-ba16.dtsi
 create mode 100644 arch/arm/dts/imx6q-bx50v3-uboot.dtsi
 create mode 100644 arch/arm/dts/imx6q-bx50v3.dtsi

-- 
2.20.1

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


Re: [U-Boot] [RESEND PATCHv1 0/5] support remote system update on Intel Stratix10 SoC

2019-10-28 Thread Richard Gong

Hi Simon,

On 10/28/19 9:05 AM, Simon Goldschmidt wrote:



Richard Gong > schrieb am Mo., 28. Okt. 2019, 14:58:


Hi Simon,

Thanks for your comment.

I will move files to driver/firmware.


Would moving to uclass mailbox fit for these kind of things?



Don't fit, since they are not mailbox like.

The Intel Remote System Update (RSU) provides a way for user to update 
the QSPI configuration bitsterams on Intel Stratix10/Agilex SoC device 
with significantly reduced risk of corrupting the bitstream storage and 
bricking the system.


RSU allows suer to perform a complete set of operations:
1. provides support for creating the initial flash images for a system 
to support RSU.
2. allows several production image to be tried in a specific order until 
one of them is successful.
3. loads a factory image if no production image is available, or all 
production image failed.

4. provides user with the ability to add or remove production images.
5. provides user with the ability to change the order in which 
production images are loaded.
6. provides user with the ability to load a specific image from flash, 
The image is a production or factory image.
7. provides user the information on which image is currently running, 
and what errors were encountered if have.


Regards,
Richard


Regards,
Simon


Regards,
Richard

On 10/24/19 10:00 AM, Simon Goldschmidt wrote:
 > On Thu, Oct 24, 2019 at 4:35 PM mailto:richard.g...@linux.intel.com>> wrote:
 >>
 >> From: Richard Gong mailto:richard.g...@intel.com>>
 >>
 >> The Intel Remote System Update (RSU) provides a way for users to
update
 >> the QSPI configuration bitstream of a Intel Stratix10 SoC device
with
 >> significantly reduced risk of corrupting the bitstream storage and
 >> bricking the system.
 >>
 >> The patchset adds RSU support which allows user to perform a
complete set
 >> of RSU operations via provided console commands.
 >>
 >> The patches have reviewed by other colleagues at Intel.
 >>
 >> Richard Gong (5):
 >>    arm: socfpga: stratix10: add RSU mailbox support
 >>    arm: socfpga: stratix10: add RSU support for Stratix10 SoC
 >>    arm: socfpga: stratix10: add environment variables for RSU
support
 >>    arm: socfpga: stratix10: add console commands for RSU support
 >>    arm: socfpga: enable RSU build
 >>
 >>   arch/arm/mach-socfpga/Makefile                   |    6 +
 >>   arch/arm/mach-socfpga/include/mach/mailbox_s10.h |   36 +-
 >>   arch/arm/mach-socfpga/include/mach/rsu.h         |  244 +
 >>   arch/arm/mach-socfpga/include/mach/rsu_ll.h      |   71 ++
 >>   arch/arm/mach-socfpga/include/mach/rsu_misc.h    |   46 +
 >>   arch/arm/mach-socfpga/include/mach/rsu_s10.h     |   46 +
 >>   arch/arm/mach-socfpga/mailbox_s10.c              |   45 +
 >>   arch/arm/mach-socfpga/misc_s10.c                 |    9 +
 >>   arch/arm/mach-socfpga/rsu.c                      |  569

 >>   arch/arm/mach-socfpga/rsu_ll_qspi.c              | 1033
++
 >>   arch/arm/mach-socfpga/rsu_misc.c                 |  527
+++
 >>   arch/arm/mach-socfpga/rsu_s10.c                  |  817
+
 >>   12 files changed, 3439 insertions(+), 10 deletions(-)
 >>   create mode 100644 arch/arm/mach-socfpga/include/mach/rsu.h
 >>   create mode 100644 arch/arm/mach-socfpga/include/mach/rsu_ll.h
 >>   create mode 100644 arch/arm/mach-socfpga/include/mach/rsu_misc.h
 >>   create mode 100644 arch/arm/mach-socfpga/include/mach/rsu_s10.h
 >>   create mode 100644 arch/arm/mach-socfpga/rsu.c
 >>   create mode 100644 arch/arm/mach-socfpga/rsu_ll_qspi.c
 >>   create mode 100644 arch/arm/mach-socfpga/rsu_misc.c
 >>   create mode 100644 arch/arm/mach-socfpga/rsu_s10.c
 >
 > We're trying to move files from arch/arm/mach-socfpga to drivers.
 > This goes in the opposite direction.
 >
 > Regards,
 > Simon
 >
 >>
 >> --
 >> 2.7.4
 >>


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


[U-Boot] [PATCH v2 4/5] .travis.yml: Remove the unneeded '&' for ls20xx buildman

2019-10-28 Thread Bin Meng
Signed-off-by: Bin Meng 
Reviewed-by: Tom Rini 
---

Changes in v2: None

 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index a3e7451..3aaed93 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -200,7 +200,7 @@ matrix:
 - BUILDMAN="freescale&aarch64&ls108"
 - name: "buildman NXP AArch64 LS20xx"
   env:
-- BUILDMAN="freescale&aarch64&&ls20"
+- BUILDMAN="freescale&aarch64&ls20"
 - name: "buildman NXP AArch64 LX216x"
   env:
 - BUILDMAN="freescale&aarch64&lx216"
-- 
2.7.4

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


[U-Boot] [PATCH v2 5/5] Bring all testings in gitlab and travis CI to Azure Pipelines

2019-10-28 Thread Bin Meng
This expands current Azure Pipelines Windows host tools build
testing to cover all the CI testing in gitlab and travis CI.

Note for some unknown reason, the 'container' cannot be used for
any jobs that have buildman, for buildman does not exit properly
and hangs the job forever. As a workaround, we manually call
docker to run the image to perform the CI tasks.

A complete run on Azure Pipelines takes about 2 hours and 10
minutes.

Signed-off-by: Bin Meng 

---
See the build result at:
https://dev.azure.com/bmeng/GitHub/_build/results?buildId=109

Changes in v2: None

 .azure-pipelines.yml | 382 +++
 1 file changed, 382 insertions(+)

diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 6c6b24e..d476d8d 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -1,5 +1,12 @@
 variables:
   windows_vm: vs2015-win2012r2
+  ubuntu_vm: ubuntu-18.04
+  ci_runner_image: trini/u-boot-gitlab-ci-runner:bionic-20190912.1-03Oct2019
+  # Add '-u 0' options for Azure pipelines, otherwise we get "permission
+  # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
+  # since our $(ci_runner_image) user is not root.
+  container_option: -u 0
+  work_dir: /u
 
 jobs:
   - job: tools_only_windows
@@ -36,3 +43,378 @@ jobs:
   MSYSTEM: MSYS
   # Tell MSYS2 not to ‘cd’ our startup directory to HOME
   CHERE_INVOKING: yes
+
+  - job: cppcheck
+displayName: 'Static code analysis with cppcheck'
+pool:
+  vmImage: $(ubuntu_vm)
+container:
+  image: $(ci_runner_image)
+  options: $(container_option)
+steps:
+  - script: cppcheck --force --quiet --inline-suppr .
+
+  - job: todo
+displayName: 'Search for TODO within source tree'
+pool:
+  vmImage: $(ubuntu_vm)
+container:
+  image: $(ci_runner_image)
+  options: $(container_option)
+steps:
+  - script: grep -r TODO .
+  - script: grep -r FIXME .
+  - script: grep -r HACK . | grep -v HACKKIT
+
+  - job: sloccount
+displayName: 'Some statistics about the code base'
+pool:
+  vmImage: $(ubuntu_vm)
+container:
+  image: $(ci_runner_image)
+  options: $(container_option)
+steps:
+  - script: sloccount .
+
+  - job: maintainers
+displayName: 'Ensure all configs have MAINTAINERS entries'
+pool:
+  vmImage: $(ubuntu_vm)
+container:
+  image: $(ci_runner_image)
+  options: $(container_option)
+steps:
+  - script: |
+  if [ `./tools/genboardscfg.py -f 2>&1 | wc -l` -ne 0 ]; then exit 1; 
fi
+
+  - job: tools_only
+displayName: 'Ensure host tools build'
+pool:
+  vmImage: $(ubuntu_vm)
+container:
+  image: $(ci_runner_image)
+  options: $(container_option)
+steps:
+  - script: |
+  make tools-only_config tools-only -j$(nproc)
+
+  - job: envtools
+displayName: 'Ensure env tools build'
+pool:
+  vmImage: $(ubuntu_vm)
+container:
+  image: $(ci_runner_image)
+  options: $(container_option)
+steps:
+  - script: |
+  make tools-only_config envtools -j$(nproc)
+
+  - job: utils
+displayName: 'Run binman, buildman, dtoc and patman testsuites'
+pool:
+  vmImage: $(ubuntu_vm)
+steps:
+  - script: |
+  cat << EOF > build.sh
+  set -ex
+  cd ${WORK_DIR}
+  EOF
+  cat << "EOF" >> build.sh
+  git config --global user.name "Azure Pipelines"
+  git config --global user.email bmeng...@gmail.com
+  export USER=azure
+  virtualenv /tmp/venv
+  . /tmp/venv/bin/activate
+  pip install pyelftools
+  export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl
+  export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
+  export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
+  ./tools/buildman/buildman -o /tmp -P sandbox_spl
+  ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
+  ./tools/buildman/buildman -t
+  ./tools/dtoc/dtoc -t
+  ./tools/patman/patman --test
+  EOF
+  cat build.sh
+  # We cannot use "container" like other jobs above, as buildman
+  # seems to hang forever with pre-configured "container" environment
+  docker run -v $PWD:$(work_dir) $(ci_runner_image) /bin/bash 
$(work_dir)/build.sh
+
+  - job: test_py
+displayName: 'test.py'
+pool:
+  vmImage: $(ubuntu_vm)
+strategy:
+  matrix:
+sandbox:
+  TEST_PY_BD: "sandbox"
+  BUILDMAN: "^sandbox$"
+sandbox_spl:
+  TEST_PY_BD: "sandbox_spl"
+  TEST_PY_TEST_SPEC: "test_ofplatdata"
+  BUILDMAN: "^sandbox_spl$"
+sandbox_flattree:
+  TEST_PY_BD: "sandbox_flattree"
+  BUILDMAN: "^sandbox_flattree$"
+evb_ast2500:
+  TEST_PY_BD: "evb-ast2500"
+  TEST_PY_ID: "--id qemu"
+  

[U-Boot] [PATCH v2 2/5] tools: buildman: Remove useless mkdir() in Make() in test.py

2019-10-28 Thread Bin Meng
In the 'Make' function, the codes tries to create a directory
if current stage is 'build'. But the directory isn't used at
all anywhere.

Signed-off-by: Bin Meng 

---

Changes in v2:
- remove the unneeded debug codes

 tools/buildman/test.py | 8 
 1 file changed, 8 deletions(-)

diff --git a/tools/buildman/test.py b/tools/buildman/test.py
index de02f61..ed99b93 100644
--- a/tools/buildman/test.py
+++ b/tools/buildman/test.py
@@ -156,14 +156,6 @@ class TestBuild(unittest.TestCase):
 result.return_code = commit.return_code
 result.stderr = (''.join(commit.error_list)
 % {'basedir' : base_dir + '/.bm-work/00/'})
-if stage == 'build':
-target_dir = None
-for arg in args:
-if arg.startswith('O='):
-target_dir = arg[2:]
-
-if not os.path.isdir(target_dir):
-os.mkdir(target_dir)
 
 result.combined = result.stdout + result.stderr
 return result
-- 
2.7.4

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


[U-Boot] [PATCH v2 3/5] arm: mvebu: Avoid generating kwbimage.cfg in the source tree

2019-10-28 Thread Bin Meng
At present some boards generate kwbimage.cfg in the source tree
during the build. This breaks buildman testing on some systems
where the source tree is read-only. Update makefile rules to
generate it in the build tree instead.

Note some other boards have the kwbimage.cfg file written in
advance, hence we need check if the file exists in the build
tree first, otherwise we fall back to one in the source tree.

Signed-off-by: Bin Meng 
Reviewed-by: Chris Packham 
Reviewed-by: Stefan Roese 
---

Changes in v2: None

 Makefile | 15 +--
 arch/arm/mach-mvebu/Makefile |  4 ++--
 board/Marvell/db-88f6281-bp/Makefile |  4 ++--
 board/Marvell/db-xc3-24g4xg/Makefile |  4 ++--
 board/mikrotik/crs305-1g-4s/Makefile |  4 ++--
 5 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index e78b317..61b94c5 100644
--- a/Makefile
+++ b/Makefile
@@ -1276,10 +1276,21 @@ endif
 
 MKIMAGEFLAGS_u-boot-dtb.img = $(MKIMAGEFLAGS_u-boot.img)
 
-MKIMAGEFLAGS_u-boot.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
+# Some boards have the kwbimage.cfg file written in advance, while some
+# other boards generate it on the fly during the build in the build tree.
+# Let's check if the file exists in the build tree first, otherwise we
+# fall back to use the one in the source tree.
+KWD_CONFIG_FILE = $(shell \
+   if [ -f $(objtree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) ]; then \
+   echo -n $(objtree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%); \
+   else \
+   echo -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%); \
+   fi)
+
+MKIMAGEFLAGS_u-boot.kwb = -n $(KWD_CONFIG_FILE) \
-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE)
 
-MKIMAGEFLAGS_u-boot-spl.kwb = -n $(srctree)/$(CONFIG_SYS_KWD_CONFIG:"%"=%) \
+MKIMAGEFLAGS_u-boot-spl.kwb = -n $(KWD_CONFIG_FILE) \
-T kwbimage -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
$(if $(KEYDIR),-k $(KEYDIR))
 
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 8228a17..b739520 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -58,10 +58,10 @@ KWB_REPLACE += SEC_FUSE_DUMP
 KWB_CFG_SEC_FUSE_DUMP = a38x
 endif
 
-$(src)/kwbimage.cfg: $(src)/kwbimage.cfg.in include/autoconf.mk \
+$(obj)/kwbimage.cfg: $(src)/kwbimage.cfg.in include/autoconf.mk \
include/config/auto.conf
$(Q)sed -ne '$(foreach V,$(KWB_REPLACE),s/^#@$(V)/$(V) 
$(KWB_CFG_$(V))/;)p' \
-   <$< >$(dir $<)$(@F)
+   <$< >$(dir $@)$(@F)
 
 endif # CONFIG_SPL_BUILD
 obj-y  += gpio.o
diff --git a/board/Marvell/db-88f6281-bp/Makefile 
b/board/Marvell/db-88f6281-bp/Makefile
index e6aa7e3..003e9f6 100644
--- a/board/Marvell/db-88f6281-bp/Makefile
+++ b/board/Marvell/db-88f6281-bp/Makefile
@@ -4,9 +4,9 @@ obj-y   := db-88f6281-bp.o
 extra-y := kwbimage.cfg
 
 quiet_cmd_sed = SED $@
-  cmd_sed = sed $(SEDFLAGS_$(@F)) $< >$(dir $<)$(@F)
+  cmd_sed = sed $(SEDFLAGS_$(@F)) $< >$(dir $@)$(@F)
 
 SEDFLAGS_kwbimage.cfg = -e "s/^\#@BOOT_FROM.*/BOOT_FROM$(if 
$(CONFIG_CMD_NAND),nand,spi)/"
-$(src)/kwbimage.cfg: $(src)/kwbimage.cfg.in include/autoconf.mk \
+$(obj)/kwbimage.cfg: $(src)/kwbimage.cfg.in include/autoconf.mk \
include/config/auto.conf
$(call if_changed,sed)
diff --git a/board/Marvell/db-xc3-24g4xg/Makefile 
b/board/Marvell/db-xc3-24g4xg/Makefile
index 4dd5790..24e8200 100644
--- a/board/Marvell/db-xc3-24g4xg/Makefile
+++ b/board/Marvell/db-xc3-24g4xg/Makefile
@@ -6,9 +6,9 @@ obj-y   := db-xc3-24g4xg.o
 extra-y:= kwbimage.cfg
 
 quiet_cmd_sed = SED $@
-  cmd_sed = sed $(SEDFLAGS_$(@F)) $< >$(dir $<)$(@F)
+  cmd_sed = sed $(SEDFLAGS_$(@F)) $< >$(dir $@)$(@F)
 
 SEDFLAGS_kwbimage.cfg =-e "s|^BINARY.*|BINARY $(srctree)/$(@D)/binary.0 
005b 0068|"
-$(src)/kwbimage.cfg: $(src)/kwbimage.cfg.in include/autoconf.mk \
+$(obj)/kwbimage.cfg: $(src)/kwbimage.cfg.in include/autoconf.mk \
include/config/auto.conf
  $(call if_changed,sed)
diff --git a/board/mikrotik/crs305-1g-4s/Makefile 
b/board/mikrotik/crs305-1g-4s/Makefile
index 895331b..c03f534 100644
--- a/board/mikrotik/crs305-1g-4s/Makefile
+++ b/board/mikrotik/crs305-1g-4s/Makefile
@@ -6,9 +6,9 @@ obj-y   := crs305-1g-4s.o
 extra-y:= kwbimage.cfg
 
 quiet_cmd_sed = SED $@
-  cmd_sed = sed $(SEDFLAGS_$(@F)) $< >$(dir $<)$(@F)
+  cmd_sed = sed $(SEDFLAGS_$(@F)) $< >$(dir $@)$(@F)
 
 SEDFLAGS_kwbimage.cfg =-e "s|^BINARY.*|BINARY $(srctree)/$(@D)/binary.0 
005b 0068|"
-$(src)/kwbimage.cfg: $(src)/kwbimage.cfg.in include/autoconf.mk \
+$(obj)/kwbimage.cfg: $(src)/kwbimage.cfg.in include/autoconf.mk \
include/config/auto.conf
  $(call if_changed,sed)
-- 
2.7.4

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


[U-Boot] [PATCH v2 1/5] tools: buildman: Honor output directory when generating boards.cfg

2019-10-28 Thread Bin Meng
buildman always generates boards.cfg in the U-Boot source tree.
When '-o' is given, we should generate boards.cfg to the given
output directory.

Signed-off-by: Bin Meng 
---

Changes in v2: None

 tools/buildman/control.py | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/buildman/control.py b/tools/buildman/control.py
index fcf531c..9787b86 100644
--- a/tools/buildman/control.py
+++ b/tools/buildman/control.py
@@ -201,14 +201,14 @@ def DoBuildman(options, args, toolchains=None, 
make_func=None, boards=None,
 
 # Work out what subset of the boards we are building
 if not boards:
-board_file = os.path.join(options.git, 'boards.cfg')
-status = subprocess.call([os.path.join(options.git,
-'tools/genboardscfg.py')])
+board_file = os.path.join(options.output_dir, 'boards.cfg')
+genboardscfg = os.path.join(options.git, 'tools/genboardscfg.py')
+status = subprocess.call([genboardscfg, '-o', board_file])
 if status != 0:
-sys.exit("Failed to generate boards.cfg")
+sys.exit("Failed to generate boards.cfg")
 
 boards = board.Boards()
-boards.ReadBoards(os.path.join(options.git, 'boards.cfg'))
+boards.ReadBoards(board_file)
 
 exclude = []
 if options.exclude:
-- 
2.7.4

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


[U-Boot] [PATCH v2 0/5] Bring all testings in gitlab and travis CI to Azure Pipelines

2019-10-28 Thread Bin Meng
At present we have set up a Microsoft Azure Pipelines to build
U-Boot host tools for Windows. We can expand it to cover all the
CI testing in gitlab and travis CI.

There are issues if we use the 'container' keyword in the pipeline,
that buildman seems to not able to exit correctly and hangs forever.
So we manually call docker to run the image to perform the CI tasks.
Unfortunately with above configuration, the uboot user inside the
container does not have the write permission to the U-Boot git repo,
and this exposes several issues in the U-Boot build process.

With all such issues fixed, a complete run on Azure Pipelines takes
about 2 hours and 10 minutes. It seems to be a good backup for the
free travis CI service.

This series depends on
http://patchwork.ozlabs.org/project/uboot/list/?series=138998

and is avaiable at u-boot-x86/azure for testing.

Changes in v2:
- remove the unneeded debug codes

Bin Meng (5):
  tools: buildman: Honor output directory when generating boards.cfg
  tools: buildman: Remove useless mkdir() in Make() in test.py
  arm: mvebu: Avoid generating kwbimage.cfg in the source tree
  .travis.yml: Remove the unneeded '&' for ls20xx buildman
  Bring all testings in gitlab and travis CI to Azure Pipelines

 .azure-pipelines.yml | 382 +++
 .travis.yml  |   2 +-
 Makefile |  15 +-
 arch/arm/mach-mvebu/Makefile |   4 +-
 board/Marvell/db-88f6281-bp/Makefile |   4 +-
 board/Marvell/db-xc3-24g4xg/Makefile |   4 +-
 board/mikrotik/crs305-1g-4s/Makefile |   4 +-
 tools/buildman/control.py|  10 +-
 tools/buildman/test.py   |   8 -
 9 files changed, 409 insertions(+), 24 deletions(-)

-- 
2.7.4

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


Re: [U-Boot] [PATCH 5/5] Bring all testings in gitlab and travis CI to Azure Pipelines

2019-10-28 Thread Tom Rini
On Mon, Oct 28, 2019 at 10:08:33PM +0800, Bin Meng wrote:
> Hi Tom,
> 
> On Mon, Oct 28, 2019 at 9:44 PM Tom Rini  wrote:
> >
> > On Sun, Oct 27, 2019 at 05:28:25AM -0700, Bin Meng wrote:
> >
> > > This expands current Azure Pipelines Windows host tools build
> > > testing to cover all the CI testing in gitlab and travis CI.
> > >
> > > Note for some unknown reason, the 'container' cannot be used for
> > > any jobs that have buildman, for buildman does not exit properly
> > > and hangs the job forever. As a workaround, we manually call
> > > docker to run the image to perform the CI tasks.
> > >
> > > A complete run on Azure Pipelines takes about 2 hours and 10
> > > minutes.
> > >
> > > Signed-off-by: Bin Meng 
> >
> > Thanks for doing the work.  I will kick things such that we can have
> > this run automatically, regularly.  My only concern is, are we unable to
> > have a world build split like on GitLab?  The matrix of "break jobs up
> > such that it stays under 50 minutes" is one of the pain points to Travis
> > and I'd like to avoid that with Azure if we can as well.
> 
> I think we can do the same world build split like on GitLab. However I
> suspect a complete run will take much more time compared to GitLab.
> Based on my testing I see each job is a 2-core VM with 8GiB memory,
> not as powerful as current GitLab CI runner machine. Although the free
> Azure account can support up to 360 minutes per job, having the same
> world build split loses the chance to do more parallelism utilizing
> the free 10 jobs.

Ah, OK.  In that case, yes, mirroring Travis is a reasonable starting
point and trying to further optimize from there can be done.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] ARM: dts: imx6qdl: Add U-Boot specific device tree files for Cubox-i

2019-10-28 Thread Fabio Estevam
Hi Walter,

On Mon, Oct 28, 2019 at 11:01 AM Walter Lozano
 wrote:
>
> To make it easier to sync dts files with Linux add specific tweaks
> for U-Boot in separate files, specifically allowing SPL to make use
> of MMC.
>
> Signed-off-by: Walter Lozano 

It seems you missed to add CONFIG_OF_CONTROL=y and CONFIG_DM_MMC=y in
the defconfig so that Cubox could be really converted to DM.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 5/5] Bring all testings in gitlab and travis CI to Azure Pipelines

2019-10-28 Thread Bin Meng
Hi Tom,

On Mon, Oct 28, 2019 at 9:44 PM Tom Rini  wrote:
>
> On Sun, Oct 27, 2019 at 05:28:25AM -0700, Bin Meng wrote:
>
> > This expands current Azure Pipelines Windows host tools build
> > testing to cover all the CI testing in gitlab and travis CI.
> >
> > Note for some unknown reason, the 'container' cannot be used for
> > any jobs that have buildman, for buildman does not exit properly
> > and hangs the job forever. As a workaround, we manually call
> > docker to run the image to perform the CI tasks.
> >
> > A complete run on Azure Pipelines takes about 2 hours and 10
> > minutes.
> >
> > Signed-off-by: Bin Meng 
>
> Thanks for doing the work.  I will kick things such that we can have
> this run automatically, regularly.  My only concern is, are we unable to
> have a world build split like on GitLab?  The matrix of "break jobs up
> such that it stays under 50 minutes" is one of the pain points to Travis
> and I'd like to avoid that with Azure if we can as well.
>

I think we can do the same world build split like on GitLab. However I
suspect a complete run will take much more time compared to GitLab.
Based on my testing I see each job is a 2-core VM with 8GiB memory,
not as powerful as current GitLab CI runner machine. Although the free
Azure account can support up to 360 minutes per job, having the same
world build split loses the chance to do more parallelism utilizing
the free 10 jobs.

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


Re: [U-Boot] [RESEND PATCHv1 0/5] support remote system update on Intel Stratix10 SoC

2019-10-28 Thread Simon Goldschmidt
Richard Gong  schrieb am Mo., 28. Okt. 2019,
14:58:

> Hi Simon,
>
> Thanks for your comment.
>
> I will move files to driver/firmware.
>

Would moving to uclass mailbox fit for these kind of things?

Regards,
Simon


>
> Regards,
> Richard
>
> On 10/24/19 10:00 AM, Simon Goldschmidt wrote:
> > On Thu, Oct 24, 2019 at 4:35 PM  wrote:
> >>
> >> From: Richard Gong 
> >>
> >> The Intel Remote System Update (RSU) provides a way for users to update
> >> the QSPI configuration bitstream of a Intel Stratix10 SoC device with
> >> significantly reduced risk of corrupting the bitstream storage and
> >> bricking the system.
> >>
> >> The patchset adds RSU support which allows user to perform a complete
> set
> >> of RSU operations via provided console commands.
> >>
> >> The patches have reviewed by other colleagues at Intel.
> >>
> >> Richard Gong (5):
> >>arm: socfpga: stratix10: add RSU mailbox support
> >>arm: socfpga: stratix10: add RSU support for Stratix10 SoC
> >>arm: socfpga: stratix10: add environment variables for RSU support
> >>arm: socfpga: stratix10: add console commands for RSU support
> >>arm: socfpga: enable RSU build
> >>
> >>   arch/arm/mach-socfpga/Makefile   |6 +
> >>   arch/arm/mach-socfpga/include/mach/mailbox_s10.h |   36 +-
> >>   arch/arm/mach-socfpga/include/mach/rsu.h |  244 +
> >>   arch/arm/mach-socfpga/include/mach/rsu_ll.h  |   71 ++
> >>   arch/arm/mach-socfpga/include/mach/rsu_misc.h|   46 +
> >>   arch/arm/mach-socfpga/include/mach/rsu_s10.h |   46 +
> >>   arch/arm/mach-socfpga/mailbox_s10.c  |   45 +
> >>   arch/arm/mach-socfpga/misc_s10.c |9 +
> >>   arch/arm/mach-socfpga/rsu.c  |  569 
> >>   arch/arm/mach-socfpga/rsu_ll_qspi.c  | 1033
> ++
> >>   arch/arm/mach-socfpga/rsu_misc.c |  527 +++
> >>   arch/arm/mach-socfpga/rsu_s10.c  |  817
> +
> >>   12 files changed, 3439 insertions(+), 10 deletions(-)
> >>   create mode 100644 arch/arm/mach-socfpga/include/mach/rsu.h
> >>   create mode 100644 arch/arm/mach-socfpga/include/mach/rsu_ll.h
> >>   create mode 100644 arch/arm/mach-socfpga/include/mach/rsu_misc.h
> >>   create mode 100644 arch/arm/mach-socfpga/include/mach/rsu_s10.h
> >>   create mode 100644 arch/arm/mach-socfpga/rsu.c
> >>   create mode 100644 arch/arm/mach-socfpga/rsu_ll_qspi.c
> >>   create mode 100644 arch/arm/mach-socfpga/rsu_misc.c
> >>   create mode 100644 arch/arm/mach-socfpga/rsu_s10.c
> >
> > We're trying to move files from arch/arm/mach-socfpga to drivers.
> > This goes in the opposite direction.
> >
> > Regards,
> > Simon
> >
> >>
> >> --
> >> 2.7.4
> >>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/4] fdt: Switch to the latest libfdt, sort-of

2019-10-28 Thread Tom Rini
On Sun, Oct 27, 2019 at 09:47:38AM -0600, Simon Glass wrote:

> This series brings over the latest libfdt with some changes to deal with
> the recent code-size bloat.
> 
> With this change U-Boot size increases about 2.5KB on 'rock' and SPL
> reduces by about 128 bytes. This should be acceptable.
> 
> The 'assumptions' series is still under review, so we can sync that up
> later when complete.

Does this address the problem you have when moving binman to python3 as
well?  Thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/4] fdt: Add Kconfig options to control code size

2019-10-28 Thread Tom Rini
On Sun, Oct 27, 2019 at 12:49:28PM -0600, Simon Glass wrote:
> Hi Heinrich,
> 
> On Sun, 27 Oct 2019 at 12:06, Heinrich Schuchardt  wrote:
> >
> > On 10/27/19 4:47 PM, Simon Glass wrote:
> > > For better or worse libfdt recent grew a lot of code that checks the
> > > validity of the device tree in great detail. When using unsigned or
> > > unverified data this makes things safer, but it does add to code size.
> > >
> > > Add some controls to select the trade-off between safety and code size.
> > >
> > > Signed-off-by: Simon Glass 
> > > ---
> > >
> > >   lib/Kconfig | 33 +
> > >   lib/libfdt/Makefile |  3 ++-
> > >   2 files changed, 35 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/lib/Kconfig b/lib/Kconfig
> > > index 135f0b372b..b8a8509d72 100644
> > > --- a/lib/Kconfig
> > > +++ b/lib/Kconfig
> > > @@ -464,6 +464,17 @@ config OF_LIBFDT
> > > particular compatible nodes. The library operates on a flattened
> > > version of the device tree.
> > >
> > > +config OF_LIBFDT_ASSUME_MASK
> > > + hex "Mask of conditions to assume for libfdt"
> > > + depends on OF_LIBFDT || FIT
> > > + default 0
> > > + help
> > > +   Use this to change the assumptions made by libfdt about the
> > > +   device tree it is working with. A value of 0 means that no 
> > > assumptions
> > > +   are made, and libfdt is able to deal with malicious data. A value 
> > > of
> >
> > What do you mean by malicious here?
> 
> Someone trying to compromise the system with a carefully crafted DT.
> 
> >
> > The checks in libfdt are about inconsistent FDT files. But they would
> > not discover malicious settings like a destructive voltage or frequency.
> 
> That's right. To cover that people should probably use verified boot.

Right, so the help text can be clarified a little bit more to be clear
that it's checking for various types of formatting and construction
problems with that data only.

> > Would FDT_ASSUME_SANE match what we have been checking up to now? Why
> > not use 1 as the default here to reduce the code size of U-Boot?
> 
> Possibly. I'm open to changing this as the code size increase is a paind.
> 
> But most of the new checking code could be dropped by enabling
> FDT_ASSUME_FRIENDLY. Take a look at that and see what you think.

We also need to be careful as the defaults we push here are the defaults
that will be used when companies build their product on top.  I'm in
favor of the default being as much sanity checking as we an afford and
to note and allow for instances where other safeguards exist, or more
risk is tolerated to save some size.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/2] ARM: dts: imx6qdl: Add U-Boot specific device tree files for Cubox-i

2019-10-28 Thread Walter Lozano
To make it easier to sync dts files with Linux add specific tweaks
for U-Boot in separate files, specifically allowing SPL to make use
of MMC.

Signed-off-by: Walter Lozano 
---
 arch/arm/dts/Makefile  |  2 ++
 arch/arm/dts/imx6dl-cubox-i-u-boot.dts | 20 
 arch/arm/dts/imx6q-cubox-i-u-boot.dts  | 20 
 3 files changed, 42 insertions(+)
 create mode 100644 arch/arm/dts/imx6dl-cubox-i-u-boot.dts
 create mode 100644 arch/arm/dts/imx6q-cubox-i-u-boot.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index b37673d6aa..dd2ddf6687 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -561,6 +561,7 @@ dtb-$(CONFIG_MX6Q) += \
 
 dtb-$(CONFIG_MX6QDL) += \
imx6dl-cubox-i.dtb \
+   imx6dl-cubox-i-u-boot.dtb \
imx6dl-dhcom-pdk2.dtb \
imx6dl-icore.dtb \
imx6dl-icore-mipi.dtb \
@@ -571,6 +572,7 @@ dtb-$(CONFIG_MX6QDL) += \
imx6dl-wandboard-revb1.dtb \
imx6q-cm-fx6.dtb \
imx6q-cubox-i.dtb \
+   imx6q-cubox-i-u-boot.dtb \
imx6q-dhcom-pdk2.dtb \
imx6q-icore.dtb \
imx6q-icore-mipi.dtb \
diff --git a/arch/arm/dts/imx6dl-cubox-i-u-boot.dts 
b/arch/arm/dts/imx6dl-cubox-i-u-boot.dts
new file mode 100644
index 00..070ac82bc3
--- /dev/null
+++ b/arch/arm/dts/imx6dl-cubox-i-u-boot.dts
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2019 Collabora Ltd.
+
+/dts-v1/;
+
+#include "imx6dl-cubox-i.dts"
+#include "imx6qdl-u-boot.dtsi"
+
+&usdhc1 {
+   u-boot,dm-spl;
+};
+
+&usdhc2 {
+   u-boot,dm-spl;
+};
+
+&usdhc3 {
+   u-boot,dm-spl;
+};
diff --git a/arch/arm/dts/imx6q-cubox-i-u-boot.dts 
b/arch/arm/dts/imx6q-cubox-i-u-boot.dts
new file mode 100644
index 00..45412c6d48
--- /dev/null
+++ b/arch/arm/dts/imx6q-cubox-i-u-boot.dts
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright (C) 2019 Collabora Ltd.
+
+/dts-v1/;
+
+#include "imx6q-cubox-i.dts"
+#include "imx6qdl-u-boot.dtsi"
+
+&usdhc1 {
+   u-boot,dm-spl;
+};
+
+&usdhc2 {
+   u-boot,dm-spl;
+};
+
+&usdhc3 {
+   u-boot,dm-spl;
+};
-- 
2.20.1

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


[U-Boot] [PATCH 1/2] ARM: dts: imx6qdl: Add device tree support for SolidRun Cubox-i

2019-10-28 Thread Walter Lozano
Import SolidRun Cubox-i device tree files from Linux 5.4 to allow the
use of Driver Model and Device Tree.

Signed-off-by: Walter Lozano 
---
 arch/arm/dts/Makefile |   2 +
 arch/arm/dts/imx6dl-cubox-i.dts   |  51 +
 arch/arm/dts/imx6q-cubox-i.dts|  59 ++
 arch/arm/dts/imx6qdl-cubox-i.dtsi | 269 ++
 arch/arm/dts/imx6qdl-sr-som-brcm.dtsi | 144 ++
 arch/arm/dts/imx6qdl-sr-som-emmc.dtsi |  70 +++
 arch/arm/dts/imx6qdl-sr-som-ti.dtsi   | 170 
 arch/arm/dts/imx6qdl-sr-som.dtsi  | 121 
 8 files changed, 886 insertions(+)
 create mode 100644 arch/arm/dts/imx6dl-cubox-i.dts
 create mode 100644 arch/arm/dts/imx6q-cubox-i.dts
 create mode 100644 arch/arm/dts/imx6qdl-cubox-i.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-sr-som-brcm.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-sr-som-emmc.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-sr-som-ti.dtsi
 create mode 100644 arch/arm/dts/imx6qdl-sr-som.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 62da168ef8..b37673d6aa 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -560,6 +560,7 @@ dtb-$(CONFIG_MX6Q) += \
imx6q-tbs2910.dtb
 
 dtb-$(CONFIG_MX6QDL) += \
+   imx6dl-cubox-i.dtb \
imx6dl-dhcom-pdk2.dtb \
imx6dl-icore.dtb \
imx6dl-icore-mipi.dtb \
@@ -569,6 +570,7 @@ dtb-$(CONFIG_MX6QDL) += \
imx6dl-sabresd.dtb \
imx6dl-wandboard-revb1.dtb \
imx6q-cm-fx6.dtb \
+   imx6q-cubox-i.dtb \
imx6q-dhcom-pdk2.dtb \
imx6q-icore.dtb \
imx6q-icore-mipi.dtb \
diff --git a/arch/arm/dts/imx6dl-cubox-i.dts b/arch/arm/dts/imx6dl-cubox-i.dts
new file mode 100644
index 00..2b1b3e193f
--- /dev/null
+++ b/arch/arm/dts/imx6dl-cubox-i.dts
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2014 Russell King
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+/dts-v1/;
+
+#include "imx6dl.dtsi"
+#include "imx6qdl-sr-som.dtsi"
+#include "imx6qdl-sr-som-brcm.dtsi"
+#include "imx6qdl-cubox-i.dtsi"
+
+/ {
+   model = "SolidRun Cubox-i Solo/DualLite";
+   compatible = "solidrun,cubox-i/dl", "fsl,imx6dl";
+};
diff --git a/arch/arm/dts/imx6q-cubox-i.dts b/arch/arm/dts/imx6q-cubox-i.dts
new file mode 100644
index 00..1c7b262e37
--- /dev/null
+++ b/arch/arm/dts/imx6q-cubox-i.dts
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2014 Russell King
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+

Re: [U-Boot] [RESEND PATCHv1 0/5] support remote system update on Intel Stratix10 SoC

2019-10-28 Thread Richard Gong

Hi Simon,

Thanks for your comment.

I will move files to driver/firmware.

Regards,
Richard

On 10/24/19 10:00 AM, Simon Goldschmidt wrote:

On Thu, Oct 24, 2019 at 4:35 PM  wrote:


From: Richard Gong 

The Intel Remote System Update (RSU) provides a way for users to update
the QSPI configuration bitstream of a Intel Stratix10 SoC device with
significantly reduced risk of corrupting the bitstream storage and
bricking the system.

The patchset adds RSU support which allows user to perform a complete set
of RSU operations via provided console commands.

The patches have reviewed by other colleagues at Intel.

Richard Gong (5):
   arm: socfpga: stratix10: add RSU mailbox support
   arm: socfpga: stratix10: add RSU support for Stratix10 SoC
   arm: socfpga: stratix10: add environment variables for RSU support
   arm: socfpga: stratix10: add console commands for RSU support
   arm: socfpga: enable RSU build

  arch/arm/mach-socfpga/Makefile   |6 +
  arch/arm/mach-socfpga/include/mach/mailbox_s10.h |   36 +-
  arch/arm/mach-socfpga/include/mach/rsu.h |  244 +
  arch/arm/mach-socfpga/include/mach/rsu_ll.h  |   71 ++
  arch/arm/mach-socfpga/include/mach/rsu_misc.h|   46 +
  arch/arm/mach-socfpga/include/mach/rsu_s10.h |   46 +
  arch/arm/mach-socfpga/mailbox_s10.c  |   45 +
  arch/arm/mach-socfpga/misc_s10.c |9 +
  arch/arm/mach-socfpga/rsu.c  |  569 
  arch/arm/mach-socfpga/rsu_ll_qspi.c  | 1033 ++
  arch/arm/mach-socfpga/rsu_misc.c |  527 +++
  arch/arm/mach-socfpga/rsu_s10.c  |  817 +
  12 files changed, 3439 insertions(+), 10 deletions(-)
  create mode 100644 arch/arm/mach-socfpga/include/mach/rsu.h
  create mode 100644 arch/arm/mach-socfpga/include/mach/rsu_ll.h
  create mode 100644 arch/arm/mach-socfpga/include/mach/rsu_misc.h
  create mode 100644 arch/arm/mach-socfpga/include/mach/rsu_s10.h
  create mode 100644 arch/arm/mach-socfpga/rsu.c
  create mode 100644 arch/arm/mach-socfpga/rsu_ll_qspi.c
  create mode 100644 arch/arm/mach-socfpga/rsu_misc.c
  create mode 100644 arch/arm/mach-socfpga/rsu_s10.c


We're trying to move files from arch/arm/mach-socfpga to drivers.
This goes in the opposite direction.

Regards,
Simon



--
2.7.4


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


Re: [U-Boot] [PATCH v3 0/9] tools: Support building U-Boot host tools for Windows via MSYS2

2019-10-28 Thread Tom Rini
On Mon, Oct 28, 2019 at 08:34:58PM +0800, Bin Meng wrote:

> Hi Tom,
> 
> On Sun, Oct 27, 2019 at 8:20 PM Bin Meng  wrote:
> >
> > Per current U-Boot README, building Windows versions of the utilities
> > in the tools directory is done via the MinGW toolchain. But testing
> > shows that it is broken and actually it must have been broken for
> > quite a long time.
> >
> > Fixing MinGW build seems quite amount of work as developers of
> > U-Boot normally work on Linux boxes hence codes written are mainly
> > for Linux or POSIX OSes. We must investigate another way of building
> > host tools for Windows, and now we have MSYS2, a software distro and
> > building platform for Windows, to build POSIX compliant software on
> > Windows using an emulation layer.
> >
> > This small series fixes several issues in current U-Boot tools codes,
> > that only assume a Linux host is used. Cases are using standard C
> > typedefs whenever possbile, or using compiler builtin functions to
> > improve portability, etc.
> >
> > A reST document for how to build U-Boot host tools for both platforms
> > is added.
> >
> > A new CI pipeline configuration for Microsoft Azure Pipelines is added
> > for U-Boot. We rely on it to ensure future host tools for Windows build
> > does not break.
> >
> > I've also investigated putting what we have for now on GitLab-CI and
> > Travis-CI to Azure Pipelines, and it turns out there are several issues
> > that should be fixed. I will post a follow-up patch series for enabling
> > full CI testing on Azure Pipelines.
> >
> > Changes in v3:
> > - new patch: tools: ifwitool: Define __packed when it is not defined
> > - rename to .azure-pipelines.yml
> > - correct typo in the commit summary
> 
> If there is no issue, could we get this series applied in v2020.01-rc1?

Yes, I would like to, and I think I've gotten far enough along with my
account setup that I should be able to test this as well.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] cmd: remove NET and CMD_NET dependency for CMD_PXE

2019-10-28 Thread Tom Rini
On Mon, Oct 28, 2019 at 02:23:19PM +0100, Patrice Chotard wrote:

> It allows to use sysboot command on board which have no NET support.
> 
> Currently, sysboot command can't be used if CMD_NET and NET flags are
> not set, while sysboot allows to load extlinux.conf file from local
> filesystem, so it doesn't need to depend of CMD_NET and NET flags.
> 
> One solution would be to put sysboot command's code outside pxe.c and
> create a new sysboot.c file. But sysboot command code is imbricated
> with pxe command code and as all CMD_NET relative code is already under
> CMD_NET flag, the easiest way to break sysboot dependency with CMD_NET
> and NET flags is to move CMD_PXE outside CMD_NET and NET section in
> Kconfig.
> 
> Signed-off-by: Patrice Chotard 

How far did you go down the path of making cmd/sysboot.c or similar?
Since it's not obvious unless you're already in here that the
extlinux.conf stuff is inside pxe, it really would be good to split
things out.  If you even have a rough draft patch to look at that would
be great.  Also:

> ---
> 
>  Kconfig |  2 +-
>  cmd/Kconfig | 12 ++--
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/Kconfig b/Kconfig
> index 66b059f749..ce2ad16ea5 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -87,7 +87,7 @@ config DISTRO_DEFAULTS
>   select CMD_FS_GENERIC
>   select CMD_PART if PARTITIONS
>   select CMD_PING if CMD_NET
> - select CMD_PXE if NET
> + select CMD_PXE
>   select ENV_VARS_UBOOT_CONFIG
>   select HUSH_PARSER
>   select SUPPORT_RAW_INITRD
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 07060c63a7..2cb0935632 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1499,12 +1499,6 @@ config CMD_ETHSW
> operations such as enabling / disabling a port and
> viewing/maintaining the filtering database (FDB)
>  
> -config CMD_PXE
> - bool "pxe"
> - select MENU
> - help
> -   Boot image via network using PXE protocol
> -
>  config CMD_WOL
>   bool "wol"
>   help
> @@ -1636,6 +1630,12 @@ config CMD_MISC
>   help
> Delay execution for some time
>  
> +config CMD_PXE
> + bool "pxe"
> + select MENU
> + help
> +   Boot image via network using PXE protocol or via local extlinux.conf 
> file
> +

We should expand the prompt as well to note that sysboot is in here as
well, if we cannot split.  Thanks!

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/5] .travis.yml: Remove the unneeded '&' for ls20xx buildman

2019-10-28 Thread Tom Rini
On Sun, Oct 27, 2019 at 05:28:24AM -0700, Bin Meng wrote:

> Signed-off-by: Bin Meng 

Reviewed-by: Tom Rini 

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 5/5] Bring all testings in gitlab and travis CI to Azure Pipelines

2019-10-28 Thread Tom Rini
On Sun, Oct 27, 2019 at 05:28:25AM -0700, Bin Meng wrote:

> This expands current Azure Pipelines Windows host tools build
> testing to cover all the CI testing in gitlab and travis CI.
> 
> Note for some unknown reason, the 'container' cannot be used for
> any jobs that have buildman, for buildman does not exit properly
> and hangs the job forever. As a workaround, we manually call
> docker to run the image to perform the CI tasks.
> 
> A complete run on Azure Pipelines takes about 2 hours and 10
> minutes.
> 
> Signed-off-by: Bin Meng 

Thanks for doing the work.  I will kick things such that we can have
this run automatically, regularly.  My only concern is, are we unable to
have a world build split like on GitLab?  The matrix of "break jobs up
such that it stays under 50 minutes" is one of the pain points to Travis
and I'd like to avoid that with Azure if we can as well.

-- 
Tom


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] cmd: remove NET and CMD_NET dependency for CMD_PXE

2019-10-28 Thread Patrice Chotard
It allows to use sysboot command on board which have no NET support.

Currently, sysboot command can't be used if CMD_NET and NET flags are
not set, while sysboot allows to load extlinux.conf file from local
filesystem, so it doesn't need to depend of CMD_NET and NET flags.

One solution would be to put sysboot command's code outside pxe.c and
create a new sysboot.c file. But sysboot command code is imbricated
with pxe command code and as all CMD_NET relative code is already under
CMD_NET flag, the easiest way to break sysboot dependency with CMD_NET
and NET flags is to move CMD_PXE outside CMD_NET and NET section in
Kconfig.

Signed-off-by: Patrice Chotard 
---

 Kconfig |  2 +-
 cmd/Kconfig | 12 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Kconfig b/Kconfig
index 66b059f749..ce2ad16ea5 100644
--- a/Kconfig
+++ b/Kconfig
@@ -87,7 +87,7 @@ config DISTRO_DEFAULTS
select CMD_FS_GENERIC
select CMD_PART if PARTITIONS
select CMD_PING if CMD_NET
-   select CMD_PXE if NET
+   select CMD_PXE
select ENV_VARS_UBOOT_CONFIG
select HUSH_PARSER
select SUPPORT_RAW_INITRD
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 07060c63a7..2cb0935632 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1499,12 +1499,6 @@ config CMD_ETHSW
  operations such as enabling / disabling a port and
  viewing/maintaining the filtering database (FDB)
 
-config CMD_PXE
-   bool "pxe"
-   select MENU
-   help
- Boot image via network using PXE protocol
-
 config CMD_WOL
bool "wol"
help
@@ -1636,6 +1630,12 @@ config CMD_MISC
help
  Delay execution for some time
 
+config CMD_PXE
+   bool "pxe"
+   select MENU
+   help
+ Boot image via network using PXE protocol or via local extlinux.conf 
file
+
 config MP
bool "support for multiprocessor"
help
-- 
2.17.1

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


Re: [U-Boot] [PATCH v3 023/108] x86: timer: Allow a timer base of 0

2019-10-28 Thread Bin Meng
Hi Simon,

On Mon, Oct 21, 2019 at 11:40 AM Simon Glass  wrote:
>
> On some platforms the timer is reset to 0 when the SoC is reset. Having
> this as the timer base is useful since it provides an indication of how
> long it takes before U-Boot is running.
>
> When U-Boot sets the timer base to something else, time is lost and we
> no-longer have an accurate account of the time since reset. This
> particularly affects bootstage.
>
> Add an option to leave the timer base as 0 on boot.

I think we can change the timer base as 0 for all x86 native port. And
use rdtsc() for configuration when U-Boot is used as payloads, eg:
efi, coreboot, slimbootloader, etc.

>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  drivers/timer/Kconfig | 13 +
>  drivers/timer/tsc_timer.c |  3 ++-
>  2 files changed, 15 insertions(+), 1 deletion(-)
>

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


Re: [U-Boot] [PATCH v3 027/108] x86: Drop unnecessary cpu code for TPL

2019-10-28 Thread Bin Meng
Hi Simon,

On Mon, Oct 21, 2019 at 11:40 AM Simon Glass  wrote:
>
> We don't need to know every detail about the CPU in TPL. Drop some
> superfluous functions to reduce code size. Add a simple CPU detection
> algorithm which just supports Intel and AMD, since we only support TPL
> on Intel, so far.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  arch/x86/cpu/cpu.c  |  4 
>  arch/x86/cpu/i386/cpu.c | 41 +
>  2 files changed, 41 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
> index 9ee4b0294ae..4795863b33c 100644
> --- a/arch/x86/cpu/cpu.c
> +++ b/arch/x86/cpu/cpu.c
> @@ -45,6 +45,7 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> +#ifndef CONFIG_TPL_BUILD
>  static const char *const x86_vendor_name[] = {
> [X86_VENDOR_INTEL] = "Intel",
> [X86_VENDOR_CYRIX] = "Cyrix",
> @@ -57,6 +58,7 @@ static const char *const x86_vendor_name[] = {
> [X86_VENDOR_NSC]   = "NSC",
> [X86_VENDOR_SIS]   = "SiS",
>  };
> +#endif
>
>  int __weak x86_cleanup_before_linux(void)
>  {
> @@ -113,6 +115,7 @@ int icache_status(void)
> return 1;
>  }
>
> +#ifndef CONFIG_TPL_BUILD
>  const char *cpu_vendor_name(int vendor)
>  {
> const char *name;
> @@ -123,6 +126,7 @@ const char *cpu_vendor_name(int vendor)
>
> return name;
>  }
> +#endif
>
>  char *cpu_get_name(char *name)
>  {
> diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
> index 90b546e7410..5a14d42cb26 100644
> --- a/arch/x86/cpu/i386/cpu.c
> +++ b/arch/x86/cpu/i386/cpu.c
> @@ -20,6 +20,7 @@
>
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -57,6 +58,8 @@ struct cpuinfo_x86 {
> uint8_t x86_mask;
>  };
>
> +/* gcc 7.3 does not what to drop x86_vendors, so use #ifdef */

what => want ?

> +#ifndef CONFIG_TPL_BUILD
>  /*
>   * List of cpu vendor strings along with their normalized
>   * id values.
> @@ -77,6 +80,7 @@ static const struct {
> { X86_VENDOR_NSC,   "Geode by NSC", },
> { X86_VENDOR_SIS,   "SiS SiS SiS ", },
>  };
> +#endif
>
>  static void load_ds(u32 segment)
>  {
> @@ -229,6 +233,7 @@ static bool has_mtrr(void)
> return cpuid_edx(0x0001) & (1 << 12) ? true : false;
>  }
>
> +#ifndef CONFIG_TPL_BUILD
>  static int build_vendor_name(char *vendor_name)
>  {
> struct cpuid_result result;
> @@ -241,14 +246,42 @@ static int build_vendor_name(char *vendor_name)
>
> return result.eax;
>  }
> +#endif
>
>  static void identify_cpu(struct cpu_device_id *cpu)
>  {
> +   cpu->device = 0; /* fix gcc 4.4.4 warning */
> +
> +   /*
> +* Do a quick and dirty check to save space - Intel and AMD only and
> +* just the vendor. This is enough for most TPL code.
> +*/
> +   if (spl_phase() == PHASE_TPL) {
> +   struct cpuid_result result;
> +
> +   result = cpuid(0x);
> +   switch (result.ecx >> 24) {
> +   case 'l': /* GenuineIntel */
> +   cpu->vendor = X86_VENDOR_INTEL;
> +   break;
> +   case 'D': /* AuthenticAMD */
> +   cpu->vendor = X86_VENDOR_AMD;
> +   break;
> +   default:
> +   cpu->vendor = X86_VENDOR_ANY;
> +   break;
> +   }
> +   if (0) /* Fix compiler warning */

Can we remove this completely?

> +   deep_magic_nexgen_probe();
> +   return;
> +   }
> +
> +/* gcc 7.3 does not what to drop x86_vendors, so use #ifdef */

what?

> +#ifndef CONFIG_TPL_BUILD
> char vendor_name[16];
> int i;
>
> vendor_name[0] = '\0'; /* Unset */
> -   cpu->device = 0; /* fix gcc 4.4.4 warning */
>
> /* Find the id and vendor_name */
> if (!has_cpuid()) {
> @@ -264,9 +297,8 @@ static void identify_cpu(struct cpu_device_id *cpu)
> /* Detect NexGen with old hypercode */
> else if (deep_magic_nexgen_probe())
> memcpy(vendor_name, "NexGenDriven", 13);
> -   }
> -   if (has_cpuid()) {
> -   int  cpuid_level;
> +   } else {
> +   int cpuid_level;
>
> cpuid_level = build_vendor_name(vendor_name);
> vendor_name[12] = '\0';
> @@ -286,6 +318,7 @@ static void identify_cpu(struct cpu_device_id *cpu)
> break;
> }
> }
> +#endif
>  }
>
>  static inline void get_fms(struct cpuinfo_x86 *c, uint32_t tfms)
> --

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


Re: [U-Boot] [PATCH v3 0/9] tools: Support building U-Boot host tools for Windows via MSYS2

2019-10-28 Thread Bin Meng
Hi Tom,

On Sun, Oct 27, 2019 at 8:20 PM Bin Meng  wrote:
>
> Per current U-Boot README, building Windows versions of the utilities
> in the tools directory is done via the MinGW toolchain. But testing
> shows that it is broken and actually it must have been broken for
> quite a long time.
>
> Fixing MinGW build seems quite amount of work as developers of
> U-Boot normally work on Linux boxes hence codes written are mainly
> for Linux or POSIX OSes. We must investigate another way of building
> host tools for Windows, and now we have MSYS2, a software distro and
> building platform for Windows, to build POSIX compliant software on
> Windows using an emulation layer.
>
> This small series fixes several issues in current U-Boot tools codes,
> that only assume a Linux host is used. Cases are using standard C
> typedefs whenever possbile, or using compiler builtin functions to
> improve portability, etc.
>
> A reST document for how to build U-Boot host tools for both platforms
> is added.
>
> A new CI pipeline configuration for Microsoft Azure Pipelines is added
> for U-Boot. We rely on it to ensure future host tools for Windows build
> does not break.
>
> I've also investigated putting what we have for now on GitLab-CI and
> Travis-CI to Azure Pipelines, and it turns out there are several issues
> that should be fixed. I will post a follow-up patch series for enabling
> full CI testing on Azure Pipelines.
>
> Changes in v3:
> - new patch: tools: ifwitool: Define __packed when it is not defined
> - rename to .azure-pipelines.yml
> - correct typo in the commit summary
>

If there is no issue, could we get this series applied in v2020.01-rc1?

> Changes in v2:
> - new patch: Add .gitattributes for line endings
> - new patch: tools: Avoid creating symbolic links for tools/version.h
> - new patch: Add Microsoft Azure pipelines configuration
>
> Bin Meng (9):
>   tools: image.h: Use portable uint32_t instead of linux-specific __be32
>   tools: mtk_image.h: Use portable uintXX_t instead of linux-specific
> __leXX
>   tools: zynqmpbif: Use compiler builtin instead of linux-specific
> __swab32
>   linux/types.h: Surround 'struct ustat' with __linux__
>   tools: ifwitool: Define __packed when it is not defined
>   doc: Add documentation for how to build U-Boot host tools
>   Add .gitattributes for line endings
>   tools: Avoid creating symbolic links for tools/version.h
>   Add Microsoft Azure Pipelines configuration
>
>  .azure-pipelines.yml  | 38 +++
>  .gitattributes|  2 ++
>  Makefile  |  9 --
>  doc/build/index.rst   |  9 ++
>  doc/build/tools.rst   | 47 
>  doc/index.rst | 11 +++
>  include/image.h   | 14 -
>  include/linux/types.h |  2 ++
>  tools/.gitignore  |  1 +
>  tools/ifwitool.c  |  2 ++
>  tools/mtk_image.h | 86 
> +--
>  tools/version.h   |  1 -
>  tools/zynqmpbif.c |  2 +-
>  13 files changed, 169 insertions(+), 55 deletions(-)
>  create mode 100644 .azure-pipelines.yml
>  create mode 100644 .gitattributes
>  create mode 100644 doc/build/index.rst
>  create mode 100644 doc/build/tools.rst
>  delete mode 12 tools/version.h

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


Re: [U-Boot] [PATCH v3 011/108] i2c: Tidy up designware PCI support

2019-10-28 Thread Stefan Roese

On 21.10.19 05:31, Simon Glass wrote:

This is hacked into the driver at present. It seems better to have it as
a separate driver that uses the base driver. Create a new file and put
the X86 code into it.

Actually the Baytrail settings should really come from the device tree.

Signed-off-by: Simon Glass 


Apart from the comments from Bin, I only have one nitpicking comments
below...


---

Changes in v3: None
Changes in v2: None

  drivers/i2c/Makefile |   3 +
  drivers/i2c/designware_i2c.c | 104 ++-
  drivers/i2c/designware_i2c.h |  35 
  drivers/i2c/dw_i2c_pci.c |  78 ++
  4 files changed, 132 insertions(+), 88 deletions(-)
  create mode 100644 drivers/i2c/dw_i2c_pci.c

diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index c2f75d87559..a7fa38b8dcf 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -14,6 +14,9 @@ obj-$(CONFIG_SYS_I2C_AT91) += at91_i2c.o
  obj-$(CONFIG_SYS_I2C_CADENCE) += i2c-cdns.o
  obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o
  obj-$(CONFIG_SYS_I2C_DW) += designware_i2c.o
+ifdef CONFIG_DM_PCI
+obj-$(CONFIG_SYS_I2C_DW) += dw_i2c_pci.o
+endif
  obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o
  obj-$(CONFIG_SYS_I2C_IHS) += ihs_i2c.o
  obj-$(CONFIG_SYS_I2C_INTEL) += intel_i2c.o
diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
index 6daa90e7442..54e4a70c74c 100644
--- a/drivers/i2c/designware_i2c.c
+++ b/drivers/i2c/designware_i2c.c
@@ -13,34 +13,6 @@
  #include 
  #include "designware_i2c.h"
  
-struct dw_scl_sda_cfg {

-   u32 ss_hcnt;
-   u32 fs_hcnt;
-   u32 ss_lcnt;
-   u32 fs_lcnt;
-   u32 sda_hold;
-};
-
-#ifdef CONFIG_X86
-/* BayTrail HCNT/LCNT/SDA hold time */
-static struct dw_scl_sda_cfg byt_config = {
-   .ss_hcnt = 0x200,
-   .fs_hcnt = 0x55,
-   .ss_lcnt = 0x200,
-   .fs_lcnt = 0x99,
-   .sda_hold = 0x6,
-};
-#endif
-
-struct dw_i2c {
-   struct i2c_regs *regs;
-   struct dw_scl_sda_cfg *scl_sda_cfg;
-   struct reset_ctl_bulk resets;
-#if CONFIG_IS_ENABLED(CLK)
-   struct clk clk;
-#endif
-};
-
  #ifdef CONFIG_SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED
  static int  dw_i2c_enable(struct i2c_regs *i2c_base, bool enable)
  {
@@ -90,7 +62,8 @@ static unsigned int __dw_i2c_set_bus_speed(struct i2c_regs 
*i2c_base,
unsigned int ena;
int i2c_spd;
  
-	if (speed >= I2C_MAX_SPEED)

+   if (speed >= I2C_MAX_SPEED &&
+   (!scl_sda_cfg || scl_sda_cfg->has_max_speed))
i2c_spd = IC_SPEED_MODE_MAX;
else if (speed >= I2C_FAST_SPEED)
i2c_spd = IC_SPEED_MODE_FAST;
@@ -106,7 +79,6 @@ static unsigned int __dw_i2c_set_bus_speed(struct i2c_regs 
*i2c_base,
cntl = (readl(&i2c_base->ic_con) & (~IC_CON_SPD_MSK));
  
  	switch (i2c_spd) {

-#ifndef CONFIG_X86 /* No High-speed for BayTrail yet */
case IC_SPEED_MODE_MAX:
cntl |= IC_CON_SPD_SS;
if (scl_sda_cfg) {
@@ -119,7 +91,6 @@ static unsigned int __dw_i2c_set_bus_speed(struct i2c_regs 
*i2c_base,
writel(hcnt, &i2c_base->ic_hs_scl_hcnt);
writel(lcnt, &i2c_base->ic_hs_scl_lcnt);
break;
-#endif
  
  	case IC_SPEED_MODE_STANDARD:

cntl |= IC_CON_SPD_SS;
@@ -565,24 +536,20 @@ static int designware_i2c_probe_chip(struct udevice *bus, 
uint chip_addr,
return ret;
  }
  
-static int designware_i2c_probe(struct udevice *bus)

+static int designware_i2c_ofdata_to_platdata(struct udevice *bus)
  {
struct dw_i2c *priv = dev_get_priv(bus);
-   int ret;
  
-	if (device_is_on_pci_bus(bus)) {

-#ifdef CONFIG_DM_PCI
-   /* Save base address from PCI BAR */
-   priv->regs = (struct i2c_regs *)
-   dm_pci_map_bar(bus, PCI_BASE_ADDRESS_0, PCI_REGION_MEM);
-#ifdef CONFIG_X86
-   /* Use BayTrail specific timing values */
-   priv->scl_sda_cfg = &byt_config;
-#endif
-#endif
-   } else {
-   priv->regs = (struct i2c_regs *)devfdt_get_addr_ptr(bus);
-   }
+   printf("bad\n");
+   priv->regs = (struct i2c_regs *)devfdt_get_addr_ptr(bus);
+
+   return 0;
+}
+
+int designware_i2c_probe(struct udevice *bus)
+{
+   struct dw_i2c *priv = dev_get_priv(bus);
+   int ret;
  
  	ret = reset_get_bulk(bus, &priv->resets);

if (ret)
@@ -606,7 +573,7 @@ static int designware_i2c_probe(struct udevice *bus)
return __dw_i2c_init(priv->regs, 0, 0);
  }
  
-static int designware_i2c_remove(struct udevice *dev)

+int designware_i2c_remove(struct udevice *dev)
  {
struct dw_i2c *priv = dev_get_priv(dev);
  
@@ -618,30 +585,7 @@ static int designware_i2c_remove(struct udevice *dev)

return reset_release_bulk(&priv->resets);
  }
  
-static int designware_i2c_bind(struct udevice *dev)

-{
-   static int num_cards;
-   char name[20];
-
-   /* Create a unique device name for PCI type de

Re: [U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-10-28 Thread Bartosz Golaszewski
pt., 25 paź 2019 o 19:25 Rizvi, Mohammad Faiz Abbas
 napisał(a):
>
> Hi Barotz,
>

It's Bartosz - it's literally on the next line of the e-mail too. :)

> On 10/25/2019 9:40 PM, Bartosz Golaszewski wrote:
> > czw., 26 wrz 2019 o 01:21 Faiz Abbas  napisał(a):
> >>
> >> Hi,
> >>
> >> On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
> >>> From: Bartosz Golaszewski 
> >>>
> >>> Enable CONFIG_SPL_DM and enable the driver model for serial by defining
> >>> an appropriate device in the board file for da850-lcdk.
> >>>
> >>
> >> This breaks booting from MMC on omapl138_lcdk. You didn't add a
> >> U_BOOT_DEVICE for the mmc node.
> >>
> >> Thanks,
> >> Faiz
> >
> > Just letting you know I haven't forgotten about this. I finally got
> > some time to work on it this week, but it turned out to be
> > non-trivial, as for some reason the set_cmd mmc callback is not being
> > properly assigned in SPL with driver-model and I couldn't find out why
> > so far.
>
> I will try to look at it as well.
>
>  Next week I'm at ELCE, but I'll be back at it on Thursday.
>
> I'm at ELC as well. Will be nice to meet up with you and discuss this if
> you want.
>

Sure, I'll be doing a talk on Wednesday, may be a good time to catch
me afterwards.

Bartosz

> Thanks,
> Faiz
>
>
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 030/108] x86: Move CPU init to before spl_init()

2019-10-28 Thread Bin Meng
On Mon, Oct 21, 2019 at 11:40 AM Simon Glass  wrote:
>
> At present we call spl_init() before identifying the CPU. This is not a
> good idea - e.g. if bootstage is enabled then it will try to set up the
> timer which works better if the CPU is identified.
>
> Put explicit code at each entry pointer to identify the CPU.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  arch/x86/cpu/start_from_spl.S | 1 +
>  arch/x86/lib/spl.c| 4 
>  arch/x86/lib/tpl.c| 5 +
>  3 files changed, 10 insertions(+)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 029/108] x86: Add a CPU init function for TPL

2019-10-28 Thread Bin Meng
On Mon, Oct 21, 2019 at 11:40 AM Simon Glass  wrote:
>
> For TPL we only need to set up the features and identify the CPU to a
> basic level. Add a function to handle that.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  arch/x86/cpu/i386/cpu.c   | 8 
>  arch/x86/include/asm/u-boot-x86.h | 9 +
>  2 files changed, 17 insertions(+)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 028/108] x86: Drop unnecessary interrupt code for TPL

2019-10-28 Thread Bin Meng
Hi Simon,

On Mon, Oct 21, 2019 at 11:40 AM Simon Glass  wrote:
>
> We don't expect an exception in TPL and don't need to print out full
> details if one happens. Add a reduced version of the code for TPL.
>
> Signed-off-by: Simon Glass 

Can we exclude the whole file from building in TPL?

> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  arch/x86/cpu/i386/interrupt.c | 13 +
>  1 file changed, 13 insertions(+)
>

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


Re: [U-Boot] [PATCH v3 026/108] x86: timer: Reduce timer code size in TPL on Intel CPUs

2019-10-28 Thread Bin Meng
Hi Simon,

On Mon, Oct 21, 2019 at 11:40 AM Simon Glass  wrote:
>
> Most of the timer-calibration methods are not needed on recent Intel CPUs
> and just increase code size. Add an option to use the known-good way to
> get the clock frequency in TPL. Size reduction is about 700 bytes.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  drivers/timer/Kconfig | 9 +
>  drivers/timer/tsc_timer.c | 7 +--
>  2 files changed, 14 insertions(+), 2 deletions(-)
>

You mentioned in the v2 that this breaks bootstage, and will drop this
patch. no?
https://www.mail-archive.com/u-boot@lists.denx.de/msg344229.html

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


Re: [U-Boot] [PATCH v3 024/108] x86: spl: Support init of a PUNIT

2019-10-28 Thread Bin Meng
On Mon, Oct 21, 2019 at 11:40 AM Simon Glass  wrote:
>
> The x86 power unit handles power management. Support initing this device
> which is modelled as a new type of system controller since there are no
> operations needed.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v3:
> - Fix 'err-%d' typo
>
> Changes in v2: None
>
>  arch/x86/include/asm/cpu.h |  1 +
>  arch/x86/lib/spl.c | 40 ++
>  2 files changed, 41 insertions(+)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 025/108] x86: tpl: Add a fake PCI bus

2019-10-28 Thread Bin Meng
On Mon, Oct 21, 2019 at 11:40 AM Simon Glass  wrote:
>
> In TPL we try to minimise code size so do not include the PCI subsystem.
> We can use fixed BARs and drivers can directly program the devices that
> they need.
>
> However we do need to bind the devices on the PCI bus and without PCI this
> does not ordinarily happen. As a work-around, define a fake PCI bus which
> does this binding, but no other PCI operations. This is a convenient way
> to ensure that we can use the same device tree for TPL, SPL and U-Boot
> proper:
>
>TPL- CONFIG_TPL_PCI is not set (no auto-config, fake PCI bus)
>SPL- CONFIG_SPL_PCI is set (no auto-config but with real PCI bus)
>U-Boot - CONFIG_PCI is set (full auto-config after relocation)
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v3:
> - Fix 'autoallocation' typo
> - Improve wording in commit message
>
> Changes in v2: None
>
>  arch/x86/lib/tpl.c | 25 +
>  1 file changed, 25 insertions(+)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 021/108] x86: timer: Set up the timer in timer_early_get_count()

2019-10-28 Thread Bin Meng
On Mon, Oct 21, 2019 at 11:33 AM Simon Glass  wrote:
>
> This function can be called before the timer is set up. Make sure that the
> init function is called so that it works correctly.
>
> This is needed so that bootstage can work correctly in TPL.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v3:
> - Update commit message
>
> Changes in v2: None
>
>  drivers/timer/tsc_timer.c | 2 ++
>  1 file changed, 2 insertions(+)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 022/108] x86: timer: Use a separate flag for whether timer is inited

2019-10-28 Thread Bin Meng
On Mon, Oct 21, 2019 at 11:39 AM Simon Glass  wrote:
>
> At present the value of the timer base is used to determine whether the
> timer has been set up or not. It is true that the timer is essentially
> never exactly 0 when it is read. However 'time 0' may indicate the time
> that the machine was reset so it is useful to be able to denote that.
>
> Update the code to use a separate flag instead.
>
> Signed-off-by: Simon Glass 
> ---
>
> Changes in v3: None
> Changes in v2: None
>
>  arch/x86/include/asm/global_data.h | 1 +
>  drivers/timer/tsc_timer.c  | 3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
>

Reviewed-by: Bin Meng 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot