[U-Boot] [PATCH 1/1] efi_loader: signature of ExitBootServices()

2019-05-05 Thread Heinrich Schuchardt
Consistently use efi_uintn_t as type of memory keys.

Signed-off-by: Heinrich Schuchardt 
---
 include/efi_api.h | 3 ++-
 lib/efi_loader/efi_boottime.c | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index b2ae279747..755c405793 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -128,7 +128,8 @@ struct efi_boot_services {
efi_status_t exit_status,
efi_uintn_t exitdata_size, u16 *exitdata);
efi_status_t (EFIAPI *unload_image)(efi_handle_t image_handle);
-   efi_status_t (EFIAPI *exit_boot_services)(efi_handle_t, unsigned long);
+   efi_status_t (EFIAPI *exit_boot_services)(efi_handle_t image_handle,
+ efi_uintn_t map_key);

efi_status_t (EFIAPI *get_next_monotonic_count)(u64 *count);
efi_status_t (EFIAPI *stall)(unsigned long usecs);
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index f75e6c0169..3989b67614 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1839,11 +1839,11 @@ static void efi_exit_caches(void)
  * Return: status code
  */
 static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle,
- unsigned long map_key)
+ efi_uintn_t map_key)
 {
struct efi_event *evt;

-   EFI_ENTRY("%p, %ld", image_handle, map_key);
+   EFI_ENTRY("%p, %zx", image_handle, map_key);

/* Check that the caller has read the current memory map */
if (map_key != efi_memory_map_key)
--
2.20.1

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


[U-Boot] [PATCH v2 1/1] efi_loader: LoadImage() parameter checks

2019-05-05 Thread Heinrich Schuchardt
If the file path is NULL, return EFI_INVALID_PARAMETER.
If the file path is invalid, return EFI_NOT_FOUND.
If the size of the source buffer is 0, return EFI_LOAD_ERROR.
If the parent image handle does not refer to a loaded image return
EFI_INVALID_PARAMETER.

The change is required to reach UEFI SCT conformance.

Signed-off-by: Heinrich Schuchardt 
---
v2
efi_load_image_from_path() must initalize *buffer even in case of
an error
---
 include/efi_loader.h   |  1 +
 lib/efi_loader/efi_boottime.c  | 17 
 lib/efi_loader/efi_root_node.c | 48 ++
 3 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index d3a1d4c465..07ef14ba1c 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -187,6 +187,7 @@ struct efi_handler {
  */
 enum efi_object_type {
EFI_OBJECT_TYPE_UNDEFINED = 0,
+   EFI_OBJECT_TYPE_U_BOOT_FIRMWARE,
EFI_OBJECT_TYPE_LOADED_IMAGE,
EFI_OBJECT_TYPE_STARTED_IMAGE,
 };
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 78a4063949..f75e6c0169 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1680,10 +1680,13 @@ efi_status_t efi_load_image_from_path(struct 
efi_device_path *file_path,
*buffer = NULL;
*size = 0;

+   if (!file_path)
+   return EFI_INVALID_PARAMETER;
+
/* Open file */
f = efi_file_from_path(file_path);
if (!f)
-   return EFI_DEVICE_ERROR;
+   return EFI_NOT_FOUND;

/* Get file size */
bs = 0;
@@ -1760,13 +1763,13 @@ efi_status_t EFIAPI efi_load_image(bool boot_policy,
EFI_ENTRY("%d, %p, %pD, %p, %zd, %p", boot_policy, parent_image,
  file_path, source_buffer, source_size, image_handle);

-   if (!image_handle || !parent_image) {
+   if (!image_handle || !efi_search_obj(parent_image)) {
ret = EFI_INVALID_PARAMETER;
goto error;
}
-
-   if (!source_buffer && !file_path) {
-   ret = EFI_NOT_FOUND;
+   /* The parent image handle must refer to a loaded image */
+   if (!parent_image->type) {
+   ret = EFI_INVALID_PARAMETER;
goto error;
}

@@ -1776,6 +1779,10 @@ efi_status_t EFIAPI efi_load_image(bool boot_policy,
if (ret != EFI_SUCCESS)
goto error;
} else {
+   if (!source_size) {
+   ret = EFI_LOAD_ERROR;
+   goto error;
+   }
dest_buffer = source_buffer;
}
/* split file_path which contains both the device and file parts */
diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c
index e0fcbb85a4..38514e0820 100644
--- a/lib/efi_loader/efi_root_node.c
+++ b/lib/efi_loader/efi_root_node.c
@@ -28,6 +28,7 @@ struct efi_root_dp {
  */
 efi_status_t efi_root_node_register(void)
 {
+   efi_status_t ret;
struct efi_root_dp *dp;

/* Create device path protocol */
@@ -47,28 +48,31 @@ efi_status_t efi_root_node_register(void)
dp->end.length = sizeof(struct efi_device_path);

/* Create root node and install protocols */
-   return EFI_CALL(efi_install_multiple_protocol_interfaces(_root,
-  /* Device path protocol */
-  _guid_device_path, dp,
-  /* Device path to text protocol */
-  _guid_device_path_to_text_protocol,
-  (void *)_device_path_to_text,
-  /* Device path utilities protocol */
-  _guid_device_path_utilities_protocol,
-  (void *)_device_path_utilities,
-  /* Unicode collation protocol */
-  _guid_unicode_collation_protocol,
-  (void *)_unicode_collation_protocol,
+   ret = EFI_CALL(efi_install_multiple_protocol_interfaces
+   (_root,
+/* Device path protocol */
+_guid_device_path, dp,
+/* Device path to text protocol */
+_guid_device_path_to_text_protocol,
+(void *)_device_path_to_text,
+/* Device path utilities protocol */
+_guid_device_path_utilities_protocol,
+(void *)_device_path_utilities,
+/* Unicode collation protocol */
+_guid_unicode_collation_protocol,
+(void *)_unicode_collation_protocol,
 #if CONFIG_IS_ENABLED(EFI_LOADER_HII)
-  /* HII string protocol */
-  _guid_hii_string_protocol,
-  (void *)_hii_string,
-  /* HII database protocol */
-  

Re: [U-Boot] [PATCH v12 4/9] ARM: socfpga: Moving the watchdog reset to the for-loop status polling

2019-05-05 Thread Chee, Tien Fong
On Sat, 2019-04-27 at 21:34 +0200, Simon Goldschmidt wrote:
> 
> On 19.03.19 09:50, tien.fong.c...@intel.com wrote:
> > 
> > From: Tien Fong Chee 
> > 
> > Ensure the watchdog is reset timely on each status polling.
> I would have expected a longer commit message here explaining why
> this 
> is done, and from where, where to, and why the watchdog reset has
> been 
> moved.
> 
> Anyway, I don't want to hold back this series again for this, but
> please 
> next time: write longer commit messages. Better write too much than
> risk 
> someone in the future doesn't get what or why you did things.
> 
> Thanks,
> Simon
> 
I will improve the commit messages in next version patch set.

Thanks.
> > 
> > 
> > Signed-off-by: Tien Fong Chee 
> > 
> > ---
> > 
> > changes for v12
> > - Improved the commit messages.
> > 
> > changes for v11
> > - No changes.
> > 
> > changes for v10
> > - This patch was split out from [PATCH v10 5/9]
> >    ARM: socfpga: Add FPGA drivers for Arria 10 FPGA.
> > ---
> >   drivers/fpga/socfpga_arria10.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/fpga/socfpga_arria10.c
> > b/drivers/fpga/socfpga_arria10.c
> > index b0abe1955c..9499d1a014 100644
> > --- a/drivers/fpga/socfpga_arria10.c
> > +++ b/drivers/fpga/socfpga_arria10.c
> > @@ -360,6 +360,7 @@ static int fpgamgr_program_poll_cd(void)
> >     printf("nstatus == 0 while waiting for
> > condone\n");
> >     return -EPERM;
> >     }
> > +   WATCHDOG_RESET();
> >     }
> >   
> >     if (i == FPGA_TIMEOUT_CNT)
> > @@ -433,7 +434,6 @@ int fpgamgr_program_finish(void)
> >     printf("FPGA: Poll CD failed with error code
> > %d\n", status);
> >     return -EPERM;
> >     }
> > -   WATCHDOG_RESET();
> >   
> >     /* Ensure the FPGA entering user mode */
> >     status = fpgamgr_program_poll_usermode();
> > 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v12 5/9] ARM: socfpga: Add FPGA drivers for Arria 10 FPGA bitstream loading

2019-05-05 Thread Chee, Tien Fong
On Fri, 2019-05-03 at 13:26 +0200, Simon Goldschmidt wrote:
> On Thu, May 2, 2019 at 9:49 AM Chee, Tien Fong  com> wrote:
> > 
> > 
> > On Tue, 2019-04-30 at 14:24 +0200, Simon Goldschmidt wrote:
> > > 
> > > On Tue, Apr 30, 2019 at 2:09 PM Chee, Tien Fong
> > >  wrote:
> > > > 
> > > > 
> > > > 
> > > > On Sat, 2019-04-27 at 21:57 +0200, Simon Goldschmidt wrote:
> > > > > 
> > > > > 
> > > > > 
> > > > > On 19.03.19 09:50, tien.fong.c...@intel.com wrote:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > From: Tien Fong Chee 
> > > > > > 
> > > > > > Add FPGA driver to support program FPGA with FPGA bitstream
> > > > > > loading
> > > > > > from
> > > > > > filesystem. The driver are designed based on generic
> > > > > > firmware
> > > > > > loader
> > > > > > framework. The driver can handle FPGA program operation
> > > > > > from
> > > > > > loading FPGA
> > > > > > bitstream in flash to memory and then to program FPGA.
> > > > > > 
> > > > > > Signed-off-by: Tien Fong Chee 
> > > > > > 
> > > > > > ---
> > > > > > 
> > > > > > changes for v12
> > > > > > - No changes.
> > > > > > 
> > > > > > changes for v11
> > > > > > - No changes.
> > > > > > 
> > > > > > changes for v10
> > > > > > -Cleaned up the codes.
> > > > > > -Return -EPERM when programing core on non early IO release
> > > > > > mode. >
> > > > > > -Using live function to get rid of gd->
> > > > > You got rid of gd-> in v10? How come I see numerous
> > > > > references to
> > > > > it
> > > > > below?
> > > > get rid of using gd->fdt_blob for finding the node_offset.
> > > > Details in https://patchwork.ozlabs.org/patch/1044415/
> > > Ah, ok. But still, here you're introducing yet more references to
> > > gd-
> > > > 
> > > > fdt_blob.
> > > That wouldn't work with a live tree, either, or would it?
> > Yeah, few direct call to config_pin function are still using gd-
> > fdt_blob as argument. But, i'm not sure i should fix this function
> > in
> > this series patch set, or separately patch after this series patch
> > set?
> > 
> > What do you think?
> While I do have a strong opinion that this should be cleaned up,
> it would be kind of off-topic in this patch. I was just confused by
> the
> version log.
> 
> Regards,
> Simon
Okay, how about we keep these changes. I will send out the fix
separately after this patch set.

Thanks.
> 
> > 
> > 
> > Thanks,
> > TF
> > > 
> > > 
> > > > 
> > > > 
> > > > 
> > > > -/*
> > > > - * FPGA Manager to program the FPGA. This is the interface
> > > > used by
> > > > FPGA driver.
> > > > - * Return 0 for sucess, non-zero for error.
> > > > - */
> > > > +ofnode get_fpga_mgr_ofnode(void)
> > > > +{
> > > > +   int node_offset;
> > > > +
> > > > +   fdtdec_find_aliases_for_id(gd->fdt_blob, "fpga_mgr",
> > > > 
> > > > nit: using of live functions would be better to get rid of gd-
> > > > >.
> > > > 
> > > > +   COMPAT_ALTERA_SOCFPGA_FPGA0,
> > > > +   _offset, 1);
> > > > 
> > > > Thanks.
> > > > > 
> > > > > 
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > -Removed @0 for fs-loader node
> > > > > > 
> > > > > > changes for v9
> > > > > > - Support data offset
> > > > > > - Added default DDR load address
> > > > > > - Squashed the image.h
> > > > > > - Changed to phandle
> > > > > > - Ensure the DDR is fully up running by checking the gd-
> > > > > > >ram
> > > > > > 
> > > > > > changes for v8
> > > > > > - Added codes to discern bitstream type based on fpga node
> > > > > > name.
> > > > > > 
> > > > > > changes for v7
> > > > > > - Restructure the FPGA driver to support both peripheral
> > > > > > bitstream
> > > > > > and core
> > > > > >    bitstream bundled into FIT image.
> > > > > > - Support loadable property for core bitstream. User can
> > > > > > set
> > > > > > loadable
> > > > > >    in DDR for better performance. This loading would be
> > > > > > done in
> > > > > > one
> > > > > > large
> > > > > >    chunk instead of chunk by chunk loading with small
> > > > > > memory
> > > > > > buffer.
> > > > > > ---
> > > > > >   arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts   |  17
> > > > > > +
> > > > > >   .../include/mach/fpga_manager_arria10.h|  39
> > > > > > +-
> > > > > >   drivers/fpga/socfpga_arria10.c | 497
> > > > > > -
> > > > > >   include/image.h|   4
> > > > > > +
> > > > > >   4 files changed, 542 insertions(+), 15 deletions(-)
> > > > > > 
> > > > > > diff --git a/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
> > > > > > b/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
> > > > > > index 998d811210..cc761967c7 100644
> > > > > > --- a/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
> > > > > > +++ b/arch/arm/dts/socfpga_arria10_socdk_sdmmc.dts
> > > > > > @@ -18,6 +18,23 @@
> > > > > >   /dts-v1/;
> > > > > >   #include "socfpga_arria10_socdk.dtsi"
> > > > > > 
> > > > > > +/ {
> > > > > > +   chosen {
> > > > > > +   

Re: [U-Boot] [PATCH v12 9/9] ARM: socfpga: Increase Malloc pool size to support FAT filesystem in SPL

2019-05-05 Thread Chee, Tien Fong
On Fri, 2019-05-03 at 13:54 +0200, Simon Goldschmidt wrote:
> On Thu, May 2, 2019 at 9:56 AM Chee, Tien Fong  com> wrote:
> > 
> > 
> > On Tue, 2019-04-30 at 14:26 +0200, Simon Goldschmidt wrote:
> > > 
> > > On Tue, Apr 30, 2019 at 2:19 PM Chee, Tien Fong
> > >  wrote:
> > > > 
> > > > 
> > > > 
> > > > On Sat, 2019-04-27 at 21:50 +0200, Simon Goldschmidt wrote:
> > > > > 
> > > > > 
> > > > > 
> > > > > On 19.03.19 09:50, tien.fong.c...@intel.com wrote:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > From: Tien Fong Chee 
> > > > > > 
> > > > > > Increasing Malloc pool size up to 0x15000 is required to
> > > > > > support
> > > > > > FAT in SPL
> > > > > > . The result of calculation is come from after applying
> > > > > > some
> > > > > > few
> > > > > > patches
> > > > > "Some few patches"? What should that mean? Either you refer
> > > > > to
> > > > > the
> > > > > current state or you can refer to the patchwork items.
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > which are required for optimizing vfat and maximizing
> > > > > > resusable
> > > > > > of
> > > > > > the
> > > > > > memory pool, and then followed by the size required come
> > > > > > from
> > > > > > default max
> > > > > > cluster(0x1) + others(0x2000) + additional memory for
> > > > > > headroom(0x3000).
> > > > > > Previous records of describing these few patches can be
> > > > > > checked
> > > > > > from here
> > > > > > [v7]: https://www.mail-archive.com/u-boot@lists.denx.de/msg
> > > > > > 3145
> > > > > > 11.h
> > > > > > tml .
> > > > > Why do you refer to mail-archive.com instead of patchwork?
> > > > Contains the cover letter in case reviewer need to know more
> > > > information.
> > > I think you understood that wrong. Why do you reference a 3rd
> > > party
> > > host (mail-archive.com) instead of the official list archive or
> > > patchwork?
> > > 
> > > And please note patchwork keeps the cover letter as well.
> > Okay, i can't find any cover letter from this link https://patchwor
> > k.oz
> > labs.org/project/uboot/list/?series==70549=*=
> > hive
> > =both= . Do you know how to find it?
> - Go to one of the patches of v7, e.g.:
> https://patchwork.ozlabs.org/patch/1034279/
> - click "Related"
> - click the 0/7 link and you'll get the cover letter:
> https://patchwork.ozlabs.org/cover/1034282/
> 
> > 
> > 
> > > 
> > > 
> > > Also note, this is the commit message which will got into the git
> > > lot.
> > > Referencing v7 and older history seems misplaced here. Better
> > > move
> > > it below the '---'.
> > Okay, noted. So, what should i do with this patch now? Should i
> > send
> > next version with new commit message?
> Well, I don't really care about which host you reference, but yes,
> please send a version that doesn't contain such a reference in
> the commit log.
> 
> Other than that, the series is, well, good enough for me to be
> accepted, I guess.
> 
> Regards,
> Simon
> 
Okay, i will send a next version.
> > 
> > 
> > Thanks.
> > TF
> > 
> > > 
> > > 
> > > > 
> > > > 
> > > > 
> > > > Thanks.
> > > > > 
> > > > > 
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > Signed-off-by: Tien Fong Chee 
> > > > > > 
> > > > > > ---
> > > > > > 
> > > > > > changes for v12
> > > > > > - Improved the commit messages.
> > > > > > 
> > > > > > changes for v11
> > > > > > - No changes.
> > > > > > 
> > > > > > changes for v10
> > > > > > - No changes.
> > > > > > 
> > > > > > changes for v9
> > > > > > - No changes.
> > > > > > 
> > > > > > changes for v8
> > > > > > - Moved the FIT related configs to the patch of
> > > > > > configuration
> > > > > > for
> > > > > > FPGA
> > > > > >    SoCFPGA A10 SoCDK.
> > > > > > 
> > > > > > changes for v7
> > > > > > - Keep minimal configs.
> > > > > > ---
> > > > > >   include/configs/socfpga_common.h | 4 ++--
> > > > > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > > 
> > > > > > diff --git a/include/configs/socfpga_common.h
> > > > > > b/include/configs/socfpga_common.h
> > > > > > index 181af9b646..22533036ed 100644
> > > > > > --- a/include/configs/socfpga_common.h
> > > > > > +++ b/include/configs/socfpga_common.h
> > > > > > @@ -1,6 +1,6 @@
> > > > > >   /* SPDX-License-Identifier: GPL-2.0+ */
> > > > > >   /*
> > > > > > - * Copyright (C) 2012 Altera Corporation 
> > > > > > + * Copyright (C) 2012-2019 Altera Corporation  > > > > > com>
> > > > > >    */
> > > > > >   #ifndef __CONFIG_SOCFPGA_COMMON_H__
> > > > > >   #define __CONFIG_SOCFPGA_COMMON_H__
> > > > > > @@ -254,7 +254,7 @@ unsigned int
> > > > > > cm_get_qspi_controller_clk_hz(void);
> > > > > >   #if defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
> > > > > >   /* SPL memory allocation configuration, this is for FAT
> > > > > > implementation */
> > > > > >   #ifndef CONFIG_SYS_SPL_MALLOC_START
> > > > > > -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x0001
> > > > > > +#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00015000
> > > > > >   #define
> > > > > > 

Re: [U-Boot] [PATCH 6/6] ARM: imx: novena: Convert to DM VIDEO

2019-05-05 Thread Vagrant Cascadian
On 2019-05-06, Marek Vasut wrote:
> Enable DM Video support on iMX6Q Novena and fix minor details
> to restore previous behavior of the system.

Also required:

  "[U-Boot] video: ipuv3: Set max display bpp to 32"
  https://patchwork.ozlabs.org/patch/1095618/

Otherwise it would hang after initializing video.

I don't see video output though. Not sure when I last tested video
output from u-boot, though. But at least it boots!

live well,
  vagrant

> Signed-off-by: Marek Vasut 
> Cc: Fabio Estevam 
> Cc: Stefano Babic 
> Cc: Vagrant Cascadian 
> ---
>  configs/novena_defconfig | 6 +++---
>  include/configs/novena.h | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/configs/novena_defconfig b/configs/novena_defconfig
> index c5dbbb0b4d..3ae485245d 100644
> --- a/configs/novena_defconfig
> +++ b/configs/novena_defconfig
> @@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x1780
>  CONFIG_SPL_GPIO_SUPPORT=y
>  CONFIG_SPL_LIBCOMMON_SUPPORT=y
>  CONFIG_SPL_LIBGENERIC_SUPPORT=y
> +CONFIG_SYS_MALLOC_F_LEN=0x2000
>  CONFIG_MX6_DDRCAL=y
>  CONFIG_TARGET_KOSAGI_NOVENA=y
>  CONFIG_SPL_MMC_SUPPORT=y
> @@ -15,7 +16,6 @@ CONFIG_SPL_LIBDISK_SUPPORT=y
>  CONFIG_CMD_HDMIDETECT=y
>  CONFIG_AHCI=y
>  CONFIG_DISTRO_DEFAULTS=y
> -# CONFIG_SYS_MALLOC_F is not set
>  CONFIG_FIT=y
>  CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
>  CONFIG_USE_BOOTARGS=y
> @@ -70,7 +70,7 @@ CONFIG_USB_ETH_CDC=y
>  CONFIG_USB_HOST_ETHER=y
>  CONFIG_USB_ETHER_ASIX=y
>  CONFIG_USB_ETHER_SMSC95XX=y
> +CONFIG_DM_VIDEO=y
> +CONFIG_SYS_WHITE_ON_BLACK=y
>  CONFIG_VIDEO_IPUV3=y
> -CONFIG_VIDEO=y
> -# CONFIG_VIDEO_SW_CURSOR is not set
>  CONFIG_FAT_WRITE=y
> diff --git a/include/configs/novena.h b/include/configs/novena.h
> index bc7383e957..cdc437c492 100644
> --- a/include/configs/novena.h
> +++ b/include/configs/novena.h
> @@ -119,14 +119,12 @@
>  #endif
>  
>  /* Video output */
> -#ifdef CONFIG_VIDEO
>  #define CONFIG_VIDEO_BMP_RLE8
>  #define CONFIG_SPLASH_SCREEN
>  #define CONFIG_BMP_16BPP
>  #define CONFIG_VIDEO_LOGO
>  #define CONFIG_IMX_HDMI
>  #define CONFIG_IMX_VIDEO_SKIP
> -#endif
>  
>  /* Extra U-Boot environment. */
>  #ifndef CONFIG_SPL_BUILD
> @@ -144,6 +142,8 @@
>   "ramdisk_addr_r=0x2800\0"   \
>   "fdt_addr_r=0x1800\0"   \
>   "fdtfile=imx6q-novena.dtb\0"\
> + "stdout=serial,vidconsole\0"\
> + "stderr=serial,vidconsole\0"\
>   "addcons="  \
>   "setenv bootargs ${bootargs} "  \
>   "console=${consdev},${baudrate}\0"  \
> -- 
> 2.20.1


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


Re: [U-Boot] [PATCH 5/6] ARM: imx: novena: Enable DM USB

2019-05-05 Thread Vagrant Cascadian
On 2019-05-06, Marek Vasut wrote:
> Enable DM USB support on iMX6Q Novena.

Hrm. Not working so well:

=> load usb 0:1 $kernel_addr_r misc/Binaries/linux/Image
data abort
pc : []  lr : []
reloc pc : [<17832f0e>]lr : [<17832991>]
sp : faf7d788  ip : 0003 fp : 0005
r10: faf8c258  r9 : faf88ea0 r8 : 0001
r7 : fafa9ba0  r6 : f9f7b040 r5 : faf7d7b0  r4 : 0038
r3 : 006d  r2 : f9f7b0a3 r1 : fafa9c0c  r0 : f9f7b09f
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Code: 4630f801 81f0e8bd e7d84606 bf082b2f (f822235c)
Resetting CPU ...

That said, I haven't tested USB recently; it may be no worse.

live well,
  vagrant

> Signed-off-by: Marek Vasut 
> Cc: Fabio Estevam 
> Cc: Stefano Babic 
> Cc: Vagrant Cascadian 
> ---
>  configs/novena_defconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/configs/novena_defconfig b/configs/novena_defconfig
> index fa5fdea278..c5dbbb0b4d 100644
> --- a/configs/novena_defconfig
> +++ b/configs/novena_defconfig
> @@ -60,6 +60,7 @@ CONFIG_PINCTRL=y
>  CONFIG_PINCTRL_IMX6=y
>  CONFIG_DM_SCSI=y
>  CONFIG_USB=y
> +CONFIG_DM_USB=y
>  CONFIG_USB_KEYBOARD=y
>  CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
>  CONFIG_USB_GADGET=y
> -- 
> 2.20.1


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


Re: [U-Boot] [PATCH 4/6] ARM: imx: novena: Convert block devices to DM

2019-05-05 Thread Vagrant Cascadian
On 2019-05-06, Marek Vasut wrote:
> Enable DM block, DM MMC and DM SATA support on iMX6Q Novena
> convert board code to match the DM support.

Tested booting from MMC and SATA.

SATA performance was *much* faster, too! Thanks!

Tested-by: Vagrant Cascadian 

live well,
  vagrant

> Signed-off-by: Marek Vasut 
> Cc: Fabio Estevam 
> Cc: Stefano Babic 
> Cc: Vagrant Cascadian 
> ---
>  arch/arm/dts/imx6q-novena.dts |   5 ++
>  board/kosagi/novena/novena.c  | 107 +-
>  configs/novena_defconfig  |   3 +
>  include/configs/novena.h  |   5 --
>  4 files changed, 61 insertions(+), 59 deletions(-)
>
> diff --git a/arch/arm/dts/imx6q-novena.dts b/arch/arm/dts/imx6q-novena.dts
> index 61347a545d..35383c9a2b 100644
> --- a/arch/arm/dts/imx6q-novena.dts
> +++ b/arch/arm/dts/imx6q-novena.dts
> @@ -61,6 +61,11 @@
>   reg = <0x1000 0>;
>   };
>  
> + aliases {
> + mmc0 = 
> + mmc1 = 
> + };
> +
>   chosen {
>   stdout-path = 
>   };
> diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
> index 0750c4667e..4b31e2961c 100644
> --- a/board/kosagi/novena/novena.c
> +++ b/board/kosagi/novena/novena.c
> @@ -6,6 +6,9 @@
>   */
>  
>  #include 
> +#include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -20,6 +23,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -101,60 +105,6 @@ int drv_keyboard_init(void)
>  }
>  #endif
>  
> -/*
> - * SDHC
> - */
> -#ifdef CONFIG_FSL_ESDHC
> -static struct fsl_esdhc_cfg usdhc_cfg[] = {
> - { USDHC3_BASE_ADDR, 0, 4 }, /* Micro SD */
> - { USDHC2_BASE_ADDR, 0, 4 }, /* Big SD */
> -};
> -
> -int board_mmc_getcd(struct mmc *mmc)
> -{
> - struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
> -
> - /* There is no CD for a microSD card, assume always present. */
> - if (cfg->esdhc_base == USDHC3_BASE_ADDR)
> - return 1;
> - else
> - return !gpio_get_value(NOVENA_SD_CD);
> -}
> -
> -int board_mmc_getwp(struct mmc *mmc)
> -{
> - struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
> -
> - /* There is no WP for a microSD card, assume always read-write. */
> - if (cfg->esdhc_base == USDHC3_BASE_ADDR)
> - return 0;
> - else
> - return gpio_get_value(NOVENA_SD_WP);
> -}
> -
> -
> -int board_mmc_init(bd_t *bis)
> -{
> - s32 status = 0;
> - int index;
> -
> - usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
> - usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
> -
> - /* Big SD write-protect and card-detect */
> - gpio_direction_input(NOVENA_SD_WP);
> - gpio_direction_input(NOVENA_SD_CD);
> -
> - for (index = 0; index < ARRAY_SIZE(usdhc_cfg); index++) {
> - status = fsl_esdhc_initialize(bis, _cfg[index]);
> - if (status)
> - return status;
> - }
> -
> - return status;
> -}
> -#endif
> -
>  int board_early_init_f(void)
>  {
>  #if defined(CONFIG_VIDEO_IPUV3)
> @@ -270,3 +220,52 @@ int misc_init_r(void)
>  
>   return ret;
>  }
> +
> +#if CONFIG_IS_ENABLED(AHCI)
> +static int sata_imx_probe(struct udevice *dev)
> +{
> + int i, err;
> +
> + for (i = 0; i < 10; i++) {
> + err = setup_sata();
> + if (err) {
> + printf("SATA setup failed: %d\n", err);
> + return err;
> + }
> +
> + udelay(100);
> +
> + err = dwc_ahsata_probe(dev);
> + if (!err)
> + break;
> +
> + /* There is no device on the SATA port */
> + if (sata_dm_port_status(0, 0) == 0)
> + break;
> +
> + /* There's a device, but link not established. Retry */
> + device_remove(dev, DM_REMOVE_NORMAL);
> + }
> +
> + return 0;
> +}
> +
> +struct ahci_ops sata_imx_ops = {
> + .port_status = dwc_ahsata_port_status,
> + .reset  = dwc_ahsata_bus_reset,
> + .scan   = dwc_ahsata_scan,
> +};
> +
> +static const struct udevice_id sata_imx_ids[] = {
> + { .compatible = "fsl,imx6q-ahci" },
> + { }
> +};
> +
> +U_BOOT_DRIVER(sata_imx) = {
> + .name   = "dwc_ahci",
> + .id = UCLASS_AHCI,
> + .of_match   = sata_imx_ids,
> + .ops= _imx_ops,
> + .probe  = sata_imx_probe,
> +};
> +#endif /* AHCI */
> diff --git a/configs/novena_defconfig b/configs/novena_defconfig
> index c74f635121..fa5fdea278 100644
> --- a/configs/novena_defconfig
> +++ b/configs/novena_defconfig
> @@ -13,6 +13,7 @@ CONFIG_SPL=y
>  CONFIG_SPL_FS_FAT=y
>  CONFIG_SPL_LIBDISK_SUPPORT=y
>  CONFIG_CMD_HDMIDETECT=y
> +CONFIG_AHCI=y
>  CONFIG_DISTRO_DEFAULTS=y
>  # CONFIG_SYS_MALLOC_F is not set
>  CONFIG_FIT=y
> @@ -48,6 +49,7 @@ CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_DM=y
>  CONFIG_DWC_AHSATA=y
>  

[U-Boot] [PATCH v3 1/2] rockchip: add common header boot0.h and gpio.h for soc

2019-05-05 Thread Kever Yang
boot0.h and gpio.h will be used by system and include by
'asm/arch/', each of them need of a copy from 'asm/arch-rockchip'.

Signed-off-by: Kever Yang 
Reviewed-by: Tom Rini 
---

 arch/arm/include/asm/arch-rk3036/boot0.h | 11 +++
 arch/arm/include/asm/arch-rk3036/gpio.h  | 11 +++
 arch/arm/include/asm/arch-rk3128/boot0.h | 11 +++
 arch/arm/include/asm/arch-rk3128/gpio.h  | 11 +++
 arch/arm/include/asm/arch-rk3188/boot0.h | 11 +++
 arch/arm/include/asm/arch-rk3188/gpio.h  | 11 +++
 arch/arm/include/asm/arch-rk322x/boot0.h | 11 +++
 arch/arm/include/asm/arch-rk322x/gpio.h  | 11 +++
 arch/arm/include/asm/arch-rk3288/boot0.h | 11 +++
 arch/arm/include/asm/arch-rk3288/gpio.h  | 11 +++
 arch/arm/include/asm/arch-rk3328/boot0.h | 11 +++
 arch/arm/include/asm/arch-rk3328/gpio.h  | 11 +++
 arch/arm/include/asm/arch-rk3368/boot0.h | 11 +++
 arch/arm/include/asm/arch-rk3368/gpio.h  | 11 +++
 arch/arm/include/asm/arch-rk3399/boot0.h | 11 +++
 arch/arm/include/asm/arch-rk3399/gpio.h  | 11 +++
 arch/arm/include/asm/arch-rv1108/boot0.h | 11 +++
 arch/arm/include/asm/arch-rv1108/gpio.h  | 11 +++
 18 files changed, 198 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-rk3036/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3036/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rk3128/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3128/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rk3188/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3188/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rk322x/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk322x/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rk3288/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3288/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rk3328/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3328/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rk3368/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3368/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rk3399/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3399/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rv1108/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rv1108/gpio.h

diff --git a/arch/arm/include/asm/arch-rk3036/boot0.h 
b/arch/arm/include/asm/arch-rk3036/boot0.h
new file mode 100644
index 00..2e78b074ad
--- /dev/null
+++ b/arch/arm/include/asm/arch-rk3036/boot0.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __ASM_ARCH_BOOT0_H__
+#define __ASM_ARCH_BOOT0_H__
+
+#include 
+
+#endif
diff --git a/arch/arm/include/asm/arch-rk3036/gpio.h 
b/arch/arm/include/asm/arch-rk3036/gpio.h
new file mode 100644
index 00..eca79d5159
--- /dev/null
+++ b/arch/arm/include/asm/arch-rk3036/gpio.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __ASM_ARCH_GPIO_H__
+#define __ASM_ARCH_GPIO_H__
+
+#include 
+
+#endif
diff --git a/arch/arm/include/asm/arch-rk3128/boot0.h 
b/arch/arm/include/asm/arch-rk3128/boot0.h
new file mode 100644
index 00..2e78b074ad
--- /dev/null
+++ b/arch/arm/include/asm/arch-rk3128/boot0.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __ASM_ARCH_BOOT0_H__
+#define __ASM_ARCH_BOOT0_H__
+
+#include 
+
+#endif
diff --git a/arch/arm/include/asm/arch-rk3128/gpio.h 
b/arch/arm/include/asm/arch-rk3128/gpio.h
new file mode 100644
index 00..eca79d5159
--- /dev/null
+++ b/arch/arm/include/asm/arch-rk3128/gpio.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __ASM_ARCH_GPIO_H__
+#define __ASM_ARCH_GPIO_H__
+
+#include 
+
+#endif
diff --git a/arch/arm/include/asm/arch-rk3188/boot0.h 
b/arch/arm/include/asm/arch-rk3188/boot0.h
new file mode 100644
index 00..2e78b074ad
--- /dev/null
+++ b/arch/arm/include/asm/arch-rk3188/boot0.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __ASM_ARCH_BOOT0_H__
+#define __ASM_ARCH_BOOT0_H__
+
+#include 
+
+#endif
diff --git a/arch/arm/include/asm/arch-rk3188/gpio.h 
b/arch/arm/include/asm/arch-rk3188/gpio.h
new file mode 100644
index 00..eca79d5159
--- /dev/null
+++ b/arch/arm/include/asm/arch-rk3188/gpio.h
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2019 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __ASM_ARCH_GPIO_H__
+#define __ASM_ARCH_GPIO_H__
+
+#include 
+
+#endif
diff --git a/arch/arm/include/asm/arch-rk322x/boot0.h 
b/arch/arm/include/asm/arch-rk322x/boot0.h
new file mode 100644
index 00..2e78b074ad
--- 

[U-Boot] [PATCH v3 2/2] arm: remove ARCH_ROCKCHIP macro in common code

2019-05-05 Thread Kever Yang
This is fix to:
e2a12f590d rockchip: use 'arch-rockchip' as header file path

The V2 of origin patch set has fix this, but we merge V1 by
mistake, so lets correct it.

Signed-off-by: Kever Yang 
---

 arch/arm/cpu/armv8/start.S | 4 
 arch/arm/lib/vectors.S | 4 
 2 files changed, 8 deletions(-)

diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S
index ecee9e37a5..fe52166e28 100644
--- a/arch/arm/cpu/armv8/start.S
+++ b/arch/arm/cpu/armv8/start.S
@@ -26,11 +26,7 @@ _start:
  * order to boot, allow them to set that in their boot0.h file and then
  * use it here.
  */
-#ifdef CONFIG_ARCH_ROCKCHIP
-#include 
-#else
 #include 
-#endif
 #else
b   reset
 #endif
diff --git a/arch/arm/lib/vectors.S b/arch/arm/lib/vectors.S
index 20f485142e..56f3681558 100644
--- a/arch/arm/lib/vectors.S
+++ b/arch/arm/lib/vectors.S
@@ -67,11 +67,7 @@
  *   (1) defines '_start:' as appropriate
  *   (2) inserts the vector table using ARM_VECTORS as appropriate
  */
-#ifdef CONFIG_ARCH_ROCKCHIP
-#include 
-#else
 #include 
-#endif
 #else
 
 /*
-- 
2.20.1

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


[U-Boot] [PATCH v5 3/3] arm: socfpga: Move Stratix 10 SDRAM driver to DM

2019-05-05 Thread Ley Foon Tan
Convert Stratix 10 SDRAM driver to device model.

Get rid of call to socfpga_per_reset() and use reset
framework.

SPL is changed from calling function in SDRAM driver
directly to just probing UCLASS_RAM.

Move sdram_s10.h from arch to driver/ddr/altera directory.

Signed-off-by: Ley Foon Tan 
---
 arch/arm/mach-socfpga/spl_s10.c   |  16 +-
 configs/socfpga_stratix10_defconfig   |   1 +
 drivers/ddr/altera/Kconfig|   6 +-
 drivers/ddr/altera/sdram_s10.c| 243 --
 .../mach => drivers/ddr/altera}/sdram_s10.h   |   4 -
 include/configs/socfpga_stratix10_socdk.h |   5 -
 scripts/config_whitelist.txt  |   1 -
 7 files changed, 183 insertions(+), 93 deletions(-)
 rename {arch/arm/mach-socfpga/include/mach => drivers/ddr/altera}/sdram_s10.h 
(97%)

diff --git a/arch/arm/mach-socfpga/spl_s10.c b/arch/arm/mach-socfpga/spl_s10.c
index a141ffe82a..ec65e1ce64 100644
--- a/arch/arm/mach-socfpga/spl_s10.c
+++ b/arch/arm/mach-socfpga/spl_s10.c
@@ -15,9 +15,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -175,11 +175,15 @@ void board_init_f(ulong dummy)
clrbits_le32(CCU_REG_ADDR(CCU_IOM_MPRT_ADMASK_MEM_RAM0),
 CCU_ADMASK_P_MASK | CCU_ADMASK_NS_MASK);
 
-   debug("DDR: Initializing Hard Memory Controller\n");
-   if (sdram_mmr_init_full(0)) {
-   puts("DDR: Initialization failed.\n");
-   hang();
-   }
+#if CONFIG_IS_ENABLED(ALTERA_SDRAM)
+   struct udevice *dev;
+
+   ret = uclass_get_device(UCLASS_RAM, 0, );
+   if (ret) {
+   debug("DRAM init failed: %d\n", ret);
+   hang();
+   }
+#endif
 
mbox_init();
 
diff --git a/configs/socfpga_stratix10_defconfig 
b/configs/socfpga_stratix10_defconfig
index 73a1231d46..18cc959450 100644
--- a/configs/socfpga_stratix10_defconfig
+++ b/configs/socfpga_stratix10_defconfig
@@ -31,6 +31,7 @@ CONFIG_DEFAULT_DEVICE_TREE="socfpga_stratix10_socdk"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_SPL_ALTERA_SDRAM=y
 CONFIG_DM_GPIO=y
 CONFIG_DWAPB_GPIO=y
 CONFIG_DM_I2C=y
diff --git a/drivers/ddr/altera/Kconfig b/drivers/ddr/altera/Kconfig
index 83c1ab5e07..2b1c1be3b5 100644
--- a/drivers/ddr/altera/Kconfig
+++ b/drivers/ddr/altera/Kconfig
@@ -1,8 +1,8 @@
 config SPL_ALTERA_SDRAM
bool "SoCFPGA DDR SDRAM driver in SPL"
depends on SPL
-   depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
-   select RAM if TARGET_SOCFPGA_GEN5
-   select SPL_RAM if TARGET_SOCFPGA_GEN5
+   depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10 || 
TARGET_SOCFPGA_STRATIX10
+   select RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10
+   select SPL_RAM if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_STRATIX10
help
  Enable DDR SDRAM controller for the SoCFPGA devices.
diff --git a/drivers/ddr/altera/sdram_s10.c b/drivers/ddr/altera/sdram_s10.c
index e4d4a02ca2..56cbbac9fe 100644
--- a/drivers/ddr/altera/sdram_s10.c
+++ b/drivers/ddr/altera/sdram_s10.c
@@ -5,17 +5,31 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
-#include 
+#include 
+#include 
+#include "sdram_s10.h"
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 
+struct altera_sdram_priv {
+   struct ram_info info;
+   struct reset_ctl_bulk resets;
+};
+
+struct altera_sdram_platdata {
+   void __iomem *hmc;
+   void __iomem *ddr_sch;
+   void __iomem *iomhc;
+};
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static const struct socfpga_system_manager *sysmgr_regs =
@@ -51,25 +65,26 @@ u32 ddr_config[] = {
DDR_CONFIG(1, 4, 10, 17),
 };
 
-static u32 hmc_readl(u32 reg)
+static u32 hmc_readl(struct altera_sdram_platdata *plat, u32 reg)
 {
-   return readl(((void __iomem *)SOCFPGA_HMC_MMR_IO48_ADDRESS + (reg)));
+   return readl(plat->iomhc + reg);
 }
 
-static u32 hmc_ecc_readl(u32 reg)
+static u32 hmc_ecc_readl(struct altera_sdram_platdata *plat, u32 reg)
 {
-   return readl((void __iomem *)SOCFPGA_SDR_ADDRESS + (reg));
+   return readl(plat->hmc + reg);
 }
 
-static u32 hmc_ecc_writel(u32 data, u32 reg)
+static u32 hmc_ecc_writel(struct altera_sdram_platdata *plat,
+ u32 data, u32 reg)
 {
-   return writel(data, (void __iomem *)SOCFPGA_SDR_ADDRESS + (reg));
+   return writel(data, plat->hmc + reg);
 }
 
-static u32 ddr_sch_writel(u32 data, u32 reg)
+static u32 ddr_sch_writel(struct altera_sdram_platdata *plat, u32 data,
+ u32 reg)
 {
-   return writel(data,
- (void __iomem *)SOCFPGA_SDR_SCHEDULER_ADDRESS + (reg));
+   return writel(data, plat->ddr_sch + reg);
 }
 
 int match_ddr_conf(u32 ddr_conf)
@@ -83,37 +98,38 @@ int match_ddr_conf(u32 ddr_conf)
return 0;
 }
 
-static int 

[U-Boot] [PATCH v5 2/3] arm: dts: Stratix10: Add SDRAM node

2019-05-05 Thread Ley Foon Tan
Add SDRAM device tree node.

Signed-off-by: Ley Foon Tan 
---
 arch/arm/dts/socfpga_stratix10.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/dts/socfpga_stratix10.dtsi 
b/arch/arm/dts/socfpga_stratix10.dtsi
index d1ae2fabae..bd68a78a37 100755
--- a/arch/arm/dts/socfpga_stratix10.dtsi
+++ b/arch/arm/dts/socfpga_stratix10.dtsi
@@ -258,6 +258,15 @@
u-boot,dm-pre-reloc;
};
 
+   sdr: sdr@f8000400 {
+compatible = "altr,sdr-ctl-s10";
+reg = <0xf8000400 0x80>,
+  <0xf801 0x190>,
+  <0xf8011000 0x500>;
+resets = < DDRSCH_RESET>;
+u-boot,dm-pre-reloc;
+};
+
spi0: spi@ffda4000 {
compatible = "snps,dw-apb-ssi";
#address-cells = <1>;
-- 
2.19.0

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


[U-Boot] [PATCH v5 1/3] ddr: altera: Compile ALTERA SDRAM in SPL only

2019-05-05 Thread Ley Foon Tan
Compile ALTERA_SDRAM driver in SPL only.
Rename ALTERA_SDRAM to SPL_ALTERA_SDRAM.

Signed-off-by: Ley Foon Tan 
---
 Makefile  | 2 +-
 arch/arm/mach-socfpga/Kconfig | 4 ++--
 drivers/Makefile  | 2 +-
 drivers/ddr/altera/Kconfig| 5 +++--
 drivers/ddr/altera/Makefile   | 2 +-
 include/configs/socfpga_stratix10_socdk.h | 2 +-
 scripts/config_whitelist.txt  | 1 +
 7 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index d6a6ef19ab..5ae5db591f 100644
--- a/Makefile
+++ b/Makefile
@@ -713,7 +713,7 @@ libs-y += drivers/spi/
 libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/
 libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
 libs-$(CONFIG_SYS_FSL_MMDC) += drivers/ddr/fsl/
-libs-$(CONFIG_ALTERA_SDRAM) += drivers/ddr/altera/
+libs-$(CONFIG_$(SPL_)ALTERA_SDRAM) += drivers/ddr/altera/
 libs-y += drivers/serial/
 libs-y += drivers/usb/dwc3/
 libs-y += drivers/usb/common/
diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index 8f7b79f586..ea316d09d7 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -26,7 +26,7 @@ config TARGET_SOCFPGA_ARRIA5
 
 config TARGET_SOCFPGA_ARRIA10
bool
-   select ALTERA_SDRAM
+   select SPL_ALTERA_SDRAM
select SPL_BOARD_INIT if SPL
select CLK
select SPL_CLK if SPL
@@ -47,7 +47,7 @@ config TARGET_SOCFPGA_CYCLONE5
 
 config TARGET_SOCFPGA_GEN5
bool
-   select ALTERA_SDRAM
+   select SPL_ALTERA_SDRAM
imply FPGA_SOCFPGA
imply SPL_STACK_R
imply SPL_SYS_MALLOC_SIMPLE
diff --git a/drivers/Makefile b/drivers/Makefile
index a7bba3ed56..e501ae8d04 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -34,7 +34,7 @@ obj-$(CONFIG_SPL_CRYPTO_SUPPORT) += crypto/
 obj-$(CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT) += ddr/fsl/
 obj-$(CONFIG_ARMADA_38X) += ddr/marvell/a38x/
 obj-$(CONFIG_ARMADA_XP) += ddr/marvell/axp/
-obj-$(CONFIG_ALTERA_SDRAM) += ddr/altera/
+obj-$(CONFIG_$(SPL_)ALTERA_SDRAM) += ddr/altera/
 obj-$(CONFIG_ARCH_IMX8M) += ddr/imx/imx8m/
 obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/
 obj-$(CONFIG_SPL_POWER_SUPPORT) += power/regulator/
diff --git a/drivers/ddr/altera/Kconfig b/drivers/ddr/altera/Kconfig
index 8f60b56eb8..83c1ab5e07 100644
--- a/drivers/ddr/altera/Kconfig
+++ b/drivers/ddr/altera/Kconfig
@@ -1,5 +1,6 @@
-config ALTERA_SDRAM
-   bool "SoCFPGA DDR SDRAM driver"
+config SPL_ALTERA_SDRAM
+   bool "SoCFPGA DDR SDRAM driver in SPL"
+   depends on SPL
depends on TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
select RAM if TARGET_SOCFPGA_GEN5
select SPL_RAM if TARGET_SOCFPGA_GEN5
diff --git a/drivers/ddr/altera/Makefile b/drivers/ddr/altera/Makefile
index 3615b617ec..341ac0d73b 100644
--- a/drivers/ddr/altera/Makefile
+++ b/drivers/ddr/altera/Makefile
@@ -6,7 +6,7 @@
 # (C) Copyright 2010, Thomas Chou 
 # Copyright (C) 2014 Altera Corporation 
 
-ifdef CONFIG_ALTERA_SDRAM
+ifdef CONFIG_$(SPL_)ALTERA_SDRAM
 obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram_gen5.o sequencer.o
 obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += sdram_arria10.o
 obj-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += sdram_s10.o
diff --git a/include/configs/socfpga_stratix10_socdk.h 
b/include/configs/socfpga_stratix10_socdk.h
index 12e77c0a90..b8a86f2cb2 100644
--- a/include/configs/socfpga_stratix10_socdk.h
+++ b/include/configs/socfpga_stratix10_socdk.h
@@ -132,7 +132,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
 /*
  * SDRAM controller
  */
-#define CONFIG_ALTERA_SDRAM
+#define CONFIG_SPL_ALTERA_SDRAM
 
 /*
  * Serial / UART configurations
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index bc86b848a2..4610553815 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1824,6 +1824,7 @@ CONFIG_SPLASH_SCREEN_ALIGN
 CONFIG_SPLASH_SOURCE
 CONFIG_SPLL_FREQ
 CONFIG_SPL_
+CONFIG_SPL_ALTERA_SDRAM
 CONFIG_SPL_ATMEL_SIZE
 CONFIG_SPL_BOARD_LOAD_IMAGE
 CONFIG_SPL_BOOTROM_SAVE
-- 
2.19.0

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


[U-Boot] [PATCH v5 0/3] Move Stratix 10 SDRAM driver to DM

2019-05-05 Thread Ley Foon Tan
Compile ALTERA_SDRAM driver in SPL only and move Stratix 10 SDRAM driver to DM.

v4->v5:
- Rebase patches to u-boot/master branch.

v3 -> v4:
- Add CONFIG_SPL_ALTERA_SDRAM to config_whitelist.txt in patch [1/3] and remove 
it in patch [3/3]
- Remove _remove().
- Update commit message in patch [2/3]

v2->v3:
---
- Compile ALTERA_SDRAM driver in SPL only
- Separate dts change to new patch
- Change to use #if CONFIG_IS_ENABLED(ALTERA_SDRAM)
- Add _remove()
- Remove #ifdef CONFIG_SPL_BUILD checking in sdram_s10.c

History:

[v1]: https://patchwork.ozlabs.org/patch/1066765/
[v2]: https://patchwork.ozlabs.org/patch/1089957/
[v3]: https://patchwork.ozlabs.org/cover/1093091/
[v4]: https://patchwork.ozlabs.org/cover/1094672/

Ley Foon Tan (3):
  ddr: altera: Compile ALTERA SDRAM in SPL only
  arm: dts: Stratix10: Add SDRAM node
  arm: socfpga: Move Stratix 10 SDRAM driver to DM

 Makefile  |   2 +-
 arch/arm/dts/socfpga_stratix10.dtsi   |   9 +
 arch/arm/mach-socfpga/Kconfig |   4 +-
 arch/arm/mach-socfpga/spl_s10.c   |  16 +-
 configs/socfpga_stratix10_defconfig   |   1 +
 drivers/Makefile  |   2 +-
 drivers/ddr/altera/Kconfig|  11 +-
 drivers/ddr/altera/Makefile   |   2 +-
 drivers/ddr/altera/sdram_s10.c| 243 --
 .../mach => drivers/ddr/altera}/sdram_s10.h   |   4 -
 include/configs/socfpga_stratix10_socdk.h |   5 -
 11 files changed, 200 insertions(+), 99 deletions(-)
 rename {arch/arm/mach-socfpga/include/mach => drivers/ddr/altera}/sdram_s10.h 
(97%)

-- 
2.19.0

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


Re: [U-Boot] [PATCH v4 0/3] Move Stratix 10 SDRAM driver to DM

2019-05-05 Thread Ley Foon Tan
On Fri, May 3, 2019 at 11:13 PM Marek Vasut  wrote:
>
> On 5/3/19 8:27 AM, Ley Foon Tan wrote:
> > Compile ALTERA_SDRAM driver in SPL only and move Stratix 10 SDRAM driver to 
> > DM.
> >
> > v3 -> v4:
> > - Add CONFIG_SPL_ALTERA_SDRAM to config_whitelist.txt in patch [1/3] and 
> > remove it in patch [3/3]
> > - Remove _remove().
> > - Update commit message in patch [2/3]
> >
> > v2->v3:
> > ---
> > - Compile ALTERA_SDRAM driver in SPL only
> > - Separate dts change to new patch
> > - Change to use #if CONFIG_IS_ENABLED(ALTERA_SDRAM)
> > - Add _remove()
> > - Remove #ifdef CONFIG_SPL_BUILD checking in sdram_s10.c
> >
> > History:
> > 
> > [v1]: https://patchwork.ozlabs.org/patch/1066765/
> > [v2]: https://patchwork.ozlabs.org/patch/1089957/
> > [v3]: https://patchwork.ozlabs.org/cover/1093091/
> >
> > Ley Foon Tan (3):
> >   ddr: altera: Compile ALTERA SDRAM in SPL only
> >   arm: dts: Stratix10: Add SDRAM node
> >   arm: socfpga: Move Stratix 10 SDRAM driver to DM
> >
> >  Makefile  |   2 +-
> >  arch/arm/dts/socfpga_stratix10.dtsi   |   9 +
> >  arch/arm/mach-socfpga/Kconfig |   4 +-
> >  arch/arm/mach-socfpga/spl_s10.c   |  16 +-
> >  configs/socfpga_stratix10_defconfig   |   1 +
> >  drivers/Makefile  |   2 +-
> >  drivers/ddr/altera/Kconfig|  11 +-
> >  drivers/ddr/altera/Makefile   |   2 +-
> >  drivers/ddr/altera/sdram_s10.c| 243 --
> >  .../mach => drivers/ddr/altera}/sdram_s10.h   |   4 -
> >  include/configs/socfpga_stratix10_socdk.h |   5 -
> >  11 files changed, 200 insertions(+), 99 deletions(-)
> >  rename {arch/arm/mach-socfpga/include/mach => 
> > drivers/ddr/altera}/sdram_s10.h (97%)
> >
> I wanted to pick them, but they don't apply to u-boot/master ?
 I will rebase them to u-boot/master and resend again.

Thanks.

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


Re: [U-Boot] [PATCH] arm: socfpga: control reboot from SRAM via env callback

2019-05-05 Thread Marek Vasut
On 5/5/19 10:21 PM, Simon Goldschmidt wrote:
> Am 05.05.2019 um 22:17 schrieb Marek Vasut:
>> On 5/5/19 8:05 AM, Simon Goldschmidt wrote:
>>>
>>>
>>> On 05.05.19 03:42, Marek Vasut wrote:
 On 5/4/19 9:10 PM, Simon Goldschmidt wrote:
> Am 04.05.2019 um 20:43 schrieb Marek Vasut:
>> On 5/3/19 10:53 PM, Simon Goldschmidt wrote:
>>>
>>>
>>> Marek Vasut mailto:ma...@denx.de>> schrieb am
>>> Fr., 3.
>>> Mai 2019, 22:42:
>>>
>>>    On 5/3/19 10:39 PM, Simon Goldschmidt wrote:
>>>    >
>>>    >
>>>    > On 03.05.19 22:35, Marek Vasut wrote:
>>>    >> On 5/3/19 10:30 PM, Simon Goldschmidt wrote:
>>>    >>>
>>>    >>>
>>>    >>> On 03.05.19 22:28, Marek Vasut wrote:
>>>     On 5/3/19 10:08 PM, Simon Goldschmidt wrote:
>>>    > This moves the code that enables the Boot ROM to
>>> just jump
>>> to SRAM
>>>    > instead
>>>    > of loading SPL from the original boot source on warm
>>> reboot.
>>>    >
>>>    > Instead of always enabling this, an environment
>>> callback
>>> for the
>>>    > env var
>>>    > "socfpga_reboot_from_sram" is used. This way, the
>>> behaviour can be
>>>    > enabled
>>>    > at runtime and via saved environment.
>>>    >
>>>    > Signed-off-by: Simon Goldschmidt
>>>    >>    >
>>>    
>>>     Would that be like a default "reset" command action ?
>>>     This probably shouldn't be socfpga specific then.
>>>    >>>
>>>    >>> No, it's a thing that lives on and influences even the
>>> soft
>>>    reset issued
>>>    >>> by linux "reboot" command. This is something *very*
>>> socfpga
>>>    specific.
>>>    >>
>>>    >> Hmmm, so isn't this a policy to be configured on the Linux
>>> end ?
>>>    >
>>>    > Might be, but it affects U-Boot's 'reset' command as
>>> well. And
>>> I guess
>>>    > it's set up in U-Boot this early to ensure it always works.
>>>
>>>    Drat, that's right. So there has to be some way to agree on
>>> how the
>>>    reset works between the kernel and U-Boot ?
>>>
>>>    > If it were for me, we could drop writing this magic
>>> altogether. I just
>>>    > figured some boards might require it to be written
>>> somewhere,
>>> and came
>>>    > up with a patch that might save those boards with the way
>>> it was
>>>    before.
>>>
>>>    Isn't this magic actually used by bootrom ?
>>>
>>>
>>> Right. It tells the boot rom to jump to ocram on next reboot
>>> instead of
>>> loading spl from qspi or mmc. But if that's required or not a good
>>> idea
>>> at all depends on many factors. Some of them board related, some
>>> U-Boot
>>> related and some Linux related (depending on the hardware and
>>> drivers
>>> used).
>>
>> Should that be runtime configurable then ?
>
> Since it might depend on Linux putting the qspi chip into a state
> where
> it's not accessible by the boot ROM. That might change without
> rebuilding U-Boot.

 If Linux switches the chip into some weird mode the bootrom cannot cope
 with, it's a reset routing problem. This cannot be fixed in software.
>>>
>>> No, it cannot be fixed, but currently there's a workaround for those
>>> boards and I thought it was worth to keep this workaround, even though
>>> my own boards will be fixed and not require such a workaround in the
>>> future :-)
>>
>> What's the workaround ?
> 
> The workaround is what this patch is about: the Boot ROM just branches
> off to SRAM where it expectes SPL to be still working.

But you still cannot communicate with the SPI NOR from your SPL ?

> SPL can then e.g. reset 4-byte mode or whatever to still communicate
> with the device when Boot ROM can't.

Unless, of course, the SPI NOR doesn't interpret the command as data and
corrupts something in the flash itself.

> Of course the downside is that SRAM might be overwritten meanwhile,
> which is why it's a workaround only, not the best idea how to do things...
> 
> Regards,
> Simon


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


[U-Boot] [PATCH 5/6] ARM: imx: novena: Enable DM USB

2019-05-05 Thread Marek Vasut
Enable DM USB support on iMX6Q Novena.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
 configs/novena_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index fa5fdea278..c5dbbb0b4d 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -60,6 +60,7 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
 CONFIG_DM_SCSI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
 CONFIG_USB_GADGET=y
-- 
2.20.1

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


[U-Boot] [PATCH 4/6] ARM: imx: novena: Convert block devices to DM

2019-05-05 Thread Marek Vasut
Enable DM block, DM MMC and DM SATA support on iMX6Q Novena
convert board code to match the DM support.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
 arch/arm/dts/imx6q-novena.dts |   5 ++
 board/kosagi/novena/novena.c  | 107 +-
 configs/novena_defconfig  |   3 +
 include/configs/novena.h  |   5 --
 4 files changed, 61 insertions(+), 59 deletions(-)

diff --git a/arch/arm/dts/imx6q-novena.dts b/arch/arm/dts/imx6q-novena.dts
index 61347a545d..35383c9a2b 100644
--- a/arch/arm/dts/imx6q-novena.dts
+++ b/arch/arm/dts/imx6q-novena.dts
@@ -61,6 +61,11 @@
reg = <0x1000 0>;
};
 
+   aliases {
+   mmc0 = 
+   mmc1 = 
+   };
+
chosen {
stdout-path = 
};
diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index 0750c4667e..4b31e2961c 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -6,6 +6,9 @@
  */
 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -20,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -101,60 +105,6 @@ int drv_keyboard_init(void)
 }
 #endif
 
-/*
- * SDHC
- */
-#ifdef CONFIG_FSL_ESDHC
-static struct fsl_esdhc_cfg usdhc_cfg[] = {
-   { USDHC3_BASE_ADDR, 0, 4 }, /* Micro SD */
-   { USDHC2_BASE_ADDR, 0, 4 }, /* Big SD */
-};
-
-int board_mmc_getcd(struct mmc *mmc)
-{
-   struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-
-   /* There is no CD for a microSD card, assume always present. */
-   if (cfg->esdhc_base == USDHC3_BASE_ADDR)
-   return 1;
-   else
-   return !gpio_get_value(NOVENA_SD_CD);
-}
-
-int board_mmc_getwp(struct mmc *mmc)
-{
-   struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-
-   /* There is no WP for a microSD card, assume always read-write. */
-   if (cfg->esdhc_base == USDHC3_BASE_ADDR)
-   return 0;
-   else
-   return gpio_get_value(NOVENA_SD_WP);
-}
-
-
-int board_mmc_init(bd_t *bis)
-{
-   s32 status = 0;
-   int index;
-
-   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-   usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
-
-   /* Big SD write-protect and card-detect */
-   gpio_direction_input(NOVENA_SD_WP);
-   gpio_direction_input(NOVENA_SD_CD);
-
-   for (index = 0; index < ARRAY_SIZE(usdhc_cfg); index++) {
-   status = fsl_esdhc_initialize(bis, _cfg[index]);
-   if (status)
-   return status;
-   }
-
-   return status;
-}
-#endif
-
 int board_early_init_f(void)
 {
 #if defined(CONFIG_VIDEO_IPUV3)
@@ -270,3 +220,52 @@ int misc_init_r(void)
 
return ret;
 }
+
+#if CONFIG_IS_ENABLED(AHCI)
+static int sata_imx_probe(struct udevice *dev)
+{
+   int i, err;
+
+   for (i = 0; i < 10; i++) {
+   err = setup_sata();
+   if (err) {
+   printf("SATA setup failed: %d\n", err);
+   return err;
+   }
+
+   udelay(100);
+
+   err = dwc_ahsata_probe(dev);
+   if (!err)
+   break;
+
+   /* There is no device on the SATA port */
+   if (sata_dm_port_status(0, 0) == 0)
+   break;
+
+   /* There's a device, but link not established. Retry */
+   device_remove(dev, DM_REMOVE_NORMAL);
+   }
+
+   return 0;
+}
+
+struct ahci_ops sata_imx_ops = {
+   .port_status = dwc_ahsata_port_status,
+   .reset  = dwc_ahsata_bus_reset,
+   .scan   = dwc_ahsata_scan,
+};
+
+static const struct udevice_id sata_imx_ids[] = {
+   { .compatible = "fsl,imx6q-ahci" },
+   { }
+};
+
+U_BOOT_DRIVER(sata_imx) = {
+   .name   = "dwc_ahci",
+   .id = UCLASS_AHCI,
+   .of_match   = sata_imx_ids,
+   .ops= _imx_ops,
+   .probe  = sata_imx_probe,
+};
+#endif /* AHCI */
diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index c74f635121..fa5fdea278 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -13,6 +13,7 @@ CONFIG_SPL=y
 CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_CMD_HDMIDETECT=y
+CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 # CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
@@ -48,6 +49,7 @@ CONFIG_ENV_IS_IN_MMC=y
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
 CONFIG_DM_GPIO=y
+CONFIG_DM_MMC=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
@@ -56,6 +58,7 @@ CONFIG_MII=y
 CONFIG_PCI=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_SCSI=y
 CONFIG_USB=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
diff --git a/include/configs/novena.h b/include/configs/novena.h
index bb5bf808c2..bc7383e957 100644
--- a/include/configs/novena.h

[U-Boot] [PATCH 6/6] ARM: imx: novena: Convert to DM VIDEO

2019-05-05 Thread Marek Vasut
Enable DM Video support on iMX6Q Novena and fix minor details
to restore previous behavior of the system.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
 configs/novena_defconfig | 6 +++---
 include/configs/novena.h | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index c5dbbb0b4d..3ae485245d 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x1780
 CONFIG_SPL_GPIO_SUPPORT=y
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_MX6_DDRCAL=y
 CONFIG_TARGET_KOSAGI_NOVENA=y
 CONFIG_SPL_MMC_SUPPORT=y
@@ -15,7 +16,6 @@ CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_CMD_HDMIDETECT=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
-# CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_USE_BOOTARGS=y
@@ -70,7 +70,7 @@ CONFIG_USB_ETH_CDC=y
 CONFIG_USB_HOST_ETHER=y
 CONFIG_USB_ETHER_ASIX=y
 CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_DM_VIDEO=y
+CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_VIDEO_IPUV3=y
-CONFIG_VIDEO=y
-# CONFIG_VIDEO_SW_CURSOR is not set
 CONFIG_FAT_WRITE=y
diff --git a/include/configs/novena.h b/include/configs/novena.h
index bc7383e957..cdc437c492 100644
--- a/include/configs/novena.h
+++ b/include/configs/novena.h
@@ -119,14 +119,12 @@
 #endif
 
 /* Video output */
-#ifdef CONFIG_VIDEO
 #define CONFIG_VIDEO_BMP_RLE8
 #define CONFIG_SPLASH_SCREEN
 #define CONFIG_BMP_16BPP
 #define CONFIG_VIDEO_LOGO
 #define CONFIG_IMX_HDMI
 #define CONFIG_IMX_VIDEO_SKIP
-#endif
 
 /* Extra U-Boot environment. */
 #ifndef CONFIG_SPL_BUILD
@@ -144,6 +142,8 @@
"ramdisk_addr_r=0x2800\0"   \
"fdt_addr_r=0x1800\0"   \
"fdtfile=imx6q-novena.dtb\0"\
+   "stdout=serial,vidconsole\0"\
+   "stderr=serial,vidconsole\0"\
"addcons="  \
"setenv bootargs ${bootargs} "  \
"console=${consdev},${baudrate}\0"  \
-- 
2.20.1

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


[U-Boot] [PATCH 3/6] ARM: imx: novena: Enable DM GPIO

2019-05-05 Thread Marek Vasut
Enable DM GPIO support on iMX6Q Novena and fix up board code
where applicable.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
 board/kosagi/novena/novena.c | 2 ++
 board/kosagi/novena/video.c  | 3 +++
 configs/novena_defconfig | 1 +
 3 files changed, 6 insertions(+)

diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index 9f2586521d..0750c4667e 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -83,6 +83,8 @@ int drv_keyboard_init(void)
.tstc   = novena_gpio_button_tstc,
};
 
+   gpio_request(NOVENA_BUTTON_GPIO, "button");
+
error = input_init(_input, 0);
if (error) {
debug("%s: Cannot set up input\n", __func__);
diff --git a/board/kosagi/novena/video.c b/board/kosagi/novena/video.c
index f1351b9e28..7083b6e103 100644
--- a/board/kosagi/novena/video.c
+++ b/board/kosagi/novena/video.c
@@ -270,6 +270,7 @@ static void enable_lvds(struct display_info_t const *dev)
return;
 
/* ITE IT6251 power enable. */
+   gpio_request(NOVENA_ITE6251_PWR_GPIO, "ite6251-power");
gpio_direction_output(NOVENA_ITE6251_PWR_GPIO, 0);
mdelay(10);
gpio_direction_output(NOVENA_ITE6251_PWR_GPIO, 1);
@@ -447,6 +448,8 @@ void setup_display_lvds(void)
/* Init the LVDS-to-eDP chip and if it succeeded, enable backlight. */
ret = it6251_init();
if (!ret) {
+   gpio_request(NOVENA_BACKLIGHT_PWR_GPIO, "backlight-power");
+   gpio_request(NOVENA_BACKLIGHT_PWM_GPIO, "backlight-pwm");
/* Backlight power enable. */
gpio_direction_output(NOVENA_BACKLIGHT_PWR_GPIO, 1);
/* PWM backlight pin, always on for full brightness. */
diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index 31a32da0dc..c74f635121 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -47,6 +47,7 @@ CONFIG_DEFAULT_DEVICE_TREE="imx6q-novena"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
+CONFIG_DM_GPIO=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
 CONFIG_PHY_MICREL=y
-- 
2.20.1

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


[U-Boot] [PATCH 1/6] ARM: dts: imx: novena: Import Novena DT from Linux

2019-05-05 Thread Marek Vasut
Import iMX6Q Novena device tree from Linux 5.1-rc7 37624b58542f .
Enable DT control in full U-Boot .

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
 arch/arm/dts/Makefile |   3 +-
 arch/arm/dts/imx6q-novena.dts | 792 ++
 configs/novena_defconfig  |   3 +-
 3 files changed, 796 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/imx6q-novena.dts

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 8e082f2840..9ec2f5e2f2 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -512,7 +512,8 @@ dtb-$(CONFIG_MX53) += imx53-cx9020.dtb \
 dtb-$(CONFIG_MX6Q) += \
imx6-apalis.dtb \
imx6q-display5.dtb \
-   imx6q-logicpd.dtb
+   imx6q-logicpd.dtb \
+   imx6q-novena.dtb
 
 dtb-$(CONFIG_TARGET_TBS2910) += \
imx6q-tbs2910.dtb
diff --git a/arch/arm/dts/imx6q-novena.dts b/arch/arm/dts/imx6q-novena.dts
new file mode 100644
index 00..61347a545d
--- /dev/null
+++ b/arch/arm/dts/imx6q-novena.dts
@@ -0,0 +1,792 @@
+/*
+ * Copyright 2015 Sutajio Ko-Usagi PTE LTD
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this file; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+/dts-v1/;
+#include "imx6q.dtsi"
+#include 
+#include 
+
+/ {
+   model = "Kosagi Novena Dual/Quad";
+   compatible = "kosagi,imx6q-novena", "fsl,imx6q";
+
+   /* Will be filled by the bootloader */
+   memory@1000 {
+   device_type = "memory";
+   reg = <0x1000 0>;
+   };
+
+   chosen {
+   stdout-path = 
+   };
+
+   backlight: backlight {
+   compatible = "pwm-backlight";
+   pwms = < 0 1000>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_backlight_novena>;
+   power-supply = <_lvds_lcd>;
+   brightness-levels = <0 3 6 12 16 24 32 48 64 96 128 192 255>;
+   default-brightness-level = <12>;
+   };
+
+   gpio-keys {
+   compatible = "gpio-keys";
+   pinctrl-names = "default";
+   pinctrl-0 = <_gpio_keys_novena>;
+
+   user-button {
+   label = "User Button";
+   gpios = < 14 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   lid {
+   label = "Lid";
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   linux,input-type = <5>; /* EV_SW */
+   linux,code = <0>;   /* SW_LID */
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_leds_novena>;
+
+   heartbeat {
+   label = "novena:white:panel";
+   gpios = < 21 

[U-Boot] [PATCH 2/6] ARM: imx: novena: Enable DM pin control

2019-05-05 Thread Marek Vasut
Enable DM pin control support on iMX6Q Novena.

Signed-off-by: Marek Vasut 
Cc: Fabio Estevam 
Cc: Stefano Babic 
Cc: Vagrant Cascadian 
---
 configs/novena_defconfig | 5 +
 1 file changed, 5 insertions(+)

diff --git a/configs/novena_defconfig b/configs/novena_defconfig
index 04c944c6d8..31a32da0dc 100644
--- a/configs/novena_defconfig
+++ b/configs/novena_defconfig
@@ -14,6 +14,7 @@ CONFIG_SPL_FS_FAT=y
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_CMD_HDMIDETECT=y
 CONFIG_DISTRO_DEFAULTS=y
+# CONFIG_SYS_MALLOC_F is not set
 CONFIG_FIT=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_USE_BOOTARGS=y
@@ -29,6 +30,7 @@ CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_CMD_ASKENV=y
 CONFIG_CMD_EEPROM=y
+CONFIG_CMD_DM=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
@@ -43,6 +45,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-novena"
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_DM=y
 CONFIG_DWC_AHSATA=y
 CONFIG_FSL_ESDHC=y
 CONFIG_PHYLIB=y
@@ -50,6 +53,8 @@ CONFIG_PHY_MICREL=y
 CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_MII=y
 CONFIG_PCI=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_IMX6=y
 CONFIG_USB=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP=y
-- 
2.20.1

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


[U-Boot] [PATCH] video: ipuv3: Set max display bpp to 32

2019-05-05 Thread Marek Vasut
The IPUv3 can handle 1920x1080x32bpp displays , set the max preallocated
framebuffer BPP to 32 to cater for all eventualities.

Signed-off-by: Marek Vasut 
Cc: Anatolij Gustschin 
---
 drivers/video/imx/mxc_ipuv3_fb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/imx/mxc_ipuv3_fb.c b/drivers/video/imx/mxc_ipuv3_fb.c
index 3e38d4bdcc..29f7c21f75 100644
--- a/drivers/video/imx/mxc_ipuv3_fb.c
+++ b/drivers/video/imx/mxc_ipuv3_fb.c
@@ -678,7 +678,7 @@ static int ipuv3_video_bind(struct udevice *dev)
struct video_uc_platdata *plat = dev_get_uclass_platdata(dev);
 
plat->size = LCD_MAX_WIDTH * LCD_MAX_HEIGHT *
-(1 << LCD_MAX_LOG2_BPP) / 8;
+(1 << VIDEO_BPP32) / 8;
 
return 0;
 }
-- 
2.20.1

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


Re: [U-Boot] ARM: omap3_logic: Enable UUID

2019-05-05 Thread Tom Rini
On Sun, May 05, 2019 at 11:28:01AM +0200, Stefano Babic wrote:
> 
> 
> On 03/05/19 20:32, Fabio Estevam wrote:
> > Hi Stefano,
> > 
> > On Fri, Apr 26, 2019 at 7:11 AM  wrote:
> >>
> >>> Instead of hardcoding the mmcroot to /dev/mmcblkX, use the UUID
> >>> method.
> >>> Signed-off-by: Adam Ford 
> >>> diff --git a/configs/omap35_logic_defconfig 
> >>> b/configs/omap35_logic_defconfig
> >>> index 5b5f3eb7b4..9a1596c89b 100644
> >>> --- a/configs/omap35_logic_defconfig
> >>> +++ b/configs/omap35_logic_defconfig
> > 
> >> Applied to u-boot-imx, master, thanks !
> > 
> > Was this applied to the u-boot-imx tree by mistake?
> > 
> > This patch is for omap, not i.MX :-)
> > 
> 
> Right, but the patch was assigned to me, it was just a small change in
> config and then I applied on u-boot-imx.  Maybe the correct way for next
> time is simply to change delegate in Patchwork and reassign the patch
> (in this case, directly to Tom).

heh, oops.  I think it must have been sent around the same time as a
bunch of Adam's other patches that were for i.MX.  Either way, going
that tree or just assigning it back to me when I goof up is fine :)
Thanks!

-- 
Tom


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


[U-Boot] [PATCH 15/18] Convert CONFIG_AUTOBOOT_MENU_SHOW to Kconfig

2019-05-05 Thread Simon Glass
This converts the following to Kconfig:
   CONFIG_AUTOBOOT_MENU_SHOW

Signed-off-by: Simon Glass 
---

 cmd/Kconfig   | 8 
 configs/nokia_rx51_defconfig  | 1 +
 include/configs/nokia_rx51.h  | 2 --
 include/configs/vexpress_aemv8a.h | 2 --
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 244f4ff2531..35201f28c65 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -170,6 +170,14 @@ config AUTOBOOT_MENUKEY
  For example, 33 means "!" in ASCII, so pressing ! at boot would take
  this action.
 
+config AUTOBOOT_MENU_SHOW
+   bool "Show a menu on boot"
+   help
+ This enables the boot menu, controlled by environment variables
+ defined by the board. The menu starts after running the 'preboot'
+ environmnent variable (if enabled) and before handling the boot delay.
+ See README.bootmenu for more details.
+
 endmenu
 
 config BUILD_BIN2C
diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig
index 5cd96017e5d..ab5bb2de6f3 100644
--- a/configs/nokia_rx51_defconfig
+++ b/configs/nokia_rx51_defconfig
@@ -12,6 +12,7 @@ CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="Nokia RX-51 # "
 CONFIG_AUTOBOOT_KEYED=y
+CONFIG_AUTOBOOT_MENU_SHOW=y
 CONFIG_CMD_BOOTMENU=y
 # CONFIG_CMD_IMI is not set
 # CONFIG_CMD_SAVEENV is not set
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index 1cd7fc54906..3d9b9f9310d 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -271,8 +271,6 @@ int rx51_kp_getc(struct stdio_dev *sdev);
"run attachboot;" \
"echo"
 
-#define CONFIG_AUTOBOOT_MENU_SHOW
-
 /*
  * Miscellaneous configurable options
  */
diff --git a/include/configs/vexpress_aemv8a.h 
b/include/configs/vexpress_aemv8a.h
index 2b1269de837..89cd8b550ae 100644
--- a/include/configs/vexpress_aemv8a.h
+++ b/include/configs/vexpress_aemv8a.h
@@ -110,8 +110,6 @@
 #define CONFIG_PL011_CLOCK 2400
 #endif
 
-/*#define CONFIG_AUTOBOOT_MENU_SHOW*/
-
 /* BOOTP options */
 #define CONFIG_BOOTP_BOOTFILESIZE
 
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 14/18] autoboot: Rename CONFIG_MENU_SHOW to include AUTOBOOT

2019-05-05 Thread Simon Glass
Rename this option to CONFIG_AUTOBOOT_MENU_SHOW this it relates to the
autoboot functionality.

Signed-off-by: Simon Glass 
---

 cmd/bootmenu.c| 2 +-
 common/autoboot.c | 2 +-
 doc/README.bootmenu   | 2 +-
 doc/README.menu   | 2 +-
 include/configs/nokia_rx51.h  | 2 +-
 include/configs/vexpress_aemv8a.h | 2 +-
 include/menu.h| 2 +-
 scripts/config_whitelist.txt  | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 7f88c1ed632..0ae9d5a6815 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -472,7 +472,7 @@ void menu_display_statusline(struct menu *m)
puts(ANSI_CLEAR_LINE);
 }
 
-#ifdef CONFIG_MENU_SHOW
+#ifdef CONFIG_AUTOBOOT_MENU_SHOW
 int menu_show(int bootdelay)
 {
bootmenu_show(bootdelay);
diff --git a/common/autoboot.c b/common/autoboot.c
index 9752470873c..a38527ff96f 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -324,7 +324,7 @@ const char *bootdelay_process(void)
 
debug("### main_loop entered: bootdelay=%d\n\n", bootdelay);
 
-#if defined(CONFIG_MENU_SHOW)
+#if defined(CONFIG_AUTOBOOT_MENU_SHOW)
bootdelay = menu_show(bootdelay);
 #endif
bootretry_init_cmd_timeout();
diff --git a/doc/README.bootmenu b/doc/README.bootmenu
index 34ff8d5ecc9..ca5099089e7 100644
--- a/doc/README.bootmenu
+++ b/doc/README.bootmenu
@@ -91,7 +91,7 @@ To run the bootmenu at startup add these additional 
definitions:
 
   #define CONFIG_AUTOBOOT_KEYED
   #define CONFIG_BOOTDELAY 30
-  #define CONFIG_MENU_SHOW
+  #define CONFIG_AUTOBOOT_MENU_SHOW
 
 When you intend to use the bootmenu on color frame buffer console,
 make sure to additionally define CONFIG_CFB_CONSOLE_ANSI in the
diff --git a/doc/README.menu b/doc/README.menu
index 450c6a83a77..0f3d7416055 100644
--- a/doc/README.menu
+++ b/doc/README.menu
@@ -14,7 +14,7 @@ Menus are composed of items. Each item has a key used to 
identify it in
 the menu, and an opaque pointer to data controlled by the consumer.
 
 If you want to show a menu, instead starting the shell, define
-CONFIG_MENU_SHOW. You have to code the int menu_show(int bootdelay)
+CONFIG_AUTOBOOT_MENU_SHOW. You have to code the int menu_show(int bootdelay)
 function, which handle your menu. This function returns the remaining
 bootdelay.
 
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index 4be329c4105..1cd7fc54906 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -271,7 +271,7 @@ int rx51_kp_getc(struct stdio_dev *sdev);
"run attachboot;" \
"echo"
 
-#define CONFIG_MENU_SHOW
+#define CONFIG_AUTOBOOT_MENU_SHOW
 
 /*
  * Miscellaneous configurable options
diff --git a/include/configs/vexpress_aemv8a.h 
b/include/configs/vexpress_aemv8a.h
index 2354f4e958d..2b1269de837 100644
--- a/include/configs/vexpress_aemv8a.h
+++ b/include/configs/vexpress_aemv8a.h
@@ -110,7 +110,7 @@
 #define CONFIG_PL011_CLOCK 2400
 #endif
 
-/*#define CONFIG_MENU_SHOW*/
+/*#define CONFIG_AUTOBOOT_MENU_SHOW*/
 
 /* BOOTP options */
 #define CONFIG_BOOTP_BOOTFILESIZE
diff --git a/include/menu.h b/include/menu.h
index fbff429c895..8fd7b0a1f02 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -19,7 +19,7 @@ int menu_destroy(struct menu *m);
 void menu_display_statusline(struct menu *m);
 int menu_default_choice(struct menu *m, void **choice);
 
-#if defined(CONFIG_MENU_SHOW)
+#if defined(CONFIG_AUTOBOOT_MENU_SHOW)
 int menu_show(int bootdelay);
 #endif
 #endif /* __MENU_H__ */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 636014bf1f9..c4bb4de0ecb 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -98,6 +98,7 @@ CONFIG_ATMEL_LEGACY
 CONFIG_ATMEL_MCI_8BIT
 CONFIG_ATMEL_SPI0
 CONFIG_AT_TRANS
+CONFIG_AUTOBOOT_MENU_SHOW
 CONFIG_AUTO_ZRELADDR
 CONFIG_BACKSIDE_L2_CACHE
 CONFIG_BAT_PAIR
@@ -1198,7 +1199,6 @@ CONFIG_MEMSIZE_MASK
 CONFIG_MEM_HOLE_16M
 CONFIG_MEM_INIT_VALUE
 CONFIG_MEM_REMAP
-CONFIG_MENU_SHOW
 CONFIG_MFG_ENV_SETTINGS
 CONFIG_MIIM_ADDRESS
 CONFIG_MII_DEFAULT_TSEC
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 09/18] autoboot: Drop #ifdef CONFIG_AUTOBOOT_KEYED

2019-05-05 Thread Simon Glass
At present we have two functions named __autoboot() which do different
things. This is confusing. Fix it by using if() instead of #ifdef for
selecting the functions, and renaming them to meaningful names.

Signed-off-by: Simon Glass 
---

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

diff --git a/common/autoboot.c b/common/autoboot.c
index 45df6656760..012dd5797e1 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -35,8 +35,6 @@ static int stored_bootdelay;
 #define AUTOBOOT_STOP_STR_SHA256 ""
 #endif
 
-#if defined(CONFIG_AUTOBOOT_KEYED)
-
 /*
  * Use a "constant-length" time compare function for this
  * hash compare:
@@ -203,7 +201,7 @@ static int passwd_abort_key(uint64_t etime)
  * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
  * returns: 0 -  no key string, allow autoboot 1 - got key string, abort
  */
-static int __abortboot(int bootdelay)
+static int abortboot_key_sequence(int bootdelay)
 {
int abort;
uint64_t etime = endtick(bootdelay);
@@ -226,13 +224,11 @@ static int __abortboot(int bootdelay)
return abort;
 }
 
-# else /* !defined(CONFIG_AUTOBOOT_KEYED) */
-
 #ifdef CONFIG_MENUKEY
 static int menukey;
 #endif
 
-static int __abortboot(int bootdelay)
+static int abortboot_single_key(int bootdelay)
 {
int abort = 0;
unsigned long ts;
@@ -277,14 +273,17 @@ static int __abortboot(int bootdelay)
 
return abort;
 }
-# endif/* CONFIG_AUTOBOOT_KEYED */
 
 static int abortboot(int bootdelay)
 {
int abort = 0;
 
-   if (bootdelay >= 0)
-   abort = __abortboot(bootdelay);
+   if (bootdelay >= 0) {
+   if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
+   abort = abortboot_key_sequence(bootdelay);
+   else
+   abort = abortboot_single_key(bootdelay);
+   }
 
if (IS_ENABLED(CONFIG_SILENT_CONSOLE) && abort)
gd->flags &= ~GD_FLG_SILENT;
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 17/18] autoboot: Move a few more options from #ifdef to if()

2019-05-05 Thread Simon Glass
Adjust some of the code which can be trivially moved to use IS_ENABLED()
instead of #ifdef.

Signed-off-by: Simon Glass 
---

 common/autoboot.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index a38527ff96f..75132f8697f 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -292,7 +292,7 @@ static int abortboot(int bootdelay)
 
 static void process_fdt_options(const void *blob)
 {
-#if defined(CONFIG_OF_CONTROL) && defined(CONFIG_SYS_TEXT_BASE)
+#ifdef CONFIG_SYS_TEXT_BASE
ulong addr;
 
/* Add an env variable to point to a kernel payload, if available */
@@ -304,7 +304,7 @@ static void process_fdt_options(const void *blob)
addr = fdtdec_get_config_int(gd->fdt_blob, "rootdisk-offset", 0);
if (addr)
env_set_addr("rootaddr", (void *)(CONFIG_SYS_TEXT_BASE + addr));
-#endif /* CONFIG_OF_CONTROL && CONFIG_SYS_TEXT_BASE */
+#endif /* CONFIG_SYS_TEXT_BASE */
 }
 
 const char *bootdelay_process(void)
@@ -317,16 +317,14 @@ const char *bootdelay_process(void)
s = env_get("bootdelay");
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
 
-#ifdef CONFIG_OF_CONTROL
-   bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
-   bootdelay);
-#endif
+   if (IS_ENABLED(CONFIG_OF_CONTROL))
+   bootdelay = fdtdec_get_config_int(gd->fdt_blob, "bootdelay",
+ bootdelay);
 
debug("### main_loop entered: bootdelay=%d\n\n", bootdelay);
 
-#if defined(CONFIG_AUTOBOOT_MENU_SHOW)
-   bootdelay = menu_show(bootdelay);
-#endif
+   if (IS_ENABLED(CONFIG_AUTOBOOT_MENU_SHOW))
+   bootdelay = menu_show(bootdelay);
bootretry_init_cmd_timeout();
 
 #ifdef CONFIG_POST
@@ -339,7 +337,8 @@ const char *bootdelay_process(void)
else
s = env_get("bootcmd");
 
-   process_fdt_options(gd->fdt_blob);
+   if (IS_ENABLED(CONFIG_OF_CONTROL))
+   process_fdt_options(gd->fdt_blob);
stored_bootdelay = bootdelay;
 
return s;
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 18/18] autoboot: Adjust the implementation in autoboot_command()

2019-05-05 Thread Simon Glass
Avoid use of #ifdef and keep the common condion in a variable. This makes
the code easier to read.

Signed-off-by: Simon Glass 
---

 common/autoboot.c | 15 +--
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index 75132f8697f..42fbd7614a8 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -349,15 +349,18 @@ void autoboot_command(const char *s)
debug("### main_loop: bootcmd=\"%s\"\n", s ? s : "");
 
if (stored_bootdelay != -1 && s && !abortboot(stored_bootdelay)) {
-#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
-   int prev = disable_ctrlc(1);/* disable Control C checking */
-#endif
+   bool lock;
+   int prev;
+
+   lock = IS_ENABLED(CONFIG_AUTOBOOT_KEYED) &&
+   !IS_ENABLED(CONFIG_AUTOBOOT_KEYED_CTRLC);
+   if (lock)
+   prev = disable_ctrlc(1); /* disable Ctrl-C checking */
 
run_command_list(s, -1, 0);
 
-#if defined(CONFIG_AUTOBOOT_KEYED) && !defined(CONFIG_AUTOBOOT_KEYED_CTRLC)
-   disable_ctrlc(prev);/* restore Control C checking */
-#endif
+   if (lock)
+   disable_ctrlc(prev);/* restore Ctrl-C checking */
}
 
if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 13/18] autoboot: Tidy up use of menukey

2019-05-05 Thread Simon Glass
Move the variable to the top of the file and adjust the code which uses it
to use if() rather than #ifdef, to make it easier to read.

Signed-off-by: Simon Glass 
---

 common/autoboot.c | 26 ++
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index ad189a8ba28..9752470873c 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -28,6 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 /* Stored value of bootdelay, used by autoboot_command() */
 static int stored_bootdelay;
+static int menukey;
 
 #ifdef CONFIG_AUTOBOOT_ENCRYPTION
 #define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256
@@ -35,6 +36,12 @@ static int stored_bootdelay;
 #define AUTOBOOT_STOP_STR_SHA256 ""
 #endif
 
+#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
+#define AUTOBOOT_MENUKEY CONFIG_USE_AUTOBOOT_MENUKEY
+#else
+#define AUTOBOOT_MENUKEY 0
+#endif
+
 /*
  * Use a "constant-length" time compare function for this
  * hash compare:
@@ -224,10 +231,6 @@ static int abortboot_key_sequence(int bootdelay)
return abort;
 }
 
-#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
-static int menukey;
-#endif
-
 static int abortboot_single_key(int bootdelay)
 {
int abort = 0;
@@ -250,13 +253,13 @@ static int abortboot_single_key(int bootdelay)
ts = get_timer(0);
do {
if (tstc()) {   /* we got a key press   */
+   int key;
+
abort  = 1; /* don't auto boot  */
bootdelay = 0;  /* no more delay*/
-# ifdef CONFIG_USE_AUTOBOOT_MENUKEY
-   menukey = getc();
-# else
-   (void) getc();  /* consume input*/
-# endif
+   key = getc(); /* consume input  */
+   if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY))
+   menukey = key;
break;
}
udelay(1);
@@ -358,11 +361,10 @@ void autoboot_command(const char *s)
 #endif
}
 
-#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
-   if (menukey == CONFIG_AUTOBOOT_MENUKEY) {
+   if (IS_ENABLED(CONFIG_USE_AUTOBOOT_MENUKEY) &&
+   menukey == AUTOBOOT_MENUKEY) {
s = env_get("menucmd");
if (s)
run_command_list(s, -1, 0);
}
-#endif /* CONFIG_USE_AUTOBOOT_MENUKEY */
 }
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 10/18] autoboot: Drop unused CONFIG_MENUPROMPT

2019-05-05 Thread Simon Glass
This is not defined by any board. We could use CONFIG_AUTOBOOT_PROMPT
instead perhaps, but this depends on CONFIG_AUTOBOOT_KEYED which is not
used for the single-key case.

So let's just remove CONFIG_MENUPROMPT.

Signed-off-by: Simon Glass 
---

 common/autoboot.c| 4 
 scripts/config_whitelist.txt | 1 -
 2 files changed, 5 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index 012dd5797e1..a6071ab8391 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -233,11 +233,7 @@ static int abortboot_single_key(int bootdelay)
int abort = 0;
unsigned long ts;
 
-#ifdef CONFIG_MENUPROMPT
-   printf(CONFIG_MENUPROMPT);
-#else
printf("Hit any key to stop autoboot: %2d ", bootdelay);
-#endif
 
/*
 * Check if key already pressed
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 787cefc1507..fc77e0de3fa 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1199,7 +1199,6 @@ CONFIG_MEM_HOLE_16M
 CONFIG_MEM_INIT_VALUE
 CONFIG_MEM_REMAP
 CONFIG_MENUKEY
-CONFIG_MENUPROMPT
 CONFIG_MENU_SHOW
 CONFIG_MFG_ENV_SETTINGS
 CONFIG_MIIM_ADDRESS
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 16/18] autoboot: Add comments for menu_show()

2019-05-05 Thread Simon Glass
Add comments for this function. Also remove the #ifdef around it so that
it can be called from 'if (IS_ENABLED(...))'.

Signed-off-by: Simon Glass 
---

 include/menu.h | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/menu.h b/include/menu.h
index 8fd7b0a1f02..2d227c20bd5 100644
--- a/include/menu.h
+++ b/include/menu.h
@@ -19,7 +19,20 @@ int menu_destroy(struct menu *m);
 void menu_display_statusline(struct menu *m);
 int menu_default_choice(struct menu *m, void **choice);
 
-#if defined(CONFIG_AUTOBOOT_MENU_SHOW)
+/**
+ * menu_show() Show a boot menu
+ *
+ * This shows a menu and lets the user select an option. The menu is defined by
+ * environment variables (see README.bootmenu).
+ *
+ * This function doesn't normally return, but if the users requests the command
+ * problem, it will.
+ *
+ * @bootdelay: Delay to wait before running the default menu option (0 to run
+ * the entry immediately)
+ * @return If it returns, it always returns -1 to indicate that the boot should
+ * be aborted and the command prompt should be provided
+ */
 int menu_show(int bootdelay);
-#endif
+
 #endif /* __MENU_H__ */
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 12/18] snow: Define CONFIG_AUTOBOOT_MENUKEY

2019-05-05 Thread Simon Glass
This option is not used by any boards. To avoid needing to remove it as
dead code, add it to 'snow'.

Signed-off-by: Simon Glass 
---

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

diff --git a/configs/snow_defconfig b/configs/snow_defconfig
index f4744095164..e5c7bdd6cc2 100644
--- a/configs/snow_defconfig
+++ b/configs/snow_defconfig
@@ -18,6 +18,8 @@ CONFIG_SILENT_CONSOLE=y
 # CONFIG_SPL_FRAMEWORK is not set
 CONFIG_SPL_TEXT_BASE=0x02023400
 CONFIG_SYS_PROMPT="snow # "
+CONFIG_USE_AUTOBOOT_MENUKEY=y
+CONFIG_AUTOBOOT_MENUKEY=33
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 11/18] autoboot: Rename CONFIG_MENUKEY to CONFIG_AUTOBOOT_MENUKEY

