From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88735C48BE0 for ; Fri, 11 Jun 2021 16:16:35 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 162D660720 for ; Fri, 11 Jun 2021 16:16:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 162D660720 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=in.bosch.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6C5AC82918; Fri, 11 Jun 2021 18:15:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=in.bosch.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=in.bosch.com header.i=@in.bosch.com header.b="Zpd1yuA7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 394DA828E1; Fri, 11 Jun 2021 18:14:54 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on061b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::61b]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id F1A9D8284C for ; Fri, 11 Jun 2021 18:14:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=in.bosch.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Gireesh.Hiremath@in.bosch.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cUnLDg/SUyz6p73yCsuY2Wes9vxYiS+t0Z71Bgd0a9TRdxPkzZ4AQdrK0Q8/ShQK+ZsiZ+Qa2eQx9Qr+Rs9eX4VIeKRnoKOMEJfzWj0zwlPCfm4TC427Qbwsz6nNBE6L/jsf0Qvw5Oe68cZlNWEqAs/s0I3M0+MLaE3b9WMoj0QTYXsGuO56yz1TcQsNS9h2FQ3JF4AmV3EPUkgsq5PFN3JbScLS5HFr8/Nk77PbTHSSqujkTxVyNT27Vf8W4aQpl7beaA1e1b/J5c76MCfqMOL1X75j2I5Fnh4qYLUfCJyZ6hbhBWT1xg2vIWRlJ/kjZQ+GRMVTTFROEeYXN7nATw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zXbJnGuYSX+gD13HlBYG0W59U8EAGG5uM6qRJJrwF5w=; b=eezU17G2e+7W8s/i/ra5mbroLCMZHYCQ00ErtiAbCyrVTEWmZnYdOYK9cvZp1ejzKApGBnyRs3xR0A/zUeIHzWgu40Qp0WmCiytlM0qH4x/6tasnMLQG1ckGInz0o8DxXsAJsKlumprtcW4LmzcQnj66yjaRuSpUulm7PeIcizHD1lZOS4QaAwSqMlLDIHiUo2BaUI9PfBvF3lebC3ZXM5PuTWrqwPHV2dr51d+uibYUi+CzDcnx7IzpjTHD+jj1ZW1RCMrZf2mhXYc1LMBWA4hKTDVEKi5dyNT61zBIOeQ450snHsev8W01bn7pC664yNz1c9AT4xtCOJceLckDSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 139.15.153.200) smtp.rcpttodomain=lists.denx.de smtp.mailfrom=in.bosch.com; dmarc=pass (p=reject sp=none pct=100) action=none header.from=in.bosch.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=in.bosch.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zXbJnGuYSX+gD13HlBYG0W59U8EAGG5uM6qRJJrwF5w=; b=Zpd1yuA71sXFqnq7oF2bceHBFOd/2QFQfnRxAPx84pxRnk2cztqZXbSk52qoB5myVCu5kua4kaeB0Of7PURPaMm5zIIaz4OXMwGfarhBN6ilFd7TBlVKCpjjHv5Kv0RtpEWe0OqueB/grmcD9jc7kxXStdJhfFDJB90hXH+8Xlk= Received: from DB6PR07CA0022.eurprd07.prod.outlook.com (2603:10a6:6:2d::32) by AM5PR10MB1665.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:1e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4195.27; Fri, 11 Jun 2021 16:14:46 +0000 Received: from DB5EUR03FT008.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2d:cafe::16) by DB6PR07CA0022.outlook.office365.com (2603:10a6:6:2d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.9 via Frontend Transport; Fri, 11 Jun 2021 16:14:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 139.15.153.200) smtp.mailfrom=in.bosch.com; lists.denx.de; dkim=none (message not signed) header.d=none; lists.denx.de; dmarc=pass action=none header.from=in.bosch.com; Received-SPF: Pass (protection.outlook.com: domain of in.bosch.com designates 139.15.153.200 as permitted sender) receiver=protection.outlook.com; client-ip=139.15.153.200; helo=eop.bosch-org.com; Received: from eop.bosch-org.com (139.15.153.200) by DB5EUR03FT008.mail.protection.outlook.com (10.152.20.98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Fri, 11 Jun 2021 16:14:46 +0000 Received: from SI-EXCAS2001.de.bosch.com (10.139.217.202) by eop.bosch-org.com (139.15.153.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2176.14; Fri, 11 Jun 2021 18:14:34 +0200 Received: from SI-HUB2000.de.bosch.com (10.4.103.108) by SI-EXCAS2001.de.bosch.com (10.139.217.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2176.14; Fri, 11 Jun 2021 18:14:34 +0200 Received: from localhost.localdomain (10.141.230.85) by SI-HUB2000.de.bosch.com (10.4.103.108) with Microsoft SMTP Server id 15.1.2176.14; Fri, 11 Jun 2021 18:14:32 +0200 From: To: , , CC: , , Subject: [PATCH v4 11/18] am335x, guardian: update swi logic Date: Fri, 11 Jun 2021 16:13:43 +0000 Message-ID: <20210611161350.2141-12-Gireesh.Hiremath@in.bosch.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210611161350.2141-1-Gireesh.Hiremath@in.bosch.com> References: <20210611161350.2141-1-Gireesh.Hiremath@in.bosch.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.141.230.85] X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eaeaf266-a0d9-456d-e960-08d92cf40806 X-MS-TrafficTypeDiagnostic: AM5PR10MB1665: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:669; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AvadKnO0Bk/AtF9jtz9cnYwgjvPecTjVwM5zXC0Y4hr2C6yRDc1/wmwOknDqbny4oqiY8sZSvmDbdaO+82Rsw3NpUcczoJuCqMmsIvgYKoL3K35up2Mf36iyaDrJzlxis8oAok4gDPxLq/TiRX17w9FeUQWdckgEUXfgLhfMTDerXUC0k55l+Ga4nqVFRecJMfbSHLMSIP/lCPcRUPYwEhD5mUfo+krFQfvya1R7wINbY2zOuCa4QMLT/+PwjXbMetxjBFTFewBSbnjpO88vBasgi88SeYXBZ/Ek5nBu/ammdDcPTRzqegi04ANUm0XfCNu7EBlcueM0/7do6YrMEVTjOxcLk70S1iTk1BBxUGvf4rQeU7+YuQ72X+Pbxg+czCALljIKGHu4CWGaiKtF3bhBMAXE/2Z9KExwP2CKqf4lNYSuRVWl2FNMtlIML0D5MJ1ome9+xfrZygcfgl8Ly5RiygmwQmvR2bXcENAM1VZLErrFUuKIRmQUYSK8s7cu5JkaeqLnNxe4V1P+VTuTKr9WfTUOgupqwy2GYyHpdOyUitXdUEZD9LRtXTOweY9BYj61ttiZ6CsZzRPSOhsr7lsrDlcdS7bWn7EcMHJlpCx/XUaq3znqAlR4p7Ogb+DI/viJCDbMpyAvdQRfh70973iIj9pZiqW3xkuAU5XY97VsTAskIAkL18unh5DkAeC7SswiG6eZIjft252d+VCDYQ== X-Forefront-Antispam-Report: CIP:139.15.153.200; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:eop.bosch-org.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(47076005)(4326008)(2616005)(54906003)(8936002)(110136005)(5660300002)(82310400003)(83380400001)(8676002)(336012)(36860700001)(356005)(498600001)(2876002)(16526019)(86362001)(2906002)(70206006)(70586007)(6666004)(81166007)(107886003)(1076003)(186003)(26005)(36900700001)(139555002); DIR:OUT; SFP:1101; X-OriginatorOrg: in.bosch.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2021 16:14:46.6880 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eaeaf266-a0d9-456d-e960-08d92cf40806 X-MS-Exchange-CrossTenant-Id: 0ae51e19-07c8-4e4b-bb6d-648ee58410f4 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0ae51e19-07c8-4e4b-bb6d-648ee58410f4; Ip=[139.15.153.200]; Helo=[eop.bosch-org.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT008.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR10MB1665 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Gireesh Hiremath read boot mode gpio and set the swi status Signed-off-by: Gireesh Hiremath --- board/bosch/guardian/board.c | 16 ++++++++++++++-- include/configs/am335x_guardian.h | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index 12d047b74b..f14ceaa1f9 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -205,8 +206,19 @@ static void set_bootmode_env(void) goto err; } - value = dm_gpio_get_value(&boot_mode_desc); - value ? env_set("swi_status", "0") : env_set("swi_status", "1"); + dm_gpio_set_dir_flags(&boot_mode_desc, GPIOD_IS_IN); + udelay(10); + + ret = dm_gpio_get_value(&boot_mode_desc); + if (ret == 0) { + env_set("swi_status", "1"); + } else if (ret == 1) { + env_set("swi_status", "0"); + } else { + printf("swi status gpio error\n"); + goto err; + } + return; err: diff --git a/include/configs/am335x_guardian.h b/include/configs/am335x_guardian.h index 814048bf86..c76f9b26fb 100644 --- a/include/configs/am335x_guardian.h +++ b/include/configs/am335x_guardian.h @@ -64,13 +64,13 @@ "setenv rootflags \"bulk_read,chk_data_crc\"; " \ "setenv ethact usb_ether; " \ "if test \"${swi_status}\" -eq 1; then " \ - "setenv extrabootargs \"swi_attached\"; " \ "if dhcp; then " \ "sleep 1; " \ "if tftp \"${tftp_load_addr}\" \"bootscript.scr\"; then " \ "source \"${tftp_load_addr}\"; " \ "fi; " \ "fi; " \ + "setenv extrabootargs $extrabootargs \"swi_attached\"; " \ "fi;" \ "run bootcmd_ubifs0;\0" \ "altbootcmd=" \ -- 2.20.1