[U-Boot] [PATCH 1/1] efi_loader: fix typo in include/efi.h

2017-09-17 Thread Heinrich Schuchardt
Fix typo in teh EFI_BOOT_SERVICES_CODE description.

Signed-off-by: Heinrich Schuchardt 
---
 include/efi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/efi.h b/include/efi.h
index 87b0b43f20..63cbdb61ec 100644
--- a/include/efi.h
+++ b/include/efi.h
@@ -120,7 +120,7 @@ enum efi_mem_type {
/* The code portions of a loaded Boot Services Driver */
EFI_BOOT_SERVICES_CODE,
/*
-* The data portions of a loaded Boot Serves Driver and
+* The data portions of a loaded Boot Services Driver and
 * the default data allocation type used by a Boot Services
 * Driver to allocate pool memory.
 */
-- 
2.11.0

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


Re: [U-Boot] [PATCH 05/16] efi: Correct header order in efi_memory

2017-09-17 Thread Heinrich Schuchardt
On 09/18/2017 12:59 AM, Simon Glass wrote:
> The headers are not in the correct order. Fix this.

The commit message should tell that and explain why you are dropping
#include 

> 
> Signed-off-by: Simon Glass 
> ---
> 
>  lib/efi_loader/efi_memory.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> index 9e079f1fa3..ad3d277be6 100644
> --- a/lib/efi_loader/efi_memory.c
> +++ b/lib/efi_loader/efi_memory.c
> @@ -8,12 +8,11 @@
>  
>  #include 
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
> -#include 
>  #include 
> -#include 
> -#include 
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> 

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


Re: [U-Boot] [PATCH 04/16] efi: Add a TODO to efi_init_obj_list()

2017-09-17 Thread Heinrich Schuchardt
On 09/18/2017 12:59 AM, Simon Glass wrote:
> This function repeats data structures provided by driver model. They are
> only created once so can be stale if the EFI loader is called twice (e.g.
> for testing or on boot failure).
> 
> Add a TODO to address this. It should be possible to attach EFI devices
> and data structures to driver-model devices and avoid having a parallel
> set of data structures.
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  cmd/bootefi.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index 9aa588eb1b..ee07733e3e 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -109,6 +109,10 @@ static struct efi_object bootefi_device_obj = {
>  /**
>   * efi_init_obj_list() - Initialize and populate EFI object list
>   *
> + * TODO(s...@chromium.org): Move this to a dynamic list based on driver 
> model,
> + * so that it does not need to be created before running EFI applications
> + * and updates when devices change.
> + *

I am not quite sure if by dynamic list you refer to linker generated
lists or to hot plugging.

The UEFI spec 2.7 has a chapter on "Hot-Plug Events". This would add a
lot of complexity. I do not think that we currently need it.

The object list also gets new entries created by the EFI application via
calling InstallMultipleProtocolInterfaces of InstallProtocolInterface
with *handle == NULL.

>   * @return 0 if OK, -ve on error (in which case it prints a message)
>   */
>  static int efi_init_obj_list(void)
> 

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


Re: [U-Boot] [PATCH 03/16] efi: Add error checking for efi_init_obj_list()

2017-09-17 Thread Heinrich Schuchardt
On 09/18/2017 12:59 AM, Simon Glass wrote:
> This function calls a function which can fail. Print a message in this
> case and abort the boot, rather than silently continuing to boot, which
> will certainly fail.
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  cmd/bootefi.c | 30 --
>  1 file changed, 24 insertions(+), 6 deletions(-)
> 
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index 2c9d31c5eb..9aa588eb1b 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -106,11 +106,17 @@ static struct efi_object bootefi_device_obj = {
>   },
>  };
>  
> -/* Initialize and populate EFI object list */
> -static void efi_init_obj_list(void)
> +/**
> + * efi_init_obj_list() - Initialize and populate EFI object list
> + *
> + * @return 0 if OK, -ve on error (in which case it prints a message)
> + */
> +static int efi_init_obj_list(void)

Use efi_status_t as return type.

>  {
> + int ret;
> +
>   if (efi_obj_list_initalized)
> - return;
> + return 0;
>   efi_obj_list_initalized = 1;
>  
>   list_add_tail(_image_info_obj.link, _obj_list);
> @@ -132,12 +138,19 @@ static void efi_init_obj_list(void)
>   loaded_image_info.device_handle = bootefi_device_path;
>  #endif
>  #ifdef CONFIG_GENERATE_SMBIOS_TABLE
> - efi_smbios_register();
> + ret = efi_smbios_register();
> + if (ret)
> + goto error;
>  #endif
>  
>   /* Initialize EFI runtime services */
>   efi_reset_system_init();
>   efi_get_time_init();
> +
> + return 0;
> +error:
> + printf("Error: Cannot set up EFI object list (err=%d)\n", ret);
> + return ret;
>  }
>  
>  static void *copy_fdt(void *fdt)
> @@ -219,6 +232,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
>   ulong fdt_pages, fdt_size, fdt_start, fdt_end;
>   const efi_guid_t fdt_guid = EFI_FDT_GUID;
>   bootm_headers_t img = { 0 };
> + int ret;
>  
>   /*
>* gd lives in a fixed register which may get clobbered while we execute
> @@ -258,7 +272,9 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
>   return -ENOENT;
>  
>   /* Initialize and populate EFI object list */
> - efi_init_obj_list();
> + ret = efi_init_obj_list();
> + if (ret)
> + return ret;
>  
>   /* Call our payload! */
>   debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
> @@ -312,7 +328,9 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
> argc, char * const argv[])
>*/
>   efi_save_gd();
>   /* Initialize and populate EFI object list */
> - efi_init_obj_list();
> + if (efi_init_obj_list())
> + return CMD_RET_FAILURE;
> +

We are duplicating code here.

efi_save_gd and efi_init_obj_list should have been moved to the start of
do_bootefi_exec in my patch
efi_selftest: provide unit test for event services

>   loaded_image_info.device_handle = bootefi_device_path;
>   loaded_image_info.file_path = bootefi_image_path;
>   return efi_selftest(_image_info, );
> 

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


Re: [U-Boot] [PATCH 02/16] efi: Move the init check inside efi_init_obj_list()

2017-09-17 Thread Heinrich Schuchardt
On 09/18/2017 12:59 AM, Simon Glass wrote:
> Rather than having the caller check this variable and the callee set it,
> move all access to the variable inside the function. This reduces the
> logic needed to call efi_init_obj_list().
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  cmd/bootefi.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index abfab8fa98..2c9d31c5eb 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -109,6 +109,8 @@ static struct efi_object bootefi_device_obj = {
>  /* Initialize and populate EFI object list */
>  static void efi_init_obj_list(void)
>  {
> + if (efi_obj_list_initalized)
> + return;
>   efi_obj_list_initalized = 1;
>  
>   list_add_tail(_image_info_obj.link, _obj_list);
> @@ -256,8 +258,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
>   return -ENOENT;
>  
>   /* Initialize and populate EFI object list */
> - if (!efi_obj_list_initalized)
> - efi_init_obj_list();
> + efi_init_obj_list();
>  
>   /* Call our payload! */
>   debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
> @@ -311,8 +312,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
> argc, char * const argv[])
>*/
>   efi_save_gd();
>   /* Initialize and populate EFI object list */
> - if (!efi_obj_list_initalized)
> - efi_init_obj_list();
> + efi_init_obj_list();
>   loaded_image_info.device_handle = bootefi_device_path;
>   loaded_image_info.file_path = bootefi_image_path;
>   return efi_selftest(_image_info, );
> 

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


Re: [U-Boot] [PATCH 01/16] efi: Update efi_smbios_register() to return error code

2017-09-17 Thread Heinrich Schuchardt
On 09/18/2017 12:59 AM, Simon Glass wrote:
> This function can fail but gives no indication of failure. Update it to
> return an error when something goes wrong.
> 
> Signed-off-by: Simon Glass 
> ---
> 
>  include/efi_loader.h| 10 --
>  lib/efi_loader/efi_smbios.c |  6 --
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index 2051fc994e..79d2dad22c 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -150,8 +150,14 @@ int efi_disk_register(void);
>  int efi_gop_register(void);
>  /* Called by bootefi to make the network interface available */
>  int efi_net_register(void **handle);
> -/* Called by bootefi to make SMBIOS tables available */
> -void efi_smbios_register(void);
> +/**
> + * efi_smbios_register() - write out SMBIOS tables
> + *
> + * Called by bootefi to make SMBIOS tables available
> + *
> + * @return 0 if OK, -ENOMEM if no memory is available for the tables
> + */
> +int efi_smbios_register(void);
>  
>  /* Called by networking code to memorize the dhcp ack package */
>  void efi_net_set_dhcp_ack(void *pkt, int len);
> diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c
> index ac412e7362..3b87294dc3 100644
> --- a/lib/efi_loader/efi_smbios.c
> +++ b/lib/efi_loader/efi_smbios.c
> @@ -13,7 +13,7 @@
>  
>  static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;
>  
> -void efi_smbios_register(void)
> +int efi_smbios_register(void)

Please, use efi_status_t as return type.

>  {
>   /* Map within the low 32 bits, to allow for 32bit SMBIOS tables */
>   uint64_t dmi = 0x;
> @@ -22,11 +22,13 @@ void efi_smbios_register(void)
>   int memtype = EFI_RUNTIME_SERVICES_DATA;
>  
>   if (efi_allocate_pages(1, memtype, pages, ) != EFI_SUCCESS)
> - return;
> + return -ENOMEM;

Use return EFI_OUT_OF_RESOURCES
This matches the value returned by efi_install_configuration_table.

>  
>   /* Generate SMBIOS tables */
>   write_smbios_table(dmi);
>  
>   /* And expose them to our EFI payload */
>   efi_install_configuration_table(_guid, (void*)(uintptr_t)dmi);

This function can return EFI_OUT_OF_RESOURCES.

> +
> + return 0;

Use return EFI_SUCCESS;

Regards Heinrich

>  }
> 

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


Re: [U-Boot] [PATCH 00/16] efi: Enable basic sandbox support for EFI loader

2017-09-17 Thread Simon Glass
Hi Heinrich,

On 17 September 2017 at 21:48, Heinrich Schuchardt  wrote:
> On 09/18/2017 12:59 AM, Simon Glass wrote:
>> A limitation of the EFI loader at present is that it does not build with
>> sandbox. This makes it hard to write tests, since sandbox is used for most
>> testing in U-Boot.
>>
>> This series enables the EFI loader feature. It allows sandbox to build and
>> run a trivial function which calls the EFI API to output a message.
>>
>> Much work remains but this should serve as a basis for adding tests more
>> easily for EFI loader.
>>
>> This series sits on top of Heinrich's recent EFI test series. It is
>> available at u-boot-dm/efi-working
>>
>>
>> Simon Glass (16):
>>   efi: Update efi_smbios_register() to return error code
>>   efi: Move the init check inside efi_init_obj_list()
>>   efi: Add error checking for efi_init_obj_list()
>>   efi: Add a TODO to efi_init_obj_list()
>>   efi: Correct header order in efi_memory
>>   efi: sandbox: Adjust memory setup for sandbox
>>   sandbox: smbios: Update to support sandbox
>>   sandbox: Add a setjmp() implementation
>>   efi: sandbox: Add required linker sections
>>   efi: sandbox: Add distroboot support
>>   Define board_quiesce_devices() in a shared location
>>   Add a comment for board_quiesce_devices()
>>   efi: sandbox: Add relocation constants
>>   efi: Add a comment about duplicated ELF constants
>>   efi: sandbox: Enable EFI loader builder for sandbox
>>   efi: sandbox: Add a simple 'bootefi test' command
>>
>>  arch/arm/include/asm/u-boot-arm.h |  1 -
>>  arch/sandbox/cpu/cpu.c| 13 ++
>>  arch/sandbox/cpu/os.c | 17 
>>  arch/sandbox/cpu/u-boot.lds   | 29 +
>>  arch/sandbox/include/asm/setjmp.h | 21 +++
>>  arch/sandbox/lib/Makefile |  2 +-
>>  arch/sandbox/lib/sections.c   | 12 +
>>  arch/x86/include/asm/u-boot-x86.h |  1 -
>>  arch/x86/lib/bootm.c  |  4 ---
>>  cmd/bootefi.c | 54 
>> ++-
>>  common/bootm.c|  4 +++
>>  configs/sandbox_defconfig |  1 +
>>  include/bootm.h   |  8 ++
>>  include/config_distro_bootcmd.h   |  2 +-
>>  include/efi_loader.h  | 13 --
>>  include/os.h  | 21 +++
>>  lib/efi_loader/Kconfig| 12 -
>>  lib/efi_loader/Makefile   |  1 +
>>  lib/efi_loader/efi_boottime.c |  4 +++
>>  lib/efi_loader/efi_memory.c   | 33 +---
>>  lib/efi_loader/efi_runtime.c  |  7 +
>>  lib/efi_loader/efi_smbios.c   |  6 +++--
>>  lib/efi_loader/efi_test.c | 17 
>>  lib/smbios.c  | 38 ---
>>  24 files changed, 277 insertions(+), 44 deletions(-)
>>  create mode 100644 arch/sandbox/include/asm/setjmp.h
>>  create mode 100644 arch/sandbox/lib/sections.c
>>  create mode 100644 lib/efi_loader/efi_test.c
>>
> Thanks for enabling efi_loader on sandbox. That will make many things
> easier.
>
> Unfortunately
> efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
>  struct efi_system_table *systab)
> {
> ...
> boottime = systable->boottime;
> ...
> ret = boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
>   (void **)_map);
> leads to a segmentation fault:
>
> => bootefi selftest
>
> Testing EFI API implementation
>
> Number of tests to execute: 3
> 
> Setting up 'ExitBootServices'
> Setting up 'ExitBootServices' succeeded
> Segmentation fault
> user@workstation:~/workspace/u-boot-odroid-c2/denx$
>
> The problem does not exist with qemu-x86_defconfig without your patches.
>
> qemu-x86_defconfig cannot be built with you patches:
>
>   UPD include/generated/asm-offsets.h
> sh: echo: I/O error
> Kbuild:47: recipe for target 'include/generated/generic-asm-offsets.h'
> failed
> make[1]: *** [include/generated/generic-asm-offsets.h] Error 1
> make[1]: *** Waiting for unfinished jobs
> Makefile:1332: recipe for target 'prepare0' failed
> make: *** [prepare0] Error 2

Are you able to bisect this to the commit which causes the problem.
I've had a look through and cannot figure it out my inspection.
Otherwise I should be able to look at it on Tuesday.

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


Re: [U-Boot] [PATCH 00/16] efi: Enable basic sandbox support for EFI loader

2017-09-17 Thread Heinrich Schuchardt
On 09/18/2017 12:59 AM, Simon Glass wrote:
> A limitation of the EFI loader at present is that it does not build with
> sandbox. This makes it hard to write tests, since sandbox is used for most
> testing in U-Boot.
> 
> This series enables the EFI loader feature. It allows sandbox to build and
> run a trivial function which calls the EFI API to output a message.
> 
> Much work remains but this should serve as a basis for adding tests more
> easily for EFI loader.
> 
> This series sits on top of Heinrich's recent EFI test series. It is
> available at u-boot-dm/efi-working
> 
> 
> Simon Glass (16):
>   efi: Update efi_smbios_register() to return error code
>   efi: Move the init check inside efi_init_obj_list()
>   efi: Add error checking for efi_init_obj_list()
>   efi: Add a TODO to efi_init_obj_list()
>   efi: Correct header order in efi_memory
>   efi: sandbox: Adjust memory setup for sandbox
>   sandbox: smbios: Update to support sandbox
>   sandbox: Add a setjmp() implementation
>   efi: sandbox: Add required linker sections
>   efi: sandbox: Add distroboot support
>   Define board_quiesce_devices() in a shared location
>   Add a comment for board_quiesce_devices()
>   efi: sandbox: Add relocation constants
>   efi: Add a comment about duplicated ELF constants
>   efi: sandbox: Enable EFI loader builder for sandbox
>   efi: sandbox: Add a simple 'bootefi test' command
> 
>  arch/arm/include/asm/u-boot-arm.h |  1 -
>  arch/sandbox/cpu/cpu.c| 13 ++
>  arch/sandbox/cpu/os.c | 17 
>  arch/sandbox/cpu/u-boot.lds   | 29 +
>  arch/sandbox/include/asm/setjmp.h | 21 +++
>  arch/sandbox/lib/Makefile |  2 +-
>  arch/sandbox/lib/sections.c   | 12 +
>  arch/x86/include/asm/u-boot-x86.h |  1 -
>  arch/x86/lib/bootm.c  |  4 ---
>  cmd/bootefi.c | 54 
> ++-
>  common/bootm.c|  4 +++
>  configs/sandbox_defconfig |  1 +
>  include/bootm.h   |  8 ++
>  include/config_distro_bootcmd.h   |  2 +-
>  include/efi_loader.h  | 13 --
>  include/os.h  | 21 +++
>  lib/efi_loader/Kconfig| 12 -
>  lib/efi_loader/Makefile   |  1 +
>  lib/efi_loader/efi_boottime.c |  4 +++
>  lib/efi_loader/efi_memory.c   | 33 +---
>  lib/efi_loader/efi_runtime.c  |  7 +
>  lib/efi_loader/efi_smbios.c   |  6 +++--
>  lib/efi_loader/efi_test.c | 17 
>  lib/smbios.c  | 38 ---
>  24 files changed, 277 insertions(+), 44 deletions(-)
>  create mode 100644 arch/sandbox/include/asm/setjmp.h
>  create mode 100644 arch/sandbox/lib/sections.c
>  create mode 100644 lib/efi_loader/efi_test.c
> 
Thanks for enabling efi_loader on sandbox. That will make many things
easier.

Unfortunately
efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
 struct efi_system_table *systab)
{
...
boottime = systable->boottime;
...
ret = boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
  (void **)_map);
leads to a segmentation fault:

=> bootefi selftest

Testing EFI API implementation

Number of tests to execute: 3

Setting up 'ExitBootServices'
Setting up 'ExitBootServices' succeeded
Segmentation fault
user@workstation:~/workspace/u-boot-odroid-c2/denx$

The problem does not exist with qemu-x86_defconfig without your patches.

qemu-x86_defconfig cannot be built with you patches:

  UPD include/generated/asm-offsets.h
sh: echo: I/O error
Kbuild:47: recipe for target 'include/generated/generic-asm-offsets.h'
failed
make[1]: *** [include/generated/generic-asm-offsets.h] Error 1
make[1]: *** Waiting for unfinished jobs
Makefile:1332: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

Best regards

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


Re: [U-Boot] [PATCH 13/13] log: Add documentation

2017-09-17 Thread Bin Meng
On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass  wrote:
> Add documentation for the log system.
>
> Signed-off-by: Simon Glass 
> ---
>
>  doc/README.log | 220 
> +
>  1 file changed, 220 insertions(+)
>  create mode 100644 doc/README.log
>

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


Re: [U-Boot] [PATCH 11/13] log: sandbox: Enable logging

2017-09-17 Thread Bin Meng
On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass  wrote:
> Enable all logging features on sandbox so that the tests can be run.
>
> Signed-off-by: Simon Glass 
> ---
>
>  configs/sandbox_defconfig | 3 +++
>  1 file changed, 3 insertions(+)
>

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


Re: [U-Boot] [PATCH 10/13] log: Plumb logging into the init sequence

2017-09-17 Thread Bin Meng
On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass  wrote:
> Set up logging both before and after relocation.
>
> Signed-off-by: Simon Glass 
> ---
>
>  common/board_f.c  | 5 -
>  common/board_r.c  | 2 ++
>  common/log.c  | 1 +
>  include/asm-generic/global_data.h | 1 +
>  4 files changed, 8 insertions(+), 1 deletion(-)
>

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


Re: [U-Boot] [PATCH 09/13] log: Add a test command

2017-09-17 Thread Bin Meng
Hi Simon,

On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass  wrote:
> Add a command which exercises the logging system.
>
> Signed-off-by: Simon Glass 
> ---
>
>  cmd/Kconfig |   3 +-
>  cmd/log.c   |   6 ++
>  common/Kconfig  |  10 +++
>  include/log.h   |   3 +
>  test/Makefile   |   1 +
>  test/log/Makefile   |   7 ++
>  test/log/log_test.c | 204 
> 
>  7 files changed, 233 insertions(+), 1 deletion(-)
>  create mode 100644 test/log/Makefile
>  create mode 100644 test/log/log_test.c
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 702d4f251f..9d52e4fecc 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -1483,7 +1483,8 @@ config CMD_LOG
> help
>   This provides access to logging features. It allows the output of
>   log data to be controlled to a limited extent (setting up the 
> default
> - maximum log level for emitting of records).
> + maximum log level for emitting of records). It also provides access
> + to a command used for testing the log system.
>
>  config CMD_TRACE
> bool "trace - Support tracing of function calls and timing"
> diff --git a/cmd/log.c b/cmd/log.c
> index 44e04ab16a..1fc49c4cf2 100644
> --- a/cmd/log.c
> +++ b/cmd/log.c
> @@ -23,6 +23,9 @@ static int do_log_level(cmd_tbl_t *cmdtp, int flag, int 
> argc,
>
>  static cmd_tbl_t log_sub[] = {
> U_BOOT_CMD_MKENT(level, CONFIG_SYS_MAXARGS, 1, do_log_level, "", ""),
> +#ifdef CONFIG_LOG_TEST
> +   U_BOOT_CMD_MKENT(test, 2, 1, do_log_level, "", ""),

It should be "do_log_test".

> +#endif
>  };
>
>  static int do_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> @@ -46,6 +49,9 @@ static int do_log(cmd_tbl_t *cmdtp, int flag, int argc, 
> char * const argv[])
>  #ifdef CONFIG_SYS_LONGHELP
>  static char log_help_text[] =
> "level - get/set log level\n"
> +#ifdef CONFIG_LOG_TEST
> +   "test - run log tests\n"

It should be "log test", as U-Boot's command line won't append the
main command name except the first one.

> +#endif
> ;
>  #endif
>
> diff --git a/common/Kconfig b/common/Kconfig
> index ba4578e870..57ce2cbe9a 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -458,6 +458,16 @@ config LOG_SPL_CONSOLE
>   log message is shown - other details like level, category, file and
>   line number are omitted.
>
> +config LOG_TEST
> +   bool "Provide a test for logging"
> +   depends on LOG
> +   default y if SANDBOX
> +   help
> + This enables a 'log test' command to test logging. It is normally
> + executed from a pytest and simply outputs logging information
> + in various different ways to test that the logging system works
> + correctly with varoius settings.
> +
>  endmenu
>
>  config DTB_RESELECT
> diff --git a/include/log.h b/include/log.h
> index fb6a196202..f03ed94128 100644
> --- a/include/log.h
> +++ b/include/log.h
> @@ -263,6 +263,9 @@ struct log_filter {
>  #define LOG_DRIVER(_name) \
> ll_entry_declare(struct log_driver, _name, log_driver)
>
> +/* Handle the 'log test' command */
> +int do_log_test(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
> +
>  /**
>   * log_add_filter() - Add a new filter to a log device
>   *
> diff --git a/test/Makefile b/test/Makefile
> index 6305afb211..40f2244b79 100644
> --- a/test/Makefile
> +++ b/test/Makefile
> @@ -10,3 +10,4 @@ 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_$(SPL_)LOG) += log/
> diff --git a/test/log/Makefile b/test/log/Makefile
> new file mode 100644
> index 00..b0da8dee28
> --- /dev/null
> +++ b/test/log/Makefile
> @@ -0,0 +1,7 @@
> +#
> +# Copyright (c) 2017 Google, Inc
> +#
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +
> +obj-$(CONFIG_LOG_TEST) += log_test.o
> diff --git a/test/log/log_test.c b/test/log/log_test.c
> new file mode 100644
> index 00..c3d076491f
> --- /dev/null
> +++ b/test/log/log_test.c
> @@ -0,0 +1,204 @@
> +/*
> + * Logging support test program
> + *
> + * Copyright (c) 2017 Google, Inc
> + * Written by Simon Glass 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +
> +/* emit some sample log records in different ways, for testing */
> +static int log_run(enum log_category_t cat, const char *file)
> +{
> +   int i;
> +
> +   debug("debug\n");
> +   error("error\n");
> +   for (i = LOGL_FIRST; i < LOGL_COUNT; i++) {
> +   log(cat, i, "log %d\n", i);
> +   _log(cat, i, file, 100 + i, "func", "_log %d\n", i);
> +   }
> +
> +   return 0;
> +}
> +
> +static int log_test(int testnum)
> +{
> +   int ret;
> +
> +   printf("test %d\n", testnum);
> +   switch (testnum) {
> +   case 0: {
> +   

Re: [U-Boot] [PATCH 07/13] log: Add a console driver

2017-09-17 Thread Bin Meng
On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass  wrote:
> It is useful to display log messages on the console. Add a simple driver
> to handle this.
>
> Signed-off-by: Simon Glass 
> ---
>
>  common/Kconfig   | 20 
>  common/Makefile  |  1 +
>  common/log_console.c | 23 +++
>  3 files changed, 44 insertions(+)
>  create mode 100644 common/log_console.c
>

Reviewed-by: Bin Meng 

But isn't it possible to get this stuff into the serial-uclass driver?

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


Re: [U-Boot] [PATCH 08/13] log: Add a 'log level' command

2017-09-17 Thread Bin Meng
On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass  wrote:
> Add a command for adjusting the log level.
>
> Signed-off-by: Simon Glass 
> ---
>
>  cmd/Kconfig  |  7 +++
>  cmd/Makefile |  1 +
>  cmd/log.c| 55 +++
>  3 files changed, 63 insertions(+)
>  create mode 100644 cmd/log.c
>

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


Re: [U-Boot] [PATCH 06/13] log: Add an implemention of logging

2017-09-17 Thread Bin Meng
Hi Simon,

On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass  wrote:
> Add the logging header file and implementation with some configuration
> options to control it.
>
> Signed-off-by: Simon Glass 
> ---
>
>  MAINTAINERS   |   9 ++
>  common/Kconfig|  56 +
>  common/Makefile   |   1 +
>  common/log.c  | 246 +
>  include/asm-generic/global_data.h |   5 +
>  include/log.h | 247 
> --
>  6 files changed, 555 insertions(+), 9 deletions(-)
>  create mode 100644 common/log.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 04acf2b89d..eb420afa8d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -290,6 +290,15 @@ S: Maintained
>  T: git git://git.denx.de/u-boot-i2c.git
>  F: drivers/i2c/
>
> +LOGGING
> +M: Simon Glass 
> +S: Maintained
> +T: git git://git.denx.de/u-boot.git
> +F: common/log.c
> +F: cmd/log.c
> +F: test/log/log_test.c
> +F: test/py/tests/test_log.py

test/log/log_test.c and test/py/tests/test_log.py have not been
introduced at this point.

> +
>  MICROBLAZE
>  M: Michal Simek 
>  S: Maintained
> diff --git a/common/Kconfig b/common/Kconfig
> index 4d8cae9610..cbccc8ae26 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -384,6 +384,62 @@ config SYS_STDIO_DEREGISTER
>
>  endmenu
>
> +menu "Logging"
> +
> +config LOG
> +   bool "Enable logging support"
> +   help
> + This enables support for logging of status and debug messages. These
> + can be displayed on the console, recorded in a memory buffer, or
> + discarded if not needed. Logging supports various categories and
> + levels of severity.
> +
> +config SPL_LOG
> +   bool "Enable logging support in SPL"
> +   help
> + This enables support for logging of status and debug messages. These
> + can be displayed on the console, recorded in a memory buffer, or
> + discarded if not needed. Logging supports various categories and
> + levels of severity.
> +
> +config LOG_MAX_LEVEL
> +   int "Maximum log level to record"
> +   depends on LOG
> +   default 5
> +   help
> + This selects the maximum log level that will be recorded. Any value
> + higher than this will be ignored. If possible log statements below
> + this level will be discarded at build time. Levels:
> +
> +   0 - panic
> +   1 - critical
> +   2 - error
> +   3 - warning
> +   4 - note
> +   5 - info
> +   6 - detail
> +   7 - debug
> +
> +config LOG_SPL_MAX_LEVEL
> +   int "Maximum log level to record in SPL"
> +   depends on SPL_LOG
> +   default 3
> +   help
> + This selects the maximum log level that will be recorded. Any value
> + higher than this will be ignored. If possible log statements below
> + this level will be discarded at build time. Levels:
> +
> +   0 - panic
> +   1 - critical
> +   2 - error
> +   3 - warning
> +   4 - note
> +   5 - info
> +   6 - detail
> +   7 - debug
> +
> +endmenu
> +
>  config DTB_RESELECT
> bool "Support swapping dtbs at a later point in boot"
> depends on FIT_EMBED
> diff --git a/common/Makefile b/common/Makefile
> index 1b56cf9a70..d37c8d5636 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -128,5 +128,6 @@ obj-y += cli.o
>  obj-$(CONFIG_FSL_DDR_INTERACTIVE) += cli_simple.o cli_readline.o
>  obj-$(CONFIG_CMD_DFU) += dfu.o
>  obj-y += command.o
> +obj-$(CONFIG_$(SPL_)LOG) += log.o
>  obj-y += s_record.o
>  obj-y += xyzModem.o
> diff --git a/common/log.c b/common/log.c
> new file mode 100644
> index 00..6bf2219d38
> --- /dev/null
> +++ b/common/log.c
> @@ -0,0 +1,246 @@
> +/*
> + * Logging support
> + *
> + * Copyright (c) 2017 Google, Inc
> + * Written by Simon Glass 
> + *
> + * SPDX-License-Identifier:GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +static struct log_device *log_device_find_by_name(const char *drv_name)
> +{
> +   struct log_device *ldev;
> +
> +   list_for_each_entry(ldev, >log_head, sibling_node) {
> +   if (!strcmp(drv_name, ldev->drv->name))
> +   return ldev;
> +   }
> +
> +   return NULL;
> +}
> +
> +/**
> + * log_has_cat() - check if a log category exists within a list
> + *
> + * @cat_list: List of categories to check, at most LOGF_MAX_CATEGORIES 
> entries
> + * long, terminated by LC_END if fewer
> + * @cat: Category to search for
> + * @return true if @cat is in @cat_list, else false
> + */
> +static bool log_has_cat(enum log_category_t cat_list[], enum log_category_t 
> cat)
> +{
> 

[U-Boot] [PATCH 2/3] video: pwm_backlight: make regulator optional

2017-09-17 Thread Vasily Khoruzhick
u-boot doesn't have dummy regulators, so pwm_backlight probe
will fail if regulator is missing. Make it optional to get this
driver working on platforms where there's no backlight regultor.

Signed-off-by: Vasily Khoruzhick 
---
 drivers/video/pwm_backlight.c | 28 
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index fbd7bf7838..05e56ffead 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -32,16 +32,21 @@ static int pwm_backlight_enable(struct udevice *dev)
uint duty_cycle;
int ret;
 
-   plat = dev_get_uclass_platdata(priv->reg);
-   debug("%s: Enable '%s', regulator '%s'/'%s'\n", __func__, dev->name,
- priv->reg->name, plat->name);
-   ret = regulator_set_enable(priv->reg, true);
-   if (ret) {
-   debug("%s: Cannot enable regulator for PWM '%s'\n", __func__,
- dev->name);
-   return ret;
+   if (priv->reg) {
+   plat = dev_get_uclass_platdata(priv->reg);
+   debug("%s: Enable '%s', regulator '%s'/'%s'\n", __func__, 
dev->name,
+ priv->reg->name, plat->name);
+   ret = regulator_set_enable(priv->reg, true);
+   if (ret) {
+   debug("%s: Cannot enable regulator for PWM '%s'\n", 
__func__,
+ dev->name);
+   return ret;
+   }
+   mdelay(120);
}
-   mdelay(120);
+
+   debug("%s: default: %d, min: %d, max: %d\n", __func__,
+   priv->default_level, priv->min_level, priv->max_level);
 
duty_cycle = priv->period_ns * (priv->default_level - priv->min_level) /
(priv->max_level - priv->min_level + 1);
@@ -68,10 +73,9 @@ static int pwm_backlight_ofdata_to_platdata(struct udevice 
*dev)
debug("%s: start\n", __func__);
ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
   "power-supply", >reg);
-   if (ret) {
+   if (ret)
debug("%s: Cannot get power supply: ret=%d\n", __func__, ret);
-   return ret;
-   }
+
ret = gpio_request_by_name(dev, "enable-gpios", 0, >enable,
   GPIOD_IS_OUT);
if (ret) {
-- 
2.14.1

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


[U-Boot] [PATCH 3/3] dts: sunxi: add PWM node for sun50i

2017-09-17 Thread Vasily Khoruzhick
Signed-off-by: Vasily Khoruzhick 
---
 arch/arm/dts/sun50i-a64.dtsi | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/dts/sun50i-a64.dtsi b/arch/arm/dts/sun50i-a64.dtsi
index 65a344d9ce..14e94bf00e 100644
--- a/arch/arm/dts/sun50i-a64.dtsi
+++ b/arch/arm/dts/sun50i-a64.dtsi
@@ -319,6 +319,14 @@
};
};
 
+   pwm: pwm@01c21400 {
+   compatible = "allwinner,sun50i-a64-pwm";
+   reg = <0x01c21400 0x8>;
+   clocks = <>;
+   #pwm-cells = <3>;
+   status = "disabled";
+   };
+
uart0: serial@1c28000 {
compatible = "snps,dw-apb-uart";
reg = <0x01c28000 0x400>;
-- 
2.14.1

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


[U-Boot] [PATCH 1/3] pwm: sunxi: add support for PWM found on Allwinner A64 and H3

2017-09-17 Thread Vasily Khoruzhick
This commit adds basic support for PWM found on Allwinner A64 and H3

Signed-off-by: Vasily Khoruzhick 
---
 arch/arm/include/asm/arch-sunxi/gpio.h |   1 +
 arch/arm/include/asm/arch-sunxi/pwm.h  |  12 +++
 arch/arm/mach-sunxi/board.c|  11 +++
 drivers/pwm/Kconfig|   7 ++
 drivers/pwm/Makefile   |   1 +
 drivers/pwm/sunxi_pwm.c| 174 +
 6 files changed, 206 insertions(+)
 create mode 100644 drivers/pwm/sunxi_pwm.c

diff --git a/arch/arm/include/asm/arch-sunxi/gpio.h 
b/arch/arm/include/asm/arch-sunxi/gpio.h
index 24f85206c8..7265d18099 100644
--- a/arch/arm/include/asm/arch-sunxi/gpio.h
+++ b/arch/arm/include/asm/arch-sunxi/gpio.h
@@ -173,6 +173,7 @@ enum sunxi_gpio_number {
 #define SUN8I_GPD_SDC1 3
 #define SUNXI_GPD_LCD0 2
 #define SUNXI_GPD_LVDS03
+#define SUNXI_GPD_PWM  2
 
 #define SUN5I_GPE_SDC2 3
 #define SUN8I_GPE_TWI2 3
diff --git a/arch/arm/include/asm/arch-sunxi/pwm.h 
b/arch/arm/include/asm/arch-sunxi/pwm.h
index 5884b5dbe7..673e0eb7b5 100644
--- a/arch/arm/include/asm/arch-sunxi/pwm.h
+++ b/arch/arm/include/asm/arch-sunxi/pwm.h
@@ -11,8 +11,15 @@
 #define SUNXI_PWM_CH0_PERIOD   (SUNXI_PWM_BASE + 4)
 
 #define SUNXI_PWM_CTRL_PRESCALE0(x)((x) & 0xf)
+#define SUNXI_PWM_CTRL_PRESCALE0_MASK  (0xf)
 #define SUNXI_PWM_CTRL_ENABLE0 (0x5 << 4)
 #define SUNXI_PWM_CTRL_POLARITY0(x)((x) << 5)
+#define SUNXI_PWM_CTRL_POLARITY0_MASK  (1 << 5)
+#define SUNXI_PWM_CTRL_CLK_GATE(1 << 6)
+
+#define SUNXI_PWM_CH0_PERIOD_MAX   (0x)
+#define SUNXI_PWM_CH0_PERIOD_PRD(x)((x & 0x) << 16)
+#define SUNXI_PWM_CH0_PERIOD_DUTY(x)   ((x) & 0x)
 
 #define SUNXI_PWM_PERIOD_80PCT 0x04af03c0
 
@@ -31,4 +38,9 @@
 #define SUNXI_PWM_MUX  SUN8I_GPH_PWM
 #endif
 
+struct sunxi_pwm {
+   u32 ctrl;
+   u32 ch0_period;
+};
+
 #endif
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 65b1ebd837..a85f973a46 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -141,6 +141,16 @@ static int gpio_init(void)
return 0;
 }
 
+static int pwm_init(void)
+{
+#ifdef CONFIG_PWM_SUNXI
+#ifdef CONFIG_MACH_SUN50I
+   sunxi_gpio_set_cfgpin(SUNXI_GPD(22), SUNXI_GPD_PWM);
+#endif
+#endif
+   return 0;
+}
+
 #if defined(CONFIG_SPL_BOARD_LOAD_IMAGE) && defined(CONFIG_SPL_BUILD)
 static int spl_board_load_image(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev)
@@ -204,6 +214,7 @@ void s_init(void)
clock_init();
timer_init();
gpio_init();
+   pwm_init();
 #ifndef CONFIG_DM_I2C
i2c_init_board();
 #endif
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig
index e827558052..67e3f355e7 100644
--- a/drivers/pwm/Kconfig
+++ b/drivers/pwm/Kconfig
@@ -43,3 +43,10 @@ config PWM_TEGRA
  four channels with a programmable period and duty cycle. Only a
  32KHz clock is supported by the driver but the duty cycle is
  configurable.
+
+config PWM_SUNXI
+   bool "Enable support for the Allwinner Sunxi PWM"
+   depends on DM_PWM
+   help
+ This PWM is found on A64 and other Allwinner SoCs. It supports a
+ programmable period and duty cycle. A 32-bit counter is used.
diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile
index 29d59916cb..1a8f8a58bc 100644
--- a/drivers/pwm/Makefile
+++ b/drivers/pwm/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_PWM_IMX) += pwm-imx.o pwm-imx-util.o
 obj-$(CONFIG_PWM_ROCKCHIP) += rk_pwm.o
 obj-$(CONFIG_PWM_SANDBOX)  += sandbox_pwm.o
 obj-$(CONFIG_PWM_TEGRA)+= tegra_pwm.o
+obj-$(CONFIG_PWM_SUNXI)+= sunxi_pwm.o
diff --git a/drivers/pwm/sunxi_pwm.c b/drivers/pwm/sunxi_pwm.c
new file mode 100644
index 00..3e6d69fa1c
--- /dev/null
+++ b/drivers/pwm/sunxi_pwm.c
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2017 Vasily Khoruzhick 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct sunxi_pwm_priv {
+   struct sunxi_pwm *regs;
+   ulong freq;
+   bool invert;
+   uint32_t prescaler;
+};
+
+static const uint32_t prescaler_table[] = {
+   120,/*  */
+   180,/* 0001 */
+   240,/* 0010 */
+   360,/* 0011 */
+   480,/* 0100 */
+   0,  /* 0101 */
+   0,  /* 0110 */
+   0,  /* 0111 */
+   12000,  /* 1000 */
+   24000,  /* 1001 */
+   36000,  /* 1010 */
+   48000,  /* 1011 */
+   72000,  /* 1100 */
+   0,  /* 1101 */
+   0,  /* 1110 */
+   1,  /*  */
+};
+
+static const uint64_t nsecs_per_sec = 10L;
+
+static int sunxi_pwm_set_invert(struct udevice *dev, uint 

[U-Boot] [PATCH 5/5] sunxi: video: add LCD support to DE2 driver

2017-09-17 Thread Vasily Khoruzhick
Extend DE2 driver with LCD support

Signed-off-by: Vasily Khoruzhick 
---
 arch/arm/mach-sunxi/Kconfig |   2 +-
 drivers/video/sunxi/Makefile|   2 +-
 drivers/video/sunxi/sunxi_de2.c |  17 +
 drivers/video/sunxi/sunxi_lcd.c | 142 
 4 files changed, 161 insertions(+), 2 deletions(-)
 create mode 100644 drivers/video/sunxi/sunxi_lcd.c

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 2309f5..06d697e3a7 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -680,7 +680,7 @@ config VIDEO_LCD_MODE
 
 config VIDEO_LCD_DCLK_PHASE
int "LCD panel display clock phase"
-   depends on VIDEO
+   depends on VIDEO || DM_VIDEO
default 1
---help---
Select LCD panel display clock phase shift, range 0-3.
diff --git a/drivers/video/sunxi/Makefile b/drivers/video/sunxi/Makefile
index 0d64c2021f..8c91766c24 100644
--- a/drivers/video/sunxi/Makefile
+++ b/drivers/video/sunxi/Makefile
@@ -6,4 +6,4 @@
 #
 
 obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o lcdc.o tve_common.o 
../videomodes.o
-obj-$(CONFIG_VIDEO_DE2) += sunxi_de2.o sunxi_dw_hdmi.o lcdc.o ../dw_hdmi.o
+obj-$(CONFIG_VIDEO_DE2) += sunxi_de2.o sunxi_dw_hdmi.o lcdc.o ../dw_hdmi.o 
sunxi_lcd.o
diff --git a/drivers/video/sunxi/sunxi_de2.c b/drivers/video/sunxi/sunxi_de2.c
index ee67764ac5..a838bbacd1 100644
--- a/drivers/video/sunxi/sunxi_de2.c
+++ b/drivers/video/sunxi/sunxi_de2.c
@@ -232,6 +232,23 @@ static int sunxi_de2_probe(struct udevice *dev)
if (!(gd->flags & GD_FLG_RELOC))
return 0;
 
+   ret = uclass_find_device_by_name(UCLASS_DISPLAY,
+"sunxi_lcd", );
+   if (!ret) {
+   int mux;
+
+   mux = 0;
+
+   ret = sunxi_de2_init(dev, plat->base, VIDEO_BPP32, disp, mux,
+false);
+   if (!ret) {
+   video_set_flush_dcache(dev, 1);
+   return 0;
+   }
+   }
+
+   debug("%s: lcd display not found (ret=%d)\n", __func__, ret);
+
ret = uclass_find_device_by_name(UCLASS_DISPLAY,
 "sunxi_dw_hdmi", );
if (!ret) {
diff --git a/drivers/video/sunxi/sunxi_lcd.c b/drivers/video/sunxi/sunxi_lcd.c
new file mode 100644
index 00..154eb5835e
--- /dev/null
+++ b/drivers/video/sunxi/sunxi_lcd.c
@@ -0,0 +1,142 @@
+/*
+ * Allwinner LCD driver
+ *
+ * (C) Copyright 2017 Vasily Khoruzhick 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct sunxi_lcd_priv {
+   struct display_timing timing;
+   int panel_bpp;
+};
+
+static void sunxi_lcdc_config_pinmux(void)
+{
+   int pin;
+   for (pin = SUNXI_GPD(0); pin <= SUNXI_GPD(21); pin++) {
+   sunxi_gpio_set_cfgpin(pin, SUNXI_GPD_LCD0);
+   sunxi_gpio_set_drv(pin, 3);
+   }
+}
+
+static int sunxi_lcd_enable(struct udevice *dev, int bpp,
+   const struct display_timing *edid)
+{
+   struct sunxi_ccm_reg * const ccm =
+  (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+   struct sunxi_lcdc_reg * const lcdc =
+  (struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE;
+   struct sunxi_lcd_priv *priv = dev_get_priv(dev);
+   struct udevice *backlight;
+   int clk_div, clk_double, ret;
+
+   /* Reset off */
+   setbits_le32(>ahb_reset1_cfg, 1 << AHB_RESET_OFFSET_LCD0);
+
+   /* Clock on */
+   setbits_le32(>ahb_gate1, 1 << AHB_GATE_OFFSET_LCD0);
+
+   lcdc_init(lcdc);
+   sunxi_lcdc_config_pinmux();
+   lcdc_pll_set(ccm, 0, edid->pixelclock.typ / 1000,
+_div, _double);
+   lcdc_tcon0_mode_set(lcdc, edid, clk_div, false,
+   priv->panel_bpp, CONFIG_VIDEO_LCD_DCLK_PHASE);
+   lcdc_enable(lcdc, priv->panel_bpp);
+
+   ret = uclass_get_device(UCLASS_PANEL_BACKLIGHT, 0, );
+   if (!ret)
+   backlight_enable(backlight);
+
+   return 0;
+}
+
+static int sunxi_lcd_read_timing(struct udevice *dev,
+struct display_timing *timing)
+{
+   struct sunxi_lcd_priv *priv = dev_get_priv(dev);
+   memcpy(timing, >timing, sizeof(struct display_timing));
+
+   return 0;
+}
+
+static int sunxi_lcd_probe(struct udevice *dev)
+{
+   struct udevice *cdev;
+   struct sunxi_lcd_priv *priv = dev_get_priv(dev);
+   int ret;
+
+   /* make sure that clock is active */
+   clock_set_pll10(43200);
+
+#ifdef CONFIG_VIDEO_BRIDGE
+   /* Try to get timings from bridge first */
+   ret = uclass_get_device(UCLASS_VIDEO_BRIDGE, 0, );
+   if (!ret) {
+   u8 edid[EDID_SIZE];
+   int channel_bpp;
+
+   ret = 

[U-Boot] [PATCH 3/5] video: add anx6345 DM driver

2017-09-17 Thread Vasily Khoruzhick
This is a eDP bridge similar to ANX9804, it allows to connect eDP panels
to the chips that can output only parallel signal

Signed-off-by: Vasily Khoruzhick 
---
 drivers/video/bridge/Kconfig   |   8 +
 drivers/video/bridge/Makefile  |   1 +
 drivers/video/bridge/anx6345.c | 419 +
 3 files changed, 428 insertions(+)
 create mode 100644 drivers/video/bridge/anx6345.c

diff --git a/drivers/video/bridge/Kconfig b/drivers/video/bridge/Kconfig
index 2a3b6c4bee..765f7380b8 100644
--- a/drivers/video/bridge/Kconfig
+++ b/drivers/video/bridge/Kconfig
@@ -25,3 +25,11 @@ config VIDEO_BRIDGE_NXP_PTN3460
  signalling) converter. It enables an LVDS LCD panel to be connected
  to an eDP output device such as an SoC that lacks LVDS capability,
  or where LVDS requires too many signals to route on the PCB.
+
+config VIDEO_BRIDGE_ANALOGIX_ANX6345
+   bool "Support Analogix ANX6345 RGB->DP bridge"
+   depends on VIDEO_BRIDGE
+   select DM_I2C
+   help
+The Analogix ANX6345 is RGB-to-DP converter. It enables an eDP LCD
+panel to be connected to an parallel LCD interface.
diff --git a/drivers/video/bridge/Makefile b/drivers/video/bridge/Makefile
index ce731fa4ca..2a746c6f8b 100644
--- a/drivers/video/bridge/Makefile
+++ b/drivers/video/bridge/Makefile
@@ -7,3 +7,4 @@
 obj-$(CONFIG_VIDEO_BRIDGE) += video-bridge-uclass.o
 obj-$(CONFIG_VIDEO_BRIDGE_PARADE_PS862X) += ps862x.o
 obj-$(CONFIG_VIDEO_BRIDGE_NXP_PTN3460) += ptn3460.o
+obj-$(CONFIG_VIDEO_BRIDGE_ANALOGIX_ANX6345) += anx6345.o
diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c
new file mode 100644
index 00..6bac9a51a9
--- /dev/null
+++ b/drivers/video/bridge/anx6345.c
@@ -0,0 +1,419 @@
+/*
+ * Copyright (C) 2017 Vasily Khoruzhick 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DP_MAX_LINK_RATE   0x001
+#define DP_MAX_LANE_COUNT  0x002
+#define DP_MAX_LANE_COUNT_MASK 0x1f
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct anx6345_priv {
+   u8 edid[EDID_SIZE];
+};
+
+static int anx6345_write(struct udevice *dev, unsigned addr_off,
+unsigned char reg_addr, unsigned char value)
+{
+   uint8_t buf[2];
+   struct i2c_msg msg;
+   int ret;
+
+   msg.addr = addr_off;
+   msg.flags = 0;
+   buf[0] = reg_addr;
+   buf[1] = value;
+   msg.buf = buf;
+   msg.len = 2;
+   ret = dm_i2c_xfer(dev, , 1);
+   if (ret) {
+   debug("%s: write failed, reg=%#x, value=%#x, ret=%d\n",
+ __func__, reg_addr, value, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
+static int anx6345_read(struct udevice *dev, unsigned addr_off,
+   unsigned char reg_addr, unsigned char *value)
+{
+   uint8_t addr, val;
+   struct i2c_msg msg[2];
+   int ret;
+
+   msg[0].addr = addr_off;
+   msg[0].flags = 0;
+   addr = reg_addr;
+   msg[0].buf = 
+   msg[0].len = 1;
+   msg[1].addr = addr_off;
+   msg[1].flags = I2C_M_RD;
+   msg[1].buf = 
+   msg[1].len = 1;
+   ret = dm_i2c_xfer(dev, msg, 2);
+   if (ret) {
+   debug("%s: read failed, reg=%.2x, value=%p, ret=%d\n",
+ __func__, (int)reg_addr, value, ret);
+   return ret;
+   }
+   *value = val;
+
+   return 0;
+}
+
+static int anx6345_write_r0(struct udevice *dev, unsigned char reg_addr,
+   unsigned char value)
+{
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
+   return anx6345_write(dev, chip->chip_addr, reg_addr, value);
+}
+
+static int anx6345_read_r0(struct udevice *dev, unsigned char reg_addr,
+  unsigned char *value)
+{
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
+   return anx6345_read(dev, chip->chip_addr, reg_addr, value);
+}
+
+static int anx6345_write_r1(struct udevice *dev, unsigned char reg_addr,
+   unsigned char value)
+{
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
+   return anx6345_write(dev, chip->chip_addr + 1, reg_addr, value);
+}
+
+static int anx6345_read_r1(struct udevice *dev, unsigned char reg_addr,
+  unsigned char *value)
+{
+   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
+   return anx6345_read(dev, chip->chip_addr + 1, reg_addr, value);
+}
+
+static int anx6345_set_backlight(struct udevice *dev, int percent)
+{
+   return -ENOSYS;
+}
+
+static int anx6345_aux_wait(struct udevice *dev)
+{
+   int ret = -ETIMEDOUT;
+   u8 v;
+   int retries = 1000;
+   do {
+   anx6345_read_r0(dev, ANX9804_DP_AUX_CH_CTL_2, );
+   if (!(v & ANX9804_AUX_EN)) {
+   ret = 0;
+ 

[U-Boot] [PATCH 4/5] sunxi: video: split out PLL code

2017-09-17 Thread Vasily Khoruzhick
It will be reused in new DM LCD driver.

Signed-off-by: Vasily Khoruzhick 
---
 arch/arm/include/asm/arch-sunxi/lcdc.h |   2 +
 drivers/video/sunxi/lcdc.c | 117 ++-
 drivers/video/sunxi/sunxi_display.c| 121 ++---
 3 files changed, 124 insertions(+), 116 deletions(-)

diff --git a/arch/arm/include/asm/arch-sunxi/lcdc.h 
b/arch/arm/include/asm/arch-sunxi/lcdc.h
index a751698b4f..5d9253aaa5 100644
--- a/arch/arm/include/asm/arch-sunxi/lcdc.h
+++ b/arch/arm/include/asm/arch-sunxi/lcdc.h
@@ -124,5 +124,7 @@ void lcdc_tcon0_mode_set(struct sunxi_lcdc_reg * const lcdc,
 void lcdc_tcon1_mode_set(struct sunxi_lcdc_reg * const lcdc,
 const struct display_timing *mode,
 bool ext_hvsync, bool is_composite);
+void lcdc_pll_set(struct sunxi_ccm_reg * const ccm, int tcon,
+ int dotclock, int *clk_div, int *clk_double);
 
 #endif /* _LCDC_H */
diff --git a/drivers/video/sunxi/lcdc.c b/drivers/video/sunxi/lcdc.c
index 7d215b713e..023a30cb1e 100644
--- a/drivers/video/sunxi/lcdc.c
+++ b/drivers/video/sunxi/lcdc.c
@@ -10,6 +10,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 
@@ -100,7 +101,7 @@ void lcdc_tcon0_mode_set(struct sunxi_lcdc_reg * const lcdc,
writel(SUNXI_LCDC_TCON0_TIMING_V_TOTAL(total) |
   SUNXI_LCDC_TCON0_TIMING_V_BP(bp), >tcon0_timing_v);
 
-#ifdef CONFIG_VIDEO_LCD_IF_PARALLEL
+#if defined(CONFIG_VIDEO_LCD_IF_PARALLEL) || defined(CONFIG_VIDEO_DE2)
writel(SUNXI_LCDC_X(mode->hsync_len.typ) |
   SUNXI_LCDC_Y(mode->vsync_len.typ), >tcon0_timing_sync);
 
@@ -207,3 +208,117 @@ void lcdc_tcon1_mode_set(struct sunxi_lcdc_reg * const 
lcdc,
SUNXI_LCDC_MUX_CTRL_SRC0(1));
 #endif
 }
+
+void lcdc_pll_set(struct sunxi_ccm_reg *ccm, int tcon, int dotclock,
+ int *clk_div, int *clk_double)
+{
+   int value, n, m, min_m, max_m, diff;
+   int best_n = 0, best_m = 0, best_diff = 0x0FFF;
+   int best_double = 0;
+   bool use_mipi_pll = false;
+
+   if (tcon == 0) {
+#if defined(CONFIG_VIDEO_LCD_IF_PARALLEL) || defined(CONFIG_SUNXI_DE2)
+   min_m = 6;
+   max_m = 127;
+#endif
+#ifdef CONFIG_VIDEO_LCD_IF_LVDS
+   min_m = max_m = 7;
+#endif
+   } else {
+   min_m = 1;
+   max_m = 15;
+   }
+
+   /*
+* Find the lowest divider resulting in a matching clock, if there
+* is no match, pick the closest lower clock, as monitors tend to
+* not sync to higher frequencies.
+*/
+   for (m = min_m; m <= max_m; m++) {
+#ifndef CONFIG_SUNXI_DE2
+   n = (m * dotclock) / 3000;
+
+   if ((n >= 9) && (n <= 127)) {
+   value = (3000 * n) / m;
+   diff = dotclock - value;
+   if (diff < best_diff) {
+   best_diff = diff;
+   best_m = m;
+   best_n = n;
+   best_double = 0;
+   }
+   }
+
+   /* These are just duplicates */
+   if (!(m & 1))
+   continue;
+#endif
+
+   /* No double clock on DE2 */
+   n = (m * dotclock) / 6000;
+   if ((n >= 9) && (n <= 127)) {
+   value = (6000 * n) / m;
+   diff = dotclock - value;
+   if (diff < best_diff) {
+   best_diff = diff;
+   best_m = m;
+   best_n = n;
+   best_double = 1;
+   }
+   }
+   }
+
+#ifdef CONFIG_MACH_SUN6I
+   /*
+* Use the MIPI pll if we've been unable to find any matching setting
+* for PLL3, this happens with high dotclocks because of min_m = 6.
+*/
+   if (tcon == 0 && best_n == 0) {
+   use_mipi_pll = true;
+   best_m = 6;  /* Minimum m for tcon0 */
+   }
+
+   if (use_mipi_pll) {
+   clock_set_pll3(29700); /* Fix the video pll at 297 MHz */
+   clock_set_mipi_pll(best_m * dotclock * 1000);
+   debug("dotclock: %dkHz = %dkHz via mipi pll\n",
+ dotclock, clock_get_mipi_pll() / best_m / 1000);
+   } else
+#endif
+   {
+   clock_set_pll3(best_n * 300);
+   debug("dotclock: %dkHz = %dkHz: (%d * 3MHz * %d) / %d\n",
+ dotclock,
+ (best_double + 1) * clock_get_pll3() / best_m / 1000,
+ best_double + 1, best_n, best_m);
+   }
+
+   if (tcon == 0) {
+   u32 pll;
+
+   if (use_mipi_pll)
+   pll = CCM_LCD_CH0_CTRL_MIPI_PLL;
+   else if 

[U-Boot] [PATCH 2/5] video: anx9804: split out registers definitions into a separate header

2017-09-17 Thread Vasily Khoruzhick
This header will be used in anx6345 driver

Signed-off-by: Vasily Khoruzhick 
---
 drivers/video/anx9804.c | 54 +--
 include/anx98xx-edp.h   | 98 +
 2 files changed, 99 insertions(+), 53 deletions(-)
 create mode 100644 include/anx98xx-edp.h

diff --git a/drivers/video/anx9804.c b/drivers/video/anx9804.c
index 37ad69a039..67f7da7d18 100755
--- a/drivers/video/anx9804.c
+++ b/drivers/video/anx9804.c
@@ -12,61 +12,9 @@
 
 #include 
 #include 
+#include 
 #include "anx9804.h"
 
-/* Registers at i2c address 0x38 */
-
-#define ANX9804_HDCP_CONTROL_0_REG 0x01
-
-#define ANX9804_SYS_CTRL2_REG  0x81
-#define ANX9804_SYS_CTRL2_CHA_STA  0x04
-
-#define ANX9804_SYS_CTRL3_REG  0x82
-#define ANX9804_SYS_CTRL3_VALID_CTRL   BIT(0)
-#define ANX9804_SYS_CTRL3_F_VALID  BIT(1)
-#define ANX9804_SYS_CTRL3_HPD_CTRL BIT(4)
-#define ANX9804_SYS_CTRL3_F_HPDBIT(5)
-
-#define ANX9804_LINK_BW_SET_REG0xa0
-#define ANX9804_LANE_COUNT_SET_REG 0xa1
-#define ANX9804_TRAINING_PTN_SET_REG   0xa2
-#define ANX9804_TRAINING_LANE0_SET_REG 0xa3
-#define ANX9804_TRAINING_LANE1_SET_REG 0xa4
-#define ANX9804_TRAINING_LANE2_SET_REG 0xa5
-#define ANX9804_TRAINING_LANE3_SET_REG 0xa6
-
-#define ANX9804_LINK_TRAINING_CTRL_REG 0xa8
-#define ANX9804_LINK_TRAINING_CTRL_EN  BIT(0)
-
-#define ANX9804_LINK_DEBUG_REG 0xb8
-#define ANX9804_PLL_CTRL_REG   0xc7
-#define ANX9804_ANALOG_POWER_DOWN_REG  0xc8
-
-/* Registers at i2c address 0x39 */
-
-#define ANX9804_DEV_IDH_REG0x03
-
-#define ANX9804_POWERD_CTRL_REG0x05
-#define ANX9804_POWERD_AUDIO   BIT(4)
-
-#define ANX9804_RST_CTRL_REG   0x06
-
-#define ANX9804_RST_CTRL2_REG  0x07
-#define ANX9804_RST_CTRL2_AUX  BIT(2)
-#define ANX9804_RST_CTRL2_AC_MODE  BIT(6)
-
-#define ANX9804_VID_CTRL1_REG  0x08
-#define ANX9804_VID_CTRL1_VID_EN   BIT(7)
-#define ANX9804_VID_CTRL1_EDGE BIT(0)
-
-#define ANX9804_VID_CTRL2_REG  0x09
-#define ANX9804_ANALOG_DEBUG_REG1  0xdc
-#define ANX9804_ANALOG_DEBUG_REG3  0xde
-#define ANX9804_PLL_FILTER_CTRL1   0xdf
-#define ANX9804_PLL_FILTER_CTRL3   0xe1
-#define ANX9804_PLL_FILTER_CTRL0xe2
-#define ANX9804_PLL_CTRL3  0xe6
-
 /**
  * anx9804_init() - Init anx9804 parallel lcd to edp bridge chip
  *
diff --git a/include/anx98xx-edp.h b/include/anx98xx-edp.h
new file mode 100644
index 00..f7e8baa167
--- /dev/null
+++ b/include/anx98xx-edp.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2015 Hans de Goede 
+ * Copyright (C) 2017 Vasily Khoruzhick 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+/* Registers at i2c address 0x38 */
+
+#define ANX9804_HDCP_CONTROL_0_REG 0x01
+
+#define ANX9804_SYS_CTRL1_REG  0x80
+#define ANX9804_SYS_CTRL1_PD_IO0x80
+#define ANX9804_SYS_CTRL1_PD_VID   0x40
+#define ANX9804_SYS_CTRL1_PD_LINK  0x20
+#define ANX9804_SYS_CTRL1_PD_TOTAL 0x10
+#define ANX9804_SYS_CTRL1_MODE_SEL 0x08
+#define ANX9804_SYS_CTRL1_DET_STA  0x04
+#define ANX9804_SYS_CTRL1_FORCE_DET0x02
+#define ANX9804_SYS_CTRL1_DET_CTRL 0x01
+
+#define ANX9804_SYS_CTRL2_REG  0x81
+#define ANX9804_SYS_CTRL2_CHA_STA  0x04
+
+#define ANX9804_SYS_CTRL3_REG  0x82
+#define ANX9804_SYS_CTRL3_VALID_CTRL   BIT(0)
+#define ANX9804_SYS_CTRL3_F_VALID  BIT(1)
+#define ANX9804_SYS_CTRL3_HPD_CTRL BIT(4)
+#define ANX9804_SYS_CTRL3_F_HPDBIT(5)
+
+#define ANX9804_LINK_BW_SET_REG

[U-Boot] [PATCH 1/5] dm: video: bridge: add operation to read EDID

2017-09-17 Thread Vasily Khoruzhick
Bridge may have ability to read EDID from panel that is connected to it,
so add an operation to read EDID.

Signed-off-by: Vasily Khoruzhick 
---
 drivers/video/bridge/video-bridge-uclass.c | 10 ++
 include/video_bridge.h | 20 
 2 files changed, 30 insertions(+)

diff --git a/drivers/video/bridge/video-bridge-uclass.c 
b/drivers/video/bridge/video-bridge-uclass.c
index 07270bac9e..79facd02a6 100644
--- a/drivers/video/bridge/video-bridge-uclass.c
+++ b/drivers/video/bridge/video-bridge-uclass.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 int video_bridge_set_backlight(struct udevice *dev, int percent)
@@ -45,6 +46,15 @@ int video_bridge_check_attached(struct udevice *dev)
return ops->check_attached(dev);
 }
 
+int video_bridge_read_edid(struct udevice *dev, u8 *buf, int buf_size)
+{
+   struct video_bridge_ops *ops = video_bridge_get_ops(dev);
+
+   if (!ops || !ops->read_edid)
+   return -ENOSYS;
+   return ops->read_edid(dev, buf, buf_size);
+}
+
 static int video_bridge_pre_probe(struct udevice *dev)
 {
struct video_bridge_priv *uc_priv = dev_get_uclass_priv(dev);
diff --git a/include/video_bridge.h b/include/video_bridge.h
index c7b8681849..0699a8dda8 100644
--- a/include/video_bridge.h
+++ b/include/video_bridge.h
@@ -53,6 +53,16 @@ struct video_bridge_ops {
 * @return 0 if OK, -ve on error
 */
int (*set_backlight)(struct udevice *dev, int percent);
+
+   /**
+* read_edid() - Read information from EDID
+*
+* @dev:Device to read from
+* @buf:Buffer to read into
+* @buf_size:   Buffer size
+* @return number of bytes read, <=0 for error
+*/
+   int (*read_edid)(struct udevice *dev, u8 *buf, int buf_size);
 };
 
 #define video_bridge_get_ops(dev) \
@@ -89,4 +99,14 @@ int video_bridge_set_active(struct udevice *dev, bool 
active);
  */
 int video_bridge_check_attached(struct udevice *dev);
 
+/**
+ * video_bridge_read_edid() - Read information from EDID
+ *
+ * @dev:   Device to read from
+ * @buf:   Buffer to read into
+ * @buf_size:  Buffer size
+ * @return number of bytes read, <=0 for error
+ */
+int video_bridge_read_edid(struct udevice *dev, u8 *buf, int buf_size);
+
 #endif
-- 
2.14.1

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


[U-Boot] [PATCH V4 3/5] arm: da850-evm: Enable DM and device tree support for da850-evm

2017-09-17 Thread Adam Ford
With the device tree ported and DM compatible drivers, enable:
OF_CONTROL, DM_SPI, DM_SPI_FLASH and DM_SERIAL

Note: DM_SERIAL is not enabled for da850evm_direct_nor_defconfig
yet.

Reviewed-by: Jagan Teki 
Signed-off-by: Adam Ford 
---
V4: Fixed isues with da850_am8xxevm and da850evm_direct_nor and resync with 
master
V3: No Change

diff --git a/board/davinci/da8xxevm/Kconfig b/board/davinci/da8xxevm/Kconfig
index bb1188b..e0df97c 100644
--- a/board/davinci/da8xxevm/Kconfig
+++ b/board/davinci/da8xxevm/Kconfig
@@ -33,6 +33,8 @@ config MAC_ADDR_IN_EEPROM
 
 endif
 
+source "board/ti/common/Kconfig"
+
 endif
 
 if TARGET_OMAPL138_LCDK
diff --git a/board/davinci/da8xxevm/da850evm.c 
b/board/davinci/da8xxevm/da850evm.c
index 516d86d..83c9f29 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -60,7 +60,7 @@ static int get_mac_addr(u8 *addr)
return -1;
}
 
-   ret = spi_flash_read(flash, CFG_MAC_ADDR_OFFSET, 6, addr);
+   ret = spi_flash_read(flash, (CFG_MAC_ADDR_OFFSET) + 1, 7, addr);
if (ret) {
printf("Error - unable to read MAC address from SPI flash.\n");
return -1;
@@ -140,6 +140,7 @@ int misc_init_r(void)
uchar buff[6];
 
spi_mac_read = get_mac_addr(buff);
+   buff[0] = 0;
 
/*
 * MAC address not present in the environment
diff --git a/configs/da850_am18xxevm_defconfig 
b/configs/da850_am18xxevm_defconfig
index 27370e7..832c9ce 100644
--- a/configs/da850_am18xxevm_defconfig
+++ b/configs/da850_am18xxevm_defconfig
@@ -1,17 +1,16 @@
 CONFIG_ARM=y
 CONFIG_ARCH_DAVINCI=y
 CONFIG_TARGET_DA850EVM=y
-CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_MAC_ADDR_IN_EEPROM=y
+CONFIG_TI_COMMON_CMD_OPTIONS=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_DEFAULT_DEVICE_TREE="da850-evm"
 
CONFIG_SYS_EXTRA_OPTIONS="DA850_AM18X_EVM,SYS_I2C_EEPROM_ADDR_LEN=2,SYS_I2C_EEPROM_ADDR=0x50"
 CONFIG_BOOTDELAY=3
-CONFIG_USE_BOOTARGS=y
-CONFIG_BOOTARGS="mem=32M console=ttyS2,115200n8 root=/dev/mtdblock2 rw 
noinitrd ip=dhcp"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -19,7 +18,7 @@ CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL=y
 CONFIG_SPL_BOARD_INIT=y
 CONFIG_HUSH_PARSER=y
-# CONFIG_CMD_BOOTZ is not set
+CONFIG_SYS_PROMPT="U-Boot > "
 # CONFIG_CMD_IMLS is not set
 CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_EEPROM is not set
@@ -33,10 +32,14 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_EXT4 is not set
 # CONFIG_CMD_FS_GENERIC is not set
 CONFIG_CMD_DIAG=y
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_DM=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
+CONFIG_DM_SPI=y
 # CONFIG_FAT_WRITE is not set
-CONFIG_OF_LIBFDT=y
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index bfa5ea1..05dc813 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -7,9 +7,9 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
 CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_DEFAULT_DEVICE_TREE="da850-evm"
+CONFIG_SYS_EXTRA_OPTIONS="MAC_ADDR_IN_SPIFLASH"
 CONFIG_BOOTDELAY=3
-CONFIG_USE_BOOTARGS=y
-CONFIG_BOOTARGS="mem=32M console=ttyS2,115200n8 root=/dev/mtdblock2 rw 
noinitrd ip=dhcp"
 CONFIG_VERSION_VARIABLE=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
@@ -31,10 +31,14 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_EXT4 is not set
 # CONFIG_CMD_FS_GENERIC is not set
 CONFIG_CMD_DIAG=y
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_DM=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
+CONFIG_DM_SPI=y
 # CONFIG_FAT_WRITE is not set
-CONFIG_OF_LIBFDT=y
diff --git a/configs/da850evm_direct_nor_defconfig 
b/configs/da850evm_direct_nor_defconfig
index 24ab892..8f8bad0 100644
--- a/configs/da850evm_direct_nor_defconfig
+++ b/configs/da850evm_direct_nor_defconfig
@@ -2,6 +2,8 @@ CONFIG_ARM=y
 CONFIG_ARCH_DAVINCI=y
 CONFIG_TARGET_DA850EVM=y
 CONFIG_TI_COMMON_CMD_OPTIONS=y
+CONFIG_DEFAULT_DEVICE_TREE="da850-evm"
+# CONFIG_SYS_MALLOC_F is not set
 CONFIG_SYS_EXTRA_OPTIONS="USE_NOR,DIRECT_NOR_BOOT"
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
@@ -28,11 +30,14 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_FAT is not set
 # CONFIG_CMD_FS_GENERIC is not set
 CONFIG_CMD_DIAG=y
+CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_FLASH=y
+CONFIG_DM=y
 # CONFIG_MMC is not set
 CONFIG_MTD_NOR_FLASH=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
 CONFIG_SYS_NS16550=y
-CONFIG_OF_LIBFDT=y
+CONFIG_DM_SPI=y
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index c05c64c..d383c23 100644
--- 

[U-Boot] [PATCH V4 2/5] spi: davinci_spi: Add da830-spi support for DM

2017-09-17 Thread Adam Ford
The DM support is already in the driver, so add
da830-spi to the compatible list.

Reviewed-by: Jagan Teki 
Signed-off-by: Adam Ford 
---
V4:  Resync
V3:  No Change
V2:  This patch is new to the series
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index 291ef95..eda252d 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -563,6 +563,7 @@ static const struct dm_spi_ops davinci_spi_ops = {
 static const struct udevice_id davinci_spi_ids[] = {
{ .compatible = "ti,keystone-spi" },
{ .compatible = "ti,dm6441-spi" },
+   { .compatible = "ti,da830-spi" },
{ }
 };
 
-- 
2.7.4

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


[U-Boot] [PATCH V4 5/5] ARM: da850-evm: Enable DM_I2C

2017-09-17 Thread Adam Ford
With DM now enabled with the device tree pulled from Linux, we can
enable DM_I2C in U-Boot.

Reviewed-by: Jagan Teki 
Signed-off-by: Adam Ford 
---
V4: Resync with master
V3: No Change
V2: New to series
diff --git a/arch/arm/dts/da850-evm-u-boot.dtsi 
b/arch/arm/dts/da850-evm-u-boot.dtsi
index 5cca47d..5cc5a81 100644
--- a/arch/arm/dts/da850-evm-u-boot.dtsi
+++ b/arch/arm/dts/da850-evm-u-boot.dtsi
@@ -13,6 +13,7 @@
};
 
aliases {
+   i2c0 = 
spi0 = 
};
 };
diff --git a/configs/da850_am18xxevm_defconfig 
b/configs/da850_am18xxevm_defconfig
index 832c9ce..6ecca07 100644
--- a/configs/da850_am18xxevm_defconfig
+++ b/configs/da850_am18xxevm_defconfig
@@ -25,7 +25,6 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_GPIO is not set
 # CONFIG_CMD_GPT is not set
-# CONFIG_CMD_I2C is not set
 # CONFIG_CMD_PART is not set
 # CONFIG_CMD_SETEXPR is not set
 # CONFIG_CMD_TIME is not set
@@ -35,6 +34,7 @@ CONFIG_CMD_DIAG=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_DM=y
+CONFIG_DM_I2C=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index 80160ef..d6eb4a5 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -24,7 +24,6 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_GPIO is not set
 # CONFIG_CMD_GPT is not set
-# CONFIG_CMD_I2C is not set
 # CONFIG_CMD_PART is not set
 # CONFIG_CMD_SETEXPR is not set
 # CONFIG_CMD_TIME is not set
@@ -35,6 +34,8 @@ CONFIG_CMD_DIAG=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_DM=y
+CONFIG_DM_I2C=y
+CONFIG_DM_I2C_COMPAT=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
diff --git a/configs/da850evm_direct_nor_defconfig 
b/configs/da850evm_direct_nor_defconfig
index 8f8bad0..3c8e7ad 100644
--- a/configs/da850evm_direct_nor_defconfig
+++ b/configs/da850evm_direct_nor_defconfig
@@ -19,7 +19,6 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_EEPROM is not set
 # CONFIG_CMD_GPIO is not set
 # CONFIG_CMD_GPT is not set
-# CONFIG_CMD_I2C is not set
 # CONFIG_CMD_MMC is not set
 # CONFIG_CMD_PART is not set
 # CONFIG_CMD_SPI is not set
@@ -33,6 +32,8 @@ CONFIG_CMD_DIAG=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_FLASH=y
 CONFIG_DM=y
+CONFIG_DM_I2C=y
+CONFIG_DM_I2C_COMPAT=y
 # CONFIG_MMC is not set
 CONFIG_MTD_NOR_FLASH=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index 0bdf0cb..821b1fe 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -167,11 +167,10 @@
 /*
  * I2C Configuration
  */
-#define CONFIG_SYS_I2C
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_SYS_I2C_DAVINCI
-#define CONFIG_SYS_DAVINCI_I2C_SPEED   25000
-#define CONFIG_SYS_DAVINCI_I2C_SLAVE   10 /* Bogus, master-only in U-Boot */
 #define CONFIG_SYS_I2C_EXPANDER_ADDR   0x20
+#endif
 
 /*
  * Flash & Environment
-- 
2.7.4

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


[U-Boot] [PATCH V4 4/5] arm: da850-evm: Enable MTD Parts in SPI Flash

2017-09-17 Thread Adam Ford
There is a discrepency between U-Boot and Linux on the partition map.
This enabes the MTD parts to pass MTD partition information from U-Boot to
Linux.  Linux already has a pending patch to enable MTD PARTS in
davinci_all_defconfig

Reviewed-by: Jagan Teki 
Signed-off-by: Adam Ford 
---
V4:  Resync with Master
V3:  No Change
V2:  This patch is new to the series

diff --git a/configs/da850evm_defconfig b/configs/da850evm_defconfig
index 05dc813..80160ef 100644
--- a/configs/da850evm_defconfig
+++ b/configs/da850evm_defconfig
@@ -30,6 +30,7 @@ CONFIG_CRC32_VERIFY=y
 # CONFIG_CMD_TIME is not set
 # CONFIG_CMD_EXT4 is not set
 # CONFIG_CMD_FS_GENERIC is not set
+CONFIG_CMD_MTDPARTS=y
 CONFIG_CMD_DIAG=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
@@ -38,6 +39,7 @@ CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_SPI_FLASH_MTD=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYS_NS16550=y
 CONFIG_DM_SPI=y
diff --git a/include/configs/da850evm.h b/include/configs/da850evm.h
index d383c23..0bdf0cb 100644
--- a/include/configs/da850evm.h
+++ b/include/configs/da850evm.h
@@ -249,6 +249,17 @@
 #define CONFIG_ENV_SIZE(64 << 10)
 #define CONFIG_ENV_OFFSET  (512 << 10)
 #define CONFIG_ENV_SECT_SIZE   (64 << 10)
+#ifdef CONFIG_SPL_BUILD
+#undef CONFIG_SPI_FLASH_MTD
+#endif
+#define CONFIG_MTD_DEVICE  /* needed for mtdparts commands */
+#define CONFIG_MTD_PARTITIONS  /* required for UBI partition support */
+#define MTDIDS_DEFAULT "nor0=spi0.0"
+#define MTDPARTS_DEFAULT   "mtdparts=spi0.0:"\
+   "512k(u-boot.ais),"\
+   "64k(u-boot-env),"\
+   "7552k(kernel-spare),"\
+   "64k(MAC-Address)"
 #endif
 
 /*
-- 
2.7.4

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


[U-Boot] [PATCH V4 1/5] arm: dts: da850: Migrate da850-evm DTS files from Linux 4.13-RC5

2017-09-17 Thread Adam Ford
A few small additional items are needed to support DM_SPI and
DM_SERIAL, so those were added to da850-evm-u-boot.dtsi

Signed-off-by: Adam Ford 
---
V4: Re-sync with latest master
V3: New to series.  I forgot to generate this before. This is required before
 The rest of the files in the series.
diff --git a/arch/arm/dts/da850-evm-u-boot.dtsi 
b/arch/arm/dts/da850-evm-u-boot.dtsi
new file mode 100644
index 000..5cca47d
--- /dev/null
+++ b/arch/arm/dts/da850-evm-u-boot.dtsi
@@ -0,0 +1,22 @@
+/*
+ * da850-evm U-Boot Additions
+ *
+ * Copyright (C) 2017 Logic PD, Inc.
+ * Copyright (C) Adam Ford
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+/ {
+   chosen {
+   stdout-path = 
+   };
+
+   aliases {
+   spi0 = 
+   };
+};
+
+ {
+   compatible = "m25p64", "spi-flash";
+};
diff --git a/arch/arm/dts/da850-evm.dts b/arch/arm/dts/da850-evm.dts
new file mode 100644
index 000..67e72bc
--- /dev/null
+++ b/arch/arm/dts/da850-evm.dts
@@ -0,0 +1,304 @@
+/*
+ * Device Tree for DA850 EVM board
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation, version 2.
+ */
+/dts-v1/;
+#include "da850.dtsi"
+#include 
+
+/ {
+   compatible = "ti,da850-evm", "ti,da850";
+   model = "DA850/AM1808/OMAP-L138 EVM";
+
+   soc@1c0 {
+   pmx_core: pinmux@14120 {
+   status = "okay";
+
+   mcasp0_pins: pinmux_mcasp0_pins {
+   pinctrl-single,bits = <
+   /*
+* AHCLKX, ACLKX, AFSX, AHCLKR, ACLKR,
+* AFSR, AMUTE
+*/
+   0x00 0x 0x
+   /* AXR11, AXR12 */
+   0x04 0x00011000 0x000ff000
+   >;
+   };
+   nand_pins: nand_pins {
+   pinctrl-single,bits = <
+   /* EMA_WAIT[0], EMA_OE, EMA_WE, 
EMA_CS[4], EMA_CS[3] */
+   0x1c 0x10110110  0xf0ff0ff0
+   /*
+* EMA_D[0], EMA_D[1], EMA_D[2],
+* EMA_D[3], EMA_D[4], EMA_D[5],
+* EMA_D[6], EMA_D[7]
+*/
+   0x24 0x  0x
+   /* EMA_A[1], EMA_A[2] */
+   0x30 0x0110  0x0ff0
+   >;
+   };
+   };
+   serial0: serial@42000 {
+   status = "okay";
+   };
+   serial1: serial@10c000 {
+   status = "okay";
+   };
+   serial2: serial@10d000 {
+   status = "okay";
+   };
+   rtc0: rtc@23000 {
+   status = "okay";
+   };
+   i2c0: i2c@22000 {
+   status = "okay";
+   clock-frequency = <10>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins>;
+
+   tps: tps@48 {
+   reg = <0x48>;
+   };
+   tlv320aic3106: tlv320aic3106@18 {
+   #sound-dai-cells = <0>;
+   compatible = "ti,tlv320aic3106";
+   reg = <0x18>;
+   status = "okay";
+
+   /* Regulators */
+   IOVDD-supply = <_reg>;
+   /* Derived from VBAT: Baseboard 3.3V / 1.8V */
+   AVDD-supply = <>;
+   DRVDD-supply = <>;
+   DVDD-supply = <>;
+   };
+   tca6416: gpio@20 {
+   compatible = "ti,tca6416";
+   reg = <0x20>;
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+   };
+   wdt: wdt@21000 {
+   status = "okay";
+   };
+   mmc0: mmc@4 {
+   max-frequency = <5000>;
+   bus-width = <4>;
+   status = "okay";
+   

[U-Boot] [PATCH V4 0/5] Update DA850 to Device tree, SPI MTDPARTS, and DM

2017-09-17 Thread Adam Ford
This series gives a general update to the DA850 Family.  This series
ports the device trees from Linux 4.13 and enables DM, DM_SERIAL, DM_SPI,
and DM_I2C.  At this time, DM_GPIO isn't yet available, but it's pending.
During the revamp, it was noted a discrepency between Linux and U-Boot
partition mapping when using SPI Flash, so MTDPARTS was updated to make
sure the partition mapping in Linux would match the mapping in U-Boot.

Adam Ford (5):
  arm: dts: da850: Migrate da850-evm DTS files from Linux 4.13-RC5
  spi: davinci_spi: Add da830-spi support for DM
  arm: da850-evm: Enable DM and device tree support for da850-evm
  arm: da850-evm: Enable MTD Parts in SPI Flash
  ARM: da850-evm: Enable DM_I2C

 arch/arm/dts/da850-evm-u-boot.dtsi|  23 ++
 arch/arm/dts/da850-evm.dts| 304 ++
 arch/arm/dts/da850.dtsi   | 581 ++
 arch/arm/dts/tps6507x.dtsi|  47 +++
 board/davinci/da8xxevm/Kconfig|   2 +
 board/davinci/da8xxevm/da850evm.c |   3 +-
 configs/da850_am18xxevm_defconfig |  15 +-
 configs/da850evm_defconfig|  15 +-
 configs/da850evm_direct_nor_defconfig |  10 +-
 drivers/spi/davinci_spi.c |   1 +
 include/configs/da850evm.h|  57 +++-
 11 files changed, 1040 insertions(+), 18 deletions(-)
 create mode 100644 arch/arm/dts/da850-evm-u-boot.dtsi
 create mode 100644 arch/arm/dts/da850-evm.dts
 create mode 100644 arch/arm/dts/da850.dtsi
 create mode 100644 arch/arm/dts/tps6507x.dtsi

-- 
2.7.4

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


[U-Boot] [PATCH 15/16] efi: sandbox: Enable EFI loader builder for sandbox

2017-09-17 Thread Simon Glass
This allows this feature to build within sandbox. This is for testing
purposes only since it is not possible for sandbox to load native code.

Signed-off-by: Simon Glass 
---

 lib/efi_loader/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index d2b6327119..dee0a96a98 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -1,6 +1,6 @@
 config EFI_LOADER
bool "Support running EFI Applications in U-Boot"
-   depends on (ARM || X86) && OF_LIBFDT
+   depends on (ARM || X86 || SANDBOX) && OF_LIBFDT
default y
help
  Select this option if you want to run EFI applications (like grub2)
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 16/16] efi: sandbox: Add a simple 'bootefi test' command

2017-09-17 Thread Simon Glass
This jumps to test code which can call directly into the EFI support. It
does not need a separate image so it is easy to write tests with it.

For now the test just outputs a message. To try it:

./sandbox/u-boot -c "bootefi test"
U-Boot 2017.09-00204-g696c9855fe (Sep 17 2017 - 16:43:53 -0600)

DRAM:  128 MiB
MMC:
Using default environment

In:serial
Out:   serial
Err:   serial
SCSI:  Net:   No ethernet found.
IDE:   Bus 0: not available
Found 0 disks
Hello, world!
Test passed

Signed-off-by: Simon Glass 
---

 cmd/bootefi.c | 18 ++
 configs/sandbox_defconfig |  1 +
 include/efi_loader.h  |  3 +++
 lib/efi_loader/Kconfig| 10 ++
 lib/efi_loader/Makefile   |  1 +
 lib/efi_loader/efi_test.c | 17 +
 6 files changed, 50 insertions(+)
 create mode 100644 lib/efi_loader/efi_test.c

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index ee07733e3e..f499103d23 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -323,6 +323,24 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
memcpy((char *)addr, __efi_hello_world_begin, size);
} else
 #endif
+   if (IS_ENABLED(CONFIG_BOOTEFI_TEST) && !strcmp(argv[1], "test")) {
+   int ret;
+
+   /* Initialize and populate EFI object list */
+   if (efi_init_obj_list())
+   return CMD_RET_FAILURE;
+
+   loaded_image_info.device_handle = bootefi_device_path;
+   loaded_image_info.file_path = bootefi_image_path;
+   ret = efi_test(_image_info, );
+   if (ret) {
+   printf("Test failed: err=%d\n", ret);
+   return CMD_RET_FAILURE;
+   }
+   printf("Test passed\n");
+
+   return 0;
+   }
 #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
if (!strcmp(argv[1], "selftest")) {
/*
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 72600afea8..ab63f639de 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -196,3 +196,4 @@ CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
 CONFIG_UT_ENV=y
 CONFIG_UT_OVERLAY=y
+CONFIG_CMD_BOOTEFI_SELFTEST=y
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 79d2dad22c..43919137b0 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -263,6 +263,9 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
 struct efi_system_table *systab);
 #endif
 
+/* Perform EFI tests */
+int efi_test(efi_handle_t image_handle, struct efi_system_table *systab);
+
 #else /* defined(EFI_LOADER) && !defined(CONFIG_SPL_BUILD) */
 
 /* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index dee0a96a98..659b2b18f4 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -16,3 +16,13 @@ config EFI_LOADER_BOUNCE_BUFFER
  Some hardware does not support DMA to full 64bit addresses. For this
  hardware we can create a bounce buffer so that payloads don't have to
  worry about platform details.
+
+config BOOTEFI_TEST
+   bool "Provide a test for the EFI loader"
+   depends on EFI_LOADER && SANDBOX
+   default y
+   help
+ Provides a test of the EFI loader functionality accessed via the
+ command line ('bootefi test'). This runs within U-Boot so does not
+ need a separate EFI application to work. It aims to include coverage
+ of all EFI code which can be accessed within sandbox.
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 30bf343a36..69eb93518d 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -21,3 +21,4 @@ obj-$(CONFIG_DM_VIDEO) += efi_gop.o
 obj-$(CONFIG_PARTITIONS) += efi_disk.o
 obj-$(CONFIG_NET) += efi_net.o
 obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o
+obj-$(CONFIG_BOOTEFI_TEST) += efi_test.o
diff --git a/lib/efi_loader/efi_test.c b/lib/efi_loader/efi_test.c
new file mode 100644
index 00..3fdce78b05
--- /dev/null
+++ b/lib/efi_loader/efi_test.c
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2017, Google Inc. All rights reserved.
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+
+int efi_test(efi_handle_t image_handle, struct efi_system_table *systable)
+{
+   struct efi_simple_text_output_protocol *con_out = systable->con_out;
+
+   con_out->output_string(con_out, L"Hello, world!\n");
+
+   return 0;
+}
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 13/16] efi: sandbox: Add relocation constants

2017-09-17 Thread Simon Glass
Add these so that we can build the EFI loader for sandbox. The values are
for x86_64 so potentially bogus. But we don't support relocation within
sandbox anyway.

Signed-off-by: Simon Glass 
---

 lib/efi_loader/efi_runtime.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index ad7f3754bd..8ad1d2fc99 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -48,6 +48,9 @@ static efi_status_t __efi_runtime EFIAPI 
efi_invalid_parameter(void);
 #include 
 #define R_RELATIVE R_386_RELATIVE
 #define R_MASK 0xffULL
+#elif defined(CONFIG_SANDBOX)
+#define R_RELATIVE 8
+#define R_MASK 0xULL
 #else
 #error Need to add relocation awareness
 #endif
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 11/16] Define board_quiesce_devices() in a shared location

2017-09-17 Thread Simon Glass
This undocumented function relies on arch-specific code to declare a nop
weak version. Add the weak function in common code instead to avoid having
to duplicate the same function in each arch.

Signed-off-by: Simon Glass 
---

 arch/arm/include/asm/u-boot-arm.h | 1 -
 arch/x86/include/asm/u-boot-x86.h | 1 -
 arch/x86/lib/bootm.c  | 4 
 common/bootm.c| 4 
 include/bootm.h   | 2 ++
 lib/efi_loader/efi_boottime.c | 4 
 6 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/u-boot-arm.h 
b/arch/arm/include/asm/u-boot-arm.h
index ef4fca68ee..73ccf41f8c 100644
--- a/arch/arm/include/asm/u-boot-arm.h
+++ b/arch/arm/include/asm/u-boot-arm.h
@@ -38,7 +38,6 @@ int   arch_early_init_r(void);
 
 /* board/.../... */
 intboard_init(void);
-void   board_quiesce_devices(void);
 
 /* cpu/.../interrupt.c */
 intarch_interrupt_init (void);
diff --git a/arch/x86/include/asm/u-boot-x86.h 
b/arch/x86/include/asm/u-boot-x86.h
index 187fe5fd8c..d2e1426042 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -85,7 +85,6 @@ static inline __attribute__((no_instrument_function)) 
uint64_t rdtsc(void)
 /* board/... */
 void timer_set_tsc_base(uint64_t new_base);
 uint64_t timer_get_tsc(void);
-void board_quiesce_devices(void);
 
 void quick_ram_check(void);
 
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index ecd4f4e6c6..d9063a76d7 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -33,10 +33,6 @@ int arch_fixup_fdt(void *blob)
return 0;
 }
 
-__weak void board_quiesce_devices(void)
-{
-}
-
 void bootm_announce_and_cleanup(void)
 {
printf("\nStarting kernel ...\n\n");
diff --git a/common/bootm.c b/common/bootm.c
index 32b3ea8e2d..f64742168c 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -47,6 +47,10 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int 
flag, int argc,
   char * const argv[], bootm_headers_t *images,
   ulong *os_data, ulong *os_len);
 
+__weak void board_quiesce_devices(void)
+{
+}
+
 #ifdef CONFIG_LMB
 static void boot_start_lmb(bootm_headers_t *images)
 {
diff --git a/include/bootm.h b/include/bootm.h
index 49813772ce..76b6ab42e6 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -73,4 +73,6 @@ int bootm_decomp_image(int comp, ulong load, ulong 
image_start, int type,
   void *load_buf, void *image_buf, ulong image_len,
   uint unc_len, ulong *load_end);
 
+void board_quiesce_devices(void);
+
 #endif
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index d832f48599..03b97d36ae 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -883,6 +883,10 @@ static void efi_exit_caches(void)
 #endif
 }
 
+__weak void board_quiesce_devices(void)
+{
+}
+
 static efi_status_t EFIAPI efi_exit_boot_services(void *image_handle,
  unsigned long map_key)
 {
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 14/16] efi: Add a comment about duplicated ELF constants

2017-09-17 Thread Simon Glass
These constants are defined in arch-specific code but redefined here. Add
a TODO to clean this up.

Signed-off-by: Simon Glass 
---

 lib/efi_loader/efi_runtime.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 8ad1d2fc99..f52d8d71db 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -37,6 +37,10 @@ static efi_status_t __efi_runtime EFIAPI 
efi_invalid_parameter(void);
 #define EFI_CACHELINE_SIZE 128
 #endif
 
+/*
+ * TODO(s...@chromium.org): These defines and structs should come from the elf.
+ * header for each arch (or a generic header) rather than being repeated here.
+ */
 #if defined(CONFIG_ARM64)
 #define R_RELATIVE 1027
 #define R_MASK 0xULL
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 12/16] Add a comment for board_quiesce_devices()

2017-09-17 Thread Simon Glass
This exported function should have a comment describing what it does. Also
it should really be removed in favour of device_remove(), which handles
this sort of thing now. Add a comment with a TODO.

Signed-off-by: Simon Glass 
---

 include/bootm.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/bootm.h b/include/bootm.h
index 76b6ab42e6..caf331f54b 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -73,6 +73,12 @@ int bootm_decomp_image(int comp, ulong load, ulong 
image_start, int type,
   void *load_buf, void *image_buf, ulong image_len,
   uint unc_len, ulong *load_end);
 
+/*
+ * boards should define this to disable devices when EFI exits from boot
+ * services.
+ *
+ * TODO(s...@chromium.org>): Update this to use driver model's device_remove().
+ */
 void board_quiesce_devices(void);
 
 #endif
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 08/16] sandbox: Add a setjmp() implementation

2017-09-17 Thread Simon Glass
Add an implementation of setjmp() and longjmp() which rely on the
underlying host C library. Since we cannot know how large the jump buffer
needs to be, pick something that should be suitable and check it at
runtime. At present we need access to the underlying struct as well.

Signed-off-by: Simon Glass 
---

 arch/sandbox/cpu/cpu.c| 13 +
 arch/sandbox/cpu/os.c | 17 +
 arch/sandbox/include/asm/setjmp.h | 21 +
 include/os.h  | 21 +
 4 files changed, 72 insertions(+)
 create mode 100644 arch/sandbox/include/asm/setjmp.h

diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 01991049cc..de5862a53b 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -154,3 +155,15 @@ ulong timer_get_boot_us(void)
 
return (count - base_count) / 1000;
 }
+
+int setjmp(jmp_buf jmp)
+{
+   return os_setjmp((ulong *)jmp, sizeof(jmp));
+}
+
+void longjmp(jmp_buf jmp, int ret)
+{
+   os_longjmp((ulong *)jmp, ret);
+   while (1)
+   ;
+}
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 22d6aab534..909034fa4b 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -7,6 +7,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -609,3 +610,19 @@ void os_localtime(struct rtc_time *rt)
rt->tm_yday = tm->tm_yday;
rt->tm_isdst = tm->tm_isdst;
 }
+
+int os_setjmp(ulong *jmp, int size)
+{
+   if (size < sizeof(jmp_buf)) {
+   printf("setjmp: jmpbuf is too small (%d bytes, need %d)\n",
+  size, sizeof(jmp_buf));
+   return -ENOSPC;
+   }
+
+   return setjmp((struct __jmp_buf_tag *)jmp);
+}
+
+void os_longjmp(ulong *jmp, int ret)
+{
+   longjmp((struct __jmp_buf_tag *)jmp, ret);
+}
diff --git a/arch/sandbox/include/asm/setjmp.h 
b/arch/sandbox/include/asm/setjmp.h
new file mode 100644
index 00..e25f50107c
--- /dev/null
+++ b/arch/sandbox/include/asm/setjmp.h
@@ -0,0 +1,21 @@
+/*
+ * (C) Copyright 2016
+ * Alexander Graf 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _SETJMP_H_
+#define _SETJMP_H_ 1
+
+struct jmp_buf_data {
+   /* We're not sure how long this should be */
+   ulong data[32];
+};
+
+typedef struct jmp_buf_data jmp_buf[1];
+
+int setjmp(jmp_buf jmp);
+__noreturn void longjmp(jmp_buf jmp, int ret);
+
+#endif /* _SETJMP_H_ */
diff --git a/include/os.h b/include/os.h
index 2bf4bdb1b8..ad1836ac9f 100644
--- a/include/os.h
+++ b/include/os.h
@@ -310,4 +310,25 @@ int os_spl_to_uboot(const char *fname);
  */
 void os_localtime(struct rtc_time *rt);
 
+/**
+ * os_setjmp() - Call setjmp()
+ *
+ * Call the host system's setjmp() function.
+ *
+ * @jmp: Buffer to store current execution state
+ * @size: Size of buffer
+ * @return normal setjmp() value if OK, -ENOSPC if @size is too small
+ */
+int os_setjmp(ulong *jmp, int size);
+
+/**
+ * os_longjmp() - Call longjmp()
+ *
+ * Call the host system's longjmp() function.
+ *
+ * @jmp: Buffer where previous execution state was stored
+ * @ret: Value to pass to longjmp()
+ */
+void os_longjmp(ulong *jmp, int ret);
+
 #endif
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 10/16] efi: sandbox: Add distroboot support

2017-09-17 Thread Simon Glass
With sandbox these values depend on the host system. Let's assume that it
is x86_64 for now.

Signed-off-by: Simon Glass 
---

 include/config_distro_bootcmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 9ed6b9892c..11cc771c5d 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -233,7 +233,7 @@
 #elif defined(CONFIG_ARM)
 #define BOOTENV_EFI_PXE_ARCH "0xa"
 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00010:UNDI:003000"
-#elif defined(CONFIG_X86)
+#elif defined(CONFIG_X86) || defined(CONFIG_SANDBOX)
 /* Always assume we're running 64bit */
 #define BOOTENV_EFI_PXE_ARCH "0x7"
 #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:7:UNDI:003000"
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 09/16] efi: sandbox: Add required linker sections

2017-09-17 Thread Simon Glass
The EFI loader code requires certain linker sections to exist. Add these
for sandbox so that the EFI loader code will link.

Signed-off-by: Simon Glass 
---

 arch/sandbox/cpu/u-boot.lds | 29 +
 arch/sandbox/lib/Makefile   |  2 +-
 arch/sandbox/lib/sections.c | 12 
 3 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 arch/sandbox/lib/sections.c

diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds
index 7e92b4ac66..38a74bcaf4 100644
--- a/arch/sandbox/cpu/u-boot.lds
+++ b/arch/sandbox/cpu/u-boot.lds
@@ -19,6 +19,35 @@ SECTIONS
__u_boot_sandbox_option_end = .;
 
__bss_start = .;
+
+   .__efi_runtime_start : {
+   *(.__efi_runtime_start)
+   }
+
+   .efi_runtime : {
+   *(efi_runtime_text)
+   *(efi_runtime_data)
+   }
+
+   .__efi_runtime_stop : {
+   *(.__efi_runtime_stop)
+   }
+
+   .efi_runtime_rel_start :
+   {
+   *(.__efi_runtime_rel_start)
+   }
+
+   .efi_runtime_rel : {
+   *(.relefi_runtime_text)
+   *(.relefi_runtime_data)
+   }
+
+   .efi_runtime_rel_stop :
+   {
+   *(.__efi_runtime_rel_stop)
+   }
+
 }
 
 INSERT BEFORE .data;
diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile
index 2e7802feac..d2171579b7 100644
--- a/arch/sandbox/lib/Makefile
+++ b/arch/sandbox/lib/Makefile
@@ -7,7 +7,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-y  += interrupts.o
+obj-y  += interrupts.o sections.o
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_PCI)  += pci_io.o
 endif
diff --git a/arch/sandbox/lib/sections.c b/arch/sandbox/lib/sections.c
new file mode 100644
index 00..6455e0f088
--- /dev/null
+++ b/arch/sandbox/lib/sections.c
@@ -0,0 +1,12 @@
+/*
+ * Copyright 2013 Albert ARIBAUD 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+char __efi_runtime_start[0] __attribute__((section(".__efi_runtime_start")));
+char __efi_runtime_stop[0] __attribute__((section(".__efi_runtime_stop")));
+char __efi_runtime_rel_start[0]
+   __attribute__((section(".__efi_runtime_rel_start")));
+char __efi_runtime_rel_stop[0]
+   __attribute__((section(".__efi_runtime_rel_stop")));
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 07/16] sandbox: smbios: Update to support sandbox

2017-09-17 Thread Simon Glass
At present this code casts addresses to pointers so cannot be used with
sandbox. Update it to use mapmem instead.

Signed-off-by: Simon Glass 
---

 lib/smbios.c | 38 +-
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/lib/smbios.c b/lib/smbios.c
index 8f19ad89c1..56481d448d 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -7,6 +7,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -75,9 +76,10 @@ static int smbios_string_table_len(char *start)
 
 static int smbios_write_type0(ulong *current, int handle)
 {
-   struct smbios_type0 *t = (struct smbios_type0 *)*current;
+   struct smbios_type0 *t;
int len = sizeof(struct smbios_type0);
 
+   t = map_sysmem(*current, len);
memset(t, 0, sizeof(struct smbios_type0));
fill_smbios_header(t, SMBIOS_BIOS_INFORMATION, len, handle);
t->vendor = smbios_add_string(t->eos, "U-Boot");
@@ -104,16 +106,18 @@ static int smbios_write_type0(ulong *current, int handle)
 
len = t->length + smbios_string_table_len(t->eos);
*current += len;
+   unmap_sysmem(t);
 
return len;
 }
 
 static int smbios_write_type1(ulong *current, int handle)
 {
-   struct smbios_type1 *t = (struct smbios_type1 *)*current;
+   struct smbios_type1 *t;
int len = sizeof(struct smbios_type1);
char *serial_str = env_get("serial#");
 
+   t = map_sysmem(*current, len);
memset(t, 0, sizeof(struct smbios_type1));
fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER);
@@ -125,15 +129,17 @@ static int smbios_write_type1(ulong *current, int handle)
 
len = t->length + smbios_string_table_len(t->eos);
*current += len;
+   unmap_sysmem(t);
 
return len;
 }
 
 static int smbios_write_type2(ulong *current, int handle)
 {
-   struct smbios_type2 *t = (struct smbios_type2 *)*current;
+   struct smbios_type2 *t;
int len = sizeof(struct smbios_type2);
 
+   t = map_sysmem(*current, len);
memset(t, 0, sizeof(struct smbios_type2));
fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER);
@@ -143,15 +149,17 @@ static int smbios_write_type2(ulong *current, int handle)
 
len = t->length + smbios_string_table_len(t->eos);
*current += len;
+   unmap_sysmem(t);
 
return len;
 }
 
 static int smbios_write_type3(ulong *current, int handle)
 {
-   struct smbios_type3 *t = (struct smbios_type3 *)*current;
+   struct smbios_type3 *t;
int len = sizeof(struct smbios_type3);
 
+   t = map_sysmem(*current, len);
memset(t, 0, sizeof(struct smbios_type3));
fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle);
t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER);
@@ -163,6 +171,7 @@ static int smbios_write_type3(ulong *current, int handle)
 
len = t->length + smbios_string_table_len(t->eos);
*current += len;
+   unmap_sysmem(t);
 
return len;
 }
@@ -201,9 +210,10 @@ static void smbios_write_type4_dm(struct smbios_type4 *t)
 
 static int smbios_write_type4(ulong *current, int handle)
 {
-   struct smbios_type4 *t = (struct smbios_type4 *)*current;
+   struct smbios_type4 *t;
int len = sizeof(struct smbios_type4);
 
+   t = map_sysmem(*current, len);
memset(t, 0, sizeof(struct smbios_type4));
fill_smbios_header(t, SMBIOS_PROCESSOR_INFORMATION, len, handle);
t->processor_type = SMBIOS_PROCESSOR_TYPE_CENTRAL;
@@ -217,32 +227,37 @@ static int smbios_write_type4(ulong *current, int handle)
 
len = t->length + smbios_string_table_len(t->eos);
*current += len;
+   unmap_sysmem(t);
 
return len;
 }
 
 static int smbios_write_type32(ulong *current, int handle)
 {
-   struct smbios_type32 *t = (struct smbios_type32 *)*current;
+   struct smbios_type32 *t;
int len = sizeof(struct smbios_type32);
 
+   t = map_sysmem(*current, len);
memset(t, 0, sizeof(struct smbios_type32));
fill_smbios_header(t, SMBIOS_SYSTEM_BOOT_INFORMATION, len, handle);
 
*current += len;
+   unmap_sysmem(t);
 
return len;
 }
 
 static int smbios_write_type127(ulong *current, int handle)
 {
-   struct smbios_type127 *t = (struct smbios_type127 *)*current;
+   struct smbios_type127 *t;
int len = sizeof(struct smbios_type127);
 
+   t = map_sysmem(*current, len);
memset(t, 0, sizeof(struct smbios_type127));
fill_smbios_header(t, SMBIOS_END_OF_TABLE, len, handle);
 
*current += len;
+   unmap_sysmem(t);
 
return len;
 }
@@ -271,7 +286,7 @@ ulong write_smbios_table(ulong addr)
/* 16 byte align the table address */
addr = 

[U-Boot] [PATCH 06/16] efi: sandbox: Adjust memory setup for sandbox

2017-09-17 Thread Simon Glass
With sandbox the U-Boot code is not mapped into the sandbox memory range
so does not need to be excluded when allocating EFI memory. Update the EFI
memory init code to take account of that.

Signed-off-by: Simon Glass 
---

 lib/efi_loader/efi_memory.c | 28 
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index ad3d277be6..c1a080e2e9 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -459,18 +459,22 @@ int efi_memory_init(void)
 
efi_add_known_memory();
 
-   /* Add U-Boot */
-   uboot_start = (gd->start_addr_sp - uboot_stack_size) & ~EFI_PAGE_MASK;
-   uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT;
-   efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, false);
-
-   /* Add Runtime Services */
-   runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK;
-   runtime_end = (ulong)&__efi_runtime_stop;
-   runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;
-   runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT;
-   efi_add_memory_map(runtime_start, runtime_pages,
-  EFI_RUNTIME_SERVICES_CODE, false);
+   if (!IS_ENABLED(CONFIG_SANDBOX)) {
+   /* Add U-Boot */
+   uboot_start = (gd->start_addr_sp - uboot_stack_size) &
+   ~EFI_PAGE_MASK;
+   uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT;
+   efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA,
+  false);
+
+   /* Add Runtime Services */
+   runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK;
+   runtime_end = (ulong)&__efi_runtime_stop;
+   runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK;
+   runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT;
+   efi_add_memory_map(runtime_start, runtime_pages,
+  EFI_RUNTIME_SERVICES_CODE, false);
+   }
 
 #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
/* Request a 32bit 64MB bounce buffer region */
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 05/16] efi: Correct header order in efi_memory

