Re: [U-Boot] [PATCH 2/2] spi: kirkwood: Full dm conversion

2018-04-29 Thread Jagan Teki
On Fri, Apr 27, 2018 at 2:21 PM, Simon Guinot  wrote:
> On Thu, Apr 26, 2018 at 11:30:00AM +0530, Jagan Teki wrote:
>> On Thu, Mar 15, 2018 at 5:03 PM, Jagan Teki  
>> wrote:
>> > kirkwood now support dt along with platform data,
>> > respective boards need to switch into dm for the same.
>>
>> Added all board mainatiner, using this driver on their relevant
>> boards. So try to switch to DM_SPI(SPI_FLASH) before migration
>> deadline expires.
>
> Hi Jagan,
>
> And what is the deadline exactly ?

See DM_SPI/SPI_FLASH migration details from, doc/driver-model/MIGRATION.txt

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


Re: [U-Boot] mainline u-boot on radxarock (rockchip rk3188) from SDcard

2018-04-29 Thread Trevor Woerner
On Sun 2018-04-29 @ 01:35:18 AM, Trevor Woerner wrote:
> I am able to generate a bootable image (bootloader, parameter, kernel,
> filesystem) for my radxarock (pro) on an SDcard if I use the bootloader from
> https://github.com/radxa/u-boot-rockchip. When I try to use mainline
> u-boot_2008.01

I was looking though the mailing list and was happy to see lots of recent
activity with rk3188! Maybe there's a chance I'll get this working :-)

As such, I moved from 2018.01 to the most latest (i.e.
8c84287a0f225e29b688bda848e49a555c68a442)

Unfortunately I'm not seeing much of a change:

U-Boot SPL 2018.05-rc2-00145-g8c84287a0f-dirty (Apr 29 2018 - 23:06:29 
+)
Returning to boot ROM...


U-Boot 2018.05-rc2-00145-g8c84287a0f-dirty (Apr 29 2018 - 23:06:29 
+)

Model: Radxa Rock
DRAM:  2 GiB
MMC:   
Loading Environment from MMC... MMC Device 0 not found
*** Warning - No MMC card found, using default environment

Failed (-5)
In:serial@20064000
Out:   serial@20064000
Err:   serial@20064000
Model: Radxa Rock
rockchip_dnl_key_pressed: adc_channel_single_shot fail!
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0 
No MMC device available
No MMC device available
No ethernet found.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-rockchip
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default
No ethernet found.
Config file not found
No ethernet found.
No ethernet found.
=>

Anything else I can try testing?

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


Re: [U-Boot] image: Display FIT signature for configs

2018-04-29 Thread Clément Péron
> I think this is fine, but can you please re-post with a Signed off by
> line?  Thanks!

> --
> Tom

Yes I will, and also missed to substitute "image" by "configuration" in the
comments,

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


[U-Boot] [PATCH v2 1/1] efi_loader: if EFI_LOADER is enabled, enable CFB_CONSOLE_ANSI

2018-04-29 Thread Heinrich Schuchardt
EFI applications like GRUB issue ANSI sequences for setting colors
and for positioning. So if the EFI subsystem is enabled, we should
also enable ANSI control sequences by default.

Signed-off-by: Heinrich Schuchardt 
---
v2
Use 'imply' instead of 'default if'.
---
 lib/efi_loader/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index d38780b604e..c3c4783f394 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -10,6 +10,7 @@ config EFI_LOADER
default y
select LIB_UUID
select HAVE_BLOCK_DEVICE
+   imply CFB_CONSOLE_ANSI
help
  Select this option if you want to run EFI applications (like grub2)
  on top of U-Boot. If this option is enabled, U-Boot will expose EFI
-- 
2.17.0

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


Re: [U-Boot] [U-Boot, 2/2] tools: mkenvimage: Fix possible segfault on stdin input

2018-04-29 Thread Tom Rini
On Fri, Apr 20, 2018 at 03:29:31PM +0200, Alexander Dahl wrote:

> The size of 'filebuf' was not increased as more and more bytes are read
> from stdin, but 'filebuf' was always reallocated to the same fix size.
> This works as long as only less bytes than the initial buffer size come
> in, for more input this will segfault. (It actually does, I tested
> that.) So for each loop cycle the buffer size has to be increased by the
> number of bytes we want to read.
> 
> Signed-off-by: Alexander Dahl 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v2, 7/8] Consolidate __assert_failed into one implementation

2018-04-29 Thread Tom Rini
On Thu, Apr 19, 2018 at 04:32:56AM +, Alex Kiernan wrote:

> We had two implementations of __assert_failed which were almost identical,
> combine them into one.
> 
> Signed-off-by: Alex Kiernan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, 1/2] tools: mkenvimage: Fix read() stdin error handling

2018-04-29 Thread Tom Rini
On Fri, Apr 20, 2018 at 03:29:30PM +0200, Alexander Dahl wrote:

> On success read() returns the number of bytes read or zero for EOF. On
> error -1 is returned and errno is set, so the right way to test if read
> had failed is to test the return value instead of errno.
> 
> Signed-off-by: Alexander Dahl 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] tools: mkimage: Check for datafile when type is script

2018-04-29 Thread Tom Rini
On Sun, Apr 22, 2018 at 05:11:17AM +, Alex Kiernan wrote:

> If generating a script image and no datafile has been passed in, mkimage
> dies with SIGSEGV:
> 
>   #0  __strchr_sse2 () at ../sysdeps/x86_64/multiarch/../strchr.S:32
>   #1  0x00403818 in main
>   at tools/mkimage.c:503
> 
> Add explicit test for datafile to fix this.
> 
> Signed-off-by: Alex Kiernan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] test: dm: regmap: fix license header

2018-04-29 Thread Tom Rini
On Fri, Apr 27, 2018 at 01:07:21AM +0900, Masahiro Yamada wrote:

> Signed-off-by: Masahiro Yamada 

Applied to u-boot/master, thanks!

-- 
Tom


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


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

2018-04-29 Thread Tom Rini
On Fri, Apr 27, 2018 at 06:32:53PM +0530, Jagan Teki wrote:

> Hi Tom,
> 
> Please pull this PR.
> 
> thanks,
> Jagan.
> 
> The following changes since commit 275d80a4c2fb63890f3f4c16b7ad481064e650a0:
> 
>   Merge git://git.denx.de/u-boot-usb (2018-04-22 09:30:36 -0400)
> 
> are available in the Git repository at:
> 
>   git://git.denx.de/u-boot-sunxi.git master
> 
> for you to fetch changes up to 5ff8e54888e4d26a352453564f7f599d29696dc9:
> 
>   sunxi: improve throughput in the sunxi_mmc driver (2018-04-25 10:29:38 
> +0530)
> 
> 
> Philipp Tomsich (1):
>   sunxi: improve throughput in the sunxi_mmc driver
> 
> Stefan Mavrodiev (1):
>   sunxi: mmc: Fix phase delays
> 
>  drivers/mmc/sunxi_mmc.c | 35 ---
>  1 file changed, 20 insertions(+), 15 deletions(-)

Please re-push on your side, git is unhappy:
$ git pull git://git.denx.de/u-boot-sunxi.git
remote: error: Could not read 275d80a4c2fb63890f3f4c16b7ad481064e650a0
remote: fatal: revision walk setup failed
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

-- 
Tom


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


Re: [U-Boot] [U-Boot,v2,6/8] spl: Disable printf if not required

2018-04-29 Thread Tom Rini
On Thu, Apr 19, 2018 at 04:32:55AM +, Alex Kiernan wrote:

> Now we have a guard for printf, disable it in the build if it's not
> selected.
> 
> Signed-off-by: Alex Kiernan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v1, 2/2] serial: serial_stm32: Rename status register flags

2018-04-29 Thread Tom Rini
On Fri, Apr 20, 2018 at 08:59:07AM +0200, Patrice Chotard wrote:

> Uart status register is named USART_ISR on STM32F7, STM32H7
> and STM32MP1 SoCs family, but USART_SR only on STM32F4 SoCs.
> 
> Use USART_ISR_ prefix instead of USART_SR_ .
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v2, 4/8] spl: ti: Avoid serial calls when serial support is disabled

2018-04-29 Thread Tom Rini
On Thu, Apr 19, 2018 at 04:32:53AM +, Alex Kiernan wrote:

> If CONFIG_SPL_SERIAL_SUPPORT is not set, then the build will fail:
> 
> board/ti/am335x/built-in.o: In function `spl_start_uboot':
> board/ti/am335x/board.c:247: undefined reference to `serial_tstc'
> board/ti/am335x/board.c:247: undefined reference to `serial_getc'
> 
> Avoid the calls to the serial functions in that case.
> 
> Signed-off-by: Alex Kiernan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot,v1,1/2] serial: serial_stm32: Enable overrun

2018-04-29 Thread Tom Rini
On Fri, Apr 20, 2018 at 08:59:06AM +0200, Patrice Chotard wrote:

> Enable uart overrun feature which allows to benefits of uart
> FIFO usage.
> 
> Previously overrun management was disabled, this has to effect
> to bypassed the uart FIFO usage even if FIFO was enabled.
> In particular configuration, for example when video console is
> enabled, copy/pasting a long command line in console results in
> corruption. This is due to the fact that a lot of time is consumed
> in flushing the cache during frame buffer update, so uart chars are
> not read fast enough.
> 
> By using uart FIFO and managing overrun, long command line can by
> copy/paste in console without being corrupted.
> 
> Signed-off-by: Patrice Chotard 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v2, 5/8] spl: Split sprintf, strto* from SPL serial in Kconfig

2018-04-29 Thread Tom Rini
On Thu, Apr 19, 2018 at 04:32:54AM +, Alex Kiernan wrote:

> When SPL serial is disabled, callers who need sprintf or strtoul fail
> because their inclusion is guarded by CONFIG_SPL_SERIAL_SUPPORT/
> CONFIG_TPL_SERIAL_SUPPORT.
> 
> Split printf, sprintf and strto into their own entries and then select
> all of them if SERIAL_SUPPORT is enabled to match the current behaviour.
> 
> Include panic.o unconditionally as it can be called from anywhere which
> uses BUG_ON().
> 
> Signed-off-by: Alex Kiernan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v2, 1/8] Cleanup CONFIG_SPL_SERIAL_SUPPORT migration

2018-04-29 Thread Tom Rini
On Thu, Apr 19, 2018 at 04:32:50AM +, Alex Kiernan wrote:

> CONFIG_SPL_SERIAL_SUPPORT had already been migrated to Kconfig, but
> existed in some include files; fix those up here.
> 
> Signed-off-by: Alex Kiernan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v2, 8/8] spl: disk: usb: Add dependencies to sprintf/strto*

2018-04-29 Thread Tom Rini
On Thu, Apr 19, 2018 at 04:32:57AM +, Alex Kiernan wrote:

> If SPL serial support is disabled nothing brings in sprintf, snprintf
> or simple_strtoul:
> 
>   env/built-in.o: In function `regex_callback':
>   env/attr.c:128: undefined reference to `sprintf'
>   disk/built-in.o: In function `blk_get_device_by_str':
>   disk/part.c:386: undefined reference to `simple_strtoul'
>   disk/part.c:395: undefined reference to `simple_strtoul'
>   disk/built-in.o: In function `blk_get_device_part_str':
>   disk/part.c:522: undefined reference to `simple_strtoul'
>   disk/built-in.o: In function `part_set_generic_name':
>   disk/part.c:704: undefined reference to `sprintf'
>   drivers/built-in.o: In function `init_peripheral_ep':
>   drivers/usb/musb-new/musb_gadget.c:1826: undefined reference to `sprintf'
>   drivers/built-in.o: In function `musb_core_init':
>   drivers/usb/musb-new/musb_core.c:1451: undefined reference to `snprintf'
> 
> Add those dependencies here.
> 
> Signed-off-by: Alex Kiernan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v2, 2/8] spl: ti: Avoid preloader_console_init if !CONFIG_SPL_SERIAL_SUPPORT

2018-04-29 Thread Tom Rini
On Thu, Apr 19, 2018 at 04:32:51AM +, Alex Kiernan wrote:

> If CONFIG_SPL_SERIAL_SUPPORT is disabled then the build fails because
> serial_init is undefined. Guard preloader_console_init() appropriately
> to fix this.
> 
> Signed-off-by: Alex Kiernan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v2, 3/8] spl: Add dependency on serial to Ymodem

2018-04-29 Thread Tom Rini
On Thu, Apr 19, 2018 at 04:32:52AM +, Alex Kiernan wrote:

> Building with Ymodem support requires serial in SPL/TPL, add that
> dependency here.
> 
> Signed-off-by: Alex Kiernan 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, 1/2] ARM: qemu-arm: Dynamically determine timer frequency

