[U-Boot] [PATCH v3 5/5] ls1088aqds: Enable USB command on QDS for qspi-boot

2017-10-10 Thread Ran Wang
Signed-off-by: Amrita Kumari 
Signed-off-by: Ashish Kumar 
Signed-off-by: Ran Wang 
---
Change in v3:
- none

Change in v2:
Remove macro CONFIG_HAS_FSL_XHCI_USB and CONFIG_USB_XHCI_FSL
and CONFIG_USB_MAX_CONTROLLER_COUNT from ls1088aqds.h since
Kconfig option has covered.

Change in v1:
Rebased to
ba39608 ARM: DRA72x: Add support for detection of DRA71x SR 2.1

 configs/ls1088aqds_qspi_defconfig | 8 
 1 file changed, 8 insertions(+)

diff --git a/configs/ls1088aqds_qspi_defconfig 
b/configs/ls1088aqds_qspi_defconfig
index 4b0d604fa0..a24a6011c9 100644
--- a/configs/ls1088aqds_qspi_defconfig
+++ b/configs/ls1088aqds_qspi_defconfig
@@ -31,3 +31,11 @@ CONFIG_FSL_DSPI=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_FSL_LS_PPA=y
+CONFIG_USB=y
+CONFIG_USB_GADGET=y
+CONFIG_CMD_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_STORAGE=y
-- 
2.14.1

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


[U-Boot] [PATCH v3 4/5] ls1088ardb: Enable USB command RDB qspi-boot

2017-10-10 Thread Ran Wang
Signed-off-by: Ashish Kumar 
Signed-off-by: Amrita Kumari 
Signed-off-by: Ran Wang 
---
Change in v3:
1.Move HAS_FSL_XHCI_USB and USB_XHCI_FSL define to other patch file.

Change in v2:
1.Adjust USB nodes position in dts to keep them sorted in
  unit-address.
2.Move macro CONFIG_HAS_FSL_XHCI_USB and CONFIG_USB_XHCI_FSL
  to Kconfig option.
3.Remove CONFIG_USB_MAX_CONTROLLER_COUNT.

Change in v1:
Rebased to 
ba39608 ARM: DRA72x: Add support for detection of DRA71x SR 2.1

 arch/arm/dts/fsl-ls1088a.dtsi | 14 ++
 configs/ls1088ardb_qspi_defconfig |  8 
 include/linux/usb/xhci-fsl.h  |  2 +-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/fsl-ls1088a.dtsi b/arch/arm/dts/fsl-ls1088a.dtsi
index d943a9efa3..64b4fcf12b 100644
--- a/arch/arm/dts/fsl-ls1088a.dtsi
+++ b/arch/arm/dts/fsl-ls1088a.dtsi
@@ -76,6 +76,20 @@
num-cs = <4>;
};
 
+   usb0: usb3@310 {
+   compatible = "fsl,layerscape-dwc3";
+   reg = <0x0 0x310 0x0 0x1>;
+   interrupts = <0 80 0x4>; /* Level high type */
+   dr_mode = "host";
+   };
+
+   usb1: usb3@311 {
+   compatible = "fsl,layerscape-dwc3";
+   reg = <0x0 0x311 0x0 0x1>;
+   interrupts = <0 81 0x4>; /* Level high type */
+   dr_mode = "host";
+   };
+
pcie@340 {
compatible = "fsl,ls-pcie", "snps,dw-pcie";
reg = <0x00 0x0340 0x0 0x8   /* dbi registers */
diff --git a/configs/ls1088ardb_qspi_defconfig 
b/configs/ls1088ardb_qspi_defconfig
index 2d5a134261..3034f506e2 100644
--- a/configs/ls1088ardb_qspi_defconfig
+++ b/configs/ls1088ardb_qspi_defconfig
@@ -31,3 +31,11 @@ CONFIG_FSL_DSPI=y
 CONFIG_EFI_LOADER_BOUNCE_BUFFER=y
 # CONFIG_DISPLAY_BOARDINFO is not set
 CONFIG_FSL_LS_PPA=y
+CONFIG_USB=y
+CONFIG_USB_GADGET=y
+CONFIG_CMD_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_XHCI_DWC3=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_STORAGE=y
diff --git a/include/linux/usb/xhci-fsl.h b/include/linux/usb/xhci-fsl.h
index bd54089722..a916afb885 100644
--- a/include/linux/usb/xhci-fsl.h
+++ b/include/linux/usb/xhci-fsl.h
@@ -58,7 +58,7 @@ struct fsl_xhci {
 #define CONFIG_SYS_FSL_XHCI_USB1_ADDR CONFIG_SYS_XHCI_USB1_ADDR
 #define CONFIG_SYS_FSL_XHCI_USB2_ADDR 0
 #define CONFIG_SYS_FSL_XHCI_USB3_ADDR 0
-#elif defined(CONFIG_ARCH_LS2080A)
+#elif defined(CONFIG_ARCH_LS2080A) || defined(CONFIG_ARCH_LS1088A)
 #define CONFIG_SYS_FSL_XHCI_USB1_ADDR CONFIG_SYS_XHCI_USB1_ADDR
 #define CONFIG_SYS_FSL_XHCI_USB2_ADDR CONFIG_SYS_XHCI_USB2_ADDR
 #define CONFIG_SYS_FSL_XHCI_USB3_ADDR 0
-- 
2.14.1

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


[U-Boot] [PATCH v3 2/5] usb: host: Move CONFIG_XHCI_FSL to Kconfig

2017-10-10 Thread Ran Wang
use Kconfig to select xhci accordingly.

Signed-off-by: Ran Wang 
---
Change in v3:
New patch file.

 drivers/usb/host/Kconfig  | 6 ++
 include/configs/ls1012afrdm.h | 1 -
 include/configs/ls1012aqds.h  | 1 -
 include/configs/ls1012ardb.h  | 1 -
 include/configs/ls1021aiot.h  | 1 -
 include/configs/ls1021aqds.h  | 1 -
 include/configs/ls1021atwr.h  | 1 -
 include/configs/ls1043aqds.h  | 1 -
 include/configs/ls1043ardb.h  | 1 -
 include/configs/ls1046aqds.h  | 1 -
 include/configs/ls1046ardb.h  | 1 -
 include/configs/ls2080aqds.h  | 1 -
 include/configs/ls2080ardb.h  | 1 -
 scripts/config_whitelist.txt  | 1 -
 14 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index f797a2568c..70e38a0425 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -71,6 +71,12 @@ config USB_XHCI_DRA7XX_INDEX
  Select the DRA7XX xHCI USB index.
  Current supported values: 0, 1.
 
+config USB_XHCI_FSL
+   bool "Support for NXPLayerscape on-chip xHCI USB controller"
+   default y if ARCH_LS1021A || FSL_LSCH3 || FSL_LSCH2
+   depends on !SPL_NO_USB
+   help
+ Enables support for the on-chip xHCI controller on NXP Layerscape 
SoCs.
 endif # USB_XHCI_HCD
 
 config USB_EHCI_HCD
diff --git a/include/configs/ls1012afrdm.h b/include/configs/ls1012afrdm.h
index 2e5af9cc4e..2e9c619bd5 100644
--- a/include/configs/ls1012afrdm.h
+++ b/include/configs/ls1012afrdm.h
@@ -34,7 +34,6 @@
 /*
 * USB
 */
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
 
 #define CONFIG_CMD_MEMINFO
diff --git a/include/configs/ls1012aqds.h b/include/configs/ls1012aqds.h
index e0949d0b53..70bf72c431 100644
--- a/include/configs/ls1012aqds.h
+++ b/include/configs/ls1012aqds.h
@@ -119,7 +119,6 @@
 #endif
 
 /*XHCI Support - enabled by default*/
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
 
 /*  MMC  */
diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h
index 66ff004384..110fcc6323 100644
--- a/include/configs/ls1012ardb.h
+++ b/include/configs/ls1012ardb.h
@@ -22,7 +22,6 @@
 /*
 * USB
 */
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
 
 /*
diff --git a/include/configs/ls1021aiot.h b/include/configs/ls1021aiot.h
index 2cbea87d95..dac4a81e2a 100644
--- a/include/configs/ls1021aiot.h
+++ b/include/configs/ls1021aiot.h
@@ -20,7 +20,6 @@
 #define CONFIG_SYS_INIT_RAM_SIZE   OCRAM_SIZE
 
 /* XHCI Support - enabled by default */
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT1
 
 #define CONFIG_SYS_CLK_FREQ1
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index 0046ded536..8346e3658f 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -405,7 +405,6 @@ unsigned long get_board_ddr_clk(void);
 #endif
 
 /*XHCI Support - enabled by default*/
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT1
 
 /*
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index 0172c9015d..8ccc81642d 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -45,7 +45,6 @@
 #endif
 
 /* XHCI Support - enabled by default */
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT1
 
 #define CONFIG_SYS_CLK_FREQ1
diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h
index 607c289d17..641ffc1400 100644
--- a/include/configs/ls1043aqds.h
+++ b/include/configs/ls1043aqds.h
@@ -371,7 +371,6 @@ unsigned long get_board_ddr_clk(void);
 #endif
 
 /* USB */
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT3
 
 /*
diff --git a/include/configs/ls1043ardb.h b/include/configs/ls1043ardb.h
index 866817d579..0e02be445a 100644
--- a/include/configs/ls1043ardb.h
+++ b/include/configs/ls1043ardb.h
@@ -281,7 +281,6 @@
 
 /* USB */
 #ifndef SPL_NO_USB
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT3
 #endif
 
diff --git a/include/configs/ls1046aqds.h b/include/configs/ls1046aqds.h
index d47616f2e7..2f2602f098 100644
--- a/include/configs/ls1046aqds.h
+++ b/include/configs/ls1046aqds.h
@@ -137,7 +137,6 @@ unsigned long get_board_ddr_clk(void);
 #endif
 
 /* USB */
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 3
 
 /* SATA */
diff --git a/include/configs/ls1046ardb.h b/include/configs/ls1046ardb.h
index 32b08d8229..40ce8ff462 100644
--- a/include/configs/ls1046ardb.h
+++ b/include/configs/ls1046ardb.h
@@ -211,7 +211,6 @@
 
 /* USB */
 #ifndef SPL_NO_USB
-#define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 3
 #endif
 
diff --git a/include/configs/ls2080aqds.h b/include/configs/ls2080aqds.h
index 74a21ab4e1..5a5debbfc0 100644
--- a/include/configs/ls2080aqds.h
+++ 

[U-Boot] [PATCH v3 3/5] arm: layerscape: Remove CONFIG_USB_MAX_CONTROLLER_COUNT

2017-10-10 Thread Ran Wang
Because COMFIG_DM_USB have been enabled and will not use it anymore.

Signed-off-by: Ran Wang 
---
Change in v3:
New patch file.

 include/configs/ls1012afrdm.h | 5 -
 include/configs/ls1012aqds.h  | 3 ---
 include/configs/ls1012ardb.h  | 4 
 include/configs/ls1021aiot.h  | 3 ---
 include/configs/ls1021aqds.h  | 3 ---
 include/configs/ls1021atwr.h  | 3 ---
 include/configs/ls1043aqds.h  | 3 ---
 include/configs/ls1043ardb.h  | 5 -
 include/configs/ls1046aqds.h  | 3 ---
 include/configs/ls1046ardb.h  | 5 -
 include/configs/ls2080aqds.h  | 5 -
 include/configs/ls2080ardb.h  | 5 -
 12 files changed, 47 deletions(-)

diff --git a/include/configs/ls1012afrdm.h b/include/configs/ls1012afrdm.h
index 2e9c619bd5..efb4c00cd9 100644
--- a/include/configs/ls1012afrdm.h
+++ b/include/configs/ls1012afrdm.h
@@ -31,11 +31,6 @@
"kernel_load=0x9600\0"  \
"kernel_size=0x280\0"
 
-/*
-* USB
-*/
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
-
 #define CONFIG_CMD_MEMINFO
 #define CONFIG_CMD_MEMTEST
 #define CONFIG_SYS_MEMTEST_START   0x8000
diff --git a/include/configs/ls1012aqds.h b/include/configs/ls1012aqds.h
index 70bf72c431..ffb512db45 100644
--- a/include/configs/ls1012aqds.h
+++ b/include/configs/ls1012aqds.h
@@ -118,9 +118,6 @@
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
 #endif
 
-/*XHCI Support - enabled by default*/
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
-
 /*  MMC  */
 #ifdef CONFIG_MMC
 #define CONFIG_FSL_ESDHC
diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h
index 110fcc6323..0caa474636 100644
--- a/include/configs/ls1012ardb.h
+++ b/include/configs/ls1012ardb.h
@@ -19,10 +19,6 @@
 #define CONFIG_SYS_MEMTEST_START   0x8000
 #define CONFIG_SYS_MEMTEST_END 0x9fff
 
-/*
-* USB
-*/
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
 
 /*
  * I2C IO expander
diff --git a/include/configs/ls1021aiot.h b/include/configs/ls1021aiot.h
index dac4a81e2a..c8eb234670 100644
--- a/include/configs/ls1021aiot.h
+++ b/include/configs/ls1021aiot.h
@@ -19,9 +19,6 @@
 #define CONFIG_SYS_INIT_RAM_ADDR   OCRAM_BASE_ADDR
 #define CONFIG_SYS_INIT_RAM_SIZE   OCRAM_SIZE
 
-/* XHCI Support - enabled by default */
-#define CONFIG_USB_MAX_CONTROLLER_COUNT1
-
 #define CONFIG_SYS_CLK_FREQ1
 #define CONFIG_DDR_CLK_FREQ1
 
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index 8346e3658f..6669f2f960 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -404,9 +404,6 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
 #endif
 
-/*XHCI Support - enabled by default*/
-#define CONFIG_USB_MAX_CONTROLLER_COUNT1
-
 /*
  * Video
  */
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index 8ccc81642d..0f20e5e2cc 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -44,9 +44,6 @@
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
 #endif
 
-/* XHCI Support - enabled by default */
-#define CONFIG_USB_MAX_CONTROLLER_COUNT1
-
 #define CONFIG_SYS_CLK_FREQ1
 #define CONFIG_DDR_CLK_FREQ1
 
diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h
index 641ffc1400..8cc2abb2b6 100644
--- a/include/configs/ls1043aqds.h
+++ b/include/configs/ls1043aqds.h
@@ -370,9 +370,6 @@ unsigned long get_board_ddr_clk(void);
 #endif
 #endif
 
-/* USB */
-#define CONFIG_USB_MAX_CONTROLLER_COUNT3
-
 /*
  * Miscellaneous configurable options
  */
diff --git a/include/configs/ls1043ardb.h b/include/configs/ls1043ardb.h
index 0e02be445a..762ecf1f4c 100644
--- a/include/configs/ls1043ardb.h
+++ b/include/configs/ls1043ardb.h
@@ -279,11 +279,6 @@
 #endif
 #endif
 
-/* USB */
-#ifndef SPL_NO_USB
-#define CONFIG_USB_MAX_CONTROLLER_COUNT3
-#endif
-
 /* SATA */
 #ifndef SPL_NO_SATA
 #define CONFIG_LIBATA
diff --git a/include/configs/ls1046aqds.h b/include/configs/ls1046aqds.h
index 2f2602f098..3ce66ce6f1 100644
--- a/include/configs/ls1046aqds.h
+++ b/include/configs/ls1046aqds.h
@@ -136,9 +136,6 @@ unsigned long get_board_ddr_clk(void);
 #define CFG_LPUART_EN  0x2
 #endif
 
-/* USB */
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 3
-
 /* SATA */
 #define CONFIG_LIBATA
 #define CONFIG_SCSI_AHCI
diff --git a/include/configs/ls1046ardb.h b/include/configs/ls1046ardb.h
index 40ce8ff462..bb27dd058a 100644
--- a/include/configs/ls1046ardb.h
+++ b/include/configs/ls1046ardb.h
@@ -209,11 +209,6 @@
 #endif
 #endif
 
-/* USB */
-#ifndef SPL_NO_USB
-#define CONFIG_USB_MAX_CONTROLLER_COUNT 3
-#endif
-
 /* SATA */
 #ifndef SPL_NO_SATA
 #define CONFIG_LIBATA
diff --git a/include/configs/ls2080aqds.h b/include/configs/ls2080aqds.h
index 5a5debbfc0..497930dd9a 100644
--- a/include/configs/ls2080aqds.h
+++ b/include/configs/ls2080aqds.h
@@ 

[U-Boot] [PATCH v3 1/5] arm64: layerscape: Move CONFIG_HAS_FSL_XHCI_USB to Kconfig

2017-10-10 Thread Ran Wang
Use Kconfig to select QE-HDLC and USB pin-mux.

Signed-off-by: Ran Wang 
---
Change in v3:
New patch file.

 arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 7 +++
 include/configs/ls1012afrdm.h | 4 
 include/configs/ls1012aqds.h  | 4 
 include/configs/ls1012ardb.h  | 4 
 include/configs/ls1021aiot.h  | 4 
 include/configs/ls1021aqds.h  | 4 
 include/configs/ls1021atwr.h  | 4 
 include/configs/ls1043aqds.h  | 3 ---
 include/configs/ls1043ardb.h  | 3 ---
 include/configs/ls1046aqds.h  | 3 ---
 include/configs/ls1046ardb.h  | 3 ---
 include/configs/ls2080aqds.h  | 1 -
 include/configs/ls2080ardb.h  | 1 -
 scripts/config_whitelist.txt  | 1 -
 14 files changed, 7 insertions(+), 39 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig 
b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
index 3518d8601d..9fda8a1e83 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
+++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig
@@ -489,3 +489,10 @@ config SYS_MC_RSV_MEM_ALIGN
 
 config SPL_LDSCRIPT
default "arch/arm/cpu/armv8/u-boot-spl.lds" if ARCH_LS1043A || 
ARCH_LS1046A || ARCH_LS2080A
+
+config HAS_FSL_XHCI_USB
+   bool
+   default y if ARCH_LS1043A || ARCH_LS1046A
+   help
+ For some SoC(such as LS1043A and LS1046A), USB and QE-HDLC multi-use
+ the pins, select it when pin assigned to USB.
diff --git a/include/configs/ls1012afrdm.h b/include/configs/ls1012afrdm.h
index 6b1ba578e9..2e5af9cc4e 100644
--- a/include/configs/ls1012afrdm.h
+++ b/include/configs/ls1012afrdm.h
@@ -34,12 +34,8 @@
 /*
 * USB
 */
-#define CONFIG_HAS_FSL_XHCI_USB
-
-#ifdef CONFIG_HAS_FSL_XHCI_USB
 #define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
-#endif
 
 #define CONFIG_CMD_MEMINFO
 #define CONFIG_CMD_MEMTEST
diff --git a/include/configs/ls1012aqds.h b/include/configs/ls1012aqds.h
index b3121d2c21..e0949d0b53 100644
--- a/include/configs/ls1012aqds.h
+++ b/include/configs/ls1012aqds.h
@@ -119,12 +119,8 @@
 #endif
 
 /*XHCI Support - enabled by default*/
-#define CONFIG_HAS_FSL_XHCI_USB
-
-#ifdef CONFIG_HAS_FSL_XHCI_USB
 #define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
-#endif
 
 /*  MMC  */
 #ifdef CONFIG_MMC
diff --git a/include/configs/ls1012ardb.h b/include/configs/ls1012ardb.h
index e9edcd2bc9..66ff004384 100644
--- a/include/configs/ls1012ardb.h
+++ b/include/configs/ls1012ardb.h
@@ -22,12 +22,8 @@
 /*
 * USB
 */
-#define CONFIG_HAS_FSL_XHCI_USB
-
-#ifdef CONFIG_HAS_FSL_XHCI_USB
 #define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
-#endif
 
 /*
  * I2C IO expander
diff --git a/include/configs/ls1021aiot.h b/include/configs/ls1021aiot.h
index 3fe7b8f44c..2cbea87d95 100644
--- a/include/configs/ls1021aiot.h
+++ b/include/configs/ls1021aiot.h
@@ -20,12 +20,8 @@
 #define CONFIG_SYS_INIT_RAM_SIZE   OCRAM_SIZE
 
 /* XHCI Support - enabled by default */
-#define CONFIG_HAS_FSL_XHCI_USB
-
-#ifdef CONFIG_HAS_FSL_XHCI_USB
 #define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT1
-#endif
 
 #define CONFIG_SYS_CLK_FREQ1
 #define CONFIG_DDR_CLK_FREQ1
diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h
index f3d3aa2271..0046ded536 100644
--- a/include/configs/ls1021aqds.h
+++ b/include/configs/ls1021aqds.h
@@ -405,12 +405,8 @@ unsigned long get_board_ddr_clk(void);
 #endif
 
 /*XHCI Support - enabled by default*/
-#define CONFIG_HAS_FSL_XHCI_USB
-
-#ifdef CONFIG_HAS_FSL_XHCI_USB
 #define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT1
-#endif
 
 /*
  * Video
diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h
index 852ff57fb6..0172c9015d 100644
--- a/include/configs/ls1021atwr.h
+++ b/include/configs/ls1021atwr.h
@@ -45,12 +45,8 @@
 #endif
 
 /* XHCI Support - enabled by default */
-#define CONFIG_HAS_FSL_XHCI_USB
-
-#ifdef CONFIG_HAS_FSL_XHCI_USB
 #define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT1
-#endif
 
 #define CONFIG_SYS_CLK_FREQ1
 #define CONFIG_DDR_CLK_FREQ1
diff --git a/include/configs/ls1043aqds.h b/include/configs/ls1043aqds.h
index 5aadd92efd..607c289d17 100644
--- a/include/configs/ls1043aqds.h
+++ b/include/configs/ls1043aqds.h
@@ -371,11 +371,8 @@ unsigned long get_board_ddr_clk(void);
 #endif
 
 /* USB */
-#define CONFIG_HAS_FSL_XHCI_USB
-#ifdef CONFIG_HAS_FSL_XHCI_USB
 #define CONFIG_USB_XHCI_FSL
 #define CONFIG_USB_MAX_CONTROLLER_COUNT3
-#endif
 
 /*
  * Miscellaneous configurable options
diff --git a/include/configs/ls1043ardb.h b/include/configs/ls1043ardb.h
index ca1d862479..866817d579 100644
--- a/include/configs/ls1043ardb.h
+++ b/include/configs/ls1043ardb.h
@@ -281,12 

Re: [U-Boot] [PATCH 2/2] mx6slevk: Remove some DM drivers

2017-10-10 Thread Fabio Estevam
Hi Peng,

On Tue, Oct 10, 2017 at 9:50 PM, Peng Fan  wrote:

> When adding DM support, I have tested on my board. What issue do you see?

SD card is not detected, so I cannot load the zImage with mainline U-Boot.

Please test it using the latest U-Boot mainline.

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


[U-Boot] [PATCH][v4] driver: fsl-mc: use calloc instead malloc

2017-10-10 Thread Prabhakar Kushwaha
Memory allocated via malloc is not guaranteed to be zeroized.

So explicitly use calloc instead of malloc.

Signed-off-by: Prabhakar Kushwaha 
---
Changes for v2: Replaced malloc/memset with calloc
Changes for v3: Updated patch description
Changes for v4: Updated patch subject

 drivers/net/fsl-mc/mc.c | 39 +--
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index 458c458..05d3358 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -725,9 +725,9 @@ int mc_init(u64 mc_fw_addr, u64 mc_dpc_addr)
 * Initialize the global default MC portal
 * And check that the MC firmware is responding portal commands:
 */
-   root_mc_io = (struct fsl_mc_io *)malloc(sizeof(struct fsl_mc_io));
+   root_mc_io = (struct fsl_mc_io *)calloc(sizeof(struct fsl_mc_io), 1);
if (!root_mc_io) {
-   printf(" No memory: malloc() failed\n");
+   printf(" No memory: calloc() failed\n");
return -ENOMEM;
}
 
@@ -877,11 +877,12 @@ static int dpio_init(void)
struct dpio_cfg dpio_cfg;
int err = 0;
 
-   dflt_dpio = (struct fsl_dpio_obj *)malloc(sizeof(struct fsl_dpio_obj));
+   dflt_dpio = (struct fsl_dpio_obj *)calloc(
+   sizeof(struct fsl_dpio_obj), 1);
if (!dflt_dpio) {
-   printf("No memory: malloc() failed\n");
+   printf("No memory: calloc() failed\n");
err = -ENOMEM;
-   goto err_malloc;
+   goto err_calloc;
}
 
dpio_cfg.channel_mode = DPIO_LOCAL_CHANNEL;
@@ -946,7 +947,7 @@ err_get_attr:
dpio_destroy(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpio->dpio_handle);
 err_create:
free(dflt_dpio);
-err_malloc:
+err_calloc:
return err;
 }
 
@@ -1028,11 +1029,11 @@ static int dprc_init(void)
goto err_create;
}
 
-   dflt_mc_io = (struct fsl_mc_io *)malloc(sizeof(struct fsl_mc_io));
+   dflt_mc_io = (struct fsl_mc_io *)calloc(sizeof(struct fsl_mc_io), 1);
if (!dflt_mc_io) {
err  = -ENOMEM;
-   printf(" No memory: malloc() failed\n");
-   goto err_malloc;
+   printf(" No memory: calloc() failed\n");
+   goto err_calloc;
}
 
child_portal_id = MC_PORTAL_OFFSET_TO_PORTAL_ID(mc_portal_offset);
@@ -1057,7 +1058,7 @@ static int dprc_init(void)
return 0;
 err_child_open:
free(dflt_mc_io);
-err_malloc:
+err_calloc:
dprc_destroy_container(root_mc_io, MC_CMD_NO_FLAGS,
   root_dprc_handle, child_dprc_id);
 err_create:
@@ -1108,11 +1109,12 @@ static int dpbp_init(void)
struct dpbp_attr dpbp_attr;
struct dpbp_cfg dpbp_cfg;
 
-   dflt_dpbp = (struct fsl_dpbp_obj *)malloc(sizeof(struct fsl_dpbp_obj));
+   dflt_dpbp = (struct fsl_dpbp_obj *)calloc(
+   sizeof(struct fsl_dpbp_obj), 1);
if (!dflt_dpbp) {
-   printf("No memory: malloc() failed\n");
+   printf("No memory: calloc() failed\n");
err = -ENOMEM;
-   goto err_malloc;
+   goto err_calloc;
}
 
dpbp_cfg.options = 512;
@@ -1162,7 +1164,7 @@ err_get_attr:
dpbp_close(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
dpbp_destroy(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpbp->dpbp_handle);
 err_create:
-err_malloc:
+err_calloc:
return err;
 }
 
@@ -1204,11 +1206,12 @@ static int dpni_init(void)
struct dpni_extended_cfg dpni_extended_cfg;
struct dpni_cfg dpni_cfg;
 
-   dflt_dpni = (struct fsl_dpni_obj *)malloc(sizeof(struct fsl_dpni_obj));
+   dflt_dpni = (struct fsl_dpni_obj *)calloc(
+   sizeof(struct fsl_dpni_obj), 1);
if (!dflt_dpni) {
-   printf("No memory: malloc() failed\n");
+   printf("No memory: calloc() failed\n");
err = -ENOMEM;
-   goto err_malloc;
+   goto err_calloc;
}
 
memset(_extended_cfg, 0, sizeof(dpni_extended_cfg));
@@ -1270,7 +1273,7 @@ err_get_attr:
 err_create:
 err_prepare_extended_cfg:
free(dflt_dpni);
-err_malloc:
+err_calloc:
return err;
 }
 
-- 
2.7.4

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


Re: [U-Boot] [XHCI] Maintainer split

2017-10-10 Thread Bin Meng
On Wed, Oct 11, 2017 at 5:04 AM, Tom Rini  wrote:
> On Tue, Oct 10, 2017 at 11:27:39AM +0200, Marek Vasut wrote:
>
>> Hi,
>>
>> I am considering offloading xhci maintainership to Bin .
>> Thoughts ?
>
> If Bin wants it, I have no objections.
>

Thanks for the offer. Glad I can help!

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


Re: [U-Boot] [PATCH 2/2] mx6slevk: Remove some DM drivers

2017-10-10 Thread Peng Fan

Hi Fabio,

> -Original Message-
> From: Fabio Estevam [mailto:fabio.este...@nxp.com]
> Sent: Wednesday, October 11, 2017 12:44 AM
> To: sba...@denx.de
> Cc: Peng Fan ; u-boot@lists.denx.de; Fabio Estevam
> 
> Subject: [PATCH 2/2] mx6slevk: Remove some DM drivers
> 
> While having DM driver is a good thing, currently this defconfig is completely
> broken in a way that SD cards can not even be detected.
> 
> Remove some of the DM drivers to avoid the regression for now and allow
> booting a kernel stored in the SD card again.
> 
> Re-adding the DM drivers can be revisited later.

When adding DM support, I have tested on my board. What issue do you see?

Thanks,
Peng.

> 
> Signed-off-by: Fabio Estevam 
> ---
> Applied on top of:
> 
> https://patchwork.ozlabs.org/patch/820477/
> 
> and
> 
> https://patchwork.ozlabs.org/patch/820298/
> 
>  configs/mx6slevk_defconfig | 11 +--
>  1 file changed, 1 insertion(+), 10 deletions(-)
> 
> diff --git a/configs/mx6slevk_defconfig b/configs/mx6slevk_defconfig index
> c876c6b..51735ec 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/imx
> image.cfg,MX6SL"
> +CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/freescale/mx6slevk/im
> ximage.cfg,MX6SL,SYS_I2C"
>  CONFIG_BOOTDELAY=3
>  CONFIG_BOARD_EARLY_INIT_F=y
>  CONFIG_HUSH_PARSER=y
> @@ -29,21 +29,12 @@ CONFIG_OF_CONTROL=y
>  CONFIG_ENV_IS_IN_MMC=y
>  CONFIG_DM=y
>  # CONFIG_BLK is not set
> -CONFIG_DM_GPIO=y
> -CONFIG_DM_I2C=y
> -CONFIG_DM_MMC=y
>  CONFIG_CMD_PART=y
>  CONFIG_SPI_FLASH=y
>  CONFIG_SPI_FLASH_STMICRO=y
>  CONFIG_PHYLIB=y
>  CONFIG_PINCTRL=y
>  CONFIG_PINCTRL_IMX6=y
> -CONFIG_DM_PMIC=y
> -CONFIG_DM_PMIC_PFUZE100=y
> -CONFIG_DM_REGULATOR=y
> -CONFIG_DM_REGULATOR_PFUZE100=y
> -CONFIG_DM_REGULATOR_FIXED=y
> -CONFIG_DM_REGULATOR_GPIO=y
>  CONFIG_DM_THERMAL=y
>  CONFIG_USB=y
>  CONFIG_USB_STORAGE=y
> --
> 2.7.4

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


Re: [U-Boot] [PATCH 00/11] efi_loader: patches for Shell.efi

2017-10-10 Thread Heinrich Schuchardt



On 10/10/2017 02:22 PM, Rob Clark wrote:

Re-send of the patch series to get Shell.efi working, and almost get
SCT.efi (the UEFI test suite) working.

Since last time, I've updated to Heinrich's latest SetWatchdogTimer
patch (as of yesterday evening), and adressed review comments on the
three new sets of protocols added.  Part of that, to avoid moving
changes from my later patch that added implementation on top of Leif's
initial stubs was done by simply squashing the patches together.


Heinrich Schuchardt (1):
   efi_loader: implement SetWatchdogTimer

Leif Lindholm (3):
   efi_loader: Initial EFI_DEVICE_PATH_UTILITIES_PROTOCOL
   efi_loader: Initial HII protocols
   efi_loader: Initial EFI_UNICODE_COLLATION_PROTOCOL

Rob Clark (7):
   efi_loader: SIMPLE_TEXT_INPUT_EX plus wire up objects properly
   efi_loader: console support for color attributes
   efi_loader: Decouple EFI input/output from stdin/stdout
   efi_loader: fix events
   efi_loader: Fix disk dp's for pre-DM/legacy devices
   efi_loader: Add mem-mapped for fallback
   efi_loader: exclude openrd devices

  cmd/bootefi.c  |  24 ++
  include/efi_api.h  | 438 -
  include/efi_loader.h   |  29 +-
  lib/efi_loader/Kconfig |   2 +-
  lib/efi_loader/Makefile|   3 +-
  lib/efi_loader/efi_boottime.c  | 256 ---
  lib/efi_loader/efi_console.c   | 398 +++---
  lib/efi_loader/efi_device_path.c   |  24 ++
  lib/efi_loader/efi_device_path_to_text.c   |   9 +
  lib/efi_loader/efi_device_path_utilities.c |  88 +
  lib/efi_loader/efi_disk.c  |  11 +
  lib/efi_loader/efi_hii.c   | 507 +
  lib/efi_loader/efi_unicode.c   | 170 ++
  lib/efi_loader/efi_watchdog.c  |  86 +
  14 files changed, 1861 insertions(+), 184 deletions(-)
  create mode 100644 lib/efi_loader/efi_device_path_utilities.c
  create mode 100644 lib/efi_loader/efi_hii.c
  create mode 100644 lib/efi_loader/efi_unicode.c
  create mode 100644 lib/efi_loader/efi_watchdog.c




Overall the patch series looks in good shape.

One comment I thought could be helpful in
[PATCH 05/11] efi_loader: console support for color attributes

Some minor checkpatch.pl warnings.

One git am problem (may be a missing space) I had.

I hope we can get this merged now.

Thanks to Rob for driving this.

Regards

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


Re: [U-Boot] [PATCH 2/2] configs: Re-sync CONFIG_CMD_IMLS with moveconfig

2017-10-10 Thread Tom Rini
On Sun, Oct 08, 2017 at 09:48:02PM +0300, Tuomas Tynkkynen wrote:

> The option is specified in Kconfig, but still a few config header files
> are overriding the choice by #undef'ing it. Re-sync the option with
> moveconfig to rid of the #undefs.
> 
> Signed-off-by: Tuomas Tynkkynen 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 1/2] cmd: Toggle the default value of CONFIG_CMD_IMLS

2017-10-10 Thread Tom Rini
On Sun, Oct 08, 2017 at 09:48:01PM +0300, Tuomas Tynkkynen wrote:

> Having this as a 'default y' is rather annoying because it doesn't
> actually compile unless other options are defined in the board header:
> 
> ../cmd/bootm.c: In function 'do_imls_nor':
> ../cmd/bootm.c:330:7: error: 'CONFIG_SYS_MAX_FLASH_BANKS' undeclared (first 
> use in this function); did you mean 'CONFIG_SYS_MAX_FLASH_SECT'?
>i < CONFIG_SYS_MAX_FLASH_BANKS; ++i, ++info) {
> 
> Make it 'default n' so people who develop new boards that start from a
> blank defconfig have one less compilation failure to debug.
> 
> Signed-off-by: Tuomas Tynkkynen 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 01/11] efi_loader: Initial EFI_DEVICE_PATH_UTILITIES_PROTOCOL

2017-10-10 Thread Heinrich Schuchardt



On 10/10/2017 02:22 PM, Rob Clark wrote:

From: Leif Lindholm 

Not complete, but enough for Shell.efi and SCT.efi.  We'll implement the
rest as needed or once we have SCT running properly so there is a way to
validate the interface against the conformance test suite.

Initial skeleton written by Leif, and then implementation by myself.

Cc: Leif Lindholm 
Signed-off-by: Rob Clark 
---
  include/efi_api.h  | 34 +++-
  include/efi_loader.h   |  2 +
  lib/efi_loader/Makefile|  1 +
  lib/efi_loader/efi_boottime.c  |  4 ++
  lib/efi_loader/efi_device_path_utilities.c | 88 ++
  5 files changed, 127 insertions(+), 2 deletions(-)
  create mode 100644 lib/efi_loader/efi_device_path_utilities.c

diff --git a/include/efi_api.h b/include/efi_api.h
index a9a6494afe..ffdba7fe1a 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -28,8 +28,9 @@ enum efi_timer_delay {
EFI_TIMER_RELATIVE = 2
  };
  
-#define UINTN size_t

-typedef long INTN;
+#define UINTN size_t   /* TODO this should be removed in a future patch */
+typedef size_t efi_uintn_t;
+typedef ssize_t efi_intn_t;
  typedef uint16_t *efi_string_t;
  
  #define EVT_TIMER0x8000

@@ -506,6 +507,35 @@ struct efi_device_path_to_text_protocol
bool allow_shortcuts);
  };
  
+#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \

+   EFI_GUID(0x0379be4e, 0xd706, 0x437d, \
+0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4)
+
+struct efi_device_path_utilities_protocol {
+   efi_uintn_t (EFIAPI *get_device_path_size)(
+   const struct efi_device_path *device_path);
+   struct efi_device_path *(EFIAPI *duplicate_device_path)(
+   const struct efi_device_path *device_path);
+   struct efi_device_path *(EFIAPI *append_device_path)(
+   const struct efi_device_path *src1,
+   const struct efi_device_path *src2);
+   struct efi_device_path *(EFIAPI *append_device_node)(
+   const struct efi_device_path *device_path,
+   const struct efi_device_path *device_node);
+   struct efi_device_path *(EFIAPI *append_device_path_instance)(
+   const struct efi_device_path *device_path,
+   const struct efi_device_path *device_path_instance);
+   struct efi_device_path *(EFIAPI *get_next_device_path_instance)(
+   struct efi_device_path **device_path_instance,
+   efi_uintn_t *device_path_instance_size);
+   bool (EFIAPI *is_device_path_multi_instance)(
+   const struct efi_device_path *device_path);
+   struct efi_device_path *(EFIAPI *create_device_node)(
+   uint8_t node_type,
+   uint8_t node_sub_type,
+   uint16_t node_length);
+};
+
  #define EFI_GOP_GUID \
EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \
 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a)
diff --git a/include/efi_loader.h b/include/efi_loader.h
index e1179b7dcd..5d37c1d75f 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -79,6 +79,7 @@ extern const struct efi_simple_text_output_protocol 
efi_con_out;
  extern struct efi_simple_input_interface efi_con_in;
  extern const struct efi_console_control_protocol efi_console_control;
  extern const struct efi_device_path_to_text_protocol efi_device_path_to_text;
