Re: [U-Boot] PBIAS driver and MMC Interaction in U-Boot Question

2018-09-14 Thread Jean-Jacques Hiblot



On 11/09/2018 12:45, Adam Ford wrote:

On Mon, Sep 10, 2018 at 6:40 AM Jean-Jacques Hiblot  wrote:

Hi Adam,


On 09/09/2018 14:19, Adam Ford wrote:

I was having some issues with a DM3730 properly reading the card
detect on GPIO 127 and attributed it to being related to the pbias
register.  I have since submitted a patch to enable GPIO_127, but I am
not the best approach.

On the HSMMC driver, there are explicit commands to Disable extended
drain IO before changing PBIAS, because the MMC driver needs to enable
the PBIAS to make the MMC/SD interface operate correctly.

I also submitted a patch to enable pbias driver found in
power/regulator/pbias_regulator.c to work on omap3 boards by adding
the 'compatible' options.   I have been able to test that the pbias
driver and it appears to have been setup to work on the omap3, but I
have only tried to read the pbias values, I haven't tried to set the
pbias values with it.

Two questions:

What I was wondering is if there is some method to get the PBIAS
driver to set the PBIAS instead of having the HSMMC driver do it.  It
seems like one should be able to do this in the device tree, but it's
not clear on how.

I believe that the PBIAs must be configured by the HSMMC driver for 2
reasons:
* PBIAS is used by HSMMC only.
* PBIAS must be updated when the MMC IO voltage is changed (see
omap_hsmmc_set_io_regulator())

That function looks like it's contained in a set of #ifdef's which may
or may not be enabled.  I think it makes sense to enable it, but I
also noticed that
mmc_board_init() is manipulating the pbias settings.  Do you think
this is OK, or do you think we should remove the pbias references from
here and only
use them from omap_hsmmc_set_io_regulator()?
omap_hsmmc_set_io_regulator() can be used only with DM so it should stay 
in mmc_board_init() at least for the non-DM case





The pbias driver does not seem to have the same checks for disabling
the extended drain IO before changing the PBIAS which seems to be
required per the DM3730 technical reference manual.  Would it make
sense to do this in here, or is it just better to leave it in the MMC
Driver?

IMO It would make sense to do it in the PBIAS driver as it is strongly
advised
to toggle both at the same time.

I don't know the details of the other OMAP/Sitara SoC's, but
currently, there is an ifdef for the OMAP36XX inside mmc_board_init
which disables and enables the IO when toggling.  Are there other
SoC's that should be included and if so, do they use the same
registers?  I am basically trying to determine if the #ifdef for the
OMAP36XX is necessary or if it should always be included.
I don't know enough about all the SOCs to say for sure. I'd say that 
this is required only for omap36xx.




adam

JJ

adam



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


[U-Boot] [PATCH v4 0/2] arm: qemu-arm: enable PL031 (RTC)

2018-09-14 Thread Akashi, Takahiro
Virtual Machines provided by qemu for arm are already equipped with
RTCdevice (PL031). With this patch set, PL031 driver is converted to
driver model and by default enabled on qemu-arm.
It allows us not only to use date command but also to enable UEFI's
GetTime/SetTime() services.

This work is motivated by running UEFI SCT(Self-Certification Test)
and measuring time. Heinrich has already posted UEFI's GetTime()
implementation.

This is a revised version of my proposal[1].

 [1] https://lists.denx.de/pipermail/u-boot/2018-July/333534.html


Changes in v4 (Sep 14, 2018)
* rebased to v2018.09-rc as my v3 was incompletely merged
* drop v3's patch#1
* remove duplicated CONFIG_RTC_PL031 and CONFIG_SYS_RTC_PL031_BASE

Changes in v3 (July 11, 2018)
* compile drivers/rtc/date.c if DM_RTC
* rename pl031_rtc_xxx to pl031_xxx
* make struct pl031_platdata private to the driver
* add probe function, removing pl031_initted variable
* use readl/writel() instead of private macros
* add a debug message to pl031_rtc_set()
* remove CONFIG_SYS_RTC_PL031_BASE from config_whitelist.txt
* enable RTC_PL031 for QEMU_ARM in arch/arm/Kconfig

Changes in v2 (July 4, 2018)
* based on Heinrich's comments,
* remove legacy mode interface
* enable the driver in defconfig

AKASHI Takahiro (2):
  rtc: pl031: convert the driver to driver model
  arm: qemu-arm: enable RTC (PL031) by default

 arch/arm/Kconfig |   2 +
 drivers/rtc/pl031.c  | 126 ++-
 include/configs/qemu-arm.h   |   3 -
 scripts/config_whitelist.txt |   1 -
 4 files changed, 82 insertions(+), 50 deletions(-)

-- 
2.18.0

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


[U-Boot] [PATCH v4 1/2] rtc: pl031: convert the driver to driver model

2018-09-14 Thread Akashi, Takahiro
From: AKASHI Takahiro 

With this patch, PL031 driver is converted to driver-model-compliant
driver. In addition, CONFIG_SYS_RTC_PL031_BASE is no longer valid.

Signed-off-by: AKASHI Takahiro 
---
 drivers/rtc/pl031.c  | 126 ++-
 include/configs/qemu-arm.h   |   3 -
 scripts/config_whitelist.txt |   1 -
 3 files changed, 80 insertions(+), 50 deletions(-)

diff --git a/drivers/rtc/pl031.c b/drivers/rtc/pl031.c
index 8955805e3bc1..8bf04f26a375 100644
--- a/drivers/rtc/pl031.c
+++ b/drivers/rtc/pl031.c
@@ -8,13 +8,11 @@
 
 #include 
 #include 
+#include 
+#include 
 #include 
-
-#if defined(CONFIG_CMD_DATE)
-
-#ifndef CONFIG_SYS_RTC_PL031_BASE
-#error CONFIG_SYS_RTC_PL031_BASE is not defined!
-#endif
+#include 
+#include 
 
 /*
  * Register definitions
@@ -30,78 +28,114 @@
 
 #define RTC_CR_START   (1 << 0)
 
-#defineRTC_WRITE_REG(addr, val) \
-   (*(volatile unsigned int *)(CONFIG_SYS_RTC_PL031_BASE + 
(addr)) = (val))
-#defineRTC_READ_REG(addr)  \
-   (*(volatile unsigned int *)(CONFIG_SYS_RTC_PL031_BASE + 
(addr)))
+struct pl031_platdata {
+   phys_addr_t base;
+};
 
-static int pl031_initted = 0;
+static inline u32 pl031_read_reg(struct udevice *dev, int reg)
+{
+   struct pl031_platdata *pdata = dev_get_platdata(dev);
 
-/* Enable RTC Start in Control register*/
-void rtc_init(void)
+   return readl(pdata->base + reg);
+}
+
+static inline u32 pl031_write_reg(struct udevice *dev, int reg, u32 value)
 {
-   RTC_WRITE_REG(RTC_CR, RTC_CR_START);
+   struct pl031_platdata *pdata = dev_get_platdata(dev);
 
-   pl031_initted = 1;
+   return writel(value, pdata->base + reg);
 }
 
 /*
- * Reset the RTC. We set the date back to 1970-01-01.
+ * Probe RTC device
+ */
+static int pl031_probe(struct udevice *dev)
+{
+   /* Enable RTC Start in Control register*/
+   pl031_write_reg(dev, RTC_CR, RTC_CR_START);
+
+   return 0;
+}
+
+/*
+ * Get the current time from the RTC
  */
-void rtc_reset(void)
+static int pl031_get(struct udevice *dev, struct rtc_time *tm)
 {
-   RTC_WRITE_REG(RTC_LR, 0x00);
-   if(!pl031_initted)
-   rtc_init();
+   unsigned long tim;
+
+   if (!tm)
+   return -EINVAL;
+
+   tim = pl031_read_reg(dev, RTC_DR);
+
+   rtc_to_tm(tim, tm);
+
+   debug("Get DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+ tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+
+   return 0;
 }
 
 /*
  * Set the RTC
-*/
-int rtc_set(struct rtc_time *tmp)
+ */
+static int pl031_set(struct udevice *dev, const struct rtc_time *tm)
 {
unsigned long tim;
 
-   if(!pl031_initted)
-   rtc_init();
+   if (!tm)
+   return -EINVAL;
 
-   if (tmp == NULL) {
-   puts("Error setting the date/time\n");
-   return -1;
-   }
+   debug("Set DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+ tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
 
/* Calculate number of seconds this incoming time represents */
-   tim = rtc_mktime(tmp);
+   tim = rtc_mktime(tm);
 
-   RTC_WRITE_REG(RTC_LR, tim);
+   pl031_write_reg(dev, RTC_LR, tim);
 
-   return -1;
+   return 0;
 }
 
 /*
- * Get the current time from the RTC
+ * Reset the RTC. We set the date back to 1970-01-01.
  */
-int rtc_get(struct rtc_time *tmp)
+static int pl031_reset(struct udevice *dev)
 {
-   ulong tim;
+   pl031_write_reg(dev, RTC_LR, 0);
 
-   if(!pl031_initted)
-   rtc_init();
+   return 0;
+}
 
-   if (tmp == NULL) {
-   puts("Error getting the date/time\n");
-   return -1;
-   }
+static const struct rtc_ops pl031_ops = {
+   .get = pl031_get,
+   .set = pl031_set,
+   .reset = pl031_reset,
+};
 
-   tim = RTC_READ_REG(RTC_DR);
+static const struct udevice_id pl031_ids[] = {
+   { .compatible = "arm,pl031" },
+   { }
+};
 
-   rtc_to_tm(tim, tmp);
+static int pl031_ofdata_to_platdata(struct udevice *dev)
+{
+   struct pl031_platdata *pdata = dev_get_platdata(dev);
 
-   debug ( "Get DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
-   tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
-   tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+   pdata->base = dev_read_addr(dev);
 
return 0;
 }
 
-#endif
+U_BOOT_DRIVER(rtc_pl031) = {
+   .name   = "rtc-pl031",
+   .id = UCLASS_RTC,
+   .of_match = pl031_ids,
+   .probe  = pl031_probe,
+   .ofdata_to_platdata = pl031_ofdata_to_platdata,
+   .platdata_auto_alloc_size = sizeof(struct pl031_platdata),
+   .ops= &pl031_ops,
+};
diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
index 913ff4f2636f..ba106247dc6f 100644
-

[U-Boot] [PATCH v4 2/2] arm: qemu-arm: enable RTC (PL031) by default

2018-09-14 Thread Akashi, Takahiro
From: AKASHI Takahiro 

Virtual machine provided by qemu-arm has a ARM PL031 Real Time Clock
device. With this patch, the driver is enabled by default.

Signed-off-by: AKASHI Takahiro 
---
 arch/arm/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 8a23c76db846..f9fdbabba81b 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -741,6 +741,8 @@ config ARCH_QEMU
select OF_CONTROL
select PL01X_SERIAL
imply CMD_DM
+   imply DM_RTC
+   imply RTC_PL031
 
 config ARCH_RMOBILE
bool "Renesas ARM SoCs"
-- 
2.18.0

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


Re: [U-Boot] [PATCH v2 0/7] [RESEND] Improvements for the dwc3_generic driver

2018-09-14 Thread Jean-Jacques Hiblot

Hi Marek,

Gentle ping on this series and the other for DM_USB on TI platforms.

JJ


On 04/09/2018 15:42, Jean-Jacques Hiblot wrote:

Resending this series after rebasing on top of latest u-boot.

This series aims at bringing improvements to the dwc3_generic driver so
that it can be used by most of the platforms using the dwc3 controller.

I tested this on with DRA7 and AM57x platforms for both Peripheral and Host
operations. The code to enable DM USB host & dev support for those
platforms will be submitted in a separate series.

Michal Simek has tested this series:
" I have tested it on zcu100 with usb stick, usb to ethernet converter and
also dfu.
Tested-by: Michal Simek "

Enhancements:
- use separate Kconfig option for DM USB Periphal and DM USB Host. This
allow platforms to keep their non-DM USB peripheral code and use the DM
USB host.
- fixes the bind/probe confusion in dwc3_generic. The probe is done when
the USB device is first needed.
- handles PHYs when in the peripheral mode. The code to handle the PHYs is
shared with the host side
- handles clock and reset
- bind host controller to the more generic driver 'xhci-dwc3'


Changes in v2:
- Updated commit log
- Fixed typo in thordown.c
- select DM_USB_DEV by default for zynqmp platforms

Jean-Jacques Hiblot (7):
   usb: gadget: Do not call board_usb_xxx() directly in USB gadget
 drivers
   usb: introduce a separate config option for DM USB device
   usb: udc: implement DM versions of
 usb_gadget_initialize()/_release()/_handle_interrupt()
   dwc3_generic: do not probe the USB device driver when it's bound
   dwc3: move phy operation to core.c
   dwc3-generic: Handle the PHYs, the clocks and the reset lines
   dwc3-generic: Add select_dr_mode operation

  arch/arm/Kconfig  |   2 +
  cmd/fastboot.c|   4 +-
  cmd/rockusb.c |   4 +-
  cmd/thordown.c|   4 +-
  cmd/usb_gadget_sdp.c  |   4 +-
  cmd/usb_mass_storage.c|   4 +-
  common/dfu.c  |   6 +-
  drivers/usb/Kconfig   |   6 ++
  drivers/usb/dwc3/Kconfig  |   7 +-
  drivers/usb/dwc3/core.c   |  86 +++-
  drivers/usb/dwc3/dwc3-generic.c   | 207 +-
  drivers/usb/dwc3/ep0.c|   1 -
  drivers/usb/gadget/ether.c|  38 +--
  drivers/usb/gadget/udc/udc-core.c |  44 +++-
  drivers/usb/host/xhci-dwc3.c  |  93 ++---
  include/dwc3-uboot.h  |   7 ++
  include/linux/usb/gadget.h|  18 
  17 files changed, 351 insertions(+), 184 deletions(-)



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


Re: [U-Boot] [PATCH 1/1] efi_loader: environment variables for terminal size

2018-09-14 Thread Mark Kettenis
> From: Alexander Graf 
> Date: Fri, 14 Sep 2018 07:21:56 +0200
> 
> On 14.09.18 06:41, Heinrich Schuchardt wrote:
> > Correct scrolling in EFI applications like the EFI Shell requires correct
> > setting of the terminal size. Detecting the terminal size over the serial
> > interface is often not supported. The patch introduces the environment
> 
> Can you give examples on when it's not supported? I think most cases
> I've encountered in the last 10 years do support just reading them via
> escape sequences.

There are multiple "standards" for these escape sequences so you can't
use them without knowing the terminal type.  So unless you implement a
way to set the terminal type in U-Boot that is a bad idea as sending
random control characters to a terminal that doesn't understand them
you invariably make it unusable.  This should then also include a
"dumb" setting since users may want to redirected the serial line
output to something that isn't a terminal at all.  At that point I
think Heinrich's solution is much simpler and better.

> > variables LINES and COLUMNS to set the terminal size manually.
> > 
> > Signed-off-by: Heinrich Schuchardt 
> > ---
> >  doc/README.uefi  | 14 ++
> >  lib/efi_loader/efi_console.c | 15 ++-
> >  2 files changed, 28 insertions(+), 1 deletion(-)
> > 
> > diff --git a/doc/README.uefi b/doc/README.uefi
> > index 6b9759cfed..df0cf5b7ce 100644
> > --- a/doc/README.uefi
> > +++ b/doc/README.uefi
> > @@ -299,6 +299,20 @@ This driver is only available if U-Boot is configured 
> > with
> >  CONFIG_BLK=y
> >  CONFIG_PARTITIONS=y
> >  
> > +## Setting the terminal size
> > +
> > +For correct scrolling the terminal size has to be known.
> > +
> > +The default terminal size is 80x25.
> > +
> > +If the environment variable 'stdout' has the value 'vidconsole', the 
> > terminal
> > +size is determined by querying the video console driver. Else it is tried 
> > to
> > +determine the terminal size by sending ESC '[18t' to the console which may
> > +reply with an escape sequence indicating the terminal size.
> > +
> > +It is possible to override the terminal size by setting the environment
> > +variables 'LINES' and 'COLUMNS'.
> > +
> >  ## TODOs as of U-Boot 2018.07
> >  
> >  * unimplemented or incompletely implemented boot services
> > diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
> > index 73f7ecf919..40e33f9fd3 100644
> > --- a/lib/efi_loader/efi_console.c
> > +++ b/lib/efi_loader/efi_console.c
> > @@ -224,6 +224,7 @@ static void query_console_size(void)
> >  {
> > const char *stdout_name = env_get("stdout");
> > int rows = 25, cols = 80;
> > +   char *value;
> >  
> > if (stdout_name && !strcmp(stdout_name, "vidconsole") &&
> > IS_ENABLED(CONFIG_DM_VIDEO)) {
> > @@ -235,9 +236,21 @@ static void query_console_size(void)
> > rows = priv->rows;
> > cols = priv->cols;
> > } else if (query_console_serial(&rows, &cols)) {
> > -   return;
> > +   rows = 25;
> > +   cols = 80;
> > }
> >  
> > +   value = env_get("LINES");
> > +   if (value)
> > +   rows = simple_strtoul(value, NULL, 10);
> > +   value = env_get("COLUMNS");
> > +   if (value)
> > +   cols = simple_strtoul(value, NULL, 10);
> > +   if (rows <= 0)
> > +   rows = 25;
> > +   if (cols <= 0)
> > +   cols = 80;
> > +
> > /* Test if we can have Mode 1 */
> > if (cols >= 80 && rows >= 50) {
> > efi_cout_modes[1].present = 1;
> > 
> ___
> 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] Please pull from u-boot-i2c

2018-09-14 Thread Heiko Schocher

Hello Tom,

please pull from u-boot-i2c.git master

The following changes since commit d1e15041abf3ccd38169ae7aa8736f78200f8ee3:

  Merge branch 'master' of git://git.denx.de/u-boot-uniphier (2018-09-11 
08:50:10 -0400)

are available in the Git repository at:

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

for you to fetch changes up to ca1d6ca3653c5aa7679a55fd84a20e175d3b8e64: 




  i2c: Drop CONFIG_SYS_I2C_MXS (2018-09-14 06:30:29 +0200)


Tuomas Tynkkynen (1):
  i2c: Drop CONFIG_SYS_I2C_MXS

 drivers/i2c/Makefile  |   1 -
 drivers/i2c/mxs_i2c.c | 319 
--

 2 files changed, 320 deletions(-)
 delete mode 100644 drivers/i2c/mxs_i2c.c

Travis build is fine:
https://travis-ci.org/hsdenx/u-boot-i2c/builds/428462792?utm_source=email&utm_medium=notification

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] drivers: spi: migrate cf_spi to DM

2018-09-14 Thread Simon Glass
Hi Angelo,

On 28 June 2018 at 21:48, Angelo Dureghello  wrote:
> Hi Jagan,
>
> On Wed, Jun 27, 2018 at 02:54:42PM +0530, Jagan Teki wrote:
>> On Wed, Jun 27, 2018 at 2:27 PM, Angelo Dureghello  wrote:
>> > Hi Jagan,
>> >
>> > On Wed, Jun 27, 2018 at 12:08:26PM +0530, Jagan Teki wrote:
>> >> On Tue, Jun 26, 2018 at 10:28 PM, Angelo Dureghello  
>> >> wrote:
>> >> > This patch adds DM support to cf_spi.c.
>> >> >
>> >> > How to use/test it:
>> >> >
>> >> > 1) enable the following options,
>> >> >
>> >> > CONFIG_DM_SPI
>> >> > CONFIG_DM_SPI_FLASH
>> >> >
>> >> > 2) add similar code into your board.c file
>> >> >
>> >> > U_BOOT_DEVICE(coldfire_spi) = {
>> >> > .name = "spi_coldfire",
>> >> > .platdata = &mcf_spi_plat,
>> >> > };
>> >> >
>> >> > ---
>> >> > Changes from v1:
>> >> > - split into 2 patches
>> >> >
>> >> > Changes from v2:
>> >> > - back in a single patch, no need to add fdt support or special
>> >> >   config options
>> >> > - doc/driver-model/spi-howto.txt has been re-checked and followed,
>> >> >   the driver now builds as is.
>> >>
>> >> Nice, How about full dm conversion. I have seen few boards using this
>> >> driver and its quite manageble for full switching. what do you think?
>> >
>> > Sorry, what do you mean exactly for full switching ?
>> > My understanding is, to remove the non-dm part of the driver and add to
>> > each board proper device struct and config options, correct ?
>>
>> yes.
>>
>> > In this case, i can only test it on my stmark2 board, but i think could
>> > be enough.
>>
>> yes, for untested ones will ask other board maintainers.
>
> I verified right now, for a full switch i should enable CONFIG_DM for
> the architecture, and then select CONFIG_DM_SPI, moving as his child
> the CONFIG_CF_SPI.
>
> To enable CONFIG_DM for m68k means to add device tree, or there are
> of_xxx functions unresolved externals errors then.
>
> For this small architecture, i am not that happy to add the devicetree
> support. I should add a fixed 30 KB of binary size and several diffent
> families/dtsi, with the benefit to configure mainly uart and spi.

Are you worried about the size of SPL when using device tree?

How about converting m68k to DT in U-Boot proper as a first step?

>
> If the devicetree become mandatory/forced, would be nice if you could accept
> the migration as is (as from doc/driver-model/spi-howto.txt), and i could
> then work on devicetree in a later step.

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


Re: [U-Boot] [PATCH v3 1/8] powerpc/dts: Define '_end' symbol in mpc85xx U-Boot lds files

2018-09-14 Thread Simon Glass
On 3 September 2018 at 18:05, Jagdish Gediya  wrote:
> 'board_fdt_blob_setup' function sets up fdt blob at '&_end' so
> define '_end' symbol in mpc85xx lds files.
>
> Signed-off-by: Jagdish Gediya 
> ---
> Changes for v2:
> - Define '_end' symbol in lds file instead of defining new
>   'board_fdt_blob_setup' function using existing '_init_end' symbol.
>
> Changes for v3:
> - Define '_end' symbol in spl lds files too.
>
>  arch/powerpc/cpu/mpc85xx/u-boot-nand.lds | 1 +
>  arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds | 1 +
>  arch/powerpc/cpu/mpc85xx/u-boot-spl.lds  | 1 +
>  arch/powerpc/cpu/mpc85xx/u-boot.lds  | 1 +
>  4 files changed, 4 insertions(+)

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


Re: [U-Boot] [PATCH v3 5/8] powerpc: mpc85xx: Select BINMAN by default

2018-09-14 Thread Simon Glass
On 3 September 2018 at 18:05, Jagdish Gediya  wrote:
> Signed-off-by: Jagdish Gediya 
> Reviewed-by: Bin Meng 
> ---
>  No changes for v2 and v3.
>
>  arch/powerpc/Kconfig | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Simon Glass 

This is more than a default - with 'select' it will not be possible to
deselected it in a defconfig file, as I understand it. But that seems
OK to me.

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


Re: [U-Boot] [PATCH v3 3/8] binman: Add a new "skip-at-start" property in Section class

2018-09-14 Thread Simon Glass
On 3 September 2018 at 18:05, Jagdish Gediya  wrote:
> Currently binman calculates '_skip_at_start' based on 'end-at-4gb'
> property and it is used for x86 images.
>
> For PowerPC mpc85xx based CPU, CONFIG_SYS_TEXT_BASE is the entry
> offset of the first entry. It can be 0xeff4 or 0xfff4 for
> nor flash boot, 0x201000 for sd boot etc, so "_skip_at_start"
> should be set to CONFIG_SYS_TEXT_BASE.
>
> 'end-at-4gb' property is not applicable where CONFIG_SYS_TEXT_BASE +
> Image size != 4gb.
>
> Add new property 'skip-at-start' in Section class so that
> '_skip_at_start' can be calculated either based on 'end-at-4gb'
> or based on "skip-at-start".
>
> Add a test case to check that 'skip-at-start' and 'end-at-4gb'
> property can't be used together.
>
> Signed-off-by: Jagdish Gediya 
> Reviewed-by: Bin Meng 
> ---
> Changes for v2:
> - Renamed 'start-pos' property to 'skip-at-start'
> - Updated README
>
> Changes for v3:
> - Modification as per Simon Glass's comments
> - Added test case for 'skip-at-start' property
>
>  tools/binman/README |  9 +
>  tools/binman/bsection.py| 15 +++
>  tools/binman/ftest.py   |  8 
>  .../test/80_4gb_and_skip_at_start_together.dts  | 21 
> +
>  4 files changed, 49 insertions(+), 4 deletions(-)
>  create mode 100644 tools/binman/test/80_4gb_and_skip_at_start_together.dts

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


Re: [U-Boot] [PATCH v3 4/8] binman: Add support for PowerPC mpc85xx 'bootpg + resetvec' entry

2018-09-14 Thread Simon Glass
On 3 September 2018 at 18:05, Jagdish Gediya  wrote:
> This entry contains the PowerPC mpc85xx boot page and resetvec
> sections.
>
> Signed-off-by: Jagdish Gediya 
> ---
> Changes for v2:
> - Updated README for new binman entry
> - Added test
>
> Changes for v3:
> - Changed text from 'Powerpc' to 'PowerPC'
>
>  tools/binman/README.entries| 14 +++-
>  .../etype/powerpc_mpc85xx_bootpg_resetvec.py   | 25 
> ++
>  tools/binman/ftest.py  |  8 +++
>  .../test/81_powerpc_mpc85xx_bootpg_resetvec.dts| 16 ++
>  4 files changed, 62 insertions(+), 1 deletion(-)
>  create mode 100644 tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
>  create mode 100644 tools/binman/test/81_powerpc_mpc85xx_bootpg_resetvec.dts

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


Re: [U-Boot] [PATCH v3 8/8] powerpc: dts: Enable device tree support for T2080QDS

2018-09-14 Thread Simon Glass
On 3 September 2018 at 18:05, Jagdish Gediya  wrote:
> Add device tree for T2080QDS board and enable CONFIG_OF_CONTROL
> so that device tree can be compiled.
>
> Update board README for device tree usage.
>
> Signed-off-by: Jagdish Gediya 
> Reviewed-by: Bin Meng 
> ---
> Changes for v2:
> - Enable CONFIG_MPC85XX_HAVE_RESET_VECTOR in T2080QDS_defconfig
> - README and commit message changes as per Bin Meng's comments
>
> No changes for v3.
>
>  arch/powerpc/dts/Makefile |  2 ++
>  arch/powerpc/dts/e6500_power_isa.dtsi | 39 ++
>  arch/powerpc/dts/t2080.dtsi   | 62 
> +++
>  arch/powerpc/dts/t2080qds.dts | 17 ++
>  board/freescale/t208xqds/README   | 19 +++
>  configs/T2080QDS_NAND_defconfig   |  3 +-
>  configs/T2080QDS_SDCARD_defconfig |  3 +-
>  configs/T2080QDS_SPIFLASH_defconfig   |  3 +-
>  configs/T2080QDS_defconfig|  4 ++-
>  9 files changed, 148 insertions(+), 4 deletions(-)
>  create mode 100644 arch/powerpc/dts/e6500_power_isa.dtsi
>  create mode 100644 arch/powerpc/dts/t2080.dtsi
>  create mode 100644 arch/powerpc/dts/t2080qds.dts

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


Re: [U-Boot] [PATCH v3 7/8] powerpc: dts: Add u-boot.dtsi to use binman for MPC85xx boards

2018-09-14 Thread Simon Glass
On 3 September 2018 at 18:05, Jagdish Gediya  wrote:
> Signed-off-by: Jagdish Gediya 
> Reviewed-by: Bin Meng 
> ---
> Changes for v2:
> - Remove mpc85xx-u-boot.dtsi
> - Update u-boot.dtsi to use CONFIG_MPC85XX_HAVE_RESET_VECTOR
>
> Changes for v3:
> - Use 'sort-by-offset' property instead of 'sort-by-pos'
>
>  arch/powerpc/dts/u-boot.dtsi | 32 
>  1 file changed, 32 insertions(+)
>  create mode 100644 arch/powerpc/dts/u-boot.dtsi

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


Re: [U-Boot] [PATCH v3 05/20] mmc: rpmb: add mmc_rpmb_route_frames()

2018-09-14 Thread Simon Glass
Hi Jens,

On 3 September 2018 at 16:46, Jens Wiklander  wrote:
> Adds mmc_rpmb_route_frames() to route RPMB data frames from/to an
> external entity.
>
> Tested-by: Igor Opaniuk 
> Signed-off-by: Jens Wiklander 
> ---
>  drivers/mmc/rpmb.c | 160 +
>  include/mmc.h  |   2 +
>  2 files changed, 162 insertions(+)
>

[..]

> diff --git a/include/mmc.h b/include/mmc.h
> index df4255b828a7..d6e02af4edea 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -748,6 +748,8 @@ int mmc_rpmb_read(struct mmc *mmc, void *addr, unsigned 
> short blk,
>   unsigned short cnt, unsigned char *key);
>  int mmc_rpmb_write(struct mmc *mmc, void *addr, unsigned short blk,
>unsigned short cnt, unsigned char *key);
> +int mmc_rpmb_route_frames(struct mmc *mmc, void *req, unsigned long reqlen,
> + void *rsp, unsigned long rsplen);

Please can you add a full comment to this function? All header-file
functions should be commented.

>  #ifdef CONFIG_CMD_BKOPS_ENABLE
>  int mmc_set_bkops_enable(struct mmc *mmc);
>  #endif
> --
> 2.17.1
>

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


Re: [U-Boot] [RFC PATCH 1/2] Makefile: Use -fno-strict-aliasing globally

2018-09-14 Thread Simon Glass
On 10 September 2018 at 15:53, Bin Meng  wrote:
> The -fstrict-aliasing option is implicitly enabled at levels -O2,
> -O3, -Os by GCC. This option allows the compiler to assume the
> strictest aliasing rules applicable to the language being compiled.
> For example, the practice of reading from a different union member
> than the one most recently written to (called "type-punning") is
> common. In this case, "type-punning" only works if the memory is
> accessed through the union type, but might not work by taking the
> address, casting the resulting pointer and dereferencing the result,
> which is an undefined behavior per the "strict aliasing rules".
>
> GCC's -Wstrict-aliasing (included in -Wall) option does not catch
> all cases, but does attempt to catch the more common pitfalls. So
> there are cases that GCC does not report but the codes are violating
> the "strict aliasing rules".
>
> Given lots of codes that may be written to rely on "type-punning",
> and Linux kernel disables it by -fno-strict-aliasing globally, since
> U-Boot currently does this on nds32/riscv/x86 builds only, extend
> this for all architecture builds.
>
> Signed-off-by: Bin Meng 
> ---
>
>  Makefile | 2 +-
>  1 file changed, 1 insertion(+), 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 v3 07/20] dt/bindings: add bindings for optee

2018-09-14 Thread Simon Glass
On 3 September 2018 at 16:46, Jens Wiklander  wrote:
> Sync with c8bfafb15944 ("dt/bindings: add bindings for optee")
> from Linux kernel.
>
> Introduces linaro prefix and adds bindings for ARM TrustZone based OP-TEE
> implementation.
>
> Signed-off-by: Jens Wiklander 
> ---
>  .../firmware/linaro,optee-tz.txt  | 31 +++
>  1 file changed, 31 insertions(+)
>  create mode 100644 doc/device-tree-bindings/firmware/linaro,optee-tz.txt

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


Re: [U-Boot] [PATCH v3 6/8] powerpc: mpc85xx: Use binman to embed dtb inside U-Boot

2018-09-14 Thread Simon Glass
On 3 September 2018 at 18:05, Jagdish Gediya  wrote:
> Below is the sequence to embed dtb inside U-Boot,
> 1. Remove bootpg and resetvec section if needed
> 2. Append dtb
> 3. Append bootpg and resetvec section back if removed in step 1
>
> Above procedure is required only when CONFIG_MPC85xx and
> CONFIG_OF_SEPARATE are defined.
>
> Add new config CONFIG_MPC85XX_HAVE_RESET_VECTOR to indicate that
> image has resetvec section. Step 1 and step 3 described above are
> required only if this config is y.
>
> Signed-off-by: Jagdish Gediya 
> ---
> Changes for v2:
> - Don't change the generic target
> - Add new config option to use binman

Where is that config option? I don't see it in this patch.

>
> Changes for v3:
> - Commit message change('u-boot' -> 'U-Boot')
>
>  Makefile | 23 ++-
>  arch/powerpc/cpu/mpc85xx/Kconfig |  4 
>  2 files changed, 26 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 v3 15/20] tee: add sandbox driver

2018-09-14 Thread Simon Glass
Hi Jens,

On 3 September 2018 at 16:47, Jens Wiklander  wrote:
> Adds a sandboxtee driver which emulates a generic TEE with the OP-TEE

sandbox tee

> AVB TA.
>
> Signed-off-by: Jens Wiklander 
> ---
>  drivers/tee/Kconfig   |  12 +-
>  drivers/tee/Makefile  |   1 +
>  drivers/tee/optee/Kconfig |   2 +-
>  drivers/tee/sandbox.c | 299 ++
>  include/sandboxtee.h  |  15 ++
>  5 files changed, 326 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/tee/sandbox.c
>  create mode 100644 include/sandboxtee.h

Reviewed-by: Simon Glass 

nits below.

>
> diff --git a/drivers/tee/Kconfig b/drivers/tee/Kconfig
> index 835c256e9239..4697b80913d6 100644
> --- a/drivers/tee/Kconfig
> +++ b/drivers/tee/Kconfig
> @@ -1,8 +1,8 @@
>  # Generic Trusted Execution Environment Configuration
>  config TEE
> bool "Trusted Execution Environment support"
> -   depends on ARM && (ARM64 || CPU_V7A)
> -   select ARM_SMCCC
> +   depends on (ARM && (ARM64 || CPU_V7A)) || SANDBOX
> +   select ARM_SMCCC if ARM
> help
>   This implements a generic interface towards a Trusted Execution
>   Environment (TEE). A TEE is a trusted OS running in some secure
> @@ -14,6 +14,14 @@ if TEE
>
>  menu "TEE drivers"
>
> +config SANDBOX_TEE
> +   bool "Sandbox TEE emulator"
> +   depends on SANDBOX
> +   default y
> +   help
> + This emulates a generic TEE needed for testing including the AVB
> + TA.

Can you please expand this? What features does it implement? How do
you access it from the U-Boot command line?

> +
>  source "drivers/tee/optee/Kconfig"
>
>  endmenu
> diff --git a/drivers/tee/Makefile b/drivers/tee/Makefile
> index 19633b60f235..f72c68c09f33 100644
> --- a/drivers/tee/Makefile
> +++ b/drivers/tee/Makefile
> @@ -1,4 +1,5 @@
>  # SPDX-License-Identifier: GPL-2.0+
>
>  obj-y += tee-uclass.o
> +obj-$(CONFIG_SANDBOX) += sandbox.o
>  obj-$(CONFIG_OPTEE) += optee/
> diff --git a/drivers/tee/optee/Kconfig b/drivers/tee/optee/Kconfig
> index dbfa7846a30f..d489834df926 100644
> --- a/drivers/tee/optee/Kconfig
> +++ b/drivers/tee/optee/Kconfig
> @@ -10,7 +10,7 @@ config OPTEE
>   handle Remote Procedure Calls (RPC) from OP-TEE needed to
>   execute a service. For more information see: https://www.op-tee.org
>
> -if OPTEE
> +if OPTEE || SANDBOX
>
>  menu "OP-TEE options"
>
> diff --git a/drivers/tee/sandbox.c b/drivers/tee/sandbox.c
> new file mode 100644
> index ..cd073497615f
> --- /dev/null
> +++ b/drivers/tee/sandbox.c
> @@ -0,0 +1,299 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2018 Linaro Limited
> + */
> +#include 
> +#include 
> +#include 

Could this go in asm/ ?

> +#include 
> +#include 
> +
> +/*
> + * The sandbox tee driver tries to emulate a generic TEE with the TA
> + * OPTEE_TA_AVB available.

What is TEE?

What is TA?

Please expand out the names once in this comment so people can see
immediately what you are referring to.

> + */
> +



> +struct ta_entry {

What is this struct for? Please add a comment

> +   struct tee_optee_ta_uuid uuid;
> +   u32 (*open_session)(uint num_params, struct tee_param *params);
> +   u32 (*invoke_func)(u32 func, uint num_params, struct tee_param 
> *params);
> +};
> +
> +#ifdef CONFIG_OPTEE_TA_AVB
> +static u32 get_attr(uint n, uint num_params, struct tee_param *params)
> +{
> +   if (n >= num_params)
> +   return TEE_PARAM_ATTR_TYPE_NONE;
> +
> +   return params[n].attr;
> +}
> +
> +static u32 check_params(u8 p0, u8 p1, u8 p2, u8 p3, uint num_params,
> +   struct tee_param *params)
> +{
> +   u8 p[] = { p0, p1, p2, p3};
> +   uint n;
> +
> +   for (n = 0; n < ARRAY_SIZE(p); n++)
> +   if (p[n] != get_attr(n, num_params, params))
> +   goto bad_params;
> +
> +   for (; n < num_params; n++)
> +   if (get_attr(n, num_params, params))
> +   goto bad_params;
> +
> +   return TEE_SUCCESS;
> +
> +bad_params:
> +   printf("Bad param attrs\n");
> +
> +   return TEE_ERROR_BAD_PARAMETERS;
> +}
> +
> +static u64 ta_avb_rollback_indexes[TA_AVB_MAX_ROLLBACK_LOCATIONS];
> +static u32 ta_avb_lock_state;
> +
> +static u32 ta_avb_open_session(uint num_params, struct tee_param *params)
> +{
> +   /*
> +* We don't expect additional parameters when opening a session to
> +* this TA.
> +*/
> +   return check_params(TEE_PARAM_ATTR_TYPE_NONE, 
> TEE_PARAM_ATTR_TYPE_NONE,
> +   TEE_PARAM_ATTR_TYPE_NONE, 
> TEE_PARAM_ATTR_TYPE_NONE,
> +   num_params, params);
> +}
> +
> +static u32 ta_avb_invoke_func(u32 func, uint num_params,
> + struct tee_param *params)
> +{
> +   u32 res;
> +   uint slot;
> +   u64 val;
> +
> +   switch (func) {
> +   case TA_AVB_CMD_READ_ROLLBACK_I

Re: [U-Boot] [PATCH v2 2/2] rockchip: fix incorrect detection of ram size

2018-09-14 Thread Simon Glass
Hi Marty,


On 13 September 2018 at 23:55, Marty E. Plummer  wrote:
> Taken from coreboot's src/soc/rockchip/rk3288/sdram.c
>
> Without this change, my u-boot build for the asus c201 chromebook (4GiB)
> is incorrectly detected as 0 Bytes of ram.
>
> Signed-off-by: Marty E. Plummer 
> ---
>  arch/arm/mach-rockchip/sdram_common.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/sdram_common.c 
> b/arch/arm/mach-rockchip/sdram_common.c
> index 650d53e4d9..194dc74b9f 100644
> --- a/arch/arm/mach-rockchip/sdram_common.c
> +++ b/arch/arm/mach-rockchip/sdram_common.c
> @@ -48,6 +48,8 @@ size_t rockchip_sdram_size(phys_addr_t reg)
>   rank, col, bk, cs0_row, bw, row_3_4);
> }
>
> +   size_mb = min(size_mb, SDRAM_MAX_SIZE/SZ_1M);
> +

Is this because size_mb is only 32-bits?

> return (size_t)size_mb << 20;
>  }
>
> --
> 2.18.0
>

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


[U-Boot] [PATCH 12/31] dtoc: Add a way to create an Fdt object from a data block

2018-09-14 Thread Simon Glass
Support creating an Fdt object without having to write the data to a file
first.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py  | 14 ++
 tools/dtoc/test_fdt.py |  8 
 2 files changed, 22 insertions(+)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index c5054e8cc91..2df2d4b0cc7 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -472,6 +472,20 @@ class Fdt:
 with open(self._fname) as fd:
 self._fdt_obj = libfdt.Fdt(fd.read())
 
+@staticmethod
+def FromData(data):
+"""Create a new Fdt object from the given data
+
+Args:
+data: Device-tree data blob
+
+Returns:
+Fdt object containing the data
+"""
+fdt = Fdt(None)
+fdt._fdt_obj = libfdt.Fdt(bytearray(data))
+return fdt
+
 def LookupPhandle(self, phandle):
 """Look up a phandle
 
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 22a075d6c57..d2597020500 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -407,6 +407,14 @@ class TestProp(unittest.TestCase):
 self.node.SetData('empty', '123')
 self.assertEqual('123', prop.bytes)
 
+def testFromData(self):
+dtb2 = fdt.Fdt.FromData(self.dtb.GetContents())
+self.assertEqual(dtb2.GetContents(), self.dtb.GetContents())
+
+self.node.AddEmptyProp('empty', 5)
+self.dtb.Sync(auto_resize=True)
+self.assertTrue(dtb2.GetContents() != self.dtb.GetContents())
+
 
 class TestFdtUtil(unittest.TestCase):
 """Tests for the fdt_util module
-- 
2.19.0.397.gdd90340f6a-goog

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


[U-Boot] [PATCH 01/31] fdt: Add Python support for adding/removing nodes

2018-09-14 Thread Simon Glass
Pull this support from these upstream commits:

   bfbfab0 pylibfdt: Add a means to add and delete notes
   9005f41 pylibfdt: Allow delprop() to return errors

Signed-off-by: Simon Glass 
---

 scripts/dtc/pylibfdt/libfdt.i_shipped | 34 ++-
 1 file changed, 28 insertions(+), 6 deletions(-)

diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped 
b/scripts/dtc/pylibfdt/libfdt.i_shipped
index 0f17c5879e7..76e61e98bdf 100644
--- a/scripts/dtc/pylibfdt/libfdt.i_shipped
+++ b/scripts/dtc/pylibfdt/libfdt.i_shipped
@@ -628,28 +628,50 @@ class Fdt(FdtRo):
 return check_err(fdt_setprop(self._fdt, nodeoffset, prop_name,
  val, len(val)), quiet)
 
-def delprop(self, nodeoffset, prop_name):
+def delprop(self, nodeoffset, prop_name, quiet=()):
 """Delete a property from a node
 
 Args:
 nodeoffset: Node offset containing property to delete
 prop_name: Name of property to delete
+quiet: Errors to ignore (empty to raise on all errors)
+
+Returns:
+Error code, or 0 if OK
 
 Raises:
 FdtError if the property does not exist, or another error occurs
 """
-return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name))
+return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name), quiet)
+
+def add_subnode(self, parentoffset, name, quiet=()):
+"""Add a new subnode to a node
 
-def del_node(self, nodeoffset):
+Args:
+parentoffset: Parent offset to add the subnode to
+name: Name of node to add
+
+Returns:
+offset of the node created, or negative error code on failure
+
+Raises:
+FdtError if there is not enough space, or another error occurs
+"""
+return check_err(fdt_add_subnode(self._fdt, parentoffset, name), quiet)
+
+def del_node(self, nodeoffset, quiet=()):
 """Delete a node
 
 Args:
-nodeoffset: Node offset containing property to delete
+nodeoffset: Offset of node to delete
+
+Returns:
+Error code, or 0 if OK
 
 Raises:
-FdtError if the node does not exist, or another error occurs
+FdtError if an error occurs
 """
-return check_err(fdt_del_node(self._fdt, nodeoffset))
+return check_err(fdt_del_node(self._fdt, nodeoffset), quiet)
 
 
 class Property(bytearray):
-- 
2.19.0.397.gdd90340f6a-goog

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


Re: [U-Boot] [PATCH 1/4] ata: ahci: Loop over the actual number of ports, not the maximum

2018-09-14 Thread Simon Glass
On 13 September 2018 at 00:28, Tuomas Tynkkynen  wrote:
> The loop in ahci_start_ports() is looping over the maximum number of
> SCSI devices in the system, which can be larger than the amount of ports
> a particular AHCI controller has. The extra looping isn't directly
> harmful because the link_port_map bitmap won't have the bit set for a
> nonexistent port, but it is wasteful. Replace the loop limit with the
> port count of the AHCI controller instead.
>
> Signed-off-by: Tuomas Tynkkynen 
> ---
>  drivers/ata/ahci.c | 2 +-
>  1 file changed, 1 insertion(+), 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 1/9] dm: allow 4GB of DRAM on 32bit systems

2018-09-14 Thread Simon Glass
Hi,

On 3 September 2018 at 16:29, Lokesh Vutla  wrote:
>
>
> On Sunday 02 September 2018 11:19 PM, Alexander Graf wrote:
>>
>>
>>> Am 02.09.2018 um 18:04 schrieb Vagrant Cascadian :
>>>
 On 2018-09-02, Alexander Graf  wrote:
> On 02.08.18 23:31, Dr. Philipp Tomsich wrote:
>
>> On 2 Aug 2018, at 22:36, Simon Glass  wrote:
>>
>> On 26 July 2018 at 07:59, Philipp Tomsich
>> > > wrote:
>>> Even on 32bit systems a full 4GB of DRAM may be installed and reported
>>> by the DRAM controller.  Whether these 4GB are larger available
>>> depends on the size/configuration of address decoding windows and
>>> architectural features (e.g. consider a hypothetical architecture that
>>> uses dedicated instructions to access the 'memory-mapped' peripheral
>>> IO ranges).  In U-Boot, the available DRAM, as reported by the
>>> device-model is independent of the accessible DRAM (i.e. adjusted top
>>> and effective size).
>>>
>>> This was first reported against the RK3288, which may have 4GB DRAM
>>> attached, but will have a small (e.g. 128MB) window not accessible due
>>> to address decoding limitations.
>>>
>>> The solution is to increase the types used for storing the ram_size to
>>> have at least 33 bits even on 32bit systems... i.e. we need to use a
>>> u64 for these always (this was previously only the case for
>>> PHYS_64BIT, which will have unwanted side-effects for 32bit systems
>>> and would require more intrusive changes).
>>>
>>> This commit changes the size-field in 'struct ram' and the ram_size in
>>> 'gd' to be a u64.
>>>
>>> Reported-by: Marty E. Plummer 
>>> Signed-off-by: Philipp Tomsich 
>>> ---
>>>
>>> include/asm-generic/global_data.h | 2 +-
>>> include/ram.h | 9 -
>>> 2 files changed, 9 insertions(+), 2 deletions(-)
>>>
>>
>> Reviewed-by: Simon Glass mailto:s...@chromium.org>>
>>
>>> diff --git a/include/asm-generic/global_data.h 
>>> b/include/asm-generic/global_data.h
>>> index 0fd4900..f3d687c 100644
>>> --- a/include/asm-generic/global_data.h
>>> +++ b/include/asm-generic/global_data.h
>>> @@ -55,7 +55,7 @@ typedef struct global_data {
>>>   unsigned long ram_base; /* Base address of RAM used by 
>>> U-Boot */
>>>   unsigned long ram_top;  /* Top address of RAM used by 
>>> U-Boot */
>>>   unsigned long relocaddr;/* Start address of U-Boot in RAM 
>>> */
>>> -   phys_size_t ram_size;   /* RAM size */
>>> +   u64 ram_size;   /* RAM size */
>>>   unsigned long mon_len;  /* monitor len */
>>>   unsigned long irq_sp;   /* irq stack pointer */
>>>   unsigned long start_addr_sp;/* start_addr_stackpointer */
>>> diff --git a/include/ram.h b/include/ram.h
>>> index 67e22d7..1fe024f 100644
>>> --- a/include/ram.h
>>> +++ b/include/ram.h
>>> @@ -9,7 +9,14 @@
>>>
>>> struct ram_info {
>>>   phys_addr_t base;
>>> -   size_t size;
>>> +   /*
>>> +* We use a 64bit type for the size to correctly handle 32bit
>>> +* systems with 4GB of DRAM (which would overflow a 32bit type
>>> +* and read back as 0).  For 64bit systems, we assume (for now)
>>
>> forever :-)
>>
>>> +* that they will always have less than 2^65 byte of DRAM
>>> +* installed. -- prt
>>
>> Is the prt your signature? I suggest dropping it.
>
> In fact it is. But I’ll need to rewrite the entire comment anyway for the 
> next
> version of this series as there’s even more functions and places that the
> memory size is stored in...
>
>>
>>> +*/
>>> +   u64 size;

 With LPAE available in all modern ARM cores, shouldn't phys_addr_t just
 be u64? And then we'd probably want to use that throughout the code, right?
>>>
>>> Quite a few currently supported boards do not support LPAE, e.g. imx6.
>>
>> What I'm trying to say is that we probably want to make phys_addr_t be u64 
>> when CONFIG_LPAE is set.
>
> That's right. Enabling PHYS_64BIT should be sufficient. Based on this
> phys_addr_t should be set to u32 or u64. arm already does that[1].
>
> [1]
> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/include/asm/types.h;h=9af7353f0866f05dbe298a603d52d90e9c8e6d28;hb=HEAD
>

Yes I agree. So will this patch be changed?

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


[U-Boot] [PATCH 03/31] binman: Allow 'fill' entry to have a size of 0

2018-09-14 Thread Simon Glass
The check for this should be for None, not 0. Fix it and add a test.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/fill.py  |  2 +-
 tools/binman/ftest.py   |  5 +
 tools/binman/test/80_fill_empty.dts | 15 +++
 3 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/test/80_fill_empty.dts

diff --git a/tools/binman/etype/fill.py b/tools/binman/etype/fill.py
index 7210a8324a0..dcfe978a5bf 100644
--- a/tools/binman/etype/fill.py
+++ b/tools/binman/etype/fill.py
@@ -23,7 +23,7 @@ class Entry_fill(Entry):
 """
 def __init__(self, section, etype, node):
 Entry.__init__(self, section, etype, node)
-if not self.size:
+if self.size is None:
 self.Raise("'fill' entry must have a size property")
 self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)
 
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a8456c26157..7f82264f8ad 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1364,6 +1364,11 @@ class TestFunctional(unittest.TestCase):
 self.assertIn("Node '/binman/u-boot': Please use 'offset' instead of "
   "'pos'", str(e.exception))
 
+def testFillZero(self):
+"""Test for an fill entry type with a size of 0"""
+data = self._DoReadFile('80_fill_empty.dts')
+self.assertEqual(chr(0) * 16, data)
+
 
 if __name__ == "__main__":
 unittest.main()
diff --git a/tools/binman/test/80_fill_empty.dts 
b/tools/binman/test/80_fill_empty.dts
new file mode 100644
index 000..2b78d3ae88d
--- /dev/null
+++ b/tools/binman/test/80_fill_empty.dts
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
+/dts-v1/;
+
+/ {
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   binman {
+   size = <16>;
+   fill {
+   size = <0>;
+   fill-byte = [ff];
+   };
+   };
+};
-- 
2.19.0.397.gdd90340f6a-goog

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


Re: [U-Boot] [PATCH 3/4] ata: Drop CONFIG_SYS_SCSI_MAX_* from boards using DM_SCSI

2018-09-14 Thread Simon Glass
On 13 September 2018 at 00:28, Tuomas Tynkkynen  wrote:
> These options are not used or necessary when device model is being used
> for SCSI. Just drop them.
>
> Signed-off-by: Tuomas Tynkkynen 
> ---
>  include/configs/dra7xx_evm.h| 4 
>  include/configs/qemu-arm.h  | 3 ---
>  include/configs/x86-common.h| 4 
>  include/configs/xilinx_zynqmp.h | 7 ---
>  4 files changed, 18 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 v3 04/20] avb_verify: bugfix avb_ops_free() skipping free

2018-09-14 Thread Simon Glass
On 3 September 2018 at 16:46, Jens Wiklander  wrote:
> Before this patch avb_ops_free() was returning early if supplied "ops"
> argument was not NULL. This patch fixes this by inverting the condition.
>
> Signed-off-by: Jens Wiklander 
> ---
>  common/avb_verify.c | 2 +-
>  1 file changed, 1 insertion(+), 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] dm: uclass: Adding missing child_pre_probe description

2018-09-14 Thread Simon Glass
On 7 September 2018 at 16:51, Bin Meng  wrote:
> The comment of child_pre_probe, one of the 'struct uclass_driver'
> members, is currently missing.
>
> Signed-off-by: Bin Meng 
> ---
>
>  include/dm/uclass.h | 1 +
>  1 file changed, 1 insertion(+)
>

Reviewed-by: Simon Glass 

> diff --git a/include/dm/uclass.h b/include/dm/uclass.h
> index 0e882ce..6e7c1cd 100644
> --- a/include/dm/uclass.h
> +++ b/include/dm/uclass.h
> @@ -58,6 +58,7 @@ struct udevice;
>   * @post_probe: Called after a new device is probed
>   * @pre_remove: Called before a device is removed
>   * @child_post_bind: Called after a child is bound to a device in this uclass
> + * @child_pre_probe: Called before a child is probed in this uclass

I prefer 'a child in this uclass is probed'

>   * @init: Called to set up the uclass
>   * @destroy: Called to destroy the uclass
>   * @priv_auto_alloc_size: If non-zero this is the size of the private data
> --
> 2.7.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 15/31] binman: Move state logic into the state module

2018-09-14 Thread Simon Glass
Rather than reaching into this module from control, move the code that
needs this info into state.

Signed-off-by: Simon Glass 
---

 tools/binman/control.py | 21 
 tools/binman/state.py   | 43 +
 2 files changed, 56 insertions(+), 8 deletions(-)

diff --git a/tools/binman/control.py b/tools/binman/control.py
index 00dcb8ad6a5..fd8b779945d 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -121,8 +121,6 @@ def Binman(options, args):
 outfd.write(infd.read())
 dtb = fdt.FdtScan(fname)
 
-# Note the file so that GetFdt() can find it
-state.fdt_files['u-boot.dtb'] = dtb
 node = _FindBinmanNode(dtb)
 if not node:
 raise ValueError("Device tree '%s' does not have a 'binman' "
@@ -139,6 +137,8 @@ def Binman(options, args):
 if skip:
 print 'Skipping images: %s\n' % ', '.join(skip)
 
+state.Prepare(dtb)
+
 # Prepare the device tree by making sure that any missing
 # properties are added (e.g. 'pos' and 'size'). The values of these
 # may not be correct yet, but we add placeholders so that the
@@ -151,9 +151,10 @@ def Binman(options, args):
 image.AddMissingProperties()
 image.ProcessFdt(dtb)
 
-dtb.Sync(auto_resize=True)
-dtb.Pack()
-dtb.Flush()
+for dtb_item in state.GetFdts():
+dtb_item.Sync(auto_resize=True)
+dtb_item.Pack()
+dtb_item.Flush()
 
 for image in images.values():
 # Perform all steps for this image, including checking and
@@ -168,14 +169,18 @@ def Binman(options, args):
 image.SetImagePos()
 if options.update_fdt:
 image.SetCalculatedProperties()
-dtb.Sync()
+for dtb_item in state.GetFdts():
+dtb_item.Sync()
 image.ProcessEntryContents()
 image.WriteSymbols()
 image.BuildImage()
 if options.map:
 image.WriteMap()
-with open(fname, 'wb') as outfd:
-outfd.write(dtb.GetContents())
+
+# Write the updated FDTs to our output files
+for dtb_item in state.GetFdts():
+tools.WriteFile(dtb_item._fname, dtb_item.GetContents())
+
 finally:
 tools.FinaliseOutputDir()
 finally:
diff --git a/tools/binman/state.py b/tools/binman/state.py
index 6bc24ddf8ac..9583b3fa5f6 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -18,6 +18,15 @@ fdt_files = {}
 # Arguments passed to binman to provide arguments to entries
 entry_args = {}
 
+# Set of all device tree files references by images
+fdt_set = Set()
+
+# Same as above, but excluding the main one
+fdt_subset = Set()
+
+# The DTB which contains the full image information
+main_dtb = None
+
 def GetFdt(fname):
 """Get the Fdt object for a particular device-tree filename
 
@@ -75,3 +84,37 @@ def GetEntryArg(name):
 String value of argument
 """
 return entry_args.get(name)
+
+def Prepare(dtb):
+"""Get device tree files ready for use
+
+This sets up a set of device tree files that can be retrieved by GetFdts().
+At present there is only one, that for U-Boot proper.
+
+Args:
+dtb: Main dtb
+"""
+global fdt_set, fdt_subset, fdt_files, main_dtb
+# Import these here in case libfdt.py is not available, in which case
+# the above help option still works.
+import fdt
+import fdt_util
+
+# If we are updating the DTBs we need to put these updated versions
+# where Entry_blob_dtb can find them. We can ignore 'u-boot.dtb'
+# since it is assumed to be the one passed in with options.dt, and
+# was handled just above.
+main_dtb = dtb
+fdt_files.clear()
+fdt_files['u-boot.dtb'] = dtb
+fdt_set = Set()
+fdt_subset = Set()
+
+def GetFdts():
+"""Yield all device tree files being used by binman
+
+Yields:
+Device trees being used (U-Boot proper, SPL, TPL)
+"""
+yield main_dtb
+
-- 
2.19.0.397.gdd90340f6a-goog

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


Re: [U-Boot] [PATCH v3 19/20] avb_verify: support sandbox configuration

2018-09-14 Thread Simon Glass
Hi Jens,

On 3 September 2018 at 16:47, Jens Wiklander  wrote:
> With CONFIG_SANDBOX malloc a buffer in get_sector_buf() and return that
> instead of returning CONFIG_FASTBOOT_BUF_ADDR since there's no such
> buffer reserved.
>
> Signed-off-by: Jens Wiklander 
> ---
>  include/avb_verify.h | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/include/avb_verify.h b/include/avb_verify.h
> index a532a2331aea..7b95409d247e 100644
> --- a/include/avb_verify.h
> +++ b/include/avb_verify.h
> @@ -76,7 +76,16 @@ static inline size_t get_sector_buf_size(void)
>
>  static inline void *get_sector_buf(void)
>  {
> +#ifdef CONFIG_SANDBOX
> +   static void *p;
> +
> +   if (!p)
> +   p = avb_malloc_(get_sector_buf_size());
> +
> +   return p;
> +#else
> return (void *)CONFIG_FASTBOOT_BUF_ADDR;

Can you not define this on sandbox? We don't want sandbox to have
special-case code if we can avoid it.

If you do define it, you should change the code to:

return map_sysmem(CONFIG_..., size);

which works on sandbox and other archs too.

> +#endif
>  }
>
>  static inline bool is_buf_unaligned(void *buffer)
> --
> 2.17.1
>

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


Re: [U-Boot] [PATCH v3 14/20] sandbox: imply CONFIG_TEE (TEE uclass)

2018-09-14 Thread Simon Glass
On 3 September 2018 at 16:47, Jens Wiklander  wrote:
> Signed-off-by: Jens Wiklander 
> ---
>  arch/Kconfig | 1 +
>  1 file changed, 1 insertion(+)

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


[U-Boot] [PATCH 13/31] binman: Add an entry method for getting the default filename

2018-09-14 Thread Simon Glass
Various entry implementations provide a way to obtain the default filename
for an entry. But at present there is no base-class implementation for
this function. Add one so that the API is defined.

Signed-off-by: Simon Glass 
---

 tools/binman/entry.py  | 3 +++
 tools/binman/entry_test.py | 5 +
 2 files changed, 8 insertions(+)

diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index e671a2ea094..ec3b22e9b31 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -160,6 +160,9 @@ class Entry(object):
 self.align_end = fdt_util.GetInt(self._node, 'align-end')
 self.offset_unset = fdt_util.GetBool(self._node, 'offset-unset')
 
+def GetDefaultFilename(self):
+return None
+
 def AddMissingProperties(self):
 """Add new properties to the device tree as needed for this entry"""
 for prop in ['offset', 'size', 'image-pos']:
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index 4100bcc3d32..69d85b4cedb 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -65,6 +65,11 @@ class TestEntry(unittest.TestCase):
 sub_entry = entry.Entry(None, None, sub_node, read_node=False)
 self.assertEqual('root.subnode', sub_entry.GetUniqueName())
 
+def testGetDefaultFilename(self):
+"""Trivial test for this base class function"""
+import entry
+base_entry = entry.Entry(None, None, None, read_node=False)
+self.assertIsNone(base_entry.GetDefaultFilename())
 
 if __name__ == "__main__":
 unittest.main()
-- 
2.19.0.397.gdd90340f6a-goog

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


Re: [U-Boot] [PATCH 2/4] ata: ahci: Don't cap AHCI port count under CONFIG_DM_SCSI

2018-09-14 Thread Simon Glass
On 13 September 2018 at 00:28, Tuomas Tynkkynen  wrote:
> When using device model this sort of hardcoded limits aren't used or
> necessary.
>
> Signed-off-by: Tuomas Tynkkynen 
> ---
>  drivers/ata/ahci.c | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass 

But please see below
>
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 333f0457f6..5fafb63aeb 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -230,8 +230,10 @@ static int ahci_host_init(struct ahci_uc_priv *uc_priv)
> debug("cap 0x%x  port_map 0x%x  n_ports %d\n",
>   uc_priv->cap, uc_priv->port_map, uc_priv->n_ports);
>
> +#if !defined(CONFIG_DM_SCSI)

Can you use this instead?

if (IS_DEFINED(CONFIG_DM_SCSI))

> if (uc_priv->n_ports > CONFIG_SYS_SCSI_MAX_SCSI_ID)
> uc_priv->n_ports = CONFIG_SYS_SCSI_MAX_SCSI_ID;
> +#endif
>
> for (i = 0; i < uc_priv->n_ports; i++) {
> if (!(port_map & (1 << i)))
> --
> 2.16.3
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v3 17/20] avb_verify: support using OP-TEE TA AVB

2018-09-14 Thread Simon Glass
On 3 September 2018 at 16:47, Jens Wiklander  wrote:
> With CONFIG_OPTEE_TA_AVB use the trusted application AVB provided by
> OP-TEE to manage rollback indexes and device lock status.

Should this be device-lock status?

>
> Signed-off-by: Jens Wiklander 
> ---
>  common/avb_verify.c  | 118 ++-
>  doc/README.avb2  |  13 +
>  include/avb_verify.h |   4 ++
>  3 files changed, 134 insertions(+), 1 deletion(-)

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


[U-Boot] [PATCH 31/31] binman: Allow writing a map file when something goes wrong

2018-09-14 Thread Simon Glass
When we get a problem like overlapping regions it is sometimes hard to
figure what what is going on. At present we don't write the map file in
this case. However the file does provide useful information.

Catch any packing errors and write a map file (if enabled with -m) to aid
debugging.

Signed-off-by: Simon Glass 
---

 tools/binman/control.py | 12 +---
 tools/binman/entry.py   | 11 +--
 tools/binman/ftest.py   | 24 ++--
 tools/binman/image.py   |  7 ++-
 4 files changed, 46 insertions(+), 8 deletions(-)

diff --git a/tools/binman/control.py b/tools/binman/control.py
index caa194c8990..3446e2e79c5 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -163,9 +163,15 @@ def Binman(options, args):
 # completed and written, but that does not seem important.
 image.GetEntryContents()
 image.GetEntryOffsets()
-image.PackEntries()
-image.CheckSize()
-image.CheckEntries()
+try:
+image.PackEntries()
+image.CheckSize()
+image.CheckEntries()
+except Exception as e:
+if options.map:
+fname = image.WriteMap()
+print "Wrote map file '%s' to show errors"  % fname
+raise
 image.SetImagePos()
 if options.update_fdt:
 image.SetCalculatedProperties()
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 01be291b709..648cfd241f1 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -390,10 +390,17 @@ class Entry(object):
 """
 pass
 
+@staticmethod
+def GetStr(value):
+if value is None:
+return '  '
+return '%08x' % value
+
 @staticmethod
 def WriteMapLine(fd, indent, name, offset, size, image_pos):
-print('%08x  %s%08x  %08x  %s' % (image_pos, ' ' * indent, offset,
-  size, name), file=fd)
+print('%s  %s%s  %s  %s' % (Entry.GetStr(image_pos), ' ' * indent,
+Entry.GetStr(offset), Entry.GetStr(size),
+name), file=fd)
 
 def WriteMap(self, fd, indent):
 """Write a map of the entry to a .map file
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 0fe16d90661..a32e423baf5 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1608,8 +1608,9 @@ class TestFunctional(unittest.TestCase):
 
 def testExpandSizeBad(self):
 """Test an expanding entry which fails to provide contents"""
-with self.assertRaises(ValueError) as e:
-self._DoReadFileDtb('89_expand_size_bad.dts', map=True)
+with test_util.capture_sys_output() as (stdout, stderr):
+with self.assertRaises(ValueError) as e:
+self._DoReadFileDtb('89_expand_size_bad.dts', map=True)
 self.assertIn("Node '/binman/_testing': Cannot obtain contents when "
   'expanding entry', str(e.exception))
 
@@ -1725,6 +1726,25 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('-boot', fd.read())
 data = self._DoReadFile('97_elf_strip.dts')
 
+def testPackOverlapMap(self):
+"""Test that overlapping regions are detected"""
+with test_util.capture_sys_output() as (stdout, stderr):
+with self.assertRaises(ValueError) as e:
+self._DoTestFile('14_pack_overlap.dts', map=True)
+map_fname = tools.GetOutputFilename('image.map')
+self.assertEqual("Wrote map file '%s' to show errors\n" % map_fname,
+ stdout.getvalue())
+
+# We should not get an inmage, but there should be a map file
+self.assertFalse(os.path.exists(tools.GetOutputFilename('image.bin')))
+self.assertTrue(os.path.exists(map_fname))
+map_data = tools.ReadFile(map_fname)
+self.assertEqual('''ImagePosOffset  Size  Name
+  0007  main-section
+   0004  u-boot
+ 0003  0004  u-boot-align
+''', map_data)
+
 
 if __name__ == "__main__":
 unittest.main()
diff --git a/tools/binman/image.py b/tools/binman/image.py
index e113a60ac9a..f237ae302df 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -139,10 +139,15 @@ class Image:
 return self._section.GetEntries()
 
 def WriteMap(self):
-"""Write a map of the image to a .map file"""
+"""Write a map of the image to a .map file
+
+Returns:
+Filename of map file written
+"""
 filename = '%s.map' % self._name
 fname = tools.GetOutputFilename(filename)
 with open(fname, 'w') as fd:
 print('%8s  %8s  %8s  %s' % ('ImagePos', 'Offset', 'Size', 'Name'),
   

Re: [U-Boot] [PATCH v3 18/20] test_avb: Update pymark.buildconfigspec information for the AVB tests

2018-09-14 Thread Simon Glass
On 3 September 2018 at 16:47, Jens Wiklander  wrote:
> Update the pymark.buildconfigspec to depend on 'cmd_mmc' in addition to
> 'cmd_avb' for those tests that needs more a more complete MMC
> implementation or the "mmc" command.
>
> Signed-off-by: Jens Wiklander 
> ---
>  test/py/tests/test_avb.py | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)

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


[U-Boot] [PATCH 30/31] binman: Support ELF files for U-Boot and SPL

2018-09-14 Thread Simon Glass
For sandbox we want to put ELF files in the image since that is what we
need to execute. Add support for this.

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries  | 22 
 tools/binman/etype/u_boot_elf.py | 39 
 tools/binman/etype/u_boot_spl_elf.py | 24 +
 tools/binman/ftest.py| 16 
 tools/binman/test/96_elf.dts | 14 ++
 tools/binman/test/97_elf_strip.dts   | 15 +++
 6 files changed, 130 insertions(+)
 create mode 100644 tools/binman/etype/u_boot_elf.py
 create mode 100644 tools/binman/etype/u_boot_spl_elf.py
 create mode 100644 tools/binman/test/96_elf.dts
 create mode 100644 tools/binman/test/97_elf_strip.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 4dd67d64fa7..69b435f96eb 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -361,6 +361,17 @@ it available to u_boot_ucode.
 
 
 
+Entry: u-boot-elf: U-Boot ELF image
+---
+
+Properties / Entry arguments:
+- filename: Filename of u-boot (default 'u-boot')
+
+This is the U-Boot ELF image. It does not include a device tree but can be
+relocated to any address for execution.
+
+
+
 Entry: u-boot-img: U-Boot legacy image
 --
 
@@ -444,6 +455,17 @@ to activate.
 
 
 
+Entry: u-boot-spl-elf: U-Boot SPL ELF image
+---
+
+Properties / Entry arguments:
+- filename: Filename of SPL u-boot (default 'spl/u-boot')
+
+This is the U-Boot SPL ELF image. It does not include a device tree but can
+be relocated to any address for execution.
+
+
+
 Entry: u-boot-spl-nodtb: SPL binary without device tree appended
 
 
diff --git a/tools/binman/etype/u_boot_elf.py b/tools/binman/etype/u_boot_elf.py
new file mode 100644
index 000..134b6cc15b4
--- /dev/null
+++ b/tools/binman/etype/u_boot_elf.py
@@ -0,0 +1,39 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2018 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for U-Boot ELF image
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+import fdt_util
+import tools
+
+class Entry_u_boot_elf(Entry_blob):
+"""U-Boot ELF image
+
+Properties / Entry arguments:
+- filename: Filename of u-boot (default 'u-boot')
+
+This is the U-Boot ELF image. It does not include a device tree but can be
+relocated to any address for execution.
+"""
+def __init__(self, section, etype, node):
+Entry_blob.__init__(self, section, etype, node)
+self._strip = fdt_util.GetBool(self._node, 'strip')
+
+def ReadBlobContents(self):
+if self._strip:
+uniq = self.GetUniqueName()
+out_fname = tools.GetOutputFilename('%s.stripped' % uniq)
+tools.WriteFile(out_fname, tools.ReadFile(self._pathname))
+tools.Run('strip', out_fname)
+self.SetContents(tools.ReadFile(out_fname))
+else:
+self.SetContents(tools.ReadFile(self._pathname))
+return True
+
+def GetDefaultFilename(self):
+return 'u-boot'
diff --git a/tools/binman/etype/u_boot_spl_elf.py 
b/tools/binman/etype/u_boot_spl_elf.py
new file mode 100644
index 000..da328ae15e1
--- /dev/null
+++ b/tools/binman/etype/u_boot_spl_elf.py
@@ -0,0 +1,24 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2018 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for U-Boot SPL ELF image
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_u_boot_spl_elf(Entry_blob):
+"""U-Boot SPL ELF image
+
+Properties / Entry arguments:
+- filename: Filename of SPL u-boot (default 'spl/u-boot')
+
+This is the U-Boot SPL ELF image. It does not include a device tree but can
+be relocated to any address for execution.
+"""
+def __init__(self, section, etype, node):
+Entry_blob.__init__(self, section, etype, node)
+
+def GetDefaultFilename(self):
+return 'spl/u-boot-spl'
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index ff934d0..0fe16d90661 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1709,6 +1709,22 @@ class TestFunctional(unittest.TestCase):
  fmap_util.FMAP_AREA_LEN * 3, fentries[2].size)
 self.assertEqual('FMAP', fentries[2].name)
 
+def testElf(self):
+"""Basic test of ELF entries"""
+with open(self.TestFile('bss_data')) as fd:
+TestFunctional._MakeInputFile('spl/u-boot-spl', fd.read())
+with open(self.TestFile('bss_data')) as fd:
+TestFunctional._MakeInputFile('-boot', fd.read())
+data = self._DoReadFile('96_elf.dts')
+
+def testElfStripg(self):
+"""Basic test of ELF entries"""
+with open(self.TestFile('bss_data')) as fd:
+Te

[U-Boot] [PATCH 24/31] binman: Support expanding entries

2018-09-14 Thread Simon Glass
It is useful to have entries which can grow automatically to fill
available space. Add support for this.

Signed-off-by: Simon Glass 
---

 tools/binman/README  |  4 +++
 tools/binman/bsection.py | 22 +++-
 tools/binman/entry.py| 11 ++
 tools/binman/etype/_testing.py   |  7 +++-
 tools/binman/etype/section.py|  8 +
 tools/binman/ftest.py| 29 
 tools/binman/test/88_expand_size.dts | 43 
 tools/binman/test/89_expand_size_bad.dts | 14 
 8 files changed, 136 insertions(+), 2 deletions(-)
 create mode 100644 tools/binman/test/88_expand_size.dts
 create mode 100644 tools/binman/test/89_expand_size_bad.dts

diff --git a/tools/binman/README b/tools/binman/README
index 34b83110f64..cd1ad2fb0fe 100644
--- a/tools/binman/README
+++ b/tools/binman/README
@@ -330,6 +330,10 @@ image-pos:
for each entry. This makes it easy to find out exactly where the entry
ended up in the image, regardless of parent sections, etc.
 
+expand-size:
+   Expand the size of this entry to fit available space. This space is only
+   limited by the size of the image/section and the position of the next
+   entry.
 
 The attributes supported for images are described below. Several are similar
 to those for entries.
diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 4bf206878dc..52ac31a4672 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -253,10 +253,26 @@ class Section(object):
 for entry in entries:
 self._entries[entry._node.name] = entry
 
+def _ExpandEntries(self):
+"""Expand any entries that are permitted to"""
+exp_entry = None
+for entry in self._entries.values():
+if exp_entry:
+exp_entry.ExpandToLimit(entry.offset)
+exp_entry = None
+if entry.expand_size:
+exp_entry = entry
+if exp_entry:
+exp_entry.ExpandToLimit(self._size)
+
 def CheckEntries(self):
-"""Check that entries do not overlap or extend outside the section"""
+"""Check that entries do not overlap or extend outside the section
+
+This also sorts entries, if needed and expands
+"""
 if self._sort:
 self._SortEntries()
+self._ExpandEntries()
 offset = 0
 prev_name = 'None'
 for entry in self._entries.values():
@@ -419,3 +435,7 @@ class Section(object):
 return None
 return entry.data
 source_entry.Raise("Cannot find entry for node '%s'" % node.name)
+
+def ExpandSize(self, size):
+if size != self._size:
+self._size = size
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 7316ad43b5e..0915b470b4e 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -76,6 +76,7 @@ class Entry(object):
 self.pad_after = 0
 self.offset_unset = False
 self.image_pos = None
+self._expand_size = False
 if read_node:
 self.ReadNode()
 
@@ -161,6 +162,7 @@ class Entry(object):
  "of two" % (self._node.path, self.align_size))
 self.align_end = fdt_util.GetInt(self._node, 'align-end')
 self.offset_unset = fdt_util.GetBool(self._node, 'offset-unset')
+self.expand_size = fdt_util.GetBool(self._node, 'expand-size')
 
 def GetDefaultFilename(self):
 return None
@@ -507,3 +509,12 @@ features to produce new behaviours.
 break
 name = '%s.%s' % (node.name, name)
 return name
+
+def ExpandToLimit(self, limit):
+"""Expand an entry so that it ends at the given offset limit"""
+if self.offset + self.size < limit:
+self.size = limit - self.offset
+# Request the contents again, since changing the size requires that
+# the data grows. This should not fail, but check it to be sure.
+if not self.ObtainContents():
+self.Raise('Cannot obtain contents when expanding entry')
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py
index 02c165c0c3e..3e345bd9526 100644
--- a/tools/binman/etype/_testing.py
+++ b/tools/binman/etype/_testing.py
@@ -48,6 +48,8 @@ class Entry__testing(Entry):
  'return-unknown-contents')
 self.bad_update_contents = fdt_util.GetBool(self._node,
 'bad-update-contents')
+self.return_contents_once = fdt_util.GetBool(self._node,
+ 'return-contents-once')
 
 # Set to True when the entry is ready to process the FDT.
 self.process_fdt_ready = False
@@ -68,12 +70,15 @@ class Entry__testing(Entry):
 EntryArg('

[U-Boot] [PATCH 19/31] binman: Support updating all device tree files

2018-09-14 Thread Simon Glass
Binman currently supports updating the main device tree with things like
the position of each entry. Extend this support to SPL and TPL as well,
since they may need (a subset of) this information.

Also adjust DTB output files to have a .out extension since this seems
clearer than having a .dtb extension with 'out' in the name somwhere.

Also add a few missing comments and update the DT setup code to use
ReadFile and WriteFile().

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries |  12 +++
 tools/binman/control.py |   6 +-
 tools/binman/entry.py   |  11 ++
 tools/binman/etype/blob_dtb.py  |  33 ++
 tools/binman/etype/section.py   |   3 +
 tools/binman/etype/u_boot_dtb.py|   9 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py |   8 +-
 tools/binman/etype/u_boot_spl_dtb.py|   6 +-
 tools/binman/etype/u_boot_tpl_dtb.py|   6 +-
 tools/binman/ftest.py   | 109 +++-
 tools/binman/image.py   |   5 +
 tools/binman/state.py   |  30 ++
 tools/binman/test/82_fdt_update_all.dts |  18 
 13 files changed, 235 insertions(+), 21 deletions(-)
 create mode 100644 tools/binman/etype/blob_dtb.py
 create mode 100644 tools/binman/test/82_fdt_update_all.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 5cb52a92ff9..091fb5ce2b6 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -26,6 +26,15 @@ example the 'u_boot' entry which provides the filename 
'u-boot.bin'.
 
 
 
+Entry: blob-dtb: A blob that holds a device tree
+
+
+This is a blob containing a device tree. The contents of the blob are
+obtained from the list of available device-tree files, managed by the
+'state' module.
+
+
+
 Entry: blob-named-by-arg: A blob entry which gets its filename property from 
its subclass
 
-
 
@@ -309,6 +318,9 @@ This is the U-Boot device tree, containing configuration 
information for
 U-Boot. U-Boot needs this to know what devices are present and which drivers
 to activate.
 
+Note: This is mostly an internal entry type, used by others. This allows
+binman to know which entries contain a device tree.
+
 
 
 Entry: u-boot-dtb-with-ucode: A U-Boot device tree file, with the microcode 
removed
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 34ec74ba1b3..e326456a4ba 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -116,10 +116,8 @@ def Binman(options, args):
 # output into a file in our output directly. Then scan it for use
 # in binman.
 dtb_fname = fdt_util.EnsureCompiled(dtb_fname)
-fname = tools.GetOutputFilename('u-boot-out.dtb')
-with open(dtb_fname) as infd:
-with open(fname, 'wb') as outfd:
-outfd.write(infd.read())
+fname = tools.GetOutputFilename('u-boot.dtb.out')
+tools.WriteFile(fname, tools.ReadFile(dtb_fname))
 dtb = fdt.FdtScan(fname)
 
 node = _FindBinmanNode(dtb)
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index e5f557749f6..f922107523e 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -192,6 +192,17 @@ class Entry(object):
 state.SetInt(self._node, 'image-pos', self.image_pos)
 
 def ProcessFdt(self, fdt):
+"""Allow entries to adjust the device tree
+
+Some entries need to adjust the device tree for their purposes. This
+may involve adding or deleting properties.
+
+Returns:
+True if processing is complete
+False if processing could not be completed due to a dependency.
+This will cause the entry to be retried after others have been
+called
+"""
 return True
 
 def SetPrefix(self, prefix):
diff --git a/tools/binman/etype/blob_dtb.py b/tools/binman/etype/blob_dtb.py
new file mode 100644
index 000..cc5b4a3f760
--- /dev/null
+++ b/tools/binman/etype/blob_dtb.py
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2018 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for U-Boot device tree files
+#
+
+import state
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_blob_dtb(Entry_blob):
+"""A blob that holds a device tree
+
+This is a blob containing a device tree. The contents of the blob are
+obtained from the list of available device-tree files, managed by the
+'state' module.
+"""
+def __init__(self, section, etype, node):
+Entry_blob.__init__(self, section, etype, node)
+
+def ObtainContents(self):
+"""Get the device-tree from the list held by the 'state' module"""
+self._filename = self.GetD

[U-Boot] [PATCH 08/31] dtoc: Allow syncing of the device tree back to a file

2018-09-14 Thread Simon Glass
At present we require the caller to manually update the device tree using
individual calls to libfdt functions. This is not ideal. It would be
better if we could make changes using the Python structure and then call a
Sync() function to write them back.

Add this feature to the Fdt class. Update binman and the tests to match.

Signed-off-by: Simon Glass 
---

 tools/binman/control.py |  2 +
 tools/dtoc/fdt.py   | 91 +
 tools/dtoc/test_fdt.py  |  8 +++-
 3 files changed, 91 insertions(+), 10 deletions(-)

diff --git a/tools/binman/control.py b/tools/binman/control.py
index 8c48008fc75..ded1b71109b 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -183,6 +183,7 @@ def Binman(options, args):
 image.AddMissingProperties()
 image.ProcessFdt(dtb)
 
+dtb.Sync(auto_resize=True)
 dtb.Pack()
 dtb.Flush()
 
@@ -199,6 +200,7 @@ def Binman(options, args):
 image.SetImagePos()
 if options.update_fdt:
 image.SetCalculatedProperties()
+dtb.Sync()
 image.ProcessEntryContents()
 image.WriteSymbols()
 image.BuildImage()
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 55baa3857f7..76cd66fbf95 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -43,6 +43,7 @@ class Prop:
 self.name = name
 self.value = None
 self.bytes = str(bytes)
+self.dirty = False
 if not bytes:
 self.type = TYPE_BOOL
 self.value = True
@@ -160,6 +161,45 @@ class Prop:
 self._node._fdt.CheckCache()
 return self._node._fdt.GetStructOffset(self._offset)
 
+def SetInt(self, val):
+"""Set the integer value of the property
+
+The device tree is marked dirty so that the value will be written to
+the block on the next sync.
+
+Args:
+val: Integer value (32-bit, single cell)
+"""
+self.bytes = struct.pack('>I', val);
+self.value = val
+self.type = TYPE_INT
+self.dirty = True
+
+def Sync(self, auto_resize=False):
+"""Sync property changes back to the device tree
+
+This updates the device tree blob with any changes to this property
+since the last sync.
+
+Args:
+auto_resize: Resize the device tree automatically if it does not
+have enough space for the update
+
+Raises:
+FdtException if auto_resize is False and there is not enough space
+"""
+if self._offset is None or self.dirty:
+node = self._node
+fdt_obj = node._fdt._fdt_obj
+if auto_resize:
+while fdt_obj.setprop(node.Offset(), self.name, self.bytes,
+(libfdt.NOSPACE,)) == -libfdt.NOSPACE:
+fdt_obj.resize(fdt_obj.totalsize() + 1024)
+fdt_obj.setprop(node.Offset(), self.name, self.bytes)
+else:
+fdt_obj.setprop(node.Offset(), self.name, self.bytes)
+
+
 class Node:
 """A device tree node
 
@@ -284,13 +324,7 @@ class Node:
 Args:
 prop_name: Name of property
 """
-fdt_obj = self._fdt._fdt_obj
-if fdt_obj.setprop_u32(self.Offset(), prop_name, 0,
-   (libfdt.NOSPACE,)) == -libfdt.NOSPACE:
-fdt_obj.resize(fdt_obj.totalsize() + 1024)
-fdt_obj.setprop_u32(self.Offset(), prop_name, 0)
-self.props[prop_name] = Prop(self, -1, prop_name, '\0' * 4)
-self._fdt.Invalidate()
+self.props[prop_name] = Prop(self, None, prop_name, '\0' * 4)
 
 def SetInt(self, prop_name, val):
 """Update an integer property int the device tree.
@@ -301,8 +335,34 @@ class Node:
 prop_name: Name of property
 val: Value to set
 """
-fdt_obj = self._fdt._fdt_obj
-fdt_obj.setprop_u32(self.Offset(), prop_name, val)
+self.props[prop_name].SetInt(val)
+
+def Sync(self, auto_resize=False):
+"""Sync node changes back to the device tree
+
+This updates the device tree blob with any changes to this node and its
+subnodes since the last sync.
+
+Args:
+auto_resize: Resize the device tree automatically if it does not
+have enough space for the update
+
+Raises:
+FdtException if auto_resize is False and there is not enough space
+"""
+# Sync subnodes in reverse so that we don't disturb node offsets for
+# nodes that are earlier in the DT. This avoids an O(n^2) rescan of
+# node offsets.
+for node in reversed(self.subnodes):
+node.Sync(auto_resize)
+
+# Sync properties now, whose offsets should not have been disturbed.
+# We do this after su

Re: [U-Boot] [PATCH v2 21/23] test/py: convert fs-test.sh to pytest

2018-09-14 Thread Simon Glass
Hi Akashi,

On 4 September 2018 at 09:49, AKASHI Takahiro
 wrote:
> In this commit, the same set of test cases as in test/fs/fs-test.sh
> is provided using pytest framework.
> Actually, fs-test.sh provides three variants:"sb" (sb command), "nonfs"
> (fatxx and etc.) and "fs" (hostfs), and this patch currently supports
> only "nonfs" variant; So it is not a replacement of fs-test.sh for now.
>
> Simple usage:
>   $ py.test test/py/tests/test_fs []
>
> You may also specify filesystem types to be tested:
>   $ py.test test/py/tests/test_fs --fs-type fat32 []
>
> Signed-off-by: AKASHI Takahiro 
> ---
>  test/py/tests/test_fs/conftest.py| 216 
>  test/py/tests/test_fs/fstest_defs.py |  10 +
>  test/py/tests/test_fs/test_basic.py  | 287 +++
>  3 files changed, 513 insertions(+)
>  create mode 100644 test/py/tests/test_fs/conftest.py
>  create mode 100644 test/py/tests/test_fs/fstest_defs.py
>  create mode 100644 test/py/tests/test_fs/test_basic.py

Thanks for doing this!

Can you also please delete the old shell script?

Does this get automatically executed with 'make tests'?

If not, is it possible to do that easily, if we reduce the size of files, etc?

>
> diff --git a/test/py/tests/test_fs/conftest.py 
> b/test/py/tests/test_fs/conftest.py
> new file mode 100644
> index ..9155ccf84266
> --- /dev/null
> +++ b/test/py/tests/test_fs/conftest.py
> @@ -0,0 +1,216 @@
> +# SPDX-License-Identifier:  GPL-2.0+
> +# Copyright (c) 2018, Linaro Limited
> +# Author: Takahiro Akashi 
> +
> +import os
> +import os.path
> +import pytest
> +import re
> +from subprocess import call, check_call, check_output, CalledProcessError
> +from fstest_defs import *
> +
> +supported_fs_basic = ['fat16', 'fat32', 'ext4']
> +
> +#
> +# Filesystem test specific setup
> +#
> +def pytest_addoption(parser):

Please can you add full function comments to each function? You can
see other tests or binman for the format to use.
[...]

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


Re: [U-Boot] [PATCH v3 20/20] Kconfig: sandbox: enable cmd_avb and dependencies

2018-09-14 Thread Simon Glass
On 3 September 2018 at 16:47, Jens Wiklander  wrote:
> Enables cmd_avb and its dependencies need to run the AVB tests.
>
> Signed-off-by: Jens Wiklander 
> ---
>  arch/Kconfig | 4 
>  drivers/fastboot/Kconfig | 2 ++
>  2 files changed, 6 insertions(+)

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


Re: [U-Boot] [PATCH 4/4] configs: Drop CONFIG_SYS_SCSI_MAXDEVICE

2018-09-14 Thread Simon Glass
On 13 September 2018 at 00:28, Tuomas Tynkkynen  wrote:
> This option has never been used for anything. Drop it.
>
> Signed-off-by: Tuomas Tynkkynen 
> ---
>  include/configs/MPC8544DS.h   | 3 +--
>  include/configs/MPC8572DS.h   | 1 -
>  include/configs/MPC8610HPCD.h | 1 -
>  include/configs/MPC8641HPCN.h | 1 -
>  include/configs/sbc8641d.h| 1 -
>  scripts/config_whitelist.txt  | 1 -
>  6 files changed, 1 insertion(+), 7 deletions(-)

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


[U-Boot] [PATCH 11/31] dtoc: Add methods for adding and updating properties

2018-09-14 Thread Simon Glass
Add a few more functions which allow creating and modifying property
values. If only we could do this so easily in the real world.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py  | 70 ++
 tools/dtoc/test_fdt.py | 43 ++
 2 files changed, 113 insertions(+)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 26f4a4ee562..c5054e8cc91 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -175,6 +175,16 @@ class Prop:
 self.type = TYPE_INT
 self.dirty = True
 
+def SetData(self, bytes):
+"""Set the value of a property as bytes
+
+Args:
+bytes: New property value to set
+"""
+self.bytes = str(bytes)
+self.type, self.value = self.BytesToValue(bytes)
+self.dirty = True
+
 def Sync(self, auto_resize=False):
 """Sync property changes back to the device tree
 
@@ -326,18 +336,78 @@ class Node:
 """
 self.props[prop_name] = Prop(self, None, prop_name, '\0' * 4)
 
+def AddEmptyProp(self, prop_name, len):
+"""Add a property with a fixed data size, for filling in later
+
+The device tree is marked dirty so that the value will be written to
+the blob on the next sync.
+
+Args:
+prop_name: Name of property
+len: Length of data in property
+"""
+value = chr(0) * len
+self.props[prop_name] = Prop(self, None, prop_name, value)
+
 def SetInt(self, prop_name, val):
 """Update an integer property int the device tree.
 
 This is not allowed to change the size of the FDT.
 
+The device tree is marked dirty so that the value will be written to
+the blob on the next sync.
+
 Args:
 prop_name: Name of property
 val: Value to set
 """
 self.props[prop_name].SetInt(val)
 
+def SetData(self, prop_name, val):
+"""Set the data value of a property
+
+The device tree is marked dirty so that the value will be written to
+the blob on the next sync.
+
+Args:
+prop_name: Name of property to set
+val: Data value to set
+"""
+self.props[prop_name].SetData(val)
+
+def SetString(self, prop_name, val):
+"""Set the string value of a property
+
+The device tree is marked dirty so that the value will be written to
+the blob on the next sync.
+
+Args:
+prop_name: Name of property to set
+val: String value to set (will be \0-terminated in DT)
+"""
+self.props[prop_name].SetData(val + chr(0))
+
+def AddString(self, prop_name, val):
+"""Add a new string property to a node
+
+The device tree is marked dirty so that the value will be written to
+the blob on the next sync.
+
+Args:
+prop_name: Name of property to add
+val: String value of property
+"""
+self.props[prop_name] = Prop(self, None, prop_name, val + chr(0))
+
 def AddSubnode(self, name):
+"""Add a new subnode to the node
+
+Args:
+name: name of node to add
+
+Returns:
+New subnode that was created
+"""
 path = self.path + '/' + name
 subnode = Node(self._fdt, self, None, name, path)
 self.subnodes.append(subnode)
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index c94e455d121..22a075d6c57 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -352,6 +352,7 @@ class TestProp(unittest.TestCase):
 with self.assertRaises(libfdt.FdtException) as e:
 self.dtb.Sync(auto_resize=False)
 self.assertIn('FDT_ERR_NOSPACE', str(e.exception))
+self.dtb.Sync(auto_resize=True)
 
 def testAddNode(self):
 self.fdt.pack()
@@ -364,6 +365,48 @@ class TestProp(unittest.TestCase):
 offset = self.fdt.path_offset('/spl-test/subnode')
 self.assertTrue(offset > 0)
 
+def testAddMore(self):
+"""Test various other methods for adding and setting properties"""
+self.node.AddZeroProp('one')
+self.dtb.Sync(auto_resize=True)
+data = self.fdt.getprop(self.node.Offset(), 'one')
+self.assertEqual(0, fdt32_to_cpu(data))
+
+self.node.SetInt('one', 1)
+self.dtb.Sync(auto_resize=False)
+data = self.fdt.getprop(self.node.Offset(), 'one')
+self.assertEqual(1, fdt32_to_cpu(data))
+
+val = '123' + chr(0) + '456'
+self.node.AddString('string', val)
+self.dtb.Sync(auto_resize=True)
+data = self.fdt.getprop(self.node.Offset(), 'string')
+self.assertEqual(val + '\0', data)
+
+self.fdt.pack()
+self.node.SetString('string', val + 'x')
+with self.assertRaises(libfdt.FdtException) as e:
+self.dtb.Sync(auto_resize=False)
+self.assertIn('FDT_ERR_NO

[U-Boot] [PATCH 06/31] binman: Tidy up the vblock entry

2018-09-14 Thread Simon Glass
At present if there are two vblock entries an image their contents are
written to the same file in the output directory. This prevents checking
the contents of each separately.

Fix this by adding part of the entry path to the filename, and add some
missing comments.

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries  |  5 +
 tools/binman/entry.py| 18 ++
 tools/binman/entry_test.py   | 11 +++
 tools/binman/etype/vblock.py | 11 ---
 tools/binman/ftest.py|  2 +-
 5 files changed, 43 insertions(+), 4 deletions(-)

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 31bc725d577..5cb52a92ff9 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -546,6 +546,11 @@ Properties / Entry arguments:
 - kernelkey: Name of the kernel key to use (inside keydir)
 - preamble-flags: Value of the vboot preamble flags (typically 0)
 
+Output files:
+- input. - input file passed to futility
+- vblock. - output file generated by futility (which is
+used as the entry contents)
+
 Chromium OS signs the read-write firmware and kernel, writing the signature
 in this block. This allows U-Boot to verify that the next firmware stage
 and kernel are genuine.
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 77cfab9c5de..e671a2ea094 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -456,3 +456,21 @@ features to produce new behaviours.
 if missing:
 raise ValueError('Documentation is missing for modules: %s' %
  ', '.join(missing))
+
+def GetUniqueName(self):
+"""Get a unique name for a node
+
+Returns:
+String containing a unique name for a node, consisting of the name
+of all ancestors (starting from within the 'binman' node) separated
+by a dot ('.'). This can be useful for generating unique filesnames
+in the output directory.
+"""
+name = self.name
+node = self._node
+while node.parent:
+node = node.parent
+if node.name == 'binman':
+break
+name = '%s.%s' % (node.name, name)
+return name
diff --git a/tools/binman/entry_test.py b/tools/binman/entry_test.py
index 6fa735ed596..4100bcc3d32 100644
--- a/tools/binman/entry_test.py
+++ b/tools/binman/entry_test.py
@@ -54,6 +54,17 @@ class TestEntry(unittest.TestCase):
 self.assertIn("Unknown entry type 'invalid-name' in node "
   "'invalid-path'", str(e.exception))
 
+def testUniqueName(self):
+"""Test Entry.GetUniqueName"""
+import entry
+Node = collections.namedtuple('Node', ['name', 'parent'])
+base_node = Node('root', None)
+base_entry = entry.Entry(None, None, base_node, read_node=False)
+self.assertEqual('root', base_entry.GetUniqueName())
+sub_node = Node('subnode', base_node)
+sub_entry = entry.Entry(None, None, sub_node, read_node=False)
+self.assertEqual('root.subnode', sub_entry.GetUniqueName())
+
 
 if __name__ == "__main__":
 unittest.main()
diff --git a/tools/binman/etype/vblock.py b/tools/binman/etype/vblock.py
index 595af5456d1..c4d970ed160 100644
--- a/tools/binman/etype/vblock.py
+++ b/tools/binman/etype/vblock.py
@@ -25,6 +25,11 @@ class Entry_vblock(Entry):
 - kernelkey: Name of the kernel key to use (inside keydir)
 - preamble-flags: Value of the vboot preamble flags (typically 0)
 
+Output files:
+- input. - input file passed to futility
+- vblock. - output file generated by futility (which is
+used as the entry contents)
+
 Chromium OS signs the read-write firmware and kernel, writing the signature
 in this block. This allows U-Boot to verify that the next firmware stage
 and kernel are genuine.
@@ -53,8 +58,9 @@ class Entry_vblock(Entry):
 return False
 input_data += data
 
-output_fname = tools.GetOutputFilename('vblock.%s' % self.name)
-input_fname = tools.GetOutputFilename('input.%s' % self.name)
+uniq = self.GetUniqueName()
+output_fname = tools.GetOutputFilename('vblock.%s' % uniq)
+input_fname = tools.GetOutputFilename('input.%s' % uniq)
 tools.WriteFile(input_fname, input_data)
 prefix = self.keydir + '/'
 args = [
@@ -69,6 +75,5 @@ class Entry_vblock(Entry):
 ]
 #out.Notice("Sign '%s' into %s" % (', '.join(self.value), self.label))
 stdout = tools.Run('futility', *args)
-#out.Debug(stdout)
 self.SetContents(tools.ReadFile(output_fname))
 return True
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 3f4f5f3a43a..c4065551e79 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1316,7 +1316,7 @@ class TestFunctional(unittest.TestCase):
 """Fake calls to t

[U-Boot] [PATCH 22/31] binman: Allow zero-size sections

2018-09-14 Thread Simon Glass
At present if there is only a zero-size entry in a section this is
reported as an error, e.g.:

   Offset 0x0 (0) is outside the section starting at 0x0 (0)

Adjust the logic in CheckEntries() to avoid this.

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 44adb82795b..1c37d84e99a 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -258,7 +258,7 @@ class Section(object):
 for entry in self._entries.values():
 entry.CheckOffset()
 if (entry.offset < self._skip_at_start or
-entry.offset >= self._skip_at_start + self._size):
+entry.offset + entry.size > self._skip_at_start + self._size):
 entry.Raise("Offset %#x (%d) is outside the section starting "
 "at %#x (%d)" %
 (entry.offset, entry.offset, self._skip_at_start,
-- 
2.19.0.397.gdd90340f6a-goog

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


[U-Boot] [PATCH 28/31] binman: Record the parent section of each section

2018-09-14 Thread Simon Glass
At present sections have no record of their parent so it is not possible
to traverse up the tree to the root and figure out the position of a
section within the image.

Change the constructor to record this information.

Signed-off-by: Simon Glass 
---

 tools/binman/bsection.py  | 5 -
 tools/binman/etype/section.py | 3 ++-
 tools/binman/image.py | 5 +++--
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 650e9ba353f..e4c1900b17f 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -24,6 +24,7 @@ class Section(object):
 
 Attributes:
 _node: Node object that contains the section definition in device tree
+_parent_section: Parent Section object which created this Section
 _size: Section size in bytes, or None if not known yet
 _align_size: Section size alignment, or None
 _pad_before: Number of bytes before the first entry starts. This
@@ -46,14 +47,16 @@ class Section(object):
 section
 _entries: OrderedDict() of entries
 """
-def __init__(self, name, node, test=False):
+def __init__(self, name, parent_section, node, image, test=False):
 global entry
 global Entry
 import entry
 from entry import Entry
 
+self._parent_section = parent_section
 self._name = name
 self._node = node
+self._image = image
 self._offset = 0
 self._size = None
 self._align_size = None
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 005a9f9cb2e..7f1b4136049 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -32,7 +32,8 @@ class Entry_section(Entry):
 """
 def __init__(self, section, etype, node):
 Entry.__init__(self, section, etype, node)
-self._section = bsection.Section(node.name, node)
+self._section = bsection.Section(node.name, section, node,
+ section._image)
 
 def GetFdtSet(self):
 return self._section.GetFdtSet()
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 4b922b51c42..e113a60ac9a 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -42,7 +42,8 @@ class Image:
 self._size = None
 self._filename = '%s.bin' % self._name
 if test:
-self._section = bsection.Section('main-section', self._node, True)
+self._section = bsection.Section('main-section', None, self._node,
+ self, True)
 else:
 self._ReadNode()
 
@@ -52,7 +53,7 @@ class Image:
 filename = fdt_util.GetString(self._node, 'filename')
 if filename:
 self._filename = filename
-self._section = bsection.Section('main-section', self._node)
+self._section = bsection.Section('main-section', None, self._node, 
self)
 
 def GetFdtSet(self):
 """Get the set of device tree files used by this image"""
-- 
2.19.0.397.gdd90340f6a-goog

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


[U-Boot] [PATCH 00/31] binman: Expand support for SPL and TPL

2018-09-14 Thread Simon Glass
At present binman only has basic support for SPL and very little for TPL.
This series expands that a bit.

Included are:
- Update SPL and TPL device trees with image offset, etc.
- Improvements to the Fdt class to allow it to automatically sync DT
changes back to the file from the Python Prop and Node objects,
without requiring the caller to do the actual DT operation
- New entry types for list of files
- Compression of blob entries (just LZ4 for now)
- Hashing entries and sections, allowing for run-time checks
- Entries which can automatically expand to fill available space
- ELF images
- Various minor fixes and improvements


Simon Glass (31):
  fdt: Add Python support for adding/removing nodes
  binman: Move 'special properties' docs to README.entries
  binman: Allow 'fill' entry to have a size of 0
  binman: Generate an error when text is not provided
  binman: Add x86 support for starting TPL
  binman: Tidy up the vblock entry
  binman: Support building a selection of images
  dtoc: Allow syncing of the device tree back to a file
  dtoc: Fixed endianness in Prop.GetEmpty()
  dtoc: Support adding new nodes
  dtoc: Add methods for adding and updating properties
  dtoc: Add a way to create an Fdt object from a data block
  binman: Add an entry method for getting the default filename
  binman: Move state information into a new module
  binman: Move state logic into the state module
  binman: Centralise device-tree updates within binman
  binman: Obtain the list of device trees from the config
  binman: Allow control of whether a fake DT is used
  binman: Support updating all device tree files
  patman: Detect missing tools and report them
  binman: Support compressed entries
  binman: Allow zero-size sections
  binman: Support adding files
  binman: Support expanding entries
  binman: Mention section attributes in docs
  binman: Support hashing entries
  binman: Support x86 microcode in TPL
  binman: Record the parent section of each section
  binman: Correct fmap output on x86
  binman: Support ELF files for U-Boot and SPL
  binman: Allow writing a map file when something goes wrong

 scripts/dtc/pylibfdt/libfdt.i_shipped |  34 +-
 tools/binman/README   |  49 ++-
 tools/binman/README.entries   | 103 -
 tools/binman/bsection.py  |  69 ++-
 tools/binman/cmdline.py   |   4 +
 tools/binman/control.py   |  96 ++---
 tools/binman/entry.py |  92 +++-
 tools/binman/entry_test.py|  16 +
 tools/binman/etype/_testing.py|   7 +-
 tools/binman/etype/blob.py|  49 ++-
 tools/binman/etype/blob_dtb.py|  33 ++
 tools/binman/etype/files.py   |  57 +++
 tools/binman/etype/fill.py|   2 +-
 tools/binman/etype/fmap.py|  11 +-
 tools/binman/etype/section.py |  14 +-
 tools/binman/etype/text.py|   3 +
 tools/binman/etype/u_boot_dtb.py  |   9 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py   |  27 +-
 tools/binman/etype/u_boot_elf.py  |  39 ++
 tools/binman/etype/u_boot_spl_dtb.py  |   6 +-
 tools/binman/etype/u_boot_spl_elf.py  |  24 ++
 .../binman/etype/u_boot_spl_with_ucode_ptr.py |   2 +
 tools/binman/etype/u_boot_tpl_dtb.py  |   6 +-
 .../binman/etype/u_boot_tpl_dtb_with_ucode.py |  25 ++
 .../binman/etype/u_boot_tpl_with_ucode_ptr.py |  27 ++
 tools/binman/etype/u_boot_ucode.py|  26 +-
 tools/binman/etype/u_boot_with_ucode_ptr.py   |  24 +-
 tools/binman/etype/vblock.py  |  11 +-
 tools/binman/etype/x86_start16_tpl.py |  30 ++
 tools/binman/fmap_util.py |   6 +-
 tools/binman/ftest.py | 395 +-
 tools/binman/image.py |  30 +-
 tools/binman/state.py | 253 +++
 tools/binman/test/80_fill_empty.dts   |  15 +
 tools/binman/test/81_x86-start16-tpl.dts  |  14 +
 tools/binman/test/82_fdt_update_all.dts   |  18 +
 tools/binman/test/83_compress.dts |  11 +
 tools/binman/test/84_files.dts|  11 +
 tools/binman/test/85_files_compress.dts   |  11 +
 tools/binman/test/86_files_none.dts   |  12 +
 tools/binman/test/87_files_no_pattern.dts |  11 +
 tools/binman/test/88_expand_size.dts  |  43 ++
 tools/binman/test/89_expand_size_bad.dts  |  14 +
 tools/binman/test/90_hash.dts |  12 +
 tools/binman/test/91_hash_no_algo.dts |  11 +
 tools/binman/test/92_hash_bad_algo.dts|  12 +
 tools/binman/test/93_x86_tpl_ucode.dts|  29 ++
 tools/binman/test/94_fmap_x86.dts |  20 +
 tools/binman/test/95_fmap_x86_section.dts |  22 +
 tools/binman/test/96_elf.dts  |  14 +
 tools/binman/test/97_elf_strip.dts|  

[U-Boot] [PATCH 09/31] dtoc: Fixed endianness in Prop.GetEmpty()

2018-09-14 Thread Simon Glass
This should be big endian, since that is what device tree uses. Fix it.

Signed-off-by: Simon Glass 
---

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

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index 76cd66fbf95..ccf3b23ced4 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -146,7 +146,7 @@ class Prop:
 if type == TYPE_BYTE:
 return chr(0)
 elif type == TYPE_INT:
-return struct.pack('I', 0);
 elif type == TYPE_STRING:
 return ''
 else:
-- 
2.19.0.397.gdd90340f6a-goog

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


[U-Boot] [PATCH 21/31] binman: Support compressed entries

2018-09-14 Thread Simon Glass
Add support for compressing blob entries. This can help reduce image sizes
for many types of data. It requires that the firmware be able to
decompress the data at run-time.

Signed-off-by: Simon Glass 
---

 tools/binman/README   | 16 ++
 tools/binman/README.entries   |  7 +
 tools/binman/etype/blob.py| 49 +--
 tools/binman/ftest.py | 32 
 tools/binman/test/83_compress.dts | 11 +++
 5 files changed, 106 insertions(+), 9 deletions(-)
 create mode 100644 tools/binman/test/83_compress.dts

diff --git a/tools/binman/README b/tools/binman/README
index 3dc8b9b80a8..34b83110f64 100644
--- a/tools/binman/README
+++ b/tools/binman/README
@@ -593,6 +593,22 @@ the device tree. These can be used by U-Boot at run-time 
to find the location
 of each entry.
 
 
+Compression
+---
+
+Binman support compression for 'blob' entries (those of type 'blob' and
+derivatives). To enable this for an entry, add a 'compression' property:
+
+blob {
+filename = "datafile";
+compression = "lz4";
+};
+
+The entry will then contain the compressed data, using the 'lz4' compression
+algorithm. Currently this is the only one that is supported.
+
+
+
 Map files
 -
 
diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 091fb5ce2b6..2cf7dc0338d 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -19,11 +19,18 @@ class by other entry types.
 
 Properties / Entry arguments:
 - filename: Filename of file to read into entry
+- compress: Compression algorithm to use:
+none: No compression
+lz4: Use lz4 compression (via 'lz4' command-line utility)
 
 This entry reads data from a file and places it in the entry. The
 default filename is often specified specified by the subclass. See for
 example the 'u_boot' entry which provides the filename 'u-boot.bin'.
 
+If compression is enabled, an extra 'uncomp-size' property is written to
+the node (if enabled with -u) which provides the uncompressed size of the
+data.
+
 
 
 Entry: blob-dtb: A blob that holds a device tree
diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py
index 3f46eecf308..642a0e482a7 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -7,6 +7,7 @@
 
 from entry import Entry
 import fdt_util
+import state
 import tools
 
 class Entry_blob(Entry):
@@ -17,14 +18,23 @@ class Entry_blob(Entry):
 
 Properties / Entry arguments:
 - filename: Filename of file to read into entry
+- compress: Compression algorithm to use:
+none: No compression
+lz4: Use lz4 compression (via 'lz4' command-line utility)
 
 This entry reads data from a file and places it in the entry. The
 default filename is often specified specified by the subclass. See for
 example the 'u_boot' entry which provides the filename 'u-boot.bin'.
+
+If compression is enabled, an extra 'uncomp-size' property is written to
+the node (if enabled with -u) which provides the uncompressed size of the
+data.
 """
 def __init__(self, section, etype, node):
 Entry.__init__(self, section, etype, node)
-self._filename = fdt_util.GetString(self._node, "filename", self.etype)
+self._filename = fdt_util.GetString(self._node, 'filename', self.etype)
+self._compress = fdt_util.GetString(self._node, 'compress', 'none')
+self._uncompressed_size = None
 
 def ObtainContents(self):
 self._filename = self.GetDefaultFilename()
@@ -33,15 +43,36 @@ class Entry_blob(Entry):
 return True
 
 def ReadBlobContents(self):
-with open(self._pathname) as fd:
-# We assume the data is small enough to fit into memory. If this
-# is used for large filesystem image that might not be true.
-# In that case, Image.BuildImage() could be adjusted to use a
-# new Entry method which can read in chunks. Then we could copy
-# the data in chunks and avoid reading it all at once. For now
-# this seems like an unnecessary complication.
-self.SetContents(fd.read())
+# We assume the data is small enough to fit into memory. If this
+# is used for large filesystem image that might not be true.
+# In that case, Image.BuildImage() could be adjusted to use a
+# new Entry method which can read in chunks. Then we could copy
+# the data in chunks and avoid reading it all at once. For now
+# this seems like an unnecessary complication.
+data = tools.ReadFile(self._pathname)
+if self._compress == 'lz4':
+self._uncompressed_size = len(data)
+'''
+import lz4  # Import this only if needed (python-lz4 dependency)
+
+try:
+data = lz4.frame.compress(data)
+except AttributeError:
+

[U-Boot] [PATCH 07/31] binman: Support building a selection of images

2018-09-14 Thread Simon Glass
Sometimes it is useful to build only a subset of the images provided by
the binman configuration. Add a -i option for this. It can be given
multiple times to build several images. If the option is not given, all
images are built.

Signed-off-by: Simon Glass 
---

 tools/binman/cmdline.py |  2 ++
 tools/binman/control.py |  9 +
 tools/binman/ftest.py   | 19 ++-
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
index f0de4ded443..4ce8bc6ab43 100644
--- a/tools/binman/cmdline.py
+++ b/tools/binman/cmdline.py
@@ -30,6 +30,8 @@ def ParseArgs(argv):
 help='Enabling debugging (provides a full traceback on error)')
 parser.add_option('-E', '--entry-docs', action='store_true',
 help='Write out entry documentation (see README.entries)')
+parser.add_option('-i', '--image', type='string', action='append',
+help='Image filename to build (if not specified, build all)')
 parser.add_option('-I', '--indir', action='append',
 help='Add a path to a directory to use for input files')
 parser.add_option('-H', '--full-help', action='store_true',
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 2de1c86ecfe..8c48008fc75 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -162,6 +162,15 @@ def Binman(options, args):
 
 images = _ReadImageDesc(node)
 
+if options.image:
+skip = []
+for name, image in images.iteritems():
+if name not in options.image:
+del images[name]
+skip.append(name)
+if skip:
+print 'Skipping images: %s\n' % ', '.join(skip)
+
 # Prepare the device tree by making sure that any missing
 # properties are added (e.g. 'pos' and 'size'). The values of these
 # may not be correct yet, but we add placeholders so that the
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index c4065551e79..290e9aebf16 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -171,7 +171,7 @@ class TestFunctional(unittest.TestCase):
 return control.Binman(options, args)
 
 def _DoTestFile(self, fname, debug=False, map=False, update_dtb=False,
-entry_args=None):
+entry_args=None, images=None):
 """Run binman with a given test file
 
 Args:
@@ -180,6 +180,10 @@ class TestFunctional(unittest.TestCase):
 map: True to output map files for the images
 update_dtb: Update the offset and size of each entry in the device
 tree before packing it into the image
+entry_args: Dict of entry args to supply to binman
+key: arg name
+value: value of that arg
+images: List of image names to build
 """
 args = ['-p', '-I', self._indir, '-d', self.TestFile(fname)]
 if debug:
@@ -191,6 +195,9 @@ class TestFunctional(unittest.TestCase):
 if entry_args:
 for arg, value in entry_args.iteritems():
 args.append('-a%s=%s' % (arg, value))
+if images:
+for image in images:
+args += ['-i', image]
 return self._DoBinman(*args)
 
 def _SetupDtb(self, fname, outfile='u-boot.dtb'):
@@ -1384,6 +1391,16 @@ class TestFunctional(unittest.TestCase):
 data = self._DoReadFile('81_x86-start16-tpl.dts')
 self.assertEqual(X86_START16_TPL_DATA, 
data[:len(X86_START16_TPL_DATA)])
 
+def testSelectImage(self):
+"""Test that we can select which images to build"""
+with test_util.capture_sys_output() as (stdout, stderr):
+retcode = self._DoTestFile('06_dual_image.dts', images=['image2'])
+self.assertEqual(0, retcode)
+self.assertIn('Skipping images: image1', stdout.getvalue())
+
+self.assertFalse(os.path.exists(tools.GetOutputFilename('image1.bin')))
+self.assertTrue(os.path.exists(tools.GetOutputFilename('image2.bin')))
+
 
 if __name__ == "__main__":
 unittest.main()
-- 
2.19.0.397.gdd90340f6a-goog

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


Re: [U-Boot] [PATCH 2/4] ata: ahci: Don't cap AHCI port count under CONFIG_DM_SCSI

2018-09-14 Thread Tuomas Tynkkynen

Hi,

On 09/14/2018 01:55 PM, Simon Glass wrote:

On 13 September 2018 at 00:28, Tuomas Tynkkynen  wrote:

When using device model this sort of hardcoded limits aren't used or
necessary.

Signed-off-by: Tuomas Tynkkynen 
---
  drivers/ata/ahci.c | 2 ++
  1 file changed, 2 insertions(+)


Reviewed-by: Simon Glass 

But please see below


diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 333f0457f6..5fafb63aeb 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -230,8 +230,10 @@ static int ahci_host_init(struct ahci_uc_priv *uc_priv)
 debug("cap 0x%x  port_map 0x%x  n_ports %d\n",
   uc_priv->cap, uc_priv->port_map, uc_priv->n_ports);

+#if !defined(CONFIG_DM_SCSI)


Can you use this instead?

if (IS_DEFINED(CONFIG_DM_SCSI))




No, that won't work because after patch 3 CONFIG_SYS_SCSI_MAX_SCSI_ID
won't be defined for boards using CONFIG_DM_SCSI, so using the preprocessor
is necessary.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 02/31] binman: Move 'special properties' docs to README.entries

2018-09-14 Thread Simon Glass
This information should be in the entry it relates to, not in the main
README. Move it.

Signed-off-by: Simon Glass 
---

 tools/binman/README | 11 ---
 tools/binman/README.entries |  5 -
 tools/binman/etype/u_boot_with_ucode_ptr.py |  3 +++
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/tools/binman/README b/tools/binman/README
index cb34171e5fc..3dc8b9b80a8 100644
--- a/tools/binman/README
+++ b/tools/binman/README
@@ -462,17 +462,6 @@ see README.entries. This is generated from the source code 
using:
binman -E >tools/binman/README.entries
 
 
-Special properties
---
-
-Some entries support special properties, documented here:
-
-u-boot-with-ucode-ptr:
-   optional-ucode: boolean property to make microcode optional. If the
-   u-boot.bin image does not include microcode, no error will
-   be generated.
-
-
 Order of image creation
 ---
 
diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index c6e7b226090..041e1ed 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -524,6 +524,9 @@ Entry: u-boot-with-ucode-ptr: U-Boot with embedded 
microcode pointer
 
 Properties / Entry arguments:
 - filename: Filename of u-boot-nodtb.dtb (default 'u-boot-nodtb.dtb')
+- optional-ucode: boolean property to make microcode optional. If the
+u-boot.bin image does not include microcode, no error will
+be generated.
 
 See Entry_u_boot_ucode for full details of the three entries involved in
 this process. This entry updates U-Boot with the offset and size of the
@@ -543,7 +546,7 @@ Properties / Entry arguments:
 - kernelkey: Name of the kernel key to use (inside keydir)
 - preamble-flags: Value of the vboot preamble flags (typically 0)
 
-Chromium OS  signs the read-write firmware and kernel, writing the signature
+Chromium OS signs the read-write firmware and kernel, writing the signature
 in this block. This allows U-Boot to verify that the next firmware stage
 and kernel are genuine.
 
diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py 
b/tools/binman/etype/u_boot_with_ucode_ptr.py
index 51e7ba48f59..c850b59a1e1 100644
--- a/tools/binman/etype/u_boot_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_with_ucode_ptr.py
@@ -19,6 +19,9 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob):
 
 Properties / Entry arguments:
 - filename: Filename of u-boot-nodtb.dtb (default 'u-boot-nodtb.dtb')
+- optional-ucode: boolean property to make microcode optional. If the
+u-boot.bin image does not include microcode, no error will
+be generated.
 
 See Entry_u_boot_ucode for full details of the three entries involved in
 this process. This entry updates U-Boot with the offset and size of the
-- 
2.19.0.397.gdd90340f6a-goog

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


[U-Boot] [PATCH 29/31] binman: Correct fmap output on x86

2018-09-14 Thread Simon Glass
Normally x86 platforms use the end-at-4gb option. This currently produces
an FMAP with positions which have a large offset. The use of end-at-4gb is
a useful convenience within binman, but we don't really want to export
a map with these offsets.

Fix this by subtracting the 'skip at start' parameter.

Also put the code which convers names to fmap format, for clarity.

Signed-off-by: Simon Glass 
---

 tools/binman/bsection.py| 18 +++--
 tools/binman/entry.py   |  3 +-
 tools/binman/etype/fmap.py  | 11 +++--
 tools/binman/etype/u_boot_with_ucode_ptr.py | 12 +++---
 tools/binman/fmap_util.py   |  6 ++-
 tools/binman/ftest.py   | 45 +
 tools/binman/test/94_fmap_x86.dts   | 20 +
 tools/binman/test/95_fmap_x86_section.dts   | 22 ++
 8 files changed, 121 insertions(+), 16 deletions(-)
 create mode 100644 tools/binman/test/94_fmap_x86.dts
 create mode 100644 tools/binman/test/95_fmap_x86_section.dts

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index e4c1900b17f..c208029c25b 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -68,6 +68,7 @@ class Section(object):
 self._end_4gb = False
 self._name_prefix = ''
 self._entries = OrderedDict()
+self._image_pos = None
 if not test:
 self._ReadNode()
 self._ReadEntries()
@@ -124,7 +125,10 @@ class Section(object):
 def SetCalculatedProperties(self):
 state.SetInt(self._node, 'offset', self._offset)
 state.SetInt(self._node, 'size', self._size)
-state.SetInt(self._node, 'image-pos', self._image_pos)
+image_pos = self._image_pos
+if self._parent_section:
+image_pos -= self._parent_section.GetRootSkipAtStart()
+state.SetInt(self._node, 'image-pos', image_pos)
 for entry in self._entries.values():
 entry.SetCalculatedProperties()
 
@@ -437,11 +441,17 @@ class Section(object):
 source_entry.Raise("Cannot find node for phandle %d" % phandle)
 for entry in self._entries.values():
 if entry._node == node:
-if entry.data is None:
-return None
-return entry.data
+return entry.GetData()
 source_entry.Raise("Cannot find entry for node '%s'" % node.name)
 
 def ExpandSize(self, size):
 if size != self._size:
 self._size = size
+
+def GetRootSkipAtStart(self):
+if self._parent_section:
+return self._parent_section.GetRootSkipAtStart()
+return self._skip_at_start
+
+def GetImageSize(self):
+return self._image._size
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index fd7223477eb..01be291b709 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -197,7 +197,8 @@ class Entry(object):
 """Set the value of device-tree properties calculated by binman"""
 state.SetInt(self._node, 'offset', self.offset)
 state.SetInt(self._node, 'size', self.size)
-state.SetInt(self._node, 'image-pos', self.image_pos)
+state.SetInt(self._node, 'image-pos',
+   self.image_pos - self.section.GetRootSkipAtStart())
 state.CheckSetHashValue(self._node, self.GetData)
 
 def ProcessFdt(self, fdt):
diff --git a/tools/binman/etype/fmap.py b/tools/binman/etype/fmap.py
index f1dd81ec493..bf35a5bbf4e 100644
--- a/tools/binman/etype/fmap.py
+++ b/tools/binman/etype/fmap.py
@@ -42,14 +42,17 @@ class Entry_fmap(Entry):
 for subentry in entries.values():
 _AddEntries(areas, subentry)
 else:
-areas.append(fmap_util.FmapArea(entry.image_pos or 0,
-entry.size or 0, entry.name, 
0))
+pos = entry.image_pos
+if pos is not None:
+pos -= entry.section.GetRootSkipAtStart()
+areas.append(fmap_util.FmapArea(pos or 0, entry.size or 0,
+entry.name, 0))
 
-entries = self.section.GetEntries()
+entries = self.section._image.GetEntries()
 areas = []
 for entry in entries.values():
 _AddEntries(areas, entry)
-return fmap_util.EncodeFmap(self.section.GetSize() or 0, self.name,
+return fmap_util.EncodeFmap(self.section.GetImageSize() or 0, 
self.name,
 areas)
 
 def ObtainContents(self):
diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py 
b/tools/binman/etype/u_boot_with_ucode_ptr.py
index 01f3513e7d3..da0e12417b5 100644
--- a/tools/binman/etype/u_boot_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_with_ucode_ptr.py
@@ -66,11 +66,11 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob):
 # the U-Boot region must start at

[U-Boot] [PATCH 04/31] binman: Generate an error when text is not provided

2018-09-14 Thread Simon Glass
When the value of a text entry is not provided an execption is generated
talking about a None type. This is confusing. Add a more explanatory error
and a test for this case.

Signed-off-by: Simon Glass 
---

 tools/binman/etype/text.py | 3 +++
 tools/binman/ftest.py  | 7 +++
 2 files changed, 10 insertions(+)

diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py
index 7a1cddf4af8..6e99819487f 100644
--- a/tools/binman/etype/text.py
+++ b/tools/binman/etype/text.py
@@ -51,6 +51,9 @@ class Entry_text(Entry):
 self.text_label, = self.GetEntryArgsOrProps(
 [EntryArg('text-label', str)])
 self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, 
str)])
+if not self.value:
+self.Raise("No value provided for text label '%s'" %
+   self.text_label)
 
 def ObtainContents(self):
 self.SetContents(self.value)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 7f82264f8ad..d956bd42e1b 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -1369,6 +1369,13 @@ class TestFunctional(unittest.TestCase):
 data = self._DoReadFile('80_fill_empty.dts')
 self.assertEqual(chr(0) * 16, data)
 
+def testTextMissing(self):
+"""Test for a text entry type where there is no text"""
+with self.assertRaises(ValueError) as e:
+self._DoReadFileDtb('66_text.dts',)
+self.assertIn("Node '/binman/text': No value provided for text label "
+  "'test-id'", str(e.exception))
+
 
 if __name__ == "__main__":
 unittest.main()
-- 
2.19.0.397.gdd90340f6a-goog

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


Re: [U-Boot] [PATCH v2 1/2] rockchip: add support for veyron-speedy (ASUS Chromebook C201)

2018-09-14 Thread Simon Glass
On 13 September 2018 at 23:55, Marty E. Plummer  wrote:
> This adds support for the ASUS C201, a RK3288-based clamshell
> device. The device tree comes from linus's linux tree at
> 3f16503b7d2274ac8cbab11163047ac0b4c66cfe. The SDRAM parameters
> are for 4GB Samsung LPDDR3, decoded from coreboot's
> src/mainboard/google/veyron/sdram_inf/sdram-lpddr3-samsung-4GB.inc
>
> Signed-off-by: Marty E. Plummer 
> ---
>  arch/arm/dts/Makefile |   1 +
>  arch/arm/dts/rk3288-veyron-speedy-u-boot.dtsi |  31 
>  arch/arm/dts/rk3288-veyron-speedy.dts | 143 ++
>  arch/arm/mach-rockchip/rk3288-board-spl.c |   3 +-
>  arch/arm/mach-rockchip/rk3288/Kconfig |  11 ++
>  board/google/veyron/Kconfig   |  16 ++
>  configs/chromebook_speedy_defconfig   |  98 
>  7 files changed, 302 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/rk3288-veyron-speedy-u-boot.dtsi
>  create mode 100644 arch/arm/dts/rk3288-veyron-speedy.dts
>  create mode 100644 configs/chromebook_speedy_defconfig

Reviewed-by: Simon Glass 

But aren't you missing a changelog?

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


[U-Boot] [PATCH 27/31] binman: Support x86 microcode in TPL

2018-09-14 Thread Simon Glass
When TPL is used on x86 we may want to program the microcode (at least for
the first CPU) early in boot. Add support for this by refactoring the
existing code to be more generic.

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries   | 20 +
 tools/binman/etype/u_boot_dtb_with_ucode.py   | 15 ++
 .../binman/etype/u_boot_spl_with_ucode_ptr.py |  2 ++
 .../binman/etype/u_boot_tpl_dtb_with_ucode.py | 25 
 .../binman/etype/u_boot_tpl_with_ucode_ptr.py | 27 +
 tools/binman/etype/u_boot_ucode.py| 26 +
 tools/binman/etype/u_boot_with_ucode_ptr.py   |  9 --
 tools/binman/ftest.py | 19 
 tools/binman/test/93_x86_tpl_ucode.dts| 29 +++
 9 files changed, 151 insertions(+), 21 deletions(-)
 create mode 100644 tools/binman/etype/u_boot_tpl_dtb_with_ucode.py
 create mode 100644 tools/binman/etype/u_boot_tpl_with_ucode_ptr.py
 create mode 100644 tools/binman/test/93_x86_tpl_ucode.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 3afc560052a..4dd67d64fa7 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -462,6 +462,8 @@ both SPL and the device tree).
 Entry: u-boot-spl-with-ucode-ptr: U-Boot SPL with embedded microcode pointer
 
 
+This is used when SPL must set up the microcode for U-Boot.
+
 See Entry_u_boot_ucode for full details of the entries involved in this
 process.
 
@@ -503,6 +505,24 @@ to activate.
 
 
 
+Entry: u-boot-tpl-dtb-with-ucode: U-Boot TPL with embedded microcode pointer
+
+
+This is used when TPL must set up the microcode for U-Boot.
+
+See Entry_u_boot_ucode for full details of the entries involved in this
+process.
+
+
+
+Entry: u-boot-tpl-with-ucode-ptr: U-Boot TPL with embedded microcode pointer
+
+
+See Entry_u_boot_ucode for full details of the entries involved in this
+process.
+
+
+
 Entry: u-boot-ucode: U-Boot microcode block
 ---
 
diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py 
b/tools/binman/etype/u_boot_dtb_with_ucode.py
index 73f5fbf9033..444c51b8b72 100644
--- a/tools/binman/etype/u_boot_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_dtb_with_ucode.py
@@ -43,6 +43,9 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
 # If the section does not need microcode, there is nothing to do
 ucode_dest_entry = self.section.FindEntryType(
 'u-boot-spl-with-ucode-ptr')
+if not ucode_dest_entry or not ucode_dest_entry.target_offset:
+ucode_dest_entry = self.section.FindEntryType(
+'u-boot-tpl-with-ucode-ptr')
 if not ucode_dest_entry or not ucode_dest_entry.target_offset:
 ucode_dest_entry = self.section.FindEntryType(
 'u-boot-with-ucode-ptr')
@@ -70,14 +73,14 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
 def ObtainContents(self):
 # Call the base class just in case it does something important.
 Entry_blob_dtb.ObtainContents(self)
-self._pathname = state.GetFdtPath(self._filename)
-self.ReadBlobContents()
-if self.ucode:
+if self.ucode and not self.collate:
 for node in self.ucode.subnodes:
 data_prop = node.props.get('data')
-if data_prop and not self.collate:
+if data_prop:
 # Find the offset in the device tree of the ucode data
 self.ucode_offset = data_prop.GetOffset() + 12
 self.ucode_size = len(data_prop.bytes)
-self.ready = True
-return True
+self.ready = True
+else:
+self.ready = True
+return self.ready
diff --git a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py 
b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py
index 0dfe268a568..b650cf0146c 100644
--- a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py
@@ -16,6 +16,8 @@ import tools
 class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
 """U-Boot SPL with embedded microcode pointer
 
+This is used when SPL must set up the microcode for U-Boot.
+
 See Entry_u_boot_ucode for full details of the entries involved in this
 process.
 """
diff --git a/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py 
b/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py
new file mode 100644
index 000..71e04fcd44f
--- /dev/null
+++ b/tools/binman/etype/u_boot_tpl_dtb_with_ucode.py
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2016 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for U-Boot devi

[U-Boot] [PATCH 25/31] binman: Mention section attributes in docs

2018-09-14 Thread Simon Glass
Images and sections have the same attributes, since an image is mostly
just a top-level section. Update the docs to explain this.

Signed-off-by: Simon Glass 
---

 tools/binman/README | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/binman/README b/tools/binman/README
index cd1ad2fb0fe..7e566ffe05b 100644
--- a/tools/binman/README
+++ b/tools/binman/README
@@ -335,8 +335,8 @@ expand-size:
limited by the size of the image/section and the position of the next
entry.
 
-The attributes supported for images are described below. Several are similar
-to those for entries.
+The attributes supported for images and sections are described below. Several
+are similar to those for entries.
 
 size:
Sets the image size in bytes, for example 'size = <0x10>' for a
-- 
2.19.0.397.gdd90340f6a-goog

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


[U-Boot] [PATCH 18/31] binman: Allow control of whether a fake DT is used

2018-09-14 Thread Simon Glass
We use a fake device tree in tests most of the time since tests don't
normally care about the actual data. For example, for U-Boot proper we use
U_BOOT_DTB_DATA which is just a four-character string. This makes testing
the image output against an expected value very easy.

However in some cases, such as when the test wants to check that the DT
output containing particular nodes, we do actually need the real DT. Add
support for this, along with a command-line option to select 'test mode'.

Signed-off-by: Simon Glass 
---

 tools/binman/cmdline.py | 2 ++
 tools/binman/control.py | 1 +
 tools/binman/ftest.py   | 4 +++-
 tools/binman/state.py   | 2 +-
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/binman/cmdline.py b/tools/binman/cmdline.py
index 4ce8bc6ab43..f8caa7d2841 100644
--- a/tools/binman/cmdline.py
+++ b/tools/binman/cmdline.py
@@ -30,6 +30,8 @@ def ParseArgs(argv):
 help='Enabling debugging (provides a full traceback on error)')
 parser.add_option('-E', '--entry-docs', action='store_true',
 help='Write out entry documentation (see README.entries)')
+parser.add_option('--fake-dtb', action='store_true',
+help='Use fake device tree contents (for testing only)')
 parser.add_option('-i', '--image', type='string', action='append',
 help='Image filename to build (if not specified, build all)')
 parser.add_option('-I', '--indir', action='append',
diff --git a/tools/binman/control.py b/tools/binman/control.py
index 49d49a001c7..34ec74ba1b3 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -106,6 +106,7 @@ def Binman(options, args):
 
 tout.Init(options.verbosity)
 elf.debug = options.debug
+state.use_fake_dtb = options.fake_dtb
 try:
 tools.SetInputDirs(options.indir)
 tools.PrepareOutputDir(options.outdir, options.preserve)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 867179702d9..75e9a2143ca 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -172,7 +172,7 @@ class TestFunctional(unittest.TestCase):
 return control.Binman(options, args)
 
 def _DoTestFile(self, fname, debug=False, map=False, update_dtb=False,
-entry_args=None, images=None):
+entry_args=None, images=None, use_real_dtb=False):
 """Run binman with a given test file
 
 Args:
@@ -193,6 +193,8 @@ class TestFunctional(unittest.TestCase):
 args.append('-m')
 if update_dtb:
 args.append('-up')
+if not use_real_dtb:
+args.append('--fake-dtb')
 if entry_args:
 for arg, value in entry_args.iteritems():
 args.append('-a%s=%s' % (arg, value))
diff --git a/tools/binman/state.py b/tools/binman/state.py
index 600eb86cfe2..b27eb077a61 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -20,7 +20,7 @@ entry_args = {}
 
 # True to use fake device-tree files for testing (see U_BOOT_DTB_DATA in
 # ftest.py)
-use_fake_dtb = True
+use_fake_dtb = False
 
 # Set of all device tree files references by images
 fdt_set = Set()
-- 
2.19.0.397.gdd90340f6a-goog

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


[U-Boot] [PATCH 14/31] binman: Move state information into a new module

2018-09-14 Thread Simon Glass
At present the control module has state information in it, since it is the
primary user of this. But it is a bit odd to have entries and other
modules importing control to obtain this information.

It seems better to have a dedicated state module, which control can use as
well. Create a new module using code from control and update other modules
to use it.

Signed-off-by: Simon Glass 
---

 tools/binman/control.py | 50 +++--
 tools/binman/entry.py   |  7 +-
 tools/binman/etype/u_boot_dtb_with_ucode.py |  6 +-
 tools/binman/ftest.py   |  3 +-
 tools/binman/state.py   | 77 +
 5 files changed, 95 insertions(+), 48 deletions(-)
 create mode 100644 tools/binman/state.py

diff --git a/tools/binman/control.py b/tools/binman/control.py
index ded1b71109b..00dcb8ad6a5 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -7,27 +7,19 @@
 
 from collections import OrderedDict
 import os
-import re
 import sys
 import tools
 
 import command
 import elf
 from image import Image
+import state
 import tout
 
 # List of images we plan to create
 # Make this global so that it can be referenced from tests
 images = OrderedDict()
 
-# Records the device-tree files known to binman, keyed by filename (e.g.
-# 'u-boot-spl.dtb')
-fdt_files = {}
-
-# Arguments passed to binman to provide arguments to entries
-entry_args = {}
-
-
 def _ReadImageDesc(binman_node):
 """Read the image descriptions from the /binman node
 
@@ -60,39 +52,15 @@ def _FindBinmanNode(dtb):
 return node
 return None
 
-def GetFdt(fname):
-"""Get the Fdt object for a particular device-tree filename
-
-Binman keeps track of at least one device-tree file called u-boot.dtb but
-can also have others (e.g. for SPL). This function looks up the given
-filename and returns the associated Fdt object.
+def WriteEntryDocs(modules, test_missing=None):
+"""Write out documentation for all entries
 
 Args:
-fname: Filename to look up (e.g. 'u-boot.dtb').
-
-Returns:
-Fdt object associated with the filename
+modules: List of Module objects to get docs for
+test_missing: Used for testing only, to force an entry's documeentation
+to show as missing even if it is present. Should be set to None in
+normal use.
 """
-return fdt_files[fname]
-
-def GetFdtPath(fname):
-return fdt_files[fname]._fname
-
-def SetEntryArgs(args):
-global entry_args
-
-entry_args = {}
-if args:
-for arg in args:
-m = re.match('([^=]*)=(.*)', arg)
-if not m:
-raise ValueError("Invalid entry arguemnt '%s'" % arg)
-entry_args[m.group(1)] = m.group(2)
-
-def GetEntryArg(name):
-return entry_args.get(name)
-
-def WriteEntryDocs(modules, test_missing=None):
 from entry import Entry
 Entry.WriteDocs(modules, test_missing)
 
@@ -141,7 +109,7 @@ def Binman(options, args):
 try:
 tools.SetInputDirs(options.indir)
 tools.PrepareOutputDir(options.outdir, options.preserve)
-SetEntryArgs(options.entry_arg)
+state.SetEntryArgs(options.entry_arg)
 
 # Get the device tree ready by compiling it and copying the 
compiled
 # output into a file in our output directly. Then scan it for use
@@ -154,7 +122,7 @@ def Binman(options, args):
 dtb = fdt.FdtScan(fname)
 
 # Note the file so that GetFdt() can find it
-fdt_files['u-boot.dtb'] = dtb
+state.fdt_files['u-boot.dtb'] = dtb
 node = _FindBinmanNode(dtb)
 if not node:
 raise ValueError("Device tree '%s' does not have a 'binman' "
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index ec3b22e9b31..1d6299aefa5 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -17,10 +17,11 @@ try:
 except:
 have_importlib = False
 
-import fdt_util
-import control
 import os
 import sys
+
+import fdt_util
+import state
 import tools
 
 modules = {}
@@ -393,7 +394,7 @@ class Entry(object):
 Raises:
 ValueError if the argument cannot be converted to in
 """
-value = control.GetEntryArg(name)
+value = state.GetEntryArg(name)
 if value is not None:
 if datatype == int:
 try:
diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py 
b/tools/binman/etype/u_boot_dtb_with_ucode.py
index 285a28dd1e7..3fab766011e 100644
--- a/tools/binman/etype/u_boot_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_dtb_with_ucode.py
@@ -5,9 +5,9 @@
 # Entry-type module for U-Boot device tree with the microcode removed
 #
 
-import control
 from entry import Entry
 from blob import Entry_blob
+import state
 import tools
 
 class Entry_u_boot_dtb_with_ucode(Entry_blob):
@@ -51,7 +51,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blo

Re: [U-Boot] [PATCH 1/9] dm: allow 4GB of DRAM on 32bit systems

2018-09-14 Thread Philipp Tomsich




> On 14.09.2018, at 12:53, Simon Glass  wrote:
> 
> Hi,
> 
> On 3 September 2018 at 16:29, Lokesh Vutla  wrote:
>> 
>> 
>> On Sunday 02 September 2018 11:19 PM, Alexander Graf wrote:
>>> 
>>> 
 Am 02.09.2018 um 18:04 schrieb Vagrant Cascadian :
 
> On 2018-09-02, Alexander Graf  wrote:
>> On 02.08.18 23:31, Dr. Philipp Tomsich wrote:
>> 
>>> On 2 Aug 2018, at 22:36, Simon Glass  wrote:
>>> 
>>> On 26 July 2018 at 07:59, Philipp Tomsich
>>> >> > wrote:
 Even on 32bit systems a full 4GB of DRAM may be installed and reported
 by the DRAM controller.  Whether these 4GB are larger available
 depends on the size/configuration of address decoding windows and
 architectural features (e.g. consider a hypothetical architecture that
 uses dedicated instructions to access the 'memory-mapped' peripheral
 IO ranges).  In U-Boot, the available DRAM, as reported by the
 device-model is independent of the accessible DRAM (i.e. adjusted top
 and effective size).
 
 This was first reported against the RK3288, which may have 4GB DRAM
 attached, but will have a small (e.g. 128MB) window not accessible due
 to address decoding limitations.
 
 The solution is to increase the types used for storing the ram_size to
 have at least 33 bits even on 32bit systems... i.e. we need to use a
 u64 for these always (this was previously only the case for
 PHYS_64BIT, which will have unwanted side-effects for 32bit systems
 and would require more intrusive changes).
 
 This commit changes the size-field in 'struct ram' and the ram_size in
 'gd' to be a u64.
 
 Reported-by: Marty E. Plummer 
 Signed-off-by: Philipp Tomsich 
 ---
 
 include/asm-generic/global_data.h | 2 +-
 include/ram.h | 9 -
 2 files changed, 9 insertions(+), 2 deletions(-)
 
>>> 
>>> Reviewed-by: Simon Glass mailto:s...@chromium.org>>
>>> 
 diff --git a/include/asm-generic/global_data.h 
 b/include/asm-generic/global_data.h
 index 0fd4900..f3d687c 100644
 --- a/include/asm-generic/global_data.h
 +++ b/include/asm-generic/global_data.h
 @@ -55,7 +55,7 @@ typedef struct global_data {
  unsigned long ram_base; /* Base address of RAM used by 
 U-Boot */
  unsigned long ram_top;  /* Top address of RAM used by 
 U-Boot */
  unsigned long relocaddr;/* Start address of U-Boot in RAM 
 */
 -   phys_size_t ram_size;   /* RAM size */
 +   u64 ram_size;   /* RAM size */
  unsigned long mon_len;  /* monitor len */
  unsigned long irq_sp;   /* irq stack pointer */
  unsigned long start_addr_sp;/* start_addr_stackpointer */
 diff --git a/include/ram.h b/include/ram.h
 index 67e22d7..1fe024f 100644
 --- a/include/ram.h
 +++ b/include/ram.h
 @@ -9,7 +9,14 @@
 
 struct ram_info {
  phys_addr_t base;
 -   size_t size;
 +   /*
 +* We use a 64bit type for the size to correctly handle 32bit
 +* systems with 4GB of DRAM (which would overflow a 32bit type
 +* and read back as 0).  For 64bit systems, we assume (for now)
>>> 
>>> forever :-)
>>> 
 +* that they will always have less than 2^65 byte of DRAM
 +* installed. -- prt
>>> 
>>> Is the prt your signature? I suggest dropping it.
>> 
>> In fact it is. But I’ll need to rewrite the entire comment anyway for 
>> the next
>> version of this series as there’s even more functions and places that the
>> memory size is stored in...
>> 
>>> 
 +*/
 +   u64 size;
> 
> With LPAE available in all modern ARM cores, shouldn't phys_addr_t just
> be u64? And then we'd probably want to use that throughout the code, 
> right?
 
 Quite a few currently supported boards do not support LPAE, e.g. imx6.
>>> 
>>> What I'm trying to say is that we probably want to make phys_addr_t be u64 
>>> when CONFIG_LPAE is set.
>> 
>> That's right. Enabling PHYS_64BIT should be sufficient. Based on this
>> phys_addr_t should be set to u32 or u64. arm already does that[1].
>> 
>> [1]
>> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/include/asm/types.h;h=9af7353f0866f05dbe298a603d52d90e9c8e6d28;hb=HEAD
>> 
> 
> Yes I agree. So will this patch be changed?

This patch-set needs to be revised for other reasons… 
However, PHYS_64BIT is not a valid option for some of the affected chips (e.g. 
if 
the address space is indeed

[U-Boot] [PATCH 17/31] binman: Obtain the list of device trees from the config

2018-09-14 Thread Simon Glass
We always have a device tree for U-Boot proper. But we may also have one
for SPL and TPL. Add a new Entry method to find out what DTs an entry
has, and use that list when updating DTs.

Signed-off-by: Simon Glass 
---

 tools/binman/bsection.py |  8 
 tools/binman/control.py  |  2 +-
 tools/binman/entry.py| 15 +++
 tools/binman/image.py|  4 
 tools/binman/state.py| 20 ++--
 5 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 4f5c33f048b..44adb82795b 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -8,6 +8,7 @@
 from __future__ import print_function
 
 from collections import OrderedDict
+from sets import Set
 import sys
 
 import fdt_util
@@ -92,6 +93,13 @@ class Section(object):
 entry.SetPrefix(self._name_prefix)
 self._entries[node.name] = entry
 
+def GetFdtSet(self):
+"""Get the set of device tree files used by this image"""
+fdt_set = Set()
+for entry in self._entries.values():
+fdt_set.update(entry.GetFdtSet())
+return fdt_set
+
 def SetOffset(self, offset):
 self._offset = offset
 
diff --git a/tools/binman/control.py b/tools/binman/control.py
index fd8b779945d..49d49a001c7 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -137,7 +137,7 @@ def Binman(options, args):
 if skip:
 print 'Skipping images: %s\n' % ', '.join(skip)
 
-state.Prepare(dtb)
+state.Prepare(images, dtb)
 
 # Prepare the device tree by making sure that any missing
 # properties are added (e.g. 'pos' and 'size'). The values of these
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 4b87156ff80..e5f557749f6 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -18,6 +18,7 @@ except:
 have_importlib = False
 
 import os
+from sets import Set
 import sys
 
 import fdt_util
@@ -164,6 +165,20 @@ class Entry(object):
 def GetDefaultFilename(self):
 return None
 
+def GetFdtSet(self):
+"""Get the set of device trees used by this entry
+
+Returns:
+Set containing the filename from this entry, if it is a .dtb, else
+an empty set
+"""
+fname = self.GetDefaultFilename()
+# It would be better to use isinstance(self, Entry_blob_dtb) here but
+# we cannot access Entry_blob_dtb
+if fname and fname.endswith('.dtb'):
+return Set([fname])
+return Set()
+
 def AddMissingProperties(self):
 """Add new properties to the device tree as needed for this entry"""
 for prop in ['offset', 'size', 'image-pos']:
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 68126bc3e69..1fb5eb65db3 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -54,6 +54,10 @@ class Image:
 self._filename = filename
 self._section = bsection.Section('main-section', self._node)
 
+def GetFdtSet(self):
+"""Get the set of device tree files used by this image"""
+return self._section.GetFdtSet()
+
 def AddMissingProperties(self):
 """Add properties that are not present in the device tree
 
diff --git a/tools/binman/state.py b/tools/binman/state.py
index 5f25b907b9e..600eb86cfe2 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -18,6 +18,10 @@ fdt_files = {}
 # Arguments passed to binman to provide arguments to entries
 entry_args = {}
 
+# True to use fake device-tree files for testing (see U_BOOT_DTB_DATA in
+# ftest.py)
+use_fake_dtb = True
+
 # Set of all device tree files references by images
 fdt_set = Set()
 
@@ -85,13 +89,14 @@ def GetEntryArg(name):
 """
 return entry_args.get(name)
 
-def Prepare(dtb):
+def Prepare(images, dtb):
 """Get device tree files ready for use
 
 This sets up a set of device tree files that can be retrieved by GetFdts().
 At present there is only one, that for U-Boot proper.
 
 Args:
+images: List of images being used
 dtb: Main dtb
 """
 global fdt_set, fdt_subset, fdt_files, main_dtb
@@ -107,8 +112,19 @@ def Prepare(dtb):
 main_dtb = dtb
 fdt_files.clear()
 fdt_files['u-boot.dtb'] = dtb
-fdt_set = Set()
 fdt_subset = Set()
+if not use_fake_dtb:
+for image in images.values():
+fdt_subset.update(image.GetFdtSet())
+fdt_subset.discard('u-boot.dtb')
+for other_fname in fdt_subset:
+infile = tools.GetInputFilename(other_fname)
+other_fname_dtb = fdt_util.EnsureCompiled(infile)
+out_fname = tools.GetOutputFilename('%s.out' %
+os.path.split(other_fname)[1])
+tools.WriteFile(out_fname, tools.ReadFile(other_fname_dtb))
+other_dtb = fdt.FdtScan(out_fname)
+fdt_files[other_fname] = 

[U-Boot] [PATCH 26/31] binman: Support hashing entries

2018-09-14 Thread Simon Glass
Sometimesi it us useful to be able to verify the content of entries with
a hash. Add an easy way to do this in binman. The hash information can be
retrieved from the device tree at run time.

Signed-off-by: Simon Glass 
---

 tools/binman/README| 22 
 tools/binman/bsection.py   |  3 +++
 tools/binman/entry.py  |  4 +++
 tools/binman/ftest.py  | 36 ++
 tools/binman/state.py  | 25 ++
 tools/binman/test/90_hash.dts  | 12 +
 tools/binman/test/91_hash_no_algo.dts  | 11 
 tools/binman/test/92_hash_bad_algo.dts | 12 +
 tools/binman/test/99_hash_section.dts  | 18 +
 9 files changed, 143 insertions(+)
 create mode 100644 tools/binman/test/90_hash.dts
 create mode 100644 tools/binman/test/91_hash_no_algo.dts
 create mode 100644 tools/binman/test/92_hash_bad_algo.dts
 create mode 100644 tools/binman/test/99_hash_section.dts

diff --git a/tools/binman/README b/tools/binman/README
index 7e566ffe05b..6bdb7e4c66e 100644
--- a/tools/binman/README
+++ b/tools/binman/README
@@ -466,6 +466,28 @@ see README.entries. This is generated from the source code 
using:
binman -E >tools/binman/README.entries
 
 
+Hashing Entries
+---
+
+It is possible to ask binman to hash the contents of an entry and write that
+value back to the device-tree node. For example:
+
+   binman {
+   u-boot {
+   hash {
+   algo = "sha256";
+   };
+   };
+   };
+
+Here, a new 'value' property will be written to the 'hash' node containing
+the hash of the 'u-boot' entry. Only SHA256 is supported at present. Whole
+sections can be hased if desired, by adding the 'hash' node to the section.
+
+The has value can be chcked at runtime by hashing the data actually read and
+comparing this has to the value in the device tree.
+
+
 Order of image creation
 ---
 
diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 52ac31a4672..650e9ba353f 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -89,6 +89,8 @@ class Section(object):
 
 def _ReadEntries(self):
 for node in self._node.subnodes:
+if node.name == 'hash':
+continue
 entry = Entry.Create(self, node)
 entry.SetPrefix(self._name_prefix)
 self._entries[node.name] = entry
@@ -112,6 +114,7 @@ class Section(object):
 for prop in ['offset', 'size', 'image-pos']:
 if not prop in self._node.props:
 state.AddZeroProp(self._node, prop)
+state.CheckAddHashProp(self._node)
 for entry in self._entries.values():
 entry.AddMissingProperties()
 
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 0915b470b4e..fd7223477eb 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -189,12 +189,16 @@ class Entry(object):
 for prop in ['offset', 'size', 'image-pos']:
 if not prop in self._node.props:
 state.AddZeroProp(self._node, prop)
+err = state.CheckAddHashProp(self._node)
+if err:
+self.Raise(err)
 
 def SetCalculatedProperties(self):
 """Set the value of device-tree properties calculated by binman"""
 state.SetInt(self._node, 'offset', self.offset)
 state.SetInt(self._node, 'size', self.size)
 state.SetInt(self._node, 'image-pos', self.image_pos)
+state.CheckSetHashValue(self._node, self.GetData)
 
 def ProcessFdt(self, fdt):
 """Allow entries to adjust the device tree
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index faacb6fa8f6..6c86f4a742c 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -6,6 +6,7 @@
 #
 #python -m unittest func_test.TestFunctional.testHelp
 
+import hashlib
 import lz4
 from optparse import OptionParser
 import os
@@ -1609,6 +1610,41 @@ class TestFunctional(unittest.TestCase):
 self.assertIn("Node '/binman/_testing': Cannot obtain contents when "
   'expanding entry', str(e.exception))
 
+def testHash(self):
+"""Test hashing of the contents of an entry"""
+_, _, _, out_dtb_fname = self._DoReadFileDtb('90_hash.dts',
+use_real_dtb=True, update_dtb=True)
+dtb = fdt.Fdt(out_dtb_fname)
+dtb.Scan()
+hash_node = dtb.GetNode('/binman/u-boot/hash').props['value']
+m = hashlib.sha256()
+m.update(U_BOOT_DATA)
+self.assertEqual(m.digest(), ''.join(hash_node.value))
+
+def testHashNoAlgo(self):
+with self.assertRaises(ValueError) as e:
+self._DoReadFileDtb('91_hash_no_algo.dts', update_dtb=True)
+self.assertIn("Node \'/binman/u-boot\': Missing \'algo\' property for "
+  'hash node', str(e.exc

[U-Boot] [PATCH 10/31] dtoc: Support adding new nodes

2018-09-14 Thread Simon Glass
Add a way to add new nodes and sync them back to the blob.

Signed-off-by: Simon Glass 
---

 tools/dtoc/fdt.py  | 20 
 tools/dtoc/test_fdt.py |  8 
 2 files changed, 28 insertions(+)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index ccf3b23ced4..26f4a4ee562 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -337,6 +337,12 @@ class Node:
 """
 self.props[prop_name].SetInt(val)
 
+def AddSubnode(self, name):
+path = self.path + '/' + name
+subnode = Node(self._fdt, self, None, name, path)
+self.subnodes.append(subnode)
+return subnode
+
 def Sync(self, auto_resize=False):
 """Sync node changes back to the device tree
 
@@ -350,6 +356,20 @@ class Node:
 Raises:
 FdtException if auto_resize is False and there is not enough space
 """
+if self._offset is None:
+# The subnode doesn't exist yet, so add it
+fdt_obj = self._fdt._fdt_obj
+if auto_resize:
+while True:
+offset = fdt_obj.add_subnode(self.parent._offset, 
self.name,
+(libfdt.NOSPACE,))
+if offset != -libfdt.NOSPACE:
+break
+fdt_obj.resize(fdt_obj.totalsize() + 1024)
+else:
+offset = fdt_obj.add_subnode(self.parent._offset, self.name)
+self._offset = offset
+
 # Sync subnodes in reverse so that we don't disturb node offsets for
 # nodes that are earlier in the DT. This avoids an O(n^2) rescan of
 # node offsets.
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py
index 4a67f8949df..c94e455d121 100755
--- a/tools/dtoc/test_fdt.py
+++ b/tools/dtoc/test_fdt.py
@@ -355,6 +355,14 @@ class TestProp(unittest.TestCase):
 
 def testAddNode(self):
 self.fdt.pack()
+self.node.AddSubnode('subnode')
+with self.assertRaises(libfdt.FdtException) as e:
+self.dtb.Sync(auto_resize=False)
+self.assertIn('FDT_ERR_NOSPACE', str(e.exception))
+
+self.dtb.Sync(auto_resize=True)
+offset = self.fdt.path_offset('/spl-test/subnode')
+self.assertTrue(offset > 0)
 
 
 class TestFdtUtil(unittest.TestCase):
-- 
2.19.0.397.gdd90340f6a-goog

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


[U-Boot] [PATCH 23/31] binman: Support adding files

2018-09-14 Thread Simon Glass
In some cases it is useful to add a group of files to the image and be
able to access them at run-time. Of course it is possible to generate
the binman config file with a set of blobs each with a filename. But for
convenience, add an entry type which can do this.

Add required support (for adding nodes and string properties) into the
state module.

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries   | 15 +
 tools/binman/bsection.py  |  4 ++
 tools/binman/control.py   |  1 +
 tools/binman/entry.py |  3 +
 tools/binman/etype/files.py   | 57 +++
 tools/binman/ftest.py | 43 ++
 tools/binman/image.py |  9 +++
 tools/binman/state.py | 27 +
 tools/binman/test/84_files.dts| 11 
 tools/binman/test/85_files_compress.dts   | 11 
 tools/binman/test/86_files_none.dts   | 12 
 tools/binman/test/87_files_no_pattern.dts | 11 
 tools/binman/test/files/1.dat |  1 +
 tools/binman/test/files/2.dat |  1 +
 .../binman/test/files/ignored_dir.dat/ignore  |  0
 tools/binman/test/files/not-this-one  |  1 +
 tools/patman/tools.py | 18 ++
 17 files changed, 225 insertions(+)
 create mode 100644 tools/binman/etype/files.py
 create mode 100644 tools/binman/test/84_files.dts
 create mode 100644 tools/binman/test/85_files_compress.dts
 create mode 100644 tools/binman/test/86_files_none.dts
 create mode 100644 tools/binman/test/87_files_no_pattern.dts
 create mode 100644 tools/binman/test/files/1.dat
 create mode 100644 tools/binman/test/files/2.dat
 create mode 100644 tools/binman/test/files/ignored_dir.dat/ignore
 create mode 100644 tools/binman/test/files/not-this-one

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 2cf7dc0338d..3afc560052a 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -71,6 +71,21 @@ updating the EC on startup via software sync.
 
 
 
+Entry: files: Entry containing a set of files
+-
+
+Properties / Entry arguments:
+- pattern: Filename pattern to match the files to include
+- compress: Compression algorithm to use:
+none: No compression
+lz4: Use lz4 compression (via 'lz4' command-line utility)
+
+This entry reads a number of files and places each in a separate sub-entry
+within this entry. To access these you need to enable device-tree updates
+at run-time so you can obtain the file positions.
+
+
+
 Entry: fill: An entry which is filled to a particular byte value
 
 
diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index 1c37d84e99a..4bf206878dc 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -103,6 +103,10 @@ class Section(object):
 def SetOffset(self, offset):
 self._offset = offset
 
+def ExpandEntries(self):
+for entry in self._entries.values():
+entry.ExpandEntries()
+
 def AddMissingProperties(self):
 """Add new properties to the device tree as needed for this entry"""
 for prop in ['offset', 'size', 'image-pos']:
diff --git a/tools/binman/control.py b/tools/binman/control.py
index e326456a4ba..caa194c8990 100644
--- a/tools/binman/control.py
+++ b/tools/binman/control.py
@@ -146,6 +146,7 @@ def Binman(options, args):
 # without changing the device-tree size, thus ensuring that our
 # entry offsets remain the same.
 for image in images.values():
+image.ExpandEntries()
 if options.update_fdt:
 image.AddMissingProperties()
 image.ProcessFdt(dtb)
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index f922107523e..7316ad43b5e 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -179,6 +179,9 @@ class Entry(object):
 return Set([fname])
 return Set()
 
+def ExpandEntries(self):
+pass
+
 def AddMissingProperties(self):
 """Add new properties to the device tree as needed for this entry"""
 for prop in ['offset', 'size', 'image-pos']:
diff --git a/tools/binman/etype/files.py b/tools/binman/etype/files.py
new file mode 100644
index 000..99f2f2f67fe
--- /dev/null
+++ b/tools/binman/etype/files.py
@@ -0,0 +1,57 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2018 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for a set of files which are placed in individual
+# sub-entries
+#
+
+import glob
+import os
+
+from section import Entry_section
+import fdt_util
+import state
+import tools
+
+import bsection
+
+class Entry_files(Entry_section):
+"""Entry containing a set of files
+
+Properties / Ent

[U-Boot] [PATCH 05/31] binman: Add x86 support for starting TPL

2018-09-14 Thread Simon Glass
Sometimes we want to include TPL for x86 platforms, such as when we want
to select between different SPL images (e.g. for Chrome OS verified boot).
Add support for this.

Signed-off-by: Simon Glass 
---

 tools/binman/README.entries  | 17 ++
 tools/binman/etype/x86_start16_tpl.py| 30 
 tools/binman/ftest.py| 10 +++-
 tools/binman/test/81_x86-start16-tpl.dts | 14 +++
 4 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/etype/x86_start16_tpl.py
 create mode 100644 tools/binman/test/81_x86-start16-tpl.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 041e1ed..31bc725d577 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -586,3 +586,20 @@ For 32-bit U-Boot, the 'x86_start16' entry type is used 
instead.
 
 
 
+Entry: x86-start16-tpl: x86 16-bit start-up code for TPL
+
+
+Properties / Entry arguments:
+- filename: Filename of tpl/u-boot-x86-16bit-tpl.bin (default
+'tpl/u-boot-x86-16bit-tpl.bin')
+
+x86 CPUs start up in 16-bit mode, even if they are 64-bit CPUs. This code
+must be placed at a particular address. This entry holds that code. It is
+typically placed at offset CONFIG_SYS_X86_START16. The code is responsible
+for changing to 32-bit mode and starting TPL, which in turn jumps to SPL.
+
+If TPL is not being used, the 'x86_start16_spl or 'x86_start16' entry types
+may be used instead.
+
+
+
diff --git a/tools/binman/etype/x86_start16_tpl.py 
b/tools/binman/etype/x86_start16_tpl.py
new file mode 100644
index 000..46ce169ae0a
--- /dev/null
+++ b/tools/binman/etype/x86_start16_tpl.py
@@ -0,0 +1,30 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2018 Google, Inc
+# Written by Simon Glass 
+#
+# Entry-type module for the 16-bit x86 start-up code for U-Boot TPL
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_x86_start16_tpl(Entry_blob):
+"""x86 16-bit start-up code for TPL
+
+Properties / Entry arguments:
+- filename: Filename of tpl/u-boot-x86-16bit-tpl.bin (default
+'tpl/u-boot-x86-16bit-tpl.bin')
+
+x86 CPUs start up in 16-bit mode, even if they are 64-bit CPUs. This code
+must be placed at a particular address. This entry holds that code. It is
+typically placed at offset CONFIG_SYS_X86_START16. The code is responsible
+for changing to 32-bit mode and starting TPL, which in turn jumps to SPL.
+
+If TPL is not being used, the 'x86_start16_spl or 'x86_start16' entry types
+may be used instead.
+"""
+def __init__(self, section, etype, node):
+Entry_blob.__init__(self, section, etype, node)
+
+def GetDefaultFilename(self):
+return 'tpl/u-boot-x86-16bit-tpl.bin'
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index d956bd42e1b..3f4f5f3a43a 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -39,6 +39,7 @@ U_BOOT_SPL_DTB_DATA   = 'spldtb'
 U_BOOT_TPL_DTB_DATA   = 'tpldtb'
 X86_START16_DATA  = 'start16'
 X86_START16_SPL_DATA  = 'start16spl'
+X86_START16_TPL_DATA  = 'start16tpl'
 U_BOOT_NODTB_DATA = 'nodtb with microcode pointer somewhere in here'
 U_BOOT_SPL_NODTB_DATA = 'splnodtb with microcode pointer somewhere in here'
 FSP_DATA  = 'fsp'
@@ -92,6 +93,8 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', X86_START16_DATA)
 TestFunctional._MakeInputFile('spl/u-boot-x86-16bit-spl.bin',
   X86_START16_SPL_DATA)
+TestFunctional._MakeInputFile('tpl/u-boot-x86-16bit-tpl.bin',
+  X86_START16_TPL_DATA)
 TestFunctional._MakeInputFile('u-boot-nodtb.bin', U_BOOT_NODTB_DATA)
 TestFunctional._MakeInputFile('spl/u-boot-spl-nodtb.bin',
   U_BOOT_SPL_NODTB_DATA)
@@ -964,7 +967,7 @@ class TestFunctional(unittest.TestCase):
   str(e.exception))
 
 def testPackStart16Spl(self):
-"""Test that an image with an x86 start16 region can be created"""
+"""Test that an image with an x86 start16 SPL region can be created"""
 data = self._DoReadFile('48_x86-start16-spl.dts')
 self.assertEqual(X86_START16_SPL_DATA, 
data[:len(X86_START16_SPL_DATA)])
 
@@ -1376,6 +1379,11 @@ class TestFunctional(unittest.TestCase):
 self.assertIn("Node '/binman/text': No value provided for text label "
   "'test-id'", str(e.exception))
 
+def testPackStart16Tpl(self):
+"""Test that an image with an x86 start16 TPL region can be created"""
+data = self._DoReadFile('81_x86-start16-tpl.dts')
+self.assertEqual(X86_START16_TPL_DATA, 
data[:len(X86_START16_TPL_DATA)])
+
 
 if __name__ == "__main__":
 unittest.main()
diff --git a/tools/binman/test/81_x86

[U-Boot] [PATCH 16/31] binman: Centralise device-tree updates within binman

2018-09-14 Thread Simon Glass
At present we have a few calls to device-tree functions in binman and plan
to add more as we add new entry types which need to report their results.

It makes sense to put this code in a central place so that we can make
sure all device trees are updated. At present we only have U-Boot proper,
but plan to add SPL and TPL too.

Signed-off-by: Simon Glass 
---

 tools/binman/bsection.py |  9 +
 tools/binman/entry.py|  8 
 tools/binman/state.py| 35 +++
 3 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index a0bd1b6d34e..4f5c33f048b 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -12,6 +12,7 @@ import sys
 
 import fdt_util
 import re
+import state
 import tools
 
 class Section(object):
@@ -98,14 +99,14 @@ class Section(object):
 """Add new properties to the device tree as needed for this entry"""
 for prop in ['offset', 'size', 'image-pos']:
 if not prop in self._node.props:
-self._node.AddZeroProp(prop)
+state.AddZeroProp(self._node, prop)
 for entry in self._entries.values():
 entry.AddMissingProperties()
 
 def SetCalculatedProperties(self):
-self._node.SetInt('offset', self._offset)
-self._node.SetInt('size', self._size)
-self._node.SetInt('image-pos', self._image_pos)
+state.SetInt(self._node, 'offset', self._offset)
+state.SetInt(self._node, 'size', self._size)
+state.SetInt(self._node, 'image-pos', self._image_pos)
 for entry in self._entries.values():
 entry.SetCalculatedProperties()
 
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index 1d6299aefa5..4b87156ff80 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -168,13 +168,13 @@ class Entry(object):
 """Add new properties to the device tree as needed for this entry"""
 for prop in ['offset', 'size', 'image-pos']:
 if not prop in self._node.props:
-self._node.AddZeroProp(prop)
+state.AddZeroProp(self._node, prop)
 
 def SetCalculatedProperties(self):
 """Set the value of device-tree properties calculated by binman"""
-self._node.SetInt('offset', self.offset)
-self._node.SetInt('size', self.size)
-self._node.SetInt('image-pos', self.image_pos)
+state.SetInt(self._node, 'offset', self.offset)
+state.SetInt(self._node, 'size', self.size)
+state.SetInt(self._node, 'image-pos', self.image_pos)
 
 def ProcessFdt(self, fdt):
 return True
diff --git a/tools/binman/state.py b/tools/binman/state.py
index 9583b3fa5f6..5f25b907b9e 100644
--- a/tools/binman/state.py
+++ b/tools/binman/state.py
@@ -118,3 +118,38 @@ def GetFdts():
 """
 yield main_dtb
 
+def GetUpdateNodes(node):
+"""Yield all the nodes that need to be updated in all device trees
+
+The property referenced by this node is added to any device trees which
+have the given node. Due to removable of unwanted notes, SPL and TPL may
+not have this node.
+
+Args:
+node: Node object in the main device tree to look up
+
+Yields:
+Node objects in each device tree that is in use (U-Boot proper, which
+is node, SPL and TPL)
+"""
+yield node
+
+def AddZeroProp(node, prop):
+"""Add a new property to affected device trees with an integer value of 0.
+
+Args:
+prop_name: Name of property
+"""
+for n in GetUpdateNodes(node):
+n.AddZeroProp(prop)
+
+def SetInt(node, prop, value):
+"""Update an integer property in affected device trees with an integer 
value
+
+This is not allowed to change the size of the FDT.
+
+Args:
+prop_name: Name of property
+"""
+for n in GetUpdateNodes(node):
+n.SetInt(prop, value)
-- 
2.19.0.397.gdd90340f6a-goog

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


[U-Boot] [PATCH 20/31] patman: Detect missing tools and report them

2018-09-14 Thread Simon Glass
When tools are needed but not present, at present we just get an error
which can be confusing for the user. Try to be helpful by reporting the
tool as missing and suggesting a possible remedy.

Also update the Run() method to support this.

Signed-off-by: Simon Glass 
---

 tools/patman/tools.py | 29 -
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index e80481438b5..0870bccca0e 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -22,6 +22,10 @@ chroot_path = None
 # Search paths to use for Filename(), used to find files
 search_paths = []
 
+# Tools and the packages that contain them, on debian
+packages = {
+'lz4': 'liblz4-tool',
+}
 
 def PrepareOutputDir(dirname, preserve=False):
 """Select an output directory, ensuring it exists.
@@ -128,8 +132,31 @@ def Align(pos, align):
 def NotPowerOfTwo(num):
 return num and (num & (num - 1))
 
+def PathHasFile(fname):
+"""Check if a given filename is in the PATH
+
+Args:
+fname: Filename to check
+
+Returns:
+True if found, False if not
+"""
+for dir in os.environ['PATH'].split(':'):
+if os.path.exists(os.path.join(dir, fname)):
+return True
+return False
+
 def Run(name, *args):
-command.Run(name, *args, cwd=outdir)
+try:
+return command.Run(name, *args, cwd=outdir, capture=True)
+except:
+if not PathHasFile(name):
+msg = "Plesae install tool '%s'" % name
+package = packages.get(name)
+if package:
+ msg += " (e.g. from package '%s')" % package
+raise ValueError(msg)
+raise
 
 def Filename(fname):
 """Resolve a file path to an absolute path.
-- 
2.19.0.397.gdd90340f6a-goog

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


Re: [U-Boot] [PATCH v3 13/14] pico-imx6ul: Add Falcon mode support

2018-09-14 Thread Stefano Babic
Hi Otavio,

On 13/09/2018 21:57, Otavio Salvador wrote:
> Falcon mode boots the kernel directly from SPL, without loading
> the full U-Boot.
> 
> As pico-imx6ul does not have a GPIO for selecting Falcon versus normal
> mode, enter in Falcon mode when the customer selects the
> CONFIG_SPL_OS_BOOT option in menuconfig.
> 

I merged two days ago V2 on my branch with just minor conflicts in
ico-imx6ul.h on current tree. New version looks identical to V2 with
exception of the last two patches. Is it enough I pick up the last two
patches or is there something I am missing ?

Regards,
Stefano

> Signed-off-by: Otavio Salvador 
> ---
> 
> Changes in v3:
> - new patch
> 
> Changes in v2: None
> 
>  board/technexion/pico-imx6ul/spl.c |  8 
>  configs/pico-imx6ul_defconfig  |  2 ++
>  include/configs/pico-imx6ul.h  | 12 
>  3 files changed, 22 insertions(+)
> 
> diff --git a/board/technexion/pico-imx6ul/spl.c 
> b/board/technexion/pico-imx6ul/spl.c
> index 1819722024..6464a32d3b 100644
> --- a/board/technexion/pico-imx6ul/spl.c
> +++ b/board/technexion/pico-imx6ul/spl.c
> @@ -14,6 +14,14 @@
>  #include 
>  
>  #if defined(CONFIG_SPL_BUILD)
> +
> +#ifdef CONFIG_SPL_OS_BOOT
> +int spl_start_uboot(void)
> +{
> + return 0;
> +}
> +#endif
> +
>  #include 
>  
>  static struct mx6ul_iomux_grp_regs mx6_grp_ioregs = {
> diff --git a/configs/pico-imx6ul_defconfig b/configs/pico-imx6ul_defconfig
> index 3d4063b136..c8d58cbe71 100644
> --- a/configs/pico-imx6ul_defconfig
> +++ b/configs/pico-imx6ul_defconfig
> @@ -21,6 +21,8 @@ CONFIG_SPL_USB_HOST_SUPPORT=y
>  CONFIG_SPL_USB_GADGET_SUPPORT=y
>  CONFIG_SPL_USB_SDP_SUPPORT=y
>  CONFIG_CMD_BOOTMENU=y
> +CONFIG_CMD_SPL=y
> +CONFIG_CMD_SPL_WRITE_SIZE=0x2
>  CONFIG_CMD_MEMTEST=y
>  CONFIG_CMD_DFU=y
>  # CONFIG_CMD_FLASH is not set
> diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h
> index 94c14a7a43..8855be107d 100644
> --- a/include/configs/pico-imx6ul.h
> +++ b/include/configs/pico-imx6ul.h
> @@ -14,6 +14,18 @@
>  #include 
>  #include "imx6_spl.h"
>  
> +#ifdef CONFIG_SPL_OS_BOOT
> +/* Falcon Mode */
> +#define CONFIG_SPL_FS_LOAD_ARGS_NAME   "args"
> +#define CONFIG_SPL_FS_LOAD_KERNEL_NAME "uImage"
> +#define CONFIG_SYS_SPL_ARGS_ADDR   0x8800
> +
> +/* Falcon Mode - MMC support: args@1MB kernel@2MB */
> +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR  0x800   /* 1MB */
> +#define CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS (CONFIG_CMD_SPL_WRITE_SIZE / 
> 512)
> +#define CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR0x1000  /* 2MB */
> +#endif
> +
>  /* Network support */
>  
>  #define CONFIG_FEC_MXC
> 


-- 
=
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


[U-Boot] [PATCH] ls1088a: remove dhcp function from u-boot env as boot source

2018-09-14 Thread Pramod Kumar
Signed-off-by: Pramod Kumar 
---
 include/configs/ls1088ardb.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index eb220bf6e9..363154a40b 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -455,8 +455,7 @@
 
 #define BOOT_TARGET_DEVICES(func) \
func(MMC, mmc, 0) \
-   func(SCSI, scsi, 0) \
-   func(DHCP, dhcp, na)
+   func(SCSI, scsi, 0)
 #include 
 #endif
 
-- 
2.17.1

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


Re: [U-Boot] [PATCH 0/7] Exynos4412 SPL support

2018-09-14 Thread Anand Moon
Hi Simon,
On Fri, 14 Sep 2018 at 08:00, Simon Shields  wrote:
>
> Hi Anand,
>
> On Thu, Sep 13, 2018 at 08:39:52PM +0530, Anand Moon wrote:
> > Hi Simon,
> >
> > On Wed, 12 Sep 2018 at 17:25, Simon Shields  wrote:
> > >
> > > Hi,
> > >
> > > This patch series adds support for using U-Boot's SPL as the second
> > > stage bootloader ("BL2") on Exynos4412 SoCs.
> > >
> > > - Patch #1 adds support for the EMMC/SD OM pin configuration, which is 
> > > used
> > >   by the boards I tested on.
> > > - Patch #2 configures the magic values used to indicate system suspend
> > >   state (which are identical to exynos5).
> > > - Patch #3 renames the existing exynos4 clock/dmc initialisation code
> > >   to reflect the fact that it only supports exynos4210.
> > > - Patches #4 and #5 add/fill in structs reflecting the PMU and TZASC
> > >   register layouts on exynos4412, respectively.
> > > - Patch #6 adds the exynos4412 DMC and clock initialisation code and
> > >   enables building the SPL on exynos4412 platforms.
> > > - Patch #7 enables building the "mkexynosspl" utility for exynos4 SoCs.
> > >
> > > The majority of the logic in patch #6 comes from a vendor u-boot dump
> > > (2010.12!), however, small portions (mostly code used for 2GB RAM
> > > initialisation) were reverse engineered from the vendor
> > > bootloader found on a GT-N7100.
> > >
> > > This patch series has been tested on a GT-I9300 (exynos4412, 1GB RAM)
> > > and a GT-N7100 (exynos4412 prime, 2GB RAM), with a few additional
> > > patchsets applied for board/HW support (which I intend to upstream in
> > > the future).
> > >
> > > Cheers,
> > > Simon
> > >
> >
> > Could you elaborate more on how to generate stage bootloader (BL2) image,
> > I am not aware of such process and what are next step to create SPL
> > for Exynos platform.
> >
> > I have build these patches for Odroid-U3 boards, with no SPL enable.
>
> Of course!
>
> You need to add "select SUPPORT_SPL" to the relevant TARGET_ kconfig
> entry (e.g. [0]). Then, you need to configure the SPL suitably in
> include/configs/.h - see [1], these values should not need
> changing between boards. Finally, you need to enable some SPL
> stuff in the defconfig (see [2]). That should allow u-boot to generate
> a SPL binary, which should go in spl/-spl.bin.
>
> After that, you need to assemble an image suitable for flashing to an
> sdcard/eMMC. I use these two scripts [3], [4] combined with this BL1 [5]
> (originally from the ODROID-X u-boot sources, which no longer appear
> to be available) for eMMC and sdcard respectively.
>
> The usage of the script is:
>
> ./create_4412__image.sh   
> 
>
>  can then be dd'd directly to an SD card or to the eMMC boot0
> partition.
>
> Hope that gets things working for you!
>
> Cheers,
> Simon
>
> >
> > Best Regards
> > -Anand
>
> [0]: 
> https://github.com/fourkbomb/u-boot/blob/4be16a7/arch/arm/mach-exynos/Kconfig#L77
> [1]: 
> https://github.com/fourkbomb/u-boot/blob/4be16a7/include/configs/midas.h#L31-L53
> [2]: 
> https://github.com/fourkbomb/u-boot/blob/4be16a7/configs/midas_defconfig#L6-L10
> [3]: 
> https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_emmc_image.sh
> [4]: 
> https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_sd_image.sh
> [5]: 
> https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/p4412_s_fwbl1.bin

Thank you very much for this inside on building SPL image. I will give
this a try on Odroid U3.

Do you have plan to add some low-level code to control clk memory cpu.

[0] 
https://github.com/SamsungARTIK/u-boot-artik/tree/artik-exynos/v2012.07/board/samsung/smdk4x12

Actually I failed to understand how the communication between the
kernel binary and u-boot with out this code.

Also what about trusted zone, and do we need to get this spl image
signed by Samsung/Hardkernel to make this work.

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


[U-Boot] [PATCH 0/3] add support for VSC8584 and VSC8574 Microsemi PHYs

2018-09-14 Thread Quentin Schulz
The VSC8584 and VSC8574 PHYs are 4-port PHYs that are 10/100/1000BASE-T,
100BASE-FX, 1000BASE-X and triple-speed copper SFP capable, can communicate
with the MAC via SGMII, QSGMII or 1000BASE-X, supports WOL, downshifting
and can set the blinking pattern of each of its 4 LEDs, supports SyncE as
well as HP Auto-MDIX detection.

This adds support for 10/100/1000BASE-T and SGMII/QSGMII link with the
MAC.

They have also an internal Intel 8051 microcontroller whose firmware needs
to be patched when the PHY is reset. If the 8051's firmware has the
expected CRC, its patching can be skipped. The microcontroller can be
accessed from any port of the PHY, though the CRC function can only be done
through the PHY that is the base PHY of the package (internal address 0)
due to a limitation of the firmware.

The GPIO register bank is a set of registers that are common to all PHYs
in the package. So any modification in any register of this bank affects
all PHYs of the package.

Thanks,
Quentin

Quentin Schulz (3):
  net: phy: mscc: add support for VSC8584 PHY
  net: phy: mscc: factorize part of config function for VSC8584
  net: phy: mscc: add support for VSC8574 PHY

 drivers/net/phy/mscc.c | 977 +
 1 file changed, 977 insertions(+)

-- 
2.17.1

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


[U-Boot] [PATCH 1/3] net: phy: mscc: add support for VSC8584 PHY

2018-09-14 Thread Quentin Schulz
The VSC8584 PHY is a 4-port PHY that is 10/100/1000BASE-T, 100BASE-FX,
1000BASE-X and triple-speed copper SFP capable, can communicate with the
MAC via SGMII, QSGMII or 1000BASE-X, supports downshifting and can set
the blinking pattern of each of its 4 LEDs, supports hardware offloading
of MACsec and supports SyncE as well as HP Auto-MDIX detection.

This adds support for 10/100/1000BASE-T and SGMII/QSGMII link with the
MAC.

The VSC8584 has also an internal Intel 8051 microcontroller whose
firmware needs to be patched when the PHY is reset. If the 8051's
firmware has the expected CRC, its patching can be skipped. The
microcontroller can be accessed from any port of the PHY, though the CRC
function can only be done through the PHY that is the base PHY of the
package (internal address 0) due to a limitation of the firmware.

The GPIO register bank is a set of registers that are common to all PHYs
in the package. So any modification in any register of this bank affects
all PHYs of the package.

The revA of the VSC8584 PHY (which is not and will not be publicly
released) should NOT patch the firmware of the microcontroller or it'll
make things worse, the easiest way is just to not support it.

Signed-off-by: Quentin Schulz 
---
 drivers/net/phy/mscc.c | 542 +
 1 file changed, 542 insertions(+)

diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 439f5e3c5c..0e54fe0eff 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -11,12 +11,15 @@
 
 #include 
 #include 
+#include 
+#include 
 
 /* Microsemi PHY ID's */
 #define PHY_ID_VSC8530  0x00070560
 #define PHY_ID_VSC8531  0x00070570
 #define PHY_ID_VSC8540  0x00070760
 #define PHY_ID_VSC8541  0x00070770
+#define PHY_ID_VSC8584  0x000707c0
 
 /* Microsemi VSC85xx PHY Register Pages */
 #define MSCC_EXT_PAGE_ACCESS31 /* Page Access Register */
@@ -29,6 +32,14 @@
 #define MSCC_PHY_PAGE_TEST 0x2A30 /* TEST Page registers */
 #define MSCC_PHY_PAGE_TR   0x52B5 /* Token Ring Page registers */
 
+/* Std Page Register 18 */
+#define MSCC_PHY_BYPASS_CONTROL   18
+#define PARALLEL_DET_IGNORE_ADVERTISED0x0008
+
+/* Std Page Register 22 */
+#define MSCC_PHY_EXT_CNTL_STATUS  22
+#define SMI_BROADCAST_WR_EN  0x0001
+
 /* Std Page Register 28 - PHY AUX Control/Status */
 #define MIIM_AUX_CNTRL_STAT_REG28
 #define MIIM_AUX_CNTRL_STAT_ACTIPHY_TO (0x0004)
@@ -47,6 +58,37 @@
 #define MAC_IF_SELECTION_RGMII (2)
 #define MAC_IF_SELECTION_POS   (11)
 #define MAC_IF_SELECTION_WIDTH (2)
+#define VSC8584_MAC_IF_SELECTION_MASK 0x1000
+#define VSC8584_MAC_IF_SELECTION_SGMII0
+#define VSC8584_MAC_IF_SELECTION_1000BASEX 1
+#define VSC8584_MAC_IF_SELECTION_POS  12
+#define MEDIA_OP_MODE_MASK   0x0700
+#define MEDIA_OP_MODE_COPPER 0
+#define MEDIA_OP_MODE_SERDES 1
+#define MEDIA_OP_MODE_1000BASEX  2
+#define MEDIA_OP_MODE_100BASEFX  3
+#define MEDIA_OP_MODE_AMS_COPPER_SERDES  5
+#define MEDIA_OP_MODE_AMS_COPPER_1000BASEX 6
+#define MEDIA_OP_MODE_AMS_COPPER_100BASEFX 7
+#define MEDIA_OP_MODE_POS8
+
+/* Extended Page 1 Register 20E1 */
+#define MSCC_PHY_ACTIPHY_CNTL20
+#define PHY_ADDR_REVERSED0x0200
+
+/* Extended Page 1 Register 23E1 */
+
+#define MSCC_PHY_EXT_PHY_CNTL_4   23
+#define PHY_CNTL_4_ADDR_POS  11
+
+/* Extended Page 1 Register 25E1 */
+#define MSCC_PHY_VERIPHY_CNTL_225
+
+/* Extended Page 1 Register 26E1 */
+#define MSCC_PHY_VERIPHY_CNTL_326
+
+/* Extended Page 2 Register 16E2 */
+#define MSCC_PHY_CU_PMD_TX_CNTL 16
 
 /* Extended Page 2 Register 20E2 */
 #define MSCC_PHY_RGMII_CNTL_REG20
@@ -72,6 +114,74 @@
 #define RMII_CLK_OUT_ENABLE_WIDTH  (1)
 #define RMII_CLK_OUT_ENABLE_MASK   (0x10)
 
+/* Extended Page 3 Register 22E3 */
+#define MSCC_PHY_SERDES_TX_CRC_ERR_CNT 22
+
+/* Extended page GPIO register 00G */
+#define MSCC_DW8051_CNTL_STATUS0
+#define MICRO_NSOFT_RESET  0x8000
+#define RUN_FROM_INT_ROM   0x4000
+#define AUTOINC_ADDR   0x2000
+#define PATCH_RAM_CLK  0x1000
+#define MICRO_PATCH_EN 0x0080
+#define DW8051_CLK_EN  0x0010
+#define MICRO_CLK_EN   0x0008
+#define MICRO_CLK_DIVIDE(x)((x) >> 1)
+
+/* Extended page GPIO register 09G */
+#define MSCC_TRAP_ROM_ADDR(x)  ((x) * 2 + 1)
+
+/* Extended page GPIO register 10G */
+#define MSCC_PATCH_RAM_ADDR(x) (((x) + 1) * 2)
+
+/* Extended page GPIO register 11G */
+#define MSCC_INT_MEM_ADDR  11
+
+/* Extended page GPIO register 12G */
+#define MSCC_INT_MEM_CNTL  12
+#define READ_SFR

[U-Boot] [PATCH 2/3] net: phy: mscc: factorize part of config function for VSC8584

2018-09-14 Thread Quentin Schulz
Part of the config is common between the VSC8584 and the VSC8574, so to
prepare for the upcoming support of VSC8574, use the phy_device.priv
pointer that will keep the function that holds code that is PHY-specific
and that should be called during config function.

Signed-off-by: Quentin Schulz 
---
 drivers/net/phy/mscc.c | 56 +-
 1 file changed, 39 insertions(+), 17 deletions(-)

diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 0e54fe0eff..b9dfcadd85 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -249,6 +249,10 @@ vsc_phy_clk_slew {
VSC_PHY_CLK_SLEW_RATE_7,
 };
 
+struct vsc85xx_priv {
+   int (*config_pre)(struct phy_device *phydev);
+};
+
 static void vsc8584_csr_write(struct mii_dev *bus, int phy0, u16 addr, u32 val)
 {
bus->write(bus, phy0, MDIO_DEVAD_NONE, MSCC_PHY_REG_TR_DATA_18,
@@ -444,11 +448,28 @@ static int vsc8584_patch_fw(struct mii_dev *bus, int phy, 
const u8 *fw_patch,
return 0;
 }
 
-static int vsc8584_config_pre_init(struct mii_dev *bus, int phy0)
+static int vsc8584_config_pre_init(struct phy_device *phydev)
 {
-   u16 reg, crc;
+   struct mii_dev *bus = phydev->bus;
+   u16 reg, crc, phy0, addr;
int ret;
 
+   if ((phydev->phy_id & MSCC_DEV_REV_MASK) != VSC8584_REVB) {
+   pr_warn("VSC8584 revA not officially supported, skipping 
firmware patching. Use at your own risk.\n");
+   return 0;
+   }
+
+   phy_write(phydev, MDIO_DEVAD_NONE, MSCC_EXT_PAGE_ACCESS,
+ MSCC_PHY_PAGE_EXT1);
+   addr = phy_read(phydev, MDIO_DEVAD_NONE, MSCC_PHY_EXT_PHY_CNTL_4);
+   addr >>= PHY_CNTL_4_ADDR_POS;
+
+   reg = phy_read(phydev, MDIO_DEVAD_NONE, MSCC_PHY_ACTIPHY_CNTL);
+   if (reg & PHY_ADDR_REVERSED)
+   phy0 = phydev->addr + addr;
+   else
+   phy0 = phydev->addr - addr;
+
bus->write(bus, phy0, MDIO_DEVAD_NONE, MSCC_EXT_PAGE_ACCESS,
   MSCC_PHY_PAGE_STD);
 
@@ -898,32 +919,22 @@ static int vsc8541_config(struct phy_device *phydev)
return genphy_config_aneg(phydev);
 }
 
-static int vsc8584_config(struct phy_device *phydev)
+static int vsc8584_config_init(struct phy_device *phydev)
 {
+   struct vsc85xx_priv *priv = phydev->priv;
int ret;
u16 addr;
u16 reg_val;
u16 val;
-   u16 base_addr;
 
phy_write(phydev, MDIO_DEVAD_NONE, MSCC_EXT_PAGE_ACCESS,
  MSCC_PHY_PAGE_EXT1);
addr = phy_read(phydev, MDIO_DEVAD_NONE, MSCC_PHY_EXT_PHY_CNTL_4);
addr >>= PHY_CNTL_4_ADDR_POS;
 
-   val = phy_read(phydev, MDIO_DEVAD_NONE, MSCC_PHY_ACTIPHY_CNTL);
-   if (val & PHY_ADDR_REVERSED)
-   base_addr = phydev->addr + addr;
-   else
-   base_addr = phydev->addr - addr;
-
-   if ((phydev->phy_id & MSCC_DEV_REV_MASK) != VSC8584_REVB) {
-   pr_warn("VSC8584 revA not officially supported, skipping 
firmware patching. Use at your own risk.\n");
-   } else {
-   ret = vsc8584_config_pre_init(phydev->bus, base_addr);
-   if (ret)
-   return ret;
-   }
+   ret = priv->config_pre(phydev);
+   if (ret)
+   return ret;
 
phy_write(phydev, MDIO_DEVAD_NONE, MSCC_EXT_PAGE_ACCESS,
  MSCC_PHY_PAGE_GPIO);
@@ -988,6 +999,17 @@ static int vsc8584_config(struct phy_device *phydev)
return genphy_config(phydev);
 }
 
+static struct vsc85xx_priv vsc8584_priv = {
+   .config_pre = vsc8584_config_pre_init,
+};
+
+static int vsc8584_config(struct phy_device *phydev)
+{
+   phydev->priv = &vsc8584_priv;
+
+   return vsc8584_config_init(phydev);
+}
+
 static struct phy_driver VSC8530_driver = {
.name = "Microsemi VSC8530",
.uid = PHY_ID_VSC8530,
-- 
2.17.1

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


[U-Boot] [PATCH 3/3] net: phy: mscc: add support for VSC8574 PHY

2018-09-14 Thread Quentin Schulz
The VSC8574 PHY is a 4-port PHY that is 10/100/1000BASE-T, 100BASE-FX,
1000BASE-X and triple-speed copper SFP capable, can communicate with
the MAC via SGMII, QSGMII or 1000BASE-X, supports WOL, downshifting and
can set the blinking pattern of each of its 4 LEDs, supports SyncE as
well as HP Auto-MDIX detection.

This adds support for 10/100/1000BASE-T and SGMII/QSGMII link with the
MAC.

The VSC8574 has also an internal Intel 8051 microcontroller whose
firmware needs to be patched when the PHY is reset. If the 8051's
firmware has the expected CRC, its patching can be skipped. The
microcontroller can be accessed from any port of the PHY, though the CRC
function can only be done through the PHY that is the base PHY of the
package (internal address 0) due to a limitation of the firmware.

The GPIO register bank is a set of registers that are common to all PHYs
in the package. So any modification in any register of this bank affects
all PHYs of the package.

Signed-off-by: Quentin Schulz 
---
 drivers/net/phy/mscc.c | 413 +
 1 file changed, 413 insertions(+)

diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index b9dfcadd85..2d510c8715 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -19,6 +19,7 @@
 #define PHY_ID_VSC8531  0x00070570
 #define PHY_ID_VSC8540  0x00070760
 #define PHY_ID_VSC8541  0x00070770
+#define PHY_ID_VSC8574 0x000704a0
 #define PHY_ID_VSC8584  0x000707c0
 
 /* Microsemi VSC85xx PHY Register Pages */
@@ -40,6 +41,9 @@
 #define MSCC_PHY_EXT_CNTL_STATUS  22
 #define SMI_BROADCAST_WR_EN  0x0001
 
+/* Std Page Register 24 */
+#define MSCC_PHY_EXT_PHY_CNTL_2   24
+
 /* Std Page Register 28 - PHY AUX Control/Status */
 #define MIIM_AUX_CNTRL_STAT_REG28
 #define MIIM_AUX_CNTRL_STAT_ACTIPHY_TO (0x0004)
@@ -127,6 +131,7 @@
 #define DW8051_CLK_EN  0x0010
 #define MICRO_CLK_EN   0x0008
 #define MICRO_CLK_DIVIDE(x)((x) >> 1)
+#define MSCC_DW8051_VLD_MASK   0xf1ff
 
 /* Extended page GPIO register 09G */
 #define MSCC_TRAP_ROM_ADDR(x)  ((x) * 2 + 1)
@@ -166,7 +171,9 @@
 #define PROC_CMD_SGMII_MAC   0x0030
 #define PROC_CMD_QSGMII_MAC  0x0020
 #define PROC_CMD_NO_MAC_CONF 0x
+#define PROC_CMD_1588_DEFAULT_INIT   0x0010
 #define PROC_CMD_NOP 0x000f
+#define PROC_CMD_PHY_INIT0x000a
 #define PROC_CMD_CRC16   0x0008
 #define PROC_CMD_FIBER_MEDIA_CONF0x0001
 #define PROC_CMD_MCB_ACCESS_MAC_CONF 0x
@@ -181,6 +188,9 @@
 /* Test Registers */
 #define MSCC_PHY_TEST_PAGE_5   5
 #define MSCC_PHY_TEST_PAGE_8   8
+#define MSCC_PHY_TEST_PAGE_9   9
+#define MSCC_PHY_TEST_PAGE_20  20
+#define MSCC_PHY_TEST_PAGE_24  24
 
 /* Token Ring Page 0x52B5 Registers */
 #define MSCC_PHY_REG_TR_ADDR_1616
@@ -223,6 +233,9 @@
 #define VSC8584_REVB   0x0001
 #define MSCC_DEV_REV_MASK  GENMASK(3, 0)
 
+#define MSCC_VSC8574_REVB_INT8051_FW_START_ADDR 0x4000
+#define MSCC_VSC8574_REVB_INT8051_FW_CRC   0x29e8
+
 #define MSCC_VSC8584_REVB_INT8051_FW_START_ADDR0xe800
 #define MSCC_VSC8584_REVB_INT8051_FW_CRC   0xfb48
 
@@ -370,6 +383,147 @@ static int vsc8584_micro_assert_reset(struct mii_dev 
*bus, int phy)
return 0;
 }
 
+static const u8 fw_patch_vsc8574[] = {
+   0x46, 0x4a, 0x02, 0x43, 0x37, 0x02, 0x46, 0x26, 0x02, 0x46, 0x77, 0x02,
+   0x45, 0x60, 0x02, 0x45, 0xaf, 0xed, 0xff, 0xe5, 0xfc, 0x54, 0x38, 0x64,
+   0x20, 0x70, 0x08, 0x65, 0xff, 0x70, 0x04, 0xed, 0x44, 0x80, 0xff, 0x22,
+   0x8f, 0x19, 0x7b, 0xbb, 0x7d, 0x0e, 0x7f, 0x04, 0x12, 0x3d, 0xd7, 0xef,
+   0x4e, 0x60, 0x03, 0x02, 0x41, 0xf9, 0xe4, 0xf5, 0x1a, 0x74, 0x01, 0x7e,
+   0x00, 0xa8, 0x1a, 0x08, 0x80, 0x05, 0xc3, 0x33, 0xce, 0x33, 0xce, 0xd8,
+   0xf9, 0xff, 0xef, 0x55, 0x19, 0x70, 0x03, 0x02, 0x41, 0xed, 0x85, 0x1a,
+   0xfb, 0x7b, 0xbb, 0xe4, 0xfd, 0xff, 0x12, 0x3d, 0xd7, 0xef, 0x4e, 0x60,
+   0x03, 0x02, 0x41, 0xed, 0xe5, 0x1a, 0x54, 0x02, 0x75, 0x1d, 0x00, 0x25,
+   0xe0, 0x25, 0xe0, 0xf5, 0x1c, 0xe4, 0x78, 0xc5, 0xf6, 0xd2, 0x0a, 0x12,
+   0x41, 0xfa, 0x7b, 0xff, 0x7d, 0x12, 0x7f, 0x07, 0x12, 0x3d, 0xd7, 0xef,
+   0x4e, 0x60, 0x03, 0x02, 0x41, 0xe7, 0xc2, 0x0a, 0x74, 0xc7, 0x25, 0x1a,
+   0xf9, 0x74, 0xe7, 0x25, 0x1a, 0xf8, 0xe6, 0x27, 0xf5, 0x1b, 0xe5, 0x1d,
+   0x24, 0x5b, 0x12, 0x45, 0xea, 0x12, 0x3e, 0xda, 0x7b, 0xfc, 0x7d, 0x11,
+   0x7f, 0x07, 0x12, 0x3d, 0xd7, 0x78, 0xcc, 0xef, 0xf6, 0x78, 0xc1, 0xe6,
+   0xfe, 0xef, 0xd3, 0x9e, 0x40, 0x06, 0x78, 0xcc, 0xe6, 0x78, 0xc1, 0xf6,
+   0x12, 0x41, 0xfa, 0x7b, 0xec, 0x7d, 0x12, 0x7f, 0x07, 0x12, 0x3d, 0xd7,
+   0x78, 0xcb, 0xef, 0xf6, 0xbf, 0x07, 0x06, 0x78, 0xc3, 0x76, 0x1a, 0x80,
+   0x1f, 0

Re: [U-Boot] [PATCH v3 13/14] pico-imx6ul: Add Falcon mode support

2018-09-14 Thread Otavio Salvador
On Fri, Sep 14, 2018 at 8:53 AM Stefano Babic  wrote:
> On 13/09/2018 21:57, Otavio Salvador wrote:
> > Falcon mode boots the kernel directly from SPL, without loading
> > the full U-Boot.
> >
> > As pico-imx6ul does not have a GPIO for selecting Falcon versus normal
> > mode, enter in Falcon mode when the customer selects the
> > CONFIG_SPL_OS_BOOT option in menuconfig.
> >
>
> I merged two days ago V2 on my branch with just minor conflicts in
> ico-imx6ul.h on current tree. New version looks identical to V2 with
> exception of the last two patches. Is it enough I pick up the last two
> patches or is there something I am missing ?

Some commit log improvements. As it wasn't push to imx tree, do you
want me to send v4 with all fixes?



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


Re: [U-Boot] [PATCH v3 13/14] pico-imx6ul: Add Falcon mode support

2018-09-14 Thread Stefano Babic
On 14/09/2018 14:49, Otavio Salvador wrote:
> On Fri, Sep 14, 2018 at 8:53 AM Stefano Babic  wrote:
>> On 13/09/2018 21:57, Otavio Salvador wrote:
>>> Falcon mode boots the kernel directly from SPL, without loading
>>> the full U-Boot.
>>>
>>> As pico-imx6ul does not have a GPIO for selecting Falcon versus normal
>>> mode, enter in Falcon mode when the customer selects the
>>> CONFIG_SPL_OS_BOOT option in menuconfig.
>>>
>>
>> I merged two days ago V2 on my branch with just minor conflicts in
>> ico-imx6ul.h on current tree. New version looks identical to V2 with
>> exception of the last two patches. Is it enough I pick up the last two
>> patches or is there something I am missing ?
> 
> Some commit log improvements. As it wasn't push to imx tree,

Due to breakage before release, I was convinced by Tom to run a full
travis before any PR (I push my local branch to github to let travis
build it: https://github.com/sbabic/u-boot-imx)

Yes, that the reason my question: I am still able to change before merging.

> do you
> want me to send v4 with all fixes?

As far as I see, it is not required. I fixed myself the niptick in
commit log for 1/14, and I have already rebase and fix the conflicts in
pico-imx6ul - there is no need to redo the same work.

I cannot find any other changes between V2 and V3, so I am getting  to
pick up the last two commits before pushing to the server.

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 v3 13/14] pico-imx6ul: Add Falcon mode support

2018-09-14 Thread Otavio Salvador
On Fri, Sep 14, 2018 at 10:07 AM Stefano Babic  wrote:
> On 14/09/2018 14:49, Otavio Salvador wrote:
> > On Fri, Sep 14, 2018 at 8:53 AM Stefano Babic  wrote:
> >> On 13/09/2018 21:57, Otavio Salvador wrote:
> >>> Falcon mode boots the kernel directly from SPL, without loading
> >>> the full U-Boot.
> >>>
> >>> As pico-imx6ul does not have a GPIO for selecting Falcon versus normal
> >>> mode, enter in Falcon mode when the customer selects the
> >>> CONFIG_SPL_OS_BOOT option in menuconfig.
> >>>
> >>
> >> I merged two days ago V2 on my branch with just minor conflicts in
> >> ico-imx6ul.h on current tree. New version looks identical to V2 with
> >> exception of the last two patches. Is it enough I pick up the last two
> >> patches or is there something I am missing ?
> >
> > Some commit log improvements. As it wasn't push to imx tree,
>
> Due to breakage before release, I was convinced by Tom to run a full
> travis before any PR (I push my local branch to github to let travis
> build it: https://github.com/sbabic/u-boot-imx)
>
> Yes, that the reason my question: I am still able to change before merging.
>
> > do you
> > want me to send v4 with all fixes?
>
> As far as I see, it is not required. I fixed myself the niptick in
> commit log for 1/14, and I have already rebase and fix the conflicts in
> pico-imx6ul - there is no need to redo the same work.
>
> I cannot find any other changes between V2 and V3, so I am getting  to
> pick up the last two commits before pushing to the server.

Great.

Please amend:

Author: Otavio Salvador 
Date:   Thu Aug 30 13:48:47 2018 -0300

pico-imx6ul: Remove CONFIG_FSL_USDHC from .h

The CONFIG_FSL_USDHC is defined inside "mx6_common.h", which is
already included in this file.

Reviewed-by: Fabio Estevam 
Signed-off-by: Otavio Salvador 


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


Re: [U-Boot] [PATCH v3 13/14] pico-imx6ul: Add Falcon mode support

2018-09-14 Thread Stefano Babic
On 14/09/2018 15:19, Otavio Salvador wrote:
> On Fri, Sep 14, 2018 at 10:07 AM Stefano Babic  wrote:
>> On 14/09/2018 14:49, Otavio Salvador wrote:
>>> On Fri, Sep 14, 2018 at 8:53 AM Stefano Babic  wrote:
 On 13/09/2018 21:57, Otavio Salvador wrote:
> Falcon mode boots the kernel directly from SPL, without loading
> the full U-Boot.
>
> As pico-imx6ul does not have a GPIO for selecting Falcon versus normal
> mode, enter in Falcon mode when the customer selects the
> CONFIG_SPL_OS_BOOT option in menuconfig.
>

 I merged two days ago V2 on my branch with just minor conflicts in
 ico-imx6ul.h on current tree. New version looks identical to V2 with
 exception of the last two patches. Is it enough I pick up the last two
 patches or is there something I am missing ?
>>>
>>> Some commit log improvements. As it wasn't push to imx tree,
>>
>> Due to breakage before release, I was convinced by Tom to run a full
>> travis before any PR (I push my local branch to github to let travis
>> build it: https://github.com/sbabic/u-boot-imx)
>>
>> Yes, that the reason my question: I am still able to change before merging.
>>
>>> do you
>>> want me to send v4 with all fixes?
>>
>> As far as I see, it is not required. I fixed myself the niptick in
>> commit log for 1/14, and I have already rebase and fix the conflicts in
>> pico-imx6ul - there is no need to redo the same work.
>>
>> I cannot find any other changes between V2 and V3, so I am getting  to
>> pick up the last two commits before pushing to the server.
> 
> Great.
> 
> Please amend:
> 
> Author: Otavio Salvador 
> Date:   Thu Aug 30 13:48:47 2018 -0300
> 
> pico-imx6ul: Remove CONFIG_FSL_USDHC from .h
> 
> The CONFIG_FSL_USDHC is defined inside "mx6_common.h", which is
> already included in this file.
> 
> Reviewed-by: Fabio Estevam 
> Signed-off-by: Otavio Salvador 
> 

ok, thanks, done.

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 0/7] Exynos4412 SPL support

2018-09-14 Thread Simon Shields
Hi Anand,

On Fri, Sep 14, 2018 at 05:31:38PM +0530, Anand Moon wrote:
> Hi Simon,
> On Fri, 14 Sep 2018 at 08:00, Simon Shields  wrote:
> >
> > Hi Anand,
> >
> > On Thu, Sep 13, 2018 at 08:39:52PM +0530, Anand Moon wrote:
> > > Hi Simon,
> > >
> > > On Wed, 12 Sep 2018 at 17:25, Simon Shields  wrote:
> > > >
> > > > Hi,
> > > >
> > > > This patch series adds support for using U-Boot's SPL as the second
> > > > stage bootloader ("BL2") on Exynos4412 SoCs.
> > > >
> > > > - Patch #1 adds support for the EMMC/SD OM pin configuration, which is 
> > > > used
> > > >   by the boards I tested on.
> > > > - Patch #2 configures the magic values used to indicate system suspend
> > > >   state (which are identical to exynos5).
> > > > - Patch #3 renames the existing exynos4 clock/dmc initialisation code
> > > >   to reflect the fact that it only supports exynos4210.
> > > > - Patches #4 and #5 add/fill in structs reflecting the PMU and TZASC
> > > >   register layouts on exynos4412, respectively.
> > > > - Patch #6 adds the exynos4412 DMC and clock initialisation code and
> > > >   enables building the SPL on exynos4412 platforms.
> > > > - Patch #7 enables building the "mkexynosspl" utility for exynos4 SoCs.
> > > >
> > > > The majority of the logic in patch #6 comes from a vendor u-boot dump
> > > > (2010.12!), however, small portions (mostly code used for 2GB RAM
> > > > initialisation) were reverse engineered from the vendor
> > > > bootloader found on a GT-N7100.
> > > >
> > > > This patch series has been tested on a GT-I9300 (exynos4412, 1GB RAM)
> > > > and a GT-N7100 (exynos4412 prime, 2GB RAM), with a few additional
> > > > patchsets applied for board/HW support (which I intend to upstream in
> > > > the future).
> > > >
> > > > Cheers,
> > > > Simon
> > > >
> > >
> > > Could you elaborate more on how to generate stage bootloader (BL2) image,
> > > I am not aware of such process and what are next step to create SPL
> > > for Exynos platform.
> > >
> > > I have build these patches for Odroid-U3 boards, with no SPL enable.
> >
> > Of course!
> >
> > You need to add "select SUPPORT_SPL" to the relevant TARGET_ kconfig
> > entry (e.g. [0]). Then, you need to configure the SPL suitably in
> > include/configs/.h - see [1], these values should not need
> > changing between boards. Finally, you need to enable some SPL
> > stuff in the defconfig (see [2]). That should allow u-boot to generate
> > a SPL binary, which should go in spl/-spl.bin.
> >
> > After that, you need to assemble an image suitable for flashing to an
> > sdcard/eMMC. I use these two scripts [3], [4] combined with this BL1 [5]
> > (originally from the ODROID-X u-boot sources, which no longer appear
> > to be available) for eMMC and sdcard respectively.
> >
> > The usage of the script is:
> >
> > ./create_4412__image.sh   
> > 
> >
> >  can then be dd'd directly to an SD card or to the eMMC boot0
> > partition.
> >
> > Hope that gets things working for you!
> >
> > Cheers,
> > Simon
> >
> > >
> > > Best Regards
> > > -Anand
> >
> > [0]: 
> > https://github.com/fourkbomb/u-boot/blob/4be16a7/arch/arm/mach-exynos/Kconfig#L77
> > [1]: 
> > https://github.com/fourkbomb/u-boot/blob/4be16a7/include/configs/midas.h#L31-L53
> > [2]: 
> > https://github.com/fourkbomb/u-boot/blob/4be16a7/configs/midas_defconfig#L6-L10
> > [3]: 
> > https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_emmc_image.sh
> > [4]: 
> > https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/create_4412_sd_image.sh
> > [5]: 
> > https://github.com/fourkbomb/buildroot-external-midas/blob/master/board/midas/p4412_s_fwbl1.bin
> 
> Thank you very much for this inside on building SPL image. I will give
> this a try on Odroid U3.
> 
> Do you have plan to add some low-level code to control clk memory cpu.
> 
> [0] 
> https://github.com/SamsungARTIK/u-boot-artik/tree/artik-exynos/v2012.07/board/samsung/smdk4x12
> 
> Actually I failed to understand how the communication between the
> kernel binary and u-boot with out this code.

That code is not actually board-specific. It's added in patch #6.
All the BL2 does is initialise clocks and memory (DMC), then load U-Boot from 
the appropriate
boot medium.

> 
> Also what about trusted zone, and do we need to get this spl image
> signed by Samsung/Hardkernel to make this work.

As with other Exynos SoCs in U-Boot, this doesn't support loading
trustzone. As a result, you need to remove the "secure-firmware" node
from the Linux kernel (you can also do it with CONFIG_OF_BOARD_SETUP[0]).
Adding support for the TZSW could probably be done, but the goal here
was to remove blobs from the boot process - so I don't really have
any interest in adding TZSW support right now.

> 
> Best Regards
> -Anand

Cheers,
Simon

[0]: 
https://github.com/fourkbomb/u-boot/blob/4be16a7/board/samsung/midas/midas.c#L377-L402
___
U-Boot mailing list
U-Boot@lists.denx.de
htt

[U-Boot] Pull request: u-boot-ubi/master

2018-09-14 Thread Heiko Schocher

Hello Tom,

please pull from u-boot-ubi-git master

The following changes since commit d1e15041abf3ccd38169ae7aa8736f78200f8ee3:

  Merge branch 'master' of git://git.denx.de/u-boot-uniphier (2018-09-11 
08:50:10 -0400)

are available in the Git repository at:

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

for you to fetch changes up to 7236e24bc4366e166b9f5f5e156f7b64cdb64949:

  fs: ubifs: Add missing newlines in super.c (2018-09-14 06:31:54 +0200)


Stefan Roese (1):
  fs: ubifs: Add missing newlines in super.c

 fs/ubifs/super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

travis build is fine:
https://travis-ci.org/hsdenx/u-boot-ubi/builds/428463072

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


[U-Boot] [PATCH] serial: omap: Add support for AM654 uart controller

2018-09-14 Thread Lokesh Vutla
AM654 uses a UART controller that is compatible (partially) with
existing OMAP UART, Introduce a compatible for adding support
for this controller.

Signed-off-by: Lokesh Vutla 
---
- Similar kernel patch: https://lore.kernel.org/patchwork/patch/949227/

 drivers/serial/serial_omap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c
index d8a047bb71..af3c755f96 100644
--- a/drivers/serial/serial_omap.c
+++ b/drivers/serial/serial_omap.c
@@ -104,6 +104,7 @@ static const struct udevice_id omap_serial_ids[] = {
{ .compatible = "ti,am3352-uart", },
{ .compatible = "ti,am4372-uart", },
{ .compatible = "ti,dra742-uart", },
+   { .compatible = "ti,am654-uart", },
{}
 };
 #endif /* OF_CONTROL && !OF_PLATDATA */
-- 
2.18.0

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


Re: [U-Boot] [PATCH v9 02/18] efi: Don't allow CMD_BOOTEFI_SELFTEST on sandbox

2018-09-14 Thread Simon Glass
Hi Alex,

On 26 August 2018 at 18:53, Alexander Graf  wrote:
>
>
> On 08.08.18 11:54, Simon Glass wrote:
>> This does not work at present and gives the following error:
>>
>> output: 'ld.bfd: read in flex scanner failed
>> scripts/Makefile.lib:390: recipe for target 
>> 'lib/efi_selftest/efi_selftest_miniapp_return_efi.so' failed
>>
>> It may be possible to figure this out with suitable linker magic but it
>> does not seem to be easy. Also, we will be able to run the tests on
>> sandbox without using the miniapp.
>>
>> So for now at least, disable this option.
>>
>> Signed-off-by: Simon Glass 
>
> Didn't Heinrich have some magic for this in the works?

Yes I'll rewrite the commit message for this and enable it in the last
patch of the series.

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


Re: [U-Boot] [PATCH v9 04/18] efi: sandbox: Enable EFI loader build for sandbox

2018-09-14 Thread Simon Glass
Hi Alex,

On 26 August 2018 at 18:55, Alexander Graf  wrote:
>
>
> On 08.08.18 11:54, Simon Glass wrote:
>> This allows this feature to build within sandbox. This is for testing
>> purposes only since it is not possible for sandbox to load native code.
>
> Last time I tried I successfully ran native code?

OK well I'll update the commit message. I thought that exit was broken
but perhaps you fixed that?

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


Re: [U-Boot] [PATCH v9 06/18] efi: sandbox: Add a simple 'bootefi test' command

2018-09-14 Thread Simon Glass
Hi Alex,

On 26 August 2018 at 18:58, Alexander Graf  wrote:
>
>
> On 08.08.18 11:54, Simon Glass wrote:
>> This jumps to test code which can call directly into the EFI support. It
>> does not need a separate image so it is easy to write tests with it.
>>
>> This test can be executed without causing problems to the run-time
>> environment (e.g. U-Boot does not need to reboot afterwards).
>>
>> For now the test just outputs a message. To try it:
>>
>> ./sandbox/u-boot -c "bootefi test"
>> U-Boot 2017.09-00204-g696c9855fe (Sep 17 2017 - 16:43:53 -0600)
>>
>> DRAM:  128 MiB
>> MMC:
>> Using default environment
>>
>> In:serial
>> Out:   serial
>> Err:   serial
>> SCSI:  Net:   No ethernet found.
>> IDE:   Bus 0: not available
>> Found 0 disks
>> WARNING: booting without device tree
>> Hello, world!
>> Test passed
>>
>> Signed-off-by: Simon Glass 
>
> I think I'm missing the point of this exercise. What's the problem with
> running the selftest suite? Its set of tests that it runs can be
> configured using an environment variable just fine?

I'm not saying you can't run the selftest suite, but that is for a
different purpose. This is just a sanity check. I'll change the name
to 'ping instead'.

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


Re: [U-Boot] [PATCH v9 10/18] sandbox: Try to start the RAM buffer at a particular address

2018-09-14 Thread Simon Glass
Hi Alex,

On 26 August 2018 at 19:01, Alexander Graf  wrote:
>
>
> On 08.08.18 11:54, Simon Glass wrote:
>> Use a starting address of 256MB which should be available. This helps to
>> make sandbox RAM buffers pointers more recognisable.
>>
>> Signed-off-by: Simon Glass 
>
> Is this really necessary still?

It was never necessary, but it seems like a useful thing to do. It
makes all the pointers smaller (the first 32 bits are 0 which makes
them easier to read).

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


Re: [U-Boot] [PATCH v9 00/18] efi: Enable sandbox support for EFI loader

2018-09-14 Thread Simon Glass
Hi Alex,

On 26 August 2018 at 19:28, Alexander Graf  wrote:
>
>
> On 08.08.18 11:54, Simon Glass wrote:
>> A limitation of the EFI loader at present is that it does not build with
>> sandbox. This makes it hard to write tests, since sandbox is used for most
>> testing in U-Boot.
>>
>> This series enables the EFI loader feature. It allows sandbox to build and
>> run a trivial function which calls the EFI API to output a message.
>>
>> Also included in v8 is support for running the full EFI self tests. These
>> run OK with some tweaks to a few parts of the code.
>>
>> With v9, various EFI patches have been applied which change things. This
>> series includes a partial review of one, which makes 'bootefi test' work.
>> But there are still problems with 'bootefi selftest':
>>
>> $ sandbox/u-boot -D -c "bootefi selftest"
>> ...
>> Executing 'block device'
>> /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest_block_device.c(385):
>> TODO: Wrong volume label 'xxa1', expected 'U-BOOT TEST'
>> map_to_sysmem: Added map from 7ffd0782d2a0 to 800
>> phys_to_virt: Used map from 800 to 7ffd0782d2a0
>> writing /u-boot.txt
>> find_tag: Used map from 7ffd0782d2a0 to 800
>> phys_to_virt: Used map from 800 to 7ffd0782d2a0
>> /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest_block_device.c(458):
>> ERROR: Unexpected file content
>> /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest.c(109):
>> ERROR: Executing 'block device' failed

I was able to fix this one.

>>
>> ...
>>
>> Executing 'simple network protocol'
>> DHCP Discover
>> DHCP Discover
>> DHCP Discover
>> DHCP Discover
>> DHCP Discover
>> DHCP Discover
>> DHCP Discover
>> DHCP Discover
>> DHCP Discover
>> DHCP Discover
>> /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest_snp.c(311):
>> ERROR: Timeout occurred
>> /home/sjg/c/src/third_party/u-boot/files/lib/efi_selftest/efi_selftest.c(109):
>> ERROR: Executing 'simple network protocol' failed

I am not sure what is going on here. I think it is best that Heinrich
takes a look once this stuff lands and before we enable the tests on
travis-ci.

>>
>> This series is at u-boot-dm/efi-working
>
> Thanks a lot again for pushing this forward.
>
> My ultimate goal is that sandbox is not a special case, but just "yet
> another" target we support.
>
> That means things like a special "bootefi test" command really don't
> make any sense and should just go.

I've renamed this to 'bootefi ping'. While I understand your POV, I
feel that a simple sanity check is useful. At present 'bootefi
selftest' quits sandbox when it finishes, so itis not really working
the way it should anyway.

>
> The other thing we need to make sure is that every divergence we find
> between sandbox and non-sandbox behavior potentially hints at a real
> problem:
>
>   - If exit doesn't work, don't just disable it, instead please debug
> why and resolve it for real.
>
>   - If tests are failing that really shouldn't fail, please figure out
> why. Maybe they used the stack in some cases which breaks your mapping
> logic?

Please see above. The tests all used to pass 6 months ago when I
revised this work. I think we should get something in and then do some
more work.

>
> At the end of the day, I want to have as little divergence between the
> sandbox target and a real x86_64 QEMU target for example. As long as we
> don't exit boot services, both should really behave the same.

Fair enough, but Rome wasn't built in a day. I think that's my main
problem with this painful year-long process, that you want everything
to be done in one series, instead of collaboratively moving towards
the ultimate end goal. We would have had this running a long time ago
if we have just taken an incremental approach.

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


Re: [U-Boot] [PATCH v9 13/18] efi: Add a call to exit() along with why we can't use it

2018-09-14 Thread Simon Glass
Hi Alex,

On 26 August 2018 at 19:13, Alexander Graf  wrote:
>
>
> On 23.08.18 22:37, Heinrich Schuchardt wrote:
>> On 08/08/2018 11:54 AM, Simon Glass wrote:
>>> The test should exit like any other EFI application, by calling exit()
>>> in the boot services API. But this crashes at present on sandbox. For now,
>>> add in the placeholder code.
>>>
>>> Signed-off-by: Simon Glass 
>>> ---
>>>
>>> Changes in v9: None
>>> Changes in v8: None
>>> Changes in v7: None
>>> Changes in v6: None
>>> Changes in v5: None
>>> Changes in v4: None
>>> Changes in v3: None
>>> Changes in v2: None
>>>
>>>  lib/efi_loader/efi_test.c | 12 +++-
>>>  1 file changed, 11 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/lib/efi_loader/efi_test.c b/lib/efi_loader/efi_test.c
>>> index 4b8d49f324b..5401a0f4715 100644
>>> --- a/lib/efi_loader/efi_test.c
>>> +++ b/lib/efi_loader/efi_test.c
>>> @@ -9,8 +9,18 @@
>>>  int efi_test(efi_handle_t image_handle, struct efi_system_table *systable)
>>>  {
>>>  struct efi_simple_text_output_protocol *con_out = systable->con_out;
>>> +struct efi_boot_services *boottime = systable->boottime;
>>> +int ret;
>>>
>>> -con_out->output_string(con_out, L"Hello, world!\n");
>>> +ret = con_out->output_string(con_out, L"Hello, world!\n");
>>> +
>>> +/*
>>> + * We should really call EFI's exit() here but this crashes at present
>>> + * on sandbox due to the incorrect use of setjmp() and longjmp(). Once
>>
>> What makes you think that setjmp and longjmp are incorrectly used?
>> Couldn't the sandbox implementation of both create the problem?
>
> I agree, last time we tracked exit problems down to incorrect
> setjmp/longjmp implementations in sandbox.

Yes that's what I mean. I'll reword it a bit.

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


Re: [U-Boot] [PATCH v9 12/18] sandbox: Enhance map_to_sysmem() to handle foreign pointers

2018-09-14 Thread Simon Glass
Hi Alex,

On 26 August 2018 at 19:11, Alexander Graf  wrote:
>
>
> On 08.08.18 11:54, Simon Glass wrote:
>> At present map_sysmem() maps an address into the sandbox RAM buffer,
>> return a pointer, while map_to_sysmem() goes the other way.
>>
>> The mapping is currently just 1:1 since a case was not found where a more
>> flexible mapping was needed. PCI does have a separate and more complex
>> mapping, but uses its own mechanism.
>>
>> However this arrange cannot handle one important case, which is where a
>> test declares a stack variable and passes a pointer to it into a U-Boot
>> function which uses map_to_sysmem() to turn it into a address. Since the
>> pointer is not inside emulated DRAM, this will fail.
>>
>> Add a mapping feature which can handle any such pointer, mapping it to a
>> simple tag value which can be passed around in U-Boot as an address.
>>
>> Signed-off-by: Simon Glass 
>
> I think you are aware that this logic will fall apart spectacularly if
> any arithmetic operation happens on the virtual (U-Boot) address, right?
> So simple code like
>
>   readl(vaddr + 1);
>
> will just fail (hopefully) or (more likely) return a completely
> incorrect value.
>
> I assume this is intentional, but shouldn't the tag increment be
> something slightly larger then?

What do you expect readl() to do on sandbox? At present it is just a
no-op. I suppose we could support memory-mapped I/O but it has not
been attempted yet.

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


[U-Boot] [PATCH 1/1] efi_loader: terminal left upper corner is [1, 1]

2018-09-14 Thread Heinrich Schuchardt
For the VT102 and the Linux console the left upper corner is [1, 1].
EFI uses [0, 0] as left upper corner.

Check parameters of the SetCursorPosition() service.

Use CSI H like EDK2 for positioning.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_console.c | 24 +---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 40e33f9fd3..e1f6b2b887 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -372,13 +372,31 @@ static efi_status_t EFIAPI efi_cout_set_cursor_position(
struct efi_simple_text_output_protocol *this,
unsigned long column, unsigned long row)
 {
+   efi_status_t ret = EFI_SUCCESS;
+   struct simple_text_output_mode *con = &efi_con_mode;
+   struct cout_mode *mode = &efi_cout_modes[con->mode];
+
EFI_ENTRY("%p, %ld, %ld", this, column, row);
 
-   printf(ESC"[%d;%df", (int)row, (int)column);
+   /* Check parameters */
+   if (!this) {
+   ret = EFI_INVALID_PARAMETER;
+   goto out;
+   }
+   if (row >= mode->rows || column >= mode->columns) {
+   ret = EFI_UNSUPPORTED;
+   goto out;
+   }
+
+   /*
+* Set cursor position by sending CSI H.
+* EFI origin is [0, 0], terminal origin is [1, 1].
+*/
+   printf(ESC "[%d;%dH", (int)row + 1, (int)column + 1);
efi_con_mode.cursor_column = column;
efi_con_mode.cursor_row = row;
-
-   return EFI_EXIT(EFI_SUCCESS);
+out:
+   return EFI_EXIT(ret);
 }
 
 static efi_status_t EFIAPI efi_cout_enable_cursor(
-- 
2.18.0

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


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

2018-09-14 Thread Tom Rini
On Fri, Sep 14, 2018 at 5:50 AM, Heiko Schocher  wrote:

> Hello Tom,
>
> please pull from u-boot-i2c.git master
>
> The following changes since commit d1e15041abf3ccd38169ae7aa8736f
> 78200f8ee3:
>
>   Merge branch 'master' of git://git.denx.de/u-boot-uniphier (2018-09-11
> 08:50:10 -0400)
>
> are available in the Git repository at:
>
>   git://git.denx.de/u-boot-i2c.git master
>
> for you to fetch changes up to ca1d6ca3653c5aa7679a55fd84a20e175d3b8e64:
>
>
>   i2c: Drop CONFIG_SYS_I2C_MXS (2018-09-14 06:30:29 +0200)
>
> 
> Tuomas Tynkkynen (1):
>   i2c: Drop CONFIG_SYS_I2C_MXS
>
>  drivers/i2c/Makefile  |   1 -
>  drivers/i2c/mxs_i2c.c | 319 --
> 
> 
>  2 files changed, 320 deletions(-)
>  delete mode 100644 drivers/i2c/mxs_i2c.c
>

Applied to u-boot/master, thanks!

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


Re: [U-Boot] [PATCH v2 2/2] rockchip: fix incorrect detection of ram size

2018-09-14 Thread Marty E. Plummer
On Fri, Sep 14, 2018 at 12:55:19PM +0200, Simon Glass wrote:
> Hi Marty,
> 
> 
> On 13 September 2018 at 23:55, Marty E. Plummer  
> wrote:
> > Taken from coreboot's src/soc/rockchip/rk3288/sdram.c
> >
> > Without this change, my u-boot build for the asus c201 chromebook (4GiB)
> > is incorrectly detected as 0 Bytes of ram.
> >
> > Signed-off-by: Marty E. Plummer 
> > ---
> >  arch/arm/mach-rockchip/sdram_common.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/arm/mach-rockchip/sdram_common.c 
> > b/arch/arm/mach-rockchip/sdram_common.c
> > index 650d53e4d9..194dc74b9f 100644
> > --- a/arch/arm/mach-rockchip/sdram_common.c
> > +++ b/arch/arm/mach-rockchip/sdram_common.c
> > @@ -48,6 +48,8 @@ size_t rockchip_sdram_size(phys_addr_t reg)
> >   rank, col, bk, cs0_row, bw, row_3_4);
> > }
> >
> > +   size_mb = min(size_mb, SDRAM_MAX_SIZE/SZ_1M);
> > +
> 
> Is this because size_mb is only 32-bits?
>
Yeah. This has been discussed a bit before on the ml. 0x1__ for
4GiB, and due to memory mapped peripherals it can only address
0xff00_ bytes anyways so clamp it down. Code is lifted from
coreboot's init code.
> > return (size_t)size_mb << 20;
> >  }
> >
> > --
> > 2.18.0
> >
> 
> Regards,
> Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/2] rockchip: add support for veyron-speedy (ASUS Chromebook C201)

2018-09-14 Thread Marty E. Plummer
On Fri, Sep 14, 2018 at 12:55:16PM +0200, Simon Glass wrote:
> On 13 September 2018 at 23:55, Marty E. Plummer  
> wrote:
> > This adds support for the ASUS C201, a RK3288-based clamshell
> > device. The device tree comes from linus's linux tree at
> > 3f16503b7d2274ac8cbab11163047ac0b4c66cfe. The SDRAM parameters
> > are for 4GB Samsung LPDDR3, decoded from coreboot's
> > src/mainboard/google/veyron/sdram_inf/sdram-lpddr3-samsung-4GB.inc
> >
> > Signed-off-by: Marty E. Plummer 
> > ---
> >  arch/arm/dts/Makefile |   1 +
> >  arch/arm/dts/rk3288-veyron-speedy-u-boot.dtsi |  31 
> >  arch/arm/dts/rk3288-veyron-speedy.dts | 143 ++
> >  arch/arm/mach-rockchip/rk3288-board-spl.c |   3 +-
> >  arch/arm/mach-rockchip/rk3288/Kconfig |  11 ++
> >  board/google/veyron/Kconfig   |  16 ++
> >  configs/chromebook_speedy_defconfig   |  98 
> >  7 files changed, 302 insertions(+), 1 deletion(-)
> >  create mode 100644 arch/arm/dts/rk3288-veyron-speedy-u-boot.dtsi
> >  create mode 100644 arch/arm/dts/rk3288-veyron-speedy.dts
> >  create mode 100644 configs/chromebook_speedy_defconfig
> 
> Reviewed-by: Simon Glass 
> 
> But aren't you missing a changelog?
> 
I don't follow.
> - Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/6] pico-imx6ul: Fix TechNexion spelling on MAINTAINERS file

2018-09-14 Thread Otavio Salvador
Signed-off-by: Otavio Salvador 
---

 board/technexion/pico-imx6ul/MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/technexion/pico-imx6ul/MAINTAINERS 
b/board/technexion/pico-imx6ul/MAINTAINERS
index 334847cf71..fec5868015 100644
--- a/board/technexion/pico-imx6ul/MAINTAINERS
+++ b/board/technexion/pico-imx6ul/MAINTAINERS
@@ -1,4 +1,4 @@
-Technexion PICO-IMX6UL board
+TechNexion PICO-IMX6UL board
 M: Richard Hu 
 M: Fabio Estevam 
 S: Maintained
@@ -6,7 +6,7 @@ F:  board/technexion/pico-imx6ul/
 F: include/configs/pico-imx6ul.h
 F: configs/pico-imx6ul_defconfig
 
-Technexion PICO-HOBBIT-IMX6UL
+TechNexion PICO-HOBBIT-IMX6UL
 M: Otavio Salvador 
 S: Maintained
 F: configs/pico-hobbit-imx6ul_defconfig
-- 
2.19.0

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


[U-Boot] [PATCH 4/6] pico-imx7d: Fix TechNexion spelling on MAINTAINERS file

2018-09-14 Thread Otavio Salvador
Signed-off-by: Otavio Salvador 
---

 board/technexion/pico-imx7d/MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/technexion/pico-imx7d/MAINTAINERS 
b/board/technexion/pico-imx7d/MAINTAINERS
index 0755bd8366..1505c4da9a 100644
--- a/board/technexion/pico-imx7d/MAINTAINERS
+++ b/board/technexion/pico-imx7d/MAINTAINERS
@@ -1,11 +1,11 @@
-Technexion PICO-IMX7D board
+TechNexion PICO-IMX7D board
 M: Vanessa Maegima 
 S: Maintained
 F: board/technexion/pico-imx7d/
 F: include/configs/pico-imx7d.h
 F: configs/pico-imx7d_defconfig
 
-Technexion PICO-PI-IMX7
+TechNexion PICO-PI-IMX7
 M: Otavio Salvador 
 S: Maintained
 F: configs/pico-pi-imx7d_defconfig
-- 
2.19.0

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


[U-Boot] [PATCH 2/6] pico-imx6ul: Add PICO-Pi baseboard support

2018-09-14 Thread Otavio Salvador
This adds the device tree to the DFU and bootmenu environment setting.

Signed-off-by: Otavio Salvador 
---

 include/configs/pico-imx6ul.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h
index 8c657c13ac..3d93205535 100644
--- a/include/configs/pico-imx6ul.h
+++ b/include/configs/pico-imx6ul.h
@@ -60,11 +60,14 @@
"u-boot raw 0x8a 0x400 mmcpart 1;" \
"/boot/zImage ext4 0 1;" \
"/boot/imx6ul-pico-hobbit.dtb ext4 0 1;" \
+   "/boot/imx6ul-pico-pi.dtb ext4 0 1;" \
"rootfs part 0 1\0" \
 
 #define BOOTMENU_ENV \
"bootmenu_0=Boot using PICO-Hobbit baseboard=" \
"setenv fdtfile imx6ul-pico-hobbit.dtb\0" \
+   "bootmenu_1=Boot using PICO-Pi baseboard=" \
+   "setenv fdtfile imx6ul-pico-pi.dtb\0" \
 
 #define CONFIG_SYS_MMC_IMG_LOAD_PART   1
 
-- 
2.19.0

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


[U-Boot] [PATCH 5/6] pico-imx7d: Add PICO-Hobbit baseboard support

2018-09-14 Thread Otavio Salvador
This adds the device tree to the DFU and bootmenu environment setting.

Signed-off-by: Otavio Salvador 
---

 include/configs/pico-imx7d.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 4cc84ff5d4..0e770bf41f 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -48,11 +48,14 @@
"spl raw 0x2 0x400 mmcpart 1;" \
"u-boot raw 0x8a 0x400 mmcpart 1;" \
"/boot/zImage ext4 0 1;" \
+   "/boot/imx7d-pico-hobbit.dtb ext4 0 1;" \
"/boot/imx7d-pico-pi.dtb ext4 0 1;" \
"rootfs part 0 1\0" \
 
 #define BOOTMENU_ENV \
-   "bootmenu_0=Boot using PICO-PI baseboard=" \
+   "bootmenu_0=Boot using PICO-Hobbit baseboard=" \
+   "setenv fdtfile imx7d-pico-hobbit.dtb\0" \
+   "bootmenu_1=Boot using PICO-Pi baseboard=" \
"setenv fdtfile imx7d-pico-pi.dtb\0" \
 
 #define CONFIG_SUPPORT_EMMC_BOOT /* eMMC specific */
-- 
2.19.0

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


[U-Boot] [PATCH 3/6] pico-imx6ul: Add a new defconfig with PICO-Pi selected

2018-09-14 Thread Otavio Salvador
This adds a new defconfig which pre-selects the PICO-Pi baseboard
allowing a completely non-interactive boot process.

Signed-off-by: Otavio Salvador 
---

 board/technexion/pico-imx6ul/MAINTAINERS |  5 +++
 configs/pico-pi-imx6ul_defconfig | 53 
 2 files changed, 58 insertions(+)
 create mode 100644 configs/pico-pi-imx6ul_defconfig

diff --git a/board/technexion/pico-imx6ul/MAINTAINERS 
b/board/technexion/pico-imx6ul/MAINTAINERS
index fec5868015..b8f3d24a53 100644
--- a/board/technexion/pico-imx6ul/MAINTAINERS
+++ b/board/technexion/pico-imx6ul/MAINTAINERS
@@ -10,3 +10,8 @@ TechNexion PICO-HOBBIT-IMX6UL
 M: Otavio Salvador 
 S: Maintained
 F: configs/pico-hobbit-imx6ul_defconfig
+
+TechNexion PICO-PI-IMX6UL
+M: Otavio Salvador 
+S: Maintained
+F: configs/pico-pi-imx6ul_defconfig
diff --git a/configs/pico-pi-imx6ul_defconfig b/configs/pico-pi-imx6ul_defconfig
new file mode 100644
index 00..680438d265
--- /dev/null
+++ b/configs/pico-pi-imx6ul_defconfig
@@ -0,0 +1,53 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MX6=y
+CONFIG_SYS_TEXT_BASE=0x8780
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_TARGET_PICO_IMX6UL=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL=y
+CONFIG_SPL_LIBDISK_SUPPORT=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
+CONFIG_BOOTDELAY=3
+CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
+CONFIG_DEFAULT_FDT_FILE="imx6ul-pico-pi.dtb"
+CONFIG_BOARD_EARLY_INIT_F=y
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_USB_HOST_SUPPORT=y
+CONFIG_SPL_USB_GADGET_SUPPORT=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
+CONFIG_CMD_BOOTMENU=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_DFU=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_DFU_MMC=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_SIZE=0x1000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
+CONFIG_FSL_ESDHC=y
+CONFIG_PHYLIB=y
+CONFIG_PHY_MICREL=y
+CONFIG_MII=y
+CONFIG_USB=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="FSL"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_CI_UDC=y
+CONFIG_OF_LIBFDT=y
-- 
2.19.0

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


[U-Boot] [PATCH 6/6] pico-imx7d: Add a new defconfig with PICO-Hobbit selected

2018-09-14 Thread Otavio Salvador
This adds a new defconfig which pre-selects the PICO-Hobbit baseboard
allowing a completely non-interactive boot process.

Signed-off-by: Otavio Salvador 
---

 board/technexion/pico-imx7d/MAINTAINERS |  5 ++
 configs/pico-hobbit-imx7d_defconfig | 61 +
 2 files changed, 66 insertions(+)
 create mode 100644 configs/pico-hobbit-imx7d_defconfig

diff --git a/board/technexion/pico-imx7d/MAINTAINERS 
b/board/technexion/pico-imx7d/MAINTAINERS
index 1505c4da9a..f9a1dfc05e 100644
--- a/board/technexion/pico-imx7d/MAINTAINERS
+++ b/board/technexion/pico-imx7d/MAINTAINERS
@@ -5,6 +5,11 @@ F: board/technexion/pico-imx7d/
 F: include/configs/pico-imx7d.h
 F: configs/pico-imx7d_defconfig
 
+TechNexion PICO-HOBBIT-IMX7
+M: Otavio Salvador 
+S: Maintained
+F: configs/pico-hobbit-imx7d_defconfig
+
 TechNexion PICO-PI-IMX7
 M: Otavio Salvador 
 S: Maintained
diff --git a/configs/pico-hobbit-imx7d_defconfig 
b/configs/pico-hobbit-imx7d_defconfig
new file mode 100644
index 00..568fb11d59
--- /dev/null
+++ b/configs/pico-hobbit-imx7d_defconfig
@@ -0,0 +1,61 @@
+CONFIG_ARM=y
+CONFIG_ARCH_MX7=y
+CONFIG_SYS_TEXT_BASE=0x8780
+CONFIG_SPL_GPIO_SUPPORT=y
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_TARGET_PICO_IMX7D=y
+CONFIG_SPL_MMC_SUPPORT=y
+CONFIG_SPL_SERIAL_SUPPORT=y
+CONFIG_SPL=y
+CONFIG_SPL_LIBDISK_SUPPORT=y
+CONFIG_ARMV7_BOOT_SEC_DEFAULT=y
+CONFIG_IMX_RDC=y
+CONFIG_IMX_BOOTAUX=y
+CONFIG_DISTRO_DEFAULTS=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
+CONFIG_BOOTCOMMAND="run findfdt; run finduuid; run distro_bootcmd"
+CONFIG_DEFAULT_FDT_FILE="imx7d-pico-hobbit.dtb"
+CONFIG_SPL_I2C_SUPPORT=y
+CONFIG_SPL_USB_HOST_SUPPORT=y
+CONFIG_SPL_USB_GADGET_SUPPORT=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
+# CONFIG_CMD_BOOTD is not set
+CONFIG_CMD_BOOTMENU=y
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_XIMG is not set
+CONFIG_CMD_SPL=y
+CONFIG_CMD_SPL_WRITE_SIZE=0x2
+CONFIG_CMD_DFU=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
+CONFIG_CMD_USB_MASS_STORAGE=y
+# CONFIG_CMD_SETEXPR is not set
+# CONFIG_CMD_MII is not set
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_DFU_MMC=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x8200
+CONFIG_FASTBOOT_BUF_SIZE=0x1000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
+CONFIG_FSL_ESDHC=y
+CONFIG_PHYLIB=y
+CONFIG_MII=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_MXC_USB_OTG_HACTIVE=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_MANUFACTURER="FSL"
+CONFIG_USB_GADGET_VENDOR_NUM=0x0525
+CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
+CONFIG_CI_UDC=y
+CONFIG_OF_LIBFDT=y
-- 
2.19.0

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


Re: [U-Boot] [PATCH] linux/compat.h: Add netdev_### log macros

2018-09-14 Thread Joe Hershberger
Hi Bin,
On Tue, Sep 11, 2018 at 5:07 AM Bin Meng  wrote:
>
> Hi Joe,
>
> On Fri, Jul 27, 2018 at 2:52 AM Joe Hershberger  
> wrote:
> >
> > On Thu, Jul 26, 2018 at 5:15 AM, Bin Meng  wrote:
> > > Currently there are two ethernet drivers (mvneta.c and mvpp2.c) that
> > > has netdev_### (eg: netdev_dbg) log macros defined in its own driver
> > > file. This adds these log macros in a common place linux/compat.h.
> > >
> > > Signed-off-by: Bin Meng 
> >
> > Acked-by: Joe Hershberger 
>
> When will the following be merged? Thanks!

Now that we have a release, I'll try to get them in my queue next week.

> http://patchwork.ozlabs.org/project/uboot/list/?series=57711
> http://patchwork.ozlabs.org/project/uboot/list/?series=57715
> http://patchwork.ozlabs.org/project/uboot/list/?series=58148
> http://patchwork.ozlabs.org/project/uboot/list/?series=58485
>
> Regards,
> Bin
> ___
> 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


  1   2   >