Re: [U-Boot] [PATCH v1] imx: bootaux: elf firmware support

2019-11-11 Thread Peng Fan
Hi Igor.

> Subject: [PATCH v1] imx: bootaux: elf firmware support

We also have similar support for i.MX8 DSP firmware loading. Good to see
your patch.

> 
> From: Igor Opaniuk 
> 
> Currently imx-specific bootaux command doesn't support ELF format
> firmware for Cortex-M4 core.
> 
> This patches introduces a PoC implementation of handling elf firmware
> (load_elf_image_phdr() was copy-pasted from elf.c just for PoC).
> 
> This has the advantage that the user does not need to know to which address
> the binary has been linked to. However, in order to handle and load the elf
> sections to the right address, we need to translate the
> Cortex-M4 core memory addresses to primary/host CPU memory addresses
> (Cortex A7/A9 cores).

Could an runtime check be added for those aux cores which has
same mapping as host cores?

Thanks,
Peng
> 
> This allows to boot firmwares from any location with just using bootaux, e.g.:
> > tftp ${loadaddr} hello_world.elf && bootaux ${loadaddr}
> 
> Similar translation table can be found in the Linux remoteproc driver [1].
> 
> [1]
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.b
> ootlin.com%2Flinux%2Flatest%2Fsource%2Fdrivers%2Fremoteproc%2Fimx_r
> proc.c&data=02%7C01%7Cpeng.fan%40nxp.com%7Cb511f03c8e4e4265
> 154908d766b277aa%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7
> C637090789004070829&sdata=tJoptyJCnuKIersJt9KmhR8nNYEdnl4SxM
> VKLvA7KNc%3D&reserved=0
> 
> Signed-off-by: Igor Opaniuk 
> Signed-off-by: Stefan Agner 
> ---
> 
>  arch/arm/include/asm/mach-imx/sys_proto.h |  7 ++
>  arch/arm/mach-imx/imx_bootaux.c   | 87
> +--
>  arch/arm/mach-imx/mx7/soc.c   | 28 
>  3 files changed, 118 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h
> b/arch/arm/include/asm/mach-imx/sys_proto.h
> index 52c83ba9e4..4428a7fa0b 100644
> --- a/arch/arm/include/asm/mach-imx/sys_proto.h
> +++ b/arch/arm/include/asm/mach-imx/sys_proto.h
> @@ -139,6 +139,13 @@ enum boot_dev_type_e {  extern struct rom_api
> *g_rom_api;  #endif
> 
> +/* address translation table */
> +struct rproc_att {
> + u32 da; /* device address (From Cortex M4 view) */
> + u32 sa; /* system bus address */
> + u32 size; /* size of reg range */
> +};
> +
>  u32 get_nr_cpus(void);
>  u32 get_cpu_rev(void);
>  u32 get_cpu_speed_grade_hz(void);
> diff --git a/arch/arm/mach-imx/imx_bootaux.c
> b/arch/arm/mach-imx/imx_bootaux.c index 3d9422d5a2..7f4bbfe885
> 100644
> --- a/arch/arm/mach-imx/imx_bootaux.c
> +++ b/arch/arm/mach-imx/imx_bootaux.c
> @@ -7,18 +7,94 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
> 
> -int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
> +const __weak struct rproc_att hostmap[] = { };
> +
> +static const struct rproc_att *get_host_mapping(unsigned long auxcore)
> +{
> + const struct rproc_att *mmap = hostmap;
> +
> + while (mmap && mmap->size) {
> + if (mmap->da <= auxcore &&
> + mmap->da + mmap->size > auxcore)
> + return mmap;
> + mmap++;
> + }
> +
> + return NULL;
> +}
> +
> +/*
> + * A very simple elf loader, assumes the image is valid, returns the
> + * entry point address.
> + */
> +static unsigned long load_elf_image_phdr(unsigned long addr) {
> + Elf32_Ehdr *ehdr; /* ELF header structure pointer */
> + Elf32_Phdr *phdr; /* Program header structure pointer */
> + int i;
> +
> + ehdr = (Elf32_Ehdr *)addr;
> + phdr = (Elf32_Phdr *)(addr + ehdr->e_phoff);
> +
> + /* Load each program header */
> + for (i = 0; i < ehdr->e_phnum; ++i, ++phdr) {
> + const struct rproc_att *mmap = get_host_mapping(phdr->p_paddr);
> + void *dst, *src;
> +
> + if (phdr->p_type != PT_LOAD)
> + continue;
> +
> + if (!mmap) {
> + printf("Invalid aux core address: %08x",
> +phdr->p_paddr);
> + return 0;
> + }
> +
> + dst = (void *)(phdr->p_paddr - mmap->da) + mmap->sa;
> + src = (void *)addr + phdr->p_offset;
> +
> + debug("Loading phdr %i to 0x%p (%i bytes)\n",
> +   i, dst, phdr->p_filesz);
> +
> + if (phdr->p_filesz)
> + memcpy(dst, src, phdr->p_filesz);
> + if (phdr->p_filesz != phdr->p_memsz)
> + memset(dst + phdr->p_filesz, 0x00,
> +phdr->p_memsz - phdr->p_filesz);
> + flush_cache((unsigned long)dst &
> + ~(CONFIG_SYS_CACHELINE_SIZE - 1),
> + ALIGN(phdr->p_filesz, CONFIG_SYS_CACHELINE_SIZE));
> + }
> +
> + return ehdr->e_entry;
> +}
> +
> +int arch_auxiliary_core_up(u32 core_id, ulong addr)
>  {
>   ulong stack, pc;
> 
> - if (!boot_private_data)
> + if (!addr)
>   return 

Re: [U-Boot] [PATCH v2 0/4] usb: host: dwc2: use driver model for PHY and CLOCK

2019-11-11 Thread Tan, Ley Foon


> -Original Message-
> From: Marek Vasut 
> Sent: Friday, November 8, 2019 11:43 PM
> To: Patrick Delaunay ; u-boot@lists.denx.de
> Cc: simon.k.r.goldschm...@gmail.com; b.galv...@gmail.com; Michal
> Suchanek ; Sven Schwermer
> ; U-Boot STM32  mailman.stormreply.com>; Bin Meng ; Tan, Ley
> Foon 
> Subject: Re: [PATCH v2 0/4] usb: host: dwc2: use driver model for PHY and
> CLOCK
> 
> On 11/8/19 3:47 PM, Patrick Delaunay wrote:
> >
> > In this serie I update the DWC2 host driver to use the device tree
> > information and the associated PHY and CLOCK drivers when they are
> > available.
> 
> I'm kinda on the fence whether to add it into current release or not.
> The patches look generally OK to me.
> 
> Ley, Simon, can you check this on SoCFPGA ?
There is compilation error for Stratix10. Stratix10 doesn't support clock DM 
framework yet. 
So, this patch needs check for CONFIG_CLK when call to all clock DM functions.

drivers/usb/host/built-in.o: In function `dwc2_usb_remove':
drivers/usb/host/dwc2.c:1441: undefined reference to `clk_disable_bulk'

Tested on Agilex, USB is working fine with this patch.

Regards
Ley Foon

> Bin, can you give it a once-over ?
> 
> If this looks OK to you, I will add it.
> 
> [...]
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] env: Access Environment in SPI flashes before relocation

2019-11-11 Thread Heiko Schocher

Hello Simon,

Am 11.11.2019 um 21:07 schrieb Simon Goldschmidt:

On Mon, Nov 11, 2019 at 7:15 AM Heiko Schocher  wrote:


Hello Simon,

Am 10.11.2019 um 15:51 schrieb Simon Goldschmidt:



Heiko Schocher mailto:h...@denx.de>> schrieb am Sa., 9. Nov. 
2019, 05:02:

 Enable the new Kconfig option ENV_SPI_EARLY if you want
 to use Environment in SPI flash before relocation.
 Call env_init() and than you can use env_get_f() for
 accessing Environment variables.

 Signed-off-by: Heiko Schocher mailto:h...@denx.de>>

 ---
 travis build:
 https://travis-ci.org/hsdenx/u-boot-test/builds/609101712

   env/Kconfig |   8 
   env/sf.c| 109 
   2 files changed, 117 insertions(+)

 diff --git a/env/Kconfig b/env/Kconfig
 index bc03816bc8..f2e1e1ba87 100644
 --- a/env/Kconfig
 +++ b/env/Kconfig
 @@ -370,6 +370,14 @@ config ENV_SPI_MODE
Value of the SPI work mode for environment.
See include/spi.h for value.

 +config ENV_SPI_EARLY
 +   bool "Access Environment in SPI flashes before relocation"
 +   depends on ENV_IS_IN_SPI_FLASH
 +   help
 + Enable this if you want to use Environment in SPI flash
 + before relocation. Call env_init() and than you can use
 + env_get_f() for accessing Environment variables.
 +
   config ENV_IS_IN_UBI
  bool "Environment in a UBI volume"
  depends on !CHAIN_OF_TRUST
 diff --git a/env/sf.c b/env/sf.c
 index 590d0cedd8..c4dd7dc611 100644
 --- a/env/sf.c
 +++ b/env/sf.c
 @@ -308,6 +308,113 @@ static int env_sf_init(void)

[...]



Sorry I haven't looked at the file in detail yet, but doesn't this duplicate 
quite a lot of env
decision code?


Yes, correct, I take a look to remove this duplication ...

Hmm... just detected when booting with invalid environment in spi nor flash,
that the board selects correct the default environment (before relocation)
but I see in U-Boot commandshell:

=> printenv

Environment size: 1/12283 bytes
=>

and even worser, saveenv never calls the save function for the spi nor...
it seems, the reason is:

diff --git a/env/env.c b/env/env.c
index 9237bb9c74..6faef1136d 100644
--- a/env/env.c
+++ b/env/env.c
@@ -189,7 +189,7 @@ int env_load(void)
  if (!drv->load)
  continue;

-   if (!env_has_inited(drv->location))
+   if (env_has_inited(drv->location))
  continue;

  printf("Loading Environment from %s... ", drv->name);

With this change, all is fine again. This seems a bug to me ... but wonder
why this does not pop up on other boards ... what do you think?


I don't think I really get what your problem is, yet. But the code above looks
correct: only call load/save/erase on env drivers that have successfully been
initialized via env_init.


Yes, you are right, sorry for your time. I try to find out, whats going
wrong...

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


Re: [U-Boot] [PATCH v4] gitattributes: dont treat non-text files as text

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 04:32:55PM +0100, Veeraiyan Chidambaram wrote:

> From: Vignesh Rajendran 
> 
> With recent update in u-boot gitattributes all files are treated as regular
> text files. This creates problems with special files and repo always
> shows uncommitted files like below.
> 
> Your branch is up-to-date with 'origin/master'.
> Changes not staged for commit:
>   (use "git add ..." to update what will be committed)
>   (use "git checkout -- ..." to discard changes in working directory)
> 
>   modified:   tools/logos/compulab.bmp
>   modified:   tools/logos/denx-comp.bmp
>   modified:   tools/logos/toradex.bmp
> 
> To fix above problem special files bmp/ttf files are treated as binary
> files in the gitattributes.
> 
> Signed-off-by: Vignesh Rajendran 
> Signed-off-by: Veeraiyan Chidambaram 

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] .gitignore: Ignore .img files

2019-11-11 Thread Tom Rini
On Sat, Nov 09, 2019 at 08:13:57PM +0100, Michael Trimarchi wrote:

> The generated idbloader.img file that rockchip uses should
> be not included in git status report
> 
> Signed-off-by: Michael Trimarchi 

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] binman: tegra: Adjust symbol calculation depending on end-at-4gb

2019-11-11 Thread Tom Rini
On Wed, Nov 06, 2019 at 05:22:44PM -0700, Simon Glass wrote:

> A recent change adjusted the symbol calculation to work on x86 but broke
> it for Tegra. In fact this is because they have different needs.
> 
> On x86 devices the code is linked to a ROM address and the end-at-4gb
> property is used for the image. In this case there is no need to add the
> base address of the image, since the base address is already built into
> the offset and image-pos properties.
> 
> On other devices we must add the base address since the offsets start at
> zero.
> 
> In addition the base address is currently added to the 'offset' and 'size'
> values. It should in fact only be added to 'image-pos', since 'offset' is
> relative to its parent and 'size' is not actually an address. This code
> should have been adjusted when support for 'image-pos' and 'size' was
> added, but it was not.
> 
> To correct these problems:
> - move the code that handles adding the base address to section.py, which
>   can check the end-at-4gb property and which property
>   (offset/size/image-pos) is being read
> - add the base address only when needed (only for image-pos and not if the
>   image uses end-at-4gb)
> - add a note to the documentation
> - add a separate test to cover x86 behaviour
> 
> Fixes: 15c981cc (binman: Correct symbol calculation with non-zero image base)
> 
> Signed-off-by: Simon Glass 
> Tested-by: Stephen Warren 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Pull request: u-boot-rockchip-20191026

2019-11-11 Thread Tom Rini
On Mon, Nov 11, 2019 at 02:57:55PM +0800, Kever Yang wrote:

> Hi Tom,
> 
> Please pull the rockchip update:
> - Add support for rockchip pmic rk805,rk809, rk816, rk817
> - Add rk3399 board Leez support
> - Fix bug in rk3328 ram driver
> - Adapt SPL to support ATF bl31 with entry at 0x4
> 
> Fix the u8 type comparision with '-1'.
> Fix checkpatch warning for multi blank line and review signature.
> 
> Travis:
> https://travis-ci.org/keveryang/u-boot/builds/608622183
> 
> Thanks,
> - Kever
> 
> The following changes since commit 0f282c1876af26cc2c8c018ae6293a691561011e:
> 
>   Makefile: fix dependency for imx targets (2019-11-06 09:22:32 -0500)
> 
> are available in the Git repository at:
> 
>   https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip.git 
> tags/u-boot-rockchip-20191110
> 
> for you to fetch changes up to f74a089e47e0b485fb70dcadfbf093daf64a740a:
> 
>   rockchip: firefly-rk3288: Enable TPL support (2019-11-10 20:40:20 +0800)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [ANN] U-Boot v2020.01-rc2 released

2019-11-11 Thread Tom Rini
Hey all,

It's release day and here is v2020.01-rc2.  Most of the outstanding
patches I know about that are "big" are also in, except for the MTD
clean-up series.  That in turn depends on some ENV related clean-ups
that I'm doing.  As the expression goes, it's turtles all the way down.

Once again, for a changelog, 
git log --merges v2020.01-rc1..v2020.01-rc2
and as always, I ask for more details in the PRs people send me so I can
put them in the merge commit.

I'm planning on doing -rc3 on the 25th of November with -rc4 on December
9th and -rc5 on December 23rd with the release scheduled on January 6th.
Thanks all!

-- 
Tom


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


Re: [U-Boot] pull request u-boot-fsl-qoriq

2019-11-11 Thread Tom Rini
On Mon, Nov 11, 2019 at 04:45:02AM +, Priyanka Jain wrote:

> Dear Tom,
> 
> 
> 
> Please find my pull-request for u-boot-fsl-qoriq/master
> 
> https://travis-ci.org/p-priyanka-jain/u-boot/builds/609183013
> 
> 
> 
> Summary
> 
> Rename CONFIG_SECURE_BOOT to CONFIG_NXP_ESBC.
> 
> Few bug fixes and updates related to SPI, hwconfig, ethernet, fsl-layerscape, 
> pci, icid, PSCI
> 
> 
> 
> priyankajain
> 
> 
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v3 043/108] x86: Adjust mrccache_get_region() to use livetree

2019-11-11 Thread Simon Glass
Hi Bin,

On Mon, 4 Nov 2019 at 08:06, Bin Meng  wrote:
>
> Hi Simon,
>
> On Mon, Oct 21, 2019 at 11:40 AM Simon Glass  wrote:
> >
> > Change the algorithm to first find the flash device then read the
> > properties using the livetree API. With this change the device is not
> > probed so this needs to be done in mrccache_save().
> >
> > Signed-off-by: Simon Glass 
> > ---
> >
> > Changes in v3:
> > - Update mrccache livetree patch to just convert to livetree
> >
> > Changes in v2: None
> >
> >  arch/x86/lib/mrccache.c | 55 +++--
> >  1 file changed, 26 insertions(+), 29 deletions(-)

Just checking if I should send a new series with all these comments,
or still hold off?

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


[U-Boot] [PATCH v3] spi: cadence_qspi: support DM_CLK

2019-11-11 Thread Simon Goldschmidt
Support loading clk speed via DM instead of requiring ad-hoc code.

Signed-off-by: Simon Goldschmidt 
---

Changes in v3:
- load ref_clk_hz only once in cadence_spi_ofdata_to_platdata instead
  of loading it every time in cadence_spi_write_speed

Changes in v2:
- check return value of clk_get_rate for error

 drivers/spi/cadence_qspi.c | 21 +++--
 drivers/spi/cadence_qspi.h |  1 +
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index e2e54cd277..8fd23a7702 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -5,6 +5,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -24,10 +25,10 @@ static int cadence_spi_write_speed(struct udevice *bus, 
uint hz)
struct cadence_spi_priv *priv = dev_get_priv(bus);
 
cadence_qspi_apb_config_baudrate_div(priv->regbase,
-CONFIG_CQSPI_REF_CLK, hz);
+plat->ref_clk_hz, hz);
 