2018-04-29 Thread Tom Rini
On Thu, Apr 12, 2018 at 04:24:45AM +0300, Tuomas Tynkkynen wrote:

> After commit 46fc679ede5f69 ("arm: timer: get frequency for arch timer
> armv7 in cp15 cntfrq") the ARM architected timer driver knows how to
> determine the timer frequency at runtime by reading the CNTFRQ register,
> so we don't need to hardcode the timer frequency anymore.
> 
> Signed-off-by: Tuomas Tynkkynen 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot,2/2] arm: move SYS_ARCH_TIMER to KConfig

2018-04-29 Thread Tom Rini
On Thu, Apr 12, 2018 at 04:24:46AM +0300, Tuomas Tynkkynen wrote:

> From: Andre Przywara 
> 
> SYS_ARCH_TIMER guards the usage of the ARM Generic Timer (aka arch
> timer) in U-Boot.
> At the moment it is mandatory for ARMv8 and used by a few ARMv7 boards.
> Add a proper Kconfig symbol to express this dependency properly,
> allowing certain board configuration to later disable arch timer in case
> there are any problems with it.
> 
> Signed-off-by: Andre Przywara 
> [tuomas: rebase + fix conflicts and resync with moveconfig & use select]
> Signed-off-by: Tuomas Tynkkynen 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] image: Display FIT signature for configs

2018-04-29 Thread Tom Rini
On Fri, Apr 13, 2018 at 11:11:45AM +0200, Clément Péron wrote:

> The signature/hash information are displayed for images but nor for
> configurations.
> 
> Add subnodes printing in fit_conf_print() like it's done in fit_image_print()
> ---
>  common/image-fit.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 4b03390454..b87f4420fa 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -1589,6 +1589,7 @@ void fit_conf_print(const void *fit, int noffset, const 
> char *p)
>   const char *uname;
>   int ret;
>   int fdt_index, loadables_index;
> + int ndepth;
>  
>   /* Mandatory properties */
>   ret = fit_get_desc(fit, noffset, );
> @@ -1638,6 +1639,16 @@ void fit_conf_print(const void *fit, int noffset, 
> const char *p)
>   }
>   printf("%s\n", uname);
>   }
> +
> + /* Process all hash subnodes of the component image node */
> + for (ndepth = 0, noffset = fdt_next_node(fit, noffset, );
> +  (noffset >= 0) && (ndepth > 0);
> +  noffset = fdt_next_node(fit, noffset, )) {
> + if (ndepth == 1) {
> + /* Direct child node of the component image node */
> + fit_image_print_verification_data(fit, noffset, p);
> + }
> + }
>  }
>  
>  static int fit_image_select(const void *fit, int rd_noffset, int verify)

I think this is fine, but can you please re-post with a Signed off by
line?  Thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 1/1] video: if EFI_LOADER is enabled, enable CFB_CONSOLE_ANSI

2018-04-29 Thread Heinrich Schuchardt
On 04/29/2018 10:52 PM, Alexander Graf wrote:
> 
> 
>> Am 29.04.2018 um 22:43 schrieb Heinrich Schuchardt :
>>
>> EFI applications like GRUB issue ANSI sequences for setting colors
>> and for positioning. So if the EFI subsystem is enabled, we should
>> also enable ANSI control sequences by default.
>>
>> Signed-off-by: Heinrich Schuchardt 
>> ---
>> drivers/video/Kconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
>> index 2fc0defcd0..343ef31031 100644
>> --- a/drivers/video/Kconfig
>> +++ b/drivers/video/Kconfig
>> @@ -557,6 +557,7 @@ config CFB_CONSOLE
>> config CFB_CONSOLE_ANSI
>>bool "Support ANSI escape sequences"
>>depends on CFB_CONSOLE
>> +default y if EFI_LOADER
> 
> Isn‘t this what imply does?
> 
> Alex

Do you mean an existing imply? Or do you mean I should put an imply
somewhere else?

Regards

Heinrich

