public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 4/4] ARM: DRA7: fastboot: Implement reboot-bootloader command - Implemented fb_set_reboot_flag() for DRA7 - Defined a weak function, fb_check_reboot_flag() - Implemented for DRA7
Date: Wed, 04 Mar 2015 14:31:59 +0100	[thread overview]
Message-ID: <20150304143159.67982639@amdc2363> (raw)
In-Reply-To: <1425381044-19460-4-git-send-email-dileep.katta@linaro.org>

Hi Dileep,

> 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); +
> +	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
> +
>  	/* 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
> +#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 */

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

-- 
Best regards,

Lukasz Majewski

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

  parent reply	other threads:[~2015-03-04 13:31 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 11:10 [U-Boot] [PATCH v1 1/4] ARM: DRA7XX: Add config file for Android with fastboot support Dileep Katta
2015-03-03 11:10 ` [U-Boot] [PATCH v2 2/4] fastboot: call board_usb_init() to enable usb Dileep Katta
2015-03-04 13:19   ` Lukasz Majewski
2015-03-04 17:05   ` Stegmaier, Angela
2015-03-04 18:29     ` Tom Rini
2015-03-04 19:06       ` Dileep Katta
2015-03-05 14:37         ` Tom Rini
2015-03-12  6:36           ` Dileep Katta
2015-03-12  8:55             ` Lukasz Majewski
2015-03-12 17:28               ` Marek Vasut
2015-03-12 21:12                 ` Dileep Katta
2015-03-13  7:53                   ` Lukasz Majewski
2015-03-13 19:28                     ` Dileep Katta
2015-03-13 20:55                       ` Lukasz Majewski
2015-03-27 17:53                         ` Dileep Katta
2015-03-27 18:15                           ` Tom Rini
2015-03-27 18:25                             ` Marek Vasut
2015-03-30  8:38                               ` Lukasz Majewski
2015-03-03 11:10 ` [U-Boot] [PATCH v3 3/4] ARM: DRA7: Set serial number environment variable Dileep Katta
2015-03-04 13:23   ` Lukasz Majewski
2015-03-04 16:53   ` Tom Rini
2015-03-07  7:00   ` Nishanth Menon
2015-03-03 11:10 ` [U-Boot] [PATCH v1 4/4] ARM: DRA7: fastboot: Implement reboot-bootloader command - Implemented fb_set_reboot_flag() for DRA7 - Defined a weak function, fb_check_reboot_flag() - Implemented for DRA7 Dileep Katta
2015-03-03 14:15   ` Rob Herring
2015-03-04 16:57     ` Tom Rini
2015-03-04 13:31   ` Lukasz Majewski [this message]
2015-03-03 11:53 ` [U-Boot] [PATCH v1 1/4] ARM: DRA7XX: Add config file for Android with fastboot support Dileep Katta
2015-03-04 13:18 ` Lukasz Majewski
2015-03-04 16:52 ` Tom Rini
2015-03-12  6:31   ` Dileep Katta
2015-03-12 19:29     ` Tom Rini
2015-03-17 18:38       ` [U-Boot] [PATCH v2 1/1] " Dileep Katta
2015-03-18 16:11         ` Tom Rini
2015-03-18 21:12           ` Dileep Katta
2015-03-19 13:15             ` Tom Rini
2015-03-23 22:41               ` Dileep Katta
2015-03-24 22:34                 ` [U-Boot] [PATCH v3 1/3] ARM: DRA7XX: Enable Fastboot Dileep Katta
2015-03-24 22:34                   ` [U-Boot] [PATCH v3 2/3] ARM: DRA7: Set serial number environment variable Dileep Katta
2015-03-27 14:19                     ` Tom Rini
2015-04-23 22:03                     ` [U-Boot] [U-Boot, v3, " Tom Rini
2015-03-24 22:34                   ` [U-Boot] [PATCH v3 3/3] fastboot: ARM: OMAP5: Enable reboot-bootloader Dileep Katta
2015-03-27 14:19                     ` Tom Rini
2015-03-27 17:28                       ` Dileep Katta
2015-03-27 17:36                         ` [U-Boot] [PATCH v4 " Dileep Katta
2015-03-27 18:02                           ` Tom Rini
2015-04-23 22:03                           ` [U-Boot] [U-Boot, v4, " Tom Rini
2015-03-27 14:19                   ` [U-Boot] [PATCH v3 1/3] ARM: DRA7XX: Enable Fastboot Tom Rini
2015-04-23 22:03                   ` [U-Boot] [U-Boot,v3,1/3] " Tom Rini
2015-03-23  8:50         ` [U-Boot] [PATCH v2 1/1] ARM: DRA7XX: Add config file for Android with fastboot support Lukasz Majewski
  -- strict thread matches above, loose matches on Subject: below --
2015-03-03 11:57 [U-Boot] [PATCH v1 4/4] ARM: DRA7: fastboot: Implement reboot-bootloader command - Implemented fb_set_reboot_flag() for DRA7 - Defined a weak function, fb_check_reboot_flag() - Implemented for DRA7 Dileep Katta

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=20150304143159.67982639@amdc2363 \
    --to=l.majewski@samsung.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