/* Reconfigure delay timing if speed is changed. */
-   cadence_qspi_apb_delay(priv->regbase, CONFIG_CQSPI_REF_CLK, hz,
+   cadence_qspi_apb_delay(priv->regbase, plat->ref_clk_hz, hz,
   plat->tshsl_ns, plat->tsd2d_ns,
   plat->tchsh_ns, plat->tslch_ns);
 
@@ -294,6 +295,8 @@ static int cadence_spi_ofdata_to_platdata(struct udevice 
*bus)
 {
struct cadence_spi_platdata *plat = bus->platdata;
ofnode subnode;
+   struct clk clk;
+   int ret;
 
plat->regbase = (void *)devfdt_get_addr_index(bus, 0);
plat->ahbbase = (void *)devfdt_get_addr_index(bus, 1);
@@ -325,6 +328,20 @@ static int cadence_spi_ofdata_to_platdata(struct udevice 
*bus)
plat->tchsh_ns = ofnode_read_u32_default(subnode, "cdns,tchsh-ns", 20);
plat->tslch_ns = ofnode_read_u32_default(subnode, "cdns,tslch-ns", 20);
 
+   ret = clk_get_by_index(bus, 0, &clk);
+   if (ret) {
+#ifdef CONFIG_CQSPI_REF_CLK
+   plat->ref_clk_hz = CONFIG_CQSPI_REF_CLK;
+#else
+   return ret;
+#endif
+   } else {
+   plat->ref_clk_hz = clk_get_rate(&clk);
+   clk_free(&clk);
+   if (IS_ERR_VALUE(plat->ref_clk_hz))
+   return plat->ref_clk_hz;
+   }
+
debug("%s: regbase=%p ahbbase=%p max-frequency=%d page-size=%d\n",
  __func__, plat->regbase, plat->ahbbase, plat->max_hz,
  plat->page_size);
diff --git a/drivers/spi/cadence_qspi.h b/drivers/spi/cadence_qspi.h
index 20cceca239..99dee75bbd 100644
--- a/drivers/spi/cadence_qspi.h
+++ b/drivers/spi/cadence_qspi.h
@@ -16,6 +16,7 @@
 #define CQSPI_READ_CAPTURE_MAX_DELAY   16
 
 struct cadence_spi_platdata {
+   unsigned intref_clk_hz;
unsigned intmax_hz;
void*regbase;
void*ahbbase;
-- 
2.20.1

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


[U-Boot] [PATCH] spl: fix stack usage check if gd is not initialized

2019-11-11 Thread Simon Goldschmidt
Most platforms do not set up gd->start_addr_sp in SPL. Since this is
required for CONFIG_SPL_SYS_REPORT_SACK_F_USAGE to work correctly, set
up gd->start_addr_sp in SPL to the value passed to
board_init_f_init_reserve if it is not set yet.

Fixes: d8c0332031 ("spl: implement stack usage check")
Signed-off-by: Simon Goldschmidt 
---

 common/init/board_init.c | 17 +
 1 file changed, 17 insertions(+)

diff --git a/common/init/board_init.c b/common/init/board_init.c
index e52106966d..3bc7994586 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -18,6 +18,19 @@ __weak void arch_setup_gd(struct global_data *gd_ptr)
 }
 #endif /* !CONFIG_X86 && !CONFIG_ARM */
 
+/**
+ * This function is called from board_init_f_init_reserve to set up
+ * gd->start_addr_sp for stack protection if not already set otherwise
+ */
+__weak void board_init_f_init_stack_protection_addr(ulong base)
+{
+#if CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE)
+   /* set up stack pointer for stack usage if not set yet */
+   if (!gd->start_addr_sp)
+   gd->start_addr_sp = base;
+#endif
+}
+
 /**
  * This function is called after the position of the initial stack is
  * determined in gd->start_addr_sp. Boards can override it to set up
@@ -129,6 +142,10 @@ void board_init_f_init_reserve(ulong base)
 #if !defined(CONFIG_ARM)
arch_setup_gd(gd_ptr);
 #endif
+
+   if (CONFIG_IS_ENABLED(SYS_REPORT_STACK_F_USAGE))
+   board_init_f_init_stack_protection_addr(base);
+
/* next alloc will be higher by one GD plus 16-byte alignment */
base += roundup(sizeof(struct global_data), 16);
 
-- 
2.20.1

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


Re: [U-Boot] [PATCH] env: Access Environment in SPI flashes before relocation

2019-11-11 Thread Simon Goldschmidt
On Mon, Nov 11, 2019 at 7:15 AM Heiko Schocher  wrote:
>
> Hello Simon,
>
> Am 10.11.2019 um 15:51 schrieb Simon Goldschmidt:
> >
> >
> > Heiko Schocher mailto:h...@denx.de>> schrieb am Sa., 9. Nov. 
> > 2019, 05:02:
> >
> > Enable the new Kconfig option ENV_SPI_EARLY if you want
> > to use Environment in SPI flash before relocation.
> > Call env_init() and than you can use env_get_f() for
> > accessing Environment variables.
> >
> > Signed-off-by: Heiko Schocher mailto:h...@denx.de>>
> >
> > ---
> > travis build:
> > https://travis-ci.org/hsdenx/u-boot-test/builds/609101712
> >
> >   env/Kconfig |   8 
> >   env/sf.c| 109 
> >   2 files changed, 117 insertions(+)
> >
> > diff --git a/env/Kconfig b/env/Kconfig
> > index bc03816bc8..f2e1e1ba87 100644
> > --- a/env/Kconfig
> > +++ b/env/Kconfig
> > @@ -370,6 +370,14 @@ config ENV_SPI_MODE
> >Value of the SPI work mode for environment.
> >See include/spi.h for value.
> >
> > +config ENV_SPI_EARLY
> > +   bool "Access Environment in SPI flashes before relocation"
> > +   depends on ENV_IS_IN_SPI_FLASH
> > +   help
> > + Enable this if you want to use Environment in SPI flash
> > + before relocation. Call env_init() and than you can use
> > + env_get_f() for accessing Environment variables.
> > +
> >   config ENV_IS_IN_UBI
> >  bool "Environment in a UBI volume"
> >  depends on !CHAIN_OF_TRUST
> > diff --git a/env/sf.c b/env/sf.c
> > index 590d0cedd8..c4dd7dc611 100644
> > --- a/env/sf.c
> > +++ b/env/sf.c
> > @@ -308,6 +308,113 @@ static int env_sf_init(void)
> [...]
> >
> >
> > Sorry I haven't looked at the file in detail yet, but doesn't this 
> > duplicate quite a lot of env
> > decision code?
>
> Yes, correct, I take a look to remove this duplication ...
>
> Hmm... just detected when booting with invalid environment in spi nor flash,
> that the board selects correct the default environment (before relocation)
> but I see in U-Boot commandshell:
>
> => printenv
>
> Environment size: 1/12283 bytes
> =>
>
> and even worser, saveenv never calls the save function for the spi nor...
> it seems, the reason is:
>
> diff --git a/env/env.c b/env/env.c
> index 9237bb9c74..6faef1136d 100644
> --- a/env/env.c
> +++ b/env/env.c
> @@ -189,7 +189,7 @@ int env_load(void)
>  if (!drv->load)
>  continue;
>
> -   if (!env_has_inited(drv->location))
> +   if (env_has_inited(drv->location))
>  continue;
>
>  printf("Loading Environment from %s... ", drv->name);
>
> With this change, all is fine again. This seems a bug to me ... but wonder
> why this does not pop up on other boards ... what do you think?

I don't think I really get what your problem is, yet. But the code above looks
correct: only call load/save/erase on env drivers that have successfully been
initialized via env_init.

Regards,
Simon

>
> bye,
> Heiko
>
> >
> > Regards,
> > Simon
> >
> > +
> >   U_BOOT_ENV_LOCATION(sf) = {
> >  .location   = ENVL_SPI_FLASH,
> >  ENV_NAME("SPI Flash")
> > @@ -317,5 +424,7 @@ U_BOOT_ENV_LOCATION(sf) = {
> >   #endif
> >   #if defined(INITENV) && defined(CONFIG_ENV_ADDR)
> >  .init   = env_sf_init,
> > +#elif defined(CONFIG_ENV_SPI_EARLY)
> > +   .init   = env_sf_init_early,
> >   #endif
> >   };
> > --
> > 2.21.0
> >
>
> --
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: h...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 6/6] config: enable DFU over USB on Raspberry Pi4 boards

2019-11-11 Thread Matthias Brugger


On 08/11/2019 17:57, Matthias Brugger wrote:
> Hi Marek,
> 
> 
> First of all thanks for the patch and sorry for the late response.
> 
> On 24/09/2019 15:11, Marek Szyprowski wrote:
>> Enable support for DFU over USB. This requires to enable USB gadget,
>> DWC2 UDC OTG driver and DFU command. DFU entities are defined for the
>> following firmware objects: u-boot.bin, uboot.env, config.txt, cmdline.txt
>> and zImage/Image.gz.
>>
>> Signed-off-by: Marek Szyprowski 
>> Reviewed-by: Lukasz Majewski 
>> ---
>>  configs/rpi_4_32b_defconfig | 11 +++
>>  configs/rpi_4_defconfig | 11 +++
>>  include/configs/rpi.h   | 17 +
>>  3 files changed, 39 insertions(+)
>>
>> diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig
>> index a31a617a5f..0a375b9736 100644
>> --- a/configs/rpi_4_32b_defconfig
>> +++ b/configs/rpi_4_32b_defconfig
>> @@ -12,6 +12,7 @@ CONFIG_MISC_INIT_R=y
>>  # CONFIG_DISPLAY_CPUINFO is not set
>>  # CONFIG_DISPLAY_BOARDINFO is not set
>>  CONFIG_SYS_PROMPT="U-Boot> "
>> +CONFIG_CMD_DFU=y
>>  # CONFIG_CMD_FLASH is not set
>>  CONFIG_CMD_GPIO=y
>>  CONFIG_CMD_MMC=y
>> @@ -19,6 +20,7 @@ CONFIG_CMD_FS_UUID=y
>>  CONFIG_ENV_FAT_INTERFACE="mmc"
>>  CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
>>  CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
>> +CONFIG_DFU_MMC=y
>>  CONFIG_DM_KEYBOARD=y
>>  CONFIG_DM_MMC=y
>>  CONFIG_MMC_SDHCI=y
>> @@ -26,6 +28,15 @@ CONFIG_MMC_SDHCI_BCM2835=y
>>  CONFIG_PINCTRL=y
>>  # CONFIG_PINCTRL_GENERIC is not set
>>  # CONFIG_REQUIRE_SERIAL_CONSOLE is not set
>> +CONFIG_USB=y
>> +CONFIG_DM_USB=y
>> +CONFIG_DM_USB_GADGET=y
>> +CONFIG_USB_GADGET=y
>> +CONFIG_USB_GADGET_MANUFACTURER="FSL"
>> +CONFIG_USB_GADGET_VENDOR_NUM=0x0525
>> +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
>> +CONFIG_USB_GADGET_DWC2_OTG=y
>> +CONFIG_USB_GADGET_DOWNLOAD=y
>>  CONFIG_DM_VIDEO=y
>>  CONFIG_SYS_WHITE_ON_BLACK=y
>>  CONFIG_CONSOLE_SCROLL_LINES=10
>> diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig
>> index da8c960a2a..5b9be9b9c0 100644
>> --- a/configs/rpi_4_defconfig
>> +++ b/configs/rpi_4_defconfig
>> @@ -12,6 +12,7 @@ CONFIG_MISC_INIT_R=y
>>  # CONFIG_DISPLAY_CPUINFO is not set
>>  # CONFIG_DISPLAY_BOARDINFO is not set
>>  CONFIG_SYS_PROMPT="U-Boot> "
>> +CONFIG_CMD_DFU=y
>>  # CONFIG_CMD_FLASH is not set
>>  CONFIG_CMD_GPIO=y
>>  CONFIG_CMD_MMC=y
>> @@ -19,6 +20,7 @@ CONFIG_CMD_FS_UUID=y
>>  CONFIG_ENV_FAT_INTERFACE="mmc"
>>  CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
>>  CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
>> +CONFIG_DFU_MMC=y
>>  CONFIG_DM_KEYBOARD=y
>>  CONFIG_DM_MMC=y
>>  CONFIG_MMC_SDHCI=y
>> @@ -26,6 +28,15 @@ CONFIG_MMC_SDHCI_BCM2835=y
>>  CONFIG_PINCTRL=y
>>  # CONFIG_PINCTRL_GENERIC is not set
>>  # CONFIG_REQUIRE_SERIAL_CONSOLE is not set
>> +CONFIG_USB=y
>> +CONFIG_DM_USB=y
>> +CONFIG_DM_USB_GADGET=y
>> +CONFIG_USB_GADGET=y
>> +CONFIG_USB_GADGET_MANUFACTURER="FSL"
>> +CONFIG_USB_GADGET_VENDOR_NUM=0x0525
>> +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
>> +CONFIG_USB_GADGET_DWC2_OTG=y
>> +CONFIG_USB_GADGET_DOWNLOAD=y
>>  CONFIG_DM_VIDEO=y
>>  CONFIG_SYS_WHITE_ON_BLACK=y
>>  CONFIG_CONSOLE_SCROLL_LINES=10
>> diff --git a/include/configs/rpi.h b/include/configs/rpi.h
>> index 77d2d5458a..bfe76eb392 100644
>> --- a/include/configs/rpi.h
>> +++ b/include/configs/rpi.h
>> @@ -70,6 +70,22 @@
>>  #define CONFIG_TFTP_TSIZE
>>  #endif
>>  
>> +/* DFU over USB/UDC */
>> +#ifdef CONFIG_CMD_DFU
>> +#define CONFIG_SYS_DFU_DATA_BUF_SIZESZ_1M
>> +#define CONFIG_SYS_DFU_MAX_FILE_SIZESZ_2M
>> +
>> +#ifdef CONFIG_ARM64
>> +#define KERNEL_FILENAME "Image.gz"
>> +#else
>> +#define KERNEL_FILENAME "zImage"
>> +#endif
>> +#define ENV_DFU_SETTINGS \
>> +"dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;" \
>> +  "config.txt fat 0 1;cmdline.txt fat 0 1;" \
>> +  KERNEL_FILENAME " fat 0 1\0"

we are missing
#else
#define ENV_DFU_SETTINGS ""

otherwise armv7 builds are broken.

Regards,
Matthias

>> +#endif
>> +
> 
> I'm hesitant to take this file list as I think it highly depends on what you
> want to do with the board. For example at SUSE we use a ubootconfig.txt which
> get's added to config.txt. We might want to update grub, our kernel is on a
> different partition etc.
> 
> What do you think?
> 
> Other then that the patches look good, and I understand that they should go
> through my tree, also I don't know much about the FAT implementation.
> 
> Regards,
> Matthias
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [BUG] U-Boot hangs on fatload, commit ee88eacbdd840199a3dec707234579fb15ddd46a

2019-11-11 Thread Gray Remlin
This content is getting very convoluted, if appropriate feel free to crop
it.
New point raised at very bottom.

On Sun, 10 Nov 2019 at 08:41, Heinrich Schuchardt 
wrote:

> On 11/9/19 10:31 PM, Gray Remlin wrote:
> > On Sat, 9 Nov 2019 at 20:50, Heinrich Schuchardt  > > wrote:
> >
> > On 11/9/19 8:42 PM, Gray Remlin wrote:
> >  > On Sat, 9 Nov 2019 at 18:40, Heinrich Schuchardt
> > mailto:xypron.g...@gmx.de>
> >  > >> wrote:
> >  >
> >  > On 11/9/19 6:08 PM, Heinrich Schuchardt wrote:
> >  >  > On 11/9/19 4:11 PM, Gray Remlin wrote:
> >  >  >> On Fri, 8 Nov 2019 at 20:08, Heinrich Schuchardt
> >  > mailto:xypron.g...@gmx.de>
> > >
> >  >  >> 
> >  >  >  >>
> >  >  >> On 11/8/19 7:32 PM, Gray Remlin wrote:
> >  >  >>  > Please excuse the noise. I would like to file a
> > bug report
> >  >  >> against the
> >  >  >>  > above commit, a quick search of www.denx.de
> > 
> >  >  
> >  >  >>  did not
> >  >  >>  > reveal how I should proceed. Please point me in
> > the right
> >  >  >> direction.
> >  >  >>  >
> >  >  >>  >
> >  >  >>  > Issue:
> >  >  >>  > U-Boot hangs (i.e. during boot) whenever the
> command
> >  > 'fatload' is
> >  >  >> used.
> >  >  >>  >
> >  >  >>  > Details:
> >  >  >>  > U-Boot 2019.10 compiled with either
> > dreamplug_defconfig or
> >  >  >>  > guruplug_defconfig.
> >  >  >>  >
> >  >  >>  > After the commit do_load() now additionally calls
> >  >  >> efi_set_bootdev()
> >  >  >>  > which was moved out of do_load_wrapper() which is
> > only called
> >  >  >> by the
> >  >  >>  > 'load' command.
> >  >  >>  >
> >  >  >>  > Reverting the commit fixes this issue for me.
> >  >  >>  >
> >  >  >>
> >  >  >> Dear Gray,
> >  >  >>
> >  >  >> thanks for reporting the issue with commit
> >  >  >> fs: do_load: pass device path for efi payload
> >  >  >> ee88eacbdd840199a3dec707234579fb15ddd46a
> >  >  >>
> >  >  >> Is it only the fatload command that fails on your
> > device or
> >  > also the
> >  >  >> load command?
> >  >  >>
> >  >  >> There is no bug tracker for U-Boot. So sending a mail
> > to the
> >  > U-Boot
> >  >  >> mailing list, the patch author, and the maintainer is
> the
> >  > best way to
> >  >  >> inform the developers about bugs.
> >  >  >>
> >  >  >> Best regards
> >  >  >>
> >  >  >> Heinrich
> >  >  >>
> >  >  >>
>

Distribution and version of GCC:

>  >  >> Additional information:
> >  >  >> cross-compiler
> > gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi
> >  >  >>
> >  >  >> The U-Boot environment being used is the default obtained
> by
> >  >  >> compiling U-Boot 2020.01-rc1-00100-gee93ef0c4b as
> >  > dreamplug_defconfig
> >  >  >>
> >  >  >> => printenv
> >  >  >> baudrate=115200
> >  >  >> bootcmd=setenv ethact egiga0; ${x_bootcmd_ethernet};
> > setenv ethact
> >  >  >> egiga1; ${x_bootcmd_ethernet}; ${x_bootcmd_usb};
> >  > ${x_bootcmd_kernel};
> >  >  >> setenv bootargs ${x_bootargs} ${x_bootargs_root}; bootm
> > 0x640;
> >  >  >> bootdelay=3
> >  >  >> ethact=egiga0
> >  >  >> fdtcontroladdr=1fb8e7c8
> >  >  >> stderr=serial
> >  >  >> stdin=serial
> >  >  >> stdout=serial
> >  >  >> x_bootargs=console=ttyS0,115200
> >  >  >> x_bootargs_root=root=/dev/sda2 rootdelay=10
> >  >  >> x_bootcmd_ethernet=ping 192.168.2.1
> >  >  >> x_bootcmd_kernel=fatload usb 0 0x640 uImage
> >  >  >> x_bootcmd_usb=usb start
> >  >  >>
> >  >  >> U-Boot hangs for other syntactically correct invocations
> > of either
> >  >  >> 'fatload' or 'load'
> >  >  >> Other commands such as 'fatls' function as expected.
> >  >  >>
> >  >  >> Program flow is as follows:
> >  >  >>
> >  >  >> command 'fatload' (or 'load')
> >  >  >>  efi_set_bootdev()
> >  >  >>  ...
> >  >  >>  efi_dp_split_file_path()
> >   

Re: [U-Boot] [PATCH] net: cpsw: Add NULL pointer check

2019-11-11 Thread Grygorii Strashko



On 11/11/2019 11:52, Faiz Abbas wrote:

Add null pointer check to take care of out of memory errors.

Signed-off-by: Faiz Abbas 
---
  drivers/net/ti/cpsw.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c
index 4a990be93e..b710ae4053 100644
--- a/drivers/net/ti/cpsw.c
+++ b/drivers/net/ti/cpsw.c
@@ -1223,6 +1223,9 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice 
*dev)
int ret;
  
  	data = calloc(1, sizeof(struct cpsw_platform_data));

+   if (!data)
+   return -ENOMEM;
+
pdata->priv_pdata = data;
pdata->iobase = dev_read_addr(dev);
data->version = CPSW_CTRL_VERSION_2;



Reviewed-by: Grygorii Strashko 

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


Re: [U-Boot] [PATCH v2 1/2] freescale/layerscape: Rename the config CONFIG_SECURE_BOOT name.

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: Udit Agarwal 
>Sent: Thursday, November 7, 2019 9:42 PM
>To: u-boot@lists.denx.de
>Cc: Priyanka Jain ; Arun Pathak
>; Ruchika Gupta ; Udit
>Agarwal 
>Subject: [PATCH v2 1/2] freescale/layerscape: Rename the config
>CONFIG_SECURE_BOOT name.
>
>Renames CONFIG_SECURE_BOOT to CONFIG_NXP_ESBC to avoid conflict with
>UEFI secure boot.
>
>Signed-off-by: Udit Agarwal 
>---

Removed '.' from subject
Series applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH v2] configs: spi: Add the SPI_FLASH_BAR for ESPI

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: U-Boot  On Behalf Of Xiaowei Bao
>Sent: Thursday, October 31, 2019 12:05 PM
>To: ja...@amarulasolutions.com; u-boot@lists.denx.de; Jagdish Gediya
>
>Cc: Xiaowei Bao 
>Subject: [U-Boot] [PATCH v2] configs: spi: Add the SPI_FLASH_BAR for ESPI
>
>Add the SPI_FLASH_BAR for the ESPI controller of FSL, this entry is missed by
>commit 6d825178364.
>
>Signed-off-by: Xiaowei Bao 
>---

