public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup
@ 2016-11-15 21:02 Stefan Agner
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined Stefan Agner
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Stefan Agner @ 2016-11-15 21:02 UTC (permalink / raw)
  To: u-boot

From: Stefan Agner <stefan.agner@toradex.com>


This patchset cleans up the SPL USB Gadget Kconfig and Makfile.
The first two patches are actual fixes and we might consider to
add these two for the v2016.11 release. The third one adds a new
config option for cleaner structure. I plan to add another USB
function with SPL support which is the reason I looked into
this...

Build tested using buildman for all boards on powerpc mips and
arm. No new errors or warnings:
Building 4 commits for 1072 boards (8 threads, 1 job per thread)
 4044    0  244 /4288   P1022DS_NAND

This patchset is probably most interesting for
am335x_evm_usbspl_defconfig (CONFIG_SPL_USBETH_SUPPORT)
And the board with which SPL DFU support has been introduced
dra7xx_evm_defconfig (CONFIG_SPL_DFU_SUPPORT, not set by default)

Due to lack of any of this hardware I did not run the binaries!
Since it is mostly Makefile shuffling I don't expect any runtime
behavior changes... If anyone (maybe Ravi or Lukasz, afaik you
worked on the SPL DFU support for dra7xx_evm) could test the
patchset on actual hardware I would be glad!

--
Stefan

Changes in v3:
- Fix depends on SPL_USB_GADGET_SUPPORT and use if statement

Changes in v2:
- Use CONFIG_SPL_RAM_SUPPORT to descide whether to compile the
  function in first place.
- Leave DWC3 config in top level SPL Makefile (as U-Boot does)

Stefan Agner (3):
  spl: add RAM boot device only if it is actually defined
  spl: dfu: move DFU Kconfig to SPL Kconfig
  spl: add USB Gadget config option

 Kconfig                             | 27 ------------------
 common/spl/Kconfig                  | 57 ++++++++++++++++++++++++++++++-------
 common/spl/spl.c                    |  4 ++-
 configs/am335x_evm_usbspl_defconfig |  1 +
 drivers/Makefile                    |  4 ++-
 drivers/usb/gadget/Makefile         |  9 ++++--
 include/configs/dra7xx_evm.h        |  1 -
 scripts/Makefile.spl                |  5 +---
 8 files changed, 61 insertions(+), 47 deletions(-)

