U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ravi Babu <ravibabu@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH v1 6/6] dfu: spl: am335x: SPL-DFU support for am335x
Date: Tue, 14 Jun 2016 16:32:24 +0530	[thread overview]
Message-ID: <1465902144-30934-7-git-send-email-ravibabu@ti.com> (raw)
In-Reply-To: <1465902144-30934-1-git-send-email-ravibabu@ti.com>

enable the SPL-DFU support for am335x platform.

Signed-off-by: Ravi Babu <ravibabu@ti.com>
---
 Kconfig                      |    2 +-
 board/ti/am335x/board.c      |   15 +++++++++++++++
 common/spl/spl_dfu.c         |    1 +
 include/configs/am335x_evm.h |   17 ++++++++++++++++-
 4 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/Kconfig b/Kconfig
index 969641e..c4eb4bd 100644
--- a/Kconfig
+++ b/Kconfig
@@ -287,7 +287,7 @@ config SPL_LOAD_FIT
 
 config SPL_DFU
 	bool "Enable SPL with DFU to load binaries to bootdevices using USB"
-	depends on USB && CMD_DFU && TARGET_DRA7XX_EVM
+	depends on USB && CMD_DFU && (TARGET_DRA7XX_EVM || TARGET_AM335X_EVM)
 	help
 	  Currently the SPL does not have capability to load the
 	  binaries or boot images to boot devices like eMMC,SPI,etc.
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 690c298..fe56004 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -246,6 +246,21 @@ const struct dpll_params dpll_ddr_evm_sk = {
 const struct dpll_params dpll_ddr_bone_black = {
 		400, OSC-1, 1, -1, -1, -1, -1};
 
+#ifdef CONFIG_SPL_DFU
+int spl_run_dfu(void)
+{
+	int os_boot = 0;
+#ifdef CONFIG_SPL_DFU_SF
+	spl_dfu_cmd(0, "dfu_alt_info_qspi", "sf", "0:0:24000000:0");
+#endif
+#ifdef CONFIG_SPL_DFU_RAM
+	spl_dfu_cmd(0, "dfu_alt_info_ram", "ram", "0");
+	spl_dfu_ram_load_image();
+	os_boot = 1;
+#endif
+	return os_boot;
+}
+#endif
 void am33xx_spl_board_init(void)
 {
 	int mpu_vdd;
diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c
index 8b8432b..f2badb6 100644
--- a/common/spl/spl_dfu.c
+++ b/common/spl/spl_dfu.c
@@ -143,6 +143,7 @@ int spl_dfu_ram_load_image(void)
 		struct spl_load_info load;
 		debug("Found FIT\n");
 		load.priv = NULL;
+		load.bl_len = 1;
 		load.read = spl_fit_ram_read;
 
 		err = spl_load_simple_fit(&load, (ulong)filename, header);
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 1139526..558be7b 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -187,6 +187,9 @@
 	NETARGS \
 	DFUARGS \
 	BOOTENV
+#else
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	DFUARGS
 #endif
 
 /* NS16550 Configuration */
@@ -297,12 +300,14 @@
 #define CONFIG_AM335X_USB1_MODE MUSB_HOST
 
 #ifndef CONFIG_SPL_USBETH_SUPPORT
+#ifndef CONFIG_SPL_DFU
 /* Fastboot */
 #define CONFIG_USB_FUNCTION_FASTBOOT
 #define CONFIG_CMD_FASTBOOT
 #define CONFIG_ANDROID_BOOT_IMAGE
 #define CONFIG_FASTBOOT_BUF_ADDR	CONFIG_SYS_LOAD_ADDR
 #define CONFIG_FASTBOOT_BUF_SIZE	0x07000000
+#endif
 
 /* To support eMMC booting */
 #define CONFIG_STORAGE_EMMC
@@ -314,9 +319,11 @@
 #endif
 
 #ifdef CONFIG_USB_MUSB_GADGET
+#ifndef CONFIG_SPL_DFU
 #define CONFIG_USB_ETHER
 #define CONFIG_USB_ETH_RNDIS
 #define CONFIG_USBNET_HOST_ADDR	"de:ad:be:af:00:00"
+#endif
 #endif /* CONFIG_USB_MUSB_GADGET */
 
 /*
@@ -348,9 +355,9 @@
 #endif
 
 /* USB Device Firmware Update support */
-#ifndef CONFIG_SPL_BUILD
 #define CONFIG_USB_FUNCTION_DFU
 #define CONFIG_DFU_MMC
+#define CONFIG_DFU_RAM
 #define DFU_ALT_INFO_MMC \
 	"dfu_alt_info_mmc=" \
 	"boot part 0 1;" \
@@ -364,6 +371,7 @@
 	"spl-os-image fat 0 1;" \
 	"u-boot.img fat 0 1;" \
 	"uEnv.txt fat 0 1\0"
+#ifndef CONFIG_SPL_DFU
 #ifdef CONFIG_NAND
 #define CONFIG_DFU_NAND
 #define DFU_ALT_INFO_NAND \
@@ -379,17 +387,24 @@
 #else
 #define DFU_ALT_INFO_NAND ""
 #endif
+#endif
 #define CONFIG_DFU_RAM
 #define DFU_ALT_INFO_RAM \
 	"dfu_alt_info_ram=" \
 	"kernel ram 0x80200000 0xD80000;" \
 	"fdt ram 0x80F80000 0x80000;" \
 	"ramdisk ram 0x81000000 0x4000000\0"
+#ifndef CONFIG_SPL_DFU
 #define DFUARGS \
 	"dfu_alt_info_emmc=rawemmc raw 0 3751936\0" \
 	DFU_ALT_INFO_MMC \
 	DFU_ALT_INFO_RAM \
 	DFU_ALT_INFO_NAND
+#else
+#define DFUARGS \
+	"dfu_alt_info_emmc=rawemmc raw 0 3751936\0" \
+	DFU_ALT_INFO_MMC \
+	DFU_ALT_INFO_RAM
 #endif
 
 /*
-- 
1.7.9.5

  parent reply	other threads:[~2016-06-14 11:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-14 11:02 [U-Boot] [RFC PATCH v1 0/6] SPL: DFU Support in SPL Ravi Babu
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 1/6] spl: dfu: add dfu support " Ravi Babu
2016-06-24  8:50   ` Lukasz Majewski
2016-06-24  8:54     ` B, Ravi
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 2/6] spl: dfu: adding dfu support functions for SPL-DFU Ravi Babu
2016-06-24  9:00   ` Lukasz Majewski
2016-06-24  9:02     ` B, Ravi
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 3/6] dfu: spl: add generic spl-dfu function in common-spl Ravi Babu
2016-06-24  9:01   ` Lukasz Majewski
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 4/6] dra7x: spl: dfu: adding SPL-DFU support for dra7x platform Ravi Babu
2016-06-24  9:10   ` Lukasz Majewski
2016-06-24  9:27     ` B, Ravi
2016-06-14 11:02 ` [U-Boot] [RFC PATCH v1 5/6] dfu: spl: dra7x: enable SPL-dfu " Ravi Babu
2016-06-24  9:12   ` Lukasz Majewski
2016-06-24  9:21     ` B, Ravi
2016-06-14 11:02 ` Ravi Babu [this message]
2016-06-24  9:15   ` [U-Boot] [RFC PATCH v1 6/6] dfu: spl: am335x: SPL-DFU support for am335x Lukasz Majewski
2016-06-24  9:29     ` B, Ravi
2016-06-21  8:39 ` [U-Boot] [RFC PATCH v1 0/6] SPL: DFU Support in SPL B, Ravi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465902144-30934-7-git-send-email-ravibabu@ti.com \
    --to=ravibabu@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox