[U-Boot] [PATCH][v2]board/ls2080ardb: Update board env based on SoC

2017-09-05 Thread Priyanka Jain
As per current implementation, default value of board env is
based on board filename i.e ls2080ardb.

With distro support changes, this env is used to decide upon
kernel dtb which is different for other SoCs (ls2088a, ls2081a)
combination supported with this board.

Add support to modify board env at runtime based on SoC type

Signed-off-by: Priyanka Jain 
---
Changes for v2:
  Replace setenv() with env_set()

 board/freescale/ls2080ardb/ls2080ardb.c |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/board/freescale/ls2080ardb/ls2080ardb.c 
b/board/freescale/ls2080ardb/ls2080ardb.c
index 07ba026..dba0988 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -247,6 +247,8 @@ int misc_init_r(void)
char *env_hwconfig;
u32 __iomem *dcfg_ccsr = (u32 __iomem *)DCFG_BASE;
u32 val;
+   struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+   u32 svr = gur_in32(>svr);
 
val = in_le32(dcfg_ccsr + DCFG_RCWSR13 / 4);
 
@@ -274,6 +276,16 @@ int misc_init_r(void)
 
if (adjust_vdd(0))
printf("Warning: Adjusting core voltage failed.\n");
+   /*
+* Default value of board env is based on filename which is
+* ls2080ardb. Modify board env for other supported SoCs
+*/
+   if ((SVR_SOC_VER(svr) == SVR_LS2088A) ||
+   (SVR_SOC_VER(svr) == SVR_LS2048A))
+   setenv("board", "ls2088ardb");
+   else if ((SVR_SOC_VER(svr) == SVR_LS2081A) ||
+   (SVR_SOC_VER(svr) == SVR_LS2041A))
+   setenv("board", "ls2081ardb");
 
return 0;
 }
-- 
1.7.4.1

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


[U-Boot] [PATCH v2 2/2] tools: .gitignore: Add libfdt related files

2017-09-05 Thread Bin Meng
Some files are generated during libfdt build. Ignore them.

This was wrongly put in the .gitignore in the root directory before.
Now let's remove entries there and put them in the right place.

Fixes: 34e2c285 ("gitignore: add intermediates from libfdt build")
Signed-off-by: Bin Meng 

---

Changes in v2:
- remove commit 34e2c285 did

 .gitignore   | 8 
 tools/.gitignore | 4 
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/.gitignore b/.gitignore
index f6f5dae..29757aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,14 +57,6 @@ fit-dtb.blob
 /include/config/
 /include/generated/
 
-# Since "ee95d10 fdt: Build the new python libfdt module", a number of
-# build artifacts and intermediated from the python libfdt module are
-# installed into the /tools directory.
-/tools/_libfdt.so
-/tools/libfdt.py
-/tools/libfdt.pyc
-/tools/libfdt_wrap.c
-
 # stgit generated dirs
 patches-*
 .stgit-edit.txt
diff --git a/tools/.gitignore b/tools/.gitignore
index 6a487d2..5293d44 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -1,3 +1,4 @@
+/_libfdt.so
 /atmel_pmecc_params
 /bin2header
 /bmp_logo
@@ -16,6 +17,9 @@
 /img2srec
 /kwboot
 /lib/
+/libfdt.py
+/libfdt.pyc
+/libfdt_wrap.c
 /mips-relocs
 /mkenvimage
 /mkexynosspl
-- 
2.9.2

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


[U-Boot] [PATCH v2 1/2] tools: .gitignore: Sort in alphabetical order

2017-09-05 Thread Bin Meng
These are currently out of alphabetical order.

Signed-off-by: Bin Meng 
---

Changes in v2: None

 tools/.gitignore | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tools/.gitignore b/tools/.gitignore
index ac0c979..6a487d2 100644
--- a/tools/.gitignore
+++ b/tools/.gitignore
@@ -1,31 +1,30 @@
 /atmel_pmecc_params
 /bin2header
 /bmp_logo
+/common/
+/dumpimage
+/easylogo/easylogo
 /envcrc
 /fdtgrep
 /fit_check_sign
 /fit_info
+/gdb/gdbcont
+/gdb/gdbsend
 /gen_eth_addr
 /gen_ethaddr_crc
 /ifdtool
 /img2srec
 /kwboot
-/dumpimage
+/lib/
 /mips-relocs
 /mkenvimage
-/mkimage
 /mkexynosspl
-/mxsboot
+/mkimage
 /mksunxiboot
-/sunxi-spl-image-builder
+/mxsboot
 /ncb
 /proftool
 /relocate-rela
+/sunxi-spl-image-builder
 /ubsha1
 /xway-swap-bytes
-/easylogo/easylogo
-/gdb/gdbcont
-/gdb/gdbsend
-
-/lib/
-/common/
-- 
2.9.2

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


[U-Boot] [PATCH v4 10/12] ARM: at91: mach: Add missing defines of MPDDRC

2017-09-05 Thread Wenyou Yang
Add missing defines of Multiport DDR-SDRAM Controller (MPDDRC).

Signed-off-by: Wenyou Yang 
Reviewed-by: Simon Glass 
---

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

 arch/arm/mach-at91/include/mach/atmel_mpddrc.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-at91/include/mach/atmel_mpddrc.h 
b/arch/arm/mach-at91/include/mach/atmel_mpddrc.h
index 803501f5cf..40e1cf0a0a 100644
--- a/arch/arm/mach-at91/include/mach/atmel_mpddrc.h
+++ b/arch/arm/mach-at91/include/mach/atmel_mpddrc.h
@@ -96,6 +96,10 @@ int ddr3_init(const unsigned int base,
 #define ATMEL_MPDDRC_CR_DLL_RESET_ENABLED  (0x1 << 7)
 #define ATMEL_MPDDRC_CR_DIC_DS (0x1 << 8)
 #define ATMEL_MPDDRC_CR_DIS_DLL(0x1 << 9)
+#define ATMEL_MPDDRC_CR_ZQ_INIT(0x0 << 10)
+#define ATMEL_MPDDRC_CR_ZQ_LONG(0x1 << 10)
+#define ATMEL_MPDDRC_CR_ZQ_SHORT   (0x2 << 10)
+#define ATMEL_MPDDRC_CR_ZQ_RESET   (0x3 << 10)
 #define ATMEL_MPDDRC_CR_OCD_DEFAULT(0x7 << 12)
 #define ATMEL_MPDDRC_CR_DQMS_SHARED(0x1 << 16)
 #define ATMEL_MPDDRC_CR_ENRDM_ON   (0x1 << 17)
-- 
2.13.0

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


[U-Boot] [PATCH v4 09/12] board: sama5d2_xplained: Make SPL work on spiflash

2017-09-05 Thread Wenyou Yang
Because before switching to a lower clock source, we must switch
the clock source first instead of last. So before configuring the
PMC_MCKR register, invoke at91_mck_init_down() first.

As said in datasheet, the the size of SPL must not exceed the maximum
size allowed(64Kbytes).

Signed-off-by: Wenyou Yang 
---

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

 board/atmel/sama5d2_xplained/sama5d2_xplained.c | 10 ++
 include/configs/sama5d2_xplained.h  |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c 
b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
index 7e0cb4228f..5758653030 100644
--- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c
+++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
@@ -247,6 +247,16 @@ void at91_pmc_init(void)
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
u32 tmp;
 
+   /*
+* while coming from the ROM code, we run on PLLA @ 492 MHz / 164 MHz
+* so we need to slow down and configure MCKR accordingly.
+* This is why we have a special flavor of the switching function.
+*/
+   tmp = AT91_PMC_MCKR_PLLADIV_2 |
+ AT91_PMC_MCKR_MDIV_3 |
+ AT91_PMC_MCKR_CSS_MAIN;
+   at91_mck_init_down(tmp);
+
tmp = AT91_PMC_PLLAR_29 |
  AT91_PMC_PLLXR_PLLCOUNT(0x3f) |
  AT91_PMC_PLLXR_MUL(82) |
diff --git a/include/configs/sama5d2_xplained.h 
b/include/configs/sama5d2_xplained.h
index 891218d83e..aedd5684c4 100644
--- a/include/configs/sama5d2_xplained.h
+++ b/include/configs/sama5d2_xplained.h
@@ -61,7 +61,7 @@
 /* SPL */
 #define CONFIG_SPL_FRAMEWORK
 #define CONFIG_SPL_TEXT_BASE   0x20
-#define CONFIG_SPL_MAX_SIZE0x18000
+#define CONFIG_SPL_MAX_SIZE0x1
 #define CONFIG_SPL_BSS_START_ADDR  0x2000
 #define CONFIG_SPL_BSS_MAX_SIZE0x8
 #define CONFIG_SYS_SPL_MALLOC_START0x2008
-- 
2.13.0

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


[U-Boot] [PATCH v4 12/12] board: atmel: Add SAMA5D27 SOM1 EK board

2017-09-05 Thread Wenyou Yang
From: Wenyou Yang 

The SAMA5D27-SiP (System in Package) integrates the SAMA5D2
with 1Gbit DDR2-SDRAM in a single package.

The SAMA5D27 SOM1 embeds a 64Mbit QSPI flash, KSZ8081 Phy and
Mac-address EEPROM.

Signed-off-by: Wenyou Yang 
---

Changes in v4:
 - Rebase the uboot/master (84a4206).
 - Remove the default config file for the spiflash.
 - Integrate the following patches into this patch series.
   1./ [PATCH v2 0/3] board: atmel: Set the ethernet mac address from eeprom
   2./ [PATCH 1/7] lib: at91: Add logo files used by API from DM_VIDEO
   3./ [PATCH 2/7] atmel: common: Add function to display via DM_VIDEO's API
   4./ [PATCH] board: sama5d2_xplained: Make SPL work on spiflash
 - Remove the dependency on [PATCH 0/5] configs: at91: Remove value of 
CONFIG_SYS_EXTRA_OPTIONS option.

Changes in v3:
 - Rebase on the PATCH: Atmel PIT timer driver and Remove 
CONFIG_SYS_EXTRA_OPTIONS.
 - Use the new Atmel PIT timer driver.
 - Remove "SAMA5D2" from CONFIG_SYS_EXTRA_OPTIONS options.
 - Move CONFIG_ENV_IS_IN_FAT to Kconfig.

Changes in v2:
 - Add the reviewed-by tag.
 - Add the help in Kconfig to describe the board and peripherals.
 - Add the code to display the company's logo and board information.
 - Replace the code to set the ethernet mac address with the common
   code from the board/atmel/common folder.

 arch/arm/dts/Makefile   |   3 +
 arch/arm/dts/at91-sama5d27_som1_ek.dts  | 215 
 arch/arm/dts/sama5d2.dtsi   |  20 +++
 arch/arm/dts/sama5d27_som1.dtsi | 159 ++
 arch/arm/mach-at91/Kconfig  |  14 ++
 board/atmel/sama5d27_som1_ek/Kconfig|  15 ++
 board/atmel/sama5d27_som1_ek/MAINTAINERS|   6 +
 board/atmel/sama5d27_som1_ek/Makefile   |   8 +
 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c | 189 +
 configs/sama5d27_som1_ek_mmc_defconfig  |  88 ++
 include/configs/sama5d27_som1_ek.h  |  92 ++
 11 files changed, 809 insertions(+)
 create mode 100644 arch/arm/dts/at91-sama5d27_som1_ek.dts
 create mode 100644 arch/arm/dts/sama5d27_som1.dtsi
 create mode 100644 board/atmel/sama5d27_som1_ek/Kconfig
 create mode 100644 board/atmel/sama5d27_som1_ek/MAINTAINERS
 create mode 100644 board/atmel/sama5d27_som1_ek/Makefile
 create mode 100644 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c
 create mode 100644 configs/sama5d27_som1_ek_mmc_defconfig
 create mode 100644 include/configs/sama5d27_som1_ek.h

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 762429c463..d6afbd1b77 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -417,6 +417,9 @@ dtb-$(CONFIG_TARGET_OMAP3_LOGIC) += \
 dtb-$(CONFIG_TARGET_SAMA5D2_XPLAINED) += \
at91-sama5d2_xplained.dtb
 
+dtb-$(CONFIG_TARGET_SAMA5D27_SOM1_EK) += \
+   at91-sama5d27_som1_ek.dtb
+
 dtb-$(CONFIG_TARGET_SAMA5D3XEK) += \
sama5d31ek.dtb \
sama5d33ek.dtb \
diff --git a/arch/arm/dts/at91-sama5d27_som1_ek.dts 
b/arch/arm/dts/at91-sama5d27_som1_ek.dts
new file mode 100644
index 00..5e62d4af71
--- /dev/null
+++ b/arch/arm/dts/at91-sama5d27_som1_ek.dts
@@ -0,0 +1,215 @@
+/*
+ * at91-sama5d27_som1_ek.dts - Device Tree file for SAMA5D27 SOM1 EK board
+ *
+ *  Copyright (C) 2017 Microchip Corporation
+ * Wenyou Yang 
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * 

[U-Boot] [PATCH v4 08/12] ARM: at91: spl: Add boot device for boot from QSPI

2017-09-05 Thread Wenyou Yang
Add the boot device for booting from the QSPI flash.

Signed-off-by: Wenyou Yang 
Reviewed-by: Simon Glass 
---

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

 arch/arm/mach-at91/spl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-at91/spl.c b/arch/arm/mach-at91/spl.c
index e113336b7b..98337aebbe 100644
--- a/arch/arm/mach-at91/spl.c
+++ b/arch/arm/mach-at91/spl.c
@@ -56,6 +56,8 @@ u32 spl_boot_device(void)
if (dev == ATMEL_SAMA5_BOOT_FROM_SPI)
return BOOT_DEVICE_SPI;
 #endif
+   if (dev == ATMEL_SAMA5_BOOT_FROM_QSPI)
+   return BOOT_DEVICE_SPI;
 
if (dev == ATMEL_SAMA5_BOOT_FROM_SMC)
return BOOT_DEVICE_NAND;
-- 
2.13.0

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


[U-Boot] [PATCH v4 07/12] ARM: at91: spl: Add mck function to lower rate while switching

2017-09-05 Thread Wenyou Yang
Refer to the commit 70f8c8316ad(PMC: add new mck function to lower
rate while switching) from AT91Bootstrap.

While switching to a lower clock source, we must switch the clock
source first instead of last. Otherwise, we could end up with
too high frequency on internal bus and peripherals.
This happen on SAMA5D2 as we exit from ROM code @396MHz.

Add a function pmc_mck_init_down() to allow this sequence.

Signed-off-by: Wenyou Yang 
---

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

 arch/arm/mach-at91/armv7/clock.c  | 36 +++
 arch/arm/mach-at91/include/mach/at91_common.h |  1 +
 2 files changed, 37 insertions(+)

diff --git a/arch/arm/mach-at91/armv7/clock.c b/arch/arm/mach-at91/armv7/clock.c
index 2e55953799..8ae01f4020 100644
--- a/arch/arm/mach-at91/armv7/clock.c
+++ b/arch/arm/mach-at91/armv7/clock.c
@@ -150,6 +150,42 @@ void at91_mck_init(u32 mckr)
;
 }
 
+void at91_mck_init_down(u32 mckr)
+{
+   struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
+   u32 tmp;
+
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_CSS_MASK);
+   tmp |= (mckr & AT91_PMC_MCKR_CSS_MASK);
+   writel(tmp, >mckr);
+
+   while (!(readl(>sr) & AT91_PMC_MCKRDY))
+   ;
+
+#ifdef CPU_HAS_H32MXDIV
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_H32MXDIV);
+   tmp |= (mckr & AT91_PMC_MCKR_H32MXDIV);
+   writel(tmp, >mckr);
+#endif
+
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_PLLADIV_MASK);
+   tmp |= (mckr & AT91_PMC_MCKR_PLLADIV_MASK);
+   writel(tmp, >mckr);
+
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_MDIV_MASK);
+   tmp |= (mckr & AT91_PMC_MCKR_MDIV_MASK);
+   writel(tmp, >mckr);
+
+   tmp = readl(>mckr);
+   tmp &= (~AT91_PMC_MCKR_PRES_MASK);
+   tmp |= (mckr & AT91_PMC_MCKR_PRES_MASK);
+   writel(tmp, >mckr);
+}
+
 int at91_enable_periph_generated_clk(u32 id, u32 clk_source, u32 div)
 {
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
diff --git a/arch/arm/mach-at91/include/mach/at91_common.h 
b/arch/arm/mach-at91/include/mach/at91_common.h
index 5416eb455d..0b09ce7b2e 100644
--- a/arch/arm/mach-at91/include/mach/at91_common.h
+++ b/arch/arm/mach-at91/include/mach/at91_common.h
@@ -25,6 +25,7 @@ void at91_lcd_hw_init(void);
 void at91_plla_init(u32 pllar);
 void at91_pllb_init(u32 pllar);
 void at91_mck_init(u32 mckr);
+void at91_mck_init_down(u32 mckr);
 void at91_pmc_init(void);
 void mem_init(void);
 void at91_phy_reset(void);
-- 
2.13.0

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


[U-Boot] [PATCH v4 11/12] ARM: at91: Get the Chip ID of SAMA5D2 SiP

2017-09-05 Thread Wenyou Yang
From: Wenyou Yang 

The SAMA5D2 SiP(System in Package) has different Chip IDs in the
CHIPID and CHIP_EXID registers.

Signed-off-by: Wenyou Yang 
Reviewed-by: Simon Glass 
---

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

 arch/arm/mach-at91/armv7/sama5d2_devices.c | 26 --
 arch/arm/mach-at91/include/mach/sama5d2.h  |  7 ++-
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-at91/armv7/sama5d2_devices.c 
b/arch/arm/mach-at91/armv7/sama5d2_devices.c
index 978eac29bd..de1d9b5bfb 100644
--- a/arch/arm/mach-at91/armv7/sama5d2_devices.c
+++ b/arch/arm/mach-at91/armv7/sama5d2_devices.c
@@ -10,11 +10,20 @@
 #include 
 #include 
 
-char *get_cpu_name()
+int cpu_is_sama5d2(void)
 {
+   unsigned int chip_id = get_chip_id();
+
+   return ((chip_id == ARCH_ID_SAMA5D2) ||
+   (chip_id == ARCH_ID_SAMA5D2_SIP)) ? 1 : 0;
+}
+
+char *get_cpu_name(void)
+{
+   unsigned int chip_id = get_chip_id();
unsigned int extension_id = get_extension_chip_id();
 
-   if (cpu_is_sama5d2()) {
+   if (chip_id == ARCH_ID_SAMA5D2) {
switch (extension_id) {
case ARCH_EXID_SAMA5D21CU:
return "SAMA5D21";
@@ -41,6 +50,19 @@ char *get_cpu_name()
}
}
 
+   if ((chip_id == ARCH_ID_SAMA5D2) || (chip_id == ARCH_ID_SAMA5D2_SIP)) {
+   switch (extension_id) {
+   case ARCH_EXID_SAMA5D225C_D1M:
+   return "SAMA5D225 128M bits DDR2 SDRAM";
+   case ARCH_EXID_SAMA5D27C_D5M:
+   return "SAMA5D27 512M bits DDR2 SDRAM";
+   case ARCH_EXID_SAMA5D27C_D1G:
+   return "SAMA5D27 1G bits DDR2 SDRAM";
+   case ARCH_EXID_SAMA5D28C_D1G:
+   return "SAMA5D28 1G bits DDR2 SDRAM";
+   }
+   }
+
return "Unknown CPU type";
 }
 
diff --git a/arch/arm/mach-at91/include/mach/sama5d2.h 
b/arch/arm/mach-at91/include/mach/sama5d2.h
index 25c85411e5..49283ed86b 100644
--- a/arch/arm/mach-at91/include/mach/sama5d2.h
+++ b/arch/arm/mach-at91/include/mach/sama5d2.h
@@ -222,7 +222,11 @@
 #define ARCH_EXID_SAMA5D28CU   0x0010
 #define ARCH_EXID_SAMA5D28CN   0x0020
 
-#define cpu_is_sama5d2()   (get_chip_id() == ARCH_ID_SAMA5D2)
+#define ARCH_ID_SAMA5D2_SIP0x8a5c08c2
+#define ARCH_EXID_SAMA5D225C_D1M   0x0053
+#define ARCH_EXID_SAMA5D27C_D5M0x0032
+#define ARCH_EXID_SAMA5D27C_D1G0x0033
+#define ARCH_EXID_SAMA5D28C_D1G0x0013
 
 /* PIT Timer(PIT_PIIR) */
 #define CONFIG_SYS_TIMER_COUNTER   0xf804803c
@@ -233,6 +237,7 @@
 #ifndef __ASSEMBLY__
 unsigned int get_chip_id(void);
 unsigned int get_extension_chip_id(void);
+int cpu_is_sama5d2(void);
 unsigned int has_lcdc(void);
 char *get_cpu_name(void);
 #endif
-- 
2.13.0

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


[U-Boot] [PATCH v4 06/12] ARM: at91: spl: Adjust switching to oscillator for SAMA5D2

2017-09-05 Thread Wenyou Yang
As said in 29.5.7 section of SAMA5D2 datasheet, before switching to
the crystal oscillator, a check must be carried out to ensure that
the oscillator is present and that its freqency is valid.

Signed-off-by: Wenyou Yang 
Reviewed-by: Simon Glass 
---

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

 arch/arm/mach-at91/include/mach/at91_pmc.h |  2 ++
 arch/arm/mach-at91/spl_atmel.c | 18 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h 
b/arch/arm/mach-at91/include/mach/at91_pmc.h
index 2875ff20b1..08ad1bf2d0 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -87,6 +87,8 @@ typedef struct at91_pmc {
 
 #define AT91_PMC_MCFR_MAINRDY  0x0001
 #define AT91_PMC_MCFR_MAINF_MASK   0x
+#define AT91_PMC_MCFR_RCMEAS   0x0010
+#define AT91_PMC_MCFR_CCSS_XTAL_OSC0x0100
 
 #define AT91_PMC_MCKR_CSS_SLOW 0x
 #define AT91_PMC_MCKR_CSS_MAIN 0x0001
diff --git a/arch/arm/mach-at91/spl_atmel.c b/arch/arm/mach-at91/spl_atmel.c
index b75c2ccefd..ce16ef3bdb 100644
--- a/arch/arm/mach-at91/spl_atmel.c
+++ b/arch/arm/mach-at91/spl_atmel.c
@@ -32,6 +32,20 @@ static void switch_to_main_crystal_osc(void)
while (!(readl(>sr) & AT91_PMC_IXR_MOSCS))
;
 
+#if defined(CONFIG_SAMA5D2)
+   /* Enable a measurement of the external oscillator */
+   tmp = readl(>mcfr);
+   tmp |= AT91_PMC_MCFR_CCSS_XTAL_OSC;
+   tmp |= AT91_PMC_MCFR_RCMEAS;
+   writel(tmp, >mcfr);
+
+   while (!(readl(>mcfr) & AT91_PMC_MCFR_MAINRDY))
+   ;
+
+   if (!(readl(>mcfr) & AT91_PMC_MCFR_MAINF_MASK))
+   hang();
+#endif
+
tmp = readl(>mor);
tmp &= ~AT91_PMC_MOR_OSCBYPASS;
tmp &= ~AT91_PMC_MOR_KEY(0xff);
@@ -47,11 +61,13 @@ static void switch_to_main_crystal_osc(void)
while (!(readl(>sr) & AT91_PMC_IXR_MOSCSELS))
;
 
+#if !defined(CONFIG_SAMA5D2)
/* Wait until MAINRDY field is set to make sure main clock is stable */
while (!(readl(>mcfr) & AT91_PMC_MAINRDY))
;
+#endif
 
-#ifndef CONFIG_SAMA5D4
+#if !defined(CONFIG_SAMA5D4) && !defined(CONFIG_SAMA5D2)
tmp = readl(>mor);
tmp &= ~AT91_PMC_MOR_MOSCRCEN;
tmp &= ~AT91_PMC_MOR_KEY(0xff);
-- 
2.13.0

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


[U-Boot] [PATCH v4 05/12] atmel: common: Add function to display via DM_VIDEO's API

2017-09-05 Thread Wenyou Yang
Add a function to display the company's logo and board information
via the API from DM_VIDEO. This function can be shared by other
atmel boards, so locate it in board/atmel/common folder.

Signed-off-by: Wenyou Yang 
---

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

 arch/arm/mach-at91/include/mach/at91_common.h |  1 +
 board/atmel/common/Makefile   |  1 +
 board/atmel/common/video_display.c| 72 +++
 3 files changed, 74 insertions(+)
 create mode 100644 board/atmel/common/video_display.c

diff --git a/arch/arm/mach-at91/include/mach/at91_common.h 
b/arch/arm/mach-at91/include/mach/at91_common.h
index a95fe41610..5416eb455d 100644
--- a/arch/arm/mach-at91/include/mach/at91_common.h
+++ b/arch/arm/mach-at91/include/mach/at91_common.h
@@ -37,5 +37,6 @@ void redirect_int_from_saic_to_aic(void);
 void configure_2nd_sram_as_l2_cache(void);
 
 int at91_set_ethaddr(int offset);
+int at91_video_show_board_info(void);
 
 #endif /* AT91_COMMON_H */
diff --git a/board/atmel/common/Makefile b/board/atmel/common/Makefile
index 5a228bece8..f68dd74953 100644
--- a/board/atmel/common/Makefile
+++ b/board/atmel/common/Makefile
@@ -7,3 +7,4 @@
 
 obj-y += board.o
 obj-$(CONFIG_I2C_EEPROM) += mac_eeprom.o
+obj-$(CONFIG_DM_VIDEO) += video_display.o
diff --git a/board/atmel/common/video_display.c 
b/board/atmel/common/video_display.c
new file mode 100644
index 00..39ad619819
--- /dev/null
+++ b/board/atmel/common/video_display.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2017 Microchip
+ *   Wenyou Yang 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int at91_video_show_board_info(void)
+{
+   ulong dram_size, nand_size;
+   int i;
+   u32 len = 0;
+   char buf[255];
+   char *corp = "2017 Microchip Technology Inc.\n";
+   char temp[32];
+   struct udevice *dev, *con;
+   const char *s;
+   vidinfo_t logo_info;
+   int ret;
+
+   len += sprintf([len], "%s\n", U_BOOT_VERSION);
+   memcpy([len], corp, strlen(corp));
+   len += strlen(corp);
+   len += sprintf([len], "%s CPU at %s MHz\n", get_cpu_name(),
+   strmhz(temp, get_cpu_clk_rate()));
+
+   dram_size = 0;
+   for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++)
+   dram_size += gd->bd->bi_dram[i].size;
+
+   nand_size = 0;
+#ifdef CONFIG_NAND_ATMEL
+   for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++)
+   nand_size += nand_info[i]->size;
+#endif
+
+   len += sprintf([len], "%ld MB SDRAM, %ld MB NAND\n",
+  dram_size >> 20, nand_size >> 20);
+
+   ret = uclass_get_device(UCLASS_VIDEO, 0, );
+   if (ret)
+   return ret;
+
+   microchip_logo_info(_info);
+   ret = video_bmp_display(dev, logo_info.logo_addr,
+   logo_info.logo_x_offset,
+   logo_info.logo_y_offset, false);
+   if (ret)
+   return ret;
+
+   ret = uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, );
+   if (ret)
+   return ret;
+
+   vidconsole_position_cursor(con, 0, logo_info.logo_height);
+   for (s = buf, i = 0; i < len; s++, i++)
+   vidconsole_put_char(con, *s);
+
+   return 0;
+}
-- 
2.13.0

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


[U-Boot] [PATCH v4 02/12] board: sama5d2_xplained: Replace code of setting mac addr

2017-09-05 Thread Wenyou Yang
Replace the code of setting the ethernet mac address with the code
from the board/atmel/common folder.

Signed-off-by: Wenyou Yang 
---

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

 arch/arm/dts/at91-sama5d2_xplained.dts  |  5 +++
 board/atmel/sama5d2_xplained/sama5d2_xplained.c | 46 +++--
 configs/sama5d2_xplained_mmc_defconfig  |  1 +
 configs/sama5d2_xplained_spiflash_defconfig |  1 +
 include/configs/sama5d2_xplained.h  |  4 ---
 5 files changed, 11 insertions(+), 46 deletions(-)

diff --git a/arch/arm/dts/at91-sama5d2_xplained.dts 
b/arch/arm/dts/at91-sama5d2_xplained.dts
index 3e624f142c..b00aaa2c79 100644
--- a/arch/arm/dts/at91-sama5d2_xplained.dts
+++ b/arch/arm/dts/at91-sama5d2_xplained.dts
@@ -102,6 +102,11 @@
pinctrl-names = "default";
pinctrl-0 = <_i2c1_default>;
status = "okay";
+
+   i2c_eeprom: i2c_eeprom@5c {
+   compatible = "atmel,24mac402";
+   reg = <0x5c>;
+   };
};
 
pioA: gpio@fc038000 {
diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c 
b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
index 3f0860c555..7e0cb4228f 100644
--- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c
+++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
@@ -8,8 +8,6 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -161,50 +159,14 @@ int dram_init(void)
return 0;
 }
 
-#ifdef CONFIG_CMD_I2C
-static int set_ethaddr_from_eeprom(void)
-{
-   const int ETH_ADDR_LEN = 6;
-   unsigned char ethaddr[ETH_ADDR_LEN];
-   const char *ETHADDR_NAME = "ethaddr";
-   struct udevice *bus, *dev;
-
-   if (env_get(ETHADDR_NAME))
-   return 0;
-
-   if (uclass_get_device_by_seq(UCLASS_I2C, 1, )) {
-   printf("Cannot find I2C bus 1\n");
-   return -1;
-   }
-
-   if (dm_i2c_probe(bus, AT24MAC_ADDR, 0, )) {
-   printf("Failed to probe I2C chip\n");
-   return -1;
-   }
-
-   if (dm_i2c_read(dev, AT24MAC_REG, ethaddr, ETH_ADDR_LEN)) {
-   printf("Failed to read ethernet address from EEPROM\n");
-   return -1;
-   }
-
-   if (!is_valid_ethaddr(ethaddr)) {
-   printf("The ethernet address read from EEPROM is not valid!\n");
-   return -1;
-   }
-
-   return eth_env_set_enetaddr(ETHADDR_NAME, ethaddr);
-}
-#else
-static int set_ethaddr_from_eeprom(void)
-{
-   return 0;
-}
-#endif
+#define AT24MAC_MAC_OFFSET 0x9a
 
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
-   set_ethaddr_from_eeprom();
+#ifdef CONFIG_I2C_EEPROM
+   at91_set_ethaddr(AT24MAC_MAC_OFFSET);
+#endif
 
return 0;
 }
diff --git a/configs/sama5d2_xplained_mmc_defconfig 
b/configs/sama5d2_xplained_mmc_defconfig
index dc4d991512..01c60e8fa1 100644
--- a/configs/sama5d2_xplained_mmc_defconfig
+++ b/configs/sama5d2_xplained_mmc_defconfig
@@ -51,6 +51,7 @@ CONFIG_DM_GPIO=y
 CONFIG_ATMEL_PIO4=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ATMEL=y
diff --git a/configs/sama5d2_xplained_spiflash_defconfig 
b/configs/sama5d2_xplained_spiflash_defconfig
index c64b8b8e3b..2ecedd98f5 100644
--- a/configs/sama5d2_xplained_spiflash_defconfig
+++ b/configs/sama5d2_xplained_spiflash_defconfig
@@ -49,6 +49,7 @@ CONFIG_DM_GPIO=y
 CONFIG_ATMEL_PIO4=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ATMEL=y
diff --git a/include/configs/sama5d2_xplained.h 
b/include/configs/sama5d2_xplained.h
index 9ceb91924d..891218d83e 100644
--- a/include/configs/sama5d2_xplained.h
+++ b/include/configs/sama5d2_xplained.h
@@ -35,10 +35,6 @@
 #define CONFIG_SF_DEFAULT_SPEED3000
 #endif
 
-/* I2C */
-#define AT24MAC_ADDR   0x5c
-#define AT24MAC_REG0x9a
-
 /* LCD */
 
 #ifdef CONFIG_LCD
-- 
2.13.0

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


[U-Boot] [PATCH v4 03/12] board: sama5d4_xplained: Set mac address from eeprom

2017-09-05 Thread Wenyou Yang
Add the code of setting the ethernet mac address from eeprom
via the common code from the common folder.

Signed-off-by: Wenyou Yang 
---

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

 arch/arm/dts/at91-sama5d4_xplained.dts  |  5 +
 board/atmel/sama5d4_xplained/sama5d4_xplained.c | 12 
 configs/sama5d4_xplained_mmc_defconfig  |  3 +++
 configs/sama5d4_xplained_nandflash_defconfig|  3 +++
 configs/sama5d4_xplained_spiflash_defconfig |  3 +++
 include/configs/sama5d4_xplained.h  |  2 ++
 6 files changed, 28 insertions(+)

diff --git a/arch/arm/dts/at91-sama5d4_xplained.dts 
b/arch/arm/dts/at91-sama5d4_xplained.dts
index ca6aff28e5..0592b31b91 100644
--- a/arch/arm/dts/at91-sama5d4_xplained.dts
+++ b/arch/arm/dts/at91-sama5d4_xplained.dts
@@ -88,6 +88,11 @@
 
i2c0: i2c@f8014000 {
status = "okay";
+
+   i2c_eeprom: i2c_eeprom@5c {
+   compatible = "atmel,24mac402";
+   reg = <0x5c>;
+   };
};
 
macb0: ethernet@f802 {
diff --git a/board/atmel/sama5d4_xplained/sama5d4_xplained.c 
b/board/atmel/sama5d4_xplained/sama5d4_xplained.c
index 854afcb622..248a31b8c4 100644
--- a/board/atmel/sama5d4_xplained/sama5d4_xplained.c
+++ b/board/atmel/sama5d4_xplained/sama5d4_xplained.c
@@ -192,6 +192,18 @@ int board_early_init_f(void)
 }
 #endif
 
+#define AT24MAC_MAC_OFFSET 0x9a
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_I2C_EEPROM
+   at91_set_ethaddr(AT24MAC_MAC_OFFSET);
+#endif
+   return 0;
+}
+#endif
+
 int board_init(void)
 {
/* adress of boot parameters */
diff --git a/configs/sama5d4_xplained_mmc_defconfig 
b/configs/sama5d4_xplained_mmc_defconfig
index 0c2b63dab9..ffc01f4384 100644
--- a/configs/sama5d4_xplained_mmc_defconfig
+++ b/configs/sama5d4_xplained_mmc_defconfig
@@ -47,6 +47,9 @@ CONFIG_AT91_UTMI=y
 CONFIG_AT91_H32MX=y
 CONFIG_DM_GPIO=y
 CONFIG_AT91_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/configs/sama5d4_xplained_nandflash_defconfig 
b/configs/sama5d4_xplained_nandflash_defconfig
index 3a2dcb12b9..3abfa4fb94 100644
--- a/configs/sama5d4_xplained_nandflash_defconfig
+++ b/configs/sama5d4_xplained_nandflash_defconfig
@@ -44,6 +44,9 @@ CONFIG_AT91_UTMI=y
 CONFIG_AT91_H32MX=y
 CONFIG_DM_GPIO=y
 CONFIG_AT91_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/configs/sama5d4_xplained_spiflash_defconfig 
b/configs/sama5d4_xplained_spiflash_defconfig
index d82a4cddf2..d8a126ce1b 100644
--- a/configs/sama5d4_xplained_spiflash_defconfig
+++ b/configs/sama5d4_xplained_spiflash_defconfig
@@ -46,6 +46,9 @@ CONFIG_AT91_UTMI=y
 CONFIG_AT91_H32MX=y
 CONFIG_DM_GPIO=y
 CONFIG_AT91_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_AT91=y
+CONFIG_I2C_EEPROM=y
 CONFIG_DM_MMC=y
 CONFIG_GENERIC_ATMEL_MCI=y
 CONFIG_DM_SPI_FLASH=y
diff --git a/include/configs/sama5d4_xplained.h 
b/include/configs/sama5d4_xplained.h
index c8462b0b64..08f865016d 100644
--- a/include/configs/sama5d4_xplained.h
+++ b/include/configs/sama5d4_xplained.h
@@ -12,6 +12,8 @@
 
 #include "at91-sama5_common.h"
 
+#define CONFIG_MISC_INIT_R
+
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS   1
 #define CONFIG_SYS_SDRAM_BASE   ATMEL_BASE_DDRCS
-- 
2.13.0

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


[U-Boot] [PATCH v4 01/12] board: atmel: Create board/atmel/common folder

2017-09-05 Thread Wenyou Yang
Create board/atmel/common folder to accommodate the common code
shared by other atmel boards, now move the code of setting ethernet
mac address from eeprom, which uses the i2c eeprom driver.

Signed-off-by: Wenyou Yang 
---

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

 arch/arm/mach-at91/include/mach/at91_common.h |  2 ++
 board/atmel/common/Makefile   |  9 +++
 board/atmel/common/board.c| 12 +
 board/atmel/common/mac_eeprom.c   | 36 +++
 4 files changed, 59 insertions(+)
 create mode 100644 board/atmel/common/Makefile
 create mode 100644 board/atmel/common/board.c
 create mode 100644 board/atmel/common/mac_eeprom.c

diff --git a/arch/arm/mach-at91/include/mach/at91_common.h 
b/arch/arm/mach-at91/include/mach/at91_common.h
index 0742ffc56f..a95fe41610 100644
--- a/arch/arm/mach-at91/include/mach/at91_common.h
+++ b/arch/arm/mach-at91/include/mach/at91_common.h
@@ -36,4 +36,6 @@ void matrix_init(void);
 void redirect_int_from_saic_to_aic(void);
 void configure_2nd_sram_as_l2_cache(void);
 
+int at91_set_ethaddr(int offset);
+
 #endif /* AT91_COMMON_H */
diff --git a/board/atmel/common/Makefile b/board/atmel/common/Makefile
new file mode 100644
index 00..5a228bece8
--- /dev/null
+++ b/board/atmel/common/Makefile
@@ -0,0 +1,9 @@
+#
+# Copyright (C) 2017 Microchip
+#Wenyou Yang 
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += board.o
+obj-$(CONFIG_I2C_EEPROM) += mac_eeprom.o
diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c
new file mode 100644
index 00..7e326d925b
--- /dev/null
+++ b/board/atmel/common/board.c
@@ -0,0 +1,12 @@
+/*
+ * Copyright (C) 2017 Microchip
+ *   Wenyou Yang 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+
+void dummy(void)
+{
+}
diff --git a/board/atmel/common/mac_eeprom.c b/board/atmel/common/mac_eeprom.c
new file mode 100644
index 00..60ddf00d45
--- /dev/null
+++ b/board/atmel/common/mac_eeprom.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2017 Microchip
+ *   Wenyou Yang 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+int at91_set_ethaddr(int offset)
+{
+   const int ETH_ADDR_LEN = 6;
+   unsigned char ethaddr[ETH_ADDR_LEN];
+   const char *ETHADDR_NAME = "ethaddr";
+   struct udevice *dev;
+   int ret;
+
+   if (env_get(ETHADDR_NAME))
+   return 0;
+
+   ret = uclass_first_device_err(UCLASS_I2C_EEPROM, );
+   if (ret)
+   return ret;
+
+   ret = i2c_eeprom_read(dev, offset, ethaddr, 6);
+   if (ret)
+   return ret;
+
+   if (is_valid_ethaddr(ethaddr))
+   eth_env_set_enetaddr(ETHADDR_NAME, ethaddr);
+
+   return 0;
+}
-- 
2.13.0

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


[U-Boot] [PATCH v4 00/12] board: atmel: Add new board SAMA5D27-SOM1-EK board.

2017-09-05 Thread Wenyou Yang
The SAMA5D27-SOM1-EK board embeds a SAMA5D27 SOM1 module, which includes
a SAMA5D27-SiP chip and QSPI flash, Phy and MAC EEPROM. The SAMA5D27 SiP
integrates the SAMA5D2 with 1Gbit DDR2-SDRAM in a single package.
It is based on the patch,
[PATCH v2] misc: Kconfig: Add SPL_I2C_EEPROM option
https://lists.denx.de/pipermail/u-boot/2017-September/304914.html

Changes in v4:
 - Rebase the uboot/master (84a4206).
 - Remove the default config file for the spiflash.
 - Integrate the following patches into this patch series.
   1./ [PATCH v2 0/3] board: atmel: Set the ethernet mac address from eeprom
   2./ [PATCH 1/7] lib: at91: Add logo files used by API from DM_VIDEO
   3./ [PATCH 2/7] atmel: common: Add function to display via DM_VIDEO's API
   4./ [PATCH] board: sama5d2_xplained: Make SPL work on spiflash
 - Remove the dependency on [PATCH 0/5] configs: at91: Remove value of 
CONFIG_SYS_EXTRA_OPTIONS option.

Changes in v3:
 - Rebase on the PATCH: Atmel PIT timer driver and Remove 
CONFIG_SYS_EXTRA_OPTIONS.
 - Use the new Atmel PIT timer driver.
 - Remove "SAMA5D2" from CONFIG_SYS_EXTRA_OPTIONS options.
 - Move CONFIG_ENV_IS_IN_FAT to Kconfig.

Changes in v2:
 - Add the reviewed-by tag.
 - Add the help in Kconfig to describe the board and peripherals.
 - Add the code to display the company's logo and board information.
 - Replace the code to set the ethernet mac address with the common
   code from the board/atmel/common folder.

Wenyou Yang (12):
  board: atmel: Create board/atmel/common folder
  board: sama5d2_xplained: Replace code of setting mac addr
  board: sama5d4_xplained: Set mac address from eeprom
  lib: at91: Add logo files used via API of DM_VIDEO
  atmel: common: Add function to display via DM_VIDEO's API
  ARM: at91: spl: Adjust switching to oscillator for SAMA5D2
  ARM: at91: spl: Add mck function to lower rate while switching
  ARM: at91: spl: Add boot device for boot from QSPI
  board: sama5d2_xplained: Make SPL work on spiflash
  ARM: at91: mach: Add missing defines of MPDDRC
  ARM: at91: Get the Chip ID of SAMA5D2 SiP
  board: atmel: Add SAMA5D27 SOM1 EK board

 arch/arm/dts/Makefile   |3 +
 arch/arm/dts/at91-sama5d27_som1_ek.dts  |  215 
 arch/arm/dts/at91-sama5d2_xplained.dts  |5 +
 arch/arm/dts/at91-sama5d4_xplained.dts  |5 +
 arch/arm/dts/sama5d2.dtsi   |   20 +
 arch/arm/dts/sama5d27_som1.dtsi |  159 +++
 arch/arm/mach-at91/Kconfig  |   14 +
 arch/arm/mach-at91/armv7/clock.c|   36 +
 arch/arm/mach-at91/armv7/sama5d2_devices.c  |   26 +-
 arch/arm/mach-at91/include/mach/at91_common.h   |4 +
 arch/arm/mach-at91/include/mach/at91_pmc.h  |2 +
 arch/arm/mach-at91/include/mach/atmel_mpddrc.h  |4 +
 arch/arm/mach-at91/include/mach/sama5d2.h   |7 +-
 arch/arm/mach-at91/spl.c|2 +
 arch/arm/mach-at91/spl_atmel.c  |   18 +-
 board/atmel/common/Makefile |   10 +
 board/atmel/common/board.c  |   12 +
 board/atmel/common/mac_eeprom.c |   36 +
 board/atmel/common/video_display.c  |   72 ++
 board/atmel/sama5d27_som1_ek/Kconfig|   15 +
 board/atmel/sama5d27_som1_ek/MAINTAINERS|6 +
 board/atmel/sama5d27_som1_ek/Makefile   |8 +
 board/atmel/sama5d27_som1_ek/sama5d27_som1_ek.c |  189 
 board/atmel/sama5d2_xplained/sama5d2_xplained.c |   56 +-
 board/atmel/sama5d4_xplained/sama5d4_xplained.c |   12 +
 configs/sama5d27_som1_ek_mmc_defconfig  |   88 ++
 configs/sama5d2_xplained_mmc_defconfig  |1 +
 configs/sama5d2_xplained_spiflash_defconfig |1 +
 configs/sama5d4_xplained_mmc_defconfig  |3 +
 configs/sama5d4_xplained_nandflash_defconfig|3 +
 configs/sama5d4_xplained_spiflash_defconfig |3 +
 include/atmel_lcd.h |9 +
 include/configs/sama5d27_som1_ek.h  |   92 ++
 include/configs/sama5d2_xplained.h  |6 +-
 include/configs/sama5d4_xplained.h  |2 +
 lib/Makefile|1 +
 lib/at91/Makefile   |8 +
 lib/at91/at91.c |   30 +
 lib/at91/atmel_logo_8bpp.h  | 1310 +++
 lib/at91/microchip_logo_8bpp.h  | 1082 +++
 tools/logos/microchip.bmp   |  Bin 0 -> 12726 bytes
 41 files changed, 3524 insertions(+), 51 deletions(-)
 create mode 100644 arch/arm/dts/at91-sama5d27_som1_ek.dts
 create mode 100644 arch/arm/dts/sama5d27_som1.dtsi
 create mode 100644 board/atmel/common/Makefile
 create mode 100644 board/atmel/common/board.c
 create mode 100644 board/atmel/common/mac_eeprom.c
 create mode 100644 board/atmel/common/video_display.c
 create mode 100644 

Re: [U-Boot] [PATCH] gitignore: add intermediates from libfdt build

2017-09-05 Thread Bin Meng
On Wed, Sep 6, 2017 at 9:12 AM, Tom Rini  wrote:
> On Tue, Sep 05, 2017 at 04:57:07PM +0800, Simon Glass wrote:
>> Hi Bin,
>>
>> On 5 September 2017 at 09:33, Bin Meng  wrote:
>> > On Thu, Aug 31, 2017 at 8:52 PM, Simon Glass  wrote:
>> >> On 29 August 2017 at 17:47, Philipp Tomsich
>> >>  wrote:
>> >>> Since ee95d10 (fdt: Build the new python libfdt module), a number of
>> >>> additional files are auto-generated/installed into the tools directory.
>> >>> List these in .gitignore to suppress having them listed as untracked.
>> >>>
>> >>> Signed-off-by: Philipp Tomsich 
>> >>> References: ee95d10 (fdt: Build the new python libfdt module)
>> >>>
>> >>> ---
>> >>>
>> >>>  .gitignore | 8 
>> >>>  1 file changed, 8 insertions(+)
>> >>
>> >> Reviewed-by: Simon Glass 
>> >
>> > I just noticed this. Shouldn't this be put in the tools/.gitignore instead?
>> >
>> > I have a similar patch @ http://patchwork.ozlabs.org/patch/809493/
>>
>> Yes you are probably right. I have already sent a pull request though.
>>
>> Tom what do you think?
>
> We have many examples of .gitignore in subdirectories, so lets continue
> there.  I believe that keeps the file manageable.

I will post a v2 to fix this.

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


[U-Boot] [PATCH v2] misc: Kconfig: Add SPL_I2C_EEPROM option

2017-09-05 Thread Wenyou Yang
This option is an SPL-variant of the I2C_EEPROM option to enable
the driver for generic I2C-attached EEPROMs for SPL.

Signed-off-by: Wenyou Yang 
---

Changes in v2:
 - Rebase the uboot/master (84a4206).

 drivers/misc/Kconfig  | 8 
 drivers/misc/Makefile | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 3d282d5b14..4133017e32 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -197,6 +197,14 @@ config I2C_EEPROM
help
  Enable a generic driver for EEPROMs attached via I2C.
 
+
+config SPL_I2C_EEPROM
+   bool "Enable driver for generic I2C-attached EEPROMs for SPL"
+   depends on MISC && SPL && SPL_DM
+   help
+ This option is an SPL-variant of the I2C_EEPROM option.
+ See the help of I2C_EEPROM for details.
+
 if I2C_EEPROM
 
 config SYS_I2C_EEPROM_ADDR
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 10265c8fb4..21f7e6c6f5 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -20,7 +20,7 @@ obj-$(CONFIG_CROS_EC_SPI) += cros_ec_spi.o
 endif
 obj-$(CONFIG_FSL_IIM) += fsl_iim.o
 obj-$(CONFIG_LED_STATUS_GPIO) += gpio_led.o
-obj-$(CONFIG_I2C_EEPROM) += i2c_eeprom.o
+obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o
 obj-$(CONFIG_FSL_MC9SDZ60) += mc9sdz60.o
 obj-$(CONFIG_MXC_OCOTP) += mxc_ocotp.o
 obj-$(CONFIG_MXS_OCOTP) += mxs_ocotp.o
-- 
2.13.0

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


Re: [U-Boot] [PATCH 03/19] arm: socfpga: Add driver for flash to program FPGA

2017-09-05 Thread Chee, Tien Fong
On Sel, 2017-09-05 at 11:36 +0200, Marek Vasut wrote:
> On 09/05/2017 11:23 AM, Chee, Tien Fong wrote:
> > 
> > On Sel, 2017-09-05 at 11:04 +0200, Marek Vasut wrote:
> > > 
> > > On 09/05/2017 07:53 AM, Chee, Tien Fong wrote:
> > > > 
> > > > 
> > > > On Isn, 2017-09-04 at 11:39 +0200, Marek Vasut wrote:
> > > > > 
> > > > > 
> > > > > On 09/04/2017 09:08 AM, Chee, Tien Fong wrote:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > On Rab, 2017-08-30 at 10:52 +0200, Marek Vasut wrote:
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > On 08/30/2017 10:05 AM, Chee, Tien Fong wrote:
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > On Sel, 2017-08-29 at 13:55 +0200, Marek Vasut wrote:
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > On 08/29/2017 12:45 PM, tien.fong.c...@intel.com
> > > > > > > > > wrote:
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > 
> > > > > > > > > > From: Tien Fong Chee 
> > > > > > > > > > 
> > > > > > > > > > This driver handles FPGA program operation from
> > > > > > > > > > flash
> > > > > > > > > > loading
> > > > > > > > > > RBF to memory and then to program FPGA.
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Tien Fong Chee  > > > > > > > > > .com
> > > > > > > > > > > 
> > > > > > > > > > > 
> > > > > > > > > > ---
> > > > > > > > > >  .../include/mach/fpga_manager_arria10.h   
> > > > > > > > > >  |  
> > > > > > > > > >  27
> > > > > > > > > > ++
> > > > > > > > > >  drivers/fpga/socfpga_arria10.c
> > > > > > > > > >  |  
> > > > > > > > > > 386
> > > > > > > > > > +++-
> > > > > > > > > >  include/altera.h  
> > > > > > > > > >  |  
> > > > > > > > > >   6
> > > > > > > > > > +
> > > > > > > > > >  include/configs/socfpga_common.h  
> > > > > > > > > >  |  
> > > > > > > > > >   4
> > > > > > > > > > +
> > > > > > > > > >  4 files changed, 422 insertions(+), 1 deletions(-)
> > > > > > > > > > 
> > > > > > > > > > diff --git a/arch/arm/mach-
> > > > > > > > > > socfpga/include/mach/fpga_manager_arria10.h
> > > > > > > > > > b/arch/arm/mach-
> > > > > > > > > > socfpga/include/mach/fpga_manager_arria10.h
> > > > > > > > > > index 9cbf696..93a9122 100644
> > > > > > > > > > --- a/arch/arm/mach-
> > > > > > > > > > socfpga/include/mach/fpga_manager_arria10.h
> > > > > > > > > > +++ b/arch/arm/mach-
> > > > > > > > > > socfpga/include/mach/fpga_manager_arria10.h
> > > > > > > > > > @@ -8,6 +8,8 @@
> > > > > > > > > >  #ifndef _FPGA_MANAGER_ARRIA10_H_
> > > > > > > > > >  #define _FPGA_MANAGER_ARRIA10_H_
> > > > > > > > > >  
> > > > > > > > > > +#include 
> > > > > > > > > > +
> > > > > > > > > >  #define
> > > > > > > > > > ALT_FPGAMGR_IMGCFG_STAT_F2S_CRC_ERROR_SET_MSK   
> > > > > > > > > > 
> > > > > > > > > > BIT(0)
> > > > > > > > > >  #define
> > > > > > > > > > ALT_FPGAMGR_IMGCFG_STAT_F2S_EARLY_USERMODE_SET_MSK
> > > > > > > > > > 
> > > > > > > > > > BIT(1)
> > > > > > > > > >  #define
> > > > > > > > > > ALT_FPGAMGR_IMGCFG_STAT_F2S_USERMODE_SET_MSK    
> > > > > > > > > > 
> > > > > > > > > > BIT(2)
> > > > > > > > > > @@ -89,11 +91,36 @@ struct socfpga_fpga_manager {
> > > > > > > > > >     u32  imgcfg_fifo_status;
> > > > > > > > > >  };
> > > > > > > > > >  
> > > > > > > > > > +#if defined(CONFIG_CMD_FPGA_LOADFS)
> > > > > > > > > > +enum rbf_type {unknown, periph_section,
> > > > > > > > > > core_section};
> > > > > > > > > > +enum rbf_security {invalid, unencrypted,
> > > > > > > > > > encrypted};
> > > > > > > > > > +
> > > > > > > > > > +struct rbf_info {
> > > > > > > > > > +   enum rbf_type section;
> > > > > > > > > > +   enum rbf_security security;
> > > > > > > > > > +};
> > > > > > > > > > +
> > > > > > > > > > +struct flash_info {
> > > > > > > > > > +   char *interface;
> > > > > > > > > > +   char *dev_part;
> > > > > > > > > > +   char *filename;
> > > > > > > > > > +   int fstype;
> > > > > > > > > > +   u32 remaining;
> > > > > > > > > > +   u32 flash_offset;
> > > > > > > > > > +   struct rbf_info rbfinfo;
> > > > > > > > > > +   struct image_header header;
> > > > > > > > > > +};
> > > > > > > > > > +#endif
> > > > > > > > > > +
> > > > > > > > > >  /* Functions */
> > > > > > > > > >  int fpgamgr_program_init(u32 * rbf_data, size_t
> > > > > > > > > > rbf_size);
> > > > > > > > > >  int fpgamgr_program_finish(void);
> > > > > > > > > >  int is_fpgamgr_user_mode(void);
> > > > > > > > > >  int fpgamgr_wait_early_user_mode(void);
> > > > > > > > > > +#if defined(CONFIG_CMD_FPGA_LOADFS)
> > > > > > > > > > +const char *get_cff_filename(const void *fdt, int
> > > > > > > > > > *len,
> > > > > > > > > > u32
> > > > > > > > > > core);
> > > > > > > > > > +const char *get_cff_devpart(const void *fdt, int
> > > > > > > > > > *len);
> > > > > > > > 

Re: [U-Boot] [PATCH 00/23] efi_loader implement missing functions

2017-09-05 Thread Heinrich Schuchardt
On 09/06/2017 01:48 AM, Rob Clark wrote:
> On Tue, Sep 5, 2017 at 4:55 AM, Simon Glass  wrote:
>> Hi,
>>
>> On 1 September 2017 at 22:45, Tom Rini  wrote:
>>> On Wed, Aug 30, 2017 at 04:16:34AM +0800, Simon Glass wrote:
 Hi,

 On 29 August 2017 at 22:16, Rob Clark  wrote:
> On Tue, Aug 29, 2017 at 8:57 AM, Leif Lindholm  
> wrote:
>> On Tue, Aug 29, 2017 at 02:26:48PM +0200, Alexander Graf wrote:
>> I would add command
>> bootefi selftest.efi
>> to run the tests and provide the python wrapper code to add it to the
>> test suite.
>
> I think that's a great idea, yes.
 I wonder how far we are from running UEFI tests (either the official
 ones, or I seem to remember hearing about some other test suite which
 didn't require UEFI shell)?
>>>
>>> Let's ask Leif, Ard and Dong.
>>>
>>> The official test suite definitely needs the UEFI Shell. Is the suite
>>> publicly available by now?
>>
>> In binary form, you can access it already from the links on
>> http://uefi.org/testtools
>>
>> Yes, 2.5 is latest release. No this is not a restriction ... the SCT
>> releases have been lagging the specification releases a fair bit.
>>
>> The 2.5a package contains AARCH64, IA32 and X64 support (not ARM).
>> Not that it couldn't contain ARM, it just hasn't been packaged.
>>
 That seems more useful long term than re-inventing comprehensive UEFI
 test suite.  (Also, beyond just running shim/fallback/grub, I don't
 really have time to invent new tests for the stack of efi_loader
 patches I have.)
>>>
>>> Yes and no - it depends on the availability of the official suite :/.
>>
>> UEFI SCT is not yet open source/free software. Obviously, this is
>> something Linaro has been lobbying for since day one of our
>> involvement. There used to be little understanding for this, but that
>> attitude has shifted substantially.
>
> So, if/until UEFI SCT is not an option, what about:
>
>   https://01.org/linux-uefi-validation
>
> (thx to pjones for pointing that out to me)

 Well in any case I'm not looking for a large functional test suite at
 this stage. It certainly could be useful, but not as a replacement for
 unit tests. The latter is for fast verification (so that everyone can
 run it as part of 'make tests') and easy identification of the
 location of bugs.
>>>
>>> I want to chime in here.  Unless we're talking hours of time, if "make
>>> tests" takes 5 minutes to run, but that includes doing some sort of full
>>> validation suite to the relevant EFI code, that seems like a win to me.
>>> And if someone else is responsible for the contents of the tests and we
>>> just have to confirm our expected results, that's an even bigger win.
>>
>> Yes it certainly is a win. But I'm already upset with how long the
>> tests take to run so I would not be keen on anything that increases it
>> much. How long does this test suite take to run normally?
>>
> 
> I'm not sure how long SCT would take to run until we get it working (I
> have a growing stack of patches on my wip-enough-uefi-for-shell
> branch, and have Shell.efi running but still debugging sct.efi)..
> maybe someone who has run SCT on a real UEFI implementation knows..
> But that said, there seems to be some potential to run a subset of the
> tests.  Either way, it seems like most of the time that travis runs
> take is building a million variants of u-boot.  I'm not sure the time
> spent running tests is really the issue.
> 
> BR,
> -R
> 
You could reduce the number of variants in .travis.yml by deleting
entries from env:.

With EFI the once that showed up my errors were:

qemu-x86
vexpress_ca15_tc2
vexpress_ca9x4

So maybe for a quick test (10 min) of your patches you can reduce to
these and do a full test before submitting.

Regards

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


Re: [U-Boot] [U-Boot, v2, 4/4] efi_loader: allow multiple source files for EFI apps

2017-09-05 Thread Heinrich Schuchardt
On 09/05/2017 09:24 PM, Alexander Graf wrote:
>> With this patch an EFI application can be built
>> out of multiple source files.
>>
>> All object files that are to be included into the EFI
>> application %.efi must be added to variable %-objs. E.g.
>>
>>  helloworld-objs = helloworld.o
>>
>> script/Makefile.lib automatically generates file %_efi.d
>> containing the dependency definition.
>>
>> This file is included in the next run of make. From now on
>> all objects in %-objs are built.
>>
>> The %_efi.d file should be included in the source
>> distribution.
>>
>> After adding a new file to %-objs the first make run will
>> fail due to the outdated %_efi.d file.
>>
>> Signed-off-by: Heinrich Schuchardt 
> 
> Thanks, applied to efi-next
> 
> Alex
> 
> 
Unfortunately there is a bug in this patch. Two dependencies are
missing. This leads to failures on vexpress.

I have fixed this on my local system. But I want to pass the correction
through Travis CI before sending it to you.

So, please, remove this single patch.

Regards

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


[U-Boot] [PATCH 00/10] rockchip: add tpl and OPTEE support for rk3229

2017-09-05 Thread Kever Yang

Add some generic options for TPL support for arm 32bit, and then
and TPL support for rk3229(cortex-A7), and then add OPTEE support
in SPL.



Kever Yang (10):
  lib: add TPL_OF_LIBFDT option for TPL
  arm: add option for TPL support in arm 32bit
  arm: add a separate stack for TPL
  rockchip: rk322x: enable tpl support
  sysreset: enable driver support in SPL/TPL
  spl: add support to booting with OP-TEE
  rockchip: rk322x: dts: enable uart2 for SPL/TPL
  rockchip: evb-rk3229: add fit source file for itb
  rockchip: evb-rk3229: add README file for OP-TEE support
  rockchip: evb-rk322x: update defconfig with tpl and optee support

 arch/arm/Kconfig | 29 ++
 arch/arm/dts/rk3229-evb.dts  |  1 +
 arch/arm/lib/crt0.S  |  4 +-
 arch/arm/mach-rockchip/Kconfig   |  9 
 arch/arm/mach-rockchip/Makefile  |  3 +-
 arch/arm/mach-rockchip/rk322x-board-spl.c| 66 ++-
 arch/arm/mach-rockchip/rk322x-board-tpl.c| 81 
 arch/arm/mach-rockchip/rk322x/u-boot-tpl.lds | 13 +
 board/rockchip/evb_rk3229/README | 72 +
 board/rockchip/evb_rk3229/fit_spl_optee.its  | 48 +
 common/spl/Kconfig   |  7 +++
 common/spl/Makefile  |  1 +
 common/spl/spl.c |  5 ++
 common/spl/spl_optee.S   | 13 +
 configs/evb-rk3229_defconfig | 28 --
 drivers/sysreset/Kconfig | 18 +++
 drivers/sysreset/Makefile|  2 +-
 include/configs/rk322x_common.h  | 12 +++--
 include/spl.h|  9 
 lib/Kconfig  | 10 
 20 files changed, 369 insertions(+), 62 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk322x-board-tpl.c
 create mode 100644 arch/arm/mach-rockchip/rk322x/u-boot-tpl.lds
 create mode 100644 board/rockchip/evb_rk3229/README
 create mode 100644 board/rockchip/evb_rk3229/fit_spl_optee.its
 create mode 100644 common/spl/spl_optee.S

-- 
1.9.1

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


[U-Boot] Fix for SHA256 Password Bug

2017-09-05 Thread Charles Eidsness
Hi All,

The SHA256 password feature doesn't seem to be working. The size argument
that was passed to hash_block was undefined. I'm not sure if this patch is
the best approach, but it does fix it:

--- uboot-2017.01/common/autoboot.c.orig2017-09-05
07:52:56.635162924 -0400
+++ uboot-2017.01/common/autoboot.c 2017-09-05 07:53:42.295593489 -0400
@@ -31,6 +31,8 @@
 #if defined(CONFIG_AUTOBOOT_KEYED)
 #if defined(CONFIG_AUTOBOOT_STOP_STR_SHA256)

+#include 
+
 /*
  * Use a "constant-length" time compare function for this
  * hash compare:
@@ -57,7 +59,6 @@
const char *algo_name = "sha256";
u_int presskey_len = 0;
int abort = 0;
-   int size;
int ret;

if (sha_env_str == NULL)
@@ -89,7 +90,7 @@

/* Calculate sha256 upon each new char */
hash_block(algo_name, (const void *)presskey,
-  presskey_len, sha, );
+  presskey_len, sha, NULL);

/* And check if sha matches saved value in env */
if (slow_equals(sha, sha_env, SHA256_SUM_LEN))
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,2/3] imx: mx6: correct IPU clock

2017-09-05 Thread Peng Fan
On Mon, Sep 04, 2017 at 07:37:01PM -0700, Eric Nelson wrote:
>Hi Peng,
>
>Pardon the reference to an old update, but do you have a description
>of the symptoms that brought about this patch?

Sorry for late reply. Runtime calculation is better.

The clk here is IPU HSP clock, which default sources mmdc ch clock.
To DL, the mmdc ch clock is 396M and the IPU HSP podf is 2, so the lock
is 198M.

Regards,
Peng.

>
>On 03/09/2016 01:07 AM, Peng Fan wrote:
>>The CONFIG_IPUV3_CLK should be 26400, to i.MX6DL, it should be
>>19800.
>>
>>Signed-off-by: Peng Fan 
>>Signed-off-by: Sandor Yu 
>>Cc: Stefano Babic 
>>Cc: Fabio Estevam 
>>Cc: Peter Robinson 
>>---
>>  include/configs/mx6sabre_common.h | 6 +-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>>diff --git a/include/configs/mx6sabre_common.h 
>>b/include/configs/mx6sabre_common.h
>>index 29d1f91..a6d821b 100644
>>--- a/include/configs/mx6sabre_common.h
>>+++ b/include/configs/mx6sabre_common.h
>>@@ -225,7 +225,11 @@
>>  #define CONFIG_BMP_16BPP
>>  #define CONFIG_VIDEO_LOGO
>>  #define CONFIG_VIDEO_BMP_LOGO
>>-#define CONFIG_IPUV3_CLK 26000
>>+#ifdef CONFIG_MX6DL
>>+#define CONFIG_IPUV3_CLK 19800
>>+#else
>>+#define CONFIG_IPUV3_CLK 26400
>>+#endif
>
>
>Note that this should probably be applied for other boards
>which are compiled for multiple CPU types.
>
>At least the Boundary Nitrogen boards, but probably others
>like Wand have ordering options for DL or Solo processors
>and may need the reduced clock rate.
>
>
>>  #define CONFIG_IMX_HDMI
>>  #define CONFIG_IMX_VIDEO_SKIP
>
>Please advise,
>
>
>Eric
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators

2017-09-05 Thread Rob Clark
On Tue, Sep 5, 2017 at 4:56 AM, Simon Glass  wrote:
> Hi Rob,
>
> On 3 September 2017 at 23:08, Łukasz Majewski  wrote:
>> On 09/02/2017 06:37 PM, Rob Clark wrote:
>>>
>>> And drop a whole lot of ugly code!
>
> :-)
>
>>
>>
>> +1
>>
>> Reviewed-by: Łukasz Majewski 
>>
>>
>>
>>>
>>> Signed-off-by: Rob Clark 
>>> ---
>>>   fs/fat/fat.c  | 723
>>> ++
>>>   include/fat.h |   6 -
>>>   2 files changed, 75 insertions(+), 654 deletions(-)
>>>
>>> diff --git a/fs/fat/fat.c b/fs/fat/fat.c
>>> index c72d6ca931..3193290434 100644
>>> --- a/fs/fat/fat.c
>>> +++ b/fs/fat/fat.c
>>> @@ -119,22 +119,6 @@ int fat_register_device(struct blk_desc *dev_desc,
>>> int part_no)
>>>   }
>>> /*
>>> - * Get the first occurence of a directory delimiter ('/' or '\') in a
>>> string.
>>> - * Return index into string if found, -1 otherwise.
>>> - */
>>> -static int dirdelim(char *str)
>>> -{
>>> -   char *start = str;
>>> -
>>> -   while (*str != '\0') {
>>> -   if (ISDIRDELIM(*str))
>>> -   return str - start;
>>> -   str++;
>>> -   }
>>> -   return -1;
>>> -}
>>> -
>>> -/*
>>>* Extract zero terminated short name from a directory entry.
>>>*/
>>>   static void get_name(dir_entry *dirent, char *s_name)
>>> @@ -468,95 +452,6 @@ static int slot2str(dir_slot *slotptr, char *l_name,
>>> int *idx)
>>> return 0;
>>>   }
>>>   -/*
>>> - * Extract the full long filename starting at 'retdent' (which is really
>>> - * a slot) into 'l_name'. If successful also copy the real directory
>>> entry
>>> - * into 'retdent'
>>> - * Return 0 on success, -1 otherwise.
>>> - */
>>> -static int
>>> -get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,
>>> -dir_entry *retdent, char *l_name)
>>> -{
>>> -   dir_entry *realdent;
>>> -   dir_slot *slotptr = (dir_slot *)retdent;
>>> -   __u8 *buflimit = cluster + mydata->sect_size * ((curclust == 0) ?
>>> -   PREFETCH_BLOCKS :
>>> -
>>> mydata->clust_size);
>>> -   __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;
>>> -   int idx = 0;
>>> -
>>> -   if (counter > VFAT_MAXSEQ) {
>>> -   debug("Error: VFAT name is too long\n");
>>> -   return -1;
>>> -   }
>>> -
>>> -   while ((__u8 *)slotptr < buflimit) {
>>> -   if (counter == 0)
>>> -   break;
>>> -   if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) !=
>>> counter)
>>> -   return -1;
>>> -   slotptr++;
>>> -   counter--;
>>> -   }
>>> -
>>> -   if ((__u8 *)slotptr >= buflimit) {
>>> -   dir_slot *slotptr2;
>>> -
>>> -   if (curclust == 0)
>>> -   return -1;
>>> -   curclust = get_fatent(mydata, curclust);
>>> -   if (CHECK_CLUST(curclust, mydata->fatsize)) {
>>> -   debug("curclust: 0x%x\n", curclust);
>>> -   printf("Invalid FAT entry\n");
>>> -   return -1;
>>> -   }
>>> -
>>> -   if (get_cluster(mydata, curclust,
>>> get_contents_vfatname_block,
>>> -   mydata->clust_size * mydata->sect_size) !=
>>> 0) {
>>> -   debug("Error: reading directory block\n");
>>> -   return -1;
>>> -   }
>>> -
>>> -   slotptr2 = (dir_slot *)get_contents_vfatname_block;
>>> -   while (counter > 0) {
>>> -   if (((slotptr2->id & ~LAST_LONG_ENTRY_MASK)
>>> -   & 0xff) != counter)
>>> -   return -1;
>>> -   slotptr2++;
>>> -   counter--;
>>> -   }
>>> -
>>> -   /* Save the real directory entry */
>>> -   realdent = (dir_entry *)slotptr2;
>>> -   while ((__u8 *)slotptr2 > get_contents_vfatname_block) {
>>> -   slotptr2--;
>>> -   slot2str(slotptr2, l_name, );
>>> -   }
>>> -   } else {
>>> -   /* Save the real directory entry */
>>> -   realdent = (dir_entry *)slotptr;
>>> -   }
>>> -
>>> -   do {
>>> -   slotptr--;
>>> -   if (slot2str(slotptr, l_name, ))
>>> -   break;
>>> -   } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));
>>> -
>>> -   l_name[idx] = '\0';
>>> -   if (*l_name == DELETED_FLAG)
>>> -   *l_name = '\0';
>>> -   else if (*l_name == aRING)
>>> -   *l_name = DELETED_FLAG;
>>> -   downcase(l_name);
>>> -
>>> -   /* Return the real directory entry */
>>> -   memcpy(retdent, realdent, sizeof(dir_entry));
>>> -
>>> -   return 0;
>>> -}
>>> -
>>>   /* 

[U-Boot] [PATCH 09/10] rockchip: evb-rk3229: add README file for OP-TEE support

2017-09-05 Thread Kever Yang
Detail of step by step to bring up the board with OP-TEE support.

Signed-off-by: Kever Yang 
---

 board/rockchip/evb_rk3229/README | 72 
 1 file changed, 72 insertions(+)
 create mode 100644 board/rockchip/evb_rk3229/README

diff --git a/board/rockchip/evb_rk3229/README b/board/rockchip/evb_rk3229/README
new file mode 100644
index 000..93328c7
--- /dev/null
+++ b/board/rockchip/evb_rk3229/README
@@ -0,0 +1,72 @@
+Get the Source and prebuild binary
+==
+
+  > mkdir ~/evb_rk3229
+  > cd ~/evb_rk3229
+  > git clone git://git.denx.de/u-boot.git
+  > git clone https://github.com/OP-TEE/optee_os.git
+  > git clone https://github.com/rockchip-linux/rkbin.git
+  > git clone https://github.com/rockchip-linux/rkdeveloptool.git
+
+Compile the OP-TEE
+===
+
+  > cd optee_os
+  > make clean
+  > make CROSS_COMPILE_ta_arm32=arm-none-eabi- PLATFORM=rockchip-rk322x
+  Get tee.bin in this step, copy it to U-Boot root dir:
+  > cp out/arm-plat-rockchip/core/tee-pager.bin ../u-boot/tee.bin
+
+Compile the U-Boot
+==
+
+  > cd ../u-boot
+  > export CROSS_COMPILE=arm-linux-gnueabihf-
+  > export ARCH=arm
+  > make evb-rk3229_defconfig
+  > make
+  > make u-boot.itb
+
+  Get tpl/u-boot-tpl.bin, spl/u-boot-spl.bin and u-boot.itb in this step.
+
+Compile the rkdeveloptool
+===
+  Follow instructions in latest README
+  > cd ../rkflashtool
+  > autoreconf -i
+  > ./configure
+  > make
+  > sudo make install
+
+  Get rkdeveloptool in you Host in this step.
+
+Both origin binaries and Tool are ready now, choose either option 1 or
+option 2 to deploy U-Boot.
+
+Package the image
+=
+
+  > cd ../u-boot
+  > tools/mkimage -n rk322x -T rksd -d tpl/u-boot-spl.bin idbloader.img
+  > cat spl/u-boot-spl.bin >> idbloader.img
+
+  Get idbloader.img in this step.
+
+Flash the image to eMMC
+===
+Power on(or reset with RESET KEY) with MASKROM KEY preesed, and then:
+  > cd ..
+  > rkdeveloptool db rkbin/rk32/rk322x_loader_v1.04.232.bin
+  > rkdeveloptool wl 64 u-boot/idbloader.img
+  > rkdeveloptool wl 0x4000 u-boot/u-boot.itb
+  > rkdeveloptool rd
+
+Flash the image to SD card
+==
+  > dd if=u-boot/idbloader.img of=/dev/sdb seek=64
+  > dd if=u-boot/u-boot.itb of=/dev/sdb seek=16384
+
+You should be able to get U-Boot log message with OP-TEE boot info.
+
+For more detail, please reference to:
+http://opensource.rock-chips.com/wiki_Boot_option
-- 
1.9.1

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


[U-Boot] [PATCH 08/10] rockchip: evb-rk3229: add fit source file for itb

2017-09-05 Thread Kever Yang
We package U-Boot and OP-TEE into one itb file for SPL,
so that we can support OP-TEE in SPL.

Signed-off-by: Kever Yang 
---

 board/rockchip/evb_rk3229/fit_spl_optee.its | 48 +
 1 file changed, 48 insertions(+)
 create mode 100644 board/rockchip/evb_rk3229/fit_spl_optee.its

diff --git a/board/rockchip/evb_rk3229/fit_spl_optee.its 
b/board/rockchip/evb_rk3229/fit_spl_optee.its
new file mode 100644
index 000..ed93d44
--- /dev/null
+++ b/board/rockchip/evb_rk3229/fit_spl_optee.its
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 Rockchip Electronic Co.,Ltd
+ *
+ * Simple U-boot fit source file containing U-Boot, dtb and optee
+ */
+
+/dts-v1/;
+
+/ {
+   description = "Simple image with OP-TEE support";
+   #address-cells = <1>;
+
+   images {
+   uboot@1 {
+   description = "U-Boot";
+   data = /incbin/("../../../u-boot-nodtb.bin");
+   type = "standalone";
+   arch = "arm";
+   compression = "none";
+   load = <0x6100>;
+   };
+   optee@1 {
+   description = "ARM Trusted Firmware";
+   data = /incbin/("../../../tee.bin");
+   type = "firmware";
+   arch = "arm";
+   compression = "none";
+   load = <0x6840>;
+   entry = <0x6840>;
+   };
+   fdt@1 {
+   description = "rk3229 dtb";
+   data = /incbin/("../../../u-boot.dtb");
+   type = "flat_dt";
+   compression = "none";
+   };
+   };
+
+   configurations {
+   default = "conf@1";
+   conf@1 {
+   description = "RK3399 evb";
+   firmware = "uboot@1";
+   loadables = "optee@1";
+   fdt = "fdt@1";
+   };
+   };
+};
-- 
1.9.1

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


[U-Boot] [PATCH 07/10] rockchip: rk322x: dts: enable uart2 for SPL/TPL

2017-09-05 Thread Kever Yang
When we use DM_SERIAL for serial driver, we need enable the
dts node for the debug console.

Signed-off-by: Kever Yang 
---

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

diff --git a/arch/arm/dts/rk3229-evb.dts b/arch/arm/dts/rk3229-evb.dts
index ae0b0a4..fe4abe9 100644
--- a/arch/arm/dts/rk3229-evb.dts
+++ b/arch/arm/dts/rk3229-evb.dts
@@ -83,6 +83,7 @@
 };
 
  {
+   u-boot,dm-pre-reloc;
status = "okay";
 };
 
-- 
1.9.1

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


[U-Boot] [PATCH 10/10] rockchip: evb-rk322x: update defconfig with tpl and optee support

2017-09-05 Thread Kever Yang
Enable all the options for TPL/SPL and OPTEE.

Signed-off-by: Kever Yang 
---

 configs/evb-rk3229_defconfig | 28 
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/configs/evb-rk3229_defconfig b/configs/evb-rk3229_defconfig
index bf5baf5..2fe2061 100644
--- a/configs/evb-rk3229_defconfig
+++ b/configs/evb-rk3229_defconfig
@@ -4,15 +4,27 @@ CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SYS_MALLOC_F_LEN=0x800
 CONFIG_ROCKCHIP_RK322X=y
-CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
+CONFIG_TPL_LDSCRIPT="arch/arm/mach-rockchip/rk322x/u-boot-tpl.lds"
+CONFIG_TPL_TEXT_BASE=0x10081004
+CONFIG_TPL_MAX_SIZE=28672
+CONFIG_TPL_STACK=0x10088000
+CONFIG_TPL_ROCKCHIP_BACK_TO_BROM=y
+CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
 CONFIG_TARGET_EVB_RK3229=y
-CONFIG_SPL_STACK_R_ADDR=0x8
+CONFIG_SPL_STACK_R_ADDR=0x6060
 CONFIG_DEFAULT_DEVICE_TREE="rk3229-evb"
 CONFIG_DEBUG_UART=y
-CONFIG_ENV_IS_IN_MMC=y
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_SOURCE="board/rockchip/evb_rk3229/fit_spl_optee.its"
 # CONFIG_DISPLAY_CPUINFO is not set
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+# CONFIG_SPL_LEGACY_IMAGE_SUPPORT is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x4000
+CONFIG_SPL_OPTEE_SUPPORT=y
 CONFIG_FASTBOOT=y
 CONFIG_USB_FUNCTION_FASTBOOT=y
 CONFIG_CMD_FASTBOOT=y
@@ -29,13 +41,19 @@ CONFIG_CMD_USB_MASS_STORAGE=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
+CONFIG_TPL_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_ENV_IS_IN_MMC=y
+CONFIG_TPL_DM=y
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
+CONFIG_TPL_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_SPL_SYSCON=y
+CONFIG_TPL_SYSCON=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_TPL_CLK=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
@@ -44,12 +62,14 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_ROCKCHIP_RK322X=y
 CONFIG_RAM=y
 CONFIG_SPL_RAM=y
+CONFIG_TPL_RAM=y
 CONFIG_BAUDRATE=150
 CONFIG_DEBUG_UART_BASE=0x1103
 CONFIG_DEBUG_UART_CLOCK=2400
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYS_NS16550=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_GADGET=y
-- 
1.9.1

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


[U-Boot] [PATCH 06/10] spl: add support to booting with OP-TEE

2017-09-05 Thread Kever Yang
OP-TEE is an open source trusted OS, in armv7, its loading and
running are like this:
loading:
- SPL load both OP-TEE and U-Boot
running:
- SPL run into OP-TEE in secure mode;
- OP-TEE run into U-Boot in non-secure mode;

More detail:
https://github.com/OP-TEE/optee_os
and search for 'boot arguments' for detail entry parameter in:
core/arch/arm/kernel/generic_entry_a32.S

Signed-off-by: Kever Yang 
---

 common/spl/Kconfig |  7 +++
 common/spl/Makefile|  1 +
 common/spl/spl.c   |  5 +
 common/spl/spl_optee.S | 13 +
 include/spl.h  |  9 +
 5 files changed, 35 insertions(+)
 create mode 100644 common/spl/spl_optee.S

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 582b685..85f8d66 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -700,6 +700,13 @@ config SPL_ATF_TEXT_BASE
help
  This is the base address in memory for ATF BL31 text and entry point.
 
+config SPL_OPTEE_SUPPORT
+   bool "Support OP-TEE Trusted OS"
+   depends on ARM
+   help
+ OP-TEE is an open source Trusted OS  which is loaded by SPL.
+ More detail at: https://github.com/OP-TEE/optee_os
+
 config TPL
bool
depends on SUPPORT_TPL
diff --git a/common/spl/Makefile b/common/spl/Makefile
index fde0d09..ec37428 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_$(SPL_TPL_)UBI) += spl_ubi.o
 obj-$(CONFIG_$(SPL_TPL_)NET_SUPPORT) += spl_net.o
 obj-$(CONFIG_$(SPL_TPL_)MMC_SUPPORT) += spl_mmc.o
 obj-$(CONFIG_$(SPL_TPL_)ATF_SUPPORT) += spl_atf.o
+obj-$(CONFIG_$(SPL_TPL_)OPTEE_SUPPORT) += spl_optee.o
 obj-$(CONFIG_$(SPL_TPL_)USB_SUPPORT) += spl_usb.o
 obj-$(CONFIG_$(SPL_TPL_)FAT_SUPPORT) += spl_fat.o
 obj-$(CONFIG_$(SPL_TPL_)EXT_SUPPORT) += spl_ext.o
diff --git a/common/spl/spl.c b/common/spl/spl.c
index d245cfc..6ff390c 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -430,6 +430,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
bl31_entry();
}
 
+   if (CONFIG_IS_ENABLED(OPTEE_SUPPORT)) {
+   debug("loaded - jumping to U-Boot via OP-TEE.\n");
+   spl_optee_entry(0, 0, 0, (void *)spl_image.entry_point);
+   }
+
debug("loaded - jumping to U-Boot...\n");
 #ifdef CONFIG_BOOTSTAGE_STASH
int ret;
diff --git a/common/spl/spl_optee.S b/common/spl/spl_optee.S
new file mode 100644
index 000..4f7f8ba
--- /dev/null
+++ b/common/spl/spl_optee.S
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2017 Rockchip Electronic Co.,Ltd
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+
+ENTRY(spl_optee_entry)
+   ldr lr, =CONFIG_SYS_TEXT_BASE
+   mov pc, r3
+ENDPROC(spl_optee_entry)
diff --git a/include/spl.h b/include/spl.h
index ce4cf0a..13d46ed 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -270,6 +270,15 @@ int spl_mmc_load_image(struct spl_image_info *spl_image,
 void bl31_entry(void);
 
 /**
+ * spl_optee_entry - entry function for optee
+ * entry arg0, pagestore
+ * entry arg1, (ARMv7 standard bootarg #1)
+ * entry arg2, device tree address, (ARMv7 standard bootarg #2)
+ * entry arg3, non-secure entry address (ARMv7 bootarg #0)
+ */
+void spl_optee_entry(void *arg0, void *arg1, void *arg2, void *arg3);
+
+/**
  * board_return_to_bootrom - allow for boards to continue with the boot ROM
  *
  * If a board (e.g. the Rockchip RK3368 boards) provide some
-- 
1.9.1

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


[U-Boot] [PATCH 03/10] arm: add a separate stack for TPL

2017-09-05 Thread Kever Yang
TPL stack may different from SPL and sys stack, add support for
separate one when the board defines it.

Signed-off-by: Kever Yang 
---

 arch/arm/lib/crt0.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index fa81317..3c1c603 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -70,7 +70,9 @@ ENTRY(_main)
  * Set up initial C runtime environment and call board_init_f(0).
  */
 
-#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
+#if defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_NEEDS_SEPARATE_STACK)
+   ldr r0, =(CONFIG_TPL_STACK)
+#elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
ldr r0, =(CONFIG_SPL_STACK)
 #else
ldr r0, =(CONFIG_SYS_INIT_SP_ADDR)
-- 
1.9.1

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


[U-Boot] [PATCH 05/10] sysreset: enable driver support in SPL/TPL

2017-09-05 Thread Kever Yang
SPL/TPL also need use sysreset for some feature like panic callback.

Signed-off-by: Kever Yang 
---

 drivers/sysreset/Kconfig  | 18 ++
 drivers/sysreset/Makefile |  2 +-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index a6d48e8..a61a7d3 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -13,6 +13,24 @@ config SYSRESET
  to effect a reset. The uclass will try all available drivers when
  reset_walk() is called.
 
+config SPL_SYSRESET
+   bool "Enable support for system reset drivers in SPL mode"
+   depends on SYSRESET && SPL_DM
+   help
+ Enable system reset drivers which can be used to reset the CPU or
+ board. Each driver can provide a reset method which will be called
+ to effect a reset. The uclass will try all available drivers when
+ reset_walk() is called.
+
+config TPL_SYSRESET
+   bool "Enable support for system reset drivers in TPL mode"
+   depends on SYSRESET && TPL_DM
+   help
+ Enable system reset drivers which can be used to reset the CPU or
+ board. Each driver can provide a reset method which will be called
+ to effect a reset. The uclass will try all available drivers when
+ reset_walk() is called.
+
 if SYSRESET
 
 config SYSRESET_PSCI
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index 476d361..ce161a7 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -4,7 +4,7 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
-obj-$(CONFIG_SYSRESET) += sysreset-uclass.o
+obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += sysreset-uclass.o
 obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o
 obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o
 obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
-- 
1.9.1

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


[U-Boot] [PATCH 04/10] rockchip: rk322x: enable tpl support

2017-09-05 Thread Kever Yang
Move original spl to tpl, and add spl to load next stage firmware,
adapt all the address and option for them.

Signed-off-by: Kever Yang 
---

 arch/arm/mach-rockchip/Kconfig   |  9 
 arch/arm/mach-rockchip/Makefile  |  3 +-
 arch/arm/mach-rockchip/rk322x-board-spl.c| 66 ++-
 arch/arm/mach-rockchip/rk322x-board-tpl.c| 81 
 arch/arm/mach-rockchip/rk322x/u-boot-tpl.lds | 13 +
 include/configs/rk322x_common.h  | 12 +++--
 6 files changed, 128 insertions(+), 56 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk322x-board-tpl.c
 create mode 100644 arch/arm/mach-rockchip/rk322x/u-boot-tpl.lds

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index d9b25d5..e1bc947 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -32,9 +32,18 @@ config ROCKCHIP_RK322X
bool "Support Rockchip RK3228/RK3229"
select CPU_V7
select SUPPORT_SPL
+   select SUPPORT_TPL
select SPL
+   select TPL
+   select TPL_NEEDS_SEPARATE_TEXT_BASE if SPL
+   select TPL_NEEDS_SEPARATE_STACK if TPL
+   select SPL_DRIVERS_MISC_SUPPORT
+   imply SPL_SERIAL_SUPPORT
+   imply TPL_SERIAL_SUPPORT
select ROCKCHIP_BROM_HELPER
select DEBUG_UART_BOARD_INIT
+   select TPL_LIBCOMMON_SUPPORT
+   select TPL_LIBGENERIC_SUPPORT
help
  The Rockchip RK3229 is a ARM-based SoC with a dual-core Cortex-A7
  including NEON and GPU, Mali-400 graphics, several DDR3 options
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 79e9704..5ef0938 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -13,10 +13,11 @@ obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o 
save_boot_param.o
 
 obj-tpl-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o
 obj-tpl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-tpl.o
+obj-tpl-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board-tpl.o
 
 obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
 obj-spl-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-spl.o
-obj-spl-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board-spl.o
+obj-spl-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board-spl.o spl-boot-order.o
 obj-spl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o
 obj-spl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-spl.o spl-boot-order.o
 obj-spl-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o spl-boot-order.o
diff --git a/arch/arm/mach-rockchip/rk322x-board-spl.c 
b/arch/arm/mach-rockchip/rk322x-board-spl.c
index 4ddb8ba..71e641e 100644
--- a/arch/arm/mach-rockchip/rk322x-board-spl.c
+++ b/arch/arm/mach-rockchip/rk322x-board-spl.c
@@ -5,77 +5,43 @@
  */
 
 #include 
-#include 
 #include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+
+DECLARE_GLOBAL_DATA_PTR;
 
 u32 spl_boot_device(void)
 {
return BOOT_DEVICE_MMC1;
 }
-DECLARE_GLOBAL_DATA_PTR;
-
-#define GRF_BASE   0x1100
-#define SGRF_BASE  0x1014
 
-#define DEBUG_UART_BASE0x1103
+u32 spl_boot_mode(const u32 boot_device)
+{
+   return MMCSD_MODE_RAW;
+}
 
 void board_debug_uart_init(void)
 {
-static struct rk322x_grf * const grf = (void *)GRF_BASE;
-   /* Enable early UART2 channel 1 on the RK322x */
-   rk_clrsetreg(>gpio1b_iomux,
-GPIO1B1_MASK | GPIO1B2_MASK,
-GPIO1B2_UART21_SIN << GPIO1B2_SHIFT |
-GPIO1B1_UART21_SOUT << GPIO1B1_SHIFT);
-   /* Set channel C as UART2 input */
-   rk_clrsetreg(>con_iomux,
-CON_IOMUX_UART2SEL_MASK,
-CON_IOMUX_UART2SEL_21 << CON_IOMUX_UART2SEL_SHIFT);
 }
 
-#define SGRF_DDR_CON0 0x1015
 void board_init_f(ulong dummy)
 {
-   struct udevice *dev;
int ret;
 
-   /*
-* Debug UART can be used from here if required:
-*
-* debug_uart_init();
-* printch('a');
-* printhex8(0x1234);
-* printascii("string");
-*/
-   debug_uart_init();
-   printascii("SPL Init");
-
ret = spl_early_init();
if (ret) {
-   debug("spl_early_init() failed: %d\n", ret);
+   printf("spl_early_init() failed: %d\n", ret);
hang();
}
+   preloader_console_init();
+}
 
-   rockchip_timer_init();
-   printf("timer init done\n");
-   ret = uclass_get_device(UCLASS_RAM, 0, );
-   if (ret) {
-   printf("DRAM init failed: %d\n", ret);
-   return;
-   }
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+   /* Just empty function now - can't decide what to choose */
+   debug("%s: %s\n", __func__, name);
 
-   /* Disable the ddr secure region setting to make it non-secure */
-   rk_clrreg(SGRF_DDR_CON0, 0x4000);
-#if 

[U-Boot] [PATCH 02/10] arm: add option for TPL support in arm 32bit

2017-09-05 Thread Kever Yang
Some options like TPL_SYS_THUMB_BUILD, TPL_USE_ARCH_MEMCPY
and TPL_USE_ARCH_MEMCPY are needed for TPL build in 32bit arm.

Signed-off-by: Kever Yang 
---

 arch/arm/Kconfig | 29 +
 1 file changed, 29 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cf4782c..3404af7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -228,6 +228,17 @@ config SPL_SYS_THUMB_BUILD
   density. For ARM architectures that support Thumb2 this flag will
   result in Thumb2 code generated by GCC.
 
+config TPL_SYS_THUMB_BUILD
+   bool "Build TPL using the Thumb instruction set"
+   default y if SYS_THUMB_BUILD
+   depends on TPL && !ARM64
+   help
+  Use this flag to build SPL using the Thumb instruction set for
+  ARM architectures. Thumb instruction set provides better code
+  density. For ARM architectures that support Thumb2 this flag will
+  result in Thumb2 code generated by GCC.
+
+
 config SYS_L2CACHE_OFF
bool "L2cache off"
help
@@ -264,6 +275,15 @@ config SPL_USE_ARCH_MEMCPY
  Such implementation may be faster under some conditions
  but may increase the binary size.
 
+config TPL_USE_ARCH_MEMCPY
+   bool "Use an assembly optimized implementation of memcpy for TPL"
+   default y if USE_ARCH_MEMCPY
+   depends on !ARM64
+   help
+ Enable the generation of an optimized version of memcpy.
+ Such implementation may be faster under some conditions
+ but may increase the binary size.
+
 config USE_ARCH_MEMSET
bool "Use an assembly optimized implementation of memset"
default y
@@ -282,6 +302,15 @@ config SPL_USE_ARCH_MEMSET
  Such implementation may be faster under some conditions
  but may increase the binary size.
 
+config TPL_USE_ARCH_MEMSET
+   bool "Use an assembly optimized implementation of memset for TPL"
+   default y if USE_ARCH_MEMSET
+   depends on !ARM64
+   help
+ Enable the generation of an optimized version of memset.
+ Such implementation may be faster under some conditions
+ but may increase the binary size.
+
 config ARM64_SUPPORT_AARCH32
bool "ARM64 system support AArch32 execution state"
default y if ARM64 && !TARGET_THUNDERX_88XX
-- 
1.9.1

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


[U-Boot] [PATCH 01/10] lib: add TPL_OF_LIBFDT option for TPL

2017-09-05 Thread Kever Yang
TPL may need use libfdt for dt decode, add option for it.

Signed-off-by: Kever Yang 
---

 lib/Kconfig | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/lib/Kconfig b/lib/Kconfig
index d73052d..d2a6dae 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -204,6 +204,16 @@ config SPL_OF_LIBFDT
  particular compatible nodes. The library operates on a flattened
  version of the device tree.
 
+config TPL_OF_LIBFDT
+   bool "Enable the FDT library for TPL"
+   default y if TPL_OF_CONTROL
+   help
+ This enables the FDT library (libfdt). It provides functions for
+ accessing binary device tree images in memory, such as adding and
+ removing nodes and properties, scanning through the tree and finding
+ particular compatible nodes. The library operates on a flattened
+ version of the device tree.
+
 config FDT_FIXUP_PARTITIONS
bool "overwrite MTD partitions in DTS through defined in 'mtdparts'"
depends on OF_LIBFDT
-- 
1.9.1

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


Re: [U-Boot] [PATCH v2 7/8] fat/fs: move ls to generic implementation

2017-09-05 Thread Rob Clark
On Tue, Sep 5, 2017 at 4:56 AM, Simon Glass  wrote:
> On 3 September 2017 at 00:38, Rob Clark  wrote:
>> Add a generic implementation of 'ls' using opendir/readdir/closedir, and
>> replace fat's custom implementation.  Other filesystems should move to
>> the generic implementation after they add opendir/readdir/closedir
>> support.
>>
>> Signed-off-by: Rob Clark 
>> ---
>>  fs/fat/fat.c  | 32 
>>  fs/fs.c   | 35 +--
>>  include/fat.h |  5 -
>>  3 files changed, 37 insertions(+), 35 deletions(-)
>
> Reviewed-by: Simon Glass 
>
> So if all filesystems implement this interface then we could move this
> to function to the fs layer?

yes.. there are some slight differences in output for other fs's but I
guess since u-boot doesn't make that easy for a script to capture we
can probably ignore it..

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


Re: [U-Boot] [PATCH 0/3] Clean up make process for EFI payload

2017-09-05 Thread Heinrich Schuchardt
On 09/05/2017 04:23 PM, Andy Shevchenko wrote:
> On Tue, 2017-09-05 at 03:19 +0200, Heinrich Schuchardt wrote:
>> Currently we have a single EFI application that we can deliver
>> integrated into U-Boot. It is a hello world application that
>> can be called with 'bootefi hello'.
>>
>> The Makefiles do not easily accomodate further EFI payloads
>> like a unit test for the EFI API or an EFI shell.
>>
>> This patch series changes Makefile.lib to allow additional
>> EFI payloads. Required fixes to the helloworld app are
>> provided.
>>
>> Further work will be needed to accomodate EFI payloads built
>> out of multiple source files.
> 
> Please, amend .gitignore, if needed, according to the changes.

In this old version of the patch series no new files are created.

In the v2 version dependency files are created/updated which we want to
add to the source repository keep.

Best regards

Heinrich

> 
>>
>> Heinrich Schuchardt (3):
>>   efi_loader: rename __efi_hello_world_*
>>   scripts/Makefile.lib: generalize building built in EFI app
>>   efi_loader: usage of always in Makefile
>>
>>  cmd/bootefi.c  |  4 ++--
>>  include/asm-generic/sections.h |  4 ++--
>>  lib/efi_loader/Makefile|  5 +++--
>>  scripts/Makefile.lib   | 28 +++-
>>  4 files changed, 22 insertions(+), 19 deletions(-)
>>
> 

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


[U-Boot] [PATCH v3 4/6] bootstage: Drop unused options

2017-09-05 Thread Simon Glass
The CONFIG_BOOTSTAGE_USER_COUNT option is no-longer needed since we can now
support any number of user IDs. Also BOOTSTAGE_ID_COUNT is not needed now.

Drop these unused options.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v3: None
Changes in v2: None

 common/Kconfig | 9 -
 common/bootstage.c | 2 +-
 configs/sandbox_defconfig  | 1 -
 configs/sandbox_flattree_defconfig | 1 -
 configs/sandbox_noblk_defconfig| 1 -
 configs/sandbox_spl_defconfig  | 1 -
 include/bootstage.h| 6 --
 7 files changed, 1 insertion(+), 20 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index 4d8cae9610..abd4146922 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -46,15 +46,6 @@ config BOOTSTAGE_REPORT
 29,916,167 26,005,792  bootm_start
 30,361,327445,160  start_kernel
 
-config BOOTSTAGE_USER_COUNT
-   int "Number of boot ID numbers available for user use"
-   default 20
-   help
- This is the number of available user bootstage records.
- Each time you call bootstage_mark(BOOTSTAGE_ID_ALLOC, ...)
- a new ID will be allocated from this stash. If you exceed
- the limit, recording will stop.
-
 config BOOTSTAGE_RECORD_COUNT
int "Number of boot stage records to store"
default 30
diff --git a/common/bootstage.c b/common/bootstage.c
index 61479d7f07..efc99fc681 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -456,7 +456,7 @@ int bootstage_unstash(const void *base, int size)
 
if (data->rec_count + hdr->count > RECORD_COUNT) {
debug("%s: Bootstage has %d records, we have space for %d\n"
-   "- please increase CONFIG_BOOTSTAGE_USER_COUNT\n",
+   "- please increase CONFIG_BOOTSTAGE_RECORD_COUNT\n",
  __func__, hdr->count, RECORD_COUNT - data->rec_count);
return -ENOSPC;
}
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index 4c4e4809be..5d8440fbcc 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -7,7 +7,6 @@ CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
-CONFIG_BOOTSTAGE_USER_COUNT=32
 CONFIG_BOOTSTAGE_FDT=y
 CONFIG_BOOTSTAGE_STASH=y
 CONFIG_BOOTSTAGE_STASH_ADDR=0x0
diff --git a/configs/sandbox_flattree_defconfig 
b/configs/sandbox_flattree_defconfig
index 325f4ff57f..50ea35e64b 100644
--- a/configs/sandbox_flattree_defconfig
+++ b/configs/sandbox_flattree_defconfig
@@ -7,7 +7,6 @@ CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
-CONFIG_BOOTSTAGE_USER_COUNT=32
 CONFIG_BOOTSTAGE_FDT=y
 CONFIG_BOOTSTAGE_STASH=y
 CONFIG_BOOTSTAGE_STASH_ADDR=0x0
diff --git a/configs/sandbox_noblk_defconfig b/configs/sandbox_noblk_defconfig
index e152917fe4..693c14bc60 100644
--- a/configs/sandbox_noblk_defconfig
+++ b/configs/sandbox_noblk_defconfig
@@ -6,7 +6,6 @@ CONFIG_FIT_SIGNATURE=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
-CONFIG_BOOTSTAGE_USER_COUNT=32
 CONFIG_BOOTSTAGE_FDT=y
 CONFIG_BOOTSTAGE_STASH=y
 CONFIG_BOOTSTAGE_STASH_ADDR=0x0
diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig
index be4a85da33..db9129456b 100644
--- a/configs/sandbox_spl_defconfig
+++ b/configs/sandbox_spl_defconfig
@@ -13,7 +13,6 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_BOOTSTAGE=y
 CONFIG_BOOTSTAGE_REPORT=y
-CONFIG_BOOTSTAGE_USER_COUNT=32
 CONFIG_BOOTSTAGE_FDT=y
 CONFIG_BOOTSTAGE_STASH=y
 CONFIG_BOOTSTAGE_STASH_ADDR=0x0
diff --git a/include/bootstage.h b/include/bootstage.h
index c5d93f57fd..7a524782ba 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -12,11 +12,6 @@
 #ifndef _BOOTSTAGE_H
 #define _BOOTSTAGE_H
 
-/* Define this for host tools */
-#ifndef CONFIG_BOOTSTAGE_USER_COUNT
-#define CONFIG_BOOTSTAGE_USER_COUNT20
-#endif
-
 /* Flags for each bootstage record */
 enum bootstage_flags {
BOOTSTAGEF_ERROR= 1 << 0,   /* Error record */
@@ -208,7 +203,6 @@ enum bootstage_id {
 
/* a few spare for the user, from here */
BOOTSTAGE_ID_USER,
-   BOOTSTAGE_ID_COUNT = BOOTSTAGE_ID_USER + CONFIG_BOOTSTAGE_USER_COUNT,
BOOTSTAGE_ID_ALLOC,
 };
 
-- 
2.14.1.581.gf28d330327-goog

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


[U-Boot] [PATCH v3 5/6] bootstage: Provide a separate record count setting for SPL

2017-09-05 Thread Simon Glass
With SPL we often have limited memory and do not need very many bootstage
records. Add a separate Kconfig option for SPL.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 common/Kconfig | 7 +++
 common/bootstage.c | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/common/Kconfig b/common/Kconfig
index abd4146922..540ccb 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -53,6 +53,13 @@ config BOOTSTAGE_RECORD_COUNT
  This is the size of the bootstage record list and is the maximum
  number of bootstage records that can be recorded.
 
+config SPL_BOOTSTAGE_RECORD_COUNT
+   int "Number of boot stage records to store for SPL"
+   default 5
+   help
+ This is the size of the bootstage record list and is the maximum
+ number of bootstage records that can be recorded.
+
 config BOOTSTAGE_FDT
bool "Store boot timing information in the OS device tree"
depends on BOOTSTAGE
diff --git a/common/bootstage.c b/common/bootstage.c
index efc99fc681..b866e66979 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -18,7 +18,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 enum {
-   RECORD_COUNT = CONFIG_BOOTSTAGE_RECORD_COUNT,
+   RECORD_COUNT = CONFIG_VAL(BOOTSTAGE_RECORD_COUNT),
 };
 
 struct bootstage_record {
@@ -327,7 +327,7 @@ void bootstage_report(void)
}
if (data->rec_count > RECORD_COUNT)
printf("Overflowed internal boot id table by %d entries\n"
-  "- please increase CONFIG_BOOTSTAGE_RECORD_COUNT\n",
+  "Please increase CONFIG_(SPL_)BOOTSTAGE_RECORD_COUNT\n",
   data->rec_count - RECORD_COUNT);
 
puts("\nAccumulated time:\n");
@@ -456,7 +456,7 @@ int bootstage_unstash(const void *base, int size)
 
if (data->rec_count + hdr->count > RECORD_COUNT) {
debug("%s: Bootstage has %d records, we have space for %d\n"
-   "- please increase CONFIG_BOOTSTAGE_RECORD_COUNT\n",
+   "Please increase CONFIG_(SPL_)BOOTSTAGE_RECORD_COUNT\n",
  __func__, hdr->count, RECORD_COUNT - data->rec_count);
return -ENOSPC;
}
-- 
2.14.1.581.gf28d330327-goog

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


[U-Boot] [PATCH v3 1/6] board_f: Drop the timer after relocation

2017-09-05 Thread Simon Glass
Once U-Boot relocates itself the existing driver-model timer (if any) is
no-longer valid until the device is reinitialised. Any use of the device
may cause a crash. To handle this, set the timer to NULL after relocation.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Bracket access to gd->timer with an #ifdef

Changes in v2: None

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

diff --git a/common/board_f.c b/common/board_f.c
index 104d144f41..9220815441 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -952,6 +952,9 @@ void board_init_f_r(void)
 * UART if available.
 */
gd->flags &= ~GD_FLG_SERIAL_READY;
+#ifdef CONFIG_TIMER
+   gd->timer = NULL;
+#endif
 
/*
 * U-Boot has been copied into SDRAM, the BSS has been cleared etc.
-- 
2.14.1.581.gf28d330327-goog

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


[U-Boot] [PATCH v3 6/6] x86: Enable early timer for chromebook_link

2017-09-05 Thread Simon Glass
Enable this option for link so that the timer is available earlier.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v3: None
Changes in v2:
- Add new patch to enable early timer for chromebook_link

 configs/chromebook_link64_defconfig | 1 +
 configs/chromebook_link_defconfig   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/configs/chromebook_link64_defconfig 
b/configs/chromebook_link64_defconfig
index da247152a8..d7052a645c 100644
--- a/configs/chromebook_link64_defconfig
+++ b/configs/chromebook_link64_defconfig
@@ -67,6 +67,7 @@ CONFIG_DEBUG_UART_CLOCK=1843200
 CONFIG_DEBUG_UART_BOARD_INIT=y
 CONFIG_SYS_NS16550=y
 CONFIG_SPL_TIMER=y
+CONFIG_TIMER_EARLY=y
 CONFIG_TPM_TIS_LPC=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
diff --git a/configs/chromebook_link_defconfig 
b/configs/chromebook_link_defconfig
index aaabb22251..f22a03e1cb 100644
--- a/configs/chromebook_link_defconfig
+++ b/configs/chromebook_link_defconfig
@@ -49,6 +49,7 @@ CONFIG_DEBUG_UART_BASE=0x3f8
 CONFIG_DEBUG_UART_CLOCK=1843200
 CONFIG_DEBUG_UART_BOARD_INIT=y
 CONFIG_SYS_NS16550=y
+CONFIG_TIMER_EARLY=y
 CONFIG_TPM_TIS_LPC=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
-- 
2.14.1.581.gf28d330327-goog

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


[U-Boot] [PATCH v3 3/6] dm: x86: Update timer_get_boot_us to work before DM is ready

2017-09-05 Thread Simon Glass
Use the new separate init function so that we can make use of the timer
before driver model is started up.

At some point we should consider adding the microsecond timer to the timer
uclass interface since it would reduce the amount of plumbing here
slightly.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2:
- Rebase on top of early timer code and simplify slightly

 drivers/timer/tsc_timer.c | 19 ++-
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index 0012fecde0..db49de87a2 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -295,11 +295,6 @@ ulong notrace timer_get_us(void)
return get_ticks() / get_tbclk_mhz();
 }
 
-ulong timer_get_boot_us(void)
-{
-   return timer_get_us();
-}
-
 void __udelay(unsigned long usec)
 {
u64 now = get_ticks();
@@ -374,6 +369,20 @@ u64 notrace timer_early_get_count(void)
return rdtsc() - gd->arch.tsc_base;
 }
 
+ulong timer_get_boot_us(void)
+{
+   if (!gd->timer) {
+   u64 now_tick;
+
+   tsc_timer_ensure_setup();
+   now_tick = rdtsc() - gd->arch.tsc_base;
+
+   return now_tick / (gd->arch.clock_rate / 100);
+   }
+
+   return timer_get_us();
+}
+
 static const struct timer_ops tsc_timer_ops = {
.get_count = tsc_timer_get_count,
 };
-- 
2.14.1.581.gf28d330327-goog

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


[U-Boot] [PATCH v3 2/6] dm: x86: Allow TSC timer to be used before DM is ready

2017-09-05 Thread Simon Glass
With bootstage we need access to the timer before driver model is set up.
To handle this, put the required state in global_data and provide a new
function to set up the device, separate from the driver's probe() method.

This will be used by the 'early' timer also.

Signed-off-by: Simon Glass 
Reviewed-by: Bin Meng 
---

Changes in v3: None
Changes in v2:
- Update to support the early timer

 arch/x86/include/asm/global_data.h |  1 +
 drivers/timer/tsc_timer.c  | 30 +-
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/global_data.h 
b/arch/x86/include/asm/global_data.h
index 93a80fe2b6..fcb6853a38 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -77,6 +77,7 @@ struct arch_global_data {
uint8_t x86_mask;
uint32_t x86_device;
uint64_t tsc_base;  /* Initial value returned by rdtsc() */
+   unsigned long clock_rate;   /* Clock rate of timer in Hz */
void *new_fdt;  /* Relocated FDT */
uint32_t bist;  /* Built-in self test value */
enum pei_boot_mode_t pei_boot_mode;
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index 4d1fc9cd13..0012fecde0 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -328,17 +328,17 @@ static int tsc_timer_get_count(struct udevice *dev, u64 
*count)
return 0;
 }
 
-static int tsc_timer_probe(struct udevice *dev)
+static void tsc_timer_ensure_setup(void)
 {
-   struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
-
+   if (gd->arch.tsc_base)
+   return;
gd->arch.tsc_base = rdtsc();
 
/*
 * If there is no clock frequency specified in the device tree,
 * calibrate it by ourselves.
 */
-   if (!uc_priv->clock_rate) {
+   if (!gd->arch.clock_rate) {
unsigned long fast_calibrate;
 
fast_calibrate = cpu_mhz_from_msr();
@@ -348,12 +348,32 @@ static int tsc_timer_probe(struct udevice *dev)
panic("TSC frequency is ZERO");
}
 
-   uc_priv->clock_rate = fast_calibrate * 100;
+   gd->arch.clock_rate = fast_calibrate * 100;
}
+}
+
+static int tsc_timer_probe(struct udevice *dev)
+{
+   struct timer_dev_priv *uc_priv = dev_get_uclass_priv(dev);
+
+   tsc_timer_ensure_setup();
+   uc_priv->clock_rate = gd->arch.clock_rate;
 
return 0;
 }
 
+unsigned long notrace timer_early_get_rate(void)
+{
+   tsc_timer_ensure_setup();
+
+   return gd->arch.clock_rate;
+}
+
+u64 notrace timer_early_get_count(void)
+{
+   return rdtsc() - gd->arch.tsc_base;
+}
+
 static const struct timer_ops tsc_timer_ops = {
.get_count = tsc_timer_get_count,
 };
-- 
2.14.1.581.gf28d330327-goog

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


[U-Boot] [PATCH v3 0/6] x86: bootstage: Fix bootstage operation on link

2017-09-05 Thread Simon Glass
Recent bootstage changes have provoked problems with chromebook_link.
Bootstage uses the timer before driver model is ready, but link uses
driver model for the timer.

This series:
- Updates the TSC timer to make the bootstage work before DM is ready
- Provides a way to have a separate setting for record count in SPL to
save memory
- Tidies up a few bootstage options that are no-longer needed

This fixes booting on link which is currently broken.

Changes in v3:
- Bracket access to gd->timer with an #ifdef

Changes in v2:
- Update to support the early timer
- Rebase on top of early timer code and simplify slightly
- Add new patch to enable early timer for chromebook_link

Simon Glass (6):
  board_f: Drop the timer after relocation
  dm: x86: Allow TSC timer to be used before DM is ready
  dm: x86: Update timer_get_boot_us to work before DM is ready
  bootstage: Drop unused options
  bootstage: Provide a separate record count setting for SPL
  x86: Enable early timer for chromebook_link

 arch/x86/include/asm/global_data.h  |  1 +
 common/Kconfig  | 16 ++--
 common/board_f.c|  3 +++
 common/bootstage.c  |  6 ++---
 configs/chromebook_link64_defconfig |  1 +
 configs/chromebook_link_defconfig   |  1 +
 configs/sandbox_defconfig   |  1 -
 configs/sandbox_flattree_defconfig  |  1 -
 configs/sandbox_noblk_defconfig |  1 -
 configs/sandbox_spl_defconfig   |  1 -
 drivers/timer/tsc_timer.c   | 49 +
 include/bootstage.h |  6 -
 12 files changed, 55 insertions(+), 32 deletions(-)

-- 
2.14.1.581.gf28d330327-goog

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


Re: [U-Boot] [PATCH 11/13] x86: braswell: Add FSP configuration

2017-09-05 Thread Simon Glass
Hi Bin,

On 26 August 2017 at 18:10, Bin Meng  wrote:
> Hi Simon,
>
> On Sun, Aug 27, 2017 at 6:39 AM, Simon Glass  wrote:
>> Hi Bin,
>>
>> On 26 August 2017 at 07:56, Bin Meng  wrote:
>>> Hi Simon,
>>>
>>> On Sat, Aug 26, 2017 at 9:39 PM, Simon Glass  wrote:
 On 15 August 2017 at 23:42, Bin Meng  wrote:
> Add FSP related configuration for Braswell.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/cpu/braswell/Makefile |   2 +-
>  arch/x86/cpu/braswell/fsp_configs.c| 158 ++
>  .../include/asm/arch-braswell/fsp/fsp_configs.h|  89 
>  arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h   | 172 +++
>  arch/x86/include/asm/arch-braswell/gpio.h  | 234 
> +
>  5 files changed, 654 insertions(+), 1 deletion(-)
>  create mode 100644 arch/x86/cpu/braswell/fsp_configs.c
>  create mode 100644 arch/x86/include/asm/arch-braswell/fsp/fsp_configs.h
>  create mode 100644 arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h
>  create mode 100644 arch/x86/include/asm/arch-braswell/gpio.h
>

 Reviewed-by: Simon Glass 

 Can this use drivers instead of manual device-tree access?
>>>
>>> Which part?
>>
>> Well you have intel,braswell-fsp for example. You could create a
>> driver with the two compatible strings and have it read the platdata
>> from the DT in the ofdata_to_platdata() method.
>
> I thought this before. We discussed the possibility of adding a new
> FSP uclass long time ago. When I added the Braswell support, I wanted
> to have a try since Braswell's FSP is v1.1 spec complaint and if we
> have a uclass for FSP we can put the common stuff in the uclass
> driver. But in the end I did not do it because:
>
> 1. FSP's initialization sequence is just a one time initialization and
> we don't do anything after the initialization completes.

That's not a very good reason though. There will be several drivers like that.

> 2. Making a uclass for FSP means we have to delay fsp_init() to after
> initf_dm().But after fsp_init(), we will return to board_init_f()
> again and do the initialization for the second time. So all previous
> platdata of FSP that is set up by DM gets lost during this process.

Yes, although this is in the nature of the broken FSP API that we hope
Intel will fix. As I understand it we already do the init twice, this
is just a case of knowing what stage we are at.

> 3. There are some other architecture-dependent stuff in the
> arch_fsp_init() that is not suitable to be put in a FSP driver.

But I am suggesting having a driver specific to the arch, not a
generic one, so this should not be a problem.

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


Re: [U-Boot] [PATCH 5/5] x86: fsp: Configure SPI opcode registers before SPI is locked down

2017-09-05 Thread Simon Glass
Hi Bin,

On 26 August 2017 at 18:12, Bin Meng  wrote:
> Hi Simon,
>
> On Sun, Aug 27, 2017 at 6:40 AM, Simon Glass  wrote:
>> Hi Bin,
>>
>> On 26 August 2017 at 07:58, Bin Meng  wrote:
>>> Hi Simon,
>>>
>>> On Sat, Aug 26, 2017 at 9:39 PM, Simon Glass  wrote:
 Hi Bin,

 On 15 August 2017 at 23:38, Bin Meng  wrote:
> Some Intel FSP (like Braswell) does SPI lock-down during the call
> to fsp_notify(INIT_PHASE_BOOT). But before SPI lock-down is done,
> it's bootloader's responsibility to configure the SPI controller's
> opcode registers properly otherwise SPI controller driver doesn't
> know how to communicate with the SPI flash device.
>
> This introduces a Kconfig option CONFIG_FSP_LOCKDOWN_SPI for such
> FSPs. When it is on, U-Boot will configure the SPI opcode registers
> before the lock-down.
>
> Signed-off-by: Bin Meng 
> ---
>
>  arch/x86/Kconfig  |  9 +
>  arch/x86/lib/fsp/fsp_common.c | 24 
>  2 files changed, 33 insertions(+)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index c26710b..5373082 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -401,6 +401,15 @@ config FSP_BROKEN_HOB
>   do not overwrite the important boot service data which is used 
> by
>   FSP, otherwise the subsequent call to fsp_notify() will fail.
>
> +config FSP_LOCKDOWN_SPI
> +   bool
> +   depends on HAVE_FSP
> +   help
> + Some Intel FSP (like Braswell) does SPI lock-down during the 
> call
> + to fsp_notify(INIT_PHASE_BOOT). This option should be turned on
> + for such FSP and U-Boot will configure the SPI opcode registers
> + before the lock-down.
> +
>  config ENABLE_MRC_CACHE
> bool "Enable MRC cache"
> depends on !EFI && !SYS_COREBOOT
> diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c
> index 3397bb8..320d87d 100644
> --- a/arch/x86/lib/fsp/fsp_common.c
> +++ b/arch/x86/lib/fsp/fsp_common.c
> @@ -19,6 +19,8 @@
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> +extern void ich_spi_config_opcode(struct udevice *dev);
> +
>  int checkcpu(void)
>  {
> return 0;
> @@ -49,6 +51,28 @@ void board_final_cleanup(void)
>  {
> u32 status;
>
> +#ifdef CONFIG_FSP_LOCKDOWN_SPI
> +   struct udevice *dev;
> +
> +   /*
> +* Some Intel FSP (like Braswell) does SPI lock-down during the 
> call
> +* to fsp_notify(INIT_PHASE_BOOT). But before SPI lock-down is 
> done,
> +* it's bootloader's responsibility to configure the SPI 
> controller's
> +* opcode registers properly otherwise SPI controller driver 
> doesn't
> +* know how to communicate with the SPI flash device.
> +*
> +* Note we cannot do such configuration elsewhere (eg: during the 
> SPI
> +* controller driver's probe() routine), becasue:
> +*
> +* 1). U-Boot SPI controller driver does not set the lock-down bit
> +* 2). Any SPI transfer will corrupt the contents of these 
> registers
> +*
> +* Hence we have to do it right here before SPI lock-down bit is 
> set.
> +*/
> +   if (!uclass_first_device_err(UCLASS_SPI, ))
> +   ich_spi_config_opcode(dev);

 I wonder if we could do this by using an operation instead of directly
 calling a function in the driver?

>>>
>>> Do you mean adding one operation to dm_spi_ops?
>>
>> Yes I think that would be better.
>>
>
> Since this is x86-specific, I would hesitate to add one.
>

Yes I understand that. Still I don't think we should call directly
into drivers. What do you suggest?

- add some sort of DM event system to which drivers can attach for notifications
- add an ioctl() method to the SPI uclass where we can put random
calls like this
- set up a new MISC device as a child of SPI which includes an ioctl
for this operation
- something else?

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


Re: [U-Boot] [PATCH v2 3/6] dm: x86: Update timer_get_boot_us to work before DM is ready

2017-09-05 Thread Simon Glass
Hi Bin,

On 27 August 2017 at 23:18, Bin Meng  wrote:
> Hi Simon,
>
> On Sun, Aug 27, 2017 at 11:23 PM, Simon Glass  wrote:
>> Use the new separate init function so that we can make use of the timer
>> before driver model is started up.
>>
>> At some point we should consider adding the microsecond timer to the timer
>> uclass interface since it would reduce the amount of plumbing here
>> slightly.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>> Changes in v2:
>> - Rebase on top of early timer code and simplify slightly
>>
>>  drivers/timer/tsc_timer.c | 19 ++-
>>  1 file changed, 14 insertions(+), 5 deletions(-)
>>
>
> I don't think this patch is needed. The early timer support was
> already provided in the patch [2/6] in this series.

The current version of timer_get_boot_us() does not init the timer if
it is not set up, so will return incorrect values at the start.

So I think this patch is needed.

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


Re: [U-Boot] video: ipu_common: fix build error

2017-09-05 Thread Peng Fan
Hi Eric,
On Mon, Sep 04, 2017 at 07:48:56PM -0700, Eric Nelson wrote:
>Hi Peng,
>
>Can you tell that I'm hunting a bug in an old version?
>
>I'm seeing a **very** intermittent regression between U-Boot
>versions 2015.07 and 2016.05 and happened to spot something
>in this patch.
>
>On 04/27/2016 07:07 PM, Peng Fan wrote:
>>Some toolchains fail to build
>>"clk->rate = (u64)(clk->parent->rate * 16) / div;"
>>And the cast usage is wrong.
>>
>>Use the following code to fix the issue,
>>"
>>   do_div(parent_rate, div);
>>   clk->rate = parent_rate;
>>"
>>
>>Reported-by: Peter Robinson 
>>Signed-off-by: Peng Fan 
>>Cc: Stefano Babic 
>>Cc: Fabio Estevam 
>>Cc: Tom Rini 
>>Cc: Anatolij Gustschin 
>>Cc: Peter Robinson 
>>Reviewed-by: Tom Rini 
>>Tested-by: Peter Robinson 
>>---
>>
>>Hi Peter,
>>
>>  Please help test this patch to see whether this fix your issue or not.
>>  Thanks for pointing out this issue.
>>
>>Thanks,
>>Peng.
>>
>>  drivers/video/ipu_common.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>>diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
>>index 36d4b23..5676a0f 100644
>>--- a/drivers/video/ipu_common.c
>>+++ b/drivers/video/ipu_common.c
>>@@ -352,7 +352,9 @@ static int ipu_pixel_clk_set_rate(struct clk *clk, 
>>unsigned long rate)
>>   */
>>  __raw_writel((div / 16) << 16, DI_BS_CLKGEN1(clk->id));
>
>Did we lose a multiply by 16 in this change?

We already have "parent_rate = (unsigned long long)clk->parent->rate * 16;"
in this function.

Thanks,
Peng.

>
>>- clk->rate = (u64)(clk->parent->rate * 16) / div;
>>+ do_div(parent_rate, div);
>>+
>>+ clk->rate = parent_rate;
>>  return 0;
>>  }
>>
>
>Please advise,
>
>
>Eric
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] gitignore: add intermediates from libfdt build

2017-09-05 Thread Tom Rini
On Tue, Sep 05, 2017 at 04:57:07PM +0800, Simon Glass wrote:
> Hi Bin,
> 
> On 5 September 2017 at 09:33, Bin Meng  wrote:
> > On Thu, Aug 31, 2017 at 8:52 PM, Simon Glass  wrote:
> >> On 29 August 2017 at 17:47, Philipp Tomsich
> >>  wrote:
> >>> Since ee95d10 (fdt: Build the new python libfdt module), a number of
> >>> additional files are auto-generated/installed into the tools directory.
> >>> List these in .gitignore to suppress having them listed as untracked.
> >>>
> >>> Signed-off-by: Philipp Tomsich 
> >>> References: ee95d10 (fdt: Build the new python libfdt module)
> >>>
> >>> ---
> >>>
> >>>  .gitignore | 8 
> >>>  1 file changed, 8 insertions(+)
> >>
> >> Reviewed-by: Simon Glass 
> >
> > I just noticed this. Shouldn't this be put in the tools/.gitignore instead?
> >
> > I have a similar patch @ http://patchwork.ozlabs.org/patch/809493/
> 
> Yes you are probably right. I have already sent a pull request though.
> 
> Tom what do you think?

We have many examples of .gitignore in subdirectories, so lets continue
there.  I believe that keeps the file manageable.

-- 
Tom


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


Re: [U-Boot] [PATCH 1/4] blk: Use macros for block device vendor/product/rev string size

2017-09-05 Thread Tom Rini
On Sun, Sep 03, 2017 at 09:00:07PM -0700, Bin Meng wrote:
> So far these are using magic numbers. Replace them with macros.
> 
> Signed-off-by: Bin Meng 
> ---
> 
>  include/blk.h | 10 +++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/include/blk.h b/include/blk.h
> index a106f9c..fced138 100644
> --- a/include/blk.h
> +++ b/include/blk.h
> @@ -36,6 +36,10 @@ enum if_type {
>   IF_TYPE_COUNT,  /* Number of interface types */
>  };
>  
> +#define BLK_VEN_SIZE 41
> +#define BLK_PRD_SIZE 21
> +#define BLK_REV_SIZE 9
> +
>  /*
>   * With driver model (CONFIG_BLK) this is uclass platform data, accessible
>   * with dev_get_uclass_platdata(dev)
> @@ -60,9 +64,9 @@ struct blk_desc {
>   lbaint_tlba;/* number of blocks */
>   unsigned long   blksz;  /* block size */
>   int log2blksz;  /* for convenience: log2(blksz) */
> - charvendor[40+1];   /* IDE model, SCSI Vendor */
> - charproduct[20+1];  /* IDE Serial no, SCSI product */
> - charrevision[8+1];  /* firmware revision */
> + charvendor[BLK_VEN_SIZE];   /* device vendor string */
> + charproduct[BLK_PRD_SIZE];  /* device product number */
> + charrevision[BLK_REV_SIZE]; /* firmware revision */

I think we should be using BLK_xxx_SIZE + 1 instead here and then it
looks like at least 2/4 shows why, we start to copy to the end of a char
buffer in, rather than ensuring we have string+NULL in each.  That is
why we use SIZE+1 here.  Thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH] env: Fix out of tree building of tools-all