Updated "commit" related description to fix checkpatch error.
Applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH v2] armv8: fsl-layerscape: fix warning if no hwconfig is defined

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: Pankaj Bansal 
>Sent: Thursday, October 31, 2019 11:11 AM
>To: Priyanka Jain 
>Cc: u-boot@lists.denx.de; Pankaj Bansal 
>Subject: [PATCH v2] armv8: fsl-layerscape: fix warning if no hwconfig is 
>defined
>
>if no hwconfig variable is defined for a platform and we try to get the subarg
>of hwconfig, we receive a warning:
>WARNING: Calling __hwconfig without a buffer and before environment is
>ready
>
>Therefore, if hwconfig is not found return without further processing.
>
>Signed-off-by: Pankaj Bansal 
>---

Some updates done in subject, description and copyright year.
Applied to fsl-qoriq master, awaiting upstream.

Thanks
priyankajain
 

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


Re: [U-Boot] [PATCH 2/2] drivers: net: fsl_enetc: fix RGMII configuration

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: U-Boot  On Behalf Of Michael Walle
>Sent: Saturday, October 26, 2019 6:09 AM
>To: u-boot@lists.denx.de
>Cc: Joe Hershberger ; Catalin Horghidan
>
>Subject: [U-Boot] [PATCH 2/2] drivers: net: fsl_enetc: fix RGMII configuration
>
>Add the missing RGMII PHY modes in which case the MAC has configure its
>RGMII settings. The only difference between these modes is the RX and TX
>delay configuration. A user might choose any RGMII mode in the device tree.
>
>Signed-off-by: Michael Walle 
>---

Applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH 1/2] drivers: net: fsl_enetc: set phydev->node

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: U-Boot  On Behalf Of Michael Walle
>Sent: Saturday, October 26, 2019 6:09 AM
>To: u-boot@lists.denx.de
>Cc: Joe Hershberger ; Catalin Horghidan
>
>Subject: [U-Boot] [PATCH 1/2] drivers: net: fsl_enetc: set phydev->node
>
>The saved ofnode is used by some PHY drivers to access the device tree node
>of the PHY.
>
>Signed-off-by: Michael Walle 
>---

Applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH] armv8: layerscape: set HWCONFIG_BUFFER_SIZE

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: U-Boot  On Behalf Of Michael Walle
>Sent: Monday, October 21, 2019 11:04 PM
>To: u-boot@lists.denx.de
>Cc: Tom Rini 
>Subject: [U-Boot] [PATCH] armv8: layerscape: set HWCONFIG_BUFFER_SIZE
>
>Set the HWCONFIG_BUFFER_SIZE if it is not already set. Otherwise
>compilation will fail if CONFIG_HWCONFIG and HWCONFIG_BUFFER_SIZE are
>not set.
>
>Taken from arch/powerpc/include/asm/config.h.
>
>Signed-off-by: Michael Walle 
>---

Applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH] armv8: fsl-layerscape: introduce fsl_board_late_init()

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: U-Boot  On Behalf Of Michael Walle
>Sent: Tuesday, October 22, 2019 2:08 AM
>To: u-boot@lists.denx.de
>Cc: Tom Rini 
>Subject: [U-Boot] [PATCH] armv8: fsl-layerscape: introduce
>fsl_board_late_init()
>
>The fsl-layerscape already occupies board_late_init(), therefore it is not
>possible for a board to have its own board_late_init(). Introduce
>fsl_board_late_init() which can be implemented in the board specific code.
>
>Signed-off-by: Michael Walle 

Applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH] armv8: fsl-lsch3: convert CONFIG_TARGET_x to CONFIG_ARCH_x

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: U-Boot  On Behalf Of Michael Walle
>Sent: Tuesday, October 22, 2019 4:41 AM
>To: u-boot@lists.denx.de
>Cc: Yinbo Zhu 
>Subject: [U-Boot] [PATCH] armv8: fsl-lsch3: convert CONFIG_TARGET_x to
>CONFIG_ARCH_x
>
>The clocks are not dependent on the target but only on the SoC.
>Therefore, convert the CONFIG_TARGET_x macros to the corresponding
>CONFIG_ARCH_x. This will allow other targets to automatically use the
>common code. Otherwise every new target would have to add itself to the
>"#if defined(CONFIG_TARGET_x) || .." macros.
>
>Signed-off-by: Michael Walle 

Applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH v2 41/41] common: Move old EEPROM functions into a new header

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:48PM -0700, Simon Glass wrote:

> These functions do not use driver model but are still used. Move them to a
> new eeprom_legacy.h header file.
> 
> Signed-off-by: Simon Glass 

I'm not sure if calling this legacy is correct or not as well.  Looking
over cmd/eeprom.c it unwinds to "use DM for i2c if available, not if
not".  It could be enhanced in the future to handle non-i2c eeproms
perhaps, yes.  And then consolidate this with drivers/misc/i2c_eeprom.c
should also be done.

-- 
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 v2 40/41] common: Drop get_endaddr()

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:47PM -0700, Simon Glass wrote:

> This is not used in U-Boot. Drop it.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 37/41] common: Move some board functions out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:44PM -0700, Simon Glass wrote:

> A number of board function belong in init.h with the others. Move them.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 39/41] common: Move trap_init() out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:46PM -0700, Simon Glass wrote:

> Move this function into the init.h header file.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 38/41] common: Move pci_init_board() out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:45PM -0700, Simon Glass wrote:

> This function can be dropped when all boards use driver model for PCI. For
> now, move it into init.h with a comment.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 36/41] common: Move board_get_usable_ram_top() out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:43PM -0700, Simon Glass wrote:

> Move this function into init.h which seems to be designed for this sort
> of thing. Also update the header to declare struct global_data so that it
> can be included without global_data.h being needed.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 35/41] common: Drop board_show_dram()

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:42PM -0700, Simon Glass wrote:

> This function is not defined by any boards so the feature is not used.
> Drop it.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 34/41] common: Move command functions out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:41PM -0700, Simon Glass wrote:

> Move these functions into the command.h header file which is a better fit.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 33/41] common: Move enable/disable_interrupts out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:40PM -0700, Simon Glass wrote:

> Move these two functions into the irq_legacy.h header file.
> Also move interrupt_handler_t as this is used by the irq_install_handler()
> function.
> 
> Signed-off-by: Simon Glass 

Conceptually, whatever we do with irq functions, these should be moved
there as well, agreed.

-- 
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 v2 32/41] common: Move interrupt functions into a new header

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:39PM -0700, Simon Glass wrote:

> These functions do not use driver model but are fairly widely used in
> U-Boot. Move them to a new irq_legacy.h header file.
> 
> Signed-off-by: Simon Glass 

I'm still weighing what I want to say about cpu_legacy.h but I feel like
for irq_legancy.h we're getting ahead of ourselves.  What is the DM
model for this?  Why do we need it?  I didn't dig in to every function
but it looks like we have a mix of U-Boot ABI functions and exception
handlers.  That stuff must be very lean.  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 v2 31/41] arm: powerpc: Tidy up code style for interrupt functions

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:38PM -0700, Simon Glass wrote:

> Remove the unwanted space before the bracket.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 29/41] common: Drop checkicache() and checkdcache()

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:36PM -0700, Simon Glass wrote:

> These are used by only one arch and only within a single file. Drop the
> declarations from the common file.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 27/41] arm: powerpc: Tidy up code style for cache functions

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:34PM -0700, Simon Glass wrote:

> Remove the unwanted space before the bracket.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 25/41] common: Move checkcpu() out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:32PM -0700, Simon Glass wrote:

> This function belongs in cpu.h so move it over.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 24/41] common: Drop cpu_init()

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:31PM -0700, Simon Glass wrote:

> This function is not defined anywhere. Drop it.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 22/41] common: Move mii_init() function out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:29PM -0700, Simon Glass wrote:

> This function belongs in mii.h so move it over.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 20/41] common: Move timer_get_us() function out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:27PM -0700, Simon Glass wrote:

> This function belongs in time.h so move it over and update the comment
> style.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 21/41] common: Move get_ticks() function out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:28PM -0700, Simon Glass wrote:

> This function belongs in time.h so move it over and add a comment.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


[U-Boot] [PATCH] m68k: Drop CONFIG_MCFPIT support

2019-11-11 Thread Tom Rini
All platforms currently use the "MCFTMR" DMA timer rather than the PIT
timer, so drop the MCFPIT code.