2017-09-17 Thread Simon Glass
The headers are not in the correct order. Fix this.

Signed-off-by: Simon Glass 
---

 lib/efi_loader/efi_memory.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 9e079f1fa3..ad3d277be6 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -8,12 +8,11 @@
 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
-#include 
 #include 
-#include 
-#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 04/16] efi: Add a TODO to efi_init_obj_list()

2017-09-17 Thread Simon Glass
This function repeats data structures provided by driver model. They are
only created once so can be stale if the EFI loader is called twice (e.g.
for testing or on boot failure).

Add a TODO to address this. It should be possible to attach EFI devices
and data structures to driver-model devices and avoid having a parallel
set of data structures.

Signed-off-by: Simon Glass 
---

 cmd/bootefi.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 9aa588eb1b..ee07733e3e 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -109,6 +109,10 @@ static struct efi_object bootefi_device_obj = {
 /**
  * efi_init_obj_list() - Initialize and populate EFI object list
  *
+ * TODO(s...@chromium.org): Move this to a dynamic list based on driver model,
+ * so that it does not need to be created before running EFI applications
+ * and updates when devices change.
+ *
  * @return 0 if OK, -ve on error (in which case it prints a message)
  */
 static int efi_init_obj_list(void)
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 02/16] efi: Move the init check inside efi_init_obj_list()

