@@ -6,3 +6,4 @@
#
obj-y := evm.o
+obj-$(CONFIG_CMD_FASTBOOT) += fastboot.o
new file mode 100644
@@ -0,0 +1,45 @@
+/*
+ * (C) Copyright 2013
+ * Texas Instruments Incorporated, <www.ti.com>
+ *
+ * Lokesh Vutla <lokeshvutla@ti.com>
+ *
+ * Based on previous work by:
+ * Aneesh V <aneesh@ti.com>
+ * Steve Sakoman <steve@sakoman.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#include <common.h>
+#include <asm/io.h>
+#include <asm-generic/gpio.h>
+#include <config.h>
+
+
+int fb_set_reboot_flag(void)
+{
+ /* clear all reset events */
+ __raw_writel(DRA7XX_PRM_RSTST_CLR, PRM_RSTST);
+ strncpy((char *)DRA7XX_PUBLIC_SAR_RAM_1_FREE, "bootloader",
+ DRA7XX_REBOOT_REASON_SIZE - 1);
+ *(((char *)DRA7XX_PUBLIC_SAR_RAM_1_FREE) +
+ DRA7XX_REBOOT_REASON_SIZE - 1) = '\0';
+ /* trigger warm reset */
+ __raw_writel(DRA7XX_PRM_RSTCTRL_RESET_WARM_BIT, DRA7XX_PRM_RSTCTRL);
+
+ return 0;
+}
+
+int fb_check_reboot_flag(void)
+{
+ /* Check if we are coming from a warm reset */
+ if (__raw_readl(DRA7XX_PRM_RSTST) & DRA7XX_PRM_RSTST_RESET_WARM_BIT)
+ if (!strncmp((const char *)DRA7XX_PUBLIC_SAR_RAM_1_FREE,
+ "bootloader", DRA7XX_REBOOT_REASON_SIZE)) {
+ strncpy((char *)DRA7XX_PUBLIC_SAR_RAM_1_FREE, "",
+ DRA7XX_REBOOT_REASON_SIZE);
+ return 0;
+ }
+
+ return 1;
+}
@@ -729,6 +729,11 @@ int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int ret;
+#if defined(CONFIG_CMD_FASTBOOT)
+ if (!fb_check_reboot_flag())
+ do_fastboot(cmdtp, flag, argc, argv);
+#endif
+
/* Consume 'booti' */
argc--; argv++;
@@ -332,6 +332,11 @@ int __weak fb_set_reboot_flag(void)
return -ENOSYS;
}
+int __weak fb_check_reboot_flag(void)
+{
+ return -ENOSYS;
+}
+
static void cb_reboot(struct usb_ep *ep, struct usb_request *req)
{
char *cmd = req->buf;
@@ -310,4 +310,18 @@
#endif
#endif /* NOR support */
+#define DRA7XX_PUBLIC_SAR_RAM_1_FREE (0x4AE26000 + 0xFE0)
+#define DRA7XX_PRM_RSTCTRL_RESET_WARM_BIT (1<<0)
+#define DRA7XX_PRM_RSTST_RESET_WARM_BIT (1<<1)
+#define DRA7XX_PRM_RSTST 0x4AE07D04
+#define DRA7XX_PRM_RSTCTRL 0x4AE07D00
+#define DRA7XX_PRM_RSTST_CLR 0xfff
+#define DRA7XX_REBOOT_REASON_SIZE 0xf
+
+#define CONFIG_BOARD_MACH_TYPE 4070
+#define MEMORY_BASE 0x80000000
+#define CONFIG_ADDR_ATAGS (MEMORY_BASE + 0x100)
+#define CONFIG_ADDR_DOWNLOAD (MEMORY_BASE + 0x02000000)
+#define DEVICE_TREE 0x82f80000
+
#endif /* __CONFIG_DRA7XX_EVM_ANDROID_H */