2017-09-05 Thread Tom Rini
On Tue, Sep 05, 2017 at 02:20:09PM -0400, Tom Rini wrote:

> With the move of environment code from common/ to env/ a number of
> changes needed to be made to various make targets.  We missed updating
> some of the files required for out of tree builds of the tools.  Correct
> the 'environ' target to know that we need to work under tools/env/ still
> (not tools/environ/) and then update the wrappers in env_attr.c and
> env_flags.c to point to the new correct file.
> 
> Reported-by: Peter Robinson 
> Tested-by: Peter Robinson 
> Signed-off-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot,v2,1/2] env: Fix operation of 'make environ'

2017-09-05 Thread Tom Rini
On Tue, Sep 05, 2017 at 01:53:58AM -0600, Simon Glass wrote:

> This was broken by the recent environment refactoring. Specifically:
> 
> $  make environ
> scripts/Makefile.build:59: tools/environ/Makefile: No such file or directory
> make[1]: *** No rule to make target 'tools/environ/Makefile'.  Stop.
> make: *** [Makefile:1469: environ] Error 2
> 
> Fix this by updating the Makefile and adjusting the #include filesnames in
> two C files.
> 
> Fixes: ec74f5f (Makefile: Rename 'env' target to 'environ')
> Reported-by: Måns Rullgård 
> Signed-off-by: Simon Glass 

With a little re-working (as yes, I thought I had applied this patch,
but had not, oops), applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v2, 2/2] env: Add 'envtools' target to 'make help'

2017-09-05 Thread Tom Rini
On Tue, Sep 05, 2017 at 01:53:59AM -0600, Simon Glass wrote:

> The target is not currently mentioned anywhere. Add it to the help so
> people can find it.
> 
> Signed-off-by: Simon Glass 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v3, 1/1] usb: gadget: g_dnl: Sync internal SN variable with env

2017-09-05 Thread Tom Rini
On Fri, Sep 01, 2017 at 03:42:03PM +0300, Sam Protsenko wrote:

> Since commit 842778a09104 ("usb: gadget: g_dnl: only set iSerialNumber
> if we have a serial#") "fastboot devices" stopped to show correct device
> serial number for TI boards, showing this line instead:
> 
>   fastboot
> 
> This is because serial# env variable could be set after g_dnl gadget was
> initialized (e.g. by using env_set() in the board file).
> 
> To fix this, let's update internal serial number variable (g_dnl_serial)
> when "serial#" env var is changed.
> 
> Signed-off-by: Sam Protsenko 
> Cc: Felipe Balbi 
> Tested-by: Heiko Schocher 
> Acked-by: Łukasz Majewski 
> Reviewed-by: Marek Vasut 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Please pull u-boot-video/master

2017-09-05 Thread Tom Rini
On Tue, Sep 05, 2017 at 01:41:38PM +0200, Anatolij Gustschin wrote:

> Hi Tom,
> 
> Please pull these fixes for v2017.09. The IPU and splash driver changes
> passed the full build test, here is a status report:
> 
>   https://travis-ci.org/vdsao/u-boot-video/builds/271856994

Ah good, thanks.

> The following changes since commit 0e88cdd17da393e7dd6040de6a3fda289c00a51e:
> 
>   Prepare v2017.09-rc4 (2017-09-04 09:02:48 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-video.git master
> 
> for you to fetch changes up to c967fb78e488c148700dc8747472d7e1d7eaec30:
> 
>   MAINTAINERS: add lcd files to video section (2017-09-05 11:17:31 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PULL] Please pull u-boot-rockchip/master

2017-09-05 Thread Tom Rini
On Tue, Sep 05, 2017 at 11:25:17AM +0200, Dr. Philipp Tomsich wrote:

> Tom,
> 
> I have a few lingering fixes and config changes.
> 
> Thanks,
> Philipp.
> 
> 
> The following changes since commit 0e88cdd17da393e7dd6040de6a3fda289c00a51e:
> 
>   Prepare v2017.09-rc4 (2017-09-04 09:02:48 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-rockchip.git master
> 
> for you to fetch changes up to 5deaa530280fda91b8fef632c62c94e7bfd89561:
> 
>   rockchip: i2c: fix >32 byte reads (2017-09-05 11:13:36 +0200)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [PATCH V2 2/2] omap3: am3517_evm: Enable TI_COMMON_CMD_OPTION

2017-09-05 Thread Adam Ford
Enable TI_COMMON_CMD_OPTIONS and remove similar options
from the defconfig. Updated with savedefconfig.

Tested-by: Derald D. Woods 
Signed-off-by: Adam Ford 
---
V2: Resync with 2017.09-RC4

 board/logicpd/am3517evm/Kconfig |  2 ++
 configs/am3517_evm_defconfig| 20 ++--
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/board/logicpd/am3517evm/Kconfig b/board/logicpd/am3517evm/Kconfig
index 901f609..743e500 100644
--- a/board/logicpd/am3517evm/Kconfig
+++ b/board/logicpd/am3517evm/Kconfig
@@ -9,4 +9,6 @@ config SYS_VENDOR
 config SYS_CONFIG_NAME
default "am3517_evm"
 
+source "board/ti/common/Kconfig"
+
 endif
diff --git a/configs/am3517_evm_defconfig b/configs/am3517_evm_defconfig
index 27ea7a4..f26dbe8 100644
--- a/configs/am3517_evm_defconfig
+++ b/configs/am3517_evm_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 # CONFIG_SYS_THUMB_BUILD is not set
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SYS_TEXT_BASE=0x8010
+CONFIG_TI_COMMON_CMD_OPTIONS=y
 # CONFIG_SPL_GPIO_SUPPORT is not set
 CONFIG_TARGET_AM3517_EVM=y
 CONFIG_BOOTDELAY=10
@@ -11,27 +12,18 @@ CONFIG_SPL=y
 CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="AM3517_EVM # "
-CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMI is not set
 # CONFIG_CMD_IMLS is not set
-CONFIG_CMD_ASKENV=y
+# CONFIG_CMD_EEPROM is not set
 # CONFIG_CMD_FLASH is not set
 # CONFIG_CMD_FPGA is not set
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_I2C=y
-CONFIG_CMD_MMC=y
+# CONFIG_CMD_GPT is not set
 CONFIG_CMD_NAND=y
-CONFIG_CMD_PART=y
-CONFIG_CMD_USB=y
+# CONFIG_CMD_SPI is not set
 # CONFIG_CMD_SETEXPR is not set
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_PING=y
+# CONFIG_CMD_MII is not set
 CONFIG_CMD_CACHE=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
-CONFIG_CMD_EXT4_WRITE=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
+# CONFIG_CMD_TIME is not set
 CONFIG_CMD_UBI=y
 CONFIG_SPL_PARTITION_UUIDS=y
 CONFIG_ENV_IS_IN_NAND=y
-- 
2.7.4

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


[U-Boot] [PATCH V2 1/2] ARM: OMAP3: am3517_evm: Move header to ti_omap3_common.h

2017-09-05 Thread Adam Ford
Much of the AM3517 functions are copies of the standard definitions
used in ti_omap3_common.h.  Moving to include a common file
reduces the amount of duplicative code and clutter.  A few
AM3517 specific functions (like EMIF4) are explictly defined
and a few items are undefined or redefined, but overall the number
of lines of code shink.

Tested-by: Derald D. Woods 
Signed-off-by: Adam Ford 
---
V2: Resync with 2017.09-RC4

 include/configs/am3517_evm.h | 50 ++--
 1 file changed, 6 insertions(+), 44 deletions(-)

diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index 5435ca8..022b8a3 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -14,7 +14,6 @@
 #define __CONFIG_H
 
 #define CONFIG_NR_DRAM_BANKS   2   /* CS1 may or may not be populated */
-
 #define CONFIG_EMIF4   /* The chip has EMIF4 controller */
 
 /*
@@ -27,39 +26,26 @@
 #define CONFIG_SYS_SPL_MALLOC_START0x80208000
 #define CONFIG_SYS_SPL_MALLOC_SIZE 0x10
 
-#include   /* get chip and board defs */
-#include 
+#include 
+#undef CONFIG_SDRC /* Disable SDRC since we have EMIF4 */
 
 #define CONFIG_MISC_INIT_R
-#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
-#define CONFIG_SETUP_MEMORY_TAGS
-#define CONFIG_INITRD_TAG
 #define CONFIG_REVISION_TAG
 
-/* Clock Defines */
-#define V_OSCK 2600/* Clock output from T2 */
-#define V_SCLK (V_OSCK >> 1)
-
-/* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN  (16 << 20)
-
 /* Hardware drivers */
 
 /* NS16550 Configuration */
-#define V_NS16550_CLK  4800/* 48MHz (APLL96/2) */
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE(-4)
-#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK
 
 /* select serial console configuration */
 #define CONFIG_CONS_INDEX  3
 #define CONFIG_SYS_NS16550_COM3OMAP34XX_UART3
 #define CONFIG_SERIAL3 3   /* UART3 on AM3517 EVM */
 
+
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
-#define CONFIG_SYS_BAUDRATE_TABLE  {4800, 9600, 19200, 38400, 57600,\
-   115200}
 
 /*
  * USB configuration
@@ -103,15 +89,10 @@
 
 /* Board NAND Info. */
 #ifdef CONFIG_NAND
-#define CONFIG_NAND_OMAP_GPMC
 #define CONFIG_NAND_OMAP_GPMC_PREFETCH
 #define CONFIG_SYS_NAND_ADDR   NAND_BASE   /* physical address */
/* to access nand */
-#define CONFIG_SYS_NAND_BASE   NAND_BASE   /* physical address */
-   /* to access */
-   /* nand at CS0 */
-#define CONFIG_SYS_MAX_NAND_DEVICE 1   /* Max number of */
-   /* NAND devices */
+
 #define CONFIG_SYS_NAND_BUSWIDTH_16BIT
 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
 #define CONFIG_SYS_NAND_PAGE_COUNT 64
@@ -231,35 +212,15 @@
 /* We set the max number of command args high to avoid HUSH bugs. */
 #define CONFIG_SYS_MAXARGS 64
 
-/* Console I/O Buffer Size */
-#define CONFIG_SYS_CBSIZE  512
-
 /* memtest works on */
 #define CONFIG_SYS_MEMTEST_START   (OMAP34XX_SDRC_CS0)
 #define CONFIG_SYS_MEMTEST_END (OMAP34XX_SDRC_CS0 + \
0x01F0) /* 31MB */
 
-#define CONFIG_SYS_LOAD_ADDR   (OMAP34XX_SDRC_CS0) /* default load */
-   /* address */
-
-/*
- * AM3517 has 12 GP timers, they can be driven by the system clock
- * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK).
- * This rate is divided by a local divisor.
- */
-#define CONFIG_SYS_TIMERBASE   OMAP34XX_GPT2
-#define CONFIG_SYS_PTV 2   /* Divisor: 2^(PTV+1) => 8 */
-
 /* Physical Memory Map */
-#define PHYS_SDRAM_1   OMAP34XX_SDRC_CS0
-#define PHYS_SDRAM_2   OMAP34XX_SDRC_CS1
 #define CONFIG_SYS_CS0_SIZE(256 * 1024 * 1024)
-#define CONFIG_SYS_SDRAM_BASE  PHYS_SDRAM_1
 #define CONFIG_SYS_INIT_RAM_ADDR   0x4020f800
 #define CONFIG_SYS_INIT_RAM_SIZE   0x800
-#define CONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_INIT_RAM_ADDR + \
-CONFIG_SYS_INIT_RAM_SIZE - \
-GENERATED_GBL_DATA_SIZE)
 
 /* FLASH and environment organization */
 
