Re: [U-Boot] [PATCH] sunxi: move CONFIG_SYS_TEXT_BASE out of defconfigs

2018-02-18 Thread Maxime Ripard
On Mon, Feb 19, 2018 at 01:44:06AM +, Andre Przywara wrote:
> Commit 278b90ce786f ("configs: Migrate CONFIG_SYS_TEXT_BASE") made
> CONFIG_SYS_TEXT_BASE a proper Kconfig variable, with the consequence
> of moving the common definition shared by almost every sunxi board
> into 123 individual defconfig files. But the U-Boot start address
> for Allwinner boards is a platform decision which has been around for
> ages, so defining it in each *board* config file seems a bit over the
> top.
> Define the standard value (160MB into DRAM) if ARCH_SUNXI is selected,
> and delete the lines from the individual defconfigs.
> This leaves the few exceptions (three A80 boards and the LicheePi Zero)
> alone, their defconfig value simply overrides the default.
> 
> Signed-off-by: Andre Przywara 

Acked-by: Maxime Ripard 

Thanks!
Maxime

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


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


[U-Boot] [PATCH] rockchip: add text_offset to kernel_addr_r on aarch64 platforms

2018-02-18 Thread Klaus Goger
Booting a aarch64 Linux kernel requires the image to be placed
text_offset bytes from a 2MB aligned address.
See https://www.kernel.org/doc/Documentation/arm64/booting.txt

booti_setup() takes care about this alignment and will relocate the
image if not properly aligned with memmove(). This can require up
to double the size of the loaded image and therefore accidentally
overwrite content placed there (i.e ramdisk_addr_r) for large kernel
images.

By adding text_offset to the default kernel_addr_r we can prevent that
from happening for kernels larger 18MB and also save a few cycles.

We can assume a text_offset of 0x8 for most cases, all others will be
handled by booti_setup() anyway.

Signed-off-by: Klaus Goger 

---

 include/configs/rk3328_common.h | 2 +-
 include/configs/rk3399_common.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/rk3328_common.h b/include/configs/rk3328_common.h
index 7018668e00..517d058a11 100644
--- a/include/configs/rk3328_common.h
+++ b/include/configs/rk3328_common.h
@@ -42,7 +42,7 @@
"scriptaddr=0x0050\0" \
"pxefile_addr_r=0x0060\0" \
"fdt_addr_r=0x01f0\0" \
-   "kernel_addr_r=0x0200\0" \
+   "kernel_addr_r=0x0208\0" \
"ramdisk_addr_r=0x0400\0"
 
 #include 
diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index d700bf2549..8582252dc3 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -53,7 +53,7 @@
"scriptaddr=0x0050\0" \
"pxefile_addr_r=0x0060\0" \
"fdt_addr_r=0x01f0\0" \
-   "kernel_addr_r=0x0200\0" \
+   "kernel_addr_r=0x0208\0" \
"ramdisk_addr_r=0x0400\0"
 
 #include 
-- 
2.11.0

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


Re: [U-Boot] Crash observed while running U-Boot on LS1088 SD-boot

2018-02-18 Thread Ashish Kumar
Hello York,

This fixes the crash on LS1088 sd-boot.

Regards
Ashish 

> -Original Message-
> From: York Sun
> Sent: Friday, February 16, 2018 9:21 PM
> To: Ashish Kumar ; u-boot@lists.denx.de
> Cc: Pankit Garg ; Maxime Ripard
> 
> Subject: Re: Crash observed while running U-Boot on LS1088 SD-boot
> 
> Ashish,
> 
> Please check if this fixes it https://patchwork.ozlabs.org/patch/870653/
> 
> York
> 
> On 02/16/2018 02:57 AM, Ashish Kumar wrote:
> > Hello all,
> >
> > I am seeing u-boot crash, while I run the latest u-boot on LS1088 for SD-
> Boot(ls1088aqds_sdcard_qspi_defconfig).
> > There were some changes related to passing env-parameters introduced by
> commit
> > "8a3a7e2270b39f14c1778a574bb815068d8c74d4 env: Pass additional
> parameters to the env lookup function".
> >
> > Did anyone face similar issue?
> > I reached this commit("8a3a7e22") after running git bisect.
> >
> > Log embedded in below mail chain.
> >
> > Regards
> > Ashish
> >> -Original Message-
> >> From: Ashish Kumar
> >> Sent: Thursday, February 8, 2018 3:51 PM
> >> To: Maxime Ripard ; York Sun
> >> 
> >> Cc: Pankit Garg 
> >> Subject: RE: Crash observed while running Uboot
> >>
> >> Hello York, Maxime,
> >>
> >> I am seeing this u-boot crash on top of the tree of denx.de.
> >> After running git bisect, I found this commit
> >> "8a3a7e2270b39f14c1778a574bb815068d8c74d4 env: Pass additional
> >> " introduces it. Any idea how to fix?
> >>
> >> Logs below:
> >> U-Boot 2018.03-rc1-00185-g9b2cfe2 (Feb 08 2018 - 15:45:34 +0530)
> >>
> >> SoC:  LS1088AE Rev1.0 (0x87030010)
> >> Clock Configuration:
> >>CPU0(A53):1600 MHz  CPU1(A53):1600 MHz  CPU2(A53):1600 MHz
> >>CPU3(A53):1600 MHz  CPU4(A53):1600 MHz  CPU5(A53):1600 MHz
> >>CPU6(A53):1600 MHz  CPU7(A53):1600 MHz
> >>Bus:  700  MHz  DDR:  2100 MT/s
> >> Reset Configuration Word (RCW):
> >>: 4000541c 0040  
> >>0010:  000a 0030 
> >>0020: 01001150 2580  0040
> >>0030: 0c5b   
> >>0040:    
> >>0050:    
> >>0060:   0011 09e7
> >>0070: 4411 9555
> >> I2C:   ready
> >> DRAM:  Initializing DDRusing SPD
> >> Detected UDIMM 18ASF1G72AZ-2G1A1
> >> 7.9 GiB
> >> DDR7.9 GiB (DDR4, 64-bit, CL=15, ECC on)
> >> FSL_SDHC: 0
> >> SEC Firmware: config-1: no such config SEC Firmware: error (-2) SEC
> >> Firmware: Failed to load image
> >> WARN: pls set popts->cpo_sample = 0x6a in /ddr.c to optimize
> >> cpo Waking secondary cores to start from fbd51000 All (8) cores are up.
> >> Using SERDES1 Protocol: 29 (0x1d)
> >> Using SERDES2 Protocol: 13 (0xd)
> >> NAND:  0 MiB
> >> MMC:   Loading Environment from MMC... OK
> >> EEPROM: Invalid ID (ff ff ff ff)
> >> In:serial
> >> Out:   serial
> >> Err:   serial
> >> Model: NXP Layerscape 1088a QDS Board
> >> Board: LS1088A-QDS, Board Arch: V1, Board version: B, boot from SD
> >> card
> >> vBank: 0
> >> FPGA: v6 (LS1088AQDS_2016_0818_1311), build 75 on Thu Aug 18 18:11:20
> >> 2016
> >> SERDES1 Reference : Clock1 = 100MHz Clock2 = 156.25MHz
> >> SERDES2 Reference : Clock1 = 100MHz Clock2 = 100MHz SATA link 0 timeout.
> >> AHCI 0001.0301 32 slots 1 ports 6 Gbps 0x1 impl SATA mode
> >> flags: 64bit ncq pm clo only pmp fbss pio slum part ccc apst Found 0 
> >> device(s).
> >> SCSI:  Net:   qds: WRIOP: Supported SerDes1 Protocol 0x1d
> >> PCIe0: pcie@340 Root Complex: no link
> >> PCIe1: pcie@350 Root Complex: no link
> >> PCIe2: pcie@360 Root Complex: x1 gen1
> >> e1000: 00:1b:21:39:30:86
> >>DPMAC1@xgmii
> >> Warning: DPMAC1@xgmii (eth0) using random MAC address -
> >> fe:89:69:1c:38:4f , DPMAC2@xgmii
> >> Warning: DPMAC2@xgmii (eth1) using random MAC address -
> >> 96:82:07:2f:7f:b0 , DPMAC3@qsgmii
> >> Warning: DPMAC3@qsgmii (eth2) using random MAC address -
> >> 92:ba:99:eb:1b:fd , DPMAC4@qsgmii
> >> Warning: DPMAC4@qsgmii (eth3) using random MAC address -
> >> fa:b1:f7:d8:5c:02 , DPMAC5@qsgmii
> >> Warning: DPMAC5@qsgmii (eth4) using random MAC address -
> >> c2:ea:0a:78:b5:0a , DPMAC6@qsgmii
> >> Warning: DPMAC6@qsgmii (eth5) using random MAC address -
> >> ca:e2:23:02:39:06 , DPMAC7@qsgmii
> >> Warning: DPMAC7@qsgmii (eth6) using random MAC address -
> >> 92:1f:76:1e:82:97 , DPMAC8@qsgmii
> >> Warning: DPMAC8@qsgmii (eth7) using random MAC address -
> >> 9a:17:5f:64:0e:9b , DPMAC9@qsgmii
> >> Warning: DPMAC9@qsgmii (eth8) using random MAC address -
> >> a2:4c:a2:c4:e7:93 , DPMAC10@qsgmii
> >> Warning: DPMAC10@qsgmii (eth9) using random MAC address -
> >> aa:44:8b:be:6b:9f , e1000#0 [PRIME]
> >> Device: FSL_SDHC
> >> Manufacturer ID: 74
> >> OEM: 4a45
> >> 

[U-Boot] [PATCH] configs: clearfog: enable random random MAC address

2018-02-18 Thread Baruch Siach
This makes the network devices usable when booting a blank board over
UART, with no pre-configured MAC address stored in the environment area.

Signed-off-by: Baruch Siach 
---
 configs/clearfog_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig
index a5ed3b20a63a..e2f1b635152f 100644
--- a/configs/clearfog_defconfig
+++ b/configs/clearfog_defconfig
@@ -30,6 +30,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 # CONFIG_SPL_PARTITION_UUIDS is not set
 CONFIG_ENV_IS_IN_MMC=y
+CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_OF_TRANSLATE=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_SDMA=y
-- 
2.16.1

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


Re: [U-Boot] [PATCH v2] env: mmc/fat/ext4: make sure that the MMC sub-system is initialized before using it

2018-02-18 Thread Faiz Abbas
Hi,

On Monday 12 February 2018 07:24 PM, Faiz Abbas wrote:
> When booting from a non-MMC device, the MMC sub-system may not be
> initialized when the environment is first accessed.
> We need to make sure that the MMC sub-system is ready in even a non-MMC
> boot case.
> 
> Therefore, initialize mmc before loading environment from it.
> 
> Signed-off-by: Faiz Abbas 
> ---
> Dropped Lukasz's Reviewed-by because patch has
> changed.
> 
> I have tested this with ENV_IS_IN_FAT and ENV_IS_IN_MMC.
> 
>  env/ext4.c | 3 +++
>  env/fat.c  | 3 +++
>  env/mmc.c  | 2 ++
>  3 files changed, 8 insertions(+)
> 
> diff --git a/env/ext4.c b/env/ext4.c
> index 3f3aac5..6c69a0a 100644
> --- a/env/ext4.c
> +++ b/env/ext4.c
> @@ -87,6 +87,9 @@ static int env_ext4_load(void)
>   int err;
>   loff_t off;
>  
> + if (!strcmp(CONFIG_ENV_EXT4_INTERFACE, "mmc"))
> + mmc_initialize(NULL);
> +
>   part = blk_get_device_part_str(CONFIG_ENV_EXT4_INTERFACE,
>  CONFIG_ENV_EXT4_DEVICE_AND_PART,
>  _desc, , 1);
> diff --git a/env/fat.c b/env/fat.c
> index 35f7ab5..fdf4b7a 100644
> --- a/env/fat.c
> +++ b/env/fat.c
> @@ -89,6 +89,9 @@ static int env_fat_load(void)
>   int dev, part;
>   int err;
>  
> + if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc"))
> + mmc_initialize(NULL);
> +
>   part = blk_get_device_part_str(CONFIG_ENV_FAT_INTERFACE,
>   CONFIG_ENV_FAT_DEVICE_AND_PART,
>   _desc, , 1);
> diff --git a/env/mmc.c b/env/mmc.c
> index 1058b8c..6f11dec 100644
> --- a/env/mmc.c
> +++ b/env/mmc.c
> @@ -273,6 +273,8 @@ static int env_mmc_load(void)
>   ALLOC_CACHE_ALIGN_BUFFER(env_t, tmp_env1, 1);
>   ALLOC_CACHE_ALIGN_BUFFER(env_t, tmp_env2, 1);
>  
> + mmc_initialize(NULL);
> +
>   mmc = find_mmc_device(dev);
>  
>   errmsg = init_mmc_for_env(mmc);
> 