2017-09-17 Thread Simon Glass
Rather than having the caller check this variable and the callee set it,
move all access to the variable inside the function. This reduces the
logic needed to call efi_init_obj_list().

Signed-off-by: Simon Glass 
---

 cmd/bootefi.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index abfab8fa98..2c9d31c5eb 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -109,6 +109,8 @@ static struct efi_object bootefi_device_obj = {
 /* Initialize and populate EFI object list */
 static void efi_init_obj_list(void)
 {
+   if (efi_obj_list_initalized)
+   return;
efi_obj_list_initalized = 1;
 
list_add_tail(_image_info_obj.link, _obj_list);
@@ -256,8 +258,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
return -ENOENT;
 
/* Initialize and populate EFI object list */
-   if (!efi_obj_list_initalized)
-   efi_init_obj_list();
+   efi_init_obj_list();
 
/* Call our payload! */
debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
@@ -311,8 +312,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 */
efi_save_gd();
/* Initialize and populate EFI object list */
-   if (!efi_obj_list_initalized)
-   efi_init_obj_list();
+   efi_init_obj_list();
loaded_image_info.device_handle = bootefi_device_path;
loaded_image_info.file_path = bootefi_image_path;
return efi_selftest(_image_info, );
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 03/16] efi: Add error checking for efi_init_obj_list()

2017-09-17 Thread Simon Glass
This function calls a function which can fail. Print a message in this
case and abort the boot, rather than silently continuing to boot, which
will certainly fail.

Signed-off-by: Simon Glass 
---

 cmd/bootefi.c | 30 --
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 2c9d31c5eb..9aa588eb1b 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -106,11 +106,17 @@ static struct efi_object bootefi_device_obj = {
},
 };
 