-- 
2.10.2

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined
  2016-11-15 21:02 [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup Stefan Agner
@ 2016-11-15 21:02 ` Stefan Agner
  2016-11-16 13:44   ` Lukasz Majewski
  2016-11-18  1:14   ` Simon Glass
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 2/3] spl: dfu: move DFU Kconfig to SPL Kconfig Stefan Agner
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 12+ messages in thread
From: Stefan Agner @ 2016-11-15 21:02 UTC (permalink / raw)
  To: u-boot

From: Stefan Agner <stefan.agner@toradex.com>

Some devices (e.g. dra7xx) support loading to RAM using DFU without
having direct boot from RAM support. Make sure the linker list
does not contain BOOT_DEVICE_RAM if CONFIG_SPL_RAM_SUPPORT is not
enabled.

Fixes: 98136b2f26fa ("spl: Convert spl_ram_load_image() to use linker list")

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
---

Changes in v3: None
Changes in v2:
- Use CONFIG_SPL_RAM_SUPPORT to descide whether to compile the
  function in first place.

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

diff --git a/common/spl/spl.c b/common/spl/spl.c
index bdb165a..ef17619 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -174,7 +174,7 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
 # define CONFIG_SPL_LOAD_FIT_ADDRESS	0
 #endif
 
-#if defined(CONFIG_SPL_RAM_DEVICE) || defined(CONFIG_SPL_DFU_SUPPORT)
+#if defined(CONFIG_SPL_RAM_SUPPORT) || defined(CONFIG_SPL_DFU_SUPPORT)
 static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector,
 			       ulong count, void *buf)
 {
@@ -220,7 +220,9 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
 
 	return 0;
 }
+#if defined(CONFIG_SPL_RAM_SUPPORT)
 SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_RAM, spl_ram_load_image);
+#endif
 #if defined(CONFIG_SPL_DFU_SUPPORT)
 SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_DFU, spl_ram_load_image);
 #endif
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 2/3] spl: dfu: move DFU Kconfig to SPL Kconfig
  2016-11-15 21:02 [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup Stefan Agner
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined Stefan Agner
@ 2016-11-15 21:02 ` Stefan Agner
  2016-11-15 21:34   ` Brüns, Stefan
  2016-11-16 14:06   ` Lukasz Majewski
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 3/3] spl: add USB Gadget config option Stefan Agner
  2016-11-16  7:04 ` [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup B, Ravi
  3 siblings, 2 replies; 12+ messages in thread
From: Stefan Agner @ 2016-11-15 21:02 UTC (permalink / raw)
  To: u-boot

From: Stefan Agner <stefan.agner@toradex.com>

The DFU Kconfig menu entries should be part of the SPL
Kconfig file. Also avoid using the top level Makefile by
moving the config dependent build artifacts to the driver/
and driver/usb/gadget/ Makfiles.

With that, DFU can be built again in SPL if
CONFIG_SPL_DFU_SUPPORT is enabled.

Fixes: 6ad6102246d8 ("usb:gadget: Disallow DFU in SPL for now")

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---
Tom, I checked size for am335x_evm_usbspl_defconfig, it stays
fine with this patch.

Changes in v3: None
Changes in v2:
- Leave DWC3 config in top level SPL Makefile (as U-Boot does)

 Kconfig                      | 27 ---------------------------
 common/spl/Kconfig           | 26 ++++++++++++++++++++++++++
 drivers/Makefile             |  3 +++
 drivers/usb/gadget/Makefile  |  8 ++++++--
 include/configs/dra7xx_evm.h |  1 -
 scripts/Makefile.spl         |  3 ---
 6 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/Kconfig b/Kconfig
index 1263d0b..a759e4d 100644
--- a/Kconfig
+++ b/Kconfig
@@ -291,33 +291,6 @@ config FIT_IMAGE_POST_PROCESS
 	  injected into the FIT creation (i.e. the blobs would have been pre-
 	  processed before being added to the FIT image).
 
-config SPL_DFU_SUPPORT
-	bool "Enable SPL with DFU to load binaries to memory device"
-	depends on USB
-	help
-	  Currently the SPL does not have capability to load the
-	  binaries or boot images to boot devices like ram,eMMC,SPI,etc.
-	  This feature enables the DFU (Device Firmware Upgarde) in SPL with
-	  RAM memory device support. The ROM code will load and execute
-	  the SPL built with dfu. The user can load binaries (u-boot/kernel) to
-	  selected device partition from host-pc using dfu-utils.
-		This feature will be useful to flash the binaries to factory
-	  or bare-metal boards using USB interface.
-
-choice
-	bool "DFU device selection"
-	depends on SPL_DFU_SUPPORT
-
-config SPL_DFU_RAM
-	bool "RAM device"
-	depends on SPL_DFU_SUPPORT
-	help
-	 select RAM/DDR memory device for loading binary images
-	 (u-boot/kernel) to the selected device partition using
-	 DFU and execute the u-boot/kernel from RAM.
-
-endchoice
-
 config SYS_CLK_FREQ
 	depends on ARC || ARCH_SUNXI
 	int "CPU clock frequency"
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index bb99f1f..54bcba3 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -497,6 +497,32 @@ config SPL_USB_SUPPORT
 	  config options. This enables loading from USB using a configured
 	  device.
 
+config SPL_DFU_SUPPORT
+	bool "Support DFU (Device Firmware Upgarde)"
+	depends on SPL
+	select SPL_HASH_SUPPORT
+	help
+	  This feature enables the DFU (Device Firmware Upgarde) in SPL with
+	  RAM memory device support. The ROM code will load and execute
+	  the SPL built with dfu. The user can load binaries (u-boot/kernel) to
+	  selected device partition from host-pc using dfu-utils.
+	  This feature is useful to flash the binaries to factory or bare-metal
+	  boards using USB interface.
+
+choice
+	bool "DFU device selection"
+	depends on SPL_DFU_SUPPORT
+
+config SPL_DFU_RAM
+	bool "RAM device"
+	depends on SPL_DFU_SUPPORT
+	help
+	 select RAM/DDR memory device for loading binary images
+	 (u-boot/kernel) to the selected device partition using
+	 DFU and execute the u-boot/kernel from RAM.
+
+endchoice
+
 config SPL_WATCHDOG_SUPPORT
 	bool "Support watchdog drivers"
 	depends on SPL
diff --git a/drivers/Makefile b/drivers/Makefile
index 761d0b3..40aba58 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -34,6 +34,9 @@ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/
 obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/
 obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/
 obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/
+obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/
+obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/udc/
+obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/
 obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
 obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
 obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index acc9964..5b18e8c 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -8,6 +8,10 @@
 obj-$(CONFIG_USB_GADGET) += epautoconf.o config.o usbstring.o
 obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o usbstring.o
 
+ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_SPL_DFU_SUPPORT) += f_dfu.o
+endif
+
 # new USB gadget layer dependencies
 ifdef CONFIG_USB_GADGET
 obj-$(CONFIG_USB_GADGET_AT91) += at91_udc.o
@@ -18,13 +22,13 @@ obj-$(CONFIG_USB_GADGET_DWC2_OTG_PHY) += dwc2_udc_otg_phy.o
 obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
 obj-$(CONFIG_CI_UDC)	+= ci_udc.o
 obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
-obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
 ifndef CONFIG_SPL_BUILD
+obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
 obj-$(CONFIG_USB_FUNCTION_DFU) += f_dfu.o
-endif
 obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
 obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o
 endif
+endif
 ifdef CONFIG_USB_ETHER
 obj-y += ether.o
 obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index 798002d..e295a84 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -133,7 +133,6 @@
 #undef CONFIG_CMD_BOOTD
 #ifdef CONFIG_SPL_DFU_SUPPORT
 #define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000
-#define CONFIG_SPL_HASH_SUPPORT
 #define DFU_ALT_INFO_RAM \
 	"dfu_alt_info_ram=" \
 	"kernel ram 0x80200000 0x4000000;" \
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index e0b0117..1e3b60a 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -66,9 +66,6 @@ endif
 
 libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
 libs-y += drivers/
-libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/dfu/
-libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/
-libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/udc/
 libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/
 libs-y += dts/
 libs-y += fs/
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 3/3] spl: add USB Gadget config option
  2016-11-15 21:02 [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup Stefan Agner
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined Stefan Agner
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 2/3] spl: dfu: move DFU Kconfig to SPL Kconfig Stefan Agner
@ 2016-11-15 21:02 ` Stefan Agner
  2016-11-16 14:31   ` Lukasz Majewski
  2016-11-16  7:04 ` [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup B, Ravi
  3 siblings, 1 reply; 12+ messages in thread
From: Stefan Agner @ 2016-11-15 21:02 UTC (permalink / raw)
  To: u-boot

From: Stefan Agner <stefan.agner@toradex.com>

Introduce USB Gadget config option. This allows to combine Makefile
entries for SPL_USBETH_SUPPORT and SPL_DFU_SUPPORT.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

---

Changes in v3:
- Fix depends on SPL_USB_GADGET_SUPPORT and use if statement

Changes in v2: None

 common/spl/Kconfig                  | 33 +++++++++++++++++++++------------
 configs/am335x_evm_usbspl_defconfig |  1 +
 drivers/Makefile                    |  5 ++---
 drivers/usb/gadget/Makefile         |  3 ++-
 scripts/Makefile.spl                |  2 +-
 5 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 54bcba3..3305299 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -465,17 +465,6 @@ config SPL_SPI_SUPPORT
 	  enable SPI drivers that are needed for other purposes also, such
 	  as a SPI PMIC.
 
-config SPL_USBETH_SUPPORT
-	bool "Support USB Ethernet drivers"
-	depends on SPL
-	help
-	  Enable access to the USB network subsystem and associated
-	  drivers in SPL. This permits SPL to load U-Boot over a
-	  USB-connected Ethernet link (such as a USB Ethernet dongle) rather
-	  than from an onboard peripheral. Environment support is required
-	  since the network stack uses a number of environment variables.
-	  See also SPL_NET_SUPPORT and SPL_ETH_SUPPORT.
-
 config SPL_USB_HOST_SUPPORT
 	bool "Support USB host drivers"
 	depends on SPL
@@ -497,9 +486,27 @@ config SPL_USB_SUPPORT
 	  config options. This enables loading from USB using a configured
 	  device.
 
+config SPL_USB_GADGET_SUPPORT
+	bool "Suppport USB Gadget drivers"
+	depends on SPL
+	help
+	  Enable USB Gadget API which allows to enable USB device functions
+	  in SPL.
+
+if SPL_USB_GADGET_SUPPORT
+
+config SPL_USBETH_SUPPORT
+	bool "Support USB Ethernet drivers"
+	help
+	  Enable access to the USB network subsystem and associated
+	  drivers in SPL. This permits SPL to load U-Boot over a
+	  USB-connected Ethernet link (such as a USB Ethernet dongle) rather
+	  than from an onboard peripheral. Environment support is required
+	  since the network stack uses a number of environment variables.
+	  See also SPL_NET_SUPPORT and SPL_ETH_SUPPORT.
+
 config SPL_DFU_SUPPORT
 	bool "Support DFU (Device Firmware Upgarde)"
-	depends on SPL
 	select SPL_HASH_SUPPORT
 	help
 	  This feature enables the DFU (Device Firmware Upgarde) in SPL with
@@ -523,6 +530,8 @@ config SPL_DFU_RAM
 
 endchoice
 
+endif
+
 config SPL_WATCHDOG_SUPPORT
 	bool "Support watchdog drivers"
 	depends on SPL
diff --git a/configs/am335x_evm_usbspl_defconfig b/configs/am335x_evm_usbspl_defconfig
index 8c28e28..fdb6f77 100644
--- a/configs/am335x_evm_usbspl_defconfig
+++ b/configs/am335x_evm_usbspl_defconfig
@@ -12,6 +12,7 @@ CONFIG_SPL_MTD_SUPPORT=y
 CONFIG_SPL_MUSB_NEW_SUPPORT=y
 CONFIG_SPL_NET_SUPPORT=y
 CONFIG_SPL_OS_BOOT=y
+CONFIG_SPL_GADGET_SUPPORT=y
 CONFIG_SPL_USBETH_SUPPORT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_BOOTZ=y
diff --git a/drivers/Makefile b/drivers/Makefile
index 40aba58..c19fa14 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -33,9 +33,8 @@ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/
 obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/
 obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/
 obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/
-obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/
-obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/
-obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/udc/
+obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/
+obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/udc/
 obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/
 obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
 obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 5b18e8c..0fbbb7c 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_USB_GADGET) += epautoconf.o config.o usbstring.o
 obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o usbstring.o
 
 ifdef CONFIG_SPL_BUILD
+obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += g_dnl.o
 obj-$(CONFIG_SPL_DFU_SUPPORT) += f_dfu.o
 endif
 
@@ -21,8 +22,8 @@ obj-$(CONFIG_USB_GADGET_DWC2_OTG) += dwc2_udc_otg.o
 obj-$(CONFIG_USB_GADGET_DWC2_OTG_PHY) += dwc2_udc_otg_phy.o
 obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
 obj-$(CONFIG_CI_UDC)	+= ci_udc.o
-obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
 ifndef CONFIG_SPL_BUILD
+obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
 obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
 obj-$(CONFIG_USB_FUNCTION_DFU) += f_dfu.o
 obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 1e3b60a..0ca8430 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -66,7 +66,7 @@ endif
 
 libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
 libs-y += drivers/
-libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/
+libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/
 libs-y += dts/
 libs-y += fs/
 libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
-- 
2.10.2

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 2/3] spl: dfu: move DFU Kconfig to SPL Kconfig
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 2/3] spl: dfu: move DFU Kconfig to SPL Kconfig Stefan Agner
@ 2016-11-15 21:34   ` Brüns, Stefan
  2016-11-16 14:06   ` Lukasz Majewski
  1 sibling, 0 replies; 12+ messages in thread
From: Brüns, Stefan @ 2016-11-15 21:34 UTC (permalink / raw)
  To: u-boot

On Dienstag, 15. November 2016 13:02:45 CET Stefan Agner wrote:
> From: Stefan Agner <stefan.agner@toradex.com>
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index bb99f1f..54bcba3 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -497,6 +497,32 @@ config SPL_USB_SUPPORT
>  	  config options. This enables loading from USB using a configured
>  	  device.
> 
> +config SPL_DFU_SUPPORT
> +	bool "Support DFU (Device Firmware Upgarde)"
Typo: Upgrade

> +	depends on SPL
> +	select SPL_HASH_SUPPORT
> +	help
> +	  This feature enables the DFU (Device Firmware Upgarde) in SPL with
dito

> +	  RAM memory device support. The ROM code will load and execute
> +	  the SPL built with dfu. The user can load binaries (u-boot/kernel) to
> +	  selected device partition from host-pc using dfu-utils.
a selected /or/ partitions

> +	  This feature is useful to flash the binaries to factory or bare-metal
> +	  boards using USB interface.
> +

Kind regards,

Stefan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup
  2016-11-15 21:02 [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup Stefan Agner
                   ` (2 preceding siblings ...)
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 3/3] spl: add USB Gadget config option Stefan Agner
@ 2016-11-16  7:04 ` B, Ravi
  3 siblings, 0 replies; 12+ messages in thread
From: B, Ravi @ 2016-11-16  7:04 UTC (permalink / raw)
  To: u-boot

Hi Stefan

>From: Stefan Agner <stefan.agner@toradex.com>


>This patchset cleans up the SPL USB Gadget Kconfig and Makfile.
>The first two patches are actual fixes and we might consider to add these two for the v2016.11 release. The third one adds a new config option >for cleaner structure. I plan to add another USB function with SPL support which is the reason I looked into this...

>Build tested using buildman for all boards on powerpc mips and arm. No new errors or warnings:
>Building 4 commits for 1072 boards (8 threads, 1 job per thread)
>4044    0  244 /4288   P1022DS_NAND

>This patchset is probably most interesting for am335x_evm_usbspl_defconfig (CONFIG_SPL_USBETH_SUPPORT) And the board with which SPL >DFU support has been introduced dra7xx_evm_defconfig (CONFIG_SPL_DFU_SUPPORT, not set by default)

>Due to lack of any of this hardware I did not run the binaries!
>Since it is mostly Makefile shuffling I don't expect any runtime behavior changes... If anyone (maybe Ravi or Lukasz, afaik you worked on the SPL >DFU support for dra7xx_evm) could test the patchset on actual hardware I would be glad!

I have test verified on dra7xx platform. Looks good to me. Thanks.

Regards
Ravi

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined Stefan Agner
@ 2016-11-16 13:44   ` Lukasz Majewski
  2016-11-18  1:14   ` Simon Glass
  1 sibling, 0 replies; 12+ messages in thread
From: Lukasz Majewski @ 2016-11-16 13:44 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

> From: Stefan Agner <stefan.agner@toradex.com>
> 
> Some devices (e.g. dra7xx) support loading to RAM using DFU without
> having direct boot from RAM support. Make sure the linker list
> does not contain BOOT_DEVICE_RAM if CONFIG_SPL_RAM_SUPPORT is not
> enabled.
> 
> Fixes: 98136b2f26fa ("spl: Convert spl_ram_load_image() to use linker
> list")
> 

Thanks for the patch and sorry for late reply....

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
> ---
> 
> Changes in v3: None
> Changes in v2:
> - Use CONFIG_SPL_RAM_SUPPORT to descide whether to compile the
>   function in first place.
> 
>  common/spl/spl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index bdb165a..ef17619 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -174,7 +174,7 @@ __weak void __noreturn
> jump_to_image_no_args(struct spl_image_info *spl_image) # define
> CONFIG_SPL_LOAD_FIT_ADDRESS	0 #endif
>  
> -#if defined(CONFIG_SPL_RAM_DEVICE) || defined(CONFIG_SPL_DFU_SUPPORT)
> +#if defined(CONFIG_SPL_RAM_SUPPORT) ||
> defined(CONFIG_SPL_DFU_SUPPORT) static ulong spl_ram_load_read(struct
> spl_load_info *load, ulong sector, ulong count, void *buf)
>  {
> @@ -220,7 +220,9 @@ static int spl_ram_load_image(struct
> spl_image_info *spl_image, 
>  	return 0;
>  }
> +#if defined(CONFIG_SPL_RAM_SUPPORT)
>  SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_RAM, spl_ram_load_image);
> +#endif
>  #if defined(CONFIG_SPL_DFU_SUPPORT)
>  SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_DFU, spl_ram_load_image);
>  #endif



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 2/3] spl: dfu: move DFU Kconfig to SPL Kconfig
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 2/3] spl: dfu: move DFU Kconfig to SPL Kconfig Stefan Agner
  2016-11-15 21:34   ` Brüns, Stefan
@ 2016-11-16 14:06   ` Lukasz Majewski
  1 sibling, 0 replies; 12+ messages in thread
From: Lukasz Majewski @ 2016-11-16 14:06 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

> From: Stefan Agner <stefan.agner@toradex.com>
> 
> The DFU Kconfig menu entries should be part of the SPL
> Kconfig file. Also avoid using the top level Makefile by
> moving the config dependent build artifacts to the driver/
> and driver/usb/gadget/ Makfiles.
> 
> With that, DFU can be built again in SPL if
> CONFIG_SPL_DFU_SUPPORT is enabled.
> 
> Fixes: 6ad6102246d8 ("usb:gadget: Disallow DFU in SPL for now")
> 
> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

> 
> ---
> Tom, I checked size for am335x_evm_usbspl_defconfig, it stays
> fine with this patch.
> 
> Changes in v3: None
> Changes in v2:
> - Leave DWC3 config in top level SPL Makefile (as U-Boot does)
> 
>  Kconfig                      | 27 ---------------------------
>  common/spl/Kconfig           | 26 ++++++++++++++++++++++++++
>  drivers/Makefile             |  3 +++
>  drivers/usb/gadget/Makefile  |  8 ++++++--
>  include/configs/dra7xx_evm.h |  1 -
>  scripts/Makefile.spl         |  3 ---
>  6 files changed, 35 insertions(+), 33 deletions(-)
> 
> diff --git a/Kconfig b/Kconfig
> index 1263d0b..a759e4d 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -291,33 +291,6 @@ config FIT_IMAGE_POST_PROCESS
>  	  injected into the FIT creation (i.e. the blobs would have
> been pre- processed before being added to the FIT image).
>  
> -config SPL_DFU_SUPPORT
> -	bool "Enable SPL with DFU to load binaries to memory device"
> -	depends on USB
> -	help
> -	  Currently the SPL does not have capability to load the
> -	  binaries or boot images to boot devices like
> ram,eMMC,SPI,etc.
> -	  This feature enables the DFU (Device Firmware Upgarde) in
> SPL with
> -	  RAM memory device support. The ROM code will load and
> execute
> -	  the SPL built with dfu. The user can load binaries
> (u-boot/kernel) to
> -	  selected device partition from host-pc using dfu-utils.
> -		This feature will be useful to flash the binaries to
> factory
> -	  or bare-metal boards using USB interface.
> -
> -choice
> -	bool "DFU device selection"
> -	depends on SPL_DFU_SUPPORT
> -
> -config SPL_DFU_RAM
> -	bool "RAM device"
> -	depends on SPL_DFU_SUPPORT
> -	help
> -	 select RAM/DDR memory device for loading binary images
> -	 (u-boot/kernel) to the selected device partition using
> -	 DFU and execute the u-boot/kernel from RAM.
> -
> -endchoice
> -
>  config SYS_CLK_FREQ
>  	depends on ARC || ARCH_SUNXI
>  	int "CPU clock frequency"
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index bb99f1f..54bcba3 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -497,6 +497,32 @@ config SPL_USB_SUPPORT
>  	  config options. This enables loading from USB using a
> configured device.
>  
> +config SPL_DFU_SUPPORT
> +	bool "Support DFU (Device Firmware Upgarde)"
> +	depends on SPL
> +	select SPL_HASH_SUPPORT
> +	help
> +	  This feature enables the DFU (Device Firmware Upgarde) in
> SPL with
> +	  RAM memory device support. The ROM code will load and
> execute
> +	  the SPL built with dfu. The user can load binaries
> (u-boot/kernel) to
> +	  selected device partition from host-pc using dfu-utils.
> +	  This feature is useful to flash the binaries to factory or
> bare-metal
> +	  boards using USB interface.
> +
> +choice
> +	bool "DFU device selection"
> +	depends on SPL_DFU_SUPPORT
> +
> +config SPL_DFU_RAM
> +	bool "RAM device"
> +	depends on SPL_DFU_SUPPORT
> +	help
> +	 select RAM/DDR memory device for loading binary images
> +	 (u-boot/kernel) to the selected device partition using
> +	 DFU and execute the u-boot/kernel from RAM.
> +
> +endchoice
> +
>  config SPL_WATCHDOG_SUPPORT
>  	bool "Support watchdog drivers"
>  	depends on SPL
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 761d0b3..40aba58 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -34,6 +34,9 @@ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/
>  obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/
>  obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/
>  obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/
> +obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/
> +obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/udc/
> +obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/
>  obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
>  obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
>  obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/
> diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
> index acc9964..5b18e8c 100644
> --- a/drivers/usb/gadget/Makefile
> +++ b/drivers/usb/gadget/Makefile
> @@ -8,6 +8,10 @@
>  obj-$(CONFIG_USB_GADGET) += epautoconf.o config.o usbstring.o
>  obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o usbstring.o
>  
> +ifdef CONFIG_SPL_BUILD
> +obj-$(CONFIG_SPL_DFU_SUPPORT) += f_dfu.o
> +endif
> +
>  # new USB gadget layer dependencies
>  ifdef CONFIG_USB_GADGET
>  obj-$(CONFIG_USB_GADGET_AT91) += at91_udc.o
> @@ -18,13 +22,13 @@ obj-$(CONFIG_USB_GADGET_DWC2_OTG_PHY) +=
> dwc2_udc_otg_phy.o obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
>  obj-$(CONFIG_CI_UDC)	+= ci_udc.o
>  obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
> -obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
>  ifndef CONFIG_SPL_BUILD
> +obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
>  obj-$(CONFIG_USB_FUNCTION_DFU) += f_dfu.o
> -endif
>  obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
>  obj-$(CONFIG_USB_FUNCTION_FASTBOOT) += f_fastboot.o
>  endif
> +endif
>  ifdef CONFIG_USB_ETHER
>  obj-y += ether.o
>  obj-$(CONFIG_USB_ETH_RNDIS) += rndis.o
> diff --git a/include/configs/dra7xx_evm.h
> b/include/configs/dra7xx_evm.h index 798002d..e295a84 100644
> --- a/include/configs/dra7xx_evm.h
> +++ b/include/configs/dra7xx_evm.h
> @@ -133,7 +133,6 @@
>  #undef CONFIG_CMD_BOOTD
>  #ifdef CONFIG_SPL_DFU_SUPPORT
>  #define CONFIG_SPL_LOAD_FIT_ADDRESS 0x80200000
> -#define CONFIG_SPL_HASH_SUPPORT
>  #define DFU_ALT_INFO_RAM \
>  	"dfu_alt_info_ram=" \
>  	"kernel ram 0x80200000 0x4000000;" \
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index e0b0117..1e3b60a 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -66,9 +66,6 @@ endif
>  
>  libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
>  libs-y += drivers/
> -libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/dfu/
> -libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/
> -libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/gadget/udc/
>  libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/
>  libs-y += dts/
>  libs-y += fs/



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 3/3] spl: add USB Gadget config option
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 3/3] spl: add USB Gadget config option Stefan Agner
@ 2016-11-16 14:31   ` Lukasz Majewski
  0 siblings, 0 replies; 12+ messages in thread
From: Lukasz Majewski @ 2016-11-16 14:31 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

> From: Stefan Agner <stefan.agner@toradex.com>
> 
> Introduce USB Gadget config option. This allows to combine Makefile
> entries for SPL_USBETH_SUPPORT and SPL_DFU_SUPPORT.
> 
> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>

Thanks for the patch.

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

> 
> ---
> 
> Changes in v3:
> - Fix depends on SPL_USB_GADGET_SUPPORT and use if statement
> 
> Changes in v2: None
> 
>  common/spl/Kconfig                  | 33
> +++++++++++++++++++++------------ configs/am335x_evm_usbspl_defconfig
> |  1 + drivers/Makefile                    |  5 ++---
>  drivers/usb/gadget/Makefile         |  3 ++-
>  scripts/Makefile.spl                |  2 +-
>  5 files changed, 27 insertions(+), 17 deletions(-)
> 
> diff --git a/common/spl/Kconfig b/common/spl/Kconfig
> index 54bcba3..3305299 100644
> --- a/common/spl/Kconfig
> +++ b/common/spl/Kconfig
> @@ -465,17 +465,6 @@ config SPL_SPI_SUPPORT
>  	  enable SPI drivers that are needed for other purposes
> also, such as a SPI PMIC.
>  
> -config SPL_USBETH_SUPPORT
> -	bool "Support USB Ethernet drivers"
> -	depends on SPL
> -	help
> -	  Enable access to the USB network subsystem and associated
> -	  drivers in SPL. This permits SPL to load U-Boot over a
> -	  USB-connected Ethernet link (such as a USB Ethernet
> dongle) rather
> -	  than from an onboard peripheral. Environment support is
> required
> -	  since the network stack uses a number of environment
> variables.
> -	  See also SPL_NET_SUPPORT and SPL_ETH_SUPPORT.
> -
>  config SPL_USB_HOST_SUPPORT
>  	bool "Support USB host drivers"
>  	depends on SPL
> @@ -497,9 +486,27 @@ config SPL_USB_SUPPORT
>  	  config options. This enables loading from USB using a
> configured device.
>  
> +config SPL_USB_GADGET_SUPPORT
> +	bool "Suppport USB Gadget drivers"
> +	depends on SPL
> +	help
> +	  Enable USB Gadget API which allows to enable USB device
> functions
> +	  in SPL.
> +
> +if SPL_USB_GADGET_SUPPORT
> +
> +config SPL_USBETH_SUPPORT
> +	bool "Support USB Ethernet drivers"
> +	help
> +	  Enable access to the USB network subsystem and associated
> +	  drivers in SPL. This permits SPL to load U-Boot over a
> +	  USB-connected Ethernet link (such as a USB Ethernet
> dongle) rather
> +	  than from an onboard peripheral. Environment support is
> required
> +	  since the network stack uses a number of environment
> variables.
> +	  See also SPL_NET_SUPPORT and SPL_ETH_SUPPORT.
> +
>  config SPL_DFU_SUPPORT
>  	bool "Support DFU (Device Firmware Upgarde)"
> -	depends on SPL
>  	select SPL_HASH_SUPPORT
>  	help
>  	  This feature enables the DFU (Device Firmware Upgarde) in
> SPL with @@ -523,6 +530,8 @@ config SPL_DFU_RAM
>  
>  endchoice
>  
> +endif
> +
>  config SPL_WATCHDOG_SUPPORT
>  	bool "Support watchdog drivers"
>  	depends on SPL
> diff --git a/configs/am335x_evm_usbspl_defconfig
> b/configs/am335x_evm_usbspl_defconfig index 8c28e28..fdb6f77 100644
> --- a/configs/am335x_evm_usbspl_defconfig
> +++ b/configs/am335x_evm_usbspl_defconfig
> @@ -12,6 +12,7 @@ CONFIG_SPL_MTD_SUPPORT=y
>  CONFIG_SPL_MUSB_NEW_SUPPORT=y
>  CONFIG_SPL_NET_SUPPORT=y
>  CONFIG_SPL_OS_BOOT=y
> +CONFIG_SPL_GADGET_SUPPORT=y
>  CONFIG_SPL_USBETH_SUPPORT=y
>  CONFIG_HUSH_PARSER=y
>  CONFIG_CMD_BOOTZ=y
> diff --git a/drivers/Makefile b/drivers/Makefile
> index 40aba58..c19fa14 100644
> --- a/drivers/Makefile
> +++ b/drivers/Makefile
> @@ -33,9 +33,8 @@ obj-$(CONFIG_SPL_ETH_SUPPORT) += net/
>  obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/
>  obj-$(CONFIG_SPL_USBETH_SUPPORT) += net/phy/
>  obj-$(CONFIG_SPL_MUSB_NEW_SUPPORT) += usb/musb-new/
> -obj-$(CONFIG_SPL_USBETH_SUPPORT) += usb/gadget/
> -obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/
> -obj-$(CONFIG_SPL_DFU_SUPPORT) += usb/gadget/udc/
> +obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/
> +obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += usb/gadget/udc/
>  obj-$(CONFIG_SPL_DFU_SUPPORT) += dfu/
>  obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
>  obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
> diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
> index 5b18e8c..0fbbb7c 100644
> --- a/drivers/usb/gadget/Makefile
> +++ b/drivers/usb/gadget/Makefile
> @@ -9,6 +9,7 @@ obj-$(CONFIG_USB_GADGET) += epautoconf.o config.o
> usbstring.o obj-$(CONFIG_USB_ETHER) += epautoconf.o config.o
> usbstring.o 
>  ifdef CONFIG_SPL_BUILD
> +obj-$(CONFIG_SPL_USB_GADGET_SUPPORT) += g_dnl.o
>  obj-$(CONFIG_SPL_DFU_SUPPORT) += f_dfu.o
>  endif
>  
> @@ -21,8 +22,8 @@ obj-$(CONFIG_USB_GADGET_DWC2_OTG) += dwc2_udc_otg.o
>  obj-$(CONFIG_USB_GADGET_DWC2_OTG_PHY) += dwc2_udc_otg_phy.o
>  obj-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
>  obj-$(CONFIG_CI_UDC)	+= ci_udc.o
> -obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
>  ifndef CONFIG_SPL_BUILD
> +obj-$(CONFIG_USB_GADGET_DOWNLOAD) += g_dnl.o
>  obj-$(CONFIG_USB_FUNCTION_THOR) += f_thor.o
>  obj-$(CONFIG_USB_FUNCTION_DFU) += f_dfu.o
>  obj-$(CONFIG_USB_FUNCTION_MASS_STORAGE) += f_mass_storage.o
> diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
> index 1e3b60a..0ca8430 100644
> --- a/scripts/Makefile.spl
> +++ b/scripts/Makefile.spl
> @@ -66,7 +66,7 @@ endif
>  
>  libs-$(CONFIG_SPL_LIBDISK_SUPPORT) += disk/
>  libs-y += drivers/
> -libs-$(CONFIG_SPL_DFU_SUPPORT) += drivers/usb/dwc3/
> +libs-$(CONFIG_SPL_USB_GADGET_SUPPORT) += drivers/usb/dwc3/
>  libs-y += dts/
>  libs-y += fs/
>  libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined
  2016-11-15 21:02 ` [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined Stefan Agner
  2016-11-16 13:44   ` Lukasz Majewski
@ 2016-11-18  1:14   ` Simon Glass
  2016-11-18  1:27     ` Stefan Agner
  1 sibling, 1 reply; 12+ messages in thread
From: Simon Glass @ 2016-11-18  1:14 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

On 15 November 2016 at 14:02, Stefan Agner <stefan@agner.ch> wrote:
> From: Stefan Agner <stefan.agner@toradex.com>
>
> Some devices (e.g. dra7xx) support loading to RAM using DFU without
> having direct boot from RAM support. Make sure the linker list
> does not contain BOOT_DEVICE_RAM if CONFIG_SPL_RAM_SUPPORT is not
> enabled.
>
> Fixes: 98136b2f26fa ("spl: Convert spl_ram_load_image() to use linker list")
>
> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
> ---
>
> Changes in v3: None
> Changes in v2:
> - Use CONFIG_SPL_RAM_SUPPORT to descide whether to compile the
>   function in first place.
>
>  common/spl/spl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index bdb165a..ef17619 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -174,7 +174,7 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
>  # define CONFIG_SPL_LOAD_FIT_ADDRESS   0
>  #endif
>
> -#if defined(CONFIG_SPL_RAM_DEVICE) || defined(CONFIG_SPL_DFU_SUPPORT)
> +#if defined(CONFIG_SPL_RAM_SUPPORT) || defined(CONFIG_SPL_DFU_SUPPORT)
>  static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector,
>                                ulong count, void *buf)

Can this be moved into its own file?

>  {
> @@ -220,7 +220,9 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
>
>         return 0;
>  }
> +#if defined(CONFIG_SPL_RAM_SUPPORT)
>  SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_RAM, spl_ram_load_image);
> +#endif
>  #if defined(CONFIG_SPL_DFU_SUPPORT)
>  SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_DFU, spl_ram_load_image);
>  #endif
> --
> 2.10.2
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined
  2016-11-18  1:14   ` Simon Glass
@ 2016-11-18  1:27     ` Stefan Agner
  2016-11-19 13:48       ` Simon Glass
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Agner @ 2016-11-18  1:27 UTC (permalink / raw)
  To: u-boot

On 2016-11-17 17:14, Simon Glass wrote:
> Hi Stefan,
> 
> On 15 November 2016 at 14:02, Stefan Agner <stefan@agner.ch> wrote:
>> From: Stefan Agner <stefan.agner@toradex.com>
>>
>> Some devices (e.g. dra7xx) support loading to RAM using DFU without
>> having direct boot from RAM support. Make sure the linker list
>> does not contain BOOT_DEVICE_RAM if CONFIG_SPL_RAM_SUPPORT is not
>> enabled.
>>
>> Fixes: 98136b2f26fa ("spl: Convert spl_ram_load_image() to use linker list")
>>
>> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
>> ---
>>
>> Changes in v3: None
>> Changes in v2:
>> - Use CONFIG_SPL_RAM_SUPPORT to descide whether to compile the
>>   function in first place.
>>
>>  common/spl/spl.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>> index bdb165a..ef17619 100644
>> --- a/common/spl/spl.c
>> +++ b/common/spl/spl.c
>> @@ -174,7 +174,7 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
>>  # define CONFIG_SPL_LOAD_FIT_ADDRESS   0
>>  #endif
>>
>> -#if defined(CONFIG_SPL_RAM_DEVICE) || defined(CONFIG_SPL_DFU_SUPPORT)
>> +#if defined(CONFIG_SPL_RAM_SUPPORT) || defined(CONFIG_SPL_DFU_SUPPORT)

I just realized that this patch is wrong, the config option is currently
named "CONFIG_SPL_RAM_DEVICE". I will send a v4.



>>  static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector,
>>                                ulong count, void *buf)
> 
> Can this be moved into its own file?
> 

Hm, we discussed that on v2:
https://www.mail-archive.com/u-boot at lists.denx.de/msg230689.html

I planned to post a separate patch for that.

For the separate patch, how should I do this? CONFIG_SPL_RAM_DEVICE is
still old config, so I guess I would first have to move that to Kconfig.

What is CONFIG_SPL_RAM_DEVICE actually doing? I think it means that the
image to boot is already there? (loaded by boot ROM?)


CONFIG_SPL_RAM_SUPPORT "Enable booting directly from RAM"
CONFIG_SPL_RAM_DEVICE depends on CONFIG_SPL_RAM_SUPPORT "Image preloaded
by ROM"
CONFIG_SPL_DFU_SUPPORT depends on CONFIG_SPL_RAM_SUPPORT "Load image via
DFU"


--
Stefan

>>  {
>> @@ -220,7 +220,9 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
>>
>>         return 0;
>>  }
>> +#if defined(CONFIG_SPL_RAM_SUPPORT)
>>  SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_RAM, spl_ram_load_image);
>> +#endif
>>  #if defined(CONFIG_SPL_DFU_SUPPORT)
>>  SPL_LOAD_IMAGE_METHOD(0, BOOT_DEVICE_DFU, spl_ram_load_image);
>>  #endif
>> --
>> 2.10.2
>>
> 
> Regards,
> Simon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined
  2016-11-18  1:27     ` Stefan Agner
@ 2016-11-19 13:48       ` Simon Glass
  0 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2016-11-19 13:48 UTC (permalink / raw)
  To: u-boot