2019-05-05 Thread Simon Glass
Since this is part of the autoboot functionality, it makes sense to name
it with an AUTOBOOT prefix. No mainline boards use it so this should be
safe, and downstream boards will need to adjust.

Since this option is just an integer value, it really needs another option
to control whether the feature is enabled or not. Add a new
CONFIG_USE_AUTOBOOT_MENUKEY for that. This fits better with how things are
done with Kconfig, avoiding the need to use a specific value to disable
the feature.

Signed-off-by: Simon Glass 
---

 cmd/Kconfig  | 17 +
 common/autoboot.c| 10 +-
 doc/README.autoboot  |  8 
 include/autoboot.h   |  2 +-
 scripts/config_whitelist.txt |  1 -
 5 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index fdfa3975ae2..244f4ff2531 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -153,6 +153,23 @@ config AUTOBOOT_STOP_STR_SHA256
  string / password matches a values that is encypted via
  a SHA256 hash and saved in the environment.
 
+config AUTOBOOT_USE_MENUKEY
+   bool "Allow a specify key to run a menu from the environment"
+   depends on !AUTOBOOT_KEYED
+   help
+ If a specific key is pressed to stop autoboot, then the commands in
+ the environment variable 'menucmd' are executed before boot starts.
+
+config AUTOBOOT_MENUKEY
+   int "ASCII value of boot key to show a menu"
+   default 0
+   depends on AUTOBOOT_USE_MENUKEY
+   help
+ If this key is pressed to stop autoboot, then the commands in the
+ environment variable 'menucmd' will be executed before boot starts.
+ For example, 33 means "!" in ASCII, so pressing ! at boot would take
+ this action.
+
 endmenu
 
 config BUILD_BIN2C
