From patchwork Tue Mar 3 11:10:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dileep Katta X-Patchwork-Id: 45354 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 823B621429 for ; Tue, 3 Mar 2015 11:14:51 +0000 (UTC) Received: by widfb4 with SMTP id fb4sf1826441wid.2 for ; Tue, 03 Mar 2015 03:14:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=EUErCpJ8PTCFhg0LTV+HqtBrxKbFZWjoX05JspA90YM=; b=h5+YB1OJcE6OoR/e90JaDX/vsP+Coh1IJ5TeNzixQmxkxTjLQZRpDl8zxYPYbCKW0Z krmC5YzV2k1HNvSigo6VLKaEEtYyGwPt5hcXByZK28/jeVifeZZ8E/C/ny9l9TQ98x8C 8B6vXS/HNuBKC9A3BEdgm3TtyJMmOmU0vk65ul8hPRgxLpJg1QayZj0ayFZMwjYilajK qtmD0aqvwvfxqP1ARwGR1Yp0xg4m7xu6ggP3vQ6A6yoytZPErt9rAFewqW9km2bCe1yD pVkdSFkaQpXXarDFc5+J7sF+garQqGW3+98Hv6bf3kVxf3u8omyBntbOEP6U/VhFQXwh 30sw== X-Gm-Message-State: ALoCoQlcaiuluWP9dG0lMTfkE8vdMIxIbMUeHapjyVyJNHS47xn8pVf4dlTf6zHakw9GnmJAYfum X-Received: by 10.112.40.81 with SMTP id v17mr4448087lbk.5.1425381290746; Tue, 03 Mar 2015 03:14:50 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.20.8 with SMTP id j8ls27615lae.7.gmail; Tue, 03 Mar 2015 03:14:50 -0800 (PST) X-Received: by 10.112.26.165 with SMTP id m5mr28318535lbg.61.1425381290596; Tue, 03 Mar 2015 03:14:50 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id t5si230061lat.168.2015.03.03.03.14.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2015 03:14:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lamq1 with SMTP id q1so13464900lam.9 for ; Tue, 03 Mar 2015 03:14:50 -0800 (PST) X-Received: by 10.152.22.67 with SMTP id b3mr27853052laf.117.1425381290452; Tue, 03 Mar 2015 03:14:50 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp492657lbj; Tue, 3 Mar 2015 03:14:50 -0800 (PST) X-Received: by 10.194.20.67 with SMTP id l3mr67154578wje.94.1425381289894; Tue, 03 Mar 2015 03:14:49 -0800 (PST) Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id gb4si23166459wic.120.2015.03.03.03.14.49; Tue, 03 Mar 2015 03:14:49 -0800 (PST) Received-SPF: none (google.com: u-boot-bounces@lists.denx.de does not designate permitted sender hosts) client-ip=85.214.87.163; Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EDB734B5F5; Tue, 3 Mar 2015 12:14:48 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RqlMJv2E4DOt; Tue, 3 Mar 2015 12:14:48 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 40FEA4B5D0; Tue, 3 Mar 2015 12:14:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EE0BE4B5D0 for ; Tue, 3 Mar 2015 12:14:44 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YyQ-l47kcuKW for ; Tue, 3 Mar 2015 12:14:44 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by theia.denx.de (Postfix) with ESMTPS id 7EDA14B5CD for ; Tue, 3 Mar 2015 12:14:44 +0100 (CET) Received: by pdbfl12 with SMTP id fl12so16494980pdb.9 for ; Tue, 03 Mar 2015 03:14:43 -0800 (PST) X-Received: by 10.70.0.66 with SMTP id 2mr36278105pdc.4.1425381283017; Tue, 03 Mar 2015 03:14:43 -0800 (PST) Received: from localhost.localdomain ([223.227.218.142]) by mx.google.com with ESMTPSA id dq4sm584321pdb.96.2015.03.03.03.14.37 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Mar 2015 03:14:42 -0800 (PST) From: Dileep Katta To: u-boot@lists.denx.de, robherring2@gmail.com, trini@ti.com, rob.herring@linaro.org, srae@broadcom.com, l.majewski@samsung.com, angelabaker@ti.com Date: Tue, 3 Mar 2015 16:40:44 +0530 Message-Id: <1425381044-19460-4-git-send-email-dileep.katta@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1425381044-19460-1-git-send-email-dileep.katta@linaro.org> References: <1425381044-19460-1-git-send-email-dileep.katta@linaro.org> Cc: Dileep Katta 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 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: dileep.katta@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Angela Stegmaier Signed-off-by: Dileep Katta --- 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, + * + * Lokesh Vutla + * + * Based on previous work by: + * Aneesh V + * Steve Sakoman + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include +#include +#include +#include + + +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 */