Re: [U-Boot] [PATCH] i2c: remove SYS_ prefix from CONFIG options

2017-10-18 Thread Masahiro Yamada
Hi Heiko,


2017-10-19 13:38 GMT+09:00 Heiko Schocher :
> Hello Masahiro,
>
>
> Am 17.10.2017 um 15:36 schrieb Masahiro Yamada:
>>
>> Historically, U-Boot added CONFIG_SYS_ prefix to user-unconfigurable
>> options.  Somehow, this rule was not observed in some places, and
>> getting meaningless with Kconfig introduction where platforms can
>> "select" to force options.  Actually, I2C drivers are generally
>> configurable.
>>
>> Convert the options in drivers/i2c/Kconfig.
>>
>> This commit was generated by the following command.
>>
>> find . -name .git -prune -o -type f -print | \
>> xargs sed -i -e '
>> s/SYS_I2C_AT91/I2C_AT91/g
>> s/SYS_I2C_FSL/I2C_FSL/g
>> s/SYS_I2C_CADENCE/I2C_CADENCE/g
>> s/SYS_I2C_DW/I2C_DW/g
>> s/SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED/I2C_DW_ENABLE_STATUS_UNSUPPORTED/g
>> s/SYS_I2C_ASPEED/I2C_ASPEED/g
>> s/SYS_I2C_INTEL/I2C_INTEL/g
>> s/SYS_I2C_IMX_LPI2C/I2C_IMX_LPI2C/g
>> s/SYS_I2C_MXC/I2C_MXC/g
>> s/SYS_I2C_OMAP24XX/I2C_OMAP24XX/g
>> s/SYS_I2C_ROCKCHIP/I2C_ROCKCHIP/g
>> s/SYS_I2C_SANDBOX/I2C_SANDBOX/g
>> s/SYS_I2C_S3C24X0/I2C_S3C24X0/g
>> s/SYS_I2C_STM32F7/I2C_STM32F7/g
>> s/SYS_I2C_UNIPHIER/I2C_UNIPHIER/g
>> s/SYS_I2C_UNIPHIER_F/I2C_UNIPHIER_F/g
>> s/SYS_I2C_MVTWSI/I2C_MVTWSI/g
>> s/TEGRA186_BPMP_I2C/I2C_TEGRA186_BPMP/g
>> s/SYS_I2C_BUS_MAX/I2C_BUS_MAX/g
>> '
>>
>> Signed-off-by: Masahiro Yamada 
>
>
>
> Thanks ... but why do you not convert all symbols?
>

Good question.

I thought legacy options should
be moved to Kconfig and renamed at the same time.
I prefer one-time churn to twice.


I sometimes do that.
For example, commit 1d2c0506d31a9997e5ffc22e90942902f673b107


I assume your next question about Kconfig move.

Yeah, if I find some time this week,
I think I can do rename-and-move for the rest of options.

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


Re: [U-Boot] [PATCH] i2c: remove SYS_ prefix from CONFIG options

2017-10-18 Thread Heiko Schocher

Hello Masahiro,

Am 17.10.2017 um 15:36 schrieb Masahiro Yamada:

Historically, U-Boot added CONFIG_SYS_ prefix to user-unconfigurable
options.  Somehow, this rule was not observed in some places, and
getting meaningless with Kconfig introduction where platforms can
"select" to force options.  Actually, I2C drivers are generally
configurable.

Convert the options in drivers/i2c/Kconfig.

This commit was generated by the following command.

find . -name .git -prune -o -type f -print | \
xargs sed -i -e '
s/SYS_I2C_AT91/I2C_AT91/g
s/SYS_I2C_FSL/I2C_FSL/g
s/SYS_I2C_CADENCE/I2C_CADENCE/g
s/SYS_I2C_DW/I2C_DW/g
s/SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED/I2C_DW_ENABLE_STATUS_UNSUPPORTED/g
s/SYS_I2C_ASPEED/I2C_ASPEED/g
s/SYS_I2C_INTEL/I2C_INTEL/g
s/SYS_I2C_IMX_LPI2C/I2C_IMX_LPI2C/g
s/SYS_I2C_MXC/I2C_MXC/g
s/SYS_I2C_OMAP24XX/I2C_OMAP24XX/g
s/SYS_I2C_ROCKCHIP/I2C_ROCKCHIP/g
s/SYS_I2C_SANDBOX/I2C_SANDBOX/g
s/SYS_I2C_S3C24X0/I2C_S3C24X0/g
s/SYS_I2C_STM32F7/I2C_STM32F7/g
s/SYS_I2C_UNIPHIER/I2C_UNIPHIER/g
s/SYS_I2C_UNIPHIER_F/I2C_UNIPHIER_F/g
s/SYS_I2C_MVTWSI/I2C_MVTWSI/g
s/TEGRA186_BPMP_I2C/I2C_TEGRA186_BPMP/g
s/SYS_I2C_BUS_MAX/I2C_BUS_MAX/g
'

Signed-off-by: Masahiro Yamada 



Thanks ... but why do you not convert all symbols?

With your patch there are now CONFIG_I2C and CONFIG_SYS_I2C symbols
mixed. Please send another patch where you convert the missing:

SYS_I2C_ADI
SYS_I2C
SYS_I2C_DAVINCI
SYS_I2C_FTI2C010
SYS_I2C_IHS
SYS_I2C_KONA
SYS_I2C_LPC32XX
SYS_I2C_MXS
SYS_I2C_RCAR
SYS_I2C_SH
SYS_I2C_SOFT
SYS_I2C_TEGRA
SYS_I2C_ZYNQ

Beside of this I like this change.

bye,
Heiko

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


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

2017-10-18 Thread Bin Meng
Hi Tom,

This includes a critical bug fix for Baytrail ACPI suspend/resume and
some other minor clean ups.

The following changes since commit 6b0fea33424dcce82b6df0c6b3774601eb1ff36a:

  Merge git://git.denx.de/u-boot-i2c (2017-10-18 09:32:35 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-x86.git

for you to fetch changes up to 9af43acba6ea1fe6de29150b8bd3eb0126ba6a15:

  x86: conga-qeval20-qa3-e3845-internal-uart_defconfig: Add ACPI
resume support (2017-10-19 11:37:51 +0800)


Bin Meng (6):
  x86: minnowmax: Adjust VGA rom address
  x86: baytrail: Fix unstable ACPI S3 resume
  x86: Turn off running VGA ROM during S3 resume
  x86: fsp: Consolidate Azalia header file
  x86: baytrail: fsp: Use a function to update the Azalia config pointer
  x86: baytrail: fsp: Move Azalia update codes to board

Heinrich Schuchardt (1):
  x86: provide CONFIG_BUILD_ROM

Stefan Roese (1):
  x86: conga-qeval20-qa3-e3845-internal-uart_defconfig: Add ACPI
resume support

 Kconfig   |   9 +
 Makefile  |   2 +-
 arch/x86/Kconfig  |   1 -
 arch/x86/cpu/baytrail/fsp_configs.c   | 117
+
 arch/x86/cpu/baytrail/valleyview.c|  22

 arch/x86/include/asm/arch-baytrail/fsp/azalia.h   |  39
---
 arch/x86/include/asm/arch-baytrail/fsp/fsp_vpd.h  |   2 +-
 arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h  |  26

 arch/x86/include/asm/fsp/fsp_azalia.h |  39
+++
 arch/x86/include/asm/fsp/fsp_support.h|   1 +
 board/advantech/som-db5800-som-6867/som-db5800-som-6867.c | 111
+++
 configs/conga-qeval20-qa3-e3845-internal-uart_defconfig   |   1 +
 configs/minnowmax_defconfig   |   1 +
 configs/qemu-x86_64_defconfig |   1 +
 configs/qemu-x86_defconfig|   1 +
 doc/README.x86|  12 +++
 16 files changed, 206 insertions(+), 179 deletions(-)
 delete mode 100644 arch/x86/include/asm/arch-baytrail/fsp/azalia.h
 create mode 100644 arch/x86/include/asm/fsp/fsp_azalia.h

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


Re: [U-Boot] [PATCH v4 1/1] x86: provide CONFIG_BUILD_ROM

2017-10-18 Thread Bin Meng
On Tue, Oct 17, 2017 at 4:52 PM, Bin Meng  wrote:
> On Tue, Oct 17, 2017 at 2:08 AM, Heinrich Schuchardt  
> wrote:
>> Up to now we depended on an exported variable to build u-boot.rom.
>> We should be able to specify it in the configuration file, too.
>>
>> With this patch this becomes possible using the new Kconfig option
>> CONFIG_BUILD_ROM.
>>
>> This option depends on CONFIG_X86 and is selected in
>> qemu-x86_defconfig and qemu-x86_64_defconfig.
>>
>> Cc: Simon Glass 
>> Cc: Bin Meng 
>> Signed-off-by: Heinrich Schuchardt 
>> ---
>> v4
>> Place BUILD_ROM in defconfig according to the sequence of
>> the generated .config.
>> Remove default=n
>> v3
>> Rework the documentation. Simon suggested not to deprecate
>> the export variable.
>> v2
>> Enable CONFIG_BUILD_ROM for qemu-x86_64_defconfig
>> as suggested by Bin.
>> Fix typos.
>> ---
>>  Kconfig   |  9 +
>>  Makefile  |  2 +-
>>  configs/qemu-x86_64_defconfig |  1 +
>>  configs/qemu-x86_defconfig|  1 +
>>  doc/README.x86| 10 +++---
>>  5 files changed, 19 insertions(+), 4 deletions(-)
>>
>
> Reviewed-by: Bin Meng 

applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] x86: baytrail: fsp: Use a function to update the Azalia config pointer

2017-10-18 Thread Bin Meng
On Fri, Oct 13, 2017 at 7:14 PM, Stefan Roese  wrote:
> On 13.10.2017 10:30, Bin Meng wrote:
>>
>> At present we directly pass the Azalia config pointer to the FSP UPD.
>> This updates to use a function to do the stuff, like Braswell does.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>   arch/x86/cpu/baytrail/fsp_configs.c  | 15 +--
>>   arch/x86/include/asm/arch-baytrail/fsp/fsp_vpd.h |  2 +-
>>   2 files changed, 14 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/cpu/baytrail/fsp_configs.c
>> b/arch/x86/cpu/baytrail/fsp_configs.c
>> index 926f26b..3052fb6 100644
>> --- a/arch/x86/cpu/baytrail/fsp_configs.c
>> +++ b/arch/x86/cpu/baytrail/fsp_configs.c
>> @@ -120,6 +120,17 @@ const struct azalia_config azalia_config = {
>>   };
>> /**
>> + * Override the FSP's Azalia configuration data
>> + *
>> + * @azalia:pointer to be updated to point to a ROM address where
>> Azalia
>> + * configuration data is stored
>> + */
>> +static void update_fsp_azalia_configs(struct azalia_config **azalia)
>> +{
>> +   *azalia = (struct azalia_config *)_config;
>> +}
>> +
>> +/**
>>* Override the FSP's configuration data.
>>* If the device tree does not specify an integer setting, use the
>> default
>>* provided in Intel's Baytrail_FSP_Gold4.tgz release
>> FSP/BayleyBayFsp.bsf file.
>> @@ -137,8 +148,6 @@ void update_fsp_configs(struct fsp_config_data
>> *config,
>> rt_buf->common.boot_mode = config->common.boot_mode;
>> rt_buf->common.upd_data = >fsp_upd;
>>   - fsp_upd->azalia_config_ptr = (uint32_t)_config;
>> -
>> node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_BAYTRAIL_FSP);
>> if (node < 0) {
>> debug("%s: Cannot find FSP node\n", __func__);
>> @@ -173,6 +182,8 @@ void update_fsp_configs(struct fsp_config_data
>> *config,
>> SATA_MODE_AHCI);
>> fsp_upd->enable_azalia = fdtdec_get_bool(blob, node,
>>  "fsp,enable-azalia");
>> +   if (fsp_upd->enable_azalia)
>> +   update_fsp_azalia_configs(_upd->azalia_cfg_ptr);
>> fsp_upd->enable_xhci = fdtdec_get_bool(blob, node,
>> "fsp,enable-xhci");
>> fsp_upd->lpe_mode = fdtdec_get_int(blob, node, "fsp,lpe-mode",
>>LPE_MODE_PCI);
>> diff --git a/arch/x86/include/asm/arch-baytrail/fsp/fsp_vpd.h
>> b/arch/x86/include/asm/arch-baytrail/fsp/fsp_vpd.h
>> index 8c07b37..e2f0e39 100644
>> --- a/arch/x86/include/asm/arch-baytrail/fsp/fsp_vpd.h
>> +++ b/arch/x86/include/asm/arch-baytrail/fsp/fsp_vpd.h
>> @@ -45,7 +45,7 @@ struct __packed upd_region {
>> uint8_t enable_sata;/* Offset 0x002d */
>> uint8_t sata_mode;  /* Offset 0x002e */
>> uint8_t enable_azalia;  /* Offset 0x002f */
>> -   uint32_t azalia_config_ptr; /* Offset 0x0030 */
>> +   struct azalia_config *azalia_cfg_ptr;   /* Offset 0x0030 */
>> uint8_t enable_xhci;/* Offset 0x0034 */
>> uint8_t lpe_mode;   /* Offset 0x0035 */
>> uint8_t lpss_sio_mode;  /* Offset 0x0036 */
>>
>
> Reviewed-by: Stefan Roese 

applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] x86: conga-qeval20-qa3-e3845-internal-uart_defconfig: Add ACPI resume support

2017-10-18 Thread Bin Meng
On Tue, Oct 17, 2017 at 4:51 PM, Bin Meng  wrote:
> On Tue, Oct 17, 2017 at 2:09 PM, Stefan Roese  wrote:
>> I've missed to add the ACPI resume support to this x86 build target.
>> This patch adds the ACPI resume support enabling S3 suspend /
>> resume.
>>
>> Signed-off-by: Stefan Roese 
>> Cc: Bin Meng 
>> Cc: Simon Glass 
>> ---
>>  configs/conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>
> Reviewed-by: Bin Meng 

applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/3] x86: baytrail: fsp: Move Azalia update codes to board

