ARM: DRA7: fastboot: Implement reboot-bootloader command
PATCH 4/4 ARM: DRA7: fastboot: Implement reboot-bootloader command
Hi Rob,
Quoted 90 lines · Rob Herring
Quoted 5 lines · Dileep Katta
Signed-off-by Angela Stegmaier <[email protected]>Signed-off-by Dileep Katta <[email protected]>--- board/ti/dra7xx/Makefile | 1 + board/ti/dra7xx/fastboot.c | 45++++++++++++++++++++++++++++++++++++
Quoted 39 lines
common/cmd_bootm.c | 5 ++++ drivers/usb/gadget/f_fastboot.c | 5 ++++ include/configs/dra7xx_evm_android.h | 14 +++++++++++ 5 files changed, 70 insertions(+) create mode 100644 board/ti/dra7xx/fastboot.cboard/ti/dra7xx/Makefile +1
-0@@ -6,3 +6,4 @@ # obj-y := evm.o +obj-$(CONFIG_CMD_FASTBOOT) += fastboot.oboard/ti/dra7xx/fastboot.c new file +18
-0@@ -0,0 +1,45 @@ +/* +* (C) Copyright 2013 +* Texas Instruments Incorporated, <www.ti.com> +* +* Lokesh Vutla <[email protected]> +* +* Based on previous work by: +* Aneesh V <[email protected]> +* Steve Sakoman <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#include <common.h> +#include <asm/io.h> +#include <asm-generic/gpio.h> +#include <config.h> + +board/ti/dra7xx/fastboot.c line 28
Quoted 10 lines
board/ti/dra7xx/fastboot.c new file +10
-0+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);Does this reset immediately? If so, then you will fail to send a response to the client.
board/ti/dra7xx/fastboot.c line 36
Quoted 8 lines
board/ti/dra7xx/fastboot.c new file +8
-0+ +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)board/ti/dra7xx/fastboot.c line 38
Quoted 2 lines
board/ti/dra7xx/fastboot.c new file +2
-0+ if (!strncmp((const char *)DRA7XX_PUBLIC_SAR_RAM_1_FREE, + "bootloader",
DRA7XX_REBOOT_REASON_SIZE)) {common/cmd_bootm.c int do_booti(cmd_tbl_t *cmdtp, int flag, int argc,
Quoted 12 lines
board/ti/dra7xx/fastboot.c new file +7
-0+strncpy ((char *)DRA7XX_PUBLIC_SAR_RAM_1_FREE ,"" , +DRA7XX_REBOOT_REASON_SIZE ); +return 0 ; + } + +return 1 ; +}common/cmd_bootm.c +0
-0@@ -729,6 +729,11 @@ int do_booti(cmd_tbl_t *cmdtp, int flag, int argc,char * const argv[])
Quoted 3 lines
common/cmd_bootm.c +0
-0{int ret;
Quoted 7 lines
common/cmd_bootm.c int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, · line 735
Quoted 4 lines
common/cmd_bootm.c +4
-0+#if defined(CONFIG_CMD_FASTBOOT ) +if (!fb_check_reboot_flag ()) +do_fastboot (cmdtp, flag, argc, argv); +#endif Part of the booti command? First, booti is for arm64 Image files. How does this work for you?
This was ported from an existing DRA7 implementation as per latest u-boot. Should have sent it
as RFC patch, as this is not verified due to unavailability of board.
Quoted 55 lines
More importantly, this should not be tied into any bootX command. It should probably be done in a boot script. If the flag is set, the board code can set some environment variable. Then the boot script can run the fastboot command if the env var is set.
Review
Quoted 5 lines
common/cmd_bootm.c +1
-0+/* Consume 'booti' */ argc--; argv++;(quoted diff) +0
-0
b/drivers/usb/gadget/f_fastboot.cReview
Quoted 16 lines
index 206b6d1..a450357 100644
drivers/usb/gadget/f_fastboot.c +5
-0@@ -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;(quoted diff) +0
-0
b/include/configs/dra7xx_evm_android.hQuoted 6 lines
index 68e7eec..2038e00 100644
include/configs/dra7xx_evm_android.h +0
-0@@ -310,4 +310,18 @@#endif #endif /* NOR support */ include/configs/dra7xx_evm_android.h line 321
Quoted 10 lines
include/configs/dra7xx_evm_android.h +9
-0+#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 4070You shouldn't need this anymore, right?
include/configs/dra7xx_evm_android.h line 323
Quoted 2 lines
include/configs/dra7xx_evm_android.h +2
-0+#define MEMORY_BASE 0x80000000 +#define CONFIG_ADDR_ATAGS (MEMORY_BASE + 0x100)Or this?
Quoted 8 lines
include/configs/dra7xx_evm_android.h line 324
Quoted 1 line
include/configs/dra7xx_evm_android.h +1
-0+#define CONFIG_ADDR_DOWNLOAD (MEMORY_BASE +
0x02000000)include/configs/dra7xx_evm_android.h line 325
Quoted 1 line
include/configs/dra7xx_evm_android.h +1
-0+#define DEVICE_TREE 0x82f80000Use
fdt_addr_renv var instead?Rob
Will change the implementation as per the comments. Thanks for the suggestions.
Regards,
Dileep
PATCH 4/4 ARM: DRA7: fastboot: Implement reboot-bootloader command
Quoted 4 lines · Dileep Katta
Quoted 2 lines · Rob Herring
On Tue, Mar 3, 2015 at 5:10 AM, Dileep Katta <[email protected]> wrote:
[...]
Quoted 17 lines
Quoted 9 lines
common/cmd_bootm.c int do_booti(cmd_tbl_t *cmdtp, int flag, int argc,
Quoted 5 lines
common/cmd_bootm.c +0
-0@@ -729,6 +729,11 @@ int do_booti(cmd_tbl_t *cmdtp, int flag, int argc,char * const argv[])
Quoted 3 lines
common/cmd_bootm.c +0
-0{int ret;Quoted 7 lines
common/cmd_bootm.c int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, · line 735
Quoted 4 lines
common/cmd_bootm.c +4
-0+#if defined(CONFIG_CMD_FASTBOOT ) +if (!fb_check_reboot_flag ()) +do_fastboot (cmdtp, flag, argc, argv); +#endif Part of the booti command? First, booti is for arm64 Image files. How does this work for you?
Quoted 1 line
This was ported from an existing DRA7 implementation as per latest u-boot.
Ummm... I am curious and wonder why the authorship changed if it was just a "port"? Might be nice to point to original source where this was picked up from
http://git.omapzoom.org/?p=repo/u-boot.git;a=shortlog;h=refs/heads/p-ti-u-boot-2014.07
For example patch #2
http://git.omapzoom.org/?p=repo/u-boot.git;a=commit;h=5df0356d4c34611d32f905dea51e9c908075eec1
I cant see much of a change here to have an authorship change perhaps?
Do I understand that Angela is ok with the same? please confirm.
Quoted 2 lines
Should have sent it
as RFC patch, as this is not verified due to unavailability of board.
Hmm... interesting.... maybe Vish can help here?
[...]
Signature · 2 lines
Regards, Nishanth Menon