[U-Boot] [PATCH] arm: armv7m: clean up armv7m unified code compilation

2018-08-31 Thread Vikas Manocha
unified syntax should be selected by config ARM_ASM_UNIFIED

Signed-off-by: Vikas Manocha 
---
 arch/arm/include/asm/armv7m.h | 5 -
 arch/arm/lib/crt0.S   | 4 +---
 arch/arm/lib/relocate.S   | 1 +
 arch/arm/lib/vectors_m.S  | 2 +-
 4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/arch/arm/include/asm/armv7m.h b/arch/arm/include/asm/armv7m.h
index 278f302..ad67b4f 100644
--- a/arch/arm/include/asm/armv7m.h
+++ b/arch/arm/include/asm/armv7m.h
@@ -10,11 +10,6 @@
 #ifndef ARMV7M_H
 #define ARMV7M_H
 
-#if defined(__ASSEMBLY__)
-.syntax unified
-.thumb
-#endif
-
 /* armv7m fixed base addresses */
 #define V7M_SCS_BASE   0xE000E000
 #define V7M_NVIC_BASE  (V7M_SCS_BASE + 0x0100)
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index d7ff9f0..fe312db 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -8,9 +8,7 @@
 #include 
 #include 
 #include 
-#ifdef CONFIG_CPU_V7M
-#include 
-#endif
+#include 
 
 /*
  * This file handles the target-independent stages of the U-Boot
diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
index c5b135d..e5f7267 100644
--- a/arch/arm/lib/relocate.S
+++ b/arch/arm/lib/relocate.S
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/arch/arm/lib/vectors_m.S b/arch/arm/lib/vectors_m.S
index d75e477..7d2d55c 100644
--- a/arch/arm/lib/vectors_m.S
+++ b/arch/arm/lib/vectors_m.S
@@ -5,7 +5,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 
 .type __hard_fault_entry, %function
-- 
2.7.4

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


[U-Boot] [PATCH] arm: armv7m: remove un-necessary If then instruction

2018-08-31 Thread Vikas Manocha
With gas option -mimplicit-it=always, IT block is inserted by the assembler
for thumb2.

Signed-off-by: Vikas Manocha 
---
 arch/arm/lib/crt0.S | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index 0decce2..d7ff9f0 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -139,9 +139,6 @@ here:
mov r2, #0x /* prepare zero to clear BSS */
 
 clbss_l:cmpr0, r1  /* while not at end of BSS */
-#if defined(CONFIG_CPU_V7M)
-   itt lo
-#endif
strlo   r2, [r0]/* clear 32-bit BSS word */
addlo   r0, r0, #4  /* move to next */
blo clbss_l
-- 
2.7.4

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


[U-Boot] [PATCH] arm: stm32: Remove redundant thumb build selection

2018-08-31 Thread Vikas Manocha
All armv7m arch builds are thumb & SYS_THUMB_BUILD is already selected by
CPU_ARMV7M.

Signed-off-by: Vikas Manocha 
---
 arch/arm/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8a23c76..b711605 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1266,7 +1266,6 @@ config STM32
select CPU_V7M
select DM
select DM_SERIAL
-   select SYS_THUMB_BUILD
imply CMD_DM
 
 config ARCH_STI
-- 
2.7.4

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


Re: [U-Boot] Make kmalloc'ed memory really DMA-safe

2018-08-31 Thread Tom Rini
On Fri, Aug 24, 2018 at 07:30:15PM +0900, Masahiro Yamada wrote:

> In Linux, the memory returned by kmalloc() is DMA-capable.
> However, it is not true in U-Boot.
> 
> At a glance, kmalloc() in U-Boot returns address aligned with
> ARCH_DMA_MINALIGN.  However, it never pads the allocated memory.
> This half-way house is completely useless because calling kmalloc()
> and malloc() in this order causes a cache sharing problem.
> 
> Change the implementation to call malloc_cache_aligned(), which
> allocates really DMA-capable memory.
> 
> Signed-off-by: Masahiro Yamada 

Applied to u-boot/master, 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] spl: Kconfig: Fix typo in 'Upgrade'

2018-08-31 Thread Tom Rini
On Fri, Aug 31, 2018 at 10:02:28AM -0300, Fabio Estevam wrote:

> From: Fabio Estevam 
> 
> Correct the spelling of 'Upgrade'.
> 
> Signed-off-by: Fabio Estevam 

Applied to u-boot/master, 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] [U-Boot, 1/1] test: fix typo in cmd_ut_category() description

2018-08-31 Thread Tom Rini
On Mon, Aug 27, 2018 at 10:04:10PM +0200, Heinrich Schuchardt wrote:

> argc = 1: all tests are run
> argc > 1: only argv[1] is run
> 
> So we need argc >= 1.
> 
> Signed-off-by: Heinrich Schuchardt 
> Reviewed-by: Simon Glass 

Applied to u-boot/master, 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] [U-Boot, 1/1] hisilicon: hikey: Update instructions based on latest source

2018-08-31 Thread Tom Rini
On Wed, Aug 29, 2018 at 10:07:36AM +0530, Manivannan Sadhasivam wrote:

> Update the HiKey board instructions based on the latest source
> available. These instructions are derived from the ATF platform doc.
> While updating the instructions, some comments on ATF issue has been
> removed since it is fixed in latest ATF source.
> 
> Signed-off-by: Manivannan Sadhasivam 

Applied to u-boot/master, thanks!

-- 
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 v2 13/17] efi_loader: capitalization table

2018-08-31 Thread Heinrich Schuchardt
This patch provides a define to initialize a table that maps lower to
capital letters for Unicode code point 0x - 0x.

Signed-off-by: Heinrich Schuchardt 
---
v2
add shorter tables for code pages 437 and 1250
---
 MAINTAINERS  |1 +
 include/capitalization.h | 2028 ++
 2 files changed, 2029 insertions(+)
 create mode 100644 include/capitalization.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 46f826a0fe..8c9cd83347 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -381,6 +381,7 @@ T:  git git://github.com/agraf/u-boot.git
 F: doc/README.uefi
 F: doc/README.iscsi
 F: Documentation/efi.rst
+F: include/capitalization.h
 F: include/efi*
 F: include/pe.h
 F: include/asm-generic/pe.h
diff --git a/include/capitalization.h b/include/capitalization.h
new file mode 100644
index 00..2c24e1bf47
--- /dev/null
+++ b/include/capitalization.h
@@ -0,0 +1,2028 @@
+/* SPDX-License-Identifier: Unicode-DFS-2016 */
+/*
+ * Capitalization tables
+ */
+
+struct capitalization_table {
+   u16 upper;
+   u16 lower;
+};
+
+/*
+ * Correspondence table for small and capital Unicode letters in the range of
+ * 0x - 0x based on 
http://www.unicode.org/Public/UCA/11.0.0/allkeys.txt
+ */
+#define UNICODE_CAPITALIZATION_TABLE { \
+   { 0x0531, /* ARMENIAN CAPITAL LETTER AYB */ \
+ 0x0561, /* ARMENIAN SMALL LETTER AYB */ }, \
+   { 0x0532, /* ARMENIAN CAPITAL LETTER BEN */ \
+ 0x0562, /* ARMENIAN SMALL LETTER BEN */ }, \
+   { 0x053E, /* ARMENIAN CAPITAL LETTER CA */ \
+ 0x056E, /* ARMENIAN SMALL LETTER CA */ }, \
+   { 0x0549, /* ARMENIAN CAPITAL LETTER CHA */ \
+ 0x0579, /* ARMENIAN SMALL LETTER CHA */ }, \
+   { 0x0543, /* ARMENIAN CAPITAL LETTER CHEH */ \
+ 0x0573, /* ARMENIAN SMALL LETTER CHEH */ }, \
+   { 0x0551, /* ARMENIAN CAPITAL LETTER CO */ \
+ 0x0581, /* ARMENIAN SMALL LETTER CO */ }, \
+   { 0x0534, /* ARMENIAN CAPITAL LETTER DA */ \
+ 0x0564, /* ARMENIAN SMALL LETTER DA */ }, \
+   { 0x0535, /* ARMENIAN CAPITAL LETTER ECH */ \
+ 0x0565, /* ARMENIAN SMALL LETTER ECH */ }, \
+   { 0x0537, /* ARMENIAN CAPITAL LETTER EH */ \
+ 0x0567, /* ARMENIAN SMALL LETTER EH */ }, \
+   { 0x0538, /* ARMENIAN CAPITAL LETTER ET */ \
+ 0x0568, /* ARMENIAN SMALL LETTER ET */ }, \
+   { 0x0556, /* ARMENIAN CAPITAL LETTER FEH */ \
+ 0x0586, /* ARMENIAN SMALL LETTER FEH */ }, \
+   { 0x0542, /* ARMENIAN CAPITAL LETTER GHAD */ \
+ 0x0572, /* ARMENIAN SMALL LETTER GHAD */ }, \
+   { 0x0533, /* ARMENIAN CAPITAL LETTER GIM */ \
+ 0x0563, /* ARMENIAN SMALL LETTER GIM */ }, \
+   { 0x0540, /* ARMENIAN CAPITAL LETTER HO */ \
+ 0x0570, /* ARMENIAN SMALL LETTER HO */ }, \
+   { 0x053B, /* ARMENIAN CAPITAL LETTER INI */ \
+ 0x056B, /* ARMENIAN SMALL LETTER INI */ }, \
+   { 0x0541, /* ARMENIAN CAPITAL LETTER JA */ \
+ 0x0571, /* ARMENIAN SMALL LETTER JA */ }, \
+   { 0x054B, /* ARMENIAN CAPITAL LETTER JHEH */ \
+ 0x057B, /* ARMENIAN SMALL LETTER JHEH */ }, \
+   { 0x0554, /* ARMENIAN CAPITAL LETTER KEH */ \
+ 0x0584, /* ARMENIAN SMALL LETTER KEH */ }, \
+   { 0x053F, /* ARMENIAN CAPITAL LETTER KEN */ \
+ 0x056F, /* ARMENIAN SMALL LETTER KEN */ }, \
+   { 0x053C, /* ARMENIAN CAPITAL LETTER LIWN */ \
+ 0x056C, /* ARMENIAN SMALL LETTER LIWN */ }, \
+   { 0x0544, /* ARMENIAN CAPITAL LETTER MEN */ \
+ 0x0574, /* ARMENIAN SMALL LETTER MEN */ }, \
+   { 0x0546, /* ARMENIAN CAPITAL LETTER NOW */ \
+ 0x0576, /* ARMENIAN SMALL LETTER NOW */ }, \
+   { 0x0555, /* ARMENIAN CAPITAL LETTER OH */ \
+ 0x0585, /* ARMENIAN SMALL LETTER OH */ }, \
+   { 0x054A, /* ARMENIAN CAPITAL LETTER PEH */ \
+ 0x057A, /* ARMENIAN SMALL LETTER PEH */ }, \
+   { 0x0553, /* ARMENIAN CAPITAL LETTER PIWR */ \
+ 0x0583, /* ARMENIAN SMALL LETTER PIWR */ }, \
+   { 0x054C, /* ARMENIAN CAPITAL LETTER RA */ \
+ 0x057C, /* ARMENIAN SMALL LETTER RA */ }, \
+   { 0x0550, /* ARMENIAN CAPITAL LETTER REH */ \
+ 0x0580, /* ARMENIAN SMALL LETTER REH */ }, \
+   { 0x054D, /* ARMENIAN CAPITAL LETTER SEH */ \
+ 0x057D, /* ARMENIAN SMALL LETTER SEH */ }, \
+   { 0x0547, /* ARMENIAN CAPITAL LETTER SHA */ \
+ 0x0577, /* ARMENIAN SMALL LETTER SHA */ }, \
+   { 0x054F, /* ARMENIAN CAPITAL LETTER TIWN */ \
+ 0x057F, /* ARMENIAN SMALL LETTER TIWN */ }, \
+   { 0x0539, /* ARMENIAN CAPITAL LETTER TO */ \
+ 0x0569, /* ARMENIAN SMALL LETTER TO */ }, \
+   { 0x054E, /* ARMENIAN CAPITAL LETTER VEW */ \
+ 0x057E, /* ARMENIAN SMALL LETTER VEW */ }, \
+   { 0x0548, /* ARMENIAN CAPITAL LETTER VO */ \
+ 0x0578, /* ARMENIAN SMALL LETTER VO */ }, \
+   { 0x053D, /* ARMENIAN CAPITAL LETTER XEH */ \
+ 0x056D, /* 

[U-Boot] [PATCH v2 01/17] vsprintf.c: use #if CONFIG_IS_ENABLED(EFI_LOADER)

2018-08-31 Thread Heinrich Schuchardt
Using CONFIG_IS_ENABLED(EFI_LOADER) allows to simply the #if statements.

Suggested-by: Alexander Graf 
Signed-off-by: Heinrich Schuchardt 
---
v2:
new patch
---
 lib/vsprintf.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 914fbd30cb..ef8b0b5989 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -294,8 +294,8 @@ static char *string16(char *buf, char *end, u16 *s, int 
field_width,
return buf;
 }
 
-#if defined(CONFIG_EFI_LOADER) && \
-   !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
+/* Device paths only exist in the EFI context. */
+#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
 static char *device_path_string(char *buf, char *end, void *dp, int 
field_width,
int precision, int flags)
 {
@@ -450,8 +450,8 @@ static char *pointer(const char *fmt, char *buf, char *end, 
void *ptr,
 #endif
 
switch (*fmt) {
-#if defined(CONFIG_EFI_LOADER) && \
-   !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
+/* Device paths only exist in the EFI context. */
+#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
case 'D':
return device_path_string(buf, end, ptr, field_width,
  precision, flags);
-- 
2.18.0

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


[U-Boot] [PATCH v2 12/17] lib: charset: remove obsolete functions

2018-08-31 Thread Heinrich Schuchardt
Remove functions:
- utf8_to_utf16()
- utf16_strcpy()
- utf16_strdup()

Signed-off-by: Heinrich Schuchardt 
---
v2
no chanage
---
 include/charset.h | 23 --
 lib/charset.c | 79 ---
 2 files changed, 102 deletions(-)

diff --git a/include/charset.h b/include/charset.h
index cf41eb5e5f..90870513ef 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -167,16 +167,6 @@ size_t u16_strlen(const u16 *in);
  */
 size_t u16_strnlen(const u16 *in, size_t count);
 
-/**
- * utf16_strcpy() - UTF16 equivalent of strcpy()
- */
-uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src);
-
-/**
- * utf16_strdup() - UTF16 equivalent of strdup()
- */
-uint16_t *utf16_strdup(const uint16_t *s);
-
 /**
  * utf16_to_utf8() - Convert an utf16 string to utf8
  *
@@ -193,17 +183,4 @@ uint16_t *utf16_strdup(const uint16_t *s);
  */
 uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size);
 
-/**
- * utf8_to_utf16() - Convert an utf8 string to utf16
- *
- * Converts up to 'size' characters of the utf16 string 'src' to utf8
- * written to the 'dest' buffer. Stops at 0x00.
- *
- * @dest   the destination buffer to write the utf8 characters
- * @srcthe source utf16 string
- * @size   maximum number of utf16 characters to convert
- * @return the pointer to the first unwritten byte in 'dest'
- */
-uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size);
-
 #endif /* __CHARSET_H_ */
diff --git a/lib/charset.c b/lib/charset.c
index e82622a7f8..39c8329830 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -256,29 +256,6 @@ size_t u16_strnlen(const u16 *in, size_t count)
return i;
 }
 
-uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src)
-{
-   uint16_t *tmp = dest;
-
-   while ((*dest++ = *src++) != '\0')
-   /* nothing */;
-   return tmp;
-
-}
-
-uint16_t *utf16_strdup(const uint16_t *s)
-{
-   uint16_t *new;
-
-   if (!s)
-   return NULL;
-   new = malloc((u16_strlen(s) + 1) * 2);
-   if (!new)
-   return NULL;
-   utf16_strcpy(new, s);
-   return new;
-}
-
 /* Convert UTF-16 to UTF-8.  */
 uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size)
 {
@@ -331,59 +308,3 @@ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, 
size_t size)
 
return dest;
 }
-
-uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size)
-{
-   while (size--) {
-   int extension_bytes;
-   uint32_t code;
-
-   extension_bytes = 0;
-   if (*src <= 0x7f) {
-   code = *src++;
-   /* Exit on zero byte */
-   if (!code)
-   size = 0;
-   } else if (*src <= 0xbf) {
-   /* Illegal code */
-   code = '?';
-   } else if (*src <= 0xdf) {
-   code = *src++ & 0x1f;
-   extension_bytes = 1;
-   } else if (*src <= 0xef) {
-   code = *src++ & 0x0f;
-   extension_bytes = 2;
-   } else if (*src <= 0xf7) {
-   code = *src++ & 0x07;
-   extension_bytes = 3;
-   } else {
-   /* Illegal code */
-   code = '?';
-   }
-
-   for (; extension_bytes && size; --size, --extension_bytes) {
-   if ((*src & 0xc0) == 0x80) {
-   code <<= 6;
-   code |= *src++ & 0x3f;
-   } else {
-   /* Illegal code */
-   code = '?';
-   ++src;
-   --size;
-   break;
-   }
-   }
-
-   if (code < 0x1) {
-   *dest++ = code;
-   } else {
-   /*
-* Simplified expression for
-* (((code - 0x1) >> 10) & 0x3ff) | 0xd800
-*/
-   *dest++ = (code >> 10) + 0xd7c0;
-   *dest++ = (code & 0x3ff) | 0xdc00;
-   }
-   }
-   return dest;
-}
-- 
2.18.0

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


[U-Boot] [PATCH v2 16/17] efi_loader: EFI_UNICODE_COLLATION_PROTOCOL

2018-08-31 Thread Heinrich Schuchardt
The patch implements the EFI_UNICODE_COLLATION_PROTOCOL.

Signed-off-by: Heinrich Schuchardt 
---
v2:
add more comments
---
 MAINTAINERS|   2 +
 include/cp1250.h   |  40 +++
 include/cp437.h|  40 +++
 include/efi_api.h  |  21 ++
 include/efi_loader.h   |   5 +
 lib/efi_loader/Makefile|  18 +-
 lib/efi_loader/efi_boottime.c  |   6 +
 lib/efi_loader/efi_unicode_collation.c | 329 +
 8 files changed, 457 insertions(+), 4 deletions(-)
 create mode 100644 include/cp1250.h
 create mode 100644 include/cp437.h
 create mode 100644 lib/efi_loader/efi_unicode_collation.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 8c9cd83347..67b015205c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -382,6 +382,8 @@ F:  doc/README.uefi
 F: doc/README.iscsi
 F: Documentation/efi.rst
 F: include/capitalization.h
+F: include/cp1250.h
+F: include/cp437.h
 F: include/efi*
 F: include/pe.h
 F: include/asm-generic/pe.h
diff --git a/include/cp1250.h b/include/cp1250.h
new file mode 100644
index 00..adacf8a958
--- /dev/null
+++ b/include/cp1250.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+/*
+ * Constant CP1250 contains the Unicode code points for characters 0x80 - 0xff
+ * of the code page 1250.
+ */
+#define CP1250 { \
+   0x20ac, 0x, 0x201a, 0x, \
+   0x201e, 0x2026, 0x2020, 0x2021, \
+   0x, 0x2030, 0x0160, 0x2039, \
+   0x015a, 0x0164, 0x017d, 0x0179, \
+   0x, 0x2018, 0x2019, 0x201c, \
+   0x201d, 0x2022, 0x2013, 0x2014, \
+   0x, 0x2122, 0x0161, 0x203a, \
+   0x015b, 0x0165, 0x017e, 0x017a, \
+   0x00a0, 0x02c7, 0x02d8, 0x0141, \
+   0x00a4, 0x0104, 0x00a6, 0x00a7, \
+   0x00a8, 0x00a9, 0x015e, 0x00ab, \
+   0x00ac, 0x00ad, 0x00ae, 0x017b, \
+   0x00b0, 0x00b1, 0x02db, 0x0142, \
+   0x00b4, 0x00b5, 0x00b6, 0x00b7, \
+   0x00b8, 0x0105, 0x015f, 0x00bb, \
+   0x013d, 0x02dd, 0x013e, 0x017c, \
+   0x0154, 0x00c1, 0x00c2, 0x0102, \
+   0x00c4, 0x0139, 0x0106, 0x00c7, \
+   0x010c, 0x00c9, 0x0118, 0x00cb, \
+   0x011a, 0x00cd, 0x00ce, 0x010e, \
+   0x0110, 0x0143, 0x0147, 0x00d3, \
+   0x00d4, 0x0150, 0x00d6, 0x00d7, \
+   0x0158, 0x016e, 0x00da, 0x0170, \
+   0x00dc, 0x00dd, 0x0162, 0x00df, \
+   0x0155, 0x00e1, 0x00e2, 0x0103, \
+   0x00e4, 0x013a, 0x0107, 0x00e7, \
+   0x010d, 0x00e9, 0x0119, 0x00eb, \
+   0x011b, 0x00ed, 0x00ee, 0x010f, \
+   0x0111, 0x0144, 0x0148, 0x00f3, \
+   0x00f4, 0x0151, 0x00f6, 0x00f7, \
+   0x0159, 0x016f, 0x00fa, 0x0171, \
+   0x00fc, 0x00fd, 0x0163, 0x02d9, \
+}
diff --git a/include/cp437.h b/include/cp437.h
new file mode 100644
index 00..0b2b97132e
--- /dev/null
+++ b/include/cp437.h
@@ -0,0 +1,40 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+/*
+ * Constant CP437 contains the Unicode code points for characters 0x80 - 0xff
+ * of the code page 437.
+ */
+#define CP437 { \
+   0x00c7, 0x00fc, 0x00e9, 0x00e2, \
+   0x00e4, 0x00e0, 0x00e5, 0x00e7, \
+   0x00ea, 0x00eb, 0x00e8, 0x00ef, \
+   0x00ee, 0x00ec, 0x00c4, 0x00c5, \
+   0x00c9, 0x00e6, 0x00c6, 0x00f4, \
+   0x00f6, 0x00f2, 0x00fb, 0x00f9, \
+   0x00ff, 0x00d6, 0x00dc, 0x00a2, \
+   0x00a3, 0x00a5, 0x20a7, 0x0192, \
+   0x00e1, 0x00ed, 0x00f3, 0x00fa, \
+   0x00f1, 0x00d1, 0x00aa, 0x00ba, \
+   0x00bf, 0x2310, 0x00ac, 0x00bd, \
+   0x00bc, 0x00a1, 0x00ab, 0x00bb, \
+   0x2591, 0x2592, 0x2593, 0x2502, \
+   0x2524, 0x2561, 0x2562, 0x2556, \
+   0x2555, 0x2563, 0x2551, 0x2557, \
+   0x255d, 0x255c, 0x255b, 0x2510, \
+   0x2514, 0x2534, 0x252c, 0x251c, \
+   0x2500, 0x253c, 0x255e, 0x255f, \
+   0x255a, 0x2554, 0x2569, 0x2566, \
+   0x2560, 0x2550, 0x256c, 0x2567, \
+   0x2568, 0x2564, 0x2565, 0x2559, \
+   0x2558, 0x2552, 0x2553, 0x256b, \
+   0x256a, 0x2518, 0x250c, 0x2588, \
+   0x2584, 0x258c, 0x2590, 0x2580, \
+   0x03b1, 0x00df, 0x0393, 0x03c0, \
+   0x03a3, 0x03c3, 0x00b5, 0x03c4, \
+   0x03a6, 0x0398, 0x03a9, 0x03b4, \
+   0x221e, 0x03c6, 0x03b5, 0x2229, \
+   0x2261, 0x00b1, 0x2265, 0x2264, \
+   0x2320, 0x2321, 0x00f7, 0x2248, \
+   0x00b0, 0x2219, 0x00b7, 0x221a, \
+   0x207f, 0x00b2, 0x25a0, 0x00a0, \
+}
diff --git a/include/efi_api.h b/include/efi_api.h
index ebf2a3bc18..1efc448184 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -31,6 +31,7 @@ enum efi_timer_delay {
EFI_TIMER_RELATIVE = 2
 };
 
+#define efi_intn_t ssize_t
 #define efi_uintn_t size_t
 typedef uint16_t *efi_string_t;
 
@@ -958,4 +959,24 @@ struct efi_driver_binding_protocol {
efi_handle_t driver_binding_handle;
 };
 