2017-10-18 Thread Bin Meng
On Fri, Oct 13, 2017 at 7:14 PM, Stefan Roese  wrote:
> On 13.10.2017 10:30, Bin Meng wrote:
>>
>> Azalia configuration may be different across boards, hence it's not
>> appropriate to do that in the SoC level. Instead, let's make the
>> SoC update_fsp_azalia_configs() routine as a weak version, and do
>> the actual work in the board codes.
>>
>> So far it seems only som-db5800-som-6867 board enables the Azalia.
>> Move the original codes into som-db5800-som-6867.c.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>   arch/x86/cpu/baytrail/fsp_configs.c| 111
>> +
>>   .../som-db5800-som-6867/som-db5800-som-6867.c  | 111
>> +
>>   2 files changed, 113 insertions(+), 109 deletions(-)
>>
>> diff --git a/arch/x86/cpu/baytrail/fsp_configs.c
>> b/arch/x86/cpu/baytrail/fsp_configs.c
>> index 3052fb6..6b762e5 100644
>> --- a/arch/x86/cpu/baytrail/fsp_configs.c
>> +++ b/arch/x86/cpu/baytrail/fsp_configs.c
>> @@ -12,122 +12,15 @@
>> DECLARE_GLOBAL_DATA_PTR;
>>   -/* ALC262 Verb Table - 10EC0262 */
>> -static const u32 verb_table_data13[] = {
>> -   /* Pin Complex (NID 0x11) */
>> -   0x01171cf0,
>> -   0x01171d11,
>> -   0x01171e11,
>> -   0x01171f41,
>> -   /* Pin Complex (NID 0x12) */
>> -   0x01271cf0,
>> -   0x01271d11,
>> -   0x01271e11,
>> -   0x01271f41,
>> -   /* Pin Complex (NID 0x14) */
>> -   0x01471c10,
>> -   0x01471d40,
>> -   0x01471e01,
>> -   0x01471f01,
>> -   /* Pin Complex (NID 0x15) */
>> -   0x01571cf0,
>> -   0x01571d11,
>> -   0x01571e11,
>> -   0x01571f41,
>> -   /* Pin Complex (NID 0x16) */
>> -   0x01671cf0,
>> -   0x01671d11,
>> -   0x01671e11,
>> -   0x01671f41,
>> -   /* Pin Complex (NID 0x18) */
>> -   0x01871c20,
>> -   0x01871d98,
>> -   0x01871ea1,
>> -   0x01871f01,
>> -   /* Pin Complex (NID 0x19) */
>> -   0x01971c21,
>> -   0x01971d98,
>> -   0x01971ea1,
>> -   0x01971f02,
>> -   /* Pin Complex (NID 0x1A) */
>> -   0x01a71c2f,
>> -   0x01a71d30,
>> -   0x01a71e81,
>> -   0x01a71f01,
>> -   /* Pin Complex */
>> -   0x01b71c1f,
>> -   0x01b71d40,
>> -   0x01b71e21,
>> -   0x01b71f02,
>> -   /* Pin Complex */
>> -   0x01c71cf0,
>> -   0x01c71d11,
>> -   0x01c71e11,
>> -   0x01c71f41,
>> -   /* Pin Complex */
>> -   0x01d71c01,
>> -   0x01d71dc6,
>> -   0x01d71e14,
>> -   0x01d71f40,
>> -   /* Pin Complex */
>> -   0x01e71cf0,
>> -   0x01e71d11,
>> -   0x01e71e11,
>> -   0x01e71f41,
>> -   /* Pin Complex */
>> -   0x01f71cf0,
>> -   0x01f71d11,
>> -   0x01f71e11,
>> -   0x01f71f41,
>> -};
>> -
>> -/*
>> - * This needs to be in ROM since if we put it in CAR, FSP init loses it
>> when
>> - * it drops CAR.
>> - *
>> - * TODO(s...@chromium.org): Move to device tree when FSP allows it
>> - *
>> - * VerbTable: (RealTek ALC262)
>> - * Revision ID = 0xFF, support all steps
>> - * Codec Verb Table For AZALIA
>> - * Codec Address: CAd value (0/1/2)
>> - * Codec Vendor: 0x10EC0262
>> - */
>> -static const struct azalia_verb_table azalia_verb_table[] = {
>> -   {
>> -   {
>> -   0x10ec0262,
>> -   0x,
>> -   0xff,
>> -   0x01,
>> -   0x000b,
>> -   0x0002,
>> -   },
>> -   verb_table_data13
>> -   }
>> -};
>> -
>> -const struct azalia_config azalia_config = {
>> -   .pme_enable = 1,
>> -   .docking_supported = 1,
>> -   .docking_attached = 0,
>> -   .hdmi_codec_enable = 1,
>> -   .azalia_v_ci_enable = 1,
>> -   .rsvdbits = 0,
>> -   .verb_table_num = 1,
>> -   .verb_table = azalia_verb_table,
>> -   .reset_wait_timer_ms = 300
>> -};
>> -
>>   /**
>>* Override the FSP's Azalia configuration data
>>*
>>* @azalia:   pointer to be updated to point to a ROM address where
>> Azalia
>>*configuration data is stored
>>*/
>> -static void update_fsp_azalia_configs(struct azalia_config **azalia)
>> +__weak void update_fsp_azalia_configs(struct azalia_config **azalia)
>>   {
>> -   *azalia = (struct azalia_config *)_config;
>> +   *azalia = NULL;
>>   }
>> /**
>> diff --git a/board/advantech/som-db5800-som-6867/som-db5800-som-6867.c
>> b/board/advantech/som-db5800-som-6867/som-db5800-som-6867.c
>> index 6158795..202e9875 100644
>> --- a/board/advantech/som-db5800-som-6867/som-db5800-som-6867.c
>> +++ b/board/advantech/som-db5800-som-6867/som-db5800-som-6867.c
>> @@ -6,6 +6,117 @@
>>*/
>> #include 
>> +#include 
>> +
>> +/* ALC262 Verb Table - 10EC0262 */
>> +static const u32 verb_table_data13[] = {
>> +   /* Pin Complex (NID 0x11) */
>> +   0x01171cf0,
>> +   0x01171d11,
>> +   0x01171e11,
>> +  

Re: [U-Boot] [PATCH 1/3] x86: fsp: Consolidate Azalia header file

2017-10-18 Thread Bin Meng
On Fri, Oct 13, 2017 at 7:14 PM, Stefan Roese  wrote:
> On 13.10.2017 10:30, Bin Meng wrote:
>>
>> So far there are two copies of Azalia struct defines with one in
>> baytrail and the other one in braswell. This consolidates these
>> two into one, put it in the common place, and remove the prefix
>> pch_ to these structs to make their names more generic.
>>
>> This also corrects reset_wait_timer from us to ms.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>   arch/x86/cpu/baytrail/fsp_configs.c  | 13 
>>   arch/x86/include/asm/arch-baytrail/fsp/azalia.h  | 39
>> 
>>   arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h | 26 
>>   arch/x86/include/asm/fsp/fsp_azalia.h| 39
>> 
>>   arch/x86/include/asm/fsp/fsp_support.h   |  1 +
>>   5 files changed, 46 insertions(+), 72 deletions(-)
>>   delete mode 100644 arch/x86/include/asm/arch-baytrail/fsp/azalia.h
>>   create mode 100644 arch/x86/include/asm/fsp/fsp_azalia.h
>>
>> diff --git a/arch/x86/cpu/baytrail/fsp_configs.c
>> b/arch/x86/cpu/baytrail/fsp_configs.c
>> index 45f9bf9..926f26b 100644
>> --- a/arch/x86/cpu/baytrail/fsp_configs.c
>> +++ b/arch/x86/cpu/baytrail/fsp_configs.c
>> @@ -8,13 +8,12 @@
>> #include 
>>   #include 
>> -#include 
>>   #include 
>> DECLARE_GLOBAL_DATA_PTR;
>> /* ALC262 Verb Table - 10EC0262 */
>> -static const uint32_t verb_table_data13[] = {
>> +static const u32 verb_table_data13[] = {
>> /* Pin Complex (NID 0x11) */
>> 0x01171cf0,
>> 0x01171d11,
>> @@ -94,7 +93,7 @@ static const uint32_t verb_table_data13[] = {
>>* Codec Address: CAd value (0/1/2)
>>* Codec Vendor: 0x10EC0262
>>*/
>> -static const struct pch_azalia_verb_table azalia_verb_table[] = {
>> +static const struct azalia_verb_table azalia_verb_table[] = {
>> {
>> {
>> 0x10ec0262,
>> @@ -108,16 +107,16 @@ static const struct pch_azalia_verb_table
>> azalia_verb_table[] = {
>> }
>>   };
>>   -const struct pch_azalia_config azalia_config = {
>> +const struct azalia_config azalia_config = {
>> .pme_enable = 1,
>> .docking_supported = 1,
>> .docking_attached = 0,
>> .hdmi_codec_enable = 1,
>> .azalia_v_ci_enable = 1,
>> .rsvdbits = 0,
>> -   .azalia_verb_table_num = 1,
>> -   .azalia_verb_table = azalia_verb_table,
>> -   .reset_wait_timer_us = 300
>> +   .verb_table_num = 1,
>> +   .verb_table = azalia_verb_table,
>> +   .reset_wait_timer_ms = 300
>>   };
>> /**
>> diff --git a/arch/x86/include/asm/arch-baytrail/fsp/azalia.h
>> b/arch/x86/include/asm/arch-baytrail/fsp/azalia.h
>> deleted file mode 100644
>> index d96a20f..000
>> --- a/arch/x86/include/asm/arch-baytrail/fsp/azalia.h
>> +++ /dev/null
>> @@ -1,39 +0,0 @@
>> -/*
>> - * Copyright (C) 2013, Intel Corporation
>> - * Copyright (C) 2015 Google, Inc
>> - *
>> - * SPDX-License-Identifier:Intel
>> - */
>> -
>> -#ifndef _FSP_AZALIA_H_
>> -#define _FSP_AZALIA_H_
>> -
>> -struct __packed pch_azalia_verb_table_header {
>> -   uint32_t vendor_device_id;
>> -   uint16_t sub_system_id;
>> -   uint8_t revision_id;/* 0xff applies to all steppings
>> */
>> -   uint8_t front_panel_support;
>> -   uint16_t number_of_rear_jacks;
>> -   uint16_t number_of_front_jacks;
>> -};
>> -
>> -struct __packed pch_azalia_verb_table {
>> -   struct pch_azalia_verb_table_header verb_table_header;
>> -   const uint32_t *verb_table_data;
>> -};
>> -
>> -struct __packed pch_azalia_config {
>> -   uint8_t pme_enable:1;
>> -   uint8_t docking_supported:1;
>> -   uint8_t docking_attached:1;
>> -   uint8_t hdmi_codec_enable:1;
>> -   uint8_t azalia_v_ci_enable:1;
>> -   uint8_t rsvdbits:3;
>> -   /* number of verb tables provided by platform */
>> -   uint8_t azalia_verb_table_num;
>> -   const struct pch_azalia_verb_table *azalia_verb_table;
>> -   /* delay timer after azalia reset */
>> -   uint16_t reset_wait_timer_us;
>> -};
>> -
>> -#endif
>> diff --git a/arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h
>> b/arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h
>> index ecb01fa..99c4c0a 100644
>> --- a/arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h
>> +++ b/arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h
>> @@ -29,32 +29,6 @@ struct __packed memory_upd {
>> u8 reserved[189];   /* Offset 0x0043 */
>>   };
>>   -struct __packed azalia_verb_table_header {
>> -   u32 vendor_device_id;
>> -   u16 sub_system_id;
>> -   u8 revision_id;
>> -   u8 front_panel_support;
>> -   u16 number_of_rear_jacks;
>> -   u16 number_of_front_jacks;
>> -};
>> -
>> -struct __packed azalia_verb_table {
>> -   struct azalia_verb_table_header header;
>> -   u32 *data;
>> -};
>> -
>> -struct __packed azalia_config {
>> 

Re: [U-Boot] [PATCH 2/2] x86: Turn off running VGA ROM during S3 resume

2017-10-18 Thread Bin Meng
On Fri, Oct 13, 2017 at 7:09 PM, Stefan Roese  wrote:
> On 12.10.2017 14:07, Bin Meng wrote:
>>
>> This is only needed when graphics console is used. For kernel with
>> native graphics driver, this can be turned off to speed up.
>>
>> Change this option's default to n in the Kconfig.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>   arch/x86/Kconfig | 1 -
>>   1 file changed, 1 deletion(-)
>>
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index 38a6187..c869ae2 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -677,7 +677,6 @@ config HAVE_ACPI_RESUME
>>   config S3_VGA_ROM_RUN
>> bool "Re-run VGA option ROMs on S3 resume"
>> depends on HAVE_ACPI_RESUME
>> -   default y if HAVE_ACPI_RESUME
>> help
>>   Execute VGA option ROMs in U-Boot when resuming from S3.
>> Normally
>>   this is needed when graphics console is being used in the
>> kernel.
>>
>
> Reviewed-by: Stefan Roese 
>

applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] x86: baytrail: Fix unstable ACPI S3 resume

2017-10-18 Thread Bin Meng
On Fri, Oct 13, 2017 at 7:09 PM, Stefan Roese  wrote:
> On 12.10.2017 14:07, Bin Meng wrote:
>>
>> It was observed that when booting a Ubuntu 16.04 kernel, doing ACPI
>> S3 suspend/resume sometimes causes the Ubuntu kernel hang forever.
>> The issue is however not reproduced with a kernel built from i386/
>> x86_64 defconfig configuration.
>>
>> The unstability is actually caused by unexpected interrupts being
>> generated during the S3 resume. For some unknown reason, FSP (gold4)
>> for BayTrail configures the GPIO DFX5 PAD to enable level interrupt
>> (bit 24 and 25). As this pin keeps generating interrupts during an
>> S3 resume, and there is no IRQ requester in the kernel to handle it,
>> the kernel seems to hang and does not continue resuming.
>>
>> Clear the mysterious interrupt bits for this pin.
>
>
> Thanks for working on this. This must have been very tough to debug
> and fix.
>
>> Reported-by: Stefan Roese 
>> Signed-off-by: Bin Meng 
>
>
> Tested-by: Stefan Roese 
> Reviewed-by: Stefan Roese 

applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v6] cmd: usb: ignore blk, emulation devices in usb tree/info display

2017-10-18 Thread Suneel Garapati
On Wed, Oct 18, 2017 at 6:39 PM, Marek Vasut  wrote:
> On 10/19/2017 03:22 AM, Suneel Garapati wrote:
>> usb tree/info commands iterate over all usb uclass devices
>> recursively. blk uclass child devices are created for mass storage,
>> treating these as usb uclass devices and referencing usb config
>> interface descriptors cause crash. To fix, ignore blk and usb_emul
>> uclass devices(sandbox)
>  ^^^ what's this about ? USB_EMUL devices can be
> enables elsewhere too, right ?
Only disabled during the tree/info dump.

>
> Anyway, shouldn't you rather filter for positive matches (usb uclass
> devices etc) , rather than filtering out a few negative matches (blk
> etc) which might break in the future ?
usb_for_each_root_dev does that but we dont have uclass_find_first_child_device
to call on UCLASS_USB like uclass_find_first_device.
So, device_find_first_child and check on uclass id is performed.

>
>> in usb_show_info and usb_tree_graph.
>> also avoid addition of preamble for blk uclass child devices,
>> otherwise tree dump gets messed up.
>
> Also, sentences start with capital letter. This should be in a separate
> patch if it's a separate change ...
Ignoring preamble and device should go together, hence cannot be
separate change.

Regards,
Suneel
>
>> Signed-off-by: Suneel Garapati 
>> Reviewed-by: Bin Meng 
>> Tested-by: Bin Meng 
>> Reviewed-by: Simon Glass 
>> ---
>> Changes v6:
>>  - re-write commit message with detail
>> Changes v5:
>>  - add usb_emul to ignore list in usb_show_info
>>  - modify description
>> Changes v4:
>>  - do not set preamble if child is block device for mass storage
>> Changes v3:
>>  - remove 'check on parent uclass' in description
>> Changes v2:
>>  - remove check on parent uclass
>> Changes v1:
>>  - add separate check on blk uclass
>>  - modify description
>>  - add separate check on parent uclass as usb
>>
>>  cmd/usb.c | 22 +++---
>>  1 file changed, 19 insertions(+), 3 deletions(-)
>>
>> diff --git a/cmd/usb.c b/cmd/usb.c
>> index d95bcf5..907debe 100644
>> --- a/cmd/usb.c
>> +++ b/cmd/usb.c
>> @@ -349,6 +349,16 @@ static void usb_show_tree_graph(struct usb_device *dev, 
>> char *pre)
>>   printf(" %s", pre);
>>  #ifdef CONFIG_DM_USB
>>   has_child = device_has_active_children(dev->dev);
>> + if (device_get_uclass_id(dev->dev) == UCLASS_MASS_STORAGE) {
>> + struct udevice *child;
>> +
>> + for (device_find_first_child(dev->dev, );
>> +  child;
>> +  device_find_next_child()) {
>> + if (device_get_uclass_id(child) == UCLASS_BLK)
>> + has_child = 0;
>> + }
>> + }
>>  #else
>>   /* check if the device has connected children */
>>   int i;
>> @@ -414,8 +424,12 @@ static void usb_show_tree_graph(struct usb_device *dev, 
>> char *pre)
>>
>>   udev = dev_get_parent_priv(child);
>>
>> - /* Ignore emulators, we only want real devices */
>> - if (device_get_uclass_id(child) != UCLASS_USB_EMUL) {
>> + /*
>> +  * Ignore emulators and block child devices, we only want
>> +  * real devices
>> +  */
>> + if ((device_get_uclass_id(child) != UCLASS_USB_EMUL) &&
>> + (device_get_uclass_id(child) != UCLASS_BLK)) {
>>   usb_show_tree_graph(udev, pre);
>>   pre[index] = 0;
>>   }
>> @@ -605,7 +619,9 @@ static void usb_show_info(struct usb_device *udev)
>>   for (device_find_first_child(udev->dev, );
>>child;
>>device_find_next_child()) {
>> - if (device_active(child)) {
>> + if (device_active(child) &&
>> + (device_get_uclass_id(child) != UCLASS_USB_EMUL) &&
>> + (device_get_uclass_id(child) != UCLASS_BLK)) {
>>   udev = dev_get_parent_priv(child);
>>   usb_show_info(udev);
>>   }
>>
>
>
> --
> Best regards,
> Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH V3] imx: mx6slevk: cleanup board usb code

2017-10-18 Thread Peng Fan
Since DM_USB enabled, no need the usb code in board file.

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

 V3:
 Changed title and commit log. Only cleanup the usb code.

 V2:
 Based on Fabio's patches:
 1. https://patchwork.ozlabs.org/patch/825464/
 2. https://patchwork.ozlabs.org/patch/825039/

 board/freescale/mx6slevk/mx6slevk.c | 49 -
 1 file changed, 49 deletions(-)

diff --git a/board/freescale/mx6slevk/mx6slevk.c 
b/board/freescale/mx6slevk/mx6slevk.c
index 8afd5da..0597dbe 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -27,8 +27,6 @@
 #include 
 #include 
 #include "../common/pfuze.h"
-#include 
-#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -223,49 +221,6 @@ static int setup_fec(void)
 }
 #endif
 
-#ifdef CONFIG_USB_EHCI_MX6
-#define USB_OTHERREGS_OFFSET   0x800
-#define UCTRL_PWR_POL  (1 << 9)
-
-static iomux_v3_cfg_t const usb_otg_pads[] = {
-   /* OTG1 */
-   MX6_PAD_KEY_COL4__USB_USBOTG1_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
-   MX6_PAD_EPDC_PWRCOM__ANATOP_USBOTG1_ID | MUX_PAD_CTRL(OTGID_PAD_CTRL),
-   /* OTG2 */
-   MX6_PAD_KEY_COL5__USB_USBOTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL)
-};
-
-static void setup_usb(void)
-{
-   imx_iomux_v3_setup_multiple_pads(usb_otg_pads,
-ARRAY_SIZE(usb_otg_pads));
-}
-
-int board_usb_phy_mode(int port)
-{
-   if (port == 1)
-   return USB_INIT_HOST;
-   else
-   return usb_phy_mode(port);
-}
-
-int board_ehci_hcd_init(int port)
-{
-   u32 *usbnc_usb_ctrl;
-
-   if (port > 1)
-   return -EINVAL;
-
-   usbnc_usb_ctrl = (u32 *)(USB_BASE_ADDR + USB_OTHERREGS_OFFSET +
-port * 4);
-
-   /* Set Power polarity */
-   setbits_le32(usbnc_usb_ctrl, UCTRL_PWR_POL);
-
-   return 0;
-}
-#endif
-
 int board_early_init_f(void)
 {
setup_iomux_uart();
@@ -287,10 +242,6 @@ int board_init(void)
setup_fec();
 #endif
 
-#ifdef CONFIG_USB_EHCI_MX6
-   setup_usb();
-#endif
-
return 0;
 }
 
-- 
2.6.2

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


Re: [U-Boot] [PATCH V2] imx: mx6slevk: fix mmc breakage

2017-10-18 Thread Peng Fan
Hi Fabio

> -Original Message-
> From: Fabio Estevam [mailto:feste...@gmail.com]
> Sent: Tuesday, October 17, 2017 12:15 AM
> To: Peng Fan 
> Cc: Stefano Babic ; Fabio Estevam
> ; U-Boot-Denx 
> Subject: Re: [U-Boot] [PATCH V2] imx: mx6slevk: fix mmc breakage
> 
> Hi Peng,
> 
> Subject should be changed as you are no longer fixing a MMC breakage.
> 
> On Mon, Oct 16, 2017 at 10:23 AM, Peng Fan  wrote:
> > Log:
> >   "
> >   MMC Device 1 not found
> >   *** Warning - No MMC card found, using default environment
> 
> This message should be removed as you are no longer fixing a MMC breakage.
> 
> >   "
> > Add alias node for usdhc.
> 
> Why? Please explain why you need the alias. What happens if the alias is not
> added?
> 
> Upstream dts file does not have the alias either, so why should we diverge
> from upstream dts?
When adding DM support, I add this piece code in fsl_esdhc.c
  /*
   * TODO:
   * Because lack of clk driver, if SDHC clk is not enabled,
   * need to enable it first before this driver is invoked.
   *
   * we use MXC_ESDHC_CLK to get clk freq.
   * If one would like to make this function work,
   * the aliases should be provided in dts as this:
   *
   *  aliases {
   *  mmc0 = 
   *  mmc1 = 
   *  mmc2 = 
   *  mmc3 = 
   *  };
   * Then if your board only supports mmc2 and mmc3, but we can
   * correctly get the seq as 2 and 3, then let mxc_get_clock
   * work as expected.
   */

init_clk_usdhc(dev->seq);

  priv->sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK + dev->seq);

If no alias node, the dev->seq maybe wrong.

> 
> Also, as far as I recall the mmc alias mechanism does not work in the kernel.
> 
> We cannot guarantee the probe ordering and we should use UUID to specify
> the rootfs location.
> 
> > Cleaned up board usb code.
> 
> This part is fine and you could do a patch doing only this USB board code
> removal.

Ok. I'll do a cleanup patch for usb part.

Regards,
Peng.

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


Re: [U-Boot] [U-Boot, 5/6] net: gmac_rockchip: Use the proerty of "clock_in_out" to set mac clock

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

Content preview:  Hi Philipp, 在 2017/10/6 18:17, Philipp Tomsich 写道: >>
   +Â Â Â if (pdata->clk_in) { >> +Â Â Â Â Â Â Â /* >> +Â Â Â Â Â Â Â Â * Since
   mac_clk is fed by an external clock >> +Â Â Â Â Â Â Â Â * we can use 0 here.
   >> +Â Â Â Â Â Â Â Â */ >> +Â Â Â Â Â Â Â ret = clk_set_rate(, 0); > >
   In hindsight using '0' was a bad decision. > We should always request the
   expected external clock rate here (so the > clock driver could do some sanity
   checking). [...] 

Content analysis details:   (6.9 points, 5.0 required)

 pts rule name  description
 -- --
 2.7 RCVD_IN_PSBL   RBL: Received via a relay in PSBL
[211.157.147.133 listed in psbl.surriel.com]
 0.6 RCVD_IN_SORBS_WEB  RBL: SORBS: sender is an abusable web server
[58.22.7.114 listed in dnsbl.sorbs.net]
 1.2 RCVD_IN_BL_SPAMCOP_NET RBL: Received via a relay in bl.spamcop.net
 [Blocked - see ]
 2.4 RCVD_IN_MSPIKE_L5  RBL: Very bad reputation (-5)
[211.157.147.133 listed in bl.mailspike.net]
 0.0 RCVD_IN_MSPIKE_BL  Mailspike blacklisted


--- Begin Message ---

Hi Philipp,

在 2017/10/6 18:17, Philipp Tomsich 写道:

+    if (pdata->clk_in) {
+    /*
+ * Since mac_clk is fed by an external clock
+ * we can use 0 here.
+ */
+    ret = clk_set_rate(, 0);


In hindsight using '0' was a bad decision.
We should always request the expected external clock rate here (so the 
clock driver could do some sanity checking).


We need to tell CLK driver to configure internal or external register, 
so do you think we're going to set this cru register directly in the 
GAMC drive, or is it similar to kernel, introducing parent, CLK driver 
through the parent to judge external or internal?


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


Re: [U-Boot] [PATCH v6] cmd: usb: ignore blk, emulation devices in usb tree/info display

2017-10-18 Thread Marek Vasut
On 10/19/2017 03:22 AM, Suneel Garapati wrote:
> usb tree/info commands iterate over all usb uclass devices
> recursively. blk uclass child devices are created for mass storage,
> treating these as usb uclass devices and referencing usb config
> interface descriptors cause crash. To fix, ignore blk and usb_emul
> uclass devices(sandbox)
 ^^^ what's this about ? USB_EMUL devices can be
enables elsewhere too, right ?

Anyway, shouldn't you rather filter for positive matches (usb uclass
devices etc) , rather than filtering out a few negative matches (blk
etc) which might break in the future ?

> in usb_show_info and usb_tree_graph.
> also avoid addition of preamble for blk uclass child devices,
> otherwise tree dump gets messed up.

Also, sentences start with capital letter. This should be in a separate
patch if it's a separate change ...

> Signed-off-by: Suneel Garapati 
> Reviewed-by: Bin Meng 
> Tested-by: Bin Meng 
> Reviewed-by: Simon Glass 
> ---
> Changes v6:
>  - re-write commit message with detail
> Changes v5:
>  - add usb_emul to ignore list in usb_show_info
>  - modify description
> Changes v4:
>  - do not set preamble if child is block device for mass storage
> Changes v3:
>  - remove 'check on parent uclass' in description
> Changes v2:
>  - remove check on parent uclass
> Changes v1:
>  - add separate check on blk uclass
>  - modify description
>  - add separate check on parent uclass as usb
> 
>  cmd/usb.c | 22 +++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/cmd/usb.c b/cmd/usb.c
> index d95bcf5..907debe 100644
> --- a/cmd/usb.c
> +++ b/cmd/usb.c
> @@ -349,6 +349,16 @@ static void usb_show_tree_graph(struct usb_device *dev, 
> char *pre)
>   printf(" %s", pre);
>  #ifdef CONFIG_DM_USB
>   has_child = device_has_active_children(dev->dev);
> + if (device_get_uclass_id(dev->dev) == UCLASS_MASS_STORAGE) {
> + struct udevice *child;
> +
> + for (device_find_first_child(dev->dev, );
> +  child;
> +  device_find_next_child()) {
> + if (device_get_uclass_id(child) == UCLASS_BLK)
> + has_child = 0;
> + }
> + }
>  #else
>   /* check if the device has connected children */
>   int i;
> @@ -414,8 +424,12 @@ static void usb_show_tree_graph(struct usb_device *dev, 
> char *pre)
>  
>   udev = dev_get_parent_priv(child);
>  
> - /* Ignore emulators, we only want real devices */
> - if (device_get_uclass_id(child) != UCLASS_USB_EMUL) {
> + /*
> +  * Ignore emulators and block child devices, we only want
> +  * real devices
> +  */
> + if ((device_get_uclass_id(child) != UCLASS_USB_EMUL) &&
> + (device_get_uclass_id(child) != UCLASS_BLK)) {
>   usb_show_tree_graph(udev, pre);
>   pre[index] = 0;
>   }
> @@ -605,7 +619,9 @@ static void usb_show_info(struct usb_device *udev)
>   for (device_find_first_child(udev->dev, );
>child;
>device_find_next_child()) {
> - if (device_active(child)) {
> + if (device_active(child) &&
> + (device_get_uclass_id(child) != UCLASS_USB_EMUL) &&
> + (device_get_uclass_id(child) != UCLASS_BLK)) {
>   udev = dev_get_parent_priv(child);
>   usb_show_info(udev);
>   }
> 


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


[U-Boot] [PATCH v6] cmd: usb: ignore blk, emulation devices in usb tree/info display

2017-10-18 Thread Suneel Garapati
usb tree/info commands iterate over all usb uclass devices
recursively. blk uclass child devices are created for mass storage,
treating these as usb uclass devices and referencing usb config
interface descriptors cause crash. To fix, ignore blk and usb_emul
uclass devices(sandbox) in usb_show_info and usb_tree_graph.
also avoid addition of preamble for blk uclass child devices,
otherwise tree dump gets messed up.

Signed-off-by: Suneel Garapati 
Reviewed-by: Bin Meng 
Tested-by: Bin Meng 
Reviewed-by: Simon Glass 
---
Changes v6:
 - re-write commit message with detail
Changes v5:
 - add usb_emul to ignore list in usb_show_info
 - modify description
Changes v4:
 - do not set preamble if child is block device for mass storage
Changes v3:
 - remove 'check on parent uclass' in description
Changes v2:
 - remove check on parent uclass
Changes v1:
 - add separate check on blk uclass
 - modify description
 - add separate check on parent uclass as usb

 cmd/usb.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/cmd/usb.c b/cmd/usb.c
index d95bcf5..907debe 100644
--- a/cmd/usb.c
+++ b/cmd/usb.c
@@ -349,6 +349,16 @@ static void usb_show_tree_graph(struct usb_device *dev, 
char *pre)
printf(" %s", pre);
 #ifdef CONFIG_DM_USB
has_child = device_has_active_children(dev->dev);
+   if (device_get_uclass_id(dev->dev) == UCLASS_MASS_STORAGE) {
+   struct udevice *child;
+
+   for (device_find_first_child(dev->dev, );
+child;
+device_find_next_child()) {
+   if (device_get_uclass_id(child) == UCLASS_BLK)
+   has_child = 0;
+   }
+   }
 #else
/* check if the device has connected children */
int i;
@@ -414,8 +424,12 @@ static void usb_show_tree_graph(struct usb_device *dev, 
char *pre)
 
udev = dev_get_parent_priv(child);
 
-   /* Ignore emulators, we only want real devices */
-   if (device_get_uclass_id(child) != UCLASS_USB_EMUL) {
+   /*
+* Ignore emulators and block child devices, we only want
+* real devices
+*/
+   if ((device_get_uclass_id(child) != UCLASS_USB_EMUL) &&
+   (device_get_uclass_id(child) != UCLASS_BLK)) {
usb_show_tree_graph(udev, pre);
pre[index] = 0;
}
@@ -605,7 +619,9 @@ static void usb_show_info(struct usb_device *udev)
for (device_find_first_child(udev->dev, );
 child;
 device_find_next_child()) {
-   if (device_active(child)) {
+   if (device_active(child) &&
+   (device_get_uclass_id(child) != UCLASS_USB_EMUL) &&
+   (device_get_uclass_id(child) != UCLASS_BLK)) {
udev = dev_get_parent_priv(child);
usb_show_info(udev);
}
-- 
2.7.4

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


[U-Boot] [PATCH 9/9] x86: acpi: Put sleepstates.asl to the common place

2017-10-18 Thread Bin Meng
The supported sleep states are generic on Intel processors. Move the
ASL definition to the common place.

Signed-off-by: Bin Meng 
---

 arch/x86/include/asm/{arch-baytrail => }/acpi/sleepstates.asl |  0
 arch/x86/include/asm/arch-baytrail/acpi/platform.asl  |  2 +-
 arch/x86/include/asm/arch-quark/acpi/platform.asl |  2 +-
 arch/x86/include/asm/arch-quark/acpi/sleepstates.asl  | 10 --
 4 files changed, 2 insertions(+), 12 deletions(-)
 rename arch/x86/include/asm/{arch-baytrail => }/acpi/sleepstates.asl (100%)
 delete mode 100644 arch/x86/include/asm/arch-quark/acpi/sleepstates.asl

diff --git a/arch/x86/include/asm/arch-baytrail/acpi/sleepstates.asl 
b/arch/x86/include/asm/acpi/sleepstates.asl
similarity index 100%
rename from arch/x86/include/asm/arch-baytrail/acpi/sleepstates.asl
rename to arch/x86/include/asm/acpi/sleepstates.asl
diff --git a/arch/x86/include/asm/arch-baytrail/acpi/platform.asl 
b/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
index a80d2c0..cf3de7c 100644
--- a/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
+++ b/arch/x86/include/asm/arch-baytrail/acpi/platform.asl
@@ -36,4 +36,4 @@ Scope (\_SB)
 }
 
 /* Chipset specific sleep states */
-#include "sleepstates.asl"
+#include 
diff --git a/arch/x86/include/asm/arch-quark/acpi/platform.asl 
b/arch/x86/include/asm/arch-quark/acpi/platform.asl
index 1ecf153..db59c46 100644
--- a/arch/x86/include/asm/arch-quark/acpi/platform.asl
+++ b/arch/x86/include/asm/arch-quark/acpi/platform.asl
@@ -33,4 +33,4 @@ Scope (\_SB)
 }
 
 /* Chipset specific sleep states */
-#include "sleepstates.asl"
+#include 
diff --git a/arch/x86/include/asm/arch-quark/acpi/sleepstates.asl 
b/arch/x86/include/asm/arch-quark/acpi/sleepstates.asl
deleted file mode 100644
index 63c82fa..000
--- a/arch/x86/include/asm/arch-quark/acpi/sleepstates.asl
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Copyright (C) 2016, Bin Meng 
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-Name(\_S0, Package() {0x0, 0x0, 0x0, 0x0})
-Name(\_S3, Package() {0x5, 0x0, 0x0, 0x0})
-Name(\_S4, Package() {0x6, 0x0, 0x0, 0x0})
-Name(\_S5, Package() {0x7, 0x0, 0x0, 0x0})
-- 
2.7.4

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


[U-Boot] [PATCH 4/9] x86: Fix ACPI resume dependency to MRC cache

2017-10-18 Thread Bin Meng
In an S3 resume path, MRC cache is mandatory. Enforce the dependency
in the Kconfig.

Signed-off-by: Bin Meng 
---

 arch/x86/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index c869ae2..b2ae865 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -664,6 +664,7 @@ endmenu
 
 config HAVE_ACPI_RESUME
bool "Enable ACPI S3 resume"
+   select ENABLE_MRC_CACHE
help
  Select this to enable ACPI S3 resume. S3 is an ACPI-defined sleeping
  state where all system context is lost except system memory. U-Boot
-- 
2.7.4

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


[U-Boot] [PATCH 7/9] x86: braswell: cherryhill: Update dts for SPI lock down

2017-10-18 Thread Bin Meng
Intel Braswell FSP requires SPI controller settings to be locked down,
let's do this in the chrryhill.dts and remove previous Kconfig option.

Signed-off-by: Bin Meng 
---

 arch/x86/cpu/braswell/Kconfig | 4 
 arch/x86/dts/cherryhill.dts   | 1 +
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/x86/cpu/braswell/Kconfig b/arch/x86/cpu/braswell/Kconfig
index 616f228..31ac279 100644
--- a/arch/x86/cpu/braswell/Kconfig
+++ b/arch/x86/cpu/braswell/Kconfig
@@ -31,8 +31,4 @@ config FSP_ADDR
hex
default 0xfff2
 
-config FSP_LOCKDOWN_SPI
-   bool
-   default y
-
 endif
diff --git a/arch/x86/dts/cherryhill.dts b/arch/x86/dts/cherryhill.dts
index 840a669..41e72f3 100644
--- a/arch/x86/dts/cherryhill.dts
+++ b/arch/x86/dts/cherryhill.dts
@@ -143,6 +143,7 @@
#address-cells = <1>;
#size-cells = <0>;
compatible = "intel,ich9-spi";
+   intel,spi-lock-down;
 
spi-flash@0 {
#address-cells = <1>;
-- 
2.7.4

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


[U-Boot] [PATCH 5/9] Revert "x86: fsp: Configure SPI opcode registers before SPI is locked down"

2017-10-18 Thread Bin Meng
This reverts commit 1e6ebee667da47fd3a87839a239a7574c66f5659.

It's not appropriate to call the Intel SPI driver specific stuff in
the FSP codes. We may add a simple DTS property "intel,spi-lock-down"
and let the Intel SPI driver call these stuff instead.

Signed-off-by: Bin Meng 
---

 arch/x86/Kconfig  |  9 -
 arch/x86/lib/fsp/fsp_common.c | 24 
 2 files changed, 33 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index b2ae865..98c56ad 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -402,15 +402,6 @@ config FSP_BROKEN_HOB
  do not overwrite the important boot service data which is used by
  FSP, otherwise the subsequent call to fsp_notify() will fail.
 
-config FSP_LOCKDOWN_SPI
-   bool
-   depends on HAVE_FSP
-   help
- Some Intel FSP (like Braswell) does SPI lock-down during the call
- to fsp_notify(INIT_PHASE_BOOT). This option should be turned on
- for such FSP and U-Boot will configure the SPI opcode registers
- before the lock-down.
-
 config ENABLE_MRC_CACHE
bool "Enable MRC cache"
depends on !EFI && !SYS_COREBOOT
diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c
index 1714d13..3397bb8 100644
--- a/arch/x86/lib/fsp/fsp_common.c
+++ b/arch/x86/lib/fsp/fsp_common.c
@@ -19,8 +19,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-extern void ich_spi_config_opcode(struct udevice *dev);
-
 int checkcpu(void)
 {
return 0;
@@ -51,28 +49,6 @@ void board_final_cleanup(void)
 {
u32 status;
 
-#ifdef CONFIG_FSP_LOCKDOWN_SPI
-   struct udevice *dev;
-
-   /*
-* Some Intel FSP (like Braswell) does SPI lock-down during the call
-* to fsp_notify(INIT_PHASE_BOOT). But before SPI lock-down is done,
-* it's bootloader's responsibility to configure the SPI controller's
-* opcode registers properly otherwise SPI controller driver doesn't
-* know how to communicate with the SPI flash device.
-*
-* Note we cannot do such configuration elsewhere (eg: during the SPI
-* controller driver's probe() routine), because:
-*
-* 1). U-Boot SPI controller driver does not set the lock-down bit
-* 2). Any SPI transfer will corrupt the contents of these registers
-*
-* Hence we have to do it right here before SPI lock-down bit is set.
-*/
-   if (!uclass_first_device_err(UCLASS_SPI, ))
-   ich_spi_config_opcode(dev);
-#endif
-
/* call into FspNotify */
debug("Calling into FSP (notify phase INIT_PHASE_BOOT): ");
status = fsp_notify(NULL, INIT_PHASE_BOOT);
-- 
2.7.4

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


[U-Boot] [PATCH 3/9] env: x86: braswell: Set ENV_IS_IN_SPI_FLASH as default

2017-10-18 Thread Bin Meng
Imply does not work for a Kconfig choice. Update ENV_IS_IN_SPI_FLASH
to be the default one for Intel Braswell.

Signed-off-by: Bin Meng 
---

 arch/x86/cpu/braswell/Kconfig | 1 -
 env/Kconfig   | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/cpu/braswell/Kconfig b/arch/x86/cpu/braswell/Kconfig
index 0e214a7..616f228 100644
--- a/arch/x86/cpu/braswell/Kconfig
+++ b/arch/x86/cpu/braswell/Kconfig
@@ -12,7 +12,6 @@ config INTEL_BRASWELL
imply HAVE_INTEL_ME
imply HAVE_VBT
imply ENABLE_MRC_CACHE
-   imply ENV_IS_IN_SPI_FLASH
imply AHCI_PCI
imply ICH_SPI
imply MMC
diff --git a/env/Kconfig b/env/Kconfig
index 024d4d7..3342806 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -17,6 +17,7 @@ choice
default ENV_IS_IN_FLASH if SH && !CPU_SH4
default ENV_IS_IN_SPI_FLASH if ARMADA_XP
default ENV_IS_IN_SPI_FLASH if INTEL_BAYTRAIL
+   default ENV_IS_IN_SPI_FLASH if INTEL_BRASWELL
default ENV_IS_IN_SPI_FLASH if INTEL_BROADWELL
default ENV_IS_IN_SPI_FLASH if NORTHBRIDGE_INTEL_IVYBRIDGE
default ENV_IS_IN_SPI_FLASH if INTEL_QUARK
-- 
2.7.4

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


[U-Boot] [PATCH 8/9] x86: fsp: graphics: Add some notes about the graphics info hob

2017-10-18 Thread Bin Meng
On some platforms (eg: Braswell), the FSP will not produce the
graphics info HOB unless you plug some cables to the display
interface (eg: HDMI) on the board. Add such notes in the FSP
video driver.

Signed-off-by: Bin Meng 
---

 arch/x86/lib/fsp/fsp_graphics.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c
index a19b067..af71276 100644
--- a/arch/x86/lib/fsp/fsp_graphics.c
+++ b/arch/x86/lib/fsp/fsp_graphics.c
@@ -37,6 +37,10 @@ static int save_vesa_mode(struct vesa_mode_info *vesa)
/*
 * If there is no graphics info structure, bail out and keep
 * running on the serial console.
+*
+* Note: on some platforms (eg: Braswell), the FSP will not produce
+* the graphics info HOB unless you plug some cables to the display
+* interface (eg: HDMI) on the board.
 */
if (!ginfo) {
debug("FSP graphics hand-off block not found\n");
-- 
2.7.4

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


[U-Boot] [PATCH 6/9] spi: ich: Lock down controller settings if required

2017-10-18 Thread Bin Meng
Some Intel FSP (like Braswell) does SPI lock-down during the call
to fsp_notify(INIT_PHASE_BOOT). But before SPI lock-down is done,
it's bootloader's responsibility to configure the SPI controller's
opcode registers properly otherwise SPI controller driver doesn't
know how to communicate with the SPI flash device.

Rather than passively doing the opcode configuration, let's add a
simple DTS property "intel,spi-lock-down" and let the driver call
the opcode configuration function if required by such FSP.

Signed-off-by: Bin Meng 
---

 drivers/spi/ich.c | 22 ++
 drivers/spi/ich.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index 22fc83d..927bbd7 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -184,6 +184,19 @@ static inline void spi_use_in(struct spi_trans *trans, 
unsigned bytes)
trans->bytesin -= bytes;
 }
 
+static void spi_lock_down(struct ich_spi_platdata *plat, void *sbase)
+{
+   if (plat->ich_version == ICHV_7) {
+   struct ich7_spi_regs *ich7_spi = sbase;
+
+   setbits_le16(_spi->spis, SPIS_LOCK);
+   } else if (plat->ich_version == ICHV_9) {
+   struct ich9_spi_regs *ich9_spi = sbase;
+
+   setbits_le16(_spi->hsfs, HSFS_FLOCKDN);
+   }
+}
+
 static bool spi_lock_status(struct ich_spi_platdata *plat, void *sbase)
 {
int lock = 0;
@@ -592,6 +605,12 @@ static int ich_spi_probe(struct udevice *dev)
return ret;
}
 
+   /* Lock down SPI controller settings if required */
+   if (plat->lockdown) {
+   ich_spi_config_opcode(dev);
+   spi_lock_down(plat, priv->base);
+   }
+
priv->cur_speed = priv->max_speed;
 
return 0;
@@ -662,6 +681,9 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev)
plat->ich_version = ICHV_9;
}
 
+   plat->lockdown = fdtdec_get_bool(gd->fdt_blob, node,
+"intel,spi-lock-down");
+
return ret;
 }
 
diff --git a/drivers/spi/ich.h b/drivers/spi/ich.h
index c867c57..06b7fb9 100644
--- a/drivers/spi/ich.h
+++ b/drivers/spi/ich.h
@@ -174,6 +174,7 @@ enum ich_version {
 
 struct ich_spi_platdata {
enum ich_version ich_version;   /* Controller version, 7 or 9 */
+   bool lockdown;  /* lock down controller settings? */
 };
 
 struct ich_spi_priv {
-- 
2.7.4

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


[U-Boot] [PATCH 2/9] x86: braswell: Fix unexpected crash during Linux kernel boot

2017-10-18 Thread Bin Meng
It was observed that when booting Linux kernel on Intel Cherry Hill
board, unexpected crash happens quite randomly. Sometimes kernel
just oops, while sometimes kernel throws MCE errors and hangs:

  mce: [Hardware Error]: Machine check events logged
  mce: [Hardware Error]: CPU 0: Machine Check: 0 Bank 4: c4010151
  mce: [Hardware Error]: TSC 0 ADDR 130f3f2c0
  mce: [Hardware Error]: PROCESSOR 0:406c3 TIME 1508160686 SOCKET 0 APIC 0 
microcode 363

This looks like a hardware error per mcelog. After debugging, it
seems turning off turbo mode on the processor does not expose this
behavior, although U-Boot runs OK with turbo mode on. Suspect it is
related to an errata of Braswell processor.

To fix this, remove the Braswell cpu driver which does the turbo
mode configuration, and switch to use the generic cpu-x86 driver.
Also there is a configuration option in the FSP that turns on the
turbo mode and that has been turned off too.

Signed-off-by: Bin Meng 
---

 arch/x86/cpu/braswell/Makefile |   2 +-
 arch/x86/cpu/braswell/cpu.c| 170 -
 arch/x86/dts/cherryhill.dts|   9 +--
 3 files changed, 5 insertions(+), 176 deletions(-)
 delete mode 100644 arch/x86/cpu/braswell/cpu.c

diff --git a/arch/x86/cpu/braswell/Makefile b/arch/x86/cpu/braswell/Makefile
index ddf6d28..4a639b8 100644
--- a/arch/x86/cpu/braswell/Makefile
+++ b/arch/x86/cpu/braswell/Makefile
@@ -4,4 +4,4 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-y += braswell.o cpu.o early_uart.o fsp_configs.o
+obj-y += braswell.o early_uart.o fsp_configs.o
diff --git a/arch/x86/cpu/braswell/cpu.c b/arch/x86/cpu/braswell/cpu.c
deleted file mode 100644
index 6ff9036..000
--- a/arch/x86/cpu/braswell/cpu.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (C) 2017, Bin Meng 
- *
- * SPDX-License-Identifier:GPL-2.0+
- *
- * Derived from arch/x86/cpu/baytrail/cpu.c
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-static const unsigned int braswell_bus_freq_table[] = {
-   8333,
-   1,
-   1,
-   11666,
-   8000,
-   9333,
-   9000,
-   8890,
-   8750
-};
-
-static unsigned int braswell_bus_freq(void)
-{
-   msr_t clk_info = msr_read(MSR_BSEL_CR_OVERCLOCK_CONTROL);
-
-   if ((clk_info.lo & 0xf) < (ARRAY_SIZE(braswell_bus_freq_table)))
-   return braswell_bus_freq_table[clk_info.lo & 0xf];
-
-   return 0;
-}
-
-static unsigned long braswell_tsc_freq(void)
-{
-   msr_t platform_info;
-   ulong bclk = braswell_bus_freq();
-
-   if (!bclk)
-   return 0;
-
-   platform_info = msr_read(MSR_PLATFORM_INFO);
-
-   return bclk * ((platform_info.lo >> 8) & 0xff);
-}
-
-static int braswell_get_info(struct udevice *dev, struct cpu_info *info)
-{
-   info->cpu_freq = braswell_tsc_freq();
-   info->features = (1 << CPU_FEAT_L1_CACHE) | (1 << CPU_FEAT_MMU);
-
-   return 0;
-}
-
-static int braswell_get_count(struct udevice *dev)
-{
-   int ecx = 0;
-
-   /*
-* Use the algorithm described in Intel 64 and IA-32 Architectures
-* Software Developer's Manual Volume 3 (3A, 3B & 3C): System
-* Programming Guide, Jan-2015. Section 8.9.2: Hierarchical Mapping
-* of CPUID Extended Topology Leaf.
-*/
-   while (1) {
-   struct cpuid_result leaf_b;
-
-   leaf_b = cpuid_ext(0xb, ecx);
-
-   /*
-* Braswell doesn't have hyperthreading so just determine the
-* number of cores by from level type (ecx[15:8] == * 2)
-*/
-   if ((leaf_b.ecx & 0xff00) == 0x0200)
-   return leaf_b.ebx & 0x;
-
-   ecx++;
-   }
-
-   return 0;
-}
-
-static void braswell_set_max_freq(void)
-{
-   msr_t perf_ctl;
-   msr_t msr;
-
-   /* Enable speed step */
-   msr = msr_read(MSR_IA32_MISC_ENABLES);
-   msr.lo |= (1 << 16);
-   msr_write(MSR_IA32_MISC_ENABLES, msr);
-
-   /* Enable Burst Mode */
-   msr = msr_read(MSR_IA32_MISC_ENABLES);
-   msr.hi = 0;
-   msr_write(MSR_IA32_MISC_ENABLES, msr);
-
-   /*
-* Set guaranteed ratio [21:16] from IACORE_TURBO_RATIOS to
-* bits [15:8] of the PERF_CTL
-*/
-   msr = msr_read(MSR_IACORE_TURBO_RATIOS);
-   perf_ctl.lo = (msr.lo & 0x3f) >> 8;
-
-   /*
-* Set guaranteed vid [22:16] from IACORE_TURBO_VIDS to
-* bits [7:0] of the PERF_CTL
-*/
-   msr = msr_read(MSR_IACORE_TURBO_VIDS);
-   perf_ctl.lo |= (msr.lo & 0x7f) >> 16;
-
-   perf_ctl.hi = 0;
-   msr_write(MSR_IA32_PERF_CTL, perf_ctl);
-}
-
-static int braswell_probe(struct udevice *dev)
-{
-   debug("Init Braswell core\n");
-
-   /*
-* On Braswell the turbo disable bit is actually scoped at 

[U-Boot] [PATCH 1/9] x86: galileo: Fix boot failure

2017-10-18 Thread Bin Meng
With latest codes on mainstream master, Intel Galileo board does not
boot unfortunately. Git biset leads to b383d6c0 "bootstage: Convert
to use malloc()".

Disable bootstage support to make it boot again. The root cause needs
to be investigated however.

Fixes: b383d6c0 ("bootstage: Convert to use malloc()")
Signed-off-by: Bin Meng 
---

 configs/galileo_defconfig | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/configs/galileo_defconfig b/configs/galileo_defconfig
index c1849e3..f91890c 100644
--- a/configs/galileo_defconfig
+++ b/configs/galileo_defconfig
@@ -6,8 +6,6 @@ CONFIG_GENERATE_PIRQ_TABLE=y
 CONFIG_GENERATE_MP_TABLE=y
 CONFIG_GENERATE_ACPI_TABLE=y
 CONFIG_FIT=y
-CONFIG_BOOTSTAGE=y
-CONFIG_BOOTSTAGE_REPORT=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="root=/dev/sdb3 init=/sbin/init rootwait ro"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
@@ -25,7 +23,6 @@ CONFIG_CMD_DHCP=y
 # CONFIG_CMD_NFS is not set
 CONFIG_CMD_PING=y
 CONFIG_CMD_TIME=y
-CONFIG_CMD_BOOTSTAGE=y
 CONFIG_CMD_EXT2=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
-- 
2.7.4

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


Re: [U-Boot] [PATCH] cmd: usb_mass_storage: add protection for block_dev

2017-10-18 Thread Marek Vasut
On 10/18/2017 06:27 PM, Tom Rini wrote:
> On Wed, Oct 18, 2017 at 04:03:21PM +0200, Patrick Delaunay wrote:
> 
>> solve data abort for the command "ums 0 ubi 0"
>> because result of case blk_get_device_part_str() result is OK
>> but with block_dev = 0 when CONFIG_CMD_UBIFS is activate and
>> ubi volume is mounted
>>
>> Signed-off-by: Patrick Delaunay 

This is UMS, so Lukasz ... please review _thoroughly_ , as I suspect
there might be some weird underlying issue .

>> ---
>>
>>  cmd/usb_mass_storage.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
>> index cfeecb7..c0563ca 100644
>> --- a/cmd/usb_mass_storage.c
>> +++ b/cmd/usb_mass_storage.c
>> @@ -85,7 +85,7 @@ static int ums_init(const char *devtype, const char 
>> *devnums_part_str)
>>  partnum = 0;
>>  
>>  /* f_mass_storage.c assumes SECTOR_SIZE sectors */
>> -if (block_dev->blksz != SECTOR_SIZE)
>> +if (!block_dev || block_dev->blksz != SECTOR_SIZE)
>>  goto cleanup;
>>  
>>  ums_new = realloc(ums, (ums_count + 1) * sizeof(*ums));
> 
> Adding in Marek..
> 


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


Re: [U-Boot] [PATCH] sf: ensure flash device is in 3-byte address mode

2017-10-18 Thread Lukasz Majewski
Hi Simon,

> On some boards where the spi flash is not reset during warm reboot,
> the chip has to be manually set into 3-byte address mode.
> 
> Signed-off-by: Simon Goldschmidt 

Reviewed-by: Lukasz Majewski 

> ---
>  drivers/mtd/spi/sf_internal.h |  2 ++
>  drivers/mtd/spi/spi_flash.c   | 53
> +++ 2 files changed, 55
> insertions(+)
> 
> diff --git a/drivers/mtd/spi/sf_internal.h
> b/drivers/mtd/spi/sf_internal.h index 839cdbe1b0..06dee0a4ea 100644
> --- a/drivers/mtd/spi/sf_internal.h
> +++ b/drivers/mtd/spi/sf_internal.h
> @@ -62,6 +62,8 @@ enum spi_nor_option_flags {
>  #define CMD_READ_STATUS1 0x35
>  #define CMD_READ_CONFIG  0x35
>  #define CMD_FLAG_STATUS  0x70
> +#define CMD_EN4B 0xB7
> +#define CMD_EX4B 0xE9
>  
>  /* Bank addr access commands */
>  #ifdef CONFIG_SPI_FLASH_BAR
> diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
> index 34f68881ed..8db2882075 100644
> --- a/drivers/mtd/spi/spi_flash.c
> +++ b/drivers/mtd/spi/spi_flash.c
> @@ -165,6 +165,55 @@ bar_end:
>  }
>  #endif
>  
> +static int set_4byte(struct spi_flash *flash, const struct
> spi_flash_info *info,
> + u8 enable)
> +{
> + int ret;
> + bool need_wren = false;
> + u8 cmd;
> +
> + if (flash->size <= SPI_FLASH_16MB_BOUN)
> + return 0;
> +
> + switch (JEDEC_MFR(info)) {
> + case SPI_FLASH_CFI_MFR_STMICRO:
> + /* Some Micron need WREN command; all will accept it
> */
> + need_wren = true;
> + case SPI_FLASH_CFI_MFR_MACRONIX:
> + case SPI_FLASH_CFI_MFR_WINBOND:
> + ret = spi_claim_bus(flash->spi);
> + if (ret) {
> + debug("SF: Unable to claim SPI bus\n");
> + return ret;
> + }
> +
> + if (need_wren) {
> + ret = spi_flash_cmd_write_enable(flash);
> + if (ret < 0) {
> + debug("SF: enabling write failed\n");
> + spi_release_bus(flash->spi);
> + return ret;
> + }
> + }
> +
> + cmd = enable ? CMD_EN4B : CMD_EX4B;
> + ret = spi_flash_cmd_write(flash->spi, , 1, NULL,
> 0);
> + if (ret) {
> + debug("SF: fail to %s 4-byte address mode\n",
> + enable ? "enter" : "exit");
> + }
> + if (need_wren)
> + if (spi_flash_cmd_write_disable(flash) < 0)
> + debug("SF: disabling write
> failed\n");
> + spi_release_bus(flash->spi);
> + return ret;
> + default:
> + /* Spansion style handled by bar_write  */
> + break;
> + }
> + return 0;
> +}
> +
>  #ifdef CONFIG_SF_DUAL_FLASH
>  static void spi_flash_dual(struct spi_flash *flash, u32 *addr)
>  {
> @@ -1086,6 +1135,10 @@ int spi_flash_scan(struct spi_flash *flash)
>   flash->flags |= SNOR_F_USE_FSR;
>  #endif
>  
> + /* disable 4-byte addressing if the device exceeds 16MiB */
> + if (flash->size > SPI_FLASH_16MB_BOUN)
> + set_4byte(flash, info, 0);
> +
>   /* Configure the BAR - discover bank cmds and read current
> bank */ #ifdef CONFIG_SPI_FLASH_BAR
>   ret = read_bar(flash, info);




Best regards,

Lukasz Majewski

--

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


Re: [U-Boot] [RFC] mmc: fsl_esdhc: Do not set high speed mode on MX25 and MX51

2017-10-18 Thread Fabio Estevam
Hi Benoît,

On Wed, Oct 18, 2017 at 6:10 PM, Benoît Thébaudeau
 wrote:

> Can you try with this?
>
> static const iomux_v3_cfg_t sdhc1_pads[] = {
> NEW_PAD_CTRL(MX25_PAD_SD1_CMD__SD1_CMD, PAD_CTL_PUS_47K_UP | 
> PAD_CTL_SRE_FAST),
> NEW_PAD_CTRL(MX25_PAD_SD1_CLK__SD1_CLK, PAD_CTL_SRE_FAST),
> NEW_PAD_CTRL(MX25_PAD_SD1_DATA0__SD1_DATA0, PAD_CTL_PUS_47K_UP |
> PAD_CTL_SRE_FAST),
> NEW_PAD_CTRL(MX25_PAD_SD1_DATA1__SD1_DATA1, PAD_CTL_PUS_47K_UP |
> PAD_CTL_SRE_FAST),
> NEW_PAD_CTRL(MX25_PAD_SD1_DATA2__SD1_DATA2, PAD_CTL_PUS_47K_UP |
> PAD_CTL_SRE_FAST),
> NEW_PAD_CTRL(MX25_PAD_SD1_DATA3__SD1_DATA3, PAD_CTL_PUS_47K_UP |
> PAD_CTL_SRE_FAST),
> NEW_PAD_CTRL(MX25_PAD_CTL_GRP_DSE_SDHC1, PAD_CTL_DSE_HIGH),
> };
>
> If you scope the SD clock during U-Boot HS SD transfers, do you get 48
> MHz as expected?

I will try tomorrow when I have access to the mx25pdk board again.

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


Re: [U-Boot] [RFC] mmc: fsl_esdhc: Do not set high speed mode on MX25 and MX51

2017-10-18 Thread Benoît Thébaudeau
Hi Fabio,

On Wed, Oct 18, 2017 at 7:35 PM, Fabio Estevam  wrote:
> On Wed, Oct 18, 2017 at 2:56 PM, Benoît Thébaudeau  wrote:
>
>> I can tell you what to use for imx25pdk if you give me the pads used by the
>> eSDHC instance in question here.
>
> mx25pdk uses the POR default IOMUX settings for sdhc1:

Can you try with this?

static const iomux_v3_cfg_t sdhc1_pads[] = {
NEW_PAD_CTRL(MX25_PAD_SD1_CMD__SD1_CMD, PAD_CTL_PUS_47K_UP | PAD_CTL_SRE_FAST),
NEW_PAD_CTRL(MX25_PAD_SD1_CLK__SD1_CLK, PAD_CTL_SRE_FAST),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA0__SD1_DATA0, PAD_CTL_PUS_47K_UP |
PAD_CTL_SRE_FAST),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA1__SD1_DATA1, PAD_CTL_PUS_47K_UP |
PAD_CTL_SRE_FAST),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA2__SD1_DATA2, PAD_CTL_PUS_47K_UP |
PAD_CTL_SRE_FAST),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA3__SD1_DATA3, PAD_CTL_PUS_47K_UP |
PAD_CTL_SRE_FAST),
NEW_PAD_CTRL(MX25_PAD_CTL_GRP_DSE_SDHC1, PAD_CTL_DSE_HIGH),
};

If you scope the SD clock during U-Boot HS SD transfers, do you get 48
MHz as expected?

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


Re: [U-Boot] [PATCH v3 2/2] ARM: dts: OMAP5+: Add support for bandgap sensor in SPL

2017-10-18 Thread Tom Rini
On Wed, Oct 18, 2017 at 05:11:53PM +0530, Faiz Abbas wrote:

> Mark bandgap node as uboot,dm-spl so that it can be accessed in spl
> 
> Signed-off-by: Faiz Abbas 
> Reviewed-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] Please pull from u-boot-i2c

2017-10-18 Thread Tom Rini
On Tue, Oct 17, 2017 at 04:29:13PM +0200, Heiko Schocher wrote:

> Hello Tom,
> 
> please pull from u-boot-i2c master
> 
> The following changes since commit eb0044db392247aa1c43e29f2703418d5668018a:
> 
>   Prepare v2017.11-rc2 (2017-10-16 21:40:56 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-i2c.git master
> 
> for you to fetch changes up to d10bd6cfd85c2a9f27c950e22e83d27ff978e7e8:
> 
>   i2c: stm32f7_i2c: fix usage of useless local variable (2017-10-17 11:28:41 
> +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] [PATCH v3 1/2] thermal: ti-bandgap: Add support for temperature sensor

2017-10-18 Thread Tom Rini
On Wed, Oct 18, 2017 at 05:11:52PM +0530, Faiz Abbas wrote:

> The dra7xx series of SOCs contain a temperature sensor and an
> associated analog-to-digital converter (ADC) which produces
> an output which is proportional to the SOC temperature.
> Add support for this temperature sensor.
> 
> Signed-off-by: Faiz Abbas 
> Reviewed-by: Simon Glass 

Reviewed-by: Tom Rini 

and note that in U-Boot, we let patchwork collect Reviewed-by/etc tags,
so you don't need to repost with just tags added, in the future.
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: u-boot-spi/master

2017-10-18 Thread Tom Rini
On Tue, Oct 17, 2017 at 07:20:04PM +0530, Jagan Teki wrote:

> Hi Tom,
> 
> Please pull this PR.
> 
> thanks!
> Jagan.
> 
> The following changes since commit 10509987285515b0a969c39ef7374fea3545851b:
> 
>   spi: fsl_qspi: Copy 16 byte aligned data in TX FIFO (2017-09-25 15:45:15 
> +0530)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-spi.git master
> 
> for you to fetch changes up to ca1ac16da097bf0ab176b1a201653553160dc042:
> 
>   sf: bar: Clean BA24 Bank Address Register bit after read/write/erase 
> operation (2017-09-27 13:31:59 +0530)
> 

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] [RFC] mmc: fsl_esdhc: Do not set high speed mode on MX25 and MX51

2017-10-18 Thread Fabio Estevam
Hi Benoît ,

On Wed, Oct 18, 2017 at 2:56 PM, Benoît Thébaudeau  wrote:

> I can tell you what to use for imx25pdk if you give me the pads used by the
> eSDHC instance in question here.

mx25pdk uses the POR default IOMUX settings for sdhc1:

static const iomux_v3_cfg_t sdhc1_pads[] = {
NEW_PAD_CTRL(MX25_PAD_SD1_CMD__SD1_CMD, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_CLK__SD1_CLK, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA0__SD1_DATA0, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA1__SD1_DATA1, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA2__SD1_DATA2, NO_PAD_CTRL),
NEW_PAD_CTRL(MX25_PAD_SD1_DATA3__SD1_DATA3, NO_PAD_CTRL),
};

Regards,

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


Re: [U-Boot] [PATCH v3 6/6] cmd: gpt: solve issue for swap and rename command

2017-10-18 Thread Stephen Warren

On 10/18/2017 07:11 AM, Patrick Delaunay wrote:

don't use prettyprint_part_size() in create_gpt_partitions_list()
that avoid to align offset and size to 1 MiB and increase precision for
start and size.
This patch avoid the risk to change partition size and lost data during
rename or swap.


All the test/py changes in this series,
Acked-by: Stephen Warren 

The series,
Tested-by: Stephen Warren 

If you're looking for more things to change(!), perhaps change the 
sgdisk commands so that the partitions are big enough that 'gpt read 
host 0' says something other than 'size 0MiB' for the partitions; when I 
saw that, I was initially rather confused until I realized that the 
partitions were less than 1MiB!

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


Re: [U-Boot] [RFC] mmc: fsl_esdhc: Do not set high speed mode on MX25 and MX51

2017-10-18 Thread Benoît Thébaudeau
Hi Fabio,

On 18/10/2017 at 18:40, Fabio Estevam wrote:
> On Wed, Oct 18, 2017 at 2:13 PM, Benoît Thébaudeau  wrote:
>> You can try to set the drive strength of all the eSDHC pads to high or max 
>> (for
> 
> Looks like the eSDHC pins do not have drive strength control, only
> PKE, PUE, PUS and SRE fields.

They may also be in a pad group control register such as
MX25_PAD_CTL_GRP_DSE_CSI.

> Also, in the kernel I do not do pinctrl setting and just use the IOMUX
> values from U-Boot. In the kernel the SD card operation in high speed
> works fine.
> 
>> each pad or for the group of pads depending on the register layout for the 
>> pads
>> used on the board). This worked on my board (custom i.MX25-based, not 
>> imx25pdk).
> 
> Could you please share your custom eSDHC pinctrl settings in U-Boot?

I can tell you what to use for imx25pdk if you give me the pads used by the
eSDHC instance in question here.

> Also, I suppose you see "Tran Speed: 5000" when you run mmc info
> with a SD high speed card connected.

Indeed.

> In my case whenever 'mmc info' reports 50MHz I am not able to access
> the SD card (saveenv, for example) on both mx25pdk and mx51evk.

Note that I am using a modified version of U-Boot, so it may work thanks to that
for me, but the pad fixup was required anyway.

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


Re: [U-Boot] [PATCH 1/2] wandboard: Remove cpu type check prior to setup_sata()

2017-10-18 Thread Heinrich Schuchardt
On 10/15/2017 03:21 PM, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> Inside setup_sata() there is a cpu type check, so there is no need to
> do this check in the board file.
> 
> This also brings the benefit to allowing setup_sata() to be called for the
> mx6qp wandboard variant.
> 
> Signed-off-by: Fabio Estevam 
> ---
>  board/wandboard/wandboard.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
> index adfcf48..3f12b50 100644
> --- a/board/wandboard/wandboard.c
> +++ b/board/wandboard/wandboard.c
> @@ -380,9 +380,7 @@ int board_early_init_f(void)
>   setup_display();
>  #endif
>  #ifdef CONFIG_SATA
> - /* Only mx6q wandboard has SATA */
> - if (is_cpu_type(MXC_CPU_MX6Q))
> - setup_sata();
> + setup_sata();
>  #endif
>  
>   return 0;
> 
Reviewed-by: Heinrich Schuchardt 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] udoo: Remove cpu type check prior to setup_sata()

2017-10-18 Thread Heinrich Schuchardt
On 10/15/2017 03:21 PM, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> Inside setup_sata() there is a cpu type check, so there is no need to
> do this check in the board file.
> 
> Signed-off-by: Fabio Estevam 
> ---
>  board/udoo/udoo.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c
> index a359626..562f0d8 100644
> --- a/board/udoo/udoo.c
> +++ b/board/udoo/udoo.c
> @@ -245,8 +245,7 @@ int board_init(void)
>   gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
>  
>  #ifdef CONFIG_SATA
> - if (is_cpu_type(MXC_CPU_MX6Q))
> - setup_sata();
> + setup_sata();
>  #endif
>   return 0;
>  }
> 
Reviewed-by: Heinrich Schuchardt 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC] mmc: fsl_esdhc: Do not set high speed mode on MX25 and MX51

2017-10-18 Thread Fabio Estevam
Hi Benoît,

On Wed, Oct 18, 2017 at 2:13 PM, Benoît Thébaudeau  wrote:

> You could stress-test the SD read/write accesses from U-Boot. Does it occur 
> with
> all HS cards?

I am not able to run a stress-test because all SD card accesses fail.

It happens with all HS cards I tested with.

> You can try to set the drive strength of all the eSDHC pads to high or max 
> (for

Looks like the eSDHC pins do not have drive strength control, only
PKE, PUE, PUS and SRE fields.

Also, in the kernel I do not do pinctrl setting and just use the IOMUX
values from U-Boot. In the kernel the SD card operation in high speed
works fine.

> each pad or for the group of pads depending on the register layout for the 
> pads
> used on the board). This worked on my board (custom i.MX25-based, not 
> imx25pdk).

Could you please share your custom eSDHC pinctrl settings in U-Boot?

Also, I suppose you see "Tran Speed: 5000" when you run mmc info
with a SD high speed card connected.

In my case whenever 'mmc info' reports 50MHz I am not able to access
the SD card (saveenv, for example) on both mx25pdk and mx51evk.

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


Re: [U-Boot] [PATCH] cmd: usb_mass_storage: add protection for block_dev

2017-10-18 Thread Tom Rini
On Wed, Oct 18, 2017 at 04:03:21PM +0200, Patrick Delaunay wrote:

> solve data abort for the command "ums 0 ubi 0"
> because result of case blk_get_device_part_str() result is OK
> but with block_dev = 0 when CONFIG_CMD_UBIFS is activate and
> ubi volume is mounted
> 
> Signed-off-by: Patrick Delaunay 
> ---
> 
>  cmd/usb_mass_storage.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
> index cfeecb7..c0563ca 100644
> --- a/cmd/usb_mass_storage.c
> +++ b/cmd/usb_mass_storage.c
> @@ -85,7 +85,7 @@ static int ums_init(const char *devtype, const char 
> *devnums_part_str)
>   partnum = 0;
>  
>   /* f_mass_storage.c assumes SECTOR_SIZE sectors */
> - if (block_dev->blksz != SECTOR_SIZE)
> + if (!block_dev || block_dev->blksz != SECTOR_SIZE)
>   goto cleanup;
>  
>   ums_new = realloc(ums, (ums_count + 1) * sizeof(*ums));

Adding in Marek..

-- 
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 v4 15/18] test/py: test reboot by EFI watchdog

2017-10-18 Thread Heinrich Schuchardt
Clear environment variable efi_selftest before executing the
default tests.

Provide a test verifying that the EFI watchdog
reboots the system upon timeout.

The test depends on CONFIG_CMD_EFI_SELFTEST=y.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
no change
v2
choose test via environment variable
---
 test/py/tests/test_efi_selftest.py | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/py/tests/test_efi_selftest.py 
b/test/py/tests/test_efi_selftest.py
index 76e282a6c7..66b799bed6 100644
--- a/test/py/tests/test_efi_selftest.py
+++ b/test/py/tests/test_efi_selftest.py
@@ -1,4 +1,3 @@
-# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
 # Copyright (c) 2017, Heinrich Schuchardt 
 #
 # SPDX-License-Identifier: GPL-2.0
@@ -14,6 +13,7 @@ def test_efi_selftest(u_boot_console):
Run bootefi selftest
"""
 
+   u_boot_console.run_command(cmd='setenv efi_selftest')
u_boot_console.run_command(cmd='bootefi selftest', 
wait_for_prompt=False)
m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
if m != 0:
@@ -23,3 +23,15 @@ def test_efi_selftest(u_boot_console):
if m != 0:
raise Exception('Reset failed during the EFI selftest')
u_boot_console.restart_uboot();
+
+@pytest.mark.buildconfigspec('cmd_bootefi_selftest')
+def test_efi_selftest_watchdog_reboot(u_boot_console):
+   u_boot_console.run_command(cmd='setenv efi_selftest list')
+   output = u_boot_console.run_command('bootefi selftest')
+   assert '\'watchdog reboot\'' in output
+   u_boot_console.run_command(cmd='setenv efi_selftest watchdog reboot')
+   u_boot_console.run_command(cmd='bootefi selftest', 
wait_for_prompt=False)
+   m = u_boot_console.p.expect(['resetting', 'U-Boot'])
+   if m != 0:
+   raise Exception('Reset failed in \'watchdog reboot\' test')
+   u_boot_console.restart_uboot();
-- 
2.14.2

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


Re: [U-Boot] [RFC] mmc: fsl_esdhc: Do not set high speed mode on MX25 and MX51

2017-10-18 Thread Benoît Thébaudeau
On 18/10/2017 at 18:13, Benoît Thébaudeau wrote:
> Hi Fabio,
> 
> On 18/10/2017 at 17:57, Fabio Estevam wrote:
>> Currently when a high speed SD card is connected on MX25 or MX51 boards
>> the following error happens:
>>
>> U-Boot 2017.11-rc2 (Oct 18 2017 - 13:49:26 -0200)
>>
>> CPU:   Freescale i.MX51 rev3.0 at 800 MHz
>> Reset cause: POR
>> Board: MX51EVK
>> DRAM:  512 MiB
>> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
>> *** Warning - read failed, using default environment
>>
>> In:serial
>> Out:   serial
>> Err:   serial
>> Net:   FEC
>> Hit any key to stop autoboot:  0
>> => saveenv
>> Saving Environment to MMC...
>> Writing to MMC(0)... failed
>>
>> Workaround this issue by not setting the mmc high speed mode flags even
>> if the HOSTCAPBLT register reports that the SD card can operate at
>> high speed.
>>
>> Tested on imx51evk and imx25pdk boards.
>>
>> Signed-off-by: Fabio Estevam 
>> ---
>> Kernel is capable of running the SD card at 50MHz clock, but U-Boot fails.
>>
>> I haven't had a chance to debug this further, but sending it as RFC in case
>> someone has some suggestions.
> 
> [...]
> 
> You could stress-test the SD read/write accesses from U-Boot. Does it occur 
> with
> all HS cards?
> 
> You can try to set the drive strength of all the eSDHC pads to high or max 
> (for
> each pad or for the group of pads depending on the register layout for the 
> pads
> used on the board). This worked on my board (custom i.MX25-based, not 
> imx25pdk).

And set SRE to fast too.

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


[U-Boot] [PATCH v4 18/18] efi_loader: set parent handle in efi_load_image

2017-10-18 Thread Heinrich Schuchardt
The parent_handle of the loaded image must be set.
Set the system table.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
new patch
---
 lib/efi_loader/efi_boottime.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index fd8d15655b..f70d8658ab 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1282,6 +1282,8 @@ static efi_status_t EFIAPI efi_load_image(bool 
boot_policy,
return EFI_EXIT(EFI_UNSUPPORTED);
}
 
+   info->system_table = 
+   info->parent_handle = parent_image;
*image_handle = info;
 
return EFI_EXIT(EFI_SUCCESS);
-- 
2.14.2

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


[U-Boot] [PATCH v4 08/18] efi_selftest: reformat code

2017-10-18 Thread Heinrich Schuchardt
Remove superfluous spaces.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
new patch split off
---
 lib/efi_selftest/efi_selftest.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c
index 45d8d3d384..c2c339a7be 100644
--- a/lib/efi_selftest/efi_selftest.c
+++ b/lib/efi_selftest/efi_selftest.c
@@ -25,8 +25,8 @@ static u16 reset_message[] = L"Selftest completed";
  */
 void efi_st_exit_boot_services(void)
 {
-   unsigned long  map_size = 0;
-   unsigned long  map_key;
+   unsigned long map_size = 0;
+   unsigned long map_key;
unsigned long desc_size;
u32 desc_version;
efi_status_t ret;
-- 
2.14.2

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


[U-Boot] [PATCH v4 13/18] efi_loader: use bootargs as load options

2017-10-18 Thread Heinrich Schuchardt
Use environment variable bootargs used as load options
for bootefi payloads.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
new patch split off
---
 cmd/bootefi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 40834f3899..ff659fc02f 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -218,6 +218,8 @@ static efi_status_t do_bootefi_exec(void *efi, void *fdt,
efi_install_configuration_table(_guid, NULL);
}
 
+   /* Transfer environment variable bootargs as load options */
+   set_load_options(_image_info, "bootargs");
/* Load the EFI payload */
entry = efi_load_pe(efi, _image_info);
if (!entry) {
-- 
2.14.2

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


[U-Boot] [PATCH v4 05/18] efi_loader: guard against double inclusion of efi_loader.h

2017-10-18 Thread Heinrich Schuchardt
Use a define to detect double inclusion of efi_loader.h.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
no change
v2
new patch
---
 include/efi_loader.h | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index af64b11cee..e506eeec61 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -6,6 +6,9 @@
  *  SPDX-License-Identifier: GPL-2.0+
  */
 
+#ifndef _EFI_LOADER_H
+#define _EFI_LOADER_H 1
+
 #include 
 #include 
 #include 
@@ -345,4 +348,6 @@ static inline void efi_set_bootdev(const char *dev, const 
char *devnr,
   const char *path) { }
 static inline void efi_net_set_dhcp_ack(void *pkt, int len) { }
 
-#endif
+#endif /* CONFIG_EFI_LOADER && !CONFIG_SPL_BUILD */
+
+#endif /* _EFI_LOADER_H */
-- 
2.14.2

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


[U-Boot] [PATCH v4 16/18] test/py: fix typo in test_efi_loader.py

2017-10-18 Thread Heinrich Schuchardt
Make a comment line easier to read.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
no change
v2
no change
---
 test/py/tests/test_efi_loader.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/py/tests/test_efi_loader.py b/test/py/tests/test_efi_loader.py
index 5d7f5dbfb2..4d391e13ef 100644
--- a/test/py/tests/test_efi_loader.py
+++ b/test/py/tests/test_efi_loader.py
@@ -12,7 +12,7 @@ import u_boot_utils
 
 """
 Note: This test relies on boardenv_* containing configuration values to define
-which the network environment available for testing. Without this, the parts
+which network environment is available for testing. Without this, the parts
 that rely on network will be automatically skipped.
 
 For example:
-- 
2.14.2

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


[U-Boot] [PATCH v4 12/18] efi_selftest: correctly cleanup after selftest

2017-10-18 Thread Heinrich Schuchardt
After executing bootefi selftest
* restore GD
* unlink the load image handle
* return 0 or 1 and not a truncated efi_status_t.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
new patch split off
---
 cmd/bootefi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 18331536dd..40834f3899 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -349,8 +349,10 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
set_load_options(_image_info, "efi_selftest");
/* Execute the test */
r = efi_selftest(_image_info, );
+   efi_restore_gd();
free(loaded_image_info.load_options);
-   return r;
+   list_del(_image_info_obj.link);
+   return r != EFI_SUCCESS;
} else
 #endif
if (!strcmp(argv[1], "bootmgr")) {
-- 
2.14.2

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


[U-Boot] [PATCH v4 17/18] efi_selftest: provide test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL

2017-10-18 Thread Heinrich Schuchardt
The following services are tested:
OutputString, TestString, SetAttribute.

Signed-off-by: Heinrich Schuchardt 
---
v4
fix build flags
v3
new patch
---
 lib/efi_selftest/Makefile  |  3 ++
 lib/efi_selftest/efi_selftest_textoutput.c | 53 ++
 2 files changed, 56 insertions(+)
 create mode 100644 lib/efi_selftest/efi_selftest_textoutput.c

diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile
index 3e5c9a6d16..b1385383ed 100644
--- a/lib/efi_selftest/Makefile
+++ b/lib/efi_selftest/Makefile
@@ -17,7 +17,9 @@ CFLAGS_efi_selftest_exitbootservices.o := $(CFLAGS_EFI)
 CFLAGS_REMOVE_efi_selftest_exitbootservices.o := $(CFLAGS_NON_EFI)
 CFLAGS_efi_selftest_snp.o := $(CFLAGS_EFI)
 CFLAGS_REMOVE_efi_selftest_snp.o := $(CFLAGS_NON_EFI)
+CFLAGS_efi_selftest_textoutput.o := $(CFLAGS_EFI)
+CFLAGS_REVMOE_efi_selftest_textoutput.o := $(CFLAGS_NON_EFI)
 CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI)
 CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI)
 CFLAGS_efi_selftest_util.o := $(CFLAGS_EFI)
 CFLAGS_REMOVE_efi_selftest_util.o := $(CFLAGS_NON_EFI)
@@ -30,6 +32,7 @@ efi_selftest_console.o \
 efi_selftest_events.o \
 efi_selftest_exitbootservices.o \
 efi_selftest_snp.o \
+efi_selftest_textoutput.o \
 efi_selftest_tpl.o \
 efi_selftest_util.o \
 efi_selftest_watchdog.o
diff --git a/lib/efi_selftest/efi_selftest_textoutput.c 
b/lib/efi_selftest/efi_selftest_textoutput.c
new file mode 100644
index 00..7bc4d2f446
--- /dev/null
+++ b/lib/efi_selftest/efi_selftest_textoutput.c
@@ -0,0 +1,53 @@
+/*
+ * efi_selftest_textoutput
+ *
+ * Copyright (c) 2017 Heinrich Schuchardt 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * Test the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
+ *
+ * The following services are tested:
+ * OutputString, TestString, SetAttribute.
+ */
+
+#include 
+
+/*
+ * Execute unit test.
+ *
+ * @return:EFI_ST_SUCCESS for success
+ */
+static int execute(void)
+{
+   size_t foreground;
+   size_t background;
+   size_t attrib;
+   efi_status_t ret;
+
+   /* SetAttribute */
+   efi_st_printf("\nColor palette\n");
+   for (foreground = 0; foreground < 0x10; ++foreground) {
+   for (background = 0; background < 0x80; background += 0x10) {
+   attrib = foreground | background;
+   con_out->set_attribute(con_out, attrib);
+   efi_st_printf("%p", (void *)attrib);
+   }
+   con_out->set_attribute(con_out, 0);
+   efi_st_printf("\n");
+   }
+   /* TestString */
+   ret = con_out->test_string(con_out,
+   L" !\"#$%&'()*+,-./0-9:;<=>?@A-Z[\\]^_`a-z{|}~\n");
+   if (ret != EFI_ST_SUCCESS) {
+   efi_st_error("TestString failed for ANSI characters\n");
+   return EFI_ST_FAILURE;
+   }
+   return EFI_ST_SUCCESS;
+}
+
+EFI_UNIT_TEST(textoutput) = {
+   .name = "text output",
+   .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
+   .execute = execute,
+};
-- 
2.14.2

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


[U-Boot] [PATCH v4 10/18] efi_selftest: deduplicate code

2017-10-18 Thread Heinrich Schuchardt
Move duplicate code to the new function efi_st_do_tests.

Suggested-by: Alexander Graf 
Signed-off-by: Heinrich Schuchardt 
---
v4
new patch
---
 lib/efi_selftest/efi_selftest.c | 71 -
 1 file changed, 42 insertions(+), 29 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c
index c2c339a7be..73f074d9e1 100644
--- a/lib/efi_selftest/efi_selftest.c
+++ b/lib/efi_selftest/efi_selftest.c
@@ -9,6 +9,13 @@
 #include 
 #include 
 
+/*
+ * Constants for test step bitmap
+ */
+#define EFI_ST_SETUP   1
+#define EFI_ST_EXECUTE 2
+#define EFI_ST_TEARDOWN4
+
 static const struct efi_system_table *systable;
 static const struct efi_boot_services *boottime;
 static const struct efi_runtime_services *runtime;
@@ -133,6 +140,31 @@ static int teardown(struct efi_unit_test *test, unsigned 
int *failures)
return ret;
 }
 
+/*
+ * Execute test steps of one phase.
+ *
+ * @phase  test phase
+ * @steps  steps to execute
+ * failuresreturns EFI_ST_SUCCESS if all test steps succeeded
+ */
+void efi_st_do_tests(unsigned int phase, unsigned int steps,
+unsigned int *failures)
+{
+   struct efi_unit_test *test;
+
+   for (test = ll_entry_start(struct efi_unit_test, efi_unit_test);
+test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) {
+   if (test->phase != phase)
+   continue;
+   if (steps & EFI_ST_SETUP)
+   setup(test, failures);
+   if (steps & EFI_ST_EXECUTE)
+   execute(test, failures);
+   if (steps & EFI_ST_TEARDOWN)
+   teardown(test, failures);
+   }
+}
+
 /*
  * Execute selftest of the EFI API
  *
@@ -153,7 +185,6 @@ static int teardown(struct efi_unit_test *test, unsigned 
int *failures)
 efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
 struct efi_system_table *systab)
 {
-   struct efi_unit_test *test;
unsigned int failures = 0;
 
systable = systab;
@@ -169,41 +200,23 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t 
image_handle,
  ll_entry_count(struct efi_unit_test, efi_unit_test));
 
/* Execute boottime tests */
-   for (test = ll_entry_start(struct efi_unit_test, efi_unit_test);
-test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) {
-   if (test->phase == EFI_EXECUTE_BEFORE_BOOTTIME_EXIT) {
-   setup(test, );
-   execute(test, );
-   teardown(test, );
-   }
-   }
+   efi_st_do_tests(EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
+   EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN,
+   );
 
/* Execute mixed tests */
-   for (test = ll_entry_start(struct efi_unit_test, efi_unit_test);
-test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) {
-   if (test->phase == EFI_SETUP_BEFORE_BOOTTIME_EXIT)
-   setup(test, );
-   }
+   efi_st_do_tests(EFI_SETUP_BEFORE_BOOTTIME_EXIT,
+   EFI_ST_SETUP, );
 
efi_st_exit_boot_services();
 
-   for (test = ll_entry_start(struct efi_unit_test, efi_unit_test);
-test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) {
-   if (test->phase == EFI_SETUP_BEFORE_BOOTTIME_EXIT) {
-   execute(test, );
-   teardown(test, );
-   }
-   }
+   efi_st_do_tests(EFI_SETUP_BEFORE_BOOTTIME_EXIT,
+   EFI_ST_EXECUTE | EFI_ST_TEARDOWN, );
 
/* Execute runtime tests */
-   for (test = ll_entry_start(struct efi_unit_test, efi_unit_test);
-test < ll_entry_end(struct efi_unit_test, efi_unit_test); ++test) {
-   if (test->phase == EFI_SETUP_AFTER_BOOTTIME_EXIT) {
-   setup(test, );
-   execute(test, );
-   teardown(test, );
-   }
-   }
+   efi_st_do_tests(EFI_SETUP_AFTER_BOOTTIME_EXIT,
+   EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN,
+   );
 
/* Give feedback */
efi_st_printf("\nSummary: %u failures\n\n", failures);
-- 
2.14.2

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


[U-Boot] [PATCH v3 04/18] efi_loader: new function utf8_to_utf16

2017-10-18 Thread Heinrich Schuchardt
Provide a conversion function from utf8 to utf16.

Add missing #include  in include/charset.h.
Remove superfluous #include  in lib/charset.c.

Signed-off-by: Heinrich Schuchardt 
---
v3
no change
v2
new patch
---
 include/charset.h | 15 +++
 lib/charset.c | 57 ++-
 2 files changed, 71 insertions(+), 1 deletion(-)

diff --git a/include/charset.h b/include/charset.h
index 37a3278499..2662c2f7c9 100644
--- a/include/charset.h
+++ b/include/charset.h
@@ -9,6 +9,8 @@
 #ifndef __CHARSET_H_
 #define __CHARSET_H_
 
+#include 
+
 #define MAX_UTF8_PER_UTF16 3
 
 /**
@@ -62,4 +64,17 @@ uint16_t *utf16_strdup(const uint16_t *s);
  */
 uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, size_t size);
 
+/**
+ * utf8_to_utf16() - Convert an utf8 string to utf16
+ *
+ * Converts up to 'size' characters of the utf16 string 'src' to utf8
+ * written to the 'dest' buffer. Stops at 0x00.
+ *
+ * @dest   the destination buffer to write the utf8 characters
+ * @srcthe source utf16 string
+ * @size   maximum number of utf16 characters to convert
+ * @return the pointer to the first unwritten byte in 'dest'
+ */
+uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size);
+
 #endif /* __CHARSET_H_ */
diff --git a/lib/charset.c b/lib/charset.c
index ff76e88c77..8cd17ea1cb 100644
--- a/lib/charset.c
+++ b/lib/charset.c
@@ -6,7 +6,6 @@
  *  SPDX-License-Identifier: GPL-2.0+
  */
 
-#include 
 #include 
 #include 
 
@@ -99,3 +98,59 @@ uint8_t *utf16_to_utf8(uint8_t *dest, const uint16_t *src, 
size_t size)
 
return dest;
 }
+
+uint16_t *utf8_to_utf16(uint16_t *dest, const uint8_t *src, size_t size)
+{
+   while (size--) {
+   int extension_bytes;
+   uint32_t code;
+
+   extension_bytes = 0;
+   if (*src <= 0x7f) {
+   code = *src++;
+   /* Exit on zero byte */
+   if (!code)
+   size = 0;
+   } else if (*src <= 0xbf) {
+   /* Illegal code */
+   code = '?';
+   } else if (*src <= 0xdf) {
+   code = *src++ & 0x1f;
+   extension_bytes = 1;
+   } else if (*src <= 0xef) {
+   code = *src++ & 0x0f;
+   extension_bytes = 2;
+   } else if (*src <= 0xf7) {
+   code = *src++ & 0x07;
+   extension_bytes = 3;
+   } else {
+   /* Illegal code */
+   code = '?';
+   }
+
+   for (; extension_bytes && size; --size, --extension_bytes) {
+   if ((*src & 0xc0) == 0x80) {
+   code <<= 6;
+   code |= *src++ & 0x3f;
+   } else {
+   /* Illegal code */
+   code = '?';
+   ++src;
+   --size;
+   break;
+   }
+   }
+
+   if (code < 0x1) {
+   *dest++ = code;
+   } else {
+   /*
+* Simplified expression for
+* (((code - 0x1) >> 10) & 0x3ff) | 0xd800
+*/
+   *dest++ = (code >> 10) + 0xd7c0;
+   *dest++ = (code & 0x3ff) | 0xdc00;
+   }
+   }
+   return dest;
+}
-- 
2.14.2

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