Gentle ping.

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


Re: [U-Boot] [PATCH] mmc: Drop unnecessary case for mmc_probe()

2018-02-18 Thread Faiz Abbas
Hi,

On Monday 12 February 2018 07:35 PM, Faiz Abbas wrote:
> Drop the unnecessary empty function case for mmc_probe().
> 
> Signed-off-by: Faiz Abbas 
> ---
>  drivers/mmc/mmc.c | 7 +--
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 255310a..e0b9a42 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -2657,12 +2657,7 @@ void mmc_set_preinit(struct mmc *mmc, int preinit)
>   mmc->preinit = preinit;
>  }
>  
> -#if CONFIG_IS_ENABLED(DM_MMC) && defined(CONFIG_SPL_BUILD)
> -static int mmc_probe(bd_t *bis)
> -{
> - return 0;
> -}
> -#elif CONFIG_IS_ENABLED(DM_MMC)
> +#if CONFIG_IS_ENABLED(DM_MMC)
>  static int mmc_probe(bd_t *bis)
>  {
>   int ret, i;
> 

Gentle ping.

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


Re: [U-Boot] [PATCH 4/5] sh: Do not provide strncmp

2018-02-18 Thread Marek Vasut
On 02/17/2018 11:30 PM, Tom Rini wrote:
> With modern GCC, we get warnings such as:
> cmd/jffs2.c: In function 'mtdparts_init':
> arch/sh/include/asm/string.h:110:38:
> warning: array subscript is above array bounds [-Warray-bounds]
>: "0" (__cs), "1" (__ct), "r" (__cs+__n)
>   ^~~~
> 
> This results in a small size reduction as well.
> 
> Cc: Nobuhiro Iwamatsu 
> Signed-off-by: Tom Rini 
> ---
>  arch/sh/include/asm/string.h | 33 ++---
>  1 file changed, 2 insertions(+), 31 deletions(-)
> 
> diff --git a/arch/sh/include/asm/string.h b/arch/sh/include/asm/string.h
> index 27d981b79af8..999febcb6b7d 100644
> --- a/arch/sh/include/asm/string.h
> +++ b/arch/sh/include/asm/string.h
> @@ -81,37 +81,8 @@ static inline int strcmp(const char *__cs, const char 
> *__ct)
>   return __res;
>  }
>  
> -#define __HAVE_ARCH_STRNCMP
> -static inline int strncmp(const char *__cs, const char *__ct, size_t __n)
> -{
> - register int __res;
> - unsigned long __dummy;
> -
> - if (__n == 0)
> - return 0;
> -
> - __asm__ __volatile__(
> - "mov.b  @%1+, %3\n"
> - "1:\n\t"
> - "mov.b  @%0+, %2\n\t"
> - "cmp/eq %6, %0\n\t"
> - "bt/s   2f\n\t"
> - " cmp/eq #0, %3\n\t"
> - "bt/s   3f\n\t"
> - " cmp/eq %3, %2\n\t"
> - "bt/s   1b\n\t"
> - " mov.b @%1+, %3\n\t"
> - "add#-2, %1\n\t"
> - "mov.b  @%1, %3\n"
> - "2:\n\t"
> - "sub%3, %2\n"
> - "3:"
> - :"=r" (__cs), "=r" (__ct), "=" (__res), "=" (__dummy)
> - : "0" (__cs), "1" (__ct), "r" (__cs+__n)
> - : "t");
> -
> - return __res;
> -}
> +#undef __HAVE_ARCH_STRNCMP
> +extern int strncmp(const char *__cs, const char *__ct, size_t __n);
>  
>  #undef __HAVE_ARCH_MEMSET
>  extern void *memset(void *__s, int __c, size_t __count);
> 
Applied, thanks

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


Re: [U-Boot] [PATCH 2/5] travis-ci: Enable more SH to be tested

2018-02-18 Thread Marek Vasut
On 02/17/2018 11:30 PM, Tom Rini wrote:
> With the switch to newer toolchains from kernel.org we can now fetch an
> sh2 toolchain that will build for sh2/3/4, so switch to that.
> 
> Signed-off-by: Tom Rini 
> ---
>  .travis.yml | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/.travis.yml b/.travis.yml
> index 7b53b3dddc1b..a67d3c3dbab6 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -38,7 +38,7 @@ install:
>   - echo -e "aarch64 = 
> /tmp/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu" >> ~/.buildman
>   - echo -e "arm = /tmp/gcc-linaro-6.3.1-2017.02-x86_64_arm-linux-gnueabihf" 
> >> ~/.buildman
>   - echo -e "arc = 
> /tmp/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install" >> ~/.buildman
> - - echo -e "\n[toolchain-alias]\nsh = sh4\nopenrisc = or32" >> ~/.buildman
> + - echo -e "\n[toolchain-alias]\nsh = sh2\nopenrisc = or32" >> ~/.buildman
>   - cat ~/.buildman
>   - virtualenv /tmp/venv
>   - . /tmp/venv/bin/activate
> @@ -63,7 +63,7 @@ before_script:
>- if [[ "${TOOLCHAIN}" == *microblaze* ]]; then ./tools/buildman/buildman 
> --fetch-arch microblaze ; fi
>- if [[ "${TOOLCHAIN}" == *mips* ]]; then ./tools/buildman/buildman 
> --fetch-arch mips ; fi
>- if [[ "${TOOLCHAIN}" == *or32* ]]; then ./tools/buildman/buildman 
> --fetch-arch or32 ; fi
> -  - if [[ "${TOOLCHAIN}" == *sh4* ]]; then ./tools/buildman/buildman 
> --fetch-arch sh4 ; fi
> +  - if [[ "${TOOLCHAIN}" == *sh* ]]; then ./tools/buildman/buildman 
> --fetch-arch sh2 ; fi
>- if [[ "${TOOLCHAIN}" == *x86_64* ]]; then
>./tools/buildman/buildman --fetch-arch x86_64;
>echo -e "\n[toolchain-prefix]\nx86 = 
> ${HOME}/.buildman-toolchains/gcc-4.9.0-nolibc/x86_64-linux/bin/x86_64-linux-" 
> >> ~/.buildman;
> @@ -268,8 +268,8 @@ matrix:
>  - env:
>  - BUILDMAN="rockchip"
>  - env:
> -- BUILDMAN="sh4"
> -  TOOLCHAIN="sh4"
> +- BUILDMAN="sh"
> +  TOOLCHAIN="sh"
>  - env:
>  - JOB="Xilinx (ARM)"
>BUILDMAN="xilinx -x microblaze"
> 
Applied, thanks

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


Re: [U-Boot] [PATCH 3/5] net: sh_eth: Fix unused variable warnings