@@ -284,11 +245,12 @@
 
 /* Defines for SPL */
 #define CONFIG_SPL_FRAMEWORK
-#define CONFIG_SPL_NAND_SIMPLE
+#undef CONFIG_SPL_TEXT_BASE
 #define CONFIG_SPL_TEXT_BASE   0x4020
 #define CONFIG_SPL_MAX_SIZE(SRAM_SCRATCH_SPACE_ADDR - \
 

Re: [U-Boot] [PATCH 00/23] efi_loader implement missing functions

2017-09-05 Thread Rob Clark
On Tue, Sep 5, 2017 at 4:55 AM, Simon Glass  wrote:
> Hi,
>
> On 1 September 2017 at 22:45, Tom Rini  wrote:
>> On Wed, Aug 30, 2017 at 04:16:34AM +0800, Simon Glass wrote:
>>> Hi,
>>>
>>> On 29 August 2017 at 22:16, Rob Clark  wrote:
>>> > On Tue, Aug 29, 2017 at 8:57 AM, Leif Lindholm  
>>> > wrote:
>>> >> On Tue, Aug 29, 2017 at 02:26:48PM +0200, Alexander Graf wrote:
>>> >>> > > > I would add command
>>> >>> > > > bootefi selftest.efi
>>> >>> > > > to run the tests and provide the python wrapper code to add it to 
>>> >>> > > > the
>>> >>> > > > test suite.
>>> >>> > >
>>> >>> > > I think that's a great idea, yes.
>>> >>> > I wonder how far we are from running UEFI tests (either the official
>>> >>> > ones, or I seem to remember hearing about some other test suite which
>>> >>> > didn't require UEFI shell)?
>>> >>>
>>> >>> Let's ask Leif, Ard and Dong.
>>> >>>
>>> >>> The official test suite definitely needs the UEFI Shell. Is the suite
>>> >>> publicly available by now?
>>> >>
>>> >> In binary form, you can access it already from the links on
>>> >> http://uefi.org/testtools
>>> >>
>>> >> Yes, 2.5 is latest release. No this is not a restriction ... the SCT
>>> >> releases have been lagging the specification releases a fair bit.
>>> >>
>>> >> The 2.5a package contains AARCH64, IA32 and X64 support (not ARM).
>>> >> Not that it couldn't contain ARM, it just hasn't been packaged.
>>> >>
>>> >>> > That seems more useful long term than re-inventing comprehensive UEFI
>>> >>> > test suite.  (Also, beyond just running shim/fallback/grub, I don't
>>> >>> > really have time to invent new tests for the stack of efi_loader
>>> >>> > patches I have.)
>>> >>>
>>> >>> Yes and no - it depends on the availability of the official suite :/.
>>> >>
>>> >> UEFI SCT is not yet open source/free software. Obviously, this is
>>> >> something Linaro has been lobbying for since day one of our
>>> >> involvement. There used to be little understanding for this, but that
>>> >> attitude has shifted substantially.
>>> >
>>> > So, if/until UEFI SCT is not an option, what about:
>>> >
>>> >   https://01.org/linux-uefi-validation
>>> >
>>> > (thx to pjones for pointing that out to me)
>>>
>>> Well in any case I'm not looking for a large functional test suite at
>>> this stage. It certainly could be useful, but not as a replacement for
>>> unit tests. The latter is for fast verification (so that everyone can
>>> run it as part of 'make tests') and easy identification of the
>>> location of bugs.
>>
>> I want to chime in here.  Unless we're talking hours of time, if "make
>> tests" takes 5 minutes to run, but that includes doing some sort of full
>> validation suite to the relevant EFI code, that seems like a win to me.
>> And if someone else is responsible for the contents of the tests and we
>> just have to confirm our expected results, that's an even bigger win.
>
> Yes it certainly is a win. But I'm already upset with how long the
> tests take to run so I would not be keen on anything that increases it
> much. How long does this test suite take to run normally?
>

I'm not sure how long SCT would take to run until we get it working (I
have a growing stack of patches on my wip-enough-uefi-for-shell
branch, and have Shell.efi running but still debugging sct.efi)..
maybe someone who has run SCT on a real UEFI implementation knows..
But that said, there seems to be some potential to run a subset of the
tests.  Either way, it seems like most of the time that travis runs
take is building a million variants of u-boot.  I'm not sure the time
spent running tests is really the issue.

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


[U-Boot] [PATCH 2/2] mx6sabresd: Add Serial Download Protocol support

2017-09-05 Thread Fabio Estevam
From: Fabio Estevam 

Add Serial Download Protocol support (SDP), which allows loading
SPL and u-boot.img via imx_usb_loader tool as explained in
doc/README.sdp.

Signed-off-by: Fabio Estevam 
---
In order to get SDP functional on sabresd we need these
two patches from Stefan:

imx: add macro to detect whether USB has been initialized
imx_common: detect USB serial downloader reliably

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

diff --git a/configs/mx6sabresd_defconfig b/configs/mx6sabresd_defconfig
index 7949c5e..1c08639 100644
--- a/configs/mx6sabresd_defconfig
+++ b/configs/mx6sabresd_defconfig
@@ -19,6 +19,9 @@ CONFIG_SPL=y
 CONFIG_SPL_EXT_SUPPORT=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
+CONFIG_SPL_USB_HOST_SUPPORT=y
+CONFIG_SPL_USB_GADGET_SUPPORT=y
+CONFIG_SPL_USB_SDP_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMLS is not set
@@ -32,6 +35,7 @@ CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_SF=y
 CONFIG_CMD_USB=y
+CONFIG_CMD_USB_SDP=y
 CONFIG_CMD_DHCP=y
 CONFIG_CMD_MII=y
 CONFIG_CMD_PING=y
-- 
2.7.4

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


[U-Boot] [PATCH 1/2] toradex: imx6: Move g_dnl_bind_fixup() into common SPL code

2017-09-05 Thread Fabio Estevam
From: Fabio Estevam 

Instead of having every board file to add its own g_dnl_bind_fixup()
implementation, move it to the common imx6 SPL code.

Signed-off-by: Fabio Estevam 
Reviewed-by: Łukasz Majewski 
---
Changes since RFC: 
- Keep the non-SPL g_dnl_bind_fixup inside tdx-common.c 

 arch/arm/mach-imx/spl.c   | 10 ++
 board/toradex/apalis_imx6/apalis_imx6.c   | 13 -
 board/toradex/colibri_imx6/colibri_imx6.c | 13 -
 3 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 8e8e2f7..e350bc9 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -86,6 +87,15 @@ u32 spl_boot_device(void)
}
return BOOT_DEVICE_NONE;
 }
+
+#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
+{
+   put_unaligned(CONFIG_G_DNL_PRODUCT_NUM + 0xfff, >idProduct);
+
+   return 0;
+}
+#endif
 #endif
 
 #if defined(CONFIG_SPL_MMC_SUPPORT)
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
b/board/toradex/apalis_imx6/apalis_imx6.c
index ebc6c12..628a61d 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -29,7 +29,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1224,18 +1223,6 @@ void reset_cpu(ulong addr)
 {
 }
 
-#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
-int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-{
-   unsigned short usb_pid;
-
-   usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
-   put_unaligned(usb_pid, >idProduct);
-
-   return 0;
-}
-#endif
-
 #endif
 
 static struct mxc_serial_platdata mxc_serial_plat = {
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c 
b/board/toradex/colibri_imx6/colibri_imx6.c
index 669d912..756e3f3 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -28,7 +28,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -1108,18 +1107,6 @@ void reset_cpu(ulong addr)
 {
 }
 
-#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
-int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
-{
-   unsigned short usb_pid;
-
-   usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
-   put_unaligned(usb_pid, >idProduct);
-
-   return 0;
-}
-#endif
-
 #endif
 
 static struct mxc_serial_platdata mxc_serial_plat = {
-- 
2.7.4

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


Re: [U-Boot] rk3188/rock_defconfig sdmmc failures

2017-09-05 Thread Heiko Stübner
Hi Artturi,

Am Mittwoch, 6. September 2017, 01:50:38 CEST schrieb Artturi Alm:
> So, being optimistic, i added compatible found from
> arch/arm/dts/rk3xxx.dtsi, included by rk3188:
> 
> diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
> index e7fcf89..a879fcd 100644
> --- a/drivers/mmc/rockchip_dw_mmc.c
> +++ b/drivers/mmc/rockchip_dw_mmc.c
> @@ -160,6 +160,7 @@ static int rockchip_dwmmc_bind(struct udevice *dev)
> 
>  static const struct udevice_id rockchip_dwmmc_ids[] = {
> { .compatible = "rockchip,rk3288-dw-mshc" },
> +   { .compatible = "rockchip,rk2928-dw-mshc" },
> { }
>  };

The rk3188 SPL is using OF_PLATDATA which transforms the devicetree entry
into a struct during compilation to save space in the image.
Relevant to this would be the U_BOOT_DRIVER below that compatibles, which
currently binds to the rockchip_rk3288_dw_mshc transformed compatible.

Adding a second U_BOOT_DRIVER entry there might help for the probing,
but seeing that the dw-mmc in the Linux kernel behaves differently for
rk3188 and rk3288 onwards, I'm not sure if it would work out of the box.

[...]

> now i've "successfully" enabled usb, but it took like +30tries
> w/"usb reset" until the host ports succesfully found my usb mass storage,
> and sometimes it leaves the dwc2 otg controller in a state where
> "usb tree" will fault while printing out, and reset the board, so i'd
> rather have sdmmc working for now instead, as it is enabled already in
> the default config for the board.

For usb you might want to make sure the usb host regulator is enabled
I have the below commands in my netboot uboot for the rock and it is
working quite reliable and so far I haven't seen usb-related issues there.

regulator dev host-pwr;
regulator enable;
usb start;


Hope that helps a bit
Heiko
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] rk3188/rock_defconfig sdmmc failures

2017-09-05 Thread Artturi Alm
Hi,

i'd like to get U-Boot working on rockchip/rk3188(rock_defconfig).
current as-is:

U-Boot SPL 2017.09-rc4-9-ga0e80c9 (Sep 05 2017 - 23:47:57)
Returning to boot ROM...


U-Boot 2017.09-rc4-9-ga0e80c9 (Sep 05 2017 - 23:47:57 +0300)

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

In:serial@20064000
Out:   serial@20064000
Err:   serial@20064000
Model: Radxa Rock
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.
=> mmc rescan
No MMC device available
=> usb
Unknown command 'usb' - try 'help'
=> 

So, being optimistic, i added compatible found from arch/arm/dts/rk3xxx.dtsi,
included by rk3188:

diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index e7fcf89..a879fcd 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -160,6 +160,7 @@ static int rockchip_dwmmc_bind(struct udevice *dev)
 
 static const struct udevice_id rockchip_dwmmc_ids[] = {
{ .compatible = "rockchip,rk3288-dw-mshc" },
+   { .compatible = "rockchip,rk2928-dw-mshc" },
{ }
 };
 

And it built w/no errors, but apparently dwmmc probe does fail w/-22:

U-Boot SPL 2017.09-rc4-00010-g1d12cc7 (Sep 06 2017 - 00:47:27)
Returning to boot ROM...


U-Boot 2017.09-rc4-00010-g1d12cc7 (Sep 06 2017 - 00:47:27 +0300)

Model: Radxa Rock
DRAM:  2 GiB
MMC:   dwmmc@10214000 - probe failed: -22

*** Warning - No MMC card found, using default environment

In:serial@20064000
Out:   serial@20064000
Err:   serial@20064000
Model: Radxa Rock
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0 
no mmc device at slot 0
MMC Device 1 not found
no mmc device at slot 1
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.
=> mmc rescan
no mmc device at slot 0
=> mmc list

=> 


now i've "successfully" enabled usb, but it took like +30tries
w/"usb reset" until the host ports succesfully found my usb mass storage,
and sometimes it leaves the dwc2 otg controller in a state where
"usb tree" will fault while printing out, and reset the board, so i'd
rather have sdmmc working for now instead, as it is enabled already in
the default config for the board.

Anyone w/clues about what's broken/missing? or patches for me to try?

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


Re: [U-Boot] [RFC] toradex: imx6: Move g_dnl_bind_fixup() into common SPL code

2017-09-05 Thread Fabio Estevam
On Tue, Sep 5, 2017 at 6:18 PM, Stefan Agner  wrote:

> Note that 0xfff was a rather randomly picked offset, not sure if we want that 
> in common code.

Yes, I noticed that. I am inclined to go with 0xfff and then later we
can even introduce a CONFIG option for the offset if needed.

>> -#ifdef CONFIG_USB_GADGET_DOWNLOAD
>> -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
>> -{
>> - unsigned short usb_pid;
>> -
>> - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + tdx_hw_tag.prodid;
>> - put_unaligned(usb_pid, >idProduct);
>> -
>> - return 0;
>> -}
>> -#endif
>
> Nack to this part, this is U-Boot only (not used in SPL) and reads the 
> product ID from eMMC to generate the officially assigned Toradex USB Product 
> ID.

Ok, will prepare another version that keeps the non-SPL code then.

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


Re: [U-Boot] [ANN] U-Boot v2017.09-rc4 released

2017-09-05 Thread Tuomas Tynkkynen

Hi,

On 09/04/2017 10:55 PM, Paul Barker wrote:


I looks like u-boot v2017.09-rc4 is still unable to boot Linux on
Raspberry Pi devices. I've just tested this now on a Raspberry Pi
(original Model B) and confirmed that it gets stuck at "Starting
kernel ...".


FWIW, works for me. I think you need to be more specific since there are 
huge number of variables related to running Linux on the RPi. My 
configuration is:


- Device is Raspberry Pi Model B (512M RAM)
- Firmware is tagged 1.20170811
- U-Boot v2017.09-rc4
- The Foundation/Raspbian kernel tagged 1.20170811, based on 4.9.41. The 
kernel is self-built. Or well, built by the package manager in NixOS but 
I am the maintainer of the RPi kernel package there.
- As for the device tree, I am letting U-Boot load bcm2708-rpi-b.dtb 
built by the Foundation/Raspbian kernel from disk (i.e. firmware is not

involved with the device tree at all)
- The framebuffer, USB, keyboard & Ethernet work in Linux. I have never 
tested the other peripherals (or GPU acceleration).


My setup has been unchanged (except for routine package upgrades of the 
firmware, kernel & U-Boot obviously) since July 2016. That's when the 
Foundation/Raspbian kernel started requiring a device tree.

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


Re: [U-Boot] [RFC] toradex: imx6: Move g_dnl_bind_fixup() into common SPL code

2017-09-05 Thread Stefan Agner


On 03.09.2017 07:56, Fabio Estevam wrote:
> From: Fabio Estevam 
>
> Instead of having every board file to add its own g_dnl_bind_fixup()
> implementation, move it to the common imx6 SPL code.
>
> Signed-off-by: Fabio Estevam 
> ---
> Stefan,
>
> I don't have access to Toradex board to test it, hence marking it
> as RFC.
>
> I have tested it with imx6q-sabresd and it works fine on this board.
>
>  arch/arm/mach-imx/spl.c   | 10 ++
>  board/toradex/apalis_imx6/apalis_imx6.c   | 13 -
>  board/toradex/colibri_imx6/colibri_imx6.c | 13 -
>  board/toradex/common/tdx-common.c | 13 -
>  4 files changed, 10 insertions(+), 39 deletions(-)
>
> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> index 8e8e2f7..e350bc9 100644
> --- a/arch/arm/mach-imx/spl.c
> +++ b/arch/arm/mach-imx/spl.c
> @@ -14,6 +14,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -86,6 +87,15 @@ u32 spl_boot_device(void)
>   }
>   return BOOT_DEVICE_NONE;
>  }
> +
> +#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
> +int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> +{
> + put_unaligned(CONFIG_G_DNL_PRODUCT_NUM + 0xfff, >idProduct);

Note that 0xfff was a rather randomly picked offset, not sure if we want that 
in common code.



> +
> + return 0;
> +}
> +#endif
>  #endif
>  
>  #if defined(CONFIG_SPL_MMC_SUPPORT)
> diff --git a/board/toradex/apalis_imx6/apalis_imx6.c 
> b/board/toradex/apalis_imx6/apalis_imx6.c
> index ebc6c12..628a61d 100644
> --- a/board/toradex/apalis_imx6/apalis_imx6.c
> +++ b/board/toradex/apalis_imx6/apalis_imx6.c
> @@ -29,7 +29,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -1224,18 +1223,6 @@ void reset_cpu(ulong addr)
>  {
>  }
>  
> -#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
> -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> -{
> - unsigned short usb_pid;
> -
> - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
> - put_unaligned(usb_pid, >idProduct);
> -
> - return 0;
> -}
> -#endif
> -
>  #endif
>  
>  static struct mxc_serial_platdata mxc_serial_plat = {
> diff --git a/board/toradex/colibri_imx6/colibri_imx6.c 
> b/board/toradex/colibri_imx6/colibri_imx6.c
> index 669d912..756e3f3 100644
> --- a/board/toradex/colibri_imx6/colibri_imx6.c
> +++ b/board/toradex/colibri_imx6/colibri_imx6.c
> @@ -28,7 +28,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -1108,18 +1107,6 @@ void reset_cpu(ulong addr)
>  {
>  }
>  
> -#ifdef CONFIG_SPL_USB_GADGET_SUPPORT
> -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> -{
> - unsigned short usb_pid;
> -
> - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + 0xfff;
> - put_unaligned(usb_pid, >idProduct);
> -
> - return 0;
> -}
> -#endif
> -
>  #endif
>  
>  static struct mxc_serial_platdata mxc_serial_plat = {
> diff --git a/board/toradex/common/tdx-common.c 
> b/board/toradex/common/tdx-common.c
> index b4e4727..a7efeb8 100644
> --- a/board/toradex/common/tdx-common.c
> +++ b/board/toradex/common/tdx-common.c
> @@ -5,7 +5,6 @@
>   */
>  
>  #include 
> -#include 
>  #include 
>  
>  #include "tdx-cfg-block.h"
> @@ -109,18 +108,6 @@ int show_board_info(void)
>   return 0;
>  }
>  
> -#ifdef CONFIG_USB_GADGET_DOWNLOAD
> -int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
> -{
> - unsigned short usb_pid;
> -
> - usb_pid = TORADEX_USB_PRODUCT_NUM_OFFSET + tdx_hw_tag.prodid;
> - put_unaligned(usb_pid, >idProduct);
> -
> - return 0;
> -}
> -#endif

Nack to this part, this is U-Boot only (not used in SPL) and reads the product 
ID from eMMC to generate the officially assigned Toradex USB Product ID.

--
Stefan

> -
>  #if defined(CONFIG_OF_LIBFDT)
>  int ft_common_board_setup(void *blob, bd_t *bd)
>  {

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


[U-Boot] USB Ethernet with device model

2017-09-05 Thread Maxime Ripard
Hi,

I've been working with USB-Ethernet gadget for quite some time on the
Allwinner SoCs, especially because most Allwinner boards lack an
ethernet controller.

The thing is, it wasn't really upstreamable all this time since we've
had also some boards that had a controller with DM_ETH. And usb_ether
didn't have DM_ETH support until recently.

So I gave it a shot, and encountered a few weird things that prevented
it from working (and still do):

1) I converted our musb glue to support the DM even in the peripheral
   mode. Here is the code: http://code.bulix.org/m846ni-194479

   It almost works, except that usb_scan_bus in usb-uclass.c for some
   reason unknown to me tries to scan the peripheral device, and
   fails. Skipping that scan makes fastboot works, so I guess the
   peripheral is working. Is there any particular reason that the
   DM_USB code tries to scan even peripheral devices ?

2) I can't manage to get usb_ether to probe after that, using the
   DM. It seems that we need to call usb_ether_init, and that it looks
   for UCLASS_USB_DEV_GENERIC devices and binds the usb_ether gadget
   to it.

   However, every board or arch hooks I tried seems to be much earlier
   than the USB controller, leading to the binding failing since we
   don't have a controller to bind to yet.

   Adding that code right after the USB controller initialisation in
   the musb probe solves that issue, but for some other reason, it
   looks for a device of the USB_DEV_GENERIC uclass, while the uclass
   for the USB controllers seems to be USB. Actually, I don't seem to
   find any user of the USB_DEV_GENERIC uclass but the usb_ether
   driver, so I'm not really sure how it's supposed to work either...

Is there some user of this in U-Boot right now? the only call there is
to usb_ether_init seems to be for the am33xx SoCs, whose usb glue
don't register a peripheral controller (yet), so I don't really know
how that can work either.

Thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.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 2/2] arm: omap3_logic: Migrate SMC911X to Kconfig

2017-09-05 Thread Adam Ford
With SMC911X supported in Kconfig, let's migrate
the Logic PD OMAP3 board.

Signed-off-by: Adam Ford 
---
 configs/omap3_logic_defconfig | 4 
 include/configs/omap3_logic.h | 7 ---
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/configs/omap3_logic_defconfig b/configs/omap3_logic_defconfig
index 8d0a4d4..07abc55 100644
--- a/configs/omap3_logic_defconfig
+++ b/configs/omap3_logic_defconfig
@@ -40,6 +40,10 @@ CONFIG_MMC_OMAP36XX_PINS=y
 CONFIG_NAND=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x8
+CONFIG_NETDEVICES=y
+CONFIG_SMC911X=y
+CONFIG_SMC911X_BASE=0x0800
+CONFIG_SMC911X_32_BIT=y
 CONFIG_SYS_NS16550=y
 CONFIG_OMAP3_SPI=y
 CONFIG_USB=y
diff --git a/include/configs/omap3_logic.h b/include/configs/omap3_logic.h
index a4a40f4..6b7a2d6 100644
--- a/include/configs/omap3_logic.h
+++ b/include/configs/omap3_logic.h
@@ -242,13 +242,6 @@
 #define CONFIG_ENV_OFFSET  SMNAND_ENV_OFFSET
 #define CONFIG_ENV_ADDRSMNAND_ENV_OFFSET
 
-/* SMSC922x Ethernet */
-#if defined(CONFIG_CMD_NET)
-#define CONFIG_SMC911X
-#define CONFIG_SMC911X_32_BIT
-#define CONFIG_SMC911X_BASE0x0800
-#endif /* (CONFIG_CMD_NET) */
-
 /* Defines for SPL */
 
 /* NAND: SPL falcon mode configs */
-- 
2.7.4

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


[U-Boot] [PATCH 1/2] net: Add SMC911X driver to Kconfig

2017-09-05 Thread Adam Ford
There are a variety of boards that need some cleanup in their
respective include/configs file, but here is a foundation
for them to begin their transisiton.

Signed-off-by: Adam Ford 
---
 drivers/net/Kconfig | 29 +
 1 file changed, 29 insertions(+)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 5ceea44..bd2a303 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -203,6 +203,35 @@ config RTL8169
  This driver supports Realtek 8169 series gigabit ethernet family of
  PCI/PCIe chipsets/adapters.
 
+config SMC911X
+   bool "SMSC LAN911x and LAN921x controller driver"
+
+if SMC911X
+
+config SMC911X_BASE
+   hex "SMC911X Base Address"
+   default 0
+   help
+ Define this to hold the physical address
+ of the device (I/O space)
+
+choice
+   prompt "SMC911X bus width"
+   default SMC911X_16_BIT
+
+config SMC911X_32_BIT
+   bool "Enable 32-bit interface"
+
+config SMC911X_16_BIT
+   bool "Enable 16-bit interface"
+   help
+ Define this if data bus is 16 bits. If your processor
+ automatically converts one 32 bit word to two 16 bit
+ words you may also try CONFIG_SMC911X_32_BIT.
+
+endchoice
+endif #SMC911X
+
 config SUN7I_GMAC
bool "Enable Allwinner GMAC Ethernet support"
help
-- 
2.7.4

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


Re: [U-Boot] [PATCH] env: Fix out of tree building of tools-all

2017-09-05 Thread Peter Robinson
On Tue, Sep 5, 2017 at 7:20 PM, Tom Rini  wrote:
> With the move of environment code from common/ to env/ a number of
> changes needed to be made to various make targets.  We missed updating
> some of the files required for out of tree builds of the tools.  Correct
> the 'environ' target to know that we need to work under tools/env/ still
> (not tools/environ/) and then update the wrappers in env_attr.c and
> env_flags.c to point to the new correct file.
>
> Reported-by: Peter Robinson 
> Signed-off-by: Tom Rini 
Tested-by: Peter Robinson 

Works for my use case, thanks for the quick fix.

Regards,
Peter

> ---
>  Makefile  | 2 +-
>  tools/env/env_attr.c  | 2 +-
>  tools/env/env_flags.c | 2 +-
>  tools/env/fw_env.c| 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index 792162521155..020ebd50ad22 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1466,7 +1466,7 @@ checkarmreloc: u-boot
> fi
>
>  environ: scripts_basic
> -   $(Q)$(MAKE) $(build)=tools/$@
> +   $(Q)$(MAKE) $(build)=tools/env
>
>  tools-only: scripts_basic $(version_h) $(timestamp_h)
> $(Q)$(MAKE) $(build)=tools
> diff --git a/tools/env/env_attr.c b/tools/env/env_attr.c
> index 502d4c900bf2..4d8536335c30 100644
> --- a/tools/env/env_attr.c
> +++ b/tools/env/env_attr.c
> @@ -1 +1 @@
> -#include "../../common/env_attr.c"
> +#include "../../env/attr.c"
> diff --git a/tools/env/env_flags.c b/tools/env/env_flags.c
> index b261cb8e3907..71e13e2021f6 100644
> --- a/tools/env/env_flags.c
> +++ b/tools/env/env_flags.c
> @@ -1 +1 @@
> -#include "../../common/env_flags.c"
> +#include "../../env/flags.c"
> diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
> index 965e1662d702..ab06415898c2 100644
> --- a/tools/env/fw_env.c
> +++ b/tools/env/fw_env.c
> @@ -755,7 +755,7 @@ static int flash_read_buf (int dev, int fd, void *buf, 
> size_t count,
>
> /*
>  * If a block is bad, we retry in the next block at the same
> -* offset - see common/env_nand.c::writeenv()
> +* offset - see env/nand.c::writeenv()
>  */
> lseek (fd, blockstart + block_seek, SEEK_SET);
>
> --
> 1.9.1
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] i2c: muxes: pca954x: Add support for GPIO reset line

2017-09-05 Thread Moritz Fischer
This commit adds support for GPIO reset lines matching the
common linux "reset-gpios" devicetree binding.

Signed-off-by: Moritz Fischer 
Cc: Heiko Schocher 
Cc: Stefan Roese 
Cc: Marek Behún 
Cc: Simon Glass 
Cc: Michal Simek 

---
 drivers/i2c/muxes/pca954x.c | 44 +++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c
index 383f72f552..dd28ff057b 100644
--- a/drivers/i2c/muxes/pca954x.c
+++ b/drivers/i2c/muxes/pca954x.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2015 - 2016 Xilinx, Inc.
+ * Copyright (C) 2017 National Instruments Corp
  * Written by Michal Simek
  *
  * SPDX-License-Identifier:GPL-2.0+
@@ -9,7 +10,10 @@
 #include 
 #include 
 #include 
-#include 
+
+#if CONFIG_DM_GPIO
+# include 
+#endif /* CONFIG_DM_GPIO */
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -30,6 +34,9 @@ struct chip_desc {
 struct pca954x_priv {
u32 addr; /* I2C mux address */
u32 width; /* I2C mux width - number of busses */
+#ifdef CONFIG_DM_GPIO
+   struct gpio_desc gpio_mux_reset;
+#endif /* CONFIG_DM_GPIO */
 };
 
 static const struct chip_desc chips[] = {
@@ -105,10 +112,45 @@ static int pca954x_ofdata_to_platdata(struct udevice *dev)
return 0;
 }
 
+static int pca954x_probe(struct udevice *dev)
+{
+#ifdef CONFIG_DM_GPIO
+   struct pca954x_priv *priv = dev_get_priv(dev);
+   int err;
+
+   err = gpio_request_by_name(dev, "reset-gpios", 0,
+   >gpio_mux_reset, GPIOD_IS_OUT);
+
+   /* it's optional so only bail if we get a real error */
+   if (err && (err != -ENOENT))
+   return err;
+
+   /* dm will take care of polarity */
+   if (dm_gpio_is_valid(>gpio_mux_reset))
+   dm_gpio_set_value(>gpio_mux_reset, 0);
+
+#endif /* CONFIG_DM_GPIO */
+   return 0;
+}
+
+static int pca954x_remove(struct udevice *dev)
+{
+#ifdef CONFIG_DM_GPIO
+   struct pca954x_priv *priv = dev_get_priv(dev);
+
+   if (dm_gpio_is_valid(>gpio_mux_reset))
+   dm_gpio_free(dev, >gpio_mux_reset);
+
+#endif /* CONFIG_DM_GPIO */
+   return 0;
+}
+
 U_BOOT_DRIVER(pca954x) = {
.name = "pca954x",
.id = UCLASS_I2C_MUX,
.of_match = pca954x_ids,
+   .probe = pca954x_probe,
+   .remove = pca954x_remove,
.ops = _ops,
.ofdata_to_platdata = pca954x_ofdata_to_platdata,
.priv_auto_alloc_size = sizeof(struct pca954x_priv),
-- 
2.14.1

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


[U-Boot] [PATCH] env: Fix out of tree building of tools-all

2017-09-05 Thread Tom Rini
With the move of environment code from common/ to env/ a number of
changes needed to be made to various make targets.  We missed updating
some of the files required for out of tree builds of the tools.  Correct
the 'environ' target to know that we need to work under tools/env/ still
(not tools/environ/) and then update the wrappers in env_attr.c and
env_flags.c to point to the new correct file.

Reported-by: Peter Robinson 
Signed-off-by: Tom Rini 
---
 Makefile  | 2 +-
 tools/env/env_attr.c  | 2 +-
 tools/env/env_flags.c | 2 +-
 tools/env/fw_env.c| 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 792162521155..020ebd50ad22 100644
--- a/Makefile
+++ b/Makefile
@@ -1466,7 +1466,7 @@ checkarmreloc: u-boot
fi
 
 environ: scripts_basic
-   $(Q)$(MAKE) $(build)=tools/$@
+   $(Q)$(MAKE) $(build)=tools/env
 
 tools-only: scripts_basic $(version_h) $(timestamp_h)
$(Q)$(MAKE) $(build)=tools
diff --git a/tools/env/env_attr.c b/tools/env/env_attr.c
index 502d4c900bf2..4d8536335c30 100644
--- a/tools/env/env_attr.c
+++ b/tools/env/env_attr.c
@@ -1 +1 @@
-#include "../../common/env_attr.c"
+#include "../../env/attr.c"
diff --git a/tools/env/env_flags.c b/tools/env/env_flags.c
index b261cb8e3907..71e13e2021f6 100644
--- a/tools/env/env_flags.c
+++ b/tools/env/env_flags.c
@@ -1 +1 @@
-#include "../../common/env_flags.c"
+#include "../../env/flags.c"
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 965e1662d702..ab06415898c2 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -755,7 +755,7 @@ static int flash_read_buf (int dev, int fd, void *buf, 
size_t count,
 
/*
 * If a block is bad, we retry in the next block at the same
-* offset - see common/env_nand.c::writeenv()
+* offset - see env/nand.c::writeenv()
 */
lseek (fd, blockstart + block_seek, SEEK_SET);
 
-- 
1.9.1

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


Re: [U-Boot] [ANN] U-Boot v2017.09-rc4 released

2017-09-05 Thread Peter Robinson
On Tue, Sep 5, 2017 at 6:55 PM, Tom Rini  wrote:
> On Tue, Sep 05, 2017 at 06:47:20PM +0100, Peter Robinson wrote:
>> On Tue, Sep 5, 2017 at 6:42 PM, Tom Rini  wrote:
>> > On Tue, Sep 05, 2017 at 06:26:59PM +0100, Peter Robinson wrote:
>> >> On Mon, Sep 4, 2017 at 2:05 PM, Tom Rini  wrote:
>> >> > Hey all,
>> >> >
>> >> > It's release day and v2017.09-rc4 is out.  It's a week until release
>> >> > day.  Please let me know if you know of any regressions, thanks!
>> >>
>> >> I'm seeing an issue with a "make defconfig" we use in Fedora for
>> >> various utils on x86 which has regressed since RC2 (sorry, currently
>> >> traveling so not sure if it was before/after RC3). The error is:
>> >>
>> >> make -f ../scripts/Makefile.build obj=scripts
>> >>   GEN ./Makefile
>> >> make -f ../scripts/Makefile.build obj=tools/environ
>> >>   gcc -O2 -g -pipe -Wall -Werror=format-security
>> >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
>> >> --param=ssp-buffer-size=4 -grecord-gcc-switches
>> >> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic
>> >> -Wp,-MD,scripts/.bin2c.d -Iscripts -Wall -Wstrict-prototypes -O2
>> >> -fomit-frame-pointer -o scripts/bin2c ../scripts/bin2c.c
>> >> ../scripts/Makefile.build:59: ../tools/environ/Makefile: No such file
>> >> or directory
>> >> make[2]: *** No rule to make target '../tools/environ/Makefile'.  Stop.
>> >> make[1]: *** [/builddir/build/BUILD/u-boot-2017.09-rc4/Makefile:1469:
>> >> environ] Error 2
>> >> make[1]: *** Waiting for unfinished jobs
>> >> if [ -f ../.config -o -d ../include/config ]; then \
>> >> echo >&2 "  .. is not clean, please run 'make mrproper'"; \
>> >> echo >&2 "  in the '..' directory.";\
>> >> /bin/false; \
>> >> fi;
>> >> make[1]: Leaving directory 
>> >> '/builddir/build/BUILD/u-boot-2017.09-rc4/builds'
>> >
>> > What's the full make command (or set of comands) ?  It looks like you're
>> > doing mkdir builds ; cd builds ; make -C .. O=`pwd` defconfig and then
>> > something else?  Thanks!
>>
>> Full build log on x86_64 is
>> https://kojipkgs.fedoraproject.org//work/tasks/9100/21659100/build.log
>
> OK, so tools-only is broken.  I see it now, thanks.

Correct, sorry, that's what I meant when I said "various utils" but
clearly my brain is operating differently to my fingers today :-D
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [ANN] U-Boot v2017.09-rc4 released

2017-09-05 Thread Tom Rini
On Tue, Sep 05, 2017 at 06:47:20PM +0100, Peter Robinson wrote:
> On Tue, Sep 5, 2017 at 6:42 PM, Tom Rini  wrote:
> > On Tue, Sep 05, 2017 at 06:26:59PM +0100, Peter Robinson wrote:
> >> On Mon, Sep 4, 2017 at 2:05 PM, Tom Rini  wrote:
> >> > Hey all,
> >> >
> >> > It's release day and v2017.09-rc4 is out.  It's a week until release
> >> > day.  Please let me know if you know of any regressions, thanks!
> >>
> >> I'm seeing an issue with a "make defconfig" we use in Fedora for
> >> various utils on x86 which has regressed since RC2 (sorry, currently
> >> traveling so not sure if it was before/after RC3). The error is:
> >>
> >> make -f ../scripts/Makefile.build obj=scripts
> >>   GEN ./Makefile
> >> make -f ../scripts/Makefile.build obj=tools/environ
> >>   gcc -O2 -g -pipe -Wall -Werror=format-security
> >> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
> >> --param=ssp-buffer-size=4 -grecord-gcc-switches
> >> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic
> >> -Wp,-MD,scripts/.bin2c.d -Iscripts -Wall -Wstrict-prototypes -O2
> >> -fomit-frame-pointer -o scripts/bin2c ../scripts/bin2c.c
> >> ../scripts/Makefile.build:59: ../tools/environ/Makefile: No such file
> >> or directory
> >> make[2]: *** No rule to make target '../tools/environ/Makefile'.  Stop.
> >> make[1]: *** [/builddir/build/BUILD/u-boot-2017.09-rc4/Makefile:1469:
> >> environ] Error 2
> >> make[1]: *** Waiting for unfinished jobs
> >> if [ -f ../.config -o -d ../include/config ]; then \
> >> echo >&2 "  .. is not clean, please run 'make mrproper'"; \
> >> echo >&2 "  in the '..' directory.";\
> >> /bin/false; \
> >> fi;
> >> make[1]: Leaving directory 
> >> '/builddir/build/BUILD/u-boot-2017.09-rc4/builds'
> >
> > What's the full make command (or set of comands) ?  It looks like you're
> > doing mkdir builds ; cd builds ; make -C .. O=`pwd` defconfig and then
> > something else?  Thanks!
> 
> Full build log on x86_64 is
> https://kojipkgs.fedoraproject.org//work/tasks/9100/21659100/build.log

OK, so tools-only is broken.  I see it now, thanks.

-- 
Tom


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


Re: [U-Boot] [ANN] U-Boot v2017.09-rc4 released

2017-09-05 Thread Peter Robinson
On Tue, Sep 5, 2017 at 6:42 PM, Tom Rini  wrote:
> On Tue, Sep 05, 2017 at 06:26:59PM +0100, Peter Robinson wrote:
>> On Mon, Sep 4, 2017 at 2:05 PM, Tom Rini  wrote:
>> > Hey all,
>> >
>> > It's release day and v2017.09-rc4 is out.  It's a week until release
>> > day.  Please let me know if you know of any regressions, thanks!
>>
>> I'm seeing an issue with a "make defconfig" we use in Fedora for
>> various utils on x86 which has regressed since RC2 (sorry, currently
>> traveling so not sure if it was before/after RC3). The error is:
>>
>> make -f ../scripts/Makefile.build obj=scripts
>>   GEN ./Makefile
>> make -f ../scripts/Makefile.build obj=tools/environ
>>   gcc -O2 -g -pipe -Wall -Werror=format-security
>> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
>> --param=ssp-buffer-size=4 -grecord-gcc-switches
>> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic
>> -Wp,-MD,scripts/.bin2c.d -Iscripts -Wall -Wstrict-prototypes -O2
>> -fomit-frame-pointer -o scripts/bin2c ../scripts/bin2c.c
>> ../scripts/Makefile.build:59: ../tools/environ/Makefile: No such file
>> or directory
>> make[2]: *** No rule to make target '../tools/environ/Makefile'.  Stop.
>> make[1]: *** [/builddir/build/BUILD/u-boot-2017.09-rc4/Makefile:1469:
>> environ] Error 2
>> make[1]: *** Waiting for unfinished jobs
>> if [ -f ../.config -o -d ../include/config ]; then \
>> echo >&2 "  .. is not clean, please run 'make mrproper'"; \
>> echo >&2 "  in the '..' directory.";\
>> /bin/false; \
>> fi;
>> make[1]: Leaving directory '/builddir/build/BUILD/u-boot-2017.09-rc4/builds'
>
> What's the full make command (or set of comands) ?  It looks like you're
> doing mkdir builds ; cd builds ; make -C .. O=`pwd` defconfig and then
> something else?  Thanks!

Full build log on x86_64 is
https://kojipkgs.fedoraproject.org//work/tasks/9100/21659100/build.log
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [ANN] U-Boot v2017.09-rc4 released

2017-09-05 Thread Tom Rini
On Tue, Sep 05, 2017 at 04:55:48PM +0800, Simon Glass wrote:
> Hi Paul,
> 
> On 5 September 2017 at 03:55, Paul Barker  wrote:
> > On Mon, Sep 4, 2017 at 2:05 PM, Tom Rini  wrote:
> >> Hey all,
> >>
> >> It's release day and v2017.09-rc4 is out.  It's a week until release
> >> day.  Please let me know if you know of any regressions, thanks!
> >>
> >> --
> >> Tom
> >
> > I looks like u-boot v2017.09-rc4 is still unable to boot Linux on
> > Raspberry Pi devices. I've just tested this now on a Raspberry Pi
> > (original Model B) and confirmed that it gets stuck at "Starting
> > kernel ...". This was also broken in v2017.07 but it's a regression
> > against v2017.05 where this was working. For reference see
> > https://lists.denx.de/pipermail/u-boot/2017-August/300857.html and
> > replies.
> >
> > I don't think we have a root cause or a full solution yet, but
> > re-enabling CONFIG_OF_EMBED in all Raspberry Pi defconfigs should at
> > least give us a workaround for now that will allow Linux to boot. Is
> > this something we can get into the v2017.09 release at this stage? If
> > so I'm happy to send the patch and do the testing.
> 
> Yes I think that is better than what we have now. Please go ahead.
> 
> I did plan to try to root-cause this, and Stephen Warren gave some
> hints, but so far I am in the dark.
> 
> One problem I have is that booting raspbian from U-Boot leaves me
> without a working keyboard/mouse/ethernet, which seems different to
> the problem you have. I am not sure whether this is a device tree
> problem or something else.

Yes, please, lets get at least a work-around for now.  Thanks!

-- 
Tom


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


Re: [U-Boot] [ANN] U-Boot v2017.09-rc4 released

2017-09-05 Thread Tom Rini
On Tue, Sep 05, 2017 at 06:26:59PM +0100, Peter Robinson wrote:
> On Mon, Sep 4, 2017 at 2:05 PM, Tom Rini  wrote:
> > Hey all,
> >
> > It's release day and v2017.09-rc4 is out.  It's a week until release
> > day.  Please let me know if you know of any regressions, thanks!
> 
> I'm seeing an issue with a "make defconfig" we use in Fedora for
> various utils on x86 which has regressed since RC2 (sorry, currently
> traveling so not sure if it was before/after RC3). The error is:
> 
> make -f ../scripts/Makefile.build obj=scripts
>   GEN ./Makefile
> make -f ../scripts/Makefile.build obj=tools/environ
>   gcc -O2 -g -pipe -Wall -Werror=format-security
> -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
> --param=ssp-buffer-size=4 -grecord-gcc-switches
> -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic
> -Wp,-MD,scripts/.bin2c.d -Iscripts -Wall -Wstrict-prototypes -O2
> -fomit-frame-pointer -o scripts/bin2c ../scripts/bin2c.c
> ../scripts/Makefile.build:59: ../tools/environ/Makefile: No such file
> or directory
> make[2]: *** No rule to make target '../tools/environ/Makefile'.  Stop.
> make[1]: *** [/builddir/build/BUILD/u-boot-2017.09-rc4/Makefile:1469:
> environ] Error 2
> make[1]: *** Waiting for unfinished jobs
> if [ -f ../.config -o -d ../include/config ]; then \
> echo >&2 "  .. is not clean, please run 'make mrproper'"; \
> echo >&2 "  in the '..' directory.";\
> /bin/false; \
> fi;
> make[1]: Leaving directory '/builddir/build/BUILD/u-boot-2017.09-rc4/builds'

What's the full make command (or set of comands) ?  It looks like you're
doing mkdir builds ; cd builds ; make -C .. O=`pwd` defconfig and then
something else?  Thanks!

-- 
Tom


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


Re: [U-Boot] [ANN] U-Boot v2017.09-rc4 released

2017-09-05 Thread Peter Robinson
On Mon, Sep 4, 2017 at 2:05 PM, Tom Rini  wrote:
> Hey all,
>
> It's release day and v2017.09-rc4 is out.  It's a week until release
> day.  Please let me know if you know of any regressions, thanks!

I'm seeing an issue with a "make defconfig" we use in Fedora for
various utils on x86 which has regressed since RC2 (sorry, currently
traveling so not sure if it was before/after RC3). The error is:

make -f ../scripts/Makefile.build obj=scripts
  GEN ./Makefile
make -f ../scripts/Makefile.build obj=tools/environ
  gcc -O2 -g -pipe -Wall -Werror=format-security
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong
--param=ssp-buffer-size=4 -grecord-gcc-switches
-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic
-Wp,-MD,scripts/.bin2c.d -Iscripts -Wall -Wstrict-prototypes -O2
-fomit-frame-pointer -o scripts/bin2c ../scripts/bin2c.c
../scripts/Makefile.build:59: ../tools/environ/Makefile: No such file
or directory
make[2]: *** No rule to make target '../tools/environ/Makefile'.  Stop.
make[1]: *** [/builddir/build/BUILD/u-boot-2017.09-rc4/Makefile:1469:
environ] Error 2
make[1]: *** Waiting for unfinished jobs
if [ -f ../.config -o -d ../include/config ]; then \
echo >&2 "  .. is not clean, please run 'make mrproper'"; \
echo >&2 "  in the '..' directory.";\
/bin/false; \
fi;
make[1]: Leaving directory '/builddir/build/BUILD/u-boot-2017.09-rc4/builds'
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Fabio Estevam
On Tue, Sep 5, 2017 at 1:26 PM, Stefan Agner  wrote:

> Yes, I understand.
>
> I am just saying, I don't see a point to use that macro over i.MX 7's
> Boot Information structure...

Correct, and I did not suggest this either :-)
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Stefan Agner
On 2017-09-05 09:18, Fabio Estevam wrote:
> On Tue, Sep 5, 2017 at 1:05 PM, Stefan Agner  wrote:
> 
>> i.MX 7 has a Boot Information structure which is passed from the Boot
>> ROM, so we have a much cleaner method there.
>> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/mach-imx/mx7/soc.c;h=87bf105f385d4c12bee6d038c0ba50e2e588124c;hb=HEAD#l392
>>
>> As far as I can tell this boot information structure is also accurate
>> when the Boot ROM entered serial downloader as a fallback.
> 
> What I meant is that the is_boot_from_usb() macro is also defined for
> MX7 and MX7ULP:
> 
> http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/include/asm/arch-mx7/imx-regs.h?h=imx_v2016.03_4.1.33_7ulp_beta#n1209
> 
> http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/include/asm/arch-mx7ulp/imx-regs.h?h=imx_v2016.03_4.1.33_7ulp_beta#n1207
> 

Yes, I understand.

I am just saying, I don't see a point to use that macro over i.MX 7's
Boot Information structure...

> 
>> Do we have boards using SPL on i.MX 7?
> 
> No, we don't have it currently.

Ok.

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


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Fabio Estevam
On Tue, Sep 5, 2017 at 1:05 PM, Stefan Agner  wrote:

> i.MX 7 has a Boot Information structure which is passed from the Boot
> ROM, so we have a much cleaner method there.
> http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/mach-imx/mx7/soc.c;h=87bf105f385d4c12bee6d038c0ba50e2e588124c;hb=HEAD#l392
>
> As far as I can tell this boot information structure is also accurate
> when the Boot ROM entered serial downloader as a fallback.

What I meant is that the is_boot_from_usb() macro is also defined for
MX7 and MX7ULP:

http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/include/asm/arch-mx7/imx-regs.h?h=imx_v2016.03_4.1.33_7ulp_beta#n1209

http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/include/asm/arch-mx7ulp/imx-regs.h?h=imx_v2016.03_4.1.33_7ulp_beta#n1207


> Do we have boards using SPL on i.MX 7?

No, we don't have it currently.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Stefan Agner
On 2017-09-05 06:45, Fabio Estevam wrote:
> Hi Stefano,
> 
> On Tue, Sep 5, 2017 at 8:16 AM, Stefano Babic  wrote:
> 
>> Maybe we get some further info from our "insider" (Fabio, Peng). It will
>> be very interesting to know if we can apply this to all spectrum from
>> i.MX6, or if there is some MX6 variant where the Bootrom is doing
>> something different.
> 
> Looking at NXP U-Boot code I see that this same mechanism applies not
> only to mx6, but it extends to mx7 and mx7ulp, so it seems like a good
> approach.

i.MX 7 has a Boot Information structure which is passed from the Boot
ROM, so we have a much cleaner method there.
http://git.denx.de/?p=u-boot/u-boot-imx.git;a=blob;f=arch/arm/mach-imx/mx7/soc.c;h=87bf105f385d4c12bee6d038c0ba50e2e588124c;hb=HEAD#l392

As far as I can tell this boot information structure is also accurate
when the Boot ROM entered serial downloader as a fallback.

Do we have boards using SPL on i.MX 7?

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


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Stefan Agner
On 2017-09-05 04:13, Fabio Estevam wrote:
> Hi Stefan,
> 
> On Mon, Sep 4, 2017 at 10:21 PM, Stefan Agner  wrote:
>> From: Stefan Agner 
>>
>> This macro allows to detect whether the boot ROM initialized USB
>> already (serial downloader). This is helpful to reliably detect
>> if the system has been recovered via USB serial downloader.
>>
>> Signed-off-by: Stefan Agner 
>> Acked-by: Marcel Ziswiler 
> 
> This allows Serial Download Protocol to work on imx6q sabresd:
> 
> Tested-by: Fabio Estevam 
> 
>> ---
>> Hi Stefano,
>>
>> I noted already in my initial post that detection of serial
>> downloader mode is somewhat brittle:
>> https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
>>
>> This came up quite fast now also for other boards:
>> https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
>>
>> We use this patches since quite some time. Also NXP uses this
>> detection method to start their mfgr tools... Altough a hack,
>> maybe we should still add it upstream?
>>
>> --
>> Stefan
>>
>>
>>  arch/arm/include/asm/arch-mx6/imx-regs.h | 7 +++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
>> b/arch/arm/include/asm/arch-mx6/imx-regs.h
>> index 86e267087a..895ef4de83 100644
>> --- a/arch/arm/include/asm/arch-mx6/imx-regs.h
>> +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
>> @@ -985,5 +985,12 @@ struct pwm_regs {
>> u32 pr;
>> u32 cnr;
>>  };
>> +
>> +/*
>> + * If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
>> + * If boot from the other mode, USB0_PWD will keep reset value
>> + */
>> +#defineis_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & 
>> (1<<20)))
> 
> Minor nit: imx-regs.h is better suited for storing register layout 
> definitions.
> 
> I think that arch/arm/include/asm/mach-imx/sys_proto.h  would be a
> more appropriate location for this macro.

Makes sense, will move it.


> 
> Also you could remove that tab between 'define' and the macro name.

Agreed.

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


Re: [U-Boot] [PATCH 0/3] Clean up make process for EFI payload

2017-09-05 Thread Andy Shevchenko
On Tue, 2017-09-05 at 03:19 +0200, Heinrich Schuchardt wrote:
> Currently we have a single EFI application that we can deliver
> integrated into U-Boot. It is a hello world application that
> can be called with 'bootefi hello'.
> 
> The Makefiles do not easily accomodate further EFI payloads
> like a unit test for the EFI API or an EFI shell.
> 
> This patch series changes Makefile.lib to allow additional
> EFI payloads. Required fixes to the helloworld app are
> provided.
> 
> Further work will be needed to accomodate EFI payloads built
> out of multiple source files.

Please, amend .gitignore, if needed, according to the changes.

> 
> Heinrich Schuchardt (3):
>   efi_loader: rename __efi_hello_world_*
>   scripts/Makefile.lib: generalize building built in EFI app
>   efi_loader: usage of always in Makefile
> 
>  cmd/bootefi.c  |  4 ++--
>  include/asm-generic/sections.h |  4 ++--
>  lib/efi_loader/Makefile|  5 +++--
>  scripts/Makefile.lib   | 28 +++-
>  4 files changed, 22 insertions(+), 19 deletions(-)
> 

-- 
Andy Shevchenko 
Intel Finland Oy
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/4] scripts/Makefile.lib: generalize building built in EFI app

2017-09-05 Thread Heinrich Schuchardt
Replace all occurences of helloworld by generalized forms.
This allows us to build additional EFI applications that are
included into the U-Boot binary without loading
scripts/Makefile.lib with specific filenames.

Signed-off-by: Heinrich Schuchardt 
---
v2
Removed superfluous reference to $($*_deps).
---
 scripts/Makefile.lib | 28 +++-
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 164c234b4c..ebc74f8987 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -342,20 +342,22 @@ cmd_S_ttf=
\
 $(obj)/%.S: $(src)/%.ttf
$(call cmd,S_ttf)
 
-# EFI Hello World application
+# EFI applications
+# A Makefile target *.efi is built as EFI application.
+# A Makefile target *_efi.S wraps *.efi as built-in EFI application.
 # ---
 
 # Generate an assembly file to wrap the EFI app
-cmd_S_efi= \
-(  \
-   echo '.section .rodata.efi.init,"a"';   \
-   echo '.balign 16';  \
-   echo '.global __efi_helloworld_begin';  \
-   echo '__efi_helloworld_begin:'; \
-   echo '.incbin "$<" ';   \
-   echo '__efi_helloworld_end:';   \
-   echo '.global __efi_helloworld_end';\
-   echo '.balign 16';  \
+cmd_S_efi= \
+(  \
+   echo '.section .rodata.$*.init,"a"';\
+   echo '.balign 16';  \
+   echo '.global __efi_$*_begin';  \
+   echo '__efi_$*_begin:'; \
+   echo '.incbin "$<" ';   \
+   echo '__efi_$*_end:';   \
+   echo '.global __efi_$*_end';\
+   echo '.balign 16';  \
 ) > $@
 
 $(obj)/%_efi.S: $(obj)/%.efi
@@ -366,7 +368,7 @@ cmd_efi_objcopy = $(OBJCOPY) -j .header -j .text -j .sdata 
-j .data -j \
.dynamic -j .dynsym  -j .rel* -j .rela* -j .reloc \
$(if $(EFI_TARGET),$(EFI_TARGET),-O binary) $^ $@
 
-$(obj)/%.efi: $(obj)/%.so
+$(obj)/%.efi: $(obj)/%_efi.so
$(call cmd,efi_objcopy)
 
 quiet_cmd_efi_ld = LD  $@
@@ -375,7 +377,7 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T 
$(EFI_LDS_PATH) -shared \
 
 EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
 
-$(obj)/helloworld.so: $(obj)/helloworld.o arch/$(ARCH)/lib/$(EFI_CRT0) \
+$(obj)/%_efi.so: $(obj)/%.o arch/$(ARCH)/lib/$(EFI_CRT0) \
arch/$(ARCH)/lib/$(EFI_RELOC)
$(call cmd,efi_ld)
 
-- 
2.11.0

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


[U-Boot] [PATCH v2 3/4] efi_loader: usage of always in Makefile

2017-09-05 Thread Heinrich Schuchardt
Variable always should only be appended but not overwritten by
lib/efi_loader/Makefile.

Remove variable efiprogs which is not otherwise used.

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 lib/efi_loader/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 6bca05aeb4..5200497230 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -10,8 +10,9 @@
 CFLAGS_helloworld.o := $(CFLAGS_EFI)
 CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI)
 
-efiprogs-$(CONFIG_CMD_BOOTEFI_HELLO_COMPILE) += helloworld.efi
-always := $(efiprogs-y)
+ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
+always += helloworld.efi
+endif
 
 obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
-- 
2.11.0

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


[U-Boot] [PATCH v2 4/4] efi_loader: allow multiple source files for EFI apps

2017-09-05 Thread Heinrich Schuchardt
With this patch an EFI application can be built
out of multiple source files.

All object files that are to be included into the EFI
application %.efi must be added to variable %-objs. E.g.

helloworld-objs = helloworld.o

script/Makefile.lib automatically generates file %_efi.d
containing the dependency definition.

This file is included in the next run of make. From now on
all objects in %-objs are built.

The %_efi.d file should be included in the source
distribution.

After adding a new file to %-objs the first make run will
fail due to the outdated %_efi.d file.

Signed-off-by: Heinrich Schuchardt 
---
v2
new patch
---
 lib/efi_loader/Makefile |  3 +++
 lib/efi_loader/helloworld_efi.d |  1 +
 scripts/Makefile.lib| 12 ++--
 3 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100644 lib/efi_loader/helloworld_efi.d

diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 5200497230..d6a9635cc8 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -10,6 +10,9 @@
 CFLAGS_helloworld.o := $(CFLAGS_EFI)
 CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI)
 
+helloworld-objs = \
+helloworld.o
+
 ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
 always += helloworld.efi
 endif
diff --git a/lib/efi_loader/helloworld_efi.d b/lib/efi_loader/helloworld_efi.d
new file mode 100644
index 00..892db64c8b
--- /dev/null
+++ b/lib/efi_loader/helloworld_efi.d
@@ -0,0 +1 @@
+lib/efi_loader/helloworld_efi.d: lib/efi_loader/helloworld.o
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index ebc74f8987..1a9f32902d 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -373,14 +373,22 @@ $(obj)/%.efi: $(obj)/%_efi.so
 
 quiet_cmd_efi_ld = LD  $@
 cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \
-   -Bsymbolic $^ -o $@
+   -Bsymbolic $(foreach _s, $($*-objs), $(obj)/$(_s)) -o $@
 
 EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
 
-$(obj)/%_efi.so: $(obj)/%.o arch/$(ARCH)/lib/$(EFI_CRT0) \
+.PRECIOUS: $(obj)/%_efi.d
+
+$(obj)/%_efi.so: $(obj)/%.o $(obj)/%.d arch/$(ARCH)/lib/$(EFI_CRT0) \
arch/$(ARCH)/lib/$(EFI_RELOC)
+   @echo $(obj)/$*_efi.d: $(foreach _s, $($*-objs), $(obj)/$(_s)) \
+   > $(obj)/$*_efi.d
$(call cmd,efi_ld)
 
+$(obj)/%.d:;
+
+include $(wildcard $(foreach _s, $(filter %_efi.o, $(obj-y)), $(_s:.o=.d)))
+
 # ACPI
 # ---
 quiet_cmd_acpi_c_asl= ASL $<
-- 
2.11.0

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


[U-Boot] [PATCH v2 0/4] Clean up make process for EFI payload

2017-09-05 Thread Heinrich Schuchardt
Currently we have a single EFI application that we can deliver
integrated into U-Boot. It is a hello world application that
can be called with 'bootefi hello'.

The Makefiles do not easily accomodate further EFI payloads
like a unit test for the EFI API or an EFI shell.

This patch series changes Makefile.lib to allow additional
EFI payloads. Required fixes to the helloworld app are
provided.

This second version of the patch series accomodated EFI payloads
build out of multiple source files.

Heinrich Schuchardt (4):
  efi_loader: rename __efi_hello_world_*
  scripts/Makefile.lib: generalize building built in EFI app
  efi_loader: usage of always in Makefile
  efi_loader: allow multiple source files for EFI apps

 cmd/bootefi.c   |  4 ++--
 include/asm-generic/sections.h  |  4 ++--
 lib/efi_loader/Makefile |  8 ++--
 lib/efi_loader/helloworld_efi.d |  1 +
 scripts/Makefile.lib| 38 --
 5 files changed, 35 insertions(+), 20 deletions(-)
 create mode 100644 lib/efi_loader/helloworld_efi.d

-- 
2.11.0

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


[U-Boot] [PATCH v2 1/4] efi_loader: rename __efi_hello_world_*

2017-09-05 Thread Heinrich Schuchardt
In scripts/Makefile.lib we build section including helloworld.efi.
This allows to load the EFI binary with command 'bootefi hello'.

scripts/Makefile.lib contains explicit references to strings
containing helloworld and hello_world. This makes it impossible
to generalize the coding to accomodate additional built in
EFI binaries.

Let us rename the variables __efi_hello_world_* to
__efi_helloworld_*.

Signed-off-by: Heinrich Schuchardt 
---
v2
no change
---
 cmd/bootefi.c  | 4 ++--
 include/asm-generic/sections.h | 4 ++--
 scripts/Makefile.lib   | 8 
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index a3768158a2..c5bfab1147 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -298,14 +298,14 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int 
argc, char * const argv[])
return CMD_RET_USAGE;
 #ifdef CONFIG_CMD_BOOTEFI_HELLO
if (!strcmp(argv[1], "hello")) {
-   ulong size = __efi_hello_world_end - __efi_hello_world_begin;
+   ulong size = __efi_helloworld_end - __efi_helloworld_begin;
 
saddr = env_get("loadaddr");
if (saddr)
addr = simple_strtoul(saddr, NULL, 16);
else
addr = CONFIG_SYS_LOAD_ADDR;
-   memcpy((char *)addr, __efi_hello_world_begin, size);
+   memcpy((char *)addr, __efi_helloworld_begin, size);
} else
 #endif
{
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index daf021b647..b6535705a5 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -22,8 +22,8 @@ extern char __kprobes_text_start[], __kprobes_text_end[];
 extern char __entry_text_start[], __entry_text_end[];
 extern char __initdata_begin[], __initdata_end[];
 extern char __start_rodata[], __end_rodata[];
-extern char __efi_hello_world_begin[];
-extern char __efi_hello_world_end[];
+extern char __efi_helloworld_begin[];
+extern char __efi_helloworld_end[];
 
 /* Start and end of .ctors section - used for constructor calls. */
 extern char __ctors_start[], __ctors_end[];
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7f97e8ebf3..164c234b4c 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -350,11 +350,11 @@ cmd_S_efi=
\
 (  \
echo '.section .rodata.efi.init,"a"';   \
echo '.balign 16';  \
-   echo '.global __efi_hello_world_begin'; \
-   echo '__efi_hello_world_begin:';\
+   echo '.global __efi_helloworld_begin';  \
+   echo '__efi_helloworld_begin:'; \
echo '.incbin "$<" ';   \
-   echo '__efi_hello_world_end:';  \
-   echo '.global __efi_hello_world_end';   \
+   echo '__efi_helloworld_end:';   \
+   echo '.global __efi_helloworld_end';\
echo '.balign 16';  \
 ) > $@
 
-- 
2.11.0

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


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Stefano Babic
Hi Eric,

On 05/09/2017 15:49, Eric Nelson wrote:
> Hi Stefano,
> 
> On 09/05/2017 04:16 AM, Stefano Babic wrote:
>> Hi Stefan,
>> On 05/09/2017 03:21, Stefan Agner wrote:
>>> From: Stefan Agner 
>>>
>>> This macro allows to detect whether the boot ROM initialized USB
>>> already (serial downloader). This is helpful to reliably detect
>>> if the system has been recovered via USB serial downloader.
>>>
>>> Signed-off-by: Stefan Agner 
>>> Acked-by: Marcel Ziswiler 
>>> ---
>>> Hi Stefano,
>>>
>>> I noted already in my initial post that detection of serial
>>> downloader mode is somewhat brittle:
>>> https://lists.denx.de/pipermail/u-boot/2017-August/301952.html
>>>
>>> This came up quite fast now also for other boards:
>>> https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html
>>>
>>> We use this patches since quite some time. Also NXP uses this
>>> detection method to start their mfgr tools...
>>
>> Then it seems to be an "undocumented feature" rather a hack.
>>
> 
> This patch only detects that the OTG PHY is active, so it's
> not really a hack.
> 

Agree.

> The next patch uses this to infer how it happened (booted using
> SDP), and since I don't think there's another way for that to
> happen, it also seems to be reasonable.

Right. It is absolutely reasonable.

> 
> Can you think of another way that the OTG PHY could be alive
> when the code is hit in SPL?

No, I can't - nothing that makes sense ;-)

> 
> ... A comment to that effect is probably in order though.
> 
> Please advise,

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] video: ipu_common: fix build error

2017-09-05 Thread Eric Nelson

Hi Fabio,

On 09/05/2017 06:33 AM, Fabio Estevam wrote:

Hi Eric,

On Mon, Sep 4, 2017 at 11:49 PM, Eric Nelson  wrote:

Hi Peng,

Can you tell that I'm hunting a bug in an old version?

I'm seeing a **very** intermittent regression between U-Boot
versions 2015.07 and 2016.05 and happened to spot something
in this patch.


Just curious: how does the regression manifest itself?



With **some** televisions at a client site, on **some** power-on
cycles, the HDMI output under Linux doesn't seem to be generated
properly.

We haven't been able to reproduce it in-house, so testing is
taking a while, and we haven't (yet) determined if the
divisor patch has anything to do with the problem.

We are running on an i.MX6DL, but the IPU clock frequency
change doesn't fix the issue (running at 19.8MHz instead of
26MHz).

All we know at the moment is that version 2015.07 works and
2016.05 fails with essentially no changes to the board files.

We're doing this remotely across time zones with limited access
to failing machine(s), so it may take the rest of the week
before we know for sure.

I'll update the thread when we nail it down.

Regards,


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


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Eric Nelson

Hi Stefano,

On 09/05/2017 04:16 AM, Stefano Babic wrote:

Hi Stefan,
On 05/09/2017 03:21, Stefan Agner wrote:

From: Stefan Agner 

This macro allows to detect whether the boot ROM initialized USB
already (serial downloader). This is helpful to reliably detect
if the system has been recovered via USB serial downloader.

Signed-off-by: Stefan Agner 
Acked-by: Marcel Ziswiler 
---
Hi Stefano,

I noted already in my initial post that detection of serial
downloader mode is somewhat brittle:
https://lists.denx.de/pipermail/u-boot/2017-August/301952.html

This came up quite fast now also for other boards:
https://www.mail-archive.com/u-boot@lists.denx.de/msg262234.html

We use this patches since quite some time. Also NXP uses this
detection method to start their mfgr tools...


Then it seems to be an "undocumented feature" rather a hack.



This patch only detects that the OTG PHY is active, so it's
not really a hack.

The next patch uses this to infer how it happened (booted using
SDP), and since I don't think there's another way for that to
happen, it also seems to be reasonable.

Can you think of another way that the OTG PHY could be alive
when the code is hit in SPL?

... A comment to that effect is probably in order though.

Please advise,


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


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Fabio Estevam
Hi Stefan,

On Tue, Sep 5, 2017 at 1:50 AM, Stefan Agner  wrote:

> Note this idea is borrowed from NXP downstream and seems to work here:
> http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/include/asm/arch-mx7/imx-regs.h?h=imx_v2016.03_4.1.15_2.0.0_ga#n1204

Please mention the NXP patch in the commit log, so that it is clear
where this idea is coming from.

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


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Fabio Estevam
Hi Stefano,

On Tue, Sep 5, 2017 at 8:16 AM, Stefano Babic  wrote:

> Maybe we get some further info from our "insider" (Fabio, Peng). It will
> be very interesting to know if we can apply this to all spectrum from
> i.MX6, or if there is some MX6 variant where the Bootrom is doing
> something different.

Looking at NXP U-Boot code I see that this same mechanism applies not
only to mx6, but it extends to mx7 and mx7ulp, so it seems like a good
approach.

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


Re: [U-Boot] [PATCH v1 1/2] imx: add macro to detect whether USB has been initialized

2017-09-05 Thread Eric Nelson

Hi Stefan,

On 09/04/2017 09:50 PM, Stefan Agner wrote:

On 2017-09-04 19:57, Eric Nelson wrote:

On 09/04/2017 06:21 PM, Stefan Agner wrote:





+
+/*
+ * If ROM fell back to USB recover mode, USBPH0_PWD will be clear to use USB
+ * If boot from the other mode, USB0_PWD will keep reset value
+ */
+#defineis_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
+
   #endif /* __ASSEMBLER__*/
   #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */


If I'm reading your comment correctly, the RXPWDRX bit will be set (the
PHY will be powered down) unless it was enabled by the Boot ROM.

Won't this also be clear if you've run 'usb start' under U-Boot?


Yes, this only works before a USB initialization...



Based on this, I'd recommend changing the macro name to something
like "is_udc_active" to reflect it's true meaning.


This should be fine for the use case I have in mind (see patch 2).

Note this idea is borrowed from NXP downstream and seems to work here:
http://git.freescale.com/git/cgit.cgi/imx/uboot-imx.git/tree/arch/arm/include/asm/arch-mx7/imx-regs.h?h=imx_v2016.03_4.1.15_2.0.0_ga#n1204



Understood.

Using this detection mechanism in SPL (where there isn't another path
for initializing the UDC) makes sense.

Regards,


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


Re: [U-Boot] [U-Boot,2/3] imx: mx6: correct IPU clock

2017-09-05 Thread Eric Nelson

Hi Stefano,

On 09/05/2017 06:30 AM, Stefano Babic wrote:

On 05/09/2017 14:56, Fabio Estevam wrote:

Hi Eric,

On Mon, Sep 4, 2017 at 11:37 PM, Eric Nelson  wrote:


--- a/include/configs/mx6sabre_common.h
+++ b/include/configs/mx6sabre_common.h
@@ -225,7 +225,11 @@
   #define CONFIG_BMP_16BPP
   #define CONFIG_VIDEO_LOGO
   #define CONFIG_VIDEO_BMP_LOGO
-#define CONFIG_IPUV3_CLK 26000
+#ifdef CONFIG_MX6DL
+#define CONFIG_IPUV3_CLK 19800
+#else
+#define CONFIG_IPUV3_CLK 26400
+#endif




Note that this should probably be applied for other boards
which are compiled for multiple CPU types.

At least the Boundary Nitrogen boards, but probably others
like Wand have ordering options for DL or Solo processors
and may need the reduced clock rate.


Agreed. The clock frequency decision should be done in run-time rather
than in build-time.


I agree, too. We have mechanism to take decisions at run time, at least
based on SOC type. Anyway, Anatolji has already merged this - should be
better to revert it ?



I don't think it should be reverted until we have a run-time decision
in place, or we'll re-introduce whatever problem the higher rate
caused, at least on SABRE boards with Solo or Dual-Lite processors.

I'm still wondering whether Peng has a description of the ramifications
of the higher rate on DL/Solo processors.

Regards,


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


Re: [U-Boot] video: ipu_common: fix build error

2017-09-05 Thread Fabio Estevam
Hi Eric,

On Mon, Sep 4, 2017 at 11:49 PM, Eric Nelson  wrote:
> Hi Peng,
>
> Can you tell that I'm hunting a bug in an old version?
>
> I'm seeing a **very** intermittent regression between U-Boot
> versions 2015.07 and 2016.05 and happened to spot something
> in this patch.

Just curious: how does the regression manifest itself?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot,2/3] imx: mx6: correct IPU clock

2017-09-05 Thread Stefano Babic
On 05/09/2017 14:56, Fabio Estevam wrote:
> Hi Eric,
> 
> On Mon, Sep 4, 2017 at 11:37 PM, Eric Nelson  wrote:
> 
>>> --- a/include/configs/mx6sabre_common.h
>>> +++ b/include/configs/mx6sabre_common.h
>>> @@ -225,7 +225,11 @@
>>>   #define CONFIG_BMP_16BPP
>>>   #define CONFIG_VIDEO_LOGO
>>>   #define CONFIG_VIDEO_BMP_LOGO
>>> -#define CONFIG_IPUV3_CLK 26000
>>> +#ifdef CONFIG_MX6DL
>>> +#define CONFIG_IPUV3_CLK 19800
>>> +#else
>>> +#define CONFIG_IPUV3_CLK 26400
>>> +#endif
>>
>>
>>
>> Note that this should probably be applied for other boards
>> which are compiled for multiple CPU types.
>>
>> At least the Boundary Nitrogen boards, but probably others
>> like Wand have ordering options for DL or Solo processors
>> and may need the reduced clock rate.
> 
> Agreed. The clock frequency decision should be done in run-time rather
> than in build-time.

I agree, too. We have mechanism to take decisions at run time, at least
based on SOC type. Anyway, Anatolji has already merged this - should be
better to revert it ?

Regards,
Stefano


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


Re: [U-Boot] [PATCH v3 1/1] usb: gadget: g_dnl: Sync internal SN variable with env

2017-09-05 Thread Marek Vasut
On 09/01/2017 02:42 PM, Sam Protsenko wrote:
> Since commit 842778a09104 ("usb: gadget: g_dnl: only set iSerialNumber
> if we have a serial#") "fastboot devices" stopped to show correct device
> serial number for TI boards, showing this line instead:
> 
>   fastboot
> 
> This is because serial# env variable could be set after g_dnl gadget was
> initialized (e.g. by using env_set() in the board file).
> 
> To fix this, let's update internal serial number variable (g_dnl_serial)
> when "serial#" env var is changed.
> 
> Signed-off-by: Sam Protsenko 
> Cc: Felipe Balbi 

Reviewed-by: Marek Vasut 

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


[U-Boot] [PATCH] ARM: rmobile: Fix SD divider settings on Gen3

2017-09-05 Thread Marek Vasut
On RCar M3 and on RCar H3 newer than and not including ES1.0, the SD clock
must be divided by 4 rather than 2 because a hardware workaround present
only in the H3 ES1.0 has been removed from these chips. U-Boot currently
only supports M3 and H3 ES 2.0 and newer, so configure the SD pre-divider
to 4 to prevent SD instability.

Signed-off-by: Marek Vasut 
Cc: Nobuhiro Iwamatsu 
---
 board/renesas/salvator-x/salvator-x.c | 8 
 board/renesas/ulcb/ulcb.c | 8 
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/board/renesas/salvator-x/salvator-x.c 
b/board/renesas/salvator-x/salvator-x.c
index 2695de5dbf..e260117802 100644
--- a/board/renesas/salvator-x/salvator-x.c
+++ b/board/renesas/salvator-x/salvator-x.c
@@ -74,10 +74,10 @@ int board_early_init_f(void)
/* SDHI0, 3 */
mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SD0_MSTP314 | SD3_MSTP311);
 
-   writel(0, SD0CKCR);
-   writel(0, SD1CKCR);
-   writel(0, SD2CKCR);
-   writel(0, SD3CKCR);
+   writel(1, SD0CKCR);
+   writel(1, SD1CKCR);
+   writel(1, SD2CKCR);
+   writel(1, SD3CKCR);
 
 #if defined(CONFIG_SYS_I2C) && defined(CONFIG_SYS_I2C_SH)
/* DVFS for reset */
diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c
index 2b6cc612c8..dc23228f4f 100644
--- a/board/renesas/ulcb/ulcb.c
+++ b/board/renesas/ulcb/ulcb.c
@@ -72,10 +72,10 @@ int board_early_init_f(void)
/* SDHI0 */
mstp_clrbits_le32(MSTPSR3, SMSTPCR3, SD0_MSTP314);
 
-   writel(0, SD0CKCR);
-   writel(0, SD1CKCR);
-   writel(0, SD2CKCR);
-   writel(0, SD3CKCR);
+   writel(1, SD0CKCR);
+   writel(1, SD1CKCR);
+   writel(1, SD2CKCR);
+   writel(1, SD3CKCR);
 
 #if defined(CONFIG_SYS_I2C) && defined(CONFIG_SYS_I2C_SH)
/* DVFS for reset */
-- 
2.13.2

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


[U-Boot] [PATCH v2] arm64: ls1012ardb: Add distro boot support

2017-09-05 Thread Rajesh Bhagat
Include common config_distro_defaults.h and config_distro_bootcmd.h
for u-boot enviroments to support automatical distro boot which
scan boot.scr from external storage devices(e.g. SD and USB)
and execute autoboot script.

Signed-off-by: Bhaskar Upadhaya 
Signed-off-by: Rajesh Bhagat 
---
Changes in v2: 
 - Rebased to latest u-boot

 configs/ls1012ardb_qspi_defconfig |  1 +
 include/configs/ls1012a_common.h  | 10 +-
 include/configs/ls1012ardb.h  | 38 ++
 3 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/configs/ls1012ardb_qspi_defconfig 
b/configs/ls1012ardb_qspi_defconfig
index 81702e3..39d7a54 100644
--- a/configs/ls1012ardb_qspi_defconfig
+++ b/configs/ls1012ardb_qspi_defconfig
@@ -50,3 +50,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_STORAGE=y
+CONFIG_DISTRO_DEFAULTS=y
diff --git a/include/configs/ls1012a_common.h b/include/configs/ls1012a_common.h
index 020c506..95ba24d 100644
--- a/include/configs/ls1012a_common.h
+++ b/include/configs/ls1012a_common.h
@@ -90,6 +90,14 @@
 #define CONFIG_HWCONFIG
 #define HWCONFIG_BUFFER_SIZE   128
 
+#include 
+#ifndef CONFIG_SPL_BUILD
+#define BOOT_TARGET_DEVICES(func) \
+   func(MMC, mmc, 0) \
+   func(USB, usb, 0)
+#include 
+#endif
+
 /* Initial environment variables */
 #define CONFIG_EXTRA_ENV_SETTINGS  \
"verify=no\0"   \
@@ -101,6 +109,7 @@
"kernel_load=0xa000\0"  \
"kernel_size=0x280\0"   \
 
+#undef CONFIG_BOOTCOMMAND
 #define CONFIG_BOOTCOMMAND "sf probe 0:0; sf read $kernel_load "\
"$kernel_start $kernel_size && "\
"bootm $kernel_load"
@@ -108,7 +117,6 @@
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE  512 /* Console I/O Buffer Size */
 #define CONFIG_SYS_LONGHELP
-#define CONFIG_CMDLINE_EDITING 1
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_SYS_MAXARGS 64  /* max command args */
 
diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h
index e9edcd2..c342aef 100644
--- a/include/configs/ls1012ardb.h
+++ b/include/configs/ls1012ardb.h
@@ -70,6 +70,44 @@
 #define CONFIG_SYS_MEMTEST_START   0x8000
 #define CONFIG_SYS_MEMTEST_END 0x9fff
 
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS  \
+   "verify=no\0"   \
+   "fdt_high=0x\0" \
+   "initrd_high=0x\0"  \
+   "fdt_addr=0x00f0\0" \
+   "kernel_addr=0x0100\0"  \
+   "scriptaddr=0x8000\0"   \
+   "fdtheader_addr_r=0x8010\0" \
+   "kernelheader_addr_r=0x8020\0"  \
+   "kernel_addr_r=0x8100\0"\
+   "fdt_addr_r=0x9000\0"   \
+   "load_addr=0xa000\0"\
+   "kernel_size=0x280\0"   \
+   "console=ttyS0,115200\0"\
+   BOOTENV \
+   "boot_scripts=ls1012ardb_boot.scr\0"\
+   "scan_dev_for_boot_part="   \
+"part list ${devtype} ${devnum} devplist; "\
+"env exists devplist || setenv devplist 1; "   \
+"for distro_bootpart in ${devplist}; do "  \
+ "if fstype ${devtype} "   \
+ "${devnum}:${distro_bootpart} "   \
+ "bootfstype; then "   \
+ "run scan_dev_for_boot; " \
+ "fi; "\
+ "done\0"  \
+   "installer=load mmc 0:2 $load_addr "\
+  "/flex_installer_arm64.itb; "\
+  "bootm $load_addr#$board\0"  \
+   "qspi_bootcmd=echo Trying load from qspi..;"\
+   "sf probe && sf read $load_addr "   \
+   "$kernel_addr $kernel_size && bootm $load_addr#$board\0" \
+
+#undef CONFIG_BOOTCOMMAND
+#if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
+#define CONFIG_BOOTCOMMAND "pfe stop;run distro_bootcmd;run qspi_bootcmd"
+#endif
 
 #include 
 
-- 
2.7.4

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


  1   2   >