[U-Boot] [PATCH v4 03/18] efi_selftest: provide test for watchdog timer

2017-10-18 Thread Heinrich Schuchardt
The test verifies that resetting the watchdog timer ensures
that it is not called during the timeout period.

Testing that the watchdog timer actually executes a reset
would require a test outside the efi_selftest framework.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
no change
v2
no change
---
 lib/efi_selftest/Makefile|   5 +-
 lib/efi_selftest/efi_selftest_watchdog.c | 185 +++
 2 files changed, 189 insertions(+), 1 deletion(-)
 create mode 100644 lib/efi_selftest/efi_selftest_watchdog.c

diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile
index e446046e02..3e5c9a6d16 100644
--- a/lib/efi_selftest/Makefile
+++ b/lib/efi_selftest/Makefile
@@ -21,6 +21,8 @@ CFLAGS_efi_selftest_tpl.o := $(CFLAGS_EFI)
 CFLAGS_REMOVE_efi_selftest_tpl.o := $(CFLAGS_NON_EFI)
 CFLAGS_efi_selftest_util.o := $(CFLAGS_EFI)
 CFLAGS_REMOVE_efi_selftest_util.o := $(CFLAGS_NON_EFI)
+CFLAGS_efi_selftest_watchdog.o := $(CFLAGS_EFI)
+CFLAGS_REMOVE_efi_selftest_watchdog.o := $(CFLAGS_NON_EFI)
 
 obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += \
 efi_selftest.o \
@@ -29,4 +31,5 @@ efi_selftest_events.o \
 efi_selftest_exitbootservices.o \
 efi_selftest_snp.o \
 efi_selftest_tpl.o \
-efi_selftest_util.o
+efi_selftest_util.o \
+efi_selftest_watchdog.o
diff --git a/lib/efi_selftest/efi_selftest_watchdog.c 
b/lib/efi_selftest/efi_selftest_watchdog.c
new file mode 100644
index 00..f8c5404000
--- /dev/null
+++ b/lib/efi_selftest/efi_selftest_watchdog.c
@@ -0,0 +1,185 @@
+/*
+ * efi_selftest_watchdog
+ *
+ * Copyright (c) 2017 Heinrich Schuchardt 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * This unit test checks that the watchdog timer will not cause
+ * a system restart during the timeout period after a timer reset.
+ *
+ * Testing that the watchdog timer actually will reset the system
+ * after a timeout is not possible within the used framework.
+ */
+
+#include 
+
+/*
+ * This is the communication structure for the notification function.
+ */
+struct notify_context {
+   /* Status code returned when resetting watchdog */
+   efi_status_t status;
+   /* Number of invocations of the notification function */
+   unsigned int timer_ticks;
+};
+
+static struct efi_event *event_notify;
+static struct efi_event *event_wait;
+static struct efi_boot_services *boottime;
+static struct notify_context notification_context;
+
+/*
+ * Notification function, increments the notfication count if parameter
+ * context is provided.
+ *
+ * @event  notified event
+ * @contextpointer to the timeout
+ */
+static void EFIAPI notify(struct efi_event *event, void *context)
+{
+   struct notify_context *notify_context = context;
+   efi_status_t ret = EFI_SUCCESS;
+
+   if (!notify_context)
+   return;
+
+   /* Reset watchdog timer to one second */
+   ret = boottime->set_watchdog_timer(1, 0, 0, NULL);
+   if (ret != EFI_SUCCESS)
+   notify_context->status = ret;
+   /* Count number of calls */
+   notify_context->timer_ticks++;
+}
+
+/*
+ * Setup unit test.
+ *
+ * Create two timer events.
+ * One with EVT_NOTIFY_SIGNAL, the other with EVT_NOTIFY_WAIT.
+ *
+ * @handle:handle of the loaded image
+ * @systable:  system table
+ * @return:EFI_ST_SUCCESS for success
+ */
+static int setup(const efi_handle_t handle,
+const struct efi_system_table *systable)
+{
+   efi_status_t ret;
+
+   boottime = systable->boottime;
+
+   notification_context.status = EFI_SUCCESS;
+   notification_context.timer_ticks = 0;
+   ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_SIGNAL,
+TPL_CALLBACK, notify,
+(void *)_context,
+_notify);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("could not create event\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT,
+TPL_CALLBACK, notify, NULL, _wait);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("could not create event\n");
+   return EFI_ST_FAILURE;
+   }
+   return EFI_ST_SUCCESS;
+}
+
+/*
+ * Tear down unit test.
+ *
+ * Close the events created in setup.
+ *
+ * @return:EFI_ST_SUCCESS for success
+ */
+static int teardown(void)
+{
+   efi_status_t ret;
+
+   /* Set the watchdog timer to the five minute default value */
+   ret = boottime->set_watchdog_timer(300, 0, 0, NULL);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("Setting watchdog timer failed\n");
+   return EFI_ST_FAILURE;
+   }
+   if (event_notify) {
+   ret = boottime->close_event(event_notify);
+   event_notify = NULL;
+   if (ret != EFI_SUCCESS) {
+   

[U-Boot] [PATCH v4 01/18] efi_loader: move efi_search_obj up in code

2017-10-18 Thread Heinrich Schuchardt
To avoid a forward declaration move efi_search_obj before
all protocol services functions.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3  
no change
v2
no change
---
 lib/efi_loader/efi_boottime.c | 41 +
 1 file changed, 21 insertions(+), 20 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index f627340de4..30577f717e 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -690,6 +690,27 @@ static efi_status_t EFIAPI efi_check_event(struct 
efi_event *event)
return EFI_EXIT(EFI_INVALID_PARAMETER);
 }
 
+/*
+ * Find the internal EFI object for a handle.
+ *
+ * @handle handle to find
+ * @return EFI object
+ */
+static struct efi_object *efi_search_obj(void *handle)
+{
+   struct list_head *lhandle;
+
+   list_for_each(lhandle, _obj_list) {
+   struct efi_object *efiobj;
+
+   efiobj = list_entry(lhandle, struct efi_object, link);
+   if (efiobj->handle == handle)
+   return efiobj;
+   }
+
+   return NULL;
+}
+
 /*
  * Install protocol interface.
  *
@@ -1355,26 +1376,6 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t 
image_handle,
panic("EFI application exited");
 }
 
-/*
- * Find the internal EFI object for a handle.
- *
- * @handle handle to find
- * @return EFI object
- */
-static struct efi_object *efi_search_obj(void *handle)
-{
-   struct list_head *lhandle;
-
-   list_for_each(lhandle, _obj_list) {
-   struct efi_object *efiobj;
-   efiobj = list_entry(lhandle, struct efi_object, link);
-   if (efiobj->handle == handle)
-   return efiobj;
-   }
-
-   return NULL;
-}
-
 /*
  * Unload an EFI image.
  *
-- 
2.14.2

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


[U-Boot] [PATCH v4 07/18] efi_selftest: provide a dummy device path

2017-10-18 Thread Heinrich Schuchardt
Currently we pass bootefi_device_path and bootefi_image_path as
device and image path without initializing them. They may carry
values from previous calls to bootefi.

With the patch the variables are initialized valid dummy values.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
new patch split off
---
 cmd/bootefi.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 59696f4601..d497381ac3 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -299,6 +299,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
struct efi_loaded_image loaded_image_info = {};
struct efi_object loaded_image_info_obj = {};
 
+   /* Construct a dummy device path. */
+   bootefi_device_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
+ (uintptr_t)_selftest,
+ (uintptr_t)_selftest);
+   bootefi_image_path = efi_dp_from_file(NULL, 0, "\\selftest");
+
efi_setup_loaded_image(_image_info,
   _image_info_obj,
   bootefi_device_path, bootefi_image_path);
-- 
2.14.2

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


[U-Boot] [PATCH v4 02/18] efi_loader: implement SetWatchdogTimer

2017-10-18 Thread Heinrich Schuchardt
The watchdog is initialized with a 5 minute timeout period.
It can be reset by SetWatchdogTimer.
It is stopped by ExitBoottimeServices.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
add a constant for 1s to 100ns conversion
v2
code comments updated
---
 cmd/bootefi.c |  1 +
 include/efi_loader.h  |  4 ++
 lib/efi_loader/Makefile   |  2 +-
 lib/efi_loader/efi_boottime.c | 17 ++---
 lib/efi_loader/efi_watchdog.c | 89 +++
 5 files changed, 98 insertions(+), 15 deletions(-)
 create mode 100644 lib/efi_loader/efi_watchdog.c

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 478bc116e2..18176a1266 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -43,6 +43,7 @@ static void efi_init_obj_list(void)
 #ifdef CONFIG_GENERATE_SMBIOS_TABLE
efi_smbios_register();
 #endif
+   efi_watchdog_register();
 
/* Initialize EFI runtime services */
efi_reset_system_init();
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 1b92edbd77..af64b11cee 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -163,6 +163,8 @@ int efi_disk_register(void);
 int efi_gop_register(void);
 /* Called by bootefi to make the network interface available */
 int efi_net_register(void);
+/* Called by bootefi to make the watchdog available */
+int efi_watchdog_register(void);
 /* Called by bootefi to make SMBIOS tables available */
 void efi_smbios_register(void);
 
@@ -171,6 +173,8 @@ efi_fs_from_path(struct efi_device_path *fp);
 
 /* Called by networking code to memorize the dhcp ack package */
 void efi_net_set_dhcp_ack(void *pkt, int len);
+/* Called by efi_set_watchdog_timer to reset the timer */
+efi_status_t efi_set_watchdog(unsigned long timeout);
 
 /* Called from places to check whether a timer expired */
 void efi_timer_check(void);
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index ddb978f650..83d879b686 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -17,7 +17,7 @@ endif
 obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
 obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o
-obj-y += efi_file.o efi_variable.o efi_bootmgr.o
+obj-y += efi_file.o efi_variable.o efi_bootmgr.o efi_watchdog.o
 obj-$(CONFIG_LCD) += efi_gop.o
 obj-$(CONFIG_DM_VIDEO) += efi_gop.o
 obj-$(CONFIG_PARTITIONS) += efi_disk.o
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 30577f717e..fd8d15655b 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -155,18 +155,6 @@ void efi_signal_event(struct efi_event *event)
event->is_queued = false;
 }
 
-/*
- * Write a debug message for an EPI API service that is not implemented yet.
- *
- * @funcname   function that is not yet implemented
- * @return EFI_UNSUPPORTED
- */
-static efi_status_t efi_unsupported(const char *funcname)
-{
-   debug("EFI: App called into unimplemented function %s\n", funcname);
-   return EFI_EXIT(EFI_UNSUPPORTED);
-}
-
 /*
  * Raise the task priority level.
  *
@@ -1454,6 +1442,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(void 
*image_handle,
bootm_disable_interrupts();
 
/* Give the payload some time to boot */
+   efi_set_watchdog(0);
WATCHDOG_RESET();
 
return EFI_EXIT(EFI_SUCCESS);
@@ -1497,7 +1486,7 @@ static efi_status_t EFIAPI efi_stall(unsigned long 
microseconds)
 /*
  * Reset the watchdog timer.
  *
- * This function implements the WatchdogTimer service.
+ * This function implements the SetWatchdogTimer service.
  * See the Unified Extensible Firmware Interface (UEFI) specification
  * for details.
  *
@@ -1514,7 +1503,7 @@ static efi_status_t EFIAPI 
efi_set_watchdog_timer(unsigned long timeout,
 {
EFI_ENTRY("%ld, 0x%"PRIx64", %ld, %p", timeout, watchdog_code,
  data_size, watchdog_data);
-   return efi_unsupported(__func__);
+   return EFI_EXIT(efi_set_watchdog(timeout));
 }
 
 /*
diff --git a/lib/efi_loader/efi_watchdog.c b/lib/efi_loader/efi_watchdog.c
new file mode 100644
index 00..35a45dedf8
--- /dev/null
+++ b/lib/efi_loader/efi_watchdog.c
@@ -0,0 +1,89 @@
+/*
+ *  EFI watchdog
+ *
+ *  Copyright (c) 2017 Heinrich Schuchardt
+ *
+ *  SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+
+/* Conversion factor from seconds to multiples of 100ns */
+#define EFI_SECONDS_TO_100NS 1000ULL
+
+static struct efi_event *watchdog_timer_event;
+
+/*
+ * Reset the system when the watchdog event is notified.
+ *
+ * @event: the watchdog event
+ * @context:   not used
+ */
+static void EFIAPI efi_watchdog_timer_notify(struct efi_event *event,
+void *context)
+{
+   EFI_ENTRY("%p, %p", event, context);
+
+   printf("\nEFI: Watchdog timeout\n");
+   

[U-Boot] [PATCH v4 06/18] efi_loader: consistently use efi_status_t in bootefi

2017-10-18 Thread Heinrich Schuchardt
Where ulong or unsigned long are used to hold an EFI status
code we should consistenly use efi_status_t.

Signed-off-by: Heinrich Schuchardt 
---
v4
fix indentation
v3
new patch
---
 cmd/bootefi.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 18176a1266..6bdbb89c29 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -93,10 +93,10 @@ static void *copy_fdt(void *fdt)
return new_fdt;
 }
 