-/* Initialize and populate EFI object list */
-static void efi_init_obj_list(void)
+/**
+ * efi_init_obj_list() - Initialize and populate EFI object list
+ *
+ * @return 0 if OK, -ve on error (in which case it prints a message)
+ */
+static int efi_init_obj_list(void)
 {
+   int ret;
+
if (efi_obj_list_initalized)
-   return;
+   return 0;
efi_obj_list_initalized = 1;
 
list_add_tail(_image_info_obj.link, _obj_list);
@@ -132,12 +138,19 @@ static void efi_init_obj_list(void)
loaded_image_info.device_handle = bootefi_device_path;
 #endif
 #ifdef CONFIG_GENERATE_SMBIOS_TABLE
-   efi_smbios_register();
+   ret = efi_smbios_register();
+   if (ret)
+   goto error;
 #endif
 
/* Initialize EFI runtime services */
efi_reset_system_init();
efi_get_time_init();
+
+   return 0;
+error:
+   printf("Error: Cannot set up EFI object list (err=%d)\n", ret);
+   return ret;
 }
 
 static void *copy_fdt(void *fdt)
@@ -219,6 +232,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
ulong fdt_pages, fdt_size, fdt_start, fdt_end;
const efi_guid_t fdt_guid = EFI_FDT_GUID;
bootm_headers_t img = { 0 };
+   int ret;
 
/*
 * gd lives in a fixed register which may get clobbered while we execute
@@ -258,7 +272,9 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
return -ENOENT;
 
/* Initialize and populate EFI object list */
-   efi_init_obj_list();
+   ret = efi_init_obj_list();
+   if (ret)
+   return ret;
 
/* Call our payload! */
debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
@@ -312,7 +328,9 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 */
efi_save_gd();
/* Initialize and populate EFI object list */
-   efi_init_obj_list();
+   if (efi_init_obj_list())
+   return CMD_RET_FAILURE;
+
loaded_image_info.device_handle = bootefi_device_path;
loaded_image_info.file_path = bootefi_image_path;
return efi_selftest(_image_info, );
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 01/16] efi: Update efi_smbios_register() to return error code

2017-09-17 Thread Simon Glass
This function can fail but gives no indication of failure. Update it to
return an error when something goes wrong.

Signed-off-by: Simon Glass 
---

 include/efi_loader.h| 10 --
 lib/efi_loader/efi_smbios.c |  6 --
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 2051fc994e..79d2dad22c 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -150,8 +150,14 @@ int efi_disk_register(void);
 int efi_gop_register(void);
 /* Called by bootefi to make the network interface available */
 int efi_net_register(void **handle);
-/* Called by bootefi to make SMBIOS tables available */
-void efi_smbios_register(void);
+/**
+ * efi_smbios_register() - write out SMBIOS tables
+ *
+ * Called by bootefi to make SMBIOS tables available
+ *
+ * @return 0 if OK, -ENOMEM if no memory is available for the tables
+ */
+int efi_smbios_register(void);
 
 /* Called by networking code to memorize the dhcp ack package */
 void efi_net_set_dhcp_ack(void *pkt, int len);
diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c
index ac412e7362..3b87294dc3 100644
--- a/lib/efi_loader/efi_smbios.c
+++ b/lib/efi_loader/efi_smbios.c
@@ -13,7 +13,7 @@
 
 static const efi_guid_t smbios_guid = SMBIOS_TABLE_GUID;
 
-void efi_smbios_register(void)
+int efi_smbios_register(void)
 {
/* Map within the low 32 bits, to allow for 32bit SMBIOS tables */
uint64_t dmi = 0x;
@@ -22,11 +22,13 @@ void efi_smbios_register(void)
int memtype = EFI_RUNTIME_SERVICES_DATA;
 
if (efi_allocate_pages(1, memtype, pages, ) != EFI_SUCCESS)
-   return;
+   return -ENOMEM;
 
/* Generate SMBIOS tables */
write_smbios_table(dmi);
 
/* And expose them to our EFI payload */
efi_install_configuration_table(_guid, (void*)(uintptr_t)dmi);
+
+   return 0;
 }
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 00/16] efi: Enable basic sandbox support for EFI loader

2017-09-17 Thread Simon Glass
A limitation of the EFI loader at present is that it does not build with
sandbox. This makes it hard to write tests, since sandbox is used for most
testing in U-Boot.

This series enables the EFI loader feature. It allows sandbox to build and
run a trivial function which calls the EFI API to output a message.

Much work remains but this should serve as a basis for adding tests more
easily for EFI loader.

This series sits on top of Heinrich's recent EFI test series. It is
available at u-boot-dm/efi-working


Simon Glass (16):
  efi: Update efi_smbios_register() to return error code
  efi: Move the init check inside efi_init_obj_list()
  efi: Add error checking for efi_init_obj_list()
  efi: Add a TODO to efi_init_obj_list()
  efi: Correct header order in efi_memory
  efi: sandbox: Adjust memory setup for sandbox
  sandbox: smbios: Update to support sandbox
  sandbox: Add a setjmp() implementation
  efi: sandbox: Add required linker sections
  efi: sandbox: Add distroboot support
  Define board_quiesce_devices() in a shared location
  Add a comment for board_quiesce_devices()
  efi: sandbox: Add relocation constants
  efi: Add a comment about duplicated ELF constants
  efi: sandbox: Enable EFI loader builder for sandbox
  efi: sandbox: Add a simple 'bootefi test' command

 arch/arm/include/asm/u-boot-arm.h |  1 -
 arch/sandbox/cpu/cpu.c| 13 ++
 arch/sandbox/cpu/os.c | 17 
 arch/sandbox/cpu/u-boot.lds   | 29 +
 arch/sandbox/include/asm/setjmp.h | 21 +++
 arch/sandbox/lib/Makefile |  2 +-
 arch/sandbox/lib/sections.c   | 12 +
 arch/x86/include/asm/u-boot-x86.h |  1 -
 arch/x86/lib/bootm.c  |  4 ---
 cmd/bootefi.c | 54 ++-
 common/bootm.c|  4 +++
 configs/sandbox_defconfig |  1 +
 include/bootm.h   |  8 ++
 include/config_distro_bootcmd.h   |  2 +-
 include/efi_loader.h  | 13 --
 include/os.h  | 21 +++
 lib/efi_loader/Kconfig| 12 -
 lib/efi_loader/Makefile   |  1 +
 lib/efi_loader/efi_boottime.c |  4 +++
 lib/efi_loader/efi_memory.c   | 33 +---
 lib/efi_loader/efi_runtime.c  |  7 +
 lib/efi_loader/efi_smbios.c   |  6 +++--
 lib/efi_loader/efi_test.c | 17 
 lib/smbios.c  | 38 ---
 24 files changed, 277 insertions(+), 44 deletions(-)
 create mode 100644 arch/sandbox/include/asm/setjmp.h
 create mode 100644 arch/sandbox/lib/sections.c
 create mode 100644 lib/efi_loader/efi_test.c

-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 4/4] dm: gpio: pca953x: Drop pointless data structure checks

2017-09-17 Thread Simon Glass
These checks cannot fail since driver model will not call a driver's
method if it cannot fully create the driver data structures.

It is confusing to have these checks and others might copy them. Drop this
code.

Signed-off-by: Simon Glass 
---

 drivers/gpio/pca953x_gpio.c | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c
index 4962f25230..791d1d1516 100644
--- a/drivers/gpio/pca953x_gpio.c
+++ b/drivers/gpio/pca953x_gpio.c
@@ -249,22 +249,11 @@ static int pca953x_probe(struct udevice *dev)
 {
struct pca953x_info *info = dev_get_platdata(dev);
struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
-   struct dm_i2c_chip *chip = dev_get_parent_platdata(dev);
char name[32], *str;
int addr;
ulong driver_data;
int ret;
 
-   if (!info) {
-   dev_err(dev, "platdata not ready\n");
-   return -ENOMEM;
-   }
-
-   if (!chip) {
-   dev_err(dev, "i2c not ready\n");
-   return -ENODEV;
-   }
-
addr = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "reg", 0);
if (addr == 0)
return -ENODEV;
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 3/4] dm: gpio: Correct use of -ENODEV in drivers

2017-09-17 Thread Simon Glass
In U-Boot -ENODEV means that there is no device. When there is a problem
with the device, drivers should return an error like -ENXIO or -EREMOTEIO.
When the device tree properties cannot be read correct , they should
return -EINVAL.

Update various GPIO drivers to follow this rule, to help with consistency
for future driver writers.

Signed-off-by: Simon Glass 
Reported-by: Adam Ford 
---

 drivers/gpio/adi_gpio2.c|  2 +-
 drivers/gpio/atmel_pio4.c   | 12 ++--
 drivers/gpio/imx_rgpio2p.c  |  2 +-
 drivers/gpio/mxc_gpio.c |  2 +-
 drivers/gpio/omap_gpio.c|  2 +-
 drivers/gpio/tegra186_gpio.c|  2 +-
 drivers/i2c/imx_lpi2c.c |  2 +-
 drivers/i2c/mxc_i2c.c   | 12 ++--
 drivers/i2c/tegra186_bpmp_i2c.c |  2 +-
 9 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/gpio/adi_gpio2.c b/drivers/gpio/adi_gpio2.c
index 4db08a344a..1012f2d8eb 100644
--- a/drivers/gpio/adi_gpio2.c
+++ b/drivers/gpio/adi_gpio2.c
@@ -138,7 +138,7 @@ int peripheral_request(unsigned short per, const char 
*label)
return 0;
 
if (!(per & P_DEFINED))
-   return -ENODEV;
+   return -EINVAL;
 
BUG_ON(ident >= MAX_RESOURCES);
 
diff --git a/drivers/gpio/atmel_pio4.c b/drivers/gpio/atmel_pio4.c
index f3689467f0..30bc4296e3 100644
--- a/drivers/gpio/atmel_pio4.c
+++ b/drivers/gpio/atmel_pio4.c
@@ -50,11 +50,11 @@ static int atmel_pio4_config_io_func(u32 port, u32 pin,
u32 reg, mask;
 
if (pin >= ATMEL_PIO_NPINS_PER_BANK)
-   return -ENODEV;
+   return -EINVAL;
 
port_base = atmel_pio4_port_base(port);
if (!port_base)
-   return -ENODEV;
+   return -EINVAL;
 
mask = 1 << pin;
reg = func;
@@ -128,11 +128,11 @@ int atmel_pio4_set_pio_output(u32 port, u32 pin, u32 
value)
u32 reg, mask;
 
if (pin >= ATMEL_PIO_NPINS_PER_BANK)
-   return -ENODEV;
+   return -EINVAL;
 
port_base = atmel_pio4_port_base(port);
if (!port_base)
-   return -ENODEV;
+   return -EINVAL;
 
mask = 0x01 << pin;
reg = ATMEL_PIO_CFGR_FUNC_GPIO | ATMEL_PIO_DIR_MASK;
@@ -154,11 +154,11 @@ int atmel_pio4_get_pio_input(u32 port, u32 pin)
u32 reg, mask;
 
if (pin >= ATMEL_PIO_NPINS_PER_BANK)
-   return -ENODEV;
+   return -EINVAL;
 
port_base = atmel_pio4_port_base(port);
if (!port_base)
-   return -ENODEV;
+   return -EINVAL;
 
mask = 0x01 << pin;
reg = ATMEL_PIO_CFGR_FUNC_GPIO;
diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c
index e60e9d2a01..7825714e80 100644
--- a/drivers/gpio/imx_rgpio2p.c
+++ b/drivers/gpio/imx_rgpio2p.c
@@ -168,7 +168,7 @@ static int imx_rgpio2p_bind(struct udevice *dev)
 
addr = devfdt_get_addr_index(dev, 1);
if (addr == FDT_ADDR_T_NONE)
-   return -ENODEV;
+   return -EINVAL;
 
/*
 * TODO:
diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index 0c42bd6cec..c480eba940 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -304,7 +304,7 @@ static int mxc_gpio_bind(struct udevice *dev)
 
addr = devfdt_get_addr(dev);
if (addr == FDT_ADDR_T_NONE)
-   return -ENODEV;
+   return -EINVAL;
 
/*
 * TODO:
diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index 5c55e6929e..91a3b4672a 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -304,7 +304,7 @@ static int omap_gpio_bind(struct udevice *dev)
 
base_addr = devfdt_get_addr(dev);
if (base_addr == FDT_ADDR_T_NONE)
-   return -ENODEV;
+   return -EINVAL;
 
/*
* TODO:
diff --git a/drivers/gpio/tegra186_gpio.c b/drivers/gpio/tegra186_gpio.c
index c5a7e13cce..deb59e8b32 100644
--- a/drivers/gpio/tegra186_gpio.c
+++ b/drivers/gpio/tegra186_gpio.c
@@ -181,7 +181,7 @@ static int tegra186_gpio_bind(struct udevice *parent)
 
regs = (uint32_t *)devfdt_get_addr_name(parent, "gpio");
if (regs == (uint32_t *)FDT_ADDR_T_NONE)
-   return -ENODEV;
+   return -EINVAL;
 
for (port = 0; port < ctlr_data->port_count; port++) {
struct tegra186_gpio_platdata *plat;
diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c
index aa97196e23..e7ec17fe9e 100644
--- a/drivers/i2c/imx_lpi2c.c
+++ b/drivers/i2c/imx_lpi2c.c
@@ -412,7 +412,7 @@ static int imx_lpi2c_probe(struct udevice *bus)
 
addr = devfdt_get_addr(bus);
if (addr == FDT_ADDR_T_NONE)
-   return -ENODEV;
+   return -EINVAL;
 
i2c_bus->base = addr;
i2c_bus->index = bus->seq;
diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index 

[U-Boot] [PATCH 1/4] dm: gpio: vybrid_gpio: Correct driver's use of bind() method

2017-09-17 Thread Simon Glass
It does not look like this driver needs to use a bind() method. It does
not manually create devices with device_bind() nor does it create devices
using U_BOOT_DEVICE(). It seems to only use device tree.

Therefore the manual allocation of platform data is not needed and is
confusing. Also platform data should be set up by the ofdata_to_platdata()
method, not bind().

Update the driver in case others use it as a model in future.

Signed-off-by: Simon Glass 
Reported-by: Adam Ford 
---

 drivers/gpio/vybrid_gpio.c | 25 ++---
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/drivers/gpio/vybrid_gpio.c b/drivers/gpio/vybrid_gpio.c
index 89918e48dd..030e8d08a4 100644
--- a/drivers/gpio/vybrid_gpio.c
+++ b/drivers/gpio/vybrid_gpio.c
@@ -105,32 +105,18 @@ static int vybrid_gpio_probe(struct udevice *dev)
return 0;
 }
 
-static int vybrid_gpio_bind(struct udevice *dev)
+static int vybrid_gpio_odata_to_platdata(struct udevice *dev)
 {
-   struct vybrid_gpio_platdata *plat = dev->platdata;
+   struct vybrid_gpio_platdata *plat = dev_get_platdata(dev);
fdt_addr_t base_addr;
 
-   if (plat)
-   return 0;
-
base_addr = devfdt_get_addr(dev);
if (base_addr == FDT_ADDR_T_NONE)
-   return -ENODEV;
-
-   /*
-   * TODO:
-   * When every board is converted to driver model and DT is
-   * supported, this can be done by auto-alloc feature, but
-   * not using calloc to alloc memory for platdata.
-   */
-   plat = calloc(1, sizeof(*plat));
-   if (!plat)
-   return -ENOMEM;
+   return -EINVAL;
 
plat->base = base_addr;
plat->chip = dev->req_seq;
plat->port_name = fdt_get_name(gd->fdt_blob, dev_of_offset(dev), NULL);
-   dev->platdata = plat;
 
return 0;
 }
@@ -144,8 +130,9 @@ U_BOOT_DRIVER(gpio_vybrid) = {
.name   = "gpio_vybrid",
.id = UCLASS_GPIO,
.ops= _vybrid_ops,
+   .of_match = vybrid_gpio_ids,
+   .ofdata_to_platdata = vybrid_gpio_odata_to_platdata,
.probe  = vybrid_gpio_probe,
.priv_auto_alloc_size = sizeof(struct vybrid_gpios),
-   .of_match = vybrid_gpio_ids,
-   .bind   = vybrid_gpio_bind,
+   .platdata_auto_alloc_size = sizeof(struct vybrid_gpio_platdata),
 };
-- 
2.14.1.690.gbb1197296e-goog

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


[U-Boot] [PATCH 2/4] dm: gpio: Add a comment about not copying some drivers

2017-09-17 Thread Simon Glass
These three drivers all use U_BOOT_DEVICE rather than device tree to
create devices, so have to do manual allocation of platform data. This is
not true for new platforms.

Add a more explicit comment so that people do not copy this approach with
new boards.

Signed-off-by: Simon Glass 
Reported-by: Adam Ford 
---

 drivers/gpio/imx_rgpio2p.c | 5 +
 drivers/gpio/mxc_gpio.c| 5 +
 drivers/gpio/omap_gpio.c   | 9 +
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/imx_rgpio2p.c b/drivers/gpio/imx_rgpio2p.c
index 5abc88ba54..e60e9d2a01 100644
--- a/drivers/gpio/imx_rgpio2p.c
+++ b/drivers/gpio/imx_rgpio2p.c
@@ -175,6 +175,11 @@ static int imx_rgpio2p_bind(struct udevice *dev)
 * When every board is converted to driver model and DT is supported,
 * this can be done by auto-alloc feature, but not using calloc
 * to alloc memory for platdata.
+*
+* For example imx_rgpio2p_plat uses platform data rather than device
+* tree.
+*
+* NOTE: DO NOT COPY this code if you are using device tree.
 */
plat = calloc(1, sizeof(*plat));
if (!plat)
diff --git a/drivers/gpio/mxc_gpio.c b/drivers/gpio/mxc_gpio.c
index 0eb6c600f1..0c42bd6cec 100644
--- a/drivers/gpio/mxc_gpio.c
+++ b/drivers/gpio/mxc_gpio.c
@@ -311,6 +311,11 @@ static int mxc_gpio_bind(struct udevice *dev)
 * When every board is converted to driver model and DT is supported,
 * this can be done by auto-alloc feature, but not using calloc
 * to alloc memory for platdata.
+*
+* For example mxc_plat below uses platform data rather than device
+* tree.
+*
+* NOTE: DO NOT COPY this code if you are using device tree.
 */
