Re: [U-Boot] mtd: spi-nor: new NXP FlexSPI driver location & framework to use ?

2018-05-17 Thread Prabhakar Kushwaha
Dear Jagan,


> -Original Message-
> From: Jagan Teki [mailto:jagannadh.t...@gmail.com]
> Sent: Friday, May 18, 2018 10:24 AM
> To: Prabhakar Kushwaha 
> Cc: u-boot@lists.denx.de
> Subject: Re: mtd: spi-nor: new NXP FlexSPI driver location & framework to
> use ?
> 
> On Thu, May 17, 2018 at 4:49 PM, Prabhakar Kushwaha
>  wrote:
> > Dear Jagan,
> >
> >> -Original Message-
> >> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
> >> Prabhakar Kushwaha
> >> Sent: Monday, May 14, 2018 6:55 PM
> >> To: Jagan Teki 
> >> Cc: u-boot@lists.denx.de
> >> Subject: Re: [U-Boot] mtd: spi-nor: new NXP FlexSPI driver location &
> >> framework to use ?
> >>
> >> Thanks Jagan,
> >>
> >> > -Original Message-
> >> > From: Jagan Teki [mailto:jagannadh.t...@gmail.com]
> >> > Sent: Friday, May 11, 2018 11:31 AM
> >> > To: Prabhakar Kushwaha 
> >> > Cc: Jagan Teki ; York Sun
> >> > ; Yogesh Narayan Gaur
> >> ;
> >> > Poonam Aggrwal ; Ashish Kumar
> >> > ; u- b...@lists.denx.de
> >> > Subject: Re: mtd: spi-nor: new NXP FlexSPI driver location &
> >> > framework to use ?
> >> >
> >> > On Fri, May 11, 2018 at 11:08 AM, Prabhakar Kushwaha
> >> >  wrote:
> >> > > Dear Jagan,
> >> > >
> >> > > NXP is coming up with new FlexSPI controller. It is similar to
> >> > > existing QSPI
> >> > with enhanced feature-set.
> >> > > We have the driver ready as per existing framework i.e. driver/spi.
> >> > >
> >> > > From recend discussion, we go to know about framework change.
> >> > > Migration of qspi drivers in u-boot-spi/drivers/mtd/spi-nor/
> >> > git://git.denx.de/u-boot-spi.git branch mtd-spinor-working.
> >> > >
> >> > > We are in dilemma for sending FlexSPI driver upstream.
> >> > > Do we follow existing framework i.e. driver/spi   or new proposed
> >> > framework i.e. u-boot-spi/drivers/mtd/spi-nor/
> >> > >
> >> > > Also, do we have any timeline of u-boot-spi/drivers/mtd/spi-nor/
> >> > > to
> >> > become default.
> >> >
> >> > Idea is to move spi-nor, mtd-spinor-working is paused because of
> >> > non-dm drivers accessing.
> >>
> >> This means, flexspi controller driver should be upstream'ed via
> >> u-boot- spi/drivers/mtd/spi-nor branch mtd-spinor-working
> >>
> >
> > Please help me with the query.
> > We don’t want to end up with 2 FlexSPI drivers being posted in upstream.
> 
> Let me understand is this FlexSPI is spi-nor controller, is it Linux 
> upstreamed
> or ML? 

RFC patch http://patchwork.ozlabs.org/patch/894918/ is under discussion.
It is with assumption of driver/mtd/spi-nor


> I think for now you can add it mtd/spi with UCLASS_SPI_FLASH driver,
> Since Boris mentioned about spi-mem(I still need to see the Linux framework
> for more details) which may be re-placer for spi-nor but once we decided to
> go with spi-mem or spi-nor then the flexspi can convert accordingly.
> 

This means,  FlexSPI should be part of driver/mtd/spi-nor for now. 
When You decide way forward(mtd/spi or spi-mem), flexSPI driver can move 
accordingly.

Thanks

--pk 


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


Re: [U-Boot] mtd: spi-nor: new NXP FlexSPI driver location & framework to use ?

2018-05-17 Thread Jagan Teki
On Thu, May 17, 2018 at 4:49 PM, Prabhakar Kushwaha
 wrote:
> Dear Jagan,
>
>> -Original Message-
>> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
>> Prabhakar Kushwaha
>> Sent: Monday, May 14, 2018 6:55 PM
>> To: Jagan Teki 
>> Cc: u-boot@lists.denx.de
>> Subject: Re: [U-Boot] mtd: spi-nor: new NXP FlexSPI driver location &
>> framework to use ?
>>
>> Thanks Jagan,
>>
>> > -Original Message-
>> > From: Jagan Teki [mailto:jagannadh.t...@gmail.com]
>> > Sent: Friday, May 11, 2018 11:31 AM
>> > To: Prabhakar Kushwaha 
>> > Cc: Jagan Teki ; York Sun
>> > ; Yogesh Narayan Gaur
>> ;
>> > Poonam Aggrwal ; Ashish Kumar
>> > ; u- b...@lists.denx.de
>> > Subject: Re: mtd: spi-nor: new NXP FlexSPI driver location & framework
>> > to use ?
>> >
>> > On Fri, May 11, 2018 at 11:08 AM, Prabhakar Kushwaha
>> >  wrote:
>> > > Dear Jagan,
>> > >
>> > > NXP is coming up with new FlexSPI controller. It is similar to
>> > > existing QSPI
>> > with enhanced feature-set.
>> > > We have the driver ready as per existing framework i.e. driver/spi.
>> > >
>> > > From recend discussion, we go to know about framework change.
>> > > Migration of qspi drivers in u-boot-spi/drivers/mtd/spi-nor/
>> > git://git.denx.de/u-boot-spi.git branch mtd-spinor-working.
>> > >
>> > > We are in dilemma for sending FlexSPI driver upstream.
>> > > Do we follow existing framework i.e. driver/spi   or new proposed
>> > framework i.e. u-boot-spi/drivers/mtd/spi-nor/
>> > >
>> > > Also, do we have any timeline of u-boot-spi/drivers/mtd/spi-nor/ to
>> > become default.
>> >
>> > Idea is to move spi-nor, mtd-spinor-working is paused because of
>> > non-dm drivers accessing.
>>
>> This means, flexspi controller driver should be upstream'ed via u-boot-
>> spi/drivers/mtd/spi-nor branch mtd-spinor-working
>>
>
> Please help me with the query.
> We don’t want to end up with 2 FlexSPI drivers being posted in upstream.

Let me understand is this FlexSPI is spi-nor controller, is it Linux
upstreamed or ML? I think for now you can add it mtd/spi with
UCLASS_SPI_FLASH driver, Since Boris mentioned about spi-mem(I still
need to see the Linux framework for more details) which may be
re-placer for spi-nor but once we decided to go with spi-mem or
spi-nor then the flexspi can convert accordingly.

Jagan.

-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] doc: Add new doc for file system firmware loader driver model

2018-05-17 Thread Chee, Tien Fong
On Thu, 2018-05-17 at 07:11 -0400, Tom Rini wrote:
> On Thu, May 17, 2018 at 04:27:27AM +, Chee, Tien Fong wrote:
> > 
> > On Wed, 2018-05-16 at 08:48 -0400, Tom Rini wrote:
> > > 
> > > On Wed, May 16, 2018 at 05:21:39PM +0800, tien.fong.c...@intel.co
> > > m
> > > wrote:
> > > 
> > > > 
> > > > 
> > > > From: Tien Fong Chee 
> > > > 
> > > > Provide information about
> > > > 
> > > > - overview of file system firmware loader driver model
> > > > - describe default storage device in device tree source
> > > > - describe fie system firmware loader API
> > > > 
> > > > Signed-off-by: Tien Fong Chee 
> > > > ---
> > > >  doc/driver-model/fs_firmware_loader.txt |  100
> > > > +++
> > > >  1 files changed, 100 insertions(+), 0 deletions(-)
> > > >  create mode 100644 doc/driver-model/fs_firmware_loader.txt
> > > > 
> > > > diff --git a/doc/driver-model/fs_firmware_loader.txt
> > > > b/doc/driver-
> > > > model/fs_firmware_loader.txt
> > > > new file mode 100644
> > > > index 000..167660a
> > > > --- /dev/null
> > > > +++ b/doc/driver-model/fs_firmware_loader.txt
> > > > @@ -0,0 +1,100 @@
> > > > +/*
> > > > + * Copyright (C) 2018 Intel Corporation 
> > > > + *
> > > > + * SPDX-License-Identifier:GPL-2.0
> > > > + */
> > > As this isn't code please don't put a code header up for the
> > > first
> > > comment block.  Frankly I'd rather see an rST comment block up
> > > front
> > > even with the rest being plain text as long term I imagine we'll
> > > move
> > > to
> > > rST.
> > > 
> > Okay, i will remove the license and changing it to rST format.
> You don't need to remove it, just move it :)
> 
Ohhi just need to change the license and copyright header to rST
format?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/7] i.MX6: board: Add BTicino i.MX6DL Mamoj initial support

2018-05-17 Thread Jagan Teki
On Thu, May 17, 2018 at 3:16 PM, Stefano Babic  wrote:
> Hi Jagan,
>
> On 07/05/2018 07:51, Jagan Teki wrote:
>> Add initial support for i.MX6DL BTicino Mamoj board.
>>
>> Mamoh board added:
>> - SPL
>> - SPL_DM
>> - SPL_OF_CONTROL
>> - DM for U-Boot proper
>> - OF_CONTROL for U-Boot proper
>> - eMMC
>> - FEC
>> - Boot from eMMC
>> - Boot from USB SDP
>>
>> Signed-off-by: Simone CIANNI 
>> Signed-off-by: Raffaele RECALCATI 
>> Signed-off-by: Jagan Teki 
>> ---
>>  arch/arm/dts/Makefile |   1 +
>>  arch/arm/dts/imx6dl-mamoj-u-boot.dtsi |  15 
>>  arch/arm/dts/imx6dl-mamoj.dts |  84 ++
>>  arch/arm/mach-imx/mx6/Kconfig |  29 ++
>>  board/bticino/mamoj/Kconfig   |  12 +++
>>  board/bticino/mamoj/MAINTAINERS   |  10 +++
>>  board/bticino/mamoj/Makefile  |   8 ++
>>  board/bticino/mamoj/README|  60 +
>>  board/bticino/mamoj/mamoj.c   |  27 ++
>>  board/bticino/mamoj/spl.c | 161 
>> ++
>>  configs/imx6dl_mamoj_defconfig|  39 
>>  include/configs/imx6dl-mamoj.h|  88 +++
>>  12 files changed, 534 insertions(+)
>>  create mode 100644 arch/arm/dts/imx6dl-mamoj-u-boot.dtsi
>>  create mode 100644 arch/arm/dts/imx6dl-mamoj.dts
>>  create mode 100644 board/bticino/mamoj/Kconfig
>>  create mode 100644 board/bticino/mamoj/MAINTAINERS
>>  create mode 100644 board/bticino/mamoj/Makefile
>>  create mode 100644 board/bticino/mamoj/README
>>  create mode 100644 board/bticino/mamoj/mamoj.c
>>  create mode 100644 board/bticino/mamoj/spl.c
>>  create mode 100644 configs/imx6dl_mamoj_defconfig
>>  create mode 100644 include/configs/imx6dl-mamoj.h
>>
>> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
>> index 389ca63717..289e11551a 100644
>> --- a/arch/arm/dts/Makefile
>> +++ b/arch/arm/dts/Makefile
>> @@ -399,6 +399,7 @@ dtb-$(CONFIG_MX6QDL) += \
>>   imx6dl-icore.dtb \
>>   imx6dl-icore-mipi.dtb \
>>   imx6dl-icore-rqs.dtb \
>> + imx6dl-mamoj.dtb \
>>   imx6q-cm-fx6.dtb \
>>   imx6q-icore.dtb \
>>   imx6q-icore-mipi.dtb \
>> diff --git a/arch/arm/dts/imx6dl-mamoj-u-boot.dtsi 
>> b/arch/arm/dts/imx6dl-mamoj-u-boot.dtsi
>> new file mode 100644
>> index 00..d4c3c0bdf0
>> --- /dev/null
>> +++ b/arch/arm/dts/imx6dl-mamoj-u-boot.dtsi
>> @@ -0,0 +1,15 @@
>> +/*
>> + * Copyright (C) 2018 Jagan Teki 
>> + *
>> + * SPDX-License-Identifier: GPL-2.0+
>> + */
>> +
>> +#include "imx6qdl-u-boot.dtsi"
>
> Something wrong here - this file is not part of the patchset. Should be
> this imx6qdl.dtsi ?

No, I've mentioned in previous version this series has dependency with
another patch-set [1]

[1] https://patchwork.ozlabs.org/cover/897156/

Jagan.

-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 01/12] ARM: socfpga: Sync A10 clock manager binding parser

2018-05-17 Thread Chee, Tien Fong
On Thu, 2018-05-17 at 11:38 +0200, Marek Vasut wrote:
> On 05/17/2018 10:44 AM, Chee, Tien Fong wrote:
> > 
> > On Thu, 2018-05-17 at 10:24 +0200, Marek Vasut wrote:
> > > 
> > > On 05/17/2018 06:38 AM, Chee, Tien Fong wrote:
> > > > 
> > > > 
> > > > On Sat, 2018-05-12 at 22:30 +0200, Marek Vasut wrote:
> > > > > 
> > > > > 
> > > > > The A10 clock manager parsed DT bindings generated by Quartus
> > > > > the
> > > > > bsp-editor to configure the A10 clocks. Sadly, those DT
> > > > > bindings
> > > > > changed at some point. The clock manager patch used the old
> > > > > ones,
> > > > > this patch replaces the bindings parser with one for the new
> > > > > set.
> > > > > 
> > > > > Signed-off-by: Marek Vasut 
> > > > > Cc: Chin Liang See 
> > > > > Cc: Dinh Nguyen 
> > > > > ---
> > > > >  arch/arm/mach-socfpga/clock_manager_arria10.c  | 158
> > > > > ++---
> > > > >  .../include/mach/clock_manager_arria10.h   |   2 +-
> > > > >  2 files changed, 111 insertions(+), 49 deletions(-)
> > > > > 
> > > > > diff --git a/arch/arm/mach-socfpga/clock_manager_arria10.c
> > > > > b/arch/arm/mach-socfpga/clock_manager_arria10.c
> > > > > index 4ee6a82b5f..defa2f6261 100644
> > > > > --- a/arch/arm/mach-socfpga/clock_manager_arria10.c
> > > > > +++ b/arch/arm/mach-socfpga/clock_manager_arria10.c
> > > > > @@ -9,6 +9,9 @@
> > > > >  #include 
> > > > >  #include 
> > > > >  
> > > > > +static const struct socfpga_clock_manager
> > > > > *clock_manager_base =
> > > > > + (struct socfpga_clock_manager
> > > > > *)SOCFPGA_CLKMGR_ADDRESS;
> > > > > +
> > > > >  static u32 eosc1_hz;
> > > > >  static u32 cb_intosc_hz;
> > > > >  static u32 f2s_free_hz;
> > > > > @@ -64,89 +67,150 @@ struct perpll_cfg {
> > > > >   u32 cntr8clk_cnt;
> > > > >   u32 cntr8clk_src;
> > > > >   u32 cntr9clk_cnt;
> > > > > + u32 cntr9clk_src;
> > > > Why add this? I believe this is not exist.
> > > It exists in the altera sources and it matches the pattern. What
> > > do
> > > you
> > > mean by "this is not exist" ?
> > > 
> > we don't have cntr9clk_src in perpll.
> https://github.com/altera-opensource/u-boot-socfpga/blob/socfpga_v201
> 4.10_arria10_bringup/arch/arm/cpu/armv7/socfpga_arria10/clock_manager
> .c#L229
> 
That is the bug, and i have already fixed it in mainstream
http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-socfpga/clock_m
anager_arria10.c;h=4ee6a82b5f75215d6930d488aa39c572d1610073;hb=HEAD#l11
4

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


[U-Boot] [PATCH v2] net: include/phy.h: add new mode for internal phy

2018-05-17 Thread Kunihiko Hayashi
Add the new mode to indicate a built-in PHY.
This will be used by UniPhier AVE ethernet driver.

Signed-off-by: Kunihiko Hayashi 
Reviewed-by: Marek Vasut 
Acked-by: Joe Hershberger 
---

Changes since v1:
- add Reviewed-by and Acked-by tags

include/phy.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/phy.h b/include/phy.h
index 52bf997..3b34504 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -65,6 +65,7 @@ typedef enum {
PHY_INTERFACE_MODE_XAUI,
PHY_INTERFACE_MODE_RXAUI,
PHY_INTERFACE_MODE_SFI,
+   PHY_INTERFACE_MODE_INTERNAL,
PHY_INTERFACE_MODE_NONE,/* Must be last */
 
PHY_INTERFACE_MODE_COUNT,
@@ -87,6 +88,7 @@ static const char *phy_interface_strings[] = {
[PHY_INTERFACE_MODE_XAUI]   = "xaui",
[PHY_INTERFACE_MODE_RXAUI]  = "rxaui",
[PHY_INTERFACE_MODE_SFI]= "sfi",
+   [PHY_INTERFACE_MODE_INTERNAL]   = "internal",
[PHY_INTERFACE_MODE_NONE]   = "",
 };
 
-- 
2.7.4

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


[U-Boot] [PATCH] malloc: Use malloc simple before malloc is fully initialized in memalign()

2018-05-17 Thread Ley Foon Tan
Follow implementation in mALLOc(). Check GD_FLG_FULL_MALLOC_INIT flag and use
malloc_simple if GD_FLG_FULL_MALLOC_INIT is unset. Adjust the malloc bytes
to align with the requested alignment.

The original memalign() function will access mchunkptr struct to adjust the
alignment if there is misalignment happen, but mchunkptr struct is not being
initialized before full malloc is initialized. This cause the system crash.

Signed-off-by: Ley Foon Tan 
---
 common/dlmalloc.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index b395eef..edaad29 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1891,6 +1891,13 @@ Void_t* mEMALIGn(alignment, bytes) size_t alignment; 
size_t bytes;
 
   if ((long)bytes < 0) return NULL;
 
+#if CONFIG_VAL(SYS_MALLOC_F_LEN)
+   if (!(gd->flags & GD_FLG_FULL_MALLOC_INIT)) {
+   nb = roundup(bytes, alignment);
+   return malloc_simple(nb);
+   }
+#endif
+
   /* If need less alignment than we give anyway, just relay to malloc */
 
   if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes);
-- 
1.7.1

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


Re: [U-Boot] [PATCH v5 13/16] fastboot: Migrate FASTBOOT_FLASH_NAND_TRIMFFS to Kconfig

2018-05-17 Thread Simon Glass
On 17 May 2018 at 09:59, Alex Kiernan  wrote:
> Add FASTBOOT_FLASH_NAND_TRIMFFS to Kconfig; note there are no in-tree
> users of it.
>
> Signed-off-by: Alex Kiernan 
> ---
>
> Changes in v5:
> - new
>
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>  drivers/fastboot/Kconfig | 6 ++
>  scripts/config_whitelist.txt | 1 -
>  2 files changed, 6 insertions(+), 1 deletion(-)

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


Re: [U-Boot] [PATCH] pylibfdt: Add missing CC and LD to Makefile

2018-05-17 Thread Simon Glass
On 17 May 2018 at 14:18, Marek Vasut  wrote:
>
> Add missing CC and LDSHARED variables to the Makefile to pass the
> correct C compiler and linker path to the build of _libfdt.so .
>
> Signed-off-by: Marek Vasut 
> Cc: Tom Rini 
> Cc: Masahiro Yamada 
> Cc: Simon Glass 
> ---
> Note: This fixes the long standing issue when building U-Boot with
>   OE for qemux86 or qemux86_64, where the build will try to use
>   the host compiler, which OE will block and thus the build will
>   crash on missing compiler/linker binary. With this patch, the
>   OE will correctly pass in the compiler/linker generated during
>   the build, just like it does for all the other tools.
> ---
>  scripts/dtc/pylibfdt/Makefile | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Simon Glass 

>
> diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile
> index 01d5e0ffe3..e6f6e9f633 100644
> --- a/scripts/dtc/pylibfdt/Makefile
> +++ b/scripts/dtc/pylibfdt/Makefile
> @@ -15,6 +15,7 @@ PYLIBFDT_srcs = $(addprefix 
> $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \
>
>  quiet_cmd_pymod = PYMOD   $@
>cmd_pymod = unset CC; unset CROSS_COMPILE; unset CFLAGS;\

Please can you remove the 'unset CC'? It does not seem necessary since
you set it later:

> +   CC="$(HOSTCC)" LDSHARED="$(HOSTCC) -shared " \
> LDFLAGS="$(HOSTLDFLAGS)" \
> VERSION="u-boot-$(UBOOTVERSION)" \
> CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \
> --
> 2.16.2
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 3/5] dm: serial: Add setparity

2018-05-17 Thread Simon Glass
Hi Patrick,

On 17 May 2018 at 06:50, Patrice Chotard  wrote:
> From: Patrick Delaunay 
>
> Implements serial setparity ops to allow uart parity change.
> It allows to select ODD, EVEN or NONE parity.
>
> Signed-off-by: Patrick Delaunay 
> Signed-off-by: Patrice Chotard 
> ---
>
>  include/serial.h | 16 
>  1 file changed, 16 insertions(+)
>
> diff --git a/include/serial.h b/include/serial.h
> index 384df94ed0b3..b9ef6d91c9c5 100644
> --- a/include/serial.h
> +++ b/include/serial.h
> @@ -67,6 +67,12 @@ extern int usbtty_tstc(void);
>
>  struct udevice;
>
> +enum serial_par {
> +   SERIAL_PAR_NONE,
> +   SERIAL_PAR_ODD,
> +   SERIAL_PAR_EVEN
> +};
> +
>  /**
>   * struct struct dm_serial_ops - Driver model serial operations
>   *
> @@ -143,6 +149,16 @@ struct dm_serial_ops {
>  */
> int (*loop)(struct udevice *dev, int on);
>  #endif
> +   /**
> +* setparity() - Set up the parity
> +*
> +* Set up a new parity for this device.
> +*
> +* @dev: Device pointer
> +* @parity: parity to use
> +* @return 0 if OK, -ve on error
> +*/
> +   int (*setparity)(struct udevice *dev, enum serial_par parity);

To me it seems that changing parity while in the middle of operation
might be tricky. I suppose this follows along with setbrg() so fair
enough.

But I worry about adding more operations here. The next thing to come
is presumably the length (7 bits, 8 bits, ...). Perhaps we should have
a more generic setconfig() which change change speed, format and
parity all at once? For format and parity, we could have a 'default'
parameter value.

Also, there should be a corresponding function in serial-uclass.c and
ideal a call from some sandbox test (although I see at present we
don't have test/dm/serial.c)

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


Re: [U-Boot] [PATCH v1 1/5] serial: stm32: Add debug uart support

2018-05-17 Thread Simon Glass
On 17 May 2018 at 06:50, Patrice Chotard  wrote:
> From: Patrick Delaunay 
>
> Add support for early debug printf, before the availability of
> driver model and device tree support.
>
> Signed-off-by: Patrick Delaunay 
> Signed-off-by: Patrice Chotard 
> ---
>
>  drivers/serial/Kconfig|   9 
>  drivers/serial/serial_stm32.c | 105 
> +-
>  2 files changed, 92 insertions(+), 22 deletions(-)
>

Reviewed-by: Simon Glass 

One question below.
[..]

> +static inline void _debug_uart_init(void)
> +{
> +   fdt_addr_t base = CONFIG_DEBUG_UART_BASE;
> +   struct stm32_uart_info *uart_info = _debug_uart_info();
> +
> +   _stm32_serial_init(base, uart_info);
> +   _stm32_serial_setbrg(base, uart_info,
> +CONFIG_DEBUG_UART_CLOCK,
> +CONFIG_BAUDRATE);
> +   printf("DEBUG done\n");

Do you really want this line?

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


Re: [U-Boot] [PATCH v5 10/16] fastboot: Rename public fb_ functions to fastboot_

2018-05-17 Thread Simon Glass
Hi,

On 17 May 2018 at 09:59, Alex Kiernan  wrote:
> Rename fb_mmc_flash_write/fb_mmc_erase/fb_nand_flash_write/fb_nand_erase to
> fastboot_... as they form a public interface
>
> Signed-off-by: Alex Kiernan 
> ---
>
> Changes in v5:
> - new
>
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
>
>  drivers/fastboot/fb_mmc.c   |  6 +++---
>  drivers/fastboot/fb_nand.c  |  6 +++---
>  drivers/usb/gadget/f_fastboot.c | 12 ++--
>  include/fb_mmc.h|  6 +++---
>  include/fb_nand.h   |  6 +++---
>  5 files changed, 18 insertions(+), 18 deletions(-)

Reviewed-by: Simon Glass 

But see below:

> -void fb_nand_flash_write(const char *cmd, void *download_buffer,
> -unsigned int download_bytes, char *response);
> -void fb_nand_erase(const char *cmd, char *response);
> +void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
> +  unsigned int download_bytes, char *response);
> +void fastboot_nand_erase(const char *cmd, char *response);

Need full docbook function comments for these.

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


Re: [U-Boot] [PATCH v1 2/5] serial: stm32: Fix bits defines name

2018-05-17 Thread Simon Glass
On 17 May 2018 at 06:50, Patrice Chotard  wrote:
> Rename USART_ISR_FLAG_xxx bits to USART_ISR_xxx bits and
> USART_ICR_OREF to USART_ICR_ORECF in order to match datasheets.
> Sort defines by descendant order.
>
> Signed-off-by: Patrice Chotard 
> ---
>
>  drivers/serial/serial_stm32.c | 12 ++--
>  drivers/serial/serial_stm32.h |  8 
>  2 files changed, 10 insertions(+), 10 deletions(-)

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


[U-Boot] [PATCH 1/4] ata: mvebu: move mvebu sata driver to drivers/ata directory

2018-05-17 Thread make
From: Ken Ma 

Currently mvebu sata driver is in arch/arm/mach_mvebu directory, this
patch moves it to drivers/ata directory with renaming "sata.c" to
"ahci_mvebu.c" which is aligned to Linux.
New ahci driver's kconfig option is added as AHCI_MVEBU which selects
DM_SCSI.

Signed-off-by: Ken Ma 
Cc: Simon Glass 
Cc: Stefan Roese 
---
 arch/arm/mach-mvebu/Makefile |  1 -
 arch/arm/mach-mvebu/sata.c   | 54 
 drivers/ata/Kconfig  |  9 
 drivers/ata/Makefile |  1 +
 drivers/ata/ahci_mvebu.c | 54 
 5 files changed, 64 insertions(+), 55 deletions(-)
 delete mode 100644 arch/arm/mach-mvebu/sata.c
 create mode 100644 drivers/ata/ahci_mvebu.c

diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index d4210af..7f0d692 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -9,7 +9,6 @@ ifdef CONFIG_ARM64
 obj-$(CONFIG_ARMADA_3700) += armada3700/
 obj-$(CONFIG_ARMADA_8K) += armada8k/
 obj-y += arm64-common.o
-obj-y += sata.o
 
 else # CONFIG_ARM64
 
diff --git a/arch/arm/mach-mvebu/sata.c b/arch/arm/mach-mvebu/sata.c
deleted file mode 100644
index 5d8032b..000
--- a/arch/arm/mach-mvebu/sata.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2016 Stefan Roese 
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/*
- * Dummy implementation that can be overwritten by a board
- * specific function
- */
-__weak int board_ahci_enable(void)
-{
-   return 0;
-}
-
-#ifdef CONFIG_ARMADA_8K
-/* CP110 has different AHCI port addresses */
-void __iomem *ahci_port_base(void __iomem *base, u32 port)
-{
-   return base + 0x1 + (port * 0x1);
-}
-#endif
-
-static int mvebu_ahci_probe(struct udevice *dev)
-{
-   /*
-* Board specific SATA / AHCI enable code, e.g. enable the
-* AHCI power or deassert reset
-*/
-   board_ahci_enable();
-
-   ahci_init(devfdt_get_addr_ptr(dev));
-
-   return 0;
-}
-
-static const struct udevice_id mvebu_ahci_ids[] = {
-   { .compatible = "marvell,armada-3700-ahci" },
-   { .compatible = "marvell,armada-8k-ahci" },
-   { }
-};
-
-U_BOOT_DRIVER(ahci_mvebu_drv) = {
-   .name   = "ahci_mvebu",
-   .id = UCLASS_AHCI,
-   .of_match   = mvebu_ahci_ids,
-   .probe  = mvebu_ahci_probe,
-};
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 86ec628..9ef4589 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -99,4 +99,13 @@ config SATA_SIL3114
help
  Enable this driver to support the SIL3114 SATA controllers.
 
+config AHCI_MVEBU
+   bool "Marvell EBU AHCI SATA support"
+   depends on ARCH_MVEBU
+   select DM_SCSI
+   help
+ This option enables support for the Marvell EBU SoC's
+ onboard AHCI SATA.
+
+ If unsure, say N.
 endmenu
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index a94c804..0254640 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -19,3 +19,4 @@ obj-$(CONFIG_SATA_MV) += sata_mv.o
 obj-$(CONFIG_SATA_SIL3114) += sata_sil3114.o
 obj-$(CONFIG_SATA_SIL) += sata_sil.o
 obj-$(CONFIG_SANDBOX) += sata_sandbox.o
+obj-$(CONFIG_AHCI_MVEBU) += ahci_mvebu.o
diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
new file mode 100644
index 000..5c1b293
--- /dev/null
+++ b/drivers/ata/ahci_mvebu.c
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2018 Marvell International Ltd.
+ * Copyright (C) 2016 Stefan Roese 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ * https://spdx.org/licenses
+ */
+
+#include 
+#include 
+#include 
+
+/*
+ * Dummy implementation that can be overwritten by a board
+ * specific function
+ */
+__weak int board_ahci_enable(void)
+{
+   return 0;
+}
+
+#ifdef CONFIG_ARMADA_8K
+/* CP110 has different AHCI port addresses */
+void __iomem *ahci_port_base(void __iomem *base, u32 port)
+{
+   return base + 0x1 + (port * 0x1);
+}
+#endif
+
+static int mvebu_ahci_probe(struct udevice *dev)
+{
+   /*
+* Board specific SATA / AHCI enable code, e.g. enable the
+* AHCI power or deassert reset
+*/
+   board_ahci_enable();
+
+   ahci_init(devfdt_get_addr_ptr(dev));
+
+   return 0;
+}
+
+static const struct udevice_id mvebu_ahci_ids[] = {
+   { .compatible = "marvell,armada-3700-ahci" },
+   { .compatible = "marvell,armada-8k-ahci" },
+   { }
+};
+
+U_BOOT_DRIVER(ahci_mvebu_drv) = {
+   .name   = "ahci_mvebu",
+   .id = UCLASS_AHCI,
+   .of_match   = mvebu_ahci_ids,
+   .probe  = mvebu_ahci_probe,
+};
-- 
1.9.1

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


[U-Boot] [PATCH 4/4] arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU

2018-05-17 Thread make
From: Ken Ma 

This patch enables the new ahci mvebu driver for marvell arm64 platform
SOCs(A3k and A8k).

Signed-off-by: Ken Ma 
Cc: Simon Glass 
Cc: Stefan Roese 
---
 configs/mvebu_db-88f3720_defconfig  | 1 +
 configs/mvebu_db_armada8k_defconfig | 1 +
 configs/mvebu_espressobin-88f3720_defconfig | 1 +
 configs/mvebu_mcbin-88f8040_defconfig   | 1 +
 4 files changed, 4 insertions(+)

diff --git a/configs/mvebu_db-88f3720_defconfig 
b/configs/mvebu_db-88f3720_defconfig
index 1d6233a..d40dd42 100644
--- a/configs/mvebu_db-88f3720_defconfig
+++ b/configs/mvebu_db-88f3720_defconfig
@@ -29,6 +29,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_GPIO=y
 # CONFIG_MVEBU_GPIO is not set
diff --git a/configs/mvebu_db_armada8k_defconfig 
b/configs/mvebu_db_armada8k_defconfig
index da67aad..72c86f3 100644
--- a/configs/mvebu_db_armada8k_defconfig
+++ b/configs/mvebu_db_armada8k_defconfig
@@ -30,6 +30,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_MVTWSI=y
diff --git a/configs/mvebu_espressobin-88f3720_defconfig 
b/configs/mvebu_espressobin-88f3720_defconfig
index 314d405..cc41711 100644
--- a/configs/mvebu_espressobin-88f3720_defconfig
+++ b/configs/mvebu_espressobin-88f3720_defconfig
@@ -28,6 +28,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_I2C=y
 CONFIG_MISC=y
diff --git a/configs/mvebu_mcbin-88f8040_defconfig 
b/configs/mvebu_mcbin-88f8040_defconfig
index e16a56e..dea0cd0 100644
--- a/configs/mvebu_mcbin-88f8040_defconfig
+++ b/configs/mvebu_mcbin-88f8040_defconfig
@@ -32,6 +32,7 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_MAC_PARTITION=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_SCSI_AHCI=y
+CONFIG_AHCI_MVEBU=y
 CONFIG_BLOCK_CACHE=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
-- 
1.9.1

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


[U-Boot] [PATCH 2/4] ata: ahci_mvebu: a8040 a0: remove bad port register offsets workarounds

2018-05-17 Thread make
From: David Sniatkiwicz 

This workaround was added for A8040/7040 A0.
A8040/7040 A0 is no longer supported so this workaround
can be removed.

Signed-off-by: David Sniatkiwicz 
Signed-off-by: Ken Ma 
Cc: Simon Glass 
Cc: Stefan Roese 
---
 drivers/ata/ahci_mvebu.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
index 5c1b293..97a04d9 100644
--- a/drivers/ata/ahci_mvebu.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -19,14 +19,6 @@ __weak int board_ahci_enable(void)
return 0;
 }
 
-#ifdef CONFIG_ARMADA_8K
-/* CP110 has different AHCI port addresses */
-void __iomem *ahci_port_base(void __iomem *base, u32 port)
-{
-   return base + 0x1 + (port * 0x1);
-}
-#endif
-
 static int mvebu_ahci_probe(struct udevice *dev)
 {
/*
-- 
1.9.1

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


[U-Boot] [PATCH 3/4] ata: ahci_mvebu: add scsi support

2018-05-17 Thread make
From: Ken Ma 

Mvebu AHCI is AHCI driver which uses SCSI under the hood.
This patch adjusts AHCI setup to support SCSI by creating
a SCSI device as a child.

Signed-off-by: Ken Ma 
Cc: Simon Glass 
Cc: Stefan Roese 
---
 drivers/ata/ahci_mvebu.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
index 97a04d9..9041a72 100644
--- a/drivers/ata/ahci_mvebu.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -19,6 +19,20 @@ __weak int board_ahci_enable(void)
return 0;
 }
 
+static int mvebu_ahci_bind(struct udevice *dev)
+{
+   struct udevice *scsi_dev;
+   int ret;
+
+   ret = ahci_bind_scsi(dev, _dev);
+   if (ret) {
+   debug("%s: Failed to bind (err=%d\n)", __func__, ret);
+   return ret;
+   }
+
+   return 0;
+}
+
 static int mvebu_ahci_probe(struct udevice *dev)
 {
/*
@@ -27,7 +41,7 @@ static int mvebu_ahci_probe(struct udevice *dev)
 */
board_ahci_enable();
 
-   ahci_init(devfdt_get_addr_ptr(dev));
+   ahci_probe_scsi(dev, (ulong)devfdt_get_addr_ptr(dev));
 
return 0;
 }
@@ -42,5 +56,6 @@ U_BOOT_DRIVER(ahci_mvebu_drv) = {
.name   = "ahci_mvebu",
.id = UCLASS_AHCI,
.of_match   = mvebu_ahci_ids,
+   .bind   = mvebu_ahci_bind,
.probe  = mvebu_ahci_probe,
 };
-- 
1.9.1

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


[U-Boot] [PATCH 0/4] ahci mvebu driver updates

2018-05-17 Thread make
From: Ken Ma 

These patches move ahci mvebu driver to drivers/ata directory with bug fixing 
and scsi supporting.

David Sniatkiwicz (1):
  ata: ahci_mvebu: a8040 a0: remove bad port register offsets
workarounds

Ken Ma (3):
  ata: mvebu: move mvebu sata driver to drivers/ata directory
  ata: ahci_mvebu: add scsi support
  arm64: mvebu: defconfig: enable CONFIG_AHCI_MVEBU

 arch/arm/mach-mvebu/Makefile|  1 -
 arch/arm/mach-mvebu/sata.c  | 54 -
 configs/mvebu_db-88f3720_defconfig  |  1 +
 configs/mvebu_db_armada8k_defconfig |  1 +
 configs/mvebu_espressobin-88f3720_defconfig |  1 +
 configs/mvebu_mcbin-88f8040_defconfig   |  1 +
 drivers/ata/Kconfig |  9 +
 drivers/ata/Makefile|  1 +
 drivers/ata/ahci_mvebu.c| 61 +
 9 files changed, 75 insertions(+), 55 deletions(-)
 delete mode 100644 arch/arm/mach-mvebu/sata.c
 create mode 100644 drivers/ata/ahci_mvebu.c

-- 
1.9.1

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


[U-Boot] [PATCH] arm: dts: sunxi: enable Ethernet on NanoPi Neo Plus2

2018-05-17 Thread Jonathan A. Kollasch
Signed-off-by: Jonathan A. Kollasch 
---

 arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts 
b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
index f1406c224b..1dde153669 100644
--- a/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
+++ b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
@@ -104,3 +104,18 @@
  {
status = "okay";
 };
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_rgmii_pins>;
+   phy-mode = "rgmii";
+   phy-handle = <_rgmii_phy>;
+   status = "okay";
+};
+
+_mdio {
+   ext_rgmii_phy: ethernet-phy@7 {
+   compatible = "ethernet-phy-ieee802.3-c22";
+   reg = <7>;
+   };
+};
-- 
2.11.0

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


[U-Boot] UBIFS Problems with U-boot 2018.1 & 4.14 Linux

2018-05-17 Thread Otto Blom
Hi There !

I'm seeing a strange problem with u-boot 2018.1 and Linux 4.14 (Xilinx
Petalinux 2018.1).
If I write a ubifs image to flash using Linux 4.9 I can mount and read
files from the image
in both u-boot 2018.1 and Linux 4.14. However as soon as I write a new
file to the file-system
from Linux, U-boot can no longer read the file. The filesystem still
mounts, but when
I attempt to read the file I get the following error

UBIFS error (ubi0:0 pid 0): read_block: bad data node (block 661, inode 5763)
magic  0x6101831
crc0x8e6aff1a
node_type  1 (data node)
group_type 0 (no node group)
sqnum  63819
len3075
key(5763, data, 661)
size   4096
compr_typ  1
data size  3027
data:
UBIFS error (ubi0:0 pid 0): do_readpage: cannot read page 661 of inode
5763, error -22

The file can still be read correctly from Linux, leading me to believe
there is some form
of incompatibility going on. I noticed that the ubifs version number
was bumped from 4 to 5
in this commit

http://git.infradead.org/linux-ubifs.git/commit/fc4b891bbefa73b496bb44b076bb5274b6bfba68

Both Linux 4.9 and U-boot 18.1 still have version 4. Could that have
something do to with it ?

I'm running on a ZynqMP platform with Micron Flash (On-Die ECC)

Thanks in advance,

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


Re: [U-Boot] [PATCH v5 14/16] mmc: Separate "mmc swrite" from fastboot

2018-05-17 Thread Jassi Brar
On 17 May 2018 at 21:29, Alex Kiernan  wrote:
> Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
> swrite" command is separated from the fastboot code.
>
> Move image-sparse from common to lib so it's clear it's library code.
>
> Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
> and migrate it to Kconfig.
>
> Signed-off-by: Alex Kiernan 
> ---
>
> Changes in v5:
> - rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to 
> CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
>   and migrate it to Kconfig.
>
> Changes in v4:
> - new
>
> Changes in v3: None
> Changes in v2: None
>
>  cmd/Kconfig|  8 
>  cmd/mmc.c  | 12 ++--
>  common/Makefile|  1 -
>  drivers/fastboot/Kconfig   |  1 +
>  lib/Kconfig| 11 +++
>  lib/Makefile   |  1 +
>  {common => lib}/image-sparse.c |  6 +-
>  scripts/config_whitelist.txt   |  1 -
>  8 files changed, 28 insertions(+), 13 deletions(-)
>  rename {common => lib}/image-sparse.c (97%)
>
> diff --git a/cmd/Kconfig b/cmd/Kconfig
> index 91f6dfe..98763c9 100644
> --- a/cmd/Kconfig
> +++ b/cmd/Kconfig
> @@ -826,6 +826,14 @@ config CMD_MMC
> help
>   MMC memory mapped support.
>
> +config CMD_MMC_SWRITE
> +   bool "mmc swrite"
> +   depends on CMD_MMC && MMC_WRITE
> +   select IMAGE_SPARSE
> +   help
> + Enable support for the "mmc swrite" command to write Android sparse
> + images to eMMC.
> +
>  config CMD_NAND
> bool "nand"
> default y if NAND_SUNXI
> diff --git a/cmd/mmc.c b/cmd/mmc.c
> index cc44525..66c3ee0 100644
> --- a/cmd/mmc.c
> +++ b/cmd/mmc.c
> @@ -308,8 +308,7 @@ static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
> return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
>  }
>
> -#if CONFIG_IS_ENABLED(MMC_WRITE)
> -#if defined(CONFIG_FASTBOOT_FLASH)
> +#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
>  static lbaint_t mmc_sparse_write(struct sparse_storage *info, lbaint_t blk,
>  lbaint_t blkcnt, const void *buffer)
>  {
> @@ -374,6 +373,7 @@ static int do_mmc_sparse_write(cmd_tbl_t *cmdtp, int flag,
>  }
>  #endif
>
> +#if CONFIG_IS_ENABLED(MMC_WRITE)
>  static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
> int argc, char * const argv[])
>  {
> @@ -868,11 +868,11 @@ static cmd_tbl_t cmd_mmc[] = {
> U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
>  #if CONFIG_IS_ENABLED(MMC_WRITE)
> U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""),
> -#if defined(CONFIG_FASTBOOT_FLASH)
> -   U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
> -#endif
> U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""),
>  #endif
> +#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
> +   U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
> +#endif
> U_BOOT_CMD_MKENT(rescan, 1, 1, do_mmc_rescan, "", ""),
> U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
> U_BOOT_CMD_MKENT(dev, 3, 0, do_mmc_dev, "", ""),
> @@ -927,7 +927,7 @@ U_BOOT_CMD(
> "info - display info of the current MMC device\n"
> "mmc read addr blk# cnt\n"
> "mmc write addr blk# cnt\n"
> -#if defined(CONFIG_FASTBOOT_FLASH)
> +#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
> "mmc swrite addr blk#\n"
>  #endif
> "mmc erase blk# cnt\n"
> diff --git a/common/Makefile b/common/Makefile
> index 9ec40b9..b3da72e 100644
> --- a/common/Makefile
> +++ b/common/Makefile
> @@ -29,7 +29,6 @@ obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
>
>  obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
>  obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
> -obj-$(CONFIG_FASTBOOT_FLASH) += image-sparse.o
>  obj-$(CONFIG_MII) += miiphyutil.o
>  obj-$(CONFIG_CMD_MII) += miiphyutil.o
>  obj-$(CONFIG_PHYLIB) += miiphyutil.o
> diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
> index b38f302..acd0c4d 100644
> --- a/drivers/fastboot/Kconfig
> +++ b/drivers/fastboot/Kconfig
> @@ -57,6 +57,7 @@ config FASTBOOT_FLASH
> bool "Enable FASTBOOT FLASH command"
> default y if ARCH_SUNXI
> depends on MMC || (NAND && CMD_MTDPARTS)
> +   select IMAGE_SPARSE
> help
>   The fastboot protocol includes a "flash" command for writing
>   the downloaded image to a non-volatile storage device. Define
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 1590f7a..15c6a52 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -61,6 +61,17 @@ config SPL_STRTO
>  config TPL_STRTO
> bool
>
> +config IMAGE_SPARSE
> +   bool
> +
> +config IMAGE_SPARSE_FILLBUF_SIZE
> +   hex "Android sparse image CHUNK_TYPE_FILL buffer size"
> +   default 0x8
> +   depends on IMAGE_SPARSE
> +   help
> + Set the size of the fill buffer used when processing CHUNK_TYPE_FILL
> + chunks.
> +
>  config USE_PRIVATE_LIBGCC
>

[U-Boot] [PATCH v5 14/16] mmc: Separate "mmc swrite" from fastboot

2018-05-17 Thread Alex Kiernan
Introduce CONFIG_IMAGE_SPARSE and CONFIG_CMD_MMC_SWRITE so the "mmc
swrite" command is separated from the fastboot code.

Move image-sparse from common to lib so it's clear it's library code.

Rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
and migrate it to Kconfig.

Signed-off-by: Alex Kiernan 
---

Changes in v5:
- rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
  and migrate it to Kconfig.

Changes in v4:
- new

Changes in v3: None
Changes in v2: None

 cmd/Kconfig|  8 
 cmd/mmc.c  | 12 ++--
 common/Makefile|  1 -
 drivers/fastboot/Kconfig   |  1 +
 lib/Kconfig| 11 +++
 lib/Makefile   |  1 +
 {common => lib}/image-sparse.c |  6 +-
 scripts/config_whitelist.txt   |  1 -
 8 files changed, 28 insertions(+), 13 deletions(-)
 rename {common => lib}/image-sparse.c (97%)

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 91f6dfe..98763c9 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -826,6 +826,14 @@ config CMD_MMC
help
  MMC memory mapped support.
 
+config CMD_MMC_SWRITE
+   bool "mmc swrite"
+   depends on CMD_MMC && MMC_WRITE
+   select IMAGE_SPARSE
+   help
+ Enable support for the "mmc swrite" command to write Android sparse
+ images to eMMC.
+
 config CMD_NAND
bool "nand"
default y if NAND_SUNXI
diff --git a/cmd/mmc.c b/cmd/mmc.c
index cc44525..66c3ee0 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -308,8 +308,7 @@ static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
 }
 
-#if CONFIG_IS_ENABLED(MMC_WRITE)
-#if defined(CONFIG_FASTBOOT_FLASH)
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
 static lbaint_t mmc_sparse_write(struct sparse_storage *info, lbaint_t blk,
 lbaint_t blkcnt, const void *buffer)
 {
@@ -374,6 +373,7 @@ static int do_mmc_sparse_write(cmd_tbl_t *cmdtp, int flag,
 }
 #endif
 
+#if CONFIG_IS_ENABLED(MMC_WRITE)
 static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
 {
@@ -868,11 +868,11 @@ static cmd_tbl_t cmd_mmc[] = {
U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
 #if CONFIG_IS_ENABLED(MMC_WRITE)
U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""),
-#if defined(CONFIG_FASTBOOT_FLASH)
-   U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
-#endif
U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""),
 #endif
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
+   U_BOOT_CMD_MKENT(swrite, 3, 0, do_mmc_sparse_write, "", ""),
+#endif
U_BOOT_CMD_MKENT(rescan, 1, 1, do_mmc_rescan, "", ""),
U_BOOT_CMD_MKENT(part, 1, 1, do_mmc_part, "", ""),
U_BOOT_CMD_MKENT(dev, 3, 0, do_mmc_dev, "", ""),
@@ -927,7 +927,7 @@ U_BOOT_CMD(
"info - display info of the current MMC device\n"
"mmc read addr blk# cnt\n"
"mmc write addr blk# cnt\n"
-#if defined(CONFIG_FASTBOOT_FLASH)
+#if CONFIG_IS_ENABLED(CMD_MMC_SWRITE)
"mmc swrite addr blk#\n"
 #endif
"mmc erase blk# cnt\n"
diff --git a/common/Makefile b/common/Makefile
index 9ec40b9..b3da72e 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -29,7 +29,6 @@ obj-$(CONFIG_CMD_BOOTI) += bootm.o bootm_os.o
 
 obj-$(CONFIG_CMD_BEDBUG) += bedbug.o
 obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += fdt_support.o
-obj-$(CONFIG_FASTBOOT_FLASH) += image-sparse.o
 obj-$(CONFIG_MII) += miiphyutil.o
 obj-$(CONFIG_CMD_MII) += miiphyutil.o
 obj-$(CONFIG_PHYLIB) += miiphyutil.o
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index b38f302..acd0c4d 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -57,6 +57,7 @@ config FASTBOOT_FLASH
bool "Enable FASTBOOT FLASH command"
default y if ARCH_SUNXI
depends on MMC || (NAND && CMD_MTDPARTS)
+   select IMAGE_SPARSE
help
  The fastboot protocol includes a "flash" command for writing
  the downloaded image to a non-volatile storage device. Define
diff --git a/lib/Kconfig b/lib/Kconfig
index 1590f7a..15c6a52 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -61,6 +61,17 @@ config SPL_STRTO
 config TPL_STRTO
bool
 
+config IMAGE_SPARSE
+   bool
+
+config IMAGE_SPARSE_FILLBUF_SIZE
+   hex "Android sparse image CHUNK_TYPE_FILL buffer size"
+   default 0x8
+   depends on IMAGE_SPARSE
+   help
+ Set the size of the fill buffer used when processing CHUNK_TYPE_FILL
+ chunks.
+
 config USE_PRIVATE_LIBGCC
bool "Use private libgcc"
depends on HAVE_PRIVATE_LIBGCC
diff --git a/lib/Makefile b/lib/Makefile
index d531ea5..a4bbe2f 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_FIT) += fdtdec_common.o
 obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
 obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
 

[U-Boot] [PATCH v5 01/16] fastboot: Move fastboot to drivers/fastboot

2018-05-17 Thread Alex Kiernan
Separate CMD_FASTBOOT from FASTBOOT and move code and configuration to
drivers/fastboot.

Switch dependencies on FASTBOOT to USB_FUNCTION_FASTBOOT as anyone who wants
FASTBOOT before this series wants USB_FUNCTION_FASTBOOT. Split
USB_FUNCTION_FASTBOOT from FASTBOOT so they retain their existing
behaviour.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v5:
- don't depend on UDP_FUNCTION_FASTBOOT until it exists
- squash in subsequent patch which updates defconfigs so we don't leave users
  of CONFIG_FASTBOOT without it enabled
- fix build in drivers/fastboot when we have CONFIG_FASTBOOT without flash
  or erase and we've not yet added fb_common.c to the build

Changes in v4: None
Changes in v3:
- move imply ANDROID_BOOT_IMAGE, CMD_FASTBOOT to FASTBOOT from
  USB_FUNCTION_FASTBOOT
- add depend on USB_FUNCTION_FASTBOOT to FASTBOOT_USB_DEV
- leave images-sparse.c in common to acommodate 2f83f21

Changes in v2: None

 arch/arm/Kconfig |  2 --
 board/ti/common/Kconfig  |  1 -
 cmd/Kconfig  | 14 --
 common/Makefile  | 15 +-
 configs/am335x_boneblack_defconfig   |  2 +-
 configs/am335x_boneblack_vboot_defconfig |  2 +-
 configs/am335x_evm_defconfig |  2 +-
 configs/am335x_evm_nor_defconfig |  2 +-
 configs/am335x_evm_norboot_defconfig |  2 +-
 configs/am335x_evm_spiboot_defconfig |  2 +-
 configs/am335x_evm_usbspl_defconfig  |  2 +-
 configs/am57xx_evm_defconfig |  2 +-
 configs/am57xx_hs_evm_defconfig  |  2 +-
 configs/bcm23550_w1d_defconfig   |  2 +-
 configs/bcm28155_ap_defconfig|  2 +-
 configs/birdland_bav335a_defconfig   |  2 +-
 configs/birdland_bav335b_defconfig   |  2 +-
 configs/cgtqmx6eval_defconfig|  2 +-
 configs/dra7xx_evm_defconfig |  2 +-
 configs/dra7xx_hs_evm_defconfig  |  2 +-
 configs/kc1_defconfig|  2 +-
 configs/mx6qsabrelite_defconfig  |  2 +-
 configs/mx6sabresd_defconfig |  2 +-
 configs/nitrogen6dl2g_defconfig  |  2 +-
 configs/nitrogen6dl_defconfig|  2 +-
 configs/nitrogen6q2g_defconfig   |  2 +-
 configs/nitrogen6q_defconfig |  2 +-
 configs/nitrogen6s1g_defconfig   |  2 +-
 configs/nitrogen6s_defconfig |  2 +-
 configs/omap3_beagle_defconfig   |  2 +-
 configs/omap3_evm_defconfig  |  2 +-
 configs/omap3_logic_defconfig|  2 +-
 configs/sniper_defconfig |  2 +-
 configs/stih410-b2260_defconfig  |  2 +-
 configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig |  2 +-
 configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig |  2 +-
 configs/xilinx_zynqmp_zcu102_rev1_0_defconfig|  2 +-
 configs/xilinx_zynqmp_zcu102_revA_defconfig  |  2 +-
 configs/xilinx_zynqmp_zcu102_revB_defconfig  |  2 +-
 configs/xilinx_zynqmp_zcu106_revA_defconfig  |  2 +-
 drivers/Kconfig  |  2 ++
 drivers/Makefile |  3 ++
 {cmd => drivers}/fastboot/Kconfig| 35 
 drivers/fastboot/Makefile|  8 ++
 {common => drivers/fastboot}/fb_mmc.c|  0
 {common => drivers/fastboot}/fb_nand.c   |  0
 46 files changed, 74 insertions(+), 78 deletions(-)
 rename {cmd => drivers}/fastboot/Kconfig (88%)
 create mode 100644 drivers/fastboot/Makefile
 rename {common => drivers/fastboot}/fb_mmc.c (100%)
 rename {common => drivers/fastboot}/fb_nand.c (100%)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c9d6e0a..c4acd10 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1246,9 +1246,7 @@ config ARCH_ROCKCHIP
select DM_REGULATOR
select ENABLE_ARM_SOC_BOOT0_HOOK
select SPI
-   imply CMD_FASTBOOT
imply DISTRO_DEFAULTS
-   imply FASTBOOT
imply FAT_WRITE
imply USB_FUNCTION_FASTBOOT
imply SPL_SYSRESET
diff --git a/board/ti/common/Kconfig b/board/ti/common/Kconfig
index c21eb8c..b1956b8 100644
--- a/board/ti/common/Kconfig
+++ b/board/ti/common/Kconfig
@@ -25,7 +25,6 @@ config TI_COMMON_CMD_OPTIONS
imply CMD_EXT2
imply CMD_EXT4
imply CMD_EXT4_WRITE
-   imply CMD_FASTBOOT if FASTBOOT
imply CMD_FAT
imply FAT_WRITE if CMD_FAT
imply CMD_FS_GENERIC
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 38406fc..91f6dfe 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -137,8 +137,6 @@ config AUTOBOOT_STOP_STR_SHA256
 
 endmenu
 

[U-Boot] [PATCH v5 00/16] Add fastboot UDP support

2018-05-17 Thread Alex Kiernan

This series merges the fastboot UDP support from AOSP into mainline
U-Boot.

Changes in UDP behaviour from the AOSP code, so it follows the existing USB
behaviour:

- 'boot' now follows the USB code and does 'bootm CONFIG_FASTBOOT_BUF_ADDR'.
  I've added 'fastboot_bootcmd' which if set overrides the boot command and
  allows the existing UDP behaviour to be preserved.
- 'continue' in UDP now exits the fastboot server rather than executing
  'run bootcmd'
- 'reboot-bootloader' no longer writes 'reboot-bootloader' to
  CONFIG_FASTBOOT_BUF_ADDR as its marker for the subsequent boot. The code
  which is in AOSP common/android_bootloader.c expects this marker, but
  we have prior art in the USB code using the weak function
  fastboot_set_reboot_flag
- 'getvar' in the UDP path now supports fetching 'fastboot.' prefixed
  variables (inherited from the USB path), these override the defaults

I'll post the USB migration as a separate patch.

Changes in v5:
- don't depend on UDP_FUNCTION_FASTBOOT until it exists
- squash in subsequent patch which updates defconfigs so we don't leave users
  of CONFIG_FASTBOOT without it enabled
- fix build in drivers/fastboot when we have CONFIG_FASTBOOT without flash
  or erase and we've not yet added fb_common.c to the build
- fix docbook formatting
- rename CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE to CONFIG_IMAGE_SPARSE_FILLBUF_SIZE
  and migrate it to Kconfig.
- make fastboot_bytes_received/expected static and add function
  fastboot_get_bytes_remaining()
- move fastboot_buf_addr/fastboot_buf_size/fastboot_progress_callback
  into fastboot-internal.h
- delete redundant fb_ prefixes from statics

Changes in v4:
- add docbook comments
- leave strcmp_l1() in USB fastboot as we don't need it in UDP path
- add docbook comments
- guard fb_getvar/fb_command with UDP_FUNCTION_FASTBOOT in Makefile
- add docbook comments
- remove parameter from fastboot_boot() since we always want
  fastboot_buf_addr (and if we're using fastboot_bootcmd then it's
  ignored)
- split oem format into new patch

Changes in v3:
- move imply ANDROID_BOOT_IMAGE, CMD_FASTBOOT to FASTBOOT from
  USB_FUNCTION_FASTBOOT
- add depend on USB_FUNCTION_FASTBOOT to FASTBOOT_USB_DEV
- leave images-sparse.c in common to acommodate 2f83f21
- refactor for changes in master
- Merge subsequent patch for formatting response strings into this one
- allow NULL to fastboot_okay() when there's no message to send
- guard FASTBOOT_GPT_NAME/FASTBOOT_MBR_NAME with EFI/DOS_PARTITION
- use FASTBOOT as our guard in Kconfig not a list of USB || UDP
- correct mis-translation from AOSP introduced when cleaning up for
  checkpatch - we should write when buffer is not NULL, rather than
  erasing, and erase when buffer is NULL
- use CMD_RET_USAGE from do_fastboot
- remove do_fastboot_udp from cmd/net.c and rewrite using net_loop()
- rename timed_send_info to fastboot_send_info, rename fastboot_send_info to
  fastboot_udp_send_info
- replace FASTBOOT_HEADER_SIZE with sizeof(struct fastboot_header)
- move start time into timed_send_info() rather than passing it in
- make calls to fastboot_udp_send_info a runtime dependency, not a compile
  time one
- set ${filesize} to size of downloaded image
- add progress meter from USB path during download
- add support for 'oem format' command from the USB path
- rename 'fastbootcmd' to 'fastboot_bootcmd' to make clear that this is the
  fastboot boot command
- make getvar implementation table driven
- add fastboot_buf_addr, fastboot_buf_size to override buffer address and
  size
- return correct filesystem type in getvar partition-type on MMC
- process "fastboot." prefixed env variables in getvar first so you
  can override the normal values (this also lets you set a fs type for
  NAND devices)
- squash subsequent patches which change this code into this one:
  - If the fastboot flash/erase commands are disabled, remove that support
so we still build correctly.
  - Add NAND support to fastboot UDP flash/erase commands
  - If we don't have a partition name passed, report it as not found.
  - Change the behaviour of the fastboot net code such that
"reboot-bootloader" is no longer written to CONFIG_FASTBOOT_BUF_ADDR for
use as a marker on reboot (the AOSP code in common/android-bootloader.c
uses this marker - this code could be reinstated there if that gets
merged).
  - Merge USB and UDP boot code. The USB implementation stays the same, but
UDP no longer passes an fdt. We introduce a new environment variable
'fastboot_bootcmd' which if set overrides the hardcoded boot command,
setting this then allows the UDP implementation to remain the same. If
after running 'fastboot_bootcmd' the board has not booted, control is
returned to U-Boot and the fastboot process ends.
  - Separate the fastboot protocol handling from the fastboot UDP code in
preparation for reusing it in the USB code.

Changes in v2:
- ensure fastboot syntax is backward compatible - 'fastboot 0' means
  

Re: [U-Boot] [PULL] Please pull u-boot-imx

2018-05-17 Thread Lukasz Majewski
Hi Tom, Stefano,

> On Thu, May 17, 2018 at 07:08:37PM +0200, Stefano Babic wrote:
> > On 17/05/2018 18:33, Lukasz Majewski wrote:  
> > > Hi Stefano, Tom,
> > >   
> > 
> > Tom was not in CC, added
> >   
> > > On 17 May 2018 17:50, Stefano Babic  wrote:
> > > 
> > > Hi Tom,
> > > 
> > > please pull from u-boot-imx, thanks !
> > > 
> > > The following changes since commit
> > > f2d0f5e7ab3b8a7b4bf6e2ac499b4867c701d52d:
> > > 
> > >   ARM: re-enable MVGBE for edminiv2 (2018-05-16 11:38:08
> > > -0400)
> > > 
> > > are available in the git repository at:
> > > 
> > >   git://www.denx.de/git/u-boot-imx.git master
> > > 
> > > for you to fetch changes up to
> > > 2f5988533d5c447d7bda79b0d9719f84db9e1835:
> > > 
> > >   imx6: sabrelite: update defconfig to use distro defaults
> > > (2018-05-17 17:47:17 +0200)
> > > 
> > > 
> > > Guillaume GARDET (2):
> > >   imx6: Convert sabrelite and nitrogen6x boards to distro
> > > boot support
> > >   imx6: sabrelite: update defconfig to use distro defaults
> > > 
> > > Ian Ray (6):
> > >   board: ge: bx50v3: add winbond SPI NOR support
> > >   board: ge: bx50v3: rename detect_baseboard function
> > >   board: ge: bx50v3: fix display support for b{46}50v3
> > >   board: ge: bx50v3: use VPD instead of compile-time
> > > checks board: ge: bx50v3: configure video arguments using VPD
> > >   board: ge: bx50v3: remove redundant targets
> > > 
> > > Lukasz Majewski (8):
> > >   dts: imx53: Add gpio and i2c nodes to imx53.dtsi file
> > >   dts: pinctrl: Provide IMX_PAD_SION definition for imx53
> > > pinctrl
> > > 
> > > 
> > > Two above patches are correct.
> > > 
> > >   pmic: fsl: Provide some more definitions for MC34708
> > > PMIC pmic: fsl: Define number of bytes sent at once by MC34708
> > > PMIC pmic: dm: Provide *trans_len() callback for pmic-uclass
> > >   pmic: dm: Rewrite pmic_reg_{read|write} and
> > > pmic_clrsetbits to support transmissions larger than 1 byte
> > >   pmic: dm: Add support for MC34708 for PMIC DM
> > >   arm: imx53: Add support for imx53 boards from K+P
> > > 
> > > 
> > > Stefano, Tom please drop above patches as they were superseded by
> > > v2 and v3 (after discussion with Simon).  
> > 
> > I have just added the pmic patches due to the dependency in "arm:
> > imx53: Add support for imx53 boards from K+P", and I have not seen
> > any change request in them. I drop the series, Tom please wait, I
> > will send a new PR after.  
> 
> OK.
> 
> > > IMHO v3 is eligible for pulling:
> > > https://patchwork.ozlabs.org/patch/913670/
> > >   
> > 
> > Should they flow into Jaehoon's tree instead of u-boot-imx ?  
> 
> I'm fine with this coming along via the imx tree so we can get it in
> now.
> 

I would also opt for this option.

For the future - I've looked at:

http://git.denx.de/?p=u-boot/u-boot-pmic.git;a=summary
https://www.denx.de/wiki/U-Boot/Custodians   (which seems outdated
anyway)