-static ulong efi_do_enter(void *image_handle,
- struct efi_system_table *st,
- asmlinkage ulong (*entry)(void *image_handle,
-   struct efi_system_table *st))
+static efi_status_t efi_do_enter(
+   void *image_handle, struct efi_system_table *st,
+   asmlinkage ulong (*entry)(void *image_handle,
+ struct efi_system_table *st))
 {
efi_status_t ret = EFI_LOAD_ERROR;
 
@@ -107,7 +107,7 @@ static ulong efi_do_enter(void *image_handle,
 }
 
 #ifdef CONFIG_ARM64
-static unsigned long efi_run_in_el2(asmlinkage ulong (*entry)(
+static efi_status_t efi_run_in_el2(asmlinkage ulong (*entry)(
void *image_handle, struct efi_system_table *st),
void *image_handle, struct efi_system_table *st)
 {
@@ -122,9 +122,9 @@ static unsigned long efi_run_in_el2(asmlinkage ulong 
(*entry)(
  * Load an EFI payload into a newly allocated piece of memory, register all
  * EFI objects it would want to access and jump to it.
  */
-static unsigned long do_bootefi_exec(void *efi, void *fdt,
-struct efi_device_path *device_path,
-struct efi_device_path *image_path)
+static efi_status_t do_bootefi_exec(void *efi, void *fdt,
+   struct efi_device_path *device_path,
+   struct efi_device_path *image_path)
 {
struct efi_loaded_image loaded_image_info = {};
struct efi_object loaded_image_info_obj = {};
@@ -278,7 +278,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 {
char *saddr, *sfdt;
unsigned long addr, fdt_addr = 0;
-   unsigned long r;
+   efi_status_t r;
 
if (argc < 2)
return CMD_RET_USAGE;
-- 
2.14.2

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


[U-Boot] [PATCH v4 00/18] efi_loader: implement SetWatchdogTimer

2017-10-18 Thread Heinrich Schuchardt
The patch series is centered on implementing the SetWatchdogTimer
boottime service. Two tests are supplied. One that checks that
resetting the watchdog timer saves from a reboot. The other
checks that the watchdog timer actually leads to a reset.
Both are covered by Python test cases.

A test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.setattribute is supplied.

Additional fixes include missing comments and fixing typos.

v4:
Fix build flags for efi_selftest_textoutput.c
Remove superfluous definitions in patch
efi_selftest: allow to select a single test for exexution
Fix indentation in
efi_loader: consistently use efi_status_t in bootefi
v3:
Split patches as suggested by Alex.
Add test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.setattribute

Heinrich Schuchardt (18):
  efi_loader: move efi_search_obj up in code
  efi_loader: implement SetWatchdogTimer
  efi_selftest: provide test for watchdog timer
  efi_loader: new function utf8_to_utf16
  efi_loader: guard against double inclusion of efi_loader.h
  efi_loader: consistently use efi_status_t in bootefi
  efi_selftest: provide a dummy device path
  efi_selftest: reformat code
  efi_selftest: efi_st_memcmp should return 0
  efi_selftest: deduplicate code
  efi_selftest: allow to select a single test for exexution
  efi_selftest: correctly cleanup after selftest
  efi_loader: use bootargs as load options
  efi_selftest: test reboot by watchdog
  test/py: test reboot by EFI watchdog
  test/py: fix typo in test_efi_loader.py
  efi_selftest: provide test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
  efi_loader: set parent handle in efi_load_image

 cmd/bootefi.c  |  56 ++-
 include/charset.h  |  15 ++
 include/efi_loader.h   |  11 +-
 include/efi_selftest.h |  18 +++
 lib/charset.c  |  57 ++-
 lib/efi_loader/Makefile|   2 +-
 lib/efi_loader/efi_boottime.c  |  60 
 lib/efi_loader/efi_watchdog.c  |  89 +++
 lib/efi_selftest/Makefile  |  10 +-
 lib/efi_selftest/efi_selftest.c| 153 ++-
 lib/efi_selftest/efi_selftest_console.c|  10 ++
 lib/efi_selftest/efi_selftest_textoutput.c |  53 +++
 lib/efi_selftest/efi_selftest_util.c   |  11 +-
 lib/efi_selftest/efi_selftest_watchdog.c   | 230 +
 test/py/tests/test_efi_loader.py   |   2 +-
 test/py/tests/test_efi_selftest.py |  14 +-
 16 files changed, 711 insertions(+), 80 deletions(-)
 create mode 100644 lib/efi_loader/efi_watchdog.c
 create mode 100644 lib/efi_selftest/efi_selftest_textoutput.c
 create mode 100644 lib/efi_selftest/efi_selftest_watchdog.c

-- 
2.14.2

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


[U-Boot] [PATCH v4 12/18] efi_selftest: allow to select a single test for exexution

2017-10-18 Thread Heinrich Schuchardt
Environment variable efi_selftest is passed as load options
to the selftest application. It is used to select a single
test to be executed.

The load options are an UTF8 string. Yet I decided to keep
the name propertiy of the tests as char[] to reduce code
size.

Special value 'list' displays a list of all available tests.

Tests get an on_request property. If this property is set
the tests are only executed if explicitly requested.

The invocation of efi_selftest is changed to reflect that
bootefi selftest with efi_selftest = 'list' will call the
Exit bootservice.

Signed-off-by: Heinrich Schuchardt 
---
v4
remove superfluous definitions
v3
split off unrelated changes to separate patches
v2
use an environment variable to choose a test
---
 cmd/bootefi.c   | 37 +-
 include/efi_selftest.h  | 12 +
 lib/efi_selftest/efi_selftest.c | 88 ++---
 lib/efi_selftest/efi_selftest_console.c | 10 
 lib/efi_selftest/efi_selftest_util.c|  9 
 5 files changed, 149 insertions(+), 9 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 6dab3cc2a7..05375a657a 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -6,10 +6,12 @@
  *  SPDX-License-Identifier: GPL-2.0+
  */
 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -50,6 +52,32 @@ static void efi_init_obj_list(void)
efi_get_time_init();
 }
 
+/*
+ * Set the load options of an image from an environment variable.
+ *
+ * @loaded_image_info: the image
+ * @env_var:   name of the environment variable
+ */
+static void set_load_options(struct efi_loaded_image *loaded_image_info,
+const char *env_var)
+{
+   size_t size;
+   const char *env = env_get(env_var);
+
+   loaded_image_info->load_options = NULL;
+   loaded_image_info->load_options_size = 0;
+   if (!env)
+   return;
+   size = strlen(env) + 1;
+   loaded_image_info->load_options = calloc(size, sizeof(u16));
+   if (!loaded_image_info->load_options) {
+   printf("ERROR: Out of memory\n");
+   return;
+   }
+   utf8_to_utf16(loaded_image_info->load_options, (u8 *)env, size);
+   loaded_image_info->load_options_size = size * 2;
+}
+
 static void *copy_fdt(void *fdt)
 {
u64 fdt_size = fdt_totalsize(fdt);
@@ -317,7 +345,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
/* Initialize and populate EFI object list */
if (!efi_obj_list_initalized)
efi_init_obj_list();
-   return efi_selftest(_image_info, );
+   /* Transfer environment variable efi_selftest as load options */
+   set_load_options(_image_info, "efi_selftest");
+   /* Execute the test */
+   r = efi_selftest(_image_info, );
+   free(loaded_image_info.load_options);
+   return r;
} else
 #endif
if (!strcmp(argv[1], "bootmgr")) {
@@ -363,6 +396,8 @@ static char bootefi_help_text[] =
 #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
"bootefi selftest\n"
"  - boot an EFI selftest application stored within U-Boot\n"
+   "Use environment variable efi_selftest to select a single test.\n"
+   "Use 'setenv efi_selftest list' to enumerate all tests.\n"
 #endif
"bootmgr [fdt addr]\n"
"  - load and boot EFI payload based on BootOrder/Boot variables.\n"
diff --git a/include/efi_selftest.h b/include/efi_selftest.h
index 7ec42a0406..5cc8d4f600 100644
--- a/include/efi_selftest.h
+++ b/include/efi_selftest.h
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #define EFI_ST_SUCCESS 0
@@ -71,6 +72,15 @@ void efi_st_printf(const char *fmt, ...)
  */
 int efi_st_memcmp(const void *buf1, const void *buf2, size_t length);
 
+/*
+ * Compare an u16 string to a char string.
+ *
+ * @buf1:  u16 string
+ * @buf2:  char string
+ * @return:0 if both buffers contain the same bytes
+ */
+int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2);
+
 /*
  * Reads an Unicode character from the input device.
  *
@@ -88,6 +98,7 @@ u16 efi_st_get_key(void);
  * @setup: set up the unit test
  * @teardown:  tear down the unit test
  * @execute:   execute the unit test
+ * @on_request:test is only executed on request
  */
 struct efi_unit_test {
const char *name;
@@ -96,6 +107,7 @@ struct efi_unit_test {
 const struct efi_system_table *systable);
int (*execute)(void);
int (*teardown)(void);
+   bool on_request;
 };
 
 /* Declare a new EFI unit test */
diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c
index 73f074d9e1..5d8bb54d53 100644
--- a/lib/efi_selftest/efi_selftest.c
+++ b/lib/efi_selftest/efi_selftest.c
@@ 

[U-Boot] [PATCH v4 14/18] efi_selftest: test reboot by watchdog

2017-10-18 Thread Heinrich Schuchardt
A test is added that verifies that the watchdog timer actually
causes a reboot upon timeout. The test is only executed on
request using

setenv efi_selftest watchdog reboot
bootefi selftest

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
correct comments
v2
no change
---
 lib/efi_selftest/efi_selftest_watchdog.c | 68 ++--
 1 file changed, 57 insertions(+), 11 deletions(-)

diff --git a/lib/efi_selftest/efi_selftest_watchdog.c 
b/lib/efi_selftest/efi_selftest_watchdog.c
index f8c5404000..e4af38407f 100644
--- a/lib/efi_selftest/efi_selftest_watchdog.c
+++ b/lib/efi_selftest/efi_selftest_watchdog.c
@@ -5,11 +5,16 @@
  *
  * SPDX-License-Identifier: GPL-2.0+
  *
- * This unit test checks that the watchdog timer will not cause
- * a system restart during the timeout period after a timer reset.
+ * The 'watchdog timer' unit test checks that the watchdog timer
+ * will not cause a system restart during the timeout period after
+ * a timer reset.
  *
- * Testing that the watchdog timer actually will reset the system
- * after a timeout is not possible within the used framework.
+ * The 'watchdog reboot' unit test checks that the watchdog timer
+ * actually reboots the system after a timeout. The test is only
+ * executed on explicit request. Use the following commands:
+ *
+ * setenv efi_selftest watchdog reboot
+ * bootefi selftest
  */
 
 #include 
@@ -28,6 +33,7 @@ static struct efi_event *event_notify;
 static struct efi_event *event_wait;
 static struct efi_boot_services *boottime;
 static struct notify_context notification_context;
+static bool watchdog_reset;
 
 /*
  * Notification function, increments the notfication count if parameter
@@ -88,6 +94,34 @@ static int setup(const efi_handle_t handle,
return EFI_ST_SUCCESS;
 }
 
+/*
+ * Execute the test resetting the watchdog in a timely manner. No reboot 
occurs.
+ *
+ * @handle:handle of the loaded image
+ * @systable:  system table
+ * @return:EFI_ST_SUCCESS for success
+ */
+static int setup_timer(const efi_handle_t handle,
+  const struct efi_system_table *systable)
+{
+   watchdog_reset = true;
+   return setup(handle, systable);
+}
+
+/*
+ * Execute the test without resetting the watchdog. A system reboot occurs.
+ *
+ * @handle:handle of the loaded image
+ * @systable:  system table
+ * @return:EFI_ST_SUCCESS for success
+ */
+static int setup_reboot(const efi_handle_t handle,
+   const struct efi_system_table *systable)
+{
+   watchdog_reset = false;
+   return setup(handle, systable);
+}
+
 /*
  * Tear down unit test.
  *
@@ -146,11 +180,14 @@ static int execute(void)
efi_st_error("Setting watchdog timer failed\n");
return EFI_ST_FAILURE;
}
-   /* Set 600 ms timer */
-   ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC, 600);
-   if (ret != EFI_SUCCESS) {
-   efi_st_error("Could not set timer\n");
-   return EFI_ST_FAILURE;
+   if (watchdog_reset) {
+   /* Set 600 ms timer */
+   ret = boottime->set_timer(event_notify, EFI_TIMER_PERIODIC,
+ 600);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("Could not set timer\n");
+   return EFI_ST_FAILURE;
+   }
}
/* Set 1350 ms timer */
ret = boottime->set_timer(event_wait, EFI_TIMER_RELATIVE, 1350);
@@ -176,10 +213,19 @@ static int execute(void)
return EFI_ST_SUCCESS;
 }
 
-EFI_UNIT_TEST(watchdog) = {
+EFI_UNIT_TEST(watchdog1) = {
.name = "watchdog timer",
.phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
-   .setup = setup,
+   .setup = setup_timer,
+   .execute = execute,
+   .teardown = teardown,
+};
+
+EFI_UNIT_TEST(watchdog2) = {
+   .name = "watchdog reboot",
+   .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
+   .setup = setup_reboot,
.execute = execute,
.teardown = teardown,
+   .on_request = true,
 };
-- 
2.14.2

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


[U-Boot] [PATCH v4 09/18] efi_selftest: efi_st_memcmp should return 0

2017-10-18 Thread Heinrich Schuchardt
If the compared memory areas match the return value should be 0.
We should not use the unrelated constant EFI_ST_SUCCESS.

Signed-off-by: Heinrich Schuchardt 
---
v4
no change
v3
new patch split off
---
 lib/efi_selftest/efi_selftest_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_selftest/efi_selftest_util.c 
b/lib/efi_selftest/efi_selftest_util.c
index 5cffe383d8..5f81f251c4 100644
--- a/lib/efi_selftest/efi_selftest_util.c
+++ b/lib/efi_selftest/efi_selftest_util.c
@@ -21,5 +21,5 @@ int efi_st_memcmp(const void *buf1, const void *buf2, size_t 
length)
++pos1;
++pos2;
}
-   return EFI_ST_SUCCESS;
+   return 0;
 }
-- 
2.14.2

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


Re: [U-Boot] [RFC] mmc: fsl_esdhc: Do not set high speed mode on MX25 and MX51

2017-10-18 Thread Benoît Thébaudeau
Hi Fabio,

On 18/10/2017 at 17:57, Fabio Estevam wrote:
> Currently when a high speed SD card is connected on MX25 or MX51 boards
> the following error happens:
> 
> U-Boot 2017.11-rc2 (Oct 18 2017 - 13:49:26 -0200)
> 
> CPU:   Freescale i.MX51 rev3.0 at 800 MHz
> Reset cause: POR
> Board: MX51EVK
> DRAM:  512 MiB
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
> *** Warning - read failed, using default environment
> 
> In:serial
> Out:   serial
> Err:   serial
> Net:   FEC
> Hit any key to stop autoboot:  0
> => saveenv
> Saving Environment to MMC...
> Writing to MMC(0)... failed
> 
> Workaround this issue by not setting the mmc high speed mode flags even
> if the HOSTCAPBLT register reports that the SD card can operate at
> high speed.
> 
> Tested on imx51evk and imx25pdk boards.
> 
> Signed-off-by: Fabio Estevam 
> ---
> Kernel is capable of running the SD card at 50MHz clock, but U-Boot fails.
> 
> I haven't had a chance to debug this further, but sending it as RFC in case
> someone has some suggestions.

[...]

You could stress-test the SD read/write accesses from U-Boot. Does it occur with
all HS cards?

You can try to set the drive strength of all the eSDHC pads to high or max (for
each pad or for the group of pads depending on the register layout for the pads
used on the board). This worked on my board (custom i.MX25-based, not imx25pdk).

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


Re: [U-Boot] [RFC] mmc: fsl_esdhc: Do not set high speed mode on MX25 and MX51

2017-10-18 Thread Otavio Salvador
On Wed, Oct 18, 2017 at 1:57 PM, Fabio Estevam  wrote:
> Currently when a high speed SD card is connected on MX25 or MX51 boards
> the following error happens:
>
> U-Boot 2017.11-rc2 (Oct 18 2017 - 13:49:26 -0200)
>
> CPU:   Freescale i.MX51 rev3.0 at 800 MHz
> Reset cause: POR
> Board: MX51EVK
> DRAM:  512 MiB
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1
> *** Warning - read failed, using default environment
>
> In:serial
> Out:   serial
> Err:   serial
> Net:   FEC
> Hit any key to stop autoboot:  0
> => saveenv
> Saving Environment to MMC...
> Writing to MMC(0)... failed
>
> Workaround this issue by not setting the mmc high speed mode flags even
> if the HOSTCAPBLT register reports that the SD card can operate at
> high speed.
>
> Tested on imx51evk and imx25pdk boards.
>
> Signed-off-by: Fabio Estevam 

Tested-by: Otavio Salvador  # imx25pdk

I had this error when booting here and I can confirm it fixes the issue for me.

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


[U-Boot] [RFC] mmc: fsl_esdhc: Do not set high speed mode on MX25 and MX51

2017-10-18 Thread Fabio Estevam
Currently when a high speed SD card is connected on MX25 or MX51 boards
the following error happens:

U-Boot 2017.11-rc2 (Oct 18 2017 - 13:49:26 -0200)

CPU:   Freescale i.MX51 rev3.0 at 800 MHz
Reset cause: POR
Board: MX51EVK
DRAM:  512 MiB
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
*** Warning - read failed, using default environment

In:serial
Out:   serial
Err:   serial
Net:   FEC
Hit any key to stop autoboot:  0
=> saveenv
Saving Environment to MMC...
Writing to MMC(0)... failed

Workaround this issue by not setting the mmc high speed mode flags even
if the HOSTCAPBLT register reports that the SD card can operate at
high speed.

Tested on imx51evk and imx25pdk boards.

Signed-off-by: Fabio Estevam 
---
Kernel is capable of running the SD card at 50MHz clock, but U-Boot fails.

I haven't had a chance to debug this further, but sending it as RFC in case
someone has some suggestions.

 drivers/mmc/fsl_esdhc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index cc188c4..5ec51a2 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -850,8 +850,10 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,
cfg->host_caps &= ~MMC_MODE_4BIT;
}
 
+#if !defined(CONFIG_MX25) && !defined(CONFIG_MX51)
if (caps & ESDHC_HOSTCAPBLT_HSS)
cfg->host_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
+#endif
 
 #ifdef CONFIG_ESDHC_DETECT_8_BIT_QUIRK
if (CONFIG_ESDHC_DETECT_8_BIT_QUIRK)
-- 
2.7.4

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


[U-Boot] [PATCH] cmd: usb_mass_storage: add protection for block_dev

2017-10-18 Thread Patrick Delaunay
solve data abort for the command "ums 0 ubi 0"
because result of case blk_get_device_part_str() result is OK
but with block_dev = 0 when CONFIG_CMD_UBIFS is activate and
ubi volume is mounted

Signed-off-by: Patrick Delaunay 
---

 cmd/usb_mass_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
index cfeecb7..c0563ca 100644
--- a/cmd/usb_mass_storage.c
+++ b/cmd/usb_mass_storage.c
@@ -85,7 +85,7 @@ static int ums_init(const char *devtype, const char 
*devnums_part_str)
partnum = 0;
 
/* f_mass_storage.c assumes SECTOR_SIZE sectors */
-   if (block_dev->blksz != SECTOR_SIZE)
+   if (!block_dev || block_dev->blksz != SECTOR_SIZE)
goto cleanup;
 
ums_new = realloc(ums, (ums_count + 1) * sizeof(*ums));
-- 
2.7.4

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


Re: [U-Boot] [PATCH v2 00/26] mmc: Add support for HS200 and UHS modes

2017-10-18 Thread Marek Vasut
On 10/18/2017 03:19 PM, Jean-Jacques Hiblot wrote:
> 
> 
> On 14/10/2017 16:51, Marek Vasut wrote:
>> On 10/02/2017 11:15 AM, Jean-Jacques Hiblot wrote:
>>>
>>> On 22/09/2017 16:42, Jaehoon Chung wrote:
 Dear JJ,

 On 09/21/2017 11:29 PM, Jean-Jacques Hiblot wrote:
> This series brings support for HS200 and UHS modes to the mmc core.
> It has been tested with the hsmmc driver on several platforms (DRA7,
> AM57x, AM437x, beaglebone black, Atmel SAMA5D3 xplained). Some
> modifications
> are required in the host driver to take advantage of this (voltage
> switching,
> tuning). The changes to the host driver will be posted a another
> series as this
> one is already long enough.
>
> The series starts with a small refactoring of th sd/mmc startup. The
> first 5 commits
> are mostly moving code around with little or no functionnal change.
>
> Then the notion of "mode" is introduced. Until now, this information
> wasn't
> kept in struct mmc. Only the clock and a flag for ddr was kept. Later
> the mode
> information will be used to select the clock frequency, the ddr flag
> and the
> tuning procedure. It will be also be check against the host
> capabilities.
>
> Then comes the big refactoring job in:
> "mmc: refactor MMC startup to make it easier to support new modes" and
> "mmc: refactor SD startup to make it easier to support new modes"
> Since the number of modes is increasing, it makes sense to try them
> in a more
> organized way. those commits use a list of supported modes and
> iterate through
> them to find the best working one. It also allows to switch more
> easilly from
> one mode to another (switching from HS200 to DDR52 to access boot
> partitions for example)
>
> Then there are a couple of new callback added to:
> - send the initialization stream (74 clock cycles)
> - wait while the card is busy (used during UHS voltage switching).
> checking is
>     done on dat0.
> - select the IO voltage
>
> Then Power cycle is added. Without power cycle, if a UHS card fails
> to enumerate in
> UHS mode, it can't fall back to high speed mode and card enumeration
> will fail.
> Also in case of a reset (as opposed to a power on), it ensures that
> the SDCard
> is in clean state before re-doing the initialization.
>
> And finally the last commits add the support for HS200 and UHS.
>
> With this in place and the required changes in the HSMMC host driver
> (including
> DMA), we observe significant improvements in the performances on a
> DRA72 evm:
> eMMC HS200: 124 MB/s
> eMMC DDR52: 78 MB/s
> sd   SDR104: 71 MB/s
> sd   SDR50: 44 MB/s
 I have one question.

 Did you test about accessing Boot partition of eMMC?
 As i know, boot partition doesn't support the HS200 mode.

 When i checked your patches, there is no the function of mode changing
 for accessing boot partition.
 If i missed it, let me know, plz.
>>> Yes I did test the boot partitions. HS200 is not used in this case.
>>> The key function is mmc_boot_part_access_chk(). It checks if the current
>>> mode is supported by the partition. If not, it'll reselect a new mode.
>> Is anything new happening on the HS200 front ?
> I've been busy lately but I'll send the v3  in a few days that adresses
> all the comments done by Jaheoon and Simon.

Awesome, thanks !

If you have a tree with those patches applied somewhere, that'd be nice
as I'm working on adding HS200/SDR104 support into the uniphier-sd driver.

Also, any plan for HS400 ? :-)

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


Re: [U-Boot] [PATCH v2 00/26] mmc: Add support for HS200 and UHS modes

2017-10-18 Thread Jean-Jacques Hiblot



On 14/10/2017 16:51, Marek Vasut wrote:

On 10/02/2017 11:15 AM, Jean-Jacques Hiblot wrote:


On 22/09/2017 16:42, Jaehoon Chung wrote:

Dear JJ,

On 09/21/2017 11:29 PM, Jean-Jacques Hiblot wrote:

This series brings support for HS200 and UHS modes to the mmc core.
It has been tested with the hsmmc driver on several platforms (DRA7,
AM57x, AM437x, beaglebone black, Atmel SAMA5D3 xplained). Some
modifications
are required in the host driver to take advantage of this (voltage
switching,
tuning). The changes to the host driver will be posted a another
series as this
one is already long enough.

The series starts with a small refactoring of th sd/mmc startup. The
first 5 commits
are mostly moving code around with little or no functionnal change.

Then the notion of "mode" is introduced. Until now, this information
wasn't
kept in struct mmc. Only the clock and a flag for ddr was kept. Later
the mode
information will be used to select the clock frequency, the ddr flag
and the
tuning procedure. It will be also be check against the host
capabilities.

Then comes the big refactoring job in:
"mmc: refactor MMC startup to make it easier to support new modes" and
"mmc: refactor SD startup to make it easier to support new modes"
Since the number of modes is increasing, it makes sense to try them
in a more
organized way. those commits use a list of supported modes and
iterate through
them to find the best working one. It also allows to switch more
easilly from
one mode to another (switching from HS200 to DDR52 to access boot
partitions for example)

Then there are a couple of new callback added to:
- send the initialization stream (74 clock cycles)
- wait while the card is busy (used during UHS voltage switching).
checking is
    done on dat0.
- select the IO voltage

Then Power cycle is added. Without power cycle, if a UHS card fails
to enumerate in
UHS mode, it can't fall back to high speed mode and card enumeration
will fail.
Also in case of a reset (as opposed to a power on), it ensures that
the SDCard
is in clean state before re-doing the initialization.

And finally the last commits add the support for HS200 and UHS.

With this in place and the required changes in the HSMMC host driver
(including
DMA), we observe significant improvements in the performances on a
DRA72 evm:
eMMC HS200: 124 MB/s
eMMC DDR52: 78 MB/s
sd   SDR104: 71 MB/s
sd   SDR50: 44 MB/s

I have one question.

Did you test about accessing Boot partition of eMMC?
As i know, boot partition doesn't support the HS200 mode.

When i checked your patches, there is no the function of mode changing
for accessing boot partition.
If i missed it, let me know, plz.

Yes I did test the boot partitions. HS200 is not used in this case.
The key function is mmc_boot_part_access_chk(). It checks if the current
mode is supported by the partition. If not, it'll reselect a new mode.

Is anything new happening on the HS200 front ?
I've been busy lately but I'll send the v3  in a few days that adresses 
all the comments done by Jaheoon and Simon.


Jean-Jacques




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


[U-Boot] [PATCH v3 0/6] solve issues in gpt management

2017-10-18 Thread Patrick Delaunay

in the last version v2017.09, I see some regression for the command

$> gpt write mmc 0 "name=test,start=0x4400,size=0"
$> gpt write mmc 0 "name=test,size=0"

I use sandbox python test to verify if this issue is also present in
v2017.11-rc1 and when I check the log tests, I detect a other issue
for the swap / rename feature : the offset and the size is always 1MB
align, that cause issue if the partition wasn't initially 1MB align.
And it is the case of the test (the size of partition change after the
command gpt rename or swap)

I propose this patch-set with:
- updated gpt test to highlight the issues
- my proposed correction for the 2 issues

tests are ok on v2017.11-rc1


Changes in v3:
- update after Stephen Warren comments
- Add partition name in persistent data and test them
- split test_gpt.py update: commit to add the test write command
- tests are now OK for each commit
- Indicate LBA end error for rename command in test/py and commit message

Changes in v2:
- Split test to functional change

Patrick Delaunay (6):
  test/py: gpt: copy persistent file
  test/py: gpt: add test for sub-command read and verify
  disk: efi: correct the overlap check on GPT header and PTE
  test/py: gpt: add test for sub-command write
  test/py: gpt: test start LBA for sub-command rename and swap
  cmd: gpt: solve issue for swap and rename command

 cmd/gpt.c | 12 +++
 disk/part_efi.c   |  4 +--
 test/py/tests/test_gpt.py | 82 +++
 3 files changed, 77 insertions(+), 21 deletions(-)

-- 
2.7.4

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


[U-Boot] [PATCH v3 3/6] disk: efi: correct the overlap check on GPT header and PTE

2017-10-18 Thread Patrick Delaunay
the partition starting at 0x4400 is refused with overlap error:
  $> gpt write mmc 0 "name=test,start=0x4400,size=0"
  Writing GPT: Partition overlap
  error!

even if the 0x4400 is the first available offset for LBA35 with default
value:
- MBR=LBA1
- GPT header=LBA2
- PTE= 32 LBAs (128 entry), 3 to 34

And the command to have one partition for all the disk failed also :
  $> gpt write mmc 0 "name=test,size=0"

After the patch :

  $> gpt write mmc 0 "name=test,size=0"
  Writing GPT: success!
  $> part list mmc 0

  Partition Map for MMC device 0  --   Partition Type: EFI

  Part  Start LBA   End LBA Name
Attributes
Type GUID
Partition GUID
  1 0x0022  0x01ce9fde  "test"
attrs:  0x
type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
type:   data
guid:   b4b84b8a-04e3-4000-0036-aff5c9c495b1

And 0x22 = 34 LBA => offset = 0x4400 is accepted as expected

Reviewed-by: Łukasz Majewski 
Signed-off-by: Patrick Delaunay 
---
gpt test are now OK
./test/py/test.py -k gpt --build

test/py/tests/test_gpt.py ...
=> 7 passed, 228 deselected in 1.11 seconds

Changes in v3: None
Changes in v2: None

 disk/part_efi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 782f8be..7862bee 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -469,8 +469,8 @@ int gpt_fill_pte(struct blk_desc *dev_desc,
 * If our partition overlaps with either the GPT
 * header, or the partition entry, reject it.
 */
-   if (((start <= hdr_end && hdr_start <= (start + size)) ||
-(start <= pte_end && pte_start <= (start + size {
+   if (((start < hdr_end && hdr_start < (start + size)) ||
+(start < pte_end && pte_start < (start + size {
printf("Partition overlap\n");
return -1;
}
-- 
2.7.4

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


[U-Boot] [PATCH v3 4/6] test/py: gpt: add test for sub-command write

2017-10-18 Thread Patrick Delaunay
+ test write for one partition on all the device (size=0)
+ test write with disk uuid and 2 partitions

Signed-off-by: Patrick Delaunay 
---
This write test failed without the previous patch with the error:
"Writing GPT: Partition overlap"

gpt test are now OK on v2017.11-rc2:
./test/py/test.py -k gpt --build

test/py/tests/test_gpt.py ...

=> 7 passed, 229 deselected in 5.23 seconds


Changes in v3:
- split test_gpt.py update: commit to add the test write command
- tests are now OK for each commit

Changes in v2: None

 test/py/tests/test_gpt.py | 20 
 1 file changed, 20 insertions(+)

diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index 5cfbf1f..2eb07a1 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -147,3 +147,23 @@ def test_gpt_swap_partitions(state_disk_image, 
u_boot_console):
 output = u_boot_console.run_command('part list host 0')
 assert '0x07ff "second"' in output
 assert '0x17ff "first"' in output
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpt')
+@pytest.mark.buildconfigspec('cmd_part')
+@pytest.mark.requiredtool('sgdisk')
+def test_gpt_write(state_disk_image, u_boot_console):
+"""Test the gpt write command."""
+
+u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
+output = u_boot_console.run_command('gpt write host 0 "name=all,size=0"')
+assert 'Writing GPT: success!' in output
+output = u_boot_console.run_command('part list host 0')
+assert '0x0022 0x1fde  "all"' in output
+output = u_boot_console.run_command('gpt write host 0 
"uuid_disk=375a56f7-d6c9-4e81-b5f0-09d41ca89efe;name=first,start=0x10,size=0x40200;name=second,start=0x20,size=0x40200;"')
+assert 'Writing GPT: success!' in output
+output = u_boot_console.run_command('part list host 0')
+assert '0x0800 0x0a00  "first"' in output
+assert '0x1000 0x1200  "second"' in output
+output = u_boot_console.run_command('gpt guid host 0')
+assert '375a56f7-d6c9-4e81-b5f0-09d41ca89efe' in output
-- 
2.7.4

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


[U-Boot] [PATCH v3 6/6] cmd: gpt: solve issue for swap and rename command

2017-10-18 Thread Patrick Delaunay
don't use prettyprint_part_size() in create_gpt_partitions_list()
that avoid to align offset and size to 1 MiB and increase precision for
start and size.
This patch avoid the risk to change partition size and lost data during
rename or swap.

Signed-off-by: Patrick Delaunay 
---

Changes in v3: None
Changes in v2: None

 cmd/gpt.c | 12 ++--
 test/py/tests/test_gpt.py | 16 ++--
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/cmd/gpt.c b/cmd/gpt.c
index 27dd987..707d861 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -282,14 +282,14 @@ static int create_gpt_partitions_list(int numparts, const 
char *guid,
strcat(partitions_list, "name=");
strncat(partitions_list, (const char *)curr->gpt_part_info.name,
PART_NAME_LEN + 1);
-   strcat(partitions_list, ",start=");
-   prettyprint_part_size(partstr, (unsigned 
long)curr->gpt_part_info.start,
- (unsigned long) 
curr->gpt_part_info.blksz);
+   sprintf(partstr, ",start=0x%llx",
+   (unsigned long long)curr->gpt_part_info.start *
+   curr->gpt_part_info.blksz);
/* one extra byte for NULL */
strncat(partitions_list, partstr, PART_NAME_LEN + 1);
-   strcat(partitions_list, ",size=");
-   prettyprint_part_size(partstr, curr->gpt_part_info.size,
- curr->gpt_part_info.blksz);
+   sprintf(partstr, ",size=0x%llx",
+   (unsigned long long)curr->gpt_part_info.size *
+   curr->gpt_part_info.blksz);
strncat(partitions_list, partstr, PART_NAME_LEN + 1);
 
strcat(partitions_list, ",uuid=");
diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index b7adc10..b9b5e5f 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -132,12 +132,8 @@ def test_gpt_rename_partition(state_disk_image, 
u_boot_console):
 output = u_boot_console.run_command('gpt read host 0')
 assert 'name second' in output
 output = u_boot_console.run_command('part list host 0')
-assert '0x0800 0x07ff  "first"' in output
-assert '0x1000 0x17ff  "second"' in output
-# command error here because 'end LBA' (column 2) change after rename
-# (previous value can be found in test_gpt_read)
-# "first" 0xa00 => 0x7ff : it is an invalid value < start LBA !
-# "seconf" 0x1200 => 0x17ff : size is increasing !
+assert '0x0800 0x0a00  "first"' in output
+assert '0x1000 0x1200  "second"' in output
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
@@ -149,12 +145,12 @@ def test_gpt_swap_partitions(state_disk_image, 
u_boot_console):
 
 u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
 output = u_boot_console.run_command('part list host 0')
-assert '0x0800 0x07ff  "first"' in output
-assert '0x1000 0x17ff  "second"' in output
+assert '0x0800 0x0a00  "first"' in output
+assert '0x1000 0x1200  "second"' in output
 u_boot_console.run_command('gpt swap host 0 first second')
 output = u_boot_console.run_command('part list host 0')
-assert '0x0800 0x07ff  "second"' in output
-assert '0x1000 0x17ff  "first"' in output
+assert '0x0800 0x0a00  "second"' in output
+assert '0x1000 0x1200  "first"' in output
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
-- 
2.7.4

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


[U-Boot] [PATCH v3 2/6] test/py: gpt: add test for sub-command read and verify

2017-10-18 Thread Patrick Delaunay
add sandbox test for some gpt sub-command
- gpt read / part list : read the gpt partition created by sgdisk on host
  test start, size, LBA and name output
- gpt verify : verify the gpt partition create by sgdisk on host

PS: persistent data test_gpt_disk_image.bin are udpated

Signed-off-by: Patrick Delaunay 
---
warning: need to erase previously create file
./build-sandbox/persistent-data/test_gpt_disk_image.bin

gpt test are OK on v2017.11-rc2:
./test/py/test.py -k gpt --build

test/py/tests/test_gpt.py ..

=> 6 passed, 229 deselected in 5.12 seconds

Changes in v3:
- update after Stephen Warren comments
- Add partition name in persistent data and test them

Changes in v2: None

 test/py/tests/test_gpt.py | 31 +--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index e58bf61..5cfbf1f 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -43,9 +43,9 @@ class GptTestDiskImage(object):
 cmd = ('sgdisk', '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe',
 persistent)
 u_boot_utils.run_and_log(u_boot_console, cmd)
-cmd = ('sgdisk', '--new=1:2048:2560', persistent)
+cmd = ('sgdisk', '--new=1:2048:2560', '-c 1:part1', persistent)
 u_boot_utils.run_and_log(u_boot_console, cmd)
-cmd = ('sgdisk', '--new=2:4096:4608', persistent)
+cmd = ('sgdisk', '--new=2:4096:4608', '-c 2:part2', persistent)
 u_boot_utils.run_and_log(u_boot_console, cmd)
 cmd = ('sgdisk', '-l', persistent)
 u_boot_utils.run_and_log(u_boot_console, cmd)
@@ -68,6 +68,33 @@ def state_disk_image(u_boot_console):
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
+@pytest.mark.buildconfigspec('cmd_part')
+@pytest.mark.requiredtool('sgdisk')
+def test_gpt_read(state_disk_image, u_boot_console):
+"""Test the gpt read command."""
+
+u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
+output = u_boot_console.run_command('gpt read host 0')
+assert 'Start 1MiB, size 0MiB' in output
+assert 'Block size 512, name part1' in output
+assert 'Start 2MiB, size 0MiB' in output
+assert 'Block size 512, name part2' in output
+output = u_boot_console.run_command('part list host 0')
+assert '0x0800 0x0a00  "part1"' in output
+assert '0x1000 0x1200  "part2"' in output
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpt')
+@pytest.mark.requiredtool('sgdisk')
+def test_gpt_verify(state_disk_image, u_boot_console):
+"""Test the gpt verify command."""
+
+u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
+output = u_boot_console.run_command('gpt verify host 0')
+assert 'Verify GPT: success!' in output
+
+@pytest.mark.boardspec('sandbox')
+@pytest.mark.buildconfigspec('cmd_gpt')
 @pytest.mark.requiredtool('sgdisk')
 def test_gpt_guid(state_disk_image, u_boot_console):
 """Test the gpt guid command."""
-- 
2.7.4

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


[U-Boot] [PATCH v3 5/6] test/py: gpt: test start LBA for sub-command rename and swap

2017-10-18 Thread Patrick Delaunay
Add test of first and last LBA in gpt for rename and swap.
Only the name is expected to change, so test 3 columns
for part command
1: first LBA (start)
2: last LBA (end)
3: partition name

After rename, the last LBA change and it is a error in current U-Boot code
+ "first" = 0x7ff : invalid value ( size increasing !

Signed-off-by: Patrick Delaunay 
---

Before rename
0x0800  0x0a00  "part1"
0x1000  0x1200  "part2"

And after rename last LBA are invalid
0x0800  0x07ff "first"
0x1000  0x17ff  "second"

this issue will be corrected in next commit of the patchset

Changes in v3:
- Indicate LBA end error for rename command in test/py and commit message

Changes in v2: None

 test/py/tests/test_gpt.py | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index 2eb07a1..b7adc10 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -119,6 +119,7 @@ def test_gpt_save_guid(state_disk_image, u_boot_console):
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
 @pytest.mark.buildconfigspec('cmd_gpt_rename')
+@pytest.mark.buildconfigspec('cmd_part')
 @pytest.mark.requiredtool('sgdisk')
 def test_gpt_rename_partition(state_disk_image, u_boot_console):
 """Test the gpt rename command to write partition names."""
@@ -130,6 +131,13 @@ def test_gpt_rename_partition(state_disk_image, 
u_boot_console):
 u_boot_console.run_command('gpt rename host 0 2 second')
 output = u_boot_console.run_command('gpt read host 0')
 assert 'name second' in output
+output = u_boot_console.run_command('part list host 0')
+assert '0x0800 0x07ff  "first"' in output
+assert '0x1000 0x17ff  "second"' in output
+# command error here because 'end LBA' (column 2) change after rename
+# (previous value can be found in test_gpt_read)
+# "first" 0xa00 => 0x7ff : it is an invalid value < start LBA !
+# "seconf" 0x1200 => 0x17ff : size is increasing !
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
@@ -141,12 +149,12 @@ def test_gpt_swap_partitions(state_disk_image, 
u_boot_console):
 
 u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
 output = u_boot_console.run_command('part list host 0')
-assert '0x07ff "first"' in output
-assert '0x17ff "second"' in output
+assert '0x0800 0x07ff  "first"' in output
+assert '0x1000 0x17ff  "second"' in output
 u_boot_console.run_command('gpt swap host 0 first second')
 output = u_boot_console.run_command('part list host 0')
-assert '0x07ff "second"' in output
-assert '0x17ff "first"' in output
+assert '0x0800 0x07ff  "second"' in output
+assert '0x1000 0x17ff  "first"' in output
 
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('cmd_gpt')
-- 
2.7.4

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


[U-Boot] [PATCH v3 1/6] test/py: gpt: copy persistent file

2017-10-18 Thread Patrick Delaunay
copy the persistent gpt binary file as it can be modified during the test
that avoid issue if the test fail: the test always restart with clean file

Acked-by: Stephen Warren 
Signed-off-by: Patrick Delaunay 
---

Changes in v3: None
Changes in v2:
- Split test to functional change

 test/py/tests/test_gpt.py | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
index ec25fbb..e58bf61 100644
--- a/test/py/tests/test_gpt.py
+++ b/test/py/tests/test_gpt.py
@@ -28,26 +28,31 @@ class GptTestDiskImage(object):
 """
 
 filename = 'test_gpt_disk_image.bin'
-self.path = u_boot_console.config.persistent_data_dir + '/' + filename
 
-if os.path.exists(self.path):
-u_boot_console.log.action('Disk image file ' + self.path +
+persistent = u_boot_console.config.persistent_data_dir + '/' + filename
+self.path = u_boot_console.config.result_dir  + '/' + filename
+
+if os.path.exists(persistent):
+u_boot_console.log.action('Disk image file ' + persistent +
 ' already exists')
 else:
-u_boot_console.log.action('Generating ' + self.path)
-fd = os.open(self.path, os.O_RDWR | os.O_CREAT)
+u_boot_console.log.action('Generating ' + persistent)
+fd = os.open(persistent, os.O_RDWR | os.O_CREAT)
 os.ftruncate(fd, 4194304)
 os.close(fd)
 cmd = ('sgdisk', '-U', '375a56f7-d6c9-4e81-b5f0-09d41ca89efe',
-self.path)
+persistent)
 u_boot_utils.run_and_log(u_boot_console, cmd)
-cmd = ('sgdisk', '--new=1:2048:2560', self.path)
+cmd = ('sgdisk', '--new=1:2048:2560', persistent)
 u_boot_utils.run_and_log(u_boot_console, cmd)
-cmd = ('sgdisk', '--new=2:4096:4608', self.path)
+cmd = ('sgdisk', '--new=2:4096:4608', persistent)
 u_boot_utils.run_and_log(u_boot_console, cmd)
-cmd = ('sgdisk', '-l', self.path)
+cmd = ('sgdisk', '-l', persistent)
 u_boot_utils.run_and_log(u_boot_console, cmd)
 
+cmd = ('cp', persistent, self.path)
+u_boot_utils.run_and_log(u_boot_console, cmd)
+
 gtdi = None
 @pytest.fixture(scope='function')
 def state_disk_image(u_boot_console):
-- 
2.7.4

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


[U-Boot] [PATCH v3 2/2] ARM: dts: OMAP5+: Add support for bandgap sensor in SPL

2017-10-18 Thread Faiz Abbas
Mark bandgap node as uboot,dm-spl so that it can be accessed in spl

Signed-off-by: Faiz Abbas 
Reviewed-by: Simon Glass 
---
v3:
Added Reviewed-by comment.

 arch/arm/dts/omap5-u-boot.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/dts/omap5-u-boot.dtsi b/arch/arm/dts/omap5-u-boot.dtsi
index fdaa692..bf2684c 100644
--- a/arch/arm/dts/omap5-u-boot.dtsi
+++ b/arch/arm/dts/omap5-u-boot.dtsi
@@ -18,6 +18,10 @@
ocp2scp@4a09 {
compatible = "ti,omap-ocp2scp", "simple-bus";
};
+
+   bandgap@4a0021e0 {
+   u-boot,dm-spl;
+   };
};
 };
 
-- 
2.7.4

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


[U-Boot] [PATCH v3 1/2] thermal: ti-bandgap: Add support for temperature sensor

2017-10-18 Thread Faiz Abbas
The dra7xx series of SOCs contain a temperature sensor and an
associated analog-to-digital converter (ADC) which produces
an output which is proportional to the SOC temperature.
Add support for this temperature sensor.

Signed-off-by: Faiz Abbas 
Reviewed-by: Simon Glass 
---
v3:
Added Reviewed-by comment

v2:
 1. Removed extra elements from ti_bandgap
 2. Changed base address to ulong
 3. Changed to udev to dev to maintain consistency
 4. minor format changes

 common/spl/Kconfig |   8 +
 configs/dra7xx_evm_defconfig   |   3 +
 .../thermal/ti_soc_thermal.txt |  35 
 drivers/Makefile   |   2 +-
 drivers/thermal/Kconfig|   6 +
 drivers/thermal/Makefile   |   1 +
 drivers/thermal/ti-bandgap.c   | 197 +
 7 files changed, 251 insertions(+), 1 deletion(-)
 create mode 100644 doc/device-tree-bindings/thermal/ti_soc_thermal.txt
 create mode 100644 drivers/thermal/ti-bandgap.c

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 0bd8370..0bf3ee3 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -604,6 +604,14 @@ config SPL_SPI_SUPPORT
  enable SPI drivers that are needed for other purposes also, such
  as a SPI PMIC.
 
+config SPL_THERMAL
+   bool "Driver support for thermal devices"
+   help
+ Enable support for temperature-sensing devices. Some SoCs have on-chip
+ temperature sensors to permit warnings, speed throttling or even
+ automatic power-off when the temperature gets too high or low. Other
+ devices may be discrete but connected on a suitable bus.
+
 config SPL_USB_HOST_SUPPORT
bool "Support USB host drivers"
help
diff --git a/configs/dra7xx_evm_defconfig b/configs/dra7xx_evm_defconfig
index 468c288..447fb89 100644
--- a/configs/dra7xx_evm_defconfig
+++ b/configs/dra7xx_evm_defconfig
@@ -90,3 +90,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Texas Instruments"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0451
 CONFIG_USB_GADGET_PRODUCT_NUM=0xd022
+CONFIG_SPL_THERMAL=y
+CONFIG_DM_THERMAL=y
+CONFIG_TI_DRA7_THERMAL=y
diff --git a/doc/device-tree-bindings/thermal/ti_soc_thermal.txt 
b/doc/device-tree-bindings/thermal/ti_soc_thermal.txt
new file mode 100644
index 000..b4e88c2
--- /dev/null
+++ b/doc/device-tree-bindings/thermal/ti_soc_thermal.txt
@@ -0,0 +1,35 @@
+* Texas Instrument dra7xx SCM bandgap bindings
+
+In the System Control Module, SoC supplies a voltage reference
+and a temperature sensor feature that are gathered in the band
+gap voltage and temperature sensor (VBGAPTS) module. The band
+gap provides current and voltage reference for its internal
+circuits and other analog IP blocks. The analog-to-digital
+converter (ADC) produces an output value that is proportional
+to the silicon temperature.
+
+Required properties:
+- compatible : Should be:
+  - "ti,dra752-bandgap"
+- interrupts : this entry should indicate which interrupt line
+the talert signal is routed to;
+- regs : this is specific to each bandgap version, because
+the mapping may change from soc to soc, apart from depending
+on available features.
+
+Optional:
+- gpios : this entry should be used to inform which GPIO
+line the tshut signal is routed to. The informed GPIO will
+be treated as an IRQ;
+
+Example:
+bandgap {
+   reg = <0x4a0021e0 0xc
+   0x4a00232c 0xc
+   0x4a002380 0x2c
+   0x4a0023C0 0x3c
+   0x4a002564 0x8
+   0x4a002574 0x50>;
+   compatible = "ti,dra752-bandgap";
+   interrupts = <0 126 4>; /* talert */
+};
diff --git a/drivers/Makefile b/drivers/Makefile
index dab5c18..35510ca 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -50,7 +50,7 @@ obj-$(CONFIG_SPL_SATA_SUPPORT) += ata/ scsi/
 obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/
 obj-$(CONFIG_SPL_MMC_SUPPORT) += block/
 obj-$(CONFIG_SPL_FPGA_SUPPORT) += fpga/
-
+obj-$(CONFIG_SPL_THERMAL) += thermal/
 endif
 endif
 
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 886f5fa..a71b9be 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -17,4 +17,10 @@ config IMX_THERMAL
   cpufreq is used as the cooling device to throttle CPUs when the
   passive trip is crossed.
 
+config TI_DRA7_THERMAL
+bool "Temperature sensor driver for TI dra7xx SOCs"
+help
+Enable thermal support for for the Texas Instruments DRA752 SoC family.
+The driver supports reading CPU temperature.
+
 endif # if DM_THERMAL
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index d768f5e..f6271a5 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -7,3 +7,4 @@
 
 obj-$(CONFIG_DM_THERMAL) += thermal-uclass.o
 obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
+obj-$(CONFIG_TI_DRA7_THERMAL) += 

[U-Boot] [PATCH v3 0/2] Support for TI bandgap temperature sensor

2017-10-18 Thread Faiz Abbas
Adding support for TI bandgap temperature sensor.
Also add dt support for bandgap sensor in spl.

v3:
Missed adding Reviewed-by in v2.

Faiz Abbas (2):
  thermal: ti-bandgap: Add support for temperature sensor
  ARM: dts: OMAP5+: Add support for bandgap sensor in SPL

 arch/arm/dts/omap5-u-boot.dtsi |   4 +
 common/spl/Kconfig |   8 +
 configs/dra7xx_evm_defconfig   |   3 +
 .../thermal/ti_soc_thermal.txt |  35 
 drivers/Makefile   |   2 +-
 drivers/thermal/Kconfig|   6 +
 drivers/thermal/Makefile   |   1 +
 drivers/thermal/ti-bandgap.c   | 197 +
 8 files changed, 255 insertions(+), 1 deletion(-)
 create mode 100644 doc/device-tree-bindings/thermal/ti_soc_thermal.txt
 create mode 100644 drivers/thermal/ti-bandgap.c

-- 
2.7.4

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


Re: [U-Boot] Fwd: u-boot.img size limit for spl fat load ?

2017-10-18 Thread laksonobudi
where you edit it? i have same problem too



--
Sent from: http://u-boot.10912.n7.nabble.com/
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v5] cmd: usb: add blk, emulation devices to ignore list as needed

2017-10-18 Thread Marek Vasut
On 10/18/2017 03:30 AM, Suneel Garapati wrote:
> On Tue, Oct 17, 2017 at 6:22 PM, Marek Vasut  wrote:
>> On 10/18/2017 01:50 AM, Suneel Garapati wrote:
>>> On Tue, Oct 17, 2017 at 5:43 AM, Marek Vasut  wrote:
 On 10/17/2017 05:21 AM, Bin Meng wrote:
> +Marek, Tom,

 Well, if the author CCed me in the first place, that'd be useful.

> On Tue, Oct 17, 2017 at 11:14 AM, Suneel Garapati
>  wrote:
>> Hi Bin/Simon,
>>
>> Request to know if this will be applied for v2017.11
>>
>
> Not sure which of you should pick this up for v2017.11.

 The commit message makes no sense, can you explain to me what this patch
 tries to achieve ?
>>> usb tree/info commands for DM_USB should ignore blk child under mass
>>> storage and usb_emul devices
>>> otherwise u-boot crashes.
>>
>> And it crashes because ... why ? I am sure you analyzed the problem and
>> that analysis/explanation should be in the commit message too.
> 
> It crashes because the next call of tree graph on blk device will try
> to fetch config interface class descriptors
> assuming it as usb_device structure.

Assume I know nothing about the subsystem, expand on this a bit and then
it's gonna be good. This is the kind of description that should be in
the commit message, to make it obvious what the problem is and how it
got fixed, without having to think too much about what the author meant.

> I will add the above to commit message and send v6.
> 
> Regards,
> Suneel
>>
>> --
>> Best regards,
>> Marek Vasut


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


[U-Boot] [PATCH v2] power: extend prefix match to regulator-name property

2017-10-18 Thread Felix Brack
This patch extends pmic_bind_children prefix matching. In addition to
the node name the property regulator-name is used while trying to match
prefixes. This allows assigning different drivers to regulator nodes
named regulator@1 and regulator@10 for example.
I have discarded the idea of using other properties then regulator-name
as I do not see any benefit in using property compatible or even
regulator-compatible. Of course I am open to change this if there are
good reasons to do so.

Signed-off-by: Felix Brack 
---

Changes in v2:
- add documentation
- add a regulator to the sandbox for testing
- extend the test for the new sandbox regulator

 arch/sandbox/dts/sandbox_pmic.dtsi   |  6 ++
 doc/device-tree-bindings/regulator/regulator.txt | 16 ++--
 drivers/power/pmic/pmic-uclass.c | 15 +--
 include/power/sandbox_pmic.h |  5 -
 test/dm/regulator.c  |  2 ++
 5 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/arch/sandbox/dts/sandbox_pmic.dtsi 
b/arch/sandbox/dts/sandbox_pmic.dtsi
index ce261b9..acb4799 100644
--- a/arch/sandbox/dts/sandbox_pmic.dtsi
+++ b/arch/sandbox/dts/sandbox_pmic.dtsi
@@ -75,4 +75,10 @@
regulator-min-microvolt = <330>;
regulator-max-microvolt = <330>;
};
+
+   no_match_by_nodename {
+   regulator-name = "buck_SUPPLY_1.5V";
+   regulator-min-microvolt = <150>;
+   regulator-max-microvolt = <150>;
+   };
 };
diff --git a/doc/device-tree-bindings/regulator/regulator.txt 
b/doc/device-tree-bindings/regulator/regulator.txt
index 918711e..65b69c4 100644
--- a/doc/device-tree-bindings/regulator/regulator.txt
+++ b/doc/device-tree-bindings/regulator/regulator.txt
@@ -2,7 +2,8 @@ Voltage/Current regulator
 
 Binding:
 The regulator devices don't use the "compatible" property. The binding is done
-by the prefix of regulator node's name. Usually the pmic I/O driver will 
provide
+by the prefix of regulator node's name, or, if this fails, by the prefix of the
+regulator's "regulator-name" property. Usually the pmic I/O driver will provide
 the array of 'struct pmic_child_info' with the prefixes and compatible drivers.
 The bind is done by calling function: pmic_bind_childs().
 Example drivers:
@@ -15,8 +16,19 @@ For the node name e.g.: "prefix[:alpha:]num { ... }":
 
 Example the prefix "ldo" will pass for: "ldo1", "ldo@1", "ldoreg@1, ...
 
+Binding by means of the node's name is preferred. However if the node names
+would produce ambiguous prefixes (like "regulator@1" and "regualtor@11") and 
you
+can't or do not want to change them then binding against the "regulator-name"
+property is possible. The syntax for the prefix of the "regulator-name" 
property
+is the same as the one for the regulator's node name.
+Use case: a regulator named "regulator@1" to be bound to a driver named
+"LDO_DRV" and a regulator named "regualator@11" to be bound to an other driver
+named "BOOST_DRV". Using prefix "regualtor@1" for driver matching would load
+the same driver for both regulators, hence the prefix is ambiguous.
+
 Optional properties:
-- regulator-name: a string, required by the regulator uclass
+- regulator-name: a string, required by the regulator uclass, used for driver
+  binding if binding by node's name prefix fails
 - regulator-min-microvolt: a minimum allowed Voltage value
 - regulator-max-microvolt: a maximum allowed Voltage value
 - regulator-min-microamp: a minimum allowed Current value
diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
index 64964e4..5a034f0 100644
--- a/drivers/power/pmic/pmic-uclass.c
+++ b/drivers/power/pmic/pmic-uclass.c
@@ -26,6 +26,7 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
struct driver *drv;
struct udevice *child;
const char *node_name;
+   const char *reg_name;
int bind_count = 0;
ofnode node;
int prefix_len;
@@ -44,8 +45,18 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
debug("  - compatible prefix: '%s'\n", info->prefix);
 
prefix_len = strlen(info->prefix);
-   if (strncmp(info->prefix, node_name, prefix_len))
-   continue;
+   if (strncmp(info->prefix, node_name, prefix_len)) {
+   reg_name = ofnode_read_string(node,
+ "regulator-name");
+   if (reg_name) {
+   if (strncmp(info->prefix, reg_name,
+   prefix_len)) {
+   continue;
+   }
+   } else {
+

Re: [U-Boot] [U-Boot, 4/6] net: gmac_rockchip: Define the gmac grf register struct at gmac_rockchip.c

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

Content preview:  Hi Philipp, 在 2017/10/6 18:06, Philipp Tomsich 写道: >
   > > On Thu, 21 Sep 2017, David Wu wrote: > >> If we include both the 
rk3288_grf.h
   and rv1108_grf.h, there is a >> number of compiling error for redefinition.
   So we define the reg >> structs of mac_grf at gmac_rockchip.c. Remove the
   rk**_grf.h files, >> give them own grf offset for their use. > > The reg
  offset should not be open-coded in gmac_rockchip.c. > > The issue of 
GRF-header
   having conflicting definitions was already > discussed on the list, when
  I initially submitted the RK3368 support. > The decision back then was as
  follows: > 1/ The GRF files should not contain definitions that are private
   to > Â Â the IOMUX (e.g. these should go into the pinctrl-driver), etc. [...]
   

Content analysis details:   (5.1 points, 5.0 required)

 pts rule name  description
 -- --
 2.7 RCVD_IN_PSBL   RBL: Received via a relay in PSBL
[211.157.147.133 listed in psbl.surriel.com]
 2.4 RCVD_IN_MSPIKE_L5  RBL: Very bad reputation (-5)
[211.157.147.133 listed in bl.mailspike.net]
 0.0 RCVD_IN_MSPIKE_BL  Mailspike blacklisted


--- Begin Message ---

Hi Philipp,

在 2017/10/6 18:06, Philipp Tomsich 写道:



On Thu, 21 Sep 2017, David Wu wrote:


If we include both the rk3288_grf.h and rv1108_grf.h, there is a
number of compiling error for redefinition. So we define the reg
structs of mac_grf at gmac_rockchip.c. Remove the rk**_grf.h files,
give them own grf offset for their use.


The reg offset should not be open-coded in gmac_rockchip.c.

The issue of GRF-header having conflicting definitions was already
discussed on the list, when I initially submitted the RK3368 support.
The decision back then was as follows:
1/ The GRF files should not contain definitions that are private to
    the IOMUX (e.g. these should go into the pinctrl-driver), etc.


Here are some problems, we call Pinctrl-driver interface to set iomux 
like uart console in some Soc board_init_f or board_init, but the DM 
peripheral driver is not ready for us to use, so if the iomux 
definitions are moved to the pinctrl drive, and using the pinctrl 
interface has limitations.



2/ As an intermediate step, we move some of this (i.e. the GMAC_CLK_SEL
    definitions into gmac_rockchip.c.
3/ The long-term solution will be to either create misc-devices that
    handle the 'set-to-rgmii' functionality and the 'GMAC_CLK_SEL'
    bits (although on those, modelling it via the clk-framework might
    be more appropriate).

Please clean up the affected GRF files that cause the conflicts (e.g.
the RV1108) and extend the current implementation w/o open-coding a
grf-offet.

Additional requested changes below.



Signed-off-by: David Wu 
Acked-by: Philipp Tomsich 
---

drivers/net/gmac_rockchip.c | 144 
+++-

1 file changed, 116 insertions(+), 28 deletions(-)

diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c
index 586ccbf..5f8f0cd 100644
--- a/drivers/net/gmac_rockchip.c
+++ b/drivers/net/gmac_rockchip.c
@@ -15,9 +15,6 @@
#include 
#include 
#include 
-#include 
-#include 
-#include 
#include 
#include 
#include "designware.h"
@@ -31,15 +28,37 @@ DECLARE_GLOBAL_DATA_PTR;
 */
struct gmac_rockchip_platdata {
struct dw_eth_pdata dw_eth_pdata;
+    void *grf;
int tx_delay;
int rx_delay;
};

struct rk_gmac_ops {
-    int (*fix_mac_speed)(struct dw_eth_dev *priv);
+    int (*fix_mac_speed)(struct gmac_rockchip_platdata *pdata,
+ struct dw_eth_dev *priv);
void (*set_to_rgmii)(struct gmac_rockchip_platdata *pdata);
};

+struct gmac_rockchip_driver_data {
+    const struct rk_gmac_ops *ops;
+    unsigned int grf_offset;
+};
+
+struct rk3288_mac_grf {
+    u32 soc_con1;
+    u32 reserved;
+    u32 soc_con3;
+};
+
+struct rk3368_mac_grf {
+    u32 soc_con15;
+    u32 soc_con16;
+};
+
+struct rk3399_mac_grf {
+    u32 soc_con5;
+    u32 soc_con6;
+};


We really can't pollute the GMAC driver with these definitions.
The actual values need to come out of the central GRF structure definition.



static int gmac_rockchip_ofdata_to_platdata(struct udevice *dev)
{
@@ -58,10 +77,18 @@ static int gmac_rockchip_ofdata_to_platdata(struct 
udevice *dev)

return designware_eth_ofdata_to_platdata(dev);
}

-static int rk3288_gmac_fix_mac_speed(struct dw_eth_dev *priv)
+static int rk3288_gmac_fix_mac_speed(struct gmac_rockchip_platdata 
*pdata,

+ struct dw_eth_dev *priv)
{
-    struct 

[U-Boot] [PATCH u-boot 3/3] arm: amlogic: p212: Add support for Ethernet with Internal PHY

2017-10-18 Thread Neil Armstrong
This patch adds support for the Internal RMII Ethernet PHY on the
Amlogic P212 Reference Board.

Signed-off-by: Neil Armstrong 
---
 board/amlogic/p212/p212.c | 39 ++-
 configs/p212_defconfig|  4 
 include/configs/p212.h|  2 ++
 3 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/board/amlogic/p212/p212.c b/board/amlogic/p212/p212.c
index 1eeb7f2..ece8096 100644
--- a/board/amlogic/p212/p212.c
+++ b/board/amlogic/p212/p212.c
@@ -9,6 +9,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+
+#define EFUSE_SN_OFFSET20
+#define EFUSE_SN_SIZE  16
+#define EFUSE_MAC_OFFSET   52
+#define EFUSE_MAC_SIZE 6
 
 int board_init(void)
 {
@@ -17,5 +24,35 @@ int board_init(void)
 
 int misc_init_r(void)
 {
-   return 0;
+   u8 mac_addr[EFUSE_MAC_SIZE];
+   char serial[EFUSE_SN_SIZE];
+   ssize_t len;
+
+   /* Set RMII mode */
+   out_le32(GXBB_ETH_REG_0, GXBB_ETH_REG_0_INVERT_RMII_CLK |
+GXBB_ETH_REG_0_CLK_EN);
+
+   /* Use Internal PHY */
+   out_le32(GXBB_ETH_REG_2, 0x10110181);
+   out_le32(GXBB_ETH_REG_3, 0xe40908ff);
+
+   /* Enable power and clock gate */
+   setbits_le32(GXBB_GCLK_MPEG_1, GXBB_GCLK_MPEG_1_ETH);
+   clrbits_le32(GXBB_MEM_PD_REG_0, GXBB_MEM_PD_REG_0_ETH_MASK);
+
+   if (!eth_env_get_enetaddr("ethaddr", mac_addr)) {
+   len = meson_sm_read_efuse(EFUSE_MAC_OFFSET,
+ mac_addr, EFUSE_MAC_SIZE);
+   if (len == EFUSE_MAC_SIZE && is_valid_ethaddr(mac_addr))
+   eth_env_set_enetaddr("ethaddr", mac_addr);
+   }
+
+   if (!env_get("serial#")) {
+   len = meson_sm_read_efuse(EFUSE_SN_OFFSET, serial,
+   EFUSE_SN_SIZE);
+   if (len == EFUSE_SN_SIZE)
+   env_set("serial#", serial);
+   }
+
+   return 0;
 }
diff --git a/configs/p212_defconfig b/configs/p212_defconfig
index 3c57621..d4b5349 100644
--- a/configs/p212_defconfig
+++ b/configs/p212_defconfig
@@ -20,6 +20,10 @@ CONFIG_OF_CONTROL=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
+CONFIG_DM_ETH=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_PHY_MESON_GXL=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_MESON_GXL=y
 CONFIG_DEBUG_UART_MESON=y
diff --git a/include/configs/p212.h b/include/configs/p212.h
index 0477384..793b556 100644
--- a/include/configs/p212.h
+++ b/include/configs/p212.h
@@ -12,6 +12,8 @@
 
 #define CONFIG_MISC_INIT_R
 
+#define CONFIG_PHY_ADDR8
+
 /* Serial setup */
 #define CONFIG_CONS_INDEX  0
 
-- 
2.7.4

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


[U-Boot] [PATCH u-boot 2/3] arm: meson: Add supplementary ethernet registers definitions

2017-10-18 Thread Neil Armstrong
On Amlogic Meson GXL/GXM, supplementary ethernet configuration registers
were added to configure the internal RMII PHY interface.

Signed-off-by: Neil Armstrong 
---
 arch/arm/include/asm/arch-meson/gxbb.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/include/asm/arch-meson/gxbb.h 
b/arch/arm/include/asm/arch-meson/gxbb.h
index ce41349..74d5290 100644
--- a/arch/arm/include/asm/arch-meson/gxbb.h
+++ b/arch/arm/include/asm/arch-meson/gxbb.h
@@ -22,11 +22,14 @@
 
 #define GXBB_ETH_REG_0 GXBB_PERIPHS_ADDR(0x50)
 #define GXBB_ETH_REG_1 GXBB_PERIPHS_ADDR(0x51)
+#define GXBB_ETH_REG_2 GXBB_PERIPHS_ADDR(0x56)
+#define GXBB_ETH_REG_3 GXBB_PERIPHS_ADDR(0x57)
 
 #define GXBB_ETH_REG_0_PHY_INTFBIT(0)
 #define GXBB_ETH_REG_0_TX_PHASE(x) (((x) & 3) << 5)
 #define GXBB_ETH_REG_0_TX_RATIO(x) (((x) & 7) << 7)
 #define GXBB_ETH_REG_0_PHY_CLK_EN  BIT(10)
+#define GXBB_ETH_REG_0_INVERT_RMII_CLK BIT(11)
 #define GXBB_ETH_REG_0_CLK_EN  BIT(12)
 
 /* HIU registers */
-- 
2.7.4

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


[U-Boot] [PATCH u-boot 1/3] net: phy: Add Amlogic Meson GXL Internal PHY support

2017-10-18 Thread Neil Armstrong
The Amlogic Meson GXL/GXM families embeds an internal RMII Ethernet PHY.

The PHY acts as a generic PHY but needs a slight configuration right
before it's configuration.

Signed-off-by: Neil Armstrong 
---
 drivers/net/phy/Kconfig |  3 +++
 drivers/net/phy/Makefile|  1 +
 drivers/net/phy/meson-gxl.c | 57 +
 drivers/net/phy/phy.c   |  3 +++
 include/phy.h   |  1 +
 5 files changed, 65 insertions(+)
 create mode 100644 drivers/net/phy/meson-gxl.c

diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 4d02d8b..e32f1eb 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -55,6 +55,9 @@ config PHY_LXT
 config PHY_MARVELL
bool "Marvell Ethernet PHYs support"
 
+config PHY_MESON_GXL
+   bool "Amlogic Meson GXL Internal PHY support"
+
 config PHY_MICREL
bool "Micrel Ethernet PHYs support"
help
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
index 54f32f6..1e264b2 100644
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_PHY_LXT) += lxt.o
 obj-$(CONFIG_PHY_MARVELL) += marvell.o
 obj-$(CONFIG_PHY_MICREL_KSZ8XXX) += micrel_ksz8xxx.o
 obj-$(CONFIG_PHY_MICREL_KSZ90X1) += micrel_ksz90x1.o
+obj-$(CONFIG_PHY_MESON_GXL) += meson-gxl.o
 obj-$(CONFIG_PHY_NATSEMI) += natsemi.o
 obj-$(CONFIG_PHY_REALTEK) += realtek.o
 obj-$(CONFIG_PHY_SMSC) += smsc.o
diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c
new file mode 100644
index 000..ccf70c9
--- /dev/null
+++ b/drivers/net/phy/meson-gxl.c
@@ -0,0 +1,57 @@
+/*
+ * Meson GXL Internal PHY Driver
+ *
+ * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
+ * Copyright (C) 2016 BayLibre, SAS. All rights reserved.
+ * Author: Neil Armstrong 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+#include 
+#include 
+#include 
+#include 
+
+static int meson_gxl_phy_config(struct phy_device *phydev)
+{
+   /* Enable Analog and DSP register Bank access by */
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x);
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x0400);
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x);
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x0400);
+
+   /* Write Analog register 23 */
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x17, 0x8E0D);
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x4417);
+
+   /* Enable fractional PLL */
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x17, 0x0005);
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x5C1B);
+
+   /* Program fraction FR_PLL_DIV1 */
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x17, 0x029A);
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x5C1D);
+
+   /* Program fraction FR_PLL_DIV1 */
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x17, 0x);
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x5C1C);
+
+   return genphy_config(phydev);
+}
+
+static struct phy_driver meson_gxl_phy_driver = {
+   .name = "Meson GXL Internal PHY",
+   .uid = 0x01814400,
+   .mask = 0xfff0,
+   .features = PHY_BASIC_FEATURES,
+   .config = _gxl_phy_config,
+   .startup = _startup,
+   .shutdown = _shutdown,
+};
+
+int phy_meson_gxl_init(void)
+{
+   phy_register(_gxl_phy_driver);
+
+   return 0;
+}
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 5be51d7..fd3dd55 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -494,6 +494,9 @@ int phy_init(void)
 #ifdef CONFIG_PHY_MICREL_KSZ90X1
phy_micrel_ksz90x1_init();
 #endif
+#ifdef CONFIG_PHY_MESON_GXL
+   phy_meson_gxl_init();
+#endif
 #ifdef CONFIG_PHY_NATSEMI
phy_natsemi_init();
 #endif
diff --git a/include/phy.h b/include/phy.h
index a0b1f12..50f1e12 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -268,6 +268,7 @@ int phy_lxt_init(void);
 int phy_marvell_init(void);
 int phy_micrel_ksz8xxx_init(void);
 int phy_micrel_ksz90x1_init(void);
+int phy_meson_gxl_init(void);
 int phy_natsemi_init(void);
 int phy_realtek_init(void);
 int phy_smsc_init(void);
-- 
2.7.4

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


[U-Boot] [PATCH u-boot 0/3] Add Ethernet support for Amlogic P212 Reference board

2017-10-18 Thread Neil Armstrong
This patchset aims to add support for the Internal RMII Ethernet PHY of the
Amlogic Meson GXL S905X SoC on the Amlogic P212 Reference board.

The Internal PHY needs a specific config then acts as a generic PHY.

Neil Armstrong (3):
  net: phy: Add Amlogic Meson GXL Internal PHY support
  arm: meson: Add supplementary ethernet registers definitions
  arm: amlogic: p212: Add support for Ethernet with Internal PHY

 arch/arm/include/asm/arch-meson/gxbb.h |  3 ++
 board/amlogic/p212/p212.c  | 39 ++-
 configs/p212_defconfig |  4 +++
 drivers/net/phy/Kconfig|  3 ++
 drivers/net/phy/Makefile   |  1 +
 drivers/net/phy/meson-gxl.c| 57 ++
 drivers/net/phy/phy.c  |  3 ++
 include/configs/p212.h |  2 ++
 include/phy.h  |  1 +
 9 files changed, 112 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/phy/meson-gxl.c

-- 
2.7.4

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


Re: [U-Boot] [PATCH v2 6/9] efi_selftest: allow to select a single test for exexution

2017-10-18 Thread Alexander Graf


On 17.10.17 22:11, Heinrich Schuchardt wrote:
> On 10/17/2017 09:48 AM, Alexander Graf wrote:
>>
>>
>> On 13.10.17 19:33, Heinrich Schuchardt wrote:
>>> Environment variable efi_selftest is passed as load options
>>> to the selftest application. It is used to select a single
>>> test to be executed.
>>>
>>> Special value 'list' displays a list of all available tests.
>>>
>>> Tests get an on_request property. If this property is set
>>> the tests are only executed if explicitly requested.
>>>
>>> The invocation of efi_selftest is changed to reflect that
>>> bootefi selftest with efi_selftest = 'list' will call the
>>> Exit bootservice.
>>>
>>> Environment variable bootargs is used as load options
>>> for all other bootefi payloads.
>>>
>>> Signed-off-by: Heinrich Schuchardt 
>>> ---
>>> v2
>>> use an environment variable to choose a test
>>> ---
>>>  cmd/bootefi.c   | 46 -
>>>  include/efi_selftest.h  | 18 +++
>>>  lib/efi_selftest/efi_selftest.c | 90 
>>> +++--
>>>  lib/efi_selftest/efi_selftest_console.c | 10 
>>>  lib/efi_selftest/efi_selftest_util.c| 11 +++-
>>>  5 files changed, 168 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
>>> index 18176a1266..2d70137482 100644
>>> --- a/cmd/bootefi.c
>>> +++ b/cmd/bootefi.c
>>> @@ -6,10 +6,12 @@
>>>   *  SPDX-License-Identifier: GPL-2.0+
>>>   */
>>>  
>>> +#include 
>>>  #include 
>>>  #include 
>>>  #include 
>>>  #include 
>>> +#include 
>>>  #include 
>>>  #include 
>>>  #include 
>>> @@ -50,6 +52,32 @@ static void efi_init_obj_list(void)
>>> efi_get_time_init();
>>>  }
>>>  
>>> +/*
>>> + * Set the load options of an image from an environment variable.
>>> + *
>>> + * @loaded_image_info: the image
>>> + * @env_var:   name of the environment variable
>>> + */
>>> +static void set_load_options(struct efi_loaded_image *loaded_image_info,
>>> +const char *env_var)
>>> +{
>>> +   size_t size;
>>> +   const char *env = env_get(env_var);
>>> +
>>> +   loaded_image_info->load_options = NULL;
>>> +   loaded_image_info->load_options_size = 0;
>>> +   if (!env)
>>> +   return;
>>> +   size = strlen(env) + 1;
>>> +   loaded_image_info->load_options = calloc(size, sizeof(u16));
>>> +   if (!loaded_image_info->load_options) {
>>> +   printf("ERROR: Out of memory\n");
>>> +   return;
>>> +   }
>>> +   utf8_to_utf16(loaded_image_info->load_options, (u8 *)env, size);
>>> +   loaded_image_info->load_options_size = size * 2;
>>> +}
>>> +
>>>  static void *copy_fdt(void *fdt)
>>>  {
>>> u64 fdt_size = fdt_totalsize(fdt);
>>> @@ -190,6 +218,8 @@ static unsigned long do_bootefi_exec(void *efi, void 
>>> *fdt,
>>> efi_install_configuration_table(_guid, NULL);
>>> }
>>>  
>>> +   /* Transfer environment variable bootargs as load options */
>>> +   set_load_options(_image_info, "bootargs");
>>
>> While I really want to see that change, please try not to sneak it in
>> with the selftest one :).
>>
>> Just split that hunk out to a following patch and give it its own patch
>> description. In case something goes wrong, we'd only need to revert a
>> small patch then.
>>
>>> /* Load the EFI payload */
>>> entry = efi_load_pe(efi, _image_info);
>>> if (!entry) {
>>> @@ -237,6 +267,7 @@ static unsigned long do_bootefi_exec(void *efi, void 
>>> *fdt,
>>>  
>>>  exit:
>>> /* image has returned, loaded-image obj goes *poof*: */
>>> +   free(loaded_image_info.load_options);
>>
>> This too is a change that doesn't fit the patch description?
>>
>>> list_del(_image_info_obj.link);
>>>  
>>> return ret;
>>> @@ -301,17 +332,26 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
>>> argc, char * const argv[])
>>>  
>>> efi_setup_loaded_image(_image_info,
>>>_image_info_obj,
>>> -  bootefi_device_path, bootefi_image_path);
>>> +  NULL, NULL);
>>
>> Why?
>>
>>> /*
>>>  * gd lives in a fixed register which may get clobbered while we
>>>  * execute the payload. So save it here and restore it on every
>>>  * callback entry
>>>  */
>>> efi_save_gd();
>>> +   loaded_image_info.image_code_type = EFI_LOADER_CODE;
>>> +   loaded_image_info.image_data_type = EFI_LOADER_DATA;
>>
>> Also unrelated? Please split it out.
>>
>>> /* Initialize and populate EFI object list */
>>> if (!efi_obj_list_initalized)
>>> efi_init_obj_list();
>>> -   return efi_selftest(_image_info, );
>>> +   /* Transfer environment variable efi_selftest as load options */
>>> +   set_load_options(_image_info, "efi_selftest");
>>> +   /* Execute the test */
>>> +   r =