[U-Boot] [PATCH] mx6sabresd: README: Add eMMC boot configuration

2017-04-07 Thread Breno Lima
Explain how to flash the eMMC and how to boot from it.

Signed-off-by: Breno Lima 
---
 board/freescale/mx6sabresd/README | 22 ++
 1 file changed, 22 insertions(+)

diff --git a/board/freescale/mx6sabresd/README 
b/board/freescale/mx6sabresd/README
index 5814b9d..875d4b2 100644
--- a/board/freescale/mx6sabresd/README
+++ b/board/freescale/mx6sabresd/README
@@ -27,6 +27,28 @@ This will generate the image called u-boot.imx.
 
 $ sudo dd if=u-boot.imx of=/dev/sdb bs=1K seek=1 && sync
 
+- Flash the u-boot.imx binary into the eMMC:
+
+Set SW6 to download mode: 1100
+
+Plug a usb cable to USB-OTG and load the u-boot image using the imx_usb_loader
+tool (https://github.com/boundarydevices/imx_usb_loader):
+
+$ sudo ./imx_usb u-boot.imx
+
+In U-boot change the eMMC partition config:
+
+=> mmc partconf 2 1 0 0
+
+Mount the eMMC in the host PC:
+
+=> ums 0 mmc 2
+
+Flash the u-boot.imx binary
+
+$ sudo dd if=u-boot.imx of=/dev/sdX bs=1K seek=1 && sync
+
+Set SW6 to eMMC 8-bit boot: 11010110
 
 2. Booting via SPL
 --
-- 
2.7.4

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


[U-Boot] [PATCH v2] mx6sabresd: README: Add eMMC boot configuration

2017-04-10 Thread Breno Lima
Explain how to flash the eMMC and how to boot from it.

Signed-off-by: Breno Lima 
---
Changes since v1:
- Add an extra section for booting from eMMC.

 board/freescale/mx6sabresd/README | 53 +--
 1 file changed, 46 insertions(+), 7 deletions(-)

diff --git a/board/freescale/mx6sabresd/README 
b/board/freescale/mx6sabresd/README
index 5814b9d..bcdbae6 100644
--- a/board/freescale/mx6sabresd/README
+++ b/board/freescale/mx6sabresd/README
@@ -3,15 +3,17 @@ How to use and build U-Boot on mx6sabresd:
 
 Currently there are three methods for booting mx6sabresd boards:
 
-1. Booting via Normal U-Boot (u-boot.imx)
+1. Booting from SD card via normal U-Boot (u-boot.imx)
 
-2. Booting via SPL (SPL and u-boot.img)
+2. Booting from eMMC via normal U-Boot
 
-3. Booting via Falcon mode (SPL launches the kernel directly)
+3. Booting via SPL (SPL and u-boot.img)
 
+4. Booting via Falcon mode (SPL launches the kernel directly)
 
-1. Booting via Normal U-Boot
-
+
+1. Booting from SD card via normal U-Boot
+-
 
 $ make mx6qsabresd_defconfig (If you want to build for mx6qsabresd)
 
@@ -28,7 +30,44 @@ This will generate the image called u-boot.imx.
 $ sudo dd if=u-boot.imx of=/dev/sdb bs=1K seek=1 && sync
 
 
-2. Booting via SPL
+2. Booting from eMMC via normal U-Boot
+--
+
+$ make mx6qsabresd_defconfig (If you want to build for mx6qsabresd)
+
+or
+
+$ make mx6dlsabresd_defconfig (If you want to build for mx6dlsabresd)
+
+$ make
+
+This will generate the image called u-boot.imx.
+
+- Flash the u-boot.imx binary into the eMMC:
+
+Set SW6 to download mode: 1100
+
+Plug a usb cable to USB-OTG and load the u-boot image using the imx_usb_loader
+tool (https://github.com/boundarydevices/imx_usb_loader):
+
+$ sudo ./imx_usb u-boot.imx
+
+In U-boot change the eMMC partition config:
+
+=> mmc partconf 2 1 0 0
+
+Mount the eMMC in the host PC:
+
+=> ums 0 mmc 2
+
+Flash the u-boot.imx binary
+
+$ sudo dd if=u-boot.imx of=/dev/sdX bs=1K seek=1 && sync
+
+Set SW6 to eMMC 8-bit boot: 11010110
+
+
+3. Booting via SPL
 --
 
 Other method for building U-Boot on mx6qsabresd and mx6qpsabresd is
@@ -48,7 +87,7 @@ $ sudo dd if=SPL of=/dev/sdb bs=1K seek=1 && sync
 $ sudo dd if=u-boot.img of=/dev/sdbbs=1K seek=69 && sync
 
 
-3. Booting via Falcon mode
+4. Booting via Falcon mode
 --
 
 $ make mx6sabresd_spl_defconfig
-- 
2.7.4

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


[U-Boot] [PATCH v3] mx6sabresd: README: Add eMMC boot configuration

2017-04-10 Thread Breno Lima
Explain how to flash the eMMC and how to boot from it.

Signed-off-by: Breno Lima 
---
Changes since v2:
-Fix number of methods for booting mx6sabresd boards.

 board/freescale/mx6sabresd/README | 55 +--
 1 file changed, 47 insertions(+), 8 deletions(-)

diff --git a/board/freescale/mx6sabresd/README 
b/board/freescale/mx6sabresd/README
index 5814b9d..bc0c0d0 100644
--- a/board/freescale/mx6sabresd/README
+++ b/board/freescale/mx6sabresd/README
@@ -1,17 +1,19 @@
 How to use and build U-Boot on mx6sabresd:
 --
 
-Currently there are three methods for booting mx6sabresd boards:
+Currently there are four methods for booting mx6sabresd boards:
 
-1. Booting via Normal U-Boot (u-boot.imx)
+1. Booting from SD card via normal U-Boot (u-boot.imx)
 
-2. Booting via SPL (SPL and u-boot.img)
+2. Booting from eMMC via normal U-Boot
 
-3. Booting via Falcon mode (SPL launches the kernel directly)
+3. Booting via SPL (SPL and u-boot.img)
 
+4. Booting via Falcon mode (SPL launches the kernel directly)
 
-1. Booting via Normal U-Boot
-
+
+1. Booting from SD card via normal U-Boot
+-
 
 $ make mx6qsabresd_defconfig (If you want to build for mx6qsabresd)
 
@@ -28,7 +30,44 @@ This will generate the image called u-boot.imx.
 $ sudo dd if=u-boot.imx of=/dev/sdb bs=1K seek=1 && sync
 
 
-2. Booting via SPL
+2. Booting from eMMC via normal U-Boot
+--
+
+$ make mx6qsabresd_defconfig (If you want to build for mx6qsabresd)
+
+or
+
+$ make mx6dlsabresd_defconfig (If you want to build for mx6dlsabresd)
+
+$ make
+
+This will generate the image called u-boot.imx.
+
+- Flash the u-boot.imx binary into the eMMC:
+
+Set SW6 to download mode: 1100
+
+Plug a usb cable to USB-OTG and load the u-boot image using the imx_usb_loader
+tool (https://github.com/boundarydevices/imx_usb_loader):
+
+$ sudo ./imx_usb u-boot.imx
+
+In U-boot change the eMMC partition config:
+
+=> mmc partconf 2 1 0 0
+
+Mount the eMMC in the host PC:
+
+=> ums 0 mmc 2
+
+Flash the u-boot.imx binary
+
+$ sudo dd if=u-boot.imx of=/dev/sdX bs=1K seek=1 && sync
+
+Set SW6 to eMMC 8-bit boot: 11010110
+
+
+3. Booting via SPL
 --
 
 Other method for building U-Boot on mx6qsabresd and mx6qpsabresd is
@@ -48,7 +87,7 @@ $ sudo dd if=SPL of=/dev/sdb bs=1K seek=1 && sync
 $ sudo dd if=u-boot.img of=/dev/sdbbs=1K seek=69 && sync
 
 
-3. Booting via Falcon mode
+4. Booting via Falcon mode
 --
 
 $ make mx6sabresd_spl_defconfig
-- 
2.7.4

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


[U-Boot] [PATCH] mx6sabresd: Fix IOMUXC_GPR6 and IOMUXC_GPR7 values

2017-08-02 Thread Breno Lima
The IPU AXI QoS for the i.MX6QP and i.MX6DP processors have to be set as
commented in the code:
/* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */

Set IOMUXC_GPR6 and IOMUXC_GPR7 to 0x77177717 instead of 0x007F007F.

Signed-off-by: Breno Lima 
---
 board/freescale/mx6sabresd/mx6sabresd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6sabresd/mx6sabresd.c 
b/board/freescale/mx6sabresd/mx6sabresd.c
index e416042..5329c3b 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -755,8 +755,8 @@ static void gpr_init(void)
writel(0xF0CF, &iomux->gpr[4]);
if (is_mx6dqp()) {
/* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */
-   writel(0x007F007F, &iomux->gpr[6]);
-   writel(0x007F007F, &iomux->gpr[7]);
+   writel(0x77177717, &iomux->gpr[6]);
+   writel(0x77177717, &iomux->gpr[7]);
} else {
/* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
writel(0x007F007F, &iomux->gpr[6]);
-- 
2.7.4

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


[U-Boot] [PATCH] mx6sabreauto: Fix IOMUXC_GPR6 and IOMUXC_GPR7 values

2017-08-02 Thread Breno Lima
The IPU AXI QoS for the i.MX6QP and i.MX6DP processors have to be set as
commented in the code:
/* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */

Set IOMUXC_GPR6 and IOMUXC_GPR7 to 0x77177717 instead of 0x007F007F.

Signed-off-by: Breno Lima 
---
 board/freescale/mx6sabreauto/mx6sabreauto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c 
b/board/freescale/mx6sabreauto/mx6sabreauto.c
index a5703a3..cad6004 100644
--- a/board/freescale/mx6sabreauto/mx6sabreauto.c
+++ b/board/freescale/mx6sabreauto/mx6sabreauto.c
@@ -806,8 +806,8 @@ static void gpr_init(void)
writel(0xF0CF, &iomux->gpr[4]);
if (is_mx6dqp()) {
/* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */
-   writel(0x007F007F, &iomux->gpr[6]);
-   writel(0x007F007F, &iomux->gpr[7]);
+   writel(0x77177717, &iomux->gpr[6]);
+   writel(0x77177717, &iomux->gpr[7]);
} else {
/* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
writel(0x007F007F, &iomux->gpr[6]);
-- 
2.7.4

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


[U-Boot] [PATCH] README.imx6: Fix Code Signing Tool command line

2017-06-26 Thread Breno Lima
The CST input option was replaced by -i on CST 2.3.2, so update the
Code Signing Tool command line.

Signed-off-by: Breno Lima 
---
 doc/README.imx6 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/README.imx6 b/doc/README.imx6
index 0e00968..9ca2150 100644
--- a/doc/README.imx6
+++ b/doc/README.imx6
@@ -177,10 +177,10 @@ Example Output of the u-boot-ivt.img (firmware_ivt) 
creation:
  Entry Point:  
  HAB Blocks:   0x177fffc0   0x   0x00054020
 
-The CST (Code Signing Tool) can be downloaded from NXP.
+The CST (Code Signing Tool) version 2.3.2 can be downloaded from NXP website.
 # Compile CSF and create signature
-./cst --o csf-u-boot.bin < command_sequence_uboot.csf
-./cst --o csf-SPL.bin < command_sequence_spl.csf
+./cst --o csf-u-boot.bin -i command_sequence_uboot.csf
+./cst --o csf-SPL.bin -i command_sequence_spl.csf
 # Append compiled CSF to Binary
 cat SPL csf-SPL.bin > SPL-signed
 cat u-boot-ivt.img csf-u-boot.bin > u-boot-signed.img
-- 
2.7.4

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


[U-Boot] [PATCH] imx: imx6: Move gpr_init() function to soc.c

2017-08-24 Thread Breno Lima
Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima 
---
 arch/arm/include/asm/mach-imx/sys_proto.h   |  2 ++
 arch/arm/mach-imx/mx6/soc.c | 17 +
 board/bachmann/ot1200/ot1200.c  | 11 ---
 board/barco/platinum/platinum.h | 11 ---
 board/congatec/cgtqmx6eval/cgtqmx6eval.c| 11 ---
 board/el/el6x/el6x.c| 11 ---
 board/engicam/common/spl.c  | 11 ---
 board/freescale/mx6sabreauto/mx6sabreauto.c | 17 -
 board/freescale/mx6sabresd/mx6sabresd.c | 17 -
 board/gateworks/gw_ventana/gw_ventana_spl.c | 11 ---
 board/kosagi/novena/novena_spl.c| 11 ---
 board/liebherr/mccmon6/spl.c| 11 ---
 board/phytec/pcm058/pcm058.c| 12 
 board/phytec/pfla02/pfla02.c| 11 ---
 board/solidrun/mx6cuboxi/mx6cuboxi.c| 11 ---
 board/toradex/apalis_imx6/apalis_imx6.c | 11 ---
 board/toradex/colibri_imx6/colibri_imx6.c   | 11 ---
 board/udoo/udoo_spl.c   | 11 ---
 board/wandboard/spl.c   | 11 ---
 19 files changed, 19 insertions(+), 200 deletions(-)

diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h 
b/arch/arm/include/asm/mach-imx/sys_proto.h
index 046df62..436ba9a 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -85,6 +85,8 @@ static inline u8 imx6_is_bmode_from_gpr9(void)
 }
 
 u32 imx6_src_get_boot_mode(void);
+void gpr_init(void);
+
 #endif /* CONFIG_MX6 */
 
 u32 get_nr_cpus(void);
diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
index 9ede1f5..f8bc05e 100644
--- a/arch/arm/mach-imx/mx6/soc.c
+++ b/arch/arm/mach-imx/mx6/soc.c
@@ -681,6 +681,23 @@ void imx_setup_hdmi(void)
 }
 #endif
 
+void gpr_init(void)
+{
+   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
+
+   /* enable AXI cache for VDOA/VPU/IPU */
+   writel(0xF0CF, &iomux->gpr[4]);
+   if (is_mx6dqp()) {
+   /* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */
+   writel(0x77177717, &iomux->gpr[6]);
+   writel(0x77177717, &iomux->gpr[7]);
+   } else {
+   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
+   writel(0x007F007F, &iomux->gpr[6]);
+   writel(0x007F007F, &iomux->gpr[7]);
+   }
+}
+
 #ifdef CONFIG_IMX_BOOTAUX
 int arch_auxiliary_core_up(u32 core_id, u32 boot_private_data)
 {
diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index df10d6a..9465cea 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -169,17 +169,6 @@ static void ccgr_init(void)
writel(0x03FF, &ccm->CCGR6);
 }
 
-static void gpr_init(void)
-{
-   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
-
-   /* enable AXI cache for VDOA/VPU/IPU */
-   writel(0xF0CF, &iomux->gpr[4]);
-   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
-   writel(0x007F007F, &iomux->gpr[6]);
-   writel(0x007F007F, &iomux->gpr[7]);
-}
-
 int board_early_init_f(void)
 {
ccgr_init();
diff --git a/board/barco/platinum/platinum.h b/board/barco/platinum/platinum.h
index d3ea8bd..3013ed9 100644
--- a/board/barco/platinum/platinum.h
+++ b/board/barco/platinum/platinum.h
@@ -75,15 +75,4 @@ static inline void ccgr_init(void)
writel(0x03FF, &ccm->CCGR6);
 }
 
-static inline void gpr_init(void)
-{
-   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
-
-   /* enable AXI cache for VDOA/VPU/IPU */
-   writel(0xF0CF, &iomux->gpr[4]);
-   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
-   writel(0x007F007F, &iomux->gpr[6]);
-   writel(0x007F007F, &iomux->gpr[7]);
-}
-
 #endif /* _PLATINUM_H_ */
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c 
b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 8cd0090..2ed66d3 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -955,17 +955,6 @@ static void ccgr_init(void)
writel(0x03FF, &ccm->CCGR6);
 }
 
-static void gpr_init(void)
-{
-   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
-
-   /* enable AXI cache for VDOA/VPU/IPU */
-   writel(0xF0CF, &iomux->gpr[4]);
-   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
-   writel(0x007F007F, &iomux->gpr[6]);
-   writel(0x007F007F, &iomux->gpr[7]);
-}
-
 /* Define a minimal structure so that the part number can be read via SPL */
 struct mfgdata {
unsigned char tsize;
diff --git a/board/el

[U-Boot] [PATCH 1/5] mx6slevk: imximage.cfg: Handle the CONFIG_SECURE_BOOT case

2017-11-27 Thread Breno Lima
From: Breno Lima 

Secure boot is not enabled in mx6slevk imximage.cfg, add support for it.

Signed-off-by: Breno Lima 
---
 board/freescale/mx6slevk/imximage.cfg | 9 +
 1 file changed, 9 insertions(+)

diff --git a/board/freescale/mx6slevk/imximage.cfg 
b/board/freescale/mx6slevk/imximage.cfg
index 024de9c..9722eb5 100644
--- a/board/freescale/mx6slevk/imximage.cfg
+++ b/board/freescale/mx6slevk/imximage.cfg
@@ -8,6 +8,8 @@
  *
  * The syntax is taken as close as possible with the kwbimage
  */
+#define __ASSEMBLY__
+#include 
 
 /* image version */
 
@@ -21,6 +23,13 @@ IMAGE_VERSION 2
 BOOT_FROM  sd
 
 /*
+ * Secure boot support
+ */
+#ifdef CONFIG_SECURE_BOOT
+CSF CONFIG_CSF_SIZE
+#endif
+
+/*
  * Device Configuration Data (DCD)
  *
  * Each entry must have the format:
-- 
2.7.4

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


[U-Boot] [PATCH 2/5] warp: imximage.cfg: Handle the CONFIG_SECURE_BOOT case

2017-11-27 Thread Breno Lima
From: Breno Lima 

Secure boot is not enabled in warp imximage.cfg, add support for it.

Signed-off-by: Breno Lima 
---
 board/warp/imximage.cfg | 9 +
 1 file changed, 9 insertions(+)

diff --git a/board/warp/imximage.cfg b/board/warp/imximage.cfg
index 771dbb3..8420968 100644
--- a/board/warp/imximage.cfg
+++ b/board/warp/imximage.cfg
@@ -8,6 +8,8 @@
  *
  * The syntax is taken as close as possible with the kwbimage
  */
+#define __ASSEMBLY__
+#include 
 
 /* image version */
 
@@ -21,6 +23,13 @@ IMAGE_VERSION 2
 BOOT_FROM  sd
 
 /*
+ * Secure boot support
+ */
+#ifdef CONFIG_SECURE_BOOT
+CSF CONFIG_CSF_SIZE
+#endif
+
+/*
  * Device Configuration Data (DCD)
  *
  * Each entry must have the format:
-- 
2.7.4

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


[U-Boot] [PATCH 3/5] mx6sl: Select MX6SL option via Kconfig

2017-11-27 Thread Breno Lima
From: Breno Lima 

Currently the MX6SL option is selected via CONFIG_SYS_EXTRA_OPTIONS,
but it is better to select it directly via Kconfig.

Signed-off-by: Breno Lima 
---
 arch/arm/mach-imx/mx6/Kconfig | 2 ++
 configs/mx6slevk_defconfig| 2 +-
 configs/mx6slevk_spinor_defconfig | 2 +-
 configs/mx6slevk_spl_defconfig| 2 +-
 configs/warp_defconfig| 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index bee7eab..4f8bb8f 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -244,6 +244,7 @@ config TARGET_MX6SABRESD
 
 config TARGET_MX6SLEVK
bool "mx6slevk"
+   select MX6SL
select SUPPORT_SPL
 
 config TARGET_MX6SLLEVK
@@ -395,6 +396,7 @@ config TARGET_WANDBOARD
 
 config TARGET_WARP
bool "WaRP"
+   select MX6SL
select BOARD_LATE_INIT
 
 config TARGET_XPRESS
diff --git a/configs/mx6slevk_defconfig b/configs/mx6slevk_defconfig
index 7b1ddac..aafddfa 100644
--- a/configs/mx6slevk_defconfig
+++ b/configs/mx6slevk_defconfig
@@ -3,7 +3,7 @@ CONFIG_ARCH_MX6=y
 CONFIG_TARGET_MX6SLEVK=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_DEFAULT_DEVICE_TREE="imx6sl-evk"
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6slevk/imximage.cfg,MX6SL"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6slevk/imximage.cfg"
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
diff --git a/configs/mx6slevk_spinor_defconfig 
b/configs/mx6slevk_spinor_defconfig
index 4b9c04e..0d3cb59 100644
--- a/configs/mx6slevk_spinor_defconfig
+++ b/configs/mx6slevk_spinor_defconfig
@@ -3,7 +3,7 @@ CONFIG_ARCH_MX6=y
 CONFIG_TARGET_MX6SLEVK=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_DEFAULT_DEVICE_TREE="imx6sl-evk"
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6slevk/imximage.cfg,MX6SL"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6slevk/imximage.cfg"
 CONFIG_SPI_BOOT=y
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_EARLY_INIT_F=y
diff --git a/configs/mx6slevk_spl_defconfig b/configs/mx6slevk_spl_defconfig
index 05a5c9e..0dbd308 100644
--- a/configs/mx6slevk_spl_defconfig
+++ b/configs/mx6slevk_spl_defconfig
@@ -10,7 +10,7 @@ CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
 # CONFIG_CMD_BMODE is not set
 CONFIG_DEFAULT_DEVICE_TREE="imx6sl-evk"
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg,MX6SL"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg"
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SPL=y
diff --git a/configs/warp_defconfig b/configs/warp_defconfig
index 5e7eef0..2ac1c6c 100644
--- a/configs/warp_defconfig
+++ b/configs/warp_defconfig
@@ -2,7 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_MX6=y
 CONFIG_TARGET_WARP=y
 # CONFIG_CMD_BMODE is not set
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/warp/imximage.cfg,MX6SL"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/warp/imximage.cfg"
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
-- 
2.7.4

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


[U-Boot] [PATCH 4/5] Kconfig: mx6ull: Deselect MX6UL from CONFIG_MX6ULL

2017-11-27 Thread Breno Lima
From: Breno Lima 

MX6UL contains features that MX6ULL doesn't support.
Deselect CONFIG_MX6UL and select SYS_L2CACHE_OFF and ROM_UNIFIED_SECTIONS.

The motivation for doing this change is that MX6UL supports CAAM and
MX6ULL does not.

Signed-off-by: Breno Lima 
---
 arch/arm/mach-imx/mx6/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index 4f8bb8f..279f088 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -66,8 +66,9 @@ config MX6UL_OPOS6UL
select SUPPORT_SPL
 
 config MX6ULL
+   select SYS_L2CACHE_OFF
+   select ROM_UNIFIED_SECTIONS
bool
-   select MX6UL
 
 config MX6_DDRCAL
bool "Include dynamic DDR calibration routines"
-- 
2.7.4

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


[U-Boot] [PATCH 5/5] imx: Kconfig: Add HAS_CAAM option

2017-11-27 Thread Breno Lima
From: Breno Lima 

Currently CONFIG_SECURE_BOOT is selecting FSL_CAAM for all i.MX devices,
this causes the following error when building mx6sl boards since
this SoC doesn't have the CAAM block:

In file included from drivers/crypto/fsl/jobdesc.c:12:0:
drivers/crypto/fsl/jobdesc.c: In function 'inline_cnstr_jobdesc_blob_dek':
include/fsl_sec.h:268:25: error: 'CAAM_ARB_BASE_ADDR' undeclared (first use
in this function)
 #define SEC_MEM_PAGE1  (CAAM_ARB_BASE_ADDR + 0x1000)
 ^
drivers/crypto/fsl/jobdesc.c:140:21: note: in expansion of macro 'SEC_MEM_PAGE1'
  memcpy((uint32_t *)SEC_MEM_PAGE1, (uint32_t *)plain_txt, in_sz);
 ^
include/fsl_sec.h:268:25: note: each undeclared identifier is reported only
once for each function it appears in
 #define SEC_MEM_PAGE1  (CAAM_ARB_BASE_ADDR + 0x1000)
 ^
drivers/crypto/fsl/jobdesc.c:140:21: note: in expansion of macro 'SEC_MEM_PAGE1'
  memcpy((uint32_t *)SEC_MEM_PAGE1, (uint32_t *)plain_txt, in_sz);
 ^
scripts/Makefile.build:280: recipe for target 'drivers/crypto/fsl/jobdesc.o'
failed
make[3]: *** [drivers/crypto/fsl/jobdesc.o] Error 1
scripts/Makefile.build:425: recipe for target 'drivers/crypto/fsl' failed
make[2]: *** [drivers/crypto/fsl] Error 2
scripts/Makefile.build:425: recipe for target 'drivers/crypto' failed
make[1]: *** [drivers/crypto] Error 2

Add HAS_CAAM configuration to avoid this error.

Signed-off-by: Breno Lima 
---
 arch/arm/mach-imx/Kconfig | 5 -
 arch/arm/mach-imx/mx6/Kconfig | 7 +++
 arch/arm/mach-imx/mx7/Kconfig | 1 +
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index cd8b8d2..a6f67c8 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -1,3 +1,6 @@
+config HAS_CAAM
+   bool
+
 config IMX_CONFIG
string
 
@@ -28,7 +31,7 @@ config USE_IMXIMG_PLUGIN
 config SECURE_BOOT
bool "Support i.MX HAB features"
depends on ARCH_MX7 || ARCH_MX6 || ARCH_MX5
-   select FSL_CAAM
+   select FSL_CAAM if HAS_CAAM
imply CMD_DEKBLOB
help
  This option enables the support for secure boot (HAB).
diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
index 279f088..8f98d9f 100644
--- a/arch/arm/mach-imx/mx6/Kconfig
+++ b/arch/arm/mach-imx/mx6/Kconfig
@@ -14,28 +14,34 @@ config MX6
imply CMD_FUSE
 
 config MX6D
+   select HAS_CAAM
select MX6_SMP
bool
 
 config MX6DL
+   select HAS_CAAM
select MX6_SMP
bool
 
 config MX6Q
+   select HAS_CAAM
select MX6_SMP
bool
 
 config MX6QDL
+   select HAS_CAAM
select MX6_SMP
bool
 
 config MX6S
+   select HAS_CAAM
bool
 
 config MX6SL
bool
 
 config MX6SX
+   select HAS_CAAM
select ROM_UNIFIED_SECTIONS
bool
 
@@ -44,6 +50,7 @@ config MX6SLL
bool
 
 config MX6UL
+   select HAS_CAAM
select SYS_L2CACHE_OFF
select ROM_UNIFIED_SECTIONS
bool
diff --git a/arch/arm/mach-imx/mx7/Kconfig b/arch/arm/mach-imx/mx7/Kconfig
index 365501d..4f8b4e1 100644
--- a/arch/arm/mach-imx/mx7/Kconfig
+++ b/arch/arm/mach-imx/mx7/Kconfig
@@ -10,6 +10,7 @@ config MX7
default y
 
 config MX7D
+   select HAS_CAAM
select ROM_UNIFIED_SECTIONS
imply CMD_FUSE
bool
-- 
2.7.4

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


[U-Boot] [PATCH] Revert "warp: Use imx_ddr_size() for calculating the DDR size"

2016-08-12 Thread Breno Lima
Commit a13d3757f7df25d0 "warp: Use imx_ddr_size() for calculating the DDR size"
causes breakage on warp board.

U-boot gets stuck in the DRAM line. It's necessary to revert this patch until
a better solution is found, otherwise it's not possible to use the board.

This reverts commit a13d3757f7df25d0f017e85551b899d598ad1bdb.

Signed-off-by: Breno Lima 
---
 board/warp/warp.c  | 2 +-
 include/configs/warp.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/board/warp/warp.c b/board/warp/warp.c
index 0bc0a6a..49dfdb6 100644
--- a/board/warp/warp.c
+++ b/board/warp/warp.c
@@ -46,7 +46,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-   gd->ram_size = imx_ddr_size();
+   gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
 
return 0;
 }
diff --git a/include/configs/warp.h b/include/configs/warp.h
index 12c7c38..4a8e270 100644
--- a/include/configs/warp.h
+++ b/include/configs/warp.h
@@ -43,6 +43,7 @@
 /* Physical Memory Map */
 #define CONFIG_NR_DRAM_BANKS   1
 #define PHYS_SDRAM MMDC0_ARB_BASE_ADDR
+#define PHYS_SDRAM_SIZESZ_512M
 
 #define CONFIG_SYS_SDRAM_BASE  PHYS_SDRAM
 #define CONFIG_SYS_INIT_RAM_ADDR   IRAM_BASE_ADDR
-- 
2.7.4

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


[U-Boot] [PATCH] warp7: Increase CONFIG_BOOTDELAY

2016-07-12 Thread Breno Lima
Increase the boot delay to 3 seconds, because it's more convenient
to load u-boot from imx_usb_loader tool.

Signed-off-by: Breno Lima 
---
 configs/warp7_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index 102b5b1..defa15a 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -4,7 +4,7 @@ CONFIG_TARGET_WARP7=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/warp7/imximage.cfg"
-CONFIG_BOOTDELAY=1
+CONFIG_BOOTDELAY=3
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_BOOTD is not set
 CONFIG_CMD_BOOTZ=y
-- 
2.7.4

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


[U-Boot] [PATCH] warp7: Remove CONFIG_BOOTDELAY variable

2016-07-13 Thread Breno Lima
It's not necessary anymore to declare the CONFIG_BOOTDELAY variable,
it's already set by default as 2 seconds.

Signed-off-by: Breno Lima 
---
 configs/warp7_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index defa15a..ad4fbbf 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -4,7 +4,6 @@ CONFIG_TARGET_WARP7=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/warp7/imximage.cfg"
-CONFIG_BOOTDELAY=3
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_BOOTD is not set
 CONFIG_CMD_BOOTZ=y
-- 
2.7.4

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


[U-Boot] [PATCH v2] warp7: Remove CONFIG_BOOTDELAY variable

2016-07-13 Thread Breno Lima
It's not necessary anymore to declare the CONFIG_BOOTDELAY variable,
it's already set by default as 2 seconds.

Signed-off-by: Breno Lima 
---
Changes since v1:
-Remove CONFIG_BOOTDELAY as suggested by Otavio Salvador and Peter Robinson

 configs/warp7_defconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index 102b5b1..ad4fbbf 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -4,7 +4,6 @@ CONFIG_TARGET_WARP7=y
 CONFIG_IMX_RDC=y
 CONFIG_IMX_BOOTAUX=y
 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/warp7/imximage.cfg"
-CONFIG_BOOTDELAY=1
 CONFIG_HUSH_PARSER=y
 # CONFIG_CMD_BOOTD is not set
 CONFIG_CMD_BOOTZ=y
-- 
2.7.4

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


[U-Boot] [PATCH] Revert "imx_common: Return MMCSD_MODE_FS in spl_boot_mode() also for EXTFS"

2016-07-20 Thread Breno Lima
Commit c1ebf54868359005 ("imx_common: Return MMCSD_MODE_FS in spl_boot_mode()
also for EXTFS") causes SPL breakage on wandboard:

ERROR: v7_dcache_inval_range - start address is not aligned - 0x1820006c
ERROR: v7_dcache_inval_range - stop address is not aligned - 0x1820086c
ERROR: v7_dcache_inval_range - start address is not aligned - 0x1820006c
ERROR: v7_dcache_inval_range - stop address is not aligned - 0x1820086c
** First descriptor is NOT a primary desc on 0:1 **
spl: no partition table found
SPL: failed to boot from all boot devices
### ERROR ### Please RESET the board ###

This error is seen when SPL and u-boot.img are stored in the raw SD card
partition.

This reverts commit c1ebf54868359005c32944c1473668d5fcaca158.

Signed-off-by: Breno Lima 
---
 arch/arm/imx-common/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
index 0c1e401..bdcda7d 100644
--- a/arch/arm/imx-common/spl.c
+++ b/arch/arm/imx-common/spl.c
@@ -76,7 +76,7 @@ u32 spl_boot_mode(const u32 boot_device)
/* for MMC return either RAW or FAT mode */
case BOOT_DEVICE_MMC1:
case BOOT_DEVICE_MMC2:
-#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
+#if defined(CONFIG_SPL_FAT_SUPPORT)
return MMCSD_MODE_FS;
 #elif defined(CONFIG_SUPPORT_EMMC_BOOT)
return MMCSD_MODE_EMMCBOOT;
-- 
2.7.4

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


[U-Boot] [PATCH] serial_mxc: Remove unconditional DCE setting

2016-07-20 Thread Breno Lima
Commit 83fd908f28c ("dm: imx: serial: Support DTE mode when using driver
model") breaks the serial output for the imx boards that do not use
the serial driver model.

The reason for the breakage is that it's setting UFCR_DCEDTE
unconditionally for the non-dm case.

So keep the original behavior by removing UFCR_DCEDTE setting in the
non-dm case.

Tested on mx7sabresd and mx6wandboard.

Signed-off-by: Breno Lima 
---
 drivers/serial/serial_mxc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 1960bbc..8545714 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -151,7 +151,6 @@ static void mxc_serial_setbrg(void)
__REG(UART_PHYS + UFCR) = (RFDIV << UFCR_RFDIV_SHF)
| (TXTL << UFCR_TXTL_SHF)
| (RXTL << UFCR_RXTL_SHF);
-   __REG(UART_PHYS + UFCR) |= UFCR_DCEDTE;
__REG(UART_PHYS + UBIR) = 0xf;
__REG(UART_PHYS + UBMR) = clk / (2 * gd->baudrate);
 
-- 
2.7.4

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


[U-Boot] [PATCH 1/3] wandboard: Replace is_cpu_type() for macro

2016-07-22 Thread Breno Lima
It's not necessary to use the is_cpu_type function, there is a macro in
sys_proto.h already implemented.

Signed-off-by: Breno Lima 
---
 board/wandboard/wandboard.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index 8340dd1..d7c1142 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -390,7 +390,7 @@ int board_late_init(void)
 #endif
 
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-   if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
+   if (is_mx6dq())
setenv("board_rev", "MX6Q");
else
setenv("board_rev", "MX6DL");
@@ -409,7 +409,7 @@ int board_init(void)
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c2_pad_info);
-   if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
+   if (is_mx6dq())
setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c2_pad_info);
else
setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c2_pad_info);
-- 
2.7.4

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


[U-Boot] [PATCH 3/3] cgtqmx6eval: Replace is_mx6q() for macro

2016-07-22 Thread Breno Lima
It's not necessary to implement the is_mx6q function, there is a macro in
sys_proto.h already implemented.

Signed-off-by: Breno Lima 
---
 board/congatec/cgtqmx6eval/cgtqmx6eval.c | 14 +++---
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c 
b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 225de7c..3fbd3d2 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -678,14 +678,6 @@ int overwrite_console(void)
return 1;
 }
 
-static bool is_mx6q(void)
-{
-   if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
-   return true;
-   else
-   return false;
-}
-
 int board_early_init_f(void)
 {
setup_iomux_uart();
@@ -703,7 +695,7 @@ int board_init(void)
gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
 
 
-   if (is_mx6q())
+   if (is_mx6dq())
setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6q_i2c_pad_info1);
else
setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &mx6dl_i2c_pad_info1);
@@ -760,7 +752,7 @@ int misc_init_r(void)
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
-   if (is_mx6q())
+   if (is_mx6dq())
setenv("board_rev", "MX6Q");
else
setenv("board_rev", "MX6DL");
@@ -1053,7 +1045,7 @@ static void spl_dram_init(int width)
return;
}
 
-   if (is_mx6q()) {
+   if (is_mx6dq()) {
mx6dq_dram_iocfg(width, &mx6q_ddr_ioregs, &mx6q_grp_ioregs);
mx6_dram_cfg(&sysinfo, &mx6q_mmcd_calib, &mem_ddr_2g);
} else if (is_cpu_type(MXC_CPU_MX6SOLO)) {
-- 
2.7.4

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


[U-Boot] [PATCH 2/3] mx6cuboxi: Replace is_mx6q() for macro

2016-07-22 Thread Breno Lima
It's not necessary to implement the is_mx6q function, there is a macro in
sys_proto.h already implemented.

Signed-off-by: Breno Lima 
---
 board/solidrun/mx6cuboxi/mx6cuboxi.c | 12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c 
b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index bcc9729..cafa348 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -367,14 +367,6 @@ int checkboard(void)
return 0;
 }
 
-static bool is_mx6q(void)
-{
-   if (is_cpu_type(MXC_CPU_MX6Q) || is_cpu_type(MXC_CPU_MX6D))
-   return true;
-   else
-   return false;
-}
-
 int board_late_init(void)
 {
 #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
@@ -383,7 +375,7 @@ int board_late_init(void)
else
setenv("board_name", "CUBOXI");
 
-   if (is_mx6q())
+   if (is_mx6dq())
setenv("board_rev", "MX6Q");
else
setenv("board_rev", "MX6DL");
@@ -615,7 +607,7 @@ static void spl_dram_init(int width)
.ddr_type = DDR_TYPE_DDR3,
};
 
-   if (is_cpu_type(MXC_CPU_MX6D) || is_cpu_type(MXC_CPU_MX6Q))
+   if (is_mx6dq())
mx6dq_dram_iocfg(width, &mx6q_ddr_ioregs, &mx6q_grp_ioregs);
else
mx6sdl_dram_iocfg(width, &mx6dl_ddr_ioregs, &mx6sdl_grp_ioregs);
-- 
2.7.4

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


[U-Boot] [PATCH] warp7: Move some USB configuration options to defconfig

2016-07-22 Thread Breno Lima
Currently it's recommended to move some configuration options to the
defconfig file.

Move some USB related options to the defconfig file.

Signed-off-by: Breno Lima 
---
 configs/warp7_defconfig | 6 ++
 include/configs/warp7.h | 9 -
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/configs/warp7_defconfig b/configs/warp7_defconfig
index 5a68998..617e0a0 100644
--- a/configs/warp7_defconfig
+++ b/configs/warp7_defconfig
@@ -24,6 +24,12 @@ CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_USB=y
+CONFIG_USB_GADGET=y
+CONFIG_CI_UDC=y
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_G_DNL_MANUFACTURER="FSL"
+CONFIG_G_DNL_VENDOR_NUM=0x0525
+CONFIG_G_DNL_PRODUCT_NUM=0xa4a5
 CONFIG_USB_EHCI_HCD=y
 CONFIG_MXC_USB_OTG_HACTIVE=y
 CONFIG_OF_LIBFDT=y
diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index 4c6e23c..e59b16c 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -125,18 +125,9 @@
 
 #define CONFIG_IMX_THERMAL
 
-#define CONFIG_CI_UDC
 #define CONFIG_USBD_HS
-#define CONFIG_USB_GADGET_DUALSPEED
 
-#define CONFIG_USB_GADGET
 #define CONFIG_USB_FUNCTION_MASS_STORAGE
-#define CONFIG_USB_GADGET_DOWNLOAD
-#define CONFIG_USB_GADGET_VBUS_DRAW2
-
-#define CONFIG_G_DNL_VENDOR_NUM0x0525
-#define CONFIG_G_DNL_PRODUCT_NUM   0xa4a5
-#define CONFIG_G_DNL_MANUFACTURER  "FSL"
 
 /* USB Device Firmware Update support */
 #define CONFIG_USB_FUNCTION_DFU
-- 
2.7.4

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


[U-Boot] [PATCH v2] warp7: Modify fdt_file environment variable

2016-08-08 Thread Breno Lima
Use imx7s-warp.dts as fdt_file because this is the name that upstream
kernel will deploy.

Signed-off-by: Breno Lima 
---
Changes since v1:
- Remove 1/2 from the Subject

 include/configs/warp7.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index e59b16c..91009a8 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -39,7 +39,7 @@
"console=ttymxc0\0" \
"fdt_high=0x\0" \
"initrd_high=0x\0" \
-   "fdt_file=imx7d-warp.dtb\0" \
+   "fdt_file=imx7s-warp.dtb\0" \
"fdt_addr=0x8300\0" \
"boot_fdt=try\0" \
"ip_dyn=yes\0" \
-- 
2.7.4

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


[U-Boot] [PATCH 1/2] warp7: Modify fdt_file environment variable

2016-08-08 Thread Breno Lima
Use imx7s-warp.dts as fdt_file because this is the name that upstream
kernel will deploy.

Signed-off-by: Breno Lima 
---
 include/configs/warp7.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/warp7.h b/include/configs/warp7.h
index e59b16c..91009a8 100644
--- a/include/configs/warp7.h
+++ b/include/configs/warp7.h
@@ -39,7 +39,7 @@
"console=ttymxc0\0" \
"fdt_high=0x\0" \
"initrd_high=0x\0" \
-   "fdt_file=imx7d-warp.dtb\0" \
+   "fdt_file=imx7s-warp.dtb\0" \
"fdt_addr=0x8300\0" \
"boot_fdt=try\0" \
"ip_dyn=yes\0" \
-- 
2.7.4

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


[U-Boot] [PATCH 3/3] udoo_neo: Remove ramdiskaddr environment variable

2017-01-10 Thread Breno Lima
Remove unused ramdiskaddr environment variable.

Suggested-by: Andreas Färber 
Signed-off-by: Breno Lima 
---
 include/configs/udoo_neo.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h
index a7d1eac..8d67ff3 100644
--- a/include/configs/udoo_neo.h
+++ b/include/configs/udoo_neo.h
@@ -54,7 +54,6 @@
"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
"pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
"ramdisk_addr_r=0x8300\0" \
-   "ramdiskaddr=0x8300\0" \
"scriptaddr=" __stringify(CONFIG_LOADADDR) "\0" \
BOOTENV
 
-- 
2.7.4

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


[U-Boot] [PATCH 2/3] udoo_neo: Remove trailing semicolon and space

2017-01-10 Thread Breno Lima
Remove the trailing semicolon and space.
It's not necessary to have it on the last condition.

Suggested-by: Andreas Färber 
Signed-off-by: Breno Lima 
---
 include/configs/udoo_neo.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h
index f1e1c93..a7d1eac 100644
--- a/include/configs/udoo_neo.h
+++ b/include/configs/udoo_neo.h
@@ -50,7 +50,7 @@
"if test $board_name = EXTENDED; then " \
"setenv fdtfile imx6sx-udoo-neo-extended.dtb; fi; " \
"if test $fdtfile = UNDEFINED; then " \
-   "echo WARNING: Could not determine dtb to use; fi; \0" \
+   "echo WARNING: Could not determine dtb to use; fi\0" \
"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
"pxefile_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
"ramdisk_addr_r=0x8300\0" \
-- 
2.7.4

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


[U-Boot] [PATCH 1/3] udoo_neo: Add fdt_addr_r environment variable

2017-01-10 Thread Breno Lima
According to doc/README.distro:
"fdt_addr_r:
Mandatory. The location in RAM where the DTB will be loaded or copied to when
processing the fdtdir/devicetreedir or fdt/devicetree options in
extlinux.conf."

So add the fdt_addr_r environment variable.

Suggested-by: Andreas Färber 
Signed-off-by: Breno Lima 
---
 include/configs/udoo_neo.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h
index 915d0f0..f1e1c93 100644
--- a/include/configs/udoo_neo.h
+++ b/include/configs/udoo_neo.h
@@ -36,6 +36,7 @@
"initrd_high=0x\0" \
"fdtfile=undefined\0" \
"fdt_addr=0x8300\0" \
+   "fdt_addr_r=0x8300\0" \
"ip_dyn=yes\0" \
"mmcdev=0\0" \
"mmcrootfstype=ext4\0" \
-- 
2.7.4

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


[U-Boot] [PATCH] mx6sx: Add initial support for UDOO Neo Board

2016-11-25 Thread Breno Lima
UDOO Neo Board is a development board from Seco that has three models:
 - UDOO Neo Basic
 - UDOO Neo Basic Kick Starter
 - UDOO Neo Extended
 - UDOO Neo Full

All versions are based on the i.MX6 SoloX processor.

For more details about the UDOO Neo board, please refer to:
http://www.udoo.org/udoo-neo/

This work is based on a previous commit of Francesco Montefoschi
:
https://github.com/fmntf/u-boot/commit/877b71184a5105e708024f232d36aed574961844

Only tested on the UDOO Neo Full board.

Signed-off-by: Breno Lima 
---
 arch/arm/cpu/armv7/mx6/Kconfig |   5 +
 board/udoo/neo/Kconfig |  12 ++
 board/udoo/neo/MAINTAINERS |   7 +
 board/udoo/neo/Makefile|   6 +
 board/udoo/neo/neo.c   | 441 +
 configs/udoo_neo_defconfig |  30 +++
 include/configs/udoo_neo.h |  94 +
 7 files changed, 595 insertions(+)
 create mode 100644 board/udoo/neo/Kconfig
 create mode 100644 board/udoo/neo/MAINTAINERS
 create mode 100644 board/udoo/neo/Makefile
 create mode 100644 board/udoo/neo/neo.c
 create mode 100644 configs/udoo_neo_defconfig
 create mode 100644 include/configs/udoo_neo.h

diff --git a/arch/arm/cpu/armv7/mx6/Kconfig b/arch/arm/cpu/armv7/mx6/Kconfig
index 762a581..ea8b693 100644
--- a/arch/arm/cpu/armv7/mx6/Kconfig
+++ b/arch/arm/cpu/armv7/mx6/Kconfig
@@ -192,6 +192,10 @@ config TARGET_UDOO
bool "udoo"
select SUPPORT_SPL
 
+config TARGET_UDOO_NEO
+   bool "UDOO Neo"
+   select SUPPORT_SPL
+
 config TARGET_WANDBOARD
bool "wandboard"
select SUPPORT_SPL
@@ -253,6 +257,7 @@ source "board/technexion/pico-imx6ul/Kconfig"
 source "board/tbs/tbs2910/Kconfig"
 source "board/tqc/tqma6/Kconfig"
 source "board/udoo/Kconfig"
+source "board/udoo/neo/Kconfig"
 source "board/wandboard/Kconfig"
 source "board/warp/Kconfig"
 
diff --git a/board/udoo/neo/Kconfig b/board/udoo/neo/Kconfig
new file mode 100644
index 000..8f474df
--- /dev/null
+++ b/board/udoo/neo/Kconfig
@@ -0,0 +1,12 @@
+if TARGET_UDOO_NEO
+
+config SYS_VENDOR
+   default "udoo"
+
+config SYS_BOARD
+   default "neo"
+
+config SYS_CONFIG_NAME
+   default "udoo_neo"
+
+endif
diff --git a/board/udoo/neo/MAINTAINERS b/board/udoo/neo/MAINTAINERS
new file mode 100644
index 000..743fe33
--- /dev/null
+++ b/board/udoo/neo/MAINTAINERS
@@ -0,0 +1,7 @@
+UDOO NEO BOARD
+M: Breno Lima 
+M: Francesco Montefoschi 
+S: Maintained
+F: board/udoo/neo/
+F: include/configs/udoo_neo.h
+F: configs/udoo_neo_defconfig
diff --git a/board/udoo/neo/Makefile b/board/udoo/neo/Makefile
new file mode 100644
index 000..150cbc1
--- /dev/null
+++ b/board/udoo/neo/Makefile
@@ -0,0 +1,6 @@
+# (C) Copyright 2015 UDOO Team
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  := neo.o
diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
new file mode 100644
index 000..7f17469
--- /dev/null
+++ b/board/udoo/neo/neo.c
@@ -0,0 +1,441 @@
+/*
+ * Copyright (C) 2014-2015 Freescale Semiconductor, Inc.
+ * Copyright (C) Jasbir Matharu
+ * Copyright (C) UDOO Team
+ *
+ * Author: Breno Lima 
+ * Author: Francesco Montefoschi 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+DECLARE_GLOBAL_DATA_PTR;
+
+enum {
+   UDOO_NEO_TYPE_BASIC,
+   UDOO_NEO_TYPE_BASIC_KS,
+   UDOO_NEO_TYPE_FULL,
+   UDOO_NEO_TYPE_EXTENDED,
+};
+
+#define UART_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |\
+   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |   \
+   PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |\
+   PAD_CTL_PUS_22K_UP  | PAD_CTL_SPEED_LOW |   \
+   PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define WDOG_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_SPEED_MED | \
+   PAD_CTL_DSE_40ohm)
+
+#define BOARD_DETECT_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
+   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |   \
+   PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST)
+#define BOARD_DETECT_PAD_CFG (MUX_PAD_CTRL(BOARD_DETECT_PAD_CTRL) |\
+   MUX_MODE_SION)
+
+int dram_init(void)
+{
+   gd->ram_size = imx_ddr_size();
+   return 0;
+}
+
+static iomux_v3_cfg_t const uart1_pads[] = {
+   MX6_PAD_GPIO1_IO04__UART1_TX | MUX_PAD_CTRL(UART_PAD_CTRL),
+   MX6_PAD_GPIO1_IO05__UART1_RX | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+
+static iomux_v3_cfg_t const usdhc2_pads[] = {
+   MX6_PAD_SD2_CLK__USDHC2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX6_PAD_SD2_CMD__USDHC2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX6_PAD_SD2_DATA0__USDHC2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   

[U-Boot] [PATCH] Revert "ARM: mx6: add MMC2 boot device detection support in SPL"

2016-11-30 Thread Breno Lima
Commit 54e4fcfa3c749a78 ("ARM: mx6: add MMC2 boot device detection
support in SPL") prevents UDOO neo board to boot:

Trying to boot from MMC2
port 1
MMC Device 1 not found
spl: could not find mmc device. error: -19
SPL: failed to boot from all boot devices

This reverts commit 54e4fcfa3c749a789192e83740a53234182f4ca3.

Signed-off-by: Breno Lima 
---
 arch/arm/imx-common/spl.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
index 325ba26..bdcda7d 100644
--- a/arch/arm/imx-common/spl.c
+++ b/arch/arm/imx-common/spl.c
@@ -14,9 +14,6 @@
 #include 
 
 #if defined(CONFIG_MX6)
-#define MX6_MMC_PORT_MASK  GENMASK(12, 11)
-#define MX6_MMC_PORT_2 BIT(11)
-
 /* determine boot device from SRC_SBMR1 (BOOT_CFG[4:1]) or SRC_GPR9 register */
 u32 spl_boot_device(void)
 {
@@ -58,11 +55,10 @@ u32 spl_boot_device(void)
/* SD/eSD: 8.5.3, Table 8-15  */
case 0x4:
case 0x5:
+   return BOOT_DEVICE_MMC1;
/* MMC/eMMC: 8.5.3 */
case 0x6:
case 0x7:
-   if ((reg & MX6_MMC_PORT_MASK) == MX6_MMC_PORT_2)
-   return BOOT_DEVICE_MMC2;
return BOOT_DEVICE_MMC1;
/* NAND Flash: 8.5.2 */
case 0x8 ... 0xf:
-- 
2.7.4

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


[U-Boot] [PATCH] imx_common: spl: Fix SPL boot from SD card

2016-11-30 Thread Breno Lima
Since commit 54e4fcfa3c749a78 ("ARM: mx6: add MMC2 boot device detection
support in SPL") we can no longer boot from SD card on a mx6sx Udoo neo board:

U-Boot SPL 2016.11-32108-g9cd37b0 (Nov 30 2016 - 11:05:54)  
Trying to boot from MMC2
MMC Device 1 not found  
spl: could not find mmc device. error: -19  
SPL: failed to boot from all boot devices   
### ERROR ### Please RESET the board ###

Prior to this commit we had the following logic:

/* SD/eSD: 8.5.3, Table 8-15  */
case 0x4:
case 0x5:
return BOOT_DEVICE_MMC1;
/* MMC/eMMC: 8.5.3 */
case 0x6:
case 0x7:
return BOOT_DEVICE_MMC1;

and in the case of MX6SX Udoo board we entered the case 0x5 (SD card boot)
and returned BOOT_DEVICE_MMC1 as expected.

Now this does not happen anymore and BOOT_DEVICE_MMC2 is returned, which
breaks the boot.

In order to fix this problem keep the original behavior for the SD card case by
returning BOOT_DEVICE_MMC1.

Tested on mx6cuboxi and mx6sx UDOO neo boards.

Signed-off-by: Breno Lima 
---
 arch/arm/imx-common/spl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/imx-common/spl.c b/arch/arm/imx-common/spl.c
index 325ba26..cbcd936 100644
--- a/arch/arm/imx-common/spl.c
+++ b/arch/arm/imx-common/spl.c
@@ -58,6 +58,7 @@ u32 spl_boot_device(void)
/* SD/eSD: 8.5.3, Table 8-15  */
case 0x4:
case 0x5:
+return BOOT_DEVICE_MMC1;
/* MMC/eMMC: 8.5.3 */
case 0x6:
case 0x7:
-- 
2.7.4

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


[U-Boot] [PATCH 2/6] udoo_neo: Move MX6SX configuration to Kconfig

2016-12-01 Thread Breno Lima
It's not necessary to define the processor in the defconfig file.

The preferred method to select the SoC is via Kconfig file.

Signed-off-by: Breno Lima 
---
 arch/arm/cpu/armv7/mx6/Kconfig | 1 +
 configs/udoo_neo_defconfig | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/mx6/Kconfig b/arch/arm/cpu/armv7/mx6/Kconfig
index a81d944..091b522 100644
--- a/arch/arm/cpu/armv7/mx6/Kconfig
+++ b/arch/arm/cpu/armv7/mx6/Kconfig
@@ -203,6 +203,7 @@ config TARGET_UDOO
 config TARGET_UDOO_NEO
bool "UDOO Neo"
select SUPPORT_SPL
+   select MX6SX
 
 config TARGET_WANDBOARD
bool "wandboard"
diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
index 3304afb..f88820c 100644
--- a/configs/udoo_neo_defconfig
+++ b/configs/udoo_neo_defconfig
@@ -11,7 +11,7 @@ CONFIG_SPL_SERIAL_SUPPORT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_WATCHDOG_SUPPORT=y
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg,MX6SX"
+CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/imx-common/spl_sd.cfg"
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_BOOTZ=y
 # CONFIG_CMD_IMLS is not set
-- 
2.7.4

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


[U-Boot] [PATCH 5/6] udoo_neo: Remove console option

2016-12-01 Thread Breno Lima
It's not necessary to define the console option as we use the distro config.

Signed-off-by: Breno Lima 
---
 include/configs/udoo_neo.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h
index 164980f..1b7a03f 100644
--- a/include/configs/udoo_neo.h
+++ b/include/configs/udoo_neo.h
@@ -32,7 +32,6 @@
 /* Linux only */
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define CONFIG_EXTRA_ENV_SETTINGS \
-   "console=ttymxc0,115200\0" \
"fdt_high=0x\0" \
"initrd_high=0x\0" \
"fdt_file=undefined\0" \
-- 
2.7.4

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


[U-Boot] [PATCH 6/6] udoo_neo: Add thermal support

2016-12-01 Thread Breno Lima
Add thermal support on the Kconfig file.

Signed-off-by: Breno Lima 
---
 arch/arm/cpu/armv7/mx6/Kconfig | 2 ++
 include/configs/udoo_neo.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx6/Kconfig b/arch/arm/cpu/armv7/mx6/Kconfig
index 091b522..aa4a476 100644
--- a/arch/arm/cpu/armv7/mx6/Kconfig
+++ b/arch/arm/cpu/armv7/mx6/Kconfig
@@ -204,6 +204,8 @@ config TARGET_UDOO_NEO
bool "UDOO Neo"
select SUPPORT_SPL
select MX6SX
+   select DM
+   select DM_THERMAL
 
 config TARGET_WANDBOARD
bool "wandboard"
diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h
index 1b7a03f..0357631 100644
--- a/include/configs/udoo_neo.h
+++ b/include/configs/udoo_neo.h
@@ -88,4 +88,6 @@
 #define CONFIG_ENV_SIZESZ_8K
 #define CONFIG_ENV_IS_IN_MMC
 
+#define CONFIG_IMX_THERMAL
+
 #endif /* __CONFIG_H */
-- 
2.7.4

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


[U-Boot] [PATCH 3/6] udoo_neo: Staticize board_string()

2016-12-01 Thread Breno Lima
Change board_string() function to static because it's being used locally.

Signed-off-by: Breno Lima 
---
 board/udoo/neo/neo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index efe8605..cfeed6f 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -176,7 +176,7 @@ int board_mmc_init(bd_t *bis)
return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
 }
 
-char *board_string(void)
+static char *board_string(void)
 {
switch (get_board_value()) {
case UDOO_NEO_TYPE_BASIC:
-- 
2.7.4

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


[U-Boot] [PATCH 1/6] udoo_neo: Remove USDHC3 support

2016-12-01 Thread Breno Lima
It's not necessary to support USDHC3 in U-Boot as it's being used for
the WLAN.

Signed-off-by: Breno Lima 
---
 board/udoo/neo/neo.c   | 94 +++---
 include/configs/udoo_neo.h |  1 -
 2 files changed, 6 insertions(+), 89 deletions(-)

diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index 7f17469..efe8605 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -81,16 +81,6 @@ static iomux_v3_cfg_t const board_recognition_pads[] = {
MX6_PAD_NAND_ALE__GPIO4_IO_0 | BOARD_DETECT_PAD_CFG,
 };
 
-static iomux_v3_cfg_t const usdhc3_pads[] = {
-/* Configured for WLAN */
-   MX6_PAD_SD3_CLK__USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD3_CMD__USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD3_DATA0__USDHC3_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD3_DATA1__USDHC3_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD3_DATA2__USDHC3_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-   MX6_PAD_SD3_DATA3__USDHC3_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
-};
-
 static iomux_v3_cfg_t const wdog_b_pad = {
MX6_PAD_GPIO1_IO13__GPIO1_IO_13 | MUX_PAD_CTRL(WDOG_PAD_CTRL),
 };
@@ -171,91 +161,19 @@ static struct fsl_esdhc_cfg usdhc_cfg[2] = {
 
 int board_mmc_getcd(struct mmc *mmc)
 {
-   struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv;
-   int ret = 0;
-
-   switch (cfg->esdhc_base) {
-   case USDHC2_BASE_ADDR:
-   ret = !gpio_get_value(USDHC2_CD_GPIO);
-   break;
-   }
-
-   return ret;
+   return !gpio_get_value(USDHC2_CD_GPIO);
 }
 
 int board_mmc_init(bd_t *bis)
 {
-#ifndef CONFIG_SPL_BUILD
-   int i, ret;
-
-   /*
-* According to the board_mmc_init() the following map is done:
-* (U-boot device node)(Physical Port)
-* mmc0USDHC2
-*/
-   for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) {
-   switch (i) {
-   case 0:
-   imx_iomux_v3_setup_multiple_pads(
-   usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
-   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
-   gpio_direction_input(USDHC2_CD_GPIO);
-   gpio_direction_output(USDHC2_PWR_GPIO, 1);
-   break;
-   case 1:
-   imx_iomux_v3_setup_multiple_pads(
-   usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
-   usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-   break;
-   default:
-   printf("Warning: you configured more USDHC controllers\
-   (%d) than supported by the board\n", i + 1);
-   return -EINVAL;
-   }
-
-   ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]);
-   if (ret) {
-   printf("Warning:\
-   failed to initialize mmc dev %d\n", i);
-   return ret;
-   }
-   }
-
-   return 0;
-#else
-   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
-   u32 val;
-   u32 port;
-
-   val = readl(&src_regs->sbmr1);
-
-   if ((val & 0xc0) != 0x40) {
-   printf("Not boot from USDHC!\n");
-   return -EINVAL;
-   }
-
-   port = (val >> 11) & 0x3;
-   printf("port %d\n", port);
-   switch (port) {
-   case 1:
-   imx_iomux_v3_setup_multiple_pads(
-   usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
-   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
-   usdhc_cfg[0].esdhc_base = USDHC2_BASE_ADDR;
-   gpio_direction_input(USDHC2_CD_GPIO);
-   gpio_direction_output(USDHC2_PWR_GPIO, 1);
-   break;
-   case 2:
-   imx_iomux_v3_setup_multiple_pads(
-   usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
-   usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
-   usdhc_cfg[1].esdhc_base = USDHC3_BASE_ADDR;
-   break;
-   }
+   imx_iomux_v3_setup_multiple_pads(usdhc2_pads, ARRAY_SIZE(usdhc2_pads));
+   usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+   usdhc_cfg[0].esdhc_base = USDHC2_BASE_ADDR;
+   gpio_direction_input(USDHC2_CD_GPIO);
+   gpio_direction_output(USDHC2_PWR_GPIO, 1);
 
gd->arch.sdhc_clk = usdhc_cfg[0].sdhc_clk;
return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
-#endif
 }
 
 char *board_string(void)
diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h
index 81e0481..cf75186 100644
--- a/include/configs/udoo_neo.h
+++ b/include/configs/udoo_neo.h
@@ -27,7 +27,6

[U-Boot] [PATCH 4/6] udoo_neo: Remove mmcautodetect option

2016-12-01 Thread Breno Lima
It's not necessary to define the mmcautodetect as it is not used anywhere.

Signed-off-by: Breno Lima 
---
 include/configs/udoo_neo.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/configs/udoo_neo.h b/include/configs/udoo_neo.h
index cf75186..164980f 100644
--- a/include/configs/udoo_neo.h
+++ b/include/configs/udoo_neo.h
@@ -40,7 +40,6 @@
"ip_dyn=yes\0" \
"mmcdev=0\0" \
"mmcrootfstype=ext4\0" \
-   "mmcautodetect=no\0" \
"findfdt="\
"if test $board_name = BASIC; then " \
"setenv fdt_file imx6sx-udoo-neo-basic.dtb; fi; " \
-- 
2.7.4

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


[U-Boot] [PATCH 1/3] power: pmic: Add Voltage configuration macro

2016-12-06 Thread Breno Lima
Add pfuze3000 voltage configuration macro for SW1AB, SW3 and VLDO1/2 according
to tables 53, 57 and 62 on PF3000 datasheet.

Signed-off-by: Breno Lima 
---
Note: This patch series depends on my last series submission.
 include/power/pfuze3000_pmic.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/power/pfuze3000_pmic.h b/include/power/pfuze3000_pmic.h
index e8b892b..7d66ba4 100644
--- a/include/power/pfuze3000_pmic.h
+++ b/include/power/pfuze3000_pmic.h
@@ -75,4 +75,9 @@ enum {
 
 int power_pfuze3000_init(unsigned char bus);
 
+/* Voltage Configuration */
+#define PFUZE3000_SW1AB_SETP(x)((x - 7000) / 250)
+#define PFUZE3000_SW3_SETP(x)  ((x - 9000) / 500)
+#define PFUZE3000_VLDO_SETP(x) ((x - 8000) / 500)
+
 #endif
-- 
2.7.4

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


[U-Boot] [PATCH 3/3] udoo_neo: Add Ethernet support

2016-12-06 Thread Breno Lima
UDOO Neo boards has one FEC port connected to KSZ8091, add support for it.

Tested on a UDOO Neo Full with "dhcp zImage" command.

Signed-off-by: Breno Lima 
---
 board/udoo/neo/neo.c   | 95 ++
 configs/udoo_neo_defconfig |  2 +-
 include/configs/udoo_neo.h | 17 -
 3 files changed, 112 insertions(+), 2 deletions(-)

diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index ad7452c..688b522 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -10,6 +10,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -25,8 +26,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -50,6 +54,16 @@ enum {
PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
PAD_CTL_ODE)
 
+#define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \
+   PAD_CTL_SPEED_MED   |   \
+   PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST)
+
+#define ENET_CLK_PAD_CTRL  (PAD_CTL_SPEED_MED | \
+   PAD_CTL_DSE_120ohm   | PAD_CTL_SRE_FAST)
+
+#define ENET_RX_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |  \
+   PAD_CTL_SPEED_MED   | PAD_CTL_SRE_FAST)
+
 #define WDOG_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_SPEED_MED | \
PAD_CTL_DSE_40ohm)
 
@@ -213,6 +227,27 @@ static iomux_v3_cfg_t const usdhc2_pads[] = {
MX6_PAD_SD1_CMD__GPIO6_IO_1 | MUX_PAD_CTRL(NO_PAD_CTRL),
 };
 
+static iomux_v3_cfg_t const fec1_pads[] = {
+   MX6_PAD_ENET1_MDC__ENET1_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_ENET1_MDIO__ENET1_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII1_RX_CTL__ENET1_RX_EN | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
+   MX6_PAD_RGMII1_RD0__ENET1_RX_DATA_0 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
+   MX6_PAD_RGMII1_RD1__ENET1_RX_DATA_1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
+   MX6_PAD_RGMII1_TX_CTL__ENET1_TX_EN | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII1_RXC__ENET1_RX_ER | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
+   MX6_PAD_RGMII1_TD0__ENET1_TX_DATA_0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII1_TD1__ENET1_TX_DATA_1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_ENET1_TX_CLK__ENET1_REF_CLK1 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
+   MX6_PAD_ENET2_TX_CLK__GPIO2_IO_9 | MUX_PAD_CTRL(ENET_RX_PAD_CTRL),
+   MX6_PAD_ENET1_CRS__GPIO2_IO_1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
+};
+
+static iomux_v3_cfg_t const phy_control_pads[] = {
+   /* 25MHz Ethernet PHY Clock */
+   MX6_PAD_ENET2_RX_CLK__ENET2_REF_CLK_25M |
+   MUX_PAD_CTRL(ENET_CLK_PAD_CTRL),
+};
+
 static iomux_v3_cfg_t const board_recognition_pads[] = {
/*Connected to R184*/
MX6_PAD_NAND_READY_B__GPIO4_IO_13 | BOARD_DETECT_PAD_CFG,
@@ -233,6 +268,66 @@ static void setup_iomux_uart(void)
imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
 }
 
+static int setup_fec(int fec_id)
+{
+   struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
+   int reg;
+
+   imx_iomux_v3_setup_multiple_pads(phy_control_pads,
+ARRAY_SIZE(phy_control_pads));
+
+   /* Reset PHY */
+   gpio_direction_output(IMX_GPIO_NR(2, 1) , 0);
+   udelay(1);
+   gpio_set_value(IMX_GPIO_NR(2, 1), 1);
+   udelay(100);
+
+   reg = readl(&anatop->pll_enet);
+   reg |= BM_ANADIG_PLL_ENET_REF_25M_ENABLE;
+   writel(reg, &anatop->pll_enet);
+
+   return enable_fec_anatop_clock(fec_id, ENET_25MHZ);
+}
+
+int board_eth_init(bd_t *bis)
+{
+   uint32_t base = IMX_FEC_BASE;
+   struct mii_dev *bus = NULL;
+   struct phy_device *phydev = NULL;
+   int ret;
+
+   imx_iomux_v3_setup_multiple_pads(fec1_pads, ARRAY_SIZE(fec1_pads));
+
+   setup_fec(CONFIG_FEC_ENET_DEV);
+
+   bus = fec_get_miibus(base, CONFIG_FEC_ENET_DEV);
+   if (!bus)
+   return -EINVAL;
+
+   phydev = phy_find_by_mask(bus, (0x1 << CONFIG_FEC_MXC_PHYADDR),
+   PHY_INTERFACE_MODE_RMII);
+   if (!phydev) {
+   free(bus);
+   return -EINVAL;
+   }
+
+   ret  = fec_probe(bis, CONFIG_FEC_ENET_DEV, base, bus, phydev);
+   if (ret) {
+   free(bus);
+   free(phydev);
+   return ret;
+   }
+   return 0;
+}
+
+int board_phy_config(struct phy_device *phydev)
+{
+   if (phydev->drv->config)
+   phydev->drv->config(phydev);
+
+   return 0;
+}
+
 int board_init(void)
 {
/* Address of boot parameters */
diff --git a/configs/udoo_neo_defconfig b/configs/udoo_neo_defconfig
index f88820c..5df4ef9 100644
--- a/configs/udoo_neo_defconfig
+++ b/configs/udoo_neo_defconfig
@@ -19,7 +19,7 @@ CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
-# CONFIG_CMD_DHCP=y
+CONFIG_CMD_DHCP=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
 CONF

[U-Boot] [PATCH 2/3] udoo_neo: Add PFUZE300 PMIC support

2016-12-06 Thread Breno Lima
UDOO Neo boards has a PFUZE300 connected to I2C1 bus.

Tested on a UDOO Neo Full with "pmic PFUZE3000 dump" command.

Signed-off-by: Breno Lima 
---
 board/udoo/neo/neo.c   | 143 +
 include/configs/udoo_neo.h |  13 +
 2 files changed, 156 insertions(+)

diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index cfeed6f..ad7452c 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -19,10 +19,14 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -41,6 +45,11 @@ enum {
PAD_CTL_PUS_22K_UP  | PAD_CTL_SPEED_LOW |   \
PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
+#define I2C_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |  \
+   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |   \
+   PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
+   PAD_CTL_ODE)
+
 #define WDOG_PAD_CTRL (PAD_CTL_PUE | PAD_CTL_PKE | PAD_CTL_SPEED_MED | \
PAD_CTL_DSE_40ohm)
 
@@ -56,6 +65,136 @@ int dram_init(void)
return 0;
 }
 
+#ifdef CONFIG_SYS_I2C_MXC
+#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
+/* I2C1 for PMIC */
+static struct i2c_pads_info i2c_pad_info1 = {
+   .scl = {
+   .i2c_mode = MX6_PAD_GPIO1_IO00__I2C1_SCL | PC,
+   .gpio_mode = MX6_PAD_GPIO1_IO00__GPIO1_IO_0 | PC,
+   .gp = IMX_GPIO_NR(1, 0),
+   },
+   .sda = {
+   .i2c_mode = MX6_PAD_GPIO1_IO01__I2C1_SDA | PC,
+   .gpio_mode = MX6_PAD_GPIO1_IO01__GPIO1_IO_1 | PC,
+   .gp = IMX_GPIO_NR(1, 1),
+   },
+};
+#endif
+
+#ifdef CONFIG_POWER
+int power_init_board(void)
+{
+   struct pmic *p;
+   int ret;
+   unsigned int reg, rev_id;
+
+   ret = power_pfuze3000_init(PFUZE3000_I2C_BUS);
+   if (ret)
+   return ret;
+
+   p = pmic_get("PFUZE3000");
+   ret = pmic_probe(p);
+   if (ret)
+   return ret;
+
+   pmic_reg_read(p, PFUZE3000_DEVICEID, ®);
+   pmic_reg_read(p, PFUZE3000_REVID, &rev_id);
+   printf("PMIC:  PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", reg, rev_id);
+
+   /* disable Low Power Mode during standby mode */
+   pmic_reg_read(p, PFUZE3000_LDOGCTL, ®);
+   reg |= 0x1;
+   ret = pmic_reg_write(p, PFUZE3000_LDOGCTL, reg);
+   if (ret)
+   return ret;
+
+   ret = pmic_reg_write(p, PFUZE3000_SW1AMODE, 0xc);
+   if (ret)
+   return ret;
+
+   ret = pmic_reg_write(p, PFUZE3000_SW1BMODE, 0xc);
+   if (ret)
+   return ret;
+
+   ret = pmic_reg_write(p, PFUZE3000_SW2MODE, 0xc);
+   if (ret)
+   return ret;
+
+   ret = pmic_reg_write(p, PFUZE3000_SW3MODE, 0xc);
+   if (ret)
+   return ret;
+
+   /* set SW1A standby voltage 0.975V */
+   pmic_reg_read(p, PFUZE3000_SW1ASTBY, ®);
+   reg &= ~0x3f;
+   reg |= PFUZE3000_SW1AB_SETP(9750);
+   ret = pmic_reg_write(p, PFUZE3000_SW1ASTBY, reg);
+   if (ret)
+   return ret;
+
+   /* set SW1B standby voltage 0.975V */
+   pmic_reg_read(p, PFUZE3000_SW1BSTBY, ®);
+   reg &= ~0x3f;
+   reg |= PFUZE3000_SW1AB_SETP(9750);
+   ret = pmic_reg_write(p, PFUZE3000_SW1BSTBY, reg);
+   if (ret)
+   return ret;
+
+   /* set SW1A/VDD_ARM_IN step ramp up time from 16us to 4us/25mV */
+   pmic_reg_read(p, PFUZE3000_SW1ACONF, ®);
+   reg &= ~0xc0;
+   reg |= 0x40;
+   ret = pmic_reg_write(p, PFUZE3000_SW1ACONF, reg);
+   if (ret)
+   return ret;
+
+   /* set SW1B/VDD_SOC_IN step ramp up time from 16us to 4us/25mV */
+   pmic_reg_read(p, PFUZE3000_SW1BCONF, ®);
+   reg &= ~0xc0;
+   reg |= 0x40;
+   ret = pmic_reg_write(p, PFUZE3000_SW1BCONF, reg);
+   if (ret)
+   return ret;
+
+   /* set VDD_ARM_IN to 1.350V */
+   pmic_reg_read(p, PFUZE3000_SW1AVOLT, ®);
+   reg &= ~0x3f;
+   reg |= PFUZE3000_SW1AB_SETP(13500);
+   ret = pmic_reg_write(p, PFUZE3000_SW1AVOLT, reg);
+   if (ret)
+   return ret;
+
+   /* set VDD_SOC_IN to 1.350V */
+   pmic_reg_read(p, PFUZE3000_SW1BVOLT, ®);
+   reg &= ~0x3f;
+   reg |= PFUZE3000_SW1AB_SETP(13500);
+   ret = pmic_reg_write(p, PFUZE3000_SW1BVOLT, reg);
+   if (ret)
+   return ret;
+
+   /* set DDR_1_5V to 1.350V */
+   pmic_reg_read(p, PFUZE3000_SW3VOLT, ®);
+   reg &= ~0x0f;
+   reg |= PFUZE3000_SW3_SETP(13500);
+   ret = pmic_reg_write(p, PFUZE3000_SW3VOLT, reg);
+   if (ret)
+   return ret;
+
+   /* set VGEN2_1V5 to 1.5V */
+   pmic_reg_read(p, PFUZE3000_VLDO2CTL, ®);
+   reg &= ~0x0f;
+   reg |= PFUZE3000_VLDO_SETP(15000);
+   /*  enable  */
+   reg |= 0x10;
+  

[U-Boot] [PATCH] doc: Move device tree bindings documentation to doc/device-tree-bindings

2018-07-20 Thread Breno Lima
From: Breno Lima 

Currently the U-Boot project contains 2 documentation directories:

- doc/
- Documentation/

The Documentation directory only contains device tree bindings related
content, so move the 3 files to doc/device-tree-bindings/.

Signed-off-by: Breno Lima 
---
 .../devicetree/bindings => doc/device-tree-bindings}/phy/no-op.txt| 0
 .../bindings => doc/device-tree-bindings}/phy/phy-stm32-usbphyc.txt   | 0
 .../bindings => doc/device-tree-bindings}/rtc/brcm,brcmstb-waketimer.txt  | 0
 3 files changed, 0 insertions(+), 0 deletions(-)
 rename {Documentation/devicetree/bindings => 
doc/device-tree-bindings}/phy/no-op.txt (100%)
 rename {Documentation/devicetree/bindings => 
doc/device-tree-bindings}/phy/phy-stm32-usbphyc.txt (100%)
 rename {Documentation/devicetree/bindings => 
doc/device-tree-bindings}/rtc/brcm,brcmstb-waketimer.txt (100%)

diff --git a/Documentation/devicetree/bindings/phy/no-op.txt 
b/doc/device-tree-bindings/phy/no-op.txt
similarity index 100%
rename from Documentation/devicetree/bindings/phy/no-op.txt
rename to doc/device-tree-bindings/phy/no-op.txt
diff --git a/Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.txt 
b/doc/device-tree-bindings/phy/phy-stm32-usbphyc.txt
similarity index 100%
rename from Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.txt
rename to doc/device-tree-bindings/phy/phy-stm32-usbphyc.txt
diff --git a/Documentation/devicetree/bindings/rtc/brcm,brcmstb-waketimer.txt 
b/doc/device-tree-bindings/rtc/brcm,brcmstb-waketimer.txt
similarity index 100%
rename from Documentation/devicetree/bindings/rtc/brcm,brcmstb-waketimer.txt
rename to doc/device-tree-bindings/rtc/brcm,brcmstb-waketimer.txt
-- 
2.7.4

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


[U-Boot] [PATCH] crypto/fsl: Fix HW accelerated hash commands

2018-01-17 Thread Breno Lima
The hash command function were not flushing the dcache before passing data
to CAAM/DMA and not invalidating the dcache when getting data back.

Due the data cache incoherency, HW accelerated hash commands used to fail
with CAAM errors like "Invalid KEY Command".

Check if pbuf and pout buffers are properly aligned to the cache line size
and flush/invalidate the memory regions to address this issue.

This solution is based in a previous work from Clemens Gruber in
commit 598e9dccc75d ("crypto/fsl: fix BLOB encapsulation and
decapsulation")

Reported-by: Anatolij Gustschin 
Signed-off-by: Breno Lima 
---
 common/hash.c |  7 ++-
 drivers/crypto/fsl/fsl_hash.c | 20 +++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/common/hash.c b/common/hash.c
index cf4d70f..69d53ed 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -390,7 +390,7 @@ int hash_command(const char *algo_name, int flags, 
cmd_tbl_t *cmdtp, int flag,
 
if (multi_hash()) {
struct hash_algo *algo;
-   uint8_t output[HASH_MAX_DIGEST_SIZE];
+   u8 *output;
uint8_t vsum[HASH_MAX_DIGEST_SIZE];
void *buf;
 
@@ -405,6 +405,9 @@ int hash_command(const char *algo_name, int flags, 
cmd_tbl_t *cmdtp, int flag,
return 1;
}
 
+   output = memalign(ARCH_DMA_MINALIGN,
+ sizeof(uint32_t) * HASH_MAX_DIGEST_SIZE);
+
buf = map_sysmem(addr, len);
algo->hash_func_ws(buf, len, output, algo->chunk_size);
unmap_sysmem(buf);
@@ -440,6 +443,8 @@ int hash_command(const char *algo_name, int flags, 
cmd_tbl_t *cmdtp, int flag,
store_result(algo, output, *argv,
flags & HASH_FLAG_ENV);
}
+   unmap_sysmem(output);
+
}
 
/* Horrible code size hack for boards that just want crc32 */
diff --git a/drivers/crypto/fsl/fsl_hash.c b/drivers/crypto/fsl/fsl_hash.c
index a63eba3..9373a39 100644
--- a/drivers/crypto/fsl/fsl_hash.c
+++ b/drivers/crypto/fsl/fsl_hash.c
@@ -7,6 +7,7 @@
 
 #include 
 #include 
+#include 
 #include "jobdesc.h"
 #include "desc.h"
 #include "jr.h"
@@ -163,20 +164,37 @@ int caam_hash(const unsigned char *pbuf, unsigned int 
buf_len,
 {
int ret = 0;
uint32_t *desc;
+   unsigned int size;
 
-   desc = malloc(sizeof(int) * MAX_CAAM_DESCSIZE);
+   desc = malloc_cache_aligned(sizeof(int) * MAX_CAAM_DESCSIZE);
if (!desc) {
debug("Not enough memory for descriptor allocation\n");
return -ENOMEM;
}
 
+   if (!IS_ALIGNED((uintptr_t)pbuf, ARCH_DMA_MINALIGN) ||
+   !IS_ALIGNED((uintptr_t)pout, ARCH_DMA_MINALIGN)) {
+   puts("Error: Address arguments are not aligned\n");
+   return -EINVAL;
+   }
+
+   size = ALIGN(buf_len, ARCH_DMA_MINALIGN);
+   flush_dcache_range((unsigned long)pbuf, (unsigned long)pbuf + size);
+
inline_cnstr_jobdesc_hash(desc, pbuf, buf_len, pout,
  driver_hash[algo].alg_type,
  driver_hash[algo].digestsize,
  0);
 
+   size = ALIGN(sizeof(int) * MAX_CAAM_DESCSIZE, ARCH_DMA_MINALIGN);
+   flush_dcache_range((unsigned long)desc, (unsigned long)desc + size);
+
ret = run_descriptor_jr(desc);
 
+   size = ALIGN(driver_hash[algo].digestsize, ARCH_DMA_MINALIGN);
+   invalidate_dcache_range((unsigned long)pout,
+   (unsigned long)pout + size);
+
free(desc);
return ret;
 }
-- 
2.7.4

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


[U-Boot] [PATCH 1/5] imx: hab: Keep CAAM clock enabled after authenticating additional images

2018-02-19 Thread Breno Lima
From: Breno Lima 

Currently it is not possible to run CMD_DEK on i.MX SPL targets:

=> dek_blob 0x1200 0x12001000 128

The system hangs after running dek_blob because the CAAM clock is being
disabled by the HAB code. There is no need to disable CAAM clock after
authenticating additional boot images, thus keep CAAM clock enabled to
address this issue.

Signed-off-by: Breno Lima 
---
 arch/arm/mach-imx/hab.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 5f19777..1e6b31d 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -507,13 +507,13 @@ int imx_hab_authenticate_image(uint32_t ddr_start, 
uint32_t image_size,
 
/* Verify IVT header bugging out on error */
if (verify_ivt_header(ivt_hdr))
-   goto hab_caam_clock_disable;
+   goto hab_authentication_exit;
 
/* Verify IVT body */
if (ivt->self != ivt_addr) {
printf("ivt->self 0x%08x pointer is 0x%08x\n",
   ivt->self, ivt_addr);
-   goto hab_caam_clock_disable;
+   goto hab_authentication_exit;
}
 
start = ddr_start;
@@ -591,8 +591,7 @@ hab_exit_failure_print_status:
get_hab_status();
 #endif
 
-hab_caam_clock_disable:
-   hab_caam_clock_enable(0);
+hab_authentication_exit:
 
if (load_addr != 0)
result = 0;
-- 
2.7.4

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


[U-Boot] [PATCH 2/5] imx: hab: Ensure the IVT DCD pointer is Null prior to calling HAB authenticate function.

2018-02-19 Thread Breno Lima
From: Utkarsh Gupta 

DCD commands should only be present in the initial boot image loaded by
the SoC ROM. DCD should not be present in images that will be verified
by software using HAB RVT authentication APIs. Newer versions of HAB
will generate an error if a DCD pointer is present in an image being
authenticated by calling the HAB RVT API. Older versions of HAB will
process and run DCD if it is present, and this could lead to an incorrect
authentication boot flow.

It is highly recommended this check is in place to ensure additional HAB
verified images do not include a DCD table.

Signed-off-by: Utkarsh Gupta 
Signed-off-by: Breno Lima 
---
 arch/arm/mach-imx/hab.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 1e6b31d..ba6b31d 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -516,6 +516,12 @@ int imx_hab_authenticate_image(uint32_t ddr_start, 
uint32_t image_size,
goto hab_authentication_exit;
}
 
+   /* Verify if IVT DCD pointer is NULL */
+   if (ivt->dcd) {
+   puts("Error: DCD pointer must be NULL\n");
+   goto hab_authentication_exit;
+   }
+
start = ddr_start;
bytes = image_size;
 
-- 
2.7.4

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


[U-Boot] [PATCH 5/5] arm: imx: hab: Define HAB_RVT_BASE according to the processor version

2018-02-19 Thread Breno Lima
From: Breno Lima 

Currently the following devices are using a different definition for ROM
Vector Table addresses:

- i.MX6DQP =  All rev
- i.MX6DQ >= rev 1.5
- i.MX6SDL >= rev 1.2

There is no need to create a new RVT macros since the only update were the
RVT base address. Remove HAB_RVT_*_NEW macros and define a new RVT base
address.

More details about RVT base address can be found on processors Reference
Manual and in the following documents:

EB803: i.MX 6Dual/6Quad Applications Processor Silicon Revision 1.2 to 1.3
Comparison

EB804: i.MX 6Solo/6DualLite Application Processor Silicon Revision 1.1
to 1.2/1.3 Comparison

Signed-off-by: Breno Lima 
---
 arch/arm/include/asm/mach-imx/hab.h |  15 ++---
 arch/arm/mach-imx/hab.c | 106 +++-
 2 files changed, 17 insertions(+), 104 deletions(-)

diff --git a/arch/arm/include/asm/mach-imx/hab.h 
b/arch/arm/include/asm/mach-imx/hab.h
index 93475a6..561de9c 100644
--- a/arch/arm/include/asm/mach-imx/hab.h
+++ b/arch/arm/include/asm/mach-imx/hab.h
@@ -168,7 +168,14 @@ typedef void hapi_clock_init_t(void);
 #ifdef CONFIG_ROM_UNIFIED_SECTIONS
 #define HAB_RVT_BASE   0x0100
 #else
-#define HAB_RVT_BASE   0x0094
+#define HAB_RVT_BASE_NEW   0x0098
+#define HAB_RVT_BASE_OLD   0x0094
+#define HAB_RVT_BASE ((is_mx6dqp()) ?  \
+   HAB_RVT_BASE_NEW :  \
+   (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ?   \
+   HAB_RVT_BASE_NEW :  \
+   (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ?  \
+   HAB_RVT_BASE_NEW : HAB_RVT_BASE_OLD)
 #endif
 
 #define HAB_RVT_ENTRY  (*(uint32_t *)(HAB_RVT_BASE + 0x04))
@@ -179,12 +186,6 @@ typedef void hapi_clock_init_t(void);
 #define HAB_RVT_REPORT_STATUS  (*(uint32_t *)(HAB_RVT_BASE + 0x24))
 #define HAB_RVT_FAILSAFE   (*(uint32_t *)(HAB_RVT_BASE + 0x28))
 
-#define HAB_RVT_REPORT_EVENT_NEW   (*(uint32_t *)0x00B8)
-#define HAB_RVT_REPORT_STATUS_NEW  (*(uint32_t *)0x00BC)
-#define HAB_RVT_AUTHENTICATE_IMAGE_NEW (*(uint32_t *)0x00A8)
-#define HAB_RVT_ENTRY_NEW  (*(uint32_t *)0x009C)
-#define HAB_RVT_EXIT_NEW   (*(uint32_t *)0x00A0)
-
 #define HAB_CID_ROM 0 /**< ROM Caller ID */
 #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/
 
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 79e8bf6..c3fc699 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -13,96 +13,6 @@
 #include 
 #include 
 
-/*  start of HAB API updates */
-
-#define hab_rvt_report_event_p \
-(  \
-   (is_mx6dqp()) ? \
-   ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_NEW) :  \
-   (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ?   \
-   ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_NEW) :  \
-   (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ?  \
-   ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT_NEW) :  \
-   ((hab_rvt_report_event_t *)HAB_RVT_REPORT_EVENT)\
-)
-
-#define hab_rvt_report_status_p\
-(  \
-   (is_mx6dqp()) ? \
-   ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_NEW) :\
-   (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ?   \
-   ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_NEW) :\
-   (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ?  \
-   ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS_NEW) :\
-   ((hab_rvt_report_status_t *)HAB_RVT_REPORT_STATUS)  \
-)
-
-#define hab_rvt_authenticate_image_p   \
-(  \
-   (is_mx6dqp()) ? \
-   ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_NEW) : \
-   (is_mx6dq() && (soc_rev() >= CHIP_REV_1_5)) ?   \
-   ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_NEW) : \
-   (is_mx6sdl() && (soc_rev() >= CHIP_REV_1_2)) ?  \
-   ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE_NEW) : \
-   ((hab_rvt_authenticate_image_t *)HAB_RVT_AUTHENTICATE_IMAGE)\
-)
-
-#define hab_rvt_entry_p\
-(  \
-   (is_mx6dqp()) ? \
-   ((hab_r

[U-Boot] [PATCH 4/5] imx: hab: Check if CSF contains deprecated commands

2018-02-19 Thread Breno Lima
From: Utkarsh Gupta 

Write, Check and Set MID commands have been deprecated from the Code
Signing Tool (CST) v2.3.3 and will not be implemented in newer versions
of HAB, hence the following features are no longer available:

- Write Data
- Clear Mask
- Set Mask
- Check All Clear
- Check All Set
- Check Any Clear
- Check Any Set
- Set MID

The inappropriate use of Write Data command may lead to an incorrect
authentication boot flow. Since no specific application has been identified
that requires the use of any of these features, it is highly recommended to
add this check.

Signed-off-by: Utkarsh Gupta 
Signed-off-by: Breno Lima 
---
 arch/arm/include/asm/mach-imx/hab.h |  4 
 arch/arm/mach-imx/hab.c | 20 
 2 files changed, 24 insertions(+)

diff --git a/arch/arm/include/asm/mach-imx/hab.h 
b/arch/arm/include/asm/mach-imx/hab.h
index bb73203..93475a6 100644
--- a/arch/arm/include/asm/mach-imx/hab.h
+++ b/arch/arm/include/asm/mach-imx/hab.h
@@ -189,6 +189,10 @@ typedef void hapi_clock_init_t(void);
 #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/
 
 #define HAB_CMD_HDR  0xD4  /* CSF Header */
+#define HAB_CMD_WRT_DAT  0xCC  /* Write Data command tag */
+#define HAB_CMD_CHK_DAT  0xCF  /* Check Data command tag */
+#define HAB_CMD_SET  0xB1  /* Set command tag */
+#define HAB_PAR_MID  0x01  /* MID parameter value */
 
 #define IVT_SIZE   0x20
 #define CSF_PAD_SIZE   0x2000
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 7f66965..79e8bf6 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -518,6 +518,26 @@ static bool csf_is_valid(struct ivt *ivt, ulong 
start_addr, size_t bytes)
}
 
do {
+   struct hab_hdr *cmd;
+
+   cmd = (struct hab_hdr *)&csf_hdr[offset];
+
+   switch (cmd->tag) {
+   case (HAB_CMD_WRT_DAT):
+   puts("Error: Deprecated write command found\n");
+   return false;
+   case (HAB_CMD_CHK_DAT):
+   puts("Error: Deprecated check command found\n");
+   return false;
+   case (HAB_CMD_SET):
+   if (cmd->par == HAB_PAR_MID) {
+   puts("Error: Deprecated Set MID command 
found\n");
+   return false;
+   }
+   default:
+   break;
+   }
+
cmd_hdr_len = get_csf_cmd_hdr_len(&csf_hdr[offset]);
if (!cmd_hdr_len) {
puts("Error: Invalid command length\n");
-- 
2.7.4

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


[U-Boot] [PATCH 3/5] imx: hab: Check if CSF is valid before authenticating image

2018-02-19 Thread Breno Lima
From: Utkarsh Gupta 

For proper authentication the HAB code must check if the CSF is valid.
Users must call the csf_is_valid() function to parse the CSF prior to
authenticating any additional images. The function will return a failure
if any of the following invalid conditions are met:

- CSF pointer is NULL
- CSF Header does not exist
- CSF does not lie within the image bounds
- CSF command length zero

Signed-off-by: Utkarsh Gupta 
Signed-off-by: Breno Lima 
---
 arch/arm/include/asm/mach-imx/hab.h |  8 
 arch/arm/mach-imx/hab.c | 81 +
 2 files changed, 89 insertions(+)

diff --git a/arch/arm/include/asm/mach-imx/hab.h 
b/arch/arm/include/asm/mach-imx/hab.h
index a0cb19d..bb73203 100644
--- a/arch/arm/include/asm/mach-imx/hab.h
+++ b/arch/arm/include/asm/mach-imx/hab.h
@@ -38,6 +38,12 @@ struct ivt {
uint32_t reserved2; /* Reserved should be zero */
 };
 
+struct __packed hab_hdr {
+   u8 tag;  /* Tag field */
+   u8 len[2];   /* Length field in bytes (big-endian) */
+   u8 par;  /* Parameters field */
+};
+
 /*  start of HAB API updates */
 /* The following are taken from HAB4 SIS */
 
@@ -182,6 +188,8 @@ typedef void hapi_clock_init_t(void);
 #define HAB_CID_ROM 0 /**< ROM Caller ID */
 #define HAB_CID_UBOOT 1 /**< UBOOT Caller ID*/
 
+#define HAB_CMD_HDR  0xD4  /* CSF Header */
+
 #define IVT_SIZE   0x20
 #define CSF_PAD_SIZE   0x2000
 
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index ba6b31d..7f66965 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -453,6 +453,83 @@ U_BOOT_CMD(
 
 #endif /* !defined(CONFIG_SPL_BUILD) */
 
+/* Get CSF Header length */
+static int get_hab_hdr_len(struct hab_hdr *hdr)
+{
+   return (size_t)((hdr->len[0] << 8) + (hdr->len[1]));
+}
+
+/* Check whether addr lies between start and
+ * end and is within the length of the image
+ */
+static int chk_bounds(u8 *addr, size_t bytes, u8 *start, u8 *end)
+{
+   size_t csf_size = (size_t)((end + 1) - addr);
+
+   return (addr && (addr >= start) && (addr <= end) &&
+   (csf_size >= bytes));
+}
+
+/* Get Length of each command in CSF */
+static int get_csf_cmd_hdr_len(u8 *csf_hdr)
+{
+   if (*csf_hdr == HAB_CMD_HDR)
+   return sizeof(struct hab_hdr);
+
+   return get_hab_hdr_len((struct hab_hdr *)csf_hdr);
+}
+
+/* Check if CSF is valid */
+static bool csf_is_valid(struct ivt *ivt, ulong start_addr, size_t bytes)
+{
+   u8 *start = (u8 *)start_addr;
+   u8 *csf_hdr;
+   u8 *end;
+
+   size_t csf_hdr_len;
+   size_t cmd_hdr_len;
+   size_t offset = 0;
+
+   if (bytes != 0)
+   end = start + bytes - 1;
+   else
+   end = start;
+
+   /* Verify if CSF pointer content is zero */
+   if (!ivt->csf) {
+   puts("Error: CSF pointer is NULL\n");
+   return false;
+   }
+
+   csf_hdr = (u8 *)ivt->csf;
+
+   /* Verify if CSF Header exist */
+   if (*csf_hdr != HAB_CMD_HDR) {
+   puts("Error: CSF header command not found\n");
+   return false;
+   }
+
+   csf_hdr_len = get_hab_hdr_len((struct hab_hdr *)csf_hdr);
+
+   /* Check if the CSF lies within the image bounds */
+   if (!chk_bounds(csf_hdr, csf_hdr_len, start, end)) {
+   puts("Error: CSF lies outside the image bounds\n");
+   return false;
+   }
+
+   do {
+   cmd_hdr_len = get_csf_cmd_hdr_len(&csf_hdr[offset]);
+   if (!cmd_hdr_len) {
+   puts("Error: Invalid command length\n");
+   return false;
+   }
+   offset += cmd_hdr_len;
+
+   } while (offset < csf_hdr_len);
+
+   return true;
+}
+
 bool imx_hab_is_enabled(void)
 {
struct imx_sec_config_fuse_t *fuse =
@@ -525,6 +602,10 @@ int imx_hab_authenticate_image(uint32_t ddr_start, 
uint32_t image_size,
start = ddr_start;
bytes = image_size;
 
+   /* Verify CSF */
+   if (!csf_is_valid(ivt, start, bytes))
+   goto hab_authentication_exit;
+
if (hab_rvt_entry() != HAB_SUCCESS) {
puts("hab entry function fail\n");
goto hab_exit_failure_print_status;
-- 
2.7.4

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


[U-Boot] [PATCH 1/2] doc: mxc_hab: Move HAB related info to the appropriate doc

2018-02-21 Thread Breno Lima
From: Breno Lima 

Currently the High Assurance Boot procedure is documented in two
places:

- doc/README.imx6
- doc/README.mxc_hab

It is better to consolidate all HAB related information into
README.mxc_hab file, so move the content from README.imx6 to
README.mxc_hab.

Signed-off-by: Breno Lima 
---
 doc/README.imx6| 48 -
 doc/README.mxc_hab | 57 +++---
 2 files changed, 54 insertions(+), 51 deletions(-)

diff --git a/doc/README.imx6 b/doc/README.imx6
index 2e8f1d8..b0644f8 100644
--- a/doc/README.imx6
+++ b/doc/README.imx6
@@ -113,51 +113,3 @@ issue the command:
 In order to load SPL and u-boot.img via imx_usb_loader tool,
 please refer to doc/README.sdp.
 
-3. Using Secure Boot on i.MX6 machines with SPL support

-
-This version of U-Boot is able to build a signable version of the SPL
-as well as a signable version of the U-Boot image. The signature can
-be verified through High Assurance Boot (HAB).
-
-CONFIG_SECURE_BOOT is needed to build those two binaries.
-After building, you need to create a command sequence file and use
-Freescales Code Signing Tool to sign both binaries. After creation,
-the mkimage tool outputs the required information about the HAB Blocks
-parameter for the CSF. During the build, the information is preserved
-in log files named as the binaries. (SPL.log and u-boot-ivt.log).
-
-More information about the CSF and HAB can be found in the AN4581.
-https://cache.freescale.com/files/32bit/doc/app_note/AN4581.pdf
-
-We don't want to explain how to create a PKI tree or SRK table as
-this is well explained in the Application Note.
-
-Example Output of the SPL (imximage) creation:
- Image Type:   Freescale IMX Boot Image
- Image Ver:2 (i.MX53/6/7 compatible)
- Mode: DCD
- Data Size:61440 Bytes = 60.00 kB = 0.06 MB
- Load Address: 00907420
- Entry Point:  00908000
- HAB Blocks:   00907400  cc00
-
-Example Output of the u-boot-ivt.img (firmware_ivt) creation:
- Image Name:   U-Boot 2016.11-rc1-31589-g2a4411
- Created:  Sat Nov  5 21:53:28 2016
- Image Type:   ARM U-Boot Firmware with HABv4 IVT (uncompressed)
- Data Size:352192 Bytes = 343.94 kB = 0.34 MB
- Load Address: 1780
- Entry Point:  
- HAB Blocks:   0x177fffc0   0x   0x00054020
-
-The CST (Code Signing Tool) can be downloaded from NXP.
-# Compile CSF and create signature
-./cst --o csf-u-boot.bin < command_sequence_uboot.csf
-./cst --o csf-SPL.bin < command_sequence_spl.csf
-# Append compiled CSF to Binary
-cat SPL csf-SPL.bin > SPL-signed
-cat u-boot-ivt.img csf-u-boot.bin > u-boot-signed.img
-
-These two signed binaries can be used on an i.MX6 in closed
-configuration when the according SRK Table Hash has been flashed.
diff --git a/doc/README.mxc_hab b/doc/README.mxc_hab
index 4bd07d3..056ade7 100644
--- a/doc/README.mxc_hab
+++ b/doc/README.mxc_hab
@@ -1,4 +1,5 @@
-High Assurance Boot (HAB) for i.MX6 CPUs
+1. High Assurance Boot (HAB) for i.MX CPUs
+--
 
 To enable the authenticated or encrypted boot mode of U-Boot, it is
 required to set the proper configuration for the target board. This
@@ -52,8 +53,58 @@ cat u-boot.imx U-Boot_CSF_pad.bin > u-boot-signed.imx
 NOTE: U-Boot_CSF.bin needs to be padded to the value specified in
 the imximage.cfg file.
 
-Setup U-Boot Image for Encrypted Boot
--
+
+2. Using Secure Boot on i.MX6 machines with SPL support
+---
+
+This version of U-Boot is able to build a signable version of the SPL
+as well as a signable version of the U-Boot image. The signature can
+be verified through High Assurance Boot (HAB).
+
+CONFIG_SECURE_BOOT is needed to build those two binaries.
+After building, you need to create a command sequence file and use
+Freescales Code Signing Tool to sign both binaries. After creation,
+the mkimage tool outputs the required information about the HAB Blocks
+parameter for the CSF. During the build, the information is preserved
+in log files named as the binaries. (SPL.log and u-boot-ivt.log).
+
+More information about the CSF and HAB can be found in the AN4581.
+https://cache.freescale.com/files/32bit/doc/app_note/AN4581.pdf
+
+We don't want to explain how to create a PKI tree or SRK table as
+this is well explained in the Application Note.
+
+Example Output of the SPL (imximage) creation:
+ Image Type:   Freescale IMX Boot Image
+ Image Ver:2 (i.MX53/6/7 compatible)
+ Mode: DCD
+ Data Size:61440 Bytes = 60.00 kB = 0.06 MB
+ Load Address: 00907420
+ Entry Point:  00908000
+ HAB Blocks:   00907400  cc00
+
+Example Output of the u-boot-ivt.img (firmware_ivt) creation:
+ Image Name:   U-Boot 2016.11-rc1-31589-g2a4411
+ Created:  Sat Nov  5 21:53:28 2016
+ Image Type:   ARM U-Boot Firmware wit

[U-Boot] [PATCH 2/2] doc: mxc_hab: Update i.MX HAB documentation

2018-02-21 Thread Breno Lima
From: Breno Lima 

The README.mxc_hab is outdated and need improvements, add the following
modifications:

- Reorganize document and remove duplicate content
- Add CST download link
- Update CST package name
- Align command lines with CST v2.3.3
- Update U-Boot binary name
- Remove CSF padding since is not documented in AN4581

Signed-off-by: Breno Lima 
---
 doc/README.mxc_hab | 72 +-
 1 file changed, 33 insertions(+), 39 deletions(-)

diff --git a/doc/README.mxc_hab b/doc/README.mxc_hab
index 056ade7..75390a5 100644
--- a/doc/README.mxc_hab
+++ b/doc/README.mxc_hab
@@ -11,14 +11,22 @@ In addition, the U-Boot image to be programmed into the
 boot media needs to be properly constructed, i.e. it must contain a
 proper Command Sequence File (CSF).
 
-The Initial Vector Table contains a pointer to the CSF. Please see
-doc/README.imximage for how to prepare u-boot.imx.
+The CSF itself is generated by the i.MX High Assurance Boot Reference
+Code Signing Tool.
+https://www.nxp.com/webapp/sps/download/license.jsp?colCode=IMX_CST_TOOL
 
-The CSF itself is being generated by Freescale HAB tools.
+More information about the CSF and HAB can be found in the AN4581.
+https://www.nxp.com/docs/en/application-note/AN4581.pdf
+
+We don't want to explain how to create a PKI tree or SRK table as
+this is well explained in the Application Note.
 
-mkimage will output additional information about "HAB Blocks"
-which can be used in the Freescale tooling to authenticate U-Boot
-(entries in the CSF file).
+2. Secure Boot on non-SPL targets
+-
+
+On non-SPL targets a singe U-Boot binary is generated, mkimage will
+output additional information about "HAB Blocks" which can be used
+in the CST to authenticate the U-Boot image (entries in the CSF file).
 
 Image Type:   Freescale IMX Boot Image
 Image Ver:2 (i.MX53/6 compatible)
@@ -34,46 +42,35 @@ HAB Blocks:   177ff400  0004dc00
|
--- (3)
 
-(1)Size of area in file u-boot.imx to sign
+(1)Size of area in file u-boot-dtb.imx to sign
This area should include the IVT, the Boot Data the DCD
and U-Boot itself.
-(2)Start of area in u-boot.imx to sign
+(2)Start of area in u-boot-dtb.imx to sign
 (3)Start of area in RAM to authenticate
 
 CONFIG_SECURE_BOOT currently enables only an additional command
 'hab_status' in U-Boot to retrieve the HAB status and events. This
 can be useful while developing and testing HAB.
 
-Commands to generate a signed U-Boot using Freescale HAB tools:
-cst --o U-Boot_CSF.bin < U-Boot.CSF
-objcopy -I binary -O binary --pad-to 0x2000 --gap-fill=0x00 \
-   U-Boot_CSF.bin U-Boot_CSF_pad.bin
-cat u-boot.imx U-Boot_CSF_pad.bin > u-boot-signed.imx
-
-NOTE: U-Boot_CSF.bin needs to be padded to the value specified in
-the imximage.cfg file.
-
+Commands to generate a signed U-Boot using i.MX HAB CST tool:
+# Compile CSF and create signature
+cst --o csf-u-boot.bin --i command_sequence_uboot.csf
+# Append compiled CSF to Binary
+cat u-boot-dtb.imx csf-u-boot.bin > u-boot-signed.imx
 
-2. Using Secure Boot on i.MX6 machines with SPL support

+3. Secure Boot on SPL targets
+-
 
 This version of U-Boot is able to build a signable version of the SPL
 as well as a signable version of the U-Boot image. The signature can
 be verified through High Assurance Boot (HAB).
 
-CONFIG_SECURE_BOOT is needed to build those two binaries.
 After building, you need to create a command sequence file and use
-Freescales Code Signing Tool to sign both binaries. After creation,
+i.MX HAB Code Signing Tool to sign both binaries. After creation,
 the mkimage tool outputs the required information about the HAB Blocks
 parameter for the CSF. During the build, the information is preserved
 in log files named as the binaries. (SPL.log and u-boot-ivt.log).
 
-More information about the CSF and HAB can be found in the AN4581.
-https://cache.freescale.com/files/32bit/doc/app_note/AN4581.pdf
-
-We don't want to explain how to create a PKI tree or SRK table as
-this is well explained in the Application Note.
-
 Example Output of the SPL (imximage) creation:
  Image Type:   Freescale IMX Boot Image
  Image Ver:2 (i.MX53/6/7 compatible)
@@ -92,23 +89,22 @@ Example Output of the u-boot-ivt.img (firmware_ivt) 
creation:
  Entry Point:  
  HAB Blocks:   0x177fffc0   0x   0x00054020
 
-The CST (Code Signing Tool) can be downloaded from NXP.
 # Compile CSF and create signature
-./cst --o csf-u-boot.bin < command_sequence_uboot.csf
-./cst --o csf-SPL.bin < command_sequence_spl.csf
+cst --o csf-u-boot.bin --i command_sequence_uboot.csf
+cst --o csf-SPL.bin --i command_sequence_spl.csf
 # Append compiled CSF to Binary
 cat SPL csf-SPL.bin > SPL-signed
 cat u-boot-ivt.