+extern const struct efi_device_path_utilities_protocol 
efi_device_path_utilities;


WARNING: line over 80 characters
#95: FILE: include/efi_loader.h:82:

Please, always run scripts/checkpatch.pl before submitting.

  
  uint16_t *efi_dp_str(struct efi_device_path *dp);
  
@@ -89,6 +90,7 @@ extern const efi_guid_t efi_guid_loaded_image;

  extern const efi_guid_t efi_guid_device_path_to_text_protocol;
  extern const efi_guid_t efi_simple_file_system_protocol_guid;
  extern const efi_guid_t efi_file_info_guid;
+extern const efi_guid_t efi_guid_device_path_utilities_protocol;
  
  extern unsigned int __efi_runtime_start, __efi_runtime_stop;

  extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index ddb978f650..b6927b3b84 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -17,6 +17,7 @@ endif
  obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
  obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
  obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o
+obj-y += efi_device_path_utilities.o
  obj-y += efi_file.o efi_variable.o efi_bootmgr.o
  obj-$(CONFIG_LCD) += efi_gop.o
  obj-$(CONFIG_DM_VIDEO) += efi_gop.o
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 976d5822f7..92c778fcca 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1153,6 +1153,10 @@ void 

[U-Boot] Please pull u-boot-sh/rmobile branch

2017-10-10 Thread Nobuhiro Iwamatsu
Hi, Tom.

The following changes since commit 37a7908137a8c904f43c83f3e6c269cd51bf6126:

  ARM: dts: rmobile: Update DTS to match Linux 4.13 (2017-09-12 23:01:51 +0200)

are available in the git repository at:

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

for you to fetch changes up to 17cf99a5bb904a6e7c8797db2632bbe65ae1cfb5:

  ARM: rmobile: dts: Add SDR104/HS200 to Salvator-X (2017-10-10 08:22:54 +0900)


Marek Vasut (29):
  ARM: rmobile: dts: Add EHCI USB nodes to r8a7796
  ARM: rmobile: Move HSUSB configuration to board on Salvator-X
  ARM: rmobile: Move HSUSB configuration to board on ULCB
  ARM: rmobile: Enable EHCI generic on Salvator-X
  ARM: rmobile: Enable EHCI generic on ULCB
  ARM: rmobile: dts: Add XHCI USB node to r8a7796
  ARM: rmobile: Move CONFIG_CMD_ from rcar-gen3-common to configs
  ARM: rmobile: Place initial stack right below U-Boot
  clk: rmobile: Add support for setting SDxCKCR
  clk: rmobile: Add RPC hyperflash clock
  net: ravb: Add PHY reset GPIO support
  serial: sh: Enable clock if available
  ARM: dts: rmobile: Add PHY reset GPIO
  ARM: rmobile: Remove SD clock configuration from board files
  ARM: rmobile: Remove AVB clock configuration from board files
  ARM: rmobile: Remove SCIF clock configuration from board files
  ARM: rmobile: Enable GPIO command
  ARM: rmobile: Switch to UniPhier SD driver on Gen3
  ARM: rmobile: Enable DM regulator support
  pinctrl: rmobile: Add Renesas RCar pincontrol driver
  gpio: rmobile: Add Renesas RCar GPIO driver
  ARM: rmobile: Switch to DM PFC pinmux and GPIO driver
  ARM: rmobile: Zap ad-hoc PFC and GPIO setup in board files
  usb: Drop the EHCI RCar Gen3
  pinctrl: rmobile: Add pinconf to Renesas RCar pincontrol driver
  ARM: rmobile: Enable pinconf
  doc: rmobile: Update README
  ARM: rmobile: Fixup ULCB CPLD support after PFC rework
  ARM: rmobile: dts: Add SDR104/HS200 to Salvator-X

 arch/arm/dts/r8a7796.dtsi |   59 +-
 arch/arm/dts/salvator-common.dtsi |   10 +
 arch/arm/dts/ulcb.dtsi|1 +
 board/renesas/salvator-x/salvator-x.c |  152 +---
 board/renesas/ulcb/cpld.c |8 +-
 board/renesas/ulcb/ulcb.c |  114 +--
 configs/r8a7795_salvator-x_defconfig  |   16 +-
 configs/r8a7795_ulcb_defconfig|   17 +-
 configs/r8a7796_salvator-x_defconfig  |   16 +-
 configs/r8a7796_ulcb_defconfig|   17 +-
 doc/README.rmobile|   41 +-
 drivers/clk/renesas/clk-rcar-gen3.c   |   78 +-
 drivers/gpio/Kconfig  |6 +
 drivers/gpio/Makefile |1 +
 drivers/gpio/gpio-rcar.c  |  169 +
 drivers/net/ravb.c|   13 +
 drivers/pinctrl/Kconfig   |1 +
 drivers/pinctrl/Makefile  |1 +
 drivers/pinctrl/renesas/Kconfig   |   31 +
 drivers/pinctrl/renesas/Makefile  |3 +
 drivers/pinctrl/renesas/pfc-r8a7795.c | 4898
++
 drivers/pinctrl/renesas/pfc-r8a7796.c | 5728
+++
 drivers/pinctrl/renesas/pfc.c |  752 +++
 drivers/pinctrl/renesas/sh_pfc.h  |  575 +++
 drivers/serial/serial_sh.c|9 +-
 drivers/usb/host/Kconfig  |8 -
 drivers/usb/host/Makefile |1 -
 drivers/usb/host/ehci-rcar_gen3.c |  106 ---
 include/configs/rcar-gen3-common.h|8 +-
 29 files changed, 12455 insertions(+), 384 deletions(-)
 create mode 100644 drivers/gpio/gpio-rcar.c
 create mode 100644 drivers/pinctrl/renesas/Kconfig
 create mode 100644 drivers/pinctrl/renesas/Makefile
 create mode 100644 drivers/pinctrl/renesas/pfc-r8a7795.c
 create mode 100644 drivers/pinctrl/renesas/pfc-r8a7796.c
 create mode 100644 drivers/pinctrl/renesas/pfc.c
 create mode 100644 drivers/pinctrl/renesas/sh_pfc.h
 delete mode 100644 drivers/usb/host/ehci-rcar_gen3.c
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 05/11] efi_loader: console support for color attributes

2017-10-10 Thread Heinrich Schuchardt



On 10/10/2017 02:23 PM, Rob Clark wrote:

Shell.efi uses this, and supporting color attributes makes things look
nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.
Not all colors have a perfect match, but spec just says "Devices
supporting a different number of text colors are required to emulate the
above colors to the best of the device’s capabilities".