diff --git a/common/autoboot.c b/common/autoboot.c
index a6071ab8391..ad189a8ba28 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -224,7 +224,7 @@ static int abortboot_key_sequence(int bootdelay)
return abort;
 }
 
-#ifdef CONFIG_MENUKEY
+#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
 static int menukey;
 #endif
 
@@ -252,7 +252,7 @@ static int abortboot_single_key(int bootdelay)
if (tstc()) {   /* we got a key press   */
abort  = 1; /* don't auto boot  */
bootdelay = 0;  /* no more delay*/
-# ifdef CONFIG_MENUKEY
+# ifdef CONFIG_USE_AUTOBOOT_MENUKEY
menukey = getc();
 # else
(void) getc();  /* consume input*/
@@ -358,11 +358,11 @@ void autoboot_command(const char *s)
 #endif
}
 
-#ifdef CONFIG_MENUKEY
-   if (menukey == CONFIG_MENUKEY) {
+#ifdef CONFIG_USE_AUTOBOOT_MENUKEY
+   if (menukey == CONFIG_AUTOBOOT_MENUKEY) {
s = env_get("menucmd");
if (s)
run_command_list(s, -1, 0);
}
-#endif /* CONFIG_MENUKEY */
+#endif /* CONFIG_USE_AUTOBOOT_MENUKEY */
 }
