Re: [U-Boot] [BUG] simple-bus and rsa-sw with DM_FLAG_PRE_RELOC

2019-05-14 Thread Bin Meng
On Wed, May 15, 2019 at 1:55 PM AKASHI Takahiro
 wrote:
>
> As of v2019.07-rc1,
> u-boot does fail to boot without any messages on qemu-arm64 when
> configured with qemu_arm64_defconfig plus CONFIG_RSA/RSA_SOFTWARE_EXP.
> (Note that RSA_SOFTWARE_EXP also declares itself with DM_FLAG_PRE_RELOC.)
>
> By bisecting between v2019.04 and v2019.07, I found that the following
> commit triggered this regression:
>
> commit 3a7c45f6a772
> Author: Lukas Auer 
> Date:   Wed Apr 10 14:46:07 2019 +0200
>
> simple-bus: add DM_FLAG_PRE_RELOC flag to simple-bus driver
>
> What's wrong with this?

I just tested it and it boots for me.

$ make qemu_arm64_defconfig
$ make menuconfig
adding CONFIG_RSA via "Library routines" -> "Security support" -> "Use
RSA Library"
$ make

$ qemu-system-aarch64 -machine virt -cpu cortex-a57 -bios u-boot.bin -nographic

U-Boot 2019.07-rc1-00506-g90176e3 (May 15 2019 - 14:43:21 +0800)

DRAM:  128 MiB
Flash: 128 MiB
*** Warning - bad CRC, using default environment

In:pl011@900
Out:   pl011@900
Err:   pl011@900
Net:   No ethernet found.
Hit any key to stop autoboot:  0
=>

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


Re: [U-Boot] [PATCH 1/3] board: atmel: sama5d2_icp: add periph reset in SPL hw init

2019-05-14 Thread Eugen.Hristev


On 08.05.2019 15:58, Eugen Hristev - M18282 wrote:
> From: Eugen Hristev 
> 
> Some periphs on the board need to be reset by holding their reset GPIO down
> for a specific time period.
> On a warm reset, the periphs are not being reset by any reset pin and may be
> in a wrong state.
> Reset them in the SPL to make sure we are booting into the correct state
> machine of the specific board periphs (KSZ eth switch, USB hub, HSIC eth,
> Ethercat)
> 
> Signed-off-by: Eugen Hristev 
> ---

Applied all 3 patches to u-boot-atmel/master
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] arm: at91: gardena-smart-gateway-at91sam: Enable CMD_WDT

2019-05-14 Thread Eugen.Hristev


On 08.05.2019 15:47, Stefan Roese wrote:

> 
> This patch enables the "wdt" command, which is quite useful for watchdog
> testing.
> 
> Signed-off-by: Stefan Roese 
> Cc: Eugen Hristev 
> ---

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


[U-Boot] [PATCH v3 2/2] armv8: fsl-lsch3: add clock support for the second eSDHC

2019-05-14 Thread Yinbo Zhu
From: Yangbo Lu 

Layerscape began to use two eSDHC controllers, for example,
LS1028A. They are same IP block with same reference clock.
This patch is to add clock support for the second eSDHC.

Signed-off-by: Yangbo Lu 
Signed-off-by: Yinbo Zhu 
---
Change in v3:
Replace 'were' with 'are'   

 arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c | 1 +
 arch/arm/include/asm/arch-fsl-layerscape/clock.h| 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
index bc268e207c..7dbca1f06f 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_speed.c
@@ -214,6 +214,7 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
return get_i2c_freq(0);
 #if defined(CONFIG_FSL_ESDHC)
case MXC_ESDHC_CLK:
+   case MXC_ESDHC2_CLK:
return get_sdhc_freq(0);
 #endif
case MXC_DSPI_CLK:
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/clock.h 
b/arch/arm/include/asm/arch-fsl-layerscape/clock.h
index cf058d22a9..ac4194b9aa 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/clock.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/clock.h
@@ -14,6 +14,7 @@ enum mxc_clock {
MXC_BUS_CLK,
MXC_UART_CLK,
MXC_ESDHC_CLK,
+   MXC_ESDHC2_CLK,
MXC_I2C_CLK,
MXC_DSPI_CLK,
 };
-- 
2.17.1

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


[U-Boot] [PATCH v3 1/2] mmc: fsl_esdhc: fix probe issue without CONFIG_BLK enabled

2019-05-14 Thread Yinbo Zhu
From: Yangbo Lu 

u-boot is trying to make CONFIG_BLK as a hard requirement
for DM_MMC. But now it's still not.

config BLK
bool "Support block devices"
depends on DM
default y if DM_MMC

When fsl_esdhc driver was reworked for DM_MMC support, DM_MMC
without CONFIG_BLK enabled wasn't considered. This patch is to
fix probe issue without CONFIG_BLK enabled.

Signed-off-by: Yangbo Lu 
Signed-off-by: Yinbo Zhu 
---
 drivers/mmc/fsl_esdhc.c | 28 
 1 file changed, 28 insertions(+)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 9e34557d16..f1d67657fa 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -25,6 +25,10 @@
 #include 
 #include 
 
+#if !CONFIG_IS_ENABLED(BLK)
+#include "mmc_private.h"
+#endif
+
 DECLARE_GLOBAL_DATA_PTR;
 
 #define SDHCI_IRQ_EN_BITS  (IRQSTATEN_CC | IRQSTATEN_TC | \
@@ -34,6 +38,7 @@ DECLARE_GLOBAL_DATA_PTR;
IRQSTATEN_DEBE | IRQSTATEN_BRR | IRQSTATEN_BWR 
| \
IRQSTATEN_DINT)
 #define MAX_TUNING_LOOP 40
+#define ESDHC_DRIVER_STAGE_VALUE 0x
 
 struct fsl_esdhc {
uintdsaddr; /* SDMA system address register */
@@ -1448,6 +1453,9 @@ static int fsl_esdhc_probe(struct udevice *dev)
fdt_addr_t addr;
unsigned int val;
struct mmc *mmc;
+#if !CONFIG_IS_ENABLED(BLK)
+   struct blk_desc *bdesc;
+#endif
int ret;
 
addr = dev_read_addr(dev);
@@ -1576,6 +1584,26 @@ static int fsl_esdhc_probe(struct udevice *dev)
mmc = &plat->mmc;
mmc->cfg = &plat->cfg;
mmc->dev = dev;
+#if !CONFIG_IS_ENABLED(BLK)
+   mmc->priv = priv;
+
+   /* Setup dsr related values */
+   mmc->dsr_imp = 0;
+   mmc->dsr = ESDHC_DRIVER_STAGE_VALUE;
+   /* Setup the universal parts of the block interface just once */
+   bdesc = mmc_get_blk_desc(mmc);
+   bdesc->if_type = IF_TYPE_MMC;
+   bdesc->removable = 1;
+   bdesc->devnum = mmc_get_next_devnum();
+   bdesc->block_read = mmc_bread;
+   bdesc->block_write = mmc_bwrite;
+   bdesc->block_erase = mmc_berase;
+
+   /* setup initial part type */
+   bdesc->part_type = mmc->cfg->part_type;
+   mmc_list_add(mmc);
+#endif
+
upriv->mmc = mmc;
 
return esdhc_init_common(priv, mmc);
-- 
2.17.1

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


Re: [U-Boot] [PATCH] Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock setting issue"

2019-05-14 Thread Peng Fan
> Subject: RE: [PATCH] Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock
> setting issue"
> 
> > Subject: Re: [PATCH] Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode clock
> > setting issue"
> >
> > On Wed, 8 May 2019 13:59:14 +
> > Peng Fan  wrote:
> >
> > > > -Original Message-
> > > > From: Lukasz Majewski [mailto:lu...@denx.de]
> > > > Sent: 2019年5月8日 14:38
> > > > To: Peng Fan 
> > > > Cc: u-boot@lists.denx.de; Tom Rini ; Marcel
> > > > Ziswiler ; Fabio Estevam
> > > > ; dl-uboot-imx ;
> > > > sba...@denx.de; Stefan Agner ; BOUGH
> > CHEN
> > > > ; Ye Li 
> > > > Subject: Re: [PATCH] Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode
> > > > clock setting issue"
> > > >
> > > > On Wed, 8 May 2019 08:19:45 +0200
> > > > Lukasz Majewski  wrote:
> > > >
> > > > > Hi Peng,
> > > > >
> > > > > > Hi Lukasz,
> > > > > >
> > > > > > > Subject: [PATCH] Revert "mmc: fsl_esdhc: fix sd/mmc ddr mode
> > > > > > > clock setting issue"
> > > > > > >
> > > > > > > This reverts commit
> > 72a89e0da5ac6a4ab929b15a2b656f04f50767f6,
> > > > > > > which causes the imx53 HSC to hang as the eMMC is not
> > > > > > > working properly anymore.
> > > > > > >
> > > > > > > The exact error message:
> > > > > > > MMC write: dev # 0, block # 2, count 927 ... mmc write
> > > > > > > failed
> > > > > > > 0 blocks written: ERROR
> > > > > > >
> > > > > > > imx53 is not using the DDR mode.
> > > > > > >
> > > > > > > Debugging of pre_div and div generation showed that those
> > > > > > > values are generated in a way, which is not matching the
> > > > > > > ones from working setup.
> > > > > > >
> > > > > > > As the original patch was performing code refactoring, let's
> > > > > > > revert this change, so all imx53 boards would work again.
> > > > > >
> > > > > > Could you share what is the clock value for your board?
> > > > >
> > > > > Sure, no problem:
> > > > >
> > > > > Working setup:
> > > > > --
> > > > >
> > > > > MMC:
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 8 div: 12 set_sysctl: clk: 2240
> > > > > FSL_SDHC: 0
> > > > > Loading Environment from MMC...
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 8 div: 12 set_sysctl: clk: 2240
> > > > >
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 8 div: 12 set_sysctl: clk: 2240
> > > > >
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 1 div: 1 set_sysctl: clk: 272
> > > > >
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 1 div: 0 set_sysctl: clk: 256
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Broken:
> > > > > ---
> > > > > MMC:
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 8 div: 12 set_sysctl: clk: 2240
> > > > > FSL_SDHC: 0
> > > > > Loading Environment from MMC...
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 8 div: 12 set_sysctl: clk: 2240
> > > > >
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 8 div: 12 set_sysctl: clk: 2240
> > > > >
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 0 div: 3 set_sysctl: clk: 48
> > > > >
> > > > > set_sysctl: pre_div = 2 mmc->ddr: 0 sdhc_clk: 8000
> > > > >  pre_div: 0 div: 1 set_sysctl: clk: 16
> > > > >
> > > > >
> > > > > (Please also find attached patch to reproduce debug output).
> > > > >
> > > >
> > > > And maybe the most important question - why it was necessary to
> > > > refactor this code?
> > > >
> > > > Parts responsible for calculating pre_div and div seems not
> > > > related to ddr problem (one spot issue is div <= 16 , but in the
> > > > original code it was div < 16)?
> > >
> > > Could you help verify whether the patch fixes you issue?
> > >
> > > index 1b7de74a72..3347fbe738 100644
> > > --- a/drivers/mmc/fsl_esdhc.c
> > > +++ b/drivers/mmc/fsl_esdhc.c
> > > @@ -640,8 +640,7 @@ static void set_sysctl(struct fsl_esdhc_priv
> > > *priv, struct mmc *mmc, uint clock) for (; pre_div < 256; pre_div *=
> > > 2) if ((sdhc_clk / pre_div) <= (clock * 16))
> > > break;
> > > -   } else
> > > -   pre_div = 1;
> > > +   }
> >
> > Please examine this code thoroughly and provide patch.
> 
> The pre_div should not override the initialization value at the beginning of 
> the
> function.
> 
> >
> > The
> > } else
> > pre_div = 1;
> >
> > was added there for a purpose, so I'm wondering why it can be easily
> > removed now.
> 
> The else was wrongly added. It is not correct.
> 
> >
> > >
> > > for (div = 1; div <= 16; div++)
> > > if ((sdhc_clk / (div * pre_div)) <= clock)
> > >
> >
> > As I've stated above - is the above for() correct?
> >
> > In the original code it was div < 16, but here it is div <= 16.
> 
> Checking i.MX53 SDHC DVS, it supports [1,16], so should use "<=16", other
> i.MX has same.

Re: [U-Boot] [PATCH] efi_loader: variable: attributes may not be changed if a variable exists

2019-05-14 Thread AKASHI Takahiro
On Tue, May 14, 2019 at 08:08:49PM +0200, Heinrich Schuchardt wrote:
> On 5/14/19 8:35 AM, Heinrich Schuchardt wrote:
> >On 5/14/19 6:57 AM, AKASHI Takahiro wrote:
> >>If a variable already exists, efi_set_variable() should not change
> >>the variable's attributes. This patch enforces it.
> >
> >This behavior is mandated by UEFI spec 2.7.
> >
> >Reviewed-by: Heinrich Schuchardt 
> 
> This patch let's `bootefi selftest`fail:
> 
> Executing 'variables'
> lib/efi_selftest/efi_selftest_variables.c(60):
> TODO: QueryVariableInfo failed
> lib/efi_selftest/efi_selftest_variables.c(119):
> ERROR: SetVariable failed
> lib/efi_selftest/efi_selftest.c(110):
> ERROR: Executing 'variables' failed
> 
> The preferred solution would be to implement APPEND_WRITE.
> 
> Otherwise at least adjust the unit test concerning APPEND_WRITE to use
> efi_st_todo() and not to abort the test.

Since the current code doesn't supoort APPEND_WRITE, my commit
doesn't break anything. You should fix selftest first.

I don't have an immediate plan to implement APPEND_WRITE for now.

-Takahiro Akashi

> I suggest that you always run `bootefi selftest` before submitting
> changes to the UEFI sub-system.
> 
> Best regards
> 
> Heinrich
> 
> >
> >>
> >>Signed-off-by: AKASHI Takahiro 
> >>---
> >>  lib/efi_loader/efi_variable.c | 9 +
> >>  1 file changed, 9 insertions(+)
> >>
> >>diff --git a/lib/efi_loader/efi_variable.c
> >>b/lib/efi_loader/efi_variable.c
> >>index 37728c3c165d..c4f3a5d2743d 100644
> >>--- a/lib/efi_loader/efi_variable.c
> >>+++ b/lib/efi_loader/efi_variable.c
> >>@@ -450,6 +450,15 @@ efi_status_t EFIAPI efi_set_variable(u16
> >>*variable_name,
> >>  ret = EFI_WRITE_PROTECTED;
> >>  goto out;
> >>  }
> >>+
> >>+    /*
> >>+ * attributes won't be changed
> >>+ * TODO: take care of APPEND_WRITE once supported
> >>+ */
> >>+    if (attr != attributes) {
> >>+    ret = EFI_INVALID_PARAMETER;
> >>+    goto out;
> >>+    }
> >>  }
> >>
> >>  val = malloc(2 * data_size + strlen("{ro,run,boot}(blob)") + 1);
> >>
> >
> >
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/4] test/py: test_fs: add tests for creating/deleting many files

2019-05-14 Thread AKASHI Takahiro
On Tue, May 14, 2019 at 08:09:53PM +0200, Heinrich Schuchardt wrote:
> On 5/13/19 7:49 AM, AKASHI Takahiro wrote:
> >Two test cases are added under test_fs_ext:
> > test case 10: for root directory
> > test case 11: for non-root directory
> 
> When running `make tests` all of these tests seem to be skipped:
> 
> test/py/tests/test_fs/test_basic.py
> sss
> [  0%]
> test/py/tests/test_fs/test_ext.py ss
> 
> [  0%]
> test/py/tests/test_fs/test_mkdir.py 
> 
> [  0%]
> test/py/tests/test_fs/test_symlink.py 
> 
> [  0%]
> test/py/tests/test_fs/test_unlink.py ss
> 
> How can they be executed?

Install guestmount and set it up correctly.

-Takahiro Akashi