plat = calloc(1, sizeof(*plat));
if (!plat)
diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
index b423e34ca4..5c55e6929e 100644
--- a/drivers/gpio/omap_gpio.c
+++ b/drivers/gpio/omap_gpio.c
@@ -299,12 +299,9 @@ static int omap_gpio_probe(struct udevice *dev)
 
 static int omap_gpio_bind(struct udevice *dev)
 {
-   struct omap_gpio_platdata *plat = dev->platdata;
+   struct omap_gpio_platdata *plat = dev_get_platdata(dev);
fdt_addr_t base_addr;
 
-   if (plat)
-   return 0;
-
base_addr = devfdt_get_addr(dev);
if (base_addr == FDT_ADDR_T_NONE)
return -ENODEV;
@@ -314,6 +311,10 @@ static int omap_gpio_bind(struct udevice *dev)
* When every board is converted to driver model and DT is
* supported, this can be done by auto-alloc feature, but
* not using calloc to alloc memory for platdata.
+   *
+   * For example am33xx_gpio uses platform data rather than device tree.
+   *
+   * NOTE: DO NOT COPY this code if you are using device tree.
*/
plat = calloc(1, sizeof(*plat));
if (!plat)
-- 
2.14.1.690.gbb1197296e-goog

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


Re: [U-Boot] [PATCH 00/10] efi_loader: event services & API test

2017-09-17 Thread Simon Glass
Hi,

On 17 September 2017 at 13:36, Heinrich Schuchardt  wrote:
> On 09/17/2017 07:58 PM, Simon Glass wrote:
>> Hi Heinrich,
>>
>> On 15 September 2017 at 02:06, Heinrich Schuchardt  
>> wrote:
>>> This patch series provides:
>>> * corrections for the EFI event services
>>> * a test framework to check the EFI API implementation
>>> * unit tests covering the event services
>>>
>>> The EFI selftest is written such that it could be easily turned
>>> into a standalone EFI application. But this would require
>>> modifying the build procedures for EFI. Objcopy cannot generate
>>> the necessary relocations.
>>>
>>> The unit tests are identified by entries in a linker generated
>>> array to make them as self sufficient as possible.
>>>
>>> A Python test case is supplied to call run the EFI tests.
>>>
>>> Tested with Travis CI
>>> https://travis-ci.org/xypron2/u-boot/jobs/275733784
>>>
>>> Of all my efi_loader patches these are the first I would like
>>> to see merged.
>>>
>>> Simon has commented on some other patches that he misses
>>> comments for all EFI API functions. I will add these with
>>> a separate patch.
>>>
>>> Heinrich Schuchardt (10):
>>>   efi_loader: allow return value in EFI_CALL
>>>   efi_selftest: provide an EFI selftest application
>>>   test/py: add a test calling the EFI selftest
>>>   efi_loader: implement queueing of the notification function
>>>   efi_loader: efi_set_timer: reset signaled state
>>>   efi_selftest: provide unit test for event services
>>>   efi_loader: implement task priority level (TPL)
>>>   efi_selftest: test task priority levels
>>>   efi_loader: notify when ExitBootServices is invoked
>>>   efi_selftest: check notification of ExitBootServices
>>>
>>
>> This progress makes significant progress on EFI testing at last. I'm
>> very pleased to see it. Thank you for all the work you have put into
>> this.
>>
>> In addition to this (not instead of) I would like to see EFI code
>> running under sandbox. I don't at present see a good reason why this
>> cannot be done. I am going to try to enable EFI loader support in
>> sandbox to a basic level and then we can see how hard it is to get
>> some of your tests running directly in sandbox. If that works out then
>> we can add that into the mix.
>>
>> I think this would make for an easier development environment for new
>> EFI features. For some years I have developed all new features in
>> sandbox and find it painful and unproductive when I need to test every
>> change manually on a board. It should also allow us to run your tests
>> (perhaps with some adaptation) with 'make tests' on a local machine
>> using sandbox. Ultimately it should be possible to expand test
>> coverage to cover all significant EFI logic.
>>
>> [..]
>>
>> Regards,
>> Simon
>>
> For local testing I have been using qemu-x86_defconfig with
> CONFIG_CMD_BOOTEFI_SELFTEST=y.
>
> Cf. https://lists.denx.de/pipermail/u-boot/2017-September/306510.html
>
> As Rob pointed out enabling EFI_LOADER in the sandbox we require an
> implementation of arch/sandbox/include/asm/setjmp.h Probably this has to
> be based on the host architecture.
>
> arch/x86/cpu/x86_64/setjmp.c teaches that setjmp.c is not yet
> implemented in U-Boot for this architecture.
>
> Linux ./arch/x86/um/setjmp_64.S is probably a good starting point.

I don't think we should implement this in U-Boot, but instead we
should use the host C library version.

I will send some WIP patches later today for discussion.

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


Re: [U-Boot] [PATCH 2/3] dm: video: Add basic ANSI escape sequence support

2017-09-17 Thread Rob Clark
On Sun, Sep 17, 2017 at 3:30 PM, Simon Glass  wrote:
> Hi Rob,
>
> On 17 September 2017 at 13:26, Rob Clark  wrote:
>> On Sun, Sep 17, 2017 at 1:55 PM, Simon Glass  wrote:
>>> On 13 September 2017 at 16:12, Rob Clark  wrote:
 Really just the subset that is needed by efi_console.  Perhaps more will
 be added later, for example color support would be useful to implement
 efi_cout_set_attribute().

 Signed-off-by: Rob Clark 
 ---
  drivers/video/Kconfig |   8 +++
  drivers/video/vidconsole-uclass.c | 109 
 ++
  drivers/video/video-uclass.c  |   4 +-
  include/video.h   |   7 +++
  include/video_console.h   |  11 
  5 files changed, 136 insertions(+), 3 deletions(-)
>>>
>>> Reviewed-by: Simon Glass 
>>>
>>> I don't see the test though - is that in another patch?
>>
>> well, at this point test is load/bootefi Shell.efi and does it look
>> messed up on screen.  If you have better ideas, let me know.
>
> It should be easy enough to update test/dm/video.o to use the new
> feature in a new test. This code has nothing to do with EFI really.
>
> The tests are fairly slow in that they gzip the display to check that
> it is correctly, but they work.
>


ok, I guess snapshotting fb and comparing to a reference is a way..
where do I look to figure out how to build/run these tests (and
presumable update reference screenshots?)

I'd be inclined to add any test as a patch on top of the following
patch to cover color escape sequences at the same time..

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


Re: [U-Boot] [PATCH 00/10] efi_loader: event services & API test

2017-09-17 Thread Heinrich Schuchardt
On 09/17/2017 07:58 PM, Simon Glass wrote:
> Hi Heinrich,
> 
> On 15 September 2017 at 02:06, Heinrich Schuchardt  wrote:
>> This patch series provides:
>> * corrections for the EFI event services
>> * a test framework to check the EFI API implementation
>> * unit tests covering the event services
>>
>> The EFI selftest is written such that it could be easily turned
>> into a standalone EFI application. But this would require
>> modifying the build procedures for EFI. Objcopy cannot generate
>> the necessary relocations.
>>
>> The unit tests are identified by entries in a linker generated
>> array to make them as self sufficient as possible.
>>
>> A Python test case is supplied to call run the EFI tests.
>>
>> Tested with Travis CI
>> https://travis-ci.org/xypron2/u-boot/jobs/275733784
>>
>> Of all my efi_loader patches these are the first I would like
>> to see merged.
>>
>> Simon has commented on some other patches that he misses
>> comments for all EFI API functions. I will add these with
>> a separate patch.
>>
>> Heinrich Schuchardt (10):
>>   efi_loader: allow return value in EFI_CALL
>>   efi_selftest: provide an EFI selftest application
>>   test/py: add a test calling the EFI selftest
>>   efi_loader: implement queueing of the notification function
>>   efi_loader: efi_set_timer: reset signaled state
>>   efi_selftest: provide unit test for event services
>>   efi_loader: implement task priority level (TPL)
>>   efi_selftest: test task priority levels
>>   efi_loader: notify when ExitBootServices is invoked
>>   efi_selftest: check notification of ExitBootServices
>>
> 
> This progress makes significant progress on EFI testing at last. I'm
> very pleased to see it. Thank you for all the work you have put into
> this.
> 
> In addition to this (not instead of) I would like to see EFI code
> running under sandbox. I don't at present see a good reason why this
> cannot be done. I am going to try to enable EFI loader support in
> sandbox to a basic level and then we can see how hard it is to get
> some of your tests running directly in sandbox. If that works out then
> we can add that into the mix.
> 
> I think this would make for an easier development environment for new
> EFI features. For some years I have developed all new features in
> sandbox and find it painful and unproductive when I need to test every
> change manually on a board. It should also allow us to run your tests
> (perhaps with some adaptation) with 'make tests' on a local machine
> using sandbox. Ultimately it should be possible to expand test
> coverage to cover all significant EFI logic.
> 
> [..]
> 
> Regards,
> Simon
> 
For local testing I have been using qemu-x86_defconfig with
CONFIG_CMD_BOOTEFI_SELFTEST=y.

Cf. https://lists.denx.de/pipermail/u-boot/2017-September/306510.html

As Rob pointed out enabling EFI_LOADER in the sandbox we require an
implementation of arch/sandbox/include/asm/setjmp.h Probably this has to
be based on the host architecture.

arch/x86/cpu/x86_64/setjmp.c teaches that setjmp.c is not yet
implemented in U-Boot for this architecture.

Linux ./arch/x86/um/setjmp_64.S is probably a good starting point.

Regards

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


Re: [U-Boot] [PATCH 00/10] efi_loader: event services & API test

2017-09-17 Thread Rob Clark
On Sun, Sep 17, 2017 at 1:58 PM, Simon Glass  wrote:
> Hi Heinrich,
>
> On 15 September 2017 at 02:06, Heinrich Schuchardt  wrote:
>> This patch series provides:
>> * corrections for the EFI event services
>> * a test framework to check the EFI API implementation
>> * unit tests covering the event services
>>
>> The EFI selftest is written such that it could be easily turned
>> into a standalone EFI application. But this would require
>> modifying the build procedures for EFI. Objcopy cannot generate
>> the necessary relocations.
>>
>> The unit tests are identified by entries in a linker generated
>> array to make them as self sufficient as possible.
>>
>> A Python test case is supplied to call run the EFI tests.
>>
>> Tested with Travis CI
>> https://travis-ci.org/xypron2/u-boot/jobs/275733784
>>
>> Of all my efi_loader patches these are the first I would like
>> to see merged.
>>
>> Simon has commented on some other patches that he misses
>> comments for all EFI API functions. I will add these with
>> a separate patch.
>>
>> Heinrich Schuchardt (10):
>>   efi_loader: allow return value in EFI_CALL
>>   efi_selftest: provide an EFI selftest application
>>   test/py: add a test calling the EFI selftest
>>   efi_loader: implement queueing of the notification function
>>   efi_loader: efi_set_timer: reset signaled state
>>   efi_selftest: provide unit test for event services
>>   efi_loader: implement task priority level (TPL)
>>   efi_selftest: test task priority levels
>>   efi_loader: notify when ExitBootServices is invoked
>>   efi_selftest: check notification of ExitBootServices
>>
>
> This progress makes significant progress on EFI testing at last. I'm
> very pleased to see it. Thank you for all the work you have put into
> this.
>
> In addition to this (not instead of) I would like to see EFI code
> running under sandbox. I don't at present see a good reason why this
> cannot be done. I am going to try to enable EFI loader support in
> sandbox to a basic level and then we can see how hard it is to get
> some of your tests running directly in sandbox. If that works out then
> we can add that into the mix.

fwiw, I started on trying to get EFI_LOADER working in sandbox earlier
today.. but ran into issues w/ setjmp.  I probably should have kept my
WIP but it was nothing too hard to reproduce (kconfig adds an "||
SANDBOX" to depends, and one or two "#elif defined(CONFIG_SANDBOX)"..
nothing that would take too long to get back to the point I was at
stuck on setjmp/longjmp (and lack of standard system hdrs).. I just
switched to qemu

Other than booting a real OS, seems theoretically possible to get
EFI_LOADER working in sandbox.  It should be enough to (w/ suitable
'host bind') load/run Shell.efi and eventually SCT.efi.

BR,
-R

> I think this would make for an easier development environment for new
> EFI features. For some years I have developed all new features in
> sandbox and find it painful and unproductive when I need to test every
> change manually on a board. It should also allow us to run your tests
> (perhaps with some adaptation) with 'make tests' on a local machine
> using sandbox. Ultimately it should be possible to expand test
> coverage to cover all significant EFI logic.
>
> [..]
>
> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] test/py: provide example scripts for integrating qemu

2017-09-17 Thread Heinrich Schuchardt
The necessary parameters for running Python tests on qemu are
tediouus to find.

The patch adds examples for u-boot-test-console and
u-boot-test-reset.

Signed-off-by: Heinrich Schuchardt 
---
 test/py/README.md | 17 +
 1 file changed, 17 insertions(+)

diff --git a/test/py/README.md b/test/py/README.md
index 829c7efbb2..f3ad10df5a 100644
--- a/test/py/README.md
+++ b/test/py/README.md
@@ -197,6 +197,23 @@ simulator includes a virtual reset button! If not, you can 
launch the
 simulator from `u-boot-test-reset` instead, while arranging for this console
 process to always communicate with the current simulator instance.
 
+With qemu you can use the parameter -monitor to connect the control console to 
a
+Unix socket, e.g.
+
+#!/bin/sh
+touch /tmp/u-boot-monitor-socket
+qemu-system-x86_64 -bios build-qemu-x86/u-boot.rom -nographic -netdev \
+user,id=eth0,tftp=../tftp,net=192.168.76.0/24,dhcpstart=192.168.76.9 \
+-device e1000,netdev=eth0 -machine pc-i440fx-2.8 \
+-monitor unix:/tmp/u-boot-monitor-socket,server,nowait
+
+In `u-boot-test-reset` call the socat command to send a system reset:
+
+#!/bin/sh
+echo system_reset | socat - UNIX-CONNECT:/tmp/u-boot-monitor-socket
+sleep 1
+true
+
  `u-boot-test-flash`
 
 Prior to running the test suite against a board, some arrangement must be made
-- 
2.11.0

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


Re: [U-Boot] [PATCH 2/3] dm: video: Add basic ANSI escape sequence support

2017-09-17 Thread Simon Glass
Hi Rob,

On 17 September 2017 at 13:26, Rob Clark  wrote:
> On Sun, Sep 17, 2017 at 1:55 PM, Simon Glass  wrote:
>> On 13 September 2017 at 16:12, Rob Clark  wrote:
>>> Really just the subset that is needed by efi_console.  Perhaps more will
>>> be added later, for example color support would be useful to implement
>>> efi_cout_set_attribute().
>>>
>>> Signed-off-by: Rob Clark 
>>> ---
>>>  drivers/video/Kconfig |   8 +++
>>>  drivers/video/vidconsole-uclass.c | 109 
>>> ++
>>>  drivers/video/video-uclass.c  |   4 +-
>>>  include/video.h   |   7 +++
>>>  include/video_console.h   |  11 
>>>  5 files changed, 136 insertions(+), 3 deletions(-)
>>
>> Reviewed-by: Simon Glass 
>>
>> I don't see the test though - is that in another patch?
>
> well, at this point test is load/bootefi Shell.efi and does it look
> messed up on screen.  If you have better ideas, let me know.

It should be easy enough to update test/dm/video.o to use the new
feature in a new test. This code has nothing to do with EFI really.

The tests are fairly slow in that they gzip the display to check that
it is correctly, but they work.

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


Re: [U-Boot] [PATCH 2/3] dm: video: Add basic ANSI escape sequence support

2017-09-17 Thread Rob Clark
On Sun, Sep 17, 2017 at 1:55 PM, Simon Glass  wrote:
> On 13 September 2017 at 16:12, Rob Clark  wrote:
>> Really just the subset that is needed by efi_console.  Perhaps more will
>> be added later, for example color support would be useful to implement
>> efi_cout_set_attribute().
>>
>> Signed-off-by: Rob Clark 
>> ---
>>  drivers/video/Kconfig |   8 +++
>>  drivers/video/vidconsole-uclass.c | 109 
>> ++
>>  drivers/video/video-uclass.c  |   4 +-
>>  include/video.h   |   7 +++
>>  include/video_console.h   |  11 
>>  5 files changed, 136 insertions(+), 3 deletions(-)
>
> Reviewed-by: Simon Glass 
>
> I don't see the test though - is that in another patch?

well, at this point test is load/bootefi Shell.efi and does it look
messed up on screen.  If you have better ideas, let me know.


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


Re: [U-Boot] [PATCH v2 5/7] armv8: layerscape: Eanble falcon boot

2017-09-17 Thread Albert ARIBAUD (U-Boot)
Spam detection software, running on the system "lists.denx.de",
has identified this incoming email as possible spam.  The original
message has been attached to this so you can view it or label
similar future email.  If you have any questions, see
@@CONTACT_ADDRESS@@ for details.

Content preview:  Hi, Le Sun, 17 Sep 2017 11:54:56 -0600 Simon Glass 

   a écrit: > +Philippe for review > > On 14 September 2017 at 13:01, York
  Sun  wrote: > > Add jump_to_image_linux() for arm64. Add
   "noreturn" flag to > > armv8_switch_to_el2(). Add hooks to fsl-layerscape
   to enable falcon > > boot. > > > > Signed-off-by: York Sun 
   > > > > --- > > > > Changes in v2: > > Relace getenv_f() with env_get_f()
   after rebasing to latet master. > > > > 
.../arm/cpu/armv8/fsl-layerscape/doc/README.falcon
   | 140 > > + > > arch/arm/cpu/armv8/fsl-layerscape/spl.c
   | 29 + > > arch/arm/include/asm/system.h | 2 +- > > arch/arm/lib/spl.c
   | 11 ++ 4 files > > changed, 181 insertions(+), 1 deletion(-) create mode
   100644 > > arch/arm/cpu/armv8/fsl-layerscape/doc/README.falcon > > 
Reviewed-by:
   Simon Glass  [...] 

Content analysis details:   (5.6 points, 5.0 required)

 pts rule name  description
 -- --
 3.6 RCVD_IN_PBLRBL: Received via a relay in Spamhaus PBL
[82.64.3.181 listed in zen.spamhaus.org]
 0.0 KHOP_BIG_TO_CC Sent to 10+ recipients instaed of Bcc or a list
 0.0 RCVD_IN_SORBS_DUL  RBL: SORBS: sent directly from dynamic IP address
[82.64.3.181 listed in dnsbl.sorbs.net]
-0.0 SPF_HELO_PASS  SPF: HELO matches SPF record
 1.6 RCVD_IN_BRBL_LASTEXT   RBL: No description available.
[82.64.3.181 listed in bb.barracudacentral.org]
 0.4 RDNS_DYNAMIC   Delivered to internal network by host with
dynamic-looking rDNS


--- Begin Message ---
Hi,

Le Sun, 17 Sep 2017 11:54:56 -0600
Simon Glass  a écrit:

> +Philippe for review
> 
> On 14 September 2017 at 13:01, York Sun  wrote:
> > Add jump_to_image_linux() for arm64. Add "noreturn" flag to
> > armv8_switch_to_el2(). Add hooks to fsl-layerscape to enable falcon
> > boot.
> >
> > Signed-off-by: York Sun 
> >
> > ---
> >
> > Changes in v2:
> > Relace getenv_f() with env_get_f() after rebasing to latet master.
> >
> >  .../arm/cpu/armv8/fsl-layerscape/doc/README.falcon | 140
> > +
> > arch/arm/cpu/armv8/fsl-layerscape/spl.c|  29 +
> > arch/arm/include/asm/system.h  |   2 +-
> > arch/arm/lib/spl.c |  11 ++ 4 files
> > changed, 181 insertions(+), 1 deletion(-) create mode 100644
> > arch/arm/cpu/armv8/fsl-layerscape/doc/README.falcon  
> 
> Reviewed-by: Simon Glass 

Nitpick: fix typo ("Eanble") in subject (can be done when applying if
no v3 is needed).

Amicalement,
-- 
Albert.
--- End Message ---
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 00/10] efi_loader: event services & API test

2017-09-17 Thread Simon Glass
Hi Heinrich,

On 15 September 2017 at 02:06, Heinrich Schuchardt  wrote:
> This patch series provides:
> * corrections for the EFI event services
> * a test framework to check the EFI API implementation
> * unit tests covering the event services
>
> The EFI selftest is written such that it could be easily turned
> into a standalone EFI application. But this would require
> modifying the build procedures for EFI. Objcopy cannot generate
> the necessary relocations.
>
> The unit tests are identified by entries in a linker generated
> array to make them as self sufficient as possible.
>
> A Python test case is supplied to call run the EFI tests.
>
> Tested with Travis CI
> https://travis-ci.org/xypron2/u-boot/jobs/275733784
>
> Of all my efi_loader patches these are the first I would like
> to see merged.
>
> Simon has commented on some other patches that he misses
> comments for all EFI API functions. I will add these with
> a separate patch.
>
> Heinrich Schuchardt (10):
>   efi_loader: allow return value in EFI_CALL
>   efi_selftest: provide an EFI selftest application
>   test/py: add a test calling the EFI selftest
>   efi_loader: implement queueing of the notification function
>   efi_loader: efi_set_timer: reset signaled state
>   efi_selftest: provide unit test for event services
>   efi_loader: implement task priority level (TPL)
>   efi_selftest: test task priority levels
>   efi_loader: notify when ExitBootServices is invoked
>   efi_selftest: check notification of ExitBootServices
>

This progress makes significant progress on EFI testing at last. I'm
very pleased to see it. Thank you for all the work you have put into
this.

In addition to this (not instead of) I would like to see EFI code
running under sandbox. I don't at present see a good reason why this
cannot be done. I am going to try to enable EFI loader support in
sandbox to a basic level and then we can see how hard it is to get
some of your tests running directly in sandbox. If that works out then
we can add that into the mix.

I think this would make for an easier development environment for new
EFI features. For some years I have developed all new features in
sandbox and find it painful and unproductive when I need to test every
change manually on a board. It should also allow us to run your tests
(perhaps with some adaptation) with 'make tests' on a local machine
using sandbox. Ultimately it should be possible to expand test
coverage to cover all significant EFI logic.

[..]

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


Re: [U-Boot] [PATCH V2] dm: gpio: Add DM compatibilty to GPIO driver for Davinci

2017-09-17 Thread Simon Glass
Hi Adam,

On 17 September 2017 at 04:29, Adam Ford  wrote:
> On Tue, Sep 12, 2017 at 11:27 PM, Simon Glass  wrote:
>> Hi Adam,
>>
>> On 12 September 2017 at 21:28, Adam Ford  wrote:
>>> This adds DM compatibility for the davinici GPIO driver.
>>> Tested on da850-evm.
>>>
>>> Signed-off-by: Adam Ford 
>>> ---
>>> V2:  The bank calculation needs to take into account the size of the struct
>>>  Whitespace fixes
>>>
>>>  arch/arm/mach-davinci/include/mach/gpio.h |  14 +-
>>>  board/davinci/da8xxevm/da850evm.c |   2 +
>>>  configs/da850evm_defconfig|   3 +-
>>>  drivers/gpio/da8xx_gpio.c | 208 
>>> +++---
>>>  include/configs/da850evm.h|   1 +
>>>  5 files changed, 205 insertions(+), 23 deletions(-)
[...]

>>> +static int davinci_gpio_bind(struct udevice *dev)
>>> +{
>>> +   struct davinci_gpio_platdata *plat = dev->platdata;
>>> +   fdt_addr_t base_addr;
>>> +
>>> +   if (plat)
>>> +   return 0;
>>> +
>>> +   base_addr = devfdt_get_addr(dev);
>>> +   if (base_addr == FDT_ADDR_T_NONE)
>>> +   return -ENODEV;
>>
>> -EINVAL. There is definitely a device.
>>
>> Also we should not be reading the DT in the bind() method. This should
>> happen in ofdata_to_platdata()
>
> Can you point me to an example board you want me to use?  Several
> boards do it this way including omap_gpio.c, mxc_gpio.c, imx_rgpio2.c,
> and others.  I used the omap_gpio.c file as a model for this since
> they are similar.

See for example rk_gpio which is a simple driver.

One mode is tegra_gpio - that driver has an 'empty' parent device and
then creates child GPIO devices in the bind() method.

Another is omap_gpio - that uses platform data and U_BOOT_DEVICE() to
create drivers (for some boards) rather than device tree.

But here you don't see to be doing that. You just have a single GPIO
device, right? If so, you should be able to put everything in
ofdata_to_platdata().

If you set .platdata_auto_alloc_size it will automatically allocate
the platform data.

>>
>>> +
>>> +   /*
>>> +   * TODO:
>>> +   * When every board is converted to driver model and DT is
>>> +   * supported, this can be done by auto-alloc feature, but
>>> +   * not using calloc to alloc memory for platdata.
>>
>> I don't really get this because we are in a driver-model method here.
>> Can we not use the plat data here?
>>
>
> See the above comment.  Some boards have a bind function while others
> use ofdata_to_platdata().  The readme shows two possible ways. I did
> it this way because the examples I followed did it this way.  If it's
> good enough for them, why can't it be good enough this?

It is frustrating when you follow examples and they are not quite
right. I will do a little series to tidy this stuff up a bit and cc
you.

Which readme are you referring to?

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


Re: [U-Boot] [PATCH 02/13] Revert "sandbox: Drop special case console code for sandbox"

2017-09-17 Thread Simon Glass
Hi Bin,

On 17 September 2017 at 06:50, Bin Meng  wrote:
> Hi Simon,
>
> On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass  wrote:
>> While sandbox works OK without the special-case code, it does result in
>> console output being stored in the pre-console buffer while sandbox starts
>> up. If there is a crash or a problem then there is no indication of what
>> is going on.
>>
>> For ease of debugging it seems better to revert this change also.
>>
>> This reverts commit d8c6fb8cedbc35eee27730a7fa544e499b3c81cc.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  common/console.c  | 7 +++
>>  configs/sandbox_defconfig | 2 +-
>>  2 files changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/console.c b/common/console.c
>> index f83528ca60..18457aab3c 100644
>> --- a/common/console.c
>> +++ b/common/console.c
>> @@ -482,6 +482,13 @@ static inline void print_pre_console_buffer(int 
>> flushpoint) {}
>>
>>  void putc(const char c)
>>  {
>> +#ifdef CONFIG_SANDBOX
>> +   /* sandbox can send characters to stdout before it has a console */
>> +   if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
>> +   os_putc(c);
>> +   return;
>> +   }
>> +#endif
>>  #ifdef CONFIG_DEBUG_UART
>> /* if we don't have a console yet, use the debug UART */
>> if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
>> diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
>> index e7a61bd61a..88ae98d312 100644
>> --- a/configs/sandbox_defconfig
>> +++ b/configs/sandbox_defconfig
>> @@ -16,7 +16,7 @@ CONFIG_CONSOLE_RECORD=y
>>  CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000
>>  CONFIG_SILENT_CONSOLE=y
>>  CONFIG_PRE_CONSOLE_BUFFER=y
>> -CONFIG_PRE_CON_BUF_ADDR=0
>> +CONFIG_PRE_CON_BUF_ADDR=0x10
>
> Looks commit d8c6fb8cedbc35eee27730a7fa544e499b3c81cc does not have
> this change. Why is the change from 0 to 0x10?

It causes a conflict with other usage of memory in sandbox. I'll split
it into a separate patch.

>>  CONFIG_CMD_CPU=y
>>  CONFIG_CMD_LICENSE=y
>>  CONFIG_CMD_BOOTZ=y
>> --
>
> And looks there is more changes in commit
> d8c6fb8cedbc35eee27730a7fa544e499b3c81cc that is not reverted? ie:
> puts()?

That function doesn't have this code in it anymore. It just calls putc().

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


Re: [U-Boot] [PATCH 01/13] Revert "sandbox: remove os_putc() and os_puts()"

2017-09-17 Thread Simon Glass
Hi Bin,

On 17 September 2017 at 06:48, Bin Meng  wrote:
> Hi Simon,
>
> On Sun, Sep 17, 2017 at 5:23 AM, Simon Glass  wrote:
>> While sandbox works OK without the special-case code, it does result in
>> console output being stored in the pre-console buffer while sandbox starts
>> up. If there is a crash or a problem then there is no indication of what
>> is going on.
>>
>
> I don't understand where the issue is. I built with current
> sandbox_defconfig w/ or w/o CONFIG_PRE_CONSOLE_BUFFER, both work fine.
>

Did you try adding a crash before console_init_f()? The problem is
that any early problems in sandbox are not reported. It just crashes
with no output. With these two patches reverted you can see what is
going on.

>> For ease of debugging it seems better to revert this change.
>>
>> This reverts commit 47b98ad0f6779485d0f0c14f337c3eece273eb54.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>>  arch/sandbox/cpu/os.c | 11 +++
>>  include/os.h  | 20 
>>  2 files changed, 31 insertions(+)
>>

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


Re: [U-Boot] [PATCH v2 5/5] board: at91sam9x5ek: Convert to CONFIG_DM_VIDEO

2017-09-17 Thread Simon Glass
On 14 September 2017 at 23:15, Wenyou Yang  wrote:
> Convert the board to support the video driver model, add the device
> tree node, and remove the unnecessary code.
>
> Signed-off-by: Wenyou Yang 
> ---
>
> Changes in v2:
>  - Rebase the u-boot/master (5541543f686).
>  - Drop the applied patches.
>  - Improve the commit log.
>
>  arch/arm/mach-at91/Kconfig   |   1 +
>  board/atmel/at91sam9x5ek/at91sam9x5ek.c  | 111 
> ++-
>  configs/at91sam9x5ek_dataflash_defconfig |   3 +-
>  configs/at91sam9x5ek_mmc_defconfig   |   3 +-
>  configs/at91sam9x5ek_nandflash_defconfig |   3 +-
>  configs/at91sam9x5ek_spiflash_defconfig  |   3 +-
>  include/configs/at91sam9x5ek.h   |  10 ---
>  7 files changed, 16 insertions(+), 118 deletions(-)

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