Hi Stefan,

On 17 November 2016 at 18:27, Stefan Agner <stefan@agner.ch> wrote:
> On 2016-11-17 17:14, Simon Glass wrote:
>> Hi Stefan,
>>
>> On 15 November 2016 at 14:02, Stefan Agner <stefan@agner.ch> wrote:
>>> From: Stefan Agner <stefan.agner@toradex.com>
>>>
>>> Some devices (e.g. dra7xx) support loading to RAM using DFU without
>>> having direct boot from RAM support. Make sure the linker list
>>> does not contain BOOT_DEVICE_RAM if CONFIG_SPL_RAM_SUPPORT is not
>>> enabled.
>>>
>>> Fixes: 98136b2f26fa ("spl: Convert spl_ram_load_image() to use linker list")
>>>
>>> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
>>> ---
>>>
>>> Changes in v3: None
>>> Changes in v2:
>>> - Use CONFIG_SPL_RAM_SUPPORT to descide whether to compile the
>>>   function in first place.
>>>
>>>  common/spl/spl.c | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>>> index bdb165a..ef17619 100644
>>> --- a/common/spl/spl.c
>>> +++ b/common/spl/spl.c
>>> @@ -174,7 +174,7 @@ __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
>>>  # define CONFIG_SPL_LOAD_FIT_ADDRESS   0
>>>  #endif
>>>
>>> -#if defined(CONFIG_SPL_RAM_DEVICE) || defined(CONFIG_SPL_DFU_SUPPORT)
>>> +#if defined(CONFIG_SPL_RAM_SUPPORT) || defined(CONFIG_SPL_DFU_SUPPORT)
>
> I just realized that this patch is wrong, the config option is currently
> named "CONFIG_SPL_RAM_DEVICE". I will send a v4.
>
>
>
>>>  static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector,
>>>                                ulong count, void *buf)
>>
>> Can this be moved into its own file?
>>
>
> Hm, we discussed that on v2:
> https://www.mail-archive.com/u-boot at lists.denx.de/msg230689.html
>
> I planned to post a separate patch for that.
>
> For the separate patch, how should I do this? CONFIG_SPL_RAM_DEVICE is
> still old config, so I guess I would first have to move that to Kconfig.