Cc: Huan Wang 
Cc: Angelo Dureghello 
Cc: TsiChung Liew 
Cc: Wolfgang Wegner 
Signed-off-by: Tom Rini 
---
 arch/m68k/include/asm/immap.h| 42 -
 arch/m68k/lib/time.c | 63 
 board/freescale/m52277evb/README |  1 -
 board/freescale/m53017evb/README |  1 -
 board/freescale/m5373evb/README  |  1 -
 board/freescale/m54455evb/README |  1 -
 include/configs/M5208EVBE.h  |  1 -
 include/configs/M52277EVB.h  |  1 -
 include/configs/M5235EVB.h   |  1 -
 include/configs/M53017EVB.h  |  1 -
 include/configs/M5329EVB.h   |  1 -
 include/configs/M5373EVB.h   |  1 -
 include/configs/M54418TWR.h  |  1 -
 include/configs/M54451EVB.h  |  1 -
 include/configs/M54455EVB.h  |  1 -
 include/configs/astro_mcf5373l.h |  1 -
 include/configs/stmark2.h|  1 -
 scripts/config_whitelist.txt |  1 -
 18 files changed, 121 deletions(-)

diff --git a/arch/m68k/include/asm/immap.h b/arch/m68k/include/asm/immap.h
index 80fa25769b27..9e84fb9d260c 100644
--- a/arch/m68k/include/asm/immap.h
+++ b/arch/m68k/include/asm/immap.h
@@ -28,12 +28,6 @@
 #define CONFIG_SYS_TIMER_PRESCALER (((gd->bus_clk / 100) - 1) << 8)
 #endif
 
-#ifdef CONFIG_MCFPIT
-#define CONFIG_SYS_UDELAY_BASE (MMAP_PIT0)
-#define CONFIG_SYS_PIT_BASE(MMAP_PIT1)
-#define CONFIG_SYS_PIT_PRESCALE(6)
-#endif
-
 #define CONFIG_SYS_INTR_BASE   (MMAP_INTC0)
 #define CONFIG_SYS_NUM_IRQS(128)
 #endif /* CONFIG_M520x */
@@ -62,12 +56,6 @@
 #define CONFIG_SYS_TIMER_PRESCALER (((gd->bus_clk / 100) - 1) << 8)
 #endif
 
-#ifdef CONFIG_MCFPIT
-#define CONFIG_SYS_UDELAY_BASE (MMAP_PIT0)
-#define CONFIG_SYS_PIT_BASE(MMAP_PIT1)
-#define CONFIG_SYS_PIT_PRESCALE(6)
-#endif
-
 #define CONFIG_SYS_INTR_BASE   (MMAP_INTC0)
 #define CONFIG_SYS_NUM_IRQS(128)
 #endif /* CONFIG_M52277 */
@@ -91,12 +79,6 @@
 #define CONFIG_SYS_TIMER_PRESCALER (((gd->bus_clk / 100) - 1) << 8)
 #endif
 
-#ifdef CONFIG_MCFPIT
-#define CONFIG_SYS_UDELAY_BASE (MMAP_PIT0)
-#define CONFIG_SYS_PIT_BASE(MMAP_PIT1)
-#define CONFIG_SYS_PIT_PRESCALE(6)
-#endif
-
 #define CONFIG_SYS_INTR_BASE   (MMAP_INTC0)
 #define CONFIG_SYS_NUM_IRQS(128)
 #endif /* CONFIG_M5235 */
@@ -285,12 +267,6 @@
 #define CONFIG_SYS_TIMER_PRESCALER (((gd->bus_clk / 100) - 1) << 8)
 #endif
 
-#ifdef CONFIG_MCFPIT
-#define CONFIG_SYS_UDELAY_BASE (MMAP_PIT0)
-#define CONFIG_SYS_PIT_BASE(MMAP_PIT1)
-#define CONFIG_SYS_PIT_PRESCALE(6)
-#endif
-
 #define CONFIG_SYS_INTR_BASE   (MMAP_INTC0)
 #define CONFIG_SYS_NUM_IRQS(128)
 #endif /* CONFIG_M5301x */
@@ -315,12 +291,6 @@
 #define CONFIG_SYS_TIMER_PRESCALER (((gd->bus_clk / 100) - 1) << 8)
 #endif
 
-#ifdef CONFIG_MCFPIT
-#define CONFIG_SYS_UDELAY_BASE (MMAP_PIT0)
-#define CONFIG_SYS_PIT_BASE(MMAP_PIT1)
-#define CONFIG_SYS_PIT_PRESCALE(6)
-#endif
-
 #define CONFIG_SYS_INTR_BASE   (MMAP_INTC0)
 #define CONFIG_SYS_NUM_IRQS(128)
 #endif /* CONFIG_M5329 && CONFIG_M5373 */
@@ -355,12 +325,6 @@
 #define CONFIG_SYS_TIMER_PRESCALER (((gd->bus_clk / 100) - 1) << 8)
 #endif
 
-#ifdef CONFIG_MCFPIT
-#define CONFIG_SYS_UDELAY_BASE (MMAP_PIT0)
-#define CONFIG_SYS_PIT_BASE(MMAP_PIT1)
-#define CONFIG_SYS_PIT_PRESCALE(6)
-#endif
-
 #define CONFIG_SYS_INTR_BASE   (MMAP_INTC0)
 #define CONFIG_SYS_NUM_IRQS(192)
 
@@ -391,12 +355,6 @@
 #define CONFIG_SYS_TIMER_PRESCALER (((gd->bus_clk / 100) - 1) << 8)
 #endif
 
-#ifdef CONFIG_MCFPIT
-#define CONFIG_SYS_UDELAY_BASE (MMAP_PIT0)
-#define CONFIG_SYS_PIT_BASE(MMAP_PIT1)
-#define CONFIG_SYS_PIT_PRESCALE(6)
-#endif
-
 #define CONFIG_SYS_INTR_BASE   (MMAP_INTC0)
 #define CONFIG_SYS_NUM_IRQS(128)
 
diff --git a/arch/m68k/lib/time.c b/arch/m68k/lib/time.c
index a6345a0bc9c0..52f6dd753321 100644
--- a/arch/m68k/lib/time.c
+++ b/arch/m68k/lib/time.c
@@ -108,69 +108,6 @@ ulong get_timer(ulong base)
 
 #endif /* CONFIG_MCFTMR */
 
