From patchwork Thu May 16 03:18:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 1100275 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="bKxCN/bw"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 454HNc4MCcz9sNC for ; Thu, 16 May 2019 13:44:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6E65CC21C4A; Thu, 16 May 2019 03:19:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 040BCC21DB6; Thu, 16 May 2019 03:19:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B5609C21C6A; Thu, 16 May 2019 03:18:56 +0000 (UTC) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150089.outbound.protection.outlook.com [40.107.15.89]) by lists.denx.de (Postfix) with ESMTPS id 5B098C21C4A for ; Thu, 16 May 2019 03:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TIqugpkNPtsD4tJuglMoTxZFaJl6xb4La2TETF8mQd0=; b=bKxCN/bwPwO2yqsR70oNqZpmz++udarK4Ub2osmJrE/q53OUpMTE8hhPaR9915YLv/adwdKFfjZPjVpInZR0/tcpchd8XKDh3PzJ4Phk7UHhC6/8C9Or+p8smolv3NWanikoEdTmgLe4jFfFB1IKZWOp6q8vZMQShA2QtHgrOQM= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB6594.eurprd04.prod.outlook.com (20.179.255.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1878.24; Thu, 16 May 2019 03:18:54 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::3173:24:d401:2378]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::3173:24:d401:2378%6]) with mapi id 15.20.1878.024; Thu, 16 May 2019 03:18:54 +0000 From: Peng Fan To: "sbabic@denx.de" , "festevam@gmail.com" Thread-Topic: [PATCH 02/15] imx: i.MX7ULP: add get_boot_device Thread-Index: AQHVC5YXFpULxuQteEubdae+aoJEYA== Date: Thu, 16 May 2019 03:18:54 +0000 Message-ID: <20190516033236.10594-2-peng.fan@nxp.com> References: <20190516033236.10594-1-peng.fan@nxp.com> In-Reply-To: <20190516033236.10594-1-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.16.4 x-clientproxiedby: HK2PR0401CA0008.apcprd04.prod.outlook.com (2603:1096:202:2::18) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 531f691b-579d-45c8-2c8b-08d6d9ad399f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0PR04MB6594; x-ms-traffictypediagnostic: AM0PR04MB6594: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3826; x-forefront-prvs: 0039C6E5C5 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(376002)(366004)(346002)(396003)(199004)(189003)(2906002)(3846002)(66556008)(6116002)(8676002)(73956011)(81166006)(186003)(66476007)(6436002)(81156014)(66066001)(86362001)(6486002)(2616005)(11346002)(446003)(26005)(64756008)(7736002)(305945005)(6512007)(486006)(44832011)(476003)(316002)(66946007)(5660300002)(102836004)(256004)(8936002)(52116002)(54906003)(478600001)(1076003)(4326008)(71190400001)(71200400001)(36756003)(66446008)(14454004)(53936002)(110136005)(2501003)(386003)(68736007)(6506007)(76176011)(99286004)(25786009)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB6594; H:AM0PR04MB4481.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: qpikIOcEEXXH8HrvxfhYGjruhN5r/sfguJoF14DRNg33uYo9LF3E9F+H52iudtb7c2vgOKLTzEAFJqx0vps96my2Hba3zWHynSWo5lVscFdh6szRPmWdEL0ib92jXwSoJMb8weXfo+VkyGilZF4l3Rqa59snCwYzx+wrU45pN9Dk1lOix4cYuZ7TyHw34kEG6vrElqRzE9bAuygNMx3lB/v2dcNT07wbH2eWY0GcpZ2xNbaVk+pfivWhfetbmihSPDyfOVyxsJHB8cTBGbmKpG676d/3pLE+bdxAPlnf/QUUJwApnWWm2/CdXcF9sHwrQ3UfSlojFVbrAYbGiOpYfDvCDVWz3wr6FLtkgYz4YQi5qF3V2pts22c+lKZk1qB7XGhxol3DigiYwizfRdFjph2gJjFq4DumuH3pAf/95Q4= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 531f691b-579d-45c8-2c8b-08d6d9ad399f X-MS-Exchange-CrossTenant-originalarrivaltime: 16 May 2019 03:18:54.1514 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6594 Cc: "u-boot@lists.denx.de" , dl-uboot-imx Subject: [U-Boot] [PATCH 02/15] imx: i.MX7ULP: add get_boot_device X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Add get_boot_device for i.MX7ULP Signed-off-by: Peng Fan --- arch/arm/include/asm/arch-mx7ulp/imx-regs.h | 13 +++++++++++++ arch/arm/include/asm/arch-mx7ulp/sys_proto.h | 1 + arch/arm/mach-imx/mx7ulp/soc.c | 27 +++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/arch/arm/include/asm/arch-mx7ulp/imx-regs.h b/arch/arm/include/asm/arch-mx7ulp/imx-regs.h index 63b02de087..d58ed43199 100644 --- a/arch/arm/include/asm/arch-mx7ulp/imx-regs.h +++ b/arch/arm/include/asm/arch-mx7ulp/imx-regs.h @@ -10,6 +10,8 @@ #define ARCH_MXC +#define ROM_SW_INFO_ADDR 0x000001E8 + #define CAAM_SEC_SRAM_BASE (0x26000000) #define CAAM_SEC_SRAM_SIZE (SZ_32K) #define CAAM_SEC_SRAM_END (CAAM_SEC_SRAM_BASE + CAAM_SEC_SRAM_SIZE - 1) @@ -1112,6 +1114,17 @@ struct usbphy_regs { u32 usb1_pfda_ctrl1_tog; /* 0x14c */ }; +struct bootrom_sw_info { + u8 reserved_1; + u8 boot_dev_instance; + u8 boot_dev_type; + u8 reserved_2; + u32 core_freq; + u32 axi_freq; + u32 ddr_freq; + u32 rom_tick_freq; + u32 reserved_3[3]; +}; #define is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20))) #define disconnect_from_pc(void) writel(0x0, USBOTG0_RBASE + 0x140) diff --git a/arch/arm/include/asm/arch-mx7ulp/sys_proto.h b/arch/arm/include/asm/arch-mx7ulp/sys_proto.h index 6ecde7db93..0e4c8ad15d 100644 --- a/arch/arm/include/asm/arch-mx7ulp/sys_proto.h +++ b/arch/arm/include/asm/arch-mx7ulp/sys_proto.h @@ -17,4 +17,5 @@ enum bt_mode { SINGLE_BOOT /* LP_BT = 0, DUAL_BT = 0 */ }; +enum boot_device get_boot_device(void); #endif diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c index c72f0ed3fc..6015c11869 100644 --- a/arch/arm/mach-imx/mx7ulp/soc.c +++ b/arch/arm/mach-imx/mx7ulp/soc.c @@ -6,6 +6,7 @@ #include #include #include +#include #include static char *get_reset_cause(char *); @@ -244,3 +245,29 @@ int mmc_get_env_dev(void) return board_mmc_get_env_dev(devno); } #endif + +enum boot_device get_boot_device(void) +{ + struct bootrom_sw_info **p = + (struct bootrom_sw_info **)ROM_SW_INFO_ADDR; + + enum boot_device boot_dev = SD1_BOOT; + u8 boot_type = (*p)->boot_dev_type; + u8 boot_instance = (*p)->boot_dev_instance; + + switch (boot_type) { + case BOOT_TYPE_SD: + boot_dev = boot_instance + SD1_BOOT; + break; + case BOOT_TYPE_MMC: + boot_dev = boot_instance + MMC1_BOOT; + break; + case BOOT_TYPE_USB: + boot_dev = USB_BOOT; + break; + default: + break; + } + + return boot_dev; +}