> 
>>help
>>  This allows the colour buffer frame buffer driver to support
>>  a limited number of ANSI escape sequences (cursor control,
>> -- 
>> 2.11.0
>>
> 
> 

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


Re: [U-Boot] [PATCH 1/1] video: if EFI_LOADER is enabled, enable CFB_CONSOLE_ANSI

2018-04-29 Thread Alexander Graf


> Am 29.04.2018 um 22:43 schrieb Heinrich Schuchardt :
> 
> EFI applications like GRUB issue ANSI sequences for setting colors
> and for positioning. So if the EFI subsystem is enabled, we should
> also enable ANSI control sequences by default.
> 
> Signed-off-by: Heinrich Schuchardt 
> ---
> drivers/video/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 2fc0defcd0..343ef31031 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -557,6 +557,7 @@ config CFB_CONSOLE
> config CFB_CONSOLE_ANSI
>bool "Support ANSI escape sequences"
>depends on CFB_CONSOLE
> +default y if EFI_LOADER

Isn‘t this what imply does?

Alex

>help
>  This allows the colour buffer frame buffer driver to support
>  a limited number of ANSI escape sequences (cursor control,
> -- 
> 2.11.0
> 

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


[U-Boot] [PATCH 1/1] video: if EFI_LOADER is enabled, enable CFB_CONSOLE_ANSI

2018-04-29 Thread Heinrich Schuchardt
EFI applications like GRUB issue ANSI sequences for setting colors
and for positioning. So if the EFI subsystem is enabled, we should
also enable ANSI control sequences by default.

Signed-off-by: Heinrich Schuchardt 
---
 drivers/video/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 2fc0defcd0..343ef31031 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -557,6 +557,7 @@ config CFB_CONSOLE
 config CFB_CONSOLE_ANSI
bool "Support ANSI escape sequences"
depends on CFB_CONSOLE
+   default y if EFI_LOADER
help
  This allows the colour buffer frame buffer driver to support
  a limited number of ANSI escape sequences (cursor control,
-- 
2.11.0

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


[U-Boot] [PATCH v3] dm: core: add functions to get memory-mapped I/O addresses

2018-04-29 Thread Daniel Schwierzeck
From: Álvaro Fernández Rojas 

Signed-off-by: Álvaro Fernández Rojas 
Reviewed-by: Daniel Schwierzeck 
Signed-off-by: Daniel Schwierzeck 

---
This replaces/updates patch 01/17 from patch series
https://patchwork.ozlabs.org/cover/889542/. The update fixes
some issues with Sandbox and adds unit-tests. The remaining patches
from the patch series can be applied as-is when this patch has been
committed.

Changes in v3:
- replace ioremap() with map_physmem()
- add unit tests
- fix checkpatch.pl warnings

Changes in v2:
- new patch

 drivers/core/fdtaddr.c | 15 +++
 drivers/core/read.c| 15 +++
 include/dm/fdtaddr.h   | 22 ++
 include/dm/read.h  | 32 
 test/dm/test-fdt.c | 42 ++
 5 files changed, 126 insertions(+)

diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 9a3b4c312a..afea47bf7c 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -137,6 +137,21 @@ void *devfdt_get_addr_ptr(struct udevice *dev)
return (void *)(uintptr_t)devfdt_get_addr_index(dev, 0);
 }
 
+void *devfdt_remap_addr_index(struct udevice *dev, int index)
+{
+   fdt_addr_t addr = devfdt_get_addr(dev);
+
+   if (addr == FDT_ADDR_T_NONE)
+   return NULL;
+
+   return map_physmem(addr, 0, MAP_NOCACHE);
+}
+
+void *devfdt_remap_addr(struct udevice *dev)
+{
+   return devfdt_remap_addr_index(dev, 0);
+}
+
 void *devfdt_map_physmem(struct udevice *dev, unsigned long size)
 {
fdt_addr_t addr = devfdt_get_addr(dev);
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 601d1322d6..615551b8f3 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -58,6 +58,16 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int 
index)
return devfdt_get_addr_index(dev, index);
 }
 
+void *dev_remap_addr_index(struct udevice *dev, int index)
+{
+   fdt_addr_t addr = dev_read_addr_index(dev, index);
+
+   if (addr == FDT_ADDR_T_NONE)
+   return NULL;
+
+   return map_physmem(addr, 0, MAP_NOCACHE);
+}
+
 fdt_addr_t dev_read_addr(struct udevice *dev)
 {
return dev_read_addr_index(dev, 0);
@@ -70,6 +80,11 @@ void *dev_read_addr_ptr(struct udevice *dev)
return (addr == FDT_ADDR_T_NONE) ? NULL : map_sysmem(addr, 0);
 }
 
+void *dev_remap_addr(struct udevice *dev)
+{
+   return dev_remap_addr_index(dev, 0);
+}
+
 fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property,
  fdt_size_t *sizep)
 {
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index c46f0e91d0..82fc5f931d 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -34,6 +34,28 @@ fdt_addr_t devfdt_get_addr(struct udevice *dev);
  */
 void *devfdt_get_addr_ptr(struct udevice *dev);
 
+/**
+ * devfdt_remap_addr() - Return pointer to the memory-mapped I/O address
+ *   of the reg property of a device
+ *
+ * @dev: Pointer to a device
+ *
+ * @return Pointer to addr, or NULL if there is no such property
+ */
+void *devfdt_remap_addr(struct udevice *dev);
+
+/**
+ * devfdt_remap_addr_index() - Return indexed pointer to the memory-mapped
+ * I/O address of the reg property of a device
+ * @index: the 'reg' property can hold a list of  pairs
+ *and @index is used to select which one is required
+ *
+ * @dev: Pointer to a device
+ *
+ * @return Pointer to addr, or NULL if there is no such property
+ */
+void *devfdt_remap_addr_index(struct udevice *dev, int index);
+
 /**
  * devfdt_map_physmem() - Read device address from reg property of the
  * device node and map the address into CPU address
diff --git a/include/dm/read.h b/include/dm/read.h
index f14c7a7ba8..c826a2235c 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -113,6 +113,18 @@ int dev_read_size(struct udevice *dev, const char 
*propname);
  */
 fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);
 
+/**
+ * dev_remap_addr_index() - Get the indexed reg property of a device
+ *   as a memory-mapped I/O pointer
+ *
+ * @dev: Device to read from
+ * @index: the 'reg' property can hold a list of  pairs
+ *and @index is used to select which one is required
+ *
+ * @return pointer or NULL if not found
+ */
+void *dev_remap_addr_index(struct udevice *dev, int index);
+
 /**
  * dev_read_addr() - Get the reg property of a device
  *
@@ -132,6 +144,16 @@ fdt_addr_t dev_read_addr(struct udevice *dev);
  */
 void *dev_read_addr_ptr(struct udevice *dev);
 
+/**
+ * dev_remap_addr() - Get the reg property of a device as a
+ * memory-mapped I/O pointer
+ *
+ * @dev: Device to read from
+ *
+ * @return pointer or NULL if not found
+ */
+void 

[U-Boot] [PATCH 1/1] efi_loader: always check parameters in efi_cout_query_mode()

2018-04-29 Thread Heinrich Schuchardt
If we cannot determine the size of the serial terminal we still have
to check the parameters of efi_cout_query_mode().

Querying the size of the serial terminal drains the keyboard buffer.
So make sure we do this during the initialization and not in the midst
of an EFI application.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_console.c | 90 +++-
 1 file changed, 48 insertions(+), 42 deletions(-)

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index d687362a50..f1b8db55d6 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -13,8 +13,6 @@
 #include 
 #include 
 
-static bool console_size_queried;
-
 #define EFI_COUT_MODE_2 2
 #define EFI_MAX_COUT_MODE 3
 
@@ -206,6 +204,51 @@ static int query_console_serial(int *rows, int *cols)
return 0;
 }
 
+/*
+ * Update the mode table.
+ *
+ * By default the only mode available is 80x25. If the console has at least 50
+ * lines, enable mode 80x50. If we can query the console size and it is neither
+ * 80x25 nor 80x50, set it as an additional mode.
+ */
+static void query_console_size(void)
+{
+   const char *stdout_name = env_get("stdout");
+   int rows, cols;
+
+   if (stdout_name && !strcmp(stdout_name, "vidconsole") &&
+   IS_ENABLED(CONFIG_DM_VIDEO)) {
+   struct stdio_dev *stdout_dev =
+   stdio_get_by_name("vidconsole");
+   struct udevice *dev = stdout_dev->priv;
+   struct vidconsole_priv *priv =
+   dev_get_uclass_priv(dev);
+   rows = priv->rows;
+   cols = priv->cols;
+   } else if (query_console_serial(, )) {
+   return;
+   }
+
+   /* Test if we can have Mode 1 */
+   if (cols >= 80 && rows >= 50) {
+   efi_cout_modes[1].present = 1;
+   efi_con_mode.max_mode = 2;
+   }
+
+   /*
+* Install our mode as mode 2 if it is different
+* than mode 0 or 1 and set it as the currently selected mode
+*/
+   if (!cout_mode_matches(_cout_modes[0], rows, cols) &&
+   !cout_mode_matches(_cout_modes[1], rows, cols)) {
+   efi_cout_modes[EFI_COUT_MODE_2].columns = cols;
+   efi_cout_modes[EFI_COUT_MODE_2].rows = rows;
+   efi_cout_modes[EFI_COUT_MODE_2].present = 1;
+   efi_con_mode.max_mode = EFI_MAX_COUT_MODE;
+   efi_con_mode.mode = EFI_COUT_MODE_2;
+   }
+}
+
 static efi_status_t EFIAPI efi_cout_query_mode(
struct efi_simple_text_output_protocol *this,
unsigned long mode_number, unsigned long *columns,
@@ -213,52 +256,12 @@ static efi_status_t EFIAPI efi_cout_query_mode(
 {
EFI_ENTRY("%p, %ld, %p, %p", this, mode_number, columns, rows);
 
-   if (!console_size_queried) {
-   const char *stdout_name = env_get("stdout");
-   int rows, cols;
-
-   console_size_queried = true;
-
-   if (stdout_name && !strcmp(stdout_name, "vidconsole") &&
-   IS_ENABLED(CONFIG_DM_VIDEO)) {
-   struct stdio_dev *stdout_dev =
-   stdio_get_by_name("vidconsole");
-   struct udevice *dev = stdout_dev->priv;
-   struct vidconsole_priv *priv =
-   dev_get_uclass_priv(dev);
-   rows = priv->rows;
-   cols = priv->cols;
-   } else if (query_console_serial(, )) {
-   goto out;
-   }
-
-   /* Test if we can have Mode 1 */
-   if (cols >= 80 && rows >= 50) {
-   efi_cout_modes[1].present = 1;
-   efi_con_mode.max_mode = 2;
-   }
-
-   /*
-* Install our mode as mode 2 if it is different
-* than mode 0 or 1 and set it  as the currently selected mode
-*/
-   if (!cout_mode_matches(_cout_modes[0], rows, cols) &&
-   !cout_mode_matches(_cout_modes[1], rows, cols)) {
-   efi_cout_modes[EFI_COUT_MODE_2].columns = cols;
-   efi_cout_modes[EFI_COUT_MODE_2].rows = rows;
-   efi_cout_modes[EFI_COUT_MODE_2].present = 1;
-   efi_con_mode.max_mode = EFI_MAX_COUT_MODE;
-   efi_con_mode.mode = EFI_COUT_MODE_2;
-   }
-   }
-
if (mode_number >= efi_con_mode.max_mode)
return EFI_EXIT(EFI_UNSUPPORTED);
 
if (efi_cout_modes[mode_number].present != 1)
return EFI_EXIT(EFI_UNSUPPORTED);
 
-out:
if (columns)
*columns = efi_cout_modes[mode_number].columns;
if (rows)
@@ -566,6 +569,9 @@ int efi_console_register(void)
struct efi_object 

[U-Boot] [PATCH 2/2] efi_selftest: updating the cursor position

2018-04-29 Thread Heinrich Schuchardt
The test case for text output is updated to check correct updating
of the cursor position.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_selftest/efi_selftest_textoutput.c | 78 ++
 1 file changed, 78 insertions(+)

diff --git a/lib/efi_selftest/efi_selftest_textoutput.c 
b/lib/efi_selftest/efi_selftest_textoutput.c
index 6e8c90cc8b..22a28508a3 100644
--- a/lib/efi_selftest/efi_selftest_textoutput.c
+++ b/lib/efi_selftest/efi_selftest_textoutput.c
@@ -24,6 +24,13 @@ static int execute(void)
size_t background;
size_t attrib;
efi_status_t ret;
+   s16 col;
+   u16 cr[] = { 0x0d, 0x00 };
+   u16 lf[] = { 0x0a, 0x00 };
+   u16 brahmi[] = { /* 2 Brahmi letters */
+   0xD804, 0xDC05,
+   0xD804, 0xDC22,
+   0};
 
/* SetAttribute */
efi_st_printf("\nColor palette\n");
@@ -43,6 +50,77 @@ static int execute(void)
efi_st_error("TestString failed for ANSI characters\n");
return EFI_ST_FAILURE;
}
+   /* OutputString */
+   ret = con_out->output_string(con_out,
+L"Testing cursor column update\n");
+   if (ret != EFI_ST_SUCCESS) {
+   efi_st_error("OutputString failed for ANSI characters");
+   return EFI_ST_FAILURE;
+   }
+   col = con_out->mode->cursor_column;
+   ret = con_out->output_string(con_out, lf);
+   if (ret != EFI_ST_SUCCESS) {
+   efi_st_error("OutputString failed for line feed\n");
+   return EFI_ST_FAILURE;
+   }
+   if (con_out->mode->cursor_column != col) {
+   efi_st_error("Cursor column changed by line feed\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = con_out->output_string(con_out, cr);
+   if (ret != EFI_ST_SUCCESS) {
+   efi_st_error("OutputString failed for carriage return\n");
+   return EFI_ST_FAILURE;
+   }
+   if (con_out->mode->cursor_column) {
+   efi_st_error("Cursor column not 0 at beginning of line\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = con_out->output_string(con_out, L"123");
+   if (ret != EFI_ST_SUCCESS) {
+   efi_st_error("OutputString failed for ANSI characters\n");
+   return EFI_ST_FAILURE;
+   }
+   if (con_out->mode->cursor_column != 3) {
+   efi_st_error("Cursor column not incremented properly\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = con_out->output_string(con_out, L"\b");
+   if (ret != EFI_ST_SUCCESS) {
+   efi_st_error("OutputString failed for backspace\n");
+   return EFI_ST_FAILURE;
+   }
+   if (con_out->mode->cursor_column != 2) {
+   efi_st_error("Cursor column not decremented properly\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = con_out->output_string(con_out, L"\b\b");
+   if (ret != EFI_ST_SUCCESS) {
+   efi_st_error("OutputString failed for backspace\n");
+   return EFI_ST_FAILURE;
+   }
+   if (con_out->mode->cursor_column) {
+   efi_st_error("Cursor column not decremented properly\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = con_out->output_string(con_out, L"\b\b");
+   if (ret != EFI_ST_SUCCESS) {
+   efi_st_error("OutputString failed for backspace\n");
+   return EFI_ST_FAILURE;
+   }
+   if (con_out->mode->cursor_column) {
+   efi_st_error("Cursor column decremented past zero\n");
+   return EFI_ST_FAILURE;
+   }
+   ret = con_out->output_string(con_out, brahmi);
+   if (ret != EFI_ST_SUCCESS) {
+   efi_st_todo("Unicode output not fully supported\n");
+   } else if (con_out->mode->cursor_column != 2) {
+   efi_st_printf("Unicode not handled properly\n");
+   return EFI_ST_FAILURE;
+   }
+   efi_st_printf("\n");
+
return EFI_ST_SUCCESS;
 }
 
-- 
2.14.2

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


[U-Boot] [PATCH 1/2] efi_loader: updating the cursor position

2018-04-29 Thread Heinrich Schuchardt
The current coding advances the column by the number of UTF-8 bytes.
The column should be increased by one per unicode character.

The UEFI spec provides advance rules for U+, U+0008, U+000A,
and U000D. All other characters, including control characters
U+0007 (bel) and U+0009 (tab), have to increase the column by one.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_console.c | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index 5d1a9a8081..d687362a50 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -117,25 +117,36 @@ static efi_status_t EFIAPI efi_cout_output_string(
 
unsigned int n16 = utf16_strlen(string);
char buf[MAX_UTF8_PER_UTF16 * n16 + 1];
-   char *p;
+   u16 *p;
 
*utf16_to_utf8((u8 *)buf, string, n16) = '\0';
 
fputs(stdout, buf);
 
-   for (p = buf; *p; p++) {
+   /*
+* Update the cursor position.
+*
+* The UEFI spec provides advance rules for U+, U+0008, U+000A,
+* and U000D. All other characters, including control characters
+* U+0007 (bel) and U+0009 (tab), have to increase the column by one.
+*/
+   for (p = string; *p; ++p) {
switch (*p) {
-   case '\r':   /* carriage-return */
-   con->cursor_column = 0;
+   case '\b':  /* U+0008, backspace */
+   con->cursor_column = max(0, con->cursor_column - 1);
break;
-   case '\n':   /* newline */
+   case '\n':  /* U+000A, newline */
con->cursor_column = 0;
con->cursor_row++;
break;
-   case '\t':   /* tab, assume 8 char align */
+   case '\r':  /* U+000D, carriage-return */
+   con->cursor_column = 0;
break;
-   case '\b':   /* backspace */
-   con->cursor_column = max(0, con->cursor_column - 1);
+   case 0xd800 ... 0xdbff:
+   /*
+* Ignore high surrogates, we do not want to count a
+* Unicode character twice.
+*/
break;
default:
con->cursor_column++;
-- 
2.14.2

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


[U-Boot] [PATCH 0/2] efi_loader: updating the cursor position

2018-04-29 Thread Heinrich Schuchardt
The current updating of the cursor position does not conform with the
UEFI spec.

The current coding advances the column by the number of UTF-8 bytes.
The column should be increased by one per unicode character.

The UEFI spec provides advance rules for U+, U+0008, U+000A,
and U000D. All other characters, including control characters
U+0007 (bel) and U+0009 (tab), have to increase the column by one.

The patch series adjusts the column update and provides unit testing.

Heinrich Schuchardt (2):
  efi_loader: updating the cursor position
  efi_selftest: updating the cursor position

 lib/efi_loader/efi_console.c   | 27 ---
 lib/efi_selftest/efi_selftest_textoutput.c | 78 ++
 2 files changed, 97 insertions(+), 8 deletions(-)

-- 
2.14.2

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


[U-Boot] [PATCH v3 6/7] bootcount: display5: spl: Extend DISPLAY5 board SPL to support bootcount checking

2018-04-29 Thread Lukasz Majewski
This patch is necessary for providing basic bootcount checking in the case
of using "falcon" boot mode in that board.

It forces u-boot proper boot, when we exceed the number of errors.

Signed-off-by: Lukasz Majewski 
Reviewed-by: Stefan Roese 

---

Changes in v3:
- The bootcount_error now accepts enum bootcount_error input parameter

Changes in v2:
- Remove bootcount_init() from SPL specific board code

 board/liebherr/display5/spl.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c
index 437963e225..147ea62683 100644
--- a/board/liebherr/display5/spl.c
+++ b/board/liebherr/display5/spl.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -214,7 +215,7 @@ void board_boot_order(u32 *spl_boot_list)
env_load();
 
s = env_get("BOOT_FROM");
-   if (s && strcmp(s, "ACTIVE") == 0) {
+   if (s && !bootcount_error(SPL) && strcmp(s, "ACTIVE") == 0) {
spl_boot_list[0] = BOOT_DEVICE_MMC1;
spl_boot_list[1] = spl_boot_device();
}
-- 
2.11.0

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


[U-Boot] [PATCH v3 4/7] bootcount: Rewrite autoboot to use wrapper functions from bootcount.h

2018-04-29 Thread Lukasz Majewski
The code has been refactored to use common wrappers from bootcount.h
header.

Signed-off-by: Lukasz Majewski 

---

Changes in v3:
- New patch

Changes in v2:
- None

 common/autoboot.c | 23 +--
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/common/autoboot.c b/common/autoboot.c
index 2eef7a04cc..bfe4bdcf50 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -291,18 +292,8 @@ const char *bootdelay_process(void)
 {
char *s;
int bootdelay;
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-   unsigned long bootcount = 0;
-   unsigned long bootlimit = 0;
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
-
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-   bootcount = bootcount_load();
-   bootcount++;
-   bootcount_store(bootcount);
-   env_set_ulong("bootcount", bootcount);
-   bootlimit = env_get_ulong("bootlimit", 10, 0);
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
+
+   bootcount_inc(UBOOT);
 
s = env_get("bootdelay");
bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
@@ -324,13 +315,9 @@ const char *bootdelay_process(void)
s = env_get("failbootcmd");
} else
 #endif /* CONFIG_POST */
-#ifdef CONFIG_BOOTCOUNT_LIMIT
-   if (bootlimit && (bootcount > bootlimit)) {
-   printf("Warning: Bootlimit (%u) exceeded. Using altbootcmd.\n",
-  (unsigned)bootlimit);
+   if (bootcount_error(UBOOT))
s = env_get("altbootcmd");
-   } else
-#endif /* CONFIG_BOOTCOUNT_LIMIT */
+   else
s = env_get("bootcmd");
 
process_fdt_options(gd->fdt_blob);
-- 
2.11.0

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


[U-Boot] [PATCH v3 5/7] bootcount: spl: Extend SPL to support bootcount incrementation

2018-04-29 Thread Lukasz Majewski
This patch adds support for incrementation of the bootcount in SPL.
Such feature is necessary when we do want to use this feature with
'falcon' boot mode (which loads OS directly in SPL).

Signed-off-by: Lukasz Majewski 

---

Changes in v3:
- Remove not needed #ifdefs
- Add enum bootcount_context parameter to bootcount_inc() function

Changes in v2:
- New patch - as suggested by Stefan Roese - bootcount_inc() is called
  in common SPL code (./common/spl/spl.c), so other boards can also
  reuse it without modification

 common/spl/spl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 61d3071324..2d10c84296 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -417,6 +418,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
spl_board_init();
 #endif
 
+   bootcount_inc(SPL);
+
memset(_image, '\0', sizeof(spl_image));
 #ifdef CONFIG_SYS_SPL_ARGS_ADDR
spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;
-- 
2.11.0

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


[U-Boot] [PATCH v3 7/7] bootcount: display5: config: Enable boot count feature in the display5 board

2018-04-29 Thread Lukasz Majewski
The boot count is enabled in both SPL and proper u-boot.

Signed-off-by: Lukasz Majewski 
Reviewed-by: Stefan Roese 

---

Changes in v3:
- None

Changes in v2:
- None

 configs/display5_defconfig | 4 
 1 file changed, 4 insertions(+)

diff --git a/configs/display5_defconfig b/configs/display5_defconfig
index a5f1cf1e92..6a2408260f 100644
--- a/configs/display5_defconfig
+++ b/configs/display5_defconfig
@@ -16,6 +16,7 @@ CONFIG_SPL_LOAD_FIT=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6Q"
 CONFIG_SUPPORT_RAW_INITRD=y
+CONFIG_SPL_BOOTCOUNT_LIMIT=y
 # CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR is not set
 CONFIG_SPL_DMA_SUPPORT=y
 CONFIG_SPL_ENV_SUPPORT=y
@@ -53,6 +54,9 @@ CONFIG_EFI_PARTITION=y
 CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_SPI_FLASH=y
 CONFIG_FSL_ESDHC=y
+CONFIG_BOOTCOUNT_LIMIT=y
+CONFIG_SYS_BOOTCOUNT_SINGLEWORD=y
+CONFIG_SYS_BOOTCOUNT_ADDR=0x020CC068
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_BAR=y
 CONFIG_SPI_FLASH_SPANSION=y
-- 
2.11.0

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


[U-Boot] [PATCH v3 3/7] bootcount: Add function wrappers to handle bootcount increment and error checking

2018-04-29 Thread Lukasz Majewski
Those two functions can be used to provide easy bootcount management.

Signed-off-by: Lukasz Majewski 

---

Changes in v3:
- Unify those functions to also work with common/autoboot.c code
- Add enum bootcount_context to distinguish between u-boot proper and SPL

Changes in v2:
- None

 include/bootcount.h | 50 ++
 1 file changed, 50 insertions(+)

diff --git a/include/bootcount.h b/include/bootcount.h
index e3b3f7028e..16fc657b2a 100644
--- a/include/bootcount.h
+++ b/include/bootcount.h
@@ -11,6 +11,13 @@
 #include 
 #include 
 
+enum bootcount_context {
+   SPL = 1,
+   UBOOT,
+};
+
+#if defined CONFIG_SPL_BOOTCOUNT_LIMIT || defined CONFIG_BOOTCOUNT_LIMIT
+
 #if !defined(CONFIG_SYS_BOOTCOUNT_LE) && !defined(CONFIG_SYS_BOOTCOUNT_BE)
 # if __BYTE_ORDER == __LITTLE_ENDIAN
 #  define CONFIG_SYS_BOOTCOUNT_LE
@@ -40,4 +47,47 @@ static inline u32 raw_bootcount_load(volatile u32 *addr)
return in_be32(addr);
 }
 #endif
+
+static inline int bootcount_error(enum bootcount_context bc)
+{
+   unsigned long bootcount = bootcount_load();
+   unsigned long bootlimit = env_get_ulong("bootlimit", 10, 0);
+
+   if (bootlimit && bootcount > bootlimit) {
+   printf("Warning: Bootlimit (%lu) exceeded.", bootlimit);
+   if (bc == UBOOT)
+   printf(" Using altbootcmd.");
+   printf("\n");
+
+   return 1;
+   }
+
+   return 0;
+}
+
+static inline void bootcount_inc(enum bootcount_context bc)
+{
+   unsigned long bootcount = bootcount_load();
+
+   if (bc == SPL) {
+   bootcount_store(++bootcount);
+   return;
+   }
+
+   /* Only increment bootcount when no bootcount support in SPL */
+#ifndef CONFIG_SPL_BOOTCOUNT_LIMIT
+   bootcount++;
+#endif
+   bootcount_store(bootcount);
+   env_set_ulong("bootcount", bootcount);
+}
+
+#if defined CONFIG_SPL_BUILD && !defined CONFIG_SPL_BOOTCOUNT_LIMIT
+void bootcount_store(ulong a) {};
+ulong bootcount_load(void) { return 0; }
+#endif /* CONFIG_SPL_BUILD && !CONFIG_SPL_BOOTCOUNT_LIMIT */
+#else
+static inline int bootcount_error(enum bootcount_context bc) { return 0; }
+static inline void bootcount_inc(enum bootcount_context bc) {}
+#endif /* CONFIG_SPL_BOOTCOUNT_LIMIT || CONFIG_BOOTCOUNT_LIMIT */
 #endif /* _BOOTCOUNT_H__ */
-- 
2.11.0

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


[U-Boot] [PATCH v3 2/7] bootcount: Add include guards into bootcount.h file

2018-04-29 Thread Lukasz Majewski
This patch adds missing include guards for bootcount.h file.

Signed-off-by: Lukasz Majewski 
Reviewed-by: Stefan Roese 

---

Changes in v3:
- None

Changes in v2:
- New patch

 include/bootcount.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/bootcount.h b/include/bootcount.h
index 06fb4d3578..e3b3f7028e 100644
--- a/include/bootcount.h
+++ b/include/bootcount.h
@@ -4,6 +4,8 @@
  *
  * SPDX-License-Identifier:GPL-2.0+
  */
+#ifndef _BOOTCOUNT_H__
+#define _BOOTCOUNT_H__
 
 #include 
 #include 
@@ -38,3 +40,4 @@ static inline u32 raw_bootcount_load(volatile u32 *addr)
return in_be32(addr);
 }
 #endif
+#endif /* _BOOTCOUNT_H__ */
-- 
2.11.0

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


[U-Boot] [PATCH v3 1/7] bootcount: spl: Enable bootcount support in SPL

2018-04-29 Thread Lukasz Majewski
New, SPL related config option - CONFIG_SPL_BOOTCOUNT_LIMIT has been
added to allow drivers/bootcount code re-usage in SPL.

This code is necessary to use and setup bootcount in SPL in the case of
falcon boot mode.

Signed-off-by: Lukasz Majewski 
Reviewed-by: Stefan Roese 


---

Changes in v3:
- None

Changes in v2:
- None

 common/spl/Kconfig | 9 +
 drivers/Makefile   | 1 +
 2 files changed, 10 insertions(+)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 4d27565566..2a61d2364b 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -54,6 +54,15 @@ config SPL_BOOTROM_SUPPORT
  BOOT_DEVICE_BOOTROM (or fall-through to the next boot device in the
  boot device list, if not implemented for a given board)
 
+config SPL_BOOTCOUNT_LIMIT
+   bool "Support bootcount in SPL"
+   depends on SPL_ENV_SUPPORT
+   help
+ On some boards, which use 'falcon' mode, it is necessary to check
+ and increment the number of boot attempts. Such boards do not
+ use proper U-Boot for normal boot flow and hence needs those
+ adjustments to be done in the SPL.
+
 config SPL_RAW_IMAGE_SUPPORT
bool "Support SPL loading and booting of RAW images"
default n if (ARCH_MX6 && (SPL_MMC_SUPPORT || SPL_SATA_SUPPORT))
diff --git a/drivers/Makefile b/drivers/Makefile
index 6846d181aa..061331eadd 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_$(SPL_TPL_)TIMER) += timer/
 ifndef CONFIG_TPL_BUILD
 ifdef CONFIG_SPL_BUILD
 
+obj-$(CONFIG_SPL_BOOTCOUNT_LIMIT) += bootcount/
 obj-$(CONFIG_SPL_CPU_SUPPORT) += cpu/
 obj-$(CONFIG_SPL_CRYPTO_SUPPORT) += crypto/
 obj-$(CONFIG_SPL_GPIO_SUPPORT) += gpio/
-- 
2.11.0

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


[U-Boot] [PATCH v3 0/7] Provide SPL support for bootcount (in the case of using falcon boot mode)

2018-04-29 Thread Lukasz Majewski
This patch series provides support for controlling bootcount limits in SPL.
Moreover, the common code has been identified and reused in the
common/autoboot.c file.
It also enables this feature on display5 board to present usage patterns.

This patch has been applied on top of u-boot/master:
SHA1 : ec37f05ec0a999e0bd79f87354716df6f9bc074d

Test HW: Beagle Bone Black (am335x) , Display5 (imx6q)
Travis-Ci: https://travis-ci.org/lmajewski/u-boot-dfu/builds/372217887

Lukasz Majewski (7):
  bootcount: spl: Enable bootcount support in SPL
  bootcount: Add include guards into bootcount.h file
  bootcount: Add function wrappers to handle bootcount increment and
error checking
  bootcount: Rewrite autoboot to use wrapper functions from bootcount.h
  bootcount: spl: Extend SPL to support bootcount incrementation
  bootcount: display5: spl: Extend DISPLAY5 board SPL to support
bootcount checking
  bootcount: display5: config: Enable boot count feature in the display5
board

 board/liebherr/display5/spl.c |  3 ++-
 common/autoboot.c | 23 ---
 common/spl/Kconfig|  9 
 common/spl/spl.c  |  3 +++
 configs/display5_defconfig|  4 
 drivers/Makefile  |  1 +
 include/bootcount.h   | 53 +++
 7 files changed, 77 insertions(+), 19 deletions(-)

-- 
2.11.0

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


Re: [U-Boot] [PATCH 1/1] arm: armv7: enable unaligned access

2018-04-29 Thread Heinrich Schuchardt
On 03/30/2018 02:00 AM, Heinrich Schuchardt wrote:
> On 03/30/2018 01:36 AM, Siarhei Siamashka wrote:
>> On Thu, 29 Mar 2018 23:33:50 +0200
>> Heinrich Schuchardt  wrote:
>>
>>> We use the command bootefi to run UEFI executables like GRUB and iPXE.
>>> The UEFI spec requires that unaligned access is enabled if the CPU
>>> supports it. This is true for armv7.
>>>
>>> So we should not set bit 1 of the system control register, the alignment
>>> bit.
>>>
>>> Without this patch iPXE snp.efi cannot be executed on the Allwinner A20.
>>>
>>> Signed-off-by: Heinrich Schuchardt 
>>> ---
>>>  arch/arm/cpu/armv7/start.S | 1 -
>>>  1 file changed, 1 deletion(-)
>>>
>>> diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
>>> index 7e2695761e..1771741119 100644
>>> --- a/arch/arm/cpu/armv7/start.S
>>> +++ b/arch/arm/cpu/armv7/start.S
>>> @@ -150,7 +150,6 @@ ENTRY(cpu_init_cp15)
>>> mrc p15, 0, r0, c1, c0, 0
>>> bic r0, r0, #0x2000 @ clear bits 13 (--V-)
>>> bic r0, r0, #0x0007 @ clear bits 2:0 (-CAM)
>>> -   orr r0, r0, #0x0002 @ set bit 1 (--A-) Align
>>> orr r0, r0, #0x0800 @ set bit 11 (Z---) BTB
>>>  #ifdef CONFIG_SYS_ICACHE_OFF
>>> bic r0, r0, #0x1000 @ clear bit 12 (I) I-cache
>>
>> Can you postpone flipping this bit until the very moment when you
>> are about to start your UEFI executable?
>>
>> The main reason against setting this bit for the whole U-Boot
>> globally is that a lot of common code in U-Boot can be run on
>> different CPU architectures, including those which don't
>> support unaligned memory accesses (ARMv5, MIPS, ...). This
>> is a maintenance nightmare. Because the people, who test their
>> patches only on ARMv7 hardware, will unintentionally keep
>> breaking other architectures.
>>
> 
> Hello Siarhei,
> 
> we could clear the bit when the bootefi command is invoked.
> 
> Best regards
> 
> Heinrich
> 
> 

Hello Albert,

in his mail
https://lists.denx.de/pipermail/u-boot/2018-April/324719.html
Alexander Graf wrote that in his view using this patch as is the
preferable way to ensure that unaligned access is available to EFI binaries.

What is your view?

Best regards

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