It seems like u-boot-pmic repo is dead (as Przemek is not doing any
open source work since 2017). If you think that it helps
- I can take it and rise my hand to be PMIC maintainer (again).


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de


pgp81HknDHloT.pgp
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Zynq: CONFIG_BOARD_RESET or reset_misc(), or ...?

2018-05-17 Thread Leon Woestenberg
Hello all,

for a Zynq (7-series) ARM based system I would like to implement a
board-specific reset function.

There are a few existing slightly different methods in place (see
below). What is the preferred way and place?

My current feeling is overriding reset_misc() in board.c, i.e. method
#4 from the existings methods I found in U-Boot, see below.


1) There used to be a call-out from the CPU reset to the board_reset()
if CONFIG_BOARD_RESET was defined non-zero, like this:

arch/powerpc/cpu/ppc4xx/cpu.c:

<...>
void board_reset(void);
<...>
int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
#if defined(CONFIG_BOARD_RESET)
board_reset();
<...>

This only existed for ppc4xx (which I think has been obsoleted now).


2) Blackfin seems to define a weak label "board_reset", and this
(function) pointer is compared against non-NULL, called if non-NULL.

arch/blackfin/cpu/reset.c:88:   if (board_reset)
arch/blackfin/cpu/reset.c:89:   board_reset();
arch/blackfin/cpu/cpu.h:14:void board_reset(void) __attribute__((__weak__));

3) PowerPC MPC85xx seems to define a weak label, and alias it to a
__board_reset();

arch/powerpc/cpu/mpc85xx/cpu.c:33:__board_reset(void)
arch/powerpc/cpu/mpc85xx/cpu.c:37:void board_reset(void)
__attribute__((weak, alias("__board_reset")));
arch/powerpc/cpu/mpc85xx/cpu.c:315: board_reset();

/*
 * Default board reset function
 */
static void
__board_reset(void)
{
/* Do nothing */
}
void board_reset(void) __attribute__((weak, alias("__board_reset")));


4) Similarly but a bit hidden for my "grep board_reset", is
reset_misc() in arch/arm/lib/reset.c:

#include 

__weak void reset_misc(void)
{
}

int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
puts ("resetting ...\n");

udelay (5); /* wait 50 ms */

disable_interrupts();

reset_misc();


Thanks,

Leon.


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


[U-Boot] [PATCH] pylibfdt: Add missing CC and LD to Makefile

2018-05-17 Thread Marek Vasut
Add missing CC and LDSHARED variables to the Makefile to pass the
correct C compiler and linker path to the build of _libfdt.so .

Signed-off-by: Marek Vasut 
Cc: Tom Rini 
Cc: Masahiro Yamada 
Cc: Simon Glass 
---
Note: This fixes the long standing issue when building U-Boot with
  OE for qemux86 or qemux86_64, where the build will try to use
  the host compiler, which OE will block and thus the build will
  crash on missing compiler/linker binary. With this patch, the
  OE will correctly pass in the compiler/linker generated during
  the build, just like it does for all the other tools.
---
 scripts/dtc/pylibfdt/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile
index 01d5e0ffe3..e6f6e9f633 100644
--- a/scripts/dtc/pylibfdt/Makefile
+++ b/scripts/dtc/pylibfdt/Makefile
@@ -15,6 +15,7 @@ PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) 
\
 
 quiet_cmd_pymod = PYMOD   $@
   cmd_pymod = unset CC; unset CROSS_COMPILE; unset CFLAGS;\
+   CC="$(HOSTCC)" LDSHARED="$(HOSTCC) -shared " \
LDFLAGS="$(HOSTLDFLAGS)" \
VERSION="u-boot-$(UBOOTVERSION)" \
CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \
-- 
2.16.2

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


[U-Boot] [PATCH] sunxi: Enable fitImage support on OrangePi Zero

2018-05-17 Thread Marek Vasut
Enable modern fitImage format on OrangePi Zero.

Signed-off-by: Marek Vasut 
Cc: Maxime Ripard 
Cc: Tom Rini 
---
 configs/orangepi_zero_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configs/orangepi_zero_defconfig b/configs/orangepi_zero_defconfig
index 6afd4a3bfa..b3860659d6 100644
--- a/configs/orangepi_zero_defconfig
+++ b/configs/orangepi_zero_defconfig
@@ -9,6 +9,8 @@ CONFIG_DRAM_ODT_EN=y
 CONFIG_SPL_SPI_SUNXI=y
 CONFIG_DEFAULT_DEVICE_TREE="sun8i-h2-plus-orangepi-zero"
 # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
 CONFIG_CONSOLE_MUX=y
 # CONFIG_CMD_FLASH is not set
 CONFIG_SUN8I_EMAC=y
-- 
2.16.2

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


Re: [U-Boot] Please pull u-boot-marvell/master (v2)

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 05:42:53PM +0200, Stefan Roese wrote:

> Hi Tom,
> 
> please pull the Kirkwood DT patches from Chris. This time with
> PHYLIB disabled for some boards (as was before).
> 
> Thanks,
> Stefan
> 
> 
> The following changes since commit f2d0f5e7ab3b8a7b4bf6e2ac499b4867c701d52d:
> 
>   ARM: re-enable MVGBE for edminiv2 (2018-05-16 11:38:08 -0400)
> 
> are available in the Git repository at:
> 
>   git://www.denx.de/git/u-boot-marvell.git 
> 
> for you to fetch changes up to f6e62ee04c37bb8d1726848c7fa9bcafb270e0f6:
> 
>   net: MVGBE don't automatically select PHYLIB (2018-05-17 17:38:31 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Please pull u-boot-dm

2018-05-17 Thread Tom Rini
On Wed, May 16, 2018 at 02:57:30PM -0600, Simon Glass wrote:

> Hi Tom,
> 
> The following changes since commit 0315d6959fdd9d2a4d89016c311e9c8c8d239a10:
> 
>   ARM: mvebu: a38x: Add missing SPDX license identfier (2018-05-15
> 09:08:00 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-dm.git
> 
> for you to fetch changes up to f717b4c8e7fc871573755a05be96c8ef857eabce:
> 
>   pinctrl: do not set_state for device without valid ofnode
> (2018-05-16 00:25:19 -0600)
> 

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] Please pull u-boot-imx

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 07:08:37PM +0200, Stefano Babic wrote:
> On 17/05/2018 18:33, Lukasz Majewski wrote:
> > Hi Stefano, Tom,
> > 
> 
> Tom was not in CC, added
> 
> > On 17 May 2018 17:50, Stefano Babic  wrote:
> > 
> > Hi Tom,
> > 
> > please pull from u-boot-imx, thanks !
> > 
> > The following changes since commit
> > f2d0f5e7ab3b8a7b4bf6e2ac499b4867c701d52d:
> > 
> >   ARM: re-enable MVGBE for edminiv2 (2018-05-16 11:38:08 -0400)
> > 
> > are available in the git repository at:
> > 
> >   git://www.denx.de/git/u-boot-imx.git master
> > 
> > for you to fetch changes up to 2f5988533d5c447d7bda79b0d9719f84db9e1835:
> > 
> >   imx6: sabrelite: update defconfig to use distro defaults (2018-05-17
> > 17:47:17 +0200)
> > 
> > 
> > Guillaume GARDET (2):
> >   imx6: Convert sabrelite and nitrogen6x boards to distro boot
> > support
> >   imx6: sabrelite: update defconfig to use distro defaults
> > 
> > Ian Ray (6):
> >   board: ge: bx50v3: add winbond SPI NOR support
> >   board: ge: bx50v3: rename detect_baseboard function
> >   board: ge: bx50v3: fix display support for b{46}50v3
> >   board: ge: bx50v3: use VPD instead of compile-time checks
> >   board: ge: bx50v3: configure video arguments using VPD
> >   board: ge: bx50v3: remove redundant targets
> > 
> > Lukasz Majewski (8):
> >   dts: imx53: Add gpio and i2c nodes to imx53.dtsi file
> >   dts: pinctrl: Provide IMX_PAD_SION definition for imx53 pinctrl
> > 
> > 
> > Two above patches are correct.
> > 
> >   pmic: fsl: Provide some more definitions for MC34708 PMIC
> >   pmic: fsl: Define number of bytes sent at once by MC34708 PMIC
> >   pmic: dm: Provide *trans_len() callback for pmic-uclass
> >   pmic: dm: Rewrite pmic_reg_{read|write} and pmic_clrsetbits to
> > support transmissions larger than 1 byte
> >   pmic: dm: Add support for MC34708 for PMIC DM
> >   arm: imx53: Add support for imx53 boards from K+P
> > 
> > 
> > Stefano, Tom please drop above patches as they were superseded by v2 and
> > v3 (after discussion with Simon).
> 
> I have just added the pmic patches due to the dependency in "arm: imx53:
> Add support for imx53 boards from K+P", and I have not seen any change
> request in them. I drop the series, Tom please wait, I will send a new
> PR after.

OK.

> > IMHO v3 is eligible for pulling:
> > https://patchwork.ozlabs.org/patch/913670/
> > 
> 
> Should they flow into Jaehoon's tree instead of u-boot-imx ?

I'm fine with this coming along via the imx tree so we can get it in
now.

-- 
Tom


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


[U-Boot] [RFC PATCH v2 2/2] fastboot: Update fastboot documentation

2018-05-17 Thread Alex Kiernan
Update fastboot documentation to reflect merged USB/UDP implementation.
Bring in current Android fastboot protocol document.

Signed-off-by: Alex Kiernan 
---

Changes in v2:
- new

 doc/README.android-fastboot | 80 +++--
 1 file changed, 55 insertions(+), 25 deletions(-)

diff --git a/doc/README.android-fastboot b/doc/README.android-fastboot
index 2c3ee78..ff6518e 100644
--- a/doc/README.android-fastboot
+++ b/doc/README.android-fastboot
@@ -1,35 +1,45 @@
+
 Android Fastboot
-
+
 
 Overview
 
-The protocol that is used over USB is described in
-README.android-fastboot-protocol in same directory.
+The protocol that is used over USB and UDP is described in the
+README.android-fastboot-protocol file in the same directory.
 
-The current implementation is a minimal support of the erase command,the
-"oem format" command and flash command;it only supports eMMC devices.
+The current implementation supports the following standard commands:
+
+- boot
+- continue
+- download
+- erase (if enabled)
+- flash (if enabled)
+- getvar
+- reboot
+- reboot-bootloader
+- set_active (only a stub implementation which always succeeds)
+
+The following OEM commands are supported (if enabled):
+
+- oem format - this executes 'gpt write mmc %x $partitions'
+
+Support for both eMMC and NAND devices is included.
 
 Client installation
 ===
-The counterpart to this gadget is the fastboot client which can
-be found in Android's platform/system/core repository in the fastboot
-folder. It runs on Windows, Linux and even OSX. Linux user are lucky since
-they only need libusb.
-Windows users need to bring some time until they have Android SDK (currently
-http://dl.google.com/android/installer_r12-windows.exe) installed. You
-need to install ADB package which contains the required glue libraries for
-accessing USB. Also you need "Google USB driver package" and "SDK platform
-tools". Once installed the usb driver is placed in your SDK folder under
-extras\google\usb_driver. The android_winusb.inf needs a line like
-
-   %SingleBootLoaderInterface% = USB_Install, USB\VID_0451_D022
-
-either in the [Google.NTx86] section for 32bit Windows or [Google.NTamd64]
-for 64bit Windows. VID and PID should match whatever the fastboot is
-advertising.
+
+The counterpart to this is the fastboot client which can be found in
+Android's platform/system/core repository in the fastboot folder. It runs on
+Windows, Linux and even OSX. The fastboot client is part of the Android
+SDK Platform-Tools and can be downloaded from:
+
+https://developer.android.com/studio/releases/platform-tools
 
 Board specific
 ==
+
+USB configuration
+-
 The fastboot gadget relies on the USB download gadget, so the following
 options must be configured:
 
@@ -42,14 +52,19 @@ NOTE: The CONFIG_USB_GADGET_VENDOR_NUM must be one of the 
numbers supported by
 the fastboot client. The list of vendor IDs supported can be found in the
 fastboot client source code (fastboot.c) mentioned above.
 
-The fastboot function is enabled by defining CONFIG_USB_FUNCTION_FASTBOOT,
-CONFIG_CMD_FASTBOOT and CONFIG_ANDROID_BOOT_IMAGE.
-
+General configuration
+-
 The fastboot protocol requires a large memory buffer for downloads. This
 buffer should be as large as possible for a platform. The location of the
 buffer and size are set with CONFIG_FASTBOOT_BUF_ADDR and
-CONFIG_FASTBOOT_BUF_SIZE.
+CONFIG_FASTBOOT_BUF_SIZE. These may be overridden on the fastboot command
+line using -l and -s.
+
+Fastboot environment variables
+==
 
+Partition aliases
+-
 Fastboot partition aliases can also be defined for devices where GPT
 limitations prevent user-friendly partition names such as "boot", "system"
 and "cache".  Or, where the actual partition name doesn't match a standard
@@ -59,6 +74,21 @@ To define a partition alias add an environment variable 
similar to:
 fastboot_partition_alias_=
 Example: fastboot_partition_alias_boot=LNX
 
+Variable overrides
+--
+Variables retrived through getvar can be overridden by defining environment
+variables of the form "fastboot.". These are looked up first so
+can be used to override values which would otherwise be returned. Using this
+mechanism you can also return types for NAND filesystems, as the fully
+parameterised variable is looked up, e.g.
+
+fastboot.partition-type:boot=jffs2
+
+Boot command
+
+When executing the fastboot 'boot' command, if fastboot_bootcmd is set then
+that will be executed in place of bootm .
+
 Partition Names
 ===
 The Fastboot implementation in U-boot allows to write images into disk
-- 
2.7.4

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


Re: [U-Boot] [PULL] Please pull u-boot-imx

2018-05-17 Thread Stefano Babic
On 17/05/2018 18:33, Lukasz Majewski wrote:
> Hi Stefano, Tom,
> 

Tom was not in CC, added

> On 17 May 2018 17:50, Stefano Babic  wrote:
> 
> Hi Tom,
> 
> please pull from u-boot-imx, thanks !
> 
> The following changes since commit
> f2d0f5e7ab3b8a7b4bf6e2ac499b4867c701d52d:
> 
>   ARM: re-enable MVGBE for edminiv2 (2018-05-16 11:38:08 -0400)
> 
> are available in the git repository at:
> 
>   git://www.denx.de/git/u-boot-imx.git master
> 
> for you to fetch changes up to 2f5988533d5c447d7bda79b0d9719f84db9e1835:
> 
>   imx6: sabrelite: update defconfig to use distro defaults (2018-05-17
> 17:47:17 +0200)
> 
> 
> Guillaume GARDET (2):
>   imx6: Convert sabrelite and nitrogen6x boards to distro boot
> support
>   imx6: sabrelite: update defconfig to use distro defaults
> 
> Ian Ray (6):
>   board: ge: bx50v3: add winbond SPI NOR support
>   board: ge: bx50v3: rename detect_baseboard function
>   board: ge: bx50v3: fix display support for b{46}50v3
>   board: ge: bx50v3: use VPD instead of compile-time checks
>   board: ge: bx50v3: configure video arguments using VPD
>   board: ge: bx50v3: remove redundant targets
> 
> Lukasz Majewski (8):
>   dts: imx53: Add gpio and i2c nodes to imx53.dtsi file
>   dts: pinctrl: Provide IMX_PAD_SION definition for imx53 pinctrl
> 
> 
> Two above patches are correct.
> 
>   pmic: fsl: Provide some more definitions for MC34708 PMIC
>   pmic: fsl: Define number of bytes sent at once by MC34708 PMIC
>   pmic: dm: Provide *trans_len() callback for pmic-uclass
>   pmic: dm: Rewrite pmic_reg_{read|write} and pmic_clrsetbits to
> support transmissions larger than 1 byte
>   pmic: dm: Add support for MC34708 for PMIC DM
>   arm: imx53: Add support for imx53 boards from K+P
> 
> 
> Stefano, Tom please drop above patches as they were superseded by v2 and
> v3 (after discussion with Simon).

I have just added the pmic patches due to the dependency in "arm: imx53:
Add support for imx53 boards from K+P", and I have not seen any change
request in them. I drop the series, Tom please wait, I will send a new
PR after.

> 
> IMHO v3 is eligible for pulling:
> https://patchwork.ozlabs.org/patch/913670/
> 

Should they flow into Jaehoon's tree instead of u-boot-imx ?

Best regards,
Stefano

> BR,
> Łukasz Majewski
> 
> Magnus Lilja (2):
>   mx31pdk: Convert CONFIG_MX31 flag to use Kconfig.
>   mx31: Convert MX31_HCLK_FREQ and MX31_CLK32 to Kconfig.
> 
> Nandor Han (2):
>   board: ge: bx50v3: unify two switch statements
>   board: ge: bx50v3: detect the monitor type by reading VPD earlier
> 
> Peter Robinson (4):
>   mx6 common: remove dangling comment
>   mx7: remove empty ifndef statement
>   mx6: Select CONFIG_MP with MX6_SMP
>   mx6: remove duplicated BOUNCE_BUFFER defines
> 
> Sebastian Reichel (1):
>   ge: ppd: move CONFIG_ENV_IS_IN_MMC to defconfig
> 
> arch/arm/Kconfig |  14 +++
> arch/arm/dts/imx53-kp.dts    | 135
> 
> arch/arm/dts/imx53-pinfunc.h |   1 +
> arch/arm/dts/imx53.dtsi  | 101
> +++-
> arch/arm/include/asm/arch-mx31/clock.h   |   8 
> arch/arm/mach-imx/mx3/Kconfig    |  34
> +
> arch/arm/mach-imx/mx5/Kconfig    |  12 ++
> arch/arm/mach-imx/mx6/Kconfig    |  15 ++--
> board/ge/bx50v3/Kconfig  |   2 +-
> board/ge/bx50v3/bx50v3.c |  71
> ++
> board/k+p/kp_imx53/Kconfig   |  15 
> board/k+p/kp_imx53/MAINTAINERS   |   6 +++
> board/k+p/kp_imx53/Makefile  |   8 
> board/k+p/kp_imx53/kp_id_rev.c   | 121
> ++
> board/k+p/kp_imx53/kp_id_rev.h   |  28
> ++
> board/k+p/kp_imx53/kp_imx53.c    | 212
> 
> +
> configs/ge_b650v3_defconfig  |  43
> -
> configs/ge_b850v3_defconfig  |  43
> -
> configs/{ge_b450v3_defconfig => ge_bx50v3_defconfig} |   4 +-
> configs/kp_imx53_defconfig   |  40
> 

[U-Boot] [PATCH 1/1] Makefile: clean should delete *.efi

2018-05-17 Thread Heinrich Schuchardt
Files *.efi are generated files. So the clean target should delete them.

Signed-off-by: Heinrich Schuchardt 
---
 Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 714ac9e1183..96c53250484 100644
--- a/Makefile
+++ b/Makefile
@@ -1611,7 +1611,8 @@ clean: $(clean-dirs)
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name modules.builtin -o -name '.tmp_*.o.*' \
-o -name 'dsdt.aml' -o -name 'dsdt.asl.tmp' -o -name 'dsdt.c' \
-   -o -name '*.gcno' \) -type f -print | xargs rm -f
+   -o -name '*.efi' -o -name '*.gcno' \) \
+   -type f -print | xargs rm -f
 
 # mrproper - Delete all generated files, including .config
 #
-- 
2.14.2

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


Re: [U-Boot] RFC: Alternative boot_jump_linux() function

2018-05-17 Thread Ramon Fried
On Thu, May 17, 2018 at 5:22 PM, Tom Rini  wrote:
> On Thu, May 17, 2018 at 02:01:55PM +0300, Ramon Fried wrote:
>
>> Hi.
>> I'm currently working on snapdragon bootloader support and in the
>> particular case where U-boot is running in Aarch32 and the kernel is
>> Aarch64 the specific implementation is to jump to Linux through SCM
>> call.
>>
>> I try to find the best possible way to provide an alternative boot function.
>> Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
>> arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
>> a callback function in gd. that if exists will jump there instead of
>> executing boot_jump_linux().
>>
>> What do you think ?
>
> So, to be clear, we're on an aarch64 SoC, but U-Boot has been entered in
> 32bit mode.  And we need to boot a 64bit Linux Kernel.  What else, if
> anything, is also loaded/still in residence/etc?  Can you explain the
> overall usecase a bit more and why we're in 32bit mode?  Thanks!
>
OK.
Basically, Qualcomm has the following boot flow:

PBL -> SBL -> LK -> Linux Kernel

PBL - 32bit Primary boot loader(ROM) loads the SBL from eMMC.

SBL - 32bit Secondary boot loader(eMMC/UFS), proprietary closed source,
Initializes the DDR, starts the trustzone and can load either a 32bit
or a 64bit (1)
ELF bootloader, given that it's signed.

LK - Little kernel, 32bit. Qualcomm maintains a downstream version, open source.
Loads 64bit Android boot image from eMMC and jumps to it using SMC
call made to Trustzone.

This was used primarily for Android, but when Dragonboards boards came
out, Qualcomm and Linaro started
distributing 64bit Linux OE & Debian builds that were booted by LK.
Because U-boot is much more useful than LK, the first U-boot
contribution was made by Mateusz Kulikowski.

Basically, Mateusz port is wrapping U-boot to appear as a kernel so LK
boots it, then it boots Linux.
So basically, LK did the 32 -> 64 transition.

Now, here where I appear in the story... :)

I'm trying to get rid of LK and use U-boot as the real bootloader for Linux.
I succeeded in that, and I have all the patches ready for submission,
I just need to add a dedicated boot function
that does the SMC call, hence this discussion.

(1) - It implies that we can in practice just use 64bit U-boot for Snapdragon.
The only problem I have right now is that there's isn't any
open-source tool to sign the Bootloader that supports ELF64
executable.

Thanks,
Ramon.


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


[U-Boot] [PATCH 1/1] efi_selftest: do not call efi_init_obj_list() twice

2018-05-17 Thread Heinrich Schuchardt
Remove a superfluous call to efi_init_obj_list() invoked by
'bootefi selftest'.

Signed-off-by: Heinrich Schuchardt 
---
 cmd/bootefi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index fe50bac1c50..806339823ff 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -441,8 +441,6 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 * callback entry
 */
efi_save_gd();
-   /* Initialize and populate EFI object list */
-   efi_init_obj_list();
/* Transfer environment variable efi_selftest as load options */
set_load_options(_image_info, "efi_selftest");
/* Execute the test */
-- 
2.14.2

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


[U-Boot] [RFC PATCH v2 1/2] usb: fastboot: Convert USB f_fastboot to shared fastboot

2018-05-17 Thread Alex Kiernan
Convert USB fastboot code to use shared fastboot protocol.

Signed-off-by: Alex Kiernan 
---

Changes in v2:
- remove redundant version.h
- use new fastboot_get_bytes_remaining() function

 drivers/fastboot/Makefile   |   4 +-
 drivers/usb/gadget/f_fastboot.c | 318 +---
 2 files changed, 37 insertions(+), 285 deletions(-)

diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
index 8831096..a242156 100644
--- a/drivers/fastboot/Makefile
+++ b/drivers/fastboot/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier:  GPL-2.0+
 
 obj-y += fb_common.o
-obj-$(CONFIG_UDP_FUNCTION_FASTBOOT) += fb_getvar.o
-obj-$(CONFIG_UDP_FUNCTION_FASTBOOT) += fb_command.o
+obj-y += fb_getvar.o
+obj-y += fb_command.o
 obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fb_mmc.o
 obj-$(CONFIG_FASTBOOT_FLASH_NAND) += fb_nand.o
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 07d6a62..4a87dc5 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -18,14 +18,7 @@
 #include 
 #include 
 #include 
-#include 
 #include 
-#ifdef CONFIG_FASTBOOT_FLASH_MMC
-#include 
-#endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND
-#include 
-#endif
 
 #define FASTBOOT_INTERFACE_CLASS   0xff
 #define FASTBOOT_INTERFACE_SUB_CLASS   0x42
@@ -56,8 +49,6 @@ static inline struct f_fastboot *func_to_fastboot(struct 
usb_function *f)
 }
 
 static struct f_fastboot *fastboot_func;
-static unsigned int download_size;
-static unsigned int download_bytes;
 
 static struct usb_endpoint_descriptor fs_ep_in = {
.bLength= USB_DT_ENDPOINT_SIZE,
@@ -145,7 +136,6 @@ static struct usb_gadget_strings *fastboot_strings[] = {
 };
 
 static void rx_handler_command(struct usb_ep *ep, struct usb_request *req);
-static int strcmp_l1(const char *s1, const char *s2);
 
 static void fastboot_complete(struct usb_ep *ep, struct usb_request *req)
 {
@@ -355,85 +345,9 @@ static void compl_do_reset(struct usb_ep *ep, struct 
usb_request *req)
do_reset(NULL, 0, 0, NULL);
 }
 
-static void cb_reboot(struct usb_ep *ep, struct usb_request *req)
-{
-   char *cmd = req->buf;
-   if (!strcmp_l1("reboot-bootloader", cmd)) {
-   if (fastboot_set_reboot_flag()) {
-   fastboot_tx_write_str("FAILCannot set reboot flag");
-   return;
-   }
-   }
-   fastboot_func->in_req->complete = compl_do_reset;
-   fastboot_tx_write_str("OKAY");
-}
-
-static int strcmp_l1(const char *s1, const char *s2)
-{
-   if (!s1 || !s2)
-   return -1;
-   return strncmp(s1, s2, strlen(s1));
-}
-
-static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
-{
-   char *cmd = req->buf;
-   char response[FASTBOOT_RESPONSE_LEN];
-   const char *s;
-   size_t chars_left;
-
-   strcpy(response, "OKAY");
-   chars_left = sizeof(response) - strlen(response) - 1;
-
-   strsep(, ":");
-   if (!cmd) {
-   pr_err("missing variable");
-   fastboot_tx_write_str("FAILmissing var");
-   return;
-   }
-
-   if (!strcmp_l1("version", cmd)) {
-   strncat(response, FASTBOOT_VERSION, chars_left);
-   } else if (!strcmp_l1("bootloader-version", cmd)) {
-   strncat(response, U_BOOT_VERSION, chars_left);
-   } else if (!strcmp_l1("downloadsize", cmd) ||
-   !strcmp_l1("max-download-size", cmd)) {
-   char str_num[12];
-
-   sprintf(str_num, "0x%08x", CONFIG_FASTBOOT_BUF_SIZE);
-   strncat(response, str_num, chars_left);
-   } else if (!strcmp_l1("serialno", cmd)) {
-   s = env_get("serial#");
-   if (s)
-   strncat(response, s, chars_left);
-   else
-   strcpy(response, "FAILValue not set");
-   } else {
-   char *envstr;
-
-   envstr = malloc(strlen("fastboot.") + strlen(cmd) + 1);
-   if (!envstr) {
-   fastboot_tx_write_str("FAILmalloc error");
-   return;
-   }
-
-   sprintf(envstr, "fastboot.%s", cmd);
-   s = env_get(envstr);
-   if (s) {
-   strncat(response, s, chars_left);
-   } else {
-   printf("WARNING: unknown variable: %s\n", cmd);
-   strcpy(response, "FAILVariable not implemented");
-   }
-
-   free(envstr);
-   }
-   fastboot_tx_write_str(response);
-}
-
 static unsigned int rx_bytes_expected(struct usb_ep *ep)
 {
-   int rx_remain = download_size - download_bytes;
+   int rx_remain = fastboot_get_bytes_remaining();
unsigned int rem;
unsigned int maxpacket = ep->maxpacket;
 
@@ -455,14 +369,12 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep)
return rx_remain;
 }
 

[U-Boot] [RFC PATCH v2 0/2] Convert USB fastboot code to use shared protocol

2018-05-17 Thread Alex Kiernan

This builds on the fastboot UDP support and migrates the USB fastboot code
to the shared code.

It's currently untested, other than passing in Travis:

https://travis-ci.org/akiernan/u-boot/builds/380023917


Changes in v2:
- remove redundant version.h
- use new fastboot_get_bytes_remaining() function

Alex Kiernan (2):
  usb: fastboot: Convert USB f_fastboot to shared fastboot
  fastboot: Update fastboot documentation

 doc/README.android-fastboot |  80 ++
 drivers/fastboot/Makefile   |   4 +-
 drivers/usb/gadget/f_fastboot.c | 318 +---
 3 files changed, 92 insertions(+), 310 deletions(-)

-- 
2.7.4

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


[U-Boot] [PATCH v5 11/16] ti: fastboot: Move weak overrides to board files

2018-05-17 Thread Alex Kiernan
Overriding fastboot_set_reboot_flag() in arch/arm/mach-omap2/boot-common.c
leaves it applying all boards that derive from this, not just the ones which
have support for Android bootloader flow. Move the weak function override to
the relevant board files.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- new

Changes in v2: None

 arch/arm/mach-omap2/boot-common.c | 10 --
 board/ti/am57xx/board.c   | 10 ++
 board/ti/dra7xx/evm.c | 10 ++
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-omap2/boot-common.c 
b/arch/arm/mach-omap2/boot-common.c
index b22b671..d4a1e2e 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -236,13 +236,3 @@ void arch_preboot_os(void)
ahci_reset((void __iomem *)DWC_AHSATA_BASE);
 }
 #endif
-
-#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
-int fastboot_set_reboot_flag(void)
-{
-   printf("Setting reboot to fastboot flag ...\n");
-   env_set("dofastboot", "1");
-   env_save();
-   return 0;
-}
-#endif
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index fd9d207..177a324 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -1178,5 +1178,15 @@ void board_tee_image_process(ulong tee_image, size_t 
tee_size)
secure_tee_install((u32)tee_image);
 }
 
+#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
+int fastboot_set_reboot_flag(void)
+{
+   printf("Setting reboot to fastboot flag ...\n");
+   env_set("dofastboot", "1");
+   env_save();
+   return 0;
+}
+#endif
+
 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TEE, board_tee_image_process);
 #endif
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 6918f4d..bbe5445 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -1188,5 +1188,15 @@ void board_tee_image_process(ulong tee_image, size_t 
tee_size)
secure_tee_install((u32)tee_image);
 }
 
+#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
+int fastboot_set_reboot_flag(void)
+{
+   printf("Setting reboot to fastboot flag ...\n");
+   env_set("dofastboot", "1");
+   env_save();
+   return 0;
+}
+#endif
+
 U_BOOT_FIT_LOADABLE_HANDLER(IH_TYPE_TEE, board_tee_image_process);
 #endif
-- 
2.7.4

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


[U-Boot] [PATCH v5 16/16] fastboot: Add support for 'oem format' command

2018-05-17 Thread Alex Kiernan
Introduce 'oem format' which matches the USB implementation, guard this
with CONFIG_FASTBOOT_CMD_OEM_FORMAT so that you can configure it out.

Signed-off-by: Alex Kiernan 
---

Changes in v5:
- new

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/fastboot/Kconfig  |  8 
 drivers/fastboot/fb_command.c | 33 +
 include/fastboot.h|  3 +++
 3 files changed, 44 insertions(+)

diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 4c0a5b0..b3186b0 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -132,6 +132,14 @@ config FASTBOOT_MBR_NAME
  specified on the "fastboot flash" command line matches the value
  defined here. The default target name for updating MBR is "mbr".
 
+config FASTBOOT_CMD_OEM_FORMAT
+   bool "Enable the 'oem format' command"
+   depends on FASTBOOT_FLASH_MMC && CMD_GPT
+   help
+ Add support for the "oem format" command from a client. This
+ relies on the env variable partitions to contain the list of
+ partitions as required by the gpt command.
+
 endif # FASTBOOT
 
 endmenu
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 4db0165..0b8c3b9 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -34,6 +34,9 @@ static void flash(char *, char *);
 static void erase(char *, char *);
 #endif
 static void reboot_bootloader(char *, char *);
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+static void oem_format(char *, char *);
+#endif
 
 static const struct {
const char *command;
@@ -77,6 +80,12 @@ static const struct {
.command = "set_active",
.dispatch = okay
},
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+   [FASTBOOT_COMMAND_OEM_FORMAT] = {
+   .command = "oem format",
+   .dispatch = oem_format,
+   },
+#endif
 };
 
 /**
@@ -293,3 +302,27 @@ static void reboot_bootloader(char *cmd_parameter, char 
*response)
else
fastboot_okay(NULL, response);
 }
+
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+/**
+ * oem_format() - Execute the OEM format command
+ *
+ * @cmd_parameter: Pointer to command parameter
+ * @response: Pointer to fastboot response buffer
+ */
+static void oem_format(char *cmd_parameter, char *response)
+{
+   char cmdbuf[32];
+
+   if (!env_get("partitions")) {
+   fastboot_fail("partitions not set", response);
+   } else {
+   sprintf(cmdbuf, "gpt write mmc %x $partitions",
+   CONFIG_FASTBOOT_FLASH_MMC_DEV);
+   if (run_command(cmdbuf, 0))
+   fastboot_fail("", response);
+   else
+   fastboot_okay(NULL, response);
+   }
+}
+#endif
diff --git a/include/fastboot.h b/include/fastboot.h
index d7de385..3384c1a 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -33,6 +33,9 @@ enum {
FASTBOOT_COMMAND_REBOOT,
FASTBOOT_COMMAND_REBOOT_BOOTLOADER,
FASTBOOT_COMMAND_SET_ACTIVE,
+#if CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT)
+   FASTBOOT_COMMAND_OEM_FORMAT,
+#endif
 
FASTBOOT_COMMAND_COUNT
 };
-- 
2.7.4

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


[U-Boot] [PATCH v5 13/16] fastboot: Migrate FASTBOOT_FLASH_NAND_TRIMFFS to Kconfig

2018-05-17 Thread Alex Kiernan
Add FASTBOOT_FLASH_NAND_TRIMFFS to Kconfig; note there are no in-tree
users of it.

Signed-off-by: Alex Kiernan 
---

Changes in v5:
- new

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/fastboot/Kconfig | 6 ++
 scripts/config_whitelist.txt | 1 -
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 51c5789..b38f302 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -95,6 +95,12 @@ config FASTBOOT_FLASH_NAND_DEV
  regarding the non-volatile storage device. Define this to
  the NAND device that fastboot should use to store the image.
 
+config FASTBOOT_FLASH_NAND_TRIMFFS
+   bool "Skip empty pages when flashing NAND"
+   depends on FASTBOOT_FLASH_NAND
+   help
+ When flashing NAND enable DROP_FFS to drop trailing all-0xff pages.
+
 config FASTBOOT_GPT_NAME
string "Target name for updating GPT"
depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 71df6db..347c619 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -591,7 +591,6 @@ CONFIG_EXYNOS_SPL
 CONFIG_EXYNOS_TMU
 CONFIG_FACTORYSET
 CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE
-CONFIG_FASTBOOT_FLASH_NAND_TRIMFFS
 CONFIG_FAST_FLASH_BIT
 CONFIG_FB_ADDR
 CONFIG_FB_BACKLIGHT
-- 
2.7.4

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


[U-Boot] [PATCH v5 12/16] fs: Add fs_get_type_name to return current filesystem name

2018-05-17 Thread Alex Kiernan
Add fs_get_type_name so we can get the current filesystem type.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Reviewed-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4:
- add docbook comments

Changes in v3:
- new

Changes in v2: None

 fs/fs.c  | 13 +
 include/fs.h | 10 ++
 2 files changed, 23 insertions(+)

diff --git a/fs/fs.c b/fs/fs.c
index 94cdc37..33808d5 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -265,6 +265,19 @@ static struct fstype_info *fs_get_info(int fstype)
return info;
 }
 
+/**
+ * fs_get_type_name() - Get type of current filesystem
+ *
+ * Return: Pointer to filesystem name
+ *
+ * Returns a string describing the current filesystem, or the sentinel
+ * "unsupported" for any unrecognised filesystem.
+ */
+const char *fs_get_type_name(void)
+{
+   return fs_get_info(fs_type)->name;
+}
+
 int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype)
 {
struct fstype_info *info;
diff --git a/include/fs.h b/include/fs.h
index d703ed5..163da10 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -37,6 +37,16 @@ int fs_set_blk_dev(const char *ifname, const char 
*dev_part_str, int fstype);
  */
 int fs_set_blk_dev_with_part(struct blk_desc *desc, int part);
 
+/**
+ * fs_get_type_name() - Get type of current filesystem
+ *
+ * Return: Pointer to filesystem name
+ *
+ * Returns a string describing the current filesystem, or the sentinel
+ * "unsupported" for any unrecognised filesystem.
+ */
+const char *fs_get_type_name(void);
+
 /*
  * Print the list of files on the partition previously set by fs_set_blk_dev(),
  * in directory "dirname".
-- 
2.7.4

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


[U-Boot] [PATCH v5 15/16] net: fastboot: Merge AOSP UDP fastboot

2018-05-17 Thread Alex Kiernan
Merge UDP fastboot support from AOSP:

  
https://android.googlesource.com/platform/external/u-boot/+/android-o-mr1-iot-preview-8

Signed-off-by: Alex Kiernan 
Signed-off-by: Alex Deymo 
Signed-off-by: Jocelyn Bohr 
Reviewed-by: Simon Glass 
---

Changes in v5:
- make fastboot_bytes_received/expected static and add function
  fastboot_get_bytes_remaining()
- move fastboot_buf_addr/fastboot_buf_size/fastboot_progress_callback
  into fastboot-internal.h
- delete redundant fb_ prefixes from statics

Changes in v4:
- guard fb_getvar/fb_command with UDP_FUNCTION_FASTBOOT in Makefile
- add docbook comments
- remove parameter from fastboot_boot() since we always want
  fastboot_buf_addr (and if we're using fastboot_bootcmd then it's
  ignored)
- split oem format into new patch

Changes in v3:
- use FASTBOOT as our guard in Kconfig not a list of USB || UDP
- correct mis-translation from AOSP introduced when cleaning up for
  checkpatch - we should write when buffer is not NULL, rather than
  erasing, and erase when buffer is NULL
- use CMD_RET_USAGE from do_fastboot
- remove do_fastboot_udp from cmd/net.c and rewrite using net_loop()
- rename timed_send_info to fastboot_send_info, rename fastboot_send_info to
  fastboot_udp_send_info
- replace FASTBOOT_HEADER_SIZE with sizeof(struct fastboot_header)
- move start time into timed_send_info() rather than passing it in
- make calls to fastboot_udp_send_info a runtime dependency, not a compile
  time one
- set ${filesize} to size of downloaded image
- add progress meter from USB path during download
- add support for 'oem format' command from the USB path
- rename 'fastbootcmd' to 'fastboot_bootcmd' to make clear that this is the
  fastboot boot command
- make getvar implementation table driven
- add fastboot_buf_addr, fastboot_buf_size to override buffer address and
  size
- return correct filesystem type in getvar partition-type on MMC
- process "fastboot." prefixed env variables in getvar first so you
  can override the normal values (this also lets you set a fs type for
  NAND devices)
- squash subsequent patches which change this code into this one:
  - If the fastboot flash/erase commands are disabled, remove that support
so we still build correctly.
  - Add NAND support to fastboot UDP flash/erase commands
  - If we don't have a partition name passed, report it as not found.
  - Change the behaviour of the fastboot net code such that
"reboot-bootloader" is no longer written to CONFIG_FASTBOOT_BUF_ADDR for
use as a marker on reboot (the AOSP code in common/android-bootloader.c
uses this marker - this code could be reinstated there if that gets
merged).
  - Merge USB and UDP boot code. The USB implementation stays the same, but
UDP no longer passes an fdt. We introduce a new environment variable
'fastboot_bootcmd' which if set overrides the hardcoded boot command,
setting this then allows the UDP implementation to remain the same. If
after running 'fastboot_bootcmd' the board has not booted, control is
returned to U-Boot and the fastboot process ends.
  - Separate the fastboot protocol handling from the fastboot UDP code in
preparation for reusing it in the USB code.

Changes in v2:
- ensure fastboot syntax is backward compatible - 'fastboot 0' means
  'fastboot usb 0'

 cmd/Kconfig   |   4 +-
 cmd/fastboot.c|  91 +++-
 drivers/fastboot/Kconfig  |   7 +
 drivers/fastboot/Makefile |   3 +-
 drivers/fastboot/fb_command.c | 295 +++
 drivers/fastboot/fb_common.c  |  93 +
 drivers/fastboot/fb_getvar.c  | 230 +++
 drivers/fastboot/fb_mmc.c |  76 +-
 drivers/fastboot/fb_nand.c|  12 +-
 include/fastboot-internal.h   |  36 +
 include/fastboot.h|  97 +
 include/fb_mmc.h  |   8 +-
 include/fb_nand.h |  10 +-
 include/net.h |   2 +-
 include/net/fastboot.h|  21 +++
 net/Makefile  |   1 +
 net/fastboot.c| 312 ++
 net/net.c |   7 +
 18 files changed, 1286 insertions(+), 19 deletions(-)
 create mode 100644 drivers/fastboot/fb_command.c
 create mode 100644 drivers/fastboot/fb_getvar.c
 create mode 100644 include/fastboot-internal.h
 create mode 100644 include/net/fastboot.h
 create mode 100644 net/fastboot.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 98763c9..51fa0dd 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -655,8 +655,8 @@ config CMD_FASTBOOT
  This enables the command "fastboot" which enables the Android
  fastboot mode for the platform. Fastboot is a protocol for
  downloading images, flashing and device control used on
- Android devices. Fastboot requires support for acting as a USB
- device.
+ 

[U-Boot] [PATCH v5 08/16] fastboot: Rename fb_set_reboot_flag to fastboot_set_reboot_flag

2018-05-17 Thread Alex Kiernan
Rename fb_set_reboot_flag to fastboot_set_reboot_flag so it matches
all other fastboot code in the global name space. Fix the guards around
them so that they're dependent on FASTBOOT, not just USB_FUNCTION_FASTBOOT.

Move the weak implementation of fastboot_set_reboot_flag to fb_common.c
so we can call it from non-USB fastboot code.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- new

Changes in v2: None

 arch/arm/mach-omap2/boot-common.c |  4 ++--
 arch/arm/mach-rockchip/rk3128-board.c |  4 ++--
 arch/arm/mach-rockchip/rk322x-board.c |  4 ++--
 board/amazon/kc1/kc1.c|  2 +-
 board/lg/sniper/sniper.c  |  2 +-
 drivers/fastboot/fb_common.c  | 15 +++
 drivers/usb/gadget/f_fastboot.c   |  7 +--
 include/fastboot.h|  2 +-
 8 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap2/boot-common.c 
b/arch/arm/mach-omap2/boot-common.c
index 0e9fd03..b22b671 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -237,8 +237,8 @@ void arch_preboot_os(void)
 }
 #endif
 
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT) && !defined(CONFIG_ENV_IS_NOWHERE)
-int fb_set_reboot_flag(void)
+#if CONFIG_IS_ENABLED(FASTBOOT) && !CONFIG_IS_ENABLED(ENV_IS_NOWHERE)
+int fastboot_set_reboot_flag(void)
 {
printf("Setting reboot to fastboot flag ...\n");
env_set("dofastboot", "1");
diff --git a/arch/arm/mach-rockchip/rk3128-board.c 
b/arch/arm/mach-rockchip/rk3128-board.c
index 48cd8ba..7fd667a 100644
--- a/arch/arm/mach-rockchip/rk3128-board.c
+++ b/arch/arm/mach-rockchip/rk3128-board.c
@@ -111,8 +111,8 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 }
 #endif
 
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
-int fb_set_reboot_flag(void)
+#if CONFIG_IS_ENABLED(FASTBOOT)
+int fastboot_set_reboot_flag(void)
 {
struct rk3128_grf *grf;
 
diff --git a/arch/arm/mach-rockchip/rk322x-board.c 
b/arch/arm/mach-rockchip/rk322x-board.c
index 99a60c4..7366d45 100644
--- a/arch/arm/mach-rockchip/rk322x-board.c
+++ b/arch/arm/mach-rockchip/rk322x-board.c
@@ -139,8 +139,8 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 }
 #endif
 
-#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
-int fb_set_reboot_flag(void)
+#if CONFIG_IS_ENABLED(FASTBOOT)
+int fastboot_set_reboot_flag(void)
 {
struct rk322x_grf *grf;
 
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c
index d9ca183..031fd11 100644
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
@@ -161,7 +161,7 @@ void get_board_serial(struct tag_serialnr *serialnr)
omap_die_id_get_board_serial(serialnr);
 }
 
-int fb_set_reboot_flag(void)
+int fastboot_set_reboot_flag(void)
 {
return omap_reboot_mode_store("b");
 }
diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c
index 34a7a11..a7de4c2 100644
--- a/board/lg/sniper/sniper.c
+++ b/board/lg/sniper/sniper.c
@@ -173,7 +173,7 @@ void reset_misc(void)
omap_reboot_mode_store(reboot_mode);
 }
 
-int fb_set_reboot_flag(void)
+int fastboot_set_reboot_flag(void)
 {
return omap_reboot_mode_store("b");
 }
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
index c4a7702..79e080a 100644
--- a/drivers/fastboot/fb_common.c
+++ b/drivers/fastboot/fb_common.c
@@ -59,3 +59,18 @@ void fastboot_okay(const char *reason, char *response)
else
fastboot_response("OKAY", response, NULL);
 }
+
+/**
+ * fastboot_set_reboot_flag() - Set flag to indicate reboot-bootloader
+ *
+ * Set flag which indicates that we should reboot into the bootloader
+ * following the reboot that fastboot executes after this function.
+ *
+ * This function should be overridden in your board file with one
+ * which sets whatever flag your board specific Android bootloader flow
+ * requires in order to re-enter the bootloader.
+ */
+int __weak fastboot_set_reboot_flag(void)
+{
+   return -ENOSYS;
+}
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 323ac89..697eee5 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -357,16 +357,11 @@ static void compl_do_reset(struct usb_ep *ep, struct 
usb_request *req)
do_reset(NULL, 0, 0, NULL);
 }
 
-int __weak fb_set_reboot_flag(void)
-{
-   return -ENOSYS;
-}
-
 static void cb_reboot(struct usb_ep *ep, struct usb_request *req)
 {
char *cmd = req->buf;
if (!strcmp_l1("reboot-bootloader", cmd)) {
-   if (fb_set_reboot_flag()) {
+   if (fastboot_set_reboot_flag()) {
fastboot_tx_write_str("FAILCannot set reboot flag");
return;
}
diff --git a/include/fastboot.h b/include/fastboot.h
index 6cd44d2..816e71b 100644
--- a/include/fastboot.h
+++ 

[U-Boot] [PATCH v5 09/16] fastboot: Extract common definitions from USB fastboot

2018-05-17 Thread Alex Kiernan
Move FASTBOOT_VERSION to include/fastboot.h so when we merge the UDP code
we only have one definition.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4:
- leave strcmp_l1() in USB fastboot as we don't need it in UDP path

Changes in v3:
- new

Changes in v2: None

 drivers/usb/gadget/f_fastboot.c | 2 --
 include/fastboot.h  | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 697eee5..25784a1 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -27,8 +27,6 @@
 #include 
 #endif
 
-#define FASTBOOT_VERSION   "0.4"
-
 #define FASTBOOT_INTERFACE_CLASS   0xff
 #define FASTBOOT_INTERFACE_SUB_CLASS   0x42
 #define FASTBOOT_INTERFACE_PROTOCOL0x03
diff --git a/include/fastboot.h b/include/fastboot.h
index 816e71b..bf3d9e2 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -12,6 +12,8 @@
 #ifndef _FASTBOOT_H_
 #define _FASTBOOT_H_
 
+#define FASTBOOT_VERSION   "0.4"
+
 /* The 64 defined bytes plus \0 */
 #define FASTBOOT_RESPONSE_LEN  (64 + 1)
 
-- 
2.7.4

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


[U-Boot] [PATCH v5 06/16] fastboot: Remove FIXME for CONFIG_FASTBOOT_...NAME

2018-05-17 Thread Alex Kiernan
CONFIG_FASTBOOT_GPT_NAME and CONFIG_FASTBOOT_MBR_NAME are always defined
by Kconfig if you're compiling this code, so remove these redundant
defaults.

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- new

Changes in v2: None

 drivers/fastboot/fb_mmc.c | 13 -
 1 file changed, 13 deletions(-)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index b1db296..038905f 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -15,19 +15,6 @@
 #include 
 #include 
 
-/*
- * FIXME: Ensure we always set these names via Kconfig once xxx_PARTITION is
- * migrated
- */
-#ifndef CONFIG_FASTBOOT_GPT_NAME
-#define CONFIG_FASTBOOT_GPT_NAME "gpt"
-#endif
-
-
-#ifndef CONFIG_FASTBOOT_MBR_NAME
-#define CONFIG_FASTBOOT_MBR_NAME "mbr"
-#endif
-
 #define BOOT_PARTITION_NAME "boot"
 
 struct fb_mmc_sparse {
-- 
2.7.4

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


[U-Boot] [PATCH v5 10/16] fastboot: Rename public fb_ functions to fastboot_

2018-05-17 Thread Alex Kiernan
Rename fb_mmc_flash_write/fb_mmc_erase/fb_nand_flash_write/fb_nand_erase to
fastboot_... as they form a public interface

Signed-off-by: Alex Kiernan 
---

Changes in v5:
- new

Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/fastboot/fb_mmc.c   |  6 +++---
 drivers/fastboot/fb_nand.c  |  6 +++---
 drivers/usb/gadget/f_fastboot.c | 12 ++--
 include/fb_mmc.h|  6 +++---
 include/fb_nand.h   |  6 +++---
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 038905f..6bb4b87 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -251,8 +251,8 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
 }
 #endif
 
-void fb_mmc_flash_write(const char *cmd, void *download_buffer,
-   unsigned int download_bytes, char *response)
+void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
+ unsigned int download_bytes, char *response)
 {
struct blk_desc *dev_desc;
disk_partition_t info;
@@ -349,7 +349,7 @@ void fb_mmc_flash_write(const char *cmd, void 
*download_buffer,
}
 }
 
-void fb_mmc_erase(const char *cmd, char *response)
+void fastboot_mmc_erase(const char *cmd, char *response)
 {
int ret;
struct blk_desc *dev_desc;
diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
index 849a6f1..28059b0 100644
--- a/drivers/fastboot/fb_nand.c
+++ b/drivers/fastboot/fb_nand.c
@@ -145,8 +145,8 @@ static lbaint_t fb_nand_sparse_reserve(struct 
sparse_storage *info,
return blkcnt + bad_blocks;
 }
 
-void fb_nand_flash_write(const char *cmd, void *download_buffer,
-unsigned int download_bytes, char *response)
+void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
+  unsigned int download_bytes, char *response)
 {
struct part_info *part;
struct mtd_info *mtd = NULL;
@@ -204,7 +204,7 @@ void fb_nand_flash_write(const char *cmd, void 
*download_buffer,
fastboot_okay(NULL, response);
 }
 
-void fb_nand_erase(const char *cmd, char *response)
+void fastboot_nand_erase(const char *cmd, char *response)
 {
struct part_info *part;
struct mtd_info *mtd = NULL;
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 25784a1..07d6a62 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -577,12 +577,12 @@ static void cb_flash(struct usb_ep *ep, struct 
usb_request *req)
 
fastboot_fail("no flash device defined", response);
 #ifdef CONFIG_FASTBOOT_FLASH_MMC
-   fb_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
-  download_bytes, response);
+   fastboot_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
+download_bytes, response);
 #endif
 #ifdef CONFIG_FASTBOOT_FLASH_NAND
-   fb_nand_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
-   download_bytes, response);
+   fastboot_nand_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
+ download_bytes, response);
 #endif
fastboot_tx_write_str(response);
 }
@@ -625,10 +625,10 @@ static void cb_erase(struct usb_ep *ep, struct 
usb_request *req)
 
fastboot_fail("no flash device defined", response);
 #ifdef CONFIG_FASTBOOT_FLASH_MMC
-   fb_mmc_erase(cmd, response);
+   fastboot_mmc_erase(cmd, response);
 #endif
 #ifdef CONFIG_FASTBOOT_FLASH_NAND
-   fb_nand_erase(cmd, response);
+   fastboot_nand_erase(cmd, response);
 #endif
fastboot_tx_write_str(response);
 }
diff --git a/include/fb_mmc.h b/include/fb_mmc.h
index 39a960c..5243dd5 100644
--- a/include/fb_mmc.h
+++ b/include/fb_mmc.h
@@ -3,6 +3,6 @@
  * Copyright 2014 Broadcom Corporation.
  */
 
-void fb_mmc_flash_write(const char *cmd, void *download_buffer,
-   unsigned int download_bytes, char *response);
-void fb_mmc_erase(const char *cmd, char *response);
+void fastboot_mmc_flash_write(const char *cmd, void *download_buffer,
+ unsigned int download_bytes, char *response);
+void fastboot_mmc_erase(const char *cmd, char *response);
diff --git a/include/fb_nand.h b/include/fb_nand.h
index 2c92a4e..bc34074 100644
--- a/include/fb_nand.h
+++ b/include/fb_nand.h
@@ -4,6 +4,6 @@
  * Copyright 2015 Free Electrons.
  */
 
-void fb_nand_flash_write(const char *cmd, void *download_buffer,
-unsigned int download_bytes, char *response);
-void fb_nand_erase(const char *cmd, char *response);
+void fastboot_nand_flash_write(const char *cmd, void *download_buffer,
+  unsigned int download_bytes, char *response);
+void fastboot_nand_erase(const char *cmd, char *response);
-- 
2.7.4


[U-Boot] [PATCH v5 07/16] fastboot: Fix parameter types in _fb_nand_write

2018-05-17 Thread Alex Kiernan
Compiling on a 64 bit target the arguments to _fb_nand_write are
incompatible:

  drivers/fastboot/fb_nand.c: In function ‘_fb_nand_write’:
  drivers/fastboot/fb_nand.c:101:42: warning: passing argument 3 of 
‘nand_write_skip_bad’ from incompatible pointer type 
[-Wincompatible-pointer-types]
return nand_write_skip_bad(mtd, offset, , written,
  ^
  In file included from drivers/fastboot/fb_nand.c:16:0:
  include/nand.h:107:5: note: expected ‘size_t * {aka long unsigned int *}’ but 
argument is of type ‘unsigned int *’
   int nand_write_skip_bad(struct mtd_info *mtd, loff_t offset, size_t *length,
   ^~~

Signed-off-by: Alex Kiernan 
Reviewed-by: Simon Glass 
Acked-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- new

Changes in v2: None

 drivers/fastboot/fb_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
index 2ee0d64..849a6f1 100644
--- a/drivers/fastboot/fb_nand.c
+++ b/drivers/fastboot/fb_nand.c
@@ -89,7 +89,7 @@ static int _fb_nand_erase(struct mtd_info *mtd, struct 
part_info *part)
 
 static int _fb_nand_write(struct mtd_info *mtd, struct part_info *part,
  void *buffer, unsigned int offset,
- unsigned int length, size_t *written)
+ size_t length, size_t *written)
 {
int flags = WITH_WR_VERIFY;
 
-- 
2.7.4

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


[U-Boot] [PATCH v5 05/16] fastboot: Add missing newlines

2018-05-17 Thread Alex Kiernan
Add newlines so we format our output correctly.

Signed-off-by: Alex Kiernan 
Acked-by: Joe Hershberger 
Reviewed-by: Jocelyn Bohr 
---

Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 drivers/fastboot/fb_mmc.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index 1bcb2e5..b1db296 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -125,7 +125,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc 
*dev_desc,
sector_size = info->blksz;
hdr_sectors = DIV_ROUND_UP(sizeof(struct andr_img_hdr), sector_size);
if (hdr_sectors == 0) {
-   pr_err("invalid number of boot sectors: 0");
+   pr_err("invalid number of boot sectors: 0\n");
fastboot_fail("invalid number of boot sectors: 0", response);
return 0;
}
@@ -133,7 +133,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc 
*dev_desc,
/* Read the boot image header */
res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr);
if (res != hdr_sectors) {
-   pr_err("cannot read header from boot partition");
+   pr_err("cannot read header from boot partition\n");
fastboot_fail("cannot read header from boot partition",
  response);
return 0;
@@ -142,7 +142,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc 
*dev_desc,
/* Check boot header magic string */
res = android_image_check_header(hdr);
if (res != 0) {
-   pr_err("bad boot image magic");
+   pr_err("bad boot image magic\n");
fastboot_fail("boot partition not initialized", response);
return 0;
}
@@ -181,7 +181,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
/* Get boot partition info */
res = part_get_info_by_name(dev_desc, BOOT_PARTITION_NAME, );
if (res < 0) {
-   pr_err("cannot find boot partition");
+   pr_err("cannot find boot partition\n");
fastboot_fail("cannot find boot partition", response);
return -1;
}
@@ -193,14 +193,14 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
/* Read boot image header */
hdr_sectors = fb_mmc_get_boot_header(dev_desc, , hdr, response);
if (hdr_sectors == 0) {
-   pr_err("unable to read boot image header");
+   pr_err("unable to read boot image header\n");
fastboot_fail("unable to read boot image header", response);
return -1;
}
 
/* Check if boot image has second stage in it (we don't support it) */
if (hdr->second_size > 0) {
-   pr_err("moving second stage is not supported yet");
+   pr_err("moving second stage is not supported yet\n");
fastboot_fail("moving second stage is not supported yet",
  response);
return -1;
@@ -219,7 +219,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
res = blk_dread(dev_desc, ramdisk_sector_start, ramdisk_sectors,
ramdisk_buffer);
if (res != ramdisk_sectors) {
-   pr_err("cannot read ramdisk from boot partition");
+   pr_err("cannot read ramdisk from boot partition\n");
fastboot_fail("cannot read ramdisk from boot partition",
  response);
return -1;
@@ -229,7 +229,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
hdr->kernel_size = download_bytes;
res = blk_dwrite(dev_desc, info.start, hdr_sectors, (void *)hdr);
if (res == 0) {
-   pr_err("cannot writeback boot image header");
+   pr_err("cannot writeback boot image header\n");
fastboot_fail("cannot write back boot image header", response);
return -1;
}
@@ -241,7 +241,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
res = blk_dwrite(dev_desc, kernel_sector_start, kernel_sectors,
 download_buffer);
if (res == 0) {
-   pr_err("cannot write new kernel");
+   pr_err("cannot write new kernel\n");
fastboot_fail("cannot write new kernel", response);
return -1;
}
@@ -253,7 +253,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
res = blk_dwrite(dev_desc, ramdisk_sector_start, ramdisk_sectors,
 ramdisk_buffer);
if (res == 0) {
-   pr_err("cannot write back original ramdisk");
+   pr_err("cannot write back original ramdisk\n");

[U-Boot] [PATCH v5 04/16] fastboot: Correct dependencies in FASTBOOT_FLASH

2018-05-17 Thread Alex Kiernan
Ensure that when selecting FASTBOOT_FLASH you end up with a buildable
configuration. Prior to this you could select NAND without MTDPARTS
and end up with an image which (surprisingly) excluded NAND.

Also fix dependencies on FASTBOOT_GPT_NAME/FASTBOOT_MBR_NAME which require
you have EFI_PARTITION/DOS_PARTITION enabled.

Signed-off-by: Alex Kiernan 
Reviewed-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- guard FASTBOOT_GPT_NAME/FASTBOOT_MBR_NAME with EFI/DOS_PARTITION

Changes in v2: None

 arch/arm/mach-omap2/utils.c |  4 ++--
 drivers/fastboot/Kconfig|  8 
 drivers/fastboot/Makefile   |  8 ++--
 drivers/usb/gadget/f_fastboot.c | 14 +++---
 4 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index dc7b37f..edf5edc 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -85,7 +85,7 @@ static void omap_set_fastboot_board_rev(void)
env_set("fastboot.board_rev", board_rev);
 }
 
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 static u32 omap_mmc_get_part_size(const char *part)
 {
int res;
@@ -128,7 +128,7 @@ static void omap_set_fastboot_userdata_size(void)
 static inline void omap_set_fastboot_userdata_size(void)
 {
 }
-#endif /* CONFIG_FASTBOOT_FLASH_MMC_DEV */
+#endif /* CONFIG_FASTBOOT_FLASH_MMC */
 void omap_set_fastboot_vars(void)
 {
omap_set_fastboot_cpu();
diff --git a/drivers/fastboot/Kconfig b/drivers/fastboot/Kconfig
index 93a8ac6..51c5789 100644
--- a/drivers/fastboot/Kconfig
+++ b/drivers/fastboot/Kconfig
@@ -56,6 +56,7 @@ config FASTBOOT_USB_DEV
 config FASTBOOT_FLASH
bool "Enable FASTBOOT FLASH command"
default y if ARCH_SUNXI
+   depends on MMC || (NAND && CMD_MTDPARTS)
help
  The fastboot protocol includes a "flash" command for writing
  the downloaded image to a non-volatile storage device. Define
@@ -71,7 +72,7 @@ config FASTBOOT_FLASH_MMC
 
 config FASTBOOT_FLASH_NAND
bool "FASTBOOT on NAND"
-   depends on NAND
+   depends on NAND && CMD_MTDPARTS
 
 endchoice
 
@@ -88,7 +89,6 @@ config FASTBOOT_FLASH_MMC_DEV
 config FASTBOOT_FLASH_NAND_DEV
int "Define FASTBOOT NAND FLASH default device"
depends on FASTBOOT_FLASH_NAND
-   depends on CMD_MTDPARTS
default 0 if ARCH_SUNXI && NAND_SUNXI
help
  The fastboot "flash" command requires additional information
@@ -97,7 +97,7 @@ config FASTBOOT_FLASH_NAND_DEV
 
 config FASTBOOT_GPT_NAME
string "Target name for updating GPT"
-   depends on FASTBOOT_FLASH
+   depends on FASTBOOT_FLASH_MMC && EFI_PARTITION
default "gpt"
help
  The fastboot "flash" command supports writing the downloaded
@@ -110,7 +110,7 @@ config FASTBOOT_GPT_NAME
 
 config FASTBOOT_MBR_NAME
string "Target name for updating MBR"
-   depends on FASTBOOT_FLASH
+   depends on FASTBOOT_FLASH_MMC && DOS_PARTITION
default "mbr"
help
  The fastboot "flash" command allows to write the downloaded image
diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
index b38dcff..e4bd389 100644
--- a/drivers/fastboot/Makefile
+++ b/drivers/fastboot/Makefile
@@ -2,9 +2,5 @@
 
 obj-y += fb_common.o
 
-ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
-obj-y += fb_mmc.o
-endif
-ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
-obj-y += fb_nand.o
-endif
+obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fb_mmc.o
+obj-$(CONFIG_FASTBOOT_FLASH_NAND) += fb_nand.o
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 2e6e161..323ac89 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -20,10 +20,10 @@
 #include 
 #include 
 #include 
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
 #include 
 #endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
 #include 
 #endif
 
@@ -583,11 +583,11 @@ static void cb_flash(struct usb_ep *ep, struct 
usb_request *req)
}
 
fastboot_fail("no flash device defined", response);
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
fb_mmc_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
   download_bytes, response);
 #endif
-#ifdef CONFIG_FASTBOOT_FLASH_NAND_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_NAND
fb_nand_flash_write(cmd, (void *)CONFIG_FASTBOOT_BUF_ADDR,
download_bytes, response);
 #endif
@@ -598,7 +598,7 @@ static void cb_flash(struct usb_ep *ep, struct usb_request 
*req)
 static void cb_oem(struct usb_ep *ep, struct usb_request *req)
 {
char *cmd = req->buf;
-#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
+#ifdef CONFIG_FASTBOOT_FLASH_MMC
if (strncmp("format", cmd + 4, 6) == 0) {
char cmdbuf[32];
 sprintf(cmdbuf, "gpt 

[U-Boot] [PATCH v5 03/16] fastboot: Extract fastboot_okay/fail to fb_common.c

2018-05-17 Thread Alex Kiernan
Add drivers/fastboot/fb_common.c, where fastboot_okay/fail are implemented
so we can call them from a non-USB implementation.

Introduce fastboot_response which takes varargs parameters so we can
use it to generate formatted response strings. Refactor fastboot_okay/fail
to use it.

Signed-off-by: Alex Kiernan 
Reviewed-by: Joe Hershberger 
---

Changes in v5:
- fix docbook formatting

Changes in v4:
- add docbook comments

Changes in v3:
- Merge subsequent patch for formatting response strings into this one
- allow NULL to fastboot_okay() when there's no message to send

Changes in v2: None

 drivers/Makefile|  4 +--
 drivers/fastboot/Makefile   |  2 ++
 drivers/fastboot/fb_common.c| 61 +
 drivers/usb/gadget/f_fastboot.c | 13 -
 include/fastboot.h  | 24 
 5 files changed, 88 insertions(+), 16 deletions(-)
 create mode 100644 drivers/fastboot/fb_common.c

diff --git a/drivers/Makefile b/drivers/Makefile
index a79ff2e..d29a6e4 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -71,9 +71,7 @@ obj-y += block/
 obj-$(CONFIG_BOOTCOUNT_LIMIT) += bootcount/
 obj-$(CONFIG_CPU) += cpu/
 obj-y += crypto/
-ifneq ($(CONFIG_FASTBOOT_FLASH_MMC_DEV)$(CONFIG_FASTBOOT_FLASH_NAND_DEV),)
-obj-y += fastboot/
-endif
+obj-$(CONFIG_FASTBOOT) += fastboot/
 obj-y += firmware/
 obj-$(CONFIG_FPGA) += fpga/
 obj-y += misc/
diff --git a/drivers/fastboot/Makefile b/drivers/fastboot/Makefile
index 651fbf0..b38dcff 100644
--- a/drivers/fastboot/Makefile
+++ b/drivers/fastboot/Makefile
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier:  GPL-2.0+
 
+obj-y += fb_common.o
+
 ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
 obj-y += fb_mmc.o
 endif
diff --git a/drivers/fastboot/fb_common.c b/drivers/fastboot/fb_common.c
new file mode 100644
index 000..c4a7702
--- /dev/null
+++ b/drivers/fastboot/fb_common.c
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2008 - 2009
+ * Windriver, 
+ * Tom Rix 
+ *
+ * Copyright 2011 Sebastian Andrzej Siewior 
+ *
+ * Copyright 2014 Linaro, Ltd.
+ * Rob Herring 
+ */
+
+#include 
+#include 
+
+/**
+ * fastboot_response() - Writes a response of the form "$tag$reason".
+ *
+ * @tag: The first part of the response
+ * @response: Pointer to fastboot response buffer
+ * @format: printf style format string
+ */
+void fastboot_response(const char *tag, char *response,
+  const char *format, ...)
+{
+   va_list args;
+
+   strlcpy(response, tag, FASTBOOT_RESPONSE_LEN);
+   if (format) {
+   va_start(args, format);
+   vsnprintf(response + strlen(response),
+ FASTBOOT_RESPONSE_LEN - strlen(response) - 1,
+ format, args);
+   va_end(args);
+   }
+}
+
+/**
+ * fastboot_fail() - Write a FAIL response of the form "FAIL$reason".
+ *
+ * @reason: Pointer to returned reason string
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_fail(const char *reason, char *response)
+{
+   fastboot_response("FAIL", response, "%s", reason);
+}
+
+/**
+ * fastboot_okay() - Write an OKAY response of the form "OKAY$reason".
+ *
+ * @reason: Pointer to returned reason string, or NULL to send a bare "OKAY"
+ * @response: Pointer to fastboot response buffer
+ */
+void fastboot_okay(const char *reason, char *response)
+{
+   if (reason)
+   fastboot_response("OKAY", response, "%s", reason);
+   else
+   fastboot_response("OKAY", response, NULL);
+}
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index bb60612..2e6e161 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -149,19 +149,6 @@ static struct usb_gadget_strings *fastboot_strings[] = {
 static void rx_handler_command(struct usb_ep *ep, struct usb_request *req);
 static int strcmp_l1(const char *s1, const char *s2);
 
-
-void fastboot_fail(const char *reason, char *response)
-{
-   strncpy(response, "FAIL\0", 5);
-   strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
-}
-
-void fastboot_okay(const char *reason, char *response)
-{
-   strncpy(response, "OKAY\0", 5);
-   strncat(response, reason, FASTBOOT_RESPONSE_LEN - 4 - 1);
-}
-
 static void fastboot_complete(struct usb_ep *ep, struct usb_request *req)
 {
int status = req->status;
diff --git a/include/fastboot.h b/include/fastboot.h
index ed52dae..6cd44d2 100644
--- a/include/fastboot.h
+++ b/include/fastboot.h
@@ -15,7 +15,31 @@
 /* The 64 defined bytes plus \0 */
 #define FASTBOOT_RESPONSE_LEN  (64 + 1)
 
+/**
+ * fastboot_response() - Writes a response of the form "$tag$reason".
+ *
+ * @tag: The first part of the response
+ * @response: Pointer to fastboot response buffer
+ * @format: printf style format string
+ */
+void 

[U-Boot] [PATCH v5 02/16] fastboot: Refactor fastboot_okay/fail to take response

2018-05-17 Thread Alex Kiernan
Add the response string as a parameter to fastboot_okay/fail, instead
of modifying a global, to match the contract expected by the AOSP
U-Boot code.

Signed-off-by: Alex Kiernan 
Reviewed-by: Joe Hershberger 
---

Changes in v5: None
Changes in v4: None
Changes in v3:
- refactor for changes in master

Changes in v2: None

 cmd/mmc.c   |  2 +-
 common/image-sparse.c   | 32 +---
 drivers/fastboot/fb_mmc.c   | 83 +++--
 drivers/fastboot/fb_nand.c  | 34 +
 drivers/usb/gadget/f_fastboot.c | 35 +++--
 include/fastboot.h  |  4 +-
 include/fb_mmc.h|  4 +-
 include/fb_nand.h   |  4 +-
 include/image-sparse.h  |  4 +-
 9 files changed, 105 insertions(+), 97 deletions(-)

diff --git a/cmd/mmc.c b/cmd/mmc.c
index 68bbf1f..cc44525 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -367,7 +367,7 @@ static int do_mmc_sparse_write(cmd_tbl_t *cmdtp, int flag,
sparse.mssg = NULL;
sprintf(dest, "0x" LBAF, sparse.start * sparse.blksz);
 
-   if (write_sparse_image(, dest, addr))
+   if (write_sparse_image(, dest, addr, NULL))
return CMD_RET_FAILURE;
else
return CMD_RET_SUCCESS;
diff --git a/common/image-sparse.c b/common/image-sparse.c
index 9223b9a..1ae7a4d 100644
--- a/common/image-sparse.c
+++ b/common/image-sparse.c
@@ -48,10 +48,10 @@
 #define CONFIG_FASTBOOT_FLASH_FILLBUF_SIZE (1024 * 512)
 #endif
 
-static void default_log(const char *ignored) {}
+static void default_log(const char *ignored, char *response) {}
 
 int write_sparse_image(struct sparse_storage *info,
-  const char *part_name, void *data)
+  const char *part_name, void *data, char *response)
 {
lbaint_t blk;
lbaint_t blkcnt;
@@ -104,7 +104,7 @@ int write_sparse_image(struct sparse_storage *info,
if (offset) {
printf("%s: Sparse image block size issue [%u]\n",
   __func__, sparse_header->blk_sz);
-   info->mssg("sparse image block size issue");
+   info->mssg("sparse image block size issue", response);
return -1;
}
 
@@ -139,7 +139,8 @@ int write_sparse_image(struct sparse_storage *info,
case CHUNK_TYPE_RAW:
if (chunk_header->total_sz !=
(sparse_header->chunk_hdr_sz + chunk_data_sz)) {
-   info->mssg("Bogus chunk size for chunk type 
Raw");
+   info->mssg("Bogus chunk size for chunk type 
Raw",
+  response);
return -1;
}
 
@@ -147,7 +148,8 @@ int write_sparse_image(struct sparse_storage *info,
printf(
"%s: Request would exceed partition 
size!\n",
__func__);
-   info->mssg("Request would exceed partition 
size!");
+   info->mssg("Request would exceed partition 
size!",
+  response);
return -1;
}
 
@@ -157,7 +159,7 @@ int write_sparse_image(struct sparse_storage *info,
printf("%s: %s" LBAFU " [" LBAFU "]\n",
   __func__, "Write failed, block #",
   blk, blks);
-   info->mssg("flash write failure");
+   info->mssg("flash write failure", response);
return -1;
}
blk += blks;
@@ -169,7 +171,7 @@ int write_sparse_image(struct sparse_storage *info,
case CHUNK_TYPE_FILL:
if (chunk_header->total_sz !=
(sparse_header->chunk_hdr_sz + sizeof(uint32_t))) {
-   info->mssg("Bogus chunk size for chunk type 
FILL");
+   info->mssg("Bogus chunk size for chunk type 
FILL", response);
return -1;
}
 
@@ -179,7 +181,8 @@ int write_sparse_image(struct sparse_storage *info,
info->blksz * fill_buf_num_blks,
ARCH_DMA_MINALIGN));
if (!fill_buf) {
-   info->mssg("Malloc failed for: 
CHUNK_TYPE_FILL");
+   info->mssg("Malloc failed for: CHUNK_TYPE_FILL",
+  response);
return -1;
}
 
@@ -196,7 +199,8 @@ int write_sparse_image(struct 

[U-Boot] [BUG] qemu-x86_64_defconfig fails with panic("TSC frequency is ZERO");

2018-05-17 Thread Heinrich Schuchardt
Hello Bin, Simon,

sometimes qemu-x86_64_defconfig fails with panic("TSC frequency is
ZERO") in drivers/timer/tsc_timer.c.

The system may hang in an endless reboot loop with this error or recover
after reboot.

Do we need to panic? Or could we use some default value?

Qemu version used for testing: 2.8.1.

Best regards

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


[U-Boot] [PULL] Please pull u-boot-imx

2018-05-17 Thread Stefano Babic
Hi Tom,

please pull from u-boot-imx, thanks !

The following changes since commit f2d0f5e7ab3b8a7b4bf6e2ac499b4867c701d52d:

  ARM: re-enable MVGBE for edminiv2 (2018-05-16 11:38:08 -0400)

are available in the git repository at:

  git://www.denx.de/git/u-boot-imx.git master

for you to fetch changes up to 2f5988533d5c447d7bda79b0d9719f84db9e1835:

  imx6: sabrelite: update defconfig to use distro defaults (2018-05-17
17:47:17 +0200)


Guillaume GARDET (2):
  imx6: Convert sabrelite and nitrogen6x boards to distro boot support
  imx6: sabrelite: update defconfig to use distro defaults

Ian Ray (6):
  board: ge: bx50v3: add winbond SPI NOR support
  board: ge: bx50v3: rename detect_baseboard function
  board: ge: bx50v3: fix display support for b{46}50v3
  board: ge: bx50v3: use VPD instead of compile-time checks
  board: ge: bx50v3: configure video arguments using VPD
  board: ge: bx50v3: remove redundant targets

Lukasz Majewski (8):
  dts: imx53: Add gpio and i2c nodes to imx53.dtsi file
  dts: pinctrl: Provide IMX_PAD_SION definition for imx53 pinctrl
  pmic: fsl: Provide some more definitions for MC34708 PMIC
  pmic: fsl: Define number of bytes sent at once by MC34708 PMIC
  pmic: dm: Provide *trans_len() callback for pmic-uclass
  pmic: dm: Rewrite pmic_reg_{read|write} and pmic_clrsetbits to
support transmissions larger than 1 byte
  pmic: dm: Add support for MC34708 for PMIC DM
  arm: imx53: Add support for imx53 boards from K+P

Magnus Lilja (2):
  mx31pdk: Convert CONFIG_MX31 flag to use Kconfig.
  mx31: Convert MX31_HCLK_FREQ and MX31_CLK32 to Kconfig.

Nandor Han (2):
  board: ge: bx50v3: unify two switch statements
  board: ge: bx50v3: detect the monitor type by reading VPD earlier

Peter Robinson (4):
  mx6 common: remove dangling comment
  mx7: remove empty ifndef statement
  mx6: Select CONFIG_MP with MX6_SMP
  mx6: remove duplicated BOUNCE_BUFFER defines

Sebastian Reichel (1):
  ge: ppd: move CONFIG_ENV_IS_IN_MMC to defconfig

 arch/arm/Kconfig |  14 +++
 arch/arm/dts/imx53-kp.dts| 135

 arch/arm/dts/imx53-pinfunc.h |   1 +
 arch/arm/dts/imx53.dtsi  | 101
+++-
 arch/arm/include/asm/arch-mx31/clock.h   |   8 
 arch/arm/mach-imx/mx3/Kconfig|  34
+
 arch/arm/mach-imx/mx5/Kconfig|  12 ++
 arch/arm/mach-imx/mx6/Kconfig|  15 ++--
 board/ge/bx50v3/Kconfig  |   2 +-
 board/ge/bx50v3/bx50v3.c |  71
++
 board/k+p/kp_imx53/Kconfig   |  15 
 board/k+p/kp_imx53/MAINTAINERS   |   6 +++
 board/k+p/kp_imx53/Makefile  |   8 
 board/k+p/kp_imx53/kp_id_rev.c   | 121
++
 board/k+p/kp_imx53/kp_id_rev.h   |  28 ++
 board/k+p/kp_imx53/kp_imx53.c| 212
+
 configs/ge_b650v3_defconfig  |  43
-
 configs/ge_b850v3_defconfig  |  43
-
 configs/{ge_b450v3_defconfig => ge_bx50v3_defconfig} |   4 +-
 configs/kp_imx53_defconfig   |  40
+++
 configs/mx31pdk_defconfig|   3 +-
 configs/mx53ppd_defconfig|   1 +
 configs/mx6qsabrelite_defconfig  |  15 +++-
 drivers/power/pmic/Kconfig   |   7 
 drivers/power/pmic/Makefile  |   1 +
 drivers/power/pmic/mc34708.c | 103
+
 drivers/power/pmic/pmic-uclass.c |  48
+--
 include/configs/advantech_dms-ba16.h |   1 -
 include/configs/apalis_imx6.h|   1 -
 include/configs/colibri_imx6.h   |   1 -
 include/configs/dh_imx6.h|   1 -
 include/configs/ge_bx50v3.h  |  17 +
 include/configs/kp_imx53.h   | 113
++
 include/configs/kp_imx6q_tpc.h   |   2 -
 include/configs/mx31pdk.h|   2 -
 include/configs/mx53ppd.h|   1 -
 include/configs/mx6_common.h |   

Re: [U-Boot] [PATCH V6 0/2] Update sabrelite and nitrogen6x boards to use distro boot support

2018-05-17 Thread Stefano Babic
On 17/05/2018 17:45, Troy Kisky wrote:
> On 5/17/2018 2:51 AM, Stefano Babic wrote:
>> Hi Guillaume,
>>
>> On 18/04/2018 17:04, Guillaume GARDET wrote:
>>> This patch serie updates sabrelite and nitrogen6x boards to use distro boot 
>>> support.
>>> Sabrelite has been boot tested with boot.scr script and EFI/Grub2 on mmc0 
>>> and mmc1 slots.
>>> Nitrogen6* boards have been build tested only.
>>>
>>> Currently, only the Sabrelite has fdtfile defined.
>>>
>>
>> Fine, but Troy is the maintainer for this board and I have not yet seen
>> if he agrees to switch the board to the distro environment. I would like
>> to have his ACK before pushing this.
>>
>> Best regards,
>> Stefano Babic
> 
> Sorry, for the delay

No worry.
> 
> Acked-by: Troy Kisky 
> 

I apply the patches to u-boot-imx, thanks !

Best regards,
Stefano


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


Re: [U-Boot] [PATCH V6 0/2] Update sabrelite and nitrogen6x boards to use distro boot support

2018-05-17 Thread Troy Kisky
On 5/17/2018 2:51 AM, Stefano Babic wrote:
> Hi Guillaume,
> 
> On 18/04/2018 17:04, Guillaume GARDET wrote:
>> This patch serie updates sabrelite and nitrogen6x boards to use distro boot 
>> support.
>> Sabrelite has been boot tested with boot.scr script and EFI/Grub2 on mmc0 
>> and mmc1 slots.
>> Nitrogen6* boards have been build tested only.
>>
>> Currently, only the Sabrelite has fdtfile defined.
>>
> 
> Fine, but Troy is the maintainer for this board and I have not yet seen
> if he agrees to switch the board to the distro environment. I would like
> to have his ACK before pushing this.
> 
> Best regards,
> Stefano Babic

Sorry, for the delay

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


[U-Boot] Please pull u-boot-marvell/master (v2)

2018-05-17 Thread Stefan Roese
Hi Tom,

please pull the Kirkwood DT patches from Chris. This time with
PHYLIB disabled for some boards (as was before).

Thanks,
Stefan


The following changes since commit f2d0f5e7ab3b8a7b4bf6e2ac499b4867c701d52d:

  ARM: re-enable MVGBE for edminiv2 (2018-05-16 11:38:08 -0400)

are available in the Git repository at:

  git://www.denx.de/git/u-boot-marvell.git 

for you to fetch changes up to f6e62ee04c37bb8d1726848c7fa9bcafb270e0f6:

  net: MVGBE don't automatically select PHYLIB (2018-05-17 17:38:31 +0200)


Chris Packham (12):
  ARM: add devicetree files for kirkwood SoC
  ARM: kirkwood: Add device-tree for dns325
  ARM: kirkwood: Add device-tree for dockstar
  ARM: kirkwood: Add device-tree for goflexhome
  ARM: kirkwood: Add device-tree for guruplug
  ARM: kirkwood: Add device-tree for ib62x0
  ARM: kirkwood: Add device-tree for iconnect
  ARM: kirkwood: Add device-tree for nas220
  ARM: kirkwood: Add device-tree for openrd
  ARM: kirkwood: Add device-tree for pogo_e02
  ARM: kirkwood: Add device-tree for sheevaplug
  net: MVGBE don't automatically select PHYLIB

 arch/arm/dts/kirkwood-6192.dtsi|  88 ++
 arch/arm/dts/kirkwood-6281.dtsi|  90 ++
 arch/arm/dts/kirkwood-98dx4122.dtsi|  53 
 arch/arm/dts/kirkwood-blackarmor-nas220.dts| 172 +++
 arch/arm/dts/kirkwood-dns325.dts   |  63 
 arch/arm/dts/kirkwood-dnskw.dtsi   | 235 +++
 arch/arm/dts/kirkwood-dockstar.dts | 110 +++
 arch/arm/dts/kirkwood-goflexnet.dts| 190 
 arch/arm/dts/kirkwood-guruplug-server-plus.dts | 133 +
 arch/arm/dts/kirkwood-ib62x0.dts   | 146 +
 arch/arm/dts/kirkwood-iconnect.dts | 195 
 arch/arm/dts/kirkwood-openrd-base.dts  |  39 +++
 arch/arm/dts/kirkwood-openrd-client.dts|  73 +
 arch/arm/dts/kirkwood-openrd-ultimate.dts  |  55 
 arch/arm/dts/kirkwood-openrd.dtsi  | 122 
 arch/arm/dts/kirkwood-pogo_e02.dts | 132 +
 arch/arm/dts/kirkwood-sheevaplug-common.dtsi   | 104 +++
 arch/arm/dts/kirkwood-sheevaplug.dts   |  42 +++
 arch/arm/dts/kirkwood.dtsi | 393 +
 configs/dns325_defconfig   |   3 +-
 configs/dockstar_defconfig |   3 +-
 configs/goflexhome_defconfig   |   3 +-
 configs/guruplug_defconfig |   3 +-
 configs/ib62x0_defconfig   |   3 +-
 configs/iconnect_defconfig |   3 +-
 configs/nas220_defconfig   |   3 +-
 configs/openrd_base_defconfig  |   3 +-
 configs/openrd_client_defconfig|   3 +-
 configs/openrd_ultimate_defconfig  |   3 +-
 configs/pogo_e02_defconfig |   3 +-
 configs/sheevaplug_defconfig   |   3 +-
 drivers/net/Kconfig|   1 -
 32 files changed, 2459 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/dts/kirkwood-6192.dtsi
 create mode 100644 arch/arm/dts/kirkwood-6281.dtsi
 create mode 100644 arch/arm/dts/kirkwood-98dx4122.dtsi
 create mode 100644 arch/arm/dts/kirkwood-blackarmor-nas220.dts
 create mode 100644 arch/arm/dts/kirkwood-dns325.dts
 create mode 100644 arch/arm/dts/kirkwood-dnskw.dtsi
 create mode 100644 arch/arm/dts/kirkwood-dockstar.dts
 create mode 100644 arch/arm/dts/kirkwood-goflexnet.dts
 create mode 100644 arch/arm/dts/kirkwood-guruplug-server-plus.dts
 create mode 100644 arch/arm/dts/kirkwood-ib62x0.dts
 create mode 100644 arch/arm/dts/kirkwood-iconnect.dts
 create mode 100644 arch/arm/dts/kirkwood-openrd-base.dts
 create mode 100644 arch/arm/dts/kirkwood-openrd-client.dts
 create mode 100644 arch/arm/dts/kirkwood-openrd-ultimate.dts
 create mode 100644 arch/arm/dts/kirkwood-openrd.dtsi
 create mode 100644 arch/arm/dts/kirkwood-pogo_e02.dts
 create mode 100644 arch/arm/dts/kirkwood-sheevaplug-common.dtsi
 create mode 100644 arch/arm/dts/kirkwood-sheevaplug.dts
 create mode 100644 arch/arm/dts/kirkwood.dtsi
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Stefan Roese

On 17.05.2018 17:30, Joe Hershberger wrote:

On Thu, May 17, 2018 at 7:12 AM, Chris Packham  wrote:

When Kconfig support was added for MVGBE it included automatically
selected PHYLIB support. But MVGBE does not need PHYLIB it will build
fine without it. Commit ed52ea507f12 ("net: add Kconfig for MVGBE")
should have been a no-op in terms of build size but because of the
selecting PHYLIB the openrd configs increased in size.

Remove the automatic selection of PHYLIB, boards that need it will have
already enabled it in their config header file.

Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
Signed-off-by: Chris Packham 


Acked-by: Joe Hershberger 

Stefan, feel free to pull this through your branch.


Thanks, will do.

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


Re: [U-Boot] [PATCH v2] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Joe Hershberger
On Thu, May 17, 2018 at 7:12 AM, Chris Packham  wrote:
> When Kconfig support was added for MVGBE it included automatically
> selected PHYLIB support. But MVGBE does not need PHYLIB it will build
> fine without it. Commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> should have been a no-op in terms of build size but because of the
> selecting PHYLIB the openrd configs increased in size.
>
> Remove the automatic selection of PHYLIB, boards that need it will have
> already enabled it in their config header file.
>
> Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> Signed-off-by: Chris Packham 

Acked-by: Joe Hershberger 

Stefan, feel free to pull this through your branch.

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


[U-Boot] [PATCH] mmc: stm32_sdmmc2: Fix stm32_sdmmc2_start_cmd()

2018-05-17 Thread Patrice Chotard
SDMMC_CMD_CPSMEN bit is wrongly check and set in
SDMMC_ARG register instead of SDMMC_CMD register.

Signed-off-by: Patrice Chotard 
---

 drivers/mmc/stm32_sdmmc2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c
index a0224ca3909c..ae0af48ef330 100644
--- a/drivers/mmc/stm32_sdmmc2.c
+++ b/drivers/mmc/stm32_sdmmc2.c
@@ -238,8 +238,8 @@ static void stm32_sdmmc2_start_data(struct 
stm32_sdmmc2_priv *priv,
 static void stm32_sdmmc2_start_cmd(struct stm32_sdmmc2_priv *priv,
   struct mmc_cmd *cmd, u32 cmd_param)
 {
-   if (readl(priv->base + SDMMC_ARG) & SDMMC_CMD_CPSMEN)
-   writel(0, priv->base + SDMMC_ARG);
+   if (readl(priv->base + SDMMC_CMD) & SDMMC_CMD_CPSMEN)
+   writel(0, priv->base + SDMMC_CMD);
 
cmd_param |= cmd->cmdidx | SDMMC_CMD_CPSMEN;
if (cmd->resp_type & MMC_RSP_PRESENT) {
-- 
1.9.1

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


Re: [U-Boot] RFC: Alternative boot_jump_linux() function

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 02:01:55PM +0300, Ramon Fried wrote:

> Hi.
> I'm currently working on snapdragon bootloader support and in the
> particular case where U-boot is running in Aarch32 and the kernel is
> Aarch64 the specific implementation is to jump to Linux through SCM
> call.
> 
> I try to find the best possible way to provide an alternative boot function.
> Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
> arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
> a callback function in gd. that if exists will jump there instead of
> executing boot_jump_linux().
> 
> What do you think ?

So, to be clear, we're on an aarch64 SoC, but U-Boot has been entered in
32bit mode.  And we need to boot a 64bit Linux Kernel.  What else, if
anything, is also loaded/still in residence/etc?  Can you explain the
overall usecase a bit more and why we're in 32bit mode?  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] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Tom Rini
On Fri, May 18, 2018 at 12:12:04AM +1200, Chris Packham wrote:

> When Kconfig support was added for MVGBE it included automatically
> selected PHYLIB support. But MVGBE does not need PHYLIB it will build
> fine without it. Commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> should have been a no-op in terms of build size but because of the
> selecting PHYLIB the openrd configs increased in size.
> 
> Remove the automatic selection of PHYLIB, boards that need it will have
> already enabled it in their config header file.
> 
> Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> Signed-off-by: Chris Packham 

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] arm64: zynqmp: Show reset reason

2018-05-17 Thread Michal Simek
On 17.5.2018 15:31, Michal Simek wrote:
> Read reset reason reg and show it in log and also save it as variable.
> reset_reasons table is setting up priorities for variable.
> 
> Signed-off-by: Michal Simek 
> ---
> 
>  arch/arm/include/asm/arch-zynqmp/hardware.h | 12 +-
>  board/xilinx/zynqmp/zynqmp.c| 43 +
>  2 files changed, 54 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/arch-zynqmp/hardware.h 
> b/arch/arm/include/asm/arch-zynqmp/hardware.h
> index 3f1f9498e356..7961a247e196 100644
> --- a/arch/arm/include/asm/arch-zynqmp/hardware.h
> +++ b/arch/arm/include/asm/arch-zynqmp/hardware.h
> @@ -33,6 +33,14 @@
>  #define PS_MODE2 BIT(2)
>  #define PS_MODE3 BIT(3)
>  
> +#define RESET_REASON_DEBUG_SYS   BIT(6)
> +#define RESET_REASON_SOFTBIT(5)
> +#define RESET_REASON_SRSTBIT(4)
> +#define RESET_REASON_PSONLY  BIT(3)
> +#define RESET_REASON_PMU BIT(2)
> +#define RESET_REASON_INTERNALBIT(1)
> +#define RESET_REASON_EXTERNALBIT(0)
> +
>  struct crlapb_regs {
>   u32 reserved0[36];
>   u32 cpu_r5_ctrl; /* 0x90 */
> @@ -40,7 +48,9 @@ struct crlapb_regs {
>   u32 timestamp_ref_ctrl; /* 0x128 */
>   u32 reserved2[53];
>   u32 boot_mode; /* 0x200 */
> - u32 reserved3[14];
> + u32 reserved3_0[7];
> + u32 reset_reason; /* 0x220 */
> + u32 reserved3_1[6];
>   u32 rst_lpd_top; /* 0x23C */
>   u32 reserved4[4];
>   u32 boot_pin_ctrl; /* 0x250 */
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 551921b888a0..4d886a914fa9 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -476,6 +476,47 @@ static int create_mmc_boot_commands(void)
>   return 0;
>  }
>  
> +static const struct {
> + u32 bit;
> + const char *name;
> +} reset_reasons[] = {
> + { RESET_REASON_EXTERNAL, "EXTERNAL" },
> + { RESET_REASON_INTERNAL, "INTERNAL" },
> + { RESET_REASON_SOFT, "SOFT" },
> + { RESET_REASON_PSONLY, "PS-ONLY" },
> + { RESET_REASON_SRST, "SRST" },
> + { RESET_REASON_PMU, "PMU" },
> + { RESET_REASON_DEBUG_SYS, "DEBUG" },
> + {}
> +};
> +
> +static u32 reset_reason(bool print)
> +{
> + u32 ret;
> + int i;
> + const char *reason = NULL;
> +
> + ret = readl(_base->reset_reason);
> +
> + if (print)
> + puts("Reset reason:\t");
> +
> + for (i = 0; i < ARRAY_SIZE(reset_reasons); i++) {
> + if (ret & reset_reasons[i].bit) {
> + reason = reset_reasons[i].name;
> + if (print)
> + printf("%s ", reset_reasons[i].name);
> + }
> + }
> +
> + if (print)
> + puts("\n");
> +
> + env_set("reset_reason", reason);

Here should be this line to clear status after read.
 writel(~0, _base->reset_reason);


Will add it to v2 when this concept is approved.

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


Re: [U-Boot] [PATCH] soc: zynqmp: Update required API version to 1.0

2018-05-17 Thread Marek Vasut
On 05/17/2018 03:59 PM, Michal Simek wrote:
> On 14.5.2018 22:55, Marek Vasut wrote:
>> On 05/14/2018 03:39 PM, Michal Simek wrote:
>>> From: Rajan Vaja 
>>>
>>> Existing EEMI version is to as 1.0 (available from xilinx v2018.1
>>> version). Update required API version to match with EEMI API version.
>>
>> Not sure I understand this sentence.
> 
> PMUFW contains EEMI api which has also changed and the biggest reason
> for bumping up PMUFW version were changes in EEMI api. And these
> versions are also aligned.

So uh, the meta-xilinx 2018.1 release which contains pmufw 2017.3 uses
the new API 1.0 , while meta-xilinx 2018.1 release which contains pmufw
2017.3 as well does not use the API 1.0 ? I think the versioning is a
complete CF then ...

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


Re: [U-Boot] [PATCH] soc: zynqmp: Update required API version to 1.0

2018-05-17 Thread Michal Simek
On 14.5.2018 22:55, Marek Vasut wrote:
> On 05/14/2018 03:39 PM, Michal Simek wrote:
>> From: Rajan Vaja 
>>
>> Existing EEMI version is to as 1.0 (available from xilinx v2018.1
>> version). Update required API version to match with EEMI API version.
> 
> Not sure I understand this sentence.

PMUFW contains EEMI api which has also changed and the biggest reason
for bumping up PMUFW version were changes in EEMI api. And these
versions are also aligned.

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


[U-Boot] [PATCH] arm64: zynqmp: Show reset reason

2018-05-17 Thread Michal Simek
Read reset reason reg and show it in log and also save it as variable.
reset_reasons table is setting up priorities for variable.

Signed-off-by: Michal Simek 
---

 arch/arm/include/asm/arch-zynqmp/hardware.h | 12 +-
 board/xilinx/zynqmp/zynqmp.c| 43 +
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-zynqmp/hardware.h 
b/arch/arm/include/asm/arch-zynqmp/hardware.h
index 3f1f9498e356..7961a247e196 100644
--- a/arch/arm/include/asm/arch-zynqmp/hardware.h
+++ b/arch/arm/include/asm/arch-zynqmp/hardware.h
@@ -33,6 +33,14 @@
 #define PS_MODE2   BIT(2)
 #define PS_MODE3   BIT(3)
 
+#define RESET_REASON_DEBUG_SYS BIT(6)
+#define RESET_REASON_SOFT  BIT(5)
+#define RESET_REASON_SRST  BIT(4)
+#define RESET_REASON_PSONLYBIT(3)
+#define RESET_REASON_PMU   BIT(2)
+#define RESET_REASON_INTERNAL  BIT(1)
+#define RESET_REASON_EXTERNAL  BIT(0)
+
 struct crlapb_regs {
u32 reserved0[36];
u32 cpu_r5_ctrl; /* 0x90 */
@@ -40,7 +48,9 @@ struct crlapb_regs {
u32 timestamp_ref_ctrl; /* 0x128 */
u32 reserved2[53];
u32 boot_mode; /* 0x200 */
-   u32 reserved3[14];
+   u32 reserved3_0[7];
+   u32 reset_reason; /* 0x220 */
+   u32 reserved3_1[6];
u32 rst_lpd_top; /* 0x23C */
u32 reserved4[4];
u32 boot_pin_ctrl; /* 0x250 */
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 551921b888a0..4d886a914fa9 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -476,6 +476,47 @@ static int create_mmc_boot_commands(void)
return 0;
 }
 
+static const struct {
+   u32 bit;
+   const char *name;
+} reset_reasons[] = {
+   { RESET_REASON_EXTERNAL, "EXTERNAL" },
+   { RESET_REASON_INTERNAL, "INTERNAL" },
+   { RESET_REASON_SOFT, "SOFT" },
+   { RESET_REASON_PSONLY, "PS-ONLY" },
+   { RESET_REASON_SRST, "SRST" },
+   { RESET_REASON_PMU, "PMU" },
+   { RESET_REASON_DEBUG_SYS, "DEBUG" },
+   {}
+};
+
+static u32 reset_reason(bool print)
+{
+   u32 ret;
+   int i;
+   const char *reason = NULL;
+
+   ret = readl(_base->reset_reason);
+
+   if (print)
+   puts("Reset reason:\t");
+
+   for (i = 0; i < ARRAY_SIZE(reset_reasons); i++) {
+   if (ret & reset_reasons[i].bit) {
+   reason = reset_reasons[i].name;
+   if (print)
+   printf("%s ", reset_reasons[i].name);
+   }
+   }
+
+   if (print)
+   puts("\n");
+
+   env_set("reset_reason", reason);
+
+   return ret;
+}
+
 int board_late_init(void)
 {
u32 reg = 0;
@@ -593,6 +634,8 @@ int board_late_init(void)
 
env_set("boot_targets", new_targets);
 
+   reset_reason(true);
+
return 0;
 }
 
-- 
2.17.0

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


[U-Boot] [PATCH v1 4/4] stm32mp1: use OTP to configure MAC address and serial number

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Use OTP57 and 58 for MAC address
- OTP57 = MAC address  bits [31:0]
- OTP58 = MAC address  bit  [47:32] stored in OTP  LSB's

Use manufacture information in OTP13 to OTP15 to build unique
chip id saved in env variable "serial#"
(used for USB device enumeration)

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 arch/arm/mach-stm32mp/cpu.c | 81 +
 1 file changed, 81 insertions(+)

diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index 2deee0961822..0e01f8e61385 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -5,9 +5,12 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* RCC register */
@@ -51,6 +54,10 @@
 #define BOOTROM_INSTANCE_MASK   GENMASK(31, 16)
 #define BOOTROM_INSTANCE_SHIFT 16
 
+/* BSEC OTP index */
+#define BSEC_OTP_SERIAL13
+#define BSEC_OTP_MAC   57
+
 #if !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD)
 static void security_init(void)
 {
@@ -274,9 +281,83 @@ static void setup_boot_mode(void)
}
 }
 
+/*
+ * If there is no MAC address in the environment, then it will be initialized
+ * (silently) from the value in the OTP.
+ */
+static int setup_mac_address(void)
+{
+#if defined(CONFIG_NET)
+   int ret;
+   int i;
+   u32 otp[2];
+   uchar enetaddr[6];
+   struct udevice *dev;
+
+   /* MAC already in environment */
+   if (eth_env_get_enetaddr("ethaddr", enetaddr))
+   return 0;
+
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stm32mp_bsec),
+ );
+   if (ret)
+   return ret;
+
+   ret = misc_read(dev, BSEC_OTP_MAC * 4 + STM32_BSEC_OTP_OFFSET,
+   otp, sizeof(otp));
+   if (ret)
+   return ret;
+
+   for (i = 0; i < 6; i++)
+   enetaddr[i] = ((uint8_t *))[i];
+
+   if (!is_valid_ethaddr(enetaddr)) {
+   pr_err("invalid MAC address in OTP %pM", enetaddr);
+   return -EINVAL;
+   }
+   pr_debug("OTP MAC address = %pM\n", enetaddr);
+   ret = !eth_env_set_enetaddr("ethaddr", enetaddr);
+   if (!ret)
+   pr_err("Failed to set mac address %pM from OTP: %d\n",
+  enetaddr, ret);
+#endif
+
+   return 0;
+}
+
+static int setup_serial_number(void)
+{
+   char serial_string[25];
+   u32 otp[3] = {0, 0, 0 };
+   struct udevice *dev;
+   int ret;
+
+   if (env_get("serial#"))
+   return 0;
+
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stm32mp_bsec),
+ );
+   if (ret)
+   return ret;
+
+   ret = misc_read(dev, BSEC_OTP_SERIAL * 4 + STM32_BSEC_OTP_OFFSET,
+   otp, sizeof(otp));
+   if (ret)
+   return ret;
+
+   sprintf(serial_string, "%08x%08x%08x", otp[0], otp[1], otp[2]);
+   env_set("serial#", serial_string);
+
+   return 0;
+}
+
 int arch_misc_init(void)
 {
setup_boot_mode();
+   setup_mac_address();
+   setup_serial_number();
 
return 0;
 }
-- 
1.9.1

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


[U-Boot] [PATCH v1 3/4] stm32mp1: add FUSE command support

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add support of fuse command (read/write/program/sense)
on bank 0 to access to BSEC SAFMEM (4096 OTP bits).

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 MAINTAINERS   |   1 +
 arch/arm/Kconfig  |   1 +
 configs/stm32mp15_basic_defconfig |   1 +
 drivers/misc/Kconfig  |   9 +++
 drivers/misc/Makefile |   1 +
 drivers/misc/stm32mp_fuse.c   | 116 ++
 6 files changed, 129 insertions(+)
 create mode 100644 drivers/misc/stm32mp_fuse.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 5670917b41b9..3209dcd31844 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -204,6 +204,7 @@ M:  Patrick Delaunay 
 S: Maintained
 F: arch/arm/mach-stm32mp
 F: drivers/clk/clk_stm32mp1.c
+F: drivers/misc/stm32mp_fuse.c
 F: drivers/ram/stm32mp1/
 
 ARM STM STV0991
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c9d6e0a42418..5bd6749309b7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1214,6 +1214,7 @@ config ARCH_STM32MP
select DM_SERIAL
select OF_CONTROL
select OF_LIBFDT
+   select MISC
select PINCTRL
select REGMAP
select SUPPORT_SPL
diff --git a/configs/stm32mp15_basic_defconfig 
b/configs/stm32mp15_basic_defconfig
index b1c3690c0094..9e43cc969850 100644
--- a/configs/stm32mp15_basic_defconfig
+++ b/configs/stm32mp15_basic_defconfig
@@ -18,6 +18,7 @@ CONFIG_SYS_PROMPT="STM32MP> "
 # CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_IMPORTENV is not set
 CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_FUSE=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index be900cf4d6ec..17b3a805a2d5 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -158,6 +158,15 @@ config PCA9551_I2C_ADDR
help
  The I2C address of the PCA9551 LED controller.
 
+config STM32MP_FUSE
+   bool "Enable STM32MP fuse wrapper providing the fuse API"
+   depends on ARCH_STM32MP && MISC
+   default y if CMD_FUSE
+   help
+ If you say Y here, you will get support for the fuse API (OTP)
+ for STM32MP architecture.
+ This API is needed for CMD_FUSE.
+
 config STM32_RCC
bool "Enable RCC driver for the STM32 SoC's family"
depends on STM32 && MISC
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index e362609d62a4..4ce9d213f06f 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -51,5 +51,6 @@ obj-$(CONFIG_WINBOND_W83627) += winbond_w83627.o
 obj-$(CONFIG_QFW) += qfw.o
 obj-$(CONFIG_ROCKCHIP_EFUSE) += rockchip-efuse.o
 obj-$(CONFIG_STM32_RCC) += stm32_rcc.o
+obj-$(CONFIG_STM32MP_FUSE) += stm32mp_fuse.o
 obj-$(CONFIG_SYS_DPAA_QBMAN) += fsl_portals.o
 obj-$(CONFIG_GDSYS_RXAUI_CTRL) += gdsys_rxaui_ctrl.o
diff --git a/drivers/misc/stm32mp_fuse.c b/drivers/misc/stm32mp_fuse.c
new file mode 100644
index ..2d661351a17c
--- /dev/null
+++ b/drivers/misc/stm32mp_fuse.c
@@ -0,0 +1,116 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define STM32MP_OTP_BANK   0
+
+/*
+ * The 'fuse' command API
+ */
+int fuse_read(u32 bank, u32 word, u32 *val)
+{
+   int ret = 0;
+   struct udevice *dev;
+
+   switch (bank) {
+   case STM32MP_OTP_BANK:
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stm32mp_bsec),
+ );
+   if (ret)
+   return ret;
+   ret = misc_read(dev, word * 4 + STM32_BSEC_SHADOW_OFFSET,
+   val, 4);
+   break;
+
+   default:
+   printf("stm32mp %s: wrong value for bank %i\n", __func__, bank);
+   ret = -EINVAL;
+   break;
+   }
+
+   return ret;
+}
+
+int fuse_prog(u32 bank, u32 word, u32 val)
+{
+   struct udevice *dev;
+   int ret;
+
+   switch (bank) {
+   case STM32MP_OTP_BANK:
+   ret = uclass_get_device_by_driver(UCLASS_MISC,
+ DM_GET_DRIVER(stm32mp_bsec),
+ );
+   if (ret)
+   return ret;
+   ret = misc_write(dev, word * 4 + STM32_BSEC_OTP_OFFSET,
+, 4);
+   break;
+
+   default:
+   printf("stm32mp %s: wrong value for bank %i\n", __func__, bank);
+   ret = -EINVAL;
+   break;
+   }
+
+   return ret;
+}
+
+int fuse_sense(u32 bank, u32 word, u32 *val)
+{
+   struct udevice *dev;
+   int ret;
+
+   switch (bank) 

[U-Boot] [PATCH v1 2/4] stm32mp1: add bsec driver

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add a MISC driver with read and write access to BSEC IP
(Boot and Security and OTP control)
- offset 0: shadowed values
- offset 0x8000: OTP fuse box values (SAFMEM)

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 arch/arm/mach-stm32mp/Makefile |   8 +-
 arch/arm/mach-stm32mp/bsec.c   | 431 +
 arch/arm/mach-stm32mp/include/mach/stm32.h |   5 +
 3 files changed, 442 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/bsec.c

diff --git a/arch/arm/mach-stm32mp/Makefile b/arch/arm/mach-stm32mp/Makefile
index 08ee642d9086..f59ced5ee1b1 100644
--- a/arch/arm/mach-stm32mp/Makefile
+++ b/arch/arm/mach-stm32mp/Makefile
@@ -1,4 +1,4 @@
-# SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+# SPDX-License-Identifier: GPL-2.0+
 #
 # Copyright (C) 2018, STMicroelectronics - All Rights Reserved
 #
@@ -7,6 +7,10 @@ obj-y += cpu.o
 obj-y += dram_init.o
 obj-y += syscon.o
 
-obj-$(CONFIG_SPL_BUILD) += spl.o
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+else
+obj-y += bsec.o
+endif
 obj-$(CONFIG_ARMV7_PSCI) += psci.o
 obj-$(CONFIG_$(SPL_)DM_REGULATOR) += pwr_regulator.o
diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c
new file mode 100644
index ..0e152efc045f
--- /dev/null
+++ b/arch/arm/mach-stm32mp/bsec.c
@@ -0,0 +1,431 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BSEC_OTP_MAX_VALUE 95
+
+#define BSEC_TIMEOUT_US1
+
+/* BSEC REGISTER OFFSET (base relative) */
+#define BSEC_OTP_CONF_OFF  0x000
+#define BSEC_OTP_CTRL_OFF  0x004
+#define BSEC_OTP_WRDATA_OFF0x008
+#define BSEC_OTP_STATUS_OFF0x00C
+#define BSEC_OTP_LOCK_OFF  0x010
+#define BSEC_DISTURBED_OFF 0x01C
+#define BSEC_ERROR_OFF 0x034
+#define BSEC_SPLOCK_OFF0x064 /* Program safmem sticky 
lock */
+#define BSEC_SWLOCK_OFF0x07C /* write in OTP sticky 
lock */
+#define BSEC_SRLOCK_OFF0x094 /* shadowing sticky lock 
*/
+#define BSEC_OTP_DATA_OFF  0x200
+
+/* BSEC_CONFIGURATION Register MASK */
+#define BSEC_CONF_POWER_UP 0x001
+
+/* BSEC_CONTROL Register */
+#define BSEC_READ  0x000
+#define BSEC_WRITE 0x100
+
+/* LOCK Register */
+#define OTP_LOCK_MASK  0x1F
+#define OTP_LOCK_BANK_SHIFT0x05
+#define OTP_LOCK_BIT_MASK  0x01
+
+/* STATUS Register */
+#define BSEC_MODE_BUSY_MASK0x08
+#define BSEC_MODE_PROGFAIL_MASK0x10
+#define BSEC_MODE_PWR_MASK 0x20
+
+/*
+ * OTP Lock services definition
+ * Value must corresponding to the bit number in the register
+ */
+#define BSEC_LOCK_PROGRAM  0x04
+
+/**
+ * bsec_check_error() - Check status of one otp
+ * @base: base address of bsec IP
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: 0 if no error, -EAGAIN or -ENOTSUPP
+ */
+static u32 bsec_check_error(u32 base, u32 otp)
+{
+   u32 bit;
+   u32 bank;
+
+   bit = 1 << (otp & OTP_LOCK_MASK);
+   bank = ((otp >> OTP_LOCK_BANK_SHIFT) & OTP_LOCK_MASK) * sizeof(u32);
+
+   if (readl(base + BSEC_DISTURBED_OFF + bank) & bit)
+   return -EAGAIN;
+   else if (readl(base + BSEC_ERROR_OFF + bank) & bit)
+   return -ENOTSUPP;
+
+   return 0;
+}
+
+/**
+ * bsec_lock() - manage lock for each type SR/SP/SW
+ * @address: address of bsec IP register
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: true if locked else false
+ */
+static bool bsec_read_lock(u32 address, u32 otp)
+{
+   u32 bit;
+   u32 bank;
+
+   bit = 1 << (otp & OTP_LOCK_MASK);
+   bank = ((otp >> OTP_LOCK_BANK_SHIFT) & OTP_LOCK_MASK) * sizeof(u32);
+
+   return !!(readl(address + bank) & bit);
+}
+
+/**
+ * bsec_read_SR_lock() - read SR lock (Shadowing)
+ * @base: base address of bsec IP
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: true if locked else false
+ */
+static bool bsec_read_SR_lock(u32 base, u32 otp)
+{
+   return bsec_read_lock(base + BSEC_SRLOCK_OFF, otp);
+}
+
+/**
+ * bsec_read_SP_lock() - read SP lock (program Lock)
+ * @base: base address of bsec IP
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: true if locked else false
+ */
+static bool bsec_read_SP_lock(u32 base, u32 otp)
+{
+   return bsec_read_lock(base + BSEC_SPLOCK_OFF, otp);
+}
+
+/**
+ * bsec_SW_lock() - manage SW lock (Write in Shadow)
+ * @base: base address of bsec IP
+ * @otp: otp number (0 - BSEC_OTP_MAX_VALUE)
+ * Return: true if locked else false
+ */
+static bool bsec_read_SW_lock(u32 base, u32 otp)
+{
+   return 

[U-Boot] [PATCH v1 0/4] Update STM32MP1 machine

2018-05-17 Thread Patrice Chotard

This series :
  _ fixes TAMP_BOOT_CONTEXT which is updated twice
  _ adds bsec IP driver (Boot and Security and OTP control)
  _ adds FUSE command support
  _ updates machine to use OTP to store MAC address and serial number


Patrick Delaunay (4):
  stm32mp1: remove the second TAMP_BOOT_CONTEXT update
  stm32mp1: add bsec driver
  stm32mp1: add FUSE command support
  stm32mp1: use OTP to configure MAC address and serial number

 MAINTAINERS|   1 +
 arch/arm/Kconfig   |   1 +
 arch/arm/mach-stm32mp/Makefile |   8 +-
 arch/arm/mach-stm32mp/bsec.c   | 431 +
 arch/arm/mach-stm32mp/cpu.c|  81 ++
 arch/arm/mach-stm32mp/include/mach/stm32.h |   5 +
 arch/arm/mach-stm32mp/spl.c|   3 -
 configs/stm32mp15_basic_defconfig  |   1 +
 drivers/misc/Kconfig   |   9 +
 drivers/misc/Makefile  |   1 +
 drivers/misc/stm32mp_fuse.c| 116 
 11 files changed, 652 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-stm32mp/bsec.c
 create mode 100644 drivers/misc/stm32mp_fuse.c

-- 
1.9.1

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


[U-Boot] [PATCH v1 1/4] stm32mp1: remove the second TAMP_BOOT_CONTEXT update

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

The register TAMP_BOOT_CONTEXT is already updated in
get_bootmode() in cpu.c and no need to be done
twice.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 arch/arm/mach-stm32mp/spl.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c
index b56f0c5381c3..790973e8b6e9 100644
--- a/arch/arm/mach-stm32mp/spl.c
+++ b/arch/arm/mach-stm32mp/spl.c
@@ -14,9 +14,6 @@ u32 spl_boot_device(void)
 
boot_mode = (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_MODE_MASK) >>
TAMP_BOOT_MODE_SHIFT;
-   clrsetbits_le32(TAMP_BOOT_CONTEXT,
-   TAMP_BOOT_MODE_MASK,
-   boot_mode << TAMP_BOOT_MODE_SHIFT);
 
switch (boot_mode) {
case BOOT_FLASH_SD_1:
-- 
1.9.1

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


Re: [U-Boot] RFC: Alternative boot_jump_linux() function

2018-05-17 Thread Ramon Fried
On Thu, May 17, 2018 at 2:48 PM, Peter Robinson  wrote:
> Hi,
>
>> I'm currently working on snapdragon bootloader support and in the
>> particular case where U-boot is running in Aarch32 and the kernel is
>> Aarch64 the specific implementation is to jump to Linux through SCM
>> call.
>
> I seem to remember the Allwinner A64 Pine64 starts in 32 bit mode and
> switches too so you might get some ideas from there or the maintainer
> might have some suggestions.
Hi Peter.
Thanks for the tip.

I looked at the code, it appears that the Pine64 starts in 32bit SPL and jumps
to U-boot in 64bit mode.
This is done in a way which is not compatible with Snapdragons.
Although it's possible to implement Snapdragon with SPL, but I think it's an
overhead and I generally prefer just to run U-boot completely in 32bit mode.

Thanks,
Ramon.

>
>> I try to find the best possible way to provide an alternative boot function.
>> Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
>> arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
>> a callback function in gd. that if exists will jump there instead of
>> executing boot_jump_linux().
>>
>> What do you think ?
>>
>> Waiting for your thoughts on the subject.
>>
>> Warm regards,
>> Ramon.
>> ___
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v1 4/5] serial: stm32: Add setparity support

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add possibility to update the serial parity used.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 drivers/serial/serial_stm32.c | 45 +--
 drivers/serial/serial_stm32.h |  8 
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index eeaa8ab050d9..f26234549c3e 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -47,6 +47,45 @@ static int stm32_serial_setbrg(struct udevice *dev, int 
baudrate)
return 0;
 }
 
+static int stm32_serial_setparity(struct udevice *dev, enum serial_par parity)
+{
+   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+   bool stm32f4 = plat->uart_info->stm32f4;
+   u8 uart_enable_bit = plat->uart_info->uart_enable_bit;
+   u32 cr1 = plat->base + CR1_OFFSET(stm32f4);
+   u32 config = 0;
+
+   if (stm32f4)
+   return -EINVAL; /* not supported in driver*/
+
+   clrbits_le32(cr1, USART_CR1_RE | USART_CR1_TE | BIT(uart_enable_bit));
+   /* update usart configuration (uart need to be disable)
+* PCE: parity check control
+* PS : '0' : Even / '1' : Odd
+* M[1:0] = '00' : 8 Data bits
+* M[1:0] = '01' : 9 Data bits with parity
+*/
+   switch (parity) {
+   default:
+   case SERIAL_PAR_NONE:
+   config = 0;
+   break;
+   case SERIAL_PAR_ODD:
+   config = USART_CR1_PCE | USART_CR1_PS | USART_CR1_M0;
+   break;
+   case SERIAL_PAR_EVEN:
+   config = USART_CR1_PCE | USART_CR1_M0;
+   break;
+   }
+   clrsetbits_le32(cr1,
+   USART_CR1_PCE | USART_CR1_PS | USART_CR1_M1 |
+   USART_CR1_M0,
+   config);
+   setbits_le32(cr1, USART_CR1_RE | USART_CR1_TE | BIT(uart_enable_bit));
+
+   return 0;
+}
+
 static int stm32_serial_getc(struct udevice *dev)
 {
struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
@@ -57,9 +96,10 @@ static int stm32_serial_getc(struct udevice *dev)
if ((isr & USART_ISR_RXNE) == 0)
return -EAGAIN;
 
-   if (isr & (USART_ISR_ORE)) {
+   if (isr & (USART_ISR_PE | USART_ISR_ORE)) {
if (!stm32f4)
-   setbits_le32(base + ICR_OFFSET, USART_ICR_ORECF);
+   setbits_le32(base + ICR_OFFSET,
+USART_ICR_PCECF | USART_ICR_ORECF);
else
readl(base + RDR_OFFSET(stm32f4));
return -EIO;
@@ -170,6 +210,7 @@ static const struct dm_serial_ops stm32_serial_ops = {
.pending = stm32_serial_pending,
.getc = stm32_serial_getc,
.setbrg = stm32_serial_setbrg,
+   .setparity = stm32_serial_setparity
 };
 
 U_BOOT_DRIVER(serial_stm32) = {
diff --git a/drivers/serial/serial_stm32.h b/drivers/serial/serial_stm32.h
index c478e3507020..ccafa31219a1 100644
--- a/drivers/serial/serial_stm32.h
+++ b/drivers/serial/serial_stm32.h
@@ -13,6 +13,7 @@
 #define ISR_OFFSET(x)  (x ? 0x00 : 0x1c)
 
 #define ICR_OFFSET 0x20
+
 /*
  * STM32F4 has one Data Register (DR) for received or transmitted
  * data, so map Receive Data Register (RDR) and Transmit Data
@@ -53,7 +54,11 @@ struct stm32x7_serial_platdata {
 };
 
 #define USART_CR1_FIFOEN   BIT(29)
+#define USART_CR1_M1   BIT(28)
 #define USART_CR1_OVER8BIT(15)
+#define USART_CR1_M0   BIT(12)
+#define USART_CR1_PCE  BIT(10)
+#define USART_CR1_PS   BIT(9)
 #define USART_CR1_TE   BIT(3)
 #define USART_CR1_RE   BIT(2)
 
@@ -62,10 +67,13 @@ struct stm32x7_serial_platdata {
 #define USART_ISR_TXE  BIT(7)
 #define USART_ISR_RXNE BIT(5)
 #define USART_ISR_ORE  BIT(3)
+#define USART_ISR_PE   BIT(0)
 
 #define USART_BRR_F_MASK   GENMASK(7, 0)
 #define USART_BRR_M_SHIFT  4
 #define USART_BRR_M_MASK   GENMASK(15, 4)
 
 #define USART_ICR_ORECFBIT(3)
+#define USART_ICR_PCECFBIT(0)
+
 #endif
-- 
1.9.1

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


[U-Boot] [PATCH v1 5/5] stm32mp1: Allow to activate CONFIG_DEBUG_UART

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add the needed information to enable the debug uart
to have printf before the serial driver probe
(so before probe for clock, pincontrol and reset drivers)

To enable the debug on uart 4 (default console):
+ CONFIG_DEBUG_UART=y
+ CONFIG_DEBUG_UART_STM32=y

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 arch/arm/mach-stm32mp/Kconfig  | 15 +++
 arch/arm/mach-stm32mp/cpu.c| 14 +-
 arch/arm/mach-stm32mp/include/mach/stm32.h | 12 
 board/st/stm32mp1/board.c  | 27 +++
 4 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-stm32mp/Kconfig b/arch/arm/mach-stm32mp/Kconfig
index ccbeb5c38815..abceeded24a2 100644
--- a/arch/arm/mach-stm32mp/Kconfig
+++ b/arch/arm/mach-stm32mp/Kconfig
@@ -54,4 +54,19 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2
 
 source "board/st/stm32mp1/Kconfig"
 
+# currently activated for debug / should be deactivated for real product
+if DEBUG_UART
+
+config DEBUG_UART_BOARD_INIT
+   default y
+
+# debug on UART4 by default
+config DEBUG_UART_BASE
+   default 0x4001
+
+# clock source is HSI on reset
+config DEBUG_UART_CLOCK
+   default 6400
+endif
+
 endif
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index dfcbbd231463..2deee0961822 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -4,6 +4,7 @@
  */
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -152,6 +153,8 @@ static u32 get_bootmode(void)
  */
 int arch_cpu_init(void)
 {
+   u32 boot_mode;
+
/* early armv7 timer init: needed for polling */
timer_init();
 
@@ -160,8 +163,17 @@ int arch_cpu_init(void)
 
security_init();
 #endif
+
/* get bootmode from BootRom context: saved in TAMP register */
-   get_bootmode();
+   boot_mode = get_bootmode();
+
+   if ((boot_mode & TAMP_BOOT_DEVICE_MASK) == BOOT_SERIAL_UART)
+   gd->flags |= GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE;
+#if defined(CONFIG_DEBUG_UART) && \
+   (!defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD))
+   else
+   debug_uart_init();
+#endif
 
return 0;
 }
diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h 
b/arch/arm/mach-stm32mp/include/mach/stm32.h
index a8142013b086..129f9f558eac 100644
--- a/arch/arm/mach-stm32mp/include/mach/stm32.h
+++ b/arch/arm/mach-stm32mp/include/mach/stm32.h
@@ -17,6 +17,18 @@
 #define STM32_ETZPC_BASE   0x5C007000
 #define STM32_TAMP_BASE0x5C00A000
 
+#ifdef CONFIG_DEBUG_UART_BASE
+/* hardcoded value can be only used for DEBUG UART */
+#define STM32_USART1_BASE  0x5C00
+#define STM32_USART2_BASE  0x4000E000
+#define STM32_USART3_BASE  0x4000F000
+#define STM32_UART4_BASE   0x4001
+#define STM32_UART5_BASE   0x40011000
+#define STM32_USART6_BASE  0x44003000
+#define STM32_UART7_BASE   0x40018000
+#define STM32_UART8_BASE   0x40019000
+#endif
+
 #define STM32_SYSRAM_BASE  0x2FFC
 #define STM32_SYSRAM_SIZE  SZ_256K
 
diff --git a/board/st/stm32mp1/board.c b/board/st/stm32mp1/board.c
index 956768f04479..5f31ea99f597 100644
--- a/board/st/stm32mp1/board.c
+++ b/board/st/stm32mp1/board.c
@@ -10,6 +10,33 @@
 #include 
 #include 
 
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+#if (CONFIG_DEBUG_UART_BASE == STM32_UART4_BASE)
+
+#define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00)
+#define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28)
+
+   /* UART4 clock enable */
+   setbits_le32(RCC_MP_APB1ENSETR, BIT(16));
+
+#define GPIOG_BASE 0x50008000
+   /* GPIOG clock enable */
+   writel(BIT(6), RCC_MP_AHB4ENSETR);
+   /* GPIO configuration for EVAL board
+* => Uart4 TX = G11
+*/
+   writel(0xffbf, GPIOG_BASE + 0x00);
+   writel(0x6000, GPIOG_BASE + 0x24);
+#else
+
+#error("CONFIG_DEBUG_UART_BASE: not supported value")
+
+#endif
+}
+#endif
+
 #ifdef CONFIG_PMIC_STPMU1
 int board_ddr_power_init(void)
 {
-- 
1.9.1

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


[U-Boot] [PATCH v1 3/5] dm: serial: Add setparity

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Implements serial setparity ops to allow uart parity change.
It allows to select ODD, EVEN or NONE parity.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 include/serial.h | 16 
 1 file changed, 16 insertions(+)

diff --git a/include/serial.h b/include/serial.h
index 384df94ed0b3..b9ef6d91c9c5 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -67,6 +67,12 @@ extern int usbtty_tstc(void);
 
 struct udevice;
 
+enum serial_par {
+   SERIAL_PAR_NONE,
+   SERIAL_PAR_ODD,
+   SERIAL_PAR_EVEN
+};
+
 /**
  * struct struct dm_serial_ops - Driver model serial operations
  *
@@ -143,6 +149,16 @@ struct dm_serial_ops {
 */
int (*loop)(struct udevice *dev, int on);
 #endif
+   /**
+* setparity() - Set up the parity
+*
+* Set up a new parity for this device.
+*
+* @dev: Device pointer
+* @parity: parity to use
+* @return 0 if OK, -ve on error
+*/
+   int (*setparity)(struct udevice *dev, enum serial_par parity);
 };
 
 /**
-- 
1.9.1

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


[U-Boot] [PATCH v1 1/5] serial: stm32: Add debug uart support

2018-05-17 Thread Patrice Chotard
From: Patrick Delaunay 

Add support for early debug printf, before the availability of
driver model and device tree support.

Signed-off-by: Patrick Delaunay 
Signed-off-by: Patrice Chotard 
---

 drivers/serial/Kconfig|   9 
 drivers/serial/serial_stm32.c | 105 +-
 2 files changed, 92 insertions(+), 22 deletions(-)

diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 5937910e5bf9..25ac869b0e64 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -315,6 +315,15 @@ config DEBUG_UART_MXC
  will need to provide parameters to make this work. The driver will
  be available until the real driver model serial is running.
 
+config DEBUG_UART_STM32
+   bool "STMicroelectronics STM32"
+   depends on STM32_SERIAL
+   help
+ Select this to enable a debug UART using the serial_stm32 driver
+ You will need to provide parameters to make this work.
+ The driver will be available until the real driver model
+ serial is running.
+
 config DEBUG_UART_UNIPHIER
bool "UniPhier on-chip UART"
depends on ARCH_UNIPHIER
diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 6717ffaaa5b9..724d6f967246 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -7,19 +7,21 @@
 #include 
 #include 
 #include 
-#include 
 #include 
+#include 
+#include 
 #include 
 #include "serial_stm32.h"
 
-static int stm32_serial_setbrg(struct udevice *dev, int baudrate)
+static void _stm32_serial_setbrg(fdt_addr_t base,
+struct stm32_uart_info *uart_info,
+u32 clock_rate,
+int baudrate)
 {
-   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
-   bool stm32f4 = plat->uart_info->stm32f4;
-   fdt_addr_t base = plat->base;
+   bool stm32f4 = uart_info->stm32f4;
u32 int_div, mantissa, fraction, oversampling;
 
-   int_div = DIV_ROUND_CLOSEST(plat->clock_rate, baudrate);
+   int_div = DIV_ROUND_CLOSEST(clock_rate, baudrate);
 
if (int_div < 16) {
oversampling = 8;
@@ -33,6 +35,14 @@ static int stm32_serial_setbrg(struct udevice *dev, int 
baudrate)
fraction = int_div % oversampling;
 
writel(mantissa | fraction, base + BRR_OFFSET(stm32f4));
+}
+
+static int stm32_serial_setbrg(struct udevice *dev, int baudrate)
+{
+   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+
+   _stm32_serial_setbrg(plat->base, plat->uart_info,
+plat->clock_rate, baudrate);
 
return 0;
 }
@@ -58,11 +68,11 @@ static int stm32_serial_getc(struct udevice *dev)
return readl(base + RDR_OFFSET(stm32f4));
 }
 
-static int stm32_serial_putc(struct udevice *dev, const char c)
+static int _stm32_serial_putc(fdt_addr_t base,
+ struct stm32_uart_info *uart_info,
+ const char c)
 {
-   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
-   bool stm32f4 = plat->uart_info->stm32f4;
-   fdt_addr_t base = plat->base;
+   bool stm32f4 = uart_info->stm32f4;
 
if ((readl(base + ISR_OFFSET(stm32f4)) & USART_ISR_FLAG_TXE) == 0)
return -EAGAIN;
@@ -72,6 +82,13 @@ static int stm32_serial_putc(struct udevice *dev, const char 
c)
return 0;
 }
 
+static int stm32_serial_putc(struct udevice *dev, const char c)
+{
+   struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+
+   return _stm32_serial_putc(plat->base, plat->uart_info, c);
+}
+
 static int stm32_serial_pending(struct udevice *dev, bool input)
 {
struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
@@ -86,18 +103,28 @@ static int stm32_serial_pending(struct udevice *dev, bool 
input)
USART_ISR_FLAG_TXE ? 0 : 1;
 }
 
+static void _stm32_serial_init(fdt_addr_t base,
+  struct stm32_uart_info *uart_info)
+{
+   bool stm32f4 = uart_info->stm32f4;
+   u8 uart_enable_bit = uart_info->uart_enable_bit;
+
+   /* Disable uart-> enable fifo -> enable uart */
+   clrbits_le32(base + CR1_OFFSET(stm32f4), USART_CR1_RE | USART_CR1_TE |
+BIT(uart_enable_bit));
+   if (uart_info->has_fifo)
+   setbits_le32(base + CR1_OFFSET(stm32f4), USART_CR1_FIFOEN);
+   setbits_le32(base + CR1_OFFSET(stm32f4), USART_CR1_RE | USART_CR1_TE |
+BIT(uart_enable_bit));
+}
+
 static int stm32_serial_probe(struct udevice *dev)
 {
struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
struct clk clk;
-   fdt_addr_t base = plat->base;
int ret;
-   bool stm32f4;
-   u8 uart_enable_bit;
 
plat->uart_info = (struct stm32_uart_info 

[U-Boot] [PATCH v1 2/5] serial: stm32: Fix bits defines name

2018-05-17 Thread Patrice Chotard
Rename USART_ISR_FLAG_xxx bits to USART_ISR_xxx bits and
USART_ICR_OREF to USART_ICR_ORECF in order to match datasheets.
Sort defines by descendant order.

Signed-off-by: Patrice Chotard 
---

 drivers/serial/serial_stm32.c | 12 ++--
 drivers/serial/serial_stm32.h |  8 
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 724d6f967246..eeaa8ab050d9 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -54,12 +54,12 @@ static int stm32_serial_getc(struct udevice *dev)
fdt_addr_t base = plat->base;
u32 isr = readl(base + ISR_OFFSET(stm32f4));
 
-   if ((isr & USART_ISR_FLAG_RXNE) == 0)
+   if ((isr & USART_ISR_RXNE) == 0)
return -EAGAIN;
 
-   if (isr & USART_ISR_FLAG_ORE) {
+   if (isr & (USART_ISR_ORE)) {
if (!stm32f4)
-   setbits_le32(base + ICR_OFFSET, USART_ICR_OREF);
+   setbits_le32(base + ICR_OFFSET, USART_ICR_ORECF);
else
readl(base + RDR_OFFSET(stm32f4));
return -EIO;
@@ -74,7 +74,7 @@ static int _stm32_serial_putc(fdt_addr_t base,
 {
bool stm32f4 = uart_info->stm32f4;
 
-   if ((readl(base + ISR_OFFSET(stm32f4)) & USART_ISR_FLAG_TXE) == 0)
+   if ((readl(base + ISR_OFFSET(stm32f4)) & USART_ISR_TXE) == 0)
return -EAGAIN;
 
writel(c, base + TDR_OFFSET(stm32f4));
@@ -97,10 +97,10 @@ static int stm32_serial_pending(struct udevice *dev, bool 
input)
 
if (input)
return readl(base + ISR_OFFSET(stm32f4)) &
-   USART_ISR_FLAG_RXNE ? 1 : 0;
+   USART_ISR_RXNE ? 1 : 0;
else
return readl(base + ISR_OFFSET(stm32f4)) &
-   USART_ISR_FLAG_TXE ? 0 : 1;
+   USART_ISR_TXE ? 0 : 1;
 }
 
 static void _stm32_serial_init(fdt_addr_t base,
diff --git a/drivers/serial/serial_stm32.h b/drivers/serial/serial_stm32.h
index 8a1a24fda8f4..c478e3507020 100644
--- a/drivers/serial/serial_stm32.h
+++ b/drivers/serial/serial_stm32.h
@@ -59,13 +59,13 @@ struct stm32x7_serial_platdata {
 
 #define USART_CR3_OVRDIS   BIT(12)
 
-#define USART_ISR_FLAG_ORE BIT(3)
-#define USART_ISR_FLAG_RXNEBIT(5)
-#define USART_ISR_FLAG_TXE BIT(7)
+#define USART_ISR_TXE  BIT(7)
+#define USART_ISR_RXNE BIT(5)
+#define USART_ISR_ORE  BIT(3)
 
 #define USART_BRR_F_MASK   GENMASK(7, 0)
 #define USART_BRR_M_SHIFT  4
 #define USART_BRR_M_MASK   GENMASK(15, 4)
 
-#define USART_ICR_OREF BIT(3)
+#define USART_ICR_ORECFBIT(3)
 #endif
-- 
1.9.1

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


[U-Boot] [PATCH v1 0/5] Update STM32 serial driver

2018-05-17 Thread Patrice Chotard

This series :
  _ adds support of DEBUG_UART
  _ fixes bit register define names
  _ add new setparity ops support in DM and in STM32 serial driver
  _ update STM32MP1 machine to allow DEBUG_UART activation


Patrice Chotard (1):
  serial: stm32: Fix bits defines name

Patrick Delaunay (4):
  serial: stm32: Add debug uart support
  dm: serial: Add setparity
  serial: stm32: Add setparity support
  stm32mp1: Allow to activate CONFIG_DEBUG_UART

 arch/arm/mach-stm32mp/Kconfig  |  15 +++
 arch/arm/mach-stm32mp/cpu.c|  14 ++-
 arch/arm/mach-stm32mp/include/mach/stm32.h |  12 +++
 board/st/stm32mp1/board.c  |  27 +
 drivers/serial/Kconfig |   9 ++
 drivers/serial/serial_stm32.c  | 158 -
 drivers/serial/serial_stm32.h  |  16 ++-
 include/serial.h   |  16 +++
 8 files changed, 234 insertions(+), 33 deletions(-)

-- 
1.9.1

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


[U-Boot] [PATCH V2] sf: Add Macronix MX25U25635F ID

2018-05-17 Thread Marek Vasut
Add ID for the Macronix MX25U25635F flash.

Signed-off-by: Marek Vasut 
Cc: Jagan Teki 
---
V2: Change the flash type on maintainer request. This doesn't match
the actual hardware with which this was tested anymore though.
---
 drivers/mtd/spi/spi_flash_ids.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/spi/spi_flash_ids.c b/drivers/mtd/spi/spi_flash_ids.c
index a46227f172..cbf2069177 100644
--- a/drivers/mtd/spi/spi_flash_ids.c
+++ b/drivers/mtd/spi/spi_flash_ids.c
@@ -85,6 +85,7 @@ const struct spi_flash_info spi_flash_ids[] = {
{"mx25u6435f", INFO(0xc22537, 0x0, 64 * 1024,   128, RD_FULL | 
WR_QPP) },
{"mx25l12855e",INFO(0xc22618, 0x0, 64 * 1024,   256, RD_FULL | 
WR_QPP) },
{"mx25u1635e", INFO(0xc22535, 0x0, 64 * 1024,  32, SECT_4K) },
+   {"mx25u25635f",INFO(0xc22539, 0x0, 64 * 1024,   512, RD_FULL | 
WR_QPP) },
{"mx66u51235f",INFO(0xc2253a, 0x0, 64 * 1024,  1024, RD_FULL | 
WR_QPP) },
{"mx66l1g45g", INFO(0xc2201b, 0x0, 64 * 1024,  2048, RD_FULL | 
WR_QPP) },
 #endif
-- 
2.16.2

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


Re: [U-Boot] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Chris Packham
On Fri, May 18, 2018 at 12:02 AM Tom Rini  wrote:

> On Thu, May 17, 2018 at 01:59:36PM +0200, Stefan Roese wrote:
> > On 17.05.2018 13:53, Chris Packham wrote:
> > >
> > >
> > >On Thu, 17 May 2018, 11:09 PM Tom Rini,  > >> wrote:
> > >
> > >On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
> > > > Not all users of MVGBE need PHYLIB and it increases the size of
the
> > > > openrd images too much.
> > > >
> > > > Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> > > > Signed-off-by: Chris Packham  > >>
> > > > Cc: Tom Rini >
> > > > Cc: Stefan Roese >
> > > > ---
> > > >
> > > >  drivers/net/Kconfig | 1 -
> > > >  1 file changed, 1 deletion(-)
> > > >
> > > > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> > > > index c962d7a72c0c..f2cc75f494e8 100644
> > > > --- a/drivers/net/Kconfig
> > > > +++ b/drivers/net/Kconfig
> > > > @@ -181,7 +181,6 @@ config FTMAC100
> > > >  config MVGBE
> > > >   bool "Marvell Orion5x/Kirkwood network interface support"
> > > >   depends on KIRKWOOD || ORION5X
> > > > - select PHYLIB
> > > >   help
> > > > This driver supports the network interface units in the
> > > > Marvell Orion5x and Kirkwood SoCs
> > >
> > >This results in phylib never being set now as the configs were
getting
> > >it implicitly.  Do any of the boards need it?
> > >
> > >
> > >I compile tested the affected boards and they all build. I've fired
this
> > >at github and should have some travis results soon.
> > >
> > >My mistake was to copy the mvneta kconfig which had the select. Commit
> > >ed52ea507f ("net: add Kconfig for MVGBE") didn't remove any
CONFIG_PHYLIB
> > >lines so if they need it it's already in the board.h file or selected
> > >somewhere else.
> >
> > Yes, this is also my understanding. ed52ea507f ("net: add Kconfig for
> > MVGBE") selected PHYLIB via Kconfig, which changed the configuration
> > for these Kirkwood boards. *If* some of them needed / selected PHYLIB
> > before this patch, it was most likely done in their config header.
> >
> > So this patch restores the board configuration again. PHYLIB is not
> > needed for MVGBE - it compiles without it as well.

> OK, thanks.  Can you please do a v2 with a commit message that reflects
> this and a Fixes tag?


Done http://patchwork.ozlabs.org/patch/915392/
Travis builds running now
https://travis-ci.org/cpackham/u-boot/builds/380175749
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Chris Packham
When Kconfig support was added for MVGBE it included automatically
selected PHYLIB support. But MVGBE does not need PHYLIB it will build
fine without it. Commit ed52ea507f12 ("net: add Kconfig for MVGBE")
should have been a no-op in terms of build size but because of the
selecting PHYLIB the openrd configs increased in size.

Remove the automatic selection of PHYLIB, boards that need it will have
already enabled it in their config header file.

Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
Signed-off-by: Chris Packham 
---

Changes in v2:
- reword commit message to make the intent a bit clearer

 drivers/net/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index c962d7a72c0c..f2cc75f494e8 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -181,7 +181,6 @@ config FTMAC100
 config MVGBE
bool "Marvell Orion5x/Kirkwood network interface support"
depends on KIRKWOOD || ORION5X
-   select PHYLIB
help
  This driver supports the network interface units in the
  Marvell Orion5x and Kirkwood SoCs
-- 
2.17.0

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


Re: [U-Boot] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 01:59:36PM +0200, Stefan Roese wrote:
> On 17.05.2018 13:53, Chris Packham wrote:
> >
> >
> >On Thu, 17 May 2018, 11:09 PM Tom Rini,  >> wrote:
> >
> >On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
> > > Not all users of MVGBE need PHYLIB and it increases the size of the
> > > openrd images too much.
> > >
> > > Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> > > Signed-off-by: Chris Packham  >>
> > > Cc: Tom Rini >
> > > Cc: Stefan Roese >
> > > ---
> > >
> > >  drivers/net/Kconfig | 1 -
> > >  1 file changed, 1 deletion(-)
> > >
> > > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> > > index c962d7a72c0c..f2cc75f494e8 100644
> > > --- a/drivers/net/Kconfig
> > > +++ b/drivers/net/Kconfig
> > > @@ -181,7 +181,6 @@ config FTMAC100
> > >  config MVGBE
> > >       bool "Marvell Orion5x/Kirkwood network interface support"
> > >       depends on KIRKWOOD || ORION5X
> > > -     select PHYLIB
> > >       help
> > >         This driver supports the network interface units in the
> > >         Marvell Orion5x and Kirkwood SoCs
> >
> >This results in phylib never being set now as the configs were getting
> >it implicitly.  Do any of the boards need it?
> >
> >
> >I compile tested the affected boards and they all build. I've fired this
> >at github and should have some travis results soon.
> >
> >My mistake was to copy the mvneta kconfig which had the select. Commit
> >ed52ea507f ("net: add Kconfig for MVGBE") didn't remove any CONFIG_PHYLIB
> >lines so if they need it it's already in the board.h file or selected
> >somewhere else.
> 
> Yes, this is also my understanding. ed52ea507f ("net: add Kconfig for
> MVGBE") selected PHYLIB via Kconfig, which changed the configuration
> for these Kirkwood boards. *If* some of them needed / selected PHYLIB
> before this patch, it was most likely done in their config header.
> 
> So this patch restores the board configuration again. PHYLIB is not
> needed for MVGBE - it compiles without it as well.

OK, thanks.  Can you please do a v2 with a commit message that reflects
this and a Fixes tag?

-- 
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] sunxi: allow CONFIG_DEFAULT_FDT_FILE override

2018-05-17 Thread Maxime Ripard
On Tue, May 01, 2018 at 05:46:41PM -0700, Martin Kelly wrote:
> Currently, sunxi-common.h ignores CONFIG_DEFAULT_FDT_FILE and assumes
> the kernel fdtfile and the u-boot devicetree names are the same.
> Although this is typically the case, sometimes you might want to
> customize one of these differently, so it's useful to allow them to be
> different.
> 
> Add logic in sunxi-common.h to respect CONFIG_DEFAULT_FDT_FILE, if set,
> and default to the values it currently uses.
> 
> Signed-off-by: Martin Kelly 

Acked-by: Maxime Ripard 

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


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] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Stefan Roese

On 17.05.2018 13:53, Chris Packham wrote:



On Thu, 17 May 2018, 11:09 PM Tom Rini, > wrote:


On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
 > Not all users of MVGBE need PHYLIB and it increases the size of the
 > openrd images too much.
 >
 > Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
 > Signed-off-by: Chris Packham >
 > Cc: Tom Rini >
 > Cc: Stefan Roese >
 > ---
 >
 >  drivers/net/Kconfig | 1 -
 >  1 file changed, 1 deletion(-)
 >
 > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
 > index c962d7a72c0c..f2cc75f494e8 100644
 > --- a/drivers/net/Kconfig
 > +++ b/drivers/net/Kconfig
 > @@ -181,7 +181,6 @@ config FTMAC100
 >  config MVGBE
 >       bool "Marvell Orion5x/Kirkwood network interface support"
 >       depends on KIRKWOOD || ORION5X
 > -     select PHYLIB
 >       help
 >         This driver supports the network interface units in the
 >         Marvell Orion5x and Kirkwood SoCs

This results in phylib never being set now as the configs were getting
it implicitly.  Do any of the boards need it?


I compile tested the affected boards and they all build. I've fired this 
at github and should have some travis results soon.


My mistake was to copy the mvneta kconfig which had the select. Commit 
ed52ea507f ("net: add Kconfig for MVGBE") didn't remove any 
CONFIG_PHYLIB lines so if they need it it's already in the board.h file 
or selected somewhere else.


Yes, this is also my understanding. ed52ea507f ("net: add Kconfig for
MVGBE") selected PHYLIB via Kconfig, which changed the configuration
for these Kirkwood boards. *If* some of them needed / selected PHYLIB
before this patch, it was most likely done in their config header.

So this patch restores the board configuration again. PHYLIB is not
needed for MVGBE - it compiles without it as well.

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


Re: [U-Boot] [PATCH 0/6] ARM: kirkwood: dts conversion round 2

2018-05-17 Thread Simon Guinot
On Thu, May 17, 2018 at 09:45:55PM +1200, Chris Packham wrote:
> This is the second round of updating kirkwood boards to OF_CONTROL. Most
> of these boards use spi flash so I've added the u-boot specific
> "spi-flash" compatible string where appropriate.

Hi Chris,

Thanks for converting the LaCie boards to device tree. I'll test them
as soon as possible.

Simon

> 
> 
> Chris Packham (6):
>   ARM: kirkwood: Add device-tree for d2net_v2 & net2big_v2
>   ARM: kirkwood: Add device-tree for dreamplug
>   ARM: kirkwood: Add device-tree for ds109
>   ARM: kirkwood: Add device-tree for lschlv2 & lsxhl
>   ARM: kirkwood: Add device-tree for netspace & inetspace
>   ARM: kirkwood: Add device-tree for keymile
> 
>  arch/arm/dts/kirkwood-d2net.dts |  45 ++
>  arch/arm/dts/kirkwood-dreamplug.dts | 127 
>  arch/arm/dts/kirkwood-ds109.dts |  40 ++
>  arch/arm/dts/kirkwood-is2.dts   |  40 ++
>  arch/arm/dts/kirkwood-km_common.dtsi|  47 ++
>  arch/arm/dts/kirkwood-km_kirkwood.dts   |  31 +
>  arch/arm/dts/kirkwood-lschlv2.dts   |  20 +
>  arch/arm/dts/kirkwood-lsxhl.dts |  20 +
>  arch/arm/dts/kirkwood-lsxl.dtsi | 237 +++
>  arch/arm/dts/kirkwood-net2big.dts   |  63 ++
>  arch/arm/dts/kirkwood-netxbig.dtsi  | 232 +++
>  arch/arm/dts/kirkwood-ns2-common.dtsi   |  97 +++
>  arch/arm/dts/kirkwood-ns2.dts   |  40 ++
>  arch/arm/dts/kirkwood-ns2lite.dts   |  35 +
>  arch/arm/dts/kirkwood-ns2max.dts|  59 ++
>  arch/arm/dts/kirkwood-ns2mini.dts   |  60 ++
>  arch/arm/dts/kirkwood-synology.dtsi | 855 
>  configs/d2net_v2_defconfig  |   3 +-
>  configs/dreamplug_defconfig |   3 +-
>  configs/ds109_defconfig |   2 +
>  configs/inetspace_v2_defconfig  |   3 +-
>  configs/km_kirkwood_128m16_defconfig|   3 +-
>  configs/km_kirkwood_defconfig   |   3 +-
>  configs/km_kirkwood_pci_defconfig   |   3 +-
>  configs/kmcoge5un_defconfig |   3 +-
>  configs/kmnusa_defconfig|   3 +-
>  configs/kmsugp1_defconfig   |   3 +-
>  configs/kmsuv31_defconfig   |   3 +-
>  configs/lschlv2_defconfig   |   3 +-
>  configs/lsxhl_defconfig |   3 +-
>  configs/mgcoge3un_defconfig |   3 +-
>  configs/net2big_v2_defconfig|   3 +-
>  configs/netspace_lite_v2_defconfig  |   3 +-
>  configs/netspace_max_v2_defconfig   |   3 +-
>  configs/netspace_mini_v2_defconfig  |   3 +-
>  configs/netspace_v2_defconfig   |   3 +-
>  include/dt-bindings/leds/leds-netxbig.h |  18 +
>  include/dt-bindings/leds/leds-ns2.h |   9 +
>  38 files changed, 2113 insertions(+), 18 deletions(-)
>  create mode 100644 arch/arm/dts/kirkwood-d2net.dts
>  create mode 100644 arch/arm/dts/kirkwood-dreamplug.dts
>  create mode 100644 arch/arm/dts/kirkwood-ds109.dts
>  create mode 100644 arch/arm/dts/kirkwood-is2.dts
>  create mode 100644 arch/arm/dts/kirkwood-km_common.dtsi
>  create mode 100644 arch/arm/dts/kirkwood-km_kirkwood.dts
>  create mode 100644 arch/arm/dts/kirkwood-lschlv2.dts
>  create mode 100644 arch/arm/dts/kirkwood-lsxhl.dts
>  create mode 100644 arch/arm/dts/kirkwood-lsxl.dtsi
>  create mode 100644 arch/arm/dts/kirkwood-net2big.dts
>  create mode 100644 arch/arm/dts/kirkwood-netxbig.dtsi
>  create mode 100644 arch/arm/dts/kirkwood-ns2-common.dtsi
>  create mode 100644 arch/arm/dts/kirkwood-ns2.dts
>  create mode 100644 arch/arm/dts/kirkwood-ns2lite.dts
>  create mode 100644 arch/arm/dts/kirkwood-ns2max.dts
>  create mode 100644 arch/arm/dts/kirkwood-ns2mini.dts
>  create mode 100644 arch/arm/dts/kirkwood-synology.dtsi
>  create mode 100644 include/dt-bindings/leds/leds-netxbig.h
>  create mode 100644 include/dt-bindings/leds/leds-ns2.h
> 
> -- 
> 2.17.0


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] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Chris Packham
On Thu, 17 May 2018, 11:09 PM Tom Rini,  wrote:

> On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
> > Not all users of MVGBE need PHYLIB and it increases the size of the
> > openrd images too much.
> >
> > Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> > Signed-off-by: Chris Packham 
> > Cc: Tom Rini 
> > Cc: Stefan Roese 
> > ---
> >
> >  drivers/net/Kconfig | 1 -
> >  1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> > index c962d7a72c0c..f2cc75f494e8 100644
> > --- a/drivers/net/Kconfig
> > +++ b/drivers/net/Kconfig
> > @@ -181,7 +181,6 @@ config FTMAC100
> >  config MVGBE
> >   bool "Marvell Orion5x/Kirkwood network interface support"
> >   depends on KIRKWOOD || ORION5X
> > - select PHYLIB
> >   help
> > This driver supports the network interface units in the
> > Marvell Orion5x and Kirkwood SoCs
>
> This results in phylib never being set now as the configs were getting
> it implicitly.  Do any of the boards need it?
>

I compile tested the affected boards and they all build. I've fired this at
github and should have some travis results soon.

My mistake was to copy the mvneta kconfig which had the select. Commit
ed52ea507f ("net: add Kconfig for MVGBE") didn't remove any CONFIG_PHYLIB
lines so if they need it it's already in the board.h file or selected
somewhere else.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] RFC: Alternative boot_jump_linux() function

2018-05-17 Thread Peter Robinson
Hi,

> I'm currently working on snapdragon bootloader support and in the
> particular case where U-boot is running in Aarch32 and the kernel is
> Aarch64 the specific implementation is to jump to Linux through SCM
> call.

I seem to remember the Allwinner A64 Pine64 starts in 32 bit mode and
switches too so you might get some ideas from there or the maintainer
might have some suggestions.

> I try to find the best possible way to provide an alternative boot function.
> Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
> arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
> a callback function in gd. that if exists will jump there instead of
> executing boot_jump_linux().
>
> What do you think ?
>
> Waiting for your thoughts on the subject.
>
> Warm regards,
> Ramon.
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC PATCH 1/3] sunxi: Extend SPL header versioning

2018-05-17 Thread Andre Przywara
Hi,

On 17/05/18 12:05, Siarhei Siamashka wrote:
> On Thu, 17 May 2018 09:16:59 +0100
> Andre Przywara  wrote:
> 
>> On Allwinner SoCs we use some free bytes at the beginning of the SPL image
>> to store various information. We have a version byte to allow updates,
>> but changing this always requires all tools to be updated as well.
> 
> The tools do not need to be updated together with U-Boot even now.
> 
> U-Boot may freely increment the SPL version number as long as the new
> header is a superset of the old one.
> 
>> Introduce the concept of semantic versioning [1] to the SPL header:
>> The major part of the version number only changes on incompatible
>> updates, a minor number bump indicates backward compatibility.
>> This patch just documents the major/minor split, adds some comments
>> to the header file and uses the versioning information for the existing
>> users.
>>
>> [1] https://semver.org
> 
> So basically you are implementing the versioning scheme that I proposed
> back in 2015:
> https://lists.denx.de/pipermail/u-boot/2015-September/228727.html

Ah, sorry, that predates my sunxi involvement ;-)

> Hans de Goede thought that the major/minor versioning was too complex
> and unnecessary (if I remember correctly, we had several discussion
> threads which concluded in the same way), so we did not implement it
> explicitly back then. But a potential non-compatible SPL header upgrade
> still could be handled, albeit less gracefully:
> 
> Yes, we can also always change the SPL header signature in the case
> of introducing incompatible changes. But the down side is that the
> "fel" tool would treat this situation as "unknown bootloader"
> instead of "incompatible U-Boot".
> 
>> Signed-off-by: Andre Przywara 
> 
> In general, improvements in this area are welcome. Just some
> comments below.
> 
>> ---
>>  arch/arm/include/asm/arch-sunxi/spl.h | 19 ++-
>>  board/sunxi/board.c   |  4 ++--
>>  2 files changed, 16 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/arch-sunxi/spl.h 
>> b/arch/arm/include/asm/arch-sunxi/spl.h
>> index 4277d836e5..7cf89c8db2 100644
>> --- a/arch/arm/include/asm/arch-sunxi/spl.h
>> +++ b/arch/arm/include/asm/arch-sunxi/spl.h
>> @@ -9,7 +9,16 @@
>>  
>>  #define BOOT0_MAGIC "eGON.BT0"
>>  #define SPL_SIGNATURE   "SPL" /* marks "sunxi" SPL header */
>> -#define SPL_HEADER_VERSION  2
>> +#define SPL_MAJOR_BITS  3
>> +#define SPL_MINOR_BITS  5
>> +#define SPL_VERSION(maj, min)   
>> \
>> +maj) & ((1U << SPL_MAJOR_BITS) - 1)) << SPL_MINOR_BITS) | \
>> +((min) & ((1U << SPL_MINOR_BITS) - 1)))
>> +
>> +#define SPL_HEADER_VERSION  SPL_VERSION(0, 2)
>> +
>> +#define SPL_ENV_HEADER_VERSION  SPL_VERSION(0, 1)
>> +#define SPL_DT_HEADER_VERSION   SPL_VERSION(0, 2)
>>  
>>  #ifdef CONFIG_SUNXI_HIGH_SRAM
>>  #define SPL_ADDR0x1
>> @@ -49,14 +58,14 @@ struct boot_file_head {
>>  uint32_t pub_head_size;
>>  uint8_t spl_signature[4];
>>  };
>> -uint32_t fel_script_address;
>> +uint32_t fel_script_address;/* since v0.1, set by sunxi-fel */
> 
> Thanks, it's nice to have these comments about the versions where these
> features were introduced.
> 
>>  /*
>>   * If the fel_uEnv_length member below is set to a non-zero value,
>>   * it specifies the size (byte count) of data at fel_script_address.
>>   * At the same time this indicates that the data is in uEnv.txt
>>   * compatible format, ready to be imported via "env import -t".
>>   */
>> -uint32_t fel_uEnv_length;
>> +uint32_t fel_uEnv_length;   /* since v0.1, set by sunxi-fel */
>>  /*
>>   * Offset of an ASCIIZ string (relative to the SPL header), which
>>   * contains the default device tree name (CONFIG_DEFAULT_DEVICE_TREE).
>> @@ -64,11 +73,11 @@ struct boot_file_head {
>>   * by flash programming tools for providing nice informative messages
>>   * to the users.
>>   */
>> -uint32_t dt_name_offset;
>> +uint32_t dt_name_offset;/* since v0.2, set by mksunxiboot */
>>  uint32_t reserved1;
>>  uint32_t boot_media;/* written here by the boot ROM */
>>  /* A padding area (may be used for storing text strings) */
>> -uint32_t string_pool[13];
>> +uint32_t string_pool[13];   /* since v0.2, filled by mksunxiboot */
> 
> The 0.2 version of the SPL header does not specify the exact
> format of this 'string_pool' padding area. So I think that this
> comment is unnecessary.

Well, I understand that it *could* be everywhere, but I wanted to give a
heads up to the reader that the actual mksunxiboot implementation fills
that area, so it's not really vacant anymore. That may become of
importance if we need more fields.

> In principle, the device tree name string 

Re: [U-Boot] mtd: spi-nor: new NXP FlexSPI driver location & framework to use ?

2018-05-17 Thread Prabhakar Kushwaha
Dear Jagan,

> -Original Message-
> From: U-Boot [mailto:u-boot-boun...@lists.denx.de] On Behalf Of
> Prabhakar Kushwaha
> Sent: Monday, May 14, 2018 6:55 PM
> To: Jagan Teki 
> Cc: u-boot@lists.denx.de
> Subject: Re: [U-Boot] mtd: spi-nor: new NXP FlexSPI driver location &
> framework to use ?
> 
> Thanks Jagan,
> 
> > -Original Message-
> > From: Jagan Teki [mailto:jagannadh.t...@gmail.com]
> > Sent: Friday, May 11, 2018 11:31 AM
> > To: Prabhakar Kushwaha 
> > Cc: Jagan Teki ; York Sun
> > ; Yogesh Narayan Gaur
> ;
> > Poonam Aggrwal ; Ashish Kumar
> > ; u- b...@lists.denx.de
> > Subject: Re: mtd: spi-nor: new NXP FlexSPI driver location & framework
> > to use ?
> >
> > On Fri, May 11, 2018 at 11:08 AM, Prabhakar Kushwaha
> >  wrote:
> > > Dear Jagan,
> > >
> > > NXP is coming up with new FlexSPI controller. It is similar to
> > > existing QSPI
> > with enhanced feature-set.
> > > We have the driver ready as per existing framework i.e. driver/spi.
> > >
> > > From recend discussion, we go to know about framework change.
> > > Migration of qspi drivers in u-boot-spi/drivers/mtd/spi-nor/
> > git://git.denx.de/u-boot-spi.git branch mtd-spinor-working.
> > >
> > > We are in dilemma for sending FlexSPI driver upstream.
> > > Do we follow existing framework i.e. driver/spi   or new proposed
> > framework i.e. u-boot-spi/drivers/mtd/spi-nor/
> > >
> > > Also, do we have any timeline of u-boot-spi/drivers/mtd/spi-nor/ to
> > become default.
> >
> > Idea is to move spi-nor, mtd-spinor-working is paused because of
> > non-dm drivers accessing.
> 
> This means, flexspi controller driver should be upstream'ed via u-boot-
> spi/drivers/mtd/spi-nor branch mtd-spinor-working
> 

Please help me with the query. 
We don’t want to end up with 2 FlexSPI drivers being posted in upstream. 

--pk




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


Re: [U-Boot] [PATCH 1/3] doc: Add new doc for file system firmware loader driver model

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 04:27:27AM +, Chee, Tien Fong wrote:
> On Wed, 2018-05-16 at 08:48 -0400, Tom Rini wrote:
> > On Wed, May 16, 2018 at 05:21:39PM +0800, tien.fong.c...@intel.com
> > wrote:
> > 
> > > 
> > > From: Tien Fong Chee 
> > > 
> > > Provide information about
> > > 
> > > - overview of file system firmware loader driver model
> > > - describe default storage device in device tree source
> > > - describe fie system firmware loader API
> > > 
> > > Signed-off-by: Tien Fong Chee 
> > > ---
> > >  doc/driver-model/fs_firmware_loader.txt |  100
> > > +++
> > >  1 files changed, 100 insertions(+), 0 deletions(-)
> > >  create mode 100644 doc/driver-model/fs_firmware_loader.txt
> > > 
> > > diff --git a/doc/driver-model/fs_firmware_loader.txt b/doc/driver-
> > > model/fs_firmware_loader.txt
> > > new file mode 100644
> > > index 000..167660a
> > > --- /dev/null
> > > +++ b/doc/driver-model/fs_firmware_loader.txt
> > > @@ -0,0 +1,100 @@
> > > +/*
> > > + * Copyright (C) 2018 Intel Corporation 
> > > + *
> > > + * SPDX-License-Identifier:GPL-2.0
> > > + */
> > As this isn't code please don't put a code header up for the first
> > comment block.  Frankly I'd rather see an rST comment block up front
> > even with the rest being plain text as long term I imagine we'll move
> > to
> > rST.
> > 
> Okay, i will remove the license and changing it to rST format.

You don't need to remove it, just move 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] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Tom Rini
On Thu, May 17, 2018 at 09:03:15PM +1200, Chris Packham wrote:
> Not all users of MVGBE need PHYLIB and it increases the size of the
> openrd images too much.
> 
> Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
> Signed-off-by: Chris Packham 
> Cc: Tom Rini 
> Cc: Stefan Roese 
> ---
> 
>  drivers/net/Kconfig | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
> index c962d7a72c0c..f2cc75f494e8 100644
> --- a/drivers/net/Kconfig
> +++ b/drivers/net/Kconfig
> @@ -181,7 +181,6 @@ config FTMAC100
>  config MVGBE
>   bool "Marvell Orion5x/Kirkwood network interface support"
>   depends on KIRKWOOD || ORION5X
> - select PHYLIB
>   help
> This driver supports the network interface units in the
> Marvell Orion5x and Kirkwood SoCs

This results in phylib never being set now as the configs were getting
it implicitly.  Do any of the boards need it?  Thanks!

-- 
Tom


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


Re: [U-Boot] [RFC PATCH 1/3] sunxi: Extend SPL header versioning

2018-05-17 Thread Icenowy Zheng


于 2018年5月17日 GMT+08:00 下午7:05:15, Siarhei Siamashka 
 写到:
>On Thu, 17 May 2018 09:16:59 +0100
>Andre Przywara  wrote:
>
>> On Allwinner SoCs we use some free bytes at the beginning of the SPL
>image
>> to store various information. We have a version byte to allow
>updates,
>> but changing this always requires all tools to be updated as well.
>
>The tools do not need to be updated together with U-Boot even now.
>
>U-Boot may freely increment the SPL version number as long as the new
>header is a superset of the old one.

But now sunxi-fel will work when SPL ver not recognized.

>
>> Introduce the concept of semantic versioning [1] to the SPL header:
>> The major part of the version number only changes on incompatible
>> updates, a minor number bump indicates backward compatibility.
>> This patch just documents the major/minor split, adds some comments
>> to the header file and uses the versioning information for the
>existing
>> users.
>> 
>> [1] https://semver.org
>
>So basically you are implementing the versioning scheme that I proposed
>back in 2015:
>https://lists.denx.de/pipermail/u-boot/2015-September/228727.html
>
>Hans de Goede thought that the major/minor versioning was too complex
>and unnecessary (if I remember correctly, we had several discussion
>threads which concluded in the same way), so we did not implement it
>explicitly back then. But a potential non-compatible SPL header upgrade
>still could be handled, albeit less gracefully:
>
>Yes, we can also always change the SPL header signature in the case
>of introducing incompatible changes. But the down side is that the
>"fel" tool would treat this situation as "unknown bootloader"
>instead of "incompatible U-Boot".
>
>> Signed-off-by: Andre Przywara 
>
>In general, improvements in this area are welcome. Just some
>comments below.
>
>> ---
>>  arch/arm/include/asm/arch-sunxi/spl.h | 19 ++-
>>  board/sunxi/board.c   |  4 ++--
>>  2 files changed, 16 insertions(+), 7 deletions(-)
>> 
>> diff --git a/arch/arm/include/asm/arch-sunxi/spl.h
>b/arch/arm/include/asm/arch-sunxi/spl.h
>> index 4277d836e5..7cf89c8db2 100644
>> --- a/arch/arm/include/asm/arch-sunxi/spl.h
>> +++ b/arch/arm/include/asm/arch-sunxi/spl.h
>> @@ -9,7 +9,16 @@
>>  
>>  #define BOOT0_MAGIC "eGON.BT0"
>>  #define SPL_SIGNATURE   "SPL" /* marks "sunxi" SPL header */
>> -#define SPL_HEADER_VERSION  2
>> +#define SPL_MAJOR_BITS  3
>> +#define SPL_MINOR_BITS  5
>> +#define SPL_VERSION(maj, min)   
>> \
>> +maj) & ((1U << SPL_MAJOR_BITS) - 1)) << SPL_MINOR_BITS) | \
>> +((min) & ((1U << SPL_MINOR_BITS) - 1)))
>> +
>> +#define SPL_HEADER_VERSION  SPL_VERSION(0, 2)
>> +
>> +#define SPL_ENV_HEADER_VERSION  SPL_VERSION(0, 1)
>> +#define SPL_DT_HEADER_VERSION   SPL_VERSION(0, 2)
>>  
>>  #ifdef CONFIG_SUNXI_HIGH_SRAM
>>  #define SPL_ADDR0x1
>> @@ -49,14 +58,14 @@ struct boot_file_head {
>>  uint32_t pub_head_size;
>>  uint8_t spl_signature[4];
>>  };
>> -uint32_t fel_script_address;
>> +uint32_t fel_script_address;/* since v0.1, set by sunxi-fel */
>
>Thanks, it's nice to have these comments about the versions where these
>features were introduced.
>
>>  /*
>>   * If the fel_uEnv_length member below is set to a non-zero value,
>>   * it specifies the size (byte count) of data at
>fel_script_address.
>>   * At the same time this indicates that the data is in uEnv.txt
>>   * compatible format, ready to be imported via "env import -t".
>>   */
>> -uint32_t fel_uEnv_length;
>> +uint32_t fel_uEnv_length;   /* since v0.1, set by sunxi-fel */
>>  /*
>>   * Offset of an ASCIIZ string (relative to the SPL header), which
>>   * contains the default device tree name
>(CONFIG_DEFAULT_DEVICE_TREE).
>> @@ -64,11 +73,11 @@ struct boot_file_head {
>>   * by flash programming tools for providing nice informative
>messages
>>   * to the users.
>>   */
>> -uint32_t dt_name_offset;
>> +uint32_t dt_name_offset;/* since v0.2, set by mksunxiboot */
>>  uint32_t reserved1;
>>  uint32_t boot_media;/* written here by the boot ROM */
>>  /* A padding area (may be used for storing text strings) */
>> -uint32_t string_pool[13];
>> +uint32_t string_pool[13];   /* since v0.2, filled by mksunxiboot */
>
>The 0.2 version of the SPL header does not specify the exact
>format of this 'string_pool' padding area. So I think that this
>comment is unnecessary.
>
>In principle, the device tree name string can be stored even
>somewhere in the const data section of the SPL binary and
>referenced from the SPL header. Not that it makes any sense to
>do this, but it is technically possible.
>
>>  /* The header must be a multiple of 

Re: [U-Boot] [RFC PATCH 1/3] sunxi: Extend SPL header versioning

2018-05-17 Thread Siarhei Siamashka
On Thu, 17 May 2018 09:16:59 +0100
Andre Przywara  wrote:

> On Allwinner SoCs we use some free bytes at the beginning of the SPL image
> to store various information. We have a version byte to allow updates,
> but changing this always requires all tools to be updated as well.

The tools do not need to be updated together with U-Boot even now.

U-Boot may freely increment the SPL version number as long as the new
header is a superset of the old one.

> Introduce the concept of semantic versioning [1] to the SPL header:
> The major part of the version number only changes on incompatible
> updates, a minor number bump indicates backward compatibility.
> This patch just documents the major/minor split, adds some comments
> to the header file and uses the versioning information for the existing
> users.
> 
> [1] https://semver.org

So basically you are implementing the versioning scheme that I proposed
back in 2015:
https://lists.denx.de/pipermail/u-boot/2015-September/228727.html

Hans de Goede thought that the major/minor versioning was too complex
and unnecessary (if I remember correctly, we had several discussion
threads which concluded in the same way), so we did not implement it
explicitly back then. But a potential non-compatible SPL header upgrade
still could be handled, albeit less gracefully:

Yes, we can also always change the SPL header signature in the case
of introducing incompatible changes. But the down side is that the
"fel" tool would treat this situation as "unknown bootloader"
instead of "incompatible U-Boot".

> Signed-off-by: Andre Przywara 

In general, improvements in this area are welcome. Just some
comments below.

> ---
>  arch/arm/include/asm/arch-sunxi/spl.h | 19 ++-
>  board/sunxi/board.c   |  4 ++--
>  2 files changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/include/asm/arch-sunxi/spl.h 
> b/arch/arm/include/asm/arch-sunxi/spl.h
> index 4277d836e5..7cf89c8db2 100644
> --- a/arch/arm/include/asm/arch-sunxi/spl.h
> +++ b/arch/arm/include/asm/arch-sunxi/spl.h
> @@ -9,7 +9,16 @@
>  
>  #define BOOT0_MAGIC  "eGON.BT0"
>  #define SPL_SIGNATURE"SPL" /* marks "sunxi" SPL header */
> -#define SPL_HEADER_VERSION   2
> +#define SPL_MAJOR_BITS   3
> +#define SPL_MINOR_BITS   5
> +#define SPL_VERSION(maj, min)
> \
> + maj) & ((1U << SPL_MAJOR_BITS) - 1)) << SPL_MINOR_BITS) | \
> + ((min) & ((1U << SPL_MINOR_BITS) - 1)))
> +
> +#define SPL_HEADER_VERSION   SPL_VERSION(0, 2)
> +
> +#define SPL_ENV_HEADER_VERSION   SPL_VERSION(0, 1)
> +#define SPL_DT_HEADER_VERSIONSPL_VERSION(0, 2)
>  
>  #ifdef CONFIG_SUNXI_HIGH_SRAM
>  #define SPL_ADDR 0x1
> @@ -49,14 +58,14 @@ struct boot_file_head {
>   uint32_t pub_head_size;
>   uint8_t spl_signature[4];
>   };
> - uint32_t fel_script_address;
> + uint32_t fel_script_address;/* since v0.1, set by sunxi-fel */

Thanks, it's nice to have these comments about the versions where these
features were introduced.

>   /*
>* If the fel_uEnv_length member below is set to a non-zero value,
>* it specifies the size (byte count) of data at fel_script_address.
>* At the same time this indicates that the data is in uEnv.txt
>* compatible format, ready to be imported via "env import -t".
>*/
> - uint32_t fel_uEnv_length;
> + uint32_t fel_uEnv_length;   /* since v0.1, set by sunxi-fel */
>   /*
>* Offset of an ASCIIZ string (relative to the SPL header), which
>* contains the default device tree name (CONFIG_DEFAULT_DEVICE_TREE).
> @@ -64,11 +73,11 @@ struct boot_file_head {
>* by flash programming tools for providing nice informative messages
>* to the users.
>*/
> - uint32_t dt_name_offset;
> + uint32_t dt_name_offset;/* since v0.2, set by mksunxiboot */
>   uint32_t reserved1;
>   uint32_t boot_media;/* written here by the boot ROM */
>   /* A padding area (may be used for storing text strings) */
> - uint32_t string_pool[13];
> + uint32_t string_pool[13];   /* since v0.2, filled by mksunxiboot */

The 0.2 version of the SPL header does not specify the exact
format of this 'string_pool' padding area. So I think that this
comment is unnecessary.

In principle, the device tree name string can be stored even
somewhere in the const data section of the SPL binary and
referenced from the SPL header. Not that it makes any sense to
do this, but it is technically possible.

>   /* The header must be a multiple of 32 bytes (for VBAR alignment) */
>  };
>  
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 3d364c6db5..a105d0a5ab 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -631,9 +631,9 @@ static 

[U-Boot] RFC: Alternative boot_jump_linux() function

2018-05-17 Thread Ramon Fried
Hi.
I'm currently working on snapdragon bootloader support and in the
particular case where U-boot is running in Aarch32 and the kernel is
Aarch64 the specific implementation is to jump to Linux through SCM
call.

I try to find the best possible way to provide an alternative boot function.
Adding #ifdef ARCH_SNAPDRAGON will just be too specific in
arm/lib/bootm.c in my opinion and I'm thinking of introducing kind of
a callback function in gd. that if exists will jump there instead of
executing boot_jump_linux().

What do you think ?

Waiting for your thoughts on the subject.

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


[U-Boot] [PATCH] ARM: uniphier: rename environment variable fdt_name to fdtname

2018-05-17 Thread Masahiro Yamada
For booting Linux in the generic distro mechanism, cmd/pxe.c
retrieves the FDT file name from "fdtname" environment variable.

Rename "fdt_name" to "fdtname" for easier migration to distro boot.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/mach-uniphier/board_late_init.c | 4 ++--
 include/configs/uniphier.h   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-uniphier/board_late_init.c 
b/arch/arm/mach-uniphier/board_late_init.c
index 9dff3f1..6a99572 100644
--- a/arch/arm/mach-uniphier/board_late_init.c
+++ b/arch/arm/mach-uniphier/board_late_init.c
@@ -38,7 +38,7 @@ static int uniphier_set_fdt_file(void)
char dtb_name[256];
int buf_len = sizeof(dtb_name);
 
-   if (env_get("fdt_file"))
+   if (env_get("fdtfile"))
return 0;   /* do nothing if it is already set */
 
compat = fdt_stringlist_get(gd->fdt_blob, 0, "compatible", 0, NULL);
@@ -56,7 +56,7 @@ static int uniphier_set_fdt_file(void)
 
strncat(dtb_name, ".dtb", buf_len);
 
-   return env_set("fdt_file", dtb_name);
+   return env_set("fdtfile", dtb_name);
 }
 
 int board_late_init(void)
diff --git a/include/configs/uniphier.h b/include/configs/uniphier.h
index f710c8f..b631f79 100644
--- a/include/configs/uniphier.h
+++ b/include/configs/uniphier.h
@@ -168,10 +168,10 @@
"run boot_common\0" \
"tftpboot=tftpboot $kernel_addr_load $bootfile && " \
"tftpboot $ramdisk_addr_r $ramdisk_file &&" \
-   "tftpboot $fdt_addr_r $fdt_file &&" \
+   "tftpboot $fdt_addr_r $fdtfile &&" \
"run boot_common\0" \
"__nfsboot=tftpboot $kernel_addr_load $bootfile && " \
-   "tftpboot $fdt_addr_r $fdt_file &&" \
+   "tftpboot $fdt_addr_r $fdtfile &&" \
"setenv ramdisk_addr_r - &&" \
"run boot_common\0"
 #endif
-- 
2.7.4

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


Re: [U-Boot] [UBOOT PATCH] env: mmc: Fix misaligned buffer address when saving envvars to FAT

2018-05-17 Thread Vipul Kumar
Hi,

> -Original Message-
> From: Alex Kiernan [mailto:alex.kier...@gmail.com]
> Sent: Thursday, May 17, 2018 1:31 PM
> To: Vipul Kumar 
> Cc: u-boot ; gmus...@ciena.com; Michal Simek
> ; Siva Durga Prasad Paladugu
> 
> Subject: Re: [U-Boot] [UBOOT PATCH] env: mmc: Fix misaligned buffer
> address when saving envvars to FAT
> 
> On Thu, May 17, 2018 at 8:46 AM Vipul Kumar 
> wrote:
> 
> > From: Gary Mussar 
> 
> > When doing a u-boot saveenv with the environment in FAT we see the
> > following warning:
> 
> > ZynqMP> saveenv
> > Saving Environment to FAT...
> > writing uboot.env
> > FAT: Misaligned buffer address (7deb9b60) done
> 
> > This can be eliminated by aligning the environment to an appropriate
> > boundary.
> 
> 
> Are you still seeing after this commit?

With cda87ec commit, it's working fine. I didn’t test with this commit earlier. 
So, there is no need of this patch.

Regards,
Vipul

> 
> cda87ec Fix misaligned buffer in env_fat_save
> 
> > Signed-off-by: Gary Mussar 
> > Signed-off-by: Vipul Kumar 
> > ---
> >   include/environment.h | 6 +-
> >   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> > diff --git a/include/environment.h b/include/environment.h index
> > 50c62c5..d6c530d 100644
> > --- a/include/environment.h
> > +++ b/include/environment.h
> > @@ -150,7 +150,11 @@ typedef struct environment_s {
> >  unsigned char   flags;  /* active/obsolete flags*/
> >   #endif
> >  unsigned char   data[ENV_SIZE]; /* Environment data */
> > -} env_t;
> > +} env_t
> > +#ifdef ARCH_DMA_MINALIGN
> > +__aligned(ARCH_DMA_MINALIGN)
> > +#endif
> > +;
> 
> >   #ifdef ENV_IS_EMBEDDED
> >   extern env_t environment;
> > --
> > 2.7.4
> 
> > This email and any attachments are intended for the sole use of the
> > named
> recipient(s) and contain(s) confidential information that may be proprietary,
> privileged or copyrighted under applicable law. If you are not the intended
> recipient, do not read, copy, or forward this email message or any
> attachments. Delete this email message and any attachments immediately.
> > ___
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
> 
> 
> 
> --
> Alex Kiernan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] IMX6 NAND booting failure

2018-05-17 Thread Rasheed, Abdul
Hi,
I am working on VAR-SOM-MX6 SOC. I'm trying to boot a custom SPL from NAND.
After programming NAND with custom SPL, system goes to serial downloader mode. 
I have taken the ROM code buffer log (also attached below). It shows that 
authentication fails. My boot security settings are OPEN, so even though 
authentication fails it should handover the control to SPL, which ROM code 
doesn't and system goes to serial downloader mode. I was able to attach JTAG 
and read the registers of core and it shows that LR is 0x000B. Which is 
exactly what it should be. Because it was expected to jump to entry point.


00902190 = 00010002 000200F0 0003 0004
009021A0 = 00050001 0006 0007 000700F0
009021B0 = 0008 0280 000800F0 0008
009021C0 = 0282 00080033 0009 000A1E33
009021D0 = 00061FFF 000C  
009021E0 =    
009021F0 =    
00902200 =    
00902210 =    
00902220 =    
00902230 =    
00902240 =    
00902250 =    
00902260 =    
00902270 =    
00902280 =    
00902290 =  03040103 0409 00030101
009022A0 = 06810040 2200 0112008C 0200
009022B0 = 15A24000 00010054 01000201 0200060A


Regards,
Abdul Rasheed

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


Re: [U-Boot] [PATCH] net: MVGBE don't automatically select PHYLIB

2018-05-17 Thread Stefan Roese

Hi Joe,

On 17.05.2018 11:03, Chris Packham wrote:

Not all users of MVGBE need PHYLIB and it increases the size of the
openrd images too much.

Fixes: commit ed52ea507f12 ("net: add Kconfig for MVGBE")
Signed-off-by: Chris Packham 
Cc: Tom Rini 
Cc: Stefan Roese 
---

  drivers/net/Kconfig | 1 -
  1 file changed, 1 deletion(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index c962d7a72c0c..f2cc75f494e8 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -181,7 +181,6 @@ config FTMAC100
  config MVGBE
bool "Marvell Orion5x/Kirkwood network interface support"
depends on KIRKWOOD || ORION5X
-   select PHYLIB
help
  This driver supports the network interface units in the
  Marvell Orion5x and Kirkwood SoCs



Joe, are you okay with me pulling this patch via the Marvell
repository? As it fixes a size limitation error on some of the
Kirkwood board, where I have some device-tree patches queued.

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


Re: [U-Boot] [PATCH] twister: Let SPL load U-Boot from MMC

2018-05-17 Thread Stefano Babic
Hi Ladislav,

On 14/05/2018 09:17, Ladislav Michl wrote:
> MMC is not initialized in SPL, so it cannot load u-boot.img
> preventing boot from MMC.
> 
> Also driver specific functions are guarded with generic
> configuration options which leads to build failures when device
> driver is not enabled in config. Fix that by using driver
> specific defines.
> 
> Signed-off-by: Ladislav Michl 
> ---
>  Stefano,
> 
>  if want this patch to be splitted, just let me know.
>  I didn't want to make it two fewliners...
> 

Patch is fine IMHO. It will be pushed by Tom's TI tree.

>  board/technexion/twister/twister.c | 17 -
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/board/technexion/twister/twister.c 
> b/board/technexion/twister/twister.c
> index 1166886e1d..0590e5f8af 100644
> --- a/board/technexion/twister/twister.c
> +++ b/board/technexion/twister/twister.c
> @@ -18,10 +18,8 @@
>  #include 
>  #include 
>  #include 
> -#ifdef CONFIG_USB_EHCI_HCD
>  #include 
>  #include 
> -#endif
>  #include "twister.h"
>  
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -45,7 +43,7 @@ static const u32 gpmc_XR16L2751[] = {
>   XR16L2751_GPMC_CONFIG6,
>  };
>  
> -#ifdef CONFIG_USB_EHCI_HCD
> +#ifdef CONFIG_USB_EHCI_OMAP
>  static struct omap_usbhs_board_data usbhs_bdata = {
>   .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
>   .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
> @@ -118,19 +116,20 @@ void set_muxconf_regs(void)
>  
>  int board_eth_init(bd_t *bis)
>  {
> +#ifdef CONFIG_DRIVER_TI_EMAC
>   davinci_emac_initialize();
> -
> +#endif
>   /* init cs for extern lan */
>   enable_gpmc_cs_config(gpmc_smc911, _cfg->cs[5],
>   CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
> - if (smc911x_initialize(0, CONFIG_SMC911X_BASE) <= 0)
> - printf("\nError initializing SMC911x controlleri\n");
> -
> +#ifdef CONFIG_SMC911X
> + return smc911x_initialize(0, CONFIG_SMC911X_BASE);
> +#else
>   return 0;
> +#endif
>  }
>  
> -#if defined(CONFIG_MMC_OMAP_HS) && \
> - !defined(CONFIG_SPL_BUILD)
> +#if defined(CONFIG_MMC_OMAP_HS)
>  int board_mmc_init(bd_t *bis)
>  {
>   return omap_mmc_init(0, 0, 0, -1, -1);
> 

Acked-by: Stefano Babic 

Best regards,
Stefano Babic

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


Re: [U-Boot] [PATCH V6 0/2] Update sabrelite and nitrogen6x boards to use distro boot support

2018-05-17 Thread Stefano Babic
Hi Guillaume,

On 18/04/2018 17:04, Guillaume GARDET wrote:
> This patch serie updates sabrelite and nitrogen6x boards to use distro boot 
> support.
> Sabrelite has been boot tested with boot.scr script and EFI/Grub2 on mmc0 and 
> mmc1 slots.
> Nitrogen6* boards have been build tested only.
> 
> Currently, only the Sabrelite has fdtfile defined.
> 

Fine, but Troy is the maintainer for this board and I have not yet seen
if he agrees to switch the board to the distro environment. I would like
to have his ACK before pushing this.

Best regards,
Stefano Babic

> Signed-off-by: Guillaume GARDET 
> Cc: Troy Kisky 
> Cc: Stefano Babic 
> Cc: Fabio Estevam 
> Cc: Gary Bisson 
> 
> Changes in V6:
>   * added CONFIG_CMD_GPT to sabrelite defconfig
>   * remove CONFIG_ARCH_MISC_INIT to sabrelite defconfig
> 
> Changes in V5:
>   * remove obsolete code from include/configs/nitrogen6x.h
>   
> Changes in V4:
>   * Remove imx6 soc definition
>   * Change comment on not defined fdtfile (no more fallback)
> 
> Changes in V3:
>   * Add imx6 soc definition
>   * Also update nitrogen6x config, not only sabrelite
>   * Split mx6qsabrelite_defconfig update to a separate patch
> Changes in V2:
>   * add mx6qsabrelite_defconfig update
> 
> 
> Guillaume GARDET (2):
>   imx6: Convert sabrelite and nitrogen6x boards to distro boot support
>   imx6: sabrelite: update defconfig to use distro defaults
> 
>  configs/mx6qsabrelite_defconfig |  15 ++--
>  include/configs/nitrogen6x.h| 179 
> ++--
>  2 files changed, 48 insertions(+), 146 deletions(-)
> 


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


  1   2   >