+#define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \
+   EFI_GUID(0xa4c751fc, 0x23ae, 0x4c3e, \
+0x92, 0xe9, 0x49, 0x64, 

[U-Boot] [PATCH 14/17] lib: charset: upper/lower case conversion

2018-08-31 Thread Heinrich Schuchardt
Provide functions for upper and lower case conversion.

Signed-off-by: Heinrich Schuchardt 
---
v2:
add configuration switch EFI_UNICODE_CAPITALIZATION
---
 include/charset.h  | 16 ++
 lib/charset.c  | 47 ++
 lib/efi_loader/Kconfig | 10 +
 3 files changed, 73 insertions(+)

diff --git a/include/charset.h b/include/charset.h
index 90870513ef..686db5a1fe 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -142,6 +142,22 @@ int utf16_utf8_strncpy(char **dst, const u16 *src, size_t 
count);
  */
 #define utf16_utf8_strcpy(d, s) utf16_utf8_strncpy((d), (s), SIZE_MAX)
 
+/**
+ * utf_to_lower() - convert a Unicode letter to lower case
+ *
+ * @code:  letter to convert
+ * Return: lower case letter or unchanged letter
+ */
+s32 utf_to_lower(const s32 code);
+
+/**
+ * utf_to_upper() - convert a Unicode letter to upper case
+ *
+ * @code:  letter to convert
+ * Return: upper case letter or unchanged letter
+ */
+s32 utf_to_upper(const s32 code);
+
 /**
  * u16_strlen - count non-zero words
  *
diff --git a/lib/charset.c b/lib/charset.c
index 39c8329830..72c808ce64 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -6,8 +6,18 @@
  */
 
 #include 
+#include 
 #include 
 
+static struct capitalization_table capitalization_table[] =
+#ifdef CONFIG_EFI_UNICODE_CAPITALIZATION
+   UNICODE_CAPITALIZATION_TABLE;
+#elif CONFIG_FAT_DEFAULT_CODEPAGE == 1250
+   CP1250_CAPITALIZATION_TABLE;
+#else
+   CP437_CAPITALIZATION_TABLE;
+#endif
+
 s32 utf8_get(const char **src)
 {
s32 code = 0;
@@ -241,6 +251,43 @@ int utf16_utf8_strncpy(char **dst, const u16 *src, size_t 
count)
return 0;
 }
 
+s32 utf_to_lower(const s32 code)
+{
+   struct capitalization_table *pos = capitalization_table;
+   s32 ret = code;
+
+   if (code <= 0x7f) {
+   if (code >= 'A' && code <= 'Z')
+   ret += 0x20;
+   return ret;
+   }
+   for (; pos->upper; ++pos) {
+   if (pos->upper == code) {
+   ret = pos->lower;
+   break;
+   }
+   }
+   return ret;
+}
+
+s32 utf_to_upper(const s32 code)
+{
+   struct capitalization_table *pos = capitalization_table;
+   s32 ret = code;
+
+   if (code <= 0x7f) {
+   if (code >= 'a' && code <= 'z')
+   ret -= 0x20;
+   return ret;
+   }
+   for (; pos->lower; ++pos) {
+   if (pos->lower == code) {
+   ret = pos->upper;
+   break;
+   }
+   }
+   return ret;
+}
 
 size_t u16_strlen(const u16 *in)
 {
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index ce6a09f0b4..dbf7339fe0 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -15,6 +15,16 @@ config EFI_LOADER
  interfaces to a loaded EFI application, enabling it to reuse U-Boot's
  device drivers.
 
+config EFI_UNICODE_CAPITALIZATION
+   bool "Support Unicode capitalization"
+   depends on EFI_LOADER
+   default y
+   help
+ Select this option to enable correct handling of the capitalization of
+ Unicode codepoints in the range 0x-0x. If this option is not
+ set, only the the correct handling of the letters of the codepage
+ used by the FAT file system is ensured.
+
 config EFI_LOADER_BOUNCE_BUFFER
bool "EFI Applications use bounce buffers for DMA operations"
depends on EFI_LOADER && ARM64
-- 
2.18.0

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


[U-Boot] [PATCH v2 06/17] test: unit tests for Unicode functions

2018-08-31 Thread Heinrich Schuchardt
Provide unit tests for Unicode functions.

Signed-off-by: Heinrich Schuchardt 
---
v2:
test handling of illegal Unicode sequences
use ut_assert*() functions from test framework
---
 MAINTAINERS   |   1 +
 include/test/suites.h |   3 +-
 lib/Makefile  |   4 +-
 test/Kconfig  |   8 +
 test/Makefile |   1 +
 test/cmd_ut.c |  13 +-
 test/unicode_ut.c | 466 ++
 7 files changed, 491 insertions(+), 5 deletions(-)
 create mode 100644 test/unicode_ut.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 8f237128b2..46f826a0fe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -387,6 +387,7 @@ F:  include/asm-generic/pe.h
 F: lib/charset.c
 F: lib/efi*/
 F: test/py/tests/test_efi*
+F: test/unicode_ut.c
 F: cmd/bootefi.c
 F: tools/file2include.c
 
diff --git a/include/test/suites.h b/include/test/suites.h
index 071ab4063e..abb3a4b816 100644
--- a/include/test/suites.h
+++ b/include/test/suites.h
@@ -23,10 +23,11 @@ struct unit_test;
 int cmd_ut_category(const char *name, struct unit_test *tests, int n_ents,
int argc, char * const argv[]);
 
+int do_ut_compression(cmd_tbl_t *cmdtp, int flag, int argc, char *const 
argv[]);
 int do_ut_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 int do_ut_env(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 int do_ut_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ut_compression(cmd_tbl_t *cmdtp, int flag, int argc, char *const 
argv[]);
+int do_ut_unicode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 
 #endif /* __TEST_SUITES_H__ */
diff --git a/lib/Makefile b/lib/Makefile
index 2fd32798a0..f169644850 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -21,7 +21,9 @@ obj-$(CONFIG_OPTEE) += optee/
 obj-$(CONFIG_AES) += aes.o
 
 ifndef API_BUILD
-obj-$(CONFIG_EFI_LOADER) += charset.o
+ifneq ($(CONFIG_UT_UNICODE)$(CONFIG_EFI_LOADER),)
+obj-y += charset.o
+endif
 endif
 obj-$(CONFIG_USB_TTY) += circbuf.o
 obj-y += crc7.o
diff --git a/test/Kconfig b/test/Kconfig
index 3643761bc6..de16d179d0 100644
--- a/test/Kconfig
+++ b/test/Kconfig
@@ -15,6 +15,14 @@ config UT_TIME
  problems. But if you are having problems with udelay() and the like,
  this is a good place to start.
 
+config UT_UNICODE
+   bool "Unit tests for Unicode functions"
+   depends on UNIT_TEST
+   default y
+   help
+ Enables the 'ut unicode' command which tests that the functions for
+ manipulating Unicode strings work correctly.
+
 source "test/dm/Kconfig"
 source "test/env/Kconfig"
 source "test/overlay/Kconfig"
diff --git a/test/Makefile b/test/Makefile
index 1092011fdb..a5f52fd5ad 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -8,4 +8,5 @@ obj-$(CONFIG_SANDBOX) += command_ut.o
 obj-$(CONFIG_SANDBOX) += compression.o
 obj-$(CONFIG_SANDBOX) += print_ut.o
 obj-$(CONFIG_UT_TIME) += time_ut.o
+obj-$(CONFIG_UT_UNICODE) += unicode_ut.o
 obj-$(CONFIG_$(SPL_)LOG) += log/
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index 934a5a931b..b7e01a4847 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -49,6 +49,9 @@ static cmd_tbl_t cmd_ut_sub[] = {
 #ifdef CONFIG_UT_TIME
U_BOOT_CMD_MKENT(time, CONFIG_SYS_MAXARGS, 1, do_ut_time, "", ""),
 #endif
+#if CONFIG_IS_ENABLED(UT_UNICODE) && !defined(API_BUILD)
+   U_BOOT_CMD_MKENT(unicode, CONFIG_SYS_MAXARGS, 1, do_ut_unicode, "", ""),
+#endif
 #ifdef CONFIG_SANDBOX
U_BOOT_CMD_MKENT(compression, CONFIG_SYS_MAXARGS, 1, do_ut_compression,
 "", ""),
@@ -93,6 +96,9 @@ static int do_ut(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 #ifdef CONFIG_SYS_LONGHELP
 static char ut_help_text[] =
"all - execute all enabled tests\n"
+#ifdef CONFIG_SANDBOX
+   "ut compression - Test compressors and bootm decompression\n"
+#endif
 #ifdef CONFIG_UT_DM
"ut dm [test-name]\n"
 #endif
@@ -105,11 +111,12 @@ static char ut_help_text[] =
 #ifdef CONFIG_UT_TIME
"ut time - Very basic test of time functions\n"
 #endif
-#ifdef CONFIG_SANDBOX
-   "ut compression - Test compressors and bootm decompression\n"
+#if defined(CONFIG_UT_UNICODE) && \
+   !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
+   "ut unicode [test-name] - test Unicode functions\n"
 #endif
;
-#endif
+#endif /* CONFIG_SYS_LONGHELP */
 
 U_BOOT_CMD(
ut, CONFIG_SYS_MAXARGS, 1, do_ut,
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
new file mode 100644
index 00..7fb9b03be9
--- /dev/null
+++ b/test/unicode_ut.c
@@ -0,0 +1,466 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Unit tests for Unicode functions
+ *
+ * Copyright (c) 2018 Heinrich Schuchardt 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Linker list entry for a Unicode test */
+#define UNICODE_TEST(_name) 

[U-Boot] [PATCH v2 11/17] efi_loader: buffer size for load options

2018-08-31 Thread Heinrich Schuchardt
The number of bytes in an utf-8 string is an upper limit for the number of
words in the equivalent utf-16 string. In so far the inumbant coding works
correctly. For non-ASCII characters the utf-16 string is shorter. With the
patch only the necessary buffer size is allocated for the load options.

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 cmd/bootefi.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index e169f5edc0..a0a8a7cdac 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -116,18 +116,20 @@ static void set_load_options(struct efi_loaded_image 
*loaded_image_info,
 {
size_t size;
const char *env = env_get(env_var);
+   u16 *pos;
 
loaded_image_info->load_options = NULL;
loaded_image_info->load_options_size = 0;
if (!env)
return;
-   size = strlen(env) + 1;
+   size = utf8_utf16_strlen(env) + 1;
loaded_image_info->load_options = calloc(size, sizeof(u16));
if (!loaded_image_info->load_options) {
printf("ERROR: Out of memory\n");
return;
}
-   utf8_to_utf16(loaded_image_info->load_options, (u8 *)env, size);
+   pos = loaded_image_info->load_options;
+   utf8_utf16_strcpy(, env);
loaded_image_info->load_options_size = size * 2;
 }
 
-- 
2.18.0

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


[U-Boot] [PATCH v2 15/17] test: tests for utf_to_lower() utf_to_upper().

2018-08-31 Thread Heinrich Schuchardt
Provide unit tests for utf_to_lower() utf_to_upper().

Signed-off-by: Heinrich Schuchardt 
---
v2:
use ut_assert*() for testing
---
 test/unicode_ut.c | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index d0dbd7985a..3e4231b241 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -500,6 +500,36 @@ int ut_utf16_utf8_strncpy(struct unit_test_state *uts)
 }
 UNICODE_TEST(ut_utf16_utf8_strncpy);
 
+int ut_utf_to_lower(struct unit_test_state *uts)
+{
+   ut_asserteq('@', utf_to_lower('@'));
+   ut_asserteq('a', utf_to_lower('A'));
+   ut_asserteq('z', utf_to_lower('Z'));
+   ut_asserteq('[', utf_to_lower('['));
+   ut_asserteq('m', utf_to_lower('m'));
+#ifdef CONFIG_EFI_UNICODE_CAPITALIZATION
+   /* Cyrillic letter I*/
+   ut_asserteq(0x0438, utf_to_lower(0x0418));
+#endif
+   return 0;
+}
+UNICODE_TEST(ut_utf_to_lower);
+
+int ut_utf_to_upper(struct unit_test_state *uts)
+{
+   ut_asserteq('`', utf_to_upper('`'));
+   ut_asserteq('A', utf_to_upper('a'));
+   ut_asserteq('Z', utf_to_upper('z'));
+   ut_asserteq('{', utf_to_upper('{'));
+   ut_asserteq('M', utf_to_upper('M'));
+#ifdef CONFIG_EFI_UNICODE_CAPITALIZATION
+   /* Cyrillic letter I */
+   ut_asserteq(0x0418, utf_to_upper(0x0438));
+#endif
+   return 0;
+}
+UNICODE_TEST(ut_utf_to_upper);
+
 int do_ut_unicode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
struct unit_test *tests = ll_entry_start(struct unit_test, 
unicode_test);
-- 
2.18.0

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


[U-Boot] [PATCH v2 05/17] lib: charset: utility functions for Unicode

2018-08-31 Thread Heinrich Schuchardt
utf8_get() - get next UTF-8 code point from buffer
utf8_put() - write UTF-8 code point to buffer
utf8_utf16_strnlen() - length of a utf-8 string after conversion to utf-16
utf8_utf16_strncpy() - copy a utf-8 string to utf-16
utf16_get() - get next UTF-16 code point from buffer
utf16_put() - write UTF-16 code point to buffer
utf16_strnlen() - number of codes points in a utf-16 string
utf16_utf8_strnlen() - length of a utf-16 string after conversion to utf-8
utf16_utf8_strncpy() - copy a utf-16 string to utf-8

Signed-off-by: Heinrich Schuchardt 
---
v2
correct handling of illegal Unicode sequences 
---
 include/charset.h | 130 +
 lib/charset.c | 236 +-
 2 files changed, 363 insertions(+), 3 deletions(-)

diff --git a/include/charset.h b/include/charset.h
index 2c6deb8034..cf41eb5e5f 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -8,10 +8,140 @@
 #ifndef __CHARSET_H_
 #define __CHARSET_H_
 
+#include 
 #include 
 
 #define MAX_UTF8_PER_UTF16 3
 
+/**
+ * utf8_get() - get next UTF-8 code point from buffer
+ *
+ * @src:   pointer to current byte, updated to point to next byte
+ * Return: code point, or 0 for end of string, or -1 if no legal
+ * code point is found. In case of an error src points to
+ * the incorrect byte.
+ */
+s32 utf8_get(const char **src);
+
+/**
+ * utf8_put() - write UTF-8 code point to buffer
+ *
+ * @code:  code point
+ * @dst:   pointer to destination buffer, updated to next position
+ * Return: -1 if the input parameters are invalid
+ */
+int utf8_put(s32 code, char **dst);
+
+/**
+ * utf8_utf16_strnlen() - length of a truncated utf-8 string after conversion
+ *   to utf-16
+ *
+ * @src:   utf-8 string
+ * @count: maximum number of code points to convert
+ * Return: length in bytes after conversion to utf-16 without the
+ * trailing \0. If an invalid UTF-8 sequence is hit one
+ * word will be reserved for a replacement character.
+ */
+size_t utf8_utf16_strnlen(const char *src, size_t count);
+
+/**
+ * utf8_utf16_strlen() - length of a utf-8 string after conversion to utf-16
+ *
+ * @src:   utf-8 string
+ * Return: length in bytes after conversion to utf-16 without the
+ * trailing \0. -1 if the utf-8 string is not valid.
+ */
+#define utf8_utf16_strlen(a) utf8_utf16_strnlen((a), SIZE_MAX)
+
+/**
+ * utf8_utf16_strncpy() - copy utf-8 string to utf-16 string
+ *
+ * @dst:   destination buffer
+ * @src:   source buffer
+ * @count: maximum number of code points to copy
+ * Return: -1 if the input parameters are invalid
+ */
+int utf8_utf16_strncpy(u16 **dst, const char *src, size_t count);
+
+/**
+ * utf8_utf16_strcpy() - copy utf-8 string to utf-16 string
+ *
+ * @dst:   destination buffer
+ * @src:   source buffer
+ * Return: -1 if the input parameters are invalid
+ */
+#define utf8_utf16_strcpy(d, s) utf8_utf16_strncpy((d), (s), SIZE_MAX)
+
+/**
+ * utf16_get() - get next UTF-16 code point from buffer
+ *
+ * @src:   pointer to current word, updated to point to next word
+ * Return: code point, or 0 for end of string, or -1 if no legal
+ * code point is found. In case of an error src points to
+ * the incorrect word.
+ */
+s32 utf16_get(const u16 **src);
+
+/**
+ * utf16_put() - write UTF-16 code point to buffer
+ *
+ * @code:  code point
+ * @dst:   pointer to destination buffer, updated to next position
+ * Return: -1 if the input parameters are invalid
+ */
+int utf16_put(s32 code, u16 **dst);
+
+/**
+ * utf16_strnlen() - length of a truncated utf-16 string
+ *
+ * @src:   utf-16 string
+ * @count: maximum number of code points to convert
+ * Return: length in code points. If an invalid UTF-16 sequence is
+ * hit one position will be reserved for a replacement
+ * character.
+ */
+size_t utf16_strnlen(const u16 *src, size_t count);
+
+/**
+ * utf16_utf8_strnlen() - length of a truncated utf-16 string after conversion
+ *   to utf-8
+ *
+ * @src:   utf-16 string
+ * @count: maximum number of code points to convert
+ * Return: length in bytes after conversion to utf-8 without the
+ * trailing \0. If an invalid UTF-16 sequence is hit one
+ * byte will be reserved for a replacement character.
+ */
+size_t utf16_utf8_strnlen(const u16 *src, size_t count);
+
+/**
+ * utf16_utf8_strlen() - length of a utf-16 string after conversion to utf-8
+ *
+ * @src:   utf-16 string
+ * Return: length 

[U-Boot] [PATCH v2 17/17] efi_selftest: EFI_UNICODE_COLLATION_PROTOCOL

2018-08-31 Thread Heinrich Schuchardt
Provide a unit test for the EFI_UNICODE_COLLATION_PROTOCOL.

Signed-off-by: Heinrich Schuchardt 
---
v2:
avoid lines over 80 characters
---
 lib/efi_selftest/Makefile |   1 +
 .../efi_selftest_unicode_collation.c  | 260 ++
 2 files changed, 261 insertions(+)
 create mode 100644 lib/efi_selftest/efi_selftest_unicode_collation.c

diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile
index 86aa72b0e0..80bc5d8a64 100644
--- a/lib/efi_selftest/Makefile
+++ b/lib/efi_selftest/Makefile
@@ -31,6 +31,7 @@ efi_selftest_snp.o \
 efi_selftest_textinput.o \
 efi_selftest_textoutput.o \
 efi_selftest_tpl.o \
+efi_selftest_unicode_collation.o \
 efi_selftest_util.o \
 efi_selftest_variables.o \
 efi_selftest_watchdog.o
diff --git a/lib/efi_selftest/efi_selftest_unicode_collation.c 
b/lib/efi_selftest/efi_selftest_unicode_collation.c
new file mode 100644
index 00..9765bd3e44
--- /dev/null
+++ b/lib/efi_selftest/efi_selftest_unicode_collation.c
@@ -0,0 +1,260 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * efi_selftest_unicode_collation
+ *
+ * Copyright (c) 2018 Heinrich Schuchardt 
+ *
+ * Test unicode collation protocol.
+ */
+
+#include 
+
+static const efi_guid_t unicode_collation_protocol_guid =
+   EFI_UNICODE_COLLATION_PROTOCOL2_GUID;
+
+static struct efi_boot_services *boottime;
+
+static struct efi_unicode_collation_protocol *unicode_collation_protocol;
+
+/**
+ * setup() - setup unit test.
+ *
+ * @handle:handle of the loaded image
+ * @systable:  system table
+ * ReturnValue:EFI_ST_SUCCESS for success
+ */
+static int setup(const efi_handle_t handle,
+const struct efi_system_table *systable)
+{
+   efi_status_t ret;
+
+   boottime = systable->boottime;
+
+   ret = boottime->locate_protocol(_collation_protocol_guid, NULL,
+   (void **)_collation_protocol);
+   if (ret != EFI_SUCCESS) {
+   unicode_collation_protocol = NULL;
+   efi_st_error("Unicode collation protocol is not available.\n");
+   return EFI_ST_FAILURE;
+   }
+
+   return EFI_ST_SUCCESS;
+}
+
+static int test_stri_coll(void)
+{
+   efi_intn_t ret;
+   u16 c1[] = L"first";
+   u16 c2[] = L"FIRST";
+   u16 c3[] = L"second";
+
+   ret = unicode_collation_protocol->stri_coll(unicode_collation_protocol,
+   c1, c2);
+   if (ret) {
+   efi_st_error(
+   "stri_coll(\"%ps\", \"%ps\") = %zu\n", c1, c2, ret);
+   return EFI_ST_FAILURE;
+   }
+
+   ret = unicode_collation_protocol->stri_coll(unicode_collation_protocol,
+   c1, c3);
+   if (ret >= 0) {
+   efi_st_error(
+   "stri_coll(\"%ps\", \"%ps\") = %zu\n", c1, c3, ret);
+   return EFI_ST_FAILURE;
+   }
+
+   ret = unicode_collation_protocol->stri_coll(unicode_collation_protocol,
+   c3, c1);
+   if (ret <= 0) {
+   efi_st_error(
+   "stri_coll(\"%ps\", \"%ps\") = %zu\n", c3, c1, ret);
+   return EFI_ST_FAILURE;
+   }
+
+   return EFI_ST_SUCCESS;
+}
+
+static int test_metai_match(void)
+{
+   bool ret;
+   const u16 c[] = L"Das U-Boot";
+
+   ret = unicode_collation_protocol->metai_match(
+   unicode_collation_protocol, c, L"*");
+   if (!ret) {
+   efi_st_error("metai_match returned %u\n", ret);
+   return EFI_ST_FAILURE;
+   }
+
+   ret = unicode_collation_protocol->metai_match(
+   unicode_collation_protocol, c, L"Da[rstu] U-Boot");
+   if (!ret) {
+   efi_st_error("metai_match returned %u\n", ret);
+   return EFI_ST_FAILURE;
+   }
+
+   ret = unicode_collation_protocol->metai_match(
+   unicode_collation_protocol, c, L"Da[q-v] U-Boot");
+   if (!ret) {
+   efi_st_error("metai_match returned %u\n", ret);
+   return EFI_ST_FAILURE;
+   }
+
+   ret = unicode_collation_protocol->metai_match(
+   unicode_collation_protocol, c, L"Da? U-Boot");
+   if (!ret) {
+   efi_st_error("metai_match returned %u\n", ret);
+   return EFI_ST_FAILURE;
+   }
+
+   ret = unicode_collation_protocol->metai_match(
+   unicode_collation_protocol, c, L"D*Bo*t");
+   if (!ret) {
+   efi_st_error("metai_match returned %u\n", ret);
+   return EFI_ST_FAILURE;
+   }
+
+   ret = unicode_collation_protocol->metai_match(
+   unicode_collation_protocol, c, L"Da[xyz] U-Boot");
+   if (ret) {
+   efi_st_error("metai_match returned %u\n", ret);
+   return EFI_ST_FAILURE;
+   }
+
+   ret = 

[U-Boot] [PATCH v2 04/17] efi_loader: rename utf16_strlen, utf16_strnlen

2018-08-31 Thread Heinrich Schuchardt
The function names utf16_strlen() and utf16_strnlen() are misnomers.
The functions do not count utf-16 characters but non-zero words.
So let's rename them to u16_strlen and u16_strnlen().

In utf16_dup() avoid assignment in if clause.

Signed-off-by: Heinrich Schuchardt 
---
v2
add more comments
---
 include/charset.h | 30 +++---
 lib/charset.c | 10 +++---
 lib/efi_loader/efi_bootmgr.c  |  2 +-
 lib/efi_loader/efi_console.c  |  2 +-
 lib/efi_loader/efi_file.c |  2 +-
 lib/efi_loader/efi_variable.c |  2 +-
 lib/vsprintf.c|  2 +-
 7 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/include/charset.h b/include/charset.h
index 11832cbd12..2c6deb8034 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -13,29 +13,29 @@
 #define MAX_UTF8_PER_UTF16 3
 
 /**
- * utf16_strlen() - Get the length of an utf16 string
+ * u16_strlen - count non-zero words
  *
- * Returns the number of 16 bit characters in an utf16 string, not
- * including the terminating NULL character.
+ * This function matches wsclen() if the -fshort-wchar compiler flag is set.
+ * In the EFI context we explicitly need a function handling u16 strings.
  *
- * @in the string to measure
- * @return the string length
+ * @in:null terminated u16 string
+ * ReturnValue:number of non-zero words.
+ * This is not the number of utf-16 letters!
  */
-size_t utf16_strlen(const uint16_t *in);
+size_t u16_strlen(const u16 *in);
 
 /**
- * utf16_strnlen() - Get the length of a fixed-size utf16 string.
+ * u16_strlen - count non-zero words
  *
- * Returns the number of 16 bit characters in an utf16 string,
- * not including the terminating NULL character, but at most
- * 'count' number of characters.  In doing this, utf16_strnlen()
- * looks at only the first 'count' characters.
+ * This function matches wscnlen_s() if the -fshort-wchar compiler flag is set.
+ * In the EFI context we explicitly need a function handling u16 strings.
  *
- * @in the string to measure
- * @count  the maximum number of characters to count
- * @return the string length, up to a maximum of 'count'
+ * @in:null terminated u16 string
+ * @count: maximum number of words to count
+ * ReturnValue:number of non-zero words.
+ * This is not the number of utf-16 letters!
  */
-size_t utf16_strnlen(const uint16_t *in, size_t count);
+size_t u16_strnlen(const u16 *in, size_t count);
 
 /**
  * utf16_strcpy() - UTF16 equivalent of strcpy()
diff --git a/lib/charset.c b/lib/charset.c
index cd186a5a5a..8ff8d59957 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -12,14 +12,14 @@
  * utf8/utf16 conversion mostly lifted from grub
  */
 
-size_t utf16_strlen(const uint16_t *in)
+size_t u16_strlen(const u16 *in)
 {
size_t i;
for (i = 0; in[i]; i++);
return i;
 }
 
-size_t utf16_strnlen(const uint16_t *in, size_t count)
+size_t u16_strnlen(const u16 *in, size_t count)
 {
size_t i;
for (i = 0; count-- && in[i]; i++);
@@ -39,7 +39,11 @@ uint16_t *utf16_strcpy(uint16_t *dest, const uint16_t *src)
 uint16_t *utf16_strdup(const uint16_t *s)
 {
uint16_t *new;
-   if (!s || !(new = malloc((utf16_strlen(s) + 1) * 2)))
+
+   if (!s)
+   return NULL;
+   new = malloc((u16_strlen(s) + 1) * 2);
+   if (!new)
return NULL;
utf16_strcpy(new, s);
return new;
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index 853358ab93..0c5764db12 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -60,7 +60,7 @@ static void parse_load_option(struct load_option *lo, void 
*ptr)
ptr += sizeof(u16);
 
lo->label = ptr;
-   ptr += (utf16_strlen(lo->label) + 1) * 2;
+   ptr += (u16_strlen(lo->label) + 1) * 2;
 
lo->file_path = ptr;
ptr += lo->file_path_length;
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index b487288785..f3d612880c 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -114,7 +114,7 @@ static efi_status_t EFIAPI efi_cout_output_string(
 
EFI_ENTRY("%p, %p", this, string);
 
-   unsigned int n16 = utf16_strlen(string);
+   unsigned int n16 = u16_strlen(string);
char buf[MAX_UTF8_PER_UTF16 * n16 + 1];
u16 *p;
 
diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 2107730ba5..5dafe28070 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -140,7 +140,7 @@ static struct efi_file_handle *file_open(struct file_system 
*fs,
 
if (file_name) {
utf16_to_utf8((u8 *)f0, (u16 *)file_name, 1);
-   flen = utf16_strlen((u16 *)file_name);
+   flen = u16_strlen((u16 *)file_name);
}
 
/* we could have a parent, but also 

[U-Boot] [PATCH v2 10/17] efi_loader: don't use unlimited stack as buffer

2018-08-31 Thread Heinrich Schuchardt
The length of a string printed to the console by the
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL is not limited by the UEFI spec.
Hence should not allocate a buffer for it on the stack.

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 lib/efi_loader/efi_console.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index f3d612880c..f5f3f256dd 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -111,16 +111,21 @@ static efi_status_t EFIAPI efi_cout_output_string(
 {
struct simple_text_output_mode *con = _con_mode;
struct cout_mode *mode = _cout_modes[con->mode];
-
-   EFI_ENTRY("%p, %p", this, string);
-
-   unsigned int n16 = u16_strlen(string);
-   char buf[MAX_UTF8_PER_UTF16 * n16 + 1];
+   char *buf, *pos;
u16 *p;
+   efi_status_t ret = EFI_SUCCESS;
 
-   *utf16_to_utf8((u8 *)buf, string, n16) = '\0';
+   EFI_ENTRY("%p, %p", this, string);
 
+   buf = malloc(utf16_utf8_strlen(string) + 1);
+   if (!buf) {
+   ret = EFI_OUT_OF_RESOURCES;
+   goto out;
+   }
+   pos = buf;
+   utf16_utf8_strcpy(, string);
fputs(stdout, buf);
+   free(buf);
 
/*
 * Update the cursor position.
@@ -158,7 +163,8 @@ static efi_status_t EFIAPI efi_cout_output_string(
con->cursor_row = min(con->cursor_row, (s32)mode->rows - 1);
}
 
-   return EFI_EXIT(EFI_SUCCESS);
+out:
+   return EFI_EXIT(ret);
 }
 
 static efi_status_t EFIAPI efi_cout_test_string(
-- 
2.18.0

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


[U-Boot] [PATCH v2 07/17] lib: vsprintf: correct printing of Unicode strings

2018-08-31 Thread Heinrich Schuchardt
The width and precision of the printf() function refer to the number of
characters not to the number of bytes printed.

Signed-off-by: Heinrich Schuchardt 
---
v2:
use library function utf16_utf8_strncpy() for string16()
---
 lib/vsprintf.c | 13 -
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 5abf734750..4213441fbf 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -280,18 +280,13 @@ static char *string16(char *buf, char *end, u16 *s, int 
field_width,
int precision, int flags)
 {
u16 *str = s ? s : L"";
-   int utf16_len = u16_strnlen(str, precision);
-   u8 utf8[utf16_len * MAX_UTF8_PER_UTF16];
-   int utf8_len, i;
-
-   utf8_len = utf16_to_utf8(utf8, str, utf16_len) - utf8;
+   ssize_t len = utf16_strnlen(str, precision);
 
if (!(flags & LEFT))
-   while (utf8_len < field_width--)
+   for (; len < field_width; --field_width)
ADDCH(buf, ' ');
-   for (i = 0; i < utf8_len; ++i)
-   ADDCH(buf, utf8[i]);
-   while (utf8_len < field_width--)
+   utf16_utf8_strncpy(, str, len);
+   for (; len < field_width; --field_width)
ADDCH(buf, ' ');
return buf;
 }
-- 
2.18.0

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


[U-Boot] [PATCH v2 09/17] efi_loader: remove limit on variable length

2018-08-31 Thread Heinrich Schuchardt
The EFI spec does not provide a length limit for variables.

Reviewed-by: Alexander Graf 
Signed-off-by: Heinrich Schuchardt 
---
v2:
no change
---
 lib/efi_loader/efi_variable.c | 52 ---
 1 file changed, 30 insertions(+), 22 deletions(-)

diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 770c67abb9..495738884b 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -44,10 +44,7 @@
  * converted to utf16?
  */
 
-#define MAX_VAR_NAME 31
-#define MAX_NATIVE_VAR_NAME \
-   (strlen("efi_---_") + \
-   (MAX_VAR_NAME * MAX_UTF8_PER_UTF16))
+#define PREFIX_LEN (strlen("efi_---_"))
 
 static int hex(int ch)
 {
@@ -101,18 +98,20 @@ static char *mem2hex(char *hexstr, const u8 *mem, int 
count)
return hexstr;
 }
 
-static efi_status_t efi_to_native(char *native, u16 *variable_name,
+static efi_status_t efi_to_native(char **native, const u16 *variable_name,
  efi_guid_t *vendor)
 {
size_t len;
+   char *pos;
 
-   len = u16_strlen((u16 *)variable_name);
-   if (len >= MAX_VAR_NAME)
-   return EFI_DEVICE_ERROR;
+   len = PREFIX_LEN + utf16_utf8_strlen(variable_name) + 1;
+   *native = malloc(len);
+   if (!*native)
+   return EFI_OUT_OF_RESOURCES;
 
-   native += sprintf(native, "efi_%pUl_", vendor);
-   native  = (char *)utf16_to_utf8((u8 *)native, (u16 *)variable_name, 
len);
-   *native = '\0';
+   pos = *native;
+   pos += sprintf(pos, "efi_%pUl_", vendor);
+   utf16_utf8_strcpy(, variable_name);
 
return EFI_SUCCESS;
 }
@@ -168,7 +167,7 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name, 
efi_guid_t *vendor,
 u32 *attributes, efi_uintn_t *data_size,
 void *data)
 {
-   char native_name[MAX_NATIVE_VAR_NAME + 1];
+   char *native_name;
efi_status_t ret;
unsigned long in_size;
const char *val, *s;
@@ -180,13 +179,14 @@ efi_status_t EFIAPI efi_get_variable(u16 *variable_name, 
efi_guid_t *vendor,
if (!variable_name || !vendor || !data_size)
return EFI_EXIT(EFI_INVALID_PARAMETER);
 
-   ret = efi_to_native(native_name, variable_name, vendor);
+   ret = efi_to_native(_name, variable_name, vendor);
if (ret)
return EFI_EXIT(ret);
 
debug("%s: get '%s'\n", __func__, native_name);
 
val = env_get(native_name);
+   free(native_name);
if (!val)
return EFI_EXIT(EFI_NOT_FOUND);
 
@@ -256,35 +256,41 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, 
efi_guid_t *vendor,
 u32 attributes, efi_uintn_t data_size,
 void *data)
 {
-   char native_name[MAX_NATIVE_VAR_NAME + 1];
+   char *native_name = NULL, *val = NULL, *s;
efi_status_t ret = EFI_SUCCESS;
-   char *val, *s;
u32 attr;
 
EFI_ENTRY("\"%ls\" %pUl %x %zu %p", variable_name, vendor, attributes,
  data_size, data);
 
-   if (!variable_name || !vendor)
-   return EFI_EXIT(EFI_INVALID_PARAMETER);
+   if (!variable_name || !vendor) {
+   ret = EFI_INVALID_PARAMETER;
+   goto out;
+   }
 
-   ret = efi_to_native(native_name, variable_name, vendor);
+   ret = efi_to_native(_name, variable_name, vendor);
if (ret)
-   return EFI_EXIT(ret);
+   goto out;
 
 #define ACCESS_ATTR (EFI_VARIABLE_RUNTIME_ACCESS | 
EFI_VARIABLE_BOOTSERVICE_ACCESS)
 
if ((data_size == 0) || !(attributes & ACCESS_ATTR)) {
/* delete the variable: */
env_set(native_name, NULL);
-   return EFI_EXIT(EFI_SUCCESS);
+   ret = EFI_SUCCESS;
+   goto out;
}
 
val = env_get(native_name);
if (val) {
parse_attr(val, );
 
-   if (attr & READ_ONLY)
-   return EFI_EXIT(EFI_WRITE_PROTECTED);
+   if (attr & READ_ONLY) {
+   /* We should not free val */
+   val = NULL;
+   ret = EFI_WRITE_PROTECTED;
+   goto out;
+   }
}
 
val = malloc(2 * data_size + strlen("{ro,run,boot}(blob)") + 1);
@@ -320,6 +326,8 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, 
efi_guid_t *vendor,
if (env_set(native_name, val))
ret = EFI_DEVICE_ERROR;
 
+out:
+   free(native_name);
free(val);
 
return EFI_EXIT(ret);
-- 
2.18.0

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


[U-Boot] [PATCH v2 02/17] test: print_ut.c use #if CONFIG_IS_ENABLED(EFI_LOADER)

2018-08-31 Thread Heinrich Schuchardt
Using CONFIG_IS_ENABLED(EFI_LOADER) allows to simply the #if statements.

Suggested-by: Alexander Graf 
Signed-off-by: Heinrich Schuchardt 
---
v2
new patch
---
 test/print_ut.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/test/print_ut.c b/test/print_ut.c
index fb46db832e..f0f1d6010a 100644
--- a/test/print_ut.c
+++ b/test/print_ut.c
@@ -6,8 +6,7 @@
 #define DEBUG
 
 #include 
-#if defined(CONFIG_EFI_LOADER) && \
-   !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
+#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
 #include 
 #endif
 #include 
@@ -19,8 +18,7 @@
 /* Test efi_loader specific printing */
 static void efi_ut_print(void)
 {
-#if defined(CONFIG_EFI_LOADER) && \
-!defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
+#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
char str[10];
u8 buf[sizeof(struct efi_device_path_sd_mmc_path) +
   sizeof(struct efi_device_path)];
-- 
2.18.0

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


[U-Boot] [PATCH v2 08/17] test: test printing Unicode

2018-08-31 Thread Heinrich Schuchardt
Test printing of Unicode strings

Signed-off-by: Heinrich Schuchardt 
---
v2
use ut_assert*() functions for testing
test handling of illegal Unicode sequences
---
 test/unicode_ut.c | 43 +++
 1 file changed, 43 insertions(+)

diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index 7fb9b03be9..d0dbd7985a 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -50,6 +50,49 @@ static const char j1[] = {0x6a, 0x31, 0xa1, 0x6c, 0x00};
 static const char j2[] = {0x6a, 0x32, 0xc3, 0xc3, 0x6c, 0x00};
 static const char j3[] = {0x6a, 0x33, 0xf0, 0x90, 0xf0, 0x00};
 
+/* U-Boot uses UTF-16 strings in the EFI context only. */
+#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
+static int ut_string16(struct unit_test_state *uts)
+{
+   char buf[20];
+
+   /* Test length and precision */
+   memset(buf, 0xff, sizeof(buf));
+   sprintf(buf, "%8.6ls", c2);
+   ut_asserteq(' ', buf[1]);
+   ut_assert(!strncmp([2], d2, 7));
+   ut_assert(!buf[9]);
+
+   memset(buf, 0xff, sizeof(buf));
+   sprintf(buf, "%8.6ls", c4);
+   ut_asserteq(' ', buf[4]);
+   ut_assert(!strncmp([5], d4, 12));
+   ut_assert(!buf[17]);
+
+   memset(buf, 0xff, sizeof(buf));
+   sprintf(buf, "%-8.2ls", c4);
+   ut_asserteq(' ', buf[8]);
+   ut_assert(!strncmp(buf, d4, 8));
+   ut_assert(!buf[14]);
+
+   /* Test handling of illegal utf-16 sequences */
+   memset(buf, 0xff, sizeof(buf));
+   sprintf(buf, "%ls", i1);
+   ut_asserteq_str("i1?l", buf);
+
+   memset(buf, 0xff, sizeof(buf));
+   sprintf(buf, "%ls", i2);
+   ut_asserteq_str("i2?l", buf);
+
+   memset(buf, 0xff, sizeof(buf));
+   sprintf(buf, "%ls", i3);
+   ut_asserteq_str("i3?", buf);
+
+   return 0;
+}
+UNICODE_TEST(ut_string16);
+#endif
+
 static int ut_utf8_get(struct unit_test_state *uts)
 {
const char *s;
-- 
2.18.0

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


[U-Boot] [PATCH v2 00/17][RESENT] efi_loader: EFI_UNICODE_COLLATION_PROTOCOL

2018-08-31 Thread Heinrich Schuchardt
This patchset implements the EFI_UNICODE_COLLATION_PROTOCOL and provides
unit tests.

Additionally some errors when handling Unicode strings are fixed.
* possible stack overflow
* incorrect handling of precision attribute in printf()
* incorrect limit on variable length

Some old Unicode functions are replaced.

An error in Unicode handling in the FAT file system shall be fixed after
merging Takahiro's FAT patches. Until then some redundancy between old and
new Unicode functions remains.

v2:
use CONFIG_IS_ENABLED(EFI_LOADER) instead of
defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD)
add configuration option EFI_UNICODE_CAPITALIZATION
use ut_assert*() for testing
test illegal Unicode sequences
add more comments

Heinrich Schuchardt (17):
  vsprintf.c: use #if CONFIG_IS_ENABLED(EFI_LOADER)
  test: print_ut.c use #if CONFIG_IS_ENABLED(EFI_LOADER)
  lib: build charset.o only if needed
  efi_loader: rename utf16_strlen, utf16_strnlen
  lib: charset: utility functions for Unicode
  test: unit tests for Unicode functions
  lib: vsprintf: correct printing of Unicode strings
  test: test printing Unicode
  efi_loader: remove limit on variable length
  efi_loader: don't use unlimited stack as buffer
  efi_loader: buffer size for load options
  lib: charset: remove obsolete functions
  efi_loader: capitalization table
  lib: charset: upper/lower case conversion
  test: tests for utf_to_lower() utf_to_upper().
  efi_loader: EFI_UNICODE_COLLATION_PROTOCOL
  efi_selftest: EFI_UNICODE_COLLATION_PROTOCOL

 MAINTAINERS   |4 +
 cmd/bootefi.c |6 +-
 include/capitalization.h  | 2028 +
 include/charset.h |  187 +-
 include/cp1250.h  |   40 +
 include/cp437.h   |   40 +
 include/efi_api.h |   21 +
 include/efi_loader.h  |5 +
 include/test/suites.h |3 +-
 lib/Makefile  |5 +
 lib/charset.c |  359 ++-
 lib/efi_loader/Kconfig|   10 +
 lib/efi_loader/Makefile   |   18 +-
 lib/efi_loader/efi_bootmgr.c  |2 +-
 lib/efi_loader/efi_boottime.c |6 +
 lib/efi_loader/efi_console.c  |   20 +-
 lib/efi_loader/efi_file.c |2 +-
 lib/efi_loader/efi_unicode_collation.c|  329 +++
 lib/efi_loader/efi_variable.c |   52 +-
 lib/efi_selftest/Makefile |1 +
 .../efi_selftest_unicode_collation.c  |  260 +++
 lib/vsprintf.c|   29 +-
 test/Kconfig  |8 +
 test/Makefile |1 +
 test/cmd_ut.c |   13 +-
 test/print_ut.c   |6 +-
 test/unicode_ut.c |  539 +
 27 files changed, 3824 insertions(+), 170 deletions(-)
 create mode 100644 include/capitalization.h
 create mode 100644 include/cp1250.h
 create mode 100644 include/cp437.h
 create mode 100644 lib/efi_loader/efi_unicode_collation.c
 create mode 100644 lib/efi_selftest/efi_selftest_unicode_collation.c
 create mode 100644 test/unicode_ut.c

-- 
2.18.0

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


[U-Boot] [PATCH v2 03/17] lib: build charset.o only if needed

2018-08-31 Thread Heinrich Schuchardt
charset.o is only needed for the EFI subsystem

Signed-off-by: Heinrich Schuchardt 
---
v2
use CONFIG_IS_ENABLED(EFI_LOADER) instead of
defined(CONFIG_EFI_LOADER) && !defined(CONFIG_SPL_BUILD)
---
 lib/Makefile   |  5 -
 lib/vsprintf.c | 12 
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/Makefile b/lib/Makefile
index 5f583aed37..2fd32798a0 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -19,7 +19,10 @@ obj-$(CONFIG_ARCH_AT91) += at91/
 obj-$(CONFIG_OPTEE) += optee/
 
 obj-$(CONFIG_AES) += aes.o
-obj-y += charset.o
+
+ifndef API_BUILD
+obj-$(CONFIG_EFI_LOADER) += charset.o
+endif
 obj-$(CONFIG_USB_TTY) += circbuf.o
 obj-y += crc7.o
 obj-y += crc8.o
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index ef8b0b5989..632796f864 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -274,6 +274,8 @@ static char *string(char *buf, char *end, char *s, int 
field_width,
return buf;
 }
 
+/* U-Boot uses UTF-16 strings in the EFI context only. */
+#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
 static char *string16(char *buf, char *end, u16 *s, int field_width,
int precision, int flags)
 {
@@ -294,8 +296,6 @@ static char *string16(char *buf, char *end, u16 *s, int 
field_width,
return buf;
 }
 
-/* Device paths only exist in the EFI context. */
-#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
 static char *device_path_string(char *buf, char *end, void *dp, int 
field_width,
int precision, int flags)
 {
@@ -612,10 +612,14 @@ repeat:
continue;
 
case 's':
-   if (qualifier == 'l' && !IS_ENABLED(CONFIG_SPL_BUILD)) {
+/* U-Boot uses UTF-16 strings in the EFI context only. */
+#if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
+   if (qualifier == 'l') {
str = string16(str, end, va_arg(args, u16 *),
   field_width, precision, flags);
-   } else {
+   } else
+#endif
+   {
str = string(str, end, va_arg(args, char *),
 field_width, precision, flags);
}
-- 
2.18.0

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


Re: [U-Boot] [PULL] Please pull u-boot-imx

2018-08-31 Thread Stefano Babic
On 31/08/2018 15:07, Tom Rini wrote:
> On Fri, Aug 31, 2018 at 03:04:31PM +0200, Stefano Babic wrote:
>> Hi Tom,
>>
>> please pull from u-boot-imx, thanks !
>>
>> The following changes since commit 11ed312896c5f5814064c5d45dcb2f53dc121437:
>>
>>   configs: am57xx: change default board name to beagle_x15 (2018-08-26
>> 12:26:16 -0400)
>>
>> are available in the Git repository at:
>>
>>   git://www.denx.de/git/u-boot-imx.git master
>>
>> for you to fetch changes up to 2846e663fd62200a189bba357135e284a379a38b:
>>
>>   imx: missing CONFIG_MII in mx7dsabresd_qspi_defconfig (2018-08-31
>> 12:08:43 +0200)
>>
>> 
>> Alex Kiernan (1):
>>   Cleanup CONFIG_BOOTDELAY on cl-som-imx7
>>
>> Anson Huang (3):
>>   imx: mx7: psci: improve cpu hotplug flow
>>   imx: mx7: add gpc initialization for low power mode
>>   imx: mx7: add system suspend/resume support
>>
>> Denis Zalevskiy (6):
>>   board: ge: Remove EEPROM bus param from read_vpd()
>>   board: ge: Move VPD EEPROM configuration to the defconfig
>>   bootcount: i2c: Add bus switching to the I2C bootcount driver
>>   bootcount: Configure length limit for I2C bootcount
>>   board: ge: Move VPD reading to the vpd_reader
>>   board: ge: Store bootcount in EEPROM on PPD and Bx50v3
>>
>> Martin Kaiser (1):
>>   watchdog: mx25: use the imx_watchdog driver for mx25
>>
>> Stefan Agner (2):
>>   board: toradex: common: fail gracefully on missing NAND chip
>>   colibri_imx7_emmc: add Colibri iMX7D 1GB (eMMC) module support
>>
>> Stefano Babic (2):
>>   Merge branch 'master' of git://git.denx.de/u-boot into master
>>   imx: missing CONFIG_MII in mx7dsabresd_qspi_defconfig
>>
>> Sébastien Szymanski (1):
>>   ARM: opos6ul: make the board boot again
>>
>> Ye Li (6):
>>   imx: imx6sx-sdb: Enable DM QSPI driver
>>   imx: imx6sx-sabreauto: convert to use DM QSPI driver
>>   imx: imx7d-sdb: Add DM QSPI support
>>   dts: imx6ul: Update alias to support DM
>>   dts: imx6ul_evk: Add DTS files for 14x14 EVK and 9x9 EVK boards
>>   imx: imx6ul_evk: Enable DM driver for iMX6UL EVK u-boot
>>
>>  arch/arm/dts/Makefile |   7 +-
>>  arch/arm/dts/imx6sx-sabreauto-u-boot.dtsi |  16 +
>>  arch/arm/dts/imx6sx-sabreauto.dts |  40 ++
>>  arch/arm/dts/imx6sx-sdb-u-boot.dtsi   |  16 +
>>  arch/arm/dts/imx6sx.dtsi  |  12 +-
>>  arch/arm/dts/imx6ul-14x14-evk-u-boot.dtsi |  10 +
>>  arch/arm/dts/imx6ul-14x14-evk.dts | 427 +++
>>  arch/arm/dts/imx6ul-9x9-evk-u-boot.dtsi   |  10 +
>>  arch/arm/dts/imx6ul-9x9-evk.dts   | 471
>> +
>>  arch/arm/dts/imx6ul-opos6ul-u-boot.dtsi   |  28 ++
>>  arch/arm/dts/imx6ul-opos6ul.dtsi  |   2 -
>>  arch/arm/dts/imx6ul-opos6uldev-u-boot.dts |  25 ++
>>  arch/arm/dts/imx6ul-opos6uldev.dts|   2 -
>>  arch/arm/dts/imx6ul.dtsi  |  13 +-
>>  arch/arm/dts/imx7d-sdb-qspi-u-boot.dtsi   |  10 +
>>  arch/arm/dts/imx7d-sdb-qspi.dts   |  44 ++
>>  arch/arm/dts/imx7d-sdb.dts|   6 +-
>>  arch/arm/dts/imx7d.dtsi   |  12 +
>>  arch/arm/dts/imx7s.dtsi   |  22 +-
>>  arch/arm/include/asm/arch-mx25/imx-regs.h |   1 +
>>  arch/arm/mach-imx/mx7/Makefile|   2 +-
>>  arch/arm/mach-imx/mx7/psci-mx7.c  | 472
>> +-
>>  arch/arm/mach-imx/mx7/psci-suspend.S  |  67 +++
>>  arch/arm/mach-imx/mx7/soc.c   | 103 +
>>  board/freescale/mx6sxsabreauto/mx6sxsabreauto.c   |  24 --
>>  board/freescale/mx6sxsabresd/mx6sxsabresd.c   |  25 --
>>  board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c | 208 ++
>>  board/freescale/mx7dsabresd/mx7dsabresd.c |  16 -
>>  board/ge/bx50v3/Kconfig   |   2 +
>>  board/ge/bx50v3/bx50v3.c  |  57 +--
>>  board/ge/common/Kconfig   |  14 +
>>  board/ge/common/vpd_reader.c  |  57 ++-
>>  board/ge/common/vpd_reader.h  |  16 +-
>>  board/ge/mx53ppd/Kconfig  |   2 +
>>  board/ge/mx53ppd/mx53ppd.c|  50 +--
>>  board/toradex/colibri_imx7/Kconfig|  42 +-
>>  board/toradex/colibri_imx7/MAINTAINERS|   4 +
>>  board/toradex/colibri_imx7/colibri_imx7.c |  41 +-
>>  board/toradex/common/tdx-cfg-block.c  |   7 +-
>>  configs/ge_bx50v3_defconfig   |  27 +-
>>  configs/mx53ppd_defconfig |  29 +-
>>  configs/mx6sxsabreauto_defconfig  |   2 +
>>  configs/mx6sxsabresd_defconfig|   7 +
>>  

Re: [U-Boot] [PULL] Please pull u-boot-imx

2018-08-31 Thread Otavio Salvador
On Fri, Aug 31, 2018 at 4:21 PM Stefano Babic  wrote:
> On 31/08/2018 20:53, Otavio Salvador wrote:
> > On Fri, Aug 31, 2018 at 10:08 AM Tom Rini  wrote:
> >> On Fri, Aug 31, 2018 at 03:04:31PM +0200, Stefano Babic wrote:
> >>> please pull from u-boot-imx, thanks !
> >
> > We sent few patches for PICO and we'd like to get them merged for next
> > release if possible. Is it possible for you to review them and see if
> > they are fine for merging or need adjustments?
>
> I saw your patches, but Tom is already complaining that I have sent a PR
> with more changes as he expected. You just sent your patchset yesterday
> and, even if they are just for pico-imx6ul, I will pick them after release.

Being a board specific I really see no high right but postponing it,
is fine for sure. If possible, provide some feedback so I can rework
anything need.

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854  Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PULL] Please pull u-boot-imx

2018-08-31 Thread Stefano Babic
Hi Otavio,

On 31/08/2018 20:53, Otavio Salvador wrote:
> Hello Stefano,
> 
> On Fri, Aug 31, 2018 at 10:08 AM Tom Rini  wrote:
>> On Fri, Aug 31, 2018 at 03:04:31PM +0200, Stefano Babic wrote:
>>> please pull from u-boot-imx, thanks !
> 
> We sent few patches for PICO and we'd like to get them merged for next
> release if possible. Is it possible for you to review them and see if
> they are fine for merging or need adjustments?

I saw your patches, but Tom is already complaining that I have sent a PR
with more changes as he expected. You just sent your patchset yesterday
and, even if they are just for pico-imx6ul, I will pick them after release.

Best regards,
Stefano

-- 
=
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PULL] Please pull u-boot-imx

2018-08-31 Thread Otavio Salvador
Hello Stefano,

On Fri, Aug 31, 2018 at 10:08 AM Tom Rini  wrote:
> On Fri, Aug 31, 2018 at 03:04:31PM +0200, Stefano Babic wrote:
> > please pull from u-boot-imx, thanks !

We sent few patches for PICO and we'd like to get them merged for next
release if possible. Is it possible for you to review them and see if
they are fine for merging or need adjustments?

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854  Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 2/3] efi_loader: ARM: run EFI payloads non-secure

2018-08-31 Thread Mark Kettenis
> From: Heinrich Schuchardt 
> Date: Fri, 31 Aug 2018 19:37:25 +0200
> 
> On 06/14/2018 12:41 AM, Mark Kettenis wrote:
> > If desired (and possible) switch into HYP mode or non-secure SVC mode
> > before calling the entry point of an EFI application.  This allows
> > U-Boot to provide a usable PSCI implementation and makes it possible
> > to boot kernels into hypervisor mode using an EFI bootloader.
> > 
> > Based on diffs from Heinrich Schuchardt and Alexander Graf.
> > 
> > Signed-off-by: Mark Kettenis 
> 
> bootefi hello fails on vexpress_ca15_tc2_defconfig when run on qemu with
> 
> QEMU_AUDIO_DRV=none qemu-system-arm \
> -M vexpress-a15 -cpu cortex-a15 -kernel u-boot \
> -net user -net nic,model=lan9118 \
> -m 1024M --nographic \
> -drive if=sd,file=img.vexpress,media=disk,format=raw

Works for me with:

$ qemu-system-arm --version
QEMU emulator version 3.0.0
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers

=> bootefi hello
Scanning disks on mmc...
MMC Device 1 not found
MMC Device 2 not found
MMC Device 3 not found
Found 3 disks
WARNING: booting without device tree
## Starting EFI application at a0008000 ...
WARNING: using memory device/image path, this may confuse some payloads!
Hello, world!
Running on UEFI 2.7
Have SMBIOS table
Load options: 
## Application terminated, r = 0

That is with CONFIG_CMD_BOOTEFI_HELLO=y added to the
vexpress_ca15_tc2_defconfig of course.

> Bisection points to
> efi_loader: ARM: run EFI payloads non-secure
> commit dc500c369486fbe04000fd325c46bb309e4a1827

That suggests an issue with emulation if the mode switching
instructions or HYP support in qemu.  Or a toolchain issue of course.

Cheers,

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


Re: [U-Boot] [PATCH v3 2/3] efi_loader: ARM: run EFI payloads non-secure

2018-08-31 Thread Heinrich Schuchardt
On 06/14/2018 12:41 AM, Mark Kettenis wrote:
> If desired (and possible) switch into HYP mode or non-secure SVC mode
> before calling the entry point of an EFI application.  This allows
> U-Boot to provide a usable PSCI implementation and makes it possible
> to boot kernels into hypervisor mode using an EFI bootloader.
> 
> Based on diffs from Heinrich Schuchardt and Alexander Graf.
> 
> Signed-off-by: Mark Kettenis 

bootefi hello fails on vexpress_ca15_tc2_defconfig when run on qemu with

QEMU_AUDIO_DRV=none qemu-system-arm \
-M vexpress-a15 -cpu cortex-a15 -kernel u-boot \
-net user -net nic,model=lan9118 \
-m 1024M --nographic \
-drive if=sd,file=img.vexpress,media=disk,format=raw

Bisection points to
efi_loader: ARM: run EFI payloads non-secure
commit dc500c369486fbe04000fd325c46bb309e4a1827

Best regards

Heinrich Schuchardt





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


Re: [U-Boot] u-boot release and feature set

2018-08-31 Thread Tom Rini
On Fri, Aug 31, 2018 at 04:45:41PM +, York Sun wrote:

> On 08/31/2018 09:30 AM, Tom Rini wrote:
> > On Fri, Aug 31, 2018 at 03:59:59PM +, York Sun wrote:
> >> On 08/31/2018 08:49 AM, Tom Rini wrote:
> >>> I really would appreciate the level of detail Linus' tree gets in signed
> >>> commit messages being in the U-Boot tree too.  No, it's not perfect and
> >>> it does need someone to make it more digestible, but it's a good
> >>> starting point.  And the people that do send me signed tags do a good
> >>> job too I think.
> >>>
> >>
> >> If you prefer to have signed tags, we can start to do this. Would you
> >> write some guideline on the format, and what information should be
> >> included in the annotated tags, how often do we tag?I guess you will use
> >> a script to extract information, unless you want to read all of them.
> >  
> > I will admit that I had to manually find this email link as perhaps my
> > subject at the time was not the best:
> > https://lists.denx.de/pipermail/u-boot/2018-June/330610.html
> > 
> > If information is in the merge commit then it's a lot easier to do
> > anything more on top of that.  Thanks!
> > 
> 
> Tom,
> 
> I have been trying to avoid merge commit. I do my best to rebase my tree
> before requesting a PR so it would be easier for you to merge.
> 
> Using signed tag is not an issue. But you still don't have the important
> changes separated from trivial changes, unless this information is
> included in the message. For example, if I request a pull with 50
> commits, in which 40 commits only deal with default environmental
> variables. The other 10 commits add a new driver which will be shared
> for new platforms. I consider the useful information in this PR is the
> new driver. If this description is in the tag message, it would be
> easier for you to gather and put into a release note. So having a
> predefined format will help you to parse the message. I don't think you
> prefer to read all tags with your eyes.

I appreciate that you want to make this easy on me.  So yes, I expect a
summary of things and not an itemized list.  Looking over the current
tree, 2668e9f4adb8c0ac8b36a2c3089fa8f05283, 
188ebc7b594841b6e05ece4690a01517b4136cdd and
61523dde17d1539b8ea361e25909acfdfc465155 are three good example.
Honestly, if most of my log on say 'git log --merges
v2018.09..v2018.11-rc1' was mostly commits like that I'd be super happy
to spend an hour reading and putting that into a summary email.

-- 
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] u-boot release and feature set

2018-08-31 Thread York Sun
On 08/31/2018 09:30 AM, Tom Rini wrote:
> On Fri, Aug 31, 2018 at 03:59:59PM +, York Sun wrote:
>> On 08/31/2018 08:49 AM, Tom Rini wrote:
>>> I really would appreciate the level of detail Linus' tree gets in signed
>>> commit messages being in the U-Boot tree too.  No, it's not perfect and
>>> it does need someone to make it more digestible, but it's a good
>>> starting point.  And the people that do send me signed tags do a good
>>> job too I think.
>>>
>>
>> If you prefer to have signed tags, we can start to do this. Would you
>> write some guideline on the format, and what information should be
>> included in the annotated tags, how often do we tag?I guess you will use
>> a script to extract information, unless you want to read all of them.
>  
> I will admit that I had to manually find this email link as perhaps my
> subject at the time was not the best:
> https://lists.denx.de/pipermail/u-boot/2018-June/330610.html
> 
> If information is in the merge commit then it's a lot easier to do
> anything more on top of that.  Thanks!
> 

Tom,

I have been trying to avoid merge commit. I do my best to rebase my tree
before requesting a PR so it would be easier for you to merge.

Using signed tag is not an issue. But you still don't have the important
changes separated from trivial changes, unless this information is
included in the message. For example, if I request a pull with 50
commits, in which 40 commits only deal with default environmental
variables. The other 10 commits add a new driver which will be shared
for new platforms. I consider the useful information in this PR is the
new driver. If this description is in the tag message, it would be
easier for you to gather and put into a release note. So having a
predefined format will help you to parse the message. I don't think you
prefer to read all tags with your eyes.

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


Re: [U-Boot] u-boot release and feature set

2018-08-31 Thread Tom Rini
On Fri, Aug 31, 2018 at 03:59:59PM +, York Sun wrote:
> On 08/31/2018 08:49 AM, Tom Rini wrote:
> > I really would appreciate the level of detail Linus' tree gets in signed
> > commit messages being in the U-Boot tree too.  No, it's not perfect and
> > it does need someone to make it more digestible, but it's a good
> > starting point.  And the people that do send me signed tags do a good
> > job too I think.
> > 
> 
> If you prefer to have signed tags, we can start to do this. Would you
> write some guideline on the format, and what information should be
> included in the annotated tags, how often do we tag?I guess you will use
> a script to extract information, unless you want to read all of them.
 
I will admit that I had to manually find this email link as perhaps my
subject at the time was not the best:
https://lists.denx.de/pipermail/u-boot/2018-June/330610.html

If information is in the merge commit then it's a lot easier to do
anything more on top of that.  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] u-boot release and feature set

2018-08-31 Thread York Sun
On 08/31/2018 08:49 AM, Tom Rini wrote:
> I really would appreciate the level of detail Linus' tree gets in signed
> commit messages being in the U-Boot tree too.  No, it's not perfect and
> it does need someone to make it more digestible, but it's a good
> starting point.  And the people that do send me signed tags do a good
> job too I think.
> 

If you prefer to have signed tags, we can start to do this. Would you
write some guideline on the format, and what information should be
included in the annotated tags, how often do we tag?I guess you will use
a script to extract information, unless you want to read all of them.

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


[U-Boot] [PATCH] dm: Update README.txt to clarify device tree usage

2018-08-31 Thread Tom Rini
In the section about Device Trees add a paragraph at the end that
clarifies how we decide of a tree is valid or not.  We say that all
bindings must either be in the specification (link provided) or in our
device-tree-bindings directory.  We say that most of these come from the
Linux Kernel and as such some design decisions are made for us already,
but that in most cases we wish to retain compatibility.

Cc: Simon Glass 
Cc: Bin Meng 
Signed-off-by: Tom Rini 
---
 doc/driver-model/README.txt | 9 +
 1 file changed, 9 insertions(+)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index d6fa5c485793..e949ff63bae4 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -449,6 +449,15 @@ The driver model tree is intended to mirror that of the 
device tree. The
 root driver is at device tree offset 0 (the root node, '/'), and its
 children are the children of the root node.
 
+In order for a device tree to be valid, the content must be correct with
+respect to either device tree specification
+(https://www.devicetree.org/specifications/) or the device tree bindings that
+are found in the doc/device-tree-bindings directory.  When not U-Boot specific
+the bindings in this directory tend to come from the Linux Kernel.  As such
+certain design decisions may have been made already for us in terms of how
+specific devices are described and bound.  In most circumstances we wish to
+retain compatibility without additional changes being made to the device tree
+source files.
 
 Declaring Uclasses
 --
-- 
2.7.4

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


Re: [U-Boot] u-boot release and feature set

2018-08-31 Thread Tom Rini
On Fri, Aug 31, 2018 at 03:46:29PM +, York Sun wrote:
> On 08/28/2018 08:11 PM, Prabhakar Kushwaha wrote:
> > Thanks Tom for responding,
> > 
> >> -Original Message-
> >> From: Tom Rini 
> >> Sent: Wednesday, August 29, 2018 7:28 AM
> >> To: Prabhakar Kushwaha 
> >> Cc: u-boot@lists.denx.de
> >> Subject: Re: [U-Boot] u-boot release and feature set
> >>
> >> On Tue, Aug 28, 2018 at 06:48:13AM +, Prabhakar Kushwaha wrote:
> >>
> >>> Hi Tom,
> >>>
> >>> Every u-boot release announcement has a very high level feature set.
> >>> I am wondering, if you also maintain detailed feature list  per u-boot
> >> release?
> >>>
> >>> I can see "Statistics" details per release from 
> >>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.denx.de%2Fwiki%2FU-data=02%7C01%7Cyork.sun%40nxp.com%7C9b263f9701134c98b63208d60d5d1d5e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636711090913158275sdata=ZJZMJUnx1LUwWMrU5%2F3kbfDo8X0GK%2BfvIqJO%2BObB4aY%3Dreserved=0
> >> Boot/ReleaseCycle but not the feature set.
> >>> May be I am looking at wrong place ☹
> >>
> >> It's been asked from time to time but I am simply bad about it.  I had 
> >> tried
> >> parsing the git logs every -rc to come up with something more detailed, but
> >> that didn't last.  If more people did signed tags that would provide some
> >> useful information for a detailed changelog.
> >>
> > Feature set is good thing to have per release. It help us in taking 
> > decision of upreving u-boot (now or later). 
> > 
> > A suggestion, can we ask feature set details in every pull request from 
> > sub-maintainers. 
> > Or
> > A blog can also be maintained, where sub-maintainer can write feature set 
> > per pull request. 
> > 
> > Sub-maintainers have better idea what feature they are providing.  
> > Feature set can also be published per sub-system (instead of pick and 
> > choose).  
> 
> I think a short description in pull request can work. Parsing git log
> doesn't have the weight on each commit. We don't need to know every
> details of a platform fix, we care more on wider and bigger changes.

I really would appreciate the level of detail Linus' tree gets in signed
commit messages being in the U-Boot tree too.  No, it's not perfect and
it does need someone to make it more digestible, but it's a good
starting point.  And the people that do send me signed tags do a good
job too I think.

-- 
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] u-boot release and feature set

2018-08-31 Thread York Sun
On 08/28/2018 08:11 PM, Prabhakar Kushwaha wrote:
> Thanks Tom for responding,
> 
>> -Original Message-
>> From: Tom Rini 
>> Sent: Wednesday, August 29, 2018 7:28 AM
>> To: Prabhakar Kushwaha 
>> Cc: u-boot@lists.denx.de
>> Subject: Re: [U-Boot] u-boot release and feature set
>>
>> On Tue, Aug 28, 2018 at 06:48:13AM +, Prabhakar Kushwaha wrote:
>>
>>> Hi Tom,
>>>
>>> Every u-boot release announcement has a very high level feature set.
>>> I am wondering, if you also maintain detailed feature list  per u-boot
>> release?
>>>
>>> I can see "Statistics" details per release from 
>>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.denx.de%2Fwiki%2FU-data=02%7C01%7Cyork.sun%40nxp.com%7C9b263f9701134c98b63208d60d5d1d5e%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636711090913158275sdata=ZJZMJUnx1LUwWMrU5%2F3kbfDo8X0GK%2BfvIqJO%2BObB4aY%3Dreserved=0
>> Boot/ReleaseCycle but not the feature set.
>>> May be I am looking at wrong place ☹
>>
>> It's been asked from time to time but I am simply bad about it.  I had tried
>> parsing the git logs every -rc to come up with something more detailed, but
>> that didn't last.  If more people did signed tags that would provide some
>> useful information for a detailed changelog.
>>
> Feature set is good thing to have per release. It help us in taking decision 
> of upreving u-boot (now or later). 
> 
> A suggestion, can we ask feature set details in every pull request from 
> sub-maintainers. 
> Or
> A blog can also be maintained, where sub-maintainer can write feature set per 
> pull request. 
> 
> Sub-maintainers have better idea what feature they are providing.  
> Feature set can also be published per sub-system (instead of pick and 
> choose).  

I think a short description in pull request can work. Parsing git log
doesn't have the weight on each commit. We don't need to know every
details of a platform fix, we care more on wider and bigger changes.

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


[U-Boot] [PATCH v7 07/13] mtd: uclass: add a generic 'mtdparts' parser

2018-08-31 Thread Miquel Raynal
The current parser is very specific to U-Boot mtdparts implementation.
It does not use MTD structures like mtd_info and mtd_partition. Copy
and adapt the current parser in drivers/mtd/mtd-uclass.c (to not break
the current use of mtdparts.c itself) and write some kind of a wrapper
around the current implementation to allow other commands to benefit
from this parsing in a user-friendly way.

This new function will allocate an mtd_partition array for each
successful call. This array must be freed after use by the caller.
The given 'mtdparts' buffer pointer will be moved forward to the next
MTD device (if any, it will point towards a '\0' character otherwise).

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
---
 drivers/mtd/mtdpart.c  | 187 +
 include/linux/mtd/partitions.h |   2 +
 2 files changed, 189 insertions(+)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 9ccb1b3361..d9708da2ae 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -76,6 +76,193 @@ char *kstrdup(const char *s, gfp_t gfp)
 }
 #endif
 
+#define MTD_SIZE_REMAINING (~0LLU)
+#define MTD_OFFSET_NOT_SPECIFIED   (~0LLU)
+
+/**
+ * mtd_parse_partition - Parse @mtdparts partition definition, fill @partition
+ *   with it and update the @mtdparts string pointer.
+ *
+ * The partition name is allocated and must be freed by the caller.
+ *
+ * This function is widely inspired from part_parse (mtdparts.c).
+ *
+ * @mtdparts: String describing the partition with mtdparts command syntax
+ * @partition: MTD partition structure to fill
+ *
+ * @return 0 on success, an error otherwise.
+ */
+static int mtd_parse_partition(const char **_mtdparts,
+  struct mtd_partition *partition)
+{
+   const char *mtdparts = *_mtdparts;
+   const char *name = NULL;
+   int name_len;
+   char *buf;
+
+   /* Ensure the partition structure is empty */
+   memset(partition, 0, sizeof(struct mtd_partition));
+
+   /* Fetch the partition size */
+   if (*mtdparts == '-') {
+   /* Assign all remaining space to this partition */
+   partition->size = MTD_SIZE_REMAINING;
+   mtdparts++;
+   } else {
+   partition->size = ustrtoull(mtdparts, (char **), 0);
+   if (partition->size < SZ_4K) {
+   printf("Minimum allowed partition size is 4kiB\n");
+   return -EINVAL;
+   }
+   }
+
+   /* Check for the offset */
+   partition->offset = MTD_OFFSET_NOT_SPECIFIED;
+   if (*mtdparts == '@') {
+   mtdparts++;
+   partition->offset = ustrtoull(mtdparts, (char **), 0);
+   }
+
+   /* Now look for the name */
+   if (*mtdparts == '(') {
+   name = ++mtdparts;
+   if ((mtdparts = strchr(name, ')')) == NULL) {
+   printf("No closing ')' found in partition name\n");
+   return -EINVAL;
+   }
+   name_len = mtdparts - name + 1;
+   if ((name_len - 1) == 0) {
+   printf("Empty partition name\n");
+   return -EINVAL;
+   }
+   mtdparts++;
+   } else {
+   /* Name will be of the form size@offset */
+   name_len = 22;
+   }
+
+   /* Check if the partition is read-only */
+   if (strncmp(mtdparts, "ro", 2) == 0) {
+   partition->mask_flags |= MTD_WRITEABLE;
+   mtdparts += 2;
+   }
+
+   /* Check for a potential next partition definition */
+   if (*mtdparts == ',') {
+   if (partition->size == MTD_SIZE_REMAINING) {
+   printf("No partitions allowed after a fill-up 
partition\n");
+   return -EINVAL;
+   }
+   ++mtdparts;
+   } else if (*mtdparts == ';') {
+   ++mtdparts;
+   } else if (*mtdparts == '\0') {
+   /* NOP */
+   } else {
+   printf("Unexpected character '%c' in mtdparts\n", *mtdparts);
+   return -EINVAL;
+   }
+
+   /*
+* Allocate a buffer for the name and either copy the provided name or
+* auto-generate it with the form 'size@offset'.
+*/
+   buf = malloc(name_len);
+   if (!buf)
+   return -ENOMEM;
+
+   if (name)
+   strncpy(buf, name, name_len - 1);
+   else
+   snprintf(buf, name_len, "0x%08llx@0x%08llx",
+partition->size, partition->offset);
+
+   buf[name_len - 1] = '\0';
+   partition->name = buf;
+
+   *_mtdparts = mtdparts;
+
+   return 0;
+}
+
+/**
+ * mtdparts_parse_part - Create a partition array from an mtdparts definition
+ *
+ * Stateless function that takes a @parent MTD device, a string @_mtdparts
+ * describing the partitions (with the 

[U-Boot] [PATCH v7 04/13] cmd: mtdparts: accept spi-nand devices

2018-08-31 Thread Miquel Raynal
Let spi-nand devices be recognized by mtdparts. This is superfluous
but a full mtdparts rework would be very time-consuming.

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
Reviewed-by: Boris Brezillon 
---
 cmd/mtdparts.c  | 13 -
 include/jffs2/load_kernel.h |  7 +--
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index 756fc6018f..2e547894c6 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -37,7 +37,7 @@
  * mtdids=[,,...]
  *
  * := =
- *:= 'nand'|'nor'|'onenand'
+ *:= 'nand'|'nor'|'onenand'|'spi-nand'
  *   := mtd device number, 0...
  *:= unique device tag used by linux kernel to find mtd device 
(mtd->name)
  *
@@ -339,7 +339,7 @@ static int part_validate_eraseblock(struct mtdids *id, 
struct part_info *part)
 
if (!mtd->numeraseregions) {
/*
-* Only one eraseregion (NAND, OneNAND or uniform NOR),
+* Only one eraseregion (NAND, SPI-NAND, OneNAND or uniform 
NOR),
 * checking for alignment is easy here
 */
offset = part->offset;
@@ -1030,7 +1030,7 @@ static struct mtdids* id_find_by_mtd_id(const char 
*mtd_id, unsigned int mtd_id_
 }
 
 /**
- * Parse device id string  := 'nand'|'nor'|'onenand',
+ * Parse device id string  := 
'nand'|'nor'|'onenand'|'spi-nand',
  * return device type and number.
  *
  * @param id string describing device id
@@ -1054,6 +1054,9 @@ int mtd_id_parse(const char *id, const char **ret_id, u8 
*dev_type,
} else if (strncmp(p, "onenand", 7) == 0) {
*dev_type = MTD_DEV_TYPE_ONENAND;
p += 7;
+   } else if (strncmp(p, "spi-nand", 8) == 0) {
+   *dev_type = MTD_DEV_TYPE_SPINAND;
+   p += 8;
} else {
printf("incorrect device type in %s\n", id);
return 1;
@@ -1636,7 +1639,7 @@ static int parse_mtdids(const char *const ids)
while(p && (*p != '\0')) {
 
ret = 1;
-   /* parse 'nor'|'nand'|'onenand' */
+   /* parse 'nor'|'nand'|'onenand'|'spi-nand' */
if (mtd_id_parse(p, , , ) != 0)
break;
 
@@ -2112,7 +2115,7 @@ static char mtdparts_help_text[] =
"'mtdids' - linux kernel mtd device id <-> u-boot device id mapping\n\n"
"mtdids=[,,...]\n\n"
":= =\n"
-   "   := 'nand'|'nor'|'onenand'\n"
+   "   := 'nand'|'nor'|'onenand'|'spi-nand'\n"
"  := mtd device number, 0...\n"
"   := unique device tag used by linux kernel to find mtd 
device (mtd->name)\n\n"
"'mtdparts' - partition list\n\n"
diff --git a/include/jffs2/load_kernel.h b/include/jffs2/load_kernel.h
index 1ddff062ad..9346d7ee9f 100644
--- a/include/jffs2/load_kernel.h
+++ b/include/jffs2/load_kernel.h
@@ -15,9 +15,12 @@
 #define MTD_DEV_TYPE_NOR   0x0001
 #define MTD_DEV_TYPE_NAND  0x0002
 #define MTD_DEV_TYPE_ONENAND   0x0004
+#define MTD_DEV_TYPE_SPINAND   0x0008
 
-#define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" : \
-   (type == MTD_DEV_TYPE_ONENAND) ? "onenand" : "nor")
+#define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" :   \
+   (type == MTD_DEV_TYPE_NOR ? "nor" : \
+(type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
+ "spi-nand"))) \
 
 struct mtd_device {
struct list_head link;
-- 
2.17.1

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


[U-Boot] [PATCH v7 12/13] cmd: ubi: clean the partition handling

2018-08-31 Thread Miquel Raynal
UBI should not mess with MTD partitions, now that the partitions are
handled in a clean way, clean the ubi command and avoid using this
uneeded extra-glue to reference the devices.

Signed-off-by: Miquel Raynal 
---
 cmd/Kconfig |   2 ++
 cmd/ubi.c   | 100 +++-
 2 files changed, 31 insertions(+), 71 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 0778d2ecff..4deec0b238 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1815,6 +1815,8 @@ config CMD_UBI
  capabilities. Please, consult the MTD web site for more details
  (www.linux-mtd.infradead.org). Activate this option if you want
  to use U-Boot UBI commands.
+ It is also strongly encouraged to also enable CONFIG_MTD to get full
+ partition support.
 
 config CMD_UBIFS
tristate "Enable UBIFS - Unsorted block images filesystem commands"
diff --git a/cmd/ubi.c b/cmd/ubi.c
index 0a3405a3b1..af0cea2ca5 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -15,6 +15,9 @@
 #include 
 #include 
 #include 
+#if defined(CONFIG_MTD)
+#include 
+#endif
 #include 
 #include 
 #include 
@@ -29,17 +32,6 @@
 
 /* Private own data */
 static struct ubi_device *ubi;
-static char buffer[80];
-static int ubi_initialized;
-
-struct selected_dev {
-   char part_name[80];
-   int selected;
-   int nr;
-   struct mtd_info *mtd_info;
-};
-
-static struct selected_dev ubi_dev;
 
 #ifdef CONFIG_CMD_UBIFS
 int ubifs_is_mounted(void);
@@ -404,43 +396,24 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
return err;
 }
 
-static int ubi_dev_scan(struct mtd_info *info, char *ubidev,
-   const char *vid_header_offset)
+static int ubi_dev_scan(struct mtd_info *info, const char *vid_header_offset)
 {
-   struct mtd_device *dev;
-   struct part_info *part;
-   struct mtd_partition mtd_part;
char ubi_mtd_param_buffer[80];
-   u8 pnum;
int err;
 
-   if (find_dev_and_part(ubidev, , , ) != 0)
-   return 1;
+   if (!vid_header_offset)
+   sprintf(ubi_mtd_param_buffer, "%s", info->name);
+   else
+   sprintf(ubi_mtd_param_buffer, "%s,%s", info->name,
+   vid_header_offset);
 
-   sprintf(buffer, "mtd=%d", pnum);
-   memset(_part, 0, sizeof(mtd_part));
-   mtd_part.name = buffer;
-   mtd_part.size = part->size;
-   mtd_part.offset = part->offset;
-   add_mtd_partitions(info, _part, 1);
-
-   strcpy(ubi_mtd_param_buffer, buffer);
-   if (vid_header_offset)
-   sprintf(ubi_mtd_param_buffer, "mtd=%d,%s", pnum,
-   vid_header_offset);
err = ubi_mtd_param_parse(ubi_mtd_param_buffer, NULL);
-   if (err) {
-   del_mtd_partitions(info);
+   if (err)
return -err;
-   }
 
err = ubi_init();
-   if (err) {
-   del_mtd_partitions(info);
+   if (err)
return -err;
-   }
-
-   ubi_initialized = 1;
 
return 0;
 }
@@ -465,50 +438,35 @@ int ubi_detach(void)
/*
 * Call ubi_exit() before re-initializing the UBI subsystem
 */
-   if (ubi_initialized) {
+   if (ubi)
ubi_exit();
-   del_mtd_partitions(ubi_dev.mtd_info);
-   ubi_initialized = 0;
-   }
 
-   ubi_dev.selected = 0;
+   ubi = NULL;
+
return 0;
 }
 
 int ubi_part(char *part_name, const char *vid_header_offset)
 {
+   struct mtd_info *mtd;
int err = 0;
-   char mtd_dev[16];
-   struct mtd_device *dev;
-   struct part_info *part;
-   u8 pnum;
 
ubi_detach();
-   /*
-* Search the mtd device number where this partition
-* is located
-*/
-   if (find_dev_and_part(part_name, , , )) {
+
+#ifdef CONFIG_MTD
+   mtd_probe_devices();
+#endif
+   mtd = get_mtd_device_nm(part_name);
+   if (IS_ERR(mtd)) {
printf("Partition %s not found!\n", part_name);
return 1;
}
-   sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(dev->id->type), dev->id->num);
-   ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev);
-   if (IS_ERR(ubi_dev.mtd_info)) {
-   printf("Partition %s not found on device %s!\n", part_name,
-  mtd_dev);
-   return 1;
-   }
+   put_mtd_device(mtd);
 
-   ubi_dev.selected = 1;
-
-   strcpy(ubi_dev.part_name, part_name);
-   err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name,
-   vid_header_offset);
+   err = ubi_dev_scan(mtd, vid_header_offset);
if (err) {
printf("UBI init error %d\n", err);
printf("Please check, if the correct MTD partition is used 
(size big enough?)\n");
-   ubi_dev.selected = 0;
return err;
}
 
@@ -539,13 +497,13 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, 

[U-Boot] [PATCH v7 10/13] cmd: mtd: add 'mtd' command

2018-08-31 Thread Miquel Raynal
There should not be a 'nand' command, a 'sf' command and certainly not
a new 'spi-nand' command. Write a 'mtd' command instead to manage all
MTD devices/partitions at once. This should be the preferred way to
access any MTD device.

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
---
 cmd/Kconfig  |  10 +-
 cmd/Makefile |   1 +
 cmd/mtd.c| 517 +++
 drivers/mtd/Makefile |   2 +-
 include/mtd.h|   1 +
 5 files changed, 528 insertions(+), 3 deletions(-)
 create mode 100644 cmd/mtd.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index ef43ed8dda..0778d2ecff 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -847,6 +847,12 @@ config CMD_MMC_SWRITE
  Enable support for the "mmc swrite" command to write Android sparse
  images to eMMC.
 
+config CMD_MTD
+   bool "mtd"
+   select MTD_PARTITIONS
+   help
+ MTD commands support.
+
 config CMD_NAND
bool "nand"
default y if NAND_SUNXI
@@ -1671,14 +1677,14 @@ config CMD_MTDPARTS
 
 config MTDIDS_DEFAULT
string "Default MTD IDs"
-   depends on CMD_MTDPARTS || CMD_NAND || CMD_FLASH
+   depends on CMD_MTD || CMD_MTDPARTS || CMD_NAND || CMD_FLASH
help
  Defines a default MTD IDs list for use with MTD partitions in the
  Linux MTD command line partitions format.
 
 config MTDPARTS_DEFAULT
string "Default MTD partition scheme"
-   depends on CMD_MTDPARTS || CMD_NAND || CMD_FLASH
+   depends on CMD_MTD || CMD_MTDPARTS || CMD_NAND || CMD_FLASH
help
  Defines a default MTD partitioning scheme in the Linux MTD command
  line partitions format
diff --git a/cmd/Makefile b/cmd/Makefile
index 323f1fd2c7..32fd102189 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -90,6 +90,7 @@ obj-$(CONFIG_CMD_MISC) += misc.o
 obj-$(CONFIG_CMD_MMC) += mmc.o
 obj-$(CONFIG_CMD_MMC_SPI) += mmc_spi.o
 obj-$(CONFIG_MP) += mp.o
+obj-$(CONFIG_CMD_MTD) += mtd.o
 obj-$(CONFIG_CMD_MTDPARTS) += mtdparts.o
 obj-$(CONFIG_CMD_NAND) += nand.o
 obj-$(CONFIG_CMD_NET) += net.o
diff --git a/cmd/mtd.c b/cmd/mtd.c
new file mode 100644
index 00..32295fe86c
--- /dev/null
+++ b/cmd/mtd.c
@@ -0,0 +1,517 @@
+// SPDX-License-Identifier:  GPL-2.0+
+/*
+ * mtd.c
+ *
+ * Generic command to handle basic operations on any memory device.
+ *
+ * Copyright: Bootlin, 2018
+ * Author: Miquèl Raynal 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MTD_NAME_MAX_LEN 20
+
+static char *old_mtdparts;
+
+static void mtd_dump_buf(u8 *buf, uint len, uint offset)
+{
+   int i, j;
+
+   for (i = 0; i < len; ) {
+   printf("0x%08x:\t", offset + i);
+   for (j = 0; j < 8; j++)
+   printf("%02x ", buf[i + j]);
+   printf(" ");
+   i += 8;
+   for (j = 0; j < 8; j++)
+   printf("%02x ", buf[i + j]);
+   printf("\n");
+   i += 8;
+   }
+}
+
+static void mtd_show_parts(struct mtd_info *mtd, int level)
+{
+   struct mtd_info *part;
+   int i;
+
+   if (list_empty(>partitions))
+   return;
+
+   list_for_each_entry(part, >partitions, node) {
+   for (i = 0; i < level; i++)
+   printf("\t");
+   printf("* %s\n", part->name);
+   for (i = 0; i < level; i++)
+   printf("\t");
+   printf("  > Offset: 0x%llx bytes\n", part->offset);
+   for (i = 0; i < level; i++)
+   printf("\t");
+   printf("  > Size: 0x%llx bytes\n", part->size);
+
+   mtd_show_parts(part, level + 1);
+   }
+}
+
+static void mtd_show_device(struct mtd_info *mtd)
+{
+   /* Device */
+   printf("* %s", mtd->name);
+   if (mtd->dev)
+   printf(" [device: %s] [parent: %s] [driver: %s]",
+  mtd->dev->name, mtd->dev->parent->name,
+  mtd->dev->driver->name);
+   printf("\n");
+
+   /* MTD device information */
+   printf("  > type: ");
+   switch (mtd->type) {
+   case MTD_RAM:
+   printf("RAM\n");
+   break;
+   case MTD_ROM:
+   printf("ROM\n");
+   break;
+   case MTD_NORFLASH:
+   printf("NOR flash\n");
+   break;
+   case MTD_NANDFLASH:
+   printf("NAND flash\n");
+   break;
+   case MTD_DATAFLASH:
+   printf("Data flash\n");
+   break;
+   case MTD_UBIVOLUME:
+   printf("UBI volume\n");
+   break;
+   case MTD_MLCNANDFLASH:
+   printf("MLC NAND flash\n");
+   break;
+   case MTD_ABSENT:
+   default:
+   printf("Unknown\n");
+   break;
+   }
+
+   printf("  > Size: 0x%llx bytes\n", 

[U-Boot] [PATCH v7 11/13] cmd: mtdparts: try to probe the MTD devices as a fallback

2018-08-31 Thread Miquel Raynal
Current implementation of mtdparts command errors out if the desired MTD
device is not found. Fallback to the new probe function in this case
before erroring out.

This will the save the user the need to call something like 'mtd list'
before mtdparts.

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
---
 cmd/mtdparts.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index f7ed1a0779..a1102c3fc5 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -79,6 +79,10 @@
 #include 
 #include 
 
+#if defined(CONFIG_MTD)
+#include 
+#endif
+
 #if defined(CONFIG_CMD_NAND)
 #include 
 #include 
@@ -307,9 +311,15 @@ static int get_mtd_info(u8 type, u8 num, struct mtd_info 
**mtd)
 
sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(type), num);
*mtd = get_mtd_device_nm(mtd_dev);
-   if (IS_ERR(*mtd)) {
-   printf("Device %s not found!\n", mtd_dev);
-   return 1;
+   if (IS_ERR_OR_NULL(*mtd)) {
+#ifdef CONFIG_MTD
+   mtd_probe_devices();
+   *mtd = get_mtd_device_nm(mtd_dev);
+#endif
+   if (IS_ERR_OR_NULL(*mtd)) {
+   printf("Device %s not found!\n", mtd_dev);
+   return 1;
+   }
}
put_mtd_device(*mtd);
 
-- 
2.17.1

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


[U-Boot] [PATCH v7 05/13] cmd: mtdparts: remove mandatory 'mtdparts=' prefix

2018-08-31 Thread Miquel Raynal
All U-Boot users must define the mtdparts environment variable with:
setenv mtdparts mtdparts=...

While this may ease the partition declaration job to be passed to
Linux, this is a pure software limitation and forcing this prefix is a
complete non-sense. Let the user to declare manually the mtdparts
variable without the prefix.

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
---
 cmd/mtdparts.c | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index 2e547894c6..f7ed1a0779 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -44,7 +44,7 @@
  *
  * 'mtdparts' - partition list
  *
- * mtdparts=mtdparts=[;...]
+ * mtdparts=[mtdparts=][;...]
  *
  *   := :[,...]
  *:= unique device tag used by linux kernel to find mtd device 
(mtd->name)
@@ -62,11 +62,11 @@
  *
  * 1 NOR Flash, with 1 single writable partition:
  * mtdids=nor0=edb7312-nor
- * mtdparts=mtdparts=edb7312-nor:-
+ * mtdparts=[mtdparts=]edb7312-nor:-
  *
  * 1 NOR Flash with 2 partitions, 1 NAND with one
  * mtdids=nor0=edb7312-nor,nand0=edb7312-nand
- * mtdparts=mtdparts=edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home)
+ * mtdparts=[mtdparts=]edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home)
  *
  */
 
@@ -1099,9 +1099,6 @@ static int generate_mtdparts(char *buf, u32 buflen)
return 0;
}
 
-   strcpy(p, "mtdparts=");
-   p += 9;
-
list_for_each(dentry, ) {
dev = list_entry(dentry, struct mtd_device, link);
 
@@ -1572,11 +1569,9 @@ static int parse_mtdparts(const char *const mtdparts)
if (!p)
p = mtdparts;
 
-   if (strncmp(p, "mtdparts=", 9) != 0) {
-   printf("mtdparts variable doesn't start with 'mtdparts='\n");
-   return err;
-   }
-   p += 9;
+   /* Skip the useless prefix, if any */
+   if (strncmp(p, "mtdparts=", 9) == 0)
+   p += 9;
 
while (*p != '\0') {
err = 1;
-- 
2.17.1

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


[U-Boot] [PATCH v7 09/13] mtd: mtdpart: implement proper partition handling

2018-08-31 Thread Miquel Raynal
Instead of collecting partitions in a flat list, create a hierarchy
within the mtd_info structure: use a partitions list to keep track of
the partitions of an MTD device (which might be itself a partition of
another MTD device), a pointer to the parent device (NULL when the MTD
device is the root one, not a partition).

By also saving directly in mtd_info the offset of the partition, we
can get rid of the mtd_part structure.

Signed-off-by: Miquel Raynal 
---
 drivers/mtd/mtdcore.c  |   2 +
 drivers/mtd/mtdpart.c  | 412 ++---
 include/linux/mtd/mtd.h|  31 +++
 include/linux/mtd/partitions.h |   1 -
 4 files changed, 208 insertions(+), 238 deletions(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index fb1d68d5e2..fb6c779abb 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -426,6 +426,8 @@ int add_mtd_device(struct mtd_info *mtd)
mtd->index = i;
mtd->usecount = 0;
 
+   INIT_LIST_HEAD(>partitions);
+
/* default value if not set by driver */
if (mtd->bitflip_threshold == 0)
mtd->bitflip_threshold = mtd->ecc_strength;
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 096351e48b..afc02dcb24 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -29,29 +29,12 @@
 
 #include "mtdcore.h"
 
-/* Our partition linked list */
-static LIST_HEAD(mtd_partitions);
 #ifndef __UBOOT__
 static DEFINE_MUTEX(mtd_partitions_mutex);
 #else
 DEFINE_MUTEX(mtd_partitions_mutex);
 #endif
 
-/* Our partition node structure */
-struct mtd_part {
-   struct mtd_info mtd;
-   struct mtd_info *master;
-   uint64_t offset;
-   struct list_head list;
-};
-
-/*
- * Given a pointer to the MTD object in the mtd_part structure, we can retrieve
- * the pointer to that structure with this macro.
- */
-#define PART(x)  ((struct mtd_part *)(x))
-
-
 #ifdef __UBOOT__
 /* from mm/util.c */
 
@@ -333,19 +316,18 @@ int mtd_search_alternate_name(const char *mtdname, char 
*altname,
 static int part_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf)
 {
-   struct mtd_part *part = PART(mtd);
struct mtd_ecc_stats stats;
int res;
 
-   stats = part->master->ecc_stats;
-   res = part->master->_read(part->master, from + part->offset, len,
- retlen, buf);
+   stats = mtd->parent->ecc_stats;
+   res = mtd->parent->_read(mtd->parent, from + mtd->offset, len,
+retlen, buf);
if (unlikely(mtd_is_eccerr(res)))
mtd->ecc_stats.failed +=
-   part->master->ecc_stats.failed - stats.failed;
+   mtd->parent->ecc_stats.failed - stats.failed;
else
mtd->ecc_stats.corrected +=
-   part->master->ecc_stats.corrected - stats.corrected;
+   mtd->parent->ecc_stats.corrected - stats.corrected;
return res;
 }
 
@@ -353,17 +335,13 @@ static int part_read(struct mtd_info *mtd, loff_t from, 
size_t len,
 static int part_point(struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, void **virt, resource_size_t *phys)
 {
-   struct mtd_part *part = PART(mtd);
-
-   return part->master->_point(part->master, from + part->offset, len,
-   retlen, virt, phys);
+   return mtd->parent->_point(mtd->parent, from + mtd->offset, len,
+  retlen, virt, phys);
 }
 
 static int part_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
 {
-   struct mtd_part *part = PART(mtd);
-
-   return part->master->_unpoint(part->master, from + part->offset, len);
+   return mtd->parent->_unpoint(mtd->parent, from + mtd->offset, len);
 }
 #endif
 
@@ -372,17 +350,13 @@ static unsigned long part_get_unmapped_area(struct 
mtd_info *mtd,
unsigned long offset,
unsigned long flags)
 {
-   struct mtd_part *part = PART(mtd);
-
-   offset += part->offset;
-   return part->master->_get_unmapped_area(part->master, len, offset,
-   flags);
+   offset += mtd->offset;
+   return mtd->parent->_get_unmapped_area(mtd->parent, len, offset, flags);
 }
 
 static int part_read_oob(struct mtd_info *mtd, loff_t from,
struct mtd_oob_ops *ops)
 {
-   struct mtd_part *part = PART(mtd);
int res;
 
if (from >= mtd->size)
@@ -407,7 +381,7 @@ static int part_read_oob(struct mtd_info *mtd, loff_t from,
return -EINVAL;
}
 
-   res = part->master->_read_oob(part->master, from + part->offset, ops);
+   res = mtd->parent->_read_oob(mtd->parent, from + mtd->offset, ops);
if (unlikely(res)) {
if (mtd_is_bitflip(res))
  

[U-Boot] [PATCH v7 08/13] mtd: uclass: search for an equivalent MTD name with the mtdids

2018-08-31 Thread Miquel Raynal
Using an MTD device (resp. partition) name in mtdparts is simple and
straightforward. However, for a long time already, another name was
given in mtdparts to indicate a device (resp. partition) so the
"mtdids" environment variable was created to do the match.

Let's create a function that, from an MTD device (resp. partition)
name, search for the equivalent name in the "mtdparts" environment
variable thanks to the "mtdids" string.

Signed-off-by: Miquel Raynal 
---
 drivers/mtd/mtdpart.c  | 62 ++
 include/linux/mtd/partitions.h |  2 ++
 2 files changed, 64 insertions(+)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index d9708da2ae..096351e48b 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -263,6 +263,68 @@ int mtd_parse_partitions(struct mtd_info *parent, const 
char **_mtdparts,
return 0;
 }
 
+/**
+ * mtd_search_alternate_name - Search an alternate name for @mtdname thanks to
+ * the mtdids legacy environment variable.
+ *
+ * The mtdids string is a list of comma-separated 'dev_id=mtd_id' tupples.
+ * Check if one of the mtd_id matches mtdname, in this case save dev_id in
+ * altname.
+ *
+ * @mtdname: Current MTD device name
+ * @altname: Alternate name to return
+ * @max_len: Length of the alternate name buffer
+ *
+ * @return 0 on success, an error otherwise.
+ */
+int mtd_search_alternate_name(const char *mtdname, char *altname,
+ unsigned int max_len)
+{
+   const char *mtdids, *equal, *comma, *dev_id, *mtd_id;
+   int dev_id_len, mtd_id_len;
+
+   mtdids = env_get("mtdids");
+   if (!mtdids)
+   return -EINVAL;
+
+   do {
+   /* Find the '=' sign */
+   dev_id = mtdids;
+   equal = strchr(dev_id, '=');
+   if (!equal)
+   break;
+
+   dev_id_len = equal - mtdids;
+   mtd_id = equal + 1;
+
+   /* Find the end of the tupple */
+   comma = strchr(mtdids, ',');
+   if (comma)
+   mtd_id_len = comma - equal;
+   else
+   mtd_id_len = [strlen(mtdids)] - equal;
+
+   if (!dev_id_len || !mtd_id_len)
+   return -EINVAL;
+
+   if (dev_id_len + 1 > max_len)
+   continue;
+
+   /* Compare the name we search with the current mtd_id */
+   if (!strncmp(mtdname, mtd_id, mtd_id_len)) {
+   strncpy(altname, dev_id, dev_id_len);
+   altname[dev_id_len] = 0;
+
+   return 0;
+   }
+
+   /* Go to the next tupple */
+   mtdids = comma + 1;
+   } while (comma);
+
+   return -EINVAL;
+}
+
 /*
  * MTD methods which simply translate the effective address and pass through
  * to the _real_ device.
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index ed4ece5e13..082a4966ea 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -88,5 +88,7 @@ int mtd_del_partition(struct mtd_info *master, int partno);
 uint64_t mtd_get_device_size(const struct mtd_info *mtd);
 int mtd_parse_partitions(struct mtd_info *parent, const char **_mtdparts,
 struct mtd_partition **_parts, int *_nb_parts);
+int mtd_search_alternate_name(const char *mtdname, char *altname,
+ unsigned int max_len);
 
 #endif
-- 
2.17.1

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


[U-Boot] [PATCH v7 06/13] mtd: uclass: add probe function

2018-08-31 Thread Miquel Raynal
The user might want to trigger the probe of any MTD device, export these
functions so they can be called from a command source file.

Signed-off-by: Miquel Raynal 
Acked-by: Jagan Teki 
---
 drivers/mtd/mtd-uclass.c | 16 
 include/mtd.h|  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/mtd/mtd-uclass.c b/drivers/mtd/mtd-uclass.c
index 9ca049c437..5418217431 100644
--- a/drivers/mtd/mtd-uclass.c
+++ b/drivers/mtd/mtd-uclass.c
@@ -5,9 +5,25 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+/**
+ * mtd_probe - Probe the device @dev if not already done
+ *
+ * @dev: U-Boot device to probe
+ *
+ * @return 0 on success, an error otherwise.
+ */
+int mtd_probe(struct udevice *dev)
+{
+   if (device_active(dev))
+   return 0;
+
+   return device_probe(dev);
+}
+
 /*
  * Implement a MTD uclass which should include most flash drivers.
  * The uclass private is pointed to mtd_info.
diff --git a/include/mtd.h b/include/mtd.h
index 548e7f191b..6e6da3002f 100644
--- a/include/mtd.h
+++ b/include/mtd.h
@@ -19,4 +19,6 @@ static inline struct mtd_info *mtd_get_info(struct udevice 
*dev)
return dev_get_uclass_priv(dev);
 }
 
+int mtd_probe(struct udevice *dev);
+
 #endif /* _MTD_H_ */
-- 
2.17.1

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


[U-Boot] [PATCH v7 13/13] cmd: mtdparts: describe as legacy

2018-08-31 Thread Miquel Raynal
The 'mtdparts' command is not needed anymore. While the environment
variable is still valid (and useful), the command has been replaced by
'mtd' which is much more close to the MTD stack and do not add its own
specific glue. The 'mtdids' variable, only used by the 'mtdparts'
command is also useless if the right MTD device name is used in the
'mtdparts' variable.

Signed-off-by: Miquel Raynal 
---
 cmd/Kconfig | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 4deec0b238..0786663f4a 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1673,7 +1673,11 @@ config CMD_MTDPARTS
bool "MTD partition support"
select MTD_DEVICE if (CMD_NAND || NAND)
help
- MTD partition support
+ MTD partitioning tool support.
+ It is strongly encouraged to avoid using this command
+ anymore. One can still declare the partitions in the
+ mtdparts environment variable but better use the MTD stack
+ and the mtd command instead than this one.
 
 config MTDIDS_DEFAULT
string "Default MTD IDs"
@@ -1681,6 +1685,10 @@ config MTDIDS_DEFAULT
help
  Defines a default MTD IDs list for use with MTD partitions in the
  Linux MTD command line partitions format.
+ Declaration of this environment variable is not useful
+ anymore when using the right MTD names in mtdparts along
+ with the use of the 'mtd' command instead of the legacy
+ 'mtdparts'.
 
 config MTDPARTS_DEFAULT
string "Default MTD partition scheme"
-- 
2.17.1

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


[U-Boot] [PATCH v7 02/13] lib: strto: fix metric suffix parsing in strtoul[l]

2018-08-31 Thread Miquel Raynal
While 1kB or 1kiB will be parsed correctly, 1k will return the right
amount, but the metric suffix will not be escaped once the char
pointer updated. Fix this situation by simplifying the move of the
endp pointer.

Signed-off-by: Miquel Raynal 
---
 lib/strto.c | 22 ++
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/lib/strto.c b/lib/strto.c
index 84f8d92d57..502a0153e7 100644
--- a/lib/strto.c
+++ b/lib/strto.c
@@ -97,12 +97,11 @@ unsigned long ustrtoul(const char *cp, char **endp, 
unsigned int base)
case 'K':
case 'k':
result *= 1024;
-   if ((*endp)[1] == 'i') {
-   if ((*endp)[2] == 'B')
-   (*endp) += 3;
-   else
-   (*endp) += 2;
-   }
+   (*endp)++;
+   if (**endp == 'i')
+   (*endp)++;
+   if (**endp == 'B')
+   (*endp)++;
}
return result;
 }
@@ -122,12 +121,11 @@ unsigned long long ustrtoull(const char *cp, char **endp, 
unsigned int base)
case 'K':
case 'k':
result *= 1024;
-   if ((*endp)[1] == 'i') {
-   if ((*endp)[2] == 'B')
-   (*endp) += 3;
-   else
-   (*endp) += 2;
-   }
+   (*endp)++;
+   if (**endp == 'i')
+   (*endp)++;
+   if (**endp == 'B')
+   (*endp)++;
}
return result;
 }
-- 
2.17.1

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


[U-Boot] [PATCH v7 01/13] lib: strto: parse all lowercase metric prefixes in ustrtoul[l]

2018-08-31 Thread Miquel Raynal
Both ustrtoul and ustrtoull interpret 1k but not 1m or 1g. Even if the
SI symbols for Mega and Giga are 'M' and 'G', certain entries of
eg. mtdparts also use (wrongly) the metric prefix 'm' and 'g'.

I do not see how parsing lowercase prefixes could break anything, so
parse them like their uppercase counterpart.

Signed-off-by: Miquel Raynal 
---
 lib/strto.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/strto.c b/lib/strto.c
index 7f6076909a..84f8d92d57 100644
--- a/lib/strto.c
+++ b/lib/strto.c
@@ -87,9 +87,11 @@ unsigned long ustrtoul(const char *cp, char **endp, unsigned 
int base)
unsigned long result = simple_strtoul(cp, endp, base);
switch (**endp) {
case 'G':
+   case 'g':
result *= 1024;
/* fall through */
case 'M':
+   case 'm':
result *= 1024;
/* fall through */
case 'K':
@@ -110,9 +112,11 @@ unsigned long long ustrtoull(const char *cp, char **endp, 
unsigned int base)
unsigned long long result = simple_strtoull(cp, endp, base);
switch (**endp) {
case 'G':
+   case 'g':
result *= 1024;
/* fall through */
case 'M':
+   case 'm':
result *= 1024;
/* fall through */
case 'K':
-- 
2.17.1

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


[U-Boot] [PATCH v7 03/13] mtd: Kconfig: remove MTD_PARTITIONS duplicated symbol

2018-08-31 Thread Miquel Raynal
MTD_PARTITIONS is declared twice. Remove the redundant entry with no
help associated.

Signed-off-by: Miquel Raynal 
---
 drivers/mtd/Kconfig | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index d98457e223..9341d518f3 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -1,8 +1,5 @@
 menu "MTD Support"
 
-config MTD_PARTITIONS
-   bool
-
 config MTD
bool "Enable Driver Model for MTD drivers"
depends on DM
-- 
2.17.1

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


[U-Boot] [PATCH v7 00/13] Cleaner MTD devices management

2018-08-31 Thread Miquel Raynal
The introduction of the SPI-NAND framework and, more widely, the
support of non parallel-NOR, parallel-NAND and SPI-NOR has shown that
extending U-Boot MTD devices/partitions handling was not
straightforward at all. While this first series [1] is a great step
forward, it is not actually usable due to purely software
limitations.

This series intends to:
* Do some cleanup in the MTD layer
* Add a new 'mtd' command that should replace in the future all the
  MTD-specific commands like 'nand' and 'sf'.
* Make deep changes in the partition handling by introducing a new way
  of managing MTD partitions (that soon will be also sent to the Linux
  kernel), and adding a generic 'mtdparts' environment variable parser
  in prevision of the 'mtdparts' command removal.
* The UBI command is also updated to stop messing with partitions that
  should just be declared in the 'mtdparts' variable.

People can now do the following without 'mtdids':
# setenv mtdparts "nor0=1m(some),-(more);spi-nand0=-(all)"

Partitions are visible with:
# mtd list

And UBI support is available with (for the above example):
# ubi part all

At least these two missing features will be added with further changes:
* 'mtd write' on NANDs should use by default the trimffs option (to
  avoid writing empty pages).
* 'nand bad' is a great way to know the list of detected bad-blocks
  and could be implemented in 'mtd'.

Of course, this series only applies on top of [1].

[1] https://lists.denx.de/pipermail/u-boot/2018-August/336780.html


Thanks,
Miquèl


Miquel Raynal (13):
  lib: strto: parse all lowercase metric prefixes in ustrtoul[l]
  lib: strto: fix metric suffix parsing in strtoul[l]
  mtd: Kconfig: remove MTD_PARTITIONS duplicated symbol
  cmd: mtdparts: accept spi-nand devices
  cmd: mtdparts: remove mandatory 'mtdparts=' prefix
  mtd: uclass: add probe function
  mtd: uclass: add a generic 'mtdparts' parser
  mtd: uclass: search for an equivalent MTD name with the mtdids
  mtd: mtdpart: implement proper partition handling
  cmd: mtd: add 'mtd' command
  cmd: mtdparts: try to probe the MTD devices as a fallback
  cmd: ubi: clean the partition handling
  cmd: mtdparts: describe as legacy

 cmd/Kconfig|  22 +-
 cmd/Makefile   |   1 +
 cmd/mtd.c  | 517 ++
 cmd/mtdparts.c |  46 ++-
 cmd/ubi.c  | 100 ++---
 drivers/mtd/Kconfig|   3 -
 drivers/mtd/Makefile   |   2 +-
 drivers/mtd/mtd-uclass.c   |  16 +
 drivers/mtd/mtdcore.c  |   2 +
 drivers/mtd/mtdpart.c  | 661 +
 include/jffs2/load_kernel.h|   7 +-
 include/linux/mtd/mtd.h|  31 ++
 include/linux/mtd/partitions.h |   5 +-
 include/mtd.h  |   3 +
 lib/strto.c|  26 +-
 15 files changed, 1093 insertions(+), 349 deletions(-)
 create mode 100644 cmd/mtd.c

-- 
2.17.1

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


[U-Boot] [PATCH v2 3/3] arm: spear: fix enabling of SSP2 clock

2018-08-31 Thread Quentin Schulz
The SSP2 clock is at bit 6 in the register, so the value is 0x40 unlike
the current 0x70 which enables the clock of UART2, SSP1 and SSP2.

Signed-off-by: Quentin Schulz 
---

added in v2

@Stefan: I think you'd want to test the FPGA on x600 again as it's using
this constant. Having worked on a system close to the x600, I'm guessing
that it'll work as fine as on my platform with this patch but better be
sure than sorry.

 arch/arm/include/asm/arch-spear/spr_misc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-spear/spr_misc.h 
b/arch/arm/include/asm/arch-spear/spr_misc.h
index 01b4b2b..0171119 100644
--- a/arch/arm/include/asm/arch-spear/spr_misc.h
+++ b/arch/arm/include/asm/arch-spear/spr_misc.h
@@ -151,7 +151,7 @@ struct misc_regs {
 #define MISC_GPT2ENB   0x0800
 #define MISC_FSMCENB   0x0200
 #define MISC_I2CENB0x0080
-#define MISC_SSP2ENB   0x0070
+#define MISC_SSP2ENB   0x0040
 #define MISC_SSP1ENB   0x0020
 #define MISC_UART0ENB  0x0008
 
-- 
git-series 0.9.1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 1/3] spi: add support for ARM PL022 SPI controller

2018-08-31 Thread Quentin Schulz
This adds support for the ARM PL022 SPI controller for the standard
variant (0x00041022) which has a 16bit wide and 8 locations deep TX/RX
FIFO.

A few parts were borrowed from the Linux kernel driver.

Cc: Armando Visconti 
Cc: Vipin Kumar 
Signed-off-by: Quentin Schulz 
---

v2:
  - move header file to include/dm/platform_data,
  - replace REGA(x) by x + REGA,
  - surround DT specific code with #define !defined(CONFIG_OF_PLATDATA),
  - fix tmp speed being stored in a u16 which overflowed and returned the
  minimum possible rate,
  - fix speed computation to be the closest to the requested value, not
  only the closest *below* this value,
  - init best_* values so that they can safely be used even if no best
  value is found,
  - flush FIFO RX queue after the controller is enabled makes more sense
  to me,

 drivers/spi/Kconfig  |   8 +-
 drivers/spi/Makefile |   1 +-
 drivers/spi/pl022_spi.c  | 338 -
 include/dm/platform_data/pl022_spi.h |  28 ++-
 4 files changed, 375 insertions(+)
 create mode 100644 drivers/spi/pl022_spi.c
 create mode 100644 include/dm/platform_data/pl022_spi.h

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index dcd719f..7d4d47d 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -125,6 +125,14 @@ config PIC32_SPI
  to access the SPI NOR flash, MMC-over-SPI on platforms based on
  Microchip PIC32 family devices.
 
+config PL022_SPI
+   bool "ARM AMBA PL022 SSP controller driver"
+   depends on ARM
+   help
+ This selects the ARM(R) AMBA(R) PrimeCell PL022 SSP
+ controller. If you have an embedded system with an AMBA(R)
+ bus and a PL022 controller, say Y or M here.
+
 config RENESAS_RPC_SPI
bool "Renesas RPC SPI driver"
depends on RCAR_GEN3
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 728e30c..6679987 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_MXS_SPI) += mxs_spi.o
 obj-$(CONFIG_ATCSPI200_SPI) += atcspi200_spi.o
 obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o
 obj-$(CONFIG_PIC32_SPI) += pic32_spi.o
+obj-$(CONFIG_PL022_SPI) += pl022_spi.o
 obj-$(CONFIG_RENESAS_RPC_SPI) += renesas_rpc_spi.o
 obj-$(CONFIG_ROCKCHIP_SPI) += rk_spi.o
 obj-$(CONFIG_SANDBOX_SPI) += sandbox_spi.o
diff --git a/drivers/spi/pl022_spi.c b/drivers/spi/pl022_spi.c
new file mode 100644
index 000..86b71d2
--- /dev/null
+++ b/drivers/spi/pl022_spi.c
@@ -0,0 +1,338 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2012
+ * Armando Visconti, ST Microelectronics, armando.visco...@st.com.
+ *
+ * (C) Copyright 2018
+ * Quentin Schulz, Bootlin, quentin.sch...@bootlin.com
+ *
+ * Driver for ARM PL022 SPI Controller.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SSP_CR00x000
+#define SSP_CR10x004
+#define SSP_DR 0x008
+#define SSP_SR 0x00C
+#define SSP_CPSR   0x010
+#define SSP_IMSC   0x014
+#define SSP_RIS0x018
+#define SSP_MIS0x01C
+#define SSP_ICR0x020
+#define SSP_DMACR  0x024
+#define SSP_CSR0x030 /* vendor extension */
+#define SSP_ITCR   0x080
+#define SSP_ITIP   0x084
+#define SSP_ITOP   0x088
+#define SSP_TDR0x08C
+
+#define SSP_PID0   0xFE0
+#define SSP_PID1   0xFE4
+#define SSP_PID2   0xFE8
+#define SSP_PID3   0xFEC
+
+#define SSP_CID0   0xFF0
+#define SSP_CID1   0xFF4
+#define SSP_CID2   0xFF8
+#define SSP_CID3   0xFFC
+
+/* SSP Control Register 0  - SSP_CR0 */
+#define SSP_CR0_SPO(0x1 << 6)
+#define SSP_CR0_SPH(0x1 << 7)
+#define SSP_CR0_BIT_MODE(x)((x) - 1)
+#define SSP_SCR_MIN(0x00)
+#define SSP_SCR_MAX(0xFF)
+#define SSP_SCR_SHFT   8
+#define DFLT_CLKRATE   2
+
+/* SSP Control Register 1  - SSP_CR1 */
+#define SSP_CR1_MASK_SSE   (0x1 << 1)
+
+#define SSP_CPSR_MIN   (0x02)
+#define SSP_CPSR_MAX   (0xFE)
+#define DFLT_PRESCALE  (0x40)
+
+/* SSP Status Register - SSP_SR */
+#define SSP_SR_MASK_TFE(0x1 << 0) /* Transmit FIFO empty */
+#define SSP_SR_MASK_TNF(0x1 << 1) /* Transmit FIFO not full */
+#define SSP_SR_MASK_RNE(0x1 << 2) /* Receive FIFO not empty */
+#define SSP_SR_MASK_RFF(0x1 << 3) /* Receive FIFO full */
+#define SSP_SR_MASK_BSY(0x1 << 4) /* Busy Flag */
+
+struct pl022_spi_slave {
+   void *base;
+#if !CONFIG_IS_ENABLED(OF_PLATDATA)
+   struct clk clk;
+#else
+   unsigned int freq;
+#endif
+};
+
+/*
+ * ARM PL022 exists in different 'flavors'.
+ * This drivers currently support the standard variant (0x00041022), that has a
+ * 16bit wide and 8 locations deep TX/RX FIFO.
+ */
+static int 

[U-Boot] [PATCH v2 2/3] arm: spear: enable SSP1, 2 and 3 clocks when SPI controller driver is built

2018-08-31 Thread Quentin Schulz
SPI controllers SSP1, 2 and 3 require to enable their respective clocks.
Let's enable them only when the SPI controller driver is built.

Signed-off-by: Quentin Schulz 
---

v2:
  - define and use constants for enabling SSP1/2/3 clocks when the
  controller is built

 arch/arm/cpu/arm926ejs/spear/cpu.c | 3 +++
 arch/arm/include/asm/arch-spear/spr_misc.h | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/arch/arm/cpu/arm926ejs/spear/cpu.c 
b/arch/arm/cpu/arm926ejs/spear/cpu.c
index 6fc29e7..c572785 100644
--- a/arch/arm/cpu/arm926ejs/spear/cpu.c
+++ b/arch/arm/cpu/arm926ejs/spear/cpu.c
@@ -52,6 +52,9 @@ int arch_cpu_init(void)
 #if defined(CONFIG_SPEAR_GPIO)
periph1_clken |= MISC_GPIO3ENB | MISC_GPIO4ENB;
 #endif
+#if defined(CONFIG_PL022_SPI)
+   periph1_clken |= MISC_SSP1ENB | MISC_SSP2ENB | MISC_SSP3ENB;
+#endif
 
writel(periph1_clken, _p->periph1_clken);
 
diff --git a/arch/arm/include/asm/arch-spear/spr_misc.h 
b/arch/arm/include/asm/arch-spear/spr_misc.h
index 65063fc..01b4b2b 100644
--- a/arch/arm/include/asm/arch-spear/spr_misc.h
+++ b/arch/arm/include/asm/arch-spear/spr_misc.h
@@ -146,11 +146,13 @@ struct misc_regs {
 #define MISC_SMIENB0x0020
 #define MISC_GPIO3ENB  0x0004
 #define MISC_GPT3ENB   0x0001
+#define MISC_SSP3ENB   0x4000
 #define MISC_GPIO4ENB  0x2000
 #define MISC_GPT2ENB   0x0800
 #define MISC_FSMCENB   0x0200
 #define MISC_I2CENB0x0080
 #define MISC_SSP2ENB   0x0070
+#define MISC_SSP1ENB   0x0020
 #define MISC_UART0ENB  0x0008
 
 /*   PERIPH_CLK_CFG   */
-- 
git-series 0.9.1
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] arm: spear: enable GPIO3 and 4 clocks when the GPIO controller driver is built

2018-08-31 Thread Quentin Schulz
There are multiple GPIOs that can be used with the same driver depending
on the CONFIG_GPIO_BASE defined in the controller driver.

GPIO3 and 4 require a clock to be enabled so let's enable them when the
driver is built.

Signed-off-by: Quentin Schulz 
---
 arch/arm/cpu/arm926ejs/spear/cpu.c | 3 +++
 arch/arm/include/asm/arch-spear/spr_misc.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/cpu/arm926ejs/spear/cpu.c 
b/arch/arm/cpu/arm926ejs/spear/cpu.c
index 0970aca2ef..6fc29e77ff 100644
--- a/arch/arm/cpu/arm926ejs/spear/cpu.c
+++ b/arch/arm/cpu/arm926ejs/spear/cpu.c
@@ -49,6 +49,9 @@ int arch_cpu_init(void)
 #if defined(CONFIG_USB_EHCI_SPEAR)
periph1_clken |= PERIPH_USBH1 | PERIPH_USBH2;
 #endif
+#if defined(CONFIG_SPEAR_GPIO)
+   periph1_clken |= MISC_GPIO3ENB | MISC_GPIO4ENB;
+#endif
 
writel(periph1_clken, _p->periph1_clken);
 
diff --git a/arch/arm/include/asm/arch-spear/spr_misc.h 
b/arch/arm/include/asm/arch-spear/spr_misc.h
index c906730699..65063fca51 100644
--- a/arch/arm/include/asm/arch-spear/spr_misc.h
+++ b/arch/arm/include/asm/arch-spear/spr_misc.h
@@ -144,6 +144,7 @@ struct misc_regs {
 #define MISC_USBDENB   0x0100
 #define MISC_ETHENB0x0080
 #define MISC_SMIENB0x0020
+#define MISC_GPIO3ENB  0x0004
 #define MISC_GPT3ENB   0x0001
 #define MISC_GPIO4ENB  0x2000
 #define MISC_GPT2ENB   0x0800
-- 
2.17.1

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


Re: [U-Boot] [PULL] Please pull u-boot-imx

2018-08-31 Thread Tom Rini
On Fri, Aug 31, 2018 at 03:04:31PM +0200, Stefano Babic wrote:
> Hi Tom,
> 
> please pull from u-boot-imx, thanks !
> 
> The following changes since commit 11ed312896c5f5814064c5d45dcb2f53dc121437:
> 
>   configs: am57xx: change default board name to beagle_x15 (2018-08-26
> 12:26:16 -0400)
> 
> are available in the Git repository at:
> 
>   git://www.denx.de/git/u-boot-imx.git master
> 
> for you to fetch changes up to 2846e663fd62200a189bba357135e284a379a38b:
> 
>   imx: missing CONFIG_MII in mx7dsabresd_qspi_defconfig (2018-08-31
> 12:08:43 +0200)
> 
> 
> Alex Kiernan (1):
>   Cleanup CONFIG_BOOTDELAY on cl-som-imx7
> 
> Anson Huang (3):
>   imx: mx7: psci: improve cpu hotplug flow
>   imx: mx7: add gpc initialization for low power mode
>   imx: mx7: add system suspend/resume support
> 
> Denis Zalevskiy (6):
>   board: ge: Remove EEPROM bus param from read_vpd()
>   board: ge: Move VPD EEPROM configuration to the defconfig
>   bootcount: i2c: Add bus switching to the I2C bootcount driver
>   bootcount: Configure length limit for I2C bootcount
>   board: ge: Move VPD reading to the vpd_reader
>   board: ge: Store bootcount in EEPROM on PPD and Bx50v3
> 
> Martin Kaiser (1):
>   watchdog: mx25: use the imx_watchdog driver for mx25
> 
> Stefan Agner (2):
>   board: toradex: common: fail gracefully on missing NAND chip
>   colibri_imx7_emmc: add Colibri iMX7D 1GB (eMMC) module support
> 
> Stefano Babic (2):
>   Merge branch 'master' of git://git.denx.de/u-boot into master
>   imx: missing CONFIG_MII in mx7dsabresd_qspi_defconfig
> 
> Sébastien Szymanski (1):
>   ARM: opos6ul: make the board boot again
> 
> Ye Li (6):
>   imx: imx6sx-sdb: Enable DM QSPI driver
>   imx: imx6sx-sabreauto: convert to use DM QSPI driver
>   imx: imx7d-sdb: Add DM QSPI support
>   dts: imx6ul: Update alias to support DM
>   dts: imx6ul_evk: Add DTS files for 14x14 EVK and 9x9 EVK boards
>   imx: imx6ul_evk: Enable DM driver for iMX6UL EVK u-boot
> 
>  arch/arm/dts/Makefile |   7 +-
>  arch/arm/dts/imx6sx-sabreauto-u-boot.dtsi |  16 +
>  arch/arm/dts/imx6sx-sabreauto.dts |  40 ++
>  arch/arm/dts/imx6sx-sdb-u-boot.dtsi   |  16 +
>  arch/arm/dts/imx6sx.dtsi  |  12 +-
>  arch/arm/dts/imx6ul-14x14-evk-u-boot.dtsi |  10 +
>  arch/arm/dts/imx6ul-14x14-evk.dts | 427 +++
>  arch/arm/dts/imx6ul-9x9-evk-u-boot.dtsi   |  10 +
>  arch/arm/dts/imx6ul-9x9-evk.dts   | 471
> +
>  arch/arm/dts/imx6ul-opos6ul-u-boot.dtsi   |  28 ++
>  arch/arm/dts/imx6ul-opos6ul.dtsi  |   2 -
>  arch/arm/dts/imx6ul-opos6uldev-u-boot.dts |  25 ++
>  arch/arm/dts/imx6ul-opos6uldev.dts|   2 -
>  arch/arm/dts/imx6ul.dtsi  |  13 +-
>  arch/arm/dts/imx7d-sdb-qspi-u-boot.dtsi   |  10 +
>  arch/arm/dts/imx7d-sdb-qspi.dts   |  44 ++
>  arch/arm/dts/imx7d-sdb.dts|   6 +-
>  arch/arm/dts/imx7d.dtsi   |  12 +
>  arch/arm/dts/imx7s.dtsi   |  22 +-
>  arch/arm/include/asm/arch-mx25/imx-regs.h |   1 +
>  arch/arm/mach-imx/mx7/Makefile|   2 +-
>  arch/arm/mach-imx/mx7/psci-mx7.c  | 472
> +-
>  arch/arm/mach-imx/mx7/psci-suspend.S  |  67 +++
>  arch/arm/mach-imx/mx7/soc.c   | 103 +
>  board/freescale/mx6sxsabreauto/mx6sxsabreauto.c   |  24 --
>  board/freescale/mx6sxsabresd/mx6sxsabresd.c   |  25 --
>  board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c | 208 ++
>  board/freescale/mx7dsabresd/mx7dsabresd.c |  16 -
>  board/ge/bx50v3/Kconfig   |   2 +
>  board/ge/bx50v3/bx50v3.c  |  57 +--
>  board/ge/common/Kconfig   |  14 +
>  board/ge/common/vpd_reader.c  |  57 ++-
>  board/ge/common/vpd_reader.h  |  16 +-
>  board/ge/mx53ppd/Kconfig  |   2 +
>  board/ge/mx53ppd/mx53ppd.c|  50 +--
>  board/toradex/colibri_imx7/Kconfig|  42 +-
>  board/toradex/colibri_imx7/MAINTAINERS|   4 +
>  board/toradex/colibri_imx7/colibri_imx7.c |  41 +-
>  board/toradex/common/tdx-cfg-block.c  |   7 +-
>  configs/ge_bx50v3_defconfig   |  27 +-
>  configs/mx53ppd_defconfig |  29 +-
>  configs/mx6sxsabreauto_defconfig  |   2 +
>  configs/mx6sxsabresd_defconfig|   7 +
>  configs/mx6ul_14x14_evk_defconfig |  17 +-
>  configs/mx6ul_9x9_evk_defconfig   |  20 +-
>  

[U-Boot] [PULL] Please pull u-boot-imx

2018-08-31 Thread Stefano Babic
Hi Tom,

please pull from u-boot-imx, thanks !

The following changes since commit 11ed312896c5f5814064c5d45dcb2f53dc121437:

  configs: am57xx: change default board name to beagle_x15 (2018-08-26
12:26:16 -0400)

are available in the Git repository at:

  git://www.denx.de/git/u-boot-imx.git master

for you to fetch changes up to 2846e663fd62200a189bba357135e284a379a38b:

  imx: missing CONFIG_MII in mx7dsabresd_qspi_defconfig (2018-08-31
12:08:43 +0200)


Alex Kiernan (1):
  Cleanup CONFIG_BOOTDELAY on cl-som-imx7

Anson Huang (3):
  imx: mx7: psci: improve cpu hotplug flow
  imx: mx7: add gpc initialization for low power mode
  imx: mx7: add system suspend/resume support

Denis Zalevskiy (6):
  board: ge: Remove EEPROM bus param from read_vpd()
  board: ge: Move VPD EEPROM configuration to the defconfig
  bootcount: i2c: Add bus switching to the I2C bootcount driver
  bootcount: Configure length limit for I2C bootcount
  board: ge: Move VPD reading to the vpd_reader
  board: ge: Store bootcount in EEPROM on PPD and Bx50v3

Martin Kaiser (1):
  watchdog: mx25: use the imx_watchdog driver for mx25

Stefan Agner (2):
  board: toradex: common: fail gracefully on missing NAND chip
  colibri_imx7_emmc: add Colibri iMX7D 1GB (eMMC) module support

Stefano Babic (2):
  Merge branch 'master' of git://git.denx.de/u-boot into master
  imx: missing CONFIG_MII in mx7dsabresd_qspi_defconfig

Sébastien Szymanski (1):
  ARM: opos6ul: make the board boot again

Ye Li (6):
  imx: imx6sx-sdb: Enable DM QSPI driver
  imx: imx6sx-sabreauto: convert to use DM QSPI driver
  imx: imx7d-sdb: Add DM QSPI support
  dts: imx6ul: Update alias to support DM
  dts: imx6ul_evk: Add DTS files for 14x14 EVK and 9x9 EVK boards
  imx: imx6ul_evk: Enable DM driver for iMX6UL EVK u-boot

 arch/arm/dts/Makefile |   7 +-
 arch/arm/dts/imx6sx-sabreauto-u-boot.dtsi |  16 +
 arch/arm/dts/imx6sx-sabreauto.dts |  40 ++
 arch/arm/dts/imx6sx-sdb-u-boot.dtsi   |  16 +
 arch/arm/dts/imx6sx.dtsi  |  12 +-
 arch/arm/dts/imx6ul-14x14-evk-u-boot.dtsi |  10 +
 arch/arm/dts/imx6ul-14x14-evk.dts | 427 +++
 arch/arm/dts/imx6ul-9x9-evk-u-boot.dtsi   |  10 +
 arch/arm/dts/imx6ul-9x9-evk.dts   | 471
+
 arch/arm/dts/imx6ul-opos6ul-u-boot.dtsi   |  28 ++
 arch/arm/dts/imx6ul-opos6ul.dtsi  |   2 -
 arch/arm/dts/imx6ul-opos6uldev-u-boot.dts |  25 ++
 arch/arm/dts/imx6ul-opos6uldev.dts|   2 -
 arch/arm/dts/imx6ul.dtsi  |  13 +-
 arch/arm/dts/imx7d-sdb-qspi-u-boot.dtsi   |  10 +
 arch/arm/dts/imx7d-sdb-qspi.dts   |  44 ++
 arch/arm/dts/imx7d-sdb.dts|   6 +-
 arch/arm/dts/imx7d.dtsi   |  12 +
 arch/arm/dts/imx7s.dtsi   |  22 +-
 arch/arm/include/asm/arch-mx25/imx-regs.h |   1 +
 arch/arm/mach-imx/mx7/Makefile|   2 +-
 arch/arm/mach-imx/mx7/psci-mx7.c  | 472
+-
 arch/arm/mach-imx/mx7/psci-suspend.S  |  67 +++
 arch/arm/mach-imx/mx7/soc.c   | 103 +
 board/freescale/mx6sxsabreauto/mx6sxsabreauto.c   |  24 --
 board/freescale/mx6sxsabresd/mx6sxsabresd.c   |  25 --
 board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c | 208 ++
 board/freescale/mx7dsabresd/mx7dsabresd.c |  16 -
 board/ge/bx50v3/Kconfig   |   2 +
 board/ge/bx50v3/bx50v3.c  |  57 +--
 board/ge/common/Kconfig   |  14 +
 board/ge/common/vpd_reader.c  |  57 ++-
 board/ge/common/vpd_reader.h  |  16 +-
 board/ge/mx53ppd/Kconfig  |   2 +
 board/ge/mx53ppd/mx53ppd.c|  50 +--
 board/toradex/colibri_imx7/Kconfig|  42 +-
 board/toradex/colibri_imx7/MAINTAINERS|   4 +
 board/toradex/colibri_imx7/colibri_imx7.c |  41 +-
 board/toradex/common/tdx-cfg-block.c  |   7 +-
 configs/ge_bx50v3_defconfig   |  27 +-
 configs/mx53ppd_defconfig |  29 +-
 configs/mx6sxsabreauto_defconfig  |   2 +
 configs/mx6sxsabresd_defconfig|   7 +
 configs/mx6ul_14x14_evk_defconfig |  17 +-
 configs/mx6ul_9x9_evk_defconfig   |  20 +-
 configs/mx7dsabresd_qspi_defconfig|  84 
 configs/opos6uldev_defconfig  |   2 +-
 drivers/bootcount/Kconfig |  21 +-
 drivers/bootcount/bootcount_i2c.c |  78 +++-
 drivers/watchdog/Makefile |   2 +-
 

[U-Boot] [PATCH] spl: Kconfig: Fix typo in 'Upgrade'

2018-08-31 Thread Fabio Estevam
From: Fabio Estevam 

Correct the spelling of 'Upgrade'.

Signed-off-by: Fabio Estevam 
---
 common/spl/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index b44b741..2e79d7d 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -738,12 +738,12 @@ config SPL_USB_ETHER
  See also SPL_NET_SUPPORT and SPL_ETH_SUPPORT.
 
 config SPL_DFU_SUPPORT
-   bool "Support DFU (Device Firmware Upgarde)"
+   bool "Support DFU (Device Firmware Upgrade)"
select SPL_HASH_SUPPORT
select SPL_DFU_NO_RESET
depends on SPL_RAM_SUPPORT
help
- This feature enables the DFU (Device Firmware Upgarde) in SPL with
+ This feature enables the DFU (Device Firmware Upgrade) in SPL with
  RAM memory device support. The ROM code will load and execute
  the SPL built with dfu. The user can load binaries (u-boot/kernel) to
  selected device partition from host-pc using dfu-utils.
-- 
2.7.4

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


[U-Boot] [PATCH] wandboard: README: Include the mx6qp variant in the list

2018-08-31 Thread Fabio Estevam
From: Fabio Estevam 

The mx6qp Wandboard variant is also supported, so add it to the list.

Signed-off-by: Fabio Estevam 
---
 board/wandboard/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/wandboard/README b/board/wandboard/README
index 6345416..e5170bc 100644
--- a/board/wandboard/README
+++ b/board/wandboard/README
@@ -4,7 +4,7 @@ U-Boot for Wandboard
 This file contains information for the port of U-Boot to the Wandboard.
 
 Wandboard is a development board that has three variants based on the following
-SoCs: mx6 quad, mx6 dual lite and mx6 solo.
+SoCs: mx6 quad, mx6 quad plus, mx6 dual lite and mx6 solo.
 
 For more details about Wandboard, please refer to:
 http://www.wandboard.org/
-- 
2.7.4

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


Re: [U-Boot] [PATCH 0/2] Add Rock960 board support

2018-08-31 Thread Manivannan Sadhasivam
On Fri, Aug 31, 2018 at 09:27:25AM -0300, Ezequiel Garcia wrote:
> On 31 August 2018 at 09:24, Manivannan Sadhasivam
>  wrote:
> > On Fri, Aug 31, 2018 at 09:08:08AM -0300, Ezequiel Garcia wrote:
> >> On 31 August 2018 at 07:56, Peter Robinson  wrote:
> >> >> On Thu, Aug 30, 2018 at 12:44:00AM -0300, Ezequiel Garcia wrote:
> >> >> > On 30 August 2018 at 00:00, Manivannan Sadhasivam
> >> >> >  wrote:
> >> >> > > Hi Ezequiel,
> >> >> > >
> >> >> > > On Wed, Aug 29, 2018 at 03:11:17AM -0300, Ezequiel Garcia wrote:
> >> >> > >> Hi Manivannan,
> >> >> > >>
> >> >> > >> On 21 August 2018 at 14:09, Manivannan Sadhasivam
> >> >> > >>  wrote:
> >> >> > >> > This patchset adds board support for Vamrs Limited Rock960,
> >> >> > >> > which is one of the 96Boards Consumer Edition platform based
> >> >> > >> > on Rockchip RK3399 SoC.
> >> >> > >> >
> >> >> > >>
> >> >> > >> What are the differences between this consumer edition board,
> >> >> > >> and the enterprise edition (aka Ficus) Vamrs board?
> >> >> > >>
> >> >> > >
> >> >> > > I asked Vamrs about this and they said the difference is very 
> >> >> > > minimal.
> >> >> > >
> >> >> >
> >> >> > In that case, you should try to leverage the Linux ficus.dts:
> >> >> >
> >> >> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-ficus.dts
> >> >> >
> >> >> > If no differences, using the ficus dts should do. If there are 
> >> >> > differences,
> >> >> > we can create a common rock960.dtsi and then enterprise and consumer
> >> >> > edition dts.
> >> >> >
> >> >>
> >> >> Okay. Here are the differences between Ficus and Rock960 CE:
> >> >>
> >> >> 1. Different host enable GPIO for USB (vcc5v0_host)
> >> >> 2. Different power and reset for PCI-E (vcc3v3_pcie, pcie0)
> >> >> 3. No Ethernet port on Rock960 (gmac)
> >> >>
> >> >> So, I would suggest keeping USB, PCI-E and GMAC related nodes on the 
> >> >> board
> >> >> specific devicetree and rest on the rk3399-rock960.dtsi. What do you 
> >> >> think?
> >> >>
> >> >> Same applies to Linux also!
> >> >
> >>
> >> Sounds good. If you have some cycles to work on the dts/dtsi split,
> >> that would be great.
> >>
> >
> > Sure, will do it for Linux now. Once your u-boot patches gets in,
> > will tackle it also.
> >
> 
> Well, I think we can tackle u-boot from scratch. No need to
> merge my patches if we think they are already wrong :-)
>

Makes sense!

> >> > Yes, I think a rk3399-rock960.dtsi with the differences in two .dts
> >> > would be great, and even better a single U-Boot which can detect the
> >> > board and load the right DT, but I do think it should be a separate
> >> > config to evb as Mani mentioned.
> >> >
> >
> > Thanks Peter for your thoughts!
> >
> >>
> >> Sounds good too. That'd make board-specific hooks easier.
> >>
> >> On the other side, the documentation should be
> >> merged somewhere.
> >>
> >> Seems nonsense to have a README per board,
> >> with more or less the same instructions each time.
> >>
> >
> > This has other side as well. If we continue to merge board specific
> > instructions onto evb-rk3399, it will become messy. So, IMO it's better
> > to have it separate. If you have other ideas, please let me know.
> >
> 
> Bootloader wise, there is no such thing as board specific instructions, is it?

Yeah, but I'm thinking about the overhead of having a common doc for
boards which might come in future (like Rock960c have an optional eMMC
module).

Even in Rock960 CE, we need to specify the load address for u-boot while
preparing the uboot.img (not sure why it is required)...

I'm kind of skeptical here.

Peter, any thoughts?

> -- 
> Ezequiel García, VanguardiaSur
> www.vanguardiasur.com.ar
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/2] Add Rock960 board support

2018-08-31 Thread Ezequiel Garcia
On 31 August 2018 at 09:24, Manivannan Sadhasivam
 wrote:
> On Fri, Aug 31, 2018 at 09:08:08AM -0300, Ezequiel Garcia wrote:
>> On 31 August 2018 at 07:56, Peter Robinson  wrote:
>> >> On Thu, Aug 30, 2018 at 12:44:00AM -0300, Ezequiel Garcia wrote:
>> >> > On 30 August 2018 at 00:00, Manivannan Sadhasivam
>> >> >  wrote:
>> >> > > Hi Ezequiel,
>> >> > >
>> >> > > On Wed, Aug 29, 2018 at 03:11:17AM -0300, Ezequiel Garcia wrote:
>> >> > >> Hi Manivannan,
>> >> > >>
>> >> > >> On 21 August 2018 at 14:09, Manivannan Sadhasivam
>> >> > >>  wrote:
>> >> > >> > This patchset adds board support for Vamrs Limited Rock960,
>> >> > >> > which is one of the 96Boards Consumer Edition platform based
>> >> > >> > on Rockchip RK3399 SoC.
>> >> > >> >
>> >> > >>
>> >> > >> What are the differences between this consumer edition board,
>> >> > >> and the enterprise edition (aka Ficus) Vamrs board?
>> >> > >>
>> >> > >
>> >> > > I asked Vamrs about this and they said the difference is very minimal.
>> >> > >
>> >> >
>> >> > In that case, you should try to leverage the Linux ficus.dts:
>> >> >
>> >> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-ficus.dts
>> >> >
>> >> > If no differences, using the ficus dts should do. If there are 
>> >> > differences,
>> >> > we can create a common rock960.dtsi and then enterprise and consumer
>> >> > edition dts.
>> >> >
>> >>
>> >> Okay. Here are the differences between Ficus and Rock960 CE:
>> >>
>> >> 1. Different host enable GPIO for USB (vcc5v0_host)
>> >> 2. Different power and reset for PCI-E (vcc3v3_pcie, pcie0)
>> >> 3. No Ethernet port on Rock960 (gmac)
>> >>
>> >> So, I would suggest keeping USB, PCI-E and GMAC related nodes on the board
>> >> specific devicetree and rest on the rk3399-rock960.dtsi. What do you 
>> >> think?
>> >>
>> >> Same applies to Linux also!
>> >
>>
>> Sounds good. If you have some cycles to work on the dts/dtsi split,
>> that would be great.
>>
>
> Sure, will do it for Linux now. Once your u-boot patches gets in,
> will tackle it also.
>

Well, I think we can tackle u-boot from scratch. No need to
merge my patches if we think they are already wrong :-)

>> > Yes, I think a rk3399-rock960.dtsi with the differences in two .dts
>> > would be great, and even better a single U-Boot which can detect the
>> > board and load the right DT, but I do think it should be a separate
>> > config to evb as Mani mentioned.
>> >
>
> Thanks Peter for your thoughts!
>
>>
>> Sounds good too. That'd make board-specific hooks easier.
>>
>> On the other side, the documentation should be
>> merged somewhere.
>>
>> Seems nonsense to have a README per board,
>> with more or less the same instructions each time.
>>
>
> This has other side as well. If we continue to merge board specific
> instructions onto evb-rk3399, it will become messy. So, IMO it's better
> to have it separate. If you have other ideas, please let me know.
>

Bootloader wise, there is no such thing as board specific instructions, is it?
-- 
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [Resend] [U-Boot, v4, 7/7] net: gmac_rockchip: Add handeling for RGMII_ID/RXID/TXID

2018-08-31 Thread David.Wu

Resend it for Undelivered Mail.

在 2018/8/31 19:54, David.Wu 写道:

Hi Janine,

This patch looks good. Thank you for adding rgmii-id/rxid/txid.
Reviewed-by: David Wu 

在 2018/8/28 14:25, Janine Hagemann 写道:

Using PHY internal delays in combination with the phy-mode
rgmii-id/rxid/txid was not possible. Only rgmii was supported.

Now we can disable rockchip's gmac delay lines and also use
rgmii-id/rxid/txid.

Based on commit eaf70ad14cbb ("net: stmmac: dwmac-rk: Add
handling for RGMII_ID/RXID/TXID") for mainline linux kernel.

Signed-off-by: Janine Hagemann 
Acked-by: Joe Hershberger 
---
v4: No changes
---
  drivers/net/gmac_rockchip.c | 80 
+++--

  1 file changed, 63 insertions(+), 17 deletions(-)

diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c
index 0f91731..c01ae75 100644
--- a/drivers/net/gmac_rockchip.c
+++ b/drivers/net/gmac_rockchip.c
@@ -24,6 +24,11 @@
  #include 
  #include "designware.h"
+DECLARE_GLOBAL_DATA_PTR;
+#define DELAY_ENABLE(soc, tx, rx) \
+    (((tx) ? soc##_TXCLK_DLY_ENA_GMAC_ENABLE : 
soc##_TXCLK_DLY_ENA_GMAC_DISABLE) | \
+    ((rx) ? soc##_RXCLK_DLY_ENA_GMAC_ENABLE : 
soc##_RXCLK_DLY_ENA_GMAC_DISABLE))

+
  /*
   * Platform data for the gmac
   *
@@ -286,8 +291,7 @@ static void rk3228_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)

   RK3228_RXCLK_DLY_ENA_GMAC_MASK |
   RK3228_TXCLK_DLY_ENA_GMAC_MASK,
   RK3228_GMAC_PHY_INTF_SEL_RGMII |
- RK3228_RXCLK_DLY_ENA_GMAC_ENABLE |
- RK3228_TXCLK_DLY_ENA_GMAC_ENABLE);
+ DELAY_ENABLE(RK3228, pdata->tx_delay, pdata->rx_delay));
  rk_clrsetreg(>mac_con[0],
   RK3228_CLK_RX_DL_CFG_GMAC_MASK |
@@ -310,8 +314,7 @@ static void rk3288_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)

   RK3288_TXCLK_DLY_ENA_GMAC_MASK |
   RK3288_CLK_RX_DL_CFG_GMAC_MASK |
   RK3288_CLK_TX_DL_CFG_GMAC_MASK,
- RK3288_RXCLK_DLY_ENA_GMAC_ENABLE |
- RK3288_TXCLK_DLY_ENA_GMAC_ENABLE |
+ DELAY_ENABLE(RK3288, pdata->rx_delay, pdata->tx_delay) |
   pdata->rx_delay << RK3288_CLK_RX_DL_CFG_GMAC_SHIFT |
   pdata->tx_delay << RK3288_CLK_TX_DL_CFG_GMAC_SHIFT);
  }
@@ -350,8 +353,7 @@ static void rk3328_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)

   RK3328_RXCLK_DLY_ENA_GMAC_MASK |
   RK3328_TXCLK_DLY_ENA_GMAC_MASK,
   RK3328_GMAC_PHY_INTF_SEL_RGMII |
- RK3328_RXCLK_DLY_ENA_GMAC_ENABLE |
- RK3328_TXCLK_DLY_ENA_GMAC_ENABLE);
+ DELAY_ENABLE(RK3328, pdata->tx_delay, pdata->rx_delay));
  rk_clrsetreg(>mac_con[0],
   RK3328_CLK_RX_DL_CFG_GMAC_MASK |
@@ -392,8 +394,7 @@ static void rk3368_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)

   RK3368_TXCLK_DLY_ENA_GMAC_MASK |
   RK3368_CLK_RX_DL_CFG_GMAC_MASK |
   RK3368_CLK_TX_DL_CFG_GMAC_MASK,
- RK3368_RXCLK_DLY_ENA_GMAC_ENABLE |
- RK3368_TXCLK_DLY_ENA_GMAC_ENABLE |
+ DELAY_ENABLE(RK3368, pdata->tx_delay, pdata->rx_delay) |
   pdata->rx_delay << RK3368_CLK_RX_DL_CFG_GMAC_SHIFT |
   pdata->tx_delay << RK3368_CLK_TX_DL_CFG_GMAC_SHIFT);
  }
@@ -413,8 +414,7 @@ static void rk3399_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)

   RK3399_TXCLK_DLY_ENA_GMAC_MASK |
   RK3399_CLK_RX_DL_CFG_GMAC_MASK |
   RK3399_CLK_TX_DL_CFG_GMAC_MASK,
- RK3399_RXCLK_DLY_ENA_GMAC_ENABLE |
- RK3399_TXCLK_DLY_ENA_GMAC_ENABLE |
+ DELAY_ENABLE(RK3399, pdata->tx_delay, pdata->rx_delay) |
   pdata->rx_delay << RK3399_CLK_RX_DL_CFG_GMAC_SHIFT |
   pdata->tx_delay << RK3399_CLK_TX_DL_CFG_GMAC_SHIFT);
  }
@@ -451,40 +451,86 @@ static int gmac_rockchip_probe(struct udevice *dev)
  switch (eth_pdata->phy_interface) {
  case PHY_INTERFACE_MODE_RGMII:
+    /* Set to RGMII mode */
+    if (ops->set_to_rgmii)
+    ops->set_to_rgmii(pdata);
+    else
+    return -EPERM;
+
  /*
   * If the gmac clock is from internal pll, need to set and
   * check the return value for gmac clock at RGMII mode. If
   * the gmac clock is from external source, the clock rate
   * is not set, because of it is bypassed.
   */
+
  if (!pdata->clock_input) {
  rate = clk_set_rate(, 12500);
  if (rate != 12500)
  return -EINVAL;
  }
+    break;
+    case PHY_INTERFACE_MODE_RGMII_ID:
  /* Set to RGMII mode */
-    if (ops->set_to_rgmii)
+    if (ops->set_to_rgmii) {
+    pdata->tx_delay = 0;
+    pdata->rx_delay = 0;
  ops->set_to_rgmii(pdata);
-    else
+    } else
  return -EPERM;
-    break;
-    case 

Re: [U-Boot] [PATCH 0/2] Add Rock960 board support

2018-08-31 Thread Manivannan Sadhasivam
On Fri, Aug 31, 2018 at 09:08:08AM -0300, Ezequiel Garcia wrote:
> On 31 August 2018 at 07:56, Peter Robinson  wrote:
> >> On Thu, Aug 30, 2018 at 12:44:00AM -0300, Ezequiel Garcia wrote:
> >> > On 30 August 2018 at 00:00, Manivannan Sadhasivam
> >> >  wrote:
> >> > > Hi Ezequiel,
> >> > >
> >> > > On Wed, Aug 29, 2018 at 03:11:17AM -0300, Ezequiel Garcia wrote:
> >> > >> Hi Manivannan,
> >> > >>
> >> > >> On 21 August 2018 at 14:09, Manivannan Sadhasivam
> >> > >>  wrote:
> >> > >> > This patchset adds board support for Vamrs Limited Rock960,
> >> > >> > which is one of the 96Boards Consumer Edition platform based
> >> > >> > on Rockchip RK3399 SoC.
> >> > >> >
> >> > >>
> >> > >> What are the differences between this consumer edition board,
> >> > >> and the enterprise edition (aka Ficus) Vamrs board?
> >> > >>
> >> > >
> >> > > I asked Vamrs about this and they said the difference is very minimal.
> >> > >
> >> >
> >> > In that case, you should try to leverage the Linux ficus.dts:
> >> >
> >> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-ficus.dts
> >> >
> >> > If no differences, using the ficus dts should do. If there are 
> >> > differences,
> >> > we can create a common rock960.dtsi and then enterprise and consumer
> >> > edition dts.
> >> >
> >>
> >> Okay. Here are the differences between Ficus and Rock960 CE:
> >>
> >> 1. Different host enable GPIO for USB (vcc5v0_host)
> >> 2. Different power and reset for PCI-E (vcc3v3_pcie, pcie0)
> >> 3. No Ethernet port on Rock960 (gmac)
> >>
> >> So, I would suggest keeping USB, PCI-E and GMAC related nodes on the board
> >> specific devicetree and rest on the rk3399-rock960.dtsi. What do you think?
> >>
> >> Same applies to Linux also!
> >
> 
> Sounds good. If you have some cycles to work on the dts/dtsi split,
> that would be great.
>

Sure, will do it for Linux now. Once your u-boot patches gets in,
will tackle it also.

> > Yes, I think a rk3399-rock960.dtsi with the differences in two .dts
> > would be great, and even better a single U-Boot which can detect the
> > board and load the right DT, but I do think it should be a separate
> > config to evb as Mani mentioned.
> >

Thanks Peter for your thoughts!

> 
> Sounds good too. That'd make board-specific hooks easier.
> 
> On the other side, the documentation should be
> merged somewhere.
> 
> Seems nonsense to have a README per board,
> with more or less the same instructions each time.
> 

This has other side as well. If we continue to merge board specific
instructions onto evb-rk3399, it will become messy. So, IMO it's better
to have it separate. If you have other ideas, please let me know.

Thanks,
Mani

> Thanks!
> -- 
> Ezequiel García, VanguardiaSur
> www.vanguardiasur.com.ar
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 14/15] tee: optee: support AVB trusted application

2018-08-31 Thread Jens Wiklander
Hi Simon,

On Wed, Aug 29, 2018 at 06:29:09PM -0600, Simon Glass wrote:
> Hi Jens,
> 
> On 23 August 2018 at 04:43, Jens Wiklander  wrote:
> > Adds configuration option OPTEE_TA_AVB and a header file describing the
> > interface to the AVB trusted application provided by OP-TEE.
> 
> What is AVB? Can you please write it out in full?

AVB stands for Android Verified Boot 2.0. However, Google is a bit picky
about how the name Android is used so I'm trying to avoid using it as
much as possible to stay out of trouble. I'll write it out in the commit
message.

> 
> >
> > Tested-by: Igor Opaniuk 
> > Reviewed-by: Igor Opaniuk 
> > Signed-off-by: Jens Wiklander 
> > ---
> >  MAINTAINERS|  1 +
> >  drivers/tee/optee/Kconfig  | 16 +
> >  include/tee.h  |  7 ++
> >  include/tee/optee_ta_avb.h | 48 ++
> >  4 files changed, 72 insertions(+)
> >  create mode 100644 include/tee/optee_ta_avb.h
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 7458c606ee92..cb36c45d74ea 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -576,6 +576,7 @@ M:  Jens Wiklander 
> >  S: Maintained
> >  F: drivers/tee/
> >  F: include/tee.h
> > +F: include/tee/
> >
> >  UBI
> >  M: Kyungmin Park 
> > diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig
> > index 8f7ebe16..a5dc08439629 100644
> > --- a/drivers/tee/optee/Kconfig
> > +++ b/drivers/tee/optee/Kconfig
> > @@ -5,3 +5,19 @@ config OPTEE
> > help
> >   This implements the OP-TEE Trusted Execution Environment (TEE)
> >   driver.
> > +
> > +if OPTEE
> > +
> > +menu "OP-TEE options"
> > +
> > +config OPTEE_TA_AVB
> > +   bool "Support AVB TA"
> > +   default y
> > +   help
> > + Enables support for the AVB Trusted Application (TA) in OP-TEE.
> > + The TA can support the "avb" subcommands "read_rb", "write"rb"
> > + and "is_unlocked".
> > +
> > +endmenu
> > +
> > +endif
> > diff --git a/include/tee.h b/include/tee.h
> > index 3e6771123ef0..b851d718d32f 100644
> > --- a/include/tee.h
> > +++ b/include/tee.h
> > @@ -48,6 +48,13 @@
> >
> >  #define TEE_ORIGIN_COMMS   0x0002
> >
> > +struct tee_optee_ta_uuid {
> 
> Comment on this struct. What is it for?

I'll fix.

> 
> > +   u32 time_low;
> > +   u16 time_mid;
> > +   u16 time_hi_and_version;
> > +   u8 clock_seq_and_node[8];
> > +};
> > +
> >  /**
> >   * struct tee_shm - memory shared with the TEE
> >   * @dev:   The TEE device
> > diff --git a/include/tee/optee_ta_avb.h b/include/tee/optee_ta_avb.h
> > new file mode 100644
> > index ..0e1da084e09d
> > --- /dev/null
> > +++ b/include/tee/optee_ta_avb.h
> > @@ -0,0 +1,48 @@
> > +/* SPDX-License-Identifier: BSD-2-Clause */
> > +/* Copyright (c) 2018, Linaro Limited */
> > +
> > +#ifndef __TA_AVB_H
> > +#define __TA_AVB_H
> > +
> > +#define TA_AVB_UUID { 0x023f8f1a, 0x292a, 0x432b, \
> > + { 0x8f, 0xc4, 0xde, 0x84, 0x71, 0x35, 0x80, 0x67 } }
> > +
> > +#define TA_AVB_MAX_ROLLBACK_LOCATIONS  256
> > +
> > +/*
> > + * Gets the rollback index corresponding to the given rollback index slot.
> > + *
> > + * in  params[0].value.a:  rollback index slot
> > + * out params[1].value.a:  upper 32 bits of rollback index
> > + * out params[1].value.b:  lower 32 bits of rollback index
> > + */
> > +#define TA_AVB_CMD_READ_ROLLBACK_INDEX 0
> > +
> > +/*
> > + * Updates the rollback index corresponding to the given rollback index 
> > slot.
> > + *
> > + * Will refuse to update a slot with a lower value.
> > + *
> > + * in  params[0].value.a:  rollback index slot
> > + * in  params[1].value.a:  upper 32 bits of rollback index
> > + * in  params[1].value.b:  lower 32 bits of rollback index
> > + */
> > +#define TA_AVB_CMD_WRITE_ROLLBACK_INDEX1
> > +
> > +/*
> > + * Gets the lock state of the device.
> > + *
> > + * out params[0].value.a:  lock state
> > + */
> > +#define TA_AVB_CMD_READ_LOCK_STATE 2
> > +
> > +/*
> > + * Sets the lock state of the device.
> > + *
> > + * If the lock state is changed all rollback slots will be reset to 0
> > + *
> > + * in  params[0].value.a:  lock state
> > + */
> > +#define TA_AVB_CMD_WRITE_LOCK_STATE3
> > +
> > +#endif /*__TA_AVB_H*/
> 
> Space before */
> 
> > --
> > 2.17.1
> >

Thanks for the review,
Jens
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 0/2] Add Rock960 board support

2018-08-31 Thread Ezequiel Garcia
On 31 August 2018 at 07:56, Peter Robinson  wrote:
>> On Thu, Aug 30, 2018 at 12:44:00AM -0300, Ezequiel Garcia wrote:
>> > On 30 August 2018 at 00:00, Manivannan Sadhasivam
>> >  wrote:
>> > > Hi Ezequiel,
>> > >
>> > > On Wed, Aug 29, 2018 at 03:11:17AM -0300, Ezequiel Garcia wrote:
>> > >> Hi Manivannan,
>> > >>
>> > >> On 21 August 2018 at 14:09, Manivannan Sadhasivam
>> > >>  wrote:
>> > >> > This patchset adds board support for Vamrs Limited Rock960,
>> > >> > which is one of the 96Boards Consumer Edition platform based
>> > >> > on Rockchip RK3399 SoC.
>> > >> >
>> > >>
>> > >> What are the differences between this consumer edition board,
>> > >> and the enterprise edition (aka Ficus) Vamrs board?
>> > >>
>> > >
>> > > I asked Vamrs about this and they said the difference is very minimal.
>> > >
>> >
>> > In that case, you should try to leverage the Linux ficus.dts:
>> >
>> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-ficus.dts
>> >
>> > If no differences, using the ficus dts should do. If there are differences,
>> > we can create a common rock960.dtsi and then enterprise and consumer
>> > edition dts.
>> >
>>
>> Okay. Here are the differences between Ficus and Rock960 CE:
>>
>> 1. Different host enable GPIO for USB (vcc5v0_host)
>> 2. Different power and reset for PCI-E (vcc3v3_pcie, pcie0)
>> 3. No Ethernet port on Rock960 (gmac)
>>
>> So, I would suggest keeping USB, PCI-E and GMAC related nodes on the board
>> specific devicetree and rest on the rk3399-rock960.dtsi. What do you think?
>>
>> Same applies to Linux also!
>

Sounds good. If you have some cycles to work on the dts/dtsi split,
that would be great.

> Yes, I think a rk3399-rock960.dtsi with the differences in two .dts
> would be great, and even better a single U-Boot which can detect the
> board and load the right DT, but I do think it should be a separate
> config to evb as Mani mentioned.
>

Sounds good too. That'd make board-specific hooks easier.

On the other side, the documentation should be
merged somewhere.

Seems nonsense to have a README per board,
with more or less the same instructions each time.

Thanks!
-- 
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/4] ARM: bootscript: Fix the nfsargs and addip in K+P's tpcboot.cmd

2018-08-31 Thread Lukasz Majewski
The quotes around ${bootargs} were missing as we elaborate those variables
twice - once when we "setenv" the command and secondly when we "run" it.
Without quotes we have just empty string in the second call.

Moreover there is an issue with line breaks - as the original commands
got truncated.

Signed-off-by: Lukasz Majewski 

---

 board/k+p/bootscripts/tpcboot.cmd | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/board/k+p/bootscripts/tpcboot.cmd 
b/board/k+p/bootscripts/tpcboot.cmd
index ebd2d4ec2a..e26fd72825 100644
--- a/board/k+p/bootscripts/tpcboot.cmd
+++ b/board/k+p/bootscripts/tpcboot.cmd
@@ -65,17 +65,14 @@ fi"
 #
 # Provide 'boot_nfs' command
 #
-setenv nfsargs "setenv bootargs root=/dev/nfs rw \
-   nfsroot=${serverip}:${rootpath},nolock,nfsvers=3"
-setenv addip "setenv bootargs ${bootargs} \
-   ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:\
-   ${hostname}:eth0:on"
+setenv nfsargs "setenv bootargs root=/dev/nfs rw 
nfsroot='${serverip}':'${rootpath}',nolock,nfsvers=3"
+setenv addip "setenv bootargs '${bootargs}' 
ip='${ipaddr}':'${serverip}':'${gatewayip}':'${netmask}':'${hostname}':eth0:on"
 
 setenv boot_nfs "
 if run download_kernel; then
run nfsargs;
run addip;
-   setenv bootargs ${bootargs} console=${console};
+   setenv bootargs '${bootargs}' console=${console};
 
run boot_fitImage;
 fi"
-- 
2.11.0

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


[U-Boot] [PATCH 4/4] ARM: bootscript: For nfsargs only use rootpath (and remove not needed serverip)

2018-08-31 Thread Lukasz Majewski
The serverip part is provided from DHCP server with
'option root-path "192.168.3.1:/srv/tftp/rootfs";' parameter in dhcpd.conf

Signed-off-by: Lukasz Majewski 
---

 board/k+p/bootscripts/tpcboot.cmd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/k+p/bootscripts/tpcboot.cmd 
b/board/k+p/bootscripts/tpcboot.cmd
index e26fd72825..0576e81140 100644
--- a/board/k+p/bootscripts/tpcboot.cmd
+++ b/board/k+p/bootscripts/tpcboot.cmd
@@ -65,7 +65,7 @@ fi"
 #
 # Provide 'boot_nfs' command
 #
-setenv nfsargs "setenv bootargs root=/dev/nfs rw 
nfsroot='${serverip}':'${rootpath}',nolock,nfsvers=3"
+setenv nfsargs "setenv bootargs root=/dev/nfs rw 
nfsroot='${rootpath}',nolock,nfsvers=3"
 setenv addip "setenv bootargs '${bootargs}' 
ip='${ipaddr}':'${serverip}':'${gatewayip}':'${netmask}':'${hostname}':eth0:on"
 
 setenv boot_nfs "
-- 
2.11.0

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


[U-Boot] [PATCH 2/4] ARM: bootscript: Replace tftpboot with dhcp when downloading kernel

2018-08-31 Thread Lukasz Majewski
The 'dhcp' command is more versatile as it allows working with the DHCP
server to obtain serverip, ipaddress and other network parameters.

The configuration necessary to obtain the serverip (dhcpd.conf):
option option-150 code 150 = ip-address;

and in the subnet definition:
option option-150 192.168.X.Y;

Signed-off-by: Lukasz Majewski 
---

 board/k+p/bootscripts/tpcboot.cmd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/k+p/bootscripts/tpcboot.cmd 
b/board/k+p/bootscripts/tpcboot.cmd
index 9290317730..ebd2d4ec2a 100644
--- a/board/k+p/bootscripts/tpcboot.cmd
+++ b/board/k+p/bootscripts/tpcboot.cmd
@@ -52,7 +52,7 @@ fi;"
 #
 # Provide 'boot_tftp_kernel' command
 #
-setenv download_kernel "tftpboot ${loadaddr} ${kernel_file}"
+setenv download_kernel "dhcp ${loadaddr} ${kernel_file}"
 
 setenv boot_tftp_kernel "
 if run download_kernel; then
-- 
2.11.0

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


[U-Boot] [PATCH 1/4] ARM: bootscript: Remove hard-coded rootpath from K+P's tpcboot.cmd

2018-08-31 Thread Lukasz Majewski
The 'rootpath' can be provided by DHCP server. Removing this line prevents
from overwriting it.

To do that on the DHCP server side (isc-dhcp-server) modify dhcpd.conf
and add 'option root-path "192.168.X.Y:/srv/tftp/rootfs";'

Signed-off-by: Lukasz Majewski 
---

 board/k+p/bootscripts/tpcboot.cmd | 1 -
 1 file changed, 1 deletion(-)

diff --git a/board/k+p/bootscripts/tpcboot.cmd 
b/board/k+p/bootscripts/tpcboot.cmd
index 16b93ebe3f..9290317730 100644
--- a/board/k+p/bootscripts/tpcboot.cmd
+++ b/board/k+p/bootscripts/tpcboot.cmd
@@ -65,7 +65,6 @@ fi"
 #
 # Provide 'boot_nfs' command
 #
-setenv rootpath "/srv/tftp/KP/rootfs"
 setenv nfsargs "setenv bootargs root=/dev/nfs rw \
nfsroot=${serverip}:${rootpath},nolock,nfsvers=3"
 setenv addip "setenv bootargs ${bootargs} \
-- 
2.11.0

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


Re: [U-Boot] [U-Boot, v4, 6/7] net: gmac_rockchip: Fix a register write in rk3328_gmac_set_to_rgmii

2018-08-31 Thread David.Wu

Hi Janine,

Thank you for the fix.

在 2018/8/28 14:25, Janine Hagemann 写道:

We have to use RK3328_RXCLK_DLY_ENA_GMAC_ENABLE instead of
RK3328_RXCLK_DLY_ENA_GMAC_MASK in rk3328_gmac_set_to_rgmii()
to enable the RX delay.
The MASK was used in a wrong way.

Signed-off-by: Janine Hagemann
Reviewed-by: Philipp Tomisch
Acked-by: Joe Hershberger


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


Re: [U-Boot] [U-Boot, v4, 7/7] net: gmac_rockchip: Add handeling for RGMII_ID/RXID/TXID

2018-08-31 Thread David.Wu

Hi Janine,

This patch looks good. Thank you for adding rgmii-id/rxid/txid.
Reviewed-by: David Wu 

在 2018/8/28 14:25, Janine Hagemann 写道:

Using PHY internal delays in combination with the phy-mode
rgmii-id/rxid/txid was not possible. Only rgmii was supported.

Now we can disable rockchip's gmac delay lines and also use
rgmii-id/rxid/txid.

Based on commit eaf70ad14cbb ("net: stmmac: dwmac-rk: Add
handling for RGMII_ID/RXID/TXID") for mainline linux kernel.

Signed-off-by: Janine Hagemann 
Acked-by: Joe Hershberger 
---
v4: No changes
---
  drivers/net/gmac_rockchip.c | 80 +++--
  1 file changed, 63 insertions(+), 17 deletions(-)

diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c
index 0f91731..c01ae75 100644
--- a/drivers/net/gmac_rockchip.c
+++ b/drivers/net/gmac_rockchip.c
@@ -24,6 +24,11 @@
  #include 
  #include "designware.h"
  
+DECLARE_GLOBAL_DATA_PTR;

+#define DELAY_ENABLE(soc, tx, rx) \
+   (((tx) ? soc##_TXCLK_DLY_ENA_GMAC_ENABLE : 
soc##_TXCLK_DLY_ENA_GMAC_DISABLE) | \
+   ((rx) ? soc##_RXCLK_DLY_ENA_GMAC_ENABLE : 
soc##_RXCLK_DLY_ENA_GMAC_DISABLE))
+
  /*
   * Platform data for the gmac
   *
@@ -286,8 +291,7 @@ static void rk3228_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)
 RK3228_RXCLK_DLY_ENA_GMAC_MASK |
 RK3228_TXCLK_DLY_ENA_GMAC_MASK,
 RK3228_GMAC_PHY_INTF_SEL_RGMII |
-RK3228_RXCLK_DLY_ENA_GMAC_ENABLE |
-RK3228_TXCLK_DLY_ENA_GMAC_ENABLE);
+DELAY_ENABLE(RK3228, pdata->tx_delay, pdata->rx_delay));
  
  	rk_clrsetreg(>mac_con[0],

 RK3228_CLK_RX_DL_CFG_GMAC_MASK |
@@ -310,8 +314,7 @@ static void rk3288_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)
 RK3288_TXCLK_DLY_ENA_GMAC_MASK |
 RK3288_CLK_RX_DL_CFG_GMAC_MASK |
 RK3288_CLK_TX_DL_CFG_GMAC_MASK,
-RK3288_RXCLK_DLY_ENA_GMAC_ENABLE |
-RK3288_TXCLK_DLY_ENA_GMAC_ENABLE |
+DELAY_ENABLE(RK3288, pdata->rx_delay, pdata->tx_delay) |
 pdata->rx_delay << RK3288_CLK_RX_DL_CFG_GMAC_SHIFT |
 pdata->tx_delay << RK3288_CLK_TX_DL_CFG_GMAC_SHIFT);
  }
@@ -350,8 +353,7 @@ static void rk3328_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)
 RK3328_RXCLK_DLY_ENA_GMAC_MASK |
 RK3328_TXCLK_DLY_ENA_GMAC_MASK,
 RK3328_GMAC_PHY_INTF_SEL_RGMII |
-RK3328_RXCLK_DLY_ENA_GMAC_ENABLE |
-RK3328_TXCLK_DLY_ENA_GMAC_ENABLE);
+DELAY_ENABLE(RK3328, pdata->tx_delay, pdata->rx_delay));
  
  	rk_clrsetreg(>mac_con[0],

 RK3328_CLK_RX_DL_CFG_GMAC_MASK |
@@ -392,8 +394,7 @@ static void rk3368_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)
 RK3368_TXCLK_DLY_ENA_GMAC_MASK |
 RK3368_CLK_RX_DL_CFG_GMAC_MASK |
 RK3368_CLK_TX_DL_CFG_GMAC_MASK,
-RK3368_RXCLK_DLY_ENA_GMAC_ENABLE |
-RK3368_TXCLK_DLY_ENA_GMAC_ENABLE |
+DELAY_ENABLE(RK3368, pdata->tx_delay, pdata->rx_delay) |
 pdata->rx_delay << RK3368_CLK_RX_DL_CFG_GMAC_SHIFT |
 pdata->tx_delay << RK3368_CLK_TX_DL_CFG_GMAC_SHIFT);
  }
@@ -413,8 +414,7 @@ static void rk3399_gmac_set_to_rgmii(struct 
gmac_rockchip_platdata *pdata)
 RK3399_TXCLK_DLY_ENA_GMAC_MASK |
 RK3399_CLK_RX_DL_CFG_GMAC_MASK |
 RK3399_CLK_TX_DL_CFG_GMAC_MASK,
-RK3399_RXCLK_DLY_ENA_GMAC_ENABLE |
-RK3399_TXCLK_DLY_ENA_GMAC_ENABLE |
+DELAY_ENABLE(RK3399, pdata->tx_delay, pdata->rx_delay) |
 pdata->rx_delay << RK3399_CLK_RX_DL_CFG_GMAC_SHIFT |
 pdata->tx_delay << RK3399_CLK_TX_DL_CFG_GMAC_SHIFT);
  }
@@ -451,40 +451,86 @@ static int gmac_rockchip_probe(struct udevice *dev)
  
  	switch (eth_pdata->phy_interface) {

case PHY_INTERFACE_MODE_RGMII:
+   /* Set to RGMII mode */
+   if (ops->set_to_rgmii)
+   ops->set_to_rgmii(pdata);
+   else
+   return -EPERM;
+
/*
 * If the gmac clock is from internal pll, need to set and
 * check the return value for gmac clock at RGMII mode. If
 * the gmac clock is from external source, the clock rate
 * is not set, because of it is bypassed.
 */
+
if (!pdata->clock_input) {
rate = clk_set_rate(, 12500);
if (rate != 12500)
return -EINVAL;
}
+   break;
  
+	case 

Re: [U-Boot] [PATCH 0/2] Add Rock960 board support

2018-08-31 Thread Peter Robinson
> On Thu, Aug 30, 2018 at 12:44:00AM -0300, Ezequiel Garcia wrote:
> > On 30 August 2018 at 00:00, Manivannan Sadhasivam
> >  wrote:
> > > Hi Ezequiel,
> > >
> > > On Wed, Aug 29, 2018 at 03:11:17AM -0300, Ezequiel Garcia wrote:
> > >> Hi Manivannan,
> > >>
> > >> On 21 August 2018 at 14:09, Manivannan Sadhasivam
> > >>  wrote:
> > >> > This patchset adds board support for Vamrs Limited Rock960,
> > >> > which is one of the 96Boards Consumer Edition platform based
> > >> > on Rockchip RK3399 SoC.
> > >> >
> > >>
> > >> What are the differences between this consumer edition board,
> > >> and the enterprise edition (aka Ficus) Vamrs board?
> > >>
> > >
> > > I asked Vamrs about this and they said the difference is very minimal.
> > >
> >
> > In that case, you should try to leverage the Linux ficus.dts:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-ficus.dts
> >
> > If no differences, using the ficus dts should do. If there are differences,
> > we can create a common rock960.dtsi and then enterprise and consumer
> > edition dts.
> >
>
> Okay. Here are the differences between Ficus and Rock960 CE:
>
> 1. Different host enable GPIO for USB (vcc5v0_host)
> 2. Different power and reset for PCI-E (vcc3v3_pcie, pcie0)
> 3. No Ethernet port on Rock960 (gmac)
>
> So, I would suggest keeping USB, PCI-E and GMAC related nodes on the board
> specific devicetree and rest on the rk3399-rock960.dtsi. What do you think?
>
> Same applies to Linux also!

Yes, I think a rk3399-rock960.dtsi with the differences in two .dts
would be great, and even better a single U-Boot which can detect the
board and load the right DT, but I do think it should be a separate
config to evb as Mani mentioned.

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


[U-Boot] [PATCH] mmc: dw_mmc: set host_caps mmc modes to equivalent buswidth and lower

2018-08-31 Thread Jan Havran
dwmci_setup_cfg was clearing all modes except the mode equivalent to
required bus width. Moreover, for buswidth = 1 was set the 4-bit mode.

This sets host caps to all modes from 1-bit up to required mode.

Signed-off-by: Jan Havran 
---
 drivers/mmc/dw_mmc.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 13180fc0d6..8aa8362359 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -501,11 +501,13 @@ void dwmci_setup_cfg(struct mmc_config *cfg, struct 
dwmci_host *host,
cfg->host_caps = host->caps;
 
if (host->buswidth == 8) {
-   cfg->host_caps |= MMC_MODE_8BIT;
-   cfg->host_caps &= ~MMC_MODE_4BIT;
-   } else {
-   cfg->host_caps |= MMC_MODE_4BIT;
+   cfg->host_caps |= MMC_MODE_8BIT | MMC_MODE_4BIT | MMC_MODE_1BIT;
+   } else if (host->buswidth == 4) {
cfg->host_caps &= ~MMC_MODE_8BIT;
+   cfg->host_caps |= MMC_MODE_4BIT | MMC_MODE_1BIT;
+   } else {
+   cfg->host_caps &= ~MMC_MODE_8BIT & ~MMC_MODE_4BIT;
+   cfg->host_caps |= MMC_MODE_1BIT;
}
cfg->host_caps |= MMC_MODE_HS | MMC_MODE_HS_52MHz;
 
-- 
2.18.0

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


Re: [U-Boot] [PATCH v3 27/58] fastboot: sunxi: Update fastboot mmc default device

2018-08-31 Thread Maxime Ripard
On Mon, Aug 27, 2018 at 02:50:32PM +0530, Jagan Teki wrote:
> On Wed, Aug 22, 2018 at 10:13 PM, Maxime Ripard
>  wrote:
> > On Tue, Aug 21, 2018 at 10:27:38PM +0530, Jagan Teki wrote:
> >> On Mon, Aug 20, 2018 at 5:14 PM, Maxime Ripard
> >>  wrote:
> >> > On Sun, Aug 19, 2018 at 07:26:44PM +0530, Jagan Teki wrote:
> >> >> Usually eMMC is default mmc device for fastboot.
> >> >>
> >> >> By enabling DM_MMC, the mmc devices are probed as per
> >> >> DT status not with respect to MMC_SUNXI_SLOT_EXTRA in
> >> >> U-Boot proper.
> >> >>
> >> >> Allwinner SoC has maximum of 4 mmc controllers start from
> >> >> mmc0...mmc3 on which mmc2 can be used an eMMC controller
> >> >> eventhough mmc3 some boards used as eMMC.
> >> >>
> >> >> So, update the default fastboot device as 2 to make the
> >> >> standard usage irrespective of DT node status.
> >> >>
> >> >> Other corner cases like different device usage, or specific
> >> >> mmc node status is not enabled in order in DTS must explicitly
> >> >> add config on the specific defconfig file.
> >> >>
> >> >> Cc: Olliver Schinagl 
> >> >> Cc: Chen-Yu Tsai 
> >> >> Signed-off-by: Jagan Teki 
> >> >
> >> > This breaks all existing users, since if DM_MMC isn't set (and it
> >> > isn't at the moment), the MMC IDs won't change, and you're changing it
> >> > from either 0 or 1 to 2.
> >>
> >> True, bisectable issue. will take care on next version.
> >>
> >> >
> >> > Can't we have a DT property instead? It looks much better than having
> >> > to deal with a non stable ID in Kconfig.
> >>
> >> What do you mean by DT property handle? mmc2 is eMMC in all sunXi
> >> isn't? ie reason I make it default.
> >
> > I meant to select the fastboot and environment devices. That way, each
> > board can select the one it wants in a truly deterministic way.
> 
> ie what get_env_fat_dev_part is doing. Identify the dev no.of
> initialized mmc or emmc. are you referring something like this?

Yep, but through a DT property instead of some code.

Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


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


[U-Boot] [PATCH] imx: missing CONFIG_MII in mx7dsabresd_qspi_defconfig

2018-08-31 Thread Stefano Babic
CONFIG_CMD_MII is set without CONFIG_MII, build is broken.

Signed-off-by: Stefano Babic 
---
 configs/mx7dsabresd_qspi_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/mx7dsabresd_qspi_defconfig 
b/configs/mx7dsabresd_qspi_defconfig
index a79880482f..53894e66f1 100644
--- a/configs/mx7dsabresd_qspi_defconfig
+++ b/configs/mx7dsabresd_qspi_defconfig
@@ -53,6 +53,7 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_EON=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_BAR=y
+CONFIG_MII=y
 CONFIG_PHYLIB=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
-- 
2.17.1

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


Re: [U-Boot] [PATCH 0/2] Add Rock960 board support

2018-08-31 Thread Manivannan Sadhasivam
On Thu, Aug 30, 2018 at 12:44:00AM -0300, Ezequiel Garcia wrote:
> On 30 August 2018 at 00:00, Manivannan Sadhasivam
>  wrote:
> > Hi Ezequiel,
> >
> > On Wed, Aug 29, 2018 at 03:11:17AM -0300, Ezequiel Garcia wrote:
> >> Hi Manivannan,
> >>
> >> On 21 August 2018 at 14:09, Manivannan Sadhasivam
> >>  wrote:
> >> > This patchset adds board support for Vamrs Limited Rock960,
> >> > which is one of the 96Boards Consumer Edition platform based
> >> > on Rockchip RK3399 SoC.
> >> >
> >>
> >> What are the differences between this consumer edition board,
> >> and the enterprise edition (aka Ficus) Vamrs board?
> >>
> >
> > I asked Vamrs about this and they said the difference is very minimal.
> >
> 
> In that case, you should try to leverage the Linux ficus.dts:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399-ficus.dts
> 
> If no differences, using the ficus dts should do. If there are differences,
> we can create a common rock960.dtsi and then enterprise and consumer
> edition dts.
>

Okay. Here are the differences between Ficus and Rock960 CE:

1. Different host enable GPIO for USB (vcc5v0_host)
2. Different power and reset for PCI-E (vcc3v3_pcie, pcie0)
3. No Ethernet port on Rock960 (gmac)

So, I would suggest keeping USB, PCI-E and GMAC related nodes on the board
specific devicetree and rest on the rk3399-rock960.dtsi. What do you think?

Same applies to Linux also!

Thanks,
Mani

> >> Perhaps the devicetree and the board support can be
> >> shared with ficus support?
> >>
> >
> > I'm fine with it but you seem to have added Ficus board under
> > evb_rk3399 which I think not the good place. Since the board
> > manufacturer is different, I would suggest you to place it under
> > boards/vamrs as I have done here. Also with more boards coming from
> > Vamrs, this makes much more sense.
> >
> > Please let me know your thoughts!
> >
> 
> Well, I've reused the evb support, because there was no reason
> to have board-specific code. If we have now a reason, then of course
> having a board dir makes sense.
> 
> When possible, we should try to avoid code duplication and scattering.
> For instance, the instructions in the README look RK3399 generic
> and not board specific. We should consolidate that.
> -- 
> Ezequiel García, VanguardiaSur
> www.vanguardiasur.com.ar
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC 1/3] test/py: convert fs-test.sh to pytest

2018-08-31 Thread Alexander Graf


> Am 31.08.2018 um 09:31 schrieb AKASHI Takahiro :
> 
>> On Wed, Aug 29, 2018 at 11:36:51PM +0200, Heinrich Schuchardt wrote:
>>> On 08/23/2018 09:25 AM, AKASHI Takahiro wrote:
>>> In this commit, the same set of test cases as in test/fs/fs-test.sh
>>> is provided using pytest framework.
>>> Actually, fs-test.sh provides three variants:"sb" (sb command), "nonfs"
>>> (fatxx and etc.) and "fs" (hostfs), and this patch currently supports
>>> only "nonfs" variant; So it is not a replacement of fs-test.sh for now.
>>> 
>>> Simple usage:
>>>  $ py.test test/py/tests/test_fs []
>>> 
>>> You may also specify filesystem types to be tested:
>>>  $ py.test test/py/tests/test_fs --fs-type fat32 []
>>> 
>>> Signed-off-by: AKASHI Takahiro 
>>> ---
>>> test/py/tests/test_fs/conftest.py| 175 +++
>>> test/py/tests/test_fs/fstest_defs.py |  10 ++
>>> test/py/tests/test_fs/test_basic.py  | 246 +++
>>> 3 files changed, 431 insertions(+)
>>> create mode 100644 test/py/tests/test_fs/conftest.py
>>> create mode 100644 test/py/tests/test_fs/fstest_defs.py
>>> create mode 100644 test/py/tests/test_fs/test_basic.py
>>> 
>>> diff --git a/test/py/tests/test_fs/conftest.py 
>>> b/test/py/tests/test_fs/conftest.py
>>> new file mode 100644
>>> index ..fefeb4c9663f
>>> --- /dev/null
>>> +++ b/test/py/tests/test_fs/conftest.py
>>> @@ -0,0 +1,175 @@
>>> +# SPDX-License-Identifier:  GPL-2.0+
>>> +# Copyright (c) 2018, Linaro Limited
>>> +# Author: Takahiro Akashi 
>>> +
>>> +import pytest
>>> +import re
>>> +from subprocess import call, check_call, check_output, CalledProcessError
>>> +from fstest_defs import *
>>> +
>>> +supported_fs_basic = ['fat16', 'fat32', 'ext4']
>>> +
>>> +#
>>> +# Filesystem test specific setup
>>> +#
>>> +def pytest_addoption(parser):
>>> +parser.addoption('--fs-type', action='append', default=None,
>>> +help='Targeting Filesystem Types')
>>> +
>>> +def pytest_configure(config):
>>> +global supported_fs_basic
>>> +
>>> +def intersect(listA, listB):
>>> +return  [x for x in listA if x in listB]
>>> +
>>> +supported_fs = config.getoption('fs_type')
>>> +if supported_fs:
>>> +print("*** FS TYPE modified: %s" % supported_fs)
>>> +supported_fs_basic =  intersect(supported_fs, supported_fs_basic)
>>> +
>>> +def pytest_generate_tests(metafunc):
>>> +if 'fs_obj_basic' in metafunc.fixturenames:
>>> +metafunc.parametrize('fs_obj_basic', supported_fs_basic,
>>> +indirect=True, scope='module')
>>> +
>>> +#
>>> +# Helper functions
>>> +#
>>> +def fstype_to_ubname(fs_type):
>>> +if re.match('fat', fs_type):
>>> +return 'fat'
>>> +else:
>>> +return fs_type
>>> +
>>> +def check_ubconfig(config, fs_type):
>>> +if not config.buildconfig.get('config_cmd_%s' % fs_type, None):
>>> +pytest.skip('.config feature "CMD_%s" not enabled' % 
>>> fs_type.upper())
>>> +if not config.buildconfig.get('config_%s_write' % fs_type, None):
>>> +pytest.skip('.config feature "%s_WRITE" not enabled'
>>> +% fs_type.upper())
>>> +
>>> +def mk_fs(config, fs_type, size, id):
>>> +fs_img = '%s.%s.img' % (id, fs_type)
>>> +fs_img = config.persistent_data_dir + '/' + fs_img
>>> +
>>> +if fs_type == 'fat16':
>>> +mkfs_opt = '-F 16'
>>> +elif fs_type == 'fat32':
>>> +mkfs_opt = '-F 32'
>>> +else:
>>> +mkfs_opt = ''
>>> +
>>> +if re.match('fat', fs_type):
>>> +fs_lnxtype = 'vfat'
>>> +else:
>>> +fs_lnxtype = fs_type
>>> +
>>> +count = (size + 1023) / 1024
>>> +
>>> +try:
>>> +check_call('rm -f %s' % fs_img, shell=True)
>>> +check_call('dd if=/dev/zero of=%s bs=1K count=%d'
>>> +% (fs_img, count), shell=True)
>>> +check_call('mkfs.%s %s %s'
>>> +% (fs_lnxtype, mkfs_opt, fs_img), shell=True)
>>> +return fs_img
>>> +except CalledProcessError:
>>> +call('rm -f %s' % fs_img, shell=True)
>>> +raise
>>> +
>>> +#
>>> +# Fixture for basic fs test
>>> +# derived from test/fs/fs-test.sh
>>> +#
>>> +# NOTE: yield_fixture was deprecated since pytest-3.0
>>> +@pytest.yield_fixture()
>>> +def fs_obj_basic(request, u_boot_config):
>>> +fs_type = request.param
>>> +fs_img = ''
>>> +
>>> +fs_ubtype = fstype_to_ubname(fs_type)
>>> +check_ubconfig(u_boot_config, fs_ubtype)
>>> +
>>> +mount_dir = u_boot_config.persistent_data_dir + '/mnt'
>>> +small_file = mount_dir + '/' + SMALL_FILE
>>> +big_file = mount_dir + '/' + BIG_FILE
>>> +try:
>>> +
>>> +# 3GiB volume
>>> +fs_img = mk_fs(u_boot_config, fs_type, 0xc000, '3GB')
>>> +
>>> +# Mount the image so we can populate it.
>>> +check_call('mkdir -p %s' % mount_dir, shell=True)
>>> +check_call('sudo mount -o loop,rw %s %s'
>>> +% (fs_img, mount_dir), shell=True)
>> 
>> Should I grant sudo to anybody who can 

Re: [U-Boot] [PATCH v2 11/15] configs: sandbox: enable CONFIG_TEE (TEE uclass)

2018-08-31 Thread Jens Wiklander
On Wed, Aug 29, 2018 at 06:29:02PM -0600, Simon Glass wrote:
> On 23 August 2018 at 04:43, Jens Wiklander  wrote:
> > Signed-off-by: Jens Wiklander 
> > ---
> >  configs/sandbox64_defconfig| 1 +
> >  configs/sandbox_defconfig  | 1 +
> >  configs/sandbox_flattree_defconfig | 1 +
> >  configs/sandbox_noblk_defconfig| 1 +
> >  configs/sandbox_spl_defconfig  | 1 +
> >  5 files changed, 5 insertions(+)
> >
> 
> Can you move this to an 'imply' in arch/Kconfig?

Will do.

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


Re: [U-Boot] [PATCH v2 10/15] sandbox: dt: add sandbox_tee node

2018-08-31 Thread Jens Wiklander
On Wed, Aug 29, 2018 at 06:28:59PM -0600, Simon Glass wrote:
> On 23 August 2018 at 04:43, Jens Wiklander  wrote:
> > Adds a sandbox_tee node to enable the sandbox tee driver in all the
> > sandbox dts files.
> >
> > Signed-off-by: Jens Wiklander 
> > ---
> >  arch/sandbox/dts/sandbox.dts   | 4 
> >  arch/sandbox/dts/sandbox64.dts | 4 
> >  arch/sandbox/dts/test.dts  | 4 
> >  3 files changed, 12 insertions(+)
> >
> 
> Reviewed-by: Simon Glass 
> 
> BTW it's only the test.dts one that matters for tests. But it's fine
> to add this in the others.

OK.

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


Re: [U-Boot] [PATCH v2 08/15] Documentation: tee uclass and op-tee driver

2018-08-31 Thread Jens Wiklander
Hi Simon,

On Wed, Aug 29, 2018 at 06:28:54PM -0600, Simon Glass wrote:
> Hi Jens,
> 
> On 23 August 2018 at 04:43, Jens Wiklander  wrote:
> > Signed-off-by: Jens Wiklander 
> > ---
> >  doc/README.tee | 112 +
> >  1 file changed, 112 insertions(+)
> >  create mode 100644 doc/README.tee
> 
> Reviewed-by: Simon Glass 
> 
> Looks good, nits below.
> 
> 
> >
> > diff --git a/doc/README.tee b/doc/README.tee
> > new file mode 100644
> > index ..e9c9ef67877a
> > --- /dev/null
> > +++ b/doc/README.tee
> > @@ -0,0 +1,112 @@
> > +=
> > +TEE uclass
> > +=
> > +
> > +This document describes the TEE uclass in U-boot
> 
> U-Boot
> 
> (please can you check all your patches for that? There are more below)

Yes, I'll check them all.

> 
> > +
> > +A TEE (Trusted Execution Environment) is a trusted OS running in some
> > +secure environment, for example, TrustZone on ARM CPUs, or a separate
> > +secure co-processor etc. A TEE driver handles the details needed to
> > +communicate with the TEE.
> > +
> > +This uclass deals with:
> > +
> > +- Registration of TEE drivers
> > +
> > +- Managing shared memory between U-boot and the TEE
> > +
> > +- Providing a generic API to the TEE
> > +
> > +The TEE interface
> > +=
> > +
> > +include/tee.h defines the generic interface to a TEE.
> > +
> > +A client finds the TEE device via tee_find_device(). Other important 
> > functions
> > +when interfacing with a TEE are:
> > +
> > +- tee_shm_alloc(), tee_shm_register() and tee_shm_free() to manage shared
> > +  memory objects often needed when communicating with the TEE.
> > +
> > +- tee_get_version() lets the client know which the capabilities of the TEE
> > +  device.
> > +
> > +- tee_open_session() opens a session to a Trusted Application
> > +
> > +- tee_invoke_func() invokes a function in a Trusted Application
> > +
> > +- tee_close_session() closes a session to a Trusted Application
> > +
> > +Much of the communication between clients and the TEE is opaque to the
> > +driver. The main job for the driver is to receive requests from the
> > +clients, forward them to the TEE and send back the results.
> > +
> > +OP-TEE driver
> > +=
> > +
> > +The OP-TEE driver handles OP-TEE [1] based TEEs. Currently it is only the 
> > ARM
> > +TrustZone based OP-TEE solution that is supported.
> 
> In fact, wouldn't other things be supported by different drivers?
> 
> Perhaps you should name your driver to indicate it is only for ARM?

The OP-TEE Message prototol isn't tied to ARM only and OP-TEE has been
or is used on at least one other architecture (not open sourced though).
I think that only small changes will be needed in the the OP-TEE driver
to support a different architecture as long as shared memory still can
be used. I'd rather keep the name as just "optee" until we know what we
need to adapt to.

> 
> > +
> > +Lowest level of communication with OP-TEE builds on ARM SMC Calling
> > +Convention (SMCCC) [2], which is the foundation for OP-TEE's SMC interface
> > +[3] used internally by the driver. Stacked on top of that is OP-TEE Message
> > +Protocol [4].
> > +
> > +OP-TEE SMC interface provides the basic functions required by SMCCC and 
> > some
> > +additional functions specific for OP-TEE. The most interesting functions 
> > are:
> > +
> > +- OPTEE_SMC_FUNCID_CALLS_UID (part of SMCCC) returns the version 
> > information
> > +  which is then returned by TEE_IOC_VERSION
> > +
> > +- OPTEE_SMC_CALL_GET_OS_UUID returns the particular OP-TEE implementation, 
> > used
> > +  to tell, for instance, a TrustZone OP-TEE apart from an OP-TEE running 
> > on a
> > +  separate secure co-processor.
> > +
> > +- OPTEE_SMC_CALL_WITH_ARG drives the OP-TEE message protocol
> > +
> > +- OPTEE_SMC_GET_SHM_CONFIG lets the driver and OP-TEE agree on which memory
> > +  range to used for shared memory between Linux and OP-TEE.
> > +
> > +The GlobalPlatform TEE Client API [5] is implemented on top of the generic
> > +TEE API.
> > +
> > +Picture of the relationship between the different components in the
> > +OP-TEE architecture:
> > +
> > +   U-boot  Secure world
> > +   ~~  
> > + ++   +-+
> > + | Client |   | Trusted |
> > + ||   | Application |
> > + ++   +-+
> > +   /\   /\
> > +   ||   ||
> > +   \/   \/
> > + ++   +-+
> > + | TEE|   | TEE Internal|
> > + | uclass |   | API |
> > + ++   +-+
> > + | OP-TEE |  

Re: [U-Boot] [RFC 1/3] test/py: convert fs-test.sh to pytest

2018-08-31 Thread AKASHI Takahiro
On Wed, Aug 29, 2018 at 11:36:51PM +0200, Heinrich Schuchardt wrote:
> On 08/23/2018 09:25 AM, AKASHI Takahiro wrote:
> > In this commit, the same set of test cases as in test/fs/fs-test.sh
> > is provided using pytest framework.
> > Actually, fs-test.sh provides three variants:"sb" (sb command), "nonfs"
> > (fatxx and etc.) and "fs" (hostfs), and this patch currently supports
> > only "nonfs" variant; So it is not a replacement of fs-test.sh for now.
> > 
> > Simple usage:
> >   $ py.test test/py/tests/test_fs []
> > 
> > You may also specify filesystem types to be tested:
> >   $ py.test test/py/tests/test_fs --fs-type fat32 []
> > 
> > Signed-off-by: AKASHI Takahiro 
> > ---
> >  test/py/tests/test_fs/conftest.py| 175 +++
> >  test/py/tests/test_fs/fstest_defs.py |  10 ++
> >  test/py/tests/test_fs/test_basic.py  | 246 +++
> >  3 files changed, 431 insertions(+)
> >  create mode 100644 test/py/tests/test_fs/conftest.py
> >  create mode 100644 test/py/tests/test_fs/fstest_defs.py
> >  create mode 100644 test/py/tests/test_fs/test_basic.py
> > 
> > diff --git a/test/py/tests/test_fs/conftest.py 
> > b/test/py/tests/test_fs/conftest.py
> > new file mode 100644
> > index ..fefeb4c9663f
> > --- /dev/null
> > +++ b/test/py/tests/test_fs/conftest.py
> > @@ -0,0 +1,175 @@
> > +# SPDX-License-Identifier:  GPL-2.0+
> > +# Copyright (c) 2018, Linaro Limited
> > +# Author: Takahiro Akashi 
> > +
> > +import pytest
> > +import re
> > +from subprocess import call, check_call, check_output, CalledProcessError
> > +from fstest_defs import *
> > +
> > +supported_fs_basic = ['fat16', 'fat32', 'ext4']
> > +
> > +#
> > +# Filesystem test specific setup
> > +#
> > +def pytest_addoption(parser):
> > +parser.addoption('--fs-type', action='append', default=None,
> > +help='Targeting Filesystem Types')
> > +
> > +def pytest_configure(config):
> > +global supported_fs_basic
> > +
> > +def intersect(listA, listB):
> > +return  [x for x in listA if x in listB]
> > +
> > +supported_fs = config.getoption('fs_type')
> > +if supported_fs:
> > +print("*** FS TYPE modified: %s" % supported_fs)
> > +supported_fs_basic =  intersect(supported_fs, supported_fs_basic)
> > +
> > +def pytest_generate_tests(metafunc):
> > +if 'fs_obj_basic' in metafunc.fixturenames:
> > +metafunc.parametrize('fs_obj_basic', supported_fs_basic,
> > +indirect=True, scope='module')
> > +
> > +#
> > +# Helper functions
> > +#
> > +def fstype_to_ubname(fs_type):
> > +if re.match('fat', fs_type):
> > +return 'fat'
> > +else:
> > +return fs_type
> > +
> > +def check_ubconfig(config, fs_type):
> > +if not config.buildconfig.get('config_cmd_%s' % fs_type, None):
> > +pytest.skip('.config feature "CMD_%s" not enabled' % 
> > fs_type.upper())
> > +if not config.buildconfig.get('config_%s_write' % fs_type, None):
> > +pytest.skip('.config feature "%s_WRITE" not enabled'
> > +% fs_type.upper())
> > +
> > +def mk_fs(config, fs_type, size, id):
> > +fs_img = '%s.%s.img' % (id, fs_type)
> > +fs_img = config.persistent_data_dir + '/' + fs_img
> > +
> > +if fs_type == 'fat16':
> > +mkfs_opt = '-F 16'
> > +elif fs_type == 'fat32':
> > +mkfs_opt = '-F 32'
> > +else:
> > +mkfs_opt = ''
> > +
> > +if re.match('fat', fs_type):
> > +fs_lnxtype = 'vfat'
> > +else:
> > +fs_lnxtype = fs_type
> > +
> > +count = (size + 1023) / 1024
> > +
> > +try:
> > +check_call('rm -f %s' % fs_img, shell=True)
> > +check_call('dd if=/dev/zero of=%s bs=1K count=%d'
> > +% (fs_img, count), shell=True)
> > +check_call('mkfs.%s %s %s'
> > +% (fs_lnxtype, mkfs_opt, fs_img), shell=True)
> > +return fs_img
> > +except CalledProcessError:
> > +call('rm -f %s' % fs_img, shell=True)
> > +raise
> > +
> > +#
> > +# Fixture for basic fs test
> > +# derived from test/fs/fs-test.sh
> > +#
> > +# NOTE: yield_fixture was deprecated since pytest-3.0
> > +@pytest.yield_fixture()
> > +def fs_obj_basic(request, u_boot_config):
> > +fs_type = request.param
> > +fs_img = ''
> > +
> > +fs_ubtype = fstype_to_ubname(fs_type)
> > +check_ubconfig(u_boot_config, fs_ubtype)
> > +
> > +mount_dir = u_boot_config.persistent_data_dir + '/mnt'
> > +small_file = mount_dir + '/' + SMALL_FILE
> > +big_file = mount_dir + '/' + BIG_FILE
> > +try:
> > +
> > +# 3GiB volume
> > +fs_img = mk_fs(u_boot_config, fs_type, 0xc000, '3GB')
> > +
> > +# Mount the image so we can populate it.
> > +check_call('mkdir -p %s' % mount_dir, shell=True)
> > +check_call('sudo mount -o loop,rw %s %s'
> > +% (fs_img, mount_dir), shell=True)
> 
> Should I grant sudo to anybody who can commit to U-Boot?
> 
> Just use exfat-fuse and 

Re: [U-Boot] [RFC 1/3] test/py: convert fs-test.sh to pytest

2018-08-31 Thread AKASHI Takahiro
Hi Tuomas,

Thank you for interesting pointers.

On Thu, Aug 30, 2018 at 01:56:41PM +0300, Tuomas Tynkkynen wrote:
> Hi Heinrich, Takahiro
> 
> On 08/30/2018 01:26 PM, AKASHI Takahiro wrote:
> >On Thu, Aug 30, 2018 at 12:01:32PM +0200, Heinrich Schuchardt wrote:
> >>On 08/30/2018 08:52 AM, AKASHI Takahiro wrote:
> >>>On Wed, Aug 29, 2018 at 11:36:51PM +0200, Heinrich Schuchardt wrote:
> On 08/23/2018 09:25 AM, AKASHI Takahiro wrote:
> >In this commit, the same set of test cases as in test/fs/fs-test.sh
> >is provided using pytest framework.
> >Actually, fs-test.sh provides three variants:"sb" (sb command), "nonfs"
> >(fatxx and etc.) and "fs" (hostfs), and this patch currently supports
> >only "nonfs" variant; So it is not a replacement of fs-test.sh for now.
> >
> >Simple usage:
> >   $ py.test test/py/tests/test_fs []
> >
> >You may also specify filesystem types to be tested:
> >   $ py.test test/py/tests/test_fs --fs-type fat32 []
> >
> >Signed-off-by: AKASHI Takahiro 
> >---
> >  test/py/tests/test_fs/conftest.py| 175 +++
> >  test/py/tests/test_fs/fstest_defs.py |  10 ++
> >  test/py/tests/test_fs/test_basic.py  | 246 +++
> >  3 files changed, 431 insertions(+)
> >  create mode 100644 test/py/tests/test_fs/conftest.py
> >  create mode 100644 test/py/tests/test_fs/fstest_defs.py
> >  create mode 100644 test/py/tests/test_fs/test_basic.py
> >
> >diff --git a/test/py/tests/test_fs/conftest.py 
> >b/test/py/tests/test_fs/conftest.py
> >new file mode 100644
> >index ..fefeb4c9663f
> >--- /dev/null
> >+++ b/test/py/tests/test_fs/conftest.py
> >@@ -0,0 +1,175 @@
> >+# SPDX-License-Identifier:  GPL-2.0+
> >+# Copyright (c) 2018, Linaro Limited
> >+# Author: Takahiro Akashi 
> >+
> >+import pytest
> >+import re
> >+from subprocess import call, check_call, check_output, 
> >CalledProcessError
> >+from fstest_defs import *
> >+
> >+supported_fs_basic = ['fat16', 'fat32', 'ext4']
> >+
> >+#
> >+# Filesystem test specific setup
> >+#
> >+def pytest_addoption(parser):
> >+parser.addoption('--fs-type', action='append', default=None,
> >+help='Targeting Filesystem Types')
> >+
> >+def pytest_configure(config):
> >+global supported_fs_basic
> >+
> >+def intersect(listA, listB):
> >+return  [x for x in listA if x in listB]
> >+
> >+supported_fs = config.getoption('fs_type')
> >+if supported_fs:
> >+print("*** FS TYPE modified: %s" % supported_fs)
> >+supported_fs_basic =  intersect(supported_fs, 
> >supported_fs_basic)
> >+
> >+def pytest_generate_tests(metafunc):
> >+if 'fs_obj_basic' in metafunc.fixturenames:
> >+metafunc.parametrize('fs_obj_basic', supported_fs_basic,
> >+indirect=True, scope='module')
> >+
> >+#
> >+# Helper functions
> >+#
> >+def fstype_to_ubname(fs_type):
> >+if re.match('fat', fs_type):
> >+return 'fat'
> >+else:
> >+return fs_type
> >+
> >+def check_ubconfig(config, fs_type):
> >+if not config.buildconfig.get('config_cmd_%s' % fs_type, None):
> >+pytest.skip('.config feature "CMD_%s" not enabled' % 
> >fs_type.upper())
> >+if not config.buildconfig.get('config_%s_write' % fs_type, None):
> >+pytest.skip('.config feature "%s_WRITE" not enabled'
> >+% fs_type.upper())
> >+
> >+def mk_fs(config, fs_type, size, id):
> >+fs_img = '%s.%s.img' % (id, fs_type)
> >+fs_img = config.persistent_data_dir + '/' + fs_img
> >+
> >+if fs_type == 'fat16':
> >+mkfs_opt = '-F 16'
> >+elif fs_type == 'fat32':
> >+mkfs_opt = '-F 32'
> >+else:
> >+mkfs_opt = ''
> >+
> >+if re.match('fat', fs_type):
> >+fs_lnxtype = 'vfat'
> >+else:
> >+fs_lnxtype = fs_type
> >+
> >+count = (size + 1023) / 1024
> >+
> >+try:
> >+check_call('rm -f %s' % fs_img, shell=True)
> >+check_call('dd if=/dev/zero of=%s bs=1K count=%d'
> >+% (fs_img, count), shell=True)
> >+check_call('mkfs.%s %s %s'
> >+% (fs_lnxtype, mkfs_opt, fs_img), shell=True)
> >+return fs_img
> >+except CalledProcessError:
> >+call('rm -f %s' % fs_img, shell=True)
> >+raise
> >+
> >+#
> >+# Fixture for basic fs test
> >+# derived from test/fs/fs-test.sh
> >+#
> >+# NOTE: yield_fixture was deprecated since pytest-3.0
> >+@pytest.yield_fixture()
> >+def fs_obj_basic(request, u_boot_config):
> >+fs_type = request.param
> >+fs_img = ''
> >+
> 

Re: [U-Boot] [PATCH v2 07/15] tee: add OP-TEE driver

2018-08-31 Thread Jens Wiklander
On Wed, Aug 29, 2018 at 06:28:51PM -0600, Simon Glass wrote:
> Hi Jens,
> 
> On 23 August 2018 at 04:43, Jens Wiklander  wrote:
> > Adds a OP-TEE driver.
> >
> > * Targets ARM and ARM64
> > * Supports using any u-boot memory as shared memory
> 
> U-Boot
> 
> Please use this consistent.

Sorry, it seems I've found lots of ways of doing that wrong.

> 
> > * Probes OP-TEE version using SMCs
> > * Uses OPTEE message protocol version 2 to communicate with secure world
> >
> > Tested-by: Igor Opaniuk 
> > Signed-off-by: Jens Wiklander 
> > ---
> >  drivers/tee/Kconfig  |  10 +
> >  drivers/tee/Makefile |   1 +
> >  drivers/tee/optee/Kconfig|   7 +
> >  drivers/tee/optee/Makefile   |   4 +
> >  drivers/tee/optee/core.c | 614 +++
> >  drivers/tee/optee/optee_msg.h| 423 
> >  drivers/tee/optee/optee_msg_supplicant.h | 234 +
> >  drivers/tee/optee/optee_private.h|  12 +
> >  drivers/tee/optee/optee_smc.h| 444 
> >  drivers/tee/optee/supplicant.c   |  89 
> >  10 files changed, 1838 insertions(+)
> >  create mode 100644 drivers/tee/optee/Kconfig
> >  create mode 100644 drivers/tee/optee/Makefile
> >  create mode 100644 drivers/tee/optee/core.c
> >  create mode 100644 drivers/tee/optee/optee_msg.h
> >  create mode 100644 drivers/tee/optee/optee_msg_supplicant.h
> >  create mode 100644 drivers/tee/optee/optee_private.h
> >  create mode 100644 drivers/tee/optee/optee_smc.h
> >  create mode 100644 drivers/tee/optee/supplicant.c
> >
> 
> Reviewed-by: Simon Glass 
> 
> > diff --git a/drivers/tee/Kconfig b/drivers/tee/Kconfig
> > index 817ab331b0f8..3e7fe6ddcc5d 100644
> > --- a/drivers/tee/Kconfig
> > +++ b/drivers/tee/Kconfig
> > @@ -6,3 +6,13 @@ config TEE
> > help
> >   This implements a generic interface towards a Trusted Execution
> >   Environment (TEE).
> > +
> > +if TEE
> > +
> > +menu "TEE drivers"
> > +
> > +source "drivers/tee/optee/Kconfig"
> > +
> > +endmenu
> > +
> > +endif
> > diff --git a/drivers/tee/Makefile b/drivers/tee/Makefile
> > index b6d8e16e6211..19633b60f235 100644
> > --- a/drivers/tee/Makefile
> > +++ b/drivers/tee/Makefile
> > @@ -1,3 +1,4 @@
> >  # SPDX-License-Identifier: GPL-2.0+
> >
> >  obj-y += tee-uclass.o
> > +obj-$(CONFIG_OPTEE) += optee/
> > diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig
> > new file mode 100644
> > index ..8f7ebe16
> > --- /dev/null
> > +++ b/drivers/tee/optee/Kconfig
> > @@ -0,0 +1,7 @@
> > +# OP-TEE Trusted Execution Environment Configuration
> > +config OPTEE
> > +   bool "OP-TEE"
> > +   depends on ARM_SMCCC
> > +   help
> > + This implements the OP-TEE Trusted Execution Environment (TEE)
> > + driver.
> 
> for ARM? I think you should expand this help. What does the driver
> support / do?

I'll expand this.

> > diff --git a/drivers/tee/optee/Makefile b/drivers/tee/optee/Makefile
> > new file mode 100644
> > index ..6148feb474a5
> > --- /dev/null
> > +++ b/drivers/tee/optee/Makefile
> > @@ -0,0 +1,4 @@
> > +# SPDX-License-Identifier: GPL-2.0+
> > +
> > +obj-y += core.o
> > +obj-y += supplicant.o
> > diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
> > new file mode 100644
> > index ..f2d92d96551b
> > --- /dev/null
> > +++ b/drivers/tee/optee/core.c
> > @@ -0,0 +1,614 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (c) 2018 Linaro Limited
> > + */
> > +
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> 
> Put linux/ ones after tee.h

OK

> > +
> > +#include "optee_smc.h"
> > +#include "optee_msg.h"
> > +#include "optee_private.h"
> > +
> > +#define PAGELIST_ENTRIES_PER_PAGE \
> > +   ((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1)
> > +
> > +typedef void (optee_invoke_fn)(unsigned long, unsigned long, unsigned long,
> > +  unsigned long, unsigned long, unsigned long,
> > +  unsigned long, unsigned long,
> > +  struct arm_smccc_res *);
> > +
> > +struct optee_pdata {
> > +   optee_invoke_fn *invoke_fn;
> > +};
> > +
> > +struct rpc_param {
> > +   u32 a0;
> > +   u32 a1;
> > +   u32 a2;
> > +   u32 a3;
> > +   u32 a4;
> > +   u32 a5;
> > +   u32 a6;
> > +   u32 a7;
> > +};
> > +
> > +static void *reg_pair_to_ptr(u32 reg0, u32 reg1)
> > +{
> > +   return (void *)(ulong)(((u64)reg0 << 32) | reg1);
> 
> Can you not remove the u64 here?
> 
> E.g.
> 
> (void *)((ulong)reg0 << 32) | reg1)

No, that will cause:
drivers/tee/optee/core.c:42:38: warning: left shift count >= width of type 
[-Wshift-count-overflow]
  return (void *)(ulong)(((ulong)reg0 << 32) | reg1);
  ^~
on ILP32

> 
> > +}
> > +
> > 

Re: [U-Boot] [PATCH V5 00/31] imx: add i.MX8M support and i.MX8MQ EVK

2018-08-31 Thread Jon Nettleton
On Mon, Jan 22, 2018 at 2:04 PM Diego Dorta  wrote:
>
> Hi Peng,
>
> 2018-01-10 3:20 GMT-02:00 Peng Fan :
> > This patchset is to add i.MX8M and i.MX8MQ-EVK support
> >
> > V5:
> >  Drop wait_mask_set/clr_timeout and switch to use readl_poll_timeout in
> >  the patchset.
> >
> > V4:
> >  Regenerate patchset based on Tom's master tree.
> >  In this patchset, https://patchwork.ozlabs.org/patch/855027/
> >  "arm: imx: Rework i.MX specific commands to be excluded from SPL" from
> >  Tom is included to avoid merge conflicts because the i.mx8m change
> >  also has some modification to bootaux and arch/arm/mach-imx/Makefile.
> >  Because CONFIG_GPT_TIMER change, I did a small modification to apply
> >  Tom's patch, no function change.
> >
> >  Include ATF link in README.
> >
> > V3:
> >  This patchset based on https://patchwork.ozlabs.org/patch/855027/
> >  "arm: imx: Rework i.MX specific commands to be excluded from SPL" from
> >  Tom to avoid this patchset fail apply after Tom's patch merged.
> >
> >  Previously "power: pmic/regulator allow dm be omited by SPL" broke other
> >  boards, in V3 patchset, only touch pfuze100 related options.
> >
> >  Sharing code about get mac from fuse between mx7/mx8m
> >  Sharing code about bootaux between mx6/7/mx8m
> >  Sharing code about cpu speed grade between mx7/mx8m
> >  Sharing code about get boot device between mx7/mx8m
> >  Sharding code about mmc env between mx7/mx8m
> >
> >  Introduce wait_mask_set/clr_timeout to avoid deadloop in clock pll 
> > configuration
> >
> >  Correct authorship of fix building warning on fec arm64, patch 27/31.
> >
> >  Switch to use structure for DDR Controller. For DDR PHY registers,
> >  there are about more than 10 thousands registers, I could not convert
> >  them with detailed register name, and the script is generated from IC team,
> >  So I use regs[0x] arrays here fo easily converting between IC team
> >  released script and uboot ddr phy cod.
> >
> >  Improve REAMME file to include where to download firmware and imx-mkimage
> >  and how to build
> >
> >  Add review tags on the V2 patchset.
> >
> >  Hope this patchset could catch up next release :)
> >
> > V2:
> >
> >  patch 02/23: convert to structure, drop is_boot_from_usb and
> >   disconnect_from_usb
> >  patch 04/23: conver to use structure for the clock driver, removed the
> >   CCM_xxx macros. Add static for local functons.
> >   Add init_usdhc_clk, init_uart_clk and etc to not enable
> >   them all at default.
> >  patch 05/23: Add more commit msg for the sip part.
> >  patch 08/23: Merge the spl boot device with i.MX7
> >  patch 12/23: Typo fix and return error fix from Heiko for the SoC related 
> > part
> >  patch 22/23: Use a weak function ddr_init. If patch 23/23 could not be
> >   accepted at current stage, to make others still be could be
> >   compiled.
> >
> > The patchset depends on
> > https://patchwork.ozlabs.org/patch/841934/
> > https://patchwork.ozlabs.org/patch/841958/
> > to be tested on real hardware.
> >
> > V1:
> >
> > patch: "power: pmic.h: include dm/ofnode.h" and
> > "power: pmic/regulator allow dm be omited by SPL" is previously reviewed
> > in mailist to not merged. If no issue, you may pick it up.
> >
> > The board support is a large patch because of the ddr related code.
> > If it is not good, please first review/pick-up other patches if they
> > are ok.
> >
> >
> >
> > Peng Fan (29):
> >   imx: add i.MX8M into Kconfig
> >   imx: mx8m: add register definition header file
> >   imx: mx8m: add pin header file
> >   imx: mx8m: add clock driver
> >   imx: add sip function
> >   imx: boot_mode: add USB_BOOT entry
> >   imx: cpu: update cpu file to support i.MX8M
> >   imx: spl: implement spl_boot_device for i.MX8M
> >   imx: add i.MX8MQ SoC Revision and is_mx8m helper
> >   imx: add pad settings bit definition for i.MX8M
> >   imx: cpu: move speed/temp to common cpu
> >   imx: cpu: add cpu speed/grade for i.MX8M
> >   imx: refactor imx_get_mac_from_fuse
> >   imx: cleanup bootaux
> >   imx: bootaux: support i.MX8M
> >   imx: mx7: move get_boot_device to cpu.c
> >   imx: cpu: support get_boot_device for i.MX8M
> >   imx: mx7: move mmc env code to mmc_env.c
> >   imx: mx8m: add soc related settings and files
> >   imx: makefile: compile files for i.MX8M
> >   misc: ocotp: add i.MX8M support
> >   mmc: fsl_esdhc: support i.MX8M
> >   imx: lcdif: include i.MX8M
> >   gpio: mxc: add i.MX8M support
> >   net: fec: do not access reserved register for i.MX8M
> >   imx: imx8mq: add dtsi file
> >   power: pmic/regulator allow dm be omitted by SPL
> >   imx: mx8m: add ddr controller memory map
> >   imx: add i.MX8MQ EVK support
> >
> > Tom Rini (1):
> >   arm: imx: Rework i.MX specific commands to be excluded from SPL
> >
> > Ye Li (1):
> >   net: fec: fix build warnings for 64bits support
> >
>
> I was able to run your patchset on my board.
>
> For the whole series:
>
> Tested-by: Diego 

Re: [U-Boot] [PATCH v2 6/8] powerpc: mpc85xx: Use binman to embed dtb inside u-boot

2018-08-31 Thread Jagdish Gediya
Hi,

> -Original Message-
> From: Bin Meng 
> Sent: Tuesday, August 28, 2018 2:47 PM
> To: Jagdish Gediya 
> Cc: U-Boot Mailing List ; Prabhakar Kushwaha
> ; York Sun ; Poonam
> Aggrwal ; Simon Glass ;
> Tom Rini 
> Subject: Re: [PATCH v2 6/8] powerpc: mpc85xx: Use binman to embed dtb
> inside u-boot
> 
> On Tue, Aug 28, 2018 at 11:53 AM Jagdish Gediya 
> wrote:
> >
> > Below is the sequence to embed dtb inside u-boot,
> 
> nits: U-Boot
> 
> > 1. Remove bootpg and resetvec section if needed 2. Append dtb 3.
> > Append bootpg and resetvec section back if removed in step 1
> >
> > Above procedure is required only when CONFIG_MPC85xx and
> > CONFIG_OF_SEPARATE are defined.
> >
> > Add new config CONFIG_MPC85XX_HAVE_RESET_VECTOR to indicate that
> image
> > have resetvec section. step 1 and step 3 described above are
> 
> have -> has. step 1 -> Step 1
> 
> > required only if this config is y.
> >
> > Signed-off-by: Jagdish Gediya 
> > ---
> > Changes for v2:
> > - Don't change the generic target
> > - Add new config option to use binman
> >
> >  Makefile | 23 ++-
> >  arch/powerpc/cpu/mpc85xx/Kconfig |  4 
> >  2 files changed, 26 insertions(+), 1 deletion(-)
> >
> > diff --git a/Makefile b/Makefile
> > index b5bf8ab..03baa74 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -861,6 +861,10 @@ ifneq ($(CONFIG_SYS_INIT_SP_BSS_OFFSET),)
> >  ALL-y += init_sp_bss_offset_check
> >  endif
> >
> > +ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
> > +ALL-y += u-boot-with-dtb.bin
> > +endif
> > +
> >  LDFLAGS_u-boot += $(LDFLAGS_FINAL)
> >
> >  # Avoid 'Not enough room for program headers' error on binutils 2.28
> onwards.
> > @@ -983,7 +987,8 @@ spl/u-boot-spl.srec: spl/u-boot-spl FORCE
> > $(call if_changed,objcopy)
> >
> >  OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
> > -   $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec)
> > +   $(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
> > +   $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -R
> > + .resetvec)
> >
> >  binary_size_check: u-boot-nodtb.bin FORCE
> > @file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}')
> > ; \ @@ -1202,6 +1207,18 @@ u-boot-with-spl.sfp: spl/u-boot-spl.sfp u-
> boot.img FORCE
> > $(call if_changed,socboot)
> >  endif
> >
> > +ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
> 
> This looks odd. Both CONFIG_OF_SEPARATE and CONFIG_OF_EMBED should
> be supported by binman.

Entry type 'u-boot-dtb-with-ucode' requires file 'u-boot.dtb' which is built 
only for CONFIG_OF_SEPARATE.

> > +u-boot-with-dtb.bin: u-boot.bin u-boot.dtb \
> > +   $(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR), u-boot-br.bin)
> FORCE
> > +   $(call if_changed,binman)
> > +
> > +ifeq ($(CONFIG_MPC85XX_HAVE_RESET_VECTOR),y)
> > +OBJCOPYFLAGS_u-boot-br.bin := -O binary -j .bootpg -j .resetvec
> > +u-boot-br.bin: u-boot FORCE
> > +   $(call if_changed,objcopy)
> > +endif
> > +endif
> > +
> >  # x86 uses a large ROM. We fill it with 0xff, put the 16-bit stuff
> > (including  # reset vector) at the top, Intel ME descriptor at the
> > bottom, and U-Boot in  # the middle. This is handled by binman based
> > on an image description in the @@ -1296,8 +1313,12 @@
> > spl/u-boot-spl.pbl: spl/u-boot-spl.bin FORCE  ifeq ($(ARCH),arm)
> > UBOOT_BINLOAD := u-boot.img  else
> > +ifeq ($(CONFIG_MPC85xx)$(CONFIG_OF_SEPARATE),yy)
> > +UBOOT_BINLOAD := u-boot-with-dtb.bin
> > +else
> >  UBOOT_BINLOAD := u-boot.bin
> >  endif
> > +endif
> >
> >  OBJCOPYFLAGS_u-boot-with-spl-pbl.bin = -I binary -O binary --pad-
> to=$(CONFIG_SPL_PAD_TO) \
> >   --gap-fill=0xff diff --git
> > a/arch/powerpc/cpu/mpc85xx/Kconfig
> b/arch/powerpc/cpu/mpc85xx/Kconfig
> > index 19e8d02..7d139ff 100644
> > --- a/arch/powerpc/cpu/mpc85xx/Kconfig
> > +++ b/arch/powerpc/cpu/mpc85xx/Kconfig
> > @@ -1143,6 +1143,10 @@ config ARCH_T4240
> > imply CMD_REGINFO
> > imply FSL_SATA
> >
> > +config MPC85XX_HAVE_RESET_VECTOR
> > +   bool "Indicate reset vector at CONFIG_RESET_VECTOR_ADDRESS -
> 0xffc"
> 
> I don't think you want people to turn this option on and off, no? You
> probably need move the "string" to the help paragraph.

This option need to be turned on/off.  Only NOR boot have the reset vector and 
bootpg section at CONFIG_RESET_VECTOR_ADDRESS - 0xffc. Other boot do not have 
the reset vector but they have the bootpg section at some other address where 
it don't need to be removed and joined.

This option indicates that reset vector and bootpg sections are placed at 
CONFIG_RESET_VECTOR_ADDRESS - 0xffc and it need to be turned on/off according 
to boot device.

> > +   depends on MPC85xx
> > +
> >  config BOOKE
> > bool
> > default y
> > --
> 
> Regards,
> Bin
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot