* [U-Boot] [PATCH v1 4/4] ARM: DRA7: fastboot: Implement reboot-bootloader command
@ 2015-03-03 17:31 Dileep Katta
2015-03-03 17:46 ` Nishanth Menon
0 siblings, 1 reply; 2+ messages in thread
From: Dileep Katta @ 2015-03-03 17:31 UTC (permalink / raw)
To: u-boot
Hi Rob,
On 3 March 2015 at 19:45, Rob Herring <robherring2@gmail.com> wrote:
> On Tue, Mar 3, 2015 at 5:10 AM, Dileep Katta <dileep.katta@linaro.org>
> wrote:
> > Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
> > Signed-off-by: Dileep Katta <dileep.katta@linaro.org>
> > ---
> > board/ti/dra7xx/Makefile | 1 +
> > board/ti/dra7xx/fastboot.c | 45
> ++++++++++++++++++++++++++++++++++++
> > 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.c
> >
> > diff --git a/board/ti/dra7xx/Makefile b/board/ti/dra7xx/Makefile
> > index 434e8d1..ae730ae 100644
> > --- a/board/ti/dra7xx/Makefile
> > +++ b/board/ti/dra7xx/Makefile
> > @@ -6,3 +6,4 @@
> > #
> >
> > obj-y := evm.o
> > +obj-$(CONFIG_CMD_FASTBOOT) += fastboot.o
> > diff --git a/board/ti/dra7xx/fastboot.c b/board/ti/dra7xx/fastboot.c
> > new file mode 100644
> > index 0000000..e05010d
> > --- /dev/null
> > +++ b/board/ti/dra7xx/fastboot.c
> > @@ -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);
>
> Does this reset immediately? If so, then you will fail to send a
> response to the client.
>
> > +
> > + 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;
> > +}
> > diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> > index 48199bf..00791be 100644
> > --- a/common/cmd_bootm.c
> > +++ b/common/cmd_bootm.c
> > @@ -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
>
> 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.
>
> 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.
>
> > +
> > /* Consume 'booti' */
> > argc--; argv++;
> >
> > diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c
> > index 206b6d1..a450357 100644
> > --- a/drivers/usb/gadget/f_fastboot.c
> > +++ b/drivers/usb/gadget/f_fastboot.c
> > @@ -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;
> > diff --git a/include/configs/dra7xx_evm_android.h
> b/include/configs/dra7xx_evm_android.h
> > index 68e7eec..2038e00 100644
> > --- a/include/configs/dra7xx_evm_android.h
> > +++ b/include/configs/dra7xx_evm_android.h
> > @@ -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
>
> You shouldn't need this anymore, right?
>
> > +#define MEMORY_BASE 0x80000000
> > +#define CONFIG_ADDR_ATAGS (MEMORY_BASE + 0x100)
>
> Or this?
>
> > +#define CONFIG_ADDR_DOWNLOAD (MEMORY_BASE +
> 0x02000000)
> > +#define DEVICE_TREE 0x82f80000
>
> Use fdt_addr_r env var instead?
>
> Rob
>
Will change the implementation as per the comments. Thanks for the
suggestions.
Regards,
Dileep
^ permalink raw reply [flat|nested] 2+ messages in thread* [U-Boot] [PATCH v1 4/4] ARM: DRA7: fastboot: Implement reboot-bootloader command
2015-03-03 17:31 [U-Boot] [PATCH v1 4/4] ARM: DRA7: fastboot: Implement reboot-bootloader command Dileep Katta
@ 2015-03-03 17:46 ` Nishanth Menon
0 siblings, 0 replies; 2+ messages in thread
From: Nishanth Menon @ 2015-03-03 17:46 UTC (permalink / raw)
To: u-boot
On 03/03/2015 11:31 AM, Dileep Katta wrote:
> On 3 March 2015 at 19:45, Rob Herring <robherring2@gmail.com> wrote:
>
>> On Tue, Mar 3, 2015 at 5:10 AM, Dileep Katta <dileep.katta@linaro.org>
>> wrote:
[...]
>>> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
>>> index 48199bf..00791be 100644
>>> --- a/common/cmd_bootm.c
>>> +++ b/common/cmd_bootm.c
>>> @@ -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
>>
>> 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.
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.
> Should have sent it
> as RFC patch, as this is not verified due to unavailability of board.
Hmm... interesting.... maybe Vish can help here?
[...]
--
Regards,
Nishanth Menon
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-03 17:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 17:31 [U-Boot] [PATCH v1 4/4] ARM: DRA7: fastboot: Implement reboot-bootloader command Dileep Katta
2015-03-03 17:46 ` Nishanth Menon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox