[U-Boot] [PATCH 2/3] pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

2017-10-16 Thread Masahiro Yamada
The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

  lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
  lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

Signed-off-by: Masahiro Yamada 
---

 Makefile   |  2 +-
 scripts/Makefile.spl   |  4 +--
 scripts/dtc/Makefile   |  3 +++
 scripts/dtc/pylibfdt/.gitignore|  4 +++
 scripts/dtc/pylibfdt/Makefile  | 30 ++
 .../dtc/pylibfdt/libfdt.i_shipped  |  0
 {lib/libfdt => scripts/dtc}/pylibfdt/setup.py  |  0
 tools/.gitignore   |  4 ---
 tools/Makefile | 30 --
 tools/binman/binman.py |  2 +-
 10 files changed, 41 insertions(+), 38 deletions(-)
 create mode 100644 scripts/dtc/pylibfdt/.gitignore
 create mode 100644 scripts/dtc/pylibfdt/Makefile
 rename lib/libfdt/pylibfdt/libfdt.i => scripts/dtc/pylibfdt/libfdt.i_shipped 
(100%)
 rename {lib/libfdt => scripts/dtc}/pylibfdt/setup.py (100%)

diff --git a/Makefile b/Makefile
index 888486b..0044503 100644
--- a/Makefile
+++ b/Makefile
@@ -1380,7 +1380,7 @@ $(timestamp_h): $(srctree)/Makefile FORCE
$(call filechk,timestamp.h)
 
 checkbinman: tools
-   @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \
+   @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt 
$(PYTHON) )); then \
echo >&2; \
echo >&2 '*** binman needs the Python libfdt library.'; \
echo >&2 '*** Either install it on your system, or try:'; \
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 49b27ac..065bb25 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -257,7 +257,7 @@ quiet_cmd_fdtgrep = FDTGREP $@
 $(obj)/$(SPL_BIN).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
$(call if_changed,fdtgrep)
 
-pythonpath = PYTHONPATH=tools
+pythonpath = PYTHONPATH=scripts/dtc/pylibfdt
 
 quiet_cmd_dtocc = DTOC C  $@
 cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb 
-o $@ platdata
@@ -381,7 +381,7 @@ ifneq ($(cmd_files),)
 endif
 
 checkdtoc: tools
-   @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \
+   @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt 
$(PYTHON) )); then \
echo '*** dtoc needs the Python libfdt library. Either '; \
echo '*** install it on your system, or try:'; \
echo '***'; \
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 2a48022..f4a16ed 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -29,3 +29,6 @@ $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
 
 # generated files need to be cleaned explicitly
 clean-files:= dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h
+
+# Added for U-Boot
+subdir-y += pylibfdt
diff --git a/scripts/dtc/pylibfdt/.gitignore b/scripts/dtc/pylibfdt/.gitignore
new file mode 100644
index 000..033f23d
--- /dev/null
+++ b/scripts/dtc/pylibfdt/.gitignore
@@ -0,0 +1,4 @@
+/_libfdt.so
+/libfdt.py
+/libfdt.pyc
+/libfdt_wrap.c
diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile
new file mode 100644
index 000..01d5e0f
--- /dev/null
+++ b/scripts/dtc/pylibfdt/Makefile
@@ -0,0 +1,30 @@
+# Unfortunately setup.py below cannot handle srctree being ".." which it often
+# is. It fails with an error like:
+# Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o:
+#No such file or directory
+# To fix this, use an absolute path.
+LIBFDT_srcdir = $(abspath $(srctree)/$(src)/../libfdt)
+
+include $(LIBFDT_srcdir)/Makefile.libfdt
+
+# Unfortunately setup.py (or actually the Python distutil implementation) puts
+# files into the same directory as the .i file. We cannot touch the source
+# directory, so we "ship" .i file into the objtree.
+PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \
+   $(obj)/libfdt.i
+
+quiet_cmd_pymod = PYMOD   $@
+  cmd_pymod = unset CC; unset CROSS_COMPILE; unset CFLAGS;\
+   LDFLAGS="$(HOSTLDFLAGS)" \
+   VERSION="u-boot-$(UBOOTVERSION)" \
+   CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \
+   SOURCES="$(PYLIBFDT_srcs)" \
+   SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)

[U-Boot] [PATCH 1/3] dtc: libfdt: import fdt_addresses.c and fdt_overlay.c

2017-10-16 Thread Masahiro Yamada
I will move the pylibfdt build script under the scripts/dtc/ in the
next commit.  We need two more files to build the pylibfdt.

We have almost same copies in lib/libfdt, but we are collecting all
DTC-derived files into scripts/dtc.

Import fdt_addresses.c and fdt_overlay.c from DTC v1.4.5.

Signed-off-by: Masahiro Yamada 
---

 scripts/dtc/libfdt/fdt_addresses.c |  96 +
 scripts/dtc/libfdt/fdt_overlay.c   | 861 +
 2 files changed, 957 insertions(+)
 create mode 100644 scripts/dtc/libfdt/fdt_addresses.c
 create mode 100644 scripts/dtc/libfdt/fdt_overlay.c

diff --git a/scripts/dtc/libfdt/fdt_addresses.c 
b/scripts/dtc/libfdt/fdt_addresses.c
new file mode 100644
index 000..eff4dbc
--- /dev/null
+++ b/scripts/dtc/libfdt/fdt_addresses.c
@@ -0,0 +1,96 @@
+/*
+ * libfdt - Flat Device Tree manipulation
+ * Copyright (C) 2014 David Gibson 
+ *
+ * libfdt is dual licensed: you can use it either under the terms of
+ * the GPL, or the BSD license, at your option.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ *
+ * Alternatively,
+ *
+ *  b) Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *copyright notice, this list of conditions and the following
+ *disclaimer in the documentation and/or other materials
+ *provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "libfdt_env.h"
+
+#include 
+#include 
+
+#include "libfdt_internal.h"
+
+int fdt_address_cells(const void *fdt, int nodeoffset)
+{
+   const fdt32_t *ac;
+   int val;
+   int len;
+
+   ac = fdt_getprop(fdt, nodeoffset, "#address-cells", &len);
+   if (!ac)
+   return 2;
+
+   if (len != sizeof(*ac))
+   return -FDT_ERR_BADNCELLS;
+
+   val = fdt32_to_cpu(*ac);
+   if ((val <= 0) || (val > FDT_MAX_NCELLS))
+   return -FDT_ERR_BADNCELLS;
+
+   return val;
+}
+
+int fdt_size_cells(const void *fdt, int nodeoffset)
+{
+   const fdt32_t *sc;
+   int val;
+   int len;
+
+   sc = fdt_getprop(fdt, nodeoffset, "#size-cells", &len);
+   if (!sc)
+   return 2;
+
+   if (len != sizeof(*sc))
+   return -FDT_ERR_BADNCELLS;
+
+   val = fdt32_to_cpu(*sc);
+   if ((val < 0) || (val > FDT_MAX_NCELLS))
+   return -FDT_ERR_BADNCELLS;
+
+   return val;
+}
diff --git a/scripts/dtc/libfdt/fdt_overlay.c b/scripts/dtc/libfdt/fdt_overlay.c
new file mode 100644
index 000..bd81241
--- /dev/null
+++ b/scripts/dtc/libfdt/fdt_overlay.c
@@ -0,0 +1,861 @@
+#include "libfdt_env.h"
+
+#include 
+#include 
+
+#include "libfdt_internal.h"
+
+/**
+ * overlay_get_target_phandle - retrieves the target phandle of a fragment
+ * @fdto: pointer to the device tree overlay blob
+ * @fragment: node offset of the fragment in the overlay
+ *
+ * overlay_get_target_phandle() retrieves the target phandle of an
+ * overlay fragment when that fragment uses a phandle (target
+ * property) instead of a path (target-path property).
+ *
+ * returns:
+ *  the phandle pointed by the target property
+ * 

[U-Boot] [PATCH 0/3] pylibfdt: compile pylibfdt in scripts/dtc/pylibfdt only when necessary

2017-10-16 Thread Masahiro Yamada



Masahiro Yamada (3):
  dtc: libfdt: import fdt_addresses.c and fdt_overlay.c
  pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile
  pylibfdt: compile pylibfdt only when dtoc/binman is necessary

 Makefile   |  17 +-
 arch/arm/Kconfig   |   1 +
 arch/x86/Kconfig   |   1 +
 dts/Kconfig|  13 +
 scripts/Makefile.spl   |  17 +-
 scripts/dtc/Makefile   |   3 +
 scripts/dtc/libfdt/fdt_addresses.c |  96 +++
 scripts/dtc/libfdt/fdt_overlay.c   | 861 +
 scripts/dtc/pylibfdt/.gitignore|   4 +
 scripts/dtc/pylibfdt/Makefile  |  30 +
 .../dtc/pylibfdt/libfdt.i_shipped  |   0
 {lib/libfdt => scripts/dtc}/pylibfdt/setup.py  |   0
 tools/.gitignore   |   4 -
 tools/Makefile |  30 -
 tools/binman/binman.py |   2 +-
 15 files changed, 1015 insertions(+), 64 deletions(-)
 create mode 100644 scripts/dtc/libfdt/fdt_addresses.c
 create mode 100644 scripts/dtc/libfdt/fdt_overlay.c
 create mode 100644 scripts/dtc/pylibfdt/.gitignore
 create mode 100644 scripts/dtc/pylibfdt/Makefile
 rename lib/libfdt/pylibfdt/libfdt.i => scripts/dtc/pylibfdt/libfdt.i_shipped 
(100%)
 rename {lib/libfdt => scripts/dtc}/pylibfdt/setup.py (100%)

-- 
2.7.4

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


[U-Boot] [PATCH 3/3] pylibfdt: compile pylibfdt only when dtoc/binman is necessary

2017-10-16 Thread Masahiro Yamada
Currently, pylibfdt is always compiled if swig is installed on your
machine.  It is really annoying because most of targets (excepts
x86, sunxi, rockchip) do not use dtoc or binman.

"checkbinman" and "checkdtoc" are wrong.  It is odd that the final
build stage checks if we have built necessary tools.  If your platform
depends on dtoc/binman, you must be able to build pylibfdt.  If swig
is not installed, it should fail immediately.

I added PYLIBFDT, DTOC, BINMAN entries to Kconfig.  They should be
property select:ed by platforms that need them.  Kbuild will descend
into scripts/dtc/pylibfdt/ only when CONFIG_PYLIBFDT is enabled.

Signed-off-by: Masahiro Yamada 
---

 Makefile | 17 ++---
 arch/arm/Kconfig |  1 +
 arch/x86/Kconfig |  1 +
 dts/Kconfig  | 13 +
 scripts/Makefile.spl | 15 ++-
 scripts/dtc/Makefile |  2 +-
 6 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/Makefile b/Makefile
index 0044503..627a639 100644
--- a/Makefile
+++ b/Makefile
@@ -1135,7 +1135,7 @@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \
 
 u-boot.rom: u-boot-x86-16bit.bin u-boot.bin \
$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
-   $(if $(CONFIG_HAVE_REFCODE),refcode.bin) checkbinman FORCE
+   $(if $(CONFIG_HAVE_REFCODE),refcode.bin) FORCE
$(call if_changed,binman)
 
 OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec
@@ -1144,8 +1144,7 @@ u-boot-x86-16bit.bin: u-boot FORCE
 endif
 
 ifneq ($(CONFIG_ARCH_SUNXI),)
-u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb \
-   checkbinman FORCE
+u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE
$(call if_changed,binman)
 endif
 
@@ -1379,18 +1378,6 @@ $(version_h): include/config/uboot.release FORCE
 $(timestamp_h): $(srctree)/Makefile FORCE
$(call filechk,timestamp.h)
 
-checkbinman: tools
-   @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt 
$(PYTHON) )); then \
-   echo >&2; \
-   echo >&2 '*** binman needs the Python libfdt library.'; \
-   echo >&2 '*** Either install it on your system, or try:'; \
-   echo >&2 '***'; \
-   echo >&2 '*** sudo apt-get install swig libpython-dev'; \
-   echo >&2 '***'; \
-   echo >&2 '*** to have U-Boot build its own version.'; \
-   false; \
-   fi
-
 # ---
 quiet_cmd_cpp_lds = LDS $@
 cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 64e0ee4..d69141a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -682,6 +682,7 @@ config ARCH_SOCFPGA
 
 config ARCH_SUNXI
bool "Support sunxi (Allwinner) SoCs"
+   select BINMAN
select CMD_GPIO
select CMD_MMC if MMC
select CMD_USB if DISTRO_DEFAULTS
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 38a6187..9d12a98 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -152,6 +152,7 @@ config SMM_TSEG_SIZE
 config X86_RESET_VECTOR
bool
default n
+   select BINMAN
 
 # The following options control where the 16-bit and 32-bit init lies
 # If SPL is enabled then it normally holds this init code, and U-Boot proper
diff --git a/dts/Kconfig b/dts/Kconfig
index daa757d..0cef225 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -8,6 +8,17 @@ config SUPPORT_OF_CONTROL
 config DTC
bool
 
+config PYLIBFDT
+   bool
+
+config DTOC
+   bool
+   select PYLIBFDT
+
+config BINMAN
+   bool
+   select DTOC
+
 menu "Device Tree Control"
depends on SUPPORT_OF_CONTROL
 
@@ -231,6 +242,7 @@ config OF_SPL_REMOVE_PROPS
 config SPL_OF_PLATDATA
bool "Generate platform data for use in SPL"
depends on SPL_OF_CONTROL
+   select DTOC
help
  For very constrained SPL environments the overhead of decoding
  device tree nodes and converting their contents into platform data
@@ -252,6 +264,7 @@ config SPL_OF_PLATDATA
 config TPL_OF_PLATDATA
bool "Generate platform data for use in TPL"
depends on TPL_OF_CONTROL
+   select DTOC
help
  For very constrained SPL environments the overhead of decoding
  device tree nodes and converting their contents into platform data
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 065bb25..ca04476 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -276,10 +276,10 @@ PHONY += dts_dir
 dts_dir:
$(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts)
 
-include/generated/dt-structs-gen.h: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc
+include/generated/dt-structs-gen.h: $(obj)/$(SPL_BIN).dtb dts_dir FORCE
$(call if_changed,dtoch)
 
-$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc
+$(obj)/dts/dt-platdata.c: $(obj)/$(S

Re: [U-Boot] [PATCH 1/3] dtc: libfdt: import fdt_addresses.c and fdt_overlay.c

2017-10-16 Thread Tom Rini
On Tue, Oct 17, 2017 at 10:11:41AM +0900, Masahiro Yamada wrote:
> I will move the pylibfdt build script under the scripts/dtc/ in the
> next commit.  We need two more files to build the pylibfdt.
> 
> We have almost same copies in lib/libfdt, but we are collecting all
> DTC-derived files into scripts/dtc.
> 
> Import fdt_addresses.c and fdt_overlay.c from DTC v1.4.5.
> 
> Signed-off-by: Masahiro Yamada 

Has Rob's patch to re-sync the kernel with v1.4.5-and-change been
applied?  Moving forward I'd like to try and keep us in-sync with the
version the kernel is using (we're ahead of the kernel until that change
goes in, and then I think behind).  Thanks!

-- 
Tom


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


[U-Boot] [ANN] U-Boot v2017.11-rc2 released

2017-10-16 Thread Tom Rini
Hey all,

It's release day and v2017.11-rc2 is out.  I'm mostly happy with the
size of the changes here and I did remember to sync the defconfigs prior
to tagging.

At this point, any changes that come in need to be clear fixes to a
problem or Kconfig migrations that can be shown as correct.

I hope that this release will migrate over to the FTP server, we shall
see shortly.

Things look on track for -rc3 on the 30th of October and -rc4 on the 6th
of November.  Thanks all!

-- 
Tom


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


Re: [U-Boot] libfdt: give setup.py optional interpreter

2017-10-16 Thread Tom Rini
On Mon, Oct 16, 2017 at 08:48:16PM -0400, Tom Rini wrote:
> On Thu, Oct 12, 2017 at 09:32:41PM -0500, Matt Weber wrote:
> 
> > If building in a sandboxed environment where a
> > alternate python interpreter is desired. Allow
> > configuring of the PYTHON variable to specify
> > the interpreter to invoke setup.py.
> > 
> > Signed-off-by: Matthew Weber 
> 
> Applied to u-boot/master, thanks!

No, no it wasn't, bad me for not cleaning that out of my bundle after
noticing it wasn't applicable and skipping 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] [RFC] MAINTAINERS: Add myself as RCar/RMobile comaintainer

2017-10-16 Thread Nobuhiro Iwamatsu
Hi,

2017-10-15 21:53 GMT+09:00 Marek Vasut :
> To help out with the RCar/RMobile upstreaming, I'm adding myself
> as the RCar/RMobile maintainer.

Thanks for your help.

Acked-by: Nobuhiro Iwamatsu 

>
> Signed-off-by: Marek Vasut 
> Cc: Nobuhiro Iwamatsu 
> ---
>  MAINTAINERS | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b167b028ec..b3a51ba7a8 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -127,6 +127,7 @@ F:  arch/arm/include/asm/arch-pxa/
>
>  ARM RENESAS RMOBILE/R-CAR
>  M: Nobuhiro Iwamatsu 
> +M: Marek Vasut 
>  S: Maintained
>  T: git git://git.denx.de/u-boot-sh.git
>  F: arch/arm/mach-rmobile/
> --
> 2.11.0
>



-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 11/20] arm: socfpga: Add DDR driver for Arria 10

2017-10-16 Thread Dinh Nguyen


On 10/13/2017 03:08 AM, tien.fong.c...@intel.com wrote:
> From: Tien Fong Chee 
> 
> Add DDR driver suppport for Arria 10.

s/suppport/support

> 
> Signed-off-by: Tien Fong Chee 
> ---
>  arch/arm/mach-socfpga/include/mach/sdram.h |   2 +
>  arch/arm/mach-socfpga/include/mach/sdram_arria10.h |   2 +
>  drivers/ddr/altera/Makefile|   1 +
>  drivers/ddr/altera/sdram_arria10.c | 736 
> +
>  4 files changed, 741 insertions(+)
>  create mode 100644 drivers/ddr/altera/sdram_arria10.c
> 
> diff --git a/arch/arm/mach-socfpga/include/mach/sdram.h 
> b/arch/arm/mach-socfpga/include/mach/sdram.h
> index 137e073..33f830b 100644
> --- a/arch/arm/mach-socfpga/include/mach/sdram.h
> +++ b/arch/arm/mach-socfpga/include/mach/sdram.h
> @@ -10,6 +10,8 @@
>  
>  #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
>  #include 
> +#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
> +#include 
>  #endif
>  
>  #endif
> diff --git a/arch/arm/mach-socfpga/include/mach/sdram_arria10.h 
> b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
> index 1d7b7c1..e7a2503 100644
> --- a/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
> +++ b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
> @@ -8,6 +8,7 @@
>  #define _SOCFPGA_SDRAM_ARRIA10_H_
>  
>  #ifndef __ASSEMBLY__
> +int ddr_calibration_sequence(void);
>  
>  struct socfpga_ecc_hmc {
>   u32 ip_rev_id;
> @@ -204,6 +205,7 @@ struct socfpga_io48_mmr {
>   u32 niosreserve1;
>   u32 niosreserve2;
>  };
> +
>  #endif /*__ASSEMBLY__*/
>  
>  #define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_MASK  0x1F00
> diff --git a/drivers/ddr/altera/Makefile b/drivers/ddr/altera/Makefile
> index ac4ab85..02f8b7c 100644
> --- a/drivers/ddr/altera/Makefile
> +++ b/drivers/ddr/altera/Makefile
> @@ -10,4 +10,5 @@
>  
>  ifdef CONFIG_ALTERA_SDRAM
>  obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram_gen5.o sequencer.o
> +obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += sdram_arria10.o
>  endif
> diff --git a/drivers/ddr/altera/sdram_arria10.c 
> b/drivers/ddr/altera/sdram_arria10.c
> new file mode 100644
> index 000..be8aff3
> --- /dev/null
> +++ b/drivers/ddr/altera/sdram_arria10.c
> @@ -0,0 +1,736 @@
> +/*
> + * Copyright (C) 2017 Intel Corporation 
> + *
> + * SPDX-License-Identifier:GPL-2.0
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +static void sdram_mmr_init(void);
> +static unsigned long long sdram_size_calc(void);

Use uint64_t

> +
> +/* FAWBANK - Number of Bank of a given device involved in the FAW period. */
> +#define ARRIA10_SDR_ACTIVATE_FAWBANK (0x1)
> +
> +#define ARRIA_DDR_CONFIG(A, B, C, R) \
> + (((A) << 24) | ((B) << 16) | ((C) << 8) | (R))
> +#define DDR_CONFIG_ELEMENTS  ARRAY_SIZE(ddr_config)
> +#define DDR_REG_SEQ2CORE0xFFD0507C
> +#define DDR_REG_CORE2SEQ0xFFD05078
> +#define DDR_READ_LATENCY_DELAY   40
> +#define DDR_SIZE_2GB_HEX 0x8000
> +#define DDR_MAX_TRIES0x0010
> +
> +#define IO48_MMR_DRAMSTS 0xFFCFA0EC
> +#define IO48_MMR_NIOS2_RESERVE0  0xFFCFA110
> +#define IO48_MMR_NIOS2_RESERVE1  0xFFCFA114
> +#define IO48_MMR_NIOS2_RESERVE2  0xFFCFA118
> +
> +#define SEQ2CORE_MASK0xF
> +#define CORE2SEQ_INT_REQ 0xF
> +#define SEQ2CORE_INT_RESP_BIT3
> +
> +static const struct socfpga_ecc_hmc *socfpga_ecc_hmc_base =
> + (void *)SOCFPGA_SDR_ADDRESS;
> +static const struct socfpga_noc_ddr_scheduler 
> *socfpga_noc_ddr_scheduler_base =
> + (void *)SOCFPGA_SDR_SCHEDULER_ADDRESS;
> +static const struct socfpga_noc_fw_ddr_mpu_fpga2sdram
> + *socfpga_noc_fw_ddr_mpu_fpga2sdram_base =
> + (void *)SOCFPGA_SDR_FIREWALL_MPU_FPGA_ADDRESS;
> +static const struct socfpga_noc_fw_ddr_l3 *socfpga_noc_fw_ddr_l3_base =
> + (void *)SOCFPGA_SDR_FIREWALL_L3_ADDRESS;
> +static const struct socfpga_io48_mmr *socfpga_io48_mmr_base =
> + (void *)SOCFPGA_HMC_MMR_IO48_ADDRESS;
> +
> +/* The followring are the supported configurations */

s/followring/following

> +static u32 ddr_config[] = {
> + /* Chip - Row - Bank - Column Style */
> + /* All Types */
> + ARRIA_DDR_CONFIG(0, 3, 10, 12),
> + ARRIA_DDR_CONFIG(0, 3, 10, 13),
> + ARRIA_DDR_CONFIG(0, 3, 10, 14),
> + ARRIA_DDR_CONFIG(0, 3, 10, 15),
> + ARRIA_DDR_CONFIG(0, 3, 10, 16),
> + ARRIA_DDR_CONFIG(0, 3, 10, 17),
> + /* LPDDR x16 */
> + ARRIA_DDR_CONFIG(0, 3, 11, 14),
> + ARRIA_DDR_CONFIG(0, 3, 11, 15),
> + ARRIA_DDR_CONFIG(0, 3, 11, 16),
> + ARRIA_DDR_CONFIG(0, 3, 12, 15),
> + /* DDR4 Only */
> + ARRIA_DDR_CONFIG(0, 4, 10, 14),
> + ARRIA_DDR_CONFIG(0, 4, 10, 15),
> + ARRIA_DDR_CONFIG(0, 4, 10, 16),
> + ARRIA_DDR_CONFIG(0, 4, 10, 17), /* 14 */
> + /* Chip - Bank - Row - Column Style */
> + ARRI

Re: [U-Boot] [PATCH] ARM: rmobile: Enable xHCI on RCar Gen3 boards

2017-10-16 Thread Nobuhiro Iwamatsu
Hi,

2017-10-15 22:02 GMT+09:00 Marek Vasut :
> Enable the XHCI support on all boards.
>
> Signed-off-by: Marek Vasut 
> Cc: Nobuhiro Iwamatsu 

Applied to rmobile branch.

Thanks,
  Nobuhiro

> ---
>  configs/r8a7795_salvator-x_defconfig | 1 +
>  configs/r8a7795_ulcb_defconfig   | 1 +
>  configs/r8a7796_salvator-x_defconfig | 1 +
>  configs/r8a7796_ulcb_defconfig   | 1 +
>  4 files changed, 4 insertions(+)
>
> diff --git a/configs/r8a7795_salvator-x_defconfig 
> b/configs/r8a7795_salvator-x_defconfig
> index e32aceba54..e010ce747c 100644
> --- a/configs/r8a7795_salvator-x_defconfig
> +++ b/configs/r8a7795_salvator-x_defconfig
> @@ -45,6 +45,7 @@ CONFIG_DM_REGULATOR_GPIO=y
>  CONFIG_SCIF_CONSOLE=y
>  CONFIG_USB=y
>  CONFIG_DM_USB=y
> +CONFIG_USB_XHCI_HCD=y
>  CONFIG_USB_EHCI_HCD=y
>  CONFIG_USB_EHCI_GENERIC=y
>  CONFIG_USB_STORAGE=y
> diff --git a/configs/r8a7795_ulcb_defconfig b/configs/r8a7795_ulcb_defconfig
> index 50d36891cc..eab9c4c8a7 100644
> --- a/configs/r8a7795_ulcb_defconfig
> +++ b/configs/r8a7795_ulcb_defconfig
> @@ -42,6 +42,7 @@ CONFIG_DM_REGULATOR_GPIO=y
>  CONFIG_SCIF_CONSOLE=y
>  CONFIG_USB=y
>  CONFIG_DM_USB=y
> +CONFIG_USB_XHCI_HCD=y
>  CONFIG_USB_EHCI_HCD=y
>  CONFIG_USB_EHCI_GENERIC=y
>  CONFIG_USB_STORAGE=y
> diff --git a/configs/r8a7796_salvator-x_defconfig 
> b/configs/r8a7796_salvator-x_defconfig
> index 8f22645efb..5ff803f0c2 100644
> --- a/configs/r8a7796_salvator-x_defconfig
> +++ b/configs/r8a7796_salvator-x_defconfig
> @@ -46,6 +46,7 @@ CONFIG_DM_REGULATOR_GPIO=y
>  CONFIG_SCIF_CONSOLE=y
>  CONFIG_USB=y
>  CONFIG_DM_USB=y
> +CONFIG_USB_XHCI_HCD=y
>  CONFIG_USB_EHCI_HCD=y
>  CONFIG_USB_EHCI_GENERIC=y
>  CONFIG_USB_STORAGE=y
> diff --git a/configs/r8a7796_ulcb_defconfig b/configs/r8a7796_ulcb_defconfig
> index c8edfabc91..1145b39919 100644
> --- a/configs/r8a7796_ulcb_defconfig
> +++ b/configs/r8a7796_ulcb_defconfig
> @@ -43,6 +43,7 @@ CONFIG_DM_REGULATOR_GPIO=y
>  CONFIG_SCIF_CONSOLE=y
>  CONFIG_USB=y
>  CONFIG_DM_USB=y
> +CONFIG_USB_XHCI_HCD=y
>  CONFIG_USB_EHCI_HCD=y
>  CONFIG_USB_EHCI_GENERIC=y
>  CONFIG_USB_STORAGE=y
> --
> 2.11.0
>



-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2017-10-16 Thread Suneel Garapati
Hi Bin/Simon,

Request to know if this will be applied for v2017.11

Regards,
Suneel

On Sun, Sep 24, 2017 at 7:13 PM, Simon Glass  wrote:
> On 20 September 2017 at 23:09, Suneel Garapati  wrote:
>> add blk child devices to ignore list while displaying usb tree graph,
>> also preamble should not be set for blk child devices.
>> add usb_emul to ignore list in usb_show_info. otherwise usb tree and
>> info commands may cause crash treating blk as usb device.
>>
>> Signed-off-by: Suneel Garapati 
>> Reviewed-by: Bin Meng 
>> Tested-by: Bin Meng 
>> ---
>> Changes v5:
>>  - add usb_emul to ignore list in usb_show_info
>>  - modify description
>> Changes v4:
>>  - do not set preamble if child is block device for mass storage
>> Changes v3:
>>  - remove 'check on parent uclass' in description
>> Changes v2:
>>  - remove check on parent uclass
>> Changes v1:
>>  - add separate check on blk uclass
>>  - modify description
>>  - add separate check on parent uclass as usb
>>
>>  cmd/usb.c | 22 +++---
>>  1 file changed, 19 insertions(+), 3 deletions(-)
>
> Reviewed-by: Simon Glass 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2017-10-16 Thread Bin Meng
+Marek, Tom,

On Tue, Oct 17, 2017 at 11:14 AM, Suneel Garapati
 wrote:
> Hi Bin/Simon,
>
> Request to know if this will be applied for v2017.11
>

Not sure which of you should pick this up for v2017.11.

> Regards,
> Suneel
>

Suneel, please avoid top-posting next time. thanks!

> On Sun, Sep 24, 2017 at 7:13 PM, Simon Glass  wrote:
>> On 20 September 2017 at 23:09, Suneel Garapati  
>> wrote:
>>> add blk child devices to ignore list while displaying usb tree graph,
>>> also preamble should not be set for blk child devices.
>>> add usb_emul to ignore list in usb_show_info. otherwise usb tree and
>>> info commands may cause crash treating blk as usb device.
>>>
>>> Signed-off-by: Suneel Garapati 
>>> Reviewed-by: Bin Meng 
>>> Tested-by: Bin Meng 
>>> ---
>>> Changes v5:
>>>  - add usb_emul to ignore list in usb_show_info
>>>  - modify description
>>> Changes v4:
>>>  - do not set preamble if child is block device for mass storage
>>> Changes v3:
>>>  - remove 'check on parent uclass' in description
>>> Changes v2:
>>>  - remove check on parent uclass
>>> Changes v1:
>>>  - add separate check on blk uclass
>>>  - modify description
>>>  - add separate check on parent uclass as usb
>>>
>>>  cmd/usb.c | 22 +++---
>>>  1 file changed, 19 insertions(+), 3 deletions(-)
>>
>> Reviewed-by: Simon Glass 

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


Re: [U-Boot] [PATCH v3 12/20] configs: Add DDR Kconfig support for Arria 10

2017-10-16 Thread Dinh Nguyen


On 10/13/2017 03:08 AM, tien.fong.c...@intel.com wrote:
> From: Tien Fong Chee 
> 
> This patch enables DDR Kconfig support for Arria 10.
> 
> Signed-off-by: Tien Fong Chee 
> ---
>  arch/arm/mach-socfpga/Kconfig | 1 +
>  drivers/ddr/altera/Kconfig| 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 

Reviewed-by: Dinh Nguyen 

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


Re: [U-Boot] Silencing SPL output

2017-10-16 Thread Heiko Schocher

Hello Chris,

Am 16.10.2017 um 23:08 schrieb Chris Packham:

Hi Heiko,

On Mon, Oct 16, 2017 at 5:24 PM, Heiko Schocher  wrote:

Hello Chris,

Am 16.10.2017 um 02:38 schrieb Chris Packham:


This is probably something of a foot-gun but here we go...

I was wondering if it's worth providing the ability to silence the
output from the SPL. CONFIG_SILENT_CONSOLE exist for u-boot proper but
the SPL preloader_console_init bypasses anything that would set
GD_FLG_SILENT. Even if it didn't the SPL probably doesn't have access
to any environment that would allow it to be set/unset.

I was thinking about adding a SPL specific CONFIG option that would
set GD_FLG_SILENT (probably in spl_init). Aside from re-compiling
there wouldn't be any way of making the SPL loud. Is this a reasonable
idea or is it just asking for boards to be bricked with no way of
telling what went wrong?



I have a at91 based board in mainline, which has no SPL output
enabled (as there is no space for it), see:

configs/smartweb_defconfig

Do not define
CONFIG_SPL_SERIAL_SUPPORT=y



Thanks for the tip. Unfortunately disabling  CONFIG_SPL_SERIAL_SUPPORT
causes some build errors (at least for db-88f6820-amc)

   common/spl/built-in.o: In function `preloader_console_init':
common/spl/spl.c:463: undefined reference to `serial_init' >lib/built-in.o: 
In function `fdtdec_get_alias_seq':
lib/fdtdec.c:546: undefined reference to `trailing_strtol'
   drivers/built-in.o: In function
`spi_flash_probe_bus_cs':drivers/mtd/spi/sf-uclass.c:66: undefined
reference to `snprintf'
   scripts/Makefile.spl:358: recipe for target 'spl/u-boot-spl' failed

The first one looks like an appropriate #ifdef (or do/while fallback)
is missing. The others look like missing dependencies.


Yes, this has to be fixed for your arch, see for example at91:

http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/mach-at91/spl_at91.c;h=cc3341acb537c4b4edf3a241f386a44c40220c9f;hb=eb0044db392247aa1c43e29f2703418d5668018a#l124

Or may better, we should fix this in common/spl/spl.c

Hmm... error in "drivers/mtd/spi/sf-uclass.c" is strange:

code:
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_USE_TINY_PRINTF)
str = "spi_flash";
#else
char name[30];

snprintf(name, sizeof(name), "spi_flash@%d:%d", busnum, cs);
str = strdup(name);
#endif

You are sure you build for SPL ?


I was already on the fence about silencing SPL output so I'm not
planning on pursuing it. I thought I'd mention the build failures in
case someone wants to take a look.


Ah, Okay.

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


Re: [U-Boot] [PATCH v3 13/20] arm: socfpga: Enable SPL memory allocation

2017-10-16 Thread Dinh Nguyen


On 10/13/2017 03:08 AM, tien.fong.c...@intel.com wrote:
> From: Tien Fong Chee 
> 
> Enable memory allocation in SPL for preparation to enable FAT
> in SPL. Memory allocation is needed by FAT to work properly.
> 
> Signed-off-by: Tien Fong Chee 
> ---
>  include/configs/socfpga_common.h | 22 +-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 

Reviewed-by: Dinh Nguyen 

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


Re: [U-Boot] [PATCH 1/2] i2c: stm32f7_i2c: fix data abort

2017-10-16 Thread Heiko Schocher

Hello patrice,

Am 11.10.2017 um 15:30 schrieb patrice.chot...@st.com:

From: Christophe Kerello 

As "v" is a local variable in stm32_i2c_choose_solution()
"v" has to be copied into "s" to avoid data abort in
stm32_i2c_compute_timing().

Signed-off-by: Christophe Kerello 
Reviewed-by: Patrick DELAUNAY 
Signed-off-by: Patrice Chotard 
---
  drivers/i2c/stm32f7_i2c.c | 21 +++--
  1 file changed, 11 insertions(+), 10 deletions(-)


Your patch does not apply to u-boot mainline:

hs@pollux [ 4:41:31] ttbott> git am -3 mbox
Applying: i2c: stm32f7_i2c: fix data abort
Using index info to reconstruct a base tree...
M   drivers/i2c/stm32f7_i2c.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/i2c/stm32f7_i2c.c
CONFLICT (content): Merge conflict in drivers/i2c/stm32f7_i2c.c
error: Failed to merge in the changes.
Patch failed at 0001 i2c: stm32f7_i2c: fix data abort
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
hs@pollux [ 4:41:31] ttbott>

For full log see for example on the corvus board:

http://xeidos.ddns.net/tbot/id_469/html_log.html

unfold the last three 4 "control" lines ...

please fix, thanks!

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


Re: [U-Boot] [PATCH 1/3] dtc: libfdt: import fdt_addresses.c and fdt_overlay.c

2017-10-16 Thread Masahiro Yamada
2017-10-17 10:37 GMT+09:00 Tom Rini :
> On Tue, Oct 17, 2017 at 10:11:41AM +0900, Masahiro Yamada wrote:
>> I will move the pylibfdt build script under the scripts/dtc/ in the
>> next commit.  We need two more files to build the pylibfdt.
>>
>> We have almost same copies in lib/libfdt, but we are collecting all
>> DTC-derived files into scripts/dtc.
>>
>> Import fdt_addresses.c and fdt_overlay.c from DTC v1.4.5.
>>
>> Signed-off-by: Masahiro Yamada 
>
> Has Rob's patch to re-sync the kernel with v1.4.5-and-change been
> applied?  Moving forward I'd like to try and keep us in-sync with the
> version the kernel is using (we're ahead of the kernel until that change
> goes in, and then I think behind).  Thanks!
>

fdt_addresses.c and fdt_overlay.c in linux-next
are already synced with DTC 1.4.5

I will do re-sync just in case, but those two files will not change.

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


[U-Boot] [PATCH v2 3/4] pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile

2017-10-16 Thread Masahiro Yamada
The pylibfdt is used by dtoc (and, indirectly by binman), but there
is no reason why it must be generated in the tools/ directory.

Recently, U-Boot switched over to the bundled DTC, and the directory
structure under scripts/dtc/ now mirrors the upstream DTC project.
So, scripts/dtc/pylibfdt is the best location.

I also rewrote the Makefile in a cleaner Kbuild style.

The scripts from the upstream have been moved as follows:

  lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
  lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

The .i_shipped is coped to .i during building because the .i must be
located in the objtree when we build it out of tree.

Signed-off-by: Masahiro Yamada 
---

 Makefile   |  2 +-
 scripts/Makefile.spl   |  4 +--
 scripts/dtc/Makefile   |  3 +++
 scripts/dtc/pylibfdt/.gitignore|  4 +++
 scripts/dtc/pylibfdt/Makefile  | 30 ++
 .../dtc/pylibfdt/libfdt.i_shipped  |  0
 {lib/libfdt => scripts/dtc}/pylibfdt/setup.py  |  0
 tools/.gitignore   |  4 ---
 tools/Makefile | 30 --
 tools/binman/binman.py |  2 +-
 10 files changed, 41 insertions(+), 38 deletions(-)
 create mode 100644 scripts/dtc/pylibfdt/.gitignore
 create mode 100644 scripts/dtc/pylibfdt/Makefile
 rename lib/libfdt/pylibfdt/libfdt.i => scripts/dtc/pylibfdt/libfdt.i_shipped 
(100%)
 rename {lib/libfdt => scripts/dtc}/pylibfdt/setup.py (100%)

diff --git a/Makefile b/Makefile
index d074358..40cd61a 100644
--- a/Makefile
+++ b/Makefile
@@ -1380,7 +1380,7 @@ $(timestamp_h): $(srctree)/Makefile FORCE
$(call filechk,timestamp.h)
 
 checkbinman: tools
-   @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \
+   @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt 
$(PYTHON) )); then \
echo >&2; \
echo >&2 '*** binman needs the Python libfdt library.'; \
echo >&2 '*** Either install it on your system, or try:'; \
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 49b27ac..065bb25 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -257,7 +257,7 @@ quiet_cmd_fdtgrep = FDTGREP $@
 $(obj)/$(SPL_BIN).dtb: dts/dt.dtb $(objtree)/tools/fdtgrep FORCE
$(call if_changed,fdtgrep)
 
-pythonpath = PYTHONPATH=tools
+pythonpath = PYTHONPATH=scripts/dtc/pylibfdt
 
 quiet_cmd_dtocc = DTOC C  $@
 cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb 
-o $@ platdata
@@ -381,7 +381,7 @@ ifneq ($(cmd_files),)
 endif
 
 checkdtoc: tools
-   @if ! ( echo 'import libfdt' | ( PYTHONPATH=tools $(PYTHON) )); then \
+   @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt 
$(PYTHON) )); then \
echo '*** dtoc needs the Python libfdt library. Either '; \
echo '*** install it on your system, or try:'; \
echo '***'; \
diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 2a48022..f4a16ed 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -29,3 +29,6 @@ $(obj)/dtc-lexer.lex.o: $(obj)/dtc-parser.tab.h
 
 # generated files need to be cleaned explicitly
 clean-files:= dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h
+
+# Added for U-Boot
+subdir-y += pylibfdt
diff --git a/scripts/dtc/pylibfdt/.gitignore b/scripts/dtc/pylibfdt/.gitignore
new file mode 100644
index 000..033f23d
--- /dev/null
+++ b/scripts/dtc/pylibfdt/.gitignore
@@ -0,0 +1,4 @@
+/_libfdt.so
+/libfdt.py
+/libfdt.pyc
+/libfdt_wrap.c
diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile
new file mode 100644
index 000..01d5e0f
--- /dev/null
+++ b/scripts/dtc/pylibfdt/Makefile
@@ -0,0 +1,30 @@
+# Unfortunately setup.py below cannot handle srctree being ".." which it often
+# is. It fails with an error like:
+# Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o:
+#No such file or directory
+# To fix this, use an absolute path.
+LIBFDT_srcdir = $(abspath $(srctree)/$(src)/../libfdt)
+
+include $(LIBFDT_srcdir)/Makefile.libfdt
+
+# Unfortunately setup.py (or actually the Python distutil implementation) puts
+# files into the same directory as the .i file. We cannot touch the source
+# directory, so we "ship" .i file into the objtree.
+PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \
+   $(obj)/libfdt.i
+
+quiet_cmd_pymod = PYMOD   $@
+  cmd_pymod = unset CC; unset CROSS_COMPILE; unset CFLAGS;\
+   LDFLAGS="$(HOSTLDFLAGS)" \
+   VERSION="u-boot-$(UBOOTVERSION)" \
+   CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \
+   SOURCES="$(PYLIBFDT_srcs)" \
+   SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)

[U-Boot] [PATCH v2 1/4] scripts/dtc: add fdt_overlay.c and fdt_addresses.c to sync script

2017-10-16 Thread Masahiro Yamada
From: Rob Herring 

libfdt has gained some new files. We need to include them in the
kernel's copy.

Reported-by: Kyle Yan 
Signed-off-by: Rob Herring 
Signed-off-by: Masahiro Yamada 

[ Linux commit: 4322323058f010274564006d61945187a15b6361 ]

---

 scripts/dtc/update-dtc-source.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/dtc/update-dtc-source.sh b/scripts/dtc/update-dtc-source.sh
index b8ebcc6..f3e5c59 100755
--- a/scripts/dtc/update-dtc-source.sh
+++ b/scripts/dtc/update-dtc-source.sh
@@ -34,7 +34,9 @@ DTC_SOURCE="checks.c data.c dtc.c dtc.h flattree.c fstree.c 
livetree.c srcpos.c
srcpos.h treesource.c util.c util.h version_gen.h Makefile.dtc \
dtc-lexer.l dtc-parser.y"
 DTC_GENERATED="dtc-lexer.lex.c dtc-parser.tab.c dtc-parser.tab.h"
-LIBFDT_SOURCE="Makefile.libfdt fdt.c fdt.h fdt_empty_tree.c fdt_ro.c fdt_rw.c 
fdt_strerror.c fdt_sw.c fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h"
+LIBFDT_SOURCE="Makefile.libfdt fdt.c fdt.h fdt_addresses.c fdt_empty_tree.c \
+   fdt_overlay.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c \
+   fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h"
 
 get_last_dtc_version() {
git log --oneline scripts/dtc/ | grep 'upstream' | head -1 | sed -e 
's/^.* \(.*\)/\1/'
-- 
2.7.4

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


[U-Boot] [PATCH v2 2/4] scripts/dtc: Update to upstream version v1.4.5-3-gb1a60033c110

2017-10-16 Thread Masahiro Yamada
This adds the following commits from upstream:

b1a6003 tests: Add a test for overlays syntactic sugar
737b2df overlay: Add syntactic sugar version of overlays
497432f checks: Use proper format modifier for size_t
22a65c5 dtc: Bump version to v1.4.5
c575d80 Add fdtoverlay to .gitignore
b6a6f94 fdtoverlay: Sanity check blob size
8c1eb15 pylibfdt: Use Python2 explicitly
ee3d26f checks: add interrupts property check
c1e7738 checks: add gpio binding properties check
b3bbac0 checks: add phandle with arg property checks

[ sync with Linux commit: 4201d057ea91c3d6efd2db65219bc91fae413bc2 ]

Signed-off-by: Masahiro Yamada 
---

 scripts/dtc/checks.c | 280 
 scripts/dtc/dtc-lexer.lex.c_shipped  | 216 -
 scripts/dtc/dtc-parser.tab.c_shipped | 464 ++-
 scripts/dtc/dtc-parser.tab.h_shipped |   8 +-
 scripts/dtc/dtc-parser.y |  20 +-
 scripts/dtc/dtc.h|   2 +
 scripts/dtc/libfdt/fdt_addresses.c   |  96 
 scripts/dtc/libfdt/fdt_overlay.c | 861 +++
 scripts/dtc/livetree.c   |  28 ++
 scripts/dtc/version_gen.h|   2 +-
 10 files changed, 1642 insertions(+), 335 deletions(-)
 create mode 100644 scripts/dtc/libfdt/fdt_addresses.c
 create mode 100644 scripts/dtc/libfdt/fdt_overlay.c

diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c
index afabf64..08a3a29 100644
--- a/scripts/dtc/checks.c
+++ b/scripts/dtc/checks.c
@@ -956,6 +956,265 @@ static void 
check_obsolete_chosen_interrupt_controller(struct check *c,
 WARNING(obsolete_chosen_interrupt_controller,
check_obsolete_chosen_interrupt_controller, NULL);
 
+struct provider {
+   const char *prop_name;
+   const char *cell_name;
+   bool optional;
+};
+
+static void check_property_phandle_args(struct check *c,
+ struct dt_info *dti,
+ struct node *node,
+ struct property *prop,
+ const struct provider *provider)
+{
+   struct node *root = dti->dt;
+   int cell, cellsize = 0;
+
+   if (prop->val.len % sizeof(cell_t)) {
+   FAIL(c, dti, "property '%s' size (%d) is invalid, expected 
multiple of %zu in node %s",
+prop->name, prop->val.len, sizeof(cell_t), node->fullpath);
+   return;
+   }
+
+   for (cell = 0; cell < prop->val.len / sizeof(cell_t); cell += cellsize 
+ 1) {
+   struct node *provider_node;
+   struct property *cellprop;
+   int phandle;
+
+   phandle = propval_cell_n(prop, cell);
+   /*
+* Some bindings use a cell value 0 or -1 to skip over optional
+* entries when each index position has a specific definition.
+*/
+   if (phandle == 0 || phandle == -1) {
+   cellsize = 0;
+   continue;
+   }
+
+   /* If we have markers, verify the current cell is a phandle */
+   if (prop->val.markers) {
+   struct marker *m = prop->val.markers;
+   for_each_marker_of_type(m, REF_PHANDLE) {
+   if (m->offset == (cell * sizeof(cell_t)))
+   break;
+   }
+   if (!m)
+   FAIL(c, dti, "Property '%s', cell %d is not a 
phandle reference in %s",
+prop->name, cell, node->fullpath);
+   }
+
+   provider_node = get_node_by_phandle(root, phandle);
+   if (!provider_node) {
+   FAIL(c, dti, "Could not get phandle node for %s:%s(cell 
%d)",
+node->fullpath, prop->name, cell);
+   break;
+   }
+
+   cellprop = get_property(provider_node, provider->cell_name);
+   if (cellprop) {
+   cellsize = propval_cell(cellprop);
+   } else if (provider->optional) {
+   cellsize = 0;
+   } else {
+   FAIL(c, dti, "Missing property '%s' in node %s or bad 
phandle (referred from %s:%s[%d])",
+provider->cell_name,
+provider_node->fullpath,
+node->fullpath, prop->name, cell);
+   break;
+   }
+
+   if (prop->val.len < ((cell + cellsize + 1) * sizeof(cell_t))) {
+   FAIL(c, dti, "%s property size (%d) too small for cell 
size %d in %s",
+prop->name, prop->val.len, cellsize, 
node->fullpath);
+   }
+   }
+}
+
+static void check_provider_cells_property(struct check *c,
+ struct 

[U-Boot] [PATCH v2 4/4] pylibfdt: compile pylibfdt only when dtoc/binman is necessary

2017-10-16 Thread Masahiro Yamada
Currently, pylibfdt is always compiled if swig is installed on your
machine.  It is really annoying because most of targets (excepts
x86, sunxi, rockchip) do not use dtoc or binman.

"checkbinman" and "checkdtoc" are wrong.  It is odd that the final
build stage checks if we have built necessary tools.  If your platform
depends on dtoc/binman, you must be able to build pylibfdt.  If swig
is not installed, it should fail immediately.

I added PYLIBFDT, DTOC, BINMAN entries to Kconfig.  They should be
property select:ed by platforms that need them.  Kbuild will descend
into scripts/dtc/pylibfdt/ only when CONFIG_PYLIBFDT is enabled.

Signed-off-by: Masahiro Yamada 
---

 Makefile | 17 ++---
 arch/arm/Kconfig |  1 +
 arch/x86/Kconfig |  1 +
 dts/Kconfig  | 13 +
 scripts/Makefile.spl | 15 ++-
 scripts/dtc/Makefile |  2 +-
 6 files changed, 20 insertions(+), 29 deletions(-)

diff --git a/Makefile b/Makefile
index 40cd61a..8f3fcfe 100644
--- a/Makefile
+++ b/Makefile
@@ -1135,7 +1135,7 @@ cmd_ldr = $(LD) $(LDFLAGS_$(@F)) \
 
 u-boot.rom: u-boot-x86-16bit.bin u-boot.bin \
$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
-   $(if $(CONFIG_HAVE_REFCODE),refcode.bin) checkbinman FORCE
+   $(if $(CONFIG_HAVE_REFCODE),refcode.bin) FORCE
$(call if_changed,binman)
 
 OBJCOPYFLAGS_u-boot-x86-16bit.bin := -O binary -j .start16 -j .resetvec
@@ -1144,8 +1144,7 @@ u-boot-x86-16bit.bin: u-boot FORCE
 endif
 
 ifneq ($(CONFIG_ARCH_SUNXI),)
-u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb \
-   checkbinman FORCE
+u-boot-sunxi-with-spl.bin: spl/sunxi-spl.bin u-boot.img u-boot.dtb FORCE
$(call if_changed,binman)
 endif
 
@@ -1379,18 +1378,6 @@ $(version_h): include/config/uboot.release FORCE
 $(timestamp_h): $(srctree)/Makefile FORCE
$(call filechk,timestamp.h)
 
-checkbinman: tools
-   @if ! ( echo 'import libfdt' | ( PYTHONPATH=scripts/dtc/pylibfdt 
$(PYTHON) )); then \
-   echo >&2; \
-   echo >&2 '*** binman needs the Python libfdt library.'; \
-   echo >&2 '*** Either install it on your system, or try:'; \
-   echo >&2 '***'; \
-   echo >&2 '*** sudo apt-get install swig libpython-dev'; \
-   echo >&2 '***'; \
-   echo >&2 '*** to have U-Boot build its own version.'; \
-   false; \
-   fi
-
 # ---
 quiet_cmd_cpp_lds = LDS $@
 cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 64e0ee4..d69141a 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -682,6 +682,7 @@ config ARCH_SOCFPGA
 
 config ARCH_SUNXI
bool "Support sunxi (Allwinner) SoCs"
+   select BINMAN
select CMD_GPIO
select CMD_MMC if MMC
select CMD_USB if DISTRO_DEFAULTS
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 38a6187..9d12a98 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -152,6 +152,7 @@ config SMM_TSEG_SIZE
 config X86_RESET_VECTOR
bool
default n
+   select BINMAN
 
 # The following options control where the 16-bit and 32-bit init lies
 # If SPL is enabled then it normally holds this init code, and U-Boot proper
diff --git a/dts/Kconfig b/dts/Kconfig
index daa757d..0cef225 100644
--- a/dts/Kconfig
+++ b/dts/Kconfig
@@ -8,6 +8,17 @@ config SUPPORT_OF_CONTROL
 config DTC
bool
 
+config PYLIBFDT
+   bool
+
+config DTOC
+   bool
+   select PYLIBFDT
+
+config BINMAN
+   bool
+   select DTOC
+
 menu "Device Tree Control"
depends on SUPPORT_OF_CONTROL
 
@@ -231,6 +242,7 @@ config OF_SPL_REMOVE_PROPS
 config SPL_OF_PLATDATA
bool "Generate platform data for use in SPL"
depends on SPL_OF_CONTROL
+   select DTOC
help
  For very constrained SPL environments the overhead of decoding
  device tree nodes and converting their contents into platform data
@@ -252,6 +264,7 @@ config SPL_OF_PLATDATA
 config TPL_OF_PLATDATA
bool "Generate platform data for use in TPL"
depends on TPL_OF_CONTROL
+   select DTOC
help
  For very constrained SPL environments the overhead of decoding
  device tree nodes and converting their contents into platform data
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 065bb25..ca04476 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -276,10 +276,10 @@ PHONY += dts_dir
 dts_dir:
$(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts)
 
-include/generated/dt-structs-gen.h: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc
+include/generated/dt-structs-gen.h: $(obj)/$(SPL_BIN).dtb dts_dir FORCE
$(call if_changed,dtoch)
 
-$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir checkdtoc
+$(obj)/dts/dt-platdata.c: $(obj)/$(S

[U-Boot] [PATCH v2 0/4] pylibfdt: compile pylibfdt in scripts/dtc/pylibfdt only when necessary

2017-10-16 Thread Masahiro Yamada

V2: resync scripts/dtc/ with  linux-next-20171016



Masahiro Yamada (3):
  scripts/dtc: Update to upstream version v1.4.5-3-gb1a60033c110
  pylibfdt: move pylibfdt to scripts/dtc/pylibfdt and refactor makefile
  pylibfdt: compile pylibfdt only when dtoc/binman is necessary

Rob Herring (1):
  scripts/dtc: add fdt_overlay.c and fdt_addresses.c to sync script

 Makefile   |  17 +-
 arch/arm/Kconfig   |   1 +
 arch/x86/Kconfig   |   1 +
 dts/Kconfig|  13 +
 scripts/Makefile.spl   |  17 +-
 scripts/dtc/Makefile   |   3 +
 scripts/dtc/checks.c   | 280 +++
 scripts/dtc/dtc-lexer.lex.c_shipped| 216 +++---
 scripts/dtc/dtc-parser.tab.c_shipped   | 464 +--
 scripts/dtc/dtc-parser.tab.h_shipped   |   8 +-
 scripts/dtc/dtc-parser.y   |  20 +-
 scripts/dtc/dtc.h  |   2 +
 scripts/dtc/libfdt/fdt_addresses.c |  96 +++
 scripts/dtc/libfdt/fdt_overlay.c   | 861 +
 scripts/dtc/livetree.c |  28 +
 scripts/dtc/pylibfdt/.gitignore|   4 +
 scripts/dtc/pylibfdt/Makefile  |  30 +
 .../dtc/pylibfdt/libfdt.i_shipped  |   0
 {lib/libfdt => scripts/dtc}/pylibfdt/setup.py  |   0
 scripts/dtc/update-dtc-source.sh   |   4 +-
 scripts/dtc/version_gen.h  |   2 +-
 tools/.gitignore   |   4 -
 tools/Makefile |  30 -
 tools/binman/binman.py |   2 +-
 24 files changed, 1703 insertions(+), 400 deletions(-)
 create mode 100644 scripts/dtc/libfdt/fdt_addresses.c
 create mode 100644 scripts/dtc/libfdt/fdt_overlay.c
 create mode 100644 scripts/dtc/pylibfdt/.gitignore
 create mode 100644 scripts/dtc/pylibfdt/Makefile
 rename lib/libfdt/pylibfdt/libfdt.i => scripts/dtc/pylibfdt/libfdt.i_shipped 
(100%)
 rename {lib/libfdt => scripts/dtc}/pylibfdt/setup.py (100%)

-- 
2.7.4

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


Re: [U-Boot] [PATCH v2] usb: dwc3: Allocate and flush dwc->ep0_trb in a cache aligned manner

2017-10-16 Thread Faiz Abbas


On Monday 16 October 2017 08:52 PM, Marek Vasut wrote:
> On 10/16/2017 04:51 PM, Felipe Balbi wrote:
>>
>> Hi,
>>
>> Faiz Abbas  writes:
>> Marek Vasut  writes:
>>> On 10/16/2017 07:21 AM, Faiz Abbas wrote:
 A flush of the cache is required before any outbound DMA access can
 take place. The minimum size that can be flushed from the cache is
 one cache line size. Therefore, any buffer allocated for DMA should
 be in multiples of cache line size.

 Thus, allocate memory for ep0_trb in multiples of cache line size.

 Also, when local variable trb is assigned to dwc->ep0_trb[1] and used
 to flush cache, it leads to cache misaligned messages as only the base
 address dwc->ep0_trb is cache aligned.

 Therefore, flush cache using ep0_trb_addr which is always cache 
 aligned.

 Signed-off-by: Faiz Abbas 
>>>
>>> SGTM, Felipe, can you review this please ?
>>
>> is cache maintenance done correctly in u-boot? Isn't the whole idea of a
>> coherent memory area that is is non-cacheable, non-bufferable memory?
>>
>> Also, why isn't the API itself guaranteeing alignment requirements?
>>
> There is no support in u-boot to make a memory area non-cacheable.
> This is the definition of dma_alloc_coherent()
>
> static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
> {
> *handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
> return (void *)*handle;
> }
>
> This driver is mostly copied from kernel (where dma_alloc_coherent() is
> what you describe) and extra flush_cache functions are added because of
> U-Boot's inability to allocate coherent memory.

 then that's what should be fixed. No?

>>>
>>> You're right but that sounds like a long-term feature which will affect
>>> a huge part of u-boot. Until it is implemented, I guess this is the best
>>> way to handle the issue.
>>
>> Not my call to make. I'll defer to Marek and Tom
>>
> We're deep in RC anyway, so feel free to prepare a fix for next MW .
> 

Fix as in rebase same patch for next merge window?

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


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

2017-10-16 Thread Stefan Roese
I've missed to add the ACPI resume support to this x86 build target.
This patch adds the ACPI resume support enabling S3 suspend /
resume.

Signed-off-by: Stefan Roese 
Cc: Bin Meng 
Cc: Simon Glass 
---
 configs/conga-qeval20-qa3-e3845-internal-uart_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig 
b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
index 971cfc66e8..59bde05c80 100644
--- a/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
+++ b/configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
@@ -9,6 +9,7 @@ CONFIG_HAVE_VGA_BIOS=y
 CONFIG_GENERATE_PIRQ_TABLE=y
 CONFIG_GENERATE_MP_TABLE=y
 CONFIG_GENERATE_ACPI_TABLE=y
+CONFIG_HAVE_ACPI_RESUME=y
 CONFIG_SEABIOS=y
 CONFIG_FIT=y
 CONFIG_FIT_SIGNATURE=y
-- 
2.14.2

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


<    1   2