2018-02-18 Thread Marek Vasut
On 02/17/2018 11:30 PM, Tom Rini wrote:
> With a newer toolchain we can see that in both sh_eth_phy_config_legacy
> and sh_eth_recv_common the variable port is never referenced as
> eth->port is always used instead.
> 
> Cc: Joe Hershberger 
> Signed-off-by: Tom Rini 
> ---
>  drivers/net/sh_eth.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
> index 850fe1587f59..6f48e93ab53d 100644
> --- a/drivers/net/sh_eth.c
> +++ b/drivers/net/sh_eth.c
> @@ -517,7 +517,7 @@ static int sh_eth_start_common(struct sh_eth_dev *eth)
>  #ifndef CONFIG_DM_ETH
>  static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth)
>  {
> - int port = eth->port, ret = 0;
> + int ret = 0;
>   struct sh_eth_info *port_info = >port_info[eth->port];
>   struct eth_device *dev = port_info->dev;
>   struct phy_device *phydev;
> @@ -540,7 +540,7 @@ static int sh_eth_send_legacy(struct eth_device *dev, 
> void *packet, int len)
>  
>  static int sh_eth_recv_common(struct sh_eth_dev *eth)
>  {
> - int port = eth->port, len = 0;
> + int len = 0;
>   struct sh_eth_info *port_info = >port_info[eth->port];
>   uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2);
>  
> 
This should be fixed in the PR I sent too.

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


Re: [U-Boot] [PATCH 1/5] sh: Use -m2a-nofpu only

2018-02-18 Thread Marek Vasut
On 02/17/2018 11:30 PM, Tom Rini wrote:
> Based on reading over the GCC manual, passing both -m2a and -m2a-nofpu
> are redundant, as -m2a-nofpu will provide functional code for both.  As
> -m2a-nofpu functions with more toolchains and does what is expected,
> switch.
> 
> Cc: Nobuhiro Iwamatsu 
> Signed-off-by: Tom Rini 
> ---
>  arch/sh/cpu/sh2/config.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/sh/cpu/sh2/config.mk b/arch/sh/cpu/sh2/config.mk
> index 12e202d539a0..a063e8361c98 100644
> --- a/arch/sh/cpu/sh2/config.mk
> +++ b/arch/sh/cpu/sh2/config.mk
> @@ -8,7 +8,7 @@
>  ENDIANNESS += -EB
>  
>  ifdef CONFIG_CPU_SH2A
> -PLATFORM_CPPFLAGS += -m2a -m2a-nofpu -mb
> +PLATFORM_CPPFLAGS += -m2a-nofpu -mb
>  else # SH2
>  PLATFORM_CPPFLAGS += -m3e -mb
>  endif
> 
Applied, thanks.

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


Re: [U-Boot] [GIT] Pull request: u-boot-dfu (18.02.2018)

2018-02-18 Thread Marek Vasut
On 02/18/2018 08:52 PM, Lukasz Majewski wrote:
> Dear Marek,
> 
> Please find some cosmetic changes and warning fixes for sdp gadget.

Pulled, thanks.


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


[U-Boot] [PULL] u-boot-sh/master

2018-02-18 Thread Marek Vasut
The following changes since commit 02b0895c215e252cff50d9edf53a972d2bbbfd30:

  Merge git://git.denx.de/u-boot-sh (2018-02-17 16:06:59 -0500)

are available in the Git repository at:

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

for you to fetch changes up to 5abcbd7847cf7ea87744bfedaaf0b4a6b99e7b02:

  net: sh_eth: Fix DT base address fetching (2018-02-18 11:20:18 +0100)


Marek Vasut (4):
  net: sh_eth: Zap port variable
  net: sh_eth: Return directly from sh_eth_recv_start
  net: sh_eth: Fix checkpatch warning
  net: sh_eth: Fix DT base address fetching

 drivers/net/sh_eth.c | 53
+
 1 file changed, 21 insertions(+), 32 deletions(-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [linux-sunxi] [PATCH] sunxi: move CONFIG_SYS_TEXT_BASE out of defconfigs

2018-02-18 Thread Chen-Yu Tsai
On Mon, Feb 19, 2018 at 9:44 AM, Andre Przywara  wrote:
> Commit 278b90ce786f ("configs: Migrate CONFIG_SYS_TEXT_BASE") made
> CONFIG_SYS_TEXT_BASE a proper Kconfig variable, with the consequence
> of moving the common definition shared by almost every sunxi board
> into 123 individual defconfig files. But the U-Boot start address
> for Allwinner boards is a platform decision which has been around for
> ages, so defining it in each *board* config file seems a bit over the
> top.
> Define the standard value (160MB into DRAM) if ARCH_SUNXI is selected,
> and delete the lines from the individual defconfigs.

I suppose we could do the same for A80 with

default 0x2a00 if ARCH_SUNXI && MACH_SUN9I

before the standard sunxi one? AFAIK that would work.

Thanks
ChenYu

> This leaves the few exceptions (three A80 boards and the LicheePi Zero)
> alone, their defconfig value simply overrides the default.
>
> Signed-off-by: Andre Przywara 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] sunxi: move CONFIG_SYS_TEXT_BASE out of defconfigs

2018-02-18 Thread Andre Przywara
Commit 278b90ce786f ("configs: Migrate CONFIG_SYS_TEXT_BASE") made
CONFIG_SYS_TEXT_BASE a proper Kconfig variable, with the consequence
of moving the common definition shared by almost every sunxi board
into 123 individual defconfig files. But the U-Boot start address
for Allwinner boards is a platform decision which has been around for
ages, so defining it in each *board* config file seems a bit over the
top.
Define the standard value (160MB into DRAM) if ARCH_SUNXI is selected,
and delete the lines from the individual defconfigs.
This leaves the few exceptions (three A80 boards and the LicheePi Zero)
alone, their defconfig value simply overrides the default.

Signed-off-by: Andre Przywara 
---
Hi,

the resulting .config files for each sunxi board are identical before
and after this patch, so no regressions are expected.

Cheers,
Andre.

 Kconfig| 1 +
 configs/A10-OLinuXino-Lime_defconfig   | 1 -
 configs/A10s-OLinuXino-M_defconfig | 1 -
 configs/A13-OLinuXinoM_defconfig   | 1 -
 configs/A13-OLinuXino_defconfig| 1 -
 configs/A20-OLinuXino-Lime2-eMMC_defconfig | 1 -
 configs/A20-OLinuXino-Lime2_defconfig  | 1 -
 configs/A20-OLinuXino-Lime_defconfig   | 1 -
 configs/A20-OLinuXino_MICRO-eMMC_defconfig | 1 -
 configs/A20-OLinuXino_MICRO_defconfig  | 1 -
 configs/A20-Olimex-SOM-EVB_defconfig   | 1 -
 configs/A33-OLinuXino_defconfig| 1 -
 configs/Ainol_AW1_defconfig| 1 -
 configs/Ampe_A76_defconfig | 1 -
 configs/Auxtek-T003_defconfig  | 1 -
 configs/Auxtek-T004_defconfig  | 1 -
 configs/Bananapi_M2_Ultra_defconfig| 1 -
 configs/Bananapi_defconfig | 1 -
 configs/Bananapi_m2m_defconfig | 1 -
 configs/Bananapro_defconfig| 1 -
 configs/CHIP_defconfig | 1 -
 configs/CHIP_pro_defconfig | 1 -
 configs/CSQ_CS908_defconfig| 1 -
 configs/Chuwi_V7_CW0825_defconfig  | 1 -
 configs/Colombus_defconfig | 1 -
 configs/Cubieboard2_defconfig  | 1 -
 configs/Cubieboard_defconfig   | 1 -
 configs/Cubietruck_defconfig   | 1 -
 configs/Cubietruck_plus_defconfig  | 1 -
 configs/Empire_electronix_d709_defconfig   | 1 -
 configs/Empire_electronix_m712_defconfig   | 1 -
 configs/Hummingbird_A31_defconfig  | 1 -
 configs/Hyundai_A7HD_defconfig | 1 -
 configs/Itead_Ibox_A20_defconfig   | 1 -
 configs/Lamobo_R1_defconfig| 1 -
 configs/Linksprite_pcDuino3_Nano_defconfig | 1 -
 configs/Linksprite_pcDuino3_defconfig  | 1 -
 configs/Linksprite_pcDuino_defconfig   | 1 -
 configs/MK808C_defconfig   | 1 -
 configs/MSI_Primo73_defconfig  | 1 -
 configs/MSI_Primo81_defconfig  | 1 -
 configs/Marsboard_A10_defconfig| 1 -
 configs/Mele_A1000G_quad_defconfig | 1 -
 configs/Mele_A1000_defconfig   | 1 -
 configs/Mele_I7_defconfig  | 1 -
 configs/Mele_M3_defconfig  | 1 -
 configs/Mele_M5_defconfig  | 1 -
 configs/Mele_M9_defconfig  | 1 -
 configs/Mini-X_defconfig   | 1 -
 configs/Nintendo_NES_Classic_Edition_defconfig | 1 -
 configs/Orangepi_defconfig | 1 -
 configs/Orangepi_mini_defconfig| 1 -
 configs/Sinlinx_SinA31s_defconfig  | 1 -
 configs/Sinlinx_SinA33_defconfig   | 1 -
 configs/Sinovoip_BPI_M2_Plus_defconfig | 1 -
 configs/Sinovoip_BPI_M2_defconfig  | 1 -
 configs/Sinovoip_BPI_M3_defconfig  | 1 -
 configs/UTOO_P66_defconfig | 1 -
 configs/Wexler_TAB7200_defconfig   | 1 -
 configs/Wits_Pro_A20_DKT_defconfig | 1 -
 configs/Wobo_i5_defconfig  | 1 -
 configs/Yones_Toptech_BD1078_defconfig | 1 -
 configs/Yones_Toptech_BS1078_V2_defconfig  | 1 -
 configs/a64-olinuxino_defconfig| 1 -
 configs/ba10_tv_box_defconfig  | 1 -
 configs/bananapi_m1_plus_defconfig | 1 -
 configs/bananapi_m64_defconfig | 1 -
 configs/colorfly_e708_q1_defconfig | 1 -
 configs/difrnce_dit4350_defconfig  | 1 -
 configs/dserve_dsrv9703c_defconfig | 1 -
 configs/ga10h_v1_1_defconfig   | 1 -
 configs/gt90h_v4_defconfig | 1 -
 configs/h8_homlet_v2_defconfig | 1 -
 configs/i12-tvbox_defconfig| 1 -
 configs/iNet_3F_defconfig  | 1 -
 configs/iNet_3W_defconfig  | 1 -
 

Re: [U-Boot] [RFC] Make U-Boot log great again

2018-02-18 Thread Wolfgang Denk
Dear Sam,

In message 

[U-Boot] [PATCH 1/1][for v2018.03] efi_loader: correct input of special keys

2018-02-18 Thread Heinrich Schuchardt
Don't set unicode_char if scan_code is set.
Without this correction navigation in the iPXE menu is not possible.

Add support for page up, page down, and insert.

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

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index d35893dc2a..b5704fbf0f 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -411,14 +411,30 @@ static efi_status_t EFIAPI efi_cin_read_key_stroke(
pressed_key.scan_code = getc() - '0' + 11;
getc();
break;
-   case '2': /* F9 - F12 */
-   pressed_key.scan_code = getc() - '0' + 19;
-   getc();
+   case '2':
+   ch = getc();
+   switch (ch) {
+   case '~': /* INS */
+   pressed_key.scan_code = 7;
+   break;
+   case '1'...'4': /* F9 - F12 */
+   pressed_key.scan_code = ch - '0' + 19;
+   getc();
+   break;
+   }
break;
case '3': /* DEL */
pressed_key.scan_code = 8;
getc();
break;
+   case '5': /* PG UP */
+   pressed_key.scan_code = 9;
+   getc();
+   break;
+   case '6': /* PG DOWN */
+   pressed_key.scan_code = 10;
+   getc();
+   break;
}
break;
}
@@ -426,7 +442,8 @@ static efi_status_t EFIAPI efi_cin_read_key_stroke(
/* Backspace */
ch = 0x08;
}
-   pressed_key.unicode_char = ch;
+   if (!pressed_key.scan_code)
+   pressed_key.unicode_char = ch;
*key = pressed_key;
 
return EFI_EXIT(EFI_SUCCESS);
-- 
2.14.2

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


[U-Boot] [GIT] Pull request: u-boot-dfu (18.02.2018)

2018-02-18 Thread Lukasz Majewski
Dear Marek,

Please find some cosmetic changes and warning fixes for sdp gadget.

Travis CI:
https://travis-ci.org/lmajewski/u-boot-dfu/builds/342704640


The following changes since commit
b16c129c2290d26e7b16b4309713c78f6146bc8a:

  usb: host: xhci-omap: Remove redundant board_usb_init and
  board_usb_cleanup functions (2018-02-15 13:44:30 +0100)

are available in the git repository at:

  git://git.denx.de/u-boot-dfu.git 

for you to fetch changes up to dd7f025dd53e46f8136f5418f3637be39fb6e9de:

  usb: gadget: sdp: fix pointer cast warnings for 64bit archs
  (2018-02-18 20:49:53 +0100)


Andre Heider (2):
  usb: gadget: sdp: add missing line breaks
  usb: gadget: sdp: fix pointer cast warnings for 64bit archs

 cmd/usb_gadget_sdp.c   |  4 ++--
 common/spl/spl_sdp.c   |  4 ++--
 drivers/usb/gadget/f_sdp.c | 27 ---
 3 files changed, 20 insertions(+), 15 deletions(-)


Best regards,

Lukasz Majewski

--

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


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


Re: [U-Boot] [U-Boot, 12/14] ARM: dts: rockchip: Add gmac2phy dts node for rk3328

2018-02-18 Thread Philipp Tomsich



On Sat, 3 Feb 2018, David Wu wrote:


The gmac2phy is connected with integrated with phy, we can
fix the phy node at dtsi level.

Signed-off-by: David Wu 
Acked-by: Philipp Tomsich 
---

arch/arm/dts/rk3328.dtsi | 35 +++
1 file changed, 35 insertions(+)

diff --git a/arch/arm/dts/rk3328.dtsi b/arch/arm/dts/rk3328.dtsi
index 5de1059..7026601 100644
--- a/arch/arm/dts/rk3328.dtsi
+++ b/arch/arm/dts/rk3328.dtsi
@@ -475,6 +475,41 @@
status = "disabled";
};

+   gmac2phy: ethernet@ff55 {
+   compatible = "rockchip,rk3328-gmac";
+   reg = <0x0 0xff55 0x0 0x1>;
+   rockchip,grf = <>;
+   interrupts = ;
+   interrupt-names = "macirq";
+   clocks = < SCLK_MAC2PHY_SRC>, < SCLK_MAC2PHY_RXTX>,
+< SCLK_MAC2PHY_RXTX>, < SCLK_MAC2PHY_REF>,
+< ACLK_MAC2PHY>, < PCLK_MAC2PHY>,
+< SCLK_MAC2PHY_OUT>;
+   clock-names = "stmmaceth", "mac_clk_rx",
+ "mac_clk_tx", "clk_mac_ref",
+ "aclk_mac", "pclk_mac",
+ "clk_macphy";
+   resets = < SRST_GMAC2PHY_A>, < SRST_MACPHY>;
+   reset-names = "stmmaceth", "mac-phy";
+   phy-mode = "rmii";
+   phy-handle = <>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_rxm1 _linkm1>;
+   status = "disabled";
+
+   mdio {
+   compatible = "snps,dwmac-mdio";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   phy: phy@0 {
+   compatible = "ethernet-phy-id1234.d400", 
"ethernet-phy-ieee802.3-c22";
+   reg = <0>;
+   phy-is-integrated;


Again: is this a common config option? If not: shouldn't this be 
"rockchip,phy-is-integrated"?



+   };
+   };
+   };
+
usb_host0_ehci: usb@ff5c {
compatible = "generic-ehci";
reg = <0x0 0xff5c 0x0 0x1>;


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


Re: [U-Boot] [U-Boot, 10/14] ARM: dts: rockchip: Enable integrated phy support for rk3229-evb

2018-02-18 Thread Philipp Tomsich



On Sat, 3 Feb 2018, David Wu wrote:


In fact, the evb-rk3229 is default supported the integrated phy,
not need to change any hardware. So it is better to enbale it and
disable external 1000M phy.

Signed-off-by: David Wu 
Acked-by: Philipp Tomsich 
---

arch/arm/dts/rk3229-evb.dts | 22 ++
1 file changed, 22 insertions(+)

diff --git a/arch/arm/dts/rk3229-evb.dts b/arch/arm/dts/rk3229-evb.dts
index ae0b0a4..547c7a2 100644
--- a/arch/arm/dts/rk3229-evb.dts
+++ b/arch/arm/dts/rk3229-evb.dts
@@ -63,7 +63,29 @@
snps,reset-delays-us = <0 1 100>;
tx_delay = <0x30>;
rx_delay = <0x10>;
+   status = "disabled";
+};
+
+ {
+   assigned-clocks = < SCLK_MAC_SRC>;
+   assigned-clock-rates = <5000>;
+   clock_in_out = "output";
+   phy-supply = <_phy>;
+   phy-mode = "rmii";
+   phy-handle = <>;
status = "okay";
+
+   mdio {
+   compatible = "snps,dwmac-mdio";
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   phy: phy@0 {
+   compatible = "ethernet-phy-id1234.d400", 
"ethernet-phy-ieee802.3-c22";


Where is "ethernet-phy-id1234.d400" defined/used? I don't see anything in 
Linux or U-Boot.



+   reg = <0>;
+   phy-is-integrated;


Documentation in the documentation for DTS bindings?
Shouldn't this be rockchip,phy-is-integrated?
What is the status of this on the Linux side?


+   };
+   };
};

 {


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


Re: [U-Boot] [U-Boot, 01/14] net: rockchip: Separate rmii and rgmii speed setup

2018-02-18 Thread Philipp Tomsich



On Sat, 3 Feb 2018, David Wu wrote:


Some Socs both have rgmii and rmii interface, so we need to
separate their speed setting.

Signed-off-by: David Wu 
Acked-by: Philipp Tomsich 
---

drivers/net/gmac_rockchip.c | 62 +++--
1 file changed, 43 insertions(+), 19 deletions(-)

diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c
index 683e820..4396ca1 100644
--- a/drivers/net/gmac_rockchip.c
+++ b/drivers/net/gmac_rockchip.c
@@ -40,7 +40,10 @@ struct gmac_rockchip_platdata {
};

struct rk_gmac_ops {
-   int (*fix_mac_speed)(struct dw_eth_dev *priv);
+   int (*fix_rmii_speed)(struct gmac_rockchip_platdata *pdata,
+ struct dw_eth_dev *priv);
+   int (*fix_rgmii_speed)(struct gmac_rockchip_platdata *pdata,
+  struct dw_eth_dev *priv);


Why can't this be a single fix_mac_speed function that does the right 
thing both for RMII and RGMII depending on the platdata?



void (*set_to_rmii)(struct gmac_rockchip_platdata *pdata);
void (*set_to_rgmii)(struct gmac_rockchip_platdata *pdata);
};
@@ -70,7 +73,8 @@ static int gmac_rockchip_ofdata_to_platdata(struct udevice 
*dev)
return designware_eth_ofdata_to_platdata(dev);
}

-static int rk3228_gmac_fix_mac_speed(struct dw_eth_dev *priv)
+static int rk3228_gmac_fix_rgmii_speed(struct gmac_rockchip_platdata *pdata,
+  struct dw_eth_dev *priv)
{
struct rk322x_grf *grf;
int clk;
@@ -103,7 +107,8 @@ static int rk3228_gmac_fix_mac_speed(struct dw_eth_dev 
*priv)
return 0;
}

-static int rk3288_gmac_fix_mac_speed(struct dw_eth_dev *priv)
+static int rk3288_gmac_fix_rgmii_speed(struct gmac_rockchip_platdata *pdata,
+  struct dw_eth_dev *priv)
{
struct rk3288_grf *grf;
int clk;
@@ -129,7 +134,8 @@ static int rk3288_gmac_fix_mac_speed(struct dw_eth_dev 
*priv)
return 0;
}

-static int rk3328_gmac_fix_mac_speed(struct dw_eth_dev *priv)
+static int rk3328_gmac_fix_rgmii_speed(struct gmac_rockchip_platdata *pdata,
+  struct dw_eth_dev *priv)
{
struct rk3328_grf_regs *grf;
int clk;
@@ -162,7 +168,8 @@ static int rk3328_gmac_fix_mac_speed(struct dw_eth_dev 
*priv)
return 0;
}

-static int rk3368_gmac_fix_mac_speed(struct dw_eth_dev *priv)
+static int rk3368_gmac_fix_rgmii_speed(struct gmac_rockchip_platdata *pdata,
+  struct dw_eth_dev *priv)
{
struct rk3368_grf *grf;
int clk;
@@ -194,7 +201,8 @@ static int rk3368_gmac_fix_mac_speed(struct dw_eth_dev 
*priv)
return 0;
}

-static int rk3399_gmac_fix_mac_speed(struct dw_eth_dev *priv)
+static int rk3399_gmac_fix_rgmii_speed(struct gmac_rockchip_platdata *pdata,
+  struct dw_eth_dev *priv)
{
struct rk3399_grf_regs *grf;
int clk;
@@ -220,7 +228,8 @@ static int rk3399_gmac_fix_mac_speed(struct dw_eth_dev 
*priv)
return 0;
}

-static int rv1108_set_rmii_speed(struct dw_eth_dev *priv)
+static int rv1108_gmac_fix_rmii_speed(struct gmac_rockchip_platdata *pdata,
+ struct dw_eth_dev *priv)
{
struct rv1108_grf *grf;
int clk, speed;
@@ -489,7 +498,7 @@ static int gmac_rockchip_probe(struct udevice *dev)

break;
default:
-   debug("NO interface defined!\n");
+   debug("%s: NO interface defined!\n", __func__);
return -ENXIO;
}

@@ -498,18 +507,33 @@ static int gmac_rockchip_probe(struct udevice *dev)

static int gmac_rockchip_eth_start(struct udevice *dev)
{
-   struct eth_pdata *pdata = dev_get_platdata(dev);
+   struct eth_pdata *eth_pdata = dev_get_platdata(dev);
struct dw_eth_dev *priv = dev_get_priv(dev);
struct rk_gmac_ops *ops =
(struct rk_gmac_ops *)dev_get_driver_data(dev);
+   struct gmac_rockchip_platdata *pdata = dev_get_platdata(dev);
int ret;

-   ret = designware_eth_init(priv, pdata->enetaddr);
-   if (ret)
-   return ret;
-   ret = ops->fix_mac_speed(priv);
+   ret = designware_eth_init(priv, eth_pdata->enetaddr);
if (ret)
return ret;
+
+   switch (eth_pdata->phy_interface) {
+   case PHY_INTERFACE_MODE_RGMII:
+   ret = ops->fix_rgmii_speed(pdata, priv);
+   if (ret)
+   return ret;
+   break;
+   case PHY_INTERFACE_MODE_RMII:
+   ret = ops->fix_rmii_speed(pdata, priv);
+   if (ret)
+   return ret;
+   break;


Looking at this, the fix_mac_speed()-function could look into pdata to 
determine what needs to be done... no need to complicate the common code 
path with this.



+ 

Re: [U-Boot] [U-Boot,1/2] rockchip: rk3288: Add TPL_LDSCRIPT

2018-02-18 Thread Philipp Tomsich



On Wed, 14 Feb 2018, Jagan Teki wrote:


Due to size limitations in SPL by adding falcon mode,
rk3288 support TPL. In order to not overlap SPL_TEXT_BASE
add TPL_TEXT_BASE with u-boot-tpl.lds that intern call
u-boot-spl.lds with proper TEXT_BASE values.


A separate TPL_LDSCRIPT is needed only, if the SPL and TPL text base are 
to be different... is this the case (from include/configs/rk3288_common.h

it seems that both SPL and TPL are starting in SRAM)?



Signed-off-by: Jagan Teki 
Acked-by: Philipp Tomsich 
---
arch/arm/mach-rockchip/Kconfig   |  7 +++
arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds | 10 ++
2 files changed, 17 insertions(+)
create mode 100644 arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 1e5a7bb..d9218da 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -72,6 +72,13 @@ config ROCKCHIP_RK3288
  and video codec support. Peripherals include Gigabit Ethernet,
  USB2 host and OTG, SDIO, I2S, UARTs, SPI, I2C and PWMs.

+if ROCKCHIP_RK3288
+
+config TPL_LDSCRIPT
+   default "arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds"
+
+endif
+
config ROCKCHIP_RK3328
bool "Support Rockchip RK3328"
select ARM64
diff --git a/arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds 
b/arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds
new file mode 100644
index 000..c7a6092
--- /dev/null
+++ b/arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds
@@ -0,0 +1,10 @@
+/*
+ * Copyright (C) 2018 Jagan Teki 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#undef CONFIG_SPL_TEXT_BASE
+#define CONFIG_SPL_TEXT_BASE   CONFIG_TPL_TEXT_BASE
+
+#include "../../cpu/u-boot-spl.lds"


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


Re: [U-Boot] [U-Boot,2/2] rockchip: rk3288: Fix TPL_TEXT_BASE

2018-02-18 Thread Philipp Tomsich



On Wed, 14 Feb 2018, Jagan Teki wrote:


rockchip boot0 add 4 bytes data (0xeaff) at beginning
of executable(0x800) in order to make generic and compatible
boot0 for all platforms and the resulting executable will be
input to mkimage and the output of mkimage with initial
4 bytes will overwritten by 'spl_hdr'


This is factually wrong (the beginning of the executable is neither at
0x800 nor are 4 bytes of data inserted by boot0 ... boot0 inserts a 
branch-instruction w/ an immediate offset).  Please rewrite.




Since the TPL_TEXT_BASE in rk3288 is 0xff704004 which is improper
align to branch-to-next-instruction-word, so the resulting 4 bytes
are written at ff704020 of executable instead of beginning ff704000

Hexdump with overlaped bytes:
-
000        
010        eaff

So, fix this improper TEXT_BASE which is wrong even before
and update it to 0xff704000 so-that the boot0 will add
4 bytes at beginning.

Disassembly:
---
with 0xff704020 TEXT_BASE:

ff704004 <__image_copy_start>:
b 1f /* if overwritten, entry-address is at the next word */
ff704020:   eaffb   ff704024 <__image_copy_start+0x20>

with 0xff704000 TEXT_BASE:

ff704000 <__image_copy_start>:
b 1f /* if overwritten, entry-address is at the next word */
ff704000:   eaffb   ff704004 <__image_copy_start+0x4>


This is confusing. Please rewrite so it is clear what the problem is and 
why the wrong TEXT_BASE is causing these effects.



This patch will also move TPL_TEXT_BASE into kconfig.

Signed-off-by: Jagan Teki 
Acked-by: Philipp Tomsich 
---
arch/arm/mach-rockchip/Kconfig | 3 +++
configs/vyasa-rk3288_defconfig | 1 -
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index d9218da..0adaed4 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -77,6 +77,9 @@ if ROCKCHIP_RK3288
config TPL_LDSCRIPT
default "arch/arm/mach-rockchip/rk3288/u-boot-tpl.lds"

+config TPL_TEXT_BASE
+   default 0xff704000
+
endif

config ROCKCHIP_RK3328
diff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig
index 1a8a9a8..4c76041 100644
--- a/configs/vyasa-rk3288_defconfig
+++ b/configs/vyasa-rk3288_defconfig
@@ -5,7 +5,6 @@ CONFIG_ARCH_ROCKCHIP=y
CONFIG_SYS_TEXT_BASE=0x0010
CONFIG_SYS_MALLOC_F_LEN=0x2000
CONFIG_ROCKCHIP_RK3288=y
-CONFIG_TPL_TEXT_BASE=0xff704004
CONFIG_TARGET_VYASA_RK3288=y
CONFIG_SPL_STACK_R_ADDR=0x8
CONFIG_DEFAULT_DEVICE_TREE="rk3288-vyasa"


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


Re: [U-Boot] [U-Boot, 6/9] pinctrl: rockchip: Add common rockchip pinctrl driver

2018-02-18 Thread Philipp Tomsich



On Sat, 3 Feb 2018, David Wu wrote:


Use this driver to fit all Rockchip SOCs and to support
the desired pinctrl configuration via DTS.


Please split this into multiple comments (and possibly multiple files) for 
the relevant per-SoC data structures.  I'd like this to be multiple 
commits to add the individual data structures for each of the SOCs.


We had the fundamental discussion of how to deal with drivers that require 
additional config-structures and code for some SOCs in the HDMI/VOP 
context and we should follow the same here.




Signed-off-by: David Wu 
Reviewed-by: Kever Yang 
Tested-by: Kever Yang 
Acked-by: Philipp Tomsich 
---

drivers/pinctrl/Kconfig|   98 +-
drivers/pinctrl/Makefile   |2 +-
drivers/pinctrl/pinctrl-rockchip.c | 2440 
3 files changed, 2454 insertions(+), 86 deletions(-)
create mode 100644 drivers/pinctrl/pinctrl-rockchip.c

diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 7e8e4b0..6177e7c 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -158,95 +158,23 @@ config PINCTRL_QCA953X
  the GPIO definitions and pin control functions for each available
  multiplex function.

-config PINCTRL_ROCKCHIP_RK3036
-   bool "Rockchip rk3036 pin control driver"
-   depends on DM
-   help
- Support pin multiplexing control on Rockchip rk3036 SoCs.
-
- The driver is controlled by a device tree node which contains both
- the GPIO definitions and pin control functions for each available
- multiplex function.
-
-config PINCTRL_ROCKCHIP_RK3128
-   bool "Rockchip rk3128 pin control driver"
-   depends on DM
-   help
- Support pin multiplexing control on Rockchip rk3128 SoCs.
-
- The driver is controlled by a device tree node which contains both
- the GPIO definitions and pin control functions for each available
- multiplex function.
-
-config PINCTRL_ROCKCHIP_RK3188
-   bool "Rockchip rk3188 pin control driver"
-   depends on DM
-   help
- Support pin multiplexing control on Rockchip rk3188 SoCs.
-
- The driver is controlled by a device tree node which contains both
- the GPIO definitions and pin control functions for each available
- multiplex function.
-
-config PINCTRL_ROCKCHIP_RK322X
-   bool "Rockchip rk322x pin control driver"
-   depends on DM
-   help
- Support pin multiplexing control on Rockchip rk322x SoCs.
-
- The driver is controlled by a device tree node which contains both
- the GPIO definitions and pin control functions for each available
- multiplex function.
-
-config PINCTRL_ROCKCHIP_RK3288
-   bool "Rockchip rk3288 pin control driver"
-   depends on DM
-   help
- Support pin multiplexing control on Rockchip rk3288 SoCs.
-
- The driver is controlled by a device tree node which contains both
- the GPIO definitions and pin control functions for each available
- multiplex function.
-
-config PINCTRL_ROCKCHIP_RK3328
-   bool "Rockchip rk3328 pin control driver"
-   depends on DM
-   help
- Support pin multiplexing control on Rockchip rk3328 SoCs.
-
- The driver is controlled by a device tree node which contains both
- the GPIO definitions and pin control functions for each available
- multiplex function.
-
-config PINCTRL_ROCKCHIP_RK3368
-   bool "Rockchip RK3368 pin control driver"
-   depends on DM
-   help
- Support pin multiplexing control on Rockchip rk3368 SoCs.
-
- The driver is controlled by a device tree node which contains both
- the GPIO definitions and pin control functions for each available
- multiplex function.
-
-config PINCTRL_ROCKCHIP_RK3399
-   bool "Rockchip rk3399 pin control driver"
-   depends on DM
+config PINCTRL_ROCKCHIP
+   bool "Rockchip pin control driver"
+   depends on PINCTRL_FULL
+   default y
help
- Support pin multiplexing control on Rockchip rk3399 SoCs.
+ Support pin multiplexing control on Rockchip SoCs.

- The driver is controlled by a device tree node which contains both
- the GPIO definitions and pin control functions for each available
- multiplex function.
+ The driver is controlled by a device tree node which contains pin
+ control functions for each available multiplex function.

-config PINCTRL_ROCKCHIP_RV1108
-   bool "Rockchip rv1108 pin control driver"
-   depends on DM
+config SPL_PINCTRL_ROCKCHIP
+   bool "Support Rockchip pin controllers in SPL"
+   depends on SPL_PINCTRL_FULL
+   default y
help
- Support pin multiplexing control on Rockchip rv1108 SoC.
-
- The driver is 

Re: [U-Boot] [U-Boot, 5/9] rk3288: chrome: defconfig: Disable SPL_OF_PLATDATA for new pinctrl driver

2018-02-18 Thread Philipp Tomsich



On Sat, 3 Feb 2018, David Wu wrote:


The fdedesc is requested for new pinctrl driver, disable SPL_OF_PLATDATA
to make fdedesc be built in.


Again, please reword: I don't see "fdedesc" used anywhere else in U-Boot 
to refer to the device tree.




Signed-off-by: David Wu 
Acked-by: Philipp Tomsich 
---

configs/chromebit_mickey_defconfig  | 2 --
configs/chromebook_jerry_defconfig  | 2 --
configs/chromebook_minnie_defconfig | 2 --
3 files changed, 6 deletions(-)

diff --git a/configs/chromebit_mickey_defconfig 
b/configs/chromebit_mickey_defconfig
index b350811..93c5c4e 100644
--- a/configs/chromebit_mickey_defconfig
+++ b/configs/chromebit_mickey_defconfig
@@ -34,7 +34,6 @@ CONFIG_CMD_REGULATOR=y
CONFIG_SPL_PARTITION_UUIDS=y
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent 
assigned-clocks assigned-clock-rates assigned-clock-parents"
-CONFIG_SPL_OF_PLATDATA=y
CONFIG_REGMAP=y
CONFIG_SPL_REGMAP=y
CONFIG_SYSCON=y
@@ -88,7 +87,6 @@ CONFIG_DISPLAY_ROCKCHIP_HDMI=y
CONFIG_USE_TINY_PRINTF=y
CONFIG_CMD_DHRYSTONE=y
CONFIG_ERRNO_STR=y
-# CONFIG_SPL_OF_LIBFDT is not set
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_USB_GADGET_VBUS_DRAW=0
CONFIG_G_DNL_MANUFACTURER="Rockchip"
diff --git a/configs/chromebook_jerry_defconfig 
b/configs/chromebook_jerry_defconfig
index f80faae..57d35e9 100644
--- a/configs/chromebook_jerry_defconfig
+++ b/configs/chromebook_jerry_defconfig
@@ -36,7 +36,6 @@ CONFIG_CMD_REGULATOR=y
CONFIG_SPL_PARTITION_UUIDS=y
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent 
assigned-clocks assigned-clock-rates assigned-clock-parents"
-CONFIG_SPL_OF_PLATDATA=y
CONFIG_REGMAP=y
CONFIG_SPL_REGMAP=y
CONFIG_SYSCON=y
@@ -90,7 +89,6 @@ CONFIG_DISPLAY_ROCKCHIP_HDMI=y
CONFIG_USE_TINY_PRINTF=y
CONFIG_CMD_DHRYSTONE=y
CONFIG_ERRNO_STR=y
-# CONFIG_SPL_OF_LIBFDT is not set
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_USB_GADGET_VBUS_DRAW=0
CONFIG_G_DNL_MANUFACTURER="Rockchip"
diff --git a/configs/chromebook_minnie_defconfig 
b/configs/chromebook_minnie_defconfig
index ff94a4d..529444a 100644
--- a/configs/chromebook_minnie_defconfig
+++ b/configs/chromebook_minnie_defconfig
@@ -35,7 +35,6 @@ CONFIG_CMD_REGULATOR=y
CONFIG_SPL_PARTITION_UUIDS=y
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent 
assigned-clocks assigned-clock-rates assigned-clock-parents"
-CONFIG_SPL_OF_PLATDATA=y
CONFIG_REGMAP=y
CONFIG_SPL_REGMAP=y
CONFIG_SYSCON=y
@@ -90,7 +89,6 @@ CONFIG_CONSOLE_SCROLL_LINES=10
CONFIG_USE_TINY_PRINTF=y
CONFIG_CMD_DHRYSTONE=y
CONFIG_ERRNO_STR=y
-# CONFIG_SPL_OF_LIBFDT is not set
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_USB_GADGET_VBUS_DRAW=0
CONFIG_G_DNL_MANUFACTURER="Rockchip"


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


Re: [U-Boot] [U-Boot, 2/9] ARM: rockchip: rk3188: Remove the pinctrl setup and enable uart at SPL

2018-02-18 Thread Philipp Tomsich



On Sat, 3 Feb 2018, David Wu wrote:


When the boot ROM sets up MMC we don't need to do it again. Remove the
MMC setup code entirely, but we also need to enable uart for debug message.


If the MMC always set up correctly for all configurations (e.g. bus-width)
or should some of the setup be duplicated there to ensure that we catch 
all corner cases?



Signed-off-by: David Wu 
Acked-by: Philipp Tomsich 
---

arch/arm/mach-rockchip/rk3188-board-spl.c | 42 +++
1 file changed, 3 insertions(+), 39 deletions(-)

diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c 
b/arch/arm/mach-rockchip/rk3188-board-spl.c
index 8e3b8ae..8371a31 100644
--- a/arch/arm/mach-rockchip/rk3188-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
@@ -100,10 +100,11 @@ static int setup_arm_clock(void)

void board_init_f(ulong dummy)
{
-   struct udevice *pinctrl, *dev;
+   struct udevice *dev;
int ret;

/* Example code showing how to enable the debug UART on RK3188 */
+#define EARLY_UART
#ifdef EARLY_UART
#include 
/* Enable early UART on the RK3188 */
@@ -124,10 +125,7 @@ void board_init_f(ulong dummy)
 * printascii("string");
 */
debug_uart_init();
-   printch('s');
-   printch('p');
-   printch('l');
-   printch('\n');
+   printascii("U-Boot SPL board init");
#endif

ret = spl_early_init();
@@ -144,12 +142,6 @@ void board_init_f(ulong dummy)
return;
}

-   ret = uclass_get_device(UCLASS_PINCTRL, 0, );
-   if (ret) {
-   debug("Pinctrl init failed: %d\n", ret);
-   return;
-   }
-
ret = uclass_get_device(UCLASS_RAM, 0, );
if (ret) {
debug("DRAM init failed: %d\n", ret);
@@ -187,7 +179,6 @@ static int setup_led(void)

void spl_board_init(void)
{
-   struct udevice *pinctrl;
int ret;

ret = setup_led();
@@ -196,36 +187,9 @@ void spl_board_init(void)
hang();
}

-   ret = uclass_get_device(UCLASS_PINCTRL, 0, );
-   if (ret) {
-   debug("%s: Cannot find pinctrl device\n", __func__);
-   goto err;
-   }
-
-#ifdef CONFIG_SPL_MMC_SUPPORT
-   ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD);
-   if (ret) {
-   debug("%s: Failed to set up SD card\n", __func__);
-   goto err;
-   }
-#endif
-
-   /* Enable debug UART */
-   ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG);
-   if (ret) {
-   debug("%s: Failed to set up console UART\n", __func__);
-   goto err;
-   }
-
preloader_console_init();
#if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
back_to_bootrom(BROM_BOOT_NEXTSTAGE);
#endif
return;
-
-err:
-   printf("spl_board_init: Error %d\n", ret);
-
-   /* No way to report error here */
-   hang();
}


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


Re: [U-Boot] [U-Boot, 1/9] rockchip: rk3399-evb: defconfig: Disable SPL_OF_PLATDATA for new pinctrl driver

2018-02-18 Thread Philipp Tomsich



On Sat, 3 Feb 2018, David Wu wrote:


The fdedesc is requested for new pinctrl driver, disable SPL_OF_PLATDATA
to make fdedesc be built in.


You should reword this, as "fdedesc" ist not how the device-tree is 
usually referred to.




Signed-off-by: David Wu 
Acked-by: Philipp Tomsich 
---

configs/evb-rk3399_defconfig | 1 -
1 file changed, 1 deletion(-)

diff --git a/configs/evb-rk3399_defconfig b/configs/evb-rk3399_defconfig
index e8e52c3..54eb703 100644
--- a/configs/evb-rk3399_defconfig
+++ b/configs/evb-rk3399_defconfig
@@ -22,7 +22,6 @@ CONFIG_CMD_USB=y
CONFIG_CMD_TIME=y
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent 
assigned-clocks assigned-clock-rates assigned-clock-parents"
-CONFIG_SPL_OF_PLATDATA=y
CONFIG_ENV_IS_IN_MMC=y
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_REGMAP=y


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


[U-Boot] [PATCH 5/5] efi_selftest: unit test for event groups

2018-02-18 Thread Heinrich Schuchardt
Supply a unit test for event groups.

Create multiple events in an event group. Signal each event once and check
that all events are notified once in each round.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_selftest/Makefile|   1 +
 lib/efi_selftest/efi_selftest_event_groups.c | 140 +++
 2 files changed, 141 insertions(+)
 create mode 100644 lib/efi_selftest/efi_selftest_event_groups.c

diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile
index b975da2955..51af1055e9 100644
--- a/lib/efi_selftest/Makefile
+++ b/lib/efi_selftest/Makefile
@@ -19,6 +19,7 @@ efi_selftest_controllers.o \
 efi_selftest_console.o \
 efi_selftest_devicepath.o \
 efi_selftest_events.o \
+efi_selftest_event_groups.o \
 efi_selftest_exitbootservices.o \
 efi_selftest_fdt.o \
 efi_selftest_gop.o \
diff --git a/lib/efi_selftest/efi_selftest_event_groups.c 
b/lib/efi_selftest/efi_selftest_event_groups.c
new file mode 100644
index 00..79e4ea1ce2
--- /dev/null
+++ b/lib/efi_selftest/efi_selftest_event_groups.c
@@ -0,0 +1,140 @@
+/*
+ * efi_selftest_event_groups
+ *
+ * Copyright (c) 2018 Heinrich Schuchardt 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ *
+ * This test checks the notification of group events and the
+ * following services:
+ * CreateEventEx, CloseEvent, SignalEvent, CheckEvent.
+ */
+
+#include 
+
+#define GROUP_SIZE 16
+
+static struct efi_boot_services *boottime;
+static efi_guid_t event_group =
+   EFI_GUID(0x2335905b, 0xc3b9, 0x4221, 0xa3, 0x71,
+0x0e, 0x5b, 0x45, 0xc0, 0x56, 0x91);
+
+/*
+ * Notification function, increments the notfication count if parameter
+ * context is provided.
+ *
+ * @event  notified event
+ * @contextpointer to the notification count
+ */
+static void EFIAPI notify(struct efi_event *event, void *context)
+{
+   unsigned int *count = context;
+
+   if (count)
+   ++*count;
+}
+
+/*
+ * Setup unit test.
+ *
+ * @handle:handle of the loaded image
+ * @systable:  system table
+ * @return:EFI_ST_SUCCESS for success
+ */
+static int setup(const efi_handle_t handle,
+const struct efi_system_table *systable)
+{
+   boottime = systable->boottime;
+
+   return EFI_ST_SUCCESS;
+}
+
+/*
+ * Execute unit test.
+ *
+ * Create multiple events in an event group. Signal each event once and check
+ * that all events are notified once in each round.
+ *
+ * @return:EFI_ST_SUCCESS for success
+ */
+static int execute(void)
+{
+   unsigned int counter[GROUP_SIZE] = {0};
+   struct efi_event *events[GROUP_SIZE];
+   size_t i, j;
+   efi_status_t ret;
+
+   for (i = 0; i < GROUP_SIZE; ++i) {
+   ret = boottime->create_event_ex(0, TPL_NOTIFY,
+   notify, (void *)[i],
+   _group, [i]);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("Failed to create event\n");
+   return EFI_ST_FAILURE;
+   }
+   }
+
+   for (i = 0; i < GROUP_SIZE; ++i) {
+   ret = boottime->signal_event(events[i]);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("Failed to signal event\n");
+   return EFI_ST_FAILURE;
+   }
+   for (j = 0; j < GROUP_SIZE; ++j) {
+   if (counter[j] != i) {
+   efi_st_printf("i %u, j %u, count %u\n",
+ (unsigned int)i, (unsigned int)j,
+ (unsigned int)counter[j]);
+   efi_st_error(
+   "Notification function was called\n");
+   return EFI_ST_FAILURE;
+   }
+   /* Clear signaled state */
+   ret = boottime->check_event(events[j]);
+   if (ret != EFI_SUCCESS) {
+   efi_st_error("Event was not signaled\n");
+   return EFI_ST_FAILURE;
+   }
+   if (counter[j] != i) {
+   efi_st_printf("i %u, j %u, count %u\n",
+ (unsigned int)i, (unsigned int)j,
+ (unsigned int)counter[j]);
+   efi_st_error(
+   "Notification function was called\n");
+   return EFI_ST_FAILURE;
+   }
+   /* Call notification function  */
+   ret = boottime->check_event(events[j]);
+   if (ret != EFI_NOT_READY) {
+   efi_st_error(
+   "Signaled 

[U-Boot] [PATCH 4/5] efi_loader: implement event groups

2018-02-18 Thread Heinrich Schuchardt
If an event of a group event is signaled all other events of the same
group are signaled too.

Function efi_signal_event is renamed to efi_queue_event.
A new function efi_signal_event is introduced that checks if an event
belongs to a group and than signals all events of the group.
Event group notifciation is implemented for ExitBootServices,
InstallConfigurationTable, and ResetSystem.

Signed-off-by: Heinrich Schuchardt 
---
 include/efi_loader.h  |  7 ++-
 lib/efi_loader/efi_boottime.c | 99 ++-
 lib/efi_loader/efi_console.c  |  6 +--
 lib/efi_loader/efi_net.c  |  4 +-
 lib/efi_loader/efi_runtime.c  | 11 +
 lib/efi_loader/efi_watchdog.c |  2 +-
 6 files changed, 101 insertions(+), 28 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index e2cd249171..b1999f08c6 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -161,6 +161,7 @@ struct efi_object {
  * @notify_tpl:Task priority level of notifications
  * @nofify_function:   Function to call when the event is triggered
  * @notify_context:Data to be passed to the notify function
+ * @group: Event group
  * @trigger_time:  Period of the timer
  * @trigger_next:  Next time to trigger the timer
  * @trigger_type:  Type of timer, see efi_set_timer
@@ -173,6 +174,7 @@ struct efi_event {
efi_uintn_t notify_tpl;
void (EFIAPI *notify_function)(struct efi_event *event, void *context);
void *notify_context;
+   const efi_guid_t *group;
u64 trigger_next;
u64 trigger_time;
enum efi_timer_delay trigger_type;
@@ -182,6 +184,8 @@ struct efi_event {
 
 /* This list contains all UEFI objects we know of */
 extern struct list_head efi_obj_list;
+/* List of all events */
+extern struct list_head efi_events;
 
 /* Called by bootefi to make console interface available */
 int efi_console_register(void);
@@ -248,7 +252,8 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t 
notify_tpl,
  void (EFIAPI *notify_function) (
struct efi_event *event,
void *context),
- void *notify_context, struct efi_event **event);
+ void *notify_context, efi_guid_t *group,
+ struct efi_event **event);
 /* Call this to set a timer */
 efi_status_t efi_set_timer(struct efi_event *event, enum efi_timer_delay type,
   uint64_t trigger_time);
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index da3c852b44..32b8149fe7 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -27,7 +27,7 @@ static efi_uintn_t efi_tpl = TPL_APPLICATION;
 LIST_HEAD(efi_obj_list);
 
 /* List of all events */
-static LIST_HEAD(efi_events);
+LIST_HEAD(efi_events);
 
 /*
  * If we're running on nasty systems (32bit ARM booting into non-EFI Linux)
@@ -176,7 +176,7 @@ const char *__efi_nesting_dec(void)
  * @event  event to signal
  * @check_tpl  check the TPL level
  */
-void efi_signal_event(struct efi_event *event, bool check_tpl)
+static void efi_queue_event(struct efi_event *event, bool check_tpl)
 {
if (event->notify_function) {
event->is_queued = true;
@@ -189,6 +189,50 @@ void efi_signal_event(struct efi_event *event, bool 
check_tpl)
event->is_queued = false;
 }
 
+/*
+ * Signal an EFI event.
+ *
+ * This function signals an event. If the event belongs to an event group
+ * all events of the group are signaled. If they are of type EVT_NOTIFY_SIGNAL
+ * their notification function is queued.
+ *
+ * For the SignalEvent service see efi_signal_event_ext.
+ *
+ * @event  event to signal
+ * @check_tpl  check the TPL level
+ */
+void efi_signal_event(struct efi_event *event, bool check_tpl)
+{
+   if (event->group) {
+   struct efi_event *evt;
+
+   /*
+* The signaled state has to set before executing any
+* notification function
+*/
+   list_for_each_entry(evt, _events, link) {
+   if (!evt->group || guidcmp(evt->group, event->group))
+   continue;
+   if (evt->is_signaled)
+   continue;
+   evt->is_signaled = true;
+   if (evt->type & EVT_NOTIFY_SIGNAL &&
+   evt->notify_function)
+   evt->is_queued = true;
+   }
+   list_for_each_entry(evt, _events, link) {
+   if (!evt->group || guidcmp(evt->group, event->group))
+   continue;
+   if (evt->is_queued)
+   efi_queue_event(evt, check_tpl);
+   }
+   } else if 

[U-Boot] [PATCH 2/5] efi_loader: manage events in a linked list

2018-02-18 Thread Heinrich Schuchardt
Lift the limit on the number of events by using a linked list.

This also allows to have events with type == 0.

This patch is based on Rob's patch
efi_loader: fix events
https://lists.denx.de/pipermail/u-boot/2017-October/309348.html

Suggested-by: Rob Clark 
Signed-off-by: Heinrich Schuchardt 
---
 include/efi_loader.h  |  11 +--
 lib/efi_loader/efi_boottime.c | 192 +++---
 2 files changed, 93 insertions(+), 110 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index 3ccbb98aaf..7f703c6ef7 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -146,17 +146,19 @@ struct efi_object {
 /**
  * struct efi_event
  *
+ * @link:  Link to list of all events
  * @type:  Type of event, see efi_create_event
  * @notify_tpl:Task priority level of notifications
- * @trigger_time:  Period of the timer
- * @trigger_next:  Next time to trigger the timer
  * @nofify_function:   Function to call when the event is triggered
  * @notify_context:Data to be passed to the notify function
+ * @trigger_time:  Period of the timer
+ * @trigger_next:  Next time to trigger the timer
  * @trigger_type:  Type of timer, see efi_set_timer
- * @queued:The notification function is queued
- * @signaled:  The event occurred. The event is in the signaled state.
+ * @is_queued: The notification function is queued
+ * @is_signaled:   The event occurred. The event is in the signaled state.
  */
 struct efi_event {
+   struct list_head link;
uint32_t type;
efi_uintn_t notify_tpl;
void (EFIAPI *notify_function)(struct efi_event *event, void *context);
@@ -168,7 +170,6 @@ struct efi_event {
bool is_signaled;
 };
 
-
 /* This list contains all UEFI objects we know of */
 extern struct list_head efi_obj_list;
 
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 75f7c50295..4acb1e092a 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -26,6 +26,9 @@ static efi_uintn_t efi_tpl = TPL_APPLICATION;
 /* This list contains all the EFI objects our payload has access to */
 LIST_HEAD(efi_obj_list);
 
+/* List of all events */
+static LIST_HEAD(efi_events);
+
 /*
  * If we're running on nasty systems (32bit ARM booting into non-EFI Linux)
  * we need to do trickery with caches. Since we don't want to break the EFI
@@ -473,10 +476,23 @@ void efi_delete_handle(struct efi_object *obj)
 }
 
 /*
- * Our event capabilities are very limited. Only a small limited
- * number of events is allowed to coexist.
+ * Check if a pointer is a valid event.
+ *
+ * @event  pointer to check
+ * @return status code
  */
-static struct efi_event efi_events[16];
+static efi_status_t efi_is_event(const struct efi_event *event)
+{
+   const struct efi_event *evt;
+
+   if (!event)
+   return EFI_INVALID_PARAMETER;
+   list_for_each_entry(evt, _events, link) {
+   if (evt == event)
+   return EFI_SUCCESS;
+   }
+   return EFI_INVALID_PARAMETER;
+}
 
 /*
  * Create an event.
@@ -499,7 +515,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t 
notify_tpl,
void *context),
  void *notify_context, struct efi_event **event)
 {
-   int i;
+   struct efi_event *evt;
 
if (event == NULL)
return EFI_INVALID_PARAMETER;
@@ -507,25 +523,24 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t 
notify_tpl,
if ((type & EVT_NOTIFY_SIGNAL) && (type & EVT_NOTIFY_WAIT))
return EFI_INVALID_PARAMETER;
 
-   if ((type & (EVT_NOTIFY_SIGNAL|EVT_NOTIFY_WAIT)) &&
+   if ((type & (EVT_NOTIFY_SIGNAL | EVT_NOTIFY_WAIT)) &&
notify_function == NULL)
return EFI_INVALID_PARAMETER;
 
-   for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
-   if (efi_events[i].type)
-   continue;
-   efi_events[i].type = type;
-   efi_events[i].notify_tpl = notify_tpl;
-   efi_events[i].notify_function = notify_function;
-   efi_events[i].notify_context = notify_context;
-   /* Disable timers on bootup */
-   efi_events[i].trigger_next = -1ULL;
-   efi_events[i].is_queued = false;
-   efi_events[i].is_signaled = false;
-   *event = _events[i];
-   return EFI_SUCCESS;
-   }
-   return EFI_OUT_OF_RESOURCES;
+   evt = calloc(1, sizeof(struct efi_event));
+   if (!evt)
+   return EFI_OUT_OF_RESOURCES;
+   evt->type = type;
+   evt->notify_tpl = notify_tpl;
+   evt->notify_function = notify_function;
+   evt->notify_context = notify_context;
+   /* Disable timers on bootup */
+   

[U-Boot] [PATCH 3/5] efi_loader: define GUIDS for event groups

2018-02-18 Thread Heinrich Schuchardt
Event groups are used to signal multiple events at the same time.
They are identified by GUIDs. This patch provided the predefined
GUIDs of UEFI specification 2.7.

Signed-off-by: Heinrich Schuchardt 
---
 include/efi_api.h | 21 +
 include/efi_loader.h  | 10 ++
 lib/efi_loader/efi_boottime.c | 16 
 3 files changed, 47 insertions(+)

diff --git a/include/efi_api.h b/include/efi_api.h
index 13ed80ac97..d20058540a 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -244,6 +244,27 @@ struct efi_runtime_services {
u64 maximum_variable_size);
 };
 
+/* EFI event group GUID definitions */
+#define EFI_EVENT_GROUP_EXIT_BOOT_SERVICES \
+   EFI_GUID(0x27abf055, 0xb1b8, 0x4c26, 0x80, 0x48, \
+0x74, 0x8f, 0x37, 0xba, 0xa2, 0xdf)
+
+#define EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE \
+   EFI_GUID(0x13fa7698, 0xc831, 0x49c7, 0x87, 0xea, \
+0x8f, 0x43, 0xfc, 0xc2, 0x51, 0x96)
+
+#define EFI_EVENT_GROUP_MEMORY_MAP_CHANGE \
+   EFI_GUID(0x78bee926, 0x692f, 0x48fd, 0x9e, 0xdb, \
+0x01, 0x42, 0x2e, 0xf0, 0xd7, 0xab)
+
+#define EFI_EVENT_GROUP_READY_TO_BOOT \
+   EFI_GUID(0x7ce88fb3, 0x4bd7, 0x4679, 0x87, 0xa8, \
+0xa8, 0xd8, 0xde, 0xe5, 0x0d, 0x2b)
+
+#define EFI_EVENT_GROUP_RESET_SYSTEM \
+   EFI_GUID(0x62da6a56, 0x13fb, 0x485a, 0xa8, 0xda, \
+0xa3, 0xdd, 0x79, 0x12, 0xcb, 0x6b)
+
 /* EFI Configuration Table and GUID definitions */
 #define NULL_GUID \
EFI_GUID(0x, 0x, 0x, 0x00, 0x00, \
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 7f703c6ef7..e2cd249171 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -93,6 +93,16 @@ extern const efi_guid_t efi_guid_console_control;
 extern const efi_guid_t efi_guid_device_path;
 /* GUID of the EFI_DRIVER_BINDING_PROTOCOL */
 extern const efi_guid_t efi_guid_driver_binding_protocol;
+/* event group ExitBootServices() invoked */
+extern const efi_guid_t efi_guid_event_group_exit_boot_services;
+/* event group SetVirtualAddressMap() invoked */
+extern const efi_guid_t efi_guid_event_group_virtual_address_change;
+/* event group memory map changed */
+extern const efi_guid_t efi_guid_event_group_memory_map_change;
+/* event group boot manager about to boot */
+extern const efi_guid_t efi_guid_event_group_ready_to_boot;
+/* event group ResetSystem() invoked (before ExitBootServices) */
+extern const efi_guid_t efi_guid_event_group_reset_system;
 /* GUID of the device tree table */
 extern const efi_guid_t efi_guid_fdt;
 extern const efi_guid_t efi_guid_loaded_image;
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 4acb1e092a..da3c852b44 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -65,6 +65,22 @@ const efi_guid_t efi_guid_fdt = EFI_FDT_GUID;
 const efi_guid_t efi_guid_driver_binding_protocol =
EFI_DRIVER_BINDING_PROTOCOL_GUID;
 
+/* event group ExitBootServices() invoked */
+const efi_guid_t efi_guid_event_group_exit_boot_services =
+   EFI_EVENT_GROUP_EXIT_BOOT_SERVICES;
+/* event group SetVirtualAddressMap() invoked */
+const efi_guid_t efi_guid_event_group_virtual_address_change =
+   EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE;
+/* event group memory map changed */
+const efi_guid_t efi_guid_event_group_memory_map_change =
+   EFI_EVENT_GROUP_MEMORY_MAP_CHANGE;
+/* event group boot manager about to boot */
+const efi_guid_t efi_guid_event_group_ready_to_boot =
+   EFI_EVENT_GROUP_READY_TO_BOOT;
+/* event group ResetSystem() invoked (before ExitBootServices) */
+const efi_guid_t efi_guid_event_group_reset_system =
+   EFI_EVENT_GROUP_RESET_SYSTEM;
+
 static efi_status_t EFIAPI efi_disconnect_controller(
efi_handle_t controller_handle,
efi_handle_t driver_image_handle,
-- 
2.14.2

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


[U-Boot] [PATCH 1/5] efi_loader: fix formatting errors

2018-02-18 Thread Heinrich Schuchardt
Fix formatting errors in efi_boottime.c indicated by
scripts/checkpatch.py.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 48 +++
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 15235f6d07..75f7c50295 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -123,6 +123,7 @@ static const char *indent_string(int level)
 {
const char *indent = "";
const int max = strlen(indent);
+
level = min(max, level * 2);
return [max - level];
 }
@@ -257,7 +258,7 @@ static efi_status_t EFIAPI efi_free_pages_ext(uint64_t 
memory,
 {
efi_status_t r;
 
-   EFI_ENTRY("%"PRIx64", 0x%zx", memory, pages);
+   EFI_ENTRY("%" PRIx64 ", 0x%zx", memory, pages);
r = efi_free_pages(memory, pages);
return EFI_EXIT(r);
 }
@@ -586,7 +587,6 @@ static efi_status_t EFIAPI efi_create_event_ext(
 notify_context, event));
 }
 
-
 /*
  * Check if a timer event has occurred or a queued notification function should
  * be called.
@@ -688,7 +688,7 @@ static efi_status_t EFIAPI efi_set_timer_ext(struct 
efi_event *event,
 enum efi_timer_delay type,
 uint64_t trigger_time)
 {
-   EFI_ENTRY("%p, %d, %"PRIx64, event, type, trigger_time);
+   EFI_ENTRY("%p, %d, %" PRIx64, event, type, trigger_time);
return EFI_EXIT(efi_set_timer(event, type, trigger_time));
 }
 
@@ -1264,7 +1264,7 @@ static efi_status_t efi_locate_handle(
/* Count how much space we need */
list_for_each_entry(efiobj, _obj_list, link) {
if (!efi_search(search_type, protocol, search_key, efiobj))
-   size += sizeof(void*);
+   size += sizeof(void *);
}
 
if (*buffer_size < size) {
@@ -1315,7 +1315,7 @@ static efi_status_t EFIAPI efi_locate_handle_ext(
 static void efi_remove_configuration_table(int i)
 {
struct efi_configuration_table *this = _conf_table[i];
-   struct efi_configuration_table *next = _conf_table[i+1];
+   struct efi_configuration_table *next = _conf_table[i + 1];
struct efi_configuration_table *end = _conf_table[systab.nr_tables];
 
memmove(this, next, (ulong)end - (ulong)next);
@@ -1332,7 +1332,8 @@ static void efi_remove_configuration_table(int i)
  * @table  table to be installed
  * @return status code
  */
-efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void 
*table)
+efi_status_t efi_install_configuration_table(const efi_guid_t *guid,
+void *table)
 {
int i;
 
@@ -1638,8 +1639,9 @@ static efi_status_t EFIAPI efi_start_image(efi_handle_t 
image_handle,
  * @return status code
  */
 static efi_status_t EFIAPI efi_exit(efi_handle_t image_handle,
-   efi_status_t exit_status, unsigned long exit_data_size,
-   int16_t *exit_data)
+   efi_status_t exit_status,
+   unsigned long exit_data_size,
+   int16_t *exit_data)
 {
/*
 * We require that the handle points to the original loaded
@@ -1652,7 +1654,7 @@ static efi_status_t EFIAPI efi_exit(efi_handle_t 
image_handle,
 * TODO: We should call the unload procedure of the loaded
 *   image protocol.
 */
-   struct efi_loaded_image *loaded_image_info = (void*)image_handle;
+   struct efi_loaded_image *loaded_image_info = (void *)image_handle;
 
EFI_ENTRY("%p, %ld, %ld, %p", image_handle, exit_status,
  exit_data_size, exit_data);
@@ -1789,7 +1791,8 @@ static efi_status_t EFIAPI 
efi_exit_boot_services(efi_handle_t image_handle,
  */
 static efi_status_t EFIAPI efi_get_next_monotonic_count(uint64_t *count)
 {
-   static uint64_t mono = 0;
+   static uint64_t mono;
+
EFI_ENTRY("%p", count);
*count = mono++;
return EFI_EXIT(EFI_SUCCESS);
@@ -1830,7 +1833,7 @@ static efi_status_t EFIAPI 
efi_set_watchdog_timer(unsigned long timeout,
  unsigned long data_size,
  uint16_t *watchdog_data)
 {
-   EFI_ENTRY("%ld, 0x%"PRIx64", %ld, %p", timeout, watchdog_code,
+   EFI_ENTRY("%ld, 0x%" PRIx64 ", %ld, %p", timeout, watchdog_code,
  data_size, watchdog_data);
return EFI_EXIT(efi_set_watchdog(timeout));
 }
@@ -1895,8 +1898,8 @@ out:
  * @entry_countnumber of entries available in the buffer
  * @return status code
  */
-static efi_status_t EFIAPI efi_open_protocol_information(efi_handle_t handle,
-  

[U-Boot] [PATCH 0/5] efi_loader: implement event groups

2018-02-18 Thread Heinrich Schuchardt
The patch series provides support for event groups. If any event of the
group is signaled all other events are signaled too.

The events are managed in a linked list instead of an array.

Some formatting errors are fixed.

Heinrich Schuchardt (5):
  efi_loader: fix formatting errors
  efi_loader: manage events in a linked list
  efi_loader: define GUIDS for event groups
  efi_loader: implement event groups
  efi_selftest: unit test for event groups

 include/efi_api.h|  21 ++
 include/efi_loader.h |  28 ++-
 lib/efi_loader/efi_boottime.c| 339 ---
 lib/efi_loader/efi_console.c |   6 +-
 lib/efi_loader/efi_net.c |   4 +-
 lib/efi_loader/efi_runtime.c |  11 +
 lib/efi_loader/efi_watchdog.c|   2 +-
 lib/efi_selftest/Makefile|   1 +
 lib/efi_selftest/efi_selftest_event_groups.c | 140 +++
 9 files changed, 400 insertions(+), 152 deletions(-)
 create mode 100644 lib/efi_selftest/efi_selftest_event_groups.c

-- 
2.14.2

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


Re: [U-Boot] [PATCH v2 07/16] sandbox: smbios: Update to support sandbox

2018-02-18 Thread Heinrich Schuchardt
On 12/04/2017 10:28 PM, Simon Glass wrote:
> At present this code casts addresses to pointers so cannot be used with
> sandbox. Update it to use mapmem instead.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v2: None
> 
>  lib/smbios.c | 38 +-
>  1 file changed, 29 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/smbios.c b/lib/smbios.c
> index 8f19ad89c1..56481d448d 100644
> --- a/lib/smbios.c
> +++ b/lib/smbios.c
> @@ -7,6 +7,7 @@
>   */
>  
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -75,9 +76,10 @@ static int smbios_string_table_len(char *start)
>  
>  static int smbios_write_type0(ulong *current, int handle)
>  {
> - struct smbios_type0 *t = (struct smbios_type0 *)*current;
> + struct smbios_type0 *t;
>   int len = sizeof(struct smbios_type0);
>  
> + t = map_sysmem(*current, len);
>   memset(t, 0, sizeof(struct smbios_type0));
>   fill_smbios_header(t, SMBIOS_BIOS_INFORMATION, len, handle);
>   t->vendor = smbios_add_string(t->eos, "U-Boot");
> @@ -104,16 +106,18 @@ static int smbios_write_type0(ulong *current, int 
> handle)
>  
>   len = t->length + smbios_string_table_len(t->eos);
>   *current += len;
> + unmap_sysmem(t);
>  
>   return len;
>  }
>  
>  static int smbios_write_type1(ulong *current, int handle)
>  {
> - struct smbios_type1 *t = (struct smbios_type1 *)*current;
> + struct smbios_type1 *t;
>   int len = sizeof(struct smbios_type1);
>   char *serial_str = env_get("serial#");
>  
> + t = map_sysmem(*current, len);
>   memset(t, 0, sizeof(struct smbios_type1));
>   fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
>   t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER);
> @@ -125,15 +129,17 @@ static int smbios_write_type1(ulong *current, int 
> handle)
>  
>   len = t->length + smbios_string_table_len(t->eos);
>   *current += len;
> + unmap_sysmem(t);
>  
>   return len;
>  }
>  
>  static int smbios_write_type2(ulong *current, int handle)
>  {
> - struct smbios_type2 *t = (struct smbios_type2 *)*current;
> + struct smbios_type2 *t;
>   int len = sizeof(struct smbios_type2);
>  
> + t = map_sysmem(*current, len);
>   memset(t, 0, sizeof(struct smbios_type2));
>   fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
>   t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER);
> @@ -143,15 +149,17 @@ static int smbios_write_type2(ulong *current, int 
> handle)
>  
>   len = t->length + smbios_string_table_len(t->eos);
>   *current += len;
> + unmap_sysmem(t);
>  
>   return len;
>  }
>  
>  static int smbios_write_type3(ulong *current, int handle)
>  {
> - struct smbios_type3 *t = (struct smbios_type3 *)*current;
> + struct smbios_type3 *t;
>   int len = sizeof(struct smbios_type3);
>  
> + t = map_sysmem(*current, len);
>   memset(t, 0, sizeof(struct smbios_type3));
>   fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle);
>   t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER);
> @@ -163,6 +171,7 @@ static int smbios_write_type3(ulong *current, int handle)
>  
>   len = t->length + smbios_string_table_len(t->eos);
>   *current += len;
> + unmap_sysmem(t);
>  
>   return len;
>  }
> @@ -201,9 +210,10 @@ static void smbios_write_type4_dm(struct smbios_type4 *t)
>  
>  static int smbios_write_type4(ulong *current, int handle)
>  {
> - struct smbios_type4 *t = (struct smbios_type4 *)*current;
> + struct smbios_type4 *t;
>   int len = sizeof(struct smbios_type4);
>  
> + t = map_sysmem(*current, len);
>   memset(t, 0, sizeof(struct smbios_type4));
>   fill_smbios_header(t, SMBIOS_PROCESSOR_INFORMATION, len, handle);
>   t->processor_type = SMBIOS_PROCESSOR_TYPE_CENTRAL;
> @@ -217,32 +227,37 @@ static int smbios_write_type4(ulong *current, int 
> handle)
>  
>   len = t->length + smbios_string_table_len(t->eos);
>   *current += len;
> + unmap_sysmem(t);
>  
>   return len;
>  }
>  
>  static int smbios_write_type32(ulong *current, int handle)
>  {
> - struct smbios_type32 *t = (struct smbios_type32 *)*current;
> + struct smbios_type32 *t;
>   int len = sizeof(struct smbios_type32);
>  
> + t = map_sysmem(*current, len);
>   memset(t, 0, sizeof(struct smbios_type32));
>   fill_smbios_header(t, SMBIOS_SYSTEM_BOOT_INFORMATION, len, handle);
>  
>   *current += len;
> + unmap_sysmem(t);
>  
>   return len;
>  }
>  
>  static int smbios_write_type127(ulong *current, int handle)
>  {
> - struct smbios_type127 *t = (struct smbios_type127 *)*current;
> + struct smbios_type127 *t;
>   int len = sizeof(struct smbios_type127);
>  
> + t = map_sysmem(*current, len);
>   memset(t, 0, sizeof(struct smbios_type127));
>   fill_smbios_header(t, 

Re: [U-Boot] [PATCH] mx6sabresd: Select the CONFIG_EFI_PARTITION option

2018-02-18 Thread Stefano Babic
Hi Fabio,

On 17/02/2018 22:44, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> With fastboot support enabled, it is useful to be able to list
> the eMMC EFI partitions, so select the CONFIG_EFI_PARTITION option.
> 
> Signed-off-by: Fabio Estevam 
> ---
> Hi Stefano,
> 
> It seems you picked the v1 of my fastboot patch instead of v2.
> 

mmmh...very bad. I have often the possibility to make errors because
patchworks just not follow the version. I see and read patches on my
e-mailer, but I pick them from patchworks with pwclient. Very often I
saw that patchworks is reporting an old version and in most cases I
search for the cirrect version. In this case, I have not seen it.

I really miss a patchwork's feature that declare all previous version
"obsolete" or "changes requested" when a new version is posted.

> Hence I am sending a new patch that only selects CONFIG_EFI_PARTITION.
> 
>  configs/mx6sabresd_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig
> index feb385d..55709e8 100644
> --- a/configs/mx6sabresd_defconfig
> +++ b/configs/mx6sabresd_defconfig
> @@ -48,6 +48,7 @@ CONFIG_CMD_EXT4=y
>  CONFIG_CMD_EXT4_WRITE=y
>  CONFIG_CMD_FAT=y
>  CONFIG_CMD_FS_GENERIC=y
> +CONFIG_EFI_PARTITION=y
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_STMICRO=y
> 

Thanks for checking this, I apply it.

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] [PATCHv1] mx53ppd: Change UART clock divider for high baudrate

2018-02-18 Thread Stefano Babic
Hi Rick,

On 18/02/2018 00:24, Rick Bronson wrote:
> Hi Fabio,
> 
>   First a disclaimer.  I no longer work for the client that had me
> make this change.  I also no longer have any iMX53 hardware to do any
> kind of tests.  But I'm happy to help out with this email.
> 

Thanks for your support !

>> Hi Rick and Sebastian,
>>
>> On Thu, Feb 15, 2018 at 2:15 PM, Sebastian Reichel
>>  wrote:
>>> From: Rick Bronson 
>>>
>>> Allow higher UART baud rates for communications to ACHC at 13.5 MBaud
>>
>> What does ACHC mean?
> 
>   ACHC is an product acronym, probably should change that sentence to:
> 
> Allow higher UART baud rates for communications up to 13.5 MBaud

ok, understood. The whole commit message is misleading, and it is not
clear what the patch is supposed to address.

> 
>>> Done in u-boot since it changes a divider common to all UARTs, including
>>> the console. If it were done in Linux we would get garbled characters
>>> during the handoff from u-boot to the kernel.
>>
>> It would be nice to explain a bit how you achieve the higher baud rates.
> 
>   Background: PLL2 runs at 400 MHz, PLL3 runs at 216 MHz.  One of
> these PLL's are fed to a UART divider, the output of which sets the
> maximum UART baud rates that are based on these rates divided by 16.

ok

> 
>   Before patch: PLL3 (400 MHz) for UART's, divide by 6, get 66.66 MHz
> from it.  Max baud rate is 4.166 MBaud.
> 

Generally enough for a console

>   After patch: PLL2 (216 MHz), divide by 1, get 216 MHz from it.  Max
> baud rate is 13.5 MBaud.
>
>   The last I saw this code was 2014 so it's a little fuzzy.  Not sure
> why I didn't keep PLL3 and just change the divider from 6 to 3, that
> would have allowed a max of 8.33 MBaud and at the time, I was just
> looking for at least 8 MBaud.

ok, understood. In any case, it looks to me that this requirement is
very specific to this target (even if I have not got why we cannot set
the parent clock in the DT in linux, it would be my first choice). It
should be implemented into board code, and not in lowlevelinit with some
#ifdef. We already spent a lot of effort to reduce nasty compiler switch
in common code.

> 
>>
>> Looks like you don't use PLL2 as the UART clock anyomore.
> 
>   That's correct, see above.
> 
>>
>> Please expland a bit further on the new UART clock sheme.
>>
>>>
>>> Signed-off-by: Sebastian Reichel 
>>> ---
>>>  arch/arm/mach-imx/mx5/lowlevel_init.S | 4 
>>>  1 file changed, 4 insertions(+)
>>>
>>> diff --git a/arch/arm/mach-imx/mx5/lowlevel_init.S
> b/arch/arm/mach-imx/mx5/lowlevel_init.S
>>> index f5bc6728b7c2..ee4c3afd2fed 100644
>>> --- a/arch/arm/mach-imx/mx5/lowlevel_init.S
>>> +++ b/arch/arm/mach-imx/mx5/lowlevel_init.S
>>> @@ -319,11 +319,13 @@ setup_pll_func:
>>> ldr r1, =0x00016154
>>> str r1, [r0, #CLKCTL_CBCMR]
>>>
>>> +#if !defined(CONFIG_TARGET_MX53PPD)
>>
>> It would be better if this option could be a generic one, something
>> like CONFIG_MX53_SERIAL_HIGHBAUD, so that other boads could use it if
>> needed.
> 
>   Yes it probably would.

Anyway, I have doubt this is useful. U-Boot is just a bootloader, and
the high baud protocol is running in Linux. It is not used in U-Boot,
because U-Boot needs just a console. The well known approach in kernel
is to not rely to the bootloader (I know there are some exceptions..).
Kernel sets all peripherals and does not bother what the bootloader did
or didn't. This is really a good approach and makes no sense to add some
kind of dependency here.

Best regards,
Stefano Babic


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


[U-Boot] [PATCH 1/1][for v2018.03] efi_loader: clear signaled state in CheckEvent

2018-02-18 Thread Heinrich Schuchardt
CheckEvent must clear the signaled state.

Signed-off-by: Heinrich Schuchardt 
---
 lib/efi_loader/efi_boottime.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 6eea2395c7..f6113f7920 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -816,7 +816,8 @@ static efi_status_t EFIAPI efi_close_event(struct efi_event 
*event)
  * See the Unified Extensible Firmware Interface (UEFI) specification
  * for details.
  *
- * If an event is not signaled yet the notification function is queued.
+ * If an event is not signaled yet, the notification function is queued.
+ * The signaled state is cleared.
  *
  * @event  event to check
  * @return status code
@@ -834,8 +835,10 @@ static efi_status_t EFIAPI efi_check_event(struct 
efi_event *event)
break;
if (!event->is_signaled)
efi_signal_event(event, true);
-   if (event->is_signaled)
+   if (event->is_signaled) {
+   event->is_signaled = false;
return EFI_EXIT(EFI_SUCCESS);
+   }
return EFI_EXIT(EFI_NOT_READY);
}
return EFI_EXIT(EFI_INVALID_PARAMETER);
-- 
2.14.2

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