-#if defined(CONFIG_MCFPIT)
-#if !defined(CONFIG_SYS_PIT_BASE)
-#  error   "CONFIG_SYS_PIT_BASE not defined!"
-#endif
-
-static unsigned short lastinc;
-
-void __udelay(unsigned long usec)
-{
-   volatile pit_t *timerp = (pit_t *) (CONFIG_SYS_UDELAY_BASE);
-   uint tmp;
-
-   while (usec > 0) {
-   if (usec > 65000)
-   tmp = 65000;
-   else
-   tmp = usec;
-   usec = usec - tmp;
-
-   /* Set up TIMER 3 as timebase clock */
-  

Re: [U-Boot] [PATCH v2 19/41] common: Move wait_ticks functions out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:26PM -0700, Simon Glass wrote:

> This function belongs in time.h so move it over and add a comment.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v2: None
> 
>  arch/arm/cpu/pxa/pxa2xx.c | 1 +
>  drivers/timer/mpc83xx_timer.c | 1 +
>  include/common.h  | 1 -
>  include/time.h| 9 +
>  4 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/pxa/pxa2xx.c b/arch/arm/cpu/pxa/pxa2xx.c
> index 0b28f0a3ef..43c206b245 100644
> --- a/arch/arm/cpu/pxa/pxa2xx.c
> +++ b/arch/arm/cpu/pxa/pxa2xx.c
> @@ -10,6 +10,7 @@
>   */
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c
> index dfbc8672b2..69949d5333 100644
> --- a/drivers/timer/mpc83xx_timer.c
> +++ b/drivers/timer/mpc83xx_timer.c
> @@ -9,6 +9,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  
> diff --git a/include/common.h b/include/common.h
> index 20d143deb8..091b54787f 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -286,7 +286,6 @@ int cleanup_before_linux_select(int flags);
>  
>  /* arch/$(ARCH)/lib/ticks.S */
>  uint64_t get_ticks(void);
> -void wait_ticks(unsigned long);
>  
>  /* lib/uuid.c */
>  #include 
> diff --git a/include/time.h b/include/time.h
> index a1bdefc164..0b3835f053 100644
> --- a/include/time.h
> +++ b/include/time.h
> @@ -86,4 +86,13 @@ ulong usec2ticks(unsigned long usec);
>   */
>  ulong ticks2usec(unsigned long ticks);
>  
> +/**
> + * wait_ticks() - waits a given number of ticks
> + *
> + * This is an internal funciton. Normally you should use udelay() or mdelay()
> + *
> + * @ticks: Number of ticks to wait
> + */
> +void wait_ticks(unsigned long ticks);
> +
>  #endif /* _TIME_H */

OK, so pxa has "pxa_wait_ticks" not "wait_ticks", so maybe you need to
check your scripts and re-run the series to catch any other similar
cases?  As an aside, pxa_wait_ticks should be static inline'd and since
it's a one-time-use function perhaps just moved in to the caller.

Next, wait_ticks exists on m68k but is unused and could be dropped.  But
in this case I see it's guarded on CONFIG_MCFPIT which is unset, so I'll
follow up and clean that all out.

Which brings us to PowerPC, where we have the asm version (as implied by
the common.h comment) and then mpc83xx has a specific timer driver that
provides it, and then wait_ticks is used to implement udelay on PowerPC
so perhaps the comment should read more like:
"This is an internal function typically used to implement udelay() and
similar".

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 v2 5/5] sifive: fu540: Enable spi-nor flash support

2019-11-11 Thread Bin Meng
Hi Jagan,

On Sat, Nov 9, 2019 at 7:57 PM Jagan Teki  wrote:
>
> Hi Bin,
>
> On Tue, Oct 29, 2019 at 3:50 PM Bin Meng  wrote:
> >
> > Hi Jagan,
> >
> > On Tue, Oct 29, 2019 at 5:38 PM Bin Meng  wrote:
> > >
> > > Hi Jagan,
> > >
> > > On Wed, Oct 16, 2019 at 10:58 PM Jagan Teki  
> > > wrote:
> > > >
> > > > HiFive Unleashed A00 support is25wp256 spi-nor flash,
> > > > So enable the same and add test result log for future
> > > > reference.
> > > >
> > > > Tested on SiFive FU540 board.
> > > >
> > > > Signed-off-by: Jagan Teki 
> > > > Reviewed-by: Bin Meng 
> > > > Tested-by: Bin Meng 
> > > > ---
> > > >  .../dts/hifive-unleashed-a00-u-boot.dtsi  |  1 +
> > > >  board/sifive/fu540/Kconfig|  3 +++
> > > >  doc/board/sifive/fu540.rst| 19 +++
> > > >  3 files changed, 23 insertions(+)
> > > >
> > > > diff --git a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi 
> > > > b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > > > index 25ec8265a5..d7a64134db 100644
> > > > --- a/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > > > +++ b/arch/riscv/dts/hifive-unleashed-a00-u-boot.dtsi
> > > > @@ -5,6 +5,7 @@
> > > >
> > > >  / {
> > > > aliases {
> > > > +   spi0 = &qspi0;
> > > > spi2 = &qspi2;
> > > > };
> > > >  };
> > > > diff --git a/board/sifive/fu540/Kconfig b/board/sifive/fu540/Kconfig
> > > > index 5d65080429..c5a1bca03c 100644
> > > > --- a/board/sifive/fu540/Kconfig
> > > > +++ b/board/sifive/fu540/Kconfig
> > > > @@ -26,6 +26,7 @@ config BOARD_SPECIFIC_OPTIONS # dummy
> > > > imply CMD_FS_GENERIC
> > > > imply CMD_NET
> > > > imply CMD_PING
> > > > +   imply CMD_SF
> > > > imply CLK_SIFIVE
> > > > imply CLK_SIFIVE_FU540_PRCI
> > > > imply DOS_PARTITION
> > > > @@ -40,6 +41,8 @@ config BOARD_SPECIFIC_OPTIONS # dummy
> > > > imply SIFIVE_SERIAL
> > > > imply SPI
> > > > imply SPI_SIFIVE
> > > > +   imply SPI_FLASH
> > > > +   imply SPI_FLASH_ISSI
> > > > imply MMC
> > > > imply MMC_SPI
> > > > imply MMC_BROKEN_CD
> > > > diff --git a/doc/board/sifive/fu540.rst b/doc/board/sifive/fu540.rst
> > > > index 91b94ee06f..2e70cad02e 100644
> > > > --- a/doc/board/sifive/fu540.rst
> > > > +++ b/doc/board/sifive/fu540.rst
> > > > @@ -366,3 +366,22 @@ load uImage.
> > > >
> > > > Please press Enter to activate this console.
> > > > / #
> > > > +
> > > > +Sample spi nor flash test
> > > > +-
> > > > +
> > > > +.. code-block:: none
> > > > +
> > > > +   => sf probe 0:2
> > >
> > > The cs number can't be 2. It should be zero.
> >
> > With this patch series, we got crazy duplicated flash devices created,
> > see below:
> >
> > => sf probe
> > unrecognized JEDEC id bytes: ff, ff, ff
> > Failed to initialize SPI flash at 0:0 (error -2)
> > => sf probe 0:2
> > SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, total 32 
> > MiB
> > => sf probe 0:4
> > SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, total 32 
> > MiB
> > => sf probe 0:6
> > SF: Detected is25wp256 with page size 256 Bytes, erase size 4 KiB, total 32 
> > MiB
> > => dm tree
> >  Class Index  Probed  DriverName
> > ---
> >  root  0  [ + ]   root_driver   root_driver
> >  simple_bus0  [ + ]   generic_simple_bus|-- soc
> >  clk   0  [ + ]   sifive-fu540-prci |   |--
> > clock-controller@1000
> >  serial0  [ + ]   serial_sifive |   |-- serial@1001
> >  serial1  [   ]   serial_sifive |   |-- serial@10011000
> >  spi   0  [ + ]   sifive_spi|   |-- spi@1004
> >  spi_flash 0  [   ]   spi_flash_std |   |   |-- flash@0
> >  spi_flash 1  [ + ]   spi_flash_std |   |   |-- spi_flash@0:2
> >  spi_flash 2  [ + ]   spi_flash_std |   |   |-- spi_flash@0:4
> >  spi_flash 3  [ + ]   spi_flash_std |   |   `-- spi_flash@0:6
> >
> > With my patch series below
> > http://patchwork.ozlabs.org/project/uboot/list/?series=129736
> >
> > the CS number check was added to the SPI flash hence we got:
> >
> > => sf probe
> > unrecognized JEDEC id bytes: ff, ff, ff
> > Failed to initialize SPI flash at 0:0 (error -2)
> > => sf probe 2
> > Invalid cs 2 (err=-22)
> > Invalid cs 2 (err=-22)
> > Invalid chip select 0:2 (err=-22)
> > Failed to initialize SPI flash at 0:2 (error -22)
> > => sf probe 4
> > Invalid cs 4 (err=-22)
> > Invalid cs 4 (err=-22)
> > Invalid chip select 0:4 (err=-22)
> > Failed to initialize SPI flash at 0:4 (error -22)
> >
> > So we still need figure out why CS number 0 cannot work on SiFive.
>
> The existing quad wire that driver pushing for flash seems not
> detecting flash at CS 0 so making cr to single wire detecting flash at

I vaguely remember someone from SiFive pos

[U-Boot] [PATCH v1] imx: bootaux: elf firmware support

2019-11-11 Thread Igor Opaniuk
From: Igor Opaniuk 

Currently imx-specific bootaux command doesn't support ELF format
firmware for Cortex-M4 core.

This patches introduces a PoC implementation of handling elf firmware
(load_elf_image_phdr() was copy-pasted from elf.c just for PoC).

This has the advantage that the user does not need to know to which
address the binary has been linked to. However, in order to handle
and load the elf sections to the right address, we need to translate the
Cortex-M4 core memory addresses to primary/host CPU memory
addresses (Cortex A7/A9 cores).

This allows to boot firmwares from any location with just using
bootaux, e.g.:
> tftp ${loadaddr} hello_world.elf && bootaux ${loadaddr}

Similar translation table can be found in the Linux remoteproc
driver [1].

[1] 
https://elixir.bootlin.com/linux/latest/source/drivers/remoteproc/imx_rproc.c

Signed-off-by: Igor Opaniuk 
Signed-off-by: Stefan Agner 
---

 arch/arm/include/asm/mach-imx/sys_proto.h |  7 ++
 arch/arm/mach-imx/imx_bootaux.c   | 87 +--
 arch/arm/mach-imx/mx7/soc.c   | 28 
 3 files changed, 118 insertions(+), 4 deletions(-)

diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h 
b/arch/arm/include/asm/mach-imx/sys_proto.h
index 52c83ba9e4..4428a7fa0b 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -139,6 +139,13 @@ enum boot_dev_type_e {
 extern struct rom_api *g_rom_api;
 #endif
 
+/* address translation table */
+struct rproc_att {
+   u32 da; /* device address (From Cortex M4 view) */
+   u32 sa; /* system bus address */
+   u32 size; /* size of reg range */
+};
+
 u32 get_nr_cpus(void);
 u32 get_cpu_rev(void);
 u32 get_cpu_speed_grade_hz(void);
diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index 3d9422d5a2..7f4bbfe885 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -7,18 +7,94 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
-int arch_auxiliary_core_up(u32 core_id, ulong boot_private_data)
+const __weak struct rproc_att hostmap[] = { };
+
+static const struct rproc_att *get_host_mapping(unsigned long auxcore)
+{
+   const struct rproc_att *mmap = hostmap;
+
+   while (mmap && mmap->size) {
+   if (mmap->da <= auxcore &&
+   mmap->da + mmap->size > auxcore)
+   return mmap;
+   mmap++;
+   }
+
+   return NULL;
+}
+
+/*
+ * A very simple elf loader, assumes the image is valid, returns the
+ * entry point address.
+ */
+static unsigned long load_elf_image_phdr(unsigned long addr)
+{
+   Elf32_Ehdr *ehdr; /* ELF header structure pointer */
+   Elf32_Phdr *phdr; /* Program header structure pointer */
+   int i;
+
+   ehdr = (Elf32_Ehdr *)addr;
+   phdr = (Elf32_Phdr *)(addr + ehdr->e_phoff);
+
+   /* Load each program header */
+   for (i = 0; i < ehdr->e_phnum; ++i, ++phdr) {
+   const struct rproc_att *mmap = get_host_mapping(phdr->p_paddr);
+   void *dst, *src;
+
+   if (phdr->p_type != PT_LOAD)
+   continue;
+
+   if (!mmap) {
+   printf("Invalid aux core address: %08x",
+  phdr->p_paddr);
+   return 0;
+   }
+
+   dst = (void *)(phdr->p_paddr - mmap->da) + mmap->sa;
+   src = (void *)addr + phdr->p_offset;
+
+   debug("Loading phdr %i to 0x%p (%i bytes)\n",
+ i, dst, phdr->p_filesz);
+
+   if (phdr->p_filesz)
+   memcpy(dst, src, phdr->p_filesz);
+   if (phdr->p_filesz != phdr->p_memsz)
+   memset(dst + phdr->p_filesz, 0x00,
+  phdr->p_memsz - phdr->p_filesz);
+   flush_cache((unsigned long)dst &
+   ~(CONFIG_SYS_CACHELINE_SIZE - 1),
+   ALIGN(phdr->p_filesz, CONFIG_SYS_CACHELINE_SIZE));
+   }
+
+   return ehdr->e_entry;
+}
+
+int arch_auxiliary_core_up(u32 core_id, ulong addr)
 {
ulong stack, pc;
 
-   if (!boot_private_data)
+   if (!addr)
return -EINVAL;
 
-   stack = *(u32 *)boot_private_data;
-   pc = *(u32 *)(boot_private_data + 4);
+   if (valid_elf_image(addr)) {
+   stack = 0x0;
+   pc = load_elf_image_phdr(addr);
+   if (!pc)
+   return CMD_RET_FAILURE;
+
+   } else {
+   /*
+* Assume binary file with vector table at the beginning.
+* Cortex-M4 vector tables start with the stack pointer (SP)
+* and reset vector (initial PC).
+*/
+   stack = *(u32 *)addr;
+   pc = *(u32 *)(addr + 4);
+   }
 
/* Set the stack and pc to M4 bootROM */
writel(stack, M4_B

Re: [U-Boot] [PATCH v2 16/41] common: Move serial functions out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:23PM -0700, Simon Glass wrote:

> These functions belong in serial.h so move them over.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 18/41] common: Move some time functions out of common.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:25PM -0700, Simon Glass wrote:

> These functions belong in time.h so move them over and add comments.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 13/41] common: Move env_get_ip() to net.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:20PM -0700, Simon Glass wrote:

> This function relates to networking, so move it out of the common.h
> header file.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 17/41] common: Add a new lz4.h header file

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:24PM -0700, Simon Glass wrote:

> Add a header file to house the lz4 compression function. Add a comment
> while we are here, since it not even clear from the name what the function
> actuall does.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 11/41] common: Move sorting functions to their own header file

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:18PM -0700, Simon Glass wrote:

> These don't need to be in common.h so move them out into a new header.
> Also add some missing comments.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 08/41] crc32: Use the crc.h header for crc functions

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:15PM -0700, Simon Glass wrote:

> Drop inclusion of crc.h in common.h and use the correct header directly
> instead.
> 
> With this we can drop the conflicting definition in fw_env.h and rely on
> the crc.h header, which is already included.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 15/41] common: Move serial_printf() to the serial header

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:22PM -0700, Simon Glass wrote:

> Move this function header to serial.h since this function is clearly
> related to serial. The function itself stays in console.c since we don't
> have a single serial file. DM and non-DM each has a separate file so we
> would have to either create a new common serial file, or repeat the
> function in both serial.c and serial-uclass.c, neither of which seem
> worthwhile.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 07/41] crc: Fix code style with crc functions

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:14PM -0700, Simon Glass wrote:

> Some of these have a space before the bracket. Drop it to fix the style.
> Add some missing function comments while here.
> 
> Note that u32 and u8 cannot be used here since crc.h is included on the
> host side.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 10/41] common: Move bootcount functions to their header file

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:17PM -0700, Simon Glass wrote:

> These don't need to be in common.h so move them out.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 14/41] serial: usb: Correct the usbtty_...() prototypes

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:21PM -0700, Simon Glass wrote:

> The function declarations in serial.h are not in sync with what is
> currently used in usbtty. Fix this by updating the header and including
> it, to help catch future such problems.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 04/41] status_led: Tidy up the code style

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:11PM -0700, Simon Glass wrote:

> There are a few whitespace problems with this code. Tidy them up.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 06/41] common: Drop linux/crc8.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:13PM -0700, Simon Glass wrote:

> We have an existing U-Boot header for the one function that this defines.
> Use that instead of the linux/ one. Move over the nice comment.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 05/41] common: Move random-number functions into their own header

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:12PM -0700, Simon Glass wrote:
> Create a new rand.h header file and move functions into it, to reduce
> the size of common.h
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v2: None
> 
>  include/common.h |  6 --
>  include/net.h|  1 +
>  include/rand.h   | 40 
>  lib/rand.c   |  1 +
>  net/link_local.c |  1 +
>  5 files changed, 43 insertions(+), 6 deletions(-)
>  create mode 100644 include/rand.h
> 
> diff --git a/include/common.h b/include/common.h
> index 52bcc2e591..b09c7aeddd 100644
> --- a/include/common.h
> +++ b/include/common.h
> @@ -325,12 +325,6 @@ char *   strmhz(char *buf, unsigned long hz);
>  /* lib/crc32.c */
>  #include 
>  
> -/* lib/rand.c */
> -#define RAND_MAX -1U
> -void srand(unsigned int seed);
> -unsigned int rand(void);
> -unsigned int rand_r(unsigned int *seedp);
> -
>  /*
>   * STDIO based functions (can always be used)
>   */
> diff --git a/include/net.h b/include/net.h
> index 75a16e4c8f..d8d187d8af 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -16,6 +16,7 @@
>  #include/* for nton* / ntoh* stuff */
>  #include 
>  #include 
> +#include 
>  
>  #define DEBUG_LL_STATE 0 /* Link local state machine changes */
>  #define DEBUG_DEV_PKT 0  /* Packets or info directed to the 
> device */

OK, but common.h includes net.h, and I don't see this addressed further
in the series.  So this is a step in the right direction, but does it
get messy to not include it?

-- 
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 v2 03/41] common: Drop global inclusion of status_led.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:10PM -0700, Simon Glass wrote:

> This is only used by a few files so it should not be in the common header.
> Move it out.
> 
> Signed-off-by: Simon Glass 

Reviewed-by: Tom Rini 

-- 
Tom


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


Re: [U-Boot] [PATCH v2 12/41] Move strtomhz() to vsprintf.h

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:19PM -0700, Simon Glass wrote:
> At present this function sits in its own file but it does not really
> justify it. There are similar string functions in vsprintf.h, so move it
> there. Also add the missing function comment.
> 
> Use the vsprintf.h include file explicitly where needed.
> 
> Signed-off-by: Simon Glass 
[snip]
> diff --git a/lib/strmhz.c b/lib/strmhz.c
> deleted file mode 100644
> index 66afe91ab9..00
> --- a/lib/strmhz.c
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0+
> -/*
> - * (C) Copyright 2002-2006
> - * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
> - */
[snip]
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 425f2f53f7..a03a076a0a 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c

Need to move the copyright to this file now too.

-- 
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 v2 09/41] spl: bootcount: Move code out of header file

2019-11-11 Thread Tom Rini
On Fri, Nov 08, 2019 at 12:53:16PM -0700, Simon Glass wrote:

> It is not good practice to write code in a header file. If it is included
> multiple times then the code can cause duplicate functions.
> 
> Move the bootcount_store() and bootcount_load() functions into SPL.
> 
> Note: bootcount is a bit strange in that it uses driver model but does not
> define proper drivers. This should be fixed.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v2: None
> 
>  common/spl/spl.c| 11 +++
>  include/bootcount.h |  4 
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index cc5507f757..a2ef13a41c 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -830,3 +830,14 @@ ulong spl_relocate_stack_gd(void)
>   return 0;
>  #endif
>  }
> +
> +#if defined(CONFIG_BOOTCOUNT_LIMIT) && !defined(CONFIG_SPL_BOOTCOUNT_LIMIT)
> +void bootcount_store(ulong a)
> +{
> +}
> +
> +ulong bootcount_load(void)
> +{
> + return 0;
> +}
> +#endif
> diff --git a/include/bootcount.h b/include/bootcount.h
> index 8fa8cf8218..a26a385233 100644
> --- a/include/bootcount.h
> +++ b/include/bootcount.h
> @@ -127,10 +127,6 @@ static inline void bootcount_inc(void)
>  #endif /* !CONFIG_SPL_BUILD */
>  }
>  
> -#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_BOOTCOUNT_LIMIT)
> -void bootcount_store(ulong a) {};
> -ulong bootcount_load(void) { return 0; }
> -#endif /* CONFIG_SPL_BUILD && !CONFIG_SPL_BOOTCOUNT_LIMIT */
>  #else
>  static inline int bootcount_error(void) { return 0; }
>  static inline void bootcount_inc(void) {}

Adding a few folks that have touched bootcount of late to chime in here,
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] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-11-11 Thread Adam Ford
On Fri, Nov 8, 2019 at 11:59 AM Bartosz Golaszewski  wrote:
>
> pt., 8 lis 2019 o 18:33 Bartosz Golaszewski
>  napisał(a):
> >
> > pt., 8 lis 2019 o 17:14 Adam Ford  napisał(a):
> > >
> > > On Fri, Nov 8, 2019 at 9:50 AM Bartosz Golaszewski
> > >  wrote:
> > > >
> > > > pt., 25 paź 2019 o 18:10 Bartosz Golaszewski  napisał(a):
> > > > >
> > > > > czw., 26 wrz 2019 o 01:21 Faiz Abbas  napisał(a):
> > > > > >
> > > > > > Hi,
> > > > > >
> > > > > > On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
> > > > > > > From: Bartosz Golaszewski 
> > > > > > >
> > > > > > > Enable CONFIG_SPL_DM and enable the driver model for serial by 
> > > > > > > defining
> > > > > > > an appropriate device in the board file for da850-lcdk.
> > > > > > >
> > > > > >
> > > > > > This breaks booting from MMC on omapl138_lcdk. You didn't add a
> > > > > > U_BOOT_DEVICE for the mmc node.
> > > > > >
> > > > > > Thanks,
> > > > > > Faiz
> > > > >
> > > > > Just letting you know I haven't forgotten about this. I finally got
> > > > > some time to work on it this week, but it turned out to be
> > > > > non-trivial, as for some reason the set_cmd mmc callback is not being
> > > > > properly assigned in SPL with driver-model and I couldn't find out why
> > > > > so far. Next week I'm at ELCE, but I'll be back at it on Thursday. I'm
> > > > > not sure if you want to revert the offending patch for now or this can
> > > > > wait for another week?
> > > > >
> > > > > Best regards,
> > > > > Bartosz Golaszewski
> > > >
> > > > I've been working on this some more this week and noticed that in SPL
> > > > for some reason the bind function of the mmc driver is not called
> > > > (despite the driver being probed fine), but so far I've been unable to
> > > > figure out why exactly. This is the reason for the failure as the mmc
> > > > is not properly setup but the mmc core thinks it is and tries using
> > > > it.
> > > >
> > > > I've tried both using a U_BOOT_DEVICE() defined in the board file or
> > > > adding the mmc node to arch/arm/dts/da850-lcdk-u-boot.dtsi.
> > > >
> > > > Adam: you know davinci's SPL pretty well - do you have any suggestions?
> > >
> > > I am not sure that I know it well.  It's just one of several TI
> > > platforms that I support for Logic PD.
> > >
> > > Two thoughts I had:  There are aliases setup for various peripherals
> > > but I am not seeing one for mmc0 = &mmc1.  I a not sure if it will
> > > help or not but it is different I see.
> > >
> >
> > I'm having the same problem even when I'm defining the device using
> > U_BOOT_DEVICE() in the relevant board file.
> >
> > > There is also a function void board_boot_order (u32 *spl_boot_list)
> > > which can force the system to boot from a given device (ie, MMC1).
> > > It's an optional function, but it's a quick and dirty option to try.
> > >
> >
> > Thanks, I'll take a look at that.
>
> It's still the same, no matter what order I specify here.
>
> One thing that bothers me is: if I manually call mmc_bind() from probe
> instead of the bind() callback, it fails with ENOMEM on memory
> allocation when creating the block device. I'm wondering if it has
> something to do with the simple malloc we're using now.

Over the weekend, I sent a series of patches.  One of them, [1], was
to increase the size of the available RAM before relocation. I believe
i doubled the amount from 1k to 2k.

Can you see if the ENMOM error still exists?

[1] - https://patchwork.ozlabs.org/patch/1192574/

adam
>
> Bart
>
> >
> > > What are the jumper settings to boot from SD,  I have an lcdk I can
> > > try when I have some time.  It's not an official board I can support,
> > > but I can tinker when I'm off the clock.
> > >
> >
> > When looking at the board with the ethernet port in the upper-right
> > corner the jumpers should be like this:
> >
> > ---^
> >
> > You can flash the .ais image onto an SD card with the following command:
> >
> > dd if=u-boot.ais of= seek=117 bs=512 conv=fsync
> >
> > Thanks!
> > Bart
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Add support for imxrt

2019-11-11 Thread Fabio Estevam
Hi Giulio,

On Wed, Nov 6, 2019 at 7:50 PM Giulio Benetti
 wrote:

> With this you mean adding every single mux, divider, gate, fixed_factor
> and pfd(i.e. linux/drivers/clk/imx/clk-imxq6.c)?
>
> Or only a shrinked version of that?
> I mean, is it ok if I list everything during imxrt_clk_probe()?

I think a shrinked version would be fine.

Regards,

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


Re: [U-Boot] [PATCH v3 2/2] sifive: fu540: Enable OF_SEPARATE

2019-11-11 Thread Andreas Schwab
On Nov 09 2019, Jagan Teki wrote:

> diff --git a/doc/board/sifive/fu540.rst b/doc/board/sifive/fu540.rst
> index 7807f5b2c1..91b94ee06f 100644
> --- a/doc/board/sifive/fu540.rst
> +++ b/doc/board/sifive/fu540.rst
> @@ -58,7 +58,7 @@ firmware. We need to compile OpenSBI with below command:
>  
>  .. code-block:: none
>  
> -make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH= 
> FW_PAYLOAD_FDT_PATH=
> +make PLATFORM=sifive/fu540 FW_PAYLOAD_PATH=
>  
>  (Note: Prefer hifive-unleashed-a00.dtb from Linux-5.3 or higher)
>  (Note: Linux-5.2 is also fine but it does not have ethernet DT node)

Are these notes now obsolete?

Andreas.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 12/13] davinci: omapl138-lcdk: enable driver-model in SPL

2019-11-11 Thread Faiz Abbas
Hi Bartosz,

On 08/11/19 9:20 PM, Bartosz Golaszewski wrote:
> pt., 25 paź 2019 o 18:10 Bartosz Golaszewski  napisał(a):
>>
>> czw., 26 wrz 2019 o 01:21 Faiz Abbas  napisał(a):
>>>
>>> Hi,
>>>
>>> On 29/07/19 12:28 PM, Bartosz Golaszewski wrote:
 From: Bartosz Golaszewski 

 Enable CONFIG_SPL_DM and enable the driver model for serial by defining
 an appropriate device in the board file for da850-lcdk.

>>>
>>> This breaks booting from MMC on omapl138_lcdk. You didn't add a
>>> U_BOOT_DEVICE for the mmc node.
>>>
>>> Thanks,
>>> Faiz
>>
>> Just letting you know I haven't forgotten about this. I finally got
>> some time to work on it this week, but it turned out to be
>> non-trivial, as for some reason the set_cmd mmc callback is not being
>> properly assigned in SPL with driver-model and I couldn't find out why
>> so far. Next week I'm at ELCE, but I'll be back at it on Thursday. I'm
>> not sure if you want to revert the offending patch for now or this can
>> wait for another week?
>>
>> Best regards,
>> Bartosz Golaszewski
> 
> I've been working on this some more this week and noticed that in SPL
> for some reason the bind function of the mmc driver is not called
> (despite the driver being probed fine), but so far I've been unable to
> figure out why exactly.

I suspect you need to set DM_FLAG_PRE_RELOC for the bind to be called.
Can you try setting this flag?

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


[U-Boot] [PATCH] regmap: Fix potential memory leaks

2019-11-11 Thread Faiz Abbas
Free allocated memory in case of an error in regmap_init_mem() and
regmap_init_mem_index().

Signed-off-by: Faiz Abbas 
---
 drivers/core/regmap.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index e9e55c9d16..a974744a61 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -134,7 +134,7 @@ int regmap_init_mem_index(ofnode node, struct regmap 
**mapp, int index)
 
ret = init_range(node, map->ranges, addr_len, size_len, index);
if (ret)
-   return ret;
+   goto err;
 
if (ofnode_read_bool(node, "little-endian"))
map->endianness = REGMAP_LITTLE_ENDIAN;
@@ -147,6 +147,10 @@ int regmap_init_mem_index(ofnode node, struct regmap 
**mapp, int index)
 
*mapp = map;
 
+   return 0;
+err:
+   regmap_uninit(map);
+
return ret;
 }
 
@@ -158,6 +162,7 @@ int regmap_init_mem(ofnode node, struct regmap **mapp)
int addr_len, size_len, both_len;
int len;
int index;
+   int ret;
 
addr_len = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
if (addr_len < 0) {
@@ -200,10 +205,9 @@ int regmap_init_mem(ofnode node, struct regmap **mapp)
 
for (range = map->ranges, index = 0; count > 0;
 count--, range++, index++) {
-   int ret = init_range(node, range, addr_len, size_len, index);
-
+   ret = init_range(node, range, addr_len, size_len, index);
if (ret)
-   return ret;
+   goto err;
}
 
if (ofnode_read_bool(node, "little-endian"))
@@ -218,6 +222,10 @@ int regmap_init_mem(ofnode node, struct regmap **mapp)
*mapp = map;
 
return 0;
+err:
+   regmap_uninit(map);
+
+   return ret;
 }
 #endif
 
-- 
2.19.2

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


[U-Boot] [PATCH] net: cpsw: Add NULL pointer check

2019-11-11 Thread Faiz Abbas
Add null pointer check to take care of out of memory errors.

Signed-off-by: Faiz Abbas 
---
 drivers/net/ti/cpsw.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c
index 4a990be93e..b710ae4053 100644
--- a/drivers/net/ti/cpsw.c
+++ b/drivers/net/ti/cpsw.c
@@ -1223,6 +1223,9 @@ static int cpsw_eth_ofdata_to_platdata(struct udevice 
*dev)
int ret;
 
data = calloc(1, sizeof(struct cpsw_platform_data));
+   if (!data)
+   return -ENOMEM;
+
pdata->priv_pdata = data;
pdata->iobase = dev_read_addr(dev);
data->version = CPSW_CTRL_VERSION_2;
-- 
2.19.2

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


[U-Boot] [PATCH] thermal: ti-bandgap: Fix adc value datatype

2019-11-11 Thread Faiz Abbas
The CORE_TEMP_SENSOR_MPU register gives a raw adc value which needs to
be indexed into a lookup table to get the actual temperature. Fix the
naming and datatype of the adc value variable.

Signed-off-by: Faiz Abbas 
---
 drivers/thermal/ti-bandgap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/thermal/ti-bandgap.c b/drivers/thermal/ti-bandgap.c
index b490391e96..8b332f116c 100644
--- a/drivers/thermal/ti-bandgap.c
+++ b/drivers/thermal/ti-bandgap.c
@@ -26,7 +26,7 @@
 
 struct ti_bandgap {
ulong   base;
-   int temperature;/* in mili degree celsius */
+   uintadc_val;
 };
 
 /*
@@ -162,8 +162,8 @@ static int ti_bandgap_get_temp(struct udevice *dev,  int 
*temp)
 {
struct ti_bandgap *bgp = dev_get_priv(dev);
 
-   bgp->temperature = 0x3ff & readl(bgp->base + CTRL_CORE_TEMP_SENSOR_MPU);
-   *temp = dra752_adc_to_temp[bgp->temperature - DRA752_ADC_START_VALUE];
+   bgp->adc_val = 0x3ff & readl(bgp->base + CTRL_CORE_TEMP_SENSOR_MPU);
+   *temp = dra752_adc_to_temp[bgp->adc_val - DRA752_ADC_START_VALUE];
 
return 0;
 }
-- 
2.19.2

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


Re: [U-Boot] [PATCH v2 1/6] armv8: fsl-layerscape: guard caam specific defines

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: Laurentiu Tudor 
>Sent: Friday, October 18, 2019 2:32 PM
>To: u-boot@lists.denx.de; Priyanka Jain 
>Cc: Horia Geanta ; Laurentiu Tudor
>
>Subject: [PATCH v2 1/6] armv8: fsl-layerscape: guard caam specific defines
>
>From: Laurentiu Tudor 
>
>These macros should only be used when CONFIG_FSL_CAAM is present.
>
>Signed-off-by: Laurentiu Tudor 
>Reviewed-by: Horia Geant?? 
>---
>Changes in v2:
> - added Reviewed-by tag
>
> arch/arm/cpu/armv8/fsl-layerscape/ls1028_ids.c | 2 ++
>arch/arm/cpu/armv8/fsl-layerscape/ls1088_ids.c | 2 ++
> 2 files changed, 4 insertions(+)
>
>diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1028_ids.c
>b/arch/arm/cpu/armv8/fsl-layerscape/ls1028_ids.c
>index d9d125e8ba..9462298fbf 100644
>--- a/arch/arm/cpu/armv8/fsl-layerscape/ls1028_ids.c
>+++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1028_ids.c
>@@ -18,6 +18,7 @@ struct icid_id_table icid_tbl[] = {
>   SET_QDMA_ICID("fsl,ls1028a-qdma", FSL_DMA_STREAM_ID),
>   SET_GPU_ICID("fsl,ls1028a-gpu", FSL_GPU_STREAM_ID),
>   SET_DISPLAY_ICID(FSL_DISPLAY_STREAM_ID),
>+#ifdef CONFIG_FSL_CAAM
>   SET_SEC_JR_ICID_ENTRY(0, FSL_SEC_JR1_STREAM_ID),
>   SET_SEC_JR_ICID_ENTRY(1, FSL_SEC_JR2_STREAM_ID),
>   SET_SEC_JR_ICID_ENTRY(2, FSL_SEC_JR3_STREAM_ID), @@ -28,6 +29,7
>@@ struct icid_id_table icid_tbl[] = {
>   SET_SEC_RTIC_ICID_ENTRY(3, FSL_SEC_STREAM_ID),
>   SET_SEC_DECO_ICID_ENTRY(0, FSL_SEC_STREAM_ID),
>   SET_SEC_DECO_ICID_ENTRY(1, FSL_SEC_STREAM_ID),
>+#endif
> };
>
> int icid_tbl_sz = ARRAY_SIZE(icid_tbl); diff --git a/arch/arm/cpu/armv8/fsl-
>layerscape/ls1088_ids.c b/arch/arm/cpu/armv8/fsl-layerscape/ls1088_ids.c
>index 49e27553b1..23743ae10c 100644
>--- a/arch/arm/cpu/armv8/fsl-layerscape/ls1088_ids.c
>+++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1088_ids.c
>@@ -13,6 +13,7 @@ struct icid_id_table icid_tbl[] = {
>   SET_USB_ICID(1, "snps,dwc3", FSL_USB1_STREAM_ID),
>   SET_USB_ICID(2, "snps,dwc3", FSL_USB2_STREAM_ID),
>   SET_SATA_ICID(1, "fsl,ls1088a-ahci", FSL_SATA1_STREAM_ID),
>+#ifdef CONFIG_FSL_CAAM
>   SET_SEC_JR_ICID_ENTRY(0, FSL_SEC_JR1_STREAM_ID),
>   SET_SEC_JR_ICID_ENTRY(1, FSL_SEC_JR2_STREAM_ID),
>   SET_SEC_JR_ICID_ENTRY(2, FSL_SEC_JR3_STREAM_ID), @@ -25,6 +26,7
>@@ struct icid_id_table icid_tbl[] = {
>   SET_SEC_DECO_ICID_ENTRY(1, FSL_SEC_STREAM_ID),
>   SET_SEC_DECO_ICID_ENTRY(2, FSL_SEC_STREAM_ID),
>   SET_SEC_DECO_ICID_ENTRY(3, FSL_SEC_STREAM_ID),
>+#endif
> };
>
> int icid_tbl_sz = ARRAY_SIZE(icid_tbl);
>--
>2.17.1

Slight updates in subject and/or description of few patches done.
Series applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH 2/2] armv8: fsl-layerscape: do not use layerscape EFI reset if PSCI used

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: Mathew McBride 
>Sent: Friday, October 18, 2019 8:58 AM
>To: u-boot@lists.denx.de
>Cc: Priyanka Jain ; Mathew McBride
>
>Subject: [PATCH 2/2] armv8: fsl-layerscape: do not use layerscape EFI reset if
>PSCI used
>
>If the secure world reset handlers are used (via CONFIG_PSCI_RESET), then do
>not use the layerscape-specific implementation.
>
>Signed-off-by: Mathew McBride 
>Cc: Priyanka Jain 
>---
> arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>index a5d0b5370f..b4012793fd 100644
>--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
>@@ -1218,7 +1218,7 @@ void __efi_runtime reset_cpu(ulong addr)  #endif  }
>
>-#ifdef CONFIG_EFI_LOADER
>+#if defined(CONFIG_EFI_LOADER) && !defined(CONFIG_PSCI_RESET)
>
> void __efi_runtime EFIAPI efi_reset_system(
>  enum efi_reset_type reset_type,
>--
>2.19.1

Trimmed subject .Applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH 1/2] armv8: dts: ls1088a: add PSCI binding for LS1088A

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: Mathew McBride 
>Sent: Friday, October 18, 2019 8:58 AM
>To: u-boot@lists.denx.de
>Cc: Priyanka Jain ; Mathew McBride
>
>Subject: [PATCH 1/2] armv8: dts: ls1088a: add PSCI binding for LS1088A
>
>This allows the use of PSCI calls to trusted firmware to initiate reset and
>poweroff events with CONFIG_PSCI_RESET and CONFIG_ARM_PSCI_FW. This is
>desirable, for example, if the target board has implemented a custom reset or
>poweroff procedure in EL3.
>
>Signed-off-by: Mathew McBride 
>Cc: Priyanka Jain 
>---
> arch/arm/dts/fsl-ls1088a.dtsi | 5 +
> 1 file changed, 5 insertions(+)
>
>diff --git a/arch/arm/dts/fsl-ls1088a.dtsi b/arch/arm/dts/fsl-ls1088a.dtsi 
>index
>4be1ab87d2..abc8b21a11 100644
>--- a/arch/arm/dts/fsl-ls1088a.dtsi
>+++ b/arch/arm/dts/fsl-ls1088a.dtsi
>@@ -192,4 +192,9 @@
>   status = "disabled";
>   };
>
>+  psci {
>+  compatible = "arm,psci-0.2";
>+  method = "smc";
>+  };
>+
> };
>--
>2.19.1

Applied to fsl-qoriq master, awaiting upstream.

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


Re: [U-Boot] [PATCH] pci: layerscape: Only set EP CFG READY bit

2019-11-11 Thread Priyanka Jain


>-Original Message-
>From: Pankaj Bansal 
>Sent: Monday, October 14, 2019 5:13 PM
>To: Priyanka Jain ; Xiaowei Bao
>; Tom Rini ; Z.q. Hou
>
>Cc: u-boot@lists.denx.de; Pankaj Bansal 
>Subject: [PATCH] pci: layerscape: Only set EP CFG READY bit
>
>As part of EP setup, we want to set the config ready bit of controller, so that
>RC can read the config space of EP.
>Now, when we set the config ready bit we are inadvertently clearing the
>LTSSM_EN bit in same register, which restarts the link tarining between RC
>and EP.
>Therefore, just set the desired CFG_READY bit (bit 0), while leaving the other
>bits unchanged.
>
>Signed-off-by: Pankaj Bansal 
>---
> drivers/pci/pcie_layerscape.c | 6 +-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c 
>index
>d8a7b7c865..bb2ec7c2ce 100644
>--- a/drivers/pci/pcie_layerscape.c
>+++ b/drivers/pci/pcie_layerscape.c
>@@ -407,7 +407,11 @@ static void ls_pcie_ep_setup_bars(void *bar_base)
>
> static void ls_pcie_ep_enable_cfg(struct ls_pcie *pcie)  {
>-  ctrl_writel(pcie, PCIE_CONFIG_READY, PCIE_PF_CONFIG);
>+  u32 config;
>+
>+  config = ctrl_readl(pcie,  PCIE_PF_CONFIG);
>+  config |= PCIE_CONFIG_READY;
>+  ctrl_writel(pcie, config, PCIE_PF_CONFIG);
> }
>
> static void ls_pcie_setup_ep(struct ls_pcie *pcie)
>--
>2.17.1
Some updates in description. Applied to fsl-qoriq master, awaiting upstream.

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