Signed-off-by: Rob Clark 
---
  include/efi_api.h| 33 +
  lib/efi_loader/efi_console.c | 27 +--
  2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 58bf15b8e6..9610d03d47 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -427,6 +427,39 @@ struct simple_text_output_mode {
EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \
 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
  
+#define EFI_BLACK0x00

+#define EFI_BLUE 0x01
+#define EFI_GREEN0x02
+#define EFI_CYAN 0x03
+#define EFI_RED  0x04
+#define EFI_MAGENTA  0x05
+#define EFI_BROWN0x06
+#define EFI_LIGHTGRAY0x07
+#define EFI_BRIGHT   0x08
+#define EFI_DARKGRAY 0x08
+#define EFI_LIGHTBLUE0x09
+#define EFI_LIGHTGREEN   0x0a
+#define EFI_LIGHTCYAN0x0b
+#define EFI_LIGHTRED 0x0c
+#define EFI_LIGHTMAGENTA 0x0d
+#define EFI_YELLOW   0x0e
+#define EFI_WHITE0x0f
+#define EFI_BACKGROUND_BLACK 0x00
+#define EFI_BACKGROUND_BLUE  0x10
+#define EFI_BACKGROUND_GREEN 0x20
+#define EFI_BACKGROUND_CYAN  0x30
+#define EFI_BACKGROUND_RED   0x40
+#define EFI_BACKGROUND_MAGENTA   0x50
+#define EFI_BACKGROUND_BROWN 0x60
+#define EFI_BACKGROUND_LIGHTGRAY 0x70
+
+/* extract foreground color from EFI attribute */
+#define EFI_ATTR_FG(attr)((attr) & 0x07)
+/* treat high bit of FG as bright/bold (similar to edk2) */
+#define EFI_ATTR_BOLD(attr)  (((attr) >> 3) & 0x01)
+/* extract background color from EFI attribute */
+#define EFI_ATTR_BG(attr)(((attr) >> 4) & 0x7)
+
  struct efi_simple_text_output_protocol {
void *reset;
efi_status_t (EFIAPI *output_string)(
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index f508b79ab8..c25d6b16f2 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -316,14 +316,37 @@ static efi_status_t EFIAPI efi_cout_set_mode(
return EFI_EXIT(EFI_SUCCESS);
  }
  
+static const struct {

+   unsigned fg;
+   unsigned bg;
+} color[] = {
+   { 30, 40 }, /* 0: black */
+   { 34, 44 }, /* 1: blue */
+   { 32, 42 }, /* 2: green */
+   { 36, 46 }, /* 3: cyan */
+   { 31, 41 }, /* 4: red */
+   { 35, 45 }, /* 5: magenta */
+   { 33, 43 }, /* 6: brown, map to yellow as edk2 does*/
+   { 37, 47 }, /* 7: light grey, map to white */
+};
+
+/* See EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute(). */
  static efi_status_t EFIAPI efi_cout_set_attribute(
struct efi_simple_text_output_protocol *this,
unsigned long attribute)
  {
+   unsigned int bold = EFI_ATTR_BOLD(attribute);
+   unsigned int fg = EFI_ATTR_FG(attribute);
+   unsigned int bg = EFI_ATTR_BG(attribute);
+
EFI_ENTRY("%p, %lx", this, attribute);
  
-	/* Just ignore attributes (colors) for now */

-   return EFI_EXIT(EFI_UNSUPPORTED);
+   if (attribute)
+   printf(ESC"[%u;%u;%um", bold, color[fg].fg, color[bg].bg);
+   else


Maybe Alex can just add a comment here when merging:

/* EFI console expects attribute = 0 to result in default colors. */


+   printf(ESC"[0;37;40m");
+
+   return EFI_EXIT(EFI_SUCCESS);
  }
  
  static efi_status_t EFIAPI efi_cout_clear_screen(




Works fine.

See appended screenshot.

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


Re: [U-Boot] [PATCH v2 08/14] arm: dts: Add dts for Stratix10 SoC

2017-10-10 Thread Dinh Nguyen
On Thu, Oct 5, 2017 at 8:07 AM,   wrote:
> From: Chin Liang See 
>
> Device tree for Stratix10 SoC
>
> Signed-off-by: Chin Liang See 
> ---
>  arch/arm/dts/Makefile|   3 +-
>  arch/arm/dts/socfpga_stratix10_socdk.dts | 180 
> +++
>  2 files changed, 182 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/dts/socfpga_stratix10_socdk.dts

Shouldn't you have a dtsi base file for the SOC, and then subsequent
boards would be the dts?

>
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 7c062f0..f66b9c9 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -171,7 +171,8 @@ dtb-$(CONFIG_ARCH_SOCFPGA) += 
>   \
> socfpga_cyclone5_sockit.dtb \
> socfpga_cyclone5_socrates.dtb   \
> socfpga_cyclone5_sr1500.dtb \
> -   socfpga_cyclone5_vining_fpga.dtb
> +   socfpga_cyclone5_vining_fpga.dtb\
> +   socfpga_stratix10_socdk.dtb
>
>  dtb-$(CONFIG_TARGET_DRA7XX_EVM) += dra72-evm.dtb dra7-evm.dtb  \
> dra72-evm-revc.dtb dra71-evm.dtb dra76-evm.dtb
> diff --git a/arch/arm/dts/socfpga_stratix10_socdk.dts 
> b/arch/arm/dts/socfpga_stratix10_socdk.dts
> new file mode 100644
> index 000..26b407f
> --- /dev/null
> +++ b/arch/arm/dts/socfpga_stratix10_socdk.dts
> @@ -0,0 +1,180 @@
> +/*
> + * Copyright (C) 2016-2017 Intel Corporation 
> + *
> + * SPDX-License-Identifier:GPL-2.0
> + */
> +
> +/dts-v1/;
> +#include "skeleton.dtsi"
> +#include 
> +
> +/ {
> +   model = "Intel SOCFPGA Stratix 10 SoC Development Kit";
> +   compatible = "altr,socfpga-stratix10", "altr,socfpga";
> +
> +   #address-cells = <1>;
> +   #size-cells = <1>;
> +
> +   chosen {
> +   bootargs = "console=ttyS0,115200";
> +   };
> +
> +   aliases {
> +   ethernet0 = 
> +   spi0 = 
> +   };
> +
> +   memory {
> +   name = "memory";
> +   device_type = "memory";
> +   reg = <0x0 0x8000>; /* 2GB */
> +   };
> +
> +   regulator_3_3v: 3-3-v-regulator {
> +   compatible = "regulator-fixed";
> +   regulator-name = "3.3V";
> +   regulator-min-microvolt = <330>;
> +   regulator-max-microvolt = <330>;
> +   };
> +
> +   cpus {
> +   #address-cells = <1>;
> +   #size-cells = <0>;
> +
> +   cpu@0 {
> +   compatible = "arm,cortex-a53", "arm,armv8";
> +   device_type = "cpu";
> +   enable-method = "psci";
> +   reg = <0x0>;
> +   };
> +
> +   cpu@1 {
> +   compatible = "arm,cortex-a53", "arm,armv8";
> +   device_type = "cpu";
> +   enable-method = "psci";
> +   reg = <0x1>;
> +   };
> +
> +   cpu@2 {
> +   compatible = "arm,cortex-a53", "arm,armv8";
> +   device_type = "cpu";
> +   enable-method = "psci";
> +   reg = <0x2>;
> +   };
> +
> +   cpu@3 {
> +   compatible = "arm,cortex-a53", "arm,armv8";
> +   device_type = "cpu";
> +   enable-method = "psci";
> +   reg = <0x3>;
> +   };
> +   };
> +
> +   soc {
> +   #address-cells = <1>;
> +   #size-cells = <1>;
> +   compatible = "simple-bus";
> +   device_type = "soc";
> +   ranges;
> +   u-boot,dm-pre-reloc;
> +
> +   rst: rstmgr@ffd11000 {
> +   #reset-cells = <1>;
> +   compatible = "altr,rst-mgr";
> +   reg = <0xffd11000 0x100>;
> +   altr,modrst-offset = <0x20>;
> +   };
> +
> +   mdio {
> +   phy0: ethernet-phy@0 {
> +   txd0-skew-ps = <0>; /* -420ps */
> +   txd1-skew-ps = <0>; /* -420ps */
> +   txd2-skew-ps = <0>; /* -420ps */
> +   txd3-skew-ps = <0>; /* -420ps */
> +   rxd0-skew-ps = <420>; /* 0ps */
> +   rxd1-skew-ps = <420>; /* 0ps */
> +   rxd2-skew-ps = <420>; /* 0ps */
> +   rxd3-skew-ps = <420>; /* 0ps */
> +   txen-skew-ps = <0>; /* -420ps */
> +   txc-skew-ps = <1860>; /* 960ps */
> +   rxdv-skew-ps = <420>; /* 0ps */
> +   rxc-skew-ps = 

Re: [U-Boot] [PATCH 11/11] efi_loader: exclude openrd devices

2017-10-10 Thread Rob Clark
On Tue, Oct 10, 2017 at 6:28 PM, Heinrich Schuchardt  wrote:
> On 10/10/2017 02:23 PM, Rob Clark wrote:
>>
>> These devices have small image size limits, so exclude EFI_LOADER to
>> help avoid exceeding limits.
>>
>> Signed-off-by: Rob Clark 
>> ---
>>   lib/efi_loader/Kconfig | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
>> index d2b6327119..6e22940da5 100644
>> --- a/lib/efi_loader/Kconfig
>> +++ b/lib/efi_loader/Kconfig
>> @@ -1,6 +1,6 @@
>>   config EFI_LOADER
>> bool "Support running EFI Applications in U-Boot"
>> -   depends on (ARM || X86) && OF_LIBFDT
>> +   depends on (ARM || X86) && OF_LIBFDT && !TARGET_OPENRD
>> default y
>> help
>>   Select this option if you want to run EFI applications (like
>> grub2)
>>
>
> I understand that with the progress we make on EFI implementation and other
> parts of U-Boot the U-Boot image size is growing too big for direct loading
> by the primary boot loader.
>
> The OPENRD boards have abundant memory, e.g. openrd_ultimate_defconfig
> refers to a board with 512 MB RAM.
>
> So I think completely disabling EFI is not the solution.
> Instead building an SPL should be enabled for this architecture when the
> image is becoming too big for direct load.
>
> I am copying in the KIRKWOOD maintainers go get their view.
>

I'm defn open to alternatives..  I don't know too much about what the
limit was on these boards, other than we were close to it before, and
the additional uefi proto's add <4k to the image size, which was
enough to push it over the limit.  Since this was effecting only a few
boards, I went with this.. if it is only a temporary fix that can be
removed soon, or if someone can do something better with a separate
SPL build in the near term, that would be great.

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


Re: [U-Boot] [PATCH 07/11] efi_loader: fix events

2017-10-10 Thread Heinrich Schuchardt

On 10/10/2017 02:23 PM, Rob Clark wrote:

An event can be created with type==0, Shell.efi does this for an event
that is set when Ctrl-C is typed.  So our current approach of having a
fixed set of timer slots, and determining which slots are unused by
type==0 doesn't work so well.  But we don't have any particularly good
reason to have a fixed table of events, so just dynamically allocate
them and keep a list.

Also fixes an incorrect implementation of CheckEvent() which was (a)
incorrectly returning an error if type==0, and (b) didn't handle the
case of an unsignaled event with a notify callback.

With these fixes (plus implementation of SIMPLE_TEXT_INPUT_EX protocol),
Ctrl-C works in Shell.efi.

Signed-off-by: Rob Clark 
---
  include/efi_loader.h  |   1 +
  lib/efi_loader/efi_boottime.c | 217 +-
  2 files changed, 111 insertions(+), 107 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index e6e55d2cb4..2232caca44 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -154,6 +154,7 @@ struct efi_event {
enum efi_timer_delay trigger_type;
bool is_queued;
bool is_signaled;
+   struct list_head link;
  };
  
  
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c

index 39dcc72648..19fafe546c 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -350,11 +350,26 @@ static efi_status_t efi_create_handle(void **handle)
return r;
  }
  
+static LIST_HEAD(efi_events);

+
  /*
- * Our event capabilities are very limited. Only a small limited
- * number of events is allowed to coexist.
+ * Check if a pointer is a valid event.
+ *
+ * It might be nice at some point to extend this to a more general
+ * mechanism to check if pointers passed from the EFI world are
+ * valid objects of a particular type.
   */
-static struct efi_event efi_events[16];
+static bool efi_is_event(const void *obj)
+{
+   struct efi_event *evt;
+
+   list_for_each_entry(evt, _events, link) {
+   if (evt == obj)
+   return true;
+   }
+
+   return false;
+}
  
  /*

   * Create an event.
@@ -377,7 +392,7 @@ efi_status_t efi_create_event(uint32_t type, UINTN 
notify_tpl,
void *context),
  void *notify_context, struct efi_event **event)
  {
-   int i;
+   struct efi_event *evt;
  
  	if (event == NULL)

return EFI_INVALID_PARAMETER;
@@ -389,21 +404,24 @@ efi_status_t efi_create_event(uint32_t type, UINTN 
notify_tpl,
notify_function == NULL)
return EFI_INVALID_PARAMETER;
  
-	for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {

-   if (efi_events[i].type)
-   continue;
-   efi_events[i].type = type;
-   efi_events[i].notify_tpl = notify_tpl;
-   efi_events[i].notify_function = notify_function;
-   efi_events[i].notify_context = notify_context;
-   /* Disable timers on bootup */
-   efi_events[i].trigger_next = -1ULL;
-   efi_events[i].is_queued = false;
-   efi_events[i].is_signaled = false;
-   *event = _events[i];
-   return EFI_SUCCESS;
-   }
-   return EFI_OUT_OF_RESOURCES;
+   evt = calloc(1, sizeof(*evt));
+   if (!evt)
+   return EFI_OUT_OF_RESOURCES;
+
+   evt->type = type;
+   evt->notify_tpl = notify_tpl;
+   evt->notify_function = notify_function;
+   evt->notify_context = notify_context;
+   /* Disable timers on bootup */
+   evt->trigger_next = -1ULL;
+   evt->is_queued = false;
+   evt->is_signaled = false;
+
+   list_add_tail(>link, _events);
+
+   *event = evt;
+
+   return EFI_SUCCESS;
  }
  
  /*

@@ -443,30 +461,31 @@ static efi_status_t EFIAPI efi_create_event_ext(
   */
  void efi_timer_check(void)
  {
-   int i;
+   struct efi_event *evt;
u64 now = timer_get_us();
  
-	for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {

-   if (!efi_events[i].type)
-   continue;
-   if (efi_events[i].is_queued)
-   efi_signal_event(_events[i]);
-   if (!(efi_events[i].type & EVT_TIMER) ||
-   now < efi_events[i].trigger_next)
+   /*
+* TODO perhaps optimize a bit and track the time of next
+* timer to expire?
+*/
+   list_for_each_entry(evt, _events, link) {
+   if (evt->is_queued)
+   efi_signal_event(evt);
+   if (!(evt->type & EVT_TIMER) ||
+   now < evt->trigger_next)
continue;
-   switch (efi_events[i].trigger_type) {
+   switch (evt->trigger_type) {
case EFI_TIMER_RELATIVE:
-   

Re: [U-Boot] [PATCH v2 06/14] arm: socfpga: stratix10: Add mailbox support for Stratix10 SoC

2017-10-10 Thread Dinh Nguyen
On Thu, Oct 5, 2017 at 8:07 AM,   wrote:
> From: Chin Liang See 
>
> Add mailbox support for Stratix SoC
>
> Signed-off-by: Ley Foon Tan 
> Signed-off-by: Chin Liang See 
> ---
>  arch/arm/mach-socfpga/Makefile   |   1 +
>  arch/arm/mach-socfpga/include/mach/mailbox_s10.h | 108 ++
>  arch/arm/mach-socfpga/mailbox_s10.c  | 238 
> +++
>  3 files changed, 347 insertions(+)
>  create mode 100644 arch/arm/mach-socfpga/include/mach/mailbox_s10.h
>  create mode 100644 arch/arm/mach-socfpga/mailbox_s10.c
>
> diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile
> index b253914..43e18d2 100644
> --- a/arch/arm/mach-socfpga/Makefile
> +++ b/arch/arm/mach-socfpga/Makefile
> @@ -32,6 +32,7 @@ endif
>
>  ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
>  obj-y  += clock_manager_s10.o
> +obj-y  += mailbox_s10.o
>  obj-y  += misc_s10.o
>  obj-y  += reset_manager_s10.o
>  obj-y  += system_manager_s10.o
> diff --git a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h 
> b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> new file mode 100644
> index 000..b9bddf6
> --- /dev/null
> +++ b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
> @@ -0,0 +1,108 @@
> +/*
> + * Copyright (C) 2017 Intel Corporation 
> + *
> + * SPDX-License-Identifier:GPL-2.0
> + */
> +#ifndef _MAILBOX_S10_H_
> +#define _MAILBOX_S10_H_
> +
> +/* user define Uboot ID */
> +#define MBOX_CLIENT_ID_UBOOT   0xB
> +#define MBOX_ID_UBOOT  0x1
> +
> +#define MBOX_MAX_CMD_INDEX 2047
> +#define MBOX_CMD_BUFFER_SIZE   32
> +#define MBOX_RESP_BUFFER_SIZE  16
> +
> +#define MBOX_HDR_CMD_LSB   0
> +#define MBOX_HDR_CMD_MSK   (BIT(11) - 1)
> +#define MBOX_HDR_I_LSB 11
> +#define MBOX_HDR_I_MSK BIT(11)
> +#define MBOX_HDR_LEN_LSB   12
> +#define MBOX_HDR_LEN_MSK   0x007FF000
> +#define MBOX_HDR_ID_LSB24
> +#define MBOX_HDR_ID_MSK0x0F00
> +#define MBOX_HDR_CLIENT_LSB28
> +#define MBOX_HDR_CLIENT_MSK0xF000
> +
> +/* Interrupt flags */
> +#define MBOX_FLAGS_INT_COE BIT(0)  /* COUT update interrupt enable */
> +#define MBOX_FLAGS_INT_RIE BIT(1)  /* RIN update interrupt enable */
> +#define MBOX_FLAGS_INT_UAE BIT(8)  /* Urgent ACK interrupt enable */
> +#define MBOX_ALL_INTRS (MBOX_FLAGS_INT_COE | \
> +MBOX_FLAGS_INT_RIE | \
> +MBOX_FLAGS_INT_UAE)
> +
> +/* Status */
> +#define MBOX_STATUS_UA_MSK BIT(8)
> +
> +#define MBOX_CMD_HEADER(client, id, len, cmd) \
> +   (((cmd) << MBOX_HDR_CMD_LSB) & MBOX_HDR_CMD_MSK) | \
> +   (((len) << MBOX_HDR_LEN_LSB) & MBOX_HDR_LEN_MSK) | \
> +   (((id) << MBOX_HDR_ID_LSB) & MBOX_HDR_ID_MSK)| \
> +   (((client) << MBOX_HDR_CLIENT_LSB) & MBOX_HDR_CLIENT_MSK)
> +
> +#define MBOX_RESP_ERR_GET(resp)\
> +   (((resp) & MBOX_HDR_CMD_MSK) >> MBOX_HDR_CMD_LSB)
> +#define MBOX_RESP_LEN_GET(resp)\
> +   (((resp) & MBOX_HDR_LEN_MSK) >> MBOX_HDR_LEN_LSB)
> +#define MBOX_RESP_ID_GET(resp) \
> +   (((resp) & MBOX_HDR_ID_MSK) >> MBOX_HDR_ID_LSB)
> +#define MBOX_RESP_CLIENT_GET(resp) \
> +   (((resp) & MBOX_HDR_CLIENT_MSK) >> MBOX_HDR_CLIENT_LSB)
> +
> +/* Response error list */
> +typedef enum {
> +   /* CMD completed succesfully, but check resp ARGS for any errors */
> +   MBOX_RESP_STATOK = 0,
> +   /* CMD is incorrectly formatted in some way */
> +   MBOX_RESP_INVALID_COMMAND = 1,
> +   /* BootROM Command code not undesrtood */
> +   MBOX_RESP_UNKNOWN_BR = 2,
> +   /* CMD code not recognized by firmware */
> +   MBOX_RESP_UNKNOWN = 3,
> +   /* Indicates that the device is not configured */
> +   MBOX_RESP_NOT_CONFIGURED = 256,
> +   /* Indicates that the device is busy */
> +   MBOX_RESP_DEVICE_BUSY = 0x1FF,
> +   /* Indicates that there is no valid response available */
> +   MBOX_RESP_NO_VALID_RESP_AVAILABLE = 0x2FF,
> +   /* General Error */
> +   MBOX_RESP_ERROR = 0x3FF,
> +} ALT_SDM_MBOX_RESP_CODE;
> +
> +/* Mailbox command list */
> +#define MBOX_RESTART   2
> +#define MBOX_QSPI_OPEN 50
> +#define MBOX_QSPI_CLOSE51
> +#define MBOX_QSPI_DIRECT   59

Only 3 commands?

> +
> +struct socfpga_mailbox {
> +   u32 cin;/* command valid offset */
> +   u32 rout;   /* response output offset */
> +   u32 urg;/* urgent command */
> +   u32 flags;  /* interrupt enables */
> +   u32 pad_0x10_0x1f[4];   /* 0x10 - 0x1F reserved */
> +   u32 cout;   /* command free offset */
> +   u32 rin;/* respond valid offset */
> +   u32 pad_0x28;   /* 0x28 

Re: [U-Boot] [PATCH 10/11] efi_loader: Add mem-mapped for fallback

2017-10-10 Thread Heinrich Schuchardt



On 10/10/2017 02:23 PM, Rob Clark wrote:

When we don't have a real device/image path, such as 'bootefi hello',
construct a mem-mapped device-path.

This fixes 'bootefi hello' after devicepath refactoring.

Fixes: 95c5553ea2 ("efi_loader: refactor boot device and loaded_image handling")
Signed-off-by: Rob Clark 
---
  cmd/bootefi.c| 23 +++
  include/efi_api.h|  8 
  include/efi_loader.h |  3 +++
  lib/efi_loader/efi_device_path.c | 24 
  lib/efi_loader/efi_device_path_to_text.c |  9 +
  5 files changed, 67 insertions(+)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 24958ada46..18176a1266 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -128,6 +128,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt,
  {
struct efi_loaded_image loaded_image_info = {};
struct efi_object loaded_image_info_obj = {};
+   struct efi_device_path *memdp = NULL;
ulong ret;
  
  	ulong (*entry)(void *image_handle, struct efi_system_table *st)

@@ -136,6 +137,20 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt,
const efi_guid_t fdt_guid = EFI_FDT_GUID;
bootm_headers_t img = { 0 };
  
+	/*

+* Special case for efi payload not loaded from disk, such as
+* 'bootefi hello' or for example payload loaded directly into
+* memory via jtag/etc:
+*/
+   if (!device_path && !image_path) {
+   printf("WARNING: using memory device/image path, this may confuse 
some payloads!\n");
+   /* actual addresses filled in after efi_load_pe() */
+   memdp = efi_dp_from_mem(0, 0, 0);
+   device_path = image_path = memdp;
+   } else {
+   assert(device_path && image_path);
+   }
+
/* Initialize and populate EFI object list */
if (!efi_obj_list_initalized)
efi_init_obj_list();
@@ -182,6 +197,14 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt,
goto exit;
}
  
+	if (memdp) {

+   struct efi_device_path_memory *mdp = (void *)memdp;
+   mdp->memory_type = loaded_image_info.image_code_type;
+   mdp->start_address = (uintptr_t)loaded_image_info.image_base;
+   mdp->end_address = mdp->start_address +
+   loaded_image_info.image_size;
+   }
+
/* we don't support much: */

env_set("efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported",
"{ro,boot}(blob)");
diff --git a/include/efi_api.h b/include/efi_api.h
index 9610d03d47..07b2af7020 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -299,8 +299,16 @@ struct efi_mac_addr {
  } __packed;
  
  #define DEVICE_PATH_TYPE_HARDWARE_DEVICE	0x01

+#  define DEVICE_PATH_SUB_TYPE_MEMORY  0x03
  #  define DEVICE_PATH_SUB_TYPE_VENDOR 0x04
  
+struct efi_device_path_memory {

+   struct efi_device_path dp;
+   u32 memory_type;
+   u64 start_address;
+   u64 end_address;
+} __packed;
+
  struct efi_device_path_vendor {
struct efi_device_path dp;
efi_guid_t guid;
diff --git a/include/efi_loader.h b/include/efi_loader.h
index fa4e1cdb1c..db805e898f 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -269,6 +269,9 @@ struct efi_device_path *efi_dp_from_part(struct blk_desc 
*desc, int part);
  struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
 const char *path);
  struct efi_device_path *efi_dp_from_eth(void);
+struct efi_device_path *efi_dp_from_mem(uint32_t mem_type,
+   uint64_t start_address,
+   uint64_t end_address);
  void efi_dp_split_file_path(struct efi_device_path *full_path,
struct efi_device_path **device_path,
struct efi_device_path **file_path);
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 5d5c3b3464..f6e368e029 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -538,6 +538,30 @@ struct efi_device_path *efi_dp_from_eth(void)
  }
  #endif
  
+/* Construct a device-path for memory-mapped image */

+struct efi_device_path *efi_dp_from_mem(uint32_t memory_type,
+   uint64_t start_address,
+   uint64_t end_address)
+{
+   struct efi_device_path_memory *mdp;
+   void *buf, *start;
+
+   start = buf = dp_alloc(sizeof(*mdp) + sizeof(END));
+
+   mdp = buf;
+   mdp->dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE;
+   mdp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MEMORY;
+   mdp->dp.length = sizeof(*mdp);
+   mdp->memory_type = memory_type;
+   mdp->start_address = 

Re: [U-Boot] [PATCH 11/11] efi_loader: exclude openrd devices

2017-10-10 Thread Heinrich Schuchardt

On 10/10/2017 02:23 PM, Rob Clark wrote:

These devices have small image size limits, so exclude EFI_LOADER to
help avoid exceeding limits.

Signed-off-by: Rob Clark 
---
  lib/efi_loader/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index d2b6327119..6e22940da5 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -1,6 +1,6 @@
  config EFI_LOADER
bool "Support running EFI Applications in U-Boot"
-   depends on (ARM || X86) && OF_LIBFDT
+   depends on (ARM || X86) && OF_LIBFDT && !TARGET_OPENRD
default y
help
  Select this option if you want to run EFI applications (like grub2)



I understand that with the progress we make on EFI implementation and 
other parts of U-Boot the U-Boot image size is growing too big for 
direct loading by the primary boot loader.


The OPENRD boards have abundant memory, e.g. openrd_ultimate_defconfig 
refers to a board with 512 MB RAM.


So I think completely disabling EFI is not the solution.
Instead building an SPL should be enabled for this architecture when the 
image is becoming too big for direct load.


I am copying in the KIRKWOOD maintainers go get their view.

Best regards

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


Re: [U-Boot] Please pull u-boot-dm (take 2)

2017-10-10 Thread Tom Rini
On Mon, Oct 09, 2017 at 05:30:17PM -0600, Simon Glass wrote:

> Hi Tom,
> 
> Sorry for the delay with v2.
> 
> 
> The following changes since commit 0d3aaa35b87573c229d65bc79050ab13f39d8ec2:
> 
>   Travis-CI: Fix microblaze and xilinx jobs (2017-10-07 15:54:18 -0400)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-dm.git
> 
> for you to fetch changes up to 04d0da51578e12bd7c490aa70ed581ee5f9dcfea:
> 
>   sandbox: avoid memory leak in os_dirent_ls (2017-10-08 20:41:09 -0600)
> 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 05/14] arm: socfpga: stratix10: Add misc support for Stratix10 SoC

2017-10-10 Thread Dinh Nguyen
On Thu, Oct 5, 2017 at 8:07 AM,   wrote:
> From: Chin Liang See 
>
> Add misc support such as EMAC and cpu info printout for Stratix SoC
>
> Signed-off-by: Chin Liang See 
> ---
>  arch/arm/mach-socfpga/Makefile|   1 +
>  arch/arm/mach-socfpga/include/mach/misc.h |   1 +
>  arch/arm/mach-socfpga/misc.c  |  76 
>  arch/arm/mach-socfpga/misc_gen5.c |  75 ++-
>  arch/arm/mach-socfpga/misc_s10.c  | 115 
> ++
>  5 files changed, 197 insertions(+), 71 deletions(-)
>  create mode 100644 arch/arm/mach-socfpga/misc_s10.c
>

I can see a few ways this patch can get split up to more
manageable pieces. The bridge enablement  can be separated.
The wrap of CONFIG_SYS_L2_PL310 can be separate. The
split of the emac reset can be separate. This would allow for
easier review.

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


Re: [U-Boot] [XHCI] Maintainer split

2017-10-10 Thread Tom Rini
On Tue, Oct 10, 2017 at 11:27:39AM +0200, Marek Vasut wrote:

> Hi,
> 
> I am considering offloading xhci maintainership to Bin .
> Thoughts ?

If Bin wants it, I have no objections.

-- 
Tom


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


[U-Boot] [PATCH] Enable HDMI on i.MX6 without VPU

2017-10-10 Thread Nikolay Petukhov
Hi, all

This patch enables HDMI on CPU without VPU.
A similar patch for the mainline kernel:
https://patchwork.kernel.org/patch/9874831/
Tested on MCIMX6Q4AVT10AD.


Signed-off-by: Nikolay Petukhov 
Cc: Stefano Babic sba...@denx.de
---
 arch/arm/mach-imx/mx6/soc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
index b724668..8b976f7 100644
--- a/arch/arm/mach-imx/mx6/soc.c
+++ b/arch/arm/mach-imx/mx6/soc.c
@@ -655,6 +655,11 @@ void imx_setup_hdmi(void)
 int reg, count;
 u8 val;

+/* Turn on MIPI core cfg clock */
+reg = readl(_ccm->CCGR3);
+reg |= MXC_CCM_CCGR3_MIPI_CORE_CFG_MASK;
+writel(reg, _ccm->CCGR3);
+
 /* Turn on HDMI PHY clock */
 reg = readl(_ccm->CCGR2);
 reg |=  MXC_CCM_CCGR2_HDMI_TX_IAHBCLK_MASK|
-- 
2.7.4



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


[U-Boot] [PATCH v5 00/18] rockchip: back-to-bootrom: replace assembly-implementation with C-code

2017-10-10 Thread Philipp Tomsich

Recent discussions confirmed (what the code always assumed): the
Rockchip BROM always enters U-Boot with the stack-pointer valid
(i.e. the U-Boot startup code is running off the BROM stack).

We can thus replace the back-to-bootrom code (i.e. both the
save_boot_params and back_to_bootrom implementations) using C-code
based on setjmp/longjmp.  The new implementation is already structured
to allow an easy drop-in of Andy's changes to enter download-mode when
returning to the BROM.

This turned out to require a some tweaking to system.h (making sure
that the prototype for save_boot_params_ret is visible for A64)and
start.S (so binutils knows that this is a possible function entry and
it can correctly insert A32-to-Thumb transitions) and taking the axe
to setjmp.h (which created quite a few issues with it not expecting
A32/T32/Thumb call-sites and some fragility from GCC being smart about
the clobber-list of the inline assembly... which led to r9 not being
saved or restored).

For v4+: To fix issues with the RK3188 support, this also updates the
boot0 hook changes (i.e. allowing the boot0-hook to insert code/data
before the ARM vector table) that Kever had submitted this spring and
implements a similar "early back-to-bootrom" as suggested by Pawel
(for the RK3066) as a generic mechanism.


Changes in v5:
- set return value to 0 before returning to the BROM

Changes in v4:
- after merging the 'back-to-bootrom' series with the 'boot0-hook'
  series, this drops the TPL stub and builds only a single SPL image
  that uses the 'early back-to-bootrom' logic originally implemented
  by Pawel for the RK3066.
- changes the SPL_STACK_BASE to +0x800 (from +0x804), as the boot0
  hook already reserves the space for the SPL magic (previously
  inserted by mkimage)
- no longer updates rk3188-board-tpl.c (as we have just removed it
  in an earlier commit)

Changes in v3:
- tracked the root-cause why no interwork branch was emitted and fixed
  it using a '.type'-directive in start.S to mark save_boot_params_ret
  as a (possible) function-entry.
- converted setjmp/longjmp from inline-assembly to separate .S files
  to improve predicatability if emitted code

Changes in v2:
- [added in v2] chain back_to_bootrom calls for SPL, first returning
  to the TPL (using the same mechanism) and the to the BROM from the
  TPL
- also covers the RK3188 (which I had originally missed)

Kever Yang (3):
  rockchip: boot0: align to 0x20 for armv7 '_start'
  rockchip: mkimage: use spl_boot0 for all Rockchip SoCs
  rockchip: rk3288: use aligned address for SPL_TEXT_BASE

Philipp Tomsich (15):
  arm: boot0 hook: move boot0 hook before '_start'
  rockchip: enable boot0-hook for all Rockchip SoCs
  rockchip: rk3036: use aligned address for SPL_TEXT_BASE
  socfpga: boot0 hook: adjust to unified boot0 semantics
  bcm235xx: boot0 hook: adjust to unified boot0 semantics
  bcm281xx: boot0 hook: adjust to unified boot0 semantics
  rockchip: boot0 hook: support early return for RK3188/RK3066-style
BROM
  arm: make save_boot_params_ret prototype visible for AArch64
  arm: mark save_boot_params_ret as a function
  arm: provide a PCS-compliant setjmp implementation
  rockchip: back-to-bootrom: replace assembly-implementation with C-code
  rockchip: rk3188: use boot0 hook to load up SPL in 2 steps
  rockchip: back-to-bootrom: allow passing a cmd to the bootrom
  rockchip: rk3188: move CONFIG_SPL_* entries from rk3188_common.h to
Kconfig
  rockchip: mkimage: remove unused code-paths (spl_boot0 is now implied)

 arch/arm/Kconfig |  1 +
 arch/arm/cpu/armv7/start.S   |  1 +
 arch/arm/include/asm/arch-bcm235xx/boot0.h   |  2 +
 arch/arm/include/asm/arch-bcm281xx/boot0.h   |  2 +
 arch/arm/include/asm/arch-rockchip/boot0.h   | 38 ---
 arch/arm/include/asm/arch-rockchip/bootrom.h | 30 ++---
 arch/arm/include/asm/setjmp.h| 94 
 arch/arm/include/asm/system.h| 62 +-
 arch/arm/lib/Makefile|  6 ++
 arch/arm/lib/setjmp.S| 37 +++
 arch/arm/lib/setjmp_aarch64.S| 42 +
 arch/arm/lib/vectors.S   | 54 ++--
 arch/arm/mach-rockchip/Kconfig   | 39 ++--
 arch/arm/mach-rockchip/Makefile  |  5 +-
 arch/arm/mach-rockchip/bootrom.c | 54 +++-
 arch/arm/mach-rockchip/rk3036-board-spl.c|  2 +-
 arch/arm/mach-rockchip/rk3188-board-spl.c| 14 +
 arch/arm/mach-rockchip/rk3188-board-tpl.c| 86 -
 arch/arm/mach-rockchip/rk322x-board-spl.c|  2 +-
 arch/arm/mach-rockchip/rk3288-board-spl.c|  4 +-
 arch/arm/mach-rockchip/rk3288-board-tpl.c|  2 +-
 arch/arm/mach-rockchip/rk3368-board-tpl.c|  2 +-
 arch/arm/mach-rockchip/rk3399-board-spl.c|  2 +-
 arch/arm/mach-rockchip/save_boot_param.S | 69 
 

[U-Boot] [PATCH] jffs2: ECC corrected nand data is ignored

2017-10-10 Thread Engling, Uwe
Hello,

I ran into a problem with the JFFS2 filesystem driver implemented in U-Boot.

I've got a NAND device that has correctable ECC errors (corrected somewhere in 
mtd/nand/nand_base.c).
The NAND driver tells the filesystem layer (jffs2_1pass.c) above that there 
occurred correctable ECC errors and returns with a "value > 0".
The JFFS2 driver recognizes the corrected ECC errors as real error and skips 
this block because the only accepts a "return value == 0" as correct.

This problem exists for over 8 years (I checked version 2010.09) so I'm a 
little bit worried that I interpreted something wrong or didn't get the whole 
context.

Can someone confirm this bug (and the bugfix) in the u-boot jffs2 driver?

There was a mail in 2012 that mentioned the same problem, but there was no 
patch:
http://u-boot.10912.n7.nabble.com/JFFS2-seems-to-drop-nand-data-with-ECC-corrections-td142008.html
Sometime after this discussion the return value of nand_read() changed from 
-EUCLEAN as correctable ECC error to a positive value with the count of ECC 
corrected errors.


diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 4c6dfbf..6bf1943 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -201,7 +201,7 @@ static int read_nand_cached(u32 off, u32 size, u_char *buf)
 
retlen = NAND_CACHE_SIZE;
if (nand_read(mtd, nand_cache_off,
- , nand_cache) != 0 ||
+ , nand_cache) < 0 ||
retlen != NAND_CACHE_SIZE) {
printf("read_nand_cached: error reading nand 
off %#x size %d bytes\n",
nand_cache_off, 
NAND_CACHE_SIZE);
@@ -300,7 +300,7 @@ static int read_onenand_cached(u32 off, u32 size, u_char 
*buf)
 
retlen = ONENAND_CACHE_SIZE;
if (onenand_read(_mtd, onenand_cache_off, 
retlen,
-   , onenand_cache) != 0 ||
+   , onenand_cache) < 0 ||
retlen != ONENAND_CACHE_SIZE) {
printf("read_onenand_cached: error reading nand 
off %#x size %d bytes\n",
onenand_cache_off, ONENAND_CACHE_SIZE);


With kind reguards,
Uwe Engling
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 04/14] arm: socfpga: stratix10: Add pinmux support for Stratix10 SoC

2017-10-10 Thread Dinh Nguyen
On Thu, Oct 5, 2017 at 8:07 AM,   wrote:
> From: Chin Liang See 
>
> Add pinmux driver support for Stratix SoC
>
> Signed-off-by: Chin Liang See 
> ---
>  arch/arm/mach-socfpga/Makefile |   2 +
>  .../arm/mach-socfpga/include/mach/system_manager.h |   5 +-
>  .../mach-socfpga/include/mach/system_manager_s10.h | 169 
> +
>  arch/arm/mach-socfpga/system_manager_s10.c |  91 +++
>  arch/arm/mach-socfpga/wrap_pinmux_config_s10.c |  55 +++
>  5 files changed, 321 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm/mach-socfpga/include/mach/system_manager_s10.h
>  create mode 100644 arch/arm/mach-socfpga/system_manager_s10.c
>  create mode 100644 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c
>

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


Re: [U-Boot] [PATCH v2 03/14] arm: socfpga: stratix10: Add Reset Manager driver for Stratix10 SoC

2017-10-10 Thread Dinh Nguyen
On Thu, Oct 5, 2017 at 8:07 AM,   wrote:
> From: Chin Liang See 
>
> Add Reset Manager driver support for Stratix SoC
>
> Signed-off-by: Chin Liang See 
> ---
>  arch/arm/mach-socfpga/Makefile |   1 +
>  arch/arm/mach-socfpga/include/mach/reset_manager.h |   2 +
>  .../include/mach/reset_manager_arria10.h   |   8 +-
>  .../mach-socfpga/include/mach/reset_manager_s10.h  | 116 
>  arch/arm/mach-socfpga/reset_manager.c  |  41 +++
>  arch/arm/mach-socfpga/reset_manager_arria10.c  |  67 +++-
>  arch/arm/mach-socfpga/reset_manager_gen5.c |  33 --
>  arch/arm/mach-socfpga/reset_manager_s10.c  | 118 
> +
>  include/dt-bindings/reset/altr,rst-mgr-s10.h   |  97 +
>  9 files changed, 395 insertions(+), 88 deletions(-)

Yikes! Can you find a way to split this patch up? Looks like you're
adding support
for Stratix10, but you're also messing with gen5 and arria10 stuff,
it's a bit hard to
review.

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


Re: [U-Boot] [PATCH v2 02/14] arm: socfpga: stratix10: Add Clock Manager driver for Stratix10 SoC

2017-10-10 Thread Dinh Nguyen
On Thu, Oct 5, 2017 at 8:07 AM,   wrote:
> From: Chin Liang See 
>
> Add Clock Manager driver support for Stratix SoC
>
> Signed-off-by: Chin Liang See 
> --
> Changes in v2
> - Declared defines for constant value used
> - Fixed spacing and comments
> ---
>  arch/arm/mach-socfpga/Makefile |   4 +
>  arch/arm/mach-socfpga/clock_manager.c  |   4 +-
>  arch/arm/mach-socfpga/clock_manager_s10.c  | 355 
> +
>  arch/arm/mach-socfpga/include/mach/clock_manager.h |   2 +
>  .../mach-socfpga/include/mach/clock_manager_s10.h  | 210 
>  arch/arm/mach-socfpga/include/mach/handoff_s10.h   |  29 ++
>  arch/arm/mach-socfpga/wrap_pll_config_s10.c|  44 +++
>  7 files changed, 646 insertions(+), 2 deletions(-)
>  create mode 100644 arch/arm/mach-socfpga/clock_manager_s10.c
>  create mode 100644 arch/arm/mach-socfpga/include/mach/clock_manager_s10.h
>  create mode 100644 arch/arm/mach-socfpga/include/mach/handoff_s10.h
>  create mode 100644 arch/arm/mach-socfpga/wrap_pll_config_s10.c
>
> diff --git a/arch/arm/mach-socfpga/Makefile b/arch/arm/mach-socfpga/Makefile
> index 286bfef..e5f9dd7 100644
> --- a/arch/arm/mach-socfpga/Makefile
> +++ b/arch/arm/mach-socfpga/Makefile
> @@ -30,6 +30,10 @@ obj-y+= pinmux_arria10.o
>  obj-y  += reset_manager_arria10.o
>  endif
>
> +ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
> +obj-y  += clock_manager_s10.o
> +obj-y  += wrap_pll_config_s10.o
> +endif
>  ifdef CONFIG_SPL_BUILD
>  obj-y  += spl.o
>  ifdef CONFIG_TARGET_SOCFPGA_GEN5
> diff --git a/arch/arm/mach-socfpga/clock_manager.c 
> b/arch/arm/mach-socfpga/clock_manager.c
> index cb6ae03..f9450a4 100644
> --- a/arch/arm/mach-socfpga/clock_manager.c
> +++ b/arch/arm/mach-socfpga/clock_manager.c
> @@ -21,7 +21,7 @@ void cm_wait_for_lock(u32 mask)
> do {
>  #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
> inter_val = readl(_manager_base->inter) & mask;
> -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
> +#else
> inter_val = readl(_manager_base->stat) & mask;
>  #endif
> /* Wait for stable lock */
> @@ -52,7 +52,7 @@ int set_cpu_clk_info(void)
>
>  #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
> gd->bd->bi_ddr_freq = cm_get_sdram_clk_hz() / 100;
> -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10)
> +#else
> gd->bd->bi_ddr_freq = 0;
>  #endif
>
> diff --git a/arch/arm/mach-socfpga/clock_manager_s10.c 
> b/arch/arm/mach-socfpga/clock_manager_s10.c
> new file mode 100644
> index 000..cfb6708
> --- /dev/null
> +++ b/arch/arm/mach-socfpga/clock_manager_s10.c
> @@ -0,0 +1,355 @@
> +/*
> + * Copyright (C) 2016-2017 Intel Corporation 
> + *
> + * SPDX-License-Identifier:GPL-2.0
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +static const struct socfpga_clock_manager *clock_manager_base =
> +   (struct socfpga_clock_manager *)SOCFPGA_CLKMGR_ADDRESS;
> +
> +/*
> + * function to write the bypass register which requires a poll of the
> + * busy bit
> + */
> +static void cm_write_bypass_mainpll(uint32_t val)
> +{
> +   writel(val, _manager_base->main_pll.bypass);
> +   cm_wait_for_fsm();
> +}
> +
> +static void cm_write_bypass_perpll(uint32_t val)
> +{
> +   writel(val, _manager_base->per_pll.bypass);
> +   cm_wait_for_fsm();
> +}
> +
> +/* function to write the ctrl register which requires a poll of the busy bit 
> */
> +static void cm_write_ctrl(uint32_t val)
> +{
> +   writel(val, _manager_base->ctrl);
> +   cm_wait_for_fsm();
> +}
> +
> +/*
> + * Setup clocks while making no assumptions about previous state of the 
> clocks.
> + */
> +void cm_basic_init(const struct cm_config * const cfg)
> +{
> +   uint32_t mdiv, refclkdiv, mscnt, hscnt, vcocalib;
> +
> +   if (cfg == 0)
> +   return;
> +
> +   /* Put all plls in bypass */
> +   cm_write_bypass_mainpll(CLKMGR_BYPASS_MAINPLL_ALL);
> +   cm_write_bypass_perpll(CLKMGR_BYPASS_PERPLL_ALL);
> +
> +   /* setup main PLL dividers where calculate the vcocalib value */
> +   mdiv = (cfg->main_pll_fdbck >> CLKMGR_FDBCK_MDIV_OFFSET) &
> +   CLKMGR_FDBCK_MDIV_MASK;
> +   refclkdiv = (cfg->main_pll_pllglob >> 
> CLKMGR_PLLGLOB_REFCLKDIV_OFFSET) &
> +CLKMGR_PLLGLOB_REFCLKDIV_MASK;
> +   mscnt = CLKMGR_MSCNT_CONST / (CLKMGR_MDIV_CONST + mdiv) / refclkdiv;
> +   hscnt = (mdiv + CLKMGR_MDIV_CONST) * mscnt / refclkdiv -
> +   CLKMGR_HSCNT_CONST;
> +   vcocalib = (hscnt & CLKMGR_VCOCALIB_HSCNT_MASK) |
> +  ((mscnt & CLKMGR_VCOCALIB_MSCNT_MASK) <<
> +  CLKMGR_VCOCALIB_MSCNT_OFFSET);
> +
> +   writel((cfg->main_pll_pllglob & ~CLKMGR_PLLGLOB_PD_MASK &
> +   ~CLKMGR_PLLGLOB_RST_MASK),
> +   _manager_base->main_pll.pllglob);
> +   writel(cfg->main_pll_fdbck, 

[U-Boot] [PATCH 2/4] spi: Drop CONFIG_ATMEL_DATAFLASH_SPI

2017-10-10 Thread Tuomas Tynkkynen
Last user of this option went away in commit:

fdc7718999 ("board: usb_a9263: Update to support DT and DM")

Signed-off-by: Tuomas Tynkkynen 
---
 drivers/spi/Makefile  |   1 -
 drivers/spi/atmel_dataflash_spi.c | 184 --
 2 files changed, 185 deletions(-)
 delete mode 100644 drivers/spi/atmel_dataflash_spi.c

diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index cd7c7556a7..ad56203cd6 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -17,7 +17,6 @@ endif
 
 obj-$(CONFIG_ALTERA_SPI) += altera_spi.o
 obj-$(CONFIG_ATH79_SPI) += ath79_spi.o
-obj-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
 obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
diff --git a/drivers/spi/atmel_dataflash_spi.c 
b/drivers/spi/atmel_dataflash_spi.c
deleted file mode 100644
index a2e9c00ea6..00
--- a/drivers/spi/atmel_dataflash_spi.c
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Driver for ATMEL DataFlash support
- * Author : Hamid Ikdoumi (Atmel)
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-/*
- * This driver desperately needs rework:
- *
- * - use structure SoC access
- * - get rid of including asm/arch/at91_spi.h
- * - remove asm/arch/at91_spi.h
- * - get rid of all CONFIG_ATMEL_LEGACY defines and uses
- *
- * 02-Aug-2010 Reinhard Meyer 
- */
-
-#include 
-#ifndef CONFIG_ATMEL_LEGACY
-# define CONFIG_ATMEL_LEGACY
-#endif
-#include 
-#include 
-
-#include 
-
-#include 
-#include 
-
-#include "atmel_spi.h"
-
-#include 
-#include 
-#include 
-
-#include 
-
-#define AT91_SPI_PCS0_DATAFLASH_CARD   0xE /* Chip Select 0: NPCS0%1110 */
-#define AT91_SPI_PCS1_DATAFLASH_CARD   0xD /* Chip Select 1: NPCS1%1101 */
-#define AT91_SPI_PCS2_DATAFLASH_CARD   0xB /* Chip Select 2: NPCS2%1011 */
-#define AT91_SPI_PCS3_DATAFLASH_CARD   0x7 /* Chip Select 3: NPCS3%0111 */
-
-void AT91F_SpiInit(void)
-{
-   /* Reset the SPI */
-   writel(AT91_SPI_SWRST, ATMEL_BASE_SPI0 + AT91_SPI_CR);
-
-   /* Configure SPI in Master Mode with No CS selected !!! */
-   writel(AT91_SPI_MSTR | AT91_SPI_MODFDIS | AT91_SPI_PCS,
-  ATMEL_BASE_SPI0 + AT91_SPI_MR);
-
-   /* Configure CS0 */
-   writel(AT91_SPI_NCPHA |
-  (AT91_SPI_DLYBS & DATAFLASH_TCSS) |
-  (AT91_SPI_DLYBCT & DATAFLASH_TCHS) |
-  ((get_mck_clk_rate() / AT91_SPI_CLK) << 8),
-  ATMEL_BASE_SPI0 + AT91_SPI_CSR(0));
-
-#ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS1
-   /* Configure CS1 */
-   writel(AT91_SPI_NCPHA |
-  (AT91_SPI_DLYBS & DATAFLASH_TCSS) |
-  (AT91_SPI_DLYBCT & DATAFLASH_TCHS) |
-  ((get_mck_clk_rate() / AT91_SPI_CLK) << 8),
-  ATMEL_BASE_SPI0 + AT91_SPI_CSR(1));
-#endif
-#ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS2
-   /* Configure CS2 */
-   writel(AT91_SPI_NCPHA |
-  (AT91_SPI_DLYBS & DATAFLASH_TCSS) |
-  (AT91_SPI_DLYBCT & DATAFLASH_TCHS) |
-  ((get_mck_clk_rate() / AT91_SPI_CLK) << 8),
-  ATMEL_BASE_SPI0 + AT91_SPI_CSR(2));
-#endif
-#ifdef CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS3
-   /* Configure CS3 */
-   writel(AT91_SPI_NCPHA |
-  (AT91_SPI_DLYBS & DATAFLASH_TCSS) |
-  (AT91_SPI_DLYBCT & DATAFLASH_TCHS) |
-  ((get_mck_clk_rate() / AT91_SPI_CLK) << 8),
-  ATMEL_BASE_SPI0 + AT91_SPI_CSR(3));
-#endif
-
-   /* SPI_Enable */
-   writel(AT91_SPI_SPIEN, ATMEL_BASE_SPI0 + AT91_SPI_CR);
-
-   while (!(readl(ATMEL_BASE_SPI0 + AT91_SPI_SR) & AT91_SPI_SPIENS))
-   ;
-
-   /*
-* Add tempo to get SPI in a safe state.
-* Should not be needed for new silicon (Rev B)
-*/
-   udelay(50);
-   readl(ATMEL_BASE_SPI0 + AT91_SPI_SR);
-   readl(ATMEL_BASE_SPI0 + AT91_SPI_RDR);
-
-}
-
-void AT91F_SpiEnable(int cs)
-{
-   unsigned long mode;
-
-   mode = readl(ATMEL_BASE_SPI0 + AT91_SPI_MR);
-   mode &= ~AT91_SPI_PCS;
-
-   switch (cs) {
-   case 0:
-   mode |= AT91_SPI_PCS0_DATAFLASH_CARD << 16;
-   break;
-   case 1:
-   mode |= AT91_SPI_PCS1_DATAFLASH_CARD << 16;
-   break;
-   case 2:
-   mode |= AT91_SPI_PCS2_DATAFLASH_CARD << 16;
-   break;
-   case 3:
-   mode |= AT91_SPI_PCS3_DATAFLASH_CARD << 16;
-   break;
-   }
-
-   writel(mode, ATMEL_BASE_SPI0 + AT91_SPI_MR);
-
-   /* SPI_Enable */
-   writel(AT91_SPI_SPIEN, ATMEL_BASE_SPI0 + AT91_SPI_CR);
-}
-
-unsigned int AT91F_SpiWrite1(AT91PS_DataflashDesc pDesc);
-
-unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc)
-{
-   unsigned int timeout;
-   unsigned int timebase;
-
-   pDesc->state = BUSY;
-
-   writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS,
-   

[U-Boot] [PATCH 3/4] Drop CONFIG_HAS_DATAFLASH

2017-10-10 Thread Tuomas Tynkkynen
Last user of this option went away in commit:

fdc7718999 ("board: usb_a9263: Update to support DT and DM")

Signed-off-by: Tuomas Tynkkynen 
---
 README |   7 -
 arch/arm/mach-at91/arm926ejs/at91sam9260_devices.c |   2 +-
 arch/arm/mach-at91/arm926ejs/at91sam9261_devices.c |   2 +-
 arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c |   2 +-
 .../mach-at91/arm926ejs/at91sam9m10g45_devices.c   |   2 +-
 arch/arm/mach-at91/arm926ejs/at91sam9rl_devices.c  |   2 +-
 board/atmel/at91sam9260ek/Makefile |   1 -
 board/atmel/at91sam9260ek/partition.c  |  26 -
 board/atmel/at91sam9261ek/Makefile |   1 -
 board/atmel/at91sam9261ek/partition.c  |  26 -
 board/atmel/at91sam9263ek/Makefile |   1 -
 board/atmel/at91sam9263ek/partition.c  |  25 -
 board/atmel/at91sam9rlek/Makefile  |   1 -
 board/atmel/at91sam9rlek/partition.c   |  25 -
 board/esd/meesc/Makefile   |   1 -
 board/esd/meesc/partition.c|  23 -
 board/mini-box/picosam9g45/picosam9g45.c   |   3 -
 board/ronetix/pm9261/Makefile  |   1 -
 board/ronetix/pm9261/partition.c   |  33 --
 board/ronetix/pm9263/Makefile  |   1 -
 board/ronetix/pm9263/partition.c   |  33 --
 board/siemens/corvus/board.c   |   3 -
 cmd/flash.c|  33 +-
 cmd/mem.c  | 106 +---
 common/board_r.c   |  15 -
 common/image.c |  62 ---
 drivers/mtd/Makefile   |   2 -
 drivers/mtd/at45.c | 545 -
 drivers/mtd/dataflash.c| 448 -
 include/dataflash.h| 205 
 scripts/config_whitelist.txt   |   5 -
 31 files changed, 16 insertions(+), 1626 deletions(-)
 delete mode 100644 board/atmel/at91sam9260ek/partition.c
 delete mode 100644 board/atmel/at91sam9261ek/partition.c
 delete mode 100644 board/atmel/at91sam9263ek/partition.c
 delete mode 100644 board/atmel/at91sam9rlek/partition.c
 delete mode 100644 board/esd/meesc/partition.c
 delete mode 100644 board/ronetix/pm9261/partition.c
 delete mode 100644 board/ronetix/pm9263/partition.c
 delete mode 100644 drivers/mtd/at45.c
 delete mode 100644 drivers/mtd/dataflash.c
 delete mode 100644 include/dataflash.h

diff --git a/README b/README
index ca07f7a3f9..242287ca9b 100644
--- a/README
+++ b/README
@@ -2312,13 +2312,6 @@ The following options need to be configured:
this is instead controlled by the value of
/config/load-environment.
 
-- DataFlash Support:
-   CONFIG_HAS_DATAFLASH
-
-   Defining this option enables DataFlash features and
-   allows to read/write in Dataflash via the standard
-   commands cp, md...
-
 - Serial Flash support
Usage requires an initial 'sf probe' to define the serial
flash parameters, followed by read/write/erase/update
diff --git a/arch/arm/mach-at91/arm926ejs/at91sam9260_devices.c 
b/arch/arm/mach-at91/arm926ejs/at91sam9260_devices.c
index 912a966bae..bb3e36552a 100644
--- a/arch/arm/mach-at91/arm926ejs/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/arm926ejs/at91sam9260_devices.c
@@ -58,7 +58,7 @@ void at91_seriald_hw_init(void)
at91_periph_clk_enable(ATMEL_ID_SYS);
 }
 
-#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
+#ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
at91_set_a_periph(AT91_PIO_PORTA, 0, PUP);  /* SPI0_MISO */
diff --git a/arch/arm/mach-at91/arm926ejs/at91sam9261_devices.c 
b/arch/arm/mach-at91/arm926ejs/at91sam9261_devices.c
index 4bd4e75e0b..58050a2a24 100644
--- a/arch/arm/mach-at91/arm926ejs/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/arm926ejs/at91sam9261_devices.c
@@ -55,7 +55,7 @@ void at91_seriald_hw_init(void)
at91_periph_clk_enable(ATMEL_ID_SYS);
 }
 
-#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
+#ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
at91_set_a_periph(AT91_PIO_PORTA, 0, PUP);  /* SPI0_MISO */
diff --git a/arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c 
b/arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c
index f3f480010a..674eb66e8e 100644
--- a/arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c
@@ -59,7 +59,7 @@ void at91_seriald_hw_init(void)
at91_periph_clk_enable(ATMEL_ID_SYS);
 }
 
-#if defined(CONFIG_HAS_DATAFLASH) || defined(CONFIG_ATMEL_SPI)
+#ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {

[U-Boot] [PATCH 4/4] common: Remove genimg_get_image()

2017-10-10 Thread Tuomas Tynkkynen
Removal of the legacy DataFlash code turned genimg_get_image() into a
no-op. Drop all calls to it and the function itself.

Signed-off-by: Tuomas Tynkkynen 
---
 common/bootm.c |  3 ---
 common/image-fdt.c |  3 ---
 common/image.c | 27 ---
 include/image.h|  1 -
 4 files changed, 34 deletions(-)

diff --git a/common/bootm.c b/common/bootm.c
index 32b3ea8e2d..9493a306cd 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -810,9 +810,6 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int 
flag, int argc,
 
bootstage_mark(BOOTSTAGE_ID_CHECK_MAGIC);
 
-   /* copy from dataflash if needed */
-   img_addr = genimg_get_image(img_addr);
-
/* check image type, for FIT images get FIT kernel node */
*os_data = *os_len = 0;
buf = map_sysmem(img_addr, 0);
diff --git a/common/image-fdt.c b/common/image-fdt.c
index a2ef409836..1e946467e3 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -294,9 +294,6 @@ int boot_get_fdt(int flag, int argc, char * const argv[], 
uint8_t arch,
debug("## Checking for 'FDT'/'FDT Image' at %08lx\n",
  fdt_addr);
 
-   /* copy from dataflash if needed */
-   fdt_addr = genimg_get_image(fdt_addr);
-
/*
 * Check if there is an FDT image at the
 * address provided in the second bootm argument
diff --git a/common/image.c b/common/image.c
index 01f48bf772..06fdca129c 100644
--- a/common/image.c
+++ b/common/image.c
@@ -385,9 +385,6 @@ void image_print_contents(const void *ptr)
  * flag. Verification done covers data and header integrity and os/type/arch
  * fields checking.
  *
- * If dataflash support is enabled routine checks for dataflash addresses
- * and handles required dataflash reads.
- *
  * returns:
  * pointer to a ramdisk image header, if image was found and valid
  * otherwise, return NULL
@@ -885,23 +882,6 @@ int genimg_get_format(const void *img_addr)
return IMAGE_FORMAT_INVALID;
 }
 
-/**
- * genimg_get_image - get image from special storage (if necessary)
- * @img_addr: image start address
- *
- * genimg_get_image() checks if provided image start address is located
- * in a dataflash storage. If so, image is moved to a system RAM memory.
- *
- * returns:
- * image start address after possible relocation from special storage
- */
-ulong genimg_get_image(ulong img_addr)
-{
-   ulong ram_addr = img_addr;
-
-   return ram_addr;
-}
-
 /**
  * fit_has_config - check if there is a valid FIT configuration
  * @images: pointer to the bootm command headers structure
@@ -1034,9 +1014,6 @@ int boot_get_ramdisk(int argc, char * const argv[], 
bootm_headers_t *images,
}
 #endif
 
-   /* copy from dataflash if needed */
-   rd_addr = genimg_get_image(rd_addr);
-
/*
 * Check if there is an initrd image at the
 * address provided in the second bootm argument
@@ -1268,10 +1245,8 @@ int boot_get_fpga(int argc, char * const argv[], 
bootm_headers_t *images,
 
/*
 * Obtain the os FIT header from the images struct
-* copy from dataflash if needed
 */
tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
-   tmp_img_addr = genimg_get_image(tmp_img_addr);
buf = map_sysmem(tmp_img_addr, 0);
/*
 * Check image type. For FIT images get FIT node
@@ -1380,10 +1355,8 @@ int boot_get_loadable(int argc, char * const argv[], 
bootm_headers_t *images,
 
/*
 * Obtain the os FIT header from the images struct
-* copy from dataflash if needed
 */
tmp_img_addr = map_to_sysmem(images->fit_hdr_os);
-   tmp_img_addr = genimg_get_image(tmp_img_addr);
buf = map_sysmem(tmp_img_addr, 0);
/*
 * Check image type. For FIT images get FIT node
diff --git a/include/image.h b/include/image.h
index 93451dd8a4..127cfc5148 100644
--- a/include/image.h
+++ b/include/image.h
@@ -558,7 +558,6 @@ ulong genimg_get_kernel_addr_fit(char * const img_addr,
 ulong genimg_get_kernel_addr(char * const img_addr);
 int genimg_get_format(const void *img_addr);
 int genimg_has_config(bootm_headers_t *images);
-ulong genimg_get_image(ulong img_addr);
 
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
uint8_t arch, const ulong *ld_start, ulong * const ld_len);
-- 
2.14.2

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


[U-Boot] [PATCH 1/4] env: Drop CONFIG_ENV_IS_IN_DATAFLASH

2017-10-10 Thread Tuomas Tynkkynen
Last user of this option went away in commit:

fdc7718999 ("board: usb_a9263: Update to support DT and DM")

Signed-off-by: Tuomas Tynkkynen 
---
 cmd/nvedit.c  |  3 +--
 env/Kconfig   | 15 ---
 env/Makefile  |  1 -
 env/dataflash.c   | 75 ---
 env/env.c |  4 +--
 include/environment.h |  1 -
 tools/Makefile|  1 -
 7 files changed, 2 insertions(+), 98 deletions(-)
 delete mode 100644 env/dataflash.c

diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 90f76bbc20..4e79d03856 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -42,7 +42,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #if!defined(CONFIG_ENV_IS_IN_EEPROM)   && \
!defined(CONFIG_ENV_IS_IN_FLASH)&& \
-   !defined(CONFIG_ENV_IS_IN_DATAFLASH)&& \
!defined(CONFIG_ENV_IS_IN_MMC)  && \
!defined(CONFIG_ENV_IS_IN_FAT)  && \
!defined(CONFIG_ENV_IS_IN_EXT4) && \
@@ -54,7 +53,7 @@ DECLARE_GLOBAL_DATA_PTR;
!defined(CONFIG_ENV_IS_IN_REMOTE)   && \
!defined(CONFIG_ENV_IS_IN_UBI)  && \
!defined(CONFIG_ENV_IS_NOWHERE)
-# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|MMC|FAT|EXT4|\
+# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|MMC|FAT|EXT4|\
 NAND|NVRAM|ONENAND|SATA|SPI_FLASH|REMOTE|UBI} or CONFIG_ENV_IS_NOWHERE
 #endif
 
diff --git a/env/Kconfig b/env/Kconfig
index 024d4d79bd..2ec2b8 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -40,21 +40,6 @@ config ENV_IS_NOWHERE
  stored. U-Boot will therefore always start up with a default
  environment.
 
-config ENV_IS_IN_DATAFLASH
-   bool "Environment in dataflash"
-   depends on !CHAIN_OF_TRUST
-   help
- Define this if you have a DataFlash memory device which you
- want to use for the environment.
-
- - CONFIG_ENV_OFFSET:
- - CONFIG_ENV_ADDR:
- - CONFIG_ENV_SIZE:
-
- These three #defines specify the offset and size of the
- environment area within the total memory of your DataFlash placed
- at the specified address.
-
 config ENV_IS_IN_EEPROM
bool "Environment in EEPROM"
depends on !CHAIN_OF_TRUST
diff --git a/env/Makefile b/env/Makefile
index 8df5b9d4c9..7ce8231d9a 100644
--- a/env/Makefile
+++ b/env/Makefile
@@ -11,7 +11,6 @@ ifndef CONFIG_SPL_BUILD
 obj-y += attr.o
 obj-y += callback.o
 obj-y += flags.o
-obj-$(CONFIG_ENV_IS_IN_DATAFLASH) += dataflash.o
 obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
 extra-$(CONFIG_ENV_IS_EMBEDDED) += embedded.o
 obj-$(CONFIG_ENV_IS_IN_EEPROM) += embedded.o
diff --git a/env/dataflash.c b/env/dataflash.c
deleted file mode 100644
index 77bc595e0d..00
--- a/env/dataflash.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * LowLevel function for DataFlash environment support
- * Author : Gilles Gastaldi (Atmel)
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static int env_dataflash_get_char(int index)
-{
-   uchar c;
-
-   read_dataflash(CONFIG_ENV_ADDR + index + offsetof(env_t, data),
-   1, (char *));
-   return c;
-}
-
-static int env_dataflash_load(void)
-{
-   ulong crc, new = 0;
-   unsigned off;
-   char buf[CONFIG_ENV_SIZE];
-
-   /* Read old CRC */
-   read_dataflash(CONFIG_ENV_ADDR + offsetof(env_t, crc),
-  sizeof(ulong), (char *));
-
-   /* Read whole environment */
-   read_dataflash(CONFIG_ENV_ADDR, CONFIG_ENV_SIZE, buf);
-
-   /* Calculate the CRC */
-   off = offsetof(env_t, data);
-   new = crc32(new, (unsigned char *)(buf + off), ENV_SIZE);
-
-   if (crc == new)
-   env_import(buf, 1);
-   else
-   set_default_env("!bad CRC");
-
-   return 0;
-}
-
-#ifdef CONFIG_ENV_OFFSET_REDUND
-#error No support for redundant environment on dataflash yet!
-#endif
-
-static int env_dataflash_save(void)
-{
-   env_t env_new;
-   int ret;
-
-   ret = env_export(_new);
-   if (ret)
-   return ret;
-
-   return write_dataflash(CONFIG_ENV_ADDR,
-   (unsigned long)_new,
-   CONFIG_ENV_SIZE);
-}
-
-U_BOOT_ENV_LOCATION(dataflash) = {
-   .location   = ENVL_DATAFLASH,
-   ENV_NAME("dataflash")
-   .get_char   = env_dataflash_get_char,
-   .load   = env_dataflash_load,
-   .save   = env_save_ptr(env_dataflash_save),
-};
diff --git a/env/env.c b/env/env.c
index 43290d0832..76a5608628 100644
--- a/env/env.c
+++ b/env/env.c
@@ -28,9 +28,7 @@ static struct env_driver *env_driver_lookup(enum env_location 
loc)
 
 static enum env_location env_get_default_location(void)
 {
-   if IS_ENABLED(CONFIG_ENV_IS_IN_DATAFLASH)
-   return ENVL_DATAFLASH;
-   else if 

[U-Boot] [PATCH 0/4] Drop unused legacy DataFlash code

2017-10-10 Thread Tuomas Tynkkynen
These patches remove:

  CONFIG_ENV_IS_IN_DATAFLASH
  CONFIG_ATMEL_DATAFLASH_SPI
  CONFIG_HAS_DATAFLASH

Last user of these went away in July, in commit fdc77189994b2ac794862
("board: usb_a9263: Update to support DT and DM"). AFAICT their
replacements using DM + DT are:

  CONFIG_ENV_IS_IN_SPI_FLASH
  CONFIG_SPI_FLASH_DATAFLASH

Tuomas Tynkkynen (4):
  env: Drop CONFIG_ENV_IS_IN_DATAFLASH
  spi: Drop CONFIG_ATMEL_DATAFLASH_SPI
  Drop CONFIG_HAS_DATAFLASH
  common: Remove genimg_get_image()

 README |   7 -
 arch/arm/mach-at91/arm926ejs/at91sam9260_devices.c |   2 +-
 arch/arm/mach-at91/arm926ejs/at91sam9261_devices.c |   2 +-
 arch/arm/mach-at91/arm926ejs/at91sam9263_devices.c |   2 +-
 .../mach-at91/arm926ejs/at91sam9m10g45_devices.c   |   2 +-
 arch/arm/mach-at91/arm926ejs/at91sam9rl_devices.c  |   2 +-
 board/atmel/at91sam9260ek/Makefile |   1 -
 board/atmel/at91sam9260ek/partition.c  |  26 -
 board/atmel/at91sam9261ek/Makefile |   1 -
 board/atmel/at91sam9261ek/partition.c  |  26 -
 board/atmel/at91sam9263ek/Makefile |   1 -
 board/atmel/at91sam9263ek/partition.c  |  25 -
 board/atmel/at91sam9rlek/Makefile  |   1 -
 board/atmel/at91sam9rlek/partition.c   |  25 -
 board/esd/meesc/Makefile   |   1 -
 board/esd/meesc/partition.c|  23 -
 board/mini-box/picosam9g45/picosam9g45.c   |   3 -
 board/ronetix/pm9261/Makefile  |   1 -
 board/ronetix/pm9261/partition.c   |  33 --
 board/ronetix/pm9263/Makefile  |   1 -
 board/ronetix/pm9263/partition.c   |  33 --
 board/siemens/corvus/board.c   |   3 -
 cmd/flash.c|  33 +-
 cmd/mem.c  | 106 +---
 cmd/nvedit.c   |   3 +-
 common/board_r.c   |  15 -
 common/bootm.c |   3 -
 common/image-fdt.c |   3 -
 common/image.c |  89 
 drivers/mtd/Makefile   |   2 -
 drivers/mtd/at45.c | 545 -
 drivers/mtd/dataflash.c| 448 -
 drivers/spi/Makefile   |   1 -
 drivers/spi/atmel_dataflash_spi.c  | 184 ---
 env/Kconfig|  15 -
 env/Makefile   |   1 -
 env/dataflash.c|  75 ---
 env/env.c  |   4 +-
 include/dataflash.h| 205 
 include/environment.h  |   1 -
 include/image.h|   1 -
 scripts/config_whitelist.txt   |   5 -
 tools/Makefile |   1 -
 43 files changed, 18 insertions(+), 1943 deletions(-)
 delete mode 100644 board/atmel/at91sam9260ek/partition.c
 delete mode 100644 board/atmel/at91sam9261ek/partition.c
 delete mode 100644 board/atmel/at91sam9263ek/partition.c
 delete mode 100644 board/atmel/at91sam9rlek/partition.c
 delete mode 100644 board/esd/meesc/partition.c
 delete mode 100644 board/ronetix/pm9261/partition.c
 delete mode 100644 board/ronetix/pm9263/partition.c
 delete mode 100644 drivers/mtd/at45.c
 delete mode 100644 drivers/mtd/dataflash.c
 delete mode 100644 drivers/spi/atmel_dataflash_spi.c
 delete mode 100644 env/dataflash.c
 delete mode 100644 include/dataflash.h

-- 
2.14.2

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


Re: [U-Boot] [PATCH V2] ARM: imx6: Add DHCOM i.MX6 PDK board support

2017-10-10 Thread Stefano Babic
Hi Jagan, Marek,

On 10/10/2017 16:08, Marek Vasut wrote:
> On 10/10/2017 04:04 PM, Jagan Teki wrote:
>> On Tue, Oct 10, 2017 at 7:10 PM, Marek Vasut  wrote:
>>> On 10/10/2017 03:32 PM, Jagan Teki wrote:
 On Tue, Oct 10, 2017 at 1:21 AM, Marek Vasut  wrote:
> Add support for the DHCOM i.MX6 PDK board. This board has:
> - FEC ethernet
> - EHCI USB host
> - 3x SDMMC
>
> Signed-off-by: Marek Vasut 
> Cc: Stefano Babic 
> ---
> V2: Use get_cpu_type() and imx_get_mac_from_fuse()
> ---
>  arch/arm/mach-imx/mx6/Kconfig |  10 +
>  board/dhelectronics/dh_imx6/Kconfig   |  12 +
>  board/dhelectronics/dh_imx6/MAINTAINERS   |   7 +
>  board/dhelectronics/dh_imx6/Makefile  |  11 +
>  board/dhelectronics/dh_imx6/dh_imx6.c | 437 
> ++
>  board/dhelectronics/dh_imx6/dh_imx6_spl.c | 399 
> +++
>  configs/dh_imx6_defconfig |  51 
>  include/configs/dh_imx6.h | 191 +
>  8 files changed, 1118 insertions(+)
>  create mode 100644 board/dhelectronics/dh_imx6/Kconfig
>  create mode 100644 board/dhelectronics/dh_imx6/MAINTAINERS
>  create mode 100644 board/dhelectronics/dh_imx6/Makefile
>  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6.c
>  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6_spl.c
>  create mode 100644 configs/dh_imx6_defconfig
>  create mode 100644 include/configs/dh_imx6.h
>
> diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
> index 540f2b29b1..b82db3af22 100644
> --- a/arch/arm/mach-imx/mx6/Kconfig
> +++ b/arch/arm/mach-imx/mx6/Kconfig
> @@ -129,6 +129,15 @@ config TARGET_COLIBRI_IMX6
> select DM_SERIAL
> select DM_THERMAL
>
> +config TARGET_DHCOMIMX6
> +   bool "dh_imx6"
> +   select BOARD_LATE_INIT
> +   select BOARD_EARLY_INIT_F
> +   select SUPPORT_SPL
> +   select DM
> +   select DM_THERMAL
> +   imply CMD_SPL

 I would suggest to add new boards with DTS along with enabling
 dm-driven drivers, this would eventually improve i.MX tree toward
 using new feature set.
>>>
>>> Enabling unused stuff and adding bloat ? Nope :)
>>
>> OK, but we still have useful stuff:
>>
>> DM_ETH
>> DM_GPIO
>> DM_I2C
>> DM_MMC
>> DM_SPI
>> DM_SPI_FLASH
> 
> This discussion is moot, it is NOT useful here and it just adds bloat.

More or less I have already explained my point of view here:

https://lists.denx.de/pipermail/u-boot/2017-May/292424.html

Again, moving to DTS should be done if this does not preclude other
features. That means for example boot time (==> small footprint), having
a single binary for multiple SOC variants, and so on. As I have already
said: I won't constraint any contributor to follow one or the other way.
See case with pico imx.7. I understand that some projects will be better
supported in one way, some other ones with the other way. I have also
merged boards in last time *without* DTS support, because the board
maintainer is in charge to better know which is the best for his own
project - the choice has low impact on the common port for i.MX. For
this patch, Marek has chosen the way to support the board, because he
won't to increase footprint and he does not want to have unused code
inside. All good arguments.

IMHO patch is fine.

Best regards,
Stefano

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


Re: [U-Boot] [PATCH v4 2/2] sun50i: h5: Add NanoPi Neo Plus2 DT initial support

2017-10-10 Thread Antony Antony
On Tue, Oct 10, 2017 at 10:30:42PM +0530, Jagan Teki wrote:
> On Tue, Oct 10, 2017 at 10:26 PM, Antony Antony  wrote:
> > On Tue, Oct 10, 2017 at 07:28:23PM +0530, Jagan Teki wrote:
> >> On Tue, Oct 10, 2017 at 7:15 PM, Antony Antony  wrote:
> >> > Add initial DT for NanoPi NEO Plus2 by FriendlyARM
> >> > - Allwinner quad core H5 Cortex A53 with an ARM Mali-450MP GPU
> >> > - 1 GB DDR3 RAM
> >> > - 8GB eMMC flash (Samsung KLM8G1WEPD-B031)
> >> > - micro SD card slot
> >> > - Gigabit Ethernet (external RTL8211E-VB-CG chip)
> >> > - 802.11 b/g/n WiFi, Bluetooth 4.0 (Ampak AP6212A module)
> >> > - 2x USB 2.0 host ports
> >> >
> >> > Signed-off-by: Antony Antony 
> >> > ---
> >> >  arch/arm/dts/Makefile   |   1 +
> >> >  arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts | 106 
> >> > 
> >> >  configs/nanopi_neo_plus2_defconfig  |  18 +
> >> >  3 files changed, 125 insertions(+)
> >> >  create mode 100644 arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
> >> >  create mode 100644 configs/nanopi_neo_plus2_defconfig
> >> > ---
> >> > Changes v1->v2
> >> >  removed memory {}, compatible ="allwinner,sun5i-a13-mmc"
> >> >  remove CONFIG_SPL_SPI_FLASH_SUPPORT=y and CONFIG_SPL_SPI_SUNXI=y (no 
> >> > SPI)
> >> >  remove CONFIG_SD_BOOT=y
> >> > Changes v2->v3
> >> >  removed compatible ="allwinner,sun50i-a64-mmc"
> >> > Changes v3->v4
> >> >  removed compatible from mmc0
> >> >  add h5 & a64 compaitable to sun50i-h5.dtsi
> >> >
> >> > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> >> > index 5b90280..879ff24 100644
> >> > --- a/arch/arm/dts/Makefile
> >> > +++ b/arch/arm/dts/Makefile
> >> > @@ -335,6 +335,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \
> >> > sun8i-v3s-licheepi-zero.dtb
> >> >  dtb-$(CONFIG_MACH_SUN50I_H5) += \
> >> > sun50i-h5-nanopi-neo2.dtb \
> >> > +   sun50i-h5-nanopi-neo-plus2.dtb \
> >> > sun50i-h5-orangepi-pc2.dtb \
> >> > sun50i-h5-orangepi-prime.dtb \
> >> > sun50i-h5-orangepi-zero-plus2.dtb
> >> > diff --git a/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts 
> >> > b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
> >> > new file mode 100644
> >> > index 000..f1406c2
> >> > --- /dev/null
> >> > +++ b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
> >> > @@ -0,0 +1,106 @@
> >> > +/*
> >> > + * Copyright (C) 2017 Antony Antony 
> >> > + * Copyright (c) 2016 ARM Ltd.
> >> > + *
> >> > + * This file is dual-licensed: you can use it either under the terms
> >> > + * of the GPL or the X11 license, at your option. Note that this dual
> >> > + * licensing only applies to this file, and not this project as a
> >> > + * whole.
> >> > + *
> >> > + *  a) This library is free software; you can redistribute it and/or
> >> > + * modify it under the terms of the GNU General Public License as
> >> > + * published by the Free Software Foundation; either version 2 of 
> >> > the
> >> > + * License, or (at your option) any later version.
> >> > + *
> >> > + * This library is distributed in the hope that it will be useful,
> >> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >> > + * GNU General Public License for more details.
> >> > + *
> >> > + * Or, alternatively,
> >> > + *
> >> > + *  b) Permission is hereby granted, free of charge, to any person
> >> > + * obtaining a copy of this software and associated documentation
> >> > + * files (the "Software"), to deal in the Software without
> >> > + * restriction, including without limitation the rights to use,
> >> > + * copy, modify, merge, publish, distribute, sublicense, and/or
> >> > + * sell copies of the Software, and to permit persons to whom the
> >> > + * Software is furnished to do so, subject to the following
> >> > + * conditions:
> >> > + *
> >> > + * The above copyright notice and this permission notice shall be
> >> > + * included in all copies or substantial portions of the Software.
> >> > + *
> >> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> >> > + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> >> > + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> >> > + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> >> > + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> >> > + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> >> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> >> > + * OTHER DEALINGS IN THE SOFTWARE.
> >> > + */
> >> > +
> >> > +/dts-v1/;
> >> > +
> >> > +#include "sun50i-h5.dtsi"
> >> > +
> >> > +#include 
> >> > +
> >> > +/ {
> >> > +   model = "FriendlyARM NanoPi NEO Plus 2";
> >> > +   compatible = "friendlyarm,nanopi-neo-plus2", 
> >> > 

Re: [U-Boot] [PATCH v4 1/2] arm64: sun50i-h5.dtsi : add h5 & a64 compatible to mmc[0-2]

2017-10-10 Thread Antony Antony
On Tue, Oct 10, 2017 at 07:21:57PM +0530, Jagan Teki wrote:
> On Tue, Oct 10, 2017 at 7:18 PM, Peter Robinson  wrote:
> > Shouldn't we just be syncing changes to the DT from the kernel?
>

I guess syncing could possibly solve the problem! Kernel DTSI got the 
compiltables I need from the begining.

The diff looks big to me. I am not sure yet, I understand all changes.  
Anyone who would like to sync the two files? Or willing to help me?
 
diff ~/u-boot/arch/arm/dts/sun50i-h5.dtsi 
~/linux/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
 
> And add last merge commit details on commit message.

A good point. I am wondering what is the practice for this u-boot commit 
message. I do not see commit IDs mentioned. A few commits seems to mention 
kernel version in the commit message.

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


Re: [U-Boot] [PATCH v4 2/2] sun50i: h5: Add NanoPi Neo Plus2 DT initial support

2017-10-10 Thread Jagan Teki
On Tue, Oct 10, 2017 at 10:26 PM, Antony Antony  wrote:
> On Tue, Oct 10, 2017 at 07:28:23PM +0530, Jagan Teki wrote:
>> On Tue, Oct 10, 2017 at 7:15 PM, Antony Antony  wrote:
>> > Add initial DT for NanoPi NEO Plus2 by FriendlyARM
>> > - Allwinner quad core H5 Cortex A53 with an ARM Mali-450MP GPU
>> > - 1 GB DDR3 RAM
>> > - 8GB eMMC flash (Samsung KLM8G1WEPD-B031)
>> > - micro SD card slot
>> > - Gigabit Ethernet (external RTL8211E-VB-CG chip)
>> > - 802.11 b/g/n WiFi, Bluetooth 4.0 (Ampak AP6212A module)
>> > - 2x USB 2.0 host ports
>> >
>> > Signed-off-by: Antony Antony 
>> > ---
>> >  arch/arm/dts/Makefile   |   1 +
>> >  arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts | 106 
>> > 
>> >  configs/nanopi_neo_plus2_defconfig  |  18 +
>> >  3 files changed, 125 insertions(+)
>> >  create mode 100644 arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
>> >  create mode 100644 configs/nanopi_neo_plus2_defconfig
>> > ---
>> > Changes v1->v2
>> >  removed memory {}, compatible ="allwinner,sun5i-a13-mmc"
>> >  remove CONFIG_SPL_SPI_FLASH_SUPPORT=y and CONFIG_SPL_SPI_SUNXI=y (no SPI)
>> >  remove CONFIG_SD_BOOT=y
>> > Changes v2->v3
>> >  removed compatible ="allwinner,sun50i-a64-mmc"
>> > Changes v3->v4
>> >  removed compatible from mmc0
>> >  add h5 & a64 compaitable to sun50i-h5.dtsi
>> >
>> > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
>> > index 5b90280..879ff24 100644
>> > --- a/arch/arm/dts/Makefile
>> > +++ b/arch/arm/dts/Makefile
>> > @@ -335,6 +335,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \
>> > sun8i-v3s-licheepi-zero.dtb
>> >  dtb-$(CONFIG_MACH_SUN50I_H5) += \
>> > sun50i-h5-nanopi-neo2.dtb \
>> > +   sun50i-h5-nanopi-neo-plus2.dtb \
>> > sun50i-h5-orangepi-pc2.dtb \
>> > sun50i-h5-orangepi-prime.dtb \
>> > sun50i-h5-orangepi-zero-plus2.dtb
>> > diff --git a/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts 
>> > b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
>> > new file mode 100644
>> > index 000..f1406c2
>> > --- /dev/null
>> > +++ b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
>> > @@ -0,0 +1,106 @@
>> > +/*
>> > + * Copyright (C) 2017 Antony Antony 
>> > + * Copyright (c) 2016 ARM Ltd.
>> > + *
>> > + * This file is dual-licensed: you can use it either under the terms
>> > + * of the GPL or the X11 license, at your option. Note that this dual
>> > + * licensing only applies to this file, and not this project as a
>> > + * whole.
>> > + *
>> > + *  a) This library is free software; you can redistribute it and/or
>> > + * modify it under the terms of the GNU General Public License as
>> > + * published by the Free Software Foundation; either version 2 of the
>> > + * License, or (at your option) any later version.
>> > + *
>> > + * This library is distributed in the hope that it will be useful,
>> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> > + * GNU General Public License for more details.
>> > + *
>> > + * Or, alternatively,
>> > + *
>> > + *  b) Permission is hereby granted, free of charge, to any person
>> > + * obtaining a copy of this software and associated documentation
>> > + * files (the "Software"), to deal in the Software without
>> > + * restriction, including without limitation the rights to use,
>> > + * copy, modify, merge, publish, distribute, sublicense, and/or
>> > + * sell copies of the Software, and to permit persons to whom the
>> > + * Software is furnished to do so, subject to the following
>> > + * conditions:
>> > + *
>> > + * The above copyright notice and this permission notice shall be
>> > + * included in all copies or substantial portions of the Software.
>> > + *
>> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
>> > + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
>> > + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
>> > + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
>> > + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
>> > + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
>> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
>> > + * OTHER DEALINGS IN THE SOFTWARE.
>> > + */
>> > +
>> > +/dts-v1/;
>> > +
>> > +#include "sun50i-h5.dtsi"
>> > +
>> > +#include 
>> > +
>> > +/ {
>> > +   model = "FriendlyARM NanoPi NEO Plus 2";
>> > +   compatible = "friendlyarm,nanopi-neo-plus2", "allwinner,sun50i-h5";
>> > +
>> > +   aliases {
>> > +   serial0 = 
>> > +   };
>> > +
>> > +   chosen {
>> > +   stdout-path = "serial0:115200n8";
>> > +   };
>> > +
>> > +   reg_vcc3v3: vcc3v3 {
>> > +   compatible = "regulator-fixed";

Re: [U-Boot] [PATCH v4 2/2] sun50i: h5: Add NanoPi Neo Plus2 DT initial support

2017-10-10 Thread Antony Antony
On Tue, Oct 10, 2017 at 07:28:23PM +0530, Jagan Teki wrote:
> On Tue, Oct 10, 2017 at 7:15 PM, Antony Antony  wrote:
> > Add initial DT for NanoPi NEO Plus2 by FriendlyARM
> > - Allwinner quad core H5 Cortex A53 with an ARM Mali-450MP GPU
> > - 1 GB DDR3 RAM
> > - 8GB eMMC flash (Samsung KLM8G1WEPD-B031)
> > - micro SD card slot
> > - Gigabit Ethernet (external RTL8211E-VB-CG chip)
> > - 802.11 b/g/n WiFi, Bluetooth 4.0 (Ampak AP6212A module)
> > - 2x USB 2.0 host ports
> >
> > Signed-off-by: Antony Antony 
> > ---
> >  arch/arm/dts/Makefile   |   1 +
> >  arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts | 106 
> > 
> >  configs/nanopi_neo_plus2_defconfig  |  18 +
> >  3 files changed, 125 insertions(+)
> >  create mode 100644 arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
> >  create mode 100644 configs/nanopi_neo_plus2_defconfig
> > ---
> > Changes v1->v2
> >  removed memory {}, compatible ="allwinner,sun5i-a13-mmc"
> >  remove CONFIG_SPL_SPI_FLASH_SUPPORT=y and CONFIG_SPL_SPI_SUNXI=y (no SPI)
> >  remove CONFIG_SD_BOOT=y
> > Changes v2->v3
> >  removed compatible ="allwinner,sun50i-a64-mmc"
> > Changes v3->v4
> >  removed compatible from mmc0
> >  add h5 & a64 compaitable to sun50i-h5.dtsi
> >
> > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> > index 5b90280..879ff24 100644
> > --- a/arch/arm/dts/Makefile
> > +++ b/arch/arm/dts/Makefile
> > @@ -335,6 +335,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \
> > sun8i-v3s-licheepi-zero.dtb
> >  dtb-$(CONFIG_MACH_SUN50I_H5) += \
> > sun50i-h5-nanopi-neo2.dtb \
> > +   sun50i-h5-nanopi-neo-plus2.dtb \
> > sun50i-h5-orangepi-pc2.dtb \
> > sun50i-h5-orangepi-prime.dtb \
> > sun50i-h5-orangepi-zero-plus2.dtb
> > diff --git a/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts 
> > b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
> > new file mode 100644
> > index 000..f1406c2
> > --- /dev/null
> > +++ b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
> > @@ -0,0 +1,106 @@
> > +/*
> > + * Copyright (C) 2017 Antony Antony 
> > + * Copyright (c) 2016 ARM Ltd.
> > + *
> > + * This file is dual-licensed: you can use it either under the terms
> > + * of the GPL or the X11 license, at your option. Note that this dual
> > + * licensing only applies to this file, and not this project as a
> > + * whole.
> > + *
> > + *  a) This library is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License as
> > + * published by the Free Software Foundation; either version 2 of the
> > + * License, or (at your option) any later version.
> > + *
> > + * This library is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * Or, alternatively,
> > + *
> > + *  b) Permission is hereby granted, free of charge, to any person
> > + * obtaining a copy of this software and associated documentation
> > + * files (the "Software"), to deal in the Software without
> > + * restriction, including without limitation the rights to use,
> > + * copy, modify, merge, publish, distribute, sublicense, and/or
> > + * sell copies of the Software, and to permit persons to whom the
> > + * Software is furnished to do so, subject to the following
> > + * conditions:
> > + *
> > + * The above copyright notice and this permission notice shall be
> > + * included in all copies or substantial portions of the Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> > + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> > + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> > + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> > + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> > + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> > + * OTHER DEALINGS IN THE SOFTWARE.
> > + */
> > +
> > +/dts-v1/;
> > +
> > +#include "sun50i-h5.dtsi"
> > +
> > +#include 
> > +
> > +/ {
> > +   model = "FriendlyARM NanoPi NEO Plus 2";
> > +   compatible = "friendlyarm,nanopi-neo-plus2", "allwinner,sun50i-h5";
> > +
> > +   aliases {
> > +   serial0 = 
> > +   };
> > +
> > +   chosen {
> > +   stdout-path = "serial0:115200n8";
> > +   };
> > +
> > +   reg_vcc3v3: vcc3v3 {
> > +   compatible = "regulator-fixed";
> > +   regulator-name = "vcc3v3";
> > +   regulator-min-microvolt = <330>;
> > +   regulator-max-microvolt = <330>;
> > +   };
> > +};
> > +
> 

Re: [U-Boot] Broadwell-DE bare metal

2017-10-10 Thread Zoran Stojsavljevic
> To start porting I was planning to copy all the files of the board
minnowmax and rename it with the name of our product.
> I saw that minnowmax use FSP 1.0 exactly like Broadwell-DE. I hope that
helps.

You might want to join Coreboot mailing list. I am 1000% sure this will
help you far beyond your expectations.

Zoran

On Tue, Oct 10, 2017 at 2:29 PM, vnktux  wrote:

> Hi Simon,
>
> Thanks for the info. I already have all the necessary blobs from the
> current working implementation with Coreboot + U-Boot: FPS, ME, Microcode,
> Flash Descriptor, VGA Rom.
>
> To start porting I was planning to copy all the files of the board
> minnowmax and rename it with the name of our product. I saw that minnowmax
> use FSP 1.0 exactly like Broadwell-DE. I hope that helps.
>
> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>
> >  Original Message 
> > Subject: Re: [U-Boot] Broadwell-DE bare metal
> > Local Time: October 9, 2017 4:43 PM
> > UTC Time: October 9, 2017 2:43 PM
> > From: s...@chromium.org
> > To: vnktux 
> > u-boot@lists.denx.de 
> >
> > Hi,
> >
> > On 3 October 2017 at 08:58, vnktux  wrote:
> >> Hi all,
> >>
> >> For my graduation project my company asked to use U-Boot as bare metal
> boot-loader on one of their product. The product in an embedded board with
> a Xeon Broadwell-DE D-1527 Quad Core. The current boot-loader consist of
> Coreboot + U-Boot, but of course they want to get rid of Coreboot. I have
> almost no experience with U-Boot (Just with ARM processor a little bit) and
> so far I don"t even know if it"s possible or not to achieve the final goal.
> What I have understood is that I need the following binary blobs to work:
> fsp.bin, vga.bin, descriptor.bin, me.bin, microcode.bin. Is it true? Can
> somebody point me in the right direction because I am a little bit lost?
> Plus I don"t see many x86 boards implemented in the source code of U-Boot.
> >
> > The original U-Boot payload support was done with Broadwell-DE (I"m
> > not sure which one though). It allows U-Boot to boot from EFI.
> >
> > For what you want, yes you will need to obtain various binary blobs.
> > Hopefully you can get the FSP from Intel, and with that the work
> > required in U-Boot is probably not too large. Although I"m sure that
> > the FSP API will have changed a little.
> >
> > Regards,
> > Simon
> >
> >>
> >> Best regards,
> >> Vincenzo
> >>
> >> Sent with [ProtonMail](https://protonmail.com) Secure Email.
> >> ___
> >> U-Boot mailing list
> >> U-Boot@lists.denx.de
> >> https://lists.denx.de/listinfo/u-boot
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/2] mx6slevk: Remove some DM drivers

2017-10-10 Thread Fabio Estevam
While having DM driver is a good thing, currently this defconfig
is completely broken in a way that SD cards can not even be detected.

Remove some of the DM drivers to avoid the regression for now
and allow booting a kernel stored in the SD card again.

Re-adding the DM drivers can be revisited later.

Signed-off-by: Fabio Estevam 
---
Applied on top of:

https://patchwork.ozlabs.org/patch/820477/

and

https://patchwork.ozlabs.org/patch/820298/

 configs/mx6slevk_defconfig | 11 +--
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/configs/mx6slevk_defconfig b/configs/mx6slevk_defconfig
index c876c6b..51735ec 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,MX6SL,SYS_I2C"
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_HUSH_PARSER=y
@@ -29,21 +29,12 @@ CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_DM=y
 # CONFIG_BLK is not set
-CONFIG_DM_GPIO=y
-CONFIG_DM_I2C=y
-CONFIG_DM_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_PHYLIB=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
-CONFIG_DM_PMIC=y
-CONFIG_DM_PMIC_PFUZE100=y
-CONFIG_DM_REGULATOR=y
-CONFIG_DM_REGULATOR_PFUZE100=y
-CONFIG_DM_REGULATOR_FIXED=y
-CONFIG_DM_REGULATOR_GPIO=y
 CONFIG_DM_THERMAL=y
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
-- 
2.7.4

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


[U-Boot] [PATCH 1/2] mx6slevk: Call gpio_request()

2017-10-10 Thread Fabio Estevam
We should call gpio_request() prior to reading the GPIO value.

Signed-off-by: Fabio Estevam 
---
Applied on top of:

https://patchwork.ozlabs.org/patch/820477/

and

https://patchwork.ozlabs.org/patch/820298/

 board/freescale/mx6slevk/mx6slevk.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/freescale/mx6slevk/mx6slevk.c 
b/board/freescale/mx6slevk/mx6slevk.c
index e9a9bbf..ab72765 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -309,12 +309,15 @@ int board_mmc_getcd(struct mmc *mmc)
 
switch (cfg->esdhc_base) {
case USDHC1_BASE_ADDR:
+   gpio_request(USDHC1_CD_GPIO, "cd1_gpio");
ret = !gpio_get_value(USDHC1_CD_GPIO);
break;
case USDHC2_BASE_ADDR:
+   gpio_request(USDHC2_CD_GPIO, "cd2_gpio");
ret = !gpio_get_value(USDHC2_CD_GPIO);
break;
case USDHC3_BASE_ADDR:
+   gpio_request(USDHC3_CD_GPIO, "cd3_gpio");
ret = !gpio_get_value(USDHC3_CD_GPIO);
break;
}
-- 
2.7.4

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


[U-Boot] [PATCH] fs/jffs2/mini_inflate.c: use "static inline" instead of "inline"

2017-10-10 Thread Vagrant Cascadian
This makes gcc no longer expect an out-of-line version of the
functions being present elsewhere.

This fixes a failure to build on several marvell targets with gcc-7 on
Debian:

  https://bugs.debian.org/877963

Signed-off-by: Adrian Bunk 
Signed-off-by: Vagrant Cascadian 
---

 fs/jffs2/mini_inflate.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/jffs2/mini_inflate.c b/fs/jffs2/mini_inflate.c
index 2f13412f98..7bfbdb6801 100644
--- a/fs/jffs2/mini_inflate.c
+++ b/fs/jffs2/mini_inflate.c
@@ -16,7 +16,7 @@
 static unsigned char huffman_order[] = {16, 17, 18,  0,  8,  7,  9,  6, 10,  5,
11,  4, 12,  3, 13,  2, 14,  1, 15};
 
-inline void cramfs_memset(int *s, const int c, size n)
+static inline void cramfs_memset(int *s, const int c, size n)
 {
n--;
for (;n > 0; n--) s[n] = c;
@@ -65,8 +65,8 @@ static void init_stream(struct bitstream *stream, unsigned 
char *data,
 /* pull 'bits' bits out of the stream. The last bit pulled it returned as the
  * msb. (section 3.1.1)
  */
-inline unsigned long pull_bits(struct bitstream *stream,
-  const unsigned int bits)
+static inline unsigned long pull_bits(struct bitstream *stream,
+ const unsigned int bits)
 {
unsigned long ret;
int i;
@@ -85,7 +85,7 @@ inline unsigned long pull_bits(struct bitstream *stream,
return ret;
 }
 
-inline int pull_bit(struct bitstream *stream)
+static inline int pull_bit(struct bitstream *stream)
 {
int ret = ((*(stream->data) >> stream->bit) & 1);
if (stream->bit++ == 7) {
-- 
2.11.0

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


Re: [U-Boot] efi_loader: don't increment part twice per loop

2017-10-10 Thread Alexander Graf
> Correct a mistake in the part number handling of
> 16a73b249d138fedeb188710533902ed7aac1ddc and only increment part once
> per loop.
> 
> Signed-off-by: Jonathan Gray 
> Tested-by: Peter Robinson 

Thanks, applied to efi-next

Alex

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


Re: [U-Boot] [PATCH v1 1/3] test/py: gpt: update test_gpt

2017-10-10 Thread Stephen Warren

On 10/10/2017 06:50 AM, Patrick DELAUNAY wrote:

Hi Stephen,


-Original Message-
From: Stephen Warren [mailto:swar...@wwwdotorg.org]

On 10/09/2017 01:47 AM, Patrick Delaunay wrote:

- copy the reference gpt binary file as it is modified during the test
to avoid issue if the test fail: the test always restart with clean
file
- update tests to highlight detected issues on gpt swap command
(offset and size of partition are modified)
- add test for gpt verfiy, gpt read and gpt write



@@ -109,9 +142,29 @@ def test_gpt_swap_partitions(state_disk_image, 
u_boot_console):

   u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
   output = u_boot_console.run_command('part list host 0')
-assert '0x07ff "first"' in output
-assert '0x17ff "second"' in output
+assert '0x0800 0x0a00  "first"' in output
+assert '0x1000 0x1200  "second"' in output


I'm not sure why this change is required. I can see two separate changes
here:

1) Verifies the value of 3 columns of data not just 2. That seems fine.

2) Changes the expected value in the column before the partition name.
I'm not sure about this; shouldn't the value stay the same, or is the test 
failing
right now?


in fact it the purpose of my modification in patch 3/3 : cmd: gpt: solve issue 
for swap

The command gpt swap (or gpt remane) don't expect change the offset or the size 
of the partition
but it is the case today , it is an error in code and it is not detected with 
the current test

In the modified test, I test the expected correct values (3 columns): without 
modification of the offset and size.

=> the test if failing for master branch
=> the test is OK only after " patch 3/3 : cmd: gpt: solve issue for swap"

But I don't sure of the correct patchset order to avoid issue during merge in 
master branch

First Test update  => test Failed
Then patch the code => test OK

Or

First patch the code => test Failed
Then patch the test => test OK


I'd suggest something like:

Patch 1: Modify the test to check the value for all 3 columns in a way 
that passes with the current implementation of the command. Perhaps add 
a comment that there's a bug in the code, and remove it in the next 
patch. The test should pass both before and after this patch.


Patch 2: Fix the bug in the GPT command, and in the same patch, change 
the values that test_gpt expects so that it passes again. The test 
should pass both before and after this patch.

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


[U-Boot] [PATCH v5 15/18] rockchip: rk3188: use boot0 hook to load up SPL in 2 steps

2017-10-10 Thread Philipp Tomsich
For the RK3188, the BROM will attempt to load up the first stage
image (SPL for the RK3188) in two steps: first 1KB to offset 0x800
in the SRAM and then the remainder to offset 0xc00 in the SRAM.
It always enters at 0x804, though.

With this changeset, the RK3188 boot removes the TPL (stub) stage and
builds a single SPL binary that utilizes the early back-to-bootrom via
the boot0-hook.

Consequently, the passing of the saved boot params via pmu->os_reg[2]
is also removed.

Signed-off-by: Philipp Tomsich 
---

Changes in v5: None
Changes in v4:
- after merging the 'back-to-bootrom' series with the 'boot0-hook'
  series, this drops the TPL stub and builds only a single SPL image
  that uses the 'early back-to-bootrom' logic originally implemented
  by Pawel for the RK3066.
- changes the SPL_STACK_BASE to +0x800 (from +0x804), as the boot0
  hook already reserves the space for the SPL magic (previously
  inserted by mkimage)

Changes in v3: None
Changes in v2:
- [added in v2] chain back_to_bootrom calls for SPL, first returning
  to the TPL (using the same mechanism) and the to the BROM from the
  TPL

 arch/arm/mach-rockchip/Kconfig|  2 +-
 arch/arm/mach-rockchip/Makefile   |  1 -
 arch/arm/mach-rockchip/rk3188-board-spl.c | 10 
 arch/arm/mach-rockchip/rk3188-board-tpl.c | 86 ---
 doc/README.rockchip   | 10 ++--
 include/configs/rk3188_common.h   | 12 ++---
 6 files changed, 9 insertions(+), 112 deletions(-)
 delete mode 100644 arch/arm/mach-rockchip/rk3188-board-tpl.c

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index d59a1d5..09f2c45 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -18,7 +18,7 @@ config ROCKCHIP_RK3188
select SUPPORT_SPL
select SUPPORT_TPL
select SPL
-   select TPL
+   select SPL_ROCKCHIP_EARLYRETURN_TO_BROM
select BOARD_LATE_INIT
select ROCKCHIP_BROM_HELPER
help
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index b875dfc..c15e9bf 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -11,7 +11,6 @@
 obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
 obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
 
-obj-tpl-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o
 obj-tpl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-tpl.o
 obj-tpl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-tpl.o
 
diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c 
b/arch/arm/mach-rockchip/rk3188-board-spl.c
index 406207e..05d4ae6 100644
--- a/arch/arm/mach-rockchip/rk3188-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
@@ -101,7 +101,6 @@ static int setup_arm_clock(void)
 void board_init_f(ulong dummy)
 {
struct udevice *pinctrl, *dev;
-   struct rk3188_pmu *pmu;
int ret;
 
/* Example code showing how to enable the debug UART on RK3188 */
@@ -145,15 +144,6 @@ void board_init_f(ulong dummy)
return;
}
 
-   /*
-* Recover the bootrom's stackpointer.
-* For whatever reason needs to run after rockchip_get_clk.
-*/
-   pmu = syscon_get_first_range(ROCKCHIP_SYSCON_PMU);
-   if (IS_ERR(pmu))
-   pr_err("pmu syscon returned %ld\n", PTR_ERR(pmu));
-   SAVE_SP_ADDR = readl(>sys_reg[2]);
-
ret = uclass_get_device(UCLASS_PINCTRL, 0, );
if (ret) {
debug("Pinctrl init failed: %d\n", ret);
diff --git a/arch/arm/mach-rockchip/rk3188-board-tpl.c 
b/arch/arm/mach-rockchip/rk3188-board-tpl.c
deleted file mode 100644
index b458ef6..000
--- a/arch/arm/mach-rockchip/rk3188-board-tpl.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * (C) Copyright 2015 Google, Inc
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* track how often we were entered */
-static int rk3188_num_entries __attribute__ ((section(".data")));
-
-#define PMU_BASE   0x20004000
-#define SPL_ENTRY  0x10080C00
-
-static void jump_to_spl(void)
-{
-   typedef void __noreturn (*image_entry_noargs_t)(void);
-
-   struct rk3188_pmu * const pmu = (void *)PMU_BASE;
-   image_entry_noargs_t tpl_entry =
-   (image_entry_noargs_t)(unsigned long)SPL_ENTRY;
-
-   /* Store the SAVE_SP_ADDR in a location shared with SPL. */
-   writel(SAVE_SP_ADDR, >sys_reg[2]);
-   tpl_entry();
-}
-
-void board_init_f(ulong dummy)
-{
-   /* Example code showing how to enable the debug UART on RK3188 */
-#ifdef EARLY_UART
-#include 
-   /* Enable early UART on the RK3188 */
-#define GRF_BASE   0x20008000
-   struct rk3188_grf * const grf = (void *)GRF_BASE;
-
-   rk_clrsetreg(>gpio1b_iomux,
-GPIO1B1_MASK << GPIO1B1_SHIFT |
-GPIO1B0_MASK << GPIO1B0_SHIFT,
- 

[U-Boot] [PATCH v5 17/18] rockchip: rk3188: move CONFIG_SPL_* entries from rk3188_common.h to Kconfig

2017-10-10 Thread Philipp Tomsich
There still are a few CONFIG_SPL_* options selected using defines from
rk3188_common.h instead of via Kconfig.  This migrates those over to
Kconfig.

Signed-off-by: Philipp Tomsich 
---

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

 arch/arm/mach-rockchip/Kconfig  | 7 ++-
 include/configs/rk3188_common.h | 6 --
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 09f2c45..36df484 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -16,8 +16,13 @@ config ROCKCHIP_RK3188
select CPU_V7
select SPL_BOARD_INIT if SPL
select SUPPORT_SPL
-   select SUPPORT_TPL
select SPL
+   select SPL_CLK
+   select SPL_PINCTRL
+   select SPL_REGMAP
+   select SPL_SYSCON
+   select SPL_RAM
+   select SPL_DRIVERS_MISC_SUPPORT
select SPL_ROCKCHIP_EARLYRETURN_TO_BROM
select BOARD_LATE_INIT
select ROCKCHIP_BROM_HELPER
diff --git a/include/configs/rk3188_common.h b/include/configs/rk3188_common.h
index 9824a10..0382450 100644
--- a/include/configs/rk3188_common.h
+++ b/include/configs/rk3188_common.h
@@ -41,12 +41,6 @@
 /* spl size 32kb sram - 2kb bootrom */
 #define CONFIG_SPL_MAX_SIZE(0x8000 - 0x800)
 #define CONFIG_SPL_FRAMEWORK   1
-#define CONFIG_SPL_CLK 1
-#define CONFIG_SPL_PINCTRL 1
-#define CONFIG_SPL_REGMAP  1
-#define CONFIG_SPL_SYSCON  1
-#define CONFIG_SPL_RAM 1
-#define CONFIG_SPL_DRIVERS_MISC_SUPPORT1
 #define CONFIG_ROCKCHIP_SERIAL 1
 
 #define CONFIG_SPL_STACK   0x10087fff
-- 
2.1.4

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


[U-Boot] [PATCH v5 16/18] rockchip: back-to-bootrom: allow passing a cmd to the bootrom

2017-10-10 Thread Philipp Tomsich
The BROM supports forcing it to enter download-mode, if an appropriate
result/cmd-word is returned to it.  There already is a series to
support this in review, so this prepares the (newly C-version) of the
back-to-bootrom code to accept a cmd to passed on to the BROM.

All the existing call-sites are adjusted to match the changed function
signature.

Signed-off-by: Philipp Tomsich 
Tested-by: Andy Yan 

---

Changes in v5: None
Changes in v4:
- no longer updates rk3188-board-tpl.c (as we have just removed it
  in an earlier commit)

Changes in v3: None
Changes in v2:
- also covers the RK3188 (which I had originally missed)

 arch/arm/include/asm/arch-rockchip/bootrom.h | 5 -
 arch/arm/mach-rockchip/bootrom.c | 4 ++--
 arch/arm/mach-rockchip/rk3036-board-spl.c| 2 +-
 arch/arm/mach-rockchip/rk3188-board-spl.c| 4 ++--
 arch/arm/mach-rockchip/rk322x-board-spl.c| 2 +-
 arch/arm/mach-rockchip/rk3288-board-spl.c| 4 ++--
 arch/arm/mach-rockchip/rk3288-board-tpl.c| 2 +-
 arch/arm/mach-rockchip/rk3368-board-tpl.c| 2 +-
 arch/arm/mach-rockchip/rk3399-board-spl.c| 2 +-
 9 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/bootrom.h 
b/arch/arm/include/asm/arch-rockchip/bootrom.h
index 2f61a33..103b799 100644
--- a/arch/arm/include/asm/arch-rockchip/bootrom.h
+++ b/arch/arm/include/asm/arch-rockchip/bootrom.h
@@ -24,6 +24,9 @@ extern u32 SAVE_SP_ADDR;
  * download mode, ...).
  *
  * This function does not return.
+ *
+ * @brom_cmd: indicates how the bootrom should continue the boot
+ *sequence (e.g. load the next stage)
  */
 enum rockchip_bootrom_cmd {
/*
@@ -35,7 +38,7 @@ enum rockchip_bootrom_cmd {
BROM_BOOT_ENTER_DNL,  /* have BROM enter download-mode */
 };
 
-void back_to_bootrom(void);
+void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd);
 
 /**
  * Boot-device identifiers as used by the BROM
diff --git a/arch/arm/mach-rockchip/bootrom.c b/arch/arm/mach-rockchip/bootrom.c
index 7b9b307..e369fdc 100644
--- a/arch/arm/mach-rockchip/bootrom.c
+++ b/arch/arm/mach-rockchip/bootrom.c
@@ -15,12 +15,12 @@
  */
 static jmp_buf brom_ctx __section(".data");
 
-void back_to_bootrom(void)
+void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd)
 {
 #if CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT)
puts("Returning to boot ROM...\n");
 #endif
-   longjmp(brom_ctx, BROM_BOOT_NEXTSTAGE);
+   longjmp(brom_ctx, brom_cmd);
 }
 
 /*
diff --git a/arch/arm/mach-rockchip/rk3036-board-spl.c 
b/arch/arm/mach-rockchip/rk3036-board-spl.c
index 9458201..550e3a1 100644
--- a/arch/arm/mach-rockchip/rk3036-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3036-board-spl.c
@@ -40,7 +40,7 @@ void board_init_f(ulong dummy)
sdram_init();
 
/* return to maskrom */
-   back_to_bootrom();
+   back_to_bootrom(BROM_BOOT_NEXTSTAGE);
 }
 
 /* Place Holders */
diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c 
b/arch/arm/mach-rockchip/rk3188-board-spl.c
index 05d4ae6..8e3b8ae 100644
--- a/arch/arm/mach-rockchip/rk3188-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
@@ -158,7 +158,7 @@ void board_init_f(ulong dummy)
 
setup_arm_clock();
 #if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM) && !defined(CONFIG_SPL_BOARD_INIT)
-   back_to_bootrom();
+   back_to_bootrom(BROM_BOOT_NEXTSTAGE);
 #endif
 }
 
@@ -219,7 +219,7 @@ void spl_board_init(void)
 
preloader_console_init();
 #if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
-   back_to_bootrom();
+   back_to_bootrom(BROM_BOOT_NEXTSTAGE);
 #endif
return;
 
diff --git a/arch/arm/mach-rockchip/rk322x-board-spl.c 
b/arch/arm/mach-rockchip/rk322x-board-spl.c
index 4ddb8ba..35f4f97 100644
--- a/arch/arm/mach-rockchip/rk322x-board-spl.c
+++ b/arch/arm/mach-rockchip/rk322x-board-spl.c
@@ -76,6 +76,6 @@ void board_init_f(ulong dummy)
/* Disable the ddr secure region setting to make it non-secure */
rk_clrreg(SGRF_DDR_CON0, 0x4000);
 #if defined(CONFIG_ROCKCHIP_SPL_BACK_TO_BROM) && 
!defined(CONFIG_SPL_BOARD_INIT)
-   back_to_bootrom();
+   back_to_bootrom(BROM_BOOT_NEXTSTAGE);
 #endif
 }
diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c 
b/arch/arm/mach-rockchip/rk3288-board-spl.c
index 7b7fd5a..f64a548 100644
--- a/arch/arm/mach-rockchip/rk3288-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
@@ -216,7 +216,7 @@ void board_init_f(ulong dummy)
 #endif
 
 #if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM) && !defined(CONFIG_SPL_BOARD_INIT)
-   back_to_bootrom();
+   back_to_bootrom(BROM_BOOT_NEXTSTAGE);
 #endif
 }
 
@@ -283,7 +283,7 @@ void spl_board_init(void)
 
preloader_console_init();
 #if CONFIG_IS_ENABLED(ROCKCHIP_BACK_TO_BROM)
-   back_to_bootrom();
+   back_to_bootrom(BROM_BOOT_NEXTSTAGE);
 #endif
return;
 err:
diff --git a/arch/arm/mach-rockchip/rk3288-board-tpl.c 

[U-Boot] [PATCH v5 18/18] rockchip: mkimage: remove unused code-paths (spl_boot0 is now implied)

2017-10-10 Thread Philipp Tomsich
With all targets converted to generate prepadded images, this removes
the spl_boot0 field from our config structure and removes the unused
code-path (for images that are not prepadded): i.e. spl_boot0 is now
implied as 'true' and the code is specialised by removing the other
case.

Signed-off-by: Philipp Tomsich 
---

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

 tools/rkcommon.c | 45 ++---
 1 file changed, 14 insertions(+), 31 deletions(-)

diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index c83260a..aed2b95 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -58,9 +58,6 @@ struct header1_info {
  * @spl_hdr:   Boot ROM requires a 4-bytes spl header
  * @spl_size:  Spl size(include extra 4-bytes spl header)
  * @spl_rc4:   RC4 encode the SPL binary (same key as header)
- * @spl_boot0:  A new-style (ARM_SOC_BOOT0_HOOK) image that should
- *  have the boot magic (e.g. 'RK33') written to its first
- *  word.
  */
 
 struct spl_info {
@@ -68,19 +65,18 @@ struct spl_info {
const char *spl_hdr;
const uint32_t spl_size;
const bool spl_rc4;
-   const bool spl_boot0;
 };
 
 static struct spl_info spl_infos[] = {
-   { "rk3036", "RK30", 0x1000, false, true },
-   { "rk3128", "RK31", 0x1800, false, true },
-   { "rk3188", "RK31", 0x8000 - 0x800, true, true },
-   { "rk322x", "RK32", 0x8000 - 0x1000, false, true },
-   { "rk3288", "RK32", 0x8000, false, true },
-   { "rk3328", "RK32", 0x8000 - 0x1000, false, true },
-   { "rk3368", "RK33", 0x8000 - 0x1000, false, true },
-   { "rk3399", "RK33", 0x3 - 0x2000, false, true },
-   { "rv1108", "RK11", 0x1800, false, true },
+   { "rk3036", "RK30", 0x1000, false },
+   { "rk3128", "RK31", 0x1800, false },
+   { "rk3188", "RK31", 0x8000 - 0x800, true },
+   { "rk322x", "RK32", 0x8000 - 0x1000, false },
+   { "rk3288", "RK32", 0x8000, false },
+   { "rk3328", "RK32", 0x8000 - 0x1000, false },
+   { "rk3368", "RK33", 0x8000 - 0x1000, false },
+   { "rk3399", "RK33", 0x3 - 0x2000, false },
+   { "rv1108", "RK11", 0x1800, false },
 };
 
 static unsigned char rc4_key[16] = {
@@ -158,16 +154,6 @@ bool rkcommon_need_rc4_spl(struct image_tool_params 
*params)
return info->spl_rc4;
 }
 
-bool rkcommon_spl_is_boot0(struct image_tool_params *params)
-{
-   struct spl_info *info = rkcommon_get_spl_info(params->imagename);
-
-   /*
-* info would not be NULL, because of we checked params before.
-*/
-   return info->spl_boot0;
-}
-
 static void rkcommon_set_header0(void *buf, uint file_size,
 struct image_tool_params *params)
 {
@@ -366,15 +352,12 @@ int rkcommon_vrec_header(struct image_tool_params *params,
 * have the first 4 bytes reserved for the spl_name).  Reserving
 * these 4 bytes is done using the BOOT0_HOOK infrastructure.
 *
-* Depending on this, the header is either 0x800 (if this is a
-* 'boot0'-style payload, which has reserved 4 bytes at the
-* beginning for the 'spl_name' and expects us to overwrite
-* its first 4 bytes) or 0x804 bytes in length.
+* The header is always at 0x800 (as we now use a payload
+* prepadded using the boot0 hook for all targets): the first
+* 4 bytes of these images can safely be overwritten using the
+* boot magic.
 */
-   if (rkcommon_spl_is_boot0(params))
-   tparams->header_size = RK_SPL_HDR_START;
-   else
-   tparams->header_size = RK_SPL_HDR_START + 4;
+   tparams->header_size = RK_SPL_HDR_START;
 
/* Allocate, clear and install the header */
tparams->hdr = malloc(tparams->header_size);
-- 
2.1.4

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


[U-Boot] [PATCH v5 10/18] rockchip: boot0 hook: support early return for RK3188/RK3066-style BROM

2017-10-10 Thread Philipp Tomsich
Some Rockchip BROM versions (e.g. the RK3188 and RK3066) first read 1KB data
from NAND into SRAM and executes it. Then, following a return to bootrom, the
BROM loads additional code to SRAM (not overwriting the first block read) and
reenters at the same address as the first time.

To support booting either a TPL (on the RK3066) or SPL (on the RK3188) using
this model of having to count entries, this commit adds code to the boot0
hook to track the number of entries and handle them accordingly.

Signed-off-by: Philipp Tomsich 
Signed-off-by: Paweł Jarosz 
Tested-by: Andy Yan 

---

Changes in v5:
- set return value to 0 before returning to the BROM

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

 arch/arm/include/asm/arch-rockchip/boot0.h | 25 +++--
 arch/arm/mach-rockchip/Kconfig | 28 
 2 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/boot0.h 
b/arch/arm/include/asm/arch-rockchip/boot0.h
index f7c6146..af3a733 100644
--- a/arch/arm/include/asm/arch-rockchip/boot0.h
+++ b/arch/arm/include/asm/arch-rockchip/boot0.h
@@ -19,12 +19,25 @@
 * beginning of the executable.  However, as we want to keep
 * this generic and make it applicable to builds that are like
 * the RK3368 (TPL needs this, SPL doesn't) or the RK3399 (no
-* TPL, but extra space needed in the SPL), we simply repeat
-* the 'b reset' with the expectation that the first one will
-* be overwritten, if this is the first stage contained in the
-* final image created with mkimage)...
+* TPL, but extra space needed in the SPL), we simply insert
+* a branch-to-next-instruction-word with the expectation that
+* the first one may be overwritten, if this is the first stage
+* contained in the final image created with mkimage)...
 */
-   b reset  /* may be overwritten --- should be 'nop' or a 'b reset' */
+   b 1f /* if overwritten, entry-address is at the next word */
+1:
+#endif
+#if CONFIG_IS_ENABLED(ROCKCHIP_EARLYRETURN_TO_BROM)
+   adr r3, entry_counter
+   ldr r0, [r3]
+   cmp r0, #1   /* check if entry_counter == 1 */
+   beq reset/* regular bootup */
+   add r0, #1
+   str r0, [r3] /* increment the entry_counter in memory */
+   mov r0, #0   /* return 0 to the BROM to signal 'OK' */
+   bx  lr   /* return control to the BROM */
+entry_counter:
+   .word   0
 #endif
b reset
 #if !defined(CONFIG_ARM64)
@@ -32,7 +45,7 @@
 * For armv7, the addr '_start' will used as vector start address
 * and write to VBAR register, which needs to aligned to 0x20.
 */
-   .align(5)
+   .align(5), 0x0
 _start:
ARM_VECTORS
 #endif
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 31e9864..d59a1d5 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -158,6 +158,34 @@ config ROCKCHIP_SPL_RESERVE_IRAM
 config ROCKCHIP_BROM_HELPER
bool
 
+config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
+bool "SPL requires early-return (for RK3188-style BROM) to BROM"
+   depends on SPL && ENABLE_ARM_SOC_BOOT0_HOOK
+   help
+ Some Rockchip BROM variants (e.g. on the RK3188) load the
+ first stage in segments and enter multiple times. E.g. on
+ the RK3188, the first 1KB of the first stage are loaded
+ first and entered; after returning to the BROM, the
+ remainder of the first stage is loaded, but the BROM
+ re-enters at the same address/to the same code as previously.
+
+ This enables support code in the BOOT0 hook for the SPL stage
+ to allow multiple entries.
+
+config TPL_ROCKCHIP_EARLYRETURN_TO_BROM
+bool "TPL requires early-return (for RK3188-style BROM) to BROM"
+   depends on TPL && ENABLE_ARM_SOC_BOOT0_HOOK
+   help
+ Some Rockchip BROM variants (e.g. on the RK3188) load the
+ first stage in segments and enter multiple times. E.g. on
+ the RK3188, the first 1KB of the first stage are loaded
+ first and entered; after returning to the BROM, the
+ remainder of the first stage is loaded, but the BROM
+ re-enters at the same address/to the same code as previously.
+
+ This enables support code in the BOOT0 hook for the TPL stage
+ to allow multiple entries.
+
 config SPL_MMC_SUPPORT
default y if !SPL_ROCKCHIP_BACK_TO_BROM
 
-- 
2.1.4

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


[U-Boot] [PATCH v5 14/18] rockchip: back-to-bootrom: replace assembly-implementation with C-code

2017-10-10 Thread Philipp Tomsich
The back-to-bootrom implementation for Rockchip has always relied on
the stack-pointer being valid on entry, so there was little reason to
have this as an assembly implementation.

This provides a new C-only implementation of save_boot_params and
back_to_bootrom (relying on setjmp/longjmp) and removes the older
assembly-only implementation.

Signed-off-by: Philipp Tomsich 
Tested-by: Andy Yan 
---

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

 arch/arm/include/asm/arch-rockchip/bootrom.h | 27 ---
 arch/arm/mach-rockchip/Makefile  |  4 +-
 arch/arm/mach-rockchip/bootrom.c | 52 -
 arch/arm/mach-rockchip/save_boot_param.S | 69 
 4 files changed, 73 insertions(+), 79 deletions(-)
 delete mode 100644 arch/arm/mach-rockchip/save_boot_param.S

diff --git a/arch/arm/include/asm/arch-rockchip/bootrom.h 
b/arch/arm/include/asm/arch-rockchip/bootrom.h
index 169cc5e..2f61a33 100644
--- a/arch/arm/include/asm/arch-rockchip/bootrom.h
+++ b/arch/arm/include/asm/arch-rockchip/bootrom.h
@@ -1,5 +1,6 @@
 /*
  * (C) Copyright 2017 Heiko Stuebner 
+ * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
  *
  * SPDX-License-Identifier:GPL-2.0
  */
@@ -14,15 +15,27 @@
 extern u32 SAVE_SP_ADDR;
 
 /**
- * Hand control back to the bootrom to load another
- * boot stage.
+ * back_to_bootrom() - return to bootrom (for TPL/SPL), passing a
+ * result code
+ *
+ * Transfer control back to the Rockchip BROM, restoring necessary
+ * register context and passing a command/result code to the BROM
+ * to instruct its next actions (e.g. continue boot sequence, enter
+ * download mode, ...).
+ *
+ * This function does not return.
  */
-void back_to_bootrom(void);
+enum rockchip_bootrom_cmd {
+   /*
+* These can not start at 0, as 0 has a special meaning
+* for setjmp().
+*/
 
-/**
- * Assembler component for the above (do not call this directly)
- */
-void _back_to_bootrom_s(void);
+   BROM_BOOT_NEXTSTAGE = 1,  /* continue boot-sequence */
+   BROM_BOOT_ENTER_DNL,  /* have BROM enter download-mode */
+};
+
+void back_to_bootrom(void);
 
 /**
  * Boot-device identifiers as used by the BROM
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index daafc8d..b875dfc 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -8,8 +8,8 @@
 # this may have entered from ATF with the stack-pointer pointing to
 # inaccessible/protected memory (and the bootrom-helper assumes that
 # the stack-pointer is valid before switching to the U-Boot stack).
-obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o save_boot_param.o
-obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o save_boot_param.o
+obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
+obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
 
 obj-tpl-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o
 obj-tpl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-tpl.o
diff --git a/arch/arm/mach-rockchip/bootrom.c b/arch/arm/mach-rockchip/bootrom.c
index 8380e4e..7b9b307 100644
--- a/arch/arm/mach-rockchip/bootrom.c
+++ b/arch/arm/mach-rockchip/bootrom.c
@@ -6,11 +6,61 @@
 
 #include 
 #include 
+#include 
+#include 
+
+/*
+ * Force the jmp_buf to the data-section, as .bss will not be valid
+ * when save_boot_params is invoked.
+ */
+static jmp_buf brom_ctx __section(".data");
 
 void back_to_bootrom(void)
 {
 #if CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT)
puts("Returning to boot ROM...\n");
 #endif
-   _back_to_bootrom_s();
+   longjmp(brom_ctx, BROM_BOOT_NEXTSTAGE);
+}
+
+/*
+ * All Rockchip BROM implementations enter with a valid stack-pointer,
+ * so this can safely be implemented in C (providing a single
+ * implementation both for ARMv7 and AArch64).
+ */
+int save_boot_params(void)
+{
+   int  ret = setjmp(brom_ctx);
+
+   switch (ret) {
+   case 0:
+   /*
+* This is the initial pass through this function
+* (i.e. saving the context), setjmp just setup up the
+* brom_ctx: transfer back into the startup-code at
+* 'save_boot_params_ret' and let the compiler know
+* that this will not return.
+*/
+   save_boot_params_ret();
+   while (true)
+   /* does not return */;
+   break;
+
+   case BROM_BOOT_NEXTSTAGE:
+   /*
+* To instruct the BROM to boot the next stage, we
+* need to return 0 to it: i.e. we need to rewrite
+* the return code once more.
+*/
+   ret = 0;
+   break;
+
+   default:
+#if CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT)
+   puts("FATAL: unexpected command to 

[U-Boot] [PATCH v5 11/18] arm: make save_boot_params_ret prototype visible for AArch64

2017-10-10 Thread Philipp Tomsich
The save_boot_params_ret() prototype (for those of us, that have a
valid SP on entry and can implement save_boot_params() in C), was
previously only defined for !defined(CONFIG_ARM64).

This moves the declaration to a common block to ensure the prototype
is available to everyone that might need it.

Signed-off-by: Philipp Tomsich 
Tested-by: Andy Yan 
---

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

 arch/arm/include/asm/system.h | 62 +--
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 79bd19a..e2af296 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -332,37 +332,6 @@ void psci_arch_init(void);
 
 #ifndef __ASSEMBLY__
 
-/**
- * save_boot_params() - Save boot parameters before starting reset sequence
- *
- * If you provide this function it will be called immediately U-Boot starts,
- * both for SPL and U-Boot proper.
- *
- * All registers are unchanged from U-Boot entry. No registers need be
- * preserved.
- *
- * This is not a normal C function. There is no stack. Return by branching to
- * save_boot_params_ret.
- *
- * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3);
- */
-
-/**
- * save_boot_params_ret() - Return from save_boot_params()
- *
- * If you provide save_boot_params(), then you should jump back to this
- * function when done. Try to preserve all registers.
- *
- * If your implementation of save_boot_params() is in C then it is acceptable
- * to simply call save_boot_params_ret() at the end of your function. Since
- * there is no link register set up, you cannot just exit the function. U-Boot
- * will return to the (initialised) value of lr, and likely crash/hang.
- *
- * If your implementation of save_boot_params() is in assembler then you
- * should use 'b' or 'bx' to return to save_boot_params_ret.
- */
-void save_boot_params_ret(void);
-
 #ifdef CONFIG_ARMV7_LPAE
 void switch_to_hypervisor_ret(void);
 #endif
@@ -556,6 +525,37 @@ void mmu_page_table_flush(unsigned long start, unsigned 
long stop);
 
 #ifndef __ASSEMBLY__
 /**
+ * save_boot_params() - Save boot parameters before starting reset sequence
+ *
+ * If you provide this function it will be called immediately U-Boot starts,
+ * both for SPL and U-Boot proper.
+ *
+ * All registers are unchanged from U-Boot entry. No registers need be
+ * preserved.
+ *
+ * This is not a normal C function. There is no stack. Return by branching to
+ * save_boot_params_ret.
+ *
+ * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3);
+ */
+
+/**
+ * save_boot_params_ret() - Return from save_boot_params()
+ *
+ * If you provide save_boot_params(), then you should jump back to this
+ * function when done. Try to preserve all registers.
+ *
+ * If your implementation of save_boot_params() is in C then it is acceptable
+ * to simply call save_boot_params_ret() at the end of your function. Since
+ * there is no link register set up, you cannot just exit the function. U-Boot
+ * will return to the (initialised) value of lr, and likely crash/hang.
+ *
+ * If your implementation of save_boot_params() is in assembler then you
+ * should use 'b' or 'bx' to return to save_boot_params_ret.
+ */
+void save_boot_params_ret(void);
+
+/**
  * Change the cache settings for a region.
  *
  * \param startstart address of memory region to change
-- 
2.1.4

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


[U-Boot] [PATCH v5 13/18] arm: provide a PCS-compliant setjmp implementation

2017-10-10 Thread Philipp Tomsich
The previous setjmp-implementation (as a static inline function that
contained an 'asm volatile' sequence) was extremely fragile: (some
versions of) GCC optimised the set of registers.  One critical example
was the removal of 'r9' from the clobber list, if -ffixed-reg9 was
supplied.

To increase robustness and ensure PCS-compliant behaviour, the setjmp
and longjmp implementation are now in assembly and closely match what
one would expect to find in a libc implementation.

Signed-off-by: Philipp Tomsich 
Tested-by: Andy Yan 

---

Changes in v5: None
Changes in v4: None
Changes in v3:
- converted setjmp/longjmp from inline-assembly to separate .S files
  to improve predicatability if emitted code

Changes in v2: None

 arch/arm/include/asm/setjmp.h | 94 ++-
 arch/arm/lib/Makefile |  6 +++
 arch/arm/lib/setjmp.S | 37 +
 arch/arm/lib/setjmp_aarch64.S | 42 +++
 4 files changed, 98 insertions(+), 81 deletions(-)
 create mode 100644 arch/arm/lib/setjmp.S
 create mode 100644 arch/arm/lib/setjmp_aarch64.S

diff --git a/arch/arm/include/asm/setjmp.h b/arch/arm/include/asm/setjmp.h
index c3399a7..517beeb 100644
--- a/arch/arm/include/asm/setjmp.h
+++ b/arch/arm/include/asm/setjmp.h
@@ -1,6 +1,6 @@
 /*
- * (C) Copyright 2016
- * Alexander Graf 
+ * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
+ * (C) Copyright 2016 Alexander Graf 
  *
  * SPDX-License-Identifier:GPL-2.0+
  */
@@ -8,89 +8,21 @@
 #ifndef _SETJMP_H_
 #define _SETJMP_H_ 1
 
+/*
+ * This really should be opaque, but the EFI implementation wrongly
+ * assumes that a 'struct jmp_buf_data' is defined.
+ */
 struct jmp_buf_data {
-   ulong target;
-   ulong regs[5];
-   int ret;
-};
-
-typedef struct jmp_buf_data jmp_buf[1];
-
-static inline int setjmp(jmp_buf jmp)
-{
-   jmp->ret = 0;
-
-#ifdef CONFIG_ARM64
-   asm volatile(
-   "adr x1, jmp_target\n"
-   "str x1, %0\n"
-   "stp x26, x27, %1\n"
-   "stp x28, x29, %2\n"
-   "mov x1, sp\n"
-   "str x1, %3\n"
-   "jmp_target: "
-   : "=m" (jmp->target), "=m" (jmp->regs[0]),
- "=m" (jmp->regs[2]), "=m" (jmp->regs[4])
-   :
-   : "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
- "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
- "x16", "x17", "x18", "x19", "x20", "x21", "x22",
- "x23", "x24", "x25", /* x26, x27, x28, x29, sp */
- "x30", "cc", "memory");
-#else
-   asm volatile(
-#if CONFIG_IS_ENABLED(SYS_THUMB_BUILD)
-   ".align 2\n"
-   "adr r0, jmp_target\n"
-   "add r0, r0, $1\n"
+#if defined(__aarch64__)
+   u64  regs[13];
 #else
-   "adr r0, jmp_target\n"
-#endif
-   "mov r1, %0\n"
-   "mov r2, sp\n"
-   "stm r1!, {r0, r2, r4, r5, r6, r7}\n"
-   ".align 2\n"
-   "jmp_target: \n"
-   :
-   : "l" (>target)
-   : "r0", "r1", "r2", "r3", /* "r4", "r5", "r6", "r7", */
- "r8", "r9", "r10", "r11", /* sp, */ "ip", "lr",
- "cc", "memory");
-#endif
-
-   return jmp->ret;
-}
-
-static inline __noreturn void longjmp(jmp_buf jmp, int ret)
-{
-   jmp->ret = ret;
-
-#ifdef CONFIG_ARM64
-   asm volatile(
-   "ldr x0, %0\n"
-   "ldr x1, %3\n"
-   "mov sp, x1\n"
-   "ldp x26, x27, %1\n"
-   "ldp x28, x25, %2\n"
-   "mov x29, x25\n"
-   "br x0\n"
-   :
-   : "m" (jmp->target), "m" (jmp->regs[0]), "m" (jmp->regs[2]),
- "m" (jmp->regs[4])
-   : "x0", "x1", "x25", "x26", "x27", "x28");
-#else
-   asm volatile(
-   "mov r1, %0\n"
-   "ldm r1!, {r0, r2, r4, r5, r6, r7}\n"
-   "mov sp, r2\n"
-   "bx r0\n"
-   :
-   : "l" (>target)
-   : "r1");
+   u32  regs[10];  /* r4-r9, sl, fp, sp, lr */
 #endif
+};
 
-   while (1) { }
-}
+typedef struct jmp_buf_data jmp_buf[1];
 
+int setjmp(jmp_buf jmp);
+void longjmp(jmp_buf jmp, int ret);
 
 #endif /* _SETJMP_H_ */
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 6e1c436..abffa10 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -17,6 +17,12 @@ else
 obj-y  += vectors.o crt0.o
 endif
 
+ifdef CONFIG_ARM64
+obj-y   += setjmp_aarch64.o
+else
+obj-y   += setjmp.o
+endif
+
 ifndef CONFIG_SPL_BUILD
 ifdef CONFIG_ARM64
 obj-y  += relocate_64.o
diff --git a/arch/arm/lib/setjmp.S b/arch/arm/lib/setjmp.S
new file mode 100644
index 000..6746e5e
--- /dev/null
+++ b/arch/arm/lib/setjmp.S
@@ -0,0 +1,37 @@
+/*
+ * (C) 2017 

[U-Boot] [PATCH v5 08/18] bcm235xx: boot0 hook: adjust to unified boot0 semantics

2017-10-10 Thread Philipp Tomsich
This updates the BCM235xx boot0-hook to the updated boot0 semantics
by emitting _start and the vector table before the boot0 hook (as
was the case before).

Signed-off-by: Philipp Tomsich 

Version-changes: 5
- ran 'whitespace-cleanup'

---

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

 arch/arm/include/asm/arch-bcm235xx/boot0.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/arch-bcm235xx/boot0.h 
b/arch/arm/include/asm/arch-bcm235xx/boot0.h
index a747bd3..28f05ba 100644
--- a/arch/arm/include/asm/arch-bcm235xx/boot0.h
+++ b/arch/arm/include/asm/arch-bcm235xx/boot0.h
@@ -5,5 +5,7 @@
  */
 
 /* BOOT0 header information */
+_start:
+   ARM_VECTORS
.word   0xbabeface
.word   _end - _start
-- 
2.1.4

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


[U-Boot] [PATCH v5 06/18] rockchip: rk3036: use aligned address for SPL_TEXT_BASE

2017-10-10 Thread Philipp Tomsich
With the boot0-hook inserting the additional padding to receive our
SPL magic, the SPL_TEXT_BASE can be aligned again.

Signed-off-by: Philipp Tomsich 
---

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

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

diff --git a/include/configs/rk3036_common.h b/include/configs/rk3036_common.h
index 9ac0df5..a387099 100644
--- a/include/configs/rk3036_common.h
+++ b/include/configs/rk3036_common.h
@@ -26,7 +26,7 @@
 #define CONFIG_SYS_INIT_SP_ADDR0x6010
 #define CONFIG_SYS_LOAD_ADDR   0x60800800
 #define CONFIG_SPL_STACK   0x10081fff
-#define CONFIG_SPL_TEXT_BASE   0x10081004
+#define CONFIG_SPL_TEXT_BASE   0x10081000
 
 #define CONFIG_ROCKCHIP_MAX_INIT_SIZE  (4 << 10)
 #define CONFIG_ROCKCHIP_CHIP_TAG   "RK30"
-- 
2.1.4

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


[U-Boot] [PATCH v5 12/18] arm: mark save_boot_params_ret as a function

2017-10-10 Thread Philipp Tomsich
As no '.type' was set for save_boot_params_ret in start.S, binutils
did not track whether it was emitted as A32 or T32.  By properly
marking save_boot_params_ret as a potential function entry, we can
make sure that the compiler will insert the appropriate instructions
for branching to save_boot_params_ret both for call-sites emitted as
A32 and T32.

Reported-by: Andy Yan 
Signed-off-by: Philipp Tomsich 
Tested-by: Andy Yan 

---

Changes in v5: None
Changes in v4: None
Changes in v3:
- tracked the root-cause why no interwork branch was emitted and fixed
  it using a '.type'-directive in start.S to mark save_boot_params_ret
  as a (possible) function-entry.

Changes in v2: None

 arch/arm/cpu/armv7/start.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S
index 7b84a7a..95a0b52 100644
--- a/arch/arm/cpu/armv7/start.S
+++ b/arch/arm/cpu/armv7/start.S
@@ -31,6 +31,7 @@
 
.globl  reset
.globl  save_boot_params_ret
+   .type   save_boot_params_ret,%function
 #ifdef CONFIG_ARMV7_LPAE
.global switch_to_hypervisor_ret
 #endif
-- 
2.1.4

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


[U-Boot] [PATCH v5 07/18] socfpga: boot0 hook: adjust to unified boot0 semantics

2017-10-10 Thread Philipp Tomsich
With the updated boot0 semantics (i.e. giving the boot0-hook control
over when and where the vector table is emitted), the boot0-hook for
the socfpga needs to be adjusted.

Signed-off-by: Philipp Tomsich 
---

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

 arch/arm/mach-socfpga/include/mach/boot0.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-socfpga/include/mach/boot0.h 
b/arch/arm/mach-socfpga/include/mach/boot0.h
index 22d9e7f..d6b9435 100644
--- a/arch/arm/mach-socfpga/include/mach/boot0.h
+++ b/arch/arm/mach-socfpga/include/mach/boot0.h
@@ -7,6 +7,9 @@
 #ifndef __BOOT0_H
 #define __BOOT0_H
 
+_start:
+   ARM_VECTORS
+
 #ifdef CONFIG_SPL_BUILD
.balignl 64,0xf33db33f;
 
-- 
2.1.4

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


[U-Boot] [PATCH v5 09/18] bcm281xx: boot0 hook: adjust to unified boot0 semantics

2017-10-10 Thread Philipp Tomsich
This updates the BCM281xx boot0-hook to the updated boot0 semantics
by emitting _start and the vector table before the boot0 hook (as
was the case before).

Signed-off-by: Philipp Tomsich 
---

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

 arch/arm/include/asm/arch-bcm281xx/boot0.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/arch-bcm281xx/boot0.h 
b/arch/arm/include/asm/arch-bcm281xx/boot0.h
index a747bd3..28f05ba 100644
--- a/arch/arm/include/asm/arch-bcm281xx/boot0.h
+++ b/arch/arm/include/asm/arch-bcm281xx/boot0.h
@@ -5,5 +5,7 @@
  */
 
 /* BOOT0 header information */
+_start:
+   ARM_VECTORS
.word   0xbabeface
.word   _end - _start
-- 
2.1.4

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


[U-Boot] [PATCH v5 03/18] rockchip: enable boot0-hook for all Rockchip SoCs

2017-10-10 Thread Philipp Tomsich
Rockchip SoCs bootrom design is like this:
- First 2KB or 4KB internal memory is for bootrom stack and heap;
- Then the first 4-byte suppose to be a TAG like 'RK33';
- The the following memory address end with '0004' is the first
  instruction load and running by bootrom;

Let's use the boot0 hook to reserve the first 4-byte tag for all
the Rockchip SoCs.

Signed-off-by: Philipp Tomsich 
[Commit message:]
Signed-off-by: Kever Yang 

Signed-off-by: Philipp Tomsich 
---

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

 arch/arm/Kconfig   | 1 +
 arch/arm/mach-rockchip/Kconfig | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 64e0ee4..585e5b0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1117,6 +1117,7 @@ config ARCH_ROCKCHIP
select DM_USB if USB
select DM_PWM
select DM_REGULATOR
+   select ENABLE_ARM_SOC_BOOT0_HOOK
imply CMD_FASTBOOT
imply FASTBOOT
imply FAT_WRITE
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index d9b25d5..31e9864 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -74,7 +74,6 @@ config ROCKCHIP_RK3368
imply SPL_SEPARATE_BSS
imply SPL_SERIAL_SUPPORT
imply TPL_SERIAL_SUPPORT
-   select ENABLE_ARM_SOC_BOOT0_HOOK
select DEBUG_UART_BOARD_INIT
select SYS_NS16550
help
@@ -112,7 +111,6 @@ config ROCKCHIP_RK3399
select SPL_SEPARATE_BSS
select SPL_SERIAL_SUPPORT
select SPL_DRIVERS_MISC_SUPPORT
-   select ENABLE_ARM_SOC_BOOT0_HOOK
select DEBUG_UART_BOARD_INIT
help
  The Rockchip RK3399 is a ARM-based SoC with a dual-core Cortex-A72
-- 
2.1.4

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


[U-Boot] [PATCH v5 02/18] rockchip: boot0: align to 0x20 for armv7 '_start'

2017-10-10 Thread Philipp Tomsich
From: Kever Yang 

The '_start' is using as vector table base address, and will write
to VBAR register, so it needs to be aligned to 0x20 for armv7.

Signed-off-by: Kever Yang 
[Updated to current code base:]
Signed-off-by: Philipp Tomsich 

---

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

 arch/arm/include/asm/arch-rockchip/boot0.h | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/boot0.h 
b/arch/arm/include/asm/arch-rockchip/boot0.h
index 455d842..f7c6146 100644
--- a/arch/arm/include/asm/arch-rockchip/boot0.h
+++ b/arch/arm/include/asm/arch-rockchip/boot0.h
@@ -6,12 +6,13 @@
 
 /*
  * Execution starts on the instruction following this 4-byte header
- * (containing the magic 'RK33').
+ * (containing the magic 'RK30', 'RK31', 'RK32' or 'RK33').  This
+ * magic constant will be written into the final image by the rkimage
+ * tool, but we need to reserve space for it here.
  *
  * To make life easier for everyone, we build the SPL binary with
  * space for this 4-byte header already included in the binary.
  */
-
 #ifdef CONFIG_SPL_BUILD
/*
 * We need to add 4 bytes of space for the 'RK33' at the
@@ -26,6 +27,15 @@
b reset  /* may be overwritten --- should be 'nop' or a 'b reset' */
 #endif
b reset
+#if !defined(CONFIG_ARM64)
+   /*
+* For armv7, the addr '_start' will used as vector start address
+* and write to VBAR register, which needs to aligned to 0x20.
+*/
+   .align(5)
+_start:
+   ARM_VECTORS
+#endif
 
 #if defined(CONFIG_ROCKCHIP_RK3399) && defined(CONFIG_SPL_BUILD)
.space CONFIG_ROCKCHIP_SPL_RESERVE_IRAM /* space for the ATF data */
-- 
2.1.4

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


[U-Boot] [PATCH v5 04/18] rockchip: mkimage: use spl_boot0 for all Rockchip SoCs

2017-10-10 Thread Philipp Tomsich
From: Kever Yang 

Enable the spl_boot0 in SPL and use the pre-padding TAG memory,
the mkimage do not need to pad it but only need to replace the value
with correct TAG value.

Signed-off-by: Kever Yang 
[Updated:]
Signed-off-by: Philipp Tomsich 

---

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

 tools/rkcommon.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/rkcommon.c b/tools/rkcommon.c
index 1a24e16..c83260a 100644
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -72,15 +72,15 @@ struct spl_info {
 };
 
 static struct spl_info spl_infos[] = {
-   { "rk3036", "RK30", 0x1000, false, false },
-   { "rk3128", "RK31", 0x1800, false, false },
-   { "rk3188", "RK31", 0x8000 - 0x800, true, false },
-   { "rk322x", "RK32", 0x8000 - 0x1000, false, false },
-   { "rk3288", "RK32", 0x8000, false, false },
-   { "rk3328", "RK32", 0x8000 - 0x1000, false, false },
+   { "rk3036", "RK30", 0x1000, false, true },
+   { "rk3128", "RK31", 0x1800, false, true },
+   { "rk3188", "RK31", 0x8000 - 0x800, true, true },
+   { "rk322x", "RK32", 0x8000 - 0x1000, false, true },
+   { "rk3288", "RK32", 0x8000, false, true },
+   { "rk3328", "RK32", 0x8000 - 0x1000, false, true },
{ "rk3368", "RK33", 0x8000 - 0x1000, false, true },
{ "rk3399", "RK33", 0x3 - 0x2000, false, true },
-   { "rv1108", "RK11", 0x1800, false, false},
+   { "rv1108", "RK11", 0x1800, false, true },
 };
 
 static unsigned char rc4_key[16] = {
-- 
2.1.4

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


[U-Boot] [PATCH v5 05/18] rockchip: rk3288: use aligned address for SPL_TEXT_BASE

2017-10-10 Thread Philipp Tomsich
From: Kever Yang 

After we use boot0 hook, we can use offset '000' instead of '004' as
SPL_TEXT_BASE.

Signed-off-by: Kever Yang 
[Updated tag in commit summary:]
Signed-off-by: Philipp Tomsich 

---

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

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

diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h
index 34f2558..9201cb6 100644
--- a/include/configs/rk3288_common.h
+++ b/include/configs/rk3288_common.h
@@ -35,7 +35,7 @@
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_TPL_BOOTROM_SUPPORT)
 # define CONFIG_SPL_TEXT_BASE  0x0
 #else
-# define CONFIG_SPL_TEXT_BASE  0xff704004
+# define CONFIG_SPL_TEXT_BASE  0xff704000
 #endif
 
 /* MMC/SD IP block */
-- 
2.1.4

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


[U-Boot] [PATCH v5 01/18] arm: boot0 hook: move boot0 hook before '_start'

2017-10-10 Thread Philipp Tomsich
The boot0 hook on ARM does not insert its payload before the vector
table. This is both a mismatch with thec comment above it and
contradict usage of the boot0 hook on ARM64.

To fix this (and unify the semantics for ARM and ARM64), we change the
boot0-hook semantics on ARM to match those on ARM64:
  (1) if a boot0-hook is present it is inserted at the start of
  the image
  (2) if a boot0-hook is present, emitting the ARM vector table
  (and the _start) symbol are suppressed in vectors.S and
  the boot0-hook has full control over where and when it
  wants to emit these

Signed-off-by: Philipp Tomsich 
---

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

 arch/arm/include/asm/arch-rockchip/boot0.h |  1 -
 arch/arm/lib/vectors.S | 54 +++---
 2 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/boot0.h 
b/arch/arm/include/asm/arch-rockchip/boot0.h
index 72d264b..455d842 100644
--- a/arch/arm/include/asm/arch-rockchip/boot0.h
+++ b/arch/arm/include/asm/arch-rockchip/boot0.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2017 Theobroma Systems Design und Consulting GmbH
  *
diff --git a/arch/arm/lib/vectors.S b/arch/arm/lib/vectors.S
index 1019091..9cb0d2e 100644
--- a/arch/arm/lib/vectors.S
+++ b/arch/arm/lib/vectors.S
@@ -16,6 +16,22 @@
 #include 
 
 /*
+ * A macro to allow insertion of an ARM exception vector either
+ * for the non-boot0 case or by a boot0-header.
+ */
+.macro ARM_VECTORS
+   b   reset
+   ldr pc, _undefined_instruction
+   ldr pc, _software_interrupt
+   ldr pc, _prefetch_abort
+   ldr pc, _data_abort
+   ldr pc, _not_used
+   ldr pc, _irq
+   ldr pc, _fiq
+   .endm
+
+
+/*
  *
  *
  * Symbol _start is referenced elsewhere, so make it global
@@ -35,6 +51,23 @@
 
.section ".vectors", "ax"
 
+#if defined(CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK)
+/*
+ * Various SoCs need something special and SoC-specific up front in
+ * order to boot, allow them to set that in their boot0.h file and then
+ * use it here.
+ *
+ * To allow a boot0 hook to insert a 'special' sequence after the vector
+ * table (e.g. for the socfpga), the presence of a boot0 hook supresses
+ * the below vector table and assumes that the vector table is filled in
+ * by the boot0 hook.  The requirements for a boot0 hook thus are:
+ *   (1) defines '_start:' as appropriate
+ *   (2) inserts the vector table using ARM_VECTORS as appropriate
+ */
+#include 
+
+#else
+
 /*
  *
  *
@@ -46,28 +79,11 @@
  */
 
 _start:
-
 #ifdef CONFIG_SYS_DV_NOR_BOOT_CFG
.word   CONFIG_SYS_DV_NOR_BOOT_CFG
 #endif
-
-   b   reset
-   ldr pc, _undefined_instruction
-   ldr pc, _software_interrupt
-   ldr pc, _prefetch_abort
-   ldr pc, _data_abort
-   ldr pc, _not_used
-   ldr pc, _irq
-   ldr pc, _fiq
-
-#ifdef CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK
-/*
- * Various SoCs need something special and SoC-specific up front in
- * order to boot, allow them to set that in their boot0.h file and then
- * use it here.
- */
-#include 
-#endif
+   ARM_VECTORS
+#endif /* !defined(CONFIG_ENABLE_ARM_SOC_BOOT0_HOOK) */
 
 /*
  *
-- 
2.1.4

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


Re: [U-Boot] [PATCH] dwc: ep0: Allocate and flush dwc->ep0_trb in a cache aligned manner

2017-10-10 Thread Marek Vasut
On 10/10/2017 12:45 PM, Faiz Abbas wrote:
> Hi Marek,
> 
> On Tuesday 10 October 2017 01:30 PM, Marek Vasut wrote:
>> On 10/10/2017 07:48 AM, Kishon Vijay Abraham I wrote:
>>> Hi,
>>
>> Hi,
>>
>> [...]
>>
> - dwc3_flush_cache((uintptr_t)trb, sizeof(*trb));
> + dwc3_flush_cache((uintptr_t)dwc->ep0_trb_addr, sizeof(*trb) * 
> 2);

 Why *2 ?
>>>
>>> Because its allocated as sizeof(*dwc->ep0_trb) * 2 below. This is 
>>> not
>>> strictly required as dwc3_flush_cache() rounds up the size to
>>> CACHELINE_SIZE but from a caller POV, flush everything we allocated.
>>
>> Can the other TRB be in use ? Maybe aligning the TRBs to cacheline 
>> size
>> would be better ?
>>
> A single trb is 16 bytes in size and two of them are allocated
> contiguously.

 Why are two allocated continuously ? (I am not dwc3 expert)
>>>
>>> The TRB's should be allocated contiguously for dwc3 and only the base of the
>>> entire TRB table is programmed in the HW.
>>>   <-- TRB table base address
>>> | TRB0   |
>>> ||
>>> | TRB1   |
>>> ||
>>> | TRB2   |
>>> ||
>>> | TRBn   |
>>> ||
>>>
>>>
>>>
>>> Neither am I. I did try to pad to the dwc_trb structure such that each
>>> trb is 64 bytes in size but this leads to failures when testing. I
>>> didn't get a chance to debug this though. I suspect its because the code
>>> expects the trbs to be contiguous and/or 16 bytes in size.
>>>
>>> It's not the code but it's the HW.
>>
>> That'd imply we need either some sort of flushing scheme or non-cachable
>> memory allocation. What does Linux do ?
>> The dma_alloc_coherent in linux kernel allocates non-cachable memory.
> 
> Currently, the code is using local variable trb to flush the cache. When
> the first trb is used, dwc3_flush_cache flushes the complete
> CACHELINE_SIZE (including the 2nd trb).
> When the 2nd trb is used to flush cache, since it is an unaligned flush,
> it will issue a warning and will align it to the lower cache line
> boundary (flushing the 1st trb in the process).
> 
> So with or without this patch, both trbs are getting flushed with every
> call. With the patch, we can just avoid misaligned messages by always
> flushing using an aligned address.

What worries me is that you can flush something into the memory while
the controller is writing into it as well. Is that possible ?

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


Re: [U-Boot] [PATCH V2] ARM: imx6: Add DHCOM i.MX6 PDK board support

2017-10-10 Thread Marek Vasut
On 10/10/2017 04:04 PM, Jagan Teki wrote:
> On Tue, Oct 10, 2017 at 7:10 PM, Marek Vasut  wrote:
>> On 10/10/2017 03:32 PM, Jagan Teki wrote:
>>> On Tue, Oct 10, 2017 at 1:21 AM, Marek Vasut  wrote:
 Add support for the DHCOM i.MX6 PDK board. This board has:
 - FEC ethernet
 - EHCI USB host
 - 3x SDMMC

 Signed-off-by: Marek Vasut 
 Cc: Stefano Babic 
 ---
 V2: Use get_cpu_type() and imx_get_mac_from_fuse()
 ---
  arch/arm/mach-imx/mx6/Kconfig |  10 +
  board/dhelectronics/dh_imx6/Kconfig   |  12 +
  board/dhelectronics/dh_imx6/MAINTAINERS   |   7 +
  board/dhelectronics/dh_imx6/Makefile  |  11 +
  board/dhelectronics/dh_imx6/dh_imx6.c | 437 
 ++
  board/dhelectronics/dh_imx6/dh_imx6_spl.c | 399 
 +++
  configs/dh_imx6_defconfig |  51 
  include/configs/dh_imx6.h | 191 +
  8 files changed, 1118 insertions(+)
  create mode 100644 board/dhelectronics/dh_imx6/Kconfig
  create mode 100644 board/dhelectronics/dh_imx6/MAINTAINERS
  create mode 100644 board/dhelectronics/dh_imx6/Makefile
  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6.c
  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6_spl.c
  create mode 100644 configs/dh_imx6_defconfig
  create mode 100644 include/configs/dh_imx6.h

 diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
 index 540f2b29b1..b82db3af22 100644
 --- a/arch/arm/mach-imx/mx6/Kconfig
 +++ b/arch/arm/mach-imx/mx6/Kconfig
 @@ -129,6 +129,15 @@ config TARGET_COLIBRI_IMX6
 select DM_SERIAL
 select DM_THERMAL

 +config TARGET_DHCOMIMX6
 +   bool "dh_imx6"
 +   select BOARD_LATE_INIT
 +   select BOARD_EARLY_INIT_F
 +   select SUPPORT_SPL
 +   select DM
 +   select DM_THERMAL
 +   imply CMD_SPL
>>>
>>> I would suggest to add new boards with DTS along with enabling
>>> dm-driven drivers, this would eventually improve i.MX tree toward
>>> using new feature set.
>>
>> Enabling unused stuff and adding bloat ? Nope :)
> 
> OK, but we still have useful stuff:
> 
> DM_ETH
> DM_GPIO
> DM_I2C
> DM_MMC
> DM_SPI
> DM_SPI_FLASH

This discussion is moot, it is NOT useful here and it just adds bloat.

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


Re: [U-Boot] [PATCH V2] ARM: imx6: Add DHCOM i.MX6 PDK board support

2017-10-10 Thread Jagan Teki
On Tue, Oct 10, 2017 at 7:10 PM, Marek Vasut  wrote:
> On 10/10/2017 03:32 PM, Jagan Teki wrote:
>> On Tue, Oct 10, 2017 at 1:21 AM, Marek Vasut  wrote:
>>> Add support for the DHCOM i.MX6 PDK board. This board has:
>>> - FEC ethernet
>>> - EHCI USB host
>>> - 3x SDMMC
>>>
>>> Signed-off-by: Marek Vasut 
>>> Cc: Stefano Babic 
>>> ---
>>> V2: Use get_cpu_type() and imx_get_mac_from_fuse()
>>> ---
>>>  arch/arm/mach-imx/mx6/Kconfig |  10 +
>>>  board/dhelectronics/dh_imx6/Kconfig   |  12 +
>>>  board/dhelectronics/dh_imx6/MAINTAINERS   |   7 +
>>>  board/dhelectronics/dh_imx6/Makefile  |  11 +
>>>  board/dhelectronics/dh_imx6/dh_imx6.c | 437 
>>> ++
>>>  board/dhelectronics/dh_imx6/dh_imx6_spl.c | 399 +++
>>>  configs/dh_imx6_defconfig |  51 
>>>  include/configs/dh_imx6.h | 191 +
>>>  8 files changed, 1118 insertions(+)
>>>  create mode 100644 board/dhelectronics/dh_imx6/Kconfig
>>>  create mode 100644 board/dhelectronics/dh_imx6/MAINTAINERS
>>>  create mode 100644 board/dhelectronics/dh_imx6/Makefile
>>>  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6.c
>>>  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6_spl.c
>>>  create mode 100644 configs/dh_imx6_defconfig
>>>  create mode 100644 include/configs/dh_imx6.h
>>>
>>> diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
>>> index 540f2b29b1..b82db3af22 100644
>>> --- a/arch/arm/mach-imx/mx6/Kconfig
>>> +++ b/arch/arm/mach-imx/mx6/Kconfig
>>> @@ -129,6 +129,15 @@ config TARGET_COLIBRI_IMX6
>>> select DM_SERIAL
>>> select DM_THERMAL
>>>
>>> +config TARGET_DHCOMIMX6
>>> +   bool "dh_imx6"
>>> +   select BOARD_LATE_INIT
>>> +   select BOARD_EARLY_INIT_F
>>> +   select SUPPORT_SPL
>>> +   select DM
>>> +   select DM_THERMAL
>>> +   imply CMD_SPL
>>
>> I would suggest to add new boards with DTS along with enabling
>> dm-driven drivers, this would eventually improve i.MX tree toward
>> using new feature set.
>
> Enabling unused stuff and adding bloat ? Nope :)

OK, but we still have useful stuff:

DM_ETH
DM_GPIO
DM_I2C
DM_MMC
DM_SPI
DM_SPI_FLASH

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v4 2/2] sun50i: h5: Add NanoPi Neo Plus2 DT initial support

2017-10-10 Thread Jagan Teki
On Tue, Oct 10, 2017 at 7:15 PM, Antony Antony  wrote:
> Add initial DT for NanoPi NEO Plus2 by FriendlyARM
> - Allwinner quad core H5 Cortex A53 with an ARM Mali-450MP GPU
> - 1 GB DDR3 RAM
> - 8GB eMMC flash (Samsung KLM8G1WEPD-B031)
> - micro SD card slot
> - Gigabit Ethernet (external RTL8211E-VB-CG chip)
> - 802.11 b/g/n WiFi, Bluetooth 4.0 (Ampak AP6212A module)
> - 2x USB 2.0 host ports
>
> Signed-off-by: Antony Antony 
> ---
>  arch/arm/dts/Makefile   |   1 +
>  arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts | 106 
> 
>  configs/nanopi_neo_plus2_defconfig  |  18 +
>  3 files changed, 125 insertions(+)
>  create mode 100644 arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
>  create mode 100644 configs/nanopi_neo_plus2_defconfig
> ---
> Changes v1->v2
>  removed memory {}, compatible ="allwinner,sun5i-a13-mmc"
>  remove CONFIG_SPL_SPI_FLASH_SUPPORT=y and CONFIG_SPL_SPI_SUNXI=y (no SPI)
>  remove CONFIG_SD_BOOT=y
> Changes v2->v3
>  removed compatible ="allwinner,sun50i-a64-mmc"
> Changes v3->v4
>  removed compatible from mmc0
>  add h5 & a64 compaitable to sun50i-h5.dtsi
>
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 5b90280..879ff24 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -335,6 +335,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \
> sun8i-v3s-licheepi-zero.dtb
>  dtb-$(CONFIG_MACH_SUN50I_H5) += \
> sun50i-h5-nanopi-neo2.dtb \
> +   sun50i-h5-nanopi-neo-plus2.dtb \
> sun50i-h5-orangepi-pc2.dtb \
> sun50i-h5-orangepi-prime.dtb \
> sun50i-h5-orangepi-zero-plus2.dtb
> diff --git a/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts 
> b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
> new file mode 100644
> index 000..f1406c2
> --- /dev/null
> +++ b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
> @@ -0,0 +1,106 @@
> +/*
> + * Copyright (C) 2017 Antony Antony 
> + * Copyright (c) 2016 ARM Ltd.
> + *
> + * This file is dual-licensed: you can use it either under the terms
> + * of the GPL or the X11 license, at your option. Note that this dual
> + * licensing only applies to this file, and not this project as a
> + * whole.
> + *
> + *  a) This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of the
> + * License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * Or, alternatively,
> + *
> + *  b) Permission is hereby granted, free of charge, to any person
> + * obtaining a copy of this software and associated documentation
> + * files (the "Software"), to deal in the Software without
> + * restriction, including without limitation the rights to use,
> + * copy, modify, merge, publish, distribute, sublicense, and/or
> + * sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following
> + * conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> + * included in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> + * OTHER DEALINGS IN THE SOFTWARE.
> + */
> +
> +/dts-v1/;
> +
> +#include "sun50i-h5.dtsi"
> +
> +#include 
> +
> +/ {
> +   model = "FriendlyARM NanoPi NEO Plus 2";
> +   compatible = "friendlyarm,nanopi-neo-plus2", "allwinner,sun50i-h5";
> +
> +   aliases {
> +   serial0 = 
> +   };
> +
> +   chosen {
> +   stdout-path = "serial0:115200n8";
> +   };
> +
> +   reg_vcc3v3: vcc3v3 {
> +   compatible = "regulator-fixed";
> +   regulator-name = "vcc3v3";
> +   regulator-min-microvolt = <330>;
> +   regulator-max-microvolt = <330>;
> +   };
> +};
> +
> + {
> +   status = "okay";
> +};

Does this tested? need to have in Linux first.

> +
> + {
> +   pinctrl-names = "default";
> +   pinctrl-0 = <_pins_a>, <_cd_pin>;
> +   vmmc-supply = <_vcc3v3>;
> +   bus-width = <4>;
> +   cd-gpios = < 5 6 GPIO_ACTIVE_HIGH>;
> +   

Re: [U-Boot] [PATCH v4 1/2] arm64: sun50i-h5.dtsi : add h5 & a64 compatible to mmc[0-2]

2017-10-10 Thread Jagan Teki
On Tue, Oct 10, 2017 at 7:18 PM, Peter Robinson  wrote:
> Shouldn't we just be syncing changes to the DT from the kernel?

And add last merge commit details on commit message.

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v4 1/2] arm64: sun50i-h5.dtsi : add h5 & a64 compatible to mmc[0-2]

2017-10-10 Thread Peter Robinson
Shouldn't we just be syncing changes to the DT from the kernel?

On Tue, Oct 10, 2017 at 2:35 PM, Antony Antony  wrote:
> add more specific,  Allwinner H5 SoC, compaitable to mmc0,1,2
> current one comes from sun8i-h3.dtsi
> compatible = "allwinner,sun7i-a20-mmc", "allwinner,sun5i-a13-mmc";
>
> Signed-off-by: Antony Antony 
> ---
>  arch/arm/dts/sun50i-h5.dtsi | 12 
>  1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm/dts/sun50i-h5.dtsi b/arch/arm/dts/sun50i-h5.dtsi
> index 4904c18..1f4c1d1 100644
> --- a/arch/arm/dts/sun50i-h5.dtsi
> +++ b/arch/arm/dts/sun50i-h5.dtsi
> @@ -75,3 +75,15 @@
>   {
> compatible = "arm,gic-400";
>  };
> +
> + {
> +   compatible = "allwinner,sun50i-h5-mmc", "allwinner,sun50i-a64-mmc";
> +};
> +
> + {
> +   compatible = "allwinner,sun50i-h5-mmc", "allwinner,sun50i-a64-mmc";
> +};
> +
> + {
> +   compatible = "allwinner,sun50i-h5-mmc", "allwinner,sun50i-a64-mmc";
> +};
> --
> 2.7.4
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v4 2/2] sun50i: h5: Add NanoPi Neo Plus2 DT initial support

2017-10-10 Thread Antony Antony
Add initial DT for NanoPi NEO Plus2 by FriendlyARM
- Allwinner quad core H5 Cortex A53 with an ARM Mali-450MP GPU
- 1 GB DDR3 RAM
- 8GB eMMC flash (Samsung KLM8G1WEPD-B031)
- micro SD card slot
- Gigabit Ethernet (external RTL8211E-VB-CG chip)
- 802.11 b/g/n WiFi, Bluetooth 4.0 (Ampak AP6212A module)
- 2x USB 2.0 host ports

Signed-off-by: Antony Antony 
---
 arch/arm/dts/Makefile   |   1 +
 arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts | 106 
 configs/nanopi_neo_plus2_defconfig  |  18 +
 3 files changed, 125 insertions(+)
 create mode 100644 arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
 create mode 100644 configs/nanopi_neo_plus2_defconfig
---
Changes v1->v2
 removed memory {}, compatible ="allwinner,sun5i-a13-mmc"
 remove CONFIG_SPL_SPI_FLASH_SUPPORT=y and CONFIG_SPL_SPI_SUNXI=y (no SPI)
 remove CONFIG_SD_BOOT=y
Changes v2->v3
 removed compatible ="allwinner,sun50i-a64-mmc"
Changes v3->v4
 removed compatible from mmc0
 add h5 & a64 compaitable to sun50i-h5.dtsi

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 5b90280..879ff24 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -335,6 +335,7 @@ dtb-$(CONFIG_MACH_SUN8I_V3S) += \
sun8i-v3s-licheepi-zero.dtb
 dtb-$(CONFIG_MACH_SUN50I_H5) += \
sun50i-h5-nanopi-neo2.dtb \
+   sun50i-h5-nanopi-neo-plus2.dtb \
sun50i-h5-orangepi-pc2.dtb \
sun50i-h5-orangepi-prime.dtb \
sun50i-h5-orangepi-zero-plus2.dtb
diff --git a/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts 
b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
new file mode 100644
index 000..f1406c2
--- /dev/null
+++ b/arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dts
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2017 Antony Antony 
+ * Copyright (c) 2016 ARM Ltd.
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "sun50i-h5.dtsi"
+
+#include 
+
+/ {
+   model = "FriendlyARM NanoPi NEO Plus 2";
+   compatible = "friendlyarm,nanopi-neo-plus2", "allwinner,sun50i-h5";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   reg_vcc3v3: vcc3v3 {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc3v3";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>, <_cd_pin>;
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <4>;
+   cd-gpios = < 5 6 GPIO_ACTIVE_HIGH>;
+   cd-inverted;
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_8bit_pins>;
+   vmmc-supply = <_vcc3v3>;
+   bus-width = <8>;
+   non-removable;
+   cap-mmc-hw-reset;
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   pinctrl-names = "default";
+   pinctrl-0 = <_pins_a>;
+   status = 

Re: [U-Boot] [PATCH V2] ARM: imx6: Add DHCOM i.MX6 PDK board support

2017-10-10 Thread Marek Vasut
On 10/10/2017 03:32 PM, Jagan Teki wrote:
> On Tue, Oct 10, 2017 at 1:21 AM, Marek Vasut  wrote:
>> Add support for the DHCOM i.MX6 PDK board. This board has:
>> - FEC ethernet
>> - EHCI USB host
>> - 3x SDMMC
>>
>> Signed-off-by: Marek Vasut 
>> Cc: Stefano Babic 
>> ---
>> V2: Use get_cpu_type() and imx_get_mac_from_fuse()
>> ---
>>  arch/arm/mach-imx/mx6/Kconfig |  10 +
>>  board/dhelectronics/dh_imx6/Kconfig   |  12 +
>>  board/dhelectronics/dh_imx6/MAINTAINERS   |   7 +
>>  board/dhelectronics/dh_imx6/Makefile  |  11 +
>>  board/dhelectronics/dh_imx6/dh_imx6.c | 437 
>> ++
>>  board/dhelectronics/dh_imx6/dh_imx6_spl.c | 399 +++
>>  configs/dh_imx6_defconfig |  51 
>>  include/configs/dh_imx6.h | 191 +
>>  8 files changed, 1118 insertions(+)
>>  create mode 100644 board/dhelectronics/dh_imx6/Kconfig
>>  create mode 100644 board/dhelectronics/dh_imx6/MAINTAINERS
>>  create mode 100644 board/dhelectronics/dh_imx6/Makefile
>>  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6.c
>>  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6_spl.c
>>  create mode 100644 configs/dh_imx6_defconfig
>>  create mode 100644 include/configs/dh_imx6.h
>>
>> diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
>> index 540f2b29b1..b82db3af22 100644
>> --- a/arch/arm/mach-imx/mx6/Kconfig
>> +++ b/arch/arm/mach-imx/mx6/Kconfig
>> @@ -129,6 +129,15 @@ config TARGET_COLIBRI_IMX6
>> select DM_SERIAL
>> select DM_THERMAL
>>
>> +config TARGET_DHCOMIMX6
>> +   bool "dh_imx6"
>> +   select BOARD_LATE_INIT
>> +   select BOARD_EARLY_INIT_F
>> +   select SUPPORT_SPL
>> +   select DM
>> +   select DM_THERMAL
>> +   imply CMD_SPL
> 
> I would suggest to add new boards with DTS along with enabling
> dm-driven drivers, this would eventually improve i.MX tree toward
> using new feature set.

Enabling unused stuff and adding bloat ? Nope :)

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


[U-Boot] [PATCH v4 1/2] arm64: sun50i-h5.dtsi : add h5 & a64 compatible to mmc[0-2]

2017-10-10 Thread Antony Antony
add more specific,  Allwinner H5 SoC, compaitable to mmc0,1,2
current one comes from sun8i-h3.dtsi
compatible = "allwinner,sun7i-a20-mmc", "allwinner,sun5i-a13-mmc";

Signed-off-by: Antony Antony 
---
 arch/arm/dts/sun50i-h5.dtsi | 12 
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/dts/sun50i-h5.dtsi b/arch/arm/dts/sun50i-h5.dtsi
index 4904c18..1f4c1d1 100644
--- a/arch/arm/dts/sun50i-h5.dtsi
+++ b/arch/arm/dts/sun50i-h5.dtsi
@@ -75,3 +75,15 @@
  {
compatible = "arm,gic-400";
 };
+
+ {
+   compatible = "allwinner,sun50i-h5-mmc", "allwinner,sun50i-a64-mmc";
+};
+
+ {
+   compatible = "allwinner,sun50i-h5-mmc", "allwinner,sun50i-a64-mmc";
+};
+
+ {
+   compatible = "allwinner,sun50i-h5-mmc", "allwinner,sun50i-a64-mmc";
+};
-- 
2.7.4

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


Re: [U-Boot] [PATCH V2] ARM: imx6: Add DHCOM i.MX6 PDK board support

2017-10-10 Thread Jagan Teki
On Tue, Oct 10, 2017 at 1:21 AM, Marek Vasut  wrote:
> Add support for the DHCOM i.MX6 PDK board. This board has:
> - FEC ethernet
> - EHCI USB host
> - 3x SDMMC
>
> Signed-off-by: Marek Vasut 
> Cc: Stefano Babic 
> ---
> V2: Use get_cpu_type() and imx_get_mac_from_fuse()
> ---
>  arch/arm/mach-imx/mx6/Kconfig |  10 +
>  board/dhelectronics/dh_imx6/Kconfig   |  12 +
>  board/dhelectronics/dh_imx6/MAINTAINERS   |   7 +
>  board/dhelectronics/dh_imx6/Makefile  |  11 +
>  board/dhelectronics/dh_imx6/dh_imx6.c | 437 
> ++
>  board/dhelectronics/dh_imx6/dh_imx6_spl.c | 399 +++
>  configs/dh_imx6_defconfig |  51 
>  include/configs/dh_imx6.h | 191 +
>  8 files changed, 1118 insertions(+)
>  create mode 100644 board/dhelectronics/dh_imx6/Kconfig
>  create mode 100644 board/dhelectronics/dh_imx6/MAINTAINERS
>  create mode 100644 board/dhelectronics/dh_imx6/Makefile
>  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6.c
>  create mode 100644 board/dhelectronics/dh_imx6/dh_imx6_spl.c
>  create mode 100644 configs/dh_imx6_defconfig
>  create mode 100644 include/configs/dh_imx6.h
>
> diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig
> index 540f2b29b1..b82db3af22 100644
> --- a/arch/arm/mach-imx/mx6/Kconfig
> +++ b/arch/arm/mach-imx/mx6/Kconfig
> @@ -129,6 +129,15 @@ config TARGET_COLIBRI_IMX6
> select DM_SERIAL
> select DM_THERMAL
>
> +config TARGET_DHCOMIMX6
> +   bool "dh_imx6"
> +   select BOARD_LATE_INIT
> +   select BOARD_EARLY_INIT_F
> +   select SUPPORT_SPL
> +   select DM
> +   select DM_THERMAL
> +   imply CMD_SPL

I would suggest to add new boards with DTS along with enabling
dm-driven drivers, this would eventually improve i.MX tree toward
using new feature set.

thanks!
-- 
Jagan Teki
Free Software Engineer | www.openedev.com
U-Boot, Linux | Upstream Maintainer
Hyderabad, India.
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v1 1/3] test/py: gpt: update test_gpt

2017-10-10 Thread Patrick DELAUNAY
Hi Stephen,

> -Original Message-
> From: Stephen Warren [mailto:swar...@wwwdotorg.org]
> 
> On 10/09/2017 01:47 AM, Patrick Delaunay wrote:
> > - copy the reference gpt binary file as it is modified during the test
> >to avoid issue if the test fail: the test always restart with clean
> > file
> > - update tests to highlight detected issues on gpt swap command
> >(offset and size of partition are modified)
> > - add test for gpt verfiy, gpt read and gpt write
> 
> It might be nice to split this into separate patches for separate logical 
> changes.

Ok I will split this patch in 3 parts in v2

> 
> > diff --git a/test/py/tests/test_gpt.py b/test/py/tests/test_gpt.py
> 
> >   These tests rely on a 4 MB disk image, which is automatically
> > created by -the test.
> > +the test, but as we expect specific content and it is modified by the
> > +gpt commands executed during the test, it is not safe be reused it
> > +directly
> 
> That's a bit of an internal detail. I'm not sure it's necessary to spell it 
> out in the
> documentation?

Yes, I agree.
It is the first time I modify tets/py and I don't see the fact that these lines 
are not just comment.
I will remove it in v2

> 
> >   class GptTestDiskImage(object):
> > @@ -28,26 +29,31 @@ class GptTestDiskImage(object):
> >   """
> >
> >   filename = 'test_gpt_disk_image.bin'
> > +
> >   self.path = u_boot_console.config.persistent_data_dir + '/'
> > + filename
> > +ref_path = u_boot_console.config.persistent_data_dir +
> > + '/ref_' + filename
> 
> Can we put self.path somewhere other than persistent_data_dir? Since it gets
> re-created every time, it's not persistent. Other tests use
> u_boot_console.config.result_dir for temporary files.

Agree, I search a location for temporary file, but I don't found a good 
solution...
So I will use u_boot_console.config.result_dir in v2

> 
> > @@ -64,6 +70,30 @@ def state_disk_image(u_boot_console):
> >   @pytest.mark.boardspec('sandbox')
> >   @pytest.mark.buildconfigspec('cmd_gpt')
> >   @pytest.mark.requiredtool('sgdisk')
> > +def test_gpt_read(state_disk_image, u_boot_console):
> > +"""Test the gpt read command."""
> > +
> > +u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
> > +output = u_boot_console.run_command('gpt read host 0')
> > +assert 'Start 1MiB, size 0MiB' in output
> > +assert 'Start 2MiB, size 0MiB' in output
> > +output = u_boot_console.run_command('part list host 0')
> 
> I think this test should also be:
> @pytest.mark.buildconfigspec('cmd_part')
> 
> Some of the other diffs in this path add use of the part command for the first
> time, so I think you need to add that decorator to a few other functions too.

Ok

> 
> > @@ -109,9 +142,29 @@ def test_gpt_swap_partitions(state_disk_image,
> u_boot_console):
> >
> >   u_boot_console.run_command('host bind 0 ' + state_disk_image.path)
> >   output = u_boot_console.run_command('part list host 0')
> > -assert '0x07ff "first"' in output
> > -assert '0x17ff "second"' in output
> > +assert '0x0800 0x0a00  "first"' in output
> > +assert '0x1000 0x1200  "second"' in output
> 
> I'm not sure why this change is required. I can see two separate changes
> here:
> 
> 1) Verifies the value of 3 columns of data not just 2. That seems fine.
> 
> 2) Changes the expected value in the column before the partition name.
> I'm not sure about this; shouldn't the value stay the same, or is the test 
> failing
> right now?

in fact it the purpose of my modification in patch 3/3 : cmd: gpt: solve issue 
for swap

The command gpt swap (or gpt remane) don't expect change the offset or the size 
of the partition
but it is the case today , it is an error in code and it is not detected with 
the current test

In the modified test, I test the expected correct values (3 columns): without 
modification of the offset and size.

=> the test if failing for master branch
=> the test is OK only after " patch 3/3 : cmd: gpt: solve issue for swap"

But I don't sure of the correct patchset order to avoid issue during merge in 
master branch

First Test update  => test Failed
Then patch the code => test OK

Or 

First patch the code => test Failed
Then patch the test => test OK

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


Re: [U-Boot] [PATCH] efi_loader: search all possible disk partitions

2017-10-10 Thread Peter Robinson
On Tue, Oct 10, 2017 at 3:55 AM, Jonathan Gray  wrote:
> When searching for partitions don't stop if a partition is not present
> for a given partition number as there may be valid partitions after.
>
> Search for up to MAX_SEARCH_PARTITIONS matching the other callers of
> part_get_info().
>
> This allows OpenBSD to boot via the efi_loader on rpi_3 again after
> changes made after U-Boot 2017.09.  With MBR partitioning OpenBSD will
> by default use the fourth partition for the 0xA6 (OpenBSD) partition.
>
> Signed-off-by: Jonathan Gray 
Tested-by: Peter Robinson 

Tested on the Pine64, fixes the issues I saw with that device.

> ---
>  lib/efi_loader/efi_disk.c | 20 
>  1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index 47b487aa30..6b192701a8 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -254,18 +254,19 @@ static int efi_disk_create_eltorito(struct blk_desc 
> *desc,
>  #if CONFIG_IS_ENABLED(ISO_PARTITION)
> char devname[32] = { 0 }; /* dp->str is u16[32] long */
> disk_partition_t info;
> -   int part = 1;
> +   int part;
>
> if (desc->part_type != PART_TYPE_ISO)
> return 0;
>
> /* and devices for each partition: */
> -   while (!part_get_info(desc, part, )) {
> +   for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
> +   if (part_get_info(desc, part, ))
> +   continue;
> snprintf(devname, sizeof(devname), "%s:%d", pdevname,
>  part);
> efi_disk_add_dev(devname, if_typename, desc, diskid,
>  info.start, part);
> -   part++;
> disks++;
> }
>
> @@ -299,15 +300,16 @@ int efi_disk_register(void)
> struct blk_desc *desc = dev_get_uclass_platdata(dev);
> const char *if_typename = dev->driver->name;
> disk_partition_t info;
> -   int part = 1;
> +   int part;
>
> printf("Scanning disk %s...\n", dev->name);
>
> /* add devices for each partition: */
> -   while (!part_get_info(desc, part, )) {
> +   for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
> +   if (part_get_info(desc, part, ))
> +   continue;
> efi_disk_add_dev(dev->name, if_typename, desc,
>  desc->devnum, 0, part);
> -   part++;
> }
>
> /* ... and add block device: */
> @@ -341,7 +343,7 @@ int efi_disk_register(void)
> struct blk_desc *desc;
> char devname[32] = { 0 }; /* dp->str is u16[32] long 
> */
> disk_partition_t info;
> -   int part = 1;
> +   int part;
>
> desc = blk_get_devnum_by_type(if_type, i);
> if (!desc)
> @@ -353,7 +355,9 @@ int efi_disk_register(void)
>  if_typename, i);
>
> /* add devices for each partition: */
> -   while (!part_get_info(desc, part, )) {
> +   for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) 
> {
> +   if (part_get_info(desc, part, ))
> +   continue;
> efi_disk_add_dev(devname, if_typename, desc,
>  i, 0, part);
> part++;
> --
> 2.14.2
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] efi_loader: don't increment part twice per loop

2017-10-10 Thread Peter Robinson
On Tue, Oct 10, 2017 at 11:32 AM, Jonathan Gray  wrote:
> Correct a mistake in the part number handling of
> 16a73b249d138fedeb188710533902ed7aac1ddc and only increment part once
> per loop.
>
> Signed-off-by: Jonathan Gray 
Tested-by: Peter Robinson 

Tested on the Pine64

> ---
>  lib/efi_loader/efi_disk.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
> index 6b192701a8..e61dbc8058 100644
> --- a/lib/efi_loader/efi_disk.c
> +++ b/lib/efi_loader/efi_disk.c
> @@ -360,7 +360,6 @@ int efi_disk_register(void)
> continue;
> efi_disk_add_dev(devname, if_typename, desc,
>  i, 0, part);
> -   part++;
> }
>
> /* ... and add block device: */
> --
> 2.14.2
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 09/11] efi_loader: Fix disk dp's for pre-DM/legacy devices

2017-10-10 Thread Rob Clark
This fixes an issue with OpenBSD's bootloader, and I think should also
fix a similar issue with grub2 on legacy devices.  In the legacy case
we were creating disk objects for the partitions, but not also the
parent device.

Reported-by: Jonathan Gray 
Signed-off-by: Rob Clark 
---
 lib/efi_loader/efi_disk.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index eb9ce772d1..47b487aa30 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -340,6 +340,8 @@ int efi_disk_register(void)
for (i = 0; i < 4; i++) {
struct blk_desc *desc;
char devname[32] = { 0 }; /* dp->str is u16[32] long */
+   disk_partition_t info;
+   int part = 1;
 
desc = blk_get_devnum_by_type(if_type, i);
if (!desc)
@@ -349,6 +351,15 @@ int efi_disk_register(void)
 
snprintf(devname, sizeof(devname), "%s%d",
 if_typename, i);
+
+   /* add devices for each partition: */
+   while (!part_get_info(desc, part, )) {
+   efi_disk_add_dev(devname, if_typename, desc,
+i, 0, part);
+   part++;
+   }
+
+   /* ... and add block device: */
efi_disk_add_dev(devname, if_typename, desc, i, 0, 0);
disks++;
 
-- 
2.13.6

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


Re: [U-Boot] Broadwell-DE bare metal

2017-10-10 Thread vnktux
Hi Simon,

Thanks for the info. I already have all the necessary blobs from the current 
working implementation with Coreboot + U-Boot: FPS, ME, Microcode, Flash 
Descriptor, VGA Rom.

To start porting I was planning to copy all the files of the board minnowmax 
and rename it with the name of our product. I saw that minnowmax use FSP 1.0 
exactly like Broadwell-DE. I hope that helps.

Sent with [ProtonMail](https://protonmail.com) Secure Email.

>  Original Message 
> Subject: Re: [U-Boot] Broadwell-DE bare metal
> Local Time: October 9, 2017 4:43 PM
> UTC Time: October 9, 2017 2:43 PM
> From: s...@chromium.org
> To: vnktux 
> u-boot@lists.denx.de 
>
> Hi,
>
> On 3 October 2017 at 08:58, vnktux  wrote:
>> Hi all,
>>
>> For my graduation project my company asked to use U-Boot as bare metal 
>> boot-loader on one of their product. The product in an embedded board with a 
>> Xeon Broadwell-DE D-1527 Quad Core. The current boot-loader consist of 
>> Coreboot + U-Boot, but of course they want to get rid of Coreboot. I have 
>> almost no experience with U-Boot (Just with ARM processor a little bit) and 
>> so far I don"t even know if it"s possible or not to achieve the final goal. 
>> What I have understood is that I need the following binary blobs to work: 
>> fsp.bin, vga.bin, descriptor.bin, me.bin, microcode.bin. Is it true? Can 
>> somebody point me in the right direction because I am a little bit lost? 
>> Plus I don"t see many x86 boards implemented in the source code of U-Boot.
>
> The original U-Boot payload support was done with Broadwell-DE (I"m
> not sure which one though). It allows U-Boot to boot from EFI.
>
> For what you want, yes you will need to obtain various binary blobs.
> Hopefully you can get the FSP from Intel, and with that the work
> required in U-Boot is probably not too large. Although I"m sure that
> the FSP API will have changed a little.
>
> Regards,
> Simon
>
>>
>> Best regards,
>> Vincenzo
>>
>> Sent with [ProtonMail](https://protonmail.com) Secure Email.
>> ___
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> https://lists.denx.de/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 05/11] efi_loader: console support for color attributes

2017-10-10 Thread Rob Clark
Shell.efi uses this, and supporting color attributes makes things look
nicer.  Map the EFI fg/bg color attributes to ANSI escape sequences.
Not all colors have a perfect match, but spec just says "Devices
supporting a different number of text colors are required to emulate the
above colors to the best of the device’s capabilities".

Signed-off-by: Rob Clark 
---
 include/efi_api.h| 33 +
 lib/efi_loader/efi_console.c | 27 +--
 2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 58bf15b8e6..9610d03d47 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -427,6 +427,39 @@ struct simple_text_output_mode {
EFI_GUID(0x387477c2, 0x69c7, 0x11d2, \
 0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
 
+#define EFI_BLACK0x00
+#define EFI_BLUE 0x01
+#define EFI_GREEN0x02
+#define EFI_CYAN 0x03
+#define EFI_RED  0x04
+#define EFI_MAGENTA  0x05
+#define EFI_BROWN0x06
+#define EFI_LIGHTGRAY0x07
+#define EFI_BRIGHT   0x08
+#define EFI_DARKGRAY 0x08
+#define EFI_LIGHTBLUE0x09
+#define EFI_LIGHTGREEN   0x0a
+#define EFI_LIGHTCYAN0x0b
+#define EFI_LIGHTRED 0x0c
+#define EFI_LIGHTMAGENTA 0x0d
+#define EFI_YELLOW   0x0e
+#define EFI_WHITE0x0f
+#define EFI_BACKGROUND_BLACK 0x00
+#define EFI_BACKGROUND_BLUE  0x10
+#define EFI_BACKGROUND_GREEN 0x20
+#define EFI_BACKGROUND_CYAN  0x30
+#define EFI_BACKGROUND_RED   0x40
+#define EFI_BACKGROUND_MAGENTA   0x50
+#define EFI_BACKGROUND_BROWN 0x60
+#define EFI_BACKGROUND_LIGHTGRAY 0x70
+
+/* extract foreground color from EFI attribute */
+#define EFI_ATTR_FG(attr)((attr) & 0x07)
+/* treat high bit of FG as bright/bold (similar to edk2) */
+#define EFI_ATTR_BOLD(attr)  (((attr) >> 3) & 0x01)
+/* extract background color from EFI attribute */
+#define EFI_ATTR_BG(attr)(((attr) >> 4) & 0x7)
+
 struct efi_simple_text_output_protocol {
void *reset;
efi_status_t (EFIAPI *output_string)(
diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index f508b79ab8..c25d6b16f2 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -316,14 +316,37 @@ static efi_status_t EFIAPI efi_cout_set_mode(
return EFI_EXIT(EFI_SUCCESS);
 }
 
+static const struct {
+   unsigned fg;
+   unsigned bg;
+} color[] = {
+   { 30, 40 }, /* 0: black */
+   { 34, 44 }, /* 1: blue */
+   { 32, 42 }, /* 2: green */
+   { 36, 46 }, /* 3: cyan */
+   { 31, 41 }, /* 4: red */
+   { 35, 45 }, /* 5: magenta */
+   { 33, 43 }, /* 6: brown, map to yellow as edk2 does*/
+   { 37, 47 }, /* 7: light grey, map to white */
+};
+
+/* See EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute(). */
 static efi_status_t EFIAPI efi_cout_set_attribute(
struct efi_simple_text_output_protocol *this,
unsigned long attribute)
 {
+   unsigned int bold = EFI_ATTR_BOLD(attribute);
+   unsigned int fg = EFI_ATTR_FG(attribute);
+   unsigned int bg = EFI_ATTR_BG(attribute);
+
EFI_ENTRY("%p, %lx", this, attribute);
 
-   /* Just ignore attributes (colors) for now */
-   return EFI_EXIT(EFI_UNSUPPORTED);
+   if (attribute)
+   printf(ESC"[%u;%u;%um", bold, color[fg].fg, color[bg].bg);
+   else
+   printf(ESC"[0;37;40m");
+
+   return EFI_EXIT(EFI_SUCCESS);
 }
 
 static efi_status_t EFIAPI efi_cout_clear_screen(
-- 
2.13.6

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


[U-Boot] [PATCH 04/11] efi_loader: SIMPLE_TEXT_INPUT_EX plus wire up objects properly

2017-10-10 Thread Rob Clark
We need the _EX version for SCT.. and we need to wire up the
corresponding objects in the systab properly, as well as dealing
with the console_in object advertising multiple protocols.

Signed-off-by: Rob Clark 
---
 include/efi_api.h |  61 +-
 include/efi_loader.h  |  10 +-
 lib/efi_loader/efi_boottime.c |   3 +
 lib/efi_loader/efi_console.c  | 264 +++---
 4 files changed, 308 insertions(+), 30 deletions(-)

diff --git a/include/efi_api.h b/include/efi_api.h
index 38dd1240c1..58bf15b8e6 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -243,11 +243,11 @@ struct efi_system_table {
struct efi_table_hdr hdr;
unsigned long fw_vendor;   /* physical addr of wchar_t vendor string */
u32 fw_revision;
-   unsigned long con_in_handle;
+   efi_handle_t con_in_handle;
struct efi_simple_input_interface *con_in;
-   unsigned long con_out_handle;
+   efi_handle_t con_out_handle;
struct efi_simple_text_output_protocol *con_out;
-   unsigned long stderr_handle;
+   efi_handle_t stderr_handle;
struct efi_simple_text_output_protocol *std_err;
struct efi_runtime_services *runtime;
struct efi_boot_services *boottime;
@@ -474,6 +474,61 @@ struct efi_simple_input_interface {
struct efi_event *wait_for_key;
 };
 
+
+#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \
+   EFI_GUID(0xdd9e7534, 0x7762, 0x4698, \
+0x8c, 0x14, 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa)
+
+/* key-shift state: */
+#define EFI_SHIFT_STATE_VALID 0x8000
+#define EFI_RIGHT_SHIFT_PRESSED   0x0001
+#define EFI_LEFT_SHIFT_PRESSED0x0002
+#define EFI_RIGHT_CONTROL_PRESSED 0x0004
+#define EFI_LEFT_CONTROL_PRESSED  0x0008
+#define EFI_RIGHT_ALT_PRESSED 0x0010
+#define EFI_EFI_LEFT_ALT_PRESSED  0x0020
+#define EFI_RIGHT_LOGO_PRESSED0x0040
+#define EFI_LEFT_LOGO_PRESSED 0x0080
+#define EFI_MENU_KEY_PRESSED  0x0100
+#define EFI_SYS_REQ_PRESSED   0x0200
+
+/* key-toggle state: */
+#define EFI_TOGGLE_STATE_VALID 0x80
+#define EFI_SCROLL_LOCK_ACTIVE 0x01
+#define EFI_NUM_LOCK_ACTIVE0x02
+#define EFI_CAPS_LOCK_ACTIVE   0x04
+
+struct efi_key_state {
+   uint32_t key_shift_state;
+   uint8_t  key_toggle_state;
+};
+
+struct efi_key_data {
+   struct efi_input_key key;
+   struct efi_key_state key_state;
+};
+
+struct efi_simple_text_input_ex_interface {
+   efi_status_t (EFIAPI *reset)(
+   struct efi_simple_text_input_ex_interface *this,
+   bool ExtendedVerification);
+   efi_status_t (EFIAPI *read_key_stroke)(
+   struct efi_simple_text_input_ex_interface *this,
+   struct efi_key_data *key_data);
+   struct efi_event *wait_for_key;
+   efi_status_t (EFIAPI *set_state)(
+   struct efi_simple_text_input_ex_interface *this,
+   uint8_t key_toggle_state);
+   efi_status_t (EFIAPI *register_key_notify)(
+   struct efi_simple_text_input_ex_interface *this,
+   struct efi_key_data *key_data,
+   efi_status_t (EFIAPI *notify_fn)(struct efi_key_data 
*key_data),
+   efi_handle_t *notify_handle);
+   efi_status_t (EFIAPI *unregister_key_notify)(
+   struct efi_simple_text_input_ex_interface *this,
+   efi_handle_t notify_handle);
+};
+
 #define CONSOLE_CONTROL_GUID \
EFI_GUID(0xf42f7782, 0x12e, 0x4c12, \
 0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21)
diff --git a/include/efi_loader.h b/include/efi_loader.h
index af6812b2b4..e6e55d2cb4 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -75,7 +75,9 @@ const char *__efi_nesting_dec(void);
 extern struct efi_runtime_services efi_runtime_services;
 extern struct efi_system_table systab;
 
+extern struct efi_object efi_console_output_obj;
 extern const struct efi_simple_text_output_protocol efi_con_out;
+extern struct efi_object efi_console_input_obj;
 extern struct efi_simple_input_interface efi_con_in;
 extern const struct efi_console_control_protocol efi_console_control;
 extern const struct efi_device_path_to_text_protocol efi_device_path_to_text;
@@ -129,14 +131,6 @@ struct efi_object {
void *handle;
 };
 
-#define EFI_PROTOCOL_OBJECT(_guid, _protocol) (struct efi_object){ \
-   .protocols = {{ \
-   .guid = &(_guid),   \
-   .protocol_interface = (void *)(_protocol),  \
-   }}, \
-   .handle = (void *)(_protocol),  \
-}
-
 /**
  * struct efi_event
  *
diff --git a/lib/efi_loader/efi_boottime.c 

[U-Boot] [PATCH 07/11] efi_loader: fix events

2017-10-10 Thread Rob Clark
An event can be created with type==0, Shell.efi does this for an event
that is set when Ctrl-C is typed.  So our current approach of having a
fixed set of timer slots, and determining which slots are unused by
type==0 doesn't work so well.  But we don't have any particularly good
reason to have a fixed table of events, so just dynamically allocate
them and keep a list.

Also fixes an incorrect implementation of CheckEvent() which was (a)
incorrectly returning an error if type==0, and (b) didn't handle the
case of an unsignaled event with a notify callback.

With these fixes (plus implementation of SIMPLE_TEXT_INPUT_EX protocol),
Ctrl-C works in Shell.efi.

Signed-off-by: Rob Clark 
---
 include/efi_loader.h  |   1 +
 lib/efi_loader/efi_boottime.c | 217 +-
 2 files changed, 111 insertions(+), 107 deletions(-)

diff --git a/include/efi_loader.h b/include/efi_loader.h
index e6e55d2cb4..2232caca44 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -154,6 +154,7 @@ struct efi_event {
enum efi_timer_delay trigger_type;
bool is_queued;
bool is_signaled;
+   struct list_head link;
 };
 
 
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 39dcc72648..19fafe546c 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -350,11 +350,26 @@ static efi_status_t efi_create_handle(void **handle)
return r;
 }
 
+static LIST_HEAD(efi_events);
+
 /*
- * Our event capabilities are very limited. Only a small limited
- * number of events is allowed to coexist.
+ * Check if a pointer is a valid event.
+ *
+ * It might be nice at some point to extend this to a more general
+ * mechanism to check if pointers passed from the EFI world are
+ * valid objects of a particular type.
  */
-static struct efi_event efi_events[16];
+static bool efi_is_event(const void *obj)
+{
+   struct efi_event *evt;
+
+   list_for_each_entry(evt, _events, link) {
+   if (evt == obj)
+   return true;
+   }
+
+   return false;
+}
 
 /*
  * Create an event.
@@ -377,7 +392,7 @@ efi_status_t efi_create_event(uint32_t type, UINTN 
notify_tpl,
void *context),
  void *notify_context, struct efi_event **event)
 {
-   int i;
+   struct efi_event *evt;
 
if (event == NULL)
return EFI_INVALID_PARAMETER;
@@ -389,21 +404,24 @@ efi_status_t efi_create_event(uint32_t type, UINTN 
notify_tpl,
notify_function == NULL)
return EFI_INVALID_PARAMETER;
 
-   for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
-   if (efi_events[i].type)
-   continue;
-   efi_events[i].type = type;
-   efi_events[i].notify_tpl = notify_tpl;
-   efi_events[i].notify_function = notify_function;
-   efi_events[i].notify_context = notify_context;
-   /* Disable timers on bootup */
-   efi_events[i].trigger_next = -1ULL;
-   efi_events[i].is_queued = false;
-   efi_events[i].is_signaled = false;
-   *event = _events[i];
-   return EFI_SUCCESS;
-   }
-   return EFI_OUT_OF_RESOURCES;
+   evt = calloc(1, sizeof(*evt));
+   if (!evt)
+   return EFI_OUT_OF_RESOURCES;
+
+   evt->type = type;
+   evt->notify_tpl = notify_tpl;
+   evt->notify_function = notify_function;
+   evt->notify_context = notify_context;
+   /* Disable timers on bootup */
+   evt->trigger_next = -1ULL;
+   evt->is_queued = false;
+   evt->is_signaled = false;
+
+   list_add_tail(>link, _events);
+
+   *event = evt;
+
+   return EFI_SUCCESS;
 }
 
 /*
@@ -443,30 +461,31 @@ static efi_status_t EFIAPI efi_create_event_ext(
  */
 void efi_timer_check(void)
 {
-   int i;
+   struct efi_event *evt;
u64 now = timer_get_us();
 
-   for (i = 0; i < ARRAY_SIZE(efi_events); ++i) {
-   if (!efi_events[i].type)
-   continue;
-   if (efi_events[i].is_queued)
-   efi_signal_event(_events[i]);
-   if (!(efi_events[i].type & EVT_TIMER) ||
-   now < efi_events[i].trigger_next)
+   /*
+* TODO perhaps optimize a bit and track the time of next
+* timer to expire?
+*/
+   list_for_each_entry(evt, _events, link) {
+   if (evt->is_queued)
+   efi_signal_event(evt);
+   if (!(evt->type & EVT_TIMER) ||
+   now < evt->trigger_next)
continue;
-   switch (efi_events[i].trigger_type) {
+   switch (evt->trigger_type) {
case EFI_TIMER_RELATIVE:
-   efi_events[i].trigger_type = EFI_TIMER_STOP;
+   

[U-Boot] [PATCH 11/11] efi_loader: exclude openrd devices

2017-10-10 Thread Rob Clark
These devices have small image size limits, so exclude EFI_LOADER to
help avoid exceeding limits.

Signed-off-by: Rob Clark 
---
 lib/efi_loader/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index d2b6327119..6e22940da5 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -1,6 +1,6 @@
 config EFI_LOADER
bool "Support running EFI Applications in U-Boot"
-   depends on (ARM || X86) && OF_LIBFDT
+   depends on (ARM || X86) && OF_LIBFDT && !TARGET_OPENRD
default y
help
  Select this option if you want to run EFI applications (like grub2)
-- 
2.13.6

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


[U-Boot] [PATCH 08/11] efi_loader: implement SetWatchdogTimer

2017-10-10 Thread Rob Clark
From: Heinrich Schuchardt 

The watchdog is initialized with a 5 minute timeout period.
It can be reset by SetWatchdogTimer.
It is stopped by ExitBoottimeServices.

Signed-off-by: Heinrich Schuchardt 
---
 cmd/bootefi.c |  1 +
 include/efi_loader.h  |  4 ++
 lib/efi_loader/Makefile   |  2 +-
 lib/efi_loader/efi_boottime.c | 17 ++---
 lib/efi_loader/efi_watchdog.c | 86 +++
 5 files changed, 95 insertions(+), 15 deletions(-)
 create mode 100644 lib/efi_loader/efi_watchdog.c

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index b7087e3da8..24958ada46 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -43,6 +43,7 @@ static void efi_init_obj_list(void)
 #ifdef CONFIG_GENERATE_SMBIOS_TABLE
efi_smbios_register();
 #endif
+   efi_watchdog_register();
 
/* Initialize EFI runtime services */
efi_reset_system_init();
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 2232caca44..fa4e1cdb1c 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -169,6 +169,8 @@ int efi_disk_register(void);
 int efi_gop_register(void);
 /* Called by bootefi to make the network interface available */
 int efi_net_register(void);
+/* Called by bootefi to make the watchdog available */
+int efi_watchdog_register(void);
 /* Called by bootefi to make SMBIOS tables available */
 void efi_smbios_register(void);
 
@@ -177,6 +179,8 @@ efi_fs_from_path(struct efi_device_path *fp);
 
 /* Called by networking code to memorize the dhcp ack package */
 void efi_net_set_dhcp_ack(void *pkt, int len);
+/* Called by efi_set_watchdog_timer to reset the timer */
+efi_status_t efi_set_watchdog(unsigned long timeout);
 
 /* Called from places to check whether a timer expired */
 void efi_timer_check(void);
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 7ea96a4f1c..4238cf9f9b 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -18,7 +18,7 @@ obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
 obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o
 obj-y += efi_device_path_utilities.o efi_hii.o efi_unicode.o
-obj-y += efi_file.o efi_variable.o efi_bootmgr.o
+obj-y += efi_file.o efi_variable.o efi_bootmgr.o efi_watchdog.o
 obj-$(CONFIG_LCD) += efi_gop.o
 obj-$(CONFIG_DM_VIDEO) += efi_gop.o
 obj-$(CONFIG_PARTITIONS) += efi_disk.o
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 19fafe546c..310f0a3b62 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -156,18 +156,6 @@ void efi_signal_event(struct efi_event *event)
 }
 
 /*
- * Write a debug message for an EPI API service that is not implemented yet.
- *
- * @funcname   function that is not yet implemented
- * @return EFI_UNSUPPORTED
- */
-static efi_status_t efi_unsupported(const char *funcname)
-{
-   debug("EFI: App called into unimplemented function %s\n", funcname);
-   return EFI_EXIT(EFI_UNSUPPORTED);
-}
-
-/*
  * Raise the task priority level.
  *
  * This function implements the RaiseTpl service.
@@ -1470,6 +1458,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(void 
*image_handle,
bootm_disable_interrupts();
 
/* Give the payload some time to boot */
+   efi_set_watchdog(0);
WATCHDOG_RESET();
 
return EFI_EXIT(EFI_SUCCESS);
@@ -1513,7 +1502,7 @@ static efi_status_t EFIAPI efi_stall(unsigned long 
microseconds)
 /*
  * Reset the watchdog timer.
  *
- * This function implements the WatchdogTimer service.
+ * This function implements the SetWatchdogTimer service.
  * See the Unified Extensible Firmware Interface (UEFI) specification
  * for details.
  *
@@ -1529,7 +1518,7 @@ static efi_status_t EFIAPI 
efi_set_watchdog_timer(unsigned long timeout,
 {
EFI_ENTRY("%ld, 0x%"PRIx64", %ld, %p", timeout, watchdog_code,
  data_size, watchdog_data);
-   return efi_unsupported(__func__);
+   return EFI_EXIT(efi_set_watchdog(timeout));
 }
 
 /*
diff --git a/lib/efi_loader/efi_watchdog.c b/lib/efi_loader/efi_watchdog.c
new file mode 100644
index 00..eb437faf4b
--- /dev/null
+++ b/lib/efi_loader/efi_watchdog.c
@@ -0,0 +1,86 @@
+/*
+ *  EFI watchdog
+ *
+ *  Copyright (c) 2017 Heinrich Schuchardt
+ *
+ *  SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+
+static struct efi_event *watchdog_timer_event;
+
+/*
+ * Reset the system when the watchdog event is notified.
+ *
+ * @event: the watchdog event
+ * @context:   not used
+ */
+static void EFIAPI efi_watchdog_timer_notify(struct efi_event *event,
+void *context)
+{
+   EFI_ENTRY("%p, %p", event, context);
+
+   printf("\nEFI: Watchdog timeout\n");
+   EFI_CALL_VOID(efi_runtime_services.reset_system(EFI_RESET_COLD,
+   

[U-Boot] [PATCH 06/11] efi_loader: Decouple EFI input/output from stdin/stdout

2017-10-10 Thread Rob Clark
In some cases, it is quite useful to have (for example) EFI on screen
but u-boot on serial port.

This adds two new optional environment variables, "efiin" and "efiout",
which can be used to set EFI console input/output independently of
u-boot's input/output.  If unset, EFI console will default to stdin/
stdout as before.

Signed-off-by: Rob Clark 
---
As mentioned yesterday, this triggers some problems w/ qemu + 'bootefi
hello' since puts() != fputs(stdout).  So you can hold off applying
this one for now if you want until we figure out a solution.  It is
not strictly required, only nice-to-have (and nice for enabling debug
traces on serial without interfering with Shell.efi output on screen)

 lib/efi_loader/efi_console.c | 111 ---
 1 file changed, 82 insertions(+), 29 deletions(-)

diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c
index c25d6b16f2..1333f9cb71 100644
--- a/lib/efi_loader/efi_console.c
+++ b/lib/efi_loader/efi_console.c
@@ -47,6 +47,38 @@ static struct cout_mode efi_cout_modes[] = {
 
 const efi_guid_t efi_guid_console_control = CONSOLE_CONTROL_GUID;
 
+static struct stdio_dev *efiin, *efiout;
+
+static int efi_tstc(void)
+{
+   return efiin->tstc(efiin);
+}
+
+static int efi_getc(void)
+{
+   return efiin->getc(efiin);
+}
+
+static int efi_printf(const char *fmt, ...)
+{
+   va_list args;
+   uint i;
+   char printbuffer[CONFIG_SYS_PBSIZE];
+
+   va_start(args, fmt);
+
+   /*
+* For this to work, printbuffer must be larger than
+* anything we ever want to print.
+*/
+   i = vsnprintf(printbuffer, sizeof(printbuffer), fmt, args);
+   va_end(args);
+
+   /* Print the string */
+   efiout->puts(efiout, printbuffer);
+   return i;
+}
+
 #define cESC '\x1b'
 #define ESC "\x1b"
 
@@ -111,16 +143,16 @@ static int term_read_reply(int *n, int maxnum, char 
end_char)
char c;
int i = 0;
 
-   c = getc();
+   c = efi_getc();
if (c != cESC)
return -1;
-   c = getc();
+   c = efi_getc();
if (c != '[')
return -1;
 
n[0] = 0;
while (1) {
-   c = getc();
+   c = efi_getc();
if (c == ';') {
i++;
if (i >= maxnum)
@@ -164,7 +196,7 @@ static efi_status_t EFIAPI efi_cout_output_string(
 
*utf16_to_utf8((u8 *)buf, string, n16) = '\0';
 
-   fputs(stdout, buf);
+   efiout->puts(efiout, buf);
 
for (p = buf; *p; p++) {
switch (*p) {
@@ -217,14 +249,14 @@ static int query_console_serial(int *rows, int *cols)
u64 timeout;
 
/* Empty input buffer */
-   while (tstc())
-   getc();
+   while (efi_tstc())
+   efi_getc();
 
-   printf(ESC"[18t");
+   efi_printf(ESC"[18t");
 
/* Check if we have a terminal that understands */
timeout = timer_get_us() + 100;
-   while (!tstc())
+   while (!efi_tstc())
if (timer_get_us() > timeout)
return -1;
 
@@ -246,16 +278,13 @@ static efi_status_t EFIAPI efi_cout_query_mode(
EFI_ENTRY("%p, %ld, %p, %p", this, mode_number, columns, rows);
 
if (!console_size_queried) {
-   const char *stdout_name = env_get("stdout");
int rows, cols;
 
console_size_queried = true;
 
-   if (stdout_name && !strcmp(stdout_name, "vidconsole") &&
+   if (!strcmp(efiout->name, "vidconsole") &&
IS_ENABLED(CONFIG_DM_VIDEO)) {
-   struct stdio_dev *stdout_dev =
-   stdio_get_by_name("vidconsole");
-   struct udevice *dev = stdout_dev->priv;
+   struct udevice *dev = efiout->priv;
struct vidconsole_priv *priv =
dev_get_uclass_priv(dev);
rows = priv->rows;
@@ -342,9 +371,9 @@ static efi_status_t EFIAPI efi_cout_set_attribute(
EFI_ENTRY("%p, %lx", this, attribute);
 
if (attribute)
-   printf(ESC"[%u;%u;%um", bold, color[fg].fg, color[bg].bg);
+   efi_printf(ESC"[%u;%u;%um", bold, color[fg].fg, color[bg].bg);
else
-   printf(ESC"[0;37;40m");
+   efi_printf(ESC"[0;37;40m");
 
return EFI_EXIT(EFI_SUCCESS);
 }
@@ -354,7 +383,7 @@ static efi_status_t EFIAPI efi_cout_clear_screen(
 {
EFI_ENTRY("%p", this);
 
-   printf(ESC"[2J");
+   efi_printf(ESC"[2J");
 
return EFI_EXIT(EFI_SUCCESS);
 }
@@ -365,7 +394,7 @@ static efi_status_t EFIAPI efi_cout_set_cursor_position(
 {
EFI_ENTRY("%p, %ld, %ld", this, column, row);
 
-   printf(ESC"[%d;%df", (int)row, (int)column);
+   efi_printf(ESC"[%d;%df", (int)row, (int)column);

[U-Boot] [PATCH 10/11] efi_loader: Add mem-mapped for fallback

2017-10-10 Thread Rob Clark
When we don't have a real device/image path, such as 'bootefi hello',
construct a mem-mapped device-path.

This fixes 'bootefi hello' after devicepath refactoring.

Fixes: 95c5553ea2 ("efi_loader: refactor boot device and loaded_image handling")
Signed-off-by: Rob Clark 
---
 cmd/bootefi.c| 23 +++
 include/efi_api.h|  8 
 include/efi_loader.h |  3 +++
 lib/efi_loader/efi_device_path.c | 24 
 lib/efi_loader/efi_device_path_to_text.c |  9 +
 5 files changed, 67 insertions(+)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 24958ada46..18176a1266 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -128,6 +128,7 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt,
 {
struct efi_loaded_image loaded_image_info = {};
struct efi_object loaded_image_info_obj = {};
+   struct efi_device_path *memdp = NULL;
ulong ret;
 
ulong (*entry)(void *image_handle, struct efi_system_table *st)
@@ -136,6 +137,20 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt,
const efi_guid_t fdt_guid = EFI_FDT_GUID;
bootm_headers_t img = { 0 };
 
+   /*
+* Special case for efi payload not loaded from disk, such as
+* 'bootefi hello' or for example payload loaded directly into
+* memory via jtag/etc:
+*/
+   if (!device_path && !image_path) {
+   printf("WARNING: using memory device/image path, this may 
confuse some payloads!\n");
+   /* actual addresses filled in after efi_load_pe() */
+   memdp = efi_dp_from_mem(0, 0, 0);
+   device_path = image_path = memdp;
+   } else {
+   assert(device_path && image_path);
+   }
+
/* Initialize and populate EFI object list */
if (!efi_obj_list_initalized)
efi_init_obj_list();
@@ -182,6 +197,14 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt,
goto exit;
}
 
+   if (memdp) {
+   struct efi_device_path_memory *mdp = (void *)memdp;
+   mdp->memory_type = loaded_image_info.image_code_type;
+   mdp->start_address = (uintptr_t)loaded_image_info.image_base;
+   mdp->end_address = mdp->start_address +
+   loaded_image_info.image_size;
+   }
+
/* we don't support much: */

env_set("efi_8be4df61-93ca-11d2-aa0d-00e098032b8c_OsIndicationsSupported",
"{ro,boot}(blob)");
diff --git a/include/efi_api.h b/include/efi_api.h
index 9610d03d47..07b2af7020 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -299,8 +299,16 @@ struct efi_mac_addr {
 } __packed;
 
 #define DEVICE_PATH_TYPE_HARDWARE_DEVICE   0x01
+#  define DEVICE_PATH_SUB_TYPE_MEMORY  0x03
 #  define DEVICE_PATH_SUB_TYPE_VENDOR  0x04
 
+struct efi_device_path_memory {
+   struct efi_device_path dp;
+   u32 memory_type;
+   u64 start_address;
+   u64 end_address;
+} __packed;
+
 struct efi_device_path_vendor {
struct efi_device_path dp;
efi_guid_t guid;
diff --git a/include/efi_loader.h b/include/efi_loader.h
index fa4e1cdb1c..db805e898f 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -269,6 +269,9 @@ struct efi_device_path *efi_dp_from_part(struct blk_desc 
*desc, int part);
 struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
 const char *path);
 struct efi_device_path *efi_dp_from_eth(void);
+struct efi_device_path *efi_dp_from_mem(uint32_t mem_type,
+   uint64_t start_address,
+   uint64_t end_address);
 void efi_dp_split_file_path(struct efi_device_path *full_path,
struct efi_device_path **device_path,
struct efi_device_path **file_path);
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index 5d5c3b3464..f6e368e029 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -538,6 +538,30 @@ struct efi_device_path *efi_dp_from_eth(void)
 }
 #endif
 
+/* Construct a device-path for memory-mapped image */
+struct efi_device_path *efi_dp_from_mem(uint32_t memory_type,
+   uint64_t start_address,
+   uint64_t end_address)
+{
+   struct efi_device_path_memory *mdp;
+   void *buf, *start;
+
+   start = buf = dp_alloc(sizeof(*mdp) + sizeof(END));
+
+   mdp = buf;
+   mdp->dp.type = DEVICE_PATH_TYPE_HARDWARE_DEVICE;
+   mdp->dp.sub_type = DEVICE_PATH_SUB_TYPE_MEMORY;
+   mdp->dp.length = sizeof(*mdp);
+   mdp->memory_type = memory_type;
+   mdp->start_address = start_address;
+   mdp->end_address = 

[U-Boot] [PATCH 02/11] efi_loader: Initial HII protocols

2017-10-10 Thread Rob Clark
From: Leif Lindholm 

Enough implementation of the following protocols to run Shell.efi and
SCT.efi:

  EfiHiiConfigRoutingProtocolGuid
  EfiHiiDatabaseProtocol
  EfiHiiStringProtocol

We'll fill in the rest once SCT is running properly so we can validate
the implementation against the conformance test suite.

Initial skeleton written by Leif, and then implementation by myself.

Cc: Leif Lindholm 
Signed-off-by: Rob Clark 
---
 include/efi_api.h | 261 ++
 include/efi_loader.h  |   6 +
 lib/efi_loader/Makefile   |   2 +-
 lib/efi_loader/efi_boottime.c |   9 +
 lib/efi_loader/efi_hii.c  | 507 ++
 5 files changed, 784 insertions(+), 1 deletion(-)
 create mode 100644 lib/efi_loader/efi_hii.c

diff --git a/include/efi_api.h b/include/efi_api.h
index ffdba7fe1a..164147dc87 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -16,6 +16,7 @@
 #define _EFI_API_H
 
 #include 
+#include 
 
 #ifdef CONFIG_EFI_LOADER
 #include 
@@ -536,6 +537,266 @@ struct efi_device_path_utilities_protocol {
uint16_t node_length);
 };
 
+#define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \
+   EFI_GUID(0x587e72d7, 0xcc50, 0x4f79, \
+0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f)
+
+typedef uint16_t efi_string_id_t;
+
+struct efi_hii_config_routing_protocol {
+   efi_status_t(EFIAPI *extract_config)(
+   const struct efi_hii_config_routing_protocol *this,
+   const efi_string_t request,
+   efi_string_t *progress,
+   efi_string_t *results);
+   efi_status_t(EFIAPI *export_config)(
+   const struct efi_hii_config_routing_protocol *this,
+   efi_string_t *results);
+   efi_status_t(EFIAPI *route_config)(
+   const struct efi_hii_config_routing_protocol *this,
+   const efi_string_t configuration,
+   efi_string_t *progress);
+   efi_status_t(EFIAPI *block_to_config)(
+   const struct efi_hii_config_routing_protocol *this,
+   const efi_string_t config_request,
+   const uint8_t *block,
+   const efi_uintn_t block_size,
+   efi_string_t *config,
+   efi_string_t *progress);
+   efi_status_t(EFIAPI *config_to_block)(
+   const struct efi_hii_config_routing_protocol *this,
+   const efi_string_t config_resp,
+   const uint8_t *block,
+   const efi_uintn_t *block_size,
+   efi_string_t *progress);
+   efi_status_t(EFIAPI *get_alt_config)(
+   const struct efi_hii_config_routing_protocol *this,
+   const efi_string_t config_resp,
+   const efi_guid_t *guid,
+   const efi_string_t name,
+   const struct efi_device_path *device_path,
+   const efi_string_t alt_cfg_id,
+   efi_string_t *alt_cfg_resp);
+};
+
+#define EFI_HII_DATABASE_PROTOCOL_GUID  \
+   EFI_GUID(0xef9fc172, 0xa1b2, 0x4693, \
+0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42)
+
+typedef enum {
+   EFI_KEY_LCTRL, EFI_KEY_A0, EFI_KEY_LALT, EFI_KEY_SPACE_BAR,
+   EFI_KEY_A2, EFI_KEY_A3, EFI_KEY_A4, EFI_KEY_RCTRL, EFI_KEY_LEFT_ARROW,
+   EFI_KEY_DOWN_ARROW, EFI_KEY_RIGHT_ARROW, EFI_KEY_ZERO,
+   EFI_KEY_PERIOD, EFI_KEY_ENTER, EFI_KEY_LSHIFT, EFI_KEY_B0,
+   EFI_KEY_B1, EFI_KEY_B2, EFI_KEY_B3, EFI_KEY_B4, EFI_KEY_B5, EFI_KEY_B6,
+   EFI_KEY_B7, EFI_KEY_B8, EFI_KEY_B9, EFI_KEY_B10, EFI_KEY_RSHIFT,
+   EFI_KEY_UP_ARROW, EFI_KEY_ONE, EFI_KEY_TWO, EFI_KEY_THREE,
+   EFI_KEY_CAPS_LOCK, EFI_KEY_C1, EFI_KEY_C2, EFI_KEY_C3, EFI_KEY_C4,
+   EFI_KEY_C5, EFI_KEY_C6, EFI_KEY_C7, EFI_KEY_C8, EFI_KEY_C9,
+   EFI_KEY_C10, EFI_KEY_C11, EFI_KEY_C12, EFI_KEY_FOUR, EFI_KEY_FIVE,
+   EFI_KEY_SIX, EFI_KEY_PLUS, EFI_KEY_TAB, EFI_KEY_D1, EFI_KEY_D2,
+   EFI_KEY_D3, EFI_KEY_D4, EFI_KEY_D5, EFI_KEY_D6, EFI_KEY_D7, EFI_KEY_D8,
+   EFI_KEY_D9, EFI_KEY_D10, EFI_KEY_D11, EFI_KEY_D12, EFI_KEY_D13,
+   EFI_KEY_DEL, EFI_KEY_END, EFI_KEY_PG_DN, EFI_KEY_SEVEN, EFI_KEY_EIGHT,
+   EFI_KEY_NINE, EFI_KEY_E0, EFI_KEY_E1, EFI_KEY_E2, EFI_KEY_E3,
+   EFI_KEY_E4, EFI_KEY_E5, EFI_KEY_E6, EFI_KEY_E7, EFI_KEY_E8, EFI_KEY_E9,
+   EFI_KEY_E10, EFI_KEY_E11, EFI_KEY_E12, EFI_KEY_BACK_SPACE,
+   EFI_KEY_INS, EFI_KEY_HOME, EFI_KEY_PG_UP, EFI_KEY_NLCK, EFI_KEY_SLASH,
+   EFI_KEY_ASTERISK, EFI_KEY_MINUS, EFI_KEY_ESC, EFI_KEY_F1, EFI_KEY_F2,
+   EFI_KEY_F3, EFI_KEY_F4, EFI_KEY_F5, EFI_KEY_F6, EFI_KEY_F7, EFI_KEY_F8,
+   EFI_KEY_F9, EFI_KEY_F10, EFI_KEY_F11, EFI_KEY_F12, EFI_KEY_PRINT,
+   EFI_KEY_SLCK, EFI_KEY_PAUSE,
+} efi_key;
+
+struct efi_key_descriptor {
+   efi_key key;
+   uint16_t unicode;
+   uint16_t shifted_unicode;
+   uint16_t alt_gr_unicode;
+   uint16_t 

[U-Boot] [PATCH 03/11] efi_loader: Initial EFI_UNICODE_COLLATION_PROTOCOL

2017-10-10 Thread Rob Clark
From: Leif Lindholm 

Not complete, but enough for Shell.efi and SCT.efi.

Initial skeleton written by Leif, and then implementation by myself.

Cc: Leif Lindholm 
Signed-off-by: Rob Clark 
---
 include/efi_api.h |  41 ++
 include/efi_loader.h  |   3 +
 lib/efi_loader/Makefile   |   2 +-
 lib/efi_loader/efi_boottime.c |   6 ++
 lib/efi_loader/efi_unicode.c  | 170 ++
 5 files changed, 221 insertions(+), 1 deletion(-)
 create mode 100644 lib/efi_loader/efi_unicode.c

diff --git a/include/efi_api.h b/include/efi_api.h
index 164147dc87..38dd1240c1 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -797,6 +797,47 @@ struct efi_hii_string_protocol {
efi_uintn_t *secondary_languages_size);
 };
 
+/*
+ * Both UNICODE_COLLATION protocols seem to be the same thing, but
+ * advertised with two different GUID's because, why not?
+ */
+
+#define EFI_UNICODE_COLLATION_PROTOCOL_GUID \
+   EFI_GUID(0x1d85cd7f, 0xf43d, 0x11d2, \
+0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
+
+#define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \
+   EFI_GUID(0xa4c751fc, 0x23ae, 0x4c3e, \
+0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49)
+
+struct efi_unicode_collation_protocol {
+   efi_intn_t (EFIAPI *stri_coll)(
+   struct efi_unicode_collation_protocol *this,
+   efi_string_t s1,
+   efi_string_t s2);
+   bool (EFIAPI *metai_match)(
+   struct efi_unicode_collation_protocol *this,
+   efi_string_t string,
+   efi_string_t pattern);
+   void (EFIAPI *str_lwr)(
+   struct efi_unicode_collation_protocol *this,
+   efi_string_t string);
+   void (EFIAPI *str_upr)(
+   struct efi_unicode_collation_protocol *this,
+   efi_string_t string);
+   void (EFIAPI *fat_to_str)(
+   struct efi_unicode_collation_protocol *this,
+   efi_uintn_t fat_size,
+   uint8_t *fat,
+   efi_string_t string);
+   bool (EFIAPI *str_to_fat)(
+   struct efi_unicode_collation_protocol *this,
+   efi_string_t string,
+   efi_uintn_t fat_size,
+   uint8_t *fat);
+   uint8_t *supported_languages;
+};
+
 #define EFI_GOP_GUID \
EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \
 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a)
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 591bf07e7a..af6812b2b4 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -83,6 +83,7 @@ extern const struct efi_device_path_utilities_protocol 
efi_device_path_utilities
 extern const struct efi_hii_config_routing_protocol efi_hii_config_routing;
 extern const struct efi_hii_database_protocol efi_hii_database;
 extern const struct efi_hii_string_protocol efi_hii_string;
+extern const struct efi_unicode_collation_protocol efi_unicode_collation;
 
 uint16_t *efi_dp_str(struct efi_device_path *dp);
 
@@ -97,6 +98,8 @@ extern const efi_guid_t 
efi_guid_device_path_utilities_protocol;
 extern const efi_guid_t efi_guid_hii_config_routing_protocol;
 extern const efi_guid_t efi_guid_hii_database_protocol;
 extern const efi_guid_t efi_guid_hii_string_protocol;
+extern const efi_guid_t efi_guid_unicode_collation_protocol;
+extern const efi_guid_t efi_guid_unicode_collation_protocol2;
 
 extern unsigned int __efi_runtime_start, __efi_runtime_stop;
 extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 725e0cba85..7ea96a4f1c 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -17,7 +17,7 @@ endif
 obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
 obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o
-obj-y += efi_device_path_utilities.o efi_hii.o
+obj-y += efi_device_path_utilities.o efi_hii.o efi_unicode.o
 obj-y += efi_file.o efi_variable.o efi_bootmgr.o
 obj-$(CONFIG_LCD) += efi_gop.o
 obj-$(CONFIG_DM_VIDEO) += efi_gop.o
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index c179afc25a..b568f3f162 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1166,6 +1166,12 @@ void efi_setup_loaded_image(struct efi_loaded_image 
*info, struct efi_object *ob
obj->protocols[7].guid = _guid_hii_config_routing_protocol;
obj->protocols[7].protocol_interface = (void *)_hii_config_routing;
 
+   obj->protocols[8].guid = _guid_unicode_collation_protocol;
+   obj->protocols[8].protocol_interface = (void *)_unicode_collation;
+
+   obj->protocols[9].guid = _guid_unicode_collation_protocol2;
+   obj->protocols[9].protocol_interface = (void *)_unicode_collation;
+

[U-Boot] [PATCH 01/11] efi_loader: Initial EFI_DEVICE_PATH_UTILITIES_PROTOCOL

2017-10-10 Thread Rob Clark
From: Leif Lindholm 

Not complete, but enough for Shell.efi and SCT.efi.  We'll implement the
rest as needed or once we have SCT running properly so there is a way to
validate the interface against the conformance test suite.

Initial skeleton written by Leif, and then implementation by myself.

Cc: Leif Lindholm 
Signed-off-by: Rob Clark 
---
 include/efi_api.h  | 34 +++-
 include/efi_loader.h   |  2 +
 lib/efi_loader/Makefile|  1 +
 lib/efi_loader/efi_boottime.c  |  4 ++
 lib/efi_loader/efi_device_path_utilities.c | 88 ++
 5 files changed, 127 insertions(+), 2 deletions(-)
 create mode 100644 lib/efi_loader/efi_device_path_utilities.c

diff --git a/include/efi_api.h b/include/efi_api.h
index a9a6494afe..ffdba7fe1a 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -28,8 +28,9 @@ enum efi_timer_delay {
EFI_TIMER_RELATIVE = 2
 };
 
-#define UINTN size_t
-typedef long INTN;
+#define UINTN size_t   /* TODO this should be removed in a future patch */
+typedef size_t efi_uintn_t;
+typedef ssize_t efi_intn_t;
 typedef uint16_t *efi_string_t;
 
 #define EVT_TIMER  0x8000
@@ -506,6 +507,35 @@ struct efi_device_path_to_text_protocol
bool allow_shortcuts);
 };
 
+#define EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID \
+   EFI_GUID(0x0379be4e, 0xd706, 0x437d, \
+0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4)
+
+struct efi_device_path_utilities_protocol {
+   efi_uintn_t (EFIAPI *get_device_path_size)(
+   const struct efi_device_path *device_path);
+   struct efi_device_path *(EFIAPI *duplicate_device_path)(
+   const struct efi_device_path *device_path);
+   struct efi_device_path *(EFIAPI *append_device_path)(
+   const struct efi_device_path *src1,
+   const struct efi_device_path *src2);
+   struct efi_device_path *(EFIAPI *append_device_node)(
+   const struct efi_device_path *device_path,
+   const struct efi_device_path *device_node);
+   struct efi_device_path *(EFIAPI *append_device_path_instance)(
+   const struct efi_device_path *device_path,
+   const struct efi_device_path *device_path_instance);
+   struct efi_device_path *(EFIAPI *get_next_device_path_instance)(
+   struct efi_device_path **device_path_instance,
+   efi_uintn_t *device_path_instance_size);
+   bool (EFIAPI *is_device_path_multi_instance)(
+   const struct efi_device_path *device_path);
+   struct efi_device_path *(EFIAPI *create_device_node)(
+   uint8_t node_type,
+   uint8_t node_sub_type,
+   uint16_t node_length);
+};
+
 #define EFI_GOP_GUID \
EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, \
 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a)
diff --git a/include/efi_loader.h b/include/efi_loader.h
index e1179b7dcd..5d37c1d75f 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -79,6 +79,7 @@ extern const struct efi_simple_text_output_protocol 
efi_con_out;
 extern struct efi_simple_input_interface efi_con_in;
 extern const struct efi_console_control_protocol efi_console_control;
 extern const struct efi_device_path_to_text_protocol efi_device_path_to_text;
+extern const struct efi_device_path_utilities_protocol 
efi_device_path_utilities;
 
 uint16_t *efi_dp_str(struct efi_device_path *dp);
 
@@ -89,6 +90,7 @@ extern const efi_guid_t efi_guid_loaded_image;
 extern const efi_guid_t efi_guid_device_path_to_text_protocol;
 extern const efi_guid_t efi_simple_file_system_protocol_guid;
 extern const efi_guid_t efi_file_info_guid;
+extern const efi_guid_t efi_guid_device_path_utilities_protocol;
 
 extern unsigned int __efi_runtime_start, __efi_runtime_stop;
 extern unsigned int __efi_runtime_rel_start, __efi_runtime_rel_stop;
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index ddb978f650..b6927b3b84 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -17,6 +17,7 @@ endif
 obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
 obj-y += efi_image_loader.o efi_boottime.o efi_runtime.o efi_console.o
 obj-y += efi_memory.o efi_device_path_to_text.o efi_device_path.o
+obj-y += efi_device_path_utilities.o
 obj-y += efi_file.o efi_variable.o efi_bootmgr.o
 obj-$(CONFIG_LCD) += efi_gop.o
 obj-$(CONFIG_DM_VIDEO) += efi_gop.o
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 976d5822f7..92c778fcca 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -1153,6 +1153,10 @@ void efi_setup_loaded_image(struct efi_loaded_image 
*info, struct efi_object *ob
obj->protocols[3].protocol_interface =
(void *)_device_path_to_text;
 
+   

[U-Boot] [PATCH 00/11] efi_loader: patches for Shell.efi

2017-10-10 Thread Rob Clark
Re-send of the patch series to get Shell.efi working, and almost get
SCT.efi (the UEFI test suite) working.

Since last time, I've updated to Heinrich's latest SetWatchdogTimer
patch (as of yesterday evening), and adressed review comments on the
three new sets of protocols added.  Part of that, to avoid moving
changes from my later patch that added implementation on top of Leif's
initial stubs was done by simply squashing the patches together.


Heinrich Schuchardt (1):
  efi_loader: implement SetWatchdogTimer

Leif Lindholm (3):
  efi_loader: Initial EFI_DEVICE_PATH_UTILITIES_PROTOCOL
  efi_loader: Initial HII protocols
  efi_loader: Initial EFI_UNICODE_COLLATION_PROTOCOL

Rob Clark (7):
  efi_loader: SIMPLE_TEXT_INPUT_EX plus wire up objects properly
  efi_loader: console support for color attributes
  efi_loader: Decouple EFI input/output from stdin/stdout
  efi_loader: fix events
  efi_loader: Fix disk dp's for pre-DM/legacy devices
  efi_loader: Add mem-mapped for fallback
  efi_loader: exclude openrd devices

 cmd/bootefi.c  |  24 ++
 include/efi_api.h  | 438 -
 include/efi_loader.h   |  29 +-
 lib/efi_loader/Kconfig |   2 +-
 lib/efi_loader/Makefile|   3 +-
 lib/efi_loader/efi_boottime.c  | 256 ---
 lib/efi_loader/efi_console.c   | 398 +++---
 lib/efi_loader/efi_device_path.c   |  24 ++
 lib/efi_loader/efi_device_path_to_text.c   |   9 +
 lib/efi_loader/efi_device_path_utilities.c |  88 +
 lib/efi_loader/efi_disk.c  |  11 +
 lib/efi_loader/efi_hii.c   | 507 +
 lib/efi_loader/efi_unicode.c   | 170 ++
 lib/efi_loader/efi_watchdog.c  |  86 +
 14 files changed, 1861 insertions(+), 184 deletions(-)
 create mode 100644 lib/efi_loader/efi_device_path_utilities.c
 create mode 100644 lib/efi_loader/efi_hii.c
 create mode 100644 lib/efi_loader/efi_unicode.c
 create mode 100644 lib/efi_loader/efi_watchdog.c

-- 
2.13.6

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


Re: [U-Boot] [PATCH] drivers: pci: imx: fix imx_pcie_remove function

2017-10-10 Thread Fabio Estevam
Hi David,

On Thu, Oct 5, 2017 at 8:46 AM, Fabio Estevam  wrote:
> From: Sven-Ola Tuecke 
>
> We have at least a minor count of boards, that failed to re-initialize
> PCI express in the Linux kernel. Typical failure rate is 20% on affected
> boards. This is mitigated by commit 6ecbe1375671 ("drivers: pci: imx:
> add imx_pcie_remove function").
>
> However, at least on some i.MX6 custom boards, when calling
> assert_core_reset() as part of the first-time PCIe init, read access
> to PCIE_PL_PFLR simply hangs. Surround this readl() with
> imx_pcie_fix_dabt_handler() does not help. For this reason, the forced
> LTSSM detection is only used on the second assert_core_reset() that is
> called shorly before starting the Linux kernel.
>
> Signed-off-by: Sven-Ola Tuecke 
> Signed-off-by: Fabio Estevam 

Does this patch solve the PCIE_PL_PFLR hang you reported at
https://lists.denx.de/pipermail/u-boot/2017-September/307191.html ?
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] dwc: ep0: Allocate and flush dwc->ep0_trb in a cache aligned manner

2017-10-10 Thread Kishon Vijay Abraham I
Hi,

On Tuesday 10 October 2017 11:07 AM, Faiz Abbas wrote:
> +Kishon
> 
> On Friday 06 October 2017 05:03 PM, Faiz Abbas wrote:
>> Hi,
>>
>> On Thursday 05 October 2017 04:57 PM, Marek Vasut wrote:
>>> On 10/04/2017 03:11 PM, Faiz Abbas wrote:
 Hi,

 On Wednesday 04 October 2017 06:01 PM, Marek Vasut wrote:
> On 10/04/2017 12:51 PM, Faiz Abbas wrote:
>> Hi,
>> On Tuesday 03 October 2017 06:48 PM, Marek Vasut wrote:
>>> On 10/03/2017 03:17 PM, Faiz Abbas wrote:
 Hi,
 On Tuesday 03 October 2017 05:34 PM, Marek Vasut wrote:
> On 09/19/2017 01:15 PM, Faiz Abbas wrote:
>>  
>> -dwc3_flush_cache((uintptr_t)trb, sizeof(*trb));
>> +dwc3_flush_cache((uintptr_t)dwc->ep0_trb_addr, sizeof(*trb) * 
>> 2);
>
> Why *2 ?

 Because its allocated as sizeof(*dwc->ep0_trb) * 2 below. This is not
 strictly required as dwc3_flush_cache() rounds up the size to
 CACHELINE_SIZE but from a caller POV, flush everything we allocated.
>>>
>>> Can the other TRB be in use ? Maybe aligning the TRBs to cacheline size
>>> would be better ?
>>>
>> A single trb is 16 bytes in size and two of them are allocated
>> contiguously.
>
> Why are two allocated continuously ? (I am not dwc3 expert)

The TRB's should be allocated contiguously for dwc3 and only the base of the
entire TRB table is programmed in the HW.
  <-- TRB table base address
| TRB0   |
||
| TRB1   |
||
| TRB2   |
||
| TRBn   |
||



 Neither am I. I did try to pad to the dwc_trb structure such that each
 trb is 64 bytes in size but this leads to failures when testing. I
 didn't get a chance to debug this though. I suspect its because the code
 expects the trbs to be contiguous and/or 16 bytes in size.

It's not the code but it's the HW.

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


Re: [U-Boot] fsl_esdhc driver is broken with DM

2017-10-10 Thread Fabio Estevam
Hi Jagan,

On Mon, Oct 9, 2017 at 3:05 PM, Jagan Teki  wrote:

> I didn't dig much, but the i.MX6UL case has rebooting with DM_MMC for
> both SPL and U-Boot proper.

Looks like the same issue I saw with mx6q, which has been fixed by this commit:
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=3ea0520512089cffbe02b7d6eb645cdfddb09c5c;hp=4f42a0d7210bd8d4d1f5e2fb73456679d74c44cd
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v4 10/18] rockchip: boot0 hook: support early return for RK3188/RK3066-style BROM

2017-10-10 Thread Andy Yan

Hi Philipp:


On 2017年10月10日 18:50, Dr. Philipp Tomsich wrote:


On 10 Oct 2017, at 11:22, Andy Yan > wrote:


Hi:


On 2017年10月10日 17:01, Andy Yan wrote:

Hi Philipp:

On 2017年10月07日 03:28, Philipp Tomsich wrote:
Some Rockchip BROM versions (e.g. the RK3188 and RK3066) first read 
1KB data
from NAND into SRAM and executes it. Then, following a return to 
bootrom, the
BROM loads additional code to SRAM (not overwriting the first block 
read) and

reenters at the same address as the first time.

To support booting either a TPL (on the RK3066) or SPL (on the 
RK3188) using
this model of having to count entries, this commit adds code to the 
boot0

hook to track the number of entries and handle them accordingly.

Signed-off-by: Philipp Tomsich 
>
Signed-off-by: Paweł Jarosz >

---

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

arch/arm/include/asm/arch-rockchip/boot0.h | 24 
++--

arch/arm/mach-rockchip/Kconfig | 28 
2 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/boot0.h 
b/arch/arm/include/asm/arch-rockchip/boot0.h

index f7c6146..06091d0 100644
--- a/arch/arm/include/asm/arch-rockchip/boot0.h
+++ b/arch/arm/include/asm/arch-rockchip/boot0.h
@@ -19,12 +19,24 @@
* beginning of the executable. However, as we want to keep
* this generic and make it applicable to builds that are like
* the RK3368 (TPL needs this, SPL doesn't) or the RK3399 (no
- * TPL, but extra space needed in the SPL), we simply repeat
- * the 'b reset' with the expectation that the first one will
- * be overwritten, if this is the first stage contained in the
- * final image created with mkimage)...
+ * TPL, but extra space needed in the SPL), we simply insert
+ * a branch-to-next-instruction-word with the expectation that
+ * the first one may be overwritten, if this is the first stage
+ * contained in the final image created with mkimage)...
*/
-    b reset /* may be overwritten --- should be 'nop' or a 'b 
reset' */

+    b 1f /* if overwritten, entry-address is at the next word */
+1:
+#endif
+#if CONFIG_IS_ENABLED(ROCKCHIP_EARLYRETURN_TO_BROM)
+    adr r3, entry_counter
+    ldr    r0, [r3]
+    cmp    r0, #1   /* check if entry_counter == 1 */
+    beq    reset    /* regular bootup */
+    add r0, #1
+    str    r0, [r3] /* increment the entry_counter in 
memory */


    It seems that we need to clear r0 to zero before return to 
bootrom, a non-zero return value will drive the system to bootrom 
download mode.


Did you test if clearing the r0-register before returning fixes this 
and we boot through into SPL?
If so, I’ll create a v5 of the patch … if not, we will need to dig 
deeper to determine why this does not work as expected.


    Yes, we can boot into uboot shell if clear r0 before return to 
bootrom from here.



+    bx lr   /* return to bootrom */

This seems not work on rk3188, When I track the code flow with DS-5, I
found the entry_counter always be zero when we run here from 
bootrom(even it is set to 1 before return to bootrom), so it return 
to bootrom again and again.

+entry_counter:
+    .word   0
#endif
b reset
#if !defined(CONFIG_ARM64)
@@ -32,7 +44,7 @@
* For armv7, the addr '_start' will used as vector start address
* and write to VBAR register, which needs to aligned to 0x20.
*/
-    .align(5)
+    .align(5), 0x0
_start:
ARM_VECTORS
#endif
diff --git a/arch/arm/mach-rockchip/Kconfig 
b/arch/arm/mach-rockchip/Kconfig

index 31e9864..d59a1d5 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -158,6 +158,34 @@ config ROCKCHIP_SPL_RESERVE_IRAM
config ROCKCHIP_BROM_HELPER
bool
+config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
+    bool "SPL requires early-return (for RK3188-style BROM) to 
BROM"

+    depends on SPL && ENABLE_ARM_SOC_BOOT0_HOOK
+    help
+  Some Rockchip BROM variants (e.g. on the RK3188) load the
+  first stage in segments and enter multiple times. E.g. on
+  the RK3188, the first 1KB of the first stage are loaded
+  first and entered; after returning to the BROM, the
+  remainder of the first stage is loaded, but the BROM
+  re-enters at the same address/to the same code as previously.
+
+  This enables support code in the BOOT0 hook for the SPL stage
+  to allow multiple entries.
+
+config TPL_ROCKCHIP_EARLYRETURN_TO_BROM
+    bool "TPL requires early-return (for RK3188-style BROM) to 
BROM"

+    depends on TPL && ENABLE_ARM_SOC_BOOT0_HOOK
+    help
+  Some Rockchip BROM variants (e.g. on the RK3188) load the
+  first stage in segments and enter multiple times. E.g. on
+  the RK3188, the first 1KB of the first stage are 

Re: [U-Boot] [PATCH v4 10/18] rockchip: boot0 hook: support early return for RK3188/RK3066-style BROM

2017-10-10 Thread Dr. Philipp Tomsich

> On 10 Oct 2017, at 11:22, Andy Yan  wrote:
> 
> Hi:
> 
> 
> On 2017年10月10日 17:01, Andy Yan wrote:
>> Hi Philipp:
>> 
>> On 2017年10月07日 03:28, Philipp Tomsich wrote:
>>> Some Rockchip BROM versions (e.g. the RK3188 and RK3066) first read 1KB data
>>> from NAND into SRAM and executes it. Then, following a return to bootrom, 
>>> the
>>> BROM loads additional code to SRAM (not overwriting the first block read) 
>>> and
>>> reenters at the same address as the first time.
>>> 
>>> To support booting either a TPL (on the RK3066) or SPL (on the RK3188) using
>>> this model of having to count entries, this commit adds code to the boot0
>>> hook to track the number of entries and handle them accordingly.
>>> 
>>> Signed-off-by: Philipp Tomsich 
>>> Signed-off-by: Paweł Jarosz 
>>> ---
>>> 
>>> Changes in v4: None
>>> Changes in v3: None
>>> Changes in v2: None
>>> 
>>>   arch/arm/include/asm/arch-rockchip/boot0.h | 24 ++--
>>>   arch/arm/mach-rockchip/Kconfig | 28 
>>> 
>>>   2 files changed, 46 insertions(+), 6 deletions(-)
>>> 
>>> diff --git a/arch/arm/include/asm/arch-rockchip/boot0.h 
>>> b/arch/arm/include/asm/arch-rockchip/boot0.h
>>> index f7c6146..06091d0 100644
>>> --- a/arch/arm/include/asm/arch-rockchip/boot0.h
>>> +++ b/arch/arm/include/asm/arch-rockchip/boot0.h
>>> @@ -19,12 +19,24 @@
>>>* beginning of the executable. However, as we want to keep
>>>* this generic and make it applicable to builds that are like
>>>* the RK3368 (TPL needs this, SPL doesn't) or the RK3399 (no
>>> - * TPL, but extra space needed in the SPL), we simply repeat
>>> - * the 'b reset' with the expectation that the first one will
>>> - * be overwritten, if this is the first stage contained in the
>>> - * final image created with mkimage)...
>>> + * TPL, but extra space needed in the SPL), we simply insert
>>> + * a branch-to-next-instruction-word with the expectation that
>>> + * the first one may be overwritten, if this is the first stage
>>> + * contained in the final image created with mkimage)...
>>>*/
>>> -b reset /* may be overwritten --- should be 'nop' or a 'b reset' */
>>> +b 1f /* if overwritten, entry-address is at the next word */
>>> +1:
>>> +#endif
>>> +#if CONFIG_IS_ENABLED(ROCKCHIP_EARLYRETURN_TO_BROM)
>>> +adr r3, entry_counter
>>> +ldrr0, [r3]
>>> +cmpr0, #1   /* check if entry_counter == 1 */
>>> +beqreset/* regular bootup */
>>> +add r0, #1
>>> +strr0, [r3] /* increment the entry_counter in memory */
> 
> It seems that we need to clear r0 to zero before return to bootrom, a 
> non-zero return value will drive the system to bootrom download mode.

Did you test if clearing the r0-register before returning fixes this and we 
boot through into SPL?
If so, I’ll create a v5 of the patch … if not, we will need to dig deeper to 
determine why this does not work as expected.

>>> +bxlr   /* return to bootrom */
>> This seems not work on rk3188, When I track the code flow with DS-5, I
>> found the entry_counter always be zero when we run here from bootrom(even it 
>> is set to 1 before return to bootrom), so it return to bootrom again and 
>> again.
>>> +entry_counter:
>>> +.word   0
>>>   #endif
>>>   b reset
>>>   #if !defined(CONFIG_ARM64)
>>> @@ -32,7 +44,7 @@
>>>* For armv7, the addr '_start' will used as vector start address
>>>* and write to VBAR register, which needs to aligned to 0x20.
>>>*/
>>> -.align(5)
>>> +.align(5), 0x0
>>>   _start:
>>>   ARM_VECTORS
>>>   #endif
>>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
>>> index 31e9864..d59a1d5 100644
>>> --- a/arch/arm/mach-rockchip/Kconfig
>>> +++ b/arch/arm/mach-rockchip/Kconfig
>>> @@ -158,6 +158,34 @@ config ROCKCHIP_SPL_RESERVE_IRAM
>>>   config ROCKCHIP_BROM_HELPER
>>>   bool
>>>   +config SPL_ROCKCHIP_EARLYRETURN_TO_BROM
>>> +bool "SPL requires early-return (for RK3188-style BROM) to BROM"
>>> +depends on SPL && ENABLE_ARM_SOC_BOOT0_HOOK
>>> +help
>>> +  Some Rockchip BROM variants (e.g. on the RK3188) load the
>>> +  first stage in segments and enter multiple times. E.g. on
>>> +  the RK3188, the first 1KB of the first stage are loaded
>>> +  first and entered; after returning to the BROM, the
>>> +  remainder of the first stage is loaded, but the BROM
>>> +  re-enters at the same address/to the same code as previously.
>>> +
>>> +  This enables support code in the BOOT0 hook for the SPL stage
>>> +  to allow multiple entries.
>>> +
>>> +config TPL_ROCKCHIP_EARLYRETURN_TO_BROM
>>> +bool "TPL requires early-return (for RK3188-style BROM) to BROM"
>>> +depends on TPL && 

Re: [U-Boot] [PATCH] dwc: ep0: Allocate and flush dwc->ep0_trb in a cache aligned manner

2017-10-10 Thread Faiz Abbas
Hi Marek,

On Tuesday 10 October 2017 01:30 PM, Marek Vasut wrote:
> On 10/10/2017 07:48 AM, Kishon Vijay Abraham I wrote:
>> Hi,
> 
> Hi,
> 
> [...]
> 
 -  dwc3_flush_cache((uintptr_t)trb, sizeof(*trb));
 +  dwc3_flush_cache((uintptr_t)dwc->ep0_trb_addr, sizeof(*trb) * 
 2);
>>>
>>> Why *2 ?
>>
>> Because its allocated as sizeof(*dwc->ep0_trb) * 2 below. This is not
>> strictly required as dwc3_flush_cache() rounds up the size to
>> CACHELINE_SIZE but from a caller POV, flush everything we allocated.
>
> Can the other TRB be in use ? Maybe aligning the TRBs to cacheline 
> size
> would be better ?
>
 A single trb is 16 bytes in size and two of them are allocated
 contiguously.
>>>
>>> Why are two allocated continuously ? (I am not dwc3 expert)
>>
>> The TRB's should be allocated contiguously for dwc3 and only the base of the
>> entire TRB table is programmed in the HW.
>>   <-- TRB table base address
>> | TRB0   |
>> ||
>> | TRB1   |
>> ||
>> | TRB2   |
>> ||
>> | TRBn   |
>> ||
>>
>>
>>
>> Neither am I. I did try to pad to the dwc_trb structure such that each
>> trb is 64 bytes in size but this leads to failures when testing. I
>> didn't get a chance to debug this though. I suspect its because the code
>> expects the trbs to be contiguous and/or 16 bytes in size.
>>
>> It's not the code but it's the HW.
> 
> That'd imply we need either some sort of flushing scheme or non-cachable
> memory allocation. What does Linux do ?
> The dma_alloc_coherent in linux kernel allocates non-cachable memory.

Currently, the code is using local variable trb to flush the cache. When
the first trb is used, dwc3_flush_cache flushes the complete
CACHELINE_SIZE (including the 2nd trb).
When the 2nd trb is used to flush cache, since it is an unaligned flush,
it will issue a warning and will align it to the lower cache line
boundary (flushing the 1st trb in the process).

So with or without this patch, both trbs are getting flushed with every
call. With the patch, we can just avoid misaligned messages by always
flushing using an aligned address.

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


Re: [U-Boot] efi_loader: search all possible disk partitions

2017-10-10 Thread Jonathan Gray
On Tue, Oct 10, 2017 at 10:01:46AM +0200, Alexander Graf wrote:
> > When searching for partitions don't stop if a partition is not present
> > for a given partition number as there may be valid partitions after.
> > 
> > Search for up to MAX_SEARCH_PARTITIONS matching the other callers of
> > part_get_info().
> > 
> > This allows OpenBSD to boot via the efi_loader on rpi_3 again after
> > changes made after U-Boot 2017.09.  With MBR partitioning OpenBSD will
> > by default use the fourth partition for the 0xA6 (OpenBSD) partition.
> > 
> > Signed-off-by: Jonathan Gray 
> 
> Thanks, applied to efi-next
> 
> Alex
> 

Thanks, looking over it again I realised one of the loops is now
incrementing the partition number twice per loop so I have sent a
further patch to the list to correct that.
>From 18d6201e4e09b9e8d6bc418b23029280a29eb015 Mon Sep 17 00:00:00 2001
From: Jonathan Gray 
Date: Tue, 10 Oct 2017 21:25:16 +1100
Subject: [PATCH] efi_loader: don't increment part twice per loop

Correct a mistake in the part number handling of
16a73b249d138fedeb188710533902ed7aac1ddc and only increment part once
per loop.

Signed-off-by: Jonathan Gray 
---
 lib/efi_loader/efi_disk.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 6b192701a8..e61dbc8058 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -360,7 +360,6 @@ int efi_disk_register(void)
continue;
efi_disk_add_dev(devname, if_typename, desc,
 i, 0, part);
-   part++;
}
 
/* ... and add block device: */
-- 
2.14.2

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


Re: [U-Boot] [PATCH] Powerpc: Make pcie link state judge more specific

2017-10-10 Thread Mingkai Hu


> -Original Message-
> From: York Sun
> Sent: Tuesday, October 03, 2017 11:32 PM
> To: Xiaowei Bao ; Mingkai Hu
> 
> Cc: u-boot@lists.denx.de
> Subject: Re: [PATCH] Powerpc: Make pcie link state judge more specific
> 
> On 09/24/2017 08:44 PM, Bao Xiaowei wrote:
> > For some special reset times for longer pcie devices, in this case,
> > the pcie device may on polling compliance state, the RC considers the
> > pcie device is link up, but the pcie device is not link up, only the
> > L0 state is link up state. So add the link up status judgement mechanisms.
> >
> > Signed-off-by: Bao Xiaowei 
> > ---
> > v2:
> >  - Detailed function module
> >  - Adjust the code structure
> 
> Mingkai,
> 
> Please ack if you agree with this change.
> 

York,

I had discussion with xiaowei and also posted the comments on the patch.

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


[U-Boot] [PATCH] efi_loader: don't increment part twice per loop

2017-10-10 Thread Jonathan Gray
Correct a mistake in the part number handling of
16a73b249d138fedeb188710533902ed7aac1ddc and only increment part once
per loop.

Signed-off-by: Jonathan Gray 
---
 lib/efi_loader/efi_disk.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 6b192701a8..e61dbc8058 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -360,7 +360,6 @@ int efi_disk_register(void)
continue;
efi_disk_add_dev(devname, if_typename, desc,
 i, 0, part);
-   part++;
}
 
/* ... and add block device: */
-- 
2.14.2

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


Re: [U-Boot] [PATCH] Powerpc: Make pcie link state judge more specific

2017-10-10 Thread Mingkai Hu


> -Original Message-
> From: Bao Xiaowei [mailto:xiaowei@nxp.com]
> Sent: Monday, September 25, 2017 11:27 AM
> To: M.h. Lian ; Z.q. Hou ;
> Mingkai Hu ; York Sun ;
> hamish.mar...@alliedtelesis.co.nz; w...@denx.de;
> tony.obr...@alliedtelesis.co.nz; u-boot@lists.denx.de
> Cc: Xiaowei Bao 
> Subject: [PATCH] Powerpc: Make pcie link state judge more specific
> 
> For some special reset times for longer pcie devices, in this case, the pcie
> device may on polling compliance state, the RC considers the pcie device is
> link up, but the pcie device is not link up, only the L0 state is link up 
> state. So
> add the link up status judgement mechanisms.
> 
> Signed-off-by: Bao Xiaowei 
> ---
> v2:
>  - Detailed function module
>  - Adjust the code structure
> 

I suggest to split this patch to two patches, one is for format change, another 
one is for LTSSM change.

>  arch/powerpc/include/asm/fsl_pci.h |   3 +
>  drivers/pci/fsl_pci_init.c | 151 
> -
>  2 files changed, 86 insertions(+), 68 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/fsl_pci.h
> b/arch/powerpc/include/asm/fsl_pci.h
> index cad341e..9dfbf19 100644
> --- a/arch/powerpc/include/asm/fsl_pci.h
> +++ b/arch/powerpc/include/asm/fsl_pci.h
> @@ -24,6 +24,9 @@
> 
>  #define PCI_LTSSM0x404   /* PCIe Link Training, Status State Machine */
>  #define  PCI_LTSSM_L00x16/* L0 state */

It's better to submit a patch to fix the leading space.

> +#define PCIE_GEN3_LTSSM_L0 0x11/* L0 state */

Follow the same name rule as PCI_LTSSM_L0? Like PCI_LTSSM_L0_PEX_REV3?

> +#define LTSSM_PCIE_DETECT_QUIET0x00 /* Detect state */
> +#define LTSSM_PCIE_DETECT_ACTIVE   0x01 /* Detect state */
> 
>  int fsl_setup_hose(struct pci_controller *hose, unsigned long addr);  int
> fsl_is_pci_agent(struct pci_controller *hose); diff --git
> a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c index 
> af20cf0..5d697bc
> 100644
> --- a/drivers/pci/fsl_pci_init.c
> +++ b/drivers/pci/fsl_pci_init.c
> @@ -39,6 +39,8 @@ DECLARE_GLOBAL_DATA_PTR;  #if
> defined(CONFIG_SYS_PCI_64BIT)
> && !defined(CONFIG_SYS_PCI64_MEMORY_BUS)
>  #define CONFIG_SYS_PCI64_MEMORY_BUS (64ull*1024*1024*1024)  #endif
> +#define PEX_CSR0_LTSSM_MASK  0xFC
> +#define PEX_CSR0_LTSSM_SHIFT 2
> 
>  /* Setup one inbound ATMU window.
>   *
> @@ -290,6 +292,81 @@ static void fsl_pcie_boot_master_release_slave(int
> port)  }  #endif
> 
> +static int is_pcie_gen3(struct fsl_pci_info *pci_info) {
> + u32 cfg_addr = (u32)&((ccsr_fsl_pci_t *)pci_info->regs)->cfg_addr;
> + volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *)cfg_addr;
> + u32 block_rev;
> +
> + block_rev = in_be32(>block_rev1);
> + if (block_rev >= PEX_IP_BLK_REV_3_0)
> + return 1;
> + else
> + return 0;
> +}
> +

As discussed, it's not related to gen3. It's related to PEX block version. 
Please use
The PCIe controller version here.

> +static int get_ltssm_val(struct pci_controller *hose,
> +  struct fsl_pci_info *pci_info)
> +{
> + u16 ltssm = 0;
> + pci_dev_t dev = PCI_BDF(hose->first_busno, 0, 0);
> + u32 cfg_addr = (u32)&((ccsr_fsl_pci_t *)pci_info->regs)->cfg_addr;
> + volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *)cfg_addr;
> +
> + if (is_pcie_gen3(pci_info))
> + ltssm = (in_be32(>pex_csr0)
> + & PEX_CSR0_LTSSM_MASK) >>
> PEX_CSR0_LTSSM_SHIFT;
> + else
> + pci_hose_read_config_word(hose, dev, PCI_LTSSM, );
> +
> + return ltssm;
> +}
> +
> +static int pci_link_up(struct pci_controller *hose,
> + struct fsl_pci_info *pci_info)
> +{
> + int enabled = 0;
> + u16 ltssm;
> + int i, pcie_ltssm_l0;
> +
> + if (is_pcie_gen3(pci_info))
> + pcie_ltssm_l0 = PCIE_GEN3_LTSSM_L0;
> + else
> + pcie_ltssm_l0 = PCI_LTSSM_L0;
> +
> + ltssm = get_ltssm_val(hose, pci_info);
> + if (ltssm == LTSSM_PCIE_DETECT_QUIET ||
> + ltssm == LTSSM_PCIE_DETECT_ACTIVE)
> + enabled = 0;
> + else if (ltssm == PCIE_GEN3_LTSSM_L0)
> + enabled = 1;
> + else {
> + for (i = 0; i < 100 && ltssm != pcie_ltssm_l0; i++) {
> + ltssm = get_ltssm_val(hose, pci_info);
> + udelay(1000);
> + }
> + enabled = (ltssm == pcie_ltssm_l0) ? 1 : 0;
> + }
> + return enabled;
> +}
> +
> +#if defined(CONFIG_FSL_PCIE_RESET) || \
> + defined(CONFIG_SYS_P4080_ERRATUM_PCIE_A003)
> +static void do_pcie_reset(struct fsl_pci_info *pci_info) {
> + u32 cfg_addr = (u32)&((ccsr_fsl_pci_t *)pci_info->regs)->cfg_addr;
> + volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *)cfg_addr;
> +
> + /* assert PCIe reset */
> + 

  1   2   >