Yes that would be good.

>
> What is CONFIG_SPL_RAM_DEVICE actually doing? I think it means that the
> image to boot is already there? (loaded by boot ROM?)

Yes I guess so.

>
>
> CONFIG_SPL_RAM_SUPPORT "Enable booting directly from RAM"
> CONFIG_SPL_RAM_DEVICE depends on CONFIG_SPL_RAM_SUPPORT "Image preloaded
> by ROM"
> CONFIG_SPL_DFU_SUPPORT depends on CONFIG_SPL_RAM_SUPPORT "Load image via
> DFU"
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-11-19 13:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-15 21:02 [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup Stefan Agner
2016-11-15 21:02 ` [U-Boot] [PATCH v3 1/3] spl: add RAM boot device only if it is actually defined Stefan Agner
2016-11-16 13:44   ` Lukasz Majewski
2016-11-18  1:14   ` Simon Glass
2016-11-18  1:27     ` Stefan Agner
2016-11-19 13:48       ` Simon Glass
2016-11-15 21:02 ` [U-Boot] [PATCH v3 2/3] spl: dfu: move DFU Kconfig to SPL Kconfig Stefan Agner
2016-11-15 21:34   ` Brüns, Stefan
2016-11-16 14:06   ` Lukasz Majewski
2016-11-15 21:02 ` [U-Boot] [PATCH v3 3/3] spl: add USB Gadget config option Stefan Agner
2016-11-16 14:31   ` Lukasz Majewski
2016-11-16  7:04 ` [U-Boot] [PATCH v3 0/3] spl: USB Gadget cleanup B, Ravi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox