From patchwork Mon Aug 3 06:05:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 1340129 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=WRs+1tiN; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BKnTW5TgGz9sRN for ; Mon, 3 Aug 2020 16:06:55 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6B1B6821DF; Mon, 3 Aug 2020 08:05:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.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=ti.com header.i=@ti.com header.b="WRs+1tiN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8D4C1821C6; Mon, 3 Aug 2020 08:05:40 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 6D5AC821C3 for ; Mon, 3 Aug 2020 08:05:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=faiz_abbas@ti.com Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 07365aM4101753 for ; Mon, 3 Aug 2020 01:05:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1596434736; bh=wzh2bDuggQ+X1y7otYtEMSlbKo8ktVx6M1X/XwEkBLM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=WRs+1tiNeuigA0dXPpZpkaS/U6RXAYcpnPLFbXtdPojybdEbbE0uSiOrsRFY4NsAJ +0+t76nua4+q/C8S5XDNKMsZJrHUPtdpn31DHl2cGK9SBXr59SwfNA69A+vTWqwmm4 IhE7wicoK60lLL0rn7OHcXv6uiOoM8696O/5KDc8= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 07365a3P110161 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 3 Aug 2020 01:05:36 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 3 Aug 2020 01:05:35 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 3 Aug 2020 01:05:35 -0500 Received: from a0230074-Latitude-E7470.ent.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 07365GRH018887; Mon, 3 Aug 2020 01:05:34 -0500 From: Faiz Abbas To: , , CC: Subject: [PATCH v2 07/13] arm: mach-k3: am6_init: Add support for USB boot mode Date: Mon, 3 Aug 2020 11:35:10 +0530 Message-ID: <20200803060516.20791-8-faiz_abbas@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200803060516.20791-1-faiz_abbas@ti.com> References: <20200803060516.20791-1-faiz_abbas@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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.102.3 at phobos.denx.de X-Virus-Status: Clean Add support for identifying USB host and device boot modes Signed-off-by: Faiz Abbas --- arch/arm/mach-k3/am6_init.c | 5 +++++ arch/arm/mach-k3/include/mach/am6_hardware.h | 2 ++ arch/arm/mach-k3/include/mach/am6_spl.h | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c index c6d4f05a01..9cb3086014 100644 --- a/arch/arm/mach-k3/am6_init.c +++ b/arch/arm/mach-k3/am6_init.c @@ -333,6 +333,11 @@ static u32 __get_primary_bootmedia(u32 devstat) CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT; if (port == 0x1) bootmode = BOOT_DEVICE_MMC2; + } else if (bootmode == BOOT_DEVICE_DFU) { + u32 mode = (devstat & CTRLMMR_MAIN_DEVSTAT_USB_MODE_MASK) >> + CTRLMMR_MAIN_DEVSTAT_USB_MODE_SHIFT; + if (mode == 0x2) + bootmode = BOOT_DEVICE_USB; } return bootmode; diff --git a/arch/arm/mach-k3/include/mach/am6_hardware.h b/arch/arm/mach-k3/include/mach/am6_hardware.h index a91ef5f735..1908a13f0f 100644 --- a/arch/arm/mach-k3/include/mach/am6_hardware.h +++ b/arch/arm/mach-k3/include/mach/am6_hardware.h @@ -25,6 +25,8 @@ #define CTRLMMR_MAIN_DEVSTAT_EMMC_PORT_SHIFT 14 #define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_MASK GENMASK(17, 17) #define CTRLMMR_MAIN_DEVSTAT_BKUP_MMC_PORT_SHIFT 12 +#define CTRLMMR_MAIN_DEVSTAT_USB_MODE_SHIFT 9 +#define CTRLMMR_MAIN_DEVSTAT_USB_MODE_MASK GENMASK(10, 9) #define WKUP_CTRL_MMR0_BASE 0x43000000 #define MCU_CTRL_MMR0_BASE 0x40f00000 diff --git a/arch/arm/mach-k3/include/mach/am6_spl.h b/arch/arm/mach-k3/include/mach/am6_spl.h index e97d8143c6..61e0380927 100644 --- a/arch/arm/mach-k3/include/mach/am6_spl.h +++ b/arch/arm/mach-k3/include/mach/am6_spl.h @@ -14,7 +14,8 @@ #define BOOT_DEVICE_I2C 0x05 #define BOOT_DEVICE_MMC2 0x06 #define BOOT_DEVICE_ETHERNET 0x07 -#define BOOT_DEVICE_USB 0x08 +#define BOOT_DEVICE_DFU 0x08 +#define BOOT_DEVICE_USB 0x408 #define BOOT_DEVICE_PCIE 0x09 #define BOOT_DEVICE_UART 0x0a #define BOOT_DEVICE_NAND 0x0c