diff --git a/doc/README.autoboot b/doc/README.autoboot
index de35f3093df..5e9a5e1cf7f 100644
--- a/doc/README.autoboot
+++ b/doc/README.autoboot
@@ -152,3 +152,11 @@ What they do
(Only effective when CONFIG_BOOT_RETRY_TIME is also set)
After the countdown timed out, the board will be reset to restart
again.
+
+  CONFIG_AUTOBOOT_USE_MENUKEY
+  CONFIG_AUTOBOOT_MENUKEY
+
+   If this key is pressed to stop autoboot, then the commands in the
+   environment variable 'menucmd' will be executed before boot starts.
+   For example, 33 means "!" in ASCII, so pressing ! at boot would take
+   this action.
diff --git a/include/autoboot.h b/include/autoboot.h
index 3ebd6f90e3c..ac8157e5704 100644
--- a/include/autoboot.h
+++ b/include/autoboot.h
@@ -27,7 +27,7 @@ const char *bootdelay_process(void);
  * autoboot_command() - run the autoboot command
  *
  * If enabled, run the autoboot command returned from bootdelay_process().
- * Also do the CONFIG_MENUKEY processing if enabled.
+ * Also do the CONFIG_AUTOBOOT_MENUKEY processing if enabled.
  *
  * @cmd: Command to run
  */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index fc77e0de3fa..636014bf1f9 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1198,7 +1198,6 @@ CONFIG_MEMSIZE_MASK
 CONFIG_MEM_HOLE_16M
 CONFIG_MEM_INIT_VALUE
 CONFIG_MEM_REMAP
-CONFIG_MENUKEY
 CONFIG_MENU_SHOW
 CONFIG_MFG_ENV_SETTINGS
 CONFIG_MIIM_ADDRESS
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 06/18] autoboot: Drop #ifdef for CONFIG_AUTOBOOT_ENCRYPTION

2019-05-05 Thread Simon Glass
Use if() instead for this option, renaming the two different
passwd_abort() functions to indicate their purpose.

Signed-off-by: Simon Glass 
---

 common/autoboot.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index e3086e3828c..5a0dac8d79a 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -10,6 +10,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -35,7 +36,6 @@ static int stored_bootdelay;
 #endif
 
 #if defined(CONFIG_AUTOBOOT_KEYED)
-#if defined(CONFIG_AUTOBOOT_STOP_STR_SHA256)
 
 /*
  * Use a "constant-length" time compare function for this
@@ -54,7 +54,7 @@ static int slow_equals(u8 *a, u8 *b, int len)
return diff == 0;
 }
 
-static int passwd_abort(uint64_t etime)
+static int passwd_abort_sha256(uint64_t etime)
 {
const char *sha_env_str = env_get("bootstopkeysha256");
u8 sha_env[SHA256_SUM_LEN];
@@ -105,8 +105,8 @@ static int passwd_abort(uint64_t etime)
 
return abort;
 }
-#else
-static int passwd_abort(uint64_t etime)
+
+static int passwd_abort_key(uint64_t etime)
 {
int abort = 0;
struct {
@@ -182,7 +182,6 @@ static int passwd_abort(uint64_t etime)
 
return abort;
 }
-#endif
 
 /***
  * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
@@ -201,7 +200,10 @@ static int __abortboot(int bootdelay)
printf(CONFIG_AUTOBOOT_PROMPT, bootdelay);
 #  endif
 
-   abort = passwd_abort(etime);
+   if (IS_ENABLED(CONFIG_AUTOBOOT_ENCRYPTION))
+   abort = passwd_abort_sha256(etime);
+   else
+   abort = passwd_abort_key(etime);
if (!abort)
debug_bootkeys("key timeout\n");
 
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 07/18] autoboot: Improve docs for CONFIG_AUTOBOOT_ENCRYPTION

2019-05-05 Thread Simon Glass
This option is not documented properly at present. Fix it.

Signed-off-by: Simon Glass 
---

 README  |  2 ++
 cmd/Kconfig |  9 -
 common/autoboot.c   | 16 
 doc/README.autoboot | 15 +++
 4 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/README b/README
index 0f311f9fdb7..2c81f0da760 100644
--- a/README
+++ b/README
@@ -3434,6 +3434,8 @@ List of environment variables (most likely not complete):
  allowed for use by the bootm command. See also "bootm_low"
  environment variable.
 
+  bootstopkeysha256, bootdelaykey, bootstopkey - See README.autoboot
+
   updatefile   - Location of the software update file on a TFTP server, used
  by the automatic software update feature. Please refer to
  documentation in doc/README.update for more details.
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 069e0ea7300..fdfa3975ae2 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -101,7 +101,14 @@ config AUTOBOOT_PROMPT
 config AUTOBOOT_ENCRYPTION
bool "Enable encryption in autoboot stopping"
depends on AUTOBOOT_KEYED
-   default n
+   help
+ This option allows a string to be entered into U-Boot to stop the
+ autoboot. The string itself is hashed and compared against the hash
+ in the environment variable 'bootstopkeysha256'. If it matches then
+ boot stops and a command-line prompt is presented.
+
+ This provides a way to ship a secure production device which can also
+ be accessed at the U-Boot command line.
 
 config AUTOBOOT_DELAY_STR
string "Delay autobooting via specific input key / string"
diff --git a/common/autoboot.c b/common/autoboot.c
index 5a0dac8d79a..f832808b71e 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -54,6 +54,14 @@ static int slow_equals(u8 *a, u8 *b, int len)
return diff == 0;
 }
 
+/**
+ * passwd_abort_sha256() - check for a hashed key sequence to abort booting
+ *
+ * This checks for the user entering a SHA256 hash within a given time.
+ *
+ * @etime: Timeout value ticks (stop when get_ticks() reachs this)
+ * @return 0 if autoboot should continue, 1 if it should stop
+ */
 static int passwd_abort_sha256(uint64_t etime)
 {
const char *sha_env_str = env_get("bootstopkeysha256");
@@ -106,6 +114,14 @@ static int passwd_abort_sha256(uint64_t etime)
return abort;
 }
 
+/**
+ * passwd_abort_key() - check for a key sequence to aborted booting
+ *
+ * This checks for the user entering a string within a given time.
+ *
+ * @etime: Timeout value ticks (stop when get_ticks() reachs this)
+ * @return 0 if autoboot should continue, 1 if it should stop
+ */
 static int passwd_abort_key(uint64_t etime)
 {
int abort = 0;
diff --git a/doc/README.autoboot b/doc/README.autoboot
index eeb7e4c6623..de35f3093df 100644
--- a/doc/README.autoboot
+++ b/doc/README.autoboot
@@ -132,6 +132,21 @@ What they do
provides an escape sequence from the limited "password"
strings.
 
+  CONFIG_AUTOBOOT_ENCRYPTION
+
+  "bootstopkeysha256"  environment variable
+
+   - Hash value of the input which unlocks the device and
+ stops autoboot.
+
+   This option allows a string to be entered into U-Boot to stop the
+   autoboot. The string itself is hashed and compared against the hash
+   in the environment variable 'bootstopkeysha256'. If it matches then
+   boot stops and a command-line prompt is presented.
+
+   This provides a way to ship a secure production device which can also
+   be accessed at the U-Boot command line.
+
   CONFIG_RESET_TO_RETRY
 
(Only effective when CONFIG_BOOT_RETRY_TIME is also set)
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 08/18] autoboot: Use if() for CONFIG_SILENT_CONSOLE

2019-05-05 Thread Simon Glass
Avoid an #ifdef in this function, to improve readability.

Signed-off-by: Simon Glass 
---

 common/autoboot.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index f832808b71e..45df6656760 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -286,10 +286,8 @@ static int abortboot(int bootdelay)
if (bootdelay >= 0)
abort = __abortboot(bootdelay);
 
-#ifdef CONFIG_SILENT_CONSOLE
-   if (abort)
+   if (IS_ENABLED(CONFIG_SILENT_CONSOLE) && abort)
gd->flags &= ~GD_FLG_SILENT;
-#endif
 
return abort;
 }
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 05/18] autoboot: Use CONFIG_AUTOBOOT_STOP_STR_SHA256 indirectly

2019-05-05 Thread Simon Glass
This CONFIG option is only present if CONFIG_AUTOBOOT_ENCRYPTION is
enabled so it cannot be used in code without that #ifdef. But we want to
reduce the use of #ifdef in this file and in particular to avoid having
two different functions both named passwd_abort() but which do different
things.

In preparation for this, create an intermediate value which is set to an
empty string if there is no value for CONFIG_AUTOBOOT_STOP_STR_SHA256.

Signed-off-by: Simon Glass 
---

 common/autoboot.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index 94133eaeda7..e3086e3828c 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -28,6 +28,12 @@ DECLARE_GLOBAL_DATA_PTR;
 /* Stored value of bootdelay, used by autoboot_command() */
 static int stored_bootdelay;
 
+#ifdef CONFIG_AUTOBOOT_ENCRYPTION
+#define AUTOBOOT_STOP_STR_SHA256 CONFIG_AUTOBOOT_STOP_STR_SHA256
+#else
+#define AUTOBOOT_STOP_STR_SHA256 ""
+#endif
+
 #if defined(CONFIG_AUTOBOOT_KEYED)
 #if defined(CONFIG_AUTOBOOT_STOP_STR_SHA256)
 
@@ -61,7 +67,7 @@ static int passwd_abort(uint64_t etime)
int ret;
 
if (sha_env_str == NULL)
-   sha_env_str = CONFIG_AUTOBOOT_STOP_STR_SHA256;
+   sha_env_str = AUTOBOOT_STOP_STR_SHA256;
 
/*
 * Generate the binary value from the environment hash value
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 03/18] Add CONFIG_USE_PREBOOT to boards that use CONFIG_PREBOOT

2019-05-05 Thread Simon Glass
In order to use CONFIG_PREBOOT with Kconfig, CONFIG_USE_PREBOOT must be
defined for each board. To prepare for conversion to Kconfig, add this.

Signed-off-by: Simon Glass 
---

 include/configs/MPC8349EMDS.h | 1 +
 include/configs/TQM834x.h | 1 +
 include/configs/am3517_crane.h| 1 +
 include/configs/am3517_evm.h  | 1 +
 include/configs/apf27.h   | 1 +
 include/configs/arndale.h | 1 +
 include/configs/bcmstb.h  | 1 +
 include/configs/bk4r1.h   | 1 +
 include/configs/bur_cfg_common.h  | 1 +
 include/configs/calimain.h| 1 +
 include/configs/cm_fx6.h  | 1 +
 include/configs/conga-qeval20-qa3-e3845.h | 1 +
 include/configs/controlcenterdc.h | 1 +
 include/configs/dfi-bt700.h   | 1 +
 include/configs/ds414.h   | 1 +
 include/configs/ea20.h| 1 +
 include/configs/evb_rk3229.h  | 1 +
 include/configs/gw_ventana.h  | 1 +
 include/configs/hrcon.h   | 1 +
 include/configs/ids8313.h | 1 +
 include/configs/m53menlo.h| 1 +
 include/configs/meesc.h   | 1 +
 include/configs/meson64.h | 1 +
 include/configs/microblaze-generic.h  | 3 ++-
 include/configs/mv-common.h   | 1 +
 include/configs/mvebu_armada-37xx.h   | 1 +
 include/configs/mvebu_armada-8k.h | 1 +
 include/configs/mx51evk.h | 1 +
 include/configs/mx53cx9020.h  | 1 +
 include/configs/mx53loco.h| 1 +
 include/configs/mx6cuboxi.h   | 1 +
 include/configs/nitrogen6x.h  | 1 +
 include/configs/nokia_rx51.h  | 1 +
 include/configs/omap3_beagle.h| 1 +
 include/configs/omap3_evm.h   | 1 +
 include/configs/omap3_logic.h | 1 +
 include/configs/opos6uldev.h  | 1 +
 include/configs/ot1200.h  | 1 +
 include/configs/platinum.h| 1 +
 include/configs/qemu-arm.h| 1 +
 include/configs/rk3036_common.h   | 1 +
 include/configs/rk3188_common.h   | 1 +
 include/configs/rk322x_common.h   | 1 +
 include/configs/rk3288_common.h   | 1 +
 include/configs/rpi.h | 1 +
 include/configs/siemens-am33x-common.h| 1 +
 include/configs/socfpga_dbm_soc1.h| 1 +
 include/configs/socfpga_vining_fpga.h | 1 +
 include/configs/socrates.h| 1 +
 include/configs/stm32mp1.h| 1 +
 include/configs/strider.h | 1 +
 include/configs/sunxi-common.h| 1 +
 include/configs/tbs2910.h | 1 +
 include/configs/tegra-common-post.h   | 1 +
 include/configs/theadorable-x86-common.h  | 1 +
 include/configs/theadorable.h | 1 +
 include/configs/topic_miami.h | 1 +
 include/configs/turris_mox.h  | 1 +
 include/configs/xpedite517x.h | 1 +
 include/configs/xpedite520x.h | 1 +
 include/configs/xpedite537x.h | 1 +
 include/configs/xpedite550x.h | 1 +
 include/configs/zipitz2.h | 1 +
 include/configs/zmx25.h   | 1 +
 include/configs/zynq-common.h | 1 +
 scripts/config_whitelist.txt  | 1 -
 66 files changed, 66 insertions(+), 2 deletions(-)

diff --git a/include/configs/MPC8349EMDS.h b/include/configs/MPC8349EMDS.h
index bda477cc160..5e6a751d8f8 100644
--- a/include/configs/MPC8349EMDS.h
+++ b/include/configs/MPC8349EMDS.h
@@ -686,6 +686,7 @@
 
 #define CONFIG_LOADADDR80  /* default location for tftp and bootm 
*/
 
+#define CONFIG_USE_PREBOOT
 #define CONFIG_PREBOOT "echo;" \
"echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
"echo"
diff --git a/include/configs/TQM834x.h b/include/configs/TQM834x.h
index 0942b872ac3..4f92fda308f 100644
--- a/include/configs/TQM834x.h
+++ b/include/configs/TQM834x.h
@@ -420,6 +420,7 @@
/* default location for tftp and bootm */
 #define CONFIG_LOADADDR40
 
+#define CONFIG_USE_PREBOOT
 #define CONFIG_PREBOOT "echo;" \
"echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
"echo"
diff --git a/include/configs/am3517_crane.h b/include/configs/am3517_crane.h
index 2c510265cca..276cc36fa15 100644
--- a/include/configs/am3517_crane.h
+++ b/include/configs/am3517_crane.h
@@ -73,6 +73,7 @@
 #ifdef CONFIG_USB_MUSB_HCD
 
 #ifdef CONFIG_USB_KEYBOARD
+#define CONFIG_USE_PREBOOT
 #define CONFIG_PREBOOT "usb start"
 #endif /* CONFIG_USB_KEYBOARD */
 
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index 9475e9975d5..875ccf33640 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -33,6 +33,7 @@
 #ifdef CONFIG_USB_MUSB_HOST
 
 #ifdef 

[U-Boot] [PATCH 02/18] Convert CONFIG_SHOW_BOOT_PROGRESS to Kconfig

2019-05-05 Thread Simon Glass
This converts the following to Kconfig:
   CONFIG_SHOW_BOOT_PROGRESS

Signed-off-by: Simon Glass 
---

 README| 165 --
 common/Kconfig| 162 +
 configs/am335x_shc_defconfig  |   1 +
 configs/am335x_shc_ict_defconfig  |   1 +
 configs/am335x_shc_netboot_defconfig  |   1 +
 configs/am335x_shc_sdboot_defconfig   |   1 +
 configs/bayleybay_defconfig   |   1 +
 configs/cherryhill_defconfig  |   1 +
 configs/chromebook_link64_defconfig   |   1 +
 configs/chromebook_link_defconfig |   1 +
 configs/chromebook_samus_defconfig|   1 +
 configs/chromebox_panther_defconfig   |   1 +
 ...-qeval20-qa3-e3845-internal-uart_defconfig |   1 +
 configs/conga-qeval20-qa3-e3845_defconfig |   1 +
 configs/coreboot_defconfig|   1 +
 configs/cougarcanyon2_defconfig   |   1 +
 configs/crownbay_defconfig|   1 +
 configs/dfi-bt700-q7x-151_defconfig   |   1 +
 configs/efi-x86_app_defconfig |   1 +
 configs/efi-x86_payload32_defconfig   |   1 +
 configs/efi-x86_payload64_defconfig   |   1 +
 configs/galileo_defconfig |   1 +
 configs/ipam390_defconfig |   1 +
 configs/lschlv2_defconfig |   1 +
 configs/lsxhl_defconfig   |   1 +
 configs/minnowmax_defconfig   |   1 +
 configs/qemu-x86_64_defconfig |   1 +
 configs/qemu-x86_defconfig|   1 +
 configs/som-db5800-som-6867_defconfig |   1 +
 ...able-x86-conga-qa3-e3845-pcie-x4_defconfig |   1 +
 .../theadorable-x86-conga-qa3-e3845_defconfig |   1 +
 configs/theadorable-x86-dfi-bt700_defconfig   |   1 +
 configs/xtfpga_defconfig  |   1 +
 include/configs/MigoR.h   |   1 -
 include/configs/am335x_shc.h  |   2 -
 include/configs/ap325rxa.h|   1 -
 include/configs/ap_sh4a_4a.h  |   1 -
 include/configs/armadillo-800eva.h|   2 -
 include/configs/ecovec.h  |   1 -
 include/configs/espt.h|   1 -
 include/configs/ipam390.h |   1 -
 include/configs/kzm9g.h   |   2 -
 include/configs/lsxl.h|   1 -
 include/configs/ms7720se.h|   1 -
 include/configs/ms7722se.h|   1 -
 include/configs/r0p7734.h |   1 -
 include/configs/rcar-gen2-common.h|   2 -
 include/configs/rcar-gen3-common.h|   2 -
 include/configs/rsk7203.h |   1 -
 include/configs/sh7752evb.h   |   1 -
 include/configs/sh7753evb.h   |   1 -
 include/configs/sh7757lcr.h   |   1 -
 include/configs/sh7763rdp.h   |   1 -
 include/configs/sh7785lcr.h   |   1 -
 include/configs/shmin.h   |   1 -
 include/configs/x86-common.h  |   1 -
 include/configs/xtfpga.h  |   1 -
 scripts/config_whitelist.txt  |   1 -
 58 files changed, 193 insertions(+), 195 deletions(-)

diff --git a/README b/README
index 8e934604cf6..0f311f9fdb7 100644
--- a/README
+++ b/README
@@ -2144,171 +2144,6 @@ The following options need to be configured:
A better solution is to properly configure the firewall,
but sometimes that is not allowed.
 
-- Show boot progress:
-   CONFIG_SHOW_BOOT_PROGRESS
-
-   Defining this option allows to add some board-
-   specific code (calling a user-provided function
-   "show_boot_progress(int)") that enables you to show
-   the system's boot progress on some display (for
-   example, some LED's) on your board. At the moment,
-   the following checkpoints are implemented:
-
-
-Legacy uImage format:
-
-  Arg  Where   When
-1  common/cmd_bootm.c  before attempting to boot an image
-   -1  common/cmd_bootm.c  Image header has bad magic number
-2  common/cmd_bootm.c  Image header has correct magic number
-   -2  common/cmd_bootm.c  Image header has bad checksum
-3  common/cmd_bootm.c  Image header has correct checksum
-   -3  common/cmd_bootm.c  Image data   has bad checksum
-4  common/cmd_bootm.c  Image data   has correct checksum
-   -4  common/cmd_bootm.c  Image is for unsupported architecture
-5  common/cmd_bootm.c  Architecture check OK
-   -5  common/cmd_bootm.c  Wrong Image Type (not kernel, multi)
-6  common/cmd_bootm.c  Image Type check OK
-   -6  common/cmd_bootm.c  gunzip uncompression error
-   -7  common/cmd_bootm.c  

[U-Boot] [PATCH 01/18] main: Use conditional run_preboot_environment_command()

2019-05-05 Thread Simon Glass
The function name indicates that it does something, but its entire
operation is actually condition on a CONFIG. Move the condition outside
the function so this is clearer, and use if() instead of #ifdef, like the
reset of the file.

Signed-off-by: Simon Glass 
---

 common/main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/common/main.c b/common/main.c
index 07b34bf2b05..ce39c8d1899 100644
--- a/common/main.c
+++ b/common/main.c
@@ -19,7 +19,6 @@ __weak void show_boot_progress(int val) {}
 
 static void run_preboot_environment_command(void)
 {
-#ifdef CONFIG_PREBOOT
char *p;
 
p = env_get("preboot");
@@ -34,7 +33,6 @@ static void run_preboot_environment_command(void)
if (IS_ENABLED(CONFIG_AUTOBOOT_KEYED))
disable_ctrlc(prev);/* restore Ctrl-C checking */
}
-#endif /* CONFIG_PREBOOT */
 }
 
 /* We come here after U-Boot is initialised and ready to process commands */
@@ -49,7 +47,8 @@ void main_loop(void)
 
cli_init();
 
-   run_preboot_environment_command();
+   if (IS_ENABLED(CONFIG_USE_PREBOOT))
+   run_preboot_environment_command();
 
if (IS_ENABLED(CONFIG_UPDATE_TFTP))
update_tftp(0UL, NULL, NULL);
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 00/18] autoboot: Tidy up autoboot code

2019-05-05 Thread Simon Glass
This series cleans up autoboot.c a bit to:

- Convert options to Kconfig
- Use C code instead of C preprocessor where possible
- Add a few comments


Simon Glass (18):
  main: Use conditional run_preboot_environment_command()
  Convert CONFIG_SHOW_BOOT_PROGRESS to Kconfig
  Add CONFIG_USE_PREBOOT to boards that use CONFIG_PREBOOT
  Convert CONFIG_USE_PREBOOT and CONFIG_PREBOOT to Kconfig
  autoboot: Use CONFIG_AUTOBOOT_STOP_STR_SHA256 indirectly
  autoboot: Drop #ifdef for CONFIG_AUTOBOOT_ENCRYPTION
  autoboot: Improve docs for CONFIG_AUTOBOOT_ENCRYPTION
  autoboot: Use if() for CONFIG_SILENT_CONSOLE
  autoboot: Drop #ifdef CONFIG_AUTOBOOT_KEYED
  autoboot: Drop unused CONFIG_MENUPROMPT
  autoboot: Rename CONFIG_MENUKEY to CONFIG_AUTOBOOT_MENUKEY
  snow: Define CONFIG_AUTOBOOT_MENUKEY
  autoboot: Tidy up use of menukey
  autoboot: Rename CONFIG_MENU_SHOW to include AUTOBOOT
  Convert CONFIG_AUTOBOOT_MENU_SHOW to Kconfig
  autoboot: Add comments for menu_show()
  autoboot: Move a few more options from #ifdef to if()
  autoboot: Adjust the implementation in autoboot_command()

 README| 167 +-
 cmd/Kconfig   |  34 +++-
 cmd/bootmenu.c|   2 +-
 common/Kconfig| 162 +
 common/autoboot.c | 121 +++--
 common/main.c |   5 +-
 configs/A10-OLinuXino-Lime_defconfig  |   1 +
 configs/A10s-OLinuXino-M_defconfig|   1 +
 configs/A13-OLinuXinoM_defconfig  |   1 +
 configs/A13-OLinuXino_defconfig   |   1 +
 configs/A20-OLinuXino-Lime2-eMMC_defconfig|   1 +
 configs/A20-OLinuXino-Lime2_defconfig |   1 +
 configs/A20-OLinuXino-Lime_defconfig  |   1 +
 configs/A20-OLinuXino_MICRO-eMMC_defconfig|   1 +
 configs/A20-OLinuXino_MICRO_defconfig |   1 +
 configs/A20-Olimex-SOM-EVB_defconfig  |   1 +
 configs/A20-Olimex-SOM204-EVB-eMMC_defconfig  |   1 +
 configs/A20-Olimex-SOM204-EVB_defconfig   |   1 +
 configs/A33-OLinuXino_defconfig   |   1 +
 configs/Ainol_AW1_defconfig   |   1 +
 configs/Ampe_A76_defconfig|   1 +
 configs/Auxtek-T003_defconfig |   1 +
 configs/Auxtek-T004_defconfig |   1 +
 configs/Bananapi_M2_Ultra_defconfig   |   1 +
 configs/Bananapi_defconfig|   1 +
 configs/Bananapi_m2m_defconfig|   1 +
 configs/Bananapro_defconfig   |   1 +
 configs/CHIP_defconfig|   1 +
 configs/CHIP_pro_defconfig|   1 +
 configs/CSQ_CS908_defconfig   |   1 +
 configs/Chuwi_V7_CW0825_defconfig |   1 +
 configs/Colombus_defconfig|   1 +
 configs/Cubieboard2_defconfig |   1 +
 configs/Cubieboard4_defconfig |   1 +
 configs/Cubieboard_defconfig  |   1 +
 configs/Cubietruck_defconfig  |   1 +
 configs/Cubietruck_plus_defconfig |   1 +
 configs/Empire_electronix_d709_defconfig  |   1 +
 configs/Empire_electronix_m712_defconfig  |   1 +
 configs/Hummingbird_A31_defconfig |   1 +
 configs/Hyundai_A7HD_defconfig|   1 +
 configs/Itead_Ibox_A20_defconfig  |   1 +
 configs/Lamobo_R1_defconfig   |   1 +
 configs/LicheePi_Zero_defconfig   |   1 +
 configs/Linksprite_pcDuino3_Nano_defconfig|   1 +
 configs/Linksprite_pcDuino3_defconfig |   1 +
 configs/Linksprite_pcDuino_defconfig  |   1 +
 configs/MK808C_defconfig  |   1 +
 configs/MPC8349EMDS_defconfig |   2 +
 configs/MSI_Primo73_defconfig |   1 +
 configs/MSI_Primo81_defconfig |   1 +
 configs/Marsboard_A10_defconfig   |   1 +
 configs/Mele_A1000G_quad_defconfig|   1 +
 configs/Mele_A1000_defconfig  |   1 +
 configs/Mele_I7_defconfig |   1 +
 configs/Mele_M3_defconfig |   1 +
 configs/Mele_M5_defconfig |   1 +
 configs/Mele_M9_defconfig |   1 +
 configs/Merrii_A80_Optimus_defconfig  |   1 +
 configs/Mini-X_defconfig  |   1 +
 .../Nintendo_NES_Classic_Edition_defconfig|   1 +
 configs/Orangepi_defconfig|   1 +
 configs/Orangepi_mini_defconfig   |   1 +
 configs/Sinlinx_SinA31s_defconfig |   1 +
 configs/Sinlinx_SinA33_defconfig  |   1 +
 configs/Sinovoip_BPI_M2_defconfig |   1 +
 configs/Sinovoip_BPI_M3_defconfig |   1 +
 configs/Sunchip_CX-A99_defconfig  |   1 +
 configs/TQM834x_defconfig |   2 +
 configs/UTOO_P66_defconfig|   1 +
 

[U-Boot] [RFC PATCH 1/1] riscv: increase the environment size for the qemu-riscv platform to 128kB

2019-05-05 Thread Karsten Merker
The existing default size of 4kB is too small as the default environment
has already nearly that size and defining a single additional environment
variable can exceed the available space.

Signed-off-by: Karsten Merker 
---
 include/configs/qemu-riscv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/qemu-riscv.h b/include/configs/qemu-riscv.h
index 2588c5a0b2..3d9208bab2 100644
--- a/include/configs/qemu-riscv.h
+++ b/include/configs/qemu-riscv.h
@@ -20,7 +20,7 @@
 #define CONFIG_STANDALONE_LOAD_ADDR0x8020
 
 /* Environment options */
-#define CONFIG_ENV_SIZESZ_4K
+#define CONFIG_ENV_SIZESZ_128K
 
 #define BOOT_TARGET_DEVICES(func) \
func(QEMU, qemu, na) \
-- 
2.20.1

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


[U-Boot] [RFC PATCH 0/1] riscv: qemu-riscv environment size

2019-05-05 Thread Karsten Merker
Hello,

currently the environment size for the qemu-riscv platform is set
to only 4kB.  The default environment (with distro_bootcmd
support) has already nearly 4kB, so defining additional
environment variables very quickly exceeds the allocated space. 
Is there a specific reason to use only 4kB for the environment? 
If not, I would like to propose to increase the environment size
to 128kB similar to what we have on a number of other platforms.

Regards,
Karsten

Karsten Merker (1):
  riscv: increase the environment size for the qemu-riscv platform to
128kB

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

-- 
2.20.1

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


[U-Boot] [PATCH v2 1/1] efi_loader: allowable event types in CreateEventEx()

2019-05-05 Thread Heinrich Schuchardt
CreateEventEx() does not allow the following event types:

* EVT_SIGNAL_EXIT_BOOT_SERVICES
* EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE

This check is needed to pass the UEFI SCT conformance test.

Signed-off-by: Heinrich Schuchardt 
Reviewed-by: Alexander Graf 
---
v2
correct commit message
---
 lib/efi_loader/efi_boottime.c | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 602b0da9f0..8965dabb2b 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -665,10 +665,26 @@ efi_status_t EFIAPI efi_create_event_ex(uint32_t type, 
efi_uintn_t notify_tpl,
efi_guid_t *event_group,
struct efi_event **event)
 {
+   efi_status_t ret;
+
EFI_ENTRY("%d, 0x%zx, %p, %p, %pUl", type, notify_tpl, notify_function,
  notify_context, event_group);
-   return EFI_EXIT(efi_create_event(type, notify_tpl, notify_function,
-notify_context, event_group, event));
+
+   /*
+* The allowable input parameters are the same as in CreateEvent()
+* except for the following two disallowed event types.
+*/
+   switch (type) {
+   case EVT_SIGNAL_EXIT_BOOT_SERVICES:
+   case EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE:
+   ret = EFI_INVALID_PARAMETER;
+   goto out;
+   }
+
+   ret = efi_create_event(type, notify_tpl, notify_function,
+  notify_context, event_group, event);
+out:
+   return EFI_EXIT(ret);
 }

 /**
--
2.20.1

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


Re: [U-Boot] [PATCH] arm: socfpga: control reboot from SRAM via env callback

2019-05-05 Thread Simon Goldschmidt

Am 05.05.2019 um 22:17 schrieb Marek Vasut:

On 5/5/19 8:05 AM, Simon Goldschmidt wrote:



On 05.05.19 03:42, Marek Vasut wrote:

On 5/4/19 9:10 PM, Simon Goldschmidt wrote:

Am 04.05.2019 um 20:43 schrieb Marek Vasut:

On 5/3/19 10:53 PM, Simon Goldschmidt wrote:



Marek Vasut mailto:ma...@denx.de>> schrieb am Fr., 3.
Mai 2019, 22:42:

   On 5/3/19 10:39 PM, Simon Goldschmidt wrote:
   >
   >
   > On 03.05.19 22:35, Marek Vasut wrote:
   >> On 5/3/19 10:30 PM, Simon Goldschmidt wrote:
   >>>
   >>>
   >>> On 03.05.19 22:28, Marek Vasut wrote:
    On 5/3/19 10:08 PM, Simon Goldschmidt wrote:
   > This moves the code that enables the Boot ROM to just jump
to SRAM
   > instead
   > of loading SPL from the original boot source on warm
reboot.
   >
   > Instead of always enabling this, an environment callback
for the
   > env var
   > "socfpga_reboot_from_sram" is used. This way, the
behaviour can be
   > enabled
   > at runtime and via saved environment.
   >
   > Signed-off-by: Simon Goldschmidt
   mailto:simon.k.r.goldschm...@gmail.com>>
   
    Would that be like a default "reset" command action ?
    This probably shouldn't be socfpga specific then.
   >>>
   >>> No, it's a thing that lives on and influences even the soft
   reset issued
   >>> by linux "reboot" command. This is something *very* socfpga
   specific.
   >>
   >> Hmmm, so isn't this a policy to be configured on the Linux
end ?
   >
   > Might be, but it affects U-Boot's 'reset' command as well. And
I guess
   > it's set up in U-Boot this early to ensure it always works.

   Drat, that's right. So there has to be some way to agree on
how the
   reset works between the kernel and U-Boot ?

   > If it were for me, we could drop writing this magic
altogether. I just
   > figured some boards might require it to be written somewhere,
and came
   > up with a patch that might save those boards with the way
it was
   before.

   Isn't this magic actually used by bootrom ?


Right. It tells the boot rom to jump to ocram on next reboot
instead of
loading spl from qspi or mmc. But if that's required or not a good
idea
at all depends on many factors. Some of them board related, some
U-Boot
related and some Linux related (depending on the hardware and drivers
used).


Should that be runtime configurable then ?


Since it might depend on Linux putting the qspi chip into a state where
it's not accessible by the boot ROM. That might change without
rebuilding U-Boot.


If Linux switches the chip into some weird mode the bootrom cannot cope
with, it's a reset routing problem. This cannot be fixed in software.


No, it cannot be fixed, but currently there's a workaround for those
boards and I thought it was worth to keep this workaround, even though
my own boards will be fixed and not require such a workaround in the
future :-)


What's the workaround ?


The workaround is what this patch is about: the Boot ROM just branches 
off to SRAM where it expectes SPL to be still working.


SPL can then e.g. reset 4-byte mode or whatever to still communicate 
with the device when Boot ROM can't.


Of course the downside is that SRAM might be overwritten meanwhile, 
which is why it's a workaround only, not the best idea how to do things...


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


Re: [U-Boot] [PATCH] arm: socfpga: control reboot from SRAM via env callback

2019-05-05 Thread Marek Vasut
On 5/5/19 8:05 AM, Simon Goldschmidt wrote:
> 
> 
> On 05.05.19 03:42, Marek Vasut wrote:
>> On 5/4/19 9:10 PM, Simon Goldschmidt wrote:
>>> Am 04.05.2019 um 20:43 schrieb Marek Vasut:
 On 5/3/19 10:53 PM, Simon Goldschmidt wrote:
>
>
> Marek Vasut mailto:ma...@denx.de>> schrieb am Fr., 3.
> Mai 2019, 22:42:
>
>   On 5/3/19 10:39 PM, Simon Goldschmidt wrote:
>   >
>   >
>   > On 03.05.19 22:35, Marek Vasut wrote:
>   >> On 5/3/19 10:30 PM, Simon Goldschmidt wrote:
>   >>>
>   >>>
>   >>> On 03.05.19 22:28, Marek Vasut wrote:
>    On 5/3/19 10:08 PM, Simon Goldschmidt wrote:
>   > This moves the code that enables the Boot ROM to just jump
> to SRAM
>   > instead
>   > of loading SPL from the original boot source on warm
> reboot.
>   >
>   > Instead of always enabling this, an environment callback
> for the
>   > env var
>   > "socfpga_reboot_from_sram" is used. This way, the
> behaviour can be
>   > enabled
>   > at runtime and via saved environment.
>   >
>   > Signed-off-by: Simon Goldschmidt
>      >
>   
>    Would that be like a default "reset" command action ?
>    This probably shouldn't be socfpga specific then.
>   >>>
>   >>> No, it's a thing that lives on and influences even the soft
>   reset issued
>   >>> by linux "reboot" command. This is something *very* socfpga
>   specific.
>   >>
>   >> Hmmm, so isn't this a policy to be configured on the Linux
> end ?
>   >
>   > Might be, but it affects U-Boot's 'reset' command as well. And
> I guess
>   > it's set up in U-Boot this early to ensure it always works.
>
>   Drat, that's right. So there has to be some way to agree on
> how the
>   reset works between the kernel and U-Boot ?
>
>   > If it were for me, we could drop writing this magic
> altogether. I just
>   > figured some boards might require it to be written somewhere,
> and came
>   > up with a patch that might save those boards with the way
> it was
>   before.
>
>   Isn't this magic actually used by bootrom ?
>
>
> Right. It tells the boot rom to jump to ocram on next reboot
> instead of
> loading spl from qspi or mmc. But if that's required or not a good
> idea
> at all depends on many factors. Some of them board related, some
> U-Boot
> related and some Linux related (depending on the hardware and drivers
> used).

 Should that be runtime configurable then ?
>>>
>>> Since it might depend on Linux putting the qspi chip into a state where
>>> it's not accessible by the boot ROM. That might change without
>>> rebuilding U-Boot.
>>
>> If Linux switches the chip into some weird mode the bootrom cannot cope
>> with, it's a reset routing problem. This cannot be fixed in software.
> 
> No, it cannot be fixed, but currently there's a workaround for those
> boards and I thought it was worth to keep this workaround, even though
> my own boards will be fixed and not require such a workaround in the
> future :-)

What's the workaround ?

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


[U-Boot] [PULL] u-boot-sh/master

2019-05-05 Thread Marek Vasut
The following changes since commit 4862830b696a6d0750e19d32a82553cdb41a85f8:

  Merge git://git.denx.de/u-boot-socfpga (2019-05-03 14:23:01 -0400)

are available in the Git repository at:

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

for you to fetch changes up to 41e30dcf87962e4bcc8d4197b3d808af14f71e92:

  cmd: mmc: Make Mode: printout consistent (2019-05-04 19:26:49 +0200)


Ismael Luceno Cortes (1):
  cmd: clk: Handle ENODEV from clk_get_rate

Marek Vasut (9):
  ARM: renesas: Configure DRAM size from ATF DT fragment
  pinctrl: gpio: Add callback for configuring pin as GPIO
  pinctrl: renesas: Set pin type in sh_pfc_config_mux_for_gpio
  pinctrl: renesas: Implement gpio_request_enable/gpio_disable_free
  gpio: renesas: Migrate to pinctrl GPIO accessors
  pinctrl: renesas: Remove sh_pfc_config_mux_for_gpio()
  ARM: rmobile: Always select pin control drivers on Gen3
  net: ravb: Avoid unsupported internal delay mode for R-Car E3/D3
  cmd: mmc: Make Mode: printout consistent

 arch/arm/mach-rmobile/Kconfig |  3 +++
 board/renesas/ebisu/ebisu.c   | 28 
 board/renesas/salvator-x/salvator-x.c | 28 
 board/renesas/ulcb/ulcb.c | 28 
 cmd/clk.c | 24 ++--
 cmd/mmc.c |  2 +-
 drivers/gpio/gpio-rcar.c  | 15 +++
 drivers/net/ravb.c| 13 ++---
 drivers/pinctrl/pinctrl-uclass.c  | 96

 drivers/pinctrl/renesas/pfc.c | 45
++---
 drivers/pinctrl/renesas/sh_pfc.h  |  1 -
 include/dm/pinctrl.h  | 44

 12 files changed, 289 insertions(+), 38 deletions(-)

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


Re: [U-Boot] [PATCH v5 2/2] dlmalloc: fix malloc range at end of ram

2019-05-05 Thread Tom Rini
On Sun, May 05, 2019 at 07:55:10PM +0200, Simon Goldschmidt wrote:
> Am 05.05.2019 um 13:38 schrieb Tom Rini:
> >On Sat, May 04, 2019 at 08:16:38PM +0200, Simon Goldschmidt wrote:
> >>Tom,
> >>
> >>Am 26.04.2019 um 13:00 schrieb Marek Vasut:
> >>>On 4/26/19 12:19 PM, Simon Goldschmidt wrote:
> On Fri, Apr 26, 2019 at 11:56 AM Marek Vasut  
> wrote:
> >
> >On 4/26/19 11:36 AM, Simon Goldschmidt wrote:
> >>On Fri, Apr 26, 2019 at 11:32 AM Marek Vasut  
> >>wrote:
> >>>
> >>>On 4/26/19 8:19 AM, Simon Goldschmidt wrote:
> Marek Vasut  schrieb am Fr., 26. Apr. 2019, 
> 00:22:
> 
> >On 4/25/19 9:22 PM, Simon Goldschmidt wrote:
> >>If the malloc range passed to mem_malloc_init() is at the end of 
> >>address
> >>range and 'start + size' overflows to 0, following allocations fail 
> >>as
> >>mem_malloc_end is zero (which looks like uninitialized).
> >>
> >>Fix this by subtracting 1 of 'start + size' overflows to zero.
> >>
> >>Signed-off-by: Simon Goldschmidt 
> >>
> >>Since there's no way this fits without breaking smartweb, I'd rather drop
> >>this for now in order to get 1/2 accepted.
> >
> >I thought that with 1/2 this fit again, with gcc-7.3 at least?  Thanks!
> 
> I'm not sure, as I don't have it here to test. But as this patch doesn't
> actually fix a board but fixes an issue in the code that *might* appear in
> the future, I'm not convinced it would be the right thing to merge it like
> it is.
> 
> And I'm also a little short on time to investigate this further, as it's not
> a real bug, currently.

OK, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v5 2/2] dlmalloc: fix malloc range at end of ram

2019-05-05 Thread Simon Goldschmidt

Am 05.05.2019 um 13:38 schrieb Tom Rini:

On Sat, May 04, 2019 at 08:16:38PM +0200, Simon Goldschmidt wrote:

Tom,

Am 26.04.2019 um 13:00 schrieb Marek Vasut:

On 4/26/19 12:19 PM, Simon Goldschmidt wrote:

On Fri, Apr 26, 2019 at 11:56 AM Marek Vasut  wrote:


On 4/26/19 11:36 AM, Simon Goldschmidt wrote:

On Fri, Apr 26, 2019 at 11:32 AM Marek Vasut  wrote:


On 4/26/19 8:19 AM, Simon Goldschmidt wrote:

Marek Vasut  schrieb am Fr., 26. Apr. 2019, 00:22:


On 4/25/19 9:22 PM, Simon Goldschmidt wrote:

If the malloc range passed to mem_malloc_init() is at the end of address
range and 'start + size' overflows to 0, following allocations fail as
mem_malloc_end is zero (which looks like uninitialized).

Fix this by subtracting 1 of 'start + size' overflows to zero.

Signed-off-by: Simon Goldschmidt 


Since there's no way this fits without breaking smartweb, I'd rather drop
this for now in order to get 1/2 accepted.


I thought that with 1/2 this fit again, with gcc-7.3 at least?  Thanks!


I'm not sure, as I don't have it here to test. But as this patch doesn't 
actually fix a board but fixes an issue in the code that *might* appear 
in the future, I'm not convinced it would be the right thing to merge it 
like it is.


And I'm also a little short on time to investigate this further, as it's 
not a real bug, currently.


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


[U-Boot] Pull request: u-boot-spi/master

2019-05-05 Thread Jagan Teki
Hi Tom, 

Please pull this spi-mem fix.

thanks,
Jagan.

The following changes since commit b4ee6daad7a2604ca9466b2ba48de86cc27d381f:

  Merge tag 'u-boot-imx-20190426' of git://git.denx.de/u-boot-imx (2019-05-01 
07:25:51 -0400)

are available in the Git repository at:

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

for you to fetch changes up to 60e2bf46784ebbd30ff29b3d3c7c97e56b11e86a:

  mtd: spi-nor: fix page program issue when using spi-mem driver (2019-05-03 
15:26:12 +0530)


Weijie Gao (1):
  mtd: spi-nor: fix page program issue when using spi-mem driver

 drivers/mtd/spi/spi-nor-core.c | 27 ---
 1 file changed, 8 insertions(+), 19 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PULL] u-boot-mips

2019-05-05 Thread Tom Rini
On Sat, May 04, 2019 at 03:26:18PM +0200, Daniel Schwierzeck wrote:

> Hi Tom,
> 
> please pull MIPS updates for 2019.07
> 
> https://travis-ci.org/danielschwierzeck/u-boot/builds/527853668
> 
> 
> The following changes since commit b4ee6daad7a2604ca9466b2ba48de86cc27d381f:
> 
>   Merge tag 'u-boot-imx-20190426' of git://git.denx.de/u-boot-imx (2019-05-01 
> 07:25:51 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-mips.git tags/mips-pull-2019-05-03
> 
> for you to fetch changes up to 5c629b1b69f780540e6e3bcc57d29438749f97c5:
> 
>   net: mscc: ocelot: Update DTS for Luton pcb90 (2019-05-03 16:46:36 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Pull request for mmc sub-system for v2019.07

2019-05-05 Thread Tom Rini
On Sat, May 04, 2019 at 03:00:31AM +, Peng Fan wrote:

> Hi Tom,
> 
> I am not able to setup ssh to denx mmc tree, so use my github for this 
> request-pull,
> please see whether this is ok for you.
> Please pull mmc-2019-5-3 for v2019.07-rc1
> Travis build: https://travis-ci.org/MrVan/u-boot/builds/527760370
> 
> Thanks,
> Peng.
> 
> The following changes since commit b4ee6daad7a2604ca9466b2ba48de86cc27d381f:
> 
>   Merge tag 'u-boot-imx-20190426' of git://git.denx.de/u-boot-imx (2019-05-01 
> 07:25:51 -0400)
> 
> are available in the Git repository at:
> 
>   https://github.com/MrVan/u-boot.git tags/mmc-2019-5-3
> 
> for you to fetch changes up to 37cb626da25d0d895079c85866d0c2030cd98438:
> 
>   mmc: sdhci: Add Support for ADMA2 (2019-05-03 20:44:11 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [PATCH 1/1] efi_loader: LoadImage() parameter checks

2019-05-05 Thread Heinrich Schuchardt
If the file path is NULL, return EFI_INVALID_PARAMETER.
If the file path is invalid, return EFI_NOT_FOUND.
If the size of the source buffer is 0, return EFI_LOAD_ERROR.
If the parent image handle does not refer to a loaded image return
EFI_INVALID_PARAMETER.

Signed-off-by: Heinrich Schuchardt 
---
 include/efi_loader.h   |  1 +
 lib/efi_loader/efi_boottime.c  | 17 
 lib/efi_loader/efi_root_node.c | 48 ++
 3 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index d3a1d4c465..07ef14ba1c 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -187,6 +187,7 @@ struct efi_handler {
  */
 enum efi_object_type {
EFI_OBJECT_TYPE_UNDEFINED = 0,
+   EFI_OBJECT_TYPE_U_BOOT_FIRMWARE,
EFI_OBJECT_TYPE_LOADED_IMAGE,
EFI_OBJECT_TYPE_STARTED_IMAGE,
 };
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 78a4063949..eb0aafa78b 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1676,6 +1676,9 @@ efi_status_t efi_load_image_from_path(struct 
efi_device_path *file_path,
u64 addr;
efi_uintn_t bs;

+   if (!file_path)
+   return EFI_INVALID_PARAMETER;
+
/* In case of failure nothing is returned */
*buffer = NULL;
*size = 0;
@@ -1683,7 +1686,7 @@ efi_status_t efi_load_image_from_path(struct 
efi_device_path *file_path,
/* Open file */
f = efi_file_from_path(file_path);
if (!f)
-   return EFI_DEVICE_ERROR;
+   return EFI_NOT_FOUND;

/* Get file size */
bs = 0;
@@ -1760,13 +1763,13 @@ efi_status_t EFIAPI efi_load_image(bool boot_policy,
EFI_ENTRY("%d, %p, %pD, %p, %zd, %p", boot_policy, parent_image,
  file_path, source_buffer, source_size, image_handle);

-   if (!image_handle || !parent_image) {
+   if (!image_handle || !efi_search_obj(parent_image)) {
ret = EFI_INVALID_PARAMETER;
goto error;
}
-
-   if (!source_buffer && !file_path) {
-   ret = EFI_NOT_FOUND;
+   /* The parent image handle must refer to a loaded image */
+   if (!parent_image->type) {
+   ret = EFI_INVALID_PARAMETER;
goto error;
}

@@ -1776,6 +1779,10 @@ efi_status_t EFIAPI efi_load_image(bool boot_policy,
if (ret != EFI_SUCCESS)
goto error;
} else {
+   if (!source_size) {
+   ret = EFI_LOAD_ERROR;
+   goto error;
+   }
dest_buffer = source_buffer;
}
/* split file_path which contains both the device and file parts */
diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c
index e0fcbb85a4..38514e0820 100644
--- a/lib/efi_loader/efi_root_node.c
+++ b/lib/efi_loader/efi_root_node.c
@@ -28,6 +28,7 @@ struct efi_root_dp {
  */
 efi_status_t efi_root_node_register(void)
 {
+   efi_status_t ret;
struct efi_root_dp *dp;

/* Create device path protocol */
@@ -47,28 +48,31 @@ efi_status_t efi_root_node_register(void)
dp->end.length = sizeof(struct efi_device_path);

/* Create root node and install protocols */
-   return EFI_CALL(efi_install_multiple_protocol_interfaces(_root,
-  /* Device path protocol */
-  _guid_device_path, dp,
-  /* Device path to text protocol */
-  _guid_device_path_to_text_protocol,
-  (void *)_device_path_to_text,
-  /* Device path utilities protocol */
-  _guid_device_path_utilities_protocol,
-  (void *)_device_path_utilities,
-  /* Unicode collation protocol */
-  _guid_unicode_collation_protocol,
-  (void *)_unicode_collation_protocol,
+   ret = EFI_CALL(efi_install_multiple_protocol_interfaces
+   (_root,
+/* Device path protocol */
+_guid_device_path, dp,
+/* Device path to text protocol */
+_guid_device_path_to_text_protocol,
+(void *)_device_path_to_text,
+/* Device path utilities protocol */
+_guid_device_path_utilities_protocol,
+(void *)_device_path_utilities,
+/* Unicode collation protocol */
+_guid_unicode_collation_protocol,
+(void *)_unicode_collation_protocol,
 #if CONFIG_IS_ENABLED(EFI_LOADER_HII)
-  /* HII string protocol */
-  _guid_hii_string_protocol,
-  (void *)_hii_string,
-  /* HII database 

[U-Boot] [PATCH V2 4/4] imx: imx8dx/qxp: enable thermal

2019-05-05 Thread Peng Fan
Add thermal dts node
Enable thermal in defconfig

Signed-off-by: Peng Fan 
---

V2: None

 arch/arm/dts/fsl-imx8dx.dtsi  | 56 +++
 configs/imx8qxp_mek_defconfig |  2 ++
 2 files changed, 58 insertions(+)

diff --git a/arch/arm/dts/fsl-imx8dx.dtsi b/arch/arm/dts/fsl-imx8dx.dtsi
index 715abb413d..4fc87a9fc8 100644
--- a/arch/arm/dts/fsl-imx8dx.dtsi
+++ b/arch/arm/dts/fsl-imx8dx.dtsi
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 
 / {
model = "Freescale i.MX8DX";
@@ -543,6 +544,61 @@
power-domains = <_conn_enet1>;
status = "disabled";
};
+
+   tsens: thermal-sensor {
+   compatible = "nxp,imx8qxp-sc-tsens";
+   /* number of the temp sensor on the chip */
+   tsens-num = <2>;
+   #thermal-sensor-cells = <1>;
+   };
+
+   thermal_zones: thermal-zones {
+   /* cpu thermal */
+   cpu-thermal0 {
+   polling-delay-passive = <250>;
+   polling-delay = <2000>;
+   /*the slope and offset of the temp sensor */
+   thermal-sensors = < 0>;
+   trips {
+   cpu_alert0: trip0 {
+   temperature = <107000>;
+   hysteresis = <2000>;
+   type = "passive";
+   };
+   cpu_crit0: trip1 {
+   temperature = <127000>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   cooling-maps {
+   map0 {
+   trip = <_alert0>;
+   cooling-device =
+   <_0 THERMAL_NO_LIMIT 
THERMAL_NO_LIMIT>;
+   };
+   };
+   };
+
+   drc-thermal0 {
+   polling-delay-passive = <250>;
+   polling-delay = <2000>;
+   thermal-sensors = < 1>;
+   status = "disabled";
+   trips {
+   drc_alert0: trip0 {
+   temperature = <107000>;
+   hysteresis = <2000>;
+   type = "passive";
+   };
+   drc_crit0: trip1 {
+   temperature = <127000>;
+   hysteresis = <2000>;
+   type = "critical";
+   };
+   };
+   };
+   };
 };
 
 _0 {
diff --git a/configs/imx8qxp_mek_defconfig b/configs/imx8qxp_mek_defconfig
index 2fb2fdf7ff..6101f62087 100644
--- a/configs/imx8qxp_mek_defconfig
+++ b/configs/imx8qxp_mek_defconfig
@@ -74,5 +74,7 @@ CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_SPL_DM_REGULATOR_GPIO=y
 CONFIG_DM_SERIAL=y
 CONFIG_FSL_LPUART=y
+CONFIG_DM_THERMAL=y
+CONFIG_IMX_SCU_THERMAL=y
 CONFIG_SPL_TINY_MEMSET=y
 # CONFIG_EFI_LOADER is not set
-- 
2.16.4

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


[U-Boot] [PATCH V2 2/4] thermal: add i.MX8 thermal driver

2019-05-05 Thread Peng Fan
Add i.MX8 thermal driver to support get temperature from SCU.

Signed-off-by: Peng Fan 
---

V2: None

 drivers/thermal/Kconfig   |   9 ++
 drivers/thermal/Makefile  |   1 +
 drivers/thermal/imx_scu_thermal.c | 203 ++
 3 files changed, 213 insertions(+)
 create mode 100644 drivers/thermal/imx_scu_thermal.c

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index a71b9be5fb..bdf8dc6fef 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -17,6 +17,15 @@ config IMX_THERMAL
   cpufreq is used as the cooling device to throttle CPUs when the
   passive trip is crossed.
 
+config IMX_SCU_THERMAL
+   bool "Temperature sensor driver for NXP i.MX8"
+   depends on ARCH_IMX8
+   help
+ Support for Temperature sensors on NXP i.MX8.
+ It supports one critical trip point and one passive trip point. The
+ boot is hold to the cool device to throttle CPUs when the passive
+ trip is crossed
+
 config TI_DRA7_THERMAL
 bool "Temperature sensor driver for TI dra7xx SOCs"
 help
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index cc75e387e4..ef2929d180 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -5,4 +5,5 @@
 
 obj-$(CONFIG_DM_THERMAL) += thermal-uclass.o
 obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
+obj-$(CONFIG_IMX_SCU_THERMAL) += imx_scu_thermal.o
 obj-$(CONFIG_TI_DRA7_THERMAL) += ti-bandgap.o
diff --git a/drivers/thermal/imx_scu_thermal.c 
b/drivers/thermal/imx_scu_thermal.c
new file mode 100644
index 00..7e17377b69
--- /dev/null
+++ b/drivers/thermal/imx_scu_thermal.c
@@ -0,0 +1,203 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2019 NXP
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct imx_sc_thermal_plat {
+   int critical;
+   int alert;
+   int polling_delay;
+   int id;
+   bool zone_node;
+};
+
+static int read_temperature(struct udevice *dev, int *temp)
+{
+   s16 celsius;
+   s8 tenths;
+   int ret;
+
+   sc_rsrc_t *sensor_rsrc = (sc_rsrc_t *)dev_get_driver_data(dev);
+
+   struct imx_sc_thermal_plat *pdata = dev_get_platdata(dev);
+
+   if (!temp)
+   return -EINVAL;
+
+   ret = sc_misc_get_temp(-1, sensor_rsrc[pdata->id], SC_C_TEMP,
+  , );
+   if (ret) {
+   printf("Error: get temperature failed! (error = %d)\n", ret);
+   return ret;
+   }
+
+   *temp = celsius * 1000 + tenths * 100;
+
+   return 0;
+}
+
+int imx_sc_thermal_get_temp(struct udevice *dev, int *temp)
+{
+   struct imx_sc_thermal_plat *pdata = dev_get_platdata(dev);
+   int cpu_temp = 0;
+   int ret;
+
+   ret = read_temperature(dev, _temp);
+   if (ret)
+   return ret;
+
+   while (cpu_temp >= pdata->alert) {
+   printf("CPU Temperature (%dC) has beyond alert (%dC), close to 
critical (%dC)",
+  cpu_temp, pdata->alert, pdata->critical);
+   puts(" waiting...\n");
+   mdelay(pdata->polling_delay);
+   ret = read_temperature(dev, _temp);
+   if (ret)
+   return ret;
+   }
+
+   *temp = cpu_temp / 1000;
+
+   return 0;
+}
+
+static const struct dm_thermal_ops imx_sc_thermal_ops = {
+   .get_temp   = imx_sc_thermal_get_temp,
+};
+
+static int imx_sc_thermal_probe(struct udevice *dev)
+{
+   debug("%s dev name %s\n", __func__, dev->name);
+   return 0;
+}
+
+static int imx_sc_thermal_bind(struct udevice *dev)
+{
+   struct imx_sc_thermal_plat *pdata = dev_get_platdata(dev);
+   int reg, ret;
+   int offset;
+   const char *name;
+   const void *prop;
+
+   debug("%s dev name %s\n", __func__, dev->name);
+
+   prop = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "compatible",
+  NULL);
+   if (!prop)
+   return 0;
+
+   pdata->zone_node = 1;
+
+   reg = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), "tsens-num", 0);
+   if (reg == 0) {
+   printf("%s: no temp sensor number provided!\n", __func__);
+   return -EINVAL;
+   }
+
+   offset = fdt_subnode_offset(gd->fdt_blob, 0, "thermal-zones");
+   fdt_for_each_subnode(offset, gd->fdt_blob, offset) {
+   /* Bind the subnode to this driver */
+   name = fdt_get_name(gd->fdt_blob, offset, NULL);
+
+   ret = device_bind_with_driver_data(dev, dev->driver, name,
+  dev->driver_data,
+  offset_to_ofnode(offset),
+  NULL);
+   if (ret)
+   printf("Error binding driver '%s': %d\n",
+  

[U-Boot] [PATCH V2 1/4] misc: imx8: add sc_misc_get_temp

2019-05-05 Thread Peng Fan
Add sc_misc_get_temp to support get temperature

Signed-off-by: Peng Fan 
---

V2: None

 arch/arm/include/asm/arch-imx8/sci/sci.h  |  2 ++
 arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h |  1 +
 drivers/misc/imx8/scu_api.c   | 28 +++
 3 files changed, 31 insertions(+)

diff --git a/arch/arm/include/asm/arch-imx8/sci/sci.h 
b/arch/arm/include/asm/arch-imx8/sci/sci.h
index 97377697f0..901b90d705 100644
--- a/arch/arm/include/asm/arch-imx8/sci/sci.h
+++ b/arch/arm/include/asm/arch-imx8/sci/sci.h
@@ -72,6 +72,8 @@ void sc_misc_get_boot_dev(sc_ipc_t ipc, sc_rsrc_t *boot_dev);
 void sc_misc_boot_status(sc_ipc_t ipc, sc_misc_boot_status_t status);
 void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit);
 int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val);
+int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp,
+s16 *celsius, s8 *tenths);
 
 /* RM API */
 sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr);
diff --git a/arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h 
b/arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h
index 5d17b553d7..3629eb68d7 100644
--- a/arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h
+++ b/arch/arm/include/asm/arch-imx8/sci/svc/misc/api.h
@@ -26,5 +26,6 @@
 #define SC_MISC_REL_CONTAINER  2U  /* Release container */
 
 typedef u8 sc_misc_boot_status_t;
+typedef u8 sc_misc_temp_t;
 
 #endif /* SC_MISC_API_H */
diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c
index d9c4d5d784..031bc0048b 100644
--- a/drivers/misc/imx8/scu_api.c
+++ b/drivers/misc/imx8/scu_api.c
@@ -273,6 +273,34 @@ int sc_misc_otp_fuse_read(sc_ipc_t ipc, u32 word, u32 *val)
return 0;
 }
 
+int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp,
+s16 *celsius, s8 *tenths)
+{
+   struct udevice *dev = gd->arch.scu_dev;
+   int size = sizeof(struct sc_rpc_msg_s);
+   struct sc_rpc_msg_s msg;
+   int ret;
+
+   RPC_VER() = SC_RPC_VERSION;
+   RPC_SVC() = (u8)SC_RPC_SVC_MISC;
+   RPC_FUNC() = (u8)MISC_FUNC_GET_TEMP;
+   RPC_U16(, 0U) = (u16)resource;
+   RPC_U8(, 2U) = (u8)temp;
+   RPC_SIZE() = 2U;
+
+   ret = misc_call(dev, SC_FALSE, , size, , size);
+   if (ret < 0)
+   return ret;
+
+   if (celsius)
+   *celsius = RPC_I16(, 0U);
+
+   if (tenths)
+   *tenths = RPC_I8(, 2U);
+
+   return 0;
+}
+
 /* RM */
 sc_bool_t sc_rm_is_memreg_owned(sc_ipc_t ipc, sc_rm_mr_t mr)
 {
-- 
2.16.4

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


[U-Boot] [PATCH V2 3/4] imx8: cpu: get temperature when print cpu desc

2019-05-05 Thread Peng Fan
Read the temperature when print cpu inforation.

Signed-off-by: Peng Fan 
---

V2:
 Fix build when IMX_SCU_THERMAL not defined.

 arch/arm/mach-imx/imx8/cpu.c | 40 ++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c
index 2c425357b5..882a82109d 100644
--- a/arch/arm/mach-imx/imx8/cpu.c
+++ b/arch/arm/mach-imx/imx8/cpu.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -573,15 +574,50 @@ const char *get_core_name(void)
return "?";
 }
 
+#if IS_ENABLED(CONFIG_IMX_SCU_THERMAL)
+static int cpu_imx_get_temp(void)
+{
+   struct udevice *thermal_dev;
+   int cpu_tmp, ret;
+
+   ret = uclass_get_device_by_name(UCLASS_THERMAL, "cpu-thermal0",
+   _dev);
+
+   if (!ret) {
+   ret = thermal_get_temp(thermal_dev, _tmp);
+   if (ret)
+   return 0xdeadbeef;
+   } else {
+   return 0xdeadbeef;
+   }
+
+   return cpu_tmp;
+}
+#else
+static int cpu_imx_get_temp(void)
+{
+   return 0;
+}
+#endif
+
 int cpu_imx_get_desc(struct udevice *dev, char *buf, int size)
 {
struct cpu_imx_platdata *plat = dev_get_platdata(dev);
+   int ret;
 
if (size < 100)
return -ENOSPC;
 
-   snprintf(buf, size, "NXP i.MX8%s Rev%s %s at %u MHz\n",
-plat->type, plat->rev, plat->name, plat->freq_mhz);
+   ret = snprintf(buf, size, "NXP i.MX8%s Rev%s %s at %u MHz",
+  plat->type, plat->rev, plat->name, plat->freq_mhz);
+
+   if (IS_ENABLED(CONFIG_IMX_SCU_THERMAL)) {
+   buf = buf + ret;
+   size = size - ret;
+   ret = snprintf(buf, size, " at %dC", cpu_imx_get_temp());
+   }
+
+   snprintf(buf + ret, size - ret, "\n");
 
return 0;
 }
-- 
2.16.4

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


Re: [U-Boot] [PATCH 1/1] env: Exit tools when invalid CRC found

2019-05-05 Thread Tom Rini
On Wed, Apr 03, 2019 at 01:30:47PM +, Molloy, Philip wrote:

> fw_setenv and fw_printenv currently print a warning and use a default
> environment compiled into the binary when an invalid CRC is found. This
> modifies the default behavior to print an error and exit. This is
> especially important when calling the tools from a script since the
> script depends on the exit code of the tool to know something went
> wrong.
> 
> If the default environment is desired it should be read explicitly by
> the caller. A better model is to store a default environment as a
> separate binary or text file rather than storing it in the executable.
> 
> Signed-off-by: Philip Molloy 

Conceptually, yes, this is correct.  However, the behavior in question
has been deployed for so long that I don't feel that we can change it at
this point, so I'm going to NAK this.  Sorry.

-- 
Tom


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


Re: [U-Boot] Pull request v2: u-boot-sunxi/master

2019-05-05 Thread Tom Rini
On Sun, May 05, 2019 at 12:34:56AM +0530, Jagan Teki wrote:

> Hi Tom,
> 
> Please pull this PR.
> 
> Summary:
> - H6 Beelink GS1 board (Clément)
> - Olimex A64-Teres-I board (Jonas)
> - sunxi build fix for CONFIG_CMD_PXE|DHCP (Ondrej)
> - EPHY clock changes (Jagan)
> - EMAC enablement on Cubietruck Plus, BPI-M3 (Chen-Yu Tsai)
> 
> Changes for v2:
> - Skip _relaxed MMIO changes
> 
> The following changes since commit 1f4ae66eaab29bfb5d1eb44996f7826c9cd01ed1:
> 
>   Merge tag 'arc-for-2019.07' of git://git.denx.de/u-boot-arc (2019-04-18 
> 12:12:16 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-sunxi.git master
> 
> for you to fetch changes up to 4488e3031bb96fe362f04fec4a75cd621cb8b4d3:
> 
>   sunxi: Enable EMAC on the Bananapi M3 (2019-05-03 15:06:12 +0530)
> 

commit 36f5f6ae957dfd382d82e384b54958d150bd2834
Author: Jagan Teki 
Date:   Thu Feb 28 00:26:52 2019 +0530

clk: Get the CLK by index without device

Breaks riscv and nds32.

-- 
Tom


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


Re: [U-Boot] [PATCH v5 2/2] dlmalloc: fix malloc range at end of ram

2019-05-05 Thread Tom Rini
On Sat, May 04, 2019 at 08:16:38PM +0200, Simon Goldschmidt wrote:
> Tom,
> 
> Am 26.04.2019 um 13:00 schrieb Marek Vasut:
> >On 4/26/19 12:19 PM, Simon Goldschmidt wrote:
> >>On Fri, Apr 26, 2019 at 11:56 AM Marek Vasut  wrote:
> >>>
> >>>On 4/26/19 11:36 AM, Simon Goldschmidt wrote:
> On Fri, Apr 26, 2019 at 11:32 AM Marek Vasut  
> wrote:
> >
> >On 4/26/19 8:19 AM, Simon Goldschmidt wrote:
> >>Marek Vasut  schrieb am Fr., 26. Apr. 2019, 
> >>00:22:
> >>
> >>>On 4/25/19 9:22 PM, Simon Goldschmidt wrote:
> If the malloc range passed to mem_malloc_init() is at the end of 
> address
> range and 'start + size' overflows to 0, following allocations fail as
> mem_malloc_end is zero (which looks like uninitialized).
> 
> Fix this by subtracting 1 of 'start + size' overflows to zero.
> 
> Signed-off-by: Simon Goldschmidt 
> 
> Since there's no way this fits without breaking smartweb, I'd rather drop
> this for now in order to get 1/2 accepted.

I thought that with 1/2 this fit again, with gcc-7.3 at least?  Thanks!

-- 
Tom


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


[U-Boot] [PATCH 1/1] efi_loader: HandleProtocol parameter checks

2019-05-05 Thread Heinrich Schuchardt
HandleProtocol() and OpenProtocol() have to return EFI_UNSUPPORTED if the
protocol is not installed on the handle.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index af9b2f4df3..5104ad5b83 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -2638,8 +2638,15 @@ static efi_status_t EFIAPI efi_open_protocol
}

r = efi_search_protocol(handle, protocol, );
-   if (r != EFI_SUCCESS)
+   switch (r) {
+   case EFI_SUCCESS:
+   break;
+   case EFI_NOT_FOUND:
+   r = EFI_UNSUPPORTED;
goto out;
+   default:
+   goto out;
+   }

r = efi_protocol_open(handler, protocol_interface, agent_handle,
  controller_handle, attributes);
--
2.20.1

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


[U-Boot] [PATCH 1/1] efi_loader: use EFI_PRINT instead of debug

2019-05-05 Thread Heinrich Schuchardt
For correct indentation of messages in the UEFI API implementation use
EFI_PRINT() instead of debug().

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 148927fbda..13ef8a6ddf 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -267,7 +267,7 @@ static unsigned long EFIAPI efi_raise_tpl(efi_uintn_t 
new_tpl)
EFI_ENTRY("0x%zx", new_tpl);

if (new_tpl < efi_tpl)
-   debug("WARNING: new_tpl < current_tpl in %s\n", __func__);
+   EFI_PRINT("WARNING: new_tpl < current_tpl in %s\n", __func__);
efi_tpl = new_tpl;
if (efi_tpl > TPL_HIGH_LEVEL)
efi_tpl = TPL_HIGH_LEVEL;
@@ -290,7 +290,7 @@ static void EFIAPI efi_restore_tpl(efi_uintn_t old_tpl)
EFI_ENTRY("0x%zx", old_tpl);

if (old_tpl > efi_tpl)
-   debug("WARNING: old_tpl > current_tpl in %s\n", __func__);
+   EFI_PRINT("WARNING: old_tpl > current_tpl in %s\n", __func__);
efi_tpl = old_tpl;
if (efi_tpl > TPL_HIGH_LEVEL)
efi_tpl = TPL_HIGH_LEVEL;
@@ -1093,11 +1093,9 @@ static efi_status_t EFIAPI 
efi_install_protocol_interface(
r = efi_create_handle(handle);
if (r != EFI_SUCCESS)
goto out;
-   debug("%sEFI: new handle %p\n", indent_string(nesting_level),
- *handle);
+   EFI_PRINT("new handle %p\n", *handle);
} else {
-   debug("%sEFI: handle %p\n", indent_string(nesting_level),
- *handle);
+   EFI_PRINT("handle %p\n", *handle);
}
/* Add new protocol */
r = efi_add_protocol(*handle, protocol, protocol_interface);
@@ -2713,10 +2711,9 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t 
image_handle,
 * missed out steps of EFI_CALL.
 */
assert(__efi_entry_check());
-   debug("%sEFI: %lu returned by started image\n",
- __efi_nesting_dec(),
- (unsigned long)((uintptr_t)image_obj->exit_status &
- ~EFI_ERROR_MASK));
+   EFI_PRINT("%lu returned by started image\n",
+ (unsigned long)((uintptr_t)image_obj->exit_status &
+ ~EFI_ERROR_MASK));
current_image = parent_image;
return EFI_EXIT(image_obj->exit_status);
}
--
2.20.1

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


[U-Boot] [PATCH 1/1] efi_loader: CloseProtocol() requires valid agent handle

2019-05-05 Thread Heinrich Schuchardt
Return EFI_INVALID_PARAMETER from CloseProtcol() if the agent handle is not
valid.

Return EFI_INVALID_PARAMETER if the optional controller handle is not
valid.

Return immediately from efi_search_obj if the handle is NULL.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 9a6e1947a6..af9b2f4df3 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -971,11 +971,13 @@ struct efi_object *efi_search_obj(const efi_handle_t 
handle)
 {
struct efi_object *efiobj;

+   if (!handle)
+   return NULL;
+
list_for_each_entry(efiobj, _obj_list, link) {
if (efiobj == handle)
return efiobj;
}
-
return NULL;
 }

@@ -1982,7 +1984,8 @@ static efi_status_t EFIAPI 
efi_close_protocol(efi_handle_t handle,
EFI_ENTRY("%p, %pUl, %p, %p", handle, protocol, agent_handle,
  controller_handle);

-   if (!agent_handle) {
+   if (!efi_search_obj(agent_handle) ||
+   (controller_handle && !efi_search_obj(controller_handle))) {
r = EFI_INVALID_PARAMETER;
goto out;
}
--
2.20.1

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


Re: [U-Boot] ARM: omap3_logic: Enable UUID

2019-05-05 Thread Stefano Babic


On 03/05/19 20:32, Fabio Estevam wrote:
> Hi Stefano,
> 
> On Fri, Apr 26, 2019 at 7:11 AM  wrote:
>>
>>> Instead of hardcoding the mmcroot to /dev/mmcblkX, use the UUID
>>> method.
>>> Signed-off-by: Adam Ford 
>>> diff --git a/configs/omap35_logic_defconfig b/configs/omap35_logic_defconfig
>>> index 5b5f3eb7b4..9a1596c89b 100644
>>> --- a/configs/omap35_logic_defconfig
>>> +++ b/configs/omap35_logic_defconfig
> 
>> Applied to u-boot-imx, master, thanks !
> 
> Was this applied to the u-boot-imx tree by mistake?
> 
> This patch is for omap, not i.MX :-)
> 

Right, but the patch was assigned to me, it was just a small change in
config and then I applied on u-boot-imx.  Maybe the correct way for next
time is simply to change delegate in Patchwork and reassign the patch
(in this case, directly to Tom).


Stefano



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


[U-Boot] [PATCH v2 3/5] arm: dts: change MT7629 to use spi-mem rather than qspi

2019-05-05 Thread Weijie Gao
The original mtk_qspi driver has been removed. We change MT7629 to use
newly added mtk-spimem driver.

Signed-off-by: Weijie Gao 
---
Changes since v1: rename node spimem to snfi. change pinctrl name and order.
---
 arch/arm/dts/mt7629-rfb.dts | 18 +-
 arch/arm/dts/mt7629.dtsi| 14 ++
 2 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/arch/arm/dts/mt7629-rfb.dts b/arch/arm/dts/mt7629-rfb.dts
index 4612218a1eb..25f1344817d 100644
--- a/arch/arm/dts/mt7629-rfb.dts
+++ b/arch/arm/dts/mt7629-rfb.dts
@@ -13,7 +13,7 @@
compatible = "mediatek,mt7629-rfb", "mediatek,mt7629";
 
aliases {
-   spi0 = 
+   spi0 = 
};
 
chosen {
@@ -34,7 +34,14 @@
 };
 
  {
-   qspi_pins: qspi-pins {
+   snfi_pins: snfi-pins {
+   mux {
+   function = "flash";
+   groups = "snfi";
+   };
+   };
+
+   snor_pins: snor-pins {
mux {
function = "flash";
groups = "spi_nor";
@@ -56,9 +63,10 @@
};
 };
 
- {
-   pinctrl-names = "default";
-   pinctrl-0 = <_pins>;
+ {
+   pinctrl-names = "default", "snfi";
+   pinctrl-0 = <_pins>;
+   pinctrl-1 = <_pins>;
status = "okay";
 
spi-flash@0{
diff --git a/arch/arm/dts/mt7629.dtsi b/arch/arm/dts/mt7629.dtsi
index c87115e0fe4..135ac8ecfa2 100644
--- a/arch/arm/dts/mt7629.dtsi
+++ b/arch/arm/dts/mt7629.dtsi
@@ -215,10 +215,16 @@
status = "disabled";
};
 
-   qspi: qspi@11014000 {
-   compatible = "mediatek,mt7629-qspi";
-   reg = <0x11014000 0xe0>, <0x3000 0x1000>;
-   reg-names = "reg_base", "mem_base";
+   snfi: snfi@1100d000 {
+   compatible = "mediatek,mtk-snfi-spi";
+   reg = <0x1100d000 0x2000>;
+   clocks = < CLK_PERI_NFI_PD>,
+< CLK_PERI_SNFI_PD>;
+   clock-names = "nfi_clk", "pad_clk";
+   assigned-clocks = < CLK_TOP_AXI_SEL>,
+ < CLK_TOP_NFI_INFRA_SEL>;
+   assigned-clock-parents = < CLK_TOP_SYSPLL1_D2>,
+< CLK_TOP_UNIVPLL2_D8>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
-- 
2.18.0

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


[U-Boot] [PATCH v2 5/5] MAINTAINERS: change spi driver entry

2019-05-05 Thread Weijie Gao
Change mtk_qspi.c to mtk_snfi_spi.c

Signed-off-by: Weijie Gao 
---
Changes since v1: rename mtk_spimem.c to spi_snfi_spi.c
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index aa4b3bc6501..e2b7d7a36fb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -202,7 +202,7 @@ F:  drivers/mmc/mtk-sd.c
 F: drivers/pinctrl/mediatek/
 F: drivers/power/domain/mtk-power-domain.c
 F: drivers/ram/mediatek/
-F: drivers/spi/mtk_qspi.c
+F: drivers/spi/mtk_snfi_spi.c
 F: drivers/timer/mtk_timer.c
 F: drivers/watchdog/mtk_wdt.c
 F: drivers/net/mtk_eth.c
-- 
2.18.0

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


[U-Boot] [PATCH v2 4/5] configs: mt7629_rfb: change MTK_QSPI to MTK_SNFI_SPI

2019-05-05 Thread Weijie Gao
This patch replaces MTK_QSPI with MTK_SNFI_SPI to ensure mtk_snfi_spi
driver is built by default.

Signed-off-by: Weijie Gao 
---
 configs/mt7629_rfb_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/mt7629_rfb_defconfig b/configs/mt7629_rfb_defconfig
index 459c67827db..b32c547673e 100644
--- a/configs/mt7629_rfb_defconfig
+++ b/configs/mt7629_rfb_defconfig
@@ -62,7 +62,7 @@ CONFIG_DM_SERIAL=y
 CONFIG_MTK_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
-CONFIG_MTK_QSPI=y
+CONFIG_MTK_SNFI_SPI=y
 CONFIG_SYSRESET=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_TIMER=y
-- 
2.18.0

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


[U-Boot] [PATCH v2 2/5] spi: add spi-mem driver for MediaTek MT7629 SoC

2019-05-05 Thread Weijie Gao
This patch adds spi-mem driver for MediaTek MT7629 SoC to access SPI-NOR
and SPI-NAND flashes.

Cc: Jagan Teki 
Signed-off-by: Weijie Gao 
---
Changes since v1: rename mtk_spimem to spi_snfi_spi. change pinctrl name.
---
 drivers/spi/Kconfig|   9 +
 drivers/spi/Makefile   |   1 +
 drivers/spi/mtk_snfi_spi.c | 325 +
 3 files changed, 335 insertions(+)
 create mode 100644 drivers/spi/mtk_snfi_spi.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 92d7ca6d8cb..a3feca97f59 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -139,6 +139,15 @@ config MT7621_SPI
  the SPI NOR flash on platforms embedding this Ralink / MediaTek
  SPI core, like MT7621/7628/7688.
 
+config MTK_SNFI_SPI
+   bool "Mediatek SPI memory controller driver"
+   depends on SPI_MEM
+   help
+ Enable the Mediatek SPI memory controller driver. This driver is
+ originally based on the MediaTek SNFI IP core. It can only be
+ used to access SPI memory devices like SPI-NOR or SPI-NAND on
+ platforms embedding this IP core, like MT7622/M7629.
+
 config MVEBU_A3700_SPI
bool "Marvell Armada 3700 SPI driver"
select CLK_ARMADA_3720
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index f1e3becd2b7..5c639634777 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o
 obj-$(CONFIG_MESON_SPIFC) += meson_spifc.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
+obj-$(CONFIG_MTK_SNFI_SPI) += mtk_snfi_spi.o
 obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o
 obj-$(CONFIG_MSCC_BB_SPI) += mscc_bb_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
diff --git a/drivers/spi/mtk_snfi_spi.c b/drivers/spi/mtk_snfi_spi.c
new file mode 100644
index 000..230b7243d6f
--- /dev/null
+++ b/drivers/spi/mtk_snfi_spi.c
@@ -0,0 +1,325 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019 MediaTek Inc. All Rights Reserved.
+ *
+ * Author: Weijie Gao 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SNFI_MAC_CTL   0x500
+#define MAC_XIO_SELBIT(4)
+#define SF_MAC_EN  BIT(3)
+#define SF_TRIGBIT(2)
+#define WIP_READY  BIT(1)
+#define WIPBIT(0)
+
+#define SNFI_MAC_OUTL  0x504
+#define SNFI_MAC_INL   0x508
+
+#define SNFI_MISC_CTL  0x538
+#define SW_RST BIT(28)
+#define FIFO_RD_LTC_SHIFT  25
+#define FIFO_RD_LTCGENMASK(26, 25)
+#define LATCH_LAT_SHIFT8
+#define LATCH_LAT  GENMASK(9, 8)
+#define CS_DESELECT_CYC_SHIFT  0
+#define CS_DESELECT_CYCGENMASK(4, 0)
+
+#define SNF_STA_CTL1   0x550
+#define SPI_STATE  GENMASK(3, 0)
+
+#define SNFI_GPRAM_OFFSET  0x800
+#define SNFI_GPRAM_SIZE0x80
+
+#define SNFI_POLL_INTERVAL 50
+#define SNFI_RST_POLL_INTERVAL 100
+
+struct mtk_snfi_priv {
+   void __iomem *base;
+
+   struct udevice *dev;
+
+   struct clk nfi_clk;
+   struct clk pad_clk;
+};
+
+static int mtk_snfi_adjust_op_size(struct spi_slave *slave,
+  struct spi_mem_op *op)
+{
+   u32 nbytes;
+
+   /*
+* When there is input data, it will be appended after the output
+* data in the GPRAM. So the total size of either pure output data
+* or the output+input data must not exceed the GPRAM size.
+*/
+
+   nbytes = sizeof(op->cmd.opcode) + op->addr.nbytes +
+   op->dummy.nbytes;
+
+   if (nbytes + op->data.nbytes <= SNFI_GPRAM_SIZE)
+   return 0;
+
+   if (nbytes >= SNFI_GPRAM_SIZE)
+   return -ENOTSUPP;
+
+   op->data.nbytes = SNFI_GPRAM_SIZE - nbytes;
+
+   return 0;
+}
+
+static bool mtk_snfi_supports_op(struct spi_slave *slave,
+const struct spi_mem_op *op)
+{
+   if (op->cmd.buswidth > 1 || op->addr.buswidth > 1 ||
+   op->dummy.buswidth > 1 || op->data.buswidth > 1)
+   return false;
+
+   return true;
+}
+
+static int mtk_snfi_mac_trigger(struct mtk_snfi_priv *priv,
+   u32 outlen, u32 inlen)
+{
+   int ret;
+   u32 val;
+
+#ifdef CONFIG_PINCTRL
+   pinctrl_select_state(priv->dev, "snfi");
+#endif
+
+   writel(SF_MAC_EN, priv->base + SNFI_MAC_CTL);
+   writel(outlen, priv->base + SNFI_MAC_OUTL);
+   writel(inlen, priv->base + SNFI_MAC_INL);
+
+   writel(SF_MAC_EN | SF_TRIG, priv->base + SNFI_MAC_CTL);
+
+   ret = readl_poll_timeout(priv->base + SNFI_MAC_CTL, 

[U-Boot] [PATCH v2 0/5] Add spi-mem driver for MediaTek MT7629 SoC

2019-05-05 Thread Weijie Gao
Since u-boot has added the spi-mem framework and replaced the spi-nor
framework, the mtk_qspi is no longer compatible with the new spi-nor
driver.

This patch series add a new spi-mem driver to replace the mtk_qspi driver.

Weijie Gao (5):
  spi: remove obsolete mtk_qspi driver
  spi: add spi-mem driver for MediaTek MT7629 SoC
  arm: dts: change MT7629 to use spi-mem rather than qspi
  configs: mt7629_rfb: change MTK_QSPI to MTK_SNFI_SPI
  MAINTAINERS: change spi driver entry

 MAINTAINERS  |   2 +-
 arch/arm/dts/mt7629-rfb.dts  |  18 +-
 arch/arm/dts/mt7629.dtsi |  14 +-
 configs/mt7629_rfb_defconfig |   2 +-
 drivers/spi/Kconfig  |  15 +-
 drivers/spi/Makefile |   2 +-
 drivers/spi/mtk_qspi.c   | 359 ---
 drivers/spi/mtk_snfi_spi.c   | 325 +++
 8 files changed, 359 insertions(+), 378 deletions(-)
 delete mode 100644 drivers/spi/mtk_qspi.c
 create mode 100644 drivers/spi/mtk_snfi_spi.c

-- 
2.18.0

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


[U-Boot] [PATCH v2 1/5] spi: remove obsolete mtk_qspi driver

2019-05-05 Thread Weijie Gao
Since u-boot has added the spi-mem framework and replaced the spi-nor
framework, the mtk_qspi is no longer compatible with the new spi-nor
driver.

Remove this driver, and a new driver will be added later.

Cc: Jagan Teki 
Signed-off-by: Weijie Gao 
---
Changes since v1: none
---
 drivers/spi/Kconfig|   8 -
 drivers/spi/Makefile   |   1 -
 drivers/spi/mtk_qspi.c | 359 -
 3 files changed, 368 deletions(-)
 delete mode 100644 drivers/spi/mtk_qspi.c

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index fb794adae72..92d7ca6d8cb 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -139,14 +139,6 @@ config MT7621_SPI
  the SPI NOR flash on platforms embedding this Ralink / MediaTek
  SPI core, like MT7621/7628/7688.
 
-config MTK_QSPI
-   bool "Mediatek QSPI driver"
-   imply SPI_FLASH_BAR
-   help
- Enable the Mediatek QSPI driver. This driver can be
- used to access the SPI NOR flash on platforms embedding this
- Mediatek QSPI IP core.
-
 config MVEBU_A3700_SPI
bool "Marvell Armada 3700 SPI driver"
select CLK_ARMADA_3720
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 8be9a4baa24..f1e3becd2b7 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -36,7 +36,6 @@ obj-$(CONFIG_LPC32XX_SSP) += lpc32xx_ssp.o
 obj-$(CONFIG_MESON_SPIFC) += meson_spifc.o
 obj-$(CONFIG_MPC8XX_SPI) += mpc8xx_spi.o
 obj-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
-obj-$(CONFIG_MTK_QSPI) += mtk_qspi.o
 obj-$(CONFIG_MT7621_SPI) += mt7621_spi.o
 obj-$(CONFIG_MSCC_BB_SPI) += mscc_bb_spi.o
 obj-$(CONFIG_MVEBU_A3700_SPI) += mvebu_a3700_spi.o
diff --git a/drivers/spi/mtk_qspi.c b/drivers/spi/mtk_qspi.c
deleted file mode 100644
index b510733e92c..000
--- a/drivers/spi/mtk_qspi.c
+++ /dev/null
@@ -1,359 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (c) 2018  MediaTek, Inc.
- * Author : guochun@mediatek.com
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-/* Register Offset */
-struct mtk_qspi_regs {
-   u32 cmd;
-   u32 cnt;
-   u32 rdsr;
-   u32 rdata;
-   u32 radr[3];
-   u32 wdata;
-   u32 prgdata[6];
-   u32 shreg[10];
-   u32 cfg[2];
-   u32 shreg10;
-   u32 mode_mon;
-   u32 status[4];
-   u32 flash_time;
-   u32 flash_cfg;
-   u32 reserved_0[3];
-   u32 sf_time;
-   u32 pp_dw_data;
-   u32 reserved_1;
-   u32 delsel_0[2];
-   u32 intrstus;
-   u32 intren;
-   u32 reserved_2;
-   u32 cfg3;
-   u32 reserved_3;
-   u32 chksum;
-   u32 aaicmd;
-   u32 wrprot;
-   u32 radr3;
-   u32 dual;
-   u32 delsel_1[3];
-};
-
-struct mtk_qspi_platdata {
-   fdt_addr_t reg_base;
-   fdt_addr_t mem_base;
-};
-
-struct mtk_qspi_priv {
-   struct mtk_qspi_regs *regs;
-   unsigned long *mem_base;
-   u8 op;
-   u8 tx[3]; /* only record max 3 bytes paras, when it's address. */
-   u32 txlen; /* dout buffer length  - op code length */
-   u8 *rx;
-   u32 rxlen;
-};
-
-#define MTK_QSPI_CMD_POLLINGREG_US 50
-#define MTK_QSPI_WRBUF_SIZE256
-#define MTK_QSPI_COMMAND_ENABLE0x30
-
-/* NOR flash controller commands */
-#define MTK_QSPI_RD_TRIGGERBIT(0)
-#define MTK_QSPI_READSTATUSBIT(1)
-#define MTK_QSPI_PRG_CMD   BIT(2)
-#define MTK_QSPI_WR_TRIGGERBIT(4)
-#define MTK_QSPI_WRITESTATUS   BIT(5)
-#define MTK_QSPI_AUTOINC   BIT(7)
-
-#define MTK_QSPI_MAX_RX_TX_SHIFT   0x6
-#define MTK_QSPI_MAX_SHIFT 0x8
-
-#define MTK_QSPI_WR_BUF_ENABLE 0x1
-#define MTK_QSPI_WR_BUF_DISABLE0x0
-
-static int mtk_qspi_execute_cmd(struct mtk_qspi_priv *priv, u8 cmd)
-{
-   u8 tmp;
-   u8 val = cmd & ~MTK_QSPI_AUTOINC;
-
-   writeb(cmd, >regs->cmd);
-
-   return readb_poll_timeout(>regs->cmd, tmp, !(val & tmp),
- MTK_QSPI_CMD_POLLINGREG_US);
-}
-
-static int mtk_qspi_tx_rx(struct mtk_qspi_priv *priv)
-{
-   int len = 1 + priv->txlen + priv->rxlen;
-   int i, ret, idx;
-
-   if (len > MTK_QSPI_MAX_SHIFT)
-   return -ERR_INVAL;
-
-   writeb(len * 8, >regs->cnt);
-
-   /* start at PRGDATA5, go down to PRGDATA0 */
-   idx = MTK_QSPI_MAX_RX_TX_SHIFT - 1;
-
-   /* opcode */
-   writeb(priv->op, >regs->prgdata[idx]);
-   idx--;
-
-   /* program TX data */
-   for (i = 0; i < priv->txlen; i++, idx--)
-   writeb(priv->tx[i], >regs->prgdata[idx]);
-
-   /* clear out rest of TX registers */
-   while (idx >= 0) {
-   writeb(0, >regs->prgdata[idx]);
-   idx--;
-   }
-
-   ret = mtk_qspi_execute_cmd(priv, MTK_QSPI_PRG_CMD);
-   if (ret)
-   return ret;
-
-   /* restart at first RX byte */
-   idx = priv->rxlen - 1;
-
-   /* read out RX data */
-   for (i = 0; i < priv->rxlen; i++, 

Re: [U-Boot] [PATCH 3/3] arm: mvebu: db-88f6820-gp: Enabel BLK and DM support

2019-05-05 Thread Chris Packham
On Fri, 3 May 2019, 6:43 PM Stefan Roese,  wrote:

> This patch enables CONFIG_BLK and some DM enabled drivers on
> db-88f6820-gp to remove these compile warnings:
>
> = WARNING ==
> This board does not use CONFIG_DM_MMC. Please update
> the board to use CONFIG_DM_MMC before the v2019.04 release.
> Failure to update by the deadline may result in board removal.
> See doc/driver-model/MIGRATION.txt for more info.
> 
> = WARNING ==
> This board does not use CONFIG_DM_USB. Please update
> the board to use CONFIG_DM_USB before the v2019.07 release.
> Failure to update by the deadline may result in board removal.
> See doc/driver-model/MIGRATION.txt for more info.
> 
> = WARNING ==
> This board does use CONFIG_LIBATA but has CONFIG_AHCI not
> enabled. Please update the storage controller driver to use
> CONFIG_AHCI before the v2019.07 release.
> Failure to update by the deadline may result in board removal.
> See doc/driver-model/MIGRATION.txt for more info.
> 
>
> Signed-off-by: Stefan Roese 
>

Typo in subject line. Other than that

Reviewed-by: Chris Packham 

---
>  configs/db-88f6820-gp_defconfig | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/configs/db-88f6820-gp_defconfig
> b/configs/db-88f6820-gp_defconfig
> index 6ee3151861..b8f036e317 100644
> --- a/configs/db-88f6820-gp_defconfig
> +++ b/configs/db-88f6820-gp_defconfig
> @@ -13,6 +13,7 @@ CONFIG_DEBUG_UART_CLOCK=25000
>  CONFIG_SPL_SPI_FLASH_SUPPORT=y
>  CONFIG_SPL_SPI_SUPPORT=y
>  CONFIG_DEBUG_UART=y
> +CONFIG_AHCI=y
>  CONFIG_BOOTDELAY=3
>  CONFIG_SYS_CONSOLE_INFO_QUIET=y
>  # CONFIG_DISPLAY_BOARDINFO is not set
> @@ -47,7 +48,8 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y
>  CONFIG_USE_ENV_SPI_MAX_HZ=y
>  CONFIG_ENV_SPI_MAX_HZ=5000
>  CONFIG_SPL_OF_TRANSLATE=y
> -CONFIG_SCSI_AHCI=y
> +CONFIG_AHCI_MVEBU=y
> +CONFIG_DM_MMC=y
>  CONFIG_MMC_SDHCI=y
>  CONFIG_MMC_SDHCI_SDMA=y
>  CONFIG_MMC_SDHCI_MV=y
> --
> 2.21.0
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] efi_loader: allowable event types in CreateEventEx()

2019-05-05 Thread Alexander Graf


On 04.05.19 10:17, Heinrich Schuchardt wrote:

CreateEventEx() does allow the following event types:



... not ...




* EVT_SIGNAL_EXIT_BOOT_SERVICES
* EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE

Signed-off-by: Heinrich Schuchardt 



Did you find this proactively or is it fixing some SCT test case? After 
all, functionally the change should be a no-op, because no payload 
should create those events in the first place :). I would just like to 
see some comment about the reasoning in the commit message.


Either way, this is definitely getting us closer to spec conformance, so 
good to have. Maybe one day (if we grow too much), we can have some 
smarts somewhere that allow us to skip all those sanity checks in small 
builds.


Reviewed-by: Alexander Graf 


Alex


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


Re: [U-Boot] [PATCH] arm: socfpga: control reboot from SRAM via env callback

2019-05-05 Thread Simon Goldschmidt



On 05.05.19 03:42, Marek Vasut wrote:

On 5/4/19 9:10 PM, Simon Goldschmidt wrote:

Am 04.05.2019 um 20:43 schrieb Marek Vasut:

On 5/3/19 10:53 PM, Simon Goldschmidt wrote:



Marek Vasut mailto:ma...@denx.de>> schrieb am Fr., 3.
Mai 2019, 22:42:

  On 5/3/19 10:39 PM, Simon Goldschmidt wrote:
  >
  >
  > On 03.05.19 22:35, Marek Vasut wrote:
  >> On 5/3/19 10:30 PM, Simon Goldschmidt wrote:
  >>>
  >>>
  >>> On 03.05.19 22:28, Marek Vasut wrote:
   On 5/3/19 10:08 PM, Simon Goldschmidt wrote:
  > This moves the code that enables the Boot ROM to just jump
to SRAM
  > instead
  > of loading SPL from the original boot source on warm reboot.
  >
  > Instead of always enabling this, an environment callback
for the
  > env var
  > "socfpga_reboot_from_sram" is used. This way, the
behaviour can be
  > enabled
  > at runtime and via saved environment.
  >
  > Signed-off-by: Simon Goldschmidt
  mailto:simon.k.r.goldschm...@gmail.com>>
  
   Would that be like a default "reset" command action ?
   This probably shouldn't be socfpga specific then.
  >>>
  >>> No, it's a thing that lives on and influences even the soft
  reset issued
  >>> by linux "reboot" command. This is something *very* socfpga
  specific.
  >>
  >> Hmmm, so isn't this a policy to be configured on the Linux end ?
  >
  > Might be, but it affects U-Boot's 'reset' command as well. And
I guess
  > it's set up in U-Boot this early to ensure it always works.

  Drat, that's right. So there has to be some way to agree on how the
  reset works between the kernel and U-Boot ?

  > If it were for me, we could drop writing this magic
altogether. I just
  > figured some boards might require it to be written somewhere,
and came
  > up with a patch that might save those boards with the way it was
  before.

  Isn't this magic actually used by bootrom ?


Right. It tells the boot rom to jump to ocram on next reboot instead of
loading spl from qspi or mmc. But if that's required or not a good idea
at all depends on many factors. Some of them board related, some U-Boot
related and some Linux related (depending on the hardware and drivers
used).


Should that be runtime configurable then ?


Since it might depend on Linux putting the qspi chip into a state where
it's not accessible by the boot ROM. That might change without
rebuilding U-Boot.


If Linux switches the chip into some weird mode the bootrom cannot cope
with, it's a reset routing problem. This cannot be fixed in software.


No, it cannot be fixed, but currently there's a workaround for those 
boards and I thought it was worth to keep this workaround, even though 
my own boards will be fixed and not require such a workaround in the 
future :-)





On the other hand, this is probably more of a U-Boot build time config.
I could make it a Kconfig option as well...

Regards,
Simon




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