Re: [U-Boot] [PATCH v2 4/5] board: sama5d4_xplained: Convert to CONFIG_DM_VIDEO

2017-09-17 Thread Simon Glass
On 14 September 2017 at 23:15, Wenyou Yang  wrote:
> From: Wenyou Yang 
>
> Convert the board to support the video driver model, add the device
> tree node, and remove the unnecessary code.
>
> Signed-off-by: Wenyou Yang 
> ---
>
> Changes in v2: None
>
>  arch/arm/dts/at91-sama5d4_xplained.dts  |  25 ++
>  arch/arm/dts/sama5d4.dtsi   |  21 +
>  arch/arm/mach-at91/Kconfig  |   1 +
>  board/atmel/common/video_display.c  |   2 +-
>  board/atmel/sama5d4_xplained/sama5d4_xplained.c | 102 
> ++--
>  configs/sama5d4_xplained_mmc_defconfig  |   2 +
>  configs/sama5d4_xplained_nandflash_defconfig|   2 +
>  configs/sama5d4_xplained_spiflash_defconfig |   2 +
>  include/configs/sama5d4_xplained.h  |  11 ---
>  9 files changed, 40 insertions(+), 128 deletions(-)

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


Re: [U-Boot] [PATCH v2 3/5] board: sama5d4ek: Convert to CONFIG_DM_VIDEO

2017-09-17 Thread Simon Glass
On 14 September 2017 at 23:15, Wenyou Yang  wrote:
> From: Wenyou Yang 
>
> Convert the board to support the video driver model, add the device
> tree node, and remove the unnecessary code.
>
> Signed-off-by: Wenyou Yang 
> ---
>
> Changes in v2: None
>
>  arch/arm/dts/at91-sama5d4ek.dts   | 26 ++
>  arch/arm/mach-at91/Kconfig|  1 +
>  board/atmel/sama5d4ek/sama5d4ek.c | 97 
> +++
>  configs/sama5d4ek_mmc_defconfig   |  3 +-
>  configs/sama5d4ek_nandflash_defconfig |  3 +-
>  configs/sama5d4ek_spiflash_defconfig  |  3 +-
>  include/configs/sama5d4ek.h   |  9 
>  7 files changed, 39 insertions(+), 103 deletions(-)

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


Re: [U-Boot] [PATCH v2 2/5] board: sama5d3xek: Convert to CONFIG_DM_VIDEO

2017-09-17 Thread Simon Glass
On 14 September 2017 at 23:15, Wenyou Yang  wrote:
> From: Wenyou Yang 
>
> Convert the board to support the video driver model, add the device
> tree node, and remove the unnecessary code.
>
> Signed-off-by: Wenyou Yang 
> ---
>
> Changes in v2: None
>
>  arch/arm/dts/sama5d36ek_cmp.dts|  1 +
>  arch/arm/dts/sama5d3_lcd.dtsi  | 21 +---
>  arch/arm/dts/sama5d3xdm.dtsi   | 26 ++
>  board/atmel/sama5d3xek/sama5d3xek.c| 83 
> ++
>  configs/sama5d36ek_cmp_mmc_defconfig   |  3 +-
>  configs/sama5d36ek_cmp_nandflash_defconfig |  3 +-
>  configs/sama5d36ek_cmp_spiflash_defconfig  |  3 +-
>  configs/sama5d3xek_mmc_defconfig   |  3 +-
>  configs/sama5d3xek_nandflash_defconfig |  3 +-
>  configs/sama5d3xek_spiflash_defconfig  |  3 +-
>  include/configs/sama5d3xek.h   |  9 
>  11 files changed, 43 insertions(+), 115 deletions(-)

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


Re: [U-Boot] [PATCH v2 1/5] board: sama5d2_xplained: Convert to CONFIG_DM_VIDEO

2017-09-17 Thread Simon Glass
On 14 September 2017 at 23:15, Wenyou Yang  wrote:
> Convert the board to support the video driver model, add the device
> tree node, and remove the unnecessary code.
>
> Signed-off-by: Wenyou Yang 
> ---
>
> Changes in v2: None
>
>  arch/arm/dts/at91-sama5d2_xplained.dts  | 60 
>  arch/arm/dts/sama5d2.dtsi   |  7 ++
>  arch/arm/mach-at91/Kconfig  |  1 +
>  board/atmel/sama5d2_xplained/sama5d2_xplained.c | 95 
> ++---
>  configs/sama5d2_xplained_mmc_defconfig  |  2 +
>  configs/sama5d2_xplained_spiflash_defconfig |  2 +
>  include/configs/sama5d2_xplained.h  | 12 
>  7 files changed, 79 insertions(+), 100 deletions(-)

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


Re: [U-Boot] [PATCH 2/3] dm: video: Add basic ANSI escape sequence support

2017-09-17 Thread Simon Glass
On 13 September 2017 at 16:12, Rob Clark  wrote:
> Really just the subset that is needed by efi_console.  Perhaps more will
> be added later, for example color support would be useful to implement
> efi_cout_set_attribute().
>
> Signed-off-by: Rob Clark 
> ---
>  drivers/video/Kconfig |   8 +++
>  drivers/video/vidconsole-uclass.c | 109 
> ++
>  drivers/video/video-uclass.c  |   4 +-
>  include/video.h   |   7 +++
>  include/video_console.h   |  11 
>  5 files changed, 136 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass 

I don't see the test though - is that in another patch?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 7/7] armv8: ls1043ardb_sdcard: Enable falcon boot

2017-09-17 Thread Simon Glass
On 14 September 2017 at 13:01, York Sun  wrote:
> Update defconfig to enable falcon boot, add needed macros to board
> header file. Because environment variables are not avaiable during
> SPL stage for SD boot, set "boot_os=y" as default.
>
> Signed-off-by: York Sun 
>
> ---
>
> Changes in v2: None
>
>  configs/ls1043ardb_sdcard_defconfig | 6 ++
>  include/configs/ls1043a_common.h| 7 ---
>  include/configs/ls1043ardb.h| 5 +
>  3 files changed, 15 insertions(+), 3 deletions(-)

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


Re: [U-Boot] [PATCH v2 5/7] armv8: layerscape: Eanble falcon boot

2017-09-17 Thread Simon Glass
+Philippe for review

On 14 September 2017 at 13:01, York Sun  wrote:
> Add jump_to_image_linux() for arm64. Add "noreturn" flag to
> armv8_switch_to_el2(). Add hooks to fsl-layerscape to enable falcon
> boot.
>
> Signed-off-by: York Sun 
>
> ---
>
> Changes in v2:
> Relace getenv_f() with env_get_f() after rebasing to latet master.
>
>  .../arm/cpu/armv8/fsl-layerscape/doc/README.falcon | 140 
> +
>  arch/arm/cpu/armv8/fsl-layerscape/spl.c|  29 +
>  arch/arm/include/asm/system.h  |   2 +-
>  arch/arm/lib/spl.c |  11 ++
>  4 files changed, 181 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/cpu/armv8/fsl-layerscape/doc/README.falcon

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


Re: [U-Boot] [PATCH v2 3/7] armv8: fsl-layerscape: Avoid running dram_init_banksize again

2017-09-17 Thread Simon Glass
On 14 September 2017 at 13:01, York Sun  wrote:
> gd->ram_size is reduced in this function to reserve secure memory.
> Avoid running this function again to further reduce memory size.
> This fixes issue for SPL boot with PPA image loaded in which case
> secure memory is incorrectly allocated due to repeated calling.
>
> Signed-off-by: York Sun 
>
> ---
>
> Changes in v2:
> New patch to fix gd->ram_size error after rebasing to latest mater.
>
>  arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 18 +-
>  1 file changed, 17 insertions(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH v2 1/7] spl: fix assignment of board info to global data

2017-09-17 Thread Simon Glass
Hi York,

On 14 September 2017 at 13:01, York Sun  wrote:
> This partially reverts commit 15eb1d43bf470b85e9031c2fce7e0ce7b27dd321
> which intended to move assignment of board info earlier, into
> board_init_r(). However, function preload_console_init() is called
> either from spl_board_init() or from board_init_f(). For the latter
> case, the board info assignment is much earlier than board_init_r().
> Moving such assignment to board_init_r() would be moving it later.
>
> Signed-off-by: York Sun 
> CC: Lokesh Vutla 
> CC: Ravi Babu 
> CC: Lukasz Majewski 
> CC: Tom Rini 
>
> ---
>
> Changes in v2:
> New patch to fix spl after rebasing to latest master.
>
>  common/spl/spl.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index ce9819e..98b0ca0 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -365,7 +365,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
> struct spl_image_info spl_image;
>
> debug(">>spl:board_init_r()\n");
> -   gd->bd = 
> +
> +   if (!gd->bd)
> +   gd->bd = 
> +
>  #ifdef CONFIG_SPL_OS_BOOT
> dram_init_banksize();
>  #endif
> @@ -450,6 +453,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>   */
>  void preloader_console_init(void)
>  {
> +   if (!gd->bd)
> +   gd->bd = 
> +

It seems odd that enabling the console sets this data.

What was the impact of moving it later for your board?


> gd->baudrate = CONFIG_BAUDRATE;
>
> serial_init();  /* serial communications setup */
> --
> 2.7.4
>

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


Re: [U-Boot] [PATCH] test: print_ut: Add test for %ls strings

2017-09-17 Thread Simon Glass
On 13 September 2017 at 16:46, Rob Clark  wrote:
> Add a simple test for long strings.
>
> Signed-off-by: Rob Clark 
> ---
>  test/print_ut.c | 3 +++
>  1 file changed, 3 insertions(+)

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


Re: [U-Boot] [PATCH 15/15] rockchip: defconfig: lion-rk3368: sync up with SPL changes for ATF

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> This tracks the SPL changes for ATF for the RK3368-uQ7:
>  * renames ATF_SUPPORT to ATF
>  * drops CONFIG_SPL_ATF_TEXT_BASE (now dynamically retrieved from
>the .itb file)
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  configs/lion-rk3368_defconfig | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH 04/15] spl: fit: simplify logic for FDT loading for non-OS boots

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> To better support bootin through an ATF or OPTEE, we need to
> streamline some of the logic for when the FDT is appended to an image:
> depending on the image type, we'd like to append the FDT not at all
> (the case for the OS boot), to the 'firmware' image (if it is a
> U-Boot) or to one of the loadables (if the 'firmware' is an ATF, an
> OPTEE, or some other image-type and U-Boot is listed in the
> loadabled).
>
> To achieve this goal, we drop the os_boot flag and track the type of
> image loaded.  If it is of type IH_OS_U_BOOT, we append the FDT.
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  common/spl/spl_fit.c | 86 
> ++--
>  1 file changed, 56 insertions(+), 30 deletions(-)

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


Re: [U-Boot] [PATCH 13/15] rockchip: board: lion-rk3368: update .its file

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> For the RK3368-uQ7, we can now update the .its file to mark the
> Trusted Firmware as out 'firmware' bootable and annotate both ATF and
> U-Boot with an OS-type.
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  board/theobroma-systems/lion_rk3368/fit_spl_atf.its | 6 --
>  1 file changed, 4 insertions(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH 14/15] rockchip: defconfig: puma-rk3399: sync up with SPL changes for ATF

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> This defconfig update makes use of the new features:
>  * CONFIG_ROCKCHIP_SPL_RESERVE_IRAM is now set to 0, as there is no
>overlap between the M0 firmware and the ATF (we load this to DRAM
>and relocate it to its final location within the ATF)
>  * tracks the ATF_SUPPORT -> ATF renaming
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  configs/puma-rk3399_defconfig | 2 ++
>  1 file changed, 2 insertions(+)

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


Re: [U-Boot] [PATCH 12/15] rockchip: board: puma-rk3399: update .its file to use new features

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> This commit updates the .its file for the RK3399-Q7 to use the new
> features and demonstrates how to use those:
>  * it marks the ATF as the 'firmware'
>  * it tracks the OS-type for U-Boot and ATF
>  * it loads the PMU (M0) firmware to DRAM and records the location
>to /fit-images (where our ATF reads it from)
>
> With the handoff of the next-stage FDT to ATF in place, we can now use
> this to pass information about the load addresses and names of each
> loadables to ATF: now we can load the M0 firmware into DRAM and avoid
> overwriting parts of the SPL stage.  This is achieved by changing our
> .its-file to use an available area of DRAM as the load-address.
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  board/theobroma-systems/puma_rk3399/fit_spl_atf.its | 12 +++-
>  1 file changed, 7 insertions(+), 5 deletions(-)

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


Re: [U-Boot] [PATCH 11/15] rockchip: defconfig: firefly-rk3399: sync up with SPL changes for ATF

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> This tracks the SPL changes for ATF for the Firefly:
>  * renames ATF_SUPPORT to ATF
>  * drops CONFIG_SPL_ATF_TEXT_BASE
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  configs/firefly-rk3399_defconfig | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH 09/15] spl: atf: drop the SPL_ATF_TEXT_BASE configuration item

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> The SPL_ATF_TEXT_BASE configuration item has become obsolete.
> Remove it from Kconfig.
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  common/spl/Kconfig | 6 --
>  1 file changed, 6 deletions(-)

Reviewed-by: Simon Glass 

But should also drop from defconfigs that use it.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 10/15] rockchip: dts: rk3399-puma: add /config/arm-trusted-firmware, reset-gpio property

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> With the ATF capable of accessing the FDT passed to the next stage,
> we can specify configuration items for the ATF in the /config path.
>
> This adds the arm-trusted-firmware,reset-gpio that conveys the number
> of the GPIO used to reset the board (used, when a reboot is requested
> from ATF via PSCI).
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  arch/arm/dts/rk3399-puma.dtsi | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/dts/rk3399-puma.dtsi b/arch/arm/dts/rk3399-puma.dtsi
> index d33c710..70d551b 100644
> --- a/arch/arm/dts/rk3399-puma.dtsi
> +++ b/arch/arm/dts/rk3399-puma.dtsi
> @@ -16,6 +16,7 @@
> u-boot,mmc-env-offset = <0x4000>;  /* @  16KB */
> u-boot,efi-partition-entries-offset = <0x20>; /* 2MB */
> u-boot,boot-led = "module_led";
> +   arm-trusted-firmware,reset-gpio = <38>;
> };
>
> chosen {
> --
> 2.1.4
>

How about putting this in an atf {} subnode?

That reminds me that these things should be documented in
doc/device-tree-bindings/config.txt
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 08/15] spl: rename config item SPL_ATF_SUPPORT to SPL_ATF

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> Having CONFIG_SPL_ATF seems more natural.
> Rename it, while it it is easy and there's few boards that use it
> (only RK3399 and RK3368 boards).
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  common/spl/Kconfig  | 2 +-
>  common/spl/Makefile | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

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


Re: [U-Boot] [PATCH 07/15] spl: atf: introduce spl_invoke_atf and make bl31_entry private

2017-09-17 Thread Simon Glass
Hi Philipp,

On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> This adds a new interface spl_invoke_atf() that takes a spl_image_info
> argument and then derives the necessary parameters for the ATF entry.
> Based on the additional information recorded (into /fit-images) from
> the FIT loadables, we can now easily locate the next boot stage.
>
> We now pass a pointer to a FDT as the platform-specific parameter
> pointer to ATF (so we don't run into the future headache of every
> board/platform defining their own proprietary tag-structure), as
> FDT access is already available in ATF.
>
> With the necessary infrastructure in place, we can now update the
> support for the ARM Trusted Firmware to dispatch into the
> spl_invoke_atf function only if a IH_OS_ARM_TRUSTED_FIRMWARE image is
> loaded.
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  common/spl/spl.c | 11 +++
>  common/spl/spl_atf.c | 84 
> +++-
>  2 files changed, 82 insertions(+), 13 deletions(-)

Reviewed-by: Simon Glass 

Please see question below

[..]

> index 6e8f928..63557c0 100644
> --- a/common/spl/spl_atf.c
> +++ b/common/spl/spl_atf.c
> @@ -5,6 +5,7 @@
>   * reserved.
>   * Copyright (C) 2016 Rockchip Electronic Co.,Ltd
>   * Written by Kever Yang 
> + * Copyright (C) 2017 Theobroma Systems Design und Consulting GmbH
>   *
>   * SPDX-License-Identifier: BSD-3-Clause
>   */
> @@ -30,7 +31,7 @@ static struct bl31_params *bl2_to_bl31_params;
>   *
>   * @return bl31 params structure pointer
>   */
> -struct bl31_params *bl2_plat_get_bl31_params(void)
> +static struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl33_entry)
>  {
> struct entry_point_info *bl33_ep_info;
>
> @@ -66,7 +67,7 @@ struct bl31_params *bl2_plat_get_bl31_params(void)
>
> /* BL33 expects to receive the primary CPU MPID (through x0) */
> bl33_ep_info->args.arg0 = 0x & read_mpidr();
> -   bl33_ep_info->pc = CONFIG_SYS_TEXT_BASE;
> +   bl33_ep_info->pc = bl33_entry;
> bl33_ep_info->spsr = SPSR_64(MODE_EL2, MODE_SP_ELX,
>  DISABLE_ALL_EXECPTIONS);
>
> @@ -77,21 +78,88 @@ struct bl31_params *bl2_plat_get_bl31_params(void)
> return bl2_to_bl31_params;
>  }
>
> -void raw_write_daif(unsigned int daif)
> +static inline void raw_write_daif(unsigned int daif)
>  {
> __asm__ __volatile__("msr DAIF, %0\n\t" : : "r" (daif) : "memory");
>  }
>
> -void bl31_entry(void)
> +typedef void (*atf_entry_t)(struct bl31_params *params, void *plat_params);
> +
> +static void bl31_entry(uintptr_t bl31_entry, uintptr_t bl33_entry,
> +  uintptr_t fdt_addr)
>  {
> struct bl31_params *bl31_params;
> -   void (*entry)(struct bl31_params *params, void *plat_params) = NULL;
> +   atf_entry_t  atf_entry = (atf_entry_t)bl31_entry;
>
> -   bl31_params = bl2_plat_get_bl31_params();
> -   entry = (void *)CONFIG_SPL_ATF_TEXT_BASE;
> +   bl31_params = bl2_plat_get_bl31_params(bl33_entry);
>
> raw_write_daif(SPSR_EXCEPTION_MASK);
> dcache_disable();
>
> -   entry(bl31_params, NULL);
> +   atf_entry((void *)bl31_params, (void *)fdt_addr);
> +}
> +
> +static int spl_fit_images_find_uboot(void *blob)
> +{
> +   int parent, node, ndepth;
> +   const void *data;
> +
> +   if (!blob)
> +   return -FDT_ERR_BADMAGIC;
> +
> +   parent = fdt_path_offset(blob, "/fit-images");
> +   if (parent < 0)
> +   return -FDT_ERR_NOTFOUND;
> +
> +   for (node = fdt_next_node(blob, parent, );
> +(node >= 0) && (ndepth > 0);
> +node = fdt_next_node(blob, node, )) {
> +   if (ndepth != 1)
> +   continue;
> +
> +   data = fdt_getprop(blob, node, FIT_OS_PROP, NULL);
> +   if (!data)
> +   continue;
> +
> +   if (genimg_get_os_id(data) == IH_OS_U_BOOT)
> +   return node;

How come this is in 'data' instead of the 'type' property?

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


Re: [U-Boot] [PATCH 06/15] spl: fit: implement recording of loadables into /fit-images

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> If a FDT was loaded (e.g. to append it to U-Boot image), we store it's
> address and record information for all loadables into this FDT.  This
> allows us to easily keep track of images for multiple privilege levels
> (e.g. with ATF) or of firmware images preloaded into temporary
> locations (e.g. PMU firmware that may overlap the SPL stage).
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  common/spl/spl_fit.c | 95 
> 
>  1 file changed, 81 insertions(+), 14 deletions(-)

Reviewed-by: Simon Glass 

I wonder if this should be a new CONFIG option to reduce code size for
things that don't need it?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 05/15] spl: fit: implement fdt_record_loadable

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> During the loading of more complex FIT images (e.g. when the invoked
> next stage needs to find additional firmware for a power-management
> core... or if there are multiple images for different privilege levels
> started in parallel), it is helpful to create a record of what images
> are loaded where: if a FDT is loaded for one of the next stages, it
> can be used to convey the status and location of loadables.
>
> This adds a fdt_record_loadable() function that can be invoked to
> record the status of each loadable below the /fit-images path.
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  common/fdt_support.c  | 39 +++
>  include/fdt_support.h | 20 
>  2 files changed, 59 insertions(+)

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


Re: [U-Boot] [PATCH 03/15] spl: change load_addr and entry_point to uintptr_t

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> Mainly a stylistic change: convert the load_addr and entry_point
> fields of struct spl_image_info to uintptr_t (from ulong).
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  include/spl.h | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass 

I am a bit nervous though since we use ulong everywhere in U-Boot for addresses.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 01/15] image: add IH_OS_ARM_TRUSTED_FIRMWARE for ARM Trusted Firmware

2017-09-17 Thread Simon Glass
On 13 September 2017 at 13:29, Philipp Tomsich
 wrote:
> To boot on ARMv8 systems with ARM Trusted Firmware, we need to
> assemble an ATF-specific parameter structure and also provide the
> address of the images started by ATF (e.g. BL3-3, which may be the
> full U-Boot).
>
> To allow us to identify an ARM Trusted Firmware contained in a FIT
> image, this adds the necessary definitions.
>
> Signed-off-by: Philipp Tomsich 
> ---
>
>  common/image.c  | 1 +
>  include/image.h | 1 +
>  2 files changed, 2 insertions(+)

Reviewed-by: Simon Glass 

You might consider IH_ATF instead of IH_OS_ARM_TRUSTED_FIRMWARE, but
it's up to you.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 9/9] board: Add stm32h7 SoC, discovery and evaluation boards support

2017-09-17 Thread Simon Glass
On 13 September 2017 at 10:00,   wrote:
> From: Patrice Chotard 
>
> This patch adds support for stm32h7 soc family, stm32h743
> discovery and evaluation boards.
>
> For more information about STM32H7 series, please visit:
> http://www.st.com/en/microcontrollers/stm32h7-series.html
>
> Signed-off-by: Patrice Chotard 
> ---
>
> v2: _ get memory address and size from DT in board file
>
>
>  arch/arm/include/asm/arch-stm32h7/gpio.h   | 126 
> +
>  arch/arm/include/asm/arch-stm32h7/stm32.h  |  21 +
>  arch/arm/mach-stm32/Kconfig|  17 
>  arch/arm/mach-stm32/Makefile   |   1 +
>  arch/arm/mach-stm32/stm32h7/Kconfig|  12 +++
>  arch/arm/mach-stm32/stm32h7/Makefile   |   8 ++
>  arch/arm/mach-stm32/stm32h7/soc.c  |  59 ++
>  board/st/stm32h743-disco/Kconfig   |  19 +
>  board/st/stm32h743-disco/MAINTAINERS   |   7 ++
>  board/st/stm32h743-disco/Makefile  |   8 ++
>  board/st/stm32h743-disco/stm32h743-disco.c |  56 +
>  board/st/stm32h743-eval/Kconfig|  19 +
>  board/st/stm32h743-eval/MAINTAINERS|   6 ++
>  board/st/stm32h743-eval/Makefile   |   8 ++
>  board/st/stm32h743-eval/stm32h743-eval.c   |  56 +
>  configs/stm32h743-disco_defconfig  |  30 +++
>  configs/stm32h743-eval_defconfig   |  30 +++
>  include/configs/stm32h743-disco.h  |  51 
>  include/configs/stm32h743-eval.h   |  51 
>  19 files changed, 585 insertions(+)
>  create mode 100644 arch/arm/include/asm/arch-stm32h7/gpio.h
>  create mode 100644 arch/arm/include/asm/arch-stm32h7/stm32.h
>  create mode 100644 arch/arm/mach-stm32/stm32h7/Kconfig
>  create mode 100644 arch/arm/mach-stm32/stm32h7/Makefile
>  create mode 100644 arch/arm/mach-stm32/stm32h7/soc.c
>  create mode 100644 board/st/stm32h743-disco/Kconfig
>  create mode 100644 board/st/stm32h743-disco/MAINTAINERS
>  create mode 100644 board/st/stm32h743-disco/Makefile
>  create mode 100644 board/st/stm32h743-disco/stm32h743-disco.c
>  create mode 100644 board/st/stm32h743-eval/Kconfig
>  create mode 100644 board/st/stm32h743-eval/MAINTAINERS
>  create mode 100644 board/st/stm32h743-eval/Makefile
>  create mode 100644 board/st/stm32h743-eval/stm32h743-eval.c
>  create mode 100644 configs/stm32h743-disco_defconfig
>  create mode 100644 configs/stm32h743-eval_defconfig
>  create mode 100644 include/configs/stm32h743-disco.h
>  create mode 100644 include/configs/stm32h743-eval.h

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


Re: [U-Boot] [PATCH v2 8/9] ARM: DTS: stm32: adapt stm32h7 dts files for U-boot

2017-09-17 Thread Simon Glass
On 13 September 2017 at 10:00,   wrote:
> From: Patrice Chotard 
>
> This patch adapts stm32h743 disco and eval dts files to match
> with U-boot requirements or add features wich are not yet

U-Boot (and below)

> upstreamed on kernel side :
>
> _ Add RCC clock driver node and update all clocks phandle
>   accordingly.
>
>   By default, on kernel side, all clocks was temporarly
>   configured as a phandle to timer_clk waiting for a RCC
>   clock driver to be available.
>   On U-boot side, we now have a dedicated RCC clock driver, we
>   can configured all clocks as phandle to this driver.
>
>   All this binding update will be available soon in a kernel tag,
>   as all the bindings have been acked by Rob Herring [1].
>
>   [1] http://lkml.iu.edu/hypermail/linux/kernel/1704.0/00935.html
>
> _ Align STM32H7 serial compatible string with the one which will be
>   available in next kernel tag. The bindings has been acked by
>   Rob Herring [2].
>   This compatible string will be usefull to add stm32h7 specific
>   feature for this serial driver.
>
>   [2] https://lkml.org/lkml/2017/7/17/739
>
> _ Add gpio compatible and aliases for stm32h743
>
> _ Add FMC sdram node with associated new bindings value to
>   manage second bank (ie bank 1).
>
> _ Add missing HSI and CSI oscillators nodes needed
>   by STM32H7 RCC clock driver.
>
>   Clock sources could be:
> _ HSE (High Speed External)
> _ HSI (High Speed Internal)
> _ CSI (Low Power Internal)
>
>   These clocks can be used as clocksource in some configuration.
>   By default, HSE is selected as clock source.
>
> _ Set HSE to 25Mhz for stm32h743i-disco and eval board
>
>   By default, the external oscillator frequency is defined at
>   25 Mhz in SoC stm32h743.dtsi file.
>   It has been set at 125 Mhz in kernel DT temporarly waiting for
>   RCC clock driver becomes available.
>
>   As in U-boot we got a RCC clock driver, the real value of HSE
>   clock can be used.
>
> _ Add "u-boot,dm-pre-reloc" for rcc, fmc, fixed-clock, pinctrl,
>   pwrcfg and gpio nodes.
>
> Signed-off-by: Patrice Chotard 
> ---
>  arch/arm/dts/stm32h7-u-boot.dtsi |  88 ++
>  arch/arm/dts/stm32h743-pinctrl.dtsi  | 102 
> +++
>  arch/arm/dts/stm32h743.dtsi  |  56 ++---
>  arch/arm/dts/stm32h743i-disco.dts|  35 +--
>  arch/arm/dts/stm32h743i-eval.dts |  34 +--
>  include/dt-bindings/memory/stm32-sdram.h |   7 +++
>  6 files changed, 294 insertions(+), 28 deletions(-)
>  create mode 100644 arch/arm/dts/stm32h7-u-boot.dtsi

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


Re: [U-Boot] [PATCH v2 7/9] ARM: DTS: stm32: add stm32h743i-eval files

2017-09-17 Thread Simon Glass
On 13 September 2017 at 10:00,   wrote:
> From: Patrice Chotard 
>
> This file is imported from linux kernel v4.13
>
> Add device tree support for STM32H743 evaluation board.
> This board offers :
>   _ STM32H743XIH6 microcontroller with 2 Mbytes of
> Flash memory and 1 Mbyte of RAM in TFBGA240+25 package
>   _ 5.7” 640x480 TFT color LCD with touch screen
>   _ Ethernet compliant with IEEE-802.3-2002
>   _ USB OTG HS and FS
>   _ I2 C compatible serial interface
>   _ RTC with rechargeable backup battery
>   _ SAI Audio DAC
>   _ ST-MEMS digital microphones
>   _ 8-Gbyte (or more) SDIO3.0 interface microSD™ card
>   _ 8Mx32bit SDRAM, 1Mx16bit SRAM and 8Mx16bit NOR Flash
>   _ 1-Gbit Twin Quad-SPI NOR Flash
>   _ Potentiometer
>   _ 4 colored user LEDs
>   _ Reset, wakeup, tamper or key buttons
>   _ Joystick with 4-direction control and selector
>   _ Board connectors :
>  Power jack
>  3 USB with Micro-AB
>  RS-232 communications
>  Ethernet RJ45
>  FD-CAN compliant connection
>  Stereo headset jack including analog microphone input
>  2 audio jacks for external speakers
>  microSD™ card
>  JTAG/SWD and ETM trace
>_ Expansion connectors:
>  Extension connectors and memory connectors for daughterboard
>  or wire-wrap board
>_ Flexible power-supply options: ST-LINK USB VBUS or external
>  sources
>_ On-board ST-LINK/V2-1 debugger/programmer with USB re-enumeration
>  capability: mass storage, virtual COM port and debug port
>
> Signed-off-by: Patrice Chotard 
> ---
>  arch/arm/dts/Makefile|  3 +-
>  arch/arm/dts/stm32h743i-eval.dts | 74 
> 
>  2 files changed, 76 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/stm32h743i-eval.dts
>

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


Re: [U-Boot] [PATCH v2 6/9] ARM: DTS: stm32: add stm32h743i-disco files

2017-09-17 Thread Simon Glass
On 13 September 2017 at 10:00,   wrote:
> From: Patrice Chotard 
>
> All these files are imported from linux kernel v4.13
>
> Add device tree support for STM32H743 SoC and discovery
> board. This board offers :
>   _ STM32H743XIH6 microcontroller with 2 Mbytes of
> Flash memory and 1 Mbyte of RAM in TFBGA240+25 package
>   _ 5.7” 640x480 TFT color LCD with touch screen
>   _ Ethernet compliant with IEEE-802.3-2002
>   _ USB OTG HS
>   _ I2 C compatible serial interface
>   _ ST-MEMS digital microphones
>   _ 8-Gbyte (or more) SDIO3.0 interface microSD™ card
>   _ 8Mx32bit SDRAM
>   _ 1-Gbit Twin Quad-SPI NOR Flash
>   _ Reset, wakeup, or key buttons
>   _ Joystick with 4-direction control and selector
>   _ Board connectors :
> 1 USB with Micro-AB
> Ethernet RJ45
> Stereo headset jack including analog microphone input
> microSD™ card
> RCA connector
> JTAG/SWD and ETM trace
>_ Expansion connectors:
> Arduino Uno compatible Connectors
> 2 x PIO connectors (PMOD and PMOD+)
>_ On-board ST-LINK/V2-1 debugger/programmer with USB re-enumeration
>  capability: mass storage, virtual COM port and debug port
>
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 
> ---
>
> v2: _ reword the board description
>
>  arch/arm/dts/Makefile |1 +
>  arch/arm/dts/stm32h743-pinctrl.dtsi   |  169 +++
>  arch/arm/dts/stm32h743.dtsi   |   91 ++
>  arch/arm/dts/stm32h743i-disco.dts |   73 ++
>  include/dt-bindings/pinctrl/stm32h7-pinfunc.h | 1612 
> +
>  5 files changed, 1946 insertions(+)
>  create mode 100644 arch/arm/dts/stm32h743-pinctrl.dtsi
>  create mode 100644 arch/arm/dts/stm32h743.dtsi
>  create mode 100644 arch/arm/dts/stm32h743i-disco.dts
>  create mode 100644 include/dt-bindings/pinctrl/stm32h7-pinfunc.h

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


Re: [U-Boot] [PATCH v2 5/9] dm: misc: add stm32 rcc driver

2017-09-17 Thread Simon Glass
On 13 September 2017 at 10:00,   wrote:
> From: Christophe Kerello 
>
> This patch adds the support of reset and clock control
> block (rcc) found on STM32 SoCs.
> This driver is similar to a MFD linux driver.
>
> This driver supports currently STM32H7 only.
> STM32F4 and STM32F7 will be migrated to this rcc MFD driver
> in the future to uniformize all STM32 SoCs already upstreamed.
>
> Signed-off-by: Christophe Kerello 
> Signed-off-by: Patrice Chotard 
> Reviewed-by: Vikas Manocha 
> ---
>
> v2: _ merge peripheral and kernel clocks arrays
> _ add voltage scaling support needed for Evaluation board
>
>  drivers/misc/Kconfig |  9 +
>  drivers/misc/Makefile|  1 +
>  drivers/misc/stm32_rcc.c | 45 +
>  3 files changed, 55 insertions(+)
>  create mode 100644 drivers/misc/stm32_rcc.c

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


Re: [U-Boot] [PATCH v2 4/9] dm: reset: add stm32 reset driver

2017-09-17 Thread Simon Glass
On 13 September 2017 at 10:00,   wrote:
> From: Patrice Chotard 
>
> This driver is adapted from linux drivers/reset/reset-stm32.c
> It's compatible with STM32 F4/F7/H7 SoCs.
>
> This driver doesn't implement .of_match as it's binded
> by MFD RCC driver.
>
> To add support for each SoC family, a SoC's specific
> include/dt-binfings/mfd/stm32xx-rcc.h file must be added.
>
> This patch only includes stm32h7-rcc.h dedicated for STM32H7 SoCs.
> Other SoCs support will be added in the future.
>
> Signed-off-by: Patrice Chotard 
> ---
>  doc/device-tree-bindings/reset/st,stm32-rcc.txt |   6 ++
>  drivers/reset/Kconfig   |   7 ++
>  drivers/reset/Makefile  |   1 +
>  drivers/reset/stm32-reset.c |  80 ++
>  include/dt-bindings/mfd/stm32h7-rcc.h   | 138 
> 
>  5 files changed, 232 insertions(+)
>  create mode 100644 doc/device-tree-bindings/reset/st,stm32-rcc.txt
>  create mode 100644 drivers/reset/stm32-reset.c
>  create mode 100644 include/dt-bindings/mfd/stm32h7-rcc.h

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


Re: [U-Boot] [PATCH v2 3/9] dm: clk: add clk driver support for stm32h7 SoCs

2017-09-17 Thread Simon Glass
On 13 September 2017 at 10:00,   wrote:
> From: Patrice Chotard 
>
> This driver implements basic clock setup, only clock gating
> is implemented.
>
> This driver doesn't implement .of_match as it's binded
> by MFD RCC driver.
>
> Files include/dt-bindings/clock/stm32h7-clks.h and
> doc/device-tree-bindings/clock/st,stm32h7-rcc.txt
> will be available soon in a kernel tag, as all the
> bindings have been acked by Rob Herring [1].
>
> [1] http://lkml.iu.edu/hypermail/linux/kernel/1704.0/00935.html
>
> Signed-off-by: Patrice Chotard 
> ---
>  doc/device-tree-bindings/clock/st,stm32h7-rcc.txt | 152 
>  drivers/clk/Makefile  |   1 +
>  drivers/clk/clk_stm32h7.c | 802 
> ++
>  include/dt-bindings/clock/stm32h7-clks.h  | 167 +
>  4 files changed, 1122 insertions(+)
>  create mode 100644 doc/device-tree-bindings/clock/st,stm32h7-rcc.txt
>  create mode 100644 drivers/clk/clk_stm32h7.c
>  create mode 100644 include/dt-bindings/clock/stm32h7-clks.h

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


Re: [U-Boot] [PATCH v2 2/9] serial: stm32x7: add STM32H7 support

2017-09-17 Thread Simon Glass
On 13 September 2017 at 10:00,   wrote:
> From: Patrice Chotard 
>
> STM32F7 and STM32H7 shares the same UART block, add
> STM32H7 compatible string.
>
> Signed-off-by: Patrice Chotard 
> ---
>  drivers/serial/Kconfig  | 7 ---
>  drivers/serial/serial_stm32x7.c | 2 ++
>  2 files changed, 6 insertions(+), 3 deletions(-)

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


Re: [U-Boot] [PATCH v2 1/9] pinctrl: stm32: add stm32h743-pinctrl compatible

2017-09-17 Thread Simon Glass
On 13 September 2017 at 10:00,   wrote:
> From: Patrice Chotard 
>
> STM32H7 SoCs uses the same pinctrl block as found into
> STM32F7 SoCs
>
> Signed-off-by: Patrice Chotard 
> ---
>  drivers/pinctrl/pinctrl_stm32.c | 1 +
>  1 file changed, 1 insertion(+)

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


Re: [U-Boot] [PATCH] spl: stash bootstage info before jump to next stage

2017-09-17 Thread Simon Glass
On 13 September 2017 at 09:58, Tom Rini  wrote:
> On Wed, Sep 13, 2017 at 06:24:24PM +0800, Kever Yang wrote:
>> Since we may jump to next stage like ATF/OP-TEE instead of U-Boot,
>> we need to stash the bootstage info before it.
>>
>> Signed-off-by: Kever Yang 
>> ---
>>
>>  common/spl/spl.c | 18 +-
>>  1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>> index 85e2e88..d156e74 100644
>> --- a/common/spl/spl.c
>> +++ b/common/spl/spl.c
>> @@ -424,6 +424,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>   debug("SPL malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
>> gd->malloc_ptr / 1024);
>>  #endif
>> +#ifdef CONFIG_BOOTSTAGE_STASH
>> + int ret;
>> +
>> + bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
>> + ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
>> +   CONFIG_BOOTSTAGE_STASH_SIZE);
>> + if (ret)
>> + debug("Failed to stash bootstage: err=%d\n", ret);
>> +#endif
>>
>>   if (CONFIG_IS_ENABLED(ATF_SUPPORT)) {
>>   debug("loaded - jumping to U-Boot via ATF BL31.\n");
>> @@ -436,15 +445,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>   }
>>
>>   debug("loaded - jumping to U-Boot...\n");
>> -#ifdef CONFIG_BOOTSTAGE_STASH
>> - int ret;
>> -
>> - bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
>> - ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
>> -   CONFIG_BOOTSTAGE_STASH_SIZE);
>> - if (ret)
>> - debug("Failed to stash bootstage: err=%d\n", ret);
>> -#endif
>>   spl_board_prepare_for_boot();
>>   jump_to_image_no_args(_image);
>>  }
>
> Simon, does this seem right to you?  Thanks!

Yes. I think the commit message would be better if it mentioned that
the code is moved, not added. Really, it is the
CONFIG_IS_ENABLED(ATF_SUPPORT) that is being moved I think.

Reviewed-by: Simon Glass 

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


Re: [U-Boot] [PATCH 2/6] treewide: replace with error() with pr_err()

2017-09-17 Thread Simon Glass
On 13 September 2017 at 05:45, Masahiro Yamada
 wrote:
> U-Boot widely uses error() as a bit noisier variant of printf().
>
> This macro causes name conflict with the following line in
> include/linux/compiler-gcc.h:
>
>   # define __compiletime_error(message) __attribute__((error(message)))
>
> This prevents us from using __compiletime_error(), and makes it
> difficult to fully sync BUILD_BUG stuff with Linux.  (Notice
> Linux's BUILD_BUG_ON_MSG is defined by using compiletime_assert().)
>
> Let's convert error() into now treewide-available pr_err().
>
> Done with the help of Coccinelle, excluing tools/ directory.
>
> The semantic patch I used is as follows:
>
> // 
> 
> -error
> +pr_err
>  (...)
> // 
>
> Signed-off-by: Masahiro Yamada 
> ---
>
>  arch/arm/mach-omap2/am33xx/board.c|  2 +-
>  arch/arm/mach-omap2/utils.c   |  4 +-
>  arch/arm/mach-rockchip/rk3188-board-spl.c |  2 +-
>  arch/arm/mach-rockchip/rk3188-board.c |  2 +-
>  arch/arm/mach-rockchip/rk3368-board-spl.c |  4 +-
>  arch/arm/mach-rockchip/rk3399/sdram_rk3399.c  |  2 +-
>  arch/arm/mach-socfpga/reset_manager_arria10.c |  2 +-
>  arch/arm/mach-tegra/ivc.c |  8 +--
>  arch/arm/mach-tegra/tegra124/xusb-padctl.c|  2 +-
>  arch/arm/mach-tegra/tegra186/nvtboot_mem.c|  4 +-
>  arch/arm/mach-tegra/tegra20/clock.c   |  6 +-
>  arch/arm/mach-tegra/tegra210/xusb-padctl.c|  2 +-
>  arch/arm/mach-tegra/tegra30/clock.c   |  6 +-
>  arch/arm/mach-tegra/xusb-padctl-common.c  | 22 +++
>  arch/x86/cpu/tangier/sdram.c  |  6 +-
>  board/nvidia/jetson-tk1/jetson-tk1.c  |  6 +-
>  board/samsung/common/exynos5-dt.c |  2 +-
>  board/samsung/common/misc.c   |  2 +-
>  board/samsung/goni/goni.c |  4 +-
>  board/samsung/odroid/odroid.c | 12 ++--
>  cmd/fastboot.c|  2 +-
>  cmd/nvedit.c  |  6 +-
>  cmd/regulator.c   |  2 +-
>  cmd/thordown.c|  6 +-
>  cmd/tpm_test.c|  6 +-
>  cmd/usb_gadget_sdp.c  |  4 +-
>  cmd/usb_mass_storage.c|  6 +-
>  common/dfu.c  |  6 +-
>  common/fb_mmc.c   | 36 +--
>  common/fb_nand.c  | 12 ++--
>  common/spl/spl_dfu.c  |  4 +-
>  common/spl/spl_sdp.c  |  4 +-
>  common/update.c   |  2 +-
>  disk/part_efi.c   | 10 +--
>  drivers/adc/adc-uclass.c  |  6 +-
>  drivers/adc/exynos-adc.c  |  6 +-
>  drivers/adc/sandbox.c |  6 +-
>  drivers/ata/dwc_ahci.c|  6 +-
>  drivers/clk/clk_boston.c  |  4 +-
>  drivers/clk/clk_stm32f7.c |  2 +-
>  drivers/clk/rockchip/clk_rk3368.c |  8 +--
>  drivers/clk/rockchip/clk_rk3399.c |  6 +-
>  drivers/clk/rockchip/clk_rv1108.c |  2 +-
>  drivers/dfu/dfu.c | 14 ++--
>  drivers/dfu/dfu_mmc.c | 18 +++---
>  drivers/dfu/dfu_ram.c |  8 +--
>  drivers/dfu/dfu_tftp.c|  4 +-
>  drivers/dma/dma-uclass.c  |  2 +-
>  drivers/dma/lpc32xx_dma.c |  8 +--
>  drivers/dma/ti-edma3.c|  2 +-
>  drivers/i2c/i2c-gpio.c|  2 +-
>  drivers/i2c/omap24xx_i2c.c|  2 +-
>  drivers/i2c/stm32f7_i2c.c | 16 ++---
>  drivers/i2c/tegra_i2c.c   |  4 +-
>  drivers/misc/tegra186_bpmp.c  | 28 
>  drivers/mmc/exynos_dw_mmc.c   |  2 +-
>  drivers/mmc/hi6220_dw_mmc.c   |  2 +-
>  drivers/mmc/xenon_sdhci.c |  4 +-
>  drivers/mtd/nand/lpc32xx_nand_mlc.c   |  6 +-
>  drivers/mtd/nand/pxa3xx_nand.c|  2 +-
>  drivers/net/bcm-sf2-eth-gmac.c| 14 ++--
>  drivers/net/bcm-sf2-eth.c | 18 +++---
>  drivers/net/cpsw-common.c |  8 +--
>  drivers/net/cpsw.c|  8 +--
>  drivers/net/dwc_eth_qos.c | 92 
> +--
>  drivers/net/ep93xx_eth.c  | 16 ++---
>  drivers/net/keystone_net.c| 14 ++--
>  drivers/pci/pci_tegra.c   | 50 +++
>  drivers/pci/pcie_xilinx.c |  2 +-
>  drivers/phy/marvell/comphy_cp110.c| 40 ++--
>  drivers/phy/ti-pipe3-phy.c| 12 ++--
>  

Re: [U-Boot] [U-Boot,2/5] power: pmic: rk816: support rk816 pmic

2017-09-17 Thread Simon Glass
Hi,

On 13 September 2017 at 14:22, Philipp Tomsich
 wrote:
>
>
> On Wed, 13 Sep 2017, Kever Yang wrote:
>
>> From: Elaine Zhang 
>>
>> Add Rockchip pmic rk816 support.
>
>
> Could you summarise some of the key-features of the RK816 here? Just a few
> words, so we know how it's different from the others and what it's used for
> (e.g. "PMIC matching the RK3xxx").
>
>
>>
>> Signed-off-by: Elaine Zhang 
>> Signed-off-by: Kever Yang 
>> ---
>>
>> drivers/power/pmic/rk8xx.c  |   1 +
>> drivers/power/regulator/rk8xx.c | 212
>> 
>> include/power/rk8xx_pmic.h  |   9 +-
>> 3 files changed, 182 insertions(+), 40 deletions(-)
>>
>> diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c
>> index eb3ec0f..0fdea95 100644
>> --- a/drivers/power/pmic/rk8xx.c
>> +++ b/drivers/power/pmic/rk8xx.c
>> @@ -100,6 +100,7 @@ static struct dm_pmic_ops rk8xx_ops = {
>>
>> static const struct udevice_id rk8xx_ids[] = {
>> { .compatible = "rockchip,rk808" },
>> +   { .compatible = "rockchip,rk816" },
>> { .compatible = "rockchip,rk818" },
>> { }
>> };
>> diff --git a/drivers/power/regulator/rk8xx.c
>> b/drivers/power/regulator/rk8xx.c
>> index 76fc2ef..cf3566e 100644
>> --- a/drivers/power/regulator/rk8xx.c
>> +++ b/drivers/power/regulator/rk8xx.c
>> @@ -48,6 +48,21 @@ static const struct rk8xx_reg_info rk808_buck[] = {
>> { 180, 10, REG_BUCK4_ON_VSEL, RK808_BUCK4_VSEL_MASK, },
>> };
>>
>> +static const struct rk8xx_reg_info rk816_buck[] = {
>> +   /* buck 1 */
>> +   { 712500, 12500, REG_BUCK1_ON_VSEL, RK818_BUCK_VSEL_MASK, },
>> +   { 180, 20, REG_BUCK1_ON_VSEL, RK818_BUCK_VSEL_MASK, },
>> +   { 230, 0, REG_BUCK1_ON_VSEL, RK818_BUCK_VSEL_MASK, },
>> +   /* buck 2 */
>> +   { 712500, 12500, REG_BUCK2_ON_VSEL, RK818_BUCK_VSEL_MASK, },
>> +   { 180, 20, REG_BUCK2_ON_VSEL, RK818_BUCK_VSEL_MASK, },
>> +   { 230, 0, REG_BUCK2_ON_VSEL, RK818_BUCK_VSEL_MASK, },
>> +   /* buck 3 */
>> +   { 712500, 12500, -1, RK818_BUCK_VSEL_MASK, },
>> +   /* buck 4 */
>> +   { 80, 10, REG_BUCK4_ON_VSEL, RK818_BUCK4_VSEL_MASK, },
>> +};
>> +
>> static const struct rk8xx_reg_info rk818_buck[] = {
>> { 712500, 12500, REG_BUCK1_ON_VSEL, RK818_BUCK_VSEL_MASK, },
>> { 712500, 12500, REG_BUCK2_ON_VSEL, RK818_BUCK_VSEL_MASK, },
>> @@ -67,6 +82,15 @@ static const struct rk8xx_reg_info rk808_ldo[] = {
>> { 180, 10, REG_LDO8_ON_VSEL, RK808_LDO_VSEL_MASK, },
>> };
>>
>> +static const struct rk8xx_reg_info rk816_ldo[] = {
>> +   { 80, 10, REG_LDO1_ON_VSEL, RK818_LDO_VSEL_MASK, },
>> +   { 80, 10, REG_LDO2_ON_VSEL, RK818_LDO_VSEL_MASK, },
>> +   { 80, 10, REG_LDO3_ON_VSEL, RK818_LDO_VSEL_MASK, },
>> +   { 80, 10, REG_LDO4_ON_VSEL, RK818_LDO_VSEL_MASK, },
>> +   { 80, 10, REG_LDO5_ON_VSEL, RK818_LDO_VSEL_MASK, },
>> +   { 80, 10, REG_LDO6_ON_VSEL, RK818_LDO_VSEL_MASK, },
>> +};
>> +
>> static const struct rk8xx_reg_info rk818_ldo[] = {
>> { 180, 10, REG_LDO1_ON_VSEL, RK818_LDO_VSEL_MASK, },
>> { 180, 10, REG_LDO2_ON_VSEL, RK818_LDO_VSEL_MASK, },
>> @@ -88,10 +112,24 @@ static const uint rk818_chrg_shutdown_vsel_array[] =
>> {
>> };
>>
>> static const struct rk8xx_reg_info *get_buck_reg(struct udevice *pmic,
>> -int num)
>> +int num, int uvolt)
>> {
>> struct rk8xx_priv *priv = dev_get_priv(pmic);
>> +
>> switch (priv->variant) {
>> +   case RK816_ID:
>> +   switch (num) {
>> +   case 0:
>> +   case 1:
>> +   if (uvolt <= 145)
>> +   return _buck[num * 3 + 0];
>> +   else if (uvolt <= 220)
>> +   return _buck[num * 3 + 1];
>> +   else
>> +   return _buck[num * 3 + 2];
>> +   default:
>> +   return _buck[num + 4];
>> +   }
>
>
> I am very concerned with this driver turning into a large switch statement:
> this really is not the way driver_data is supposed to be used.
>
> Can we have a single path through this function and use driver_data to
> parameterize the cut-offs? As an alternative, we'll need to start splitting
> this into separate drivers.

Yes it is worth considering that. I don't see a good reason to have
this new device in the same driver, given all the changes.

If there is shared code it could be split out into a new file.

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


Re: [U-Boot] [PATCH 09/10] power: spl: add SPL_DM_REGULATOR_FIXED in Kconfig

2017-09-17 Thread Simon Glass
On 13 September 2017 at 02:20, Dr. Philipp Tomsich
 wrote:
>
>> On 13 Sep 2017, at 06:26, Simon Glass  wrote:
>>
>> On 11 September 2017 at 05:59, Philipp Tomsich
>>  wrote:
>>> The Makefile already tests for SPL_DM_REGULATOR_FIXED, but Kconfig
>>> does not provide it.  This adds SPL_DM_REGULATOR_FIXED to Kconfig.
>>>
>>> Signed-off-by: Philipp Tomsich 
>>> ---
>>>
>>> drivers/power/regulator/Kconfig | 7 +++
>>> 1 file changed, 7 insertions(+)
>>>
>>
>> Reviewed-by: Simon Glass 
>>
>> Should that default to y?
>
> I am undecided, as pretty much any default will be wrong for most people.
> Fortunately it can be easily changed via defconfig or from implying it from
> one of the other Kconfig sections.
>
> My reasoning behind not making it the default was that a large number of
> boards will have DM_REGULATOR_FIXED enabled (e.g. for enabling some
> of the USB path), but many of the boards will not need it at the SPL stage.
> If we’d make this the default, we might see increases in size (and some SPL
> stages exceeding their size limit) from this change.
>
> I’d more more than happy to make it the default, though.

Seems fine, I understand.

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


  1   2   >