> I think it is worthwhile to mention as a comment that you are testing
> long file names (not 8.3).
> 
> Best regards
> 
> Heinrich
> 
> >
> >Those will verify a behavior fixed by the commits related to
> >root directory
> >("fs: fat: allocate a new cluster for root directory of fat32" and
> >"fs: fat: flush a directory cluster properly").
> >
> >Signed-off-by: AKASHI Takahiro 
> >---
> >  test/py/tests/test_fs/test_ext.py | 84 +++
> >  1 file changed, 84 insertions(+)
> >
> >diff --git a/test/py/tests/test_fs/test_ext.py 
> >b/test/py/tests/test_fs/test_ext.py
> >index 2c47738b8df2..361f440dd6d4 100644
> >--- a/test/py/tests/test_fs/test_ext.py
> >+++ b/test/py/tests/test_fs/test_ext.py
> >@@ -233,3 +233,87 @@ class TestFsExt(object):
> >  % (fs_type, ADDR, MIN_FILE)])
> >  assert('Unable to write "/dir1' in ''.join(output))
> >  assert_fs_integrity(fs_type, fs_img)
> >+
> >+def test_fs_ext10(self, u_boot_console, fs_obj_ext):
> >+"""
> >+'Test Case 10 - create/delete as many directories under root 
> >directory
> >+as amount of directory entries goes beyond one cluster size)'
> >+"""
> >+fs_type,fs_img,md5val = fs_obj_ext
> >+with u_boot_console.log.section('Test Case 10 - create/delete 
> >(many)'):
> >+# Test Case 10a - Create many files
> >+#   Please note that the size of directory entry is 32 bytes.
> >+#   So one typical cluster may holds 64 (2048/32) entries.
> >+output = u_boot_console.run_command(
> >+'host bind 0 %s' % fs_img)
> >+
> >+for i in range(0, 66):
> >+output = u_boot_console.run_command(
> >+'%swrite host 0:0 %x /FILE0123456789_%02x 100'
> >+% (fs_type, ADDR, i))
> >+output = u_boot_console.run_command('%sls host 0:0 /' % fs_type)
> >+assert('FILE0123456789_00' in output)
> >+assert('FILE0123456789_41' in output)
> >+
> >+# Test Case 10b - Delete many files
> >+for i in range(0, 66):
> >+output = u_boot_console.run_command(
> >+'%srm host 0:0 /FILE0123456789_%02x'
> >+% (fs_type, i))
> >+output = u_boot_console.run_command('%sls host 0:0 /' % fs_type)
> >+assert(not 'FILE0123456789_00' in output)
> >+assert(not 'FILE0123456789_41' in output)
> >+
> >+# Test Case 10c - Create many files again
> >+# Please note no.64 and 65 are intentionally re-created
> >+for i in range(64, 128):
> >+output = u_boot_console.run_command(
> >+'%swrite host 0:0 %x /FILE0123456789_%02x 100'
> >+% (fs_type, ADDR, i))
> >+output = u_boot_console.run_command('%sls host 0:0 /' % fs_type)
> >+assert('FILE0123456789_40' in output)
> >+assert('FILE0123456789_79' in output)
> >+
> >+assert_fs_integrity(fs_type, fs_img)
> >+
> >+def test_fs_ext11(self, u_boot_console, fs_obj_ext):
> >+"""
> >+'Test Case 11 - create/delete as many directories under non-root
> >+directory as amount of directory entries goes beyond one cluster 
> >size)'
> >+"""
> >+fs_type,fs_img,md5val = fs_obj_ext
> >+with u_boot_console.log.section('Test Case 10 - create/delete 
> >(many)'):
> >+# Test Case 11a - Create many files
> >+#   Please note that the size of directory entry is 32 bytes.
> >+#   So one typical cluster may holds 64 (2048/32) entries.
> >+output = u_boot_console.run_command(
> >+'host bind 0 %s' % fs_img)
> >+
> >+for i in range(0, 66):
> >+output = u_boot_console.run_command(
> >+'%swrite host 0:0 %x /dir1/FILE0123456789_%02x 100'
> >+% (fs_type, ADDR, i))
> >+output = u_boot_console.run_command('%sls host 0:0 /dir1' % 
> >fs_type)
> >+   

[U-Boot] [BUG] simple-bus and rsa-sw with DM_FLAG_PRE_RELOC

2019-05-14 Thread AKASHI Takahiro
As of v2019.07-rc1,
u-boot does fail to boot without any messages on qemu-arm64 when
configured with qemu_arm64_defconfig plus CONFIG_RSA/RSA_SOFTWARE_EXP.
(Note that RSA_SOFTWARE_EXP also declares itself with DM_FLAG_PRE_RELOC.)

By bisecting between v2019.04 and v2019.07, I found that the following
commit triggered this regression:

commit 3a7c45f6a772
Author: Lukas Auer 
Date:   Wed Apr 10 14:46:07 2019 +0200

simple-bus: add DM_FLAG_PRE_RELOC flag to simple-bus driver

What's wrong with this?

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


Re: [U-Boot] [PATCH 2/2] watchdog: imx: Add DM support

2019-05-14 Thread Peng Fan
> Subject: [U-Boot] [PATCH 2/2] watchdog: imx: Add DM support
> 
> Add DM and DT probing support to iMX watchdog driver. This should allow
> boards to move over to this driver, enable SYSRESET_WATCHDOG to handle
> cpu_reset() if required.
> 
> Signed-off-by: Marek Vasut 
> Cc: Peng Fan 
> Cc: Stefano Babic 
> ---
>  drivers/watchdog/Kconfig|   2 +-
>  drivers/watchdog/imx_watchdog.c | 119
> +++-
>  2 files changed, 104 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index
> f909d40f45..b2ebe528ab 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -129,7 +129,7 @@ config XILINX_TB_WATCHDOG
> 
>  config IMX_WATCHDOG
>   bool "Enable Watchdog Timer support for IMX and LSCH2 of NXP"
> - select HW_WATCHDOG
> + select HW_WATCHDOG if !WDT
>   help
>  Select this to enable the IMX and LSCH2 of Layerscape watchdog
>  driver.
> diff --git a/drivers/watchdog/imx_watchdog.c
> b/drivers/watchdog/imx_watchdog.c index 14cc618074..53a3e9f5c7 100644
> --- a/drivers/watchdog/imx_watchdog.c
> +++ b/drivers/watchdog/imx_watchdog.c
> @@ -5,7 +5,9 @@
>   */
> 
>  #include 
> +#include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #ifdef CONFIG_FSL_LSCH2
> @@ -13,20 +15,40 @@
>  #endif
>  #include 
> 
> -#ifdef CONFIG_IMX_WATCHDOG
> -void hw_watchdog_reset(void)
> +static void imx_watchdog_expire_now(struct watchdog_regs *wdog) {
> + clrsetbits_le16(&wdog->wcr, WCR_WT_MSK, WCR_WDE);
> +
> + writew(0x, &wdog->wsr);
> + writew(0x, &wdog->wsr); /* load minimum 1/2 second timeout
> */
> + while (1) {
> + /*
> +  * spin for .5 seconds before reset
> +  */
> + }
> +}
> +
> +#if !defined(CONFIG_IMX_WATCHDOG) || \
> +(defined(CONFIG_IMX_WATCHDOG) && !CONFIG_IS_ENABLED(WDT))
> void
> +__attribute__((weak)) reset_cpu(ulong addr)
>  {
> -#ifndef CONFIG_WATCHDOG_RESET_DISABLE
>   struct watchdog_regs *wdog = (struct watchdog_regs
> *)WDOG1_BASE_ADDR;
> 
> + imx_watchdog_expire_now(wdog);
> +}
> +#endif
> +
> +#if defined(CONFIG_IMX_WATCHDOG)
> +static void imx_watchdog_reset(struct watchdog_regs *wdog) { #ifndef
> +CONFIG_WATCHDOG_RESET_DISABLE
>   writew(0x, &wdog->wsr);
>   writew(0x, &wdog->wsr);
>  #endif /* CONFIG_WATCHDOG_RESET_DISABLE*/  }
> 
> -void hw_watchdog_init(void)
> +static void imx_watchdog_init(struct watchdog_regs *wdog)
>  {
> - struct watchdog_regs *wdog = (struct watchdog_regs
> *)WDOG1_BASE_ADDR;
>   u16 timeout;
> 
>   /*
> @@ -44,21 +66,86 @@ void hw_watchdog_init(void)
>   writew(WCR_WDZST | WCR_WDBG | WCR_WDE | WCR_WDT |
> WCR_SRS |
>   WCR_WDA | SET_WCR_WT(timeout), &wdog->wcr);  #endif /*
> CONFIG_FSL_LSCH2*/
> - hw_watchdog_reset();
> + imx_watchdog_reset(wdog);
>  }
> -#endif
> 
> -void __attribute__((weak)) reset_cpu(ulong addr)
> +#if !CONFIG_IS_ENABLED(WDT)
> +void hw_watchdog_reset(void)
>  {
>   struct watchdog_regs *wdog = (struct watchdog_regs
> *)WDOG1_BASE_ADDR;
> 
> - clrsetbits_le16(&wdog->wcr, WCR_WT_MSK, WCR_WDE);
> + imx_watchdog_reset(wdog);
> +}
> 
> - writew(0x, &wdog->wsr);
> - writew(0x, &wdog->wsr); /* load minimum 1/2 second timeout
> */
> - while (1) {
> - /*
> -  * spin for .5 seconds before reset
> -  */
> - }
> +void hw_watchdog_init(void)
> +{
> + struct watchdog_regs *wdog = (struct watchdog_regs
> *)WDOG1_BASE_ADDR;
> +
> + imx_watchdog_init(wdog);
> +}
> +#else
> +struct imx_wdt_priv {
> + void __iomem *base;
> +};
> +
> +static int imx_wdt_reset(struct udevice *dev) {
> + struct imx_wdt_priv *priv = dev_get_priv(dev);
> +
> + imx_watchdog_reset(priv->base);
> +
> + return 0;
> +}
> +
> +static int imx_wdt_expire_now(struct udevice *dev, ulong flags) {
> + struct imx_wdt_priv *priv = dev_get_priv(dev);
> +
> + imx_watchdog_expire_now(priv->base);
> + hang();
> +
> + return 0;
> +}
> +
> +static int imx_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
> +{
> + struct imx_wdt_priv *priv = dev_get_priv(dev);
> +
> + imx_watchdog_init(priv->base);
> +
> + return 0;
> +}
> +
> +static int imx_wdt_probe(struct udevice *dev) {
> + struct imx_wdt_priv *priv = dev_get_priv(dev);
> +
> + priv->base = dev_read_addr_ptr(dev);
> + if (!priv->base)
> + return -ENOENT;
> +
> + return 0;
>  }
> +
> +static const struct wdt_ops imx_wdt_ops = {
> + .start  = imx_wdt_start,
> + .reset  = imx_wdt_reset,
> + .expire_now = imx_wdt_expire_now,
> +};
> +
> +static const struct udevice_id imx_wdt_ids[] = {
> + { .compatible = "fsl,imx21-wdt" },
> + {}
> +};
> +
> +U_BOOT_DRIVER(imx_wdt) = {
> + .name   = "imx_wdt",
> + .id = UCLASS_WDT,
> + .of_match   = imx_wdt_ids,
> + .probe 

Re: [U-Boot] [PATCH 1/2] watchdog: Split WDT from SPL_WDT

2019-05-14 Thread Peng Fan
> Subject: [U-Boot] [PATCH 1/2] watchdog: Split WDT from SPL_WDT
> 
> Use CONFIG_IS_ENABLED(WDT) to permit use of WDT in SPL without DM,
> while the full U-Boot can use rich DM/DT WDT driver.
> 
> Signed-off-by: Marek Vasut 
> Cc: Peng Fan 
> Cc: Stefano Babic 
> ---
>  common/board_r.c  | 2 +-
>  common/spl/spl.c  | 2 +-
>  drivers/watchdog/Makefile | 2 +-
>  include/asm-generic/global_data.h | 2 +-
>  include/wdt.h | 2 +-
>  5 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/common/board_r.c b/common/board_r.c index
> 150e8cd424..988e40abb2 100644
> --- a/common/board_r.c
> +++ b/common/board_r.c
> @@ -678,7 +678,7 @@ static init_fnc_t init_sequence_r[] = {  #ifdef
> CONFIG_DM
>   initr_dm,
>  #endif
> -#if defined(CONFIG_WDT)
> +#if CONFIG_IS_ENABLED(WDT)
>   initr_watchdog,
>  #endif
>  #if defined(CONFIG_ARM) || defined(CONFIG_NDS32) ||
> defined(CONFIG_RISCV) || \ diff --git a/common/spl/spl.c
> b/common/spl/spl.c index 0a6a47c202..f22f854718 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -601,7 +601,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>   spl_board_init();
>  #endif
> 
> -#if defined(CONFIG_SPL_WATCHDOG_SUPPORT) && defined(CONFIG_WDT)
> +#if defined(CONFIG_SPL_WATCHDOG_SUPPORT) &&
> CONFIG_IS_ENABLED(WDT)
>   initr_watchdog();
>  #endif
> 
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index
> 40b2f4bc66..4b94ae988c 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -16,7 +16,7 @@ obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o
>  obj-$(CONFIG_DESIGNWARE_WATCHDOG) += designware_wdt.o
>  obj-$(CONFIG_TANGIER_WATCHDOG) += tangier_wdt.o
>  obj-$(CONFIG_ULP_WATCHDOG) += ulp_wdog.o
> -obj-$(CONFIG_WDT) += wdt-uclass.o
> +obj-$(CONFIG_$(SPL_TPL_)WDT) += wdt-uclass.o
>  obj-$(CONFIG_WDT_SANDBOX) += sandbox_wdt.o
>  obj-$(CONFIG_WDT_ARMADA_37XX) += armada-37xx-wdt.o
>  obj-$(CONFIG_WDT_ASPEED) += ast_wdt.o
> diff --git a/include/asm-generic/global_data.h
> b/include/asm-generic/global_data.h
> index 02a3ed6838..7c2220643b 100644
> --- a/include/asm-generic/global_data.h
> +++ b/include/asm-generic/global_data.h
> @@ -137,7 +137,7 @@ typedef struct global_data {  #if
> defined(CONFIG_TRANSLATION_OFFSET)
>   fdt_addr_t translation_offset;  /* optional translation offset */
>  #endif
> -#if defined(CONFIG_WDT)
> +#if CONFIG_IS_ENABLED(WDT)
>   struct udevice *watchdog_dev;
>  #endif
>  } gd_t;
> diff --git a/include/wdt.h b/include/wdt.h index aa77d3e9b4..5bcff24ab3
> 100644
> --- a/include/wdt.h
> +++ b/include/wdt.h
> @@ -106,7 +106,7 @@ struct wdt_ops {
>   int (*expire_now)(struct udevice *dev, ulong flags);  };
> 
> -#if defined(CONFIG_WDT)
> +#if CONFIG_IS_ENABLED(WDT)
>  #ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS
>  #define CONFIG_WATCHDOG_TIMEOUT_MSECS(60 * 1000)
>  #endif

Reviewed-by: Peng Fan 

> --
> 2.20.1
> 
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.d
> enx.de%2Flistinfo%2Fu-boot&data=02%7C01%7CPeng.Fan%40nxp.com
> %7C80a98d74e79849cca5bd08d6d721cb41%7C686ea1d3bc2b4c6fa92cd99c
> 5c301635%7C0%7C0%7C636932937538649220&sdata=JB4foxgQVteQw
> MUJrefgqegLm6N%2ByFq%2BfLknDE89nfo%3D&reserved=0
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2] drivers: net: mc: Report extra memory to Linux

2019-05-14 Thread Meenakshi Aggarwal
MC firmware need to be aligned to 512M, so minimum 512MB DDR is reserved.
But MC support to work with 128MB or 256MB DDR memory also, in this
case, rest of the memory is not usable.
So reporting this extra memory to Linux through dtb memory fixup.

Signed-off-by: Meenakshi Aggarwal 
---
 board/freescale/ls1088a/ls1088a.c   | 34 +---
 board/freescale/ls2080ardb/ls2080ardb.c | 35 ++---
 board/freescale/lx2160a/lx2160a.c   | 34 +---
 drivers/net/fsl-mc/mc.c | 10 ++
 include/fsl-mc/fsl_mc.h |  1 +
 5 files changed, 105 insertions(+), 9 deletions(-)

diff --git a/board/freescale/ls1088a/ls1088a.c 
b/board/freescale/ls1088a/ls1088a.c
index 6d11a13..88c34cb 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -28,6 +28,9 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define TRUE   1
+#define FALSE  0
+
 #ifdef CONFIG_TARGET_LS1088AQDS
 #ifdef CONFIG_TFABOOT
 struct ifc_regs ifc_cfg_ifc_nor_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = {
@@ -738,11 +741,26 @@ void fsl_fdt_fixup_flash(void *fdt)
 int ft_board_setup(void *blob, bd_t *bd)
 {
int i;
-   u64 base[CONFIG_NR_DRAM_BANKS];
-   u64 size[CONFIG_NR_DRAM_BANKS];
+   bool mc_memory_bank = FALSE;
+
+   u64 *base;
+   u64 *size;
+   u64 mc_memory_base = 0;
+   u64 mc_memory_size = 0;
+   u16 total_memory_banks;
 
ft_cpu_setup(blob, bd);
 
+   fdt_fixup_mc_ddr(&mc_memory_base, &mc_memory_size);
+
+   if (mc_memory_base != 0)
+   mc_memory_bank = TRUE;
+
+   total_memory_banks = CONFIG_NR_DRAM_BANKS + mc_memory_bank;
+
+   base = calloc(total_memory_banks, sizeof(u64));
+   size = calloc(total_memory_banks, sizeof(u64));
+
/* fixup DT for the two GPP DDR banks */
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
base[i] = gd->bd->bi_dram[i].start;
@@ -759,7 +777,17 @@ int ft_board_setup(void *blob, bd_t *bd)
size[1] = gd->arch.resv_ram - base[1];
 #endif
 
-   fdt_fixup_memory_banks(blob, base, size, CONFIG_NR_DRAM_BANKS);
+   if (mc_memory_base != 0) {
+   for (i = 0; i <= total_memory_banks; i++) {
+   if (base[i] == 0 && size[i] == 0) {
+   base[i] = mc_memory_base;
+   size[i] = mc_memory_size;
+   break;
+   }
+   }
+   }
+
+   fdt_fixup_memory_banks(blob, base, size, total_memory_banks);
 
fdt_fsl_mc_fixup_iommu_map_entry(blob);
 
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c 
b/board/freescale/ls2080ardb/ls2080ardb.c
index ce419df..b6b4e80 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -22,6 +22,9 @@
 #include 
 #include 
 
+#define TRUE   1
+#define FALSE  0
+
 #ifdef CONFIG_FSL_QIXIS
 #include "../common/qixis.h"
 #include "ls2080ardb_qixis.h"
@@ -409,11 +412,27 @@ void fsl_fdt_fixup_flash(void *fdt)
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
-   u64 base[CONFIG_NR_DRAM_BANKS];
-   u64 size[CONFIG_NR_DRAM_BANKS];
+   int i;
+   bool mc_memory_bank = FALSE;
+
+   u64 *base;
+   u64 *size;
+   u64 mc_memory_base = 0;
+   u64 mc_memory_size = 0;
+   u16 total_memory_banks;
 
ft_cpu_setup(blob, bd);
 
+   fdt_fixup_mc_ddr(&mc_memory_base, &mc_memory_size);
+
+   if (mc_memory_base != 0)
+   mc_memory_bank = TRUE;
+
+   total_memory_banks = CONFIG_NR_DRAM_BANKS + mc_memory_bank;
+
+   base = calloc(total_memory_banks, sizeof(u64));
+   size = calloc(total_memory_banks, sizeof(u64));
+
/* fixup DT for the two GPP DDR banks */
base[0] = gd->bd->bi_dram[0].start;
size[0] = gd->bd->bi_dram[0].size;
@@ -430,7 +449,17 @@ int ft_board_setup(void *blob, bd_t *bd)
size[1] = gd->arch.resv_ram - base[1];
 #endif
 
-   fdt_fixup_memory_banks(blob, base, size, 2);
+   if (mc_memory_base != 0) {
+   for (i = 0; i <= total_memory_banks; i++) {
+   if (base[i] == 0 && size[i] == 0) {
+   base[i] = mc_memory_base;
+   size[i] = mc_memory_size;
+   break;
+   }
+   }
+   }
+
+   fdt_fixup_memory_banks(blob, base, size, total_memory_banks);
 
fdt_fsl_mc_fixup_iommu_map_entry(blob);
 
diff --git a/board/freescale/lx2160a/lx2160a.c 
b/board/freescale/lx2160a/lx2160a.c
index 3875d04..5f6099f 100644
--- a/board/freescale/lx2160a/lx2160a.c
+++ b/board/freescale/lx2160a/lx2160a.c
@@ -30,6 +30,9 @@
 #include "../common/emc2305.h"
 #endif
 
+#defin

[U-Boot] [PATCH v2] cover letter for drivers: net: mc: Report extra memory to linux

2019-05-14 Thread Meenakshi Aggarwal
changes in different versions:

v1 : Incorporated review comments in one board, Missed for other boards
v2 : Incorporated review comments in all boards.

Meenakshi Aggarwal (1):
  drivers: net: mc: Report extra memory to Linux

 board/freescale/ls1088a/ls1088a.c   | 34 +---
 board/freescale/ls2080ardb/ls2080ardb.c | 35 ++---
 board/freescale/lx2160a/lx2160a.c   | 34 +---
 drivers/net/fsl-mc/mc.c | 10 ++
 include/fsl-mc/fsl_mc.h |  1 +
 5 files changed, 105 insertions(+), 9 deletions(-)

-- 
1.9.1

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


Re: [U-Boot] [PATCH 1/1] pci: pci_mvebu: fix bus enumeration if some buses have empty slots

2019-05-14 Thread Mario Six
Hi Marek,

On Tue, May 14, 2019 at 5:12 PM Marek Behún  wrote:
>
> The documentation for the uclass_next_device says this:
>
>   @devp: On entry, pointer to device to lookup. On exit, returns pointer
>   to the next device in the uclass if no error occurred, or NULL if
>   there is no next device, or an error occurred with that next device.
>
> But this is useless, because if an error occured with that next device,
> the iteration stops and devices which should work won't be probed.

The class_{first,next}_device_check functions do exactly what you need: They
skip the devices that won't probe and only return the ones that do probe.

Best regards,

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


Re: [U-Boot] [PATCH v2 10/19] spi: mpc8xxx: Simplify logic a bit

2019-05-14 Thread Mario Six
On Tue, May 14, 2019 at 3:53 PM Jagan Teki  wrote:
>
> On Thu, May 2, 2019 at 2:37 PM Joakim Tjernlund
>  wrote:
> >
> > On Thu, 2019-05-02 at 07:31 +0200, Mario Six wrote:
> > > CAUTION: This email originated from outside of the organization. Do not 
> > > click links or open attachments unless you recognize the sender and know 
> > > the content is safe.
> > >
> > >
> > > Hi Jagan and Jocke,
> > >
> > > I'm back from vacation, so here's my answer:
> > >
> > > On Mon, Apr 29, 2019 at 12:41 PM Jagan Teki  
> > > wrote:
> > > > + Mario
> > > >
> > > > On Mon, Apr 29, 2019 at 2:48 PM Joakim Tjernlund
> > > >  wrote:
> > > > > On Mon, 2019-04-29 at 01:58 +0530, Jagan Teki wrote:
> > > > > > From: Mario Six 
> > > > > >
> > > > > > We do nothing in the loop if the "not empty" event was not 
> > > > > > detected. To
> > > > > > simplify the logic, check if this is the case, and skip the 
> > > > > > execution of
> > > > > > the loop early to reduce the nesting level and flag checking.
> > > > >
> > > > > Looked at the driver to refresh memory and noticed:
> > > > > if (charSize == 32) {
> > > > > /* Advance output buffer by 32 bits */
> > > > > din += 4;
> > > > > }
> > > > > which suggests that only 32 bit char will increase the din ptr so 
> > > > > does other bitlens
> > > > > work for reading?
> > > Yes, It will work. When charSize < 32 in a loop execution, we necessarily 
> > > also
> > > have numBlks == 0, since numBlks = DIV_ROUND_UP(bitlen, 32) and charSize =
> > > (bitlen >= 32 ? 32 : bitlen); in other words: we're at the very end of 
> > > the data
> > > to be sent/received and also the final loop execution, so we don't have to
> > > advance the pointer anymore.
> >
> > Ahh, I see now.
> >
> > But this over use of always 32 bits cause complexity/subtile bugs. The 
> > driver should use
> > the requested charsize(wordlen) throughout. As is now you cannot use the 
> > NF/NE flag as intended or
> > toggle LSB_FIRST
>
> Look like Joakim has a point here. better we can check the required
> charsize instead of looking for magic 32 number. What do you say
> Mario?

I agree, the driver code could be made more readable and cleaned up a bit, but
I don't know if it's worth postponing this series for a code readability issue
that's not a functional bug; I'd say that's an optimization that could be made
later on.

What do you guys think?

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


Re: [U-Boot] fit: Add support for printing more than one FPGA node name

2019-05-14 Thread Chee, Tien Fong
On Sat, 2019-04-27 at 10:43 -0400, Tom Rini wrote:
> On Fri, Apr 26, 2019 at 06:12:40AM +, Chee, Tien Fong wrote:
> > 
> > On Mon, 2019-04-22 at 13:29 -0400, Tom Rini wrote:
> > > 
> > > On Wed, Feb 13, 2019 at 08:32:24PM +0800, tien.fong.c...@intel.co
> > > m
> > > wrote:
> > > 
> > > > 
> > > > 
> > > > From: Tien Fong Chee 
> > > > 
> > > > This would print out all the FPGA node names setting to fpga
> > > > property.
> > > > 
> > > > Signed-off-by: Tien Fong Chee 
> > > > ---
> > > >  common/image-fit.c |   14 +++---
> > > >  1 files changed, 11 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/common/image-fit.c b/common/image-fit.c
> > > > index ac901e1..816e17d 100644
> > > > --- a/common/image-fit.c
> > > > +++ b/common/image-fit.c
> > > > @@ -263,6 +263,7 @@ static void fit_conf_print(const void *fit,
> > > > int
> > > > noffset, const char *p)
> > > >     int ret;
> > > >     int fdt_index, loadables_index;
> > > >     int ndepth;
> > > > +   ulong count;
> > > >  
> > > >     /* Mandatory properties */
> > > >     ret = fit_get_desc(fit, noffset, &desc);
> > > > @@ -299,9 +300,16 @@ static void fit_conf_print(const void
> > > > *fit,
> > > > int noffset, const char *p)
> > > >     printf("%s\n", uname);
> > > >     }
> > > >  
> > > > -   uname = fdt_getprop(fit, noffset, FIT_FPGA_PROP,
> > > > NULL);
> > > > -   if (uname)
> > > > -   printf("%s  FPGA: %s\n", p, uname);
> > > > +   count = fit_conf_get_prop_node_count(fit, noffset,
> > > > FIT_FPGA_PROP);
> > > > +
> > > > +   for (ndepth = 0; ndepth < count; ndepth++) {
> > > > +   int images_noffset =
> > > > fit_conf_get_prop_node_index(fit, noffset,
> > > > +   FIT_FPGA_PROP,
> > > > ndepth);
> > > > +   uname = fit_get_name(fit, images_noffset,
> > > > NULL);
> > > > +
> > > > +   if (uname)
> > > > +   printf("%s  FPGA: %s\n", p,
> > > > uname);
> > > > +   }
> > > >  
> > > >     /* Print out all of the specified loadables */
> > > >     for (loadables_index = 0;
> > > While I'm fine with the conceptual change here, both
> > > fit_conf_get_prop_node_count / fit_conf_get_prop_node_index are
> > > defined
> > > later in the file and while public functions not documented in a
> > > header.
> > > Can you please do a patch that does so first, as we otherwise get
> > > a
> > > warning?  Thanks!
> > The header file in this patch https://patchwork.ozlabs.org/patch/10
> > 58289/,
> > unfortunately the review taking a bit longer than what i expected.
> > 
> > I would update you once the whole series patches are accepted.
> Ah, OK, I'll hold off until the other series is complete.

The series is already in mainline master branch.

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


[U-Boot] [PATCH v1] drivers: net: mc: Report extra memory to Linux

2019-05-14 Thread Meenakshi Aggarwal
MC firmware need to be aligned to 512M, so minimum 512MB DDR is reserved.
But MC support to work with 128MB or 256MB DDR memory also, in this
case, rest of the memory is not usable.
So reporting this extra memory to Linux through dtb memory fixup.

Signed-off-by: Meenakshi Aggarwal 
---
 board/freescale/ls1088a/ls1088a.c   | 31 +++---
 board/freescale/ls2080ardb/ls2080ardb.c | 32 ---
 board/freescale/lx2160a/lx2160a.c   | 34 ++---
 drivers/net/fsl-mc/mc.c | 10 ++
 include/fsl-mc/fsl_mc.h |  1 +
 5 files changed, 99 insertions(+), 9 deletions(-)

diff --git a/board/freescale/ls1088a/ls1088a.c 
b/board/freescale/ls1088a/ls1088a.c
index 6d11a13..96f0871 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -738,11 +738,26 @@ void fsl_fdt_fixup_flash(void *fdt)
 int ft_board_setup(void *blob, bd_t *bd)
 {
int i;
-   u64 base[CONFIG_NR_DRAM_BANKS];
-   u64 size[CONFIG_NR_DRAM_BANKS];
+   bool mc_memory_bank = false;
+
+   u64 *base;
+   u64 *size;
+   u64 mc_memory_base = 0;
+   u64 mc_memory_size = 0;
+   u16 total_memory_banks;
 
ft_cpu_setup(blob, bd);
 
+   fdt_fixup_mc_ddr(&mc_memory_base, &mc_memory_size);
+
+   if (mc_memory_base != 0)
+   mc_memory_bank = true;
+
+   total_memory_banks = CONFIG_NR_DRAM_BANKS + mc_memory_bank;
+
+   base = calloc(total_memory_banks, sizeof(u64));
+   size = calloc(total_memory_banks, sizeof(u64));
+
/* fixup DT for the two GPP DDR banks */
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
base[i] = gd->bd->bi_dram[i].start;
@@ -759,7 +774,17 @@ int ft_board_setup(void *blob, bd_t *bd)
size[1] = gd->arch.resv_ram - base[1];
 #endif
 
-   fdt_fixup_memory_banks(blob, base, size, CONFIG_NR_DRAM_BANKS);
+   if (mc_memory_base != 0) {
+   for (i = 0; i <= total_memory_banks; i++) {
+   if (base[i] == 0 && size[i] == 0) {
+   base[i] = mc_memory_base;
+   size[i] = mc_memory_size;
+   break;
+   }
+   }
+   }
+
+   fdt_fixup_memory_banks(blob, base, size, total_memory_banks);
 
fdt_fsl_mc_fixup_iommu_map_entry(blob);
 
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c 
b/board/freescale/ls2080ardb/ls2080ardb.c
index ce419df..3af83f9 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -409,11 +409,27 @@ void fsl_fdt_fixup_flash(void *fdt)
 
 int ft_board_setup(void *blob, bd_t *bd)
 {
-   u64 base[CONFIG_NR_DRAM_BANKS];
-   u64 size[CONFIG_NR_DRAM_BANKS];
+   int i;
+   bool mc_memory_bank = false;
+
+   u64 *base;
+   u64 *size;
+   u64 mc_memory_base = 0;
+   u64 mc_memory_size = 0;
+   u16 total_memory_banks;
 
ft_cpu_setup(blob, bd);
 
+   fdt_fixup_mc_ddr(&mc_memory_base, &mc_memory_size);
+
+   if (mc_memory_base != 0)
+   mc_memory_bank = true;
+
+   total_memory_banks = CONFIG_NR_DRAM_BANKS + mc_memory_bank;
+
+   base = calloc(total_memory_banks, sizeof(u64));
+   size = calloc(total_memory_banks, sizeof(u64));
+
/* fixup DT for the two GPP DDR banks */
base[0] = gd->bd->bi_dram[0].start;
size[0] = gd->bd->bi_dram[0].size;
@@ -430,7 +446,17 @@ int ft_board_setup(void *blob, bd_t *bd)
size[1] = gd->arch.resv_ram - base[1];
 #endif
 
-   fdt_fixup_memory_banks(blob, base, size, 2);
+   if (mc_memory_base != 0) {
+   for (i = 0; i <= total_memory_banks; i++) {
+   if (base[i] == 0 && size[i] == 0) {
+   base[i] = mc_memory_base;
+   size[i] = mc_memory_size;
+   break;
+   }
+   }
+   }
+
+   fdt_fixup_memory_banks(blob, base, size, total_memory_banks);
 
fdt_fsl_mc_fixup_iommu_map_entry(blob);
 
diff --git a/board/freescale/lx2160a/lx2160a.c 
b/board/freescale/lx2160a/lx2160a.c
index 3875d04..b44ca3f 100644
--- a/board/freescale/lx2160a/lx2160a.c
+++ b/board/freescale/lx2160a/lx2160a.c
@@ -30,6 +30,9 @@
 #include "../common/emc2305.h"
 #endif
 
+#define TRUE   1
+#define FALSE  0
+
 #ifdef CONFIG_TARGET_LX2160AQDS
 #define CFG_MUX_I2C_SDHC(reg, value)   ((reg & 0x3f) | value)
 #define SET_CFG_MUX1_SDHC1_SDHC(reg)   (reg & 0x3f)
@@ -520,11 +523,26 @@ void board_quiesce_devices(void)
 int ft_board_setup(void *blob, bd_t *bd)
 {
int i;
-   u64 base[CONFIG_NR_DRAM_BANKS];
-   u64 size[CONFIG_NR_DRAM_BANKS];
+   bool mc_memory_bank = FALSE;
+
+   u64 *base;
+   u64 *size;
+

Re: [U-Boot] [PATCH v3 1/2] fit: Support compression for non-kernel components (e.g. FDT)

2019-05-14 Thread Simon Glass
Hi Simon,

On Tue, 14 May 2019 at 05:16, Simon Goldschmidt
 wrote:
>
> On Tue, May 14, 2019 at 12:55 PM Simon Glass  wrote:
> >
> > Hi Julius,
> >
> > On Mon, 13 May 2019 at 19:13, Julius Werner  wrote:
> > >
> > > > Is there a change log for this patch?I think we discussed having a test.
> > >
> > > Sorry, forgot that. Is it okay if I just put it here or do you need me
> > > to resend a v4?
> >
> > I think it should be a v4 so it looks right in patchwork.
> >
> > Also for this patch, can you please add documentation - see
> > source_file_format.txt
>
> I had submitted a patch for that file already last year but then got
> stuck in implementing just this, see commit fd15a9e2565f here:
> https://github.com/u-boot/u-boot/commit/fd15a9e2565f831bf95c2152d1966d068a642175#diff-8c4b5e332d50ba25248fd06d6b4eb026
>
> I don't know if this compression support needs anything more
> specific in that doc file. If anything, we could explicitly state that
> compression is now supported for all nodes, but then again, the
> file didn't tell that it was only supported for Kernels...

Now that gmail is fixed I can reply more easily...

Fair enough.

Compression for a DT node is a pain, since it must be decompressed
before being accessed and even reading the compatible string is hard.
This is the purpose of one of Julius' patches.

The DT format is fairly well documented and I would like to keep it
that way, as well as extend the tests as we add new functions.

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


[U-Boot] [BUG] dm_extended_scan_fdt()

2019-05-14 Thread AKASHI Takahiro
This function, dm_extended_scan_fdt(), takes an argument, blob,
but never uses it, instead uses gd->fdt_blob directly.

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


Re: [U-Boot] [PATCH v4 0/8] pico-imx7d: Add support for BL33 case

2019-05-14 Thread Jun Nie
Fabio,

Any comments on this version?

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


[U-Boot] [PATCH 09/21] tools: dtoc: Open all binary files in binary mode

2019-05-14 Thread Simon Glass
Fix an open() statement to use binary mode, so that it works as expected
with Python 3.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 9ad72f89ec..031b3a0084 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -469,7 +469,7 @@ class Fdt:
 if self._fname:
 self._fname = fdt_util.EnsureCompiled(self._fname)
 
-with open(self._fname) as fd:
+with open(self._fname, 'rb') as fd:
 self._fdt_obj = libfdt.Fdt(fd.read())
 
 @staticmethod
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 21/21] patman: Don't require Python 2

2019-05-14 Thread Simon Glass
Update the shebang to allow either Python 2 or Python 3.

Signed-off-by: Simon Glass 
---

 tools/patman/patman.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/patman/patman.py b/tools/patman/patman.py
index 27a2febf70..9605a36eff 100755
--- a/tools/patman/patman.py
+++ b/tools/patman/patman.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 # SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (c) 2011 The Chromium OS Authors.
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 19/21] patman: Adjust functional tests for Python 3

2019-05-14 Thread Simon Glass
Change the code so that it works on both Python 2 and Python 3. This works
by using unicode instead of latin1 for the test input, and ensuring that
the output is converted to a string rather than a unicode object on
Python 2.

Signed-off-by: Simon Glass 
---

 tools/patman/func_test.py | 25 ++---
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index f7d5ad68f6..50a2741439 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -129,10 +129,10 @@ class TestFunctional(unittest.TestCase):
 """
 process_tags = True
 ignore_bad_tags = True
-stefan = u'Stefan Brüns '
+stefan = b'Stefan Br\xc3\xbcns 
'.decode('utf-8')
 rick = 'Richard III '
-mel = u'Lord Mëlchett '
-ed = u'Lond Edmund Blackaddër '.decode('utf-8')
+ed = b'Lond Edmund Blackadd\xc3\xabr 
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 18/21] patman: Avoid unicode type in settings unit tests

2019-05-14 Thread Simon Glass
The unicode type does not exist in Python 3 and when displaying strings
they do not have the 'u' prefix. Adjusts the settings unit tests to deal
with this difference, by converting the comparison value to a string, thus
dropping the 'u'.

Signed-off-by: Simon Glass 
---

 tools/patman/settings.py | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index b080136d88..c98911d522 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -58,26 +58,26 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 # Check to make sure that bogus project gets general alias.
 >>> config = _ProjectConfigParser("zzz")
 >>> config.readfp(StringIO(sample_config))
->>> config.get("alias", "enemies")
-u'Evil '
+>>> str(config.get("alias", "enemies"))
+'Evil '
 
 # Check to make sure that alias gets overridden by project.
 >>> config = _ProjectConfigParser("sm")
 >>> config.readfp(StringIO(sample_config))
->>> config.get("alias", "enemies")
-u'Green G. '
+>>> str(config.get("alias", "enemies"))
+'Green G. '
 
 # Check to make sure that settings get merged with project.
 >>> config = _ProjectConfigParser("linux")
 >>> config.readfp(StringIO(sample_config))
->>> sorted(config.items("settings"))
-[(u'am_hero', u'True'), (u'process_tags', u'False')]
+>>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
+[('am_hero', 'True'), ('process_tags', 'False')]
 
 # Check to make sure that settings works with unknown project.
 >>> config = _ProjectConfigParser("unknown")
 >>> config.readfp(StringIO(sample_config))
->>> sorted(config.items("settings"))
-[(u'am_hero', u'True')]
+>>> sorted((str(a), str(b)) for (a, b) in config.items("settings"))
+[('am_hero', 'True')]
 """
 def __init__(self, project_name):
 """Construct _ProjectConfigParser.
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 17/21] patman: Sort series output for repeatabily

2019-05-14 Thread Simon Glass
We use sets to produce the list of To and Cc lines for a series. This does
not result in stable ordering of the recipients. Sort each list to ensure
that the output is repeatable. This is necessary for tests.

Signed-off-by: Simon Glass 
---

 tools/patman/func_test.py | 12 ++--
 tools/patman/series.py| 12 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 2c4392dbc1..f7d5ad68f6 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -183,10 +183,10 @@ class TestFunctional(unittest.TestCase):
 self.assertEqual('Prefix:\t  RFC', lines[line + 3])
 self.assertEqual('Cover: 4 lines', lines[line + 4])
 line += 5
-self.assertEqual('  Cc:  %s' % mel.encode('utf-8'), lines[line + 
0])
-self.assertEqual('  Cc:  %s' % rick, lines[line + 1])
-self.assertEqual('  Cc:  %s' % fred, lines[line + 2])
-self.assertEqual('  Cc:  %s' % ed.encode('utf-8'), lines[line + 3])
+self.assertEqual('  Cc:  %s' % fred, lines[line + 0])
+self.assertEqual('  Cc:  %s' % ed.encode('utf-8'), lines[line + 1])
+self.assertEqual('  Cc:  %s' % mel.encode('utf-8'), lines[line + 
2])
+self.assertEqual('  Cc:  %s' % rick, lines[line + 3])
 expected = ('Git command: git send-email --annotate '
 '--in-reply-to="%s" --to "u-boot@lists.denx.de" '
 '--cc "%s" --cc-cmd "%s --cc-cmd %s" %s %s'
@@ -197,8 +197,8 @@ class TestFunctional(unittest.TestCase):
 
 self.assertEqual(('%s %s, %s' % (args[0], rick, stefan))
  .encode('utf-8'), cc_lines[0])
-self.assertEqual(('%s %s, %s, %s, %s' % (args[1], fred, rick, stefan,
-ed)).encode('utf-8'), cc_lines[1])
+self.assertEqual(('%s %s, %s, %s, %s' % (args[1], fred, ed, rick,
+ stefan)).encode('utf-8'), cc_lines[1])
 
 expected = '''
 This is a test of how the cover
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 0b71a896cb..bbb30d849e 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -115,16 +115,16 @@ class Series(dict):
 commit = self.commits[upto]
 print(col.Color(col.GREEN, '   %s' % args[upto]))
 cc_list = list(self._generated_cc[commit.patch])
-for email in set(cc_list) - to_set - cc_set:
+for email in sorted(set(cc_list) - to_set - cc_set):
 if email == None:
 email = col.Color(col.YELLOW, ""
 % tag)
 if email:
 print('  Cc: ', email)
 print
-for item in to_set:
+for item in sorted(to_set):
 print('To:\t ', item)
-for item in cc_set - to_set:
+for item in sorted(cc_set - to_set):
 print('Cc:\t ', item)
 print('Version: ', self.get('version'))
 print('Prefix:\t ', self.get('prefix'))
@@ -132,7 +132,7 @@ class Series(dict):
 print('Cover: %d lines' % len(self.cover))
 cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
 all_ccs = itertools.chain(cover_cc, *self._generated_cc.values())
-for email in set(all_ccs) - to_set - cc_set:
+for email in sorted(set(all_ccs) - to_set - cc_set):
 print('  Cc: ', email)
 if cmd:
 print('Git command: %s' % cmd)
@@ -243,7 +243,7 @@ class Series(dict):
 if limit is not None:
 cc = cc[:limit]
 all_ccs += cc
-print(commit.patch, ', '.join(set(cc)), file=fd)
+print(commit.patch, ', '.join(sorted(set(cc))), file=fd)
 self._generated_cc[commit.patch] = cc
 
 if cover_fname:
@@ -251,7 +251,7 @@ class Series(dict):
 cover_cc = [m.encode('utf-8') if type(m) != str else m
 for m in cover_cc]
 cc_list = ', '.join([tools.ToUnicode(x)
- for x in set(cover_cc + all_ccs)])
+ for x in sorted(set(cover_cc + all_ccs))])
 print(cover_fname, cc_list.encode('utf-8'), file=fd)
 
 fd.close()
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 02/21] patman: Convert print statements to Python 3

2019-05-14 Thread Simon Glass
Update all print statements to be functions, as required by Python 3.

Signed-off-by: Simon Glass 
---

 tools/patman/func_test.py |  3 ---
 tools/patman/gitutil.py   | 10 +-
 tools/patman/test_util.py | 16 +---
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index d79e716074..31481157fc 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -159,7 +159,6 @@ class TestFunctional(unittest.TestCase):
 os.remove(cc_file)
 
 lines = out[0].splitlines()
-#print '\n'.join(lines)
 self.assertEqual('Cleaned %s patches' % len(series.commits), lines[0])
 self.assertEqual('Change log missing for v2', lines[1])
 self.assertEqual('Change log missing for v3', lines[2])
@@ -223,7 +222,6 @@ Simon Glass (2):
 
 '''
 lines = open(cover_fname).read().splitlines()
-#print '\n'.join(lines)
 self.assertEqual(
 'Subject: [RFC PATCH v3 0/2] test: A test patch series',
 lines[3])
@@ -231,7 +229,6 @@ Simon Glass (2):
 
 for i, fname in enumerate(args):
 lines = open(fname).read().splitlines()
-#print '\n'.join(lines)
 subject = [line for line in lines if line.startswith('Subject')]
 self.assertEqual('Subject: [RFC %d/%d]' % (i + 1, count),
  subject[0][:18])
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 7650b51bd5..11aeb73b74 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -397,11 +397,11 @@ def EmailPatches(series, cover_fname, args, dry_run, 
raise_on_error, cc_fname,
 git_config_to = command.Output('git', 'config', 'sendemail.to',
raise_on_error=False)
 if not git_config_to:
-print ("No recipient.\n"
-   "Please add something like this to a commit\n"
-   "Series-to: Fred Bloggs \n"
-   "Or do something like this\n"
-   "git config sendemail.to u-boot@lists.denx.de")
+print("No recipient.\n"
+  "Please add something like this to a commit\n"
+  "Series-to: Fred Bloggs \n"
+  "Or do something like this\n"
+  "git config sendemail.to u-boot@lists.denx.de")
 return
 cc = BuildEmailList(list(set(series.get('cc')) - set(series.get('to'))),
 '--cc', alias, raise_on_error)
diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py
index 687d40704a..e462ec8f72 100644
--- a/tools/patman/test_util.py
+++ b/tools/patman/test_util.py
@@ -3,6 +3,8 @@
 # Copyright (c) 2016 Google, Inc
 #
 
+from __future__ import print_function
+
 from contextlib import contextmanager
 import glob
 import os
@@ -54,18 +56,18 @@ def RunTestCoverage(prog, filter_fname, exclude_list, 
build_dir, required=None):
 missing_list = required
 missing_list.difference_update(test_set)
 if missing_list:
-print 'Missing tests for %s' % (', '.join(missing_list))
-print stdout
+print('Missing tests for %s' % (', '.join(missing_list)))
+print(stdout)
 ok = False
 
 coverage = lines[-1].split(' ')[-1]
 ok = True
-print coverage
+print(coverage)
 if coverage != '100%':
-print stdout
-print ("Type 'python-coverage html' to get a report in "
-   'htmlcov/index.html')
-print 'Coverage error: %s, but should be 100%%' % coverage
+print(stdout)
+print("Type 'python-coverage html' to get a report in "
+  'htmlcov/index.html')
+print('Coverage error: %s, but should be 100%%' % coverage)
 ok = False
 if not ok:
 raise ValueError('Test coverage failure')
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 12/21] binman: Drop an unused input file

2019-05-14 Thread Simon Glass
Drop this line which is not used or needed.

Signed-off-by: Simon Glass 
---

 tools/binman/ftest.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 4d96933cb4..e1fc9e8e9e 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -291,7 +291,6 @@ class TestFunctional(unittest.TestCase):
 # Use the compiled test file as the u-boot-dtb input
 if use_real_dtb:
 dtb_data = self._SetupDtb(fname)
-infile = os.path.join(self._indir, 'u-boot.dtb')
 
 # For testing purposes, make a copy of the DT for SPL and TPL. Add
 # a node indicating which it is, so aid verification.
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 10/21] patman: Provide a way to get program output in binary mode

2019-05-14 Thread Simon Glass
At present cros_subprocess and the tools library use a string to obtain
stdout from a program. This works fine on Python 2. With Python 3 we end
up with unicode errors in some cases. Fix this by providing a binary mode,
which returns the data as bytes() instead of a string.

Signed-off-by: Simon Glass 
---

 tools/patman/cros_subprocess.py | 15 +--
 tools/patman/tools.py   |  4 ++--
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/patman/cros_subprocess.py b/tools/patman/cros_subprocess.py
index 4de230ac63..39d4f21980 100644
--- a/tools/patman/cros_subprocess.py
+++ b/tools/patman/cros_subprocess.py
@@ -54,7 +54,7 @@ class Popen(subprocess.Popen):
 """
 
 def __init__(self, args, stdin=None, stdout=PIPE_PTY, stderr=PIPE_PTY,
- shell=False, cwd=None, env=None, **kwargs):
+ shell=False, cwd=None, env=None, binary=False, **kwargs):
 """Cut-down constructor
 
 Args:
@@ -72,6 +72,7 @@ class Popen(subprocess.Popen):
 """
 stdout_pty = None
 stderr_pty = None
+self.binary = binary
 
 if stdout == PIPE_PTY:
 stdout_pty = pty.openpty()
@@ -107,15 +108,17 @@ class Popen(subprocess.Popen):
 data: Data to convert, or None for ''
 
 Returns:
-Converted data to a unicode string
+Converted data, normally as a unicode string, but this uses bytes
+in binary mode
 """
 if data is None:
 return ''
 else:
-try:
-data = data.decode('utf-8')
-except UnicodeDecodeError:
-data = data.decode('utf-8', 'ignore')
+if not self.binary:
+try:
+data = data.decode('utf-8')
+except UnicodeDecodeError:
+data = data.decode('utf-8', 'ignore')
 return data
 
 def CommunicateFilter(self, output):
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index bf099798e6..1df8f2ecd2 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -167,9 +167,9 @@ def PathHasFile(fname):
 return True
 return False
 
-def Run(name, *args):
+def Run(name, *args, **kwargs):
 try:
-return command.Run(name, *args, cwd=outdir, capture=True)
+return command.Run(name, *args, cwd=outdir, capture=True, **kwargs)
 except:
 if not PathHasFile(name):
 msg = "Plesae install tool '%s'" % name
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 14/21] Add a simple script to remove boards

2019-05-14 Thread Simon Glass
This script attempts to create a git commit which removes a single board.
It is quite fallible and everything it does needs checking. But it can
help speed up the process.

Signed-off-by: Simon Glass 
---

 tools/rmboard.py | 150 +++
 1 file changed, 150 insertions(+)
 create mode 100755 tools/rmboard.py

diff --git a/tools/rmboard.py b/tools/rmboard.py
new file mode 100755
index 00..17952f795d
--- /dev/null
+++ b/tools/rmboard.py
@@ -0,0 +1,150 @@
+#! /usr/bin/python
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2019 Google LLC
+#
+
+"""
+Script to remove boards
+
+Usage:
+   rmboard.py ...
+
+A single commit is created for each board removed.
+
+Some boards may depend on files provided by another and this will cause
+problems, generally the removal of files which should not be removed.
+
+This script works by:
+- Looking through the MAINTAINERS files which mention a board to find out
+what files the board uses
+- Looking through the Kconfig files which mention a board to find one that
+needs to have material removed
+
+Search for ## to update the commit message manually.
+"""
+
+from __future__ import print_function
+
+import glob
+import os
+import re
+import sys
+
+# Bring in the patman libraries
+our_path = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(our_path, '../tools/patman'))
+
+import command
+
+def rm_kconfig_include(path):
+"""Remove a path from Kconfig files
+
+This function finds the given path in a 'source' statement in a Kconfig
+file and removes that line from the file. This is needed because the path
+is going to be removed, so any reference to it will cause a problem with
+Kconfig parsing.
+
+The changes are made locally and then added to the git staging area.
+
+Args:
+path: Path to search for and remove
+"""
+cmd = ['git', 'grep', path]
+stdout = command.RunPipe([cmd], capture=True, raise_on_error=False).stdout
+if not stdout:
+return
+fname = stdout.split(':')[0]
+
+print("Fixing up '%s' to remove reference to '%s'" % (fname, path))
+cmd = ['sed', '-i', '\|%s|d' % path, fname]
+stdout = command.RunPipe([cmd], capture=True).stdout
+
+cmd = ['git', 'add', fname]
+stdout = command.RunPipe([cmd], capture=True).stdout
+
+def rm_board(board):
+"""Create a commit which removes a single board
+
+This looks up the MAINTAINERS file to file files that need to be removed,
+then removes pieces from the Kconfig files that mention the board.
+
+
+Args:
+board: Board name to remove
+"""
+
+# Find all MAINTAINERS and Kconfig files which mention the board
+cmd = ['git', 'grep', '-l', board]
+stdout = command.RunPipe([cmd], capture=True).stdout
+maintain = []
+kconfig = []
+for line in stdout.splitlines():
+line = line.strip()
+if 'MAINTAINERS' in line:
+if line not in maintain:
+maintain.append(line)
+elif 'Kconfig' in line:
+kconfig.append(line)
+paths = []
+cc = []
+
+# Look through the MAINTAINERS file to find things to remove
+for fname in maintain:
+with open(fname) as fd:
+for line in fd:
+line = line.strip()
+fields = re.split('[ \t]', line, 1)
+if len(fields) == 2:
+if fields[0] == 'M:':
+cc.append(fields[1])
+elif fields[0] == 'F:':
+paths.append(fields[1].strip())
+
+# Expannd any wildcards in the MAINTAINRERS file
+real = []
+for path in paths:
+if path[-1] == '/':
+path = path[:-1]
+if '*' in path:
+globbed = glob.glob(path)
+print("Expanded '%s' to '%s'" % (path, globbed))
+real += globbed
+else:
+real.append(path)
+
+# Search for Kconfig files in the resulting list. Remove any 'source' lines
+# which reference Kconfig files we want to remove
+for path in real:
+cmd = ['find', path]
+stdout = (command.RunPipe([cmd], capture=True, raise_on_error=False).
+  stdout)
+for fname in stdout.splitlines():
+if fname.endswith('Kconfig'):
+rm_kconfig_include(fname)
+
+# Remove unwanted files
+cmd = ['git', 'rm', '-r'] + real
+stdout = command.RunPipe([cmd], capture=True).stdout
+
+## Change the messages as needed
+msg = '''arm: Remove %s board
+
+This board has not been converted to CONFIG_DM_MMC by the deadline.
+Remove it.
+
+''' % board
+for name in cc:
+msg += 'Patch-cc: %s\n' % name
+
+# Create the commit
+cmd = ['git', 'commit', '-s', '-m', msg]
+stdout = command.RunPipe([cmd], capture=True).stdout
+
+# Check if the board is mentioned anywhere else. The user will need to deal
+# with this
+cmd 

[U-Boot] [PATCH 07/21] binman: Use items() instead of iteritems()

2019-05-14 Thread Simon Glass
Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass 
---

 tools/binman/bsection.py  | 2 +-
 tools/binman/control.py   | 2 +-
 tools/binman/elf.py   | 4 ++--
 tools/binman/etype/gbb.py | 2 +-
 tools/binman/ftest.py | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index be67ff957e..3ca0592fe1 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -253,7 +253,7 @@ class Section(object):
 """
 for entry in self._entries.values():
 offset_dict = entry.GetOffsets()
-for name, info in offset_dict.iteritems():
+for name, info in offset_dict.items():
 self._SetEntryOffsetSize(name, *info)
 
 def PackEntries(self):
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 8f7f906860..ce25eb5485 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -131,7 +131,7 @@ def Binman(options, args):
 
 if options.image:
 skip = []
-for name, image in images.iteritems():
+for name, image in images.items():
 if name not in options.image:
 del images[name]
 skip.append(name)
diff --git a/tools/binman/elf.py b/tools/binman/elf.py
index 97df8e32c5..828681d76d 100644
--- a/tools/binman/elf.py
+++ b/tools/binman/elf.py
@@ -59,7 +59,7 @@ def GetSymbols(fname, patterns):
 flags[1] == 'w')
 
 # Sort dict by address
-return OrderedDict(sorted(syms.iteritems(), key=lambda x: x[1].address))
+return OrderedDict(sorted(syms.items(), key=lambda x: x[1].address))
 
 def GetSymbolAddress(fname, sym_name):
 """Get a value of a symbol from an ELF file
@@ -98,7 +98,7 @@ def LookupAndWriteSymbols(elf_fname, entry, section):
 base = syms.get('__image_copy_start')
 if not base:
 return
-for name, sym in syms.iteritems():
+for name, sym in syms.items():
 if name.startswith('_binman'):
 msg = ("Section '%s': Symbol '%s'\n   in entry '%s'" %
(section.GetPath(), name, entry.GetPath()))
diff --git a/tools/binman/etype/gbb.py b/tools/binman/etype/gbb.py
index 8fe10f4713..a94c0fca9d 100644
--- a/tools/binman/etype/gbb.py
+++ b/tools/binman/etype/gbb.py
@@ -64,7 +64,7 @@ class Entry_gbb(Entry):
 self.gbb_flags = 0
 flags_node = node.FindNode('flags')
 if flags_node:
-for flag, value in gbb_flag_properties.iteritems():
+for flag, value in gbb_flag_properties.items():
 if fdt_util.GetBool(flags_node, flag):
 self.gbb_flags |= value
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index daea1ea138..7cf17526a7 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -214,7 +214,7 @@ class TestFunctional(unittest.TestCase):
 if verbosity is not None:
 args.append('-v%d' % verbosity)
 if entry_args:
-for arg, value in entry_args.iteritems():
+for arg, value in entry_args.items():
 args.append('-a%s=%s' % (arg, value))
 if images:
 for image in images:
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 11/21] binman: Use binary mode when compressing data

2019-05-14 Thread Simon Glass
The lz4 utility inserts binary data in its output which cannot always be
converted to unicode (nor should it be). Fix this by using the new binary
mode for program output.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/blob.py | 2 +-
 tools/binman/ftest.py  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index ae80bbee53..f56a1f8768 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -60,7 +60,7 @@ class Entry_blob(Entry):
 except AttributeError:
 data = lz4.compress(data)
 '''
-data = tools.Run('lz4', '-c', self._pathname)
+data = tools.Run('lz4', '-c', self._pathname, binary=True)
 self.SetContents(data)
 return True
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 852a40..4d96933cb4 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1557,7 +1557,7 @@ class TestFunctional(unittest.TestCase):
 out = os.path.join(self._indir, 'lz4.tmp')
 with open(out, 'wb') as fd:
 fd.write(data)
-return tools.Run('lz4', '-dc', out)
+return tools.Run('lz4', '-dc', out, binary=True)
 '''
 try:
 orig = lz4.frame.decompress(data)
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 03/21] binman: Convert print statements to Python 3

2019-05-14 Thread Simon Glass
Update all print statements to be functions, as required by Python 3.

Signed-off-by: Simon Glass 
---

 tools/binman/binman.py  | 14 --
 tools/binman/control.py |  6 --
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/tools/binman/binman.py b/tools/binman/binman.py
index 439908e665..4206d2b0e3 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/binman.py
@@ -9,6 +9,8 @@
 
 """See README for more information"""
 
+from __future__ import print_function
+
 import glob
 import multiprocessing
 import os
@@ -85,13 +87,13 @@ def RunTests(debug, processes, args):
 else:
 suite.run(result)
 
-print result
+print(result)
 for test, err in result.errors:
-print test.id(), err
+print(test.id(), err)
 for test, err in result.failures:
-print err, result.failures
+print(err, result.failures)
 if result.errors or result.failures:
-  print 'binman tests FAILED'
+  print('binman tests FAILED')
   return 1
 return 0
 
@@ -143,9 +145,9 @@ def RunBinman(options, args):
 try:
 ret_code = control.Binman(options, args)
 except Exception as e:
-print 'binman: %s' % e
+print('binman: %s' % e)
 if options.debug:
-print
+print()
 traceback.print_exc()
 ret_code = 1
 return ret_code
diff --git a/tools/binman/control.py b/tools/binman/control.py
index b32e4e1996..8f7f906860 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -5,6 +5,8 @@
 # Creates binary images from input files controlled by a description
 #
 
+from __future__ import print_function
+
 from collections import OrderedDict
 import os
 import sys
@@ -134,7 +136,7 @@ def Binman(options, args):
 del images[name]
 skip.append(name)
 if skip and options.verbosity >= 2:
-print 'Skipping images: %s' % ', '.join(skip)
+print('Skipping images: %s' % ', '.join(skip))
 
 state.Prepare(images, dtb)
 
@@ -170,7 +172,7 @@ def Binman(options, args):
 except Exception as e:
 if options.map:
 fname = image.WriteMap()
-print "Wrote map file '%s' to show errors"  % fname
+print("Wrote map file '%s' to show errors"  % fname)
 raise
 image.SetImagePos()
 if options.update_fdt:
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 16/21] patman: Move unicode helpers to tools

2019-05-14 Thread Simon Glass
Create helper functions in the tools module to deal with the differences
between unicode in Python 2 (where we use the 'unicode' type) and Python 3
(where we use the 'str' type).

Signed-off-by: Simon Glass 
---

 tools/patman/gitutil.py  |  4 ++--
 tools/patman/series.py   |  3 ++-
 tools/patman/settings.py | 16 +++-
 tools/patman/tools.py| 32 
 4 files changed, 39 insertions(+), 16 deletions(-)

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 11aeb73b74..fb9e67c0f0 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -12,6 +12,7 @@ import terminal
 
 import checkpatch
 import settings
+import tools
 
 # True to use --no-decorate - we check this in Setup()
 use_no_decorate = True
@@ -325,9 +326,8 @@ def BuildEmailList(in_list, tag=None, alias=None, 
raise_on_error=True):
 raw += LookupEmail(item, alias, raise_on_error=raise_on_error)
 result = []
 for item in raw:
+item = tools.FromUnicode(item)
 if not item in result:
-if type(item) == unicode:
-item = item.encode('utf-8')
 result.append(item)
 if tag:
 return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 2735afaf88..0b71a896cb 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -11,6 +11,7 @@ import get_maintainer
 import gitutil
 import settings
 import terminal
+import tools
 
 # Series-xxx tags that we understand
 valid_series = ['to', 'cc', 'version', 'changes', 'prefix', 'notes', 'name',
@@ -249,7 +250,7 @@ class Series(dict):
 cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
 cover_cc = [m.encode('utf-8') if type(m) != str else m
 for m in cover_cc]
-cc_list = ', '.join([x.decode('utf-8')
+cc_list = ', '.join([tools.ToUnicode(x)
  for x in set(cover_cc + all_ccs)])
 print(cover_fname, cc_list.encode('utf-8'), file=fd)
 
diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 07bf6a6ea4..b080136d88 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -14,6 +14,7 @@ import re
 
 import command
 import gitutil
+import tools
 
 """Default settings per-project.
 
@@ -99,17 +100,6 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 for setting_name, setting_value in project_defaults.items():
 self.set(project_settings, setting_name, setting_value)
 
-def _to_unicode(self, val):
-"""Make sure a value is of type 'unicode'
-
-Args:
-val: string or unicode object
-
-Returns:
-unicode version of val
-"""
-return val if isinstance(val, unicode) else val.decode('utf-8')
-
 def get(self, section, option, *args, **kwargs):
 """Extend SafeConfigParser to try project_section before section.
 
@@ -127,7 +117,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 val = ConfigParser.SafeConfigParser.get(
 self, section, option, *args, **kwargs
 )
-return self._to_unicode(val)
+return tools.ToUnicode(val)
 
 def items(self, section, *args, **kwargs):
 """Extend SafeConfigParser to add project_section to section.
@@ -162,7 +152,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 
 item_dict = dict(top_items)
 item_dict.update(project_items)
-return {(self._to_unicode(item), self._to_unicode(val))
+return {(tools.ToUnicode(item), tools.ToUnicode(val))
 for item, val in item_dict.items()}
 
 def ReadGitAliases(fname):
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 0ad0fb9705..7e6a45a3b0 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -258,3 +258,35 @@ def GetBytes(byte, size):
 else:
 data = chr(byte) * size
 return data
+
+def ToUnicode(val):
+"""Make sure a value is a unicode string
+
+This allows some amount of compatibility between Python 2 and Python3. For
+the former, it returns a unicode object.
+
+Args:
+val: string or unicode object
+
+Returns:
+unicode version of val
+"""
+if sys.version_info[0] >= 3:
+return val
+return val if isinstance(val, unicode) else val.decode('utf-8')
+
+def FromUnicode(val):
+"""Make sure a value is a non-unicode string
+
+This allows some amount of compatibility between Python 2 and Python3. For
+the former, it converts a unicode object to a string.
+
+Args:
+val: string or unicode object
+
+Returns:
+non-unicode version of val
+"""
+if sys.version_info[0] >= 3:
+return val
+return val if isinstance(val, str) else val.encode('utf-8')
-- 
2.21.0.1020.gf2820cf01a-goog

__

[U-Boot] [PATCH 15/21] patman: Support use of stringIO in Python 3

2019-05-14 Thread Simon Glass
With Python 3 this class has moved. Update the code to handle both cases.

Signed-off-by: Simon Glass 
---

 tools/patman/func_test.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 31481157fc..2c4392dbc1 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -12,15 +12,20 @@ import sys
 import tempfile
 import unittest
 
+try:
+from StringIO import StringIO
+except ImportError:
+from io import StringIO
+
 import gitutil
 import patchstream
 import settings
+import tools
 
 
 @contextlib.contextmanager
 def capture():
 import sys
-from cStringIO import StringIO
 oldout,olderr = sys.stdout, sys.stderr
 try:
 out=[StringIO(), StringIO()]
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 13/21] binman: Handle repeated bytes for Python 3

2019-05-14 Thread Simon Glass
The method of multiplying a character by a number works well for creating
a repeated string in Python 2. But in Python 3 we need to use bytes()
instead, to avoid unicode problems, since 'bytes' is no-longer just an
alias of 'str'.

Create a function to handle this detail and call it from the relevant
places in binman.

Signed-off-by: Simon Glass 
---

 tools/binman/bsection.py |  2 +-
 tools/binman/elf_test.py |  2 +-
 tools/binman/etype/fill.py   |  4 +--
 tools/binman/etype/u_boot_spl_bss_pad.py |  2 +-
 tools/binman/ftest.py| 46 +---
 tools/patman/tools.py| 19 ++
 6 files changed, 50 insertions(+), 25 deletions(-)

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 3ca0592fe1..03dfa2f805 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -332,7 +332,7 @@ class Section(object):
 
 def GetData(self):
 """Get the contents of the section"""
-section_data = chr(self._pad_byte) * self._size
+section_data = tools.GetBytes(self._pad_byte, self._size)
 
 for entry in self._entries.values():
 data = entry.GetData()
diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py
index b68530c19b..3d55cb1946 100644
--- a/tools/binman/elf_test.py
+++ b/tools/binman/elf_test.py
@@ -122,7 +122,7 @@ class TestElf(unittest.TestCase):
 section = FakeSection(sym_value=None)
 elf_fname = os.path.join(binman_dir, 'test', 'u_boot_binman_syms')
 syms = elf.LookupAndWriteSymbols(elf_fname, entry, section)
-self.assertEqual(chr(255) * 16 + 'a' * 4, entry.data)
+self.assertEqual(tools.GetBytes(255, 16) + 'a' * 4, entry.data)
 
 def testDebug(self):
 """Check that enabling debug in the elf module produced debug output"""
diff --git a/tools/binman/etype/fill.py b/tools/binman/etype/fill.py
index dcfe978a5b..68efe42ec0 100644
--- a/tools/binman/etype/fill.py
+++ b/tools/binman/etype/fill.py
@@ -5,7 +5,7 @@
 
 from entry import Entry
 import fdt_util
-
+import tools
 
 class Entry_fill(Entry):
 """An entry which is filled to a particular byte value
@@ -28,5 +28,5 @@ class Entry_fill(Entry):
 self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
 
 def ObtainContents(self):
-self.SetContents(chr(self.fill_value) * self.size)
+self.SetContents(tools.GetBytes(self.fill_value, self.size))
 return True
diff --git a/tools/binman/etype/u_boot_spl_bss_pad.py 
b/tools/binman/etype/u_boot_spl_bss_pad.py
index 00b7ac5004..66a296a6f8 100644
--- a/tools/binman/etype/u_boot_spl_bss_pad.py
+++ b/tools/binman/etype/u_boot_spl_bss_pad.py
@@ -38,5 +38,5 @@ class Entry_u_boot_spl_bss_pad(Entry_blob):
 bss_size = elf.GetSymbolAddress(fname, '__bss_size')
 if not bss_size:
 self.Raise('Expected __bss_size symbol in spl/u-boot-spl')
-self.SetContents(chr(0) * bss_size)
+self.SetContents(tools.GetBytes(0, bss_size))
 return True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index e1fc9e8e9e..971fade343 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -551,8 +551,8 @@ class TestFunctional(unittest.TestCase):
 with open(fname, 'rb') as fd:
 data = fd.read()
 self.assertEqual(U_BOOT_DATA, data[3:7])
-self.assertEqual(chr(0) * 3, data[:3])
-self.assertEqual(chr(0) * 5, data[7:])
+self.assertEqual(tools.GetBytes(0, 3), data[:3])
+self.assertEqual(tools.GetBytes(0, 5), data[7:])
 
 def testBadAlign(self):
 """Test that an invalid alignment value is detected"""
@@ -731,7 +731,8 @@ class TestFunctional(unittest.TestCase):
 """Test that the image pad byte can be specified"""
 self._SetupSplElf()
 data = self._DoReadFile('021_image_pad.dts')
-self.assertEqual(U_BOOT_SPL_DATA + (chr(0xff) * 1) + U_BOOT_DATA, data)
+self.assertEqual(U_BOOT_SPL_DATA + tools.GetBytes(0xff, 1) +
+ U_BOOT_DATA, data)
 
 def testImageName(self):
 """Test that image files can be named"""
@@ -754,8 +755,8 @@ class TestFunctional(unittest.TestCase):
 """Test that entries can be sorted"""
 self._SetupSplElf()
 data = self._DoReadFile('024_sorted.dts')
-self.assertEqual(chr(0) * 1 + U_BOOT_SPL_DATA + chr(0) * 2 +
- U_BOOT_DATA, data)
+self.assertEqual(tools.GetBytes(0, 1) + U_BOOT_SPL_DATA +
+ tools.GetBytes(0, 2) + U_BOOT_DATA, data)
 
 def testPackZeroOffset(self):
 """Test that an entry at offset 0 is not given a new offset"""
@@ -797,8 +798,8 @@ class TestFunctional(unittest.TestCase):
 """Test that a basic x86 ROM can be created"""
 self._SetupSplElf()
 data = self._DoReadFile('029_x86-rom.dts')
-self.assertEqual(U_B

[U-Boot] [PATCH 20/21] patman: Tidy up a few more unicode conversions

2019-05-14 Thread Simon Glass
Use the new functions in the tools module to handle conversion.

Signed-off-by: Simon Glass 
---

 tools/patman/gitutil.py | 4 +---
 tools/patman/series.py  | 5 ++---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index fb9e67c0f0..dce7fa25b6 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -412,9 +412,7 @@ def EmailPatches(series, cover_fname, args, dry_run, 
raise_on_error, cc_fname,
 if smtp_server:
 cmd.append('--smtp-server=%s' % smtp_server)
 if in_reply_to:
-if type(in_reply_to) != str:
-in_reply_to = in_reply_to.encode('utf-8')
-cmd.append('--in-reply-to="%s"' % in_reply_to)
+cmd.append('--in-reply-to="%s"' % tools.FromUnicode(in_reply_to))
 if thread:
 cmd.append('--thread')
 
diff --git a/tools/patman/series.py b/tools/patman/series.py
index bbb30d849e..67103f03e6 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -239,7 +239,7 @@ class Series(dict):
 for x in set(cc) & set(settings.bounces):
 print(col.Color(col.YELLOW, 'Skipping "%s"' % x))
 cc = set(cc) - set(settings.bounces)
-cc = [m.encode('utf-8') if type(m) != str else m for m in cc]
+cc = [tools.FromUnicode(m) for m in cc]
 if limit is not None:
 cc = cc[:limit]
 all_ccs += cc
@@ -248,8 +248,7 @@ class Series(dict):
 
 if cover_fname:
 cover_cc = gitutil.BuildEmailList(self.get('cover_cc', ''))
-cover_cc = [m.encode('utf-8') if type(m) != str else m
-for m in cover_cc]
+cover_cc = [tools.FromUnicode(m) for m in cover_cc]
 cc_list = ', '.join([tools.ToUnicode(x)
  for x in sorted(set(cover_cc + all_ccs))])
 print(cover_fname, cc_list.encode('utf-8'), file=fd)
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 08/21] tools: binman: Open all binary files in binary mode

2019-05-14 Thread Simon Glass
At present some files are opened in text mode despite containing binary
data. This works on Python 2 but not always on Python 3, due to unicode
problems. BC&D are not my favourite people. Adjust the affected open()
statements to use binary mode.

Signed-off-by: Simon Glass 

---

 tools/binman/ftest.py | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 7cf17526a7..852a40 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -119,11 +119,11 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('refcode.bin', REFCODE_DATA)
 
 # ELF file with a '_dt_ucode_base_size' symbol
-with open(self.TestFile('u_boot_ucode_ptr')) as fd:
+with open(self.TestFile('u_boot_ucode_ptr'), 'rb') as fd:
 TestFunctional._MakeInputFile('u-boot', fd.read())
 
 # Intel flash descriptor file
-with open(self.TestFile('descriptor.bin')) as fd:
+with open(self.TestFile('descriptor.bin'), 'rb') as fd:
 TestFunctional._MakeInputFile('descriptor.bin', fd.read())
 
 shutil.copytree(self.TestFile('files'),
@@ -236,7 +236,7 @@ class TestFunctional(unittest.TestCase):
 """
 tools.PrepareOutputDir(None)
 dtb = fdt_util.EnsureCompiled(self.TestFile(fname))
-with open(dtb) as fd:
+with open(dtb, 'rb') as fd:
 data = fd.read()
 TestFunctional._MakeInputFile(outfile, data)
 tools.FinaliseOutputDir()
@@ -317,7 +317,7 @@ class TestFunctional(unittest.TestCase):
 map_data = fd.read()
 else:
 map_data = None
-with open(image_fname) as fd:
+with open(image_fname, 'rb') as fd:
 return fd.read(), dtb_data, map_data, out_dtb_fname
 finally:
 # Put the test file back
@@ -379,7 +379,7 @@ class TestFunctional(unittest.TestCase):
 Args:
 Filename of ELF file to use as SPL
 """
-with open(self.TestFile(src_fname)) as fd:
+with open(self.TestFile(src_fname), 'rb') as fd:
 TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read())
 
 @classmethod
@@ -541,7 +541,7 @@ class TestFunctional(unittest.TestCase):
 self.assertEqual(len(U_BOOT_DATA), image._size)
 fname = tools.GetOutputFilename('image1.bin')
 self.assertTrue(os.path.exists(fname))
-with open(fname) as fd:
+with open(fname, 'rb') as fd:
 data = fd.read()
 self.assertEqual(U_BOOT_DATA, data)
 
@@ -549,7 +549,7 @@ class TestFunctional(unittest.TestCase):
 self.assertEqual(3 + len(U_BOOT_DATA) + 5, image._size)
 fname = tools.GetOutputFilename('image2.bin')
 self.assertTrue(os.path.exists(fname))
-with open(fname) as fd:
+with open(fname, 'rb') as fd:
 data = fd.read()
 self.assertEqual(U_BOOT_DATA, data[3:7])
 self.assertEqual(chr(0) * 3, data[:3])
@@ -970,7 +970,7 @@ class TestFunctional(unittest.TestCase):
 """Test that a U-Boot binary without the microcode symbol is 
detected"""
 # ELF file without a '_dt_ucode_base_size' symbol
 try:
-with open(self.TestFile('u_boot_no_ucode_ptr')) as fd:
+with open(self.TestFile('u_boot_no_ucode_ptr'), 'rb') as fd:
 TestFunctional._MakeInputFile('u-boot', fd.read())
 
 with self.assertRaises(ValueError) as e:
@@ -980,7 +980,7 @@ class TestFunctional(unittest.TestCase):
 
 finally:
 # Put the original file back
-with open(self.TestFile('u_boot_ucode_ptr')) as fd:
+with open(self.TestFile('u_boot_ucode_ptr'), 'rb') as fd:
 TestFunctional._MakeInputFile('u-boot', fd.read())
 
 def testMicrocodeNotInImage(self):
@@ -993,7 +993,7 @@ class TestFunctional(unittest.TestCase):
 
 def testWithoutMicrocode(self):
 """Test that we can cope with an image without microcode (e.g. qemu)"""
-with open(self.TestFile('u_boot_no_ucode_ptr')) as fd:
+with open(self.TestFile('u_boot_no_ucode_ptr'), 'rb') as fd:
 TestFunctional._MakeInputFile('u-boot', fd.read())
 data, dtb, _, _ = self._DoReadFileDtb('044_x86_optional_ucode.dts', 
True)
 
@@ -1357,7 +1357,7 @@ class TestFunctional(unittest.TestCase):
 fname = pipe_list[0][-1]
 # Append our GBB data to the file, which will happen every time the
 # futility command is called.
-with open(fname, 'a') as fd:
+with open(fname, 'ab') as fd:
 fd.write(GBB_DATA)
 return command.CommandResult()
 
@@ -1431,7 +1431,7 @@ class TestFunctional(unittest.TestCase):
 def testTpl(self):
 """Test that an image with TPL and ots device tree can be created"""
 # ELF file with a 

[U-Boot] [PATCH 05/21] binman: Remove use of Set()

2019-05-14 Thread Simon Glass
A new built-in set() is used in both Python 2 and 3 now. Move it to use
that instead of Set().

Signed-off-by: Simon Glass 
---

 tools/binman/bsection.py | 3 +--
 tools/binman/entry.py| 5 ++---
 tools/binman/state.py| 7 +++
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 0ba542ee98..be67ff957e 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -8,7 +8,6 @@
 from __future__ import print_function
 
 from collections import OrderedDict
-from sets import Set
 import sys
 
 import fdt_util
@@ -109,7 +108,7 @@ class Section(object):
 
 def GetFdtSet(self):
 """Get the set of device tree files used by this image"""
-fdt_set = Set()
+fdt_set = set()
 for entry in self._entries.values():
 fdt_set.update(entry.GetFdtSet())
 return fdt_set
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 648cfd241f..d842d89dd6 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -18,7 +18,6 @@ except:
 have_importlib = False
 
 import os
-from sets import Set
 import sys
 
 import fdt_util
@@ -178,8 +177,8 @@ class Entry(object):
 # It would be better to use isinstance(self, Entry_blob_dtb) here but
 # we cannot access Entry_blob_dtb
 if fname and fname.endswith('.dtb'):
-return Set([fname])
-return Set()
+return set([fname])
+return set()
 
 def ExpandEntries(self):
 pass
diff --git a/tools/binman/state.py b/tools/binman/state.py
index d945e4bf65..af9678649c 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -7,7 +7,6 @@
 
 import hashlib
 import re
-from sets import Set
 
 import os
 import tools
@@ -24,10 +23,10 @@ entry_args = {}
 use_fake_dtb = False
 
 # Set of all device tree files references by images
-fdt_set = Set()
+fdt_set = set()
 
 # Same as above, but excluding the main one
-fdt_subset = Set()
+fdt_subset = set()
 
 # The DTB which contains the full image information
 main_dtb = None
@@ -136,7 +135,7 @@ def Prepare(images, dtb):
 main_dtb = dtb
 fdt_files.clear()
 fdt_files['u-boot.dtb'] = dtb
-fdt_subset = Set()
+fdt_subset = set()
 if not use_fake_dtb:
 for image in images.values():
 fdt_subset.update(image.GetFdtSet())
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 04/21] binman: Don't show errors for failed tests

2019-05-14 Thread Simon Glass
An unfortunate new feature in Python 3.5 causes binman to print errors for
non-existent tests, when the test filter is used. Work around this by
detecting the unwanted tests and removing them from the result.

Signed-off-by: Simon Glass 
---

 tools/binman/binman.py | 12 
 1 file changed, 12 insertions(+)

diff --git a/tools/binman/binman.py b/tools/binman/binman.py
index 4206d2b0e3..aad2e9c8bc 100755
--- a/tools/binman/binman.py
+++ b/tools/binman/binman.py
@@ -87,6 +87,18 @@ def RunTests(debug, processes, args):
 else:
 suite.run(result)
 
+# Remove errors which just indicate a missing test. Since Python v3.5 If an
+# ImportError or AttributeError occurs while traversing name then a
+# synthetic test that raises that error when run will be returned. These
+# errors are included in the errors accumulated by result.errors.
+if test_name:
+errors = []
+for test, err in result.errors:
+if ("has no attribute '%s'" % test_name) not in err:
+errors.append((test, err))
+result.testsRun -= 1
+result.errors = errors
+
 print(result)
 for test, err in result.errors:
 print(test.id(), err)
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 06/21] patman: Use items() instead of iteritems()

2019-05-14 Thread Simon Glass
Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass 
---

 tools/patman/settings.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index ea2bc74f75..07bf6a6ea4 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -163,7 +163,7 @@ class _ProjectConfigParser(ConfigParser.SafeConfigParser):
 item_dict = dict(top_items)
 item_dict.update(project_items)
 return {(self._to_unicode(item), self._to_unicode(val))
-for item, val in item_dict.iteritems()}
+for item, val in item_dict.items()}
 
 def ReadGitAliases(fname):
 """Read a git alias file. This is in the form used by git:
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 01/21] patman: Update cros_subprocess to use bytearray

2019-05-14 Thread Simon Glass
At present this function uses lists and strings. This does not work so
well with Python 3, and testing against '' does not work for a bytearray.
Update the code to fix these issues.

Signed-off-by: Simon Glass 
---

 tools/patman/cros_subprocess.py | 48 -
 tools/patman/gitutil.py |  2 ++
 2 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/tools/patman/cros_subprocess.py b/tools/patman/cros_subprocess.py
index ebd4300dfd..4de230ac63 100644
--- a/tools/patman/cros_subprocess.py
+++ b/tools/patman/cros_subprocess.py
@@ -100,6 +100,24 @@ class Popen(subprocess.Popen):
 if kwargs:
 raise ValueError("Unit tests do not test extra args - please add 
tests")
 
+def ConvertData(self, data):
+"""Convert stdout/stderr data to the correct format for output
+
+Args:
+data: Data to convert, or None for ''
+
+Returns:
+Converted data to a unicode string
+"""
+if data is None:
+return ''
+else:
+try:
+data = data.decode('utf-8')
+except UnicodeDecodeError:
+data = data.decode('utf-8', 'ignore')
+return data
+
 def CommunicateFilter(self, output):
 """Interact with process: Read data from stdout and stderr.
 
@@ -156,11 +174,11 @@ class Popen(subprocess.Popen):
 self.stdin.close()
 if self.stdout:
 read_set.append(self.stdout)
-stdout = []
+stdout = bytearray()
 if self.stderr and self.stderr != self.stdout:
 read_set.append(self.stderr)
-stderr = []
-combined = []
+stderr = bytearray()
+combined = bytearray()
 
 input_offset = 0
 while read_set or write_set:
@@ -192,12 +210,12 @@ class Popen(subprocess.Popen):
 data = os.read(self.stdout.fileno(), 1024)
 except OSError:
 pass
-if data == "":
+if not len(data):
 self.stdout.close()
 read_set.remove(self.stdout)
 else:
-stdout.append(data)
-combined.append(data)
+stdout += data
+combined += data
 if output:
 output(sys.stdout, data)
 if self.stderr in rlist:
@@ -207,25 +225,19 @@ class Popen(subprocess.Popen):
 data = os.read(self.stderr.fileno(), 1024)
 except OSError:
 pass
-if data == "":
+if not len(data):
 self.stderr.close()
 read_set.remove(self.stderr)
 else:
-stderr.append(data)
-combined.append(data)
+stderr += data
+combined += data
 if output:
 output(sys.stderr, data)
 
 # All data exchanged.Translate lists into strings.
-if stdout is not None:
-stdout = ''.join(stdout)
-else:
-stdout = ''
-if stderr is not None:
-stderr = ''.join(stderr)
-else:
-stderr = ''
-combined = ''.join(combined)
+stdout = self.ConvertData(stdout)
+stderr = self.ConvertData(stderr)
+combined = self.ConvertData(combined)
 
 # Translate newlines, if requested.We cannot let the file
 # object do the translation: It is based on stdio, which is
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 9905bb0bbd..7650b51bd5 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -326,6 +326,8 @@ def BuildEmailList(in_list, tag=None, alias=None, 
raise_on_error=True):
 result = []
 for item in raw:
 if not item in result:
+if type(item) == unicode:
+item = item.encode('utf-8')
 result.append(item)
 if tag:
 return ['%s %s%s%s' % (tag, quote, email, quote) for email in result]
-- 
2.21.0.1020.gf2820cf01a-goog

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


[U-Boot] [PATCH 00/21] patman: Update to support Python 3

2019-05-14 Thread Simon Glass
This series updates patman to support Python 3:

- Avoid using 'unicode' type directly
- Use items() instead of iteritems()
- Make sure file I/O uses binary mode where necessary
- Change print statements to functions
- Use the built-in set() class
- Fix up generation of repeated bytes

A few patches for binman are included, but this still requires Python 2.


Simon Glass (21):
  patman: Update cros_subprocess to use bytearray
  patman: Convert print statements to Python 3
  binman: Convert print statements to Python 3
  binman: Don't show errors for failed tests
  binman: Remove use of Set()
  patman: Use items() instead of iteritems()
  binman: Use items() instead of iteritems()
  tools: binman: Open all binary files in binary mode
  tools: dtoc: Open all binary files in binary mode
  patman: Provide a way to get program output in binary mode
  binman: Use binary mode when compressing data
  binman: Drop an unused input file
  binman: Handle repeated bytes for Python 3
  Add a simple script to remove boards
  patman: Support use of stringIO in Python 3
  patman: Move unicode helpers to tools
  patman: Sort series output for repeatabily
  patman: Avoid unicode type in settings unit tests
  patman: Adjust functional tests for Python 3
  patman: Tidy up a few more unicode conversions
  patman: Don't require Python 2

 tools/binman/binman.py   |  26 +++-
 tools/binman/bsection.py |   7 +-
 tools/binman/control.py  |   8 +-
 tools/binman/elf.py  |   4 +-
 tools/binman/elf_test.py |   2 +-
 tools/binman/entry.py|   5 +-
 tools/binman/etype/blob.py   |   2 +-
 tools/binman/etype/fill.py   |   4 +-
 tools/binman/etype/gbb.py|   2 +-
 tools/binman/etype/u_boot_spl_bss_pad.py |   2 +-
 tools/binman/ftest.py|  81 ++--
 tools/binman/state.py|   7 +-
 tools/dtoc/fdt.py|   2 +-
 tools/patman/cros_subprocess.py  |  53 +---
 tools/patman/func_test.py|  41 ---
 tools/patman/gitutil.py  |  16 +--
 tools/patman/patman.py   |   2 +-
 tools/patman/series.py   |  20 +--
 tools/patman/settings.py |  34 ++---
 tools/patman/test_util.py|  16 +--
 tools/patman/tools.py|  55 -
 tools/rmboard.py | 150 +++
 22 files changed, 385 insertions(+), 154 deletions(-)
 create mode 100755 tools/rmboard.py

-- 
2.21.0.1020.gf2820cf01a-goog

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


Re: [U-Boot] [PATCH 1/2] mtd: mxs_nand_spl: fix nand_command protocol violation

2019-05-14 Thread Andrea Scian - DAVE Embedded Systems


Hi Michael,
On 14/05/19 20:44, Michael Nazzareno Trimarchi wrote:

Hi all

On Tue, Jan 29, 2019 at 3:40 PM Andrea Scian  wrote:


mxs_nand_command() implementation assume that it's working with a
LP NAND, which is a common case nowadays and thus uses two bytes
for column address.

However this is wrong for NAND_CMD_READID and NAND_CMD_PARAM, which
expects only one byte of column address, even for LP NANDs.
This leads to ONFI detection problem with some NAND manufacturer (like
Winbond) but not with others (like Samsung and Spansion)

We fix this with a simple workaround to avoid the 2nd byte column address
for those two commands.

Also align the code with nand_base to support 16 bit devices.

Tested on an iMX6SX device with:
* Winbond W29N04GVSIAA
* Spansion S34ML04G100TF100
* Samsung K9F4G08U00

Signed-off-by: Andrea Scian 
CC: Stefano Babic 


Is this somenthing that is already addressed?


AFAIK, this is still an open problem on current master
This patch has not been integrated and the code is the same as the one 
that have the original issue


Andrea SCIAN


*DAVE Embedded Systems*

via Talponedo 29/A 33080 Porcia (PN) - Italy
Telephone: +39.0434.921215
Telefax: +39.0434.1994030
web: www.dave.eu 




Michael


---
  drivers/mtd/nand/raw/mxs_nand_spl.c | 14 +-
  1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c 
b/drivers/mtd/nand/raw/mxs_nand_spl.c
index 2d7bbe83cc..ad3b7ade64 100644
--- a/drivers/mtd/nand/raw/mxs_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
@@ -22,8 +22,20 @@ static void mxs_nand_command(struct mtd_info *mtd, unsigned 
int command,

 /* Serially input address */
 if (column != -1) {
+   /* Adjust columns for 16 bit buswidth */
+   if (chip->options & NAND_BUSWIDTH_16 &&
+   !nand_opcode_8bits(command))
+   column >>= 1;
 chip->cmd_ctrl(mtd, column, NAND_ALE);
-   chip->cmd_ctrl(mtd, column >> 8, NAND_ALE);
+
+   /*
+* Assume LP NAND here, so use two bytes column address
+* but not for CMD_READID and CMD_PARAM, which require
+* only one byte column address
+*/
+   if (command != NAND_CMD_READID &&
+   command != NAND_CMD_PARAM)
+   chip->cmd_ctrl(mtd, column >> 8, NAND_ALE);
 }
 if (page_addr != -1) {
 chip->cmd_ctrl(mtd, page_addr, NAND_ALE);
--
2.19.2

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





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


Re: [U-Boot] [PATCH 3/7] warp7: include: configs: Differentiate bootscript address from loadaddr

2019-05-14 Thread Pierre-Jean Texier

Hi Bryan,

Le 14/05/2019 à 00:13, Bryan O'Donoghue a écrit :



On 09/05/2019 16:32, Bryan O'Donoghue wrote:



On 08/05/2019 20:33, Pierre-Jean Texier wrote:

Hi Bryan,

Le 08/05/2019 à 20:14, Bryan O'Donoghue a écrit :
Reusing the loadaddr to load the boot script breaks some of the 
logic we
want to have around the bootscript/FIT load addresses. Making a 
dedicated
bootscript address allows us to differentiate the bootscript load 
address
from the Linux Kernel or OPTEE load address, thus ensuring that no 
matter

what the load sequence the bootscript and Kernel/OPTEE binary load
addresses do not conflict.

Signed-off-by: Bryan O'Donoghue 
---
  include/configs/warp7.h | 7 ---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 95955fd626..0c63050833 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -50,6 +50,7 @@
  "script=boot.scr\0" \
  "bootscr_fitimage_name=bootscr\0" \
  "script_signed=boot.scr.imx-signed\0" \
+    "bootscriptaddr=0x8320\0" \
  "image=zImage\0" \
  "console=ttymxc0\0" \
  "ethact=usb_ether\0" \
@@ -70,16 +71,16 @@
  "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} 
${filesize} 0;\0" \

  "do_bootscript_hab=" \
  "if test ${hab_enabled} -eq 1; then " \
-    "setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \
+    "setexpr hab_ivt_addr ${bootscriptaddr} - 
${ivt_offset}; " \

  "setenv script ${script_signed}; " \
  "load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} 
${script}; " \

  "run warp7_auth_or_fail; " \
  "run bootscript; "\
  "fi;\0" \
  "loadbootscript=" \
-    "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+    "load mmc ${mmcdev}:${mmcpart} ${bootscriptaddr} 
${script};\0" \

  "bootscript=echo Running bootscript from mmc ...; " \
-    "source\0" \
+    BOOT_SCR_STRING \
  "loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} 
${image}\0" \
  "loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr} 
${fdt_file}\0" \

  "mmcboot=echo Booting from mmc ...; " \


Instead of implementing a new variable (bootscriptaddr), I think 
(IMHO) it's time to migrate


to distroboot for the WaRP7 (like pico imx7 for instance >

In fact, in this specific case, this allows to use the common 
scriptaddr[1] variable.
FYI, this is a task I am currently working on [2] (work in 
progress). Maybe we could integrate this migration into this series ?


Sure.

Let me give it a test later tonight/tomorrow


Hi Pierre,

I've applied your patch on-top of of a 3 day old master

* 60277e4bcc - (HEAD) warp7: add distroboot support (27 hours ago)
* 4ca7700d2c - imx: Use a convenient default value for 
SYS_MALLOC_F_LEN (27 hours ago)

* 48372a5af6 - Remove whitelist entry for CONFIG_CRC32 (3 days ago)
* 4ad2c8953d - Remove #define CONFIG_CRC32 (3 days ago)
* 661bbc50d3 - mtd: ubi: Remove select for non existent option (3 days 
ago)
* 2b841dba5c - cmd: ubifs: Remove select for non-existent option (3 
days ago)

* b8de00c671 - Remove whitelist entry for CONFIG_GPIO (3 days ago)
* 26680b9f3a - sysreset: select DM_GPIO instead of GPIO (3 days ago)
*   927a37df9f - Merge branch '2019-05-09-master-imports' (3 days ago)

should this apply in isolation ?
Not necessarily, on my side everything working well on-top of master, 
for example:


Hit any key to stop autoboot:  0
=> run bootcmd_mmc0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
247 bytes read in 1 ms (241.2 KiB/s)
## Executing script at 8080
8923088 bytes read in 131 ms (65 MiB/s)
26889 bytes read in 5 ms (5.1 MiB/s)
Kernel image @ 0x8080 [ 0x00 - 0x8827d0 ]
## Flattened Device Tree blob at 8300
   Booting using the fdt blob at 0x8300
   Using Device Tree in place at 8300, end 83009908

Starting kernel ...

[    0.00] Booting Linux on physical CPU 0x0



I get a dead-loop on USB CDC ethernet...

=> reset
resetting ...


U-Boot 2019.07-rc1-00457-g60277e4bcc (May 13 2019 - 23:11:24 +0100)

CPU:   Freescale i.MX7S rev1.2 800 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 47C
Reset cause: POR
Model: Warp i.MX7 Board
Board: WARP7 in secure mode OPTEE DRAM 0x9d00-0xa000
DRAM:  464 MiB
PMIC: PFUZE3000 DEV_ID=0x30 REV_ID=0x11
MMC:   FSL_SDHC: 1, FSL_SDHC: 0
Loading Environment from MMC... *** Warning - bad CRC, using default 
environment


In:    serial@3086
Out:   serial@3086
Err:   serial@3086
SEC0: RNG instantiated
Net:   usb_ether
Warning: usb_ether (eth0) using random MAC address - b6:5e:3c:03:d8:8e

Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found U-Boot script /boot.scr
11090492 bytes read in 146 ms (72.4 MiB/s)
## Executing script at 8080
No FIT subimage unit name
SCRIPT FAILED: co

Re: [U-Boot] net: rtl8169: Support RTL-8168h/8111h

2019-05-14 Thread Joe Hershberger
Hi Thierry,

https://patchwork.ozlabs.org/patch/1086412/ was applied to 
http://git.denx.de/?p=u-boot/u-boot-net.git

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


Re: [U-Boot] eth: mtk-eth: fix incorrect read of phy-handle

2019-05-14 Thread Joe Hershberger
Hi Weijie,

https://patchwork.ozlabs.org/patch/1092185/ was applied to 
http://git.denx.de/?p=u-boot/u-boot-net.git

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


Re: [U-Boot] net: rtl8169: Implement ->hwaddr_write() callback

2019-05-14 Thread Joe Hershberger
Hi Thierry,

https://patchwork.ozlabs.org/patch/1086411/ was applied to 
http://git.denx.de/?p=u-boot/u-boot-net.git

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


Re: [U-Boot] phy: ti: Init node before reading

2019-05-14 Thread Joe Hershberger
Hi Michal,

https://patchwork.ozlabs.org/patch/1057355/ was applied to 
http://git.denx.de/?p=u-boot/u-boot-net.git

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


Re: [U-Boot] net: phy: micrel: Allow KSZ8xxx and KSZ90x1 to be used together

2019-05-14 Thread Joe Hershberger
Hi James,

https://patchwork.ozlabs.org/patch/1052351/ was applied to 
http://git.denx.de/?p=u-boot/u-boot-net.git

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


[U-Boot] Pull request: u-boot-net.git master

2019-05-14 Thread Joe Hershberger
Hi Tom,

Tested on Travis... https://travis-ci.org/jhershbe/u-boot/builds/531963238

The following changes since commit 90176e3be63802bc8630bab651d169993f0f0763:

  Merge tag 'efi-2019-07-rc3' of git://git.denx.de/u-boot-efi (2019-05-13 
07:13:28 -0400)

are available in the git repository at:

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

for you to fetch changes up to ebb97ea86878e56daadcc2d5d063ed59a10b5744:

  eth: mtk-eth: fix incorrect read of phy-handle (2019-05-14 14:43:33 -0500)


James Byrne (1):
  net: phy: micrel: Allow KSZ8xxx and KSZ90x1 to be used together

Michal Simek (1):
  phy: ti: Init node before reading

Thierry Reding (2):
  net: rtl8169: Implement ->hwaddr_write() callback
  net: rtl8169: Support RTL-8168h/8111h

Weijie Gao (1):
  eth: mtk-eth: fix incorrect read of phy-handle

 configs/alt_defconfig|  1 +
 configs/aristainetos_defconfig   |  1 +
 configs/bk4r1_defconfig  |  1 +
 configs/colibri_imx6_defconfig   |  1 +
 configs/colibri_imx7_defconfig   |  1 +
 configs/colibri_imx7_emmc_defconfig  |  1 +
 configs/colibri_vf_defconfig |  1 +
 configs/flea3_defconfig  |  1 +
 configs/gose_defconfig   |  1 +
 configs/imx6dl_mamoj_defconfig   |  1 +
 configs/imx6qdl_icore_rqs_defconfig  |  1 +
 configs/k2g_evm_defconfig|  1 +
 configs/k2g_hs_evm_defconfig |  1 +
 configs/koelsch_defconfig|  1 +
 configs/lager_defconfig  |  1 +
 configs/m53menlo_defconfig   |  1 +
 configs/mx6ul_14x14_evk_defconfig|  1 +
 configs/mx6ul_9x9_evk_defconfig  |  1 +
 configs/opos6uldev_defconfig |  1 +
 configs/pcm052_defconfig |  1 +
 configs/phycore_pcl063_defconfig |  1 +
 configs/pico-hobbit-imx6ul_defconfig |  1 +
 configs/pico-imx6ul_defconfig|  1 +
 configs/pico-pi-imx6ul_defconfig |  1 +
 configs/porter_defconfig |  1 +
 configs/silk_defconfig   |  1 +
 configs/stout_defconfig  |  1 +
 configs/stv0991_defconfig|  1 +
 configs/udoo_neo_defconfig   |  1 +
 configs/vf610twr_defconfig   |  1 +
 configs/vf610twr_nand_defconfig  |  1 +
 configs/woodburn_defconfig   |  1 +
 configs/woodburn_sd_defconfig|  1 +
 drivers/net/mtk_eth.c|  7 ---
 drivers/net/phy/Kconfig  | 19 +--
 drivers/net/phy/micrel_ksz8xxx.c |  8 +---
 drivers/net/phy/micrel_ksz90x1.c |  2 +-
 drivers/net/phy/ti.c |  8 
 drivers/net/rtl8169.c| 19 +++
 39 files changed, 71 insertions(+), 25 deletions(-)

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


[U-Boot] [PATCH] Import include/android_bootloader_message.h from AOSP

2019-05-14 Thread Alex Deymo
This takes the latest changes from AOSP from the file
bootloader_message/include/bootloader_message/bootloader_message.h
in the repository
https://android.googlesource.com/platform/bootable/recovery
and re-licensed them to BSD-3 for U-Boot.

Minimum local changes have been applied (convert C++ to C comments and
adding #ifndef __UBOOT__ block to skip all the function declarations).

Signed-off-by: Alex Deymo 
---
 include/android_bootloader_message.h | 246 +++
 1 file changed, 246 insertions(+)
 create mode 100644 include/android_bootloader_message.h

diff --git a/include/android_bootloader_message.h 
b/include/android_bootloader_message.h
new file mode 100644
index 00..b84789f022
--- /dev/null
+++ b/include/android_bootloader_message.h
@@ -0,0 +1,246 @@
+/*
+ * This is from the Android Project,
+ * Repository: https://android.googlesource.com/platform/bootable/recovery
+ * File: bootloader_message/include/bootloader_message/bootloader_message.h
+ * Commit: c784ce50e8c10eaf70e1f97e24e8324aef45faf5
+ *
+ * Copyright (C) 2008 The Android Open Source Project
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef __ANDROID_BOOTLOADER_MESSAGE_H
+#define __ANDROID_BOOTLOADER_MESSAGE_H
+
+/* compiler.h defines the types that otherwise are included from stdint.h and
+ * stddef.h
+ */
+#include 
+
+/* Spaces used by misc partition are as below:
+ * 0   - 2K For bootloader_message
+ * 2K  - 16KUsed by Vendor's bootloader (the 2K - 4K range may be 
optionally used
+ *  as bootloader_message_ab struct)
+ * 16K - 64KUsed by uncrypt and recovery to store wipe_package for A/B 
devices
+ * Note that these offsets are admitted by bootloader,recovery and uncrypt, so 
they
+ * are not configurable without changing all of them. */
+static const size_t BOOTLOADER_MESSAGE_OFFSET_IN_MISC = 0;
+static const size_t WIPE_PACKAGE_OFFSET_IN_MISC = 16 * 1024;
+
+/* Bootloader Message (2-KiB)
+ *
+ * This structure describes the content of a block in flash
+ * that is used for recovery and the bootloader to talk to
+ * each other.
+ *
+ * The command field is updated by linux when it wants to
+ * reboot into recovery or to update radio or bootloader firmware.
+ * It is also updated by the bootloader when firmware update
+ * is complete (to boot into recovery for any final cleanup)
+ *
+ * The status field was used by the bootloader after the completion
+ * of an "update-radio" or "update-hboot" command, which has been
+ * deprecated since Froyo.
+ *
+ * The recovery field is only written by linux and used
+ * for the system to send a message to recovery or the
+ * other way around.
+ *
+ * The stage field is written by packages which restart themselves
+ * multiple times, so that the UI can reflect which invocation of the
+ * package it is.  If the value is of the format "#/#" (eg, "1/3"),
+ * the UI will add a simple indicator of that status.
+ *
+ * We used to have slot_suffix field for A/B boot control metadata in
+ * this struct, which gets unintentionally cleared by recovery or
+ * uncrypt. Move it into struct bootloader_message_ab to avoid the
+ * issue.
+ */
+struct bootloader_message {
+char command[32];
+char status[32];
+char recovery[768];
+
+/* The 'recovery' field used to be 1024 bytes.  It has only ever
+ * been used to store the recovery command line, so 768 bytes
+ * should be plenty.  We carve off the last 256 bytes to store the
+ * stage string (for multistage packages) and possible future
+ * expansion. */
+char stage[32];
+
+/* The 'reserved' field used to be 224 bytes when it was initially
+ * carved off from the 1024-byte recovery field. Bump it up to
+ * 1184-byte so that the entire bootloader_message struct rounds up
+ * to 2048-byte. */
+char reserved[1184];
+};
+
+/**
+ * We must be cautious when changing the bootloader_message struct size,
+ * because A/B-specific fields may end up with different offsets.
+ */
+#if (__STDC_VERSION__ >= 201112L) || defined(__cplusplus)
+static_assert(sizeof(struct bootloader_message) == 2048,
+  "struct bootloader_message size changes, which may break A/B 
devices");
+#endif
+
+/**
+ * The A/B-specific bootloader message structure (4-KiB).
+ *
+ * We separate A/B boot control metadata from the regular bootloader
+ * message struct and keep it here. Everything that's A/B-specific
+ * stays after struct bootloader_message, which should be managed by
+ * the A/B-bootloader or boot control HAL.
+ *
+ * The slot_suffix field is used for A/B implementations where the
+ * bootloader does not set the androidboot.ro.boot.slot_suffix kernel
+ * commandline parameter. This is used by fs_mgr to mount /system and
+ * other partitions with the slotselect flag set in fstab. A/B
+ * implementations are free to use all 32 bytes and may store private
+ * data past the first NUL-byte in this field. It is encouraged, but
+ * not mandatory, to use 'struct bootloader_con

[U-Boot] [PATCH] tools: use read-only mmap in fit_check_sign

2019-05-14 Thread luca . boccassi
From: Luca Boccassi 

Add an option to open files in read-only mode in mmap_fdt so
that fit_check_sign can be used to inspect files on read-only
filesystems.
For example, this is useful when a key is shipped in a read-only
rootfs or squashfs.

Signed-off-by: Luca Boccassi 
---
 tools/fit_check_sign.c |  4 ++--
 tools/fit_common.c |  9 ++---
 tools/fit_common.h |  4 +++-
 tools/fit_image.c  | 10 ++
 tools/fit_info.c   |  2 +-
 5 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/tools/fit_check_sign.c b/tools/fit_check_sign.c
index 62adc751cb..4528743792 100644
--- a/tools/fit_check_sign.c
+++ b/tools/fit_check_sign.c
@@ -70,10 +70,10 @@ int main(int argc, char **argv)
usage(*argv);
}
 
-   ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false);
+   ffd = mmap_fdt(cmdname, fdtfile, 0, &fit_blob, &fsbuf, false, true);
if (ffd < 0)
return EXIT_FAILURE;
-   kfd = mmap_fdt(cmdname, keyfile, 0, &key_blob, &ksbuf, false);
+   kfd = mmap_fdt(cmdname, keyfile, 0, &key_blob, &ksbuf, false, true);
if (kfd < 0)
return EXIT_FAILURE;
 
diff --git a/tools/fit_common.c b/tools/fit_common.c
index 9506390214..cdf987d3c1 100644
--- a/tools/fit_common.c
+++ b/tools/fit_common.c
@@ -41,13 +41,14 @@ int fit_check_image_types(uint8_t type)
 }
 
 int mmap_fdt(const char *cmdname, const char *fname, size_t size_inc,
-void **blobp, struct stat *sbuf, bool delete_on_error)
+void **blobp, struct stat *sbuf, bool delete_on_error,
+bool read_only)
 {
void *ptr;
int fd;
 
/* Load FIT blob into memory (we need to write hashes/signatures) */
-   fd = open(fname, O_RDWR | O_BINARY);
+   fd = open(fname, (read_only ? O_RDONLY : O_RDWR) | O_BINARY);
 
if (fd < 0) {
fprintf(stderr, "%s: Can't open %s: %s\n",
@@ -71,7 +72,9 @@ int mmap_fdt(const char *cmdname, const char *fname, size_t 
size_inc,
}
 
errno = 0;
-   ptr = mmap(0, sbuf->st_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
+   ptr = mmap(0, sbuf->st_size,
+  (read_only ? PROT_READ : PROT_READ | PROT_WRITE), MAP_SHARED,
+  fd, 0);
if ((ptr == MAP_FAILED) || (errno != 0)) {
fprintf(stderr, "%s: Can't read %s: %s\n",
cmdname, fname, strerror(errno));
diff --git a/tools/fit_common.h b/tools/fit_common.h
index 9e09624f64..1e81d4c68b 100644
--- a/tools/fit_common.h
+++ b/tools/fit_common.h
@@ -32,9 +32,11 @@ int fit_check_image_types(uint8_t type);
  * @blobp: Returns pointer to FDT blob
  * @sbuf:  File status information is stored here
  * @delete_on_error:   true to delete the file if we get an error
+ * @read_only: true to open in read-only mode
  * @return 0 if OK, -1 on error.
  */
 int mmap_fdt(const char *cmdname, const char *fname, size_t size_inc,
-void **blobp, struct stat *sbuf, bool delete_on_error);
+void **blobp, struct stat *sbuf, bool delete_on_error,
+bool read_only);
 
 #endif /* _FIT_COMMON_H_ */
diff --git a/tools/fit_image.c b/tools/fit_image.c
index 3b867e0656..5aca634b5e 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -33,7 +33,8 @@ static int fit_add_file_data(struct image_tool_params 
*params, size_t size_inc,
void *ptr;
int ret = 0;
 
-   tfd = mmap_fdt(params->cmdname, tmpfile, size_inc, &ptr, &sbuf, true);
+   tfd = mmap_fdt(params->cmdname, tmpfile, size_inc, &ptr, &sbuf, true,
+  false);
if (tfd < 0)
return -EIO;
 
@@ -41,7 +42,8 @@ static int fit_add_file_data(struct image_tool_params 
*params, size_t size_inc,
struct stat dest_sbuf;
 
destfd = mmap_fdt(params->cmdname, params->keydest, size_inc,
- &dest_blob, &dest_sbuf, false);
+ &dest_blob, &dest_sbuf, false,
+ false);
if (destfd < 0) {
ret = -EIO;
goto err_keydest;
@@ -420,7 +422,7 @@ static int fit_extract_data(struct image_tool_params 
*params, const char *fname)
int images;
int node;
 
-   fd = mmap_fdt(params->cmdname, fname, 0, &fdt, &sbuf, false);
+   fd = mmap_fdt(params->cmdname, fname, 0, &fdt, &sbuf, false, false);
if (fd < 0)
return -EIO;
fit_size = fdt_totalsize(fdt);
@@ -531,7 +533,7 @@ static int fit_import_data(struct image_tool_params 
*params, const char *fname)
int images;
int node;
 
-   fd = mmap_fdt(params->cmdname, fname, 0, &old_fdt, &sbuf, false);
+   fd = mmap_fdt(params->cmdname, fname, 0, &old_fdt, &sbuf, false, false);
if (fd < 0)
return -EIO;
fit_size = fdt_totalsize(old_fdt);
diff --git a/tools/fit_info.c b/tools/fit_info.c
index 

Re: [U-Boot] [PATCH 1/2] mtd: mxs_nand_spl: fix nand_command protocol violation

2019-05-14 Thread Michael Nazzareno Trimarchi
Hi all

On Tue, Jan 29, 2019 at 3:40 PM Andrea Scian  wrote:
>
> mxs_nand_command() implementation assume that it's working with a
> LP NAND, which is a common case nowadays and thus uses two bytes
> for column address.
>
> However this is wrong for NAND_CMD_READID and NAND_CMD_PARAM, which
> expects only one byte of column address, even for LP NANDs.
> This leads to ONFI detection problem with some NAND manufacturer (like
> Winbond) but not with others (like Samsung and Spansion)
>
> We fix this with a simple workaround to avoid the 2nd byte column address
> for those two commands.
>
> Also align the code with nand_base to support 16 bit devices.
>
> Tested on an iMX6SX device with:
> * Winbond W29N04GVSIAA
> * Spansion S34ML04G100TF100
> * Samsung K9F4G08U00
>
> Signed-off-by: Andrea Scian 
> CC: Stefano Babic 

Is this somenthing that is already addressed?

Michael

> ---
>  drivers/mtd/nand/raw/mxs_nand_spl.c | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c 
> b/drivers/mtd/nand/raw/mxs_nand_spl.c
> index 2d7bbe83cc..ad3b7ade64 100644
> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> @@ -22,8 +22,20 @@ static void mxs_nand_command(struct mtd_info *mtd, 
> unsigned int command,
>
> /* Serially input address */
> if (column != -1) {
> +   /* Adjust columns for 16 bit buswidth */
> +   if (chip->options & NAND_BUSWIDTH_16 &&
> +   !nand_opcode_8bits(command))
> +   column >>= 1;
> chip->cmd_ctrl(mtd, column, NAND_ALE);
> -   chip->cmd_ctrl(mtd, column >> 8, NAND_ALE);
> +
> +   /*
> +* Assume LP NAND here, so use two bytes column address
> +* but not for CMD_READID and CMD_PARAM, which require
> +* only one byte column address
> +*/
> +   if (command != NAND_CMD_READID &&
> +   command != NAND_CMD_PARAM)
> +   chip->cmd_ctrl(mtd, column >> 8, NAND_ALE);
> }
> if (page_addr != -1) {
> chip->cmd_ctrl(mtd, page_addr, NAND_ALE);
> --
> 2.19.2
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot



-- 
| Michael Nazzareno Trimarchi Amarula Solutions BV |
| COO  -  Founder  Cruquiuskade 47 |
| +31(0)851119172 Amsterdam 1018 AM NL |
|  [`as] http://www.amarulasolutions.com   |
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] sun50i: h6: Fix Beelink GS1 board config

2019-05-14 Thread peron . clem
From: Clément Péron 

SPL_TEXT_BASE has been moved to Kconfig with commit:
f89d6133ee configs: move CONFIG_SPL_TEXT_BASE to Kconfig

But Beelink GS1 config file has been introduced in the
same time without this modification.

Fix this by settings the CONFIG_SPL_TEXT_BASE

Suggested-by: Jonas Smedegaard 
Signed-off-by: Clément Péron 
---
 configs/beelink_gs1_defconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configs/beelink_gs1_defconfig b/configs/beelink_gs1_defconfig
index ef4dd29549..f16d0fee22 100644
--- a/configs/beelink_gs1_defconfig
+++ b/configs/beelink_gs1_defconfig
@@ -1,12 +1,13 @@
 CONFIG_ARM=y
 CONFIG_ARCH_SUNXI=y
+CONFIG_NR_DRAM_BANKS=1
 CONFIG_SPL=y
 CONFIG_MACH_SUN50I_H6=y
 CONFIG_MMC0_CD_PIN="PF6"
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 # CONFIG_PSCI_RESET is not set
-CONFIG_NR_DRAM_BANKS=1
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_SPL_TEXT_BASE=0x20060
 # CONFIG_CMD_FLASH is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
-- 
2.17.1

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


Re: [U-Boot] [PATCH 4/4] test/py: test_fs: add tests for creating/deleting many files

2019-05-14 Thread Heinrich Schuchardt

On 5/13/19 7:49 AM, AKASHI Takahiro wrote:

Two test cases are added under test_fs_ext:
 test case 10: for root directory
 test case 11: for non-root directory


When running `make tests` all of these tests seem to be skipped:

test/py/tests/test_fs/test_basic.py
sss
[  0%]
test/py/tests/test_fs/test_ext.py ss

[  0%]
test/py/tests/test_fs/test_mkdir.py 

[  0%]
test/py/tests/test_fs/test_symlink.py 

[  0%]
test/py/tests/test_fs/test_unlink.py ss

How can they be executed?

I think it is worthwhile to mention as a comment that you are testing
long file names (not 8.3).

Best regards

Heinrich



Those will verify a behavior fixed by the commits related to
root directory
("fs: fat: allocate a new cluster for root directory of fat32" and
"fs: fat: flush a directory cluster properly").

Signed-off-by: AKASHI Takahiro 
---
  test/py/tests/test_fs/test_ext.py | 84 +++
  1 file changed, 84 insertions(+)

diff --git a/test/py/tests/test_fs/test_ext.py 
b/test/py/tests/test_fs/test_ext.py
index 2c47738b8df2..361f440dd6d4 100644
--- a/test/py/tests/test_fs/test_ext.py
+++ b/test/py/tests/test_fs/test_ext.py
@@ -233,3 +233,87 @@ class TestFsExt(object):
  % (fs_type, ADDR, MIN_FILE)])
  assert('Unable to write "/dir1' in ''.join(output))
  assert_fs_integrity(fs_type, fs_img)
+
+def test_fs_ext10(self, u_boot_console, fs_obj_ext):
+"""
+'Test Case 10 - create/delete as many directories under root directory
+as amount of directory entries goes beyond one cluster size)'
+"""
+fs_type,fs_img,md5val = fs_obj_ext
+with u_boot_console.log.section('Test Case 10 - create/delete (many)'):
+# Test Case 10a - Create many files
+#   Please note that the size of directory entry is 32 bytes.
+#   So one typical cluster may holds 64 (2048/32) entries.
+output = u_boot_console.run_command(
+'host bind 0 %s' % fs_img)
+
+for i in range(0, 66):
+output = u_boot_console.run_command(
+'%swrite host 0:0 %x /FILE0123456789_%02x 100'
+% (fs_type, ADDR, i))
+output = u_boot_console.run_command('%sls host 0:0 /' % fs_type)
+assert('FILE0123456789_00' in output)
+assert('FILE0123456789_41' in output)
+
+# Test Case 10b - Delete many files
+for i in range(0, 66):
+output = u_boot_console.run_command(
+'%srm host 0:0 /FILE0123456789_%02x'
+% (fs_type, i))
+output = u_boot_console.run_command('%sls host 0:0 /' % fs_type)
+assert(not 'FILE0123456789_00' in output)
+assert(not 'FILE0123456789_41' in output)
+
+# Test Case 10c - Create many files again
+# Please note no.64 and 65 are intentionally re-created
+for i in range(64, 128):
+output = u_boot_console.run_command(
+'%swrite host 0:0 %x /FILE0123456789_%02x 100'
+% (fs_type, ADDR, i))
+output = u_boot_console.run_command('%sls host 0:0 /' % fs_type)
+assert('FILE0123456789_40' in output)
+assert('FILE0123456789_79' in output)
+
+assert_fs_integrity(fs_type, fs_img)
+
+def test_fs_ext11(self, u_boot_console, fs_obj_ext):
+"""
+'Test Case 11 - create/delete as many directories under non-root
+directory as amount of directory entries goes beyond one cluster size)'
+"""
+fs_type,fs_img,md5val = fs_obj_ext
+with u_boot_console.log.section('Test Case 10 - create/delete (many)'):
+# Test Case 11a - Create many files
+#   Please note that the size of directory entry is 32 bytes.
+#   So one typical cluster may holds 64 (2048/32) entries.
+output = u_boot_console.run_command(
+'host bind 0 %s' % fs_img)
+
+for i in range(0, 66):
+output = u_boot_console.run_command(
+'%swrite host 0:0 %x /dir1/FILE0123456789_%02x 100'
+% (fs_type, ADDR, i))
+output = u_boot_console.run_command('%sls host 0:0 /dir1' % 
fs_type)
+assert('FILE0123456789_00' in output)
+assert('FILE0123456789_41' in output)
+
+# Test Case 11b - Delete many files
+for i in range(0, 66):
+output = u_boot_console.run_command(
+'%srm host 0:0 /dir1/FILE0123456789_%02x'
+% (fs_type, i))
+output = u_boot_console.run_command('%sls host 0:0 /dir1' % 
fs_type)
+assert(not 'FILE01234567

Re: [U-Boot] [PATCH] efi_loader: variable: attributes may not be changed if a variable exists

2019-05-14 Thread Heinrich Schuchardt

On 5/14/19 8:35 AM, Heinrich Schuchardt wrote:

On 5/14/19 6:57 AM, AKASHI Takahiro wrote:

If a variable already exists, efi_set_variable() should not change
the variable's attributes. This patch enforces it.


This behavior is mandated by UEFI spec 2.7.

Reviewed-by: Heinrich Schuchardt 


This patch let's `bootefi selftest`fail:

Executing 'variables'
lib/efi_selftest/efi_selftest_variables.c(60):
TODO: QueryVariableInfo failed
lib/efi_selftest/efi_selftest_variables.c(119):
ERROR: SetVariable failed
lib/efi_selftest/efi_selftest.c(110):
ERROR: Executing 'variables' failed

The preferred solution would be to implement APPEND_WRITE.

Otherwise at least adjust the unit test concerning APPEND_WRITE to use
efi_st_todo() and not to abort the test.

I suggest that you always run `bootefi selftest` before submitting
changes to the UEFI sub-system.

Best regards

Heinrich





Signed-off-by: AKASHI Takahiro 
---
  lib/efi_loader/efi_variable.c | 9 +
  1 file changed, 9 insertions(+)

diff --git a/lib/efi_loader/efi_variable.c
b/lib/efi_loader/efi_variable.c
index 37728c3c165d..c4f3a5d2743d 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -450,6 +450,15 @@ efi_status_t EFIAPI efi_set_variable(u16
*variable_name,
  ret = EFI_WRITE_PROTECTED;
  goto out;
  }
+
+    /*
+ * attributes won't be changed
+ * TODO: take care of APPEND_WRITE once supported
+ */
+    if (attr != attributes) {
+    ret = EFI_INVALID_PARAMETER;
+    goto out;
+    }
  }

  val = malloc(2 * data_size + strlen("{ro,run,boot}(blob)") + 1);






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


Re: [U-Boot] [PATCH 4/8] spi: Kconfig: Mark MXS_SPI has BROKEN

2019-05-14 Thread Tom Rini
On Tue, May 14, 2019 at 07:41:07PM +0200, Marek Vasut wrote:
> On 5/14/19 7:37 PM, Tom Rini wrote:
> > On Tue, May 14, 2019 at 07:33:17PM +0200, Marek Vasut wrote:
> >> On 5/14/19 4:45 PM, Tom Rini wrote:
> >>> On Tue, May 14, 2019 at 07:46:06PM +0530, Jagan Teki wrote:
>  On Mon, Apr 29, 2019 at 4:54 PM Tom Rini  wrote:
> >
> > On Mon, Apr 29, 2019 at 01:06:57PM +0200, Marek Vasut wrote:
> >> On 4/29/19 1:02 PM, Jagan Teki wrote:
> >>> On Mon, Apr 29, 2019 at 4:28 PM Marek Vasut  wrote:
> 
>  On 4/29/19 12:40 PM, Jagan Teki wrote:
> > On Mon, Apr 29, 2019 at 3:24 PM Marek Vasut  wrote:
> >>
> >> On 4/28/19 10:47 PM, Jagan Teki wrote:
> >>> Mark MXS_SPI has BROKEN, this so the resulting build shows
> >>> warning for broken configuration enabled and associated code
> >>> will remove in v2019.07 release.
> >>
> >> But the code is not broken, it works fine, right ?
> >
> > Yes the code work fine, but dm conversion not done yet. Now the
> > CONFIG_BROKEN can mark the driver configs which doesn't convert dm
> 
>  That makes no sense, if the code works, it works and thus it is NOT
>  broken. Find some other way to flag it as non-DM-converted, not this 
>  hack.
> >>>
> >>> np, It depends on whether we consider non-dm code(for legacy SPI
> >>> drivers) is broken or not, let Tom comment on this.
> >>
> >> Again, the code works, it's not broken. That's very clear.
> >> DM conversion is a separate matter, so let's not overload CONFIG_BROKEN
> >> for such things. The Makefile warning seems sufficient to me.
> >
> > The code is broken because it doesn't work with DM and is going to be
> > removed due to lack of maintenance soon.  My problem with this series,
> > but I need to check that we can do what I want to do and still keep
> > travis green, is have this (and the other non-converted and thus
> > non-maintained drivers) depend on, not select BROKEN.
> 
>  Yes, the idea here is to build the broken one by selecting BROKEN
>  so-that the travis-CI is green and have warning on the build,
>  otherwise it is another rework of selecting BROKEN for those
>  non-converted drivers if they depends.
> 
> >
> > The Makefile warnings tell people the code is going to be removed and
> > I'm trying to have the window be:
> > 1) LOUD warning about needing work
> > 2) 1 release past those loud deadlines of the code there, but not built
> > unless you enable BROKEN (as yes, I see code that's not updated to use
> > DM as being broken)
> > 3) Code removed.
> 
>  ie what this series does.  Driver (for example) will select BROKEN,
>  that means it is still working bu would like to remove in next
>  versions and so..
> >>>
> >>> What I'm after is
> >>> https://github.com/trini/u-boot/commits/WIP-BROKEN-test which is close,
> >>> but not quite there.  We no longer build the drivers marked as BROKEN by
> >>> default, and the fallout from that has been:
> >>> - Some missing dependencies (I'm trying to fix that now) leading to
> >>>   build problems.
> >>> - Needing to yank CONFIG_SPI for example from configs that had been
> >>>   using a now-not-built driver as the subsystem fails to link if there's
> >>>   no controller.  I don't think that's a problem however.
> >>> - Needing to migrate a few more symbols to Kconfig in order to be able
> >>>   to properly express "You need to depend on BROKEN to use this option
> >>>   now".
> >>
> >> I still disagree with marking drivers that need DM conversion, but are
> >> otherwise working perfectly fine, as broken. That's just misleading and
> >> in fact incorrect. Invent some new, more descriptive Kconfig option please.
> > 
> > I also still disagree, but, fine, I'll add  CONFIG_DEPRECATED.
> 
> CONFIG_DM_NEED_MIGRATION or something ?

No, I think given the definition of deprecated:
"to withdraw official support for or discourage the use of (something,
such as a software product) in favor of a newer or better alternative"
(from https://www.merriam-webster.com/dictionary/deprecated) this is
good enough.

-- 
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] ARM: renesas: grpeach: Align env position

2019-05-14 Thread Marek Vasut
Move the U-Boot environment to 0x8 to match the downstream
vendor fork and allow easy migration from one to the other.

Signed-off-by: Marek Vasut 
Cc: Chris Brandt 
Cc: Nobuhiro Iwamatsu 
---
 include/configs/grpeach.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/grpeach.h b/include/configs/grpeach.h
index 01704d84c2..b7271ab1f6 100644
--- a/include/configs/grpeach.h
+++ b/include/configs/grpeach.h
@@ -31,7 +31,7 @@
 #define CONFIG_ENV_OVERWRITE   1
 #define CONFIG_ENV_SECT_SIZE   (64 * 1024)
 #define CONFIG_ENV_SIZE(CONFIG_ENV_SECT_SIZE)
-#define CONFIG_ENV_OFFSET  0xc
+#define CONFIG_ENV_OFFSET  0x8
 
 /* Malloc */
 #define CONFIG_SYS_MALLOC_LEN  (1024 * 1024)
-- 
2.20.1

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


Re: [U-Boot] [PATCH 4/8] spi: Kconfig: Mark MXS_SPI has BROKEN

2019-05-14 Thread Marek Vasut
On 5/14/19 7:37 PM, Tom Rini wrote:
> On Tue, May 14, 2019 at 07:33:17PM +0200, Marek Vasut wrote:
>> On 5/14/19 4:45 PM, Tom Rini wrote:
>>> On Tue, May 14, 2019 at 07:46:06PM +0530, Jagan Teki wrote:
 On Mon, Apr 29, 2019 at 4:54 PM Tom Rini  wrote:
>
> On Mon, Apr 29, 2019 at 01:06:57PM +0200, Marek Vasut wrote:
>> On 4/29/19 1:02 PM, Jagan Teki wrote:
>>> On Mon, Apr 29, 2019 at 4:28 PM Marek Vasut  wrote:

 On 4/29/19 12:40 PM, Jagan Teki wrote:
> On Mon, Apr 29, 2019 at 3:24 PM Marek Vasut  wrote:
>>
>> On 4/28/19 10:47 PM, Jagan Teki wrote:
>>> Mark MXS_SPI has BROKEN, this so the resulting build shows
>>> warning for broken configuration enabled and associated code
>>> will remove in v2019.07 release.
>>
>> But the code is not broken, it works fine, right ?
>
> Yes the code work fine, but dm conversion not done yet. Now the
> CONFIG_BROKEN can mark the driver configs which doesn't convert dm

 That makes no sense, if the code works, it works and thus it is NOT
 broken. Find some other way to flag it as non-DM-converted, not this 
 hack.
>>>
>>> np, It depends on whether we consider non-dm code(for legacy SPI
>>> drivers) is broken or not, let Tom comment on this.
>>
>> Again, the code works, it's not broken. That's very clear.
>> DM conversion is a separate matter, so let's not overload CONFIG_BROKEN
>> for such things. The Makefile warning seems sufficient to me.
>
> The code is broken because it doesn't work with DM and is going to be
> removed due to lack of maintenance soon.  My problem with this series,
> but I need to check that we can do what I want to do and still keep
> travis green, is have this (and the other non-converted and thus
> non-maintained drivers) depend on, not select BROKEN.

 Yes, the idea here is to build the broken one by selecting BROKEN
 so-that the travis-CI is green and have warning on the build,
 otherwise it is another rework of selecting BROKEN for those
 non-converted drivers if they depends.

>
> The Makefile warnings tell people the code is going to be removed and
> I'm trying to have the window be:
> 1) LOUD warning about needing work
> 2) 1 release past those loud deadlines of the code there, but not built
> unless you enable BROKEN (as yes, I see code that's not updated to use
> DM as being broken)
> 3) Code removed.

 ie what this series does.  Driver (for example) will select BROKEN,
 that means it is still working bu would like to remove in next
 versions and so..
>>>
>>> What I'm after is
>>> https://github.com/trini/u-boot/commits/WIP-BROKEN-test which is close,
>>> but not quite there.  We no longer build the drivers marked as BROKEN by
>>> default, and the fallout from that has been:
>>> - Some missing dependencies (I'm trying to fix that now) leading to
>>>   build problems.
>>> - Needing to yank CONFIG_SPI for example from configs that had been
>>>   using a now-not-built driver as the subsystem fails to link if there's
>>>   no controller.  I don't think that's a problem however.
>>> - Needing to migrate a few more symbols to Kconfig in order to be able
>>>   to properly express "You need to depend on BROKEN to use this option
>>>   now".
>>
>> I still disagree with marking drivers that need DM conversion, but are
>> otherwise working perfectly fine, as broken. That's just misleading and
>> in fact incorrect. Invent some new, more descriptive Kconfig option please.
> 
> I also still disagree, but, fine, I'll add  CONFIG_DEPRECATED.

CONFIG_DM_NEED_MIGRATION or something ?

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


Re: [U-Boot] [PATCH 4/8] spi: Kconfig: Mark MXS_SPI has BROKEN

2019-05-14 Thread Tom Rini
On Tue, May 14, 2019 at 07:33:17PM +0200, Marek Vasut wrote:
> On 5/14/19 4:45 PM, Tom Rini wrote:
> > On Tue, May 14, 2019 at 07:46:06PM +0530, Jagan Teki wrote:
> >> On Mon, Apr 29, 2019 at 4:54 PM Tom Rini  wrote:
> >>>
> >>> On Mon, Apr 29, 2019 at 01:06:57PM +0200, Marek Vasut wrote:
>  On 4/29/19 1:02 PM, Jagan Teki wrote:
> > On Mon, Apr 29, 2019 at 4:28 PM Marek Vasut  wrote:
> >>
> >> On 4/29/19 12:40 PM, Jagan Teki wrote:
> >>> On Mon, Apr 29, 2019 at 3:24 PM Marek Vasut  wrote:
> 
>  On 4/28/19 10:47 PM, Jagan Teki wrote:
> > Mark MXS_SPI has BROKEN, this so the resulting build shows
> > warning for broken configuration enabled and associated code
> > will remove in v2019.07 release.
> 
>  But the code is not broken, it works fine, right ?
> >>>
> >>> Yes the code work fine, but dm conversion not done yet. Now the
> >>> CONFIG_BROKEN can mark the driver configs which doesn't convert dm
> >>
> >> That makes no sense, if the code works, it works and thus it is NOT
> >> broken. Find some other way to flag it as non-DM-converted, not this 
> >> hack.
> >
> > np, It depends on whether we consider non-dm code(for legacy SPI
> > drivers) is broken or not, let Tom comment on this.
> 
>  Again, the code works, it's not broken. That's very clear.
>  DM conversion is a separate matter, so let's not overload CONFIG_BROKEN
>  for such things. The Makefile warning seems sufficient to me.
> >>>
> >>> The code is broken because it doesn't work with DM and is going to be
> >>> removed due to lack of maintenance soon.  My problem with this series,
> >>> but I need to check that we can do what I want to do and still keep
> >>> travis green, is have this (and the other non-converted and thus
> >>> non-maintained drivers) depend on, not select BROKEN.
> >>
> >> Yes, the idea here is to build the broken one by selecting BROKEN
> >> so-that the travis-CI is green and have warning on the build,
> >> otherwise it is another rework of selecting BROKEN for those
> >> non-converted drivers if they depends.
> >>
> >>>
> >>> The Makefile warnings tell people the code is going to be removed and
> >>> I'm trying to have the window be:
> >>> 1) LOUD warning about needing work
> >>> 2) 1 release past those loud deadlines of the code there, but not built
> >>> unless you enable BROKEN (as yes, I see code that's not updated to use
> >>> DM as being broken)
> >>> 3) Code removed.
> >>
> >> ie what this series does.  Driver (for example) will select BROKEN,
> >> that means it is still working bu would like to remove in next
> >> versions and so..
> > 
> > What I'm after is
> > https://github.com/trini/u-boot/commits/WIP-BROKEN-test which is close,
> > but not quite there.  We no longer build the drivers marked as BROKEN by
> > default, and the fallout from that has been:
> > - Some missing dependencies (I'm trying to fix that now) leading to
> >   build problems.
> > - Needing to yank CONFIG_SPI for example from configs that had been
> >   using a now-not-built driver as the subsystem fails to link if there's
> >   no controller.  I don't think that's a problem however.
> > - Needing to migrate a few more symbols to Kconfig in order to be able
> >   to properly express "You need to depend on BROKEN to use this option
> >   now".
> 
> I still disagree with marking drivers that need DM conversion, but are
> otherwise working perfectly fine, as broken. That's just misleading and
> in fact incorrect. Invent some new, more descriptive Kconfig option please.

I also still disagree, but, fine, I'll add  CONFIG_DEPRECATED.

-- 
Tom


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


Re: [U-Boot] [PATCH 4/8] spi: Kconfig: Mark MXS_SPI has BROKEN

2019-05-14 Thread Marek Vasut
On 5/14/19 4:45 PM, Tom Rini wrote:
> On Tue, May 14, 2019 at 07:46:06PM +0530, Jagan Teki wrote:
>> On Mon, Apr 29, 2019 at 4:54 PM Tom Rini  wrote:
>>>
>>> On Mon, Apr 29, 2019 at 01:06:57PM +0200, Marek Vasut wrote:
 On 4/29/19 1:02 PM, Jagan Teki wrote:
> On Mon, Apr 29, 2019 at 4:28 PM Marek Vasut  wrote:
>>
>> On 4/29/19 12:40 PM, Jagan Teki wrote:
>>> On Mon, Apr 29, 2019 at 3:24 PM Marek Vasut  wrote:

 On 4/28/19 10:47 PM, Jagan Teki wrote:
> Mark MXS_SPI has BROKEN, this so the resulting build shows
> warning for broken configuration enabled and associated code
> will remove in v2019.07 release.

 But the code is not broken, it works fine, right ?
>>>
>>> Yes the code work fine, but dm conversion not done yet. Now the
>>> CONFIG_BROKEN can mark the driver configs which doesn't convert dm
>>
>> That makes no sense, if the code works, it works and thus it is NOT
>> broken. Find some other way to flag it as non-DM-converted, not this 
>> hack.
>
> np, It depends on whether we consider non-dm code(for legacy SPI
> drivers) is broken or not, let Tom comment on this.

 Again, the code works, it's not broken. That's very clear.
 DM conversion is a separate matter, so let's not overload CONFIG_BROKEN
 for such things. The Makefile warning seems sufficient to me.
>>>
>>> The code is broken because it doesn't work with DM and is going to be
>>> removed due to lack of maintenance soon.  My problem with this series,
>>> but I need to check that we can do what I want to do and still keep
>>> travis green, is have this (and the other non-converted and thus
>>> non-maintained drivers) depend on, not select BROKEN.
>>
>> Yes, the idea here is to build the broken one by selecting BROKEN
>> so-that the travis-CI is green and have warning on the build,
>> otherwise it is another rework of selecting BROKEN for those
>> non-converted drivers if they depends.
>>
>>>
>>> The Makefile warnings tell people the code is going to be removed and
>>> I'm trying to have the window be:
>>> 1) LOUD warning about needing work
>>> 2) 1 release past those loud deadlines of the code there, but not built
>>> unless you enable BROKEN (as yes, I see code that's not updated to use
>>> DM as being broken)
>>> 3) Code removed.
>>
>> ie what this series does.  Driver (for example) will select BROKEN,
>> that means it is still working bu would like to remove in next
>> versions and so..
> 
> What I'm after is
> https://github.com/trini/u-boot/commits/WIP-BROKEN-test which is close,
> but not quite there.  We no longer build the drivers marked as BROKEN by
> default, and the fallout from that has been:
> - Some missing dependencies (I'm trying to fix that now) leading to
>   build problems.
> - Needing to yank CONFIG_SPI for example from configs that had been
>   using a now-not-built driver as the subsystem fails to link if there's
>   no controller.  I don't think that's a problem however.
> - Needing to migrate a few more symbols to Kconfig in order to be able
>   to properly express "You need to depend on BROKEN to use this option
>   now".

I still disagree with marking drivers that need DM conversion, but are
otherwise working perfectly fine, as broken. That's just misleading and
in fact incorrect. Invent some new, more descriptive Kconfig option please.

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


Re: [U-Boot] [PATCH 3/4] fs: fat: allocate a new cluster for root directory of fat32

2019-05-14 Thread Heinrich Schuchardt

On 5/13/19 7:49 AM, AKASHI Takahiro wrote:

Contrary to fat12/16, fat32 can have root directory at any location
and its size can be expanded.
Without this patch, root directory won't grow properly and so we will
eventually fail to add files under root directory. Please note that this
can happen even if you delete many files as deleted directory entries
are not reclaimed but just marked as "deleted" under the current
implementation.

Signed-off-by: AKASHI Takahiro 


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


Re: [U-Boot] [PATCH 2/4] fs: fat: flush a directory cluster properly

2019-05-14 Thread Heinrich Schuchardt

On 5/13/19 7:49 AM, AKASHI Takahiro wrote:

When a long name directory entry is created, multiple directory entries
may be occupied across a directory cluster boundary. Since only one
directory cluster is cached in a directory iterator, a first cluster must
be written back to device before switching over a second cluster.

Without this patch, some added files may be lost even if you don't see
any failures on write operation.

Signed-off-by: AKASHI Takahiro 


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


Re: [U-Boot] [PATCH 1/4] fs: fat: write to non-cluster-aligned root directory

2019-05-14 Thread Heinrich Schuchardt

On 5/13/19 7:49 AM, AKASHI Takahiro wrote:

With the commit below, fat now correctly handles a file read under
a non-cluster-aligned root directory of fat12/16.
Write operation should be fixed in the same manner.

Fixes: commit 9b18358dc05d ("fs: fat: fix reading non-cluster-aligned
root directory")
Signed-off-by: AKASHI Takahiro 
Cc: Anssi Hannula 


Thanks a lot for addressing this.


---
  fs/fat/fat.c   | 15 -
  fs/fat/fat_write.c | 78 +++---
  2 files changed, 61 insertions(+), 32 deletions(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index c5997c21735f..fccaa385d187 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -619,13 +619,14 @@ static int get_fs_info(fsdata *mydata)
return -1;
}

-   debug("FAT%d, fat_sect: %d, fatlength: %d\n",
-  mydata->fatsize, mydata->fat_sect, mydata->fatlength);
-   debug("Rootdir begins at cluster: %d, sector: %d, offset: %x\n"
-  "Data begins at: %d\n",
-  mydata->root_cluster,
-  mydata->rootdir_sect,
-  mydata->rootdir_sect * mydata->sect_size, mydata->data_begin);
+   debug("FAT%d, fat_sect: %d, fatlength: %d, num: %d\n",
+ mydata->fatsize, mydata->fat_sect, mydata->fatlength,
+ mydata->fats);
+   debug("Rootdir begins at cluster: %d, sector: %d, size: %x\n"
+ "Data begins at: %d\n",
+ mydata->root_cluster,
+ mydata->rootdir_sect,
+ mydata->rootdir_size * mydata->sect_size, mydata->data_begin);


This seems to be an unrelated change. It should be either in a separate
patch or the commit message should explain why it is related.

Tested-by: Heinrich Schuchardt 


debug("Sector size: %d, cluster size: %d\n", mydata->sect_size,
  mydata->clust_size);

diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 852f874e5817..3bc0dd637521 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -388,29 +388,23 @@ static __u32 determine_fatent(fsdata *mydata, __u32 entry)
  }

  /**
- * set_cluster() - write data to cluster
+ * set_sectors() - write data to sectors
   *
- * Write 'size' bytes from 'buffer' into the specified cluster.
+ * Write 'size' bytes from 'buffer' into the specified sector.
   *
   * @mydata:   data to be written
- * @clustnum:  cluster to be written to
+ * @startsect: sector to be written to
   * @buffer:   data to be written
   * @size: bytes to be written (but not more than the size of a cluster)
   * Return:0 on success, -1 otherwise
   */
  static int
-set_cluster(fsdata *mydata, u32 clustnum, u8 *buffer, u32 size)
+set_sectors(fsdata *mydata, u32 startsect, u8 *buffer, u32 size)
  {
-   u32 idx = 0;
-   u32 startsect;
+   u32 nsects = 0;
int ret;

-   if (clustnum > 0)
-   startsect = clust_to_sect(mydata, clustnum);
-   else
-   startsect = mydata->rootdir_sect;
-
-   debug("clustnum: %d, startsect: %d\n", clustnum, startsect);
+   debug("startsect: %d\n", startsect);

if ((unsigned long)buffer & (ARCH_DMA_MINALIGN - 1)) {
ALLOC_CACHE_ALIGN_BUFFER(__u8, tmpbuf, mydata->sect_size);
@@ -429,17 +423,16 @@ set_cluster(fsdata *mydata, u32 clustnum, u8 *buffer, u32 
size)
size -= mydata->sect_size;
}
} else if (size >= mydata->sect_size) {
-   idx = size / mydata->sect_size;
-   ret = disk_write(startsect, idx, buffer);
-   if (ret != idx) {
+   nsects = size / mydata->sect_size;
+   ret = disk_write(startsect, nsects, buffer);
+   if (ret != nsects) {
debug("Error writing data (got %d)\n", ret);
return -1;
}

-   startsect += idx;
-   idx *= mydata->sect_size;
-   buffer += idx;
-   size -= idx;
+   startsect += nsects;
+   buffer += nsects * mydata->sect_size;
+   size -= nsects * mydata->sect_size;
}

if (size) {
@@ -457,6 +450,44 @@ set_cluster(fsdata *mydata, u32 clustnum, u8 *buffer, u32 
size)
return 0;
  }

+/**
+ * set_cluster() - write data to cluster
+ *
+ * Write 'size' bytes from 'buffer' into the specified cluster.
+ *
+ * @mydata:data to be written
+ * @clustnum:  cluster to be written to
+ * @buffer:data to be written
+ * @size:  bytes to be written (but not more than the size of a cluster)
+ * Return: 0 on success, -1 otherwise
+ */
+static int
+set_cluster(fsdata *mydata, u32 clustnum, u8 *buffer, u32 size)
+{
+   return set_sectors(mydata, clust_to_sect(mydata, clustnum),
+  buffer, size);
+}
+
+static int
+flush_dir(fat_itr *itr)
+{
+   fsdata *mydata = itr->fsdata;
+   u32 startsect, sect_offset, nsects;
+
+   if (!itr->is_root || mydata->fatsize =

Re: [U-Boot] [PATCH v3 02/10] spi: Add Atmel QuadSPI driver

2019-05-14 Thread Tudor.Ambarus


On 05/14/2019 01:26 PM, Tudor Ambarus - M18064 wrote:
> From: Tudor Ambarus 
> 
> Backport the driver from linux v5.1-rc5 and adapt it for u-boot.
> Tested on sama5d2_xplained Rev B with mx25l25635e spi-nor flash.
> 
> Signed-off-by: Tudor Ambarus 
> ---
> v3: no change
> v2: no change
> 
>  drivers/spi/Kconfig |   7 +
>  drivers/spi/Makefile|   1 +
>  drivers/spi/atmel-quadspi.c | 535 
> 
>  3 files changed, 543 insertions(+)
>  create mode 100644 drivers/spi/atmel-quadspi.c
> 
> diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
> index dc3e23f353aa..69c2f92c7826 100644
> --- a/drivers/spi/Kconfig
> +++ b/drivers/spi/Kconfig
> @@ -49,6 +49,13 @@ config ATH79_SPI
> uses driver model and requires a device tree binding to operate.
> please refer to doc/device-tree-bindings/spi/spi-ath79.txt.
>  
> +config ATMEL_QSPI
> + bool "Atmel QSPI driver"

"Atmel Quad SPI Controller"

> + depends on ARCH_AT91
> + help
> +   Enable the Ateml Quad-SPI (QSPI) driver. This driver can only be
> +   used to access SPI NOR flashes.

The description is wrong, I'll submit a new version if everything else looks ok.
This should have been:

  This enables support for the Quad SPI controller in master mode.
  This driver does not support generic SPI. The implementation only
  supports spi-mem interface.

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


Re: [U-Boot] sun50i: a64: Beelink GS1 box is likely broken

2019-05-14 Thread Clément Péron
Hi Jonas,

On Tue, 14 May 2019 at 17:41, Jonas Smedegaard  wrote:
>
> I notice that the patch to initially support Beelink GS1 was proposed
> before git commit f89d613 changing location of CONFIG_SPL_TEXT_BASE but
> was applied _after_ that commit.
>
> This is similar to the introduction of Olimex Teres-I which currently
> succeed to build but the resulting code is completely useless.  I
> provided a patch for that earlier today, and recommend that someone with
> access to Beelink GS1 checks if a similar patch is needed for that
> device.

Thanks for noticing.

I will have a look at it.

Regards,
Clement


>
>
>  - Jonas
>
> --
>  * Jonas Smedegaard - idealist & Internet-arkitekt
>  * Tlf.: +45 40843136  Website: http://dr.jones.dk/
>
>  [x] quote me freely  [ ] ask before reusing  [ ] keep private
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] sysreset: move stm32mp sysreset poweroff implementation to sysreset uclass

2019-05-14 Thread Patrice CHOTARD
Hi Urja

This patch doesn't compile using the stm32mp15_trusted_defconfig
configuration:

...
  LD  drivers/pinctrl/built-in.o
  LD  drivers/core/built-in.o
  LD  drivers/mmc/built-in.o
  LD  drivers/built-in.o
drivers/sysreset/built-in.o: In function `do_poweroff':
/local/home/nxp11987/projects/community/u-boot.denx/drivers/sysreset/sysreset-uclass.c:123:
multiple definition of `do_poweroff'
drivers/firmware/built-in.o:/local/home/nxp11987/projects/community/u-boot.denx/drivers/firmware/psci.c:134:
first defined here
make[1]: *** [drivers/built-in.o] Error 1
make: *** [drivers] Error 2
build error !!


I suggest you to update your patch with :

config PMIC_STPMIC1
bool "Enable support for STMicroelectronics STPMIC1 PMIC"
depends on DM_PMIC && DM_I2C
-   select SYSRESET_CMD_POWEROFF if CMD_POWEROFF
+   select SYSRESET_CMD_POWEROFF if CMD_POWEROFF && !ARM_PSCI_FW
---help---
The STPMIC1 PMIC provides 4 BUCKs, 6 LDOs, 1 VREF and 2 power switches.
It is accessed via an I2C interface. The device is used with STM32MP1
SoCs. This driver implements register read/write operations.


On 5/13/19 2:17 PM, Urja Rannikko wrote:
> This is a generic implementation. Add CONFIG_SYSRESET_CMD_POWEROFF
> to signal when we need it. Enable it from the STPMIC1 config and in
> sandbox.
> 
> The config flag is transitionary, that is it can be removed after all
> poweroff implementations use sysreset, and just have CMD_POWEROFF depend
> on sysreset.
> 
> Signed-off-by: Urja Rannikko 
> ---
> Note: I cant test STM32MP, so I would really appreciate if someone could
> test this series on that.
> ---
>  arch/Kconfig |  1 +
>  arch/arm/mach-stm32mp/Makefile   |  3 ---
>  arch/arm/mach-stm32mp/cmd_poweroff.c | 24 
>  drivers/power/pmic/Kconfig   |  1 +
>  drivers/sysreset/Kconfig | 10 ++
>  drivers/sysreset/sysreset-uclass.c   | 18 ++
>  6 files changed, 30 insertions(+), 27 deletions(-)
>  delete mode 100644 arch/arm/mach-stm32mp/cmd_poweroff.c
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index 239289b885..83ff21dfd7 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -91,6 +91,7 @@ config SANDBOX
>   select LZO
>   select SPI
>   select SUPPORT_OF_CONTROL
> + select SYSRESET_CMD_POWEROFF if CMD_POWEROFF
>   imply BITREVERSE
>   select BLOBLIST
>   imply CMD_DM
> diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile
> index 1493914a11..f59ced5ee1 100644
> --- a/arch/arm/mach-stm32mp/Makefile
> +++ b/arch/arm/mach-stm32mp/Makefile
> @@ -11,9 +11,6 @@ ifdef CONFIG_SPL_BUILD
>  obj-y += spl.o
>  else
>  obj-y += bsec.o
> -ifndef CONFIG_STM32MP1_TRUSTED
> -obj-$(CONFIG_SYSRESET) += cmd_poweroff.o
> -endif
>  endif
>  obj-$(CONFIG_ARMV7_PSCI) += psci.o
>  obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o
> diff --git a/arch/arm/mach-stm32mp/cmd_poweroff.c 
> b/arch/arm/mach-stm32mp/cmd_poweroff.c
> deleted file mode 100644
> index 62347425a0..00
> --- a/arch/arm/mach-stm32mp/cmd_poweroff.c
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
> -/*
> - * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
> - */
> -
> -#include 
> -#include 
> -#include 
> -
> -int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> -{
> - int ret;
> -
> - puts("poweroff ...\n");
> - mdelay(100);
> -
> - ret = sysreset_walk(SYSRESET_POWER_OFF);
> -
> - if (ret == -EINPROGRESS)
> - mdelay(1000);
> -
> - /*NOTREACHED when power off*/
> - return CMD_RET_FAILURE;
> -}
> diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
> index b0cd260354..5c6c045fad 100644
> --- a/drivers/power/pmic/Kconfig
> +++ b/drivers/power/pmic/Kconfig
> @@ -234,6 +234,7 @@ config DM_PMIC_TPS65910
>  config PMIC_STPMIC1
>   bool "Enable support for STMicroelectronics STPMIC1 PMIC"
>   depends on DM_PMIC && DM_I2C
> + select SYSRESET_CMD_POWEROFF if CMD_POWEROFF
>   ---help---
>   The STPMIC1 PMIC provides 4 BUCKs, 6 LDOs, 1 VREF and 2 power switches.
>   It is accessed via an I2C interface. The device is used with STM32MP1
> diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
> index 30aed2c4c1..4c883923bf 100644
> --- a/drivers/sysreset/Kconfig
> +++ b/drivers/sysreset/Kconfig
> @@ -33,6 +33,16 @@ config TPL_SYSRESET
>  
>  if SYSRESET
>  
> +if CMD_POWEROFF
> +
> +config SYSRESET_CMD_POWEROFF
> + bool "sysreset implementation of the poweroff command"
> + help
> +   This should be selected by the appropriate PMIC driver if
> +   the poweroff command is enabled.
> +
> +endif
> +
>  config SYSRESET_GPIO
>   bool "Enable support for GPIO reset driver"
>   select DM_GPIO
> diff --git a/drivers/sysreset/sysreset-uclass.c 
> b/drivers/sysreset/sysreset-uclass.c
> index ad831c703a..

Re: [U-Boot] [PATCH v3 1/2] arm64: zynqmp: spl: install a PMU firmware config object at runtime

2019-05-14 Thread Michal Simek
On 14. 05. 19 8:06, Luca Ceresoli wrote:
> Hi Michal, All,
> 
> On 07/05/19 16:11, Luca Ceresoli wrote:
>> Hi,
>>
>> On 06/05/19 17:56, Michal Simek wrote:
>>> Hi,
>>>
>>> snip.
>>>
>> +$(obj)/pm_cfg_obj.o: $(obj)/pm_cfg_obj.bin
>> +
>> +CFLAGS_zynqmp.o += -DZYNQMP_LOAD_PM_CFG_OBJ
>
> I am no fan of passing another object. you have
> CONFIG_ZYNQMP_LOAD_PM_CFG_OBJ_FILE already and this can be used instead.

 Not sure I got your point here. I'm not passing an object, just setting
 a define (without value). This is used to enable code under #ifdef in C
 files.
>>>
>>> Sorry I meant new config option. It should be enough to use CFG_OBJ_FILE
>>> everywhere and not create another config option which is just used the
>>> same way.
>>
>> I totally agree. But I would need to check whether
>> CONFIG_ZYNQMP_LOAD_PM_CFG_OBJ_FILE is empty or not, and I don't think
>> the C preprocessor can do that.
> 
> Any news on this issue? It's the only issue still open on this series,
> and as said, I don't think there's a way to avoid the extra define. As
> such, unless a smart solution emerges suddenly, I'm sending v4 in one or
> two days with all the other issues fixed.

I didn't spend any time on this. Try to grep it. If you don't file
anything please add there TODO and let's fix it in future.

Thanks,
Michal

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


[U-Boot] sun50i: a64: Beelink GS1 box is likely broken

2019-05-14 Thread Jonas Smedegaard
I notice that the patch to initially support Beelink GS1 was proposed 
before git commit f89d613 changing location of CONFIG_SPL_TEXT_BASE but 
was applied _after_ that commit.

This is similar to the introduction of Olimex Teres-I which currently 
succeed to build but the resulting code is completely useless.  I 
provided a patch for that earlier today, and recommend that someone with 
access to Beelink GS1 checks if a similar patch is needed for that 
device.


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private


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


Re: [U-Boot] [PATCH 1/1] pci: pci_mvebu: fix bus enumeration if some buses have empty slots

2019-05-14 Thread Marek Behún
The documentation for the uclass_next_device says this:

  @devp: On entry, pointer to device to lookup. On exit, returns pointer
  to the next device in the uclass if no error occurred, or NULL if
  there is no next device, or an error occurred with that next device.

But this is useless, because if an error occured with that next device,
the iteration stops and devices which should work won't be probed.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [linux-sunxi] [PATCH v3 3/3] arm: sunxi: h6: fix reset using r_wdog

2019-05-14 Thread Clément Péron
Hi Jagan,

On Tue, 14 May 2019 at 15:49, Jagan Teki  wrote:
>
> On Wed, Apr 17, 2019 at 11:11 PM Clément Péron  wrote:
> >
> > WDOG is broken for some H6 rev. The board is not
> > reseted correctly.
> >
> > Use the R_WDOG instead.
>
> Can you describe the proper issue why it broken? this would really
> help us to understand and future reference.

I would like but I don't have much information on it.
If I take the information in my 2nd email is it ok for you ?

Something like this
"
Some H6 boards have a watchdog which didn't make the SoC reboot properly.
Reason is still unknown but several people have test it.
Chen-Yu Tsai :
Pine H64 = H6 V200-AWIN H6448BA 7782 => OK
OrangePi Lite 2 = H6 V200-AWIN H8068BA 61C2 => KO

Martin Ayotte :
Pine H64 = H8069BA 6892 => OK
OrangePi 3 = HA047BA 69W2 => KO
OrangePi One Plus = H7310BA 6842 => KO
OrangePi Lite2 = H6448BA 6662 => KO

Clément Péron:
Beelink GS1 = H6 V200-AWIN H7309BA 6842 => KO

After the series of result, Icenowy try to reach Allwinner about this
issue but they seems not interested to investigate it.

As we don't have the ARIS coproc to do power management and watchdogis
the only solution to reset the board.
Change from watchdog to R_watchdog to allow a reboot on all H6 boards.
"

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


Re: [U-Boot] [PATCH 1/1] pci: pci_mvebu: fix bus enumeration if some buses have empty slots

2019-05-14 Thread Marek Behún
On Tue, 14 May 2019 16:58:59 +0200
Marek Behún  wrote:

> The ofdata_to_platdata method for this driver returns -ENODEV if link
> is down for a given bus, for example if there is no device in the
> slot. This causes the uclass_{first,next}_device to return NULL for
> this bus in pci-uclass.c:pci_init, which of course stops probing of
> buses which come after.
> 
> So if the slot on the first bus is empty on Turris Omnia, and the slot
> on second bus has a device connected, the device is not probed in
> U-Boot. On Turris Omnia the PCIe devices have to be probed in U-Boot
> to work correctly in Linux. Therefore we need this fix.
> 
...
>   if (!mvebu_pcie_link_up(pcie)) {
>   debug("%s: %s - down\n", __func__, pcie->name);
> - ret = -ENODEV;
>   goto err;
>   }
>  

The problem is how uclass_{first,next}_device functions work.

They use helpers uclass_find_{first,next}_device, which iterate all
devices. But uclass_{first,next}_device functions also use
uclass_get_device_tail on the device returned by helper. This function
can return NULL if device failed to probe, which causes the iteration
to stop.

Wouldn't it be better if uclass_next_device tried iterating via
uclass_find_next_device until a device was found which probed
successfully?

I don't know if this would break other things in U-Boot though.

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


Re: [U-Boot] [PATCH v3 1/2] arm64: zynqmp: spl: install a PMU firmware config object at runtime

2019-05-14 Thread Luca Ceresoli
Hi Michal, All,

On 07/05/19 16:11, Luca Ceresoli wrote:
> Hi,
> 
> On 06/05/19 17:56, Michal Simek wrote:
>> Hi,
>>
>> snip.
>>
> +$(obj)/pm_cfg_obj.o: $(obj)/pm_cfg_obj.bin
> +
> +CFLAGS_zynqmp.o += -DZYNQMP_LOAD_PM_CFG_OBJ

 I am no fan of passing another object. you have
 CONFIG_ZYNQMP_LOAD_PM_CFG_OBJ_FILE already and this can be used instead.
>>>
>>> Not sure I got your point here. I'm not passing an object, just setting
>>> a define (without value). This is used to enable code under #ifdef in C
>>> files.
>>
>> Sorry I meant new config option. It should be enough to use CFG_OBJ_FILE
>> everywhere and not create another config option which is just used the
>> same way.
> 
> I totally agree. But I would need to check whether
> CONFIG_ZYNQMP_LOAD_PM_CFG_OBJ_FILE is empty or not, and I don't think
> the C preprocessor can do that.

Any news on this issue? It's the only issue still open on this series,
and as said, I don't think there's a way to avoid the extra define. As
such, unless a smart solution emerges suddenly, I'm sending v4 in one or
two days with all the other issues fixed.

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


[U-Boot] [PULL] u-boot-stm32 for v2019.07​ (round 3)​

2019-05-14 Thread Patrice CHOTARD
Hi Tom

Please find the pull request for STM32 round 3

The following changes since commit a69120a0d7c8d4044cdaceea9eb03913ba4e49c7:

  Prepare v2019.07-rc1 (2019-04-29 21:54:04 -0400)

are available in the git repository at:

  https://github.com/pchotard/u-boot.git tags/u-boot-stm32-mcu-20190514

for you to fetch changes up to 1aaac8e60042b1e132f84184cfd9aa0f1a4afdde:

  configs: stm32f469-disco: Disable PINCTRL_FULL flag (2019-05-06
11:15:16 +0200)


STM32 MCUs update:
_ Add MPU region for SPI NOR memory mapped region
_ Add missing QSPI flash compatible for STM32 F7 boards
_ Update spi-tx-bus-width and spi-rx-bus-width properties
_ Add QSPI support for STM32F469 Discovery board


Patrice Chotard (12):
  mach-stm32: Add MPU region for spi-nor memory mapped region
  ARM: dts: stm32: Fix qspi memory map size for stm32f7 boards
  ARM: dts: stm32: add qspi flash compatible string for stm32f769-disco
  ARM: dts: stm32: add qspi flash compatible string for stm32f746-eval
  ARM: dts: stm32: Set spi-rx/tx-bus-width to 4 for stm32f746-eval
  ARM: dts: stm32: Set spi-rx/tx-bus-width to 4 for stm32f746-disco
  ARM: dts: stm32: Remove useless spi-nor compatible string
  ARM: dts: stm32: Set spi-rx/tx-bus-width to 4 for stm32f769-disco
  ARM: dts: stm32: Add qspi support for stm32f469-disco board
  spi: Kconfig: Add STM32F4 support for STM32_QSPI driver
  configs: stm32f469-disco: Enable QSPI relative flags
  configs: stm32f469-disco: Disable PINCTRL_FULL flag

 arch/arm/dts/stm32746g-eval-u-boot.dtsi  |  6 +++--
 arch/arm/dts/stm32f469-disco-u-boot.dtsi | 39

 arch/arm/dts/stm32f746-disco-u-boot.dtsi |  8 +++
 arch/arm/dts/stm32f769-disco-u-boot.dtsi |  3 +++
 arch/arm/mach-stm32/soc.c|  3 +++
 configs/stm32f469-discovery_defconfig|  9 
 drivers/spi/Kconfig  |  2 +-
 7 files changed, 63 insertions(+), 7 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/1] pci: pci_mvebu: fix bus enumeration if some buses have empty slots

2019-05-14 Thread Marek Behún
The ofdata_to_platdata method for this driver returns -ENODEV if link is
down for a given bus, for example if there is no device in the slot.
This causes the uclass_{first,next}_device to return NULL for this bus
in pci-uclass.c:pci_init, which of course stops probing of buses which
come after.

So if the slot on the first bus is empty on Turris Omnia, and the slot
on second bus has a device connected, the device is not probed in
U-Boot. On Turris Omnia the PCIe devices have to be probed in U-Boot to
work correctly in Linux. Therefore we need this fix.

Signed-off-by: Marek Behún 
Cc: Stefan Roese 
Cc: Anton Schubert 
Cc: Dirk Eibach 
Cc: Mario Six 
Cc: Chris Packham 
Cc: Phil Sutter 
Cc: VlaoMao 
---
 drivers/pci/pci_mvebu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
index 653f445a0f..7ec6a2be27 100644
--- a/drivers/pci/pci_mvebu.c
+++ b/drivers/pci/pci_mvebu.c
@@ -436,7 +436,6 @@ static int mvebu_pcie_ofdata_to_platdata(struct udevice 
*dev)
/* Check link and skip ports that have no link */
if (!mvebu_pcie_link_up(pcie)) {
debug("%s: %s - down\n", __func__, pcie->name);
-   ret = -ENODEV;
goto err;
}
 
-- 
2.21.0

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


Re: [U-Boot] [PATCH 2/2] opos6uldev: remove board_ehci_hcd_init function

2019-05-14 Thread Sébastien Szymanski
Hi Fabio,

On 5/14/19 2:17 PM, Fabio Estevam wrote:
> On Tue, May 14, 2019 at 8:48 AM Sébastien Szymanski
>  wrote:
>>
>> It's useless on the opos6uldev. Remove it.
> 
> Why is it useless? No USB host on this port?

There is an USB host port but this function was just setting the
polarity of the PWR signal which is not used on the opos6uldev board.

I guess I should send a v2 with that explanation.

Regards,

> 
> Reviewed-by: Fabio Estevam 
> 


-- 
Sébastien Szymanski
Software engineer, Armadeus Systems
Tel: +33 (0)9 72 29 41 44
Fax: +33 (0)9 72 28 79 26
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] sun50i: a64: Fix broken A64-Teres-I board config

2019-05-14 Thread Jonas Smedegaard
Set CONFIG_SPL_TEXT_BASE in teres_i_defconfig
(see commit f89d6133ee)

Tested-by: Jonas Smedegaard 
Signed-off-by: Jonas Smedegaard 
---

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

diff --git a/configs/teres_i_defconfig b/configs/teres_i_defconfig
index 421a8d3d40..1b57a48712 100644
--- a/configs/teres_i_defconfig
+++ b/configs/teres_i_defconfig
@@ -7,6 +7,7 @@ CONFIG_DRAM_ZQ=3881949
 CONFIG_MMC_SUNXI_SLOT_EXTRA=2
 CONFIG_USB1_VBUS_PIN="PL7"
 CONFIG_I2C0_ENABLE=y
+CONFIG_SPL_TEXT_BASE=0x10060
 # CONFIG_CMD_FLASH is not set
 # CONFIG_SPL_DOS_PARTITION is not set
 # CONFIG_SPL_EFI_PARTITION is not set
-- 
2.20.1



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


Re: [U-Boot] [PATCH 4/8] spi: Kconfig: Mark MXS_SPI has BROKEN

2019-05-14 Thread Tom Rini
On Tue, May 14, 2019 at 07:46:06PM +0530, Jagan Teki wrote:
> On Mon, Apr 29, 2019 at 4:54 PM Tom Rini  wrote:
> >
> > On Mon, Apr 29, 2019 at 01:06:57PM +0200, Marek Vasut wrote:
> > > On 4/29/19 1:02 PM, Jagan Teki wrote:
> > > > On Mon, Apr 29, 2019 at 4:28 PM Marek Vasut  wrote:
> > > >>
> > > >> On 4/29/19 12:40 PM, Jagan Teki wrote:
> > > >>> On Mon, Apr 29, 2019 at 3:24 PM Marek Vasut  wrote:
> > > 
> > >  On 4/28/19 10:47 PM, Jagan Teki wrote:
> > > > Mark MXS_SPI has BROKEN, this so the resulting build shows
> > > > warning for broken configuration enabled and associated code
> > > > will remove in v2019.07 release.
> > > 
> > >  But the code is not broken, it works fine, right ?
> > > >>>
> > > >>> Yes the code work fine, but dm conversion not done yet. Now the
> > > >>> CONFIG_BROKEN can mark the driver configs which doesn't convert dm
> > > >>
> > > >> That makes no sense, if the code works, it works and thus it is NOT
> > > >> broken. Find some other way to flag it as non-DM-converted, not this 
> > > >> hack.
> > > >
> > > > np, It depends on whether we consider non-dm code(for legacy SPI
> > > > drivers) is broken or not, let Tom comment on this.
> > >
> > > Again, the code works, it's not broken. That's very clear.
> > > DM conversion is a separate matter, so let's not overload CONFIG_BROKEN
> > > for such things. The Makefile warning seems sufficient to me.
> >
> > The code is broken because it doesn't work with DM and is going to be
> > removed due to lack of maintenance soon.  My problem with this series,
> > but I need to check that we can do what I want to do and still keep
> > travis green, is have this (and the other non-converted and thus
> > non-maintained drivers) depend on, not select BROKEN.
> 
> Yes, the idea here is to build the broken one by selecting BROKEN
> so-that the travis-CI is green and have warning on the build,
> otherwise it is another rework of selecting BROKEN for those
> non-converted drivers if they depends.
> 
> >
> > The Makefile warnings tell people the code is going to be removed and
> > I'm trying to have the window be:
> > 1) LOUD warning about needing work
> > 2) 1 release past those loud deadlines of the code there, but not built
> > unless you enable BROKEN (as yes, I see code that's not updated to use
> > DM as being broken)
> > 3) Code removed.
> 
> ie what this series does.  Driver (for example) will select BROKEN,
> that means it is still working bu would like to remove in next
> versions and so..

What I'm after is
https://github.com/trini/u-boot/commits/WIP-BROKEN-test which is close,
but not quite there.  We no longer build the drivers marked as BROKEN by
default, and the fallout from that has been:
- Some missing dependencies (I'm trying to fix that now) leading to
  build problems.
- Needing to yank CONFIG_SPI for example from configs that had been
  using a now-not-built driver as the subsystem fails to link if there's
  no controller.  I don't think that's a problem however.
- Needing to migrate a few more symbols to Kconfig in order to be able
  to properly express "You need to depend on BROKEN to use this option
  now".

-- 
Tom


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


Re: [U-Boot] [PATCH 4/8] spi: Kconfig: Mark MXS_SPI has BROKEN

2019-05-14 Thread Jagan Teki
On Mon, Apr 29, 2019 at 4:54 PM Tom Rini  wrote:
>
> On Mon, Apr 29, 2019 at 01:06:57PM +0200, Marek Vasut wrote:
> > On 4/29/19 1:02 PM, Jagan Teki wrote:
> > > On Mon, Apr 29, 2019 at 4:28 PM Marek Vasut  wrote:
> > >>
> > >> On 4/29/19 12:40 PM, Jagan Teki wrote:
> > >>> On Mon, Apr 29, 2019 at 3:24 PM Marek Vasut  wrote:
> > 
> >  On 4/28/19 10:47 PM, Jagan Teki wrote:
> > > Mark MXS_SPI has BROKEN, this so the resulting build shows
> > > warning for broken configuration enabled and associated code
> > > will remove in v2019.07 release.
> > 
> >  But the code is not broken, it works fine, right ?
> > >>>
> > >>> Yes the code work fine, but dm conversion not done yet. Now the
> > >>> CONFIG_BROKEN can mark the driver configs which doesn't convert dm
> > >>
> > >> That makes no sense, if the code works, it works and thus it is NOT
> > >> broken. Find some other way to flag it as non-DM-converted, not this 
> > >> hack.
> > >
> > > np, It depends on whether we consider non-dm code(for legacy SPI
> > > drivers) is broken or not, let Tom comment on this.
> >
> > Again, the code works, it's not broken. That's very clear.
> > DM conversion is a separate matter, so let's not overload CONFIG_BROKEN
> > for such things. The Makefile warning seems sufficient to me.
>
> The code is broken because it doesn't work with DM and is going to be
> removed due to lack of maintenance soon.  My problem with this series,
> but I need to check that we can do what I want to do and still keep
> travis green, is have this (and the other non-converted and thus
> non-maintained drivers) depend on, not select BROKEN.

Yes, the idea here is to build the broken one by selecting BROKEN
so-that the travis-CI is green and have warning on the build,
otherwise it is another rework of selecting BROKEN for those
non-converted drivers if they depends.

>
> The Makefile warnings tell people the code is going to be removed and
> I'm trying to have the window be:
> 1) LOUD warning about needing work
> 2) 1 release past those loud deadlines of the code there, but not built
> unless you enable BROKEN (as yes, I see code that's not updated to use
> DM as being broken)
> 3) Code removed.

ie what this series does.  Driver (for example) will select BROKEN,
that means it is still working bu would like to remove in next
versions and so..
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 00/11] dm: Removal of some boards due to DM_MMC deadline

2019-05-14 Thread Tom Rini
On Sun, May 12, 2019 at 01:03:33PM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Sat, 11 May 2019 at 13:36, Tom Rini  wrote:
> >
> > + Peng, the new MMC maintainer
> >
> > On Sat, May 11, 2019 at 01:23:45PM -0600, Simon Glass wrote:
> >
> > > This series starts the process of removing boards which have not been
> > > converted to driver model for MMC.
> >
> > I'm sorry, no.  Like I've been saying in the SPI thread, and I thought I
> > had made clear elsewhere:
> > - This release we move the drivers to depend on BROKEN.  Jagan has a
> >   patch right now that makes BROKEN make another warning happen, but I'm
> >   not 100% sure I like this, but also haven't had a chance to try my
> >   idea of just removing the driver from the build and seeing if the
> >   boards link, or how hard making them link again is.
> > - Next release we can remove the _drivers_ that depend on BROKEN.
> 
> Sorry I must have missed this, have had very little time in the past
> few months. I did see mention of BROKEN elsewhere but had somehow not
> made the connection.
> 
> Could we get a note added to MIGRATION.txt perhaps?

Yes, I should do that.

> > Yes, this will result in a bunch of boards that aren't nearly so
> > functional as they would be expected to be.  This in turn might lead to:
> > - Someone stepping up as they care about the hardware
> > - Removing of the boards down the line when it's clear no one has been
> >   using them as there's a big window where generally key drivers aren't
> >   there anymore.
> 
> Sounds like a great plan, and much better and easier than removal
> (which is a real pain to create patches for).

I've managed to make some progress on top of Jagan's series for SPI
stuff such that after marking things BROKEN (and also after migrating
some options to Kconfig) I can then do a commit that drops a bunch of
SPI-related stuff from defconfigs (move env out of SPI and to nowhere,
drop SPI from the config as there's no SPI controller, etc).  I hope to
finish that up soon so that it builds everything, and then clean it up
enough to post (I realize now that say CMD_SF / CMD_SPI should depend on
SPI_FLASH / SPI for example, and hadn't done that yet).

-- 
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 00/11] dm: Removal of some boards due to DM_MMC deadline

2019-05-14 Thread Tom Rini
On Sun, May 12, 2019 at 02:08:14PM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Sun, 12 May 2019 at 13:03, Simon Glass  wrote:
> >
> > Hi Tom,
> >
> > On Sat, 11 May 2019 at 13:36, Tom Rini  wrote:
> > >
> > > + Peng, the new MMC maintainer
> > >
> > > On Sat, May 11, 2019 at 01:23:45PM -0600, Simon Glass wrote:
> > >
> > > > This series starts the process of removing boards which have not been
> > > > converted to driver model for MMC.
> > >
> > > I'm sorry, no.  Like I've been saying in the SPI thread, and I thought I
> > > had made clear elsewhere:
> > > - This release we move the drivers to depend on BROKEN.  Jagan has a
> > >   patch right now that makes BROKEN make another warning happen, but I'm
> > >   not 100% sure I like this, but also haven't had a chance to try my
> > >   idea of just removing the driver from the build and seeing if the
> > >   boards link, or how hard making them link again is.
> > > - Next release we can remove the _drivers_ that depend on BROKEN.
> >
> > Sorry I must have missed this, have had very little time in the past
> > few months. I did see mention of BROKEN elsewhere but had somehow not
> > made the connection.
> >
> > Could we get a note added to MIGRATION.txt perhaps?
> >
> > >
> > > Yes, this will result in a bunch of boards that aren't nearly so
> > > functional as they would be expected to be.  This in turn might lead to:
> > > - Someone stepping up as they care about the hardware
> > > - Removing of the boards down the line when it's clear no one has been
> > >   using them as there's a big window where generally key drivers aren't
> > >   there anymore.
> >
> > Sounds like a great plan, and much better and easier than removal
> > (which is a real pain to create patches for).
> 
> I've hit a snag though. s32v234evb doesn't even support
> CONFIG_OF_CONTROL. What should we do in that case?

This falls, sadly, into the same category as what to do about large
swaths of PowerPC, and then some other architectures entirely.

-- 
Tom


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


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

2019-05-14 Thread Tom Rini
On Mon, May 13, 2019 at 08:05:34AM +0200, Heinrich Schuchardt wrote:

> The following changes since commit 82da478b8f8ed41ed8bdbd0269da36ef6aaef7e8:
> 
>   Merge branch '2019-05-10-master-imports' (2019-05-10 11:08:48 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-efi.git tags/efi-2019-07-rc3
> 
> for you to fetch changes up to e2d82f8b2a91fb3fa78345f935a93a6db575effa:
> 
>   efi_loader: comments for efi_install_fdt() (2019-05-12 20:54:23 +0200)
> 
> Travis CI:
> https://travis-ci.org/xypron2/u-boot/builds/531491341
> 
> Primary key fingerprint:
> 6DC4 F9C7 1F29 A6FA 06B7  6D33 C481 DBBC 2C05 1AC4
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PULL] u-boot-socfpga/master

2019-05-14 Thread Tom Rini
On Sun, May 12, 2019 at 01:56:20AM +0200, Marek Vasut wrote:

> A10 FPGA programming support, Gen5 livetree conversion
> 
> The following changes since commit 82da478b8f8ed41ed8bdbd0269da36ef6aaef7e8:
> 
>   Merge branch '2019-05-10-master-imports' (2019-05-10 11:08:48 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-socfpga.git master
> 
> for you to fetch changes up to 1b898ffc040b5977a07af755b8ba3aa151914800:
> 
>   gpio: dwapb_gpio: convert to livetree (2019-05-10 22:48:11 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


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

2019-05-14 Thread Tom Rini
On Sun, May 12, 2019 at 01:54:15AM +0200, Marek Vasut wrote:

> SH2, SH3 removal
> 
> The following changes since commit 82da478b8f8ed41ed8bdbd0269da36ef6aaef7e8:
> 
>   Merge branch '2019-05-10-master-imports' (2019-05-10 11:08:48 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-sh.git master
> 
> for you to fetch changes up to d0487da83f916181eba57251ca28b2cb4d728092:
> 
>   sh: sh3: Remove CPU support (2019-05-10 22:43:18 +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 05/14] arm: socfpga: Move Stratix10 and Agilex system manager common code

2019-05-14 Thread Ley Foon Tan
On Tue, May 14, 2019 at 9:55 PM Marek Vasut  wrote:
>
> On 5/14/19 3:52 PM, Ley Foon Tan wrote:
> > On Tue, May 14, 2019 at 9:47 PM Marek Vasut  wrote:
> >>
> >> On 5/14/19 7:47 AM, Ley Foon Tan wrote:
> >>> On Fri, May 10, 2019 at 8:17 PM Marek Vasut  wrote:
> 
>  On 5/10/19 7:54 AM, Ley Foon Tan wrote:
> > Move Stratix10 and Agilex system manager common code to 
> > system_manager.h.
> >
> > Signed-off-by: Ley Foon Tan 
> 
>  This becomes quite a bit of ifdeffery . Why don't you have the
>  system_manager.h include system_manager_$soc.h like e.g. here?
> 
>  http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h
> 
>  --
>  Best regards,
>  Marek Vasut
> >>> We already have similar thing for Gen5. A10 and S10 includes. But, S10
> >>> and Agilex share some common defines/functions.
> >>> I can move S10 and Agilex common code to a separate file and include
> >>> in their header file.
> >>
> >> I think that'd improve the code .
> >>
> > I am plan to use filename system_manager_s10_agilex_common.h, or you
> > have better filename suggestion? :)
>
> Whatever looks consistent is fine.
>
> --
Noted.

Thanks.

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


Re: [U-Boot] [PATCH 05/14] arm: socfpga: Move Stratix10 and Agilex system manager common code

2019-05-14 Thread Marek Vasut
On 5/14/19 3:52 PM, Ley Foon Tan wrote:
> On Tue, May 14, 2019 at 9:47 PM Marek Vasut  wrote:
>>
>> On 5/14/19 7:47 AM, Ley Foon Tan wrote:
>>> On Fri, May 10, 2019 at 8:17 PM Marek Vasut  wrote:

 On 5/10/19 7:54 AM, Ley Foon Tan wrote:
> Move Stratix10 and Agilex system manager common code to system_manager.h.
>
> Signed-off-by: Ley Foon Tan 

 This becomes quite a bit of ifdeffery . Why don't you have the
 system_manager.h include system_manager_$soc.h like e.g. here?

 http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h

 --
 Best regards,
 Marek Vasut
>>> We already have similar thing for Gen5. A10 and S10 includes. But, S10
>>> and Agilex share some common defines/functions.
>>> I can move S10 and Agilex common code to a separate file and include
>>> in their header file.
>>
>> I think that'd improve the code .
>>
> I am plan to use filename system_manager_s10_agilex_common.h, or you
> have better filename suggestion? :)

Whatever looks consistent is fine.

-- 
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 10/19] spi: mpc8xxx: Simplify logic a bit

2019-05-14 Thread Jagan Teki
On Thu, May 2, 2019 at 2:37 PM Joakim Tjernlund
 wrote:
>
> On Thu, 2019-05-02 at 07:31 +0200, Mario Six wrote:
> > CAUTION: This email originated from outside of the organization. Do not 
> > click links or open attachments unless you recognize the sender and know 
> > the content is safe.
> >
> >
> > Hi Jagan and Jocke,
> >
> > I'm back from vacation, so here's my answer:
> >
> > On Mon, Apr 29, 2019 at 12:41 PM Jagan Teki  
> > wrote:
> > > + Mario
> > >
> > > On Mon, Apr 29, 2019 at 2:48 PM Joakim Tjernlund
> > >  wrote:
> > > > On Mon, 2019-04-29 at 01:58 +0530, Jagan Teki wrote:
> > > > > From: Mario Six 
> > > > >
> > > > > We do nothing in the loop if the "not empty" event was not detected. 
> > > > > To
> > > > > simplify the logic, check if this is the case, and skip the execution 
> > > > > of
> > > > > the loop early to reduce the nesting level and flag checking.
> > > >
> > > > Looked at the driver to refresh memory and noticed:
> > > > if (charSize == 32) {
> > > > /* Advance output buffer by 32 bits */
> > > > din += 4;
> > > > }
> > > > which suggests that only 32 bit char will increase the din ptr so does 
> > > > other bitlens
> > > > work for reading?
> > Yes, It will work. When charSize < 32 in a loop execution, we necessarily 
> > also
> > have numBlks == 0, since numBlks = DIV_ROUND_UP(bitlen, 32) and charSize =
> > (bitlen >= 32 ? 32 : bitlen); in other words: we're at the very end of the 
> > data
> > to be sent/received and also the final loop execution, so we don't have to
> > advance the pointer anymore.
>
> Ahh, I see now.
>
> But this over use of always 32 bits cause complexity/subtile bugs. The driver 
> should use
> the requested charsize(wordlen) throughout. As is now you cannot use the 
> NF/NE flag as intended or
> toggle LSB_FIRST

Look like Joakim has a point here. better we can check the required
charsize instead of looking for magic 32 number. What do you say
Mario?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 05/14] arm: socfpga: Move Stratix10 and Agilex system manager common code

2019-05-14 Thread Ley Foon Tan
On Tue, May 14, 2019 at 9:47 PM Marek Vasut  wrote:
>
> On 5/14/19 7:47 AM, Ley Foon Tan wrote:
> > On Fri, May 10, 2019 at 8:17 PM Marek Vasut  wrote:
> >>
> >> On 5/10/19 7:54 AM, Ley Foon Tan wrote:
> >>> Move Stratix10 and Agilex system manager common code to system_manager.h.
> >>>
> >>> Signed-off-by: Ley Foon Tan 
> >>
> >> This becomes quite a bit of ifdeffery . Why don't you have the
> >> system_manager.h include system_manager_$soc.h like e.g. here?
> >>
> >> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h
> >>
> >> --
> >> Best regards,
> >> Marek Vasut
> > We already have similar thing for Gen5. A10 and S10 includes. But, S10
> > and Agilex share some common defines/functions.
> > I can move S10 and Agilex common code to a separate file and include
> > in their header file.
>
> I think that'd improve the code .
>
I am plan to use filename system_manager_s10_agilex_common.h, or you
have better filename suggestion? :)

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


Re: [U-Boot] [linux-sunxi] [PATCH v3 3/3] arm: sunxi: h6: fix reset using r_wdog

2019-05-14 Thread Jagan Teki
On Wed, Apr 17, 2019 at 11:11 PM Clément Péron  wrote:
>
> WDOG is broken for some H6 rev. The board is not
> reseted correctly.
>
> Use the R_WDOG instead.

Can you describe the proper issue why it broken? this would really
help us to understand and future reference.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [linux-sunxi] Re: [PATCH v3 3/3] arm: sunxi: h6: fix reset using r_wdog

2019-05-14 Thread Jagan Teki
On Mon, May 13, 2019 at 2:58 AM Clément Péron  wrote:
>
> On Sun, 12 May 2019 at 20:23, Jagan Teki  wrote:
> >
> > On Fri, Apr 19, 2019 at 2:49 PM Clément Péron  wrote:
> > >
> > > Hi,
> > >
> > > On Fri, 19 Apr 2019 at 10:24, Jagan Teki  
> > > wrote:
> > > >
> > > > On Fri, Apr 19, 2019 at 1:23 PM Clément Péron  
> > > > wrote:
> > > > >
> > > > > Hi,
> > > > >
> > > > > +Chen-Yu Tsai for test and +Icenowy because she try to contact AW
> > > > > about this issue.
> > > > >
> > > > > On Wed, 17 Apr 2019 at 19:41, Clément Péron  
> > > > > wrote:
> > > > > >
> > > > > > WDOG is broken for some H6 rev. The board is not
> > > > > > reseted correctly.
> > > > > >
> > > > > > Use the R_WDOG instead.
> > > > >
> > > > > The issue is real except on Pine H64 and Rongpin RP-H6B which seems to
> > > > > be NOT affected.
> > > > > Lot of users on OrangePi boards (Lite2 / One Plus and 3) are
> > > > > complaining about this issue.
> > > > >
> > > > > We perform a simple watchdog test on different board :
> > > > >
> > > > > Chen-Yu Tsai :
> > > > > Pine h64 = H6 V200-AWIN H6448BA 7782 => OK
> > > > > OrangePi Lite 2 = H6 V200-AWIN H8068BA 61C2 => KO
> > > > >
> > > > > Martin Ayotte :
> > > > > PineH64 = H8069BA 6892 => OK
> > > > > Orange Pi 3 = HA047BA 69W2 => KO
> > > > > OPiOnePlus = H7310BA 6842 => KO
> > > > > OPiLite2 = H6448BA 6662 => KO
> > > > >
> > > > > Clément Péron:
> > > > > Beelink GS1 = H6 V200-AWIN H7309BA 6842 => KO
> > > > >
> > > > > After the series of result, Icenowy try to reach Allwinner about this
> > > > > issue but they seems not interested to investigate it.
> > > > >
> > > > > I'm not sure if it's an HW errata or if there something misconfigured
> > > > > but the result is here WDOG doesn't make these boards reboot.
> > > > > And this should not happens !
> > > >
> > > > How about Linux? same issue.
> > > Yes, Linux use PSCI, call ATF and we have the same issue as ATF use
> > > the watchdog to reboot.
> >
>
> Hi,
>
> > There is an RFC for watchdog, can you have any change to add reset_cpu
> > via that driver (ofcourse it's a rework)?
> It's indeed a more proper way but it's a different work.
> I'm only trying to fix the reboot issue on some H6 boards.
> Moreover modifying this part will require some testing on different
> Allwinner boards that I don't have.

True, may be we can plan it for next MW.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] arm: socfpga: remove re-added ad-hoc reset code

2019-05-14 Thread Marek Vasut
On 5/13/19 9:16 PM, Simon Goldschmidt wrote:
> commit c5de2b7eae68 ("arm: socfpga: implement proper peripheral reset")
> has removed the call to 'reset_deassert_peripherals_handoff()' from
> socfpga gen5 SPL since the reset driver now handles resets. However,
> commit c1d4b464c8b8 ("ARM: socfpga: Disable bridges in SPL unless booting 
> from FPGA")
> has re-added this ad-hoc reset code, so that all peripherals were now
> again enabled instead of letting the drivers enable them by request.
> 
> While at it, remove this function for gen5 as it should not be used.
> 
> Fixes: commit c1d4b464c8b8 ("ARM: socfpga: Disable bridges in SPL unless 
> booting from FPGA")
> Signed-off-by: Simon Goldschmidt 

Applied both, thanks

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


Re: [U-Boot] [PATCH 05/14] arm: socfpga: Move Stratix10 and Agilex system manager common code

2019-05-14 Thread Marek Vasut
On 5/14/19 7:47 AM, Ley Foon Tan wrote:
> On Fri, May 10, 2019 at 8:17 PM Marek Vasut  wrote:
>>
>> On 5/10/19 7:54 AM, Ley Foon Tan wrote:
>>> Move Stratix10 and Agilex system manager common code to system_manager.h.
>>>
>>> Signed-off-by: Ley Foon Tan 
>>
>> This becomes quite a bit of ifdeffery . Why don't you have the
>> system_manager.h include system_manager_$soc.h like e.g. here?
>>
>> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-rmobile/include/mach/rmobile.h
>>
>> --
>> Best regards,
>> Marek Vasut
> We already have similar thing for Gen5. A10 and S10 includes. But, S10
> and Agilex share some common defines/functions.
> I can move S10 and Agilex common code to a separate file and include
> in their header file.

I think that'd improve the code .

-- 
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] arm: socfpga: Re-add support for Aries MCV SoM and MCVEV[KP] board

2019-05-14 Thread Marek Vasut
On 5/12/19 7:25 PM, Wolfgang Grandegger wrote:
> Re-add support for Aries Embedded MCV SoM, which is CycloneV based
> and the associated MCVEVK and MCVEVP baseboard. The board can boot
> from eMMC. Ethernet and USB is supported.
> 
> The Aries Embedded boards have been removed with commit 03b54997d568
> ("board/aries: Remove"). I will now take care of them.
> 
> The device-tree files are from mainline Linux commit e93c9c99a629
> ("Linux v5.1)".
> 
> Signed-off-by: Wolfgang Grandegger 
> CC: Marek Vasut 
> CC: Simon Goldschmidt 

Applied, thanks

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


Re: [U-Boot] [PATCH 04/14] arm: socfpga: agilex: Add reset manager support

2019-05-14 Thread Ley Foon Tan
On Tue, May 14, 2019 at 4:35 PM Simon Goldschmidt
 wrote:
>
> On Tue, May 14, 2019 at 8:08 AM Ley Foon Tan  wrote:
> >
> > On Sat, May 11, 2019 at 2:28 AM Simon Goldschmidt
> >  wrote:
> > >
> > > Am 10.05.2019 um 07:54 schrieb Ley Foon Tan:
> > > > Add reset manager support for Agilex.
> > > >
> > > > Signed-off-by: Ley Foon Tan 
> > > > ---
> > > >   .../mach-socfpga/include/mach/reset_manager.h |  5 ++-
> > > >   .../include/mach/reset_manager_agilex.h   | 38 +++
> > > >   arch/arm/mach-socfpga/reset_manager.c |  9 +++--
> > >
> > > Have you seen my series that removes reset_manager.c and moves the code
> > > to drivers/sysreset instead? It's not accepted, yet, but I think agilex
> > > should use drivers/sysreset, too.
> > >
> > > Regards,
> > > Simon
> > drivers/sysreset is only for system reset, right?
> > Most of our drivers use reset framework to reset, but we still using
> > functions from reset_manager to reset watchdog and UART (when
> > CONFIG_DEBUG_UART enabeld).
>
> Right, but arch/arm/mach-socfpga/reset_manager.c only contains
> reset_cpu(), so drivers/sysreset is a direct replacement for this.
>
> You're probably talking about reset_manager_s10.c. I know you still
> need that (although I'm trying to find a way to move that code to
> dm driver, too - at least for gen5 as a start).
>
Yes, I am talking about reset_manager_s10.c.

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


Re: [U-Boot] [PATCH 2/2] opos6uldev: remove board_ehci_hcd_init function

2019-05-14 Thread Fabio Estevam
On Tue, May 14, 2019 at 8:48 AM Sébastien Szymanski
 wrote:
>
> It's useless on the opos6uldev. Remove it.

Why is it useless? No USB host on this port?

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


Re: [U-Boot] [PATCH 1/2] opos6uldev: don't call enable_lcdif_clock

2019-05-14 Thread Fabio Estevam
On Tue, May 14, 2019 at 8:47 AM Sébastien Szymanski
 wrote:
>
> The mxsfb driver already calls enable_lcdif_clock.
>
> Signed-off-by: Sébastien Szymanski 

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


Re: [U-Boot] [PATCH 1/1] opos6ul: set REFSEL and REFR fields

2019-05-14 Thread Fabio Estevam
On Tue, May 14, 2019 at 8:33 AM Sébastien Szymanski
 wrote:
>
> Signed-off-by: Sébastien Szymanski 

Please ask a commit log explaining why you are doing this.

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


[U-Boot] [PATCH 2/2] opos6uldev: remove board_ehci_hcd_init function

2019-05-14 Thread Sébastien Szymanski
It's useless on the opos6uldev. Remove it.

Signed-off-by: Sébastien Szymanski 
---
 board/armadeus/opos6uldev/board.c | 21 -
 1 file changed, 21 deletions(-)

diff --git a/board/armadeus/opos6uldev/board.c 
b/board/armadeus/opos6uldev/board.c
index aed334f8fb..cbf40d5c4a 100644
--- a/board/armadeus/opos6uldev/board.c
+++ b/board/armadeus/opos6uldev/board.c
@@ -70,27 +70,6 @@ int setup_lcd(void)
 }
 #endif
 
-#ifdef CONFIG_USB_EHCI_MX6
-#define USB_OTHERREGS_OFFSET   0x800
-#define UCTRL_PWR_POL  (1 << 9)
-
-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 opos6ul_board_late_init(void)
 {
 #ifdef CONFIG_VIDEO_MXS
-- 
2.19.2

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


[U-Boot] [PATCH 1/2] opos6uldev: don't call enable_lcdif_clock

2019-05-14 Thread Sébastien Szymanski
The mxsfb driver already calls enable_lcdif_clock.

Signed-off-by: Sébastien Szymanski 
---
 board/armadeus/opos6uldev/board.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/board/armadeus/opos6uldev/board.c 
b/board/armadeus/opos6uldev/board.c
index 4faa997126..aed334f8fb 100644
--- a/board/armadeus/opos6uldev/board.c
+++ b/board/armadeus/opos6uldev/board.c
@@ -3,7 +3,6 @@
  * Copyright (C) 2018 Armadeus Systems
  */
 
-#include 
 #include 
 #include 
 #include 
@@ -49,8 +48,6 @@ int setup_lcd(void)
struct gpio_desc backlight;
int ret;
 
-   enable_lcdif_clock(LCDIF1_BASE_ADDR, 1);
-
imx_iomux_v3_setup_multiple_pads(lcd_pads, ARRAY_SIZE(lcd_pads));
 
/* Set Brightness to high */
-- 
2.19.2

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


[U-Boot] [PATCH 1/1] opos6ul: set REFSEL and REFR fields

2019-05-14 Thread Sébastien Szymanski
Signed-off-by: Sébastien Szymanski 
---
 arch/arm/mach-imx/mx6/opos6ul.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-imx/mx6/opos6ul.c b/arch/arm/mach-imx/mx6/opos6ul.c
index a578fd67db..55ebe3a624 100644
--- a/arch/arm/mach-imx/mx6/opos6ul.c
+++ b/arch/arm/mach-imx/mx6/opos6ul.c
@@ -197,6 +197,8 @@ struct mx6_ddr_sysinfo ddr_sysinfo = {
.sde_to_rst = 0x10, /* 14 cycles, 200us (JEDEC default) */
.rst_to_cke = 0x23, /* 33 cycles, 500us (JEDEC default) */
.ddr_type = DDR_TYPE_DDR3,
+   .refsel = 1,/* Refresh cycles at 32KHz */
+   .refr = 7,  /* 8 refreshes commands per refresh cycle */
 };
 
 static struct mx6_ddr3_cfg mem_ddr = {
-- 
2.19.2

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


  1   2   >